@aiquants/markdown-explorer 0.25.0 → 0.27.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 +77 -0
- package/README.md +40 -25
- package/dist/{EditSurface-Co4Rvfa1.cjs → EditSurface-B1yD7ywF.cjs} +1 -1
- package/dist/{EditSurface-Blymamic.js → EditSurface-sUNqYw9o.js} +5 -5
- package/dist/{ExplorerSplit-WApgYMPb.cjs → ExplorerSplit-Bn3ZnEMZ.cjs} +1 -1
- package/dist/{ExplorerSplit-BZ0PA3z3.js → ExplorerSplit-pClUl3-e.js} +3 -3
- package/dist/{MultiLayout-dAW_JCzg.cjs → MultiLayout-0Jh08fxo.cjs} +1 -1
- package/dist/{MultiLayout-B5-1N3JD.js → MultiLayout-B-ft4_Vs.js} +4 -4
- package/dist/{NativeScrollBar-BraWuZvN.js → NativeScrollBar-ByawerpG.js} +1 -1
- package/dist/{NativeScrollBar-ThVMbI0Y.cjs → NativeScrollBar-D9QrjRJa.cjs} +1 -1
- package/dist/{TreeLayout-C60lb9hP.cjs → TreeLayout-CXHbKdxy.cjs} +1 -1
- package/dist/{TreeLayout-CChoxh9W.js → TreeLayout-DjIVKBG4.js} +3 -3
- package/dist/core/config.d.cts +7 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/contracts.d.cts +8 -2
- package/dist/core/contracts.d.ts +8 -2
- package/dist/core/dataRoute.d.cts +40 -0
- package/dist/core/dataRoute.d.ts +40 -0
- package/dist/core/labels.d.cts +10 -1
- package/dist/core/labels.d.ts +10 -1
- package/dist/{dataRoute-BEvesOvN.js → dataRoute-DLhQfdoW.js} +111 -103
- package/dist/dataRoute-DwYtgyt6.cjs +1 -0
- package/dist/index-BNAkC0g3.js +4800 -0
- package/dist/index-DRMNpWDJ.cjs +15 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -26
- package/dist/{location-DIxIjqs7.js → location-BNFdxzhn.js} +134 -130
- package/dist/location-yvU5HUY1.cjs +1 -0
- package/dist/{merge-DRWmjC24.cjs → merge-BBU1pDoT.cjs} +1 -1
- package/dist/{merge-CgSp-0Dd.js → merge-DhHzRcAI.js} +1 -1
- package/dist/{sanitizePolicy-gVKBhabq.js → sanitizePolicy-By0tKOpZ.js} +1 -1
- package/dist/{sanitizePolicy-CZwOaJ92.cjs → sanitizePolicy-T5T-3vV5.cjs} +1 -1
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +1 -1
- package/dist/server/ports.d.cts +4 -3
- package/dist/server/ports.d.ts +4 -3
- package/dist/server.cjs +1 -1
- package/dist/server.js +500 -493
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{useSplitPersistence-Df63lnQZ.js → useSplitPersistence-D5EjJwCg.js} +1 -1
- package/dist/{useSplitPersistence-D-T75Hlh.cjs → useSplitPersistence-xGOSwpLM.cjs} +1 -1
- package/docs/behavior/dom-hooks.md +10 -6
- package/docs/behavior/layout.md +8 -3
- package/docs/behavior/localization.md +5 -2
- package/docs/behavior/security.md +7 -2
- package/docs/behavior/url-contract.md +3 -3
- package/package.json +5 -5
- package/dist/dataRoute-Cv7fgCW7.cjs +0 -1
- package/dist/index-B6FkGD-p.cjs +0 -13
- package/dist/index-Bd6hgisa.js +0 -4097
- package/dist/location-D3DgoELB.cjs +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),d=require("react"),te=require("react-router"),z=require("./location-yvU5HUY1.cjs"),ve=require("@aiquants/markdown/code-blocks"),_=require("./dataRoute-DwYtgyt6.cjs"),xe=require("@aiquants/markdown"),ft=require("@aiquants/markdown/source-lines"),mt=require("@aiquants/spreadsheet/tsv"),Ut=require("@aiquants/spreadsheet/view"),mo=require("@aiquants/markdown/viewer-settings"),J=require("./storage-DM0EvkVf.cjs"),ho=require("@aiquants/route-revalidation");function po(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 k=po(d),ht=Object.freeze(["en","ja"]),On="en",yt=e=>`viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,Cn=Object.freeze(Object.keys(ve.SPREADSHEET_BLOCK_LABEL_CATALOGS.en)),Ln=e=>Object.fromEntries(Cn.map(t=>[yt(t),ve.SPREADSHEET_BLOCK_LABEL_CATALOGS[e][t].text])),An=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"]),viewerSvgImageSourceRegion:Object.freeze(["name"]),...Object.fromEntries(Cn.filter(e=>ve.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e].length>0).map(e=>[yt(e),ve.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e]]))}),go=/\{(\w+)\}/gu,Mn={...Ln("en"),explorerRegion:"Explorer",sourceLabel:"Source",refreshTreeLabel:"Refresh tree",refreshTree:"Reload the tree and the open documents from the source",treeRefreshed:"Reloaded the tree from the source",treeRefreshFailed:e=>`Could not reload the tree: ${e}`,refreshDocumentLabel:"Refresh document",refreshDocument:"Reload the document from the source",refreshDocumentNamed:e=>`Refresh ${e}`,documentRefreshed:e=>`Reloaded ${e}`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,showMarkupLabel:"Source",showMarkup:"Show the document's Markdown as written",showSvgMarkup:"Show the image's SVG as written",showSpreadsheetMarkup:e=>`Show the table's ${e} as written`,showMarkupNamed:e=>`Source of ${e}`,editDocumentLabel:"Edit",editDocument:"Edit the document's Markdown (or double-click the document)",editDocumentNamed:e=>`Edit ${e}`,editDraftDocument:"Edit the document's Markdown without saving, to try it in the preview (or double-click the document)",editDraftDocumentNamed:e=>`Edit ${e} without saving`,editExternallyLabel:"Open in its editor",editExternally:"Open the document in its own editor, in a new tab",editExternallyNamed:e=>`Open ${e} in its editor`,editorRegion:e=>`Editing ${e}`,editorLabel:e=>`Markdown of ${e}`,editLoading:"Loading the source for editing…",editToolbar:"Editor",saveDraft:"Save",saveDraftTooltip:"Save the draft (Ctrl+S, or ⌘S on a Mac)",closeEditor:"Close editor",editView:"View",editViewNamed:e=>`View of ${e}`,editViewEditor:"Editor",editViewEditorTooltip:"Show the editor (Ctrl+E, or ⌘E on a Mac, switches with the preview)",editViewSplit:"Side by side",editViewSplitTooltip:"Show the editor and the preview side by side",editViewSplitResize:"Resize the editor and the preview",editViewPreview:"Preview",editViewPreviewTooltip:"Show the preview (Ctrl+E, or ⌘E on a Mac, switches with the editor)",historyOpen:"History",draftUnsaved:"Unsaved changes",draftStatus:"Draft, not saved",draftNotSaved:"This draft is not saved: the document cannot be saved here.",draftSaving:"Saving…",draftSaved:"Saved",draftSavedMerged:"Saved, merged with changes saved elsewhere",draftConflicts:e=>e===1?"1 conflict with changes saved elsewhere: choose what to keep, then save":`${e} conflicts with changes saved elsewhere: choose what to keep, then save`,draftSaveFailed:e=>`Could not save: ${e}`,documentSaved:e=>`Saved ${e}`,documentSavedMerged:e=>`Saved ${e}, merged with changes saved elsewhere`,conflictOurs:"your draft",conflictTheirs:"saved elsewhere",conflictUseOurs:"Use my lines",conflictUseTheirs:"Use the saved lines",conflictKeepBoth:"Keep both",conflictNext:"Next conflict",editGrantTitle:"Editing needs your permission",editGrantBody:"Allow this site to change documents on your behalf. You are asked once; signing out asks again.",editGrantAction:"Grant permission",editGrantRetry:"Try again",unsavedTitle:"Discard unsaved changes?",unsavedBody:e=>`${e} has changes that are not saved.`,unsavedDiscard:"Discard changes",draftDiscardTitle:"Discard the draft?",draftDiscardBody:e=>`The changes to ${e} are not saved anywhere and will be lost.`,unsavedStay:"Keep editing",historyTitle:e=>`Revisions of ${e}`,historyLoading:"Loading the revisions…",historyEmpty:"No revisions are kept for this document.",historyCurrent:"Current",historyKept:"Kept",historyEntry:(e,t)=>t===""?e:`${e} by ${t}`,historyRestore:"Put into the draft",historyClose:"Close",historyRestored:e=>`Put the revision into the draft of ${e}; save to keep it`,previewRegion:"Preview",previewUpdating:"Updating the preview…",previewFailed:e=>`Could not preview: ${e}`,previewTablePending:"This table can be edited once the preview shows the draft.",expandAll:"Expand all folders",collapseAll:"Collapse all folders",treeSettings:"Tree settings",switchToMulti:"Open in the multi-panel view",switchToTree:"Open in the tree view",resizeExplorer:"Resize the explorer",showExplorer:"Show the explorer",hideExplorer:"Close the explorer",treeRegion:"Documents",treeLoading:"Loading the tree…",treeEmptyTitle:"Nothing to show",treeEmptyBody:"This source has no documents you can open.",folderLoadFailed:"This folder could not be loaded.",loopFolderName:e=>`${e} (already open above)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("en",{type:"conjunction"}).format(e)} could not be loaded`,foldersLoading:e=>e===1?"Loading 1 folder…":`Loading ${String(e)} folders…`,expandAllStarted:"Opening all folders…",expandAllProgress:(e,t)=>`Opening all folders (${String(e)} opened, ${String(t)} loading)…`,expandAllDone:(e,t,n)=>{const r=`Opened ${String(e)} ${e===1?"folder":"folders"}`;return t>0?`${r}; ${String(t)} could not be loaded`:n?e===0?"All folders are already open":`${r}; every folder is open`:r},expandAllFolderLimit:(e,t,n)=>`Opened ${String(e)} ${e===1?"folder":"folders"} and stopped at the limit of ${String(t)} ${t===1?"folder":"folders"} to load. Choose "${n}" again to continue`,expandAllDepthLimit:(e,t)=>`Opened ${String(e)} ${e===1?"folder":"folders"}; folders more than ${String(t)} ${t===1?"level":"levels"} deep stay closed`,treeEntryKindDirectory:"directory",treeEntryKindFile:"file",treeScrollUp:"Scroll up",treeScrollDown:"Scroll down",treeScrollToTop:"Top",treeScrollToBottom:"Bottom",selectionTitle:e=>`Selected (${String(e)})`,clearSelection:"Clear the selection",openSelectionInMulti:e=>`Open ${String(e)} in panels`,removeFromSelection:e=>`Remove ${e} from the selection`,settingSortMode:"Sort order",sortNative:"Source order",sortAscending:"Name A→Z",sortDescending:"Name Z→A",sortOldest:"Modified old→new",sortNewest:"Modified new→old",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",settingReadmePlacement:"README",readmePlacementMixed:"Mixed",readmePlacementFirst:"First",readmePlacementLast:"Last",settingSelectionMode:"Selection",selectionSingle:"Single",selectionMultiple:"Multiple",selectionNone:"Off",settingDoubleClick:"Double-click",doubleClickRecursive:"Expand all levels",doubleClickToggle:"Toggle",settingExpandIconSize:"Expander size",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"Always expanded",settingRevealDocument:"Reveal the open document",settingRemoveRootIndent:"No root indent",settingTreeLines:"Tree lines",settingExpandIcons:"Expanders",settingDirectoryIcons:"Folder icons",settingFileIcons:"File icons",settingOn:"On",settingOff:"Off",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"Document",documentEmpty:"Select a document in the explorer.",folderReadmeMissing:e=>`${e} has no README.`,documentLoading:"Loading the document…",markupLoading:"Loading the source…",spreadsheetLoading:"Loading the table…",documentShown:e=>`Showing ${e}`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[.!?]$/u.test(t)?t:`${t}.`).join(" "),textTruncated:"Only the beginning of this file is shown.",inertLink:"This link points outside the source and cannot be opened.",failureUnauthorizedTitle:"Your session has expired",failureUnauthorizedBody:"Reload the page to sign in again.",failureForbiddenTitle:"Access denied",failureForbiddenBody:"You do not have permission to open this.",failureNotFoundTitle:"Not found",failureNotFoundBody:"It may have been moved or deleted.",failureNotConfiguredTitle:"This source is not set up",failureNotConfiguredBody:"Ask your administrator to configure it.",failureInvalidTitle:"Invalid address",failureInvalidBody:"The document path in this address cannot be used.",failureTooLargeTitle:"Too large to display",failureTooLargeBody:"This file exceeds the size that can be displayed.",failureUnsupportedTitle:"Cannot be displayed",failureUnsupportedBody:"This type of file cannot be shown here.",failureFailedTitle:"Something went wrong",failureFailedBody:"Try again in a moment.",retry:"Try again",reloadPage:"Reload the page",imageZoomIn:"Zoom in",imageZoomOut:"Zoom out",imageFit:"Fit to the view",imageFitLevel:"Fit",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"Open in a new tab",download:"Download",copyText:"Copy the text",copiedText:"Copied the text",copyTextFailed:"Could not copy the text",mediaUnsupported:"Your browser cannot play this file.",fileNotShown:"This file cannot be shown here. Download it to open it.",pdfNotShown:"This browser does not show PDF files inside the page. Open it in a new tab or download it.",spreadsheetWorkbookFirstSheet:"The whole workbook could not be read, so only its first sheet is shown.",spreadsheetSheets:e=>`Sheets of ${e}`,spreadsheetSheetName:(e,t)=>`${e}, sheet ${t}`,spreadsheetUnshownSheets:e=>e===1?"1 sheet is not shown (a hidden sheet or a chart sheet).":`${e} sheets are not shown (hidden sheets or chart sheets).`,spreadsheetUnlistedSheets:e=>`Only the first ${e} sheets are listed.`,spreadsheetSheetLoading:"Loading the sheet…",spreadsheetSheetEmpty:"This sheet has no data.",spreadsheetWorkbookEncrypted:"This workbook is password-protected, so it cannot be shown. Download it to open it.",spreadsheetNotWorkbook:"This file cannot be read as an Excel (.xlsx) or OpenDocument (.ods) workbook. Download it to open it.",spreadsheetWorkbookTooLarge:"This workbook is too large to preview. Download it to open it.",spreadsheetTruncated:"The table shows only part of this file. Download it to open the whole file.",spreadsheetUnreadableEncoding:([e,t])=>t===void 0?`This file's text is not ${e}, so it cannot be shown as a table. Download it to open it.`:`This file's text is neither ${e} nor ${t}, so it cannot be shown as a table. Download it to open it.`,spreadsheetEmpty:"This file has no data.",spreadsheetNotText:"This file is not text, so it cannot be shown as a table. Download it to open it.",spreadsheetLongRow:"No row of this file ends within the part read for the preview, so it cannot be shown as a table. Download it to open it.",spreadsheetFullscreen:e=>`${e} (full screen)`,viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display Style",viewerSelectStyle:"Select display style",viewerPinStyle:"Pin style selector",viewerUnpinStyle:"Unpin style selector",viewerErrorTitle:"An error occurred",viewerMissingImage:"Image not found",viewerOpenToc:"Open table of contents",viewerTocTitle:"Table of contents",viewerPinToc:"Pin table of contents",viewerUnpinToc:"Unpin table of contents",viewerSelectAlign:"Select alignment",viewerAlignTitle:"Alignment",viewerPinAlign:"Pin alignment selector",viewerUnpinAlign:"Unpin alignment selector",viewerAlignLeft:"Align left",viewerAlignCenter:"Align center",viewerAlignRight:"Align right",viewerMermaidInteractionMode:"Mouse interaction mode",viewerMermaidInteractionModeTouch:"Touch interaction mode",viewerMermaidModeNone:"No interaction",viewerMermaidModeZoom:"Zoom only",viewerMermaidModePan:"Pan only (drag)",viewerMermaidModePanShift:"Pan only (Shift+drag)",viewerMermaidModeBoth:"Zoom and pan (drag)",viewerMermaidModeBothShift:"Zoom and pan (Shift+drag)",viewerMermaidModeNoneTouch:"No interaction (a finger scrolls the page)",viewerMermaidModeZoomTouch:"Zoom only (two fingers)",viewerMermaidModePanTouch:"Pan only (one-finger drag while the diagram overflows)",viewerMermaidModeBothTouch:"Zoom and pan (two fingers, one finger while the diagram overflows)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidPanUp:"Pan Up",viewerMermaidPanDown:"Pan Down",viewerMermaidPanLeft:"Pan Left",viewerMermaidPanRight:"Pan Right",viewerMermaidDiagram:"Diagram (arrow keys pan, + and - zoom, 0 resets)",viewerMermaidRetry:"Try again",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",viewerBlockFailed:"This block could not be shown.",viewerSvgImageToolbar:"SVG image",viewerSvgImageSource:"Source",viewerSvgImageSourceRegion:"Source of {name}",viewerSvgImageLoading:"Loading the source…",viewerSvgImageFailed:"The source could not be read.",viewerSvgImageRetry:"Try again",viewerSvgImageTruncated:"Only the beginning of this file is shown.",viewerSvgImageCopy:"Copy the source",viewerSvgImageCopied:"Copied the source.",viewerSvgImageCopyFailed:"Could not copy the source.",viewerSvgImageCopyImage:"Copy the image",viewerSvgImageCopiedImage:"Copied the image.",viewerSvgImageCopyImageFailed:"Could not copy the image.",multiRegion:"Panels",multiEmpty:"Select documents in the explorer to open them side by side.",panelLimit:e=>`You can open up to ${String(e)} panels at once.`,panelOpened:e=>`Opened ${e}`,panelClosed:e=>`Closed ${e}`,panelAlreadyOpen:e=>`${e} is already open`,panelHidden:e=>`Hid ${e}`,panelShown:e=>`Showed ${e}`,panelMaximized:e=>`Maximized ${e}`,panelRestored:e=>`Restored ${e} to its size`,panelHide:"Hide the panel",panelMaximize:"Maximize the panel",panelRestore:"Restore the panel to its size",panelClose:"Close the panel",panelSwitchToCustomDrag:"Switch to the custom drag mode",panelSwitchToNormalDrag:"Back to the normal drag mode",panelCustomDragBadge:"Custom",panelMove:"Move the panel",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoved:"Moved {title} to column {column}, position {position}",panelMoveUnavailable:"{move} is not available for {title}",panelDragStarted:"Picked up {title}",panelDragCancelled:"Kept {title} where it was",hiddenPanelsTitle:"Hidden panels:",hiddenPanelBadge:"Hidden",hiddenPanelNotice:"This panel is hidden",multiColumnEmpty:"This column is empty",multiColumnRegion:"Column {column}",panelDropHere:"Drop the panel here"},wo={...Ln("ja"),explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,showMarkupLabel:"ソース",showMarkup:"文書の Markdown を書いたまま表示",showSvgMarkup:"画像の SVG を書いたまま表示",showSpreadsheetMarkup:e=>`表の ${e} を書いたまま表示`,showMarkupNamed:e=>`${e} のソース`,editDocumentLabel:"編集",editDocument:"文書の Markdown を編集 (文書のダブルクリックでも)",editDocumentNamed:e=>`${e} を編集`,editDraftDocument:"文書の Markdown を保存せずに編集し、プレビューで確かめる (文書のダブルクリックでも)",editDraftDocumentNamed:e=>`${e} を保存せずに編集`,editExternallyLabel:"元のエディタで開く",editExternally:"文書を元のエディタで、新しいタブに開く",editExternallyNamed:e=>`${e} を元のエディタで開く`,editorRegion:e=>`${e} を編集中`,editorLabel:e=>`${e} の Markdown`,editLoading:"編集のためにソースを読み込み中…",editToolbar:"エディタ",saveDraft:"保存",saveDraftTooltip:"下書きを保存 (Ctrl+S、Mac は ⌘S)",closeEditor:"編集を閉じる",editView:"表示",editViewNamed:e=>`${e} の表示`,editViewEditor:"エディタ",editViewEditorTooltip:"エディタを表示 (Ctrl+E、Mac は ⌘E でプレビューと切り替え)",editViewSplit:"並べて表示",editViewSplitTooltip:"エディタとプレビューを並べて表示",editViewSplitResize:"エディタとプレビューの割合を変更",editViewPreview:"プレビュー",editViewPreviewTooltip:"プレビューを表示 (Ctrl+E、Mac は ⌘E でエディタと切り替え)",historyOpen:"履歴",draftUnsaved:"保存していない変更があります",draftStatus:"保存しない下書き",draftNotSaved:"この下書きは保存しません。ここでは文書を保存できません。",draftSaving:"保存中…",draftSaved:"保存しました",draftSavedMerged:"ほかで保存された変更と統合して保存しました",draftConflicts:e=>`ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,draftSaveFailed:e=>`保存できませんでした: ${e}`,documentSaved:e=>`${e} を保存しました`,documentSavedMerged:e=>`${e} を、ほかで保存された変更と統合して保存しました`,conflictOurs:"あなたの下書き",conflictTheirs:"ほかで保存された版",conflictUseOurs:"自分の行を使う",conflictUseTheirs:"保存された行を使う",conflictKeepBoth:"両方を残す",conflictNext:"次の衝突へ",editGrantTitle:"編集には許可が必要です",editGrantBody:"このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",editGrantAction:"許可する",editGrantRetry:"もう一度試す",unsavedTitle:"保存していない変更を破棄しますか?",unsavedBody:e=>`${e} に保存していない変更があります。`,unsavedDiscard:"変更を破棄",draftDiscardTitle:"下書きを破棄しますか?",draftDiscardBody:e=>`${e} への変更はどこにも保存されず、失われます。`,unsavedStay:"編集を続ける",historyTitle:e=>`${e} の版`,historyLoading:"版の一覧を読み込み中…",historyEmpty:"この文書の版は残っていません。",historyCurrent:"現在の版",historyKept:"保持",historyEntry:(e,t)=>t===""?e:`${e} (${t})`,historyRestore:"下書きに戻す",historyClose:"閉じる",historyRestored:e=>`${e} の下書きに版を戻しました。残すには保存してください`,previewRegion:"プレビュー",previewUpdating:"プレビューを更新中…",previewFailed:e=>`プレビューできませんでした: ${e}`,previewTablePending:"プレビューが下書きを描くと、この表を編集できます。",expandAll:"すべてのフォルダーを展開",collapseAll:"すべてのフォルダーを折りたたむ",treeSettings:"ツリーの設定",switchToMulti:"マルチビューで開く",switchToTree:"ツリービューで開く",resizeExplorer:"エクスプローラーの幅を変更",showExplorer:"エクスプローラーを開く",hideExplorer:"エクスプローラーを閉じる",treeRegion:"文書の一覧",treeLoading:"ツリーを読み込み中…",treeEmptyTitle:"表示できるファイルがありません",treeEmptyBody:"このソースには開ける文書がありません。",folderLoadFailed:"このフォルダーを読み込めませんでした。",loopFolderName:e=>`${e} (上の階層で開いています)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("ja",{type:"conjunction"}).format(e)} を読み込めませんでした`,foldersLoading:e=>`フォルダーを ${String(e)} 件読み込み中…`,expandAllStarted:"すべてのフォルダーを展開しています…",expandAllProgress:(e,t)=>`すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,expandAllDone:(e,t,n)=>{const r=`${String(e)} 件のフォルダーを展開しました`;return t>0?`${r}。うち ${String(t)} 件は読み込めませんでした`:n?e===0?"すべてのフォルダーが既に開いています":`${r}。すべてのフォルダーが開いています`:r},expandAllFolderLimit:(e,t,n)=>`${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,expandAllDepthLimit:(e,t)=>`${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,treeEntryKindDirectory:"ディレクトリ",treeEntryKindFile:"ファイル",treeScrollUp:"上へスクロール",treeScrollDown:"下へスクロール",treeScrollToTop:"先頭へ",treeScrollToBottom:"末尾へ",selectionTitle:e=>`選択中 (${String(e)})`,clearSelection:"選択を解除",openSelectionInMulti:e=>`${String(e)} 件をパネルで開く`,removeFromSelection:e=>`${e} を選択から外す`,settingSortMode:"並び順",sortNative:"取得順",sortAscending:"名前の昇順",sortDescending:"名前の降順",sortOldest:"更新日時の昇順 (古い順)",sortNewest:"更新日時の降順 (新しい順)",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingReadmePlacement:"README の位置",readmePlacementMixed:"混ぜる",readmePlacementFirst:"先に",readmePlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",folderReadmeMissing:e=>`${e} には README がありません。`,documentLoading:"文書を読み込み中…",markupLoading:"ソースを読み込み中…",spreadsheetLoading:"表を読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",pdfNotShown:"このブラウザはページの中に PDF を表示しません。新しいタブで開くか、ダウンロードしてください。",spreadsheetWorkbookFirstSheet:"ブック全体を読めなかったため、最初のシートだけを表示しています。",spreadsheetSheets:e=>`${e} のシート`,spreadsheetSheetName:(e,t)=>`${e} のシート「${t}」`,spreadsheetUnshownSheets:e=>`非表示のシートかグラフのシートが ${e} 枚あり、表示していません。`,spreadsheetUnlistedSheets:e=>`最初の ${e} 枚のシートだけを並べています。`,spreadsheetSheetLoading:"シートを読み込み中…",spreadsheetSheetEmpty:"このシートにはデータがありません。",spreadsheetWorkbookEncrypted:"このブックはパスワードで保護されているため、表示できません。ダウンロードして開いてください。",spreadsheetNotWorkbook:"このファイルは Excel (.xlsx) や OpenDocument (.ods) のブックとして読めません。ダウンロードして開いてください。",spreadsheetWorkbookTooLarge:"このブックはプレビューするには大きすぎます。ダウンロードして開いてください。",spreadsheetTruncated:"表はこのファイルの一部だけを表示しています。全体はダウンロードして開いてください。",spreadsheetUnreadableEncoding:([e,t])=>t===void 0?`このファイルの文字は ${e} ではないため、表として表示できません。ダウンロードして開いてください。`:`このファイルの文字は ${e} でも ${t} でもないため、表として表示できません。ダウンロードして開いてください。`,spreadsheetEmpty:"このファイルにはデータがありません。",spreadsheetNotText:"このファイルは文字のファイルではないため、表として表示できません。ダウンロードして開いてください。",spreadsheetLongRow:"プレビューに読む範囲の中でこのファイルの行が 1 つも終わらないため、表として表示できません。ダウンロードして開いてください。",spreadsheetFullscreen:e=>`${e} (全画面)`,viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidInteractionModeTouch:"タッチ操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidModeNoneTouch:"操作なし (指はページをスクロール)",viewerMermaidModeZoomTouch:"拡大縮小のみ (2 本指)",viewerMermaidModePanTouch:"移動のみ (はみ出す図を 1 本指でドラッグ)",viewerMermaidModeBothTouch:"拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidPanUp:"上へ移動",viewerMermaidPanDown:"下へ移動",viewerMermaidPanLeft:"左へ移動",viewerMermaidPanRight:"右へ移動",viewerMermaidDiagram:"図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",viewerMermaidRetry:"再試行",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",viewerBlockFailed:"このブロックを表示できませんでした。",viewerSvgImageToolbar:"SVG の画像",viewerSvgImageSource:"ソース",viewerSvgImageSourceRegion:"{name} のソース",viewerSvgImageLoading:"ソースを読み込み中…",viewerSvgImageFailed:"ソースを読み込めませんでした。",viewerSvgImageRetry:"再試行",viewerSvgImageTruncated:"このファイルは先頭だけを表示しています。",viewerSvgImageCopy:"ソースをコピー",viewerSvgImageCopied:"ソースをコピーしました。",viewerSvgImageCopyFailed:"ソースをコピーできませんでした。",viewerSvgImageCopyImage:"画像をコピー",viewerSvgImageCopiedImage:"画像をコピーしました。",viewerSvgImageCopyImageFailed:"画像をコピーできませんでした。",multiRegion:"パネル",multiEmpty:"エクスプローラーで文書を選ぶと、ここに並べて開きます。",panelLimit:e=>`同時に開けるのは ${String(e)} パネルまでです。`,panelOpened:e=>`${e} を開きました`,panelClosed:e=>`${e} を閉じました`,panelAlreadyOpen:e=>`${e} は既に開いています`,panelHidden:e=>`${e} を隠しました`,panelShown:e=>`${e} を表示しました`,panelMaximized:e=>`${e} を最大化しました`,panelRestored:e=>`${e} を元のサイズに戻しました`,panelHide:"パネルを隠す",panelMaximize:"パネルを最大化",panelRestore:"パネルを元のサイズに戻す",panelClose:"パネルを閉じる",panelSwitchToCustomDrag:"カスタムのドラッグの方式に切り替え",panelSwitchToNormalDrag:"通常のドラッグの方式に戻す",panelCustomDragBadge:"カスタム",panelMove:"パネルを移動",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},Nn=Object.freeze({en:Object.freeze(Mn),ja:Object.freeze(wo)}),kt=Object.freeze(Object.keys(Mn)),vo=new Set(kt),xo=e=>vo.has(e),$e=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,jn=e=>{if(e===void 0)return On;if(ht.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${ht.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${$e(e)}`)},pt=(e,t)=>{const n=Nn[jn(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${$e(t)}`);if(!z.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${$e(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!xo(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${kt.join(", ")}`);const a=r[s];if(a===void 0)continue;const i=typeof n[s];if(typeof a!==i)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${i}; got ${$e(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const m=An[s];if(typeof a=="string"&&m!==void 0){for(const[,f]of a.matchAll(go))if(!m.includes(f??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(f)}}; it accepts ${m.map(c=>`{${c}}`).join(", ")}`)}o[s]=a}return Object.freeze(o)},Eo=(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(a=>Object.hasOwn(n,a)&&Object.is(n[a],r[a]))},gt=Object.freeze(["light","dark"]),bo=e=>{if(e===void 0)return"light";if(gt.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${gt.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},Dn=d.createContext(null),$=()=>{const e=d.use(Dn);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},Re=e=>{const{viewSettings:t}=$(),n=()=>e(t.getSnapshot());return d.useSyncExternalStore(t.subscribe,n,n)},Ze=()=>{const{config:e}=$(),t=te.useParams()["*"],[n]=te.useSearchParams(),r=n.toString();return d.useMemo(()=>z.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Pn={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"]},re=(e,t)=>e[Pn[t][0]],ce=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=$(),s=re(o,e.reason),a=o[Pn[e.reason][1]],i=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":i,"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:a}),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]})},yo=(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 re(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(re(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},ko=(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(re(e,t.failure.reason));case"idle":case"saving":return null}},Ee=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},_n="<<<<<<<",In="=======",$n=">>>>>>>",Ht=(e,t)=>e===t||e.startsWith(`${t} `),zt=e=>Fn(e.split(`
|
|
2
|
+
`)),Fn=e=>{const t=[];let n=null,r=null,o=0;for(const s of e){o+=1;const a=s.charCodeAt(0);a!==60&&a!==61&&a!==62||(Ht(s,_n)?(n=o,r=null):s===In?n!==null&&r===null?r=o:n=null:Ht(s,$n)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},Vt=e=>e.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,Qe=e=>e.replace(/\r\n?/gu,`
|
|
6
|
+
`),So=(e,t)=>t===`
|
|
7
|
+
`?e:e.replaceAll(`
|
|
8
|
+
`,`\r
|
|
9
|
+
`),Ro=3,To=/^\d+(?:\.\d+)?$/u,Oo=e=>{if(e===null||!To.test(e))return null;const t=Number(e);return t>=z.EDIT_SPLIT_MIN_PERCENT&&t<=z.EDIT_SPLIT_MAX_PERCENT?t:null},Je=Object.freeze({kind:"idle"}),Zt=Object.freeze({kind:"draft"}),Co=({data:e,conflictLabels:t,onSaveSettled:n,sideBySideSetting:r,editorShareSetting:o})=>{const s=new Map,a=new Map,i=new Map,m=new Map,f=new Map,c=Ee();let u=null,p=null,w=null;const x=(h,g)=>{h.value={...h.value,...g},c.emit()},b=(h,g)=>s.get(h)===g,T=async(h,g)=>{g.controller.abort(),g.controller=new AbortController;const{signal:R}=g.controller;x(g,{phase:{kind:"opening"}});const N=await e.edit(h,R);if(!b(h,g)||R.aborted||!("kind"in N))return;if(N.kind==="grant"){x(g,{phase:{kind:"grant",href:N.href}});return}if(N.kind==="failure"){x(g,{phase:{kind:"failed",failure:N.failure}});return}const I=Qe(N.text),F=N.kind==="draft";g.base={text:I,version:F?null:N.version},g.draft=I,g.ending=Vt(N.text),x(g,{phase:{kind:"editing"},history:F?!1:N.history,dirty:!1,save:F?Zt:Je,generation:g.value.generation+1})},L=h=>{const g=s.get(h);g!==void 0&&(g.controller.abort(),s.delete(h),i.delete(h))},O=(h,g,R)=>(h.set(g,R),()=>{h.get(g)===R&&h.delete(g)}),q=(h,g,R,N={})=>{x(g,{...N,save:R}),n(h,R)},D=async h=>{m.get(h)?.flush();const g=s.get(h);if(g===void 0||g.value.phase.kind!=="editing"||g.base===null||g.value.save.kind==="saving")return;const{version:R}=g.base;if(R===null){n(h,Zt);return}const N=zt(g.draft).length;if(N>0){q(h,g,{kind:"conflicts",count:N});return}g.controller.abort(),g.controller=new AbortController;const{signal:I}=g.controller;let F={text:g.base.text,version:R},E=g.draft,S=!1;x(g,{save:{kind:"saving"}});for(let A=0;A<Ro;A+=1){const M=await e.save(h,F.version,So(E,g.ending),I);if(!b(h,g)||I.aborted||!("kind"in M))return;if(M.kind==="saved"){m.get(h)?.flush(),g.base={text:E,version:M.version},q(h,g,{kind:"saved",merged:S},{dirty:g.draft!==E});return}if(M.kind==="grant"){q(h,g,{kind:"grant",href:M.href});return}if(M.kind==="failure"){q(h,g,{kind:"failed",failure:M.failure});return}const{mergeDraft:P}=await Promise.resolve().then(()=>require("./merge-BBU1pDoT.cjs"));if(!b(h,g)||I.aborted)return;const B=m.get(h);B?.flush();const G=Qe(M.text),v=P(F.text,g.draft,G,t());if(F={text:G,version:M.version},g.base=F,g.ending=Vt(M.text),g.draft=v.text,B?.adopt(v.text),v.kind==="conflicts"){q(h,g,{kind:"conflicts",count:v.conflicts},{dirty:!0,generation:g.value.generation+1});return}if(S=!0,E=v.text,E===F.text){q(h,g,{kind:"saved",merged:S},{dirty:!1,generation:g.value.generation+1});return}x(g,{dirty:!0,generation:g.value.generation+1})}q(h,g,{kind:"failed",failure:{reason:"failed"}})};return{session:h=>s.get(h)?.value,subscribe:c.subscribe,start:(h,g)=>{const R=s.get(h);if(R!==void 0){x(R,{request:{anchor:g},view:"editor"}),(R.value.phase.kind==="failed"||R.value.phase.kind==="grant")&&T(h,R);return}a.delete(h);const N={value:{path:h,phase:{kind:"opening"},view:"editor",previewPrepared:!1,history:!1,dirty:!1,save:Je,generation:0,request:{anchor:g}},base:null,draft:"",ending:`
|
|
10
|
+
`,controller:new AbortController};s.set(h,N),T(h,N)},retry:h=>{const g=s.get(h);g===void 0||g.value.phase.kind==="editing"||T(h,g)},draft:h=>{const g=s.get(h);return g===void 0||g.base===null?null:g.draft},setDraft:(h,g)=>{const R=s.get(h);if(R===void 0||R.base===null)return;R.draft=g;const N={},I=g!==R.base.text;I!==R.value.dirty&&(N.dirty=I);const{save:F}=R.value;if(F.kind==="conflicts"){const E=zt(g).length;E===0?N.save=Je:E!==F.count&&(N.save={kind:"conflicts",count:E})}(N.dirty!==void 0||N.save!==void 0)&&x(R,N)},consumeRequest:h=>{const g=s.get(h);g!==void 0&&g.value.request!==null&&x(g,{request:null})},save:D,replaceDraft:(h,g)=>{const R=m.get(h);R?.flush();const N=s.get(h);if(N===void 0||N.base===null)return;const I=Qe(g);N.draft=I,R?.adopt(I),x(N,{dirty:I!==N.base.text,generation:N.value.generation+1})},close:h=>{if(!s.has(h))return;const g=m.get(h),R=g===void 0?null:g.returnPoint();L(h),R===null?a.delete(h):a.set(h,R),c.emit()},takeReturn:h=>{const g=a.get(h)??null;return a.delete(h),g},dirtyPaths:()=>[...s.values()].filter(h=>h.value.dirty).map(h=>h.value.path),discard:h=>{for(const g of h)L(g);h.length>0&&c.emit()},editorState:{get:h=>i.get(h),set:(h,g)=>{s.has(h)&&i.set(h,g)}},bindEditor:(h,g)=>O(m,h,g),bindView:(h,g)=>O(f,h,g),viewAnchor:h=>{const g=f.get(h);return g===void 0?null:g.anchor()},flush:h=>m.get(h)?.flush(),flushDrafts:()=>{for(const h of m.values())h.flush()},nextConflict:h=>m.get(h)?.nextConflict()===!0,hasSessions:()=>s.size>0,unsavedAmong:h=>{for(const g of m.values())g.flush();return h.filter(g=>s.get(g)?.value.dirty===!0)},askToDiscard:h=>new Promise(g=>{w?.settle(!1);const R={paths:h,settle:N=>{if(w===R){if(w=null,N)for(const I of h)L(I);c.emit(),g(N)}}};w=R,c.emit()}),discardRequest:()=>w,sideBySide:()=>(u??=r.read(),u),setSideBySide:h=>{u!==h&&(u=h,r.write(h),c.emit())},editorShare:()=>(p??=o.read()??z.EDIT_SPLIT_DEFAULT_PERCENT,p),setEditorShare:h=>{if(!Number.isFinite(h))throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(h)}`);const g=Math.min(z.EDIT_SPLIT_MAX_PERCENT,Math.max(z.EDIT_SPLIT_MIN_PERCENT,h));p!==g&&(p=g,o.write(g))},setView:(h,g)=>{const R=s.get(h);R===void 0||R.value.view===g||(m.get(h)?.beforeView(g),x(R,{view:g,previewPrepared:R.value.previewPrepared||g==="preview"}))},preparePreview:h=>{const g=s.get(h);g!==void 0&&!g.value.previewPrepared&&x(g,{previewPrepared:!0})}}},St=e=>{e.preventDefault(),e.stopPropagation()},qn=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,Bn="data-aqmx-content-pane",Be=Object.freeze({[Bn]:""}),Lo="--aqmx-dialog-left",Ao="--aqmx-dialog-top",Mo='[data-testid="markdown-explorer"]',No=e=>{const t=e.closest(Mo)?.querySelectorAll(`[${Bn}]`),n=t?.item(t.length-1);if(!(n instanceof HTMLElement))throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");return n},jo=e=>{const t=qn(getComputedStyle(e).marginTop);if(Number.isNaN(t))return null;const n=No(e),r=e.getBoundingClientRect(),o=e.ownerDocument.documentElement,{left:s,top:a}=z.centeredDialogPosition(n.getBoundingClientRect(),{width:r.width+2*t,height:r.height+2*t},{width:o.clientWidth,height:o.clientHeight});return e.style.setProperty(Lo,`${String(s)}px`),e.style.setProperty(Ao,`${String(a)}px`),n},Do=e=>e.preventDefault(),Un=({open:e,onOpen:t,onDismiss:n})=>{const r=d.useRef(null),o=d.useRef(null),s=d.useRef(!1),a=d.useRef(t);d.useLayoutEffect(()=>{a.current=t},[t]),d.useLayoutEffect(()=>{s.current=e;const c=r.current;if(c!==null)if(e&&!c.open){const u=c.ownerDocument.activeElement;o.current=u instanceof HTMLElement?u:null,c.showModal(),a.current?.()}else!e&&c.open&&(c.close(),o.current?.isConnected===!0&&o.current.focus(),o.current=null)},[e]),d.useLayoutEffect(()=>{const c=r.current;if(!e||c===null)return;const u=new ResizeObserver(()=>w());let p=null;const w=()=>{const b=jo(c);b===null||b===p||(p!==null&&u.unobserve(p),u.observe(b),p=b)};w(),u.observe(c);const x=c.ownerDocument.defaultView;return x?.addEventListener("resize",w),c.ownerDocument.addEventListener("scroll",w,{capture:!0,passive:!0}),()=>{u.disconnect(),x?.removeEventListener("resize",w),c.ownerDocument.removeEventListener("scroll",w,{capture:!0})}},[e]);const i=d.useCallback(c=>{c.key!=="Escape"||c.defaultPrevented||(St(c),n())},[n]),m=d.useCallback(c=>{c.target===c.currentTarget&&n()},[n]),f=d.useCallback(()=>{s.current&&n()},[n]);return{ref:r,onKeyDown:i,onClick:m,onCancel:Do,onClose:f}},Hn=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:i})=>{const m=d.useRef(null),f=d.useId(),c=d.useId(),u=d.useCallback(()=>m.current?.focus(),[]),p=Un({open:e,onOpen:u,onDismiss:a});return l.jsx("dialog",{...p,className:"aqmx-confirm","aria-labelledby":f,"aria-describedby":c,"data-testid":i,children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:f,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:c,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":`${i}-cancel`,onClick:a,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${i}-confirm`,onClick:s,children:r})]})]})})},Te=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},zn=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),ye=e=>e.status==="fulfilled"?e.value:void 0,Vn=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!1}),Po=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!0}),_o=(e,t,n)=>{const r=new Set,o=[...e].reverse();for(let s=o.pop();s!==void 0;s=o.pop()){if(s.type!=="directory"||r.has(s.path))continue;r.add(s.path);const a=s.lazy===!0?n(s.path):void 0,i=s.lazy===!0?a?.status==="loaded"?a.entries:null:s.children===void 0?[]:s.children;if(s.path===t)return i;if(i!==null)for(const m of[...i].reverse())o.push(m)}return null},Zn=(e,t,n)=>{const r=ye(e.read(t));if(r===void 0||r.status==="deferred")return Vn;if(r.status==="error")return{readme:{status:"failed",failure:r.failure,retry:()=>e.retry(t)},claim:!1};const o=_o(r.entries,n,a=>e.children(t,a));if(o!==null)return{readme:{status:"ok",readme:z.folderReadmeOf(o)},claim:!1};const s=e.children(t,n);return s===void 0||s.status==="loading"?Po:s.status==="failed"?{readme:{status:"failed",failure:s.failure,retry:()=>e.retryChildren(t,n)},claim:!0}:{readme:{status:"ok",readme:z.folderReadmeOf(s.entries)},claim:!0}},Io=(e,t,n)=>{const{readme:r}=Zn(e,t,n);return r.status==="ok"?r.readme:null},$o=(e,t,n)=>{const r=te.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(r===null)return new Set;const{location:o}=z.resolveExplorerLocation(e,r.params["*"],new URLSearchParams(t.search));switch(o.view){case"tree":{const s=o.folder===null?o.doc:n(o.source,o.folder);return new Set(s===null?[]:[s])}case"single":return new Set([o.doc]);case"multi":return new Set(o.docs)}},Wn=e=>{const{edits:t}=$(),n=d.useCallback(()=>t.session(e),[t,e]);return d.useSyncExternalStore(t.subscribe,n,Fo)},Gn=()=>!1,Fo=()=>{},qo=()=>{const{edits:e}=$();return d.useSyncExternalStore(e.subscribe,e.hasSessions,Gn)},Kn=()=>{const{edits:e}=$();return d.useSyncExternalStore(e.subscribe,e.sideBySide,Gn)},Bo=()=>null,Uo=()=>{const{edits:e,labels:t,config:n,trees:r}=$(),o=d.useRef([]),s=d.useCallback(({nextLocation:w})=>{const x=$o(n,w,(b,T)=>Io(r,b,T));return e.flushDrafts(),o.current=e.dirtyPaths().filter(b=>!x.has(b)),o.current.length>0},[e,n,r]),a=te.useBlocker(s),i=qo();d.useEffect(()=>{if(!i)return;const w=x=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(x.preventDefault(),x.returnValue=!0)};return window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[i,e]);const m=d.useSyncExternalStore(e.subscribe,e.discardRequest,Bo),f=a.state==="blocked",c=f?o.current:m===null?[]:m.paths,u=c.map(w=>_.lastPathSegment(w)).join(", "),p=c.length>0&&c.every(w=>e.session(w)?.save.kind==="draft");return l.jsx(Hn,{open:f||m!==null,title:p?t.draftDiscardTitle:t.unsavedTitle,body:p?t.draftDiscardBody(u):t.unsavedBody(u),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(a.state==="blocked"){e.discard(o.current),a.proceed();return}m?.settle(!0)},onCancel:()=>{if(a.state==="blocked"){a.reset();return}m?.settle(!1)}})};function Ho({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 zo=k.forwardRef(Ho);let et=null;const Xn=()=>(et??=Promise.resolve().then(()=>require("./EditSurface-B1yD7ywF.cjs")).catch(e=>{throw et=null,e}),et),Vo=()=>{Xn().catch(()=>{})},Zo=e=>{const{default:t}=d.use(Xn());return l.jsx(t,{...e})};class Wo extends d.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 Rt=`[${ft.SOURCE_LINES_ATTRIBUTE}]`,Go="[data-aqmd-content]",Ko='a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen], [data-aqmd-svg-image-source]',Xo=200,Oe=e=>ft.parseSourceLines(e.getAttribute(ft.SOURCE_LINES_ATTRIBUTE)),Yo=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=Oe(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(Rt)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=Oe(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},Qo=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Yn=e=>e.closest(Go)!==null&&e.closest(Ko)===null,Qn=(e,t,n)=>{const r=Yo(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const i=r.lines.last+1;return{lines:{first:i,last:i},word:null,occurrence:0,clientTop:Ue(e)}}const a=Jo(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:Ue(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},Jn=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(Rt)){const i=Oe(a);if(i===null)continue;n??=tr(t,a);const{top:m,bottom:f}=a.getBoundingClientRect();m<=n&&n<f?r={lines:i,block:a}:o===null&&m>=n&&(o={lines:i,block:a})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:Ue(s.block)}},er=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,tr=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return er(e)+(Number.isFinite(n)?n:0)},Jo=(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>Xo||/[\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:Qo(o.toString(),r),clientTop:n.getBoundingClientRect().top}},es=(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 a=0;for(let i=r;i<=o;i+=1){const m=n[i-1]??"";for(let f=m.indexOf(t.word);f>=0;f=m.indexOf(t.word,f+t.word.length)){if(a===t.occurrence)return{line:i,column:f};a+=1}}return a>0?ts(n,r,o,t.word)??s:s},ts=(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},nr=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(Rt)){const s=Oe(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},rr=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=Ue(e),o=Oe(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},Ue=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:a,height:i}=s.getBoundingClientRect();if(i>0)return a}return e.getBoundingClientRect().top},Tt=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})}),ns=e=>Tt[e],Le=()=>{const e=te.useNavigate();return d.useCallback((t,n)=>{e(t,Tt[n])},[e])},or=({navigation:e,...t})=>l.jsx(te.Link,{...t,...Tt[e]}),Ot=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},sr=(e,t)=>{const n=d.useRef(null),r=d.useRef(null),o=d.useRef(null),s=d.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);d.useEffect(()=>s,[s]);const a=d.useCallback(f=>{if(r.current!==f)return;const c=o.current;if(c!==null){c.then(()=>a(f));return}e.prefetch(f);const u=e.peek(f);if(u?.status!=="pending")return;const p=Promise.allSettled([u.promise]);o.current=p,p.then(()=>{o.current===p&&(o.current=null)})},[e]),i=d.useCallback(f=>{const c=t(f);c!==r.current&&(s(),c!==null&&(r.current=c,n.current=window.setTimeout(()=>{n.current=null,a(c)},z.PREFETCH_DWELL_MS)))},[s,t,a]),m=d.useCallback(f=>{t(f)!==r.current&&s()},[s,t]);return d.useMemo(()=>({onPointerOver:f=>i(f.target),onPointerOut:f=>m(f.relatedTarget),onFocus:f=>i(f.target),onBlur:f=>m(f.relatedTarget)}),[i,m])},rs=d.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-D9QrjRJa.cjs")).then(e=>({default:e.NativeScrollBar})));class os extends d.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 ar=({scroller:e,withCircle:t})=>l.jsx(os,{children:l.jsx(d.Suspense,{fallback:null,children:l.jsx(rs,{scroller:e,withCircle:t})})}),lr=e=>l.jsx(ar,{scroller:e,withCircle:!0}),ir=()=>{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 a=e.get(o);if(a!==void 0&&a>1){e.set(o,a-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},He=(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,a)=>He(s,t[a]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(s=>Object.hasOwn(r,s)&&He(n[s],r[s]))},ss=55e3,Wt=Object.freeze({status:"deferred"}),tt=Object.freeze({status:"refreshed"}),nt=Object.freeze({status:"shown",failed:!1}),De=Object.freeze({status:"shown",failed:!0}),Pe=Object.freeze({status:"superseded"}),le=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,as=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",ls=({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=ir(),o=Ee(),s=new WeakSet,a=new Map,i=new Map,m=new Map;let f=0;const c=o.emit,u=()=>(f+=1,f),p=()=>{if(!(n.size<=t))for(const E of[...n.keys()]){if(n.size<=t)return;r.isHeld(E)||n.delete(E)}},w=(E,S)=>{n.delete(E),n.set(E,S)},x=E=>performance.now()-E.validatedAt>=ss,b=(E,S,A)=>{const M=n.get(E),P=le(M?.snapshot),B=A||M?.refreshPending===!0,G=Te(e.document(E,{refresh:B}).then(y=>({status:"loaded",document:y}))),v={snapshot:{status:"pending",promise:G,previous:P},validatedAt:performance.now(),opened:S,background:null,refreshPending:!1,seeded:void 0,stamp:u()};return w(E,v),p(),G.then(y=>{n.get(E)===v&&(v.snapshot=y,v.stamp=u(),c())}),v},T=(E,S,A,M,P,B)=>{S.background===A&&(S.background=null,!(n.get(E)!==S||S.snapshot!==M)&&(P.kind==="failure"&&M.document.kind!=="failure"||(S.validatedAt=B,S.stamp=u(),He(M.document,P)||(S.snapshot={status:"loaded",document:P}),c())))},L=async(E,S)=>{const A=S.snapshot;if(A.status!=="loaded")return null;const M={};S.background=M;const P=performance.now(),B=e.document(E,{refresh:S.refreshPending});S.refreshPending=!1;const G=await B,v=S.background===M&&n.get(E)===S&&S.snapshot===A;return T(E,S,M,A,G,P),v?G:null},O=(E,S)=>{const{snapshot:A}=S;return A.status==="pending"?!1:A.status==="loaded"&&A.document.kind!=="failure"?(L(E,S),!1):(A.status==="loaded"&&s.add(A),b(E,!0,!1),!0)},q=E=>{i.delete(E);const S=m.get(E);if(S!==void 0){m.delete(E);for(const A of S)A()}},D=(E,S)=>new Promise(A=>{if(i.get(E)===S||!r.isHeld(E)){A();return}const M=m.get(E);M===void 0?m.set(E,new Set([A])):M.add(A)}),h=(E,S)=>{const A=a.get(E);if(A===void 0){S.resolve(null);return}if(A.last!==null&&A.last.stamp>=S.stamp){S.resolve(A.last);return}A.waiters.add(S)},g=async(E,S,A)=>{const M=await new Promise(P=>h(E,{stamp:S.stamp,resolve:P}));if(n.get(E)!==S)return Pe;if(M===null)return A?tt:nt;if(!A)return M.failure===null?nt:De;switch(M.before){case"copy":return M.failure===null?tt:{status:"failed",failure:M.failure};case"failure":return M.failure===null?nt:De;case"none":return M.failure===null?tt:De}},R=E=>{const S={showing:"none",last:null,waiters:new Set};a.set(E,S);let A=!1;return{settle:(M,P)=>{if(A||M===void 0)return;const B={stamp:M,failure:P,before:S.showing};S.last=B,P===null?S.showing="copy":S.showing==="none"&&(S.showing="failure");for(const G of[...S.waiters])M<G.stamp||(S.waiters.delete(G),G.resolve(B))},release:()=>{if(A)return;A=!0,a.get(E)===S&&a.delete(E);const M=[...S.waiters];S.waiters.clear(),M.length>0&&queueMicrotask(()=>{for(const P of M)h(E,P)})}}},N=E=>{const S=r.hold(E);let A=!1;return()=>{if(A)return;A=!0,S();const M=n.get(E);M!==void 0&&w(E,M),p(),r.isHeld(E)||queueMicrotask(()=>{r.isHeld(E)||q(E)})}};return{peek:E=>n.get(E)?.snapshot,peekSeeded:E=>n.get(E)?.seeded,answerStampOf:E=>n.get(E)?.stamp,prefetch:E=>{const S=n.get(E);S!==void 0&&S.snapshot.status!=="deferred"||(b(E,!1,!1),c())},open:E=>{const S=r.resumes(E),A=N(E),M=n.get(E);if(M===void 0||M.snapshot.status==="deferred")return b(E,!0,!1),c(),A;if(w(E,M),S)return A;const{snapshot:P}=M;return P.status==="pending"?(M.opened=!0,A):P.document.kind==="failure"?(M.opened||x(M)?(s.add(P),b(E,!0,!1),c()):M.opened=!0,A):(M.opened=!0,M.background===null&&x(M)&&L(E,M),A)},retain:N,retry:E=>{const S=n.get(E);S===void 0||S.snapshot.status!=="loaded"||S.snapshot.document.kind!=="failure"||(b(E,!0,!1),c())},seed:(E,S)=>{const A=performance.now(),M=Te(S.then(y=>y===null?Wt:{status:"loaded",document:y},()=>Wt)),P=n.get(E);if(P!==void 0&&P.snapshot.status==="loaded"){const y=P.snapshot,C={};P.background=C,M.then(j=>{if(j.status==="loaded"){T(E,P,C,y,j.document,A);return}P.background===C&&(P.background=null)});return}const B=P!==void 0&&P.snapshot.status==="pending"?P.snapshot.previous:null,G={status:"pending",promise:M,previous:B},v={snapshot:G,validatedAt:A,opened:P?.opened===!0,background:null,refreshPending:P?.refreshPending===!0,seeded:G,stamp:u()};w(E,v),p(),M.then(y=>{n.get(E)===v&&(y.status==="deferred"&&r.isHeld(E)?b(E,v.opened,!1):(v.snapshot=y,v.stamp=u()),c())})},invalidate:()=>{let E=!1;for(const[S,A]of[...n]){if(A.validatedAt=Number.NEGATIVE_INFINITY,A.opened=!0,A.refreshPending=!0,!r.isHeld(S))continue;const{snapshot:M}=A;if(M.status!=="pending"){O(S,A)&&(E=!0);continue}M.promise.then(()=>{n.get(S)===A&&A.refreshPending&&r.isHeld(S)&&O(S,A)&&c()})}E&&c()},refresh:async E=>{const S=n.get(E);if(S!==void 0&&as(S.snapshot)){S.refreshPending=!0;const P=await L(E,S);return P===null?Pe:P.kind==="failure"?{status:"failed",failure:P.failure}:g(E,S,!0)}const A=b(E,!0,!0);if(c(),A.snapshot.status!=="pending")return Pe;const M=await A.snapshot.promise;return n.get(E)!==A||M.status!=="loaded"?Pe:M.document.kind==="failure"?De:(await D(E,M),g(E,A,!1))},clear:()=>{n.clear();for(const E of r.heldKeys())b(E,!0,!1);c()},subscribe:o.subscribe,readPart:R,noteShown:(E,S)=>{i.set(E,S);const A=m.get(E);if(A!==void 0){m.delete(E);for(const M of A)M()}},noteFailureShown:E=>s.has(E)?!1:(s.add(E),!0)}},de=d.createContext("fill"),is=Object.freeze({blockSize:"100%"}),Ae=({scrollerProps:e,children:t})=>d.use(de)==="content"?l.jsx(xe.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(xe.HostedScrollArea,{scrollerProps:{...e,style:is},rowClassName:"aqmx-document-scroll-row",renderScrollBar:lr,children:t}),cs=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),ds=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),ue=({label:e,testId:t})=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":t,children:cs.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:e})]}),Ct=({failure:e,onRetry:t,testId:n})=>l.jsx(Ae,{scrollerProps:ds,children:l.jsx(ce,{failure:e,alert:!1,onRetry:t,testId:n})});function us({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 fs=k.forwardRef(us);function ms({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 hs=k.forwardRef(ms);function ps({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 gs=k.forwardRef(ps),ws=2e3,Gt=Object.freeze({outcome:"idle"}),vs=e=>{const t=navigator.clipboard;return t===void 0?Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")):t.writeText(e)},xs=({text:e})=>{const{announcer:t,labels:n}=$(),[r,o]=d.useState(Gt);d.useEffect(()=>{if(r.outcome==="idle")return;const m=setTimeout(()=>o(Gt),ws);return()=>clearTimeout(m)},[r]);const s=m=>{o({outcome:m}),t.announce(m==="copied"?n.copiedText:n.copyTextFailed)},a=()=>{vs(e).then(()=>s("copied"),()=>s("failed"))},i=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:i,onClick:a,"data-aqmx-copy-outcome":r.outcome,"data-testid":"markdown-explorer-file-copy",children:r.outcome==="copied"?l.jsx(fs,{}):r.outcome==="failed"?l.jsx(gs,{}):l.jsx(hs,{})})},cr=d.createContext(null),Es=()=>{const e=d.use(cr);if(e===null)throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");return e};function bs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 ys=k.forwardRef(bs);function ks({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 Ss=k.forwardRef(ks),Me=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=$();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(Ss,{})}),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(ys,{})})]})};function Rs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Ts=k.forwardRef(Rs),Os=Object.freeze({className:"aqmx-document-stage"}),Cs=({document:e})=>{const{labels:t}=$();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(Me,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Ts,{})}),l.jsx(Ae,{scrollerProps:Os,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})]})})]})},We="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",Ls=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},As=/(%[0-9A-Fa-f]{2})/u,Lt=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(As).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))},dr=e=>`#${encodeURIComponent(e)}`,Ms=e=>{if(e==="#")return!0;const t=Lt(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},ur=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Ns="http://www.w3.org/1999/xhtml",Kt=(e,t)=>{if(t==="")return null;const n=ur(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Ns&&r.getAttribute("name")===t)return r;return null},fr=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=Kt(e,t.slice(1));if(n!==null)return n;const r=Lt(t);return r===null?null:Kt(e,r)},Xt=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"},js=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"},Ds=(e,t)=>{const n=t.closest(We),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&Xt(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:a}=e.ownerDocument;for(let i=e.parentElement;i!==null&&i!==s;i=i.parentElement)if(Xt(i)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o)return i;return a instanceof Element&&js(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},Ps=Object.freeze({scrollerOf:Ds,reveal:e=>{e.scrollIntoView(wt)}}),wt=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),_s=(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")}}},Is=(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),a=t.getBoundingClientRect(),i=a.height+s+Number.parseFloat(o)>e.clientHeight;if(!i&&Math.abs(a.top-s-n)<1){t.scrollIntoView(wt);return}e.scrollBy({top:i?a.top-n-e.clientHeight:a.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(wt)},$s=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(We)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},Yt=(e,t,n)=>{if(e===null)return null;const r=fr(e,t);return r===null?(Ms(t)&&$s(e,n),null):(_s(e,r),Is(n.scrollerOf(e,r),r),n.reveal(r),r)};function Fs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 qs=k.forwardRef(Fs);function Bs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 Us=k.forwardRef(Bs);function Hs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 zs=k.forwardRef(Hs);function Vs({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Zs=k.forwardRef(Vs),vt="data-aqmx-key-repeat",ze=Object.freeze({[vt]:"allow"}),Ws=`[${vt}="${ze[vt]}"]`,Gs=()=>{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(Ws)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},Fe=Object.freeze([1/z.GOLDEN_RATIO**2,1/z.GOLDEN_RATIO,1,z.GOLDEN_RATIO,z.GOLDEN_RATIO**2]),Qt=Object.freeze({mode:"fit"}),Ks=1,mr=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),Jt=`[data-testid="${mr["data-testid"]}"]`,hr=d.createContext(null),Xs=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=Ks?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,en=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<Fe.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?Fe.findIndex(o=>o>t):Fe.findLastIndex(o=>o<t);return r===-1?null:r},tn=(e,t,n)=>{if(e.mode==="level"){const o=en(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=en(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},Ys=(e,t)=>{if(e<=0||t<=0)return 0;const n=Math.trunc(Math.log(t/e)/Math.log(z.GOLDEN_RATIO));return n===0?0:n},nn=e=>{const t=e[0],n=e[1];return e.length!==2||t===void 0||n===void 0?null:{distance:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),middle:{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}},Qs=e=>{const t=Fe[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},rn=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},Js=({document:e})=>{const{labels:t}=$(),n=d.use(hr),[r]=d.useState(()=>n===null?null:n.read(e.url)),[o,s]=d.useState(r===null?Qt:r.zoom),[a,i]=d.useState(r===null?null:r.reported),[m,f]=d.useState(null),c=d.useRef(null),u=d.useCallback(D=>{const{naturalWidth:h,naturalHeight:g}=D;i(R=>rn(R,h,g))},[]),p=d.useCallback(D=>{c.current=D,!(D===null||!D.complete)&&(D.naturalWidth>0||D.naturalHeight>0?u(D):D.decode().then(()=>u(D),()=>{}))},[u]);d.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),d.useLayoutEffect(()=>{const D=c.current;if(D===null||a===null||o.mode!=="fit")return;const h=()=>f(R=>rn(R,D.clientWidth,D.clientHeight));if(h(),typeof ResizeObserver>"u")return;const g=new ResizeObserver(h);return g.observe(D),()=>g.disconnect()},[a,o.mode]);const w=a===null||m===null?null:Xs(a,m),x=tn(o,w,-1),b=tn(o,w,1),T=o.mode==="level"?Qs(o.index):null,L=d.useRef({zoomIn:b,zoomOut:x});d.useLayoutEffect(()=>{L.current={zoomIn:b,zoomOut:x}});const O=d.useRef(null);d.useLayoutEffect(()=>{const D=O.current,h=c.current?.closest(Jt);O.current=null,!(D===null||h===null||h===void 0)&&(h.scrollLeft=D.across*h.scrollWidth-D.x,h.scrollTop=D.down*h.scrollHeight-D.y)},[o]),d.useEffect(()=>{const D=c.current?.closest(Jt);if(D==null)return;let h=null;const g=I=>{const F=nn(I.touches);h=F===null?null:{distance:F.distance,steps:0}},R=I=>{const F=nn(I.touches);if(h===null||F===null)return;I.preventDefault();const E=Ys(h.distance,F.distance);if(E===h.steps)return;const S=E>h.steps?1:-1,A=S===1?L.current.zoomIn:L.current.zoomOut;if(A===null)return;h.steps+=S;const M=D.getBoundingClientRect(),P=F.middle.x-M.left,B=F.middle.y-M.top;O.current=D.scrollWidth>0&&D.scrollHeight>0?{x:P,y:B,across:(D.scrollLeft+P)/D.scrollWidth,down:(D.scrollTop+B)/D.scrollHeight}:null,s(A)},N=I=>{I.touches.length<2&&(h=null)};return D.addEventListener("touchstart",g,{passive:!0}),D.addEventListener("touchmove",R,{passive:!1}),D.addEventListener("touchend",N,{passive:!0}),D.addEventListener("touchcancel",N,{passive:!0}),()=>{D.removeEventListener("touchstart",g),D.removeEventListener("touchmove",R),D.removeEventListener("touchend",N),D.removeEventListener("touchcancel",N)}},[]);const q=o.mode==="level"&&T!==null?{width:`${o.base.width*T}px`,height:`${o.base.height*T}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(Me,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(Zs,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":x===null,onClick:()=>{x!==null&&s(x)},...ze,children:l.jsx(Us,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:T===null?t.imageFitLevel:t.imageZoomLevel(Math.round(T*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":b===null,onClick:()=>{b!==null&&s(b)},...ze,children:l.jsx(zs,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(Qt),children:l.jsx(qs,{})})]}),l.jsx(Ae,{scrollerProps:mr,children:l.jsx("img",{ref:p,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:q,onLoad:D=>u(D.currentTarget),"data-testid":"markdown-explorer-image"})})]})},ea=async(e,t,n)=>{const r=await e.text(t,n);if(!("kind"in r))throw n.reason;return r.kind==="text"?{kind:"text",text:r.text,truncated:r.truncated}:{kind:"failure",retryable:r.failure.reason==="failed"}},pr=d.createContext(null),Ge=d.createContext(void 0),gr=d.createContext(null),Ke=()=>{const e=d.use(pr);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},ta=()=>{const e=d.use(gr);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},Xe=(e,t,n,r)=>t.kind==="panel"?z.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?z.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):z.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),na=({children:e})=>{const{config:t}=$(),n=Ke(),r=Ze(),o=r.kind==="location"?r.location.source:void 0,s=te.useHref(Xe(t,n.navigation,o,n.currentPath));return l.jsx(Ge,{value:o,children:l.jsx(gr,{value:s,children:e})})},ra='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',oa=e=>{const t=e instanceof Element?e.closest(ra):null;return t===null?null:t.getAttribute("data-doc-path")},Ye=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,sa=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:i,children:m})=>{const f=te.useHref(e),c=u=>{if(Ye(u)){if(u.preventDefault(),t===i.currentPath&&n!==""){i.scrollWithin(n);return}a(t,n)}};return l.jsx("a",{...s,href:f,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:c,children:m})},aa=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=$(),i=Ke(),m=d.use(Ge),f=Ls(e),{navigation:c}=i,u=`${Xe(a,c,m,t)}${f}`,p=n===!1?"false":void 0;return c.kind==="page"?l.jsx(or,{...o,to:u,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":p,children:s}):l.jsx(sa,{to:u,docPath:t,fragment:f,exists:p,className:r,attributes:o,onDocumentLink:c.onDocumentLink,scope:i,children:s})},la=({className:e,attributes:t,children:n})=>{const{labels:r}=$();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,")"]})]})},ia=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=$(),a=d.use(Ge),i=te.useHref(`${Xe(s,r.navigation,a,r.currentPath)}${e}`),m=f=>{Ye(f)&&(f.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:i,className:t,onClick:m,children:o})},ca=({href:e,className:t,attributes:n,children:r})=>{const o=Ke();if(o.navigation.kind==="page"){const s=a=>{if(!Ye(a))return;const i=a.currentTarget;e==="#"?o.followEmptyFragment(a.nativeEvent):i.href===i.ownerDocument.URL&&o.followSameUrlJump(e,a.nativeEvent)};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(ia,{href:e,className:t,attributes:n,scope:o,children:r})},da=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!_.isAcceptableDocumentPath(n)?l.jsx(la,{className:o,attributes:s,children:a}):l.jsx(aa,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?l.jsx(ca,{href:e,className:o,attributes:s,children:a}):l.jsx("a",{...s,href:e,className:o,children:a}),ua=()=>{const{config:e}=$(),t=Ke(),n=d.use(Ge),r=Le();return d.useCallback((o,s)=>{if(!Ye(s))return!0;s.preventDefault();const a=dr(o.id),{navigation:i}=t;return i.kind==="panel"||Lt(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${Xe(e,i,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},fa=()=>{const e=ta();return d.useCallback(t=>`${e}${dr(t.id)}`,[e])};function ma({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 ha=k.forwardRef(ma);function pa({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 ga=k.forwardRef(pa);function wa({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 va=k.forwardRef(wa),xa=Object.freeze({className:"aqmx-document-stage"}),Ea=()=>()=>{},ba=()=>navigator.pdfViewerEnabled!==!1,ya=()=>null,ka=({document:e})=>{const{labels:t}=$(),n=d.useSyncExternalStore(Ea,ba,ya);return n===null?null:n?l.jsx("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"}):l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-pdf-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.pdfNotShown}),l.jsxs("div",{className:"aqmx-callout-actions",children:[l.jsx("a",{className:"aqmx-callout-action",href:e.url,target:"_blank",rel:"noopener noreferrer","data-testid":"markdown-explorer-pdf-not-shown-open",children:t.openInNewTab}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-pdf-not-shown-download",children:t.download})]})]})},Sa=e=>{switch(e){case"video":return l.jsx(ga,{});case"audio":return l.jsx(va,{});case"pdf":return l.jsx(ha,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},Ra=({document:e})=>{const{labels:t}=$();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(ka,{document:e});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},Ta=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(Me,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:Sa(e.mediaType)}),l.jsx(Ae,{scrollerProps:xa,children:l.jsx(Ra,{document:e})})]}),At=e=>{switch(e.kind){case"markdown":return"markdown";case"image":return e.imageType==="svg"?"svg":null;case"spreadsheet":return e.format==="workbook"?null:e.format;default:return null}},Oa=e=>{const{documents:t}=$(),n=d.useCallback(()=>t.peek(e),[t,e]),r=d.useCallback(()=>t.peekSeeded(e),[t,e]),o=d.useSyncExternalStore(t.subscribe,n,r),s=le(o);return s===null?null:At(s.document)},wr=e=>{const{config:t}=$(),n=Le(),r=d.useCallback(()=>n(z.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return d.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])};function Ca({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.createElement("path",{fillRule:"evenodd",d:"M.99 5.24A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25l.01 9.5A2.25 2.25 0 0 1 16.76 17H3.26A2.267 2.267 0 0 1 1 14.74l-.01-9.5Zm8.26 9.52v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.615c0 .414.336.75.75.75h5.373a.75.75 0 0 0 .627-.74Zm1.5 0a.75.75 0 0 0 .627.74h5.373a.75.75 0 0 0 .75-.75v-.615a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625Zm6.75-3.63v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75v.625c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75ZM17.5 7.5v-.625a.75.75 0 0 0-.75-.75H11.5a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75h5.25a.75.75 0 0 0 .75-.75Zm-8.25 0v-.625a.75.75 0 0 0-.75-.75H3.25a.75.75 0 0 0-.75.75V7.5c0 .414.336.75.75.75H8.5a.75.75 0 0 0 .75-.75Z",clipRule:"evenodd"}))}const La=k.forwardRef(Ca),Aa=100,Ma=32767,qe=Object.freeze({maxCells:Ut.SPREADSHEET_MAX_OPERATION_CELLS,maxColumns:Ut.SPREADSHEET_MAX_OPERATION_CELLS/Aa,maxCellLength:Ma}),vr=44,xr=10,Er=13,_e='"',on=(e,t)=>{let n=t;for(;n<e.length;){const r=e.charCodeAt(n);if(r===vr||r===xr||r===Er)return n;n+=1}return n};function*Na(e,t){let n=[],r=0;for(;;){let o;if(e.startsWith(_e,r)){o="";let a=r+1;for(;;){const m=e.indexOf(_e,a);if(m<0){o+=e.slice(a),r=e.length;break}if(o+=e.slice(a,m),e.startsWith(_e,m+1)){o+=_e,a=m+2;continue}r=m+1;break}const i=on(e,r);o+=e.slice(r,i),r=i}else{const a=on(e,r);o=e.slice(r,a),r=a}if(n.push(o),r>=e.length){t==="whole"&&(yield n);return}const s=e.charCodeAt(r);if(r+=1,s!==vr&&(yield n,n=[],s===Er&&e.charCodeAt(r)===xr&&(r+=1),r>=e.length))return}}const ja=(e,t,n)=>t==="csv"?Na(e,n):n==="whole"?mt.iterateTsvRows(e):mt.iterateTsvPrefixRows(e),Da=(e,t)=>{if(e.length<=t)return e;const n=e.charCodeAt(t-1);return e.slice(0,n>=55296&&n<=56319?t-1:t)},br=(e,t)=>{const n=[];let r=0,o=!1,s=!1;for(const i of e){const m=i.length>t.maxColumns?i.slice(0,t.maxColumns):i,f=Math.max(r,m.length);if((n.length+1)*f>t.maxCells){s=!0;break}const c=m.some(u=>u.length>t.maxCellLength)?m.map(u=>Da(u,t.maxCellLength)):m;c!==i&&(o=!0),n.push(c),r=f}return{rows:n.map(i=>i.length===r?i:[...i,...Array(r-i.length).fill("")]),truncated:s||o,full:s}},rt=(e,t,n,r,o)=>{const s=z.decodeText(e,t,r);if(s===null)return{kind:"unreadable",code:"encoding",encodings:z.textEncodingsOf(e,t,r)};if(s.includes("\0"))return{kind:"unreadable",code:"binary"};const a=br(ja(s,n,t?"whole":"prefix"),o);return t?a.truncated||a.rows.some(i=>i.some(m=>m!==""))?{kind:"table",table:a}:{kind:"empty"}:a.rows.length===0?{kind:"unreadable",code:"long-row"}:{kind:"table",table:{...a,truncated:!0}}},Pa=Object.freeze({maxPartBytes:64*1024*1024,maxSheets:256}),yr=e=>{const t=[];let n=0,r=!1;const o=s=>{if(r)return;const a=Math.max(n,Math.min(s.length,e.maxColumns));(t.length+1)*a>e.maxCells&&(r=!0),t.push(s),n=a};return{addRow:(s,a,i)=>{if(a.size===0||r)return;let m=-1;for(const u of a.keys())u>m&&(m=u);const f=Array(Math.min(m,e.maxColumns)+1).fill("");for(const[u,p]of a)u<=e.maxColumns&&(f[u]=p);const c=Math.min(f.length,e.maxColumns);if(n===0&&(s+1)*c>e.maxCells){const u=Math.floor(e.maxCells/c);for(;t.length<u;)t.push([]);o(f);return}for(;t.length<s&&!r;)o([]);for(let u=0;u<i&&!r;u+=1)o(u===0?f:[...f])},full:()=>r,table:()=>br(t,e)}},_a=e=>{const t=Array.from(e.currentTarget.querySelectorAll('[role="tab"]')),n=e.target instanceof HTMLButtonElement?t.indexOf(e.target):-1;if(n===-1)return;const r=getComputedStyle(e.currentTarget).direction==="rtl"?"ArrowRight":"ArrowLeft",o=r==="ArrowLeft"?"ArrowRight":"ArrowLeft",s=e.key===o?(n+1)%t.length:e.key===r?(n-1+t.length)%t.length:e.key==="Home"?0:e.key==="End"?t.length-1:null;s!==null&&(e.preventDefault(),t[s]?.focus())},Ia=({names:e,selected:t,onSelect:n,label:r,tabIdOf:o,panelId:s})=>l.jsx("div",{role:"tablist","aria-label":r,className:"aqmx-sheet-tabs","data-testid":"markdown-explorer-spreadsheet-sheets",onKeyDown:_a,children:e.map((a,i)=>l.jsx("button",{type:"button",role:"tab",id:o(i),"aria-selected":i===t,"aria-controls":s,tabIndex:i===t?0:-1,className:"aqmx-sheet-tab","data-aqmx-sheet-tab":i,onClick:()=>n(i),children:a},i))}),kr=64*1024,$a=e=>{let t=new Uint8Array(Math.min(e,kr)),n=0;return{append:r=>{if(n+r.byteLength>t.byteLength){const o=new Uint8Array(Math.min(e,Math.max(t.byteLength*2,n+r.byteLength)));o.set(t.subarray(0,n)),t=o}t.set(r,n),n+=r.byteLength},bytes:()=>t.subarray(0,n),length:()=>n}},Fa=async e=>{for(;;){const{done:t,value:n}=await e.read();if(t)return!0;if(n.byteLength>0)return!1}},qa=async(e,t)=>{const{format:n,legacyEncoding:r,maxBytes:o,budget:s}=t,a=e.getReader(),i=$a(o);let m=kr;try{for(;;){const{done:f,value:c}=await a.read();if(f)return rt(i.bytes(),!0,n,r,s);const u=o-i.length();if(i.append(c.byteLength>u?c.subarray(0,u):c),i.length()===o){const w=c.byteLength<=u&&await Fa(a);return rt(i.bytes(),w,n,r,s)}if(i.length()<m)continue;m=i.length()*2;const p=rt(i.bytes(),!1,n,r,s);if(p.kind==="unreadable"&&p.code!=="long-row"||p.kind==="table"&&p.table.full)return p}}finally{a.cancel().catch(()=>{})}},Sr=async(e,t,n,r)=>{const o=await e.asset(_.explorerPlainTextHref(t),r);if(o.status==="cancelled")return null;if(o.status==="error")return{kind:"failure",failure:o.failure};let s;try{s=await qa(o.body,n)}catch{return r.aborted?null:{kind:"failure",failure:{reason:"failed"}}}return r.aborted?null:s.kind==="table"?{kind:"table",rows:s.table.rows,truncated:s.table.truncated}:s},Mt=(e,t,n)=>{const{documents:r,labels:o}=$(),s=Es(),a=d.useCallback(()=>r.answerStampOf(e),[r,e]),i=d.useSyncExternalStore(r.subscribe,a,a),[m,f]=d.useState(0),c=d.useMemo(()=>({read:n,stamp:i,attempt:m}),[n,i,m]),[u,p]=d.useState({settled:null,shown:null,failure:null}),w=d.useRef(null),x=d.useEffectEvent((L,O)=>{if(w.current?.settle(O.stamp,L.kind==="failure"?L.failure:null),L.kind==="read"){p({settled:O,shown:L.value,failure:null});return}if(u.shown!==null){p({settled:O,shown:u.shown,failure:null});return}p({settled:O,shown:null,failure:L.failure}),s.announceFailure(o.documentFailed(t,re(o,L.failure.reason)))});d.useEffect(()=>{const L=s.readPart();return w.current=L,()=>{w.current=null,L.release()}},[s]),d.useEffect(()=>{const L=new AbortController;return c.read(L.signal).then(O=>{O!==null&&!L.signal.aborted&&x(O,c)}),()=>L.abort()},[c]);const b=u.settled!==c&&(u.shown!==null||u.failure!==null);d.useLayoutEffect(()=>b?s.holdBusy():void 0,[b,s]);const T=d.useCallback(()=>f(L=>L+1),[]);return{shown:u.shown,failure:u.failure,retry:T}},Rr=(e,t)=>{const n={};for(const r of Object.keys(ve.SPREADSHEET_BLOCK_LABEL_CATALOGS[t])){const o=e[yt(r)];o!==ve.SPREADSHEET_BLOCK_LABEL_CATALOGS[t][r].text&&(n[r]=o)}return n},Ba=(e,t)=>Object.fromEntries(Object.entries(Rr(e,t)).map(([n,r])=>[`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`,r])),Ua=(e,t)=>({...Ba(e,t),loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,defaultErrorTitle:e.viewerErrorTitle,missingImage:e.viewerMissingImage,openTocAria:e.viewerOpenToc,tocTitle:e.viewerTocTitle,pinTocAria:e.viewerPinToc,unpinTocAria:e.viewerUnpinToc,selectAlignAria:e.viewerSelectAlign,alignTitle:e.viewerAlignTitle,pinAlignAria:e.viewerPinAlign,unpinAlignAria:e.viewerUnpinAlign,alignLeft:e.viewerAlignLeft,alignCenter:e.viewerAlignCenter,alignRight:e.viewerAlignRight,mermaidInteractionMode:e.viewerMermaidInteractionMode,mermaidInteractionModeTouch:e.viewerMermaidInteractionModeTouch,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidModeNoneTouch:e.viewerMermaidModeNoneTouch,mermaidModeZoomTouch:e.viewerMermaidModeZoomTouch,mermaidModePanTouch:e.viewerMermaidModePanTouch,mermaidModeBothTouch:e.viewerMermaidModeBothTouch,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidPanUp:e.viewerMermaidPanUp,mermaidPanDown:e.viewerMermaidPanDown,mermaidPanLeft:e.viewerMermaidPanLeft,mermaidPanRight:e.viewerMermaidPanRight,mermaidDiagram:e.viewerMermaidDiagram,mermaidRetry:e.viewerMermaidRetry,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame,blockFailed:e.viewerBlockFailed,svgImageToolbar:e.viewerSvgImageToolbar,svgImageSource:e.viewerSvgImageSource,svgImageSourceRegion:e.viewerSvgImageSourceRegion,svgImageLoading:e.viewerSvgImageLoading,svgImageFailed:e.viewerSvgImageFailed,svgImageRetry:e.viewerSvgImageRetry,svgImageTruncated:e.viewerSvgImageTruncated,svgImageCopy:e.viewerSvgImageCopy,svgImageCopied:e.viewerSvgImageCopied,svgImageCopyFailed:e.viewerSvgImageCopyFailed,svgImageCopyImage:e.viewerSvgImageCopyImage,svgImageCopiedImage:e.viewerSvgImageCopiedImage,svgImageCopyImageFailed:e.viewerSvgImageCopyImageFailed}),Tr=(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},Or=(e,t)=>e!==void 0?e:t!==void 0?t:mo.DEFAULT_CONTENT_ALIGN;class Y extends Error{refusal;constructor(t,n){super(n),this.name="WorkbookError",this.refusal=t}}const Ha=new Map([["lt","<"],["gt",">"],["amp","&"],["quot",'"'],["apos","'"]]),za=/&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu,Va=/([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu,Za=/^[^\s/>]+/u,ge=e=>{throw new Y("not-workbook",`the XML ${e}`)},sn=e=>Number.isInteger(e)&&e>=0&&e<=1114111?String.fromCodePoint(e):ge(`refers to the code point ${e}`),Cr=e=>e.includes("&")?e.replace(za,(t,n)=>n.startsWith("#x")?sn(Number.parseInt(n.slice(2),16)):n.startsWith("#")?sn(Number.parseInt(n.slice(1),10)):Ha.get(n)??ge(`names the undeclared entity ${t}`)):e,xt=e=>e.slice(e.indexOf(":")+1),Wa=(e,t)=>{let n="";for(let r=t;r<e.length;r+=1){const o=e[r];if(n!=="")o===n&&(n="");else if(o==='"'||o==="'")n=o;else if(o===">")return r}return-1},Ga=e=>{const t=new Map;for(const n of e.matchAll(Va))t.set(xt(n[1]??""),Cr(n[2]??n[3]??""));return t},Lr=(e,t)=>{let n="";const r=()=>{let o=0;for(;!t();){const s=n.indexOf("<",o);if(s===-1)break;if(s>o&&(e.text?.(Cr(n.slice(o,s))),o=s),n.startsWith("<!--",s)){const f=n.indexOf("-->",s+4);if(f===-1)break;o=f+3;continue}if(n.startsWith("<![CDATA[",s)){const f=n.indexOf("]]>",s+9);if(f===-1)break;e.text?.(n.slice(s+9,f)),o=f+3;continue}const a=n.slice(s);if(a.length<9&&("<!--".startsWith(a)||"<![CDATA[".startsWith(a)))break;if(n.startsWith("<!",s)&&ge("declares a document type or another declaration"),n.startsWith("<?",s)){const f=n.indexOf("?>",s+2);if(f===-1)break;o=f+2;continue}const i=Wa(n,s+1);if(i===-1)break;const m=n.slice(s+1,i);if(m.startsWith("/"))e.end?.(xt(m.slice(1).trim()));else{const f=m.endsWith("/"),c=f?m.slice(0,-1):m,u=Za.exec(c)?.[0]??ge("has a tag without a name"),p=xt(u);e.start?.(p,Ga(c.slice(u.length)),f),f&&e.end?.(p)}o=i+1}n=n.slice(o)};return{write:o=>{n+=o,r()},finish:()=>{r(),!t()&&n.includes("<")&&ge("ends inside a tag, a comment or a section")}}},Ne=async(e,t,n)=>{const r=Lr(t,n),o=new TextDecoder("utf-8",{fatal:!0}),s=e.getReader();try{for(;!n();){const{done:a,value:i}=await s.read();if(a){r.write(o.decode()),r.finish();return}r.write(o.decode(i,{stream:!0}))}}catch(a){if(a instanceof Y)throw a;ge("could not be read as UTF-8 text")}finally{s.cancel().catch(()=>{})}},Ka=101010256,Xa=33639248,Ya=67324752,Ar=22,Qa=65535,an=46,ln=30,Ja=1,cn=0,el=8,tl=65535,be=4294967295,nl=new TextDecoder("utf-8"),ee=e=>{throw new Y("not-workbook",`the ZIP package ${e}`)},rl=e=>{const t=e.byteLength-Ar,n=Math.max(0,t-Qa);for(let r=t;r>=n;r-=1)if(e.getUint32(r,!0)===Ka)return r;return ee("has no end of central directory record")},ol=e=>{if(e.byteLength<Ar)return ee("is shorter than its end record");const t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=rl(t),r=t.getUint16(n+4,!0),o=t.getUint16(n+6,!0),s=t.getUint16(n+10,!0),a=t.getUint32(n+12,!0),i=t.getUint32(n+16,!0);if(r!==0||o!==0)return ee("spans several disks");if(s===tl||a===be||i===be)return ee("is a ZIP64 package");if(i+a>n)return ee("has a central directory past its end record");const m=new Map;let f=i;for(let c=0;c<s;c+=1){if(f+an>n||t.getUint32(f,!0)!==Xa)return ee("has a malformed central directory");const u=t.getUint16(f+8,!0),p=t.getUint16(f+10,!0),w=t.getUint32(f+20,!0),x=t.getUint32(f+24,!0),b=t.getUint16(f+28,!0),T=t.getUint16(f+30,!0),L=t.getUint16(f+32,!0),O=t.getUint32(f+42,!0),q=f+an;if(q+b>n)return ee("has a name past its central directory");const D=nl.decode(e.subarray(q,q+b));if(w===be||x===be||O===be)return ee("has a ZIP64 entry");if(!D.endsWith("/")){if(m.has(D))return ee(`names ${D} twice`);m.set(D,{name:D,encrypted:(u&Ja)!==0,method:p,compressedSize:w,uncompressedSize:x,localHeaderOffset:O})}f=q+b+T+L}return{bytes:e,entries:m}},sl=(e,t)=>{const{bytes:n}=e,r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=t.localHeaderOffset;if(o+ln>n.byteLength||r.getUint32(o,!0)!==Ya)return ee(`has no local header for ${t.name}`);const s=o+ln+r.getUint16(o+26,!0)+r.getUint16(o+28,!0),a=s+t.compressedSize;return a>n.byteLength?ee(`has the data of ${t.name} past its end`):{start:s,end:a}},Mr=e=>new ReadableStream({start(t){e.byteLength>0&&t.enqueue(e),t.close()}}),al=e=>Mr(e).pipeThrough(new DecompressionStream("deflate-raw")),ll=(e,t)=>{let n=0;return new TransformStream({transform(r,o){if(n+=r.byteLength,n>t){o.error(new Y("too-large",`${e} inflates past ${t} bytes`));return}o.enqueue(r)}})},Ce=(e,t,n)=>{const r=e.entries.get(t);if(r===void 0)return null;if(r.encrypted)throw new Y("encrypted",`${t} is encrypted`);if(r.method!==cn&&r.method!==el)return ee(`compresses ${t} with method ${r.method}`);if(r.uncompressedSize>n)throw new Y("too-large",`${t} declares ${r.uncompressedSize} bytes`);const{start:o,end:s}=sl(e,r),a=e.bytes.subarray(o,s);return(r.method===cn?Mr(a):al(a)).pipeThrough(ll(t,n))},Ve=async(e,t,n)=>{const r=Ce(e,t,n);if(r===null)return null;const o=new TextDecoder("utf-8",{fatal:!0}),s=r.getReader();let a="";try{for(;;){const{done:i,value:m}=await s.read();if(i)break;a+=o.decode(m,{stream:!0})}return a+o.decode()}catch(i){if(i instanceof Y)throw i;return ee(`has ${t}, which does not inflate to UTF-8 text`)}finally{s.releaseLock()}},dn="content.xml",il="META-INF/manifest.xml",Nr=e=>{throw new Y("not-workbook",`the spreadsheet ${e}`)},un=(e,t)=>Ce(e,dn,t.maxPartBytes)??Nr(`has no ${dn}`),cl=async(e,t)=>{const n=Ce(e,il,t.maxPartBytes);if(n===null)return!1;let r=!1;return await Ne(n,{start:o=>{o==="encryption-data"&&(r=!0)}},()=>r),r},dl=async e=>{const t=[],n=new Set;let r=null,o=0;return await Ne(e,{start:(s,a,i)=>{s==="style"?r=a.get("family")==="table"?a.get("name")??null:null:s==="table-properties"&&r!==null&&a.get("display")==="false"?n.add(r):s==="table"&&(o===0&&t.push({name:a.get("name")??"",style:a.get("style-name")??""}),i||(o+=1))},end:s=>{s==="style"?r=null:s==="table"&&(o=Math.max(0,o-1))}},()=>!1),{tables:t,hidingStyles:n}},ot=e=>{const t=Number(e);return Number.isInteger(t)&&t>0?t:1},ul=async(e,t,n)=>{const r=yr(n);let o=0,s=0,a=!1,i=!1,m=0,f=1,c=new Map,u=0,p=null;return await Ne(e,{start:(w,x,b)=>{if(w==="table"){s===0&&(a=o===t,o+=1),b||(s+=1);return}!a||s!==1||(w==="table-row"?(f=ot(x.get("number-rows-repeated")),c=new Map,u=0):w==="table-cell"||w==="covered-table-cell"?p={repeat:ot(x.get("number-columns-repeated")),covered:w==="covered-table-cell",parts:[],paragraphs:0,paragraphDepth:0,annotationDepth:0}:p!==null&&p.annotationDepth===0&&(w==="annotation"&&!b?p.annotationDepth+=1:w==="p"||w==="h"?(p.paragraphs>0&&p.parts.push(`
|
|
12
|
+
`),p.paragraphs+=1,b||(p.paragraphDepth+=1)):p.paragraphDepth>0&&(w==="s"?p.parts.push(" ".repeat(ot(x.get("c")))):w==="tab"?p.parts.push(" "):w==="line-break"&&p.parts.push(`
|
|
13
|
+
`))))},end:w=>{if(w==="table"){s=Math.max(0,s-1),s===0&&a&&(a=!1,i=!0);return}if(p!==null&&p.annotationDepth>0){w==="annotation"&&(p.annotationDepth-=1);return}if(!(!a||s!==1))if((w==="table-cell"||w==="covered-table-cell")&&p!==null){const x=p.covered?"":p.parts.join("");if(x!==""){const b=Math.min(u+p.repeat,n.maxColumns+1);for(let T=u;T<b;T+=1)c.set(T,x)}u+=p.repeat,p=null}else w==="table-row"?(r.addRow(m,c,f),m+=f):(w==="p"||w==="h")&&p!==null&&(p.paragraphDepth=Math.max(0,p.paragraphDepth-1))},text:w=>{p!==null&&p.annotationDepth===0&&p.paragraphDepth>0&&p.parts.push(w)}},()=>i||r.full()),r.table()},fl=async(e,t)=>{if(await cl(e,t))throw new Y("encrypted","the spreadsheet's manifest names encryption data");const{tables:n,hidingStyles:r}=await dl(un(e,t)),o=[];let s=0;return n.forEach((a,i)=>{if(r.has(a.style)){s+=1;return}o.push({name:a.name,read:async m=>ul(un(e,t),i,m)})}),o.length===0&&Nr("shows no table"),{sheets:o.slice(0,t.maxSheets),unshownSheets:s,unlistedSheets:Math.max(0,o.length-t.maxSheets)}},pe=Object.freeze({kind:"general"}),ml=new Map([[0,"General"],[1,"0"],[2,"0.00"],[3,"#,##0"],[4,"#,##0.00"],[9,"0%"],[10,"0.00%"],[11,"0.00E+00"],[12,"# ?/?"],[13,"# ??/??"],[14,"mm-dd-yy"],[15,"d-mmm-yy"],[16,"d-mmm"],[17,"mmm-yy"],[18,"h:mm AM/PM"],[19,"h:mm:ss AM/PM"],[20,"h:mm"],[21,"h:mm:ss"],[22,"m/d/yy h:mm"],...[27,28,29,30,31,34,35,36,50,51,52,53,54,55,56,57,58].map(e=>[e,"yyyy-mm-dd"]),[32,"h:mm"],[33,"h:mm:ss"],[37,"#,##0 ;(#,##0)"],[38,"#,##0 ;[Red](#,##0)"],[39,"#,##0.00;(#,##0.00)"],[40,"#,##0.00;[Red](#,##0.00)"],[45,"mm:ss"],[46,"[h]:mm:ss"],[47,"mmss.0"],[48,"##0.0E+0"],[49,"@"]]),hl=/^\[(h+|m+|s+)\]$/iu,pl=e=>{let t="",n=!1;for(let r=0;r<e.length;r+=1){const o=e[r];if(o===";")break;if(o==='"'){const s=e.indexOf('"',r+1);r=s===-1?e.length:s}else if(o==="\\"||o==="_"||o==="*")r+=1;else if(o==="["){const s=e.indexOf("]",r+1),a=e.slice(r,s===-1?e.length:s+1);hl.test(a)&&(t+=a.slice(1,-1),n=!0),r=s===-1?e.length:s}else t+=o}return{text:t.toLowerCase(),elapsed:n}},gl=e=>{const{text:t,elapsed:n}=pl(e);if(t===""||t==="general"||t.includes("@")||/[0#?.]e[+-]/u.test(t))return pe;const r=n||/[hs]/u.test(t)||t.includes("am/pm")||t.includes("a/p"),o=/[ydge]/u.test(t.replace(/am\/pm|a\/p/gu,""))||t.includes("m")&&!r;if(o||r)return{kind:"date-time",date:o,time:r,seconds:t.includes("s"),elapsed:n};if(/[0#?]\s*\/\s*[0#?]/u.test(t))return pe;const s=/[0#?][0#?,]*(?:\.[0#?]*)?,*/u.exec(t)?.[0];if(s===void 0)return pe;const a=/,*$/u.exec(s)?.[0].length??0,[i="",m=""]=s.slice(0,s.length-a).split("."),f=(m.match(/[0#?]/gu)??[]).length;return t.includes("%")?{kind:"percent",decimals:f}:{kind:"fixed",decimals:f,grouping:i.includes(","),scale:1e3**a}},wl=(e,t)=>{const n=t.get(e)??ml.get(e);return n===void 0?pe:gl(n)},Nt=e=>{if(Number.isInteger(e)&&Math.abs(e)<1e15)return String(e);const[t="",n]=e.toPrecision(15).split("e"),r=t.includes(".")?t.replace(/0+$/u,"").replace(/\.$/u,""):t;return n===void 0?r:`${r}E${n.startsWith("-")?n:`+${n.replace("+","")}`}`},fn=(e,t,n)=>{const r=Math.abs(e).toFixed(t);if(r.includes("e"))return Nt(e);const[o="",s]=r.split("."),a=n?o.replace(/\B(?=(\d{3})+(?!\d))/gu,","):o;return`${e<0&&/[1-9]/u.test(r)?"-":""}${a}${s===void 0?"":`.${s}`}`},vl=864e5,mn=86400,xl=2958465,we=(e,t)=>String(e).padStart(t,"0"),El=(e,t)=>{if(!t&&e===0)return"1900-01-00";if(!t&&e===60)return"1900-02-29";const n=t?Date.UTC(1904,0,1):e<60?Date.UTC(1899,11,31):Date.UTC(1899,11,30),r=new Date(n+e*vl);return`${we(r.getUTCFullYear(),4)}-${we(r.getUTCMonth()+1,2)}-${we(r.getUTCDate(),2)}`},bl=(e,t,n)=>{if(e<0||e>=xl+1)return Nt(e);let r=Math.floor(e),o=Math.round((e-r)*mn);o===mn&&(r+=1,o=0);const s=Math.floor(o/3600),a=Math.floor(o%3600/60),i=`${we(t.elapsed?r*24+s:s,2)}:${we(a,2)}${t.seconds?`:${we(o%60,2)}`:""}`;if(t.elapsed||!t.date)return i;const m=El(r,n);return t.time?`${m} ${i}`:m},yl=(e,t,n)=>{switch(t.kind){case"general":return Nt(e);case"date-time":return bl(e,t,n);case"percent":return`${fn(e*100,t.decimals,!1)}%`;case"fixed":return fn(e/t.scale,t.decimals,t.grouping)}},jr="_rels/.rels",oe=e=>{throw new Y("not-workbook",`the workbook ${e}`)},jt=(e,t)=>{const n=Lr(t,()=>!1);n.write(e),n.finish()},kl=(e,t)=>{try{return decodeURIComponent(e)}catch{return oe(`points to a malformed part name (${t})`)}},Sl=(e,t)=>{const r=[...t.startsWith("/")?[]:e.split("/").slice(0,-1)];for(const o of t.split("/"))o===""||o==="."||(o===".."?(r.length===0&&oe(`points above its root (${t})`),r.pop()):r.push(kl(o,t)));return r.join("/")},Rl=e=>{const t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},hn=async(e,t,n)=>{const r=await Ve(e,t===""?jr:Rl(t),n.maxPartBytes),o=new Map;return r===null||jt(r,{start:(s,a)=>{if(s!=="Relationship")return;const i=a.get("Id"),m=a.get("Type"),f=a.get("Target");i===void 0||m===void 0||f===void 0||a.get("TargetMode")==="External"||o.set(i,{type:m,target:Sl(t,f)})}}),o},st=(e,t)=>{for(const n of e.values())if(n.type.endsWith(`/${t}`))return n.target;return null},Tl=e=>{const t=[];let n=!1;return jt(e,{start:(r,o)=>{if(r==="workbookPr"){const s=o.get("date1904");n=s==="1"||s==="true"}else r==="sheet"&&t.push({name:o.get("name")??"",state:o.get("state")??"visible",relationship:o.get("id")??""})}}),{sheets:t,date1904:n}},Ol=async e=>{const t=[];let n=null,r=!1,o=0;return await Ne(e,{start:(s,a,i)=>{s==="si"?n=[]:s==="rPh"&&!i?o+=1:s==="t"&&o===0&&(r=!i)},end:s=>{s==="si"&&n!==null?(t.push(n.join("")),n=null):s==="rPh"?o=Math.max(0,o-1):s==="t"&&(r=!1)},text:s=>{r&&n!==null&&n.push(s)}},()=>!1),t},Cl=e=>{const t=new Map,n=[];let r=!1;return jt(e,{start:(o,s)=>{if(o==="numFmt"){const a=Number(s.get("numFmtId")),i=s.get("formatCode");Number.isInteger(a)&&i!==void 0&&t.set(a,i)}else if(o==="cellXfs")r=!0;else if(o==="xf"&&r){const a=Number(s.get("numFmtId")??"0");n.push(Number.isInteger(a)?a:0)}},end:o=>{o==="cellXfs"&&(r=!1)}}),n.map(o=>wl(o,t))},Ll=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u,Al=e=>{const t=Ll.exec(e);if(t===null)return e;const[,n,r]=t;return r===void 0||/^00:00(?::00)?$/u.test(r)?n??e:`${n} ${r}`},Ml=/^([A-Za-z]{1,3})(\d+)$/u,Nl=e=>{const t=Ml.exec(e)?.[1];if(t===void 0)return null;let n=0;for(const r of t.toUpperCase())n=n*26+(r.charCodeAt(0)-64);return n-1},jl=(e,t,n,r)=>{const o=e.value.join("");switch(e.type){case"s":return o===""?"":t[Number(o)]??oe(`refers to the shared string ${o}, past its ${t.length}`);case"inlineStr":return e.inline.join("");case"b":return o===""?"":o==="1"||o==="true"?"TRUE":"FALSE";case"str":case"e":return o;case"d":return Al(o.trim());default:{const s=o.trim();if(s==="")return"";const a=Number(s);return Number.isFinite(a)?yl(a,n[e.style]??pe,r):s}}},Dl=async(e,t,n,r,o)=>{const s=yr(t);let a=-1,i=new Map,m=0,f=null;return await Ne(e,{start:(c,u,p)=>{if(c==="row"){const w=Number(u.get("r"));a=Number.isInteger(w)&&w>a+1?w-1:a+1,i=new Map,m=0}else if(c==="c"){const w=Nl(u.get("r")??"")??m,x=Number(u.get("s")??"0");f={column:w,type:u.get("t")??"n",style:Number.isInteger(x)?x:0,value:[],inline:[],inValue:!1,inInlineText:!1,phoneticDepth:0}}else f!==null&&(c==="v"?f.inValue=!p:c==="rPh"&&!p?f.phoneticDepth+=1:c==="t"&&f.type==="inlineStr"&&f.phoneticDepth===0&&(f.inInlineText=!p))},end:c=>{if(c==="c"&&f!==null){const u=jl(f,n,r,o);u!==""&&i.set(f.column,u),m=f.column+1,f=null}else c==="row"?s.addRow(a,i,1):f!==null&&(c==="v"?f.inValue=!1:c==="rPh"?f.phoneticDepth=Math.max(0,f.phoneticDepth-1):c==="t"&&(f.inInlineText=!1))},text:c=>{f!==null&&(f.inValue?f.value.push(c):f.inInlineText&&f.inline.push(c))}},s.full),s.table()},Pl=async(e,t)=>{const n=st(await hn(e,"",t),"officeDocument")??oe("has no officeDocument relationship"),r=await Ve(e,n,t.maxPartBytes)??oe(`has no part ${n}`),{sheets:o,date1904:s}=Tl(r),a=await hn(e,n,t),i=st(a,"sharedStrings"),m=i===null?null:Ce(e,i,t.maxPartBytes),f=m===null?[]:await Ol(m),c=st(a,"styles"),u=c===null?null:await Ve(e,c,t.maxPartBytes),p=u===null?[]:Cl(u),w=[];let x=0;for(const b of o){const T=a.get(b.relationship)??oe(`lists the sheet ${b.name} without its relationship`);if(b.state!=="visible"||!T.type.endsWith("/worksheet")){x+=1;continue}e.entries.has(T.target)||oe(`has no part ${T.target} for the sheet ${b.name}`),w.push({name:b.name,read:async L=>{const O=Ce(e,T.target,t.maxPartBytes)??oe(`has no part ${T.target}`);return Dl(O,L,f,p,s)}})}return w.length===0&&oe("shows no sheet"),{sheets:w.slice(0,t.maxSheets),unshownSheets:x,unlistedSheets:Math.max(0,w.length-t.maxSheets)}},_l=Object.freeze([80,75,3,4]),Il=Object.freeze([208,207,17,224,161,177,26,225]),at=Uint8Array.from([..."EncryptedPackage"].flatMap(e=>[e.charCodeAt(0),0])),$l=new Set(["application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.spreadsheet-template"]),Fl="mimetype",Dr=(e,t)=>e.byteLength>=t.length&&t.every((n,r)=>e[r]===n),Pr=e=>Dr(e,_l),_r=e=>Dr(e,Il),ql=e=>{const t=e.byteLength-at.byteLength;for(let n=0;n<=t;n+=1)if(e[n]===at[0]&&at.every((r,o)=>e[n+o]===r))return!0;return!1},Bl=async(e,t)=>{if(_r(e))throw ql(e)?new Y("encrypted","the bytes are a password-protected workbook"):new Y("not-workbook","the bytes are a compound file (a legacy .xls)");if(!Pr(e))throw new Y("not-workbook","the bytes are no ZIP package");const n=ol(e),r=await Ve(n,Fl,t.maxPartBytes);if(r!==null&&$l.has(r.trim()))return fl(n,t);if(n.entries.has(jr))return Pl(n,t);throw new Y("not-workbook","the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package")},Ul=async(e,t)=>{const n=e.getReader(),r=[];let o=0;try{for(;;){const{done:i,value:m}=await n.read();if(i)break;if(o+=m.byteLength,o>t)return null;r.push(m)}}finally{n.cancel().catch(()=>{})}const s=new Uint8Array(o);let a=0;for(const i of r)s.set(i,a),a+=i.byteLength;return s},Ir=async(e,t)=>{try{return{kind:"table",table:await e.read(t)}}catch(n){return{kind:"refused",refusal:n instanceof Y?n.refusal:"not-workbook"}}},Hl=async(e,t,n,r,o)=>{const s=await e.asset(_.explorerWorkbookHref(t),o);if(s.status==="cancelled")return null;if(s.status==="error")return{kind:"failure",failure:s.failure};let a;try{a=await Ul(s.body,n.maxBytes)}catch{return o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}if(o.aborted)return null;if(a===null)return{kind:"refused",refusal:"too-large"};if(!(Pr(a)||_r(a)))return{kind:"not-package"};try{const i=await Bl(a,n.limits),m=r===null?-1:i.sheets.findIndex(p=>p.name===r),f=Math.max(m,0),c=i.sheets[f];if(c===void 0)return{kind:"refused",refusal:"not-workbook"};const u=await Ir(c,n.budget);return o.aborted?null:{kind:"workbook",workbook:i,selected:f,sheet:u}}catch(i){return i instanceof Y?{kind:"refused",refusal:i.refusal}:o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}},zl=Object.freeze({className:"aqmx-document-spreadsheet-body","data-aqmx-document-scroller":""}),Vl=(e,t)=>{switch(t.code){case"encoding":return e.spreadsheetUnreadableEncoding(t.encodings);case"binary":return e.spreadsheetNotText;case"long-row":return e.spreadsheetLongRow}},pn=(e,t)=>{switch(t){case"encrypted":return e.spreadsheetWorkbookEncrypted;case"not-workbook":return e.spreadsheetNotWorkbook;case"too-large":return e.spreadsheetWorkbookTooLarge}},lt=e=>e.every(t=>t.every(n=>n==="")),$r=({name:e,url:t,openUrl:n,state:r,children:o})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-spreadsheet-view","data-aqmx-spreadsheet":r,children:[l.jsx(Me,{name:e,openUrl:n,downloadUrl:t,icon:l.jsx(La,{})}),l.jsx(Ae,{scrollerProps:zl,children:l.jsx("div",{className:"aqmx-document-spreadsheet-column",children:o})})]}),Fr=({rows:e,title:t})=>{const{labels:n,locale:r,theme:o}=$(),s=d.use(de),a=d.useMemo(()=>({...Rr(n,r),table:t,fullscreenDialog:n.spreadsheetFullscreen(t)}),[n,r,t]),i=d.useMemo(()=>mt.serializeTsv(e),[e]);return l.jsx("div",{className:"aqmx-document-spreadsheet","data-theme":o,children:l.jsx(xe.SpreadsheetBlock,{tsv:i,layout:s==="fill"?"fill":"inline",locale:r,labels:a})})},ke=({note:e,testId:t,code:n,download:r})=>{const{labels:o}=$();return l.jsx("div",{className:"aqmx-document-spreadsheet-stage",children:r===void 0?l.jsx("p",{className:"aqmx-callout",role:"note","data-testid":t,children:e}):l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":t,"data-aqmx-unreadable":n,children:[l.jsx("p",{className:"aqmx-callout-body",children:e}),l.jsx("a",{className:"aqmx-callout-action",href:r.url,download:r.name,"data-testid":"markdown-explorer-spreadsheet-unreadable-download",children:o.download})]})})},qr=({reading:e,name:t,url:n})=>{const{labels:r}=$();switch(e.kind){case"table":return l.jsxs(l.Fragment,{children:[e.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:r.spreadsheetTruncated}):null,l.jsx(Fr,{rows:e.rows,title:t})]});case"empty":return l.jsx(ke,{note:r.spreadsheetEmpty,testId:"markdown-explorer-spreadsheet-empty"});case"unreadable":return l.jsx(ke,{note:Vl(r,e),testId:"markdown-explorer-spreadsheet-unreadable",code:e.code,download:{url:n,name:t}})}},Zl=({path:e,document:t})=>t.format==="workbook"?l.jsx(Gl,{path:e,document:t}):l.jsx(Wl,{path:e,document:t,format:t.format}),Wl=({path:e,document:t,format:n})=>{const{config:r,data:o,labels:s}=$(),{name:a,url:i}=t,m=d.useCallback(async p=>{const w=await Sr(o,i,{format:n,legacyEncoding:r.legacyTextEncoding,maxBytes:r.spreadsheets.maxBytes,budget:qe},p);return w===null||w.kind==="failure"?w:{kind:"read",value:w}},[o,i,n,r.legacyTextEncoding,r.spreadsheets.maxBytes]),{shown:f,failure:c,retry:u}=Mt(e,a,m);return l.jsxs($r,{name:a,url:i,openUrl:_.explorerPlainTextHref(i),state:f===null?c===null?"loading":"failure":f.kind,children:[f===null&&c===null?l.jsx(ue,{label:s.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,f===null&&c!==null?l.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:l.jsx(ce,{failure:c,alert:!1,onRetry:u,testId:"markdown-explorer-spreadsheet-failure"})}):null,f===null?null:l.jsx(qr,{reading:f,name:a,url:i})]})},Gl=({path:e,document:t})=>{const{config:n,data:r,labels:o}=$(),{name:s,url:a,firstSheetText:i}=t,m=d.useId(),f=d.useRef(null),c=d.useCallback(async E=>{const S=await Hl(r,a,{maxBytes:n.spreadsheets.maxWorkbookBytes,limits:Pa,budget:qe},f.current,E);if(S===null||S.kind==="failure")return S;if(S.kind==="workbook")return{kind:"read",value:S};if(i!==null){const A=await Sr(r,a,{format:i,legacyEncoding:n.legacyTextEncoding,maxBytes:n.spreadsheets.maxBytes,budget:qe},E);return A===null||A.kind==="failure"?A:{kind:"read",value:{kind:"first-sheet",reading:A}}}return{kind:"read",value:{kind:"refused",refusal:S.kind==="not-package"?"not-workbook":S.refusal}}},[r,a,i,n.legacyTextEncoding,n.spreadsheets.maxBytes,n.spreadsheets.maxWorkbookBytes]),{shown:u,failure:p,retry:w}=Mt(e,s,c),[x,b]=d.useState(null),T=d.useRef(new WeakMap),L=u?.kind==="workbook"?u:null,O=L===null?null:x!==null&&x.workbook===L.workbook?x:{workbook:L.workbook,index:L.selected,reading:L.sheet},q=E=>{if(L===null)return;const S=L.workbook.sheets[E];if(S===void 0)return;f.current=S.name;let A=T.current.get(L.workbook);A===void 0&&(A=new Map([[L.selected,L.sheet]]),T.current.set(L.workbook,A));const M=A.get(E),P={workbook:L.workbook,index:E,reading:M??null};if(b(P),M!==void 0)return;const B=A;Ir(S,qe).then(G=>{B.set(E,G),b(v=>v===P?{...P,reading:G}:v)})},D=O===null?null:O.reading===null?"loading":O.reading.kind==="refused"?"unreadable":lt(O.reading.table.rows)?"empty":"table",h=u===null?p===null?"loading":"failure":u.kind==="first-sheet"?u.reading.kind:u.kind==="refused"?"unreadable":D??"loading",g=i===null?a:_.explorerPlainTextHref(a),R=E=>`${m}-sheet-${E}`,N=`${m}-panel`,I=O===null?null:L?.workbook.sheets[O.index]?.name??null,F=L!==null&&L.workbook.sheets.length>1;return l.jsxs($r,{name:s,url:a,openUrl:g,state:h,children:[u===null&&p===null?l.jsx(ue,{label:o.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,u===null&&p!==null?l.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:l.jsx(ce,{failure:p,alert:!1,onRetry:w,testId:"markdown-explorer-spreadsheet-failure"})}):null,u?.kind==="refused"?l.jsx(ke,{note:pn(o,u.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:u.refusal,download:{url:a,name:s}}):null,u?.kind==="first-sheet"?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-first-sheet",children:o.spreadsheetWorkbookFirstSheet}),l.jsx(qr,{reading:u.reading,name:s,url:a})]}):null,L===null||O===null||I===null?null:l.jsxs(l.Fragment,{children:[L.workbook.unshownSheets>0?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unshown-sheets",children:o.spreadsheetUnshownSheets(L.workbook.unshownSheets)}):null,L.workbook.unlistedSheets>0?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unlisted-sheets",children:o.spreadsheetUnlistedSheets(L.workbook.sheets.length)}):null,F?l.jsx(Ia,{names:L.workbook.sheets.map(E=>E.name),selected:O.index,onSelect:q,label:o.spreadsheetSheets(s),tabIdOf:R,panelId:N}):null,l.jsxs("div",{className:"aqmx-document-spreadsheet-sheet","data-testid":"markdown-explorer-spreadsheet-sheet","data-aqmx-sheet":O.index,...F?{role:"tabpanel",id:N,"aria-labelledby":R(O.index)}:{},children:[O.reading===null?l.jsx(ue,{label:o.spreadsheetSheetLoading,testId:"markdown-explorer-spreadsheet-sheet-skeleton"}):null,O.reading?.kind==="table"&&O.reading.table.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:o.spreadsheetTruncated}):null,O.reading?.kind==="refused"?l.jsx(ke,{note:pn(o,O.reading.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:O.reading.refusal,download:{url:a,name:s}}):null,O.reading?.kind==="table"&<(O.reading.table.rows)?l.jsx(ke,{note:o.spreadsheetSheetEmpty,testId:"markdown-explorer-spreadsheet-empty"}):null,O.reading?.kind==="table"&&!lt(O.reading.table.rows)?l.jsx(Fr,{rows:O.reading.table.rows,title:o.spreadsheetSheetName(s,I)},O.index):null]})]})]})},Br=Object.freeze({kind:"empty"}),Kl=(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 z.explorerHref(e,{...t,overrides:r})},Se=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:i})=>{const m=d.use(de);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":m,className:"aqmx-document",...a,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,i]})},Xl=({absence:e,announces:t,announceFailure:n})=>{const{labels:r,announcer:o}=$(),s=e.kind==="no-readme"?e.folder:null,a=e.kind==="failure"?e.folder:null,i=e.kind==="failure"?e.failure:null;switch(d.useEffect(()=>{t&&s!==null&&o.announce(r.folderReadmeMissing(_.lastPathSegment(s)))},[t,s,o,r]),d.useEffect(()=>{a!==null&&i!==null&&n(r.documentFailed(_.lastPathSegment(a),re(r,i.reason)))},[a,i,n,r]),e.kind){case"empty":return l.jsx(Se,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:r.documentEmpty})})});case"loading":return l.jsx(Dt,{label:r.documentRegion});case"no-readme":return l.jsx(Se,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-folder-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:r.folderReadmeMissing(_.lastPathSegment(e.folder))})})});case"failure":return l.jsx(Se,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx(Ct,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-folder-failure"})})}},Dt=({label:e})=>{const{labels:t}=$();return l.jsx(Se,{kind:"loading",label:e,stale:!1,busy:!0,children:l.jsx(ue,{label:t.documentLoading,testId:"markdown-explorer-document-skeleton"})})},gn=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),Yl=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=$(),a=d.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),i=ua(),m=fa(),f=d.useMemo(()=>o===void 0?void 0:h=>o(e,h),[o,e]),c=d.useRef(null),{editable:u,doubleClick:p,region:w,paneScroll:x,stale:b}=r;d.useLayoutEffect(()=>{if(u)return s.bindView(e,{anchor:()=>{const h=c.current,g=w(),R=h===null?null:h.querySelector(We);return h===null||g===null||R===null?null:Jn(h,x.scrollerOf(g,R))}})},[s,e,u,w,x]);const T=h=>{const g=c.current,{target:R}=h;!p||g===null||!(R instanceof Element)||!Yn(R)||(h.stopPropagation(),s.start(e,Qn(R,g,g.ownerDocument.getSelection())))},L=d.useRef(null),O=d.useRef(b);d.useLayoutEffect(()=>{O.current=b});const q=d.useEffectEvent(h=>{const g=c.current,R=w(),N=g===null?null:nr(g,h.line);if(R===null||N===null)return!1;const I=x.scrollerOf(R,N);return I.scrollTop+=rr(N,h.line)-h.clientTop,!0}),D=d.useEffectEvent(h=>{const g=w();if(g===null)return;const R=()=>{for(const I of gn)g.removeEventListener(I,N,!0);L.current?.release===R&&(L.current=null)},N=()=>R();for(const I of gn)g.addEventListener(I,N,{capture:!0,passive:!0});L.current={point:h,release:R}});return d.useLayoutEffect(()=>{const h=s.takeReturn(e);if(h!==null)return queueMicrotask(()=>{q(h)&&O.current&&D(h)}),()=>L.current?.release()},[s,e]),d.useLayoutEffect(()=>{const h=L.current;h===null||b||(h.release(),q(h.point))},[t,b]),l.jsx("div",{ref:c,className:"aqmx-document-viewer",onDoubleClick:T,children:l.jsx(xe.MarkdownViewer,{...n,onHeadingSelect:i,headingHref:m,onMathDiagnostics:f,parseResult:a,content:null})})},Ur=({document:e,viewer:t})=>{const{labels:n}=$();return l.jsxs(l.Fragment,{children:[l.jsx(Me,{name:e.name,openUrl:_.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:l.jsx(zo,{}),children:e.truncated?null:l.jsx(xs,{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(xe.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},it=({path:e,name:t,viewer:n})=>{const{data:r,labels:o}=$(),s=d.useCallback(async f=>{const c=await r.text(e,f);return"kind"in c?c.kind==="failure"?{kind:"failure",failure:c.failure}:{kind:"read",value:c}:null},[r,e]),{shown:a,failure:i,retry:m}=Mt(e,t,s);return a!==null?l.jsx(Ur,{document:a,viewer:n}):i!==null?l.jsx(Ct,{failure:i,onRetry:m,testId:"markdown-explorer-markup-failure"}):l.jsx(ue,{label:o.markupLoading,testId:"markdown-explorer-markup-skeleton"})},Ql=Object.freeze({reason:"failed"}),Jl=e=>{const{labels:t}=$();return l.jsx(Wo,{fallback:n=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(ce,{failure:Ql,alert:!1,onRetry:n,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(d.Suspense,{fallback:l.jsx(ue,{label:t.editLoading,testId:"markdown-explorer-edit-skeleton"}),children:l.jsx(Zo,{...e})})})},ei=({path:e,document:t,view:n,viewer:r,onRetry:o,editing:s})=>{switch(t.kind){case"markdown":{const{session:a,layout:i,region:m,paneScroll:f,stale:c}=s;if(n==="edit"&&a!==void 0)return l.jsx(Jl,{path:e,name:t.name,session:a,layout:i,viewer:r,region:m,paneScroll:f});if(n==="markup")return l.jsx(it,{path:e,name:t.name,viewer:r});const u=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return l.jsx(Yl,{path:e,document:t,viewer:r,editing:{editable:u,doubleClick:u&&i==="fill",region:m,paneScroll:f,stale:c}})}case"text":return l.jsx(Ur,{document:t,viewer:r});case"image":return n==="markup"&&At(t)==="svg"?l.jsx(it,{path:e,name:t.name,viewer:r}):l.jsx(Js,{document:t});case"media":return l.jsx(Ta,{document:t});case"spreadsheet":return n==="markup"?l.jsx(it,{path:e,name:t.name,viewer:r}):l.jsx(Zl,{path:e,document:t});case"file":return l.jsx(Cs,{document:t});case"failure":return l.jsx(Ct,{failure:t.failure,onRetry:o,testId:"markdown-explorer-document-failure"});default:{const a=t;throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`)}}},ti='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',ni=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:fr(e,n),r===void 0?null:ur(e,r.id),e.querySelector(We),e.querySelector(ti)];for(const s of o)if(s instanceof HTMLElement&&Ot(s))return s;return null},wn=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&Ot(t)},ri=e=>{const t=d.useRef(!1);return d.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,a;const i=p=>{s=!(p.target instanceof Node&&n.contains(p.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},m=p=>{t.current=p.target instanceof Node&&n.contains(p.target)},f=p=>{p.relatedTarget===null&&s&&(t.current=!1)},c=()=>{const{activeElement:p,body:w}=r;p!==null&&p!==w&&(t.current=n.contains(p))},u=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",i,!0),o.addEventListener("mousedown",i,!0),o.addEventListener("focusin",m,!0),o.addEventListener("blur",c),o.addEventListener("focus",u),n.addEventListener("focusout",f),()=>{clearTimeout(a),o.removeEventListener("pointerdown",i,!0),o.removeEventListener("mousedown",i,!0),o.removeEventListener("focusin",m,!0),o.removeEventListener("blur",c),o.removeEventListener("focus",u),n.removeEventListener("focusout",f)}},[e]),t},oi=Object.freeze({count:0,recovered:!1}),si=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:i,fragment:m,paneScroll:f,announces:c,announceFailure:u,onDocumentShown:p})=>{const{labels:w,announcer:x,documents:b}=$(),{document:T}=t,L=d.useRef(null),O=d.useRef(null),q=d.useRef(null),D=d.useRef(0),h=ri(L),g=d.useRef({path:e,document:T}),R=d.useRef(null),N=d.useCallback(H=>{const V=L.current,X=Yt(V,H,f);V!==null&&X!==null&&wn(V,X,h.current)},[f,h]),I=d.useCallback((H,V)=>{const X=D.current;setTimeout(()=>{!V.defaultPrevented&&D.current===X&&N(H)},0)},[N]),F=d.useCallback(H=>{setTimeout(()=>{H.defaultPrevented||N("#")},0)},[N]),E=d.useMemo(()=>({navigation:i,currentPath:e,scrollWithin:N,followSameUrlJump:I,followEmptyFragment:F}),[i,e,N,I,F]),S=d.useCallback(()=>b.retry(e),[b,e]),A=sr(b,oa),M=Wn(e),P=M!==void 0?"edit":n?"markup":"rendered",B=At(T)===null?void 0:P,G=d.useCallback(()=>L.current,[]),v=d.useMemo(()=>({session:M,layout:s,region:G,paneScroll:f,stale:r}),[M,s,G,f,r]),y=B==="edit"?!1:r,C=d.use(de),j=B==="edit"&&s==="fill"?"fill":C,[U,Z]=d.useState(0),K=d.useRef(0),W=d.useRef(!1),[ne,_t]=d.useState(oi),[It,ro]=d.useState(0),$t=d.useRef(u),Ft=d.useRef(r);d.useLayoutEffect(()=>{$t.current=u,Ft.current=r},[u,r]);const oo=d.useMemo(()=>({announceFailure:H=>{Ft.current||$t.current(H)},readPart:()=>{const H=b.readPart(e);K.current+=1;let V=!1,X=!1,Q=!1;return{settle:(fe,me)=>{if(H.settle(fe,me),!(Q||V)){if(me!==null){X=!0,W.current=!1;return}V=!0,_t(je=>({count:je.count+1,recovered:X}))}},release:()=>{Q||(Q=!0,H.release(),K.current-=1,V||ro(fe=>fe+1))}}},holdBusy:()=>{Z(V=>V+1);let H=!0;return()=>{H&&(H=!1,Z(V=>V-1))}}}),[b,e]),qt=y||U>0,so=d.useEffectEvent((H,V)=>{const X=O.current;if(X!==null&&X.path===H&&X.snapshot===V)return;O.current={path:H,snapshot:V},b.noteShown(H,V);const Q=V.document;if(Q.kind==="failure"){W.current=!1,b.noteFailureShown(V)&&u(w.documentFailed(_.lastPathSegment(H),re(w,Q.failure.reason)));return}p?.(H,Q),!(!c||X!==null&&X.path===H&&X.snapshot.document.kind!=="failure")&&(W.current=K.current>0,W.current||x.announce(w.documentShown(Q.name)))});d.useEffect(()=>{so(e,t)},[e,t]);const ao=d.useEffectEvent(()=>{m.kind==="panel"&&m.consume()}),Bt=d.useEffectEvent(H=>{const V=L.current;if(V===null||!h.current)return null;const{activeElement:X,body:Q}=V.ownerDocument;return X!==null&&X!==Q?null:ni(V,T,H)}),lo=d.useEffectEvent(H=>{const V=W.current;W.current=!1,!r&&(H&&Bt(null),c&&(H||V)&&T.kind!=="failure"&&x.announce(w.documentShown(T.name)))});d.useEffect(()=>{ne.count>0&&lo(ne.recovered)},[ne]);const io=d.useEffectEvent(()=>{K.current>0||!W.current||(W.current=!1,c&&!r&&T.kind!=="failure"&&x.announce(w.documentShown(T.name)))});d.useEffect(()=>{It>0&&io()},[It]);const co=d.useEffectEvent(H=>{const V=L.current;V!==null&&wn(V,H,h.current)}),uo=d.useEffectEvent(H=>f.reveal(H)),fo=d.useEffectEvent(H=>Yt(L.current,H,f));return d.useEffect(()=>{if(r)return;const H=g.current.path!==e,V=H||g.current.document!==T;g.current={path:e,document:T};const X=R.current!==e;R.current=e;let Q=null;m.kind==="page"?q.current!==m.navigation&&(q.current=m.navigation,D.current+=1,Q=m.fragment):m.fragment!==null&&(Q=m.fragment,ao());const fe=()=>{const me=Q===null?null:fo(Q);if(!V){me!==null&&co(me);return}const je=Bt(m.fragment);H&&me===null&&je!==null&&uo(je)};X?queueMicrotask(fe):fe()},[m,e,T,r]),l.jsx(de,{value:j,children:l.jsx(Se,{kind:T.kind,view:B,label:a(e,T),stale:qt,busy:qt,frameRef:L,intent:A,children:l.jsx(pr,{value:E,children:l.jsx(na,{children:l.jsx(cr,{value:oo,children:l.jsx(ei,{path:e,document:T,view:P,viewer:o,onRetry:S,editing:v},e)})})})})})},Pt=Object.freeze({kind:"skeleton"}),ai=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=le(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 a=n===null||n===e?null:le(r);return n===null||a===null?Pt:{kind:"document",path:n,snapshot:a,stale:!0}},li=(e,t)=>t.status==="deferred"?Pt:{kind:"document",path:e,snapshot:t,stale:!1},ii=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?li(t.path,d.use(t.promise)):t;return o.kind!=="document"?l.jsx(Dt,{label:r.regionLabel(e,null)}):l.jsx(si,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},Hr=({path:e,absence:t,markup:n,display:r,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:f})=>{const{config:c,labels:u,locale:p,theme:w,documents:x,data:b}=$(),T=xe.useMarkdownToolbarState(),L=d.useRef(!1);d.useLayoutEffect(()=>{L.current=!0},[]);const[O,q]=d.useState(null),[D,h]=d.useState(n),g=d.useCallback(()=>e===null?void 0:x.peek(e),[x,e]),R=d.useSyncExternalStore(x.subscribe,g,g),N=d.useCallback(()=>O===null?void 0:x.peek(O),[x,O]),I=d.useSyncExternalStore(x.subscribe,N,N);d.useLayoutEffect(()=>e===null?void 0:x.open(e),[x,e]),d.useLayoutEffect(()=>O===null?void 0:x.retain(O),[x,O]);const F=e===null?Pt:ai(e,R,O,I,!L.current),E=e===null?null:F.kind==="document"&&!F.stale?F.path:O;E!==O&&q(E);const S=F.kind!=="document"||F.path===e;S&&n!==D&&h(n);const A=d.useMemo(()=>Ua(u,p),[u,p]),M=d.useMemo(()=>({read:(C,j)=>ea(b,C,j)}),[b]),P=d.useMemo(()=>[...c.iframeHosts],[c]),B=o.kind==="panel",G=d.useMemo(()=>({labels:A,spreadsheetLocale:p,emptyMessage:u.documentEmpty,theme:w,availableStyles:c.documentStyles,iFrameAllowedDomains:P,embeds:c.embeds,linkComponent:da,toolbar:T,style:r.style,onStyleChange:r.onStyleChange,align:r.align,onAlignChange:r.onAlignChange,showToc:r.showToc,showStyle:r.showStyle,showAlign:r.showAlign,padding:r.padding,width:r.width===void 0?void 0:`min(${r.width}, 100%)`,maxWidth:r.maxWidth===void 0?void 0:`min(${r.maxWidth}, 100%)`,renderScrollBar:B?void 0:lr,imageSource:M}),[A,p,u.documentEmpty,w,c.documentStyles,P,c.embeds,T,r,B,M]),v=d.useCallback((C,j)=>B?j===null||j.kind==="failure"?_.lastPathSegment(C):j.name:u.documentRegion,[B,u.documentRegion]),y=B?"content":"fill";return e===null?l.jsx(de,{value:y,children:l.jsx(Xl,{absence:t,announces:i,announceFailure:m})}):l.jsx(de,{value:y,children:l.jsx(d.Suspense,{fallback:l.jsx(Dt,{label:v(e,null)}),children:l.jsx(ii,{requestedPath:e,content:F,markup:S?n:D,viewer:G,editLayout:r.editLayout,regionLabel:v,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:f})})})},ci=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a,announcer:i}=$(),m=Re(I=>I.style),f=Re(I=>I.align),c=Le(),u=te.useLocation(),p=Ze(),{view:w,overrides:x,embed:b}=r,T=d.useCallback(I=>{if(p.kind!=="location")return;const F=Kl(s,p.location,I);F!==null&&c(F,"browse")},[s,c,p]),L=d.useCallback(I=>{a.update({style:I}),T("style")},[a,T]),O=d.useCallback(I=>{a.update({align:I}),T("align")},[a,T]),q=Tr(s,x.style,m),D=Or(x.align,f),h=d.useMemo(()=>({style:q,onStyleChange:L,align:D,onAlignChange:O,showToc:b.showToc!==!1,showStyle:b.showStyle!==!1,showAlign:b.showAlign!==!1,padding:b.padding,width:b.width,maxWidth:b.maxWidth,editLayout:"fill"}),[q,L,D,O,b]),g=d.useMemo(()=>({kind:"page",view:w,overrides:x,embed:b}),[w,x,b]),R=d.useMemo(()=>({kind:"page",fragment:u.hash,navigation:u}),[u]),N=d.useCallback(I=>i.announce(I),[i]);return l.jsx(Hr,{path:e,absence:t,markup:n,display:h,navigation:g,fragment:R,paneScroll:Ps,announces:!0,announceFailure:N,onDocumentShown:o})},di=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a}=$(),i=Re(g=>g.style),m=Re(g=>g.align),[f,c]=d.useState(()=>Tr(s,void 0,i)),u=Or(void 0,m),p=d.useCallback(g=>a.update({align:g}),[a]),{maximized:w,onDocumentLink:x,pendingHash:b,onHashConsumed:T,announceFailure:L,paneScroll:O}=r,q=d.useMemo(()=>({style:f,onStyleChange:c,align:u,onAlignChange:p,showToc:w,showStyle:w,showAlign:w,padding:void 0,width:void 0,maxWidth:void 0,editLayout:w?"fill":"content"}),[f,u,p,w]),D=d.useMemo(()=>({kind:"panel",onDocumentLink:x}),[x]),h=d.useMemo(()=>({kind:"panel",fragment:b,consume:T}),[b,T]);return l.jsx(Hr,{path:e,absence:t,markup:n,display:q,navigation:D,fragment:h,paneScroll:O,announces:!1,announceFailure:L,onDocumentShown:o})},zr=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>r.kind==="page"?l.jsx(ci,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o}):l.jsx(di,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o});function ui({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Vr=k.forwardRef(ui);function fi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Zr=k.forwardRef(fi);function mi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 hi=k.forwardRef(mi);function pi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 gi=k.forwardRef(pi);function wi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 vi=k.forwardRef(wi);function xi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 Ei=k.forwardRef(xi);function bi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),k.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 Wr=k.forwardRef(bi);function yi({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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"}),k.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 ki=k.forwardRef(yi);function Si({title:e,titleId:t,...n},r){return k.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?k.createElement("title",{id:t},e):null,k.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 Ri=k.forwardRef(Si),Gr=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=$(),[s,a]=d.useState(!1),i=()=>{o===void 0||s||(a(!0),o(e).then(m=>{m&&t()}).finally(()=>a(!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:i,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},Ti="Control+E Meta+E",Kr=(e,t,n)=>n&&t?"split":e.view,Et=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},Oi=e=>e==="split"?null:e,Xr=e=>e==="preview"?"editor":"preview",Yr=e=>/Mac|iPhone|iPad|iPod/u.test(e),Qr=(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)},vn=(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)},Ci=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:i,announcer:m}=$(),f=d.useId(),[c,u]=d.useState(null),[p,w]=d.useState(0),[x,b]=d.useState(null),[T,L]=d.useState(null),O=d.useMemo(()=>new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}),[i]),q=d.useCallback(()=>{b(null),L(null)},[]),D=Un({open:n,onOpen:q,onDismiss:r});d.useEffect(()=>{if(!n)return;const R=new AbortController;return u(null),o.revisions(e,R.signal).then(N=>{"kind"in N&&u(N)}),()=>R.abort()},[n,o,e,p]),d.useEffect(()=>{if(!n||x===null)return;const R=new AbortController;return L(null),o.revision(e,x,R.signal).then(N=>{"kind"in N&&L(N)}),()=>R.abort()},[n,o,e,x]);const h=()=>{T===null||T.kind!=="revision"||(s.replaceDraft(e,T.text),m.announce(a.historyRestored(t)),r())},g=c!==null&&c.kind==="revisions"?c.revisions.find(R=>R.id===x):void 0;return l.jsx("dialog",{...D,className:"aqmx-confirm aqmx-history","aria-labelledby":f,"data-testid":"markdown-explorer-history",children:l.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[l.jsx("p",{id:f,className:"aqmx-confirm-title",children:a.historyTitle(t)}),c===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):c.kind==="failure"?l.jsx(ce,{failure:c.failure,alert:!1,onRetry:()=>w(R=>R+1),testId:"markdown-explorer-history-failure"}):c.revisions.length===0?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:a.historyEmpty}):l.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:c.revisions.map(R=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":R.id===x,"data-testid":"markdown-explorer-history-entry",onClick:()=>b(R.id),children:[l.jsx("span",{children:vn(R,O,a.historyEntry)}),R.current?l.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,R.kept?l.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},R.id))}),x===null?null:T===null?l.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):T.kind==="failure"?l.jsx(ce,{failure:T.failure,alert:!1,testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":g===void 0?a.historyTitle(t):vn(g,O,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:T.text})}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":"markdown-explorer-history-close",onClick:r,children:a.historyClose}),l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":T===null||T.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:h,children:a.historyRestore})]})]})})},Li=e=>{const{documents:t}=$(),n=d.useCallback(()=>t.peek(e),[t,e]),r=d.useCallback(()=>t.peekSeeded(e),[t,e]),o=d.useSyncExternalStore(t.subscribe,n,r),s=le(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:_.lastPathSegment(e)}:{edit:s.kind==="markdown"||s.kind==="spreadsheet"?s.edit:null,name:s.name}},ae=e=>{e.stopPropagation()},Ai=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:a,labels:i}=$(),m=d.useSyncExternalStore(a.subscribe,()=>a.session(e)!==void 0,()=>!1),[f,c]=d.useState(null),u=()=>{if(!m){a.start(e,a.viewAnchor(e));return}a.flush(e);const b=a.session(e);b?.dirty===!0?c(b.save.kind==="draft"?"draft":"unsaved"):a.close(e)},p=()=>{m||(Vo(),r&&a.sideBySide()&&s?.prepare?.())},w=n?o?i.editDraftDocumentNamed(t):i.editDocumentNamed(t):null,x=o?i.editDraftDocument:i.editDocument;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:w===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:m?i.closeEditor:w===null?x:w,"aria-label":w===null?void 0:w,"aria-pressed":m,"data-testid":"markdown-explorer-document-edit",onClick:u,onDoubleClick:ae,onPointerEnter:p,onFocus:p,children:[l.jsx(ki,{"aria-hidden":"true"}),w===null?l.jsx("span",{children:i.editDocumentLabel}):null]}),l.jsx(Hn,{open:f!==null,title:f==="draft"?i.draftDiscardTitle:i.unsavedTitle,body:f==="draft"?i.draftDiscardBody(t):i.unsavedBody(t),confirmLabel:i.unsavedDiscard,cancelLabel:i.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{c(null),a.close(e)},onCancel:()=>c(null)})]})},Mi=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=$(),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:ae,children:[l.jsx(hi,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},Ni=({session:e})=>{const{labels:t}=$(),n=yo(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})},ji=Object.freeze(["editor","split","preview"]),Di=Object.freeze(["editor","preview"]),Pi=Object.freeze({editor:Zr,split:Ri,preview:Wr}),_i=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:a,labels:i}=$(),m=Kn(),f=Kr(r,m,o),c=o?ji:Di,u=d.useId(),p=d.useRef(new Map),w={editor:{label:i.editViewEditor,tooltip:i.editViewEditorTooltip},split:{label:i.editViewSplit,tooltip:i.editViewSplitTooltip},preview:{label:i.editViewPreview,tooltip:i.editViewPreviewTooltip}},x=()=>{a.preparePreview(e),s?.prepare?.()},b=T=>{if(!Qr(T.nativeEvent,Yr(navigator.platform)))return;St(T);const L=Xr(f);Et(a,e,L,o),p.current.get(L)?.focus()};return l.jsx("div",{role:"radiogroup","aria-label":n?i.editViewNamed(t):i.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:b,children:c.map(T=>{const L=Pi[T],{label:O,tooltip:q}=w[T],D=T==="preview"?x: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(T):p.current.set(T,h)},type:"radio",name:u,value:T,checked:T===f,"aria-label":O,"aria-keyshortcuts":T==="split"?void 0:Ti,title:q,"data-testid":`markdown-explorer-edit-view-${T}`,onChange:()=>Et(a,e,T,o),onDoubleClick:ae,onPointerEnter:D,onFocus:D}),l.jsx(L,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:O})]},T)})})},Ii=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:a}=$(),[i,m]=d.useState(!1);if(r.phase.kind!=="editing")return null;const f=r.save.kind==="saving",c=f||!r.dirty,u=()=>{s.flush(e);const w=s.session(e);w===void 0||!w.dirty||w.save.kind==="saving"||s.save(e)},p=w=>n?{className:"aqmx-icon-button","aria-label":w}:{className:"aqmx-icon-button aqmx-labelled-button"};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...p(a.conflictNext),title:a.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ae,children:[l.jsx(gi,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.conflictNext})]}):null,l.jsx(_i,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?l.jsxs("button",{type:"button",...p(a.historyOpen),title:a.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>m(!0),onDoubleClick:ae,children:[l.jsx(vi,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.historyOpen})]}):null,r.save.kind==="draft"?null:l.jsxs("button",{type:"button",...p(a.saveDraft),title:a.saveDraftTooltip,"aria-disabled":c,"aria-busy":f,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:u,onDoubleClick:ae,children:[l.jsx(Ei,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:a.saveDraft})]}),r.history?l.jsx(Ci,{path:e,documentName:t,open:i,onClose:()=>m(!1)}):null]})},$i=({path:e,session:t})=>{const{edits:n}=$();return t.save.kind!=="grant"?null:l.jsx(Gr,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},Fi=new Set,qi=(e,t,n)=>{const{documents:r,announcer:o,labels:s}=$(),a=d.useCallback(()=>r.peek(e),[r,e]),i=d.useCallback(()=>r.peekSeeded(e),[r,e]),m=d.useSyncExternalStore(r.subscribe,a,i),f=d.useCallback(()=>r.answerStampOf(e),[r,e]),c=d.useSyncExternalStore(r.subscribe,f,f),[u]=d.useState(()=>new Set),[p,w]=d.useState(Fi),[x,b]=d.useState(null);x!==null&&(x.path!==e||x.markup!==n)&&b(null);const T=d.useRef(null);d.useLayoutEffect(()=>(T.current=e,()=>{T.current=null}),[e]);const L=d.useRef(n);d.useLayoutEffect(()=>{L.current=n},[n]);const O=d.useCallback(()=>{const h=e,g=r.peek(h);u.has(h)||g?.status==="pending"||(u.add(h),w(new Set(u)),b(null),(async()=>{try{const R=await r.refresh(h);if(T.current!==h||R.status==="superseded")return;if(R.status==="failed"){b({path:h,failure:R.failure,stamp:r.answerStampOf(h),markup:L.current}),o.announce(s.documentRefreshFailed(re(s,R.failure.reason)));return}if(R.status==="shown"&&(t||R.failed))return;const N=le(r.peek(h));if(N===null||N.document.kind==="failure")return;o.announce(s.documentRefreshed(N.document.name))}finally{u.delete(h),w(new Set(u))}})())},[e,t,u,r,o,s]),q=p.has(e),D=x!==null&&x.path===e&&x.stamp===c&&x.markup===n?x.failure:null;return{refreshing:q,unavailable:q||m?.status==="pending",failure:D,refresh:O}},Bi=(e,t)=>{switch(t){case"markdown":return e.showMarkup;case"svg":return e.showSvgMarkup;case"csv":case"tsv":return e.showSpreadsheetMarkup(t.toUpperCase())}},Jr=Object.freeze({kind:"page"}),eo=({path:e,placement:t,markup:n})=>{const{labels:r}=$(),{refreshing:o,unavailable:s,failure:a,refresh:i}=qi(e,t.kind==="page",n.shown),m=Oa(e),f=Li(e),c=Wn(e),u=t.kind==="panel"?r.refreshDocumentNamed(t.documentName):null,p=t.kind==="panel"?r.showMarkupNamed(t.documentName):null,w=t.kind==="panel",x=t.kind==="panel"?t.documentName:f.name,b=t.kind==="page"||t.maximized;return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":c===void 0?void 0:"true",children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[c===void 0?null:l.jsx(Ni,{session:c}),c===void 0?null:l.jsx(Ii,{path:e,documentName:x,iconOnly:w,session:c,previewAvailable:b}),c===void 0&&m!==null?l.jsxs("button",{type:"button",className:p===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:p===null?Bi(r,m):p,"aria-label":p===null?void 0:p,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ae,children:[l.jsx(Zr,{"aria-hidden":"true"}),p===null?l.jsx("span",{children:r.showMarkupLabel}):null]}):null,c!==void 0||f.edit?.kind==="inline"||f.edit?.kind==="draft"?l.jsx(Ai,{path:e,documentName:x,iconOnly:w,previewAvailable:b,draft:f.edit?.kind==="draft"}):f.edit?.kind==="external"?l.jsx(Mi,{href:f.edit.href,documentName:x,iconOnly:w}):null,c===void 0?l.jsxs("button",{type:"button",className:u===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:u===null?r.refreshDocument:u,"aria-label":u===null?void 0:u,"aria-disabled":s,"aria-busy":o,"data-aqmx-busy":o?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:i,onDoubleClick:ae,children:[l.jsx(Vr,{"aria-hidden":"true"}),u===null?l.jsx("span",{children:r.refreshDocumentLabel}):null]}):null]}),c!==void 0||a===null?null:l.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":a.reason,children:r.documentRefreshFailed(re(r,a.reason))}),c===void 0?null:l.jsx($i,{path:e,session:c})]})},Ui=({location:e})=>{const t=e.doc,n=d.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=wr(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",...Be,children:[l.jsx(eo,{path:t,placement:Jr,markup:r}),l.jsx(zr,{path:t,absence:Br,markup:e.markup,variant:n})]})},to=({holds:e,testId:t})=>{const{labels:n,announcer:r}=$(),o=d.useId();d.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=d.useCallback(()=>r.shownIn(o),[r,o]),a=d.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:a.length>1?n.announcementSequence(a):a[0]})},he=Object.freeze([]),Hi=e=>{const t=new Set;let n=he,r=[],o=!1;const s=[],a=c=>{n=c;for(const u of[...t])u()},i=()=>s.at(-1)?.region,m=c=>{const u=i();c(),i()!==u&&n!==he&&a(he)},f=()=>{o=!1;const c=r.map(u=>"sentence"in u?u.sentence:u.list(u.items));r=[],a(Object.freeze(c))};return{announce:c=>{if(typeof c=="string")r.push({sentence:c});else{const u=r.find(p=>"list"in p&&p.list===c.list);u!==void 0&&"items"in u?u.items.push(c.item):r.push({list:c.list,items:[c.item]})}o||(o=!0,n!==he&&a(he),e.request(f))},subscribe:c=>(t.add(c),()=>{t.delete(c)}),claim:c=>{const u={region:c};return m(()=>s.push(u)),()=>m(()=>{const p=s.indexOf(u);p!==-1&&s.splice(p,1)})},shownIn:c=>i()===c?n:he}},se=Object.freeze({status:"cancelled"}),xn=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(_.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return _.failureOf(n,r)},zi=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((c,u)=>globalThis.fetch(c,u)),o=(c,u)=>`${e}/${c}?${new URLSearchParams(u).toString()}`,s=c=>{c.status===401&&t(null);const u=c.headers.get(_.EXPLORER_SCOPE_HEADER);u!==null&&t(u)},a=async(c,u,p,w)=>{let x;try{x=await r(c,{credentials:"same-origin",...u,headers:{Accept:"application/json",...u.headers}})}catch{return w({reason:"failed"})}s(x);let b;try{b=await x.json()}catch{return w({reason:_.failureReasonOfStatus(x.status)})}let T;try{T=p(b)}catch{T=!1}if(T)return b;const L=xn(b);return w(L!==null?L:{reason:x.status===200?"failed":_.failureReasonOfStatus(x.status)})},i={[_.EXPLORER_PROOF_HEADER]:_.EXPLORER_REFRESH_PROOF},m={[_.EXPLORER_PROOF_HEADER]:_.EXPLORER_EDIT_PROOF,"Content-Type":`${_.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},f=async(c,u,p)=>{const w=await a(c,u,p,x=>_.failureDocument(x.reason,x.code));return u.signal.aborted?se:w};return{tree:c=>a(o("tree",{[_.EXPLORER_DATA_QUERY.source]:c}),{method:"GET"},_.isExplorerTreeResult,u=>({status:"error",failure:u})),children:async(c,u,p)=>{const w=await a(o("children",{[_.EXPLORER_DATA_QUERY.source]:c,[_.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},_.isExplorerChildrenResult,x=>({status:"error",failure:x}));return p.aborted?se:w},ancestors:async(c,u,p)=>{const w=await a(o("ancestors",{[_.EXPLORER_DATA_QUERY.source]:c,[_.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},_.isExplorerAncestorsResult,x=>({status:"error",failure:x}));return p.aborted?se:w},reveal:async(c,u,p)=>{const w=await a(o("reveal",{[_.EXPLORER_DATA_QUERY.source]:c,[_.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},_.isExplorerRevealResult,x=>({status:"error",failure:x}));return p.aborted?se:w},document:(c,{refresh:u})=>a(o("document",{[_.EXPLORER_DATA_QUERY.path]:c}),u?{method:"GET",headers:i}:{method:"GET"},_.isExplorerDocument,p=>_.failureDocument(p.reason,p.code)),text:async(c,u)=>{const p=await a(o("text",{[_.EXPLORER_DATA_QUERY.path]:c}),{method:"GET",signal:u},_.isExplorerTextAnswer,w=>_.failureDocument(w.reason,w.code));return u.aborted?se:p},asset:async(c,u)=>{let p;try{p=await r(c,{method:"GET",credentials:"same-origin",signal:u})}catch{return u.aborted?se:{status:"error",failure:{reason:"failed"}}}if(s(p),p.ok)return u.aborted?se:{status:"ok",body:p.body===null?new ReadableStream({start:b=>b.close()}):p.body};let w=null;try{w=await p.json()}catch{}if(u.aborted)return se;const x=xn(w);return{status:"error",failure:x===null?{reason:_.failureReasonOfStatus(p.status)}:x}},edit:(c,u)=>f(o("edit",{[_.EXPLORER_DATA_QUERY.path]:c}),{method:"GET",signal:u},_.isExplorerEditAnswer),save:(c,u,p,w)=>f(o("save",{[_.EXPLORER_DATA_QUERY.path]:c,[_.EXPLORER_DATA_QUERY.base]:u}),{method:"POST",headers:m,body:p,signal:w},_.isExplorerSaveAnswer),preview:(c,u,p)=>f(o("preview",{[_.EXPLORER_DATA_QUERY.path]:c}),{method:"POST",headers:m,body:u,signal:p},_.isExplorerPreviewAnswer),revisions:(c,u)=>f(o("revisions",{[_.EXPLORER_DATA_QUERY.path]:c}),{method:"GET",signal:u},_.isExplorerRevisionsAnswer),revision:(c,u,p)=>f(o("revision",{[_.EXPLORER_DATA_QUERY.path]:c,[_.EXPLORER_DATA_QUERY.revision]:u}),{method:"GET",signal:p},_.isExplorerRevisionAnswer),refresh:c=>a(o("refresh",{[_.EXPLORER_DATA_QUERY.source]:c}),{method:"POST",headers:i},_.isExplorerTreeResult,u=>({status:"error",failure:u}))}},Vi=()=>{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}}},Zi=e=>{const t=J.readStorage(e);if(t===null)return z.NO_TREE_SETTING_CHANGES;try{return z.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),z.NO_TREE_SETTING_CHANGES}},En=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=Zi(e);n={changes:s,settings:z.applyTreeSettingChanges(t,s)}}return n},o=Ee();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:a,settings:i}=r(),m=z.recordTreeSettingChange(a,s,z.advanceTreeSetting(i,s)[s],t);return n={changes:m,settings:z.applyTreeSettingChanges(t,m)},o.emit(),J.writeStorage(e,z.serializeTreeSettingChanges(m)),n.settings}}},Wi=Object.freeze({status:"refreshed"}),Gi=Object.freeze({status:"superseded"}),bt=Object.freeze({status:"deferred"}),Ki=zn(bt),no=4,Xi=no-1,bn=Object.freeze({status:"loading"}),Yi=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),Qi=e=>{const t=new Map,n=ir(),r=new Map,o=new Map,s=new Map,a=new Map,i=Ee(),m=new Set;let f=0,c=0;const u={direct:null,bulk:null},p=new Set;let w=!1,x=0;const b=()=>{x+=1,i.emit()},T=v=>o.get(v)??0,L=v=>{let y=a.get(v);return y===void 0&&(y={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(v,y)),y},O=(v,y,C)=>{v.inFlight.delete(y),f-=1,C.lane==="bulk"&&(c-=1)},q=v=>{const y=a.get(v);if(y!==void 0){for(const[C,j]of[...y.inFlight])O(y,C,j),j.controller.abort();y.direct.clear(),y.bulk.clear(),y.unclaimed.clear()}},D=v=>{const y=T(v)+1;return o.set(v,y),q(v),y},h=(v,y)=>{const C=ye(v),j={promise:v,opened:y,stale:!1,loadedAt:C?.status==="ok"?C.loadedAt:null};return v.status==="pending"&&v.then(U=>{U.status==="ok"&&(j.loadedAt=U.loadedAt)}),j},g=v=>{let y=r.get(v);return y===void 0&&(y=new Map,r.set(v,y)),y},R=v=>{const y=[...a.keys()],C=u[v],j=C===null?0:y.indexOf(C)+1;for(let U=0;U<y.length;U+=1){const Z=y[(j+U)%y.length],K=Z===void 0?void 0:a.get(Z);if(!(Z===void 0||K===void 0)){for(const W of K[v])if((K.claims.get(W)??0)!==0)return K[v].delete(W),u[v]=Z,{sourceId:Z,path:W}}}return null},N=(v,y,C,j)=>{const U=a.get(v);if(U===void 0||U.inFlight.get(y)!==C)return;O(U,y,C);const Z=(U.claims.get(y)??0)>0,K=g(v);if(j.status==="ok"?K.set(y,{status:"loaded",entries:j.entries}):j.status==="error"&&Z?K.set(y,{status:"failed",failure:j.failure}):K.delete(y),b(),j.status==="error"&&Z){const W={sourceId:v,path:y,failure:j.failure};for(const ne of[...m])ne(W)}F()},I=(v,y,C)=>{const j={controller:new AbortController,lane:C};L(v).inFlight.set(y,j),f+=1,C==="bulk"&&(c+=1),e.children(v,y,j.controller.signal).then(U=>N(v,y,j,U),()=>N(v,y,j,Yi))},F=()=>{for(;f<no;){const v=R("direct");if(v!==null){I(v.sourceId,v.path,"direct");continue}const y=c<Xi?R("bulk"):null;if(y===null)return;I(y.sourceId,y.path,"bulk")}},E=(v,y,C)=>{if(!(y.direct.delete(C)||y.bulk.delete(C))){const U=y.inFlight.get(C);if(U===void 0)return!1;O(y,C,U),U.controller.abort()}return r.get(v)?.delete(C),!0},S=()=>{w=!1;let v=!1;for(const y of p){const C=L(y);for(const j of C.unclaimed)(C.claims.get(j)??0)===0&&E(y,C,j)&&(v=!0);C.unclaimed.clear()}p.clear(),v&&(b(),F())},A=(v,y)=>{t.set(v,h(Te(e.tree(v)),y))},M=(v,y,C)=>{D(v);const j=h(zn(y),C);return t.set(v,j),r.delete(v),b(),F(),j},P=(v,y,C,j)=>{if(C!==T(v)||t.get(v)!==y)return;const U=ye(y.promise);if(!(j.status!=="ok"||U?.status!=="ok"||y.loadedAt===null||j.loadedAt<=y.loadedAt)){if(He(U.entries,j.entries)){y.loadedAt=j.loadedAt;return}M(v,j,y.opened)}},B=(v,y)=>{const C=t.get(v);return C!==void 0&&ye(C.promise)?.status===y},G=(v,y)=>{y.stale=!1;const C=T(v);e.tree(v).then(j=>P(v,y,C,j))};return{read:v=>t.get(v)?.promise??Ki,open:v=>{const y=n.resumes(v),C=n.hold(v),j=t.get(v);return j===void 0||B(v,"deferred")?(A(v,!0),b()):y||(j.opened&&B(v,"error")?(A(v,!0),b()):(j.opened=!0,j.stale&&B(v,"ok")&&G(v,j))),C},retry:v=>{B(v,"error")&&(A(v,!0),b())},seed:(v,y)=>{const C=y.then(Z=>Z===null?bt:Z,()=>bt),j=t.get(v);if(j!==void 0&&B(v,"ok")){const Z=T(v);C.then(K=>P(v,j,Z,K));return}D(v);const U=h(Te(C),j?.opened===!0);t.set(v,U),r.delete(v),F(),C.then(Z=>{t.get(v)===U&&(Z.status==="deferred"&&n.isHeld(v)&&A(v,U.opened),b())})},refresh:async v=>{const y=(s.get(v)??0)+1;s.set(v,y);const C=await e.refresh(v);if(s.get(v)!==y)return Gi;if(C.status==="error")return{status:"failed",failure:C.failure};const j=t.get(v);if(!(j!==void 0&&j.loadedAt!==null&&B(v,"ok")&&j.loadedAt>C.loadedAt)){const Z=M(v,C,!0);if(j!==void 0&&j.promise.status==="pending"){const K=T(v);j.promise.then(W=>P(v,Z,K,W))}}for(const[Z,K]of t)Z!==v&&ye(K.promise)?.status==="ok"&&(K.stale=!0);return Wi},children:(v,y)=>r.get(v)?.get(y),claimChildren:(v,y)=>{const C=L(v),j=g(v);let U=!1,Z=!1;for(const[W,ne]of y)C.claims.set(W,(C.claims.get(W)??0)+1),j.get(W)===void 0?(j.set(W,bn),C[ne].add(W),U=!0,Z=!0):ne==="direct"&&C.bulk.delete(W)&&(C.direct.add(W),Z=!0);U&&b(),Z&&F();let K=!1;return()=>{if(!K){K=!0;for(const W of y.keys()){const ne=(C.claims.get(W)??0)-1;ne>0?C.claims.set(W,ne):(C.claims.delete(W),C.unclaimed.add(W))}p.add(v),!w&&(w=!0,queueMicrotask(S))}}},retryChildren:(v,y)=>{const C=r.get(v);if(C===void 0||C.get(y)?.status!=="failed")return;const j=L(v);if((j.claims.get(y)??0)>0){C.set(y,bn),j.direct.add(y),b(),F();return}C.delete(y),b()},pendingChildren:v=>{const y=a.get(v);return y===void 0?0:y.direct.size+y.bulk.size+y.inFlight.size},clear:()=>{for(const v of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))D(v);for(const[v,y]of s)s.set(v,y+1);t.clear(),r.clear(),b()},subscribeChildrenFailures:v=>(m.add(v),()=>{m.delete(v)}),subscribe:i.subscribe,version:()=>x}},Ji=(e,t)=>{let n=e;const r=Ee();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},ec=1;let Ie=0,ie=null;const tc=()=>{const{documentElement:e,body:t}=document;Ie===0&&(ie={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"),Ie+=1;let n=!1;return()=>{n||(n=!0,Ie-=1,!(Ie>0||ie===null)&&(e.style.overflow=ie.htmlOverflow,t.style.overflow=ie.bodyOverflow,e.style.scrollbarGutter=ie.htmlGutter,t.style.scrollbarGutter=ie.bodyGutter,ie=null))}},nc=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],yn=1,rc=1e3,kn=e=>e.getClientRects().length>0,ct="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.",oc=e=>{if(!kn(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+ec)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. ${ct}`;if(t.height<yn)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. ${ct}`;for(const{selector:r,name:o}of nc)for(const s of e.querySelectorAll(r)){if(!kn(s))continue;const a=s.getBoundingClientRect().height;if(a<yn)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(a))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${ct}`}return null},sc=e=>{let t=!1,n;const r=()=>{n=void 0;const a=oc(e);a!==null&&(t=!0,console.error(a))},o=()=>{t||(clearTimeout(n),n=setTimeout(r,rc))},s=typeof ResizeObserver>"u"?null:new ResizeObserver(o);return s?.observe(e),window.addEventListener("resize",o),o(),()=>{clearTimeout(n),s?.disconnect(),window.removeEventListener("resize",o)}},ac=(e,t)=>{d.useEffect(()=>e?tc():void 0,[e]),d.useEffect(()=>{const n=t.current;if(!(!e||n===null))return sc(n)},[e,t])},Sn='[data-testid="markdown-explorer-view-switch"]',lc=[{control:Sn,successors:[Sn,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],ic=e=>{for(const t of lc){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},cc=(e,t)=>{const n=d.useRef(null);d.useEffect(()=>{const o=i=>{const m=e.current;n.current=m!==null&&i instanceof Element&&m.contains(i)?ic(i):null},s=i=>o(i.target);o(document.activeElement);const a=i=>{const m=i.target;i.relatedTarget!==null||!(m instanceof Element)||queueMicrotask(()=>{n.current?.element===m&&m.isConnected&&document.activeElement!==m&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a)}},[e]);const r=d.useRef(t);d.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const m=document.activeElement;if(m!==null&&m!==document.body&&m!==o.element)return!0;const f=e.current;if(f===null)return!0;for(const c of o.control.successors)for(const u of f.querySelectorAll(c))if(u!==o.element&&(u.focus({preventScroll:!0}),document.activeElement===u))return!0;return!1};if(s())return;const a=e.current;if(a===null)return;const i=new MutationObserver(()=>{s()&&i.disconnect()});return i.observe(a,{childList:!0,subtree:!0}),()=>i.disconnect()},[t,e])},dc=d.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-CXHbKdxy.cjs")).then(e=>({default:e.TreeLayout}))),uc=d.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-0Jh08fxo.cjs")).then(e=>({default:e.MultiLayout}))),fc=64,mc={request:e=>{requestAnimationFrame(e)}},Rn=e=>{e.documents.clear(),e.trees.clear()},dt=(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)},hc=(e,t)=>{const[n,r]=d.useState(()=>({overrides:t,locale:e,labels:pt(e,t)}));if(n.locale===e&&Eo(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:pt(e,t)};return r(o),o.labels},pc=(e,t,n)=>{const[r,o]=d.useState(()=>({scope:t,store:En(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:En(e,n)};return o(s),s.store},ut=(e,t)=>{const[n,r]=d.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},gc=()=>Hi(mc),Tn="on",wc="off",vc=Object.freeze({kind:"unavailable"}),xc=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")},Ec=(e,t)=>{const n=le(e.peek(t));return n===null||n.document.kind==="failure"?_.lastPathSegment(t):n.document.name},bc=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:i,lockDocumentScroll:m=!1,onMathDiagnostics:f,onEditGrant:c,draftConverter:u})=>{J.assertStorageNamespace(n),xc(u);const p=jn(r),w=bo(s),x=hc(p,o),{revalidate:b}=te.useRevalidator(),T=d.useRef(()=>{}),L=te.useHref(t.dataPath),[O]=d.useState(()=>{const C=zi({dataPath:L,onScope:U=>T.current(U)}),j={documents:ls({client:C,capacity:Math.max(fc,t.multiView.maxPanels*2)}),trees:Qi(C)};return dt(j,e),J.syncStorageScope(n,e.scope),{data:C,...j,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(O.aligned.pageData!==e||O.aligned.storageNamespace!==n){const C=O.aligned.pageData;O.aligned.pageData=e,O.aligned.storageNamespace=n,C!==e&&(C.scope!==e.scope?O.aligned.pendingReader=e:dt(O,e)),J.syncStorageScope(n,e.scope)}const q=pc(J.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);d.useLayoutEffect(()=>{const C=O.aligned.pendingReader;C!==null&&(O.aligned.pendingReader=null,Rn(O),dt(O,C))},[e,O]),d.useLayoutEffect(()=>{let C=!1;return T.current=j=>{j===e.scope||C||(C=!0,j!==null&&(Rn(O),J.clearExplorerStorage(n)),b())},()=>{T.current=()=>{}}},[e,b,O,n]);const D=d.useRef(t.settingsCookie);d.useLayoutEffect(()=>{D.current=t.settingsCookie},[t.settingsCookie]);const[h]=d.useState(()=>Ji(e.settings,C=>{document.cookie=z.viewSettingsCookieString(D.current,C,window.location.protocol==="https:")})),g=ut(e.scope,gc),R=ut(e.scope,Vi),N=d.useRef(x);d.useLayoutEffect(()=>{N.current=x},[x]);const I=ut(e.scope,()=>Co({data:O.data,conflictLabels:()=>({ours:N.current.conflictOurs,theirs:N.current.conflictTheirs}),onSaveSettled:(C,j)=>{j.kind==="saved"&&O.documents.refresh(C);const U=ko(N.current,j,Ec(O.documents,C));U!==null&&g.announce(U)},sideBySideSetting:{read:()=>J.readStorage(J.storageKeys(n).editPreview)===Tn,write:C=>J.writeStorage(J.storageKeys(n).editPreview,C?Tn:wc)},editorShareSetting:{read:()=>Oo(J.readStorage(J.storageKeys(n).editSplit)),write:C=>J.writeStorage(J.storageKeys(n).editSplit,String(C))}})),F=d.useMemo(()=>Te(e.notices.catch(()=>[])),[e.notices]),E=e.sources.map(C=>C.id).join(`
|
|
14
|
+
`),S=d.useMemo(()=>z.withExplorerSources(t,E.split(`
|
|
15
|
+
`)),[t,E]),A=d.useRef(f);d.useLayoutEffect(()=>{A.current=f},[f]);const[M]=d.useState(()=>(C,j)=>{A.current?.(C,j)}),P=f===void 0?void 0:M,B=d.useRef(u);d.useLayoutEffect(()=>{B.current=u},[u]);const[G]=d.useState(()=>{let C=!1;return{convert:(j,U)=>{const Z=B.current;return Z===void 0?Promise.resolve(vc):Z.convert(j,U)},prepare:()=>{try{B.current?.prepare?.()}catch(j){if(C)return;C=!0,console.error("[markdown-explorer] the draft converter's prepare threw",j)}}}}),v=u===void 0?void 0:G,y=d.useMemo(()=>({config:S,labels:x,locale:p,theme:w,storageNamespace:n,scope:e.scope,sources:e.sources,notices:F,documents:O.documents,trees:O.trees,data:O.data,viewSettings:h,treeSettings:q,announcer:g,reveals:R,edits:I,onEditGrant:c,draftConverter:v,renderTreeFailure:i,reportMathDiagnostics:P}),[S,x,p,w,n,e.scope,e.sources,F,O,h,q,g,R,I,c,v,i,P]);return l.jsx(Dn,{value:y,children:l.jsx(kc,{renderFrame:a,lockDocumentScroll:m},e.scope)})},yc=({ref:e,theme:t,view:n,children:r})=>{const[o]=d.useState(Gs);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})},kc=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=$(),o=Ze(),{hash:s}=te.useLocation(),a=Le(),i=d.useRef(null);ac(t,i),d.useLayoutEffect(()=>{o.kind==="redirect"&&a(`${o.href}${s}`,"browse")},[o,s,a]);const{location:m}=o,f=m.view;cc(i,f);const c=m.view==="tree"?l.jsx(d.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading",...Be}),children:l.jsx(dc,{location:m})}):m.view==="multi"?l.jsx(d.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading",...Be}),children:l.jsx(uc,{location:m})}):l.jsx(Ui,{location:m}),u=l.jsxs(yc,{ref:i,theme:n,view:f,children:[c,l.jsx(Uo,{}),l.jsx(to,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?u:e({view:f,children:u})},Sc=ho.createShouldRevalidate({submissions:"skip",otherPath:"skip",query:"skip",hashChange:"skip"});exports.ALLOW_KEY_REPEAT=ze;exports.CONFLICT_OURS_MARKER=_n;exports.CONFLICT_SEPARATOR=In;exports.CONFLICT_THEIRS_MARKER=$n;exports.CONTENT_PANE=Be;exports.ContentSkeleton=ue;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=On;exports.DocumentPane=zr;exports.DocumentRefreshBar=eo;exports.EXPLORER_THEMES=gt;exports.EditGrantNotice=Gr;exports.ExplorerLink=or;exports.FOLDER_README_LOADING=Vn;exports.FailureView=ce;exports.ForwardRef=Vr;exports.ForwardRef$1=Wr;exports.ImageViewMemoryContext=hr;exports.LazyNativeScrollBar=ar;exports.LiveRegion=to;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=Nn;exports.MARKDOWN_EXPLORER_LABEL_KEYS=kt;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=An;exports.MARKDOWN_EXPLORER_LOCALES=ht;exports.MarkdownExplorer=bc;exports.NO_DOCUMENT=Br;exports.PAGE_DOCUMENT_REFRESH=Jr;exports.anchorOfDoubleClick=Qn;exports.anchorOfView=Jn;exports.blockAtLine=nr;exports.chooseEditView=Et;exports.consumeKey=St;exports.createEmitter=Ee;exports.cssPixels=qn;exports.editViewOf=Kr;exports.explorerNavigationOptions=ns;exports.failureTitleOf=re;exports.findConflictsInLines=Fn;exports.focusWithoutScroll=Ot;exports.frameTopOf=er;exports.isApplePlatform=Yr;exports.isEditViewShortcut=Qr;exports.isEditingDoubleClick=Yn;exports.lineTopIn=rr;exports.loadedOf=le;exports.paneShownAlone=Oi;exports.positionInSource=es;exports.readFolderReadme=Zn;exports.resolveMarkdownExplorerLabels=pt;exports.shouldRevalidateExplorer=Sc;exports.toggledEditView=Xr;exports.useExplorer=$;exports.useExplorerLocation=Ze;exports.useExplorerNavigate=Le;exports.useIntentPrefetch=sr;exports.usePageMarkupToggle=wr;exports.useSideBySide=Kn;exports.useViewSetting=Re;exports.visibleTopOf=tr;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-DRMNpWDJ.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-yvU5HUY1.cjs"),_=require("./dataRoute-DwYtgyt6.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.SPREADSHEET_BYTE_LIMITS=E.SPREADSHEET_BYTE_LIMITS;exports.WORKBOOK_BYTE_LIMITS=E.WORKBOOK_BYTE_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type ExplorerFrameRenderer, MarkdownExplorer, type MarkdownExplorerProps } from "./client/MarkdownExplorer.cjs";
|
|
2
2
|
export { clearExplorerStorage } from "./client/storage.cjs";
|
|
3
|
-
export { DEFAULT_VIEW_SLUGS, defineExplorerConfig, EXPAND_ALL_DEPTH_LIMITS, EXPAND_ALL_FOLDER_LIMITS, type ExplorerConfig, type ExplorerConfigInput, type ExplorerDocumentStyle, type ExplorerLocationConfig, type ExplorerView, type ExplorerViewSlugs, isExplorerSourceId, MULTI_VIEW_COLUMN_LIMITS, MULTI_VIEW_PANEL_LIMITS, REVEAL_DOCUMENT_DEPTH_LIMITS, SPREADSHEET_BYTE_LIMITS, withExplorerSources, } from "./core/config.cjs";
|
|
4
|
-
export { EXPLORER_EDIT_TOKEN_MAX_LENGTH, EXPLORER_FAILURE_REASONS, EXPLORER_MAX_HEADINGS, type ExplorerChildrenResult, type ExplorerDocument, type ExplorerDocumentEdit, type ExplorerDraft, type ExplorerDraftAnswer, type ExplorerDraftConverter, type ExplorerEntry, type ExplorerExternalEdit, type ExplorerFailure, type ExplorerFailureDocument, type ExplorerFailureReason, type ExplorerGrantRequired, type ExplorerHeading, type ExplorerImageType, type ExplorerMediaType, type ExplorerNotice, type ExplorerPageData, type ExplorerRevision, type ExplorerSeededDocument, type ExplorerSourceSummary, type ExplorerSpreadsheetDocument, type ExplorerSpreadsheetFormat, type ExplorerTreeResult, failureDocument, failureOf, isExplorerChildrenResult, isExplorerFailureCode, isExplorerFailureReason, } from "./core/contracts.cjs";
|
|
3
|
+
export { DEFAULT_VIEW_SLUGS, defineExplorerConfig, EXPAND_ALL_DEPTH_LIMITS, EXPAND_ALL_FOLDER_LIMITS, type ExplorerConfig, type ExplorerConfigInput, type ExplorerDocumentStyle, type ExplorerLocationConfig, type ExplorerView, type ExplorerViewSlugs, isExplorerSourceId, MULTI_VIEW_COLUMN_LIMITS, MULTI_VIEW_PANEL_LIMITS, REVEAL_DOCUMENT_DEPTH_LIMITS, SPREADSHEET_BYTE_LIMITS, WORKBOOK_BYTE_LIMITS, withExplorerSources, } from "./core/config.cjs";
|
|
4
|
+
export { EXPLORER_EDIT_TOKEN_MAX_LENGTH, EXPLORER_FAILURE_REASONS, EXPLORER_MAX_HEADINGS, type ExplorerChildrenResult, type ExplorerDocument, type ExplorerDocumentEdit, type ExplorerDraft, type ExplorerDraftAnswer, type ExplorerDraftConverter, type ExplorerEntry, type ExplorerExternalEdit, type ExplorerFailure, type ExplorerFailureDocument, type ExplorerFailureReason, type ExplorerGrantRequired, type ExplorerHeading, type ExplorerImageType, type ExplorerMediaType, type ExplorerNotice, type ExplorerPageData, type ExplorerRevision, type ExplorerSeededDocument, type ExplorerSheetTextFormat, type ExplorerSourceSummary, type ExplorerSpreadsheetDocument, type ExplorerSpreadsheetFormat, type ExplorerTreeResult, failureDocument, failureOf, isExplorerChildrenResult, isExplorerFailureCode, isExplorerFailureReason, } from "./core/contracts.cjs";
|
|
5
5
|
export { COLUMN_MIN_MEASURE, EXPLORER_DEFAULT_PERCENT, EXPLORER_MAX_PERCENT, EXPLORER_MIN_REM, EXPLORER_MULTI_DEFAULT_PERCENT, GOLDEN_RATIO } from "./core/geometry.cjs";
|
|
6
6
|
export { DEFAULT_MARKDOWN_EXPLORER_LOCALE, MARKDOWN_EXPLORER_LABEL_CATALOGS, MARKDOWN_EXPLORER_LABEL_KEYS, MARKDOWN_EXPLORER_LABEL_TEMPLATES, MARKDOWN_EXPLORER_LOCALES, type MarkdownExplorerLabelKey, type MarkdownExplorerLabelOverrides, type MarkdownExplorerLabels, type MarkdownExplorerLocale, resolveMarkdownExplorerLabels, } from "./core/labels.cjs";
|
|
7
7
|
export { type ExplorerEmbedOptions, type ExplorerHrefTarget, type ExplorerLocation, type ExplorerLocationResult, type ExplorerOverrides, type ExplorerSourcelessHrefTarget, explorerHref, resolveExplorerLocation, } from "./core/location.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type ExplorerFrameRenderer, MarkdownExplorer, type MarkdownExplorerProps } from "./client/MarkdownExplorer.js";
|
|
2
2
|
export { clearExplorerStorage } from "./client/storage.js";
|
|
3
|
-
export { DEFAULT_VIEW_SLUGS, defineExplorerConfig, EXPAND_ALL_DEPTH_LIMITS, EXPAND_ALL_FOLDER_LIMITS, type ExplorerConfig, type ExplorerConfigInput, type ExplorerDocumentStyle, type ExplorerLocationConfig, type ExplorerView, type ExplorerViewSlugs, isExplorerSourceId, MULTI_VIEW_COLUMN_LIMITS, MULTI_VIEW_PANEL_LIMITS, REVEAL_DOCUMENT_DEPTH_LIMITS, SPREADSHEET_BYTE_LIMITS, withExplorerSources, } from "./core/config.js";
|
|
4
|
-
export { EXPLORER_EDIT_TOKEN_MAX_LENGTH, EXPLORER_FAILURE_REASONS, EXPLORER_MAX_HEADINGS, type ExplorerChildrenResult, type ExplorerDocument, type ExplorerDocumentEdit, type ExplorerDraft, type ExplorerDraftAnswer, type ExplorerDraftConverter, type ExplorerEntry, type ExplorerExternalEdit, type ExplorerFailure, type ExplorerFailureDocument, type ExplorerFailureReason, type ExplorerGrantRequired, type ExplorerHeading, type ExplorerImageType, type ExplorerMediaType, type ExplorerNotice, type ExplorerPageData, type ExplorerRevision, type ExplorerSeededDocument, type ExplorerSourceSummary, type ExplorerSpreadsheetDocument, type ExplorerSpreadsheetFormat, type ExplorerTreeResult, failureDocument, failureOf, isExplorerChildrenResult, isExplorerFailureCode, isExplorerFailureReason, } from "./core/contracts.js";
|
|
3
|
+
export { DEFAULT_VIEW_SLUGS, defineExplorerConfig, EXPAND_ALL_DEPTH_LIMITS, EXPAND_ALL_FOLDER_LIMITS, type ExplorerConfig, type ExplorerConfigInput, type ExplorerDocumentStyle, type ExplorerLocationConfig, type ExplorerView, type ExplorerViewSlugs, isExplorerSourceId, MULTI_VIEW_COLUMN_LIMITS, MULTI_VIEW_PANEL_LIMITS, REVEAL_DOCUMENT_DEPTH_LIMITS, SPREADSHEET_BYTE_LIMITS, WORKBOOK_BYTE_LIMITS, withExplorerSources, } from "./core/config.js";
|
|
4
|
+
export { EXPLORER_EDIT_TOKEN_MAX_LENGTH, EXPLORER_FAILURE_REASONS, EXPLORER_MAX_HEADINGS, type ExplorerChildrenResult, type ExplorerDocument, type ExplorerDocumentEdit, type ExplorerDraft, type ExplorerDraftAnswer, type ExplorerDraftConverter, type ExplorerEntry, type ExplorerExternalEdit, type ExplorerFailure, type ExplorerFailureDocument, type ExplorerFailureReason, type ExplorerGrantRequired, type ExplorerHeading, type ExplorerImageType, type ExplorerMediaType, type ExplorerNotice, type ExplorerPageData, type ExplorerRevision, type ExplorerSeededDocument, type ExplorerSheetTextFormat, type ExplorerSourceSummary, type ExplorerSpreadsheetDocument, type ExplorerSpreadsheetFormat, type ExplorerTreeResult, failureDocument, failureOf, isExplorerChildrenResult, isExplorerFailureCode, isExplorerFailureReason, } from "./core/contracts.js";
|
|
5
5
|
export { COLUMN_MIN_MEASURE, EXPLORER_DEFAULT_PERCENT, EXPLORER_MAX_PERCENT, EXPLORER_MIN_REM, EXPLORER_MULTI_DEFAULT_PERCENT, GOLDEN_RATIO } from "./core/geometry.js";
|
|
6
6
|
export { DEFAULT_MARKDOWN_EXPLORER_LOCALE, MARKDOWN_EXPLORER_LABEL_CATALOGS, MARKDOWN_EXPLORER_LABEL_KEYS, MARKDOWN_EXPLORER_LABEL_TEMPLATES, MARKDOWN_EXPLORER_LOCALES, type MarkdownExplorerLabelKey, type MarkdownExplorerLabelOverrides, type MarkdownExplorerLabels, type MarkdownExplorerLocale, resolveMarkdownExplorerLabels, } from "./core/labels.js";
|
|
7
7
|
export { type ExplorerEmbedOptions, type ExplorerHrefTarget, type ExplorerLocation, type ExplorerLocationResult, type ExplorerOverrides, type ExplorerSourcelessHrefTarget, explorerHref, resolveExplorerLocation, } from "./core/location.js";
|