@heycys/gallery 0.1.1 → 0.2.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/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/columns/page.mjs +4 -4
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +7 -6
- package/browser/editor/components/icons.mjs +11 -0
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +15 -4
- package/browser/editor/components/installed/page.mjs +103 -25
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +30 -9
- package/browser/editor/components/table/index.mjs +61 -2
- package/browser/editor/components/table/page.mjs +1 -1
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/autosave.mjs +310 -37
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +182 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +1059 -0
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +210 -0
- package/browser/editor/page/caret.mjs +1 -1
- package/browser/editor/page/changes/bar.mjs +6 -14
- package/browser/editor/page/changes/index.mjs +2 -2
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +133 -15
- package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/clipboard/own/selection.mjs +1 -1
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +80 -22
- package/browser/editor/page/conflicts.mjs +7 -7
- package/browser/editor/page/core.mjs +34 -16
- package/browser/editor/page/custom-page.mjs +110 -0
- package/browser/editor/page/editor.mjs +71 -17
- package/browser/editor/page/emoji-picker/styles.mjs +7 -12
- package/browser/editor/page/emoji-picker/upload.mjs +2 -2
- package/browser/editor/page/handle/index.mjs +5 -8
- package/browser/editor/page/history.mjs +41 -6
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/look.mjs +54 -3
- package/browser/editor/page/margin.mjs +18 -3
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +33 -14
- package/browser/editor/page/notices.mjs +2 -2
- package/browser/editor/page/page-objects.mjs +9 -2
- package/browser/editor/page/panel.mjs +4 -9
- package/browser/editor/page/present-links.mjs +15 -5
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +48 -4
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/cells.mjs +102 -46
- package/browser/editor/page/table/index.mjs +24 -9
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +103 -0
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/text-select/index.mjs +26 -12
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/typing/index.mjs +97 -15
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/block-packs.mjs +419 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/colors.mjs +3 -2
- package/browser/shared/component-catalog.mjs +330 -46
- package/browser/shared/component-source.mjs +39 -0
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/index.mjs +12 -3
- package/browser/shared/components/installed.mjs +35 -3
- package/browser/shared/components/page.mjs +20 -8
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/document-look.mjs +10 -5
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/line-icons.mjs +37 -0
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +330 -27
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +359 -67
- package/browser/shared/pack-manifest.mjs +88 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +500 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +8 -1
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/sidebar-head.mjs +70 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +139 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/chunk-3MBRL2PM.mjs +16 -0
- package/dist/chunk-4OKWZY5E.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5K44HLTZ.mjs +2 -0
- package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
- package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/chunk-6N3PX4XX.mjs +8 -0
- package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/chunk-7JDX4E65.mjs +13 -0
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/chunk-7OG26PGF.mjs +2 -0
- package/dist/chunk-AHN3NFKJ.mjs +3 -0
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/chunk-AR5D57ZD.mjs +170 -0
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
- package/dist/chunk-CMA72MAG.mjs +2 -0
- package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
- package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-F4ZA6JRZ.mjs +3 -0
- package/dist/chunk-F6HVDZR4.mjs +2 -0
- package/dist/chunk-FDMAXMQA.mjs +2 -0
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/chunk-GHOYKMQ3.mjs +4 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/chunk-HPOI4ZX7.mjs +6 -0
- package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/chunk-IV64FFI4.mjs +2 -0
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/chunk-JA7G53PC.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JLTZF4LA.mjs +2 -0
- package/dist/chunk-JZT7I2OJ.mjs +2 -0
- package/dist/chunk-K5XATEOO.mjs +2 -0
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-LM4XFQHZ.mjs +2 -0
- package/dist/chunk-MN7BZL4R.mjs +2 -0
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/chunk-MXUBKDRO.mjs +15 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/chunk-OFHXGWOX.mjs +2 -0
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-PGDE24N5.mjs +2 -0
- package/dist/chunk-POTA2FV4.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QE5RG76S.mjs +549 -0
- package/dist/chunk-R2ZDLJYT.mjs +10 -0
- package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TR7TWGHB.mjs +2 -0
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/chunk-UGWMMEJ5.mjs +15 -0
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/chunk-VFX2KNHP.mjs +4 -0
- package/dist/chunk-VS7JIGJW.mjs +24 -0
- package/dist/chunk-W7665ZEC.mjs +6 -0
- package/dist/chunk-WQDQWCX5.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/chunk-YNAWBAYN.mjs +3 -0
- package/dist/chunk-YROX2O22.mjs +2 -0
- package/dist/chunk-ZDLPUOAG.mjs +6 -0
- package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZWWC4KLF.mjs +20 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-U6KNPJPR.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +17 -17
- package/kit/report.css +335 -18
- package/kit/runtime.js +1638 -125
- package/kit/state.js +10 -1
- package/kit/tables.js +130 -43
- package/kit/ui.js +79 -35
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +216 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +118 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +334 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +174 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +513 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +189 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +129 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +97 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +293 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +85 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +171 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +347 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +73 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +220 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +149 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +489 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +214 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +387 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +140 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +12 -10
- package/sdk/doc-kit.d.ts +396 -5
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +56 -23
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +225 -0
- package/skill/references/writing-html.md +8 -4
- package/skill/sdk/doc-kit.d.ts +396 -5
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-3HIRPVLU.mjs +0 -2
- package/dist/chunk-5MHMDLZD.mjs +0 -4
- package/dist/chunk-64K7IPLO.mjs +0 -255
- package/dist/chunk-6QXGZM36.mjs +0 -8
- package/dist/chunk-6RGJOMJP.mjs +0 -16
- package/dist/chunk-AJ73XJF3.mjs +0 -2
- package/dist/chunk-AUZGSZJH.mjs +0 -13
- package/dist/chunk-BFE45AKL.mjs +0 -2
- package/dist/chunk-BXO2ZY5P.mjs +0 -2
- package/dist/chunk-CEH4MRCC.mjs +0 -2
- package/dist/chunk-CY2FNNAB.mjs +0 -16
- package/dist/chunk-DFUDV4LX.mjs +0 -2
- package/dist/chunk-DKXG4XDG.mjs +0 -2
- package/dist/chunk-EZQ34M3F.mjs +0 -124
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FUKQNOQS.mjs +0 -9
- package/dist/chunk-JPOSLGOC.mjs +0 -6
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-L3QKH4OK.mjs +0 -26
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LEF6DRCK.mjs +0 -59
- package/dist/chunk-NO5NJCHO.mjs +0 -2
- package/dist/chunk-NQPVAU63.mjs +0 -2
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O35FIXRB.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-PL6GHLGD.mjs +0 -15
- package/dist/chunk-QJIR2BLP.mjs +0 -6
- package/dist/chunk-QUPLVPB2.mjs +0 -7
- package/dist/chunk-R7BNENLY.mjs +0 -4
- package/dist/chunk-S6O4UHLC.mjs +0 -2
- package/dist/chunk-SGJWQKEI.mjs +0 -2
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-TYK6VNAB.mjs +0 -10
- package/dist/chunk-UALRNVSE.mjs +0 -4
- package/dist/chunk-V3HXVQEM.mjs +0 -2
- package/dist/chunk-V5VXUJKG.mjs +0 -2
- package/dist/chunk-VBXMADMP.mjs +0 -2
- package/dist/chunk-VNV55RUA.mjs +0 -2
- package/dist/chunk-VPD2PS35.mjs +0 -2
- package/dist/chunk-W4VKN3GF.mjs +0 -7
- package/dist/chunk-W5BXXPDJ.mjs +0 -3
- package/dist/chunk-XUNHRCOG.mjs +0 -6
- package/skill/references/building-components.md +0 -367
- package/web/assets/index-Bh74DfsV.css +0 -1
- package/web/assets/index-UW0RyFFt.js +0 -13
|
@@ -1,3 +1,3 @@
|
|
|
1
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{
|
|
2
|
+
import{b as E}from"./chunk-ZQS6H473.mjs";import{g as M}from"./chunk-HXG7EOPJ.mjs";import{a as O}from"./chunk-HYMEEXKN.mjs";import{e as I,j as S}from"./chunk-VFX2KNHP.mjs";import d from"node:fs/promises";import b from"node:path";import{isInstance as T}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as _}from"../browser/shared/components/installed.mjs";import{exportSourceOf as q}from"../browser/shared/export-wrap.mjs";import{sha256 as w}from"../browser/shared/files.mjs";import{attr as g,hasClass as y}from"../browser/shared/html-tree.mjs";import{editStateDirectory as F,exportsDirectory as z,qaDirectory as G,reportsDirectory as H}from"../browser/shared/paths.mjs";import{documentDirectory as K,documentFiles as Q}from"../browser/shared/workspace.mjs";function V(t,e=null){return t.tagName==="figure"&&y(t,"doc-figure")||t.tagName==="div"&&(y(t,"doc-code")||y(t,"doc-diff"))||e===D||T(t)||y(t,"doc-flow")||y(t,"doc-sheet-shell")||g(t,"data-doc-sheets")!==void 0?0:t.tagName==="figure"||y(t,"doc-columns")?1:y(t,"doc-table-wrap")?2:3}function X(t){let e=new Map,n=new Map;for(let i of I(t).units)i.blockId&&!n.has(i.blockId)&&n.set(i.blockId,i.kind);let a=new Map,r=new Map,o=new Map,f=i=>!!i.tagName&&g(i,"data-block-id")!==void 0,u=(i,c)=>{if(i.nodeName==="#text")return i.value;if(!i.tagName||i.tagName==="template")return"";let s=g(i,"data-doc-chart-data")?.trim();s&&a.get(c).push(s);let l=g(i,"data-doc-chart-source")?.trim();l&&!r.has(l)&&r.set(l,c);let h=i.attrs.map(({name:k,value:N})=>`${k}="${N}"`).sort().join(" ");return`<${i.tagName} ${h}>${(i.childNodes??[]).map(k=>f(k)?"":u(k,c)).join("")}</${i.tagName}>`},m=(i,c)=>{for(let s of i.childNodes??[]){if(!s.tagName||s.tagName==="template")continue;let l=g(s,"data-block-id"),h=c;if(l!==void 0&&!e.has(l)){let k=[s.tagName,...(g(s,"class")??"").split(/\s+/).filter(Boolean).slice(0,1)].join("."),N=o.get(c)??0;o.set(c,N+1),a.set(l,[]);let v=V(s,n.get(l)),x=s.sourceCodeLocation,U=x?(x.endOffset??x.startTag?.endOffset??x.startOffset)-x.startOffset:0,B=u(s,l).replace(R," ");e.set(l,{hash:w(B).slice(0,16),bare:w(B.replace(`data-block-id="${l}"`,"")).slice(0,16),rank:v,card:v<3,whole:n.get(l)===D,figure:n.get(l)===tt,tag:k,parent:c,at:N,size:U,package:T(s)?g(s,_)??null:null}),h=l}m(s,h)}};m(O(t),null);let p=new Map([...e].map(([i,{hash:c,bare:s}])=>[i,{hash:c,bare:s}]));for(let[i,c]of a){let s=c.map(l=>p.get(r.get(l))).filter(Boolean);s.length&&(e.get(i).hash=w([p.get(i).hash,...s.map(({hash:l})=>l)].join("|")).slice(0,16),e.get(i).bare=w([p.get(i).bare,...s.map(({bare:l})=>l)].join("|")).slice(0,16))}return e}function Y(t){let e=[],n=a=>{for(let r of a.childNodes??[])if(!(!r.tagName||r.tagName==="template"||g(r,"data-block-id")!==void 0))if(r.tagName==="script"||r.tagName==="style"){let o=r.attrs.map(({name:f,value:u})=>`${f}="${u}"`).sort().join(" ");e.push(`<${r.tagName} ${o}>${(r.childNodes??[]).map(f=>f.value??"").join("")}`.replace(R," "))}else n(r)};return n(O(t)),e.length?w(e.join("|")).slice(0,16):""}var Z=t=>Object.fromEntries(M(t).map(({id:e,stamp:n})=>[e,n])),D="block",tt="figure",R=/[ \t\n\f\r]+/g,et=["export","preview"];function st(t){if(t==null)return null;try{let{blocks:e,places:n,moved:a,unseen:r,from:o,time:f,idless:u,page:m,packages:p}=JSON.parse(t)??{};if(!e||typeof e!="object"||Array.isArray(e))return null;let i=n&&typeof n=="object"&&!Array.isArray(n)?n:{},c=s=>Array.isArray(s)?s.filter(l=>typeof l=="string"):[];return{blocks:Object.fromEntries(Object.entries(e).filter(([,s])=>typeof s=="string")),places:Object.fromEntries(Object.entries(i).filter(([,s])=>Array.isArray(s)&&s.length===2&&(s[0]===null||typeof s[0]=="string")&&Number.isInteger(s[1]))),moved:c(a),unseen:c(r),...et.includes(o)?{from:o,time:Number.isFinite(f)?f:null}:{},...c(u).length?{idless:c(u)}:{},...typeof m=="string"?{page:m}:{},...p&&typeof p=="object"&&!Array.isArray(p)?{packages:Object.fromEntries(Object.entries(p).filter(([,s])=>typeof s=="string"))}:{}}}catch{return null}}var $="ge-idless-";function nt(t,{from:e,time:n}){let a=0,{text:r}=S(E(t).text,()=>`${$}${a++}`),o=Z(r),f={blocks:{},places:{},moved:[],unseen:[],from:e,time:n,page:Y(r),...Object.keys(o).length?{packages:o}:{}},u=[];for(let[m,{hash:p,bare:i,card:c,parent:s,at:l}]of X(r)){if(m.startsWith($)){u.push(i);continue}f.blocks[m]=p,s?.startsWith($)||(f.places[m]=[s,l]),c&&f.unseen.push(m)}return u.length?{...f,idless:u}:f}function yt(t,e){if(!e?.idless?.length)return e;let n=new Map;for(let o of e.idless)n.set(o,(n.get(o)??0)+1);let a={...e,blocks:{...e.blocks},unseen:[...e.unseen]};for(let[o,{hash:f,bare:u,card:m}]of t)Object.hasOwn(e.blocks,o)||!n.get(u)||(n.set(u,n.get(u)-1),a.blocks[o]=f,m&&a.unseen.push(o));let r=[...n].flatMap(([o,f])=>Array(f).fill(o));return r.length?a.idless=r:delete a.idless,a}var at=/<[^>]*\sdata-doc-placeholder\b/,j=t=>b.join(G,t),L=t=>b.join(j(t),"blocks.json"),P=t=>b.join(j(t),"exported.html");async function W(t){return st(await d.readFile(L(t),"utf8").catch(()=>null))!==null}async function C(t,e,n){let a=async c=>d.readFile(c).then(s=>({bytes:s,file:c}),()=>null),r=await a(P(t)),o=[r];if(e){let c=e.slice(0,16),s=b.join(F,"history",t),l=await d.readdir(s).catch(()=>[]);o.push(...await Promise.all(l.filter(h=>h.endsWith(`-${c}.html`)).map(h=>a(b.join(s,h))))),o.push(await a(b.join(F,"snapshots",`${c}.html`)))}let f=r?(await d.stat(r.file).catch(()=>null))?.mtimeMs??null:null,m=!(r&&e&&n!==null&&f!==null&&f>n&&w(r.bytes)!==e)&&e&&o.find(c=>c&&w(c.bytes)===e),p=m||r;if(!p)return null;let i=m&&n!==null?n:p===r?f??n:(await d.stat(p.file).catch(()=>null))?.mtimeMs??n;return{text:p.bytes.toString("utf8"),time:i??null}}async function A(t){let e=b.join(z,`${t}.html`),[n,a]=await Promise.all([d.readFile(e,"utf8").catch(()=>null),d.stat(e).catch(()=>null)]);return n===null||!a?null:{said:q(n),time:a.mtimeMs}}async function J(t,e,n){if(at.test(e))return!1;let a=nt(e,n);return!Object.keys(a.blocks).length&&!a.idless?!1:(await d.mkdir(j(t),{recursive:!0}),await d.writeFile(L(t),`${JSON.stringify(a)}
|
|
3
3
|
`),!0)}async function bt(t){let e=new Map(await Promise.all(t.map(async a=>[a,await A(a).catch(()=>null)])));return{keep:async(a,r=null)=>{for(let o of a)try{if(!await W(o)){let m=e.get(o),p=await C(o,m?.said??null,m?.time??null);p&&await J(o,p.text,{from:"export",time:p.time})}let[f,u]=await Promise.all([d.readFile(Q(K(o,H)).html),r?{said:r.get(o)??null}:A(o)]);u?.said&&w(f)===u.said&&(await d.mkdir(j(o),{recursive:!0}),await d.writeFile(P(o),f))}catch{}}}}async function kt(t,e){try{if(await W(t))return!1;let n=await A(t),a=await C(t,n?.said??null,n?.time??null);return await J(t,a?.text??e,a?{from:"export",time:a.time}:{from:"preview",time:Date.now()})}catch{return!1}}export{V as a,X as b,Y as c,Z as d,et as e,st as f,nt as g,yt as h,W as i,C as j,bt as k,kt as l};
|
|
@@ -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 D from"node:fs/promises";import R from"node:path";import{writeAtomic as Y}from"../browser/shared/files.mjs";var I=371,S=1,j=["reader","agent"],T=/^\d{4}-\d{2}-\d{2}$/,$=d=>String(d).padStart(2,"0");function k(d){let s=new Date(d);return`${s.getFullYear()}-${$(s.getMonth()+1)}-${$(s.getDate())}`}function x(d,s){let[h,e,w]=d.split("-").map(Number);return k(new Date(h,e-1,w+s,12))}function F(d){let s;try{s=JSON.parse(d)}catch{return null}let h=r=>r!==null&&typeof r=="object"&&!Array.isArray(r);if(!h(s)||s.version!==S||!T.test(s.since??"")||!h(s.days)||!h(s.seen))return null;let e={};for(let[r,t]of Object.entries(s.days))if(!(!T.test(r)||!h(t)))for(let[g,p]of Object.entries(t))for(let b of j){let l=p?.[b];Array.isArray(l)&&l.length===2&&l.every(Number.isInteger)&&l[0]>0&&(((e[r]??={})[g]??={})[b]=[l[0],l[1]])}let w={};for(let[r,t]of Object.entries(s.seen))h(t)&&Number.isFinite(t.mtime)&&typeof t.hash=="string"&&Number.isInteger(t.words)&&(w[r]={mtime:t.mtime,hash:t.hash,words:t.words});return{version:S,since:s.since,days:e,seen:w}}function V({file:d,now:s=()=>new Date,wait:h=1e3}){let e=null,w=null,r=!1,t=null,g=Promise.resolve(),p=()=>k(s());function b(){return w??=D.readFile(d,"utf8").then(F,()=>null).then(n=>(e=n??{version:S,since:p(),days:{},seen:{},fresh:!0},n||(r=!0),e)),w}function l(){r=!0,!t&&(t=setTimeout(()=>{t=null,A()},h),t.unref?.())}function E(){let n=x(p(),-(I-1));for(let i of Object.keys(e.days))i<n&&delete e.days[i];let{version:a,since:c,days:u,seen:f}=e;return`${JSON.stringify({version:a,since:c<n?n:c,days:u,seen:f})}
|
|
3
|
+
`}function A(){if(!e||!r)return g;r=!1,clearTimeout(t),t=null;let n=E();return g=g.then(async()=>{await D.mkdir(R.dirname(d),{recursive:!0}),await Y(d,n)}).catch(()=>{}),g}function N(n,a,c,u){let f=((e.days[a]??={})[n]??={})[j.includes(c)?c:"agent"]??=[0,0];f[0]+=1,f[1]+=u}return{load:b,get since(){return e?.since??p()},record(n,{hash:a,words:c,mtime:u,by:f}){if(!e)return!1;let i=e.seen[n];return e.seen[n]={mtime:u,hash:a,words:c},i?.hash===a?(i.mtime!==u&&l(),!1):(N(n,p(),f,c-(i?.words??0)),l(),!0)},async catchUp(n,a,{kept:c=[]}={}){await b();let u=e.fresh===!0;delete e.fresh;let f=0;for(let{slug:o,mtime:O}of n){let m=e.seen[o];if(m&&m.mtime===O)continue;let y=await a(o).catch(()=>null);if(!y||(e.seen[o]={mtime:y.edited,hash:y.hash,words:y.words},r=!0,u||m?.hash===y.hash))continue;let v=k(y.edited);N(o,v<e.since?e.since:v,"agent",y.words-(m?.words??0)),f+=1}let i=new Set([...n.map(({slug:o})=>o),...c]);for(let o of Object.keys(e.seen))i.has(o)||(delete e.seen[o],r=!0);return r&&l(),f},days(n=365){let a=p(),c=e?.since??a,u=x(a,-(Math.max(1,Math.min(I,n))-1));u<c&&(u=c);let f=[];for(let i=u;i<=a;i=x(i,1)){let o={date:i,edits:0,words:0,reader:{edits:0,words:0},agent:{edits:0,words:0}};for(let O of Object.values(e?.days[i]??{}))for(let m of j){let[y,v]=O[m]??[0,0];o[m].edits+=y,o[m].words+=v,o.edits+=y,o.words+=v}f.push(o)}return f},flush:A,async close(){clearTimeout(t),t=null,await A()}}}export{V as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
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{e as D,f as x}from"./chunk-
|
|
2
|
+
import{e as D,f as x}from"./chunk-67N2QJYT.mjs";import{a as d,b as u,c as w,d as y}from"./chunk-ZWWC4KLF.mjs";import{b as c,d as f,e as m,g as p,h as g,i as a,j as h}from"./chunk-ZQS6H473.mjs";import{k as l}from"./chunk-6N3PX4XX.mjs";import{a as s}from"./chunk-UMHUSOPJ.mjs";import S from"node:path";import{FILE as j}from"../browser/shared/annotations.mjs";import{editStateDirectory as L,reportsDirectory as i}from"../browser/shared/paths.mjs";import{documentDirectory as $,documentFiles as k}from"../browser/shared/workspace.mjs";function O({say:e=!0}={}){return o=>{let{text:t,changes:n}=c(o.html,{finish:l});if(e&&n.length&&console.log(p(o.htmlPath,n,{pending:!0}).join(`
|
|
3
3
|
`)),e){let r=f(o.html);r.length&&console.log(D(o.htmlPath,r,r.length,{pending:!0}).join(`
|
|
4
4
|
`));for(let N of x(o.htmlPath,m(s(o.html),o.metadata),{pending:!0}))console.log(N)}return t}}function b(e){for(let o of e){for(let t of g(o.html))console.log(`note ${o.slug}: ${t} (read-only in the preview)`);for(let t of a(o.html))console.log(`note ${o.slug}: ${t}`);for(let t of h(o.html))console.log(`note ${o.slug}: ${t}`)}}async function q(e){for(let o of e){let t=await w({stateDirectory:L,reportsDirectory:i,slug:o});for(let n of y(k($(o,i)).html,t))console.log(n)}}async function z(e){for(let o of e){let t=await d({stateDirectory:L,reportsDirectory:i,slug:o});for(let n of u(S.join($(o,i),j),t))console.log(n)}}export{O as a,b,q as c,z as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{b as n,f as i}from"./chunk-
|
|
2
|
+
import{b as n,f as i}from"./chunk-4OZWXZE5.mjs";import"./chunk-5L7RYZCL.mjs";import{reportsDirectory as r}from"../browser/shared/paths.mjs";import{answerOf as a,readAnnouncement as d,stopServer as l}from"../browser/shared/preview-server.mjs";async function m(p){let{positional:s}=i({argv:p});if(s.length>0)throw new n(`gallery stop takes no arguments: ${s[0]}`);let o=await d({reportsDirectory:r}),t=o?await a(o,r,1e4):"no";if(t==="no")return void console.log(`No Gallery server runs for ${r}.`);t==="busy"&&(console.error(`The Gallery server on port ${o.port} (pid ${o.pid}) took the request and gave no answer in 10s: it is busy or stuck. Run gallery stop again in a while, or end process ${o.pid} yourself.`),process.exit(1)),o.kind==="dev"&&(console.error(`This workspace's server is npm run dev's (port ${o.port}, pid ${o.pid}): stop it where it runs.`),process.exit(1));let e=await l(o);e.ok||(console.error(e.message),process.exit(1)),console.log(`Stopped the server on port ${o.port} (pid ${o.pid})${e.killed?": it did not stop by itself in 10s, so its process was ended":""}.`)}export{m as run};
|
|
@@ -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{g as v,h as X}from"./chunk-AR5D57ZD.mjs";import{a as C,b as B,d as z,g as W,i as J,j as K}from"./chunk-5XA2ZBAE.mjs";import{a as w}from"./chunk-JEUK3ZO7.mjs";import{f as G}from"./chunk-QE5RG76S.mjs";import{h as F,i as H}from"./chunk-UYVCQK3H.mjs";import{a as R,e as P,f as Y}from"./chunk-J5PUIV3Y.mjs";import{a as U,b as d,f as q}from"./chunk-4OZWXZE5.mjs";import{f as L}from"./chunk-HDWTZ763.mjs";import{editStateDirectory as re,reportsDirectory as Z}from"../browser/shared/paths.mjs";import{FIRST_BOARD as le,HOME as D,createPage as ce,listPages as de,pageExists as ee,pageFiles as O,pageSlugRefused as te,pagesSettings as he,readPageMeta as ge}from"../browser/shared/pages.mjs";import{findPreviewServer as se}from"../browser/shared/preview-server.mjs";var M=(e,t)=>`${W(e)}#@${t}`,pe=(e,t)=>`http://127.0.0.1:${e}/pages/${t}`,fe="The default home page (\u9996\u9875, slug home) is not made yet: Gallery makes it, with its own cards, when its server first starts in this workspace. gallery open --no-browser starts it: run that once, then gallery page list again.";async function oe(e){return H()||ee(D,e)||he(e).homeMade||await te(D,e)?null:fe}async function ne(e,t){return(e===D?await oe(t):null)??`No custom page "${e}": ${w(O(e,t).html)} does not exist (gallery page list lists those there are).`}async function ae(e){return(await se({reportsDirectory:e,answering:!0,timeout:2e3}))?.port??null}async function we(e,[t,o,...i]){if(!t||!o?.trim()||i.length)throw new d("Name the slug and the title, the title quoted when it has spaces.");let n=await te(t,e);n&&(console.error(n),process.exit(1));let s=await ce(t,o,{root:e});console.log(`Created ${w(s.html)} and page.json`),console.log(`It is listed in the workbench's sidebar, last among the rows under \u65B0\u5EFA and \u641C\u7D22 (the user may drag it elsewhere), and shows one empty board (data-board-id="main"): use it, or write the page as you like.`);let a=await ae(e),r=`write page.html: a board of cards (each <section class="gallery-card" data-card-id="\u2026" data-x data-y data-w data-h> around one custom block's instance; gallery page add places one), or any HTML, CSS and script of your own (references/pages-and-data.md)`,c="at the end tell them where it is in the sidebar (under \u65B0\u5EFA and \u641C\u7D22, its title)";a?(console.log(`Next: send the user the address on the last line now, in a message of its own (the page is theirs to watch as its cards arrive); ${r}; ${c}.`),console.log(`${C}${M(a,t)}`)):console.log(`Next: run gallery page open ${t} --no-browser now (it starts the server) and send the user the address on its \u4EA4\u7ED9\u7528\u6237 line, in a message of its own, before you write any card (the page is theirs to watch as its cards arrive); then ${r}; ${c}.`)}async function me(e,t){if(t.length)throw new d("gallery page list takes nothing else.");let o=await de(e);console.log(`\u5DE5\u4F5C\u533A\uFF1A${w(e)}`);let i=await oe(e);o.length===0&&!i?console.log('No custom pages yet: gallery page new <slug> "<\u6807\u9898>" makes one.'):o.length>0&&console.log(`Custom pages, in the sidebar's order (${o.length}):`);let n=o.length?await ae(e):null;for(let{slug:s,title:a,icon:r}of o)console.log(`- ${s} ${r?`${r} `:""}${a}`),console.log(` \u5730\u5740\uFF1A${n?M(n,s):`/#@${s}`} ${w(O(s,e).html)}`);i&&console.log(i)}async function ue(e,[t,...o],i){if(!t||o.length)throw new d("gallery page open takes one page's slug.");await ge(t,e)||(console.error(await ne(t,e)),process.exit(1)),console.log(`\u5DE5\u4F5C\u533A\uFF1A${w(e)}`);let s=await J({command:`gallery page open ${t}`});s.ok||(console.error(s.message),process.exit(1));let a=[K(s),`${B}${pe(s.port,t)}`,`${C}${M(s.port,t)}`];for(let r of a)console.log(r);console.log(await z(a,i))}async function Q(e,t,o){let i=`127.0.0.1:${e.port}`;try{let n=await fetch(`http://${i}/__gallery/pages/${t}/cards`,{method:"POST",headers:{"Content-Type":"application/json",Origin:`http://${i}`,"X-Gallery-Token":e.token},body:JSON.stringify({...o,workspace:Z}),signal:AbortSignal.timeout(3e4)}),s=await n.json().catch(()=>null);return!s||["elsewhere","token","host","origin","unknown","method"].includes(s.reason)?null:[n.status,s]}catch{return null}}var $e=8e3,b={places:e=>`${e} is a block of documents (its manifest's places has no "page"): it does not go on a custom page.`,disabled:e=>`${e} is turned off (\u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 \u505C\u7528): nothing of it loads, on a page or in a document.`,missing:e=>`No custom block ${e} in this workspace: gallery block list lists them.`,template:e=>`${e} has no template.html a new card can be made of (gallery block check ${e} says why).`,board:(e,t)=>`No board "${t}" on this page: its <div class="gallery-board" data-board-id="\u2026">s are the ones there are.`,cells:()=>"--x, --y, --w and --h are whole numbers (x and y from 0, w and h from 1).",busy:()=>"page.html was written again and again meanwhile: run this again.",size:()=>"page.html would grow past 1,000,000 bytes.",values:(e,t,o)=>`${e}'s setting ${o?`"${o}" `:""}does not take that value (a text of 10,000 characters at most, a number, a date, one of a select's options, a switch's true or false).`,settings:e=>`${e} has no settings, or a card of it no settings part: --set goes with a block whose manifest has some.`};function ye(e){let t=e.indexOf("--"),o=[],i=[];for(let n=0;n<e.length;n++){let s=e[n];if(t!==-1&&n>=t)i.push(s);else if(s==="--set"||s.startsWith("--set=")){let a=s==="--set"?e[n+1]:s.slice(6);s==="--set"&&(n+=1);let r=a?.indexOf("=")??-1;if(a===void 0||r<1)throw new d("--set takes a setting's key and its value: --set <key>=<value> (--set city=\u4E0A\u6D77).");o.push([a.slice(0,r),a.slice(r+1)])}else i.push(s)}return{argv:i,given:o}}var V=new Map([["true",!0],["yes",!0],["on",!0],["1",!0],["false",!1],["no",!1],["off",!1],["0",!1]]);function be(e,t){let o=t.settings??[],i=()=>o.length?`its settings are ${o.map(({key:s,label:a})=>`${s} (${a?.en??a?.zh??s})`).join(", ")}`:"it has no settings",n={};for(let[s,a]of e){let r=o.find(c=>c.key===s);if(!r)throw new d(`${t.id} has no setting "${s}": ${i()}.`);if(Object.hasOwn(n,s))throw new d(`--set ${s} is given twice.`);if(r.type==="number"){if(a.trim()!==""&&!Number.isFinite(Number(a)))throw new d(`The setting ${s} of ${t.id} is a number: --set ${s}=<number>, or --set ${s}= for none.`);n[s]=a.trim()===""?null:Number(a)}else if(r.type==="switch"){if(!V.has(a.trim().toLowerCase()))throw new d(`The setting ${s} of ${t.id} is a switch: --set ${s}=true or --set ${s}=false.`);n[s]=V.get(a.trim().toLowerCase())}else if(r.type==="select"){if(!r.options.includes(a))throw new d(`The setting ${s} of ${t.id} is one of ${r.options.join(", ")}: --set ${s}=<one of them>.`);n[s]=a}else if(r.type==="date"){if(a!==""&&!/^\d{4}-\d{2}-\d{2}$/.test(a))throw new d(`The setting ${s} of ${t.id} is a date, written YYYY-MM-DD: --set ${s}=2027-02-06.`);n[s]=a}else n[s]=a}return n}function ke(e,t){let o=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return(e.settings??[]).filter(i=>i.required&&i.type!=="switch").filter(({key:i,default:n})=>{let s=Object.hasOwn(o,i)?o[i]:n;return s==null||typeof s=="string"&&s.trim()===""}).map(({key:i,label:n})=>({key:i,label:n?.en??n?.zh??i,zh:n?.zh??null}))}async function xe(e,[t,o,...i],n,s,a,r=[]){if(!t||!o||i.length)throw new d("gallery page add takes a page's slug and a block's id (gallery block list lists them).");let c={};for(let l of["x","y","w","h"]){let g=s.get(`--${l}`);if(g!==void 0){if(!/^\d+$/.test(g)||(l==="w"||l==="h")&&Number(g)<1)throw new d(b.cells());c[l]=Number(g)}}if(c.x===void 0!=(c.y===void 0))throw new d("--x and --y go together: a place is both.");ee(t,e)||(console.error(await ne(t,e)),process.exit(1));let k=o.includes("/")?null:P(o),h=o.includes("/")?o:k?k.id:o,m=L(e),u=m.packages.get(h);if(!u){let l=Y(h)?P(h):null;m.settings.disabled.includes(h)?console.error(b.disabled(h)):console.error(l?`${h} is one of Gallery's own blocks, not yet in this workspace: gallery block add ${l.pack===R?l.name:l.id} puts it in; then run this again.`:m.problems.has(h)?`${h} does not load (gallery block check ${h} says why).`:b.missing(h)),process.exit(1)}u.places.includes("page")||(console.error(b.places(h)),process.exit(1));let p=s.get("--board"),y=r.length?be(r,u):null,N={op:"add",block:h,...p?{board:p}:{},...c,...y?{settings:y}:{},agent:!0},j=await se({reportsDirectory:e}),x=j?await Q(j,t,N):null;for(let l=0;x?.[1]?.reason==="missing"&&l<$e/250;l++)await new Promise(g=>setTimeout(g,250)),x=await Q(j,t,N);let[ie,f]=x??await F({root:e,stateDirectory:re,catalog:()=>m}).apply(t,N);if(!f?.ok){let l=f?.reason;console.error(b[l]?.(h,p??le,f?.message)??`Not added (${ie}: ${l??"no answer"}${f?.message?`: ${f.message}`:""}).`),process.exit(1)}let $=f.cards.find(l=>l.id===f.card),I=(f.pushed??[]).map(l=>f.cards.find(g=>g.id===l)).filter(Boolean);console.log(`Added a card of ${h} to ${w(O(t,e).html)}${x?" (through the workspace's running server: an open page shows it at once)":""}:`),console.log(` data-card-id="${$.id}" on board ${$.board}: x ${$.x}, y ${$.y}, w ${$.w}, h ${$.h}${f.measure?" (its block gives no height: 2 cells, --h sets another)":""}`),I.length&&console.log(` Pushed down under it, as it met them: ${I.map(l=>`${l.id} (y ${l.y})`).join(", ")}; no card moved up.`),y&&console.log(` Settings written with it: ${Object.entries(y).map(([l,g])=>`${l}=${JSON.stringify(g)}`).join(", ")}`),console.log(y?"The rest of its data is as the block's template writes it, in the card's instance: write it there if it is to hold something else, leaving every other card as it is.":"Its data is as the block's template writes it, in the card's instance: write it there if it is to hold something else, leaving every other card as it is.");let S=ke(u,{...y??{}});if(S.length){let l=S.map(({key:g,label:T,zh:E})=>`${g} (${E&&E!==T?`${T}, ${E}`:T})`).join(", ");console.log(`${h} needs its setting ${l} before the card shows anything, and this card has none: ask the user for it, or take it from what the workspace says (\u5199\u4F5C\u504F\u597D, the documents) and tell them in the handoff which you did. Give it with the add (${S.map(({key:g})=>`--set ${g}=<value>`).join(" ")}); for this card, write it in its settings part of ${w(O(t,e).html)} (the <script type="application/json"> of data-card-id="${$.id}": {"${S[0].key}":"\u2026"}), re-reading the page right before, or the user fills it in on the card (the grip at its top right \u203A \u8BBE\u7F6E\u2026).`)}}var _={new:we,list:me,open:ue,add:xe,try:async(e,t,o,i,n)=>(await import("./chunk-J43Z6LSS.mjs")).pageTryCommand(e,{named:t,values:i,seconds:n,keep:o.has("--keep"),replace:o.has("--replace")}),check:async(e,t)=>(await import("./chunk-YLPSMDIS.mjs")).pageCheckCommand(e,t)},A=["--board","--x","--y","--w","--h"];async function Ie(e){try{return await Se(e)}catch(t){throw t instanceof d&&e.find(o=>!U(o))==="try"&&(t.synopsis=G),t}}async function Se(e){let{argv:t,seconds:o}=X(e),{argv:i,given:n}=ye(t),{positional:s,options:a,values:r}=q({options:["--no-browser","--keep","--replace"],values:[...A,...v],argv:i}),[c,...k]=s,h=Object.keys(_).join(", ");if(!c)throw new d(`Say what to do: ${h}.`);if(!Object.hasOwn(_,c))throw new d(`No such page command: ${c} (${h}).`);if(a.has("--no-browser")&&c!=="open")throw new d(`--no-browser goes with open, not ${c}.`);let m=[...v.filter(p=>r.has(p)),...Object.keys(o).filter(p=>!r.has(p)),...a.has("--keep")?["--keep"]:[],...a.has("--replace")?["--replace"]:[]];if(m.length&&c!=="try")throw new d(`${m[0]} goes with try, not ${c}.`);let u=A.filter(p=>r.has(p));if(u.length&&c!=="add")throw new d(`${u.join(", ")} go with add, not ${c}.`);if(n.length&&c!=="add")throw new d(`--set goes with add, not ${c}.`);return _[c](Z,k,a,new Map([...r].filter(([p])=>c==="try"?v.includes(p):A.includes(p))),o,n)}export{M as a,pe as b,fe as c,ne as d,ye as e,be as f,ke as g,Ie as h};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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{
|
|
3
|
-
`);throw ie.includes("Failed to create a ProcessSingleton for your profile directory")||process.platform==="win32"&&$(ke(m.userDataDir,"lockfile"))?er(m.userDataDir)?new Error(`The browser is already running for ${m.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`):new Error(`The browser cannot write to ${m.userDataDir}. Make the \`userDataDir\` writable or use a different one.`):ie.includes("Missing X server")&&e.headless===!1?new Error("Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script."):F instanceof Te?new we(F.message):F}return Array.isArray(t)&&await Promise.all([t.map(F=>S.installExtension(F,{enabledInIncognito:s.includes(F)}))]),y&&await this.waitForPageTarget(S,E),S}async closeBrowser(e,r){if(r)try{await r.closeBrowser(),await e.hasClosed()}catch(t){this.#r?.(g.error)?.(t),await e.close()}else await ae(le(k(e.hasClosed()),ce(5e3).pipe(W(()=>k(e.close())))))}async waitForPageTarget(e,r){try{await e.waitForTarget(t=>t.type()==="page",{timeout:r})}catch(t){throw await e.close(),t}}async createCdpSocketConnection(e,r){let t=await e.waitForLineOutput(Se,r.timeout),s=await Z.create(t,void 0,r.logger,r.wsOptions);return new Q(t,s,r.slowMo,r.protocolTimeout,!1,r.idGenerator,r.logger)}async createCdpPipeConnection(e,r){let{3:t,4:s}=e.nodeProcess.stdio,c=new V(t,s,r.logger);return new Q("",c,r.slowMo,r.protocolTimeout,!1,r.idGenerator,r.logger)}async createBiDiOverCdpBrowser(e,r,t,s){let c=process.env.PUPPETEER_WEBDRIVER_BIDI_ONLY==="true",o=await import("./chunk-
|
|
2
|
+
import{$ as zr,$a as $t,$b as ks,A as K,Aa as wt,Ab as ls,Ac as li,B as _,Ba as gt,Bb as fs,Bc as fi,Ca as bt,Cb as ps,Cc as pi,Da as Et,Db as ds,Dc as di,E as _r,Ea as xt,Eb as hs,Ec as hi,F as we,Fa as yt,Fb as ms,Fc as mi,G as Br,Ga as Dt,Gb as ws,Gc as wi,H as Sr,Ha as Pt,Hb as gs,Hc as gi,I as Fr,Ia as vt,Ib as bs,Ic as bi,J as Tr,Ja as Ot,Jb as Es,Jc as Ei,K as Ir,Ka as _t,Kb as xs,Kc as xi,L as Rr,Lb as Q,Lc as yi,M as ge,Mb as ys,Mc as Di,N as Cr,Nb as Ds,Nc as Pi,O as Ar,Oa as J,Ob as Ps,Oc as vi,P as Lr,Pb as vs,Pc as Oi,Q as kr,Qa as Bt,Qb as Os,Qc as _i,R as Wr,Ra as St,Rb as _s,Rc as Bi,S as $r,Sa as Ft,Sb as Bs,Sc as ye,T as Ur,Ta as Tt,Tb as Ss,Tc as Si,U as Nr,Ua as It,Ub as Fs,Uc as Fi,V as Mr,Va as Rt,Vb as Ts,Vc as Ti,W as Gr,Wa as Ct,Wb as Is,Wc as Ri,X as Vr,Xa as At,Xb as Rs,Xc as Ae,Y as jr,Ya as Lt,Yb as Cs,Yc as Le,Z as Xr,Za as kt,Zb as As,Zc as Ci,_ as Hr,_a as Wt,_b as Ls,_c as q,a as k,aa as Yr,ab as Ut,ac as Ws,ba as Kr,bb as Nt,bc as $s,c as oe,ca as Jr,cb as Mt,cc as Us,d as ae,da as Qr,db as Gt,dc as Ns,e as W,ea as be,eb as Vt,ec as Ms,fa as Zr,fb as jt,fc as Gs,ga as qr,gb as Xt,gc as Vs,h as ne,ha as et,hb as Ht,hc as js,i as ce,ia as rt,ib as zt,ic as Xs,j as ue,ja as tt,jb as Yt,jc as Hs,k as le,ka as st,kb as Kt,kc as zs,l as fe,la as it,lb as xe,lc as Ys,m as pe,ma as Ee,mb as Jt,mc as Ks,na as ot,nb as Qt,nc as Js,oa as at,ob as Zt,oc as Qs,pa as nt,pb as qt,pc as Zs,qa as ct,qb as es,qc as qs,r as de,ra as ut,rb as rs,rc as ei,s as he,sa as lt,sb as ts,sc as ri,t as yr,ta as ft,tb as ss,tc as ti,u as Y,ua as pt,ub as is,uc as si,v as Dr,vb as os,vc as ii,w as me,wb as as,wc as oi,x as Pr,xa as dt,xb as ns,xc as ai,y as vr,ya as ht,yb as cs,yc as ci,z as Or,za as mt,zb as us,zc as ui}from"./chunk-SQ6Y2ZMA.mjs";import{a as Ii}from"./chunk-Y34NR5JL.mjs";import{b as Z}from"./chunk-U3SSPL4K.mjs";import"./chunk-YEY3RSFQ.mjs";import{b as P,c as g,d as I}from"./chunk-W7XHE4CT.mjs";import{a as Ce}from"./chunk-MAFIGVXY.mjs";import{a as x,e as De,f as Pe,i as ve,l as Oe,m as _e,n as Be,o as Se,p as Fe,r as Te,u as Ie,v as Re}from"./chunk-742D2WWJ.mjs";import{a as ni}from"./chunk-UH4SIXTR.mjs";import"./chunk-5L7RYZCL.mjs";import p from"node:fs";import je from"node:path";import{debuglog as Xe}from"node:util";var He=p.constants.O_RDONLY|p.constants.O_NOFOLLOW,ee=p.constants.O_WRONLY|p.constants.O_CREAT|p.constants.O_TRUNC|p.constants.O_NOFOLLOW,ze=p.constants.O_WRONLY|p.constants.O_CREAT|p.constants.O_EXCL|p.constants.O_NOFOLLOW,Ye=p.constants.O_WRONLY|p.constants.O_CREAT|p.constants.O_EXCL,G=384;async function Ke(a,e){return!P.value.followSymlinks&&p.constants.O_NOFOLLOW!==void 0?await p.promises.readFile(a,{encoding:e,flag:He}):await p.promises.readFile(a,{encoding:e})}P.value={path:je,debuglog:P.value.debuglog??Xe,ScreenRecorder:P.value.ScreenRecorder,followSymlinks:!0,readFile:Ke,writeFile:async(a,e)=>{!P.value.followSymlinks&&p.constants.O_NOFOLLOW!==void 0?await p.promises.writeFile(a,e,{flag:ee,mode:G}):await p.promises.writeFile(a,e)},openFileForWriting:async a=>!P.value.followSymlinks&&p.constants.O_NOFOLLOW!==void 0?await p.promises.open(a,ee,G):await p.promises.open(a,"w+"),createWriteStream:(a,e)=>{let r=e?.encoding,t=e?.overwrite??!0;if(!P.value.followSymlinks&&p.constants.O_NOFOLLOW!==void 0){let s=t?ee:ze,c=p.openSync(a,s,G);return p.createWriteStream("",{fd:c,mode:G,encoding:r})}if(!t){let s=p.openSync(a,Ye);return p.createWriteStream("",{fd:s,encoding:r})}return p.createWriteStream(a,r?{encoding:r}:void 0)},mkdir:async(a,e)=>{await p.promises.mkdir(a,e)}};import{mkdtemp as or}from"node:fs/promises";import ar from"node:os";import te from"node:path";import{accessSync as Je,constants as Qe,existsSync as $,rmSync as Ze}from"node:fs";import{tmpdir as qe}from"node:os";import{join as ke}from"node:path";var V=class{#e;#r=new me;#t;#i=!1;#s=[];onclose;onmessage;constructor(e,r,t){this.#e=e,this.#t=t;let s=this.#r.use(new K(r,t));s.on("data",o=>this.#o(o)),s.on("close",()=>{this.onclose&&this.onclose.call(null)}),s.on("error",o=>{this.#t?.(g.error)?.(o)}),this.#r.use(new K(e)).on("error",o=>{this.#t?.(g.error)?.(o)})}send(e){_(!this.#i,"`PipeTransport` is closed."),this.#e.write(e),this.#e.write("\0")}#o(e){if(_(!this.#i,"`PipeTransport` is closed."),this.#s.push(e),e.indexOf("\0")===-1)return;let r=Buffer.concat(this.#s),t=0,s=r.indexOf("\0");for(;s!==-1;){let c=r.toString(void 0,t,s);setImmediate(()=>{this.onmessage&&this.onmessage.call(null,c)}),t=s+1,s=r.indexOf("\0",t)}t>=r.length?this.#s=[]:this.#s=[r.subarray(t)]}close(){this.#i=!0,this.#r.dispose()}};function er(a){try{return Je(a,Qe.W_OK),!0}catch{return!$(a)}}function rr(a){switch(a){case x.FIREFOX:case x.CHROME:return a.charAt(0).toUpperCase()+a.slice(1);default:return a}}var R=class{#e;#r;puppeteer;constructor(e,r,t){this.puppeteer=e,this.#e=r,this.#r=t}get logger(){return this.#r}get browser(){return this.#e}async launch(e={}){e.logger??=this.#r;let{dumpio:r=!1,enableExtensions:t=!1,extensionsEnabledInIncognito:s=[],env:c=process.env,handleSIGINT:o=!0,handleSIGTERM:n=!0,handleSIGHUP:i=!0,acceptInsecureCerts:u=!1,networkEnabled:d=!0,issuesEnabled:f=!0,defaultViewport:h=ge,downloadBehavior:l,slowMo:b=0,timeout:E=3e4,waitForInitialPage:y=!0,protocolTimeout:D,handleDevToolsAsPage:U,idGenerator:C=xe(),blocklist:A,allowlist:B}=e,{protocol:v}=e;if(this.#e==="firefox"&&v===void 0&&(v="webDriverBiDi"),Ae({allowlist:B,blocklist:A,protocol:v}),this.#e==="firefox"&&v==="cdp")throw new Error("Connecting to Firefox using CDP is no longer supported");let m=await this.computeLaunchArguments({...e,protocol:v});if(!$(m.executablePath))throw m.isTempUserDataDir&&await this.cleanUserDataDir(m.userDataDir,{isTemp:!0}),new Error(`Browser was not found at the configured executablePath (${m.executablePath})`);let T=m.args.includes("--remote-debugging-pipe"),N=async()=>{try{await this.cleanUserDataDir(m.userDataDir,{isTemp:m.isTempUserDataDir})}finally{w?.()}};if(this.#e==="firefox"&&v==="webDriverBiDi"&&T)throw new Error("Pipe connections are not supported with Firefox and WebDriver BiDi");let w,O;try{O=Be({executablePath:m.executablePath,args:m.args,handleSIGHUP:i,handleSIGTERM:n,handleSIGINT:o,dumpio:r,env:c,pipe:T,onExit:N,signal:e.signal,logger:e.logger}),w=m.isTempUserDataDir?tr(m.userDataDir,this.#r):void 0}catch(F){throw w?.(),await this.cleanUserDataDir(m.userDataDir,{isTemp:m.isTempUserDataDir}),F}let S,L,se=!1,M=async()=>{se||(se=!0,await this.closeBrowser(O,L))};try{this.#e==="firefox"?S=await this.createBiDiBrowser(O,M,{timeout:E,protocolTimeout:D,slowMo:b,defaultViewport:h,acceptInsecureCerts:u,networkEnabled:d,idGenerator:C,logger:e.logger}):(T?L=await this.createCdpPipeConnection(O,{timeout:E,protocolTimeout:D,slowMo:b,idGenerator:C,logger:e.logger}):L=await this.createCdpSocketConnection(O,{timeout:E,protocolTimeout:D,slowMo:b,idGenerator:C,logger:e.logger}),v==="webDriverBiDi"?S=await this.createBiDiOverCdpBrowser(O,L,M,{defaultViewport:h,acceptInsecureCerts:u,networkEnabled:d,issuesEnabled:f,logger:e.logger}):S=await ye._create(L,[],u,h,l,O.nodeProcess,M,e.targetFilter,void 0,void 0,d,f,U,A,B,e.logger))}catch(F){M();let ie=O.getRecentLogs().join(`
|
|
3
|
+
`);throw ie.includes("Failed to create a ProcessSingleton for your profile directory")||process.platform==="win32"&&$(ke(m.userDataDir,"lockfile"))?er(m.userDataDir)?new Error(`The browser is already running for ${m.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`):new Error(`The browser cannot write to ${m.userDataDir}. Make the \`userDataDir\` writable or use a different one.`):ie.includes("Missing X server")&&e.headless===!1?new Error("Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script."):F instanceof Te?new we(F.message):F}return Array.isArray(t)&&await Promise.all([t.map(F=>S.installExtension(F,{enabledInIncognito:s.includes(F)}))]),y&&await this.waitForPageTarget(S,E),S}async closeBrowser(e,r){if(r)try{await r.closeBrowser(),await e.hasClosed()}catch(t){this.#r?.(g.error)?.(t),await e.close()}else await ae(le(k(e.hasClosed()),ce(5e3).pipe(W(()=>k(e.close())))))}async waitForPageTarget(e,r){try{await e.waitForTarget(t=>t.type()==="page",{timeout:r})}catch(t){throw await e.close(),t}}async createCdpSocketConnection(e,r){let t=await e.waitForLineOutput(Se,r.timeout),s=await Z.create(t,void 0,r.logger,r.wsOptions);return new Q(t,s,r.slowMo,r.protocolTimeout,!1,r.idGenerator,r.logger)}async createCdpPipeConnection(e,r){let{3:t,4:s}=e.nodeProcess.stdio,c=new V(t,s,r.logger);return new Q("",c,r.slowMo,r.protocolTimeout,!1,r.idGenerator,r.logger)}async createBiDiOverCdpBrowser(e,r,t,s){let c=process.env.PUPPETEER_WEBDRIVER_BIDI_ONLY==="true",o=await import("./chunk-6QBHU4DF.mjs"),n=await o.connectBidiOverCdp(r,s.logger);return await o.BidiBrowser.create({connection:n,cdpConnection:c?void 0:r,closeCallback:t,process:e.nodeProcess,defaultViewport:s.defaultViewport,acceptInsecureCerts:s.acceptInsecureCerts,networkEnabled:s.networkEnabled,issuesEnabled:s.issuesEnabled,logger:s.logger})}async createBiDiBrowser(e,r,t){let s=await e.waitForLineOutput(Fe,t.timeout)+"/session",c=await Z.create(s,void 0,t.logger,t.wsOptions),o=await import("./chunk-6QBHU4DF.mjs"),n=new o.BidiConnection(s,c,t.idGenerator,t.slowMo,t.protocolTimeout,t.logger);return await o.BidiBrowser.create({connection:n,closeCallback:r,process:e.nodeProcess,defaultViewport:t.defaultViewport,acceptInsecureCerts:t.acceptInsecureCerts,networkEnabled:t.networkEnabled??!0,issuesEnabled:t.issuesEnabled??!0,logger:t.logger})}async getProfilePath(){let e=await this.puppeteer.configuration();return ke(e.temporaryDirectory??qe(),`puppeteer_dev_${this.browser}_profile-`)}async resolveExecutablePath(e,r=!0){let t=await this.puppeteer.configuration(),s=t.executablePath;if(s){if(r&&!$(s))throw new Error(`Tried to find the browser at the configured path (${s}), but no executable was found.`);return s}function c(u,d){switch(u){case"chrome":return d==="shell"?x.CHROMEHEADLESSSHELL:x.CHROME;case"firefox":return x.FIREFOX}return x.CHROME}let o=c(this.browser,e),n=await this.puppeteer.defaultDownloadPath(),i=await this.puppeteer.browserVersion();if(s=Oe({cacheDir:n,browser:o,buildId:i}),r&&!$(s)){let u=t?.[this.browser]?.version;throw u?new Error(`Tried to find the browser at the configured path (${s}) for version ${u}, but no executable was found.`):new Error(`Could not find ${rr(o)} (ver. ${i}). This can occur if either
|
|
4
4
|
1. you did not perform an installation before running the script (e.g. \`npx puppeteer browsers install ${o}\`) or
|
|
5
5
|
2. your cache path is incorrectly configured (which is: ${t.cacheDirectory}).
|
|
6
6
|
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.`)}return s}},re=new WeakMap;function tr(a,e,r=process){let t=re.get(r);if(!t){let c=new Set,o=()=>{for(let n of c)try{Ze(n.userDataDir,{recursive:!0,force:!0,maxRetries:3,retryDelay:100})}catch(i){n.logger(g.error)?.(i)}};t={entries:c,onExit:o},re.set(r,t),r.once("exit",o)}let s={userDataDir:a,logger:e};return t.entries.add(s),()=>{!t?.entries.delete(s)||t.entries.size>0||(r.off("exit",t.onExit),re.delete(r))}}import sr from"node:fs";var ir={force:!0,recursive:!0,maxRetries:10,retryDelay:100};async function j(a){await sr.promises.rm(a,ir)}var X=class extends R{constructor(e,r){super(e,"chrome",r)}async launch(e={}){return(await this.puppeteer.configuration()).logLevel==="warn"&&process.platform==="darwin"&&process.arch==="x64"&&ar.cpus()[0]?.model.includes("Apple")&&console.warn(["\x1B[1m\x1B[43m\x1B[30m","Degraded performance warning:\x1B[0m\x1B[33m","Launching Chrome on Mac Silicon (arm64) from an x64 Node installation results in","Rosetta translating the Chrome binary, even if Chrome is already arm64. This would","result in huge performance issues. To resolve this, you must run Puppeteer with","a version of Node built for arm64."].join(`
|
|
@@ -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 x,b as w,e as _}from"./chunk-Q4UEPUWF.mjs";import{spawn as P}from"node:child_process";import{existsSync as T,mkdirSync as F,readFileSync as g,renameSync as I,rmSync as A,writeFileSync as C}from"node:fs";import m from"node:fs/promises";import j from"node:os";import p from"node:path";import{fileURLToPath as k}from"node:url";import{userDirectory as b}from"../browser/shared/user-directory.mjs";import{compareVersions as O,RELEASED as S}from"../browser/shared/versions.mjs";var d="@heycys/gallery",D="\u6280\u80FD\uFF1A",G="\u65B0\u7248\u672C\uFF1A",Y="update-check.json",U=1440*60*1e3,H=3600*1e3,v=5e3,X="https://registry.npmjs.org/",K=d.split("/")[0],L="\uFF08\u4E4B\u540E\u65B0\u5F00\u7684 Agent \u4F1A\u8BDD\u624D\u8BFB\u5230\u65B0\u6280\u80FD\uFF09",h=t=>!["","0","false",void 0].includes(t),W=(t=process.env)=>h(t.GALLERY_NO_UPDATE_CHECK)||h(t.CI)||h(t.NO_UPDATE_NOTIFIER),J=(t=k(import.meta.url))=>/[\\/]_npx[\\/]/.test(t),V=(t={})=>b("cache",t);function M(t,e=process.env){let o=i=>i.replace(/(?<!\\)\$\{([^${}?]+)(\?)?\}/g,(c,l,s)=>e[l]??(s?"":c)),n={},r=!1;for(let i of t.replace(/^\uFEFF/,"").split(/\r?\n/)){let c=i.trim();if(!c||/^[;#]/.test(c))continue;if(/^\[.*\]$/.test(c)){r=!0;continue}let l=c.indexOf("=");if(r||l<1)continue;let s=c.slice(l+1).trim();/^(".*"|'.*')$/.test(s)?s=s.slice(1,-1):s=s.split(/(?<!\\)[;#]/)[0].replace(/\\([;#])/g,"$1").trim(),n[o(c.slice(0,l).trim())]=o(s)}return n}function $({env:t=process.env,home:e=t.HOME||j.homedir(),platform:o=process.platform,execPath:n=process.execPath}={}){let r={};for(let[a,f]of Object.entries(t)){if(!/^npm_config_/i.test(a)||!f)continue;let y=a.slice(11);r[y.startsWith("//")?y:y.replace(/(?!^)_/g,"-").toLowerCase()]=f}let i=a=>{try{return M(g(a,"utf8"),t)}catch{return{}}},c=a=>p.resolve(/^~[\\/]/.test(a)?p.join(e,a.slice(2)):a),l=o==="win32"?p.dirname(n):p.dirname(p.dirname(n)),s=[],u=[()=>r,()=>i(c(r.userconfig||p.join(e,".npmrc"))),()=>{let a=s[3]??=u[3](),f=r.prefix||s[1].prefix||a.prefix||t.PREFIX||l;return i(c(r.globalconfig||p.join(c(f),"etc","npmrc")))},()=>i(o==="win32"?p.join(l,"node_modules","npm","npmrc"):p.join(l,"lib","node_modules","npm","npmrc"))];return a=>{for(let f=0;f<u.length;f++)if(s[f]??=u[f](),s[f][a])return s[f][a]}}function q(t=process.env,e=$({env:t})){let o=t.GALLERY_REGISTRY||e(`${K}:registry`)||e("registry")||X;return o.endsWith("/")?o:`${o}/`}function z(t=process.env,e=$({env:t})){let o={...t,NODE_USE_ENV_PROXY:"1"},n=(c,l)=>{for(let s of Object.keys(o))c.test(s)&&delete o[s];Object.assign(o,l)},r=e("https-proxy")||e("proxy");r&&n(/^https?_proxy$/i,{HTTPS_PROXY:r,HTTP_PROXY:r});let i=e("noproxy");return i&&n(/^no_proxy$/i,{NO_PROXY:i}),o}var B=t=>`${t}${d.replace("/","%2f")}/latest`;function R(t){try{let e=JSON.parse(g(t,"utf8"));return e&&typeof e=="object"?e:null}catch{return null}}function Q(t,e,o=Date.now()){if(!t||!Number.isFinite(t.checked)||t.registry!==e)return!0;let n=o-t.checked;return n<0||n>=(t.failed?H:U)}var E=(t,e)=>t?.registry===e&&typeof t.latest=="string"&&S.test(t.latest)?t.latest:null;function Z(t,e,o,n=Date.now()){let r=`${t}.${process.pid}.tmp`;try{return F(p.dirname(t),{recursive:!0}),C(r,`${JSON.stringify({checked:n,registry:e,latest:E(o,e),failed:!0,checking:!0})}
|
|
3
|
+
`),I(r,t),!0}catch{return!1}finally{try{A(r,{force:!0})}catch{}}}async function dt(t,e,{timeout:o=v,now:n=Date.now}={}){let r=null;try{let l=await fetch(B(e),{signal:AbortSignal.timeout(o),headers:{Accept:"application/json"}});if(l.ok){let{version:s}=await l.json();typeof s=="string"&&S.test(s)&&(r=s)}}catch{}let i=r?{checked:n(),registry:e,latest:r}:{checked:n(),registry:e,latest:E(R(t),e),failed:!0};await m.mkdir(p.dirname(t),{recursive:!0});let c=`${t}.${process.pid}.tmp`;try{await m.writeFile(c,`${JSON.stringify(i)}
|
|
4
|
+
`),await m.rename(c,t)}finally{await m.rm(c,{force:!0}).catch(()=>{})}return i}function tt(t,e,{env:o=process.env}={}){try{let n=P(process.execPath,[k(new URL("./update-fetch.mjs",import.meta.url)),t,e],{cwd:j.homedir(),env:o,detached:!0,stdio:"ignore",windowsHide:!0});return n.on("error",()=>{}),n.unref(),!0}catch{return!1}}function et({env:t=process.env,cwd:e=process.cwd()}={}){let o=[...Object.values(x).map(r=>({folder:p.join(p.resolve(r.home(t)),"skills","gallery"),project:!1})),...Object.values(x).map(r=>({folder:p.join(p.resolve(e),r.project,"skills","gallery"),project:!0}))],n=r=>process.platform==="win32"?r.toLowerCase():r;return o.filter(({folder:r},i)=>o.findIndex(c=>n(c.folder)===n(r))===i)}var N=(t,e,o)=>o?`npx -y ${d}@^${e} ${t}`:`gallery ${t}`,rt=(t,e,o,n,r=!1)=>`${D}${t} \u662F${e?` Gallery ${e} `:"\u65E7\u7248 Gallery\uFF08\u6CA1\u5199\u7248\u672C\uFF09"}\u7684\uFF0C\u6BD4\u8FD9\u4E2A gallery ${o} \u65E7\uFF1B\u95EE\u8FC7\u7528\u6237\u540E\u8FD0\u884C ${N(`skill install${n?" --project":""}`,o,r)}${L}`,ot=(t,e,o=!1)=>`${G}npm \u4E0A\u6709 Gallery ${t}\uFF0C\u8FD9\u4E2A gallery \u662F ${e}\uFF1B\u95EE\u8FC7\u7528\u6237\u540E\u8FD0\u884C ${o?N("skill install",t,!0):`npm i -g ${d}@^${t}\uFF0C\u518D\u8FD0\u884C gallery skill install`}${L}`;function nt(t,{env:e=process.env,cwd:o=process.cwd(),npx:n=!1}={}){let r=[];for(let{folder:i,project:c}of et({env:e,cwd:o})){let l;try{l=g(p.join(i,"SKILL.md"),"utf8")}catch{continue}if(!["gallery","html-report-studio"].includes(w(l))||T(p.join(i,".git")))continue;let s=_(l);s&&O(s,t)>=0||r.push(rt(i,s,t,c,n))}return r}function yt(t,{env:e=process.env,cwd:o=process.cwd(),now:n=Date.now(),npx:r=J()}={}){let i=[];try{i.push(...nt(t,{env:e,cwd:o,npx:r}))}catch{}if(W(e))return i;try{let c=$({env:e}),l=q(e,c),s=p.join(V({env:e}),Y),u=R(s);Q(u,l,n)&&Z(s,l,u,n)&&tt(s,l,{env:z(e,c)});let a=E(u,l);a&&O(a,t)>0&&i.push(ot(a,t,r))}catch{}return i}export{d as a,D as b,G as c,Y as d,U as e,H as f,v as g,W as h,J as i,V as j,M as k,$ as l,q as m,z as n,B as o,R as p,Q as q,Z as r,dt as s,tt as t,et as u,rt as v,ot as w,nt as x,yt as y};
|
|
@@ -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{c as L,d as _,e as D,h as N}from"./chunk-7M2BQQGZ.mjs";import{createHash as q,randomUUID as Q}from"node:crypto";import f from"node:fs/promises";import g from"node:path";import{refusal as V,said as T,saying as X}from"../browser/shared/i18n/index.mjs";import{extensionOf as Y,imageExtension as Z,imageFile as M,mediaTypeOf as tt,UPLOAD_LIMITS as y}from"../browser/shared/media.mjs";import{slugPattern as F}from"../browser/shared/reports.mjs";import{documentDirectory as U,documentFiles as et,layoutOf as nt}from"../browser/shared/workspace.mjs";var z=i=>Y(String(i??"").replace(/[?#].*$/,"")),it=i=>{let e=String(i??"").replace(/[?#].*$/,"");e=e.slice(e.lastIndexOf("/")+1);try{e=decodeURIComponent(e)}catch{}return e.replace(/[\u0000-\u001f<>:"/\\|?*]/g,"").trim().slice(0,120)||"file"};function rt(i){let e=i.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(i.subarray(0,512).toString("utf8"))?"image/svg+xml":null}var w=(i,e)=>V(e,{reason:i}),S=(i,e)=>{let l=rt(i);if(!l)throw w("type","\u4EC5\u652F\u6301\u56FE\u7247");return Z(l)},at=(i,e)=>z(e),ot=(i,e)=>{let l=z(e);if(!["html","htm","pdf"].includes(l)||l==="pdf"&&i.subarray(0,5).toString("latin1")!=="%PDF-")throw w("type","\u53EA\u80FD\u5D4C\u5165 HTML \u6216 PDF \u6587\u4EF6");return l},j={big:i=>T("\u56FE\u7247\u592A\u5927\uFF08\u6700\u591A {0} MB\uFF09",i),unreachable:"\u4E0B\u8F7D\u4E0D\u4E86\u8FD9\u5F20\u56FE\u7247"},B={big:i=>T("\u6587\u4EF6\u592A\u5927\uFF08\u6700\u591A {0} MB\uFF09",i),unreachable:"\u4E0B\u8F7D\u4E0D\u4E86\u8FD9\u4E2A\u6587\u4EF6"},k={icon:{limit:y.icon,words:j,extension:S},image:{limit:y.image,words:j,extension:S},file:{limit:y.file,words:B,extension:at,named:!0},embed:{limit:y.embed,words:B,extension:ot,named:!0}};function wt(i,e,l,b){let s=k[i].extension(l,b);return`${i}-${e.slice(0,12)}${s?`.${s}`:""}`}function bt({reportsDirectory:i}){let e=nt(i).emojiLibrary,l=async t=>{let n=U(t,i);return await f.stat(et(n).html).catch(()=>null)?n:null},b=g.join(e,"library.json"),s=(t,n,r)=>[t,{ok:!1,reason:n,...X(r)}];async function O(t,n,{stem:r,limit:a,words:c=j,extension:o=S,given:m}){let u=o(n,m);if(n.length>a)throw w("size",c.big(a/1024/1024));let p=`${r}-${q("sha256").update(n).digest("hex").slice(0,12)}${u?`.${u}`:""}`;await f.mkdir(t,{recursive:!0});let h=g.join(t,p);return await f.stat(h).catch(()=>null)||await f.writeFile(h,n),p}let E=(t,n,r,a=y.icon)=>O(t,n,{stem:r,limit:a});async function I(t,n,r=j){let a=await L(t,{unreachable:r.unreachable});if(!a.ok)throw w("download",r.unreachable);let c=await _(a,n);if(!c)throw w("size",r.big(n/1024/1024));return c}async function $(){try{let t=JSON.parse(await f.readFile(b,"utf8"));return Array.isArray(t)?t:[]}catch{return[]}}let v=t=>({id:t.id,name:t.name,url:`/__gallery/edit/emoji-library/${t.file}`,created_time:t.created,alive:!0});async function A(t){let{slug:n,data:r,url:a,library:c}=t??{},o=Object.hasOwn(k,t?.kind)?t.kind:"icon";if(typeof n!="string"||!F.test(n))return s(400,"body");let m=await l(n);if(!m)return s(404,"missing");let{limit:u,words:p,extension:h,named:J}=k[o];try{let d,x;if(typeof r=="string")d=Buffer.from(r,"base64"),x=t.name;else if(typeof a=="string")d=await I(a,u,p),x=a;else if(typeof c=="string"){let P=(await $()).find(K=>K.id===c);if(!P)return s(404,"library","\u8FD9\u4E2A\u81EA\u5B9A\u4E49\u8868\u60C5\u5DF2\u4E0D\u5728\u8868\u60C5\u5E93\u91CC");d=await f.readFile(g.join(e,P.file))}else return s(400,"body");return[200,{ok:!0,path:`assets/${await O(g.join(m,"assets"),d,{stem:o,limit:u,words:p,extension:h,given:x})}`,...J?{name:it(x),size:d.length}:{}}]}catch(d){return s(422,d.reason??"write",d)}}async function R(t){let{slug:n,url:r,parts:a="all"}=t??{};if(typeof n!="string"||!F.test(n)||typeof r!="string"||!["all","icon","title"].includes(a))return s(400,"body");let c=await l(n);if(!c)return s(404,"missing");try{return[200,{ok:!0,...await N(r,async(m,u)=>`assets/${await E(g.join(c,"assets"),m,u,y.image)}`,{icon:a!=="title",cover:a==="all"})}]}catch(o){return s(422,o.reason??"download",o)}}async function W(t){return typeof t?.url!="string"?s(400,"body"):[200,{ok:!0,...await D(t.url)}]}async function C(t){let{slug:n,name:r,url:a}=t??{};if(typeof r!="string"||!/^[\p{Ll}\p{Lo}\d_-]{1,49}$/u.test(r)||typeof a!="string")return s(400,"body");let c=await $();if(c.some(o=>o.name===r))return s(409,"name","\u540D\u79F0\u5DF2\u88AB\u5360\u7528");try{let o;M(a)&&typeof n=="string"&&F.test(n)?o=await f.readFile(g.join(U(n,i),a)):o=await I(a,y.icon);let m=await E(e,o,"emoji"),u={id:Q(),name:r,file:m,created:Date.now()};return await f.writeFile(b,`${JSON.stringify([...c,u],null,2)}
|
|
3
|
+
`),[200,{ok:!0,entry:v(u)}]}catch(o){return s(422,o.reason??"write",o)}}let G=async()=>[200,{ok:!0,list:(await $()).map(v)}];async function H(t){if(!M(`assets/${t}`))return null;let n=await f.readFile(g.join(e,t)).catch(()=>null);return n&&{type:tt(t),body:n}}return{upload:A,unfurl:R,frameable:W,addEmoji:C,listEmojis:G,readEmoji:H}}export{wt as a,bt as b};
|
|
@@ -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-IV64FFI4.mjs";import"./chunk-GHOYKMQ3.mjs";import"./chunk-QE5RG76S.mjs";import"./chunk-UYVCQK3H.mjs";import"./chunk-J5PUIV3Y.mjs";import"./chunk-4OZWXZE5.mjs";import"./chunk-VS7JIGJW.mjs";import"./chunk-HDWTZ763.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as copiedLines,b as run};
|
|
@@ -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}from"./chunk-DJISHPUL.mjs";import"./chunk-ITOH5EGO.mjs";import"./chunk-ZQS6H473.mjs";import"./chunk-HXG7EOPJ.mjs";import"./chunk-6N3PX4XX.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-R2ZDLJYT.mjs";import"./chunk-VFX2KNHP.mjs";import"./chunk-VS7JIGJW.mjs";import"./chunk-HDWTZ763.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{e as BASELINE_FROM,h as adoptIdless,g as baselineOf,b as blocksOf,k as exportBaselines,j as exportedText,i as hasBaseline,d as packageStamps,c as pageOf,l as previewBaseline,a as rankOf,f as readBaseline};
|
|
@@ -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{a as ue,b as we,k as ge,v as $e,w as be}from"./chunk-3MBRL2PM.mjs";import{M as ye}from"./chunk-HPOI4ZX7.mjs";import"./chunk-342HXE3Q.mjs";import"./chunk-EAIFITAV.mjs";import{c as R,f as ke}from"./chunk-AR5D57ZD.mjs";import"./chunk-67N2QJYT.mjs";import{a as P}from"./chunk-JEUK3ZO7.mjs";import"./chunk-PUOQ65NC.mjs";import"./chunk-7OG26PGF.mjs";import"./chunk-DJISHPUL.mjs";import"./chunk-ZWWC4KLF.mjs";import"./chunk-IA4PSIMD.mjs";import"./chunk-2OHANJ6Q.mjs";import"./chunk-F4ZA6JRZ.mjs";import"./chunk-7M2BQQGZ.mjs";import"./chunk-ITOH5EGO.mjs";import{b as de,h as D}from"./chunk-ZQS6H473.mjs";import"./chunk-QE5RG76S.mjs";import{n as ie}from"./chunk-J5PUIV3Y.mjs";import"./chunk-4OZWXZE5.mjs";import{a as pe,j as fe,s as me}from"./chunk-MXUBKDRO.mjs";import{d as re,e as le,i as I,j as ce,k as he}from"./chunk-HXG7EOPJ.mjs";import"./chunk-ZTHICSSF.mjs";import{a as g}from"./chunk-6N3PX4XX.mjs";import"./chunk-PAREWQGB.mjs";import"./chunk-BFJGHSQN.mjs";import"./chunk-U5XL7D6A.mjs";import{a as z,c as S}from"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-R2ZDLJYT.mjs";import"./chunk-VFX2KNHP.mjs";import{c as ae}from"./chunk-VS7JIGJW.mjs";import{a as F,f as te,h as se,j as U,r as ne,s as oe}from"./chunk-HDWTZ763.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{isUtf8 as Ue}from"node:buffer";import X from"node:fs";import E from"node:path";import{instanceSlots as ze,instancesOf as Y,isInstance as Z,partOf as W}from"../browser/shared/components/index.mjs";import{fewestSyllables as Oe}from"../browser/shared/pinyin.mjs";import{ATTRIBUTE as $,refusedInCopy as De}from"../browser/shared/components/installed.mjs";import{attr as b,elementsOf as Q,walk as A}from"../browser/shared/html-tree.mjs";import{blankedCss as M}from"../browser/shared/css-references.mjs";import{ATTRIBUTE as G,SLOT as Le}from"../browser/shared/components/installed.mjs";var Ae=new Set(["media","supports","container","layer","starting-style"]);function K(e,t){let s=0,o="";for(let n=0;n<e.length;n++){let i=e[n];i==="\\"?n++:o?o=i===o?"":o:i==='"'||i==="'"?o=i:i===")"||i==="]"?s--:(s===0&&t(i,n),(i==="("||i==="[")&&s++)}}function Ce(e){let t=M(e),s=M(e,{strings:!0}),o={children:[]},n=[o],i=0,r=0;for(let a=0;a<t.length;a++){let l=t[a];if(l==="\\")a++;else if(l==="("||l==="[")r++;else if(l===")"||l==="]")r=Math.max(0,r-1);else{if(r>0)continue;if(l==="{"){let c={prelude:s.slice(i,a),start:i,children:[]};n.at(-1).children.push(c),n.push(c),i=a+1}else l==="}"?(n.length>1&&n.pop(),i=a+1):l===";"&&(i=a+1)}}return o.children}function _(e){let t=[],s=0;return K(e,(o,n)=>{o===","&&(t.push({text:e.slice(s,n),start:s}),s=n+1)}),t.push({text:e.slice(s),start:s}),t.filter(({text:o})=>o.trim())}function H(e){let t=[],s=e.trim(),o="",n=0,i=0,r=a=>{(i||a)>n&&t.push({combinator:o,compound:s.slice(n,i||a)}),i=0};return K(s,(a,l)=>{/\s/.test(a)?l===n?n=l+1:i||=l:">+~".includes(a)?(r(l),o=a,n=l+1):i&&(r(l),o=" ",n=l)}),r(s.length),t}function B(e){let t=[],s=-1,o=0,n="";for(let r=0;r<e.length;r++){let a=e[r];a==="\\"?r++:n?n=a===n?"":n:a==='"'||a==="'"?n=a:a==="("?o++:a===")"?o--:a==="["&&o===0?s=r:a==="]"&&o===0&&s>=0&&(t.push(e.slice(s,r+1)),s=-1)}let i=!1;return K(e,r=>{i||=r==="&"}),{attributes:t,nesting:i,scope:/(?:^|[^\w-]):scope\b/.test(e)}}var Ie=e=>new RegExp(`^\\[\\s*${G}\\s*=\\s*(["'])${e.replace(/[/-]/g,"\\$&")}\\1\\s*i?\\s*\\]$`,"i"),Pe=e=>M(e).replace(/\\.|\[[^\]]*\]/g,"").includes("&");function xe(e,t,s,o=!1){let n=H(e),i=({compound:f})=>B(f).attributes.some(h=>t.test(h)),r=({compound:f})=>{let{nesting:h,scope:m}=B(f);return!!s&&(h||m)},a=f=>["+","~"].includes(f?.combinator),l=f=>n.slice(f).some(({combinator:h},m)=>(m+f===0?h||" ":h)===" "),c=n.findLastIndex(f=>i(f)||r(f));if(c<0)return!s||Pe(e)?{why:"outside"}:{why:s==="instance"&&a(n[0])?"beside":null,subject:"inside",deep:o||l(0)};let p=i(n[c])||s==="instance";return{why:p&&a(n[c+1])?"beside":null,subject:p&&c===n.length-1?"instance":"inside",deep:!i(n[c])&&o||l(c+1)}}var Se=e=>e.some(({subject:t})=>t==="instance")?"instance":"inside",Re=new RegExp(`^\\[\\s*${Le}\\s*(?:\\]|=)`,"i"),Fe=e=>_(/\)\s*to\s*\(([^)]*)\)/i.exec(e)?.[1]??"").some(({text:t})=>H(t).length===1&&B(t).attributes.some(s=>Re.test(s))),je=(e,t)=>Ne(e,t).outside;function Ee(e,t,s){if(s.length===0)return[];let o=`slot${s.length===1?"":"s"} ${s.join(" and ")}`;return Ne(e,t).deep.map(({line:n,words:i})=>({line:n,what:`${i} also reaches the blocks in ${o}, the document's: write each step with > or wrap the rules in @scope ([${G}="${t}"]) to ([${Le}])`}))}function Ne(e,t){let s=Ie(t),o=`[${G}="${t}"]`,n=[],i=[],r=(l,c,p)=>{let f=c.replace(/\s+/g," ").trim();n.push({line:S(e,l),what:p==="beside"?`${f} reaches what stands beside the instance: what it styles has to stand in it`:`${f} reaches outside the instance: start it at ${o}`})},a=(l,c,p=!1,f=!1)=>{for(let h of l){let m=h.prelude.length-h.prelude.trimStart().length,u=h.start+m,y=/^@([\w-]+)\s*/.exec(h.prelude.trim());if(y){let d=y[1].toLowerCase();if(Ae.has(d))a(h.children,c,p,f);else if(d==="page")n.push({line:S(e,u),what:"@page reaches the paper of the whole document: an instance has no page of its own"});else if(d==="scope"){let x=/^@scope\s*\(([^)]*)\)/i.exec(h.prelude.trim())?.[1]??"",L=_(x).map(({text:j})=>({...xe(j,s,c),steps:H(j).length}));x&&L.every(({why:j,steps:Te})=>!j&&Te===1)?a(h.children,Se(L),!1,f||Fe(h.prelude.trim())):r(u,h.prelude,"outside")}continue}let k=_(h.prelude).map(({text:d,start:x})=>{let L=xe(d,s,c,p),j=h.start+x+d.length-d.trimStart().length;return L.why?r(j,d,L.why):L.deep&&!f&&!p&&i.push({line:S(e,j),words:d.replace(/\s+/g," ").trim()}),L});k.some(({why:d})=>d)||a(h.children,Se(k),k.some(d=>d.deep),f)}};return a(Ce(e),null),{outside:n,deep:i}}var w="template.html",N="example.html",O="component.json",Me=new Set(["localStorage","sessionStorage"]),_e=/^\S+: (?:line \d+ of )?its (?:kit\.js|style\.css) /,Be=/(?: (?:names a file that )?is not in the document's folder|: it is (?:no file of|not in) the document's .*)$|^external resources are not portable: .*$/,Ge=": an example stands in no document: write a picture as a data: address, or draw it from style.css with a file the manifest's assets name",Ke=e=>e.replace(Be,t=>(t.startsWith("external")?t:"")+Ge),T=(e,t)=>I({folder:e},t);function C(e,t){let s=null;try{s=X.readFileSync(E.join(e,t))}catch{return null}return Ue(s)?null:{file:t,what:"it is not UTF-8: save it as UTF-8 (PowerShell's > writes UTF-16; Set-Content -Encoding utf8 does not)"}}function J(e,t){let s=/^line (\d+): | \(line (\d+)\)/.exec(t);return s?{file:e,line:Number(s[1]??s[2]),what:t.replace(s[0],"")}:{file:e,what:t}}function v(e,t){let s=g.parseJsonText(O,e),o=s.statements[0]?.expression,n=null;for(let i of t.split(".")){let r=o?.properties?.find(({name:a})=>a?.text===i);if(!r)break;n=s.getLineAndCharacterOfPosition(r.getStart(s)).line+1,o=r.initializer}return n}function He(e,{message:t,text:s="",values:o=[]}){let n=/at position (\d+)/.exec(t)?.[1];if(n)return S(e,Number(n));for(let i of[...o.map(String),...s.match(/[a-zA-Z][\w.]*/g)??[]]){let r=v(e,i);if(r)return r}return null}var Je=e=>D(e).map(t=>/^line (\d+): <([^>]+)>: ([\s\S]*)$/.exec(t)).filter(Boolean).map(([,t,s,o])=>({line:Number(t),tag:s,why:o}));function qe(e,{file:t,tree:s,html:o}){let n=[],i=Je(o),r=Object.entries(e.parts).filter(([,c])=>c.edit==="text"),a=Object.entries(e.parts).filter(([,c])=>c.edit==="data"),l=(c,p)=>{let f=!1;return A(c,h=>{f||=h===p}),f};for(let c of Y(s,e))for(let[p,f]of r)for(let h of W(c,f.at)){let m=h.sourceCodeLocation?.startLine,u=Q(h).find(d=>ae.has(d.tagName)),y=i.find(d=>d.line===m&&d.tag===h.tagName),k=a.find(([,d])=>W(c,d.at).some(x=>x===h||l(x,h)||l(h,x)))?.[0];k?n.push({file:t,line:m,what:`the part ${p} (${f.at}) is edited as text, and stands in the part ${k}, edited as data, or around it, which is the component's: the editor leaves it read-only: name elements apart`}):u?n.push({file:t,line:m,what:`the part ${p} (${f.at}) is edited as text and holds a block, its <${u.tagName}> at line ${u.sourceCodeLocation?.startLine}: a text part holds words and marks alone, and the editor would leave this one read-only: write its \`at\` as what holds the words (${f.at} > ${u.tagName}), or give each block a part of its own`}):y&&n.push({file:t,line:m,what:`the part ${p} (${f.at}) is edited as text, and the editor would leave it read-only for what it holds: ${y.why}. A text part holds words and marks alone`})}return n}var ee=new RegExp("\\p{Script=Han}","u"),ve=e=>[...e].filter(t=>ee.test(t)).length,Ve={test:e=>{let t=Oe(e);return t!==null&&t<=8}};function We({name:e,words:t}){let s=ve(e.zh),o=t.split(/\s+/).filter(Boolean);return s===0?ee.test(t)&&!o.some(n=>Ve.test(n)):!o.some(n=>Oe(n.toLowerCase())===s)}function Xe({id:e,folder:t,catalog:s,off:o,parts:n}){let i=s.packages.get(e),r=s.problems.get(e)?.problem,a=T(t,O)??"",l=[];r&&l.push({file:O,line:He(a,r),what:U("en",r)}),i?.template===null&&l.push({file:w,what:`there is none, and it is what "/" puts in a document: with none, no menu offers the block: write one <div ${$}="${e}"> with what a new instance holds`}),l.push(...n);let c=C(t,"writing.md");c&&l.push(c);let p=c||T(t,"writing.md")?.trim()?[]:[{file:"writing.md",what:"there is none, so gallery block show has nothing to say of how to write it"}];i&&We(i)&&p.push({file:O,line:v(a,"words")??v(a,"name.zh"),what:ee.test(i.name.zh)?`no word of words spells its whole name ${i.name.zh} in pinyin as an input method composes it, its ${ve(i.name.zh)} Chinese characters a syllable each in one word (as \u65B9\u6848\u6253\u5206 is fangandafen): "/" finds it while those letters are being composed only by such a word. What is counted is how many syllables a word reads as, not which characters they spell`:'its words are Chinese and none of them is pinyin: "/" goes by the letters an input method is composing, so write the pinyin there (\u770B\u677F kanban)'});let f=(()=>{try{return ie(X.readFileSync(E.join(t,"preview.svg")),e)}catch{return null}})();return f&&p.push({file:"preview.svg",what:`it is Gallery's ${f.id} picture, byte for byte (a block made with --recipe keeps its recipe's drawing, which the menu shows beside this block's name): draw this block's own, or delete preview.svg, which the menu does without`}),o&&p.push({file:"gallery.json",what:"the user turned it off in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868, which is theirs to change and says nothing of the block: it is checked as if it were on, and the instances of a document show what they hold, read-only, until it is on"}),i&&(l.push(...Ze(i)),p.push(...Ye(i,a))),{title:"manifest",problems:l,notes:p}}function Ye({places:e,parts:t,card:s},o){let n=[];if(e.includes("page"))for(let[i,r]of Object.entries(t))r.edit==="text"&&n.push({file:O,line:v(o,`parts.${i}`),what:`the part ${i} is edited as text, which is read-only on a custom page (no editor runs there): a block whose places hold page keeps what a reader changes there in a data part, with its own field or the card's settings`});else v(o,"card")&&n.push({file:O,line:v(o,"card"),what:`card is for a custom page's board, and its places (${e.join(", ")}) hold no page: nothing reads it`});return n}function Ze(e){if(e.settings.length===0||!e.template)return[];let t=ne(e.template,e.id),s=t?W(t.root,e.parts[F].at):[];if(s.length!==1||(b(s[0],"type")??"").trim().toLowerCase()!=="application/json")return[{file:w,what:`its manifest has settings, and the template holds ${s.length===1?`a <${s[0].tagName}> where`:`${s.length} elements of`} its settings part (${e.parts[F].at}): it is to hold one <script type="application/json">, the values a new card starts with ({} for each setting's default)`}];let o=s[0].childNodes.map(n=>n.value??"").join("").trim();try{let n=JSON.parse(o||"{}");if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("it is no object");return[]}catch(n){return[{file:w,line:s[0].sourceCodeLocation?.startLine,what:`its settings part is not a JSON object (${n.message}): write {} or the values of some of its settings, by key`}]}}function Qe(e){let t=g.createSourceFile("kit.js",e,g.ScriptTarget.Latest,!0,g.ScriptKind.JS),s=[],o=n=>{let i=g.isCallExpression(n)&&g.isPropertyAccessExpression(n.expression)?n.expression:null;if(i?.name.text==="component"&&/\bDocKit$/.test(i.expression.getText(t))){let[r]=n.arguments,a=r&&g.isObjectLiteralExpression(r)?r.properties.find(c=>c.name?.getText(t)==="id"):null,l=a&&g.isPropertyAssignment(a)&&g.isStringLiteralLike(a.initializer)?a.initializer.text:null;s.push({id:l,at:n.getStart(t)})}g.forEachChild(n,o)};return o(t),s}function et(e){let t="kit.js";if(!e.files.includes("kit.js"))return{title:t,none:"none: a static block"};let s=C(e.folder,t);if(s)return{title:t,stops:!0,problems:[s]};let o=I(e,"kit.js")??"",n=pe(o);if(n)return{title:t,stops:!0,problems:[{file:t,line:n.line,what:`a browser refuses it: ${n.message}`}]};let i=he(e).map(({line:c,what:p})=>({file:t,line:c,what:p})),r=i.length>0;for(let{name:c,at:p}of re(o,Me))i.push({file:t,line:S(o,p),what:`uses ${c}: an instance keeps what a reader chose with context.state`});let a=Qe(o);for(let{id:c,at:p}of a)c!==null&&c!==e.id&&i.push({file:t,line:S(o,p),what:`it registers ${c}, and this block is ${e.id}`});let l=a.length?[]:[{file:t,what:`no DocKit.component({ id: "${e.id}", mount(host, context) { \u2026 } }) is to be read in it, and a script may make that call in ways reading does not tell: running it says whether it starts one`}];for(let{line:c,code:p,message:f,refused:h}of le(o,{assets:e.assets}))(h?i:l).push({file:t,line:c,what:`TS${p}: ${f}`});return{title:t,stops:r,problems:i.sort((c,p)=>(c.line??0)-(p.line??0)),notes:l}}function tt(e){let t="style.css";if(!e.files.includes("style.css"))return{title:t,none:"none"};let s=C(e.folder,t);if(s)return{title:t,stops:!0,problems:[s]};let o=I(e,"style.css")??"",n=ce(e),i=[...je(o,e.id),...n].map(({line:l,what:c})=>({file:t,line:l,what:c})),r=Object.entries(e.parts??{}).filter(([,{edit:l}])=>l==="flow").map(([l])=>l),a=Ee(o,e.id,r).map(({line:l,what:c})=>({file:t,line:l,what:c}));return{title:t,stops:n.length>0,problems:i.sort((l,c)=>l.line-c.line),notes:a}}function st(e,{tree:t}){let s=null;A(t,a=>{s??=a.tagName==="main"?a:null});let o=Q(s??{}),n=(s?.childNodes??[]).some(a=>a.nodeName==="#text"&&a.value.trim()),[i]=o;if(o.length!==1||n||!Z(i)||b(i,$)!==e)return[{file:w,line:i?.sourceCodeLocation?.startLine,what:`a template is one element, a <div ${$}="${e}"> or a <section>, and it holds ${o.length===1&&!n?`<${i.tagName}${b(i,$)?` ${$}="${b(i,$)}"`:""}>`:`${o.length} element${o.length===1?"":"s"}${n?" and words":""}`}`}];let r=[];return A({childNodes:[i]},a=>{b(a,"data-block-id")!==void 0&&r.push({file:w,line:a.sourceCodeLocation?.startLine,what:"it writes a data-block-id, which every instance made of it would repeat: leave it out, Gallery gives a block its id"})}),r}var nt=[[e=>b(e,"data-doc-chart")!==void 0,e=>`a chart (<${e.tagName} data-doc-chart="${b(e,"data-doc-chart")}">)`],[e=>e.tagName==="figure",()=>"a card (<figure>)"],[e=>e.tagName==="caption",()=>"a table's <caption>"],[Z,e=>`an instance of ${b(e,$)}`]];function ot(e,t){let s=null;if(A(z(t),i=>{s??=Z(i)&&b(i,$)===e?i:null}),!s)return[];let o=[],n=(i,r)=>{for(let a of Q(i)){let l=nt.find(([c])=>c(a));l?o.push({file:w,line:a.sourceCodeLocation?.startLine,what:`its slot ${b(r,"data-doc-slot")} holds ${l[1](a)}, which a new block from "/" would not have: a menu makes what a template's slot holds as a paste of it makes blocks, and a paste makes no chart, card, table caption or instance of a block. Keep the template's slots to blocks the page makes (paragraphs, headings, lists, quotes, code, a plain table, a disclosure), and show the rest in example.html`}):n(a.tagName==="template"?a.content:a,r)}};for(let i of ze(s))n(i,i);return o}function it(e,{tree:t}){let s=oe(e);if(!s)return[];let[o]=Y(t,e),n=null;return o&&A({childNodes:[o]},i=>{De(i.tagName,i.attrs)&&(n??=i)}),[{file:w,line:(n??o)?.sourceCodeLocation?.startLine,what:U("en",s)}]}function at(e){return[[w,"component-template"],[N,"component-example"]].flatMap(([t,s])=>{let o=T(e,t);if(o===null||!o.trim()||C(e,t))return[];let n=ge(s,o),{text:i}=de(n);return[{file:t,slug:s,written:n,html:i,tree:z(i)}]})}function rt({id:e,folder:t,found:s,pages:o,parts:n}){let i="template.html and example.html",r=[],a=[];for(let h of[w,N]){let m=C(t,h);m?r.push(m):h===w&&!T(t,h)?.trim()&&s.template!==null?r.push({file:h,what:"it is empty"}):h===N&&!o.some(u=>u.file===h)&&r.push({file:h,what:`there is none or it is empty: write an instance as a writer would fill it, a <div ${$}="${e}">; it is what this check runs`})}let l=o.find(h=>h.file===w);l&&r.push(...st(e,l),...ot(e,l.written));let c=o.find(h=>h.file===N);c&&Y(c.tree,s).length===0&&r.push({file:N,what:`it holds no instance of ${e}: a <div ${$}="${e}">`});let p=o.map(({slug:h,written:m,html:u,file:y})=>({file:y,slug:h,written:m,html:u,directory:E.join(t,h),htmlPath:E.join(t,h,"doc.html"),metadata:{title:h,description:h,type:"component"}})),f=fe(p);for(let h of p){for(let m of f.get(h.slug)??[])_e.test(m)||r.push(J(h.file,Ke(m)));for(let m of me(h))a.push(J(h.file,m));for(let m of D(h.html)){let u=J(h.file,`${m} (read-only in the preview)`);n.some(({file:y,line:k})=>y===u.file&&k===u.line)||a.push(u)}}return l&&!r.some(({file:h})=>h===w)&&r.push(...it(s,l)),{title:i,problems:r,notes:a}}function lt(e,t){let s=te(e,void 0,{on:t}),o=R(e,t);if(!s.packages.has(t)&&!s.problems.has(t))return null;se(e,s);let n=s.packages.has(t)&&s.settings.disabled.includes(t),i=s.packages.get(t)??{id:t,folder:o,files:["kit.js","style.css"].filter(c=>X.existsSync(E.join(o,c)))},r=at(o),a=s.packages.has(t)?null:"its manifest does not load",l=a?[]:r.flatMap(c=>qe(i,c));return{found:s.packages.get(t)??null,pages:r,sections:[Xe({id:t,folder:o,catalog:s,off:n,parts:l}),et(i),tt(i),a?{title:"template.html and example.html",skipped:a}:rt({id:t,folder:o,found:i,pages:r,parts:l})]}}var q=({file:e,line:t})=>t?`${e}:${t}`:e;function V({title:e,problems:t=[],notes:s=[],told:o=[],none:n,skipped:i,unverified:r,pictures:a},l){let c=r?`UNVERIFIED ${r}`:i?`not run: ${i}`:n??(t.length?`${t.length} problem${t.length===1?"":"s"}`:`ok${s.length?`, ${s.length} note${s.length===1?"":"s"}`:""}`);return[`${l}. ${e}: ${c}`,...t.map(p=>` FAIL ${q(p)}: ${p.what}`),...s.map(p=>` note ${q(p)}: ${p.what}`),...o.map(p=>` way back ${q(p)}: ${p.what}`),...a?[ct(a)]:[]]}function ct({folder:e,overviews:t,each:s,edited:o=[],asExport:n=[],documents:i=!1}){let r=t.length?`${P(E.join(e,t[0]))}${t.slice(1).map(c=>` and ${c}`).join("")}, the three widths of each theme side by side; then each at full size: `:`${P(e)}: `,a=n.length===0?"":n.length===o.length?", each the same picture as the export's at its width: the block draws nothing more where a reader can edit":`, ${n.join(" and ")} the same picture as the export's at its width`,l=o.length?`; and ${o.join(" and ")}, as the editing page draws it (context.canEdit() true)${a}`:"";return` Pictures (none looked at for you; ${i?"each instance under a line naming where it stands in the document":"example.html above the line, template.html below it, each under its name"}): ${r}${s.join(", ")}${l}`}function ht([e,t,s,o]){return e.problems.length?"the manifest":t.stops?"kit.js":s.stops?"style.css":o.skipped||o.problems.length?"template.html and example.html":null}async function Ut(e,t,{documents:s=!1}={}){let o=lt(e,t);o||(console.error(ke(e,t)),process.exit(1)),console.log(`${t}: ${P(R(e,t))}`),o.sections.forEach((p,f)=>console.log(V(p,f+1).join(`
|
|
3
|
+
`)));let n=ht(o.sections),i=R(e,t),r=n?{title:ue,skipped:`${n} first`}:await $e(e,o.found,{example:T(i,N),template:T(i,w)});console.log(V(r,5).join(`
|
|
4
|
+
`));let a=s?n?[{title:we(),skipped:`${n} first`}]:await be(e,o.found):[];a.forEach((p,f)=>console.log(V(p,6+f).join(`
|
|
5
|
+
`)));let l=ye([r,...a].filter(({pictures:p})=>p).map(({pictures:{folder:p,overviews:f,each:h,edited:m=[]}})=>({folder:p,files:[...f,...h,...m].map(u=>E.join(p,u))})));l&&console.log(l);let c=[...o.sections,r,...a].reduce((p,{problems:f=[]})=>p+f.length,0);c?(console.log(`FAIL ${t}: ${c} problem${c===1?"":"s"}`),process.exitCode=1):r.unverified||a.some(({unverified:p})=>p)?(console.log(`UNVERIFIED ${t}: the rest passed, and no browser ran ${r.unverified?"it":"the documents' instances"}: export a document that holds it and open that in Chrome or Edge.`),process.exitCode=3):console.log(`OK ${t}${s?" and its instances in the workspace's documents":""}`)}export{Ut as checkCommand,Oe as fewestSyllables,lt as readSections,V as sectionLines,We as wantsPinyin};
|
|
@@ -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 w,b as k,c as f,g as u}from"./chunk-QE5RG76S.mjs";import{readFileSync as x,realpathSync as E}from"node:fs";import p from"node:path";import{fileURLToPath as $}from"node:url";var S=p.dirname($(import.meta.url));function v(t=S){for(let e=t;;e=p.dirname(e)){try{let a=JSON.parse(x(p.join(e,"package.json"),"utf8"));if(a.name==="@heycys/gallery")return a.version}catch{}if(p.dirname(e)===e)return"0.0.0"}}var O={init:()=>import("./chunk-F6HVDZR4.mjs"),new:()=>import("./chunk-LM4XFQHZ.mjs"),import:()=>import("./chunk-ZDLPUOAG.mjs"),open:()=>import("./chunk-5K44HLTZ.mjs"),serve:()=>import("./chunk-U7NZI6N4.mjs"),stop:()=>import("./chunk-EKNHM3P4.mjs"),check:()=>import("./chunk-6KBYRA2C.mjs"),export:()=>import("./chunk-CMA72MAG.mjs"),qa:()=>import("./chunk-TR7TWGHB.mjs"),list:()=>import("./chunk-ZHEHPMBK.mjs"),workspaces:()=>import("./chunk-MN7BZL4R.mjs"),move:()=>import("./chunk-BZ5RAF7L.mjs"),set:()=>import("./chunk-YNAWBAYN.mjs"),link:()=>import("./chunk-JZT7I2OJ.mjs"),extension:()=>import("./chunk-L7UP52JO.mjs"),block:()=>import("./chunk-PGDE24N5.mjs"),page:()=>import("./chunk-UJQJKNGK.mjs"),skill:()=>import("./chunk-POTA2FV4.mjs")},j=new Set(["stop","init","skill","workspaces"]),N=(t,e)=>`${t.split(`
|
|
3
|
+
`)[0]} (gallery ${e?`${e} --help`:"help"} says more)`,g=t=>/^--.|^-[A-Za-z]/.test(t);function A(t){let e=t.indexOf("--"),a=e===-1?t:t.slice(0,e),h=e===-1?[]:t.slice(e),n=[],s=null;for(let r=0;r<a.length;r++){let o=a[r];if(o==="--workspace"||o.startsWith("--workspace=")){let c=o.includes("=")?o.slice(o.indexOf("=")+1):r+1<a.length&&!g(a[r+1])?a[++r]:"";if(!c)return{error:"--workspace takes a folder: --workspace <dir>",usage:u};if(s!==null&&p.resolve(s)!==p.resolve(c))return{error:`Two workspaces named: ${s} and ${c}.`,usage:u};s=c;continue}n.push(o)}if(n[0]==="--version"||n[0]==="-v"||n[0]==="-V")return n.length===1&&h.length===0?{version:!0}:{error:"--version takes nothing else.",usage:u};if(n.length===0||n[0]==="help"||n[0]==="--help"||n[0]==="-h"){let r=n[0]==="help"?n[1]:void 0;return r===void 0?{help:u}:Object.hasOwn(f,r)?{help:f[r]}:{error:`No such command: ${r} (${w.join(", ")}).`,usage:u}}let[d,...m]=n,l=k[d]??d;if(!Object.hasOwn(O,l))return{error:g(l)?`Unknown option: ${l} (the command comes first: gallery <command> [options]).`:`No such command: ${l} (${w.join(", ")}).`,usage:u};let i=[...m,...h];if(m.some(r=>r==="--help"||r==="-h"))return{help:f[l]};if(l==="init"){let r=new Set(["--from","--name"]),o=[];for(let c=0;c<m.length;c++)r.has(m[c])?c++:g(m[c])||o.push(m[c]);if(o.push(...h.slice(1)),o.length>1)return{error:"Name one folder at most.",usage:f.init,command:l};if(o.length===1){if(s!==null&&p.resolve(s)!==p.resolve(o[0]))return{error:`Two workspaces named: ${o[0]} and --workspace ${s}.`,usage:f.init,command:l};s=o[0]}}return{command:l,argv:i,flag:s}}var L=(t,e)=>`Cannot write the workspace ${t} (${e}): allow Gallery to write there, or pass --workspace <a folder you may write>.`,G=(t,e=!0)=>e?`${p.join(t,"gallery.json")} is not Gallery's (another program's file of that name): pass --workspace <another folder> for Gallery's documents.`:`${p.join(t,"gallery.json")} does not read as JSON: mend the file, or pass --workspace <another folder> for Gallery's documents.`;async function b(t=process.argv.slice(2)){process.stdout.on("error",i=>{throw i.code==="EPIPE"&&process.exit(process.exitCode??0),i});let e=A(t);if(e.version){let i=v();console.log(i);try{let{versionNotes:r}=await import("./chunk-TANZRINB.mjs");for(let o of r(i))console.log(o)}catch{}return}if(e.help)return void console.log(e.help);e.error&&(console.error(`${e.error}
|
|
4
|
+
${N(e.usage,e.command)}`),process.exit(2));let{command:a,flag:h}=e,{findWorkspace:n}=await import("../browser/shared/workspace.mjs"),s=n({flag:h});if(process.env.GALLERY_WORKSPACE=s.root,!j.has(a)){let{ensureWorkspace:i}=await import("../browser/shared/workspace.mjs");try{let{ours:o,reads:c}=await i(s.root);o||(console.error(G(s.root,c)),process.exit(1))}catch(o){if(!o.code)throw o;console.error(L(s.root,o.code)),process.exit(1)}let{registerQuietly:r}=await import("../browser/shared/workspace-registry.mjs");await r(s.root)}let{UsageError:d,usageFailureText:m}=await import("./chunk-GPIWQ4X4.mjs"),l=await O[a]();try{await l.run(e.argv,{command:a,workspace:s.root,how:s.how,version:v()})}catch(i){if(!(i instanceof d))throw i;console.error(m(f[a],i.message,i.synopsis)),process.exit(2)}}var y=t=>{try{return E.native(t)}catch{return null}};process.argv[1]&&y(process.argv[1])===y($(import.meta.url))&&b();export{v as a,A as b,L as c,G as d,b as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-4OZWXZE5.mjs";import"./chunk-5L7RYZCL.mjs";export{b as UsageError,e as asksHelp,g as checkSlug,f as commandArguments,j as documentArguments,i as documentNamed,h as inTrashSaid,a as isOption,k as scriptArguments,d as usageFailureText,c as usageOf};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as H,c as X,e as ve}from"./chunk-A55HN5OK.mjs";ve();import{isUtf8 as _e}from"node:buffer";import{createHash as Pe}from"node:crypto";import{existsSync as Ce,lstatSync as De,readFileSync as _,readdirSync as Me,realpathSync as Q,statSync as Fe}from"node:fs";import Le from"node:fs/promises";import k from"node:path";import{isInstance as Re,parseCompound as Ke,parsePart as Ge,parseSelector as Ve,partOf as Ue}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as pe,NO_TEXT as We,PACKAGE_ID as A,PACKAGE_MARK as Be,SLOT as ee,inDocumentMenus as Je,instanceMatch as Ze,refusedInCopy as qe,settingState as Ye}from"../browser/shared/components/installed.mjs";import{writeAtomic as He}from"../browser/shared/files.mjs";import{attr as Xe,walk as Qe}from"../browser/shared/html-tree.mjs";import{HOST as me,NET as te,netHostsOf as et}from"../browser/shared/net-policy.mjs";import{inLanguage as tt,refusal as ue,said as i,saying as nt,told as st}from"../browser/shared/i18n/index.mjs";import{DEFAULT_PACK as ot,OWN_SCOPE as it,PACK_FILE as ne,PACK_ID as he,readPackManifest as rt}from"../browser/shared/pack-manifest.mjs";import{DEVICE_NAMES as at,PACKAGE_MANIFEST as I,WORKSPACE_MARK as ct,findWorkspace as lt,layoutOf as G,markerOf as ft,packageFolders as dt}from"../browser/shared/workspace.mjs";var se=1,oe=new Set(["code","state","sheets","tokens","dialogs","katex-styles","katex","katex-auto-render","math","d3","charts","tables"]),pt=["id","apiVersion","version","name","description","words","parts","runtime","assets","markdown","schema","places","card","settings","needs"],mt=["at","edit","optional","min","max"],ut=["generated","attrs"],ht=["document","page"],wt=["document"],yt=["sizes","w","h","min","max","resize","fit","bare","consent"],y={w:12,h:24},bt=["fixed","content"],ie={sizes:null,any:!1,w:4,h:null,min:{w:1,h:1},max:{...y},resize:!1,fit:"fixed",bare:!1},gt=["key","label","type","options","default","required"],kt=/^[a-z][a-zA-Z0-9]*$/,re=["text","number","select","date","switch","document"],Ot=/^\d{4}-\d{2}-\d{2}$/,$t="settings",Et=["workspace","tables"],St=["text","data","flow","none"],xt=/^[a-z][a-z0-9-]*$/,At=e=>`div[${ee}="${e}"], section[${ee}="${e}"]`,Nt=e=>Object.fromEntries(Object.entries(e).map(([n,s])=>[n,s.edit==="flow"?{...s,at:At(n)}:s])),jt=["parts","text"],we=["kit.js","style.css","preview.svg"],M="template.html",zt=[I,M,...we],V=e=>[...new Set([...zt,...e])].sort(),Tt=/^(?:[A-Za-z0-9_-][A-Za-z0-9._-]*\/)*[A-Za-z0-9_-][A-Za-z0-9._-]*\.[A-Za-z0-9]+$/,It=/^(?:doc-|data-doc-|data-ge-)|^data-block-id$/i,ae=256*1024,u=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),b=e=>typeof e=="string"&&e.trim()!=="",U=(e,n)=>e.id<n.id?-1:1,r=e=>{throw ue(e)},S=e=>{let n=Pe("sha256");return e(n),n.digest("hex").slice(0,16)};function j(e,n){let s=k.join(e,n);try{let t=De(s,{throwIfNoEntry:!1});if(!t)return null;if(!t.isSymbolicLink()&&!n.includes("/"))return s;let o=Q.native(s);return o.startsWith(Q.native(e)+k.sep)?o:null}catch{return null}}function ye(e,n){try{let s=j(e,n);return s&&_(s)}catch{return null}}var ce=new Map,vt=2e3;function _t(e){let{size:n,mtimeMs:s}=Fe(e),t=ce.get(e);if(t?.size===n&&t.time===s)return t.digest;let o=S(f=>f.update(_(e)));return Date.now()-s>vt&&ce.set(e,{size:n,time:s,digest:o}),o}var W=(e,n)=>S(s=>{for(let t of n){let o=j(e,t),f="none";try{o&&(f=_t(o))}catch{}s.update(`${t}\0${f}
|
|
3
|
+
`)}}),be=e=>e.toString("utf8").replace(/^\uFEFF/,""),ge=(e,n)=>{e.length>ae&&r(i("{0} \u6709 {1} KB\uFF0C\u800C\u6BCF\u4E00\u9875\u90FD\u5E26\u7740\u5B83\uFF0C\u6700\u591A {2} KB",n,Math.ceil(e.length/1024),ae/1024))},E=(e,n,s="")=>{for(let t of Object.keys(e))n.includes(t)||r(i("{0} \u4E0D\u662F\u81EA\u5B9A\u4E49\u5757\u7684\u6E05\u5355\u80FD\u5199\u7684\u5B57\u6BB5",`${s}${t}`))},le=(e,n)=>{for(let s of n)e[s]===void 0&&r(i("\u7F3A\u5C11 {0}",s))},v=(e,n)=>{(!u(e)||!b(e.zh)||!b(e.en)||Object.keys(e).length!==2)&&r(i("{0} \u8981\u5199\u6210 { zh, en } \u4E24\u79CD\u8BED\u8A00\u7684\u6587\u5B57",n))},F=e=>e.split(",").map(n=>n.split(">").at(-1).trim()).filter(n=>n!=="*").map(n=>Ke(n).tag);function Pt(e,n){let s=`parts.${e}`;if(u(n)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868",s)),E(n,mt,`${s}.`),n.edit==="flow"){xt.test(e)||r(i("{0} \u662F\u63D2\u69FD\uFF0C\u540D\u5B57\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",s)),n.at!==void 0&&r(i('{0} \u662F\u63D2\u69FD\uFF0C\u7531 data-doc-slot="{1}" \u6807\u51FA\uFF0C\u4E0D\u5199 at',s,e)),(n.min!==void 0||n.max!==void 0)&&r(i("{0} \u662F\u63D2\u69FD\uFF0C\u4E00\u4E2A\u5B9E\u4F8B\u91CC\u53EA\u6709\u4E00\u4E2A\uFF0C\u4E0D\u5199 min\u3001max",s)),n.optional!==void 0&&typeof n.optional!="boolean"&&r(i("{0} \u8981\u5199\u6210 true \u6216 false",`${s}.optional`));return}b(n.at)||r(i("\u7F3A\u5C11 {0}",`${s}.at`));try{Ge(n.at)}catch(t){r(i("{0} \u5199\u9519\u4E86\uFF1A{1}",`${s}.at`,t.message))}St.includes(n.edit)||r(i("{0} \u7684 edit \u53EA\u80FD\u662F text\u3001data\u3001flow \u6216 none",s)),n.optional!==void 0&&typeof n.optional!="boolean"&&r(i("{0} \u8981\u5199\u6210 true \u6216 false",`${s}.optional`));for(let t of["min","max"])n[t]!==void 0&&!(Number.isInteger(n[t])&&n[t]>=0)&&r(i("{0} \u8981\u5199\u6210\u4E0D\u5C0F\u4E8E 0 \u7684\u6574\u6570",`${s}.${t}`));if(n.min>n.max&&r(i("{0} \u7684 min \u6BD4 max \u5927\uFF0C\u6CA1\u6709\u5B9E\u4F8B\u80FD\u6EE1\u8DB3",s)),n.edit==="text")for(let t of F(n.at))We.has(t)&&r(i("{0} \u4E0D\u80FD\u6309\u6587\u5B57\u7F16\u8F91\uFF1A<{1}> \u4E0D\u662F\u80FD\u6253\u5B57\u7684\u6587\u5B57",s,t))}var Ct=e=>e.split(",").some(n=>n.split(">").every(s=>[":scope","*"].includes(s.trim())));function Dt(e,n){if(e===void 0)return null;u(e)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime")),E(e,ut,"runtime.");let s=`[${pe}="${n}"]`,t=(d,a)=>{try{if(!b(d))throw new Error("no selector");Ve(d)}catch(l){r(i("{0} \u5199\u9519\u4E86\uFF1A{1}",a,l.message))}return d.split(",").map(l=>l.trim().startsWith(":scope")?l.trim().replace(":scope",s):`${s} ${l.trim()}`).join(", ")},{generated:o=[],attrs:f={}}=e;Array.isArray(o)||r(i("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.generated")),u(f)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime.attrs"));for(let d of Object.values(f)){(!Array.isArray(d)||!d.every(b))&&r(i("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.attrs"));for(let a of d)It.test(a)&&r(i("{0} \u662F Gallery \u81EA\u5DF1\u7684\u540D\u5B57\uFF0C\u81EA\u5B9A\u4E49\u5757\u4E0D\u80FD\u7528",a))}let c=d=>{let a=t(d,"runtime.generated");return Ct(d)&&r(i("{0} \u7684 {1} \u662F\u6574\u4E2A\u5B9E\u4F8B\uFF0C\u800C\u8FD9\u91CC\u53EA\u5199\u5B83\u751F\u6210\u7684\u8282\u70B9","runtime.generated",d)),a};return{generated:o.map(c),attrs:Object.fromEntries(Object.entries(f).map(([d,a])=>[t(d,"runtime.attrs"),a]))}}var T=(e,n)=>Number.isInteger(e)&&e>=1&&e<=n,O=e=>e.find((n,s)=>e.indexOf(n)!==s);function Mt(e){return e===void 0?wt:((!Array.isArray(e)||e.length===0||!e.every(n=>ht.includes(n)))&&r(i('places \u8981\u5199\u6210 document\u3001page \u4E2D\u7684\u4E00\u4E2A\u6216\u4E24\u4E2A\uFF0C\u5982 ["document"]')),O(e)&&r(i("places \u91CC {0} \u5199\u4E86\u4E24\u6B21",O(e))),[...e])}function Ft(e){if(e===void 0)return ie;u(e)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","card")),E(e,yt,"card.");let n=a=>Array.isArray(a)&&a.length===2&&T(a[0],y.w)&&T(a[1],y.h);if(e.sizes!==void 0){(!Array.isArray(e.sizes)||e.sizes.length===0||!e.sizes.every(n))&&r(i("card.sizes \u8981\u5199\u6210 [\u5BBD, \u9AD8] \u7684\u4E00\u4E32\uFF0C\u5BBD 1 \u5230 {0} \u683C\uFF0C\u9AD8 1 \u5230 {1} \u683C",y.w,y.h));let a=O(e.sizes.map(p=>p.join("x")));a&&r(i("card.sizes \u91CC {0} \u5199\u4E86\u4E24\u6B21",a));let l=["w","h"].find(p=>e[p]!==void 0);l&&r(i("\u5199\u4E86 card.sizes\uFF0C\u5C31\u4E0D\u518D\u5199 card.{0}\uFF1A\u7B2C\u4E00\u79CD\u5927\u5C0F\u662F\u9ED8\u8BA4\u7684",l))}for(let a of["w","h"])e[a]!==void 0&&!T(e[a],y[a])&&r(i("{0} \u8981\u5199\u6210 1 \u5230 {1} \u7684\u6574\u6570",`card.${a}`,y[a]));let s={};for(let a of["min","max"]){let l=e[a];if(l!==void 0){u(l)||r(i("{0} \u8981\u5199\u6210 { w, h }\uFF0C\u5355\u4F4D\u662F\u683C",`card.${a}`)),E(l,["w","h"],`card.${a}.`);for(let p of["w","h"])l[p]!==void 0&&!T(l[p],y[p])&&r(i("{0} \u8981\u5199\u6210 1 \u5230 {1} \u7684\u6574\u6570",`card.${a}.${p}`,y[p]));s[a]=l}}let t={w:s.min?.w??1,h:s.min?.h??1},o={w:s.max?.w??y.w,h:s.max?.h??y.h},f=e.sizes?e.sizes[0][0]:e.w??ie.w,c=e.sizes?e.sizes[0][1]:e.h??null,d=!!e.sizes&&(e.min!==void 0||e.max!==void 0);if(d){let a=e.sizes.find(([l,p])=>l<t.w||l>o.w||p<t.h||p>o.h);a&&r(i("card.sizes \u91CC {0} \u4E0D\u5728 card.min \u5230 card.max \u4E4B\u95F4",a.join("x")))}for(let a of["w","h"]){t[a]>o[a]&&r(i("card.min.{0} \u6BD4 card.max.{0} \u5927",a));let l={w:f,h:c}[a];l!==null&&!e.sizes&&(l<t[a]||l>o[a])&&r(i("\u9ED8\u8BA4\u7684 card.{0} \u662F {1}\uFF0C\u4E0D\u5728 card.min \u5230 card.max \u4E4B\u95F4\uFF08{2} \u5230 {3}\uFF09",a,l,t[a],o[a]))}for(let a of["resize","bare"])e[a]!==void 0&&typeof e[a]!="boolean"&&r(i("{0} \u8981\u5199\u6210 true \u6216 false",`card.${a}`));return e.fit!==void 0&&!bt.includes(e.fit)&&r(i("card.fit \u53EA\u80FD\u662F fixed \u6216 content")),e.consent!==void 0&&v(e.consent,"card.consent"),{sizes:e.sizes?e.sizes.map(([a,l])=>[a,l]):null,any:d,w:f,h:c,min:t,max:o,resize:e.resize??!1,fit:e.fit??"fixed",bare:e.bare??!1,...e.consent!==void 0?{consent:{zh:e.consent.zh,en:e.consent.en}}:{}}}var Lt=(e,{type:n,options:s})=>({text:typeof e=="string",number:typeof e=="number"&&Number.isFinite(e),select:s?.includes(e),date:typeof e=="string"&&Ot.test(e),switch:typeof e=="boolean",document:typeof e=="string"})[n];function Rt(e,n){if(e===void 0)return[];Array.isArray(e)||r(i("{0} \u8981\u5199\u6210\u4E00\u4E32\u5B57\u6BB5","settings"));let s=[];e.forEach((o,f)=>{let c=`settings[${f}]`;u(o)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868",c)),E(o,gt,`${c}.`),(typeof o.key!="string"||!kt.test(o.key))&&r(i("{0} \u7684 key \u4EE5\u5C0F\u5199\u5B57\u6BCD\u5F00\u5934\uFF0C\u53EA\u7528\u5B57\u6BCD\u548C\u6570\u5B57\uFF08\u5982 city\u3001startDate\uFF09",c)),s.includes(o.key)&&r(i("settings \u91CC key {0} \u5199\u4E86\u4E24\u6B21",o.key)),s.push(o.key),v(o.label,`${c}.label`),re.includes(o.type)||r(i("{0} \u7684 type \u53EA\u80FD\u662F {1}",c,re.join(", "))),o.type==="select"?((!Array.isArray(o.options)||o.options.length===0||!o.options.every(b))&&r(i("{0} \u662F select\uFF0C\u8981\u6709 options\uFF1A\u4E00\u4E32\u6587\u5B57",c)),O(o.options)&&r(i("{0} \u7684 options \u91CC {1} \u5199\u4E86\u4E24\u6B21",c,O(o.options)))):o.options!==void 0&&r(i("{0} \u4E0D\u662F select\uFF0C\u4E0D\u5199 options",c)),o.default!==void 0&&!Lt(o.default,o)&&r(i("{0} \u7684 default \u548C\u5B83\u7684 type {1} \u4E0D\u7B26",c,o.type)),o.required!==void 0&&typeof o.required!="boolean"&&r(i("{0} \u7684 required \u8981\u5199 true \u6216 false",c))});let t=n[$t];return e.length>0&&!(t?.edit==="data"&&F(t.at).every(o=>o==="script")&&F(t.at).length>0)&&r(i('\u5199\u4E86 settings\uFF0Cparts \u91CC\u5C31\u8981\u6709\u4E00\u4E2A\u540D\u4E3A settings\u3001edit \u4E3A data \u7684\u90E8\u5206\uFF0C\u5B83\u662F\u4E00\u4E2A <script type="application/json">\uFF0C\u5B58\u5361\u7247\u8BBE\u7F6E\u7684\u503C')),e.map(o=>({...o}))}function Kt(e){if(e===void 0)return[];Array.isArray(e)||r(i("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","needs"));for(let n of e)typeof n=="string"&&(Et.includes(n)||n.startsWith(te)&&me.test(n.slice(te.length)))||r(i("needs \u91CC\u7684 {0} \u4E0D\u8BA4\u8BC6\uFF1A\u53EA\u8BA4 workspace\u3001tables \u548C net:<\u57DF\u540D>\uFF08\u5C0F\u5199\u7684\u4E3B\u673A\u540D\uFF0C\u4E0D\u5E26\u7AEF\u53E3\u548C\u8DEF\u5F84\uFF0C\u53EF\u4EE5\u4EE5 *. \u5F00\u5934\uFF09",typeof n=="string"?n:JSON.stringify(n)));return O(e)&&r(i("needs \u91CC {0} \u5199\u4E86\u4E24\u6B21",O(e))),[...e]}function Gt(e,n){if(!e.includes("page"))return;let s=Object.entries(n).find(([,t])=>t.edit==="flow");s&&r(i("places \u91CC\u6709 page\uFF0C\u5C31\u4E0D\u80FD\u6709\u63D2\u69FD\uFF1A{0} \u7684 edit \u662F flow\uFF0C\u63D2\u69FD\u653E\u7684\u662F\u6587\u6863\u7684\u5757\uFF0C\u81EA\u5B9A\u4E49\u9875\u4E0A\u6CA1\u6709",`parts.${s[0]}`))}function Vt(e,n){if(e===void 0)return{kit:[],own:[]};(!Array.isArray(e)||!e.every(b))&&r(i("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","assets"));let s=e.filter(t=>!oe.has(t));for(let t of s)Tt.test(t)||r(i("assets \u91CC\u7684 {0} \u65E2\u4E0D\u662F\u5957\u4EF6\u7684\u8D44\u6E90\uFF0C\u4E5F\u4E0D\u662F\u5757\u7684\u6587\u4EF6\u5939\u91CC\u7684\u6587\u4EF6",t)),j(n,t)||r(i("assets \u5199\u4E86 {0}\uFF0C\u5757\u7684\u6587\u4EF6\u5939\u91CC\u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6",t));return{kit:e.filter(t=>oe.has(t)),own:s}}function Ut(e,n,s){let t;try{t=JSON.parse(s)}catch(w){r(i("component.json \u4E0D\u662F JSON\uFF1A{0}",w.message))}u(t)||r(i("component.json \u5199\u7684\u4E0D\u662F\u4E00\u4E2A\u5BF9\u8C61")),A.test(e)||r(i("{0} \u4E0D\u80FD\u505A\u81EA\u5B9A\u4E49\u5757\u7684 id\uFF1A\u8303\u56F4\u548C\u540D\u5B57\u90FD\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",e));for(let w of e.split("/"))at.has(w)&&r(i("{0} \u4E0D\u80FD\u505A\u81EA\u5B9A\u4E49\u5757\u7684 id\uFF1A{1} \u662F Windows \u7559\u7ED9\u8BBE\u5907\u7684\u540D\u5B57",e,w));if(t.id!==e&&r(i("\u6E05\u5355\u7684 id \u662F {0}\uFF0C\u548C\u5B83\u7684\u6587\u4EF6\u5939 {1} \u4E0D\u4E00\u6837",String(t.id),e)),le(t,["apiVersion"]),(!Number.isInteger(t.apiVersion)||t.apiVersion<1)&&r(i("apiVersion \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570")),t.apiVersion!==se)throw ue(i("\u8FD9\u4E2A\u81EA\u5B9A\u4E49\u5757\u8981 apiVersion {0}\uFF0C\u8FD9\u4E00\u7248 Gallery \u53EA\u652F\u6301 {1}",t.apiVersion,se),{disabled:!0,version:b(t.version)?t.version:null});E(t,pt),le(t,["version","name","description","parts"]),b(t.version)||r(i("{0} \u8981\u5199\u6210\u6587\u5B57","version")),v(t.name,"name"),v(t.description,"description"),t.words!==void 0&&typeof t.words!="string"&&r(i("{0} \u8981\u5199\u6210\u6587\u5B57","words")),u(t.parts)||r(i("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","parts"));for(let[w,$]of Object.entries(t.parts))Pt(w,$);let o=Dt(t.runtime,e),{kit:f,own:c}=Vt(t.assets,n);t.markdown!==void 0&&!jt.includes(t.markdown)&&r(i("markdown \u53EA\u80FD\u662F parts \u6216 text")),t.schema!==void 0&&!(Number.isInteger(t.schema)&&t.schema>=1)&&r(i("schema \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570"));let d=Mt(t.places);Gt(d,t.parts);let a=Ft(t.card),l=Rt(t.settings,t.parts),p=Kt(t.needs),h=ye(n,M);return h&&ge(h,M),{id:e,match:Ze(e),parts:Nt(t.parts),...o?{runtime:o}:{},...t.schema!==void 0?{schema:t.schema}:{},apiVersion:t.apiVersion,version:t.version,name:t.name,description:t.description,words:t.words??"",assets:f,markdown:t.markdown??"parts",places:d,card:a,settings:l,needs:p,files:[...new Set([...we.filter(w=>j(n,w)),...c])],template:h&&be(h),folder:n,definition:S(w=>w.update(s)),stamp:W(n,V(c))}}function Wt(e,n){try{let s=ye(n,I);return s||r(i("\u8BFB\u4E0D\u51FA component.json")),_e(s)||r(i("{0} \u4E0D\u662F UTF-8 \u7F16\u7801\uFF1A\u8BF7\u5B58\u6210 UTF-8",I)),ge(s,I),Ut(e,n,be(s))}catch(s){let t=nt(s),o=S(f=>f.update(`${W(n,V([]))} ${JSON.stringify(t)}`));return{id:e.toLowerCase(),stamp:o,problem:t,disabled:s.disabled===!0,version:s.version??null}}}var P=()=>lt().root,Bt=/^[a-z0-9][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)?$/,x=(e,n)=>[...new Set(Array.isArray(e)?e.filter(s=>typeof s=="string"&&n.test(s)):[])],Jt=e=>Object.fromEntries(Object.entries(u(e)?e:{}).filter(([n])=>A.test(n)).map(([n,s])=>[n,x(s,me)]).filter(([,n])=>n.length>0)),Zt=e=>Object.fromEntries(Object.entries(u(e)?e:{}).filter(([n,s])=>he.test(n)&&typeof s?.enabled=="boolean").map(([n,s])=>[n,s.enabled])),C=e=>{let n=Zt(e?.components?.packs);return{hidden:x(e?.components?.hidden,Bt),disabled:x(e?.components?.disabled,A),shown:x(e?.components?.shown,A),unlisted:x(e?.components?.unlisted,A),net:Jt(e?.components?.net),packs:n,packsOff:Object.keys(n).filter(s=>n[s]===!1).sort()}},B=i("gallery.json \u8BFB\u4E0D\u51FA\u6765\uFF1A\u6539\u597D\u8FD9\u4E2A\u6587\u4EF6\u540E\u518D\u8BD5"),qt=i("gallery.json \u4E0D\u662F Gallery \u7684\u6587\u4EF6");function L(e){if(e===null)return{value:null};let{value:n,ours:s,reads:t}=ft(e);return s?{value:n}:{problem:t?qt:B}}function ke(e){try{return L(_(G(e).marker,"utf8"))}catch(n){return n.code==="ENOENT"?L(null):{problem:B}}}var On=(e=P())=>C(ke(e).value),Yt=["EPERM","EACCES","EBUSY","EROFS"];async function $n(e,{id:n,hidden:s,shown:t,disabled:o,unlisted:f,net:c,pack:d,enabled:a}){let l=G(e).marker,p=await Le.readFile(l,"utf8").catch(m=>{if(m.code==="ENOENT")return null;r(B)}),{value:h,problem:w}=L(p);w&&r(w);let $=(m,Y)=>Y===void 0?m:Y?[...new Set([...m,n])]:m.filter(Ie=>Ie!==n),{hidden:Ne,disabled:je,shown:ze,unlisted:Te}=C(h),g=u(h?.components)?h.components:{},Z=$(ze,t),q=$(Te,f),z={...g,hidden:$(Ne,s),disabled:$(je,o),...Z.length>0||Object.hasOwn(g,"shown")?{shown:Z}:{},...q.length>0||Object.hasOwn(g,"unlisted")?{unlisted:q}:{}};if(d!==void 0){let m=u(g.packs)?g.packs:{};z.packs={...m,[d]:{...u(m[d])?m[d]:{},enabled:a===!0}}}if(c!==void 0){let m={...u(g.net)?g.net:{}};c.length>0?m[n]=[...new Set(c)]:delete m[n],Object.keys(m).length>0?z.net=m:delete z.net}await He(l,`${JSON.stringify({...h??ct,components:z},null,2)}
|
|
4
|
+
`,{expect:p}).catch(m=>{throw Yt.includes(m.code)&&r(i("gallery.json \u5199\u4E0D\u8FDB\u53BB\uFF1A\u53EF\u80FD\u662F\u53EA\u8BFB\u7684\uFF0C\u6216\u88AB\u522B\u7684\u7A0B\u5E8F\u5360\u7740")),m})||r(i("gallery.json \u521A\u521A\u88AB\u6539\u8FC7\uFF1A\u518D\u8BD5\u4E00\u6B21"))}var Ht=e=>({...e,off:!0,disabled:!0,problem:i("\u5728\u8BBE\u7F6E\u91CC\u505C\u7528\u4E86"),stamp:S(n=>n.update(`${e.stamp} off`))}),D=C(null),Xt=({packages:e,problems:n,settings:s=D,packs:t=new Map})=>S(o=>{for(let{id:f,stamp:c}of[...e.values(),...n.values()].sort(U))o.update(`${f} ${c}
|
|
5
|
+
`);o.update(`hidden ${[...s.hidden].sort().join(" ")}
|
|
6
|
+
`),o.update(`shown ${[...s.shown].sort().join(" ")}
|
|
7
|
+
`),o.update(`unlisted ${[...s.unlisted??[]].sort().join(" ")}
|
|
8
|
+
`),o.update(`net ${Oe(s).join(" ")}
|
|
9
|
+
`),o.update(`packs off ${(s.packsOff??[]).join(" ")}
|
|
10
|
+
`);for(let[f,c]of[...t].sort(([d],[a])=>d<a?-1:1))o.update(`pack ${f} ${JSON.stringify(c)}
|
|
11
|
+
`);o.update(`settings ${s.problem?.message??""}
|
|
12
|
+
`)}),Oe=({net:e={}})=>Object.entries(e).flatMap(([n,s])=>s.map(t=>`${n}@${t}`)).sort();function Qt(e,n){let{value:s,problem:t}=ke(e);return t?{hidden:n.hidden,disabled:n.disabled,shown:n.shown??[],unlisted:n.unlisted??[],net:n.net??{},packs:n.packs??{},packsOff:n.packsOff??[],problem:t}:C(s)}var R=null,$e=[],En=(e,n=["gallery"])=>{R=e,$e=[...n]};function en(e=P(),n=D,{on:s=null}={}){let t=Qt(e,n),o=new Map,f=new Map,c=dt(e),d=c.map(({id:l})=>l).filter(l=>$e.includes(l.split("/")[0]));if(R&&d.length>0)try{R(e,d)}catch{}for(let{id:l,folder:p}of c){let h=Wt(l,p);(h.problem?f:o).set(h.id,h)}for(let l of o.keys())f.delete(l);for(let l of t.disabled)!o.has(l)||l===s||(f.set(l,Ht(o.get(l))),o.delete(l));let a=tn(e,c.map(({id:l})=>l.split("/")[0]));return{packages:o,problems:f,settings:t,packs:a,stamp:Xt({packages:o,problems:f,settings:t,packs:a})}}function tn(e,n=[]){let{components:s}=G(e),t=[];try{t=Me(s).filter(f=>he.test(f)&&Ce(k.join(s,f,ne)))}catch{}let o=new Map;for(let f of[...new Set([...n,...t])].sort()){let c=null;try{c=f===it?ot.name:rt(_(k.join(s,f,ne),"utf8")).name}catch{}o.set(f,c)}return o}var N=new Map;function Sn(e=P()){let n=k.resolve(e);return N.has(n)||N.set(n,en(n)),N.get(n)}var xn=(e,n)=>{N.set(k.resolve(e),n)},An=(e=P())=>{N.delete(k.resolve(e))},fe=(e,n)=>tt(e,()=>st(n)),J=e=>({zh:fe("zh",e),en:fe("en",e)}),Nn=({settings:e})=>e.problem?J(e.problem):null,Ee=(e,n)=>e.problem?e.disabled?"disabled":"broken":Ye(e.id,n,e.places),Se=({id:e,match:n,parts:s,runtime:t,schema:o,needs:f,card:c})=>({id:e,match:n,parts:s,...t?{runtime:t}:{},...o!==void 0?{schema:o}:{},...f?.length?{needs:f}:{},...c?.consent?{consent:c.consent}:{}}),jn=({packages:e,problems:n})=>[...[...e.values()].map(Se),...[...n.values()].map(({id:s,problem:t})=>({id:s,problem:J(t)}))],nn=e=>`DocKit.describe(${JSON.stringify(e)});`.replace(/</g,"\\u003c"),K=({id:e,stamp:n},s)=>`/__gallery/components/${e}/${s}?v=${n}`;function sn(e){let n=`${Be}="${e.id}"`,s=t=>e.files.includes(t);return{styles:s("style.css")?[`<link rel="stylesheet" href="${K(e,"style.css")}" ${n}>`]:[],scripts:[`<script ${n}>${nn({...Se(e),...s("kit.js")?{script:!0}:{}})}</script>`,...s("kit.js")?[`<script src="${K(e,"kit.js")}" ${n}></script>`]:[]]}}var zn=({folder:e},n)=>j(e,n),Tn=({folder:e,files:n})=>W(e,V(n));function de(e,n){let s=X(e,{sourceCodeLocationInfo:!0}).childNodes.filter(o=>o.tagName||o.nodeName==="#text"&&o.value.trim()),[t]=s;return s.length===1&&t.tagName&&Re(t)&&Xe(t,pe)===n&&t.sourceCodeLocation.endTag?t:null}function on(e,n){let s=de(e,n),t=s&&H(s),o=t&&de(t,n);return o?{markup:t,root:o}:null}function xe({id:e,template:n,parts:s}){if(!n)return{};let t=on(n,e);if(!t)return{problem:i("template.html \u8981\u662F\u8FD9\u4E2A\u81EA\u5B9A\u4E49\u5757\u7684\u4E00\u4E2A\u5B9E\u4F8B\uFF0C\u6709\u81EA\u5DF1\u7684\u7ED3\u675F\u6807\u7B7E\uFF0C\u6B64\u5916\u4EC0\u4E48\u90FD\u6CA1\u6709")};let o=[];if(Qe({childNodes:[t.root]},c=>{qe(c.tagName,c.attrs)&&o.push(c.tagName)}),o.length>0)return{problem:i("template.html \u91CC\u7684 <{0}> \u8FDB\u4E0D\u4E86\u65B0\u5EFA\u7684\u5757\uFF1A\u811A\u672C\u3001\u4E8B\u4EF6\u3001\u6837\u5F0F\u548C Gallery \u81EA\u5DF1\u7684\u6807\u8BB0\u90FD\u4E0D\u5199\u5728\u6A21\u677F\u91CC",o[0])};let f=Object.entries(s).find(([,c])=>{let d=Ue(t.root,c.at).length;return d<(c.optional?0:c.min??1)||d>(c.edit==="flow"?1:c.max??1/0)});return f?{problem:i("template.html \u7684 {0} \u548C\u6E05\u5355\u5199\u7684\u6570\u76EE\u4E0D\u7B26",f[0])}:{markup:t.markup}}var In=e=>xe(e).problem??null,Ae=e=>xe(e).markup??null,vn=({packages:e,settings:n=D,packs:s=new Map})=>[...e.values()].sort(U).map(t=>({id:t.id,version:t.version,name:t.name,description:t.description,words:t.words,definition:t.definition,stamp:t.stamp,template:Ae(t),preview:t.files.includes("preview.svg")?K(t,"preview.svg"):null,state:Ee(t,n),places:t.places,needs:t.needs,settings:t.settings,markdown:t.markdown,assets:t.assets,tags:sn(t),pack:{id:t.id.split("/")[0],name:s.get(t.id.split("/")[0])??null}})),_n=({packages:e,problems:n,settings:s=D})=>[...e.values(),...n.values()].sort(U).map(t=>({id:t.id,pack:t.id.split("/")[0],version:t.version??null,name:t.name??null,description:t.description??null,state:Ee(t,s),reason:t.problem&&!t.off?J(t.problem):null,template:!!Ae(t),places:t.places??null,needs:t.needs??null,hidden:s.hidden.includes(t.id),shown:s.shown.includes(t.id),disabled:s.disabled.includes(t.id),unlisted:(s.unlisted??[]).includes(t.id),allowed:(s.net?.[t.id]??[]).filter(o=>et(t.needs).includes(o)),menu:Je(t.places,{...s,disabled:[],unlisted:[],packsOff:[]},t.id)})),Pn=e=>`settings ${e.hidden.join(",")} ${e.disabled.join(",")} ${e.shown.join(",")} ${Oe(e).join(",")} ${(e.unlisted??[]).join(",")} ${(e.packsOff??[]).join(",")}`;export{$t as a,On as b,$n as c,Xt as d,En as e,en as f,Sn as g,xn as h,An as i,fe as j,Nn as k,jn as l,nn as m,K as n,sn as o,zn as p,Tn as q,on as r,In as s,Ae as t,vn as u,_n as v,Pn as w};
|
|
@@ -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 fe,b as At}from"./chunk-342HXE3Q.mjs";import{c as ue,d as pe}from"./chunk-EAIFITAV.mjs";import{b as ae}from"./chunk-67N2QJYT.mjs";import{a as ie,b as re,c as le,d as ce,f as Dt,g as de,h as he}from"./chunk-PUOQ65NC.mjs";import{b as _t,c as ee,d as oe,f as ne,h as se}from"./chunk-DJISHPUL.mjs";import{b as Wt,j as Qt}from"./chunk-4OZWXZE5.mjs";import{g as te}from"./chunk-HXG7EOPJ.mjs";import{a as Zt}from"./chunk-HYMEEXKN.mjs";import{a as Vt}from"./chunk-UMHUSOPJ.mjs";import{spawnSync as Le}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Ie}from"node:url";import{MATH_IGNORED_TAGS as Fe}from"../browser/shared/components/math.mjs";import{exportPackagesOf as Pe,exportSourceOf as Ve,packagesSaid as _e}from"../browser/shared/export-wrap.mjs";import{sha256 as ge}from"../browser/shared/files.mjs";import{attr as me}from"../browser/shared/html-tree.mjs";import{projectRoot as De,qaDirectory as He,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as Lt,documentFiles as It}from"../browser/shared/workspace.mjs";import{KINDS as Yo,LEVELS as Bt,LOOKS as we,WIDE as Ko,WIDTHS as $e,layoutNotesOf as ze,levelOf as Ee}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ue}from"../browser/shared/table-hides.mjs";var Ge=new Set(["code-scrolls","formula-scrolls"]),qe=(e,n)=>e.level??Ee(e.kind,n),Ye=(e,n)=>["fail","warn"].includes(qe(e,n))||Ge.has(e.kind)&&Ee(e.kind,n)==="info",Ke=4,Ae=12,Xe=8,Je=2,xe=200,Qe=2e3,ye=600;function Ze({block:e,above:n=null,below:s=null}){let l=[e,n,s].filter(Boolean),i=Math.min(...l.map(u=>u.left)),d=Math.max(...l.map(u=>u.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-xe):e.top,f=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+xe):e.bottom,x=(u,A)=>({x:Math.max(0,i),y:Math.max(0,u),width:d-i,height:A-Math.max(0,u)});return e.bottom-e.top<=Qe?[{part:"",clip:x(w,f)}]:[{part:"top",clip:x(w,e.top+ye)},{part:"bottom",clip:x(e.bottom-ye,f)}]}function be(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 Ft=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=Ft(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},to=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function eo(e,n="doc.html"){let s=new Map,l=new Map,i=new Map,d=(x,u)=>(u&&x.sourceCodeLocation.attrs?.[u]||x.sourceCodeLocation).startLine,w=new Map,f=x=>{if(x.nodeName==="#text")return x.value;if(!x.tagName&&x.nodeName!=="#document"||x.tagName==="template")return"";let u=(x.childNodes??[]).map(f).join("");if(!x.tagName||!x.sourceCodeLocation)return u;let A=me(x,"data-block-id");A!==void 0&&!s.has(A)&&s.set(A,d(x,"data-block-id"));let j=me(x,"id");j!==void 0&&!l.has(j)&&l.set(j,d(x,"id"));let K=to(u);if(K.length>=2){let m=`${x.tagName}|${K}`;w.has(m)||w.set(m,[]),w.get(m).push(x.sourceCodeLocation)}return u};f(Zt(e));for(let[x,u]of w)i.set(x,u.sort((A,j)=>A.startOffset-j.startOffset).map(A=>A.startLine));return{blocks:s,ids:l,texts:i,name:n}}function oo(e,n){if(!e)return"the page";let s=n.name??"doc.html",l=u=>{let A=u&&n.texts.get(`${u.tag}|${u.words}`);return A?.[Math.min(u.nth??0,A.length-1)]},i=e.table||e.header?.text,d=e.card?` card ${Mt(e.card.text)}`:i?` table ${Mt(i)}`:"",w=e.blocks?.find(u=>n.blocks.has(u));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${d}`;if(l(e.card))return`${s}:${l(e.card)} card ${Mt(e.card.text)}`;if(l(e.header))return`${s}:${l(e.header)} table ${Mt(i)}`;let f=e.texts?.find(l);if(f)return`${s}:${l(f)} ${f===e.texts[0]&&f.tag===e.tag?"":`${e.element} in `}<${f.tag}> ${Mt(f.text,32)}`;let x=e.ids?.find(u=>n.ids.has(u));return x!==void 0?`${s}:${n.ids.get(x)} #${x}${d}`:l(e.section)?`${s}:${l(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${d} (not found in ${s})`}function Yt(e){let n=new Date(e),s=d=>String(d).padStart(2,"0"),l=-n.getTimezoneOffset(),i=`${l<0?"-":"+"}${s(Math.floor(Math.abs(l)/60))}:${s(Math.abs(l)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${i}`}function no(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 custom block"}, 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 Kt(e,{made:n=!1}={}){let s=It(Lt(e,Rt)).html,l=At(e),[i,d]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(l).catch(()=>null)]);if(!i)return{problem:`${e}: no document (${s})`};if(!d)return{problem:`${e}: no export (${l}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(l),f=w.toString("utf8"),x=Ve(f),u={said:Pe(f),now:_e(te(i.toString("utf8")))},{stale:A,why:j,packaged:K=!1}=no(x,ge(i),u);return A&&!n?{problem:`${e}: ${l} is not of ${s} as it is now (${j}): run gallery export ${e} first`,stale:!0,why:j,edited:!!x&&!K,packaged:K}:{file:l,sha256:ge(w),time:d.mtimeMs}}function so(e,n){let s=e.map((w,f)=>({length:1,weight:n[f],previous:-1})),l=(w,f)=>w.length>f.length||w.length===f.length&&w.weight>f.weight;e.forEach((w,f)=>{for(let x=0;x<f;x++){if(e[x]>=w)continue;let u={length:s[x].length+1,weight:s[x].weight+n[f],previous:x};l(u,s[f])&&(s[f]=u)}});let i=-1;s.forEach((w,f)=>{(i<0||l(w,s[i]))&&(i=f)});let d=[];for(let w=i;w>=0;w=s[w].previous)d.unshift(w);return d}function Be(e,n){let s=n?.places??{},l=new Set((n?.moved??[]).filter(d=>e.has(d))),i=new Map;for(let[d,{parent:w,size:f=0}]of e){let x=s[d];if(x){if(x[0]!==w){l.add(d);continue}i.has(w)||i.set(w,[]),i.get(w).push({id:d,at:x[1],size:f})}}for(let d of i.values()){let w=new Set(so(d.map(({at:f})=>f),d.map(({size:f})=>f)).map(f=>d[f].id));for(let{id:f}of d)w.has(f)||l.add(f)}return l}function ao(e,n,s,{named:l=null,verified:i=!0,failed:d=!1,seen:w=null,page:f=void 0,packages:x=void 0}={}){if(!i||d||l&&!n)return null;let u=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),A=!n,j=A||s.pageChanged?s.cards??[]:[],K=[...n?.unseen??[],...j],m={blocks:{},places:{},moved:A?[]:[...Be(e,n)].filter($=>!u.has($)),unseen:[...new Set(K)].filter($=>e.has($)&&!u.has($))};for(let[$,{hash:Y,parent:X,at:gt}]of e){let N=A||u.has($)?Y:n.blocks[$];N!==void 0&&(m.blocks[$]=N),m.places[$]=[X,gt]}let E=!A&&(l||s.tiles)?n.page:f;typeof E=="string"&&(m.page=E);let z=!A&&(l||s.tiles)?n.packages:x&&Object.fromEntries(Object.entries(x).map(([$,Y])=>[$,(s.restyled?.get($)??[]).every(X=>u.has(X))?Y:n.packages[$]]));return z&&Object.keys(z).length&&(m.packages=z),m}function Oe(e){let n=new Map;for(let s of e){let l=new Set(s.held?.covered??[]);for(let i of s.held?.missed??[])l.has(i)||n.set(i,[...n.get(i)??[],s.label??String(s.width)])}return n}function io(e,n){let s=Oe(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(l=>!s.has(l))])}function Se(e){let n=e.time?` of ${Yt(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 ro=3;function lo(e,n,s=null,{tiles:l=!1,page:i=void 0,packages:d=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},f=[...e.keys()],x=new Map(f.map((a,M)=>[a,M])),u=n?Be(e,n):new Set,A=a=>typeof n?.packages?.[a]=="string"&&typeof d?.[a]=="string"&&n.packages[a]!==d[a],j=n?f.filter(a=>A(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!u.has(a)):[],K=new Map;for(let a of j)K.set(e.get(a).package,[...K.get(e.get(a).package)??[],a]);let m=new Set(j),E=n?f.filter(a=>n.blocks[a]!==e.get(a).hash||u.has(a)||m.has(a)):[],z=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!E.includes(a))),$=(a,M)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)M.has(et)&&(G=et);return G},Y=new Set(E),X=new Set(E.filter(a=>e.get(a).card||u.has(a))),gt=a=>Y.has(a)&&!u.has(a)&&$(a,X)===null,N=new Map;for(let a of f)for(let M=e.get(a).parent;M!==null&&e.has(M);M=e.get(M).parent){let G=N.get(M)??{all:0,changed:0};G.all+=1,gt(a)&&(G.changed+=1),N.set(M,G)}let Q=f.filter(a=>!e.get(a).card&&N.has(a)&&N.get(a).changed>=ro&&N.get(a).changed*2>=N.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),M=new Set(a),G=new Map;for(let o of f){let r=M.has(o)?null:$(o,M);r!==null&&G.set(r,[...G.get(r)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,xt=new Set([...E.filter(o=>e.get(o).card||u.has(o)),...Q]),bt=!n||yt?f.filter(o=>e.get(o).card&&!E.includes(o)):[],Pt=new Set([...xt,...bt]),Nt=[...E,...Q.filter(o=>!Y.has(o))].sort((o,r)=>x.get(o)-x.get(r)).filter(o=>!$t.has(o)&&$(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)&&$(o,Pt)===null).sort((o,r)=>e.get(o).rank-e.get(r).rank||x.get(o)-x.get(r)),since:n?Se(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(E),restyled:K,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(l)return{...w,ids:[],why:null,tiles:!0};let h=(...a)=>(M,G)=>a.reduce((et,$t)=>et||$t(M)-$t(G),0),B=a=>e.get(a).rank,_=a=>x.get(a),tt=n?Se(n):"",C=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,v=f.filter(a=>e.get(a).card&&!E.includes(a)),L=!n||C||E.length===0?v:v.filter(a=>z.has(a)),it=new Set([...E.filter(a=>e.get(a).card||u.has(a)),...Q]),dt=new Set([...it,...L]),Z=new Map,at=(a,M)=>a.filter(G=>{let et=$(G,M);return et!==null&&Z.set(et,[...Z.get(et)??[],G]),et===null}),V=[...at(E,it),...Q.filter(a=>!Y.has(a)&&$(a,it)===null)].sort(h(a=>+!u.has(a),B,_)),pt=V.filter(a=>m.has(a)),lt=V.filter(a=>!m.has(a)),st=at(L,dt).sort(h(a=>+!z.has(a),B,_)),ct="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",y=st.some(a=>z.has(a))?", those no look has pictured yet first":"",D=typeof n?.page=="string"&&typeof i=="string",F=n?C?`${ct.replace("the cards","the cards, not changed themselves")}${y}: the document's own <script> or <style> changed since ${tt}, which may draw any of them`:E.length?"the cards no look has pictured yet (not changed themselves)":`${ct}${y}: no block changed since ${tt}${D?", nor the document's own <script> or <style>":""}`:`${ct}: no earlier look to compare with`,J=[...lt.length?[{kind:"changed",why:`the blocks changed since ${tt}${u.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:lt}]:[],...pt.length?[{kind:"changed",why:`the instances of a custom block changed since ${tt} (${[...new Set(pt.map(a=>e.get(a).package))].join(", ")})`,all:pt}]:[],...st.length||!V.length?[{kind:"cards",why:F,all:st}]:[]],R=Ae;for(let a of J)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=J.flatMap(a=>a.ids),k=a=>{let{parent:M,at:G}=e.get(a),et=$t=>f.find(yt=>e.get(yt).parent===M&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},H=new Map(I.filter(a=>u.has(a)).map(a=>[a,k(a)])),c=new Map(I.filter(a=>Z.has(a)).map(a=>[a,Z.get(a)]));return{...w,ids:I,why:J[0].why,groups:J,rest:J.flatMap(a=>a.rest),moved:new Set(I.filter(a=>u.has(a))),around:H,held:c,cards:L,pageChanged:C,changed:new Set(E),restyled:K}}function co(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),l=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let i=[...document.images].filter(m=>!n(m));i.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let d=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);d.forEach((m,E)=>{m.dataset.qaCard=String(E)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,f=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));f.forEach((m,E)=>{m.dataset.qaTab=String(E)});let x=m=>m.parentElement.parentElement,u=m=>{let E=[];for(let z=m.closest("[data-doc-sheet]");z;z=z.parentElement.closest("[data-doc-sheet]")){let $=f.find(Y=>x(Y)===z.parentElement&&Y.getAttribute("data-sheet-tab")===z.getAttribute("data-doc-sheet"));$&&E.unshift(Number($.dataset.qaTab))}return E},A=f.map((m,E)=>{let z=[...u(x(m)),E],$=[...x(m).children].find(X=>X.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));$&&($.dataset.qaPanel=String(E));let Y=w(m);return{index:E,chain:z,card:Y?Number(Y.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:z.every(X=>f[X].getAttribute("aria-selected")==="true"),panel:!!$}}),j=d.map((m,E)=>{let z=`[href="#${CSS.escape(m.id)}"]`,$=[...m.querySelectorAll("h1, h2, h3, h4")].find(X=>X.textContent.trim())??document.querySelector(z),Y=[];for(let X=w(m);X;X=w(X))Y.unshift(Number(X.dataset.qaCard));return{index:E,chain:u(m),within:Y,label:($?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),K=Promise.all(i.map(m=>m.decode().catch(()=>{})));return Promise.race([K.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:l,images:i.length,loaded:m,sheets:A,cards:j}))}function ke(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 Ht(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 ho({selector:e,up:n=0,margin:s=0,frames:l=2}){let i=document.querySelector(e);for(let v=0;v<n&&i;v++)i=i.parentElement;if(!i||i.getClientRects().length===0)return null;let d=i.getBoundingClientRect();i.scrollIntoView({block:"nearest",inline:"nearest"});let w=i.getBoundingClientRect();if(d.top!==w.top||d.left!==w.left){let v=()=>new Promise(U=>{requestAnimationFrame(()=>U()),setTimeout(U,100)});for(let U=0;U<l;U++)await v()}let f=v=>v===document.body||v===document.documentElement,x=(v,U,L)=>{let{left:it,top:dt,right:Z,bottom:at}=v;for(let V=U;V&&!f(V);V=V.parentElement){let pt=getComputedStyle(V),lt=pt.overflowX!=="visible",st=pt.overflowY!=="visible";if(lt||st){let ct=V.getBoundingClientRect();lt&&([it,Z]=[Math.max(it,ct.left),Math.min(Z,ct.right)]),st&&([dt,at]=[Math.max(dt,ct.top),Math.min(at,ct.bottom)])}if(V===L)break}return Z>it&&at>dt?{left:it,top:dt,right:Z,bottom:at}:null},u=v=>parseFloat(v)||0,A=(v,U)=>{let L=getComputedStyle(v,U);if(["none","normal"].includes(L.content)||L.display==="none"||!["absolute","fixed"].includes(L.position))return null;let it=L.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,dt=it?it.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},Z=it?getComputedStyle(it):null,at={left:dt.left+u(Z?.borderLeftWidth),top:dt.top+u(Z?.borderTopWidth),right:dt.right-u(Z?.borderRightWidth),bottom:dt.bottom-u(Z?.borderBottomWidth)},V=(y,D)=>L.boxSizing==="border-box"?0:u(L[`padding${y}`])+u(L[`padding${D}`])+u(L[`border${y}Width`])+u(L[`border${D}Width`]),pt=u(L.width)+V("Left","Right"),lt=u(L.height)+V("Top","Bottom"),st=L.left!=="auto"?at.left+u(L.left)+u(L.marginLeft):L.right!=="auto"?at.right-u(L.right)-u(L.marginRight)-pt:null,ct=L.top!=="auto"?at.top+u(L.top)+u(L.marginTop):L.bottom!=="auto"?at.bottom-u(L.bottom)-u(L.marginBottom)-lt:null;return st===null||ct===null||!(pt>0)||!(lt>0)?null:x({left:st,top:ct,right:st+pt,bottom:ct+lt},v,i)},j=[i.getBoundingClientRect()],K=[i];for(let v of i.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(K.push(v),j.push(x(v.getBoundingClientRect(),v.parentElement,i)));for(let v of K)j.push(A(v,"::before"),A(v,"::after"));let m=document.createRange(),E=document.createTreeWalker(i,NodeFilter.SHOW_TEXT);for(let v=E.nextNode();v;v=E.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let U of m.getClientRects())j.push(x(U,v.parentElement,i))}m.detach();let z=j.filter(Boolean),$={left:Math.min(...z.map(v=>v.left)),top:Math.min(...z.map(v=>v.top)),right:Math.max(...z.map(v=>v.right)),bottom:Math.max(...z.map(v=>v.bottom))},Y=x($,i.parentElement,null)??$,X=!1;for(let v=i;v&&!X;v=v.parentElement)X=getComputedStyle(v).position==="fixed";let gt=visualViewport.pageLeft,N=visualViewport.pageTop,[Q,h]=X?[gt+innerWidth,N+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],B=Math.max(X?gt:0,Y.left+gt-s),_=Math.max(X?N:0,Y.top+N-s),tt=Math.min(Q,Y.right+gt+s),C=Math.min(h,Y.bottom+N+s);return tt>B&&C>_?{clip:{x:B,y:_,width:tt-B,height:C-_},fixed:X}:null}function ve(e){for(let s of e){let l=document.querySelector(`[data-qa-tab="${s}"]`);l&&l.getAttribute("aria-selected")!=="true"&&l.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function zt({scope:e,next:n,ignored:s=[],place:l,slack:i=4,whole:d=[],drawn:w=[]}){let f=e?document.querySelector(e):document.body,x=[];if(!f)return{found:x,next:n};let u=document.documentElement.clientWidth,A=Math.round,j=t=>String(t??"").replace(/\s+/g," ").trim(),K=(t,o=32)=>{let r=j(t);return`"${r.length>o?`${r.slice(0,o-1)}\u2026`:r}"`},m=t=>!!t.closest?.("[data-doc-dev]"),E=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let r=getComputedStyle(o);if(r.visibility==="hidden"||r.display==="none"||Number(r.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},z=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,$=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),Y=new Map,X=t=>{let o=$(t);if(!Y.has(t.localName)){let b=new Map;for(let O of document.getElementsByTagName(t.localName)){if(m(O))continue;let W=$(O);b.has(W)||b.set(W,[]),b.get(W).push(O)}Y.set(t.localName,b)}let r=Y.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,r),text:j(t.textContent).slice(0,80)}},gt=t=>{let o=t.cloneNode(!0);for(let r of o.querySelectorAll(".doc-tab"))r.before(" \xB7 ");return j(o.textContent).replace(/^· /,"")},N=t=>{let o=t.matches("table")?t:t.querySelector("table"),r=t.closest(".doc-table-wrap")??t,b=r.getAttribute("data-doc-chart-source")?.trim(),W=(b?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===b&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),p=r.previousElementSibling;return j(o?.caption?.textContent)||j(W?.textContent)||(p?.matches("p.doc-note")?gt(p):"")||j(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},Q=t=>{let o=t.nodeType===1?t:t.parentElement,r=[],b=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&r.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&b.push(g.id);let O=[];for(let g=o,T=0;g&&T<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,T++){let ot=X(g);ot.words.length>=2&&O.push(ot)}let W=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),p=o.closest(".doc-table-wrap, table"),S=p?.querySelector("th"),q=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:r,ids:b,texts:O,tag:o.localName,element:z(o),card:W?X(W):null,header:S?X(S):null,table:p?N(p).slice(0,80):null,section:q?X(q):null}};if(l){let t=document.querySelector(l);return{found:x,next:n,anchor:t?Q(t):null}}let h=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),B=(t,o,r,{picture:b=o,url:O,measured:W,scroll:p,level:S}={})=>x.push({kind:t,what:r,anchor:o?Q(o):null,shot:b?h(b):null,seen:!!(b&&E(b)),url:O,measured:W,scroll:p,...S?{level:S}:{}}),_=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,tt=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},C=(t,o,{x:r=!0,y:b=!0}={})=>Math.max(r?o.left-t.left:-1/0,r?t.right-o.right:-1/0,b?o.top-t.top:-1/0,b?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))}),U=t=>{let o=t.getBBox(),r=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(([b,O])=>new DOMPoint(b,O).matrixTransform(r)))},L=t=>{let o=[];for(let r=t.parentElement;r&&r!==document.documentElement;r=r.parentElement){let b=getComputedStyle(r);r instanceof SVGSVGElement&&b.overflow!=="visible"&&o.push(["the svg's edge",r.getBoundingClientRect(),{}]);let O=/url\(\s*["']?#([^)"']+)/.exec(`${r.getAttribute?.("clip-path")??""} ${b.clipPath??""}`)?.[1],W=O?document.getElementById(O):null,p=W?.getAttribute("clipPathUnits")!=="objectBoundingBox"?W?.querySelector("rect"):null;if(p&&r.getScreenCTM){let[S,q,g,T]=["x","y","width","height"].map(ot=>p[ot].baseVal.value);o.push(["a clip-path",v([[S,q],[S+g,q+T]].map(([ot,rt])=>new DOMPoint(ot,rt).matrixTransform(r.getScreenCTM()))),{}])}if(!(r instanceof SVGElement)){let S=/hidden|clip/.test(b.overflowX),q=/hidden|clip/.test(b.overflowY);(S||q)&&o.push([z(r),r.getBoundingClientRect(),{x:S,y:q}])}}return o},it=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,dt=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||E(t)&&tt(t));for(let t of f.querySelectorAll("[data-doc-chart]"))m(t)||!E(t)||[...t.children].some(dt)||B("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:_(t)});let Z=[...f.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!E(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},V=new Map;for(let t of Z){let o=_(t),r=o.getBoundingClientRect(),b=[],O=[],W=[...t.querySelectorAll("text")].filter(q=>!q.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(q.textContent)&&E(q));for(let q of W){let g=U(q),T=L(q).map(([ot,rt,ut])=>[ot,C(g,rt,ut)]).find(([,ot])=>ot>1.5);T?b.push(`${K(q.textContent,24)} ${A(T[1])}px past ${T[0]}`):C(g,r)>1.5&&O.push(`${K(q.textContent,24)} ${A(C(g,r))}px past the card's edge`)}b.length&&B("chart-text-clipped",t,it(b),{picture:o}),O.length&&B("chart-text-outside",t,it(O),{picture:o});let p=q=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(q.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=q=>q.every(Number.isFinite)&&q[1]!==q[0]&&q.slice(2).every((g,T)=>Math.abs(g-q[T+1]-(q[1]-q[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let q of t.querySelectorAll("g")){let g=[...q.children].filter(P=>P.matches("g.tick")&&E(P)),T=g.map(P=>P.querySelector("text")).filter(P=>P&&j(P.textContent)&&E(P)),ot=T.map(P=>j(P.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(p)))continue;let rt=T.map(P=>{let kt=P.getScreenCTM(),je=(parseFloat(getComputedStyle(P).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:P,box:U(P),size:je,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(rt.some(P=>P.turned||!(P.size>0)))continue;let ut=rt.map(({box:P})=>[(P.left+P.right)/2,(P.top+P.bottom)/2]),nt=Math.max(...ut.map(([P])=>P))-Math.min(...ut.map(([P])=>P))>=Math.max(...ut.map(([,P])=>P))-Math.min(...ut.map(([,P])=>P)),mt=({box:P,size:kt})=>nt?[P.left,P.right]:[(P.top+P.bottom-kt)/2,(P.top+P.bottom+kt)/2],St=[...rt].sort((P,kt)=>mt(P)[0]-mt(kt)[0]),wt=null;for(let P=1;P<St.length;P++){let kt=mt(St[P])[0]-mt(St[P-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[P-1],St[P]]})}let Ct=Math.max(...rt.map(P=>P.size));if(!wt||wt.gap>=at[nt?"across":"down"]*Ct)continue;for(let{label:P}of rt)V.set(P,q);let[Ot,qt]=wt.pair.map(({label:P})=>K(P.textContent,16)),We=wt.gap<0?`${Ot} and ${qt} overlapping by ${A(-wt.gap)}px`:`${Ot} and ${qt} ${A(wt.gap)}px apart`;B("ticks",t,`${ot.length} tick labels ${nt?"across":"down"} a ${A(nt?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${We}, under ${nt?"a digit's width and a hair":"a quarter of a line"} at their ${A(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let pt=t=>{let o=t.getBBox(),r=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,b=o.y+Math.max(0,(o.height-r)/2),O=b+Math.min(o.height,r),W=t.getScreenCTM();return[[o.x,b],[o.x+o.width,b],[o.x+o.width,O],[o.x,O]].map(([p,S])=>new DOMPoint(p,S).matrixTransform(W))},lt=(t,o)=>{let r=1/0;for(let b of[t,o])for(let O=0;O<b.length;O++){let W=b[O],p=b[(O+1)%b.length],S=Math.hypot(p.x-W.x,p.y-W.y);if(S===0)continue;let q={x:-(p.y-W.y)/S,y:(p.x-W.x)/S},g=ut=>ut.map(nt=>nt.x*q.x+nt.y*q.y),[T,ot]=[g(t),g(o)],rt=Math.min(Math.max(...T),Math.max(...ot))-Math.max(Math.min(...T),Math.min(...ot));if(rt<=0)return 0;r=Math.min(r,rt)}return r===1/0?0:r},st=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(o.textContent)&&E(o));for(let t of Z){let o=st(t).map(b=>({label:b,outline:pt(b)})),r=[];o.forEach(({label:b,outline:O},W)=>{for(let p of o.slice(W+1))V.has(b)&&V.get(b)===V.get(p.label)||lt(O,p.outline)>1.5&&r.push(`${K(b.textContent,20)} and ${K(p.label.textContent,20)} overlap`)}),r.length&&B("chart-text-overlap",t,it(r),{picture:_(t)})}let ct=11;for(let t of Z){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let O of st(t)){let W=O.getScreenCTM(),p=parseFloat(getComputedStyle(O).fontSize);if(!W||!(p>0))continue;let S=p*Math.hypot(W.c,W.d);S<ct-.05&&o.push(`${K(O.textContent,24)} at ${S.toFixed(1)}px (font-size ${+p.toFixed(2)})`)}if(!o.length)continue;let r=t.viewBox.baseVal,b=`${o.length} text${o.length>1?"s":""}`;B("svg-text-small",t,`${b} of a drawing scaled by its viewBox (${+r.width.toFixed(2)}\xD7${+r.height.toFixed(2)} drawn ${A(t.getBoundingClientRect().width)}px wide) render below ${ct}px: ${it(o)}`,{picture:_(t)})}let y=new Set;for(let t of f.querySelectorAll(".doc-table-wrap")){if(m(t)||!E(t))continue;y.add(t);let o=t.querySelector("table");if(!o)continue;let r=Math.max(t.clientWidth,o.offsetWidth),b=Math.max(t.clientHeight,o.offsetHeight),O=r>t.clientWidth+i,W=b>t.clientHeight+i,p=N(t);(O||W)&&B("table-scrolls",t,[O&&`${r}px wide in a ${t.clientWidth}px frame`,W&&`${b}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:O,down:W,name:p}});let S=globalThis.__qaTableHides(t,o);S.said&&B("table-columns",t,`${S.said}: the table is ${r}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&B("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 D=t=>!!t.closest("details[data-qa-closed]"),F="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of f.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!E(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&E(o)){let b=D(t);if(o.scrollHeight>o.clientHeight+i){let O=[t,o].map(q=>q.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),W=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,p=[...o.querySelectorAll(".doc-code-line")].filter(q=>q.getClientRects().length>0&&q.getBoundingClientRect().top>=W-1).length,S=b?`, ${F} inside it for the rest`:O?`, the block's own height (--doc-code-height: ${O}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";B("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${p?` (its last ${p} line${p===1?"":"s"} below it)`:""}${S}`,{level:b||O?"info":void 0})}if(o.scrollWidth>o.clientWidth+i){let O=t.classList.contains("doc-code--nowrap"),W=b?`, ${F} sideways for the rest`:O?", 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";B("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${W}`,{level:b||O?"info":void 0})}}let r=t.querySelector(":scope > .doc-code-title");r&&E(r)&&r.scrollWidth>r.clientWidth+1&&B("code-title-cut",t,`its title ${K(r.textContent,48)} is cut to fit its header (${r.scrollWidth}px of words in ${r.clientWidth}px)`)}for(let t of f.querySelectorAll(".doc-math-block")){if(m(t)||!E(t)||t.scrollWidth<=t.clientWidth+i)continue;let o=D(t);B("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${F} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of f.querySelectorAll("[data-doc-layout]"))m(t)||!E(t)||B("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:y.has(t)});let J=document.createTreeWalker(f,NodeFilter.SHOW_TEXT),R=new Map;for(let t=J.nextNode();t;t=J.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!E(o))continue;let r=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(r)||R.set(r,t.nodeValue)}for(let[t,o]of R){let r=o.search(/\\\(|\\\[|\$\$/);B("raw-formula",t,`${K(o.slice(r,r+40),40)} is shown as written: the kit's math did not render it`)}for(let t of f.querySelectorAll(".katex-error"))m(t)||!E(t)||B("formula-error",t,`${K(t.textContent,32)}: ${j(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,k=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},H=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(r=>r[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(k),c=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>H(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let r=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,b=c.find(W=>r?!a.has(W)&&W.address.startsWith(r):W.address===t);b&&r&&a.add(b);let O=b?.node??null;e&&!(O&&f.contains(O))||B("blocked",O,`${o} blocked ${I(b?.address??t)}${O?` (${z(O)})`:""}: the export holds every file it shows`,{url:b?.address??t})}for(let t of f.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?k(t.currentSrc||t.src):"";B("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let M=new Set(d),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(r=>r.startsWith("doc-"))),xt=(t,o,r)=>{let b=[],O=!1;for(let W=t,p=!0;W&&W!==document.body&&W!==document.documentElement;W=W.parentElement,p=!1){let S=getComputedStyle(W);if((!p||r)&&(O&&(S.position!=="static"||S.transform!=="none")&&(O=!1),!O)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(W,o)&&b.push(W)}if(S.position==="fixed")break;S.position==="absolute"&&(O=!0)}return b},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Pt=t=>{let o=getComputedStyle(t),r=b=>!/^(transparent|rgba\(.*,\s*0\))$/.test(b);return r(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(b=>parseFloat(o[`border${b}Width`])>0&&o[`border${b}Style`]!=="none"&&r(o[`border${b}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let r=new Map,b=(p,S,q,g)=>{if(!r.has(p)&&r.size>=3)return;let T=r.get(p)??{words:[],marks:[],depth:0,height:p.getBoundingClientRect().height};q&&T.words.push(q),g&&T.marks.push(g),T.depth=Math.max(T.depth,S),r.set(p,T)},O=p=>p.getBoundingClientRect().height>1.5,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||o(S))continue;let q=xt(S,t,!0).filter(O);if(q.length===0)continue;let g=getComputedStyle(S),T=parseFloat(g.lineHeight);for(let ot of p.nodeValue.matchAll(/\S+/g)){let rt=ot.index+ot[0].length;et.setStart(p,ot.index),et.setEnd(p,rt);let ut=[...et.getClientRects()];for(let nt of ut){let mt=Number.isFinite(T)?Math.max(0,(nt.height-T)/2):0,St=q.find(Ct=>nt.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 Ot=rt-1;wt<Ot;){let qt=wt+Ot>>1;et.setStart(p,qt),et.setEnd(p,qt+1),(et.getClientRects()[0]?.bottom??0)>Ct?Ot=qt:wt=qt+1}}b(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),p.nodeValue.slice(wt,rt),null);break}}}for(let p of t.querySelectorAll("*")){let S=p instanceof SVGElement&&p.matches(Nt)&&!p.closest("defs, clipPath, mask, pattern, marker, symbol"),q=!S&&!(p instanceof SVGElement)&&!p.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&p.children.length===0&&!p.textContent.trim()&&Pt(p);if(!S&&!q||!E(p))continue;let g=p.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let T=S?p.ownerSVGElement:null,ot=[...T&&getComputedStyle(T).overflowY!=="visible"?[T]:[],...xt(T??p,t,!!T)].filter(O),rt=nt=>{let mt=nt.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(nt=>g.bottom-bt(nt)>1.5&&rt(nt));ut&&b(ut,g.bottom-bt(ut),null,S?p.localName:z(p))}return r};for(let t of f.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),r=G.has(o);if(!r&&!M.has(o)||m(t)||!E(t))continue;let b=p=>p.closest(".doc-chart-message")||p.closest("h2, h3, h4, p, figcaption")?.parentElement===t,O=new Map,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p&&O.size<3;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||r&&b(S))continue;let q=S;for(;q!==t&&["inline","contents"].includes(getComputedStyle(q).display);)q=q.parentElement;let g=!1;for(let nt=S;nt&&!g;nt=nt===t?null:nt.parentElement){let mt=getComputedStyle(nt);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let T=getComputedStyle(q),ot=q.getBoundingClientRect(),rt=ot.left+parseFloat(T.borderLeftWidth)+parseFloat(T.paddingLeft),ut=ot.right-parseFloat(T.borderRightWidth)-parseFloat(T.paddingRight);for(let nt of p.nodeValue.matchAll(/\S+/g)){et.setStart(p,nt.index),et.setEnd(p,nt.index+nt[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,rt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>u+1))continue;let wt=O.get(q)??{words:[],reach:0,width:ut-rt};wt.words.push(nt[0]),wt.reach=Math.max(wt.reach,St),O.set(q,wt)}}for(let[p,{words:S,reach:q,width:g}]of O)B("overflow-in-block",p,`the words ${K(S.join(" "),40)} run ${A(q)}px past the side of ${z(p)} (${A(g)}px wide for its words), over what is beside it`,{picture:t});for(let[p,{words:S,marks:q,depth:g,height:T}]of Tt(t,r?b:()=>!1)){let ot=[S.length&&`the words ${K(S.join(" "),40)}`,q.length&&`${q.length===1?"a mark":`${q.length} marks`} (${[...new Set(q)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),rt=S.length===0&&q.length===1;B("cut-in-block",p,`${ot} ${rt?"reaches":"reach"} ${A(g)}px past the bottom of ${z(p)} (${A(T)}px tall, its overflow ${getComputedStyle(p).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>u+1){let t=g=>{for(let T=g.parentElement;T&&T!==document.body;T=T.parentElement)if(getComputedStyle(T).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...f.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>u+1&&E(g)&&t(g)),r=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),b=`the page is ${document.documentElement.scrollWidth}px wide in a ${u}px window`,O=new Set(o),W=g=>{for(let T=g.parentElement;T;T=T.parentElement)if(O.has(T))return!0;return!1},p=new Map,S=document.createRange(),q=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);for(let g=q.nextNode();g&&p.size<3;g=q.nextNode()){let T=g.parentElement;if(!T||!g.nodeValue.trim()||T.closest("svg, script, style, template")||m(T)||W(g)||!E(T)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(nt=>nt.right>u+1)))continue;let ot=T.closest("[data-block-id]")??T;if(p.has(ot))continue;let rt=[],ut=0;for(let nt of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,nt.index),S.setEnd(g,nt.index+nt[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=u+1||(rt.push(nt[0]),ut=Math.max(ut,mt))}rt.length&&p.set(ot,{node:T,words:rt.join(" "),right:ut})}S.detach(),r.length===0&&p.size===0&&!e&&B("overflow",null,b);for(let g of r)B("overflow",g,`${b}: ${z(g)} ${K(g.textContent,24)} reaches ${A(g.getBoundingClientRect().right)}px`);for(let[g,{node:T,words:ot,right:rt}]of p)B("overflow",T,`${b}: the words ${K(ot,60)} in ${z(g)} run past its edge to ${A(rt)}px (a text that cannot break)`,{picture:g})}return{found:x,next:n}}function fo(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(l=>!e(l)).length;return{charts:n("[data-doc-chart], [data-doc-component='gallery/chart-view']"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Et=2e4,Me=1800;function jt(e,n,s){let l=0,i=new Promise((d,w)=>{l=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,i]).finally(()=>clearTimeout(l))}var Xt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function uo(e,n,s,{out:l,tiles:i=!1,blocks:d=[],around:w=new Map,held:f=new Map,whole:x=[],drawn:u=[],known:A=null}){let{width:j,height:K=900,label:m=String(j)}=typeof s=="number"?{width:s}:s,E=m.replace("\xD7","x"),z,$;try{z=await jt(e.createBrowserContext(),Et,"a browser context opened"),$=await jt(z.newPage(),Et,"a tab opened")}catch(y){return await Dt(z?.close()),{findings:[{kind:"unverified",what:`the browser did not open a page: ${y.message}`,anchor:null,shot:null,seen:!1,state:""}],counts:null,pictures:[],held:{covered:[],missed:[]}}}$.setDefaultTimeout(Et);let Y=[],X=[],gt=new Set,N=new Map,Q=new Set,h=new Set,B=new Set,_="",tt=0,C=(y,D,F={})=>Y.push({kind:y,what:D,anchor:null,shot:null,seen:!1,state:_,...F}),v=Ie(n).href,U=y=>`"${be(y,v)}"`,L=y=>l.folders?.get(y)??l.blocks,it=y=>y.replace(/[^\w-]/g,"_");$.on("pageerror",y=>C("error",`uncaught ${Ft(y.message).slice(0,200)}`)),$.on("console",y=>{y.type()==="error"&&le(y,v)&&C("error",`console: ${Ft(y.text()).slice(0,200)}`)}),$.on("requestfailed",y=>{y.frame()===$.mainFrame()&&C("request",`${U(y.url())}: ${y.failure()?.errorText??"failed"}`,{url:y.url()})}),$.on("response",y=>{y.status()>=400&&y.request().frame()===$.mainFrame()&&C("request",`${U(y.url())}: HTTP ${y.status()}`,{url:y.url()})}),await ce($),await $.evaluateOnNewDocument(`globalThis.__qaUrlName = ${be}; globalThis.__qaTableHides = ${Ue()};`),await $.setViewport({width:j,height:K}),await $.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let dt=async y=>{for(let D of await he($,{timeout:Et}))C("unverified",`${y}: waited for ${D}`)},Z=async(y,D,F,J)=>jt($.screenshot({path:F,clip:y,captureBeyondViewport:!D}),Et,"the picture").then(()=>!0,R=>(C("unverified",`no picture of ${J} (${R.message})`),!1)),at=async(y,D,F,J=0)=>{let R=await $.evaluate(ho,{selector:y,up:J,margin:Xe,frames:Je}).catch(I=>({error:I}));return R?.clip?await Z(R.clip,R.fixed,D,F)?R.clip:null:(C("unverified",`no picture of ${F} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},V=(y,D)=>y.left<D.x+D.width&&y.right>D.x&&y.top<D.y+D.height&&y.bottom>D.y,pt=async()=>{let y=d.filter(F=>!Q.has(F)),D=await $.evaluate((F,J,R)=>{let I=new Map(F.map((M,G)=>[M,G])),k=M=>!!M&&!M.closest("[data-doc-dev], dialog:not([open])")&&M.getClientRects().length>0,H=M=>M===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===M&&k(G))??null,c=M=>{if(!M)return null;let G=M.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let M of document.querySelectorAll("[data-block-id]")){let G=I.get(M.getAttribute("data-block-id"));if(G===void 0||!k(M))continue;I.delete(M.getAttribute("data-block-id")),M.setAttribute("data-qa-block",String(G));let[et,$t]=J[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...M.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&k(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:J[G]?{block:c(M),above:c(H(et)),below:c(H($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:c(bt)}))})}return a},y,y.map(F=>w.get(F)??null),y.map(F=>f.get(F)??[]));for(let{index:F,boxes:J,held:R}of D){let I=y[F];Q.add(I);let k=`${E}-${it(I)}`,H=[];if(!J){let c=ht.join(L(I),`${k}.png`),a=await at(`[data-qa-block="${F}"]`,c,`the block ${I}`);a&&(X.push({block:I,file:c}),H.push(a))}for(let{part:c,clip:a}of J?Ze(J):[]){let M=ht.join(L(I),`${k}${c?`-${c}`:""}.png`);await Z(a,!1,M,`the block ${I}${c?` (its ${c})`:""}`)&&(X.push({block:I,file:M}),H.push(a))}for(let{id:c,box:a}of R)H.some(M=>V(a,M))?h.add(c):h.has(c)||B.add(c);await $.evaluate(c=>document.querySelector(`[data-qa-block="${c}"]`)?.removeAttribute("data-qa-block"),F)}},lt=async(y,D,F)=>{let J=[...f].filter(([I])=>Q.has(I)).map(([I,k])=>[I,k.filter(H=>!h.has(H))]).filter(([,I])=>I.length);if(!J.length)return;let R=await $.evaluate((I,k)=>{let H=document.querySelector(I);if(!H)return[];let c=a=>[...H.querySelectorAll("[data-block-id]")].some(M=>M.getAttribute("data-block-id")===a&&M.getClientRects().length>0);return k.map(([a,M])=>[a,M.filter(c)]).filter(([,a])=>a.length)},y,J);for(let[I,k]of R){let H=ht.join(L(I),`${E}-${it(I)}-${D}.png`);if(await at(y,H,`the block ${I} (${D})`,F)){X.push({block:I,part:D,file:H});for(let c of k)h.add(c),B.delete(c)}}},st=async y=>{let D=await $.evaluate(zt,{scope:y,next:tt,ignored:Fe,slack:Ke,whole:x,drawn:u});tt=D.next;let F=D.found.flatMap(R=>R.kind!=="layout"?[R]:ze(R.what,j).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:k})=>({...R,kind:I,what:`the kit notes ${k}`})));for(let R of F){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,k=I&&N.get(I);if(k)!k.seen&&R.seen&&Object.assign(k,R,{state:_});else{let H={...R,state:_};Y.push(H),I&&N.set(I,H)}}let J=new Set(Y.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of Y){if(R.shot===null||!R.seen||gt.has(R.shot)||!Ye(R,j)||A?.has(Xt(R))||["request","image"].includes(R.kind)&&J.has(R.url))continue;gt.add(R.shot);let I=ht.join(l.flagged,`${E}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&X.push({shot:R.shot,file:I})}d.length&&await pt()},ct=y=>{let D=new Set(Y.filter(J=>J.kind==="blocked").map(J=>J.url));return{findings:Y.filter(J=>!(["request","image"].includes(J.kind)&&D.has(J.url))&&!A?.has(Xt(J))),counts:y,pictures:X,held:{covered:[...h],missed:[...B]}}};try{try{let k=new Promise(c=>$.once("domcontentloaded",c)),H=$.goto(v,{waitUntil:"load",timeout:6e4});if(H.catch(()=>{}),await Promise.race([k,H]),$.url()!==v)throw new Error(`the browser shows ${$.url()}`)}catch(k){return C("unverified",`the page did not load: ${k.message}`),ct(null)}await dt("the page as it opens");let y=await $.evaluate(co,Et);y.loaded||C("unverified",`the pictures (${y.images}) not all loaded in ${Et/1e3}s`),y.closed&&await dt(`the page with its ${y.closed} closed disclosure${y.closed===1?"":"s"} opened`),await st(null);let D=async(k,H,c,a=null)=>{for(let M=k,G=1;M<H;M+=Me,G++){let et=ht.join(l.tiles,`${E}-${c}${String(G).padStart(2,"0")}.png`);await jt($.screenshot({path:et,clip:{x:0,y:M,width:j,height:Math.min(Me,H-M)},captureBeyondViewport:!0}),Et,"a tile").then(()=>X.push({tile:!0,sheet:a,file:et}),$t=>C("unverified",`no tile ${c}${G} (${$t.message})`))}};i&&await D(0,await $.evaluate(()=>document.documentElement.scrollHeight),"");let F=async(k,H=null)=>{if(!await $.evaluate(ve,k.chain)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:`[data-qa-tab="${k.index}"]`});return C("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:c}),!1}if(await dt("the Sheet shown"),await st(`[data-qa-panel="${k.index}"]`),await lt(`[data-qa-panel="${k.index}"]`,`sheet${k.index+1}`,1),i&&H)await J(H,`sheet${k.index+1}-`);else if(i){let c=await $.evaluate(a=>{let M=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return M&&M.height>0?{top:Math.max(0,M.top+scrollY),bottom:M.bottom+scrollY}:null},k.index);c&&await D(c.top,c.bottom,`sheet${k.index+1}-`,{number:k.index+1,label:k.label})}return!0},J=async(k,H="")=>{for(let c=1;c<=20;c++){let a=await $.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}},k.index,c===1);if(!a)break;let M=ht.join(l.tiles,`${E}-card${k.index+1}-${H}${String(c).padStart(2,"0")}.png`);await Z(a,!0,M,`the detail card ${Mt(k.label,24)}, tile ${H}${c}`)&&X.push({tile:!0,card:{number:k.index+1,label:k.label,part:H},file:M})}},R=0;for(let k of y.sheets)k.shown||!k.panel||k.card!==null||(_=`Sheet ${Mt(k.label,24)}`,await F(k)&&(R+=1));let I=0;for(let k of y.cards){_=`detail card ${Mt(k.label,24)}`;let H=`[data-qa-card="${k.index}"]`;k.chain.length&&await $.evaluate(ve,k.chain);for(let c of k.within)await $.evaluate(ke,c);if(!await $.evaluate(ke,k.index)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:H});C("unverified","this detail card could not be opened",{anchor:c});for(let a of k.within.toReversed())await $.evaluate(Ht,a);continue}I+=1,await dt("the detail card opened"),await st(H),await lt(H,`card${k.index+1}`,0),i&&await J(k);for(let c of y.sheets)c.card!==k.index||c.shown||!c.panel||(_=`detail card ${Mt(k.label,24)}, Sheet ${Mt(c.label,24)}`,await F(c,k)&&(R+=1));await $.evaluate(Ht,k.index);for(let c of k.within.toReversed())await $.evaluate(Ht,c)}return _="",ct({...await $.evaluate(fo),details:y.details,closed:y.closed,sheets:R,cards:y.cards.length,cardsOpened:I})}catch(y){return C("unverified",`the look ended early: ${y.message}`),ct(null)}finally{await Dt(z.close())}}var Jt=e=>e.split(ht.sep).join("/"),ft=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ut=e=>`${e.join(", ")}px`,po=e=>e.includes("\xD7")?e:`${e}px`;function go({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`${ft(e,"disclosure")} (${s})`}function Re(e,n=null){let s=new Map;for(let l of e){let i=n?ht.relative(n,l):"",d=Jt(n&&i&&!i.startsWith("..")&&!ht.isAbsolute(i)?i:l),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(d),f=w?`${w[1]??""}\0${w[3]}`:d;s.has(f)||s.set(f,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:d});let x=s.get(f);w&&!x.looks.includes(w[2])&&x.looks.push(w[2])}return[...s.values()].map(l=>l.whole??`${l.head}${l.looks.length>1?`{${l.looks.join(",")}}`:l.looks[0]}-${l.tail}`)}function mo(e){let n=e.map(({folder:l,files:i})=>({folder:l,files:[...new Set(i)]})).filter(({files:l})=>l.length);if(!n.length)return null;let s=n.reduce((l,{files:i})=>l+i.length,0);return`Not opened yet: ${ft(s,"picture")} of this run, none looked at for you; open each, and in the handoff name those you opened: ${n.flatMap(({folder:l,files:i})=>Re(i,l).map(d=>ht.isAbsolute(d)?d:`${Jt(l)}/${d}`)).join(", ")}`}var Te=(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)`,nn=Te(),Ne=fe,Ce='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.',wo=e=>Ft(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),Gt={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"},$o='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 xo(e){if(e.kind!=="code-scrolls")return Gt[e.kind]?[Gt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(l=>/ wide, its frame /.test(l));return[...!s||n.some(l=>/ tall, its frame /.test(l))?[Gt["code-scrolls"]]:[],...s?[$o]:[]]}var yo="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)",bo="a reader scrolls it: not a problem";function So(e,n,s=null,{folder:l=null,slug:i="<slug>"}={}){let d=[],w=Object.fromEntries(Bt.map(h=>[h,0])),f=new Map,x=new Set,u=new Map,A=[],j=h=>Re(h,l),K=h=>h.label??String(h.width),m=new Map(e.flatMap(h=>h.pictures.filter(B=>B.shot!==void 0).map(B=>[`${K(h)}|${B.shot}`,B.file])));for(let h of e){let{width:B,findings:_,counts:tt}=h,C=K(h),v=new Set,U=Object.fromEntries(Bt.map(V=>[V,0])),L={right:0,down:0,all:0};for(let V of _){let pt=`${V.kind}|${V.shot??""}|${V.what}`;if(v.has(pt))continue;v.add(pt);let lt=qe(V,B);U[lt]+=1;let st=oo(V.anchor,n);if(V.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:k=""}=V.scroll??{};Object.assign(L,{all:L.all+1,right:L.right+Number(R),down:L.down+Number(I)});let H=`${st}|${k}`;u.has(H)||u.set(H,{place:st,name:k,right:[],down:[]}),R&&!u.get(H).right.includes(C)&&u.get(H).right.push(C),I&&!u.get(H).down.includes(C)&&u.get(H).down.push(C)}if(lt==="info"&&x.add(`${V.kind}|${st}`),lt==="info"&&["table-scrolls","table-columns","table-rows"].includes(V.kind))continue;let ct=`${Bt.indexOf(lt)}|${V.kind}|${st}`;f.has(ct)||(f.set(ct,{level:lt,kind:V.kind,place:st,said:new Map}),lt!=="info"&&(w[lt]+=1));let y=f.get(ct).said,D=`${V.state?`[${V.state}] `:""}${V.what}`;y.has(D)||y.set(D,{labels:[],pictures:[]});let F=y.get(D);F.labels.includes(C)||F.labels.push(C);let J=m.get(`${C}|${V.shot}`);J&&!F.pictures.includes(J)&&F.pictures.push(J)}let it=[L.right&&`\u2192 ${L.right}`,L.down&&`\u2193 ${L.down}`].filter(Boolean).join(", "),dt=`${ft(L.all,"table scrolls","tables scroll")}${it?` (${it})`:""}`,Z=tt?.cards?`, ${ft(tt.cards,"detail card")} (${tt.cardsOpened===tt.cards?"closed in the file, opened in turn":`${tt.cardsOpened??0} of them opened`})`:"",at=h.laptop?"; only what the 1024px look did not find":tt?`; ${ft(tt.charts,"chart")}, ${ft(tt.tables,"table")}, ${go(tt)}, ${ft(tt.sheets,"Sheet")} shown besides the first${Z}, page ${tt.height}px tall`:"";A.push({label:C,fail:U.fail,warn:U.warn,line:`${h.laptop?C:`${C.padStart(4)}px`} fail ${U.fail} \xB7 warn ${U.warn} \xB7 unverified ${U.unverified} \xB7 ${dt}${at}`})}let E=[...f.values()].sort((h,B)=>Bt.indexOf(h.level)-Bt.indexOf(B.level)),z=e.flatMap(h=>h.pictures);if(l&&z.length&&d.push(`Pictures of this run in ${Jt(l)}/ (each path below is in it):`),s){let h=new Map;for(let C of z)C.block!==void 0&&h.set(C.block,[...h.get(C.block)??[],C.file]);let B=Oe(e),_=C=>`${s.tags?.get(C)?`${s.tags.get(C)} `:""}${C}`,tt=`at ${$e.slice(0,-1).join(", ")} and ${$e.at(-1)}px`;s.tiles&&s.why&&d.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let C of s.groups??[]){if(!C.ids.length&&!C.rest.length)continue;let v=!C.ids.length&&s.groups.some(U=>U!==C&&U.ids.length)?`: none this run (the ${Ae} blocks a run pictures went to the changed blocks above)`:"";d.push(`${C.why[0].toUpperCase()}${C.why.slice(1)}${C.ids.length?`, ${tt}`:v}:`);for(let U of C.ids){let L=n.blocks.get(U),it=`${L?`${n.name??"doc.html"}:${L}`:`(not in ${n.name??"doc.html"})`} ${U}${s.tags?.get(U)?` ${s.tags.get(U)}`:""}`,dt=h.get(U)??[],Z=s.moved?.has(U)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(U)??[],V=at.filter(F=>s.changed?.has(F)).length,pt=C.kind==="named"?ft(at.length,"block"):[V&&ft(V,"changed block"),at.length-V&&ft(at.length-V,"card")].filter(Boolean).join(" and "),lt=z.some(F=>F.block===U&&F.part)?", pictured again with each Sheet panel or detail card that holds one":"",st=at.filter(F=>B.has(F)),ct=[...new Set(st.flatMap(F=>B.get(F)))].map(F=>F.includes("\xD7")?F:`${F}px`).join(", "),y=st.length?`; ${st.length} of them not pictured at ${ct}: gallery qa ${i} --blocks ${st.join(",")}`:"",D=at.length?` (with the ${pt} it holds${lt}${y})`:"";d.push(dt.length?` ${it}${Z}${D}: ${j(dt).join(", ")}`:` ${it}${Z}${D}: not shown at any width (hidden)`)}if(C.rest.length){let U=ft(C.rest.length,{changed:"changed block",cards:"card"}[C.kind]??"block"),L=`${C.rest.slice(0,6).map(_).join(", ")}${C.rest.length>6?", \u2026":""}`;d.push(` ${C.ids.length?"and ":""}${U}${C.ids.length?" more":""}, not pictured (${L}): gallery qa ${i} --blocks ${C.rest.join(",")}`)}}s.unknown.length&&d.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let $=[];for(let h of E)for(let{pictures:B}of h.said.values())$.push(...B.filter(_=>!$.includes(_)));$.length&&d.push("The elements flagged below, look at these first:",...j($).map(h=>` ${h}`));let Y=z.filter(h=>h.tile),X=Y.filter(h=>!h.sheet&&!h.card);X.length&&d.push(`The page as it opens (each Sheet area with the panel it shows first): ${ft(X.length,"tile")} in ${j([ht.dirname(X[0].file)])[0]}/ (<width>-<n>.png)`);let gt=new Map;for(let{sheet:h}of Y)h&>.set(h.number,{...h,count:(gt.get(h.number)?.count??0)+1});gt.size&&d.push(`Each other Sheet panel, shown in turn: ${ft(Y.filter(h=>h.sheet).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...gt.values()].map(({number:h,label:B,count:_})=>`sheet${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);let N=new Map;for(let{card:h}of Y)h&&N.set(h.number,{...h,count:(N.get(h.number)?.count??0)+1});N.size&&d.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${ft(Y.filter(h=>h.card).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.card).file)])[0]}/ (<width>-card<i>-<n>.png${Y.some(h=>h.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...N.values()].map(({number:h,label:B,count:_})=>`card${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);for(let{place:h,name:B,right:_,down:tt}of u.values()){let C=/^(?:doc|report)\.html:\d+/.exec(h)?.[0]??h;d.push(`${"INFO".padEnd(10)} table-scrolls: ${C}${B?` ${Mt(B,32)}`:""}: ${[_.length&&`\u2192 ${Ut(_)}`,tt.length&&`\u2193 ${Ut(tt)}`].filter(Boolean).join("; ")} (${bo})`)}for(let h of E){d.push(`${h.level.toUpperCase().padEnd(10)} ${h.kind}: ${h.place}`);for(let[B,{labels:_,pictures:tt}]of h.said)d.push(` ${Ut(_)}: ${B}${tt.length?` (${j(tt).join(", ")})`:""}`);for(let B of xo(h))d.push(` ${B}`)}d.push(...A.map(({line:h})=>h));let Q=ko(s,i);return Q&&d.push(Q),w.info=x.size,{lines:d,levels:w,looks:A.map(({label:h,fail:B,warn:_})=>({label:h,fail:B,warn:_}))}}function ko(e,n="<slug>"){let{changed:s=[],restyled:l=[],packages:i=[],cards:d=[],since:w="the last look",first:f=!1}=e?.left??{};if(!s.length&&!l.length&&!d.length)return null;let x=A=>`${A.slice(0,6).map(j=>`${e.tags?.get(j)?`${e.tags.get(j)} `:""}${j}`).join(", ")}${A.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${ft(s.length,"block")} changed or moved since ${w} (${x(s)})`,l.length&&`${ft(l.length,"instance")} of a custom block changed since ${w}, ${i.join(", ")} (${x(l)})`,d.length&&(f?`no earlier look: ${ft(d.length,"card")} never pictured (${x(d)})`:`${ft(d.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${x(d)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function vo(e,n,s=[],{unpictured:l=!1}={}){let i=n.map(({label:A,fail:j,warn:K})=>`${po(A)} fail ${j}, warn ${K}`).join("; "),d=i?` (${i})`:"",w=Te(s.length===1?s[0].slug:void 0),f={stale:"its file had changed since its export",missing:"it had none yet"},x=s.filter(({first:A})=>A).map(({slug:A,first:j})=>`${s.length>1?`${A} was`:"It was"} exported first by this run (${f[j]}).`),u=`${x.length?`. ${x.join(" ")}`:""}${s.map(({file:A})=>`
|
|
3
|
+
${Ne}${A}`).join("")}`;if(e.fail)return`failures at ${ft(e.fail,"place")}${d}: fix them in the document's doc.html (report.html in an older document), then run this again (it exports first); ${w}${u}`;if(e.unverified)return`nothing failed${d}; not verified at ${ft(e.unverified,"place")}: say so when you hand the document over; ${w}${u}`;if(e.warn)return`nothing failed${d}; warnings at ${ft(e.warn,"place")} to look at, ${yo}; ${w}${u}`;if(l){let A=s.length===1?s[0].slug:"<slug>";return`nothing found${d}, 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 ${A} --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 ${A} --blocks <id,\u2026> pictures the blocks you name${u}`}return`nothing found${d}: open the pictures above and look at the document once yourself; ${w}${u}`}function Mo(e,{missing:n=!1,edited:s=!1,packaged:l=!1}={}){let i=At(e),d=ht.basename(It(Lt(e,Rt)).html);return`exporting first: ${n?`no export yet (${i})`:s?`${d} changed since the last export (${i})`:l?`a custom block it uses changed since the last export (${i})`:`the last export (${i}) does not say which text it was made from (an older Gallery's)`}, as gallery export ${e} does (--no-export: refuse instead)`}async function Co(e){for(let[i,{missing:d,edited:w,packaged:f}]of e)console.log(`${i}: ${Mo(i,{missing:d,edited:w,packaged:f})}`);let n=new Map(await Promise.all(e.map(async([i])=>[i,await vt.stat(At(i)).then(d=>d.mtimeMs,()=>null)]))),s=Le(process.execPath,[ht.join(De,"bin","gallery.mjs"),"export",...e.map(([i])=>i)],{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 l=[];for(let[i]of e){let d=await vt.stat(At(i)).then(w=>w.mtimeMs,()=>null);d!==null&&d!==n.get(i)&&!(await Kt(i,{made:!0})).problem&&l.push(i)}return l}var Eo=e=>String(e??"").split(/[\s,]+/).filter(Boolean);function qo(e,n){let s=_t(e);return[...new Set(n)].filter(l=>!s.has(l))}var Ao=(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 sn(e){let{slugs:n,options:s,values:l}=await Qt({options:["--tiles","--no-export"],values:["--blocks"],argv:e}),i=l.has("--blocks")?Eo(l.get("--blocks")):null;if(i?.length===0)throw new Wt("--blocks takes block ids: --blocks <id,\u2026>");if(i&&n.length!==1)throw new Wt("--blocks names blocks of one document: name one.");let d=new Map,w=[];for(let N of n){let Q=await Kt(N);Q.problem&&!((Q.stale||Q.missing)&&!s.has("--no-export"))&&w.push(Q.problem),d.set(N,Q)}if(w.length&&(console.error(w.join(`
|
|
4
|
+
`)),process.exit(2)),i){let N=It(Lt(n[0],Rt)).html,Q=qo(Vt(await vt.readFile(N,"utf8").catch(()=>"")),i);if(Q.length)throw new Wt(Ao(ht.resolve(N),Q))}await ae(n),await ue(n),await pe(n);let f=[...d].filter(([,N])=>N.stale||N.missing),x=new Map(f.map(([N,Q])=>[N,Q.missing?"missing":"stale"]));if(f.length){let N=await Co(f),Q=f.map(([h])=>h).filter(h=>!N.includes(h));for(let h of N)d.set(h,await Kt(h,{made:!0}));Q.length&&(console.error(`${Q.join(", ")}: the export failed (above), so nothing was looked at: fix what it says, then run this again`),process.exit(1))}let u=d,A=[...u].map(([N,{file:Q}])=>({slug:N,file:Q,first:x.get(N)??null})),j=(N,Q)=>{for(let[h,{sha256:B,time:_}]of u)console.log(`${h}: ${At(h)} sha256 ${B}, exported ${Yt(_)}`);console.log(`UNVERIFIED ${N}: nothing was looked at. ${Q}`);for(let{file:h}of A)console.log(`${Ne}${h}`);process.exit(3)},K=ie();K||j("no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)",`Install Chrome or Edge, or ${Ce}`);let m=await de({executablePath:K,args:re()}).catch(N=>j(`the browser ${K} did not start, twice, each time with a fresh profile (${wo(N)}; GALLERY_BROWSER=<its executable> picks another)`,`Run gallery qa once more; if it says UNVERIFIED again, ${Ce}`)),{browser:E}=m,z=Object.fromEntries(Bt.map(N=>[N,0])),$=new Map,Y=!1,X=[];try{for(let[N,{file:Q,sha256:h,time:B}]of u){let _=ht.join(He,N),tt=ht.join(_,"blocks.json");console.log(`${N}: ${At(N)} sha256 ${h}, exported ${Yt(B)} (${ht.basename(K)}, headless)`);let C=It(Lt(N,Rt)).html,v=Vt(await vt.readFile(C,"utf8")),U=_t(v),L=se(U,ne(await vt.readFile(tt,"utf8").catch(()=>null))),it=ee(v),dt=oe(v),Z=lo(U,L,i,{tiles:s.has("--tiles")&&!i,page:it,packages:dt}),at=s.has("--tiles")||!!Z.tiles;(at||Z.ids.length)&&(Y=!0);let V={flagged:ht.join(_,"flagged"),blocks:ht.join(_,i?"blocks":"changed"),tiles:ht.join(_,"tiles")},pt=ht.join(_,"cards");V.folders=new Map(Z.groups.flatMap(c=>c.ids.map(a=>[a,c.kind==="cards"?pt:V.blocks])));let lt=[V.flagged,...i?[V.blocks]:Z.tiles?[]:[V.blocks,pt],...at?[V.tiles]:[]],st=(await Promise.all(lt.map(async c=>[c,(await vt.readdir(c).catch(()=>[])).filter(a=>a.endsWith(".png")).length]))).filter(([,c])=>c>0);st.length&&console.log(`The pictures of the run before in ${st.map(([c])=>`${ht.basename(c)}/`).join(", ")} (${ft(st.reduce((c,[,a])=>c+a,0),"file")}) were removed: this run's replace them.`);for(let c of lt)await vt.rm(c,{recursive:!0,force:!0});for(let c of await vt.readdir(_).catch(()=>[]))c.endsWith(".png")&&await vt.rm(ht.join(_,c),{force:!0});for(let c of lt)await vt.mkdir(c,{recursive:!0});let ct=[...U].filter(([,{whole:c}])=>c).map(([c])=>c),y=[...U].filter(([,{figure:c}])=>c).map(([c])=>c),D=[],F=null;for(let c of we){let a=await uo(E,Q,c,{out:V,tiles:at&&!c.laptop,blocks:c.laptop?[]:Z.ids,around:Z.around,held:c.laptop?new Map:Z.held,whole:ct,drawn:y,known:c.laptop?F:null});D.push({...c,...a}),a.pictures.length&&(Y=!0),X.push({folder:_,files:a.pictures.map(({file:M})=>M)}),!c.laptop&&c.width===we.find(M=>M.laptop)?.width&&(F=new Set(a.findings.map(Xt)))}let{lines:J,levels:R,looks:I}=So(D,eo(v,ht.basename(C)),{...Z,tags:new Map([...U].map(([c,{tag:a}])=>[c,a]))},{folder:_,slug:N});console.log(J.join(`
|
|
5
|
+
`));for(let c of Bt)z[c]+=R[c];for(let{label:c,fail:a,warn:M}of I){let G=$.get(c)??{label:c,fail:0,warn:0};$.set(c,{label:c,fail:G.fail+a,warn:G.warn+M})}let k=D.every(c=>c.counts&&!c.findings.some(a=>a.kind==="unverified")),H=ao(U,L,Z,{named:i,verified:k,failed:R.fail>0,seen:io(Z,D),page:it,packages:dt})??L;H&&await vt.writeFile(tt,`${JSON.stringify(H)}
|
|
6
|
+
`)}}finally{await m.close()}let gt=mo([...Map.groupBy(X,({folder:N})=>N)].map(([N,Q])=>({folder:N,files:Q.flatMap(({files:h})=>h)})));gt&&console.log(gt),console.log(vo(z,[...$.values()],A,{unpictured:!Y})),process.exitCode=z.fail?1:z.unverified?3:0}export{Yo as a,Bt as b,we as c,Ko as d,$e as e,ze as f,Ee as g,Ge as h,qe as i,Ye as j,Ke as k,Ae as l,Xe as m,Je as n,xe as o,Qe as p,ye as q,Ze as r,be as s,to as t,eo as u,oo as v,Yt as w,no as x,Kt as y,Be as z,ao as A,Oe as B,io as C,Se as D,ro as E,lo as F,ho as G,fo as H,Xt as I,uo as J,go as K,Re as L,mo as M,Te as N,nn as O,Ne as P,Ce as Q,wo as R,Gt as S,$o as T,xo as U,yo as V,bo as W,So as X,ko as Y,vo as Z,Mo as _,Eo as $,qo as aa,Ao as ba,sn as ca};
|