@heycys/gallery 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD-PARTY-NOTICES.md +3253 -0
- package/assets/writing-preferences.md +107 -0
- package/bin/gallery.mjs +10 -0
- package/browser/editor/components/bookmark/icons.mjs +6 -0
- package/browser/editor/components/bookmark/index.mjs +80 -0
- package/browser/editor/components/bookmark/page.mjs +147 -0
- package/browser/editor/components/builders.mjs +19 -0
- package/browser/editor/components/callout/index.mjs +39 -0
- package/browser/editor/components/callout/page.mjs +13 -0
- package/browser/editor/components/code/index.mjs +327 -0
- package/browser/editor/components/code/page.mjs +561 -0
- package/browser/editor/components/colors.mjs +50 -0
- package/browser/editor/components/columns/index.mjs +104 -0
- package/browser/editor/components/columns/page.mjs +297 -0
- package/browser/editor/components/details/index.mjs +72 -0
- package/browser/editor/components/details/page.mjs +86 -0
- package/browser/editor/components/dialog/index.mjs +83 -0
- package/browser/editor/components/dialog/page.mjs +219 -0
- package/browser/editor/components/divider/index.mjs +48 -0
- package/browser/editor/components/embed/icons.mjs +11 -0
- package/browser/editor/components/embed/index.mjs +123 -0
- package/browser/editor/components/embed/page.mjs +309 -0
- package/browser/editor/components/figure/index.mjs +87 -0
- package/browser/editor/components/figure/page.mjs +33 -0
- package/browser/editor/components/file/icons.mjs +14 -0
- package/browser/editor/components/file/index.mjs +77 -0
- package/browser/editor/components/file/page.mjs +114 -0
- package/browser/editor/components/flowchart/add.mjs +123 -0
- package/browser/editor/components/flowchart/index.mjs +246 -0
- package/browser/editor/components/flowchart/page.mjs +453 -0
- package/browser/editor/components/heading/index.mjs +51 -0
- package/browser/editor/components/highlight/index.mjs +79 -0
- package/browser/editor/components/icon/index.mjs +57 -0
- package/browser/editor/components/icon/page.mjs +286 -0
- package/browser/editor/components/icons.mjs +45 -0
- package/browser/editor/components/image/crop.mjs +189 -0
- package/browser/editor/components/image/index.mjs +104 -0
- package/browser/editor/components/image/page.mjs +385 -0
- package/browser/editor/components/image/viewer.mjs +213 -0
- package/browser/editor/components/installed/index.mjs +133 -0
- package/browser/editor/components/installed/page.mjs +422 -0
- package/browser/editor/components/installed/served.mjs +35 -0
- package/browser/editor/components/kit.mjs +64 -0
- package/browser/editor/components/list/index.mjs +194 -0
- package/browser/editor/components/list/join.mjs +68 -0
- package/browser/editor/components/list/numbers.mjs +107 -0
- package/browser/editor/components/list/page.mjs +632 -0
- package/browser/editor/components/math/index.mjs +88 -0
- package/browser/editor/components/math/page.mjs +236 -0
- package/browser/editor/components/math/tex-logo.mjs +6 -0
- package/browser/editor/components/media/icons.mjs +19 -0
- package/browser/editor/components/media/page.mjs +162 -0
- package/browser/editor/components/media/parts.mjs +60 -0
- package/browser/editor/components/media/size.mjs +20 -0
- package/browser/editor/components/media/toolbar.mjs +37 -0
- package/browser/editor/components/media/write.mjs +7 -0
- package/browser/editor/components/pages.mjs +46 -0
- package/browser/editor/components/paragraph/index.mjs +43 -0
- package/browser/editor/components/paragraph/page.mjs +52 -0
- package/browser/editor/components/placeholder-bar.mjs +17 -0
- package/browser/editor/components/placeholder.mjs +128 -0
- package/browser/editor/components/quote/index.mjs +33 -0
- package/browser/editor/components/registry.mjs +833 -0
- package/browser/editor/components/rows.mjs +16 -0
- package/browser/editor/components/section/index.mjs +41 -0
- package/browser/editor/components/section/page.mjs +141 -0
- package/browser/editor/components/sheets/index.mjs +137 -0
- package/browser/editor/components/sheets/page.mjs +227 -0
- package/browser/editor/components/sheets/pills.mjs +226 -0
- package/browser/editor/components/table/grid.mjs +73 -0
- package/browser/editor/components/table/index.mjs +306 -0
- package/browser/editor/components/table/page.mjs +672 -0
- package/browser/editor/components/table/slots.mjs +41 -0
- package/browser/editor/components/widget/index.mjs +50 -0
- package/browser/editor/page/annotate/anchors.mjs +229 -0
- package/browser/editor/page/annotate/card.mjs +102 -0
- package/browser/editor/page/annotate/index.mjs +1629 -0
- package/browser/editor/page/at-menu/index.mjs +317 -0
- package/browser/editor/page/autosave.mjs +977 -0
- package/browser/editor/page/beside.mjs +21 -0
- package/browser/editor/page/block-info.mjs +63 -0
- package/browser/editor/page/block-menu/colors.mjs +82 -0
- package/browser/editor/page/block-menu/index.mjs +215 -0
- package/browser/editor/page/blocks.mjs +246 -0
- package/browser/editor/page/caret.mjs +679 -0
- package/browser/editor/page/chip-fills.mjs +126 -0
- package/browser/editor/page/clipboard/import/colors.mjs +192 -0
- package/browser/editor/page/clipboard/import/html.mjs +792 -0
- package/browser/editor/page/clipboard/import/inline.mjs +232 -0
- package/browser/editor/page/clipboard/import/languages.mjs +42 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
- package/browser/editor/page/clipboard/import/math.mjs +100 -0
- package/browser/editor/page/clipboard/import/office.mjs +245 -0
- package/browser/editor/page/clipboard/import/read.mjs +120 -0
- package/browser/editor/page/clipboard/import/rich.mjs +29 -0
- package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
- package/browser/editor/page/clipboard/index.mjs +797 -0
- package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
- package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
- package/browser/editor/page/clipboard/own/describe.mjs +115 -0
- package/browser/editor/page/clipboard/own/export.mjs +167 -0
- package/browser/editor/page/clipboard/own/ids.mjs +39 -0
- package/browser/editor/page/clipboard/own/index.mjs +13 -0
- package/browser/editor/page/clipboard/own/rules.mjs +44 -0
- package/browser/editor/page/clipboard/own/selection.mjs +159 -0
- package/browser/editor/page/clipboard/own/writers.mjs +326 -0
- package/browser/editor/page/columns/index.mjs +360 -0
- package/browser/editor/page/commit.mjs +1798 -0
- package/browser/editor/page/conflicts.mjs +269 -0
- package/browser/editor/page/convert.mjs +830 -0
- package/browser/editor/page/core.mjs +1655 -0
- package/browser/editor/page/drag/drop.mjs +307 -0
- package/browser/editor/page/drag/index.mjs +335 -0
- package/browser/editor/page/drag/preview.mjs +121 -0
- package/browser/editor/page/edge-scroll.mjs +50 -0
- package/browser/editor/page/editor.mjs +1725 -0
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
- package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
- package/browser/editor/page/emoji-picker/grid.mjs +79 -0
- package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
- package/browser/editor/page/emoji-picker/icons.mjs +32 -0
- package/browser/editor/page/emoji-picker/index.mjs +164 -0
- package/browser/editor/page/emoji-picker/styles.mjs +2 -0
- package/browser/editor/page/emoji-picker/support.mjs +202 -0
- package/browser/editor/page/emoji-picker/upload.mjs +235 -0
- package/browser/editor/page/export-report.mjs +23 -0
- package/browser/editor/page/fills.mjs +60 -0
- package/browser/editor/page/find/index.mjs +107 -0
- package/browser/editor/page/flags.mjs +70 -0
- package/browser/editor/page/format-bar/bar.mjs +448 -0
- package/browser/editor/page/format-bar/brush.mjs +77 -0
- package/browser/editor/page/format-bar/colors.mjs +46 -0
- package/browser/editor/page/format-bar/index.mjs +404 -0
- package/browser/editor/page/formula/index.mjs +236 -0
- package/browser/editor/page/formula/panel.mjs +336 -0
- package/browser/editor/page/formula/symbols.mjs +156 -0
- package/browser/editor/page/frame.mjs +74 -0
- package/browser/editor/page/frames.mjs +196 -0
- package/browser/editor/page/geometry.mjs +400 -0
- package/browser/editor/page/gesture.mjs +45 -0
- package/browser/editor/page/handle/index.mjs +639 -0
- package/browser/editor/page/handle-sizes.mjs +14 -0
- package/browser/editor/page/hints/index.mjs +84 -0
- package/browser/editor/page/history.mjs +401 -0
- package/browser/editor/page/insert/index.mjs +243 -0
- package/browser/editor/page/kept.mjs +38 -0
- package/browser/editor/page/links/address.mjs +40 -0
- package/browser/editor/page/links/index.mjs +866 -0
- package/browser/editor/page/links/pages.mjs +131 -0
- package/browser/editor/page/links/views.mjs +369 -0
- package/browser/editor/page/look.mjs +65 -0
- package/browser/editor/page/made.mjs +24 -0
- package/browser/editor/page/margin.mjs +352 -0
- package/browser/editor/page/markdown/index.mjs +88 -0
- package/browser/editor/page/markdown/rules.mjs +33 -0
- package/browser/editor/page/marks.mjs +377 -0
- package/browser/editor/page/media-menu/index.mjs +158 -0
- package/browser/editor/page/menu.mjs +500 -0
- package/browser/editor/page/merge.mjs +100 -0
- package/browser/editor/page/notices.mjs +142 -0
- package/browser/editor/page/offered.mjs +32 -0
- package/browser/editor/page/outline/folds.mjs +52 -0
- package/browser/editor/page/outline/index.mjs +697 -0
- package/browser/editor/page/outline/list.mjs +172 -0
- package/browser/editor/page/outline/read.mjs +201 -0
- package/browser/editor/page/outline/strip.mjs +281 -0
- package/browser/editor/page/outline/tree.mjs +248 -0
- package/browser/editor/page/overlay-layer.mjs +227 -0
- package/browser/editor/page/overlays.mjs +205 -0
- package/browser/editor/page/own.mjs +28 -0
- package/browser/editor/page/pads.mjs +71 -0
- package/browser/editor/page/page-objects.mjs +105 -0
- package/browser/editor/page/panel.mjs +64 -0
- package/browser/editor/page/placement.mjs +58 -0
- package/browser/editor/page/post.mjs +41 -0
- package/browser/editor/page/present-links.mjs +50 -0
- package/browser/editor/page/quiet.mjs +48 -0
- package/browser/editor/page/resize/index.mjs +327 -0
- package/browser/editor/page/select-all/index.mjs +262 -0
- package/browser/editor/page/selection/delete.mjs +59 -0
- package/browser/editor/page/selection/index.mjs +157 -0
- package/browser/editor/page/selection/marquee.mjs +174 -0
- package/browser/editor/page/session.mjs +117 -0
- package/browser/editor/page/slash-menu/index.mjs +291 -0
- package/browser/editor/page/storage.mjs +48 -0
- package/browser/editor/page/sync-state.mjs +267 -0
- package/browser/editor/page/table/aligns.mjs +29 -0
- package/browser/editor/page/table/cell-bar.mjs +138 -0
- package/browser/editor/page/table/cells.mjs +527 -0
- package/browser/editor/page/table/icons.mjs +40 -0
- package/browser/editor/page/table/index.mjs +985 -0
- package/browser/editor/page/table/lists.mjs +187 -0
- package/browser/editor/page/table/widths.mjs +308 -0
- package/browser/editor/page/tex.mjs +32 -0
- package/browser/editor/page/text-select/index.mjs +656 -0
- package/browser/editor/page/tooltip.mjs +98 -0
- package/browser/editor/page/type-grid.mjs +82 -0
- package/browser/editor/page/typing/code-edges.mjs +228 -0
- package/browser/editor/page/typing/index.mjs +276 -0
- package/browser/editor/page/typing/leave.mjs +68 -0
- package/browser/editor/page/ui.mjs +160 -0
- package/browser/shared/annotations.mjs +571 -0
- package/browser/shared/code-folds.mjs +10 -0
- package/browser/shared/code-languages.mjs +70 -0
- package/browser/shared/code-lines.mjs +30 -0
- package/browser/shared/colors.mjs +28 -0
- package/browser/shared/component-catalog.mjs +559 -0
- package/browser/shared/components/bookmark.mjs +26 -0
- package/browser/shared/components/callout.mjs +7 -0
- package/browser/shared/components/chart.mjs +20 -0
- package/browser/shared/components/code.mjs +37 -0
- package/browser/shared/components/columns.mjs +16 -0
- package/browser/shared/components/details.mjs +15 -0
- package/browser/shared/components/dialog.mjs +28 -0
- package/browser/shared/components/diff.mjs +18 -0
- package/browser/shared/components/divider.mjs +6 -0
- package/browser/shared/components/embed.mjs +25 -0
- package/browser/shared/components/figure.mjs +14 -0
- package/browser/shared/components/file.mjs +23 -0
- package/browser/shared/components/heading.mjs +6 -0
- package/browser/shared/components/highlight.mjs +9 -0
- package/browser/shared/components/icon.mjs +18 -0
- package/browser/shared/components/image.mjs +39 -0
- package/browser/shared/components/index.mjs +342 -0
- package/browser/shared/components/installed.mjs +162 -0
- package/browser/shared/components/list.mjs +146 -0
- package/browser/shared/components/math.mjs +49 -0
- package/browser/shared/components/mention.mjs +33 -0
- package/browser/shared/components/page.mjs +37 -0
- package/browser/shared/components/paragraph.mjs +9 -0
- package/browser/shared/components/quote.mjs +6 -0
- package/browser/shared/components/section.mjs +8 -0
- package/browser/shared/components/sheets.mjs +80 -0
- package/browser/shared/components/state.mjs +20 -0
- package/browser/shared/components/table.mjs +49 -0
- package/browser/shared/components/text.mjs +14 -0
- package/browser/shared/components/widget.mjs +10 -0
- package/browser/shared/copy-ids.mjs +72 -0
- package/browser/shared/css-references.mjs +110 -0
- package/browser/shared/emoji/custom.mjs +91 -0
- package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
- package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
- package/browser/shared/emoji/data/README.md +26 -0
- package/browser/shared/emoji/data/categories.json +1 -0
- package/browser/shared/emoji/data/icons.json +1 -0
- package/browser/shared/emoji/data/keywords-en.json +1 -0
- package/browser/shared/emoji/data/keywords-zh.json +1 -0
- package/browser/shared/emoji/data/names.json +1 -0
- package/browser/shared/emoji/data/positions.json +1 -0
- package/browser/shared/emoji/data/twemoji-index.json +1 -0
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +196 -0
- package/browser/shared/emoji/emoji.mjs +37 -0
- package/browser/shared/emoji/glyphs.mjs +134 -0
- package/browser/shared/emoji/icon-value.mjs +90 -0
- package/browser/shared/escape.mjs +20 -0
- package/browser/shared/export-wrap.mjs +89 -0
- package/browser/shared/files.mjs +33 -0
- package/browser/shared/html-tree.mjs +53 -0
- package/browser/shared/http.mjs +22 -0
- package/browser/shared/i18n/en.mjs +1164 -0
- package/browser/shared/i18n/index.mjs +132 -0
- package/browser/shared/ids.mjs +24 -0
- package/browser/shared/import-types.mjs +23 -0
- package/browser/shared/inline-spacing.mjs +97 -0
- package/browser/shared/layers.mjs +42 -0
- package/browser/shared/media.mjs +162 -0
- package/browser/shared/new-names.mjs +64 -0
- package/browser/shared/number-reading.mjs +92 -0
- package/browser/shared/old-names.mjs +143 -0
- package/browser/shared/page-address.mjs +140 -0
- package/browser/shared/page-links.mjs +86 -0
- package/browser/shared/paths.mjs +73 -0
- package/browser/shared/preferences.mjs +110 -0
- package/browser/shared/preview-server.mjs +247 -0
- package/browser/shared/qa-levels.mjs +93 -0
- package/browser/shared/reading-place.mjs +91 -0
- package/browser/shared/renamed-storage.mjs +220 -0
- package/browser/shared/reports.mjs +46 -0
- package/browser/shared/search.mjs +85 -0
- package/browser/shared/session.mjs +76 -0
- package/browser/shared/table-chart.mjs +113 -0
- package/browser/shared/table-hides.mjs +120 -0
- package/browser/shared/table-slots.mjs +75 -0
- package/browser/shared/words.mjs +23 -0
- package/browser/shared/workspace.mjs +535 -0
- package/browser/shared/writing-preferences.mjs +68 -0
- package/browser/shared/zoom.mjs +57 -0
- package/dist/chunk-2B5E4CDJ.mjs +2 -0
- package/dist/chunk-2PBALTR3.mjs +57 -0
- package/dist/chunk-342HXE3Q.mjs +2 -0
- package/dist/chunk-3LA3EMDE.mjs +15 -0
- package/dist/chunk-43B75J5T.mjs +2 -0
- package/dist/chunk-4K5KC6V2.mjs +2 -0
- package/dist/chunk-5FRMCDPY.mjs +16 -0
- package/dist/chunk-5L7RYZCL.mjs +2 -0
- package/dist/chunk-5LEK2CBS.mjs +2 -0
- package/dist/chunk-5OFN5AHC.mjs +2 -0
- package/dist/chunk-5SIYS5HN.mjs +2 -0
- package/dist/chunk-5TEK3RAD.mjs +2 -0
- package/dist/chunk-6CYG3Z4V.mjs +2 -0
- package/dist/chunk-6U2SLSDN.mjs +3 -0
- package/dist/chunk-742D2WWJ.mjs +19 -0
- package/dist/chunk-7GHT2UCA.mjs +15 -0
- package/dist/chunk-7QQBR7PB.mjs +2 -0
- package/dist/chunk-A55HN5OK.mjs +2 -0
- package/dist/chunk-ACOPDCNB.mjs +2 -0
- package/dist/chunk-AGDILNWB.mjs +2 -0
- package/dist/chunk-ATCJYAR4.mjs +2 -0
- package/dist/chunk-B3VTYBYR.mjs +960 -0
- package/dist/chunk-C564NU2H.mjs +77 -0
- package/dist/chunk-C7HWOBIF.mjs +2 -0
- package/dist/chunk-DB4WKGYF.mjs +7 -0
- package/dist/chunk-E7VYDG2X.mjs +2 -0
- package/dist/chunk-EUX7IC5J.mjs +48 -0
- package/dist/chunk-EVJ3BX3M.mjs +2 -0
- package/dist/chunk-EZY3WC6Z.mjs +15 -0
- package/dist/chunk-FQGQH4KM.mjs +2 -0
- package/dist/chunk-G7TOXONE.mjs +6 -0
- package/dist/chunk-GPF4YWWB.mjs +9 -0
- package/dist/chunk-GRAXKKG4.mjs +2 -0
- package/dist/chunk-GYQV7Y4J.mjs +120 -0
- package/dist/chunk-HMHK3EQ6.mjs +2 -0
- package/dist/chunk-HQQMJCQJ.mjs +10 -0
- package/dist/chunk-HYMEEXKN.mjs +4 -0
- package/dist/chunk-IERUOGC3.mjs +6 -0
- package/dist/chunk-ITNLYXXV.mjs +3 -0
- package/dist/chunk-L4DVONOG.mjs +2 -0
- package/dist/chunk-LAE5NQ4B.mjs +2 -0
- package/dist/chunk-LC7YNQFG.mjs +2 -0
- package/dist/chunk-LHTFLRB6.mjs +4 -0
- package/dist/chunk-LKX55H76.mjs +2 -0
- package/dist/chunk-MAFIGVXY.mjs +2 -0
- package/dist/chunk-NFIBI4IP.mjs +26 -0
- package/dist/chunk-NSKUTQ5J.mjs +5 -0
- package/dist/chunk-O52JMOCZ.mjs +2 -0
- package/dist/chunk-P2CAZPDP.mjs +3 -0
- package/dist/chunk-QAIHRH3I.mjs +13 -0
- package/dist/chunk-QMQUXTU4.mjs +12 -0
- package/dist/chunk-QR6A54KJ.mjs +3 -0
- package/dist/chunk-QVWVFC5K.mjs +6 -0
- package/dist/chunk-QYKCJ7FG.mjs +8 -0
- package/dist/chunk-QZY6Q64C.mjs +2 -0
- package/dist/chunk-TDQP3DKQ.mjs +10 -0
- package/dist/chunk-TMYZB6AV.mjs +2 -0
- package/dist/chunk-TX6JH7TR.mjs +2 -0
- package/dist/chunk-U3SSPL4K.mjs +8 -0
- package/dist/chunk-UH4SIXTR.mjs +2 -0
- package/dist/chunk-UNUEWH4S.mjs +2 -0
- package/dist/chunk-UXUK4PMC.mjs +27 -0
- package/dist/chunk-V4CPWKMZ.mjs +2 -0
- package/dist/chunk-V6XZ4VIR.mjs +2 -0
- package/dist/chunk-VACRB2NE.mjs +3 -0
- package/dist/chunk-W63L7367.mjs +7 -0
- package/dist/chunk-W7CXPCRV.mjs +6 -0
- package/dist/chunk-W7XHE4CT.mjs +2 -0
- package/dist/chunk-XINNG4F2.mjs +4 -0
- package/dist/chunk-Y34NR5JL.mjs +2 -0
- package/dist/chunk-YEY3RSFQ.mjs +2 -0
- package/dist/chunk-YL2DPWVS.mjs +4 -0
- package/dist/chunk-YXAUQPVK.mjs +8 -0
- package/dist/chunk-YZ5Z6H4W.mjs +4 -0
- package/dist/chunk-Z52HTUW7.mjs +4 -0
- package/dist/chunk-ZBIM6ARY.mjs +216 -0
- package/dist/cli.mjs +2 -0
- package/dist/server.mjs +2 -0
- package/dist/worker.mjs +5 -0
- package/kit/charts.js +355 -0
- package/kit/code.js +164 -0
- package/kit/dialogs.js +157 -0
- package/kit/math.js +1988 -0
- package/kit/report.css +2821 -0
- package/kit/runtime.js +1707 -0
- package/kit/sheets.js +123 -0
- package/kit/state.js +217 -0
- package/kit/tables.js +1449 -0
- package/kit/tokens.js +29 -0
- package/kit/ui.js +561 -0
- package/package.json +41 -4
- package/release.json +25 -0
- package/sdk/column-widths.d.ts +56 -0
- package/sdk/doc-charts.d.ts +82 -0
- package/sdk/doc-code.d.ts +28 -0
- package/sdk/doc-dialogs.d.ts +4 -0
- package/sdk/doc-kit.d.ts +141 -0
- package/sdk/doc-math.d.ts +3 -0
- package/sdk/doc-sheets.d.ts +15 -0
- package/sdk/doc-state.d.ts +41 -0
- package/sdk/doc-tables.d.ts +24 -0
- package/sdk/doc-tokens.d.ts +22 -0
- package/sdk/index.d.ts +30 -0
- package/skill/SKILL.md +138 -0
- package/skill/agents/openai.yaml +5 -0
- package/skill/references/building-components.md +327 -0
- package/skill/references/example-report.html +356 -0
- package/skill/references/writing-html.md +187 -0
- package/skill/sdk/column-widths.d.ts +56 -0
- package/skill/sdk/doc-charts.d.ts +82 -0
- package/skill/sdk/doc-code.d.ts +28 -0
- package/skill/sdk/doc-dialogs.d.ts +4 -0
- package/skill/sdk/doc-kit.d.ts +141 -0
- package/skill/sdk/doc-math.d.ts +3 -0
- package/skill/sdk/doc-sheets.d.ts +15 -0
- package/skill/sdk/doc-state.d.ts +41 -0
- package/skill/sdk/doc-tables.d.ts +24 -0
- package/skill/sdk/doc-tokens.d.ts +22 -0
- package/skill/sdk/index.d.ts +30 -0
- package/starter/doc.html +21 -0
- package/starter/doc.json +5 -0
- package/vendor/d3.v7.9.0.min.js +2 -0
- package/vendor/katex/auto-render.min.js +1 -0
- package/vendor/katex/contrib/mhchem.min.js +1 -0
- package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/vendor/katex/katex.min.css +1 -0
- package/vendor/katex/katex.min.js +1 -0
- package/vendor/pdfjs/LICENSE +177 -0
- package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
- package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
- package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/vendor/types/@types/d3/LICENSE +21 -0
- package/vendor/types/@types/d3/index.d.ts +39 -0
- package/vendor/types/@types/d3/package.json +81 -0
- package/vendor/types/@types/d3-array/LICENSE +21 -0
- package/vendor/types/@types/d3-array/index.d.ts +1118 -0
- package/vendor/types/@types/d3-array/package.json +56 -0
- package/vendor/types/@types/d3-axis/LICENSE +21 -0
- package/vendor/types/@types/d3-axis/index.d.ts +293 -0
- package/vendor/types/@types/d3-axis/package.json +47 -0
- package/vendor/types/@types/d3-brush/LICENSE +21 -0
- package/vendor/types/@types/d3-brush/index.d.ts +255 -0
- package/vendor/types/@types/d3-brush/package.json +42 -0
- package/vendor/types/@types/d3-chord/LICENSE +21 -0
- package/vendor/types/@types/d3-chord/index.d.ts +471 -0
- package/vendor/types/@types/d3-chord/package.json +40 -0
- package/vendor/types/@types/d3-color/LICENSE +21 -0
- package/vendor/types/@types/d3-color/index.d.ts +669 -0
- package/vendor/types/@types/d3-color/package.json +55 -0
- package/vendor/types/@types/d3-contour/LICENSE +21 -0
- package/vendor/types/@types/d3-contour/index.d.ts +222 -0
- package/vendor/types/@types/d3-contour/package.json +38 -0
- package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
- package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
- package/vendor/types/@types/d3-delaunay/package.json +30 -0
- package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
- package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
- package/vendor/types/@types/d3-dispatch/package.json +51 -0
- package/vendor/types/@types/d3-drag/LICENSE +21 -0
- package/vendor/types/@types/d3-drag/index.d.ts +395 -0
- package/vendor/types/@types/d3-drag/package.json +42 -0
- package/vendor/types/@types/d3-dsv/LICENSE +21 -0
- package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
- package/vendor/types/@types/d3-dsv/package.json +45 -0
- package/vendor/types/@types/d3-ease/LICENSE +21 -0
- package/vendor/types/@types/d3-ease/index.d.ts +316 -0
- package/vendor/types/@types/d3-ease/package.json +40 -0
- package/vendor/types/@types/d3-fetch/LICENSE +21 -0
- package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
- package/vendor/types/@types/d3-fetch/package.json +37 -0
- package/vendor/types/@types/d3-force/LICENSE +21 -0
- package/vendor/types/@types/d3-force/index.d.ts +899 -0
- package/vendor/types/@types/d3-force/package.json +45 -0
- package/vendor/types/@types/d3-format/LICENSE +21 -0
- package/vendor/types/@types/d3-format/index.d.ts +337 -0
- package/vendor/types/@types/d3-format/package.json +45 -0
- package/vendor/types/@types/d3-geo/LICENSE +21 -0
- package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
- package/vendor/types/@types/d3-geo/package.json +48 -0
- package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
- package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
- package/vendor/types/@types/d3-hierarchy/package.json +50 -0
- package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
- package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
- package/vendor/types/@types/d3-interpolate/package.json +47 -0
- package/vendor/types/@types/d3-path/LICENSE +21 -0
- package/vendor/types/@types/d3-path/index.d.ts +108 -0
- package/vendor/types/@types/d3-path/package.json +41 -0
- package/vendor/types/@types/d3-polygon/LICENSE +21 -0
- package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
- package/vendor/types/@types/d3-polygon/package.json +40 -0
- package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
- package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
- package/vendor/types/@types/d3-quadtree/package.json +45 -0
- package/vendor/types/@types/d3-random/LICENSE +21 -0
- package/vendor/types/@types/d3-random/index.d.ts +313 -0
- package/vendor/types/@types/d3-random/package.json +41 -0
- package/vendor/types/@types/d3-scale/LICENSE +21 -0
- package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
- package/vendor/types/@types/d3-scale/package.json +53 -0
- package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
- package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
- package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
- package/vendor/types/@types/d3-selection/LICENSE +21 -0
- package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
- package/vendor/types/@types/d3-selection/package.json +56 -0
- package/vendor/types/@types/d3-shape/LICENSE +21 -0
- package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
- package/vendor/types/@types/d3-shape/package.json +53 -0
- package/vendor/types/@types/d3-time/LICENSE +21 -0
- package/vendor/types/@types/d3-time/index.d.ts +697 -0
- package/vendor/types/@types/d3-time/package.json +46 -0
- package/vendor/types/@types/d3-time-format/LICENSE +21 -0
- package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
- package/vendor/types/@types/d3-time-format/package.json +40 -0
- package/vendor/types/@types/d3-timer/LICENSE +21 -0
- package/vendor/types/@types/d3-timer/index.d.ts +68 -0
- package/vendor/types/@types/d3-timer/package.json +45 -0
- package/vendor/types/@types/d3-transition/LICENSE +21 -0
- package/vendor/types/@types/d3-transition/index.d.ts +664 -0
- package/vendor/types/@types/d3-transition/package.json +47 -0
- package/vendor/types/@types/d3-zoom/LICENSE +21 -0
- package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
- package/vendor/types/@types/d3-zoom/package.json +48 -0
- package/vendor/types/@types/geojson/LICENSE +21 -0
- package/vendor/types/@types/geojson/index.d.ts +202 -0
- package/vendor/types/@types/geojson/package.json +46 -0
- package/vendor/typescript/LICENSE.txt +55 -0
- package/vendor/typescript/lib.decorators.d.ts +384 -0
- package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
- package/vendor/typescript/lib.dom.d.ts +39429 -0
- package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
- package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
- package/vendor/typescript/lib.es2015.core.d.ts +597 -0
- package/vendor/typescript/lib.es2015.d.ts +28 -0
- package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
- package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
- package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
- package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
- package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
- package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
- package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
- package/vendor/typescript/lib.es2016.d.ts +21 -0
- package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
- package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
- package/vendor/typescript/lib.es2017.d.ts +26 -0
- package/vendor/typescript/lib.es2017.date.d.ts +31 -0
- package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
- package/vendor/typescript/lib.es2017.object.d.ts +49 -0
- package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
- package/vendor/typescript/lib.es2017.string.d.ts +45 -0
- package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
- package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
- package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
- package/vendor/typescript/lib.es2018.d.ts +24 -0
- package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
- package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
- package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
- package/vendor/typescript/lib.es2019.array.d.ts +79 -0
- package/vendor/typescript/lib.es2019.d.ts +24 -0
- package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
- package/vendor/typescript/lib.es2019.object.d.ts +33 -0
- package/vendor/typescript/lib.es2019.string.d.ts +37 -0
- package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
- package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
- package/vendor/typescript/lib.es2020.d.ts +27 -0
- package/vendor/typescript/lib.es2020.date.d.ts +42 -0
- package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
- package/vendor/typescript/lib.es2020.number.d.ts +28 -0
- package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
- package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
- package/vendor/typescript/lib.es2020.string.d.ts +44 -0
- package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/vendor/typescript/lib.es2021.d.ts +23 -0
- package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
- package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
- package/vendor/typescript/lib.es2021.string.d.ts +33 -0
- package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
- package/vendor/typescript/lib.es2022.array.d.ts +121 -0
- package/vendor/typescript/lib.es2022.d.ts +25 -0
- package/vendor/typescript/lib.es2022.error.d.ts +75 -0
- package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
- package/vendor/typescript/lib.es2022.object.d.ts +26 -0
- package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
- package/vendor/typescript/lib.es2022.string.d.ts +25 -0
- package/vendor/typescript/lib.es5.d.ts +4601 -0
- package/vendor/typescript/package.json +4 -0
- package/vendor/typescript/typescript.js +446 -0
- package/web/assets/index-B6Ai3wsa.js +13 -0
- package/web/assets/index-SYPC3EZy.css +1 -0
- package/web/index.html +14 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{c as Lu,e as cu}from"./chunk-5L7RYZCL.mjs";var gu=Lu((Mt,tD)=>{tD.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var yD=Lu((hn,xD)=>{"use strict";xD.exports=function(D){if(D===void 0&&(D=2),D>=Error.stackTraceLimit)throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+D+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var e=Error.prepareStackTrace;Error.prepareStackTrace=function(n,a){return a};var r=new Error().stack;if(Error.prepareStackTrace=e,r!==null&&typeof r=="object")return r[D]?r[D].getFileName():void 0}});import{format as UD}from"util";import{normalize as qD,resolve as KD}from"path";function P(u){if(u!==u.toLowerCase()&&u!==u.toUpperCase()||(u=u.toLowerCase()),u.indexOf("-")===-1&&u.indexOf("_")===-1)return u;{let e="",r=!1,n=u.match(/^-+/);for(let a=n?n[0].length:0;a<u.length;a++){let l=u.charAt(a);r&&(r=!1,l=l.toUpperCase()),a!==0&&(l==="-"||l==="_")?r=!0:l!=="-"&&l!=="_"&&(e+=l)}return e}}function Z(u,D){let e=u.toLowerCase();D=D||"-";let r="";for(let n=0;n<u.length;n++){let a=e.charAt(n),l=u.charAt(n);a!==l&&n>0?r+=`${D}${e.charAt(n)}`:r+=l}return r}function X(u){return u==null?!1:typeof u=="number"||/^0x[0-9a-f]+$/i.test(u)?!0:/^0[^.]/.test(u)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(u)}function $u(u){if(Array.isArray(u))return u.map(l=>typeof l!="string"?l+"":l);u=u.trim();let D=0,e=null,r=null,n=null,a=[];for(let l=0;l<u.length;l++){if(e=r,r=u.charAt(l),r===" "&&!n){e!==" "&&D++;continue}r===n?n=null:(r==="'"||r==='"')&&!n&&(n=r),a[D]||(a[D]=""),a[D]+=r}return a}var N;(function(u){u.BOOLEAN="boolean",u.STRING="string",u.NUMBER="number",u.ARRAY="array"})(N||(N={}));var I,uu=class{constructor(D){I=D}parse(D,e){let r=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),n=$u(D),a=typeof D=="string",l=zD(Object.assign(Object.create(null),r.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),p=Object.assign(Object.create(null),r.default),A=r.configObjects||[],B=r.envPrefix,b=o["populate--"],O=b?"--":"_",y=Object.create(null),$=Object.create(null),S=r.__||I.format,c={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},T=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,su=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(t){let s=typeof t=="object"?t.key:t,f=Object.keys(t).map(function(F){return{boolean:"bools",string:"strings",number:"numbers"}[F]}).filter(Boolean).pop();f&&(c[f][s]=!0),c.arrays[s]=!0,c.keys.push(s)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(t){c.bools[t]=!0,c.keys.push(t)}),[].concat(r.string||[]).filter(Boolean).forEach(function(t){c.strings[t]=!0,c.keys.push(t)}),[].concat(r.number||[]).filter(Boolean).forEach(function(t){c.numbers[t]=!0,c.keys.push(t)}),[].concat(r.count||[]).filter(Boolean).forEach(function(t){c.counts[t]=!0,c.keys.push(t)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(t){c.normalize[t]=!0,c.keys.push(t)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([t,s])=>{typeof s=="number"&&(c.nargs[t]=s,c.keys.push(t))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([t,s])=>{typeof s=="function"&&(c.coercions[t]=s,c.keys.push(t))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(t){c.configs[t]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([t,s])=>{(typeof s=="boolean"||typeof s=="function")&&(c.configs[t]=s)})),LD(r.key,l,r.default,c.arrays),Object.keys(p).forEach(function(t){(c.aliases[t]||[]).forEach(function(s){p[s]=p[t]})});let W=null;PD();let Q=[],x=Object.assign(Object.create(null),{_:[]}),ju={};for(let t=0;t<n.length;t++){let s=n[t],f=s.replace(/^-{3,}/,"---"),F,i,C,E,d,_;if(s!=="--"&&/^-/.test(s)&&Y(s))ou(s);else if(f.match(/^---+(=|$)/)){ou(s);continue}else if(s.match(/^--.+=/)||!o["short-option-groups"]&&s.match(/^-.+=/))E=s.match(/^--?([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&(h(E[1],c.arrays)?t=J(t,E[1],n,E[2]):h(E[1],c.nargs)!==!1?t=H(t,E[1],n,E[2]):g(E[1],E[2],!0));else if(s.match(su)&&o["boolean-negation"])E=s.match(su),E!==null&&Array.isArray(E)&&E.length>=2&&(i=E[1],g(i,h(i,c.arrays)?[!1]:!1));else if(s.match(/^--.+/)||!o["short-option-groups"]&&s.match(/^-[^-]+/))E=s.match(/^--?(.+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(i=E[1],h(i,c.arrays)?t=J(t,i,n):h(i,c.nargs)!==!1?t=H(t,i,n):(d=n[t+1],d!==void 0&&(!d.match(/^-/)||d.match(T))&&!h(i,c.bools)&&!h(i,c.counts)||/^(true|false)$/.test(d)?(g(i,d),t++):g(i,G(i))));else if(s.match(/^-.\..+=/))E=s.match(/^-([^=]+)=([\s\S]*)$/),E!==null&&Array.isArray(E)&&E.length>=3&&g(E[1],E[2]);else if(s.match(/^-.\..+/)&&!s.match(T))d=n[t+1],E=s.match(/^-(.\..+)/),E!==null&&Array.isArray(E)&&E.length>=2&&(i=E[1],d!==void 0&&!d.match(/^-/)&&!h(i,c.bools)&&!h(i,c.counts)?(g(i,d),t++):g(i,G(i)));else if(s.match(/^-[^-]+/)&&!s.match(T)){C=s.slice(1,-1).split(""),F=!1;for(let w=0;w<C.length;w++){if(d=s.slice(w+2),C[w+1]&&C[w+1]==="="){_=s.slice(w+3),i=C[w],h(i,c.arrays)?t=J(t,i,n,_):h(i,c.nargs)!==!1?t=H(t,i,n,_):g(i,_),F=!0;break}if(d==="-"){g(C[w],d);continue}if(/[A-Za-z]/.test(C[w])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(d)&&h(d,c.bools)===!1){g(C[w],d),F=!0;break}if(C[w+1]&&C[w+1].match(/\W/)){g(C[w],d),F=!0;break}else g(C[w],G(C[w]))}i=s.slice(-1)[0],!F&&i!=="-"&&(h(i,c.arrays)?t=J(t,i,n):h(i,c.nargs)!==!1?t=H(t,i,n):(d=n[t+1],d!==void 0&&(!/^(-|--)[^-]/.test(d)||d.match(T))&&!h(i,c.bools)&&!h(i,c.counts)||/^(true|false)$/.test(d)?(g(i,d),t++):g(i,G(i))))}else if(s.match(/^-[0-9]$/)&&s.match(T)&&h(s.slice(1),c.bools))i=s.slice(1),g(i,G(i));else if(s==="--"){Q=n.slice(t+1);break}else if(o["halt-at-non-option"]){Q=n.slice(t);break}else ou(s)}Nu(x,!0),Nu(x,!1),SD(x),ND(),Wu(x,c.aliases,p,!0),WD(x),o["set-placeholder-key"]&&RD(x),Object.keys(c.counts).forEach(function(t){U(x,t.split("."))||g(t,0)}),b&&Q.length&&(x[O]=[]),Q.forEach(function(t){x[O].push(t)}),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(x).filter(t=>t!=="--"&&t.includes("-")).forEach(t=>{delete x[t]}),o["strip-aliased"]&&[].concat(...Object.keys(l).map(t=>l[t])).forEach(t=>{o["camel-case-expansion"]&&t.includes("-")&&delete x[t.split(".").map(s=>P(s)).join(".")],delete x[t]});function ou(t){let s=k("_",t);(typeof s=="string"||typeof s=="number")&&x._.push(s)}function H(t,s,f,F){let i,C=h(s,c.nargs);if(C=typeof C!="number"||isNaN(C)?1:C,C===0)return M(F)||(W=Error(S("Argument unexpected for: %s",s))),g(s,G(s)),t;let E=M(F)?0:1;if(o["nargs-eats-options"])f.length-(t+1)+E<C&&(W=Error(S("Not enough arguments following: %s",s))),E=C;else{for(i=t+1;i<f.length&&(!f[i].match(/^-[^0-9]/)||f[i].match(T)||Y(f[i]));i++)E++;E<C&&(W=Error(S("Not enough arguments following: %s",s)))}let d=Math.min(E,C);for(!M(F)&&d>0&&(g(s,F),d--),i=t+1;i<d+t+1;i++)g(s,f[i]);return t+d}function J(t,s,f,F){let i=[],C=F||f[t+1],E=h(s,c.nargs);if(h(s,c.bools)&&!/^(true|false)$/.test(C))i.push(!0);else if(M(C)||M(F)&&/^-/.test(C)&&!T.test(C)&&!Y(C)){if(p[s]!==void 0){let d=p[s];i=Array.isArray(d)?d:[d]}}else{M(F)||i.push(Fu(s,F,!0));for(let d=t+1;d<f.length&&!(!o["greedy-arrays"]&&i.length>0||E&&typeof E=="number"&&i.length>=E||(C=f[d],/^-/.test(C)&&!T.test(C)&&!Y(C)));d++)t=d,i.push(Fu(s,C,a))}return typeof E=="number"&&(E&&i.length<E||isNaN(E)&&i.length===0)&&(W=Error(S("Not enough arguments following: %s",s))),g(s,i),t}function g(t,s,f=a){if(/-/.test(t)&&o["camel-case-expansion"]){let C=t.split(".").map(function(E){return P(E)}).join(".");Su(t,C)}let F=Fu(t,s,f),i=t.split(".");q(x,i,F),c.aliases[t]&&c.aliases[t].forEach(function(C){let E=C.split(".");q(x,E,F)}),i.length>1&&o["dot-notation"]&&(c.aliases[i[0]]||[]).forEach(function(C){let E=C.split("."),d=[].concat(i);d.shift(),E=E.concat(d),(c.aliases[t]||[]).includes(E.join("."))||q(x,E,F)}),h(t,c.normalize)&&!h(t,c.arrays)&&[t].concat(c.aliases[t]||[]).forEach(function(E){Object.defineProperty(ju,E,{enumerable:!0,get(){return s},set(d){s=typeof d=="string"?I.normalize(d):d}})})}function Su(t,s){c.aliases[t]&&c.aliases[t].length||(c.aliases[t]=[s],y[s]=!0),c.aliases[s]&&c.aliases[s].length||Su(s,t)}function Fu(t,s,f){f&&(s=GD(s)),(h(t,c.bools)||h(t,c.counts))&&typeof s=="string"&&(s=s==="true");let F=Array.isArray(s)?s.map(function(i){return k(t,i)}):k(t,s);return h(t,c.counts)&&(M(F)||typeof F=="boolean")&&(F=lu()),h(t,c.normalize)&&h(t,c.arrays)&&(Array.isArray(s)?F=s.map(i=>I.normalize(i)):F=I.normalize(s)),F}function k(t,s){return!o["parse-positional-numbers"]&&t==="_"||!h(t,c.strings)&&!h(t,c.bools)&&!Array.isArray(s)&&(X(s)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))||!M(s)&&h(t,c.numbers))&&(s=Number(s)),s}function SD(t){let s=Object.create(null);Wu(s,c.aliases,p),Object.keys(c.configs).forEach(function(f){let F=t[f]||s[f];if(F)try{let i=null,C=I.resolve(I.cwd(),F),E=c.configs[f];if(typeof E=="function"){try{i=E(C)}catch(d){i=d}if(i instanceof Error){W=i;return}}else i=I.require(C);au(i)}catch(i){i.name==="PermissionDenied"?W=i:t[f]&&(W=Error(S("Invalid JSON config file: %s",F)))}})}function au(t,s){Object.keys(t).forEach(function(f){let F=t[f],i=s?s+"."+f:f;typeof F=="object"&&F!==null&&!Array.isArray(F)&&o["dot-notation"]?au(F,i):(!U(x,i.split("."))||h(i,c.arrays)&&o["combine-arrays"])&&g(i,F)})}function ND(){typeof A<"u"&&A.forEach(function(t){au(t)})}function Nu(t,s){if(typeof B>"u")return;let f=typeof B=="string"?B:"",F=I.env();Object.keys(F).forEach(function(i){if(f===""||i.lastIndexOf(f,0)===0){let C=i.split("__").map(function(E,d){return d===0&&(E=E.substring(f.length)),P(E)});(s&&c.configs[C.join(".")]||!s)&&!U(t,C)&&g(C.join("."),F[i])}})}function WD(t){let s,f=new Set;Object.keys(t).forEach(function(F){if(!f.has(F)&&(s=h(F,c.coercions),typeof s=="function"))try{let i=k(F,s(t[F]));[].concat(c.aliases[F]||[],F).forEach(C=>{f.add(C),t[C]=i})}catch(i){W=i}})}function RD(t){return c.keys.forEach(s=>{~s.indexOf(".")||typeof t[s]>"u"&&(t[s]=void 0)}),t}function Wu(t,s,f,F=!1){Object.keys(f).forEach(function(i){U(t,i.split("."))||(q(t,i.split("."),f[i]),F&&($[i]=!0),(s[i]||[]).forEach(function(C){U(t,C.split("."))||q(t,C.split("."),f[i])}))})}function U(t,s){let f=t;o["dot-notation"]||(s=[s.join(".")]),s.slice(0,-1).forEach(function(i){f=f[i]||{}});let F=s[s.length-1];return typeof f!="object"?!1:F in f}function q(t,s,f){let F=t;o["dot-notation"]||(s=[s.join(".")]),s.slice(0,-1).forEach(function(_){_=Tu(_),typeof F=="object"&&F[_]===void 0&&(F[_]={}),typeof F[_]!="object"||Array.isArray(F[_])?(Array.isArray(F[_])?F[_].push({}):F[_]=[F[_],{}],F=F[_][F[_].length-1]):F=F[_]});let i=Tu(s[s.length-1]),C=h(s.join("."),c.arrays),E=Array.isArray(f),d=o["duplicate-arguments-array"];!d&&h(i,c.nargs)&&(d=!0,(!M(F[i])&&c.nargs[i]===1||Array.isArray(F[i])&&F[i].length===c.nargs[i])&&(F[i]=void 0)),f===lu()?F[i]=lu(F[i]):Array.isArray(F[i])?d&&C&&E?F[i]=o["flatten-duplicate-arrays"]?F[i].concat(f):(Array.isArray(F[i][0])?F[i]:[F[i]]).concat([f]):!d&&!!C==!!E?F[i]=f:F[i]=F[i].concat([f]):F[i]===void 0&&C?F[i]=E?f:[f]:d&&!(F[i]===void 0||h(i,c.counts)||h(i,c.bools))?F[i]=[F[i],f]:F[i]=f}function LD(...t){t.forEach(function(s){Object.keys(s||{}).forEach(function(f){c.aliases[f]||(c.aliases[f]=[].concat(l[f]||[]),c.aliases[f].concat(f).forEach(function(F){if(/-/.test(F)&&o["camel-case-expansion"]){let i=P(F);i!==f&&c.aliases[f].indexOf(i)===-1&&(c.aliases[f].push(i),y[i]=!0)}}),c.aliases[f].concat(f).forEach(function(F){if(F.length>1&&/[A-Z]/.test(F)&&o["camel-case-expansion"]){let i=Z(F,"-");i!==f&&c.aliases[f].indexOf(i)===-1&&(c.aliases[f].push(i),y[i]=!0)}}),c.aliases[f].forEach(function(F){c.aliases[F]=[f].concat(c.aliases[f].filter(function(i){return F!==i}))}))})})}function h(t,s){let f=[].concat(c.aliases[t]||[],t),F=Object.keys(s),i=f.find(C=>F.includes(C));return i?s[i]:!1}function Ru(t){let s=Object.keys(c);return[].concat(s.map(F=>c[F])).some(function(F){return Array.isArray(F)?F.includes(t):F[t]})}function $D(t,...s){return[].concat(...s).some(function(F){let i=t.match(F);return i&&Ru(i[1])})}function TD(t){if(t.match(T)||!t.match(/^-[^-]+/))return!1;let s=!0,f,F=t.slice(1).split("");for(let i=0;i<F.length;i++){if(f=t.slice(i+2),!Ru(F[i])){s=!1;break}if(F[i+1]&&F[i+1]==="="||f==="-"||/[A-Za-z]/.test(F[i])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(f)||F[i+1]&&F[i+1].match(/\W/))break}return s}function Y(t){return o["unknown-options-as-args"]&&MD(t)}function MD(t){return t=t.replace(/^-{3,}/,"--"),t.match(T)||TD(t)?!1:!$D(t,/^-+([^=]+?)=[\s\S]*$/,su,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function G(t){return!h(t,c.bools)&&!h(t,c.counts)&&`${t}`in p?p[t]:ID(vD(t))}function ID(t){return{[N.BOOLEAN]:!0,[N.STRING]:"",[N.NUMBER]:void 0,[N.ARRAY]:[]}[t]}function vD(t){let s=N.BOOLEAN;return h(t,c.strings)?s=N.STRING:h(t,c.numbers)?s=N.NUMBER:h(t,c.bools)?s=N.BOOLEAN:h(t,c.arrays)&&(s=N.ARRAY),s}function M(t){return t===void 0}function PD(){Object.keys(c.counts).find(t=>h(t,c.arrays)?(W=Error(S("Invalid configuration: %s, opts.count excludes opts.array.",t)),!0):h(t,c.nargs)?(W=Error(S("Invalid configuration: %s, opts.count excludes opts.narg.",t)),!0):!1)}return{aliases:Object.assign({},c.aliases),argv:Object.assign(ju,x),configuration:o,defaulted:Object.assign({},$),error:W,newAliases:Object.assign({},y)}}};function zD(u){let D=[],e=Object.create(null),r=!0;for(Object.keys(u).forEach(function(n){D.push([].concat(u[n],n))});r;){r=!1;for(let n=0;n<D.length;n++)for(let a=n+1;a<D.length;a++)if(D[n].filter(function(o){return D[a].indexOf(o)!==-1}).length){D[n]=D[n].concat(D[a]),D.splice(a,1),r=!0;break}}return D.forEach(function(n){n=n.filter(function(l,o,p){return p.indexOf(l)===o});let a=n.pop();a!==void 0&&typeof a=="string"&&(e[a]=n)}),e}function lu(u){return u!==void 0?u+1:1}function Tu(u){return u==="__proto__"?"___proto___":u}function GD(u){return typeof u=="string"&&(u[0]==="'"||u[0]==='"')&&u[u.length-1]===u[0]?u.substring(1,u.length-1):u}import{readFileSync as VD}from"fs";import{createRequire as Mu}from"node:module";var fu,Eu,Cu,Iu=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,vu=(Eu=(fu=process==null?void 0:process.versions)===null||fu===void 0?void 0:fu.node)!==null&&Eu!==void 0?Eu:(Cu=process==null?void 0:process.version)===null||Cu===void 0?void 0:Cu.slice(1);if(vu&&Number(vu.match(/^([^.]+)/)[1])<Iu)throw Error(`yargs parser supports a minimum Node.js version of ${Iu}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var QD=process?process.env:{},Pu=Mu?Mu(import.meta.url):void 0,zu=new uu({cwd:process.cwd,env:()=>QD,format:UD,normalize:qD,resolve:KD,require:u=>{if(typeof Pu<"u")return Pu(u);if(u.match(/\.json$/))return JSON.parse(VD(u,"utf8"));throw Error("only .json config files are supported in ESM")}}),K=function(D,e){return zu.parse(D.slice(),e).argv};K.detailed=function(u,D){return zu.parse(u.slice(),D)};K.camelCase=P;K.decamelize=Z;K.looksLikeNumber=X;var Gu=K;function Uu(){return HD()?0:1}function HD(){return JD()&&!process.defaultApp}function JD(){return!!process.versions.electron}function ht(u){return u.slice(Uu()+1)}function qu(){return process.argv[Uu()]}import{notStrictEqual as ze,strictEqual as Ge}from"assert";var kD={right:De,center:ee},YD=0,Du=1,ZD=2,eu=3,du=class{constructor(D){var e;this.width=D.width,this.wrap=(e=D.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...D){let e=this.div(...D);e.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]=="string")return this.applyLayoutDSL(D[0]);let e=D.map(r=>typeof r=="string"?this.colFromString(r):r);return this.rows.push(e),e}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]=="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let e=D.split(`
|
|
3
|
+
`).map(n=>n.split(" ")),r=0;return e.forEach(n=>{n.length>1&&j.stringWidth(n[0])>r&&(r=Math.min(Math.floor(this.width*.5),j.stringWidth(n[0])))}),e.forEach(n=>{this.div(...n.map((a,l)=>({text:a.trim(),padding:this.measurePadding(a),width:l===0&&n.length>1?r:void 0})))}),this.rows[this.rows.length-1]}colFromString(D){return{text:D,padding:this.measurePadding(D)}}measurePadding(D){let e=j.stripAnsi(D);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let D=[];return this.rows.forEach(e=>{this.rowToString(e,D)}),D.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
4
|
+
`)}rowToString(D,e){return this.rasterize(D).forEach((r,n)=>{let a="";r.forEach((l,o)=>{let{width:p}=D[o],A=this.negatePadding(D[o]),B=l;if(A>j.stringWidth(l)&&(B+=" ".repeat(A-j.stringWidth(l))),D[o].align&&D[o].align!=="left"&&this.wrap){let O=kD[D[o].align];B=O(B,A),j.stringWidth(B)<A&&(B+=" ".repeat((p||0)-j.stringWidth(B)-1))}let b=D[o].padding||[0,0,0,0];b[eu]&&(a+=" ".repeat(b[eu])),a+=Ku(D[o],B,"| "),a+=B,a+=Ku(D[o],B," |"),b[Du]&&(a+=" ".repeat(b[Du])),n===0&&e.length>0&&(a=this.renderInline(a,e[e.length-1]))}),e.push({text:a.replace(/ +$/,""),span:D.span})}),e}renderInline(D,e){let r=D.match(/^ */),n=r?r[0].length:0,a=e.text,l=j.stringWidth(a.trimRight());return e.span?this.wrap?n<l?D:(e.hidden=!0,a.trimRight()+" ".repeat(n-l)+D.trimLeft()):(e.hidden=!0,a+D):D}rasterize(D){let e=[],r=this.columnWidths(D),n;return D.forEach((a,l)=>{a.width=r[l],this.wrap?n=j.wrap(a.text,this.negatePadding(a),{hard:!0}).split(`
|
|
5
|
+
`):n=a.text.split(`
|
|
6
|
+
`),a.border&&(n.unshift("."+"-".repeat(this.negatePadding(a)+2)+"."),n.push("'"+"-".repeat(this.negatePadding(a)+2)+"'")),a.padding&&(n.unshift(...new Array(a.padding[YD]||0).fill("")),n.push(...new Array(a.padding[ZD]||0).fill(""))),n.forEach((o,p)=>{e[p]||e.push([]);let A=e[p];for(let B=0;B<l;B++)A[B]===void 0&&A.push("");A.push(o)})}),e}negatePadding(D){let e=D.width||0;return D.padding&&(e-=(D.padding[eu]||0)+(D.padding[Du]||0)),D.border&&(e-=4),e}columnWidths(D){if(!this.wrap)return D.map(l=>l.width||j.stringWidth(l.text));let e=D.length,r=this.width,n=D.map(l=>{if(l.width)return e--,r-=l.width,l.width}),a=e?Math.floor(r/e):0;return n.map((l,o)=>l===void 0?Math.max(a,XD(D[o])):l)}};function Ku(u,D,e){return u.border?/[.']-+[.']/.test(D)?"":D.trim().length!==0?e:" ":""}function XD(u){let D=u.padding||[],e=1+(D[eu]||0)+(D[Du]||0);return u.border?e+4:e}function ue(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function De(u,D){u=u.trim();let e=j.stringWidth(u);return e<D?" ".repeat(D-e)+u:u}function ee(u,D){u=u.trim();let e=j.stringWidth(u);return e>=D?u:" ".repeat(D-e>>1)+u}var j;function Vu(u,D){return j=D,new du({width:u?.width||ue(),wrap:u?.wrap})}function hu({onlyFirst:u=!1}={}){let n="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(n,u?void 0:"g")}var te=hu();function R(u){if(typeof u!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof u}\``);return!u.includes("\x1B")&&!u.includes("\x9B")?u:u.replace(te,"")}var Qu=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Hu=12288,Ju=65510,ku=[12288,12288,65281,65376,65504,65510];var Yu=4352,Zu=262141,pu=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101594,101631,101664,101760,101874,101888,102801,102816,102866,110576,110579,110581,110587,110589,110590,110592,110888,110898,110898,110928,110930,110933,110933,110948,110952,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127406,127406,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128729,128732,128735,128747,128748,128756,128764,128986,128986,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129734,129736,129736,129740,129757,129759,129771,129775,129786,131072,196605,196608,262141];var tu=(u,D)=>{let e=0,r=Math.floor(u.length/2)-1;for(;e<=r;){let n=Math.floor((e+r)/2),a=n*2;if(D<u[a])r=n-1;else if(D>u[a+1])e=n+1;else return!0}return!1};var Xu=19968,[ie,se]=oe(pu);function oe(u){let D=u[0],e=u[1];for(let r=0;r<u.length;r+=2){let n=u[r],a=u[r+1];if(Xu>=n&&Xu<=a)return[n,a];a-n>e-D&&(D=n,e=a)}return[D,e]}var uD=u=>u<161||u>1114109?!1:tu(Qu,u),DD=u=>u<Hu||u>Ju?!1:tu(ku,u);var eD=u=>u>=ie&&u<=se?!0:u<Yu||u>Zu?!1:tu(pu,u);function Fe(u){if(!Number.isSafeInteger(u))throw new TypeError(`Expected a code point, got \`${typeof u}\`.`)}function v(u,{ambiguousAsWide:D=!1}={}){return Fe(u),DD(u)||eD(u)||D&&uD(u)?2:1}var nD=cu(gu(),1),ae=new Intl.Segmenter,ce=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function mu(u,D={}){if(typeof u!="string"||u.length===0)return 0;let{ambiguousIsNarrow:e=!0,countAnsiEscapeCodes:r=!1}=D;if(r||(u=R(u)),u.length===0)return 0;let n=0,a={ambiguousAsWide:!e};for(let{segment:l}of ae.segment(u)){let o=l.codePointAt(0);if(!(o<=31||o>=127&&o<=159)&&!(o>=8203&&o<=8207||o===65279)&&!(o>=768&&o<=879||o>=6832&&o<=6911||o>=7616&&o<=7679||o>=8400&&o<=8447||o>=65056&&o<=65071)&&!(o>=55296&&o<=57343)&&!(o>=65024&&o<=65039)&&!ce.test(l)){if((0,nD.default)().test(l)){n+=2;continue}n+=v(o,a)}}return n}var rD=cu(gu(),1),le=new Intl.Segmenter,fe=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function z(u,D={}){if(typeof u!="string"||u.length===0)return 0;let{ambiguousIsNarrow:e=!0,countAnsiEscapeCodes:r=!1}=D;if(r||(u=R(u)),u.length===0)return 0;let n=0,a={ambiguousAsWide:!e};for(let{segment:l}of le.segment(u)){let o=l.codePointAt(0);if(!(o<=31||o>=127&&o<=159)&&!(o>=8203&&o<=8207||o===65279)&&!(o>=768&&o<=879||o>=6832&&o<=6911||o>=7616&&o<=7679||o>=8400&&o<=8447||o>=65056&&o<=65071)&&!(o>=55296&&o<=57343)&&!(o>=65024&&o<=65039)&&!fe.test(l)){if((0,rD.default)().test(l)){n+=2;continue}n+=v(o,a)}}return n}var iD=(u=0)=>D=>`\x1B[${D+u}m`,sD=(u=0)=>D=>`\x1B[${38+u};5;${D}m`,oD=(u=0)=>(D,e,r)=>`\x1B[${38+u};2;${D};${e};${r}m`,m={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},qt=Object.keys(m.modifier),Ee=Object.keys(m.color),Ce=Object.keys(m.bgColor),Kt=[...Ee,...Ce];function de(){let u=new Map;for(let[D,e]of Object.entries(m)){for(let[r,n]of Object.entries(e))m[r]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},e[r]=m[r],u.set(n[0],n[1]);Object.defineProperty(m,D,{value:e,enumerable:!1})}return Object.defineProperty(m,"codes",{value:u,enumerable:!1}),m.color.close="\x1B[39m",m.bgColor.close="\x1B[49m",m.color.ansi=iD(),m.color.ansi256=sD(),m.color.ansi16m=oD(),m.bgColor.ansi=iD(10),m.bgColor.ansi256=sD(10),m.bgColor.ansi16m=oD(10),Object.defineProperties(m,{rgbToAnsi256:{value(D,e,r){return D===e&&e===r?D<8?16:D>248?231:Math.round((D-8)/247*24)+232:16+36*Math.round(D/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(D){let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(D.toString(16));if(!e)return[0,0,0];let[r]=e;r.length===3&&(r=[...r].map(a=>a+a).join(""));let n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:D=>m.rgbToAnsi256(...m.hexToRgb(D)),enumerable:!1},ansi256ToAnsi:{value(D){if(D<8)return 30+D;if(D<16)return 90+(D-8);let e,r,n;if(D>=232)e=((D-232)*10+8)/255,r=e,n=e;else{D-=16;let o=D%36;e=Math.floor(D/36)/5,r=Math.floor(o/6)/5,n=o%6/5}let a=Math.max(e,r,n)*2;if(a===0)return 30;let l=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(e));return a===2&&(l+=60),l},enumerable:!1},rgbToAnsi:{value:(D,e,r)=>m.ansi256ToAnsi(m.rgbToAnsi256(D,e,r)),enumerable:!1},hexToAnsi:{value:D=>m.ansi256ToAnsi(m.hexToAnsi256(D)),enumerable:!1}}),m}var he=de(),FD=he;var ru=new Set(["\x1B","\x9B"]),pe=39,Au="\x07",lD="[",ge="]",fD="m",nu=`${ge}8;;`,aD=u=>`${ru.values().next().value}${lD}${u}${fD}`,cD=u=>`${ru.values().next().value}${nu}${u}${Au}`,me=u=>u.split(" ").map(D=>z(D)),Bu=(u,D,e)=>{let r=[...D],n=!1,a=!1,l=z(R(u.at(-1)));for(let[o,p]of r.entries()){let A=z(p);if(l+A<=e?u[u.length-1]+=p:(u.push(p),l=0),ru.has(p)&&(n=!0,a=r.slice(o+1,o+1+nu.length).join("")===nu),n){a?p===Au&&(n=!1,a=!1):p===fD&&(n=!1);continue}l+=A,l===e&&o<r.length-1&&(u.push(""),l=0)}!l&&u.at(-1).length>0&&u.length>1&&(u[u.length-2]+=u.pop())},Be=u=>{let D=u.split(" "),e=D.length;for(;e>0&&!(z(D[e-1])>0);)e--;return e===D.length?u:D.slice(0,e).join(" ")+D.slice(e).join("")},Ae=(u,D,e={})=>{if(e.trim!==!1&&u.trim()==="")return"";let r="",n,a,l=me(u),o=[""];for(let[b,O]of u.split(" ").entries()){e.trim!==!1&&(o[o.length-1]=o.at(-1).trimStart());let y=z(o.at(-1));if(b!==0&&(y>=D&&(e.wordWrap===!1||e.trim===!1)&&(o.push(""),y=0),(y>0||e.trim===!1)&&(o[o.length-1]+=" ",y++)),e.hard&&l[b]>D){let $=D-y,S=1+Math.floor((l[b]-$-1)/D);Math.floor((l[b]-1)/D)<S&&o.push(""),Bu(o,O,D);continue}if(y+l[b]>D&&y>0&&l[b]>0){if(e.wordWrap===!1&&y<D){Bu(o,O,D);continue}o.push("")}if(y+l[b]>D&&e.wordWrap===!1){Bu(o,O,D);continue}o[o.length-1]+=O}e.trim!==!1&&(o=o.map(b=>Be(b)));let p=o.join(`
|
|
7
|
+
`),A=[...p],B=0;for(let[b,O]of A.entries()){if(r+=O,ru.has(O)){let{groups:$}=new RegExp(`(?:\\${lD}(?<code>\\d+)m|\\${nu}(?<uri>.*)${Au})`).exec(p.slice(B))||{groups:{}};if($.code!==void 0){let S=Number.parseFloat($.code);n=S===pe?void 0:S}else $.uri!==void 0&&(a=$.uri.length===0?void 0:$.uri)}let y=FD.codes.get(Number(n));A[b+1]===`
|
|
8
|
+
`?(a&&(r+=cD("")),n&&y&&(r+=aD(y))):O===`
|
|
9
|
+
`&&(n&&y&&(r+=aD(n)),a&&(r+=cD(a))),B+=O.length}return r};function bu(u,D,e){return String(u).normalize().replaceAll(`\r
|
|
10
|
+
`,`
|
|
11
|
+
`).split(`
|
|
12
|
+
`).map(r=>Ae(r,D,e)).join(`
|
|
13
|
+
`)}function xu(u){return Vu(u,{stringWidth:mu,stripAnsi:R,wrap:bu})}import{dirname as ED,resolve as CD}from"path";import{readdirSync as be,statSync as xe}from"fs";function dD(u,D){let e=CD(".",u),r;for(xe(e).isDirectory()||(e=ED(e));;){if(r=D(e,be(e)),r)return CD(e,r);if(e=ED(r=e),r===e)break}}import{inspect as Ue}from"util";import{fileURLToPath as wD}from"url";import{basename as qe,dirname as Ke,extname as Ve,relative as Qe,resolve as _D,join as He}from"path";var ye=new Intl.Segmenter,hD=new RegExp("[^\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]","v"),_e=new RegExp("\\p{Spacing_Mark}","v"),we=new RegExp("^\\p{RGI_Emoji}$","v"),Oe=/^[\d#*]\u20E3$/,je=new RegExp("\\p{Extended_Pictographic}","gu");function Se(u){if(u.length>50)return!1;if(Oe.test(u))return!0;if(u.includes("\u200D")){let D=u.match(je);return D!==null&&D.length>=2}return!1}function Ne(u){let D=u.search(hD);return D===-1?void 0:u.slice(D)}function pD(u){return u>=4352&&u<=4447||u>=43360&&u<=43388}function gD(u){return u>=4448&&u<=4519||u>=55216&&u<=55238}function mD(u){return u>=4520&&u<=4607||u>=55243&&u<=55291}function We(u){return pD(u)||gD(u)||mD(u)}function Re(u,D){let e=[];for(let n of u)hD.test(n)&&e.push(n.codePointAt(0));if(e.length===0)return;let r=0;for(let n=0;n<e.length;n++){let a=e[n];if(!We(a)){if(r===0)return;for(let l=n;l<e.length;l++)r+=v(e[l],D);return r}if(pD(a)&&gD(e[n+1])){r+=2,n+=mD(e[n+2])?2:1;continue}r+=v(a,D)}return r}function Le(u,D){let e=0,r=!0;for(let n of u){if(r){r=!1;continue}(_e.test(n)||n>="\uFF00"&&n<="\uFFEF")&&(e+=v(n.codePointAt(0),D))}return e}function yu(u,D={}){if(typeof u!="string"||u.length===0)return 0;let{ambiguousIsNarrow:e=!0,countAnsiEscapeCodes:r=!1}=D,n=u;if(!r&&(n.includes("\x1B")||n.includes("\x9B"))&&(n=R(n)),n.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(n))return n.length;let a=0,l={ambiguousAsWide:!e};for(let{segment:o}of ye.segment(n)){let p=Ne(o);if(p===void 0)continue;if(we.test(o)||Se(o)){a+=2;continue}let A=Re(p,l);if(A!==void 0){a+=A;continue}let B=p.codePointAt(0);a+=v(B,l),a+=Le(p,l)}return a}import{readFileSync as $e,statSync as Te,writeFile as Me}from"fs";import{format as Ie}from"util";import{resolve as ve}from"path";var BD={fs:{readFileSync:$e,writeFile:Me},format:Ie,resolve:ve,exists:u=>{try{return Te(u).isFile()}catch{return!1}}};var L,_u=class{constructor(D){D=D||{},this.directory=D.directory||"./locales",this.updateFiles=typeof D.updateFiles=="boolean"?D.updateFiles:!0,this.locale=D.locale||"en",this.fallbackToLanguage=typeof D.fallbackToLanguage=="boolean"?D.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...D){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=D.shift(),r=function(){};return typeof D[D.length-1]=="function"&&(r=D.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),L.format.apply(L.format,[this.cache[this.locale][e]||e].concat(D))}__n(){let D=Array.prototype.slice.call(arguments),e=D.shift(),r=D.shift(),n=D.shift(),a=function(){};typeof D[D.length-1]=="function"&&(a=D.pop()),this.cache[this.locale]||this._readLocaleFile();let l=n===1?e:r;this.cache[this.locale][e]&&(l=this.cache[this.locale][e][n===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:a})):a();let o=[l];return~l.indexOf("%d")&&o.push(n),L.format.apply(L.format,o.concat(D))}setLocale(D){this.locale=D}getLocale(){return this.locale}updateLocale(D){this.cache[this.locale]||this._readLocaleFile();for(let e in D)Object.prototype.hasOwnProperty.call(D,e)&&(this.cache[this.locale][e]=D[e])}_taggedLiteral(D,...e){let r="";return D.forEach(function(n,a){let l=e[a+1];r+=n,typeof l<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(e,1)))}_enqueueWrite(D){this.writeQueue.push(D),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let D=this,e=this.writeQueue[0],r=e.directory,n=e.locale,a=e.cb,l=this._resolveLocaleFile(r,n),o=JSON.stringify(this.cache[n],null,2);L.fs.writeFile(l,o,"utf-8",function(p){D.writeQueue.shift(),D.writeQueue.length>0&&D._processWriteQueue(),a(p)})}_readLocaleFile(){let D={},e=this._resolveLocaleFile(this.directory,this.locale);try{L.fs.readFileSync&&(D=JSON.parse(L.fs.readFileSync(e,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+e),r.code==="ENOENT")D={};else throw r}this.cache[this.locale]=D}_resolveLocaleFile(D,e){let r=L.resolve(D,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~e.lastIndexOf("_")){let n=L.resolve(D,"./",e.split("_")[0]+".json");this._fileExistsSync(n)&&(r=n)}return r}_fileExistsSync(D){return L.exists(D)}};function AD(u,D){L=D;let e=new _u(u);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var Pe=u=>AD(u,BD),bD=Pe;var OD=cu(yD(),1);import{createRequire as Je}from"node:module";import{readFileSync as ke,readdirSync as Ye}from"node:fs";var wu=wD(import.meta.url),Ze=wu.substring(0,wu.lastIndexOf("node_modules")),Xe=Je(import.meta.url),Sn={assert:{notStrictEqual:ze,strictEqual:Ge},cliui:xu,findUp:dD,getEnv:u=>process.env[u],inspect:Ue,getProcessArgvBin:qu,mainFilename:Ze||process.cwd(),Parser:Gu,path:{basename:qe,dirname:Ke,extname:Ve,relative:Qe,resolve:_D,join:He},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(u,D)=>process.emitWarning(u,D),execPath:()=>process.execPath,exit:u=>{process.exit(u)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:ke,readdirSync:Ye,require:Xe,getCallerFile:()=>{let u=(0,OD.default)(3);return u.match(/^file:\/\//)?wD(u):u},stringWidth:yu,y18n:bD({directory:_D(wu,"../../../locales"),updateFiles:!1})};var iu=class u extends Error{constructor(D){super(D||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,u)}};var Ou=[],V;function ut(u,D,e,r){V=r;let n={};if(Object.prototype.hasOwnProperty.call(u,"extends")){if(typeof u.extends!="string")return n;let a=/\.json|\..*rc$/.test(u.extends),l=null;if(a)l=et(D,u.extends);else try{l=import.meta.resolve(u.extends)}catch{return u}Dt(l),Ou.push(l),n=a?JSON.parse(V.readFileSync(l,"utf8")):r.require(u.extends),delete u.extends,n=ut(n,V.path.dirname(l),e,V)}return Ou=[],e?jD(n,u):Object.assign({},n,u)}function Dt(u){if(Ou.indexOf(u)>-1)throw new iu(`Circular extended configurations: '${u}'.`)}function et(u,D){return V.path.resolve(u,D)}function jD(u,D){let e={};function r(n){return n&&typeof n=="object"&&!Array.isArray(n)}Object.assign(e,u);for(let n of Object.keys(D))n!=="__proto__"&&(r(D[n])&&r(e[n])?e[n]=jD(u[n],D[n]):e[n]=D[n]);return e}export{Gu as a,ht as b,Sn as c,iu as d,ut as e};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as ae,b as Z,c as V,f as re,g as A,h as ce,i as le,l as de,m as he}from"./chunk-HQQMJCQJ.mjs";import{b as Xt,c as lt,e as U,f as Yt,i as Qt,j as te,m as ee,n as oe,o as ne,p as se,q as ie,r as dt}from"./chunk-QYKCJ7FG.mjs";import{a as rt}from"./chunk-YZ5Z6H4W.mjs";import{b as ct,c as jt,d as zt,e as Dt,f as _t,h as Mt,i as Pt,j as Ut,k as Bt,l as Wt,m as Ht,n as Gt,o as Kt,s as Jt}from"./chunk-VACRB2NE.mjs";import{a as g,b as Ft,c as Rt}from"./chunk-HYMEEXKN.mjs";import{d as T,g as Zt,i as Vt,j as qt}from"./chunk-W63L7367.mjs";import{existsSync as Qe,readFileSync as Is,readdirSync as Fs}from"node:fs";import N from"node:fs/promises";import S from"node:path";function fe(t){if(!t||!Array.isArray(t.lines))throw new Error("diff: lines must be an array.");t.lines.forEach(o=>{if(!o||!["added","removed","unchanged"].includes(o.type)||typeof o.content!="string"||/[\r\n]/.test(o.content))throw new Error("diff: each line needs a valid type and single-line content.");if(o.lineNumber!=null&&(!Number.isInteger(o.lineNumber)||o.lineNumber<1))throw new Error("diff: lineNumber must be a positive integer.")})}import{isInstance as ue}from"../browser/shared/components/index.mjs";import{attr as I,elementsOf as B,hasClass as yo,walk as pe}from"../browser/shared/html-tree.mjs";import{CHART_DATA as No,CHART_SOURCE as q,cellWords as me,rowsReading as ge,tableRows as So}from"../browser/shared/table-chart.mjs";var xo=t=>t.tagName==="script"&&(I(t,"type")??"").trim().toLowerCase()==="application/json",ht=t=>t.nodeName==="#text"?t.value:(t.childNodes??[]).map(ht).join("");function vo(t){let o=t;for(;o&&o.tagName!=="figure";)o=o.parentNode;let n=o?B(o).find(e=>/^h[2-4]$/.test(e.tagName)):null;return n?me(ht(n)):""}function $e(t,o,n=g(t)){let e=[];return pe(n,s=>{let i=o(s);if(i===void 0||!s.sourceCodeLocation)return;let a=s.childNodes.find(xo);e.push({type:i,line:s.sourceCodeLocation.startLine,text:a?a.childNodes.map(r=>r.value??"").join(""):null,source:I(s,No),tag:s.tagName,holder:s.parentNode?.tagName,title:vo(s)})},{stop:ue}),e}var Oo=t=>t.tagName==="ol"&&I(t,"data-doc-chart")==="flow",X=(t,o)=>$e(t,n=>Oo(n)?void 0:I(n,"data-doc-chart"),o),Eo=t=>$e(t,o=>yo(o,"doc-diff")?"diff":void 0),C=t=>B(t).filter(o=>o.tagName==="td"||o.tagName==="th"),To=t=>["rowspan","colspan"].some(o=>{let n=Number.parseInt(I(t,o)??"1",10);return Number.isFinite(n)&&n!==1});function Lo(t){let o=B(t),n=r=>B(r).filter(l=>l.tagName==="tr"),e=o.find(r=>r.tagName==="thead"),s=e?n(e)[0]??null:null,i=o.filter(r=>r.tagName==="tbody").flatMap(n);!s&&i.length>0&&C(i[0]).length>0&&C(i[0]).every(r=>r.tagName==="th")&&([s,...i]=i);let a=r=>me(ht(r));return{names:s?C(s).map(a):null,types:s?C(s).map(r=>I(r,"data-sort-type")??null):null,rows:i.map(r=>C(r).map(l=>({words:a(l),sort:I(l,"data-sort-value")?.trim()??null}))),foot:o.filter(r=>r.tagName==="tfoot").flatMap(n).map(r=>C(r)[0]?a(C(r)[0]):""),merged:[s,...i].some(r=>r&&C(r).some(To))}}function ft(t){let o=new Map;return pe(t,n=>{let e=I(n,q);if(e===void 0||!n.sourceCodeLocation)return;(o.get(e)??o.set(e,[]).get(e)).push({line:n.sourceCodeLocation.startLine,table:B(n).find(i=>i.tagName==="table")??null})},{inTemplates:!1,stop:ue}),o}function ut(t,o){let n=o.get(t)??[];if(n.length===0)return{error:`no table's frame carries ${q}="${t}", so the chart has nothing to draw: put the table back, or delete the card`};if(n.length>1)return{error:`${n.length} tables carry ${q}="${t}" (lines ${n.map(({line:r})=>r).join(", ")}): a key names one table (the chart draws the first); take it off the copies`};let[{line:e,table:s}]=n;if(!s)return{error:`the frame carrying ${q}="${t}" (line ${e}) holds no table`};let i=Lo(s),a=So(i);return a.error?{error:`its table (line ${e}) ${a.error}`}:{...a,line:e,cells:i}}function pt(t){let o=new Set([...t.matchAll(/DocCharts\.define\(\s*(["'`])([a-z][a-z0-9-]*)\1/g)].map(e=>e[2])),n=new Set([...t.matchAll(/DocCharts\.define\(\s*(["'`])([^"'`\n]*)\1/g)].map(e=>e[2]).filter(e=>!o.has(e)));return{defined:o,misnamed:n}}function mt(t){let o=g(t),n=[],{defined:e,misnamed:s}=pt(t),i=null;for(let{type:a,line:r,text:l,source:c,tag:d,holder:h}of X(t,o)){let f=`data-doc-chart="${a}" (line ${r})`;if(d==="table"){n.push(h==="figure"?`${f} is on a table inside a <figure>: the chart's card is a figure of its own, so write the table outside it, its <caption> the chart's title`:`${f} is on a table the tools leave as written (inside a whole block, an element with a class of the document's own, a cell): a chart is drawn from a table outside one`);continue}if(s.has(a)){n.push(`${f}: the document's script defines "${a}" with DocCharts.define, which refuses that name: a chart type's name is lowercase letters, digits and hyphens, a letter first ("interval", "ci-plot"); rename it in both places`);continue}if(!e.has(a)){n.push(`${f}: the document's script does not define "${a}": define it once in the document's <script> with DocCharts.define("${a}", ({ host, data, tokens, width, height }) => { \u2026 }) (references/writing-html.md, "Figures and charts")`);continue}if(c!==void 0){if(l!==null){n.push(`${f}: a chart drawn from a table takes its data from the table: take its <script type="application/json"> out`);continue}let u=ut(c,i??=ft(o));u.error&&n.push(`${f}: ${u.error}`);continue}if(l===null){n.push(`${f} needs its data in a <script type="application/json"> child`);continue}try{JSON.parse(l)}catch(u){n.push(`${f}: its data is not valid JSON (${u.message})`)}}for(let{line:a,text:r}of Eo(t)){if(r===null)continue;let l=`.doc-diff (line ${a})`;try{fe(JSON.parse(r))}catch(c){n.push(`${l}: ${c instanceof SyntaxError?`its options are not valid JSON (${c.message})`:c.message}`)}}return n}function we(t,{written:o=t}={}){let n=g(t),e=[],{defined:s}=pt(t),i=null,a=null;for(let{type:r,line:l,text:c,source:d,title:h,tag:f}of X(t,n)){if(d===void 0||f==="table"||c!==null||!s.has(r))continue;let u=`data-doc-chart="${r}" (line ${l})`;if(!h){a??=new Set(o===t?[]:X(o).map(b=>b.source).filter(b=>b!==void 0));let y=o!==t&&!a.has(d);e.push(`${u}: this chart card has no title: ${y?"write a <caption> on its table (the one with data-doc-chart), which becomes the card's h3":"write an h3 in the card's figure, before the chart"}`)}let p=ut(d,i??=ft(n));if(p.error)continue;let{blank:m,twice:w}=ge(p.cells,p.data);m&&e.push(`${u}: its table's header (line ${p.line}) has a cell with no words, so that column's values are keyed "" in data: write the column's name there`),w.length>0&&e.push(`${u}: its table's header (line ${p.line}) names ${w.map(y=>`"${y}"`).join(", ")} twice, so data keeps the later column's value under it: give each column a name of its own`)}return e}function be(t){let o=g(t),n=[],e=[],{defined:s}=pt(t),i=null,a=(r,l)=>`${r} ${l}${r===1?"":"s"}`;for(let{type:r,line:l,text:c,source:d,tag:h}of X(t,o)){if(d===void 0||h==="table"||c!==null||!s.has(r))continue;let f=ut(d,i??=ft(o));if(f.error)continue;let{rows:u,columns:p,foot:m,extra:w}=ge(f.cells,f.data),y=`data-doc-chart="${r}" (line ${l})`,b=[a(u,"row")];for(let{name:k,numbers:v,words:E,empty:P}of p){let R=v+E+P,J=v===R&&R>0?"numbers":E===R&&R>0?"words":[v&&a(v,"number"),E&&`${E} as words`,P&&`${P} empty (null)`].filter(Boolean).join(", ")||"no rows";b.push(`"${k}": ${J}`),v>0&&E>0&&e.push(`${y}: its table's column "${k}" (line ${f.line}) reads as numbers in ${a(v,"row")} and as words in ${E}: write each of its cells as one number (an empty cell, "\u2014" or "n/a" for none: null in data), or, for a column of words, data-sort-type="text" on its header cell`)}m>0&&e.push(`${y}: its table's <tfoot> (line ${f.line}) holds ${a(m,"row")} the chart leaves out, and a table with a <tfoot> has no table tools in the preview: keep a total out of a table you chart and say it in the text`),w>0&&e.push(`${y}: ${a(w,"row")} of its table (line ${f.line}) ${w===1?"has":"have"} cells past the header, which the chart does not read: give each column a header cell`),n.push(`${r} (line ${l}) reads its table (line ${f.line}): ${b.join("; ")}`)}return{readings:n,notes:e}}import{componentOf as Rs,isInstance as js,matchesNode as to}from"../browser/shared/components/index.mjs";import{FLOW as zs}from"../browser/shared/components/list.mjs";import{attr as O,elementsOf as eo,walk as j}from"../browser/shared/html-tree.mjs";import{GLYPH_SETS as Ds,ICON_COLORS as oo,glyphOf as _s,glyphValue as Ms,iconKind as Et,iconMarkup as Ps,iconValueOf as Us}from"../browser/shared/emoji/icon-value.mjs";import Ao from"node:vm";import{LINE_START as tt,lineStart as Co}from"../browser/shared/code-lines.mjs";import{COMPONENTS as Io,FLOWS as Fo,instancesOf as Ro,isInstance as W,matchesNode as D,partOf as ke,vocabulary as jo}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as L,INSTANCE as zo,PACKAGE_ID as Oe,SCHEMA as gt,schemaAhead as Do}from"../browser/shared/components/installed.mjs";import{packageScript as _o}from"../browser/shared/export-wrap.mjs";import{asDocName as Mo,kitNamespace as Po}from"../browser/shared/old-names.mjs";import{shortSheets as Uo}from"../browser/shared/components/sheets.mjs";import{attr as x,curlyQuoted as Bo,hasClass as Wo,walk as et}from"../browser/shared/html-tree.mjs";var{authoring:Q,runtime:ye}=jo(),Ho="input, select, textarea, button, details, table",ot=t=>t.sourceCodeLocation?.startLine,$=t=>ot(t)?` (line ${ot(t)})`:"";function Ne(t){let o=(e,s)=>{let i=Array.from({length:s.length+1},(a,r)=>r);for(let a=1;a<=e.length;a++){let r=i[0];i[0]=a;for(let l=1;l<=s.length;l++){let c=i[l];i[l]=Math.min(i[l]+1,i[l-1]+1,r+(e[a-1]===s[l-1]?0:1)),r=c}}return i[s.length]},[n]=[...Q.keys()].filter(e=>e.startsWith(t.slice(0,7))).map(e=>[e,o(t,e)]).sort((e,s)=>e[1]-s[1]);return n&&n[1]<=3?` (${n[0]}?)`:""}function Go(t,o,n){let{part:e,property:s,min:i}=t.shares,a=new RegExp(`(?:^|;)\\s*${s}\\s*:\\s*([^;]*)`),r=n.map(h=>a.exec(x(h,"style")??"")?.[1].trim()??null),l=r.filter(h=>h!==null);if(l.length===0)return[];let c=`${t.id}${$(o)}`;return l.length<r.length?[`${c}: ${s} on ${l.length} of its ${r.length} ${e}: write it on every one of them, or on none (equal widths)`]:l.map(Number).some(h=>!Number.isFinite(h)||h<i-1e-9||h>1)?[`${c}: ${s} is a share of the row, a number from ${Math.round(i*1e3)/1e3} to 1 (${l.join(", ")})`]:[]}var Y={"doc-dialog-header":'a detail card has no header: its content region (<div class="doc-dialog-content">) stands alone in its panel',"doc-dialog-title":"a detail card's title is an ordinary heading (<h3>), first in its content region","doc-dialog-close":"a detail card has no close button: Esc and a press outside it close it","data-doc-dialog-close":"a detail card has no close button: Esc and a press outside it close it","doc-section-header":"a section's title is a plain heading (<h2>) with an ordinary paragraph below it for the line that says what the section is: no <div> goes around them","doc-grid":'a card row is now columns: <div class="doc-columns"> holding one <div class="doc-column"> per card',"doc-grid-3":'a card row is now columns: <div class="doc-columns"> holding three <div class="doc-column">',"doc-lede":`write the line under the title as a paragraph of the header (an ordinary <p>), or as small text, <p class="doc-note"): the header's lines read as the body's paragraphs`,"doc-source":`write the line under the title as a plain paragraph of the header (an ordinary <p>), or as small text (<p class="doc-note">): the header's lines read as the body's paragraphs`,"doc-prose":"write the text straight in its flow (the page, a Sheet panel, a section, a panel, a column\u2026): it reads the same there","doc-prose-h1":"write an h1","doc-prose-h2":"write an h2","doc-prose-h3":"write an h3","doc-prose-h4":"write an h4","doc-state-grid":'put the groups side by side in columns (<div class="doc-columns">)',"doc-state-group":"write the group's title as a heading and its controls as blocks of their own in a column","doc-state-status":'write the line as small text, <p class="doc-note">',"doc-code-block":'a code block is <div class="doc-code"> holding its title (<div class="doc-code-title">) and the <pre><code>',"doc-code-card":'a code block is <div class="doc-code"> holding its title and its <pre>; a diff is <div class="doc-diff">',"doc-code-header":'write the title as <div class="doc-code-title">: the kit draws the rest of the header',"data-doc-diff":'a diff is <div class="doc-diff"> holding its title and its options as JSON (sdk/doc-code.d.ts)',"data-doc-diff-stats":"the kit shows a diff's counts in its header: remove it","doc-code--wrap":"a code block wraps its long lines by itself: remove it (doc-code--nowrap scrolls them instead)"},Ko={[tt]:'write it on its <div class="doc-code">',"data-start":`write ${tt} on its <div class="doc-code">`,"data-line-numbers":'write it on its <div class="doc-code">',"data-folded-lines":'write it on its <div class="doc-code">',"data-title":'write the title in its <div class="doc-code-title">',"data-wrap":'for long lines that scroll, write class="doc-code doc-code--nowrap" on its <div class="doc-code">'};function Jo(t){let o=[],n=t.tagName==="pre"?t.parentNode:t.tagName==="code"&&t.parentNode?.tagName==="pre"?t.parentNode.parentNode:null;if(n?.tagName&&D(n,".doc-code"))for(let[s,i]of Object.entries(Ko))x(t,s)!==void 0&&o.push(`${s}${$(t)} on the <${t.tagName}> of a code block does nothing: ${i}`);let e=t.tagName==="div"&&D(t,".doc-code")?x(t,tt):void 0;return e!==void 0&&Co(e)===null&&o.push(`${tt}="${e}"${$(t)}: the number of a code block's first line is a whole number from 1`),o}var Se=Fo.join(", "),Zo=t=>D(t.parentNode,Se)||t.parentNode?.tagName==="div"&&!x(t.parentNode,"class")&&D(t.parentNode.parentNode,Se);function Vo(t,o){let n=[];et(o,s=>n.push(...Bo(t,s)));let e=s=>s.replace(/=(\s*)[“”]/,'=$1"').replace(/[“”]$/,'"');return n.map(({written:s,line:i},a)=>a===0?`line ${i}: attribute ${s} uses curly quotes (U+201C/U+201D), which HTML reads as part of the value: write straight quotes, ${e(s)}; an editor keeping a file's \u201C\u2026\u201D style may change them`:`line ${i}: attribute ${s} uses curly quotes too: write ${e(s)}`)}var xe={details:"write a plain <details> without the class (its <summary>, then what it holds): the export makes it the kit's"},qo="write a <section> of no attribute straight in it for each tab, starting with its heading (<h2>\u2013<h4>), the tab's name, the rest its blocks, and nothing else: the export makes the kit's tabs",Xo='a bookmark written the short way is a paragraph in a flow holding only <a class="doc-bookmark" href="https://\u2026">its title</a> (a title attribute its description, nothing else on it, words alone in it): the export makes the card';function Ee(t){let o=[];return et(t,n=>{x(n,L)!==void 0&&o.push(n)},{stop:W}),o}var Yo=t=>t.flatMap(o=>W(o)?Oe.test(x(o,L))?[]:[`${L}="${x(o,L)}"${$(o)} names no package: write <scope>/<name>, a package of the workspace's components/ folder`]:[`${L}${$(o)} on a <${o.tagName}>: an instance of a component is a block-level <div> or <section>`]);function Te(t){let o=Ee(t).filter(e=>W(e)&&Oe.test(x(e,L))),n=o.length>0?T():null;return o.flatMap(e=>{let s=x(e,L),i=n.packages.get(s);if(i&&!Do(x(e,gt),i.schema))return[];if(i)return[`line ${ot(e)}: <${e.tagName} ${L}="${s}">: ${gt}="${x(e,gt)}" is past the ${i.schema??1} its package's manifest reads (schema): nothing can write it back, and the block shows read-only until the package reads it`];let a=n.problems.get(s)?.problem,r=a?`package ${s} does not load (${Zt("en",a)})`:`no package ${s} in this workspace (components/${s}/component.json)`;return[`line ${ot(e)}: <${e.tagName} ${L}="${s}">: ${r}: the block shows what it holds, read-only, and moves, copies and deletes whole`]})}function $t(t,o){let n=[];for(let{name:e,value:s}of t.attrs){if(Y[e]&&!Q.has(e)){n.push(`${e}${$(t)} is gone: ${Y[e]}`);continue}if(e.startsWith("data-doc-")&&!Q.has(e)&&n.push(ye.has(e)?`${e}${$(t)} is the kit's to set: remove it`:`${e}${$(t)} is no attribute of the kit's${Ne(e)}`),e==="class"){for(let i of s.split(/\s+/).filter(o))if(!Q.has(i)){if(Y[i]){n.push(`class ${i}${$(t)} is gone: ${Y[i]}`);continue}n.push(ye.has(i)?`class ${i}${$(t)} is the kit's to set: remove it`:`class ${i}${$(t)} is no class of the kit's${Ne(Mo(i))}: give a class of the document's own a name of its own (not doc-\u2026)`)}}}return n}var ve=t=>t.startsWith("doc-");function Qo(t){try{return new Ao.Script(_o(t),{filename:"kit.js"}),null}catch(o){let n=/^kit\.js:(\d+)/.exec(o.stack??"")?.[1];return{message:o.message,line:n?Number(n):null}}}var wt=new Map;function tn(t){if(!t.files.includes("kit.js"))return null;if(wt.get(t.folder)?.stamp!==t.stamp){let o=le(t,"kit.js"),n=o===null?null:Qo(o),e=o===null?`${t.id}: its kit.js cannot be read`:n&&`${t.id}: its kit.js does not run: ${n.message}${n.line?` (line ${n.line})`:""}`;wt.set(t.folder,{stamp:t.stamp,failure:e})}return wt.get(t.folder).failure}function bt(t,o=g(t),n=null){let e=Vo(t,o),s=Ee(o);e.push(...Yo(s));let i=s.length>0?n??T():null,a=i?[...i.packages.values()]:[];i&&e.push(...A(t,i,o).map(tn).filter(Boolean));for(let c of[...Io,...a].filter(d=>d.match&&(d.parts||d.pairs)))for(let d of Ro(o,c)){if(c.empty&&!(d.childNodes??[]).some(u=>u.tagName||u.nodeName==="#text"&&u.value.trim()))continue;let h=c.id==="sheets"?Uo(d):null;if(h){e.push(`${c.id}${$(d)} has no tabs and is no short form: ${h.why??"it stands where no block does (in a whole block or a figure)"}; ${qo}`);continue}if(xe[c.id]&&Object.values(c.parts??{}).some(u=>ke(d,u.at).length<(u.optional?0:u.min??1))){e.push(`${c.id}${$(d)} carries the kit's class without the kit's parts: ${xe[c.id]}`);continue}let f={};for(let[u,p]of Object.entries(c.parts??{})){f[u]=ke(d,p.at);let m=p.optional?0:p.min??1,w=p.max??1/0;f[u].length<m?e.push(`${c.id}${$(d)} has ${f[u].length===0?"no":`${f[u].length} of`} ${u} (${p.at.replace(":scope > ","")})${f[u].length>0?`, at least ${m}`:""}`):f[u].length>w&&e.push(`${c.id}${$(d)} has ${f[u].length} of ${u}, at most ${w}`)}if(c.only){let u=new Set(c.only.flatMap(p=>f[p]));for(let p of(d.childNodes??[]).filter(m=>m.tagName&&!u.has(m)))e.push(`${c.id}${$(d)} holds a <${p.tagName}>${$(p)}: only its ${c.only.join(", ")} (${c.only.map(m=>c.parts[m].at.replace(":scope > ","")).join(", ")}) go in it`)}c.shares&&e.push(...Go(c,d,f[c.shares.part]));for(let{a:u,attrA:p,b:m,attrB:w}of c.pairs??[]){let y=f[u].map(k=>x(k,p)),b=f[m].map(k=>x(k,w));for(let k of new Set(y.filter((v,E)=>y.indexOf(v)!==E)))e.push(`${c.id}${$(d)}: ${u} "${k}" twice`);for(let k of y.filter(v=>!b.includes(v)))e.push(`${c.id}${$(d)}: ${u.replace(/s$/,"")} "${k}" has no ${m.replace(/s$/,"")} (${w}="${k}")`);for(let k of b.filter(v=>!y.includes(v)))e.push(`${c.id}${$(d)}: ${m.replace(/s$/,"")} "${k}" has no ${u.replace(/s$/,"")} (${p}="${k}")`)}}let r=new Set,l=[];et(o,c=>{if(W(c)){e.push(...$t(c,ve)),et(c,f=>e.push(...$t(f,ve)));return}c.tagName==="pre"&&Zo(c)&&e.push(`<pre>${$(c)} straight in the text: a code block is <div class="doc-code"> holding its title (<div class="doc-code-title">) and the <pre>`),e.push(...Jo(c)),c.tagName==="a"&&Wo(c,"doc-bookmark")&&e.push(`<a class="doc-bookmark">${$(c)} is no bookmark: ${Xo}`),e.push(...$t(c,Po));let d=x(c,"data-doc-bind");d!==void 0&&(d.trim()?D(c,Ho)?c.tagName==="button"&&x(c,"value")===void 0?e.push(`data-doc-bind${$(c)} on a button without a value: give it the value a click chooses`):r.add(d.trim()):e.push(`data-doc-bind${$(c)} on a ${c.tagName}: only inputs, selects, textareas, buttons with a value, details and tables hold a key`):e.push(`data-doc-bind${$(c)} names no key`));let h=x(c,"data-doc-show");h!==void 0&&l.push([c,h])},{stop:W});for(let[c,d]of l){let h=d.split(":")[0].trim();!h||!d.includes(":")?e.push(`data-doc-show="${d}"${$(c)}: write key:value`):r.has(h)||e.push(`data-doc-show="${d}"${$(c)}: nothing binds "${h}" (data-doc-bind="${h}")`)}return e.push(...rn(t,o)),e}var en=/(?<![\\$])\$(?=[^\s$])([^$]*?[^\s$\\])\$(?![$\d])/g,on=/(?:(?<![A-Za-z0-9_])[A-Za-z]|[)\]}])_[A-Za-z0-9{]/,nn=t=>/[\\^]/.test(t)||!t.startsWith("{")&&on.test(t),sn=new Set(["head","code","pre","kbd","samp","script","style","template","textarea","noscript","svg","math","title","iframe","object"]),an=`.doc-math-inline, .doc-math-block, .doc-code, .doc-diff, [data-doc-math-dollar], [data-doc-chart], ${zo}`;function rn(t,o){let n=[],e=s=>{for(let i of s.childNodes??[])if(i.nodeName==="#text"&&i.sourceCodeLocation&&i.value.includes("$")){let{startOffset:a,endOffset:r}=i.sourceCodeLocation;for(let l of t.slice(a,r).matchAll(en)){if(!nn(l[1]))continue;let c=l[1].replace(/\s+/g," "),d=c.length>60?`${c.slice(0,59)}\u2026`:c;n.push(`line ${Rt(t,a+l.index)}: $${d}$ is not drawn as a formula (single dollars are off: they are money): write \\(${d}\\)`)}}else i.tagName&&!sn.has(i.tagName)&&!D(i,an)&&e(i)};return e(o),n}import H from"node:fs";import _ from"node:path";import{COLOR_NAMES as fn}from"../browser/shared/colors.mjs";import{FOLD_DOTS as un}from"../browser/shared/code-folds.mjs";import{kitPublicDirectory as pn,kitSourceDirectory as mn,release as gn}from"../browser/shared/paths.mjs";import{FLOW_LABEL as Zi}from"../browser/shared/components/list.mjs";var cn={"code-title":{zh:"\u4EE3\u7801\u5757",en:"Code"},"plain-text":{zh:"\u7EAF\u6587\u672C",en:"Plain text"},"fold-code":{zh:"\u6298\u53E0\u6216\u5C55\u5F00\u4EE3\u7801\u5757",en:"Collapse or expand the code block"},"copy-code":{zh:"\u590D\u5236\u4EE3\u7801",en:"Copy code"},copied:{zh:"\u5DF2\u590D\u5236",en:"Copied"},wrap:{zh:"\u81EA\u52A8\u6362\u884C",en:"Wrap lines"},"no-wrap":{zh:"\u53D6\u6D88\u81EA\u52A8\u6362\u884C",en:"Stop wrapping lines"},fold:{zh:"\u6298\u53E0",en:"Collapse"},unfold:{zh:"\u5C55\u5F00",en:"Expand"},line:{zh:"\u7B2C {0} \u884C",en:"Line {0}"},lines:{zh:"\u7B2C {0}\u2013{1} \u884C",en:"Lines {0}\u2013{1}"},"diff-counts":{zh:"\u65B0\u589E {0} \u884C\uFF0C\u5220\u9664 {1} \u884C",en:"Lines added: {0}, removed: {1}"}};var Le="data-ge-language",ln={"code-title":"--doc-word-code-title"};function dn(t,o,n,...e){let s=t[n];if(!s)throw new Error(`The kit has no word "${n}" here (src/render/kit/words.js).`);let i=s[o]??s.zh;return e.length===0?i:i.replace(/\{(\d+)\}/g,(a,r)=>r<e.length?String(e[r]):a)}var hn=`:root[${Le}="en"], :root:not([${Le}])[lang|="en" i]`;function Ae(){let t=o=>Object.entries(ln).map(([n,e])=>`${e}: ${JSON.stringify(dn(cn,o,n))};`).join(" ");return`:root { ${t("zh")} }
|
|
3
|
+
${hn} { ${t("en")} }`}var Ce=Object.fromEntries(U.filter(t=>t.file).map(t=>[t.file,t.build])),sa=Object.keys(Ce),G=t=>_.join(mn,t),$n=(t,o,n)=>({entryPoints:[G(t)],bundle:!0,write:!1,format:"iife",platform:"browser",target:"es2022",...typeof o=="function"?o():o,...n}),wn=t=>{let o=Ce[t];if(!o)throw new Error(`src/render/kit-build.mjs: no kit file "${t}"`);return o},nt=new Map;function bn(t,o){let n=[...o.matchAll(/^@import\s+"\.\/([a-z0-9-]+\.css)";\s*$/gm)].map(i=>i[1]),e=H.readdirSync(_.dirname(G(t))).filter(i=>i.endsWith(".css")&&i!==_.basename(t)),s=[...e.filter(i=>!n.includes(i)).map(i=>`${i} is not listed`),...n.filter((i,a)=>!e.includes(i)||n.indexOf(i)!==a).map(i=>`${i} is listed but missing, or listed twice`)];if(s.length>0)throw new Error(`src/render/kit/${t}: ${s.join("; ")}`);return n.map(i=>_.join(_.dirname(t),i))}var kn=t=>t.replace(/@(text|highlight)-colors\b/g,(o,n)=>fn.map(e=>`.doc-${n}-${e}`).join(", ")),yn=t=>kn(t.join(`
|
|
4
|
+
`)).replaceAll("@fold-dots",un).replace(/^@kit-words;$/m,()=>Ae());function kt(t,{fresh:o=!1}={}){let n=wn(t);if(gn)return H.promises.readFile(_.join(pn,t),"utf8");if(n.read)return H.promises.readFile(G(n.read),"utf8");if(n.styles)return H.promises.readFile(G(n.styles),"utf8").then(e=>Promise.all(bn(n.styles,e).map(s=>H.promises.readFile(G(s),"utf8")))).then(yn);if(o||!nt.has(t)){let e=Xt($n(n.bundle,n.options)).then(s=>s.outputFiles[0].text);e.catch(()=>nt.delete(t)),nt.set(t,e)}return nt.get(t)}import{kitNamespace as Nn}from"../browser/shared/old-names.mjs";import{attr as yt,hasClass as st}from"../browser/shared/html-tree.mjs";var Ie=t=>t.tagName==="section"&&st(t,"doc-section"),Sn=new Set(["section","header","footer","nav","script","style","template","dialog","link","meta"]),xn=t=>!Sn.has(t.tagName),Nt=t=>t.nodeName==="#text"?t.value:(t.childNodes??[]).map(Nt).join("");function Re(t,o=[]){for(let n of t.childNodes??[])n.tagName&&((n.tagName==="main"&&st(n,"doc-page")||yt(n,"data-doc-sheet")!==void 0)&&o.push(n),Re(n.tagName==="template"?n.content:n,o));return o}var vn=/^(p|li|h[1-4]|blockquote|ul|ol)$/,je=["doc-summary","doc-panel","doc-note","doc-callout"],On=t=>vn.test(t.tagName)||je.some(o=>st(t,o)),En=new Set(["none","auto","100%","inherit","initial","unset","revert"]),Fe=t=>[...t.matchAll(/(?:^|[;{\s])(?:max-)?width\s*:\s*([^;}]+)/gi)].some(([,o])=>!En.has(o.replace(/!important/i,"").trim().toLowerCase())),Tn=t=>{let o=t.trim().split(/\s*[\s>+~]\s*/).at(-1)??"",n=/^(p|li|h[1-4]|blockquote|ul|ol)\b/.test(o)||je.some(s=>o.includes(`.${s}`)),e=[...t.matchAll(/\.([\w-]+)/g)].some(([,s])=>!Nn(s))||t.includes("#");return n&&!e};function Ln(t){let o=[],n=(e,s)=>{for(let i of e.childNodes??[]){if(!i.tagName)continue;let a=s||i.tagName==="main"&&st(i,"doc-page");if(a&&On(i)&&Fe(yt(i,"style")??"")&&o.push(`<${i.tagName}> with style="${yt(i,"style").trim()}"`),i.tagName==="style"){let r=Nt(i).replace(/\/\*[\s\S]*?\*\//g,"");for(let[,l,c]of r.matchAll(/([^{}]+)\{([^{}]*)\}/g))if(Fe(c))for(let d of l.split(","))Tn(d)&&o.push(`"${d.trim()}" in the document's style`)}n(i.tagName==="template"?i.content:i,a)}};return n(t,!1),o}function ze(t,{written:o=t}={}){let n=[],e=g(t),s=Ln(e);s.length>0&&n.push(`body text given a width of its own (${s.slice(0,3).join("; ")}${s.length>3?`; ${s.length-3} more`:""}): its lines break before the reading column's edge, leaving an extra right margin; let body text fill the column`);for(let i of Re(e)){let a=i.childNodes.filter(r=>r.tagName);a.forEach((r,l)=>{if(!Ie(r))return;let c=l+1;for(;c<a.length&&xn(a[c]);)c++;let d=a.slice(l+1,c);if(d.length===0||!Ie(a[c]??{})||/^h[1-4]$/.test(d[0].tagName))return;let h=r.childNodes.map(f=>f.tagName?f:null).filter(Boolean).map(Nt).find(f=>f.trim())?.replace(/\s+/g," ").trim().slice(0,40)??"";n.push(`${d.length} block${d.length===1?"":"s"} of body text right after the section "${h}" stand outside it, between two sections, with no heading of their own: fine if meant, otherwise they belong inside that section`)})}return n.push(...we(t,{written:o})),n}import{attr as De,hasClass as An}from"../browser/shared/html-tree.mjs";var _e="Write instead where it came from, in words, or a path relative to materials/ (materials/data.csv)",Cn=new Set(["script","style","template","noscript","textarea","pre","code","kbd","samp","var"]),In=["doc-math-inline","doc-math-block"],Fn=/\\\([\s\S]*?\\\)|\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$/g,Rn=/(?<!\\)\$(?:\\[\s\S]|[^\\$])+\$/g,jn=/[\s"'<>|()[\]{};,。;:、!?()《》「」『』“”‘’【】]/u,zn=/[^\s"'<>|()[\]{};,。;:、!?()《》「」『』“”‘’【】]+/gu,Ue=/^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,Dn=/\.[A-Za-z0-9]{1,8}$/,_n=[/(?<![A-Za-z0-9_\\])[A-Za-z]:[\\/]/g,/(?<![A-Za-z0-9_.~:/\\-])\/(?:Users|home|root|tmp|private|mnt|opt|Volumes|var\/folders)\/(?=\S)/g,/(?<![A-Za-z0-9_.~:/\\-])~\/(?=\S)/g,/(?<![A-Za-z0-9_$\\])\$(?:HOME|\{HOME\})\/(?=\S)/g,/(?<![A-Za-z0-9_:\\])\\\\[A-Za-z0-9][\w.$-]*\\(?=[^\s\\])/g,/%(?:TEMP|TMP|APPDATA|LOCALAPPDATA|USERPROFILE)%/gi],Mn=/(?:^|[\\/])(?:AppData|scratchpad)(?=[\\/]|$)/i,Pn=/^(?:[A-Za-z]:|[\\/]|%[A-Za-z]+%)[\s\S]*[\\/](?:temp|tmp)(?=[\\/])/i,Un=t=>t.includes("://")&&!/^file:/i.test(t),Me=12;function Pe(t,o){let n=o;for(;n<t.length&&!jn.test(t[n])&&!(Ue.test(t[n])&&Dn.test(t.slice(o,n)));)n++;return t.slice(o,n).replace(/[.,;:!?]+$/,"")}function Bn(t,o=!1){let n=r=>r.replace(/[^\n]/g," "),e=t.replace(Fn,n),s=o?e.replace(Rn,n):e,i=[],a=(r,l)=>i.some(c=>c.at<=r+l.length&&r<=c.at+c.path.length);for(let r of _n)for(let l of s.matchAll(r)){let c=Pe(s,l.index);c.length>=l[0].length+2&&!a(l.index,c)&&i.push({at:l.index,path:c})}for(let r of s.matchAll(zn)){let l=r.index;for(;l<r.index+r[0].length&&Ue.test(s[l]);)l++;let c=Pe(s,l);/[\\/]/.test(c)&&(Mn.test(c)||Pn.test(c))&&!Un(c)&&!a(l,c)&&i.push({at:l,path:c})}return i.sort((r,l)=>r.at-l.at)}function Be(t,o=g(t)){let n=[],e=(a,r)=>{for(let l of a.childNodes??[])if(l.nodeName==="#text"){if(!l.sourceCodeLocation)continue;for(let{at:c,path:d}of Bn(l.value,r))n.push({line:l.sourceCodeLocation.startLine+(l.value.slice(0,c).match(/\n/g)?.length??0),path:d})}else l.tagName&&!Cn.has(l.tagName)&&De(l,"hidden")===void 0&&!In.some(c=>An(l,c))&&e(l,r||De(l,"data-doc-math-dollar")!==void 0)};e(o,!1);let s=n.slice(0,Me).map(({line:a,path:r})=>`line ${a}: "${r.length>80?`${r.slice(0,77)}\u2026`:r}" is a path of this machine in the text a reader reads: a reader on another machine cannot open it. ${_e}`),i=n.slice(Me);return i.length>0&&s.push(`${i.length} more path${i.length===1?"":"s"} of this machine in the text a reader reads, on line${new Set(i.map(({line:a})=>a)).size===1?"":"s"} ${[...new Set(i.map(({line:a})=>a))].join(", ")}. ${_e}`),s}import{MENTION as Wn,MENTION_ICON as Hn}from"../browser/shared/components/mention.mjs";import{escapeAttribute as Gn}from"../browser/shared/escape.mjs";import{attr as We,elementsOf as Kn,hasClass as He,walk as Jn}from"../browser/shared/html-tree.mjs";import{addressOn as Zn,decoded as Vn,fromFile as qn,hosted as Xn,pageAddress as Yn,workbenchHash as Qn}from"../browser/shared/page-address.mjs";function ts(t,o,n){let e=qn(t,o),s=Zn(e,n);return s||Xn(t)?s:Yn(e)??(Qn(e)===null?null:{slug:null,block:null})}function es(t,o,n,e){let s=g(t),i=new Set,a=[];Jn(s,c=>{let d=We(c,"data-block-id");d!==void 0&&i.add(d),c.tagName==="a"&&We(c,"href")!==void 0&&c.sourceCodeLocation?.startTag&&a.push(c)});let r=new Map,l=({startOffset:c,endOffset:d})=>r.set(c,[d,""]);for(let c of a){let{prefix:d,value:h}=c.attrs.find(({name:b})=>b==="href"),f=h.startsWith("#")?Vn(h.slice(1)):null,u=f===null?h&&ts(h,o,e):i.has(f)?{slug:o,block:f}:null;if(!u)continue;let p=n(u,h);if(p===h)continue;let{attrs:m,startTag:w,endTag:y}=c.sourceCodeLocation;if(p===null)l(w),y&&l(y),He(c,Wn)&&Kn(c).filter(b=>He(b,Hn)).forEach(b=>l(b.sourceCodeLocation));else{let b=d?`${d}:href`:"href";r.set(m[b].startOffset,[m[b].endOffset,`${b}="${Gn(p)}"`])}}return[...r].sort(([c],[d])=>d-c).reduce((c,[d,[h,f]])=>`${c.slice(0,d)}${f}${c.slice(h)}`,t)}function Ge(t,o,n,{blocks:e=!0,links:s}){return es(t,o,({slug:i,block:a})=>{let r=n(i);if(r===null)return null;if(!a||!e)return i===o&&a?null:r;let l=`#${encodeURIComponent(a)}`;return i===o?l:`${r}${l}`},s)}import it from"node:fs";import os from"node:path";import{extensionOf as ns,imageFile as ss,mediaTypeOf as is}from"../browser/shared/media.mjs";var vt=1024*1024,as=vt,Je=2400,St=2e3,rs=.25,cs=new Set(["png","gif"]),Ke=.75;function ls(t){if(t.length<16||t.toString("latin1",0,4)!=="RIFF"||t.toString("latin1",8,12)!=="WEBP")return!1;for(let o=12;o+8<=t.length;){let n=t.toString("latin1",o,o+4);if(n==="VP8L")return!0;if(n==="VP8 "||n==="ANMF")return!1;let e=t.readUInt32LE(o+4);o+=8+e+e%2}return!1}function ds(t){let o=(n,e)=>n+e<=t.length;if(o(0,24)&&t.readUInt32BE(0)===2303741511&&t.toString("latin1",12,16)==="IHDR")return{width:t.readUInt32BE(16),height:t.readUInt32BE(20)};if(o(0,10)&&/^GIF8[79]a$/.test(t.toString("latin1",0,6)))return{width:t.readUInt16LE(6),height:t.readUInt16LE(8)};if(o(0,4)&&t[0]===255&&t[1]===216){for(let n=2;o(n,4);){if(t[n]!==255)return null;let e=t[n+1];if(e===255){n+=1;continue}if(e===216||e===1||e>=208&&e<=215){n+=2;continue}if(e>=192&&e<=207&&![196,200,204].includes(e))return o(n,9)?{width:t.readUInt16BE(n+7),height:t.readUInt16BE(n+5)}:null;if(e===217||e===218)return null;n+=2+t.readUInt16BE(n+2)}return null}if(o(0,30)&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"){let n=t.toString("latin1",12,16);if(n==="VP8 ")return{width:t.readUInt16LE(26)&16383,height:t.readUInt16LE(28)&16383};if(n==="VP8L"){let e=t.readUInt32LE(21);return{width:(e&16383)+1,height:(e>>>14&16383)+1}}return n==="VP8X"?{width:t.readUIntLE(24,3)+1,height:t.readUIntLE(27,3)+1}:null}if(o(0,12)&&t.toString("latin1",4,8)==="ftyp"&&/avi[fs]/.test(t.toString("latin1",8,Math.min(t.length,t.readUInt32BE(0))))){let n=null;for(let e=t.indexOf("ispe",0,"latin1");e>=0&&o(e,16);e=t.indexOf("ispe",e+4,"latin1")){let s={width:t.readUInt32BE(e+8),height:t.readUInt32BE(e+12)};(!n||s.width*s.height>n.width*n.height)&&(n=s)}return n}return null}var hs=vt;function fs(t){let o;try{o=it.openSync(t,"r");let{size:n}=it.fstatSync(o),e=Buffer.alloc(Math.min(n,hs));return it.readSync(o,e,0,e.length,0),{length:n,head:e}}catch{return null}finally{o!==void 0&&it.closeSync(o)}}var F=t=>`${Math.max(.1,t/vt).toFixed(1)} MB`;function us({bytes:t,width:o,height:n,extension:e,lossless:s}){let i=Math.max(o,n),a=Math.min(1,St/i),r=Math.min(t,o*n*a*a*rs);if(i>Je){if(!s)return r<=t*Ke?` \u2014 a ${St}px copy would be about ${F(r)}`:"";let l=t*a*a;return` \u2014 a ${St}px copy would be about ${F(l)}${e==="png"&&r<l/2?`, or ${F(r)} as a JPEG (for a photograph)`:""}`}return!s&&r<=t*Ke?` \u2014 written again as a JPEG of quality about 82, it would be about ${F(r)}`:e==="png"&&r<t/2?` \u2014 as a JPEG (for a photograph) it would be about ${F(r)}`:""}var xt=t=>t===2?"twice":`${t} times`;function Ze({html:t,directory:o,tree:n=g(t)}){let{embedded:e,unserved:s}=Kt({html:t,directory:o,tree:n}),i=new Map,a=(l,c,d,h=!1)=>{let f=i.get(l)??i.set(l,{at:[],shows:0,served:d}).get(l);f.at.push(c),h||(f.shows+=1)};for(let{file:l,line:c,icon:d}of e)ss(l)&&a(l,c,!0,d);for(let{file:l,line:c}of s)is(l).startsWith("image/")&&a(l,c,!1);let r=[];for(let[l,{at:c,shows:d,served:h}]of[...i].sort(([,f],[,u])=>Math.min(...f.at)-Math.min(...u.at))){let f=fs(os.join(o,l));if(!f)continue;let{length:u,head:p}=f,m=ds(p),w=m?Math.max(m.width,m.height):0,y=u>as||w>Je,b=h&&d>1;if(!y&&!b)continue;let k=[...new Set(c)],v=`line${k.length===1?"":"s"} ${k.length>1?`${k.slice(0,-1).join(", ")} and ${k.at(-1)}`:k[0]}`,E=b?`shown ${xt(d)}: the export embeds it ${xt(d)}; show it once and refer back to it in words`:"";if(!y){r.push(`${l} (${v}): ${E} (${F(Math.ceil(u/3)*4*d)} as data: URLs)`);continue}let P=c.length===1||!h?"":`, ${xt(c.length)}`,R=h?c.length:1,J=`${F(Math.ceil(u/3)*4*R)} as ${R===1?"a data: URL":"data: URLs"}`,bo=m?`, ${m.width}\xD7${m.height}px`:"",Ct=ns(l),It=m?us({bytes:u,...m,extension:Ct,lossless:cs.has(Ct)||ls(p)}):"",ko=h?`the export embeds it as it is${P}, ${J}${It}`:`its name keeps it out of the preview and the export (the failure at its line says why); copied into assets/ under a name they take, the export embeds it as it is, ${J}${It}: copy it in at the size the page needs`;r.push(`${l} (${v}): ${F(u)}${bo}; ${ko}${E?`; ${E}`:""}`)}return r}import{COMPONENTS as Ls}from"../browser/shared/components/index.mjs";import Ve from"node:fs";import{MENTION as qe,MENTION_ICON as Xe}from"../browser/shared/components/mention.mjs";import{escapeAttribute as ps,escapeText as ms}from"../browser/shared/escape.mjs";import{iconUrl as gs,validIcon as $s}from"../browser/shared/emoji/icon-value.mjs";import{attr as ws,hasClass as bs,walk as ks}from"../browser/shared/html-tree.mjs";import{fromFile as ys,isFileLink as Ns,pageAddress as Ss}from"../browser/shared/page-address.mjs";import{reportsDirectory as xs}from"../browser/shared/paths.mjs";import{documentDirectory as vs,documentFiles as Os}from"../browser/shared/workspace.mjs";function Es(t,o){let{html:n,json:e}=Os(vs(t,o));if(!Ve.existsSync(n))return null;try{let{title:s,icon:i}=JSON.parse(Ve.readFileSync(e,"utf8"));return{title:s,icon:i}}catch{return{}}}function Ts(t,o,n,e){if(n==="words"||typeof t!="string"||!$s(t))return null;if(n==="preview")return gs(t,o,{tab:!0});let s=zt({value:t,slug:o,tab:!0,reportsDirectory:e});return s&&`data:${s.type};base64,${s.body.toString("base64")}`}function Ye(t,{slug:o,mode:n="export",reportsDirectory:e=xs}){if(!t.includes(qe))return t;let s=new Map,i=r=>(s.has(r)||s.set(r,Es(r,e)),s.get(r)),a=new Map;return ks(g(t),r=>{let l=r.tagName==="a"&&bs(r,qe)?ws(r,"href"):void 0,{startTag:c,endTag:d}=r.sourceCodeLocation??{};if(!l||!Ns(l)||!c||!d)return;let h=Ss(ys(l,o))?.slug;if(!h)return;let f=i(h);if(!f)a.set(c.endOffset-1,[c.endOffset-1," data-doc-gone"]);else if(f.title){let u=Ts(f.icon,h,n,e);a.set(c.endOffset,[d.startOffset,`${u?`<img class="${Xe}" src="${ps(u)}" alt="">`:`<span class="${Xe}"></span>`}${ms(f.title)}`])}}),[...a].sort(([r],[l])=>l-r).reduce((r,[l,[c,d]])=>`${r.slice(0,l)}${d}${r.slice(c)}`,t)}var As=/<script\b[^>]*\bdata-doc-kit="runtime"[^>]*><\/script>/;function Cs(t,o,n){let e=Vt(o).filter(({id:s})=>!n.some(i=>i.id===s)).map(qt).join(" ");return e?t.replace(As,s=>`${s}
|
|
5
|
+
<script data-doc-dev>${e}</script>`):t}function Ot(t,{slug:o,mode:n="export",files:e=!0,reportsDirectory:s,kit:i}){let a=T(s),r=A(t,a),{html:l,removed:c,used:d}=Qt(t,[...Ls,...r]),h={slug:o,mode:n,...s?{reportsDirectory:s}:{}},f=ce(te(l,{used:d,...i?{href:i}:{}}),r),u=Dt(n==="preview"?Cs(f,a,r):f,h),p=e?Jt(Mt(Ut(Wt(u,h),h),h),h):u;return{html:Ye(p,h),removed:c}}import{exportsDirectory as Tt,generatedDirectory as K,kitPublicDirectory as Bs,release as Ws,reportsDirectory as z,vendorDirectory as Hs}from"../browser/shared/paths.mjs";import{referencedFile as Gs}from"../browser/shared/media.mjs";import{decoded as Ks,fromFile as Js,hashAddress as Zs,hosted as lo,pageAddress as Vs,workbenchHash as qs}from"../browser/shared/page-address.mjs";import{pageLinks as Xs}from"../browser/shared/page-links.mjs";import{documentLinks as Ys,listReportSlugs as Qs}from"../browser/shared/reports.mjs";import{documentDirectory as M,documentFiles as At}from"../browser/shared/workspace.mjs";import{sha256 as at}from"../browser/shared/files.mjs";import{EXPORT_CSP as ti,GENERATOR as ei,isolateUmd as oi,packagesMeta as ni,sourceMeta as si}from"../browser/shared/export-wrap.mjs";var no=/__REPORT_[A-Z_]+__/,so=1e6,io=t=>t.length>1?`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`:`${t[0]}`;function ii(t){return t.map(({id:o,lines:n,columns:e})=>{let s=new Set(n).size<n.length,i=n.map((a,r)=>s?`${a}:${e[r]}`:`${a}`);return`data-block-id repeats: "${o}" on lines ${io(i)}${s?" (line:column)":""}; each id names one block: remove it from the copy, which needs none (the later ${i.length>2?`ones, lines ${io(i.slice(1))}`:`one, line ${i[1]}`}, unless the copy went before its original)`})}var ai=({slug:t,htmlPath:o,metadataPath:n})=>{let e=o?{html:o,json:n??o.replace(/\.html$/,".json")}:At(M(t,z));return{htmlName:S.basename(e.html),jsonName:S.basename(e.json)}};function ri({slug:t,html:o,metadata:n,htmlPath:e,metadataPath:s,tree:i=g(o)}){let a=[],{htmlName:r,jsonName:l}=ai({slug:t,htmlPath:e,metadataPath:s}),c=[[/<meta\s+name=["']viewport["']/i,"missing viewport metadata"],[/<title>[^<]+<\/title>/i,"missing document title"],[/<main(?:\s|>)/i,"missing semantic main element"],[/aria-label|aria-labelledby|<title>/i,"missing accessible labels"]];for(let[p,m]of c)p.test(o)||a.push(m);let d=Buffer.byteLength(o);d>so&&a.push(`the document's editable source is ${d.toLocaleString("en-US")} bytes, over the ${so.toLocaleString("en-US")}-byte limit: aggregate or sample the embedded data, or split the document`),no.test(o)&&a.push(`${r} still contains a starter placeholder such as __REPORT_TITLE__`);for(let[p,m]of Object.entries(n))typeof m=="string"&&no.test(m)&&a.push(`${l} "${p}" is still a starter placeholder such as __REPORT_TITLE__`);/<[a-z][^>]*\sdata-doc-placeholder\b/i.test(o)&&a.push("starter placeholder content ([data-doc-placeholder]) is still present; replace it with the document's content");let h=new Map;j(i,p=>{let m=O(p,"data-block-id"),w=p.sourceCodeLocation?.attrs?.["data-block-id"]??p.sourceCodeLocation;m!==void 0&&h.set(m,[...h.get(m)??[],{line:w?.startLine,column:w?.startCol}])});let f=[...h].filter(([,p])=>p.length>1);a.push(...ii(f.map(([p,m])=>({id:p,lines:m.map(({line:w})=>w),columns:m.map(({column:w})=>w)}))));let u=null;if(j(i,p=>{!u&&p.tagName==="main"&&(u=p)},{inTemplates:!1}),u){let p=O(u,"data-doc-id");p===void 0?a.push(`main.doc-page needs data-doc-id="${t}"`):p!==t&&a.push(`main[data-doc-id] is "${p}": it must be the document's slug "${t}"`)}return a}var ho=t=>eo(eo(t).find(o=>o.tagName==="html")??{}).find(o=>o.tagName==="head")?.sourceCodeLocation?.startTag?.endOffset,Lt=new Set(["localStorage","sessionStorage"]);function fo(t){let o=[],n=[];return j(t,e=>{e.tagName==="script"&&O(e,"src")!==void 0&&o.push(O(e,"src")),(e.tagName==="link"?(O(e,"rel")??"").toLowerCase().split(/\s+/):[]).includes("stylesheet")&&O(e,"href")!==void 0&&n.push(O(e,"href"))}),{scripts:o,styles:n}}function uo({slug:t,html:o,directory:n=M(t,z),tree:e=g(o),uses:s=V(o,Z,{tree:e}),catalog:i}){let a=[];ho(e)===void 0&&a.push("the page writes no <head> start tag, which an export puts its Content-Security-Policy right after: write <head> \u2026 </head> before <body>");let r=[];j(e,d=>{if(["script","link","img"].includes(d.tagName))for(let h of["src","href"]){let f=O(d,h)?.trim();f&&/^https?:\/\//i.test(f)&&r.push(f)}}),r.length>0&&a.push(`external resources are not portable: ${r.join(", ")}`);for(let{name:d,how:h,line:f,where:u}of s){if(!Z.has(d))continue;let p={call:`calls ${d}(\u2026)`,new:`creates new ${d}(\u2026)`}[h]??`uses ${d}`;a.push(`line ${f}: ${u} ${p}: embed its data (inline JSON, DocState); the export blocks the network`)}let{scripts:l,styles:c}=fo(e);for(let d of l)se.has(d)||a.push(`unsupported script dependency ${d}`);for(let d of c)ie.has(d)||a.push(`unsupported stylesheet dependency ${d}`);return a.push(...Ht({html:o,directory:n,tree:e}),...Bt({html:o,directory:n,tree:e}),...Pt({html:o,directory:n,tree:e}),...Gt({html:o,directory:n,tree:e})),a.push(...de(A(o,i,e))),[...new Set(a)]}var ci=[[/\bDocSheets\.mount\s*\(/,"Sheet areas start on their own: remove DocSheets.mount (an area keeps its tab under its data-doc-sheets name)"],[/\bDocCode\.(?:View|DiffView|DiffStats|enhance)\b/,'code blocks are highlighted on their own, and a diff is declared as <div class="doc-diff"> holding { path, lines } as JSON (sdk/doc-code.d.ts)'],[/\bDocTables\.(?:enhance|enhanceAll|makeSortable)\b/,"tables start on their own: remove the call"],[/\bDocDialogs\.(?:enhance|enhanceAll)\b/,"detail cards start on their own: remove the call"]];function li({html:t,tree:o=g(t),uses:n=V(t,Lt,{tree:o})}){let e=ae(t,o),s=[...ee(t,o),...oe(t,o)];for(let[i,a]of ci)i.test(e)&&s.push(`${e.match(i)[0].replace(/\s*\($/,"")} is gone: ${a}`);for(let{name:i,line:a,where:r}of n)Lt.has(i)&&s.push(`line ${a}: ${r} uses ${i}: use DocState instead of direct browser storage`);return[...new Set(s)]}var di=(t,o)=>o.childNodes.find(n=>n.tagName||n.nodeName==="#text"&&n.value.trim())===t,hi=t=>to(t,Rs("highlight").match)||t.tagName==="li"&&to(t.parentNode,`ol.${zs}`),fi=`an icon is one of three kinds: an emoji, <div class="doc-icon">\u{1F3AF}</div>; an icon of Gallery's sets in one of ${oo.length} colors, <div class="doc-icon" data-icon="/icons/airplane_blue.svg"></div> (MingCute's names; Tabler's as /icons/tabler/plane_blue.svg; the colors ${oo.join(", ")}); or a picture of the document's folder, <div class="doc-icon"><img src="assets/logo.png" alt=""></div>`,po=t=>t.nodeName==="#text"?t.value:(t.childNodes??[]).map(po).join("");function ao(t,o,n){let e=o.sourceCodeLocation?.attrs?.[n],s=e?t.slice(e.startOffset,e.endOffset):`${n}="${O(o,n)??""}"`;return s.length>72?`${s.slice(0,71)}\u2026`:s}function ui(t,o){let n=O(o,"data-icon");if(n!==void 0)return{held:ao(t,o,"data-icon"),meant:Et(n)==="glyph"?n:null};let e=null;if(j(o,i=>{e??=["img","svg"].includes(i.tagName)?i:null}),e?.tagName==="img"){let i=O(e,"src");return{held:`<img ${ao(t,e,"src")}>`,meant:Et(i)==="image"?i:null}}if(e)return{held:"an <svg>"};let s=po(o).replace(/\s+/g," ").trim();return{held:s?`"${s.slice(0,40)}"`:"nothing"}}function pi({set:t,name:o,color:n}){let e=Ds.find(a=>a!==t);if(ct(e).includes(o))return`; "${o}" is ${e==="tabler"?"Tabler":"MingCute"}'s: ${Ms(e,o,n)}`;let s=o.split("-").filter(a=>a.length>=3),i=ct(t).filter(a=>a.split("-").some(r=>s.includes(r))).slice(0,6);return i.length>0?`; names of its set near it: ${i.join(", ")}`:""}function mi({html:t,tree:o=g(t)}){let{all:n,own:e}=_t(o),s=[],i=a=>a.sourceCodeLocation?.startLine;e.length>1&&s.push(`line ${i(e[1])}: ${e.length} page icons (.doc-icon) in the header (the first at line ${i(e[0])}): a document has one, right before its title`);for(let a of n){let r=i(a),l=a.parentNode;!e.includes(a)&&!(hi(l)&&di(a,l))&&s.push(`line ${r}: an icon (.doc-icon) stands only right before the document's title, first in a highlight block (.doc-panel, .doc-summary), or first in a flowchart's step (ol.doc-flow > li, in its number's place)`);let c=Us(Ft(t,a)),{held:d,meant:h}=c?{}:ui(t,a);h?s.push(`line ${r}: an icon (.doc-icon) holds ${d}, an icon a page reads only in double quotes: write ${Ps(h)}`):c?Et(c)==="glyph"&&!jt(c)&&s.push(`line ${r}: the icon ${c} is none of the icon sets' (MingCute: /icons/<name>_<color>.svg, Tabler: /icons/tabler/<name>_<color>.svg; src/shared/emoji/data/icons.json lists the names of each)${pi(_s(c))}`):s.push(`line ${r}: an icon (.doc-icon) holds no icon (it holds ${d}): ${fi}`)}return[...new Set(s)]}function mo(t){let o=g(t.html),n={...t,tree:o,uses:V(t.html,new Set([...Z,...Lt]),{tree:o})};return[...ri(n),...bt(t.html,o),...li(n),...mi(n),...uo(n)]}function gi(t){let o=new Map(t.map(s=>[s.slug,[...mo(s),...mt(s.html)]])),n=new Map(t.map(s=>[S.resolve(s.htmlPath),s.slug])),e=new Map(t.map(s=>[S.resolve(s.htmlPath),s]));for(let s of t)s.scriptNotes=[];if(t.length>0)for(let{htmlPath:s,text:i,typeOnly:a,note:r}of re(t)){if(a){e.get(s)?.scriptNotes.push(r);continue}let l=s?[n.get(s)]:[...o.keys()];for(let c of l)o.get(c).push(s?i:`${i} (shared SDK declaration)`)}for(let[s,i]of o)i.length===0&&o.delete(s);return o}async function Tr(t=[],{prepare:o=null}={}){let{reports:n,failures:e}=await rt(t,{prepare:o});for(let s of n){let i=[...mo(s),...mt(s.html)];i.length&&e.set(s.slug,i)}return e}async function $i(t=[],{prepare:o=null}={}){let{reports:n,failures:e}=await rt(t,{prepare:o});for(let[s,i]of gi(n))e.set(s,i);return{reports:n,failures:e}}async function wi({fresh:t=!1,kit:o=Bs,vendor:n=Hs}={}){if(Ws)return;let e=U.map(a=>[a,a.file?kt(a.file,{fresh:t}):dt(a)]);await N.mkdir(o,{recursive:!0});let s=S.join(n,"katex","fonts");await N.mkdir(s,{recursive:!0});let i=(await N.readdir(lt)).filter(a=>a.endsWith(".woff2"));await Promise.all(i.map(a=>N.copyFile(S.join(lt,a),S.join(s,a)))),await Promise.all(e.map(async([a,r])=>N.writeFile(a.file?S.join(o,a.file):S.join(n,...a.vendor.path.split("/").slice(2)),await r)))}async function bi(t,o){let n=await N.readdir(t).catch(()=>[]);await Promise.all(n.filter(e=>e.endsWith(".html")&&!o.has(e.slice(0,-5))).map(e=>N.rm(S.join(t,e),{force:!0})))}async function ki(t){let o=S.join(K,"reports.json"),n=await N.readFile(o,"utf8").then(JSON.parse,()=>[]),e=new Map(Array.isArray(n)?n.map(i=>[i.slug,i]):[]);for(let{entry:i}of t)e.set(i.slug,i);let s=[];for(let[i,a]of[...e].sort(([r],[l])=>r.localeCompare(l))){let r=S.join(K,`${i}.html`);await N.stat(r).then(()=>!0,()=>!1)&&s.push(a)}await N.writeFile(o,`${JSON.stringify(s,null,2)}
|
|
6
|
+
`)}async function yi(t=[],{prepare:o=null}={}){let{reports:n,failures:e}=await $i(t,{prepare:o});await wi(),await N.mkdir(K,{recursive:!0}),await bi(K,new Set(await Qs()));let s=[];for(let i of n){let a=`${i.slug}.html`,r=S.join(K,a);if(e.has(i.slug)){await N.rm(r,{force:!0});continue}let{html:l,removed:c}=Ot(i.html,{slug:i.slug});await N.writeFile(r,l),s.push({report:i,html:l,removed:c,entry:{slug:i.slug,...i.metadata,preview:`/generated/${a}`,sourceSha256:at(i.html),outputSha256:at(l)}})}return await ki(s),{built:s,failures:e}}var Ni=t=>t.replace(/<\/script/gi,"<\\/script");async function go(){return new Map(await Promise.all(U.map(async t=>{let o=await(t.file?kt(t.file):dt(t,{inline:!0}));return Yt(t).endsWith(".css")||(o=Ni(o)),[t.id,t.umd?oi(o):o]})))}function Si(t,o,n=null,e=[]){let s=ho(g(o));if(s===void 0)throw new Error(`${t}: the page writes no <head> start tag, which the export's Content-Security-Policy goes right after`);let i=n?`
|
|
7
|
+
${si(n)}${e.length>0?`
|
|
8
|
+
${ni(e)}`:""}`:"";return`${o.slice(0,s)}
|
|
9
|
+
<meta name="generator" content="${ei}">
|
|
10
|
+
<meta http-equiv="Content-Security-Policy" content="${ti}">${i}${o.slice(s)}`}function $o(t,o,n,e=null,s=T()){let i=A(o,s);o=ne(he(Si(t,o,e,i),s),({id:l,element:c,attribute:d})=>{let h=n.get(l);if(typeof h!="string")throw new Error(`${t}: no inline source for the asset "${l}" (loadInlineSources in src/render/pipeline.mjs)`);return`<${c} ${d}="${l}-inline">${h}</${c}>`});let{scripts:a,styles:r}=fo(g(o));if(a.length+r.length>0)throw new Error(`${t}: export still contains a linked script or stylesheet`);return o}async function ro(t,o=z,{components:n=!0}={}){let e=M(t,o),s=await N.readFile(At(e).html),i=s.toString("utf8"),a=g(i),r=n?T(o):{packages:new Map},l=[...n?bt(i,a,r):[],...uo({slug:t,html:i,directory:e,tree:a,catalog:r})];if(l.length>0){let c=A(i,r,a).find(({id:d})=>l[0].startsWith(`${d}:`)||l[0].startsWith(`${d} (`))?.id;throw Object.assign(new Error(`${t}: ${l[0]}`),{reason:"check",slug:t,failures:l,...c?{component:c}:{}})}return{html:i,sha256:at(s)}}async function Lr({directory:t=z}={}){let o=await go(),n=async(e,{files:s=!0}={})=>{let i=await ro(e,t);return $o(e,Ot(i.html,{slug:e,files:s,reportsDirectory:t}).html,o,i.sha256,T(t))};return n.check=async e=>{await ro(e,t,{components:!1})},n}async function Ar(t=[],{prepare:o=null}={}){let{built:n,failures:e}=await yi(t,{prepare:o}),s=await go();await N.mkdir(Tt,{recursive:!0});let i=new Set(n.map(({report:l})=>l.slug)),{links:a}=await Ys(),r=[];for(let{report:l,html:c}of n)try{let d=Ge(c,l.slug,f=>i.has(f)?`${f}.html`:null,{links:a}),h=$o(l.slug,d,s,l.fileSha256);await N.writeFile(S.join(Tt,`${l.slug}.html`),h),r.push({slug:l.slug,bytes:Buffer.byteLength(h),sha256:at(h)})}catch(d){e.set(l.slug,[d.message])}return{built:n,exported:r,failures:e}}function co(t){let o=new Set;return j(t,n=>{for(let e of["id","data-block-id"])O(n,e)!==void 0&&o.add(O(n,e))}),o}function xi(t,o,n){if(lo(t)||/^(?:[a-z][a-z0-9+.-]*:|\/)/i.test(t)||Gs(t))return!1;let{pathname:e}=new URL(o);return!e.startsWith(`/${n}/`)||e.endsWith(".html")}function vi({slug:t,tree:o,directory:n}){let e=[],s=co(o),i=n===M(S.basename(n),z)?z:S.dirname(n),a=new Map([[t,s]]),r=d=>{if(!a.has(d)){let h=At(M(d,i));a.set(d,Qe(h.html)?co(g(Is(h.html,"utf8"))):null)}return a.get(d)},l=null,c=(d,h)=>h===null?Vs(d):Zs(h,l??=Xs((Qe(i)?Fs(i):[]).map(f=>({slug:f}))));return j(o,d=>{let h=d.tagName==="a"?O(d,"href"):void 0;if(!h||h==="#"||h==="#top")return;let f=d.sourceCodeLocation?.startLine;if(h.startsWith("#")){s.has(Ks(h.slice(1)))||e.push(`the link to ${h} (line ${f}) names no block or element of this document`);return}let u=Js(h,t),p=qs(u),m=c(u,p);(m?!r(m.slug):p!==null)?lo(h)||e.push(`the link to ${h} (line ${f}) names a document that is not there: gallery list has the slugs`):m?.block&&!r(m.slug).has(m.block)?e.push(`the link to ${h} (line ${f}) names a block document ${m.slug} does not hold`):u&&!m&&xi(h,u,t)&&e.push(`the link to ${h} (line ${f}) leads to no document: a link to one is ../<slug>/doc.html, gallery list has the slugs`)},{stop:js}),e}function wo({slug:t,html:o,directory:n=M(t,z),written:e=o,scriptNotes:s=[]}){let i=g(o),a=be(o);return{fix:[...Be(o,i),...Ze({html:o,directory:n,tree:i})],notes:[...ze(o,{written:e}),...Te(i),...vi({slug:t,tree:i,directory:n}),...a.notes,...s],readings:a.readings}}function Cr(t){let{fix:o,notes:n}=wo(t);return[...o,...n]}function Ir(t){let o=t.map(n=>[n.slug,wo(n)]);for(let[n,{fix:e}]of o)for(let s of e)console.log(`fix ${n}: ${s}`);for(let[n,{notes:e}]of o)for(let s of e)console.log(`note ${n}: ${s}`);for(let[n,{readings:e}]of o)for(let s of e)console.log(`chart ${n}: ${s}`)}async function Oi(t,{exportNote:o=!1}={}){for(let[n,e]of t){console.error(`
|
|
11
|
+
FAIL ${n}: ${e.length} problem${e.length===1?"":"s"}`);for(let i of e)console.error(` - ${i}`);let s=S.join(Tt,`${n}.html`);o&&await N.stat(s).then(()=>!0,()=>!1)&&console.error(` ${s} was not updated; it still holds an earlier export.`)}}function Ei(t,{above:o=!1,allow:n=process.argv.includes("--allow-failures")}={}){t.size!==0&&(console.error(`
|
|
12
|
+
${t.size} document${t.size===1?"":"s"} failed: ${[...t.keys()].join(", ")}${o?" (the failures are listed first, above)":""}`),n||(process.exitCode=1))}async function Fr(t,{exportNote:o=!1,allow:n}={}){await Oi(t,{exportNote:o}),Ei(t,{allow:n})}export{Qo as a,es as b,Ge as c,Ye as d,Ot as e,ii as f,uo as g,mo as h,gi as i,Tr as j,$i as k,wi as l,yi as m,Si as n,Lr as o,Ar as p,wo as q,Cr as r,Ir as s,Oi as t,Ei as u,Fr as v};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import"./chunk-5L7RYZCL.mjs";var re="file",fe="link",ue="symlink",Q="directory",Xe={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},Ze={0:re,1:fe,2:ue,3:"character-device",4:"block-device",5:Q,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},Ge=new Uint8Array(512),he=new Uint8Array(0),ie=new TextEncoder,ye=new TextDecoder;function te(e,t,n,i){if(i)for(let r=0;r<i.length&&r<n;r++){let s=i.charCodeAt(r);if(s>127){ie.encodeInto(i,e.subarray(t,t+n));return}e[t+r]=s}}function le(e,t,n,i){if(i===void 0)return;let r=i;for(let s=t+n-2;s>=t;s--)e[s]=48+r%8,r=Math.floor(r/8);r===0&&i%1===0||ie.encodeInto(i.toString(8).padStart(n-1,"0"),e.subarray(t,t+n-1))}function J(e,t,n){if(e[t]===0)return"";let i=e.indexOf(0,t),r=i===-1||i>t+n?t+n:i;return ye.decode(e.subarray(t,r))}function Te(e,t,n){let i=0,r=t+n;for(let s=t;s<r;s++){let c=e[s];if(c===0)break;c!==32&&(i=i*8+(c-48))}return i}function me(e,t,n){if(e[t]&128){let i=0;i=e[t]&127;for(let r=1;r<n;r++)i=i*256+e[t+r];if(!Number.isSafeInteger(i))throw new Error("TAR number too large");return i}return Te(e,t,n)}var ze=e=>e.type==="directory"||e.type==="symlink"||e.type==="link"||e.type==="character-device"||e.type==="block-device"||e.type==="fifo";async function Ce(e){if(e==null)return he;if(e instanceof Uint8Array)return e;if(typeof e=="string")return ie.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}var Ie=(e,t)=>{let n=e.split("/").filter(Boolean);return t>=n.length?"":n.slice(t).join("/")};function De(e,t){let{strip:n,filter:i,map:r}=t;if(!n&&!i&&!r)return e;let s={...e};if(n&&n>0){let a=Ie(s.name,n);if(!a)return null;if(s.name=s.type==="directory"&&!a.endsWith("/")?`${a}/`:a,s.linkname){let d=s.linkname.startsWith("/");if(d||s.type==="link"){let h=Ie(s.linkname,n);s.linkname=d?`/${h}`||"/":h}}}if(i?.(s)===!1)return null;let c=r?r(s):s;return c&&(!c.name?.trim()||c.name==="."||c.name==="/")?null:c}var Se=256;function qe(){let e=new Array(Se),t=e.length-1,n=0,i=0,r=0,s=a=>{let d=e[n];a===d.length?(e[n]=he,n=n+1&t):e[n]=d.subarray(a),r-=a,r===0&&e.length>Se&&(e=new Array(Se),t=255,n=0,i=0)};function c(a,d){if(d){let E=0,o=Math.min(a,r);for(;o>0;){let m=e[n],f=Math.min(o,m.length),l=f===m.length?m:m.subarray(0,f);if(s(f),o-=f,E+=f,!d(l))break}return E}if(r<a)return null;if(a===0)return he;let h=e[n];if(h.length>=a){let E=h.length===a?h:h.subarray(0,a);return s(a),E}let v=new Uint8Array(a),w=0,T=a;for(;T>0;){let E=e[n],o=Math.min(T,E.length);v.set(o===E.length?E:E.subarray(0,o),w),w+=o,T-=o,s(o)}return v}return{push:a=>{if(a.length===0)return;let d=i+1&t;if(d===n){let h=e.length,v=h*2,w=new Array(v),T=i-n+h&h-1;if(n<i)for(let E=0;E<T;E++)w[E]=e[n+E];else{let E=h-n;for(let o=0;o<E;o++)w[o]=e[n+o];for(let o=0;o<i;o++)w[E+o]=e[o]}e=w,t=v-1,n=0,i=T,d=i+1&t}e[i]=a,i=d,r+=a.length},available:()=>r,peek:a=>{if(r<a)return null;if(a===0)return he;let d=e[n];if(d.length>=a)return d.length===a?d:d.subarray(0,a);let h=new Uint8Array(a),v=0,w=n;for(;v<a;){let T=e[w],E=Math.min(a-v,T.length);E===T.length?h.set(T,v):h.set(T.subarray(0,E),v),v+=E,w=w+1&t}return h},discard:a=>{if(a>r)throw new Error("Too many bytes consumed");if(a===0)return;let d=a;for(;d>0;){let h=e[n],v=Math.min(d,h.length);s(v),d-=v}},pull:c}}var ve=32,Je=48;function Qe(e){let t=Te(e,148,8),n=0;for(let i=0;i<e.length;i++)i>=148&&i<156?n+=ve:n+=e[i];return t===n}function Ve(e){e.fill(ve,148,156);let t=0;for(let n=e.length;n>0;)t+=e[--n];for(let n=153;n>=148;n--)e[n]=(t&7)+Je,t>>=3;e[154]=0,e[155]=ve}var je=256,et=/[^\x00-\x7f]/;function ne(e,t){return e.length*3<=t?!1:e.length>t?!0:et.test(e)?ie.encode(e).length>t:!1}function tt(e){let t={};ne(e.name,100)&&be(e.name)===null&&(t.path=e.name),e.linkname&&ne(e.linkname,100)&&(t.linkpath=e.linkname),e.uname&&ne(e.uname,32)&&(t.uname=e.uname),e.gname&&ne(e.gname,32)&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let n=Object.entries(t);if(n.length===0)return null;let i=ie.encode(n.map(([r,s])=>{let c=`${r}=${s}
|
|
3
|
+
`,a=ie.encode(c).length+1,d=a+String(a).length;return d=a+String(d).length,`${d} ${c}`}).join(""));return{paxHeader:Be({name:ye.decode(ie.encode(`PaxHeader/${e.name}`).slice(0,100)),size:i.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:i}}function be(e){if(!ne(e,100)||ne(e,je))return null;for(let t=e.length-1;t>0;t--){if(e[t]!=="/")continue;let n=e.slice(0,t),i=e.slice(t+1);if(!ne(n,155)&&!ne(i,100))return{prefix:n,name:i}}return null}function Be(e){let t=new Uint8Array(512),n=ze(e)?0:e.size??0,i=e.name,r="";if(!e.pax?.path){let s=be(i);s&&(i=s.name,r=s.prefix)}return te(t,0,100,i),le(t,100,8,e.mode??(e.type==="directory"?493:420)),le(t,108,8,e.uid??0),le(t,116,8,e.gid??0),le(t,124,12,n),le(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),te(t,156,1,Xe[e.type??"file"]),te(t,157,100,e.linkname),te(t,257,6,"ustar\0"),te(t,263,2,"00"),te(t,265,32,e.uname),te(t,297,32,e.gname),te(t,345,155,r),Ve(t),t}function nt(e,t){if(t&&!Qe(e))throw new Error("Invalid tar header checksum.");let n=J(e,156,1),i={name:J(e,0,100),mode:Te(e,100,8),uid:me(e,108,8),gid:me(e,116,8),size:me(e,124,12),mtime:new Date(me(e,136,12)*1e3),type:Ze[n]||"file",linkname:J(e,157,100)},r=J(e,257,6);return r.trim()==="ustar"&&(i.uname=J(e,265,32),i.gname=J(e,297,32)),r==="ustar"&&(i.prefix=J(e,345,155)),i}var Oe={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>/^\d+$/.test(e)&&Number.isSafeInteger(+e)?+e:NaN],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function rt(e){let t=Object.create(null),n=Object.create(null),i=!1,r=0;for(;r<e.length;){let s=e.indexOf(32,r);if(s===-1)break;let c=parseInt(ye.decode(e.subarray(r,s)),10);if(!(c>0))break;let a=r+c,d=ye.decode(e.subarray(s+1,a-1)),h=d.indexOf("=");if(h>0){let v=d.slice(0,h),w=d.slice(h+1);if(n[v]=w,i=!0,Object.hasOwn(Oe,v)){let[T,E]=Oe[v],o=E(w);(typeof o=="string"||!Number.isNaN(o))&&(t[T]=o)}}r=a}return i&&(t.pax=n),t}function Pe(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function it(e){switch(e){case"pax-global-header":case"pax-header":return rt;case"gnu-long-name":return t=>({name:J(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:J(t,0,t.length)});default:return}}function at(e){let t=Be(e),n=tt(e);if(!n)return[t];let i=-n.paxBody.length&511,r=i>0?[Ge.subarray(0,i)]:[];return[n.paxHeader,n.paxBody,...r,t]}var xe=0,ce=1,st=8388608,pe=new Error("Tar archive is truncated.");function Le(e={}){let t=e.strict??!1,{available:n,peek:i,push:r,discard:s,pull:c}=qe(),a=xe,d=!1,h=!1,v=!1,w=null,T={},E={},o={isEntryActive:()=>a===ce,isBodyComplete:()=>!w||w.remaining===0,canFinish:()=>!w||n()>=w.remaining+w.padding,bodyBytes:()=>w&&w.remaining>0?Math.min(w.remaining,n()):0,available:n,write(m){if(d)throw new Error("Archive already ended.");r(m)},end(){d=!0},readHeader(){if(a!==xe)throw new Error("Cannot read header while an entry is active");if(!h)for(;!h;){if(n()<512){if(d){if(n()>0&&t)throw pe;h=!0;return}return null}let m=i(512);if(Ne(m)){if(n()<1024){if(d){if(t)throw pe;h=!0;return}return null}if(Ne(i(1024).subarray(512))){s(1024),h=!0,v=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let f;try{f=nt(m,t)}catch(I){if(t)throw I;s(512);continue}let l=it(f.type);if(l){if(f.size>st)throw new Error("Tar metadata entry exceeds maximum size.");let I=f.size+(-f.size&511);if(n()<512+I){if(d&&t)throw pe;return null}s(512);let O=l(c(I).subarray(0,f.size));E.pax&&(E={});let z=f.type==="pax-global-header"?T:E;for(let A in O)z[A]=O[A];continue}s(512);let u=f;f.prefix&&(u.name=`${f.prefix}/${u.name}`),Pe(u,T),Pe(u,E);let k=u.size;return ze(u)?(k=0,u.size=0):u.name.endsWith("/")&&u.type==="file"&&(u.type=Q,u.size=0),E={},w={header:u,remaining:k,padding:-k&511},a=ce,u}},streamBody(m){if(a!==ce||!w||w.remaining===0)return 0;let f=Math.min(w.remaining,n());if(f===0)return 0;let l=c(f,m);return w.remaining-=l,l},skipPadding(){if(a!==ce||!w)return!0;if(w.remaining>0)throw new Error("Body not fully consumed");return n()<w.padding?!1:(s(w.padding),w=null,a=xe,!0)},skipEntry(){if(a!==ce||!w)return!0;let m=Math.min(w.remaining,n());return m>0&&(s(m),w.remaining-=m),w.remaining>0?!1:o.skipPadding()},validateEOF(){if(t){if(!v)throw pe;if(n()>0&&c(n()).some(m=>m!==0))throw new Error("Invalid EOF.")}}};return o}function Ne(e){if(e[0]!==0)return!1;if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let n=0;n<t.length;n++)if(t[n]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}var ot=new Uint8Array(1024);function $e(e){let t=null,n=0,i=!1,r=s=>{throw new Error(s)};return{add(s){i&&r("No new tar entries after finalize."),t!==null&&r("Previous entry must be completed before adding a new one");let c=ze(s)?0:s.size;(!Number.isSafeInteger(c)||c<0)&&r("Invalid tar entry size.");let a=at({...s,size:c});for(let d of a)e(d);t={...s,size:c},n=0},write(s){t||r("No active tar entry."),i&&r("Cannot write data after finalize.");let c=n+s.length;c>t.size&&r(`"${t.name}" exceeds given size of ${t.size} bytes.`),n=c,e(s)},endEntry(){t||r("No active entry to end."),i&&r("Cannot end entry after finalize."),n!==t.size&&r(`Size mismatch for "${t.name}".`);let s=-t.size&511;s>0&&e(new Uint8Array(s)),t=null,n=0},finalize(){i&&r("Archive has already been finalized"),t!==null&&r("Cannot finalize while an entry is still active"),e(ot),i=!0}}}import*as C from"node:fs";import*as y from"node:fs/promises";import{cpus as Ye}from"node:os";import*as S from"node:path";import{Readable as se,Writable as lt}from"node:stream";function V(e,t,n){let i=S.resolve(e),r=S.resolve(t);if(i!==r&&!i.startsWith(r+S.sep))throw new Error(n)}var ct={":":"\uF03A","<":"\uF03C",">":"\uF03E","|":"\uF07C","?":"\uF03F","*":"\uF02A",'"':"\uF022"},ft=/\/\/|(?:^|\/)\.(?:\/|$)/;function Ke(e){let t=e.replace(/\\/g,"/");if(t.split("/").includes("..")||/^[a-zA-Z]:\.\./.test(t))throw new Error(`${e} points outside extraction directory`);let n=t;return/^[a-zA-Z]:/.test(n)?n=n.replace(/^[a-zA-Z]:[/\\]?/,""):n.startsWith("/")&&(n=n.replace(/^\/+/,"")),process.platform==="win32"?n.replace(/[<>:"|?*]/g,i=>ct[i]):n}var ut=e=>{let t=Ke(e.replace(/[\\/]+$/,""));return ft.test(t)?S.posix.normalize(t):t},ae={bigint:!0},_e={withFileTypes:!0},xt=dt;function dt(e,t={}){let n=new Map,i=new Map,r=new Set,s=null,c=null,a=null,d,h=()=>{let l=s;s=null,c=null,l?.()},v=()=>{a?.(),a=null},w=(l,u)=>{r.delete(l),l.destroy(u)},T=l=>{let u=i.get(l);if(u!==null)return u;let k=l.close().finally(()=>i.delete(l));return i.set(l,k),k},E=async l=>{for(let k of r)w(k,l);let u=Promise.allSettled([...i.keys()].map(T));n.clear(),v();for(let k of await u)if(k.status==="rejected")throw k.reason},o=new se({highWaterMark:8388608,read:h,destroy(l,u){d=l??AbortSignal.abort().reason,h(),E(d).then(()=>u(l),k=>u(l??k))}}),m=l=>o.destroy(l),f=$e(l=>{if(o.destroyed)throw d;!o.push(Buffer.from(l))&&!c&&(c=new Promise(u=>{s=u}))});return(async()=>{let{dereference:l=!1,filter:u,map:k,baseDir:I,concurrency:O=Ye().length||8}=t,z,A,P;if(typeof e=="string"){let p=S.resolve(e);z=p;let U=await y.stat(p,ae);if(o.destroyed)return;let x=await y.readdir(p,_e);if(o.destroyed)return;let W=await y.stat(p,ae);if(o.destroyed)return;P=U.dev===W.dev&&U.ino===W.ino?x.map(_=>({type:_.isDirectory()?Q:re,source:S.join(p,_.name),target:_.name})):[]}else P=e.map(p=>({...p}));let b=new Map,N=0,F=0,$=0,g=!1,B=async p=>{try{for await(let U of p){if(o.destroyed)return;f.write(U instanceof Uint8Array?U:Buffer.from(U)),c&&await c}}finally{p.off("error",m),r.delete(p)}},D=async()=>{let p=Buffer.alloc(65536),U=null;for(;;){if(o.destroyed)return;if(g&&F>=P.length)break;if(!n.has(F)){await new Promise(W=>{a=W});continue}let x=n.get(F);if(n.delete(F),!x){F++,X();continue}if(x.hardlinkId){let W=x.header.name,_=b.get(x.hardlinkId);_&&(x.body&&!(x.body instanceof Uint8Array)&&!(x.body instanceof se)&&await T(x.body.handle),x.body=void 0,x.header.type=fe,x.header.linkname=_.originalName,x.header.size=0),k&&(x.header=k(x.header)),_?x.header.linkname===_.originalName&&(x.header.linkname=_.mappedName):b.set(x.hardlinkId,{originalName:W,mappedName:x.header.name})}if(f.add(x.header),c&&await c,o.destroyed)return;if(x.body)if(x.body instanceof Uint8Array)x.body.length>0&&(f.write(x.body),c&&await c);else if(x.body instanceof se)await B(x.body);else{let{handle:W,size:_}=x.body,L=_>1048576?U??=Buffer.alloc(1048576):p;try{let H=_;for(;H>0&&!o.destroyed;){let{bytesRead:ee}=await W.read(L,0,Math.min(H,L.length),null);if(ee===0)break;f.write(L.subarray(0,ee)),H-=ee,c&&await c}}finally{await T(W)}}if(o.destroyed)return;f.endEntry(),c&&await c,F++,X()}},X=()=>{if(!(o.destroyed||g)){for(;$<O&&N<P.length&&N-F<O;){$++;let p=N++;G(P[p],p).catch(m).finally(()=>{$--,X()})}$===0&&N>=P.length&&(g=!0,v())}},G=async(p,U)=>{let x=null,W=Ke(p.target);try{if(p.type==="content"||p.type==="stream"){let M,Y,R=W.endsWith("/");if(p.type==="stream"){if(!R&&p.size<=0||R&&p.size!==0)throw new Error(R?"Streams for directories must have size 0.":"Streams require a positive size.");Y=p.size}else{let oe=await Ce(p.content);Y=oe.length,M=oe}let K={size:R?0:Y,isFile:()=>!R,isDirectory:()=>R,isSymbolicLink:()=>!1,mode:p.mode,mtime:p.mtime??new Date,uid:p.uid??0,gid:p.gid??0};if(o.destroyed||u&&!u(W,K)||o.destroyed)return;let Z={name:W,type:R?Q:re,size:R?0:Y,mode:K.mode,mtime:K.mtime,uid:K.uid,gid:K.gid,uname:p.uname,gname:p.gname};if(k&&(Z=k(Z)),o.destroyed)return;!R&&p.type==="stream"&&(M=p.content instanceof se?p.content:se.fromWeb(p.content),M.once("error",m),r.add(M)),x={header:Z,body:R?void 0:M};return}let _=p.source,L=await y.lstat(_,ae);if(o.destroyed)return;if(l&&L.isSymbolicLink()){if(_=await y.realpath(_),o.destroyed||(A??=await y.realpath(I??z??process.cwd()),o.destroyed))return;let M=S.relative(A,_);if(M===".."||M.startsWith(".."+S.sep)||S.isAbsolute(M)||(L=await y.lstat(_,ae),L.isSymbolicLink()))return}if(o.destroyed||u&&!u(p.source,L)||o.destroyed)return;let H={name:W,size:0,mode:(p.mode??Number(L.mode))&4095,mtime:p.mtime===void 0?L.mtime:new Date(p.mtime.getTime()),uid:p.uid??Number(L.uid),gid:p.gid??Number(L.gid),uname:p.uname,gname:p.gname,type:re},ee,Ee;if(L.isDirectory()){H.type=Q,H.name=W.endsWith("/")?W:`${W}/`;try{let M=await y.readdir(_,_e);if(o.destroyed)return;let Y=await y.lstat(_,ae);if(o.destroyed||!Y.isDirectory()||L.dev!==Y.dev||L.ino!==Y.ino)return;for(let R of M)P.push({type:R.isDirectory()?Q:re,source:S.join(_,R.name),target:`${H.name}${R.name}`,mtime:p.mtime,uid:p.uid,gid:p.gid,uname:p.uname,gname:p.gname,mode:p.mode})}catch(M){let Y=M.code;if(Y!=="ENOENT"&&Y!=="ENOTDIR")throw M}}else if(L.isSymbolicLink())H.type=ue,H.linkname=await y.readlink(p.source);else if(L.isFile()){H.size=Number(L.size);let M;L.nlink>1n&&(process.platform!=="win32"||L.dev!==0n&&L.ino!==-1n)&&(Ee=`${L.dev}:${L.ino}`);try{let Y;try{H.size===0?Y=await y.lstat(_,ae):(M=await y.open(_,C.constants.O_NOFOLLOW??0),i.set(M,null))}catch(R){let K=R.code;if(K==="ELOOP"||K==="ENOENT")return;throw R}if(o.destroyed)return;if(Y){if(!Y.isFile()||L.dev!==Y.dev||L.ino!==Y.ino)return}else{let{dev:R,ino:K}=await M.stat(ae);if(o.destroyed||L.dev!==R||L.ino!==K)return}if(H.size>0){let R=M;if(H.size<32768){let K=Buffer.allocUnsafe(H.size),Z=0;for(;Z<K.length&&!o.destroyed;){let{bytesRead:oe}=await R.read(K,Z,K.length-Z,Z);if(oe===0)break;Z+=oe}ee=Z===K.length?K:K.subarray(0,Z)}else ee={handle:R,size:H.size},M=void 0}}finally{M&&await T(M)}}else return;if(o.destroyed)return;Ee?x={header:H,body:ee,hardlinkId:Ee}:(k&&(H=k(H)),x={header:H,body:ee})}finally{o.destroyed?x?.body instanceof se?w(x.body,d):x?.body&&!(x.body instanceof Uint8Array)&&await T(x.body.handle):(n.set(U,x),U===F&&v())}};X(),await D(),o.destroyed||(f.finalize(),o.push(null))})().catch(m),o}var mt=e=>{let t=0,n=[],i=0,r=null,s=null,c=()=>r??=new Promise(d=>s=d),a=()=>{for(;t<e&&i<n.length;){let d=n[i++];t++,d().finally(()=>{t--,a()})}i===n.length&&(n.length=0,i=0,t===0&&s&&(s(),r=null,s=null))};return{add(d){let h=t===0&&i===n.length;return new Promise((v,w)=>{n.push(()=>Promise.resolve().then(d).then(v,w)),h&&c(),a()})},onIdle(){return t===0&&i===n.length?Promise.resolve():c()}}},Fe=262144,Ae=8388608,we=1024,Me=C.constants.O_WRONLY|C.constants.O_CREAT|C.constants.O_TRUNC|(C.constants.O_NOFOLLOW??0)|C.constants.O_EXCL,ge=1,j=2,de=3,Re=4,He=Promise.resolve(),Ue=e=>C.ftruncate(e,0,()=>C.close(e));function pt(e,{mode:t=438,mtime:n}={},i){let r=ge,s=!1,c=null,a=[],d=[],h=0,v=null,w=null,T=null,E=null,o=null,m=null,f=null,l=null,u=g=>{if(!m)return;let B=f,D=l;m=null,f=null,l=null,g?D?.(g):B?.()},k=()=>{h=0,a.length=0,d.length=0},I=()=>{r!==Re&&(r=de,E?.(),u())},O=g=>{if(v)return;v=g,r=Re;let B=s;k();let D=c;c=null,D!==null&&(B?w=D:Ue(D)),s=!1,o?o(g):i?.(g),u(g)},z=()=>{if(c===null){I();return}let g=c;c=null,n?C.futimes(g,n,n,B=>{if(r!==j){C.close(g);return}if(B){C.close(g,()=>O(B));return}C.close(g,D=>{r===j&&(D?O(D):I())})}):C.close(g,B=>{r===j&&(B?O(B):I())})},A=()=>{if(s||a.length===0||r!==j)return;s=!0;let g=a;a=d,d=g,a.length=0;let B=h,D=(X,G=0)=>{if(r!==j){if(w!==null){let p=w;w=null,Ue(p)}return}if(X){s=!1,O(X);return}if(G<=0||G>B){s=!1,O(new Error("File write made no progress."));return}if(h-=G,B-=G,B>0){let p=G,U=0;for(;p>=g[U].length;)p-=g[U++].length;if(g=g.slice(U),p>0&&(g[0]=g[0].subarray(p)),g.length===1){let x=g[0];C.write(c,x,0,x.length,null,D)}else C.writev(c,g,D);return}s=!1,d.length=0,h<Ae&&u(),a.length>0?A():E&&z()};if(g.length===1){let X=g[0];C.write(c,X,0,X.length,null,D)}else C.writev(c,g,D)},P=(g,B)=>{if(g)return O(g);if(r>=de){C.close(B);return}c=B,r=j,E?a.length>0?A():z():h>=Fe||a.length>=we?A():u()},b=g=>r>=de||E?!1:(a.push(g),h+=g.length,r===j&&!s&&(h>=Fe||a.length>=we)&&A(),h<Ae&&a.length<we),N=()=>v?Promise.reject(v):r===ge||r===j&&(h>=Ae||a.length>=we)?m??=new Promise((g,B)=>{f=g,l=B}):He,F=()=>v?Promise.reject(v):r>=de?He:T||(T=new Promise((g,B)=>{E=g,o=B,r===j&&!s&&(a.length>0?A():z())}),T),$=g=>{if(g){O(g);return}if(!(r>=de)){if(k(),s=!1,c!==null){let B=c;c=null,C.close(B)}I()}};return C.open(e,Me,t,(g,B)=>{if(g?.code!=="EEXIST")return P(g,B);r===ge&&C.rm(e,{force:!0},D=>{if(D)return O(D);r===ge&&C.open(e,Me,t,P)})}),{write:b,end:F,destroy:$,waitDrain:N}}var We=()=>{let e=new Map;return{get(t){let n=e.get(t);return e.delete(t)&&e.set(t,n),n},set(t,n){e.set(t,n).size>1e4&&e.delete(e.keys().next().value)},clear(){e.clear()}}},q="ENOENT",ht=64,yt=process.platform==="win32"?/[/\\]/:"/",ke=e=>e.split(yt).filter(t=>t&&t!=="."),wt=(e,t,n,i)=>{let{maxDepth:r=1024,dmode:s}=t,c=We(),a=new Map,d=[],h,v=We(),T=(async m=>{let f=S.resolve(m);try{await y.mkdir(f,{recursive:!0})}catch(l){if(l.code===q){let u=S.dirname(f);if(u===f)throw l;await y.mkdir(u,{recursive:!0}),await y.mkdir(f,{recursive:!0})}else throw l}try{return{symbolic:f,real:await y.realpath(f)}}catch(l){if(l.code===q)return{symbolic:f,real:f};throw l}})(e);T.catch(()=>{});let E=async(m,f)=>{let l=await T;if(m===l.symbolic)return l.real;let u=v.get(m);return u||(u=y.realpath(m).then(k=>(V(k,l.real,f),k)),v.set(m,u)),u},o=async(m,f)=>{let l=c.get(m);return l||(l=(async()=>{if(m!==(await T).symbolic){await o(S.dirname(m));try{let u=await y.lstat(m);if(u.isDirectory())return;if(u.isSymbolicLink())try{let k=await E(m,`Symlink "${m}" points outside the extraction directory.`);if((await y.stat(k)).isDirectory())return}catch(k){throw k.code===q?new Error(`Symlink "${m}" points outside the extraction directory.`):k}throw new Error(`"${m}" is not a valid directory component.`)}catch(u){if(u.code===q){await y.mkdir(m,{mode:f??t.dmode});return}throw u}}})(),c.set(m,l),l)};return{async ready(){await T},async preparePath(m){let{name:f,linkname:l,type:u,mode:k,mtime:I}=m,O=ut(f),z=await T,A=S.join(z.symbolic,O);if(r!==1/0){let N=1;for(let F of O)if(F==="/"&&++N>r)throw new Error("Tar exceeds max specified depth.")}let P=a.get(O);if(P){if(P==="directory"&&u!=="directory"||P!=="directory"&&u==="directory")throw new Error(`Path conflict ${u} over existing ${P} at "${f}"`);return}let b=S.dirname(A);switch(u){case Q:{a.set(O,Q);let N=k===void 0?void 0:k&511;await o(A,s??N),I&&await y.lutimes(A,I,I).catch(()=>{});return}case re:return a.set(O,re),await o(b),S.join(await E(b,`File "${f}" points outside the extraction directory.`),S.basename(A));case ue:{if(a.set(O,ue),!l)return;V(S.resolve(b,l),z.symbolic,`Symlink "${l}" points outside the extraction directory.`),await o(b);let N=await y.realpath(b);V(N,z.real,"Symlink parent changed."),V(S.resolve(N,l),z.real,`Symlink "${l}" points outside the extraction directory.`);let F=S.join(N,S.basename(A));try{await y.symlink(l,F)}catch($){if($.code!=="EEXIST")throw $;if(await y.rm(F,{force:!0}),await y.realpath(b)!==N)throw new Error("Symlink parent changed.");await y.symlink(l,F)}(h??=[]).push([O,l]),c.clear(),v.clear(),I&&await y.lutimes(A,I,I).catch(()=>{});return}case fe:{if(a.set(O,fe),!l)return;if(S.isAbsolute(l))throw new Error(`Hardlink "${l}" points outside the extraction directory.`);let N=S.join(z.symbolic,l);V(N,z.symbolic,`Hardlink "${l}" points outside the extraction directory.`),await o(b),N!==A&&d.push({linkTarget:N,outPath:A});return}default:return}},async checkSymlinks(){if(!h)return;let{symbolic:m,real:f}=await T,l=f+S.sep,u=S.parse(f).root,k=ke(f.slice(u.length)).length,I=(z,A,P)=>{if(!S.isAbsolute(z))return ke(z);V(z,f,P),A.length=0;let b=ke(z.slice(u.length));return b.splice(0,k),b},O=async([z,A])=>{let P=S.join(m,z);try{try{let D=await y.realpath(P);if(D!==f&&!D.startsWith(l))throw new Error(`Symlink "${A}" points outside the extraction directory.`);return}catch(D){if(D.code!==q)throw D}if(!(await y.lstat(P)).isSymbolicLink())return;let b=await y.readlink(P),N=`Symlink "${b}" points outside the extraction directory.`,F=await y.realpath(S.dirname(P));V(F,f,N);let $=ke(S.relative(f,F)),g=I(b,$,N),B=0;for(let D=0;D<g.length;D++){let X=g[D];if(X===".."){if(!$.length)throw new Error(N);$.pop();continue}$.push(X);let G=S.join(f,...$),p;try{p=await y.lstat(G)}catch(x){if(x.code===q)continue;throw x}if(!p.isSymbolicLink())continue;if(++B>ht)throw new Error(N);let U=await y.readlink(G);$.pop(),g.splice(D+1,0,...I(U,$,N))}}catch(b){if(b.code!==q)return b}};for(let z=0;z<h.length;z+=i){let A=h.slice(z,z+i),P=await Promise.all(A.map(b=>n.add(()=>O(b))));for(let[b,N]of P.entries())if(N!==void 0)throw await y.rm(S.join(m,A[b][0]),{force:!0}),N}},async applyLinks(){let m=(await T).real;for(let{linkTarget:f,outPath:l}of d)try{let u=await y.realpath(S.dirname(f));V(u,m,`Hardlink "${f}" points outside the extraction directory.`);let k=S.join(u,S.basename(f)),[I,O]=await Promise.allSettled([n.add(()=>y.lstat(k)),n.add(()=>y.realpath(S.dirname(l)))]);if(I.status==="rejected")throw I.reason;let z=I.value;if(z.isSymbolicLink())throw new Error(`Hardlink "${f}" is a symlink.`);if(O.status==="rejected")throw O.reason;let A=O.value;V(A,m,`Hardlink "${l}" points outside the extraction directory.`);let P=S.join(A,S.basename(l));try{await y.link(k,P)}catch(N){let F=N.code;if(F!=="EEXIST"&&F!==q)throw N;try{let $=await y.lstat(P);if($.dev===z.dev&&$.ino===z.ino)continue;await y.rm(P,{force:!0})}catch($){if($.code!==q)throw $}await y.link(k,P)}let b=await y.lstat(P);if(b.dev!==z.dev||b.ino!==z.ino)throw await y.rm(P,{force:!0}),new Error(`Hardlink target "${f}" changed during creation for link at "${l}".`)}catch(u){throw u.code===q?new Error(`Hardlink target "${f}" does not exist for link at "${l}".`):u}}}};function vt(e,t={}){let n=Le(t),i=t.concurrency||Ye().length||8,r=mt(i),s,c=wt(e,t,r,i),a=null,d=new Set,h=!1,v=o=>{let m=a.write(o);return m||(h=!0),m},w=o=>{E.destroyed||E.destroy(o)},T=()=>{let o=a;a=null,r.add(()=>o.end()).then(()=>d.delete(o),m=>{d.delete(o),w(m)})},E=new lt({async write(o,m,f){let l,u;try{if(n.write(o),n.isEntryActive()){if(a){for(;!n.isBodyComplete();){h=!1;let k=n.streamBody(v);if(h)await a.waitDrain();else if(k===0)return}if(!n.skipPadding())return;T()}else if(!n.skipEntry())return}for(;;){let k=n.readHeader();if(k==null)return;let I=De(k,t);if(!I){if(!n.skipEntry())return;continue}let O=await r.add(()=>c.preparePath(I));if(s)throw s;if(O){let z=I.mode===void 0?void 0:I.mode&511;for(a=pt(O,{mode:t.fmode??z,mtime:I.mtime??void 0},w),d.add(a),(l??=[]).push(a.waitDrain().catch(A=>A));!n.isBodyComplete();){h=!1;let A=n.streamBody(v);if(h)await a.waitDrain();else if(A===0)return}if(!n.skipPadding())return;T()}else if(!n.skipEntry())return}}catch(k){u=k}finally{let k=l?(await Promise.all(l)).find(I=>I):void 0;f(s??k??u)}},async final(o){try{if(n.end(),n.validateEOF(),a&&T(),await c.ready(),await r.onIdle(),s)throw s;await c.checkSymlinks(),await c.applyLinks(),o()}catch(m){o(m)}},destroy(o,m){let f=d.size>0||E.writableLength>0||E.writableEnded&&!E.writableFinished;if(!o&&!f){m(null);return}s=o??AbortSignal.abort().reason;for(let l of d)l.destroy(s);d.clear(),a=null,m(s)}});return E}export{dt as packTar,xt as packTarSources,vt as unpackTar};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as Q}from"./chunk-FQGQH4KM.mjs";import{a as b,b as J}from"./chunk-TX6JH7TR.mjs";import{a as X,b as _,c as B,i as G}from"./chunk-YXAUQPVK.mjs";import{a as Z,b as ee}from"./chunk-W7CXPCRV.mjs";import{c as V,d as Y,e as T}from"./chunk-B3VTYBYR.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import{b as N,f as A,g as H}from"./chunk-NSKUTQ5J.mjs";import{k as q}from"./chunk-QYKCJ7FG.mjs";import{b as I}from"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import{b as U,g as W}from"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import v from"node:fs/promises";import le from"node:os";import x from"node:path";import{IMPORT_EXT as se,kindOf as re}from"../browser/shared/import-types.mjs";import{reportsDirectory as M}from"../browser/shared/paths.mjs";import{documentDirectory as oe,documentFiles as S}from"../browser/shared/workspace.mjs";var ie=Object.values(se).flat().join(" "),E=m=>{let s=m.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return/[a-z]{3}/.test(s)?s.length<=60?s:s.slice(0,61).replace(/-[^-]*$/,"")||s.slice(0,60):""},j=(m,s)=>`${m} ${s}${m===1?"":"s"}`;function ae(m,s,p){let n=(g,r=s)=>(r.match(g)??[]).length,f=n(/<ol class="doc-flow"/g,p),u=n(/<li id="fn-\d+"/g,p),w=[[n(/<section class="doc-section"/g),"section"],[n(/<h[2-4][\s>]/g),"heading"],[n(/<p[\s>]/g),"paragraph"],[n(/<(?:ul|ol)[\s>]/g),"list"],[n(/<table\b/g),"table"],[n(/class="doc-math-(?:inline|block)"/g,p),"formula"],[n(/<div class="doc-code"/g),"code block"],[n(/<figure class="doc-image"/g),"picture"],[f,"flow"],[u,"footnote"]].filter(([g])=>g>0).map(([g,r])=>j(g,r)),d=(m.raws?.length??0)-f-(u?1:0);return d>0&&w.push(`${j(d,"HTML block")} kept as written`),w}async function Fe(m){let{positional:s,options:p}=A({options:["--no-preview","--no-browser"],argv:m}),[n,f,u]=s;if(s.length<1||s.length>3||!n)throw new N("Name the file; then the slug and the title, if you choose them.");let w=re(n);if(!w)throw new N(`Not a kind of file gallery import takes: ${n} (${ie}).`);f!==void 0&&H(f);let d=x.resolve(n);await v.stat(d).then(a=>a.isFile(),()=>!1)||(console.error(`No such file: ${n}`),process.exit(1));let g=f!==void 0?await Q(f):null;g&&(console.error(g),process.exit(1));let r=x.basename(d),O=await v.mkdtemp(x.join(le.tmpdir(),"gallery-import-")),L,y,R;try{let a,$=[];if(w==="markdown")a=[{...await Y(d,O),from:r,children:[]}];else try{({pages:a,skipped:$}=await V([{file:d,name:r}],O))}catch(e){console.error(`${r} could not be read: ${e.message}`),process.exit(1)}a.length===0&&(console.error(`Nothing in ${r} could be read as a page${$.length?` (not taken: ${$.join(", ")})`:""}.`),process.exit(1)),u?.trim()&&(a[0]={...a[0],title:u.replace(/\s+/g," ").trim()});let C=new Map,D=ee({edits:{},reports:{},reportsDirectory:M});y=(await Z(a,{create:async(e,t,i,{lang:l})=>{let{directory:o}=await I(e,t,i,{blank:!0,lang:l});C.set(e,await v.readFile(S(o).html,"utf8"))},slugOf:(e,t)=>t===0&&f!==void 0?f:D.freeSlug(E(e.title)||E(e.from?.replace(/\.[^.]+$/,"")??"")||E(r.replace(/\.[^.]+$/,""))||"doc"),folderOf:e=>oe(e,M),fill:e=>T(e),place:(e,t)=>D.place(e,t)})).made;let K=[],P=(e,t)=>{K.push({page:e,depth:t});for(let i of e.children??[])P(i,t+1)};for(let e of a)P(e,0);let h=await Promise.all(K.map(async({page:e,depth:t},i)=>{let l=y[i],o=oe(l,M),c=S(o).html,k=await v.readFile(c,"utf8"),te=(await T({source:C.get(l),nodes:e.nodes,icon:e.icon,own:e.own})).replace(/<p>\u{E000}\d+\u{E001}<\/p>/gu,""),ne=W(U(k,{finish:q}).text);return{slug:l,depth:t,page:e,directory:o,htmlFile:c,made:ae(e,te,k),readOnly:ne}}));if(L={slug:y[0]},h.length===1){let[{page:e,directory:t,htmlFile:i,made:l,readOnly:o}]=h;if(console.log(`Created ${b(i)} and ${x.basename(S(t).json)} from ${r}`),console.log(`Title: ${e.title}`),console.log(`Made: ${l.length?l.join(", "):"nothing but the title"}${e.files.length?` (${j(e.files.length,"file")} in ${b(x.join(t,"assets"))})`:""}`),e.notes?.length){console.log(`Not brought as the file has it (${e.notes.length}):`);for(let c of e.notes)console.log(` ${c.line?`line ${c.line}: `:""}${c.text}`)}if(o.length){console.log(`Text the preview leaves read-only (${o.length}), by doc.html's lines as gallery check gives them:`);for(let c of o)console.log(` ${c}`)}}else{console.log(`Created ${j(h.length,"document")} from ${r} (each nested as in the file):`);for(let{slug:i,depth:l,page:o,htmlFile:c,made:k}of h)console.log(`${" ".repeat(l+1)}${i} ${o.title} ${b(c)}`),console.log(`${" ".repeat(l+2)}Made: ${k.length?k.join(", "):"nothing but the title"}${o.files.length?` (${j(o.files.length,"file")} in its assets/)`:""}`);let e=h.flatMap(({slug:i,page:l})=>(l.notes??[]).map(o=>` ${i}: ${o.line?`line ${o.line}: `:""}${o.text}`));e.length&&console.log(`Not brought as the file has it (${e.length}):
|
|
3
|
+
${e.join(`
|
|
4
|
+
`)}`);let t=h.flatMap(({slug:i,readOnly:l})=>l.map(o=>` ${i}: ${o}`));t.length&&console.log(`Text the preview leaves read-only (${t.length}), by doc.html's lines as gallery check gives them:
|
|
5
|
+
${t.join(`
|
|
6
|
+
`)}`)}$.length&&console.log(`Not taken from ${r} (${$.length}): ${$.join(", ")}`);for(let e of await J())console.log(e);R=`edit ${b(h[0].htmlFile)}${h.length>1?" (and the others)":""} into the document as \u5199\u4F5C\u504F\u597D asks.`}finally{await v.rm(O,{recursive:!0,force:!0})}let F=await G(L.slug,{skipped:B(p),command:`gallery import ${r}`});console.log(X(F,R)),console.log(`Hand in: gallery export ${y.join(" ")}, then gallery qa ${y.join(" ")}`);let z=await _(F,p);z&&console.log(z);for(let a of F)console.log(a)}export{Fe as run};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as g}from"./chunk-HYMEEXKN.mjs";import{createRequire as re}from"node:module";import{typescriptFile as ae}from"../browser/shared/paths.mjs";var ce=re(import.meta.url),B=null;function fe(){return B??=ce(ae??"typescript"),B}var $=new Proxy({},{get:(e,n)=>fe()[n]});import _ from"node:fs/promises";import h from"node:path";import{COMPONENTS as D,instancesOf as ue}from"../browser/shared/components/index.mjs";import{PACKAGE_MARK as q}from"../browser/shared/components/installed.mjs";import{MATH_IGNORED_TAGS as pe}from"../browser/shared/components/math.mjs";import{attr as x,elementsOf as b,walk as y}from"../browser/shared/html-tree.mjs";import I from"node:path";import de from"node:vm";var L=()=>{throw new Error("esbuild is not in the release: Gallery 0.1.0 calls it only in a source checkout")},Le=L,J=L;var Te=new Proxy({},{get:L});import{projectRoot as le}from"../browser/shared/paths.mjs";var T=I.join(le,"src","shared","components","index.mjs");function F(e){let{outputFiles:n}=J({stdin:{contents:`import { FLOWS, FLOW_BLOCKS, runtimeDescriptions } from ${JSON.stringify(e)}; module.exports = { descriptions: runtimeDescriptions(), flows: FLOWS, blockFlows: FLOW_BLOCKS };`,resolveDir:I.dirname(e),loader:"js"},bundle:!0,write:!1,format:"cjs",platform:"node",logLevel:"silent"}),s={module:{exports:null}};return de.runInNewContext(n[0].text,s),JSON.parse(JSON.stringify(s.module.exports))}var W=(e=T)=>F(e).descriptions,G=(e=T)=>F(e).flows,U=(e=T)=>F(e).blockFlows;import{kitPublicDirectory as me,projectRoot as H,release as Y,vendorDirectory as z}from"../browser/shared/paths.mjs";var P=h.join(H,"node_modules"),he=h.join(P,"d3","dist","d3.min.js"),S=Y?h.join(z,"katex"):h.join(P,"katex","dist"),xe=h.join(S,"fonts"),He=h.join(S,"contrib","mhchem.min.js"),u=[{id:"styles",file:"report.css",build:{styles:"styles/index.css"},always:!0},{id:"katex-styles",vendor:{path:"/vendor/katex/katex.min.css",source:h.join(S,"katex.min.css")}},{id:"runtime",file:"runtime.js",build:{bundle:"runtime/index.js",options:()=>({minify:!1,define:{__COMPONENT_RUNTIME__:JSON.stringify(W()),__COMPONENT_FLOWS__:JSON.stringify(G()),__COMPONENT_BLOCK_FLOWS__:JSON.stringify(U())}})},api:"DocKit",always:!0},{id:"code",file:"code.js",build:{bundle:"code.js",options:{minify:!0,legalComments:"inline"}},api:"DocCode",after:["runtime"]},{id:"state",file:"state.js",build:{read:"state.js"},api:"DocState",always:!0},{id:"sheets",file:"sheets.js",build:{read:"sheets.js"},api:"DocSheets",after:["runtime","state"]},{id:"tokens",file:"tokens.js",build:{read:"tokens.js"},api:"DocTokens",always:!0},{id:"ui",file:"ui.js",build:{bundle:"ui.js",options:{minify:!1}},added:!0,after:["runtime","state","tokens"]},{id:"dialogs",file:"dialogs.js",build:{read:"dialogs.js"},api:"DocDialogs",after:["runtime"]},{id:"katex",vendor:{path:"/vendor/katex/katex.min.js",source:h.join(S,"katex.min.js")},umd:!0},{id:"katex-auto-render",vendor:{path:"/vendor/katex/auto-render.min.js",source:h.join(S,"contrib","auto-render.min.js")},umd:!0,after:["katex"]},{id:"math",file:"math.js",build:{bundle:"math-bundle.js",options:{minify:!1,legalComments:"inline",alias:{katex:h.join(H,"src","render","kit","page-katex.js")},nodePaths:[h.join(P,"katex")]}},api:"DocMath",after:["runtime","katex-styles","katex","katex-auto-render"]},{id:"d3",vendor:{path:"/vendor/d3.v7.9.0.min.js",source:he},api:"d3",umd:!0},{id:"charts",file:"charts.js",build:{bundle:"charts/index.js",options:{minify:!1}},api:"DocCharts",after:["runtime","tokens"]},{id:"tables",file:"tables.js",build:{bundle:"tables/index.js",options:{minify:!1}},api:"DocTables",after:["runtime"]}],m=e=>e.file?`/kit/${e.file}`:e.vendor.path,ge=e=>e.file?h.join(me,e.file):h.join(z,...e.vendor.path.split("/").slice(2));if(Y)for(let e of u)e.vendor&&(e.vendor.source=ge(e));var O=e=>m(e).endsWith(".css"),E=e=>e.file?"data-doc-kit":"data-doc-vendor",C=e=>u.find(n=>n.id===e),w=(e,n=m(e))=>O(e)?`<link rel="stylesheet" href="${n}" ${E(e)}="${e.id}">`:`<script src="${n}" ${E(e)}="${e.id}"></script>`,we=u.map(e=>({id:e.id,tag:w(e),always:!!e.always,element:O(e)?"style":"script",attribute:E(e)}));function Ye(e,n=m){let s=new Set,i=t=>{s.has(t)||(s.add(t),C(t)?.after?.forEach(i))};return e.forEach(i),u.filter(t=>s.has(t.id)&&!t.always&&!t.added).map(t=>w(t,n(t)))}function ye(e=u,n=D){let s=[],i=e.map(t=>t.id);for(let t of new Set(i.filter((a,o)=>i.indexOf(a)!==o)))s.push(`the asset "${t}" is listed twice`);for(let t of e){!!t.file==!!t.vendor&&s.push(`the asset "${t.id}" is a kit file (file) or a vendor file (vendor), one of them`),t.file&&!["read","bundle","styles"].some(o=>typeof t.build?.[o]=="string")&&s.push(`the kit file "${t.file}" does not say how it is made (build: read, bundle or styles)`),t.vendor&&!(t.vendor.path&&t.vendor.source)&&s.push(`the vendor asset "${t.id}" needs its public path and its source`);for(let o of t.after??[])i.includes(o)?i.indexOf(o)>i.indexOf(t.id)&&s.push(`the asset "${t.id}" loads after "${o}", which the list puts after it`):s.push(`the asset "${t.id}" loads after "${o}", which is no asset`);let a=n.filter(o=>(o.assets??[]).includes(t.id));!t.always&&!t.api&&!t.added&&a.length===0&&s.push(`no report would keep the asset "${t.id}": it is not always kept, defines no global and no component needs it`)}for(let t of n)for(let a of t.assets??[])i.includes(a)||s.push(`the component "${t.id}" needs "${a}", which is no asset`);return s}{let e=ye();if(e.length>0)throw new Error(`src/render/assets.mjs: ${e.join("; ")}`)}var K=/^(?:|module|(?:text|application)\/(?:x-)?(?:javascript|ecmascript)|text\/javascript1\.[0-5]|text\/(?:jscript|livescript))$/,$e=/^application\/(?:\S+\+)?json$/,N=e=>(x(e,"type")??"").trim().toLowerCase();function V(e){let n=$.createSourceFile("report.js",e,$.ScriptTarget.Latest,!1,$.ScriptKind.JS),s=[],i=[n];for(;i.length>0;){let t=i.pop();if(t.kind>=$.SyntaxKind.FirstJSDocNode&&t.kind<=$.SyntaxKind.LastJSDocNode)continue;let a=t.getChildren(n);a.length===0&&s.push(e.slice(t.getStart(n),t.end));for(let o=a.length-1;o>=0;o-=1)i.push(a[o])}return s.join(" ")}var Q=e=>new RegExp(`\\b(?:${e.filter(n=>n.api).map(n=>n.api).join("|")})\\b`);function ke(e,n){let s=[],i=t=>{n.test(t)&&s.push(V(t))};return y(e,t=>{t.tagName==="script"&&x(t,"src")===void 0&&K.test(N(t))&&i(t.childNodes.map(a=>a.value??"").join(""));for(let{name:a,value:o}of t.attrs??[]){if(/^on/.test(a)){i(o);continue}let f=o.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(!/^javascript:/i.test(f))continue;let r=f.slice(11);try{r=decodeURIComponent(r)}catch{}i(r)}}),s.join(`
|
|
3
|
+
`)}function je(e,n){let s=[],i=(o,f)=>{for(let r of o.childNodes??[]){let c=r.sourceCodeLocation;r.nodeName==="#comment"||f&&r.nodeName==="#text"?c&&s.push([c.startOffset,c.endOffset]):r.tagName==="script"?i(r,$e.test(N(r))):r.tagName&&i(r.content??r,f||pe.includes(r.tagName))}};i(e,!1);let t="",a=0;for(let[o,f]of s.sort((r,c)=>r[0]-c[0]))o<a||(t+=`${n.slice(a,o)} `,a=f);return t+n.slice(a)}function R(e,n=u,s=D){let i=n.reduce((c,d)=>c.replaceAll(w(d),""),e),t=g(i),a=je(t,i),o=ke(t,Q(n)),f=new Set,r=c=>{f.has(c)||(f.add(c),(n.find(d=>d.id===c)?.after??[]).forEach(r))};for(let c of s){if(!(c.assets??[]).length)continue;((c.uses??[]).some(l=>l.test(a))||c.match&&ue(t,c).length>0)&&c.assets.forEach(r)}for(let c of n)c.api&&new RegExp(`\\b${c.api}\\b`).test(o)&&r(c.id);return f}function ze(e,n=D){let s=R(e,u,n),i=[];for(let t of u){let a=w(t);if(t.always||t.added||s.has(t.id)||!e.includes(a))continue;let o=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp(`[ \\t]*${o}[ \\t]*\\r?\\n?`),""),i.push(t.id)}return{html:e,removed:i,used:s}}function M(e,n){let s=[];return y(n,i=>{let t=Z(i),a=t===void 0?void 0:u.find(f=>m(f)===t.trim()),o=i.sourceCodeLocation;!a||!o||s.push({asset:a,start:o.startOffset,end:o.endOffset,line:o.startLine,exact:e.slice(o.startOffset,o.endOffset)===w(a)})},{inTemplates:!1}),s}var X=e=>e.tagName==="style"||e.tagName==="link"&&(x(e,"rel")??"").toLowerCase().split(/\s+/).includes("stylesheet"),Z=e=>e.tagName==="script"?x(e,"src"):X(e)?x(e,"href"):void 0,j=e=>!!e.sourceCodeLocation,A=e=>e.includes(`\r
|
|
4
|
+
`)?`\r
|
|
5
|
+
`:`
|
|
6
|
+
`;function k(e,n,{closing:s=!1}={}){let i=n===0?0:e.lastIndexOf(`
|
|
7
|
+
`,n-1)+1,t=e.slice(i,n);if(!/^[ \t]*$/.test(t))return{at:n,text:o=>o};let a=s?`${t} `:t;return{at:i,text:o=>`${a}${o}${A(e)}`}}function v(e,n){let s=/^[ \t]*/.exec(e.slice(e.lastIndexOf(`
|
|
8
|
+
`,n-1)+1))[0];return{at:n,text:i=>`${A(e)}${s}${i}`}}function ee(e){let n;return y(e,s=>{!n&&s.tagName==="main"&&(n=s)},{inTemplates:!1}),n}var Oe="http://www.w3.org/1999/xhtml";function be(e){let n=e;for(let s=e.parentNode;s?.tagName;s=s.parentNode)s.namespaceURI!==Oe&&(n=s);return n}function te(e,n,s){let i=b(n).find(o=>o.tagName==="html"),t=b(i??{}).find(o=>o.tagName==="head"),a=b(i??{}).find(o=>o.tagName==="body");if(s){let o=b(t??{}).filter(j),f=o.find(X);if(f)return k(e,f.sourceCodeLocation.startOffset);if(t?.sourceCodeLocation?.endTag)return k(e,t.sourceCodeLocation.endTag.startOffset,{closing:!0});if(o.length>0)return v(e,o.at(-1).sourceCodeLocation.endOffset);if(t?.sourceCodeLocation)return v(e,t.sourceCodeLocation.startTag.endOffset);let r=a?.sourceCodeLocation?.startTag?.startOffset??b(a??{}).find(j)?.sourceCodeLocation.startOffset;if(r!==void 0)return k(e,r)}else{let o=ee(n),f=d=>{for(let l=d.parentNode;l;l=l.parentNode)if(l===o)return!1;return!o?.sourceCodeLocation||d.sourceCodeLocation.startOffset>o.sourceCodeLocation.startOffset},r;if(y(a??{},d=>{!r&&d.tagName==="script"&&j(d)&&K.test(N(d))&&f(d)&&(r=d)},{inTemplates:!1}),r)return k(e,be(r).sourceCodeLocation.startOffset);let c=a?.sourceCodeLocation?.endTag??i?.sourceCodeLocation?.endTag;if(c)return k(e,c.startOffset,{closing:!0})}return{at:e.length,text:o=>`${A(e)}${o}`}}function oe(e,n,{free:s}){let i=M(e,n),t=new Map;for(let a of[!0,!1]){let o=u.filter(d=>O(d)===a),f=d=>i.find(l=>l.asset===d),r=o.map(f).find(Boolean),c=r?k(e,r.start):s?te(e,n,a):null;for(let d of o){let l=f(d);l?(t.set(d.id,{at:l.start,written:l}),c=v(e,l.end)):c&&t.set(d.id,c)}}return t}function ne(e,n,{tree:s=g(e),free:i,href:t=m}){let a=[];for(let[r,c]of oe(e,s,{free:i})){let d=C(r);c.written?c.written.exact&&t(d)!==m(d)&&a.push({at:c.written.start,end:c.written.end,text:w(d,t(d))}):n.has(r)&&a.push({at:c.at,end:c.at,text:c.text(w(d,t(d)))})}if(a.length===0)return e;a.sort((r,c)=>r.at-c.at);let o="",f=0;for(let{at:r,end:c,text:d}of a)o+=e.slice(f,r)+d,f=c;return o+e.slice(f)}function Ve(e,{used:n=R(e),href:s=m}={}){let i=g(e),t=x(ee(i)??{},"data-doc-id")!==void 0,a=new Set(u.filter(o=>o.always||n.has(o.id)||o.added&&t).map(o=>o.id));return ne(e,a,{tree:i,free:!0,href:s})}function Qe(e){let n=R(e);return ne(e,new Set(u.filter(s=>!s.always&&!s.added&&n.has(s.id)).map(s=>s.id)),{free:!1})}function Xe(e,{styles:n,scripts:s}){let i=g(e),t=[];y(i,r=>{let c=u.find(d=>m(d)===Z(r)?.trim().split("?")[0]);c&&j(r)&&t.push({style:O(c),end:r.sourceCodeLocation.endOffset})},{inTemplates:!1});let a=[[!0,n],[!1,s]].filter(([,r])=>r.length>0).map(([r,c])=>{let d=t.filter(p=>p.style===r).at(-1),l=d?v(e,d.end):te(e,i,r);return{at:l.at,text:c.map(l.text).join("")}}),o="",f=0;for(let{at:r,text:c}of a.sort((d,l)=>d.at-l.at))o+=e.slice(f,r)+c,f=r;return o+e.slice(f)}function Ze(e,n=g(e)){let s=[],i=[];if(y(n,o=>{let f=["data-doc-kit","data-doc-vendor"].find(r=>x(o,r)?.endsWith("-inline"))??(x(o,q)===void 0?void 0:q);f&&j(o)&&i.push({line:o.sourceCodeLocation.startLine,mark:`${f}="${x(o,f)}"`})},{inTemplates:!1}),i.length>0){let o=i.length>1?`, and ${i.length-1} more on line${i.length>2?"s":""} ${se(i.slice(1).map(({line:f})=>f))}`:"";s.push(`line ${i[0].line}: an export's inline copy of the kit (${i[0].mark}${o}), which a document's source never holds (the kit's tags are put in as the document is shown, so it would load twice): bring an exported file in with \u5BFC\u5165 instead of copying it in`)}let t=M(e,n);for(let{asset:o,line:f,exact:r}of t)r||s.push(`line ${f}: ${m(o)} is not loaded by the kit's own tag, ${w(o)}: take the tag out (the kit's tags are put in as the document is shown and exported)`);for(let o of u){let f=t.filter(r=>r.asset===o).map(r=>r.line);f.length>1&&s.push(`${m(o)} is loaded ${f.length} times (lines ${f.join(", ")}): keep one tag, or none`)}let a=o=>t.find(f=>f.asset===o);for(let o of u){let f=a(o);if(f)for(let r of o.after??[]){let c=a(C(r));c&&c.start>f.start&&s.push(`line ${f.line}: ${m(c.asset)} (line ${c.line}) must load before ${m(o)}`)}}return[...new Set(s)]}var se=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`:e[0];function et(e,n=g(e)){let s=Q(u),i=[],t;return y(n,a=>{if(a.tagName!=="script"||x(a,"src")!==void 0||!j(a)||N(a)==="module"||!K.test(N(a)))return;let o=a.childNodes.map(p=>p.value??"").join("");if(!s.test(o))return;let f=V(o);t??=oe(e,n,{free:!0});let{startOffset:r,startLine:c}=a.sourceCodeLocation,d=u.filter(p=>p.api&&new RegExp(`\\b${p.api}\\b`).test(f)&&t.get(p.id).at>r),l=d.filter(p=>!t.get(p.id).written);l.length>0&&i.push(`line ${c}: this script names ${se(l.map(p=>p.api))} before the kit's scripts load (they are put in after </main>): move the script after </main>`);for(let p of d.filter(ie=>t.get(ie.id).written))i.push(`line ${c}: this script names ${p.api} before ${m(p)} loads (line ${t.get(p.id).written.line}): move the script after that tag`)},{inTemplates:!1}),i}function tt(e,n){let s=new Set,i="",t=0;for(let{asset:a,start:o,end:f,exact:r}of M(e,g(e)))!r||s.has(a.id)||(s.add(a.id),i+=e.slice(t,o)+n(we.find(c=>c.id===a.id)),t=f);return i+e.slice(t)}var ot=new Set(u.filter(e=>!O(e)).map(m)),nt=new Set(u.filter(O).map(m));async function Se({inlineFonts:e=!1}={}){let n=await _.readFile(C("katex-styles").vendor.source,"utf8");if(n=n.replace(/src:url\((fonts\/[^)]+\.woff2)\) format\("woff2"\),url\(fonts\/[^)]+\.woff\) format\("woff"\),url\(fonts\/[^)]+\.ttf\) format\("truetype"\)/g,'src:url($1) format("woff2")'),!e)return n;let s=[...new Set([...n.matchAll(/url\(fonts\/([^)]+\.woff2)\)/g)].map(i=>i[1]))];for(let i of s){let t=await _.readFile(h.join(xe,i));n=n.replaceAll(`url(fonts/${i})`,`url(data:font/woff2;base64,${t.toString("base64")})`)}return n}function st(e,{inline:n=!1}={}){return e.id==="katex-styles"?Se({inlineFonts:n}):_.readFile(e.vendor.source,"utf8")}export{$ as a,Le as b,xe as c,He as d,u as e,m as f,ge as g,Ye as h,ze as i,Ve as j,Qe as k,Xe as l,Ze as m,et as n,tt as o,ot as p,nt as q,st as r};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as d,b as u}from"./chunk-TX6JH7TR.mjs";import{f as g,h as f}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import p from"node:fs/promises";import{fullAddress as S,namedPlace as k}from"../browser/shared/page-address.mjs";import{reportsDirectory as h}from"../browser/shared/paths.mjs";import{documentLinks as D,listReportSlugs as F,roleOf as N}from"../browser/shared/reports.mjs";import{documentDirectory as j,documentFiles as M,isSlugName as b}from"../browser/shared/workspace.mjs";import{rankReports as A}from"../browser/shared/search.mjs";async function L(){let l=(await F(h)).filter(b);return(await Promise.all(l.map(async e=>{let n=j(e,h),{html:i,json:r}=M(n),s=await p.stat(i).catch(()=>null);if(!s?.isFile()||await N(n)==="instructions")return null;let a=await p.readFile(r,"utf8").then(JSON.parse).catch(()=>({})),c=t=>typeof t=="string"?t.replace(/\s+/g," ").trim():"";return{slug:e,title:c(a.title)||e,description:c(a.description),edited:s.mtimeMs,file:i}}))).filter(Boolean)}var O=l=>{let o=new Date(l),e=n=>String(n).padStart(2,"0");return`${o.getFullYear()}-${e(o.getMonth()+1)}-${e(o.getDate())} ${e(o.getHours())}:${e(o.getMinutes())}`};async function q(l){let{positional:o}=g({argv:l}),e=o.join(" ").trim(),n=await L(),{links:i}=await D(),r=o.length===1?k(o[0],i):null,s=r&&r.slug!==o[0]?n.filter(({slug:t})=>t===r.slug):A(n,e),a=o.length===1&&s.length===0?await f(o[0]):null;for(let t of await u())console.log(t);let c=t=>`${t} document${t===1?"":"s"}`;if(a)console.log(a);else if(n.length===0)console.log('No documents yet: gallery new <slug> "<title>" makes one.');else if(s.length===0)console.log(`No document's title, description or slug holds ${e.split(/\s+/).map(t=>`"${t}"`).join(" or ")}: gallery list lists all ${n.length}.`);else{console.log(e?`${s.length} of ${c(n.length)}, the best match first:`:`${c(n.length)}, the one edited last first:`);for(let{slug:t,title:$,description:m,edited:w,file:y}of s)console.log(`${t} ${$}`),m&&console.log(` \u8BF4\u660E\uFF1A${m}`),console.log(` \u5730\u5740\uFF1A${S("",{slug:t},i)}`),console.log(` \u4E0A\u6B21\u7F16\u8F91\uFF1A${O(w)}`),console.log(` ${d(y)}`)}}export{q as run};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{B as Je,D as Qe,E as me,F as Et,I as Xe,J as tn,a as pe,e as Fe,f as Ee,g as Re,h as wt,i as he,j as Oe,k as Xt,l as Rt,m as De,n as Ve,o as At,p as Ne,q as Ge,r as $e,s as gt,t as Y,u as Le,v as Ye,w as We,x as Me,y as W,z as Ze}from"./chunk-NFIBI4IP.mjs";import{d as Tt}from"./chunk-W63L7367.mjs";import{b as ue,c as de,e as Ae}from"./chunk-A55HN5OK.mjs";import{BLOCK_TYPES as ve,COPIED_AS_ITSELF as zn,IDENTITY as gn}from"../browser/editor/components/registry.mjs";import{copyKeys as Un}from"../browser/editor/components/figure/index.mjs";import{accepts as ye,attributeValue as An,BLOCK_TYPES as Dt,boxRole as be,CHAPTER as En,holdsStraight as On,IDENTITY as Pe,isLead as rn,SIZES as Nn,sizeValue as ln,TOGGLES as an}from"../browser/editor/components/registry.mjs";import{iconMarkup as $n,iconValueOf as Ln,validIcon as Mn}from"../browser/editor/components/icon/index.mjs";Ae();import{attributeValue as bn,BLOCK_TYPES as en,HOSTS as xn,TOGGLES as wn}from"../browser/editor/components/registry.mjs";import{texSource as nn}from"../browser/editor/components/math/index.mjs";var je=new Set(Object.entries(en).filter(([,s])=>!s.box&&!s.bare).map(([s])=>s)),te=(s,m,w="")=>{let g=W[m.type]?.leaf;if(g)return g(s,m,w);let k=[s.className,...m.classes??[]].filter(Boolean).join(" ");return`<${s.tag}${k?` class="${k}"`:""}${he(m.attributes)}${w}>${m.html}</${s.tag}>`},Ce=(s,m)=>s===void 0||!!s&&typeof s=="object"&&!Array.isArray(s)&&Object.entries(s).every(([w,g])=>typeof g=="string"&&bn(m,w,g)),Te=s=>s?.empty===!0,Be=(s,m)=>s===void 0?null:w=>s.includes(m.slice(w.startOffset,w.endOffset));function ke(s,m,{empty:w=!1,file:g}={}){if(typeof m!="string"||!m.trim()&&!(w&&m===""))return!1;if(m==="")return!0;if(s.tex&&!nn(m))return!1;let k=s.inside??s.tag,O=`<${k}>${m}</${k}>`,[I,...a]=de(O,{sourceCodeLocationInfo:!0}).childNodes;return a.length===0&&I?.tagName===k&&me(I,[],s.inside!==void 0,{lists:k==="td"||k==="th",known:Be(g,O)})===null}var vn=new Set(Object.values(en).filter(s=>s.text&&s.className).map(s=>s.kind));function qe(s,m){if(s.keep?.reason==="script")return null;if(s.kind==="list")return m.some(g=>g.unit===s.id&&g.kind==="list")?"list":null;let w=W[s.kind];return w?.written?w.written(s)?"written":null:s.text===void 0||s.nested?null:["p","h1","h2","h3","h4","li"].includes(s.tag)||vn.has(s.kind)?"text":null}function ge(s,m,w){if(!Array.isArray(m)||!m.every(k=>Sn(s,k,w)))return"invalid";let g=m.filter(k=>k.keep);return g.length>1?"invalid":m.length>g.length&&!s.caps.split||g.length===0&&!s.caps.remove||m.length===0&&s.nested?"fixed":g.length===1&&g[0].html.trim()===""&&!s.caps.empty?"empty":null}function sn(s,m,w){let g=`<table><tbody><tr><${s}>${m}</${s}></tr></tbody></table>`,[k,...O]=de(g,{sourceCodeLocationInfo:!0}).childNodes,I=O.length===0&&k?.tagName==="table"&&k.childNodes.length===1?k.childNodes[0]:null,a=I?.childNodes.length===1?I.childNodes[0]:null,p=a?.childNodes.length===1?a.childNodes[0]:null;return p?.tagName===s&&me(p,[],!1,{lists:!0,known:Be(w,g)})===null}var on={p:"paragraph",h1:"heading",h2:"heading",h3:"heading",h4:"heading",li:"item"},In=(s,m)=>s.classes===void 0||!s.keep&&Array.isArray(s.classes)&&new Set(s.classes).size===s.classes.length&&s.classes.every(w=>(wn[on[m]]??[]).includes(w));function Sn(s,m,w){if(!m||typeof m.html!="string"||xn[s.kind]?.tex&&!nn(m.html))return!1;let g=m.keep?s.tag:m.tag;if(!m.keep&&Je[s.tag]!==g||!In(m,g)||m.attributes!==void 0&&(m.keep||!Ce(m.attributes,on[g])))return!1;let k=g==="td"||g==="th",O=k?`<table><tbody><tr><${g}>${m.html}</${g}></tr></tbody></table>`:`<${g}>${m.html}</${g}>`,[I,...a]=de(O,{sourceCodeLocationInfo:!0}).childNodes;if(a.length>0||!I)return!1;let p=I;if(k){let h=I.tagName==="table"&&I.childNodes.length===1?I.childNodes[0]:null,u=h?.childNodes.length===1?h.childNodes[0]:null;p=u?.childNodes.length===1?u.childNodes[0]:null}return p?.tagName===g&&me(p,[],Qe(s.kind,s.tag,s.caps),{lists:k,known:Be(w,O)})===null}import{attr as cn}from"../browser/shared/html-tree.mjs";import{pageLanguage as jn}from"../browser/shared/components/page.mjs";import{SHEETS as Cn}from"../browser/editor/components/kit.mjs";import{BLOCK_ID as Tn}from"../browser/shared/ids.mjs";function fn({current:s,edits:m,units:w=[],partial:g=!1,ids:k=!1,touch:O=[],proposals:I=null}){let a=Et(s),p=a.blocks,h=s.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,u=[],$=[],j=[],K=new Map,q=null,Z,yt=!1,J=(t,n)=>u.push({unit:t.id,reason:n}),X=t=>{let r=Rt(t).replace(/[0-9.]/g,l=>String.fromCharCode(l.charCodeAt(0)-65248)).replace(/[\s,,]/g,"").replace(/[−–]/g,"-").match(/-?\d+(?:\.\d+)?/)?.[0];return r===void 0?null:Number(r)},ct=(t,n,r)=>{if(t.kind!=="cell")return;let l=s.slice(t.start,t.innerStart),c=/\sdata-sort-value(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/.exec(l);if(!c)return;let d=(c[1]??c[2]??c[3]??"").trim(),x=/^-?\d+(\.\d+)?(e[-+]?\d+)?$/i.test(d)?Number(d):null,[S,f]=[X(s.slice(t.innerStart,t.innerEnd)),X(n)],b="";x!==null&&f!==null?b=` data-sort-value="${Number((f*(S?x/S:1)).toPrecision(12))}"`:x!==null&&S===null&&(b=c[0]),b!==c[0]&&$.push({start:t.start+c.index,end:t.start+c.index+c[0].length,text:b,of:[{id:r}]})},Vt=t=>{t.keep&&e(t)?J(t,"referenced"):j.push({start:t.start,end:t.end},...t.companion?[t.companion]:[])},ne=(t,n)=>{let r=t.classAttr,l=r?r.value.split(/\s+/).filter(Boolean):[],c=l;for(let[x,S]of n)c=S?c.includes(x)?c:[...c,x]:c.filter(f=>f!==x);if(c.join(" ")===l.join(" "))return;if(at(t),!r){let x=/^<[A-Za-z][\w-]*/.exec(s.slice(t.elStart,t.elStart+40));if(!x)return J(t,"unknown");let S=t.elStart+x[0].length;$.push({start:S,end:S,text:` class="${c.join(" ")}"`});return}if(c.length===0){$.push({...Xt(s,r.start,r.end),text:""});return}let d=/=\s*'/.test(s.slice(r.start,r.end))?"'":'"';$.push({start:r.start,end:r.end,text:`class=${d}${c.join(" ")}${d}`})},vt=typeof k=="function"?k:k?Xe:null,rt=new Set([...s.matchAll(tn)].map(t=>t[1]??t[2])),Bt=()=>{for(;;){let t=vt();if(!rt.has(t))return rt.add(t)&&t}},se=[],qt=[],Gt=t=>t?` ${Pe}="${t}"`:"",ie=t=>typeof t=="string"&&Tn.test(t)&&!rt.has(t),lt=(t,n)=>{let r=vt?ie(n)?(rt.add(n),n):Bt():null;return r&&t!==void 0&&qt.push({key:t,id:r}),Gt(r)},et=new Set,Pt=t=>{et.add(t.at);let n=I?.get(t.id),r=vt?ie(n)?(rt.add(n),n):Bt():null;return r&&se.push({at:t.at,id:r}),Gt(r)},at=t=>{if(!vt||!t||t.blockId||t.at===void 0||et.has(t.at))return;let n=Oe(s,t.at);$.push({start:n,end:n,text:Pt(t)})},Ot=t=>{let{element:n,source:r}=At(t.restore),l=n.sourceCodeLocation,c=cn(n,Pe);if(c&&!rt.has(c))return rt.add(c),t.key!==void 0&&qt.push({key:t.key,id:c}),r;let d=r,x=l.startTag.endOffset-1;if(c){let S=l.attrs[Pe],f=Xt(d,S.startOffset,S.endOffset);d=d.slice(0,f.start)+d.slice(f.end),x-=f.end-f.start}return x=Oe(d,x),d.slice(0,x)+lt(t.key,t.blockId)+d.slice(x)},pt=t=>{let n=null;for(let r of a.units)r.elStart<=t.start&&t.start<r.end&&(!n||r.elStart>n.elStart)&&(n=r);return n},P=new Set;for(let t of m){let{id:n,parts:r}=t??{},l=Number.isInteger(n)?p[n]:void 0;if(!l){u.push({id:n,reason:"unknown"});continue}if(Array.isArray(r)&&r.length===0&&l.self!==null&&a.units[l.self].keep){u.push({id:n,reason:"referenced"});continue}let c=ge(l,r,s);if(c){u.push({id:n,reason:c});continue}if(r.length===0){let N={...Le(s,l.start,l.end),of:[{id:n}]};$.push(N),K.set(n,N),l.self!==null&&P.add(l.self);continue}let d=Y(s,l.start),x=d===null?"":h+d,S=N=>`<${N.tag}${N.classes?` class="${N.classes.join(" ")}"`:""}${he(N.attributes)}${lt(N.key,N.blockId)}>${N.html}</${N.tag}>`,f=r.findIndex(N=>N.keep),b=pt(l),v=b&&b.at===l.innerStart-1;if((!v||l.tag==="li")&&at(b),l.tag==="li"&&f>=0){let N=r.slice(0,f),H=r.slice(f+1),z=b?{start:b.start,end:b.end}:null;$.push({start:l.innerStart,end:l.innerEnd,text:r[f].html,of:[{id:n}]}),N.length>0&&$.push({start:l.start,end:l.start,seq:1/0,text:N.map(S).join(x)+x,edge:z,of:[{id:n}]}),H.length>0&&$.push({start:l.end,end:l.end,text:x+H.map(S).join(x),edge:z,of:[{id:n}]})}else{let N=s.slice(l.start,l.innerStart);if(v&&vt&&!b.blockId&&!et.has(b.at)&&(N=`${N.slice(0,-1)}${Pt(b)}>`),r.length===1&&f===0&&N===s.slice(l.start,l.innerStart)){$.push({start:l.innerStart,end:l.innerEnd,text:r[0].html,of:[{id:n}]}),ct(l,r[0].html,n),l.kind==="title"&&(q={from:Rt(s.slice(l.innerStart,l.innerEnd)),to:Rt(r[0].html)});continue}let H=r.map(z=>z.keep?N+z.html+s.slice(l.innerEnd,l.end):S(z)).join(x);$.push({start:l.start,end:l.end,text:H,of:[{id:n}]})}l.kind==="title"&&(q={from:Rt(s.slice(l.innerStart,l.innerEnd)),to:Rt(r[0].html)})}let G=(t,n,r)=>{let l=a.units.filter(f=>f.box===t),c=[];for(let f=1;f<l.length;f++){let b=s.slice(l[f-1].end,l[f].start);b.trim()||c.push({pair:[l[f-1],l[f]],gap:b})}let d=c.find(({pair:f})=>f.includes(n))??c[0];if(d)return d.gap.replace(/\r?\n/g,h);let x=Y(s,r.start),S=be(a.boxes[t]?.kind)==="root"?h:"";return x===null?"":S+h+x},Yt=t=>{if(t.kind!=="nest"||Y(s,t.innerEnd)!==null)return null;let n=a.units[t.unit];return n?Y(s,n.elStart):null},Wt=(t,n)=>{let r=s.slice(t.at+1,t.innerEnd).match(/\n([ \t]*)\S/);return r?r[1]:`${n??""} `},zt=(t,n)=>n!==null&&be(t.kind)==="root",ft=[],Zt=(t,n,r,l)=>{let c=Number.isInteger(n?.into)?a.boxes[n.into]:null,d=Number.isInteger(n?.after),x=c?null:a.units[d?n.after:n?.before],S=c??(x?a.boxes[x.box]:null),f=H=>H>=t.start&&H<t.end;if(!S||!(ye(S.kind,Jt(t))||l===S.kind)||t.kind==="tab"&&S.id!==t.box||x&&(x===t||!r.has(x.id)||f(x.elStart))||c&&f(S.at))return J(t,"position");let b=Y(s,t.start);if(at(t),c){if(c.innerEnd===null)return J(t,"missing");let H=Yt(c);if(H!==null){ft.push({start:t.start,end:t.end,at:c.innerEnd,seq:o++,from:b,to:H+nt,wrap:_=>h+H+nt+_+h+H});return}let z=Y(s,c.innerEnd),ot=Wt(c,z),B=z!==null&&ot.startsWith(z)?ot.slice(z.length):" ",U=zt(c,z);ft.push({start:t.start,end:t.end,at:U?c.innerEnd-z.length:c.innerEnd,seq:o++,from:b,to:ot,wrap:_=>z===null?_:U?z+B+_+h:B+_+h+z});return}let v=G(x.box,x,x),N=d?v.includes(`
|
|
6
|
+
`)?v.slice(v.lastIndexOf(`
|
|
7
|
+
`)+1):null:Y(s,x.start);ft.push({start:t.start,end:t.end,at:d?x.end:x.start,seq:o++,from:b,to:N,wrap:H=>d?v+H:H+v})},ht=(t,n)=>t.classes===void 0||Array.isArray(t.classes)&&new Set(t.classes).size===t.classes.length&&t.classes.every(r=>(an[n.kind]??[]).includes(r)),Ut=(t,n)=>!Ze(t)&&(W[t.type]?.check?.(t)??!0)&&ht(t,n)&&Ce(t.attributes,n.kind),_t=(t,n,r={})=>ke(t,n,{...r,file:s}),Ht=(t,n)=>{if(it.has(t.id))return;let r=Dt[n?.type],l=qe(t,a.boxes);if(!(l==="text"||l==="written"&&r?.kind!==t.kind)||!je.has(n?.type)||!ke(r,n.html,{empty:Te(r),file:s}))return J(t,"invalid");if(!dt.has(t.id)&&!mt.has(t.id)&&!ye(a.boxes[t.box].kind,r.kind))return J(t,"position");if(!Ut(n,r))return J(t,"invalid");let c=t.blockId?Gt(t.blockId):Pt(t);et.add(t.at);let d=l==="written"&&t.node?Fe(s,t.node,W[t.kind].attribute):t.carried;$.push({start:t.elStart,end:t.end,text:te(r,n,d+c)})},oe=(t,n)=>{if(it.has(t.id))return;let r=W[t.kind]?.rewrite;if(!r)return J(t,"invalid");let l=r(s,t.node,n,{validCell:(c,d)=>sn(c,d,s),get packages(){return Tt().packages}});if(!l)return J(t,"invalid");at(t),$.push(...[l].flat())},re=(t,n)=>{if(qe(t,a.boxes)!=="list"||n!=="ul"&&n!=="ol")return J(t,"invalid");let r=/^<(ul|ol)\b/i.exec(s.slice(t.elStart,t.elStart+3)),l=/<\/(ul|ol)\s*>$/i.exec(s.slice(t.elStart,t.end));if(!r||!l)return J(t,"unknown");if(r[1].toLowerCase()===n)return;at(t);let c=t.end-l[0].length+2;$.push({start:t.elStart+1,end:t.elStart+3,text:n},{start:c,end:c+2,text:n})},Kt=new Set([...s.matchAll(/\sid\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi)].map(t=>t[1]??t[2]??t[3])),Nt=new Map,$t=new Set,nt=/\n(\t|[ ]+)</.exec(s)?.[1]??" ",bt=(t,n)=>{let r=d=>ye(n,d)||t?.stood===n;if(t?.restore!==void 0){let d=At(t.restore),x=d?.kind==="item"?Ee(d.element,n):d?.kind;if(!d||!r(x))return!1;if(t.children===void 0)return!0;let S=Dt[t.type];return On(S)&&S.kind===x&&t.children.every(f=>bt(f,S.box))}if(t?.unit!==void 0){let d=Number.isInteger(t.unit)?a.units[t.unit]:void 0;return!d||$t.has(d.id)||it.has(d.id)||dt.has(d.id)||P.has(d.id)||d.kind==="tab"||!r(Jt(d))?!1:($t.add(d.id),!0)}let l=Dt[t?.type];if(!l||!r(l.kind))return!1;if(t.type==="divider")return!0;if(t.type==="icon")return Mn(t.icon);let c=W[t.type];return l.bare&&c?.check?c.check(t,{validLeaf:_t,usedIds:Kt})&&ht(t,l):l.box?!Array.isArray(t.children)||t.children.length===0&&!c?.empty||!ht(t,l)||c?.check&&!c.check(t,{validLeaf:_t,usedIds:Kt})?!1:t.children.every(d=>bt(d,l.box)):!je.has(t.type)||!ke(l,t.html,{empty:Te(l),file:s})||!Ut(t,l)?!1:t.children===void 0?!0:Array.isArray(t.children)&&c?.children?.(t,bt)===!0},Q=(t,n)=>{if(t.unit!==void 0){let b=Nt.get(t.unit);return gt(F(b),b.from,n)}if(t.restore!==void 0&&t.children===void 0)return gt(Ot(t),"",n);let r=Dt[t.type];if(t.type==="divider")return`<hr${lt(t.key,t.blockId)}>`;if(t.type==="icon")return $n(t.icon,lt(t.key,t.blockId));let l=n===null?null:n+nt,c=(b,v,N,H=n,z=l)=>z===null?b+v.join("")+N:b+v.map(ot=>h+z+ot).join("")+h+H+N,d=b=>t.children.map(v=>Q(v,b));if(t.restore!==void 0){let b=Ot(t),{element:v}=At(b),{startTag:N,endTag:H}=v.sourceCodeLocation,z=v.childNodes.findLastIndex(B=>B.tagName),ot=v.childNodes.slice(z+1).filter(B=>B.nodeName==="#comment").map(({sourceCodeLocation:{startOffset:B,endOffset:U}})=>gt(b.slice(B,U),Y(b,B),l));return c(gt(b.slice(0,N.endOffset),"",n),[...d(l),...ot],H?b.slice(H.startOffset):`</${r.tag}>`)}let x={get id(){return lt(t.key,t.blockId)},get language(){return jn(s)},idOf:b=>lt(b.key,b.blockId),render:(b,v)=>Q(b,v),indent:n,inner:l,step:nt,block:c,children:d,deep:b=>n===null?null:n+nt.repeat(b)},S=W[t.type]?.write;if(r.bare&&S)return S(t,x);if(!r.box)return t.children?S(t,x):te(r,t,lt(t.key,t.blockId));if(S)return S(t,x);let f=[r.className,...t.classes??[]].filter(Boolean).join(" ");return c(`<${r.tag}${f?` class="${f}"`:""}${lt(t.key,t.blockId)}>`,d(l),`</${r.tag}>`)},st=[],le=t=>{let{insert:n,place:r}=t,l=B=>u.push({unit:t.id,reason:B}),c=n?.restore!==void 0?At(n.restore):null;if(n?.type==="icon"||c?.kind==="icon"){let B=Number.isInteger(r?.into)?a.boxes[r.into]:null,U=B?null:a.units[Number.isInteger(r?.after)?r.after:r?.before],_=B??(U?a.boxes[U.box]:null);if(rn(_?.kind,"icon")){if(!bt(n,_.kind))return l("invalid");if(_.innerEnd===null)return l("missing");let kt=a.units.find(Ke=>Ke.box===_.id&&Ke.kind!=="icon"),Qt=kt?kt.start:_.innerEnd,Ct=Y(s,Qt);st.push({at:Qt,seq:o++,text:()=>Q(n,Ct)+(Ct===null?"":h+Ct)});return}if(!bt(n,"header"))return l("invalid");let tt=p.find(kt=>kt.kind==="title");if(!tt)return l("missing");let xt=Y(s,tt.start);st.push({at:tt.start,seq:o++,text:()=>Q(n,xt)+(xt===null?"":h+xt)}),Z=c?Ln(c.source):n.icon;return}if(n?.type==="tab"||c?.kind==="tab")return Lt(t,c,l);let d=Number.isInteger(r?.into)?a.boxes[r.into]:null,x=Number.isInteger(r?.after),S=d?null:a.units[x?r.after:r?.before],f=d??(S?a.boxes[S.box]:null),b=n?.restore!==void 0?At(n.restore):null,v=b?f&&b.kind==="item"?Ee(b.element,f.kind):b.kind:Dt[n?.type]?.kind;if(!f||!v||!(ye(f.kind,v)||n.stood===f.kind)||S&&!jt.has(S.id))return l("position");let N=new Set($t);if(!bt(n,f.kind))return l("invalid");for(let B of $t){if(N.has(B))continue;let U=a.units[B];at(U);let _={start:U.start,end:U.end,at:null,from:Y(s,U.start)};Nt.set(B,_),ft.push(_)}if(d){if(d.innerEnd===null)return l("missing");let B=Yt(d);if(B!==null){st.push({at:d.innerEnd,seq:o++,text:()=>h+B+nt+Q(n,B+nt)+h+B});return}let U=Y(s,d.innerEnd),_=Wt(d,U),tt=U!==null&&_.startsWith(U)?_.slice(U.length):nt,xt=a.units.filter(Ct=>Ct.box===d.id),kt=be(d.kind)==="root"&&En.has(v)&&(xt.some(Ct=>jt.has(Ct.id))||!d.pure&&(xt.length>0||n.restore!==void 0))?h:"",Qt=zt(d,U);st.push({at:Qt?d.innerEnd-U.length:d.innerEnd,seq:o++,text:()=>U===null?Q(n,null):Qt?kt+U+tt+Q(n,_)+h:tt+Q(n,_)+h+U});return}let H=x?S.end:S.start;if(be(f.kind)==="root"){let B=G(S.box,S,S),U=x?B.includes(`
|
|
8
|
+
`)?B.slice(B.lastIndexOf(`
|
|
9
|
+
`)+1):null:Y(s,S.start);st.push({at:H,seq:o++,text:()=>x?B+Q(n,U):Q(n,U)+B});return}let z=Y(s,S.start),ot=z===null?"":h+z;st.push({at:H,seq:o++,text:()=>x?ot+Q(n,z):Q(n,z)+ot})},Lt=({insert:t,place:n},r,l)=>{let c=Number.isInteger(n?.after),d=a.units[c?n.after:n?.before];if(d?.kind!=="tab"||!jt.has(d.id))return l("position");if(!bt(t,"tabs"))return l("invalid");let x=d.companion,S=a.units[d.parent??-1];if(!x||!S)return l("missing");let f=r?cn(r.element,Cn.tabKey):t.sheet,b=s.slice(S.start,S.end);if(b.includes(`data-sheet-tab="${f}"`)||b.includes(`data-doc-sheet="${f}"`))return l("invalid");let v=Y(s,d.start),N=Y(s,x.start),H=(_,tt)=>_===null?tt:c?h+_+tt:tt+h+_,z=()=>r?gt(Ot(t),"",v):We({...t,sheet:f},lt(t.key,t.blockId)),ot=()=>{if(r)return gt(r.panel,"",N);let _=`<div data-doc-sheet="${f}">`;if(t.children.length===0)return N===null?`${_}</div>`:`${_}${h}${N}</div>`;let tt=N===null?null:N+nt,xt=t.children.map(kt=>Q(kt,tt));return tt===null?_+xt.join("")+"</div>":_+xt.map(kt=>h+tt+kt).join("")+h+N+"</div>"};st.push({at:c?d.end:d.start,seq:o++,text:()=>H(v,z())});let B=c?/^\s*/.exec(s.slice(x.end))[0]:/\s*$/.exec(s.slice(0,x.start))[0],U=N!==null&&/\n[ \t]*\r?\n/.test(B)?h:"";st.push({at:c?x.end:x.start,seq:o++,text:()=>c?U+H(N,ot()):H(N,ot())+U})},Ie=(t,n)=>{let r=t.node?.sourceCodeLocation;if(t.at===void 0||!r)return J(t,"unknown");at(t),$.push(...Me(s,r.startTag,[["style",l=>Ve(l?.value??"",n)||null]]))},D=(t,n)=>{let r=t.node?.sourceCodeLocation;if(t.at===void 0||!r)return J(t,"unknown");at(t),$.push(...Me(s,r.startTag,n))},Mt=new Map,ut=new Map,It=new Map,it=new Set(w.filter(t=>t?.remove===!0).map(t=>t.id)),dt=new Set(w.filter(t=>t?.move).map(t=>t.id)),mt=new Map,ae=(t,n)=>n?.unit!==void 0?mt.set(n.unit,t.id):Array.isArray(n?.children)&&n.children.forEach(r=>ae(t,r));w.forEach(t=>ae(t,t?.insert));let ce=new Map(w.filter(t=>Number.isInteger(t?.id)&&t.replace).map(t=>[t.id,t.replace])),Jt=t=>Dt[ce.get(t.id)?.type]?.kind??t.kind,jt=new Set(a.units.map(t=>t.id).filter(t=>!it.has(t)&&!dt.has(t)&&!mt.has(t)&&!P.has(t))),fe=a.units.filter(t=>dt.has(t.id)||mt.has(t.id)),Se=(t,n)=>r=>n.some(l=>l!==t&&t.start<=l.start&&l.end<=t.end&&l.start<=r&&r<l.end),e=t=>!!t.keep&&!t.keep.at.every(Se(t,fe)),i=(t,n)=>{let r=[$,j,ft,st],l=r.map(c=>c.length);n(),r.forEach((c,d)=>c.slice(l[d]).forEach(x=>x.of??=t))},o=0;for(let t of w){let{id:n,remove:r,toggle:l,on:c,move:d,size:x,value:S,attribute:f,stood:b}=t??{},v=Number.isInteger(n)?a.units[n]:void 0;i([{unit:n}],()=>{if(t?.insert&&typeof n=="string")le(t);else if(v&&t.replace){let N=u.length;Ht(v,t.replace),u.length>N&&ce.delete(v.id)}else v&&t.retag?re(v,t.retag):v&&(t.table||t.source)?oe(v,t.table??t.source):v&&r===!0?e(v)?u.push({unit:n,reason:"referenced"}):v.kind==="tab"&&a.units.every(N=>N.box!==v.box||it.has(N.id))?u.push({unit:n,reason:"last"}):(v.kind==="icon"&&!rn(a.boxes[v.box]?.kind,"icon")&&(yt=!0),Vt(v)):v&&d&&typeof d=="object"&&!it.has(n)?P.has(n)||Zt(v,d,jt,b):v&&typeof c=="boolean"&&(an[v.kind]??[]).includes(l)?(Mt.get(v)??Mt.set(v,new Map).get(v)).set(l,c):v&&Nn[v.kind]?.[x]&&(S===null||ln(v.kind,x,S)!==null)?it.has(n)||(ut.get(v)??ut.set(v,new Map).get(v)).set(x,S===null?null:ln(v.kind,x,S)):v&&typeof f=="string"&&An(v.kind,f,S)?it.has(n)||(It.get(v)??It.set(v,new Map).get(v)).set(f,S):u.push({unit:n,reason:x===void 0&&f===void 0?"unknown":"invalid"})})}let y=new Set(u.map(t=>t.unit).filter(t=>t!==void 0)),M=t=>(it.has(t.id)||dt.has(t.id)||mt.has(t.id))&&!y.has(mt.get(t.id)??t.id);for(let t of a.boxes){if(!["list","quote"].includes(t.kind)||!t.pure||t.unit===null)continue;let n=a.units[t.unit];if(!n||it.has(n.id)||dt.has(n.id)||mt.has(n.id))continue;let r=a.units.filter(c=>c.box===t.id);if(r.length===0||!r.every(M))continue;let l=c=>!!c&&(c.into===t.id||[n,...r].some(d=>c.after===d.id||c.before===d.id));w.some(c=>l(c?.insert?c.place:c?.move))||Vt(n)}for(let[t,n]of Mt)i([{unit:t.id}],()=>ne(t,n));for(let[t,n]of ut)i([{unit:t.id}],()=>Ie(t,n));for(let[t,n]of It)i([{unit:t.id}],()=>D(t,n));for(let t of O)at(a.units[t]);let E=new Set([...K.keys()].map(t=>p[t].wrapper).filter(Boolean));for(let t of E){let n=t.ids.map(r=>K.get(r));n.some(r=>!r)||j.some(r=>r.start<=t.start&&t.end<=r.end)||(n.forEach(r=>r.skip=!0),$.push({...Le(s,t.start,t.end),of:t.ids.map(r=>({id:r}))}))}if(q&&q.from!==q.to){let t=De(s,q);q.synced=!!t,t&&$.push(t)}else q=null;let L=new Map;for(let t of j){let n=`${t.start}:${t.end}`;L.has(n)?L.get(n).of=[...L.get(n).of??[],...t.of??[]]:L.set(n,t)}j.splice(0,j.length,...L.values());let A=(t,n)=>{t.of?.length||u.push({reason:n});for(let r of t.of??[])u.push({...r,reason:n})},C=(t,n,r)=>n===r?t.start<n&&n<t.end:t.start<=n&&r<=t.end,R=(t,n,r,l=null)=>{let c=null;for(let d of ft){let x=l!==null&&d.start===l.start&&d.end===l.end;d!==r&&(x||C(d,t,n))&&(!c||d.start>=c.start)&&(c=d)}return c},V=(t,n,r,l=null)=>{let c=R(t,n,r,l);return j.some(d=>d!==r&&C(d,t,n)&&!(c&&C(d,c.start,c.end)))},T=new Set,F=t=>{if(T.has(t))return A(t,"position"),"";T.add(t);try{return St(t)}finally{T.delete(t)}},St=t=>{let[n,r]=t?[t.start,t.end]:[0,s.length],l=(f,b,v=null,N=null)=>R(f,b,v,N)===t&&!V(f,b,v,N),c=[];for(let f of[...j,...ft].filter(b=>b!==t&&l(b.start,b.end,b)).sort((b,v)=>b.start-v.start)){let b=c.at(-1);b&&(f.start<=b.end||!s.slice(b.end,f.start).trim())?(b.end=Math.max(b.end,f.end),b.of.push(...f.of??[])):c.push({start:f.start,end:f.end,of:[...f.of??[]]})}let d=[...$.filter(f=>!f.skip&&l(f.start,f.end,null,f.edge??null)).map(f=>({...f,seq:f.seq??-2})),...c.map(f=>({...Ye(s,f.start,f.end),seq:-1,of:f.of})),...[...ft.filter(f=>f.at!==null),...st].filter(f=>l(f.at,f.at,f)).map(f=>({start:f.at,end:f.at,seq:f.seq,text:f.text?f.text():f.wrap(gt(F(f),f.from,f.to)),of:f.of}))].sort((f,b)=>f.start-b.start||f.end-f.start-(b.end-b.start)||f.seq-b.seq),x=[];for(let f of d)x.length>0&&f.start<x.at(-1).end?A(f,"overlap"):x.push(f);let S=s.slice(n,r);for(let f of x.reverse())S=S.slice(0,f.start-n)+f.text+S.slice(f.end-n);return S},Ft=F(null);if(u.length>0&&!g)return{ok:!1,conflicts:u};let He=Z??(yt?null:void 0);return{ok:u.length===0,text:Ft,version:pe(Ft),ids:{assigned:se,created:qt},...q?{title:q}:{},...He!==void 0?{icon:He}:{},...g?{conflicts:u}:{}}}import{attr as yn}from"../browser/shared/html-tree.mjs";import{outsideKey as _n}from"../browser/shared/ids.mjs";Ae();import{commonPrefix as un,commonSuffix as dn,mergeText as pn}from"../browser/editor/page/merge.mjs";var ee=new Map;function xe(s){let m=ee.get(s);if(m)return m;let w=/data-block-id/i.test(s)?Re(s,[ue(s,{sourceCodeLocationInfo:!0})]):[],g="",k=0,O=0,I=[];for(let p of w)g+=s.slice(k,p.start),k=p.end,O+=p.end-p.start,I.push({at:g.length,end:p.end,removed:O});g+=s.slice(k);let a={text:g,at:p=>p-(I.findLast(h=>h.end<=p)?.removed??0),source:p=>p+(I.findLast(h=>h.at<=p)?.removed??0)};for(ee.set(s,a);ee.size>4;)ee.delete(ee.keys().next().value);return a}function ze(s,m,w,g=w.start){let[k,O]=[xe(s),xe(m)],I=k.at(w.start),a=k.text.slice(I,k.at(w.end)),p=K=>O.source(K+k.at(g)-I),h=K=>{let q=[];for(let Z=K.indexOf(a);Z>=0;Z=K.indexOf(a,Z+1))q.push(Z);return q},u=h(O.text);if(u.length<=1&&h(k.text).length<=1)return u.length===1?p(u[0]):-1;let $=k.text.slice(Math.max(0,I-120),I),j=u.filter(K=>O.text.slice(Math.max(0,K-$.length),K)===$);return j.length===1?p(j[0]):u.length>1?-2:-1}function Ue(s,m,w,g){let[O,I]=[xe(s),xe(m)],[a,p]=[O.at(w.start),O.at(w.end)],h=O.text.slice(Math.max(0,a-400),a),u=O.text.slice(p,p+400),$=g.filter(q=>q.tag===w.tag).map(q=>{let[Z,yt]=[I.at(q.start),I.at(q.end)];return{other:q,score:dn(h,I.text.slice(Math.max(0,Z-400),Z))+un(u,I.text.slice(yt,yt+400))}}).sort((q,Z)=>Z.score-q.score),[j,K]=$;return j&&j.score>=40&&j.score-(K?.score??0)>=20?j.other:null}function hn(s,m){let w=p=>p.replace(/<[^>]*>/g," ").replace(/&(?:[a-z]+|#\d+);/gi," ").replace(/\s+/g," ").trim(),g=w(s),k=w(m);if(!g||!k)return!g&&!k;if(g.length<2||k.length<2)return g===k;let O=p=>{let h=new Map;for(let u=0;u<p.length-1;u++)h.set(p.slice(u,u+2),(h.get(p.slice(u,u+2))??0)+1);return h},I=O(k),a=0;for(let[p,h]of O(g))a+=Math.min(h,I.get(p)??0);return 2*a/(g.length-1+k.length-1)>=.5}Ae();import{IDENTITY as Bn}from"../browser/editor/components/registry.mjs";import{escapeAttribute as qn}from"../browser/shared/escape.mjs";import{attr as mn}from"../browser/shared/html-tree.mjs";import{CHART_DATA as _e,CHART_SOURCE as we,nextChartKey as Pn}from"../browser/shared/table-chart.mjs";function kn(s,m){if(m.size===0||!s.includes(we))return{text:s,keys:{}};let w=[],g=(a,p)=>{for(let h of a.childNodes??[]){if(!h.tagName)continue;let u=p||m.has(mn(h,Bn));for(let $ of[_e,we]){let j=mn(h,$);j!==void 0&&w.push({name:$,key:j,made:u,at:h.sourceCodeLocation?.attrs?.[$]??null})}g(h.tagName==="template"?h.content:h,u)}};g(ue(s,{sourceCodeLocationInfo:!0}),!1);let k=new Set(w.map(({key:a})=>a)),O={};for(let a of new Set(w.filter(p=>p.made&&p.name===we).map(p=>p.key))){let p=w.filter(u=>u.key===a&&!u.made),h=w.some(u=>u.key===a&&u.made&&u.name===_e);h&&p.length>0?(O[a]=Pn(k),k.add(O[a])):!h&&p.some(u=>u.name===we)&&(O[a]=null)}return{text:w.filter(({name:a,key:p,made:h,at:u})=>h&&u&&Object.hasOwn(O,p)&&!(O[p]===null&&a===_e)).map(({name:a,key:p,at:h})=>O[p]===null?{...Xt(s,h.startOffset,h.endOffset),put:""}:{start:h.startOffset,end:h.endOffset,put:`${a}="${qn(O[p])}"`}).sort((a,p)=>p.start-a.start).reduce((a,{start:p,end:h,put:u})=>a.slice(0,p)+u+a.slice(h),s),keys:O}}function Hn({current:s,opening:m=null,texts:w=[],units:g=[],touch:k=[],ids:O=!0,seal:I=null,pageIds:a=null}){let p=Et(s),h=typeof m=="string"?Et(m):null,u=e=>s.slice(e.innerStart,e.innerEnd),$=null,j=e=>($??=new Map(p.units.map(i=>[i.id,wt(s,i)]))).get(e.id),K=new Map,q=new Set,Z=new Map,yt=new Set(Array.isArray(a)?a.filter(e=>typeof e=="string"):[]),J=(e,i,o=!0,y=[])=>{let M=F=>!!F.blockId&&yt.has(F.blockId)&&!y.includes(F.blockId),E=yt.size>0?p.units.filter(F=>!M(F)):p.units,L=typeof i=="string"?E.filter(F=>j(F)===i):[],A=e>=0?h?.units[e]:void 0,C=A&&L.length>1?h.units.filter(F=>!M(F)&&wt(m,F)===i):[];if(L.length===1)return{unit:L[0]};if(C.length===L.length&&C.includes(A))return{unit:L[C.indexOf(A)]};if(!A)return L.length>1?{reason:"ambiguous"}:{gone:!0};let R=ze(m,s,A,A.elStart),V=R>=0?E.find(F=>F.elStart===R):null;if(V)return{unit:V};if(R===-2||L.length>1)return{reason:"ambiguous"};if(!o)return{gone:!0};let T=Ue(m,s,A,E);return T&&hn(m.slice(A.start,A.end),s.slice(T.start,T.end))?{unit:T,changed:!0}:{gone:!0}},X=e=>{if(!e||typeof e.key!="number"&&typeof e.key!="string")return{reason:"invalid"};if(K.has(e.key))return K.get(e.key);let i,o=typeof e.blockId=="string"?p.units.filter(y=>y.blockId===e.blockId):[];if(o.length===1&&typeof e.id!="string")i={unit:o[0]};else if(typeof e.id=="string"){let y=p.units.filter(M=>M.blockId===e.id);i=y.length===1?{unit:y[0]}:y.length>1?{reason:"ambiguous"}:Number.isInteger(e.open)&&typeof e.openHash=="string"?J(e.open,e.openHash,!1,[e.id]):{gone:!0}}else Number.isInteger(e.open)?i=J(e.open,e.hash,!0,[e.blockId]):i={reason:"invalid"};return i.unit&&!i.unit.blockId&&typeof e.blockId=="string"&&Z.set(i.unit.id,e.blockId),K.set(e.key,i),i.unit&&ct(e,i)&&q.add(e.key),i},ct=(e,i)=>i.changed||e.hash===null||typeof e.hash=="string"&&j(i.unit)!==e.hash,Vt=new Set(p.units.map(e=>e.blockId).filter(Boolean)),ne=[],vt=e=>e?.restore!==void 0?yn(At(e.restore?.source)?.element??{},gn)??e.blockId:e?.blockId,rt=e=>{let i=vt(e);if(typeof i=="string"&&Vt.has(i))return!0;let o=ve[e?.type];return!!o?.keyed&&typeof e.id=="string"&&p.boxes.some(y=>y.kind===o.box&&y.key===e.id)},Bt=e=>{let i=vt(e);e?.key!==void 0&&typeof i=="string"&&Vt.has(i)&&ne.push({key:e.key,id:i}),Array.isArray(e?.children)&&e.children.forEach(Bt)},se=(e,i)=>{let o=ve[i?.type];return!!o&&s.slice(e.elStart,e.end)===te(o,i,(e.carried??"")+(e.blockId?` ${gn}="${e.blockId}"`:""))},qt=(e,i,o)=>Array.isArray(e)&&Array.isArray(i)&&e.length===i.length&&e[0]===i[0]&&e.slice(1).every((y,M)=>y[0]===i[M+1]?.[0]&&y[1]===i[M+1][1]&&(!o||y[2]===i[M+1][2])),Gt=e=>{if(!e||typeof e.before!="string")return{reason:"invalid"};let i=o=>({block:o,changed:u(o)!==e.before});if(e.title){let o=p.blocks.filter(y=>y.kind==="title");return o.length===1?i(o[0]):{reason:o.length?"ambiguous":"missing"}}if(e.unit){let o=X(e.unit);if(!o.unit)return{reason:o.gone?"missing":o.reason};let y=p.blocks.filter(L=>L.unit===o.unit.id);if(e.self){let L=y.find(A=>A.self===o.unit.id);return L?i(L):{reason:"missing"}}let M=y.find(L=>qt(L.path,e.path,!1));if(M&&qt(M.path,e.path,!0))return i(M);let E=y.filter(L=>u(L)===e.before);return E.length===1?i(E[0]):{reason:W[o.unit.kind]?.textParts&&!ct(e.unit,o)?"package":"structure"}}if(Number.isInteger(e.open)||e.outside){let o=p.blocks.filter(A=>A.unit===null&&A.kind!=="title"&&u(A)===e.before);if(o.length===1)return i(o[0]);let y=Number.isInteger(e.open)?h?.blocks[e.open]:null;if(!y||o.length>1)return{reason:o.length>1?"ambiguous":"missing"};let M=ze(m,s,y),E=M>=0?p.blocks.find(A=>A.start===M):null;if(E)return i(E);let L=M===-2?null:Ue(m,s,y,p.blocks.filter(A=>A.unit===null));return L?i(L):{reason:M===-2?"ambiguous":"missing"}}return{reason:"invalid"}},ie=e=>{if(e?.main)return p.boxes.find(o=>o.kind==="main")??null;if(e&&!e.unit&&typeof e.kind=="string")return p.boxes.find(o=>o.unit===null&&o.kind===e.kind&&(o.key??null)===(e.key??null))??null;let i=e?.unit?X(e.unit):null;return i?.unit?p.boxes.find(o=>o.unit===i.unit.id&&o.kind===e.kind&&(o.key??null)===(e.key??null))??null:null},lt=[],et=e=>{e&&typeof e=="object"&&(typeof e.key=="number"||typeof e.key=="string")&<.push(e)},Pt=e=>{e?.unit!==void 0&&et(e.unit),e?.copy!==void 0&&et(e.copy),e?.children?.forEach(Pt)},at=e=>{et(e?.after),et(e?.before),et(e?.into?.unit)};for(let e of w)et(e?.block?.unit);for(let e of g)et(e?.unit),at(e?.place),at(e?.move),Pt(e?.insert);k.forEach(et);let Ot=new Map;for(let e of lt){let i=X(e);i.unit&&(Ot.get(i.unit)??Ot.set(i.unit,[]).get(i.unit)).push({key:e.key,changed:!!i.changed})}for(let e of Ot.values())if(!(new Set(e.map(i=>i.key)).size<2))for(let i of e)i.changed&&K.set(i.key,{gone:!0});let pt=new Map,P=new Map,G=(e,i,o,y={})=>e.set(i,{key:i,status:"conflict",reason:o,...y}),Yt=new Map,Wt=(e,i,o,y)=>{let M=L=>{for(let A=L.unit;A!=null;A=i.units[A]?.parent)if(A===o.id)return!0;return!1};if(!y)return{hash:wt(e,o),theirs:i.blocks.filter(M).map(L=>e.slice(L.innerStart,L.innerEnd)).join(`
|
|
10
|
+
`)};let E=L=>Object.fromEntries(y.filter(A=>typeof L?.[A]=="string").map(A=>[A,L[A]]));return{theirs:E(W[o.kind]?.dataOf?.(e,o.node,Tt().packages)??{}),parts:E(o.parts)}},zt=(e,i,o=null,y={})=>{Yt.set(e,{unit:i,held:o}),G(P,e,"changed",{...Wt(s,p,i,o),...y})},ft=[],Zt=new Map;for(let e of w){let{key:i,block:o}=e??{},y=e?.parts,M=Array.isArray(y)?y.filter(A=>!A?.keep):[];M.some(rt)&&(M.forEach(Bt),y=y.filter(A=>A?.keep||!rt(A)));let E=Gt(o);if(!E.block){E.reason==="missing"&&Array.isArray(y)&&!y.some(A=>A?.keep)&&y.every(rt)?pt.set(i,{key:i,status:"applied"}):G(pt,i,E.reason);continue}let L=Array.isArray(y)&&y.length===1&&y[0]?.keep&&typeof y[0].html=="string"?y[0].html:null;if(E.changed&&L!==null&&L===u(E.block))pt.set(i,{key:i,status:"applied"});else if(E.changed){let A=L===null?null:pn(o.before,L,u(E.block));if(A===null||ge(E.block,[{keep:!0,html:A}],s)){G(pt,i,"changed",{theirs:u(E.block)});continue}y=[{keep:!0,html:A}],pt.set(i,{key:i,status:"merged",html:A})}else pt.set(i,{key:i,status:"applied"});Zt.set(E.block.id,i),ft.push({id:E.block.id,parts:y})}let ht=[],Ut=new Map,_t=(e,i)=>Ut.set(e,[...Ut.get(e)??[],i]),Ht={},oe=e=>{if(e?.into){let y=ie(e.into);return y?{into:y.id}:null}let i=!!e?.after,o=X(i?e.after:e?.before);return o?.unit?{[i?"after":"before"]:o.unit.id}:null},re=null,Kt=e=>{if(e?.unit!==void 0){let y=X(e.unit);return y.unit?{unit:y.unit.id,stood:e.stood}:null}if(e?.restore!==void 0){let{source:y,seal:M}=e.restore??{};if(!I||typeof y!="string"||M!==I(y))return null;let E=Array.isArray(e.children)?e.children.map(Kt):void 0;return E?.includes(null)?null:{restore:y,key:e.key,blockId:e.blockId,stood:e.stood,...E?{type:e.type,children:E}:{}}}if(e?.copy!==void 0){let y=X(e.copy),M=e.keys===void 0?null:Un(e.keys);return e.keys!==void 0&&!M?null:y.unit&&zn.has(y.unit.kind)?{restore:$e(s,y.unit,{keys:M,taken:re??=new Set(Ne(s))}),key:e.key,blockId:e.blockId}:null}if(!e||typeof e!="object")return null;let i=W[e.type]?.source;if(i){let y=E=>$e(E,{start:0,end:E.length},{taken:re??=new Set(Ne(s))}),M=i(e,{packages:Tt().packages,written:y});return M?{restore:M,key:e.key,blockId:e.blockId}:null}let o=Array.isArray(e.children)?e.children.map(Kt):void 0;return o?.includes(null)?null:{...e,...o?{children:o}:{}}},Nt=new Set,$t=e=>[...Nt].filter(i=>i!==e&&[e,e.companion].some(o=>o&&o.start<=i.start&&i.end<=o.end)),nt=e=>{if(e?.unit!==void 0){let i=X(e.unit);i.unit&&Nt.add(i.unit)}else Array.isArray(e?.children)&&e.children.forEach(nt)};for(let e of g)e?.move?nt({unit:e.unit}):e?.insert&&nt(e.insert);let bt=(e,i)=>{let o=p.boxes.filter(E=>E.unit===e.id),y=new Map(i.map(E=>[X(E).unit,E])),M=p.units.filter(E=>o.some(L=>L.id===E.box));return o.every(E=>E.pure)&&M.length>0&&M.every(E=>Nt.has(E)||y.has(E)&&!ct(y.get(E),{unit:E}))},Q=new Set,st=e=>{if(e?.unit!==void 0){let i=X(e.unit);i.unit&&Q.add(i.unit)}else Array.isArray(e?.children)&&e.children.forEach(st)},le=[],Lt=new Map;for(let e of g){let i=e?.key;if(e?.insert&&rt(e.insert)){Bt({...e.insert,key:e.insert.key??i}),P.set(i,{key:i,status:"applied"});continue}if(e?.insert){let C=Kt({...e.insert,key:e.insert.key??i}),R=oe(e.place);if(!C||!R){G(P,i,!C&&W[e.insert.type]?.source?W[e.insert.type].unwritten(e.insert,{packages:Tt().packages}):"position");continue}P.set(i,{key:i,status:"applied"}),_t(i,i),ht.push({id:i,insert:C,place:R}),st(e.insert);continue}let o=X(e?.unit);if(e?.force===!0&&o.gone&&typeof e.hash=="string"&&typeof e.unit.id!="string"){let C=Number.isInteger(e.unit.open)&&e.unit.open>=0?h?.units[e.unit.open]:void 0;o=!h||h.units.some(V=>V!==C&&wt(m,V)===e.hash)?{reason:"ambiguous"}:J(-1,e.hash,!1,[e.unit.blockId]),o.unit&&!o.unit.blockId&&typeof e.unit.blockId=="string"&&Z.set(o.unit.id,e.unit.blockId),K.set(e.unit.key,o)}if(e?.source&&o.gone&&typeof e.unit.id=="string"&&e.parts&&typeof e.parts=="object"){let C=Object.entries(e.parts).filter(([,V])=>typeof V=="string"),R=C.length>0?p.units.filter(V=>V.parts&&!yt.has(V.blockId)&&C.every(([T,F])=>V.parts[T]===F)):[];R.length===1&&(o={unit:R[0]},R[0].blockId||Z.set(R[0].id,e.unit.id),K.set(e.unit.key,o),ct(e.unit,o)&&q.add(e.unit.key))}let y=typeof e?.size=="string"||typeof e?.toggle=="string"||typeof e?.attribute=="string",M=e?.remove===!0&&Array.isArray(e.items)&&e.force!==!0&&!!o.unit&&ct(e.unit,o)&&bt(o.unit,e.items);if(e?.remove===!0&&Array.isArray(e.items)&&e.force!==!0&&!M&&(o.gone||o.unit&&ct(e.unit,o))){let C=e.items.map(T=>({ref:T,found:X(T)})),R=C.find(T=>!T.found.unit&&!T.found.gone),V=C.filter(T=>T.found.unit&&!Nt.has(T.found.unit));if(R)G(P,i,R.found.reason);else if(V.some(T=>ct(T.ref,T.found)))o.unit?zt(i,o.unit):G(P,i,"changed");else if(V.some(T=>Lt.has(T.found.unit)))G(P,i,"ambiguous");else{P.set(i,{key:i,status:"applied"});for(let{ref:T,found:F}of V)Lt.set(F.unit,T.key),_t(F.unit.id,i),ht.push({id:F.unit.id,remove:!0})}continue}if(!o.unit){o.gone&&(e?.remove===!0||y)?P.set(i,{key:i,status:"applied"}):G(P,i,o.gone?"missing":o.reason);continue}if(e.replace&&se(o.unit,e.replace)){P.set(i,{key:i,status:"applied"});continue}if(e.source){let C=W[o.unit.kind]?.definition?.(o.unit.node,Tt().packages);if(typeof C!="string"||C!==e.definition){G(P,i,"definition");continue}}if(e.table&&W[o.unit.kind]?.definition){G(P,i,"invalid");continue}let E=e.source;if(e.source&&typeof e.source=="object"&&(e.force===!0||ct(e.unit,o))){let C=e.force===!0||!o.changed,R=St=>C&&St.every(Ft=>typeof e.parts?.[Ft]=="string"&&e.parts[Ft]===o.unit.parts?.[Ft]),V=Kn(e.source,e.together),T=V.filter(R).flat(),F=V.filter(St=>!R(St)).flat();if(F.length>0){if(zt(i,o.unit,F,T.length>0?{wrote:T}:{}),T.length===0)continue;E=Object.fromEntries(T.map(St=>[St,e.source[St]]))}}else if((e.remove===!0||e.replace||e.table)&&!M&&(e.force===!0?j(o.unit)!==e.hash:ct(e.unit,o))){zt(i,o.unit);continue}let L=E!==e.source;if(Lt.has(o.unit)&&Lt.get(o.unit)!==e.unit.key){G(P,i,"ambiguous");continue}Lt.set(o.unit,e.unit.key);let A=null;if(e.remove===!0){A={remove:!0};let{unit:C}=o,R=C.companion?Ge(s,C):gt(s.slice(C.start,C.end),Y(s,C.start),"");Ht[i]={source:R,seal:I?I(R):null,...$t(C).length>0?{around:!0}:{}}}else if(e.move){let C=oe(e.move);if(!C){G(P,i,"position");continue}A={move:C,stood:e.stood}}else e.replace?A={replace:e.replace}:typeof e.retag=="string"?A={retag:e.retag}:e.table&&typeof e.table=="object"?A={table:e.table}:E&&typeof E=="object"?A={source:E}:typeof e.toggle=="string"?A={toggle:e.toggle,on:e.on}:typeof e.size=="string"?A={size:e.size,value:e.value}:typeof e.attribute=="string"&&(A={attribute:e.attribute,value:e.value});if(!A){G(P,i,"unknown");continue}L||P.set(i,{key:i,status:"applied"}),_t(o.unit.id,i),ht.push({id:o.unit.id,...A}),A.move&&Q.add(o.unit),A.remove&&le.push({key:i,unit:o.unit})}for(let{key:e,unit:i}of le)$t(i).every(o=>Q.has(o))||(G(P,e,"position"),delete Ht[e],ht.splice(ht.findIndex(o=>o.id===i.id&&o.remove),1));let Ie=[...new Set(k.map(X).filter(e=>e.unit).map(e=>e.unit.id))],D=fn({current:s,edits:ft,units:ht,partial:!0,ids:O,touch:Ie,proposals:Z}),Mt=kn(D.text,new Set((D.ids?.created??[]).map(({id:e})=>e)));D.text=Mt.text;for(let e of D.conflicts??[]){e.id!==void 0&&Zt.has(e.id)&&G(pt,Zt.get(e.id),e.reason);for(let i of Ut.get(e.unit)??[])G(P,i,e.reason),delete Ht[i]}let ut=Et(D.text),It=new Map,it=new Map(D.ids.assigned.map(({at:e,id:i})=>[e,i]));for(let[e,i]of K){let o=i.unit?i.unit.blockId??it.get(i.unit.at):null;o&&It.set(e,o)}for(let[e,{unit:i,held:o}]of Yt){let y=i.blockId??it.get(i.at),M=y?ut.units.filter(E=>E.blockId===y):[];M.length===1&&P.get(e)?.reason==="changed"&&Object.assign(P.get(e),Wt(D.text,ut,M[0],o))}let dt=new Map([...ne,...D.ids.created].map(({key:e,id:i})=>[e,i])),mt=new Set([...It.values(),...dt.values()]),ae=new Set(ut.units.map(e=>e.blockId).filter(Boolean)),ce=[...mt].filter(e=>!ae.has(e)),Jt=new Map,jt=new Map,fe=e=>{let o=(Array.isArray(e?.children)?e.children.map(fe).some(Boolean):!1)||[e?.unit,e?.copy].some(y=>y!==void 0&&q.has(y?.key));return e?.key!==void 0&&jt.set(e.key,o),o};for(let e of g)e?.insert&&fe({...e.insert,key:e.insert.key??e.key});for(let[e,i]of[...It,...[...dt].filter(([o])=>jt.get(o)!==!0)]){if(q.has(e))continue;let o=ut.units.filter(y=>y.blockId===i);o.length===1&&Jt.set(e,wt(D.text,o[0]))}let Se=g.filter(e=>ve[e?.insert?.type]?.keyed&&typeof e.insert.id=="string"&&P.get(e.key)?.status==="applied").map(e=>({key:e.insert.id,box:ve[e.insert.type].box}));return{text:D.text,version:pe(D.text),texts:[...pt.values()],units:[...P.values()],ids:Object.fromEntries(It),made:Object.fromEntries(dt),hashes:Object.fromEntries(Jt),removed:Ht,gone:ce,file:Dn(D.text,ut,mt,new Set(dt.values())),outside:Rn(D.text,ut),keyed:Fn(D.text,ut,Se),...Object.keys(Mt.keys).length>0?{chartKeys:Mt.keys}:{},...D.title?{title:D.title}:{},...D.icon!==void 0?{icon:D.icon}:{}}}function Kn(s,m){let w=[];for(let g of[...Array.isArray(m)?m:[],...Object.keys(s).map(k=>[k])]){let k=Array.isArray(g)?g.filter(I=>typeof I=="string"&&Object.hasOwn(s,I)):[],O=w.filter(I=>k.some(a=>I.includes(a)));if(k.length!==0){for(let I of O)w.splice(w.indexOf(I),1);w.push([...new Set([...O.flat(),...k])])}}return w}function Fn(s,m,w){let g={};for(let{key:k,box:O}of w){let I=m.boxes.find(a=>a.kind===O&&a.key===k);I&&(g[k]={units:m.units.filter(a=>a.box===I.id).map(a=>a.blockId??{hash:wt(s,a)})})}return g}function Rn(s,m){let w={};for(let g of m.blocks){let k=g.unit===null?_n(g.kind==="title",yn(g.node,"id")):null;k&&(w[k]=s.slice(g.innerStart,g.innerEnd))}return w}function Dn(s,m,w,g){let k=new Map;for(let a of m.units)a.blockId&&k.set(a.blockId,(k.get(a.blockId)??0)+1);let O=a=>{for(let p=a.parent;p!=null;p=m.units[p].parent)if(g.has(m.units[p].blockId))return!0;return!1},I={};for(let a of m.units){if(!a.blockId||k.get(a.blockId)!==1||!(w.has(a.blockId)||O(a)))continue;let p=a.parent===null?null:m.units[a.parent];I[a.blockId]={kind:a.kind,hash:wt(s,a),keep:a.keep??null,...a.grid?{grid:!0}:{},...a.parts?{parts:a.parts}:{},parent:p?p.blockId??"":null,boxes:m.boxes.filter(h=>h.unit===a.id).map(h=>({kind:h.kind,key:h.key,units:m.units.filter(u=>u.box===h.id).map(u=>u.blockId??{hash:wt(s,u)})})),blocks:m.blocks.filter(h=>h.unit===a.id).map(h=>({...h.self!==null?{self:!0}:{path:h.path},kind:h.kind,caps:Object.keys(h.caps),inner:s.slice(h.innerStart,h.innerEnd),...h.atoms.length>0?{atoms:h.atoms}:{}})),...W[a.kind]?.definition&&(g.has(a.blockId)||O(a))?{markup:s.slice(a.elStart,a.end)}:{}}}return I}function Rs({current:s,units:m=[]}){let w=Et(s),g=[];for(let k of m){if(typeof k?.id!="string"||typeof k.key!="string"&&typeof k.key!="number")continue;let O=w.units.filter(a=>a.blockId===k.id);if(O.length===0){g.push({key:k.key,gone:!0});continue}if(O.length>1||k.from===void 0||k.from===k.parent||k.from===""||k.parent==="")continue;(O[0].parent===null?null:w.units[O[0].parent].blockId??"")===k.from&&g.push({key:k.key,moved:!0})}return g}function Ds({current:s,instances:m=[],pageIds:w=null}){let g=Et(s),k=new Set(Array.isArray(w)?w.filter(I=>typeof I=="string"):[]),O=[];for(let I of m){if(typeof I?.id!="string"||typeof I.key!="string"&&typeof I.key!="number"||!I.parts||typeof I.parts!="object")continue;let a=j=>Object.entries(I.parts).filter(([K,q])=>typeof j.parts?.[K]=="string"&&j.parts[K]!==q?.after&&Array.isArray(q?.before)&&q.before.includes(j.parts[K])),p=g.units.filter(j=>j.blockId===I.id),h=p.length===0?g.units.filter(j=>j.parts&&!k.has(j.blockId)&&a(j).length>0):[],u=p.length===1?p[0]:h.length===1?h[0]:null,$=u?a(u):[];$.length>0&&O.push({key:I.key,parts:Object.fromEntries($.map(([j])=>[j,u.parts[j]])),markup:s.slice(u.elStart,u.end)})}return O}function Vs({current:s,opening:m=null,texts:w=[],pageIds:g=null}){let k=w.filter(u=>typeof u?.block?.before=="string"&&typeof u.original=="string").map(u=>({entry:u,was:new Set([u.original,...Array.isArray(u.earlier)?u.earlier.filter($=>typeof $=="string"):[]].filter($=>$!==u.block.before))})).filter(({was:u})=>u.size>0),O=u=>Hn({current:s,opening:m,ids:!1,pageIds:g,texts:u.map(({entry:{key:$,block:j}})=>({key:$,block:j,parts:[{keep:!0,html:j.before}]}))}).texts,I=O(k),a=new Set(I.filter(u=>u.reason==="overlap").map(u=>u.key)),p=[...I.filter(u=>!a.has(u.key)),...k.filter(({entry:u})=>a.has(u.key)).flatMap(u=>O([u]))],h=new Map(k.map(({entry:u,was:$})=>[u.key,$]));return p.filter(u=>u.status==="merged"&&h.get(u.key)?.has(u.html)).map(({key:u,html:$})=>({key:u,theirs:$}))}export{fn as a,Hn as b,Rs as c,Ds as d,Vs as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as n,f as i}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import{reportsDirectory as r}from"../browser/shared/paths.mjs";import{answerOf as a,readAnnouncement as d,stopServer as l}from"../browser/shared/preview-server.mjs";async function m(p){let{positional:s}=i({argv:p});if(s.length>0)throw new n(`gallery stop takes no arguments: ${s[0]}`);let o=await d({reportsDirectory:r}),t=o?await a(o,r,1e4):"no";if(t==="no")return void console.log(`No Gallery server runs for ${r}.`);t==="busy"&&(console.error(`The Gallery server on port ${o.port} (pid ${o.pid}) took the request and gave no answer in 10s: it is busy or stuck. Run gallery stop again in a while, or end process ${o.pid} yourself.`),process.exit(1)),o.kind==="dev"&&(console.error(`This workspace's server is npm run dev's (port ${o.port}, pid ${o.pid}): stop it where it runs.`),process.exit(1));let e=await l(o);e.ok||(console.error(e.message),process.exit(1)),console.log(`Stopped the server on port ${o.port} (pid ${o.pid})${e.killed?": it did not stop by itself in 10s, so its process was ended":""}.`)}export{m as run};
|