@aiquants/markdown-explorer 0.37.0 → 0.37.1
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 +40 -0
- package/README.md +5 -2
- package/dist/{EditSurface-BQgwRUrR.js → EditSurface-BvwgM4lC.js} +1 -1
- package/dist/{EditSurface-Xvk5wZu7.cjs → EditSurface-Ce4bpuvh.cjs} +1 -1
- package/dist/{ExplorerSplit-C_3FChSt.cjs → ExplorerSplit-DBUFhlo_.cjs} +1 -1
- package/dist/{ExplorerSplit-C_kaEnyM.js → ExplorerSplit-DKpqQBsQ.js} +2 -2
- package/dist/{MultiLayout-BZNj1GYo.cjs → MultiLayout-BfGxy2pf.cjs} +1 -1
- package/dist/{MultiLayout-DROxkTdD.js → MultiLayout-CVj5iam0.js} +2 -2
- package/dist/{NativeScrollBar-BDF9A1sc.cjs → NativeScrollBar-BQpaWt45.cjs} +1 -1
- package/dist/{NativeScrollBar-DvdOpwIW.js → NativeScrollBar-BkZPkphH.js} +2 -2
- package/dist/{TreeLayout-Cc-ykewY.js → TreeLayout-B83wJ2CL.js} +2 -2
- package/dist/{TreeLayout-D_DYV64_.cjs → TreeLayout-Df4HLMP-.cjs} +1 -1
- package/dist/{index-BmOU3xcK.cjs → index-Bz-n0dl1.cjs} +9 -9
- package/dist/{index-dtjghDWY.js → index-CVnGqEmh.js} +1121 -1121
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{merge-DC_h-t31.js → merge-BGr72noP.js} +1 -1
- package/dist/{merge-BCFCL1cF.cjs → merge-hFiGx_ND.cjs} +1 -1
- package/dist/{tapScrollCircle-CqMZzWjo.js → tapScrollCircle-BTCGTQ8T.js} +1 -1
- package/dist/{tapScrollCircle-DVNlszeF.cjs → tapScrollCircle-DDwYa54Q.cjs} +1 -1
- package/docs/behavior/dom-hooks.md +1 -1
- package/docs/behavior/security.md +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/*! Bundled third-party code: @heroicons/react 2.2.0 (MIT, ./licenses/@heroicons/react/LICENSE) */
|
|
2
|
-
"use strict";const V=require("./describeValue-Ccvhbt36.cjs"),c=require("react/jsx-runtime"),l=require("react"),re=require("react-router"),z=require("./location-DrOP6t1F.cjs"),De=require("@aiquants/markdown/code-blocks"),P=require("./ownUrls-BTPGNhBt.cjs"),Ne=require("@aiquants/markdown"),Bt=require("@aiquants/markdown/source-lines"),Ht=require("@aiquants/spreadsheet/tsv"),vn=require("@aiquants/spreadsheet/view"),
|
|
2
|
+
"use strict";const V=require("./describeValue-Ccvhbt36.cjs"),c=require("react/jsx-runtime"),l=require("react"),re=require("react-router"),z=require("./location-DrOP6t1F.cjs"),De=require("@aiquants/markdown/code-blocks"),P=require("./ownUrls-BTPGNhBt.cjs"),Ne=require("@aiquants/markdown"),Bt=require("@aiquants/markdown/source-lines"),Ht=require("@aiquants/spreadsheet/tsv"),vn=require("@aiquants/spreadsheet/view"),hs=require("@aiquants/markdown/viewer-settings"),ae=require("./storage-BpYsprog.cjs"),Tt=require("@aiquants/markdown/converter"),ps=require("@aiquants/route-revalidation");function ws(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 R=ws(l),dr=Object.freeze(["reload","notify"]),gs=Object.freeze([`
|
|
3
3
|
`,`\r
|
|
4
|
-
`]),gs=Object.freeze(["fetch","persistSettings","subscribeHostChanges","onDraftChange"]),vs=Object.freeze(["guardUnload","confirmUnversionedSaves"]),Es=(e,t,n)=>{if(!(t===void 0||typeof t=="string"&&n.includes(t)))throw new RangeError(`[markdown-explorer] ${e} must be ${n.map(V.describeValue).join(" or ")}; got ${V.describeValue(t)}`)},ys=e=>{if(typeof e.accessFailure!="function")throw new TypeError(`[markdown-explorer] accessFailure must be the host's access failure presenter (a function); got ${V.describeValue(e.accessFailure)}`);for(const n of gs){const r=e[n];if(r!==void 0&&typeof r!="function")throw new TypeError(`[markdown-explorer] ${n} must be a function; got ${V.describeValue(r)}`)}for(const n of vs){const r=e[n];if(r!==void 0&&typeof r!="boolean")throw new TypeError(`[markdown-explorer] ${n} must be a boolean; got ${V.describeValue(r)}`)}Es("hostChangePolicy",e.hostChangePolicy,cr);const{paletteKey:t}=e;if(t!==void 0){if(typeof t!="string")throw new TypeError(`[markdown-explorer] paletteKey must be a non-empty string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] paletteKey must be a non-empty string; got an empty string")}},Ut=(e,t)=>{if(!Array.isArray(t))throw new TypeError(`[markdown-explorer] ${e} must be an array of strings; got ${V.describeValue(t)}`);for(const n of t){if(typeof n!="string")throw new TypeError(`[markdown-explorer] ${e} must hold strings only; got ${V.describeValue(n)}`);if(n==="")throw new RangeError(`[markdown-explorer] ${e} must hold non-empty strings; got an empty string`)}},xs=(e,t)=>{Ut(`${e}'s paths`,t)},bs=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] a host change must be a plain object; got ${V.describeValue(e)}`);Ut("a host change's sourceIds",e.sourceIds),Ut("a host change's paths",e.paths)},En=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes ${e} as a string; got ${V.describeValue(t)}`);if(t.includes("\r"))throw new RangeError(`[markdown-explorer] restoreDrafts takes ${e} with its lines ending in "\\n" alone; got a text with "\\r"`)},ks=e=>{if(!Array.isArray(e))throw new TypeError(`[markdown-explorer] restoreDrafts takes an array of drafts; got ${V.describeValue(e)}`);const t=new Set;for(const n of e){if(!V.isPlainObject(n))throw new TypeError(`[markdown-explorer] restoreDrafts takes each draft as a plain object; got ${V.describeValue(n)}`);const{path:r,base:o,lineEnding:s}=n;if(typeof r!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's path as a string; got ${V.describeValue(r)}`);if(r==="")throw new RangeError("[markdown-explorer] restoreDrafts takes non-empty paths; got an empty string");if(t.has(r))throw new RangeError(`[markdown-explorer] restoreDrafts takes one draft per path; got ${V.describeValue(r)} twice`);if(t.add(r),!V.isPlainObject(o))throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's base as a plain object; got ${V.describeValue(o)}`);if(En("base.text",o.text),o.version!==null&&typeof o.version!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes base.version as a string or null; got ${V.describeValue(o.version)}`);if(En("draft",n.draft),!ws.includes(s))throw new RangeError(`[markdown-explorer] restoreDrafts takes lineEnding as "\\n" or "\\r\\n"; got ${V.describeValue(s)}`)}},Ss=e=>{if(typeof e!="string")throw new TypeError(`[markdown-explorer] announce takes a string; got ${V.describeValue(e)}`);if(e==="")throw new RangeError("[markdown-explorer] announce takes a non-empty string; got an empty string")},Ts=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] reportMediaFailure takes a plain object; got ${V.describeValue(e)}`);const{url:t,final:n}=e;if(typeof t!="string")throw new TypeError(`[markdown-explorer] reportMediaFailure takes url as a string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] reportMediaFailure takes a non-empty url; got an empty string");if(typeof n!="boolean")throw new TypeError(`[markdown-explorer] reportMediaFailure takes final as a boolean; got ${V.describeValue(n)}`)},Vt=Object.freeze(["en","ja"]),dr="en",Jt=e=>`viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,ur=Object.freeze(Object.keys(De.SPREADSHEET_BLOCK_LABEL_CATALOGS.en)),fr=e=>Object.fromEntries(ur.map(t=>[Jt(t),De.SPREADSHEET_BLOCK_LABEL_CATALOGS[e][t].text])),mr=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"]),panelGroupMinimumExceededDetail:Object.freeze(["required","available"]),panelGroupMaximumInsufficientDetail:Object.freeze(["total","needed"]),viewerSvgImageSourceRegion:Object.freeze(["name"]),viewerSvgImageFullscreenDialog:Object.freeze(["name"]),...Object.fromEntries(ur.filter(e=>De.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e].length>0).map(e=>[Jt(e),De.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e]]))}),Rs=/\{(\w+)\}|[{}]/gu,hr={...fr("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}`,documentMaximize:"Maximize the document",documentRestore:"Restore the document to its size",documentMaximized:e=>`Maximized ${e}`,documentRestored:e=>`Restored ${e} to its size`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,documentReloadedAfterChange:e=>`Reloaded ${e}, which changed elsewhere`,documentChangedElsewhere:e=>`${e} changed elsewhere`,reload:"Reload",mediaLoadFailed:e=>`Could not load ${e}`,mediaLoadFailedCount:e=>`Could not load ${e} media files`,mediaUnplayable:e=>`Cannot play ${e}`,mediaUnplayableCount:e=>`Cannot play ${e} media files`,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",unversionedSaveTitle:"Save without keeping the previous version?",unversionedSaveBody:"This source does not keep previous versions. Once saved, the previous content cannot be restored.",unversionedSaveConfirm:"Save",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",settingShowFolderReadme:"Show folder READMEs",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.",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",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",copyPermalinkLabel:"Permalink",copyPermalink:"Copy permalink",copyPermalinkNamed:e=>`Copy the permalink of ${e}`,permalinkCopied:e=>`Copied the permalink (${e})`,permalinkCopyFailed:e=>`Could not copy the permalink: ${e}`,permalinkClipboardRefused:"The browser did not allow the copy",documentIdFailedTitle:"This link's document cannot be opened",documentIdInvalid:"The link's ID is not valid. Check how it was copied.",documentIdNotFound:"No document has this ID. It may have been moved or removed.",documentIdForbidden:"You cannot open this link's document.",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",viewerSelectStyle:"Display options",viewerPinStyle:"Pin display options",viewerUnpinStyle:"Unpin display options",viewerStyleSectionTitle:"Style",viewerMeasureTitle:"Width",viewerColorsTitle:"Colors",viewerMeasureFill:"Full width",viewerMeasureReading:"Reading width",viewerColorsDefault:"Document colors",viewerColorsSepia:"Sepia",viewerColorsDarkLowGlare:"Dark, low glare",viewerColorsHighContrast:"High contrast",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",viewerMermaidFullscreen:"View full screen",viewerMermaidExitFullscreen:"Exit full screen",viewerMermaidFullscreenDialog:"Diagram (full screen)",viewerMermaidDiagram:"Diagram (arrow keys pan, + and - zoom, 0 resets)",viewerMermaidRetry:"Try again",viewerMermaidLoading:"Loading diagram...",viewerMermaidInitializationFailed:"Mermaid failed to initialize globally.",viewerMermaidRenderFailed:"An unknown error occurred while rendering the diagram.",viewerMermaidEmptyDrawing:"Failed to render Mermaid diagram: SVG content is empty or invalid.",viewerMermaidSource:"Source",viewerMermaidSourceRegion:"Diagram source",viewerMermaidCopySource:"Copy the source",viewerMermaidCopiedSource:"Copied the source.",viewerMermaidCopySourceFailed:"Could not copy the source.",viewerMermaidTypeC4:"C4 diagram",viewerMermaidTypeFlowchart:"Flowchart",viewerMermaidTypeSwimlane:"Swimlane diagram",viewerMermaidTypeEntityRelationship:"Entity relationship diagram",viewerMermaidTypeGitGraph:"Git graph",viewerMermaidTypeGantt:"Gantt chart",viewerMermaidTypeInfo:"Mermaid information",viewerMermaidTypePie:"Pie chart",viewerMermaidTypeQuadrantChart:"Quadrant chart",viewerMermaidTypeXyChart:"XY chart",viewerMermaidTypeRequirement:"Requirement diagram",viewerMermaidTypeSequence:"Sequence diagram",viewerMermaidTypeClass:"Class diagram",viewerMermaidTypeState:"State diagram",viewerMermaidTypeJourney:"User journey",viewerMermaidTypeTimeline:"Timeline",viewerMermaidTypeMindmap:"Mind map",viewerMermaidTypeKanban:"Kanban board",viewerMermaidTypeSankey:"Sankey diagram",viewerMermaidTypePacket:"Packet diagram",viewerMermaidTypeRadar:"Radar chart",viewerMermaidTypeBlock:"Block diagram",viewerMermaidTypeTreeView:"Tree view",viewerMermaidTypeArchitecture:"Architecture diagram",viewerMermaidTypeEventModeling:"Event modeling diagram",viewerMermaidTypeIshikawa:"Ishikawa diagram",viewerMermaidTypeVenn:"Venn diagram",viewerMermaidTypeTreemap:"Treemap",viewerMermaidTypeWardley:"Wardley map",viewerMermaidTypeCynefin:"Cynefin diagram",viewerMermaidTypeRailroad:"Railroad diagram",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.",viewerSvgImageFullscreen:"View full screen",viewerSvgImageExitFullscreen:"Exit full screen",viewerSvgImageFullscreenDialog:"{name} (full screen)",viewerCodeBlockCopy:"Copy the code",viewerCodeBlockCopied:"Copied the code.",viewerCodeBlockCopyFailed:"Could not copy the code.",viewerDisplayMathCopy:"Copy the formula",viewerDisplayMathCopied:"Copied the formula.",viewerDisplayMathCopyFailed:"Could not copy the formula.",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",panelMoreActions:"More actions",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",panelGroupMinimumExceededSummary:"Layout unavailable: minimum panel sizes exceed the container.",panelGroupMinimumExceededDetail:"Min required: {required}px | Available: {available}px",panelGroupMaximumInsufficientSummary:"Layout unavailable: panels cannot fill the container with their maximum sizes.",panelGroupMaximumInsufficientDetail:"Max total: {total}px | Needed: {needed}px"},Cs={...fr("ja"),explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentMaximize:"文書を最大化",documentRestore:"文書を元のサイズに戻す",documentMaximized:e=>`${e} を最大化しました`,documentRestored:e=>`${e} を元のサイズに戻しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,documentReloadedAfterChange:e=>`ほかで変更された ${e} を読み込み直しました`,documentChangedElsewhere:e=>`${e} はほかで変更されました`,reload:"読み込み直す",mediaLoadFailed:e=>`${e} を読み込めませんでした`,mediaLoadFailedCount:e=>`${e} 個の媒体を読み込めませんでした`,mediaUnplayable:e=>`${e} を再生できません`,mediaUnplayableCount: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:"編集を続ける",unversionedSaveTitle:"前の版を残さずに保存しますか?",unversionedSaveBody:"この保存先は前の版を残しません。保存すると前の内容へ戻せません。",unversionedSaveConfirm:"保存する",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:"開いた文書をツリーで表示",settingShowFolderReadme:"フォルダーの README を表示",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:"リンク先がソースの外にあるため開けません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",copyPermalinkLabel:"固定リンク",copyPermalink:"固定リンクをコピー",copyPermalinkNamed:e=>`${e} の固定リンクをコピー`,permalinkCopied:e=>`固定リンクをコピーしました (${e})`,permalinkCopyFailed:e=>`固定リンクをコピーできませんでした: ${e}`,permalinkClipboardRefused:"ブラウザがコピーを許しませんでした",documentIdFailedTitle:"このリンクの文書を開けません",documentIdInvalid:"リンクの ID が正しくありません。書き写した ID を確かめてください。",documentIdNotFound:"この ID の文書はありません。移されたか消された可能性があります。",documentIdForbidden:"このリンクの文書を開く権限がありません。",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:"表示の設定のピン留めを解除",viewerStyleSectionTitle:"スタイル",viewerMeasureTitle:"幅",viewerColorsTitle:"配色",viewerMeasureFill:"全幅",viewerMeasureReading:"読みやすい幅",viewerColorsDefault:"文書の配色",viewerColorsSepia:"セピア",viewerColorsDarkLowGlare:"ダーク (まぶしさ控えめ)",viewerColorsHighContrast:"高コントラスト",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:"右へ移動",viewerMermaidFullscreen:"全画面で見る",viewerMermaidExitFullscreen:"全画面を閉じる",viewerMermaidFullscreenDialog:"図 (全画面)",viewerMermaidDiagram:"図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",viewerMermaidRetry:"再試行",viewerMermaidLoading:"図を読み込み中...",viewerMermaidInitializationFailed:"Mermaid を初期化できませんでした。",viewerMermaidRenderFailed:"図の描画中に不明なエラーが発生しました。",viewerMermaidEmptyDrawing:"Mermaid の図を描画できませんでした: SVG の内容が空か不正です。",viewerMermaidSource:"ソース",viewerMermaidSourceRegion:"図のソース",viewerMermaidCopySource:"ソースをコピー",viewerMermaidCopiedSource:"ソースをコピーしました。",viewerMermaidCopySourceFailed:"ソースをコピーできませんでした。",viewerMermaidTypeC4:"C4 の図",viewerMermaidTypeFlowchart:"流れ図",viewerMermaidTypeSwimlane:"スイムレーンの図",viewerMermaidTypeEntityRelationship:"実体関連図",viewerMermaidTypeGitGraph:"Git のグラフ",viewerMermaidTypeGantt:"ガントチャート",viewerMermaidTypeInfo:"Mermaid の情報の図",viewerMermaidTypePie:"円グラフ",viewerMermaidTypeQuadrantChart:"四象限の図",viewerMermaidTypeXyChart:"XY のグラフ",viewerMermaidTypeRequirement:"要求図",viewerMermaidTypeSequence:"シーケンス図",viewerMermaidTypeClass:"クラス図",viewerMermaidTypeState:"状態図",viewerMermaidTypeJourney:"ユーザージャーニーの図",viewerMermaidTypeTimeline:"年表",viewerMermaidTypeMindmap:"マインドマップ",viewerMermaidTypeKanban:"カンバンのボード",viewerMermaidTypeSankey:"サンキー図",viewerMermaidTypePacket:"パケットの図",viewerMermaidTypeRadar:"レーダーチャート",viewerMermaidTypeBlock:"ブロック図",viewerMermaidTypeTreeView:"ツリーの表示",viewerMermaidTypeArchitecture:"アーキテクチャ図",viewerMermaidTypeEventModeling:"イベントモデリングの図",viewerMermaidTypeIshikawa:"特性要因図",viewerMermaidTypeVenn:"ベン図",viewerMermaidTypeTreemap:"ツリーマップ",viewerMermaidTypeWardley:"ワードリーマップ",viewerMermaidTypeCynefin:"クネビンの図",viewerMermaidTypeRailroad:"構文図",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",viewerBlockFailed:"このブロックを表示できませんでした。",viewerSvgImageToolbar:"SVG の画像",viewerSvgImageSource:"ソース",viewerSvgImageSourceRegion:"{name} のソース",viewerSvgImageLoading:"ソースを読み込み中…",viewerSvgImageFailed:"ソースを読み込めませんでした。",viewerSvgImageRetry:"再試行",viewerSvgImageTruncated:"このファイルは先頭だけを表示しています。",viewerSvgImageCopy:"ソースをコピー",viewerSvgImageCopied:"ソースをコピーしました。",viewerSvgImageCopyFailed:"ソースをコピーできませんでした。",viewerSvgImageCopyImage:"画像をコピー",viewerSvgImageCopiedImage:"画像をコピーしました。",viewerSvgImageCopyImageFailed:"画像をコピーできませんでした。",viewerSvgImageFullscreen:"全画面で見る",viewerSvgImageExitFullscreen:"全画面を閉じる",viewerSvgImageFullscreenDialog:"{name} (全画面)",viewerCodeBlockCopy:"コードをコピー",viewerCodeBlockCopied:"コードをコピーしました。",viewerCodeBlockCopyFailed:"コードをコピーできませんでした。",viewerDisplayMathCopy:"数式をコピー",viewerDisplayMathCopied:"数式をコピーしました。",viewerDisplayMathCopyFailed:"数式をコピーできませんでした。",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:"下へ移動",panelMoreActions:"その他の操作",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ",panelGroupMinimumExceededSummary:"レイアウトを表示できません: パネルの最小の大きさの合計が枠を超えています。",panelGroupMinimumExceededDetail:"必要な最小: {required}px | 使える長さ: {available}px",panelGroupMaximumInsufficientSummary:"レイアウトを表示できません: パネルを最大の大きさにしても枠を満たせません。",panelGroupMaximumInsufficientDetail:"最大の合計: {total}px | 必要な長さ: {needed}px"},pr=Object.freeze({en:Object.freeze(hr),ja:Object.freeze(Cs)}),en=Object.freeze(Object.keys(hr)),Ms=new Set(en),Ls=e=>Ms.has(e),wr=e=>{if(e===void 0)return dr;if(Vt.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${Vt.map(V.describeValue).join(" or ")}), not a BCP 47 tag; got ${V.describeValue(e)}`)},zt=(e,t)=>{const n=pr[wr(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${V.describeValue(t)}`);if(!V.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${V.describeValue(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!Ls(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${en.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 ${V.describeValue(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const m=mr[s];if(typeof a=="string"&&m!==void 0){const p=m.map(g=>`{${g}}`).join(", ");for(const g of a.matchAll(Rs)){const f=g[1];if(f===void 0)throw new RangeError(`[markdown-explorer] labels.${s} holds a brace outside a placeholder at index ${String(g.index)}; it accepts ${p}, and no other braces`);if(!m.includes(f))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${f}}; it accepts ${p}`)}}o[s]=a}return Object.freeze(o)},Os=(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"]),As=e=>{if(e===void 0)return"light";if(Gt.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Gt.map(V.describeValue).join(" or ")}; got ${V.describeValue(e)}`)},yn=Object.freeze({guardUnload:!0,confirmUnversionedSaves:!1}),gr=l.createContext(null),F=()=>{const e=l.use(gr);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},ye=e=>{const{viewSettings:t}=F(),n=()=>e(t.getSnapshot());return l.useSyncExternalStore(t.subscribe,n,n)},Ge=()=>{const{config:e}=F(),t=re.useParams()["*"],[n]=re.useSearchParams(),r=n.toString();return l.useMemo(()=>z.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Ds=()=>{const e=new Map,t=new Set,n=new Set,r=()=>{for(const s of[...n])s()},o=s=>{t.delete(s)&&r()};return{show:s=>{e.set(s,(e.get(s)??0)+1);let a=!1;return()=>{if(a)return;a=!0;const i=(e.get(s)??0)-1;if(i>0){e.set(s,i);return}e.delete(s),o(s)}},shown:s=>e.has(s),mark:s=>{const a=s.filter(i=>e.has(i)&&!t.has(i));for(const i of a)t.add(i);a.length>0&&r()},changed:s=>t.has(s),dismiss:o,subscribe:s=>(n.add(s),()=>{n.delete(s)})}},Ns=2,js=1,Ps=2,_s=3,Is=4,xn=Object.freeze(["error","loadstart","progress","stalled"]),Zt=Object.freeze({marked:!1,final:!1,stalled:!1,progress:0,error:null}),it=Object.freeze([]),Fs=e=>e.marked&&e.progress<=Ns&&(e.final||e.stalled),$s=(e,t)=>e===js?null:t||e===Ps?"media-load":e===_s||e===Is?"media-unplayable":null,qs=(e,t)=>{switch(t.kind){case"report":return{...e,marked:!0,final:t.final,progress:0,error:e.error===null?null:"media-load"};case"stalled":return{...e,stalled:!0};case"progress":return{...e,stalled:!1,progress:e.progress+1};case"loadstart":return Zt;case"error":{const n=$s(t.code,e.marked);return n===null?e:{...e,error:n}}case"source-error":return{...e,error:e.marked?"media-load":"media-unplayable"}}},Bs=e=>e.error==="media-load"||Fs(e)?"media-load":e.error,bn=(e,t,n)=>{if(e===""||t===""||!URL.canParse(e,n)||!URL.canParse(t,n))return!1;const r=new URL(e,n),o=new URL(t,n);return r.hash="",o.hash="",r.href===o.href},Hs=(e,t)=>{if(!URL.canParse(e,t))return e;const n=new URL(e,t),r=n.searchParams.get(P.EXPLORER_DATA_QUERY.path);return P.lastPathSegment(r===null?n.pathname:r)},Us=e=>{for(let t=e.nextElementSibling;t!==null;t=t.nextElementSibling)if(t instanceof HTMLSourceElement)return!1;return!0},Vs=e=>{const{target:t,type:n}=e;if(t instanceof HTMLSourceElement){const r=t.parentElement;return n==="error"&&r instanceof HTMLMediaElement&&Us(t)?{element:r,arrival:{kind:"source-error"},url:t.src}:null}return t instanceof HTMLMediaElement?n==="error"?{element:t,arrival:{kind:"error",code:t.error===null?null:t.error.code},url:t.currentSrc}:n==="stalled"||n==="progress"||n==="loadstart"?{element:t,arrival:{kind:n},url:t.currentSrc}:null:null},zs=()=>{const e=new WeakMap,t=new Map,n=new Map,r=new WeakMap,o=new Map,s=new Set;let a=it,i=null;const m=(h,v,E)=>{if(v===null){o.delete(h);return}o.get(h)?.kind!==v&&o.set(h,{kind:v,target:h,url:E,name:Hs(E,document.baseURI)})},p=h=>{for(const x of[...o.keys()])x.isConnected||o.delete(x);const v=[...o.values()],E=v.length===a.length&&v.every((x,b)=>x===a[b]);if(E||(a=Object.freeze(v)),!(E&&!h))for(const x of[...s])x()},g=(h,v,E)=>{const x=qs(e.get(h)??Zt,v);e.set(h,x),m(h,Bs(x),E)},f=h=>{const v=Vs(h);v!==null&&(g(v.element,v.arrival,v.url),p(!1))},w=h=>{const v=h.ended?0:h.currentTime,E=!h.paused,x=r.get(h);x!==void 0&&h.removeEventListener("loadedmetadata",x);const b=()=>{r.delete(h),h.currentTime=v,E&&h.play().catch(()=>{})};r.set(h,b),h.addEventListener("loadedmetadata",b,{once:!0}),h.load()};return{observe:h=>{i=h;for(const v of xn)h.addEventListener(v,f,!0);return()=>{for(const v of xn)h.removeEventListener(v,f,!0);i===h&&(i=null)}},report:h=>{const v=document.baseURI;if(i!==null)for(const E of i.querySelectorAll("video, audio"))bn(E.currentSrc,h.url,v)&&g(E,{kind:"report",final:h.final},E.currentSrc);for(const[E,x]of t)bn(x,h.url,v)&&m(E,"media-load",x);p(!1)},registerPdfFrame:(h,v)=>(t.set(v,h),()=>{t.delete(v),o.delete(v),p(!1)}),pdfGeneration:h=>n.get(h)??0,subscribe:h=>(s.add(h),()=>{s.delete(h)}),notices:()=>a,reload:h=>{let v=!1;for(const E of[...o.values()])E.kind!=="media-load"||!h.contains(E.target)||(o.delete(E.target),E.target instanceof HTMLIFrameElement?(n.set(E.url,(n.get(E.url)??0)+1),v=!0):(e.set(E.target,Zt),w(E.target)));p(v)}}},Gs=Object.freeze({unauthorized:"unauthenticated",forbidden:"forbidden"}),ie=e=>e==="unauthorized"||e==="forbidden",Zs=(e,t,n,r)=>{const o=l.useRef(r);l.useLayoutEffect(()=>{o.current=r});const s=r!==null;return l.useMemo(()=>{const{reason:a}=e;if(!ie(a))throw new TypeError(`[markdown-explorer] the failure ${a} is the explorer's own, not an access failure for the host's presenter`);const i=Gs[a],m=Object.freeze({kind:i,place:t,deniedSentence:i==="forbidden"?n:null,retry:s?()=>o.current?.():null});return Object.freeze({occurrence:m,reason:a})},[e,t,n,s])},Ws=Object.freeze([]),Ks=()=>{let e=Ws,t=0;const n=new Set,r=o=>{e=Object.freeze(o);for(const s of[...n])s()};return Object.freeze({hold:o=>{t+=1;const s=Object.freeze({...o,key:t});return r([...e,s]),()=>{e.includes(s)&&r(e.filter(a=>a!==s))}},subscribe:o=>(n.add(o),()=>{n.delete(o)}),held:()=>e})},vr=l.createContext(null),Er=l.createContext(null),yr=({reason:e,testId:t,children:n})=>t===null?n:c.jsx("div",{className:"aqmx-access-failure","data-testid":t,"data-aqmx-failure":e,children:n}),Ze=({failure:e,place:t,deniedSentence:n,retry:r,testId:o})=>{const{accessFailure:s}=F(),a=Zs(e,t,n,r),i=l.use(vr);return l.useLayoutEffect(()=>i===null?void 0:i.hold({access:a,testId:o}),[i,a,o]),i!==null?null:c.jsx(yr,{reason:a.reason,testId:o,children:s(a.occurrence)})},Xs=()=>{const e=l.use(Er);return e===null?null:c.jsx(Ys,{sheet:e})},Ys=({sheet:e})=>{const{accessFailure:t}=F(),n=l.useSyncExternalStore(e.subscribe,e.held,e.held);return n.length===0?null:c.jsx("div",{className:"aqmx-sheet-access-failures","data-testid":"markdown-explorer-sheet-access-failures",children:n.map(r=>c.jsx(yr,{reason:r.access.reason,testId:r.testId,children:t(r.access.occurrence)},r.key))})},xr={"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},ce=(e,t)=>e[xr[t][0]],xe=({failure:e,alert:t,onRetry:n,testId:r,text:o,deniedSentence:s})=>{const{reason:a}=e;return ie(a)?c.jsx(Ze,{failure:e,place:"read",deniedSentence:s??null,retry:n??null,testId:r}):c.jsx(Qs,{failure:e,reason:a,alert:t,onRetry:n,testId:r,text:o})},Qs=({failure:e,reason:t,alert:n,onRetry:r,testId:o,text:s})=>{const{labels:a}=F(),i=s===void 0?ce(a,t):s.title,m=s===void 0?a[xr[t][1]]:s.body,p=t==="failed"?"danger":"warning";return c.jsxs("div",{className:"aqmx-callout",role:n?"alert":void 0,"data-aqmx-tone":p,"data-testid":o===null?void 0:o,"data-aqmx-failure":o===null?void 0:e.reason,children:[c.jsx("p",{className:"aqmx-callout-title",children:i}),c.jsx("p",{className:"aqmx-callout-body",children:m}),r!==void 0&&t==="failed"?c.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:r,children:a.retry}):null]})},Js=(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":{const{reason:s}=n.failure;return ie(s)?"":ce(e,s)}}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":{const{reason:s}=r.failure;if(!ie(s))return e.draftSaveFailed(ce(e,s));break}case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},ea=(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":{const{reason:r}=t.failure;return ie(r)?null:e.draftSaveFailed(ce(e,r))}case"idle":case"saving":return null}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},br="<<<<<<<",kr="=======",Sr=">>>>>>>",kn=(e,t)=>e===t||e.startsWith(`${t} `),Sn=e=>Tr(e.split(`
|
|
5
|
-
`)),
|
|
4
|
+
`]),vs=Object.freeze(["fetch","persistSettings","subscribeHostChanges","onDraftChange"]),Es=Object.freeze(["guardUnload","confirmUnversionedSaves"]),xs=(e,t,n)=>{if(!(t===void 0||typeof t=="string"&&n.includes(t)))throw new RangeError(`[markdown-explorer] ${e} must be ${n.map(V.describeValue).join(" or ")}; got ${V.describeValue(t)}`)},ys=e=>{if(typeof e.accessFailure!="function")throw new TypeError(`[markdown-explorer] accessFailure must be the host's access failure presenter (a function); got ${V.describeValue(e.accessFailure)}`);for(const n of vs){const r=e[n];if(r!==void 0&&typeof r!="function")throw new TypeError(`[markdown-explorer] ${n} must be a function; got ${V.describeValue(r)}`)}for(const n of Es){const r=e[n];if(r!==void 0&&typeof r!="boolean")throw new TypeError(`[markdown-explorer] ${n} must be a boolean; got ${V.describeValue(r)}`)}xs("hostChangePolicy",e.hostChangePolicy,dr);const{paletteKey:t}=e;if(t!==void 0){if(typeof t!="string")throw new TypeError(`[markdown-explorer] paletteKey must be a non-empty string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] paletteKey must be a non-empty string; got an empty string")}},Ut=(e,t)=>{if(!Array.isArray(t))throw new TypeError(`[markdown-explorer] ${e} must be an array of strings; got ${V.describeValue(t)}`);for(const n of t){if(typeof n!="string")throw new TypeError(`[markdown-explorer] ${e} must hold strings only; got ${V.describeValue(n)}`);if(n==="")throw new RangeError(`[markdown-explorer] ${e} must hold non-empty strings; got an empty string`)}},bs=(e,t)=>{Ut(`${e}'s paths`,t)},ks=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] a host change must be a plain object; got ${V.describeValue(e)}`);Ut("a host change's sourceIds",e.sourceIds),Ut("a host change's paths",e.paths)},En=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes ${e} as a string; got ${V.describeValue(t)}`);if(t.includes("\r"))throw new RangeError(`[markdown-explorer] restoreDrafts takes ${e} with its lines ending in "\\n" alone; got a text with "\\r"`)},Ss=e=>{if(!Array.isArray(e))throw new TypeError(`[markdown-explorer] restoreDrafts takes an array of drafts; got ${V.describeValue(e)}`);const t=new Set;for(const n of e){if(!V.isPlainObject(n))throw new TypeError(`[markdown-explorer] restoreDrafts takes each draft as a plain object; got ${V.describeValue(n)}`);const{path:r,base:o,lineEnding:s}=n;if(typeof r!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's path as a string; got ${V.describeValue(r)}`);if(r==="")throw new RangeError("[markdown-explorer] restoreDrafts takes non-empty paths; got an empty string");if(t.has(r))throw new RangeError(`[markdown-explorer] restoreDrafts takes one draft per path; got ${V.describeValue(r)} twice`);if(t.add(r),!V.isPlainObject(o))throw new TypeError(`[markdown-explorer] restoreDrafts takes a draft's base as a plain object; got ${V.describeValue(o)}`);if(En("base.text",o.text),o.version!==null&&typeof o.version!="string")throw new TypeError(`[markdown-explorer] restoreDrafts takes base.version as a string or null; got ${V.describeValue(o.version)}`);if(En("draft",n.draft),!gs.includes(s))throw new RangeError(`[markdown-explorer] restoreDrafts takes lineEnding as "\\n" or "\\r\\n"; got ${V.describeValue(s)}`)}},Ts=e=>{if(typeof e!="string")throw new TypeError(`[markdown-explorer] announce takes a string; got ${V.describeValue(e)}`);if(e==="")throw new RangeError("[markdown-explorer] announce takes a non-empty string; got an empty string")},Rs=e=>{if(!V.isPlainObject(e))throw new TypeError(`[markdown-explorer] reportMediaFailure takes a plain object; got ${V.describeValue(e)}`);const{url:t,final:n}=e;if(typeof t!="string")throw new TypeError(`[markdown-explorer] reportMediaFailure takes url as a string; got ${V.describeValue(t)}`);if(t==="")throw new RangeError("[markdown-explorer] reportMediaFailure takes a non-empty url; got an empty string");if(typeof n!="boolean")throw new TypeError(`[markdown-explorer] reportMediaFailure takes final as a boolean; got ${V.describeValue(n)}`)},Vt=Object.freeze(["en","ja"]),ur="en",Jt=e=>`viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,fr=Object.freeze(Object.keys(De.SPREADSHEET_BLOCK_LABEL_CATALOGS.en)),mr=e=>Object.fromEntries(fr.map(t=>[Jt(t),De.SPREADSHEET_BLOCK_LABEL_CATALOGS[e][t].text])),hr=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"]),panelGroupMinimumExceededDetail:Object.freeze(["required","available"]),panelGroupMaximumInsufficientDetail:Object.freeze(["total","needed"]),viewerSvgImageSourceRegion:Object.freeze(["name"]),viewerSvgImageFullscreenDialog:Object.freeze(["name"]),...Object.fromEntries(fr.filter(e=>De.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e].length>0).map(e=>[Jt(e),De.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e]]))}),Cs=/\{(\w+)\}|[{}]/gu,pr={...mr("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}`,documentMaximize:"Maximize the document",documentRestore:"Restore the document to its size",documentMaximized:e=>`Maximized ${e}`,documentRestored:e=>`Restored ${e} to its size`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,documentReloadedAfterChange:e=>`Reloaded ${e}, which changed elsewhere`,documentChangedElsewhere:e=>`${e} changed elsewhere`,reload:"Reload",mediaLoadFailed:e=>`Could not load ${e}`,mediaLoadFailedCount:e=>`Could not load ${e} media files`,mediaUnplayable:e=>`Cannot play ${e}`,mediaUnplayableCount:e=>`Cannot play ${e} media files`,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",unversionedSaveTitle:"Save without keeping the previous version?",unversionedSaveBody:"This source does not keep previous versions. Once saved, the previous content cannot be restored.",unversionedSaveConfirm:"Save",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",settingShowFolderReadme:"Show folder READMEs",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.",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",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",copyPermalinkLabel:"Permalink",copyPermalink:"Copy permalink",copyPermalinkNamed:e=>`Copy the permalink of ${e}`,permalinkCopied:e=>`Copied the permalink (${e})`,permalinkCopyFailed:e=>`Could not copy the permalink: ${e}`,permalinkClipboardRefused:"The browser did not allow the copy",documentIdFailedTitle:"This link's document cannot be opened",documentIdInvalid:"The link's ID is not valid. Check how it was copied.",documentIdNotFound:"No document has this ID. It may have been moved or removed.",documentIdForbidden:"You cannot open this link's document.",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",viewerSelectStyle:"Display options",viewerPinStyle:"Pin display options",viewerUnpinStyle:"Unpin display options",viewerStyleSectionTitle:"Style",viewerMeasureTitle:"Width",viewerColorsTitle:"Colors",viewerMeasureFill:"Full width",viewerMeasureReading:"Reading width",viewerColorsDefault:"Document colors",viewerColorsSepia:"Sepia",viewerColorsDarkLowGlare:"Dark, low glare",viewerColorsHighContrast:"High contrast",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",viewerMermaidFullscreen:"View full screen",viewerMermaidExitFullscreen:"Exit full screen",viewerMermaidFullscreenDialog:"Diagram (full screen)",viewerMermaidDiagram:"Diagram (arrow keys pan, + and - zoom, 0 resets)",viewerMermaidRetry:"Try again",viewerMermaidLoading:"Loading diagram...",viewerMermaidInitializationFailed:"Mermaid failed to initialize globally.",viewerMermaidRenderFailed:"An unknown error occurred while rendering the diagram.",viewerMermaidEmptyDrawing:"Failed to render Mermaid diagram: SVG content is empty or invalid.",viewerMermaidSource:"Source",viewerMermaidSourceRegion:"Diagram source",viewerMermaidCopySource:"Copy the source",viewerMermaidCopiedSource:"Copied the source.",viewerMermaidCopySourceFailed:"Could not copy the source.",viewerMermaidTypeC4:"C4 diagram",viewerMermaidTypeFlowchart:"Flowchart",viewerMermaidTypeSwimlane:"Swimlane diagram",viewerMermaidTypeEntityRelationship:"Entity relationship diagram",viewerMermaidTypeGitGraph:"Git graph",viewerMermaidTypeGantt:"Gantt chart",viewerMermaidTypeInfo:"Mermaid information",viewerMermaidTypePie:"Pie chart",viewerMermaidTypeQuadrantChart:"Quadrant chart",viewerMermaidTypeXyChart:"XY chart",viewerMermaidTypeRequirement:"Requirement diagram",viewerMermaidTypeSequence:"Sequence diagram",viewerMermaidTypeClass:"Class diagram",viewerMermaidTypeState:"State diagram",viewerMermaidTypeJourney:"User journey",viewerMermaidTypeTimeline:"Timeline",viewerMermaidTypeMindmap:"Mind map",viewerMermaidTypeKanban:"Kanban board",viewerMermaidTypeSankey:"Sankey diagram",viewerMermaidTypePacket:"Packet diagram",viewerMermaidTypeRadar:"Radar chart",viewerMermaidTypeBlock:"Block diagram",viewerMermaidTypeTreeView:"Tree view",viewerMermaidTypeArchitecture:"Architecture diagram",viewerMermaidTypeEventModeling:"Event modeling diagram",viewerMermaidTypeIshikawa:"Ishikawa diagram",viewerMermaidTypeVenn:"Venn diagram",viewerMermaidTypeTreemap:"Treemap",viewerMermaidTypeWardley:"Wardley map",viewerMermaidTypeCynefin:"Cynefin diagram",viewerMermaidTypeRailroad:"Railroad diagram",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.",viewerSvgImageFullscreen:"View full screen",viewerSvgImageExitFullscreen:"Exit full screen",viewerSvgImageFullscreenDialog:"{name} (full screen)",viewerCodeBlockCopy:"Copy the code",viewerCodeBlockCopied:"Copied the code.",viewerCodeBlockCopyFailed:"Could not copy the code.",viewerDisplayMathCopy:"Copy the formula",viewerDisplayMathCopied:"Copied the formula.",viewerDisplayMathCopyFailed:"Could not copy the formula.",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",panelMoreActions:"More actions",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",panelGroupMinimumExceededSummary:"Layout unavailable: minimum panel sizes exceed the container.",panelGroupMinimumExceededDetail:"Min required: {required}px | Available: {available}px",panelGroupMaximumInsufficientSummary:"Layout unavailable: panels cannot fill the container with their maximum sizes.",panelGroupMaximumInsufficientDetail:"Max total: {total}px | Needed: {needed}px"},Ms={...mr("ja"),explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentMaximize:"文書を最大化",documentRestore:"文書を元のサイズに戻す",documentMaximized:e=>`${e} を最大化しました`,documentRestored:e=>`${e} を元のサイズに戻しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,documentReloadedAfterChange:e=>`ほかで変更された ${e} を読み込み直しました`,documentChangedElsewhere:e=>`${e} はほかで変更されました`,reload:"読み込み直す",mediaLoadFailed:e=>`${e} を読み込めませんでした`,mediaLoadFailedCount:e=>`${e} 個の媒体を読み込めませんでした`,mediaUnplayable:e=>`${e} を再生できません`,mediaUnplayableCount: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:"編集を続ける",unversionedSaveTitle:"前の版を残さずに保存しますか?",unversionedSaveBody:"この保存先は前の版を残しません。保存すると前の内容へ戻せません。",unversionedSaveConfirm:"保存する",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:"開いた文書をツリーで表示",settingShowFolderReadme:"フォルダーの README を表示",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:"リンク先がソースの外にあるため開けません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",copyPermalinkLabel:"固定リンク",copyPermalink:"固定リンクをコピー",copyPermalinkNamed:e=>`${e} の固定リンクをコピー`,permalinkCopied:e=>`固定リンクをコピーしました (${e})`,permalinkCopyFailed:e=>`固定リンクをコピーできませんでした: ${e}`,permalinkClipboardRefused:"ブラウザがコピーを許しませんでした",documentIdFailedTitle:"このリンクの文書を開けません",documentIdInvalid:"リンクの ID が正しくありません。書き写した ID を確かめてください。",documentIdNotFound:"この ID の文書はありません。移されたか消された可能性があります。",documentIdForbidden:"このリンクの文書を開く権限がありません。",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:"表示の設定のピン留めを解除",viewerStyleSectionTitle:"スタイル",viewerMeasureTitle:"幅",viewerColorsTitle:"配色",viewerMeasureFill:"全幅",viewerMeasureReading:"読みやすい幅",viewerColorsDefault:"文書の配色",viewerColorsSepia:"セピア",viewerColorsDarkLowGlare:"ダーク (まぶしさ控えめ)",viewerColorsHighContrast:"高コントラスト",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:"右へ移動",viewerMermaidFullscreen:"全画面で見る",viewerMermaidExitFullscreen:"全画面を閉じる",viewerMermaidFullscreenDialog:"図 (全画面)",viewerMermaidDiagram:"図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",viewerMermaidRetry:"再試行",viewerMermaidLoading:"図を読み込み中...",viewerMermaidInitializationFailed:"Mermaid を初期化できませんでした。",viewerMermaidRenderFailed:"図の描画中に不明なエラーが発生しました。",viewerMermaidEmptyDrawing:"Mermaid の図を描画できませんでした: SVG の内容が空か不正です。",viewerMermaidSource:"ソース",viewerMermaidSourceRegion:"図のソース",viewerMermaidCopySource:"ソースをコピー",viewerMermaidCopiedSource:"ソースをコピーしました。",viewerMermaidCopySourceFailed:"ソースをコピーできませんでした。",viewerMermaidTypeC4:"C4 の図",viewerMermaidTypeFlowchart:"流れ図",viewerMermaidTypeSwimlane:"スイムレーンの図",viewerMermaidTypeEntityRelationship:"実体関連図",viewerMermaidTypeGitGraph:"Git のグラフ",viewerMermaidTypeGantt:"ガントチャート",viewerMermaidTypeInfo:"Mermaid の情報の図",viewerMermaidTypePie:"円グラフ",viewerMermaidTypeQuadrantChart:"四象限の図",viewerMermaidTypeXyChart:"XY のグラフ",viewerMermaidTypeRequirement:"要求図",viewerMermaidTypeSequence:"シーケンス図",viewerMermaidTypeClass:"クラス図",viewerMermaidTypeState:"状態図",viewerMermaidTypeJourney:"ユーザージャーニーの図",viewerMermaidTypeTimeline:"年表",viewerMermaidTypeMindmap:"マインドマップ",viewerMermaidTypeKanban:"カンバンのボード",viewerMermaidTypeSankey:"サンキー図",viewerMermaidTypePacket:"パケットの図",viewerMermaidTypeRadar:"レーダーチャート",viewerMermaidTypeBlock:"ブロック図",viewerMermaidTypeTreeView:"ツリーの表示",viewerMermaidTypeArchitecture:"アーキテクチャ図",viewerMermaidTypeEventModeling:"イベントモデリングの図",viewerMermaidTypeIshikawa:"特性要因図",viewerMermaidTypeVenn:"ベン図",viewerMermaidTypeTreemap:"ツリーマップ",viewerMermaidTypeWardley:"ワードリーマップ",viewerMermaidTypeCynefin:"クネビンの図",viewerMermaidTypeRailroad:"構文図",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",viewerBlockFailed:"このブロックを表示できませんでした。",viewerSvgImageToolbar:"SVG の画像",viewerSvgImageSource:"ソース",viewerSvgImageSourceRegion:"{name} のソース",viewerSvgImageLoading:"ソースを読み込み中…",viewerSvgImageFailed:"ソースを読み込めませんでした。",viewerSvgImageRetry:"再試行",viewerSvgImageTruncated:"このファイルは先頭だけを表示しています。",viewerSvgImageCopy:"ソースをコピー",viewerSvgImageCopied:"ソースをコピーしました。",viewerSvgImageCopyFailed:"ソースをコピーできませんでした。",viewerSvgImageCopyImage:"画像をコピー",viewerSvgImageCopiedImage:"画像をコピーしました。",viewerSvgImageCopyImageFailed:"画像をコピーできませんでした。",viewerSvgImageFullscreen:"全画面で見る",viewerSvgImageExitFullscreen:"全画面を閉じる",viewerSvgImageFullscreenDialog:"{name} (全画面)",viewerCodeBlockCopy:"コードをコピー",viewerCodeBlockCopied:"コードをコピーしました。",viewerCodeBlockCopyFailed:"コードをコピーできませんでした。",viewerDisplayMathCopy:"数式をコピー",viewerDisplayMathCopied:"数式をコピーしました。",viewerDisplayMathCopyFailed:"数式をコピーできませんでした。",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:"下へ移動",panelMoreActions:"その他の操作",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ",panelGroupMinimumExceededSummary:"レイアウトを表示できません: パネルの最小の大きさの合計が枠を超えています。",panelGroupMinimumExceededDetail:"必要な最小: {required}px | 使える長さ: {available}px",panelGroupMaximumInsufficientSummary:"レイアウトを表示できません: パネルを最大の大きさにしても枠を満たせません。",panelGroupMaximumInsufficientDetail:"最大の合計: {total}px | 必要な長さ: {needed}px"},wr=Object.freeze({en:Object.freeze(pr),ja:Object.freeze(Ms)}),en=Object.freeze(Object.keys(pr)),Ls=new Set(en),Os=e=>Ls.has(e),gr=e=>{if(e===void 0)return ur;if(Vt.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${Vt.map(V.describeValue).join(" or ")}), not a BCP 47 tag; got ${V.describeValue(e)}`)},zt=(e,t)=>{const n=wr[gr(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${V.describeValue(t)}`);if(!V.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${V.describeValue(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!Os(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${en.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 ${V.describeValue(a)}`);if(typeof a=="string"&&a.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const m=hr[s];if(typeof a=="string"&&m!==void 0){const p=m.map(g=>`{${g}}`).join(", ");for(const g of a.matchAll(Cs)){const f=g[1];if(f===void 0)throw new RangeError(`[markdown-explorer] labels.${s} holds a brace outside a placeholder at index ${String(g.index)}; it accepts ${p}, and no other braces`);if(!m.includes(f))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${f}}; it accepts ${p}`)}}o[s]=a}return Object.freeze(o)},As=(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"]),Ds=e=>{if(e===void 0)return"light";if(Gt.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Gt.map(V.describeValue).join(" or ")}; got ${V.describeValue(e)}`)},xn=Object.freeze({guardUnload:!0,confirmUnversionedSaves:!1}),vr=l.createContext(null),F=()=>{const e=l.use(vr);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},xe=e=>{const{viewSettings:t}=F(),n=()=>e(t.getSnapshot());return l.useSyncExternalStore(t.subscribe,n,n)},Ge=()=>{const{config:e}=F(),t=re.useParams()["*"],[n]=re.useSearchParams(),r=n.toString();return l.useMemo(()=>z.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Ns=()=>{const e=new Map,t=new Set,n=new Set,r=()=>{for(const s of[...n])s()},o=s=>{t.delete(s)&&r()};return{show:s=>{e.set(s,(e.get(s)??0)+1);let a=!1;return()=>{if(a)return;a=!0;const i=(e.get(s)??0)-1;if(i>0){e.set(s,i);return}e.delete(s),o(s)}},shown:s=>e.has(s),mark:s=>{const a=s.filter(i=>e.has(i)&&!t.has(i));for(const i of a)t.add(i);a.length>0&&r()},changed:s=>t.has(s),dismiss:o,subscribe:s=>(n.add(s),()=>{n.delete(s)})}},js=2,Ps=1,_s=2,Is=3,Fs=4,yn=Object.freeze(["error","loadstart","progress","stalled"]),Zt=Object.freeze({marked:!1,final:!1,stalled:!1,progress:0,error:null}),it=Object.freeze([]),$s=e=>e.marked&&e.progress<=js&&(e.final||e.stalled),qs=(e,t)=>e===Ps?null:t||e===_s?"media-load":e===Is||e===Fs?"media-unplayable":null,Bs=(e,t)=>{switch(t.kind){case"report":return{...e,marked:!0,final:t.final,progress:0,error:e.error===null?null:"media-load"};case"stalled":return{...e,stalled:!0};case"progress":return{...e,stalled:!1,progress:e.progress+1};case"loadstart":return Zt;case"error":{const n=qs(t.code,e.marked);return n===null?e:{...e,error:n}}case"source-error":return{...e,error:e.marked?"media-load":"media-unplayable"}}},Hs=e=>e.error==="media-load"||$s(e)?"media-load":e.error,bn=(e,t,n)=>{if(e===""||t===""||!URL.canParse(e,n)||!URL.canParse(t,n))return!1;const r=new URL(e,n),o=new URL(t,n);return r.hash="",o.hash="",r.href===o.href},Us=(e,t)=>{if(!URL.canParse(e,t))return e;const n=new URL(e,t),r=n.searchParams.get(P.EXPLORER_DATA_QUERY.path);return P.lastPathSegment(r===null?n.pathname:r)},Vs=e=>{for(let t=e.nextElementSibling;t!==null;t=t.nextElementSibling)if(t instanceof HTMLSourceElement)return!1;return!0},zs=e=>{const{target:t,type:n}=e;if(t instanceof HTMLSourceElement){const r=t.parentElement;return n==="error"&&r instanceof HTMLMediaElement&&Vs(t)?{element:r,arrival:{kind:"source-error"},url:t.src}:null}return t instanceof HTMLMediaElement?n==="error"?{element:t,arrival:{kind:"error",code:t.error===null?null:t.error.code},url:t.currentSrc}:n==="stalled"||n==="progress"||n==="loadstart"?{element:t,arrival:{kind:n},url:t.currentSrc}:null:null},Gs=()=>{const e=new WeakMap,t=new Map,n=new Map,r=new WeakMap,o=new Map,s=new Set;let a=it,i=null;const m=(h,v,E)=>{if(v===null){o.delete(h);return}o.get(h)?.kind!==v&&o.set(h,{kind:v,target:h,url:E,name:Us(E,document.baseURI)})},p=h=>{for(const y of[...o.keys()])y.isConnected||o.delete(y);const v=[...o.values()],E=v.length===a.length&&v.every((y,b)=>y===a[b]);if(E||(a=Object.freeze(v)),!(E&&!h))for(const y of[...s])y()},g=(h,v,E)=>{const y=Bs(e.get(h)??Zt,v);e.set(h,y),m(h,Hs(y),E)},f=h=>{const v=zs(h);v!==null&&(g(v.element,v.arrival,v.url),p(!1))},w=h=>{const v=h.ended?0:h.currentTime,E=!h.paused,y=r.get(h);y!==void 0&&h.removeEventListener("loadedmetadata",y);const b=()=>{r.delete(h),h.currentTime=v,E&&h.play().catch(()=>{})};r.set(h,b),h.addEventListener("loadedmetadata",b,{once:!0}),h.load()};return{observe:h=>{i=h;for(const v of yn)h.addEventListener(v,f,!0);return()=>{for(const v of yn)h.removeEventListener(v,f,!0);i===h&&(i=null)}},report:h=>{const v=document.baseURI;if(i!==null)for(const E of i.querySelectorAll("video, audio"))bn(E.currentSrc,h.url,v)&&g(E,{kind:"report",final:h.final},E.currentSrc);for(const[E,y]of t)bn(y,h.url,v)&&m(E,"media-load",y);p(!1)},registerPdfFrame:(h,v)=>(t.set(v,h),()=>{t.delete(v),o.delete(v),p(!1)}),pdfGeneration:h=>n.get(h)??0,subscribe:h=>(s.add(h),()=>{s.delete(h)}),notices:()=>a,reload:h=>{let v=!1;for(const E of[...o.values()])E.kind!=="media-load"||!h.contains(E.target)||(o.delete(E.target),E.target instanceof HTMLIFrameElement?(n.set(E.url,(n.get(E.url)??0)+1),v=!0):(e.set(E.target,Zt),w(E.target)));p(v)}}},Zs=Object.freeze({unauthorized:"unauthenticated",forbidden:"forbidden"}),ie=e=>e==="unauthorized"||e==="forbidden";let kn=0;const Ws=(e,t,n,r)=>{const o=l.useRef(r);l.useLayoutEffect(()=>{o.current=r});const s=r!==null;return l.useMemo(()=>{const{reason:a}=e;if(!ie(a))throw new TypeError(`[markdown-explorer] the failure ${a} is the explorer's own, not an access failure for the host's presenter`);const i=Zs[a],m=Object.freeze({kind:i,place:t,deniedSentence:i==="forbidden"?n:null,retry:s?()=>o.current?.():null});return kn+=1,Object.freeze({occurrence:m,reason:a,number:kn})},[e,t,n,s])},Ks=Object.freeze([]),Xs=()=>{let e=Ks;const t=new Set,n=r=>{e=Object.freeze(r);for(const o of[...t])o()};return Object.freeze({hold:r=>{const o=Object.freeze({...r});return n([...e,o]),()=>{e.includes(o)&&n(e.filter(s=>s!==o))}},subscribe:r=>(t.add(r),()=>{t.delete(r)}),held:()=>e})},Er=l.createContext(null),xr=l.createContext(null),yr=({reason:e,testId:t,children:n})=>t===null?n:c.jsx("div",{className:"aqmx-access-failure","data-testid":t,"data-aqmx-failure":e,children:n}),Ze=({failure:e,place:t,deniedSentence:n,retry:r,testId:o})=>{const{accessFailure:s}=F(),a=Ws(e,t,n,r),i=l.use(Er);return l.useLayoutEffect(()=>i===null?void 0:i.hold({access:a,testId:o}),[i,a,o]),i!==null?null:c.jsx(yr,{reason:a.reason,testId:o,children:s(a.occurrence)},a.number)},Ys=()=>{const e=l.use(xr);return e===null?null:c.jsx(Qs,{sheet:e})},Qs=({sheet:e})=>{const{accessFailure:t}=F(),n=l.useSyncExternalStore(e.subscribe,e.held,e.held);return n.length===0?null:c.jsx("div",{className:"aqmx-sheet-access-failures","data-testid":"markdown-explorer-sheet-access-failures",children:n.map(r=>c.jsx(yr,{reason:r.access.reason,testId:r.testId,children:t(r.access.occurrence)},r.access.number))})},br={"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},ce=(e,t)=>e[br[t][0]],ye=({failure:e,alert:t,onRetry:n,testId:r,text:o,deniedSentence:s})=>{const{reason:a}=e;return ie(a)?c.jsx(Ze,{failure:e,place:"read",deniedSentence:s??null,retry:n??null,testId:r}):c.jsx(Js,{failure:e,reason:a,alert:t,onRetry:n,testId:r,text:o})},Js=({failure:e,reason:t,alert:n,onRetry:r,testId:o,text:s})=>{const{labels:a}=F(),i=s===void 0?ce(a,t):s.title,m=s===void 0?a[br[t][1]]:s.body,p=t==="failed"?"danger":"warning";return c.jsxs("div",{className:"aqmx-callout",role:n?"alert":void 0,"data-aqmx-tone":p,"data-testid":o===null?void 0:o,"data-aqmx-failure":o===null?void 0:e.reason,children:[c.jsx("p",{className:"aqmx-callout-title",children:i}),c.jsx("p",{className:"aqmx-callout-body",children:m}),r!==void 0&&t==="failed"?c.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:r,children:a.retry}):null]})},ea=(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":{const{reason:s}=n.failure;return ie(s)?"":ce(e,s)}}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":{const{reason:s}=r.failure;if(!ie(s))return e.draftSaveFailed(ce(e,s));break}case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},ta=(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":{const{reason:r}=t.failure;return ie(r)?null:e.draftSaveFailed(ce(e,r))}case"idle":case"saving":return null}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},kr="<<<<<<<",Sr="=======",Tr=">>>>>>>",Sn=(e,t)=>e===t||e.startsWith(`${t} `),Tn=e=>Rr(e.split(`
|
|
5
|
+
`)),Rr=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||(Sn(s,kr)?(n=o,r=null):s===Sr?n!==null&&r===null?r=o:n=null:Sn(s,Tr)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},Rt=e=>e.includes(`\r
|
|
6
6
|
`)?`\r
|
|
7
7
|
`:`
|
|
8
8
|
`,nt=e=>e.replace(/\r\n?/gu,`
|
|
9
|
-
`),
|
|
9
|
+
`),na=(e,t)=>t===`
|
|
10
10
|
`?e:e.replaceAll(`
|
|
11
11
|
`,`\r
|
|
12
|
-
`),
|
|
13
|
-
`,controller:new AbortController};s.set(u,T),I(u,T)},retry:u=>{const d=s.get(u);d===void 0||d.value.phase.kind==="editing"||I(u,d)},draft:u=>{const d=s.get(u);return d===void 0||d.base===null?null:d.draft},setDraft:(u,d)=>{const k=s.get(u);if(k===void 0||k.base===null)return;d!==k.draft&&M(u),k.draft=d;const T={},O=d!==k.base.text;O!==k.value.dirty&&(T.dirty=O);const{save:$}=k.value;if($.kind==="conflicts"){const y=Sn(d).length;y===0?T.save=Ie:y!==$.count&&(T.save={kind:"conflicts",count:y})}(T.dirty!==void 0||T.save!==void 0)&&b(k,T)},consumeRequest:u=>{const d=s.get(u);d!==void 0&&d.value.request!==null&&b(d,{request:null})},save:Z,replaceDraft:(u,d)=>{const k=m.get(u);k?.flush();const T=s.get(u);if(T===void 0||T.base===null)return;const O=nt(d);O!==T.draft&&M(u),T.draft=O,k?.adopt(O),b(T,{dirty:O!==T.base.text,generation:T.value.generation+1})},close:u=>{if(!s.has(u))return;const d=m.get(u),k=d===void 0?null:d.returnPoint();H(u),k===null?a.delete(u):a.set(u,k),g.emit()},takeReturn:u=>{const d=a.get(u)??null;return a.delete(u),d},dirtyPaths:()=>[...s.values()].filter(u=>u.value.dirty).map(u=>u.value.path),discard:u=>{for(const d of u)H(d);u.length>0&&g.emit()},editorState:{get:u=>i.get(u),set:(u,d)=>{s.has(u)&&i.set(u,d)}},bindEditor:(u,d)=>j(m,u,d),bindView:(u,d)=>j(p,u,d),viewAnchor:u=>{const d=p.get(u);return d===void 0?null:d.anchor()},flush:u=>m.get(u)?.flush(),flushDrafts:()=>{for(const u of m.values())u.flush()},nextConflict:u=>m.get(u)?.nextConflict()===!0,hasSessions:()=>s.size>0,unsavedAmong:u=>{for(const d of m.values())d.flush();return u.filter(d=>s.get(d)?.value.dirty===!0)},askToDiscard:u=>new Promise(d=>{h?.settle(!1);const k={paths:u,settle:T=>{if(h===k){if(h=null,T)for(const O of u)H(O);g.emit(),d(T)}}};h=k,g.emit()}),discardRequest:()=>h,subscribeDrafts:u=>{const d={listener:u,kept:new Set,first:!0};return v.add(d),C(),()=>{v.delete(d)}},restoreDrafts:async u=>{const{signal:d}=new AbortController,k=await Promise.all(u.map(async $=>{const y=await e.edit($.path,d);if(!("kind"in y))throw new Error("[markdown-explorer] the transport answered a restore read as cancelled, though nothing aborted it");return{draft:$,answer:y}})),T=[],O=[];for(const{draft:$,answer:y}of k){const S=await K($,y);S.restored?T.push($.path):O.push({path:$.path,reason:S.reason})}return{restored:T,failed:O}},sideBySide:()=>(f??=r.read(),f),setSideBySide:u=>{f!==u&&(f=u,r.write(u),g.emit())},editorShare:()=>(w??=o.read()??z.EDIT_SPLIT_DEFAULT_PERCENT,w),setEditorShare:u=>{if(!Number.isFinite(u))throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${V.describeValue(u)}`);const d=Math.min(z.EDIT_SPLIT_MAX_PERCENT,Math.max(z.EDIT_SPLIT_MIN_PERCENT,u));w!==d&&(w=d,o.write(d))},setView:(u,d)=>{const k=s.get(u);k===void 0||k.value.view===d||(m.get(u)?.beforeView(d),b(k,{view:d,previewPrepared:k.value.previewPrepared||d==="preview"}))},preparePreview:u=>{const d=s.get(u);d!==void 0&&!d.value.previewPrepared&&b(d,{previewPrepared:!0})}}},tn=e=>{e.preventDefault(),e.stopPropagation()},Rr=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,Cr="data-aqmx-content-pane",ut=Object.freeze({[Cr]:""}),aa="--aqmx-dialog-left",ia="--aqmx-dialog-top",la='[data-testid="markdown-explorer"]',ca=e=>{const t=e.closest(la)?.querySelectorAll(`[${Cr}]`),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},da=e=>{const t=Rr(getComputedStyle(e).marginTop);if(Number.isNaN(t))return null;const n=ca(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(aa,`${String(s)}px`),e.style.setProperty(ia,`${String(a)}px`),n},ua=e=>e.preventDefault(),Mr=({open:e,onOpen:t,onDismiss:n})=>{const r=l.useRef(null),o=l.useRef(null),s=l.useRef(!1),a=l.useRef(t);l.useLayoutEffect(()=>{a.current=t},[t]),l.useLayoutEffect(()=>{s.current=e;const g=r.current;if(g!==null)if(e&&!g.open){const f=g.ownerDocument.activeElement;o.current=f instanceof HTMLElement?f:null,g.showModal(),a.current?.()}else!e&&g.open&&(g.close(),o.current?.isConnected===!0&&o.current.focus(),o.current=null)},[e]),l.useLayoutEffect(()=>{const g=r.current;if(!e||g===null)return;const f=new ResizeObserver(()=>h());let w=null;const h=()=>{const E=da(g);E===null||E===w||(w!==null&&f.unobserve(w),f.observe(E),w=E)};h(),f.observe(g);const v=g.ownerDocument.defaultView;return v?.addEventListener("resize",h),g.ownerDocument.addEventListener("scroll",h,{capture:!0,passive:!0}),()=>{f.disconnect(),v?.removeEventListener("resize",h),g.ownerDocument.removeEventListener("scroll",h,{capture:!0})}},[e]);const i=l.useCallback(g=>{g.key!=="Escape"||g.defaultPrevented||(tn(g),n())},[n]),m=l.useCallback(g=>{g.target===g.currentTarget&&n()},[n]),p=l.useCallback(()=>{s.current&&n()},[n]);return{ref:r,onKeyDown:i,onClick:m,onCancel:ua,onClose:p}},nn=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:i})=>{const m=l.useRef(null),p=l.useId(),g=l.useId(),f=l.useCallback(()=>m.current?.focus(),[]),w=Mr({open:e,onOpen:f,onDismiss:a});return c.jsx("dialog",{...w,className:"aqmx-confirm","aria-labelledby":p,"aria-describedby":g,"data-testid":i,children:c.jsxs("div",{className:"aqmx-confirm-panel",children:[c.jsx("p",{id:p,className:"aqmx-confirm-title",children:t}),c.jsx("p",{id:g,className:"aqmx-confirm-body",children:n}),c.jsxs("div",{className:"aqmx-confirm-actions",children:[c.jsx("button",{ref:m,type:"button",className:"aqmx-callout-action","data-testid":`${i}-cancel`,onClick:a,children:o}),c.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${i}-confirm`,onClick:s,children:r})]})]})})},Ue=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},Lr=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),Be=e=>e.status==="fulfilled"?e.value:void 0,Or=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!1}),fa=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!0}),ma=(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},Ar=(e,t,n)=>{const r=Be(e.read(t));if(r===void 0||r.status==="deferred")return Or;if(r.status==="error")return{readme:{status:"failed",failure:r.failure,retry:()=>e.retry(t)},claim:!1};const o=ma(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"?fa: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}},ha=(e,t,n)=>{const{readme:r}=Ar(e,t,n);return r.status==="ok"?r.readme:null},pa=(e,t,n)=>{const r=re.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)}},Dr=e=>{const{edits:t}=F(),n=l.useCallback(()=>t.session(e),[t,e]);return l.useSyncExternalStore(t.subscribe,n,wa)},Nr=()=>!1,wa=()=>{},ga=()=>{const{edits:e}=F();return l.useSyncExternalStore(e.subscribe,e.hasSessions,Nr)},jr=()=>{const{edits:e}=F();return l.useSyncExternalStore(e.subscribe,e.sideBySide,Nr)},va=()=>null,Ea=()=>{const{edits:e,labels:t,config:n,trees:r,guardUnload:o}=F(),s=l.useRef([]),a=l.useCallback(({nextLocation:v})=>{const E=pa(n,v,(x,b)=>ha(r,x,b));return e.flushDrafts(),s.current=e.dirtyPaths().filter(x=>!E.has(x)),s.current.length>0},[e,n,r]),i=re.useBlocker(a),m=ga();l.useEffect(()=>{if(!(m&&o))return;const v=E=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(E.preventDefault(),E.returnValue=!0)};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[m,e,o]);const p=l.useSyncExternalStore(e.subscribe,e.discardRequest,va),g=i.state==="blocked";l.useEffect(()=>{p!==null&&i.state==="blocked"&&i.reset()},[p,i]);const f=p!==null?p.paths:g?s.current:[],w=f.map(v=>P.lastPathSegment(v)).join(", "),h=f.length>0&&f.every(v=>e.session(v)?.save.kind==="draft");return c.jsx(nn,{open:g||p!==null,title:h?t.draftDiscardTitle:t.unsavedTitle,body:h?t.draftDiscardBody(w):t.unsavedBody(w),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(p!==null){p.settle(!0);return}i.state==="blocked"&&(e.discard(s.current),i.proceed())},onCancel:()=>{if(p!==null){p.settle(!1);return}i.state==="blocked"&&i.reset()}})},ya=async(e,t)=>{const n=await t.documents.refresh(e);if(n.status==="refreshed"||n.status==="shown"&&!n.failed){t.announcer.announce(t.labels.documentReloadedAfterChange(t.nameOf(e)));return}n.status==="failed"&&t.documentChanges.mark([e])},xa=(e,t)=>{bs(e);for(const r of e.sourceIds)t.trees.reloadSource(r);const n=[];for(const r of e.paths){if(t.documents.noteChanged(r),t.edits.session(r)!==void 0||!t.documentChanges.shown(r))continue;const o=t.documents.peek(r);o?.status!=="loaded"||o.document.kind==="failure"||(t.policy==="notify"?n.push(r):ya(r,t))}n.length>0&&t.documentChanges.mark(n)};function ba({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 ka=R.forwardRef(ba);let Mt=null;const Pr=()=>(Mt??=Promise.resolve().then(()=>require("./EditSurface-Xvk5wZu7.cjs")).catch(e=>{throw Mt=null,e}),Mt),Sa=()=>{Pr().catch(()=>{})},Ta=e=>{const{default:t}=l.use(Pr());return c.jsx(t,{...e})};class Ra extends l.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 _r="[data-aqmd-fullscreen]",Ca="[data-aqmd-fullscreen-dialog]:modal",Ma=e=>e instanceof Element&&e.closest(_r)!==null,La=e=>e.querySelector(Ca)!==null,rn=`[${Bt.SOURCE_LINES_ATTRIBUTE}]`,Oa="[data-aqmd-content]",Aa=`a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], ${_r}, [data-aqmd-svg-image-source]`,Da=200,Ve=e=>Bt.parseSourceLines(e.getAttribute(Bt.SOURCE_LINES_ATTRIBUTE)),Na=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=Ve(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(rn)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=Ve(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},ja=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Ir=e=>e.closest(Oa)!==null&&e.closest(Aa)===null,Fr=(e,t,n)=>{const r=Na(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:ft(e)}}const a=Pa(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:ft(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},$r=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(rn)){const i=Ve(a);if(i===null)continue;n??=Br(t,a);const{top:m,bottom:p}=a.getBoundingClientRect();m<=n&&n<p?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:ft(s.block)}},qr=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Br=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return qr(e)+(Number.isFinite(n)?n:0)},Pa=(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>Da||/[\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:ja(o.toString(),r),clientTop:n.getBoundingClientRect().top}},_a=(e,t)=>{const n=e.split(`
|
|
14
|
-
`),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 p=m.indexOf(t.word);p>=0;p=m.indexOf(t.word,p+t.word.length)){if(a===t.occurrence)return{line:i,column:p};a+=1}}return a>0?Ia(n,r,o,t.word)??s:s},Ia=(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},Hr=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(rn)){const s=Ve(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},Ur=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=ft(e),o=Ve(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},ft=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},Fe=(e,t)=>Object.freeze({replace:t.replace,preventScrollReset:t.preventScrollReset,defaultShouldRevalidate:!1,state:Object.freeze({aqmxNavigation:e})}),Et=Object.freeze({browse:Fe("browse",{replace:!0,preventScrollReset:!0}),"close-folder":Fe("close-folder",{replace:!0,preventScrollReset:!0}),"switch-source":Fe("switch-source",{replace:!1,preventScrollReset:!0}),"switch-view":Fe("switch-view",{replace:!1,preventScrollReset:!1}),"follow-link":Fe("follow-link",{replace:!1,preventScrollReset:!1})}),Fa=Object.freeze(Object.keys(Et)),$a=e=>Et[e],qa=(e,t)=>{if(e===re.NavigationType.Pop||typeof t!="object"||t===null||!("aqmxNavigation"in t))return null;const{aqmxNavigation:n}=t;return Fa.find(r=>r===n)??null},Se=()=>{const e=re.useNavigate();return l.useCallback((t,n)=>{e(t,Et[n])},[e])},Vr=({navigation:e,...t})=>c.jsx(re.Link,{...t,...Et[e]}),on=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},zr=(e,t)=>{const n=l.useRef(null),r=l.useRef(null),o=l.useRef(null),s=l.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);l.useEffect(()=>s,[s]);const a=l.useCallback(p=>{if(r.current!==p)return;const g=o.current;if(g!==null){g.then(()=>a(p));return}e.prefetch(p);const f=e.peek(p);if(f?.status!=="pending")return;const w=Promise.allSettled([f.promise]);o.current=w,w.then(()=>{o.current===w&&(o.current=null)})},[e]),i=l.useCallback(p=>{const g=t(p);g!==r.current&&(s(),g!==null&&(r.current=g,n.current=window.setTimeout(()=>{n.current=null,a(g)},z.PREFETCH_DWELL_MS)))},[s,t,a]),m=l.useCallback(p=>{t(p)!==r.current&&s()},[s,t]);return l.useMemo(()=>({onPointerOver:p=>i(p.target),onPointerOut:p=>m(p.relatedTarget),onFocus:p=>i(p.target),onBlur:p=>m(p.relatedTarget)}),[i,m])},Ba=l.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-BDF9A1sc.cjs")).then(e=>({default:e.NativeScrollBar})));class Ha extends l.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 Gr=({scroller:e,kind:t})=>c.jsx(Ha,{children:c.jsx(l.Suspense,{fallback:null,children:c.jsx(Ba,{scroller:e,kind:t})})}),Zr=e=>c.jsx(Gr,{scroller:e,kind:"content"}),Wr=Object.freeze({showArrowButtons:!0,enableThumbDrag:!0,enableTrackClick:!0}),Kr=Object.freeze({showArrowButtons:!1,enableThumbDrag:!1,enableTrackClick:!1}),sn=e=>e?Kr:Wr,Ua=8,Va="--aqmx-scroll-bar-slot-size",an=`var(${Va})`,ln=z.CONTROL_BLOCK_PIXELS,za=z.FIBONACCI_SPACING_PIXELS[3],Ga="--aqmx-tap-circle-gutter-size",cn=`var(${Ga})`,Za=-(ln+za),Xr=Object.freeze({minSpeedMultiplier:.25,maxSpeedMultiplier:18});let Yr=null,Lt=null;const Wt=new Set,Wa=e=>(Wt.add(e),()=>{Wt.delete(e)}),Ka=()=>{Lt===null&&(Lt=Promise.resolve().then(()=>require("./tapScrollCircle-DVNlszeF.cjs")).then(e=>{const t=e.TAP_SCROLL_CIRCLE.renderVisual;if(t===void 0)throw new TypeError("[markdown-explorer] the bars' tap-scroll circle has no look to share");Yr=t;for(const n of[...Wt])n()}).catch(e=>{Lt=null,console.error("[markdown-explorer] the look of a table's tap-scroll circle failed to load; the circle still scrolls without it.",e)}))},Xa=({look:e,state:t})=>e(t),Ya=e=>{const t=l.useSyncExternalStore(Wa,()=>Yr,()=>null);return l.useEffect(()=>{t===null&&Ka()},[t]),t===null?null:c.jsx(Xa,{look:t,state:e})},Qr=Object.freeze({renderVisual:e=>c.jsx(Ya,{...e}),...Xr,size:ln}),Qa=Object.freeze({...Qr,visibility:"scrolling"}),Jr=e=>e?Qa:Qr,eo="(pointer: coarse)",Ja=e=>{const t=window.matchMedia(eo);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},ei=()=>window.matchMedia(eo).matches,ti=()=>!1,dn=()=>l.useSyncExternalStore(Ja,ei,ti),to=()=>{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()]}},mt=(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)=>mt(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)&&mt(n[s],r[s]))},ni=55e3,Tn=Object.freeze({status:"deferred"}),Ot=Object.freeze({status:"refreshed"}),At=Object.freeze({status:"shown",failed:!1}),rt=Object.freeze({status:"shown",failed:!0}),ot=Object.freeze({status:"superseded"}),we=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,ri=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",oi=({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 ${V.describeValue(t)}`);const n=new Map,r=to(),o=je(),s=new WeakSet,a=new Map,i=new Map,m=new Map;let p=0;const g=o.emit,f=()=>(p+=1,p),w=()=>{if(!(n.size<=t))for(const u of[...n.keys()]){if(n.size<=t)return;r.isHeld(u)||n.delete(u)}},h=(u,d)=>{n.delete(u),n.set(u,d)},v=u=>performance.now()-u.validatedAt>=ni,E=(u,d,k)=>{const T=n.get(u),O=we(T?.snapshot),$=k||T?.refreshPending===!0,y=Ue(e.document(u,{refresh:$}).then(A=>({status:"loaded",document:A}))),S={snapshot:{status:"pending",promise:y,previous:O},validatedAt:performance.now(),opened:d,background:null,refreshPending:!1,seeded:void 0,stamp:f()};return h(u,S),w(),y.then(A=>{n.get(u)===S&&(S.snapshot=A,S.stamp=f(),g())}),S},x=(u,d,k,T,O,$)=>{d.background===k&&(d.background=null,!(n.get(u)!==d||d.snapshot!==T)&&(O.kind==="failure"&&T.document.kind!=="failure"||(d.validatedAt=$,d.stamp=f(),mt(T.document,O)||(d.snapshot={status:"loaded",document:O}),g())))},b=async(u,d)=>{const k=d.snapshot;if(k.status!=="loaded")return null;const T={};d.background=T;const O=performance.now(),$=e.document(u,{refresh:d.refreshPending});d.refreshPending=!1;const y=await $,S=d.background===T&&n.get(u)===d&&d.snapshot===k;return x(u,d,T,k,y,O),S?y:null},L=u=>{u.validatedAt=Number.NEGATIVE_INFINITY,u.opened=!0,u.refreshPending=!0},N=u=>{u.background=null},C=(u,d)=>{const{snapshot:k}=d;return k.status==="pending"?!1:k.status==="loaded"&&k.document.kind!=="failure"?(b(u,d),!1):(k.status==="loaded"&&s.add(k),E(u,!0,!1),!0)},M=u=>{i.delete(u);const d=m.get(u);if(d!==void 0){m.delete(u);for(const k of d)k()}},_=(u,d)=>new Promise(k=>{if(i.get(u)===d||!r.isHeld(u)){k();return}const T=m.get(u);T===void 0?m.set(u,new Set([k])):T.add(k)}),I=(u,d)=>{const k=a.get(u);if(k===void 0){d.resolve(null);return}if(k.last!==null&&k.last.stamp>=d.stamp){d.resolve(k.last);return}k.waiters.add(d)},H=async(u,d,k)=>{const T=await new Promise(O=>I(u,{stamp:d.stamp,resolve:O}));if(n.get(u)!==d)return ot;if(T===null)return k?Ot:At;if(!k)return T.failure===null?At:rt;switch(T.before){case"copy":return T.failure===null?Ot:{status:"failed",failure:T.failure};case"failure":return T.failure===null?At:rt;case"none":return T.failure===null?Ot:rt}},j=u=>{const d={showing:"none",last:null,waiters:new Set};a.set(u,d);let k=!1;return{settle:(T,O)=>{if(k||T===void 0)return;const $={stamp:T,failure:O,before:d.showing};d.last=$,O===null?d.showing="copy":d.showing==="none"&&(d.showing="failure");for(const y of[...d.waiters])T<y.stamp||(d.waiters.delete(y),y.resolve($))},release:()=>{if(k)return;k=!0,a.get(u)===d&&a.delete(u);const T=[...d.waiters];d.waiters.clear(),T.length>0&&queueMicrotask(()=>{for(const O of T)I(u,O)})}}},U=u=>{const d=r.hold(u);let k=!1;return()=>{if(k)return;k=!0,d();const T=n.get(u);T!==void 0&&h(u,T),w(),r.isHeld(u)||queueMicrotask(()=>{r.isHeld(u)||M(u)})}};return{peek:u=>n.get(u)?.snapshot,peekSeeded:u=>n.get(u)?.seeded,answerStampOf:u=>n.get(u)?.stamp,prefetch:u=>{const d=n.get(u);d!==void 0&&d.snapshot.status!=="deferred"||(E(u,!1,!1),g())},open:u=>{const d=r.resumes(u),k=U(u),T=n.get(u);if(T===void 0||T.snapshot.status==="deferred")return E(u,!0,!1),g(),k;if(h(u,T),d)return k;const{snapshot:O}=T;return O.status==="pending"?(T.opened=!0,k):O.document.kind==="failure"?(T.opened||v(T)?(s.add(O),E(u,!0,!1),g()):T.opened=!0,k):(T.opened=!0,T.background===null&&v(T)&&b(u,T),k)},retain:U,retry:u=>{const d=n.get(u);d===void 0||d.snapshot.status!=="loaded"||d.snapshot.document.kind!=="failure"||(E(u,!0,!1),g())},seed:(u,d)=>{const k=performance.now(),T=Ue(d.then(A=>A===null?Tn:{status:"loaded",document:A},()=>Tn)),O=n.get(u);if(O!==void 0&&O.snapshot.status==="loaded"){const A=O.snapshot,D={};O.background=D,T.then(q=>{if(q.status==="loaded"){x(u,O,D,A,q.document,k);return}O.background===D&&(O.background=null)});return}const $=O!==void 0&&O.snapshot.status==="pending"?O.snapshot.previous:null,y={status:"pending",promise:T,previous:$},S={snapshot:y,validatedAt:k,opened:O?.opened===!0,background:null,refreshPending:O?.refreshPending===!0,seeded:y,stamp:f()};h(u,S),w(),T.then(A=>{n.get(u)===S&&(A.status==="deferred"&&r.isHeld(u)?E(u,S.opened,!1):(S.snapshot=A,S.stamp=f()),g())})},invalidate:()=>{let u=!1;for(const[d,k]of[...n]){if(L(k),!r.isHeld(d)){N(k);continue}const{snapshot:T}=k;if(T.status!=="pending"){C(d,k)&&(u=!0);continue}T.promise.then(()=>{n.get(d)===k&&k.refreshPending&&r.isHeld(d)&&C(d,k)&&g()})}u&&g()},noteChanged:u=>{const d=n.get(u);if(d===void 0)return;if(L(d),!r.isHeld(u)){N(d);return}const{snapshot:k}=d;if(k.status==="pending"){E(u,d.opened,!0),g();return}k.status==="loaded"&&k.document.kind==="failure"&&(s.add(k),E(u,!0,!1),g())},refresh:async u=>{const d=n.get(u);if(d!==void 0&&ri(d.snapshot)){d.refreshPending=!0;const O=await b(u,d);return O===null?ot:O.kind==="failure"?{status:"failed",failure:O.failure}:H(u,d,!0)}const k=E(u,!0,!0);if(g(),k.snapshot.status!=="pending")return ot;const T=await k.snapshot.promise;return n.get(u)!==k||T.status!=="loaded"?ot:T.document.kind==="failure"?rt:(await _(u,T),H(u,k,!1))},clear:()=>{n.clear();for(const u of r.heldKeys())E(u,!0,!1);g()},subscribe:o.subscribe,readPart:j,noteShown:(u,d)=>{i.set(u,d);const k=m.get(u);if(k!==void 0){m.delete(u);for(const T of k)T()}},noteFailureShown:u=>s.has(u)?!1:(s.add(u),!0)}},be=l.createContext("fill"),si="--aqmx-tap-circle-gutter",ai=Object.freeze({blockSize:"100%",[si]:cn}),We=({scrollerProps:e,children:t})=>l.use(be)==="content"?c.jsx(Ne.HostedScrollArea,{scrollerProps:e,children:t}):c.jsx(Ne.HostedScrollArea,{scrollerProps:{...e,style:ai},rowClassName:"aqmx-document-scroll-row",renderScrollBar:Zr,barInlineSize:an,children:t}),ii=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),li=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),ke=({label:e,testId:t})=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":t,children:ii.map(n=>c.jsx("span",{},n))}),c.jsx("p",{className:"aqmx-sr-only",children:e})]}),ht=({failure:e,onRetry:t,testId:n,text:r,deniedSentence:o})=>c.jsx(We,{scrollerProps:li,children:c.jsx(xe,{failure:e,alert:!1,onRetry:t,testId:n,text:r,deniedSentence:o})});function ci({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 di=R.forwardRef(ci);function ui({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 fi=R.forwardRef(ui);function mi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 no=R.forwardRef(mi),hi=2e3,Rn=Object.freeze({outcome:"idle",message:null}),ro=()=>{const{announcer:e}=F(),[t,n]=l.useState(Rn),r=l.useRef(0);l.useEffect(()=>{if(t.outcome==="idle")return;const s=setTimeout(()=>n(Rn),hi);return()=>clearTimeout(s)},[t]);const o=l.useCallback(()=>{r.current+=1;const s=r.current;return(a,i)=>{r.current===s&&(n({outcome:a,message:i}),e.announce(i))}},[e]);return{shown:t,press:o}},pi=(e,t)=>new Promise(n=>n(e.writeText(t))),wi=({text:e})=>{const{labels:t}=F(),{shown:n,press:r}=ro(),o=()=>{const a=r(),i=navigator.clipboard;if(i===void 0){a("failed",t.copyTextFailed);return}pi(i,e).then(()=>a("copied",t.copiedText),m=>{console.error("[markdown-explorer] could not copy the text",m),a("failed",t.copyTextFailed)})},s=n.message===null?t.copyText:n.message;return c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.copyText,title:s,onClick:o,"data-aqmx-copy-outcome":n.outcome,"data-testid":"markdown-explorer-file-copy",children:n.outcome==="copied"?c.jsx(di,{}):n.outcome==="failed"?c.jsx(no,{}):c.jsx(fi,{})})},oo=l.createContext(null),gi=()=>{const e=l.use(oo);if(e===null)throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");return e},vi=new Set,so=(e,t,n)=>{const{documents:r,announcer:o,labels:s}=F(),a=l.useCallback(()=>r.peek(e),[r,e]),i=l.useCallback(()=>r.peekSeeded(e),[r,e]),m=l.useSyncExternalStore(r.subscribe,a,i),p=l.useCallback(()=>r.answerStampOf(e),[r,e]),g=l.useSyncExternalStore(r.subscribe,p,p),[f]=l.useState(()=>new Set),[w,h]=l.useState(vi),[v,E]=l.useState(null);v!==null&&(v.path!==e||v.markup!==n)&&E(null);const x=l.useRef(null);l.useLayoutEffect(()=>(x.current=e,()=>{x.current=null}),[e]);const b=l.useRef(n);l.useLayoutEffect(()=>{b.current=n},[n]);const L=l.useCallback(()=>{const M=e,_=r.peek(M);f.has(M)||_?.status==="pending"||(f.add(M),h(new Set(f)),E(null),(async()=>{try{const I=await r.refresh(M);if(x.current!==M||I.status==="superseded")return;if(I.status==="failed"){E({path:M,failure:I.failure,stamp:r.answerStampOf(M),markup:b.current});const{reason:j}=I.failure;ie(j)||o.announce(s.documentRefreshFailed(ce(s,j)));return}if(I.status==="shown"&&(t||I.failed))return;const H=we(r.peek(M));if(H===null||H.document.kind==="failure")return;o.announce(s.documentRefreshed(H.document.name))}finally{f.delete(M),h(new Set(f))}})())},[e,t,f,r,o,s]),N=w.has(e),C=v!==null&&v.path===e&&v.stamp===g&&v.markup===n?v.failure:null;return{refreshing:N,unavailable:N||m?.status==="pending",failure:C,refresh:L}},Ei=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),yi=(e,t)=>{const{mediaFailures:n}=F(),[r,o]=l.useState(()=>({path:t,notices:it}));return l.useEffect(()=>{const s=()=>{const a=e.current,i=a===null?it:n.notices().filter(m=>a.contains(m.target));o(m=>m.path===t&&Ei(m.notices,i)?m:{path:t,notices:i})};return s(),n.subscribe(s)},[n,e,t]),r.path===t?r.notices:it},Cn=(e,t,n)=>{const[r]=e;return r===void 0?null:e.length===1?t(r.name):n(e.length)},Dt=({kind:e,tone:t,text:n,onReload:r})=>{const{labels:o}=F(),s=l.useId();return c.jsxs("div",{className:"aqmx-callout aqmx-document-notice","data-aqmx-tone":t,"data-testid":"markdown-explorer-document-notice","data-aqmx-notice":e,children:[c.jsx("p",{id:s,className:"aqmx-callout-body",children:n}),r===null?null:c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-describedby":s,onClick:r,children:o.reload})]})},xi=({path:e,name:t,editing:n,announces:r,markup:o,region:s,focusDocument:a})=>{const{labels:i,documentChanges:m,mediaFailures:p}=F(),{refresh:g}=so(e,r,o);l.useLayoutEffect(()=>m.show(e),[m,e]);const f=l.useCallback(()=>m.changed(e),[m,e]),w=l.useSyncExternalStore(m.subscribe,f,f);l.useEffect(()=>{n&&m.dismiss(e)},[n,m,e]);const h=yi(s,e),v=N=>{N.currentTarget===N.currentTarget.ownerDocument.activeElement&&a()},E=N=>{v(N),m.dismiss(e),g()},x=N=>{const C=s.current;C!==null&&(v(N),p.reload(C))},b=Cn(h.filter(N=>N.kind==="media-load"),i.mediaLoadFailed,i.mediaLoadFailedCount),L=Cn(h.filter(N=>N.kind==="media-unplayable"),i.mediaUnplayable,i.mediaUnplayableCount);return c.jsxs("div",{className:"aqmx-document-notices",role:"status","aria-live":"polite","aria-atomic":"false","data-testid":"markdown-explorer-document-notices",children:[w&&!n?c.jsx(Dt,{kind:"changed",tone:"info",text:i.documentChangedElsewhere(t),onReload:E}):null,b===null?null:c.jsx(Dt,{kind:"media-load",tone:"warning",text:b,onReload:x}),L===null?null:c.jsx(Dt,{kind:"media-unplayable",tone:"warning",text:L,onReload:null})]})};function bi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 ki=R.forwardRef(bi);function Si({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Ti=R.forwardRef(Si),Ke=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=F();return c.jsxs("div",{className:"aqmx-document-toolbar",children:[c.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:r}),c.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),o,c.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:c.jsx(Ti,{})}),c.jsx("a",{className:"aqmx-icon-button",href:n,download:e,"aria-label":s.download,title:s.download,"data-testid":"markdown-explorer-file-download",children:c.jsx(ki,{})})]})};function Ri({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Ci=R.forwardRef(Ri),Mi=Object.freeze({className:"aqmx-document-stage"}),Li=({document:e})=>{const{labels:t}=F();return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[c.jsx(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:c.jsx(Ci,{})}),c.jsx(We,{scrollerProps:Mi,children:c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[c.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),c.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Mn=["keydown","pointerdown","wheel","touchstart"],lt=new WeakMap,pt=new WeakMap,Oi=e=>{const t=pt.get(e);if(t!==void 0){t.count+=1;return}pt.set(e,{count:1,original:e.style.overflowAnchor}),e.style.overflowAnchor="none"},Ai=e=>{const t=pt.get(e);t!==void 0&&(t.count-=1,!(t.count>0)&&(pt.delete(e),e.style.overflowAnchor=t.original))},Di=(e,t,n)=>{for(let r=t;r!==null&&r!==n;r=r.parentElement){e.observe(r);for(let o=r.previousElementSibling;o!==null;o=o.previousElementSibling)e.observe(o)}},Ni=e=>{const t=new Map;for(let n=e.parentElement;n!==null;n=n.parentElement)t.set(n,{top:n.scrollTop,left:n.scrollLeft});return t},ao=e=>{lt.get(e)?.()},io=(e,t,n)=>{ao(e);let r=new Map;const o=new Set,s=()=>{const f=t();return f===null?!1:(r=Ni(f),!0)};if(!s()||typeof ResizeObserver>"u")return;const a=()=>{for(const f of r.keys())!(f instanceof HTMLElement)||o.has(f)||(o.add(f),Oi(f))};a();const{ownerDocument:i}=e,m=new ResizeObserver(()=>{if(!s()){g();return}a()});for(const{element:f,boundary:w}of n)Di(m,f,w);const p=f=>{const w=f.target===i?i.scrollingElement:f.target;if(!(w instanceof Element))return;const h=r.get(w);h!==void 0&&(w.scrollTop!==h.top||w.scrollLeft!==h.left)&&g()},g=()=>{m.disconnect();for(const f of Mn)i.removeEventListener(f,g,!0);i.removeEventListener("scroll",p,!0);for(const f of o)Ai(f);o.clear(),lt.get(e)===g&<.delete(e)};for(const f of Mn)i.addEventListener(f,g,{capture:!0,passive:!0});i.addEventListener("scroll",p,{capture:!0,passive:!0}),lt.set(e,g)},yt="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",ji=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},Pi=/(%[0-9A-Fa-f]{2})/u,un=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(Pi).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))},lo=e=>`#${encodeURIComponent(e)}`,_i=e=>{if(e==="#")return!0;const t=un(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},co=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Ii="http://www.w3.org/1999/xhtml",Ln=(e,t)=>{if(t==="")return null;const n=co(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Ii&&r.getAttribute("name")===t)return r;return null},uo=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=Ln(e,t.slice(1));if(n!==null)return n;const r=un(t);return r===null?null:Ln(e,r)},On=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"},Fi=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"},$i=(e,t)=>{const n=t.closest(yt),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&On(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(On(i)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o)return i;return a instanceof Element&&Fi(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},qi=Object.freeze({scrollerOf:$i,reveal:e=>{e.scrollIntoView(wt)},keepAtStart:(e,t)=>{io(e,()=>t.isConnected?(fo(e,t),t):null,[{element:t,boundary:e}])}}),wt=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),Bi=(e,t)=>{for(let n=t;n!==null&&n!==e;n=n.parentElement){const r=n.parentElement;if(r instanceof HTMLDetailsElement&&n!==r.querySelector(":scope > summary")&&(r.open=!0),n.getAttribute("hidden")?.toLowerCase()==="until-found"){if(n.dispatchEvent(new Event("beforematch",{bubbles:!0})),!n.isConnected)return;n.removeAttribute("hidden")}}},fo=(e,t)=>{if(t.getClientRects().length===0)return;const n=e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,{scrollMarginTop:r,scrollMarginBottom:o}=getComputedStyle(t),s=Number.parseFloat(r),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)},Hi=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(yt)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},An=(e,t,n)=>{if(e===null)return null;const r=uo(e,t);return r===null?(_i(t)&&Hi(e,n),null):(Bi(e,r),n.keepAtStart(n.scrollerOf(e,r),r),r)};function Ui({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Vi=R.forwardRef(Ui);function zi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Gi=R.forwardRef(zi);function Zi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Wi=R.forwardRef(Zi);function Ki({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Xi=R.forwardRef(Ki),Kt="data-aqmx-key-repeat",gt=Object.freeze({[Kt]:"allow"}),Yi=`[${Kt}="${gt[Kt]}"]`,Qi=()=>{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(Yi)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},ct=Object.freeze([1/z.GOLDEN_RATIO**2,1/z.GOLDEN_RATIO,1,z.GOLDEN_RATIO,z.GOLDEN_RATIO**2]),Dn=Object.freeze({mode:"fit"}),Ji=1,mo=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),Nn=`[data-testid="${mo["data-testid"]}"]`,ho=l.createContext(null),el=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=Ji?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,jn=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<ct.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?ct.findIndex(o=>o>t):ct.findLastIndex(o=>o<t);return r===-1?null:r},Pn=(e,t,n)=>{if(e.mode==="level"){const o=jn(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=jn(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},tl=(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},_n=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}}},nl=e=>{const t=ct[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${V.describeValue(e)}`);return t},In=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},rl=({document:e})=>{const{labels:t}=F(),n=l.use(ho),[r]=l.useState(()=>n===null?null:n.read(e.url)),[o,s]=l.useState(r===null?Dn:r.zoom),[a,i]=l.useState(r===null?null:r.reported),[m,p]=l.useState(null),g=l.useRef(null),f=l.useCallback(C=>{const{naturalWidth:M,naturalHeight:_}=C;i(I=>In(I,M,_))},[]),w=l.useCallback(C=>{g.current=C,!(C===null||!C.complete)&&(C.naturalWidth>0||C.naturalHeight>0?f(C):C.decode().then(()=>f(C),()=>{}))},[f]);l.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),l.useLayoutEffect(()=>{const C=g.current;if(C===null||a===null||o.mode!=="fit")return;const M=()=>p(I=>In(I,C.clientWidth,C.clientHeight));if(M(),typeof ResizeObserver>"u")return;const _=new ResizeObserver(M);return _.observe(C),()=>_.disconnect()},[a,o.mode]);const h=a===null||m===null?null:el(a,m),v=Pn(o,h,-1),E=Pn(o,h,1),x=o.mode==="level"?nl(o.index):null,b=l.useRef({zoomIn:E,zoomOut:v});l.useLayoutEffect(()=>{b.current={zoomIn:E,zoomOut:v}});const L=l.useRef(null);l.useLayoutEffect(()=>{const C=L.current,M=g.current?.closest(Nn);L.current=null,!(C===null||M===null||M===void 0)&&(M.scrollLeft=C.across*M.scrollWidth-C.x,M.scrollTop=C.down*M.scrollHeight-C.y)},[o]),l.useEffect(()=>{const C=g.current?.closest(Nn);if(C==null)return;let M=null;const _=j=>{const U=_n(j.touches);M=U===null?null:{distance:U.distance,steps:0}},I=j=>{const U=_n(j.touches);if(M===null||U===null)return;j.preventDefault();const Z=tl(M.distance,U.distance);if(Z===M.steps)return;const K=Z>M.steps?1:-1,u=K===1?b.current.zoomIn:b.current.zoomOut;if(u===null)return;M.steps+=K;const d=C.getBoundingClientRect(),k=U.middle.x-d.left,T=U.middle.y-d.top;L.current=C.scrollWidth>0&&C.scrollHeight>0?{x:k,y:T,across:(C.scrollLeft+k)/C.scrollWidth,down:(C.scrollTop+T)/C.scrollHeight}:null,s(u)},H=j=>{j.touches.length<2&&(M=null)};return C.addEventListener("touchstart",_,{passive:!0}),C.addEventListener("touchmove",I,{passive:!1}),C.addEventListener("touchend",H,{passive:!0}),C.addEventListener("touchcancel",H,{passive:!0}),()=>{C.removeEventListener("touchstart",_),C.removeEventListener("touchmove",I),C.removeEventListener("touchend",H),C.removeEventListener("touchcancel",H)}},[]);const N=o.mode==="level"&&x!==null?{width:`${o.base.width*x}px`,height:`${o.base.height*x}px`}:void 0;return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[c.jsxs(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:c.jsx(Xi,{}),children:[c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":v===null,onClick:()=>{v!==null&&s(v)},...gt,children:c.jsx(Gi,{})}),c.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:x===null?t.imageFitLevel:t.imageZoomLevel(Math.round(x*100))}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":E===null,onClick:()=>{E!==null&&s(E)},...gt,children:c.jsx(Wi,{})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(Dn),children:c.jsx(Vi,{})})]}),c.jsx(We,{scrollerProps:mo,children:c.jsx("img",{ref:w,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:N,onLoad:C=>f(C.currentTarget),"data-testid":"markdown-explorer-image"})})]})},ol=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"}},po=l.createContext(null),wo=l.createContext(void 0),xt=l.createContext(void 0),go=l.createContext(null),bt=()=>{const e=l.use(po);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},sl=()=>{const e=l.use(go);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},kt=(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}),vo=(e,t,n,r)=>t.view==="tree"?z.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides,maximized:t.maximized()}):kt(e,t,n,r),al=({children:e})=>{const{config:t}=F(),n=bt(),r=Ge(),o=r.kind==="location"?r.location.source:void 0,s=re.useHref(kt(t,n.navigation,o,n.currentPath));return c.jsx(xt,{value:o,children:c.jsx(go,{value:s,children:e})})},il='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',ll=e=>{const t=e instanceof Element?e.closest(il):null;return t===null?null:t.getAttribute("data-doc-path")},Xe=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,cl=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:i,children:m})=>{const p=re.useHref(e),g=f=>{if(Xe(f)){if(f.preventDefault(),t===i.currentPath&&n!==""){i.scrollWithin(n);return}a(t,n)}};return c.jsx("a",{...s,href:p,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:g,children:m})},dl=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=F(),i=bt(),m=l.use(xt),p=Se(),g=ji(e),{navigation:f}=i,w=`${kt(a,f,m,t)}${g}`,h=n===!1?"false":void 0;if(f.kind==="page"){const v=E=>{if(!Xe(E))return;const x=`${vo(a,f,m,t)}${g}`;x!==w&&(E.preventDefault(),p(x,"follow-link"))};return c.jsx(Vr,{...o,to:w,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":h,onClick:v,children:s})}return c.jsx(cl,{to:w,docPath:t,fragment:g,exists:h,className:r,attributes:o,onDocumentLink:f.onDocumentLink,scope:i,children:s})},ul=({className:e,attributes:t,children:n})=>{const{labels:r,locale:o}=F(),s=l.use(wo),{lang:a,dir:i,...m}=t,p=a??s;return c.jsxs("a",{...m,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,lang:p===void 0?void 0:o,"data-link-kind":"doc","data-doc-exists":"false",children:[c.jsx("span",{lang:p,dir:i,children:n}),c.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},fl=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=F(),a=l.use(xt),i=re.useHref(`${kt(s,r.navigation,a,r.currentPath)}${e}`),m=p=>{Xe(p)&&(p.preventDefault(),r.scrollWithin(e))};return c.jsx("a",{...n,href:i,className:t,onClick:m,children:o})},ml=({href:e,className:t,attributes:n,children:r})=>{const o=bt();if(o.navigation.kind==="page"){const s=a=>{Xe(a)&&(e==="#"?o.followEmptyFragment(a.nativeEvent):o.followFragmentJump(e,a.nativeEvent))};return c.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return c.jsx(fl,{href:e,className:t,attributes:n,scope:o,children:r})},hl=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!P.isAcceptableDocumentPath(n)?c.jsx(ul,{className:o,attributes:s,children:a}):c.jsx(dl,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?c.jsx(ml,{href:e,className:o,attributes:s,children:a}):c.jsx("a",{...s,href:e,className:o,children:a}),pl=()=>{const{config:e}=F(),t=bt(),n=l.use(xt),r=Se();return l.useCallback((o,s)=>{if(!Xe(s))return!0;s.preventDefault();const a=lo(o.id),{navigation:i}=t;return i.kind==="panel"||un(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${vo(e,i,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},wl=()=>{const e=sl();return l.useCallback(t=>`${e}${lo(t.id)}`,[e])};function gl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 vl=R.forwardRef(gl);function El({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 yl=R.forwardRef(El);function xl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 bl=R.forwardRef(xl),kl=Object.freeze({className:"aqmx-document-stage"}),Sl=()=>()=>{},Tl=()=>navigator.pdfViewerEnabled!==!1,Rl=()=>null,Cl=({document:e})=>{const{labels:t,mediaFailures:n}=F(),r=l.useSyncExternalStore(Sl,Tl,Rl),o=l.useCallback(()=>n.pdfGeneration(e.url),[n,e.url]),s=l.useSyncExternalStore(n.subscribe,o,o),a=l.useCallback(i=>n.registerPdfFrame(e.url,i),[n,e.url]);return r===null?null:r?c.jsx("iframe",{ref:a,className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"},s):c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-pdf-not-shown",children:[c.jsx("p",{className:"aqmx-callout-body",children:t.pdfNotShown}),c.jsxs("div",{className:"aqmx-callout-actions",children:[c.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}),c.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-pdf-not-shown-download",children:t.download})]})]})},Ml=e=>{switch(e){case"video":return c.jsx(yl,{});case"audio":return c.jsx(bl,{});case"pdf":return c.jsx(vl,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(t)}`)}}},Ll=({document:e})=>{const{labels:t}=F();switch(e.mediaType){case"video":return c.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 c.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 c.jsx(Cl,{document:e});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(n)}`)}}},Ol=({document:e})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[c.jsx(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:Ml(e.mediaType)}),c.jsx(We,{scrollerProps:kl,children:c.jsx(Ll,{document:e})})]}),fn=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}},Al=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=l.useSyncExternalStore(t.subscribe,n,r),s=we(o);return s===null?null:fn(s.document)},Eo=e=>{const{config:t}=F(),n=Se(),r=l.useCallback(()=>n(z.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return l.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])};function Dl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Nl=R.forwardRef(Dl),jl=100,Pl=32767,dt=Object.freeze({maxCells:vn.SPREADSHEET_MAX_OPERATION_CELLS,maxColumns:vn.SPREADSHEET_MAX_OPERATION_CELLS/jl,maxCellLength:Pl}),yo=44,xo=10,bo=13,st='"',Fn=(e,t)=>{let n=t;for(;n<e.length;){const r=e.charCodeAt(n);if(r===yo||r===xo||r===bo)return n;n+=1}return n};function*_l(e,t){let n=[],r=0;for(;;){let o;if(e.startsWith(st,r)){o="";let a=r+1;for(;;){const m=e.indexOf(st,a);if(m<0){o+=e.slice(a),r=e.length;break}if(o+=e.slice(a,m),e.startsWith(st,m+1)){o+=st,a=m+2;continue}r=m+1;break}const i=Fn(e,r);o+=e.slice(r,i),r=i}else{const a=Fn(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!==yo&&(yield n,n=[],s===bo&&e.charCodeAt(r)===xo&&(r+=1),r>=e.length))return}}const Il=(e,t,n)=>t==="csv"?_l(e,n):n==="whole"?Ht.iterateTsvRows(e):Ht.iterateTsvPrefixRows(e),Fl=(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)},ko=(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,p=Math.max(r,m.length);if((n.length+1)*p>t.maxCells){s=!0;break}const g=m.some(f=>f.length>t.maxCellLength)?m.map(f=>Fl(f,t.maxCellLength)):m;g!==i&&(o=!0),n.push(g),r=p}return{rows:n.map(i=>i.length===r?i:[...i,...Array(r-i.length).fill("")]),truncated:s||o,full:s}},Nt=(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=ko(Il(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}}},$l=Object.freeze({maxPartBytes:64*1024*1024,maxSheets:256}),So=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 f of a.keys())f>m&&(m=f);const p=Array(Math.min(m,e.maxColumns)+1).fill("");for(const[f,w]of a)f<=e.maxColumns&&(p[f]=w);const g=Math.min(p.length,e.maxColumns);if(n===0&&(s+1)*g>e.maxCells){const f=Math.floor(e.maxCells/g);for(;t.length<f;)t.push([]);o(p);return}for(;t.length<s&&!r;)o([]);for(let f=0;f<i&&!r;f+=1)o(f===0?p:[...p])},full:()=>r,table:()=>ko(t,e)}},ql=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())},Bl=({names:e,selected:t,onSelect:n,label:r,tabIdOf:o,panelId:s})=>c.jsx("div",{role:"tablist","aria-label":r,className:"aqmx-sheet-tabs","data-testid":"markdown-explorer-spreadsheet-sheets",onKeyDown:ql,children:e.map((a,i)=>c.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))}),To=64*1024,Hl=e=>{let t=new Uint8Array(Math.min(e,To)),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}},Ul=async e=>{for(;;){const{done:t,value:n}=await e.read();if(t)return!0;if(n.byteLength>0)return!1}},Vl=async(e,t)=>{const{format:n,legacyEncoding:r,maxBytes:o,budget:s}=t,a=e.getReader(),i=Hl(o);let m=To;try{for(;;){const{done:p,value:g}=await a.read();if(p)return Nt(i.bytes(),!0,n,r,s);const f=o-i.length();if(i.append(g.byteLength>f?g.subarray(0,f):g),i.length()===o){const h=g.byteLength<=f&&await Ul(a);return Nt(i.bytes(),h,n,r,s)}if(i.length()<m)continue;m=i.length()*2;const w=Nt(i.bytes(),!1,n,r,s);if(w.kind==="unreadable"&&w.code!=="long-row"||w.kind==="table"&&w.table.full)return w}}finally{a.cancel().catch(()=>{})}},Ro=async(e,t,n,r)=>{const o=await e.asset(P.explorerPlainTextHref(t),r);if(o.status==="cancelled")return null;if(o.status==="error")return{kind:"failure",failure:o.failure};let s;try{s=await Vl(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},mn=(e,t,n)=>{const{documents:r,labels:o}=F(),s=gi(),a=l.useCallback(()=>r.answerStampOf(e),[r,e]),i=l.useSyncExternalStore(r.subscribe,a,a),[m,p]=l.useState(0),g=l.useMemo(()=>({read:n,stamp:i,attempt:m}),[n,i,m]),[f,w]=l.useState({settled:null,shown:null,failure:null}),h=l.useRef(null),v=l.useEffectEvent((b,L)=>{if(h.current?.settle(L.stamp,b.kind==="failure"?b.failure:null),b.kind==="read"){w({settled:L,shown:b.value,failure:null});return}if(f.shown!==null){w({settled:L,shown:f.shown,failure:null});return}w({settled:L,shown:null,failure:b.failure});const{reason:N}=b.failure;ie(N)||s.announceFailure(o.documentFailed(t,ce(o,N)))});l.useEffect(()=>{const b=s.readPart();return h.current=b,()=>{h.current=null,b.release()}},[s]),l.useEffect(()=>{const b=new AbortController;return g.read(b.signal).then(L=>{L!==null&&!b.signal.aborted&&v(L,g)}),()=>b.abort()},[g]);const E=f.settled!==g&&(f.shown!==null||f.failure!==null);l.useLayoutEffect(()=>E?s.holdBusy():void 0,[E,s]);const x=l.useCallback(()=>p(b=>b+1),[]);return{shown:f.shown,failure:f.failure,retry:x}},Co=(e,t)=>{const n={};for(const r of Object.keys(De.SPREADSHEET_BLOCK_LABEL_CATALOGS[t])){const o=e[Jt(r)];o!==De.SPREADSHEET_BLOCK_LABEL_CATALOGS[t][r].text&&(n[r]=o)}return n},zl=(e,t)=>Object.fromEntries(Object.entries(Co(e,t)).map(([n,r])=>[`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`,r])),Gl=(e,t)=>({...zl(e,t),loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,styleSectionTitle:e.viewerStyleSectionTitle,measureTitle:e.viewerMeasureTitle,colorsTitle:e.viewerColorsTitle,measureFill:e.viewerMeasureFill,measureReading:e.viewerMeasureReading,colorsDefault:e.viewerColorsDefault,colorsSepia:e.viewerColorsSepia,colorsDarkLowGlare:e.viewerColorsDarkLowGlare,colorsHighContrast:e.viewerColorsHighContrast,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,mermaidFullscreen:e.viewerMermaidFullscreen,mermaidExitFullscreen:e.viewerMermaidExitFullscreen,mermaidFullscreenDialog:e.viewerMermaidFullscreenDialog,mermaidDiagram:e.viewerMermaidDiagram,mermaidRetry:e.viewerMermaidRetry,mermaidLoading:e.viewerMermaidLoading,mermaidInitializationFailed:e.viewerMermaidInitializationFailed,mermaidRenderFailed:e.viewerMermaidRenderFailed,mermaidEmptyDrawing:e.viewerMermaidEmptyDrawing,mermaidSource:e.viewerMermaidSource,mermaidSourceRegion:e.viewerMermaidSourceRegion,mermaidCopySource:e.viewerMermaidCopySource,mermaidCopiedSource:e.viewerMermaidCopiedSource,mermaidCopySourceFailed:e.viewerMermaidCopySourceFailed,mermaidTypeC4:e.viewerMermaidTypeC4,mermaidTypeFlowchart:e.viewerMermaidTypeFlowchart,mermaidTypeSwimlane:e.viewerMermaidTypeSwimlane,mermaidTypeEntityRelationship:e.viewerMermaidTypeEntityRelationship,mermaidTypeGitGraph:e.viewerMermaidTypeGitGraph,mermaidTypeGantt:e.viewerMermaidTypeGantt,mermaidTypeInfo:e.viewerMermaidTypeInfo,mermaidTypePie:e.viewerMermaidTypePie,mermaidTypeQuadrantChart:e.viewerMermaidTypeQuadrantChart,mermaidTypeXyChart:e.viewerMermaidTypeXyChart,mermaidTypeRequirement:e.viewerMermaidTypeRequirement,mermaidTypeSequence:e.viewerMermaidTypeSequence,mermaidTypeClass:e.viewerMermaidTypeClass,mermaidTypeState:e.viewerMermaidTypeState,mermaidTypeJourney:e.viewerMermaidTypeJourney,mermaidTypeTimeline:e.viewerMermaidTypeTimeline,mermaidTypeMindmap:e.viewerMermaidTypeMindmap,mermaidTypeKanban:e.viewerMermaidTypeKanban,mermaidTypeSankey:e.viewerMermaidTypeSankey,mermaidTypePacket:e.viewerMermaidTypePacket,mermaidTypeRadar:e.viewerMermaidTypeRadar,mermaidTypeBlock:e.viewerMermaidTypeBlock,mermaidTypeTreeView:e.viewerMermaidTypeTreeView,mermaidTypeArchitecture:e.viewerMermaidTypeArchitecture,mermaidTypeEventModeling:e.viewerMermaidTypeEventModeling,mermaidTypeIshikawa:e.viewerMermaidTypeIshikawa,mermaidTypeVenn:e.viewerMermaidTypeVenn,mermaidTypeTreemap:e.viewerMermaidTypeTreemap,mermaidTypeWardley:e.viewerMermaidTypeWardley,mermaidTypeCynefin:e.viewerMermaidTypeCynefin,mermaidTypeRailroad:e.viewerMermaidTypeRailroad,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,svgImageFullscreen:e.viewerSvgImageFullscreen,svgImageExitFullscreen:e.viewerSvgImageExitFullscreen,svgImageFullscreenDialog:e.viewerSvgImageFullscreenDialog,codeBlockCopy:e.viewerCodeBlockCopy,codeBlockCopied:e.viewerCodeBlockCopied,codeBlockCopyFailed:e.viewerCodeBlockCopyFailed,displayMathCopy:e.viewerDisplayMathCopy,displayMathCopied:e.viewerDisplayMathCopied,displayMathCopyFailed:e.viewerDisplayMathCopyFailed}),Mo=(e,t,n)=>t!==void 0?t:n!==void 0?n:e.defaultDocumentStyle,Lo=(e,t)=>e!==void 0?e:t!==void 0?t:ms.DEFAULT_CONTENT_ALIGN;class ne extends Error{refusal;constructor(t,n){super(n),this.name="WorkbookError",this.refusal=t}}const Zl=new Map([["lt","<"],["gt",">"],["amp","&"],["quot",'"'],["apos","'"]]),Wl=/&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu,Kl=/([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu,Xl=/^[^\s/>]+/u,Oe=e=>{throw new ne("not-workbook",`the XML ${e}`)},$n=e=>Number.isInteger(e)&&e>=0&&e<=1114111?String.fromCodePoint(e):Oe(`refers to the code point ${e}`),Oo=e=>e.includes("&")?e.replace(Wl,(t,n)=>n.startsWith("#x")?$n(Number.parseInt(n.slice(2),16)):n.startsWith("#")?$n(Number.parseInt(n.slice(1),10)):Zl.get(n)??Oe(`names the undeclared entity ${t}`)):e,Xt=e=>e.slice(e.indexOf(":")+1),Yl=(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},Ql=e=>{const t=new Map;for(const n of e.matchAll(Kl))t.set(Xt(n[1]??""),Oo(n[2]??n[3]??""));return t},Ao=(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?.(Oo(n.slice(o,s))),o=s),n.startsWith("<!--",s)){const p=n.indexOf("-->",s+4);if(p===-1)break;o=p+3;continue}if(n.startsWith("<![CDATA[",s)){const p=n.indexOf("]]>",s+9);if(p===-1)break;e.text?.(n.slice(s+9,p)),o=p+3;continue}const a=n.slice(s);if(a.length<9&&("<!--".startsWith(a)||"<![CDATA[".startsWith(a)))break;if(n.startsWith("<!",s)&&Oe("declares a document type or another declaration"),n.startsWith("<?",s)){const p=n.indexOf("?>",s+2);if(p===-1)break;o=p+2;continue}const i=Yl(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 p=m.endsWith("/"),g=p?m.slice(0,-1):m,f=Xl.exec(g)?.[0]??Oe("has a tag without a name"),w=Xt(f);e.start?.(w,Ql(g.slice(f.length)),p),p&&e.end?.(w)}o=i+1}n=n.slice(o)};return{write:o=>{n+=o,r()},finish:()=>{r(),!t()&&n.includes("<")&&Oe("ends inside a tag, a comment or a section")}}},Ye=async(e,t,n)=>{const r=Ao(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 ne)throw a;Oe("could not be read as UTF-8 text")}finally{s.cancel().catch(()=>{})}},Jl=101010256,ec=33639248,tc=67324752,Do=22,nc=65535,qn=46,Bn=30,rc=1,Hn=0,oc=8,sc=65535,$e=4294967295,ac=new TextDecoder("utf-8"),le=e=>{throw new ne("not-workbook",`the ZIP package ${e}`)},ic=e=>{const t=e.byteLength-Do,n=Math.max(0,t-nc);for(let r=t;r>=n;r-=1)if(e.getUint32(r,!0)===Jl)return r;return le("has no end of central directory record")},lc=e=>{if(e.byteLength<Do)return le("is shorter than its end record");const t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=ic(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 le("spans several disks");if(s===sc||a===$e||i===$e)return le("is a ZIP64 package");if(i+a>n)return le("has a central directory past its end record");const m=new Map;let p=i;for(let g=0;g<s;g+=1){if(p+qn>n||t.getUint32(p,!0)!==ec)return le("has a malformed central directory");const f=t.getUint16(p+8,!0),w=t.getUint16(p+10,!0),h=t.getUint32(p+20,!0),v=t.getUint32(p+24,!0),E=t.getUint16(p+28,!0),x=t.getUint16(p+30,!0),b=t.getUint16(p+32,!0),L=t.getUint32(p+42,!0),N=p+qn;if(N+E>n)return le("has a name past its central directory");const C=ac.decode(e.subarray(N,N+E));if(h===$e||v===$e||L===$e)return le("has a ZIP64 entry");if(!C.endsWith("/")){if(m.has(C))return le(`names ${C} twice`);m.set(C,{name:C,encrypted:(f&rc)!==0,method:w,compressedSize:h,uncompressedSize:v,localHeaderOffset:L})}p=N+E+x+b}return{bytes:e,entries:m}},cc=(e,t)=>{const{bytes:n}=e,r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=t.localHeaderOffset;if(o+Bn>n.byteLength||r.getUint32(o,!0)!==tc)return le(`has no local header for ${t.name}`);const s=o+Bn+r.getUint16(o+26,!0)+r.getUint16(o+28,!0),a=s+t.compressedSize;return a>n.byteLength?le(`has the data of ${t.name} past its end`):{start:s,end:a}},No=e=>new ReadableStream({start(t){e.byteLength>0&&t.enqueue(e),t.close()}}),dc=e=>No(e).pipeThrough(new DecompressionStream("deflate-raw")),uc=(e,t)=>{let n=0;return new TransformStream({transform(r,o){if(n+=r.byteLength,n>t){o.error(new ne("too-large",`${e} inflates past ${t} bytes`));return}o.enqueue(r)}})},ze=(e,t,n)=>{const r=e.entries.get(t);if(r===void 0)return null;if(r.encrypted)throw new ne("encrypted",`${t} is encrypted`);if(r.method!==Hn&&r.method!==oc)return le(`compresses ${t} with method ${r.method}`);if(r.uncompressedSize>n)throw new ne("too-large",`${t} declares ${r.uncompressedSize} bytes`);const{start:o,end:s}=cc(e,r),a=e.bytes.subarray(o,s);return(r.method===Hn?No(a):dc(a)).pipeThrough(uc(t,n))},vt=async(e,t,n)=>{const r=ze(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 ne)throw i;return le(`has ${t}, which does not inflate to UTF-8 text`)}finally{s.releaseLock()}},Un="content.xml",fc="META-INF/manifest.xml",jo=e=>{throw new ne("not-workbook",`the spreadsheet ${e}`)},Vn=(e,t)=>ze(e,Un,t.maxPartBytes)??jo(`has no ${Un}`),mc=async(e,t)=>{const n=ze(e,fc,t.maxPartBytes);if(n===null)return!1;let r=!1;return await Ye(n,{start:o=>{o==="encryption-data"&&(r=!0)}},()=>r),r},hc=async e=>{const t=[],n=new Set;let r=null,o=0;return await Ye(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}},jt=e=>{const t=Number(e);return Number.isInteger(t)&&t>0?t:1},pc=async(e,t,n)=>{const r=So(n);let o=0,s=0,a=!1,i=!1,m=0,p=1,g=new Map,f=0,w=null;return await Ye(e,{start:(h,v,E)=>{if(h==="table"){s===0&&(a=o===t,o+=1),E||(s+=1);return}!a||s!==1||(h==="table-row"?(p=jt(v.get("number-rows-repeated")),g=new Map,f=0):h==="table-cell"||h==="covered-table-cell"?w={repeat:jt(v.get("number-columns-repeated")),covered:h==="covered-table-cell",parts:[],paragraphs:0,paragraphDepth:0,annotationDepth:0}:w!==null&&w.annotationDepth===0&&(h==="annotation"&&!E?w.annotationDepth+=1:h==="p"||h==="h"?(w.paragraphs>0&&w.parts.push(`
|
|
12
|
+
`),ra=3,oa=/^\d+(?:\.\d+)?$/u,sa=e=>{if(e===null||!oa.test(e))return null;const t=Number(e);return t>=z.EDIT_SPLIT_MIN_PERCENT&&t<=z.EDIT_SPLIT_MAX_PERCENT?t:null},Ie=Object.freeze({kind:"idle"}),Ct=Object.freeze({kind:"draft"}),aa=({data:e,conflictLabels:t,onSaveSettled:n,sideBySideSetting:r,editorShareSetting:o})=>{const s=new Map,a=new Map,i=new Map,m=new Map,p=new Map,g=je();let f=null,w=null,h=null;const v=new Set,E=new Set;let y=!1;const b=(u,d)=>{u.value={...u.value,...d},g.emit()},L=u=>{const d=s.get(u);return d===void 0||d.base===null||!d.value.dirty?null:{path:u,base:{text:d.base.text,version:d.base.version},draft:d.draft,lineEnding:d.ending}},N=()=>{y=!1;const u=[...E];E.clear();for(const d of v){const k=d.first?new Set([...s.keys(),...u]):u;d.first=!1;const T=[],O=[];for(const $ of k){const x=L($);x!==null?(T.push(x),d.kept.add($)):d.kept.delete($)&&O.push($)}(T.length>0||O.length>0)&&d.listener({kept:T,ended:O})}},C=()=>{y||(y=!0,queueMicrotask(N))},M=u=>{E.add(u),C()},_=(u,d)=>s.get(u)===d,I=async(u,d)=>{d.controller.abort(),d.controller=new AbortController;const{signal:k}=d.controller;b(d,{phase:{kind:"opening"}});const T=await e.edit(u,k);if(!_(u,d)||k.aborted||!("kind"in T))return;if(T.kind==="grant"){b(d,{phase:{kind:"grant",href:T.href}});return}if(T.kind==="failure"){b(d,{phase:{kind:"failed",failure:T.failure}});return}const O=nt(T.text),$=T.kind==="draft";d.base={text:O,version:$?null:T.version},d.draft=O,d.ending=Rt(T.text),M(u),b(d,{phase:{kind:"editing"},history:$?!1:T.history,dirty:!1,save:$?Ct:Ie,generation:d.value.generation+1})},H=u=>{const d=s.get(u);d!==void 0&&(d.controller.abort(),s.delete(u),i.delete(u),M(u))},j=(u,d,k)=>(u.set(d,k),()=>{u.get(d)===k&&u.delete(d)}),U=(u,d,k,T={})=>{b(d,{...T,save:k}),n(u,k)},Z=async u=>{m.get(u)?.flush();const d=s.get(u);if(d===void 0||d.value.phase.kind!=="editing"||d.base===null||d.value.save.kind==="saving")return;const{version:k}=d.base;if(k===null){n(u,Ct);return}const T=Tn(d.draft).length;if(T>0){U(u,d,{kind:"conflicts",count:T});return}d.controller.abort(),d.controller=new AbortController;const{signal:O}=d.controller;let $={text:d.base.text,version:k},x=d.draft,S=!1;b(d,{save:{kind:"saving"}});for(let A=0;A<ra;A+=1){const D=await e.save(u,$.version,na(x,d.ending),O);if(!_(u,d)||O.aborted||!("kind"in D))return;if(D.kind==="saved"){m.get(u)?.flush(),d.base={text:x,version:D.version},M(u),U(u,d,{kind:"saved",merged:S},{dirty:d.draft!==x});return}if(D.kind==="grant"){U(u,d,{kind:"grant",href:D.href});return}if(D.kind==="failure"){U(u,d,{kind:"failed",failure:D.failure});return}const{mergeDraft:q}=await Promise.resolve().then(()=>require("./merge-hFiGx_ND.cjs"));if(!_(u,d)||O.aborted)return;const Y=m.get(u);Y?.flush();const J=nt(D.text),W=q($.text,d.draft,J,t());if($={text:J,version:D.version},d.base=$,d.ending=Rt(D.text),d.draft=W.text,M(u),Y?.adopt(W.text),W.kind==="conflicts"){U(u,d,{kind:"conflicts",count:W.conflicts},{dirty:!0,generation:d.value.generation+1});return}if(S=!0,x=W.text,x===$.text){U(u,d,{kind:"saved",merged:S},{dirty:!1,generation:d.value.generation+1});return}b(d,{dirty:!0,generation:d.value.generation+1})}U(u,d,{kind:"failed",failure:{reason:"failed"}})},K=async(u,d)=>{if(d.kind==="failure")return{restored:!1,reason:d.failure.reason};if(d.kind==="grant")return{restored:!1,reason:"forbidden"};const k=nt(d.text);let T,O,$;if(d.kind==="draft")T={text:k,version:null},O=u.draft,$=Ct;else if(u.base.version===d.version)T={text:k,version:d.version},O=u.draft,$=Ie;else{const{mergeDraft:x}=await Promise.resolve().then(()=>require("./merge-hFiGx_ND.cjs")),S=x(u.base.text,u.draft,k,t());T={text:k,version:d.version},O=S.text,$=S.kind==="conflicts"?{kind:"conflicts",count:S.conflicts}:Ie}if(s.has(u.path))return{restored:!1,reason:"failed"};if(O!==T.text){const x=d.kind==="edit"&&d.history;s.set(u.path,{value:{path:u.path,phase:{kind:"editing"},view:"editor",previewPrepared:!1,history:x,dirty:!0,save:$,generation:1,request:null},base:T,draft:O,ending:Rt(d.text),controller:new AbortController}),M(u.path),g.emit()}return{restored:!0}};return{session:u=>s.get(u)?.value,subscribe:g.subscribe,start:(u,d)=>{const k=s.get(u);if(k!==void 0){b(k,{request:{anchor:d},view:"editor"}),(k.value.phase.kind==="failed"||k.value.phase.kind==="grant")&&I(u,k);return}a.delete(u);const T={value:{path:u,phase:{kind:"opening"},view:"editor",previewPrepared:!1,history:!1,dirty:!1,save:Ie,generation:0,request:{anchor:d}},base:null,draft:"",ending:`
|
|
13
|
+
`,controller:new AbortController};s.set(u,T),I(u,T)},retry:u=>{const d=s.get(u);d===void 0||d.value.phase.kind==="editing"||I(u,d)},draft:u=>{const d=s.get(u);return d===void 0||d.base===null?null:d.draft},setDraft:(u,d)=>{const k=s.get(u);if(k===void 0||k.base===null)return;d!==k.draft&&M(u),k.draft=d;const T={},O=d!==k.base.text;O!==k.value.dirty&&(T.dirty=O);const{save:$}=k.value;if($.kind==="conflicts"){const x=Tn(d).length;x===0?T.save=Ie:x!==$.count&&(T.save={kind:"conflicts",count:x})}(T.dirty!==void 0||T.save!==void 0)&&b(k,T)},consumeRequest:u=>{const d=s.get(u);d!==void 0&&d.value.request!==null&&b(d,{request:null})},save:Z,replaceDraft:(u,d)=>{const k=m.get(u);k?.flush();const T=s.get(u);if(T===void 0||T.base===null)return;const O=nt(d);O!==T.draft&&M(u),T.draft=O,k?.adopt(O),b(T,{dirty:O!==T.base.text,generation:T.value.generation+1})},close:u=>{if(!s.has(u))return;const d=m.get(u),k=d===void 0?null:d.returnPoint();H(u),k===null?a.delete(u):a.set(u,k),g.emit()},takeReturn:u=>{const d=a.get(u)??null;return a.delete(u),d},dirtyPaths:()=>[...s.values()].filter(u=>u.value.dirty).map(u=>u.value.path),discard:u=>{for(const d of u)H(d);u.length>0&&g.emit()},editorState:{get:u=>i.get(u),set:(u,d)=>{s.has(u)&&i.set(u,d)}},bindEditor:(u,d)=>j(m,u,d),bindView:(u,d)=>j(p,u,d),viewAnchor:u=>{const d=p.get(u);return d===void 0?null:d.anchor()},flush:u=>m.get(u)?.flush(),flushDrafts:()=>{for(const u of m.values())u.flush()},nextConflict:u=>m.get(u)?.nextConflict()===!0,hasSessions:()=>s.size>0,unsavedAmong:u=>{for(const d of m.values())d.flush();return u.filter(d=>s.get(d)?.value.dirty===!0)},askToDiscard:u=>new Promise(d=>{h?.settle(!1);const k={paths:u,settle:T=>{if(h===k){if(h=null,T)for(const O of u)H(O);g.emit(),d(T)}}};h=k,g.emit()}),discardRequest:()=>h,subscribeDrafts:u=>{const d={listener:u,kept:new Set,first:!0};return v.add(d),C(),()=>{v.delete(d)}},restoreDrafts:async u=>{const{signal:d}=new AbortController,k=await Promise.all(u.map(async $=>{const x=await e.edit($.path,d);if(!("kind"in x))throw new Error("[markdown-explorer] the transport answered a restore read as cancelled, though nothing aborted it");return{draft:$,answer:x}})),T=[],O=[];for(const{draft:$,answer:x}of k){const S=await K($,x);S.restored?T.push($.path):O.push({path:$.path,reason:S.reason})}return{restored:T,failed:O}},sideBySide:()=>(f??=r.read(),f),setSideBySide:u=>{f!==u&&(f=u,r.write(u),g.emit())},editorShare:()=>(w??=o.read()??z.EDIT_SPLIT_DEFAULT_PERCENT,w),setEditorShare:u=>{if(!Number.isFinite(u))throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${V.describeValue(u)}`);const d=Math.min(z.EDIT_SPLIT_MAX_PERCENT,Math.max(z.EDIT_SPLIT_MIN_PERCENT,u));w!==d&&(w=d,o.write(d))},setView:(u,d)=>{const k=s.get(u);k===void 0||k.value.view===d||(m.get(u)?.beforeView(d),b(k,{view:d,previewPrepared:k.value.previewPrepared||d==="preview"}))},preparePreview:u=>{const d=s.get(u);d!==void 0&&!d.value.previewPrepared&&b(d,{previewPrepared:!0})}}},tn=e=>{e.preventDefault(),e.stopPropagation()},Cr=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,Mr="data-aqmx-content-pane",ut=Object.freeze({[Mr]:""}),ia="--aqmx-dialog-left",la="--aqmx-dialog-top",ca='[data-testid="markdown-explorer"]',da=e=>{const t=e.closest(ca)?.querySelectorAll(`[${Mr}]`),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},ua=e=>{const t=Cr(getComputedStyle(e).marginTop);if(Number.isNaN(t))return null;const n=da(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(ia,`${String(s)}px`),e.style.setProperty(la,`${String(a)}px`),n},fa=e=>e.preventDefault(),Lr=({open:e,onOpen:t,onDismiss:n})=>{const r=l.useRef(null),o=l.useRef(null),s=l.useRef(!1),a=l.useRef(t);l.useLayoutEffect(()=>{a.current=t},[t]),l.useLayoutEffect(()=>{s.current=e;const g=r.current;if(g!==null)if(e&&!g.open){const f=g.ownerDocument.activeElement;o.current=f instanceof HTMLElement?f:null,g.showModal(),a.current?.()}else!e&&g.open&&(g.close(),o.current?.isConnected===!0&&o.current.focus(),o.current=null)},[e]),l.useLayoutEffect(()=>{const g=r.current;if(!e||g===null)return;const f=new ResizeObserver(()=>h());let w=null;const h=()=>{const E=ua(g);E===null||E===w||(w!==null&&f.unobserve(w),f.observe(E),w=E)};h(),f.observe(g);const v=g.ownerDocument.defaultView;return v?.addEventListener("resize",h),g.ownerDocument.addEventListener("scroll",h,{capture:!0,passive:!0}),()=>{f.disconnect(),v?.removeEventListener("resize",h),g.ownerDocument.removeEventListener("scroll",h,{capture:!0})}},[e]);const i=l.useCallback(g=>{g.key!=="Escape"||g.defaultPrevented||(tn(g),n())},[n]),m=l.useCallback(g=>{g.target===g.currentTarget&&n()},[n]),p=l.useCallback(()=>{s.current&&n()},[n]);return{ref:r,onKeyDown:i,onClick:m,onCancel:fa,onClose:p}},nn=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:a,testId:i})=>{const m=l.useRef(null),p=l.useId(),g=l.useId(),f=l.useCallback(()=>m.current?.focus(),[]),w=Lr({open:e,onOpen:f,onDismiss:a});return c.jsx("dialog",{...w,className:"aqmx-confirm","aria-labelledby":p,"aria-describedby":g,"data-testid":i,children:c.jsxs("div",{className:"aqmx-confirm-panel",children:[c.jsx("p",{id:p,className:"aqmx-confirm-title",children:t}),c.jsx("p",{id:g,className:"aqmx-confirm-body",children:n}),c.jsxs("div",{className:"aqmx-confirm-actions",children:[c.jsx("button",{ref:m,type:"button",className:"aqmx-callout-action","data-testid":`${i}-cancel`,onClick:a,children:o}),c.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${i}-confirm`,onClick:s,children:r})]})]})})},Ue=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},Or=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),Be=e=>e.status==="fulfilled"?e.value:void 0,Ar=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!1}),ma=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!0}),ha=(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},Dr=(e,t,n)=>{const r=Be(e.read(t));if(r===void 0||r.status==="deferred")return Ar;if(r.status==="error")return{readme:{status:"failed",failure:r.failure,retry:()=>e.retry(t)},claim:!1};const o=ha(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"?ma: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}},pa=(e,t,n)=>{const{readme:r}=Dr(e,t,n);return r.status==="ok"?r.readme:null},wa=(e,t,n)=>{const r=re.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)}},Nr=e=>{const{edits:t}=F(),n=l.useCallback(()=>t.session(e),[t,e]);return l.useSyncExternalStore(t.subscribe,n,ga)},jr=()=>!1,ga=()=>{},va=()=>{const{edits:e}=F();return l.useSyncExternalStore(e.subscribe,e.hasSessions,jr)},Pr=()=>{const{edits:e}=F();return l.useSyncExternalStore(e.subscribe,e.sideBySide,jr)},Ea=()=>null,xa=()=>{const{edits:e,labels:t,config:n,trees:r,guardUnload:o}=F(),s=l.useRef([]),a=l.useCallback(({nextLocation:v})=>{const E=wa(n,v,(y,b)=>pa(r,y,b));return e.flushDrafts(),s.current=e.dirtyPaths().filter(y=>!E.has(y)),s.current.length>0},[e,n,r]),i=re.useBlocker(a),m=va();l.useEffect(()=>{if(!(m&&o))return;const v=E=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(E.preventDefault(),E.returnValue=!0)};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[m,e,o]);const p=l.useSyncExternalStore(e.subscribe,e.discardRequest,Ea),g=i.state==="blocked";l.useEffect(()=>{p!==null&&i.state==="blocked"&&i.reset()},[p,i]);const f=p!==null?p.paths:g?s.current:[],w=f.map(v=>P.lastPathSegment(v)).join(", "),h=f.length>0&&f.every(v=>e.session(v)?.save.kind==="draft");return c.jsx(nn,{open:g||p!==null,title:h?t.draftDiscardTitle:t.unsavedTitle,body:h?t.draftDiscardBody(w):t.unsavedBody(w),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(p!==null){p.settle(!0);return}i.state==="blocked"&&(e.discard(s.current),i.proceed())},onCancel:()=>{if(p!==null){p.settle(!1);return}i.state==="blocked"&&i.reset()}})},ya=async(e,t)=>{const n=await t.documents.refresh(e);if(n.status==="refreshed"||n.status==="shown"&&!n.failed){t.announcer.announce(t.labels.documentReloadedAfterChange(t.nameOf(e)));return}n.status==="failed"&&t.documentChanges.mark([e])},ba=(e,t)=>{ks(e);for(const r of e.sourceIds)t.trees.reloadSource(r);const n=[];for(const r of e.paths){if(t.documents.noteChanged(r),t.edits.session(r)!==void 0||!t.documentChanges.shown(r))continue;const o=t.documents.peek(r);o?.status!=="loaded"||o.document.kind==="failure"||(t.policy==="notify"?n.push(r):ya(r,t))}n.length>0&&t.documentChanges.mark(n)};function ka({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Sa=R.forwardRef(ka);let Mt=null;const _r=()=>(Mt??=Promise.resolve().then(()=>require("./EditSurface-Ce4bpuvh.cjs")).catch(e=>{throw Mt=null,e}),Mt),Ta=()=>{_r().catch(()=>{})},Ra=e=>{const{default:t}=l.use(_r());return c.jsx(t,{...e})};class Ca extends l.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 Ir="[data-aqmd-fullscreen]",Ma="[data-aqmd-fullscreen-dialog]:modal",La=e=>e instanceof Element&&e.closest(Ir)!==null,Oa=e=>e.querySelector(Ma)!==null,rn=`[${Bt.SOURCE_LINES_ATTRIBUTE}]`,Aa="[data-aqmd-content]",Da=`a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], ${Ir}, [data-aqmd-svg-image-source]`,Na=200,Ve=e=>Bt.parseSourceLines(e.getAttribute(Bt.SOURCE_LINES_ATTRIBUTE)),ja=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=Ve(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(rn)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=Ve(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},Pa=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},Fr=e=>e.closest(Aa)!==null&&e.closest(Da)===null,$r=(e,t,n)=>{const r=ja(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:ft(e)}}const a=_a(o,n);return a===null?{lines:r.lines,word:null,occurrence:0,clientTop:ft(o)}:{lines:r.lines,word:a.text,occurrence:a.occurrence,clientTop:a.clientTop}},qr=(e,t)=>{let n=null,r=null,o=null;for(const a of e.querySelectorAll(rn)){const i=Ve(a);if(i===null)continue;n??=Hr(t,a);const{top:m,bottom:p}=a.getBoundingClientRect();m<=n&&n<p?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:ft(s.block)}},Br=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,Hr=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return Br(e)+(Number.isFinite(n)?n:0)},_a=(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>Na||/[\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:Pa(o.toString(),r),clientTop:n.getBoundingClientRect().top}},Ia=(e,t)=>{const n=e.split(`
|
|
14
|
+
`),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 p=m.indexOf(t.word);p>=0;p=m.indexOf(t.word,p+t.word.length)){if(a===t.occurrence)return{line:i,column:p};a+=1}}return a>0?Fa(n,r,o,t.word)??s:s},Fa=(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},Ur=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(rn)){const s=Ve(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},Vr=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=ft(e),o=Ve(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},ft=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},Fe=(e,t)=>Object.freeze({replace:t.replace,preventScrollReset:t.preventScrollReset,defaultShouldRevalidate:!1,state:Object.freeze({aqmxNavigation:e})}),Et=Object.freeze({browse:Fe("browse",{replace:!0,preventScrollReset:!0}),"close-folder":Fe("close-folder",{replace:!0,preventScrollReset:!0}),"switch-source":Fe("switch-source",{replace:!1,preventScrollReset:!0}),"switch-view":Fe("switch-view",{replace:!1,preventScrollReset:!1}),"follow-link":Fe("follow-link",{replace:!1,preventScrollReset:!1})}),$a=Object.freeze(Object.keys(Et)),qa=e=>Et[e],Ba=(e,t)=>{if(e===re.NavigationType.Pop||typeof t!="object"||t===null||!("aqmxNavigation"in t))return null;const{aqmxNavigation:n}=t;return $a.find(r=>r===n)??null},Se=()=>{const e=re.useNavigate();return l.useCallback((t,n)=>{e(t,Et[n])},[e])},zr=({navigation:e,...t})=>c.jsx(re.Link,{...t,...Et[e]}),on=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},Gr=(e,t)=>{const n=l.useRef(null),r=l.useRef(null),o=l.useRef(null),s=l.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);l.useEffect(()=>s,[s]);const a=l.useCallback(p=>{if(r.current!==p)return;const g=o.current;if(g!==null){g.then(()=>a(p));return}e.prefetch(p);const f=e.peek(p);if(f?.status!=="pending")return;const w=Promise.allSettled([f.promise]);o.current=w,w.then(()=>{o.current===w&&(o.current=null)})},[e]),i=l.useCallback(p=>{const g=t(p);g!==r.current&&(s(),g!==null&&(r.current=g,n.current=window.setTimeout(()=>{n.current=null,a(g)},z.PREFETCH_DWELL_MS)))},[s,t,a]),m=l.useCallback(p=>{t(p)!==r.current&&s()},[s,t]);return l.useMemo(()=>({onPointerOver:p=>i(p.target),onPointerOut:p=>m(p.relatedTarget),onFocus:p=>i(p.target),onBlur:p=>m(p.relatedTarget)}),[i,m])},Ha=l.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-BQpaWt45.cjs")).then(e=>({default:e.NativeScrollBar})));class Ua extends l.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 Zr=({scroller:e,kind:t})=>c.jsx(Ua,{children:c.jsx(l.Suspense,{fallback:null,children:c.jsx(Ha,{scroller:e,kind:t})})}),Wr=e=>c.jsx(Zr,{scroller:e,kind:"content"}),Kr=Object.freeze({showArrowButtons:!0,enableThumbDrag:!0,enableTrackClick:!0}),Xr=Object.freeze({showArrowButtons:!1,enableThumbDrag:!1,enableTrackClick:!1}),sn=e=>e?Xr:Kr,Va=8,za="--aqmx-scroll-bar-slot-size",an=`var(${za})`,ln=z.CONTROL_BLOCK_PIXELS,Ga=z.FIBONACCI_SPACING_PIXELS[3],Za="--aqmx-tap-circle-gutter-size",cn=`var(${Za})`,Wa=-(ln+Ga),Yr=Object.freeze({minSpeedMultiplier:.25,maxSpeedMultiplier:18});let Qr=null,Lt=null;const Wt=new Set,Ka=e=>(Wt.add(e),()=>{Wt.delete(e)}),Xa=()=>{Lt===null&&(Lt=Promise.resolve().then(()=>require("./tapScrollCircle-DDwYa54Q.cjs")).then(e=>{const t=e.TAP_SCROLL_CIRCLE.renderVisual;if(t===void 0)throw new TypeError("[markdown-explorer] the bars' tap-scroll circle has no look to share");Qr=t;for(const n of[...Wt])n()}).catch(e=>{Lt=null,console.error("[markdown-explorer] the look of a table's tap-scroll circle failed to load; the circle still scrolls without it.",e)}))},Ya=({look:e,state:t})=>e(t),Qa=e=>{const t=l.useSyncExternalStore(Ka,()=>Qr,()=>null);return l.useEffect(()=>{t===null&&Xa()},[t]),t===null?null:c.jsx(Ya,{look:t,state:e})},Jr=Object.freeze({renderVisual:e=>c.jsx(Qa,{...e}),...Yr,size:ln}),Ja=Object.freeze({...Jr,visibility:"scrolling"}),eo=e=>e?Ja:Jr,to="(pointer: coarse)",ei=e=>{const t=window.matchMedia(to);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},ti=()=>window.matchMedia(to).matches,ni=()=>!1,dn=()=>l.useSyncExternalStore(ei,ti,ni),no=()=>{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()]}},mt=(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)=>mt(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)&&mt(n[s],r[s]))},ri=55e3,Rn=Object.freeze({status:"deferred"}),Ot=Object.freeze({status:"refreshed"}),At=Object.freeze({status:"shown",failed:!1}),rt=Object.freeze({status:"shown",failed:!0}),ot=Object.freeze({status:"superseded"}),we=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,oi=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",si=({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 ${V.describeValue(t)}`);const n=new Map,r=no(),o=je(),s=new WeakSet,a=new Map,i=new Map,m=new Map;let p=0;const g=o.emit,f=()=>(p+=1,p),w=()=>{if(!(n.size<=t))for(const u of[...n.keys()]){if(n.size<=t)return;r.isHeld(u)||n.delete(u)}},h=(u,d)=>{n.delete(u),n.set(u,d)},v=u=>performance.now()-u.validatedAt>=ri,E=(u,d,k)=>{const T=n.get(u),O=we(T?.snapshot),$=k||T?.refreshPending===!0,x=Ue(e.document(u,{refresh:$}).then(A=>({status:"loaded",document:A}))),S={snapshot:{status:"pending",promise:x,previous:O},validatedAt:performance.now(),opened:d,background:null,refreshPending:!1,seeded:void 0,stamp:f()};return h(u,S),w(),x.then(A=>{n.get(u)===S&&(S.snapshot=A,S.stamp=f(),g())}),S},y=(u,d,k,T,O,$)=>{d.background===k&&(d.background=null,!(n.get(u)!==d||d.snapshot!==T)&&(O.kind==="failure"&&T.document.kind!=="failure"||(d.validatedAt=$,d.stamp=f(),mt(T.document,O)||(d.snapshot={status:"loaded",document:O}),g())))},b=async(u,d)=>{const k=d.snapshot;if(k.status!=="loaded")return null;const T={};d.background=T;const O=performance.now(),$=e.document(u,{refresh:d.refreshPending});d.refreshPending=!1;const x=await $,S=d.background===T&&n.get(u)===d&&d.snapshot===k;return y(u,d,T,k,x,O),S?x:null},L=u=>{u.validatedAt=Number.NEGATIVE_INFINITY,u.opened=!0,u.refreshPending=!0},N=u=>{u.background=null},C=(u,d)=>{const{snapshot:k}=d;return k.status==="pending"?!1:k.status==="loaded"&&k.document.kind!=="failure"?(b(u,d),!1):(k.status==="loaded"&&s.add(k),E(u,!0,!1),!0)},M=u=>{i.delete(u);const d=m.get(u);if(d!==void 0){m.delete(u);for(const k of d)k()}},_=(u,d)=>new Promise(k=>{if(i.get(u)===d||!r.isHeld(u)){k();return}const T=m.get(u);T===void 0?m.set(u,new Set([k])):T.add(k)}),I=(u,d)=>{const k=a.get(u);if(k===void 0){d.resolve(null);return}if(k.last!==null&&k.last.stamp>=d.stamp){d.resolve(k.last);return}k.waiters.add(d)},H=async(u,d,k)=>{const T=await new Promise(O=>I(u,{stamp:d.stamp,resolve:O}));if(n.get(u)!==d)return ot;if(T===null)return k?Ot:At;if(!k)return T.failure===null?At:rt;switch(T.before){case"copy":return T.failure===null?Ot:{status:"failed",failure:T.failure};case"failure":return T.failure===null?At:rt;case"none":return T.failure===null?Ot:rt}},j=u=>{const d={showing:"none",last:null,waiters:new Set};a.set(u,d);let k=!1;return{settle:(T,O)=>{if(k||T===void 0)return;const $={stamp:T,failure:O,before:d.showing};d.last=$,O===null?d.showing="copy":d.showing==="none"&&(d.showing="failure");for(const x of[...d.waiters])T<x.stamp||(d.waiters.delete(x),x.resolve($))},release:()=>{if(k)return;k=!0,a.get(u)===d&&a.delete(u);const T=[...d.waiters];d.waiters.clear(),T.length>0&&queueMicrotask(()=>{for(const O of T)I(u,O)})}}},U=u=>{const d=r.hold(u);let k=!1;return()=>{if(k)return;k=!0,d();const T=n.get(u);T!==void 0&&h(u,T),w(),r.isHeld(u)||queueMicrotask(()=>{r.isHeld(u)||M(u)})}};return{peek:u=>n.get(u)?.snapshot,peekSeeded:u=>n.get(u)?.seeded,answerStampOf:u=>n.get(u)?.stamp,prefetch:u=>{const d=n.get(u);d!==void 0&&d.snapshot.status!=="deferred"||(E(u,!1,!1),g())},open:u=>{const d=r.resumes(u),k=U(u),T=n.get(u);if(T===void 0||T.snapshot.status==="deferred")return E(u,!0,!1),g(),k;if(h(u,T),d)return k;const{snapshot:O}=T;return O.status==="pending"?(T.opened=!0,k):O.document.kind==="failure"?(T.opened||v(T)?(s.add(O),E(u,!0,!1),g()):T.opened=!0,k):(T.opened=!0,T.background===null&&v(T)&&b(u,T),k)},retain:U,retry:u=>{const d=n.get(u);d===void 0||d.snapshot.status!=="loaded"||d.snapshot.document.kind!=="failure"||(E(u,!0,!1),g())},seed:(u,d)=>{const k=performance.now(),T=Ue(d.then(A=>A===null?Rn:{status:"loaded",document:A},()=>Rn)),O=n.get(u);if(O!==void 0&&O.snapshot.status==="loaded"){const A=O.snapshot,D={};O.background=D,T.then(q=>{if(q.status==="loaded"){y(u,O,D,A,q.document,k);return}O.background===D&&(O.background=null)});return}const $=O!==void 0&&O.snapshot.status==="pending"?O.snapshot.previous:null,x={status:"pending",promise:T,previous:$},S={snapshot:x,validatedAt:k,opened:O?.opened===!0,background:null,refreshPending:O?.refreshPending===!0,seeded:x,stamp:f()};h(u,S),w(),T.then(A=>{n.get(u)===S&&(A.status==="deferred"&&r.isHeld(u)?E(u,S.opened,!1):(S.snapshot=A,S.stamp=f()),g())})},invalidate:()=>{let u=!1;for(const[d,k]of[...n]){if(L(k),!r.isHeld(d)){N(k);continue}const{snapshot:T}=k;if(T.status!=="pending"){C(d,k)&&(u=!0);continue}T.promise.then(()=>{n.get(d)===k&&k.refreshPending&&r.isHeld(d)&&C(d,k)&&g()})}u&&g()},noteChanged:u=>{const d=n.get(u);if(d===void 0)return;if(L(d),!r.isHeld(u)){N(d);return}const{snapshot:k}=d;if(k.status==="pending"){E(u,d.opened,!0),g();return}k.status==="loaded"&&k.document.kind==="failure"&&(s.add(k),E(u,!0,!1),g())},refresh:async u=>{const d=n.get(u);if(d!==void 0&&oi(d.snapshot)){d.refreshPending=!0;const O=await b(u,d);return O===null?ot:O.kind==="failure"?{status:"failed",failure:O.failure}:H(u,d,!0)}const k=E(u,!0,!0);if(g(),k.snapshot.status!=="pending")return ot;const T=await k.snapshot.promise;return n.get(u)!==k||T.status!=="loaded"?ot:T.document.kind==="failure"?rt:(await _(u,T),H(u,k,!1))},clear:()=>{n.clear();for(const u of r.heldKeys())E(u,!0,!1);g()},subscribe:o.subscribe,readPart:j,noteShown:(u,d)=>{i.set(u,d);const k=m.get(u);if(k!==void 0){m.delete(u);for(const T of k)T()}},noteFailureShown:u=>s.has(u)?!1:(s.add(u),!0)}},be=l.createContext("fill"),ai="--aqmx-tap-circle-gutter",ii=Object.freeze({blockSize:"100%",[ai]:cn}),We=({scrollerProps:e,children:t})=>l.use(be)==="content"?c.jsx(Ne.HostedScrollArea,{scrollerProps:e,children:t}):c.jsx(Ne.HostedScrollArea,{scrollerProps:{...e,style:ii},rowClassName:"aqmx-document-scroll-row",renderScrollBar:Wr,barInlineSize:an,children:t}),li=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),ci=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),ke=({label:e,testId:t})=>c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":t,children:li.map(n=>c.jsx("span",{},n))}),c.jsx("p",{className:"aqmx-sr-only",children:e})]}),ht=({failure:e,onRetry:t,testId:n,text:r,deniedSentence:o})=>c.jsx(We,{scrollerProps:ci,children:c.jsx(ye,{failure:e,alert:!1,onRetry:t,testId:n,text:r,deniedSentence:o})});function di({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 ui=R.forwardRef(di);function fi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 mi=R.forwardRef(fi);function hi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 ro=R.forwardRef(hi),pi=2e3,Cn=Object.freeze({outcome:"idle",message:null}),oo=()=>{const{announcer:e}=F(),[t,n]=l.useState(Cn),r=l.useRef(0);l.useEffect(()=>{if(t.outcome==="idle")return;const s=setTimeout(()=>n(Cn),pi);return()=>clearTimeout(s)},[t]);const o=l.useCallback(()=>{r.current+=1;const s=r.current;return(a,i)=>{r.current===s&&(n({outcome:a,message:i}),e.announce(i))}},[e]);return{shown:t,press:o}},wi=(e,t)=>new Promise(n=>n(e.writeText(t))),gi=({text:e})=>{const{labels:t}=F(),{shown:n,press:r}=oo(),o=()=>{const a=r(),i=navigator.clipboard;if(i===void 0){a("failed",t.copyTextFailed);return}wi(i,e).then(()=>a("copied",t.copiedText),m=>{console.error("[markdown-explorer] could not copy the text",m),a("failed",t.copyTextFailed)})},s=n.message===null?t.copyText:n.message;return c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.copyText,title:s,onClick:o,"data-aqmx-copy-outcome":n.outcome,"data-testid":"markdown-explorer-file-copy",children:n.outcome==="copied"?c.jsx(ui,{}):n.outcome==="failed"?c.jsx(ro,{}):c.jsx(mi,{})})},so=l.createContext(null),vi=()=>{const e=l.use(so);if(e===null)throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");return e},Ei=new Set,ao=(e,t,n)=>{const{documents:r,announcer:o,labels:s}=F(),a=l.useCallback(()=>r.peek(e),[r,e]),i=l.useCallback(()=>r.peekSeeded(e),[r,e]),m=l.useSyncExternalStore(r.subscribe,a,i),p=l.useCallback(()=>r.answerStampOf(e),[r,e]),g=l.useSyncExternalStore(r.subscribe,p,p),[f]=l.useState(()=>new Set),[w,h]=l.useState(Ei),[v,E]=l.useState(null);v!==null&&(v.path!==e||v.markup!==n)&&E(null);const y=l.useRef(null);l.useLayoutEffect(()=>(y.current=e,()=>{y.current=null}),[e]);const b=l.useRef(n);l.useLayoutEffect(()=>{b.current=n},[n]);const L=l.useCallback(()=>{const M=e,_=r.peek(M);f.has(M)||_?.status==="pending"||(f.add(M),h(new Set(f)),E(null),(async()=>{try{const I=await r.refresh(M);if(y.current!==M||I.status==="superseded")return;if(I.status==="failed"){E({path:M,failure:I.failure,stamp:r.answerStampOf(M),markup:b.current});const{reason:j}=I.failure;ie(j)||o.announce(s.documentRefreshFailed(ce(s,j)));return}if(I.status==="shown"&&(t||I.failed))return;const H=we(r.peek(M));if(H===null||H.document.kind==="failure")return;o.announce(s.documentRefreshed(H.document.name))}finally{f.delete(M),h(new Set(f))}})())},[e,t,f,r,o,s]),N=w.has(e),C=v!==null&&v.path===e&&v.stamp===g&&v.markup===n?v.failure:null;return{refreshing:N,unavailable:N||m?.status==="pending",failure:C,refresh:L}},xi=(e,t)=>e.length===t.length&&e.every((n,r)=>n===t[r]),yi=(e,t)=>{const{mediaFailures:n}=F(),[r,o]=l.useState(()=>({path:t,notices:it}));return l.useEffect(()=>{const s=()=>{const a=e.current,i=a===null?it:n.notices().filter(m=>a.contains(m.target));o(m=>m.path===t&&xi(m.notices,i)?m:{path:t,notices:i})};return s(),n.subscribe(s)},[n,e,t]),r.path===t?r.notices:it},Mn=(e,t,n)=>{const[r]=e;return r===void 0?null:e.length===1?t(r.name):n(e.length)},Dt=({kind:e,tone:t,text:n,onReload:r})=>{const{labels:o}=F(),s=l.useId();return c.jsxs("div",{className:"aqmx-callout aqmx-document-notice","data-aqmx-tone":t,"data-testid":"markdown-explorer-document-notice","data-aqmx-notice":e,children:[c.jsx("p",{id:s,className:"aqmx-callout-body",children:n}),r===null?null:c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-describedby":s,onClick:r,children:o.reload})]})},bi=({path:e,name:t,editing:n,announces:r,markup:o,region:s,focusDocument:a})=>{const{labels:i,documentChanges:m,mediaFailures:p}=F(),{refresh:g}=ao(e,r,o);l.useLayoutEffect(()=>m.show(e),[m,e]);const f=l.useCallback(()=>m.changed(e),[m,e]),w=l.useSyncExternalStore(m.subscribe,f,f);l.useEffect(()=>{n&&m.dismiss(e)},[n,m,e]);const h=yi(s,e),v=N=>{N.currentTarget===N.currentTarget.ownerDocument.activeElement&&a()},E=N=>{v(N),m.dismiss(e),g()},y=N=>{const C=s.current;C!==null&&(v(N),p.reload(C))},b=Mn(h.filter(N=>N.kind==="media-load"),i.mediaLoadFailed,i.mediaLoadFailedCount),L=Mn(h.filter(N=>N.kind==="media-unplayable"),i.mediaUnplayable,i.mediaUnplayableCount);return c.jsxs("div",{className:"aqmx-document-notices",role:"status","aria-live":"polite","aria-atomic":"false","data-testid":"markdown-explorer-document-notices",children:[w&&!n?c.jsx(Dt,{kind:"changed",tone:"info",text:i.documentChangedElsewhere(t),onReload:E}):null,b===null?null:c.jsx(Dt,{kind:"media-load",tone:"warning",text:b,onReload:y}),L===null?null:c.jsx(Dt,{kind:"media-unplayable",tone:"warning",text:L,onReload:null})]})};function ki({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Si=R.forwardRef(ki);function Ti({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Ri=R.forwardRef(Ti),Ke=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=F();return c.jsxs("div",{className:"aqmx-document-toolbar",children:[c.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:r}),c.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),o,c.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:c.jsx(Ri,{})}),c.jsx("a",{className:"aqmx-icon-button",href:n,download:e,"aria-label":s.download,title:s.download,"data-testid":"markdown-explorer-file-download",children:c.jsx(Si,{})})]})};function Ci({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Mi=R.forwardRef(Ci),Li=Object.freeze({className:"aqmx-document-stage"}),Oi=({document:e})=>{const{labels:t}=F();return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[c.jsx(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:c.jsx(Mi,{})}),c.jsx(We,{scrollerProps:Li,children:c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[c.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),c.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Ln=["keydown","pointerdown","wheel","touchstart"],lt=new WeakMap,pt=new WeakMap,Ai=e=>{const t=pt.get(e);if(t!==void 0){t.count+=1;return}pt.set(e,{count:1,original:e.style.overflowAnchor}),e.style.overflowAnchor="none"},Di=e=>{const t=pt.get(e);t!==void 0&&(t.count-=1,!(t.count>0)&&(pt.delete(e),e.style.overflowAnchor=t.original))},Ni=(e,t,n)=>{for(let r=t;r!==null&&r!==n;r=r.parentElement){e.observe(r);for(let o=r.previousElementSibling;o!==null;o=o.previousElementSibling)e.observe(o)}},ji=e=>{const t=new Map;for(let n=e.parentElement;n!==null;n=n.parentElement)t.set(n,{top:n.scrollTop,left:n.scrollLeft});return t},io=e=>{lt.get(e)?.()},lo=(e,t,n)=>{io(e);let r=new Map;const o=new Set,s=()=>{const f=t();return f===null?!1:(r=ji(f),!0)};if(!s()||typeof ResizeObserver>"u")return;const a=()=>{for(const f of r.keys())!(f instanceof HTMLElement)||o.has(f)||(o.add(f),Ai(f))};a();const{ownerDocument:i}=e,m=new ResizeObserver(()=>{if(!s()){g();return}a()});for(const{element:f,boundary:w}of n)Ni(m,f,w);const p=f=>{const w=f.target===i?i.scrollingElement:f.target;if(!(w instanceof Element))return;const h=r.get(w);h!==void 0&&(w.scrollTop!==h.top||w.scrollLeft!==h.left)&&g()},g=()=>{m.disconnect();for(const f of Ln)i.removeEventListener(f,g,!0);i.removeEventListener("scroll",p,!0);for(const f of o)Di(f);o.clear(),lt.get(e)===g&<.delete(e)};for(const f of Ln)i.addEventListener(f,g,{capture:!0,passive:!0});i.addEventListener("scroll",p,{capture:!0,passive:!0}),lt.set(e,g)},xt="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",Pi=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},_i=/(%[0-9A-Fa-f]{2})/u,un=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(_i).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))},co=e=>`#${encodeURIComponent(e)}`,Ii=e=>{if(e==="#")return!0;const t=un(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},uo=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},Fi="http://www.w3.org/1999/xhtml",On=(e,t)=>{if(t==="")return null;const n=uo(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===Fi&&r.getAttribute("name")===t)return r;return null},fo=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=On(e,t.slice(1));if(n!==null)return n;const r=un(t);return r===null?null:On(e,r)},An=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"},$i=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"},qi=(e,t)=>{const n=t.closest(xt),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&An(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(An(i)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o)return i;return a instanceof Element&&$i(e.ownerDocument)&&a.scrollHeight>a.clientHeight&&a.clientHeight<o?a:r},Bi=Object.freeze({scrollerOf:qi,reveal:e=>{e.scrollIntoView(wt)},keepAtStart:(e,t)=>{lo(e,()=>t.isConnected?(mo(e,t),t):null,[{element:t,boundary:e}])}}),wt=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),Hi=(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")}}},mo=(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)},Ui=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(xt)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},Dn=(e,t,n)=>{if(e===null)return null;const r=fo(e,t);return r===null?(Ii(t)&&Ui(e,n),null):(Hi(e,r),n.keepAtStart(n.scrollerOf(e,r),r),r)};function Vi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 zi=R.forwardRef(Vi);function Gi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Zi=R.forwardRef(Gi);function Wi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Ki=R.forwardRef(Wi);function Xi({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Yi=R.forwardRef(Xi),Kt="data-aqmx-key-repeat",gt=Object.freeze({[Kt]:"allow"}),Qi=`[${Kt}="${gt[Kt]}"]`,Ji=()=>{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(Qi)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},ct=Object.freeze([1/z.GOLDEN_RATIO**2,1/z.GOLDEN_RATIO,1,z.GOLDEN_RATIO,z.GOLDEN_RATIO**2]),Nn=Object.freeze({mode:"fit"}),el=1,ho=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),jn=`[data-testid="${ho["data-testid"]}"]`,po=l.createContext(null),tl=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=el?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,Pn=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<ct.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?ct.findIndex(o=>o>t):ct.findLastIndex(o=>o<t);return r===-1?null:r},_n=(e,t,n)=>{if(e.mode==="level"){const o=Pn(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=Pn(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},nl=(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},In=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}}},rl=e=>{const t=ct[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${V.describeValue(e)}`);return t},Fn=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},ol=({document:e})=>{const{labels:t}=F(),n=l.use(po),[r]=l.useState(()=>n===null?null:n.read(e.url)),[o,s]=l.useState(r===null?Nn:r.zoom),[a,i]=l.useState(r===null?null:r.reported),[m,p]=l.useState(null),g=l.useRef(null),f=l.useCallback(C=>{const{naturalWidth:M,naturalHeight:_}=C;i(I=>Fn(I,M,_))},[]),w=l.useCallback(C=>{g.current=C,!(C===null||!C.complete)&&(C.naturalWidth>0||C.naturalHeight>0?f(C):C.decode().then(()=>f(C),()=>{}))},[f]);l.useEffect(()=>{n!==null&&a!==null&&n.save(e.url,{zoom:o,reported:a})},[n,e.url,o,a]),l.useLayoutEffect(()=>{const C=g.current;if(C===null||a===null||o.mode!=="fit")return;const M=()=>p(I=>Fn(I,C.clientWidth,C.clientHeight));if(M(),typeof ResizeObserver>"u")return;const _=new ResizeObserver(M);return _.observe(C),()=>_.disconnect()},[a,o.mode]);const h=a===null||m===null?null:tl(a,m),v=_n(o,h,-1),E=_n(o,h,1),y=o.mode==="level"?rl(o.index):null,b=l.useRef({zoomIn:E,zoomOut:v});l.useLayoutEffect(()=>{b.current={zoomIn:E,zoomOut:v}});const L=l.useRef(null);l.useLayoutEffect(()=>{const C=L.current,M=g.current?.closest(jn);L.current=null,!(C===null||M===null||M===void 0)&&(M.scrollLeft=C.across*M.scrollWidth-C.x,M.scrollTop=C.down*M.scrollHeight-C.y)},[o]),l.useEffect(()=>{const C=g.current?.closest(jn);if(C==null)return;let M=null;const _=j=>{const U=In(j.touches);M=U===null?null:{distance:U.distance,steps:0}},I=j=>{const U=In(j.touches);if(M===null||U===null)return;j.preventDefault();const Z=nl(M.distance,U.distance);if(Z===M.steps)return;const K=Z>M.steps?1:-1,u=K===1?b.current.zoomIn:b.current.zoomOut;if(u===null)return;M.steps+=K;const d=C.getBoundingClientRect(),k=U.middle.x-d.left,T=U.middle.y-d.top;L.current=C.scrollWidth>0&&C.scrollHeight>0?{x:k,y:T,across:(C.scrollLeft+k)/C.scrollWidth,down:(C.scrollTop+T)/C.scrollHeight}:null,s(u)},H=j=>{j.touches.length<2&&(M=null)};return C.addEventListener("touchstart",_,{passive:!0}),C.addEventListener("touchmove",I,{passive:!1}),C.addEventListener("touchend",H,{passive:!0}),C.addEventListener("touchcancel",H,{passive:!0}),()=>{C.removeEventListener("touchstart",_),C.removeEventListener("touchmove",I),C.removeEventListener("touchend",H),C.removeEventListener("touchcancel",H)}},[]);const N=o.mode==="level"&&y!==null?{width:`${o.base.width*y}px`,height:`${o.base.height*y}px`}:void 0;return c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[c.jsxs(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:c.jsx(Yi,{}),children:[c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":v===null,onClick:()=>{v!==null&&s(v)},...gt,children:c.jsx(Zi,{})}),c.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:y===null?t.imageFitLevel:t.imageZoomLevel(Math.round(y*100))}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":E===null,onClick:()=>{E!==null&&s(E)},...gt,children:c.jsx(Ki,{})}),c.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(Nn),children:c.jsx(zi,{})})]}),c.jsx(We,{scrollerProps:ho,children:c.jsx("img",{ref:w,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:N,onLoad:C=>f(C.currentTarget),"data-testid":"markdown-explorer-image"})})]})},sl=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"}},wo=l.createContext(null),go=l.createContext(void 0),yt=l.createContext(void 0),vo=l.createContext(null),bt=()=>{const e=l.use(wo);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},al=()=>{const e=l.use(vo);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},kt=(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}),Eo=(e,t,n,r)=>t.view==="tree"?z.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides,maximized:t.maximized()}):kt(e,t,n,r),il=({children:e})=>{const{config:t}=F(),n=bt(),r=Ge(),o=r.kind==="location"?r.location.source:void 0,s=re.useHref(kt(t,n.navigation,o,n.currentPath));return c.jsx(yt,{value:o,children:c.jsx(vo,{value:s,children:e})})},ll='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',cl=e=>{const t=e instanceof Element?e.closest(ll):null;return t===null?null:t.getAttribute("data-doc-path")},Xe=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,dl=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:a,scope:i,children:m})=>{const p=re.useHref(e),g=f=>{if(Xe(f)){if(f.preventDefault(),t===i.currentPath&&n!==""){i.scrollWithin(n);return}a(t,n)}};return c.jsx("a",{...s,href:p,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:g,children:m})},ul=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:a}=F(),i=bt(),m=l.use(yt),p=Se(),g=Pi(e),{navigation:f}=i,w=`${kt(a,f,m,t)}${g}`,h=n===!1?"false":void 0;if(f.kind==="page"){const v=E=>{if(!Xe(E))return;const y=`${Eo(a,f,m,t)}${g}`;y!==w&&(E.preventDefault(),p(y,"follow-link"))};return c.jsx(zr,{...o,to:w,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":h,onClick:v,children:s})}return c.jsx(dl,{to:w,docPath:t,fragment:g,exists:h,className:r,attributes:o,onDocumentLink:f.onDocumentLink,scope:i,children:s})},fl=({className:e,attributes:t,children:n})=>{const{labels:r,locale:o}=F(),s=l.use(go),{lang:a,dir:i,...m}=t,p=a??s;return c.jsxs("a",{...m,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,lang:p===void 0?void 0:o,"data-link-kind":"doc","data-doc-exists":"false",children:[c.jsx("span",{lang:p,dir:i,children:n}),c.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},ml=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=F(),a=l.use(yt),i=re.useHref(`${kt(s,r.navigation,a,r.currentPath)}${e}`),m=p=>{Xe(p)&&(p.preventDefault(),r.scrollWithin(e))};return c.jsx("a",{...n,href:i,className:t,onClick:m,children:o})},hl=({href:e,className:t,attributes:n,children:r})=>{const o=bt();if(o.navigation.kind==="page"){const s=a=>{Xe(a)&&(e==="#"?o.followEmptyFragment(a.nativeEvent):o.followFragmentJump(e,a.nativeEvent))};return c.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return c.jsx(ml,{href:e,className:t,attributes:n,scope:o,children:r})},pl=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:a})=>t==="doc"?n===void 0||!P.isAcceptableDocumentPath(n)?c.jsx(fl,{className:o,attributes:s,children:a}):c.jsx(ul,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:a}):e.startsWith("#")?c.jsx(hl,{href:e,className:o,attributes:s,children:a}):c.jsx("a",{...s,href:e,className:o,children:a}),wl=()=>{const{config:e}=F(),t=bt(),n=l.use(yt),r=Se();return l.useCallback((o,s)=>{if(!Xe(s))return!0;s.preventDefault();const a=co(o.id),{navigation:i}=t;return i.kind==="panel"||un(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(a),!0):(r(`${Eo(e,i,n,t.currentPath)}${a}`,"follow-link"),!0)},[e,t,n,r])},gl=()=>{const e=al();return l.useCallback(t=>`${e}${co(t.id)}`,[e])};function vl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 El=R.forwardRef(vl);function xl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 yl=R.forwardRef(xl);function bl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 kl=R.forwardRef(bl),Sl=Object.freeze({className:"aqmx-document-stage"}),Tl=()=>()=>{},Rl=()=>navigator.pdfViewerEnabled!==!1,Cl=()=>null,Ml=({document:e})=>{const{labels:t,mediaFailures:n}=F(),r=l.useSyncExternalStore(Tl,Rl,Cl),o=l.useCallback(()=>n.pdfGeneration(e.url),[n,e.url]),s=l.useSyncExternalStore(n.subscribe,o,o),a=l.useCallback(i=>n.registerPdfFrame(e.url,i),[n,e.url]);return r===null?null:r?c.jsx("iframe",{ref:a,className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"},s):c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-pdf-not-shown",children:[c.jsx("p",{className:"aqmx-callout-body",children:t.pdfNotShown}),c.jsxs("div",{className:"aqmx-callout-actions",children:[c.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}),c.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-pdf-not-shown-download",children:t.download})]})]})},Ll=e=>{switch(e){case"video":return c.jsx(yl,{});case"audio":return c.jsx(kl,{});case"pdf":return c.jsx(El,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(t)}`)}}},Ol=({document:e})=>{const{labels:t}=F();switch(e.mediaType){case"video":return c.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 c.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 c.jsx(Ml,{document:e});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${V.describeValue(n)}`)}}},Al=({document:e})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[c.jsx(Ke,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:Ll(e.mediaType)}),c.jsx(We,{scrollerProps:Sl,children:c.jsx(Ol,{document:e})})]}),fn=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}},Dl=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=l.useSyncExternalStore(t.subscribe,n,r),s=we(o);return s===null?null:fn(s.document)},xo=e=>{const{config:t}=F(),n=Se(),r=l.useCallback(()=>n(z.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return l.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])};function Nl({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 jl=R.forwardRef(Nl),Pl=100,_l=32767,dt=Object.freeze({maxCells:vn.SPREADSHEET_MAX_OPERATION_CELLS,maxColumns:vn.SPREADSHEET_MAX_OPERATION_CELLS/Pl,maxCellLength:_l}),yo=44,bo=10,ko=13,st='"',$n=(e,t)=>{let n=t;for(;n<e.length;){const r=e.charCodeAt(n);if(r===yo||r===bo||r===ko)return n;n+=1}return n};function*Il(e,t){let n=[],r=0;for(;;){let o;if(e.startsWith(st,r)){o="";let a=r+1;for(;;){const m=e.indexOf(st,a);if(m<0){o+=e.slice(a),r=e.length;break}if(o+=e.slice(a,m),e.startsWith(st,m+1)){o+=st,a=m+2;continue}r=m+1;break}const i=$n(e,r);o+=e.slice(r,i),r=i}else{const a=$n(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!==yo&&(yield n,n=[],s===ko&&e.charCodeAt(r)===bo&&(r+=1),r>=e.length))return}}const Fl=(e,t,n)=>t==="csv"?Il(e,n):n==="whole"?Ht.iterateTsvRows(e):Ht.iterateTsvPrefixRows(e),$l=(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)},So=(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,p=Math.max(r,m.length);if((n.length+1)*p>t.maxCells){s=!0;break}const g=m.some(f=>f.length>t.maxCellLength)?m.map(f=>$l(f,t.maxCellLength)):m;g!==i&&(o=!0),n.push(g),r=p}return{rows:n.map(i=>i.length===r?i:[...i,...Array(r-i.length).fill("")]),truncated:s||o,full:s}},Nt=(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=So(Fl(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}}},ql=Object.freeze({maxPartBytes:64*1024*1024,maxSheets:256}),To=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 f of a.keys())f>m&&(m=f);const p=Array(Math.min(m,e.maxColumns)+1).fill("");for(const[f,w]of a)f<=e.maxColumns&&(p[f]=w);const g=Math.min(p.length,e.maxColumns);if(n===0&&(s+1)*g>e.maxCells){const f=Math.floor(e.maxCells/g);for(;t.length<f;)t.push([]);o(p);return}for(;t.length<s&&!r;)o([]);for(let f=0;f<i&&!r;f+=1)o(f===0?p:[...p])},full:()=>r,table:()=>So(t,e)}},Bl=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())},Hl=({names:e,selected:t,onSelect:n,label:r,tabIdOf:o,panelId:s})=>c.jsx("div",{role:"tablist","aria-label":r,className:"aqmx-sheet-tabs","data-testid":"markdown-explorer-spreadsheet-sheets",onKeyDown:Bl,children:e.map((a,i)=>c.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))}),Ro=64*1024,Ul=e=>{let t=new Uint8Array(Math.min(e,Ro)),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}},Vl=async e=>{for(;;){const{done:t,value:n}=await e.read();if(t)return!0;if(n.byteLength>0)return!1}},zl=async(e,t)=>{const{format:n,legacyEncoding:r,maxBytes:o,budget:s}=t,a=e.getReader(),i=Ul(o);let m=Ro;try{for(;;){const{done:p,value:g}=await a.read();if(p)return Nt(i.bytes(),!0,n,r,s);const f=o-i.length();if(i.append(g.byteLength>f?g.subarray(0,f):g),i.length()===o){const h=g.byteLength<=f&&await Vl(a);return Nt(i.bytes(),h,n,r,s)}if(i.length()<m)continue;m=i.length()*2;const w=Nt(i.bytes(),!1,n,r,s);if(w.kind==="unreadable"&&w.code!=="long-row"||w.kind==="table"&&w.table.full)return w}}finally{a.cancel().catch(()=>{})}},Co=async(e,t,n,r)=>{const o=await e.asset(P.explorerPlainTextHref(t),r);if(o.status==="cancelled")return null;if(o.status==="error")return{kind:"failure",failure:o.failure};let s;try{s=await zl(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},mn=(e,t,n)=>{const{documents:r,labels:o}=F(),s=vi(),a=l.useCallback(()=>r.answerStampOf(e),[r,e]),i=l.useSyncExternalStore(r.subscribe,a,a),[m,p]=l.useState(0),g=l.useMemo(()=>({read:n,stamp:i,attempt:m}),[n,i,m]),[f,w]=l.useState({settled:null,shown:null,failure:null}),h=l.useRef(null),v=l.useEffectEvent((b,L)=>{if(h.current?.settle(L.stamp,b.kind==="failure"?b.failure:null),b.kind==="read"){w({settled:L,shown:b.value,failure:null});return}if(f.shown!==null){w({settled:L,shown:f.shown,failure:null});return}w({settled:L,shown:null,failure:b.failure});const{reason:N}=b.failure;ie(N)||s.announceFailure(o.documentFailed(t,ce(o,N)))});l.useEffect(()=>{const b=s.readPart();return h.current=b,()=>{h.current=null,b.release()}},[s]),l.useEffect(()=>{const b=new AbortController;return g.read(b.signal).then(L=>{L!==null&&!b.signal.aborted&&v(L,g)}),()=>b.abort()},[g]);const E=f.settled!==g&&(f.shown!==null||f.failure!==null);l.useLayoutEffect(()=>E?s.holdBusy():void 0,[E,s]);const y=l.useCallback(()=>p(b=>b+1),[]);return{shown:f.shown,failure:f.failure,retry:y}},Mo=(e,t)=>{const n={};for(const r of Object.keys(De.SPREADSHEET_BLOCK_LABEL_CATALOGS[t])){const o=e[Jt(r)];o!==De.SPREADSHEET_BLOCK_LABEL_CATALOGS[t][r].text&&(n[r]=o)}return n},Gl=(e,t)=>Object.fromEntries(Object.entries(Mo(e,t)).map(([n,r])=>[`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`,r])),Zl=(e,t)=>({...Gl(e,t),loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,styleSectionTitle:e.viewerStyleSectionTitle,measureTitle:e.viewerMeasureTitle,colorsTitle:e.viewerColorsTitle,measureFill:e.viewerMeasureFill,measureReading:e.viewerMeasureReading,colorsDefault:e.viewerColorsDefault,colorsSepia:e.viewerColorsSepia,colorsDarkLowGlare:e.viewerColorsDarkLowGlare,colorsHighContrast:e.viewerColorsHighContrast,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,mermaidFullscreen:e.viewerMermaidFullscreen,mermaidExitFullscreen:e.viewerMermaidExitFullscreen,mermaidFullscreenDialog:e.viewerMermaidFullscreenDialog,mermaidDiagram:e.viewerMermaidDiagram,mermaidRetry:e.viewerMermaidRetry,mermaidLoading:e.viewerMermaidLoading,mermaidInitializationFailed:e.viewerMermaidInitializationFailed,mermaidRenderFailed:e.viewerMermaidRenderFailed,mermaidEmptyDrawing:e.viewerMermaidEmptyDrawing,mermaidSource:e.viewerMermaidSource,mermaidSourceRegion:e.viewerMermaidSourceRegion,mermaidCopySource:e.viewerMermaidCopySource,mermaidCopiedSource:e.viewerMermaidCopiedSource,mermaidCopySourceFailed:e.viewerMermaidCopySourceFailed,mermaidTypeC4:e.viewerMermaidTypeC4,mermaidTypeFlowchart:e.viewerMermaidTypeFlowchart,mermaidTypeSwimlane:e.viewerMermaidTypeSwimlane,mermaidTypeEntityRelationship:e.viewerMermaidTypeEntityRelationship,mermaidTypeGitGraph:e.viewerMermaidTypeGitGraph,mermaidTypeGantt:e.viewerMermaidTypeGantt,mermaidTypeInfo:e.viewerMermaidTypeInfo,mermaidTypePie:e.viewerMermaidTypePie,mermaidTypeQuadrantChart:e.viewerMermaidTypeQuadrantChart,mermaidTypeXyChart:e.viewerMermaidTypeXyChart,mermaidTypeRequirement:e.viewerMermaidTypeRequirement,mermaidTypeSequence:e.viewerMermaidTypeSequence,mermaidTypeClass:e.viewerMermaidTypeClass,mermaidTypeState:e.viewerMermaidTypeState,mermaidTypeJourney:e.viewerMermaidTypeJourney,mermaidTypeTimeline:e.viewerMermaidTypeTimeline,mermaidTypeMindmap:e.viewerMermaidTypeMindmap,mermaidTypeKanban:e.viewerMermaidTypeKanban,mermaidTypeSankey:e.viewerMermaidTypeSankey,mermaidTypePacket:e.viewerMermaidTypePacket,mermaidTypeRadar:e.viewerMermaidTypeRadar,mermaidTypeBlock:e.viewerMermaidTypeBlock,mermaidTypeTreeView:e.viewerMermaidTypeTreeView,mermaidTypeArchitecture:e.viewerMermaidTypeArchitecture,mermaidTypeEventModeling:e.viewerMermaidTypeEventModeling,mermaidTypeIshikawa:e.viewerMermaidTypeIshikawa,mermaidTypeVenn:e.viewerMermaidTypeVenn,mermaidTypeTreemap:e.viewerMermaidTypeTreemap,mermaidTypeWardley:e.viewerMermaidTypeWardley,mermaidTypeCynefin:e.viewerMermaidTypeCynefin,mermaidTypeRailroad:e.viewerMermaidTypeRailroad,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,svgImageFullscreen:e.viewerSvgImageFullscreen,svgImageExitFullscreen:e.viewerSvgImageExitFullscreen,svgImageFullscreenDialog:e.viewerSvgImageFullscreenDialog,codeBlockCopy:e.viewerCodeBlockCopy,codeBlockCopied:e.viewerCodeBlockCopied,codeBlockCopyFailed:e.viewerCodeBlockCopyFailed,displayMathCopy:e.viewerDisplayMathCopy,displayMathCopied:e.viewerDisplayMathCopied,displayMathCopyFailed:e.viewerDisplayMathCopyFailed}),Lo=(e,t,n)=>t!==void 0?t:n!==void 0?n:e.defaultDocumentStyle,Oo=(e,t)=>e!==void 0?e:t!==void 0?t:hs.DEFAULT_CONTENT_ALIGN;class ne extends Error{refusal;constructor(t,n){super(n),this.name="WorkbookError",this.refusal=t}}const Wl=new Map([["lt","<"],["gt",">"],["amp","&"],["quot",'"'],["apos","'"]]),Kl=/&(#x[0-9A-Fa-f]+|#[0-9]+|[A-Za-z_][A-Za-z0-9._-]*);/gu,Xl=/([^\s=/>]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/gu,Yl=/^[^\s/>]+/u,Oe=e=>{throw new ne("not-workbook",`the XML ${e}`)},qn=e=>Number.isInteger(e)&&e>=0&&e<=1114111?String.fromCodePoint(e):Oe(`refers to the code point ${e}`),Ao=e=>e.includes("&")?e.replace(Kl,(t,n)=>n.startsWith("#x")?qn(Number.parseInt(n.slice(2),16)):n.startsWith("#")?qn(Number.parseInt(n.slice(1),10)):Wl.get(n)??Oe(`names the undeclared entity ${t}`)):e,Xt=e=>e.slice(e.indexOf(":")+1),Ql=(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},Jl=e=>{const t=new Map;for(const n of e.matchAll(Xl))t.set(Xt(n[1]??""),Ao(n[2]??n[3]??""));return t},Do=(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?.(Ao(n.slice(o,s))),o=s),n.startsWith("<!--",s)){const p=n.indexOf("-->",s+4);if(p===-1)break;o=p+3;continue}if(n.startsWith("<![CDATA[",s)){const p=n.indexOf("]]>",s+9);if(p===-1)break;e.text?.(n.slice(s+9,p)),o=p+3;continue}const a=n.slice(s);if(a.length<9&&("<!--".startsWith(a)||"<![CDATA[".startsWith(a)))break;if(n.startsWith("<!",s)&&Oe("declares a document type or another declaration"),n.startsWith("<?",s)){const p=n.indexOf("?>",s+2);if(p===-1)break;o=p+2;continue}const i=Ql(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 p=m.endsWith("/"),g=p?m.slice(0,-1):m,f=Yl.exec(g)?.[0]??Oe("has a tag without a name"),w=Xt(f);e.start?.(w,Jl(g.slice(f.length)),p),p&&e.end?.(w)}o=i+1}n=n.slice(o)};return{write:o=>{n+=o,r()},finish:()=>{r(),!t()&&n.includes("<")&&Oe("ends inside a tag, a comment or a section")}}},Ye=async(e,t,n)=>{const r=Do(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 ne)throw a;Oe("could not be read as UTF-8 text")}finally{s.cancel().catch(()=>{})}},ec=101010256,tc=33639248,nc=67324752,No=22,rc=65535,Bn=46,Hn=30,oc=1,Un=0,sc=8,ac=65535,$e=4294967295,ic=new TextDecoder("utf-8"),le=e=>{throw new ne("not-workbook",`the ZIP package ${e}`)},lc=e=>{const t=e.byteLength-No,n=Math.max(0,t-rc);for(let r=t;r>=n;r-=1)if(e.getUint32(r,!0)===ec)return r;return le("has no end of central directory record")},cc=e=>{if(e.byteLength<No)return le("is shorter than its end record");const t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=lc(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 le("spans several disks");if(s===ac||a===$e||i===$e)return le("is a ZIP64 package");if(i+a>n)return le("has a central directory past its end record");const m=new Map;let p=i;for(let g=0;g<s;g+=1){if(p+Bn>n||t.getUint32(p,!0)!==tc)return le("has a malformed central directory");const f=t.getUint16(p+8,!0),w=t.getUint16(p+10,!0),h=t.getUint32(p+20,!0),v=t.getUint32(p+24,!0),E=t.getUint16(p+28,!0),y=t.getUint16(p+30,!0),b=t.getUint16(p+32,!0),L=t.getUint32(p+42,!0),N=p+Bn;if(N+E>n)return le("has a name past its central directory");const C=ic.decode(e.subarray(N,N+E));if(h===$e||v===$e||L===$e)return le("has a ZIP64 entry");if(!C.endsWith("/")){if(m.has(C))return le(`names ${C} twice`);m.set(C,{name:C,encrypted:(f&oc)!==0,method:w,compressedSize:h,uncompressedSize:v,localHeaderOffset:L})}p=N+E+y+b}return{bytes:e,entries:m}},dc=(e,t)=>{const{bytes:n}=e,r=new DataView(n.buffer,n.byteOffset,n.byteLength),o=t.localHeaderOffset;if(o+Hn>n.byteLength||r.getUint32(o,!0)!==nc)return le(`has no local header for ${t.name}`);const s=o+Hn+r.getUint16(o+26,!0)+r.getUint16(o+28,!0),a=s+t.compressedSize;return a>n.byteLength?le(`has the data of ${t.name} past its end`):{start:s,end:a}},jo=e=>new ReadableStream({start(t){e.byteLength>0&&t.enqueue(e),t.close()}}),uc=e=>jo(e).pipeThrough(new DecompressionStream("deflate-raw")),fc=(e,t)=>{let n=0;return new TransformStream({transform(r,o){if(n+=r.byteLength,n>t){o.error(new ne("too-large",`${e} inflates past ${t} bytes`));return}o.enqueue(r)}})},ze=(e,t,n)=>{const r=e.entries.get(t);if(r===void 0)return null;if(r.encrypted)throw new ne("encrypted",`${t} is encrypted`);if(r.method!==Un&&r.method!==sc)return le(`compresses ${t} with method ${r.method}`);if(r.uncompressedSize>n)throw new ne("too-large",`${t} declares ${r.uncompressedSize} bytes`);const{start:o,end:s}=dc(e,r),a=e.bytes.subarray(o,s);return(r.method===Un?jo(a):uc(a)).pipeThrough(fc(t,n))},vt=async(e,t,n)=>{const r=ze(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 ne)throw i;return le(`has ${t}, which does not inflate to UTF-8 text`)}finally{s.releaseLock()}},Vn="content.xml",mc="META-INF/manifest.xml",Po=e=>{throw new ne("not-workbook",`the spreadsheet ${e}`)},zn=(e,t)=>ze(e,Vn,t.maxPartBytes)??Po(`has no ${Vn}`),hc=async(e,t)=>{const n=ze(e,mc,t.maxPartBytes);if(n===null)return!1;let r=!1;return await Ye(n,{start:o=>{o==="encryption-data"&&(r=!0)}},()=>r),r},pc=async e=>{const t=[],n=new Set;let r=null,o=0;return await Ye(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}},jt=e=>{const t=Number(e);return Number.isInteger(t)&&t>0?t:1},wc=async(e,t,n)=>{const r=To(n);let o=0,s=0,a=!1,i=!1,m=0,p=1,g=new Map,f=0,w=null;return await Ye(e,{start:(h,v,E)=>{if(h==="table"){s===0&&(a=o===t,o+=1),E||(s+=1);return}!a||s!==1||(h==="table-row"?(p=jt(v.get("number-rows-repeated")),g=new Map,f=0):h==="table-cell"||h==="covered-table-cell"?w={repeat:jt(v.get("number-columns-repeated")),covered:h==="covered-table-cell",parts:[],paragraphs:0,paragraphDepth:0,annotationDepth:0}:w!==null&&w.annotationDepth===0&&(h==="annotation"&&!E?w.annotationDepth+=1:h==="p"||h==="h"?(w.paragraphs>0&&w.parts.push(`
|
|
15
15
|
`),w.paragraphs+=1,E||(w.paragraphDepth+=1)):w.paragraphDepth>0&&(h==="s"?w.parts.push(" ".repeat(jt(v.get("c")))):h==="tab"?w.parts.push(" "):h==="line-break"&&w.parts.push(`
|
|
16
|
-
`))))},end:h=>{if(h==="table"){s=Math.max(0,s-1),s===0&&a&&(a=!1,i=!0);return}if(w!==null&&w.annotationDepth>0){h==="annotation"&&(w.annotationDepth-=1);return}if(!(!a||s!==1))if((h==="table-cell"||h==="covered-table-cell")&&w!==null){const v=w.covered?"":w.parts.join("");if(v!==""){const E=Math.min(f+w.repeat,n.maxColumns+1);for(let x=f;x<E;x+=1)g.set(x,v)}f+=w.repeat,w=null}else h==="table-row"?(r.addRow(m,g,p),m+=p):(h==="p"||h==="h")&&w!==null&&(w.paragraphDepth=Math.max(0,w.paragraphDepth-1))},text:h=>{w!==null&&w.annotationDepth===0&&w.paragraphDepth>0&&w.parts.push(h)}},()=>i||r.full()),r.table()},wc=async(e,t)=>{if(await mc(e,t))throw new ne("encrypted","the spreadsheet's manifest names encryption data");const{tables:n,hidingStyles:r}=await hc(Vn(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=>pc(Vn(e,t),i,m)})}),o.length===0&&jo("shows no table"),{sheets:o.slice(0,t.maxSheets),unshownSheets:s,unlistedSheets:Math.max(0,o.length-t.maxSheets)}},Me=Object.freeze({kind:"general"}),gc=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,"@"]]),vc=/^\[(h+|m+|s+)\]$/iu,Ec=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);vc.test(a)&&(t+=a.slice(1,-1),n=!0),r=s===-1?e.length:s}else t+=o}return{text:t.toLowerCase(),elapsed:n}},yc=e=>{const{text:t,elapsed:n}=Ec(e);if(t===""||t==="general"||t.includes("@")||/[0#?.]e[+-]/u.test(t))return Me;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 Me;const s=/[0#?][0#?,]*(?:\.[0#?]*)?,*/u.exec(t)?.[0];if(s===void 0)return Me;const a=/,*$/u.exec(s)?.[0].length??0,[i="",m=""]=s.slice(0,s.length-a).split("."),p=(m.match(/[0#?]/gu)??[]).length;return t.includes("%")?{kind:"percent",decimals:p}:{kind:"fixed",decimals:p,grouping:i.includes(","),scale:1e3**a}},xc=(e,t)=>{const n=t.get(e)??gc.get(e);return n===void 0?Me:yc(n)},hn=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("+","")}`}`},zn=(e,t,n)=>{const r=Math.abs(e).toFixed(t);if(r.includes("e"))return hn(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}`}`},bc=864e5,Gn=86400,kc=2958465,Ae=(e,t)=>String(e).padStart(t,"0"),Sc=(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*bc);return`${Ae(r.getUTCFullYear(),4)}-${Ae(r.getUTCMonth()+1,2)}-${Ae(r.getUTCDate(),2)}`},Tc=(e,t,n)=>{if(e<0||e>=kc+1)return hn(e);let r=Math.floor(e),o=Math.round((e-r)*Gn);o===Gn&&(r+=1,o=0);const s=Math.floor(o/3600),a=Math.floor(o%3600/60),i=`${Ae(t.elapsed?r*24+s:s,2)}:${Ae(a,2)}${t.seconds?`:${Ae(o%60,2)}`:""}`;if(t.elapsed||!t.date)return i;const m=Sc(r,n);return t.time?`${m} ${i}`:m},Rc=(e,t,n)=>{switch(t.kind){case"general":return hn(e);case"date-time":return Tc(e,t,n);case"percent":return`${zn(e*100,t.decimals,!1)}%`;case"fixed":return zn(e/t.scale,t.decimals,t.grouping)}},Po="_rels/.rels",pe=e=>{throw new ne("not-workbook",`the workbook ${e}`)},pn=(e,t)=>{const n=Ao(t,()=>!1);n.write(e),n.finish()},Cc=(e,t)=>{try{return decodeURIComponent(e)}catch{return pe(`points to a malformed part name (${t})`)}},Mc=(e,t)=>{const r=[...t.startsWith("/")?[]:e.split("/").slice(0,-1)];for(const o of t.split("/"))o===""||o==="."||(o===".."?(r.length===0&&pe(`points above its root (${t})`),r.pop()):r.push(Cc(o,t)));return r.join("/")},Lc=e=>{const t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},Zn=async(e,t,n)=>{const r=await vt(e,t===""?Po:Lc(t),n.maxPartBytes),o=new Map;return r===null||pn(r,{start:(s,a)=>{if(s!=="Relationship")return;const i=a.get("Id"),m=a.get("Type"),p=a.get("Target");i===void 0||m===void 0||p===void 0||a.get("TargetMode")==="External"||o.set(i,{type:m,target:Mc(t,p)})}}),o},Pt=(e,t)=>{for(const n of e.values())if(n.type.endsWith(`/${t}`))return n.target;return null},Oc=e=>{const t=[];let n=!1;return pn(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}},Ac=async e=>{const t=[];let n=null,r=!1,o=0;return await Ye(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},Dc=e=>{const t=new Map,n=[];let r=!1;return pn(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=>xc(o,t))},Nc=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u,jc=e=>{const t=Nc.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}`},Pc=/^([A-Za-z]{1,3})(\d+)$/u,_c=e=>{const t=Pc.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},Ic=(e,t,n,r)=>{const o=e.value.join("");switch(e.type){case"s":return o===""?"":t[Number(o)]??pe(`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 jc(o.trim());default:{const s=o.trim();if(s==="")return"";const a=Number(s);return Number.isFinite(a)?Rc(a,n[e.style]??Me,r):s}}},Fc=async(e,t,n,r,o)=>{const s=So(t);let a=-1,i=new Map,m=0,p=null;return await Ye(e,{start:(g,f,w)=>{if(g==="row"){const h=Number(f.get("r"));a=Number.isInteger(h)&&h>a+1?h-1:a+1,i=new Map,m=0}else if(g==="c"){const h=_c(f.get("r")??"")??m,v=Number(f.get("s")??"0");p={column:h,type:f.get("t")??"n",style:Number.isInteger(v)?v:0,value:[],inline:[],inValue:!1,inInlineText:!1,phoneticDepth:0}}else p!==null&&(g==="v"?p.inValue=!w:g==="rPh"&&!w?p.phoneticDepth+=1:g==="t"&&p.type==="inlineStr"&&p.phoneticDepth===0&&(p.inInlineText=!w))},end:g=>{if(g==="c"&&p!==null){const f=Ic(p,n,r,o);f!==""&&i.set(p.column,f),m=p.column+1,p=null}else g==="row"?s.addRow(a,i,1):p!==null&&(g==="v"?p.inValue=!1:g==="rPh"?p.phoneticDepth=Math.max(0,p.phoneticDepth-1):g==="t"&&(p.inInlineText=!1))},text:g=>{p!==null&&(p.inValue?p.value.push(g):p.inInlineText&&p.inline.push(g))}},s.full),s.table()},$c=async(e,t)=>{const n=Pt(await Zn(e,"",t),"officeDocument")??pe("has no officeDocument relationship"),r=await vt(e,n,t.maxPartBytes)??pe(`has no part ${n}`),{sheets:o,date1904:s}=Oc(r),a=await Zn(e,n,t),i=Pt(a,"sharedStrings"),m=i===null?null:ze(e,i,t.maxPartBytes),p=m===null?[]:await Ac(m),g=Pt(a,"styles"),f=g===null?null:await vt(e,g,t.maxPartBytes),w=f===null?[]:Dc(f),h=[];let v=0;for(const E of o){const x=a.get(E.relationship)??pe(`lists the sheet ${E.name} without its relationship`);if(E.state!=="visible"||!x.type.endsWith("/worksheet")){v+=1;continue}e.entries.has(x.target)||pe(`has no part ${x.target} for the sheet ${E.name}`),h.push({name:E.name,read:async b=>{const L=ze(e,x.target,t.maxPartBytes)??pe(`has no part ${x.target}`);return Fc(L,b,p,w,s)}})}return h.length===0&&pe("shows no sheet"),{sheets:h.slice(0,t.maxSheets),unshownSheets:v,unlistedSheets:Math.max(0,h.length-t.maxSheets)}},qc=Object.freeze([80,75,3,4]),Bc=Object.freeze([208,207,17,224,161,177,26,225]),_t=Uint8Array.from([..."EncryptedPackage"].flatMap(e=>[e.charCodeAt(0),0])),Hc=new Set(["application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.spreadsheet-template"]),Uc="mimetype",_o=(e,t)=>e.byteLength>=t.length&&t.every((n,r)=>e[r]===n),Io=e=>_o(e,qc),Fo=e=>_o(e,Bc),Vc=e=>{const t=e.byteLength-_t.byteLength;for(let n=0;n<=t;n+=1)if(e[n]===_t[0]&&_t.every((r,o)=>e[n+o]===r))return!0;return!1},zc=async(e,t)=>{if(Fo(e))throw Vc(e)?new ne("encrypted","the bytes are a password-protected workbook"):new ne("not-workbook","the bytes are a compound file (a legacy .xls)");if(!Io(e))throw new ne("not-workbook","the bytes are no ZIP package");const n=lc(e),r=await vt(n,Uc,t.maxPartBytes);if(r!==null&&Hc.has(r.trim()))return wc(n,t);if(n.entries.has(Po))return $c(n,t);throw new ne("not-workbook","the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package")},Gc=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},$o=async(e,t)=>{try{return{kind:"table",table:await e.read(t)}}catch(n){return{kind:"refused",refusal:n instanceof ne?n.refusal:"not-workbook"}}},Zc=async(e,t,n,r,o)=>{const s=await e.asset(P.explorerWorkbookHref(t),o);if(s.status==="cancelled")return null;if(s.status==="error")return{kind:"failure",failure:s.failure};let a;try{a=await Gc(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(!(Io(a)||Fo(a)))return{kind:"not-package"};try{const i=await zc(a,n.limits),m=r===null?-1:i.sheets.findIndex(w=>w.name===r),p=Math.max(m,0),g=i.sheets[p];if(g===void 0)return{kind:"refused",refusal:"not-workbook"};const f=await $o(g,n.budget);return o.aborted?null:{kind:"workbook",workbook:i,selected:p,sheet:f}}catch(i){return i instanceof ne?{kind:"refused",refusal:i.refusal}:o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}},Wc=Object.freeze({className:"aqmx-document-spreadsheet-body","data-aqmx-document-scroller":""}),Kc=(e,t)=>{switch(t.code){case"encoding":return e.spreadsheetUnreadableEncoding(t.encodings);case"binary":return e.spreadsheetNotText;case"long-row":return e.spreadsheetLongRow}},Wn=(e,t)=>{switch(t){case"encrypted":return e.spreadsheetWorkbookEncrypted;case"not-workbook":return e.spreadsheetNotWorkbook;case"too-large":return e.spreadsheetWorkbookTooLarge}},It=e=>e.every(t=>t.every(n=>n==="")),qo=({name:e,url:t,openUrl:n,state:r,children:o})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-spreadsheet-view","data-aqmx-spreadsheet":r,children:[c.jsx(Ke,{name:e,openUrl:n,downloadUrl:t,icon:c.jsx(Nl,{})}),c.jsx(We,{scrollerProps:Wc,children:c.jsx("div",{className:"aqmx-document-spreadsheet-column",children:o})})]}),Bo=({rows:e,title:t})=>{const{labels:n,locale:r,theme:o}=F(),s=l.use(be),a=l.useMemo(()=>({...Co(n,r),table:t,fullscreenDialog:n.spreadsheetFullscreen(t)}),[n,r,t]),i=l.useMemo(()=>Ht.serializeTsv(e),[e]),m=dn();return c.jsx("div",{className:"aqmx-document-spreadsheet","data-theme":o,children:c.jsx(Ne.SpreadsheetBlock,{tsv:i,layout:s==="fill"?"fill":"inline",locale:r,labels:a,tapScrollCircle:Jr(m),scrollBarControls:sn(m)})})},He=({note:e,testId:t,code:n,download:r})=>{const{labels:o}=F();return c.jsx("div",{className:"aqmx-document-spreadsheet-stage",children:r===void 0?c.jsx("p",{className:"aqmx-callout",role:"note","data-testid":t,children:e}):c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":t,"data-aqmx-unreadable":n,children:[c.jsx("p",{className:"aqmx-callout-body",children:e}),c.jsx("a",{className:"aqmx-callout-action",href:r.url,download:r.name,"data-testid":"markdown-explorer-spreadsheet-unreadable-download",children:o.download})]})})},Ho=({reading:e,name:t,url:n})=>{const{labels:r}=F();switch(e.kind){case"table":return c.jsxs(c.Fragment,{children:[e.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:r.spreadsheetTruncated}):null,c.jsx(Bo,{rows:e.rows,title:t})]});case"empty":return c.jsx(He,{note:r.spreadsheetEmpty,testId:"markdown-explorer-spreadsheet-empty"});case"unreadable":return c.jsx(He,{note:Kc(r,e),testId:"markdown-explorer-spreadsheet-unreadable",code:e.code,download:{url:n,name:t}})}},Xc=({path:e,document:t})=>t.format==="workbook"?c.jsx(Qc,{path:e,document:t}):c.jsx(Yc,{path:e,document:t,format:t.format}),Yc=({path:e,document:t,format:n})=>{const{config:r,data:o,labels:s}=F(),{name:a,url:i}=t,m=l.useCallback(async w=>{const h=await Ro(o,i,{format:n,legacyEncoding:r.legacyTextEncoding,maxBytes:r.spreadsheets.maxBytes,budget:dt},w);return h===null||h.kind==="failure"?h:{kind:"read",value:h}},[o,i,n,r.legacyTextEncoding,r.spreadsheets.maxBytes]),{shown:p,failure:g,retry:f}=mn(e,a,m);return c.jsxs(qo,{name:a,url:i,openUrl:P.explorerPlainTextHref(i),state:p===null?g===null?"loading":"failure":p.kind,children:[p===null&&g===null?c.jsx(ke,{label:s.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,p===null&&g!==null?c.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:c.jsx(xe,{failure:g,alert:!1,onRetry:f,testId:"markdown-explorer-spreadsheet-failure"})}):null,p===null?null:c.jsx(Ho,{reading:p,name:a,url:i})]})},Qc=({path:e,document:t})=>{const{config:n,data:r,labels:o}=F(),{name:s,url:a,firstSheetText:i}=t,m=l.useId(),p=l.useRef(null),g=l.useCallback(async Z=>{const K=await Zc(r,a,{maxBytes:n.spreadsheets.maxWorkbookBytes,limits:$l,budget:dt},p.current,Z);if(K===null||K.kind==="failure")return K;if(K.kind==="workbook")return{kind:"read",value:K};if(i!==null){const u=await Ro(r,a,{format:i,legacyEncoding:n.legacyTextEncoding,maxBytes:n.spreadsheets.maxBytes,budget:dt},Z);return u===null||u.kind==="failure"?u:{kind:"read",value:{kind:"first-sheet",reading:u}}}return{kind:"read",value:{kind:"refused",refusal:K.kind==="not-package"?"not-workbook":K.refusal}}},[r,a,i,n.legacyTextEncoding,n.spreadsheets.maxBytes,n.spreadsheets.maxWorkbookBytes]),{shown:f,failure:w,retry:h}=mn(e,s,g),[v,E]=l.useState(null),x=l.useRef(new WeakMap),b=f?.kind==="workbook"?f:null,L=b===null?null:v!==null&&v.workbook===b.workbook?v:{workbook:b.workbook,index:b.selected,reading:b.sheet},N=Z=>{if(b===null)return;const K=b.workbook.sheets[Z];if(K===void 0)return;p.current=K.name;let u=x.current.get(b.workbook);u===void 0&&(u=new Map([[b.selected,b.sheet]]),x.current.set(b.workbook,u));const d=u.get(Z),k={workbook:b.workbook,index:Z,reading:d??null};if(E(k),d!==void 0)return;const T=u;$o(K,dt).then(O=>{T.set(Z,O),E($=>$===k?{...k,reading:O}:$)})},C=L===null?null:L.reading===null?"loading":L.reading.kind==="refused"?"unreadable":It(L.reading.table.rows)?"empty":"table",M=f===null?w===null?"loading":"failure":f.kind==="first-sheet"?f.reading.kind:f.kind==="refused"?"unreadable":C??"loading",_=i===null?a:P.explorerPlainTextHref(a),I=Z=>`${m}-sheet-${Z}`,H=`${m}-panel`,j=L===null?null:b?.workbook.sheets[L.index]?.name??null,U=b!==null&&b.workbook.sheets.length>1;return c.jsxs(qo,{name:s,url:a,openUrl:_,state:M,children:[f===null&&w===null?c.jsx(ke,{label:o.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,f===null&&w!==null?c.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:c.jsx(xe,{failure:w,alert:!1,onRetry:h,testId:"markdown-explorer-spreadsheet-failure"})}):null,f?.kind==="refused"?c.jsx(He,{note:Wn(o,f.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:f.refusal,download:{url:a,name:s}}):null,f?.kind==="first-sheet"?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-first-sheet",children:o.spreadsheetWorkbookFirstSheet}),c.jsx(Ho,{reading:f.reading,name:s,url:a})]}):null,b===null||L===null||j===null?null:c.jsxs(c.Fragment,{children:[b.workbook.unshownSheets>0?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unshown-sheets",children:o.spreadsheetUnshownSheets(b.workbook.unshownSheets)}):null,b.workbook.unlistedSheets>0?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unlisted-sheets",children:o.spreadsheetUnlistedSheets(b.workbook.sheets.length)}):null,U?c.jsx(Bl,{names:b.workbook.sheets.map(Z=>Z.name),selected:L.index,onSelect:N,label:o.spreadsheetSheets(s),tabIdOf:I,panelId:H}):null,c.jsxs("div",{className:"aqmx-document-spreadsheet-sheet","data-testid":"markdown-explorer-spreadsheet-sheet","data-aqmx-sheet":L.index,...U?{role:"tabpanel",id:H,"aria-labelledby":I(L.index)}:{},children:[L.reading===null?c.jsx(ke,{label:o.spreadsheetSheetLoading,testId:"markdown-explorer-spreadsheet-sheet-skeleton"}):null,L.reading?.kind==="table"&&L.reading.table.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:o.spreadsheetTruncated}):null,L.reading?.kind==="refused"?c.jsx(He,{note:Wn(o,L.reading.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:L.reading.refusal,download:{url:a,name:s}}):null,L.reading?.kind==="table"&&It(L.reading.table.rows)?c.jsx(He,{note:o.spreadsheetSheetEmpty,testId:"markdown-explorer-spreadsheet-empty"}):null,L.reading?.kind==="table"&&!It(L.reading.table.rows)?c.jsx(Bo,{rows:L.reading.table.rows,title:o.spreadsheetSheetName(s,j)},L.index):null]})]})]})},Uo=Object.freeze({kind:"empty"}),Jc=(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})},Le=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:i})=>{const m=l.use(be);return c.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?c.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,i]})},ed=Object.freeze({invalid:"documentIdInvalid","not-found":"documentIdNotFound"}),Kn=(e,t)=>{const n=ed[t];return n===void 0?void 0:{title:e.documentIdFailedTitle,body:e[n]}},td=({absence:e,announces:t,announceFailure:n})=>{const{labels:r,announcer:o}=F(),s=e.kind==="no-readme"?e.folder:null,a=e.kind==="failure"?e.folder:null,i=e.kind==="failure"?e.failure:null,m=e.kind==="document-id"?e.failure:null;switch(l.useEffect(()=>{t&&s!==null&&o.announce(r.folderReadmeMissing(P.lastPathSegment(s)))},[t,s,o,r]),l.useEffect(()=>{if(a===null||i===null)return;const{reason:p}=i;ie(p)||n(r.documentFailed(P.lastPathSegment(a),ce(r,p)))},[a,i,n,r]),l.useEffect(()=>{if(m===null)return;const{reason:p}=m;if(ie(p))return;const g=Kn(r,p);n(r.announcementSequence([r.documentIdFailedTitle,g===void 0?ce(r,p):g.body]))},[m,n,r]),e.kind){case"empty":return c.jsx(Le,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:c.jsx("p",{className:"aqmx-empty-title",children:r.documentEmpty})})});case"loading":return c.jsx(wn,{label:r.documentRegion});case"no-readme":return c.jsx(Le,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-folder-empty",children:c.jsx("p",{className:"aqmx-empty-title",children:r.folderReadmeMissing(P.lastPathSegment(e.folder))})})});case"failure":return c.jsx(Le,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx(ht,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-folder-failure"})});case"document-id":return c.jsx(Le,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx(ht,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-document-id-failure",text:Kn(r,e.failure.reason),deniedSentence:r.documentIdForbidden})})}},wn=({label:e})=>{const{labels:t}=F();return c.jsx(Le,{kind:"loading",label:e,stale:!1,busy:!0,children:c.jsx(ke,{label:t.documentLoading,testId:"markdown-explorer-document-skeleton"})})},Xn=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),nd=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=F(),a=l.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),i=pl(),m=wl(),p=l.useMemo(()=>o===void 0?void 0:M=>o(e,M),[o,e]),g=l.useRef(null),{editable:f,doubleClick:w,region:h,paneScroll:v,stale:E}=r;l.useLayoutEffect(()=>{if(f)return s.bindView(e,{anchor:()=>{const M=g.current,_=h(),I=M===null?null:M.querySelector(yt);return M===null||_===null||I===null?null:$r(M,v.scrollerOf(_,I))}})},[s,e,f,h,v]);const x=M=>{const _=g.current,{target:I}=M;!w||_===null||!(I instanceof Element)||!Ir(I)||(M.stopPropagation(),s.start(e,Fr(I,_,_.ownerDocument.getSelection())))},b=l.useRef(null),L=l.useRef(E);l.useLayoutEffect(()=>{L.current=E});const N=l.useEffectEvent(M=>{const _=g.current,I=h(),H=_===null?null:Hr(_,M.line);if(I===null||H===null)return!1;const j=v.scrollerOf(I,H);return j.scrollTop+=Ur(H,M.line)-M.clientTop,!0}),C=l.useEffectEvent(M=>{const _=h();if(_===null)return;const I=()=>{for(const j of Xn)_.removeEventListener(j,H,!0);b.current?.release===I&&(b.current=null)},H=()=>I();for(const j of Xn)_.addEventListener(j,H,{capture:!0,passive:!0});b.current={point:M,release:I}});return l.useLayoutEffect(()=>{const M=s.takeReturn(e);if(M!==null)return queueMicrotask(()=>{N(M)&&L.current&&C(M)}),()=>b.current?.release()},[s,e]),l.useLayoutEffect(()=>{const M=b.current;M===null||E||(M.release(),N(M.point))},[t,E]),c.jsx("div",{ref:g,className:"aqmx-document-viewer",onDoubleClick:x,children:c.jsx(Ne.MarkdownViewer,{...n,onHeadingSelect:i,headingHref:m,onMathDiagnostics:p,parseResult:a,content:null})})},Vo=({document:e,viewer:t})=>{const{labels:n}=F();return c.jsxs(c.Fragment,{children:[c.jsx(Ke,{name:e.name,openUrl:P.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:c.jsx(ka,{}),children:e.truncated?null:c.jsx(wi,{text:e.text})}),e.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-text-truncated",children:n.textTruncated}):null,c.jsx("div",{className:"aqmx-document-viewer",children:c.jsx(Ne.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},Ft=({path:e,name:t,viewer:n})=>{const{data:r,labels:o}=F(),s=l.useCallback(async p=>{const g=await r.text(e,p);return"kind"in g?g.kind==="failure"?{kind:"failure",failure:g.failure}:{kind:"read",value:g}:null},[r,e]),{shown:a,failure:i,retry:m}=mn(e,t,s);return a!==null?c.jsx(Vo,{document:a,viewer:n}):i!==null?c.jsx(ht,{failure:i,onRetry:m,testId:"markdown-explorer-markup-failure"}):c.jsx(ke,{label:o.markupLoading,testId:"markdown-explorer-markup-skeleton"})},rd=Object.freeze({reason:"failed"}),od=e=>{const{labels:t}=F();return c.jsx(Ra,{fallback:n=>c.jsx("div",{className:"aqmx-edit-message",children:c.jsx(xe,{failure:rd,alert:!1,onRetry:n,testId:"markdown-explorer-edit-load-failure"})}),children:c.jsx(l.Suspense,{fallback:c.jsx(ke,{label:t.editLoading,testId:"markdown-explorer-edit-skeleton"}),children:c.jsx(Ta,{...e})})})},sd=({path:e,document:t,view:n,viewer:r,contentViewer:o,onRetry:s,editing:a})=>{switch(t.kind){case"markdown":{const{session:i,layout:m,region:p,paneScroll:g,stale:f}=a;if(n==="edit"&&i!==void 0)return c.jsx(od,{path:e,name:t.name,session:i,layout:m,viewer:o,region:p,paneScroll:g});if(n==="markup")return c.jsx(Ft,{path:e,name:t.name,viewer:o});const w=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return c.jsx(nd,{path:e,document:t,viewer:o,editing:{editable:w,doubleClick:w&&m==="fill",region:p,paneScroll:g,stale:f}})}case"text":return c.jsx(Vo,{document:t,viewer:o});case"image":return n==="markup"&&fn(t)==="svg"?c.jsx(Ft,{path:e,name:t.name,viewer:r}):c.jsx(rl,{document:t});case"media":return c.jsx(Ol,{document:t});case"spreadsheet":return n==="markup"?c.jsx(Ft,{path:e,name:t.name,viewer:r}):c.jsx(Xc,{path:e,document:t});case"file":return c.jsx(Li,{document:t});case"failure":return c.jsx(ht,{failure:t.failure,onRetry:s,testId:"markdown-explorer-document-failure"});default:{const i=t;throw new RangeError(`[markdown-explorer] unknown document kind ${V.describeValue(i.kind)}`)}}},ad=e=>{const{document:t,viewer:n}=e,r=t.kind==="markdown"||t.kind==="text"?t.lang:void 0,o=l.useMemo(()=>r===void 0?n:{...n,contentLang:r},[n,r]);return c.jsx(wo,{value:r,children:c.jsx(sd,{...e,contentViewer:o})})},id='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',Yn=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:uo(e,n),r===void 0?null:co(e,r.id),e.querySelector(yt),e.querySelector(id)];for(const s of o)if(s instanceof HTMLElement&&on(s))return s;return null},Qn=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&on(t)},ld=e=>{const t=l.useRef(!1);return l.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=w=>{s=!(w.target instanceof Node&&n.contains(w.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},m=w=>{t.current=w.target instanceof Node&&n.contains(w.target)},p=w=>{w.relatedTarget===null&&s&&(t.current=!1)},g=()=>{const{activeElement:w,body:h}=r;w!==null&&w!==h&&(t.current=n.contains(w))},f=()=>{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",g),o.addEventListener("focus",f),n.addEventListener("focusout",p),()=>{clearTimeout(a),o.removeEventListener("pointerdown",i,!0),o.removeEventListener("mousedown",i,!0),o.removeEventListener("focusin",m,!0),o.removeEventListener("blur",g),o.removeEventListener("focus",f),n.removeEventListener("focusout",p)}},[e]),t},cd=Object.freeze({count:0,recovered:!1}),dd=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:i,fragment:m,paneScroll:p,announces:g,announceFailure:f,onDocumentShown:w})=>{const{labels:h,announcer:v,documents:E}=F(),{document:x}=t,b=l.useRef(null),L=l.useRef(null),N=l.useRef(null),C=l.useRef(null),[M,_]=l.useState(null),I=l.useRef(null),H=ld(b),j=l.useRef({path:e,document:x}),U=l.useRef(null),Z=l.useCallback(G=>{const X=b.current,ee=An(X,G,p);X!==null&&ee!==null&&Qn(X,ee,H.current)},[p,H]),K=l.useCallback((G,X)=>{const ee=C.current;setTimeout(()=>{X.defaultPrevented||l.startTransition(()=>_({fragment:G,from:ee}))},0)},[]),u=l.useCallback(G=>{setTimeout(()=>{G.defaultPrevented||Z("#")},0)},[Z]),d=l.useMemo(()=>({navigation:i,currentPath:e,scrollWithin:Z,followFragmentJump:K,followEmptyFragment:u}),[i,e,Z,K,u]),k=l.useCallback(()=>E.retry(e),[E,e]),T=zr(E,ll),O=Dr(e),$=O!==void 0?"edit":n?"markup":"rendered",y=fn(x)===null?void 0:$,S=l.useCallback(()=>b.current,[]),A=l.useCallback(()=>{const G=b.current;G!==null&&Yn(G,x,null)},[x]),D=l.useMemo(()=>({session:O,layout:s,region:S,paneScroll:p,stale:r}),[O,s,S,p,r]),q=y==="edit"?!1:r,Q=l.use(be),J=y==="edit"&&s==="fill"?"fill":Q,[W,oe]=l.useState(0),ge=l.useRef(0),de=l.useRef(!1),[ve,St]=l.useState(cd),[Pe,Qe]=l.useState(0),fe=l.useRef(f),_e=l.useRef(r);l.useLayoutEffect(()=>{fe.current=f,_e.current=r},[f,r]);const Je=l.useMemo(()=>({announceFailure:G=>{_e.current||fe.current(G)},readPart:()=>{const G=E.readPart(e);ge.current+=1;let X=!1,ee=!1,se=!1;return{settle:(me,Re)=>{if(G.settle(me,Re),!(se||X)){if(Re!==null){ee=!0,de.current=!1;return}X=!0,St(tt=>({count:tt.count+1,recovered:ee}))}},release:()=>{se||(se=!0,G.release(),ge.current-=1,X||Qe(me=>me+1))}}},holdBusy:()=>{oe(X=>X+1);let G=!0;return()=>{G&&(G=!1,oe(X=>X-1))}}}),[E,e]),et=q||W>0,B=l.useEffectEvent((G,X)=>{const ee=L.current;if(ee!==null&&ee.path===G&&ee.snapshot===X)return;L.current={path:G,snapshot:X},E.noteShown(G,X);const se=X.document;if(se.kind==="failure"){de.current=!1;const{reason:me}=se.failure;E.noteFailureShown(X)&&!ie(me)&&f(h.documentFailed(P.lastPathSegment(G),ce(h,me)));return}w?.(G,se),!(!g||ee!==null&&ee.path===G&&ee.snapshot.document.kind!=="failure")&&(de.current=ge.current>0,de.current||v.announce(h.documentShown(se.name)))});l.useEffect(()=>{B(e,t)},[e,t]);const Y=l.useEffectEvent(()=>{m.kind==="panel"&&m.consume()}),te=l.useEffectEvent(G=>{const X=b.current;if(X===null||!H.current)return null;const{activeElement:ee,body:se}=X.ownerDocument;return ee!==null&&ee!==se?null:Yn(X,x,G)}),Te=l.useEffectEvent(G=>{const X=de.current;de.current=!1,!r&&(G&&te(null),g&&(G||X)&&x.kind!=="failure"&&v.announce(h.documentShown(x.name)))});l.useEffect(()=>{ve.count>0&&Te(ve.recovered)},[ve]);const cs=l.useEffectEvent(()=>{ge.current>0||!de.current||(de.current=!1,g&&!r&&x.kind!=="failure"&&v.announce(h.documentShown(x.name)))});l.useEffect(()=>{Pe>0&&cs()},[Pe]);const ds=l.useEffectEvent(G=>{const X=b.current;X!==null&&Qn(X,G,H.current)}),us=l.useEffectEvent(G=>p.reveal(G)),fs=l.useEffectEvent(G=>An(b.current,G,p));return l.useEffect(()=>{if(r)return;const G=j.current.path!==e,X=G||j.current.document!==x;j.current={path:e,document:x};const ee=U.current!==e;U.current=e;let se=null;m.kind==="page"?N.current!==m.navigation&&(N.current=m.navigation,se=m.fragment):m.fragment!==null&&(se=m.fragment,Y());const me=()=>{const Re=se===null?null:fs(se);if(!X){Re!==null&&ds(Re);return}const tt=te(m.fragment);G&&Re===null&&tt!==null&&us(tt)};ee?queueMicrotask(me):me()},[m,e,x,r]),l.useLayoutEffect(()=>{C.current=m.kind==="page"?m.navigation:null},[m]),l.useEffect(()=>{M===null||M===I.current||r||(I.current=M,!(m.kind==="page"&&m.navigation!==M.from)&&Z(M.fragment))},[M,m,r,Z]),c.jsxs(be,{value:J,children:[c.jsx(xi,{path:e,name:x.kind==="failure"?P.lastPathSegment(e):x.name,editing:O!==void 0,announces:g,markup:n,region:b,focusDocument:A}),c.jsx(Le,{kind:x.kind,view:y,label:a(e,x),stale:et,busy:et,frameRef:b,intent:T,children:c.jsx(po,{value:d,children:c.jsx(al,{children:c.jsx(oo,{value:Je,children:c.jsx(ad,{path:e,document:x,view:$,viewer:o,onRetry:k,editing:D},e)})})})})]})},gn=Object.freeze({kind:"skeleton"}),ud=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=we(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:we(r);return n===null||a===null?gn:{kind:"document",path:n,snapshot:a,stale:!0}},fd=(e,t)=>t.status==="deferred"?gn:{kind:"document",path:e,snapshot:t,stale:!1},md=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?fd(t.path,l.use(t.promise)):t;return o.kind!=="document"?c.jsx(wn,{label:r.regionLabel(e,null)}):c.jsx(dd,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},zo=({path:e,absence:t,markup:n,display:r,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:p})=>{const{config:g,labels:f,locale:w,theme:h,documents:v,data:E,fetch:x}=F(),b=Ne.useMarkdownToolbarState(),L=l.useRef(!1);l.useLayoutEffect(()=>{L.current=!0},[]);const[N,C]=l.useState(null),[M,_]=l.useState(n),I=l.useCallback(()=>e===null?void 0:v.peek(e),[v,e]),H=l.useSyncExternalStore(v.subscribe,I,I),j=l.useCallback(()=>N===null?void 0:v.peek(N),[v,N]),U=l.useSyncExternalStore(v.subscribe,j,j);l.useLayoutEffect(()=>e===null?void 0:v.open(e),[v,e]),l.useLayoutEffect(()=>N===null?void 0:v.retain(N),[v,N]);const Z=e===null?gn:ud(e,H,N,U,!L.current),K=e===null?null:Z.kind==="document"&&!Z.stale?Z.path:N;K!==N&&C(K);const u=Z.kind!=="document"||Z.path===e;u&&n!==M&&_(n);const d=l.useMemo(()=>Gl(f,w),[f,w]),k=l.useMemo(()=>({read:(D,q)=>ol(E,D,q)}),[E]),T=l.useMemo(()=>[...g.iframeHosts],[g]),O=o.kind==="panel",$=dn(),y=l.useMemo(()=>({labels:d,labelsLang:w,spreadsheetLocale:w,spreadsheetTapScrollCircle:Jr($),spreadsheetScrollBarControls:sn($),emptyMessage:f.documentEmpty,theme:h,availableStyles:g.documentStyles,iFrameAllowedDomains:T,embeds:g.embeds,fetch:x,linkComponent:hl,toolbar:b,style:r.style,onStyleChange:r.onStyleChange,align:r.align,onAlignChange:r.onAlignChange,measure:r.measure,onMeasureChange:r.onMeasureChange,contentColors:r.documentColors,onContentColorsChange:r.onDocumentColorsChange,showToc:r.showToc,showStyle:r.showStyle,showAlign:r.showAlign,showMeasure:r.showMeasure,showContentColors:r.showContentColors,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:O?void 0:Zr,scrollBarInlineSize:O?void 0:an,scrollBarGutter:O?void 0:cn,imageSource:k}),[d,w,$,f.documentEmpty,h,g.documentStyles,T,g.embeds,x,b,r,O,k]),S=l.useCallback((D,q)=>O?q===null||q.kind==="failure"?P.lastPathSegment(D):q.name:f.documentRegion,[O,f.documentRegion]),A=O?"content":"fill";return e===null?c.jsx(be,{value:A,children:c.jsx(td,{absence:t,announces:i,announceFailure:m})}):c.jsx(be,{value:A,children:c.jsx(l.Suspense,{fallback:c.jsx(wn,{label:S(e,null)}),children:c.jsx(md,{requestedPath:e,content:Z,markup:u?n:M,viewer:y,editLayout:r.editLayout,regionLabel:S,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:p})})})},Go=()=>{const{viewSettings:e}=F(),t=ye(s=>s.measure),n=ye(s=>s.documentColors),r=l.useCallback(s=>e.update({measure:s}),[e]),o=l.useCallback(s=>e.update({documentColors:s}),[e]);return l.useMemo(()=>({measure:t,onMeasureChange:r,documentColors:n,onDocumentColorsChange:o}),[t,r,n,o])},hd=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a,announcer:i}=F(),m=ye(j=>j.style),p=ye(j=>j.align),g=Se(),f=re.useLocation(),w=Ge(),{overrides:h,embed:v}=r,E=l.useCallback(j=>{if(w.kind!=="location")return;const U=Jc(s,w.location,j);U!==null&&g(U,"browse")},[s,g,w]),x=l.useCallback(j=>{a.update({style:j}),E("style")},[a,E]),b=l.useCallback(j=>{a.update({align:j}),E("align")},[a,E]),L=Mo(s,h.style,m),N=Lo(h.align,p),C=Go(),M=l.useMemo(()=>({style:L,onStyleChange:x,align:N,onAlignChange:b,...C,showToc:v.showToc!==!1,showStyle:v.showStyle!==!1,showAlign:v.showAlign!==!1,showMeasure:v.showStyle!==!1,showContentColors:v.showStyle!==!1,padding:v.padding,width:v.width,maxWidth:v.maxWidth,editLayout:"fill"}),[L,x,N,b,C,v]),_=r,I=l.useMemo(()=>({kind:"page",fragment:f.hash,navigation:f}),[f]),H=l.useCallback(j=>i.announce(j),[i]);return c.jsx(zo,{path:e,absence:t,markup:n,display:M,navigation:_,fragment:I,paneScroll:qi,announces:!0,announceFailure:H,onDocumentShown:o})},pd=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a}=F(),i=ye(I=>I.style),m=ye(I=>I.align),[p,g]=l.useState(()=>Mo(s,void 0,i)),f=Lo(void 0,m),w=l.useCallback(I=>a.update({align:I}),[a]),h=Go(),{maximized:v,onDocumentLink:E,pendingHash:x,onHashConsumed:b,announceFailure:L,paneScroll:N}=r,C=l.useMemo(()=>({style:p,onStyleChange:g,align:f,onAlignChange:w,...h,showToc:v,showStyle:v,showAlign:v,showMeasure:v,showContentColors:v,padding:void 0,width:void 0,maxWidth:void 0,editLayout:v?"fill":"content"}),[p,f,w,h,v]),M=l.useMemo(()=>({kind:"panel",onDocumentLink:E}),[E]),_=l.useMemo(()=>({kind:"panel",fragment:x,consume:b}),[x,b]);return c.jsx(zo,{path:e,absence:t,markup:n,display:C,navigation:M,fragment:_,paneScroll:N,announces:!1,announceFailure:L,onDocumentShown:o})},Zo=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>r.kind==="page"?c.jsx(hd,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o}):c.jsx(pd,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o});function wd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Wo=R.forwardRef(wd);function gd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M3.22 3.22a.75.75 0 0 1 1.06 0l3.97 3.97V4.5a.75.75 0 0 1 1.5 0V9a.75.75 0 0 1-.75.75H4.5a.75.75 0 0 1 0-1.5h2.69L3.22 4.28a.75.75 0 0 1 0-1.06Zm17.56 0a.75.75 0 0 1 0 1.06l-3.97 3.97h2.69a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75V4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0ZM3.75 15a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-2.69l-3.97 3.97a.75.75 0 0 1-1.06-1.06l3.97-3.97H4.5a.75.75 0 0 1-.75-.75Zm10.5 0a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-2.69l3.97 3.97a.75.75 0 1 1-1.06 1.06l-3.97-3.97v2.69a.75.75 0 0 1-1.5 0V15Z",clipRule:"evenodd"}))}const vd=R.forwardRef(gd);function Ed({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Ko=R.forwardRef(Ed);function yd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Xo=R.forwardRef(yd);function xd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 bd=R.forwardRef(xd);function kd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Sd=R.forwardRef(kd);function Td({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Rd=R.forwardRef(Td);function Cd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Md=R.forwardRef(Cd);function Ld({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),R.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 Yo=R.forwardRef(Ld);function Od({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Ad=R.forwardRef(Od);function Dd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Nd=R.forwardRef(Dd),Qo=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=F(),[s,a]=l.useState(!1),i=()=>{o===void 0||s||(a(!0),o(e).then(m=>{m&&t()}).finally(()=>a(!1)))};return c.jsxs("div",{className:"aqmx-callout aqmx-edit-grant","data-testid":n,children:[c.jsx("p",{className:"aqmx-callout-title",children:r.editGrantTitle}),c.jsx("p",{className:"aqmx-callout-body",children:r.editGrantBody}),c.jsxs("div",{className:"aqmx-edit-grant-actions",children:[o===void 0?c.jsx("a",{className:"aqmx-callout-action",href:e,target:"_blank",rel:"noopener","data-testid":`${n}-open`,children:r.editGrantAction}):c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":s,"data-testid":`${n}-open`,onClick:i,children:r.editGrantAction}),c.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},jd="Control+E Meta+E",Jo=(e,t,n)=>n&&t?"split":e.view,Yt=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},Pd=e=>e==="split"?null:e,es=e=>e==="preview"?"editor":"preview",ts=e=>/Mac|iPhone|iPad|iPod/u.test(e),ns=(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)},Jn=(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)},_d=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:i,announcer:m}=F(),p=l.useId(),[g,f]=l.useState(null),[w,h]=l.useState(0),[v,E]=l.useState(null),[x,b]=l.useState(null),[L,N]=l.useState(0),C=l.useMemo(()=>new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}),[i]),M=l.useCallback(()=>{E(null),b(null)},[]),_=Mr({open:n,onOpen:M,onDismiss:r});l.useEffect(()=>{if(!n)return;const j=new AbortController;return f(null),o.revisions(e,j.signal).then(U=>{"kind"in U&&f(U)}),()=>j.abort()},[n,o,e,w]),l.useEffect(()=>{if(!n||v===null)return;const j=new AbortController;return b(null),o.revision(e,v,j.signal).then(U=>{"kind"in U&&b(U)}),()=>j.abort()},[n,o,e,v,L]);const I=()=>{x===null||x.kind!=="revision"||(s.replaceDraft(e,x.text),m.announce(a.historyRestored(t)),r())},H=g!==null&&g.kind==="revisions"?g.revisions.find(j=>j.id===v):void 0;return c.jsx("dialog",{..._,className:"aqmx-confirm aqmx-history","aria-labelledby":p,"data-testid":"markdown-explorer-history",children:c.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[c.jsx("p",{id:p,className:"aqmx-confirm-title",children:a.historyTitle(t)}),g===null?c.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):g.kind==="failure"?c.jsx(xe,{failure:g.failure,alert:!1,onRetry:()=>h(j=>j+1),testId:"markdown-explorer-history-failure"}):g.revisions.length===0?c.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:a.historyEmpty}):c.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:g.revisions.map(j=>c.jsx("li",{children:c.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":j.id===v,"data-testid":"markdown-explorer-history-entry",onClick:()=>E(j.id),children:[c.jsx("span",{children:Jn(j,C,a.historyEntry)}),j.current?c.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,j.kept?c.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},j.id))}),v===null?null:x===null?c.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):x.kind==="failure"?c.jsx(xe,{failure:x.failure,alert:!1,onRetry:()=>N(j=>j+1),testId:"markdown-explorer-history-revision-failure"}):c.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":H===void 0?a.historyTitle(t):Jn(H,C,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:c.jsx("pre",{children:x.text})}),c.jsxs("div",{className:"aqmx-confirm-actions",children:[c.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":"markdown-explorer-history-close",onClick:r,children:a.historyClose}),c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":x===null||x.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:I,children:a.historyRestore})]})]})})},Id=(e,t)=>{if(!t||e===void 0||e.history||!e.dirty||e.phase.kind!=="editing")return!1;const{kind:n}=e.save;return n!=="draft"&&n!=="saving"&&n!=="conflicts"},rs=e=>{const{edits:t,labels:n,confirmUnversionedSaves:r}=F(),[o,s]=l.useState(!1),a=l.useCallback(()=>{t.flush(e),Id(t.session(e),r)?s(!0):t.save(e)},[t,e,r]),i=c.jsx(nn,{open:o,title:n.unversionedSaveTitle,body:n.unversionedSaveBody,confirmLabel:n.unversionedSaveConfirm,cancelLabel:n.unsavedStay,testId:"markdown-explorer-unversioned-save-confirm",onConfirm:()=>{s(!1),t.save(e)},onCancel:()=>s(!1)});return{requestSave:a,confirmation:i}},Fd=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=l.useSyncExternalStore(t.subscribe,n,r),s=we(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:P.lastPathSegment(e)}:{edit:s.kind==="markdown"||s.kind==="spreadsheet"?s.edit:null,name:s.name}},ue=e=>{e.stopPropagation()},$d=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:a,labels:i}=F(),m=l.useSyncExternalStore(a.subscribe,()=>a.session(e)!==void 0,()=>!1),[p,g]=l.useState(null),f=()=>{if(!m){a.start(e,a.viewAnchor(e));return}a.flush(e);const E=a.session(e);E?.dirty===!0?g(E.save.kind==="draft"?"draft":"unsaved"):a.close(e)},w=()=>{m||(Sa(),r&&a.sideBySide()&&s?.prepare?.())},h=n?o?i.editDraftDocumentNamed(t):i.editDocumentNamed(t):null,v=o?i.editDraftDocument:i.editDocument;return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:m?i.closeEditor:h===null?v:h,"aria-label":h===null?void 0:h,"aria-pressed":m,"data-testid":"markdown-explorer-document-edit",onClick:f,onDoubleClick:ue,onPointerEnter:w,onFocus:w,children:[c.jsx(Ad,{"aria-hidden":"true"}),h===null?c.jsx("span",{children:i.editDocumentLabel}):null]}),c.jsx(nn,{open:p!==null,title:p==="draft"?i.draftDiscardTitle:i.unsavedTitle,body:p==="draft"?i.draftDiscardBody(t):i.unsavedBody(t),confirmLabel:i.unsavedDiscard,cancelLabel:i.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{g(null),a.close(e)},onCancel:()=>g(null)})]})},qd=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=F(),o=n?r.editExternallyNamed(t):null;return c.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:ue,children:[c.jsx(bd,{"aria-hidden":"true"}),o===null?c.jsx("span",{children:r.editExternallyLabel}):null]})},Bd=({session:e})=>{const{labels:t}=F(),n=Js(t,e);return c.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})},Hd=Object.freeze(["editor","split","preview"]),Ud=Object.freeze(["editor","preview"]),Vd=Object.freeze({editor:Xo,split:Nd,preview:Yo}),zd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:a,labels:i}=F(),m=jr(),p=Jo(r,m,o),g=o?Hd:Ud,f=l.useId(),w=l.useRef(new Map),h={editor:{label:i.editViewEditor,tooltip:i.editViewEditorTooltip},split:{label:i.editViewSplit,tooltip:i.editViewSplitTooltip},preview:{label:i.editViewPreview,tooltip:i.editViewPreviewTooltip}},v=()=>{a.preparePreview(e),s?.prepare?.()},E=x=>{if(!ns(x.nativeEvent,ts(navigator.platform)))return;tn(x);const b=es(p);Yt(a,e,b,o),w.current.get(b)?.focus()};return c.jsx("div",{role:"radiogroup","aria-label":n?i.editViewNamed(t):i.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:E,children:g.map(x=>{const b=Vd[x],{label:L,tooltip:N}=h[x],C=x==="preview"?v:void 0;return c.jsxs("label",{className:n?"aqmx-icon-button":"aqmx-icon-button aqmx-labelled-button",children:[c.jsx("input",{ref:M=>{M===null?w.current.delete(x):w.current.set(x,M)},type:"radio",name:f,value:x,checked:x===p,"aria-label":L,"aria-keyshortcuts":x==="split"?void 0:jd,title:N,"data-testid":`markdown-explorer-edit-view-${x}`,onChange:()=>Yt(a,e,x,o),onDoubleClick:ue,onPointerEnter:C,onFocus:C}),c.jsx(b,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:L})]},x)})})},Gd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:a}=F(),[i,m]=l.useState(!1),{requestSave:p,confirmation:g}=rs(e);if(r.phase.kind!=="editing")return null;const f=r.save.kind==="saving",w=f||!r.dirty,h=()=>{s.flush(e);const E=s.session(e);E===void 0||!E.dirty||E.save.kind==="saving"||p()},v=E=>n?{className:"aqmx-icon-button","aria-label":E}:{className:"aqmx-icon-button aqmx-labelled-button"};return c.jsxs(c.Fragment,{children:[r.save.kind==="conflicts"?c.jsxs("button",{type:"button",...v(a.conflictNext),title:a.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ue,children:[c.jsx(Sd,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.conflictNext})]}):null,c.jsx(zd,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?c.jsxs("button",{type:"button",...v(a.historyOpen),title:a.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>m(!0),onDoubleClick:ue,children:[c.jsx(Rd,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.historyOpen})]}):null,r.save.kind==="draft"?null:c.jsxs("button",{type:"button",...v(a.saveDraft),title:a.saveDraftTooltip,"aria-disabled":w,"aria-busy":f,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:h,onDoubleClick:ue,children:[c.jsx(Md,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.saveDraft})]}),r.history?c.jsx(_d,{path:e,documentName:t,open:i,onClose:()=>m(!1)}):null,g]})},Zd=({path:e,session:t})=>{const{edits:n}=F(),{save:r}=t,o=()=>{n.save(e)};return r.kind==="grant"?c.jsx(Qo,{href:r.href,onRetry:o,testId:"markdown-explorer-save-grant"}):r.kind==="failed"&&ie(r.failure.reason)?c.jsx(Ze,{failure:r.failure,place:"write",deniedSentence:null,retry:o,testId:"markdown-explorer-save-access-failure"}):null},os=l.createContext(null);function Wd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M7.502 6h7.128A3.375 3.375 0 0 1 18 9.375v9.375a3 3 0 0 0 3-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 0 0-.673-.05A3 3 0 0 0 15 1.5h-1.5a3 3 0 0 0-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6ZM13.5 3A1.5 1.5 0 0 0 12 4.5h4.5A1.5 1.5 0 0 0 15 3h-1.5Z",clipRule:"evenodd"}),R.createElement("path",{fillRule:"evenodd",d:"M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 0 1 3 20.625V9.375Zm9.586 4.594a.75.75 0 0 0-1.172-.938l-2.476 3.096-.908-.907a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.116-.062l3-3.75Z",clipRule:"evenodd"}))}const Kd=R.forwardRef(Wd);function Xd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M19.902 4.098a3.75 3.75 0 0 0-5.304 0l-4.5 4.5a3.75 3.75 0 0 0 1.035 6.037.75.75 0 0 1-.646 1.353 5.25 5.25 0 0 1-1.449-8.45l4.5-4.5a5.25 5.25 0 1 1 7.424 7.424l-1.757 1.757a.75.75 0 1 1-1.06-1.06l1.757-1.757a3.75 3.75 0 0 0 0-5.304Zm-7.389 4.267a.75.75 0 0 1 1-.353 5.25 5.25 0 0 1 1.449 8.45l-4.5 4.5a5.25 5.25 0 1 1-7.424-7.424l1.757-1.757a.75.75 0 1 1 1.06 1.06l-1.757 1.757a3.75 3.75 0 1 0 5.304 5.304l4.5-4.5a3.75 3.75 0 0 0-1.035-6.037.75.75 0 0 1-.354-1Z",clipRule:"evenodd"}))}const Yd=R.forwardRef(Xd),Qd=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=we(l.useSyncExternalStore(t.subscribe,n,r));return o!==null&&o.document.kind!=="failure"},Jd=(e,t)=>{switch(e.view){case"single":return{view:"document-id",id:t,opens:"single",overrides:e.overrides,embed:e.embed};case"tree":return{view:"document-id",id:t,overrides:e.overrides};case"multi":return{view:"document-id",id:t}}},eu=(e,t)=>new Promise(n=>n(e.write([t()]))),tu=({path:e,placement:t,onAccessFailure:n})=>{const{config:r,data:o,labels:s}=F(),{location:a}=Ge(),{shown:i,press:m}=ro(),p=Qd(e),g=l.useRef(0),f=re.useHref(r.basePath),w=x=>{const b=z.explorerHref(r,Jd(a,x));return new URL(`${f}${b.slice(r.basePath.length)}`,window.location.origin).href},h=()=>{if(!p)return;const x=m();g.current+=1;const b=g.current;n(null);const L=_=>{console.error("[markdown-explorer] could not copy the permalink",_),x("failed",s.permalinkCopyFailed(s.permalinkClipboardRefused))},N=navigator.clipboard;if(N===void 0||typeof ClipboardItem>"u"){x("failed",s.permalinkCopyFailed(s.permalinkClipboardRefused));return}const C=o.issueId(e),M=C.then(_=>_.status==="ok"?new Blob([w(_.id)],{type:"text/plain"}):Promise.reject(new Error(`[markdown-explorer] the document ID was not issued: ${_.failure.reason}`)));M.catch(()=>{}),eu(N,()=>new ClipboardItem({"text/plain":M})).then(()=>C.then(_=>{_.status==="ok"&&x("copied",s.permalinkCopied(P.groupDocumentId(_.id)))}),_=>C.then(I=>{if(I.status!=="error"){L(_);return}const{failure:H}=I,{reason:j}=H;ie(j)?g.current===b&&n(H):x("failed",s.permalinkCopyFailed(ce(s,j)))}))},v=t.kind==="panel"?s.copyPermalinkNamed(t.documentName):null,E=i.message===null?v===null?s.copyPermalink:v:i.message;return c.jsxs("button",{type:"button",className:v===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:E,"aria-label":v===null?void 0:v,"aria-disabled":!p,"data-aqmx-copy-outcome":i.outcome,"data-testid":"markdown-explorer-document-permalink",onClick:h,onDoubleClick:ue,children:[i.outcome==="copied"?c.jsx(Kd,{"aria-hidden":"true"}):i.outcome==="failed"?c.jsx(no,{"aria-hidden":"true"}):c.jsx(Yd,{"aria-hidden":"true"}),v===null?c.jsx("span",{children:s.copyPermalinkLabel}):null]})},nu=(e,t)=>{switch(t){case"markdown":return e.showMarkup;case"svg":return e.showSvgMarkup;case"csv":case"tsv":return e.showSpreadsheetMarkup(t.toUpperCase())}},ru=({maximize:e})=>{const{labels:t}=F(),n=e.maximized?t.documentRestore:t.documentMaximize;return c.jsx("button",{type:"button",className:"aqmx-icon-button",title:n,"aria-label":n,"data-testid":"markdown-explorer-document-maximize",onClick:e.toggle,onDoubleClick:ue,children:e.maximized?c.jsx(vd,{"aria-hidden":"true"}):c.jsx(Ko,{"aria-hidden":"true"})})},ss=Object.freeze({kind:"page"}),as=({path:e,placement:t,markup:n,maximize:r})=>{const{config:o,labels:s}=F(),{refreshing:a,unavailable:i,failure:m,refresh:p}=so(e,t.kind==="page",n.shown),g=Al(e),f=Fd(e),w=Dr(e),h=t.kind==="panel"?s.refreshDocumentNamed(t.documentName):null,v=t.kind==="panel"?s.showMarkupNamed(t.documentName):null,E=t.kind==="panel",x=t.kind==="panel"?t.documentName:f.name,b=t.kind==="page"||t.maximized,L=l.use(os),N=t.kind==="page"?L:null,C=N===null?null:N.onBar;l.useLayoutEffect(()=>{if(C!==null)return C(!0),()=>C(!1)},[C]);const M=N===null?void 0:N.lane?"merged":"covering",[_,I]=l.useState(null);_!==null&&_.path!==e&&I(null);const H=_!==null&&_.path===e?_.failure:null,j=l.useCallback(U=>I(U===null?null:{path:e,failure:U}),[e]);return c.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":w===void 0?void 0:"true","data-aqmx-sheet-bar":M,children:[c.jsxs("div",{className:"aqmx-document-refresh-row",children:[w===void 0?null:c.jsx(Bd,{session:w}),w===void 0?null:c.jsx(Gd,{path:e,documentName:x,iconOnly:E,session:w,previewAvailable:b}),w===void 0&&g!==null?c.jsxs("button",{type:"button",className:v===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:v===null?nu(s,g):v,"aria-label":v===null?void 0:v,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ue,children:[c.jsx(Xo,{"aria-hidden":"true"}),v===null?c.jsx("span",{children:s.showMarkupLabel}):null]}):null,w!==void 0||f.edit?.kind==="inline"||f.edit?.kind==="draft"?c.jsx($d,{path:e,documentName:x,iconOnly:E,previewAvailable:b,draft:f.edit?.kind==="draft"}):f.edit?.kind==="external"?c.jsx(qd,{href:f.edit.href,documentName:x,iconOnly:E}):null,w===void 0?c.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h===null?s.refreshDocument:h,"aria-label":h===null?void 0:h,"aria-disabled":i,"aria-busy":a,"data-aqmx-busy":a?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:p,onDoubleClick:ue,children:[c.jsx(Wo,{"aria-hidden":"true"}),h===null?c.jsx("span",{children:s.refreshDocumentLabel}):null]}):null,w===void 0&&o.documentIds!==null?c.jsx(tu,{path:e,placement:t,onAccessFailure:j}):null,r===null?null:c.jsx(ru,{maximize:r})]}),w!==void 0||m===null?null:c.jsx(ou,{failure:m,onRetry:p}),w!==void 0||H===null?null:c.jsx(Ze,{failure:H,place:"write",deniedSentence:null,retry:null,testId:"markdown-explorer-permalink-access-failure"}),w===void 0?null:c.jsx(Zd,{path:e,session:w})]})},ou=({failure:e,onRetry:t})=>{const{labels:n}=F(),{reason:r}=e;return ie(r)?c.jsx(Ze,{failure:e,place:"read",deniedSentence:null,retry:t,testId:"markdown-explorer-document-refresh-failure"}):c.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":r,children:n.documentRefreshFailed(ce(n,r))})},su=({location:e})=>{const t=e.doc,n=l.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=Eo(e);return c.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",...ut,children:[c.jsx(as,{path:t,placement:ss,markup:r,maximize:null}),c.jsx(Zo,{path:t,absence:Uo,markup:e.markup,variant:n})]})},is=({holds:e,deferWhileFullscreenIn:t,testId:n})=>{const{labels:r,announcer:o}=F(),s=l.useId();l.useLayoutEffect(()=>{if(!e)return;const m=t===null?null:()=>t.current!==null&&La(t.current);return o.claim(s,m)},[e,o,s,t]),l.useEffect(()=>{if(t===null)return;const m=t.current;if(m===null)return;const p=()=>o.publishDeferred();return m.addEventListener("close",p,!0),()=>m.removeEventListener("close",p,!0)},[o,t]);const a=l.useCallback(()=>o.shownIn(s),[o,s]),i=l.useSyncExternalStore(o.subscribe,a,a);return c.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":n,children:i.length>1?r.announcementSequence(i):i[0]})},Ce=Object.freeze([]),au=e=>{const t=new Set;let n=Ce,r=[],o=!1;const s=[];let a=[];const i=h=>{n=h;for(const v of[...t])v()},m=()=>s.at(-1)?.region,p=()=>s.at(-1)?.defers?.()===!0,g=h=>{const v=m();h(),m()!==v&&n!==Ce&&i(Ce)},f=()=>{o=!1;const h=r.map(E=>"sentence"in E?E.sentence:E.list(E.items));if(r=[],p()){for(const E of h)a.at(-1)!==E&&a.push(E);return}const v=[...a,...h];a=[],i(Object.freeze(v))},w=()=>{o||(o=!0,n!==Ce&&i(Ce),e.request(f))};return{announce:h=>{if(typeof h=="string")r.push({sentence:h});else{const v=r.find(E=>"list"in E&&E.list===h.list);v!==void 0&&"items"in v?v.items.push(h.item):r.push({list:h.list,items:[h.item]})}w()},subscribe:h=>(t.add(h),()=>{t.delete(h)}),claim:(h,v)=>{const E={region:h,defers:v};return g(()=>s.push(E)),()=>g(()=>{const x=s.indexOf(E);x!==-1&&s.splice(x,1)})},publishDeferred:()=>{a.length>0&&!p()&&w()},shownIn:h=>m()===h?n:Ce}},he=Object.freeze({status:"cancelled"}),iu=e=>P.isExplorerResolvedDocumentId(e)&&(e.status!=="ok"||z.hasDocumentUrl(e.path)),er=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(P.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return P.failureOf(n,r)},lu=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((f,w)=>globalThis.fetch(f,w)),o=(f,w)=>`${e}/${f}?${new URLSearchParams(w).toString()}`,s=f=>{f.status===401&&t(null);const w=f.headers.get(P.EXPLORER_SCOPE_HEADER);w!==null&&t(w)},a=async(f,w,h,v)=>{let E;try{E=await r(f,{credentials:"same-origin",...w,headers:{Accept:"application/json",...w.headers}})}catch{return v({reason:"failed"})}s(E);let x;try{x=await E.json()}catch{return v({reason:P.failureReasonOfStatus(E.status)})}let b;try{b=h(x)}catch{b=!1}if(b)return x;const L=er(x);return v(L!==null?L:{reason:E.status===200?"failed":P.failureReasonOfStatus(E.status)})},i={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_REFRESH_PROOF},m={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_EDIT_PROOF,"Content-Type":`${P.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},p={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_DOCUMENT_ID_PROOF},g=async(f,w,h)=>{const v=await a(f,w,h,E=>P.failureDocument(E.reason,E.code));return w.signal.aborted?he:v};return{tree:f=>a(o("tree",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"GET"},P.isExplorerTreeResult,w=>({status:"error",failure:w})),children:async(f,w,h)=>{const v=await a(o("children",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerChildrenResult,E=>({status:"error",failure:E}));return h.aborted?he:v},ancestors:async(f,w,h)=>{const v=await a(o("ancestors",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerAncestorsResult,E=>({status:"error",failure:E}));return h.aborted?he:v},reveal:async(f,w,h)=>{const v=await a(o("reveal",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerRevealResult,E=>({status:"error",failure:E}));return h.aborted?he:v},document:(f,{refresh:w})=>a(o("document",{[P.EXPLORER_DATA_QUERY.path]:f}),w?{method:"GET",headers:i}:{method:"GET"},P.isExplorerDocument,h=>P.failureDocument(h.reason,h.code)),text:async(f,w)=>{const h=await a(o("text",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerTextAnswer,v=>P.failureDocument(v.reason,v.code));return w.aborted?he:h},asset:async(f,w)=>{let h;try{h=await r(f,{method:"GET",credentials:"same-origin",signal:w})}catch{return w.aborted?he:{status:"error",failure:{reason:"failed"}}}if(s(h),h.ok)return w.aborted?he:{status:"ok",body:h.body===null?new ReadableStream({start:x=>x.close()}):h.body};let v=null;try{v=await h.json()}catch{}if(w.aborted)return he;const E=er(v);return{status:"error",failure:E===null?{reason:P.failureReasonOfStatus(h.status)}:E}},edit:(f,w)=>g(o("edit",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerEditAnswer),save:(f,w,h,v)=>g(o("save",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.base]:w}),{method:"POST",headers:m,body:h,signal:v},P.isExplorerSaveAnswer),preview:(f,w,h)=>g(o("preview",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"POST",headers:m,body:w,signal:h},P.isExplorerPreviewAnswer),revisions:(f,w)=>g(o("revisions",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerRevisionsAnswer),revision:(f,w,h)=>g(o("revision",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.revision]:w}),{method:"GET",signal:h},P.isExplorerRevisionAnswer),refresh:f=>a(o("refresh",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"POST",headers:i},P.isExplorerTreeResult,w=>({status:"error",failure:w})),issueId:f=>a(o("issue-id",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"POST",headers:p},P.isExplorerIssuedDocumentId,w=>({status:"error",failure:w})),resolveId:async(f,w)=>{const h=await a(o("resolve-id",{[P.EXPLORER_DATA_QUERY.id]:f}),{method:"GET",signal:w},iu,v=>({status:"error",failure:v}));return w.aborted?he:h}}},cu=()=>{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}}},du=e=>{const t=ae.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 ${V.describeValue(e)} does not hold JSON; using the default tree settings.`,n),z.NO_TREE_SETTING_CHANGES}},tr=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=du(e);n={changes:s,settings:z.applyTreeSettingChanges(t,s)}}return n},o=je();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(),ae.writeStorage(e,z.serializeTreeSettingChanges(m)),n.settings}}},uu=Object.freeze({status:"refreshed"}),fu=Object.freeze({status:"superseded"}),mu=Object.freeze({status:"unshown"}),Qt=Object.freeze({status:"deferred"}),hu=Lr(Qt),ls=4,pu=ls-1,nr=Object.freeze({status:"loading"}),wu=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),gu=e=>{const t=new Map,n=to(),r=new Map,o=new Map,s=new Map,a=new Map,i=je(),m=new Set;let p=0,g=0;const f={direct:null,bulk:null},w=new Set;let h=!1,v=0;const E=()=>{v+=1,i.emit()},x=y=>o.get(y)??0,b=y=>{let S=a.get(y);return S===void 0&&(S={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(y,S)),S},L=(y,S,A)=>{y.inFlight.delete(S),p-=1,A.lane==="bulk"&&(g-=1)},N=y=>{const S=a.get(y);if(S!==void 0){for(const[A,D]of[...S.inFlight])L(S,A,D),D.controller.abort();S.direct.clear(),S.bulk.clear(),S.unclaimed.clear()}},C=y=>{const S=x(y)+1;return o.set(y,S),N(y),S},M=(y,S)=>{const A=Be(y),D={promise:y,opened:S,stale:!1,loadedAt:A?.status==="ok"?A.loadedAt:null};return y.status==="pending"&&y.then(q=>{q.status==="ok"&&(D.loadedAt=q.loadedAt)}),D},_=y=>{let S=r.get(y);return S===void 0&&(S=new Map,r.set(y,S)),S},I=y=>{const S=[...a.keys()],A=f[y],D=A===null?0:S.indexOf(A)+1;for(let q=0;q<S.length;q+=1){const Q=S[(D+q)%S.length],J=Q===void 0?void 0:a.get(Q);if(!(Q===void 0||J===void 0)){for(const W of J[y])if((J.claims.get(W)??0)!==0)return J[y].delete(W),f[y]=Q,{sourceId:Q,path:W}}}return null},H=(y,S,A,D)=>{const q=a.get(y);if(q===void 0||q.inFlight.get(S)!==A)return;L(q,S,A);const Q=(q.claims.get(S)??0)>0,J=_(y);if(D.status==="ok"?J.set(S,{status:"loaded",entries:D.entries}):D.status==="error"&&Q?J.set(S,{status:"failed",failure:D.failure}):J.delete(S),E(),D.status==="error"&&Q){const W={sourceId:y,path:S,failure:D.failure};for(const oe of[...m])oe(W)}U()},j=(y,S,A)=>{const D={controller:new AbortController,lane:A};b(y).inFlight.set(S,D),p+=1,A==="bulk"&&(g+=1),e.children(y,S,D.controller.signal).then(q=>H(y,S,D,q),()=>H(y,S,D,wu))},U=()=>{for(;p<ls;){const y=I("direct");if(y!==null){j(y.sourceId,y.path,"direct");continue}const S=g<pu?I("bulk"):null;if(S===null)return;j(S.sourceId,S.path,"bulk")}},Z=(y,S,A)=>{if(!(S.direct.delete(A)||S.bulk.delete(A))){const q=S.inFlight.get(A);if(q===void 0)return!1;L(S,A,q),q.controller.abort()}return r.get(y)?.delete(A),!0},K=()=>{h=!1;let y=!1;for(const S of w){const A=b(S);for(const D of A.unclaimed)(A.claims.get(D)??0)===0&&Z(S,A,D)&&(y=!0);A.unclaimed.clear()}w.clear(),y&&(E(),U())},u=(y,S)=>{t.set(y,M(Ue(e.tree(y)),S))},d=(y,S,A)=>{C(y);const D=M(Lr(S),A);return t.set(y,D),r.delete(y),E(),U(),D},k=(y,S,A,D)=>{if(A!==x(y)||t.get(y)!==S)return;const q=Be(S.promise);if(!(D.status!=="ok"||q?.status!=="ok"||S.loadedAt===null||D.loadedAt<=S.loadedAt)){if(mt(q.entries,D.entries)){S.loadedAt=D.loadedAt;return}d(y,D,S.opened)}},T=(y,S)=>{const A=t.get(y);return A!==void 0&&Be(A.promise)?.status===S},O=(y,S)=>{S.stale=!1;const A=x(y);e.tree(y).then(D=>k(y,S,A,D))},$=async(y,S)=>{const A=(s.get(y)??0)+1;s.set(y,A);const D=await e.refresh(y);if(s.get(y)!==A)return fu;if(D.status==="error")return{status:"failed",failure:D.failure};const q=t.get(y);if(!(q!==void 0&&q.loadedAt!==null&&T(y,"ok")&&q.loadedAt>D.loadedAt)){const J=d(y,D,!0);if(q!==void 0&&q.promise.status==="pending"){const W=x(y);q.promise.then(oe=>k(y,J,W,oe))}}if(S)for(const[J,W]of t)J!==y&&Be(W.promise)?.status==="ok"&&(W.stale=!0);return uu};return{read:y=>t.get(y)?.promise??hu,open:y=>{const S=n.resumes(y),A=n.hold(y),D=t.get(y);return D===void 0||T(y,"deferred")?(u(y,!0),E()):S||(D.opened&&T(y,"error")?(u(y,!0),E()):(D.opened=!0,D.stale&&T(y,"ok")&&O(y,D))),A},retry:y=>{T(y,"error")&&(u(y,!0),E())},seed:(y,S)=>{const A=S.then(Q=>Q===null?Qt:Q,()=>Qt),D=t.get(y);if(D!==void 0&&T(y,"ok")){const Q=x(y);A.then(J=>k(y,D,Q,J));return}C(y);const q=M(Ue(A),D?.opened===!0);t.set(y,q),r.delete(y),U(),A.then(Q=>{t.get(y)===q&&(Q.status==="deferred"&&n.isHeld(y)&&u(y,q.opened),E())})},refresh:y=>$(y,!0),reloadSource:y=>{if(n.isHeld(y))return $(y,!1);const S=t.get(y);return S!==void 0&&(S.stale=!0),Promise.resolve(mu)},children:(y,S)=>r.get(y)?.get(S),claimChildren:(y,S)=>{const A=b(y),D=_(y);let q=!1,Q=!1;for(const[W,oe]of S)A.claims.set(W,(A.claims.get(W)??0)+1),D.get(W)===void 0?(D.set(W,nr),A[oe].add(W),q=!0,Q=!0):oe==="direct"&&A.bulk.delete(W)&&(A.direct.add(W),Q=!0);q&&E(),Q&&U();let J=!1;return()=>{if(!J){J=!0;for(const W of S.keys()){const oe=(A.claims.get(W)??0)-1;oe>0?A.claims.set(W,oe):(A.claims.delete(W),A.unclaimed.add(W))}w.add(y),!h&&(h=!0,queueMicrotask(K))}}},retryChildren:(y,S)=>{const A=r.get(y);if(A===void 0||A.get(S)?.status!=="failed")return;const D=b(y);if((D.claims.get(S)??0)>0){A.set(S,nr),D.direct.add(S),E(),U();return}A.delete(S),E()},pendingChildren:y=>{const S=a.get(y);return S===void 0?0:S.direct.size+S.bulk.size+S.inFlight.size},clear:()=>{for(const y of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))C(y);for(const[y,S]of s)s.set(y,S+1);t.clear(),r.clear(),E()},subscribeChildrenFailures:y=>(m.add(y),()=>{m.delete(y)}),subscribe:i.subscribe,version:()=>v}},vu=(e,t)=>{let n=e;const r=je();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},Eu=Object.freeze({kind:"loading"}),yu=Object.freeze({reason:"invalid"}),xu=Object.freeze({reason:"failed"}),bu=(e,t)=>{const{config:n,data:r,sources:o}=F(),s=Se(),a=e.kind==="document-id"?e:null,[i,m]=l.useState(null),[p,g]=l.useState(null),f=l.useMemo(()=>a===null?null:i!==null&&i.opening===a?i:{opening:a,retries:0},[a,i]),w=f===null?null:f.opening.id===null?yu:f.retries===0&&t!==null&&t.id===f.opening.id?t.failure:p!==null&&p.attempt===f?p.failure:null,h=f!==null&&w===null,{hash:v}=re.useLocation(),E=l.useRef(v);l.useLayoutEffect(()=>{E.current=v},[v]),l.useEffect(()=>{if(!h||f===null||f.opening.id===null)return;const{opens:b,id:L}=f.opening,N=new AbortController;return r.resolveId(L,N.signal).then(C=>{if(!(C.status==="cancelled"||N.signal.aborted)){if(C.status==="error")return g({attempt:f,failure:C.failure});if(!o.some(M=>M.id===C.source))return g({attempt:f,failure:xu});s(`${z.explorerHref(n,z.documentIdOpeningTarget(b,C.path,C.source))}${E.current}`,"browse")}}),()=>N.abort()},[h,f,r,o,n,s]);const x=l.useCallback(()=>{f!==null&&m({opening:f.opening,retries:f.retries+1})},[f]);return l.useMemo(()=>f===null?null:w===null?Eu:{kind:"document-id",failure:w,onRetry:x},[f,w,x])},ku=1;let at=0,Ee=null;const Su=()=>{const{documentElement:e,body:t}=document;at===0&&(Ee={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"),at+=1;let n=!1;return()=>{n||(n=!0,at-=1,!(at>0||Ee===null)&&(e.style.overflow=Ee.htmlOverflow,t.style.overflow=Ee.bodyOverflow,e.style.scrollbarGutter=Ee.htmlGutter,t.style.scrollbarGutter=Ee.bodyGutter,Ee=null))}},Tu=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],rr=1,Ru=1e3,or=e=>e.getClientRects().length>0,$t="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.",Cu=e=>{if(!or(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+ku)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. ${$t}`;if(t.height<rr)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. ${$t}`;for(const{selector:r,name:o}of Tu)for(const s of e.querySelectorAll(r)){if(!or(s))continue;const a=s.getBoundingClientRect().height;if(a<rr)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. ${$t}`}return null},Mu=e=>{let t=!1,n;const r=()=>{n=void 0;const a=Cu(e);a!==null&&(t=!0,console.error(a))},o=()=>{t||(clearTimeout(n),n=setTimeout(r,Ru))},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)}},Lu=e=>(l.useEffect(()=>e?Su():void 0,[e]),l.useCallback(t=>e?Mu(t):void 0,[e])),sr='[data-testid="markdown-explorer-view-switch"]',Ou=[{control:sr,successors:[sr,'[data-testid="markdown-explorer-sheet-toggle"]','[data-testid="markdown-explorer-rail-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],Au=e=>{for(const t of Ou){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},Du=(e,t)=>{const n=l.useRef(null);l.useEffect(()=>{const o=i=>{const m=e.current;n.current=m!==null&&i instanceof Element&&m.contains(i)?Au(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=l.useRef(t);l.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 p=e.current;if(p===null)return!0;for(const g of o.control.successors)for(const f of p.querySelectorAll(g))if(f!==o.element&&(f.focus({preventScroll:!0}),document.activeElement===f))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])},Nu=l.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-D_DYV64_.cjs")).then(e=>({default:e.TreeLayout}))),ju=l.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-BZNj1GYo.cjs")).then(e=>({default:e.MultiLayout}))),Pu=64,_u={request:e=>{requestAnimationFrame(e)}},ar=e=>{e.documents.clear(),e.trees.clear()},qt=(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)},Iu=(e,t)=>{const[n,r]=l.useState(()=>({overrides:t,locale:e,labels:zt(e,t)}));if(n.locale===e&&Os(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:zt(e,t)};return r(o),o.labels},Fu=(e,t,n)=>{const[r,o]=l.useState(()=>({scope:t,store:tr(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:tr(e,n)};return o(s),s.store},qe=(e,t)=>{const[n,r]=l.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},$u=()=>au(_u),ir="on",qu="off",Bu=Object.freeze({kind:"unavailable"}),Hu=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")},lr=(e,t)=>{const n=we(e.peek(t));return n===null||n.document.kind==="failure"?P.lastPathSegment(t):n.document.name},Uu=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:i,accessFailure:m,lockDocumentScroll:p=!1,onMathDiagnostics:g,onEditGrant:f,draftConverter:w,fetch:h,persistSettings:v,subscribeHostChanges:E,hostChangePolicy:x="reload",ref:b,guardUnload:L=yn.guardUnload,onDraftChange:N,confirmUnversionedSaves:C=yn.confirmUnversionedSaves,paletteKey:M})=>{ae.assertStorageNamespace(n),Hu(w),ys({fetch:h,persistSettings:v,subscribeHostChanges:E,onDraftChange:N,accessFailure:m,guardUnload:L,confirmUnversionedSaves:C,hostChangePolicy:x,paletteKey:M});const _=wr(r),I=As(s),H=Iu(_,o),{revalidate:j}=re.useRevalidator(),U=l.useRef(()=>{}),Z=re.useHref(t.dataPath),K=l.useRef({fetch:h,persistSettings:v,onDraftChange:N,hostChangePolicy:x});l.useLayoutEffect(()=>{K.current={fetch:h,persistSettings:v,onDraftChange:N,hostChangePolicy:x}},[h,v,N,x]);const[u]=l.useState(()=>({fetch:(B,Y)=>{const te=K.current.fetch;return te===void 0?globalThis.fetch(B,Y):te(B,Y)}})),[d]=l.useState(()=>{const B=lu({dataPath:Z,onScope:te=>U.current(te),fetch:u.fetch}),Y={documents:oi({client:B,capacity:Math.max(Pu,t.multiView.maxPanels*2)}),trees:gu(B)};return qt(Y,e),ae.syncStorageScope(n,e.scope),{data:B,...Y,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(d.aligned.pageData!==e||d.aligned.storageNamespace!==n){const B=d.aligned.pageData;d.aligned.pageData=e,d.aligned.storageNamespace=n,B!==e&&(B.scope!==e.scope?d.aligned.pendingReader=e:qt(d,e)),ae.syncStorageScope(n,e.scope)}const k=Fu(ae.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);l.useLayoutEffect(()=>{const B=d.aligned.pendingReader;B!==null&&(d.aligned.pendingReader=null,ar(d),qt(d,B))},[e,d]),l.useLayoutEffect(()=>{let B=!1;return U.current=Y=>{Y===e.scope||B||(B=!0,Y!==null&&(ar(d),ae.clearExplorerStorage(n)),j())},()=>{U.current=()=>{}}},[e,j,d,n]);const T=l.useRef(t.settingsCookie);l.useLayoutEffect(()=>{T.current=t.settingsCookie},[t.settingsCookie]);const[O]=l.useState(()=>vu(e.settings,B=>{const Y=K.current.persistSettings;if(Y!==void 0){Y(z.serializeViewSettings(B));return}document.cookie=z.viewSettingsCookieString(T.current,B,window.location.protocol==="https:")})),$=qe(e.scope,$u),y=qe(e.scope,cu),S=qe(e.scope,zs),A=qe(e.scope,Ds),D=l.useRef(H);l.useLayoutEffect(()=>{D.current=H},[H]);const q=qe(e.scope,()=>sa({data:d.data,conflictLabels:()=>({ours:D.current.conflictOurs,theirs:D.current.conflictTheirs}),onSaveSettled:(B,Y)=>{Y.kind==="saved"&&d.documents.refresh(B);const te=ea(D.current,Y,lr(d.documents,B));te!==null&&$.announce(te)},sideBySideSetting:{read:()=>ae.readStorage(ae.storageKeys(n).editPreview)===ir,write:B=>ae.writeStorage(ae.storageKeys(n).editPreview,B?ir:qu)},editorShareSetting:{read:()=>oa(ae.readStorage(ae.storageKeys(n).editSplit)),write:B=>ae.writeStorage(ae.storageKeys(n).editSplit,String(B))}})),Q=l.useMemo(()=>Ue(e.notices.catch(()=>[])),[e.notices]),J=e.sources.map(B=>B.id).join(`
|
|
16
|
+
`))))},end:h=>{if(h==="table"){s=Math.max(0,s-1),s===0&&a&&(a=!1,i=!0);return}if(w!==null&&w.annotationDepth>0){h==="annotation"&&(w.annotationDepth-=1);return}if(!(!a||s!==1))if((h==="table-cell"||h==="covered-table-cell")&&w!==null){const v=w.covered?"":w.parts.join("");if(v!==""){const E=Math.min(f+w.repeat,n.maxColumns+1);for(let y=f;y<E;y+=1)g.set(y,v)}f+=w.repeat,w=null}else h==="table-row"?(r.addRow(m,g,p),m+=p):(h==="p"||h==="h")&&w!==null&&(w.paragraphDepth=Math.max(0,w.paragraphDepth-1))},text:h=>{w!==null&&w.annotationDepth===0&&w.paragraphDepth>0&&w.parts.push(h)}},()=>i||r.full()),r.table()},gc=async(e,t)=>{if(await hc(e,t))throw new ne("encrypted","the spreadsheet's manifest names encryption data");const{tables:n,hidingStyles:r}=await pc(zn(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=>wc(zn(e,t),i,m)})}),o.length===0&&Po("shows no table"),{sheets:o.slice(0,t.maxSheets),unshownSheets:s,unlistedSheets:Math.max(0,o.length-t.maxSheets)}},Me=Object.freeze({kind:"general"}),vc=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,"@"]]),Ec=/^\[(h+|m+|s+)\]$/iu,xc=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);Ec.test(a)&&(t+=a.slice(1,-1),n=!0),r=s===-1?e.length:s}else t+=o}return{text:t.toLowerCase(),elapsed:n}},yc=e=>{const{text:t,elapsed:n}=xc(e);if(t===""||t==="general"||t.includes("@")||/[0#?.]e[+-]/u.test(t))return Me;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 Me;const s=/[0#?][0#?,]*(?:\.[0#?]*)?,*/u.exec(t)?.[0];if(s===void 0)return Me;const a=/,*$/u.exec(s)?.[0].length??0,[i="",m=""]=s.slice(0,s.length-a).split("."),p=(m.match(/[0#?]/gu)??[]).length;return t.includes("%")?{kind:"percent",decimals:p}:{kind:"fixed",decimals:p,grouping:i.includes(","),scale:1e3**a}},bc=(e,t)=>{const n=t.get(e)??vc.get(e);return n===void 0?Me:yc(n)},hn=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("+","")}`}`},Gn=(e,t,n)=>{const r=Math.abs(e).toFixed(t);if(r.includes("e"))return hn(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}`}`},kc=864e5,Zn=86400,Sc=2958465,Ae=(e,t)=>String(e).padStart(t,"0"),Tc=(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*kc);return`${Ae(r.getUTCFullYear(),4)}-${Ae(r.getUTCMonth()+1,2)}-${Ae(r.getUTCDate(),2)}`},Rc=(e,t,n)=>{if(e<0||e>=Sc+1)return hn(e);let r=Math.floor(e),o=Math.round((e-r)*Zn);o===Zn&&(r+=1,o=0);const s=Math.floor(o/3600),a=Math.floor(o%3600/60),i=`${Ae(t.elapsed?r*24+s:s,2)}:${Ae(a,2)}${t.seconds?`:${Ae(o%60,2)}`:""}`;if(t.elapsed||!t.date)return i;const m=Tc(r,n);return t.time?`${m} ${i}`:m},Cc=(e,t,n)=>{switch(t.kind){case"general":return hn(e);case"date-time":return Rc(e,t,n);case"percent":return`${Gn(e*100,t.decimals,!1)}%`;case"fixed":return Gn(e/t.scale,t.decimals,t.grouping)}},_o="_rels/.rels",pe=e=>{throw new ne("not-workbook",`the workbook ${e}`)},pn=(e,t)=>{const n=Do(t,()=>!1);n.write(e),n.finish()},Mc=(e,t)=>{try{return decodeURIComponent(e)}catch{return pe(`points to a malformed part name (${t})`)}},Lc=(e,t)=>{const r=[...t.startsWith("/")?[]:e.split("/").slice(0,-1)];for(const o of t.split("/"))o===""||o==="."||(o===".."?(r.length===0&&pe(`points above its root (${t})`),r.pop()):r.push(Mc(o,t)));return r.join("/")},Oc=e=>{const t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},Wn=async(e,t,n)=>{const r=await vt(e,t===""?_o:Oc(t),n.maxPartBytes),o=new Map;return r===null||pn(r,{start:(s,a)=>{if(s!=="Relationship")return;const i=a.get("Id"),m=a.get("Type"),p=a.get("Target");i===void 0||m===void 0||p===void 0||a.get("TargetMode")==="External"||o.set(i,{type:m,target:Lc(t,p)})}}),o},Pt=(e,t)=>{for(const n of e.values())if(n.type.endsWith(`/${t}`))return n.target;return null},Ac=e=>{const t=[];let n=!1;return pn(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}},Dc=async e=>{const t=[];let n=null,r=!1,o=0;return await Ye(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},Nc=e=>{const t=new Map,n=[];let r=!1;return pn(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=>bc(o,t))},jc=/^(\d{4}-\d{2}-\d{2})(?:T(\d{2}:\d{2}(?::\d{2})?)(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?$/u,Pc=e=>{const t=jc.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}`},_c=/^([A-Za-z]{1,3})(\d+)$/u,Ic=e=>{const t=_c.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},Fc=(e,t,n,r)=>{const o=e.value.join("");switch(e.type){case"s":return o===""?"":t[Number(o)]??pe(`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 Pc(o.trim());default:{const s=o.trim();if(s==="")return"";const a=Number(s);return Number.isFinite(a)?Cc(a,n[e.style]??Me,r):s}}},$c=async(e,t,n,r,o)=>{const s=To(t);let a=-1,i=new Map,m=0,p=null;return await Ye(e,{start:(g,f,w)=>{if(g==="row"){const h=Number(f.get("r"));a=Number.isInteger(h)&&h>a+1?h-1:a+1,i=new Map,m=0}else if(g==="c"){const h=Ic(f.get("r")??"")??m,v=Number(f.get("s")??"0");p={column:h,type:f.get("t")??"n",style:Number.isInteger(v)?v:0,value:[],inline:[],inValue:!1,inInlineText:!1,phoneticDepth:0}}else p!==null&&(g==="v"?p.inValue=!w:g==="rPh"&&!w?p.phoneticDepth+=1:g==="t"&&p.type==="inlineStr"&&p.phoneticDepth===0&&(p.inInlineText=!w))},end:g=>{if(g==="c"&&p!==null){const f=Fc(p,n,r,o);f!==""&&i.set(p.column,f),m=p.column+1,p=null}else g==="row"?s.addRow(a,i,1):p!==null&&(g==="v"?p.inValue=!1:g==="rPh"?p.phoneticDepth=Math.max(0,p.phoneticDepth-1):g==="t"&&(p.inInlineText=!1))},text:g=>{p!==null&&(p.inValue?p.value.push(g):p.inInlineText&&p.inline.push(g))}},s.full),s.table()},qc=async(e,t)=>{const n=Pt(await Wn(e,"",t),"officeDocument")??pe("has no officeDocument relationship"),r=await vt(e,n,t.maxPartBytes)??pe(`has no part ${n}`),{sheets:o,date1904:s}=Ac(r),a=await Wn(e,n,t),i=Pt(a,"sharedStrings"),m=i===null?null:ze(e,i,t.maxPartBytes),p=m===null?[]:await Dc(m),g=Pt(a,"styles"),f=g===null?null:await vt(e,g,t.maxPartBytes),w=f===null?[]:Nc(f),h=[];let v=0;for(const E of o){const y=a.get(E.relationship)??pe(`lists the sheet ${E.name} without its relationship`);if(E.state!=="visible"||!y.type.endsWith("/worksheet")){v+=1;continue}e.entries.has(y.target)||pe(`has no part ${y.target} for the sheet ${E.name}`),h.push({name:E.name,read:async b=>{const L=ze(e,y.target,t.maxPartBytes)??pe(`has no part ${y.target}`);return $c(L,b,p,w,s)}})}return h.length===0&&pe("shows no sheet"),{sheets:h.slice(0,t.maxSheets),unshownSheets:v,unlistedSheets:Math.max(0,h.length-t.maxSheets)}},Bc=Object.freeze([80,75,3,4]),Hc=Object.freeze([208,207,17,224,161,177,26,225]),_t=Uint8Array.from([..."EncryptedPackage"].flatMap(e=>[e.charCodeAt(0),0])),Uc=new Set(["application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.spreadsheet-template"]),Vc="mimetype",Io=(e,t)=>e.byteLength>=t.length&&t.every((n,r)=>e[r]===n),Fo=e=>Io(e,Bc),$o=e=>Io(e,Hc),zc=e=>{const t=e.byteLength-_t.byteLength;for(let n=0;n<=t;n+=1)if(e[n]===_t[0]&&_t.every((r,o)=>e[n+o]===r))return!0;return!1},Gc=async(e,t)=>{if($o(e))throw zc(e)?new ne("encrypted","the bytes are a password-protected workbook"):new ne("not-workbook","the bytes are a compound file (a legacy .xls)");if(!Fo(e))throw new ne("not-workbook","the bytes are no ZIP package");const n=cc(e),r=await vt(n,Vc,t.maxPartBytes);if(r!==null&&Uc.has(r.trim()))return gc(n,t);if(n.entries.has(_o))return qc(n,t);throw new ne("not-workbook","the ZIP package is neither an OpenDocument spreadsheet nor an Office Open XML package")},Zc=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},qo=async(e,t)=>{try{return{kind:"table",table:await e.read(t)}}catch(n){return{kind:"refused",refusal:n instanceof ne?n.refusal:"not-workbook"}}},Wc=async(e,t,n,r,o)=>{const s=await e.asset(P.explorerWorkbookHref(t),o);if(s.status==="cancelled")return null;if(s.status==="error")return{kind:"failure",failure:s.failure};let a;try{a=await Zc(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(!(Fo(a)||$o(a)))return{kind:"not-package"};try{const i=await Gc(a,n.limits),m=r===null?-1:i.sheets.findIndex(w=>w.name===r),p=Math.max(m,0),g=i.sheets[p];if(g===void 0)return{kind:"refused",refusal:"not-workbook"};const f=await qo(g,n.budget);return o.aborted?null:{kind:"workbook",workbook:i,selected:p,sheet:f}}catch(i){return i instanceof ne?{kind:"refused",refusal:i.refusal}:o.aborted?null:{kind:"failure",failure:{reason:"failed"}}}},Kc=Object.freeze({className:"aqmx-document-spreadsheet-body","data-aqmx-document-scroller":""}),Xc=(e,t)=>{switch(t.code){case"encoding":return e.spreadsheetUnreadableEncoding(t.encodings);case"binary":return e.spreadsheetNotText;case"long-row":return e.spreadsheetLongRow}},Kn=(e,t)=>{switch(t){case"encrypted":return e.spreadsheetWorkbookEncrypted;case"not-workbook":return e.spreadsheetNotWorkbook;case"too-large":return e.spreadsheetWorkbookTooLarge}},It=e=>e.every(t=>t.every(n=>n==="")),Bo=({name:e,url:t,openUrl:n,state:r,children:o})=>c.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-spreadsheet-view","data-aqmx-spreadsheet":r,children:[c.jsx(Ke,{name:e,openUrl:n,downloadUrl:t,icon:c.jsx(jl,{})}),c.jsx(We,{scrollerProps:Kc,children:c.jsx("div",{className:"aqmx-document-spreadsheet-column",children:o})})]}),Ho=({rows:e,title:t})=>{const{labels:n,locale:r,theme:o}=F(),s=l.use(be),a=l.useMemo(()=>({...Mo(n,r),table:t,fullscreenDialog:n.spreadsheetFullscreen(t)}),[n,r,t]),i=l.useMemo(()=>Ht.serializeTsv(e),[e]),m=dn();return c.jsx("div",{className:"aqmx-document-spreadsheet","data-theme":o,children:c.jsx(Ne.SpreadsheetBlock,{tsv:i,layout:s==="fill"?"fill":"inline",locale:r,labels:a,tapScrollCircle:eo(m),scrollBarControls:sn(m)})})},He=({note:e,testId:t,code:n,download:r})=>{const{labels:o}=F();return c.jsx("div",{className:"aqmx-document-spreadsheet-stage",children:r===void 0?c.jsx("p",{className:"aqmx-callout",role:"note","data-testid":t,children:e}):c.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":t,"data-aqmx-unreadable":n,children:[c.jsx("p",{className:"aqmx-callout-body",children:e}),c.jsx("a",{className:"aqmx-callout-action",href:r.url,download:r.name,"data-testid":"markdown-explorer-spreadsheet-unreadable-download",children:o.download})]})})},Uo=({reading:e,name:t,url:n})=>{const{labels:r}=F();switch(e.kind){case"table":return c.jsxs(c.Fragment,{children:[e.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:r.spreadsheetTruncated}):null,c.jsx(Ho,{rows:e.rows,title:t})]});case"empty":return c.jsx(He,{note:r.spreadsheetEmpty,testId:"markdown-explorer-spreadsheet-empty"});case"unreadable":return c.jsx(He,{note:Xc(r,e),testId:"markdown-explorer-spreadsheet-unreadable",code:e.code,download:{url:n,name:t}})}},Yc=({path:e,document:t})=>t.format==="workbook"?c.jsx(Jc,{path:e,document:t}):c.jsx(Qc,{path:e,document:t,format:t.format}),Qc=({path:e,document:t,format:n})=>{const{config:r,data:o,labels:s}=F(),{name:a,url:i}=t,m=l.useCallback(async w=>{const h=await Co(o,i,{format:n,legacyEncoding:r.legacyTextEncoding,maxBytes:r.spreadsheets.maxBytes,budget:dt},w);return h===null||h.kind==="failure"?h:{kind:"read",value:h}},[o,i,n,r.legacyTextEncoding,r.spreadsheets.maxBytes]),{shown:p,failure:g,retry:f}=mn(e,a,m);return c.jsxs(Bo,{name:a,url:i,openUrl:P.explorerPlainTextHref(i),state:p===null?g===null?"loading":"failure":p.kind,children:[p===null&&g===null?c.jsx(ke,{label:s.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,p===null&&g!==null?c.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:c.jsx(ye,{failure:g,alert:!1,onRetry:f,testId:"markdown-explorer-spreadsheet-failure"})}):null,p===null?null:c.jsx(Uo,{reading:p,name:a,url:i})]})},Jc=({path:e,document:t})=>{const{config:n,data:r,labels:o}=F(),{name:s,url:a,firstSheetText:i}=t,m=l.useId(),p=l.useRef(null),g=l.useCallback(async Z=>{const K=await Wc(r,a,{maxBytes:n.spreadsheets.maxWorkbookBytes,limits:ql,budget:dt},p.current,Z);if(K===null||K.kind==="failure")return K;if(K.kind==="workbook")return{kind:"read",value:K};if(i!==null){const u=await Co(r,a,{format:i,legacyEncoding:n.legacyTextEncoding,maxBytes:n.spreadsheets.maxBytes,budget:dt},Z);return u===null||u.kind==="failure"?u:{kind:"read",value:{kind:"first-sheet",reading:u}}}return{kind:"read",value:{kind:"refused",refusal:K.kind==="not-package"?"not-workbook":K.refusal}}},[r,a,i,n.legacyTextEncoding,n.spreadsheets.maxBytes,n.spreadsheets.maxWorkbookBytes]),{shown:f,failure:w,retry:h}=mn(e,s,g),[v,E]=l.useState(null),y=l.useRef(new WeakMap),b=f?.kind==="workbook"?f:null,L=b===null?null:v!==null&&v.workbook===b.workbook?v:{workbook:b.workbook,index:b.selected,reading:b.sheet},N=Z=>{if(b===null)return;const K=b.workbook.sheets[Z];if(K===void 0)return;p.current=K.name;let u=y.current.get(b.workbook);u===void 0&&(u=new Map([[b.selected,b.sheet]]),y.current.set(b.workbook,u));const d=u.get(Z),k={workbook:b.workbook,index:Z,reading:d??null};if(E(k),d!==void 0)return;const T=u;qo(K,dt).then(O=>{T.set(Z,O),E($=>$===k?{...k,reading:O}:$)})},C=L===null?null:L.reading===null?"loading":L.reading.kind==="refused"?"unreadable":It(L.reading.table.rows)?"empty":"table",M=f===null?w===null?"loading":"failure":f.kind==="first-sheet"?f.reading.kind:f.kind==="refused"?"unreadable":C??"loading",_=i===null?a:P.explorerPlainTextHref(a),I=Z=>`${m}-sheet-${Z}`,H=`${m}-panel`,j=L===null?null:b?.workbook.sheets[L.index]?.name??null,U=b!==null&&b.workbook.sheets.length>1;return c.jsxs(Bo,{name:s,url:a,openUrl:_,state:M,children:[f===null&&w===null?c.jsx(ke,{label:o.spreadsheetLoading,testId:"markdown-explorer-spreadsheet-skeleton"}):null,f===null&&w!==null?c.jsx("div",{className:"aqmx-document-spreadsheet-failure",children:c.jsx(ye,{failure:w,alert:!1,onRetry:h,testId:"markdown-explorer-spreadsheet-failure"})}):null,f?.kind==="refused"?c.jsx(He,{note:Kn(o,f.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:f.refusal,download:{url:a,name:s}}):null,f?.kind==="first-sheet"?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-first-sheet",children:o.spreadsheetWorkbookFirstSheet}),c.jsx(Uo,{reading:f.reading,name:s,url:a})]}):null,b===null||L===null||j===null?null:c.jsxs(c.Fragment,{children:[b.workbook.unshownSheets>0?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unshown-sheets",children:o.spreadsheetUnshownSheets(b.workbook.unshownSheets)}):null,b.workbook.unlistedSheets>0?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-unlisted-sheets",children:o.spreadsheetUnlistedSheets(b.workbook.sheets.length)}):null,U?c.jsx(Hl,{names:b.workbook.sheets.map(Z=>Z.name),selected:L.index,onSelect:N,label:o.spreadsheetSheets(s),tabIdOf:I,panelId:H}):null,c.jsxs("div",{className:"aqmx-document-spreadsheet-sheet","data-testid":"markdown-explorer-spreadsheet-sheet","data-aqmx-sheet":L.index,...U?{role:"tabpanel",id:H,"aria-labelledby":I(L.index)}:{},children:[L.reading===null?c.jsx(ke,{label:o.spreadsheetSheetLoading,testId:"markdown-explorer-spreadsheet-sheet-skeleton"}):null,L.reading?.kind==="table"&&L.reading.table.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-spreadsheet-truncated",children:o.spreadsheetTruncated}):null,L.reading?.kind==="refused"?c.jsx(He,{note:Kn(o,L.reading.refusal),testId:"markdown-explorer-spreadsheet-unreadable",code:L.reading.refusal,download:{url:a,name:s}}):null,L.reading?.kind==="table"&&It(L.reading.table.rows)?c.jsx(He,{note:o.spreadsheetSheetEmpty,testId:"markdown-explorer-spreadsheet-empty"}):null,L.reading?.kind==="table"&&!It(L.reading.table.rows)?c.jsx(Ho,{rows:L.reading.table.rows,title:o.spreadsheetSheetName(s,j)},L.index):null]})]})]})},Vo=Object.freeze({kind:"empty"}),ed=(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})},Le=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:a,children:i})=>{const m=l.use(be);return c.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?c.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,i]})},td=Object.freeze({invalid:"documentIdInvalid","not-found":"documentIdNotFound"}),Xn=(e,t)=>{const n=td[t];return n===void 0?void 0:{title:e.documentIdFailedTitle,body:e[n]}},nd=({absence:e,announces:t,announceFailure:n})=>{const{labels:r,announcer:o}=F(),s=e.kind==="no-readme"?e.folder:null,a=e.kind==="failure"?e.folder:null,i=e.kind==="failure"?e.failure:null,m=e.kind==="document-id"?e.failure:null;switch(l.useEffect(()=>{t&&s!==null&&o.announce(r.folderReadmeMissing(P.lastPathSegment(s)))},[t,s,o,r]),l.useEffect(()=>{if(a===null||i===null)return;const{reason:p}=i;ie(p)||n(r.documentFailed(P.lastPathSegment(a),ce(r,p)))},[a,i,n,r]),l.useEffect(()=>{if(m===null)return;const{reason:p}=m;if(ie(p))return;const g=Xn(r,p);n(r.announcementSequence([r.documentIdFailedTitle,g===void 0?ce(r,p):g.body]))},[m,n,r]),e.kind){case"empty":return c.jsx(Le,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:c.jsx("p",{className:"aqmx-empty-title",children:r.documentEmpty})})});case"loading":return c.jsx(wn,{label:r.documentRegion});case"no-readme":return c.jsx(Le,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-folder-empty",children:c.jsx("p",{className:"aqmx-empty-title",children:r.folderReadmeMissing(P.lastPathSegment(e.folder))})})});case"failure":return c.jsx(Le,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx(ht,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-folder-failure"})});case"document-id":return c.jsx(Le,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:c.jsx(ht,{failure:e.failure,onRetry:e.onRetry,testId:"markdown-explorer-document-id-failure",text:Xn(r,e.failure.reason),deniedSentence:r.documentIdForbidden})})}},wn=({label:e})=>{const{labels:t}=F();return c.jsx(Le,{kind:"loading",label:e,stale:!1,busy:!0,children:c.jsx(ke,{label:t.documentLoading,testId:"markdown-explorer-document-skeleton"})})},Yn=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),rd=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=F(),a=l.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),i=wl(),m=gl(),p=l.useMemo(()=>o===void 0?void 0:M=>o(e,M),[o,e]),g=l.useRef(null),{editable:f,doubleClick:w,region:h,paneScroll:v,stale:E}=r;l.useLayoutEffect(()=>{if(f)return s.bindView(e,{anchor:()=>{const M=g.current,_=h(),I=M===null?null:M.querySelector(xt);return M===null||_===null||I===null?null:qr(M,v.scrollerOf(_,I))}})},[s,e,f,h,v]);const y=M=>{const _=g.current,{target:I}=M;!w||_===null||!(I instanceof Element)||!Fr(I)||(M.stopPropagation(),s.start(e,$r(I,_,_.ownerDocument.getSelection())))},b=l.useRef(null),L=l.useRef(E);l.useLayoutEffect(()=>{L.current=E});const N=l.useEffectEvent(M=>{const _=g.current,I=h(),H=_===null?null:Ur(_,M.line);if(I===null||H===null)return!1;const j=v.scrollerOf(I,H);return j.scrollTop+=Vr(H,M.line)-M.clientTop,!0}),C=l.useEffectEvent(M=>{const _=h();if(_===null)return;const I=()=>{for(const j of Yn)_.removeEventListener(j,H,!0);b.current?.release===I&&(b.current=null)},H=()=>I();for(const j of Yn)_.addEventListener(j,H,{capture:!0,passive:!0});b.current={point:M,release:I}});return l.useLayoutEffect(()=>{const M=s.takeReturn(e);if(M!==null)return queueMicrotask(()=>{N(M)&&L.current&&C(M)}),()=>b.current?.release()},[s,e]),l.useLayoutEffect(()=>{const M=b.current;M===null||E||(M.release(),N(M.point))},[t,E]),c.jsx("div",{ref:g,className:"aqmx-document-viewer",onDoubleClick:y,children:c.jsx(Ne.MarkdownViewer,{...n,onHeadingSelect:i,headingHref:m,onMathDiagnostics:p,parseResult:a,content:null})})},zo=({document:e,viewer:t})=>{const{labels:n}=F();return c.jsxs(c.Fragment,{children:[c.jsx(Ke,{name:e.name,openUrl:P.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:c.jsx(Sa,{}),children:e.truncated?null:c.jsx(gi,{text:e.text})}),e.truncated?c.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-text-truncated",children:n.textTruncated}):null,c.jsx("div",{className:"aqmx-document-viewer",children:c.jsx(Ne.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},Ft=({path:e,name:t,viewer:n})=>{const{data:r,labels:o}=F(),s=l.useCallback(async p=>{const g=await r.text(e,p);return"kind"in g?g.kind==="failure"?{kind:"failure",failure:g.failure}:{kind:"read",value:g}:null},[r,e]),{shown:a,failure:i,retry:m}=mn(e,t,s);return a!==null?c.jsx(zo,{document:a,viewer:n}):i!==null?c.jsx(ht,{failure:i,onRetry:m,testId:"markdown-explorer-markup-failure"}):c.jsx(ke,{label:o.markupLoading,testId:"markdown-explorer-markup-skeleton"})},od=Object.freeze({reason:"failed"}),sd=e=>{const{labels:t}=F();return c.jsx(Ca,{fallback:n=>c.jsx("div",{className:"aqmx-edit-message",children:c.jsx(ye,{failure:od,alert:!1,onRetry:n,testId:"markdown-explorer-edit-load-failure"})}),children:c.jsx(l.Suspense,{fallback:c.jsx(ke,{label:t.editLoading,testId:"markdown-explorer-edit-skeleton"}),children:c.jsx(Ra,{...e})})})},ad=({path:e,document:t,view:n,viewer:r,contentViewer:o,onRetry:s,editing:a})=>{switch(t.kind){case"markdown":{const{session:i,layout:m,region:p,paneScroll:g,stale:f}=a;if(n==="edit"&&i!==void 0)return c.jsx(sd,{path:e,name:t.name,session:i,layout:m,viewer:o,region:p,paneScroll:g});if(n==="markup")return c.jsx(Ft,{path:e,name:t.name,viewer:o});const w=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return c.jsx(rd,{path:e,document:t,viewer:o,editing:{editable:w,doubleClick:w&&m==="fill",region:p,paneScroll:g,stale:f}})}case"text":return c.jsx(zo,{document:t,viewer:o});case"image":return n==="markup"&&fn(t)==="svg"?c.jsx(Ft,{path:e,name:t.name,viewer:r}):c.jsx(ol,{document:t});case"media":return c.jsx(Al,{document:t});case"spreadsheet":return n==="markup"?c.jsx(Ft,{path:e,name:t.name,viewer:r}):c.jsx(Yc,{path:e,document:t});case"file":return c.jsx(Oi,{document:t});case"failure":return c.jsx(ht,{failure:t.failure,onRetry:s,testId:"markdown-explorer-document-failure"});default:{const i=t;throw new RangeError(`[markdown-explorer] unknown document kind ${V.describeValue(i.kind)}`)}}},id=e=>{const{document:t,viewer:n}=e,r=t.kind==="markdown"||t.kind==="text"?t.lang:void 0,o=l.useMemo(()=>r===void 0?n:{...n,contentLang:r},[n,r]);return c.jsx(go,{value:r,children:c.jsx(ad,{...e,contentViewer:o})})},ld='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',Qn=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:fo(e,n),r===void 0?null:uo(e,r.id),e.querySelector(xt),e.querySelector(ld)];for(const s of o)if(s instanceof HTMLElement&&on(s))return s;return null},Jn=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&on(t)},cd=e=>{const t=l.useRef(!1);return l.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=w=>{s=!(w.target instanceof Node&&n.contains(w.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(a),a=setTimeout(()=>{s=!1},0)},m=w=>{t.current=w.target instanceof Node&&n.contains(w.target)},p=w=>{w.relatedTarget===null&&s&&(t.current=!1)},g=()=>{const{activeElement:w,body:h}=r;w!==null&&w!==h&&(t.current=n.contains(w))},f=()=>{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",g),o.addEventListener("focus",f),n.addEventListener("focusout",p),()=>{clearTimeout(a),o.removeEventListener("pointerdown",i,!0),o.removeEventListener("mousedown",i,!0),o.removeEventListener("focusin",m,!0),o.removeEventListener("blur",g),o.removeEventListener("focus",f),n.removeEventListener("focusout",p)}},[e]),t},dd=Object.freeze({count:0,recovered:!1}),ud=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:a,navigation:i,fragment:m,paneScroll:p,announces:g,announceFailure:f,onDocumentShown:w})=>{const{labels:h,announcer:v,documents:E}=F(),{document:y}=t,b=l.useRef(null),L=l.useRef(null),N=l.useRef(null),C=l.useRef(null),[M,_]=l.useState(null),I=l.useRef(null),H=cd(b),j=l.useRef({path:e,document:y}),U=l.useRef(null),Z=l.useCallback(G=>{const X=b.current,ee=Dn(X,G,p);X!==null&&ee!==null&&Jn(X,ee,H.current)},[p,H]),K=l.useCallback((G,X)=>{const ee=C.current;setTimeout(()=>{X.defaultPrevented||l.startTransition(()=>_({fragment:G,from:ee}))},0)},[]),u=l.useCallback(G=>{setTimeout(()=>{G.defaultPrevented||Z("#")},0)},[Z]),d=l.useMemo(()=>({navigation:i,currentPath:e,scrollWithin:Z,followFragmentJump:K,followEmptyFragment:u}),[i,e,Z,K,u]),k=l.useCallback(()=>E.retry(e),[E,e]),T=Gr(E,cl),O=Nr(e),$=O!==void 0?"edit":n?"markup":"rendered",x=fn(y)===null?void 0:$,S=l.useCallback(()=>b.current,[]),A=l.useCallback(()=>{const G=b.current;G!==null&&Qn(G,y,null)},[y]),D=l.useMemo(()=>({session:O,layout:s,region:S,paneScroll:p,stale:r}),[O,s,S,p,r]),q=x==="edit"?!1:r,Y=l.use(be),J=x==="edit"&&s==="fill"?"fill":Y,[W,oe]=l.useState(0),ge=l.useRef(0),de=l.useRef(!1),[ve,St]=l.useState(dd),[Pe,Qe]=l.useState(0),fe=l.useRef(f),_e=l.useRef(r);l.useLayoutEffect(()=>{fe.current=f,_e.current=r},[f,r]);const Je=l.useMemo(()=>({announceFailure:G=>{_e.current||fe.current(G)},readPart:()=>{const G=E.readPart(e);ge.current+=1;let X=!1,ee=!1,se=!1;return{settle:(me,Re)=>{if(G.settle(me,Re),!(se||X)){if(Re!==null){ee=!0,de.current=!1;return}X=!0,St(tt=>({count:tt.count+1,recovered:ee}))}},release:()=>{se||(se=!0,G.release(),ge.current-=1,X||Qe(me=>me+1))}}},holdBusy:()=>{oe(X=>X+1);let G=!0;return()=>{G&&(G=!1,oe(X=>X-1))}}}),[E,e]),et=q||W>0,B=l.useEffectEvent((G,X)=>{const ee=L.current;if(ee!==null&&ee.path===G&&ee.snapshot===X)return;L.current={path:G,snapshot:X},E.noteShown(G,X);const se=X.document;if(se.kind==="failure"){de.current=!1;const{reason:me}=se.failure;E.noteFailureShown(X)&&!ie(me)&&f(h.documentFailed(P.lastPathSegment(G),ce(h,me)));return}w?.(G,se),!(!g||ee!==null&&ee.path===G&&ee.snapshot.document.kind!=="failure")&&(de.current=ge.current>0,de.current||v.announce(h.documentShown(se.name)))});l.useEffect(()=>{B(e,t)},[e,t]);const Q=l.useEffectEvent(()=>{m.kind==="panel"&&m.consume()}),te=l.useEffectEvent(G=>{const X=b.current;if(X===null||!H.current)return null;const{activeElement:ee,body:se}=X.ownerDocument;return ee!==null&&ee!==se?null:Qn(X,y,G)}),Te=l.useEffectEvent(G=>{const X=de.current;de.current=!1,!r&&(G&&te(null),g&&(G||X)&&y.kind!=="failure"&&v.announce(h.documentShown(y.name)))});l.useEffect(()=>{ve.count>0&&Te(ve.recovered)},[ve]);const ds=l.useEffectEvent(()=>{ge.current>0||!de.current||(de.current=!1,g&&!r&&y.kind!=="failure"&&v.announce(h.documentShown(y.name)))});l.useEffect(()=>{Pe>0&&ds()},[Pe]);const us=l.useEffectEvent(G=>{const X=b.current;X!==null&&Jn(X,G,H.current)}),fs=l.useEffectEvent(G=>p.reveal(G)),ms=l.useEffectEvent(G=>Dn(b.current,G,p));return l.useEffect(()=>{if(r)return;const G=j.current.path!==e,X=G||j.current.document!==y;j.current={path:e,document:y};const ee=U.current!==e;U.current=e;let se=null;m.kind==="page"?N.current!==m.navigation&&(N.current=m.navigation,se=m.fragment):m.fragment!==null&&(se=m.fragment,Q());const me=()=>{const Re=se===null?null:ms(se);if(!X){Re!==null&&us(Re);return}const tt=te(m.fragment);G&&Re===null&&tt!==null&&fs(tt)};ee?queueMicrotask(me):me()},[m,e,y,r]),l.useLayoutEffect(()=>{C.current=m.kind==="page"?m.navigation:null},[m]),l.useEffect(()=>{M===null||M===I.current||r||(I.current=M,!(m.kind==="page"&&m.navigation!==M.from)&&Z(M.fragment))},[M,m,r,Z]),c.jsxs(be,{value:J,children:[c.jsx(bi,{path:e,name:y.kind==="failure"?P.lastPathSegment(e):y.name,editing:O!==void 0,announces:g,markup:n,region:b,focusDocument:A}),c.jsx(Le,{kind:y.kind,view:x,label:a(e,y),stale:et,busy:et,frameRef:b,intent:T,children:c.jsx(wo,{value:d,children:c.jsx(il,{children:c.jsx(so,{value:Je,children:c.jsx(id,{path:e,document:y,view:$,viewer:o,onRetry:k,editing:D},e)})})})})]})},gn=Object.freeze({kind:"skeleton"}),fd=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=we(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:we(r);return n===null||a===null?gn:{kind:"document",path:n,snapshot:a,stale:!0}},md=(e,t)=>t.status==="deferred"?gn:{kind:"document",path:e,snapshot:t,stale:!1},hd=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?md(t.path,l.use(t.promise)):t;return o.kind!=="document"?c.jsx(wn,{label:r.regionLabel(e,null)}):c.jsx(ud,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},Go=({path:e,absence:t,markup:n,display:r,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:p})=>{const{config:g,labels:f,locale:w,theme:h,documents:v,data:E,fetch:y}=F(),b=Ne.useMarkdownToolbarState(),L=l.useRef(!1);l.useLayoutEffect(()=>{L.current=!0},[]);const[N,C]=l.useState(null),[M,_]=l.useState(n),I=l.useCallback(()=>e===null?void 0:v.peek(e),[v,e]),H=l.useSyncExternalStore(v.subscribe,I,I),j=l.useCallback(()=>N===null?void 0:v.peek(N),[v,N]),U=l.useSyncExternalStore(v.subscribe,j,j);l.useLayoutEffect(()=>e===null?void 0:v.open(e),[v,e]),l.useLayoutEffect(()=>N===null?void 0:v.retain(N),[v,N]);const Z=e===null?gn:fd(e,H,N,U,!L.current),K=e===null?null:Z.kind==="document"&&!Z.stale?Z.path:N;K!==N&&C(K);const u=Z.kind!=="document"||Z.path===e;u&&n!==M&&_(n);const d=l.useMemo(()=>Zl(f,w),[f,w]),k=l.useMemo(()=>({read:(D,q)=>sl(E,D,q)}),[E]),T=l.useMemo(()=>[...g.iframeHosts],[g]),O=o.kind==="panel",$=dn(),x=l.useMemo(()=>({labels:d,labelsLang:w,spreadsheetLocale:w,spreadsheetTapScrollCircle:eo($),spreadsheetScrollBarControls:sn($),emptyMessage:f.documentEmpty,theme:h,availableStyles:g.documentStyles,iFrameAllowedDomains:T,embeds:g.embeds,fetch:y,linkComponent:pl,toolbar:b,style:r.style,onStyleChange:r.onStyleChange,align:r.align,onAlignChange:r.onAlignChange,measure:r.measure,onMeasureChange:r.onMeasureChange,contentColors:r.documentColors,onContentColorsChange:r.onDocumentColorsChange,showToc:r.showToc,showStyle:r.showStyle,showAlign:r.showAlign,showMeasure:r.showMeasure,showContentColors:r.showContentColors,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:O?void 0:Wr,scrollBarInlineSize:O?void 0:an,scrollBarGutter:O?void 0:cn,imageSource:k}),[d,w,$,f.documentEmpty,h,g.documentStyles,T,g.embeds,y,b,r,O,k]),S=l.useCallback((D,q)=>O?q===null||q.kind==="failure"?P.lastPathSegment(D):q.name:f.documentRegion,[O,f.documentRegion]),A=O?"content":"fill";return e===null?c.jsx(be,{value:A,children:c.jsx(nd,{absence:t,announces:i,announceFailure:m})}):c.jsx(be,{value:A,children:c.jsx(l.Suspense,{fallback:c.jsx(wn,{label:S(e,null)}),children:c.jsx(hd,{requestedPath:e,content:Z,markup:u?n:M,viewer:x,editLayout:r.editLayout,regionLabel:S,navigation:o,fragment:s,paneScroll:a,announces:i,announceFailure:m,onDocumentShown:p})})})},Zo=()=>{const{viewSettings:e}=F(),t=xe(s=>s.measure),n=xe(s=>s.documentColors),r=l.useCallback(s=>e.update({measure:s}),[e]),o=l.useCallback(s=>e.update({documentColors:s}),[e]);return l.useMemo(()=>({measure:t,onMeasureChange:r,documentColors:n,onDocumentColorsChange:o}),[t,r,n,o])},pd=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a,announcer:i}=F(),m=xe(j=>j.style),p=xe(j=>j.align),g=Se(),f=re.useLocation(),w=Ge(),{overrides:h,embed:v}=r,E=l.useCallback(j=>{if(w.kind!=="location")return;const U=ed(s,w.location,j);U!==null&&g(U,"browse")},[s,g,w]),y=l.useCallback(j=>{a.update({style:j}),E("style")},[a,E]),b=l.useCallback(j=>{a.update({align:j}),E("align")},[a,E]),L=Lo(s,h.style,m),N=Oo(h.align,p),C=Zo(),M=l.useMemo(()=>({style:L,onStyleChange:y,align:N,onAlignChange:b,...C,showToc:v.showToc!==!1,showStyle:v.showStyle!==!1,showAlign:v.showAlign!==!1,showMeasure:v.showStyle!==!1,showContentColors:v.showStyle!==!1,padding:v.padding,width:v.width,maxWidth:v.maxWidth,editLayout:"fill"}),[L,y,N,b,C,v]),_=r,I=l.useMemo(()=>({kind:"page",fragment:f.hash,navigation:f}),[f]),H=l.useCallback(j=>i.announce(j),[i]);return c.jsx(Go,{path:e,absence:t,markup:n,display:M,navigation:_,fragment:I,paneScroll:Bi,announces:!0,announceFailure:H,onDocumentShown:o})},wd=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:a}=F(),i=xe(I=>I.style),m=xe(I=>I.align),[p,g]=l.useState(()=>Lo(s,void 0,i)),f=Oo(void 0,m),w=l.useCallback(I=>a.update({align:I}),[a]),h=Zo(),{maximized:v,onDocumentLink:E,pendingHash:y,onHashConsumed:b,announceFailure:L,paneScroll:N}=r,C=l.useMemo(()=>({style:p,onStyleChange:g,align:f,onAlignChange:w,...h,showToc:v,showStyle:v,showAlign:v,showMeasure:v,showContentColors:v,padding:void 0,width:void 0,maxWidth:void 0,editLayout:v?"fill":"content"}),[p,f,w,h,v]),M=l.useMemo(()=>({kind:"panel",onDocumentLink:E}),[E]),_=l.useMemo(()=>({kind:"panel",fragment:y,consume:b}),[y,b]);return c.jsx(Go,{path:e,absence:t,markup:n,display:C,navigation:M,fragment:_,paneScroll:N,announces:!1,announceFailure:L,onDocumentShown:o})},Wo=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>r.kind==="page"?c.jsx(pd,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o}):c.jsx(wd,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o});function gd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Ko=R.forwardRef(gd);function vd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M3.22 3.22a.75.75 0 0 1 1.06 0l3.97 3.97V4.5a.75.75 0 0 1 1.5 0V9a.75.75 0 0 1-.75.75H4.5a.75.75 0 0 1 0-1.5h2.69L3.22 4.28a.75.75 0 0 1 0-1.06Zm17.56 0a.75.75 0 0 1 0 1.06l-3.97 3.97h2.69a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75V4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0ZM3.75 15a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-2.69l-3.97 3.97a.75.75 0 0 1-1.06-1.06l3.97-3.97H4.5a.75.75 0 0 1-.75-.75Zm10.5 0a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-2.69l3.97 3.97a.75.75 0 1 1-1.06 1.06l-3.97-3.97v2.69a.75.75 0 0 1-1.5 0V15Z",clipRule:"evenodd"}))}const Ed=R.forwardRef(vd);function xd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M15 3.75a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0V5.56l-3.97 3.97a.75.75 0 1 1-1.06-1.06l3.97-3.97h-2.69a.75.75 0 0 1-.75-.75Zm-12 0A.75.75 0 0 1 3.75 3h4.5a.75.75 0 0 1 0 1.5H5.56l3.97 3.97a.75.75 0 0 1-1.06 1.06L4.5 5.56v2.69a.75.75 0 0 1-1.5 0v-4.5Zm11.47 11.78a.75.75 0 1 1 1.06-1.06l3.97 3.97v-2.69a.75.75 0 0 1 1.5 0v4.5a.75.75 0 0 1-.75.75h-4.5a.75.75 0 0 1 0-1.5h2.69l-3.97-3.97Zm-4.94-1.06a.75.75 0 0 1 0 1.06L5.56 19.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 1 1.5 0v2.69l3.97-3.97a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Xo=R.forwardRef(xd);function yd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Yo=R.forwardRef(yd);function bd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 kd=R.forwardRef(bd);function Sd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Td=R.forwardRef(Sd);function Rd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 Cd=R.forwardRef(Rd);function Md({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Ld=R.forwardRef(Md);function Od({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),R.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 Qo=R.forwardRef(Od);function Ad({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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"}),R.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 Dd=R.forwardRef(Ad);function Nd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.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 jd=R.forwardRef(Nd),Jo=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=F(),[s,a]=l.useState(!1),i=()=>{o===void 0||s||(a(!0),o(e).then(m=>{m&&t()}).finally(()=>a(!1)))};return c.jsxs("div",{className:"aqmx-callout aqmx-edit-grant","data-testid":n,children:[c.jsx("p",{className:"aqmx-callout-title",children:r.editGrantTitle}),c.jsx("p",{className:"aqmx-callout-body",children:r.editGrantBody}),c.jsxs("div",{className:"aqmx-edit-grant-actions",children:[o===void 0?c.jsx("a",{className:"aqmx-callout-action",href:e,target:"_blank",rel:"noopener","data-testid":`${n}-open`,children:r.editGrantAction}):c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":s,"data-testid":`${n}-open`,onClick:i,children:r.editGrantAction}),c.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},Pd="Control+E Meta+E",es=(e,t,n)=>n&&t?"split":e.view,Yt=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},_d=e=>e==="split"?null:e,ts=e=>e==="preview"?"editor":"preview",ns=e=>/Mac|iPhone|iPad|iPod/u.test(e),rs=(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)},er=(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)},Id=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:a,locale:i,announcer:m}=F(),p=l.useId(),[g,f]=l.useState(null),[w,h]=l.useState(0),[v,E]=l.useState(null),[y,b]=l.useState(null),[L,N]=l.useState(0),C=l.useMemo(()=>new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}),[i]),M=l.useCallback(()=>{E(null),b(null)},[]),_=Lr({open:n,onOpen:M,onDismiss:r});l.useEffect(()=>{if(!n)return;const j=new AbortController;return f(null),o.revisions(e,j.signal).then(U=>{"kind"in U&&f(U)}),()=>j.abort()},[n,o,e,w]),l.useEffect(()=>{if(!n||v===null)return;const j=new AbortController;return b(null),o.revision(e,v,j.signal).then(U=>{"kind"in U&&b(U)}),()=>j.abort()},[n,o,e,v,L]);const I=()=>{y===null||y.kind!=="revision"||(s.replaceDraft(e,y.text),m.announce(a.historyRestored(t)),r())},H=g!==null&&g.kind==="revisions"?g.revisions.find(j=>j.id===v):void 0;return c.jsx("dialog",{..._,className:"aqmx-confirm aqmx-history","aria-labelledby":p,"data-testid":"markdown-explorer-history",children:c.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[c.jsx("p",{id:p,className:"aqmx-confirm-title",children:a.historyTitle(t)}),g===null?c.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:a.historyLoading}):g.kind==="failure"?c.jsx(ye,{failure:g.failure,alert:!1,onRetry:()=>h(j=>j+1),testId:"markdown-explorer-history-failure"}):g.revisions.length===0?c.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:a.historyEmpty}):c.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:g.revisions.map(j=>c.jsx("li",{children:c.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":j.id===v,"data-testid":"markdown-explorer-history-entry",onClick:()=>E(j.id),children:[c.jsx("span",{children:er(j,C,a.historyEntry)}),j.current?c.jsx("span",{className:"aqmx-history-mark",children:a.historyCurrent}):null,j.kept?c.jsx("span",{className:"aqmx-history-mark",children:a.historyKept}):null]})},j.id))}),v===null?null:y===null?c.jsx("p",{className:"aqmx-history-note",children:a.historyLoading}):y.kind==="failure"?c.jsx(ye,{failure:y.failure,alert:!1,onRetry:()=>N(j=>j+1),testId:"markdown-explorer-history-revision-failure"}):c.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":H===void 0?a.historyTitle(t):er(H,C,a.historyEntry),"data-testid":"markdown-explorer-history-text",children:c.jsx("pre",{children:y.text})}),c.jsxs("div",{className:"aqmx-confirm-actions",children:[c.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":"markdown-explorer-history-close",onClick:r,children:a.historyClose}),c.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":y===null||y.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:I,children:a.historyRestore})]})]})})},Fd=(e,t)=>{if(!t||e===void 0||e.history||!e.dirty||e.phase.kind!=="editing")return!1;const{kind:n}=e.save;return n!=="draft"&&n!=="saving"&&n!=="conflicts"},os=e=>{const{edits:t,labels:n,confirmUnversionedSaves:r}=F(),[o,s]=l.useState(!1),a=l.useCallback(()=>{t.flush(e),Fd(t.session(e),r)?s(!0):t.save(e)},[t,e,r]),i=c.jsx(nn,{open:o,title:n.unversionedSaveTitle,body:n.unversionedSaveBody,confirmLabel:n.unversionedSaveConfirm,cancelLabel:n.unsavedStay,testId:"markdown-explorer-unversioned-save-confirm",onConfirm:()=>{s(!1),t.save(e)},onCancel:()=>s(!1)});return{requestSave:a,confirmation:i}},$d=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=l.useSyncExternalStore(t.subscribe,n,r),s=we(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:P.lastPathSegment(e)}:{edit:s.kind==="markdown"||s.kind==="spreadsheet"?s.edit:null,name:s.name}},ue=e=>{e.stopPropagation()},qd=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:a,labels:i}=F(),m=l.useSyncExternalStore(a.subscribe,()=>a.session(e)!==void 0,()=>!1),[p,g]=l.useState(null),f=()=>{if(!m){a.start(e,a.viewAnchor(e));return}a.flush(e);const E=a.session(e);E?.dirty===!0?g(E.save.kind==="draft"?"draft":"unsaved"):a.close(e)},w=()=>{m||(Ta(),r&&a.sideBySide()&&s?.prepare?.())},h=n?o?i.editDraftDocumentNamed(t):i.editDocumentNamed(t):null,v=o?i.editDraftDocument:i.editDocument;return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:m?i.closeEditor:h===null?v:h,"aria-label":h===null?void 0:h,"aria-pressed":m,"data-testid":"markdown-explorer-document-edit",onClick:f,onDoubleClick:ue,onPointerEnter:w,onFocus:w,children:[c.jsx(Dd,{"aria-hidden":"true"}),h===null?c.jsx("span",{children:i.editDocumentLabel}):null]}),c.jsx(nn,{open:p!==null,title:p==="draft"?i.draftDiscardTitle:i.unsavedTitle,body:p==="draft"?i.draftDiscardBody(t):i.unsavedBody(t),confirmLabel:i.unsavedDiscard,cancelLabel:i.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{g(null),a.close(e)},onCancel:()=>g(null)})]})},Bd=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=F(),o=n?r.editExternallyNamed(t):null;return c.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:ue,children:[c.jsx(kd,{"aria-hidden":"true"}),o===null?c.jsx("span",{children:r.editExternallyLabel}):null]})},Hd=({session:e})=>{const{labels:t}=F(),n=ea(t,e);return c.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})},Ud=Object.freeze(["editor","split","preview"]),Vd=Object.freeze(["editor","preview"]),zd=Object.freeze({editor:Yo,split:jd,preview:Qo}),Gd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:a,labels:i}=F(),m=Pr(),p=es(r,m,o),g=o?Ud:Vd,f=l.useId(),w=l.useRef(new Map),h={editor:{label:i.editViewEditor,tooltip:i.editViewEditorTooltip},split:{label:i.editViewSplit,tooltip:i.editViewSplitTooltip},preview:{label:i.editViewPreview,tooltip:i.editViewPreviewTooltip}},v=()=>{a.preparePreview(e),s?.prepare?.()},E=y=>{if(!rs(y.nativeEvent,ns(navigator.platform)))return;tn(y);const b=ts(p);Yt(a,e,b,o),w.current.get(b)?.focus()};return c.jsx("div",{role:"radiogroup","aria-label":n?i.editViewNamed(t):i.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:E,children:g.map(y=>{const b=zd[y],{label:L,tooltip:N}=h[y],C=y==="preview"?v:void 0;return c.jsxs("label",{className:n?"aqmx-icon-button":"aqmx-icon-button aqmx-labelled-button",children:[c.jsx("input",{ref:M=>{M===null?w.current.delete(y):w.current.set(y,M)},type:"radio",name:f,value:y,checked:y===p,"aria-label":L,"aria-keyshortcuts":y==="split"?void 0:Pd,title:N,"data-testid":`markdown-explorer-edit-view-${y}`,onChange:()=>Yt(a,e,y,o),onDoubleClick:ue,onPointerEnter:C,onFocus:C}),c.jsx(b,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:L})]},y)})})},Zd=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:a}=F(),[i,m]=l.useState(!1),{requestSave:p,confirmation:g}=os(e);if(r.phase.kind!=="editing")return null;const f=r.save.kind==="saving",w=f||!r.dirty,h=()=>{s.flush(e);const E=s.session(e);E===void 0||!E.dirty||E.save.kind==="saving"||p()},v=E=>n?{className:"aqmx-icon-button","aria-label":E}:{className:"aqmx-icon-button aqmx-labelled-button"};return c.jsxs(c.Fragment,{children:[r.save.kind==="conflicts"?c.jsxs("button",{type:"button",...v(a.conflictNext),title:a.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ue,children:[c.jsx(Td,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.conflictNext})]}):null,c.jsx(Gd,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?c.jsxs("button",{type:"button",...v(a.historyOpen),title:a.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>m(!0),onDoubleClick:ue,children:[c.jsx(Cd,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.historyOpen})]}):null,r.save.kind==="draft"?null:c.jsxs("button",{type:"button",...v(a.saveDraft),title:a.saveDraftTooltip,"aria-disabled":w,"aria-busy":f,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:h,onDoubleClick:ue,children:[c.jsx(Ld,{"aria-hidden":"true"}),n?null:c.jsx("span",{children:a.saveDraft})]}),r.history?c.jsx(Id,{path:e,documentName:t,open:i,onClose:()=>m(!1)}):null,g]})},Wd=({path:e,session:t})=>{const{edits:n}=F(),{save:r}=t,o=()=>{n.save(e)};return r.kind==="grant"?c.jsx(Jo,{href:r.href,onRetry:o,testId:"markdown-explorer-save-grant"}):r.kind==="failed"&&ie(r.failure.reason)?c.jsx(Ze,{failure:r.failure,place:"write",deniedSentence:null,retry:o,testId:"markdown-explorer-save-access-failure"}):null},ss=l.createContext(null);function Kd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M7.502 6h7.128A3.375 3.375 0 0 1 18 9.375v9.375a3 3 0 0 0 3-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 0 0-.673-.05A3 3 0 0 0 15 1.5h-1.5a3 3 0 0 0-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6ZM13.5 3A1.5 1.5 0 0 0 12 4.5h4.5A1.5 1.5 0 0 0 15 3h-1.5Z",clipRule:"evenodd"}),R.createElement("path",{fillRule:"evenodd",d:"M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 0 1 3 20.625V9.375Zm9.586 4.594a.75.75 0 0 0-1.172-.938l-2.476 3.096-.908-.907a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.116-.062l3-3.75Z",clipRule:"evenodd"}))}const Xd=R.forwardRef(Kd);function Yd({title:e,titleId:t,...n},r){return R.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?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",d:"M19.902 4.098a3.75 3.75 0 0 0-5.304 0l-4.5 4.5a3.75 3.75 0 0 0 1.035 6.037.75.75 0 0 1-.646 1.353 5.25 5.25 0 0 1-1.449-8.45l4.5-4.5a5.25 5.25 0 1 1 7.424 7.424l-1.757 1.757a.75.75 0 1 1-1.06-1.06l1.757-1.757a3.75 3.75 0 0 0 0-5.304Zm-7.389 4.267a.75.75 0 0 1 1-.353 5.25 5.25 0 0 1 1.449 8.45l-4.5 4.5a5.25 5.25 0 1 1-7.424-7.424l1.757-1.757a.75.75 0 1 1 1.06 1.06l-1.757 1.757a3.75 3.75 0 1 0 5.304 5.304l4.5-4.5a3.75 3.75 0 0 0-1.035-6.037.75.75 0 0 1-.354-1Z",clipRule:"evenodd"}))}const Qd=R.forwardRef(Yd),Jd=e=>{const{documents:t}=F(),n=l.useCallback(()=>t.peek(e),[t,e]),r=l.useCallback(()=>t.peekSeeded(e),[t,e]),o=we(l.useSyncExternalStore(t.subscribe,n,r));return o!==null&&o.document.kind!=="failure"},eu=(e,t)=>{switch(e.view){case"single":return{view:"document-id",id:t,opens:"single",overrides:e.overrides,embed:e.embed};case"tree":return{view:"document-id",id:t,overrides:e.overrides};case"multi":return{view:"document-id",id:t}}},tu=(e,t)=>new Promise(n=>n(e.write([t()]))),nu=({path:e,placement:t,onAccessFailure:n})=>{const{config:r,data:o,labels:s}=F(),{location:a}=Ge(),{shown:i,press:m}=oo(),p=Jd(e),g=l.useRef(0),f=re.useHref(r.basePath),w=y=>{const b=z.explorerHref(r,eu(a,y));return new URL(`${f}${b.slice(r.basePath.length)}`,window.location.origin).href},h=()=>{if(!p)return;const y=m();g.current+=1;const b=g.current;n(null);const L=_=>{console.error("[markdown-explorer] could not copy the permalink",_),y("failed",s.permalinkCopyFailed(s.permalinkClipboardRefused))},N=navigator.clipboard;if(N===void 0||typeof ClipboardItem>"u"){y("failed",s.permalinkCopyFailed(s.permalinkClipboardRefused));return}const C=o.issueId(e),M=C.then(_=>_.status==="ok"?new Blob([w(_.id)],{type:"text/plain"}):Promise.reject(new Error(`[markdown-explorer] the document ID was not issued: ${_.failure.reason}`)));M.catch(()=>{}),tu(N,()=>new ClipboardItem({"text/plain":M})).then(()=>C.then(_=>{_.status==="ok"&&y("copied",s.permalinkCopied(P.groupDocumentId(_.id)))}),_=>C.then(I=>{if(I.status!=="error"){L(_);return}const{failure:H}=I,{reason:j}=H;ie(j)?g.current===b&&n(H):y("failed",s.permalinkCopyFailed(ce(s,j)))}))},v=t.kind==="panel"?s.copyPermalinkNamed(t.documentName):null,E=i.message===null?v===null?s.copyPermalink:v:i.message;return c.jsxs("button",{type:"button",className:v===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:E,"aria-label":v===null?void 0:v,"aria-disabled":!p,"data-aqmx-copy-outcome":i.outcome,"data-testid":"markdown-explorer-document-permalink",onClick:h,onDoubleClick:ue,children:[i.outcome==="copied"?c.jsx(Xd,{"aria-hidden":"true"}):i.outcome==="failed"?c.jsx(ro,{"aria-hidden":"true"}):c.jsx(Qd,{"aria-hidden":"true"}),v===null?c.jsx("span",{children:s.copyPermalinkLabel}):null]})},ru=(e,t)=>{switch(t){case"markdown":return e.showMarkup;case"svg":return e.showSvgMarkup;case"csv":case"tsv":return e.showSpreadsheetMarkup(t.toUpperCase())}},ou=({maximize:e})=>{const{labels:t}=F(),n=e.maximized?t.documentRestore:t.documentMaximize;return c.jsx("button",{type:"button",className:"aqmx-icon-button",title:n,"aria-label":n,"data-testid":"markdown-explorer-document-maximize",onClick:e.toggle,onDoubleClick:ue,children:e.maximized?c.jsx(Ed,{"aria-hidden":"true"}):c.jsx(Xo,{"aria-hidden":"true"})})},as=Object.freeze({kind:"page"}),is=({path:e,placement:t,markup:n,maximize:r})=>{const{config:o,labels:s}=F(),{refreshing:a,unavailable:i,failure:m,refresh:p}=ao(e,t.kind==="page",n.shown),g=Dl(e),f=$d(e),w=Nr(e),h=t.kind==="panel"?s.refreshDocumentNamed(t.documentName):null,v=t.kind==="panel"?s.showMarkupNamed(t.documentName):null,E=t.kind==="panel",y=t.kind==="panel"?t.documentName:f.name,b=t.kind==="page"||t.maximized,L=l.use(ss),N=t.kind==="page"?L:null,C=N===null?null:N.onBar;l.useLayoutEffect(()=>{if(C!==null)return C(!0),()=>C(!1)},[C]);const M=N===null?void 0:N.lane?"merged":"covering",[_,I]=l.useState(null);_!==null&&(_.path!==e||w!==void 0)&&I(null);const H=_!==null&&_.path===e&&w===void 0?_.failure:null,j=l.useCallback(U=>I(U===null?null:{path:e,failure:U}),[e]);return c.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":w===void 0?void 0:"true","data-aqmx-sheet-bar":M,children:[c.jsxs("div",{className:"aqmx-document-refresh-row",children:[w===void 0?null:c.jsx(Hd,{session:w}),w===void 0?null:c.jsx(Zd,{path:e,documentName:y,iconOnly:E,session:w,previewAvailable:b}),w===void 0&&g!==null?c.jsxs("button",{type:"button",className:v===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:v===null?ru(s,g):v,"aria-label":v===null?void 0:v,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ue,children:[c.jsx(Yo,{"aria-hidden":"true"}),v===null?c.jsx("span",{children:s.showMarkupLabel}):null]}):null,w!==void 0||f.edit?.kind==="inline"||f.edit?.kind==="draft"?c.jsx(qd,{path:e,documentName:y,iconOnly:E,previewAvailable:b,draft:f.edit?.kind==="draft"}):f.edit?.kind==="external"?c.jsx(Bd,{href:f.edit.href,documentName:y,iconOnly:E}):null,w===void 0?c.jsxs("button",{type:"button",className:h===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h===null?s.refreshDocument:h,"aria-label":h===null?void 0:h,"aria-disabled":i,"aria-busy":a,"data-aqmx-busy":a?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:p,onDoubleClick:ue,children:[c.jsx(Ko,{"aria-hidden":"true"}),h===null?c.jsx("span",{children:s.refreshDocumentLabel}):null]}):null,w===void 0&&o.documentIds!==null?c.jsx(nu,{path:e,placement:t,onAccessFailure:j}):null,r===null?null:c.jsx(ou,{maximize:r})]}),w!==void 0||m===null?null:c.jsx(su,{failure:m,onRetry:p}),w!==void 0||H===null?null:c.jsx(Ze,{failure:H,place:"write",deniedSentence:null,retry:null,testId:"markdown-explorer-permalink-access-failure"}),w===void 0?null:c.jsx(Wd,{path:e,session:w})]})},su=({failure:e,onRetry:t})=>{const{labels:n}=F(),{reason:r}=e;return ie(r)?c.jsx(Ze,{failure:e,place:"read",deniedSentence:null,retry:t,testId:"markdown-explorer-document-refresh-failure"}):c.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":r,children:n.documentRefreshFailed(ce(n,r))})},au=({location:e})=>{const t=e.doc,n=l.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=xo(e);return c.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",...ut,children:[c.jsx(is,{path:t,placement:as,markup:r,maximize:null}),c.jsx(Wo,{path:t,absence:Vo,markup:e.markup,variant:n})]})},ls=({holds:e,deferWhileFullscreenIn:t,testId:n})=>{const{labels:r,announcer:o}=F(),s=l.useId();l.useLayoutEffect(()=>{if(!e)return;const m=t===null?null:()=>t.current!==null&&Oa(t.current);return o.claim(s,m)},[e,o,s,t]),l.useEffect(()=>{if(t===null)return;const m=t.current;if(m===null)return;const p=()=>o.publishDeferred();return m.addEventListener("close",p,!0),()=>m.removeEventListener("close",p,!0)},[o,t]);const a=l.useCallback(()=>o.shownIn(s),[o,s]),i=l.useSyncExternalStore(o.subscribe,a,a);return c.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":n,children:i.length>1?r.announcementSequence(i):i[0]})},Ce=Object.freeze([]),iu=e=>{const t=new Set;let n=Ce,r=[],o=!1;const s=[];let a=[];const i=h=>{n=h;for(const v of[...t])v()},m=()=>s.at(-1)?.region,p=()=>s.at(-1)?.defers?.()===!0,g=h=>{const v=m();h(),m()!==v&&n!==Ce&&i(Ce)},f=()=>{o=!1;const h=r.map(E=>"sentence"in E?E.sentence:E.list(E.items));if(r=[],p()){for(const E of h)a.at(-1)!==E&&a.push(E);return}const v=[...a,...h];a=[],i(Object.freeze(v))},w=()=>{o||(o=!0,n!==Ce&&i(Ce),e.request(f))};return{announce:h=>{if(typeof h=="string")r.push({sentence:h});else{const v=r.find(E=>"list"in E&&E.list===h.list);v!==void 0&&"items"in v?v.items.push(h.item):r.push({list:h.list,items:[h.item]})}w()},subscribe:h=>(t.add(h),()=>{t.delete(h)}),claim:(h,v)=>{const E={region:h,defers:v};return g(()=>s.push(E)),()=>g(()=>{const y=s.indexOf(E);y!==-1&&s.splice(y,1)})},publishDeferred:()=>{a.length>0&&!p()&&w()},shownIn:h=>m()===h?n:Ce}},he=Object.freeze({status:"cancelled"}),lu=e=>P.isExplorerResolvedDocumentId(e)&&(e.status!=="ok"||z.hasDocumentUrl(e.path)),tr=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(P.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return P.failureOf(n,r)},cu=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((f,w)=>globalThis.fetch(f,w)),o=(f,w)=>`${e}/${f}?${new URLSearchParams(w).toString()}`,s=f=>{const w=f.headers.get(P.EXPLORER_SCOPE_HEADER);w!==null&&t(w)},a=async(f,w,h,v)=>{let E;try{E=await r(f,{credentials:"same-origin",...w,headers:{Accept:"application/json",...w.headers}})}catch{return v({reason:"failed"})}s(E);let y;try{y=await E.json()}catch{return v({reason:P.failureReasonOfStatus(E.status)})}let b;try{b=h(y)}catch{b=!1}if(b)return y;const L=tr(y);return v(L!==null?L:{reason:E.status===200?"failed":P.failureReasonOfStatus(E.status)})},i={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_REFRESH_PROOF},m={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_EDIT_PROOF,"Content-Type":`${P.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},p={[P.EXPLORER_PROOF_HEADER]:P.EXPLORER_DOCUMENT_ID_PROOF},g=async(f,w,h)=>{const v=await a(f,w,h,E=>P.failureDocument(E.reason,E.code));return w.signal.aborted?he:v};return{tree:f=>a(o("tree",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"GET"},P.isExplorerTreeResult,w=>({status:"error",failure:w})),children:async(f,w,h)=>{const v=await a(o("children",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerChildrenResult,E=>({status:"error",failure:E}));return h.aborted?he:v},ancestors:async(f,w,h)=>{const v=await a(o("ancestors",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerAncestorsResult,E=>({status:"error",failure:E}));return h.aborted?he:v},reveal:async(f,w,h)=>{const v=await a(o("reveal",{[P.EXPLORER_DATA_QUERY.source]:f,[P.EXPLORER_DATA_QUERY.path]:w}),{method:"GET",signal:h},P.isExplorerRevealResult,E=>({status:"error",failure:E}));return h.aborted?he:v},document:(f,{refresh:w})=>a(o("document",{[P.EXPLORER_DATA_QUERY.path]:f}),w?{method:"GET",headers:i}:{method:"GET"},P.isExplorerDocument,h=>P.failureDocument(h.reason,h.code)),text:async(f,w)=>{const h=await a(o("text",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerTextAnswer,v=>P.failureDocument(v.reason,v.code));return w.aborted?he:h},asset:async(f,w)=>{let h;try{h=await r(f,{method:"GET",credentials:"same-origin",signal:w})}catch{return w.aborted?he:{status:"error",failure:{reason:"failed"}}}if(s(h),h.ok)return w.aborted?he:{status:"ok",body:h.body===null?new ReadableStream({start:y=>y.close()}):h.body};let v=null;try{v=await h.json()}catch{}if(w.aborted)return he;const E=tr(v);return{status:"error",failure:E===null?{reason:P.failureReasonOfStatus(h.status)}:E}},edit:(f,w)=>g(o("edit",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerEditAnswer),save:(f,w,h,v)=>g(o("save",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.base]:w}),{method:"POST",headers:m,body:h,signal:v},P.isExplorerSaveAnswer),preview:(f,w,h)=>g(o("preview",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"POST",headers:m,body:w,signal:h},P.isExplorerPreviewAnswer),revisions:(f,w)=>g(o("revisions",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"GET",signal:w},P.isExplorerRevisionsAnswer),revision:(f,w,h)=>g(o("revision",{[P.EXPLORER_DATA_QUERY.path]:f,[P.EXPLORER_DATA_QUERY.revision]:w}),{method:"GET",signal:h},P.isExplorerRevisionAnswer),refresh:f=>a(o("refresh",{[P.EXPLORER_DATA_QUERY.source]:f}),{method:"POST",headers:i},P.isExplorerTreeResult,w=>({status:"error",failure:w})),issueId:f=>a(o("issue-id",{[P.EXPLORER_DATA_QUERY.path]:f}),{method:"POST",headers:p},P.isExplorerIssuedDocumentId,w=>({status:"error",failure:w})),resolveId:async(f,w)=>{const h=await a(o("resolve-id",{[P.EXPLORER_DATA_QUERY.id]:f}),{method:"GET",signal:w},lu,v=>({status:"error",failure:v}));return w.aborted?he:h}}},du=()=>{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}}},uu=e=>{const t=ae.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 ${V.describeValue(e)} does not hold JSON; using the default tree settings.`,n),z.NO_TREE_SETTING_CHANGES}},nr=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=uu(e);n={changes:s,settings:z.applyTreeSettingChanges(t,s)}}return n},o=je();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(),ae.writeStorage(e,z.serializeTreeSettingChanges(m)),n.settings}}},fu=Object.freeze({status:"refreshed"}),mu=Object.freeze({status:"superseded"}),hu=Object.freeze({status:"unshown"}),Qt=Object.freeze({status:"deferred"}),pu=Or(Qt),cs=4,wu=cs-1,rr=Object.freeze({status:"loading"}),gu=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),vu=e=>{const t=new Map,n=no(),r=new Map,o=new Map,s=new Map,a=new Map,i=je(),m=new Set;let p=0,g=0;const f={direct:null,bulk:null},w=new Set;let h=!1,v=0;const E=()=>{v+=1,i.emit()},y=x=>o.get(x)??0,b=x=>{let S=a.get(x);return S===void 0&&(S={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},a.set(x,S)),S},L=(x,S,A)=>{x.inFlight.delete(S),p-=1,A.lane==="bulk"&&(g-=1)},N=x=>{const S=a.get(x);if(S!==void 0){for(const[A,D]of[...S.inFlight])L(S,A,D),D.controller.abort();S.direct.clear(),S.bulk.clear(),S.unclaimed.clear()}},C=x=>{const S=y(x)+1;return o.set(x,S),N(x),S},M=(x,S)=>{const A=Be(x),D={promise:x,opened:S,stale:!1,loadedAt:A?.status==="ok"?A.loadedAt:null};return x.status==="pending"&&x.then(q=>{q.status==="ok"&&(D.loadedAt=q.loadedAt)}),D},_=x=>{let S=r.get(x);return S===void 0&&(S=new Map,r.set(x,S)),S},I=x=>{const S=[...a.keys()],A=f[x],D=A===null?0:S.indexOf(A)+1;for(let q=0;q<S.length;q+=1){const Y=S[(D+q)%S.length],J=Y===void 0?void 0:a.get(Y);if(!(Y===void 0||J===void 0)){for(const W of J[x])if((J.claims.get(W)??0)!==0)return J[x].delete(W),f[x]=Y,{sourceId:Y,path:W}}}return null},H=(x,S,A,D)=>{const q=a.get(x);if(q===void 0||q.inFlight.get(S)!==A)return;L(q,S,A);const Y=(q.claims.get(S)??0)>0,J=_(x);if(D.status==="ok"?J.set(S,{status:"loaded",entries:D.entries}):D.status==="error"&&Y?J.set(S,{status:"failed",failure:D.failure}):J.delete(S),E(),D.status==="error"&&Y){const W={sourceId:x,path:S,failure:D.failure};for(const oe of[...m])oe(W)}U()},j=(x,S,A)=>{const D={controller:new AbortController,lane:A};b(x).inFlight.set(S,D),p+=1,A==="bulk"&&(g+=1),e.children(x,S,D.controller.signal).then(q=>H(x,S,D,q),()=>H(x,S,D,gu))},U=()=>{for(;p<cs;){const x=I("direct");if(x!==null){j(x.sourceId,x.path,"direct");continue}const S=g<wu?I("bulk"):null;if(S===null)return;j(S.sourceId,S.path,"bulk")}},Z=(x,S,A)=>{if(!(S.direct.delete(A)||S.bulk.delete(A))){const q=S.inFlight.get(A);if(q===void 0)return!1;L(S,A,q),q.controller.abort()}return r.get(x)?.delete(A),!0},K=()=>{h=!1;let x=!1;for(const S of w){const A=b(S);for(const D of A.unclaimed)(A.claims.get(D)??0)===0&&Z(S,A,D)&&(x=!0);A.unclaimed.clear()}w.clear(),x&&(E(),U())},u=(x,S)=>{t.set(x,M(Ue(e.tree(x)),S))},d=(x,S,A)=>{C(x);const D=M(Or(S),A);return t.set(x,D),r.delete(x),E(),U(),D},k=(x,S,A,D)=>{if(A!==y(x)||t.get(x)!==S)return;const q=Be(S.promise);if(!(D.status!=="ok"||q?.status!=="ok"||S.loadedAt===null||D.loadedAt<=S.loadedAt)){if(mt(q.entries,D.entries)){S.loadedAt=D.loadedAt;return}d(x,D,S.opened)}},T=(x,S)=>{const A=t.get(x);return A!==void 0&&Be(A.promise)?.status===S},O=(x,S)=>{S.stale=!1;const A=y(x);e.tree(x).then(D=>k(x,S,A,D))},$=async(x,S)=>{const A=(s.get(x)??0)+1;s.set(x,A);const D=await e.refresh(x);if(s.get(x)!==A)return mu;if(D.status==="error")return{status:"failed",failure:D.failure};const q=t.get(x);if(!(q!==void 0&&q.loadedAt!==null&&T(x,"ok")&&q.loadedAt>D.loadedAt)){const J=d(x,D,!0);if(q!==void 0&&q.promise.status==="pending"){const W=y(x);q.promise.then(oe=>k(x,J,W,oe))}}if(S)for(const[J,W]of t)J!==x&&Be(W.promise)?.status==="ok"&&(W.stale=!0);return fu};return{read:x=>t.get(x)?.promise??pu,open:x=>{const S=n.resumes(x),A=n.hold(x),D=t.get(x);return D===void 0||T(x,"deferred")?(u(x,!0),E()):S||(D.opened&&T(x,"error")?(u(x,!0),E()):(D.opened=!0,D.stale&&T(x,"ok")&&O(x,D))),A},retry:x=>{T(x,"error")&&(u(x,!0),E())},seed:(x,S)=>{const A=S.then(Y=>Y===null?Qt:Y,()=>Qt),D=t.get(x);if(D!==void 0&&T(x,"ok")){const Y=y(x);A.then(J=>k(x,D,Y,J));return}C(x);const q=M(Ue(A),D?.opened===!0);t.set(x,q),r.delete(x),U(),A.then(Y=>{t.get(x)===q&&(Y.status==="deferred"&&n.isHeld(x)&&u(x,q.opened),E())})},refresh:x=>$(x,!0),reloadSource:x=>{if(n.isHeld(x))return $(x,!1);const S=t.get(x);return S!==void 0&&(S.stale=!0),Promise.resolve(hu)},children:(x,S)=>r.get(x)?.get(S),claimChildren:(x,S)=>{const A=b(x),D=_(x);let q=!1,Y=!1;for(const[W,oe]of S)A.claims.set(W,(A.claims.get(W)??0)+1),D.get(W)===void 0?(D.set(W,rr),A[oe].add(W),q=!0,Y=!0):oe==="direct"&&A.bulk.delete(W)&&(A.direct.add(W),Y=!0);q&&E(),Y&&U();let J=!1;return()=>{if(!J){J=!0;for(const W of S.keys()){const oe=(A.claims.get(W)??0)-1;oe>0?A.claims.set(W,oe):(A.claims.delete(W),A.unclaimed.add(W))}w.add(x),!h&&(h=!0,queueMicrotask(K))}}},retryChildren:(x,S)=>{const A=r.get(x);if(A===void 0||A.get(S)?.status!=="failed")return;const D=b(x);if((D.claims.get(S)??0)>0){A.set(S,rr),D.direct.add(S),E(),U();return}A.delete(S),E()},pendingChildren:x=>{const S=a.get(x);return S===void 0?0:S.direct.size+S.bulk.size+S.inFlight.size},clear:()=>{for(const x of new Set([...t.keys(),...r.keys(),...o.keys(),...a.keys()]))C(x);for(const[x,S]of s)s.set(x,S+1);t.clear(),r.clear(),E()},subscribeChildrenFailures:x=>(m.add(x),()=>{m.delete(x)}),subscribe:i.subscribe,version:()=>v}},Eu=(e,t)=>{let n=e;const r=je();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},xu=Object.freeze({kind:"loading"}),yu=Object.freeze({reason:"invalid"}),bu=Object.freeze({reason:"failed"}),ku=(e,t)=>{const{config:n,data:r,sources:o}=F(),s=Se(),a=e.kind==="document-id"?e:null,[i,m]=l.useState(null),[p,g]=l.useState(null),f=l.useMemo(()=>a===null?null:i!==null&&i.opening===a?i:{opening:a,retries:0},[a,i]),w=f===null?null:f.opening.id===null?yu:f.retries===0&&t!==null&&t.id===f.opening.id?t.failure:p!==null&&p.attempt===f?p.failure:null,h=f!==null&&w===null,{hash:v}=re.useLocation(),E=l.useRef(v);l.useLayoutEffect(()=>{E.current=v},[v]),l.useEffect(()=>{if(!h||f===null||f.opening.id===null)return;const{opens:b,id:L}=f.opening,N=new AbortController;return r.resolveId(L,N.signal).then(C=>{if(!(C.status==="cancelled"||N.signal.aborted)){if(C.status==="error")return g({attempt:f,failure:C.failure});if(!o.some(M=>M.id===C.source))return g({attempt:f,failure:bu});s(`${z.explorerHref(n,z.documentIdOpeningTarget(b,C.path,C.source))}${E.current}`,"browse")}}),()=>N.abort()},[h,f,r,o,n,s]);const y=l.useCallback(()=>{f!==null&&m({opening:f.opening,retries:f.retries+1})},[f]);return l.useMemo(()=>f===null?null:w===null?xu:{kind:"document-id",failure:w,onRetry:y},[f,w,y])},Su=1;let at=0,Ee=null;const Tu=()=>{const{documentElement:e,body:t}=document;at===0&&(Ee={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"),at+=1;let n=!1;return()=>{n||(n=!0,at-=1,!(at>0||Ee===null)&&(e.style.overflow=Ee.htmlOverflow,t.style.overflow=Ee.bodyOverflow,e.style.scrollbarGutter=Ee.htmlGutter,t.style.scrollbarGutter=Ee.bodyGutter,Ee=null))}},Ru=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],or=1,Cu=1e3,sr=e=>e.getClientRects().length>0,$t="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.",Mu=e=>{if(!sr(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+Su)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. ${$t}`;if(t.height<or)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. ${$t}`;for(const{selector:r,name:o}of Ru)for(const s of e.querySelectorAll(r)){if(!sr(s))continue;const a=s.getBoundingClientRect().height;if(a<or)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. ${$t}`}return null},Lu=e=>{let t=!1,n;const r=()=>{n=void 0;const a=Mu(e);a!==null&&(t=!0,console.error(a))},o=()=>{t||(clearTimeout(n),n=setTimeout(r,Cu))},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)}},Ou=e=>(l.useEffect(()=>e?Tu():void 0,[e]),l.useCallback(t=>e?Lu(t):void 0,[e])),ar='[data-testid="markdown-explorer-view-switch"]',Au=[{control:ar,successors:[ar,'[data-testid="markdown-explorer-sheet-toggle"]','[data-testid="markdown-explorer-rail-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],Du=e=>{for(const t of Au){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},Nu=(e,t)=>{const n=l.useRef(null);l.useEffect(()=>{const o=i=>{const m=e.current;n.current=m!==null&&i instanceof Element&&m.contains(i)?Du(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=l.useRef(t);l.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 p=e.current;if(p===null)return!0;for(const g of o.control.successors)for(const f of p.querySelectorAll(g))if(f!==o.element&&(f.focus({preventScroll:!0}),document.activeElement===f))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])},ju=l.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-Df4HLMP-.cjs")).then(e=>({default:e.TreeLayout}))),Pu=l.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-BfGxy2pf.cjs")).then(e=>({default:e.MultiLayout}))),_u=64,Iu={request:e=>{requestAnimationFrame(e)}},ir=e=>{e.documents.clear(),e.trees.clear()},qt=(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)},Fu=(e,t)=>{const[n,r]=l.useState(()=>({overrides:t,locale:e,labels:zt(e,t)}));if(n.locale===e&&As(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:zt(e,t)};return r(o),o.labels},$u=(e,t,n)=>{const[r,o]=l.useState(()=>({scope:t,store:nr(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:nr(e,n)};return o(s),s.store},qe=(e,t)=>{const[n,r]=l.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},qu=()=>iu(Iu),lr="on",Bu="off",Hu=Object.freeze({kind:"unavailable"}),Uu=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")},cr=(e,t)=>{const n=we(e.peek(t));return n===null||n.document.kind==="failure"?P.lastPathSegment(t):n.document.name},Vu=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:a,renderTreeFailure:i,accessFailure:m,lockDocumentScroll:p=!1,onMathDiagnostics:g,onEditGrant:f,draftConverter:w,fetch:h,persistSettings:v,subscribeHostChanges:E,hostChangePolicy:y="reload",ref:b,guardUnload:L=xn.guardUnload,onDraftChange:N,confirmUnversionedSaves:C=xn.confirmUnversionedSaves,paletteKey:M})=>{ae.assertStorageNamespace(n),Uu(w),ys({fetch:h,persistSettings:v,subscribeHostChanges:E,onDraftChange:N,accessFailure:m,guardUnload:L,confirmUnversionedSaves:C,hostChangePolicy:y,paletteKey:M});const _=gr(r),I=Ds(s),H=Fu(_,o),{revalidate:j}=re.useRevalidator(),U=l.useRef(()=>{}),Z=re.useHref(t.dataPath),K=l.useRef({fetch:h,persistSettings:v,onDraftChange:N,hostChangePolicy:y});l.useLayoutEffect(()=>{K.current={fetch:h,persistSettings:v,onDraftChange:N,hostChangePolicy:y}},[h,v,N,y]);const[u]=l.useState(()=>({fetch:(B,Q)=>{const te=K.current.fetch;return te===void 0?globalThis.fetch(B,Q):te(B,Q)}})),[d]=l.useState(()=>{const B=cu({dataPath:Z,onScope:te=>U.current(te),fetch:u.fetch}),Q={documents:si({client:B,capacity:Math.max(_u,t.multiView.maxPanels*2)}),trees:vu(B)};return qt(Q,e),ae.syncStorageScope(n,e.scope),{data:B,...Q,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(d.aligned.pageData!==e||d.aligned.storageNamespace!==n){const B=d.aligned.pageData;d.aligned.pageData=e,d.aligned.storageNamespace=n,B!==e&&(B.scope!==e.scope?d.aligned.pendingReader=e:qt(d,e)),ae.syncStorageScope(n,e.scope)}const k=$u(ae.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);l.useLayoutEffect(()=>{const B=d.aligned.pendingReader;B!==null&&(d.aligned.pendingReader=null,ir(d),qt(d,B))},[e,d]),l.useLayoutEffect(()=>{let B=!1;return U.current=Q=>{Q===e.scope||B||(B=!0,ir(d),ae.clearExplorerStorage(n),j())},()=>{U.current=()=>{}}},[e,j,d,n]);const T=l.useRef(t.settingsCookie);l.useLayoutEffect(()=>{T.current=t.settingsCookie},[t.settingsCookie]);const[O]=l.useState(()=>Eu(e.settings,B=>{const Q=K.current.persistSettings;if(Q!==void 0){Q(z.serializeViewSettings(B));return}document.cookie=z.viewSettingsCookieString(T.current,B,window.location.protocol==="https:")})),$=qe(e.scope,qu),x=qe(e.scope,du),S=qe(e.scope,Gs),A=qe(e.scope,Ns),D=l.useRef(H);l.useLayoutEffect(()=>{D.current=H},[H]);const q=qe(e.scope,()=>aa({data:d.data,conflictLabels:()=>({ours:D.current.conflictOurs,theirs:D.current.conflictTheirs}),onSaveSettled:(B,Q)=>{Q.kind==="saved"&&d.documents.refresh(B);const te=ta(D.current,Q,cr(d.documents,B));te!==null&&$.announce(te)},sideBySideSetting:{read:()=>ae.readStorage(ae.storageKeys(n).editPreview)===lr,write:B=>ae.writeStorage(ae.storageKeys(n).editPreview,B?lr:Bu)},editorShareSetting:{read:()=>sa(ae.readStorage(ae.storageKeys(n).editSplit)),write:B=>ae.writeStorage(ae.storageKeys(n).editSplit,String(B))}})),Y=l.useMemo(()=>Ue(e.notices.catch(()=>[])),[e.notices]),J=e.sources.map(B=>B.id).join(`
|
|
17
17
|
`),W=l.useMemo(()=>z.withExplorerSources(t,J.split(`
|
|
18
|
-
`)),[t,J]),oe=l.useRef(g);l.useLayoutEffect(()=>{oe.current=g},[g]);const[ge]=l.useState(()=>(B,
|
|
18
|
+
`)),[t,J]),oe=l.useRef(g);l.useLayoutEffect(()=>{oe.current=g},[g]);const[ge]=l.useState(()=>(B,Q)=>{oe.current?.(B,Q)}),de=g===void 0?void 0:ge,ve=l.useRef(w);l.useLayoutEffect(()=>{ve.current=w},[w]);const[St]=l.useState(()=>{let B=!1;return{convert:(Q,te)=>{const Te=ve.current;return Te===void 0?Promise.resolve(Hu):Te.convert(Q,te)},prepare:()=>{try{ve.current?.prepare?.()}catch(Q){if(B)return;B=!0,console.error("[markdown-explorer] the draft converter's prepare threw",Q)}}}}),Pe=w===void 0?void 0:St;l.useEffect(()=>{if(E===void 0)return;let B=!0;const Q=E(te=>{B&&ba(te,{trees:d.trees,documents:d.documents,edits:q,documentChanges:A,announcer:$,labels:D.current,nameOf:Te=>cr(d.documents,Te),policy:K.current.hostChangePolicy})});if(typeof Q!="function")throw B=!1,new TypeError(`[markdown-explorer] subscribeHostChanges must return its unsubscribe function; got ${V.describeValue(Q)}`);return()=>{B=!1,Q()}},[E,d,q,A,$]);const Qe=N!==void 0;l.useEffect(()=>{if(Qe)return q.subscribeDrafts(B=>K.current.onDraftChange?.(B))},[q,Qe]);const fe=l.useRef({edits:q,announcer:$,mediaFailures:S});l.useLayoutEffect(()=>{fe.current={edits:q,announcer:$,mediaFailures:S}},[q,$,S]);const _e=l.useRef(null);l.useImperativeHandle(b,()=>({flushUnsaved:()=>{const{edits:B}=fe.current;return B.flushDrafts(),B.dirtyPaths()},confirmDiscard:async B=>{bs("confirmDiscard",B);const{edits:Q}=fe.current,te=Q.unsavedAmong([...new Set(B)]);return te.length===0?!0:Q.askToDiscard(te)},restoreDrafts:async B=>(Ss(B),fe.current.edits.restoreDrafts(B)),announce:B=>{Ts(B),fe.current.announcer.announce(B)},owns:B=>_e.current?.contains(B)===!0,reportMediaFailure:B=>{Rs(B),fe.current.mediaFailures.report(B)}}),[]);const Je=h===void 0?void 0:u.fetch,et=l.useMemo(()=>({config:W,labels:H,locale:_,theme:I,storageNamespace:n,scope:e.scope,sources:e.sources,notices:Y,documents:d.documents,trees:d.trees,data:d.data,viewSettings:O,treeSettings:k,announcer:$,reveals:x,edits:q,mediaFailures:S,documentChanges:A,onEditGrant:f,draftConverter:Pe,renderTreeFailure:i,accessFailure:m,reportMathDiagnostics:de,fetch:Je,guardUnload:L,confirmUnversionedSaves:C,paletteKey:M}),[W,H,_,I,n,e.scope,e.sources,Y,d,O,k,$,x,q,S,A,f,Pe,i,m,de,Je,L,C,M]);return c.jsx(vr,{value:et,children:c.jsx(Gu,{renderFrame:a,lockDocumentScroll:p,rootRef:_e,documentIdAnswer:e.documentId},e.scope)})},zu=({ref:e,theme:t,view:n,children:r})=>{const[o]=l.useState(Ji);return c.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})},Gu=({renderFrame:e,lockDocumentScroll:t,rootRef:n,documentIdAnswer:r})=>{const{theme:o,labels:s,mediaFailures:a}=F(),i=Ge(),m=ku(i,r),{hash:p}=re.useLocation(),g=Se(),f=Ou(t),w=l.useCallback(b=>{if(n.current=b,b===null)return;const L=a.observe(b),N=f(b);return()=>{N?.(),L(),n.current=null}},[a,n,f]);l.useLayoutEffect(()=>{i.kind==="redirect"&&g(`${i.href}${p}`,"browse")},[i,p,g]);const{location:h}=i,v=h.view;Nu(n,v);const E=h.view==="tree"?c.jsx(l.Suspense,{fallback:c.jsx("section",{className:"aqmx-split-fallback","aria-label":s.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading",...ut}),children:c.jsx(ju,{location:h,opening:m})}):h.view==="multi"?c.jsx(l.Suspense,{fallback:c.jsx("section",{className:"aqmx-stage-fallback","aria-label":s.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading",...ut}),children:c.jsx(Pu,{location:h})}):c.jsx(au,{location:h}),y=c.jsxs(zu,{ref:w,theme:o,view:v,children:[E,c.jsx(xa,{}),c.jsx(ls,{holds:!0,deferWhileFullscreenIn:n,testId:"markdown-explorer-announcer"})]});return e===void 0?y:e({view:v,children:y})},Zu=e=>{if(e instanceof Tt.MarkdownResourceExhaustedError||e instanceof Tt.MarkdownConversionTimeoutError)return P.failureDocument("too-large");if(!(e instanceof Tt.MarkdownConversionError))throw e;switch(e.code){case"unavailable":return{kind:"unavailable"};case"invalid_argument":return P.failureDocument("invalid");case"internal":return P.failureDocument("failed");default:throw e}},Wu=e=>({timeoutMs:e.conversion.deadlineMs,options:{deniedPathSegments:[...e.deny],maxHtmlBytes:e.conversion.maxHtmlBytes,includeSourceLines:!0}}),Ku=ps.createShouldRevalidate({submissions:"skip",otherPath:"skip",query:"skip",hashChange:"skip"});exports.ALLOW_KEY_REPEAT=gt;exports.AccessFailureNotice=Ze;exports.AccessFailureRelayContext=Er;exports.CONFLICT_OURS_MARKER=kr;exports.CONFLICT_SEPARATOR=Sr;exports.CONFLICT_THEIRS_MARKER=Tr;exports.CONTENT_PANE=ut;exports.ContentSkeleton=ke;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=ur;exports.DocumentPane=Wo;exports.DocumentRefreshBar=is;exports.EXPLORER_HOST_CHANGE_POLICIES=dr;exports.EXPLORER_THEMES=Gt;exports.EditGrantNotice=Jo;exports.ExplorerLink=zr;exports.FOLDER_README_LOADING=Ar;exports.FailureView=ye;exports.ForwardRef=Ko;exports.ForwardRef$1=Qo;exports.ForwardRef$2=Xo;exports.ImageViewMemoryContext=po;exports.LazyNativeScrollBar=Zr;exports.LiveRegion=ls;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=wr;exports.MARKDOWN_EXPLORER_LABEL_KEYS=en;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=hr;exports.MARKDOWN_EXPLORER_LOCALES=Vt;exports.MarkdownExplorer=Vu;exports.NATIVE_SCROLL_BAR_SLOT_LENGTH=an;exports.NATIVE_SCROLL_BAR_WIDTH=Va;exports.NEAREST=wt;exports.NO_DOCUMENT=Vo;exports.PAGE_DOCUMENT_REFRESH=as;exports.SCROLL_BAR_CONTROLS=Kr;exports.SheetAccessFailureList=Ys;exports.SheetAccessFailuresContext=xr;exports.SheetBarContext=ss;exports.TAP_SCROLL_CIRCLE_GUTTER_LENGTH=cn;exports.TAP_SCROLL_CIRCLE_OFFSET_X=Wa;exports.TAP_SCROLL_CIRCLE_SIZE=ln;exports.TAP_SCROLL_CIRCLE_SPEED_RANGE=Yr;exports.TOUCH_SCROLL_BAR_CONTROLS=Xr;exports.alignToStart=mo;exports.anchorOfDoubleClick=$r;exports.anchorOfView=qr;exports.blockAtLine=Ur;exports.chooseEditView=Yt;exports.consumeKey=tn;exports.createEmitter=je;exports.createSheetAccessFailures=Xs;exports.cssPixels=Cr;exports.draftAnswerOf=Zu;exports.draftConversionOf=Wu;exports.editViewOf=es;exports.explorerNavigationOf=Ba;exports.explorerNavigationOptions=qa;exports.failureTitleOf=ce;exports.findConflictsInLines=Rr;exports.focusWithoutScroll=on;exports.frameTopOf=Br;exports.isAccessFailureReason=ie;exports.isApplePlatform=ns;exports.isEditViewShortcut=rs;exports.isEditingDoubleClick=Fr;exports.isInFullscreenBlock=La;exports.keepInView=lo;exports.lineTopIn=Vr;exports.loadedOf=we;exports.paneShownAlone=_d;exports.positionInSource=Ia;exports.readFolderReadme=Dr;exports.resolveMarkdownExplorerLabels=zt;exports.scrollBarControlsFor=sn;exports.shouldRevalidateExplorer=Ku;exports.stopKeepingInView=io;exports.toggledEditView=ts;exports.useCoarsePointer=dn;exports.useExplorer=F;exports.useExplorerLocation=Ge;exports.useExplorerNavigate=Se;exports.useIntentPrefetch=Gr;exports.usePageMarkupToggle=xo;exports.useSaveRequest=os;exports.useSideBySide=Pr;exports.useViewSetting=xe;exports.visibleTopOf=Hr;
|