@aiquants/markdown-explorer 0.12.1 → 0.14.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 +30 -1
- package/README.md +21 -12
- package/dist/EditSurface-BLlu5zEt.cjs +2 -0
- package/dist/EditSurface-CF2io496.js +705 -0
- package/dist/{ExplorerSplit-BjjqNRtj.js → ExplorerSplit-BPLECNpv.js} +109 -109
- package/dist/{ExplorerSplit-CqmbUSZ7.cjs → ExplorerSplit-Cjvy0JHP.cjs} +1 -1
- package/dist/{MultiLayout-BZbEl73E.cjs → MultiLayout-BjA0k-5n.cjs} +1 -1
- package/dist/{MultiLayout-BYXoD1aS.js → MultiLayout-D8F0BfxA.js} +25 -25
- package/dist/{NativeScrollBar-RP37nwmY.js → NativeScrollBar-BFF12oEd.js} +1 -1
- package/dist/{NativeScrollBar-B7jTbQmn.cjs → NativeScrollBar-BUWXPvTV.cjs} +1 -1
- package/dist/{TreeLayout-CEp5oKly.cjs → TreeLayout-CQUpgsxz.cjs} +1 -1
- package/dist/{TreeLayout-Uo6RG7lq.js → TreeLayout-rhyVTfrI.js} +3 -3
- package/dist/core/contracts.d.cts +7 -1
- package/dist/core/contracts.d.ts +7 -1
- package/dist/core/labels.d.cts +14 -1
- package/dist/core/labels.d.ts +14 -1
- package/dist/core/revalidation.d.cts +1 -2
- package/dist/core/revalidation.d.ts +1 -2
- package/dist/{dataRoute-CH3yOKR0.cjs → dataRoute-BONacTPi.cjs} +1 -1
- package/dist/{dataRoute-Pm_0ue_4.js → dataRoute-CObbjNxG.js} +14 -12
- package/dist/index-Dn7cYy-4.cjs +13 -0
- package/dist/index-v997iKxe.js +3464 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/{location-BUNWJ4eB.cjs → location-D6RE3wAN.cjs} +1 -1
- package/dist/{location-DWd6SQhN.js → location-IRD9h42r.js} +1 -1
- package/dist/{merge-DRGBbLuR.cjs → merge-BFk7nT59.cjs} +1 -1
- package/dist/{merge-q-5i8qsn.js → merge-Bi2VedIr.js} +1 -1
- package/dist/{sanitizePolicy-djLC3fRN.js → sanitizePolicy-DlrakwA4.js} +1 -1
- package/dist/{sanitizePolicy-BfUlXI5E.cjs → sanitizePolicy-DrIMuYCb.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +3 -0
- package/dist/server/ports.d.ts +3 -0
- package/dist/server.cjs +1 -1
- package/dist/server.js +93 -83
- package/dist/styles/markdown-explorer.css +1 -1
- package/docs/behavior/dom-hooks.md +6 -5
- package/docs/behavior/layout.md +10 -3
- package/package.json +6 -5
- package/dist/EditSurface-By6NPcD7.js +0 -633
- package/dist/EditSurface-BztcpQPW.cjs +0 -2
- package/dist/index-CGBl3fYT.cjs +0 -13
- package/dist/index-CjCr8czx.js +0 -3356
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),c=require("react"),X=require("react-router"),B=require("./location-D6RE3wAN.cjs"),N=require("./dataRoute-BONacTPi.cjs"),de=require("@aiquants/markdown"),qe=require("@aiquants/markdown/source-lines"),jn=require("@aiquants/markdown/viewer-settings"),Q=require("./storage-Dgi4JXaB.cjs"),Mn=require("@aiquants/route-revalidation");function Nn(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 E=Nn(c),Be=Object.freeze(["en","ja"]),Ot="en",At=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"])}),Dn=/\{(\w+)\}/gu,Lt={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",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}`,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",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.",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.",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",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)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",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",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"},Pn={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:"エディタとプレビューを並べて表示",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}`,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:"後に",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:"エクスプローラーで文書を選んでください。",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:"このファイルはここでは表示できません。ダウンロードして開いてください。",viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",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:"カスタム",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},jt=Object.freeze({en:Object.freeze(Lt),ja:Object.freeze(Pn)}),Ge=Object.freeze(Object.keys(Lt)),_n=new Set(Ge),$n=e=>_n.has(e),we=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,Mt=e=>{if(e===void 0)return Ot;if(Be.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${Be.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${we(e)}`)},Ie=(e,t)=>{const n=jt[Mt(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${we(t)}`);if(!B.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${we(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!$n(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${Ge.join(", ")}`);const i=r[s];if(i===void 0)continue;const u=typeof n[s];if(typeof i!==u)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${u}; got ${we(i)}`);if(typeof i=="string"&&i.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const v=At[s];if(typeof i=="string"&&v!==void 0){for(const[,m]of i.matchAll(Dn))if(!v.includes(m??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(m)}}; it accepts ${v.map(f=>`{${f}}`).join(", ")}`)}o[s]=i}return Object.freeze(o)},Fn=(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]))},He=Object.freeze(["light","dark"]),qn=e=>{if(e===void 0)return"light";if(He.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${He.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},Nt=c.createContext(null),P=()=>{const e=c.use(Nt);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},ue=e=>{const{viewSettings:t}=P(),n=()=>e(t.getSnapshot());return c.useSyncExternalStore(t.subscribe,n,n)},Se=()=>{const{config:e}=P(),t=X.useParams()["*"],[n]=X.useSearchParams(),r=n.toString();return c.useMemo(()=>B.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Dt={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"]},te=(e,t)=>e[Dt[t][0]],le=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=P(),s=te(o,e.reason),i=o[Dt[e.reason][1]],u=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":u,"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]})},Bn=(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 te(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(te(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},In=(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(te(e,t.failure.reason));case"idle":case"saving":return null}},ae=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},Pt="<<<<<<<",_t="=======",$t=">>>>>>>",ot=(e,t)=>e===t||e.startsWith(`${t} `),st=e=>Ft(e.split(`
|
|
2
|
+
`)),Ft=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||(ot(s,Pt)?(n=o,r=null):s===_t?n!==null&&r===null?r=o:n=null:ot(s,$t)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},lt=e=>e.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,Me=e=>e.replace(/\r\n?/gu,`
|
|
6
|
+
`),Hn=(e,t)=>t===`
|
|
7
|
+
`?e:e.replaceAll(`
|
|
8
|
+
`,`\r
|
|
9
|
+
`),Vn=3,Ne=Object.freeze({kind:"idle"}),it=Object.freeze({kind:"draft"}),Un=({data:e,conflictLabels:t,onSaveSettled:n,sideBySideSetting:r})=>{const o=new Map,s=new Map,i=new Map,u=new Map,v=new Map,m=ae();let f=null,g=null;const p=(a,d)=>{a.value={...a.value,...d},m.emit()},y=(a,d)=>o.get(a)===d,L=async(a,d)=>{d.controller.abort(),d.controller=new AbortController;const{signal:h}=d.controller;p(d,{phase:{kind:"opening"}});const x=await e.edit(a,h);if(!y(a,d)||h.aborted||!("kind"in x))return;if(x.kind==="grant"){p(d,{phase:{kind:"grant",href:x.href}});return}if(x.kind==="failure"){p(d,{phase:{kind:"failed",failure:x.failure}});return}const T=Me(x.text),j=x.kind==="draft";d.base={text:T,version:j?null:x.version},d.draft=T,d.ending=lt(x.text),p(d,{phase:{kind:"editing"},history:j?!1:x.history,dirty:!1,save:j?it:Ne,generation:d.value.generation+1})},S=a=>{const d=o.get(a);d!==void 0&&(d.controller.abort(),o.delete(a),i.delete(a))},R=(a,d,h)=>(a.set(d,h),()=>{a.get(d)===h&&a.delete(d)}),M=(a,d,h,x={})=>{p(d,{...x,save:h}),n(a,h)},C=async a=>{u.get(a)?.flush();const d=o.get(a);if(d===void 0||d.value.phase.kind!=="editing"||d.base===null||d.value.save.kind==="saving")return;const{version:h}=d.base;if(h===null){n(a,it);return}const x=st(d.draft).length;if(x>0){M(a,d,{kind:"conflicts",count:x});return}d.controller.abort(),d.controller=new AbortController;const{signal:T}=d.controller;let j={text:d.base.text,version:h},A=d.draft,D=!1;p(d,{save:{kind:"saving"}});for(let q=0;q<Vn;q+=1){const F=await e.save(a,j.version,Hn(A,d.ending),T);if(!y(a,d)||T.aborted||!("kind"in F))return;if(F.kind==="saved"){u.get(a)?.flush(),d.base={text:A,version:F.version},M(a,d,{kind:"saved",merged:D},{dirty:d.draft!==A});return}if(F.kind==="grant"){M(a,d,{kind:"grant",href:F.href});return}if(F.kind==="failure"){M(a,d,{kind:"failed",failure:F.failure});return}const{mergeDraft:Z}=await Promise.resolve().then(()=>require("./merge-BFk7nT59.cjs"));if(!y(a,d)||T.aborted)return;const W=u.get(a);W?.flush();const K=Me(F.text),I=Z(j.text,d.draft,K,t());if(j={text:K,version:F.version},d.base=j,d.ending=lt(F.text),d.draft=I.text,W?.adopt(I.text),I.kind==="conflicts"){M(a,d,{kind:"conflicts",count:I.conflicts},{dirty:!0,generation:d.value.generation+1});return}if(D=!0,A=I.text,A===j.text){M(a,d,{kind:"saved",merged:D},{dirty:!1,generation:d.value.generation+1});return}p(d,{dirty:!0,generation:d.value.generation+1})}M(a,d,{kind:"failed",failure:{reason:"failed"}})};return{session:a=>o.get(a)?.value,subscribe:m.subscribe,start:(a,d)=>{const h=o.get(a);if(h!==void 0){p(h,{request:{anchor:d},view:"editor"}),(h.value.phase.kind==="failed"||h.value.phase.kind==="grant")&&L(a,h);return}s.delete(a);const x={value:{path:a,phase:{kind:"opening"},view:"editor",previewPrepared:!1,history:!1,dirty:!1,save:Ne,generation:0,request:{anchor:d}},base:null,draft:"",ending:`
|
|
10
|
+
`,controller:new AbortController};o.set(a,x),L(a,x)},retry:a=>{const d=o.get(a);d===void 0||d.value.phase.kind==="editing"||L(a,d)},draft:a=>{const d=o.get(a);return d===void 0||d.base===null?null:d.draft},setDraft:(a,d)=>{const h=o.get(a);if(h===void 0||h.base===null)return;h.draft=d;const x={},T=d!==h.base.text;T!==h.value.dirty&&(x.dirty=T);const{save:j}=h.value;if(j.kind==="conflicts"){const A=st(d).length;A===0?x.save=Ne:A!==j.count&&(x.save={kind:"conflicts",count:A})}(x.dirty!==void 0||x.save!==void 0)&&p(h,x)},consumeRequest:a=>{const d=o.get(a);d!==void 0&&d.value.request!==null&&p(d,{request:null})},save:C,replaceDraft:(a,d)=>{const h=u.get(a);h?.flush();const x=o.get(a);if(x===void 0||x.base===null)return;const T=Me(d);x.draft=T,h?.adopt(T),p(x,{dirty:T!==x.base.text,generation:x.value.generation+1})},close:a=>{if(!o.has(a))return;const d=u.get(a),h=d===void 0?null:d.returnPoint();S(a),h===null?s.delete(a):s.set(a,h),m.emit()},takeReturn:a=>{const d=s.get(a)??null;return s.delete(a),d},dirtyPaths:()=>[...o.values()].filter(a=>a.value.dirty).map(a=>a.value.path),discard:a=>{for(const d of a)S(d);a.length>0&&m.emit()},editorState:{get:a=>i.get(a),set:(a,d)=>{o.has(a)&&i.set(a,d)}},bindEditor:(a,d)=>R(u,a,d),bindView:(a,d)=>R(v,a,d),viewAnchor:a=>{const d=v.get(a);return d===void 0?null:d.anchor()},flush:a=>u.get(a)?.flush(),flushDrafts:()=>{for(const a of u.values())a.flush()},nextConflict:a=>u.get(a)?.nextConflict()===!0,hasSessions:()=>o.size>0,unsavedAmong:a=>{for(const d of u.values())d.flush();return a.filter(d=>o.get(d)?.value.dirty===!0)},askToDiscard:a=>new Promise(d=>{g?.settle(!1);const h={paths:a,settle:x=>{if(g===h){if(g=null,x)for(const T of a)S(T);m.emit(),d(x)}}};g=h,m.emit()}),discardRequest:()=>g,sideBySide:()=>(f??=r.read(),f),setSideBySide:a=>{f!==a&&(f=a,r.write(a),m.emit())},setView:(a,d)=>{const h=o.get(a);h===void 0||h.value.view===d||(u.get(a)?.beforeView(d),p(h,{view:d,previewPrepared:h.value.previewPrepared||d==="preview"}))},preparePreview:a=>{const d=o.get(a);d!==void 0&&!d.value.previewPrepared&&p(d,{previewPrepared:!0})}}},ke=e=>{e.preventDefault(),e.stopPropagation()},qt=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:i,testId:u})=>{const v=c.useRef(null),m=c.useRef(null),f=c.useRef(null),g=c.useId(),p=c.useId();c.useLayoutEffect(()=>{const S=v.current;if(S!==null)if(e&&!S.open){const R=S.ownerDocument.activeElement;f.current=R instanceof HTMLElement?R:null,S.showModal(),m.current?.focus()}else!e&&S.open&&(S.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[e]);const y=S=>{S.key!=="Escape"||S.defaultPrevented||(ke(S),i())},L=S=>{S.target===S.currentTarget&&i()};return l.jsx("dialog",{ref:v,className:"aqmx-confirm","aria-labelledby":g,"aria-describedby":p,"data-testid":u,onKeyDown:y,onClick:L,onCancel:S=>S.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:g,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:p,className:"aqmx-confirm-body",children:n}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{ref:m,type:"button",className:"aqmx-callout-action","data-testid":`${u}-cancel`,onClick:i,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${u}-confirm`,onClick:s,children:r})]})]})})},zn=(e,t)=>{const n=X.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(n===null)return new Set;const{location:r}=B.resolveExplorerLocation(e,n.params["*"],new URLSearchParams(t.search));switch(r.view){case"tree":return new Set(r.doc===null?[]:[r.doc]);case"single":return new Set([r.doc]);case"multi":return new Set(r.docs)}},Bt=e=>{const{edits:t}=P(),n=c.useCallback(()=>t.session(e),[t,e]);return c.useSyncExternalStore(t.subscribe,n,Zn)},It=()=>!1,Zn=()=>{},Gn=()=>{const{edits:e}=P();return c.useSyncExternalStore(e.subscribe,e.hasSessions,It)},Ht=()=>{const{edits:e}=P();return c.useSyncExternalStore(e.subscribe,e.sideBySide,It)},Kn=()=>null,Wn=()=>{const{edits:e,labels:t,config:n}=P(),r=c.useRef([]),o=c.useCallback(({nextLocation:p})=>{const y=zn(n,p);return e.flushDrafts(),r.current=e.dirtyPaths().filter(L=>!y.has(L)),r.current.length>0},[e,n]),s=X.useBlocker(o),i=Gn();c.useEffect(()=>{if(!i)return;const p=y=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(y.preventDefault(),y.returnValue=!0)};return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[i,e]);const u=c.useSyncExternalStore(e.subscribe,e.discardRequest,Kn),v=s.state==="blocked",m=v?r.current:u===null?[]:u.paths,f=m.map(p=>N.lastPathSegment(p)).join(", "),g=m.length>0&&m.every(p=>e.session(p)?.save.kind==="draft");return l.jsx(qt,{open:v||u!==null,title:g?t.draftDiscardTitle:t.unsavedTitle,body:g?t.draftDiscardBody(f):t.unsavedBody(f),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(s.state==="blocked"){e.discard(r.current),s.proceed();return}u?.settle(!0)},onCancel:()=>{if(s.state==="blocked"){s.reset();return}u?.settle(!1)}})};function Xn({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Yn=E.forwardRef(Xn);let De=null;const Vt=()=>(De??=Promise.resolve().then(()=>require("./EditSurface-BLlu5zEt.cjs")).catch(e=>{throw De=null,e}),De),Qn=()=>{Vt().catch(()=>{})},Jn=e=>{const{default:t}=c.use(Vt());return l.jsx(t,{...e})};class er extends c.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 Ke=`[${qe.SOURCE_LINES_ATTRIBUTE}]`,tr="[data-aqmd-content]",nr='a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg',rr=200,fe=e=>qe.parseSourceLines(e.getAttribute(qe.SOURCE_LINES_ATTRIBUTE)),or=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=fe(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(Ke)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=fe(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},sr=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Ut=e=>e.closest(tr)!==null&&e.closest(nr)===null,zt=(e,t,n)=>{const r=or(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const u=r.lines.last+1;return{lines:{first:u,last:u},word:null,occurrence:0,clientTop:Ee(e)}}const i=lr(o,n);return i===null?{lines:r.lines,word:null,occurrence:0,clientTop:Ee(o)}:{lines:r.lines,word:i.text,occurrence:i.occurrence,clientTop:i.clientTop}},Zt=(e,t)=>{let n=null,r=null,o=null;for(const i of e.querySelectorAll(Ke)){const u=fe(i);if(u===null)continue;n??=Kt(t,i);const{top:v,bottom:m}=i.getBoundingClientRect();v<=n&&n<m?r={lines:u,block:i}:o===null&&v>=n&&(o={lines:u,block:i})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:Ee(s.block)}},Gt=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Kt=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return Gt(e)+(Number.isFinite(n)?n:0)},lr=(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>rr||/[\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:sr(o.toString(),r),clientTop:n.getBoundingClientRect().top}},ir=(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 u=r;u<=o;u+=1){const v=n[u-1]??"";for(let m=v.indexOf(t.word);m>=0;m=v.indexOf(t.word,m+t.word.length)){if(i===t.occurrence)return{line:u,column:m};i+=1}}return i>0?ar(n,r,o,t.word)??s:s},ar=(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},Wt=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(Ke)){const s=fe(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},Xt=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=Ee(e),o=fe(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},Ee=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:u}=s.getBoundingClientRect();if(u>0)return i}return e.getBoundingClientRect().top},We=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})}),cr=e=>We[e],pe=()=>{const e=X.useNavigate();return c.useCallback((t,n)=>{e(t,We[n])},[e])},Yt=({navigation:e,...t})=>l.jsx(X.Link,{...t,...We[e]}),Xe=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},Qt=(e,t)=>{const n=c.useRef(null),r=c.useRef(null),o=c.useRef(null),s=c.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);c.useEffect(()=>s,[s]);const i=c.useCallback(m=>{if(r.current!==m)return;const f=o.current;if(f!==null){f.then(()=>i(m));return}e.prefetch(m);const g=e.peek(m);if(g?.status!=="pending")return;const p=Promise.allSettled([g.promise]);o.current=p,p.then(()=>{o.current===p&&(o.current=null)})},[e]),u=c.useCallback(m=>{const f=t(m);f!==r.current&&(s(),f!==null&&(r.current=f,n.current=window.setTimeout(()=>{n.current=null,i(f)},B.PREFETCH_DWELL_MS)))},[s,t,i]),v=c.useCallback(m=>{t(m)!==r.current&&s()},[s,t]);return c.useMemo(()=>({onPointerOver:m=>u(m.target),onPointerOut:m=>v(m.relatedTarget),onFocus:m=>u(m.target),onBlur:m=>v(m.relatedTarget)}),[u,v])},dr=c.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-BUWXPvTV.cjs")).then(e=>({default:e.NativeScrollBar})));class ur extends c.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 Jt=({scroller:e,withCircle:t})=>l.jsx(ur,{children:l.jsx(c.Suspense,{fallback:null,children:l.jsx(dr,{scroller:e,withCircle:t})})}),en=e=>l.jsx(Jt,{scroller:e,withCircle:!0}),tn=()=>{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()]}},be=(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)=>be(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)&&be(n[s],r[s]))},me=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},nn=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),ve=e=>e.status==="fulfilled"?e.value:void 0,fr=55e3,at=Object.freeze({status:"deferred"}),ct=Object.freeze({status:"refreshed"}),Pe=Object.freeze({status:"superseded"}),re=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,rn=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",mr=({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=tn(),o=ae(),s=new WeakSet;let i=0;const u=o.emit,v=()=>(i+=1,i),m=()=>{if(!(n.size<=t))for(const a of[...n.keys()]){if(n.size<=t)return;r.isHeld(a)||n.delete(a)}},f=(a,d)=>{n.delete(a),n.set(a,d)},g=a=>performance.now()-a.validatedAt>=fr,p=(a,d,h)=>{const x=n.get(a),T=re(x?.snapshot),j=h||x?.refreshPending===!0,A=me(e.document(a,{refresh:j}).then(q=>({status:"loaded",document:q}))),D={snapshot:{status:"pending",promise:A,previous:T},validatedAt:performance.now(),opened:d,background:null,refreshPending:!1,seeded:void 0,stamp:v()};return f(a,D),m(),A.then(q=>{n.get(a)===D&&(D.snapshot=q,D.stamp=v(),u())}),D},y=(a,d,h,x,T,j)=>{d.background===h&&(d.background=null,!(n.get(a)!==d||d.snapshot!==x)&&(T.kind==="failure"&&x.document.kind!=="failure"||(d.validatedAt=j,d.stamp=v(),be(x.document,T)||(d.snapshot={status:"loaded",document:T}),u())))},L=async(a,d)=>{const h=d.snapshot;if(h.status!=="loaded")return null;const x={};d.background=x;const T=performance.now(),j=e.document(a,{refresh:d.refreshPending});d.refreshPending=!1;const A=await j,D=d.background===x&&n.get(a)===d&&d.snapshot===h;return y(a,d,x,h,A,T),D?A:null},S=(a,d)=>{const{snapshot:h}=d;return h.status==="pending"?!1:h.status==="loaded"&&h.document.kind!=="failure"?(L(a,d),!1):(h.status==="loaded"&&s.add(h),p(a,!0,!1),!0)},R=a=>{const d=r.hold(a);let h=!1;return()=>{if(h)return;h=!0,d();const x=n.get(a);x!==void 0&&f(a,x),m()}};return{peek:a=>n.get(a)?.snapshot,peekSeeded:a=>n.get(a)?.seeded,answerStampOf:a=>n.get(a)?.stamp,prefetch:a=>{const d=n.get(a);d!==void 0&&d.snapshot.status!=="deferred"||(p(a,!1,!1),u())},open:a=>{const d=r.resumes(a),h=R(a),x=n.get(a);if(x===void 0||x.snapshot.status==="deferred")return p(a,!0,!1),u(),h;if(f(a,x),d)return h;const{snapshot:T}=x;return T.status==="pending"?(x.opened=!0,h):T.document.kind==="failure"?(x.opened||g(x)?(s.add(T),p(a,!0,!1),u()):x.opened=!0,h):(x.opened=!0,x.background===null&&g(x)&&L(a,x),h)},retain:R,retry:a=>{const d=n.get(a);d===void 0||d.snapshot.status!=="loaded"||d.snapshot.document.kind!=="failure"||(p(a,!0,!1),u())},seed:(a,d)=>{const h=performance.now(),x=me(d.then(q=>q===null?at:{status:"loaded",document:q},()=>at)),T=n.get(a);if(T!==void 0&&T.snapshot.status==="loaded"){const q=T.snapshot,F={};T.background=F,x.then(Z=>{if(Z.status==="loaded"){y(a,T,F,q,Z.document,h);return}T.background===F&&(T.background=null)});return}const j=T!==void 0&&T.snapshot.status==="pending"?T.snapshot.previous:null,A={status:"pending",promise:x,previous:j},D={snapshot:A,validatedAt:h,opened:T?.opened===!0,background:null,refreshPending:T?.refreshPending===!0,seeded:A,stamp:v()};f(a,D),m(),x.then(q=>{n.get(a)===D&&(q.status==="deferred"&&r.isHeld(a)?p(a,D.opened,!1):(D.snapshot=q,D.stamp=v()),u())})},invalidate:()=>{let a=!1;for(const[d,h]of[...n]){if(h.validatedAt=Number.NEGATIVE_INFINITY,h.opened=!0,h.refreshPending=!0,!r.isHeld(d))continue;const{snapshot:x}=h;if(x.status!=="pending"){S(d,h)&&(a=!0);continue}x.promise.then(()=>{n.get(d)===h&&h.refreshPending&&r.isHeld(d)&&S(d,h)&&u()})}a&&u()},refresh:async a=>{const d=n.get(a);if(d!==void 0&&rn(d.snapshot)){d.refreshPending=!0;const x=await L(a,d);return x===null?Pe:x.kind==="failure"?{status:"failed",failure:x.failure}:ct}const h=p(a,!0,!0);return u(),h.snapshot.status!=="pending"?Pe:(await h.snapshot.promise,n.get(a)===h?ct:Pe)},clear:()=>{n.clear();for(const a of r.heldKeys())p(a,!0,!1);u()},subscribe:o.subscribe,noteFailureShown:a=>s.has(a)?!1:(s.add(a),!0)}};function pr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 hr=E.forwardRef(pr);function vr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 gr=E.forwardRef(vr);function wr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 xr=E.forwardRef(wr),Er=2e3,dt=Object.freeze({outcome:"idle"}),br=e=>{const t=navigator.clipboard;return t===void 0?Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")):t.writeText(e)},yr=({text:e})=>{const{announcer:t,labels:n}=P(),[r,o]=c.useState(dt);c.useEffect(()=>{if(r.outcome==="idle")return;const v=setTimeout(()=>o(dt),Er);return()=>clearTimeout(v)},[r]);const s=v=>{o({outcome:v}),t.announce(v==="copied"?n.copiedText:n.copyTextFailed)},i=()=>{br(e).then(()=>s("copied"),()=>s("failed"))},u=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:u,onClick:i,"data-aqmx-copy-outcome":r.outcome,"data-testid":"markdown-explorer-file-copy",children:r.outcome==="copied"?l.jsx(hr,{}):r.outcome==="failed"?l.jsx(xr,{}):l.jsx(gr,{})})},ie=c.createContext("fill"),Sr=Object.freeze({blockSize:"100%"}),he=({scrollerProps:e,children:t})=>c.use(ie)==="content"?l.jsx(de.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(de.HostedScrollArea,{scrollerProps:{...e,style:Sr},rowClassName:"aqmx-document-scroll-row",renderScrollBar:en,children:t});function kr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 Rr=E.forwardRef(kr);function Tr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 Cr=E.forwardRef(Tr),Re=({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(Cr,{})}),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(Rr,{})})]})};function Or({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Ar=E.forwardRef(Or),Lr=Object.freeze({className:"aqmx-document-stage"}),jr=({document:e})=>{const{labels:t}=P();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(Re,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Ar,{})}),l.jsx(he,{scrollerProps:Lr,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})]})})]})},Te="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",Mr=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},Nr=/(%[0-9A-Fa-f]{2})/u,Ye=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(Nr).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))},on=e=>`#${encodeURIComponent(e)}`,Dr=e=>{if(e==="#")return!0;const t=Ye(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},sn=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Pr="http://www.w3.org/1999/xhtml",ut=(e,t)=>{if(t==="")return null;const n=sn(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Pr&&r.getAttribute("name")===t)return r;return null},ln=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=ut(e,t.slice(1));if(n!==null)return n;const r=Ye(t);return r===null?null:ut(e,r)},ft=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"},_r=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"},$r=(e,t)=>{const n=t.closest(Te),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&ft(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:i}=e.ownerDocument;for(let u=e.parentElement;u!==null&&u!==s;u=u.parentElement)if(ft(u)&&u.scrollHeight>u.clientHeight&&u.clientHeight<o)return u;return i instanceof Element&&_r(e.ownerDocument)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o?i:r},Fr=Object.freeze({scrollerOf:$r,reveal:e=>{e.scrollIntoView(Ve)}}),Ve=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),qr=(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")}}},Br=(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(),u=i.height+s+Number.parseFloat(o)>e.clientHeight;if(!u&&Math.abs(i.top-s-n)<1){t.scrollIntoView(Ve);return}e.scrollBy({top:u?i.top-n-e.clientHeight:i.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(Ve)},Ir=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(Te)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},mt=(e,t,n)=>{if(e===null)return null;const r=ln(e,t);return r===null?(Dr(t)&&Ir(e,n),null):(qr(e,r),Br(n.scrollerOf(e,r),r),n.reveal(r),r)};function Hr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Vr=E.forwardRef(Hr);function Ur({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 zr=E.forwardRef(Ur);function Zr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 Gr=E.forwardRef(Zr);function Kr({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Wr=E.forwardRef(Kr),Ue="data-aqmx-key-repeat",ye=Object.freeze({[Ue]:"allow"}),Xr=`[${Ue}="${ye[Ue]}"]`,Yr=()=>{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(Xr)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},xe=Object.freeze([1/B.GOLDEN_RATIO**2,1/B.GOLDEN_RATIO,1,B.GOLDEN_RATIO,B.GOLDEN_RATIO**2]),pt=Object.freeze({mode:"fit"}),Qr=1,Jr=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),an=c.createContext(null),eo=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=Qr?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,ht=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<xe.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?xe.findIndex(o=>o>t):xe.findLastIndex(o=>o<t);return r===-1?null:r},vt=(e,t,n)=>{if(e.mode==="level"){const o=ht(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=ht(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},to=e=>{const t=xe[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},gt=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},no=({document:e})=>{const{labels:t}=P(),n=c.use(an),[r]=c.useState(()=>n===null?null:n.read(e.url)),[o,s]=c.useState(r===null?pt:r.zoom),[i,u]=c.useState(r===null?null:r.reported),[v,m]=c.useState(null),f=c.useRef(null),g=c.useCallback(C=>{const{naturalWidth:a,naturalHeight:d}=C;u(h=>gt(h,a,d))},[]),p=c.useCallback(C=>{f.current=C,!(C===null||!C.complete)&&(C.naturalWidth>0||C.naturalHeight>0?g(C):C.decode().then(()=>g(C),()=>{}))},[g]);c.useEffect(()=>{n!==null&&i!==null&&n.save(e.url,{zoom:o,reported:i})},[n,e.url,o,i]),c.useLayoutEffect(()=>{const C=f.current;if(C===null||i===null||o.mode!=="fit")return;const a=()=>m(h=>gt(h,C.clientWidth,C.clientHeight));if(a(),typeof ResizeObserver>"u")return;const d=new ResizeObserver(a);return d.observe(C),()=>d.disconnect()},[i,o.mode]);const y=i===null||v===null?null:eo(i,v),L=vt(o,y,-1),S=vt(o,y,1),R=o.mode==="level"?to(o.index):null,M=o.mode==="level"&&R!==null?{width:`${o.base.width*R}px`,height:`${o.base.height*R}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(Re,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Wr,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":L===null,onClick:()=>{L!==null&&s(L)},...ye,children:l.jsx(zr,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:R===null?t.imageFitLevel:t.imageZoomLevel(Math.round(R*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":S===null,onClick:()=>{S!==null&&s(S)},...ye,children:l.jsx(Gr,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(pt),children:l.jsx(Vr,{})})]}),l.jsx(he,{scrollerProps:Jr,children:l.jsx("img",{ref:p,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:M,onLoad:C=>g(C.currentTarget),"data-testid":"markdown-explorer-image"})})]})},cn=c.createContext(null),Ce=c.createContext(void 0),dn=c.createContext(null),Oe=()=>{const e=c.use(cn);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},ro=()=>{const e=c.use(dn);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},Ae=(e,t,n,r)=>t.kind==="panel"?B.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?B.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):B.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),oo=({children:e})=>{const{config:t}=P(),n=Oe(),r=Se(),o=r.kind==="location"?r.location.source:void 0,s=X.useHref(Ae(t,n.navigation,o,n.currentPath));return l.jsx(Ce,{value:o,children:l.jsx(dn,{value:s,children:e})})},so='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',lo=e=>{const t=e instanceof Element?e.closest(so):null;return t===null?null:t.getAttribute("data-doc-path")},Le=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,io=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:i,scope:u,children:v})=>{const m=X.useHref(e),f=g=>{if(Le(g)){if(g.preventDefault(),t===u.currentPath&&n!==""){u.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:f,children:v})},ao=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:i}=P(),u=Oe(),v=c.use(Ce),m=Mr(e),{navigation:f}=u,g=`${Ae(i,f,v,t)}${m}`,p=n===!1?"false":void 0;return f.kind==="page"?l.jsx(Yt,{...o,to:g,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":p,children:s}):l.jsx(io,{to:g,docPath:t,fragment:m,exists:p,className:r,attributes:o,onDocumentLink:f.onDocumentLink,scope:u,children:s})},co=({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,")"]})]})},uo=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=P(),i=c.use(Ce),u=X.useHref(`${Ae(s,r.navigation,i,r.currentPath)}${e}`),v=m=>{Le(m)&&(m.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:u,className:t,onClick:v,children:o})},fo=({href:e,className:t,attributes:n,children:r})=>{const o=Oe();if(o.navigation.kind==="page"){const s=i=>{if(!Le(i))return;const u=i.currentTarget;e==="#"?o.followEmptyFragment(i.nativeEvent):u.href===u.ownerDocument.URL&&o.followSameUrlJump(e,i.nativeEvent)};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(uo,{href:e,className:t,attributes:n,scope:o,children:r})},mo=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:i})=>t==="doc"?n===void 0||!N.isAcceptableDocumentPath(n)?l.jsx(co,{className:o,attributes:s,children:i}):l.jsx(ao,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:i}):e.startsWith("#")?l.jsx(fo,{href:e,className:o,attributes:s,children:i}):l.jsx("a",{...s,href:e,className:o,children:i}),po=()=>{const{config:e}=P(),t=Oe(),n=c.use(Ce),r=pe();return c.useCallback((o,s)=>{if(!Le(s))return!0;s.preventDefault();const i=on(o.id),{navigation:u}=t;return u.kind==="panel"||Ye(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(i),!0):(r(`${Ae(e,u,n,t.currentPath)}${i}`,"follow-link"),!0)},[e,t,n,r])},ho=()=>{const e=ro();return c.useCallback(t=>`${e}${on(t.id)}`,[e])};function vo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 go=E.forwardRef(vo);function wo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 xo=E.forwardRef(wo);function Eo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 bo=E.forwardRef(Eo),yo=Object.freeze({className:"aqmx-document-stage"}),So=e=>{switch(e){case"video":return l.jsx(xo,{});case"audio":return l.jsx(bo,{});case"pdf":return l.jsx(go,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},ko=({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("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},Ro=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(Re,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:So(e.mediaType)}),l.jsx(he,{scrollerProps:yo,children:l.jsx(ko,{document:e})})]}),To=e=>({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,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidRetry:e.viewerMermaidRetry,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame}),un=(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},fn=(e,t)=>e!==void 0?e:t!==void 0?t:jn.DEFAULT_CONTENT_ALIGN,Qe=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),Co=(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 B.explorerHref(e,{...t,overrides:r})},Je=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:i,children:u})=>{const v=c.use(ie);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":v,className:"aqmx-document",...i,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,u]})},Oo=()=>{const{labels:e}=P();return l.jsx(Je,{kind:"empty",label:e.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:e.documentEmpty})})})},mn=({label:e})=>{const{labels:t}=P();return l.jsxs(Je,{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:Qe.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},wt=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),Ao=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=P(),i=c.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),u=po(),v=ho(),m=c.useMemo(()=>o===void 0?void 0:h=>o(e,h),[o,e]),f=c.useRef(null),{editable:g,doubleClick:p,region:y,paneScroll:L,stale:S}=r;c.useLayoutEffect(()=>{if(g)return s.bindView(e,{anchor:()=>{const h=f.current,x=y(),T=h===null?null:h.querySelector(Te);return h===null||x===null||T===null?null:Zt(h,L.scrollerOf(x,T))}})},[s,e,g,y,L]);const R=h=>{const x=f.current,{target:T}=h;!p||x===null||!(T instanceof Element)||!Ut(T)||(h.stopPropagation(),s.start(e,zt(T,x,x.ownerDocument.getSelection())))},M=c.useRef(null),C=c.useRef(S);c.useLayoutEffect(()=>{C.current=S});const a=c.useEffectEvent(h=>{const x=f.current,T=y(),j=x===null?null:Wt(x,h.line);if(T===null||j===null)return!1;const A=L.scrollerOf(T,j);return A.scrollTop+=Xt(j,h.line)-h.clientTop,!0}),d=c.useEffectEvent(h=>{const x=y();if(x===null)return;const T=()=>{for(const A of wt)x.removeEventListener(A,j,!0);M.current?.release===T&&(M.current=null)},j=()=>T();for(const A of wt)x.addEventListener(A,j,{capture:!0,passive:!0});M.current={point:h,release:T}});return c.useLayoutEffect(()=>{const h=s.takeReturn(e);if(h!==null)return queueMicrotask(()=>{a(h)&&C.current&&d(h)}),()=>M.current?.release()},[s,e]),c.useLayoutEffect(()=>{const h=M.current;h===null||S||(h.release(),a(h.point))},[t,S]),l.jsx("div",{ref:f,className:"aqmx-document-viewer",onDoubleClick:R,children:l.jsx(de.MarkdownViewer,{...n,onHeadingSelect:u,headingHref:v,onMathDiagnostics:m,parseResult:i,content:null})})},pn=({document:e,viewer:t})=>{const{labels:n}=P();return l.jsxs(l.Fragment,{children:[l.jsx(Re,{name:e.name,openUrl:N.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:l.jsx(Yn,{}),children:e.truncated?null:l.jsx(yr,{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(de.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},Lo=({path:e,name:t,viewer:n})=>{const{data:r,documents:o,announcer:s,labels:i}=P(),u=c.useCallback(()=>o.answerStampOf(e),[o,e]),v=c.useSyncExternalStore(o.subscribe,u,u),[m,f]=c.useState(0),g=c.useMemo(()=>({path:e,stamp:v,attempt:m}),[e,v,m]),[p,y]=c.useState(null),L=c.useEffectEvent(R=>{y(R),R.kind==="failure"&&s.announce(i.documentFailed(t,te(i,R.failure.reason)))});c.useEffect(()=>{const R=new AbortController;return r.text(g.path,R.signal).then(M=>{"kind"in M&&L(M)}),()=>R.abort()},[r,g]);const S=c.useCallback(()=>f(R=>R+1),[]);return p===null?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-markup-skeleton",children:Qe.map(R=>l.jsx("span",{},R))}),l.jsx("p",{className:"aqmx-sr-only",children:i.markupLoading})]}):p.kind==="failure"?l.jsx(he,{scrollerProps:hn,children:l.jsx(le,{failure:p.failure,alert:!1,onRetry:S,testId:"markdown-explorer-markup-failure"})}):l.jsx(pn,{document:p,viewer:n})},hn=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),jo=Object.freeze({reason:"failed"}),Mo=e=>l.jsx(er,{fallback:t=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(le,{failure:jo,alert:!1,onRetry:t,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(c.Suspense,{fallback:l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-skeleton",children:Qe.map(t=>l.jsx("span",{},t))}),children:l.jsx(Jn,{...e})})}),No=({path:e,document:t,view:n,viewer:r,onRetry:o,editing:s})=>{switch(t.kind){case"markdown":{const{session:i,layout:u,region:v,paneScroll:m,stale:f}=s;if(n==="edit"&&i!==void 0)return l.jsx(Mo,{path:e,name:t.name,session:i,layout:u,viewer:r,region:v,paneScroll:m});if(n==="markup")return l.jsx(Lo,{path:e,name:t.name,viewer:r});const g=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return l.jsx(Ao,{path:e,document:t,viewer:r,editing:{editable:g,doubleClick:g&&u==="fill",region:v,paneScroll:m,stale:f}})}case"text":return l.jsx(pn,{document:t,viewer:r});case"image":return l.jsx(no,{document:t});case"media":return l.jsx(Ro,{document:t});case"file":return l.jsx(jr,{document:t});case"failure":return l.jsx(he,{scrollerProps:hn,children:l.jsx(le,{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)}`)}}},Do='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',Po=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:ln(e,n),r===void 0?null:sn(e,r.id),e.querySelector(Te),e.querySelector(Do)];for(const s of o)if(s instanceof HTMLElement&&Xe(s))return s;return null},xt=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&Xe(t)},_o=e=>{const t=c.useRef(!1);return c.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 u=p=>{s=!(p.target instanceof Node&&n.contains(p.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(i),i=setTimeout(()=>{s=!1},0)},v=p=>{t.current=p.target instanceof Node&&n.contains(p.target)},m=p=>{p.relatedTarget===null&&s&&(t.current=!1)},f=()=>{const{activeElement:p,body:y}=r;p!==null&&p!==y&&(t.current=n.contains(p))},g=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",u,!0),o.addEventListener("mousedown",u,!0),o.addEventListener("focusin",v,!0),o.addEventListener("blur",f),o.addEventListener("focus",g),n.addEventListener("focusout",m),()=>{clearTimeout(i),o.removeEventListener("pointerdown",u,!0),o.removeEventListener("mousedown",u,!0),o.removeEventListener("focusin",v,!0),o.removeEventListener("blur",f),o.removeEventListener("focus",g),n.removeEventListener("focusout",m)}},[e]),t},$o=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:i,navigation:u,fragment:v,paneScroll:m,announces:f,announceFailure:g,onDocumentShown:p})=>{const{labels:y,announcer:L,documents:S}=P(),{document:R}=t,M=c.useRef(null),C=c.useRef(null),a=c.useRef(null),d=c.useRef(0),h=_o(M),x=c.useRef({path:e,document:R}),T=c.useRef(null),j=c.useCallback(V=>{const z=M.current,G=mt(z,V,m);z!==null&&G!==null&&xt(z,G,h.current)},[m,h]),A=c.useCallback((V,z)=>{const G=d.current;setTimeout(()=>{!z.defaultPrevented&&d.current===G&&j(V)},0)},[j]),D=c.useCallback(V=>{setTimeout(()=>{V.defaultPrevented||j("#")},0)},[j]),q=c.useMemo(()=>({navigation:u,currentPath:e,scrollWithin:j,followSameUrlJump:A,followEmptyFragment:D}),[u,e,j,A,D]),F=c.useCallback(()=>S.retry(e),[S,e]),Z=Qt(S,lo),W=Bt(e),K=W!==void 0?"edit":n?"markup":"rendered",I=R.kind==="markdown"?K:void 0,J=c.useCallback(()=>M.current,[]),w=c.useMemo(()=>({session:W,layout:s,region:J,paneScroll:m,stale:r}),[W,s,J,m,r]),b=I==="edit"?!1:r,k=c.use(ie),O=I==="edit"&&s==="fill"?"fill":k,_=c.useEffectEvent((V,z)=>{const G=C.current;if(G!==null&&G.path===V&&G.snapshot===z)return;C.current={path:V,snapshot:z};const Y=z.document;if(Y.kind==="failure"){S.noteFailureShown(z)&&g(y.documentFailed(N.lastPathSegment(V),te(y,Y.failure.reason)));return}p?.(V,Y),f&&(G===null||G.path!==V||G.snapshot.document.kind==="failure")&&L.announce(y.documentShown(Y.name))});c.useEffect(()=>{_(e,t)},[e,t]);const $=c.useEffectEvent(()=>{v.kind==="panel"&&v.consume()}),U=c.useEffectEvent(V=>{const z=M.current;if(z===null||!h.current)return null;const{activeElement:G,body:Y}=z.ownerDocument;return G!==null&&G!==Y?null:Po(z,R,V)}),H=c.useEffectEvent(V=>{const z=M.current;z!==null&&xt(z,V,h.current)}),ee=c.useEffectEvent(V=>m.reveal(V)),tt=c.useEffectEvent(V=>mt(M.current,V,m));return c.useEffect(()=>{if(r)return;const V=x.current.path!==e,z=V||x.current.document!==R;x.current={path:e,document:R};const G=T.current!==e;T.current=e;let Y=null;v.kind==="page"?a.current!==v.navigation&&(a.current=v.navigation,d.current+=1,Y=v.fragment):v.fragment!==null&&(Y=v.fragment,$());const nt=()=>{const je=Y===null?null:tt(Y);if(!z){je!==null&&H(je);return}const rt=U(v.fragment);V&&je===null&&rt!==null&&ee(rt)};G?queueMicrotask(nt):nt()},[v,e,R,r]),l.jsx(ie,{value:O,children:l.jsx(Je,{kind:R.kind,view:I,label:i(e,R),stale:b,busy:b,frameRef:M,intent:Z,children:l.jsx(cn,{value:q,children:l.jsx(oo,{children:l.jsx(No,{path:e,document:R,view:K,viewer:o,onRetry:F,editing:w},e)})})})})},et=Object.freeze({kind:"skeleton"}),Fo=(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?et:{kind:"document",path:n,snapshot:i,stale:!0}},qo=(e,t)=>t.status==="deferred"?et:{kind:"document",path:e,snapshot:t,stale:!1},Bo=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?qo(t.path,c.use(t.promise)):t;return o.kind!=="document"?l.jsx(mn,{label:r.regionLabel(e,null)}):l.jsx($o,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},vn=({path:e,markup:t,display:n,navigation:r,fragment:o,paneScroll:s,announces:i,announceFailure:u,onDocumentShown:v})=>{const{config:m,labels:f,theme:g,documents:p}=P(),y=de.useMarkdownToolbarState(),L=c.useRef(!1);c.useLayoutEffect(()=>{L.current=!0},[]);const[S,R]=c.useState(null),[M,C]=c.useState(t),a=c.useCallback(()=>e===null?void 0:p.peek(e),[p,e]),d=c.useSyncExternalStore(p.subscribe,a,a),h=c.useCallback(()=>S===null?void 0:p.peek(S),[p,S]),x=c.useSyncExternalStore(p.subscribe,h,h);c.useLayoutEffect(()=>e===null?void 0:p.open(e),[p,e]),c.useLayoutEffect(()=>S===null?void 0:p.retain(S),[p,S]);const T=e===null?et:Fo(e,d,S,x,!L.current),j=e===null?null:T.kind==="document"&&!T.stale?T.path:S;j!==S&&R(j);const A=T.kind!=="document"||T.path===e;A&&t!==M&&C(t);const D=c.useMemo(()=>To(f),[f]),q=c.useMemo(()=>[...m.iframeHosts],[m]),F=r.kind==="panel",Z=c.useMemo(()=>({labels:D,emptyMessage:f.documentEmpty,theme:g,availableStyles:m.documentStyles,iFrameAllowedDomains:q,embeds:m.embeds,linkComponent:mo,toolbar:y,style:n.style,onStyleChange:n.onStyleChange,align:n.align,onAlignChange:n.onAlignChange,showToc:n.showToc,showStyle:n.showStyle,showAlign:n.showAlign,padding:n.padding,width:n.width===void 0?void 0:`min(${n.width}, 100%)`,maxWidth:n.maxWidth===void 0?void 0:`min(${n.maxWidth}, 100%)`,renderScrollBar:F?void 0:en}),[D,f.documentEmpty,g,m.documentStyles,q,m.embeds,y,n,F]),W=c.useCallback((I,J)=>F?J===null||J.kind==="failure"?N.lastPathSegment(I):J.name:f.documentRegion,[F,f.documentRegion]),K=F?"content":"fill";return e===null?l.jsx(ie,{value:K,children:l.jsx(Oo,{})}):l.jsx(ie,{value:K,children:l.jsx(c.Suspense,{fallback:l.jsx(mn,{label:W(e,null)}),children:l.jsx(Bo,{requestedPath:e,content:T,markup:A?t:M,viewer:Z,editLayout:n.editLayout,regionLabel:W,navigation:r,fragment:o,paneScroll:s,announces:i,announceFailure:u,onDocumentShown:v})})})},Io=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s,announcer:i}=P(),u=ue(j=>j.style),v=ue(j=>j.align),m=pe(),f=X.useLocation(),g=Se(),{view:p,overrides:y,embed:L}=n,S=c.useCallback(j=>{if(g.kind!=="location")return;const A=Co(o,g.location,j);A!==null&&m(A,"browse")},[o,m,g]),R=c.useCallback(j=>{s.update({style:j}),S("style")},[s,S]),M=c.useCallback(j=>{s.update({align:j}),S("align")},[s,S]),C=un(o,y.style,u),a=fn(y.align,v),d=c.useMemo(()=>({style:C,onStyleChange:R,align:a,onAlignChange:M,showToc:L.showToc!==!1,showStyle:L.showStyle!==!1,showAlign:L.showAlign!==!1,padding:L.padding,width:L.width,maxWidth:L.maxWidth,editLayout:"fill"}),[C,R,a,M,L]),h=c.useMemo(()=>({kind:"page",view:p,overrides:y,embed:L}),[p,y,L]),x=c.useMemo(()=>({kind:"page",fragment:f.hash,navigation:f}),[f]),T=c.useCallback(j=>i.announce(j),[i]);return l.jsx(vn,{path:e,markup:t,display:d,navigation:h,fragment:x,paneScroll:Fr,announces:!0,announceFailure:T,onDocumentShown:r})},Ho=({path:e,markup:t,variant:n,onDocumentShown:r})=>{const{config:o,viewSettings:s}=P(),i=ue(h=>h.style),u=ue(h=>h.align),[v,m]=c.useState(()=>un(o,void 0,i)),f=fn(void 0,u),g=c.useCallback(h=>s.update({align:h}),[s]),{maximized:p,onDocumentLink:y,pendingHash:L,onHashConsumed:S,announceFailure:R,paneScroll:M}=n,C=c.useMemo(()=>({style:v,onStyleChange:m,align:f,onAlignChange:g,showToc:p,showStyle:p,showAlign:p,padding:void 0,width:void 0,maxWidth:void 0,editLayout:p?"fill":"content"}),[v,f,g,p]),a=c.useMemo(()=>({kind:"panel",onDocumentLink:y}),[y]),d=c.useMemo(()=>({kind:"panel",fragment:L,consume:S}),[L,S]);return l.jsx(vn,{path:e,markup:t,display:C,navigation:a,fragment:d,paneScroll:M,announces:!1,announceFailure:R,onDocumentShown:r})},gn=({path:e,markup:t,variant:n,onDocumentShown:r})=>n.kind==="page"?l.jsx(Io,{path:e,markup:t,variant:n,onDocumentShown:r}):l.jsx(Ho,{path:e,markup:t,variant:n,onDocumentShown:r});function Vo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 wn=E.forwardRef(Vo);function Uo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 xn=E.forwardRef(Uo);function zo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Zo=E.forwardRef(zo);function Go({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 Ko=E.forwardRef(Go);function Wo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 Xo=E.forwardRef(Wo);function Yo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 Qo=E.forwardRef(Yo);function Jo({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),E.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 En=E.forwardRef(Jo);function es({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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"}),E.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 ts=E.forwardRef(es);function ns({title:e,titleId:t,...n},r){return E.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?E.createElement("title",{id:t},e):null,E.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 rs=E.forwardRef(ns),bn=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=P(),[s,i]=c.useState(!1),u=()=>{o===void 0||s||(i(!0),o(e).then(v=>{v&&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:u,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},os="Control+E Meta+E",yn=(e,t,n)=>n&&t?"split":e.view,ze=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},ss=e=>e==="split"?null:e,Sn=e=>e==="preview"?"editor":"preview",kn=e=>/Mac|iPhone|iPad|iPod/u.test(e),Rn=(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)},Et=(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)},ls=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:i,locale:u,announcer:v}=P(),m=c.useRef(null),f=c.useRef(null),g=c.useId(),[p,y]=c.useState(null),[L,S]=c.useState(0),[R,M]=c.useState(null),[C,a]=c.useState(null),d=c.useMemo(()=>new Intl.DateTimeFormat(u,{dateStyle:"medium",timeStyle:"short"}),[u]);c.useLayoutEffect(()=>{const A=m.current;if(A!==null)if(n&&!A.open){const D=A.ownerDocument.activeElement;f.current=D instanceof HTMLElement?D:null,M(null),a(null),A.showModal()}else!n&&A.open&&(A.close(),f.current?.isConnected===!0&&f.current.focus(),f.current=null)},[n]),c.useEffect(()=>{if(!n)return;const A=new AbortController;return y(null),o.revisions(e,A.signal).then(D=>{"kind"in D&&y(D)}),()=>A.abort()},[n,o,e,L]),c.useEffect(()=>{if(!n||R===null)return;const A=new AbortController;return a(null),o.revision(e,R,A.signal).then(D=>{"kind"in D&&a(D)}),()=>A.abort()},[n,o,e,R]);const h=()=>{C===null||C.kind!=="revision"||(s.replaceDraft(e,C.text),v.announce(i.historyRestored(t)),r())},x=A=>{A.key!=="Escape"||A.defaultPrevented||(ke(A),r())},T=A=>{A.target===A.currentTarget&&r()},j=p!==null&&p.kind==="revisions"?p.revisions.find(A=>A.id===R):void 0;return l.jsx("dialog",{ref:m,className:"aqmx-confirm aqmx-history","aria-labelledby":g,"data-testid":"markdown-explorer-history",onKeyDown:x,onClick:T,onCancel:A=>A.preventDefault(),children:l.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[l.jsx("p",{id:g,className:"aqmx-confirm-title",children:i.historyTitle(t)}),p===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:i.historyLoading}):p.kind==="failure"?l.jsx(le,{failure:p.failure,alert:!1,onRetry:()=>S(A=>A+1),testId:"markdown-explorer-history-failure"}):p.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:p.revisions.map(A=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":A.id===R,"data-testid":"markdown-explorer-history-entry",onClick:()=>M(A.id),children:[l.jsx("span",{children:Et(A,d,i.historyEntry)}),A.current?l.jsx("span",{className:"aqmx-history-mark",children:i.historyCurrent}):null,A.kept?l.jsx("span",{className:"aqmx-history-mark",children:i.historyKept}):null]})},A.id))}),R===null?null:C===null?l.jsx("p",{className:"aqmx-history-note",children:i.historyLoading}):C.kind==="failure"?l.jsx(le,{failure:C.failure,alert:!1,testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":j===void 0?i.historyTitle(t):Et(j,d,i.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:C.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":C===null||C.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:h,children:i.historyRestore})]})]})})},is=e=>{const{documents:t}=P(),n=c.useCallback(()=>t.peek(e),[t,e]),r=c.useCallback(()=>t.peekSeeded(e),[t,e]),o=c.useSyncExternalStore(t.subscribe,n,r),s=re(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:N.lastPathSegment(e)}:{edit:s.kind==="markdown"?s.edit:null,name:s.name}},ne=e=>{e.stopPropagation()},as=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:i,labels:u}=P(),v=c.useSyncExternalStore(i.subscribe,()=>i.session(e)!==void 0,()=>!1),[m,f]=c.useState(null),g=()=>{if(!v){i.start(e,i.viewAnchor(e));return}i.flush(e);const S=i.session(e);S?.dirty===!0?f(S.save.kind==="draft"?"draft":"unsaved"):i.close(e)},p=()=>{v||(Qn(),r&&i.sideBySide()&&s?.prepare?.())},y=n?o?u.editDraftDocumentNamed(t):u.editDocumentNamed(t):null,L=o?u.editDraftDocument:u.editDocument;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:y===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:v?u.closeEditor:y===null?L:y,"aria-label":y===null?void 0:y,"aria-pressed":v,"data-testid":"markdown-explorer-document-edit",onClick:g,onDoubleClick:ne,onPointerEnter:p,onFocus:p,children:[l.jsx(ts,{"aria-hidden":"true"}),y===null?l.jsx("span",{children:u.editDocumentLabel}):null]}),l.jsx(qt,{open:m!==null,title:m==="draft"?u.draftDiscardTitle:u.unsavedTitle,body:m==="draft"?u.draftDiscardBody(t):u.unsavedBody(t),confirmLabel:u.unsavedDiscard,cancelLabel:u.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{f(null),i.close(e)},onCancel:()=>f(null)})]})},cs=({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(Zo,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},ds=({session:e})=>{const{labels:t}=P(),n=Bn(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})},us=Object.freeze(["editor","split","preview"]),fs=Object.freeze(["editor","preview"]),ms=Object.freeze({editor:xn,split:rs,preview:En}),ps=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:i,labels:u}=P(),v=Ht(),m=yn(r,v,o),f=o?us:fs,g=c.useId(),p=c.useRef(new Map),y={editor:{label:u.editViewEditor,tooltip:u.editViewEditorTooltip},split:{label:u.editViewSplit,tooltip:u.editViewSplitTooltip},preview:{label:u.editViewPreview,tooltip:u.editViewPreviewTooltip}},L=()=>{i.preparePreview(e),s?.prepare?.()},S=R=>{if(!Rn(R.nativeEvent,kn(navigator.platform)))return;ke(R);const M=Sn(m);ze(i,e,M,o),p.current.get(M)?.focus()};return l.jsx("div",{role:"radiogroup","aria-label":n?u.editViewNamed(t):u.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:S,children:f.map(R=>{const M=ms[R],{label:C,tooltip:a}=y[R],d=R==="preview"?L:void 0;return l.jsxs("label",{className:n?"aqmx-icon-button":"aqmx-icon-button aqmx-labelled-button",children:[l.jsx("input",{ref:h=>{h===null?p.current.delete(R):p.current.set(R,h)},type:"radio",name:g,value:R,checked:R===m,"aria-label":C,"aria-keyshortcuts":R==="split"?void 0:os,title:a,"data-testid":`markdown-explorer-edit-view-${R}`,onChange:()=>ze(i,e,R,o),onDoubleClick:ne,onPointerEnter:d,onFocus:d}),l.jsx(M,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:C})]},R)})})},hs=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:i}=P(),[u,v]=c.useState(!1);if(r.phase.kind!=="editing")return null;const m=r.save.kind==="saving",f=m||!r.dirty,g=()=>{s.flush(e);const y=s.session(e);y===void 0||!y.dirty||y.save.kind==="saving"||s.save(e)},p=y=>n?{className:"aqmx-icon-button","aria-label":y}:{className:"aqmx-icon-button aqmx-labelled-button"};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...p(i.conflictNext),title:i.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ne,children:[l.jsx(Ko,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.conflictNext})]}):null,l.jsx(ps,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?l.jsxs("button",{type:"button",...p(i.historyOpen),title:i.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>v(!0),onDoubleClick:ne,children:[l.jsx(Xo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.historyOpen})]}):null,r.save.kind==="draft"?null:l.jsxs("button",{type:"button",...p(i.saveDraft),title:i.saveDraftTooltip,"aria-disabled":f,"aria-busy":m,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:g,onDoubleClick:ne,children:[l.jsx(Qo,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.saveDraft})]}),r.history?l.jsx(ls,{path:e,documentName:t,open:u,onClose:()=>v(!1)}):null]})},vs=({path:e,session:t})=>{const{edits:n}=P();return t.save.kind!=="grant"?null:l.jsx(bn,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},gs=e=>{const{documents:t}=P(),n=c.useCallback(()=>t.peek(e),[t,e]),r=c.useCallback(()=>t.peekSeeded(e),[t,e]),o=c.useSyncExternalStore(t.subscribe,n,r);return re(o)?.document.kind==="markdown"},Tn=e=>{const{config:t}=P(),n=pe(),r=c.useCallback(()=>n(B.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return c.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])},ws=new Set,xs=(e,t)=>{const{documents:n,announcer:r,labels:o}=P(),s=c.useCallback(()=>n.peek(e),[n,e]),i=c.useCallback(()=>n.peekSeeded(e),[n,e]),u=c.useSyncExternalStore(n.subscribe,s,i),v=c.useCallback(()=>n.answerStampOf(e),[n,e]),m=c.useSyncExternalStore(n.subscribe,v,v),[f]=c.useState(()=>new Set),[g,p]=c.useState(ws),[y,L]=c.useState(null);y!==null&&y.path!==e&&L(null);const S=c.useRef(null);c.useLayoutEffect(()=>(S.current=e,()=>{S.current=null}),[e]);const R=c.useCallback(()=>{const a=e,d=n.peek(a);if(f.has(a)||d?.status==="pending")return;const h=t&&!rn(d);f.add(a),p(new Set(f)),L(null),(async()=>{try{const x=await n.refresh(a);if(S.current!==a||x.status==="superseded")return;if(x.status==="failed"){L({path:a,failure:x.failure,stamp:n.answerStampOf(a)}),r.announce(o.documentRefreshFailed(te(o,x.failure.reason)));return}const T=re(n.peek(a));if(h||T===null||T.document.kind==="failure")return;r.announce(o.documentRefreshed(T.document.name))}finally{f.delete(a),p(new Set(f))}})()},[e,t,f,n,r,o]),M=g.has(e),C=y!==null&&y.path===e&&y.stamp===m?y.failure:null;return{refreshing:M,unavailable:M||u?.status==="pending",failure:C,refresh:R}},Cn=Object.freeze({kind:"page"}),On=({path:e,placement:t,markup:n})=>{const{labels:r}=P(),{refreshing:o,unavailable:s,failure:i,refresh:u}=xs(e,t.kind==="page"),v=gs(e),m=is(e),f=Bt(e),g=t.kind==="panel"?r.refreshDocumentNamed(t.documentName):null,p=t.kind==="panel"?r.showMarkupNamed(t.documentName):null,y=t.kind==="panel",L=t.kind==="panel"?t.documentName:m.name,S=t.kind==="page"||t.maximized;return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":f===void 0?void 0:"true",children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[f===void 0?null:l.jsx(ds,{session:f}),f===void 0?null:l.jsx(hs,{path:e,documentName:L,iconOnly:y,session:f,previewAvailable:S}),f===void 0&&v?l.jsxs("button",{type:"button",className:p===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:p===null?r.showMarkup:p,"aria-label":p===null?void 0:p,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ne,children:[l.jsx(xn,{"aria-hidden":"true"}),p===null?l.jsx("span",{children:r.showMarkupLabel}):null]}):null,f!==void 0||m.edit?.kind==="inline"||m.edit?.kind==="draft"?l.jsx(as,{path:e,documentName:L,iconOnly:y,previewAvailable:S,draft:m.edit?.kind==="draft"}):m.edit?.kind==="external"?l.jsx(cs,{href:m.edit.href,documentName:L,iconOnly:y}):null,f===void 0?l.jsxs("button",{type:"button",className:g===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:g===null?r.refreshDocument:g,"aria-label":g===null?void 0:g,"aria-disabled":s,"aria-busy":o,"data-aqmx-busy":o?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:u,onDoubleClick:ne,children:[l.jsx(wn,{"aria-hidden":"true"}),g===null?l.jsx("span",{children:r.refreshDocumentLabel}):null]}):null]}),f!==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(te(r,i.reason))}),f===void 0?null:l.jsx(vs,{path:e,session:f})]})},Es=({location:e})=>{const t=e.doc,n=c.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=Tn(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",children:[l.jsx(On,{path:t,placement:Cn,markup:r}),l.jsx(gn,{path:t,markup:e.markup,variant:n})]})},An=({holds:e,testId:t})=>{const{labels:n,announcer:r}=P(),o=c.useId();c.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=c.useCallback(()=>r.shownIn(o),[r,o]),i=c.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]})},se=Object.freeze([]),bs=e=>{const t=new Set;let n=se,r=[],o=!1;const s=[],i=f=>{n=f;for(const g of[...t])g()},u=()=>s.at(-1)?.region,v=f=>{const g=u();f(),u()!==g&&n!==se&&i(se)},m=()=>{o=!1;const f=r.map(g=>"sentence"in g?g.sentence:g.list(g.items));r=[],i(Object.freeze(f))};return{announce:f=>{if(typeof f=="string")r.push({sentence:f});else{const g=r.find(p=>"list"in p&&p.list===f.list);g!==void 0&&"items"in g?g.items.push(f.item):r.push({list:f.list,items:[f.item]})}o||(o=!0,n!==se&&i(se),e.request(m))},subscribe:f=>(t.add(f),()=>{t.delete(f)}),claim:f=>{const g={region:f};return v(()=>s.push(g)),()=>v(()=>{const p=s.indexOf(g);p!==-1&&s.splice(p,1)})},shownIn:f=>u()===f?n:se}},ce=Object.freeze({status:"cancelled"}),ys=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(N.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return N.failureOf(n,r)},Ss=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((m,f)=>globalThis.fetch(m,f)),o=(m,f)=>`${e}/${m}?${new URLSearchParams(f).toString()}`,s=async(m,f,g,p)=>{let y;try{y=await r(m,{credentials:"same-origin",...f,headers:{Accept:"application/json",...f.headers}})}catch{return p({reason:"failed"})}y.status===401&&t(null);const L=y.headers.get(N.EXPLORER_SCOPE_HEADER);L!==null&&t(L);let S;try{S=await y.json()}catch{return p({reason:N.failureReasonOfStatus(y.status)})}let R;try{R=g(S)}catch{R=!1}if(R)return S;const M=ys(S);return p(M!==null?M:{reason:y.status===200?"failed":N.failureReasonOfStatus(y.status)})},i={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_REFRESH_PROOF},u={[N.EXPLORER_PROOF_HEADER]:N.EXPLORER_EDIT_PROOF,"Content-Type":`${N.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},v=async(m,f,g)=>{const p=await s(m,f,g,y=>N.failureDocument(y.reason,y.code));return f.signal.aborted?ce:p};return{tree:m=>s(o("tree",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"GET"},N.isExplorerTreeResult,f=>({status:"error",failure:f})),children:async(m,f,g)=>{const p=await s(o("children",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:g},N.isExplorerChildrenResult,y=>({status:"error",failure:y}));return g.aborted?ce:p},ancestors:async(m,f,g)=>{const p=await s(o("ancestors",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:g},N.isExplorerAncestorsResult,y=>({status:"error",failure:y}));return g.aborted?ce:p},reveal:async(m,f,g)=>{const p=await s(o("reveal",{[N.EXPLORER_DATA_QUERY.source]:m,[N.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:g},N.isExplorerRevealResult,y=>({status:"error",failure:y}));return g.aborted?ce:p},document:(m,{refresh:f})=>s(o("document",{[N.EXPLORER_DATA_QUERY.path]:m}),f?{method:"GET",headers:i}:{method:"GET"},N.isExplorerDocument,g=>N.failureDocument(g.reason,g.code)),text:async(m,f)=>{const g=await s(o("text",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerTextAnswer,p=>N.failureDocument(p.reason,p.code));return f.aborted?ce:g},edit:(m,f)=>v(o("edit",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerEditAnswer),save:(m,f,g,p)=>v(o("save",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.base]:f}),{method:"POST",headers:u,body:g,signal:p},N.isExplorerSaveAnswer),preview:(m,f,g)=>v(o("preview",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"POST",headers:u,body:f,signal:g},N.isExplorerPreviewAnswer),revisions:(m,f)=>v(o("revisions",{[N.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:f},N.isExplorerRevisionsAnswer),revision:(m,f,g)=>v(o("revision",{[N.EXPLORER_DATA_QUERY.path]:m,[N.EXPLORER_DATA_QUERY.revision]:f}),{method:"GET",signal:g},N.isExplorerRevisionAnswer),refresh:m=>s(o("refresh",{[N.EXPLORER_DATA_QUERY.source]:m}),{method:"POST",headers:i},N.isExplorerTreeResult,f=>({status:"error",failure:f}))}},ks=()=>{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}}},Rs=e=>{const t=Q.readStorage(e);if(t===null)return B.NO_TREE_SETTING_CHANGES;try{return B.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),B.NO_TREE_SETTING_CHANGES}},bt=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=Rs(e);n={changes:s,settings:B.applyTreeSettingChanges(t,s)}}return n},o=ae();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:i,settings:u}=r(),v=B.recordTreeSettingChange(i,s,B.advanceTreeSetting(u,s)[s],t);return n={changes:v,settings:B.applyTreeSettingChanges(t,v)},o.emit(),Q.writeStorage(e,B.serializeTreeSettingChanges(v)),n.settings}}},Ts=Object.freeze({status:"refreshed"}),Cs=Object.freeze({status:"superseded"}),Ze=Object.freeze({status:"deferred"}),Os=nn(Ze),Ln=4,As=Ln-1,yt=Object.freeze({status:"loading"}),Ls=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),js=e=>{const t=new Map,n=tn(),r=new Map,o=new Map,s=new Map,i=new Map,u=ae(),v=new Set;let m=0,f=0;const g={direct:null,bulk:null},p=new Set;let y=!1,L=0;const S=()=>{L+=1,u.emit()},R=w=>o.get(w)??0,M=w=>{let b=i.get(w);return b===void 0&&(b={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},i.set(w,b)),b},C=(w,b,k)=>{w.inFlight.delete(b),m-=1,k.lane==="bulk"&&(f-=1)},a=w=>{const b=i.get(w);if(b!==void 0){for(const[k,O]of[...b.inFlight])C(b,k,O),O.controller.abort();b.direct.clear(),b.bulk.clear(),b.unclaimed.clear()}},d=w=>{const b=R(w)+1;return o.set(w,b),a(w),b},h=(w,b)=>{const k=ve(w),O={promise:w,opened:b,stale:!1,loadedAt:k?.status==="ok"?k.loadedAt:null};return w.status==="pending"&&w.then(_=>{_.status==="ok"&&(O.loadedAt=_.loadedAt)}),O},x=w=>{let b=r.get(w);return b===void 0&&(b=new Map,r.set(w,b)),b},T=w=>{const b=[...i.keys()],k=g[w],O=k===null?0:b.indexOf(k)+1;for(let _=0;_<b.length;_+=1){const $=b[(O+_)%b.length],U=$===void 0?void 0:i.get($);if(!($===void 0||U===void 0)){for(const H of U[w])if((U.claims.get(H)??0)!==0)return U[w].delete(H),g[w]=$,{sourceId:$,path:H}}}return null},j=(w,b,k,O)=>{const _=i.get(w);if(_===void 0||_.inFlight.get(b)!==k)return;C(_,b,k);const $=(_.claims.get(b)??0)>0,U=x(w);if(O.status==="ok"?U.set(b,{status:"loaded",entries:O.entries}):O.status==="error"&&$?U.set(b,{status:"failed",failure:O.failure}):U.delete(b),S(),O.status==="error"&&$){const H={sourceId:w,path:b,failure:O.failure};for(const ee of[...v])ee(H)}D()},A=(w,b,k)=>{const O={controller:new AbortController,lane:k};M(w).inFlight.set(b,O),m+=1,k==="bulk"&&(f+=1),e.children(w,b,O.controller.signal).then(_=>j(w,b,O,_),()=>j(w,b,O,Ls))},D=()=>{for(;m<Ln;){const w=T("direct");if(w!==null){A(w.sourceId,w.path,"direct");continue}const b=f<As?T("bulk"):null;if(b===null)return;A(b.sourceId,b.path,"bulk")}},q=(w,b,k)=>{if(!(b.direct.delete(k)||b.bulk.delete(k))){const _=b.inFlight.get(k);if(_===void 0)return!1;C(b,k,_),_.controller.abort()}return r.get(w)?.delete(k),!0},F=()=>{y=!1;let w=!1;for(const b of p){const k=M(b);for(const O of k.unclaimed)(k.claims.get(O)??0)===0&&q(b,k,O)&&(w=!0);k.unclaimed.clear()}p.clear(),w&&(S(),D())},Z=(w,b)=>{t.set(w,h(me(e.tree(w)),b))},W=(w,b,k)=>{d(w);const O=h(nn(b),k);return t.set(w,O),r.delete(w),S(),D(),O},K=(w,b,k,O)=>{if(k!==R(w)||t.get(w)!==b)return;const _=ve(b.promise);if(!(O.status!=="ok"||_?.status!=="ok"||b.loadedAt===null||O.loadedAt<=b.loadedAt)){if(be(_.entries,O.entries)){b.loadedAt=O.loadedAt;return}W(w,O,b.opened)}},I=(w,b)=>{const k=t.get(w);return k!==void 0&&ve(k.promise)?.status===b},J=(w,b)=>{b.stale=!1;const k=R(w);e.tree(w).then(O=>K(w,b,k,O))};return{read:w=>t.get(w)?.promise??Os,open:w=>{const b=n.resumes(w),k=n.hold(w),O=t.get(w);return O===void 0||I(w,"deferred")?(Z(w,!0),S()):b||(O.opened&&I(w,"error")?(Z(w,!0),S()):(O.opened=!0,O.stale&&I(w,"ok")&&J(w,O))),k},retry:w=>{I(w,"error")&&(Z(w,!0),S())},seed:(w,b)=>{const k=b.then($=>$===null?Ze:$,()=>Ze),O=t.get(w);if(O!==void 0&&I(w,"ok")){const $=R(w);k.then(U=>K(w,O,$,U));return}d(w);const _=h(me(k),O?.opened===!0);t.set(w,_),r.delete(w),D(),k.then($=>{t.get(w)===_&&($.status==="deferred"&&n.isHeld(w)&&Z(w,_.opened),S())})},refresh:async w=>{const b=(s.get(w)??0)+1;s.set(w,b);const k=await e.refresh(w);if(s.get(w)!==b)return Cs;if(k.status==="error")return{status:"failed",failure:k.failure};const O=t.get(w);if(!(O!==void 0&&O.loadedAt!==null&&I(w,"ok")&&O.loadedAt>k.loadedAt)){const $=W(w,k,!0);if(O!==void 0&&O.promise.status==="pending"){const U=R(w);O.promise.then(H=>K(w,$,U,H))}}for(const[$,U]of t)$!==w&&ve(U.promise)?.status==="ok"&&(U.stale=!0);return Ts},children:(w,b)=>r.get(w)?.get(b),claimChildren:(w,b)=>{const k=M(w),O=x(w);let _=!1,$=!1;for(const[H,ee]of b)k.claims.set(H,(k.claims.get(H)??0)+1),O.get(H)===void 0?(O.set(H,yt),k[ee].add(H),_=!0,$=!0):ee==="direct"&&k.bulk.delete(H)&&(k.direct.add(H),$=!0);_&&S(),$&&D();let U=!1;return()=>{if(!U){U=!0;for(const H of b.keys()){const ee=(k.claims.get(H)??0)-1;ee>0?k.claims.set(H,ee):(k.claims.delete(H),k.unclaimed.add(H))}p.add(w),!y&&(y=!0,queueMicrotask(F))}}},retryChildren:(w,b)=>{const k=r.get(w);if(k===void 0||k.get(b)?.status!=="failed")return;const O=M(w);if((O.claims.get(b)??0)>0){k.set(b,yt),O.direct.add(b),S(),D();return}k.delete(b),S()},pendingChildren:w=>{const b=i.get(w);return b===void 0?0:b.direct.size+b.bulk.size+b.inFlight.size},clear:()=>{for(const w of new Set([...t.keys(),...r.keys(),...o.keys(),...i.keys()]))d(w);for(const[w,b]of s)s.set(w,b+1);t.clear(),r.clear(),S()},subscribeChildrenFailures:w=>(v.add(w),()=>{v.delete(w)}),subscribe:u.subscribe,version:()=>L}},Ms=(e,t)=>{let n=e;const r=ae();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},Ns=1;let ge=0,oe=null;const Ds=()=>{const{documentElement:e,body:t}=document;ge===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"),ge+=1;let n=!1;return()=>{n||(n=!0,ge-=1,!(ge>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))}},Ps=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],St=1,kt=e=>e.getClientRects().length>0,_e="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.",_s=e=>{if(!kt(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+Ns)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. ${_e}`;if(t.height<St)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. ${_e}`;for(const{selector:r,name:o}of Ps)for(const s of e.querySelectorAll(r)){if(!kt(s))continue;const i=s.getBoundingClientRect().height;if(i<St)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. ${_e}`}return null},$s=e=>{let t=!1;const n=()=>{if(t)return;const o=_s(e);o!==null&&(t=!0,console.error(o))},r=typeof ResizeObserver>"u"?null:new ResizeObserver(n);return r?.observe(e),window.addEventListener("resize",n),n(),()=>{r?.disconnect(),window.removeEventListener("resize",n)}},Fs=(e,t)=>{c.useEffect(()=>e?Ds():void 0,[e]),c.useEffect(()=>{const n=t.current;if(!(!e||n===null))return $s(n)},[e,t])},Rt='[data-testid="markdown-explorer-view-switch"]',qs=[{control:Rt,successors:[Rt,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],Bs=e=>{for(const t of qs){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},Is=(e,t)=>{const n=c.useRef(null);c.useEffect(()=>{const o=u=>{const v=e.current;n.current=v!==null&&u instanceof Element&&v.contains(u)?Bs(u):null},s=u=>o(u.target);o(document.activeElement);const i=u=>{const v=u.target;u.relatedTarget!==null||!(v instanceof Element)||queueMicrotask(()=>{n.current?.element===v&&v.isConnected&&document.activeElement!==v&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",i),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",i)}},[e]);const r=c.useRef(t);c.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const v=document.activeElement;if(v!==null&&v!==document.body&&v!==o.element)return!0;const m=e.current;if(m===null)return!0;for(const f of o.control.successors)for(const g of m.querySelectorAll(f))if(g!==o.element&&(g.focus({preventScroll:!0}),document.activeElement===g))return!0;return!1};if(s())return;const i=e.current;if(i===null)return;const u=new MutationObserver(()=>{s()&&u.disconnect()});return u.observe(i,{childList:!0,subtree:!0}),()=>u.disconnect()},[t,e])},Hs=c.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-CQUpgsxz.cjs")).then(e=>({default:e.TreeLayout}))),Vs=c.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-BjA0k-5n.cjs")).then(e=>({default:e.MultiLayout}))),Us=64,zs={request:e=>{requestAnimationFrame(e)}},Tt=e=>{e.documents.clear(),e.trees.clear()},$e=(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)},Zs=(e,t)=>{const[n,r]=c.useState(()=>({overrides:t,locale:e,labels:Ie(e,t)}));if(n.locale===e&&Fn(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:Ie(e,t)};return r(o),o.labels},Gs=(e,t,n)=>{const[r,o]=c.useState(()=>({scope:t,store:bt(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:bt(e,n)};return o(s),s.store},Fe=(e,t)=>{const[n,r]=c.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},Ks=()=>bs(zs),Ct="on",Ws="off",Xs=Object.freeze({kind:"unavailable"}),Ys=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")},Qs=(e,t)=>{const n=re(e.peek(t));return n===null||n.document.kind==="failure"?N.lastPathSegment(t):n.document.name},Js=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:i,renderTreeFailure:u,lockDocumentScroll:v=!1,onMathDiagnostics:m,onEditGrant:f,draftConverter:g})=>{Q.assertStorageNamespace(n),Ys(g);const p=Mt(r),y=qn(s),L=Zs(p,o),{revalidate:S}=X.useRevalidator(),R=c.useRef(()=>{}),M=X.useHref(t.dataPath),[C]=c.useState(()=>{const k=Ss({dataPath:M,onScope:_=>R.current(_)}),O={documents:mr({client:k,capacity:Math.max(Us,t.multiView.maxPanels*2)}),trees:js(k)};return $e(O,e),Q.syncStorageScope(n,e.scope),{data:k,...O,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(C.aligned.pageData!==e||C.aligned.storageNamespace!==n){const k=C.aligned.pageData;C.aligned.pageData=e,C.aligned.storageNamespace=n,k!==e&&(k.scope!==e.scope?C.aligned.pendingReader=e:$e(C,e)),Q.syncStorageScope(n,e.scope)}const a=Gs(Q.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);c.useLayoutEffect(()=>{const k=C.aligned.pendingReader;k!==null&&(C.aligned.pendingReader=null,Tt(C),$e(C,k))},[e,C]),c.useLayoutEffect(()=>{let k=!1;return R.current=O=>{O===e.scope||k||(k=!0,O!==null&&(Tt(C),Q.clearExplorerStorage(n)),S())},()=>{R.current=()=>{}}},[e,S,C,n]);const d=c.useRef(t.settingsCookie);c.useLayoutEffect(()=>{d.current=t.settingsCookie},[t.settingsCookie]);const[h]=c.useState(()=>Ms(e.settings,k=>{document.cookie=B.viewSettingsCookieString(d.current,k,window.location.protocol==="https:")})),x=Fe(e.scope,Ks),T=Fe(e.scope,ks),j=c.useRef(L);c.useLayoutEffect(()=>{j.current=L},[L]);const A=Fe(e.scope,()=>Un({data:C.data,conflictLabels:()=>({ours:j.current.conflictOurs,theirs:j.current.conflictTheirs}),onSaveSettled:(k,O)=>{O.kind==="saved"&&C.documents.refresh(k);const _=In(j.current,O,Qs(C.documents,k));_!==null&&x.announce(_)},sideBySideSetting:{read:()=>Q.readStorage(Q.storageKeys(n).editPreview)===Ct,write:k=>Q.writeStorage(Q.storageKeys(n).editPreview,k?Ct:Ws)}})),D=c.useMemo(()=>me(e.notices.catch(()=>[])),[e.notices]),q=e.sources.map(k=>k.id).join(`
|
|
12
|
+
`),F=c.useMemo(()=>B.withExplorerSources(t,q.split(`
|
|
13
|
+
`)),[t,q]),Z=c.useRef(m);c.useLayoutEffect(()=>{Z.current=m},[m]);const[W]=c.useState(()=>(k,O)=>{Z.current?.(k,O)}),K=m===void 0?void 0:W,I=c.useRef(g);c.useLayoutEffect(()=>{I.current=g},[g]);const[J]=c.useState(()=>{let k=!1;return{convert:(O,_)=>{const $=I.current;return $===void 0?Promise.resolve(Xs):$.convert(O,_)},prepare:()=>{try{I.current?.prepare?.()}catch(O){if(k)return;k=!0,console.error("[markdown-explorer] the draft converter's prepare threw",O)}}}}),w=g===void 0?void 0:J,b=c.useMemo(()=>({config:F,labels:L,locale:p,theme:y,storageNamespace:n,scope:e.scope,sources:e.sources,notices:D,documents:C.documents,trees:C.trees,data:C.data,viewSettings:h,treeSettings:a,announcer:x,reveals:T,edits:A,onEditGrant:f,draftConverter:w,renderTreeFailure:u,reportMathDiagnostics:K}),[F,L,p,y,n,e.scope,e.sources,D,C,h,a,x,T,A,f,w,u,K]);return l.jsx(Nt,{value:b,children:l.jsx(tl,{renderFrame:i,lockDocumentScroll:v},e.scope)})},el=({ref:e,theme:t,view:n,children:r})=>{const[o]=c.useState(Yr);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})},tl=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=P(),o=Se(),{hash:s}=X.useLocation(),i=pe(),u=c.useRef(null);Fs(t,u),c.useLayoutEffect(()=>{o.kind==="redirect"&&i(`${o.href}${s}`,"browse")},[o,s,i]);const{location:v}=o,m=v.view;Is(u,m);const f=v.view==="tree"?l.jsx(c.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading"}),children:l.jsx(Hs,{location:v})}):v.view==="multi"?l.jsx(c.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading"}),children:l.jsx(Vs,{location:v})}):l.jsx(Es,{location:v}),g=l.jsxs(el,{ref:u,theme:n,view:m,children:[f,l.jsx(Wn,{}),l.jsx(An,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?g:e({view:m,children:g})},nl=Mn.createShouldRevalidate({submissions:"skip",otherPath:"skip",query:"skip",hashChange:"skip"});exports.ALLOW_KEY_REPEAT=ye;exports.CONFLICT_OURS_MARKER=Pt;exports.CONFLICT_SEPARATOR=_t;exports.CONFLICT_THEIRS_MARKER=$t;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=Ot;exports.DocumentPane=gn;exports.DocumentRefreshBar=On;exports.EXPLORER_THEMES=He;exports.EditGrantNotice=bn;exports.ExplorerLink=Yt;exports.FailureView=le;exports.ForwardRef=wn;exports.ForwardRef$1=En;exports.ImageViewMemoryContext=an;exports.LazyNativeScrollBar=Jt;exports.LiveRegion=An;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=jt;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Ge;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=At;exports.MARKDOWN_EXPLORER_LOCALES=Be;exports.MarkdownExplorer=Js;exports.PAGE_DOCUMENT_REFRESH=Cn;exports.anchorOfDoubleClick=zt;exports.anchorOfView=Zt;exports.blockAtLine=Wt;exports.chooseEditView=ze;exports.consumeKey=ke;exports.createEmitter=ae;exports.editViewOf=yn;exports.explorerNavigationOptions=cr;exports.failureTitleOf=te;exports.findConflictsInLines=Ft;exports.focusWithoutScroll=Xe;exports.frameTopOf=Gt;exports.isApplePlatform=kn;exports.isEditViewShortcut=Rn;exports.isEditingDoubleClick=Ut;exports.lineTopIn=Xt;exports.loadedOf=re;exports.paneShownAlone=ss;exports.positionInSource=ir;exports.resolveMarkdownExplorerLabels=Ie;exports.shouldRevalidateExplorer=nl;exports.toggledEditView=Sn;exports.useExplorer=P;exports.useExplorerLocation=Se;exports.useExplorerNavigate=pe;exports.useIntentPrefetch=Qt;exports.usePageMarkupToggle=Tn;exports.useSideBySide=Ht;exports.useViewSetting=ue;exports.visibleTopOf=Kt;
|