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