@aiquants/markdown-explorer 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +61 -21
  3. package/dist/{EditSurface-Bk4tdJ99.cjs → EditSurface-CRc4g0Qa.cjs} +5 -5
  4. package/dist/{EditSurface-Dhvw9IDD.js → EditSurface-CcWEczj3.js} +333 -336
  5. package/dist/{ExplorerSplit-Q5VqUBDE.js → ExplorerSplit-97SeIAOS.js} +81 -81
  6. package/dist/{ExplorerSplit-BAFiXU-V.cjs → ExplorerSplit-ByxxXlgs.cjs} +1 -1
  7. package/dist/{MultiLayout-Bq_TS3ez.cjs → MultiLayout-B_yMVDt_.cjs} +1 -1
  8. package/dist/{MultiLayout-DlATT7km.js → MultiLayout-CnbuAlxd.js} +22 -22
  9. package/dist/{NativeScrollBar-TsIcS3JZ.js → NativeScrollBar-BXdaM3EA.js} +1 -1
  10. package/dist/{NativeScrollBar-A6-qEpz7.cjs → NativeScrollBar-D4a7fBOS.cjs} +1 -1
  11. package/dist/{TreeLayout-zrSo4MNZ.js → TreeLayout-BIQBKAkV.js} +3 -3
  12. package/dist/{TreeLayout-l-r2pPao.cjs → TreeLayout-C6QDpEBS.cjs} +1 -1
  13. package/dist/core/config.d.cts +13 -0
  14. package/dist/core/config.d.ts +13 -0
  15. package/dist/core/contracts.d.cts +22 -4
  16. package/dist/core/contracts.d.ts +22 -4
  17. package/dist/core/labels.d.cts +9 -0
  18. package/dist/core/labels.d.ts +9 -0
  19. package/dist/core/textEncoding.d.cts +4 -0
  20. package/dist/core/textEncoding.d.ts +4 -0
  21. package/dist/{dataRoute-Diu_7gle.js → dataRoute-BEvesOvN.js} +105 -97
  22. package/dist/dataRoute-Cv7fgCW7.cjs +1 -0
  23. package/dist/index-BwTVYkTR.cjs +13 -0
  24. package/dist/index-CeZDCyEl.js +4088 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +24 -23
  29. package/dist/location-CasigkBk.cjs +1 -0
  30. package/dist/location-gXXmC7CQ.js +643 -0
  31. package/dist/{merge-BzMpSaxx.js → merge-DqjUgcV_.js} +1 -1
  32. package/dist/{merge-DlPkU2Jc.cjs → merge-QLktbpZY.cjs} +1 -1
  33. package/dist/{sanitizePolicy-Du3lFZd-.cjs → sanitizePolicy-CZwOaJ92.cjs} +1 -1
  34. package/dist/{sanitizePolicy-BvhYIqVO.js → sanitizePolicy-gVKBhabq.js} +1 -1
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +1 -1
  37. package/dist/server/fileSystemSource.d.cts +1 -0
  38. package/dist/server/fileSystemSource.d.ts +1 -0
  39. package/dist/server/ports.d.cts +8 -1
  40. package/dist/server/ports.d.ts +8 -1
  41. package/dist/server.cjs +1 -1
  42. package/dist/server.d.cts +1 -0
  43. package/dist/server.d.ts +1 -0
  44. package/dist/server.js +783 -768
  45. package/dist/styles/markdown-explorer.css +1 -1
  46. package/dist/{useSplitPersistence-HfAb8Kzh.js → useSplitPersistence-BPNjvuJi.js} +1 -1
  47. package/dist/{useSplitPersistence-CR4Oxtaa.cjs → useSplitPersistence-Bmpb2prR.cjs} +1 -1
  48. package/docs/behavior/dom-hooks.md +13 -6
  49. package/docs/behavior/layout.md +19 -10
  50. package/docs/behavior/localization.md +6 -3
  51. package/docs/behavior/security.md +6 -4
  52. package/docs/behavior/url-contract.md +2 -2
  53. package/package.json +5 -5
  54. package/dist/dataRoute-vXGZMVB-.cjs +0 -1
  55. package/dist/index-BNFl3BsO.cjs +0 -13
  56. package/dist/index-Jz6zeO4O.js +0 -3703
  57. package/dist/location-8Ho8ZNv_.js +0 -499
  58. package/dist/location-DN0AI4ir.cjs +0 -1
@@ -0,0 +1,4088 @@
1
+ import { jsxs as H, jsx as s, Fragment as je } from "react/jsx-runtime";
2
+ import * as y from "react";
3
+ import { createContext as he, use as oe, useMemo as Y, useSyncExternalStore as re, useRef as B, useLayoutEffect as K, useCallback as I, useId as ke, useEffect as ee, Component as En, Suspense as xe, lazy as wt, useState as U, useEffectEvent as ae } from "react";
4
+ import { useParams as br, useSearchParams as Er, matchPath as yr, useBlocker as Sr, useNavigate as kr, Link as xr, useHref as ze, useLocation as yn, useRevalidator as Tr } from "react-router";
5
+ import { k as Rr, h as Sn, G as Or, E as kn, a as xn, H as Cr, I as Dt, J as Mr, K as be, e as ye, m as Lr, L as Ar, M as Nr, O as Dr, Q as Pt, R as Pr, T as $t, U as $r, w as Fr, V as qr } from "./location-gXXmC7CQ.js";
6
+ import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as Ft, SPREADSHEET_BLOCK_LABEL_CATALOGS as Ie } from "@aiquants/markdown/code-blocks";
7
+ import { H as ce, i as Ir, I as gt, A as te, J as Xe, B as Je, z as _r, K as Br, f as Hr, L as jr, N as zr, O as Vr, P as Ur, Q as qt, x as Zr, R as Gr, S as Wr, T as Kr, D as Yr, y as Xr, U as Jr, V as Qr, W as eo, w as It } from "./dataRoute-BEvesOvN.js";
8
+ import { HostedScrollArea as _t, SpreadsheetBlock as to, useMarkdownToolbarState as no, MarkdownViewer as Tn } from "@aiquants/markdown";
9
+ import { SOURCE_LINES_ATTRIBUTE as Rn, parseSourceLines as ro } from "@aiquants/markdown/source-lines";
10
+ import { iterateTsvRows as oo, iterateTsvPrefixRows as io, serializeTsv as ao } from "@aiquants/spreadsheet/tsv";
11
+ import { SPREADSHEET_MAX_OPERATION_CELLS as Bt } from "@aiquants/spreadsheet/view";
12
+ import { DEFAULT_CONTENT_ALIGN as lo } from "@aiquants/markdown/viewer-settings";
13
+ import { w as ct, r as dt, a as so, b as Ht, s as ve, c as co } from "./storage-CmGHg7OA.js";
14
+ import { createShouldRevalidate as uo } from "@aiquants/route-revalidation";
15
+ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`, On = Object.freeze(Object.keys(Ie.en)), Cn = (e) => Object.fromEntries(On.map((t) => [vt(t), Ie[e][t].text])), mo = Object.freeze({
16
+ panelMoved: Object.freeze(["title", "column", "position"]),
17
+ panelMoveUnavailable: Object.freeze(["title", "move"]),
18
+ panelDragStarted: Object.freeze(["title"]),
19
+ panelDragCancelled: Object.freeze(["title"]),
20
+ multiColumnRegion: Object.freeze(["column"]),
21
+ viewerSvgImageSourceRegion: Object.freeze(["name"]),
22
+ ...Object.fromEntries(On.filter((e) => Ft[e].length > 0).map((e) => [vt(e), Ft[e]]))
23
+ }), ho = /\{(\w+)\}/gu, Mn = {
24
+ ...Cn("en"),
25
+ explorerRegion: "Explorer",
26
+ sourceLabel: "Source",
27
+ refreshTreeLabel: "Refresh tree",
28
+ refreshTree: "Reload the tree and the open documents from the source",
29
+ treeRefreshed: "Reloaded the tree from the source",
30
+ treeRefreshFailed: (e) => `Could not reload the tree: ${e}`,
31
+ refreshDocumentLabel: "Refresh document",
32
+ refreshDocument: "Reload the document from the source",
33
+ refreshDocumentNamed: (e) => `Refresh ${e}`,
34
+ documentRefreshed: (e) => `Reloaded ${e}`,
35
+ documentRefreshFailed: (e) => `Could not reload the document: ${e}`,
36
+ showMarkupLabel: "Source",
37
+ showMarkup: "Show the document's Markdown as written",
38
+ showSvgMarkup: "Show the image's SVG as written",
39
+ showSpreadsheetMarkup: (e) => `Show the table's ${e} as written`,
40
+ showMarkupNamed: (e) => `Source of ${e}`,
41
+ editDocumentLabel: "Edit",
42
+ editDocument: "Edit the document's Markdown (or double-click the document)",
43
+ editDocumentNamed: (e) => `Edit ${e}`,
44
+ editDraftDocument: "Edit the document's Markdown without saving, to try it in the preview (or double-click the document)",
45
+ editDraftDocumentNamed: (e) => `Edit ${e} without saving`,
46
+ editExternallyLabel: "Open in its editor",
47
+ editExternally: "Open the document in its own editor, in a new tab",
48
+ editExternallyNamed: (e) => `Open ${e} in its editor`,
49
+ editorRegion: (e) => `Editing ${e}`,
50
+ editorLabel: (e) => `Markdown of ${e}`,
51
+ editLoading: "Loading the source for editing…",
52
+ editToolbar: "Editor",
53
+ saveDraft: "Save",
54
+ saveDraftTooltip: "Save the draft (Ctrl+S, or ⌘S on a Mac)",
55
+ closeEditor: "Close editor",
56
+ editView: "View",
57
+ editViewNamed: (e) => `View of ${e}`,
58
+ editViewEditor: "Editor",
59
+ editViewEditorTooltip: "Show the editor (Ctrl+E, or ⌘E on a Mac, switches with the preview)",
60
+ editViewSplit: "Side by side",
61
+ editViewSplitTooltip: "Show the editor and the preview side by side",
62
+ editViewSplitResize: "Resize the editor and the preview",
63
+ editViewPreview: "Preview",
64
+ editViewPreviewTooltip: "Show the preview (Ctrl+E, or ⌘E on a Mac, switches with the editor)",
65
+ historyOpen: "History",
66
+ draftUnsaved: "Unsaved changes",
67
+ draftStatus: "Draft, not saved",
68
+ draftNotSaved: "This draft is not saved: the document cannot be saved here.",
69
+ draftSaving: "Saving…",
70
+ draftSaved: "Saved",
71
+ draftSavedMerged: "Saved, merged with changes saved elsewhere",
72
+ 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`,
73
+ draftSaveFailed: (e) => `Could not save: ${e}`,
74
+ documentSaved: (e) => `Saved ${e}`,
75
+ documentSavedMerged: (e) => `Saved ${e}, merged with changes saved elsewhere`,
76
+ conflictOurs: "your draft",
77
+ conflictTheirs: "saved elsewhere",
78
+ conflictUseOurs: "Use my lines",
79
+ conflictUseTheirs: "Use the saved lines",
80
+ conflictKeepBoth: "Keep both",
81
+ conflictNext: "Next conflict",
82
+ editGrantTitle: "Editing needs your permission",
83
+ editGrantBody: "Allow this site to change documents on your behalf. You are asked once; signing out asks again.",
84
+ editGrantAction: "Grant permission",
85
+ editGrantRetry: "Try again",
86
+ unsavedTitle: "Discard unsaved changes?",
87
+ unsavedBody: (e) => `${e} has changes that are not saved.`,
88
+ unsavedDiscard: "Discard changes",
89
+ draftDiscardTitle: "Discard the draft?",
90
+ draftDiscardBody: (e) => `The changes to ${e} are not saved anywhere and will be lost.`,
91
+ unsavedStay: "Keep editing",
92
+ historyTitle: (e) => `Revisions of ${e}`,
93
+ historyLoading: "Loading the revisions…",
94
+ historyEmpty: "No revisions are kept for this document.",
95
+ historyCurrent: "Current",
96
+ historyKept: "Kept",
97
+ historyEntry: (e, t) => t === "" ? e : `${e} by ${t}`,
98
+ historyRestore: "Put into the draft",
99
+ historyClose: "Close",
100
+ historyRestored: (e) => `Put the revision into the draft of ${e}; save to keep it`,
101
+ previewRegion: "Preview",
102
+ previewUpdating: "Updating the preview…",
103
+ previewFailed: (e) => `Could not preview: ${e}`,
104
+ previewTablePending: "This table can be edited once the preview shows the draft.",
105
+ expandAll: "Expand all folders",
106
+ collapseAll: "Collapse all folders",
107
+ treeSettings: "Tree settings",
108
+ switchToMulti: "Open in the multi-panel view",
109
+ switchToTree: "Open in the tree view",
110
+ resizeExplorer: "Resize the explorer",
111
+ showExplorer: "Show the explorer",
112
+ hideExplorer: "Close the explorer",
113
+ treeRegion: "Documents",
114
+ treeLoading: "Loading the tree…",
115
+ treeEmptyTitle: "Nothing to show",
116
+ treeEmptyBody: "This source has no documents you can open.",
117
+ folderLoadFailed: "This folder could not be loaded.",
118
+ loopFolderName: (e) => `${e} (already open above)`,
119
+ foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("en", { type: "conjunction" }).format(e)} could not be loaded`,
120
+ foldersLoading: (e) => e === 1 ? "Loading 1 folder…" : `Loading ${String(e)} folders…`,
121
+ expandAllStarted: "Opening all folders…",
122
+ expandAllProgress: (e, t) => `Opening all folders (${String(e)} opened, ${String(t)} loading)…`,
123
+ expandAllDone: (e, t, n) => {
124
+ const r = `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}`;
125
+ return t > 0 ? `${r}; ${String(t)} could not be loaded` : n ? e === 0 ? "All folders are already open" : `${r}; every folder is open` : r;
126
+ },
127
+ 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`,
128
+ expandAllDepthLimit: (e, t) => `Opened ${String(e)} ${e === 1 ? "folder" : "folders"}; folders more than ${String(t)} ${t === 1 ? "level" : "levels"} deep stay closed`,
129
+ treeEntryKindDirectory: "directory",
130
+ treeEntryKindFile: "file",
131
+ treeScrollUp: "Scroll up",
132
+ treeScrollDown: "Scroll down",
133
+ treeScrollToTop: "Top",
134
+ treeScrollToBottom: "Bottom",
135
+ selectionTitle: (e) => `Selected (${String(e)})`,
136
+ clearSelection: "Clear the selection",
137
+ openSelectionInMulti: (e) => `Open ${String(e)} in panels`,
138
+ removeFromSelection: (e) => `Remove ${e} from the selection`,
139
+ settingSortMode: "Sort order",
140
+ sortNative: "Source order",
141
+ sortAscending: "Name A→Z",
142
+ sortDescending: "Name Z→A",
143
+ sortOldest: "Modified old→new",
144
+ sortNewest: "Modified new→old",
145
+ settingFolderPlacement: "Folders",
146
+ folderPlacementMixed: "Mixed",
147
+ folderPlacementFirst: "First",
148
+ folderPlacementLast: "Last",
149
+ settingReadmePlacement: "README",
150
+ readmePlacementMixed: "Mixed",
151
+ readmePlacementFirst: "First",
152
+ readmePlacementLast: "Last",
153
+ settingSelectionMode: "Selection",
154
+ selectionSingle: "Single",
155
+ selectionMultiple: "Multiple",
156
+ selectionNone: "Off",
157
+ settingDoubleClick: "Double-click",
158
+ doubleClickRecursive: "Expand all levels",
159
+ doubleClickToggle: "Toggle",
160
+ settingExpandIconSize: "Expander size",
161
+ expandIconSizeValue: (e) => `${String(e)} px`,
162
+ settingAlwaysExpanded: "Always expanded",
163
+ settingRevealDocument: "Reveal the open document",
164
+ settingRemoveRootIndent: "No root indent",
165
+ settingTreeLines: "Tree lines",
166
+ settingExpandIcons: "Expanders",
167
+ settingDirectoryIcons: "Folder icons",
168
+ settingFileIcons: "File icons",
169
+ settingOn: "On",
170
+ settingOff: "Off",
171
+ settingAnnouncement: (e, t) => `${e}: ${t}`,
172
+ documentRegion: "Document",
173
+ documentEmpty: "Select a document in the explorer.",
174
+ folderReadmeMissing: (e) => `${e} has no README.`,
175
+ documentLoading: "Loading the document…",
176
+ markupLoading: "Loading the source…",
177
+ spreadsheetLoading: "Loading the table…",
178
+ documentShown: (e) => `Showing ${e}`,
179
+ documentFailed: (e, t) => `${e}: ${t}`,
180
+ announcementSequence: (e) => e.map((t) => /[.!?]$/u.test(t) ? t : `${t}.`).join(" "),
181
+ textTruncated: "Only the beginning of this file is shown.",
182
+ inertLink: "This link points outside the source and cannot be opened.",
183
+ failureUnauthorizedTitle: "Your session has expired",
184
+ failureUnauthorizedBody: "Reload the page to sign in again.",
185
+ failureForbiddenTitle: "Access denied",
186
+ failureForbiddenBody: "You do not have permission to open this.",
187
+ failureNotFoundTitle: "Not found",
188
+ failureNotFoundBody: "It may have been moved or deleted.",
189
+ failureNotConfiguredTitle: "This source is not set up",
190
+ failureNotConfiguredBody: "Ask your administrator to configure it.",
191
+ failureInvalidTitle: "Invalid address",
192
+ failureInvalidBody: "The document path in this address cannot be used.",
193
+ failureTooLargeTitle: "Too large to display",
194
+ failureTooLargeBody: "This file exceeds the size that can be displayed.",
195
+ failureUnsupportedTitle: "Cannot be displayed",
196
+ failureUnsupportedBody: "This type of file cannot be shown here.",
197
+ failureFailedTitle: "Something went wrong",
198
+ failureFailedBody: "Try again in a moment.",
199
+ retry: "Try again",
200
+ reloadPage: "Reload the page",
201
+ imageZoomIn: "Zoom in",
202
+ imageZoomOut: "Zoom out",
203
+ imageFit: "Fit to the view",
204
+ imageFitLevel: "Fit",
205
+ imageZoomLevel: (e) => `${String(e)}%`,
206
+ openInNewTab: "Open in a new tab",
207
+ download: "Download",
208
+ copyText: "Copy the text",
209
+ copiedText: "Copied the text",
210
+ copyTextFailed: "Could not copy the text",
211
+ mediaUnsupported: "Your browser cannot play this file.",
212
+ fileNotShown: "This file cannot be shown here. Download it to open it.",
213
+ pdfNotShown: "This browser does not show PDF files inside the page. Open it in a new tab or download it.",
214
+ spreadsheetFirstSheetOnly: "Only the first sheet of this spreadsheet is shown.",
215
+ spreadsheetTruncated: "The table shows only part of this file. Download it to open the whole file.",
216
+ 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.`,
217
+ spreadsheetEmpty: "This file has no data.",
218
+ spreadsheetNotText: "This file is not text, so it cannot be shown as a table. Download it to open it.",
219
+ 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.",
220
+ spreadsheetFullscreen: (e) => `${e} (full screen)`,
221
+ viewerLoading: "Loading data...",
222
+ viewerErrorPrefix: "Error: ",
223
+ viewerStyleTitle: "Display Style",
224
+ viewerSelectStyle: "Select display style",
225
+ viewerPinStyle: "Pin style selector",
226
+ viewerUnpinStyle: "Unpin style selector",
227
+ viewerErrorTitle: "An error occurred",
228
+ viewerMissingImage: "Image not found",
229
+ viewerOpenToc: "Open table of contents",
230
+ viewerTocTitle: "Table of contents",
231
+ viewerPinToc: "Pin table of contents",
232
+ viewerUnpinToc: "Unpin table of contents",
233
+ viewerSelectAlign: "Select alignment",
234
+ viewerAlignTitle: "Alignment",
235
+ viewerPinAlign: "Pin alignment selector",
236
+ viewerUnpinAlign: "Unpin alignment selector",
237
+ viewerAlignLeft: "Align left",
238
+ viewerAlignCenter: "Align center",
239
+ viewerAlignRight: "Align right",
240
+ viewerMermaidInteractionMode: "Mouse interaction mode",
241
+ viewerMermaidInteractionModeTouch: "Touch interaction mode",
242
+ viewerMermaidModeNone: "No interaction",
243
+ viewerMermaidModeZoom: "Zoom only",
244
+ viewerMermaidModePan: "Pan only (drag)",
245
+ viewerMermaidModePanShift: "Pan only (Shift+drag)",
246
+ viewerMermaidModeBoth: "Zoom and pan (drag)",
247
+ viewerMermaidModeBothShift: "Zoom and pan (Shift+drag)",
248
+ viewerMermaidModeNoneTouch: "No interaction (a finger scrolls the page)",
249
+ viewerMermaidModeZoomTouch: "Zoom only (two fingers)",
250
+ viewerMermaidModePanTouch: "Pan only (one-finger drag while the diagram overflows)",
251
+ viewerMermaidModeBothTouch: "Zoom and pan (two fingers, one finger while the diagram overflows)",
252
+ viewerMermaidZoomIn: "Zoom In",
253
+ viewerMermaidZoomOut: "Zoom Out",
254
+ viewerMermaidResetView: "Reset View",
255
+ viewerMermaidPanUp: "Pan Up",
256
+ viewerMermaidPanDown: "Pan Down",
257
+ viewerMermaidPanLeft: "Pan Left",
258
+ viewerMermaidPanRight: "Pan Right",
259
+ viewerMermaidDiagram: "Diagram (arrow keys pan, + and - zoom, 0 resets)",
260
+ viewerMermaidRetry: "Try again",
261
+ viewerEmbeddedVideo: "embedded video",
262
+ viewerEmbeddedPost: "embedded post",
263
+ viewerEmbeddedFrame: "Embedded content",
264
+ viewerBlockFailed: "This block could not be shown.",
265
+ viewerSvgImageToolbar: "SVG image",
266
+ viewerSvgImageSource: "Source",
267
+ viewerSvgImageSourceRegion: "Source of {name}",
268
+ viewerSvgImageLoading: "Loading the source…",
269
+ viewerSvgImageFailed: "The source could not be read.",
270
+ viewerSvgImageRetry: "Try again",
271
+ viewerSvgImageTruncated: "Only the beginning of this file is shown.",
272
+ viewerSvgImageCopy: "Copy the source",
273
+ viewerSvgImageCopied: "Copied the source.",
274
+ viewerSvgImageCopyFailed: "Could not copy the source.",
275
+ multiRegion: "Panels",
276
+ multiEmpty: "Select documents in the explorer to open them side by side.",
277
+ panelLimit: (e) => `You can open up to ${String(e)} panels at once.`,
278
+ panelOpened: (e) => `Opened ${e}`,
279
+ panelClosed: (e) => `Closed ${e}`,
280
+ panelAlreadyOpen: (e) => `${e} is already open`,
281
+ panelHidden: (e) => `Hid ${e}`,
282
+ panelShown: (e) => `Showed ${e}`,
283
+ panelMaximized: (e) => `Maximized ${e}`,
284
+ panelRestored: (e) => `Restored ${e} to its size`,
285
+ panelHide: "Hide the panel",
286
+ panelMaximize: "Maximize the panel",
287
+ panelRestore: "Restore the panel to its size",
288
+ panelClose: "Close the panel",
289
+ panelSwitchToCustomDrag: "Switch to the custom drag mode",
290
+ panelSwitchToNormalDrag: "Back to the normal drag mode",
291
+ panelCustomDragBadge: "Custom",
292
+ panelMove: "Move the panel",
293
+ panelMovePreviousColumn: "Move to the previous column",
294
+ panelMoveNextColumn: "Move to the next column",
295
+ panelMoveUp: "Move up",
296
+ panelMoveDown: "Move down",
297
+ panelMoved: "Moved {title} to column {column}, position {position}",
298
+ panelMoveUnavailable: "{move} is not available for {title}",
299
+ panelDragStarted: "Picked up {title}",
300
+ panelDragCancelled: "Kept {title} where it was",
301
+ hiddenPanelsTitle: "Hidden panels:",
302
+ hiddenPanelBadge: "Hidden",
303
+ hiddenPanelNotice: "This panel is hidden",
304
+ multiColumnEmpty: "This column is empty",
305
+ multiColumnRegion: "Column {column}",
306
+ panelDropHere: "Drop the panel here"
307
+ }, po = {
308
+ ...Cn("ja"),
309
+ explorerRegion: "エクスプローラー",
310
+ sourceLabel: "ソース",
311
+ refreshTreeLabel: "ツリーを更新",
312
+ refreshTree: "ソースからツリーと開いている文書を読み込み直す",
313
+ treeRefreshed: "ツリーをソースから読み込み直しました",
314
+ treeRefreshFailed: (e) => `ツリーを読み込み直せませんでした: ${e}`,
315
+ refreshDocumentLabel: "文書を更新",
316
+ refreshDocument: "ソースから文書を読み込み直す",
317
+ refreshDocumentNamed: (e) => `${e} を更新`,
318
+ documentRefreshed: (e) => `${e} を読み込み直しました`,
319
+ documentRefreshFailed: (e) => `文書を読み込み直せませんでした: ${e}`,
320
+ showMarkupLabel: "ソース",
321
+ showMarkup: "文書の Markdown を書いたまま表示",
322
+ showSvgMarkup: "画像の SVG を書いたまま表示",
323
+ showSpreadsheetMarkup: (e) => `表の ${e} を書いたまま表示`,
324
+ showMarkupNamed: (e) => `${e} のソース`,
325
+ editDocumentLabel: "編集",
326
+ editDocument: "文書の Markdown を編集 (文書のダブルクリックでも)",
327
+ editDocumentNamed: (e) => `${e} を編集`,
328
+ editDraftDocument: "文書の Markdown を保存せずに編集し、プレビューで確かめる (文書のダブルクリックでも)",
329
+ editDraftDocumentNamed: (e) => `${e} を保存せずに編集`,
330
+ editExternallyLabel: "元のエディタで開く",
331
+ editExternally: "文書を元のエディタで、新しいタブに開く",
332
+ editExternallyNamed: (e) => `${e} を元のエディタで開く`,
333
+ editorRegion: (e) => `${e} を編集中`,
334
+ editorLabel: (e) => `${e} の Markdown`,
335
+ editLoading: "編集のためにソースを読み込み中…",
336
+ editToolbar: "エディタ",
337
+ saveDraft: "保存",
338
+ saveDraftTooltip: "下書きを保存 (Ctrl+S、Mac は ⌘S)",
339
+ closeEditor: "編集を閉じる",
340
+ editView: "表示",
341
+ editViewNamed: (e) => `${e} の表示`,
342
+ editViewEditor: "エディタ",
343
+ editViewEditorTooltip: "エディタを表示 (Ctrl+E、Mac は ⌘E でプレビューと切り替え)",
344
+ editViewSplit: "並べて表示",
345
+ editViewSplitTooltip: "エディタとプレビューを並べて表示",
346
+ editViewSplitResize: "エディタとプレビューの割合を変更",
347
+ editViewPreview: "プレビュー",
348
+ editViewPreviewTooltip: "プレビューを表示 (Ctrl+E、Mac は ⌘E でエディタと切り替え)",
349
+ historyOpen: "履歴",
350
+ draftUnsaved: "保存していない変更があります",
351
+ draftStatus: "保存しない下書き",
352
+ draftNotSaved: "この下書きは保存しません。ここでは文書を保存できません。",
353
+ draftSaving: "保存中…",
354
+ draftSaved: "保存しました",
355
+ draftSavedMerged: "ほかで保存された変更と統合して保存しました",
356
+ draftConflicts: (e) => `ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,
357
+ draftSaveFailed: (e) => `保存できませんでした: ${e}`,
358
+ documentSaved: (e) => `${e} を保存しました`,
359
+ documentSavedMerged: (e) => `${e} を、ほかで保存された変更と統合して保存しました`,
360
+ conflictOurs: "あなたの下書き",
361
+ conflictTheirs: "ほかで保存された版",
362
+ conflictUseOurs: "自分の行を使う",
363
+ conflictUseTheirs: "保存された行を使う",
364
+ conflictKeepBoth: "両方を残す",
365
+ conflictNext: "次の衝突へ",
366
+ editGrantTitle: "編集には許可が必要です",
367
+ editGrantBody: "このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",
368
+ editGrantAction: "許可する",
369
+ editGrantRetry: "もう一度試す",
370
+ unsavedTitle: "保存していない変更を破棄しますか?",
371
+ unsavedBody: (e) => `${e} に保存していない変更があります。`,
372
+ unsavedDiscard: "変更を破棄",
373
+ draftDiscardTitle: "下書きを破棄しますか?",
374
+ draftDiscardBody: (e) => `${e} への変更はどこにも保存されず、失われます。`,
375
+ unsavedStay: "編集を続ける",
376
+ historyTitle: (e) => `${e} の版`,
377
+ historyLoading: "版の一覧を読み込み中…",
378
+ historyEmpty: "この文書の版は残っていません。",
379
+ historyCurrent: "現在の版",
380
+ historyKept: "保持",
381
+ historyEntry: (e, t) => t === "" ? e : `${e} (${t})`,
382
+ historyRestore: "下書きに戻す",
383
+ historyClose: "閉じる",
384
+ historyRestored: (e) => `${e} の下書きに版を戻しました。残すには保存してください`,
385
+ previewRegion: "プレビュー",
386
+ previewUpdating: "プレビューを更新中…",
387
+ previewFailed: (e) => `プレビューできませんでした: ${e}`,
388
+ previewTablePending: "プレビューが下書きを描くと、この表を編集できます。",
389
+ expandAll: "すべてのフォルダーを展開",
390
+ collapseAll: "すべてのフォルダーを折りたたむ",
391
+ treeSettings: "ツリーの設定",
392
+ switchToMulti: "マルチビューで開く",
393
+ switchToTree: "ツリービューで開く",
394
+ resizeExplorer: "エクスプローラーの幅を変更",
395
+ showExplorer: "エクスプローラーを開く",
396
+ hideExplorer: "エクスプローラーを閉じる",
397
+ treeRegion: "文書の一覧",
398
+ treeLoading: "ツリーを読み込み中…",
399
+ treeEmptyTitle: "表示できるファイルがありません",
400
+ treeEmptyBody: "このソースには開ける文書がありません。",
401
+ folderLoadFailed: "このフォルダーを読み込めませんでした。",
402
+ loopFolderName: (e) => `${e} (上の階層で開いています)`,
403
+ foldersLoadFailedNamed: (e) => `${new Intl.ListFormat("ja", { type: "conjunction" }).format(e)} を読み込めませんでした`,
404
+ foldersLoading: (e) => `フォルダーを ${String(e)} 件読み込み中…`,
405
+ expandAllStarted: "すべてのフォルダーを展開しています…",
406
+ expandAllProgress: (e, t) => `すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,
407
+ expandAllDone: (e, t, n) => {
408
+ const r = `${String(e)} 件のフォルダーを展開しました`;
409
+ return t > 0 ? `${r}。うち ${String(t)} 件は読み込めませんでした` : n ? e === 0 ? "すべてのフォルダーが既に開いています" : `${r}。すべてのフォルダーが開いています` : r;
410
+ },
411
+ expandAllFolderLimit: (e, t, n) => `${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,
412
+ expandAllDepthLimit: (e, t) => `${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,
413
+ treeEntryKindDirectory: "ディレクトリ",
414
+ treeEntryKindFile: "ファイル",
415
+ treeScrollUp: "上へスクロール",
416
+ treeScrollDown: "下へスクロール",
417
+ treeScrollToTop: "先頭へ",
418
+ treeScrollToBottom: "末尾へ",
419
+ selectionTitle: (e) => `選択中 (${String(e)})`,
420
+ clearSelection: "選択を解除",
421
+ openSelectionInMulti: (e) => `${String(e)} 件をパネルで開く`,
422
+ removeFromSelection: (e) => `${e} を選択から外す`,
423
+ settingSortMode: "並び順",
424
+ sortNative: "取得順",
425
+ sortAscending: "名前の昇順",
426
+ sortDescending: "名前の降順",
427
+ sortOldest: "更新日時の昇順 (古い順)",
428
+ sortNewest: "更新日時の降順 (新しい順)",
429
+ settingFolderPlacement: "フォルダーの位置",
430
+ folderPlacementMixed: "混ぜる",
431
+ folderPlacementFirst: "先に",
432
+ folderPlacementLast: "後に",
433
+ settingReadmePlacement: "README の位置",
434
+ readmePlacementMixed: "混ぜる",
435
+ readmePlacementFirst: "先に",
436
+ readmePlacementLast: "後に",
437
+ settingSelectionMode: "選択",
438
+ selectionSingle: "1 件",
439
+ selectionMultiple: "複数",
440
+ selectionNone: "オフ",
441
+ settingDoubleClick: "ダブルクリック",
442
+ doubleClickRecursive: "下の階層まで展開",
443
+ doubleClickToggle: "開閉",
444
+ settingExpandIconSize: "展開アイコンの大きさ",
445
+ expandIconSizeValue: (e) => `${String(e)} px`,
446
+ settingAlwaysExpanded: "常に展開",
447
+ settingRevealDocument: "開いた文書をツリーで表示",
448
+ settingRemoveRootIndent: "最上位の字下げなし",
449
+ settingTreeLines: "ツリーの線",
450
+ settingExpandIcons: "展開アイコン",
451
+ settingDirectoryIcons: "フォルダーのアイコン",
452
+ settingFileIcons: "ファイルのアイコン",
453
+ settingOn: "オン",
454
+ settingOff: "オフ",
455
+ settingAnnouncement: (e, t) => `${e}: ${t}`,
456
+ documentRegion: "文書",
457
+ documentEmpty: "エクスプローラーで文書を選んでください。",
458
+ folderReadmeMissing: (e) => `${e} には README がありません。`,
459
+ documentLoading: "文書を読み込み中…",
460
+ markupLoading: "ソースを読み込み中…",
461
+ spreadsheetLoading: "表を読み込み中…",
462
+ documentShown: (e) => `${e} を表示しています`,
463
+ documentFailed: (e, t) => `${e}: ${t}`,
464
+ announcementSequence: (e) => e.map((t) => /[。!?]$/u.test(t) ? t : `${t}。`).join(""),
465
+ textTruncated: "このファイルは先頭だけを表示しています。",
466
+ inertLink: "リンク先がソースの外にあるため開けません。",
467
+ failureUnauthorizedTitle: "セッションの有効期限が切れました",
468
+ failureUnauthorizedBody: "ページを再読み込みして、もう一度サインインしてください。",
469
+ failureForbiddenTitle: "アクセスが許可されていません",
470
+ failureForbiddenBody: "これを開く権限がありません。",
471
+ failureNotFoundTitle: "見つかりません",
472
+ failureNotFoundBody: "移動または削除された可能性があります。",
473
+ failureNotConfiguredTitle: "このソースは設定されていません",
474
+ failureNotConfiguredBody: "管理者に設定を依頼してください。",
475
+ failureInvalidTitle: "アドレスが正しくありません",
476
+ failureInvalidBody: "このアドレスに含まれる文書の経路は使えません。",
477
+ failureTooLargeTitle: "大きすぎて表示できません",
478
+ failureTooLargeBody: "このファイルは表示できる大きさを超えています。",
479
+ failureUnsupportedTitle: "表示できない形式です",
480
+ failureUnsupportedBody: "この種類のファイルはここでは表示できません。",
481
+ failureFailedTitle: "読み込みに失敗しました",
482
+ failureFailedBody: "しばらくしてからもう一度お試しください。",
483
+ retry: "再試行",
484
+ reloadPage: "ページを再読み込み",
485
+ imageZoomIn: "拡大",
486
+ imageZoomOut: "縮小",
487
+ imageFit: "画面に合わせる",
488
+ imageFitLevel: "全体",
489
+ imageZoomLevel: (e) => `${String(e)}%`,
490
+ openInNewTab: "新しいタブで開く",
491
+ download: "ダウンロード",
492
+ copyText: "テキストをコピー",
493
+ copiedText: "テキストをコピーしました",
494
+ copyTextFailed: "テキストをコピーできませんでした",
495
+ mediaUnsupported: "このブラウザではこのファイルを再生できません。",
496
+ fileNotShown: "このファイルはここでは表示できません。ダウンロードして開いてください。",
497
+ pdfNotShown: "このブラウザはページの中に PDF を表示しません。新しいタブで開くか、ダウンロードしてください。",
498
+ spreadsheetFirstSheetOnly: "このスプレッドシートは最初のシートだけを表示しています。",
499
+ spreadsheetTruncated: "表はこのファイルの一部だけを表示しています。全体はダウンロードして開いてください。",
500
+ spreadsheetUnreadableEncoding: ([e, t]) => t === void 0 ? `このファイルの文字は ${e} ではないため、表として表示できません。ダウンロードして開いてください。` : `このファイルの文字は ${e} でも ${t} でもないため、表として表示できません。ダウンロードして開いてください。`,
501
+ spreadsheetEmpty: "このファイルにはデータがありません。",
502
+ spreadsheetNotText: "このファイルは文字のファイルではないため、表として表示できません。ダウンロードして開いてください。",
503
+ spreadsheetLongRow: "プレビューに読む範囲の中でこのファイルの行が 1 つも終わらないため、表として表示できません。ダウンロードして開いてください。",
504
+ spreadsheetFullscreen: (e) => `${e} (全画面)`,
505
+ viewerLoading: "データを読み込み中...",
506
+ viewerErrorPrefix: "エラー: ",
507
+ viewerStyleTitle: "表示スタイル",
508
+ viewerSelectStyle: "表示スタイルを選択",
509
+ viewerPinStyle: "スタイル選択をピン留め",
510
+ viewerUnpinStyle: "スタイル選択のピン留めを解除",
511
+ viewerErrorTitle: "エラーが発生しました",
512
+ viewerMissingImage: "画像が見つかりません",
513
+ viewerOpenToc: "目次を開く",
514
+ viewerTocTitle: "目次",
515
+ viewerPinToc: "目次をピン留め",
516
+ viewerUnpinToc: "目次のピン留めを解除",
517
+ viewerSelectAlign: "揃えを選択",
518
+ viewerAlignTitle: "揃え",
519
+ viewerPinAlign: "揃え選択をピン留め",
520
+ viewerUnpinAlign: "揃え選択のピン留めを解除",
521
+ viewerAlignLeft: "左揃え",
522
+ viewerAlignCenter: "中央揃え",
523
+ viewerAlignRight: "右揃え",
524
+ viewerMermaidInteractionMode: "マウス操作モード",
525
+ viewerMermaidInteractionModeTouch: "タッチ操作モード",
526
+ viewerMermaidModeNone: "操作なし",
527
+ viewerMermaidModeZoom: "拡大縮小のみ",
528
+ viewerMermaidModePan: "移動のみ (左ドラッグ)",
529
+ viewerMermaidModePanShift: "移動のみ (Shift+ドラッグ)",
530
+ viewerMermaidModeBoth: "拡大縮小+移動 (左ドラッグ)",
531
+ viewerMermaidModeBothShift: "拡大縮小+移動 (Shift+ドラッグ)",
532
+ viewerMermaidModeNoneTouch: "操作なし (指はページをスクロール)",
533
+ viewerMermaidModeZoomTouch: "拡大縮小のみ (2 本指)",
534
+ viewerMermaidModePanTouch: "移動のみ (はみ出す図を 1 本指でドラッグ)",
535
+ viewerMermaidModeBothTouch: "拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",
536
+ viewerMermaidZoomIn: "拡大",
537
+ viewerMermaidZoomOut: "縮小",
538
+ viewerMermaidResetView: "表示を元に戻す",
539
+ viewerMermaidPanUp: "上へ移動",
540
+ viewerMermaidPanDown: "下へ移動",
541
+ viewerMermaidPanLeft: "左へ移動",
542
+ viewerMermaidPanRight: "右へ移動",
543
+ viewerMermaidDiagram: "図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",
544
+ viewerMermaidRetry: "再試行",
545
+ viewerEmbeddedVideo: "埋め込みの動画",
546
+ viewerEmbeddedPost: "埋め込みの投稿",
547
+ viewerEmbeddedFrame: "埋め込みのコンテンツ",
548
+ viewerBlockFailed: "このブロックを表示できませんでした。",
549
+ viewerSvgImageToolbar: "SVG の画像",
550
+ viewerSvgImageSource: "ソース",
551
+ viewerSvgImageSourceRegion: "{name} のソース",
552
+ viewerSvgImageLoading: "ソースを読み込み中…",
553
+ viewerSvgImageFailed: "ソースを読み込めませんでした。",
554
+ viewerSvgImageRetry: "再試行",
555
+ viewerSvgImageTruncated: "このファイルは先頭だけを表示しています。",
556
+ viewerSvgImageCopy: "ソースをコピー",
557
+ viewerSvgImageCopied: "ソースをコピーしました。",
558
+ viewerSvgImageCopyFailed: "ソースをコピーできませんでした。",
559
+ multiRegion: "パネル",
560
+ multiEmpty: "エクスプローラーで文書を選ぶと、ここに並べて開きます。",
561
+ panelLimit: (e) => `同時に開けるのは ${String(e)} パネルまでです。`,
562
+ panelOpened: (e) => `${e} を開きました`,
563
+ panelClosed: (e) => `${e} を閉じました`,
564
+ panelAlreadyOpen: (e) => `${e} は既に開いています`,
565
+ panelHidden: (e) => `${e} を隠しました`,
566
+ panelShown: (e) => `${e} を表示しました`,
567
+ panelMaximized: (e) => `${e} を最大化しました`,
568
+ panelRestored: (e) => `${e} を元のサイズに戻しました`,
569
+ panelHide: "パネルを隠す",
570
+ panelMaximize: "パネルを最大化",
571
+ panelRestore: "パネルを元のサイズに戻す",
572
+ panelClose: "パネルを閉じる",
573
+ panelSwitchToCustomDrag: "カスタムのドラッグの方式に切り替え",
574
+ panelSwitchToNormalDrag: "通常のドラッグの方式に戻す",
575
+ panelCustomDragBadge: "カスタム",
576
+ panelMove: "パネルを移動",
577
+ panelMovePreviousColumn: "前の列へ移動",
578
+ panelMoveNextColumn: "次の列へ移動",
579
+ panelMoveUp: "上へ移動",
580
+ panelMoveDown: "下へ移動",
581
+ panelMoved: "{title} を {column} 列目の {position} 番目へ移動しました",
582
+ panelMoveUnavailable: "{title} は「{move}」できません",
583
+ panelDragStarted: "{title} を持ち上げました",
584
+ panelDragCancelled: "{title} の移動を取り消しました",
585
+ hiddenPanelsTitle: "隠したパネル:",
586
+ hiddenPanelBadge: "非表示",
587
+ hiddenPanelNotice: "このパネルは隠しています",
588
+ multiColumnEmpty: "この列は空です",
589
+ multiColumnRegion: "{column} 列目",
590
+ panelDropHere: "ここへパネルをドロップ"
591
+ }, wo = Object.freeze({
592
+ en: Object.freeze(Mn),
593
+ ja: Object.freeze(po)
594
+ }), Ln = Object.freeze(Object.keys(Mn)), go = new Set(Ln), vo = (e) => go.has(e), Fe = (e) => e === null ? "null" : typeof e == "string" ? JSON.stringify(e.length > 40 ? `${e.slice(0, 40)}…` : e) : typeof e == "function" ? "a function" : Array.isArray(e) ? "an array" : typeof e, An = (e) => {
595
+ if (e === void 0) return fo;
596
+ if (jt.includes(e)) return e;
597
+ throw new RangeError(`[markdown-explorer] locale is the UI language (${jt.map((t) => JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${Fe(e)}`);
598
+ }, zt = (e, t) => {
599
+ const n = wo[An(e)];
600
+ if (t === void 0) return n;
601
+ if (t === null || typeof t != "object")
602
+ throw new RangeError(`[markdown-explorer] labels must be an object; got ${Fe(t)}`);
603
+ if (!Rr(t))
604
+ throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${Fe(t)}`);
605
+ const r = t, o = { ...n };
606
+ for (const i of Object.keys(r)) {
607
+ if (!vo(i))
608
+ throw new RangeError(`[markdown-explorer] labels.${i} is not a known label key; expected one of ${Ln.join(", ")}`);
609
+ const a = r[i];
610
+ if (a === void 0) continue;
611
+ const c = typeof n[i];
612
+ if (typeof a !== c)
613
+ throw new TypeError(`[markdown-explorer] labels.${i} must be a ${c}; got ${Fe(a)}`);
614
+ if (typeof a == "string" && a.trim() === "")
615
+ throw new RangeError(`[markdown-explorer] labels.${i} must be a non-blank string`);
616
+ const f = mo[i];
617
+ if (typeof a == "string" && f !== void 0) {
618
+ for (const [, w] of a.matchAll(ho))
619
+ if (!f.includes(w ?? ""))
620
+ throw new RangeError(`[markdown-explorer] labels.${i} uses the unknown placeholder {${String(w)}}; it accepts ${f.map((l) => `{${l}}`).join(", ")}`);
621
+ }
622
+ o[i] = a;
623
+ }
624
+ return Object.freeze(o);
625
+ }, bo = (e, t) => {
626
+ if (Object.is(e, t)) return !0;
627
+ if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
628
+ const n = e, r = t, o = Object.keys(n), i = Object.keys(r);
629
+ return o.length === i.length && i.every((a) => Object.hasOwn(n, a) && Object.is(n[a], r[a]));
630
+ }, Vt = Object.freeze(["light", "dark"]), Eo = (e) => {
631
+ if (e === void 0) return "light";
632
+ if (Vt.includes(e)) return e;
633
+ throw new RangeError(`[markdown-explorer] theme must be ${Vt.map((t) => JSON.stringify(t)).join(" or ")}; got ${typeof e == "string" ? JSON.stringify(e) : typeof e}`);
634
+ }, Nn = he(null), F = () => {
635
+ const e = oe(Nn);
636
+ if (e === null) throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");
637
+ return e;
638
+ }, _e = (e) => {
639
+ const { viewSettings: t } = F(), n = () => e(t.getSnapshot());
640
+ return re(t.subscribe, n, n);
641
+ }, bt = () => {
642
+ const { config: e } = F(), t = br()["*"], [n] = Er(), r = n.toString();
643
+ return Y(() => Sn(e, t, new URLSearchParams(r)), [e, t, r]);
644
+ }, Dn = {
645
+ unauthorized: ["failureUnauthorizedTitle", "failureUnauthorizedBody"],
646
+ forbidden: ["failureForbiddenTitle", "failureForbiddenBody"],
647
+ "not-found": ["failureNotFoundTitle", "failureNotFoundBody"],
648
+ "not-configured": ["failureNotConfiguredTitle", "failureNotConfiguredBody"],
649
+ invalid: ["failureInvalidTitle", "failureInvalidBody"],
650
+ "too-large": ["failureTooLargeTitle", "failureTooLargeBody"],
651
+ unsupported: ["failureUnsupportedTitle", "failureUnsupportedBody"],
652
+ failed: ["failureFailedTitle", "failureFailedBody"]
653
+ }, le = (e, t) => e[Dn[t][0]], Te = ({ failure: e, alert: t, onRetry: n, testId: r }) => {
654
+ const { labels: o } = F(), i = le(o, e.reason), a = o[Dn[e.reason][1]], c = e.reason === "unauthorized" || e.reason === "forbidden" || e.reason === "failed" ? "danger" : "warning";
655
+ return /* @__PURE__ */ H("div", { className: "aqmx-callout", role: t ? "alert" : void 0, "data-aqmx-tone": c, "data-testid": r === null ? void 0 : r, "data-aqmx-failure": r === null ? void 0 : e.reason, children: [
656
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-title", children: i }),
657
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: a }),
658
+ e.reason === "unauthorized" ? /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", onClick: () => window.location.reload(), children: o.reloadPage }) : n !== void 0 && e.reason === "failed" ? /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", onClick: n, children: o.retry }) : null
659
+ ] });
660
+ }, yo = (e, t) => {
661
+ const { phase: n, save: r, dirty: o } = t;
662
+ switch (n.kind) {
663
+ case "opening":
664
+ return e.editLoading;
665
+ case "grant":
666
+ return e.editGrantTitle;
667
+ case "failed":
668
+ return le(e, n.failure.reason);
669
+ }
670
+ switch (r.kind) {
671
+ case "draft":
672
+ return e.draftStatus;
673
+ case "saving":
674
+ return e.draftSaving;
675
+ case "conflicts":
676
+ return e.draftConflicts(r.count);
677
+ case "grant":
678
+ return e.editGrantTitle;
679
+ case "failed":
680
+ return e.draftSaveFailed(le(e, r.failure.reason));
681
+ case "saved":
682
+ if (!o) return r.merged ? e.draftSavedMerged : e.draftSaved;
683
+ break;
684
+ }
685
+ return o ? e.draftUnsaved : "";
686
+ }, So = (e, t, n) => {
687
+ switch (t.kind) {
688
+ case "draft":
689
+ return e.draftNotSaved;
690
+ case "saved":
691
+ return t.merged ? e.documentSavedMerged(n) : e.documentSaved(n);
692
+ case "conflicts":
693
+ return e.draftConflicts(t.count);
694
+ case "grant":
695
+ return e.editGrantTitle;
696
+ case "failed":
697
+ return e.draftSaveFailed(le(e, t.failure.reason));
698
+ case "idle":
699
+ case "saving":
700
+ return null;
701
+ }
702
+ }, Ce = () => {
703
+ const e = /* @__PURE__ */ new Set();
704
+ return {
705
+ subscribe: (t) => (e.add(t), () => {
706
+ e.delete(t);
707
+ }),
708
+ emit: () => {
709
+ for (const t of [...e]) t();
710
+ }
711
+ };
712
+ }, ko = "<<<<<<<", xo = "=======", To = ">>>>>>>", Ut = (e, t) => e === t || e.startsWith(`${t} `), Zt = (e) => Ro(e.split(`
713
+ `)), Ro = (e) => {
714
+ const t = [];
715
+ let n = null, r = null, o = 0;
716
+ for (const i of e) {
717
+ o += 1;
718
+ const a = i.charCodeAt(0);
719
+ a !== 60 && a !== 61 && a !== 62 || (Ut(i, ko) ? (n = o, r = null) : i === xo ? n !== null && r === null ? r = o : n = null : Ut(i, To) && (n !== null && r !== null && t.push({ start: n, separator: r, end: o }), n = null, r = null));
720
+ }
721
+ return t;
722
+ }, Gt = (e) => e.includes(`\r
723
+ `) ? `\r
724
+ ` : `
725
+ `, Qe = (e) => e.replace(/\r\n?/gu, `
726
+ `), Oo = (e, t) => t === `
727
+ ` ? e : e.replaceAll(`
728
+ `, `\r
729
+ `), Co = 3, Mo = /^\d+(?:\.\d+)?$/u, Lo = (e) => {
730
+ if (e === null || !Mo.test(e)) return null;
731
+ const t = Number(e);
732
+ return t >= xn && t <= kn ? t : null;
733
+ }, et = Object.freeze({ kind: "idle" }), Wt = Object.freeze({ kind: "draft" }), Ao = ({ data: e, conflictLabels: t, onSaveSettled: n, sideBySideSetting: r, editorShareSetting: o }) => {
734
+ const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), l = Ce();
735
+ let u = null, p = null, g = null;
736
+ const b = (d, m) => {
737
+ d.value = { ...d.value, ...m }, l.emit();
738
+ }, x = (d, m) => i.get(d) === m, R = async (d, m) => {
739
+ m.controller.abort(), m.controller = new AbortController();
740
+ const { signal: k } = m.controller;
741
+ b(m, { phase: { kind: "opening" } });
742
+ const M = await e.edit(d, k);
743
+ if (!x(d, m) || k.aborted || !("kind" in M)) return;
744
+ if (M.kind === "grant") {
745
+ b(m, { phase: { kind: "grant", href: M.href } });
746
+ return;
747
+ }
748
+ if (M.kind === "failure") {
749
+ b(m, { phase: { kind: "failed", failure: M.failure } });
750
+ return;
751
+ }
752
+ const $ = Qe(M.text), q = M.kind === "draft";
753
+ m.base = { text: $, version: q ? null : M.version }, m.draft = $, m.ending = Gt(M.text), b(m, { phase: { kind: "editing" }, history: q ? !1 : M.history, dirty: !1, save: q ? Wt : et, generation: m.value.generation + 1 });
754
+ }, A = (d) => {
755
+ const m = i.get(d);
756
+ m !== void 0 && (m.controller.abort(), i.delete(d), c.delete(d));
757
+ }, N = (d, m, k) => (d.set(m, k), () => {
758
+ d.get(m) === k && d.delete(m);
759
+ }), _ = (d, m, k, M = {}) => {
760
+ b(m, { ...M, save: k }), n(d, k);
761
+ }, D = async (d) => {
762
+ f.get(d)?.flush();
763
+ const m = i.get(d);
764
+ if (m === void 0 || m.value.phase.kind !== "editing" || m.base === null || m.value.save.kind === "saving") return;
765
+ const { version: k } = m.base;
766
+ if (k === null) {
767
+ n(d, Wt);
768
+ return;
769
+ }
770
+ const M = Zt(m.draft).length;
771
+ if (M > 0) {
772
+ _(d, m, { kind: "conflicts", count: M });
773
+ return;
774
+ }
775
+ m.controller.abort(), m.controller = new AbortController();
776
+ const { signal: $ } = m.controller;
777
+ let q = { text: m.base.text, version: k }, v = m.draft, T = !1;
778
+ b(m, { save: { kind: "saving" } });
779
+ for (let L = 0; L < Co; L += 1) {
780
+ const O = await e.save(d, q.version, Oo(v, m.ending), $);
781
+ if (!x(d, m) || $.aborted || !("kind" in O)) return;
782
+ if (O.kind === "saved") {
783
+ f.get(d)?.flush(), m.base = { text: v, version: O.version }, _(d, m, { kind: "saved", merged: T }, { dirty: m.draft !== v });
784
+ return;
785
+ }
786
+ if (O.kind === "grant") {
787
+ _(d, m, { kind: "grant", href: O.href });
788
+ return;
789
+ }
790
+ if (O.kind === "failure") {
791
+ _(d, m, { kind: "failed", failure: O.failure });
792
+ return;
793
+ }
794
+ const { mergeDraft: P } = await import("./merge-DqjUgcV_.js");
795
+ if (!x(d, m) || $.aborted) return;
796
+ const j = f.get(d);
797
+ j?.flush();
798
+ const X = Qe(O.text), h = P(q.text, m.draft, X, t());
799
+ if (q = { text: X, version: O.version }, m.base = q, m.ending = Gt(O.text), m.draft = h.text, j?.adopt(h.text), h.kind === "conflicts") {
800
+ _(d, m, { kind: "conflicts", count: h.conflicts }, { dirty: !0, generation: m.value.generation + 1 });
801
+ return;
802
+ }
803
+ if (T = !0, v = h.text, v === q.text) {
804
+ _(d, m, { kind: "saved", merged: T }, { dirty: !1, generation: m.value.generation + 1 });
805
+ return;
806
+ }
807
+ b(m, { dirty: !0, generation: m.value.generation + 1 });
808
+ }
809
+ _(d, m, { kind: "failed", failure: { reason: "failed" } });
810
+ };
811
+ return {
812
+ session: (d) => i.get(d)?.value,
813
+ subscribe: l.subscribe,
814
+ start: (d, m) => {
815
+ const k = i.get(d);
816
+ if (k !== void 0) {
817
+ b(k, { request: { anchor: m }, view: "editor" }), (k.value.phase.kind === "failed" || k.value.phase.kind === "grant") && R(d, k);
818
+ return;
819
+ }
820
+ a.delete(d);
821
+ const M = {
822
+ value: { path: d, phase: { kind: "opening" }, view: "editor", previewPrepared: !1, history: !1, dirty: !1, save: et, generation: 0, request: { anchor: m } },
823
+ base: null,
824
+ draft: "",
825
+ ending: `
826
+ `,
827
+ controller: new AbortController()
828
+ };
829
+ i.set(d, M), R(d, M);
830
+ },
831
+ retry: (d) => {
832
+ const m = i.get(d);
833
+ m === void 0 || m.value.phase.kind === "editing" || R(d, m);
834
+ },
835
+ draft: (d) => {
836
+ const m = i.get(d);
837
+ return m === void 0 || m.base === null ? null : m.draft;
838
+ },
839
+ setDraft: (d, m) => {
840
+ const k = i.get(d);
841
+ if (k === void 0 || k.base === null) return;
842
+ k.draft = m;
843
+ const M = {}, $ = m !== k.base.text;
844
+ $ !== k.value.dirty && (M.dirty = $);
845
+ const { save: q } = k.value;
846
+ if (q.kind === "conflicts") {
847
+ const v = Zt(m).length;
848
+ v === 0 ? M.save = et : v !== q.count && (M.save = { kind: "conflicts", count: v });
849
+ }
850
+ (M.dirty !== void 0 || M.save !== void 0) && b(k, M);
851
+ },
852
+ consumeRequest: (d) => {
853
+ const m = i.get(d);
854
+ m !== void 0 && m.value.request !== null && b(m, { request: null });
855
+ },
856
+ save: D,
857
+ replaceDraft: (d, m) => {
858
+ const k = f.get(d);
859
+ k?.flush();
860
+ const M = i.get(d);
861
+ if (M === void 0 || M.base === null) return;
862
+ const $ = Qe(m);
863
+ M.draft = $, k?.adopt($), b(M, { dirty: $ !== M.base.text, generation: M.value.generation + 1 });
864
+ },
865
+ close: (d) => {
866
+ if (!i.has(d)) return;
867
+ const m = f.get(d), k = m === void 0 ? null : m.returnPoint();
868
+ A(d), k === null ? a.delete(d) : a.set(d, k), l.emit();
869
+ },
870
+ takeReturn: (d) => {
871
+ const m = a.get(d) ?? null;
872
+ return a.delete(d), m;
873
+ },
874
+ dirtyPaths: () => [...i.values()].filter((d) => d.value.dirty).map((d) => d.value.path),
875
+ discard: (d) => {
876
+ for (const m of d) A(m);
877
+ d.length > 0 && l.emit();
878
+ },
879
+ editorState: {
880
+ get: (d) => c.get(d),
881
+ set: (d, m) => {
882
+ i.has(d) && c.set(d, m);
883
+ }
884
+ },
885
+ bindEditor: (d, m) => N(f, d, m),
886
+ bindView: (d, m) => N(w, d, m),
887
+ viewAnchor: (d) => {
888
+ const m = w.get(d);
889
+ return m === void 0 ? null : m.anchor();
890
+ },
891
+ flush: (d) => f.get(d)?.flush(),
892
+ flushDrafts: () => {
893
+ for (const d of f.values()) d.flush();
894
+ },
895
+ nextConflict: (d) => f.get(d)?.nextConflict() === !0,
896
+ hasSessions: () => i.size > 0,
897
+ unsavedAmong: (d) => {
898
+ for (const m of f.values()) m.flush();
899
+ return d.filter((m) => i.get(m)?.value.dirty === !0);
900
+ },
901
+ askToDiscard: (d) => new Promise((m) => {
902
+ g?.settle(!1);
903
+ const k = {
904
+ paths: d,
905
+ settle: (M) => {
906
+ if (g === k) {
907
+ if (g = null, M) for (const $ of d) A($);
908
+ l.emit(), m(M);
909
+ }
910
+ }
911
+ };
912
+ g = k, l.emit();
913
+ }),
914
+ discardRequest: () => g,
915
+ sideBySide: () => (u ??= r.read(), u),
916
+ setSideBySide: (d) => {
917
+ u !== d && (u = d, r.write(d), l.emit());
918
+ },
919
+ editorShare: () => (p ??= o.read() ?? Or, p),
920
+ setEditorShare: (d) => {
921
+ if (!Number.isFinite(d)) throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(d)}`);
922
+ const m = Math.min(kn, Math.max(xn, d));
923
+ p !== m && (p = m, o.write(m));
924
+ },
925
+ setView: (d, m) => {
926
+ const k = i.get(d);
927
+ k === void 0 || k.value.view === m || (f.get(d)?.beforeView(m), b(k, { view: m, previewPrepared: k.value.previewPrepared || m === "preview" }));
928
+ },
929
+ preparePreview: (d) => {
930
+ const m = i.get(d);
931
+ m !== void 0 && !m.value.previewPrepared && b(m, { previewPrepared: !0 });
932
+ }
933
+ };
934
+ }, Pn = (e) => {
935
+ e.preventDefault(), e.stopPropagation();
936
+ }, No = (e) => e.endsWith("px") ? Number.parseFloat(e) : Number.NaN, $n = "data-aqmx-content-pane", ut = Object.freeze({ [$n]: "" }), Do = "--aqmx-dialog-left", Po = "--aqmx-dialog-top", $o = '[data-testid="markdown-explorer"]', Fo = (e) => {
937
+ const t = e.closest($o)?.querySelectorAll(`[${$n}]`), n = t?.item(t.length - 1);
938
+ if (!(n instanceof HTMLElement)) throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");
939
+ return n;
940
+ }, qo = (e) => {
941
+ const t = No(getComputedStyle(e).marginTop);
942
+ if (Number.isNaN(t)) return null;
943
+ const n = Fo(e), r = e.getBoundingClientRect(), o = e.ownerDocument.documentElement, { left: i, top: a } = Cr(n.getBoundingClientRect(), { width: r.width + 2 * t, height: r.height + 2 * t }, { width: o.clientWidth, height: o.clientHeight });
944
+ return e.style.setProperty(Do, `${String(i)}px`), e.style.setProperty(Po, `${String(a)}px`), n;
945
+ }, Io = (e) => e.preventDefault(), Fn = ({ open: e, onOpen: t, onDismiss: n }) => {
946
+ const r = B(null), o = B(null), i = B(!1), a = B(t);
947
+ K(() => {
948
+ a.current = t;
949
+ }, [t]), K(() => {
950
+ i.current = e;
951
+ const l = r.current;
952
+ if (l !== null)
953
+ if (e && !l.open) {
954
+ const u = l.ownerDocument.activeElement;
955
+ o.current = u instanceof HTMLElement ? u : null, l.showModal(), a.current?.();
956
+ } else !e && l.open && (l.close(), o.current?.isConnected === !0 && o.current.focus(), o.current = null);
957
+ }, [e]), K(() => {
958
+ const l = r.current;
959
+ if (!e || l === null) return;
960
+ const u = new ResizeObserver(() => g());
961
+ let p = null;
962
+ const g = () => {
963
+ const x = qo(l);
964
+ x === null || x === p || (p !== null && u.unobserve(p), u.observe(x), p = x);
965
+ };
966
+ g(), u.observe(l);
967
+ const b = l.ownerDocument.defaultView;
968
+ return b?.addEventListener("resize", g), l.ownerDocument.addEventListener("scroll", g, { capture: !0, passive: !0 }), () => {
969
+ u.disconnect(), b?.removeEventListener("resize", g), l.ownerDocument.removeEventListener("scroll", g, { capture: !0 });
970
+ };
971
+ }, [e]);
972
+ const c = I(
973
+ (l) => {
974
+ l.key !== "Escape" || l.defaultPrevented || (Pn(l), n());
975
+ },
976
+ [n]
977
+ ), f = I(
978
+ (l) => {
979
+ l.target === l.currentTarget && n();
980
+ },
981
+ [n]
982
+ ), w = I(() => {
983
+ i.current && n();
984
+ }, [n]);
985
+ return { ref: r, onKeyDown: c, onClick: f, onCancel: Io, onClose: w };
986
+ }, qn = ({ open: e, title: t, body: n, confirmLabel: r, cancelLabel: o, onConfirm: i, onCancel: a, testId: c }) => {
987
+ const f = B(null), w = ke(), l = ke(), u = I(() => f.current?.focus(), []), p = Fn({ open: e, onOpen: u, onDismiss: a });
988
+ return /* @__PURE__ */ s("dialog", { ...p, className: "aqmx-confirm", "aria-labelledby": w, "aria-describedby": l, "data-testid": c, children: /* @__PURE__ */ H("div", { className: "aqmx-confirm-panel", children: [
989
+ /* @__PURE__ */ s("p", { id: w, className: "aqmx-confirm-title", children: t }),
990
+ /* @__PURE__ */ s("p", { id: l, className: "aqmx-confirm-body", children: n }),
991
+ /* @__PURE__ */ H("div", { className: "aqmx-confirm-actions", children: [
992
+ /* @__PURE__ */ s("button", { ref: f, type: "button", className: "aqmx-callout-action", "data-testid": `${c}-cancel`, onClick: a, children: o }),
993
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", "data-aqmx-tone": "danger", "data-testid": `${c}-confirm`, onClick: i, children: r })
994
+ ] })
995
+ ] }) });
996
+ }, Re = (e) => {
997
+ const t = e;
998
+ return t.status === void 0 && (t.status = "pending", e.then(
999
+ (n) => {
1000
+ t.status = "fulfilled", t.value = n;
1001
+ },
1002
+ (n) => {
1003
+ t.status = "rejected", t.reason = n;
1004
+ }
1005
+ )), t;
1006
+ }, In = (e) => Object.assign(Promise.resolve(e), { status: "fulfilled", value: e }), Ee = (e) => e.status === "fulfilled" ? e.value : void 0, _o = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !1 }), Bo = Object.freeze({ readme: Object.freeze({ status: "loading" }), claim: !0 }), Ho = (e, t, n) => {
1007
+ const r = /* @__PURE__ */ new Set(), o = [...e].reverse();
1008
+ for (let i = o.pop(); i !== void 0; i = o.pop()) {
1009
+ if (i.type !== "directory" || r.has(i.path)) continue;
1010
+ r.add(i.path);
1011
+ const a = i.lazy === !0 ? n(i.path) : void 0, c = i.lazy === !0 ? a?.status === "loaded" ? a.entries : null : i.children === void 0 ? [] : i.children;
1012
+ if (i.path === t) return c;
1013
+ if (c !== null) for (const f of [...c].reverse()) o.push(f);
1014
+ }
1015
+ return null;
1016
+ }, jo = (e, t, n) => {
1017
+ const r = Ee(e.read(t));
1018
+ if (r === void 0 || r.status === "deferred") return _o;
1019
+ if (r.status === "error") return { readme: { status: "failed", failure: r.failure, retry: () => e.retry(t) }, claim: !1 };
1020
+ const o = Ho(r.entries, n, (a) => e.children(t, a));
1021
+ if (o !== null) return { readme: { status: "ok", readme: Dt(o) }, claim: !1 };
1022
+ const i = e.children(t, n);
1023
+ return i === void 0 || i.status === "loading" ? Bo : i.status === "failed" ? { readme: { status: "failed", failure: i.failure, retry: () => e.retryChildren(t, n) }, claim: !0 } : { readme: { status: "ok", readme: Dt(i.entries) }, claim: !0 };
1024
+ }, zo = (e, t, n) => {
1025
+ const { readme: r } = jo(e, t, n);
1026
+ return r.status === "ok" ? r.readme : null;
1027
+ }, Vo = (e, t, n) => {
1028
+ const r = yr({ path: `${e.basePath}/*`, end: !0 }, t.pathname);
1029
+ if (r === null) return /* @__PURE__ */ new Set();
1030
+ const { location: o } = Sn(e, r.params["*"], new URLSearchParams(t.search));
1031
+ switch (o.view) {
1032
+ case "tree": {
1033
+ const i = o.folder === null ? o.doc : n(o.source, o.folder);
1034
+ return new Set(i === null ? [] : [i]);
1035
+ }
1036
+ case "single":
1037
+ return /* @__PURE__ */ new Set([o.doc]);
1038
+ case "multi":
1039
+ return new Set(o.docs);
1040
+ }
1041
+ }, _n = (e) => {
1042
+ const { edits: t } = F(), n = I(() => t.session(e), [t, e]);
1043
+ return re(t.subscribe, n, Uo);
1044
+ }, Bn = () => !1, Uo = () => {
1045
+ }, Zo = () => {
1046
+ const { edits: e } = F();
1047
+ return re(e.subscribe, e.hasSessions, Bn);
1048
+ }, Go = () => {
1049
+ const { edits: e } = F();
1050
+ return re(e.subscribe, e.sideBySide, Bn);
1051
+ }, Wo = () => null, Ko = () => {
1052
+ const { edits: e, labels: t, config: n, trees: r } = F(), o = B([]), i = I(
1053
+ ({ nextLocation: g }) => {
1054
+ const b = Vo(n, g, (x, R) => zo(r, x, R));
1055
+ return e.flushDrafts(), o.current = e.dirtyPaths().filter((x) => !b.has(x)), o.current.length > 0;
1056
+ },
1057
+ [e, n, r]
1058
+ ), a = Sr(i), c = Zo();
1059
+ ee(() => {
1060
+ if (!c) return;
1061
+ const g = (b) => {
1062
+ e.flushDrafts(), e.dirtyPaths().length !== 0 && (b.preventDefault(), b.returnValue = !0);
1063
+ };
1064
+ return window.addEventListener("beforeunload", g), () => window.removeEventListener("beforeunload", g);
1065
+ }, [c, e]);
1066
+ const f = re(e.subscribe, e.discardRequest, Wo), w = a.state === "blocked", l = w ? o.current : f === null ? [] : f.paths, u = l.map((g) => ce(g)).join(", "), p = l.length > 0 && l.every((g) => e.session(g)?.save.kind === "draft");
1067
+ return /* @__PURE__ */ s(
1068
+ qn,
1069
+ {
1070
+ open: w || f !== null,
1071
+ title: p ? t.draftDiscardTitle : t.unsavedTitle,
1072
+ body: p ? t.draftDiscardBody(u) : t.unsavedBody(u),
1073
+ confirmLabel: t.unsavedDiscard,
1074
+ cancelLabel: t.unsavedStay,
1075
+ testId: "markdown-explorer-unsaved-guard",
1076
+ onConfirm: () => {
1077
+ if (a.state === "blocked") {
1078
+ e.discard(o.current), a.proceed();
1079
+ return;
1080
+ }
1081
+ f?.settle(!0);
1082
+ },
1083
+ onCancel: () => {
1084
+ if (a.state === "blocked") {
1085
+ a.reset();
1086
+ return;
1087
+ }
1088
+ f?.settle(!1);
1089
+ }
1090
+ }
1091
+ );
1092
+ };
1093
+ function Yo({
1094
+ title: e,
1095
+ titleId: t,
1096
+ ...n
1097
+ }, r) {
1098
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1099
+ xmlns: "http://www.w3.org/2000/svg",
1100
+ viewBox: "0 0 20 20",
1101
+ fill: "currentColor",
1102
+ "aria-hidden": "true",
1103
+ "data-slot": "icon",
1104
+ ref: r,
1105
+ "aria-labelledby": t
1106
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1107
+ id: t
1108
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1109
+ fillRule: "evenodd",
1110
+ 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",
1111
+ clipRule: "evenodd"
1112
+ }));
1113
+ }
1114
+ const Xo = /* @__PURE__ */ y.forwardRef(Yo);
1115
+ let tt = null;
1116
+ const Hn = () => (tt ??= import("./EditSurface-CcWEczj3.js").catch((e) => {
1117
+ throw tt = null, e;
1118
+ }), tt), Jo = () => {
1119
+ Hn().catch(() => {
1120
+ });
1121
+ }, Qo = (e) => {
1122
+ const { default: t } = oe(Hn());
1123
+ return /* @__PURE__ */ s(t, { ...e });
1124
+ };
1125
+ class ei extends En {
1126
+ state = { failed: !1 };
1127
+ static getDerivedStateFromError() {
1128
+ return { failed: !0 };
1129
+ }
1130
+ retry = () => this.setState({ failed: !1 });
1131
+ render() {
1132
+ return this.state.failed ? this.props.fallback(this.retry) : this.props.children;
1133
+ }
1134
+ }
1135
+ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen], [data-aqmd-svg-image-source]', ri = 200, Oe = (e) => ro(e.getAttribute(Rn)), oi = (e, t) => {
1136
+ for (let r = e; r !== null && t.contains(r); r = r.parentElement) {
1137
+ const o = Oe(r);
1138
+ if (o !== null) return { block: r, lines: o, own: !0 };
1139
+ }
1140
+ let n = null;
1141
+ for (const r of t.querySelectorAll(Et)) {
1142
+ if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
1143
+ const o = Oe(r);
1144
+ o !== null && (n = { block: r, lines: o });
1145
+ }
1146
+ return n === null ? null : { ...n, own: !1 };
1147
+ }, ii = (e, t) => {
1148
+ let n = 0;
1149
+ for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + t.length)) n += 1;
1150
+ return n;
1151
+ }, ai = (e) => e.closest(ti) !== null && e.closest(ni) === null, li = (e, t, n) => {
1152
+ const r = oi(e, t);
1153
+ if (r === null) return null;
1154
+ const { block: o, own: i } = r;
1155
+ if (!i) {
1156
+ const c = r.lines.last + 1;
1157
+ return { lines: { first: c, last: c }, word: null, occurrence: 0, clientTop: Be(e) };
1158
+ }
1159
+ const a = ui(o, n);
1160
+ return a === null ? { lines: r.lines, word: null, occurrence: 0, clientTop: Be(o) } : { lines: r.lines, word: a.text, occurrence: a.occurrence, clientTop: a.clientTop };
1161
+ }, si = (e, t) => {
1162
+ let n = null, r = null, o = null;
1163
+ for (const a of e.querySelectorAll(Et)) {
1164
+ const c = Oe(a);
1165
+ if (c === null) continue;
1166
+ n ??= di(t, a);
1167
+ const { top: f, bottom: w } = a.getBoundingClientRect();
1168
+ f <= n && n < w ? r = { lines: c, block: a } : o === null && f >= n && (o = { lines: c, block: a });
1169
+ }
1170
+ const i = r === null ? o : r;
1171
+ return i === null ? null : { lines: i.lines, word: null, occurrence: 0, clientTop: Be(i.block) };
1172
+ }, ci = (e) => e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, di = (e, t) => {
1173
+ const n = Number.parseFloat(getComputedStyle(t).scrollMarginTop);
1174
+ return ci(e) + (Number.isFinite(n) ? n : 0);
1175
+ }, ui = (e, t) => {
1176
+ if (t === null || t.rangeCount === 0) return null;
1177
+ const n = t.getRangeAt(0);
1178
+ if (!(e.contains(n.startContainer) && e.contains(n.endContainer))) return null;
1179
+ const r = n.toString().trim();
1180
+ if (r === "" || r.length > ri || /[\r\n]/u.test(r)) return null;
1181
+ const o = e.ownerDocument.createRange();
1182
+ return o.setStart(e, 0), o.setEnd(n.startContainer, n.startOffset), { text: r, occurrence: ii(o.toString(), r), clientTop: n.getBoundingClientRect().top };
1183
+ }, lc = (e, t) => {
1184
+ const n = e.split(`
1185
+ `), r = Math.min(t.lines.first, n.length), o = Math.min(t.lines.last, n.length), i = { line: r, column: 0 };
1186
+ if (t.word === null) return i;
1187
+ let a = 0;
1188
+ for (let c = r; c <= o; c += 1) {
1189
+ const f = n[c - 1] ?? "";
1190
+ for (let w = f.indexOf(t.word); w >= 0; w = f.indexOf(t.word, w + t.word.length)) {
1191
+ if (a === t.occurrence) return { line: c, column: w };
1192
+ a += 1;
1193
+ }
1194
+ }
1195
+ return a > 0 ? fi(n, r, o, t.word) ?? i : i;
1196
+ }, fi = (e, t, n, r) => {
1197
+ for (let o = n; o >= t; o -= 1) {
1198
+ const i = (e[o - 1] ?? "").lastIndexOf(r);
1199
+ if (i >= 0) return { line: o, column: i };
1200
+ }
1201
+ return null;
1202
+ }, mi = (e, t) => {
1203
+ let n = null, r = null;
1204
+ for (const o of e.querySelectorAll(Et)) {
1205
+ const i = Oe(o);
1206
+ i === null || i.first > t || (i.last >= t ? n = o : (r === null || i.last >= r.last) && (r = { element: o, last: i.last }));
1207
+ }
1208
+ return n !== null ? n : r === null ? null : r.element;
1209
+ }, hi = (e, t) => {
1210
+ const { bottom: n } = e.getBoundingClientRect(), r = Be(e), o = Oe(e);
1211
+ if (o === null) return r;
1212
+ const i = Math.min(Math.max(t - o.first, 0) / (o.last - o.first + 1), 1);
1213
+ return r + (n - r) * i;
1214
+ }, Be = (e) => {
1215
+ const t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT);
1216
+ for (let n = t.nextNode(); n !== null; n = t.nextNode()) {
1217
+ const o = (n.textContent ?? "").search(/\S/u);
1218
+ if (o < 0) continue;
1219
+ const i = e.ownerDocument.createRange();
1220
+ i.setStart(n, o), i.setEnd(n, o + 1);
1221
+ const { top: a, height: c } = i.getBoundingClientRect();
1222
+ if (c > 0) return a;
1223
+ }
1224
+ return e.getBoundingClientRect().top;
1225
+ }, yt = Object.freeze({
1226
+ browse: Object.freeze({ replace: !0, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1227
+ "switch-source": Object.freeze({ replace: !1, preventScrollReset: !0, defaultShouldRevalidate: !1 }),
1228
+ "switch-view": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 }),
1229
+ "follow-link": Object.freeze({ replace: !1, preventScrollReset: !1, defaultShouldRevalidate: !1 })
1230
+ }), sc = (e) => yt[e], Ve = () => {
1231
+ const e = kr();
1232
+ return I(
1233
+ (t, n) => {
1234
+ e(t, yt[n]);
1235
+ },
1236
+ [e]
1237
+ );
1238
+ }, pi = ({ navigation: e, ...t }) => /* @__PURE__ */ s(xr, { ...t, ...yt[e] }), jn = (e) => {
1239
+ const t = e.ownerDocument;
1240
+ if (e.focus({ preventScroll: !0 }), t.activeElement === e) return !0;
1241
+ if (e.hasAttribute("tabindex")) return !1;
1242
+ if (e.setAttribute("tabindex", "-1"), e.focus({ preventScroll: !0 }), t.activeElement !== e)
1243
+ return e.removeAttribute("tabindex"), !1;
1244
+ const n = () => {
1245
+ t.activeElement !== e && (e.removeAttribute("tabindex"), e.removeEventListener("blur", n));
1246
+ };
1247
+ return e.addEventListener("blur", n), !0;
1248
+ }, wi = (e, t) => {
1249
+ const n = B(null), r = B(null), o = B(null), i = I(() => {
1250
+ n.current !== null && window.clearTimeout(n.current), n.current = null, r.current = null;
1251
+ }, []);
1252
+ ee(() => i, [i]);
1253
+ const a = I(
1254
+ (w) => {
1255
+ if (r.current !== w) return;
1256
+ const l = o.current;
1257
+ if (l !== null) {
1258
+ l.then(() => a(w));
1259
+ return;
1260
+ }
1261
+ e.prefetch(w);
1262
+ const u = e.peek(w);
1263
+ if (u?.status !== "pending") return;
1264
+ const p = Promise.allSettled([u.promise]);
1265
+ o.current = p, p.then(() => {
1266
+ o.current === p && (o.current = null);
1267
+ });
1268
+ },
1269
+ [e]
1270
+ ), c = I(
1271
+ (w) => {
1272
+ const l = t(w);
1273
+ l !== r.current && (i(), l !== null && (r.current = l, n.current = window.setTimeout(() => {
1274
+ n.current = null, a(l);
1275
+ }, Mr)));
1276
+ },
1277
+ [i, t, a]
1278
+ ), f = I(
1279
+ (w) => {
1280
+ t(w) !== r.current && i();
1281
+ },
1282
+ [i, t]
1283
+ );
1284
+ return Y(
1285
+ () => ({
1286
+ onPointerOver: (w) => c(w.target),
1287
+ onPointerOut: (w) => f(w.relatedTarget),
1288
+ onFocus: (w) => c(w.target),
1289
+ onBlur: (w) => f(w.relatedTarget)
1290
+ }),
1291
+ [c, f]
1292
+ );
1293
+ }, gi = wt(() => import("./NativeScrollBar-BXdaM3EA.js").then((e) => ({ default: e.NativeScrollBar })));
1294
+ class vi extends En {
1295
+ state = { failed: !1 };
1296
+ static getDerivedStateFromError() {
1297
+ return { failed: !0 };
1298
+ }
1299
+ componentDidCatch(t) {
1300
+ console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.", t);
1301
+ }
1302
+ render() {
1303
+ return this.state.failed ? null : this.props.children;
1304
+ }
1305
+ }
1306
+ const bi = ({ scroller: e, withCircle: t }) => /* @__PURE__ */ s(vi, { children: /* @__PURE__ */ s(xe, { fallback: null, children: /* @__PURE__ */ s(gi, { scroller: e, withCircle: t }) }) }), zn = (e) => /* @__PURE__ */ s(bi, { scroller: e, withCircle: !0 }), Vn = () => {
1307
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
1308
+ let n = !1;
1309
+ const r = (o) => {
1310
+ t.add(o), !n && (n = !0, queueMicrotask(() => {
1311
+ n = !1, t.clear();
1312
+ }));
1313
+ };
1314
+ return {
1315
+ hold: (o) => {
1316
+ e.set(o, (e.get(o) ?? 0) + 1);
1317
+ let i = !1;
1318
+ return () => {
1319
+ if (i) return;
1320
+ i = !0;
1321
+ const a = e.get(o);
1322
+ if (a !== void 0 && a > 1) {
1323
+ e.set(o, a - 1);
1324
+ return;
1325
+ }
1326
+ e.delete(o), r(o);
1327
+ };
1328
+ },
1329
+ isHeld: (o) => e.has(o),
1330
+ resumes: (o) => t.delete(o),
1331
+ heldKeys: () => [...e.keys()]
1332
+ };
1333
+ }, He = (e, t) => {
1334
+ if (Object.is(e, t)) return !0;
1335
+ if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
1336
+ if (Array.isArray(e) || Array.isArray(t))
1337
+ return !(Array.isArray(e) && Array.isArray(t)) || e.length !== t.length ? !1 : e.every((i, a) => He(i, t[a]));
1338
+ const n = e, r = t, o = Object.keys(n);
1339
+ return o.length !== Object.keys(r).length ? !1 : o.every((i) => Object.hasOwn(r, i) && He(n[i], r[i]));
1340
+ }, Ei = 55e3, Kt = Object.freeze({ status: "deferred" }), nt = Object.freeze({ status: "refreshed" }), rt = Object.freeze({ status: "shown", failed: !1 }), Ne = Object.freeze({ status: "shown", failed: !0 }), De = Object.freeze({ status: "superseded" }), fe = (e) => e === void 0 || e.status === "deferred" ? null : e.status === "loaded" ? e : e.previous, yi = (e) => e !== void 0 && e.status === "loaded" && e.document.kind !== "failure", Si = ({ client: e, capacity: t }) => {
1341
+ if (!Number.isInteger(t) || t < 1) throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);
1342
+ const n = /* @__PURE__ */ new Map(), r = Vn(), o = Ce(), i = /* @__PURE__ */ new WeakSet(), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1343
+ let w = 0;
1344
+ const l = o.emit, u = () => (w += 1, w), p = () => {
1345
+ if (!(n.size <= t))
1346
+ for (const v of [...n.keys()]) {
1347
+ if (n.size <= t) return;
1348
+ r.isHeld(v) || n.delete(v);
1349
+ }
1350
+ }, g = (v, T) => {
1351
+ n.delete(v), n.set(v, T);
1352
+ }, b = (v) => performance.now() - v.validatedAt >= Ei, x = (v, T, L) => {
1353
+ const O = n.get(v), P = fe(O?.snapshot), j = L || O?.refreshPending === !0, X = Re(e.document(v, { refresh: j }).then((E) => ({ status: "loaded", document: E }))), h = { snapshot: { status: "pending", promise: X, previous: P }, validatedAt: performance.now(), opened: T, background: null, refreshPending: !1, seeded: void 0, stamp: u() };
1354
+ return g(v, h), p(), X.then((E) => {
1355
+ n.get(v) === h && (h.snapshot = E, h.stamp = u(), l());
1356
+ }), h;
1357
+ }, R = (v, T, L, O, P, j) => {
1358
+ T.background === L && (T.background = null, !(n.get(v) !== T || T.snapshot !== O) && (P.kind === "failure" && O.document.kind !== "failure" || (T.validatedAt = j, T.stamp = u(), He(O.document, P) || (T.snapshot = { status: "loaded", document: P }), l())));
1359
+ }, A = async (v, T) => {
1360
+ const L = T.snapshot;
1361
+ if (L.status !== "loaded") return null;
1362
+ const O = {};
1363
+ T.background = O;
1364
+ const P = performance.now(), j = e.document(v, { refresh: T.refreshPending });
1365
+ T.refreshPending = !1;
1366
+ const X = await j, h = T.background === O && n.get(v) === T && T.snapshot === L;
1367
+ return R(v, T, O, L, X, P), h ? X : null;
1368
+ }, N = (v, T) => {
1369
+ const { snapshot: L } = T;
1370
+ return L.status === "pending" ? !1 : L.status === "loaded" && L.document.kind !== "failure" ? (A(v, T), !1) : (L.status === "loaded" && i.add(L), x(v, !0, !1), !0);
1371
+ }, _ = (v) => {
1372
+ c.delete(v);
1373
+ const T = f.get(v);
1374
+ if (T !== void 0) {
1375
+ f.delete(v);
1376
+ for (const L of T) L();
1377
+ }
1378
+ }, D = (v, T) => new Promise((L) => {
1379
+ if (c.get(v) === T || !r.isHeld(v)) {
1380
+ L();
1381
+ return;
1382
+ }
1383
+ const O = f.get(v);
1384
+ O === void 0 ? f.set(v, /* @__PURE__ */ new Set([L])) : O.add(L);
1385
+ }), d = (v, T) => {
1386
+ const L = a.get(v);
1387
+ if (L === void 0) {
1388
+ T.resolve(null);
1389
+ return;
1390
+ }
1391
+ if (L.last !== null && L.last.stamp >= T.stamp) {
1392
+ T.resolve(L.last);
1393
+ return;
1394
+ }
1395
+ L.waiters.add(T);
1396
+ }, m = async (v, T, L) => {
1397
+ const O = await new Promise((P) => d(v, { stamp: T.stamp, resolve: P }));
1398
+ if (n.get(v) !== T) return De;
1399
+ if (O === null) return L ? nt : rt;
1400
+ if (!L) return O.failure === null ? rt : Ne;
1401
+ switch (O.before) {
1402
+ case "copy":
1403
+ return O.failure === null ? nt : { status: "failed", failure: O.failure };
1404
+ case "failure":
1405
+ return O.failure === null ? rt : Ne;
1406
+ case "none":
1407
+ return O.failure === null ? nt : Ne;
1408
+ }
1409
+ }, k = (v) => {
1410
+ const T = { showing: "none", last: null, waiters: /* @__PURE__ */ new Set() };
1411
+ a.set(v, T);
1412
+ let L = !1;
1413
+ return {
1414
+ settle: (O, P) => {
1415
+ if (L || O === void 0) return;
1416
+ const j = { stamp: O, failure: P, before: T.showing };
1417
+ T.last = j, P === null ? T.showing = "copy" : T.showing === "none" && (T.showing = "failure");
1418
+ for (const X of [...T.waiters])
1419
+ O < X.stamp || (T.waiters.delete(X), X.resolve(j));
1420
+ },
1421
+ release: () => {
1422
+ if (L) return;
1423
+ L = !0, a.get(v) === T && a.delete(v);
1424
+ const O = [...T.waiters];
1425
+ T.waiters.clear(), O.length > 0 && queueMicrotask(() => {
1426
+ for (const P of O) d(v, P);
1427
+ });
1428
+ }
1429
+ };
1430
+ }, M = (v) => {
1431
+ const T = r.hold(v);
1432
+ let L = !1;
1433
+ return () => {
1434
+ if (L) return;
1435
+ L = !0, T();
1436
+ const O = n.get(v);
1437
+ O !== void 0 && g(v, O), p(), r.isHeld(v) || queueMicrotask(() => {
1438
+ r.isHeld(v) || _(v);
1439
+ });
1440
+ };
1441
+ };
1442
+ return {
1443
+ peek: (v) => n.get(v)?.snapshot,
1444
+ peekSeeded: (v) => n.get(v)?.seeded,
1445
+ answerStampOf: (v) => n.get(v)?.stamp,
1446
+ prefetch: (v) => {
1447
+ const T = n.get(v);
1448
+ T !== void 0 && T.snapshot.status !== "deferred" || (x(v, !1, !1), l());
1449
+ },
1450
+ open: (v) => {
1451
+ const T = r.resumes(v), L = M(v), O = n.get(v);
1452
+ if (O === void 0 || O.snapshot.status === "deferred")
1453
+ return x(v, !0, !1), l(), L;
1454
+ if (g(v, O), T) return L;
1455
+ const { snapshot: P } = O;
1456
+ return P.status === "pending" ? (O.opened = !0, L) : P.document.kind === "failure" ? (O.opened || b(O) ? (i.add(P), x(v, !0, !1), l()) : O.opened = !0, L) : (O.opened = !0, O.background === null && b(O) && A(v, O), L);
1457
+ },
1458
+ retain: M,
1459
+ retry: (v) => {
1460
+ const T = n.get(v);
1461
+ T === void 0 || T.snapshot.status !== "loaded" || T.snapshot.document.kind !== "failure" || (x(v, !0, !1), l());
1462
+ },
1463
+ seed: (v, T) => {
1464
+ const L = performance.now(), O = Re(
1465
+ T.then(
1466
+ (E) => E === null ? Kt : { status: "loaded", document: E },
1467
+ () => Kt
1468
+ )
1469
+ ), P = n.get(v);
1470
+ if (P !== void 0 && P.snapshot.status === "loaded") {
1471
+ const E = P.snapshot, S = {};
1472
+ P.background = S, O.then((C) => {
1473
+ if (C.status === "loaded") {
1474
+ R(v, P, S, E, C.document, L);
1475
+ return;
1476
+ }
1477
+ P.background === S && (P.background = null);
1478
+ });
1479
+ return;
1480
+ }
1481
+ const j = P !== void 0 && P.snapshot.status === "pending" ? P.snapshot.previous : null, X = { status: "pending", promise: O, previous: j }, h = { snapshot: X, validatedAt: L, opened: P?.opened === !0, background: null, refreshPending: P?.refreshPending === !0, seeded: X, stamp: u() };
1482
+ g(v, h), p(), O.then((E) => {
1483
+ n.get(v) === h && (E.status === "deferred" && r.isHeld(v) ? x(v, h.opened, !1) : (h.snapshot = E, h.stamp = u()), l());
1484
+ });
1485
+ },
1486
+ invalidate: () => {
1487
+ let v = !1;
1488
+ for (const [T, L] of [...n]) {
1489
+ if (L.validatedAt = Number.NEGATIVE_INFINITY, L.opened = !0, L.refreshPending = !0, !r.isHeld(T)) continue;
1490
+ const { snapshot: O } = L;
1491
+ if (O.status !== "pending") {
1492
+ N(T, L) && (v = !0);
1493
+ continue;
1494
+ }
1495
+ O.promise.then(() => {
1496
+ n.get(T) === L && L.refreshPending && r.isHeld(T) && N(T, L) && l();
1497
+ });
1498
+ }
1499
+ v && l();
1500
+ },
1501
+ refresh: async (v) => {
1502
+ const T = n.get(v);
1503
+ if (T !== void 0 && yi(T.snapshot)) {
1504
+ T.refreshPending = !0;
1505
+ const P = await A(v, T);
1506
+ return P === null ? De : P.kind === "failure" ? { status: "failed", failure: P.failure } : m(v, T, !0);
1507
+ }
1508
+ const L = x(v, !0, !0);
1509
+ if (l(), L.snapshot.status !== "pending") return De;
1510
+ const O = await L.snapshot.promise;
1511
+ return n.get(v) !== L || O.status !== "loaded" ? De : O.document.kind === "failure" ? Ne : (await D(v, O), m(v, L, !1));
1512
+ },
1513
+ clear: () => {
1514
+ n.clear();
1515
+ for (const v of r.heldKeys()) x(v, !0, !1);
1516
+ l();
1517
+ },
1518
+ subscribe: o.subscribe,
1519
+ readPart: k,
1520
+ noteShown: (v, T) => {
1521
+ c.set(v, T);
1522
+ const L = f.get(v);
1523
+ if (L !== void 0) {
1524
+ f.delete(v);
1525
+ for (const O of L) O();
1526
+ }
1527
+ },
1528
+ noteFailureShown: (v) => i.has(v) ? !1 : (i.add(v), !0)
1529
+ };
1530
+ }, me = he("fill"), ki = Object.freeze({ blockSize: "100%" }), Me = ({ scrollerProps: e, children: t }) => oe(me) === "content" ? /* @__PURE__ */ s(_t, { scrollerProps: e, children: t }) : /* @__PURE__ */ s(_t, { scrollerProps: { ...e, style: ki }, rowClassName: "aqmx-document-scroll-row", renderScrollBar: zn, children: t }), xi = Object.freeze(["l1", "l2", "l3", "l4", "l5", "l6", "l7", "l8"]), Ti = Object.freeze({ className: "aqmx-document-failure", "data-aqmx-document-scroller": "" }), Ue = ({ label: e, testId: t }) => /* @__PURE__ */ H(je, { children: [
1531
+ /* @__PURE__ */ s("div", { className: "aqmx-skeleton", "aria-hidden": "true", "data-testid": t, children: xi.map((n) => /* @__PURE__ */ s("span", {}, n)) }),
1532
+ /* @__PURE__ */ s("p", { className: "aqmx-sr-only", children: e })
1533
+ ] }), St = ({ failure: e, onRetry: t, testId: n }) => /* @__PURE__ */ s(Me, { scrollerProps: Ti, children: /* @__PURE__ */ s(Te, { failure: e, alert: !1, onRetry: t, testId: n }) });
1534
+ function Ri({
1535
+ title: e,
1536
+ titleId: t,
1537
+ ...n
1538
+ }, r) {
1539
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1540
+ xmlns: "http://www.w3.org/2000/svg",
1541
+ viewBox: "0 0 20 20",
1542
+ fill: "currentColor",
1543
+ "aria-hidden": "true",
1544
+ "data-slot": "icon",
1545
+ ref: r,
1546
+ "aria-labelledby": t
1547
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1548
+ id: t
1549
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1550
+ fillRule: "evenodd",
1551
+ 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",
1552
+ clipRule: "evenodd"
1553
+ }), /* @__PURE__ */ y.createElement("path", {
1554
+ fillRule: "evenodd",
1555
+ 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",
1556
+ clipRule: "evenodd"
1557
+ }));
1558
+ }
1559
+ const Oi = /* @__PURE__ */ y.forwardRef(Ri);
1560
+ function Ci({
1561
+ title: e,
1562
+ titleId: t,
1563
+ ...n
1564
+ }, r) {
1565
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1566
+ xmlns: "http://www.w3.org/2000/svg",
1567
+ viewBox: "0 0 20 20",
1568
+ fill: "currentColor",
1569
+ "aria-hidden": "true",
1570
+ "data-slot": "icon",
1571
+ ref: r,
1572
+ "aria-labelledby": t
1573
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1574
+ id: t
1575
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1576
+ fillRule: "evenodd",
1577
+ 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",
1578
+ clipRule: "evenodd"
1579
+ }), /* @__PURE__ */ y.createElement("path", {
1580
+ 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"
1581
+ }));
1582
+ }
1583
+ const Mi = /* @__PURE__ */ y.forwardRef(Ci);
1584
+ function Li({
1585
+ title: e,
1586
+ titleId: t,
1587
+ ...n
1588
+ }, r) {
1589
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1590
+ xmlns: "http://www.w3.org/2000/svg",
1591
+ viewBox: "0 0 20 20",
1592
+ fill: "currentColor",
1593
+ "aria-hidden": "true",
1594
+ "data-slot": "icon",
1595
+ ref: r,
1596
+ "aria-labelledby": t
1597
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1598
+ id: t
1599
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1600
+ fillRule: "evenodd",
1601
+ 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",
1602
+ clipRule: "evenodd"
1603
+ }));
1604
+ }
1605
+ const Ai = /* @__PURE__ */ y.forwardRef(Li), Ni = 2e3, Yt = Object.freeze({ outcome: "idle" }), Di = (e) => {
1606
+ const t = navigator.clipboard;
1607
+ return t === void 0 ? Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")) : t.writeText(e);
1608
+ }, Pi = ({ text: e }) => {
1609
+ const { announcer: t, labels: n } = F(), [r, o] = U(Yt);
1610
+ ee(() => {
1611
+ if (r.outcome === "idle") return;
1612
+ const f = setTimeout(() => o(Yt), Ni);
1613
+ return () => clearTimeout(f);
1614
+ }, [r]);
1615
+ const i = (f) => {
1616
+ o({ outcome: f }), t.announce(f === "copied" ? n.copiedText : n.copyTextFailed);
1617
+ }, a = () => {
1618
+ Di(e).then(
1619
+ () => i("copied"),
1620
+ () => i("failed")
1621
+ );
1622
+ }, c = r.outcome === "copied" ? n.copiedText : r.outcome === "failed" ? n.copyTextFailed : n.copyText;
1623
+ return (
1624
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-icon-button", "aria-label": n.copyText, title: c, onClick: a, "data-aqmx-copy-outcome": r.outcome, "data-testid": "markdown-explorer-file-copy", children: r.outcome === "copied" ? /* @__PURE__ */ s(Oi, {}) : r.outcome === "failed" ? /* @__PURE__ */ s(Ai, {}) : /* @__PURE__ */ s(Mi, {}) })
1625
+ );
1626
+ }, Un = he(null), $i = () => {
1627
+ const e = oe(Un);
1628
+ if (e === null) throw new Error("[markdown-explorer] a document's content reads its own part only inside a document pane (DocumentContentChannelContext)");
1629
+ return e;
1630
+ };
1631
+ function Fi({
1632
+ title: e,
1633
+ titleId: t,
1634
+ ...n
1635
+ }, r) {
1636
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1637
+ xmlns: "http://www.w3.org/2000/svg",
1638
+ viewBox: "0 0 20 20",
1639
+ fill: "currentColor",
1640
+ "aria-hidden": "true",
1641
+ "data-slot": "icon",
1642
+ ref: r,
1643
+ "aria-labelledby": t
1644
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1645
+ id: t
1646
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1647
+ 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"
1648
+ }), /* @__PURE__ */ y.createElement("path", {
1649
+ 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"
1650
+ }));
1651
+ }
1652
+ const qi = /* @__PURE__ */ y.forwardRef(Fi);
1653
+ function Ii({
1654
+ title: e,
1655
+ titleId: t,
1656
+ ...n
1657
+ }, r) {
1658
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1659
+ xmlns: "http://www.w3.org/2000/svg",
1660
+ viewBox: "0 0 20 20",
1661
+ fill: "currentColor",
1662
+ "aria-hidden": "true",
1663
+ "data-slot": "icon",
1664
+ ref: r,
1665
+ "aria-labelledby": t
1666
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1667
+ id: t
1668
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1669
+ fillRule: "evenodd",
1670
+ 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",
1671
+ clipRule: "evenodd"
1672
+ }), /* @__PURE__ */ y.createElement("path", {
1673
+ fillRule: "evenodd",
1674
+ 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",
1675
+ clipRule: "evenodd"
1676
+ }));
1677
+ }
1678
+ const _i = /* @__PURE__ */ y.forwardRef(Ii), Le = ({ name: e, openUrl: t, downloadUrl: n, icon: r, children: o }) => {
1679
+ const { labels: i } = F();
1680
+ return /* @__PURE__ */ H("div", { className: "aqmx-document-toolbar", children: [
1681
+ /* @__PURE__ */ s("span", { className: "aqmx-document-file-icon", "aria-hidden": "true", children: r }),
1682
+ /* @__PURE__ */ s("span", { className: "aqmx-document-title", title: e, "data-testid": "markdown-explorer-file-name", children: e }),
1683
+ o,
1684
+ /* @__PURE__ */ s("a", { className: "aqmx-icon-button", href: t, target: "_blank", rel: "noopener noreferrer", "aria-label": i.openInNewTab, title: i.openInNewTab, "data-testid": "markdown-explorer-file-open", children: /* @__PURE__ */ s(_i, {}) }),
1685
+ /* @__PURE__ */ s("a", { className: "aqmx-icon-button", href: n, download: e, "aria-label": i.download, title: i.download, "data-testid": "markdown-explorer-file-download", children: /* @__PURE__ */ s(qi, {}) })
1686
+ ] });
1687
+ };
1688
+ function Bi({
1689
+ title: e,
1690
+ titleId: t,
1691
+ ...n
1692
+ }, r) {
1693
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1694
+ xmlns: "http://www.w3.org/2000/svg",
1695
+ viewBox: "0 0 20 20",
1696
+ fill: "currentColor",
1697
+ "aria-hidden": "true",
1698
+ "data-slot": "icon",
1699
+ ref: r,
1700
+ "aria-labelledby": t
1701
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1702
+ id: t
1703
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1704
+ fillRule: "evenodd",
1705
+ 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",
1706
+ clipRule: "evenodd"
1707
+ }));
1708
+ }
1709
+ const Hi = /* @__PURE__ */ y.forwardRef(Bi), ji = Object.freeze({ className: "aqmx-document-stage" }), zi = ({ document: e }) => {
1710
+ const { labels: t } = F();
1711
+ return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-file-view", children: [
1712
+ /* @__PURE__ */ s(Le, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ s(Hi, {}) }),
1713
+ /* @__PURE__ */ s(Me, { scrollerProps: ji, children: /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-file-not-shown", children: [
1714
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: t.fileNotShown }),
1715
+ /* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-file-not-shown-download", children: t.download })
1716
+ ] }) })
1717
+ ] });
1718
+ }, Ze = "[data-aqmd-scroll-container], [data-aqmx-document-scroller]", Vi = (e) => {
1719
+ const t = e.indexOf("#");
1720
+ return t === -1 ? "" : e.slice(t);
1721
+ }, Ui = /(%[0-9A-Fa-f]{2})/u, kt = (e) => {
1722
+ if (!e.startsWith("#") || e.length === 1) return null;
1723
+ const t = new TextEncoder(), n = e.slice(1).split(Ui).flatMap((r, o) => o % 2 === 1 ? [Number.parseInt(r.slice(1), 16)] : [...t.encode(r)]);
1724
+ return new TextDecoder("utf-8", { ignoreBOM: !0 }).decode(Uint8Array.from(n));
1725
+ }, Zn = (e) => `#${encodeURIComponent(e)}`, Zi = (e) => {
1726
+ if (e === "#") return !0;
1727
+ const t = kt(e);
1728
+ return t !== null && t.replace(/[A-Z]/gu, (n) => n.toLowerCase()) === "top";
1729
+ }, Gn = (e, t) => {
1730
+ if (t === "") return null;
1731
+ for (const n of e.querySelectorAll("[id]"))
1732
+ if (n.id === t) return n;
1733
+ return null;
1734
+ }, Gi = "http://www.w3.org/1999/xhtml", Xt = (e, t) => {
1735
+ if (t === "") return null;
1736
+ const n = Gn(e, t);
1737
+ if (n !== null) return n;
1738
+ for (const r of e.querySelectorAll("a[name]"))
1739
+ if (r.localName === "a" && r.namespaceURI === Gi && r.getAttribute("name") === t) return r;
1740
+ return null;
1741
+ }, Wn = (e, t) => {
1742
+ if (e === null || !t.startsWith("#")) return null;
1743
+ const n = Xt(e, t.slice(1));
1744
+ if (n !== null) return n;
1745
+ const r = kt(t);
1746
+ return r === null ? null : Xt(e, r);
1747
+ }, Jt = (e) => {
1748
+ const { body: t, documentElement: n } = e.ownerDocument;
1749
+ if (e === t) {
1750
+ const o = getComputedStyle(n);
1751
+ if (o.overflowX === "visible" && o.overflowY === "visible") return !1;
1752
+ }
1753
+ const { overflowY: r } = getComputedStyle(e);
1754
+ return r === "auto" || r === "scroll";
1755
+ }, Wi = (e) => {
1756
+ const { body: t, documentElement: n } = e, r = getComputedStyle(n), o = r.overflowX === "visible" && r.overflowY === "visible" && t !== null ? getComputedStyle(t).overflowY : r.overflowY;
1757
+ return o !== "hidden" && o !== "clip";
1758
+ }, Ki = (e, t) => {
1759
+ const n = t.closest(Ze), r = n !== null && e.contains(n) ? n : e;
1760
+ if (r.scrollHeight > r.clientHeight && Jt(r)) return r;
1761
+ const o = e.getBoundingClientRect().height, { documentElement: i, scrollingElement: a } = e.ownerDocument;
1762
+ for (let c = e.parentElement; c !== null && c !== i; c = c.parentElement)
1763
+ if (Jt(c) && c.scrollHeight > c.clientHeight && c.clientHeight < o) return c;
1764
+ return a instanceof Element && Wi(e.ownerDocument) && a.scrollHeight > a.clientHeight && a.clientHeight < o ? a : r;
1765
+ }, Yi = Object.freeze({
1766
+ scrollerOf: Ki,
1767
+ reveal: (e) => {
1768
+ e.scrollIntoView(ft);
1769
+ }
1770
+ }), ft = Object.freeze({ block: "nearest", inline: "nearest", behavior: "instant" }), Xi = (e, t) => {
1771
+ for (let n = t; n !== null && n !== e; n = n.parentElement) {
1772
+ const r = n.parentElement;
1773
+ if (r instanceof HTMLDetailsElement && n !== r.querySelector(":scope > summary") && (r.open = !0), n.getAttribute("hidden")?.toLowerCase() === "until-found") {
1774
+ if (n.dispatchEvent(new Event("beforematch", { bubbles: !0 })), !n.isConnected) return;
1775
+ n.removeAttribute("hidden");
1776
+ }
1777
+ }
1778
+ }, Ji = (e, t) => {
1779
+ if (t.getClientRects().length === 0) return;
1780
+ const n = e === e.ownerDocument.scrollingElement ? 0 : e.getBoundingClientRect().top + e.clientTop, { scrollMarginTop: r, scrollMarginBottom: o } = getComputedStyle(t), i = Number.parseFloat(r), a = t.getBoundingClientRect(), c = a.height + i + Number.parseFloat(o) > e.clientHeight;
1781
+ if (!c && Math.abs(a.top - i - n) < 1) {
1782
+ t.scrollIntoView(ft);
1783
+ return;
1784
+ }
1785
+ e.scrollBy({ top: c ? a.top - n - e.clientHeight : a.bottom - n + e.clientHeight, behavior: "instant" }), t.scrollIntoView(ft);
1786
+ }, Qi = (e, t) => {
1787
+ const n = t.scrollerOf(e, e.querySelector(Ze) ?? e);
1788
+ n.getClientRects().length !== 0 && (n.scrollTo({ top: 0, left: 0, behavior: "instant" }), t.reveal(n));
1789
+ }, Qt = (e, t, n) => {
1790
+ if (e === null) return null;
1791
+ const r = Wn(e, t);
1792
+ return r === null ? (Zi(t) && Qi(e, n), null) : (Xi(e, r), Ji(n.scrollerOf(e, r), r), n.reveal(r), r);
1793
+ };
1794
+ function ea({
1795
+ title: e,
1796
+ titleId: t,
1797
+ ...n
1798
+ }, r) {
1799
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1800
+ xmlns: "http://www.w3.org/2000/svg",
1801
+ viewBox: "0 0 20 20",
1802
+ fill: "currentColor",
1803
+ "aria-hidden": "true",
1804
+ "data-slot": "icon",
1805
+ ref: r,
1806
+ "aria-labelledby": t
1807
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1808
+ id: t
1809
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1810
+ 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"
1811
+ }));
1812
+ }
1813
+ const ta = /* @__PURE__ */ y.forwardRef(ea);
1814
+ function na({
1815
+ title: e,
1816
+ titleId: t,
1817
+ ...n
1818
+ }, r) {
1819
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1820
+ xmlns: "http://www.w3.org/2000/svg",
1821
+ viewBox: "0 0 20 20",
1822
+ fill: "currentColor",
1823
+ "aria-hidden": "true",
1824
+ "data-slot": "icon",
1825
+ ref: r,
1826
+ "aria-labelledby": t
1827
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1828
+ id: t
1829
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1830
+ d: "M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"
1831
+ }), /* @__PURE__ */ y.createElement("path", {
1832
+ fillRule: "evenodd",
1833
+ 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",
1834
+ clipRule: "evenodd"
1835
+ }));
1836
+ }
1837
+ const ra = /* @__PURE__ */ y.forwardRef(na);
1838
+ function oa({
1839
+ title: e,
1840
+ titleId: t,
1841
+ ...n
1842
+ }, r) {
1843
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1844
+ xmlns: "http://www.w3.org/2000/svg",
1845
+ viewBox: "0 0 20 20",
1846
+ fill: "currentColor",
1847
+ "aria-hidden": "true",
1848
+ "data-slot": "icon",
1849
+ ref: r,
1850
+ "aria-labelledby": t
1851
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1852
+ id: t
1853
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1854
+ 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"
1855
+ }), /* @__PURE__ */ y.createElement("path", {
1856
+ fillRule: "evenodd",
1857
+ 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",
1858
+ clipRule: "evenodd"
1859
+ }));
1860
+ }
1861
+ const ia = /* @__PURE__ */ y.forwardRef(oa);
1862
+ function aa({
1863
+ title: e,
1864
+ titleId: t,
1865
+ ...n
1866
+ }, r) {
1867
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
1868
+ xmlns: "http://www.w3.org/2000/svg",
1869
+ viewBox: "0 0 20 20",
1870
+ fill: "currentColor",
1871
+ "aria-hidden": "true",
1872
+ "data-slot": "icon",
1873
+ ref: r,
1874
+ "aria-labelledby": t
1875
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
1876
+ id: t
1877
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
1878
+ fillRule: "evenodd",
1879
+ 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",
1880
+ clipRule: "evenodd"
1881
+ }));
1882
+ }
1883
+ const la = /* @__PURE__ */ y.forwardRef(aa), mt = "data-aqmx-key-repeat", ht = Object.freeze({ [mt]: "allow" }), sa = `[${mt}="${ht[mt]}"]`, ca = () => {
1884
+ let e = null;
1885
+ return {
1886
+ onKeyDownCapture: (t) => {
1887
+ if (t.key === "Enter") {
1888
+ if (!t.repeat) {
1889
+ e = t.target instanceof Element ? t.target : null;
1890
+ return;
1891
+ }
1892
+ e !== null && t.target === e && e.closest(sa) !== null || (t.preventDefault(), t.stopPropagation());
1893
+ }
1894
+ },
1895
+ onKeyUpCapture: (t) => {
1896
+ t.key === "Enter" && (e = null);
1897
+ },
1898
+ onBlurCapture: (t) => {
1899
+ t.target === e && (e = null);
1900
+ }
1901
+ };
1902
+ }, qe = Object.freeze([1 / be ** 2, 1 / be, 1, be, be ** 2]), en = Object.freeze({ mode: "fit" }), da = 1, Kn = Object.freeze({ className: "aqmx-document-canvas", "data-testid": "markdown-explorer-image-canvas" }), tn = `[data-testid="${Kn["data-testid"]}"]`, ua = he(null), fa = (e, t) => e.width > 0 && e.height > 0 && t.width - e.width <= da ? { base: e, scale: t.width / e.width } : t.width > 0 && t.height > 0 ? { base: t, scale: 1 } : null, nn = (e, t, n) => {
1903
+ if (e.mode === "level") {
1904
+ const o = e.index + n;
1905
+ return o >= 0 && o < qe.length ? o : null;
1906
+ }
1907
+ if (t === null || !Number.isFinite(t) || t <= 0) return null;
1908
+ const r = n === 1 ? qe.findIndex((o) => o > t) : qe.findLastIndex((o) => o < t);
1909
+ return r === -1 ? null : r;
1910
+ }, rn = (e, t, n) => {
1911
+ if (e.mode === "level") {
1912
+ const o = nn(e, null, n);
1913
+ return o === null ? null : { mode: "level", index: o, base: e.base };
1914
+ }
1915
+ if (t === null) return null;
1916
+ const r = nn(e, t.scale, n);
1917
+ return r === null ? null : { mode: "level", index: r, base: t.base };
1918
+ }, ma = (e, t) => {
1919
+ if (e <= 0 || t <= 0) return 0;
1920
+ const n = Math.trunc(Math.log(t / e) / Math.log(be));
1921
+ return n === 0 ? 0 : n;
1922
+ }, on = (e) => {
1923
+ const t = e[0], n = e[1];
1924
+ 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 } };
1925
+ }, ha = (e) => {
1926
+ const t = qe[e];
1927
+ if (t === void 0) throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);
1928
+ return t;
1929
+ }, an = (e, t, n) => e !== null && e.width === t && e.height === n ? e : { width: t, height: n }, pa = ({ document: e }) => {
1930
+ const { labels: t } = F(), n = oe(ua), [r] = U(() => n === null ? null : n.read(e.url)), [o, i] = U(r === null ? en : r.zoom), [a, c] = U(r === null ? null : r.reported), [f, w] = U(null), l = B(null), u = I((D) => {
1931
+ const { naturalWidth: d, naturalHeight: m } = D;
1932
+ c((k) => an(k, d, m));
1933
+ }, []), p = I(
1934
+ (D) => {
1935
+ l.current = D, !(D === null || !D.complete) && (D.naturalWidth > 0 || D.naturalHeight > 0 ? u(D) : D.decode().then(
1936
+ () => u(D),
1937
+ () => {
1938
+ }
1939
+ ));
1940
+ },
1941
+ [u]
1942
+ );
1943
+ ee(() => {
1944
+ n !== null && a !== null && n.save(e.url, { zoom: o, reported: a });
1945
+ }, [n, e.url, o, a]), K(() => {
1946
+ const D = l.current;
1947
+ if (D === null || a === null || o.mode !== "fit") return;
1948
+ const d = () => w((k) => an(k, D.clientWidth, D.clientHeight));
1949
+ if (d(), typeof ResizeObserver > "u") return;
1950
+ const m = new ResizeObserver(d);
1951
+ return m.observe(D), () => m.disconnect();
1952
+ }, [a, o.mode]);
1953
+ const g = a === null || f === null ? null : fa(a, f), b = rn(o, g, -1), x = rn(o, g, 1), R = o.mode === "level" ? ha(o.index) : null, A = B({ zoomIn: x, zoomOut: b });
1954
+ K(() => {
1955
+ A.current = { zoomIn: x, zoomOut: b };
1956
+ });
1957
+ const N = B(null);
1958
+ K(() => {
1959
+ const D = N.current, d = l.current?.closest(tn);
1960
+ N.current = null, !(D === null || d === null || d === void 0) && (d.scrollLeft = D.across * d.scrollWidth - D.x, d.scrollTop = D.down * d.scrollHeight - D.y);
1961
+ }, [o]), ee(() => {
1962
+ const D = l.current?.closest(tn);
1963
+ if (D == null) return;
1964
+ let d = null;
1965
+ const m = ($) => {
1966
+ const q = on($.touches);
1967
+ d = q === null ? null : { distance: q.distance, steps: 0 };
1968
+ }, k = ($) => {
1969
+ const q = on($.touches);
1970
+ if (d === null || q === null) return;
1971
+ $.preventDefault();
1972
+ const v = ma(d.distance, q.distance);
1973
+ if (v === d.steps) return;
1974
+ const T = v > d.steps ? 1 : -1, L = T === 1 ? A.current.zoomIn : A.current.zoomOut;
1975
+ if (L === null) return;
1976
+ d.steps += T;
1977
+ const O = D.getBoundingClientRect(), P = q.middle.x - O.left, j = q.middle.y - O.top;
1978
+ N.current = D.scrollWidth > 0 && D.scrollHeight > 0 ? { x: P, y: j, across: (D.scrollLeft + P) / D.scrollWidth, down: (D.scrollTop + j) / D.scrollHeight } : null, i(L);
1979
+ }, M = ($) => {
1980
+ $.touches.length < 2 && (d = null);
1981
+ };
1982
+ return D.addEventListener("touchstart", m, { passive: !0 }), D.addEventListener("touchmove", k, { passive: !1 }), D.addEventListener("touchend", M, { passive: !0 }), D.addEventListener("touchcancel", M, { passive: !0 }), () => {
1983
+ D.removeEventListener("touchstart", m), D.removeEventListener("touchmove", k), D.removeEventListener("touchend", M), D.removeEventListener("touchcancel", M);
1984
+ };
1985
+ }, []);
1986
+ const _ = o.mode === "level" && R !== null ? { width: `${o.base.width * R}px`, height: `${o.base.height * R}px` } : void 0;
1987
+ return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-image-view", children: [
1988
+ /* @__PURE__ */ H(Le, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: /* @__PURE__ */ s(la, {}), children: [
1989
+ /* @__PURE__ */ s(
1990
+ "button",
1991
+ {
1992
+ type: "button",
1993
+ className: "aqmx-icon-button",
1994
+ "aria-label": t.imageZoomOut,
1995
+ title: t.imageZoomOut,
1996
+ "aria-disabled": b === null,
1997
+ onClick: () => {
1998
+ b !== null && i(b);
1999
+ },
2000
+ ...ht,
2001
+ children: /* @__PURE__ */ s(ra, {})
2002
+ }
2003
+ ),
2004
+ /* @__PURE__ */ s("output", { className: "aqmx-document-level", "aria-live": "polite", "data-testid": "markdown-explorer-image-level", children: R === null ? t.imageFitLevel : t.imageZoomLevel(Math.round(R * 100)) }),
2005
+ /* @__PURE__ */ s(
2006
+ "button",
2007
+ {
2008
+ type: "button",
2009
+ className: "aqmx-icon-button",
2010
+ "aria-label": t.imageZoomIn,
2011
+ title: t.imageZoomIn,
2012
+ "aria-disabled": x === null,
2013
+ onClick: () => {
2014
+ x !== null && i(x);
2015
+ },
2016
+ ...ht,
2017
+ children: /* @__PURE__ */ s(ia, {})
2018
+ }
2019
+ ),
2020
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-icon-button", "aria-label": t.imageFit, title: t.imageFit, "aria-pressed": o.mode === "fit", onClick: () => i(en), children: /* @__PURE__ */ s(ta, {}) })
2021
+ ] }),
2022
+ /* @__PURE__ */ s(Me, { scrollerProps: Kn, children: /* @__PURE__ */ s("img", { ref: p, className: "aqmx-document-image", src: e.url, alt: e.name, "data-aqmx-image-mode": o.mode, style: _, onLoad: (D) => u(D.currentTarget), "data-testid": "markdown-explorer-image" }) })
2023
+ ] });
2024
+ }, wa = async (e, t, n) => {
2025
+ const r = await e.text(t, n);
2026
+ if (!("kind" in r)) throw n.reason;
2027
+ return r.kind === "text" ? { kind: "text", text: r.text, truncated: r.truncated } : { kind: "failure", retryable: r.failure.reason === "failed" };
2028
+ }, Yn = he(null), Ge = he(void 0), Xn = he(null), We = () => {
2029
+ const e = oe(Yn);
2030
+ if (e === null) throw new Error("[markdown-explorer] document links must be rendered inside a document pane");
2031
+ return e;
2032
+ }, ga = () => {
2033
+ const e = oe(Xn);
2034
+ if (e === null) throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");
2035
+ return e;
2036
+ }, Ke = (e, t, n, r) => t.kind === "panel" ? ye(e, { view: "tree", source: n, doc: r }) : t.view === "single" ? ye(e, { view: "single", source: n, doc: r, overrides: t.overrides, embed: t.embed }) : ye(e, { view: "tree", source: n, doc: r, overrides: t.overrides }), va = ({ children: e }) => {
2037
+ const { config: t } = F(), n = We(), r = bt(), o = r.kind === "location" ? r.location.source : void 0, i = ze(Ke(t, n.navigation, o, n.currentPath));
2038
+ return /* @__PURE__ */ s(Ge, { value: o, children: /* @__PURE__ */ s(Xn, { value: i, children: e }) });
2039
+ }, ba = 'a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])', Ea = (e) => {
2040
+ const t = e instanceof Element ? e.closest(ba) : null;
2041
+ return t === null ? null : t.getAttribute("data-doc-path");
2042
+ }, Ye = (e) => !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey, ya = ({ to: e, docPath: t, fragment: n, exists: r, className: o, attributes: i, onDocumentLink: a, scope: c, children: f }) => {
2043
+ const w = ze(e);
2044
+ return /* @__PURE__ */ s("a", { ...i, href: w, className: o, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": r, onClick: (u) => {
2045
+ if (Ye(u)) {
2046
+ if (u.preventDefault(), t === c.currentPath && n !== "") {
2047
+ c.scrollWithin(n);
2048
+ return;
2049
+ }
2050
+ a(t, n);
2051
+ }
2052
+ }, children: f });
2053
+ }, Sa = ({ href: e, docPath: t, docExists: n, className: r, attributes: o, children: i }) => {
2054
+ const { config: a } = F(), c = We(), f = oe(Ge), w = Vi(e), { navigation: l } = c, u = `${Ke(a, l, f, t)}${w}`, p = n === !1 ? "false" : void 0;
2055
+ return l.kind === "page" ? /* @__PURE__ */ s(pi, { ...o, to: u, navigation: "follow-link", className: r, "data-link-kind": "doc", "data-doc-path": t, "data-doc-exists": p, children: i }) : /* @__PURE__ */ s(ya, { to: u, docPath: t, fragment: w, exists: p, className: r, attributes: o, onDocumentLink: l.onDocumentLink, scope: c, children: i });
2056
+ }, ka = ({ className: e, attributes: t, children: n }) => {
2057
+ const { labels: r } = F();
2058
+ return (
2059
+ /* @__PURE__ */ H("a", { ...t, className: e === void 0 ? "aqmx-document-inert-link" : `${e} aqmx-document-inert-link`, title: r.inertLink, "data-link-kind": "doc", "data-doc-exists": "false", children: [
2060
+ n,
2061
+ /* @__PURE__ */ H("span", { className: "aqmx-sr-only", children: [
2062
+ " (",
2063
+ r.inertLink,
2064
+ ")"
2065
+ ] })
2066
+ ] })
2067
+ );
2068
+ }, xa = ({ href: e, className: t, attributes: n, scope: r, children: o }) => {
2069
+ const { config: i } = F(), a = oe(Ge), c = ze(`${Ke(i, r.navigation, a, r.currentPath)}${e}`);
2070
+ return /* @__PURE__ */ s("a", { ...n, href: c, className: t, onClick: (w) => {
2071
+ Ye(w) && (w.preventDefault(), r.scrollWithin(e));
2072
+ }, children: o });
2073
+ }, Ta = ({ href: e, className: t, attributes: n, children: r }) => {
2074
+ const o = We();
2075
+ return o.navigation.kind === "page" ? /* @__PURE__ */ s("a", { ...n, href: e, className: t, onClick: (a) => {
2076
+ if (!Ye(a)) return;
2077
+ const c = a.currentTarget;
2078
+ e === "#" ? o.followEmptyFragment(a.nativeEvent) : c.href === c.ownerDocument.URL && o.followSameUrlJump(e, a.nativeEvent);
2079
+ }, children: r }) : /* @__PURE__ */ s(xa, { href: e, className: t, attributes: n, scope: o, children: r });
2080
+ }, Ra = ({ href: e, kind: t, docPath: n, docExists: r, className: o, attributes: i, children: a }) => t === "doc" ? n === void 0 || !Ir(n) ? /* @__PURE__ */ s(ka, { className: o, attributes: i, children: a }) : /* @__PURE__ */ s(Sa, { href: e, docPath: n, docExists: r, className: o, attributes: i, children: a }) : e.startsWith("#") ? /* @__PURE__ */ s(Ta, { href: e, className: o, attributes: i, children: a }) : /* @__PURE__ */ s("a", { ...i, href: e, className: o, children: a }), Oa = () => {
2081
+ const { config: e } = F(), t = We(), n = oe(Ge), r = Ve();
2082
+ return I(
2083
+ (o, i) => {
2084
+ if (!Ye(i)) return !0;
2085
+ i.preventDefault();
2086
+ const a = Zn(o.id), { navigation: c } = t;
2087
+ return c.kind === "panel" || kt(i.currentTarget.ownerDocument.location.hash) === o.id ? (t.scrollWithin(a), !0) : (r(`${Ke(e, c, n, t.currentPath)}${a}`, "follow-link"), !0);
2088
+ },
2089
+ [e, t, n, r]
2090
+ );
2091
+ }, Ca = () => {
2092
+ const e = ga();
2093
+ return I((t) => `${e}${Zn(t.id)}`, [e]);
2094
+ };
2095
+ function Ma({
2096
+ title: e,
2097
+ titleId: t,
2098
+ ...n
2099
+ }, r) {
2100
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2101
+ xmlns: "http://www.w3.org/2000/svg",
2102
+ viewBox: "0 0 20 20",
2103
+ fill: "currentColor",
2104
+ "aria-hidden": "true",
2105
+ "data-slot": "icon",
2106
+ ref: r,
2107
+ "aria-labelledby": t
2108
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2109
+ id: t
2110
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2111
+ 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"
2112
+ }));
2113
+ }
2114
+ const La = /* @__PURE__ */ y.forwardRef(Ma);
2115
+ function Aa({
2116
+ title: e,
2117
+ titleId: t,
2118
+ ...n
2119
+ }, r) {
2120
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2121
+ xmlns: "http://www.w3.org/2000/svg",
2122
+ viewBox: "0 0 20 20",
2123
+ fill: "currentColor",
2124
+ "aria-hidden": "true",
2125
+ "data-slot": "icon",
2126
+ ref: r,
2127
+ "aria-labelledby": t
2128
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2129
+ id: t
2130
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2131
+ fillRule: "evenodd",
2132
+ 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",
2133
+ clipRule: "evenodd"
2134
+ }));
2135
+ }
2136
+ const Na = /* @__PURE__ */ y.forwardRef(Aa);
2137
+ function Da({
2138
+ title: e,
2139
+ titleId: t,
2140
+ ...n
2141
+ }, r) {
2142
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2143
+ xmlns: "http://www.w3.org/2000/svg",
2144
+ viewBox: "0 0 20 20",
2145
+ fill: "currentColor",
2146
+ "aria-hidden": "true",
2147
+ "data-slot": "icon",
2148
+ ref: r,
2149
+ "aria-labelledby": t
2150
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2151
+ id: t
2152
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2153
+ fillRule: "evenodd",
2154
+ 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",
2155
+ clipRule: "evenodd"
2156
+ }));
2157
+ }
2158
+ const Pa = /* @__PURE__ */ y.forwardRef(Da), $a = Object.freeze({ className: "aqmx-document-stage" }), Fa = () => () => {
2159
+ }, qa = () => navigator.pdfViewerEnabled !== !1, Ia = () => null, _a = ({ document: e }) => {
2160
+ const { labels: t } = F(), n = re(Fa, qa, Ia);
2161
+ return n === null ? null : n ? /* @__PURE__ */ s("iframe", { className: "aqmx-document-frame", src: e.url, title: e.name, "data-testid": "markdown-explorer-media-player" }) : /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-pdf-not-shown", children: [
2162
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: t.pdfNotShown }),
2163
+ /* @__PURE__ */ H("div", { className: "aqmx-callout-actions", children: [
2164
+ /* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: e.url, target: "_blank", rel: "noopener noreferrer", "data-testid": "markdown-explorer-pdf-not-shown-open", children: t.openInNewTab }),
2165
+ /* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: e.url, download: e.name, "data-testid": "markdown-explorer-pdf-not-shown-download", children: t.download })
2166
+ ] })
2167
+ ] });
2168
+ }, Ba = (e) => {
2169
+ switch (e) {
2170
+ case "video":
2171
+ return /* @__PURE__ */ s(Na, {});
2172
+ case "audio":
2173
+ return /* @__PURE__ */ s(Pa, {});
2174
+ case "pdf":
2175
+ return /* @__PURE__ */ s(La, {});
2176
+ default: {
2177
+ const t = e;
2178
+ throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`);
2179
+ }
2180
+ }
2181
+ }, Ha = ({ document: e }) => {
2182
+ const { labels: t } = F();
2183
+ switch (e.mediaType) {
2184
+ case "video":
2185
+ return (
2186
+ /* @__PURE__ */ s("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 })
2187
+ );
2188
+ case "audio":
2189
+ return (
2190
+ /* @__PURE__ */ s("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 })
2191
+ );
2192
+ case "pdf":
2193
+ return /* @__PURE__ */ s(_a, { document: e });
2194
+ default: {
2195
+ const n = e.mediaType;
2196
+ throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`);
2197
+ }
2198
+ }
2199
+ }, ja = ({ document: e }) => /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-media-view", "data-aqmx-media-type": e.mediaType, children: [
2200
+ /* @__PURE__ */ s(Le, { name: e.name, openUrl: e.url, downloadUrl: e.url, icon: Ba(e.mediaType) }),
2201
+ /* @__PURE__ */ s(Me, { scrollerProps: $a, children: /* @__PURE__ */ s(Ha, { document: e }) })
2202
+ ] }), xt = (e) => {
2203
+ switch (e.kind) {
2204
+ case "markdown":
2205
+ return "markdown";
2206
+ case "image":
2207
+ return e.imageType === "svg" ? "svg" : null;
2208
+ case "spreadsheet":
2209
+ return e.format;
2210
+ default:
2211
+ return null;
2212
+ }
2213
+ }, za = (e) => {
2214
+ const { documents: t } = F(), n = I(() => t.peek(e), [t, e]), r = I(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), i = fe(o);
2215
+ return i === null ? null : xt(i.document);
2216
+ }, Va = (e) => {
2217
+ const { config: t } = F(), n = Ve(), r = I(() => n(ye(t, { ...e, markup: !e.markup }), "browse"), [t, n, e]);
2218
+ return Y(() => ({ shown: e.markup, toggle: r }), [e.markup, r]);
2219
+ };
2220
+ function Ua({
2221
+ title: e,
2222
+ titleId: t,
2223
+ ...n
2224
+ }, r) {
2225
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2226
+ xmlns: "http://www.w3.org/2000/svg",
2227
+ viewBox: "0 0 20 20",
2228
+ fill: "currentColor",
2229
+ "aria-hidden": "true",
2230
+ "data-slot": "icon",
2231
+ ref: r,
2232
+ "aria-labelledby": t
2233
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2234
+ id: t
2235
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2236
+ fillRule: "evenodd",
2237
+ 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",
2238
+ clipRule: "evenodd"
2239
+ }));
2240
+ }
2241
+ const Za = /* @__PURE__ */ y.forwardRef(Ua), Ga = 100, Wa = 32767, Ka = Object.freeze({ maxCells: Bt, maxColumns: Bt / Ga, maxCellLength: Wa }), Jn = 44, Qn = 10, er = 13, Pe = '"', ln = (e, t) => {
2242
+ let n = t;
2243
+ for (; n < e.length; ) {
2244
+ const r = e.charCodeAt(n);
2245
+ if (r === Jn || r === Qn || r === er) return n;
2246
+ n += 1;
2247
+ }
2248
+ return n;
2249
+ };
2250
+ function* Ya(e, t) {
2251
+ let n = [], r = 0;
2252
+ for (; ; ) {
2253
+ let o;
2254
+ if (e.startsWith(Pe, r)) {
2255
+ o = "";
2256
+ let a = r + 1;
2257
+ for (; ; ) {
2258
+ const f = e.indexOf(Pe, a);
2259
+ if (f < 0) {
2260
+ o += e.slice(a), r = e.length;
2261
+ break;
2262
+ }
2263
+ if (o += e.slice(a, f), e.startsWith(Pe, f + 1)) {
2264
+ o += Pe, a = f + 2;
2265
+ continue;
2266
+ }
2267
+ r = f + 1;
2268
+ break;
2269
+ }
2270
+ const c = ln(e, r);
2271
+ o += e.slice(r, c), r = c;
2272
+ } else {
2273
+ const a = ln(e, r);
2274
+ o = e.slice(r, a), r = a;
2275
+ }
2276
+ if (n.push(o), r >= e.length) {
2277
+ t === "whole" && (yield n);
2278
+ return;
2279
+ }
2280
+ const i = e.charCodeAt(r);
2281
+ if (r += 1, i !== Jn && (yield n, n = [], i === er && e.charCodeAt(r) === Qn && (r += 1), r >= e.length))
2282
+ return;
2283
+ }
2284
+ }
2285
+ const Xa = (e, t, n) => t === "csv" ? Ya(e, n) : n === "whole" ? oo(e) : io(e), Ja = (e, t) => {
2286
+ if (e.length <= t) return e;
2287
+ const n = e.charCodeAt(t - 1);
2288
+ return e.slice(0, n >= 55296 && n <= 56319 ? t - 1 : t);
2289
+ }, Qa = (e, t) => {
2290
+ const n = [];
2291
+ let r = 0, o = !1, i = !1;
2292
+ for (const c of e) {
2293
+ const f = c.length > t.maxColumns ? c.slice(0, t.maxColumns) : c, w = Math.max(r, f.length);
2294
+ if ((n.length + 1) * w > t.maxCells) {
2295
+ i = !0;
2296
+ break;
2297
+ }
2298
+ const l = f.some((u) => u.length > t.maxCellLength) ? f.map((u) => Ja(u, t.maxCellLength)) : f;
2299
+ l !== c && (o = !0), n.push(l), r = w;
2300
+ }
2301
+ return { rows: n.map((c) => c.length === r ? c : [...c, ...Array(r - c.length).fill("")]), truncated: i || o, full: i };
2302
+ }, ot = (e, t, n, r, o) => {
2303
+ const i = Lr(e, t, r);
2304
+ if (i === null) return { kind: "unreadable", code: "encoding", encodings: Ar(e, t, r) };
2305
+ if (i.includes("\0")) return { kind: "unreadable", code: "binary" };
2306
+ const a = Qa(Xa(i, n, t ? "whole" : "prefix"), o);
2307
+ return t ? a.truncated || a.rows.some((c) => c.some((f) => f !== "")) ? { kind: "table", table: a } : { kind: "empty" } : a.rows.length === 0 ? { kind: "unreadable", code: "long-row" } : { kind: "table", table: { ...a, truncated: !0 } };
2308
+ }, tr = 64 * 1024, el = (e) => {
2309
+ let t = new Uint8Array(Math.min(e, tr)), n = 0;
2310
+ return {
2311
+ append: (r) => {
2312
+ if (n + r.byteLength > t.byteLength) {
2313
+ const o = new Uint8Array(Math.min(e, Math.max(t.byteLength * 2, n + r.byteLength)));
2314
+ o.set(t.subarray(0, n)), t = o;
2315
+ }
2316
+ t.set(r, n), n += r.byteLength;
2317
+ },
2318
+ bytes: () => t.subarray(0, n),
2319
+ length: () => n
2320
+ };
2321
+ }, tl = async (e) => {
2322
+ for (; ; ) {
2323
+ const { done: t, value: n } = await e.read();
2324
+ if (t) return !0;
2325
+ if (n.byteLength > 0) return !1;
2326
+ }
2327
+ }, nl = async (e, t) => {
2328
+ const { format: n, legacyEncoding: r, maxBytes: o, budget: i } = t, a = e.getReader(), c = el(o);
2329
+ let f = tr;
2330
+ try {
2331
+ for (; ; ) {
2332
+ const { done: w, value: l } = await a.read();
2333
+ if (w) return ot(c.bytes(), !0, n, r, i);
2334
+ const u = o - c.length();
2335
+ if (c.append(l.byteLength > u ? l.subarray(0, u) : l), c.length() === o) {
2336
+ const g = l.byteLength <= u && await tl(a);
2337
+ return ot(c.bytes(), g, n, r, i);
2338
+ }
2339
+ if (c.length() < f) continue;
2340
+ f = c.length() * 2;
2341
+ const p = ot(c.bytes(), !1, n, r, i);
2342
+ if (p.kind === "unreadable" && p.code !== "long-row" || p.kind === "table" && p.table.full) return p;
2343
+ }
2344
+ } finally {
2345
+ a.cancel().catch(() => {
2346
+ });
2347
+ }
2348
+ }, rl = async (e, t, n, r) => {
2349
+ const o = await e.asset(gt(t), r);
2350
+ if (o.status === "cancelled") return null;
2351
+ if (o.status === "error") return { kind: "failure", failure: o.failure };
2352
+ let i;
2353
+ try {
2354
+ i = await nl(o.body, n);
2355
+ } catch {
2356
+ return r.aborted ? null : { kind: "failure", failure: { reason: "failed" } };
2357
+ }
2358
+ return r.aborted ? null : i.kind === "table" ? { kind: "table", rows: i.table.rows, truncated: i.table.truncated } : i;
2359
+ }, nr = (e, t, n) => {
2360
+ const { documents: r, labels: o } = F(), i = $i(), a = I(() => r.answerStampOf(e), [r, e]), c = re(r.subscribe, a, a), [f, w] = U(0), l = Y(() => ({ read: n, stamp: c, attempt: f }), [n, c, f]), [u, p] = U({ settled: null, shown: null, failure: null }), g = B(null), b = ae((A, N) => {
2361
+ if (g.current?.settle(N.stamp, A.kind === "failure" ? A.failure : null), A.kind === "read") {
2362
+ p({ settled: N, shown: A.value, failure: null });
2363
+ return;
2364
+ }
2365
+ if (u.shown !== null) {
2366
+ p({ settled: N, shown: u.shown, failure: null });
2367
+ return;
2368
+ }
2369
+ p({ settled: N, shown: null, failure: A.failure }), i.announceFailure(o.documentFailed(t, le(o, A.failure.reason)));
2370
+ });
2371
+ ee(() => {
2372
+ const A = i.readPart();
2373
+ return g.current = A, () => {
2374
+ g.current = null, A.release();
2375
+ };
2376
+ }, [i]), ee(() => {
2377
+ const A = new AbortController();
2378
+ return l.read(A.signal).then((N) => {
2379
+ N !== null && !A.signal.aborted && b(N, l);
2380
+ }), () => A.abort();
2381
+ }, [l]);
2382
+ const x = u.settled !== l && (u.shown !== null || u.failure !== null);
2383
+ K(() => x ? i.holdBusy() : void 0, [x, i]);
2384
+ const R = I(() => w((A) => A + 1), []);
2385
+ return { shown: u.shown, failure: u.failure, retry: R };
2386
+ }, rr = (e, t) => {
2387
+ const n = {};
2388
+ for (const r of Object.keys(Ie[t])) {
2389
+ const o = e[vt(r)];
2390
+ o !== Ie[t][r].text && (n[r] = o);
2391
+ }
2392
+ return n;
2393
+ }, ol = (e, t) => Object.fromEntries(Object.entries(rr(e, t)).map(([n, r]) => [`spreadsheet${n.charAt(0).toUpperCase()}${n.slice(1)}`, r])), il = (e, t) => ({
2394
+ ...ol(e, t),
2395
+ loading: e.viewerLoading,
2396
+ errorPrefix: e.viewerErrorPrefix,
2397
+ styleTitle: e.viewerStyleTitle,
2398
+ selectStyleAria: e.viewerSelectStyle,
2399
+ pinStyleAria: e.viewerPinStyle,
2400
+ unpinStyleAria: e.viewerUnpinStyle,
2401
+ defaultErrorTitle: e.viewerErrorTitle,
2402
+ missingImage: e.viewerMissingImage,
2403
+ openTocAria: e.viewerOpenToc,
2404
+ tocTitle: e.viewerTocTitle,
2405
+ pinTocAria: e.viewerPinToc,
2406
+ unpinTocAria: e.viewerUnpinToc,
2407
+ selectAlignAria: e.viewerSelectAlign,
2408
+ alignTitle: e.viewerAlignTitle,
2409
+ pinAlignAria: e.viewerPinAlign,
2410
+ unpinAlignAria: e.viewerUnpinAlign,
2411
+ alignLeft: e.viewerAlignLeft,
2412
+ alignCenter: e.viewerAlignCenter,
2413
+ alignRight: e.viewerAlignRight,
2414
+ mermaidInteractionMode: e.viewerMermaidInteractionMode,
2415
+ mermaidInteractionModeTouch: e.viewerMermaidInteractionModeTouch,
2416
+ mermaidModeNone: e.viewerMermaidModeNone,
2417
+ mermaidModeZoom: e.viewerMermaidModeZoom,
2418
+ mermaidModePan: e.viewerMermaidModePan,
2419
+ mermaidModePanShift: e.viewerMermaidModePanShift,
2420
+ mermaidModeBoth: e.viewerMermaidModeBoth,
2421
+ mermaidModeBothShift: e.viewerMermaidModeBothShift,
2422
+ mermaidModeNoneTouch: e.viewerMermaidModeNoneTouch,
2423
+ mermaidModeZoomTouch: e.viewerMermaidModeZoomTouch,
2424
+ mermaidModePanTouch: e.viewerMermaidModePanTouch,
2425
+ mermaidModeBothTouch: e.viewerMermaidModeBothTouch,
2426
+ mermaidZoomIn: e.viewerMermaidZoomIn,
2427
+ mermaidZoomOut: e.viewerMermaidZoomOut,
2428
+ mermaidResetView: e.viewerMermaidResetView,
2429
+ mermaidPanUp: e.viewerMermaidPanUp,
2430
+ mermaidPanDown: e.viewerMermaidPanDown,
2431
+ mermaidPanLeft: e.viewerMermaidPanLeft,
2432
+ mermaidPanRight: e.viewerMermaidPanRight,
2433
+ mermaidDiagram: e.viewerMermaidDiagram,
2434
+ mermaidRetry: e.viewerMermaidRetry,
2435
+ embeddedVideo: e.viewerEmbeddedVideo,
2436
+ embeddedPost: e.viewerEmbeddedPost,
2437
+ embeddedFrame: e.viewerEmbeddedFrame,
2438
+ blockFailed: e.viewerBlockFailed,
2439
+ svgImageToolbar: e.viewerSvgImageToolbar,
2440
+ svgImageSource: e.viewerSvgImageSource,
2441
+ svgImageSourceRegion: e.viewerSvgImageSourceRegion,
2442
+ svgImageLoading: e.viewerSvgImageLoading,
2443
+ svgImageFailed: e.viewerSvgImageFailed,
2444
+ svgImageRetry: e.viewerSvgImageRetry,
2445
+ svgImageTruncated: e.viewerSvgImageTruncated,
2446
+ svgImageCopy: e.viewerSvgImageCopy,
2447
+ svgImageCopied: e.viewerSvgImageCopied,
2448
+ svgImageCopyFailed: e.viewerSvgImageCopyFailed
2449
+ }), or = (e, t, n) => {
2450
+ if (t !== void 0) return t;
2451
+ if (n !== void 0) return n;
2452
+ const [r] = e.documentStyles;
2453
+ if (r === void 0) throw new Error("[markdown-explorer] the configuration has no document style");
2454
+ return r.name;
2455
+ }, ir = (e, t) => e !== void 0 ? e : t !== void 0 ? t : lo, al = Object.freeze({ className: "aqmx-document-spreadsheet-body", "data-aqmx-document-scroller": "" }), ll = (e, t) => {
2456
+ switch (t.code) {
2457
+ case "encoding":
2458
+ return e.spreadsheetUnreadableEncoding(t.encodings);
2459
+ case "binary":
2460
+ return e.spreadsheetNotText;
2461
+ case "long-row":
2462
+ return e.spreadsheetLongRow;
2463
+ }
2464
+ }, sl = ({ path: e, document: t }) => {
2465
+ const { config: n, data: r, labels: o, locale: i, theme: a } = F(), c = oe(me), { name: f, url: w, format: l } = t, u = Y(() => ({ format: l, legacyEncoding: n.legacyTextEncoding, maxBytes: n.spreadsheets.maxBytes, budget: Ka }), [l, n.legacyTextEncoding, n.spreadsheets.maxBytes]), p = I(
2466
+ async (N) => {
2467
+ const _ = await rl(r, w, u, N);
2468
+ return _ === null || _.kind === "failure" ? _ : { kind: "read", value: _ };
2469
+ },
2470
+ [r, w, u]
2471
+ ), { shown: g, failure: b, retry: x } = nr(e, f, p), R = Y(() => ({ ...rr(o, i), table: f, fullscreenDialog: o.spreadsheetFullscreen(f) }), [o, i, f]), A = Y(() => g?.kind === "table" ? ao(g.rows) : null, [g]);
2472
+ return /* @__PURE__ */ H("div", { className: "aqmx-document-file", "data-testid": "markdown-explorer-spreadsheet-view", "data-aqmx-spreadsheet": g === null ? b === null ? "loading" : "failure" : g.kind, children: [
2473
+ /* @__PURE__ */ s(Le, { name: f, openUrl: gt(w), downloadUrl: w, icon: /* @__PURE__ */ s(Za, {}) }),
2474
+ /* @__PURE__ */ s(Me, { scrollerProps: al, children: /* @__PURE__ */ H("div", { className: "aqmx-document-spreadsheet-column", children: [
2475
+ t.firstSheetOnly ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-first-sheet", children: o.spreadsheetFirstSheetOnly }) : null,
2476
+ g?.kind === "table" && g.truncated ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-spreadsheet-truncated", children: o.spreadsheetTruncated }) : null,
2477
+ g === null && b === null ? /* @__PURE__ */ s(Ue, { label: o.spreadsheetLoading, testId: "markdown-explorer-spreadsheet-skeleton" }) : null,
2478
+ g === null && b !== null ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-failure", children: /* @__PURE__ */ s(Te, { failure: b, alert: !1, onRetry: x, testId: "markdown-explorer-spreadsheet-failure" }) }) : null,
2479
+ g?.kind === "empty" ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-stage", children: /* @__PURE__ */ s("p", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-spreadsheet-empty", children: o.spreadsheetEmpty }) }) : null,
2480
+ g?.kind === "unreadable" ? /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet-stage", children: /* @__PURE__ */ H("div", { className: "aqmx-callout", role: "note", "data-testid": "markdown-explorer-spreadsheet-unreadable", "data-aqmx-unreadable": g.code, children: [
2481
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: ll(o, g) }),
2482
+ /* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: w, download: f, "data-testid": "markdown-explorer-spreadsheet-unreadable-download", children: o.download })
2483
+ ] }) }) : null,
2484
+ A === null ? null : (
2485
+ /* @__PURE__ */ s("div", { className: "aqmx-document-spreadsheet", "data-theme": a, children: /* @__PURE__ */ s(to, { tsv: A, layout: c === "fill" ? "fill" : "inline", locale: i, labels: R }) })
2486
+ )
2487
+ ] }) })
2488
+ ] });
2489
+ }, cl = Object.freeze({ kind: "empty" }), dl = (e, t, n) => {
2490
+ if (t.view === "multi" || t.overrides[n] === void 0) return null;
2491
+ const r = n === "style" ? { align: t.overrides.align } : { style: t.overrides.style };
2492
+ return ye(e, { ...t, overrides: r });
2493
+ }, Se = ({ kind: e, view: t, label: n, stale: r, busy: o, frameRef: i, intent: a, children: c }) => {
2494
+ const f = oe(me);
2495
+ return (
2496
+ /* @__PURE__ */ H("section", { ref: i, 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": f, className: "aqmx-document", ...a, children: [
2497
+ r ? /* @__PURE__ */ s("div", { className: "aqmx-progress", "aria-hidden": "true", "data-testid": "markdown-explorer-document-progress" }) : null,
2498
+ c
2499
+ ] })
2500
+ );
2501
+ }, ul = ({ absence: e, announces: t, announceFailure: n }) => {
2502
+ const { labels: r, announcer: o } = F(), i = e.kind === "no-readme" ? e.folder : null, a = e.kind === "failure" ? e.folder : null, c = e.kind === "failure" ? e.failure : null;
2503
+ switch (ee(() => {
2504
+ t && i !== null && o.announce(r.folderReadmeMissing(ce(i)));
2505
+ }, [t, i, o, r]), ee(() => {
2506
+ a !== null && c !== null && n(r.documentFailed(ce(a), le(r, c.reason)));
2507
+ }, [a, c, n, r]), e.kind) {
2508
+ case "empty":
2509
+ return /* @__PURE__ */ s(Se, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ s("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-document-empty", children: /* @__PURE__ */ s("p", { className: "aqmx-empty-title", children: r.documentEmpty }) }) });
2510
+ case "loading":
2511
+ return /* @__PURE__ */ s(Tt, { label: r.documentRegion });
2512
+ case "no-readme":
2513
+ return /* @__PURE__ */ s(Se, { kind: "empty", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ s("div", { className: "aqmx-empty", "data-testid": "markdown-explorer-folder-empty", children: /* @__PURE__ */ s("p", { className: "aqmx-empty-title", children: r.folderReadmeMissing(ce(e.folder)) }) }) });
2514
+ case "failure":
2515
+ return /* @__PURE__ */ s(Se, { kind: "failure", label: r.documentRegion, stale: !1, busy: !1, children: /* @__PURE__ */ s(St, { failure: e.failure, onRetry: e.onRetry, testId: "markdown-explorer-folder-failure" }) });
2516
+ }
2517
+ }, Tt = ({ label: e }) => {
2518
+ const { labels: t } = F();
2519
+ return /* @__PURE__ */ s(Se, { kind: "loading", label: e, stale: !1, busy: !0, children: /* @__PURE__ */ s(Ue, { label: t.documentLoading, testId: "markdown-explorer-document-skeleton" }) });
2520
+ }, sn = Object.freeze(["wheel", "touchstart", "pointerdown", "keydown"]), fl = ({ path: e, document: t, viewer: n, editing: r }) => {
2521
+ const { reportMathDiagnostics: o, edits: i } = F(), a = Y(() => ({ htmlContent: t.htmlContent, headings: [...t.headings] }), [t]), c = Oa(), f = Ca(), w = Y(() => o === void 0 ? void 0 : (d) => o(e, d), [o, e]), l = B(null), { editable: u, doubleClick: p, region: g, paneScroll: b, stale: x } = r;
2522
+ K(() => {
2523
+ if (u)
2524
+ return i.bindView(e, {
2525
+ anchor: () => {
2526
+ const d = l.current, m = g(), k = d === null ? null : d.querySelector(Ze);
2527
+ return d === null || m === null || k === null ? null : si(d, b.scrollerOf(m, k));
2528
+ }
2529
+ });
2530
+ }, [i, e, u, g, b]);
2531
+ const R = (d) => {
2532
+ const m = l.current, { target: k } = d;
2533
+ !p || m === null || !(k instanceof Element) || !ai(k) || (d.stopPropagation(), i.start(e, li(k, m, m.ownerDocument.getSelection())));
2534
+ }, A = B(null), N = B(x);
2535
+ K(() => {
2536
+ N.current = x;
2537
+ });
2538
+ const _ = ae((d) => {
2539
+ const m = l.current, k = g(), M = m === null ? null : mi(m, d.line);
2540
+ if (k === null || M === null) return !1;
2541
+ const $ = b.scrollerOf(k, M);
2542
+ return $.scrollTop += hi(M, d.line) - d.clientTop, !0;
2543
+ }), D = ae((d) => {
2544
+ const m = g();
2545
+ if (m === null) return;
2546
+ const k = () => {
2547
+ for (const $ of sn) m.removeEventListener($, M, !0);
2548
+ A.current?.release === k && (A.current = null);
2549
+ }, M = () => k();
2550
+ for (const $ of sn) m.addEventListener($, M, { capture: !0, passive: !0 });
2551
+ A.current = { point: d, release: k };
2552
+ });
2553
+ return K(() => {
2554
+ const d = i.takeReturn(e);
2555
+ if (d !== null)
2556
+ return queueMicrotask(() => {
2557
+ _(d) && N.current && D(d);
2558
+ }), () => A.current?.release();
2559
+ }, [i, e]), K(() => {
2560
+ const d = A.current;
2561
+ d === null || x || (d.release(), _(d.point));
2562
+ }, [t, x]),
2563
+ /* @__PURE__ */ s("div", { ref: l, className: "aqmx-document-viewer", onDoubleClick: R, children: /* @__PURE__ */ s(Tn, { ...n, onHeadingSelect: c, headingHref: f, onMathDiagnostics: w, parseResult: a, content: null }) });
2564
+ }, ar = ({ document: e, viewer: t }) => {
2565
+ const { labels: n } = F();
2566
+ return /* @__PURE__ */ H(je, { children: [
2567
+ /* @__PURE__ */ s(Le, { name: e.name, openUrl: gt(e.url), downloadUrl: e.url, icon: /* @__PURE__ */ s(Xo, {}), children: e.truncated ? null : /* @__PURE__ */ s(Pi, { text: e.text }) }),
2568
+ e.truncated ? /* @__PURE__ */ s("p", { className: "aqmx-callout aqmx-document-notice", role: "note", "data-testid": "markdown-explorer-text-truncated", children: n.textTruncated }) : null,
2569
+ /* @__PURE__ */ s("div", { className: "aqmx-document-viewer", children: /* @__PURE__ */ s(Tn, { ...t, parseResult: null, content: e.text }) })
2570
+ ] });
2571
+ }, it = ({ path: e, name: t, viewer: n }) => {
2572
+ const { data: r, labels: o } = F(), i = I(
2573
+ async (w) => {
2574
+ const l = await r.text(e, w);
2575
+ return "kind" in l ? l.kind === "failure" ? { kind: "failure", failure: l.failure } : { kind: "read", value: l } : null;
2576
+ },
2577
+ [r, e]
2578
+ ), { shown: a, failure: c, retry: f } = nr(e, t, i);
2579
+ return a !== null ? /* @__PURE__ */ s(ar, { document: a, viewer: n }) : c !== null ? /* @__PURE__ */ s(St, { failure: c, onRetry: f, testId: "markdown-explorer-markup-failure" }) : /* @__PURE__ */ s(Ue, { label: o.markupLoading, testId: "markdown-explorer-markup-skeleton" });
2580
+ }, ml = Object.freeze({ reason: "failed" }), hl = (e) => {
2581
+ const { labels: t } = F();
2582
+ return /* @__PURE__ */ s(
2583
+ ei,
2584
+ {
2585
+ fallback: (n) => /* @__PURE__ */ s("div", { className: "aqmx-edit-message", children: /* @__PURE__ */ s(Te, { failure: ml, alert: !1, onRetry: n, testId: "markdown-explorer-edit-load-failure" }) }),
2586
+ children: /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s(Ue, { label: t.editLoading, testId: "markdown-explorer-edit-skeleton" }), children: /* @__PURE__ */ s(Qo, { ...e }) })
2587
+ }
2588
+ );
2589
+ }, pl = ({ path: e, document: t, view: n, viewer: r, onRetry: o, editing: i }) => {
2590
+ switch (t.kind) {
2591
+ case "markdown": {
2592
+ const { session: a, layout: c, region: f, paneScroll: w, stale: l } = i;
2593
+ if (n === "edit" && a !== void 0) return /* @__PURE__ */ s(hl, { path: e, name: t.name, session: a, layout: c, viewer: r, region: f, paneScroll: w });
2594
+ if (n === "markup") return /* @__PURE__ */ s(it, { path: e, name: t.name, viewer: r });
2595
+ const u = t.edit !== null && (t.edit.kind === "inline" || t.edit.kind === "draft");
2596
+ return /* @__PURE__ */ s(fl, { path: e, document: t, viewer: r, editing: { editable: u, doubleClick: u && c === "fill", region: f, paneScroll: w, stale: l } });
2597
+ }
2598
+ case "text":
2599
+ return /* @__PURE__ */ s(ar, { document: t, viewer: r });
2600
+ case "image":
2601
+ return n === "markup" && xt(t) === "svg" ? /* @__PURE__ */ s(it, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ s(pa, { document: t });
2602
+ case "media":
2603
+ return /* @__PURE__ */ s(ja, { document: t });
2604
+ case "spreadsheet":
2605
+ return n === "markup" ? /* @__PURE__ */ s(it, { path: e, name: t.name, viewer: r }) : /* @__PURE__ */ s(sl, { path: e, document: t });
2606
+ case "file":
2607
+ return /* @__PURE__ */ s(zi, { document: t });
2608
+ case "failure":
2609
+ return /* @__PURE__ */ s(St, { failure: t.failure, onRetry: o, testId: "markdown-explorer-document-failure" });
2610
+ default: {
2611
+ const a = t;
2612
+ throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(a)}`);
2613
+ }
2614
+ }
2615
+ }, wl = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])', gl = (e, t, n) => {
2616
+ const [r] = t.kind === "markdown" ? t.headings : [], o = [n === null ? null : Wn(e, n), r === void 0 ? null : Gn(e, r.id), e.querySelector(Ze), e.querySelector(wl)];
2617
+ for (const i of o)
2618
+ if (i instanceof HTMLElement && jn(i)) return i;
2619
+ return null;
2620
+ }, cn = (e, t, n) => {
2621
+ const { activeElement: r, body: o } = e.ownerDocument, i = r === null || r === o;
2622
+ t instanceof HTMLElement && n && (i || e.contains(r)) && jn(t);
2623
+ }, vl = (e) => {
2624
+ const t = B(!1);
2625
+ return K(() => {
2626
+ const n = e.current;
2627
+ if (n === null) throw new Error("[markdown-explorer] the document region is not mounted");
2628
+ const r = n.ownerDocument, o = r.defaultView;
2629
+ if (o === null) throw new Error("[markdown-explorer] the document region's document has no window");
2630
+ let i = !1, a;
2631
+ const c = (p) => {
2632
+ i = !(p.target instanceof Node && n.contains(p.target)), i && !n.contains(r.activeElement) && (t.current = !1), clearTimeout(a), a = setTimeout(() => {
2633
+ i = !1;
2634
+ }, 0);
2635
+ }, f = (p) => {
2636
+ t.current = p.target instanceof Node && n.contains(p.target);
2637
+ }, w = (p) => {
2638
+ p.relatedTarget === null && i && (t.current = !1);
2639
+ }, l = () => {
2640
+ const { activeElement: p, body: g } = r;
2641
+ p !== null && p !== g && (t.current = n.contains(p));
2642
+ }, u = () => {
2643
+ i && !n.contains(r.activeElement) && (t.current = !1);
2644
+ };
2645
+ return o.addEventListener("pointerdown", c, !0), o.addEventListener("mousedown", c, !0), o.addEventListener("focusin", f, !0), o.addEventListener("blur", l), o.addEventListener("focus", u), n.addEventListener("focusout", w), () => {
2646
+ clearTimeout(a), o.removeEventListener("pointerdown", c, !0), o.removeEventListener("mousedown", c, !0), o.removeEventListener("focusin", f, !0), o.removeEventListener("blur", l), o.removeEventListener("focus", u), n.removeEventListener("focusout", w);
2647
+ };
2648
+ }, [e]), t;
2649
+ }, bl = Object.freeze({ count: 0, recovered: !1 }), El = ({ path: e, snapshot: t, markup: n, stale: r, viewer: o, editLayout: i, regionLabel: a, navigation: c, fragment: f, paneScroll: w, announces: l, announceFailure: u, onDocumentShown: p }) => {
2650
+ const { labels: g, announcer: b, documents: x } = F(), { document: R } = t, A = B(null), N = B(null), _ = B(null), D = B(0), d = vl(A), m = B({ path: e, document: R }), k = B(null), M = I(
2651
+ (V) => {
2652
+ const Z = A.current, Q = Qt(Z, V, w);
2653
+ Z !== null && Q !== null && cn(Z, Q, d.current);
2654
+ },
2655
+ [w, d]
2656
+ ), $ = I(
2657
+ (V, Z) => {
2658
+ const Q = D.current;
2659
+ setTimeout(() => {
2660
+ !Z.defaultPrevented && D.current === Q && M(V);
2661
+ }, 0);
2662
+ },
2663
+ [M]
2664
+ ), q = I(
2665
+ (V) => {
2666
+ setTimeout(() => {
2667
+ V.defaultPrevented || M("#");
2668
+ }, 0);
2669
+ },
2670
+ [M]
2671
+ ), v = Y(() => ({ navigation: c, currentPath: e, scrollWithin: M, followSameUrlJump: $, followEmptyFragment: q }), [c, e, M, $, q]), T = I(() => x.retry(e), [x, e]), L = wi(x, Ea), O = _n(e), P = O !== void 0 ? "edit" : n ? "markup" : "rendered", j = xt(R) === null ? void 0 : P, X = I(() => A.current, []), h = Y(() => ({ session: O, layout: i, region: X, paneScroll: w, stale: r }), [O, i, X, w, r]), E = j === "edit" ? !1 : r, S = oe(me), C = j === "edit" && i === "fill" ? "fill" : S, [z, G] = U(0), J = B(0), W = B(!1), [ie, Ot] = U(bl), [Ct, dr] = U(0), Mt = B(u), Lt = B(r);
2672
+ K(() => {
2673
+ Mt.current = u, Lt.current = r;
2674
+ }, [u, r]);
2675
+ const ur = Y(
2676
+ () => ({
2677
+ announceFailure: (V) => {
2678
+ Lt.current || Mt.current(V);
2679
+ },
2680
+ readPart: () => {
2681
+ const V = x.readPart(e);
2682
+ J.current += 1;
2683
+ let Z = !1, Q = !1, ne = !1;
2684
+ return {
2685
+ settle: (pe, we) => {
2686
+ if (V.settle(pe, we), !(ne || Z)) {
2687
+ if (we !== null) {
2688
+ Q = !0, W.current = !1;
2689
+ return;
2690
+ }
2691
+ Z = !0, Ot((Ae) => ({ count: Ae.count + 1, recovered: Q }));
2692
+ }
2693
+ },
2694
+ release: () => {
2695
+ ne || (ne = !0, V.release(), J.current -= 1, Z || dr((pe) => pe + 1));
2696
+ }
2697
+ };
2698
+ },
2699
+ holdBusy: () => {
2700
+ G((Z) => Z + 1);
2701
+ let V = !0;
2702
+ return () => {
2703
+ V && (V = !1, G((Z) => Z - 1));
2704
+ };
2705
+ }
2706
+ }),
2707
+ [x, e]
2708
+ ), At = E || z > 0, fr = ae((V, Z) => {
2709
+ const Q = N.current;
2710
+ if (Q !== null && Q.path === V && Q.snapshot === Z) return;
2711
+ N.current = { path: V, snapshot: Z }, x.noteShown(V, Z);
2712
+ const ne = Z.document;
2713
+ if (ne.kind === "failure") {
2714
+ W.current = !1, x.noteFailureShown(Z) && u(g.documentFailed(ce(V), le(g, ne.failure.reason)));
2715
+ return;
2716
+ }
2717
+ p?.(V, ne), !(!l || Q !== null && Q.path === V && Q.snapshot.document.kind !== "failure") && (W.current = J.current > 0, W.current || b.announce(g.documentShown(ne.name)));
2718
+ });
2719
+ ee(() => {
2720
+ fr(e, t);
2721
+ }, [e, t]);
2722
+ const mr = ae(() => {
2723
+ f.kind === "panel" && f.consume();
2724
+ }), Nt = ae((V) => {
2725
+ const Z = A.current;
2726
+ if (Z === null || !d.current) return null;
2727
+ const { activeElement: Q, body: ne } = Z.ownerDocument;
2728
+ return Q !== null && Q !== ne ? null : gl(Z, R, V);
2729
+ }), hr = ae((V) => {
2730
+ const Z = W.current;
2731
+ W.current = !1, !r && (V && Nt(null), l && (V || Z) && R.kind !== "failure" && b.announce(g.documentShown(R.name)));
2732
+ });
2733
+ ee(() => {
2734
+ ie.count > 0 && hr(ie.recovered);
2735
+ }, [ie]);
2736
+ const pr = ae(() => {
2737
+ J.current > 0 || !W.current || (W.current = !1, l && !r && R.kind !== "failure" && b.announce(g.documentShown(R.name)));
2738
+ });
2739
+ ee(() => {
2740
+ Ct > 0 && pr();
2741
+ }, [Ct]);
2742
+ const wr = ae((V) => {
2743
+ const Z = A.current;
2744
+ Z !== null && cn(Z, V, d.current);
2745
+ }), gr = ae((V) => w.reveal(V)), vr = ae((V) => Qt(A.current, V, w));
2746
+ return ee(() => {
2747
+ if (r) return;
2748
+ const V = m.current.path !== e, Z = V || m.current.document !== R;
2749
+ m.current = { path: e, document: R };
2750
+ const Q = k.current !== e;
2751
+ k.current = e;
2752
+ let ne = null;
2753
+ f.kind === "page" ? _.current !== f.navigation && (_.current = f.navigation, D.current += 1, ne = f.fragment) : f.fragment !== null && (ne = f.fragment, mr());
2754
+ const pe = () => {
2755
+ const we = ne === null ? null : vr(ne);
2756
+ if (!Z) {
2757
+ we !== null && wr(we);
2758
+ return;
2759
+ }
2760
+ const Ae = Nt(f.fragment);
2761
+ V && we === null && Ae !== null && gr(Ae);
2762
+ };
2763
+ Q ? queueMicrotask(pe) : pe();
2764
+ }, [f, e, R, r]), /* @__PURE__ */ s(me, { value: C, children: /* @__PURE__ */ s(Se, { kind: R.kind, view: j, label: a(e, R), stale: At, busy: At, frameRef: A, intent: L, children: /* @__PURE__ */ s(Yn, { value: v, children: /* @__PURE__ */ s(va, { children: /* @__PURE__ */ s(Un, { value: ur, children: /* @__PURE__ */ s(pl, { path: e, document: R, view: P, viewer: o, onRetry: T, editing: h }, e) }) }) }) }) });
2765
+ }, Rt = Object.freeze({ kind: "skeleton" }), yl = (e, t, n, r, o) => {
2766
+ if (t?.status === "loaded") return { kind: "document", path: e, snapshot: t, stale: !1 };
2767
+ const i = fe(t);
2768
+ if (i !== null) return { kind: "document", path: e, snapshot: i, stale: !0 };
2769
+ if (o && t?.status === "pending") return { kind: "streaming", path: e, promise: t.promise };
2770
+ const a = n === null || n === e ? null : fe(r);
2771
+ return n === null || a === null ? Rt : { kind: "document", path: n, snapshot: a, stale: !0 };
2772
+ }, Sl = (e, t) => t.status === "deferred" ? Rt : { kind: "document", path: e, snapshot: t, stale: !1 }, kl = ({ requestedPath: e, content: t, markup: n, ...r }) => {
2773
+ const o = t.kind === "streaming" ? Sl(t.path, oe(t.promise)) : t;
2774
+ return o.kind !== "document" ? /* @__PURE__ */ s(Tt, { label: r.regionLabel(e, null) }) : /* @__PURE__ */ s(El, { path: o.path, snapshot: o.snapshot, markup: n, stale: o.stale, ...r });
2775
+ }, lr = ({ path: e, absence: t, markup: n, display: r, navigation: o, fragment: i, paneScroll: a, announces: c, announceFailure: f, onDocumentShown: w }) => {
2776
+ const { config: l, labels: u, locale: p, theme: g, documents: b, data: x } = F(), R = no(), A = B(!1);
2777
+ K(() => {
2778
+ A.current = !0;
2779
+ }, []);
2780
+ const [N, _] = U(null), [D, d] = U(n), m = I(() => e === null ? void 0 : b.peek(e), [b, e]), k = re(b.subscribe, m, m), M = I(() => N === null ? void 0 : b.peek(N), [b, N]), $ = re(b.subscribe, M, M);
2781
+ K(() => e === null ? void 0 : b.open(e), [b, e]), K(() => N === null ? void 0 : b.retain(N), [b, N]);
2782
+ const q = e === null ? Rt : yl(e, k, N, $, !A.current), v = e === null ? null : q.kind === "document" && !q.stale ? q.path : N;
2783
+ v !== N && _(v);
2784
+ const T = q.kind !== "document" || q.path === e;
2785
+ T && n !== D && d(n);
2786
+ const L = Y(() => il(u, p), [u, p]), O = Y(() => ({ read: (S, C) => wa(x, S, C) }), [x]), P = Y(() => [...l.iframeHosts], [l]), j = o.kind === "panel", X = Y(
2787
+ () => ({
2788
+ labels: L,
2789
+ spreadsheetLocale: p,
2790
+ emptyMessage: u.documentEmpty,
2791
+ theme: g,
2792
+ availableStyles: l.documentStyles,
2793
+ iFrameAllowedDomains: P,
2794
+ embeds: l.embeds,
2795
+ linkComponent: Ra,
2796
+ toolbar: R,
2797
+ style: r.style,
2798
+ onStyleChange: r.onStyleChange,
2799
+ align: r.align,
2800
+ onAlignChange: r.onAlignChange,
2801
+ showToc: r.showToc,
2802
+ showStyle: r.showStyle,
2803
+ showAlign: r.showAlign,
2804
+ padding: r.padding,
2805
+ width: r.width === void 0 ? void 0 : `min(${r.width}, 100%)`,
2806
+ maxWidth: r.maxWidth === void 0 ? void 0 : `min(${r.maxWidth}, 100%)`,
2807
+ renderScrollBar: j ? void 0 : zn,
2808
+ imageSource: O
2809
+ }),
2810
+ [L, p, u.documentEmpty, g, l.documentStyles, P, l.embeds, R, r, j, O]
2811
+ ), h = I((S, C) => j ? C === null || C.kind === "failure" ? ce(S) : C.name : u.documentRegion, [j, u.documentRegion]), E = j ? "content" : "fill";
2812
+ return e === null ? /* @__PURE__ */ s(me, { value: E, children: /* @__PURE__ */ s(ul, { absence: t, announces: c, announceFailure: f }) }) : /* @__PURE__ */ s(me, { value: E, children: /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s(Tt, { label: h(e, null) }), children: /* @__PURE__ */ s(
2813
+ kl,
2814
+ {
2815
+ requestedPath: e,
2816
+ content: q,
2817
+ markup: T ? n : D,
2818
+ viewer: X,
2819
+ editLayout: r.editLayout,
2820
+ regionLabel: h,
2821
+ navigation: o,
2822
+ fragment: i,
2823
+ paneScroll: a,
2824
+ announces: c,
2825
+ announceFailure: f,
2826
+ onDocumentShown: w
2827
+ }
2828
+ ) }) });
2829
+ }, xl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2830
+ const { config: i, viewSettings: a, announcer: c } = F(), f = _e(($) => $.style), w = _e(($) => $.align), l = Ve(), u = yn(), p = bt(), { view: g, overrides: b, embed: x } = r, R = I(
2831
+ ($) => {
2832
+ if (p.kind !== "location") return;
2833
+ const q = dl(i, p.location, $);
2834
+ q !== null && l(q, "browse");
2835
+ },
2836
+ [i, l, p]
2837
+ ), A = I(
2838
+ ($) => {
2839
+ a.update({ style: $ }), R("style");
2840
+ },
2841
+ [a, R]
2842
+ ), N = I(
2843
+ ($) => {
2844
+ a.update({ align: $ }), R("align");
2845
+ },
2846
+ [a, R]
2847
+ ), _ = or(i, b.style, f), D = ir(b.align, w), d = Y(
2848
+ () => ({
2849
+ style: _,
2850
+ onStyleChange: A,
2851
+ align: D,
2852
+ onAlignChange: N,
2853
+ showToc: x.showToc !== !1,
2854
+ showStyle: x.showStyle !== !1,
2855
+ showAlign: x.showAlign !== !1,
2856
+ padding: x.padding,
2857
+ width: x.width,
2858
+ maxWidth: x.maxWidth,
2859
+ editLayout: "fill"
2860
+ }),
2861
+ [_, A, D, N, x]
2862
+ ), m = Y(() => ({ kind: "page", view: g, overrides: b, embed: x }), [g, b, x]), k = Y(() => ({ kind: "page", fragment: u.hash, navigation: u }), [u]), M = I(($) => c.announce($), [c]);
2863
+ return /* @__PURE__ */ s(lr, { path: e, absence: t, markup: n, display: d, navigation: m, fragment: k, paneScroll: Yi, announces: !0, announceFailure: M, onDocumentShown: o });
2864
+ }, Tl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => {
2865
+ const { config: i, viewSettings: a } = F(), c = _e((m) => m.style), f = _e((m) => m.align), [w, l] = U(() => or(i, void 0, c)), u = ir(void 0, f), p = I((m) => a.update({ align: m }), [a]), { maximized: g, onDocumentLink: b, pendingHash: x, onHashConsumed: R, announceFailure: A, paneScroll: N } = r, _ = Y(
2866
+ () => ({
2867
+ style: w,
2868
+ onStyleChange: l,
2869
+ align: u,
2870
+ onAlignChange: p,
2871
+ showToc: g,
2872
+ showStyle: g,
2873
+ showAlign: g,
2874
+ padding: void 0,
2875
+ width: void 0,
2876
+ maxWidth: void 0,
2877
+ editLayout: g ? "fill" : "content"
2878
+ }),
2879
+ [w, u, p, g]
2880
+ ), D = Y(() => ({ kind: "panel", onDocumentLink: b }), [b]), d = Y(() => ({ kind: "panel", fragment: x, consume: R }), [x, R]);
2881
+ return /* @__PURE__ */ s(lr, { path: e, absence: t, markup: n, display: _, navigation: D, fragment: d, paneScroll: N, announces: !1, announceFailure: A, onDocumentShown: o });
2882
+ }, Rl = ({ path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) => r.kind === "page" ? /* @__PURE__ */ s(xl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o }) : /* @__PURE__ */ s(Tl, { path: e, absence: t, markup: n, variant: r, onDocumentShown: o });
2883
+ function Ol({
2884
+ title: e,
2885
+ titleId: t,
2886
+ ...n
2887
+ }, r) {
2888
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2889
+ xmlns: "http://www.w3.org/2000/svg",
2890
+ viewBox: "0 0 24 24",
2891
+ fill: "currentColor",
2892
+ "aria-hidden": "true",
2893
+ "data-slot": "icon",
2894
+ ref: r,
2895
+ "aria-labelledby": t
2896
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2897
+ id: t
2898
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2899
+ fillRule: "evenodd",
2900
+ 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",
2901
+ clipRule: "evenodd"
2902
+ }));
2903
+ }
2904
+ const Cl = /* @__PURE__ */ y.forwardRef(Ol);
2905
+ function Ml({
2906
+ title: e,
2907
+ titleId: t,
2908
+ ...n
2909
+ }, r) {
2910
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2911
+ xmlns: "http://www.w3.org/2000/svg",
2912
+ viewBox: "0 0 24 24",
2913
+ fill: "currentColor",
2914
+ "aria-hidden": "true",
2915
+ "data-slot": "icon",
2916
+ ref: r,
2917
+ "aria-labelledby": t
2918
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2919
+ id: t
2920
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2921
+ fillRule: "evenodd",
2922
+ 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",
2923
+ clipRule: "evenodd"
2924
+ }));
2925
+ }
2926
+ const sr = /* @__PURE__ */ y.forwardRef(Ml);
2927
+ function Ll({
2928
+ title: e,
2929
+ titleId: t,
2930
+ ...n
2931
+ }, r) {
2932
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2933
+ xmlns: "http://www.w3.org/2000/svg",
2934
+ viewBox: "0 0 24 24",
2935
+ fill: "currentColor",
2936
+ "aria-hidden": "true",
2937
+ "data-slot": "icon",
2938
+ ref: r,
2939
+ "aria-labelledby": t
2940
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2941
+ id: t
2942
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2943
+ fillRule: "evenodd",
2944
+ 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",
2945
+ clipRule: "evenodd"
2946
+ }));
2947
+ }
2948
+ const Al = /* @__PURE__ */ y.forwardRef(Ll);
2949
+ function Nl({
2950
+ title: e,
2951
+ titleId: t,
2952
+ ...n
2953
+ }, r) {
2954
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2955
+ xmlns: "http://www.w3.org/2000/svg",
2956
+ viewBox: "0 0 24 24",
2957
+ fill: "currentColor",
2958
+ "aria-hidden": "true",
2959
+ "data-slot": "icon",
2960
+ ref: r,
2961
+ "aria-labelledby": t
2962
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2963
+ id: t
2964
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2965
+ fillRule: "evenodd",
2966
+ 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",
2967
+ clipRule: "evenodd"
2968
+ }), /* @__PURE__ */ y.createElement("path", {
2969
+ fillRule: "evenodd",
2970
+ 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",
2971
+ clipRule: "evenodd"
2972
+ }));
2973
+ }
2974
+ const Dl = /* @__PURE__ */ y.forwardRef(Nl);
2975
+ function Pl({
2976
+ title: e,
2977
+ titleId: t,
2978
+ ...n
2979
+ }, r) {
2980
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
2981
+ xmlns: "http://www.w3.org/2000/svg",
2982
+ viewBox: "0 0 24 24",
2983
+ fill: "currentColor",
2984
+ "aria-hidden": "true",
2985
+ "data-slot": "icon",
2986
+ ref: r,
2987
+ "aria-labelledby": t
2988
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
2989
+ id: t
2990
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
2991
+ fillRule: "evenodd",
2992
+ 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",
2993
+ clipRule: "evenodd"
2994
+ }));
2995
+ }
2996
+ const $l = /* @__PURE__ */ y.forwardRef(Pl);
2997
+ function Fl({
2998
+ title: e,
2999
+ titleId: t,
3000
+ ...n
3001
+ }, r) {
3002
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
3003
+ xmlns: "http://www.w3.org/2000/svg",
3004
+ viewBox: "0 0 24 24",
3005
+ fill: "currentColor",
3006
+ "aria-hidden": "true",
3007
+ "data-slot": "icon",
3008
+ ref: r,
3009
+ "aria-labelledby": t
3010
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
3011
+ id: t
3012
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
3013
+ fillRule: "evenodd",
3014
+ 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",
3015
+ clipRule: "evenodd"
3016
+ }), /* @__PURE__ */ y.createElement("path", {
3017
+ 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"
3018
+ }));
3019
+ }
3020
+ const ql = /* @__PURE__ */ y.forwardRef(Fl);
3021
+ function Il({
3022
+ title: e,
3023
+ titleId: t,
3024
+ ...n
3025
+ }, r) {
3026
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
3027
+ xmlns: "http://www.w3.org/2000/svg",
3028
+ viewBox: "0 0 24 24",
3029
+ fill: "currentColor",
3030
+ "aria-hidden": "true",
3031
+ "data-slot": "icon",
3032
+ ref: r,
3033
+ "aria-labelledby": t
3034
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
3035
+ id: t
3036
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
3037
+ d: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
3038
+ }), /* @__PURE__ */ y.createElement("path", {
3039
+ fillRule: "evenodd",
3040
+ 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",
3041
+ clipRule: "evenodd"
3042
+ }));
3043
+ }
3044
+ const _l = /* @__PURE__ */ y.forwardRef(Il);
3045
+ function Bl({
3046
+ title: e,
3047
+ titleId: t,
3048
+ ...n
3049
+ }, r) {
3050
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
3051
+ xmlns: "http://www.w3.org/2000/svg",
3052
+ viewBox: "0 0 24 24",
3053
+ fill: "currentColor",
3054
+ "aria-hidden": "true",
3055
+ "data-slot": "icon",
3056
+ ref: r,
3057
+ "aria-labelledby": t
3058
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
3059
+ id: t
3060
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
3061
+ 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"
3062
+ }), /* @__PURE__ */ y.createElement("path", {
3063
+ 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"
3064
+ }));
3065
+ }
3066
+ const Hl = /* @__PURE__ */ y.forwardRef(Bl);
3067
+ function jl({
3068
+ title: e,
3069
+ titleId: t,
3070
+ ...n
3071
+ }, r) {
3072
+ return /* @__PURE__ */ y.createElement("svg", Object.assign({
3073
+ xmlns: "http://www.w3.org/2000/svg",
3074
+ viewBox: "0 0 24 24",
3075
+ fill: "currentColor",
3076
+ "aria-hidden": "true",
3077
+ "data-slot": "icon",
3078
+ ref: r,
3079
+ "aria-labelledby": t
3080
+ }, n), e ? /* @__PURE__ */ y.createElement("title", {
3081
+ id: t
3082
+ }, e) : null, /* @__PURE__ */ y.createElement("path", {
3083
+ 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"
3084
+ }));
3085
+ }
3086
+ const zl = /* @__PURE__ */ y.forwardRef(jl), Vl = ({ href: e, onRetry: t, testId: n }) => {
3087
+ const { labels: r, onEditGrant: o } = F(), [i, a] = U(!1), c = () => {
3088
+ o === void 0 || i || (a(!0), o(e).then((f) => {
3089
+ f && t();
3090
+ }).finally(() => a(!1)));
3091
+ };
3092
+ return /* @__PURE__ */ H("div", { className: "aqmx-callout aqmx-edit-grant", "data-testid": n, children: [
3093
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-title", children: r.editGrantTitle }),
3094
+ /* @__PURE__ */ s("p", { className: "aqmx-callout-body", children: r.editGrantBody }),
3095
+ /* @__PURE__ */ H("div", { className: "aqmx-edit-grant-actions", children: [
3096
+ o === void 0 ? /* @__PURE__ */ s("a", { className: "aqmx-callout-action", href: e, target: "_blank", rel: "noopener", "data-testid": `${n}-open`, children: r.editGrantAction }) : (
3097
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": i, "data-testid": `${n}-open`, onClick: c, children: r.editGrantAction })
3098
+ ),
3099
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", "data-testid": `${n}-retry`, onClick: t, children: r.editGrantRetry })
3100
+ ] })
3101
+ ] });
3102
+ }, Ul = "Control+E Meta+E", Zl = (e, t, n) => n && t ? "split" : e.view, dn = (e, t, n, r) => {
3103
+ if (n === "split") {
3104
+ e.setSideBySide(!0);
3105
+ return;
3106
+ }
3107
+ e.setView(t, n), r && e.sideBySide() && e.setSideBySide(!1);
3108
+ }, cc = (e) => e === "split" ? null : e, Gl = (e) => e === "preview" ? "editor" : "preview", Wl = (e) => /Mac|iPhone|iPad|iPod/u.test(e), Kl = (e, t) => {
3109
+ if (e.isComposing || e.altKey || e.shiftKey || (t ? !e.metaKey || e.ctrlKey : !e.ctrlKey || e.metaKey)) return !1;
3110
+ const n = e.key.toLowerCase();
3111
+ return n === "e" || e.code === "KeyE" && /^\p{L}$/u.test(n) && !/^[a-z]$/u.test(n);
3112
+ }, un = (e, t, n) => {
3113
+ const r = e.modifiedAt === null ? Number.NaN : Date.parse(e.modifiedAt);
3114
+ return n(Number.isNaN(r) ? e.id : t.format(r), e.author === null ? "" : e.author);
3115
+ }, Yl = ({ path: e, documentName: t, open: n, onClose: r }) => {
3116
+ const { data: o, edits: i, labels: a, locale: c, announcer: f } = F(), w = ke(), [l, u] = U(null), [p, g] = U(0), [b, x] = U(null), [R, A] = U(null), N = Y(() => new Intl.DateTimeFormat(c, { dateStyle: "medium", timeStyle: "short" }), [c]), _ = I(() => {
3117
+ x(null), A(null);
3118
+ }, []), D = Fn({ open: n, onOpen: _, onDismiss: r });
3119
+ ee(() => {
3120
+ if (!n) return;
3121
+ const k = new AbortController();
3122
+ return u(null), o.revisions(e, k.signal).then((M) => {
3123
+ "kind" in M && u(M);
3124
+ }), () => k.abort();
3125
+ }, [n, o, e, p]), ee(() => {
3126
+ if (!n || b === null) return;
3127
+ const k = new AbortController();
3128
+ return A(null), o.revision(e, b, k.signal).then((M) => {
3129
+ "kind" in M && A(M);
3130
+ }), () => k.abort();
3131
+ }, [n, o, e, b]);
3132
+ const d = () => {
3133
+ R === null || R.kind !== "revision" || (i.replaceDraft(e, R.text), f.announce(a.historyRestored(t)), r());
3134
+ }, m = l !== null && l.kind === "revisions" ? l.revisions.find((k) => k.id === b) : void 0;
3135
+ return /* @__PURE__ */ s("dialog", { ...D, className: "aqmx-confirm aqmx-history", "aria-labelledby": w, "data-testid": "markdown-explorer-history", children: /* @__PURE__ */ H("div", { className: "aqmx-confirm-panel aqmx-history-panel", children: [
3136
+ /* @__PURE__ */ s("p", { id: w, className: "aqmx-confirm-title", children: a.historyTitle(t) }),
3137
+ l === null ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-loading", children: a.historyLoading }) : l.kind === "failure" ? /* @__PURE__ */ s(Te, { failure: l.failure, alert: !1, onRetry: () => g((k) => k + 1), testId: "markdown-explorer-history-failure" }) : l.revisions.length === 0 ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", "data-testid": "markdown-explorer-history-empty", children: a.historyEmpty }) : /* @__PURE__ */ s("ul", { className: "aqmx-history-list", "data-testid": "markdown-explorer-history-list", children: l.revisions.map((k) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ H("button", { type: "button", className: "aqmx-history-entry", "aria-pressed": k.id === b, "data-testid": "markdown-explorer-history-entry", onClick: () => x(k.id), children: [
3138
+ /* @__PURE__ */ s("span", { children: un(k, N, a.historyEntry) }),
3139
+ k.current ? /* @__PURE__ */ s("span", { className: "aqmx-history-mark", children: a.historyCurrent }) : null,
3140
+ k.kept ? /* @__PURE__ */ s("span", { className: "aqmx-history-mark", children: a.historyKept }) : null
3141
+ ] }) }, k.id)) }),
3142
+ b === null ? null : R === null ? /* @__PURE__ */ s("p", { className: "aqmx-history-note", children: a.historyLoading }) : R.kind === "failure" ? /* @__PURE__ */ s(Te, { failure: R.failure, alert: !1, testId: "markdown-explorer-history-revision-failure" }) : (
3143
+ /* @__PURE__ */ s("section", { className: "aqmx-history-text", tabIndex: 0, "aria-label": m === void 0 ? a.historyTitle(t) : un(m, N, a.historyEntry), "data-testid": "markdown-explorer-history-text", children: /* @__PURE__ */ s("pre", { children: R.text }) })
3144
+ ),
3145
+ /* @__PURE__ */ H("div", { className: "aqmx-confirm-actions", children: [
3146
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", "data-testid": "markdown-explorer-history-close", onClick: r, children: a.historyClose }),
3147
+ /* @__PURE__ */ s("button", { type: "button", className: "aqmx-callout-action", "aria-disabled": R === null || R.kind !== "revision", "data-testid": "markdown-explorer-history-restore", onClick: d, children: a.historyRestore })
3148
+ ] })
3149
+ ] }) });
3150
+ }, Xl = (e) => {
3151
+ const { documents: t } = F(), n = I(() => t.peek(e), [t, e]), r = I(() => t.peekSeeded(e), [t, e]), o = re(t.subscribe, n, r), i = fe(o)?.document;
3152
+ return i === void 0 || i.kind === "failure" ? { edit: null, name: ce(e) } : { edit: i.kind === "markdown" || i.kind === "spreadsheet" ? i.edit : null, name: i.name };
3153
+ }, de = (e) => {
3154
+ e.stopPropagation();
3155
+ }, Jl = ({ path: e, documentName: t, iconOnly: n, previewAvailable: r, draft: o }) => {
3156
+ const { draftConverter: i, edits: a, labels: c } = F(), f = re(
3157
+ a.subscribe,
3158
+ () => a.session(e) !== void 0,
3159
+ () => !1
3160
+ ), [w, l] = U(null), u = () => {
3161
+ if (!f) {
3162
+ a.start(e, a.viewAnchor(e));
3163
+ return;
3164
+ }
3165
+ a.flush(e);
3166
+ const x = a.session(e);
3167
+ x?.dirty === !0 ? l(x.save.kind === "draft" ? "draft" : "unsaved") : a.close(e);
3168
+ }, p = () => {
3169
+ f || (Jo(), r && a.sideBySide() && i?.prepare?.());
3170
+ }, g = n ? o ? c.editDraftDocumentNamed(t) : c.editDocumentNamed(t) : null, b = o ? c.editDraftDocument : c.editDocument;
3171
+ return /* @__PURE__ */ H(je, { children: [
3172
+ /* @__PURE__ */ H(
3173
+ "button",
3174
+ {
3175
+ type: "button",
3176
+ className: g === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
3177
+ title: f ? c.closeEditor : g === null ? b : g,
3178
+ "aria-label": g === null ? void 0 : g,
3179
+ "aria-pressed": f,
3180
+ "data-testid": "markdown-explorer-document-edit",
3181
+ onClick: u,
3182
+ onDoubleClick: de,
3183
+ onPointerEnter: p,
3184
+ onFocus: p,
3185
+ children: [
3186
+ /* @__PURE__ */ s(Hl, { "aria-hidden": "true" }),
3187
+ g === null ? /* @__PURE__ */ s("span", { children: c.editDocumentLabel }) : null
3188
+ ]
3189
+ }
3190
+ ),
3191
+ /* @__PURE__ */ s(
3192
+ qn,
3193
+ {
3194
+ open: w !== null,
3195
+ title: w === "draft" ? c.draftDiscardTitle : c.unsavedTitle,
3196
+ body: w === "draft" ? c.draftDiscardBody(t) : c.unsavedBody(t),
3197
+ confirmLabel: c.unsavedDiscard,
3198
+ cancelLabel: c.unsavedStay,
3199
+ testId: "markdown-explorer-edit-close-confirm",
3200
+ onConfirm: () => {
3201
+ l(null), a.close(e);
3202
+ },
3203
+ onCancel: () => l(null)
3204
+ }
3205
+ )
3206
+ ] });
3207
+ }, Ql = ({ href: e, documentName: t, iconOnly: n }) => {
3208
+ const { labels: r } = F(), o = n ? r.editExternallyNamed(t) : null;
3209
+ return /* @__PURE__ */ H(
3210
+ "a",
3211
+ {
3212
+ className: o === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
3213
+ href: e,
3214
+ target: "_blank",
3215
+ rel: "noopener noreferrer",
3216
+ title: o === null ? r.editExternally : o,
3217
+ "aria-label": o === null ? void 0 : o,
3218
+ "data-testid": "markdown-explorer-document-edit-external",
3219
+ onDoubleClick: de,
3220
+ children: [
3221
+ /* @__PURE__ */ s(Al, { "aria-hidden": "true" }),
3222
+ o === null ? /* @__PURE__ */ s("span", { children: r.editExternallyLabel }) : null
3223
+ ]
3224
+ }
3225
+ );
3226
+ }, es = ({ session: e }) => {
3227
+ const { labels: t } = F(), n = yo(t, e);
3228
+ return /* @__PURE__ */ s("p", { className: "aqmx-edit-status", title: n === "" ? void 0 : n, "data-testid": "markdown-explorer-edit-status", "data-aqmx-save": e.save.kind, children: n });
3229
+ }, ts = Object.freeze(["editor", "split", "preview"]), ns = Object.freeze(["editor", "preview"]), rs = Object.freeze({ editor: sr, split: zl, preview: _l }), os = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
3230
+ const { draftConverter: i, edits: a, labels: c } = F(), f = Go(), w = Zl(r, f, o), l = o ? ts : ns, u = ke(), p = B(/* @__PURE__ */ new Map()), g = {
3231
+ editor: { label: c.editViewEditor, tooltip: c.editViewEditorTooltip },
3232
+ split: { label: c.editViewSplit, tooltip: c.editViewSplitTooltip },
3233
+ preview: { label: c.editViewPreview, tooltip: c.editViewPreviewTooltip }
3234
+ }, b = () => {
3235
+ a.preparePreview(e), i?.prepare?.();
3236
+ }, x = (R) => {
3237
+ if (!Kl(R.nativeEvent, Wl(navigator.platform))) return;
3238
+ Pn(R);
3239
+ const A = Gl(w);
3240
+ dn(a, e, A, o), p.current.get(A)?.focus();
3241
+ };
3242
+ return /* @__PURE__ */ s("div", { role: "radiogroup", "aria-label": n ? c.editViewNamed(t) : c.editView, className: "aqmx-edit-view", "data-testid": "markdown-explorer-edit-view", onKeyDown: x, children: l.map((R) => {
3243
+ const A = rs[R], { label: N, tooltip: _ } = g[R], D = R === "preview" ? b : void 0;
3244
+ return /* @__PURE__ */ H("label", { className: n ? "aqmx-icon-button" : "aqmx-icon-button aqmx-labelled-button", children: [
3245
+ /* @__PURE__ */ s(
3246
+ "input",
3247
+ {
3248
+ ref: (d) => {
3249
+ d === null ? p.current.delete(R) : p.current.set(R, d);
3250
+ },
3251
+ type: "radio",
3252
+ name: u,
3253
+ value: R,
3254
+ checked: R === w,
3255
+ "aria-label": N,
3256
+ "aria-keyshortcuts": R === "split" ? void 0 : Ul,
3257
+ title: _,
3258
+ "data-testid": `markdown-explorer-edit-view-${R}`,
3259
+ onChange: () => dn(a, e, R, o),
3260
+ onDoubleClick: de,
3261
+ onPointerEnter: D,
3262
+ onFocus: D
3263
+ }
3264
+ ),
3265
+ /* @__PURE__ */ s(A, { "aria-hidden": "true" }),
3266
+ n ? null : /* @__PURE__ */ s("span", { children: N })
3267
+ ] }, R);
3268
+ }) });
3269
+ }, is = ({ path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }) => {
3270
+ const { edits: i, labels: a } = F(), [c, f] = U(!1);
3271
+ if (r.phase.kind !== "editing") return null;
3272
+ const w = r.save.kind === "saving", l = w || !r.dirty, u = () => {
3273
+ i.flush(e);
3274
+ const g = i.session(e);
3275
+ g === void 0 || !g.dirty || g.save.kind === "saving" || i.save(e);
3276
+ }, p = (g) => n ? { className: "aqmx-icon-button", "aria-label": g } : { className: "aqmx-icon-button aqmx-labelled-button" };
3277
+ return /* @__PURE__ */ H(je, { children: [
3278
+ r.save.kind === "conflicts" ? /* @__PURE__ */ H("button", { type: "button", ...p(a.conflictNext), title: a.conflictNext, "data-testid": "markdown-explorer-edit-next-conflict", onClick: () => i.nextConflict(e), onDoubleClick: de, children: [
3279
+ /* @__PURE__ */ s(Dl, { "aria-hidden": "true" }),
3280
+ n ? null : /* @__PURE__ */ s("span", { children: a.conflictNext })
3281
+ ] }) : null,
3282
+ /* @__PURE__ */ s(os, { path: e, documentName: t, iconOnly: n, session: r, previewAvailable: o }),
3283
+ r.history ? /* @__PURE__ */ H("button", { type: "button", ...p(a.historyOpen), title: a.historyOpen, "aria-haspopup": "dialog", "data-testid": "markdown-explorer-edit-history", onClick: () => f(!0), onDoubleClick: de, children: [
3284
+ /* @__PURE__ */ s($l, { "aria-hidden": "true" }),
3285
+ n ? null : /* @__PURE__ */ s("span", { children: a.historyOpen })
3286
+ ] }) : null,
3287
+ r.save.kind === "draft" ? null : /* @__PURE__ */ H("button", { type: "button", ...p(a.saveDraft), title: a.saveDraftTooltip, "aria-disabled": l, "aria-busy": w, "aria-keyshortcuts": "Control+S Meta+S", "data-testid": "markdown-explorer-edit-save", onClick: u, onDoubleClick: de, children: [
3288
+ /* @__PURE__ */ s(ql, { "aria-hidden": "true" }),
3289
+ n ? null : /* @__PURE__ */ s("span", { children: a.saveDraft })
3290
+ ] }),
3291
+ r.history ? /* @__PURE__ */ s(Yl, { path: e, documentName: t, open: c, onClose: () => f(!1) }) : null
3292
+ ] });
3293
+ }, as = ({ path: e, session: t }) => {
3294
+ const { edits: n } = F();
3295
+ return t.save.kind !== "grant" ? null : /* @__PURE__ */ s(Vl, { href: t.save.href, onRetry: () => {
3296
+ n.save(e);
3297
+ }, testId: "markdown-explorer-save-grant" });
3298
+ }, ls = /* @__PURE__ */ new Set(), ss = (e, t, n) => {
3299
+ const { documents: r, announcer: o, labels: i } = F(), a = I(() => r.peek(e), [r, e]), c = I(() => r.peekSeeded(e), [r, e]), f = re(r.subscribe, a, c), w = I(() => r.answerStampOf(e), [r, e]), l = re(r.subscribe, w, w), [u] = U(() => /* @__PURE__ */ new Set()), [p, g] = U(ls), [b, x] = U(null);
3300
+ b !== null && (b.path !== e || b.markup !== n) && x(null);
3301
+ const R = B(null);
3302
+ K(() => (R.current = e, () => {
3303
+ R.current = null;
3304
+ }), [e]);
3305
+ const A = B(n);
3306
+ K(() => {
3307
+ A.current = n;
3308
+ }, [n]);
3309
+ const N = I(() => {
3310
+ const d = e, m = r.peek(d);
3311
+ u.has(d) || m?.status === "pending" || (u.add(d), g(new Set(u)), x(null), (async () => {
3312
+ try {
3313
+ const k = await r.refresh(d);
3314
+ if (R.current !== d || k.status === "superseded") return;
3315
+ if (k.status === "failed") {
3316
+ x({ path: d, failure: k.failure, stamp: r.answerStampOf(d), markup: A.current }), o.announce(i.documentRefreshFailed(le(i, k.failure.reason)));
3317
+ return;
3318
+ }
3319
+ if (k.status === "shown" && (t || k.failed)) return;
3320
+ const M = fe(r.peek(d));
3321
+ if (M === null || M.document.kind === "failure") return;
3322
+ o.announce(i.documentRefreshed(M.document.name));
3323
+ } finally {
3324
+ u.delete(d), g(new Set(u));
3325
+ }
3326
+ })());
3327
+ }, [e, t, u, r, o, i]), _ = p.has(e), D = b !== null && b.path === e && b.stamp === l && b.markup === n ? b.failure : null;
3328
+ return { refreshing: _, unavailable: _ || f?.status === "pending", failure: D, refresh: N };
3329
+ }, cs = (e, t) => {
3330
+ switch (t) {
3331
+ case "markdown":
3332
+ return e.showMarkup;
3333
+ case "svg":
3334
+ return e.showSvgMarkup;
3335
+ case "csv":
3336
+ case "tsv":
3337
+ return e.showSpreadsheetMarkup(t.toUpperCase());
3338
+ }
3339
+ }, ds = Object.freeze({ kind: "page" }), us = ({ path: e, placement: t, markup: n }) => {
3340
+ const { labels: r } = F(), { refreshing: o, unavailable: i, failure: a, refresh: c } = ss(e, t.kind === "page", n.shown), f = za(e), w = Xl(e), l = _n(e), u = t.kind === "panel" ? r.refreshDocumentNamed(t.documentName) : null, p = t.kind === "panel" ? r.showMarkupNamed(t.documentName) : null, g = t.kind === "panel", b = t.kind === "panel" ? t.documentName : w.name, x = t.kind === "page" || t.maximized;
3341
+ return /* @__PURE__ */ H("div", { className: "aqmx-document-refresh-bar", "data-testid": "markdown-explorer-document-refresh-bar", "data-aqmx-editing": l === void 0 ? void 0 : "true", children: [
3342
+ /* @__PURE__ */ H("div", { className: "aqmx-document-refresh-row", children: [
3343
+ l === void 0 ? null : /* @__PURE__ */ s(es, { session: l }),
3344
+ l === void 0 ? null : /* @__PURE__ */ s(is, { path: e, documentName: b, iconOnly: g, session: l, previewAvailable: x }),
3345
+ l === void 0 && f !== null ? /* @__PURE__ */ H(
3346
+ "button",
3347
+ {
3348
+ type: "button",
3349
+ className: p === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
3350
+ title: p === null ? cs(r, f) : p,
3351
+ "aria-label": p === null ? void 0 : p,
3352
+ "aria-pressed": n.shown,
3353
+ "data-testid": "markdown-explorer-document-markup",
3354
+ onClick: n.toggle,
3355
+ onDoubleClick: de,
3356
+ children: [
3357
+ /* @__PURE__ */ s(sr, { "aria-hidden": "true" }),
3358
+ p === null ? /* @__PURE__ */ s("span", { children: r.showMarkupLabel }) : null
3359
+ ]
3360
+ }
3361
+ ) : null,
3362
+ l !== void 0 || w.edit?.kind === "inline" || w.edit?.kind === "draft" ? /* @__PURE__ */ s(Jl, { path: e, documentName: b, iconOnly: g, previewAvailable: x, draft: w.edit?.kind === "draft" }) : w.edit?.kind === "external" ? /* @__PURE__ */ s(Ql, { href: w.edit.href, documentName: b, iconOnly: g }) : null,
3363
+ l === void 0 ? /* @__PURE__ */ H(
3364
+ "button",
3365
+ {
3366
+ type: "button",
3367
+ className: u === null ? "aqmx-icon-button aqmx-labelled-button" : "aqmx-icon-button",
3368
+ title: u === null ? r.refreshDocument : u,
3369
+ "aria-label": u === null ? void 0 : u,
3370
+ "aria-disabled": i,
3371
+ "aria-busy": o,
3372
+ "data-aqmx-busy": o ? "true" : void 0,
3373
+ "data-testid": "markdown-explorer-document-refresh",
3374
+ onClick: c,
3375
+ onDoubleClick: de,
3376
+ children: [
3377
+ /* @__PURE__ */ s(Cl, { "aria-hidden": "true" }),
3378
+ u === null ? /* @__PURE__ */ s("span", { children: r.refreshDocumentLabel }) : null
3379
+ ]
3380
+ }
3381
+ ) : null
3382
+ ] }),
3383
+ l !== void 0 || a === null ? null : /* @__PURE__ */ s("p", { className: "aqmx-document-refresh-failure", "data-testid": "markdown-explorer-document-refresh-failure", "data-aqmx-failure": a.reason, children: r.documentRefreshFailed(le(r, a.reason)) }),
3384
+ l === void 0 ? null : /* @__PURE__ */ s(as, { path: e, session: l })
3385
+ ] });
3386
+ }, fs = ({ location: e }) => {
3387
+ const t = e.doc, n = Y(() => ({ kind: "page", view: "single", overrides: e.overrides, embed: e.embed }), [e.overrides, e.embed]), r = Va(e);
3388
+ return /* @__PURE__ */ H("div", { className: "aqmx-single aqmx-document-column", "data-testid": "markdown-explorer-single", ...ut, children: [
3389
+ /* @__PURE__ */ s(us, { path: t, placement: ds, markup: r }),
3390
+ /* @__PURE__ */ s(Rl, { path: t, absence: cl, markup: e.markup, variant: n })
3391
+ ] });
3392
+ }, ms = ({ holds: e, testId: t }) => {
3393
+ const { labels: n, announcer: r } = F(), o = ke();
3394
+ K(() => e ? r.claim(o) : void 0, [e, r, o]);
3395
+ const i = I(() => r.shownIn(o), [r, o]), a = re(r.subscribe, i, i);
3396
+ return /* @__PURE__ */ s("div", { className: "aqmx-sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-testid": t, children: a.length > 1 ? n.announcementSequence(a) : a[0] });
3397
+ }, ge = Object.freeze([]), hs = (e) => {
3398
+ const t = /* @__PURE__ */ new Set();
3399
+ let n = ge, r = [], o = !1;
3400
+ const i = [], a = (l) => {
3401
+ n = l;
3402
+ for (const u of [...t]) u();
3403
+ }, c = () => i.at(-1)?.region, f = (l) => {
3404
+ const u = c();
3405
+ l(), c() !== u && n !== ge && a(ge);
3406
+ }, w = () => {
3407
+ o = !1;
3408
+ const l = r.map((u) => "sentence" in u ? u.sentence : u.list(u.items));
3409
+ r = [], a(Object.freeze(l));
3410
+ };
3411
+ return {
3412
+ announce: (l) => {
3413
+ if (typeof l == "string") r.push({ sentence: l });
3414
+ else {
3415
+ const u = r.find((p) => "list" in p && p.list === l.list);
3416
+ u !== void 0 && "items" in u ? u.items.push(l.item) : r.push({ list: l.list, items: [l.item] });
3417
+ }
3418
+ o || (o = !0, n !== ge && a(ge), e.request(w));
3419
+ },
3420
+ subscribe: (l) => (t.add(l), () => {
3421
+ t.delete(l);
3422
+ }),
3423
+ claim: (l) => {
3424
+ const u = { region: l };
3425
+ return f(() => i.push(u)), () => f(() => {
3426
+ const p = i.indexOf(u);
3427
+ p !== -1 && i.splice(p, 1);
3428
+ });
3429
+ },
3430
+ shownIn: (l) => c() === l ? n : ge
3431
+ };
3432
+ }, se = Object.freeze({ status: "cancelled" }), fn = (e) => {
3433
+ if (e === null || typeof e != "object") return null;
3434
+ const { failure: t } = e;
3435
+ if (Br(t) !== null) return null;
3436
+ const { reason: n, code: r } = t;
3437
+ return Hr(n, r);
3438
+ }, ps = ({ dataPath: e, onScope: t, fetch: n }) => {
3439
+ const r = n ?? ((l, u) => globalThis.fetch(l, u)), o = (l, u) => `${e}/${l}?${new URLSearchParams(u).toString()}`, i = (l) => {
3440
+ l.status === 401 && t(null);
3441
+ const u = l.headers.get(_r);
3442
+ u !== null && t(u);
3443
+ }, a = async (l, u, p, g) => {
3444
+ let b;
3445
+ try {
3446
+ b = await r(l, { credentials: "same-origin", ...u, headers: { Accept: "application/json", ...u.headers } });
3447
+ } catch {
3448
+ return g({ reason: "failed" });
3449
+ }
3450
+ i(b);
3451
+ let x;
3452
+ try {
3453
+ x = await b.json();
3454
+ } catch {
3455
+ return g({ reason: Xe(b.status) });
3456
+ }
3457
+ let R;
3458
+ try {
3459
+ R = p(x);
3460
+ } catch {
3461
+ R = !1;
3462
+ }
3463
+ if (R) return x;
3464
+ const A = fn(x);
3465
+ return g(A !== null ? A : { reason: b.status === 200 ? "failed" : Xe(b.status) });
3466
+ }, c = { [It]: Zr }, f = { [It]: Xr, "Content-Type": `${Yr}; charset=utf-8` }, w = async (l, u, p) => {
3467
+ const g = await a(l, u, p, (b) => Je(b.reason, b.code));
3468
+ return u.signal.aborted ? se : g;
3469
+ };
3470
+ return {
3471
+ tree: (l) => a(o("tree", { [te.source]: l }), { method: "GET" }, qt, (u) => ({ status: "error", failure: u })),
3472
+ children: async (l, u, p) => {
3473
+ const g = await a(o("children", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, Ur, (b) => ({ status: "error", failure: b }));
3474
+ return p.aborted ? se : g;
3475
+ },
3476
+ ancestors: async (l, u, p) => {
3477
+ const g = await a(o("ancestors", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, Vr, (b) => ({ status: "error", failure: b }));
3478
+ return p.aborted ? se : g;
3479
+ },
3480
+ reveal: async (l, u, p) => {
3481
+ const g = await a(o("reveal", { [te.source]: l, [te.path]: u }), { method: "GET", signal: p }, zr, (b) => ({ status: "error", failure: b }));
3482
+ return p.aborted ? se : g;
3483
+ },
3484
+ document: (l, { refresh: u }) => a(o("document", { [te.path]: l }), u ? { method: "GET", headers: c } : { method: "GET" }, eo, (p) => Je(p.reason, p.code)),
3485
+ text: async (l, u) => {
3486
+ const p = await a(o("text", { [te.path]: l }), { method: "GET", signal: u }, jr, (g) => Je(g.reason, g.code));
3487
+ return u.aborted ? se : p;
3488
+ },
3489
+ asset: async (l, u) => {
3490
+ let p;
3491
+ try {
3492
+ p = await r(l, { method: "GET", credentials: "same-origin", signal: u });
3493
+ } catch {
3494
+ return u.aborted ? se : { status: "error", failure: { reason: "failed" } };
3495
+ }
3496
+ if (i(p), p.ok)
3497
+ return u.aborted ? se : { status: "ok", body: p.body === null ? new ReadableStream({ start: (x) => x.close() }) : p.body };
3498
+ let g = null;
3499
+ try {
3500
+ g = await p.json();
3501
+ } catch {
3502
+ }
3503
+ if (u.aborted) return se;
3504
+ const b = fn(g);
3505
+ return { status: "error", failure: b === null ? { reason: Xe(p.status) } : b };
3506
+ },
3507
+ edit: (l, u) => w(o("edit", { [te.path]: l }), { method: "GET", signal: u }, Qr),
3508
+ save: (l, u, p, g) => w(o("save", { [te.path]: l, [te.base]: u }), { method: "POST", headers: f, body: p, signal: g }, Jr),
3509
+ preview: (l, u, p) => w(o("preview", { [te.path]: l }), { method: "POST", headers: f, body: u, signal: p }, Kr),
3510
+ revisions: (l, u) => w(o("revisions", { [te.path]: l }), { method: "GET", signal: u }, Wr),
3511
+ revision: (l, u, p) => w(o("revision", { [te.path]: l, [te.revision]: u }), { method: "GET", signal: p }, Gr),
3512
+ refresh: (l) => a(o("refresh", { [te.source]: l }), { method: "POST", headers: c }, qt, (u) => ({ status: "error", failure: u }))
3513
+ };
3514
+ }, ws = () => {
3515
+ let e = null, t = null;
3516
+ return {
3517
+ settle: (n) => {
3518
+ e = n;
3519
+ },
3520
+ mayMove: (n) => e !== n,
3521
+ move: (n, r, o) => {
3522
+ e = r, t = { sourceId: n, path: r, ancestors: o };
3523
+ },
3524
+ take: (n, r) => {
3525
+ const o = t !== null && t.sourceId === n && t.path === r ? t.ancestors : null;
3526
+ return t = null, o;
3527
+ }
3528
+ };
3529
+ }, gs = (e) => {
3530
+ const t = dt(e);
3531
+ if (t === null) return $t;
3532
+ try {
3533
+ return $r(JSON.parse(t));
3534
+ } catch (n) {
3535
+ return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`, n), $t;
3536
+ }
3537
+ }, mn = (e, t) => {
3538
+ let n = null;
3539
+ const r = () => {
3540
+ if (n === null) {
3541
+ const i = gs(e);
3542
+ n = { changes: i, settings: Pt(t, i) };
3543
+ }
3544
+ return n;
3545
+ }, o = Ce();
3546
+ return {
3547
+ storageKey: e,
3548
+ defaults: t,
3549
+ getSnapshot: () => r().settings,
3550
+ getServerSnapshot: () => t,
3551
+ subscribe: o.subscribe,
3552
+ advance: (i) => {
3553
+ const { changes: a, settings: c } = r(), f = Nr(a, i, Dr(c, i)[i], t);
3554
+ return n = { changes: f, settings: Pt(t, f) }, o.emit(), ct(e, Pr(f)), n.settings;
3555
+ }
3556
+ };
3557
+ }, vs = Object.freeze({ status: "refreshed" }), bs = Object.freeze({ status: "superseded" }), pt = Object.freeze({ status: "deferred" }), Es = In(pt), cr = 4, ys = cr - 1, hn = Object.freeze({ status: "loading" }), Ss = Object.freeze({ status: "error", failure: Object.freeze({ reason: "failed" }) }), ks = (e) => {
3558
+ const t = /* @__PURE__ */ new Map(), n = Vn(), r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = Ce(), f = /* @__PURE__ */ new Set();
3559
+ let w = 0, l = 0;
3560
+ const u = { direct: null, bulk: null }, p = /* @__PURE__ */ new Set();
3561
+ let g = !1, b = 0;
3562
+ const x = () => {
3563
+ b += 1, c.emit();
3564
+ }, R = (h) => o.get(h) ?? 0, A = (h) => {
3565
+ let E = a.get(h);
3566
+ return E === void 0 && (E = { claims: /* @__PURE__ */ new Map(), unclaimed: /* @__PURE__ */ new Set(), direct: /* @__PURE__ */ new Set(), bulk: /* @__PURE__ */ new Set(), inFlight: /* @__PURE__ */ new Map() }, a.set(h, E)), E;
3567
+ }, N = (h, E, S) => {
3568
+ h.inFlight.delete(E), w -= 1, S.lane === "bulk" && (l -= 1);
3569
+ }, _ = (h) => {
3570
+ const E = a.get(h);
3571
+ if (E !== void 0) {
3572
+ for (const [S, C] of [...E.inFlight])
3573
+ N(E, S, C), C.controller.abort();
3574
+ E.direct.clear(), E.bulk.clear(), E.unclaimed.clear();
3575
+ }
3576
+ }, D = (h) => {
3577
+ const E = R(h) + 1;
3578
+ return o.set(h, E), _(h), E;
3579
+ }, d = (h, E) => {
3580
+ const S = Ee(h), C = { promise: h, opened: E, stale: !1, loadedAt: S?.status === "ok" ? S.loadedAt : null };
3581
+ return h.status === "pending" && h.then((z) => {
3582
+ z.status === "ok" && (C.loadedAt = z.loadedAt);
3583
+ }), C;
3584
+ }, m = (h) => {
3585
+ let E = r.get(h);
3586
+ return E === void 0 && (E = /* @__PURE__ */ new Map(), r.set(h, E)), E;
3587
+ }, k = (h) => {
3588
+ const E = [...a.keys()], S = u[h], C = S === null ? 0 : E.indexOf(S) + 1;
3589
+ for (let z = 0; z < E.length; z += 1) {
3590
+ const G = E[(C + z) % E.length], J = G === void 0 ? void 0 : a.get(G);
3591
+ if (!(G === void 0 || J === void 0)) {
3592
+ for (const W of J[h])
3593
+ if ((J.claims.get(W) ?? 0) !== 0)
3594
+ return J[h].delete(W), u[h] = G, { sourceId: G, path: W };
3595
+ }
3596
+ }
3597
+ return null;
3598
+ }, M = (h, E, S, C) => {
3599
+ const z = a.get(h);
3600
+ if (z === void 0 || z.inFlight.get(E) !== S) return;
3601
+ N(z, E, S);
3602
+ const G = (z.claims.get(E) ?? 0) > 0, J = m(h);
3603
+ if (C.status === "ok" ? J.set(E, { status: "loaded", entries: C.entries }) : C.status === "error" && G ? J.set(E, { status: "failed", failure: C.failure }) : J.delete(E), x(), C.status === "error" && G) {
3604
+ const W = { sourceId: h, path: E, failure: C.failure };
3605
+ for (const ie of [...f]) ie(W);
3606
+ }
3607
+ q();
3608
+ }, $ = (h, E, S) => {
3609
+ const C = { controller: new AbortController(), lane: S };
3610
+ A(h).inFlight.set(E, C), w += 1, S === "bulk" && (l += 1), e.children(h, E, C.controller.signal).then(
3611
+ (z) => M(h, E, C, z),
3612
+ () => M(h, E, C, Ss)
3613
+ );
3614
+ }, q = () => {
3615
+ for (; w < cr; ) {
3616
+ const h = k("direct");
3617
+ if (h !== null) {
3618
+ $(h.sourceId, h.path, "direct");
3619
+ continue;
3620
+ }
3621
+ const E = l < ys ? k("bulk") : null;
3622
+ if (E === null) return;
3623
+ $(E.sourceId, E.path, "bulk");
3624
+ }
3625
+ }, v = (h, E, S) => {
3626
+ if (!(E.direct.delete(S) || E.bulk.delete(S))) {
3627
+ const z = E.inFlight.get(S);
3628
+ if (z === void 0) return !1;
3629
+ N(E, S, z), z.controller.abort();
3630
+ }
3631
+ return r.get(h)?.delete(S), !0;
3632
+ }, T = () => {
3633
+ g = !1;
3634
+ let h = !1;
3635
+ for (const E of p) {
3636
+ const S = A(E);
3637
+ for (const C of S.unclaimed)
3638
+ (S.claims.get(C) ?? 0) === 0 && v(E, S, C) && (h = !0);
3639
+ S.unclaimed.clear();
3640
+ }
3641
+ p.clear(), h && (x(), q());
3642
+ }, L = (h, E) => {
3643
+ t.set(h, d(Re(e.tree(h)), E));
3644
+ }, O = (h, E, S) => {
3645
+ D(h);
3646
+ const C = d(In(E), S);
3647
+ return t.set(h, C), r.delete(h), x(), q(), C;
3648
+ }, P = (h, E, S, C) => {
3649
+ if (S !== R(h) || t.get(h) !== E) return;
3650
+ const z = Ee(E.promise);
3651
+ if (!(C.status !== "ok" || z?.status !== "ok" || E.loadedAt === null || C.loadedAt <= E.loadedAt)) {
3652
+ if (He(z.entries, C.entries)) {
3653
+ E.loadedAt = C.loadedAt;
3654
+ return;
3655
+ }
3656
+ O(h, C, E.opened);
3657
+ }
3658
+ }, j = (h, E) => {
3659
+ const S = t.get(h);
3660
+ return S !== void 0 && Ee(S.promise)?.status === E;
3661
+ }, X = (h, E) => {
3662
+ E.stale = !1;
3663
+ const S = R(h);
3664
+ e.tree(h).then((C) => P(h, E, S, C));
3665
+ };
3666
+ return {
3667
+ read: (h) => t.get(h)?.promise ?? Es,
3668
+ open: (h) => {
3669
+ const E = n.resumes(h), S = n.hold(h), C = t.get(h);
3670
+ return C === void 0 || j(h, "deferred") ? (L(h, !0), x()) : E || (C.opened && j(h, "error") ? (L(h, !0), x()) : (C.opened = !0, C.stale && j(h, "ok") && X(h, C))), S;
3671
+ },
3672
+ retry: (h) => {
3673
+ j(h, "error") && (L(h, !0), x());
3674
+ },
3675
+ seed: (h, E) => {
3676
+ const S = E.then(
3677
+ (G) => G === null ? pt : G,
3678
+ () => pt
3679
+ ), C = t.get(h);
3680
+ if (C !== void 0 && j(h, "ok")) {
3681
+ const G = R(h);
3682
+ S.then((J) => P(h, C, G, J));
3683
+ return;
3684
+ }
3685
+ D(h);
3686
+ const z = d(Re(S), C?.opened === !0);
3687
+ t.set(h, z), r.delete(h), q(), S.then((G) => {
3688
+ t.get(h) === z && (G.status === "deferred" && n.isHeld(h) && L(h, z.opened), x());
3689
+ });
3690
+ },
3691
+ refresh: async (h) => {
3692
+ const E = (i.get(h) ?? 0) + 1;
3693
+ i.set(h, E);
3694
+ const S = await e.refresh(h);
3695
+ if (i.get(h) !== E) return bs;
3696
+ if (S.status === "error") return { status: "failed", failure: S.failure };
3697
+ const C = t.get(h);
3698
+ if (!(C !== void 0 && C.loadedAt !== null && j(h, "ok") && C.loadedAt > S.loadedAt)) {
3699
+ const G = O(h, S, !0);
3700
+ if (C !== void 0 && C.promise.status === "pending") {
3701
+ const J = R(h);
3702
+ C.promise.then((W) => P(h, G, J, W));
3703
+ }
3704
+ }
3705
+ for (const [G, J] of t)
3706
+ G !== h && Ee(J.promise)?.status === "ok" && (J.stale = !0);
3707
+ return vs;
3708
+ },
3709
+ children: (h, E) => r.get(h)?.get(E),
3710
+ claimChildren: (h, E) => {
3711
+ const S = A(h), C = m(h);
3712
+ let z = !1, G = !1;
3713
+ for (const [W, ie] of E)
3714
+ S.claims.set(W, (S.claims.get(W) ?? 0) + 1), C.get(W) === void 0 ? (C.set(W, hn), S[ie].add(W), z = !0, G = !0) : ie === "direct" && S.bulk.delete(W) && (S.direct.add(W), G = !0);
3715
+ z && x(), G && q();
3716
+ let J = !1;
3717
+ return () => {
3718
+ if (!J) {
3719
+ J = !0;
3720
+ for (const W of E.keys()) {
3721
+ const ie = (S.claims.get(W) ?? 0) - 1;
3722
+ ie > 0 ? S.claims.set(W, ie) : (S.claims.delete(W), S.unclaimed.add(W));
3723
+ }
3724
+ p.add(h), !g && (g = !0, queueMicrotask(T));
3725
+ }
3726
+ };
3727
+ },
3728
+ retryChildren: (h, E) => {
3729
+ const S = r.get(h);
3730
+ if (S === void 0 || S.get(E)?.status !== "failed") return;
3731
+ const C = A(h);
3732
+ if ((C.claims.get(E) ?? 0) > 0) {
3733
+ S.set(E, hn), C.direct.add(E), x(), q();
3734
+ return;
3735
+ }
3736
+ S.delete(E), x();
3737
+ },
3738
+ pendingChildren: (h) => {
3739
+ const E = a.get(h);
3740
+ return E === void 0 ? 0 : E.direct.size + E.bulk.size + E.inFlight.size;
3741
+ },
3742
+ clear: () => {
3743
+ for (const h of /* @__PURE__ */ new Set([...t.keys(), ...r.keys(), ...o.keys(), ...a.keys()])) D(h);
3744
+ for (const [h, E] of i) i.set(h, E + 1);
3745
+ t.clear(), r.clear(), x();
3746
+ },
3747
+ subscribeChildrenFailures: (h) => (f.add(h), () => {
3748
+ f.delete(h);
3749
+ }),
3750
+ subscribe: c.subscribe,
3751
+ version: () => b
3752
+ };
3753
+ }, xs = (e, t) => {
3754
+ let n = e;
3755
+ const r = Ce();
3756
+ return {
3757
+ getSnapshot: () => n,
3758
+ subscribe: r.subscribe,
3759
+ update: (o) => {
3760
+ n = { ...n, ...o }, t(n), r.emit();
3761
+ }
3762
+ };
3763
+ }, Ts = 1;
3764
+ let $e = 0, ue = null;
3765
+ const Rs = () => {
3766
+ const { documentElement: e, body: t } = document;
3767
+ $e === 0 && (ue = { 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"), $e += 1;
3768
+ let n = !1;
3769
+ return () => {
3770
+ n || (n = !0, $e -= 1, !($e > 0 || ue === null) && (e.style.overflow = ue.htmlOverflow, t.style.overflow = ue.bodyOverflow, e.style.scrollbarGutter = ue.htmlGutter, t.style.scrollbarGutter = ue.bodyGutter, ue = null));
3771
+ };
3772
+ }, Os = [
3773
+ { selector: '[data-aqmx-document-flow="fill"]', name: "document region" },
3774
+ { selector: "[data-aqmx-explorer-body]", name: "tree area" }
3775
+ ], pn = 1, Cs = 1e3, wn = (e) => e.getClientRects().length > 0, at = "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.", Ms = (e) => {
3776
+ if (!wn(e)) return null;
3777
+ const t = e.getBoundingClientRect(), n = window.innerHeight;
3778
+ if (t.bottom > n + Ts)
3779
+ 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. ${at}`;
3780
+ if (t.height < pn)
3781
+ 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. ${at}`;
3782
+ for (const { selector: r, name: o } of Os)
3783
+ for (const i of e.querySelectorAll(r)) {
3784
+ if (!wn(i)) continue;
3785
+ const a = i.getBoundingClientRect().height;
3786
+ if (a < pn)
3787
+ 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. ${at}`;
3788
+ }
3789
+ return null;
3790
+ }, Ls = (e) => {
3791
+ let t = !1, n;
3792
+ const r = () => {
3793
+ n = void 0;
3794
+ const a = Ms(e);
3795
+ a !== null && (t = !0, console.error(a));
3796
+ }, o = () => {
3797
+ t || (clearTimeout(n), n = setTimeout(r, Cs));
3798
+ }, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
3799
+ return i?.observe(e), window.addEventListener("resize", o), o(), () => {
3800
+ clearTimeout(n), i?.disconnect(), window.removeEventListener("resize", o);
3801
+ };
3802
+ }, As = (e, t) => {
3803
+ ee(() => e ? Rs() : void 0, [e]), ee(() => {
3804
+ const n = t.current;
3805
+ if (!(!e || n === null))
3806
+ return Ls(n);
3807
+ }, [e, t]);
3808
+ }, gn = '[data-testid="markdown-explorer-view-switch"]', Ns = [
3809
+ { control: gn, successors: [gn, '[data-testid="markdown-explorer-sheet-toggle"]'] },
3810
+ { control: '[data-testid="markdown-explorer-selection-open"]', successors: ['[data-testid="markdown-explorer-panel-frame"]'] }
3811
+ ], Ds = (e) => {
3812
+ for (const t of Ns) {
3813
+ const n = e.closest(t.control);
3814
+ if (n !== null) return { element: n, control: t };
3815
+ }
3816
+ return null;
3817
+ }, Ps = (e, t) => {
3818
+ const n = B(null);
3819
+ ee(() => {
3820
+ const o = (c) => {
3821
+ const f = e.current;
3822
+ n.current = f !== null && c instanceof Element && f.contains(c) ? Ds(c) : null;
3823
+ }, i = (c) => o(c.target);
3824
+ o(document.activeElement);
3825
+ const a = (c) => {
3826
+ const f = c.target;
3827
+ c.relatedTarget !== null || !(f instanceof Element) || queueMicrotask(() => {
3828
+ n.current?.element === f && f.isConnected && document.activeElement !== f && (n.current = null);
3829
+ });
3830
+ };
3831
+ return document.addEventListener("focusin", i), document.addEventListener("focusout", a), () => {
3832
+ document.removeEventListener("focusin", i), document.removeEventListener("focusout", a);
3833
+ };
3834
+ }, [e]);
3835
+ const r = B(t);
3836
+ K(() => {
3837
+ if (r.current === t) return;
3838
+ r.current = t;
3839
+ const o = n.current;
3840
+ if (o === null) return;
3841
+ const i = () => {
3842
+ const f = document.activeElement;
3843
+ if (f !== null && f !== document.body && f !== o.element) return !0;
3844
+ const w = e.current;
3845
+ if (w === null) return !0;
3846
+ for (const l of o.control.successors)
3847
+ for (const u of w.querySelectorAll(l))
3848
+ if (u !== o.element && (u.focus({ preventScroll: !0 }), document.activeElement === u))
3849
+ return !0;
3850
+ return !1;
3851
+ };
3852
+ if (i()) return;
3853
+ const a = e.current;
3854
+ if (a === null) return;
3855
+ const c = new MutationObserver(() => {
3856
+ i() && c.disconnect();
3857
+ });
3858
+ return c.observe(a, { childList: !0, subtree: !0 }), () => c.disconnect();
3859
+ }, [t, e]);
3860
+ }, $s = wt(() => import("./TreeLayout-BIQBKAkV.js").then((e) => ({ default: e.TreeLayout }))), Fs = wt(() => import("./MultiLayout-CnbuAlxd.js").then((e) => ({ default: e.MultiLayout }))), qs = 64, Is = {
3861
+ request: (e) => {
3862
+ requestAnimationFrame(e);
3863
+ }
3864
+ }, vn = (e) => {
3865
+ e.documents.clear(), e.trees.clear();
3866
+ }, lt = (e, t) => {
3867
+ t.tree !== null && e.trees.seed(t.tree.sourceId, t.tree.result);
3868
+ for (const { path: n, document: r } of t.documents) e.documents.seed(n, r);
3869
+ }, _s = (e, t) => {
3870
+ const [n, r] = U(() => ({ overrides: t, locale: e, labels: zt(e, t) }));
3871
+ if (n.locale === e && bo(n.overrides, t)) return n.labels;
3872
+ const o = { overrides: t, locale: e, labels: zt(e, t) };
3873
+ return r(o), o.labels;
3874
+ }, Bs = (e, t, n) => {
3875
+ const [r, o] = U(() => ({ scope: t, store: mn(e, n) }));
3876
+ if (r.scope === t && r.store.storageKey === e && r.store.defaults === n) return r.store;
3877
+ const i = { scope: t, store: mn(e, n) };
3878
+ return o(i), i.store;
3879
+ }, st = (e, t) => {
3880
+ const [n, r] = U(() => ({ scope: e, value: t() }));
3881
+ if (n.scope === e) return n.value;
3882
+ const o = { scope: e, value: t() };
3883
+ return r(o), o.value;
3884
+ }, Hs = () => hs(Is), bn = "on", js = "off", zs = Object.freeze({ kind: "unavailable" }), Vs = (e) => {
3885
+ if (e !== void 0 && (e === null || typeof e != "object" || typeof e.convert != "function"))
3886
+ throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function");
3887
+ }, Us = (e, t) => {
3888
+ const n = fe(e.peek(t));
3889
+ return n === null || n.document.kind === "failure" ? ce(t) : n.document.name;
3890
+ }, dc = ({
3891
+ data: e,
3892
+ config: t,
3893
+ storageNamespace: n,
3894
+ locale: r,
3895
+ labels: o,
3896
+ theme: i,
3897
+ renderFrame: a,
3898
+ renderTreeFailure: c,
3899
+ lockDocumentScroll: f = !1,
3900
+ onMathDiagnostics: w,
3901
+ onEditGrant: l,
3902
+ draftConverter: u
3903
+ }) => {
3904
+ so(n), Vs(u);
3905
+ const p = An(r), g = Eo(i), b = _s(p, o), { revalidate: x } = Tr(), R = B(() => {
3906
+ }), A = ze(t.dataPath), [N] = U(() => {
3907
+ const S = ps({ dataPath: A, onScope: (z) => R.current(z) }), C = { documents: Si({ client: S, capacity: Math.max(qs, t.multiView.maxPanels * 2) }), trees: ks(S) };
3908
+ return lt(C, e), Ht(n, e.scope), { data: S, ...C, aligned: { pageData: e, storageNamespace: n, pendingReader: null } };
3909
+ });
3910
+ if (N.aligned.pageData !== e || N.aligned.storageNamespace !== n) {
3911
+ const S = N.aligned.pageData;
3912
+ N.aligned.pageData = e, N.aligned.storageNamespace = n, S !== e && (S.scope !== e.scope ? N.aligned.pendingReader = e : lt(N, e)), Ht(n, e.scope);
3913
+ }
3914
+ const _ = Bs(ve(n).treeSettings, e.scope, t.defaultTreeSettings);
3915
+ K(() => {
3916
+ const S = N.aligned.pendingReader;
3917
+ S !== null && (N.aligned.pendingReader = null, vn(N), lt(N, S));
3918
+ }, [e, N]), K(() => {
3919
+ let S = !1;
3920
+ return R.current = (C) => {
3921
+ C === e.scope || S || (S = !0, C !== null && (vn(N), co(n)), x());
3922
+ }, () => {
3923
+ R.current = () => {
3924
+ };
3925
+ };
3926
+ }, [e, x, N, n]);
3927
+ const D = B(t.settingsCookie);
3928
+ K(() => {
3929
+ D.current = t.settingsCookie;
3930
+ }, [t.settingsCookie]);
3931
+ const [d] = U(
3932
+ () => xs(e.settings, (S) => {
3933
+ document.cookie = qr(D.current, S, window.location.protocol === "https:");
3934
+ })
3935
+ ), m = st(e.scope, Hs), k = st(e.scope, ws), M = B(b);
3936
+ K(() => {
3937
+ M.current = b;
3938
+ }, [b]);
3939
+ const $ = st(
3940
+ e.scope,
3941
+ () => Ao({
3942
+ data: N.data,
3943
+ conflictLabels: () => ({ ours: M.current.conflictOurs, theirs: M.current.conflictTheirs }),
3944
+ onSaveSettled: (S, C) => {
3945
+ C.kind === "saved" && N.documents.refresh(S);
3946
+ const z = So(M.current, C, Us(N.documents, S));
3947
+ z !== null && m.announce(z);
3948
+ },
3949
+ sideBySideSetting: {
3950
+ read: () => dt(ve(n).editPreview) === bn,
3951
+ write: (S) => ct(ve(n).editPreview, S ? bn : js)
3952
+ },
3953
+ editorShareSetting: {
3954
+ read: () => Lo(dt(ve(n).editSplit)),
3955
+ write: (S) => ct(ve(n).editSplit, String(S))
3956
+ }
3957
+ })
3958
+ ), q = Y(() => Re(e.notices.catch(() => [])), [e.notices]), v = e.sources.map((S) => S.id).join(`
3959
+ `), T = Y(() => Fr(t, v.split(`
3960
+ `)), [t, v]), L = B(w);
3961
+ K(() => {
3962
+ L.current = w;
3963
+ }, [w]);
3964
+ const [O] = U(() => (S, C) => {
3965
+ L.current?.(S, C);
3966
+ }), P = w === void 0 ? void 0 : O, j = B(u);
3967
+ K(() => {
3968
+ j.current = u;
3969
+ }, [u]);
3970
+ const [X] = U(() => {
3971
+ let S = !1;
3972
+ return {
3973
+ convert: (C, z) => {
3974
+ const G = j.current;
3975
+ return G === void 0 ? Promise.resolve(zs) : G.convert(C, z);
3976
+ },
3977
+ prepare: () => {
3978
+ try {
3979
+ j.current?.prepare?.();
3980
+ } catch (C) {
3981
+ if (S) return;
3982
+ S = !0, console.error("[markdown-explorer] the draft converter's prepare threw", C);
3983
+ }
3984
+ }
3985
+ };
3986
+ }), h = u === void 0 ? void 0 : X, E = Y(
3987
+ () => ({
3988
+ config: T,
3989
+ labels: b,
3990
+ locale: p,
3991
+ theme: g,
3992
+ storageNamespace: n,
3993
+ scope: e.scope,
3994
+ sources: e.sources,
3995
+ notices: q,
3996
+ documents: N.documents,
3997
+ trees: N.trees,
3998
+ data: N.data,
3999
+ viewSettings: d,
4000
+ treeSettings: _,
4001
+ announcer: m,
4002
+ reveals: k,
4003
+ edits: $,
4004
+ onEditGrant: l,
4005
+ draftConverter: h,
4006
+ renderTreeFailure: c,
4007
+ reportMathDiagnostics: P
4008
+ }),
4009
+ [T, b, p, g, n, e.scope, e.sources, q, N, d, _, m, k, $, l, h, c, P]
4010
+ );
4011
+ return /* @__PURE__ */ s(Nn, { value: E, children: /* @__PURE__ */ s(Gs, { renderFrame: a, lockDocumentScroll: f }, e.scope) });
4012
+ }, Zs = ({ ref: e, theme: t, view: n, children: r }) => {
4013
+ const [o] = U(ca);
4014
+ return /* @__PURE__ */ s("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 });
4015
+ }, Gs = ({ renderFrame: e, lockDocumentScroll: t }) => {
4016
+ const { theme: n, labels: r } = F(), o = bt(), { hash: i } = yn(), a = Ve(), c = B(null);
4017
+ As(t, c), K(() => {
4018
+ o.kind === "redirect" && a(`${o.href}${i}`, "browse");
4019
+ }, [o, i, a]);
4020
+ const { location: f } = o, w = f.view;
4021
+ Ps(c, w);
4022
+ const l = f.view === "tree" ? /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s("section", { className: "aqmx-split-fallback", "aria-label": r.explorerRegion, "aria-busy": "true", "data-testid": "markdown-explorer-split-loading", ...ut }), children: /* @__PURE__ */ s($s, { location: f }) }) : f.view === "multi" ? /* @__PURE__ */ s(xe, { fallback: /* @__PURE__ */ s("section", { className: "aqmx-stage-fallback", "aria-label": r.multiRegion, "aria-busy": "true", "data-testid": "markdown-explorer-stage-loading", ...ut }), children: /* @__PURE__ */ s(Fs, { location: f }) }) : /* @__PURE__ */ s(fs, { location: f }), u = /* @__PURE__ */ H(Zs, { ref: c, theme: n, view: w, children: [
4023
+ l,
4024
+ /* @__PURE__ */ s(Ko, {}),
4025
+ /* @__PURE__ */ s(ms, { holds: !0, testId: "markdown-explorer-announcer" })
4026
+ ] });
4027
+ return e === void 0 ? u : e({ view: w, children: u });
4028
+ }, uc = uo({ submissions: "skip", otherPath: "skip", query: "skip", hashChange: "skip" });
4029
+ export {
4030
+ mo as $,
4031
+ ht as A,
4032
+ Wl as B,
4033
+ ko as C,
4034
+ us as D,
4035
+ Vl as E,
4036
+ _o as F,
4037
+ dn as G,
4038
+ Gl as H,
4039
+ Ce as I,
4040
+ sc as J,
4041
+ ua as K,
4042
+ No as L,
4043
+ jn as M,
4044
+ cl as N,
4045
+ bi as O,
4046
+ ds as P,
4047
+ Cl as Q,
4048
+ wi as R,
4049
+ _l as S,
4050
+ pi as T,
4051
+ bt as U,
4052
+ ms as V,
4053
+ _e as W,
4054
+ fo as X,
4055
+ Vt as Y,
4056
+ wo as Z,
4057
+ Ln as _,
4058
+ xo as a,
4059
+ jt as a0,
4060
+ dc as a1,
4061
+ zt as a2,
4062
+ uc as a3,
4063
+ To as b,
4064
+ Ve as c,
4065
+ Va as d,
4066
+ ut as e,
4067
+ Rl as f,
4068
+ ci as g,
4069
+ Ro as h,
4070
+ mi as i,
4071
+ si as j,
4072
+ le as k,
4073
+ hi as l,
4074
+ fe as m,
4075
+ ai as n,
4076
+ li as o,
4077
+ Te as p,
4078
+ Ue as q,
4079
+ jo as r,
4080
+ Go as s,
4081
+ Zl as t,
4082
+ F as u,
4083
+ di as v,
4084
+ lc as w,
4085
+ cc as x,
4086
+ Pn as y,
4087
+ Kl as z
4088
+ };