@heycys/gallery 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (785) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/THIRD-PARTY-NOTICES.md +3253 -0
  4. package/assets/writing-preferences.md +107 -0
  5. package/bin/gallery.mjs +10 -0
  6. package/browser/editor/components/bookmark/icons.mjs +6 -0
  7. package/browser/editor/components/bookmark/index.mjs +80 -0
  8. package/browser/editor/components/bookmark/page.mjs +147 -0
  9. package/browser/editor/components/builders.mjs +19 -0
  10. package/browser/editor/components/callout/index.mjs +39 -0
  11. package/browser/editor/components/callout/page.mjs +13 -0
  12. package/browser/editor/components/code/index.mjs +327 -0
  13. package/browser/editor/components/code/page.mjs +561 -0
  14. package/browser/editor/components/colors.mjs +50 -0
  15. package/browser/editor/components/columns/index.mjs +104 -0
  16. package/browser/editor/components/columns/page.mjs +297 -0
  17. package/browser/editor/components/details/index.mjs +72 -0
  18. package/browser/editor/components/details/page.mjs +86 -0
  19. package/browser/editor/components/dialog/index.mjs +83 -0
  20. package/browser/editor/components/dialog/page.mjs +219 -0
  21. package/browser/editor/components/divider/index.mjs +48 -0
  22. package/browser/editor/components/embed/icons.mjs +11 -0
  23. package/browser/editor/components/embed/index.mjs +123 -0
  24. package/browser/editor/components/embed/page.mjs +309 -0
  25. package/browser/editor/components/figure/index.mjs +87 -0
  26. package/browser/editor/components/figure/page.mjs +33 -0
  27. package/browser/editor/components/file/icons.mjs +14 -0
  28. package/browser/editor/components/file/index.mjs +77 -0
  29. package/browser/editor/components/file/page.mjs +114 -0
  30. package/browser/editor/components/flowchart/add.mjs +123 -0
  31. package/browser/editor/components/flowchart/index.mjs +246 -0
  32. package/browser/editor/components/flowchart/page.mjs +453 -0
  33. package/browser/editor/components/heading/index.mjs +51 -0
  34. package/browser/editor/components/highlight/index.mjs +79 -0
  35. package/browser/editor/components/icon/index.mjs +57 -0
  36. package/browser/editor/components/icon/page.mjs +286 -0
  37. package/browser/editor/components/icons.mjs +45 -0
  38. package/browser/editor/components/image/crop.mjs +189 -0
  39. package/browser/editor/components/image/index.mjs +104 -0
  40. package/browser/editor/components/image/page.mjs +385 -0
  41. package/browser/editor/components/image/viewer.mjs +213 -0
  42. package/browser/editor/components/installed/index.mjs +133 -0
  43. package/browser/editor/components/installed/page.mjs +422 -0
  44. package/browser/editor/components/installed/served.mjs +35 -0
  45. package/browser/editor/components/kit.mjs +64 -0
  46. package/browser/editor/components/list/index.mjs +194 -0
  47. package/browser/editor/components/list/join.mjs +68 -0
  48. package/browser/editor/components/list/numbers.mjs +107 -0
  49. package/browser/editor/components/list/page.mjs +632 -0
  50. package/browser/editor/components/math/index.mjs +88 -0
  51. package/browser/editor/components/math/page.mjs +236 -0
  52. package/browser/editor/components/math/tex-logo.mjs +6 -0
  53. package/browser/editor/components/media/icons.mjs +19 -0
  54. package/browser/editor/components/media/page.mjs +162 -0
  55. package/browser/editor/components/media/parts.mjs +60 -0
  56. package/browser/editor/components/media/size.mjs +20 -0
  57. package/browser/editor/components/media/toolbar.mjs +37 -0
  58. package/browser/editor/components/media/write.mjs +7 -0
  59. package/browser/editor/components/pages.mjs +46 -0
  60. package/browser/editor/components/paragraph/index.mjs +43 -0
  61. package/browser/editor/components/paragraph/page.mjs +52 -0
  62. package/browser/editor/components/placeholder-bar.mjs +17 -0
  63. package/browser/editor/components/placeholder.mjs +128 -0
  64. package/browser/editor/components/quote/index.mjs +33 -0
  65. package/browser/editor/components/registry.mjs +833 -0
  66. package/browser/editor/components/rows.mjs +16 -0
  67. package/browser/editor/components/section/index.mjs +41 -0
  68. package/browser/editor/components/section/page.mjs +141 -0
  69. package/browser/editor/components/sheets/index.mjs +137 -0
  70. package/browser/editor/components/sheets/page.mjs +227 -0
  71. package/browser/editor/components/sheets/pills.mjs +226 -0
  72. package/browser/editor/components/table/grid.mjs +73 -0
  73. package/browser/editor/components/table/index.mjs +306 -0
  74. package/browser/editor/components/table/page.mjs +672 -0
  75. package/browser/editor/components/table/slots.mjs +41 -0
  76. package/browser/editor/components/widget/index.mjs +50 -0
  77. package/browser/editor/page/annotate/anchors.mjs +229 -0
  78. package/browser/editor/page/annotate/card.mjs +102 -0
  79. package/browser/editor/page/annotate/index.mjs +1629 -0
  80. package/browser/editor/page/at-menu/index.mjs +317 -0
  81. package/browser/editor/page/autosave.mjs +977 -0
  82. package/browser/editor/page/beside.mjs +21 -0
  83. package/browser/editor/page/block-info.mjs +63 -0
  84. package/browser/editor/page/block-menu/colors.mjs +82 -0
  85. package/browser/editor/page/block-menu/index.mjs +215 -0
  86. package/browser/editor/page/blocks.mjs +246 -0
  87. package/browser/editor/page/caret.mjs +679 -0
  88. package/browser/editor/page/chip-fills.mjs +126 -0
  89. package/browser/editor/page/clipboard/import/colors.mjs +192 -0
  90. package/browser/editor/page/clipboard/import/html.mjs +792 -0
  91. package/browser/editor/page/clipboard/import/inline.mjs +232 -0
  92. package/browser/editor/page/clipboard/import/languages.mjs +42 -0
  93. package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
  94. package/browser/editor/page/clipboard/import/math.mjs +100 -0
  95. package/browser/editor/page/clipboard/import/office.mjs +245 -0
  96. package/browser/editor/page/clipboard/import/read.mjs +120 -0
  97. package/browser/editor/page/clipboard/import/rich.mjs +29 -0
  98. package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
  99. package/browser/editor/page/clipboard/index.mjs +797 -0
  100. package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
  101. package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
  102. package/browser/editor/page/clipboard/own/describe.mjs +115 -0
  103. package/browser/editor/page/clipboard/own/export.mjs +167 -0
  104. package/browser/editor/page/clipboard/own/ids.mjs +39 -0
  105. package/browser/editor/page/clipboard/own/index.mjs +13 -0
  106. package/browser/editor/page/clipboard/own/rules.mjs +44 -0
  107. package/browser/editor/page/clipboard/own/selection.mjs +159 -0
  108. package/browser/editor/page/clipboard/own/writers.mjs +326 -0
  109. package/browser/editor/page/columns/index.mjs +360 -0
  110. package/browser/editor/page/commit.mjs +1798 -0
  111. package/browser/editor/page/conflicts.mjs +269 -0
  112. package/browser/editor/page/convert.mjs +830 -0
  113. package/browser/editor/page/core.mjs +1655 -0
  114. package/browser/editor/page/drag/drop.mjs +307 -0
  115. package/browser/editor/page/drag/index.mjs +335 -0
  116. package/browser/editor/page/drag/preview.mjs +121 -0
  117. package/browser/editor/page/edge-scroll.mjs +50 -0
  118. package/browser/editor/page/editor.mjs +1725 -0
  119. package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
  120. package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
  121. package/browser/editor/page/emoji-picker/grid.mjs +79 -0
  122. package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
  123. package/browser/editor/page/emoji-picker/icons.mjs +32 -0
  124. package/browser/editor/page/emoji-picker/index.mjs +164 -0
  125. package/browser/editor/page/emoji-picker/styles.mjs +2 -0
  126. package/browser/editor/page/emoji-picker/support.mjs +202 -0
  127. package/browser/editor/page/emoji-picker/upload.mjs +235 -0
  128. package/browser/editor/page/export-report.mjs +23 -0
  129. package/browser/editor/page/fills.mjs +60 -0
  130. package/browser/editor/page/find/index.mjs +107 -0
  131. package/browser/editor/page/flags.mjs +70 -0
  132. package/browser/editor/page/format-bar/bar.mjs +448 -0
  133. package/browser/editor/page/format-bar/brush.mjs +77 -0
  134. package/browser/editor/page/format-bar/colors.mjs +46 -0
  135. package/browser/editor/page/format-bar/index.mjs +404 -0
  136. package/browser/editor/page/formula/index.mjs +236 -0
  137. package/browser/editor/page/formula/panel.mjs +336 -0
  138. package/browser/editor/page/formula/symbols.mjs +156 -0
  139. package/browser/editor/page/frame.mjs +74 -0
  140. package/browser/editor/page/frames.mjs +196 -0
  141. package/browser/editor/page/geometry.mjs +400 -0
  142. package/browser/editor/page/gesture.mjs +45 -0
  143. package/browser/editor/page/handle/index.mjs +639 -0
  144. package/browser/editor/page/handle-sizes.mjs +14 -0
  145. package/browser/editor/page/hints/index.mjs +84 -0
  146. package/browser/editor/page/history.mjs +401 -0
  147. package/browser/editor/page/insert/index.mjs +243 -0
  148. package/browser/editor/page/kept.mjs +38 -0
  149. package/browser/editor/page/links/address.mjs +40 -0
  150. package/browser/editor/page/links/index.mjs +866 -0
  151. package/browser/editor/page/links/pages.mjs +131 -0
  152. package/browser/editor/page/links/views.mjs +369 -0
  153. package/browser/editor/page/look.mjs +65 -0
  154. package/browser/editor/page/made.mjs +24 -0
  155. package/browser/editor/page/margin.mjs +352 -0
  156. package/browser/editor/page/markdown/index.mjs +88 -0
  157. package/browser/editor/page/markdown/rules.mjs +33 -0
  158. package/browser/editor/page/marks.mjs +377 -0
  159. package/browser/editor/page/media-menu/index.mjs +158 -0
  160. package/browser/editor/page/menu.mjs +500 -0
  161. package/browser/editor/page/merge.mjs +100 -0
  162. package/browser/editor/page/notices.mjs +142 -0
  163. package/browser/editor/page/offered.mjs +32 -0
  164. package/browser/editor/page/outline/folds.mjs +52 -0
  165. package/browser/editor/page/outline/index.mjs +697 -0
  166. package/browser/editor/page/outline/list.mjs +172 -0
  167. package/browser/editor/page/outline/read.mjs +201 -0
  168. package/browser/editor/page/outline/strip.mjs +281 -0
  169. package/browser/editor/page/outline/tree.mjs +248 -0
  170. package/browser/editor/page/overlay-layer.mjs +227 -0
  171. package/browser/editor/page/overlays.mjs +205 -0
  172. package/browser/editor/page/own.mjs +28 -0
  173. package/browser/editor/page/pads.mjs +71 -0
  174. package/browser/editor/page/page-objects.mjs +105 -0
  175. package/browser/editor/page/panel.mjs +64 -0
  176. package/browser/editor/page/placement.mjs +58 -0
  177. package/browser/editor/page/post.mjs +41 -0
  178. package/browser/editor/page/present-links.mjs +50 -0
  179. package/browser/editor/page/quiet.mjs +48 -0
  180. package/browser/editor/page/resize/index.mjs +327 -0
  181. package/browser/editor/page/select-all/index.mjs +262 -0
  182. package/browser/editor/page/selection/delete.mjs +59 -0
  183. package/browser/editor/page/selection/index.mjs +157 -0
  184. package/browser/editor/page/selection/marquee.mjs +174 -0
  185. package/browser/editor/page/session.mjs +117 -0
  186. package/browser/editor/page/slash-menu/index.mjs +291 -0
  187. package/browser/editor/page/storage.mjs +48 -0
  188. package/browser/editor/page/sync-state.mjs +267 -0
  189. package/browser/editor/page/table/aligns.mjs +29 -0
  190. package/browser/editor/page/table/cell-bar.mjs +138 -0
  191. package/browser/editor/page/table/cells.mjs +527 -0
  192. package/browser/editor/page/table/icons.mjs +40 -0
  193. package/browser/editor/page/table/index.mjs +985 -0
  194. package/browser/editor/page/table/lists.mjs +187 -0
  195. package/browser/editor/page/table/widths.mjs +308 -0
  196. package/browser/editor/page/tex.mjs +32 -0
  197. package/browser/editor/page/text-select/index.mjs +656 -0
  198. package/browser/editor/page/tooltip.mjs +98 -0
  199. package/browser/editor/page/type-grid.mjs +82 -0
  200. package/browser/editor/page/typing/code-edges.mjs +228 -0
  201. package/browser/editor/page/typing/index.mjs +276 -0
  202. package/browser/editor/page/typing/leave.mjs +68 -0
  203. package/browser/editor/page/ui.mjs +160 -0
  204. package/browser/shared/annotations.mjs +571 -0
  205. package/browser/shared/code-folds.mjs +10 -0
  206. package/browser/shared/code-languages.mjs +70 -0
  207. package/browser/shared/code-lines.mjs +30 -0
  208. package/browser/shared/colors.mjs +28 -0
  209. package/browser/shared/component-catalog.mjs +559 -0
  210. package/browser/shared/components/bookmark.mjs +26 -0
  211. package/browser/shared/components/callout.mjs +7 -0
  212. package/browser/shared/components/chart.mjs +20 -0
  213. package/browser/shared/components/code.mjs +37 -0
  214. package/browser/shared/components/columns.mjs +16 -0
  215. package/browser/shared/components/details.mjs +15 -0
  216. package/browser/shared/components/dialog.mjs +28 -0
  217. package/browser/shared/components/diff.mjs +18 -0
  218. package/browser/shared/components/divider.mjs +6 -0
  219. package/browser/shared/components/embed.mjs +25 -0
  220. package/browser/shared/components/figure.mjs +14 -0
  221. package/browser/shared/components/file.mjs +23 -0
  222. package/browser/shared/components/heading.mjs +6 -0
  223. package/browser/shared/components/highlight.mjs +9 -0
  224. package/browser/shared/components/icon.mjs +18 -0
  225. package/browser/shared/components/image.mjs +39 -0
  226. package/browser/shared/components/index.mjs +342 -0
  227. package/browser/shared/components/installed.mjs +162 -0
  228. package/browser/shared/components/list.mjs +146 -0
  229. package/browser/shared/components/math.mjs +49 -0
  230. package/browser/shared/components/mention.mjs +33 -0
  231. package/browser/shared/components/page.mjs +37 -0
  232. package/browser/shared/components/paragraph.mjs +9 -0
  233. package/browser/shared/components/quote.mjs +6 -0
  234. package/browser/shared/components/section.mjs +8 -0
  235. package/browser/shared/components/sheets.mjs +80 -0
  236. package/browser/shared/components/state.mjs +20 -0
  237. package/browser/shared/components/table.mjs +49 -0
  238. package/browser/shared/components/text.mjs +14 -0
  239. package/browser/shared/components/widget.mjs +10 -0
  240. package/browser/shared/copy-ids.mjs +72 -0
  241. package/browser/shared/css-references.mjs +110 -0
  242. package/browser/shared/emoji/custom.mjs +91 -0
  243. package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
  244. package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
  245. package/browser/shared/emoji/data/README.md +26 -0
  246. package/browser/shared/emoji/data/categories.json +1 -0
  247. package/browser/shared/emoji/data/icons.json +1 -0
  248. package/browser/shared/emoji/data/keywords-en.json +1 -0
  249. package/browser/shared/emoji/data/keywords-zh.json +1 -0
  250. package/browser/shared/emoji/data/names.json +1 -0
  251. package/browser/shared/emoji/data/positions.json +1 -0
  252. package/browser/shared/emoji/data/twemoji-index.json +1 -0
  253. package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
  254. package/browser/shared/emoji/data.mjs +196 -0
  255. package/browser/shared/emoji/emoji.mjs +37 -0
  256. package/browser/shared/emoji/glyphs.mjs +134 -0
  257. package/browser/shared/emoji/icon-value.mjs +90 -0
  258. package/browser/shared/escape.mjs +20 -0
  259. package/browser/shared/export-wrap.mjs +89 -0
  260. package/browser/shared/files.mjs +33 -0
  261. package/browser/shared/html-tree.mjs +53 -0
  262. package/browser/shared/http.mjs +22 -0
  263. package/browser/shared/i18n/en.mjs +1164 -0
  264. package/browser/shared/i18n/index.mjs +132 -0
  265. package/browser/shared/ids.mjs +24 -0
  266. package/browser/shared/import-types.mjs +23 -0
  267. package/browser/shared/inline-spacing.mjs +97 -0
  268. package/browser/shared/layers.mjs +42 -0
  269. package/browser/shared/media.mjs +162 -0
  270. package/browser/shared/new-names.mjs +64 -0
  271. package/browser/shared/number-reading.mjs +92 -0
  272. package/browser/shared/old-names.mjs +143 -0
  273. package/browser/shared/page-address.mjs +140 -0
  274. package/browser/shared/page-links.mjs +86 -0
  275. package/browser/shared/paths.mjs +73 -0
  276. package/browser/shared/preferences.mjs +110 -0
  277. package/browser/shared/preview-server.mjs +247 -0
  278. package/browser/shared/qa-levels.mjs +93 -0
  279. package/browser/shared/reading-place.mjs +91 -0
  280. package/browser/shared/renamed-storage.mjs +220 -0
  281. package/browser/shared/reports.mjs +46 -0
  282. package/browser/shared/search.mjs +85 -0
  283. package/browser/shared/session.mjs +76 -0
  284. package/browser/shared/table-chart.mjs +113 -0
  285. package/browser/shared/table-hides.mjs +120 -0
  286. package/browser/shared/table-slots.mjs +75 -0
  287. package/browser/shared/words.mjs +23 -0
  288. package/browser/shared/workspace.mjs +535 -0
  289. package/browser/shared/writing-preferences.mjs +68 -0
  290. package/browser/shared/zoom.mjs +57 -0
  291. package/dist/chunk-2B5E4CDJ.mjs +2 -0
  292. package/dist/chunk-2PBALTR3.mjs +57 -0
  293. package/dist/chunk-342HXE3Q.mjs +2 -0
  294. package/dist/chunk-3LA3EMDE.mjs +15 -0
  295. package/dist/chunk-43B75J5T.mjs +2 -0
  296. package/dist/chunk-4K5KC6V2.mjs +2 -0
  297. package/dist/chunk-5FRMCDPY.mjs +16 -0
  298. package/dist/chunk-5L7RYZCL.mjs +2 -0
  299. package/dist/chunk-5LEK2CBS.mjs +2 -0
  300. package/dist/chunk-5OFN5AHC.mjs +2 -0
  301. package/dist/chunk-5SIYS5HN.mjs +2 -0
  302. package/dist/chunk-5TEK3RAD.mjs +2 -0
  303. package/dist/chunk-6CYG3Z4V.mjs +2 -0
  304. package/dist/chunk-6U2SLSDN.mjs +3 -0
  305. package/dist/chunk-742D2WWJ.mjs +19 -0
  306. package/dist/chunk-7GHT2UCA.mjs +15 -0
  307. package/dist/chunk-7QQBR7PB.mjs +2 -0
  308. package/dist/chunk-A55HN5OK.mjs +2 -0
  309. package/dist/chunk-ACOPDCNB.mjs +2 -0
  310. package/dist/chunk-AGDILNWB.mjs +2 -0
  311. package/dist/chunk-ATCJYAR4.mjs +2 -0
  312. package/dist/chunk-B3VTYBYR.mjs +960 -0
  313. package/dist/chunk-C564NU2H.mjs +77 -0
  314. package/dist/chunk-C7HWOBIF.mjs +2 -0
  315. package/dist/chunk-DB4WKGYF.mjs +7 -0
  316. package/dist/chunk-E7VYDG2X.mjs +2 -0
  317. package/dist/chunk-EUX7IC5J.mjs +48 -0
  318. package/dist/chunk-EVJ3BX3M.mjs +2 -0
  319. package/dist/chunk-EZY3WC6Z.mjs +15 -0
  320. package/dist/chunk-FQGQH4KM.mjs +2 -0
  321. package/dist/chunk-G7TOXONE.mjs +6 -0
  322. package/dist/chunk-GPF4YWWB.mjs +9 -0
  323. package/dist/chunk-GRAXKKG4.mjs +2 -0
  324. package/dist/chunk-GYQV7Y4J.mjs +120 -0
  325. package/dist/chunk-HMHK3EQ6.mjs +2 -0
  326. package/dist/chunk-HQQMJCQJ.mjs +10 -0
  327. package/dist/chunk-HYMEEXKN.mjs +4 -0
  328. package/dist/chunk-IERUOGC3.mjs +6 -0
  329. package/dist/chunk-ITNLYXXV.mjs +3 -0
  330. package/dist/chunk-L4DVONOG.mjs +2 -0
  331. package/dist/chunk-LAE5NQ4B.mjs +2 -0
  332. package/dist/chunk-LC7YNQFG.mjs +2 -0
  333. package/dist/chunk-LHTFLRB6.mjs +4 -0
  334. package/dist/chunk-LKX55H76.mjs +2 -0
  335. package/dist/chunk-MAFIGVXY.mjs +2 -0
  336. package/dist/chunk-NFIBI4IP.mjs +26 -0
  337. package/dist/chunk-NSKUTQ5J.mjs +5 -0
  338. package/dist/chunk-O52JMOCZ.mjs +2 -0
  339. package/dist/chunk-P2CAZPDP.mjs +3 -0
  340. package/dist/chunk-QAIHRH3I.mjs +13 -0
  341. package/dist/chunk-QMQUXTU4.mjs +12 -0
  342. package/dist/chunk-QR6A54KJ.mjs +3 -0
  343. package/dist/chunk-QVWVFC5K.mjs +6 -0
  344. package/dist/chunk-QYKCJ7FG.mjs +8 -0
  345. package/dist/chunk-QZY6Q64C.mjs +2 -0
  346. package/dist/chunk-TDQP3DKQ.mjs +10 -0
  347. package/dist/chunk-TMYZB6AV.mjs +2 -0
  348. package/dist/chunk-TX6JH7TR.mjs +2 -0
  349. package/dist/chunk-U3SSPL4K.mjs +8 -0
  350. package/dist/chunk-UH4SIXTR.mjs +2 -0
  351. package/dist/chunk-UNUEWH4S.mjs +2 -0
  352. package/dist/chunk-UXUK4PMC.mjs +27 -0
  353. package/dist/chunk-V4CPWKMZ.mjs +2 -0
  354. package/dist/chunk-V6XZ4VIR.mjs +2 -0
  355. package/dist/chunk-VACRB2NE.mjs +3 -0
  356. package/dist/chunk-W63L7367.mjs +7 -0
  357. package/dist/chunk-W7CXPCRV.mjs +6 -0
  358. package/dist/chunk-W7XHE4CT.mjs +2 -0
  359. package/dist/chunk-XINNG4F2.mjs +4 -0
  360. package/dist/chunk-Y34NR5JL.mjs +2 -0
  361. package/dist/chunk-YEY3RSFQ.mjs +2 -0
  362. package/dist/chunk-YL2DPWVS.mjs +4 -0
  363. package/dist/chunk-YXAUQPVK.mjs +8 -0
  364. package/dist/chunk-YZ5Z6H4W.mjs +4 -0
  365. package/dist/chunk-Z52HTUW7.mjs +4 -0
  366. package/dist/chunk-ZBIM6ARY.mjs +216 -0
  367. package/dist/cli.mjs +2 -0
  368. package/dist/server.mjs +2 -0
  369. package/dist/worker.mjs +5 -0
  370. package/kit/charts.js +355 -0
  371. package/kit/code.js +164 -0
  372. package/kit/dialogs.js +157 -0
  373. package/kit/math.js +1988 -0
  374. package/kit/report.css +2821 -0
  375. package/kit/runtime.js +1707 -0
  376. package/kit/sheets.js +123 -0
  377. package/kit/state.js +217 -0
  378. package/kit/tables.js +1449 -0
  379. package/kit/tokens.js +29 -0
  380. package/kit/ui.js +561 -0
  381. package/package.json +41 -4
  382. package/release.json +25 -0
  383. package/sdk/column-widths.d.ts +56 -0
  384. package/sdk/doc-charts.d.ts +82 -0
  385. package/sdk/doc-code.d.ts +28 -0
  386. package/sdk/doc-dialogs.d.ts +4 -0
  387. package/sdk/doc-kit.d.ts +141 -0
  388. package/sdk/doc-math.d.ts +3 -0
  389. package/sdk/doc-sheets.d.ts +15 -0
  390. package/sdk/doc-state.d.ts +41 -0
  391. package/sdk/doc-tables.d.ts +24 -0
  392. package/sdk/doc-tokens.d.ts +22 -0
  393. package/sdk/index.d.ts +30 -0
  394. package/skill/SKILL.md +138 -0
  395. package/skill/agents/openai.yaml +5 -0
  396. package/skill/references/building-components.md +327 -0
  397. package/skill/references/example-report.html +356 -0
  398. package/skill/references/writing-html.md +187 -0
  399. package/skill/sdk/column-widths.d.ts +56 -0
  400. package/skill/sdk/doc-charts.d.ts +82 -0
  401. package/skill/sdk/doc-code.d.ts +28 -0
  402. package/skill/sdk/doc-dialogs.d.ts +4 -0
  403. package/skill/sdk/doc-kit.d.ts +141 -0
  404. package/skill/sdk/doc-math.d.ts +3 -0
  405. package/skill/sdk/doc-sheets.d.ts +15 -0
  406. package/skill/sdk/doc-state.d.ts +41 -0
  407. package/skill/sdk/doc-tables.d.ts +24 -0
  408. package/skill/sdk/doc-tokens.d.ts +22 -0
  409. package/skill/sdk/index.d.ts +30 -0
  410. package/starter/doc.html +21 -0
  411. package/starter/doc.json +5 -0
  412. package/vendor/d3.v7.9.0.min.js +2 -0
  413. package/vendor/katex/auto-render.min.js +1 -0
  414. package/vendor/katex/contrib/mhchem.min.js +1 -0
  415. package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  416. package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  417. package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  418. package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  419. package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  420. package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  421. package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  422. package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  423. package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  424. package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  425. package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  426. package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  427. package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  428. package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  429. package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  430. package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  431. package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  432. package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  433. package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  434. package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  435. package/vendor/katex/katex.min.css +1 -0
  436. package/vendor/katex/katex.min.js +1 -0
  437. package/vendor/pdfjs/LICENSE +177 -0
  438. package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  439. package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  440. package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  441. package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  442. package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  443. package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  444. package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  445. package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  446. package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  447. package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  448. package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  449. package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  450. package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  451. package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  452. package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  453. package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  454. package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  455. package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  456. package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  457. package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  458. package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  459. package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  460. package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  461. package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  462. package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  463. package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  464. package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  465. package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  466. package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  467. package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  468. package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  469. package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  470. package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  471. package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  472. package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  473. package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  474. package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  475. package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  476. package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  477. package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  478. package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  479. package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  480. package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  481. package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  482. package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  483. package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  484. package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  485. package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  486. package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  487. package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  488. package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  489. package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  490. package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  491. package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  492. package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  493. package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  494. package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  495. package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  496. package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  497. package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  498. package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  499. package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  500. package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  501. package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  502. package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  503. package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  504. package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  505. package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  506. package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  507. package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  508. package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  509. package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  510. package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  511. package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  512. package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  513. package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  514. package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  515. package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  516. package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  517. package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  518. package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  519. package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  520. package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  521. package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  522. package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  523. package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  524. package/vendor/pdfjs/cmaps/H.bcmap +0 -0
  525. package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  526. package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  527. package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  528. package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  529. package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  530. package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  531. package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  532. package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  533. package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  534. package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  535. package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  536. package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  537. package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  538. package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  539. package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  540. package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  541. package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  542. package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  543. package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  544. package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  545. package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  546. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  547. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  548. package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  549. package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  550. package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  551. package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  552. package/vendor/pdfjs/cmaps/LICENSE +36 -0
  553. package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  554. package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  555. package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  556. package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  557. package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  558. package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  559. package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  560. package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  561. package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  562. package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  563. package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  564. package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  565. package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  566. package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  567. package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  568. package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  569. package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  570. package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  571. package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  572. package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  573. package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  574. package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  575. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  576. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  577. package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  578. package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  579. package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  580. package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  581. package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  582. package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  583. package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  584. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  585. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  586. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  587. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  588. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  589. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  590. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  591. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  592. package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  593. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  594. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  595. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  596. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  597. package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  598. package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  599. package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  600. package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  601. package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  602. package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  603. package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  604. package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  605. package/vendor/pdfjs/cmaps/V.bcmap +0 -0
  606. package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  607. package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
  608. package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
  609. package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  610. package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  611. package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  612. package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  613. package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  614. package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  615. package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  616. package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  617. package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  618. package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  619. package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  620. package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  621. package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  622. package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  623. package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  624. package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  625. package/vendor/types/@types/d3/LICENSE +21 -0
  626. package/vendor/types/@types/d3/index.d.ts +39 -0
  627. package/vendor/types/@types/d3/package.json +81 -0
  628. package/vendor/types/@types/d3-array/LICENSE +21 -0
  629. package/vendor/types/@types/d3-array/index.d.ts +1118 -0
  630. package/vendor/types/@types/d3-array/package.json +56 -0
  631. package/vendor/types/@types/d3-axis/LICENSE +21 -0
  632. package/vendor/types/@types/d3-axis/index.d.ts +293 -0
  633. package/vendor/types/@types/d3-axis/package.json +47 -0
  634. package/vendor/types/@types/d3-brush/LICENSE +21 -0
  635. package/vendor/types/@types/d3-brush/index.d.ts +255 -0
  636. package/vendor/types/@types/d3-brush/package.json +42 -0
  637. package/vendor/types/@types/d3-chord/LICENSE +21 -0
  638. package/vendor/types/@types/d3-chord/index.d.ts +471 -0
  639. package/vendor/types/@types/d3-chord/package.json +40 -0
  640. package/vendor/types/@types/d3-color/LICENSE +21 -0
  641. package/vendor/types/@types/d3-color/index.d.ts +669 -0
  642. package/vendor/types/@types/d3-color/package.json +55 -0
  643. package/vendor/types/@types/d3-contour/LICENSE +21 -0
  644. package/vendor/types/@types/d3-contour/index.d.ts +222 -0
  645. package/vendor/types/@types/d3-contour/package.json +38 -0
  646. package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
  647. package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
  648. package/vendor/types/@types/d3-delaunay/package.json +30 -0
  649. package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
  650. package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
  651. package/vendor/types/@types/d3-dispatch/package.json +51 -0
  652. package/vendor/types/@types/d3-drag/LICENSE +21 -0
  653. package/vendor/types/@types/d3-drag/index.d.ts +395 -0
  654. package/vendor/types/@types/d3-drag/package.json +42 -0
  655. package/vendor/types/@types/d3-dsv/LICENSE +21 -0
  656. package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
  657. package/vendor/types/@types/d3-dsv/package.json +45 -0
  658. package/vendor/types/@types/d3-ease/LICENSE +21 -0
  659. package/vendor/types/@types/d3-ease/index.d.ts +316 -0
  660. package/vendor/types/@types/d3-ease/package.json +40 -0
  661. package/vendor/types/@types/d3-fetch/LICENSE +21 -0
  662. package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
  663. package/vendor/types/@types/d3-fetch/package.json +37 -0
  664. package/vendor/types/@types/d3-force/LICENSE +21 -0
  665. package/vendor/types/@types/d3-force/index.d.ts +899 -0
  666. package/vendor/types/@types/d3-force/package.json +45 -0
  667. package/vendor/types/@types/d3-format/LICENSE +21 -0
  668. package/vendor/types/@types/d3-format/index.d.ts +337 -0
  669. package/vendor/types/@types/d3-format/package.json +45 -0
  670. package/vendor/types/@types/d3-geo/LICENSE +21 -0
  671. package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
  672. package/vendor/types/@types/d3-geo/package.json +48 -0
  673. package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
  674. package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
  675. package/vendor/types/@types/d3-hierarchy/package.json +50 -0
  676. package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
  677. package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
  678. package/vendor/types/@types/d3-interpolate/package.json +47 -0
  679. package/vendor/types/@types/d3-path/LICENSE +21 -0
  680. package/vendor/types/@types/d3-path/index.d.ts +108 -0
  681. package/vendor/types/@types/d3-path/package.json +41 -0
  682. package/vendor/types/@types/d3-polygon/LICENSE +21 -0
  683. package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
  684. package/vendor/types/@types/d3-polygon/package.json +40 -0
  685. package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
  686. package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
  687. package/vendor/types/@types/d3-quadtree/package.json +45 -0
  688. package/vendor/types/@types/d3-random/LICENSE +21 -0
  689. package/vendor/types/@types/d3-random/index.d.ts +313 -0
  690. package/vendor/types/@types/d3-random/package.json +41 -0
  691. package/vendor/types/@types/d3-scale/LICENSE +21 -0
  692. package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
  693. package/vendor/types/@types/d3-scale/package.json +53 -0
  694. package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
  695. package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
  696. package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
  697. package/vendor/types/@types/d3-selection/LICENSE +21 -0
  698. package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
  699. package/vendor/types/@types/d3-selection/package.json +56 -0
  700. package/vendor/types/@types/d3-shape/LICENSE +21 -0
  701. package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
  702. package/vendor/types/@types/d3-shape/package.json +53 -0
  703. package/vendor/types/@types/d3-time/LICENSE +21 -0
  704. package/vendor/types/@types/d3-time/index.d.ts +697 -0
  705. package/vendor/types/@types/d3-time/package.json +46 -0
  706. package/vendor/types/@types/d3-time-format/LICENSE +21 -0
  707. package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
  708. package/vendor/types/@types/d3-time-format/package.json +40 -0
  709. package/vendor/types/@types/d3-timer/LICENSE +21 -0
  710. package/vendor/types/@types/d3-timer/index.d.ts +68 -0
  711. package/vendor/types/@types/d3-timer/package.json +45 -0
  712. package/vendor/types/@types/d3-transition/LICENSE +21 -0
  713. package/vendor/types/@types/d3-transition/index.d.ts +664 -0
  714. package/vendor/types/@types/d3-transition/package.json +47 -0
  715. package/vendor/types/@types/d3-zoom/LICENSE +21 -0
  716. package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
  717. package/vendor/types/@types/d3-zoom/package.json +48 -0
  718. package/vendor/types/@types/geojson/LICENSE +21 -0
  719. package/vendor/types/@types/geojson/index.d.ts +202 -0
  720. package/vendor/types/@types/geojson/package.json +46 -0
  721. package/vendor/typescript/LICENSE.txt +55 -0
  722. package/vendor/typescript/lib.decorators.d.ts +384 -0
  723. package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
  724. package/vendor/typescript/lib.dom.d.ts +39429 -0
  725. package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
  726. package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
  727. package/vendor/typescript/lib.es2015.core.d.ts +597 -0
  728. package/vendor/typescript/lib.es2015.d.ts +28 -0
  729. package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
  730. package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
  731. package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
  732. package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
  733. package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
  734. package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
  735. package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
  736. package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
  737. package/vendor/typescript/lib.es2016.d.ts +21 -0
  738. package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
  739. package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
  740. package/vendor/typescript/lib.es2017.d.ts +26 -0
  741. package/vendor/typescript/lib.es2017.date.d.ts +31 -0
  742. package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
  743. package/vendor/typescript/lib.es2017.object.d.ts +49 -0
  744. package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
  745. package/vendor/typescript/lib.es2017.string.d.ts +45 -0
  746. package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
  747. package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
  748. package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
  749. package/vendor/typescript/lib.es2018.d.ts +24 -0
  750. package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
  751. package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
  752. package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
  753. package/vendor/typescript/lib.es2019.array.d.ts +79 -0
  754. package/vendor/typescript/lib.es2019.d.ts +24 -0
  755. package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
  756. package/vendor/typescript/lib.es2019.object.d.ts +33 -0
  757. package/vendor/typescript/lib.es2019.string.d.ts +37 -0
  758. package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
  759. package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
  760. package/vendor/typescript/lib.es2020.d.ts +27 -0
  761. package/vendor/typescript/lib.es2020.date.d.ts +42 -0
  762. package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
  763. package/vendor/typescript/lib.es2020.number.d.ts +28 -0
  764. package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
  765. package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
  766. package/vendor/typescript/lib.es2020.string.d.ts +44 -0
  767. package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
  768. package/vendor/typescript/lib.es2021.d.ts +23 -0
  769. package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
  770. package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
  771. package/vendor/typescript/lib.es2021.string.d.ts +33 -0
  772. package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
  773. package/vendor/typescript/lib.es2022.array.d.ts +121 -0
  774. package/vendor/typescript/lib.es2022.d.ts +25 -0
  775. package/vendor/typescript/lib.es2022.error.d.ts +75 -0
  776. package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
  777. package/vendor/typescript/lib.es2022.object.d.ts +26 -0
  778. package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
  779. package/vendor/typescript/lib.es2022.string.d.ts +25 -0
  780. package/vendor/typescript/lib.es5.d.ts +4601 -0
  781. package/vendor/typescript/package.json +4 -0
  782. package/vendor/typescript/typescript.js +446 -0
  783. package/web/assets/index-B6Ai3wsa.js +13 -0
  784. package/web/assets/index-SYPC3EZy.css +1 -0
  785. package/web/index.html +14 -0
@@ -0,0 +1,2 @@
1
+ import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
+ import{b as p,d as m,e as u,f,g as d}from"./chunk-XINNG4F2.mjs";import{j as n}from"./chunk-NSKUTQ5J.mjs";import{k as i,s as a,v as c}from"./chunk-QMQUXTU4.mjs";import{reportsDirectory as g}from"../browser/shared/paths.mjs";import{documentDirectory as $,documentFiles as y}from"../browser/shared/workspace.mjs";var k=()=>`No documents in ${g} yet: gallery new <slug> "<title>" makes one.`;async function A(w){let{slugs:e,options:h}=await n({options:["--allow-failures"],argv:w,noneIsAll:!0});e.length===0&&(console.error(k()),process.exit(1)),await p(e),await f(e),await d(e);let{reports:r,failures:t}=await i(e,{prepare:m()}),s=r.filter(o=>!t.has(o.slug));for(let o of s)console.log(`OK ${o.slug}`);for(let o of e)y($(o,g)).both&&console.log(`note ${o}: both doc.html and report.html: report.html is not read`);a(r),u(r);let l=s.length+t.size;console.log(`Checked ${l} document${l===1?"":"s"}: ${s.length} passed, ${t.size} failed.`),await c(t,{allow:h.has("--allow-failures")})}export{k as a,A 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-U3SSPL4K.mjs";import"./chunk-YEY3RSFQ.mjs";import"./chunk-W7XHE4CT.mjs";import"./chunk-5L7RYZCL.mjs";export{a as DEFAULT_KEEP_ALIVE_INTERVAL_MS,b as NodeWebSocketTransport};
@@ -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{a as m,b as G,c as J}from"./chunk-HYMEEXKN.mjs";import w from"node:fs";import k from"node:path";import je from"node:zlib";import{escapeAttribute as I}from"../browser/shared/escape.mjs";import{componentOf as M,instancesOf as Ee,partOf as q}from"../browser/shared/components/index.mjs";import{ICON_COLOR_VALUES as Y,TAB_ICON as Q,glyphOf as ee,iconKind as j,iconUrl as te,iconValueOf as P,tabIconValue as Ce}from"../browser/shared/emoji/icon-value.mjs";import{mediaTypeOf as se,mediaUrl as De}from"../browser/shared/media.mjs";import{emojiDataDirectory as Re,reportsDirectory as oe}from"../browser/shared/paths.mjs";import{slugPattern as Te}from"../browser/shared/reports.mjs";import{documentDirectory as ne}from"../browser/shared/workspace.mjs";var N=Re,X=String.fromCodePoint(65039),Z=null,B=null;function Me(){return Z??={positions:JSON.parse(w.readFileSync(k.join(N,"positions.json"),"utf8")),index:JSON.parse(w.readFileSync(k.join(N,"twemoji-index.json"),"utf8")),svg:je.gunzipSync(w.readFileSync(k.join(N,"twemoji-svg.bin")))},Z}function re(e){let{positions:t,index:s,svg:n}=Me(),o=[e,e.replaceAll(X,""),`${e}${X}`].find(i=>t[i]),r=o&&s[t[o][0]];return r?n.subarray(r[0],r[0]+r[1]):null}function ie(e){let t=re(e);return t?`data:image/svg+xml;base64,${t.toString("base64")}`:null}function es(e){return E(""),[...B.keys()].filter(t=>t.startsWith(`${e}/`)).map(t=>t.slice(e.length+1))}function E(e,t="currentColor"){B??=new Map(JSON.parse(w.readFileSync(k.join(N,"icons.json"),"utf8")).icons.flatMap(([,o,r,i,a])=>[[`mingcute/${o}`,i],[`tabler/${r}`,a]].filter(([,c])=>c)));let s=ee(e),n=s&&B.get(`${s.set}/${s.name}`);return n?n.split("#COLOR").join(t).replace("<svg ",'<svg aria-hidden="true" '):null}function Ie(e){let[t,s]=Y[ee(e)?.color]??Y.gray,n=E(e);return n&&n.replace(/<svg\b[^>]*>/,o=>`${o.replace(/ aria-hidden="true"/,"").replace(/^<svg /,'<svg xmlns="http://www.w3.org/2000/svg" ').replace(/ xmlns="http:\/\/www\.w3\.org\/2000\/svg"(?=.* xmlns=)/,"")}<style>svg{color:${t}}@media (prefers-color-scheme:dark){svg{color:${s}}}</style>`)}function Be({value:e,slug:t=null,tab:s=!1,reportsDirectory:n=oe}){let o=j(e);if(o==="emoji"){let i=re(e);return i&&{type:"image/svg+xml",body:i}}if(o==="glyph"){let i=s?Ie(e):E(e,"#000");return i&&{type:"image/svg+xml",body:Buffer.from(i)}}if(o!=="image"||!t||!Te.test(t))return null;let r=k.join(ne(t,n),e);return w.existsSync(r)?{type:se(e),body:w.readFileSync(r)}:null}var ae=/(<div\b[^>]*\bclass="doc-icon"[^>]*>)([\s\S]*?)(<\/div>)/g;function ts(e,{slug:t,mode:s="export",reportsDirectory:n=oe}){return He(Ae(e,{mode:s}).replace(ae,(o,r,i,a)=>{let c=P(o),l=j(c);if(!l)return o;let f=null;if(l==="emoji"){let d=ie(c);f=d&&`<img alt="${I(c)}" src="${d}">`}else if(l==="glyph")f=E(c);else if(s==="preview")f=`<img src="${De("asset",t,c)}" alt="">`;else{let d=k.join(ne(t,n),c),p=w.existsSync(d)?w.readFileSync(d):null;f=p&&`<img src="data:${se(c)};base64,${p.toString("base64")}" alt="">`}let u=s==="preview"?r.replace(/>$/,` data-ge-icon="${I(c)}">`):r;return f?`${u}${f}${a}`:`${u}${i}${a}`}),ze(_e(e),{slug:t,mode:s,reportsDirectory:n}))}var ce=e=>[...e.matchAll(ae)].flatMap(t=>{let s=j(P(t[0]))==="image"?/<img\b[^>]*\bsrc="/.exec(t[2]):null;return s?[t.index+t[1].length+s.index]:[]}),Pe=/<button\b[^>]*\bdata-tab-icon="([^"]*)"[^>]*>/g;function Ae(e,{mode:t="export"}={}){return e.replace(Pe,(s,n)=>{if(j(n)!=="emoji"||s.includes(Q))return s;let o=t==="preview"?te(n):ie(n);if(!o)return s;let r=`${Q}: ${Ce(o)}`;return/\sstyle="/.test(s)?s.replace(/\sstyle="([^"]*)"/,(i,a)=>` style="${a.replace(/;?\s*$/,"; ")}${r}"`):s.replace(/>$/,` style="${r}">`)})}function Ue(e){let t=q(e,M("page").header)[0];return{all:Ee(e,M("icon")),own:t?q(t,M("icon").match):[]}}function _e(e){let[t]=Ue(m(e)).own;return t?P(G(e,t)):null}function ze(e,{slug:t,mode:s,reportsDirectory:n}){if(!e)return null;if(s==="preview")return te(e,t,{tab:!0});let o=Be({value:e,slug:t,tab:!0,reportsDirectory:n});return o&&`data:${o.type};base64,${Buffer.from(o.body).toString("base64")}`}var He=(e,t)=>t&&/<\/head>/i.test(e)&&!e.includes("data-doc-tab-icon")?e.replace(/<\/head>/i,()=>` <link rel="icon" href="${I(t)}" data-doc-tab-icon>
3
+ </head>`):e;import Ze from"node:fs";import et from"node:path";import{reportsDirectory as tt}from"../browser/shared/paths.mjs";import{assetFile as st,assetProblem as ot,embedFile as nt}from"../browser/shared/media.mjs";import{attr as le,hasClass as rt,walk as it}from"../browser/shared/html-tree.mjs";import fe from"node:fs";import We from"node:path";import{attr as Ve,hasClass as Ke,walk as Ge}from"../browser/shared/html-tree.mjs";import{MEDIA_ROUTES as Je,mediaTypeOf as qe,mediaUrl as Ye}from"../browser/shared/media.mjs";import{documentDirectory as Qe}from"../browser/shared/workspace.mjs";function x(e,t,s){let n=null;return Ge(e,o=>{!n&&o.tagName===t&&Ke(o,s)&&(n=o)}),n}function A(e,t){let s=We.join(e,t);return fe.statSync(s,{throwIfNoEntry:!1})?.isFile()?`data:${qe(t)};base64,${fe.readFileSync(s).toString("base64")}`:null}function Xe(e,{attribute:t,route:s,slug:n,mode:o,reportsDirectory:r}){if(!Je[s](e))return null;if(o==="preview")return`${t}="${Ye(s,n,e)}" data-ge-${t}="${e}"`;let i=A(Qe(n,r),e);return i&&`${t}="${i}"`}function S(e,t,{attribute:s,route:n,slug:o,mode:r,reportsDirectory:i}){let a=t.map(f=>({place:f.sourceCodeLocation?.attrs?.[s],value:Ve(f,s)})).filter(({place:f})=>f).sort((f,u)=>f.place.startOffset-u.place.startOffset),c=[],l=0;for(let{place:f,value:u}of a){let d=Xe(u,{attribute:s,route:n,slug:o,mode:r,reportsDirectory:i});d===null||f.startOffset<l||(c.push(e.slice(l,f.startOffset),d),l=f.endOffset)}return c.push(e.slice(l)),c.join("")}function U(e){let t=[];return it(e,s=>{let n=s.tagName==="figure"&&rt(s,"doc-embed")?x(s,"iframe","doc-embed-frame"):null;n&&t.push(n)}),t}function gs(e,{slug:t,mode:s="export",reportsDirectory:n=tt}){return e.includes("doc-embed")?S(e,U(m(e)),{attribute:"src",route:"embed",slug:t,mode:s,reportsDirectory:n}):e}var de=(e,t=m(e))=>U(t).map(s=>s.sourceCodeLocation.startOffset);function $s({html:e,directory:t,tree:s=m(e)}){let n=[];for(let o of U(s)){let r=`line ${o.sourceCodeLocation.startLine}`,i=le(o,"src")??"",a=le(o,"sandbox"),c=/^https:\/\/[^\s"]+$/.test(i),l=!c&&!/^[a-z][a-z0-9+.-]*:/i.test(i)&&!st(i)?ot(i):null;l?n.push(`${r}: an embed's frame (${i.slice(0,80)}): ${l} (an HTML or PDF file; or a web page, https://\u2026)`):!c&&!nt(i)?n.push(`${r}: an embed's frame (${i.slice(0,80)}) shows a web page (https://\u2026, never http) or an HTML or PDF file of the document's folder (assets/<file>)`):!c&&!Ze.existsSync(et.join(t,i))?n.push(`${r}: the embed's file ${i} is not in the document's folder`):(c||/\.html?$/i.test(i))&&a===void 0?n.push(`${r}: an embed's frame (${i.slice(0,80)}) is sandboxed: sandbox="allow-scripts allow-popups \u2026"`):!c&&/\.html?$/i.test(i)&&/\ballow-same-origin\b/.test(a)?n.push(`${r}: an embedded HTML file (${i}) keeps its own origin: its sandbox has no allow-same-origin`):!c&&/\.pdf$/i.test(i)&&a!==void 0&&n.push(`${r}: an embedded PDF (${i}) is sandboxed, and a sandboxed frame shows no PDF: take its sandbox attribute off`)}return[...new Set(n)]}import at from"node:fs";import ct from"node:path";import{reportsDirectory as ft}from"../browser/shared/paths.mjs";import{assetFile as lt,assetProblem as dt}from"../browser/shared/media.mjs";import{attr as ue,hasClass as ut,walk as pt}from"../browser/shared/html-tree.mjs";function C(e,t=m(e)){let s=[];return pt(t,n=>{n.tagName==="figure"&&ut(n,"doc-file")&&s.push({node:n,link:x(n,"a","doc-file-link")})}),s}function Fs(e,{slug:t,mode:s="export",reportsDirectory:n=ft}){if(!e.includes("doc-file"))return e;let o=C(e).flatMap(({link:r})=>r?[r]:[]);return S(e,o,{attribute:"href",route:"file",slug:t,mode:s,reportsDirectory:n})}function Ls({html:e,directory:t,tree:s=m(e)}){let n=[];for(let{link:o}of C(e,s)){if(!o)continue;let r=`line ${o.sourceCodeLocation?.startLine}`,i=ue(o,"href")??"";lt(i)?at.existsSync(ct.join(t,i))||n.push(`${r}: the file block's file ${i} is not in the document's folder`):n.push(`${r}: a file block's file (${i.slice(0,80)}): ${dt(i)} (<a class="doc-file-link" href="assets/<file>" download="<name>">)`),ue(o,"download")||n.push(`${r}: a file block's link (${i.slice(0,80)}) says the name to save it as: download="<name>"`)}return[...new Set(n)]}import mt from"node:fs";import ht from"node:path";import{reportsDirectory as gt}from"../browser/shared/paths.mjs";import{assetProblem as pe,imageFile as me}from"../browser/shared/media.mjs";import{attr as _,hasClass as $t,walk as z}from"../browser/shared/html-tree.mjs";var bt={"doc-image":"image","doc-bookmark":"bookmark"},wt={image:"an image's picture",bookmark:"a bookmark's icon or cover"},yt=/doc-(?:image|bookmark|link-mention-icon)/;function he(e){let t=[];return z(e,s=>{let n=s.tagName==="figure"&&(_(s,"class")??"").split(/\s+/).map(o=>bt[o]).find(Boolean);n&&t.push({node:s,kind:n})}),t}function D(e,t=m(e)){let s=new Map,n=(o,r,i)=>{let a=o.sourceCodeLocation;a&&!s.has(a.startOffset)&&s.set(a.startOffset,{at:a.startOffset,line:a.startLine,node:o,what:r,kind:i,mention:i==="mention"})};for(let{node:o,kind:r}of he(t))z(o,i=>i.tagName==="img"&&n(i,wt[r],r));return z(t,o=>o.tagName==="img"&&$t(o,"doc-link-mention-icon")&&n(o,"a link's icon","mention")),[...s.values()].sort((o,r)=>o.at-r.at)}function Is(e,{slug:t,mode:s="export",reportsDirectory:n=gt}){return yt.test(e)?S(e,D(e).map(({node:o})=>o),{attribute:"src",route:"asset",slug:t,mode:s,reportsDirectory:n}):e}function Bs({html:e,directory:t,tree:s=m(e)}){let n=[];for(let{line:o,node:r,what:i,mention:a}of D(e,s)){let c=_(r,"src");a&&!me(c)?n.push(`line ${o}: a link's icon (${(c??"").slice(0,80)}): ${pe(c,{picture:!0})}; or write an empty <span class="doc-link-mention-icon"></span>`):c===void 0?n.push(`line ${o}: ${i} has no src: <img src="assets/<file>" alt="\u2026">`):me(c)?mt.existsSync(ht.join(t,c))||n.push(`line ${o}: ${i} ${c} is not in the document's folder`):n.push(`line ${o}: ${i} (${c.slice(0,80)}): ${pe(c,{picture:!0})}`)}for(let{node:o,kind:r}of he(s)){let i=r==="bookmark"?x(o,"a","doc-bookmark-card"):null,a=i&&_(i,"href");i&&!/^https?:\/\/[^\s"]+$/.test(a??"")&&n.push(`line ${i.sourceCodeLocation?.startLine}: a bookmark's link (${(a??"").slice(0,80)}) is a web address: <a class="doc-bookmark-card" href="https://\u2026">`)}return[...new Set(n)]}import Se from"node:fs";import Oe from"node:path";import{escapeAttribute as F}from"../browser/shared/escape.mjs";import{attr as O,hasClass as kt,walk as xt}from"../browser/shared/html-tree.mjs";import{cssReferences as ge}from"../browser/shared/css-references.mjs";import{assetFile as St,assetProblem as Ot,imageFile as vt,mediaUrl as Ft,referencedFile as L}from"../browser/shared/media.mjs";import{reportsDirectory as Lt}from"../browser/shared/paths.mjs";import{documentDirectory as Nt}from"../browser/shared/workspace.mjs";var $e=/^\s*(?:\.\/)?assets\//i,be=1e6;function jt(e){let t=[],s=0;for(;s<e.length;){for(;s<e.length&&/[\s,]/.test(e[s]);)s++;if(s>=e.length)break;let n=s;for(;n<e.length&&!/\s/.test(e[n]);)n++;let o=e.slice(s,n),r="";if(o.endsWith(","))o=o.replace(/,+$/,""),s=n;else{let a=n;for(let c=0;a<e.length&&(e[a]!==","||c>0);a++)e[a]==="("?c++:e[a]===")"&&c--;r=e.slice(n,a).trim(),s=a+1}let i=r.split(/\s+/).find(a=>/^\d*\.?\d+[wx]$/i.test(a));t.push({url:o,descriptor:r,size:i?parseFloat(i):1,wide:/w$/i.test(i??"")})}return t}function Et(e){let t=e.filter(s=>s.wide);return(t.length>0?t:e).reduce((s,n)=>!s||n.size>s.size?n:s,null)}var Ct=new Set(["body","table","thead","tbody","tfoot","tr","td","th"]);function W(e,t,s=n=>$e.test(n)){let n=[],o=r=>{s(r.value,r.node)&&n.push({...r,value:r.value.trim(),written:r.css?.written})};return xt(t,r=>{let i=r.sourceCodeLocation;if(i){for(let{name:a,value:c,prefix:l}of r.attrs){let f=l?`${l}:${a}`:a,u=i.attrs?.[f],d={node:r,how:a,key:f,place:u,line:u?.startLine??i.startLine};if(a==="src"||a==="href"||a==="poster"||a==="data"&&r.tagName==="object"||a==="background"&&Ct.has(r.tagName))o({...d,value:c});else if(a==="srcset"){let p=jt(c),y=Et(p.filter(b=>$e.test(b.url)));p.forEach((b,h)=>o({...d,value:b.url,candidates:p,index:h,largest:b===y}))}else if(a==="style")for(let p of ge(c))o({...d,value:p.value,css:p})}if(r.tagName==="style")for(let a of r.childNodes){if(a.nodeName!=="#text"||!a.sourceCodeLocation)continue;let{startOffset:c,endOffset:l}=a.sourceCodeLocation;for(let f of ge(e.slice(c,l)))o({node:r,how:"css",value:f.value,line:J(e,c+f.index),css:{...f,offset:c}})}}}),n}function ve(e,t){let s=new Map;for(let{at:n,kind:o}of D(e,t))s.set(n,{attribute:"src",owner:"block",icon:o!=="image"});for(let{link:n}of C(e,t))n&&s.set(n.sourceCodeLocation.startOffset,{attribute:"href",owner:"block"});for(let n of de(e,t))s.set(n,{attribute:"src",owner:"block"});for(let n of ce(e))s.set(n,{attribute:"src",owner:"icon"});return s}var Fe=(e,t)=>{let s=e.get(t.node.sourceCodeLocation.startOffset);return s?.attribute===t.how?s:null},Dt=new Set(["img","input","video","audio","source","track"]),we="an export holds no stylesheet of the folder (the addresses in one are read from its own place): put its rules in the page's <style>",ye=e=>(O(e,"rel")??"").toLowerCase().split(/\s+/),H=/\.html?$/i,Rt={html:'src="assets/<file>.html" sandbox="allow-scripts"',pdf:'src="assets/<file>.pdf"'},V=e=>`<figure class="doc-embed doc-embed--file"><iframe class="doc-embed-frame" ${Rt[e]}></iframe><figcaption></figcaption></figure>`,ke=`its frame with no sandbox (a sandboxed one shows no PDF): ${V("pdf")}`,xe='show a picture with <img src="assets/<file>">, a file to save with a link, <a href="assets/<file>" download="<name>">';function K({node:e,how:t,css:s,value:n}){let o=e.tagName;if(t==="style"||t==="css")return s.kind==="import"?{not:we}:{use:"shown"};if(t==="srcset"&&(o==="img"||o==="source")||t==="poster"&&o==="video"||t==="src"&&Dt.has(o)||t==="background")return{use:"shown"};if(t==="src"&&o==="iframe"){let r=L(n)??"";return H.test(r)?{use:"frame"}:/\.pdf$/i.test(r)?{not:`a PDF shows in an embed block alone (the kit hands its file to the browser's PDF viewer, in the preview and in an export): make it one, ${ke}`}:{not:`a frame shows a page of the folder (an HTML file), not this file, which the preview would hand out for saving: ${xe}`}}if(t==="href"&&(o==="a"||o==="area"))return{use:"link"};if(t==="href"&&(o==="image"||o==="link"&&ye(e).some(r=>r.endsWith("icon"))))return{use:"shown"};if(o==="object"||o==="embed"){let r=L(n)??"";return{not:`an export's policy loads no plugin content (<object>, <embed>): ${/\.pdf$/i.test(r)?`show a PDF in an embed block, ${ke}`:H.test(r)?`show a page in an embed block, ${V("html")}`:xe}`}}return o==="script"?{not:"an export runs the page's own scripts alone: put the code in the page's <script>"}:o==="link"&&ye(e).includes("stylesheet")?{not:we}:{not:"an export holds a file of the folder as a picture, a font, a video or audio, a link or a frame, not there"}}var R=e=>e.startsWith("assets/")&&St(e),Tt=e=>Ot(e)??`the folder is assets/, in lowercase: write it so (assets/${e.slice(7)})`,Le=(e,t,s)=>t==="link"&&H.test(s)&&O(e.node,"download")===void 0,Mt=(e,t)=>e==="frame"?"embed":e==="shown"&&vt(t)?"asset":"file",It=(e,t)=>!!Se.statSync(Oe.join(e,t),{throwIfNoEntry:!1})?.isFile(),v=({node:e,how:t,value:s,written:n})=>({srcset:`<${e.tagName} srcset="\u2026 ${s} \u2026">`,style:`${n} in the style of <${e.tagName}>`,css:`${n} in <style>`})[t]??`<${e.tagName} ${t}="${s}">`,Bt=e=>{for(let t=e.parentNode;t;t=t.parentNode)if(t.tagName&&kt(t,"doc-icon"))return!0;return!1},Pt=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`:`${e[0]}`;function At(e,t){let s=new Map;for(let{file:i,line:a,owned:c}of e){let l=s.get(i)??s.set(i,{lines:[],owned:!1}).get(i);c?l.owned=!0:l.lines.push(a)}let n=0,o=[];for(let[i,{lines:a,owned:c}]of s){let l=c?a.length:a.length-1;if(l<1)continue;let f=l*Math.ceil(Se.statSync(Oe.join(t,i)).size/3)*4;n+=f;let u=a.length===1?"once":a.length===2?"twice":`${a.length} times`;o.push({bytes:f,said:`${i} ${u}${c?" besides a media block's or the icon's":""} (line${new Set(a).size>1?"s":""} ${Pt([...new Set(a)])})`})}if(n<=be)return[];let r=o.sort((i,a)=>a.bytes-i.bytes).map(({said:i})=>i).join(", ");return[`files embedded more than once make an export ${n.toLocaleString("en-US")} bytes bigger, over the ${be.toLocaleString("en-US")} bytes the copies outside the media blocks may add: ${r}; show each fewer times (a picture, a link or a frame holds a copy of its own each time it is written), or, for a CSS background (url() in a <style> or a style attribute), name it once in the page's <style> (--picture: url(assets/<file>)) and write var(--picture) where it shows`]}function Ne({html:e,directory:t,tree:s}){let n=ve(e,s),o=[],r=[],i=[];for(let a of W(e,s)){let{line:c}=a,l=Fe(n,a),f=L(a.value),u=f!==null&&It(t,f);if(u&&!R(f)&&i.push({file:f,line:c}),l?.owner==="block"){u&&R(f)&&r.push({file:f,line:c,owned:!0,icon:!!l.icon});continue}if(u||o.push(l?`line ${c}: the icon's image ${a.value} is not in the document's folder`:`line ${c}: ${v(a)} names a file that is not in the document's folder`),l){u&&r.push({file:f,line:c,owned:!0,icon:!0});continue}let{use:d,not:p}=K(a);p&&o.push(`line ${c}: ${v(a)}: ${p}`),!(!d||!u)&&(R(f)?Le(a,d,f)?o.push(`line ${c}: ${v(a)} opens an HTML file, which an export cannot (a browser opens no page from a data: address): show it in an embed block, ${V("html")}, or give the link download="<name>" to hand it out as a file`):a.node.tagName==="img"&&a.how==="src"&&Bt(a.node)?o.push(`line ${c}: ${v(a)} is in an icon (.doc-icon) written as an icon is not read (its picker, the browser tab's icon): write it <div class="doc-icon"><img src="assets/<file>" alt=""></div>, in double quotes and with no other class`):(a.how!=="srcset"||a.largest)&&r.push({file:f,line:c}):o.push(`line ${c}: ${v(a)}: ${Tt(f)}`))}return{failures:o,embedded:r,unserved:i}}function Zs({html:e,directory:t,tree:s=m(e)}){let{failures:n,embedded:o}=Ne({html:e,directory:t,tree:s});return[...new Set([...n,...At(o,t)])]}function eo({html:e,directory:t,tree:s=m(e)}){let{embedded:n,unserved:o}=Ne({html:e,directory:t,tree:s});return{embedded:n.map(({file:r,line:i,icon:a=!1})=>({file:r,line:i,icon:a})),unserved:o}}function Ut(e,{slug:t,mode:s,directory:n}){let{use:o}=K(e),r=L(e.value);if(!o||!r||!R(r)||Le(e,o,r))return null;let i=/#.*$/.exec(e.value)?.[0]??"";if(s==="preview")return`${Ft(Mt(o,r),t,r)}${i}`;let a=A(n,r);return a&&`${a}${i}`}function _t(e,t,{mode:s,shown:n}){let[o]=t,{node:r,how:i,key:a}=o,c=(h,g="")=>({start:e.startOffset,end:e.endOffset,text:`${a}="${F(h)}"${g}`}),l=s==="preview"?` data-ge-${i}="${F(O(r,i)??"")}"`:"",u=(s==="preview"?[`data-ge-${i}`,`data-rs-${i}`].map(h=>r.sourceCodeLocation.attrs?.[h]).filter(Boolean):[]).map(h=>({start:h.startOffset,end:h.endOffset,text:""}));if(i==="srcset"){if(s==="export"){let g=t.find(T=>T.largest),$=g&&n(g);return $?[c(`${$} ${g.candidates[g.index].descriptor}`.trim())]:[]}let h=new Map(t.map(g=>[g.index,n(g)]));return[...h.values()].some(Boolean)?[c(o.candidates.map((g,$)=>[h.get($)??g.url,g.descriptor].filter(Boolean).join(" ")).join(", "),l),...u]:[]}if(i==="style"){let h=O(r,"style"),g=t.map($=>({...$.css,address:n($)})).filter($=>$.address).sort(($,T)=>T.start-$.start);for(let $ of g)h=`${h.slice(0,$.start)}${$.address}${h.slice($.end)}`;return g.length>0?[c(h)]:[]}let d=n(o);if(!d)return[];if(s==="preview"||K(o).use!=="link")return[c(d,l),...u];let p=L(o.value).slice(7),y=O(r,"download");if(y===void 0)return[c(d,` download="${F(p)}"`)];let b=r.sourceCodeLocation.attrs?.download;return[c(d),...y===""&&b?[{start:b.startOffset,end:b.endOffset,text:`download="${F(p)}"`}]:[]]}function zt(e,t){let s=[],n=0;for(let{start:o,end:r,text:i}of[...t].sort((a,c)=>a.start-c.start))o<n||(s.push(e.slice(n,o),i),n=r);return s.push(e.slice(n)),s.join("")}var to=(e,t,s=m(e))=>W(e,s,t);function so(e,t){let s=[],n=new Map;for(let o of e){let r=t(o);typeof r=="string"&&(o.how==="css"?s.push({start:o.css.offset+o.css.start,end:o.css.offset+o.css.end,text:r}):o.place&&n.set(o.place,[...n.get(o.place)??[],{...o,address:r}]))}for(let[o,r]of n){let[{node:i,how:a,key:c,candidates:l}]=r,f=r[0].address;if(a==="srcset"){let u=new Map(r.map(d=>[d.index,d.address]));f=l.map((d,p)=>[u.get(p)??d.url,d.descriptor].filter(Boolean).join(" ")).join(", ")}else if(a==="style"){f=O(i,"style");for(let{css:u,address:d}of[...r].sort((p,y)=>y.css.start-p.css.start))f=`${f.slice(0,u.start)}${d}${f.slice(u.end)}`}s.push({start:o.startOffset,end:o.endOffset,text:`${c}="${F(f)}"`})}return s}function oo(e,{slug:t,mode:s="export",reportsDirectory:n=Lt}){if(!/assets\//i.test(e.replace(/\sdata-ge-(?:src|href|icon)="[^"]*"/g,"")))return e;let o=m(e),r=ve(e,o),i=Nt(t,n),a=f=>Ut(f,{slug:t,mode:s,directory:i}),c=[],l=new Map;for(let f of W(e,o))if(!Fe(r,f))if(f.how==="css"){let u=a(f),d=f.css.offset;u&&c.push({start:d+f.css.start,end:d+f.css.end,text:u})}else f.place&&l.set(f.place,[...l.get(f.place)??[],f]);for(let[f,u]of l)c.push(..._t(f,u,{mode:s,shown:a}));return zt(e,c)}export{ie as a,es as b,E as c,Be as d,ts as e,Ue as f,_e as g,gs as h,$s as i,Fs as j,Ls as k,Is as l,Bs as m,Zs as n,eo as o,zt as p,to as q,so as r,oo as s};
@@ -0,0 +1,7 @@
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 P,c as C,e as at}from"./chunk-A55HN5OK.mjs";at();import{isUtf8 as ct}from"node:buffer";import{createHash as lt}from"node:crypto";import{lstatSync as pt,readFileSync as A,realpathSync as F,statSync as mt}from"node:fs";import dt from"node:fs/promises";import y from"node:path";import{isInstance as ft,parseCompound as ut,parsePart as gt,parseSelector as ht,partOf as yt}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as B,NO_TEXT as bt,PACKAGE_ID as J,PACKAGE_MARK as wt,instanceMatch as kt,refusedInCopy as Et,settingState as Ot}from"../browser/shared/components/installed.mjs";import{writeAtomic as St}from"../browser/shared/files.mjs";import{attr as At,walk as vt}from"../browser/shared/html-tree.mjs";import{inLanguage as $t,refusal as Z,said as o,saying as xt,told as Nt}from"../browser/shared/i18n/index.mjs";import{DEVICE_NAMES as Tt,PACKAGE_MANIFEST as w,WORKSPACE_MARK as It,findWorkspace as jt,layoutOf as H,markerOf as _t,packageFolders as Mt}from"../browser/shared/workspace.mjs";var z=1,L=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"],Ct=["at","edit","optional","min","max"],Ft=["generated","attrs"],zt=["text","data","none"],Lt=["parts","text"],Y=["kit.js","style.css","preview.svg"],E="template.html",Rt=[w,E,...Y],v=t=>[...new Set([...Rt,...t])].sort(),Dt=/^(?:[A-Za-z0-9_-][A-Za-z0-9._-]*\/)*[A-Za-z0-9_-][A-Za-z0-9._-]*\.[A-Za-z0-9]+$/,Vt=/^(?:doc-|data-doc-|data-ge-)|^data-block-id$/i,R=256*1024,u=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),f=t=>typeof t=="string"&&t.trim()!=="",$=(t,n)=>t.id<n.id?-1:1,i=t=>{throw Z(t)},g=t=>{let n=lt("sha256");return t(n),n.digest("hex").slice(0,16)};function b(t,n){let s=y.join(t,n);try{let e=pt(s,{throwIfNoEntry:!1});if(!e)return null;if(!e.isSymbolicLink()&&!n.includes("/"))return s;let r=F.native(s);return r.startsWith(F.native(t)+y.sep)?r:null}catch{return null}}function q(t,n){try{let s=b(t,n);return s&&A(s)}catch{return null}}var D=new Map,Kt=2e3;function Wt(t){let{size:n,mtimeMs:s}=mt(t),e=D.get(t);if(e?.size===n&&e.time===s)return e.digest;let r=g(c=>c.update(A(t)));return Date.now()-s>Kt&&D.set(t,{size:n,time:s,digest:r}),r}var x=(t,n)=>g(s=>{for(let e of n){let r=b(t,e),c="none";try{r&&(c=Wt(r))}catch{}s.update(`${e}\0${c}
3
+ `)}}),X=t=>t.toString("utf8").replace(/^\uFEFF/,""),Q=(t,n)=>{t.length>R&&i(o("{0} \u6709 {1} KB\uFF0C\u800C\u6BCF\u4E00\u9875\u90FD\u5E26\u7740\u5B83\uFF0C\u6700\u591A {2} KB",n,Math.ceil(t.length/1024),R/1024))},N=(t,n,s="")=>{for(let e of Object.keys(t))n.includes(e)||i(o("{0} \u4E0D\u662F\u7EC4\u4EF6\u5305\u80FD\u5199\u7684\u5B57\u6BB5",`${s}${e}`))},V=(t,n)=>{for(let s of n)t[s]===void 0&&i(o("\u7F3A\u5C11 {0}",s))},K=(t,n)=>{(!u(t)||!f(t.zh)||!f(t.en)||Object.keys(t).length!==2)&&i(o("{0} \u8981\u5199\u6210 { zh, en } \u4E24\u79CD\u8BED\u8A00\u7684\u6587\u5B57",n))},Gt=t=>t.split(",").map(n=>n.split(">").at(-1).trim()).filter(n=>n!=="*").map(n=>ut(n).tag);function Ut(t,n){let s=`parts.${t}`;u(n)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868",s)),N(n,Ct,`${s}.`),f(n.at)||i(o("\u7F3A\u5C11 {0}",`${s}.at`));try{gt(n.at)}catch(e){i(o("{0} \u5199\u9519\u4E86\uFF1A{1}",`${s}.at`,e.message))}zt.includes(n.edit)||i(o("{0} \u7684 edit \u53EA\u80FD\u662F text\u3001data \u6216 none",s)),n.optional!==void 0&&typeof n.optional!="boolean"&&i(o("{0} \u8981\u5199\u6210 true \u6216 false",`${s}.optional`));for(let e of["min","max"])n[e]!==void 0&&!(Number.isInteger(n[e])&&n[e]>=0)&&i(o("{0} \u8981\u5199\u6210\u4E0D\u5C0F\u4E8E 0 \u7684\u6574\u6570",`${s}.${e}`));if(n.min>n.max&&i(o("{0} \u7684 min \u6BD4 max \u5927\uFF0C\u6CA1\u6709\u5B9E\u4F8B\u80FD\u6EE1\u8DB3",s)),n.edit==="text")for(let e of Gt(n.at))bt.has(e)&&i(o("{0} \u4E0D\u80FD\u6309\u6587\u5B57\u7F16\u8F91\uFF1A<{1}> \u4E0D\u662F\u80FD\u6253\u5B57\u7684\u6587\u5B57",s,e))}var Bt=t=>t.split(",").some(n=>n.split(">").every(s=>[":scope","*"].includes(s.trim())));function Jt(t,n){if(t===void 0)return null;u(t)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime")),N(t,Ft,"runtime.");let s=`[${B}="${n}"]`,e=(l,p)=>{try{if(!f(l))throw new Error("no selector");ht(l)}catch(m){i(o("{0} \u5199\u9519\u4E86\uFF1A{1}",p,m.message))}return l.split(",").map(m=>m.trim().startsWith(":scope")?m.trim().replace(":scope",s):`${s} ${m.trim()}`).join(", ")},{generated:r=[],attrs:c={}}=t;Array.isArray(r)||i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.generated")),u(c)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime.attrs"));for(let l of Object.values(c)){(!Array.isArray(l)||!l.every(f))&&i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.attrs"));for(let p of l)Vt.test(p)&&i(o("{0} \u662F Gallery \u81EA\u5DF1\u7684\u540D\u5B57\uFF0C\u7EC4\u4EF6\u5305\u4E0D\u80FD\u7528",p))}let a=l=>{let p=e(l,"runtime.generated");return Bt(l)&&i(o("{0} \u7684 {1} \u662F\u6574\u4E2A\u5B9E\u4F8B\uFF0C\u800C\u8FD9\u91CC\u53EA\u5199\u5B83\u751F\u6210\u7684\u8282\u70B9","runtime.generated",l)),p};return{generated:r.map(a),attrs:Object.fromEntries(Object.entries(c).map(([l,p])=>[e(l,"runtime.attrs"),p]))}}function Zt(t,n){if(t===void 0)return{kit:[],own:[]};(!Array.isArray(t)||!t.every(f))&&i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","assets"));let s=t.filter(e=>!L.has(e));for(let e of s)Dt.test(e)||i(o("assets \u91CC\u7684 {0} \u65E2\u4E0D\u662F\u5957\u4EF6\u7684\u8D44\u6E90\uFF0C\u4E5F\u4E0D\u662F\u5305\u91CC\u7684\u6587\u4EF6",e)),b(n,e)||i(o("assets \u5199\u4E86 {0}\uFF0C\u5305\u91CC\u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6",e));return{kit:t.filter(e=>L.has(e)),own:s}}function Ht(t,n,s){let e;try{e=JSON.parse(s)}catch(p){i(o("component.json \u4E0D\u662F JSON\uFF1A{0}",p.message))}u(e)||i(o("component.json \u5199\u7684\u4E0D\u662F\u4E00\u4E2A\u5BF9\u8C61")),J.test(t)||i(o("{0} \u4E0D\u80FD\u505A\u7EC4\u4EF6\u5305\u7684 id\uFF1A\u8303\u56F4\u548C\u540D\u5B57\u90FD\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",t));for(let p of t.split("/"))Tt.has(p)&&i(o("{0} \u4E0D\u80FD\u505A\u7EC4\u4EF6\u5305\u7684 id\uFF1A{1} \u662F Windows \u7559\u7ED9\u8BBE\u5907\u7684\u540D\u5B57",t,p));if(e.id!==t&&i(o("\u6E05\u5355\u7684 id \u662F {0}\uFF0C\u548C\u5B83\u7684\u6587\u4EF6\u5939 {1} \u4E0D\u4E00\u6837",String(e.id),t)),V(e,["apiVersion"]),(!Number.isInteger(e.apiVersion)||e.apiVersion<1)&&i(o("apiVersion \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570")),e.apiVersion!==z)throw Z(o("\u8FD9\u4E2A\u7EC4\u4EF6\u5305\u8981 apiVersion {0}\uFF0C\u8FD9\u4E00\u7248 Gallery \u53EA\u652F\u6301 {1}",e.apiVersion,z),{disabled:!0,version:f(e.version)?e.version:null});N(e,Pt),V(e,["version","name","description","parts"]),f(e.version)||i(o("{0} \u8981\u5199\u6210\u6587\u5B57","version")),K(e.name,"name"),K(e.description,"description"),e.words!==void 0&&typeof e.words!="string"&&i(o("{0} \u8981\u5199\u6210\u6587\u5B57","words")),u(e.parts)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","parts"));for(let[p,m]of Object.entries(e.parts))Ut(p,m);let r=Jt(e.runtime,t),{kit:c,own:a}=Zt(e.assets,n);e.markdown!==void 0&&!Lt.includes(e.markdown)&&i(o("markdown \u53EA\u80FD\u662F parts \u6216 text")),e.schema!==void 0&&!(Number.isInteger(e.schema)&&e.schema>=1)&&i(o("schema \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570"));let l=q(n,E);return l&&Q(l,E),{id:t,match:kt(t),parts:e.parts,...r?{runtime:r}:{},...e.schema!==void 0?{schema:e.schema}:{},apiVersion:e.apiVersion,version:e.version,name:e.name,description:e.description,words:e.words??"",assets:c,markdown:e.markdown??"parts",files:[...new Set([...Y.filter(p=>b(n,p)),...a])],template:l&&X(l),folder:n,definition:g(p=>p.update(s)),stamp:x(n,v(a))}}function Yt(t,n){try{let s=q(n,w);return s||i(o("\u8BFB\u4E0D\u51FA component.json")),ct(s)||i(o("{0} \u4E0D\u662F UTF-8 \u7F16\u7801\uFF1A\u8BF7\u5B58\u6210 UTF-8",w)),Q(s,w),Ht(t,n,X(s))}catch(s){let e=xt(s),r=g(c=>c.update(`${x(n,v([]))} ${JSON.stringify(e)}`));return{id:t.toLowerCase(),stamp:r,problem:e,disabled:s.disabled===!0,version:s.version??null}}}var T=()=>jt().root,qt=/^[a-z0-9][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)?$/,W=(t,n)=>[...new Set(Array.isArray(t)?t.filter(s=>typeof s=="string"&&n.test(s)):[])],I=t=>({hidden:W(t?.components?.hidden,qt),disabled:W(t?.components?.disabled,J)}),j=o("gallery.json \u8BFB\u4E0D\u51FA\u6765\uFF1A\u6539\u597D\u8FD9\u4E2A\u6587\u4EF6\u540E\u518D\u8BD5"),Xt=o("gallery.json \u4E0D\u662F Gallery \u7684\u6587\u4EF6");function O(t){if(t===null)return{value:null};let{value:n,ours:s,reads:e}=_t(t);return s?{value:n}:{problem:e?Xt:j}}function Qt(t){try{return O(A(H(t).marker,"utf8"))}catch(n){return n.code==="ENOENT"?O(null):{problem:j}}}var te=["EPERM","EACCES","EBUSY","EROFS"];async function Ee(t,{id:n,hidden:s,disabled:e}){let r=H(t).marker,c=await dt.readFile(r,"utf8").catch(d=>{if(d.code==="ENOENT")return null;i(j)}),{value:a,problem:l}=O(c);l&&i(l);let p=(d,M)=>M===void 0?d:M?[...new Set([...d,n])]:d.filter(it=>it!==n),{hidden:m,disabled:ot}=I(a),rt={...u(a?.components)?a.components:{},hidden:p(m,s),disabled:p(ot,e)};await St(r,`${JSON.stringify({...a??It,components:rt},null,2)}
4
+ `,{expect:c}).catch(d=>{throw te.includes(d.code)&&i(o("gallery.json \u5199\u4E0D\u8FDB\u53BB\uFF1A\u53EF\u80FD\u662F\u53EA\u8BFB\u7684\uFF0C\u6216\u88AB\u522B\u7684\u7A0B\u5E8F\u5360\u7740")),d})||i(o("gallery.json \u521A\u521A\u88AB\u6539\u8FC7\uFF1A\u518D\u8BD5\u4E00\u6B21"))}var ee=t=>({...t,off:!0,disabled:!0,problem:o("\u5728\u8BBE\u7F6E\u91CC\u505C\u7528\u4E86"),stamp:g(n=>n.update(`${t.stamp} off`))}),k=I(null),ne=({packages:t,problems:n,settings:s=k})=>g(e=>{for(let{id:r,stamp:c}of[...t.values(),...n.values()].sort($))e.update(`${r} ${c}
5
+ `);e.update(`hidden ${[...s.hidden].sort().join(" ")}
6
+ `),e.update(`settings ${s.problem?.message??""}
7
+ `)});function se(t,n){let{value:s,problem:e}=Qt(t);return e?{hidden:n.hidden,disabled:n.disabled,problem:e}:I(s)}function oe(t=T(),n=k,{on:s=null}={}){let e=se(t,n),r=new Map,c=new Map;for(let{id:a,folder:l}of Mt(t)){let p=Yt(a,l);(p.problem?c:r).set(p.id,p)}for(let a of r.keys())c.delete(a);for(let a of e.disabled)!r.has(a)||a===s||(c.set(a,ee(r.get(a))),r.delete(a));return{packages:r,problems:c,settings:e,stamp:ne({packages:r,problems:c,settings:e})}}var h=new Map;function Oe(t=T()){let n=y.resolve(t);return h.has(n)||h.set(n,oe(n)),h.get(n)}var Se=(t,n)=>{h.set(y.resolve(t),n)},Ae=(t=T())=>{h.delete(y.resolve(t))},G=(t,n)=>$t(t,()=>Nt(n)),_=t=>({zh:G("zh",t),en:G("en",t)}),ve=({settings:t})=>t.problem?_(t.problem):null,tt=(t,n)=>t.problem?t.disabled?"disabled":"broken":Ot(t.id,n),et=({id:t,match:n,parts:s,runtime:e,schema:r})=>({id:t,match:n,parts:s,...e?{runtime:e}:{},...r!==void 0?{schema:r}:{}}),$e=({packages:t,problems:n})=>[...[...t.values()].map(et),...[...n.values()].map(({id:s,problem:e})=>({id:s,problem:_(e)}))],re=t=>`DocKit.describe(${JSON.stringify(t)});`.replace(/</g,"\\u003c"),S=({id:t,stamp:n},s)=>`/__gallery/components/${t}/${s}?v=${n}`;function ie(t){let n=`${wt}="${t.id}"`,s=e=>t.files.includes(e);return{styles:s("style.css")?[`<link rel="stylesheet" href="${S(t,"style.css")}" ${n}>`]:[],scripts:[`<script ${n}>${re({...et(t),...s("kit.js")?{script:!0}:{}})}</script>`,...s("kit.js")?[`<script src="${S(t,"kit.js")}" ${n}></script>`]:[]]}}var xe=({folder:t},n)=>b(t,n),Ne=({folder:t,files:n})=>x(t,v(n));function U(t,n){let s=C(t,{sourceCodeLocationInfo:!0}).childNodes.filter(r=>r.tagName||r.nodeName==="#text"&&r.value.trim()),[e]=s;return s.length===1&&e.tagName&&ft(e)&&At(e,B)===n&&e.sourceCodeLocation.endTag?e:null}function ae(t,n){let s=U(t,n),e=s&&P(s),r=e&&U(e,n);return r?{markup:e,root:r}:null}function nt({id:t,template:n,parts:s}){if(!n)return{};let e=ae(n,t);if(!e)return{problem:o("template.html \u8981\u662F\u8FD9\u4E2A\u7EC4\u4EF6\u5305\u7684\u4E00\u4E2A\u5B9E\u4F8B\uFF0C\u6709\u81EA\u5DF1\u7684\u7ED3\u675F\u6807\u7B7E\uFF0C\u6B64\u5916\u4EC0\u4E48\u90FD\u6CA1\u6709")};let r=[];if(vt({childNodes:[e.root]},a=>{Et(a.tagName,a.attrs)&&r.push(a.tagName)}),r.length>0)return{problem:o("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",r[0])};let c=Object.entries(s).find(([,a])=>{let l=yt(e.root,a.at).length;return l<(a.optional?0:a.min??1)||l>(a.max??1/0)});return c?{problem:o("template.html \u7684 {0} \u548C\u6E05\u5355\u5199\u7684\u6570\u76EE\u4E0D\u7B26",c[0])}:{markup:e.markup}}var Te=t=>nt(t).problem??null,st=t=>nt(t).markup??null,Ie=({packages:t,settings:n=k})=>[...t.values()].sort($).map(s=>({id:s.id,version:s.version,name:s.name,description:s.description,words:s.words,definition:s.definition,stamp:s.stamp,template:st(s),preview:s.files.includes("preview.svg")?S(s,"preview.svg"):null,state:tt(s,n),markdown:s.markdown,assets:s.assets,tags:ie(s)})),je=({packages:t,problems:n,settings:s=k})=>[...t.values(),...n.values()].sort($).map(e=>({id:e.id,version:e.version??null,name:e.name??null,description:e.description??null,state:tt(e,s),reason:e.problem&&!e.off?_(e.problem):null,template:!!st(e),hidden:s.hidden.includes(e.id),disabled:s.disabled.includes(e.id)})),_e=({hidden:t,disabled:n})=>`settings ${t.join(",")} ${n.join(",")}`;export{Ee as a,ne as b,oe as c,Oe as d,Se as e,Ae as f,G as g,ve as h,$e as i,re as j,ie as k,xe as l,Ne as m,ae as n,Te as o,st as p,Ie as q,je as r,_e as s};
@@ -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{k as et}from"./chunk-QYKCJ7FG.mjs";import{a as nt}from"./chunk-E7VYDG2X.mjs";import L from"node:fs/promises";import rt from"node:path";import{writeAtomic as it}from"../browser/shared/files.mjs";import{documentFiles as wt}from"../browser/shared/workspace.mjs";var mt=s=>L.access(s).then(()=>!0,()=>!1);async function Ct(s,{create:d,slugOf:l,folderOf:p,fill:P,place:O,under:A="",said:c="\u5BFC\u5165\u81EA {0}",lang:M=null}){let E=[],v=[];async function h(f,F,C){let S=await l(f,C);await d(S,f.title,c.replace("{0}",()=>f.from),{lang:M});let R=p(S),{html:J,json:y}=wt(R),$=await L.readFile(J,"utf8");await it(J,et(await P({source:$,nodes:f.nodes,icon:f.icon,own:f.own,raws:f.raws,lang:f.lang}))),f.files.length&&await L.mkdir(rt.join(R,"assets"),{recursive:!0});for(let{from:N,name:T}of f.files){let x=rt.join(R,"assets",T);await mt(x)||await L.copyFile(N,x)}if(f.icon){let N=JSON.parse(await L.readFile(y,"utf8"));await it(y,`${JSON.stringify({...N,icon:f.icon},null,2)}
3
+ `)}await O(S,F),E.push(S);for(let N of f.children??[])await h(N,S,null);return S}for(let[f,F]of s.entries())v.push(await h(F,A,f));return{made:E,top:v}}import{randomBytes as dt}from"node:crypto";import w from"node:fs/promises";import u from"node:path";import{writeAtomic as _}from"../browser/shared/files.mjs";import{sendJson as W}from"../browser/shared/http.mjs";import{said as D,saying as ht}from"../browser/shared/i18n/index.mjs";import{reportsDirectory as pt}from"../browser/shared/paths.mjs";import{listReportSlugs as yt,slugPattern as g}from"../browser/shared/reports.mjs";import{COMPONENTS_FOLDER as Q,DOCUMENT_FOLDERS as kt,PAGE_SLUG as Ot,documentDirectory as jt,documentFiles as Y,layoutOf as gt,listTrash as vt,packageFolders as St,pageSlug as xt,slugTaken as bt,trashIdPattern as at}from"../browser/shared/workspace.mjs";import{MENTION as Et}from"../browser/shared/components/mention.mjs";import{findIn as Nt,reportLines as Pt,tidyQuery as Ft}from"../browser/shared/search.mjs";import{countWords as $t}from"../browser/shared/words.mjs";var Tt=([s,d,l,...p])=>p.length?D("\u68C0\u67E5\u6CA1\u6709\u901A\u8FC7\uFF1A{0}\uFF1B{1}\uFF1B{2} \u7B49 {3} \u6761",s,d,l,p.length+3):l!==void 0?D("\u68C0\u67E5\u6CA1\u6709\u901A\u8FC7\uFF1A{0}\uFF1B{1}\uFF1B{2}",s,d,l):d!==void 0?D("\u68C0\u67E5\u6CA1\u6709\u901A\u8FC7\uFF1A{0}\uFF1B{1}",s,d):D("\u68C0\u67E5\u6CA1\u6709\u901A\u8FC7\uFF1A{0}",s),ot=s=>s==="en"?"en":null;async function H(s,d){for(let l=0;;l++)try{return await w.rename(s,d)}catch(p){if(!["EPERM","EBUSY","EACCES"].includes(p.code))throw p;if(l>=5)break;await new Promise(P=>setTimeout(P,60*(l+1)))}await w.cp(s,d,{recursive:!0,errorOnExist:!0,force:!1}),await w.rm(s,{recursive:!0,force:!0,maxRetries:5})}var At=s=>u.resolve(s);function qt({edits:s,reports:d,reportsDirectory:l=pt,server:p={kind:"dev",version:null,stop:null},components:P=null}){let{trash:O,outline:A}=gt(l),c=(t,n,e)=>[t,{ok:!1,reason:n,...ht(e)}],M=t=>w.readFile(t,"utf8").then(JSON.parse).catch(()=>null),E=t=>jt(t,l),v=t=>Y(E(t)),h=t=>u.join(l,t),f=t=>T(Y(h(t)).html),F=async t=>{let n=await w.readdir(h(t),{withFileTypes:!0});if(t!==Q)return n.map(({name:r})=>r);let e=new Set(St(l).map(({id:r})=>r.split("/")[0]));return n.filter(r=>r.isFile()||kt.includes(r.name)&&!e.has(r.name)).map(({name:r})=>r)},C=async(t,n,e)=>{await w.mkdir(e,{recursive:!0});let r=[];try{for(let i of t)await H(u.join(n,i),u.join(e,i)),r.push(i)}catch(i){for(let a of r)await H(u.join(e,a),u.join(n,a));throw i}},S=async(t,n)=>{if(t!==Q)return H(h(t),n);await C(await F(t),h(t),n),await w.rmdir(h(t)).catch(()=>{})},R=async(t,n)=>t===Q&&!await f(t)&&(await Promise.all((await w.readdir(n)).map(e=>T(u.join(h(t),e))))).every(e=>!e),J=async t=>await M(Y(t).json)??{},y=async t=>{let{title:n=t,description:e="",type:r,instructions:i,icon:a}=await J(E(t));return{slug:t,title:n,description:e,...r?{type:r}:{},...typeof a=="string"&&a?{icon:a}:{},...i===!0?{instructions:!0}:{}}},$=()=>xt(l),N=async(t,n)=>{let e=await J(E(t));await _(v(t).json,`${JSON.stringify({...e,[n]:!0},null,2)}
4
+ `)},T=t=>w.access(t).then(()=>!0,()=>!1),x=async(t,{own:n=null}={})=>{let e=new Set((await B()).map(({slug:r})=>r));e.delete(n);for(let r=1;;r++){let i=r===1?t:`${t}-${r}`;if(!bt(i,l)&&!e.has(i))return i}},z=async(t,n)=>{let e=v(t).html,r=await w.readFile(e,"utf8"),i=nt(r).replace(`data-doc-id="${n}"`,`data-doc-id="${t}"`);i!==r&&await _(e,i)};async function b(){let t=await $(),n=(await yt(l)).filter(o=>o!==t),e=await M(A),r={"":[]},i=new Set,a=o=>{for(let k of e?.children?.[o]??[])!n.includes(k)||i.has(k)||(i.add(k),(r[o]??=[]).push(k),a(k))};a("");for(let o of n)i.has(o)||r[""].push(o);return{version:1,children:r}}function st(t){let n=t?.children;if(!n||typeof n!="object"||Array.isArray(n))return!1;let e=new Set;for(let[r,i]of Object.entries(n)){if(r!==""&&!g.test(r)||!Array.isArray(i))return!1;for(let a of i){if(typeof a!="string"||!g.test(a)||e.has(a)||a===r)return!1;e.add(a)}}return!0}let G=async t=>(await w.mkdir(u.dirname(A),{recursive:!0}),_(A,`${JSON.stringify({version:1,children:t.children},null,2)}
5
+ `));async function U(t,n="",e=1/0){let r=await b();for(let o of Object.values(r.children))o.includes(t)&&o.splice(o.indexOf(t),1);let i=n!==t&&(n===""||Object.values(r.children).some(o=>o.includes(n))),a=r.children[i?n:""]??=[];a.splice(Math.max(0,Math.min(e,a.length)),0,t),await G(r)}async function ct(t){let n=await b();for(let[e,r]of Object.entries(n.children)){let i=r.indexOf(t);if(!(i<0))return r.splice(i,1,...n.children[t]??[]),delete n.children[t],await G(n),{parent:e,index:i}}return{parent:"",index:1/0}}let V=new Map;async function ut(t,n){let e=v(t).html,r=await w.stat(e).catch(()=>null);if(!r)return null;let i=V.get(t);if(i?.at===r.mtimeMs&&(i.titles===null||i.titles===n))return i.lines;let a=(await s.read(t))?.text??"",o=Pt(d.words(a,t));return V.set(t,{at:r.mtimeMs,titles:a.includes(Et)?n:null,lines:o}),o}let X=t=>M(u.join(O,t,"entry.json")),B=()=>vt(l),Z={info:async()=>[200,{ok:!0,version:1,gallery:p.version,token:s.token,commands:[...Object.keys(K)],server:{pid:process.pid,workspace:u.resolve(l),kind:p.kind}}],async outline(){let t=await b(),n=await $(),e=[...Object.values(t.children).flat(),...n?[n]:[]],r=async i=>[i,await y(i)];return[200,{ok:!0,outline:t,instructions:n,reports:Object.fromEntries(await Promise.all(e.map(r))),trash:await B()}]},trash:async()=>[200,{ok:!0,entries:await B()}],async stats(t){let n=t.get("slug")??"",e=g.test(n)?v(n).html:"",[r,i]=g.test(n)?await Promise.all([w.stat(e),s.read(n)]).catch(()=>[]):[];return!r||!i?c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863"):[200,{ok:!0,edited:Math.round(r.mtimeMs),words:$t(i.text)}]},components:async()=>[200,{ok:!0,...P.read()}],async source(t){let n=t.get("slug")??"";if(!g.test(n))return c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863");let e=u.resolve(v(n).html);return await T(e)?[200,{ok:!0,path:e}]:c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863")},async search(t){let n=Ft(t.get("q")??"");if(!n)return[200,{ok:!0,results:[]}];let{children:e}=await b(),r=[],i=m=>(e[m]??[]).forEach(j=>{r.push(j),i(j)});i("");let a=n.toLowerCase(),o=new Map(await Promise.all(r.map(async m=>[m,await y(m)]))),k=JSON.stringify([...o].map(([m,{title:j}])=>[m,j])),I=(await Promise.all(r.map(async m=>{let j=await ut(m,k);if(!j)return null;let q=String(o.get(m).title).toLowerCase().includes(a),{count:tt,hits:ft}=Nt(j,n);return q||tt?{slug:m,title:q,count:tt,hits:ft}:null}))).filter(Boolean);return I.sort((m,j)=>Number(j.title)-Number(m.title)||j.count-m.count),[200,{ok:!0,results:I.slice(0,50)}]}},K={async outline({outline:t}){return st(t)?(await G(t),[200,{ok:!0,outline:await b()}]):c(400,"outline","\u6587\u6863\u76EE\u5F55\u7684\u7ED3\u6784\u4E0D\u5BF9\uFF1A\u6BCF\u4EFD\u6587\u6863\u53EA\u80FD\u51FA\u73B0\u4E00\u6B21")},async create({title:t,description:n,parent:e="",language:r}){let i=typeof t=="string"&&t.trim()?t.trim():"\u672A\u547D\u540D\u6587\u6863",a=await x("doc");return await d.create(a,i,typeof n=="string"&&n.trim()?n.trim():"\u65B0\u6587\u6863",{lang:ot(r)}),await U(a,typeof e=="string"?e:""),[200,{ok:!0,report:await y(a)}]},async instructions({title:t,description:n,language:e}){let r=await $();if(r)return[200,{ok:!0,report:await y(r)}];let i=await x(Ot),a=(o,k)=>typeof o=="string"&&o.trim()?o.trim().slice(0,200):k;return await d.create(i,a(t,"\u5199\u4F5C\u504F\u597D"),a(n,"Agent \u6BCF\u6B21\u5199\u62A5\u544A\u524D\u90FD\u4F1A\u5148\u8BFB\u7684\u5199\u4F5C\u504F\u597D"),{lang:ot(e),page:!0}),await N(i,"instructions"),[200,{ok:!0,report:await y(i)}]},async components({id:t,hidden:n,disabled:e}){try{return[200,{ok:!0,...await P.write({id:t,hidden:n,disabled:e})}]}catch(r){return c(409,"components",r)}},async duplicate({slug:t,suffix:n}){if(typeof t!="string"||!g.test(t)||!await f(t))return c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863");let e=await x(`${t}-copy`),r=new Set(["",...await F(t)]);await w.cp(h(t),h(e),{recursive:!0,errorOnExist:!0,filter:m=>r.has(u.relative(h(t),m).split(u.sep)[0])}),await z(e,t);let{title:i}=await y(t),a=await s.renameReport(e,`${i}${typeof n=="string"&&n.length>0&&n.length<=20?n:"\uFF08\u526F\u672C\uFF09"}`),o=await b(),[k,I]=Object.entries(o.children).find(([,m])=>m.includes(t))??["",null];return await U(e,k,I?I.indexOf(t)+1:1/0),[200,{ok:!0,report:await y(e),notes:a.notes??[]}]},async rename({slug:t,title:n}){if(typeof t!="string"||!g.test(t))return c(400,"slug","\u6587\u6863\u540D\u4E0D\u5BF9");let e=await s.renameReport(t,n);return e.ok?[200,{ok:!0,report:await y(t),notes:e.notes}]:c({title:400,missing:404}[e.reason]??409,e.reason,e.message??"\u6539\u540D\u6CA1\u6709\u6210\u529F")},async trash({slug:t}){if(typeof t!="string"||!g.test(t))return c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863");if(t===await $())return c(409,"instructions","\u5199\u4F5C\u504F\u597D\u4E0D\u80FD\u79FB\u5230\u56DE\u6536\u533A");if(!await f(t))return c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863");let{title:n}=await y(t),e=`${Date.now().toString(36)}-${dt(3).toString("hex")}`,r=await b(),{parent:i,index:a}=await ct(t);try{await w.mkdir(u.join(O,e),{recursive:!0}),await S(t,u.join(O,e,"report"))}catch(k){throw await G(r),await w.rm(u.join(O,e),{recursive:!0,force:!0}).catch(()=>{}),k}let o={id:e,slug:t,title:n,at:Date.now(),parent:i,index:Number.isFinite(a)?a:-1};return await _(u.join(O,e,"entry.json"),`${JSON.stringify(o,null,2)}
6
+ `),[200,{ok:!0,entry:o}]},async restore({id:t}){let n=typeof t=="string"&&at.test(t)?await X(t):null;if(!n)return c(404,"missing","\u56DE\u6536\u533A\u91CC\u6CA1\u6709\u8FD9\u4E00\u9879");let e=u.join(O,t,"report"),r=await R(n.slug,e),i=r?n.slug:await x(n.slug,{own:n.slug});return r?await C(await w.readdir(e),e,h(i)):await H(e,h(i)),i!==n.slug&&await z(i,n.slug),await w.rm(u.join(O,t),{recursive:!0,force:!0}),await U(i,n.parent,n.index<0?1/0:n.index),[200,{ok:!0,report:await y(i),entry:{...n,slug:i}}]},async destroy({id:t}){return typeof t!="string"||!at.test(t)||!await X(t)?c(404,"missing","\u56DE\u6536\u533A\u91CC\u6CA1\u6709\u8FD9\u4E00\u9879"):(await w.rm(u.join(O,t),{recursive:!0,force:!0}),[200,{ok:!0}])},async export({slug:t}){if(typeof t!="string"||!g.test(t)||!await T(E(t)))return c(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863");let{problems:n=[],file:e,refused:r}=await d.export(t);return r?c(r.reason==="missing"?404:409,r.reason,r.message):n.length?c(422,"check",Tt(n)):[200,{ok:!0,path:At(e)}]}};function lt(t,n,e){if(t.method==="GET"&&Object.hasOwn(Z,e)){let r=t.headers.host??"",i=t.socket.localPort;return r!==`127.0.0.1:${i}`&&r!==`localhost:${i}`?W(n,403,{ok:!1,reason:"host"}):Z[e](new URL(t.url??"/","http://localhost").searchParams).then(([a,o])=>W(n,a,o),a=>W(n,...c(500,"read",a)))}return t.method==="POST"&&e==="stop"?s.respond(async r=>{let i=await s.check(r);return i.error?i.error:p.kind!=="cli"||typeof p.stop!="function"?c(409,"dev","\u8FD9\u662F npm run dev \u7684\u670D\u52A1\u5668\uFF1A\u5728\u8FD0\u884C\u5B83\u7684\u5730\u65B9\u505C\u6B62\u5B83"):(n.once("finish",()=>p.stop()),[200,{ok:!0,pid:process.pid}])})(t,n):t.method==="POST"&&Object.hasOwn(K,e)?s.respond(async r=>{let i=await s.check(r);return i.error?i.error:K[e](i.body&&typeof i.body=="object"?i.body:{})})(t,n):W(n,404,{ok:!1,reason:"unknown"})}return{handle:lt,outline:b,trashEntries:B,place:U,freeSlug:x}}export{Ct as a,qt 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
+ var n=!!(typeof process<"u"&&process.version),o={value:{followSymlinks:!0,ScreenRecorder:class{constructor(){throw new Error("ScreenRecorder is not available in this environment")}},readFile:(()=>{throw new Error("readFile is not available in this environment")}),writeFile:()=>{throw new Error("writeFile is not available in this environment")},openFileForWriting:()=>{throw new Error("openFileForWriting is not available in this environment")},createWriteStream:()=>{throw new Error("createWriteStream is not available in this environment")},mkdir:()=>{throw new Error("mkdir is not available in this environment")}}};var d={cdpSend:"puppeteer:protocol:SEND \u25BA",cdpReceive:"puppeteer:protocol:RECV \u25C0",bidiSend:"puppeteer:webDriverBiDi:SEND \u25BA",bidiReceive:"puppeteer:webDriverBiDi:RECV \u25C0",error:"puppeteer:error",ffmpeg:"puppeteer:ffmpeg"},v=i=>{if(n){let r=o.value.debuglog?.(i);return!r||!r.enabled?void 0:(...t)=>{r(...t)}}let e=globalThis.__PUPPETEER_DEBUG;if(!(!e||!(e==="*"||(e.endsWith("*")?i.startsWith(e.slice(0,-1)):i===e))))return(...r)=>{console.log(`${i}:`,...r)}};export{n as a,o as b,d as c,v as d};
@@ -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 L,b as N,c as O,d as T,e as I}from"./chunk-7GHT2UCA.mjs";import{f as k}from"./chunk-QMQUXTU4.mjs";import{k as p}from"./chunk-QYKCJ7FG.mjs";import{b as x,d as S,e as b,f as d,g as v,h as D,i as j}from"./chunk-5FRMCDPY.mjs";import{a as y}from"./chunk-E7VYDG2X.mjs";import f from"node:path";import{editStateDirectory as M,reportsDirectory as h}from"../browser/shared/paths.mjs";import{findPreviewServer as P}from"../browser/shared/preview-server.mjs";import{documentDirectory as A,documentFiles as E,isDocumentSource as B}from"../browser/shared/workspace.mjs";var m=t=>f.resolve(t),G=t=>f.basename(E(f.dirname(t)).json),_={busy:"it kept changing while it was being written (an Agent writing it?); nothing written. Run the export again.",timeout:"the workspace's Gallery server did not answer in 30s; nothing written. Run the export again."};async function F(t,e,n="hand-in"){let a=`127.0.0.1:${t.port}`,o;try{o=await fetch(`http://${a}/__gallery/edit/${n}`,{method:"POST",headers:{"Content-Type":"application/json",Origin:`http://${a}`,"X-Gallery-Token":t.token},body:JSON.stringify({slug:e,workspace:h}),signal:AbortSignal.timeout(3e4)})}catch(s){return s.name==="TimeoutError"?{ok:!1,reason:"timeout"}:null}let i=await o.json().catch(()=>null);return typeof i?.ok!="boolean"||["elsewhere","token","host","origin"].includes(i.reason)?null:i}async function te(t){let e=await P({reportsDirectory:h}),n=null,a=[],o=new Map,i=[];for(let s of t){let{html:l,json:c}=E(A(s,h)),r=e?await F(e,s):null;if(r===null&&(n??=I({reportsDirectory:h,stateDirectory:M,finish:p}),r=await n.handIn(s),r.ok&&await n.settleNotes(s)),!r.ok){r.reason!=="missing"&&o.set(s,[`${m(l)} was not handed in: ${_[r.reason]??r.message??r.reason}`]);continue}if(r.repeated?.length){o.set(s,k(r.repeated));continue}i.push(...$(l,r)),r.written&&(r.changes.length&&i.push(...d(l,r.changes,{reread:!1})),r.added&&i.push(...g(l,r.given,r.added)),a.push(m(l))),C(r)&&a.push(m(c))}return{written:a,failures:o,lines:i}}async function ne(t){let e=await P({reportsDirectory:h});if(e){for(let n of t)if(await F(e,n,"settle")===null)return}}var C=({title:t=null,icon:e=null})=>!!(t&&typeof t.from=="string"&&t.from!==t.to||e&&!e.missing),R=10;function g(t,e,n=e?.length??0,{pending:a=!1}={}){let o=`${n} block${n===1?"":"s"}`;if(a){let s=[`ids ${m(t)}: ${o} without an id yet: the export gives ${n===1?"it":"each"} one`];return n>R?s:[...s,...e.map(({line:l,tag:c})=>` line ${l} ${c}`)]}let i=[`ids ${m(t)}: ${o} given an id`];return!e||n>R?i:[...i,...e.map(({line:s,tag:l,id:c})=>` line ${s} ${l} \u2192 ${c}`)]}function $(t,{title:e=null,icon:n=null}={},{pending:a=!1}={}){let o=m(f.dirname(t)),i=G(t),s=(c,r,w)=>a?`${c} not ${r} yet (${w}): the export writes ${c.includes(" and ")?"them":"it"}`:`${c} written ${r}: ${w}`,l=[];if(e){let c=[...e.page?["<title>"]:[],...typeof e.from=="string"&&e.from!==e.to?[`${i}'s title`]:[]];c.length&&l.push(`title ${o}: ${s(c.join(" and "),"as its h1 says it",JSON.stringify(e.to))}`)}return n?.missing?l.push(`icon ${o}: ${i} has the icon ${JSON.stringify(n.from)} and the page's header none: write it there (<div class="doc-icon">\u2026</div> before the h1) or take "icon" out of ${i} (the export leaves ${i}'s as it is)`):n&&l.push(`icon ${o}: ${s(`${i}'s icon`,"as its header has it",n.to===null?"none":JSON.stringify(n.to))}`),l}function oe(t,{by:e="this export"}={}){let n=t.length===1,a=[...t.filter(o=>B(f.basename(o))).map(o=>f.basename(o)).filter((o,i,s)=>s.indexOf(o)===i).map(o=>`${o}: the kit's markup, block ids`),...t.filter(o=>/^(doc|report)\.json$/.test(f.basename(o))).map(o=>f.basename(o)).filter((o,i,s)=>s.indexOf(o)===i).map(o=>`${o}: the title or icon said above`)];return`Re-read ${t.join(", ")} before editing ${n?"it":"them"}: ${e} wrote ${n?"it":"them"} (${a.join("; ")}).`}import H from"node:path";import{FILE as W}from"../browser/shared/annotations.mjs";import{editStateDirectory as J,reportsDirectory as u}from"../browser/shared/paths.mjs";import{documentDirectory as K,documentFiles as X}from"../browser/shared/workspace.mjs";function ue({say:t=!0}={}){return e=>{let{text:n,changes:a}=x(e.html,{finish:p});if(t&&a.length&&console.log(d(e.htmlPath,a,{pending:!0}).join(`
3
+ `)),t){let o=S(e.html);o.length&&console.log(g(e.htmlPath,o,o.length,{pending:!0}).join(`
4
+ `));for(let i of $(e.htmlPath,b(y(e.html),e.metadata),{pending:!0}))console.log(i)}return n}}function ge(t){for(let e of t){for(let n of v(e.html))console.log(`note ${e.slug}: ${n} (read-only in the preview)`);for(let n of D(e.html))console.log(`note ${e.slug}: ${n}`);for(let n of j(e.html))console.log(`note ${e.slug}: ${n}`)}}async function $e(t){for(let e of t){let n=await O({stateDirectory:J,reportsDirectory:u,slug:e});for(let a of T(X(K(e,u)).html,n))console.log(a)}}async function we(t){for(let e of t){let n=await L({stateDirectory:J,reportsDirectory:u,slug:e});for(let a of N(H.join(K(e,u),W),n))console.log(a)}}export{te as a,ne as b,oe as c,ue as d,ge as e,$e as f,we as g};
@@ -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{c as o}from"./chunk-W7XHE4CT.mjs";var i=class r{static create(e,n,s,c){return new Promise((a,l)=>{let t=new WebSocket(e);t.addEventListener("open",()=>a(new r(t,s))),t.addEventListener("error",l)})}#e;#s;onmessage;onclose;constructor(e,n){this.#e=e,this.#s=n,this.#e.addEventListener("message",s=>{this.onmessage&&this.onmessage.call(null,s.data)}),this.#e.addEventListener("close",()=>{this.onclose&&this.onclose.call(null)}),this.#e.addEventListener("error",()=>{this.#s?.(o.error)})}send(e){this.#e.send(e)}close(){this.#e.close()}};export{i as a};
@@ -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
+ var e="25.12.0";export{e as a};
@@ -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 te,f as ne,n as se}from"./chunk-3LA3EMDE.mjs";import{b as A,d as oe}from"./chunk-2PBALTR3.mjs";import{a as N}from"./chunk-TX6JH7TR.mjs";import"./chunk-LC7YNQFG.mjs";import"./chunk-ITNLYXXV.mjs";import"./chunk-ZBIM6ARY.mjs";import"./chunk-NSKUTQ5J.mjs";import{a as J,i as X,r as Z}from"./chunk-QMQUXTU4.mjs";import{d as Y,e as q,i as j,j as V,k as W}from"./chunk-HQQMJCQJ.mjs";import{a as $}from"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import{a as D,c as x}from"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import{b as ee,g as R}from"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import{c as Q}from"./chunk-NFIBI4IP.mjs";import{c as K,e as G,g as P,o as H}from"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{isUtf8 as ke}from"node:buffer";import ue from"node:fs";import E from"node:path";import{instancesOf as _,isInstance as Le,partOf as fe}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as y,refusedInCopy as Se}from"../browser/shared/components/installed.mjs";import{attr as T,elementsOf as de,walk as I}from"../browser/shared/html-tree.mjs";import{blankedCss as v}from"../browser/shared/css-references.mjs";import{ATTRIBUTE as ce}from"../browser/shared/components/installed.mjs";var $e=new Set(["media","supports","container","layer","starting-style"]);function F(t,e){let n=0,s="";for(let o=0;o<t.length;o++){let i=t[o];i==="\\"?o++:s?s=i===s?"":s:i==='"'||i==="'"?s=i:i===")"||i==="]"?n--:(n===0&&e(i,o),(i==="("||i==="[")&&n++)}}function be(t){let e=v(t),n=v(t,{strings:!0}),s={children:[]},o=[s],i=0,a=0;for(let r=0;r<e.length;r++){let c=e[r];if(c==="\\")r++;else if(c==="("||c==="[")a++;else if(c===")"||c==="]")a=Math.max(0,a-1);else{if(a>0)continue;if(c==="{"){let l={prelude:n.slice(i,r),start:i,children:[]};o.at(-1).children.push(l),o.push(l),i=r+1}else c==="}"?(o.length>1&&o.pop(),i=r+1):c===";"&&(i=r+1)}}return s.children}function ie(t){let e=[],n=0;return F(t,(s,o)=>{s===","&&(e.push({text:t.slice(n,o),start:n}),n=o+1)}),e.push({text:t.slice(n),start:n}),e.filter(({text:s})=>s.trim())}function he(t){let e=[],n=t.trim(),s="",o=0,i=0,a=r=>{(i||r)>o&&e.push({combinator:s,compound:n.slice(o,i||r)}),i=0};return F(n,(r,c)=>{/\s/.test(r)?c===o?o=c+1:i||=c:">+~".includes(r)?(a(c),s=r,o=c+1):i&&(a(c),s=" ",o=c)}),a(n.length),e}function re(t){let e=[],n=-1,s=0,o="";for(let a=0;a<t.length;a++){let r=t[a];r==="\\"?a++:o?o=r===o?"":o:r==='"'||r==="'"?o=r:r==="("?s++:r===")"?s--:r==="["&&s===0?n=a:r==="]"&&s===0&&n>=0&&(e.push(t.slice(n,a+1)),n=-1)}let i=!1;return F(t,a=>{i||=a==="&"}),{attributes:e,nesting:i,scope:/(?:^|[^\w-]):scope\b/.test(t)}}var ye=t=>new RegExp(`^\\[\\s*${ce}\\s*=\\s*(["'])${t.replace(/[/-]/g,"\\$&")}\\1\\s*i?\\s*\\]$`,"i"),xe=t=>v(t).replace(/\\.|\[[^\]]*\]/g,"").includes("&");function ae(t,e,n){let s=he(t),o=({compound:l})=>re(l).attributes.some(h=>e.test(h)),i=({compound:l})=>{let{nesting:h,scope:u}=re(l);return!!n&&(h||u)},a=l=>["+","~"].includes(l?.combinator),r=s.findLastIndex(l=>o(l)||i(l));if(r<0)return!n||xe(t)?{why:"outside"}:{why:n==="instance"&&a(s[0])?"beside":null,subject:"inside"};let c=o(s[r])||n==="instance";return{why:c&&a(s[r+1])?"beside":null,subject:c&&r===s.length-1?"instance":"inside"}}var le=t=>t.some(({subject:e})=>e==="instance")?"instance":"inside";function pe(t,e){let n=ye(e),s=`[${ce}="${e}"]`,o=[],i=(r,c,l)=>{let h=c.replace(/\s+/g," ").trim();o.push({line:x(t,r),what:l==="beside"?`${h} reaches what stands beside the instance: what it styles has to stand in it`:`${h} reaches outside the instance: start it at ${s}`})},a=(r,c)=>{for(let l of r){let h=l.prelude.length-l.prelude.trimStart().length,u=l.start+h,p=/^@([\w-]+)\s*/.exec(l.prelude.trim());if(p){let f=p[1].toLowerCase();if($e.has(f))a(l.children,c);else if(f==="page")o.push({line:x(t,u),what:"@page reaches the paper of the whole document: an instance has no page of its own"});else if(f==="scope"){let d=/^@scope\s*\(([^)]*)\)/i.exec(l.prelude.trim())?.[1]??"",g=ie(d).map(({text:w})=>({...ae(w,n,c),steps:he(w).length}));d&&g.every(({why:w,steps:S})=>!w&&S===1)?a(l.children,le(g)):i(u,l.prelude,"outside")}continue}let m=ie(l.prelude).map(({text:f,start:d})=>{let g=ae(f,n,c);return g.why&&i(l.start+d+f.length-f.trimStart().length,f,g.why),g});m.some(({why:f})=>f)||a(l.children,le(m))}};return a(be(t),null),o}var b="template.html",k="example.html",C="component.json",Ee=new Set(["localStorage","sessionStorage"]),Oe=/^\S+: (?:line \d+ of )?its (?:kit\.js|style\.css) /,je=/(?: (?: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: .*$/,Ne=": 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",Ae=t=>t.replace(je,e=>(e.startsWith("external")?e:"")+Ne),L=(t,e)=>j({folder:t},e);function O(t,e){let n=null;try{n=ue.readFileSync(E.join(t,e))}catch{return null}return ke(n)?null:{file:e,what:"it is not UTF-8: save it as UTF-8 (PowerShell's > writes UTF-16; Set-Content -Encoding utf8 does not)"}}function z(t,e){let n=/^line (\d+): | \(line (\d+)\)/.exec(e);return n?{file:t,line:Number(n[1]??n[2]),what:e.replace(n[0],"")}:{file:t,what:e}}function U(t,e){let n=$.parseJsonText(C,t),s=n.statements[0]?.expression,o=null;for(let i of e.split(".")){let a=s?.properties?.find(({name:r})=>r?.text===i);if(!a)break;o=n.getLineAndCharacterOfPosition(a.getStart(n)).line+1,s=a.initializer}return o}function Te(t,{message:e,text:n="",values:s=[]}){let o=/at position (\d+)/.exec(e)?.[1];if(o)return x(t,Number(o));for(let i of[...s.map(String),...n.match(/[a-zA-Z][\w.]*/g)??[]]){let a=U(t,i);if(a)return a}return null}var Ce=t=>R(t).map(e=>/^line (\d+): <([^>]+)>: ([\s\S]*)$/.exec(e)).filter(Boolean).map(([,e,n,s])=>({line:Number(e),tag:n,why:s}));function Ie(t,{file:e,tree:n,html:s}){let o=[],i=Ce(s),a=Object.entries(t.parts).filter(([,l])=>l.edit==="text"),r=Object.entries(t.parts).filter(([,l])=>l.edit==="data"),c=(l,h)=>{let u=!1;return I(l,p=>{u||=p===h}),u};for(let l of _(n,t))for(let[h,u]of a)for(let p of fe(l,u.at)){let m=p.sourceCodeLocation?.startLine,f=de(p).find(w=>Q.has(w.tagName)),d=i.find(w=>w.line===m&&w.tag===p.tagName),g=r.find(([,w])=>fe(l,w.at).some(S=>S===p||c(S,p)||c(p,S)))?.[0];g?o.push({file:e,line:m,what:`the part ${h} (${u.at}) is edited as text, and stands in the part ${g}, edited as data, or around it, which is the component's: the editor leaves it read-only: name elements apart`}):f?o.push({file:e,line:m,what:`the part ${h} (${u.at}) is edited as text and holds a block, its <${f.tagName}> at line ${f.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 (${u.at} > ${f.tagName}), or give each block a part of its own`}):d&&o.push({file:e,line:m,what:`the part ${h} (${u.at}) is edited as text, and the editor would leave it read-only for what it holds: ${d.why}. A text part holds words and marks alone`})}return o}var ge="(?:(?:[zcs]h|[bpmfdtnlgkhjqxrzcsyw])?(?:[iuv]?(?:a(?:i|o|ng?)?|e(?:i|r|ng?)?|o(?:u|ng)?)|i(?:u|ng?)?|u(?:i|n)?|vn?))",Pe=new RegExp(`^${ge}$`,"i"),Re=new RegExp(`^${ge}{1,8}$`,"i"),M=new RegExp("\\p{Script=Han}","u"),ve=6,we=t=>[...t].filter(e=>M.test(e)).length;function Fe(t){let e=t.replaceAll("'",""),n=[0,...Array(e.length).fill(1/0)];for(let s=1;s<=e.length;s++)for(let o=Math.max(0,s-ve);o<s;o++)n[o]+1<n[s]&&Pe.test(e.slice(o,s))&&(n[s]=n[o]+1);return e&&Number.isFinite(n[e.length])?n[e.length]:null}function ze({name:t,words:e}){let n=we(t.zh),s=e.split(/\s+/).filter(Boolean);return n===0?M.test(e)&&!s.some(o=>Re.test(o)):!s.some(o=>Fe(o.toLowerCase())===n)}function Be({id:t,folder:e,catalog:n,off:s,parts:o}){let i=n.packages.get(t),a=n.problems.get(t)?.problem,r=L(e,C)??"",c=[];a&&c.push({file:C,line:Te(r,a),what:P("en",a)}),i?.template===null&&c.push({file:b,what:`there is none, and it is what "/" puts in a document: with none, no menu offers the block: write one <div ${y}="${t}"> with what a new instance holds`}),c.push(...o);let l=O(e,"writing.md");l&&c.push(l);let h=l||L(e,"writing.md")?.trim()?[]:[{file:"writing.md",what:"there is none, so gallery component show has nothing to say of how to write it"}];return i&&ze(i)&&h.push({file:C,line:U(r,"words")??U(r,"name.zh"),what:M.test(i.name.zh)?`no word of words spells its whole name ${i.name.zh} in pinyin as an input method composes it, its ${we(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)'}),s&&h.push({file:"gallery.json",what:"the user turned it off in \u8BBE\u7F6E \u203A \u7EC4\u4EF6, which is theirs to change and says nothing of the package: it is checked as if it were on, and the instances of a document show what they hold, read-only, until it is on"}),{title:"manifest",problems:c,notes:h}}function Ue(t){let e=$.createSourceFile("kit.js",t,$.ScriptTarget.Latest,!0,$.ScriptKind.JS),n=[],s=o=>{let i=$.isCallExpression(o)&&$.isPropertyAccessExpression(o.expression)?o.expression:null;if(i?.name.text==="component"&&/\bDocKit$/.test(i.expression.getText(e))){let[a]=o.arguments,r=a&&$.isObjectLiteralExpression(a)?a.properties.find(l=>l.name?.getText(e)==="id"):null,c=r&&$.isPropertyAssignment(r)&&$.isStringLiteralLike(r.initializer)?r.initializer.text:null;n.push({id:c,at:o.getStart(e)})}$.forEachChild(o,s)};return s(e),n}function _e(t){let e="kit.js";if(!t.files.includes("kit.js"))return{title:e,none:"none: a static block"};let n=O(t.folder,e);if(n)return{title:e,stops:!0,problems:[n]};let s=j(t,"kit.js")??"",o=J(s);if(o)return{title:e,stops:!0,problems:[{file:e,line:o.line,what:`a browser refuses it: ${o.message}`}]};let i=W(t).map(({line:l,what:h})=>({file:e,line:l,what:h})),a=i.length>0;for(let{name:l,at:h}of Y(s,Ee))i.push({file:e,line:x(s,h),what:`uses ${l}: an instance keeps what a reader chose with context.state`});let r=Ue(s);for(let{id:l,at:h}of r)l!==null&&l!==t.id&&i.push({file:e,line:x(s,h),what:`it registers ${l}, and this package is ${t.id}`});let c=r.length?[]:[{file:e,what:`no DocKit.component({ id: "${t.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:l,code:h,message:u,refused:p}of q(s,{assets:t.assets}))(p?i:c).push({file:e,line:l,what:`TS${h}: ${u}`});return{title:e,stops:a,problems:i.sort((l,h)=>(l.line??0)-(h.line??0)),notes:c}}function Me(t){let e="style.css";if(!t.files.includes("style.css"))return{title:e,none:"none"};let n=O(t.folder,e);if(n)return{title:e,stops:!0,problems:[n]};let s=j(t,"style.css")??"",o=V(t),i=[...pe(s,t.id),...o].map(({line:a,what:r})=>({file:e,line:a,what:r}));return{title:e,stops:o.length>0,problems:i.sort((a,r)=>a.line-r.line)}}function De(t,{tree:e}){let n=null;I(e,r=>{n??=r.tagName==="main"?r:null});let s=de(n??{}),o=(n?.childNodes??[]).some(r=>r.nodeName==="#text"&&r.value.trim()),[i]=s;if(s.length!==1||o||!Le(i)||T(i,y)!==t)return[{file:b,line:i?.sourceCodeLocation?.startLine,what:`a template is one element, a <div ${y}="${t}"> or a <section>, and it holds ${s.length===1&&!o?`<${i.tagName}${T(i,y)?` ${y}="${T(i,y)}"`:""}>`:`${s.length} element${s.length===1?"":"s"}${o?" and words":""}`}`}];let a=[];return I({childNodes:[i]},r=>{T(r,"data-block-id")!==void 0&&a.push({file:b,line:r.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"})}),a}function Ke(t,{tree:e}){let n=H(t);if(!n)return[];let[s]=_(e,t),o=null;return s&&I({childNodes:[s]},i=>{Se(i.tagName,i.attrs)&&(o??=i)}),[{file:b,line:(o??s)?.sourceCodeLocation?.startLine,what:P("en",n)}]}function Ge(t){return[[b,"component-template"],[k,"component-example"]].flatMap(([e,n])=>{let s=L(t,e);if(s===null||!s.trim()||O(t,e))return[];let o=ne(n,s),{text:i}=ee(o);return[{file:e,slug:n,written:o,html:i,tree:D(i)}]})}function He({id:t,folder:e,found:n,pages:s,parts:o}){let i="template.html and example.html",a=[],r=[];for(let p of[b,k]){let m=O(e,p);m?a.push(m):p===b&&!L(e,p)?.trim()&&n.template!==null?a.push({file:p,what:"it is empty"}):p===k&&!s.some(f=>f.file===p)&&a.push({file:p,what:`there is none or it is empty: write an instance as a writer would fill it, a <div ${y}="${t}">; it is what this check runs`})}let c=s.find(p=>p.file===b);c&&a.push(...De(t,c));let l=s.find(p=>p.file===k);l&&_(l.tree,n).length===0&&a.push({file:k,what:`it holds no instance of ${t}: a <div ${y}="${t}">`});let h=s.map(({slug:p,written:m,html:f,file:d})=>({file:d,slug:p,written:m,html:f,directory:E.join(e,p),htmlPath:E.join(e,p,"doc.html"),metadata:{title:p,description:p,type:"component"}})),u=X(h);for(let p of h){for(let m of u.get(p.slug)??[])Oe.test(m)||a.push(z(p.file,Ae(m)));for(let m of Z(p))r.push(z(p.file,m));for(let m of R(p.html)){let f=z(p.file,`${m} (read-only in the preview)`);o.some(({file:d,line:g})=>d===f.file&&g===f.line)||r.push(f)}}return c&&!a.some(({file:p})=>p===b)&&a.push(...Ke(n,c)),{title:i,problems:a,notes:r}}function Ye(t,e){let n=K(t,void 0,{on:e}),s=A(t,e);if(!n.packages.has(e)&&!n.problems.has(e))return null;G(t,n);let o=n.packages.has(e)&&n.settings.disabled.includes(e),i=n.packages.get(e)??{id:e,folder:s,files:["kit.js","style.css"].filter(l=>ue.existsSync(E.join(s,l)))},a=Ge(s),r=n.packages.has(e)?null:"its manifest does not load",c=r?[]:a.flatMap(l=>Ie(i,l));return{found:n.packages.get(e)??null,pages:a,sections:[Be({id:e,folder:s,catalog:n,off:o,parts:c}),_e(i),Me(i),r?{title:"template.html and example.html",skipped:r}:He({id:e,folder:s,found:i,pages:a,parts:c})]}}var B=({file:t,line:e})=>e?`${t}:${e}`:t;function me({title:t,problems:e=[],notes:n=[],told:s=[],none:o,skipped:i,unverified:a,pictures:r},c){let l=a?`UNVERIFIED ${a}`:i?`not run: ${i}`:o??(e.length?`${e.length} problem${e.length===1?"":"s"}`:`ok${n.length?`, ${n.length} note${n.length===1?"":"s"}`:""}`);return[`${c}. ${t}: ${l}`,...e.map(h=>` FAIL ${B(h)}: ${h.what}`),...n.map(h=>` note ${B(h)}: ${h.what}`),...s.map(h=>` way back ${B(h)}: ${h.what}`),...r?[qe(r)]:[]]}function qe({folder:t,overviews:e,each:n,edited:s=[],asExport:o=[]}){let i=e.length?`${N(E.join(t,e[0]))}${e.slice(1).map(c=>` and ${c}`).join("")}, the three widths of each theme side by side; then each at full size: `:`${N(t)}: `,a=o.length===0?"":o.length===s.length?", each the same picture as the export's at its width: the block draws nothing more where a reader can edit":`, ${o.join(" and ")} the same picture as the export's at its width`,r=s.length?`; and ${s.join(" and ")}, as the editing page draws it (context.canEdit() true)${a}`:"";return` Pictures (none looked at for you; example.html above the line, template.html below it, each under its name): ${i}${n.join(", ")}${r}`}function Ve([t,e,n,s]){return t.problems.length?"the manifest":e.stops?"kit.js":n.stops?"style.css":s.skipped||s.problems.length?"template.html and example.html":null}async function $t(t,e){let n=Ye(t,e);n||(console.error(oe(t,e)),process.exit(1)),console.log(`${e}: ${N(A(t,e))}`),n.sections.forEach((r,c)=>console.log(me(r,c+1).join(`
3
+ `)));let s=Ve(n.sections),o=A(t,e),i=s?{title:te,skipped:`${s} first`}:await se(t,n.found,{example:L(o,k),template:L(o,b)});console.log(me(i,5).join(`
4
+ `));let a=[...n.sections,i].reduce((r,{problems:c=[]})=>r+c.length,0);a?(console.log(`FAIL ${e}: ${a} problem${a===1?"":"s"}`),process.exitCode=1):i.unverified?(console.log(`UNVERIFIED ${e}: the rest passed, and no browser ran it: export a document that holds it and open that in Chrome or Edge.`),process.exitCode=3):console.log(`OK ${e}`)}export{$t as checkCommand,Fe as fewestSyllables,Ye as readSections,me as sectionLines,ze as wantsPinyin};
@@ -0,0 +1,8 @@
1
+ import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
+ import{spawn as J}from"node:child_process";import P from"node:fs";import m from"node:fs/promises";import Q from"node:os";import k from"node:path";import{escapeMarkup as X}from"../browser/shared/escape.mjs";import{spawn as C}from"node:child_process";import{existsSync as H,readFileSync as M}from"node:fs";import w from"node:path";var V=e=>!["","0",void 0].includes(e),z=(e,r)=>(r.PATH??"").split(w.delimiter).some(t=>t&&H(w.join(t,e))),U=()=>{try{return process.platform==="linux"&&/microsoft/i.test(M("/proc/version","utf8"))}catch{return!1}};function K(e,{platform:r=process.platform,env:t=process.env,wsl:s=U()}={}){let n=encodeURI(e);return V(t.GALLERY_NO_BROWSER)?{skip:"GALLERY_NO_BROWSER is set"}:r==="win32"?{command:w.join(t.SystemRoot||t.windir||"C:\\Windows","System32","rundll32.exe"),args:["url.dll,FileProtocolHandler",n]}:r==="darwin"?{command:"open",args:[n]}:s?{command:"cmd.exe",args:["/c","start",'""',n.replace(/[&^]/g,"^$&")]}:!t.DISPLAY&&!t.WAYLAND_DISPLAY?{skip:"no display here (neither DISPLAY nor WAYLAND_DISPLAY is set)"}:z("xdg-open",t)?{command:"xdg-open",args:[n]}:{skip:"xdg-open is not installed"}}var q="Opened it in the default browser (if that is not Chrome or Edge, open the address there to edit).",T=e=>e.opened?q:`Not opened in a browser: ${e.why}.`;async function O(e,r){let t=K(e,r);return t.skip?{opened:!1,why:t.skip}:new Promise(s=>{let n;try{n=C(t.command,t.args,{detached:!0,stdio:"ignore",windowsHide:!0})}catch(o){return s({opened:!1,why:`${w.basename(t.command)} did not start (${o.code??o.message})`})}n.once("error",o=>s({opened:!1,why:`${w.basename(t.command)} did not start (${o.code??o.message})`})),n.once("spawn",()=>{n.unref(),s({opened:!0})})})}import{packageRoot as Z,previewLogFile as f,projectRoot as G,release as I,reportsDirectory as h}from"../browser/shared/paths.mjs";import{fullAddress as ee}from"../browser/shared/page-address.mjs";import{findPreviewServer as te,galleryVersion as F,portIsFree as re,previewServerFor as ne,readAnnouncement as oe}from"../browser/shared/preview-server.mjs";import{documentLinks as se}from"../browser/shared/reports.mjs";import{documentDirectory as ie,documentFiles as ae,layoutOf as ce}from"../browser/shared/workspace.mjs";var $="\u4EA4\u7ED9\u7528\u6237\uFF08\u73B0\u5728\u5C31\u628A\u8FD9\u4E2A\u5730\u5740\u7ED9\u7528\u6237\uFF1B\u7528 Chrome \u6216 Edge \u6253\u5F00\uFF09\uFF1A",le="Agent \u81EA\u7528\uFF08\u53EA\u6709\u6587\u6863\u9875\uFF0C\u4E0D\u4EA4\u7ED9\u7528\u6237\uFF09\uFF1A",de=e=>`send the user ${e} now, in a message of its own, before any other step; then `;function Me(e,r){let t=e.at(-1)??"";return`Next: ${t.startsWith($)?de(t.slice($.length)):""}${r}`}async function Ve(e,r){let t=e.at(-1)??"";return t.startsWith($)?r.has("--no-browser")?"Not opened in a browser (--no-browser).":T(await O(t.slice($.length))):null}var D="GALLERY_NO_PREVIEW",pe=e=>!["","0",void 0].includes(e),ze=e=>e.has("--no-preview")||pe(process.env[D]),ue=4317,fe=20,me=(e=process.env)=>{let r=Number(e.GALLERY_PORT);return Number.isInteger(r)&&r>0&&r<65536?r:ue},we=6e4,he=5*1024*1024,$e=k.join(G,"node_modules","vite","bin","vite.js"),ye=k.join(Z,"dist","server.mjs"),ge=e=>new Promise(r=>setTimeout(r,e)),A={reportsDirectory:h},Y=ce(h),R=(e,r)=>`http://127.0.0.1:${e}/generated/${r}.html`,j=e=>`http://127.0.0.1:${e}/`,ve=(e,r)=>se().then(({links:t})=>t,()=>null).then(t=>ee(`http://127.0.0.1:${e}`,r,t));async function xe({first:e=me(),count:r=fe}={}){let t=Number((await m.readFile(Y.lastPortFile,"utf8").catch(()=>"")).trim()),s=Array.from({length:Math.max(0,r)},(n,o)=>e+o);return Number.isInteger(t)&&t>0&&t<65536?[t,...s.filter(n=>n!==t)]:s}async function ke(){return await m.mkdir(k.dirname(f),{recursive:!0}),await m.stat(f).then(r=>r.size,()=>0)>he&&await m.rename(f,`${f}.1`).catch(()=>{}),P.openSync(f,"a")}async function Le(e,r){if(!I){let{writeSharedAssets:p}=await import("./chunk-5TEK3RAD.mjs");await p()}let t=await ke();P.writeSync(t,`
3
+ [${new Date().toISOString()}] ${r}: Gallery ${F} on 127.0.0.1:${e} for ${h}
4
+ `);let[s,n]=I?[[ye,"--port",String(e)],Q.homedir()]:[[$e,"--host","127.0.0.1","--port",String(e),"--strictPort"],G],o=J(process.execPath,s,{cwd:n,env:{...process.env,GALLERY_WORKSPACE:k.resolve(h),GALLERY_SERVER_KIND:"cli"},detached:!0,stdio:["ignore",t,t],windowsHide:!0});return P.closeSync(t),o.unref(),o}async function Se({slug:e=null,command:r=`gallery open${e?` ${e}`:""}`,ports:t=null,starting:s=we,baseline:n=!1}={}){let o=()=>!0;if(e){let a=ae(ie(e,h)),c=await m.readFile(a.html,"utf8").catch(()=>null);if(c===null)return{ok:!1,reason:"missing",message:`No document "${e}": ${a.html} does not exist (gallery new ${e} "<\u6807\u9898>" makes one; gallery list lists those there are).`};n&&await import("./chunk-HMHK3EQ6.mjs").then(({previewBaseline:x})=>x(e,c));let i=await m.readFile(a.json,"utf8").then(JSON.parse).catch(()=>({})),v=[/<title>([^<]*)<\/title>/i.exec(c)?.[1]?.trim(),typeof i.title=="string"?i.title.trim():""].filter(Boolean);o=x=>v.length===0||v.some(_=>x.includes(_)||x.includes(X(_)))}let p=t??await xe(),L=p.length?`${Math.min(...p)} to ${Math.max(...p)}`:"none",S=`gallery open${e?` ${e}`:""}`,E=async(a,c=[])=>{let i=await ne({...A,ports:p.slice(a),start:v=>Le(v,r)});return i.busy?.newer?{failed:{ok:!1,reason:"newer",message:`A newer Gallery (${i.busy.version}) serves this workspace (port ${i.busy.port}, pid ${i.busy.pid}) and gave no answer in 10s; this is Gallery ${F}. Update this one (npm i -g @heycys/gallery@latest), or run ${S} again in a while.`}}:i.busy?{failed:{ok:!1,reason:"busy",message:`This workspace's Gallery server (port ${i.busy.port}, pid ${i.busy.pid}) took the request and gave no answer in 10s: it is busy or stuck. Run ${S} again in a while, or stop that process first (gallery stop): a second server of this workspace is not started beside it.`}}:i.stuck?{failed:{ok:!1,reason:"stuck",message:`An older Gallery's server serves this workspace and did not stop: ${i.stuck.message}`}}:i.port===null?{failed:{ok:!1,reason:"ports",message:`No server of this workspace runs, and no port from ${L} is free to start one on: stop a server on one of them (or name another first port: GALLERY_PORT=<n>), then run ${S}.`}}:{...i,passed:[...c,...i.passed]}},u=await E(0);if(u.failed)return u.failed;let{port:l,started:d,passed:b,replaced:W}=u,y=u.running??null,N=Date.now()+s,g="",B=async()=>{if(e){let c=await fetch(`${R(l,e)}?present`,{signal:AbortSignal.timeout(5e3)}).catch(()=>null),i=c?.ok?await c.text():"";return g=c?i?`HTTP ${c.status} without the title`:`HTTP ${c.status}`:"no answer",!!(i&&o(i))}let a=await fetch(`http://127.0.0.1:${l}/__gallery/workspace/info`,{signal:AbortSignal.timeout(5e3)}).catch(()=>null);return g=a?`HTTP ${a.status}`:"no answer",!!a?.ok};for(;;await ge(300)){if(Date.now()>N)return{ok:!1,reason:"timeout",message:`${e?R(l,e):j(l)} did not answer${e?" with the document's title":""} in ${s/1e3}s (${g})${d?`; the server's output is in ${f}`:""}.`};if(d){let a=await te({...A,answering:!0});if(a&&a.pid!==d.pid){if(d.exitCode===null)try{process.kill(d.pid)}catch{}({port:l}=a),y={pid:a.pid,kind:(await oe(A))?.kind??"cli",version:null},d=null;continue}if(!a&&d.exitCode===null){g="the server started has not announced itself yet";continue}if(!a){if(!await re(l)){if(u=await E(p.indexOf(l)+1,[...b,`${l} (taken by another program while the server started)`]),u.failed)return u.failed;({port:l,started:d,passed:b}=u),y=u.running??null,N=Date.now()+s;continue}let c=await m.readFile(f,"utf8").catch(()=>"");return{ok:!1,reason:"stopped",message:`The Gallery server on port ${l} stopped (exit ${d.exitCode}). Its last words (${f}):
5
+ ${c.split(`
6
+ `).slice(-15).join(`
7
+ `)}`}}}if(await B())break}return await m.writeFile(Y.lastPortFile,`${l}
8
+ `).catch(()=>{}),{ok:!0,port:l,pid:d?.pid??y?.pid??null,kind:y?.kind??"cli",started:!!d,replaced:W??null,passed:b}}var be=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ae({port:e,pid:r,kind:t,started:s,replaced:n,passed:o=[]}){let p=[`pid ${r}`,...t==="dev"?["npm run dev's"]:[],...s?[`started now${o.length?`, after passing over ${be(o)}`:""}`]:[],...n?[`it replaced Gallery ${n.version??"an older version"}'s server, pid ${n.pid}`]:[]],L=s?`; its log: ${f}`:"";return`This workspace's Gallery server runs on port ${e} (${p.join(", ")}${L}). This command is done; the server runs on after it (nothing to wait for or keep running).`}async function Pe(e,r,t=null){return[Ae(r),...e?[`${le}${R(r.port,e)}`]:[],`${$}${e?await ve(r.port,{slug:e,block:t}):j(r.port)}`]}async function Ue(e,{skipped:r,command:t,ports:s=null}){let n=`gallery open ${e} starts it and prints the address to give the user`;if(r)return[`Preview: not started (--no-preview or ${D}): ${n}.`];let o=await Se({slug:e,command:t,ports:s});return o.ok?Pe(e,o):[`Preview: not started: ${o.message}`,`When that is fixed, ${n}.`]}export{Me as a,Ve as b,ze as c,R as d,j as e,xe as f,Se as g,Pe as h,Ue as i};
@@ -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 u}from"./chunk-E7VYDG2X.mjs";import l from"node:fs/promises";import p from"node:path";import{escapeMarkup as b}from"../browser/shared/escape.mjs";import{sha256 as g}from"../browser/shared/files.mjs";import{reportsDirectory as E,starterDirectory as y}from"../browser/shared/paths.mjs";import{listReportSlugs as T,slugPattern as S}from"../browser/shared/reports.mjs";import{documentDirectory as N,documentFiles as $,layoutOf as O,slugTaken as j}from"../browser/shared/workspace.mjs";async function v(t,c){if(!S.test(t))throw new Error(`A document's folder name must be lowercase kebab-case: ${t}`);let s=N(t,c),{html:r,json:n}=$(s),[m,o]=[p.basename(r),p.basename(n)],e,f;try{[e,f]=await Promise.all([l.readFile(r),l.readFile(n,"utf8")])}catch(a){if(a.code!=="ENOENT")throw a;let h=await l.stat(s).then(()=>!0,()=>!1);throw new Error(h?`${s} needs both ${m} and ${o}.`:`${s} does not exist.`)}let i;try{i=JSON.parse(f)}catch(a){throw new Error(`${o} is not valid JSON: ${a.message}`)}for(let a of["title","description","type"])if(typeof i[a]!="string"||i[a].trim()==="")throw new Error(`${o} is missing a non-empty ${a}.`);if(i.source!==void 0&&typeof i.source!="string")throw new Error(`${o} source must be a string when given.`);return{slug:t,directory:s,htmlPath:r,metadataPath:n,html:e.toString("utf8"),fileSha256:g(e),metadata:i}}async function z(t=[],{directory:c=E,prepare:s=null}={}){let r=t.length>0?[...new Set(t)]:await T(c);if(r.length===0)throw new Error(`No documents in ${p.resolve(c)} yet: gallery new <slug> "<title>" makes one.`);let n=[],m=new Map;for(let o of r)try{let e=await v(o,c);s&&([e.written,e.html]=[u(e.html),s(e)]),n.push(e)}catch(e){m.set(o,[e.message])}return{reports:n,failures:m}}var F=/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/,P=/\n[ \t]*<!-- Starter content:[^\n]*-->\n[ \t]*<section\b[^>]*\sdata-doc-placeholder\b[\s\S]*?<\/section>/;async function M(t,c,s,{directory:r=E,blank:n=!1,lang:m=null,page:o=!1}={}){if(!S.test(t))throw new Error("Slug must be lowercase kebab-case.");if(j(t,r))throw Object.assign(new Error(`"${t}" is taken in ${p.resolve(r)}`),{code:"EEXIST"});let e=o?O(r).pages:p.resolve(r),f=p.join(e,t),{html:i,metadata:a}=await R(t,c,s,{blank:n,lang:m});await l.mkdir(e,{recursive:!0}),await l.mkdir(f,{recursive:!1});let h=$(f);return await Promise.all([l.writeFile(h.html,i),l.writeFile(h.json,`${JSON.stringify(a,null,2)}
3
+ `)]),{slug:t,directory:f,metadata:a}}async function R(t,c,s,{blank:r=!1,lang:n=null}={}){let m=w=>b(w).replaceAll("'","&#39;"),[o,e]=await Promise.all([l.readFile(p.join(y,"doc.html"),"utf8"),l.readFile(p.join(y,"doc.json"),"utf8")]),f={...JSON.parse(e),title:c,description:s},i=r?o.replace(P,`
4
+ <p></p>`):o;if(r&&i===o)throw new Error("The starter's placeholder section was not found.");let a=typeof n=="string"&&F.test(n)?i.replace(/(<html\b[^>]*\slang=")[^"]*"/,(w,d)=>`${d}${n}"`):i,h={SLUG:t,TITLE:m(c)};return{html:a.replace(/__REPORT_(SLUG|TITLE)__/g,(w,d)=>h[d]),metadata:f}}export{z as a,M as b,R as c};
@@ -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{e as n,f as g}from"./chunk-YXAUQPVK.mjs";import{b as m,f as d}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import{spawn as P}from"node:child_process";import h from"node:fs/promises";import R from"node:path";import{projectRoot as v,release as k,reportsDirectory as t}from"../browser/shared/paths.mjs";import{answerOf as S,findPreviewServer as x,portIsFree as E,readAnnouncement as G}from"../browser/shared/preview-server.mjs";import{layoutOf as $}from"../browser/shared/workspace.mjs";var b=a=>new Promise(s=>setTimeout(s,a));async function O(a){let{positional:s,values:l}=d({values:["--port"],argv:a});if(s.length>0)throw new m(`gallery serve takes no arguments: ${s[0]}`);let o=l.has("--port")?Number(l.get("--port")):null;if(o!==null&&!(Number.isInteger(o)&&o>0&&o<65536))throw new m(`--port takes a port number: ${l.get("--port")}`);let i=await G({reportsDirectory:t}),f=i?await S(i,t,1e4):"no";f!=="no"&&(console.error(`This workspace's Gallery server runs already: ${n(i.port)} (pid ${i.pid}${f==="busy"?", not answering now":""}). gallery stop stops it; one server serves a workspace.`),process.exit(1));let r=null;if(o!==null)await E(o)||(console.error(`Port ${o} is taken: name another (--port), or leave it out for the first free one.`),process.exit(1)),r=o;else{for(let e of await g())if(await E(e)){r=e;break}r===null&&(console.error("No port from 4317 is free: name one (--port <n>)."),process.exit(1))}if(k){process.env.GALLERY_SERVER_KIND="cli";let{startProductionServer:e}=await import("./chunk-5LEK2CBS.mjs");await e({port:r,kind:"cli"}),await h.writeFile($(t).lastPortFile,`${r}
3
+ `).catch(()=>{}),console.log(`Gallery serves ${t} at ${n(r)} (Chrome or Edge). Ctrl+C stops it.`);return}let{writeSharedAssets:y}=await import("./chunk-5TEK3RAD.mjs");await y();let c=P(process.execPath,[R.join(v,"node_modules","vite","bin","vite.js"),"--host","127.0.0.1","--port",String(r),"--strictPort"],{cwd:v,env:{...process.env,GALLERY_WORKSPACE:t,GALLERY_SERVER_KIND:"cli"},stdio:"inherit"});for(let e of["SIGINT","SIGTERM"])process.on(e,()=>c.kill(e));let w=new Promise(e=>c.once("exit",(u,p)=>e(u??(p?1:0))));for(;;){let e=await Promise.race([w.then(p=>({code:p})),b(300).then(()=>null)]);if(e&&process.exit(e.code),(await x({reportsDirectory:t,answering:!0,timeout:2e3}))?.pid===c.pid)break}await h.writeFile($(t).lastPortFile,`${r}
4
+ `).catch(()=>{}),console.log(`Gallery serves ${t} at ${n(r)} (Chrome or Edge). Ctrl+C stops it.`),process.exit(await w)}export{O as run};
@@ -0,0 +1,216 @@
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
+ var n=["init","new","import","open","serve","stop","check","export","qa","list","component","skill"],a=`The workspace (the folder of your documents) is --workspace <dir>, else GALLERY_WORKSPACE, else the
3
+ nearest folder up from here holding gallery.json (gallery init makes one), else ~/Documents/Gallery (on Windows
4
+ the Documents folder Explorer shows, OneDrive's when OneDrive backs it up).`,e=`A document is named by its slug, by its link (\u5468\u62A5-k3xv9q2a, what gallery list shows after /#) or by a
5
+ whole address, as a user hands one over (http://127.0.0.1:4317/#\u5468\u62A5-k3xv9q2a, a block's id after a / or not): the
6
+ words in a link are a label, and a title changed since leaves the address good.`,o={init:`Usage: gallery init [<dir>] [--from <old reports dir>]
7
+ Makes a workspace: <dir> (else the workspace found as every command finds it) with its gallery.json
8
+ and .gallery/ (never over a gallery.json that is there). Prints \u5DE5\u4F5C\u533A\uFF1A<abs>\uFF08\u65B0\u5EFA or \u5DF2\u6709\uFF09.
9
+ --from copies the documents of an older Gallery (its reports/ folder: one folder a document, each
10
+ holding report.html or doc.html) into the workspace: every document whose slug is free here (the
11
+ others listed as skipped), its preferences.md when the workspace has none, the sidebar's order, the
12
+ \u5199\u4F5C\u504F\u597D page, the custom emoji and the documents' recent versions. The old folder is only read:
13
+ nothing there is changed, moved or deleted.
14
+ Exits 1 when the workspace cannot be written or --from names no folder.`,new:`Usage: gallery new <slug> "<title>" ["<description>"] [--no-preview] [--no-browser]
15
+ A new document in <workspace>/<slug>/ from the starter: its doc.html, holding the starter's section
16
+ to replace, and doc.json, with the title and the description (\u65B0\u6587\u6863 when none is given). Then says
17
+ where it wrote (the workspace), where the user's writing preferences are (\u5199\u4F5C\u504F\u597D,
18
+ <workspace>/preferences.md, to read first: made from Gallery's default when there are none yet) and
19
+ the next steps (the first: send the user the address now), and last starts this workspace's Gallery
20
+ server (or uses the one running: it runs on after this command), opens the default browser at the
21
+ document and prints the address to give the user, as gallery open does. --no-preview (or
22
+ GALLERY_NO_PREVIEW=1) leaves the server alone; --no-browser (or GALLERY_NO_BROWSER=1) opens no
23
+ browser. Editing needs Chrome or Edge.
24
+ A title or a description that starts with "-" and a letter would be read as an option: put "--"
25
+ before the arguments (gallery new q3-review -- "-Q3 \u56DE\u987E").
26
+ Exits 1 when the document exists, or the slug is the workspace's own (exports, the \u5199\u4F5C\u504F\u597D page's) or
27
+ a document's in the trash.`,import:`Usage: gallery import <file> [<slug> ["<title>"]] [--no-preview] [--no-browser]
28
+ New documents made of a file, as the workbench's \u5BFC\u5165 makes them: Markdown (.md .markdown .mdx .txt
29
+ .text), HTML (.html .htm .xhtml, a Gallery export too), a table (.csv .tsv), Word (.docx), PDF (.pdf,
30
+ its text), EPUB (.epub) or a .zip of them (a Notion export: one document a page, nested as there).
31
+ The first document's title is the argument's, else the file's (front matter, first heading, name);
32
+ its slug the argument's, else made of the title's Latin words (lowercase kebab-case, a number added
33
+ when it is taken, as gallery new would refuse it). The pictures a Markdown file links to by relative addresses are copied into
34
+ <slug>/assets/. Then says what it made, what it could not bring as the file has it (by line), the
35
+ text the preview leaves read-only, the workspace, \u5199\u4F5C\u504F\u597D, the next steps (the first: send the user
36
+ the address now), and last, as gallery new does, the browser opened at the first document and the
37
+ server's address to give the user (--no-preview, or GALLERY_NO_PREVIEW=1, leaves the server alone;
38
+ --no-browser, or GALLERY_NO_BROWSER=1, opens no browser).
39
+ Put "--" before a title that starts with "-" and a letter.
40
+ Exits 1 when the file is not there, cannot be read, or gallery new would refuse the slug; 2 for a
41
+ kind it does not take.`,open:`Usage: gallery open [<slug>] [--no-browser]
42
+ Starts this workspace's Gallery server (or uses the one running: it runs on after this command, its
43
+ log in <workspace>/.gallery/logs/server.log), waits until it answers, and opens the default browser
44
+ at the workbench, or at the document <slug>, at its block when an address names one (--no-browser,
45
+ or GALLERY_NO_BROWSER=1, opens none).
46
+ ${e}
47
+ Prints the workspace, the server, the document's page alone (the Agent's own, with a slug) and last
48
+ the address to give the user. Editing needs Chrome or Edge: open the address there.
49
+ With a slug and no qa baseline yet, it first keeps one of the document as it is now, so that the
50
+ first gallery qa after the changes pictures what changed.
51
+ Exits 1 when there is no such document, no server answers, or the workspace's server takes the
52
+ request and gives no answer (a second server is never started beside it).`,serve:`Usage: gallery serve [--port <n>]
53
+ Runs this workspace's Gallery server in the foreground until Ctrl+C (gallery open runs one in the
54
+ background instead). Prints the address once it answers. --port picks the port (else the last one
55
+ this workspace used, else the first free one from 4317).
56
+ Exits 1 when a server of this workspace runs already (its address said) or the port is taken.`,stop:`Usage: gallery stop
57
+ Stops this workspace's Gallery server, the one gallery open or gallery new started: it finishes the
58
+ saves in its queue first. A server npm run dev runs (Gallery's own development) is stopped where it runs.
59
+ Exits 0 when it stopped or none runs, 1 when it could not be stopped.`,check:`Usage: gallery check [<slug>...] [--allow-failures]
60
+ Checks each named document (none named: every document of the workspace) on its own.
61
+ ${e}
62
+ Reads it as its preview shows it (natural HTML made the kit's in memory) and writes nothing: what the export will
63
+ write as the kit's markup is printed by line, and the blocks it will give an id (each at its line
64
+ when they are ten at most); first, once, what the preview wrote as the kit's markup when the reader
65
+ edited the document, and the \u6279\u6CE8 it deleted because their words are gone. Problems to act on first
66
+ ("fix") come before the others ("note").
67
+ Exits 1 when a document fails, unless --allow-failures.`,export:`Usage: gallery export <slug>... [--allow-failures]
68
+ gallery export --all [--allow-failures]
69
+ Hands each named document in: its doc.html (report.html in an older document) written as its
70
+ preview shows it, natural HTML as the kit's markup and every block given an id (through the
71
+ workspace's server while one runs); then checks it and writes one standalone offline file per
72
+ passing document, <workspace>/exports/<slug>.html. A document the quick checks fail is not handed in.
73
+ ${e}
74
+ It says first, once, what the preview wrote when the reader edited a document and the \u6279\u6CE8 it deleted;
75
+ then the failures ("FAIL <slug>: N problems"), the exports made, the notes to act on first ("fix")
76
+ and the others ("note"), what the hand-in wrote by line, which files to re-read before editing them,
77
+ and last, for each document exported, \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A and the export's absolute path.
78
+ Exits 1 when a document fails, unless --allow-failures.`,qa:`Usage: gallery qa <slug>... [--tiles] [--blocks <id,\u2026>] [--no-export]
79
+ gallery qa --all [--tiles] [--no-export]
80
+ Looks at each named document's export (<workspace>/exports/<slug>.html; one with none yet, or one not
81
+ made from its doc.html and its component packages as they are now, is exported first, as gallery
82
+ export does, unless --no-export) as a reader's browser shows it: Chrome or Edge, headless, at 1024, 736 and 360px wide
83
+ and in a laptop's 1024\xD7768 window, every disclosure open, each Sheet and detail card shown in turn.
84
+ ${e}
85
+ Each finding is said with its place in the document's file (doc.html:<line>, report.html:<line> in
86
+ an older document): fail (errors, broken pictures, charts that drew nothing, the page wider than the
87
+ window\u2026), warn (columns or rows out of sight, overlapping text\u2026), info, unverified (no browser, a
88
+ wait that ran out\u2026). Pictures go to <workspace>/.gallery/qa/<slug>/ (its absolute path printed):
89
+ flagged/, changed/ and cards/ (the blocks changed since the last look, and the cards not pictured
90
+ yet), blocks/ (--blocks <id,\u2026>, one document only; the ids split at commas or spaces, and one the
91
+ document has not refused before anything is looked at), tiles/ (--tiles: the page in tiles). Each run
92
+ empties its own folders first: flagged/ every run, changed/ and cards/ a plain run, blocks/ a --blocks
93
+ run, tiles/ a --tiles run. A --blocks run says, before its verdict, the changed blocks and the cards
94
+ it did not picture: a plain run pictures them. First, once, as gallery check says them, what the
95
+ preview wrote when the reader edited the document and the \u6279\u6CE8 it deleted. Then the verdict, and
96
+ last, on a line of its own, the export's absolute path after \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A.
97
+ GALLERY_BROWSER=<executable> picks the browser. A browser that does not start is tried once more
98
+ with a fresh profile.
99
+ Exits 1 when anything fails (or the export it ran first did), 3 when something could not be
100
+ verified (UNVERIFIED: no browser, or one that did not start), 2 when an export is missing or stale
101
+ with --no-export or --blocks names an id the document has not, else 0. A warning never fails.`,list:`Usage: gallery list [<words>...]
102
+ The workspace's documents, for an Agent to find the one the user means: each one's slug and title,
103
+ its description, its address (\u5730\u5740\uFF1A/#<link>, after the port of the workspace's server), when its file
104
+ was last written and where that file is, the one edited last first.
105
+ With words, only those whose title, description or slug holds any of them (case alike, Chinese found
106
+ inside words), the best first; with a document's link or whole address, that document, or that it is
107
+ in the trash. First, the workspace and where \u5199\u4F5C\u504F\u597D is (made from Gallery's default when there is none
108
+ yet).`,component:`Usage: gallery component new <id> [--script]
109
+ gallery component list
110
+ gallery component show <id>
111
+ gallery component check <id>
112
+ gallery component try <slug> [<instance id>] --press <selector> [--keep]
113
+ gallery component try <slug> [<instance id>] --drag <selector> --to <selector> [--keep]
114
+ gallery component try <slug> [<instance id>] --key <selector> <key> [--keep]
115
+ A component package is a block to use again, kept in the workspace: components/<scope>/<name>/. An id
116
+ is <scope>/<name>, or a <name> alone in the scope local; a document uses one by an element naming it.
117
+ new starts a package: component.json, template.html, example.html, writing.md and style.css, and with
118
+ --script a kit.js. It passes check as it stands, and says what to write next.
119
+ Exits 1 when the id is taken.
120
+ list says what the workspace has now: the components to write with, each with its version, then those
121
+ not to write with now and why: hidden, disabled, one that does not load, a manifest one level too shallow;
122
+ and last the blocks of Gallery's own the user hid.
123
+ show says how to write one: its parts, its writing.md and its example.
124
+ Exits 1 when there is no such component or it does not load.
125
+ check says what is wrong with one, each problem ("FAIL") at its place in the package's files, each note
126
+ never a failure, in five sections: 1 the manifest, with template.html there, text parts that hold
127
+ words and marks alone, and a note on a Chinese name no word of its words spells whole in pinyin, a
128
+ syllable a character, by how many syllables a word reads as; 2 kit.js: what a browser refuses, what
129
+ an export refuses, what it registers, a type check against sdk/; 3 style.css: every selector in the
130
+ instance, what an export cannot hold; 4 template.html and example.html, each read as a document's page
131
+ by what gallery check runs, and template.html as what a menu can put in; 5
132
+ both in a temporary document, exported and opened as gallery qa opens one, in Chrome or Edge under the export's
133
+ policy: what the console and the policy say, a dialog or a window it opens, mount then dehydrate then
134
+ mount and copies put back giving the same DOM (a drawing neither the manifest's runtime nor dehydrate
135
+ names piles up, and what piles up outside the instance is named too), a text part the component
136
+ redraws, a data part a mount changes, a write with no gesture once the page takes edits, the way back
137
+ to the file (a way back line: what the component's example wrote, each part with how many of its
138
+ lines the write took out and put in, and that the server took it; a note on a write that lays a part
139
+ out anew, and on a list a card is dropped on that listens for dragover and not for dragenter), a page
140
+ wider than the window, and the pictures, in <workspace>/.gallery/qa/components/<id>/, its absolute
141
+ path printed, emptied each run: overview-light.png and overview-dark.png, the three widths of a theme
142
+ side by side, then each at 360, 736 and 1024px wide, light and dark, and edit-1024-light.png and
143
+ edit-360-light.png, as the editing page draws it, said when they are the export's. Section 5 waits
144
+ until what it needs passes; a page that stops answering or loads itself again ends it, and is said;
145
+ with no browser, one that does not start or goes while it looks, or a folder it cannot write, it says
146
+ so and the rest stands. A package the user turned off is checked as any, with a note saying so.
147
+ GALLERY_BROWSER=<executable> picks the browser.
148
+ Exits 1 when anything fails, 3 when nothing did and no browser ran it (UNVERIFIED), else 0.
149
+ Exits 2 for an id no package can have.
150
+ try makes one gesture a reader makes on an instance in a document, with the pointer and the keys, and
151
+ says what it wrote. It starts the workspace's server (or uses the one running), as gallery open does,
152
+ and opens the document's page alone, editable (the Agent \u81EA\u7528 address), in Chrome or Edge, headless, in
153
+ a profile of its own, and waits until the server has told the page of the writes made before it (a
154
+ package changed, doc.html written), which load it again. Each selector is the first element of the
155
+ instance it finds: --press, a press at its middle; --drag \u2026 --to, pressed there, moved in steps to the
156
+ middle of another and released a moment after the move that comes onto it; --key, the key (Enter,
157
+ Space, ArrowRight, a letter, Shift+Tab) with the focus on it, as Tab gives it. <slug> names the
158
+ document, as its link or a whole address does too (gallery help says how), and the instance is named
159
+ by its data-block-id, or by its package's id where the document holds one of it; with one instance in
160
+ the document, not at all. Once <html>'s data-ge-save says saved again it prints a Gesture line, what it
161
+ did to which element, and a Wrote line: each part of the instance in doc.html with how many of its
162
+ lines the gesture took out and put in, and that nothing outside the instance changed, data-block-id
163
+ aside, which a save gives (what did is someone else's, which stays). Then it presses Ctrl+Z once, the
164
+ focus where the gesture left it but off a field of the instance, as a reader undoes, and an Undone line
165
+ says doc.html is as it was; --keep leaves the write (a Kept line). Last, a picture of the instance after
166
+ the gesture, <workspace>/.gallery/qa/<slug>/try/after.png, its absolute path printed, emptied each run.
167
+ A first save of an edit writes a document's plain HTML as the kit's markup, which the Wrote line says
168
+ and which stays: the file is compared as its page shows it. A trial cut off after its gesture (the page
169
+ offline, a card held for the reader, a load of its own, the browser gone) reads doc.html and says what
170
+ it holds of the gesture.
171
+ Exits 1 when the gesture wrote nothing (what came of it said: no context.edit, one the page refused, an
172
+ HTML5 drag dropped nowhere, a selector that finds nothing as the component failed), when one Ctrl+Z did
173
+ not give doc.html back, when the component failed, or when a trial cut off left the gesture's write in
174
+ doc.html, said with the parts it holds, for you to put back; 2 for a mistake in the command line: a
175
+ selector that finds nothing shown in the instance, an instance the document has not among them, a drag
176
+ that ends on what it drags; 3 when the trial was not seen through and doc.html holds nothing of the
177
+ gesture (UNVERIFIED: no server or browser ran it, a card waits for the reader, someone else wrote
178
+ doc.html meanwhile, which stays), the line saying what doc.html holds.`,skill:`Usage: gallery skill install [--agent claude|codex] [--project] [--dir <path>]
179
+ Writes the Gallery skill that matches this gallery command (what an Agent reads to write documents
180
+ with it: SKILL.md, references/, sdk/) where the Agent reads skills:
181
+ Claude Code ~/.claude/skills/gallery (CLAUDE_CONFIG_DIR/skills/gallery when that is set)
182
+ Codex ~/.codex/skills/gallery (CODEX_HOME/skills/gallery when that is set)
183
+ for each of them whose folder is there (neither: Claude Code's), or the one --agent names. --project
184
+ writes it into this folder's .claude/skills/gallery (.codex/skills/gallery for Codex) instead, for
185
+ this project alone; --dir <path> writes it into <path> itself, the skill's own folder, for any other agent.
186
+ A Gallery skill there is replaced (nothing done when it holds the same files). An older Gallery's
187
+ skill (the whole tools: package.json and src/, or reports/, its SKILL.md named gallery or
188
+ html-report-studio), there or anywhere in that skills folder, has its documents copied into the
189
+ workspace first, as gallery init --from copies them, and its exports into <workspace>/exports/ where
190
+ the name is free; then it is moved to <workspace>/.gallery/old-skill-<date>/ (never deleted), so that
191
+ the Agent sees one Gallery skill. Says what it did and where; then open a new Agent session.
192
+ Exits 1, changing nothing, when a target holds something else or an older skill's preview server
193
+ still runs (stop it first); 1 too when an older skill cannot be moved (its documents are copied).`},r=o.component.split(`
194
+ `).filter(t=>/^(?:Usage:)?\s*gallery component try /.test(t)).map((t,s)=>s===0?`Usage: ${t.trimStart()}`:t).join(`
195
+ `),i=`Usage: gallery <command> [options] [--workspace <dir>]
196
+ Gallery: documents written as HTML, edited in the browser, exported as one offline file.
197
+
198
+ gallery init [<dir>] [--from <old reports dir>] make a workspace (copy an older Gallery's documents)
199
+ gallery new <slug> "<title>" ["<description>"] a new document; starts the server, opens the browser
200
+ gallery import <file> [<slug> ["<title>"]] documents made of a file (Markdown, HTML, Word, PDF\u2026)
201
+ gallery open [<slug>] [--no-browser] start or reuse the server and open the browser
202
+ gallery serve [--port <n>] run the server in the foreground
203
+ gallery stop stop the workspace's server
204
+ gallery check [<slug>...] check documents (none named: all)
205
+ gallery export <slug>... | --all write <workspace>/exports/<slug>.html
206
+ gallery qa <slug>... [--blocks a,b] [--tiles] look at exports in Chrome or Edge
207
+ gallery list [<words>...] the documents, or those the words name
208
+ gallery component new|list|show|check [<id>] make, list, read and check component packages
209
+ gallery component try <slug> --press <selector> a reader's gesture on an instance, and what it wrote
210
+ gallery skill install [--agent claude|codex] write the Agent's skill for this version
211
+ gallery help [<command>] this, or a command's whole usage
212
+ gallery --version the version
213
+
214
+ ${e}
215
+ ${a}
216
+ Editing in the browser and gallery qa need Chrome or Edge. Node 22.13 or newer.`;export{n as a,o as b,r as c,i as d};
package/dist/cli.mjs ADDED
@@ -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}from"./chunk-LHTFLRB6.mjs";import"./chunk-ZBIM6ARY.mjs";import"./chunk-5L7RYZCL.mjs";export{e as main,d as notOurs,b as readCommandLine,c as unwritable,a as versionOf};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
+ import{a as o}from"./chunk-GYQV7Y4J.mjs";import"./chunk-7GHT2UCA.mjs";import"./chunk-UNUEWH4S.mjs";import"./chunk-G7TOXONE.mjs";import"./chunk-LC7YNQFG.mjs";import"./chunk-6U2SLSDN.mjs";import"./chunk-W7CXPCRV.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import"./chunk-QMQUXTU4.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";var t=process.argv.indexOf("--port"),r=t===-1?Number.NaN:Number(process.argv[t+1]);(!Number.isInteger(r)||r<=0||r>=65536)&&(console.error("Usage: node dist/server.mjs --port <n> (GALLERY_WORKSPACE names the workspace). The gallery command starts it: gallery open."),process.exit(2));try{let{port:e}=await o({port:r});console.log(`[gallery] ${new Date().toISOString()} listening on http://127.0.0.1:${e}/ (pid ${process.pid})`)}catch(e){console.error(`[gallery] could not start on port ${r}: ${e.message}`),process.exit(1)}
@@ -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 P,b as W,c as B,e as H}from"./chunk-B3VTYBYR.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import{c as F}from"./chunk-NFIBI4IP.mjs";import{d as R,f as M}from"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{parentPort as N}from"node:worker_threads";import{PAGE as U}from"../browser/editor/components/kit.mjs";import{APART as T,clipboardOf as X,tagKind as j,unitClipboard as _,writtenApart as Y}from"../browser/editor/components/registry.mjs";import{WRITERS as h,heldToWords as Z,unitOpening as tt,wordsIn as et}from"../browser/editor/page/clipboard/own/writers.mjs";import{escapeAttribute as v}from"../browser/shared/escape.mjs";import{referencedFile as rt}from"../browser/shared/media.mjs";var nt=/^\s*\\\(([\s\S]*)\\\)\s*$/,ot=" ",st=["script","style","template","noscript",T,U.header,`${U.header} > h1`].join(", ");function it(r,u){let f=globalThis.document.createElement("template");f.innerHTML=r??"";let d=g=>[...g.childNodes].map(n=>{if(n.nodeType===3)return n.data.replace(/ /g," ");if(n.nodeType!==1)return"";if(n.matches(".doc-math-inline")){let i=nt.exec(n.textContent)?.[1];return i!==void 0?i.trim()?`$${i.trim()}$`:"":n.textContent}if(n.localName==="img"){let i=n.getAttribute("src");return i?`![${at(n.getAttribute("alt")??"")}](${u(i,"image",D(i))})`:""}if(n.matches("a.doc-link-mention")){let i=(n.querySelector(".doc-link-mention-title")??n).textContent.replace(/\s+/g," ").trim();return n.getAttribute("href")?`[${i||n.getAttribute("href")}](${n.getAttribute("href")})`:i}let l=d(n);if(n.localName==="br")return`
3
+ `;if(!l.trim())return l;let[c,m,p]=[l.match(/^\s*/)[0],l.trim(),l.match(/\s*$/)[0]];switch(n.localName){case"strong":case"b":return`${c}**${m}**${p}`;case"em":case"i":return`${c}*${m}*${p}`;case"s":case"del":case"strike":return`${c}~~${m}~~${p}`;case"code":return`${c}\`${m}\`${p}`;case"a":{let i=n.getAttribute("href")??"";return!i||i.startsWith("#")?l:rt(i)?`${c}[${m}](${u(i,"file",n.getAttribute("download")||D(i))})${p}`:m===i?`${c}${i}${p}`:`${c}[${m}](${i})${p}`}default:return n.classList.contains("doc-tab")?` ${l}`:l}}).join("");return Z(d(f.content).replace(/[ \t]+\n/g,`
4
+ `).trim())}function b(r){if(!r.querySelector(T))return r;let u=r.cloneNode(!0);for(let f of u.querySelectorAll(T))f.remove();return u}var ct=r=>(r?.textContent??"").replace(/\s+/g," ").trim(),D=r=>r.replace(/[?#].*$/,"").split("/").pop(),at=r=>r.replace(/[\\[\]]/g,"\\$&"),ut=/(\d+)/g;async function K(r,{title:u,media:f=g=>g,chart:d=()=>null}){let{UNIT:g,unitsOf:n,serializeInner:l,nestedBlocks:c,isHost:m}=await P(),p=e=>it(e,f),i=e=>{let t=b(e),o=[...t.querySelectorAll("img")];if(o.length===0)return l(t);let s=t.cloneNode(!0);return s.querySelectorAll("img").forEach((a,A)=>a.replaceWith(`\uE000${A}\uE001`)),l(s).replace(ut,(a,A)=>`<img src="${v(o[A].getAttribute("src")??"")}" alt="${v(o[A].getAttribute("alt")??"")}">`)},z=e=>p(i(e)),G=(e,{tables:t=!0}={})=>{let o=b(e);return[...o.querySelectorAll("img[src]")].filter(s=>!s.closest("a.doc-link-mention")&&(t||!o.contains(s.closest("table")))).map(s=>p(s.outerHTML))},x=e=>(j(e)&&!e.matches(g)&&e.setAttribute("data-ge-unit-kind",j(e)),e);function w(e){let t=[],o=null;for(let s of e.childNodes){let a=s.nodeType===1;(a?s.matches(st):s.nodeType!==3)||(a&&(s.matches(g)||F.has(s.localName))?(t.push(x(s)),o=null):(a||o||s.data.trim())&&(o||t.push(o=x(r.createElement("p"))),o.append(s.cloneNode(!0))))}return t}let y=e=>h[_(e).kind].list,C=e=>e.map(t=>t&&`${ot}${t}`);function k(e){let t=[],o=null;for(let s of e){let a=E(s);a.length!==0&&(o!==null&&!(y(o)&&y(s))&&t.push(""),t.push(...a),o=s)}return t}function S(e){let t=[];for(let o of e){let s=E(o);if(s.length===0)continue;let a=y(o);!a&&t.length>0&&t.at(-1)!==""&&t.push(""),!a&&t.length===0&&t.push(""),t.push(...C(s)),a||t.push("")}for(;t.at(-1)==="";)t.pop();return t}function J(e,t=null){let s=n(e).length>0?[]:h.words.exported(e,$,{without:t});return s.length>0?["",...C(s)]:S(w(e).filter(a=>a!==t))}function E(e){let t=_(e);return h[t.kind].exported(e,$,t)}function V(e,t){let o=/^en(?:-|$)/i.test(e.ownerDocument.documentElement.getAttribute("lang")??"");return t?o?"Chart":"\u56FE\u8868":o?"Figure":"\u56FE"}let $={isHost:m,nestedBlocks:c,serializeInner:l,media:f,chart:d,inline:p,own:z,withPictures:i,picturesIn:G,lines:k,held:S,heldIn:J,untitled:V,wordsIn:(e,t,o)=>et(b(e),t,o),plain:ct,unitsOf:w,words:e=>h.words.exported(e,$),packageOf:e=>R().packages.get(e),opening:(e,t)=>tt(e,t,$),writtenAs(e,t){let o=X(e);return h[o.kind].exported(t,$,o)}},I=r.querySelector(".doc-header"),O=I?k(w(I)):[],q=r.querySelector("main"),L=k(q?w(q):[]),Q=Y(r).flatMap(({element:e,clipboard:t})=>["",...h[t.kind].exported(e,$,t)]);return[`# ${u||"Untitled"}`,...O.length?["",...O]:[],...L.length?["",...L]:[],...Q].join(`
5
+ `)}import{saying as lt}from"../browser/shared/i18n/index.mjs";import{referencedFile as pt}from"../browser/shared/media.mjs";var ft=r=>`\0F${r}\0`,mt=r=>`\0C${r}\0`,dt={async markdown({source:r,title:u,pictures:f}){let{document:d}=await W(r),g=[],n=[...d.querySelectorAll("main figure.doc-figure")];return{text:await K(d,{title:u,media:(c,m,p)=>{let i=pt(c);return i?ft(g.push({src:i,kind:m,name:p})-1):c},chart:c=>f&&n.includes(c)?mt(n.indexOf(c)):null}),files:g,charts:n.length,charted:n.map(c=>!!c.querySelector("[data-doc-chart]"))}},import:({uploads:r,scratch:u})=>B(r,u),fill:r=>H(r)};N.on("message",async({id:r,type:u,payload:f})=>{try{M(),N.postMessage({id:r,result:await dt[u](f)})}catch(d){N.postMessage({id:r,error:{...lt(d),stack:d.stack}})}});