@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,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{a as he,b as qt}from"./chunk-342HXE3Q.mjs";import{b as le,f as ce,g as de}from"./chunk-XINNG4F2.mjs";import"./chunk-7GHT2UCA.mjs";import"./chunk-G7TOXONE.mjs";import{a as oe,b as ne,c as se,d as ae,e as ie,f as re}from"./chunk-LC7YNQFG.mjs";import{a as We,b as Vt,c as Qt,d as Zt,f as te,g as je,h as ee,k as Le,l as Ie}from"./chunk-6U2SLSDN.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import{b as Wt,j as Kt}from"./chunk-NSKUTQ5J.mjs";import"./chunk-QMQUXTU4.mjs";import{g as Jt}from"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import{a as Xt}from"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import{a as Pt}from"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{spawnSync as Fe}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Pe}from"node:url";import{MATH_IGNORED_TAGS as Ve}from"../browser/shared/components/math.mjs";import{exportPackagesOf as _e,exportSourceOf as De,packagesSaid as He}from"../browser/shared/export-wrap.mjs";import{sha256 as fe}from"../browser/shared/files.mjs";import{attr as ue}from"../browser/shared/html-tree.mjs";import{projectRoot as ze,qaDirectory as Ue,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as jt,documentFiles as Lt}from"../browser/shared/workspace.mjs";import{KINDS as Uo,LEVELS as At,LOOKS as pe,WIDE as Go,WIDTHS as ge,layoutNotesOf as Ge,levelOf as Me}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ye}from"../browser/shared/table-hides.mjs";var Ke=new Set(["code-scrolls","formula-scrolls"]),Ce=(e,n)=>e.level??Me(e.kind,n),Xe=(e,n)=>["fail","warn"].includes(Ce(e,n))||Ke.has(e.kind)&&Me(e.kind,n)==="info",Je=4,Ee=12,Qe=8,Ze=2,me=200,to=2e3,we=600;function eo({block:e,above:n=null,below:s=null}){let c=[e,n,s].filter(Boolean),r=Math.min(...c.map(h=>h.left)),u=Math.max(...c.map(h=>h.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-me):e.top,d=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+me):e.bottom,$=(h,q)=>({x:Math.max(0,r),y:Math.max(0,h),width:u-r,height:q-Math.max(0,h)});return e.bottom-e.top<=to?[{part:"",clip:$(w,d)}]:[{part:"top",clip:$(w,e.top+we)},{part:"bottom",clip:$(e.bottom-we,d)}]}function $e(e,n=""){if(e.startsWith("data:"))return`${e.slice(0,30)}\u2026 (${e.length} characters)`;let s=n.slice(0,n.lastIndexOf("/")+1);if(s&&e.startsWith(s)&&e.length>s.length)try{return decodeURIComponent(e.slice(s.length))}catch{return e.slice(s.length)}return e.length>60?`\u2026${e.slice(-59)}`:e}var It=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=It(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},oo=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function no(e,n="doc.html"){let s=new Map,c=new Map,r=new Map,u=($,h)=>(h&&$.sourceCodeLocation.attrs?.[h]||$.sourceCodeLocation).startLine,w=new Map,d=$=>{if($.nodeName==="#text")return $.value;if(!$.tagName&&$.nodeName!=="#document"||$.tagName==="template")return"";let h=($.childNodes??[]).map(d).join("");if(!$.tagName||!$.sourceCodeLocation)return h;let q=ue($,"data-block-id");q!==void 0&&!s.has(q)&&s.set(q,u($,"data-block-id"));let L=ue($,"id");L!==void 0&&!c.has(L)&&c.set(L,u($,"id"));let U=oo(h);if(U.length>=2){let m=`${$.tagName}|${U}`;w.has(m)||w.set(m,[]),w.get(m).push($.sourceCodeLocation)}return h};d(Xt(e));for(let[$,h]of w)r.set($,h.sort((q,L)=>q.startOffset-L.startOffset).map(q=>q.startLine));return{blocks:s,ids:c,texts:r,name:n}}function so(e,n){if(!e)return"the page";let s=n.name??"doc.html",c=h=>{let q=h&&n.texts.get(`${h.tag}|${h.words}`);return q?.[Math.min(h.nth??0,q.length-1)]},r=e.table||e.header?.text,u=e.card?` card ${Mt(e.card.text)}`:r?` table ${Mt(r)}`:"",w=e.blocks?.find(h=>n.blocks.has(h));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${u}`;if(c(e.card))return`${s}:${c(e.card)} card ${Mt(e.card.text)}`;if(c(e.header))return`${s}:${c(e.header)} table ${Mt(r)}`;let d=e.texts?.find(c);if(d)return`${s}:${c(d)} ${d===e.texts[0]&&d.tag===e.tag?"":`${e.element} in `}<${d.tag}> ${Mt(d.text,32)}`;let $=e.ids?.find(h=>n.ids.has(h));return $!==void 0?`${s}:${n.ids.get($)} #${$}${u}`:c(e.section)?`${s}:${c(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${u} (not found in ${s})`}function Ut(e){let n=new Date(e),s=u=>String(u).padStart(2,"0"),c=-n.getTimezoneOffset(),r=`${c<0?"-":"+"}${s(Math.floor(Math.abs(c)/60))}:${s(Math.abs(c)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${r}`}function ao(e,n,s={said:"",now:""}){return e===n?s.said===s.now?{stale:!1,why:""}:{stale:!0,packaged:!0,why:`it holds ${s.said||"no component package"}, the workspace has ${s.now||"none of them"}`}:{stale:!0,why:e?`made from a text whose sha256 is ${e.slice(0,12)}\u2026, the file's is ${n.slice(0,12)}\u2026`:"it does not say which text it was made from: made before exports said it, or before the kit's names were doc-* (2026-10-26), whose pages gallery qa no longer reads"}}async function Gt(e,{made:n=!1}={}){let s=Lt(jt(e,Rt)).html,c=qt(e),[r,u]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(c).catch(()=>null)]);if(!r)return{problem:`${e}: no document (${s})`};if(!u)return{problem:`${e}: no export (${c}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(c),d=w.toString("utf8"),$=De(d),h={said:_e(d),now:He(Jt(r.toString("utf8")))},{stale:q,why:L,packaged:U=!1}=ao($,fe(r),h);return q&&!n?{problem:`${e}: ${c} is not of ${s} as it is now (${L}): run gallery export ${e} first`,stale:!0,why:L,edited:!!$&&!U,packaged:U}:{file:c,sha256:fe(w),time:u.mtimeMs}}function io(e,n){let s=e.map((w,d)=>({length:1,weight:n[d],previous:-1})),c=(w,d)=>w.length>d.length||w.length===d.length&&w.weight>d.weight;e.forEach((w,d)=>{for(let $=0;$<d;$++){if(e[$]>=w)continue;let h={length:s[$].length+1,weight:s[$].weight+n[d],previous:$};c(h,s[d])&&(s[d]=h)}});let r=-1;s.forEach((w,d)=>{(r<0||c(w,s[r]))&&(r=d)});let u=[];for(let w=r;w>=0;w=s[w].previous)u.unshift(w);return u}function qe(e,n){let s=n?.places??{},c=new Set((n?.moved??[]).filter(u=>e.has(u))),r=new Map;for(let[u,{parent:w,size:d=0}]of e){let $=s[u];if($){if($[0]!==w){c.add(u);continue}r.has(w)||r.set(w,[]),r.get(w).push({id:u,at:$[1],size:d})}}for(let u of r.values()){let w=new Set(io(u.map(({at:d})=>d),u.map(({size:d})=>d)).map(d=>u[d].id));for(let{id:d}of u)w.has(d)||c.add(d)}return c}function ro(e,n,s,{named:c=null,verified:r=!0,failed:u=!1,seen:w=null,page:d=void 0,packages:$=void 0}={}){if(!r||u||c&&!n)return null;let h=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),q=!n,L=q||s.pageChanged?s.cards??[]:[],U=[...n?.unseen??[],...L],m={blocks:{},places:{},moved:q?[]:[...qe(e,n)].filter(x=>!h.has(x)),unseen:[...new Set(U)].filter(x=>e.has(x)&&!h.has(x))};for(let[x,{hash:H,parent:M,at:Z}]of e){let X=q||h.has(x)?H:n.blocks[x];X!==void 0&&(m.blocks[x]=X),m.places[x]=[M,Z]}let C=!q&&(c||s.tiles)?n.page:d;typeof C=="string"&&(m.page=C);let D=!q&&(c||s.tiles)?n.packages:$&&Object.fromEntries(Object.entries($).map(([x,H])=>[x,(s.restyled?.get(x)??[]).every(M=>h.has(M))?H:n.packages[x]]));return D&&Object.keys(D).length&&(m.packages=D),m}function Ae(e){let n=new Map;for(let s of e){let c=new Set(s.held?.covered??[]);for(let r of s.held?.missed??[])c.has(r)||n.set(r,[...n.get(r)??[],s.label??String(s.width)])}return n}function lo(e,n){let s=Ae(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(c=>!s.has(c))])}function xe(e){let n=e.time?` of ${Ut(e.time)}`:"";return e.from==="export"?`the export${n} (the document before these changes)`:e.from==="preview"?`gallery open${n} (the document before these changes)`:"the last look"}var co=3;function ho(e,n,s=null,{tiles:c=!1,page:r=void 0,packages:u=void 0}={}){let w={rest:[],unknown:[],moved:new Set,around:new Map,held:new Map,groups:[],cards:[],pageChanged:!1,changed:new Set,restyled:new Map,left:null},d=[...e.keys()],$=new Map(d.map((a,O)=>[a,O])),h=n?qe(e,n):new Set,q=a=>typeof n?.packages?.[a]=="string"&&typeof u?.[a]=="string"&&n.packages[a]!==u[a],L=n?d.filter(a=>q(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!h.has(a)):[],U=new Map;for(let a of L)U.set(e.get(a).package,[...U.get(e.get(a).package)??[],a]);let m=new Set(L),C=n?d.filter(a=>n.blocks[a]!==e.get(a).hash||h.has(a)||m.has(a)):[],D=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!C.includes(a))),x=(a,O)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)O.has(et)&&(G=et);return G},H=new Set(C),M=new Set(C.filter(a=>e.get(a).card||h.has(a))),Z=a=>H.has(a)&&!h.has(a)&&x(a,M)===null,X=new Map;for(let a of d)for(let O=e.get(a).parent;O!==null&&e.has(O);O=e.get(O).parent){let G=X.get(O)??{all:0,changed:0};G.all+=1,Z(a)&&(G.changed+=1),X.set(O,G)}let gt=d.filter(a=>!e.get(a).card&&X.has(a)&&X.get(a).changed>=co&&X.get(a).changed*2>=X.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),O=new Set(a),G=new Map;for(let o of d){let l=O.has(o)?null:x(o,O);l!==null&&G.set(l,[...G.get(l)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof r=="string"&&n.page!==r,xt=new Set([...C.filter(o=>e.get(o).card||h.has(o)),...gt]),bt=!n||yt?d.filter(o=>e.get(o).card&&!C.includes(o)):[],Ft=new Set([...xt,...bt]),Nt=[...C,...gt.filter(o=>!H.has(o))].sort((o,l)=>$.get(o)-$.get(l)).filter(o=>!$t.has(o)&&x(o,xt)===null),Tt=Nt.filter(o=>m.has(o)),t={changed:Nt.filter(o=>!m.has(o)),...Tt.length?{restyled:Tt,packages:[...new Set(Tt.map(o=>e.get(o).package))]}:{},cards:bt.filter(o=>!$t.has(o)&&x(o,Ft)===null).sort((o,l)=>e.get(o).rank-e.get(l).rank||$.get(o)-$.get(l)),since:n?xe(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(C),restyled:U,left:t,unknown:[...new Set(s)].filter(o=>!e.has(o))}}if(e.size===0)return{...w,ids:[],why:"the document has no block ids (never handed in): the whole page in tiles instead",tiles:!0};if(c)return{...w,ids:[],why:null,tiles:!0};let p=(...a)=>(O,G)=>a.reduce((et,$t)=>et||$t(O)-$t(G),0),A=a=>e.get(a).rank,J=a=>$.get(a),Q=n?xe(n):"",k=!!n&&typeof n.page=="string"&&typeof r=="string"&&n.page!==r,v=d.filter(a=>e.get(a).card&&!C.includes(a)),F=!n||k||C.length===0?v:v.filter(a=>D.has(a)),tt=new Set([...C.filter(a=>e.get(a).card||h.has(a)),...gt]),ct=new Set([...tt,...F]),nt=new Map,at=(a,O)=>a.filter(G=>{let et=x(G,O);return et!==null&&nt.set(et,[...nt.get(et)??[],G]),et===null}),_=[...at(C,tt),...gt.filter(a=>!H.has(a)&&x(a,tt)===null)].sort(p(a=>+!h.has(a),A,J)),ft=_.filter(a=>m.has(a)),dt=_.filter(a=>!m.has(a)),it=at(F,ct).sort(p(a=>+!D.has(a),A,J)),rt="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",b=it.some(a=>D.has(a))?", those no look has pictured yet first":"",z=typeof n?.page=="string"&&typeof r=="string",P=n?k?`${rt.replace("the cards","the cards, not changed themselves")}${b}: the document's own <script> or <style> changed since ${Q}, which may draw any of them`:C.length?"the cards no look has pictured yet (not changed themselves)":`${rt}${b}: no block changed since ${Q}${z?", nor the document's own <script> or <style>":""}`:`${rt}: no earlier look to compare with`,K=[...dt.length?[{kind:"changed",why:`the blocks changed since ${Q}${h.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:dt}]:[],...ft.length?[{kind:"changed",why:`the instances of a package changed since ${Q} (${[...new Set(ft.map(a=>e.get(a).package))].join(", ")})`,all:ft}]:[],...it.length||!_.length?[{kind:"cards",why:P,all:it}]:[]],R=Ee;for(let a of K)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=K.flatMap(a=>a.ids),i=a=>{let{parent:O,at:G}=e.get(a),et=$t=>d.find(yt=>e.get(yt).parent===O&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},T=new Map(I.filter(a=>h.has(a)).map(a=>[a,i(a)])),N=new Map(I.filter(a=>nt.has(a)).map(a=>[a,nt.get(a)]));return{...w,ids:I,why:K[0].why,groups:K,rest:K.flatMap(a=>a.rest),moved:new Set(I.filter(a=>h.has(a))),around:T,held:N,cards:F,pageChanged:k,changed:new Set(C),restyled:U}}function fo(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),c=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let r=[...document.images].filter(m=>!n(m));r.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let u=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);u.forEach((m,C)=>{m.dataset.qaCard=String(C)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,d=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));d.forEach((m,C)=>{m.dataset.qaTab=String(C)});let $=m=>m.parentElement.parentElement,h=m=>{let C=[];for(let D=m.closest("[data-doc-sheet]");D;D=D.parentElement.closest("[data-doc-sheet]")){let x=d.find(H=>$(H)===D.parentElement&&H.getAttribute("data-sheet-tab")===D.getAttribute("data-doc-sheet"));x&&C.unshift(Number(x.dataset.qaTab))}return C},q=d.map((m,C)=>{let D=[...h($(m)),C],x=[...$(m).children].find(M=>M.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));x&&(x.dataset.qaPanel=String(C));let H=w(m);return{index:C,chain:D,card:H?Number(H.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:D.every(M=>d[M].getAttribute("aria-selected")==="true"),panel:!!x}}),L=u.map((m,C)=>{let D=`[href="#${CSS.escape(m.id)}"]`,x=[...m.querySelectorAll("h1, h2, h3, h4")].find(M=>M.textContent.trim())??document.querySelector(D),H=[];for(let M=w(m);M;M=w(M))H.unshift(Number(M.dataset.qaCard));return{index:C,chain:h(m),within:H,label:(x?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),U=Promise.all(r.map(m=>m.decode().catch(()=>{})));return Promise.race([U.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:c,images:r.length,loaded:m,sheets:q,cards:L}))}function ye(e){let n=document.querySelector(`[data-qa-card="${e}"]`);return n?(n.open||(globalThis.DocDialogs?globalThis.DocDialogs.open(n,null):typeof n.showModal=="function"?n.showModal():n.setAttribute("open","")),document.activeElement?.blur?.(),Promise.all(n.getAnimations({subtree:!0}).map(s=>s.finished.catch(()=>{}))).then(()=>n.open&&n.getClientRects().length>0)):Promise.resolve(!1)}function _t(e){let n=document.querySelector(`[data-qa-card="${e}"]`);n?.open&&(globalThis.DocDialogs?globalThis.DocDialogs.close(n):typeof n.close=="function"?n.close():n.removeAttribute("open"))}async function uo({selector:e,up:n=0,margin:s=0,frames:c=2}){let r=document.querySelector(e);for(let v=0;v<n&&r;v++)r=r.parentElement;if(!r||r.getClientRects().length===0)return null;let u=r.getBoundingClientRect();r.scrollIntoView({block:"nearest",inline:"nearest"});let w=r.getBoundingClientRect();if(u.top!==w.top||u.left!==w.left){let v=()=>new Promise(Y=>{requestAnimationFrame(()=>Y()),setTimeout(Y,100)});for(let Y=0;Y<c;Y++)await v()}let d=v=>v===document.body||v===document.documentElement,$=(v,Y,F)=>{let{left:tt,top:ct,right:nt,bottom:at}=v;for(let _=Y;_&&!d(_);_=_.parentElement){let ft=getComputedStyle(_),dt=ft.overflowX!=="visible",it=ft.overflowY!=="visible";if(dt||it){let rt=_.getBoundingClientRect();dt&&([tt,nt]=[Math.max(tt,rt.left),Math.min(nt,rt.right)]),it&&([ct,at]=[Math.max(ct,rt.top),Math.min(at,rt.bottom)])}if(_===F)break}return nt>tt&&at>ct?{left:tt,top:ct,right:nt,bottom:at}:null},h=v=>parseFloat(v)||0,q=(v,Y)=>{let F=getComputedStyle(v,Y);if(["none","normal"].includes(F.content)||F.display==="none"||!["absolute","fixed"].includes(F.position))return null;let tt=F.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,ct=tt?tt.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},nt=tt?getComputedStyle(tt):null,at={left:ct.left+h(nt?.borderLeftWidth),top:ct.top+h(nt?.borderTopWidth),right:ct.right-h(nt?.borderRightWidth),bottom:ct.bottom-h(nt?.borderBottomWidth)},_=(b,z)=>F.boxSizing==="border-box"?0:h(F[`padding${b}`])+h(F[`padding${z}`])+h(F[`border${b}Width`])+h(F[`border${z}Width`]),ft=h(F.width)+_("Left","Right"),dt=h(F.height)+_("Top","Bottom"),it=F.left!=="auto"?at.left+h(F.left)+h(F.marginLeft):F.right!=="auto"?at.right-h(F.right)-h(F.marginRight)-ft:null,rt=F.top!=="auto"?at.top+h(F.top)+h(F.marginTop):F.bottom!=="auto"?at.bottom-h(F.bottom)-h(F.marginBottom)-dt:null;return it===null||rt===null||!(ft>0)||!(dt>0)?null:$({left:it,top:rt,right:it+ft,bottom:rt+dt},v,r)},L=[r.getBoundingClientRect()],U=[r];for(let v of r.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(U.push(v),L.push($(v.getBoundingClientRect(),v.parentElement,r)));for(let v of U)L.push(q(v,"::before"),q(v,"::after"));let m=document.createRange(),C=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let v=C.nextNode();v;v=C.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let Y of m.getClientRects())L.push($(Y,v.parentElement,r))}m.detach();let D=L.filter(Boolean),x={left:Math.min(...D.map(v=>v.left)),top:Math.min(...D.map(v=>v.top)),right:Math.max(...D.map(v=>v.right)),bottom:Math.max(...D.map(v=>v.bottom))},H=$(x,r.parentElement,null)??x,M=!1;for(let v=r;v&&!M;v=v.parentElement)M=getComputedStyle(v).position==="fixed";let Z=visualViewport.pageLeft,X=visualViewport.pageTop,[gt,p]=M?[Z+innerWidth,X+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],A=Math.max(M?Z:0,H.left+Z-s),J=Math.max(M?X:0,H.top+X-s),Q=Math.min(gt,H.right+Z+s),k=Math.min(p,H.bottom+X+s);return Q>A&&k>J?{clip:{x:A,y:J,width:Q-A,height:k-J},fixed:M}:null}function be(e){for(let s of e){let c=document.querySelector(`[data-qa-tab="${s}"]`);c&&c.getAttribute("aria-selected")!=="true"&&c.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function Dt({scope:e,next:n,ignored:s=[],place:c,slack:r=4,whole:u=[],drawn:w=[]}){let d=e?document.querySelector(e):document.body,$=[];if(!d)return{found:$,next:n};let h=document.documentElement.clientWidth,q=Math.round,L=t=>String(t??"").replace(/\s+/g," ").trim(),U=(t,o=32)=>{let l=L(t);return`"${l.length>o?`${l.slice(0,o-1)}\u2026`:l}"`},m=t=>!!t.closest?.("[data-doc-dev]"),C=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let l=getComputedStyle(o);if(l.visibility==="hidden"||l.display==="none"||Number(l.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},D=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,x=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),H=new Map,M=t=>{let o=x(t);if(!H.has(t.localName)){let y=new Map;for(let B of document.getElementsByTagName(t.localName)){if(m(B))continue;let j=x(B);y.has(j)||y.set(j,[]),y.get(j).push(B)}H.set(t.localName,y)}let l=H.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,l),text:L(t.textContent).slice(0,80)}},Z=t=>{let o=t.cloneNode(!0);for(let l of o.querySelectorAll(".doc-tab"))l.before(" \xB7 ");return L(o.textContent).replace(/^· /,"")},X=t=>{let o=t.matches("table")?t:t.querySelector("table"),l=t.closest(".doc-table-wrap")??t,y=l.getAttribute("data-doc-chart-source")?.trim(),j=(y?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===y&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),f=l.previousElementSibling;return L(o?.caption?.textContent)||L(j?.textContent)||(f?.matches("p.doc-note")?Z(f):"")||L(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},gt=t=>{let o=t.nodeType===1?t:t.parentElement,l=[],y=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&l.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&y.push(g.id);let B=[];for(let g=o,W=0;g&&W<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,W++){let ot=M(g);ot.words.length>=2&&B.push(ot)}let j=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),f=o.closest(".doc-table-wrap, table"),S=f?.querySelector("th"),E=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:l,ids:y,texts:B,tag:o.localName,element:D(o),card:j?M(j):null,header:S?M(S):null,table:f?X(f).slice(0,80):null,section:E?M(E):null}};if(c){let t=document.querySelector(c);return{found:$,next:n,anchor:t?gt(t):null}}let p=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),A=(t,o,l,{picture:y=o,url:B,measured:j,scroll:f,level:S}={})=>$.push({kind:t,what:l,anchor:o?gt(o):null,shot:y?p(y):null,seen:!!(y&&C(y)),url:B,measured:j,scroll:f,...S?{level:S}:{}}),J=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,Q=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},k=(t,o,{x:l=!0,y=!0}={})=>Math.max(l?o.left-t.left:-1/0,l?t.right-o.right:-1/0,y?o.top-t.top:-1/0,y?t.bottom-o.bottom:-1/0),v=t=>({left:Math.min(...t.map(o=>o.x)),right:Math.max(...t.map(o=>o.x)),top:Math.min(...t.map(o=>o.y)),bottom:Math.max(...t.map(o=>o.y))}),Y=t=>{let o=t.getBBox(),l=t.getScreenCTM();return v([[o.x,o.y],[o.x+o.width,o.y],[o.x+o.width,o.y+o.height],[o.x,o.y+o.height]].map(([y,B])=>new DOMPoint(y,B).matrixTransform(l)))},F=t=>{let o=[];for(let l=t.parentElement;l&&l!==document.documentElement;l=l.parentElement){let y=getComputedStyle(l);l instanceof SVGSVGElement&&y.overflow!=="visible"&&o.push(["the svg's edge",l.getBoundingClientRect(),{}]);let B=/url\(\s*["']?#([^)"']+)/.exec(`${l.getAttribute?.("clip-path")??""} ${y.clipPath??""}`)?.[1],j=B?document.getElementById(B):null,f=j?.getAttribute("clipPathUnits")!=="objectBoundingBox"?j?.querySelector("rect"):null;if(f&&l.getScreenCTM){let[S,E,g,W]=["x","y","width","height"].map(ot=>f[ot].baseVal.value);o.push(["a clip-path",v([[S,E],[S+g,E+W]].map(([ot,lt])=>new DOMPoint(ot,lt).matrixTransform(l.getScreenCTM()))),{}])}if(!(l instanceof SVGElement)){let S=/hidden|clip/.test(y.overflowX),E=/hidden|clip/.test(y.overflowY);(S||E)&&o.push([D(l),l.getBoundingClientRect(),{x:S,y:E}])}}return o},tt=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,ct=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||C(t)&&Q(t));for(let t of d.querySelectorAll("[data-doc-chart]"))m(t)||!C(t)||[...t.children].some(ct)||A("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:J(t)});let nt=[...d.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!C(t))return!1;let o=t.getBoundingClientRect();return t.closest("[data-doc-chart], figure")||o.width>=120&&o.height>=60}),at={across:.6,down:.25},_=new Map;for(let t of nt){let o=J(t),l=o.getBoundingClientRect(),y=[],B=[],j=[...t.querySelectorAll("text")].filter(E=>!E.closest("defs, clipPath, mask, pattern, marker, symbol")&&L(E.textContent)&&C(E));for(let E of j){let g=Y(E),W=F(E).map(([ot,lt,ut])=>[ot,k(g,lt,ut)]).find(([,ot])=>ot>1.5);W?y.push(`${U(E.textContent,24)} ${q(W[1])}px past ${W[0]}`):k(g,l)>1.5&&B.push(`${U(E.textContent,24)} ${q(k(g,l))}px past the card's edge`)}y.length&&A("chart-text-clipped",t,tt(y),{picture:o}),B.length&&A("chart-text-outside",t,tt(B),{picture:o});let f=E=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(E.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=E=>E.every(Number.isFinite)&&E[1]!==E[0]&&E.slice(2).every((g,W)=>Math.abs(g-E[W+1]-(E[1]-E[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let E of t.querySelectorAll("g")){let g=[...E.children].filter(V=>V.matches("g.tick")&&C(V)),W=g.map(V=>V.querySelector("text")).filter(V=>V&&L(V.textContent)&&C(V)),ot=W.map(V=>L(V.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(f)))continue;let lt=W.map(V=>{let kt=V.getScreenCTM(),Ne=(parseFloat(getComputedStyle(V).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:V,box:Y(V),size:Ne,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(lt.some(V=>V.turned||!(V.size>0)))continue;let ut=lt.map(({box:V})=>[(V.left+V.right)/2,(V.top+V.bottom)/2]),st=Math.max(...ut.map(([V])=>V))-Math.min(...ut.map(([V])=>V))>=Math.max(...ut.map(([,V])=>V))-Math.min(...ut.map(([,V])=>V)),mt=({box:V,size:kt})=>st?[V.left,V.right]:[(V.top+V.bottom-kt)/2,(V.top+V.bottom+kt)/2],St=[...lt].sort((V,kt)=>mt(V)[0]-mt(kt)[0]),wt=null;for(let V=1;V<St.length;V++){let kt=mt(St[V])[0]-mt(St[V-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[V-1],St[V]]})}let Ct=Math.max(...lt.map(V=>V.size));if(!wt||wt.gap>=at[st?"across":"down"]*Ct)continue;for(let{label:V}of lt)_.set(V,E);let[Bt,Et]=wt.pair.map(({label:V})=>U(V.textContent,16)),Te=wt.gap<0?`${Bt} and ${Et} overlapping by ${q(-wt.gap)}px`:`${Bt} and ${Et} ${q(wt.gap)}px apart`;A("ticks",t,`${ot.length} tick labels ${st?"across":"down"} a ${q(st?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${Te}, under ${st?"a digit's width and a hair":"a quarter of a line"} at their ${q(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let ft=t=>{let o=t.getBBox(),l=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,y=o.y+Math.max(0,(o.height-l)/2),B=y+Math.min(o.height,l),j=t.getScreenCTM();return[[o.x,y],[o.x+o.width,y],[o.x+o.width,B],[o.x,B]].map(([f,S])=>new DOMPoint(f,S).matrixTransform(j))},dt=(t,o)=>{let l=1/0;for(let y of[t,o])for(let B=0;B<y.length;B++){let j=y[B],f=y[(B+1)%y.length],S=Math.hypot(f.x-j.x,f.y-j.y);if(S===0)continue;let E={x:-(f.y-j.y)/S,y:(f.x-j.x)/S},g=ut=>ut.map(st=>st.x*E.x+st.y*E.y),[W,ot]=[g(t),g(o)],lt=Math.min(Math.max(...W),Math.max(...ot))-Math.max(Math.min(...W),Math.min(...ot));if(lt<=0)return 0;l=Math.min(l,lt)}return l===1/0?0:l},it=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&L(o.textContent)&&C(o));for(let t of nt){let o=it(t).map(y=>({label:y,outline:ft(y)})),l=[];o.forEach(({label:y,outline:B},j)=>{for(let f of o.slice(j+1))_.has(y)&&_.get(y)===_.get(f.label)||dt(B,f.outline)>1.5&&l.push(`${U(y.textContent,20)} and ${U(f.label.textContent,20)} overlap`)}),l.length&&A("chart-text-overlap",t,tt(l),{picture:J(t)})}let rt=11;for(let t of nt){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let B of it(t)){let j=B.getScreenCTM(),f=parseFloat(getComputedStyle(B).fontSize);if(!j||!(f>0))continue;let S=f*Math.hypot(j.c,j.d);S<rt-.05&&o.push(`${U(B.textContent,24)} at ${S.toFixed(1)}px (font-size ${+f.toFixed(2)})`)}if(!o.length)continue;let l=t.viewBox.baseVal,y=`${o.length} text${o.length>1?"s":""}`;A("svg-text-small",t,`${y} of a drawing scaled by its viewBox (${+l.width.toFixed(2)}\xD7${+l.height.toFixed(2)} drawn ${q(t.getBoundingClientRect().width)}px wide) render below ${rt}px: ${tt(o)}`,{picture:J(t)})}let b=new Set;for(let t of d.querySelectorAll(".doc-table-wrap")){if(m(t)||!C(t))continue;b.add(t);let o=t.querySelector("table");if(!o)continue;let l=Math.max(t.clientWidth,o.offsetWidth),y=Math.max(t.clientHeight,o.offsetHeight),B=l>t.clientWidth+r,j=y>t.clientHeight+r,f=X(t);(B||j)&&A("table-scrolls",t,[B&&`${l}px wide in a ${t.clientWidth}px frame`,j&&`${y}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:B,down:j,name:f}});let S=globalThis.__qaTableHides(t,o);S.said&&A("table-columns",t,`${S.said}: the table is ${l}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&A("table-rows",t,`the frame shows ${S.shown} of ${S.rows} rows: a reader scrolls inside it for the other ${S.rows-S.shown}; style="--doc-table-height: none" on its div.doc-table-wrap shows every row (or split the table where its content divides)`)}let z=t=>!!t.closest("details[data-qa-closed]"),P="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of d.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!C(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&C(o)){let y=z(t);if(o.scrollHeight>o.clientHeight+r){let B=[t,o].map(E=>E.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),j=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,f=[...o.querySelectorAll(".doc-code-line")].filter(E=>E.getClientRects().length>0&&E.getBoundingClientRect().top>=j-1).length,S=y?`, ${P} inside it for the rest`:B?`, the block's own height (--doc-code-height: ${B}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";A("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${f?` (its last ${f} line${f===1?"":"s"} below it)`:""}${S}`,{level:y||B?"info":void 0})}if(o.scrollWidth>o.clientWidth+r){let B=t.classList.contains("doc-code--nowrap"),j=y?`, ${P} sideways for the rest`:B?", its lines left unwrapped (doc-code--nowrap, the author's or the reader's choice): a reader scrolls sideways for the rest of its long lines":": a reader scrolls sideways for the rest";A("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${j}`,{level:y||B?"info":void 0})}}let l=t.querySelector(":scope > .doc-code-title");l&&C(l)&&l.scrollWidth>l.clientWidth+1&&A("code-title-cut",t,`its title ${U(l.textContent,48)} is cut to fit its header (${l.scrollWidth}px of words in ${l.clientWidth}px)`)}for(let t of d.querySelectorAll(".doc-math-block")){if(m(t)||!C(t)||t.scrollWidth<=t.clientWidth+r)continue;let o=z(t);A("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${P} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of d.querySelectorAll("[data-doc-layout]"))m(t)||!C(t)||A("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:b.has(t)});let K=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),R=new Map;for(let t=K.nextNode();t;t=K.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!C(o))continue;let l=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(l)||R.set(l,t.nodeValue)}for(let[t,o]of R){let l=o.search(/\\\(|\\\[|\$\$/);A("raw-formula",t,`${U(o.slice(l,l+40),40)} is shown as written: the kit's math did not render it`)}for(let t of d.querySelectorAll(".katex-error"))m(t)||!C(t)||A("formula-error",t,`${U(t.textContent,32)}: ${L(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,i=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},T=t=>[...["src","href","poster","data"].filter(o=>t.hasAttribute(o)&&!(o==="href"&&t.matches("a, area"))).map(o=>t.getAttribute(o)),...(t.getAttribute("srcset")??"").split(",").map(o=>o.trim().split(/\s+/)[0]),...[t.getAttribute("style"),t.localName==="style"?t.textContent:""].flatMap(o=>[...String(o??"").matchAll(/url\(\s*["']?([^"')]+)/g)].map(l=>l[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(i),N=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>T(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let l=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,y=N.find(j=>l?!a.has(j)&&j.address.startsWith(l):j.address===t);y&&l&&a.add(y);let B=y?.node??null;e&&!(B&&d.contains(B))||A("blocked",B,`${o} blocked ${I(y?.address??t)}${B?` (${D(B)})`:""}: the export holds every file it shows`,{url:y?.address??t})}for(let t of d.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?i(t.currentSrc||t.src):"";A("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let O=new Set(u),G=new Set(w),et=document.createRange(),$t="button, select, input, textarea, [data-doc-dev]",yt=(t,o)=>t!==o&&(t.matches($t)||[...t.classList].some(l=>l.startsWith("doc-"))),xt=(t,o,l)=>{let y=[],B=!1;for(let j=t,f=!0;j&&j!==document.body&&j!==document.documentElement;j=j.parentElement,f=!1){let S=getComputedStyle(j);if((!f||l)&&(B&&(S.position!=="static"||S.transform!=="none")&&(B=!1),!B)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(j,o)&&y.push(j)}if(S.position==="fixed")break;S.position==="absolute"&&(B=!0)}return y},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Ft=t=>{let o=getComputedStyle(t),l=y=>!/^(transparent|rgba\(.*,\s*0\))$/.test(y);return l(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(y=>parseFloat(o[`border${y}Width`])>0&&o[`border${y}Style`]!=="none"&&l(o[`border${y}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let l=new Map,y=(f,S,E,g)=>{if(!l.has(f)&&l.size>=3)return;let W=l.get(f)??{words:[],marks:[],depth:0,height:f.getBoundingClientRect().height};E&&W.words.push(E),g&&W.marks.push(g),W.depth=Math.max(W.depth,S),l.set(f,W)},B=f=>f.getBoundingClientRect().height>1.5,j=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let f=j.nextNode();f;f=j.nextNode()){let S=f.parentElement;if(!f.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!C(S)||o(S))continue;let E=xt(S,t,!0).filter(B);if(E.length===0)continue;let g=getComputedStyle(S),W=parseFloat(g.lineHeight);for(let ot of f.nodeValue.matchAll(/\S+/g)){let lt=ot.index+ot[0].length;et.setStart(f,ot.index),et.setEnd(f,lt);let ut=[...et.getClientRects()];for(let st of ut){let mt=Number.isFinite(W)?Math.max(0,(st.height-W)/2):0,St=E.find(Ct=>st.bottom-bt(Ct)>1.5+mt);if(!St)continue;let wt=ot.index;if(ut.length>1){let Ct=bt(St)+1.5+mt;for(let Bt=lt-1;wt<Bt;){let Et=wt+Bt>>1;et.setStart(f,Et),et.setEnd(f,Et+1),(et.getClientRects()[0]?.bottom??0)>Ct?Bt=Et:wt=Et+1}}y(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),f.nodeValue.slice(wt,lt),null);break}}}for(let f of t.querySelectorAll("*")){let S=f instanceof SVGElement&&f.matches(Nt)&&!f.closest("defs, clipPath, mask, pattern, marker, symbol"),E=!S&&!(f instanceof SVGElement)&&!f.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&f.children.length===0&&!f.textContent.trim()&&Ft(f);if(!S&&!E||!C(f))continue;let g=f.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let W=S?f.ownerSVGElement:null,ot=[...W&&getComputedStyle(W).overflowY!=="visible"?[W]:[],...xt(W??f,t,!!W)].filter(B),lt=st=>{let mt=st.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(st=>g.bottom-bt(st)>1.5&<(st));ut&&y(ut,g.bottom-bt(ut),null,S?f.localName:D(f))}return l};for(let t of d.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),l=G.has(o);if(!l&&!O.has(o)||m(t)||!C(t))continue;let y=f=>f.closest(".doc-chart-message")||f.closest("h2, h3, h4, p, figcaption")?.parentElement===t,B=new Map,j=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let f=j.nextNode();f&&B.size<3;f=j.nextNode()){let S=f.parentElement;if(!f.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!C(S)||l&&y(S))continue;let E=S;for(;E!==t&&["inline","contents"].includes(getComputedStyle(E).display);)E=E.parentElement;let g=!1;for(let st=S;st&&!g;st=st===t?null:st.parentElement){let mt=getComputedStyle(st);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let W=getComputedStyle(E),ot=E.getBoundingClientRect(),lt=ot.left+parseFloat(W.borderLeftWidth)+parseFloat(W.paddingLeft),ut=ot.right-parseFloat(W.borderRightWidth)-parseFloat(W.paddingRight);for(let st of f.nodeValue.matchAll(/\S+/g)){et.setStart(f,st.index),et.setEnd(f,st.index+st[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,lt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>h+1))continue;let wt=B.get(E)??{words:[],reach:0,width:ut-lt};wt.words.push(st[0]),wt.reach=Math.max(wt.reach,St),B.set(E,wt)}}for(let[f,{words:S,reach:E,width:g}]of B)A("overflow-in-block",f,`the words ${U(S.join(" "),40)} run ${q(E)}px past the side of ${D(f)} (${q(g)}px wide for its words), over what is beside it`,{picture:t});for(let[f,{words:S,marks:E,depth:g,height:W}]of Tt(t,l?y:()=>!1)){let ot=[S.length&&`the words ${U(S.join(" "),40)}`,E.length&&`${E.length===1?"a mark":`${E.length} marks`} (${[...new Set(E)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),lt=S.length===0&&E.length===1;A("cut-in-block",f,`${ot} ${lt?"reaches":"reach"} ${q(g)}px past the bottom of ${D(f)} (${q(W)}px tall, its overflow ${getComputedStyle(f).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>h+1){let t=g=>{for(let W=g.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...d.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>h+1&&C(g)&&t(g)),l=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),y=`the page is ${document.documentElement.scrollWidth}px wide in a ${h}px window`,B=new Set(o),j=g=>{for(let W=g.parentElement;W;W=W.parentElement)if(B.has(W))return!0;return!1},f=new Map,S=document.createRange(),E=document.createTreeWalker(d,NodeFilter.SHOW_TEXT);for(let g=E.nextNode();g&&f.size<3;g=E.nextNode()){let W=g.parentElement;if(!W||!g.nodeValue.trim()||W.closest("svg, script, style, template")||m(W)||j(g)||!C(W)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(st=>st.right>h+1)))continue;let ot=W.closest("[data-block-id]")??W;if(f.has(ot))continue;let lt=[],ut=0;for(let st of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,st.index),S.setEnd(g,st.index+st[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=h+1||(lt.push(st[0]),ut=Math.max(ut,mt))}lt.length&&f.set(ot,{node:W,words:lt.join(" "),right:ut})}S.detach(),l.length===0&&f.size===0&&!e&&A("overflow",null,y);for(let g of l)A("overflow",g,`${y}: ${D(g)} ${U(g.textContent,24)} reaches ${q(g.getBoundingClientRect().right)}px`);for(let[g,{node:W,words:ot,right:lt}]of f)A("overflow",W,`${y}: the words ${U(ot,60)} in ${D(g)} run past its edge to ${q(lt)}px (a text that cannot break)`,{picture:g})}return{found:$,next:n}}function po(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(c=>!e(c)).length;return{charts:n("[data-doc-chart]"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Ot=2e4,Se=1800;function ke(e,n,s){let c=0,r=new Promise((u,w)=>{c=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,r]).finally(()=>clearTimeout(c))}var Yt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function go(e,n,s,{out:c,tiles:r=!1,blocks:u=[],around:w=new Map,held:d=new Map,whole:$=[],drawn:h=[],known:q=null}){let{width:L,height:U=900,label:m=String(L)}=typeof s=="number"?{width:s}:s,C=m.replace("\xD7","x"),D=await e.createBrowserContext(),x=await D.newPage();x.setDefaultTimeout(Ot);let H=[],M=[],Z=new Set,X=new Map,gt=new Set,p=new Set,A=new Set,J="",Q=0,k=(b,z,P={})=>H.push({kind:b,what:z,anchor:null,shot:null,seen:!1,state:J,...P}),v=Pe(n).href,Y=b=>`"${$e(b,v)}"`,F=b=>c.folders?.get(b)??c.blocks,tt=b=>b.replace(/[^\w-]/g,"_");x.on("pageerror",b=>k("error",`uncaught ${It(b.message).slice(0,200)}`)),x.on("console",b=>{b.type()==="error"&&se(b,v)&&k("error",`console: ${It(b.text()).slice(0,200)}`)}),x.on("requestfailed",b=>{b.frame()===x.mainFrame()&&k("request",`${Y(b.url())}: ${b.failure()?.errorText??"failed"}`,{url:b.url()})}),x.on("response",b=>{b.status()>=400&&b.request().frame()===x.mainFrame()&&k("request",`${Y(b.url())}: HTTP ${b.status()}`,{url:b.url()})}),await ae(x),await x.evaluateOnNewDocument(`globalThis.__qaUrlName = ${$e}; globalThis.__qaTableHides = ${Ye()};`),await x.setViewport({width:L,height:U}),await x.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let ct=async b=>{for(let z of await re(x,{timeout:Ot}))k("unverified",`${b}: waited for ${z}`)},nt=async(b,z,P,K)=>ke(x.screenshot({path:P,clip:b,captureBeyondViewport:!z}),Ot,"the picture").then(()=>!0,R=>(k("unverified",`no picture of ${K} (${R.message})`),!1)),at=async(b,z,P,K=0)=>{let R=await x.evaluate(uo,{selector:b,up:K,margin:Qe,frames:Ze}).catch(I=>({error:I}));return R?.clip?await nt(R.clip,R.fixed,z,P)?R.clip:null:(k("unverified",`no picture of ${P} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},_=(b,z)=>b.left<z.x+z.width&&b.right>z.x&&b.top<z.y+z.height&&b.bottom>z.y,ft=async()=>{let b=u.filter(P=>!gt.has(P)),z=await x.evaluate((P,K,R)=>{let I=new Map(P.map((O,G)=>[O,G])),i=O=>!!O&&!O.closest("[data-doc-dev], dialog:not([open])")&&O.getClientRects().length>0,T=O=>O===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===O&&i(G))??null,N=O=>{if(!O)return null;let G=O.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let O of document.querySelectorAll("[data-block-id]")){let G=I.get(O.getAttribute("data-block-id"));if(G===void 0||!i(O))continue;I.delete(O.getAttribute("data-block-id")),O.setAttribute("data-qa-block",String(G));let[et,$t]=K[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...O.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&i(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:K[G]?{block:N(O),above:N(T(et)),below:N(T($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:N(bt)}))})}return a},b,b.map(P=>w.get(P)??null),b.map(P=>d.get(P)??[]));for(let{index:P,boxes:K,held:R}of z){let I=b[P];gt.add(I);let i=`${C}-${tt(I)}`,T=[];if(!K){let N=ht.join(F(I),`${i}.png`),a=await at(`[data-qa-block="${P}"]`,N,`the block ${I}`);a&&(M.push({block:I,file:N}),T.push(a))}for(let{part:N,clip:a}of K?eo(K):[]){let O=ht.join(F(I),`${i}${N?`-${N}`:""}.png`);await nt(a,!1,O,`the block ${I}${N?` (its ${N})`:""}`)&&(M.push({block:I,file:O}),T.push(a))}for(let{id:N,box:a}of R)T.some(O=>_(a,O))?p.add(N):p.has(N)||A.add(N);await x.evaluate(N=>document.querySelector(`[data-qa-block="${N}"]`)?.removeAttribute("data-qa-block"),P)}},dt=async(b,z,P)=>{let K=[...d].filter(([I])=>gt.has(I)).map(([I,i])=>[I,i.filter(T=>!p.has(T))]).filter(([,I])=>I.length);if(!K.length)return;let R=await x.evaluate((I,i)=>{let T=document.querySelector(I);if(!T)return[];let N=a=>[...T.querySelectorAll("[data-block-id]")].some(O=>O.getAttribute("data-block-id")===a&&O.getClientRects().length>0);return i.map(([a,O])=>[a,O.filter(N)]).filter(([,a])=>a.length)},b,K);for(let[I,i]of R){let T=ht.join(F(I),`${C}-${tt(I)}-${z}.png`);if(await at(b,T,`the block ${I} (${z})`,P)){M.push({block:I,part:z,file:T});for(let N of i)p.add(N),A.delete(N)}}},it=async b=>{let z=await x.evaluate(Dt,{scope:b,next:Q,ignored:Ve,slack:Je,whole:$,drawn:h});Q=z.next;let P=z.found.flatMap(R=>R.kind!=="layout"?[R]:Ge(R.what,L).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:i})=>({...R,kind:I,what:`the kit notes ${i}`})));for(let R of P){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,i=I&&X.get(I);if(i)!i.seen&&R.seen&&Object.assign(i,R,{state:J});else{let T={...R,state:J};H.push(T),I&&X.set(I,T)}}let K=new Set(H.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of H){if(R.shot===null||!R.seen||Z.has(R.shot)||!Xe(R,L)||q?.has(Yt(R))||["request","image"].includes(R.kind)&&K.has(R.url))continue;Z.add(R.shot);let I=ht.join(c.flagged,`${C}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&M.push({shot:R.shot,file:I})}u.length&&await ft()},rt=b=>{let z=new Set(H.filter(K=>K.kind==="blocked").map(K=>K.url));return{findings:H.filter(K=>!(["request","image"].includes(K.kind)&&z.has(K.url))&&!q?.has(Yt(K))),counts:b,pictures:M,held:{covered:[...p],missed:[...A]}}};try{try{let i=new Promise(N=>x.once("domcontentloaded",N)),T=x.goto(v,{waitUntil:"load",timeout:6e4});if(T.catch(()=>{}),await Promise.race([i,T]),x.url()!==v)throw new Error(`the browser shows ${x.url()}`)}catch(i){return k("unverified",`the page did not load: ${i.message}`),rt(null)}await ct("the page as it opens");let b=await x.evaluate(fo,Ot);b.loaded||k("unverified",`the pictures (${b.images}) not all loaded in ${Ot/1e3}s`),b.closed&&await ct(`the page with its ${b.closed} closed disclosure${b.closed===1?"":"s"} opened`),await it(null);let z=async(i,T,N,a=null)=>{for(let O=i,G=1;O<T;O+=Se,G++){let et=ht.join(c.tiles,`${C}-${N}${String(G).padStart(2,"0")}.png`);await ke(x.screenshot({path:et,clip:{x:0,y:O,width:L,height:Math.min(Se,T-O)},captureBeyondViewport:!0}),Ot,"a tile").then(()=>M.push({tile:!0,sheet:a,file:et}),$t=>k("unverified",`no tile ${N}${G} (${$t.message})`))}};r&&await z(0,await x.evaluate(()=>document.documentElement.scrollHeight),"");let P=async(i,T=null)=>{if(!await x.evaluate(be,i.chain)){let{anchor:N}=await x.evaluate(Dt,{next:Q,place:`[data-qa-tab="${i.index}"]`});return k("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:N}),!1}if(await ct("the Sheet shown"),await it(`[data-qa-panel="${i.index}"]`),await dt(`[data-qa-panel="${i.index}"]`,`sheet${i.index+1}`,1),r&&T)await K(T,`sheet${i.index+1}-`);else if(r){let N=await x.evaluate(a=>{let O=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return O&&O.height>0?{top:Math.max(0,O.top+scrollY),bottom:O.bottom+scrollY}:null},i.index);N&&await z(N.top,N.bottom,`sheet${i.index+1}-`,{number:i.index+1,label:i.label})}return!0},K=async(i,T="")=>{for(let N=1;N<=20;N++){let a=await x.evaluate((G,et)=>{let $t=document.querySelector(`[data-qa-card="${G}"]`),yt=$t?.querySelector(".doc-dialog-content")??$t;if(!yt)return null;if(et)yt.scrollTop=0;else{let bt=yt.scrollTop;if(yt.scrollTop+=Math.max(40,yt.clientHeight-24),yt.scrollTop===bt)return null}let xt=$t.getBoundingClientRect();return{x:xt.left+visualViewport.pageLeft,y:xt.top+visualViewport.pageTop,width:xt.width,height:xt.height}},i.index,N===1);if(!a)break;let O=ht.join(c.tiles,`${C}-card${i.index+1}-${T}${String(N).padStart(2,"0")}.png`);await nt(a,!0,O,`the detail card ${Mt(i.label,24)}, tile ${T}${N}`)&&M.push({tile:!0,card:{number:i.index+1,label:i.label,part:T},file:O})}},R=0;for(let i of b.sheets)i.shown||!i.panel||i.card!==null||(J=`Sheet ${Mt(i.label,24)}`,await P(i)&&(R+=1));let I=0;for(let i of b.cards){J=`detail card ${Mt(i.label,24)}`;let T=`[data-qa-card="${i.index}"]`;i.chain.length&&await x.evaluate(be,i.chain);for(let N of i.within)await x.evaluate(ye,N);if(!await x.evaluate(ye,i.index)){let{anchor:N}=await x.evaluate(Dt,{next:Q,place:T});k("unverified","this detail card could not be opened",{anchor:N});for(let a of i.within.toReversed())await x.evaluate(_t,a);continue}I+=1,await ct("the detail card opened"),await it(T),await dt(T,`card${i.index+1}`,0),r&&await K(i);for(let N of b.sheets)N.card!==i.index||N.shown||!N.panel||(J=`detail card ${Mt(i.label,24)}, Sheet ${Mt(N.label,24)}`,await P(N,i)&&(R+=1));await x.evaluate(_t,i.index);for(let N of i.within.toReversed())await x.evaluate(_t,N)}return J="",rt({...await x.evaluate(po),details:b.details,closed:b.closed,sheets:R,cards:b.cards.length,cardsOpened:I})}catch(b){return k("unverified",`the look ended early: ${b.message}`),rt(null)}finally{await D.close().catch(()=>{})}}var Be=e=>e.split(ht.sep).join("/"),pt=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ht=e=>`${e.join(", ")}px`,mo=e=>e.includes("\xD7")?e:`${e}px`;function wo({details:e,closed:n}){if(e===0)return"0 disclosures";let s=n===0?"open in the file":`${n===e?"":`${n} `}closed in the file, opened for the pictures`;return`${pt(e,"disclosure")} (${s})`}function $o(e,n=null){let s=new Map;for(let c of e){let r=n?ht.relative(n,c):"",u=Be(n&&r&&!r.startsWith("..")&&!ht.isAbsolute(r)?r:c),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(u),d=w?`${w[1]??""}\0${w[3]}`:u;s.has(d)||s.set(d,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:u});let $=s.get(d);w&&!$.looks.includes(w[2])&&$.looks.push(w[2])}return[...s.values()].map(c=>c.whole??`${c.head}${c.looks.length>1?`{${c.looks.join(",")}}`:c.looks[0]}-${c.tail}`)}var Oe=(e="<slug>")=>`more pictures: gallery qa ${e} --tiles (the page, each Sheet panel and each detail card in tiles), gallery qa ${e} --blocks <id,\u2026> (the blocks you name)`,en=Oe(),Re=he,ve='look at the export yourself at 1024, 736 and 360px, its disclosures and detail cards opened (SKILL.md, "Export, check and look"), and say so when you hand the document over.',xo=e=>It(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),zt={overflow:"a reader scrolls the whole page sideways. Words that cannot break where they stand (a long path, URL or name): wrap each in <code>, which breaks where it must and keeps it whole for the reader to copy; an element wider than the window (a picture, a drawing, a width of your own): let it fit (max-width: 100%) or put it in a frame that scrolls; never cut or rewrite a path to silence this","table-columns":"not a failure. If the reader must see the column on a desktop, write its long values compactly (a cell of numbers stays on one line, so its longest value sets the column's width: a range as a\u2013b, fewer digits), move a unit out of its header into the line above the table, shorten the header, or split the table; never delete a column to silence this","chart-text-overlap":"not a failure. If the reader must read both, shorten the labels (a unit belongs in the axis's title), move one (above its row, or a leader line) or give the drawing more room at this width; never delete a label or a category to silence this","code-scrolls":'not a failure. A reader scrolls inside the frame (40 lines) for the rest; if every line must show at once, write style="--doc-code-height: none" on its <pre>; never delete code to silence this',"formula-scrolls":"not a failure. A reader scrolls the formula sideways for the rest; if it must show whole at this width, break it into lines (\\begin{aligned} \u2026 \\end{aligned}) or into two formulas; never cut a term to silence this","overflow-in-block":"not a failure. If the words run over others in the picture, give their box room at this width (a wider column in an @media rule of your <style>, or a smaller font there), or let them break (a dash or a space where a line may end); never cut the words to silence this","cut-in-block":"not a failure. If the reader must see what is cut, let the box grow with what it holds (min-height instead of height or max-height, or none), give it room at this width in an @media rule of your <style>, or let it scroll (overflow: auto); never delete the words to silence this",ticks:"not a failure. If the numbers crowd in the picture, give that axis fewer ticks at this width with axis.tickValues([...]), at most four on a phone (the domain's ends and middle; ticks(n) is only a hint to d3 and can still draw five or more), or shorter numbers (the unit in the axis's title: 2k, 1.5\u4E07); never take the axis out to silence this","svg-text-small":"not a failure. The viewBox scales the drawing's text with it: give the text a larger font-size in the viewBox's units (a viewBox 800 wide drawn 340px wide scales by 0.43, so 26 units read as 11px), or lay the drawing out for narrow widths (a viewBox of its own under an @media rule, a chart of your own drawn from its width, or HTML that wraps); never drop the labels to silence this"},yo='not a failure. A reader scrolls sideways for the rest of its long lines; if the reader must see them whole at this width, let them wrap (take data-wrap="false" off its <pre>) or break them where the code allows; a tree or a log whose lines must stay whole may scroll; never cut a line to silence this';function bo(e){if(e.kind!=="code-scrolls")return zt[e.kind]?[zt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(c=>/ wide, its frame /.test(c));return[...!s||n.some(c=>/ tall, its frame /.test(c))?[zt["code-scrolls"]]:[],...s?[yo]:[]]}var So="none is a failure: each says what to do if it matters to the reader (never delete a column or a label to silence one)",ko="a reader scrolls it: not a problem";function vo(e,n,s=null,{folder:c=null,slug:r="<slug>"}={}){let u=[],w=Object.fromEntries(At.map(p=>[p,0])),d=new Map,$=new Set,h=new Map,q=[],L=p=>$o(p,c),U=p=>p.label??String(p.width),m=new Map(e.flatMap(p=>p.pictures.filter(A=>A.shot!==void 0).map(A=>[`${U(p)}|${A.shot}`,A.file])));for(let p of e){let{width:A,findings:J,counts:Q}=p,k=U(p),v=new Set,Y=Object.fromEntries(At.map(_=>[_,0])),F={right:0,down:0,all:0};for(let _ of J){let ft=`${_.kind}|${_.shot??""}|${_.what}`;if(v.has(ft))continue;v.add(ft);let dt=Ce(_,A);Y[dt]+=1;let it=so(_.anchor,n);if(_.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:i=""}=_.scroll??{};Object.assign(F,{all:F.all+1,right:F.right+Number(R),down:F.down+Number(I)});let T=`${it}|${i}`;h.has(T)||h.set(T,{place:it,name:i,right:[],down:[]}),R&&!h.get(T).right.includes(k)&&h.get(T).right.push(k),I&&!h.get(T).down.includes(k)&&h.get(T).down.push(k)}if(dt==="info"&&$.add(`${_.kind}|${it}`),dt==="info"&&["table-scrolls","table-columns","table-rows"].includes(_.kind))continue;let rt=`${At.indexOf(dt)}|${_.kind}|${it}`;d.has(rt)||(d.set(rt,{level:dt,kind:_.kind,place:it,said:new Map}),dt!=="info"&&(w[dt]+=1));let b=d.get(rt).said,z=`${_.state?`[${_.state}] `:""}${_.what}`;b.has(z)||b.set(z,{labels:[],pictures:[]});let P=b.get(z);P.labels.includes(k)||P.labels.push(k);let K=m.get(`${k}|${_.shot}`);K&&!P.pictures.includes(K)&&P.pictures.push(K)}let tt=[F.right&&`\u2192 ${F.right}`,F.down&&`\u2193 ${F.down}`].filter(Boolean).join(", "),ct=`${pt(F.all,"table scrolls","tables scroll")}${tt?` (${tt})`:""}`,nt=Q?.cards?`, ${pt(Q.cards,"detail card")} (${Q.cardsOpened===Q.cards?"closed in the file, opened in turn":`${Q.cardsOpened??0} of them opened`})`:"",at=p.laptop?"; only what the 1024px look did not find":Q?`; ${pt(Q.charts,"chart")}, ${pt(Q.tables,"table")}, ${wo(Q)}, ${pt(Q.sheets,"Sheet")} shown besides the first${nt}, page ${Q.height}px tall`:"";q.push({label:k,fail:Y.fail,warn:Y.warn,line:`${p.laptop?k:`${k.padStart(4)}px`} fail ${Y.fail} \xB7 warn ${Y.warn} \xB7 unverified ${Y.unverified} \xB7 ${ct}${at}`})}let C=[...d.values()].sort((p,A)=>At.indexOf(p.level)-At.indexOf(A.level)),D=e.flatMap(p=>p.pictures);if(c&&D.length&&u.push(`Pictures of this run in ${Be(c)}/ (each path below is in it):`),s){let p=new Map;for(let k of D)k.block!==void 0&&p.set(k.block,[...p.get(k.block)??[],k.file]);let A=Ae(e),J=k=>`${s.tags?.get(k)?`${s.tags.get(k)} `:""}${k}`,Q=`at ${ge.slice(0,-1).join(", ")} and ${ge.at(-1)}px`;s.tiles&&s.why&&u.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let k of s.groups??[]){if(!k.ids.length&&!k.rest.length)continue;let v=!k.ids.length&&s.groups.some(Y=>Y!==k&&Y.ids.length)?`: none this run (the ${Ee} blocks a run pictures went to the changed blocks above)`:"";u.push(`${k.why[0].toUpperCase()}${k.why.slice(1)}${k.ids.length?`, ${Q}`:v}:`);for(let Y of k.ids){let F=n.blocks.get(Y),tt=`${F?`${n.name??"doc.html"}:${F}`:`(not in ${n.name??"doc.html"})`} ${Y}${s.tags?.get(Y)?` ${s.tags.get(Y)}`:""}`,ct=p.get(Y)??[],nt=s.moved?.has(Y)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(Y)??[],_=at.filter(P=>s.changed?.has(P)).length,ft=k.kind==="named"?pt(at.length,"block"):[_&&pt(_,"changed block"),at.length-_&&pt(at.length-_,"card")].filter(Boolean).join(" and "),dt=D.some(P=>P.block===Y&&P.part)?", pictured again with each Sheet panel or detail card that holds one":"",it=at.filter(P=>A.has(P)),rt=[...new Set(it.flatMap(P=>A.get(P)))].map(P=>P.includes("\xD7")?P:`${P}px`).join(", "),b=it.length?`; ${it.length} of them not pictured at ${rt}: gallery qa ${r} --blocks ${it.join(",")}`:"",z=at.length?` (with the ${ft} it holds${dt}${b})`:"";u.push(ct.length?` ${tt}${nt}${z}: ${L(ct).join(", ")}`:` ${tt}${nt}${z}: not shown at any width (hidden)`)}if(k.rest.length){let Y=pt(k.rest.length,{changed:"changed block",cards:"card"}[k.kind]??"block"),F=`${k.rest.slice(0,6).map(J).join(", ")}${k.rest.length>6?", \u2026":""}`;u.push(` ${k.ids.length?"and ":""}${Y}${k.ids.length?" more":""}, not pictured (${F}): gallery qa ${r} --blocks ${k.rest.join(",")}`)}}s.unknown.length&&u.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let x=[];for(let p of C)for(let{pictures:A}of p.said.values())x.push(...A.filter(J=>!x.includes(J)));x.length&&u.push("The elements flagged below, look at these first:",...L(x).map(p=>` ${p}`));let H=D.filter(p=>p.tile),M=H.filter(p=>!p.sheet&&!p.card);M.length&&u.push(`The page as it opens (each Sheet area with the panel it shows first): ${pt(M.length,"tile")} in ${L([ht.dirname(M[0].file)])[0]}/ (<width>-<n>.png)`);let Z=new Map;for(let{sheet:p}of H)p&&Z.set(p.number,{...p,count:(Z.get(p.number)?.count??0)+1});Z.size&&u.push(`Each other Sheet panel, shown in turn: ${pt(H.filter(p=>p.sheet).length,"tile")} in ${L([ht.dirname(H.find(p=>p.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...Z.values()].map(({number:p,label:A,count:J})=>`sheet${p} ${Mt(A,24)} ${pt(J,"tile")}`).join(", ")}`);let X=new Map;for(let{card:p}of H)p&&X.set(p.number,{...p,count:(X.get(p.number)?.count??0)+1});X.size&&u.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${pt(H.filter(p=>p.card).length,"tile")} in ${L([ht.dirname(H.find(p=>p.card).file)])[0]}/ (<width>-card<i>-<n>.png${H.some(p=>p.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...X.values()].map(({number:p,label:A,count:J})=>`card${p} ${Mt(A,24)} ${pt(J,"tile")}`).join(", ")}`);for(let{place:p,name:A,right:J,down:Q}of h.values()){let k=/^(?:doc|report)\.html:\d+/.exec(p)?.[0]??p;u.push(`${"INFO".padEnd(10)} table-scrolls: ${k}${A?` ${Mt(A,32)}`:""}: ${[J.length&&`\u2192 ${Ht(J)}`,Q.length&&`\u2193 ${Ht(Q)}`].filter(Boolean).join("; ")} (${ko})`)}for(let p of C){u.push(`${p.level.toUpperCase().padEnd(10)} ${p.kind}: ${p.place}`);for(let[A,{labels:J,pictures:Q}]of p.said)u.push(` ${Ht(J)}: ${A}${Q.length?` (${L(Q).join(", ")})`:""}`);for(let A of bo(p))u.push(` ${A}`)}u.push(...q.map(({line:p})=>p));let gt=Mo(s,r);return gt&&u.push(gt),w.info=$.size,{lines:u,levels:w,looks:q.map(({label:p,fail:A,warn:J})=>({label:p,fail:A,warn:J}))}}function Mo(e,n="<slug>"){let{changed:s=[],restyled:c=[],packages:r=[],cards:u=[],since:w="the last look",first:d=!1}=e?.left??{};if(!s.length&&!c.length&&!u.length)return null;let $=q=>`${q.slice(0,6).map(L=>`${e.tags?.get(L)?`${e.tags.get(L)} `:""}${L}`).join(", ")}${q.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${pt(s.length,"block")} changed or moved since ${w} (${$(s)})`,c.length&&`${pt(c.length,"instance")} of a package changed since ${w}, ${r.join(", ")} (${$(c)})`,u.length&&(d?`no earlier look: ${pt(u.length,"card")} never pictured (${$(u)})`:`${pt(u.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${$(u)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function Co(e,n,s=[],{unpictured:c=!1}={}){let r=n.map(({label:q,fail:L,warn:U})=>`${mo(q)} fail ${L}, warn ${U}`).join("; "),u=r?` (${r})`:"",w=Oe(s.length===1?s[0].slug:void 0),d={stale:"its file had changed since its export",missing:"it had none yet"},$=s.filter(({first:q})=>q).map(({slug:q,first:L})=>`${s.length>1?`${q} was`:"It was"} exported first by this run (${d[L]}).`),h=`${$.length?`. ${$.join(" ")}`:""}${s.map(({file:q})=>`
|
|
3
|
+
${Re}${q}`).join("")}`;if(e.fail)return`failures at ${pt(e.fail,"place")}${u}: fix them in the document's doc.html (report.html in an older document), then run this again (it exports first); ${w}${h}`;if(e.unverified)return`nothing failed${u}; not verified at ${pt(e.unverified,"place")}: say so when you hand the document over; ${w}${h}`;if(e.warn)return`nothing failed${u}; warnings at ${pt(e.warn,"place")} to look at, ${So}; ${w}${h}`;if(c){let q=s.length===1?s[0].slug:"<slug>";return`nothing found${u}, and no picture taken: a plain run pictures the cards and the blocks changed since the last look, and the document has no card (a chart or a drawing, code, a whole block, a component, a flowchart, a Sheet area, columns, a figure, a table) and no block changed; run gallery qa ${q} --tiles to picture the page, each Sheet panel and each detail card in tiles, open those pictures and look at the document once yourself; gallery qa ${q} --blocks <id,\u2026> pictures the blocks you name${h}`}return`nothing found${u}: open the pictures above and look at the document once yourself; ${w}${h}`}function Eo(e,{missing:n=!1,edited:s=!1,packaged:c=!1}={}){let r=qt(e),u=ht.basename(Lt(jt(e,Rt)).html);return`exporting first: ${n?`no export yet (${r})`:s?`${u} changed since the last export (${r})`:c?`a component package it uses changed since the last export (${r})`:`the last export (${r}) does not say which text it was made from (an older Gallery's)`}, as gallery export ${e} does (--no-export: refuse instead)`}async function qo(e){for(let[r,{missing:u,edited:w,packaged:d}]of e)console.log(`${r}: ${Eo(r,{missing:u,edited:w,packaged:d})}`);let n=new Map(await Promise.all(e.map(async([r])=>[r,await vt.stat(qt(r)).then(u=>u.mtimeMs,()=>null)]))),s=Fe(process.execPath,[ht.join(ze,"bin","gallery.mjs"),"export",...e.map(([r])=>r)],{cwd:Rt,encoding:"utf8",env:{...process.env,GALLERY_WORKSPACE:Rt},maxBuffer:256*1024*1024});s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr),s.error&&console.error(`the export did not run: ${s.error.message}`);let c=[];for(let[r]of e){let u=await vt.stat(qt(r)).then(w=>w.mtimeMs,()=>null);u!==null&&u!==n.get(r)&&!(await Gt(r,{made:!0})).problem&&c.push(r)}return c}var Ao=e=>String(e??"").split(/[\s,]+/).filter(Boolean);function Bo(e,n){let s=Vt(e);return[...new Set(n)].filter(c=>!s.has(c))}var Oo=(e,n)=>`--blocks: no block of ${e} has the id${n.length===1?"":"s"} ${n.join(", ")}: nothing was looked at and no picture removed. Name ids as gallery qa prints them (data-block-id in the file).`;async function on(e){let{slugs:n,options:s,values:c}=await Kt({options:["--tiles","--no-export"],values:["--blocks"],argv:e}),r=c.has("--blocks")?Ao(c.get("--blocks")):null;if(r?.length===0)throw new Wt("--blocks takes block ids: --blocks <id,\u2026>");if(r&&n.length!==1)throw new Wt("--blocks names blocks of one document: name one.");let u=new Map,w=[];for(let M of n){let Z=await Gt(M);Z.problem&&!((Z.stale||Z.missing)&&!s.has("--no-export"))&&w.push(Z.problem),u.set(M,Z)}if(w.length&&(console.error(w.join(`
|
|
4
|
+
`)),process.exit(2)),r){let M=Lt(jt(n[0],Rt)).html,Z=Bo(Pt(await vt.readFile(M,"utf8").catch(()=>"")),r);if(Z.length)throw new Wt(Oo(ht.resolve(M),Z))}await le(n),await ce(n),await de(n);let d=[...u].filter(([,M])=>M.stale||M.missing),$=new Map(d.map(([M,Z])=>[M,Z.missing?"missing":"stale"]));if(d.length){let M=await qo(d),Z=d.map(([X])=>X).filter(X=>!M.includes(X));for(let X of M)u.set(X,await Gt(X,{made:!0}));Z.length&&(console.error(`${Z.join(", ")}: the export failed (above), so nothing was looked at: fix what it says, then run this again`),process.exit(1))}let h=u,q=[...h].map(([M,{file:Z}])=>({slug:M,file:Z,first:$.get(M)??null})),L=(M,Z)=>{for(let[X,{sha256:gt,time:p}]of h)console.log(`${X}: ${qt(X)} sha256 ${gt}, exported ${Ut(p)}`);console.log(`UNVERIFIED ${M}: nothing was looked at. ${Z}`);for(let{file:X}of q)console.log(`${Re}${X}`);process.exit(3)},U=oe();U||L("no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)",`Install Chrome or Edge, or ${ve}`);let m=await ie({executablePath:U,args:ne()}).catch(M=>L(`the browser ${U} did not start, twice, each time with a fresh profile (${xo(M)}; GALLERY_BROWSER=<its executable> picks another)`,`Run gallery qa once more; if it says UNVERIFIED again, ${ve}`)),{browser:C}=m,D=Object.fromEntries(At.map(M=>[M,0])),x=new Map,H=!1;try{for(let[M,{file:Z,sha256:X,time:gt}]of h){let p=ht.join(Ue,M),A=ht.join(p,"blocks.json");console.log(`${M}: ${qt(M)} sha256 ${X}, exported ${Ut(gt)} (${ht.basename(U)}, headless)`);let J=Lt(jt(M,Rt)).html,Q=Pt(await vt.readFile(J,"utf8")),k=Vt(Q),v=ee(k,te(await vt.readFile(A,"utf8").catch(()=>null))),Y=Qt(Q),F=Zt(Q),tt=ho(k,v,r,{tiles:s.has("--tiles")&&!r,page:Y,packages:F}),ct=s.has("--tiles")||!!tt.tiles;(ct||tt.ids.length)&&(H=!0);let nt={flagged:ht.join(p,"flagged"),blocks:ht.join(p,r?"blocks":"changed"),tiles:ht.join(p,"tiles")},at=ht.join(p,"cards");nt.folders=new Map(tt.groups.flatMap(i=>i.ids.map(T=>[T,i.kind==="cards"?at:nt.blocks])));let _=[nt.flagged,...r?[nt.blocks]:tt.tiles?[]:[nt.blocks,at],...ct?[nt.tiles]:[]],ft=(await Promise.all(_.map(async i=>[i,(await vt.readdir(i).catch(()=>[])).filter(T=>T.endsWith(".png")).length]))).filter(([,i])=>i>0);ft.length&&console.log(`The pictures of the run before in ${ft.map(([i])=>`${ht.basename(i)}/`).join(", ")} (${pt(ft.reduce((i,[,T])=>i+T,0),"file")}) were removed: this run's replace them.`);for(let i of _)await vt.rm(i,{recursive:!0,force:!0});for(let i of await vt.readdir(p).catch(()=>[]))i.endsWith(".png")&&await vt.rm(ht.join(p,i),{force:!0});for(let i of _)await vt.mkdir(i,{recursive:!0});let dt=[...k].filter(([,{whole:i}])=>i).map(([i])=>i),it=[...k].filter(([,{figure:i}])=>i).map(([i])=>i),rt=[],b=null;for(let i of pe){let T=await go(C,Z,i,{out:nt,tiles:ct&&!i.laptop,blocks:i.laptop?[]:tt.ids,around:tt.around,held:i.laptop?new Map:tt.held,whole:dt,drawn:it,known:i.laptop?b:null});rt.push({...i,...T}),T.pictures.length&&(H=!0),!i.laptop&&i.width===pe.find(N=>N.laptop)?.width&&(b=new Set(T.findings.map(Yt)))}let{lines:z,levels:P,looks:K}=vo(rt,no(Q,ht.basename(J)),{...tt,tags:new Map([...k].map(([i,{tag:T}])=>[i,T]))},{folder:p,slug:M});console.log(z.join(`
|
|
5
|
+
`));for(let i of At)D[i]+=P[i];for(let{label:i,fail:T,warn:N}of K){let a=x.get(i)??{label:i,fail:0,warn:0};x.set(i,{label:i,fail:a.fail+T,warn:a.warn+N})}let R=rt.every(i=>i.counts&&!i.findings.some(T=>T.kind==="unverified")),I=ro(k,v,tt,{named:r,verified:R,failed:P.fail>0,seen:lo(tt,rt),page:Y,packages:F})??v;I&&await vt.writeFile(A,`${JSON.stringify(I)}
|
|
6
|
+
`)}}finally{await m.close()}console.log(Co(D,[...x.values()],q,{unpictured:!H})),process.exitCode=D.fail?1:D.unverified?3:0}export{zt as ADVICE,Ee as BLOCK_PICTURES,yo as CODE_SIDEWAYS,Re as HAND_OVER,Qe as INK_MARGIN,Uo as KINDS,At as LEVELS,pe as LOOKS,ve as LOOK_YOURSELF,en as MORE_PICTURES,co as MOSTLY_CHANGED,we as MOVED_PART,to as MOVED_WHOLE,me as NEIGHBOUR_EDGE,Ke as PICTURED_INFO,ko as SCROLLS,Ze as SCROLL_FRAMES,Je as SCROLL_SLACK,So as WARNED,Go as WIDE,ge as WIDTHS,ee as adoptIdless,bo as adviceOf,je as baselineOf,xe as baselineSaid,Vt as blocksOf,ho as blocksToPicture,vo as describeLooks,wo as disclosuresSaid,Le as exportBaselines,Gt as exportOf,Eo as exportingFirst,Yt as findingKey,Ce as findingLevel,uo as inkOf,Ge as layoutNotesOf,Me as levelOf,go as lookAt,Ae as missedWidths,Oe as morePictures,qe as movedBlocks,eo as movedClips,Ao as namedBlocks,ro as nextBaseline,Mo as notPicturedLine,Qt as pageOf,Xe as picturedAt,$o as picturesSaid,so as placeOf,Ie as previewBaseline,We as rankOf,te as readBaseline,on as run,lo as seenOf,no as sourceIndex,ao as staleExport,xo as startFailure,Ut as timeOf,Bo as unknownBlocks,Oo as unknownBlocksSaid,$e as urlName,Co as verdictOf,oo as wordsOf};
|
|
@@ -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{F as v,a as u,b as I,h as w,j as N,y as S}from"./chunk-NFIBI4IP.mjs";import{b as T,e as M}from"./chunk-A55HN5OK.mjs";import{IDENTITY as Tt}from"../browser/editor/components/registry.mjs";function P(n){let{blocks:s,locks:d,units:i,boxes:p}=v(n),f=z(n,[...s.map(t=>({at:t.innerStart-1,text:` data-ge-block="${t.id}"`})),...d.map(t=>({at:t.at,text:` data-ge-lock="${t.reason}"`})),...i.map(t=>({at:t.at,text:` data-ge-unit="${t.id}"${t.grid?" data-ge-grid":""}${t.keep?` data-ge-keep="${t.keep.reason}"${t.keep.own?" data-ge-keep-own":""}`:""}`})),...i.filter(t=>t.lead!==null).map(t=>({at:t.lead,text:` data-ge-lead="${t.id}"`})),...p.map(t=>({at:t.at,text:` data-ge-box="${t.id}"${t.pure?" data-ge-pure":""}`}))]),o={version:u(n),blocks:s.map(t=>({id:t.id,tag:t.tag,kind:t.kind,caps:Object.keys(t.caps),inner:n.slice(t.innerStart,t.innerEnd),atoms:t.atoms,unit:t.unit,...t.path?{path:t.path}:{},...t.self!==null?{self:!0}:{}})),units:i.map(t=>({id:t.id,kind:t.kind,parent:t.parent,hash:w(n,t),...t.blockId?{blockId:t.blockId}:{},...t.keep?{keep:t.keep}:{},...t.grid?{grid:!0}:{},...t.parts?{parts:t.parts}:{}})),boxes:p.map(t=>({id:t.id,kind:t.kind,unit:t.unit,...t.key!==null?{key:t.key}:{}}))};return{html:f,map:o}}function z(n,s,d=!0){let i=[],p=0;for(let f of[...s].sort((o,t)=>o.at-t.at)){if(n[f.at]!==">"){if(d)throw new Error(`Unexpected start tag before offset ${f.at}.`);continue}let o=N(n,f.at);i.push(n.slice(p,o),f.text),p=o}return i.push(n.slice(p)),i.join("")}M();import{COMPONENTS as U,instancesOf as R,partOf as E}from"../browser/shared/components/index.mjs";import{attr as A}from"../browser/shared/html-tree.mjs";var y=new Set(["main","section","article","aside","nav","header","footer","div","details","dialog","figure","blockquote","table","ul","ol","dl"]),W=new Set(["script","style","template","textarea","title","xmp","iframe","noembed","noframes","noscript","plaintext","pre","code","kbd","samp","var","svg","math"]),j=U.filter(n=>n.match&&n.pairs);function D(n){let s=n.replace(/^/," "),d=T(s,{sourceCodeLocationInfo:!0}),i=a=>s.slice(0,a).split(`
|
|
3
|
+
`).length,p=[],f=(a,e,r)=>p.push({key:a,tag:s.slice(e,r).replace(/\s+/g," "),line:i(e),offset:e});I(d,"main")||f("no <main> in the file",0,0);let o=[],t=new Set,k=a=>{for(let e of a.childNodes??[]){let r=e.sourceCodeLocation;if(e.nodeName==="#comment"){r&&o.push([r.startOffset,r.endOffset]);continue}if(e.tagName){if(r?.startTag&&o.push([r.startTag.startOffset,r.startTag.endOffset]),W.has(e.tagName)){r&&o.push([r.startOffset,r.endOffset??s.length]);continue}r?.endTag&&t.add(r.endTag.startOffset),y.has(e.tagName)&&r?.startTag&&!r.endTag&&f(`<${e.tagName}> not closed`,r.startTag.startOffset,r.startTag.endOffset),k(e)}}};k(d),o.sort((a,e)=>a[0]-e[0]);let g="",c=0;for(let[a,e]of o)e<=c||(g+=s.slice(c,Math.max(c,a))+" ".repeat(e-Math.max(c,a)),c=e);g+=s.slice(c);for(let a of g.matchAll(/<\/([A-Za-z][A-Za-z0-9]*)[^<>]*>?/g)){let e=a[1].toLowerCase();y.has(e)&&!t.has(a.index)&&f(`</${e}> closes nothing`,a.index,a.index+a[0].length)}for(let a of j)for(let e of R(d,a))for(let{a:r,attrA:B,b:O,attrB:L}of a.pairs){let h=E(e,a.parts[r].at).map(m=>A(m,B)),x=E(e,a.parts[O].at).map(m=>A(m,L)),$=m=>new Set(m).size===m.length,C=$(h)&&$(x)&&h.length===x.length&&h.every(m=>x.includes(m)),l=e.sourceCodeLocation;!C&&l&&f(`${a.id}: ${r} and ${O} do not pair`,l.startOffset,l.startTag?.endOffset??l.startOffset)}return p.sort((a,e)=>a.offset-e.offset).map(({key:a,tag:e,line:r})=>({key:a,tag:e,line:r,text:`${a} (line ${r})`}))}var kt=(n,s,d,i)=>S.installed.rewrite(n,s,d,{packages:i});export{P as a,D as b,kt as c};
|
|
@@ -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 A}from"./chunk-7QQBR7PB.mjs";import{c as _,d as P}from"./chunk-LHTFLRB6.mjs";import"./chunk-ZBIM6ARY.mjs";import{b as $,f as M}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import{randomBytes as K}from"node:crypto";import{existsSync as X,readdirSync as G,readFileSync as B,statSync as R}from"node:fs";import c from"node:fs/promises";import C from"node:os";import n from"node:path";import{release as q,reportsDirectory as H,skillDirectory as J}from"../browser/shared/paths.mjs";import{copyOldDocuments as V,ensureWorkspace as Q,layoutOf as Y,oldStateOf as z}from"../browser/shared/workspace.mjs";var v={claude:{name:"Claude Code",home:t=>t.CLAUDE_CONFIG_DIR||n.join(C.homedir(),".claude"),project:".claude"},codex:{name:"Codex",home:t=>t.CODEX_HOME||n.join(C.homedir(),".codex"),project:".codex"}},x=t=>R(t,{throwIfNoEntry:!1})?.isDirectory()??!1;function Z({agent:t=null,project:e=!1,dir:r=null,cwd:o=process.cwd(),env:s=process.env}={}){if(r)return[{agent:null,target:n.resolve(o,r),skills:null}];let a=t?[t]:Object.keys(v),u=d=>e?n.join(n.resolve(o),v[d].project):n.resolve(v[d].home(s)),p=a.filter(d=>x(u(d)));return(t||p.length?t?a:p:["claude"]).map(d=>{let h=n.join(u(d),"skills");return{agent:d,target:n.join(h,"gallery"),skills:h}})}function ee(t){let e;try{e=B(n.join(t,"SKILL.md"),"utf8")}catch{return null}let r=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e.replace(/^/,""));return r?/^name:\s*["']?([\w.-]+)["']?\s*$/m.exec(r[1])?.[1]??null:null}function T(t){let e=R(t,{throwIfNoEntry:!1});if(!e)return{kind:"absent"};if(!e.isDirectory())return{kind:"other",why:"it is a file"};let r=G(t);if(r.length===0)return{kind:"absent"};if(r.includes(".git"))return{kind:"other",why:"it is a git checkout"};let o=ee(t),s=u=>r.includes(u);return(s("package.json")&&s("src")||s("reports"))&&(o==="gallery"||o==="html-report-studio")?{kind:"fat",name:o}:o==="gallery"&&!s("package.json")&&!s("src")&&!s("reports")?{kind:"thin"}:{kind:"other",why:o?`its SKILL.md is the skill "${o}"`:"it holds no Gallery skill"}}function te(t){return x(t)?G(t,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!e.name.startsWith(".")).map(e=>n.join(t,e.name)).filter(e=>T(e).kind==="fat"):[]}function oe(t){let e=n.join(z(t),"servers");return x(e)?G(e).filter(r=>r.endsWith(".json")).flatMap(r=>{try{let{pid:o,port:s}=JSON.parse(B(n.join(e,r),"utf8"));return!Number.isInteger(o)||o<=0||o===process.pid?[]:(process.kill(o,0),[{pid:o,port:s}])}catch(o){return o.code==="EPERM"?[{pid:Number.NaN,port:null}]:[]}}):[]}async function O(t){let e=0,r=0,o=async s=>{for(let a of await c.readdir(s,{withFileTypes:!0})){let u=n.join(s,a.name);a.isDirectory()?await o(u):(e++,r+=(await c.lstat(u)).size)}};return await o(t).catch(()=>{}),{files:e,bytes:r}}var U=t=>`${(t/1024/1024).toFixed(1)} MB`,re=(t,e)=>`${t} ${e}${t===1?"":"s"}`;async function j(t,e){for(let r=0;;r++)try{return await c.rename(t,e)}catch(o){if(process.platform!=="win32"||r>=10||!["EPERM","EBUSY","EACCES"].includes(o.code))throw o;await new Promise(s=>setTimeout(s,100*(r+1)))}}function se(t,e=new Date){let r=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,o=n.join(Y(t).gallery,`old-skill-${r}`);for(let s=1;;s++){let a=s===1?o:`${o}-${s}`;if(!X(a))return a}}async function ne(t,e){await c.mkdir(n.dirname(e),{recursive:!0});try{return await j(t,e),null}catch(s){if(s.code!=="EXDEV")return`${s.code??s.message}`}let r=await O(t);await c.cp(t,e,{recursive:!0,preserveTimestamps:!0,verbatimSymlinks:!0,errorOnExist:!0,force:!1});let o=await O(e);return o.files!==r.files||o.bytes!==r.bytes?`the copy holds ${o.files} files, ${o.bytes} bytes, of ${r.files}, ${r.bytes}: the old folder was left as it was`:(await c.rm(t,{recursive:!0,force:!0}),null)}async function W(t){let e=[],r=async o=>{for(let s of await c.readdir(o,{withFileTypes:!0})){let a=n.join(o,s.name);s.isDirectory()?await r(a):e.push([n.relative(t,a).split(n.sep).join("/"),await c.readFile(a)])}};return await r(t),e.sort(([o],[s])=>o<s?-1:o>s?1:0)}var ie=(t,e)=>t.length===e.length&&t.every(([r,o],s)=>r===e[s][0]&&o.equals(e[s][1]));async function le(t,e,r){if(r==="thin"&&ie(await W(t),await W(e)))return"same";let o=n.dirname(e);await c.mkdir(o,{recursive:!0});let s=K(4).toString("hex"),a=n.join(o,`.gallery-skill-new-${s}`);if(await c.cp(t,a,{recursive:!0}),r==="absent")return X(e)&&await c.rmdir(e),await j(a,e),"new";let u=n.join(o,`.gallery-skill-old-${s}`);await j(e,u);try{await j(a,e)}catch(p){throw await j(u,e).catch(()=>{}),await c.rm(a,{recursive:!0,force:!0}),p}return await c.rm(u,{recursive:!0,force:!0}),"updated"}async function ge(t,{version:e}){let{positional:r,options:o,values:s}=M({options:["--project"],values:["--agent","--dir"],argv:t});if(r[0]!=="install")throw new $(r.length?`No such skill command: ${r[0]} (install).`:"Say what to do: gallery skill install.");if(r.length>1)throw new $(`gallery skill install takes no other argument: ${r[1]}`);let a=s.get("--agent")??null;if(a!==null&&!Object.hasOwn(v,a))throw new $(`--agent is claude or codex, not ${a}.`);let u=s.get("--dir")??null;if(u!==null&&(a!==null||o.has("--project")))throw new $("--dir names the skill's folder itself: not with --agent or --project.");let p=Z({agent:a,project:o.has("--project"),dir:u}),d=[],h=p.map(i=>({...i,...T(i.target)}));for(let{target:i,kind:l,why:f}of h)l==="other"&&d.push(`${i} holds something that is not a Gallery skill (${f}): move it away, or pass --dir <another folder>.`);let F=[...new Set(h.flatMap(({target:i,kind:l,skills:f})=>[...l==="fat"?[i]:[],...f?te(f):[]]))];for(let i of F)for(let{pid:l,port:f}of oe(i))d.push(Number.isNaN(l)?`The older Gallery skill ${i} has a preview server running that this user cannot see: stop it first.`:`The older Gallery skill ${i} has its preview server running (pid ${l}${f?`, port ${f}`:""}): stop it first (close the window that runs it, or end process ${l}), then run gallery skill install again.`);if(d.length){for(let i of d)console.error(i);console.error("Nothing was changed."),process.exit(1)}if(F.length){let i=H;try{let{ours:l,reads:f}=await Q(i);l||(console.error(P(i,f)),process.exit(1))}catch(l){if(!l.code)throw l;console.error(_(i,l.code)),process.exit(1)}console.log(`\u5DE5\u4F5C\u533A\uFF1A${i}`);for(let l of F){console.log(`An older Gallery skill (the whole tools) is in ${l}: its documents go into the workspace, then it moves out of the skills folder.`);let f=n.join(l,"reports");if(x(f)){let m=await V({from:f,to:i,state:z(l)});for(let w of A(m,f,i))console.log(` ${w}`)}else console.log(" It holds no documents (no reports/ folder).");let y=n.join(l,"exports");if(x(y)){let m=Y(i).exports;await c.mkdir(m,{recursive:!0});let w=[],I=[];for(let E of(await c.readdir(y)).filter(b=>b.endsWith(".html")).sort())try{await c.copyFile(n.join(y,E),n.join(m,E),c.constants.COPYFILE_EXCL),w.push(E)}catch(b){if(b.code!=="EEXIST")throw b;I.push(E)}w.length&&console.log(` Exports: copied ${re(w.length,"file")} into ${m}: ${w.join(", ")}`),I.length&&console.log(` Exports not copied (the name is taken in ${m}; they stay in the moved folder's exports/): ${I.join(", ")}`)}let{bytes:g}=await O(l),k=await O(n.join(l,"node_modules")),D=se(i),L=await ne(l,D);L&&(console.error(`Could not move ${l} to ${D} (${L}). Its documents are copied; move the folder out of the skills folder yourself (it is never needed in it again), then run gallery skill install again.`),process.exit(1)),console.log(` Moved the old skill to ${D} (${U(g)}${k.files?`; its node_modules/, ${U(k.bytes)}, may be deleted: nothing reads it any more`:""}).`)}}let N=J,S=null;if(!q){let{buildSkill:i}=await import("./chunk-EZY3WC6Z.mjs");S=await c.mkdtemp(n.join(C.tmpdir(),"gallery-skill-")),N=n.join(S,"gallery"),i(N,{version:e})}try{let i=!1;for(let{agent:l,target:f}of h){let y=T(f).kind,g=await le(N,f,y),k=l?` for ${v[l].name}`:"";console.log(g==="same"?`The Gallery skill ${e}${k} is installed already, unchanged: ${f}`:`${g==="updated"?"Updated":"Installed"} the Gallery skill ${e}${k}: ${f}`),i||=g!=="same"}i&&console.log("Open a new Agent session to use it.")}finally{S&&await c.rm(S,{recursive:!0,force:!0})}}export{v as AGENTS,T as kindOf,ge as run,Z as targetsOf};
|
|
@@ -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 L from"node:fs";import{pipeline as F}from"node:stream/promises";import z from"node:zlib";import{refusal as B,said as k}from"../browser/shared/i18n/index.mjs";var Z=67324752,O=33639248,A=101010256,P=101075792,W=117853008,I=4294967295,D=2048;function v(t=new Date){let o=t.getHours()<<11|t.getMinutes()<<5|Math.floor(t.getSeconds()/2),n=Math.max(1980,t.getFullYear())-1980<<9|t.getMonth()+1<<5|t.getDate();return[o,n]}function K(t){let[o,n]=v(),c=[],d=[],r=0;for(let a of t){let u=Buffer.isBuffer(a.data)?a.data:Buffer.from(a.data??"","utf8"),e=Buffer.from(a.name,"utf8"),w=u.length>64?z.deflateRawSync(u):null,h=w&&w.length<u.length?w:u,m=h===u?0:8,g=z.crc32(u);if(u.length>=I||r>=I)throw new Error("\u538B\u7F29\u5305\u592A\u5927\uFF08\u8D85\u8FC7 4GB\uFF09");let l=Buffer.alloc(30);l.writeUInt32LE(Z,0),l.writeUInt16LE(20,4),l.writeUInt16LE(D,6),l.writeUInt16LE(m,8),l.writeUInt16LE(o,10),l.writeUInt16LE(n,12),l.writeUInt32LE(g,14),l.writeUInt32LE(h.length,18),l.writeUInt32LE(u.length,22),l.writeUInt16LE(e.length,26),l.writeUInt16LE(0,28);let s=Buffer.alloc(46);s.writeUInt32LE(O,0),s.writeUInt16LE(20,4),s.writeUInt16LE(20,6),s.writeUInt16LE(D,8),s.writeUInt16LE(m,10),s.writeUInt16LE(o,12),s.writeUInt16LE(n,14),s.writeUInt32LE(g,16),s.writeUInt32LE(h.length,20),s.writeUInt32LE(u.length,24),s.writeUInt16LE(e.length,28),s.writeUInt32LE(r,42),c.push(l,e,h),d.push(s,e),r+=l.length+e.length+h.length}if(t.length>=65535)throw new Error("\u538B\u7F29\u5305\u91CC\u7684\u6587\u4EF6\u592A\u591A");let i=Buffer.concat(d),f=Buffer.alloc(22);return f.writeUInt32LE(A,0),f.writeUInt16LE(t.length,8),f.writeUInt16LE(t.length,10),f.writeUInt32LE(i.length,12),f.writeUInt32LE(r,16),Buffer.concat([...c,i,f])}var G=new TextDecoder("utf-8",{fatal:!0}),H=new TextDecoder("gbk");function X(t,o){if(o&D)return t.toString("utf8");try{return G.decode(t)}catch{return H.decode(t)}}var U=()=>new Error("ZIP \u6587\u4EF6\u5DF2\u635F\u574F"),E=(t,o)=>Number(t.readBigUInt64LE(o));function C(t,o){let n=Math.min(o,65557),c=t(o-n,n),d=-1;for(let e=c.length-22;e>=0;e-=1)if(c.readUInt32LE(e)===A){d=e;break}if(d<0)throw new Error("\u4E0D\u662F\u6709\u6548\u7684 ZIP \u6587\u4EF6");let r=c.readUInt16LE(d+10),i=c.readUInt32LE(d+12),f=c.readUInt32LE(d+16);if(r===65535||i===I||f===I){let e=t(o-n+d-20,20);if(e.readUInt32LE(0)!==W)throw U();let w=t(E(e,8),56);if(w.readUInt32LE(0)!==P)throw U();r=E(w,32),i=E(w,40),f=E(w,48)}let a=t(f,i),u=[];for(let e=0,w=0;w<r;w+=1){if(a.readUInt32LE(e)!==O)throw U();let h=a.readUInt16LE(e+8),m=a.readUInt16LE(e+10),g=a.readUInt32LE(e+20),l=a.readUInt32LE(e+24),s=a.readUInt16LE(e+28),T=a.readUInt16LE(e+30),N=a.readUInt16LE(e+32),R=a.readUInt32LE(e+42),b=X(a.subarray(e+46,e+46+s),h),p=a.subarray(e+46+s,e+46+s+T);for(let x=0;x+4<=p.length;x+=4+p.readUInt16LE(x+2)){if(p.readUInt16LE(x)!==1)continue;let S=x+4;l===I&&(l=E(p,S),S+=8),g===I&&(g=E(p,S),S+=8),R===I&&(R=E(p,S))}if(e+=46+s+T+N,!b.endsWith("/")){if(h&1)throw B(k("{0} \u5DF2\u52A0\u5BC6",b));if(m!==0&&m!==8)throw B(k("{0}\uFF1A\u4E0D\u652F\u6301\u7684\u538B\u7F29\u65B9\u5F0F",b));u.push({name:b,method:m,packedSize:g,size:l,local:R})}}return u}function M(t,o){let n=t(o.local,30);if(n.readUInt32LE(0)!==Z)throw U();return o.local+30+n.readUInt16LE(26)+n.readUInt16LE(28)}function Q(t){let o=(n,c)=>{if(n<0||n+c>t.length)throw U();return t.subarray(n,n+c)};return C(o,t.length).map(n=>{let c=o(M(o,n),n.packedSize),d=n.method===0?Buffer.from(c):z.inflateRawSync(c);if(d.length!==n.size)throw B(k("{0}\uFF1A\u5927\u5C0F\u4E0D\u7B26",n.name));return{name:n.name,data:d}})}function V(t){let o=L.openSync(t,"r"),n=L.fstatSync(o).size,c=(r,i)=>{if(r<0||r+i>n)throw U();let f=Buffer.alloc(i);for(let a=0;a<i;){let u=L.readSync(o,f,a,i-a,r+a);if(u===0)throw U();a+=u}return f},d;try{d=C(c,n)}catch(r){throw L.closeSync(o),r}return{entries:d,read(r){let i=c(M(c,r),r.packedSize),f=r.method===0?i:z.inflateRawSync(i);if(f.length!==r.size)throw B(k("{0}\uFF1A\u5927\u5C0F\u4E0D\u7B26",r.name));return f},async extract(r,i){let f=M(c,r);if(r.packedSize===0)await L.promises.writeFile(i,"");else{let a=L.createReadStream(null,{fd:o,start:f,end:f+r.packedSize-1,autoClose:!1});await F(...r.method===0?[a]:[a,z.createInflateRaw()],L.createWriteStream(i))}if((await L.promises.stat(i)).size!==r.size)throw B(k("{0}\uFF1A\u5927\u5C0F\u4E0D\u7B26",r.name))},close:()=>L.closeSync(o)}}export{K as a,Q as b,V as c};
|
|
@@ -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{spawn as G}from"node:child_process";import{existsSync as O}from"node:fs";import S from"node:fs/promises";import I from"node:os";import q from"node:path";import{APART as T}from"../browser/editor/components/registry.mjs";var _=6e4,y=600,B=["A4","A3","Letter","Legal","Tabloid"];function F(){if(process.env.GALLERY_BROWSER)return process.env.GALLERY_BROWSER;let{PROGRAMFILES:o="","PROGRAMFILES(X86)":e="",LOCALAPPDATA:r="",HOME:i=""}=process.env;return({win32:[`${o}\\Google\\Chrome\\Application\\chrome.exe`,`${e}\\Google\\Chrome\\Application\\chrome.exe`,`${r}\\Google\\Chrome\\Application\\chrome.exe`,`${e}\\Microsoft\\Edge\\Application\\msedge.exe`,`${o}\\Microsoft\\Edge\\Application\\msedge.exe`],darwin:["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge","/Applications/Chromium.app/Contents/MacOS/Chromium",...i?[`${i}/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,`${i}/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,`${i}/Applications/Chromium.app/Contents/MacOS/Chromium`]:[]],linux:["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/opt/google/chrome/chrome","/usr/bin/microsoft-edge","/usr/bin/microsoft-edge-stable","/opt/microsoft/msedge/msedge","/usr/bin/chromium","/usr/bin/chromium-browser","/snap/bin/chromium"]}[process.platform]??[]).find(n=>n&&O(n))??null}var $=()=>process.getuid?.()===0?["--no-sandbox"]:[],Z=()=>["--no-first-run","--no-default-browser-check","--disable-extensions","--hide-scrollbars","--lang=zh-CN",...$()];function ee(o,e,r=[]){let i=o.location()?.url??"";return!/^Failed to load resource|^Refused to |Content Security Policy/.test(o.text())&&(!i||i.startsWith(e)||r.includes(i))}var te=o=>o.evaluateOnNewDocument(()=>{globalThis.__qaViolations=[],document.addEventListener("securitypolicyviolation",e=>{globalThis.__qaViolations.push({url:e.blockedURI,directive:e.effectiveDirective||e.violatedDirective,source:e.sourceFile,line:e.lineNumber})})}),N=3e4,P=o=>new Promise(e=>setTimeout(e,o).unref()),R=o=>String(o??"").replace(/\s+/g," ").trim(),M=o=>{let e=o.split(/\r?\n/).map(R).filter(Boolean).at(-1);return e?`: ${e.slice(0,200)}`:""};async function oe({executablePath:o,args:e=[],attempts:r=2,start:i=V}){let c=[];for(let n=0;n<r;n+=1){let s=await S.mkdtemp(q.join(I.tmpdir(),"gallery-browser-")),t=()=>S.rm(s,{recursive:!0,force:!0,maxRetries:5,retryDelay:200}).catch(()=>{});try{let{browser:a,stop:l}=await i({executablePath:o,args:e,profile:s});return{browser:a,failures:c,close:async()=>{await l().catch(()=>{}),await t()}}}catch(a){c.push(R(a?.message??a)),await t()}}throw Object.assign(new Error(c.at(-1)??"the browser did not start"),{failures:c})}async function V({executablePath:o,args:e,profile:r,starting:i=N}){let{default:c}=await import("./chunk-DB4WKGYF.mjs"),n=await c.defaultArgs({headless:!0,userDataDir:r,args:[...e,"--remote-debugging-port=0"]}),s=process.platform!=="win32",t=G(o,n,{stdio:["ignore","ignore","pipe"],windowsHide:!0,detached:s}),a=!1;t.on("error",()=>a||=t.pid===void 0);let l=()=>a||t.exitCode!==null||t.signalCode!==null,u=new Promise(h=>t.once("exit",h)),m=()=>{if(!l())try{s?process.kill(-t.pid,"SIGKILL"):t.kill()}catch{try{t.kill("SIGKILL")}catch{}}};process.once("exit",m);let p="",d=new Promise((h,E)=>{let v=setTimeout(()=>E(new Error(`it said nothing of its DevTools port in ${i/1e3}s${M(p)}`)),i);t.stderr.setEncoding("utf8"),t.stderr.on("data",f=>{p=`${p}${f}`.slice(-4e3);let b=/DevTools listening on (ws:\/\/\S+)/.exec(p);b&&(clearTimeout(v),h(b[1]))}),t.once("error",f=>(clearTimeout(v),E(f))),t.once("exit",(f,b)=>(clearTimeout(v),E(new Error(`it stopped (${b??`exit ${f}`}) before it opened its DevTools port${M(p)}`))))}),g=async()=>{try{l()||await Promise.race([u,P(5e3)]),m(),l()||await Promise.race([u,P(3e3)])}finally{process.off("exit",m)}},x;try{x=await c.connect({browserWSEndpoint:await d,defaultViewport:{width:800,height:600}})}catch(h){throw m(),await g(),h}return{browser:x,stop:async()=>{await Promise.race([x.close().catch(()=>{}),P(5e3)]),await g()}}}var w=null,L=0,C=0;async function W(){let o=F();if(!o)throw Object.assign(new Error("\u6CA1\u6709\u627E\u5230 Chrome \u6216 Edge\uFF1A\u5BFC\u51FA PDF \u9700\u8981\u7535\u8111\u4E0A\u88C5\u6709\u5176\u4E2D\u4E00\u4E2A\u6D4F\u89C8\u5668"),{reason:"browser"});let{default:e}=await import("./chunk-DB4WKGYF.mjs");return e.launch({executablePath:o,headless:!0,args:["--no-first-run","--no-default-browser-check","--disable-extensions",...$()]})}async function k(o,e){clearTimeout(L),C+=1,w??=W().catch(i=>{throw w=null,i});let r=await(await w).newPage();try{return await r.emulateMediaFeatures([{name:"prefers-reduced-motion",value:"reduce"},{name:"prefers-color-scheme",value:"light"}]),await r.setViewport({width:1200,height:900}),await r.setContent(o,{waitUntil:"load",timeout:6e4}),await A(r,{changing:y}),await e(r)}finally{await r.close().catch(()=>{}),C-=1,C===0&&(L=setTimeout(async()=>{let i=w;w=null,(await i?.catch(()=>null))?.close().catch(()=>{})},_))}}async function A(o,{timeout:e=15e3,changing:r=e}={}){let i=[],c=(s,t,a=e)=>{t!==!0&&i.push(`${s} (${t===!1?`not in ${a/1e3}s`:t})`)},n=(s,t=e)=>o.evaluate(s,t).catch(a=>a.message);return c("the fonts loaded",await n(s=>Promise.race([Promise.resolve(document.fonts?.ready).then(()=>!0),new Promise(t=>setTimeout(()=>t(!1),s))]))),c("the kit's first drawing done (data-doc-drawn)",await n(s=>new Promise(t=>{let a=Date.now(),l=()=>{!globalThis.DocKit||document.documentElement.hasAttribute("data-doc-drawn")?(globalThis.DocCode?.colorAll?.(),t(!0)):Date.now()-a>s?t(!1):setTimeout(l,50)};l()}))),c("the page done changing",await n(s=>new Promise(t=>{let a=()=>[document.documentElement.scrollHeight,...[...document.querySelectorAll("[style]")].map(d=>d.getAttribute("style")),...[...document.adoptedStyleSheets??[]].flatMap(d=>[...d.cssRules].map(g=>g.cssText)),...[...document.querySelectorAll("svg, canvas")].map(d=>d.outerHTML.length),[...document.images].filter(d=>d.complete).length].join("|"),l=Date.now(),u=a(),m=0,p=()=>{let d=a();m=d===u?m+1:0,u=d,m>=3?t(!0):Date.now()-l>s?t(!1):setTimeout(p,100)};setTimeout(p,100)}),r),r),i}async function D(o){await o.evaluate(()=>{document.documentElement.setAttribute("data-doc-theme","light");for(let e of document.querySelectorAll("[data-doc-sheets]")){let r=e.querySelector(":scope > .doc-sheet-tabs");if(r){for(let i of r.querySelectorAll(":scope > .doc-sheet-tab")){let c=i.getAttribute("data-sheet-tab"),n=[...e.querySelectorAll(":scope > [data-doc-sheet]")].find(a=>a.getAttribute("data-doc-sheet")===c);if(!n)continue;n.hidden=!1,n.removeAttribute("aria-hidden"),n.style.setProperty("display","block","important");let s=r.cloneNode(!1);s.removeAttribute("id"),s.removeAttribute("role"),s.style.setProperty("break-after","avoid");let t=i.cloneNode(!0);t.removeAttribute("id"),t.setAttribute("aria-selected","true"),t.classList.add("is-active"),s.append(t),n.before(s)}r.style.setProperty("display","none","important")}}for(let e of document.querySelectorAll("details"))e.open=!0;window.dispatchEvent(new Event("resize"))}),await A(o,{changing:y})}var H={A4:793.7,A3:1122.5,Letter:816,Legal:816,Tabloid:1056},K=96;async function j(o,e){await o.emulateMediaType("print");let r=await o.evaluate(()=>Math.max(0,innerWidth-document.documentElement.clientWidth));await o.setViewport({width:Math.floor(e)+r,height:900}),await A(o,{changing:y})}function re(o,{paper:e="A4",scale:r=1}={}){let i=B.includes(e)?e:"A4",c=Math.min(2,Math.max(.1,r));return k(o,async n=>(await D(n),await j(n,(H[i]-2*K)/c),Buffer.from(await n.pdf({format:i,scale:c,printBackground:!0,margin:{top:"1in",right:"1in",bottom:"1in",left:"1in"}}))))}function ie(o){return k(o,async e=>{await D(e);let r=e.viewport(),i=await e.$$("main figure.doc-figure"),c=[];for(let n of i){let s=0;try{s=await n.evaluate(async(t,a)=>{let l=[];for(let u=t.closest(a);u;u=u.parentElement.closest(a))l.unshift(u);for(let u of l)u.showModal();return await new Promise(u=>requestAnimationFrame(()=>requestAnimationFrame(u))),l.length?Math.ceil(t.getBoundingClientRect().height):0},T),s&&(await e.setViewport({...r,height:r.height+s}),await A(e,{changing:y})),await n.evaluate(t=>t.scrollIntoView({block:"center"})),c.push(Buffer.from(await n.screenshot({type:"png"})))}catch{c.push(null)}await n.evaluate((t,a)=>{for(let l=t.closest(a);l;l=l.parentElement.closest(a))l.close()},T).catch(()=>{}),s&&await e.setViewport(r).catch(()=>{})}return c})}export{F as a,Z as b,ee as c,te as d,oe as e,A as f,re as g,ie as h};
|
|
@@ -0,0 +1,4 @@
|
|
|
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 m,d as f}from"./chunk-ZBIM6ARY.mjs";import{readFileSync as $,realpathSync as O}from"node:fs";import l from"node:path";import{fileURLToPath as v}from"node:url";var x=l.dirname(v(import.meta.url));function g(t=x){for(let e=t;;e=l.dirname(e)){try{let i=JSON.parse($(l.join(e,"package.json"),"utf8"));if(i.name==="@heycys/gallery")return i.version}catch{}if(l.dirname(e)===e)return"0.0.0"}}var y={init:()=>import("./chunk-EVJ3BX3M.mjs"),new:()=>import("./chunk-C7HWOBIF.mjs"),import:()=>import("./chunk-QVWVFC5K.mjs"),open:()=>import("./chunk-5SIYS5HN.mjs"),serve:()=>import("./chunk-Z52HTUW7.mjs"),stop:()=>import("./chunk-TMYZB6AV.mjs"),check:()=>import("./chunk-O52JMOCZ.mjs"),export:()=>import("./chunk-5OFN5AHC.mjs"),qa:()=>import("./chunk-IERUOGC3.mjs"),list:()=>import("./chunk-QZY6Q64C.mjs"),component:()=>import("./chunk-6CYG3Z4V.mjs"),skill:()=>import("./chunk-L4DVONOG.mjs")},E=new Set(["stop","init","skill"]),S=(t,e)=>`${t.split(`
|
|
3
|
+
`)[0]} (gallery ${e?`${e} --help`:"help"} says more)`,w=t=>/^--.|^-[A-Za-z]/.test(t);function j(t){let e=t.indexOf("--"),i=e===-1?t:t.slice(0,e),u=e===-1?[]:t.slice(e),n=[],s=null;for(let o=0;o<i.length;o++){let r=i[o];if(r==="--workspace"||r.startsWith("--workspace=")){let a=r.includes("=")?r.slice(r.indexOf("=")+1):o+1<i.length&&!w(i[o+1])?i[++o]:"";if(!a)return{error:"--workspace takes a folder: --workspace <dir>",usage:f};if(s!==null&&l.resolve(s)!==l.resolve(a))return{error:`Two workspaces named: ${s} and ${a}.`,usage:f};s=a;continue}n.push(r)}if(n[0]==="--version"||n[0]==="-v"||n[0]==="-V")return n.length===1&&u.length===0?{version:!0}:{error:"--version takes nothing else.",usage:f};if(n.length===0||n[0]==="help"||n[0]==="--help"||n[0]==="-h"){let o=n[0]==="help"?n[1]:void 0;return o===void 0?{help:f}:Object.hasOwn(m,o)?{help:m[o]}:{error:`No such command: ${o} (${d.join(", ")}).`,usage:f}}let[c,...p]=n;if(!Object.hasOwn(y,c))return{error:w(c)?`Unknown option: ${c} (the command comes first: gallery <command> [options]).`:`No such command: ${c} (${d.join(", ")}).`,usage:f};let h=[...p,...u];if(p.some(o=>o==="--help"||o==="-h"))return{help:m[c]};if(c==="init"){let o=new Set(["--from"]),r=[];for(let a=0;a<p.length;a++)o.has(p[a])?a++:w(p[a])||r.push(p[a]);if(r.push(...u.slice(1)),r.length>1)return{error:"Name one folder at most.",usage:m.init,command:c};if(r.length===1){if(s!==null&&l.resolve(s)!==l.resolve(r[0]))return{error:`Two workspaces named: ${r[0]} and --workspace ${s}.`,usage:m.init,command:c};s=r[0]}}return{command:c,argv:h,flag:s}}var N=(t,e)=>`Cannot write the workspace ${t} (${e}): allow Gallery to write there, or pass --workspace <a folder you may write>.`,A=(t,e=!0)=>e?`${l.join(t,"gallery.json")} is not Gallery's (another program's file of that name): pass --workspace <another folder> for Gallery's documents.`:`${l.join(t,"gallery.json")} does not read as JSON: mend the file, or pass --workspace <another folder> for Gallery's documents.`;async function G(t=process.argv.slice(2)){process.stdout.on("error",o=>{throw o.code==="EPIPE"&&process.exit(process.exitCode??0),o});let e=j(t);if(e.version)return void console.log(g());if(e.help)return void console.log(e.help);e.error&&(console.error(`${e.error}
|
|
4
|
+
${S(e.usage,e.command)}`),process.exit(2));let{command:i,flag:u}=e,{findWorkspace:n}=await import("../browser/shared/workspace.mjs"),s=n({flag:u});if(process.env.GALLERY_WORKSPACE=s.root,!E.has(i)){let{ensureWorkspace:o}=await import("../browser/shared/workspace.mjs");try{let{ours:r,reads:a}=await o(s.root);r||(console.error(A(s.root,a)),process.exit(1))}catch(r){if(!r.code)throw r;console.error(N(s.root,r.code)),process.exit(1)}}let{UsageError:c,usageFailureText:p}=await import("./chunk-2B5E4CDJ.mjs"),h=await y[i]();try{await h.run(e.argv,{command:i,workspace:s.root,how:s.how,version:g()})}catch(o){if(!(o instanceof c))throw o;console.error(p(m[i],o.message,o.synopsis)),process.exit(2)}}var k=t=>{try{return O.native(t)}catch{return null}};process.argv[1]&&k(process.argv[1])===k(v(import.meta.url))&&G();export{g as a,j as b,N as c,A as d,G 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{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-742D2WWJ.mjs";import"./chunk-5L7RYZCL.mjs";export{a as Browser,b as BrowserPlatform,c as BrowserTag,o as CDP_WEBSOCKET_ENDPOINT_REGEX,y as CLI,k as Cache,d as ChromeReleaseChannel,s as DefaultProvider,j as InstalledBrowser,q as Process,r as TimeoutError,p as WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX,z as buildArchiveFilename,w as canDownload,l as computeExecutablePath,m as computeSystemExecutablePath,f as createProfile,i as detectBrowserPlatform,x as getDownloadUrl,v as getInstalledBrowsers,h as getVersionComparator,t as install,n as launch,e as resolveBuildId,g as resolveDefaultUserDataDir,u as uninstall};
|
|
@@ -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{d as e}from"./chunk-742D2WWJ.mjs";function a(r){switch(r){case"chrome":return e.STABLE;case"chrome-dev":return e.DEV;case"chrome-beta":return e.BETA;case"chrome-canary":return e.CANARY}}export{a};
|
|
@@ -0,0 +1,26 @@
|
|
|
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{d as ht,n as Wt,p as Pt}from"./chunk-W63L7367.mjs";import{b as P,c as U,e as st}from"./chunk-A55HN5OK.mjs";import{createHash as Je}from"node:crypto";import{BLOCK_LEVEL as K}from"../browser/shared/html-tree.mjs";var nt=t=>Je("sha256").update(t).digest("hex").slice(0,16),F=t=>t.nodeName==="#text"&&!t.value.trim();function Nt(t,e){for(let s of t.childNodes??[]){if(s.tagName===e)return s;let a=s.tagName&&Nt(s,e);if(a)return a}return null}import{ATTRIBUTES as Qe,BOX_CLASSES as ts,COMPONENT_ATTRIBUTES as es,COMPONENT_CLASSES as ss,GROUPING as ns,IDENTITY as j,TOGGLES as as,UNIT_KINDS as os}from"../browser/editor/components/registry.mjs";import{attr as I,hasClass as xt}from"../browser/shared/html-tree.mjs";import{idsNamed as rs}from"../browser/shared/copy-ids.mjs";import{DIALOG as is,PAGE as cs,SECTION as ls,SHEETS as G,TABLE as Ut}from"../browser/editor/components/kit.mjs";import{matchesNode as Z,partOf as $t}from"../browser/shared/components/index.mjs";import{FLOW as at,HELD_TAGS as Ot}from"../browser/editor/components/list/index.mjs";var fs=new Set(["section","div","blockquote","ul","ol","aside","article"]),Ht=new Set(["script","style","template","noscript","link","meta","header","dialog","form","fieldset","label","input","select","textarea","button","summary","main","caption","dd","dt","tbody","thead","tfoot","tr","td","th","figcaption"]),Kt=new Set(["img","picture","svg","canvas","video","audio","iframe","object"]),kt=new Set(["hr","img"]),ds=new Set(["label","input","select","textarea","button"]),J=t=>ss.some(e=>xt(t,e))||es.some(e=>I(t,e)!==void 0);function Tt(t){let e=t.childNodes??[],s=e.findIndex(o=>Ot.has(o.tagName));if(s<0)return[];let a=e.slice(s);return a.every(o=>Ot.has(o.tagName)||F(o))?a.filter(o=>o.tagName):null}function Lt(t){return t.tagName==="li"&&t.parentNode?.tagName==="ol"&&xt(t.parentNode,at)&&t.childNodes.some(e=>e.tagName)&&t.childNodes.every(e=>e.tagName?Ot.has(e.tagName):e.nodeName!=="#text"||!e.value.trim())}function Ft(t){let e=t.tagName,s=t.sourceCodeLocation;return Ht.has(e)||!(K.has(e)||Kt.has(e))||I(t,"contenteditable")!==void 0?!1:!!(s?.startTag&&(s.endTag||kt.has(e)))}function Gt(t){if(!t.childNodes.every(s=>s.nodeName!=="#text"||!s.value.trim()))return!1;let e=t.childNodes.filter(s=>s.tagName);return e.length>0&&!e.some(s=>ds.has(s.tagName)||!(K.has(s.tagName)||Kt.has(s.tagName)||Ht.has(s.tagName)))}function bt(t,e=null){let s=t.tagName;if(!fs.has(s)||J(t)||I(t,"contenteditable")!==void 0)return null;let a=(I(t,"class")??"").split(/\s+/).filter(Boolean),o=t.childNodes.filter(d=>d.tagName),n=()=>o.every(d=>d.tagName==="li")&&t.childNodes.every(d=>d.tagName||!d.value?.trim());if(s==="ol"&&a.includes(at))return a.every(d=>d===at)&&n()?"flowchart":null;if(s==="ul"||s==="ol")return a.every(d=>(as.list??[]).includes(d))&&n()?"list":null;let r=t.childNodes.every(d=>d.nodeName!=="#text"||!d.value.trim()),l=Z(t,ls.match);if(s==="section"&&(a.length===0||l))return r&&(o.length>0||l)?"section":null;let u=ts.find(([d])=>a.includes(d))?.[1];return u&&r&&o.length===0?u:Gt(t)?u||(a.length>0?null:s==="blockquote"?"quote":ns.has(e)?"plain":null):null}var us=(t,e,s=()=>!1)=>Object.entries(e.sourceCodeLocation.attrs??{}).filter(([a])=>a!=="class"&&a!==j&&!s(a,I(e,a))).sort((a,o)=>a[1].startOffset-o[1].startOffset).map(([,a])=>` ${t.slice(a.startOffset,a.endOffset)}`).join("");function z(t,e=t.parentNode){let s=(o,n,r)=>(!n||[n].flat().includes(o?.tagName))&&(!r||xt(o,r));return os.find(({tag:o,class:n,attr:r,parent:l})=>s(t,o,n)&&(!r||I(t,r)!==void 0)&&(!l||e?.tagName&&s(e,l.tag,l.class)))?.kind??"block"}var ms={flowchart:{tagName:"ol",attrs:[{name:"class",value:at}]}},Ma=(t,e)=>z(t,ms[e]??null);function qt(t,e){let s=[],a=[],o=i=>i.parentNode.childNodes,n=i=>o(i)[o(i).indexOf(i)-1]??null,r=i=>/^[ \t]*$/.test(e.slice(e.lastIndexOf(`
|
|
3
|
+
`,i-1)+1,i)),l=i=>{let f=n(i);for(;f&&F(f);)f=n(f);return f?.tagName?f:null},u=i=>{if(!Z(i,Ut.frame))return null;let f=l(i);return f&&Z(f,Ut.lead)&&f.sourceCodeLocation?.endTag?f:null},d=(i,f)=>{let $=i.sourceCodeLocation.startOffset;for(let x=n(i);x;)if(F(x)&&(x.value.match(/\n/g)?.length??0)<=1)x=n(x);else if(x.nodeName==="#comment"&&x.sourceCodeLocation&&r(x.sourceCodeLocation.startOffset))f.add(x),$=x.sourceCodeLocation.startOffset,x=n(x);else break;return $},m=(i,f,$,x)=>{let c=i.sourceCodeLocation,N=u(i),L=c.attrs?.class,O={id:s.length,tag:i.tagName,kind:z(i),box:f.id,parent:$?.id??null,start:d(N??i,x),end:c.endOffset,elStart:c.startOffset,at:c.startTag.endOffset-1,lead:N?N.sourceCodeLocation.startTag.endOffset-1:null,classAttr:L?{start:L.startOffset,end:L.endOffset,value:I(i,"class")}:null,attrs:i.attrs.map(({name:S,value:A})=>({name:S,value:A})),blockId:I(i,j)??null,carried:us(e,i,S=>!!Qe[z(i)]?.[S]),blockIdAttr:c.attrs?.[j]?{start:c.attrs[j].startOffset,end:c.attrs[j].endOffset}:null,companion:null,keep:null,node:i,nodes:N?[N,i]:[i]};return s.push(O),N&&x.add(N),O},g=(i,f,$,x=null)=>{let c=i.sourceCodeLocation,N={id:a.length,kind:f,unit:$?.id??null,key:x,at:c.startTag.endOffset-1,innerEnd:c.endTag?.startOffset??null,pure:!0};return a.push(N),N},T=(i,f,$)=>{let x=g(i,"tabs",f),c=new Set;for(let N of i.childNodes){if(!N.tagName){N.nodeName==="#text"&&N.value.trim()&&(x.pure=!1);continue}let L=I(N,G.tabKey),O=L&&$.find(M=>I(M,G.panelKey)===L);if(N.tagName!=="button"||!Z(N,G.tab)||!O?.sourceCodeLocation?.endTag||!N.sourceCodeLocation?.endTag){x.pure=!1;continue}let S=m(N,x,f,c);S.kind="tab",S.key=L;let A=O.sourceCodeLocation;S.companion={tag:O.tagName,start:d(O,new Set),end:A.endOffset,elStart:A.startOffset},S.nodes.push(O)}for(let N of i.childNodes)N.nodeName==="#comment"&&!c.has(N)&&(x.pure=!1)},E=(i,f,$,x=null)=>{let c=g(i,f,$,x),N=new Set,L=i.childNodes.filter(O=>O.tagName);L.forEach((O,S)=>{if(L[S+1]&&u(L[S+1])===O)return;if(f==="header"&&O.tagName==="h1"||!Ft(O)){c.pure=!1,O.tagName==="dialog"&&k(O,$),f==="main"&&Z(O,cs.header)&&O.sourceCodeLocation?.endTag&&E(O,"header",null);return}y(O,m(O,c,$,N),f)});for(let O of i.childNodes)(O.nodeName==="#text"?O.value.trim():!O.tagName&&!N.has(O))&&(c.pure=!1)},y=(i,f,$)=>{if(f.kind==="sheets"){let x=$t(i,G.panels),[c]=$t(i,G.row);c&&T(c,f,x);for(let N of x)(Gt(N)||N.sourceCodeLocation?.endTag&&N.childNodes.every(F))&&E(N,"panel",f,I(N,G.panelKey))}else if(i.tagName==="details")for(let x of i.childNodes)x.tagName&&bt(x)==="details"&&E(x,"details",f);else if(i.tagName==="li"&&Lt(i))E(i,"node",f);else if(i.tagName==="li")C.push([i,f]);else{let x=bt(i,$);x&&E(i,x,f)}},k=(i,f)=>{let[$]=$t(i,is.content);$&&bt($)==="dialog"&&E($,"dialog",f,I(i,"id")??null)},C=[],h=(i,f)=>{let $=Tt(i);if($===null||!i.sourceCodeLocation?.endTag)return;let x=g(i,"nest",f);x.pure=!1,f.nested=$.length>0;let c=new Set;for(let N of $)Ft(N)&&y(N,m(N,x,f,c),"nest")},b=Nt(t,"main");b?.sourceCodeLocation?.startTag&&E(b,"main",null);for(let i=0;i<C.length;i++)h(...C[i]);let p=Os(t,s);return{units:s,boxes:a,referenced:p}}var ps=t=>t===void 0||/^\s*(?:module|(?:text|application)\/(?:x-)?(?:javascript|ecmascript)|text\/javascript1\.[0-5]|text\/(?:jscript|livescript))?\s*$/i.test(t);function gs(t){let e=hs(t),s=new Set,a=[],o=/(["'`])((?:(?!\1)[^\\\n]|\\.)*)\1/g,n=m=>m.split(/\s+/).filter(Boolean).forEach(g=>s.add(g)),r=/(?:\bclassList\s*\.\s*(?:add|remove|toggle|contains|replace)|\.classed|\bgetElementsByClassName|\.(?:has|add|remove|toggle)Class|\bclassName\s*\.\s*(?:includes|indexOf|startsWith|endsWith)|\bclassName\s*\.\s*split\s*\([^)]*\)\s*\.\s*(?:includes|indexOf))\s*\(\s*((?:(["'`])(?:(?!\2)[^\\\n]|\\.)*\2\s*,?\s*)+)/g;for(let[,m]of t.matchAll(r))for(let[,,g]of m.matchAll(o))n(g);if(/(["'`])[^"'`\n]*\.\1\s*\+|\.\$\{/.test(t)||/(?:\bclassList\s*\.\s*(?:add|remove|toggle|contains|replace)|\.classed|\.(?:has|add|remove|toggle)Class)\s*\(\s*[A-Za-z_$][\w$.]*\s*[,)]/.test(t))for(let m of e)/^-?[A-Za-z_][\w-]*$/.test(m)&&s.add(m);let u=/\bclassName\s*(?:[!=]==?|=)\s*(["'`])((?:(?!\1)[^\\\n]|\\.)*)\1|(["'`])((?:(?!\3)[^\\\n]|\\.)*)\3\s*[!=]==?\s*[\w$.]*\bclassName\b/g;for(let m of t.matchAll(u))n(m[2]??m[4]);let d=/\[\s*class\s*([~|^$*]?)=\s*(?:"([^"]*)"|'([^']*)'|([^\]\s]+))\s*(?:[is]\s*)?\]/g;for(let m of e)for(let g of m.matchAll(d)){let T=g[2]??g[3]??g[4];g[1]===""||g[1]==="~"||g[1]==="|"?n(T):a.push(T)}return{names:s,partial:a,selectors:e.join(`
|
|
4
|
+
`)}}function hs(t){let e=[],s=[],a=0,o="",n=0,r=l=>{let u="";for(let d=l;d<t.length;d++){let m=t[d];if(m==="\\"){u+=t.slice(d,d+2),d++;continue}if(m==="`")return e.push(u),d+1;if(m==="$"&&t[d+1]==="{")return e.push(u),s.push(a),d+2;u+=m}return e.push(u),t.length};for(;n<t.length;){let l=t[n],u=t[n+1];if(l==="/"&&u==="/"){let d=t.indexOf(`
|
|
5
|
+
`,n);n=d<0?t.length:d;continue}if(l==="/"&&u==="*"){let d=t.indexOf("*/",n+2);n=d<0?t.length:d+2;continue}if(l==='"'||l==="'"){let d=n+1,m="";for(;d<t.length&&t[d]!==l&&t[d]!==`
|
|
6
|
+
`;)t[d]==="\\"?(m+=t.slice(d,d+2),d+=2):m+=t[d++];e.push(m),n=d+1,o="a";continue}if(l==="`"){n=r(n+1),o="a";continue}if(l==="}"&&s.length&&s.at(-1)===a){s.pop(),n=r(n+1),o="a";continue}if(l==="/"&&(!/[\w$)\]}]/.test(o)||/(?:^|[^\w$.])(?:return|typeof|case|in|of|void|delete|throw|yield|await|else|do)\s*$/.test(t.slice(Math.max(0,n-12),n)))){let d=n+1,m=!1;for(;d<t.length&&t[d]!==`
|
|
7
|
+
`&&(m||t[d]!=="/");)t[d]==="\\"?d++:t[d]==="["?m=!0:t[d]==="]"&&(m=!1),d++;if(t[d]==="/"){for(n=d+1;/[a-z]/i.test(t[n]??"");)n++;o="a";continue}}l==="{"?a++:l==="}"&&a--,/\s/.test(l)||(o=l),n++}return e}var Ns=/\bDocSheets\b|["'`]sheets-|\bactiveSheet\b|data-active-sheet|["'`]sheet["'`]|\bsheet\s*:/,$s=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function bs(t,e){if(!Ns.test(e))return!1;let s=$s(t),a=`(["'\`])${s}\\1`;return[`\\bsheet["'\`]?\\s*:\\s*${a}`,`\\.set\\(\\s*(["'\`])${s}\\1`,`\\.set\\(\\s*(["'\`])sheet\\1\\s*,\\s*(["'\`])${s}\\2`,`[!=]==?\\s*${a}`,`${a}\\s*[!=]==?`,`\\bcase\\s+${a}\\s*:`,`active-sheet\\s*=\\s*["']?${s}["'\\]]`].some(o=>new RegExp(o).test(e))}function Os(t,e){let s=[],a=new Map,o=h=>{for(let b of h.childNodes??[]){if(!b.tagName)continue;let p=b.sourceCodeLocation?.startOffset??-1;b.tagName==="script"&&I(b,"src")===void 0&&s.push({at:p,code:ps(I(b,"type")),text:b.childNodes.map(i=>i.value??"").join("")});for(let{name:i,value:f}of b.attrs)if(!(i==="aria-labelledby"&&b.tagName==="section"))for(let $ of rs(i,f))(a.get($)??a.set($,[]).get($)).push(p);o(b.tagName==="template"?b.content:b)}};o(t);let n=h=>h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=h=>h.slice(5).replace(/-([a-z])/g,(b,p)=>p.toUpperCase()),l=s.filter(h=>h.code),u=l.map(h=>h.text).join(`
|
|
8
|
+
`),d=h=>l.some(b=>h(b.at))?l.filter(b=>!h(b.at)).map(b=>b.text).join(`
|
|
9
|
+
`):u,m=new Map,g=(h,b)=>(p,i)=>{if(i!==u)return b(p,i);let f=`${h} ${p}`;return m.has(f)||m.set(f,b(p,i)),m.get(f)},T=g("id",(h,b)=>new RegExp(`#${n(h)}(?![\\w-])|(["'\`])${n(h)}\\1`).test(b)),E=g("data",(h,b)=>new RegExp(`${n(h)}(?![\\w-])|dataset\\.${r(h)}(?![\\w$])`).test(b)),y=new Map,k=g("class",(h,b)=>{y.has(b)||y.set(b,gs(b));let{names:p,partial:i,selectors:f}=y.get(b);return p.has(h)||i.some($=>$.includes(h))||new RegExp(`\\.${n(h)}(?![\\w-])`).test(f)}),C=h=>h.split(/\s+/).filter(b=>b&&!/^(doc-|katex)/.test(b));for(let h of e){let b=[[h.start,h.end],...h.companion?[[h.companion.start,h.companion.end]]:[]],p=v=>b.some(([w,_])=>v>=w&&v<_),i=new Map,f=new Map,$=new Map,x=(v,w,_)=>(v.get(w)??v.set(w,[]).get(w)).push(_),c=v=>{if(!v.tagName)return;let w=v.sourceCodeLocation?.startOffset??h.start;for(let{name:_,value:W}of v.attrs)_==="id"&&W?x(i,W,w):_.startsWith("data-")&&_!==j?x(f,_,w):_==="class"&&C(W).forEach(gt=>x($,gt,w));(v.tagName==="template"?v.content:v).childNodes?.forEach(c)};h.nodes.forEach(c);let N=d(p),L=(v,w,_)=>[...v].filter(([W])=>w(W)).map(([W,gt])=>({name:_(W),at:gt})),O=[...h.key&&s.some(v=>!p(v.at)&&bs(h.key,v.text))?[{name:`"${h.key}"`,at:[h.start]}]:[],...L(i,v=>T(v,N),v=>`#${v}`),...L(f,v=>E(v,N),v=>`[${v}]`),...L($,v=>k(v,N),v=>`.${v}`)],S=L(i,v=>(a.get(v)??[]).some(w=>!p(w)),v=>`#${v}`),A=O.length>0?O:S,M=A.flatMap(v=>v.at),pt=M.some(v=>!e.some(w=>w!==h&&h.start<=w.start&&w.end<=h.end&&w.start<=v&&v<w.end));h.keep=A.length>0?{reason:O.length>0?"script":"ref",names:A.map(v=>v.name),at:M,own:pt}:null}return h=>{let b=h.sourceCodeLocation;if(!b||!h.attrs.some(({name:$})=>$==="id"||$==="class"||$.startsWith("data-")))return null;let p=$=>$>=b.startOffset&&$<b.endOffset,i=d(p),f=null;for(let{name:$,value:x}of h.attrs)if($==="id"&&x){if(T(x,i))return"script";(a.get(x)??[]).some(c=>!p(c))&&(f="ref")}else{if($.startsWith("data-")&&$!==j&&E($,i))return"script";if($==="class"&&C(x).some(c=>k(c,i)))return"script"}return f}}function xs(t,e){let s=[],a=o=>{let n=o.sourceCodeLocation?.attrs?.[j];if(n){let r=n.startOffset>0&&/\s/.test(t[n.startOffset-1])?n.startOffset-1:n.startOffset;s.push({start:r,end:n.endOffset})}for(let r of o.content?.childNodes??o.childNodes??[])a(r)};return e.forEach(a),s.sort((o,n)=>o.start-n.start)}var zt=(t,e,s,a)=>{let o="",n=e;for(let r of a)r.start<n||r.end>s||(o+=t.slice(n,r.start),n=r.end);return o+t.slice(n,s)},ja=(t,e)=>{let s=xs(t,e.nodes),a=zt(t,e.start,e.end,s);return nt(e.companion?`${a}\0${zt(t,e.companion.start,e.companion.end,s)}`:a)};st();import{IDENTITY as ks}from"../browser/editor/components/registry.mjs";import{SHEETS as ot,TABLE as Xt}from"../browser/editor/components/kit.mjs";import{escapeAttribute as rt,escapeText as Vt}from"../browser/shared/escape.mjs";import{isInstance as Ts,matchesNode as yt}from"../browser/shared/components/index.mjs";import{attr as R}from"../browser/shared/html-tree.mjs";import{CHART_DATA as Ls,CHART_SOURCE as Yt}from"../browser/shared/table-chart.mjs";import{freshPrefix as ys,referencedIds as vs,rewrite as Cs}from"../browser/shared/copy-ids.mjs";var Zt=(t={})=>Object.entries(t).map(([e,s])=>s===""?` ${e}`:` ${e}="${rt(String(s))}"`).join(""),ct=(t,e)=>t[e-1]==="/"?e-1:e;function it(t,e,s){let a=e;for(;a>0&&/\s/.test(t[a-1]);)a--;return{start:a,end:s}}function qa(t){let e=s=>s.nodeName==="#text"?s.value:(s.childNodes??[]).map(e).join("");return e(U(t)).replace(/\s+/g," ").trim()}function Xa(t,{from:e,to:s}){let o=Jt(P(t,{sourceCodeLocationInfo:!0}))?.sourceCodeLocation;if(!o?.endTag||!e)return null;let n=t.slice(o.startTag.endOffset,o.endTag.startOffset),r=Vt(e),l=n.indexOf(r);if(l<0||n.indexOf(r,l+1)>=0)return null;let u=o.startTag.endOffset+l;return{start:u,end:u+r.length,text:Vt(s)}}function Jt(t){for(let e of t.childNodes??[]){if(e.tagName==="title")return e;if(e.tagName==="body")continue;let s=e.tagName&&Jt(e);if(s)return s}return null}function Ss(t){let e=[],s=0,a=null,o=0;for(let n=0;n<t.length;n++){let r=t[n];if(r==="&"){let l=/^&(#\d+|#x[\da-f]+|[a-z]\w*);/i.exec(t.slice(n));l&&(n+=l[0].length-1)}else a?r===a?a=null:r==="\\"&&n++:r==='"'||r==="'"?a=r:r==="("?s++:r===")"?s=Math.max(0,s-1):r===";"&&s===0&&(e.push(t.slice(o,n)),o=n+1)}return e.push(t.slice(o)),e.map(n=>n.trim()).filter(Boolean)}function Ct(t,e){let s=Ss(t);for(let[a,o]of e){let n=s.findIndex(r=>r.slice(0,r.indexOf(":")).trim()===a);o===null?n>=0&&s.splice(n,1):n>=0?s[n]=`${a}: ${o}`:s.push(`${a}: ${o}`)}return s.join("; ")}var Es=new Set(["pre","textarea","script","style"]);function Va(t){if(typeof t!="string"||!t.trim())return null;let s=U(t,{sourceCodeLocationInfo:!0}).childNodes.filter(u=>u.nodeName!=="#comment"&&!(u.nodeName==="#text"&&!u.value.trim())),[a,o]=s;if(s.length===2&&a.tagName==="button"&&yt(a,ot.tab)&&o.tagName&&o.sourceCodeLocation?.endTag&&R(a,ot.tabKey)&&R(o,ot.panelKey)===R(a,ot.tabKey)){let u=a.sourceCodeLocation.endOffset;return{element:a,source:t.slice(0,u),panel:t.slice(u).replace(/^\s+/,""),kind:"tab"}}let n=s.at(-1),r=s.length===2?s[0]:null;if(!n?.tagName||!n.sourceCodeLocation?.startTag||s.length>2||r&&!(r.tagName&&yt(r,Xt.lead)&&yt(n,Xt.frame)))return null;let l=z(n);return{element:n,source:t,kind:l}}function ws(t){let e=[],s=a=>{for(let o of a.childNodes??[]){if(!o.tagName)continue;let n=R(o,"id");n&&e.push(n),s(o.tagName==="template"?o.content:o)}};return s(P(t)),e}var Ya=(t,e)=>`${vt(t.slice(e.start,e.end),H(t,e.start),"")}
|
|
10
|
+
${vt(t.slice(e.companion.start,e.companion.end),H(t,e.companion.start),"")}`;function Za(t,e,{keys:s=null,taken:a=null}={}){let o=t.slice(e.start,e.end),n=[],r=U(o,{sourceCodeLocationInfo:!0}),l=[],u=y=>{for(let k of y.childNodes??[])k.tagName&&(l.push(k),u(k.tagName==="template"?k.content:k))};u(r);let d=vs(l.flatMap(y=>y.attrs)),m=new Set(l.map(y=>R(y,"id")).filter(y=>y&&d.has(y))),g=new Map;if(m.size>0){let y=a??new Set(ws(t)),k=ys(y);for(let C of m)g.set(C,`${k}${C}`),y.add(`${k}${C}`)}let T=y=>{for(let k of y.childNodes??[])if(k.tagName){for(let C of[ks,"id"]){let h=k.sourceCodeLocation?.attrs?.[C];h&&(C==="id"&&g.has(R(k,"id"))?n.push({start:h.startOffset,end:h.endOffset,text:`id="${rt(g.get(R(k,"id")))}"`}):n.push(it(o,h.startOffset,h.endOffset)))}for(let{name:C,prefix:h,value:b}of g.size>0?k.attrs:[]){let p=h?`${h}:${C}`:C,i=Cs(p,b,g),f=k.sourceCodeLocation?.attrs?.[p];i!==null&&f&&n.push({start:f.startOffset,end:f.endOffset,text:`${p}="${rt(i)}"`})}for(let C of[Ls,Yt]){let h=k.sourceCodeLocation?.attrs?.[C],b=R(k,C);!h||!s||!Object.hasOwn(s,b)||(s[b]!==null?n.push({start:h.startOffset,end:h.endOffset,text:`${C}="${rt(s[b])}"`}):C===Yt&&n.push(it(o,h.startOffset,h.endOffset)))}T(k.tagName==="template"?k.content:k)}};T(r);let E=n.sort((y,k)=>k.start-y.start).reduce((y,{start:k,end:C,text:h=""})=>y.slice(0,k)+h+y.slice(C),o);return vt(E,H(t,e.start),"")}function vt(t,e,s){if(e===null||s===null||e===s||!t.includes(`
|
|
11
|
+
`))return t;let a=[],o=l=>{for(let u of l.childNodes??[]){if(!u.tagName)continue;let d=u.sourceCodeLocation;(Es.has(u.tagName)||Ts(u))&&d?.startTag&&d.endTag?a.push([d.startTag.endOffset,d.endTag.startOffset]):o(u.tagName==="template"?u.content:u)}};o(U(t,{sourceCodeLocationInfo:!0}));let n="",r=0;for(let l of t.split(/(?<=\n)/)){let u=a.some(([m,g])=>r>m&&r<=g),d=l===`
|
|
12
|
+
`||l===`\r
|
|
13
|
+
`;n+=r>0&&!u&&!d&&l.startsWith(e)?s+l.slice(e.length):l,r+=l.length}return n}function H(t,e){let s=t.slice(t.lastIndexOf(`
|
|
14
|
+
`,e-1)+1,e);return/^[ \t]*$/.test(s)?s:null}function Is(t,e,s){let a=t.lastIndexOf(`
|
|
15
|
+
`,e-1)+1,o=t.indexOf(`
|
|
16
|
+
`,s),n=o<0?t.length:o+1;return/^[ \t]*$/.test(t.slice(a,e))&&/^[ \t]*\r?\n?$/.test(t.slice(s,n))?{start:a,end:n,text:""}:{start:e,end:s,text:""}}function Ja(t,e,s){let a=/^\s*(?=<\/li\s*>)/i.exec(t.slice(s,s+400));if(a)return{start:e-/\s*$/.exec(t.slice(Math.max(0,e-400),e))[0].length,end:s+a[0].length,text:""};let o=Is(t,e,s);if(o.start===e&&o.end===s)return o;let n=/^[ \t]*\r?\n$/,r=t.indexOf(`
|
|
17
|
+
`,o.end),l=r>=0&&n.test(t.slice(o.end,r+1)),u=t.lastIndexOf(`
|
|
18
|
+
`,o.start-2)+1,d=o.start>0&&n.test(t.slice(u,o.start)),m=t.slice(0,e).trimEnd(),g=m.endsWith(">")?m.slice(m.lastIndexOf("<")):"",T=/^<[a-z]/i.test(g)&&!/\/\s*>$/.test(g)&&!kt.has(g.match(/^<([a-z0-9-]+)/i)?.[1].toLowerCase()),E=/^\s*<\//.test(t.slice(s,s+200));return l&&(d||T)?{...o,end:r+1}:d&&E?{...o,start:u}:o}import{iconKind as As}from"../browser/shared/emoji/icon-value.mjs";import{SHEETS_LABEL as Bs}from"../browser/shared/components/sheets.mjs";var Qt=/^[a-z0-9][a-z0-9_-]{0,63}$/i,_s=(t,e="")=>`<button class="doc-sheet-tab" type="button" data-sheet-tab="${t.sheet}"${t.icon?` data-tab-icon="${t.icon}"`:""}${e}>${t.title}</button>`,te={sheets:{check:t=>typeof t.name=="string"&&Qt.test(t.name)&&t.children.length>=1&&t.children.every(e=>e.type==="tab")&&new Set(t.children.map(e=>e.sheet)).size===t.children.length,write(t,e){let s=e.inner===null?null:e.inner+e.step,a=Bs[e.language],o=e.block(`<div class="doc-sheet-tabs" aria-label="${a}">`,t.children.map(r=>_s(r,e.idOf(r))),"</div>",e.inner,s),n=t.children.map(r=>r.children.length===0?`<div data-doc-sheet="${r.sheet}"></div>`:e.block(`<div data-doc-sheet="${r.sheet}">`,r.children.map(l=>e.render(l,s)),"</div>",e.inner,s));return e.block(`<section class="doc-sheet-shell" data-doc-sheets="${t.name}" aria-label="${a}"${e.id}>`,[o,...n],"</section>")}},tab:{empty:!0,check:t=>typeof t.title=="string"&&t.title.trim()!==""&&t.title.length<=200&&!/[<>\r\n]/.test(t.title)&&typeof t.sheet=="string"&&Qt.test(t.sheet)&&(t.icon===void 0||As(t.icon)==="emoji")}};import{escapeMarkup as lt}from"../browser/shared/escape.mjs";import{imageFile as Ms}from"../browser/shared/media.mjs";import{emptyFigure as js}from"../browser/editor/components/media/write.mjs";var Rs=t=>typeof t=="string"&&t.length<=2e3&&/^https?:\/\/[^\s"<>]+$/.test(t),ee=(t,e)=>typeof t=="string"&&t.length<=e&&!/[\u0000-\u001f]/.test(t),se=t=>t.href===""&&!t.title&&!t.description&&!t.icon&&!t.cover&&t.caption==="",ne=t=>t==null||Ms(t),ae={bookmark:{check:(t,{validLeaf:e})=>se(t)||Rs(t.href)&&ee(t.title,300)&&ee(t.description??"",600)&&ne(t.icon)&&ne(t.cover)&&typeof t.caption=="string"&&(t.caption===""||e({tag:"figcaption"},t.caption)),write(t,e){if(se(t))return js("bookmark",e);let s=t.title.trim()||new URL(t.href).hostname,a=[`<span class="doc-bookmark-title">${lt(s)}</span>`,t.description?`<span class="doc-bookmark-description">${lt(t.description)}</span>`:"",`<span class="doc-bookmark-url">${t.icon?`<img class="doc-bookmark-icon" src="${t.icon}" alt="">`:""}<span class="doc-bookmark-href">${lt(t.href)}</span></span>`].join(""),o=t.cover?`<span class="doc-bookmark-cover"><img src="${t.cover}" alt=""></span>`:"",n=`<a class="doc-bookmark-card" href="${lt(t.href)}" target="_blank" rel="noopener noreferrer"><span class="doc-bookmark-text">${a}</span>${o}</a>`;return e.block(`<figure class="doc-bookmark"${e.id}>`,[n,`<figcaption>${t.caption}</figcaption>`],"</figure>")}}};import{BLOCK_TYPES as Ds,sizeValue as Ws}from"../browser/editor/components/registry.mjs";import{LINE_START as re,lineStart as Ps}from"../browser/shared/code-lines.mjs";import{hasClass as oe}from"../browser/shared/html-tree.mjs";import{CODE_HEIGHT as St,FOLDED_LINES as ie,validFolded as Us,validLanguage as Fs}from"../browser/editor/components/code/index.mjs";var zs=(t,e,s,a,o="",n="",r="",l="")=>`<div class="${t.className}"${s?` data-language="${s}"`:""}${l?` ${re}="${l}"`:""}${r?` ${ie}="${r}"`:""}${a?` style="${St}: ${a}"`:""}${o}><div class="doc-code-title">${n}</div><pre><code>${e}</code></pre></div>`,Hs=(t,e)=>t==="data-language"||t===ie||t===re||t==="style"&&new RegExp(`^\\s*${St}\\s*:[^;]*;?\\s*$`).test(e??""),Ks=t=>typeof t=="string"&&t.length<=200&&!/[<>\n]|&(?!(amp|lt|gt|quot|#39);)/.test(t),Gs=t=>(t.language===void 0||Fs(t.language))&&(t.folded===void 0||Us(t.folded))&&(t.height===void 0||Ws("code",St,t.height)===t.height)&&(t.title===void 0||Ks(t.title))&&(t.lineStart===void 0||typeof t.lineStart=="string"&&String(Ps(t.lineStart))===t.lineStart);function qs(t){let{node:e}=t;if(t.tag!=="div"||t.nested||!oe(e,Ds.code.className))return!1;let s=(o,n)=>{let r=o.childNodes??[],l=r.filter(u=>u.tagName);return l.length===n.length&&l.every((u,d)=>u.tagName===n[d])&&r.every(u=>u.tagName||!(u.value??"").trim())?l:null},a=s(e,["div","pre"]);return!!a&&oe(a[0],"doc-code-title")&&!!s(a[1],["code"])}var ce={code:{fields:["language","folded","height","title","lineStart"],check:Gs,leaf:(t,e,s)=>zs(t,e.html,e.language,e.height,s,e.title,e.folded,e.lineStart),written:qs,attribute:Hs}};import{sizeValue as Xs}from"../browser/editor/components/registry.mjs";import{MIN_COLUMNS as Vs,RATIO as le}from"../browser/editor/components/columns/index.mjs";var fe={columns:{check:t=>t.children.length>=Vs&&t.children.every(e=>e.type==="column")},column:{check:t=>t.ratio===void 0||Xs("column",le,t.ratio)===t.ratio,write(t,e){let s=t.ratio===void 0?"":` style="${le}: ${t.ratio}"`;return e.block(`<div class="doc-column"${s}${e.id}>`,e.children(e.inner),"</div>")}}};var de={details:{empty:!0,check:(t,{validLeaf:e})=>t.title===""||e({tag:"span"},t.title),write(t,e){let s=e.inner===null?null:e.inner+e.step,a=e.block('<div class="doc-details-content">',e.children(s),"</div>",e.inner,s),o=t.classes?.length?` ${t.classes.join(" ")}`:"";return e.block(`<details class="doc-details${o}"${e.id}>`,[`<summary><span class="doc-details-summary-label">${t.title}</span></summary>`,t.children.length>0?a:'<div class="doc-details-content"></div>'],"</details>")}}};var ue={dialog:{empty:!0,check(t,{usedIds:e}){return typeof t.id!="string"||!/^[A-Za-z][\w-]{0,63}$/.test(t.id)||e.has(t.id)?!1:(e.add(t.id),!0)},write(t,e){let s=t.children.length>0?e.block('<div class="doc-dialog-content">',e.children(e.deep(3)),"</div>",e.deep(2),e.deep(3)):'<div class="doc-dialog-content"></div>',a=e.block('<div class="doc-dialog-panel">',[s],"</div>",e.deep(1),e.deep(2));return e.block(`<dialog class="doc-dialog" id="${t.id}">`,[a],"</dialog>")}}};import{escapeAttribute as Ys}from"../browser/shared/escape.mjs";import{embedFile as me}from"../browser/shared/media.mjs";import{emptyFigure as Zs}from"../browser/editor/components/media/write.mjs";import{FILE_SANDBOX as Js,WEB_SANDBOX as Qs}from"../browser/editor/components/embed/index.mjs";var tn=t=>typeof t=="string"&&t.length<=2e3&&/^https:\/\/[^\s"<>]+$/.test(t),pe=t=>t.src===""&&t.height===void 0&&t.caption==="",ge={embed:{check:(t,{validLeaf:e})=>pe(t)||(tn(t.src)||me(t.src))&&(t.height===void 0||/^\d{2,4}px$/.test(t.height))&&typeof t.caption=="string"&&(t.caption===""||e({tag:"figcaption"},t.caption)),write(t,e){if(pe(t))return Zs("embed",e);let s=me(t.src),a=s?/\.pdf$/i.test(t.src)?"":` sandbox="${Js}"`:` sandbox="${Qs}" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen`,o=`<iframe class="doc-embed-frame" src="${Ys(t.src)}"${a} loading="lazy"></iframe>`,n=t.height?` style="--doc-embed-height: ${t.height}"`:"";return e.block(`<figure class="doc-embed${s?" doc-embed--file":""}"${n}${e.id}>`,[o,`<figcaption>${t.caption}</figcaption>`],"</figure>")}}};import{escapeMarkup as he}from"../browser/shared/escape.mjs";import{assetFile as en}from"../browser/shared/media.mjs";import{emptyFigure as sn}from"../browser/editor/components/media/write.mjs";var Ne=t=>t.href===""&&t.name===""&&t.size===void 0&&t.caption==="",nn=t=>typeof t=="string"&&t.trim()!==""&&t.length<=120&&!/[\u0000-\u001f<>:"/\\|?*]/.test(t),$e={file:{check:(t,{validLeaf:e})=>Ne(t)||en(t.href)&&nn(t.name)&&(t.size===void 0||/^\d+(\.\d)? (B|KiB|MiB|GiB)$/.test(t.size))&&typeof t.caption=="string"&&(t.caption===""||e({tag:"figcaption"},t.caption)),write(t,e){if(Ne(t))return sn("file",e);let s=t.size?`<span class="doc-file-size">${t.size}</span>`:"",a=`<a class="doc-file-link" href="${t.href}" download="${he(t.name)}"><span class="doc-file-name">${he(t.name)}</span>${s}</a>`;return e.block(`<figure class="doc-file"${e.id}>`,[a,`<figcaption>${t.caption}</figcaption>`],"</figure>")}}};import{FLOW as an,FLOW_DIRECTION as be,FLOW_RATIO as Oe}from"../browser/editor/components/flowchart/index.mjs";import{START as on,validDirection as xe,validStart as rn}from"../browser/editor/components/list/index.mjs";import{sizeValue as cn,TOGGLES as ln}from"../browser/editor/components/registry.mjs";var ke={flowchart:{check:t=>(t.start===void 0||rn(t.start))&&(t.direction===void 0||xe(t.direction))&&t.children.length>0,write:(t,e)=>e.block(`<ol class="${an}"${t.start?` ${on}="${t.start}"`:""}${t.direction?` ${be}="${t.direction}"`:""}${e.id}>`,e.children(e.inner),"</ol>")},step:{check:t=>(t.classes===void 0||Array.isArray(t.classes)&&new Set(t.classes).size===t.classes.length&&t.classes.every(e=>(ln.step??[]).includes(e)))&&(t.ratio===void 0||cn("step",Oe,t.ratio)===t.ratio)&&(t.direction===void 0||xe(t.direction))&&t.children.length>0,write(t,e){let s=t.classes?.length?` class="${t.classes.join(" ")}"`:"",a=t.direction?` ${be}="${t.direction}"`:"",o=t.ratio===void 0?"":` style="${Oe}: ${t.ratio}"`;return e.block(`<li${s}${a}${o}${e.id}>`,e.children(e.inner),"</li>")}}};import{SPAN as fn,SPAN_SIZE as Te,imageFile as Le}from"../browser/shared/media.mjs";import{emptyFigure as dn}from"../browser/editor/components/media/write.mjs";var un=/^\d{1,3}(\.\d{1,3})?( \d{1,3}(\.\d{1,3})?){3}$/,ye=t=>t.src===""&&t.caption===""&&t.span===void 0&&t.original===void 0&&t.classes===void 0,mn=t=>typeof t=="number"&&Number.isFinite(t)&&t>=Te.min&&t<=Te.max,ve={image:{check:(t,{validLeaf:e})=>ye(t)||Le(t.src)&&typeof t.caption=="string"&&(t.caption===""||e({tag:"figcaption"},t.caption))&&(t.span===void 0||mn(t.span))&&(t.original===void 0||Le(t.original)&&typeof t.crop=="string"&&un.test(t.crop)),write(t,e){if(ye(t))return dn("image",e);let s=["doc-image",...t.classes??[]].join(" "),a=t.span===void 0?"":` style="${fn}: ${Math.round(t.span*1e3)/1e3}"`,o=t.original===void 0?"":` data-original="${t.original}" data-crop="${t.crop}"`;return e.block(`<figure class="${s}"${a}${e.id}>`,[`<img src="${t.src}" alt=""${o}>`,`<figcaption>${t.caption}</figcaption>`],"</figure>")}}};st();import{isInstance as wt,partOf as we}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as ft,DATA_MOST as pn,NO_TEXT as gn,PACKAGE_ID as Ce,SCHEMA as Se,fitsDataScript as hn,isDataScript as Nn,noDataPart as $n,refusedInCopy as bn,refusedInData as On,schemaAhead as Ee}from"../browser/shared/components/installed.mjs";import{attr as q,walk as Ie}from"../browser/shared/html-tree.mjs";var dt=(t,e)=>{for(let s=t.parentNode;s;s=s.parentNode)if(s===e)return!0;return!1},Ae=t=>{let e=t.parentNode;for(;e&&!wt(e);)e=e.parentNode;return e??null};function Et(t,e){let a=Object.entries(e.get(q(t,ft))?.parts??{}).filter(([,{edit:o}])=>o==="data").map(([o,{at:n}])=>[o,we(t,n).find(r=>r.sourceCodeLocation&&!wt(r)&&Ae(r)===t)]).filter(([,o])=>o);return a.filter(([,o],n)=>!a.some(([,r],l)=>dt(o,r)||r===o&&l<n))}var xn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),kn="http://www.w3.org/1999/xhtml",Tn=t=>(t.content??t).childNodes;function Be(t,e,s,a){let o=s;for(let n of Tn(t)){let r=n.sourceCodeLocation;if(r?.startOffset!==o)return!1;if(n.tagName){let{startTag:l,endTag:u}=r,d=xn.has(n.tagName)||n.namespaceURI!==kn&&e.startsWith("/>",r.endOffset-2);if(u?!Be(n,e,l.endOffset,u.startOffset):!d)return!1}o=r.endOffset}return o===a}function Ln(t,e,s){if(e.tagName==="script")return Nn(e.tagName,e.attrs)&&hn(s);if($n(e.tagName))return!1;let{startTag:a,endTag:o}=e.sourceCodeLocation,n=t.slice(a.startOffset,a.endOffset),r=`${n}${s}${t.slice(o.startOffset,o.endOffset)}`,[l,...u]=U(e.parentNode,r,{sourceCodeLocationInfo:!0}).childNodes;if(u.length>0||l?.tagName!==e.tagName||l.sourceCodeLocation?.endOffset!==r.length||!l.sourceCodeLocation.endTag||!Be(l,r,n.length,n.length+s.length))return!1;let d=!1;return Ie(l,m=>{d||=On(m.tagName,m.attrs)}),!d}var _e={installed:{textParts(t,e){let s=e.get(q(t,ft));if(Ee(q(t,Se),s?.schema))return[];let a=Object.values(s?.parts??{}).filter(({edit:r})=>r==="text"),o=Et(t,e).map(([,r])=>r),n=[...new Set(a.flatMap(({at:r})=>we(t,r)))].filter(r=>r.sourceCodeLocation&&!wt(r)&&!gn.has(r.tagName)&&Ae(r)===t).filter(r=>!o.some(l=>l===r||dt(r,l)||dt(l,r)));return n.filter(r=>!n.some(l=>dt(r,l))).map(r=>({kind:"installed",part:r}))},source({package:t,html:e},{packages:s,written:a}){if(typeof t!="string"||!Ce.test(t))return null;if(e===void 0){let r=s.has(t)?Pt(s.get(t)):null;return r&&a(r)}let o=typeof e=="string"?Wt(e,t):null;if(!o)return null;let n=!1;return Ie({childNodes:[o.root]},r=>{n||=bn(r.tagName,r.attrs)}),n?null:a(o.markup)},unwritten:({package:t,html:e},{packages:s})=>e===void 0&&Ce.test(t)&&!s.has(t)?"no-package":"invalid",definition:(t,e)=>e.get(q(t,ft))?.definition,dataOf(t,e,s){let a=Et(e,s).filter(([,o])=>o.sourceCodeLocation.endTag);return a.length>0?Object.fromEntries(a.map(([o,n])=>[o,t.slice(n.sourceCodeLocation.startTag.endOffset,n.sourceCodeLocation.endTag.startOffset)])):null},rewrite(t,e,s,{packages:a}){let o=new Map(Et(e,a)),n=Object.keys(s),r=n.map(u=>s[u]);if(Ee(q(e,Se),a.get(q(e,ft))?.schema)||n.length===0||!r.every(u=>typeof u=="string")||!n.every(u=>o.has(u))||r.reduce((u,d)=>u+Buffer.byteLength(d),0)>pn||!n.every(u=>o.get(u).sourceCodeLocation.endTag&&Ln(t,o.get(u),s[u])))return null;let l=t.includes(`\r
|
|
19
|
+
`)?`\r
|
|
20
|
+
`:`
|
|
21
|
+
`;return n.map(u=>{let{startTag:d,endTag:m}=o.get(u).sourceCodeLocation;return{start:d.endOffset,end:m.startOffset,text:s[u].replace(/\r?\n/g,l)}})}}};import{CONTINUE as yn,START as vn,validStart as Cn}from"../browser/editor/components/list/index.mjs";var Me={item:{children:(t,e)=>t.children.length>0&&t.children.every(s=>e(s,"nest")),write:(t,e)=>e.block(`<li${t.classes?.length?` class="${t.classes.join(" ")}"`:""}${Zt(t.attributes)}${e.id}>${t.html}`,e.children(e.inner),"</li>")},numbers:{check:t=>(t.start===void 0||Cn(t.start))&&(t.continue===void 0||t.continue===!0),write:(t,e)=>e.block(`<ol${t.start?` ${vn}="${t.start}"`:""}${t.continue?` ${yn}`:""}${e.id}>`,e.children(e.inner),"</ol>")}};import{COLUMN_WIDTH as jn,NUMBERS as Rn,tableTiling as Dn,validTable as Wn}from"../browser/editor/components/table/index.mjs";import{CHART_SOURCE as Pn}from"../browser/shared/table-chart.mjs";import{widthHolder as Un}from"../browser/shared/table-slots.mjs";import{CELL_LOOKS as wn,COLUMN_WIDTH as De,validLook as In,validWidth as An}from"../browser/editor/components/table/index.mjs";import{tileSpans as We}from"../browser/shared/table-slots.mjs";import{attr as At}from"../browser/shared/html-tree.mjs";function Sn(t,e){let s=t.slice(e.startOffset,e.endOffset),a=/^[^=\s]+\s*=\s*(["'])([\s\S]*)\1$/.exec(s);return a?{value:a[2],quote:a[1]}:{value:s.replace(/^[^=\s]+\s*=?\s*/,""),quote:'"'}}function En(t,e,s){let a=ct(t,e.endOffset-1);for(;a-1>e.startOffset&&/\s/.test(t[a-1]);)a--;let o=[];for(let[n,r]of s){let l=e.attrs?.[n],u=l?Sn(t,l):null,d=typeof r=="function"?r(u):r,m=u&&typeof r=="function"?u.quote:'"',g=d===null?"":d===""&&typeof r!="function"?n:`${n}=${m}${d}${m}`;l&&d===null?o.push({...it(t,l.startOffset,l.endOffset),text:g}):l?o.push({start:l.startOffset,end:l.endOffset,text:g}):d!==null&&o.push({start:a,end:a,text:` ${g}`})}return o}function je(t,e,s,a){let o=e.sourceCodeLocation.startTag,n=t.slice(o.startOffset,o.endOffset),r=En(t,o,s).map((l,u)=>({...l,index:u}));for(let{start:l,end:u,text:d}of r.sort((m,g)=>g.start-m.start||g.index-m.index))n=n.slice(0,l-o.startOffset)+d+n.slice(u-o.startOffset);return a?n.replace(/^<\w+/,`<${a}`):n}function Bt(t){let e=t?.tagName==="table"?t:t?.childNodes?.find(g=>g.tagName==="table"),s=g=>!!(g?.sourceCodeLocation?.startTag&&g.sourceCodeLocation.endTag),a=g=>g.childNodes.filter(T=>T.tagName),o=g=>g.childNodes.every(T=>T.tagName||F(T));if(!s(e)||!o(e))return null;let n=a(e);if(n.some(g=>!["thead","tbody","colgroup","caption"].includes(g.tagName)))return null;let r=n.filter(g=>g.tagName==="thead"),l=n.filter(g=>g.tagName==="tbody");if(r.length>1||l.length!==1||r.length===1&&n.indexOf(r[0])>n.indexOf(l[0]))return null;let u=g=>g.tagName==="tr"&&s(g)&&o(g)&&a(g).every(T=>(T.tagName==="td"||T.tagName==="th")&&s(T)&&X(T,"rowspan")!==null&&X(T,"colspan")!==null),d=[...r,...l];if(!d.every(g=>s(g)&&o(g)&&a(g).every(u)))return null;let m=d.flatMap(g=>a(g).map(T=>({node:T,head:g.tagName==="thead",cells:a(T)})));return We(m.map(g=>({head:g.head,cells:g.cells.map(T=>[X(T,"rowspan"),X(T,"colspan")])})))?{table:e,head:r[0]??null,body:l[0],rows:m}:null}var Pe=1e3;function X(t,e){let s=At(t,e);return s===void 0?1:/^\s*\d{1,4}\s*$/.test(s)&&Number(s)>=1&&Number(s)<=Pe?Number(s):null}var Re=t=>t===void 0||Number.isInteger(t)&&t>=1&&t<=Pe,It=(t,e)=>t.slice(e.sourceCodeLocation.startTag.startOffset,e.sourceCodeLocation.startTag.endOffset),Bn=(t,e)=>t.slice(e.sourceCodeLocation.startTag.endOffset,e.sourceCodeLocation.endTag.startOffset),Ue=(t,e)=>[...(t??"").split(/\s+/).filter(s=>s&&!wn.includes(s)),...e.split(" ").filter(Boolean)].join(" "),_n=(t,e)=>`${e>1?` colspan="${e}"`:""}${t>1?` rowspan="${t}"`:""}`,Mn=(t,e,s,a,o,n,r)=>je(t,e,[...o!==void 0?[["class",l=>Ue(l?.value,o)||null]]:[],...n!==void 0?[["style",l=>Ct(l?.value??"",[[De,n]])||null]]:[],["scope",a],...r!==void 0?[["colspan",r[1]>1?String(r[1]):null],["rowspan",r[0]>1?String(r[0]):null]]:[]],s);function Fe(t,e,s,{validCell:a}){let o=Bt(e);if(!o||!Array.isArray(s?.rows)||s.rows.length===0||s.rows.length>2e3)return null;let{table:n,rows:r}=o,l=new Set;if(!s.rows.every((c,N)=>c&&typeof c.head=="boolean"&&(N===0||!c.head||s.rows[N-1].head)&&(c.from===null||Number.isInteger(c.from)&&r[c.from])&&Array.isArray(c.cells)&&c.cells.length<=5e3&&c.cells.every(L=>{if(!L||!["td","th"].includes(L.tag)||![void 0,null,"row","col"].includes(L.scope)||L.look!==void 0&&!In(L.look)||L.width!==void 0&&!An(L.width)||!Re(L.rowspan)||!Re(L.colspan)||L.rowspan===void 0!=(L.colspan===void 0)||L.scope&&L.tag!=="th")return!1;if(L.from!==null){let[O,S]=Array.isArray(L.from)?L.from:[];if(!r[O]?.cells[S]||l.has(`${O}:${S}`))return!1;l.add(`${O}:${S}`)}else if(typeof L.html!="string")return!1;return L.html===void 0||typeof L.html=="string"&&L.html.length<=1e5&&(L.html===""||a(L.tag,L.html))}))||!s.rows.some(c=>!c.head))return null;let d=c=>c.rowspan!==void 0?[c.rowspan,c.colspan]:c.from===null?[1,1]:[X(r[c.from[0]].cells[c.from[1]],"rowspan"),X(r[c.from[0]].cells[c.from[1]],"colspan")],m=We(s.rows.map(c=>({head:c.head,cells:c.cells.map(d)})));if(!m||s.rows.length*m.columns>5e3)return null;let g=r[0]?.node,T=g?H(t,g.sourceCodeLocation.startOffset):null,E=H(t,o.body.sourceCodeLocation.startOffset),y=H(t,n.sourceCodeLocation.startOffset),k=t.includes(`\r
|
|
22
|
+
`)?`\r
|
|
23
|
+
`:`
|
|
24
|
+
`,C=c=>{if(c.from===null){let pt=c.look?` class="${Ue("",c.look)}"`:"",v=c.width?` style="${Ct("",[[De,c.width]])}"`:"";return`<${c.tag}${pt}${v}${c.scope?` scope="${c.scope}"`:""}${_n(c.rowspan??1,c.colspan??1)}>${c.html}</${c.tag}>`}let[N,L]=c.from,O=r[N].cells[L],S=c.tag==="th"?c.scope??null:null;return`${O.tagName===c.tag&&(At(O,"scope")??null)===S&&c.look===void 0&&c.width===void 0&&c.rowspan===void 0?It(t,O):Mn(t,O,c.tag,S,c.look,c.width,c.rowspan===void 0?void 0:[c.rowspan,c.colspan])}${c.html??Bn(t,O)}</${c.tag}>`},h=c=>{let N=c.from===null?null:r[c.from];return N&&N.cells.length===c.cells.length&&c.cells.every((O,S)=>O.from?.[0]===c.from&&O.from[1]===S&&O.html===void 0&&O.look===void 0&&O.width===void 0&&O.rowspan===void 0&&O.tag===N.cells[S].tagName&&(O.tag!=="th"||(O.scope??null)===(At(N.cells[S],"scope")??null)))?t.slice(N.node.sourceCodeLocation.startOffset,N.node.sourceCodeLocation.endOffset):`${N?It(t,N.node):"<tr>"}${c.cells.map(C).join("")}</tr>`},b=(c,N,L)=>{let O=L?It(t,L):`<${c}>`;return T===null||E===null?`${O}${N.map(h).join("")}</${c}>`:`${O}${N.map(S=>`${k}${T}${h(S)}`).join("")}${k}${E}</${c}>`},p=s.rows.filter(c=>c.head),i=s.rows.filter(c=>!c.head),$=[...n.childNodes.filter(c=>c.tagName==="caption"||c.tagName==="colgroup").map(c=>t.slice(c.sourceCodeLocation.startOffset,c.sourceCodeLocation.endOffset)),...p.length?[b("thead",p,o.head)]:[],b("tbody",i,o.body)],x=E===null||y===null?$.join(""):`${$.map(c=>`${k}${E}${c}`).join("")}${k}${y}`;return{start:n.sourceCodeLocation.startTag.endOffset,end:n.sourceCodeLocation.endTag.startOffset,text:x}}var ze={table:{rewrite:Fe,plain:t=>Bt(t)!==null,check:(t,{validLeaf:e})=>Wn(t,s=>typeof s=="string"&&e({tag:"td"},s,{empty:!0})),write(t,e){let s=Dn(t),a=(y,k)=>t.spans?.[y]?.[k]??[1,1],o=new Map((t.widths??[]).map((y,k)=>[Un(s,k),y]).filter(([y,k])=>y&&k)),n=(y,k)=>{let[C,h]=a(y,k),b=o.get(`${y}:${k}`);return`${t.looks?.[y]?.[k]?` class="${t.looks[y][k]}"`:""}${b?` style="${jn}: ${b}"`:""}${h>1?` colspan="${h}"`:""}${C>1?` rowspan="${C}"`:""}`},r=(y,k,C)=>`<tr>${y.map((h,b)=>k?`<th${n(C,b)}>${h}</th>`:t.column&&s.places.get(`${C}:${b}`).c===0?`<th${n(C,b)} scope="row">${h}</th>`:`<td${n(C,b)}>${h}</td>`).join("")}</tr>`,l=e.inner===null?null:e.inner+e.step,u=l===null?null:l+e.step,[d,...m]=t.rows,g=[];t.header&&g.push(e.block("<thead>",[r(d,!0,0)],"</thead>",l,u));let T=t.header?m:t.rows,E=t.header?1:0;return T.length>0&&g.push(e.block("<tbody>",T.map((y,k)=>r(y,!1,k+E)),"</tbody>",l,u)),e.block(`<div class="doc-table-wrap"${t.numbers===!1?` ${Rn}="off"`:""}${t.chart?` ${Pn}="${t.chart}"`:""}${e.id}>`,[e.block('<table class="doc-table">',g,"</table>",e.inner,l)],"</div>")}}};var Q={...ae,...ce,...fe,...de,...ue,...ge,...$e,...ke,...ve,..._e,...Me,...te,...ze},Fn=Object.entries(Q).flatMap(([t,e])=>(e.fields??[]).map(s=>[s,t])),hr=t=>Fn.some(([e,s])=>t[e]!==void 0&&t.type!==s);st();import{HOSTS as et,IDENTITY as zn}from"../browser/editor/components/registry.mjs";import{CODE as Hn,MATH as Xe,MEDIA as Kn,PAGE as Gn,TABLE as qn}from"../browser/editor/components/kit.mjs";import{TAB as Xn}from"../browser/editor/components/paragraph/index.mjs";import{componentOf as Vn,isInstance as ut,matchesNode as D,partOf as Yn}from"../browser/shared/components/index.mjs";import{texSource as Zn}from"../browser/editor/components/math/index.mjs";import{MENTION as Mt,MENTION_ICON as He,MENTION_PAGE as Ke}from"../browser/shared/components/mention.mjs";import{imageFile as Jn}from"../browser/shared/media.mjs";import{isFileLink as Qn}from"../browser/shared/page-address.mjs";import{isInkClass as ta}from"../browser/editor/page/marks.mjs";import{ownInline as ea}from"../browser/editor/page/own.mjs";import{attr as B,hasClass as sa}from"../browser/shared/html-tree.mjs";var na=new Set(["h1","h2","h3","h4","p","li"]),aa=new Set(["h3","h4","p","figcaption"]),oa=Object.entries(et).flatMap(([t,e])=>(e.parts??[]).map(([s,a])=>{let o=Vn(s);if(o?.parts?.[a]?.edit!=="text")throw new Error(`Host ${t}: ${s} has no part ${a} edited as text`);return{kind:t,match:o.match,at:o.parts[a].at}})),ra=t=>oa.filter(({match:e})=>D(t,e)).flatMap(({kind:e,at:s})=>Yn(t,s).map(a=>({kind:e,part:a}))),ia=t=>t.sort((e,s)=>e.part.sourceCodeLocation.startOffset-s.part.sourceCodeLocation.startOffset),ca=Object.entries(et).filter(([,t])=>t.whole).map(([t,e])=>({kind:t,at:e.whole})),Ge=t=>ca.find(({at:e})=>D(t,e))?.kind,la=new Set(["strong","em","b","i","u","s","code","a","br","sup","sub"]),fa=new Set(["ul","ol","blockquote"]),_t=new Set(["pre","summary","button","label","select","textarea","form","template","script","style","svg","math","iframe","object","noscript","canvas","video","audio"]),_r={p:"p",h1:"p",h2:"p",h3:"p",h4:"p",li:"li"};function da(t,e,s){let a=et[t];if(!a)throw new Error(`Unknown block kind ${t}`);return a.caps({bound:s,blockLevel:K.has(e)})}var jt=t=>t.tagName==="span"&&D(t,Xe.inline),ua=t=>t.tagName==="a"&&sa(t,Mt),ma=/^https?:\/\/[^\s"<>]+$/i,tt=t=>t.attrs.map(e=>e.name).sort().join(),pa=t=>B(t,"class")===Mt&&t.childNodes.length===0&&(tt(t)==="class"||tt(t)===`class,${Ke}`&&B(t,Ke)==="");function ga(t){if(pa(t))return null;if(tt(t)!=="class,href"||B(t,"class")!==Mt||!(ma.test(B(t,"href"))||Qn(B(t,"href"))))return"mention";let[e,...s]=t.childNodes;return(e?.tagName==="img"?tt(e)==="alt,class,src"&&B(e,"class")===He&&B(e,"alt")===""&&Jn(B(e,"src")):e?.tagName==="span"&&tt(e)==="class"&&B(e,"class")===He&&e.childNodes.length===0)&&s.length>0&&s.every(o=>o.nodeName==="#text")&&s.some(o=>o.value.trim())?null:"mention"}var ha=t=>t.tagName==="span"&&t.attrs.length===1&&t.attrs[0].name==="class"&&t.attrs[0].value.trim().split(/\s+/).every(ta),Na=t=>t.tagName==="span"&&t.attrs.length===1&&t.attrs[0].name==="class"&&t.attrs[0].value===Xn,Rt=t=>la.has(t.tagName)||ha(t)||Na(t),$a=t=>Rt(t)||jt(t),mt=t=>(t.childNodes??[]).some(e=>e.nodeName==="#text"?e.value.trim()!=="":mt(e)),Ve=t=>ea(t.tagName,t.attrs,mt(t)),qe=t=>t.attrs.some(e=>e.name==="id"||e.name.startsWith("data-")&&e.name!==zn),ba=t=>/^(javascript|vbscript|data):/i.test(t.replace(/[\u0000- ]/g,"")),Oa=(t,e,s={})=>t==="text"?K.has(e)?!1:"atoms":t==="title"||t==="code"||t==="codeTitle"||t==="tex"||!!s.plain;function Dt(t,e,s=!1,{lists:a=!1,known:o=null}={}){for(let n of t.childNodes){if(n.nodeName==="#text")continue;if(!n.tagName)return"comment";if(s===!0)return`tag:${n.tagName}`;if(n.attrs.some(l=>/^on/i.test(l.name)))return"markup";if(s==="atoms"){if(!n.sourceCodeLocation?.endTag&&n.tagName!=="br")return"markup";if(o&&!o(n.sourceCodeLocation))return`tag:${n.tagName}`;e.push(n.sourceCodeLocation);continue}if(a&&(n.tagName==="ul"||n.tagName==="ol")){let l=xa(n,e,o);if(l)return l;continue}if(jt(n)){if(n.childNodes.some(l=>l.nodeName!=="#text"))return"markup";e.push(n.sourceCodeLocation);continue}if(ua(n)){let l=ga(n);if(l)return l;e.push(n.sourceCodeLocation);continue}if(Ve(n)){if(!n.sourceCodeLocation?.endTag)return"markup";if(o&&!o(n.sourceCodeLocation))return`tag:${n.tagName}`;e.push(n.sourceCodeLocation);continue}if(!Rt(n))return`tag:${n.tagName}`;if(n.tagName!=="br"&&!n.sourceCodeLocation?.endTag)return"markup";if(n.tagName==="a"&&ba(B(n,"href")??""))return"link";let r=Dt(n,e,!1,{known:o});if(r)return r}return null}function xa(t,e,s){if(t.attrs.length>0||!t.sourceCodeLocation?.endTag)return"markup";for(let a of t.childNodes){if(a.nodeName==="#text"&&!a.value.trim())continue;if(a.tagName!=="li")return`tag:${a.tagName??"text"}`;if(a.attrs.length>0||!a.sourceCodeLocation?.endTag)return"markup";let o=Dt(a,e,!1,{known:s});if(o)return o}return null}function V(t){let e=[],s=[],a=new Map,o=null,n=(p,i,f=null)=>{let $=p.sourceCodeLocation;if(!et[i]||!$?.startTag||B(p,"contenteditable")!==void 0)return!1;let x=[],c=Oa(i,p.tagName),N=f?{childNodes:p.childNodes.slice(0,p.childNodes.indexOf(f))}:p,L=$.endTag?Dt(N,x,c,{lists:i==="cell"}):"markup";if(L)return s.push({at:$.startTag.endOffset-1,reason:L}),!1;let O=$.startTag.endOffset,S=f?O+t.slice(O,f.sourceCodeLocation.startOffset).replace(/[ \t\r\n\f]+$/,"").length:$.endTag.startOffset,A={id:e.length,tag:p.tagName,kind:i,bound:!1,caps:{},start:$.startOffset,end:$.endOffset,innerStart:O,innerEnd:S,atoms:x.map(M=>[M.startOffset-O,M.endOffset-O]),wrapper:null,nested:!!f,node:p};return e.push(A),a.set(p,A),!0},r=p=>(p.childNodes??[]).filter(i=>i.tagName),l=p=>{let i=p.sourceCodeLocation;return i?.startTag&&i.endTag?t.slice(i.startTag.endOffset,i.endTag.startOffset):null},u=p=>p.tagName!=="a"&&!qe(p)&&mt(p)&&r(p).every(i=>Ve(i)?!mt(i):Rt(i)||jt(i)),d=p=>{for(let i of r(p))i.tagName==="td"||i.tagName==="th"?n(i,"cell"):["thead","tbody","tfoot","tr"].includes(i.tagName)&&d(i)},m=p=>{for(let i of r(p))i.tagName==="table"?d(i):!_t.has(i.tagName)&&!ut(i)&&m(i)},g=p=>{let i=r(p);i.length===1&&i[0].tagName==="code"&&p.childNodes.every(f=>f.tagName||!f.value?.trim())?n(i[0],"code"):i.length===0?n(p,"code"):p.sourceCodeLocation?.startTag&&s.push({at:p.sourceCodeLocation.startTag.endOffset-1,reason:"markup"})},T=(p,i=!0)=>{for(let f of r(p)){let $=f.tagName,x=ut(f);for(let{kind:c,part:N}of ia(x?Q[z(f)].textParts(f,o??=ht().packages):ra(f)))n(N,c);if(!x){if($==="div"&&D(f,Hn.match)){for(let c of r(f))c.tagName==="pre"&&B(c,"contenteditable")===void 0&&g(c);continue}if(!(_t.has($)||B(f,"contenteditable")!==void 0))if(Ge(f)&&r(f).every($a))n(f,Ge(f));else if($==="table")d(f);else if($==="figure"){let c=D(f,Kn);for(let N of r(f))if(!(c&&N.tagName==="figcaption"))if(aa.has(N.tagName))n(N,"field");else if(N.tagName==="table")d(N);else{if(_t.has(N.tagName))continue;ut(N)?T({childNodes:[N]},i):c||J(N)||qe(N)?m(N):T({childNodes:[N]},i)}}else if($==="details")for(let c of r(f))ut(c)?T({childNodes:[c]},i):c.tagName!=="summary"&&T(c,i);else if($==="h1"&&(p.tagName==="header"||D(f,Gn.title)))n(f,"title");else if($==="li"&&Lt(f))T({childNodes:r(f)},i);else if(na.has($)){let c=$==="li"?Tt(f):[];c?.length>0?(n(f,"flow",c[0]),T({childNodes:c},i)):n(f,"flow")||T(f,!1)}else if($==="div"&&D(f,Xe.block)&&r(f).length===0&&Zn(l(f)))n(f,"tex");else if($==="div"&&D(f,qn.lead))for(let c of r(f))c.tagName==="span"&&n(c,"field");else i&&!J(f)&&u(f)?n(f,"text"):(T(f,i&&!J(f)),fa.has($)&&E(f))}}},E=p=>{let i=p.sourceCodeLocation,f=r(p).map(c=>a.get(c));if(!(f.length>0&&f.every(Boolean)&&p.childNodes.every(c=>c.tagName||c.nodeName==="#text"&&!c.value.trim()))||!i?.endTag)return;let x={start:i.startOffset,end:i.endOffset,ids:f.map(c=>c.id)};f.forEach(c=>c.wrapper=x)},y=p=>{for(let i of r(p))(i.tagName==="main"?T:y)(i)},k=P(t,{sourceCodeLocationInfo:!0});y(k);let{units:C,boxes:h,referenced:b}=qt(k,t);for(let p of C)p.grid=!!Q[p.kind]?.plain?.(p.node);for(let p of C){let i=Q[p.kind]?.dataOf?.(t,p.node,o??=ht().packages);i&&(p.parts=Object.fromEntries(Object.entries(i).map(([f,$])=>[f,nt($)])))}for(let p of e){let i=null;for(let f of C)f.start<=p.start&&p.start<f.end&&(!i||f.start>i.start)&&(i=f);p.unit=i?.id??null,p.self=i&&i.at===p.innerStart-1?i.id:null,p.self!==null&&(i.text=p.id),p.path=i&&p.self===null?ka(i,p.node):null,et.text&&p.kind==="flow"&&p.self===null&&(i?.kind==="block"||i?.kind==="figure")&&(p.kind="text"),p.bound=b(p.node)!==null,p.caps=Object.fromEntries(da(p.kind,p.tag,p.bound).map(f=>[f,!0]))}return{blocks:e,locks:s,units:C,boxes:h}}function ka(t,e){let s=[],a=e;for(;a&&!t.nodes.includes(a);a=a.parentNode){let o=(a.parentNode?.childNodes??[]).filter(n=>n.tagName===a.tagName);s.unshift([a.tagName,o.indexOf(a),o.length])}return a?[a===t.node?"unit":a===t.nodes[0]&&t.lead!==null?"lead":"panel",...s]:null}var Mr=t=>V(t).blocks;function jr(t){let{units:e,boxes:s}=V(t);return{units:e,boxes:s}}st();import{randomBlockId as Ta}from"../browser/shared/ids.mjs";import{IDENTITY as Y}from"../browser/editor/components/registry.mjs";var La=/\sdata-block-id\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;function zr(t,e=Ta){let{units:s}=V(t),a=new Set([...t.matchAll(La)].map(m=>m[1]??m[2])),o=()=>{for(;;){let m=e();if(!a.has(m))return a.add(m)&&m}},n=new Set,r=[],l=[],u=[];for(let m of s)if(m.blockId)n.has(m.blockId)&&m.blockIdAttr?(l.push(m.blockId),r.push({start:m.blockIdAttr.start,end:m.blockIdAttr.end,text:`${Y}="${o()}"`})):n.add(m.blockId);else{let g=o();if(m.blockIdAttr)r.push({start:m.blockIdAttr.start,end:m.blockIdAttr.end,text:`${Y}="${g}"`});else{let T=ct(t,m.at);r.push({start:T,end:T,text:` ${Y}="${g}"`})}u.push({id:g,tag:Ze(m.tag,m.attrs),at:m.elStart})}let d=t;for(let m of r.sort((g,T)=>T.start-g.start))d=d.slice(0,m.start)+m.text+d.slice(m.end);return u.sort((m,g)=>m.at-g.at),{text:d,added:u.length,renamed:l,given:u.map(({id:m,tag:g})=>({id:m,tag:g}))}}function Hr(t){let e=Ye(t);return V(t).units.filter(s=>!s.blockId).sort((s,a)=>s.elStart-a.elStart).map(s=>({line:e(s.elStart),tag:Ze(s.tag,s.attrs)}))}function Kr(t,e){let s=new Map(e.map(o=>[o.id,o])),a=Ye(t);return V(t).units.filter(o=>s.has(o.blockId)).sort((o,n)=>o.elStart-n.elStart).map(o=>({...s.get(o.blockId),line:a(o.elStart)}))}function Ye(t){let e=[0];for(let s=t.indexOf(`
|
|
25
|
+
`);s!==-1;s=t.indexOf(`
|
|
26
|
+
`,s+1))e.push(s+1);return s=>{let[a,o]=[0,e.length-1];for(;a<o;){let n=a+o+1>>1;e[n]<=s?a=n:o=n-1}return a+1}}function Ze(t,e=[]){let s=e.filter(({name:n})=>n!==Y&&n!=="style"),a=n=>{let r=n.replace(/\s+/g," "),l=r.length>32?`${r.slice(0,31)}\u2026`:r;return l===""?"":/[\s"'=<>`]/.test(l)?`="${l.replaceAll('"',""")}"`:`=${l}`},o=s.slice(0,3).map(({name:n,value:r})=>`${n}${a(r)}`);return`<${[t,...o,...s.length>3?["\u2026"]:[]].join(" ")}>`}function Gr(t){let e=new Map,s=a=>{let o=a.attrs?.find(r=>r.name===Y)?.value,n=a.sourceCodeLocation?.attrs?.[Y]??a.sourceCodeLocation;o!==void 0&&e.set(o,[...e.get(o)??[],n]);for(let r of a.content?.childNodes??a.childNodes??[])s(r)};return s(P(t,{sourceCodeLocationInfo:!0})),[...e].filter(([,a])=>a.length>1).map(([a,o])=>({id:a,lines:o.map(n=>n?.startLine),columns:o.map(n=>n?.startCol)}))}export{nt as a,Nt as b,K as c,J as d,us as e,Ma as f,xs as g,ja as h,Zt as i,ct as j,it as k,qa as l,Xa as m,Ct as n,Va as o,ws as p,Ya as q,Za as r,vt as s,H as t,Is as u,Ja as v,_s as w,En as x,Q as y,hr as z,Ge as A,_r as B,$a as C,Oa as D,Dt as E,V as F,Mr as G,jr as H,Ta as I,La as J,zr as K,Hr as L,Kr as M,Gr as N};
|
|
@@ -0,0 +1,5 @@
|
|
|
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 $ from"node:fs";import{fileURLToPath as y}from"node:url";import{namedPlace as h}from"../browser/shared/page-address.mjs";import{pageLinks as w}from"../browser/shared/page-links.mjs";import{reportsDirectory as b}from"../browser/shared/paths.mjs";import{listReportSlugs as g,slugPattern as x}from"../browser/shared/reports.mjs";import{RESERVED as v,isSlugName as N,listTrash as O}from"../browser/shared/workspace.mjs";var d=e=>/^--.|^-[A-Za-z]/.test(e),i=class extends Error{constructor(n){super(n),this.name="UsageError"}};function A(e){let n=$.readFileSync(y(e),"utf8").split(/\r?\n/),t=n.findIndex(s=>!s.startsWith("//"));return n.slice(0,t===-1?n.length:t).map(s=>s.replace(/^\/\/ ?/,"")).join(`
|
|
3
|
+
`)}var E=e=>/^Usage: (gallery \S+|npm run \S+|node \S+)/.exec(e)?.[1]??"this command",P=e=>e.split(`
|
|
4
|
+
`)[0],R=(e,n,t=P(e))=>{let s=E(e);return`${n}
|
|
5
|
+
${t} (${s}${s.startsWith("npm run")?" --":""} --help says more)`},T=e=>{let n=e.indexOf("--");return(n===-1?e:e.slice(0,n)).some(t=>t==="--help"||t==="-h")};function k({options:e=[],values:n=[],argv:t=process.argv.slice(2)}={}){let s=t.indexOf("--"),[o,a]=s===-1?[t,[]]:[t.slice(0,s),t.slice(s+1)],u=[],l=new Set,p=new Map;for(let c=0;c<o.length;c++){let r=o[c],[f,S]=r.startsWith("--")&&r.includes("=")?[r.slice(0,r.indexOf("=")),r.slice(r.indexOf("=")+1)]:[r,void 0];if(!d(r))u.push(r);else if(n.includes(f)){let m=S??(c+1<o.length&&!d(o[c+1])?o[++c]:void 0);if(!m)throw new i(`${f} takes a value`);p.set(f,m)}else if(e.includes(r))l.add(r);else throw new i(`Unknown option: ${r}`)}return{positional:[...u,...a],options:l,values:p}}function U(e){if(!x.test(e))throw new i(`Not a document's slug: ${e} (lowercase kebab-case).`);if(v.has(e))throw new i(`Not a document's slug: ${e} (a name the workspace keeps for itself).`);return e}async function L(e){let n=await O(b),t=h(e,w(n));return t&&`${e} is a document in the trash ("${n.find(({slug:s})=>s===t.slug).title}"): it has to be restored in the workbench first.`}async function W(e){let n=(await g()).filter(N),t=h(e,w(n.map(o=>({slug:o}))));if(t)return t;let s=await L(e);if(s)throw new i(s);if(!x.test(e))throw new i(`Not a document's slug, link or address: ${e} (gallery list shows them).`);return{slug:U(e),block:null}}async function D({options:e=[],values:n=[],argv:t,noneIsAll:s=!1}={}){let{positional:o,options:a,values:u}=k({options:["--all",...e],values:n,argv:t}),l=a.has("--all");if(l&&o.length>0)throw new i("Name documents or pass --all, not both.");if(!l&&o.length===0&&!s)throw new i("Name a document (or pass --all).");let p=await Promise.all(o.map(W));return{slugs:l||o.length===0?await g():[...new Set(p.map(({slug:c})=>c))],options:a,values:u}}async function Z(e,{documents:n=!1,...t}={}){let s=A(e),o=t.argv??process.argv.slice(2);T(o)&&(console.log(s),process.exit(0));try{return n?await D({...t,argv:o}):k({...t,argv:o})}catch(a){if(!(a instanceof i))throw a;console.error(R(s,a.message)),process.exit(2)}}export{d as a,i as b,A as c,R as d,T as e,k as f,U as g,L as h,W as i,D as j,Z as k};
|
|
@@ -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,b}from"./chunk-V4CPWKMZ.mjs";import"./chunk-XINNG4F2.mjs";import"./chunk-7GHT2UCA.mjs";import"./chunk-G7TOXONE.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import"./chunk-NSKUTQ5J.mjs";import"./chunk-QMQUXTU4.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as noDocuments,b as run};
|
|
@@ -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 W from"node:http";import ot from"node:https";import it from"node:tls";import R from"node:zlib";import{Readable as st}from"node:stream";import{execFile as at}from"node:child_process";import{promisify as ct}from"node:util";var q=ct(at),lt=/^(localhost|127\.|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.|\[?::1\]?$|0\.0\.0\.0)/i;function ut(t,e){let r=t.toLowerCase();for(let o of e){let n=o.trim().toLowerCase();if(!n)continue;if(n==="*")return!0;if(n==="<local>"){if(!r.includes("."))return!0;continue}if(n.includes("*")){if(new RegExp(`^${n.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(r))return!0;continue}let i=n.replace(/^\./,"").replace(/:\d+$/,"");if(r===i||r.endsWith(`.${i}`))return!0}return!1}var D=t=>/^[a-z]+:\/\//i.test(t)?t:`http://${t}`;function ft(t=process.env){let e=t.HTTPS_PROXY||t.https_proxy||t.HTTP_PROXY||t.http_proxy||t.ALL_PROXY||t.all_proxy;return e?{url:D(e),bypass:(t.NO_PROXY||t.no_proxy||"").split(",")}:null}async function pt(){let{stdout:t}=await q("reg",["query","HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"],{windowsHide:!0,timeout:3e3}),e=n=>new RegExp(`^\\s*${n}\\s+REG_\\w+\\s+(.*)$`,"mi").exec(t)?.[1]?.trim();if(Number.parseInt(e("ProxyEnable")||"0",16)!==1)return null;let r=e("ProxyServer");if(!r)return null;let o=r;if(r.includes("=")){let n=Object.fromEntries(r.split(";").map(i=>i.split("=").map(s=>s.trim())));if(o=n.https||n.http,!o)return null}return{url:D(o),bypass:(e("ProxyOverride")||"").split(";")}}async function mt(){let{stdout:t}=await q("scutil",["--proxy"],{timeout:3e3}),e=o=>new RegExp(`\\b${o}\\s*:\\s*(\\S+)`).exec(t)?.[1];if(e("HTTPSEnable")!=="1"||!e("HTTPSProxy"))return null;let r=[...t.matchAll(/^\s*\d+\s*:\s*(\S+)\s*$/gm)].map(o=>o[1]);return{url:`http://${e("HTTPSProxy")}:${e("HTTPSPort")||80}`,bypass:r}}var I=null,H=0;async function dt(){let t=ft();if(t)return t;if(I!==null&&Date.now()-H<3e4)return I||null;let e=null;try{process.platform==="win32"?e=await pt():process.platform==="darwin"&&(e=await mt())}catch{e=null}return I=e||!1,H=Date.now(),e}async function ht(t){let e;try{e=new URL(t).hostname}catch{return null}if(lt.test(e))return null;let r=await dt();return r&&!ut(e,r.bypass)&&/^http:/i.test(r.url)?r.url:null}var M=t=>t.username?{"proxy-authorization":`Basic ${Buffer.from(`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`).toString("base64")}`}:{};function gt(t,e,r,o){return new Promise((n,i)=>{let s=W.request({host:t.hostname,port:t.port||80,method:"CONNECT",path:`${e}:${r}`,headers:{host:`${e}:${r}`,...M(t)},signal:o});s.once("connect",(l,m)=>{l.statusCode===200?n(m):(m.destroy(),i(new Error(`the proxy answered ${l.statusCode}`)))}),s.once("error",i),s.end()})}function yt(t,{method:e,headers:r,signal:o},n){let i=new URL(t),s=new URL(n),l={"accept-encoding":"gzip, deflate, br",...r};return new Promise((m,u)=>{let d=g=>{g.once("response",m),g.once("error",u),g.end()};if(i.protocol==="http:"){d(W.request({host:s.hostname,port:s.port||80,method:e,path:i.href,headers:{...l,host:i.host,...M(s)},signal:o}));return}gt(s,i.hostname,i.port||443,o).then(g=>{d(ot.request(i,{method:e,headers:{...l,host:i.host},defaultPort:443,signal:o,createConnection:()=>it.connect({socket:g,servername:i.hostname,ALPNProtocols:["http/1.1"]})}))},u)})}function wt(t,e){let r=new Headers;for(let[m,u]of Object.entries(t.headers))r.set(m,Array.isArray(u)?u.join(", "):String(u));let o=(t.headers["content-encoding"]||"").toLowerCase(),n={gzip:R.createGunzip,"x-gzip":R.createGunzip,deflate:R.createInflate,br:R.createBrotliDecompress}[o],i=n?t.pipe(n()):t;n&&(t.on("error",m=>i.destroy(m)),r.delete("content-encoding"),r.delete("content-length"));let s=[101,204,205,304].includes(t.statusCode);s&&t.resume();let l=new Response(s?null:st.toWeb(i),{status:t.statusCode,statusText:t.statusMessage,headers:r});return Object.defineProperty(l,"url",{value:e}),l}async function bt(t,{method:e="GET",headers:r={},signal:o}={},n){for(let i=0;;i++){let s=await yt(t,{method:e,headers:r,signal:o},n),l=s.headers.location;if([301,302,303,307,308].includes(s.statusCode)&&l&&i<10){s.resume(),t=new URL(l,t).href,s.statusCode===303&&(e="GET");continue}return wt(s,t)}}async function xt(t,e={}){let r=await ht(t);if(r)try{return await bt(t,e,r)}catch(o){if(e.signal?.aborted)throw o}return fetch(t,e)}var $t="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0 Safari/537.36";async function L(t,{timeout:e=1e4,accept:r="*/*",headers:o={},unreachable:n="\u6253\u4E0D\u5F00\u8FD9\u4E2A\u7F51\u9875",protocols:i=["http:","https:"]}={}){let s;try{s=new URL(t)}catch{throw Object.assign(new Error("\u4E0D\u662F\u7F51\u5740"),{reason:"url"})}if(!i.includes(s.protocol))throw Object.assign(new Error("\u53EA\u652F\u6301 http(s) \u7F51\u5740"),{reason:"url"});return xt(s,{redirect:"follow",signal:AbortSignal.timeout(e),headers:{"user-agent":$t,accept:r,...o}}).catch(()=>{throw Object.assign(new Error(n),{reason:"download"})})}async function _(t,e){let r=t.body.getReader(),o=[],n=0;for(;;){let{done:i,value:s}=await r.read();if(i)break;if(o.push(Buffer.from(s)),n+=s.length,n>=e){r.cancel().catch(()=>{});break}}return Buffer.concat(o)}async function j(t,e){let r=await _(t,e+1);return r.length<=e?r:null}import{createHash as Tt,randomUUID as Rt}from"node:crypto";import b from"node:fs/promises";import P from"node:path";import{refusal as jt,said as Q,saying as vt}from"../browser/shared/i18n/index.mjs";import{extensionOf as Ft,imageExtension as It,imageFile as Y,mediaTypeOf as _t,UPLOAD_LIMITS as S}from"../browser/shared/media.mjs";import{slugPattern as z}from"../browser/shared/reports.mjs";import{documentDirectory as J,documentFiles as zt,layoutOf as At}from"../browser/shared/workspace.mjs";import{refusal as Pt,said as St}from"../browser/shared/i18n/index.mjs";var Lt={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},G=t=>t.replace(/&(#x[0-9a-f]+|#\d+|\w+);/gi,(e,r)=>{if(r[0]==="#"){let o=r[1]==="x"||r[1]==="X"?parseInt(r.slice(2),16):Number(r.slice(1));return Number.isFinite(o)&&o>0&&o<=1114111?String.fromCodePoint(o):e}return Lt[r.toLowerCase()]??e}),B=t=>G(String(t??"")).replace(/\s+/g," ").trim();function Ot(t){let e={};for(let r of t.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+))/g))e[r[1].toLowerCase()]=r[3]??r[4]??r[5]??"";return e}function Et(t,e){let r=/charset=([\w-]+)/i.exec(e??"")?.[1];r||(r=/<meta[^>]+charset=["']?([\w-]+)/i.exec(t.subarray(0,4096).toString("latin1"))?.[1]);try{return new TextDecoder(r||"utf-8").decode(t)}catch{return new TextDecoder("utf-8").decode(t)}}function Ct(t,e){let r=t.search(/<\/head>/i),o=r>0?t.slice(0,r):t.slice(0,3e5),n={},i=[];for(let[u]of o.matchAll(/<(meta|link)\b[^>]*>/gi)){let d=Ot(u);if(/^<meta/i.test(u)){let g=(d.property||d.name||d.itemprop||"").toLowerCase();g&&d.content!==void 0&&!(g in n)&&(n[g]=d.content)}else d.rel&&d.href&&/(^|\s)(icon|shortcut icon|apple-touch-icon)(\s|$)/i.test(d.rel)&&i.push({rel:d.rel.toLowerCase(),href:d.href})}let s=u=>{try{return u?new URL(G(u),e).href:null}catch{return null}},l=/<title[^>]*>([\s\S]*?)<\/title>/i.exec(o)?.[1],m=i.find(u=>/(^|\s)icon(\s|$)/.test(u.rel))??i.find(u=>u.rel.includes("icon"));return{title:B(n["og:title"]||n["twitter:title"]||l||"").slice(0,300),description:B(n["og:description"]||n["twitter:description"]||n.description||"").slice(0,600),icon:s(m?.href)||s("/favicon.ico"),cover:s(n["og:image"]||n["og:image:url"]||n["og:image:secure_url"]||n["twitter:image"]||n["twitter:image:src"])}}async function kt(t){if(!t)return null;try{let e=await L(t,{timeout:8e3,accept:"image/*,*/*;q=0.5",protocols:["http:","https:","data:"]}),r=(e.headers.get("content-type")??"").split(";")[0].trim();if(!e.ok||!/^image\//.test(r))return null;let o=await j(e,5*1024*1024);return o?.length?o:null}catch{return null}}async function X(t){try{let e=await L(t,{timeout:8e3,accept:"text/html,*/*;q=0.8"});e.body?.cancel().catch(()=>{});let r=(e.headers.get("x-frame-options")??"").toLowerCase(),o=/frame-ancestors([^;]*)/i.exec(e.headers.get("content-security-policy")??"")?.[1]?.trim().toLowerCase();return/deny|sameorigin/.test(r)?{frameable:!1,reason:"x-frame-options"}:o!==void 0&&!/(^|\s)\*(\s|$)/.test(o)?{frameable:!1,reason:"frame-ancestors"}:{frameable:!0}}catch(e){return e.reason==="url"?{frameable:!1,reason:"url"}:{frameable:!0,reason:"unknown"}}}async function K(t,e,{icon:r=!0,cover:o=!0}={}){let n=await L(t,{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.8",headers:{"accept-language":"zh-CN,zh;q=0.9,en;q=0.8"}}),i=n.url||new URL(t).href,s=n.headers.get("content-type")??"";if(!n.ok)throw Pt(St("\u7F51\u9875\u8FD4\u56DE {0}",n.status),{reason:"download"});if(!/html|xml/i.test(s))return n.body?.cancel().catch(()=>{}),{url:i,title:"",description:"",icon:null,cover:null};let l=Ct(Et(await _(n,1.5*1024*1024),s),i),m=async(g,F)=>{let C=await kt(g);try{return C?await e(C,F):null}catch{return null}},[u,d]=await Promise.all([r?m(l.icon,"bookmark-icon"):null,o?m(l.cover,"bookmark-cover"):null]);return{url:i,title:l.title,description:l.description,icon:u,cover:d}}var Z=t=>Ft(String(t??"").replace(/[?#].*$/,"")),Nt=t=>{let e=String(t??"").replace(/[?#].*$/,"");e=e.slice(e.lastIndexOf("/")+1);try{e=decodeURIComponent(e)}catch{}return e.replace(/[\u0000-\u001f<>:"/\\|?*]/g,"").trim().slice(0,120)||"file"};function Ut(t){let e=t.subarray(0,16);return e[0]===137&&e.toString("latin1",1,4)==="PNG"?"image/png":e[0]===0&&e[1]===0&&e[2]===1&&e[3]===0?"image/x-icon":e[0]===255&&e[1]===216?"image/jpeg":e.toString("latin1",0,4)==="GIF8"?"image/gif":e.toString("latin1",0,4)==="RIFF"&&e.toString("latin1",8,12)==="WEBP"?"image/webp":e.toString("latin1",4,12)==="ftypavif"?"image/avif":/^\s*(<\?xml[^>]*>\s*)?(<!--[\s\S]*?-->\s*)*<svg\b/i.test(t.subarray(0,512).toString("utf8"))?"image/svg+xml":null}var E=(t,e)=>jt(e,{reason:t}),A=(t,e)=>{let r=Ut(t);if(!r)throw E("type","\u4EC5\u652F\u6301\u56FE\u7247");return It(r)},Ht=(t,e)=>Z(e),Wt=(t,e)=>{let r=Z(e);if(!["html","htm","pdf"].includes(r)||r==="pdf"&&t.subarray(0,5).toString("latin1")!=="%PDF-")throw E("type","\u53EA\u80FD\u5D4C\u5165 HTML \u6216 PDF \u6587\u4EF6");return r},v={big:t=>Q("\u56FE\u7247\u592A\u5927\uFF08\u6700\u591A {0} MB\uFF09",t),unreachable:"\u4E0B\u8F7D\u4E0D\u4E86\u8FD9\u5F20\u56FE\u7247"},V={big:t=>Q("\u6587\u4EF6\u592A\u5927\uFF08\u6700\u591A {0} MB\uFF09",t),unreachable:"\u4E0B\u8F7D\u4E0D\u4E86\u8FD9\u4E2A\u6587\u4EF6"},N={icon:{limit:S.icon,words:v,extension:A},image:{limit:S.image,words:v,extension:A},file:{limit:S.file,words:V,extension:Ht,named:!0},embed:{limit:S.embed,words:V,extension:Wt,named:!0}};function le(t,e,r,o){let n=N[t].extension(r,o);return`${t}-${e.slice(0,12)}${n?`.${n}`:""}`}function ue({reportsDirectory:t}){let e=At(t).emojiLibrary,r=async a=>{let c=J(a,t);return await b.stat(zt(c).html).catch(()=>null)?c:null},o=P.join(e,"library.json"),n=(a,c,f)=>[a,{ok:!1,reason:c,...vt(f)}];async function i(a,c,{stem:f,limit:p,words:y=v,extension:h=A,given:x}){let w=h(c,x);if(c.length>p)throw E("size",y.big(p/1024/1024));let O=`${f}-${Tt("sha256").update(c).digest("hex").slice(0,12)}${w?`.${w}`:""}`;await b.mkdir(a,{recursive:!0});let k=P.join(a,O);return await b.stat(k).catch(()=>null)||await b.writeFile(k,c),O}let s=(a,c,f,p=S.icon)=>i(a,c,{stem:f,limit:p});async function l(a,c,f=v){let p=await L(a,{unreachable:f.unreachable});if(!p.ok)throw E("download",f.unreachable);let y=await j(p,c);if(!y)throw E("size",f.big(c/1024/1024));return y}async function m(){try{let a=JSON.parse(await b.readFile(o,"utf8"));return Array.isArray(a)?a:[]}catch{return[]}}let u=a=>({id:a.id,name:a.name,url:`/__gallery/edit/emoji-library/${a.file}`,created_time:a.created,alive:!0});async function d(a){let{slug:c,data:f,url:p,library:y}=a??{},h=Object.hasOwn(N,a?.kind)?a.kind:"icon";if(typeof c!="string"||!z.test(c))return n(400,"body");let x=await r(c);if(!x)return n(404,"missing");let{limit:w,words:O,extension:k,named:rt}=N[h];try{let $,T;if(typeof f=="string")$=Buffer.from(f,"base64"),T=a.name;else if(typeof p=="string")$=await l(p,w,O),T=p;else if(typeof y=="string"){let U=(await m()).find(nt=>nt.id===y);if(!U)return n(404,"library","\u8FD9\u4E2A\u81EA\u5B9A\u4E49\u8868\u60C5\u5DF2\u4E0D\u5728\u8868\u60C5\u5E93\u91CC");$=await b.readFile(P.join(e,U.file))}else return n(400,"body");return[200,{ok:!0,path:`assets/${await i(P.join(x,"assets"),$,{stem:h,limit:w,words:O,extension:k,given:T})}`,...rt?{name:Nt(T),size:$.length}:{}}]}catch($){return n(422,$.reason??"write",$)}}async function g(a){let{slug:c,url:f,parts:p="all"}=a??{};if(typeof c!="string"||!z.test(c)||typeof f!="string"||!["all","icon","title"].includes(p))return n(400,"body");let y=await r(c);if(!y)return n(404,"missing");try{return[200,{ok:!0,...await K(f,async(x,w)=>`assets/${await s(P.join(y,"assets"),x,w,S.image)}`,{icon:p!=="title",cover:p==="all"})}]}catch(h){return n(422,h.reason??"download",h)}}async function F(a){return typeof a?.url!="string"?n(400,"body"):[200,{ok:!0,...await X(a.url)}]}async function C(a){let{slug:c,name:f,url:p}=a??{};if(typeof f!="string"||!/^[\p{Ll}\p{Lo}\d_-]{1,49}$/u.test(f)||typeof p!="string")return n(400,"body");let y=await m();if(y.some(h=>h.name===f))return n(409,"name","\u540D\u79F0\u5DF2\u88AB\u5360\u7528");try{let h;Y(p)&&typeof c=="string"&&z.test(c)?h=await b.readFile(P.join(J(c,t),p)):h=await l(p,S.icon);let x=await s(e,h,"emoji"),w={id:Rt(),name:f,file:x,created:Date.now()};return await b.writeFile(o,`${JSON.stringify([...y,w],null,2)}
|
|
3
|
+
`),[200,{ok:!0,entry:u(w)}]}catch(h){return n(422,h.reason??"write",h)}}let tt=async()=>[200,{ok:!0,list:(await m()).map(u)}];async function et(a){if(!Y(`assets/${a}`))return null;let c=await b.readFile(P.join(e,a)).catch(()=>null);return c&&{type:_t(a),body:c}}return{upload:d,unfurl:g,frameable:F,addEmoji:C,listEmojis:tt,readEmoji:et}}export{L as a,j as b,le as c,ue as d};
|