@heycys/gallery 0.2.3 → 0.2.4

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 (220) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +1 -1
  3. package/assets/preview/runtime.js +156 -0
  4. package/assets/preview/shell.html +107 -0
  5. package/assets/writing-preferences.md +1 -1
  6. package/browser/editor/components/divider/index.mjs +1 -1
  7. package/browser/editor/page/annotate/card.mjs +6 -0
  8. package/browser/editor/page/annotate/index.mjs +22 -2
  9. package/browser/editor/page/columns/index.mjs +1 -1
  10. package/browser/editor/page/conflicts.mjs +1 -1
  11. package/browser/editor/page/drag/index.mjs +1 -1
  12. package/browser/editor/page/editor.mjs +39 -3
  13. package/browser/editor/page/focus.mjs +104 -0
  14. package/browser/editor/page/handle/index.mjs +14 -2
  15. package/browser/editor/page/links/index.mjs +2 -2
  16. package/browser/editor/page/quiet.mjs +3 -3
  17. package/browser/editor/page/resize/index.mjs +1 -1
  18. package/browser/editor/page/session.mjs +4 -1
  19. package/browser/editor/page/ui.mjs +1 -1
  20. package/browser/shared/annotations.mjs +22 -3
  21. package/browser/shared/block-packs.mjs +13 -4
  22. package/browser/shared/document-look.mjs +14 -0
  23. package/browser/shared/drafts.mjs +1 -1
  24. package/browser/shared/extension-manifest.mjs +40 -12
  25. package/browser/shared/favorite-merge.mjs +17 -0
  26. package/browser/shared/favorites.mjs +77 -0
  27. package/browser/shared/i18n/en.mjs +123 -24
  28. package/browser/shared/outline-ops.mjs +109 -0
  29. package/browser/shared/outline.mjs +6 -0
  30. package/browser/shared/pages.mjs +20 -8
  31. package/browser/shared/paths.mjs +5 -2
  32. package/browser/shared/preference-documents.mjs +137 -0
  33. package/browser/shared/presence.mjs +94 -0
  34. package/browser/shared/preview-server.mjs +8 -5
  35. package/browser/shared/qa-levels.mjs +9 -1
  36. package/browser/shared/session.mjs +4 -0
  37. package/browser/shared/shipped-blocks.mjs +22 -4
  38. package/browser/shared/startup.mjs +101 -0
  39. package/browser/shared/workspace-columns.mjs +1 -1
  40. package/browser/shared/workspace-look.mjs +21 -8
  41. package/browser/shared/workspace-registry.mjs +6 -3
  42. package/browser/shared/workspace.mjs +37 -10
  43. package/browser/shared/writing-preferences.mjs +2 -42
  44. package/dist/chunk-25LYSMAE.mjs +2 -0
  45. package/dist/chunk-2I6ZVC5O.mjs +2 -0
  46. package/dist/{chunk-M4NRDYI5.mjs → chunk-2MYTOOP6.mjs} +1 -1
  47. package/dist/chunk-2VNENLER.mjs +2 -0
  48. package/dist/chunk-3FERXZF5.mjs +4 -0
  49. package/dist/chunk-3M6SBBGU.mjs +2 -0
  50. package/dist/chunk-3VCAAF34.mjs +2 -0
  51. package/dist/{chunk-WD4U6XXT.mjs → chunk-3ZTRLGSA.mjs} +1 -1
  52. package/dist/chunk-4FRA5AUE.mjs +2 -0
  53. package/dist/chunk-4LR2QEC2.mjs +4 -0
  54. package/dist/chunk-56SVJENP.mjs +966 -0
  55. package/dist/chunk-5CQISL2G.mjs +4 -0
  56. package/dist/{chunk-RRKJMHNX.mjs → chunk-5I5ZDDWC.mjs} +5 -5
  57. package/dist/chunk-5IHDLEB4.mjs +10 -0
  58. package/dist/chunk-5LRDMV7O.mjs +2 -0
  59. package/dist/chunk-5MVUYRKG.mjs +5 -0
  60. package/dist/chunk-5TLLIZT7.mjs +2 -0
  61. package/dist/chunk-6ILJWFYW.mjs +4 -0
  62. package/dist/chunk-6N25CJ6Y.mjs +3 -0
  63. package/dist/{chunk-SQ6Y2ZMA.mjs → chunk-7DTINW6U.mjs} +2 -2
  64. package/dist/chunk-7KWAGKIK.mjs +2 -0
  65. package/dist/chunk-7WNUOAFK.mjs +2 -0
  66. package/dist/chunk-7XCRW5RC.mjs +2 -0
  67. package/dist/{chunk-BYNPEUDS.mjs → chunk-7XSDTILF.mjs} +1 -1
  68. package/dist/chunk-ABKYFOVR.mjs +2 -0
  69. package/dist/chunk-AMUF7PUN.mjs +2 -0
  70. package/dist/{chunk-FJLM7YE7.mjs → chunk-B2EIMERT.mjs} +2 -2
  71. package/dist/{chunk-QNECWMGR.mjs → chunk-B45IAAU6.mjs} +1 -1
  72. package/dist/chunk-B6RAGF4R.mjs +2 -0
  73. package/dist/chunk-BSJKFE7I.mjs +4 -0
  74. package/dist/chunk-C72EEVLK.mjs +2 -0
  75. package/dist/chunk-CRAUKZ23.mjs +4 -0
  76. package/dist/chunk-F4CT35KL.mjs +2 -0
  77. package/dist/chunk-F63BNJLG.mjs +2 -0
  78. package/dist/chunk-FBKUPS44.mjs +2 -0
  79. package/dist/chunk-FL52ZL5Z.mjs +15 -0
  80. package/dist/chunk-FOZCU4VW.mjs +2 -0
  81. package/dist/chunk-G5HV7BC3.mjs +2 -0
  82. package/dist/{chunk-ERLAIBOA.mjs → chunk-GB5SOYQJ.mjs} +2 -2
  83. package/dist/chunk-GN3SG3IF.mjs +2 -0
  84. package/dist/{chunk-6QWQXHAV.mjs → chunk-HFTBVEZK.mjs} +1 -1
  85. package/dist/chunk-IOW5HLRK.mjs +2 -0
  86. package/dist/chunk-IQ3GJNTI.mjs +6 -0
  87. package/dist/chunk-K6SPFBUJ.mjs +2 -0
  88. package/dist/chunk-K7Y7SPTS.mjs +2 -0
  89. package/dist/chunk-L2IJCEUH.mjs +2 -0
  90. package/dist/{chunk-GPIWQ4X4.mjs → chunk-L3VT6LM4.mjs} +1 -1
  91. package/dist/chunk-L4WLQYFC.mjs +5 -0
  92. package/dist/{chunk-NLDF35P5.mjs → chunk-LAMCAGK6.mjs} +1 -1
  93. package/dist/chunk-LHGKPMTI.mjs +2 -0
  94. package/dist/chunk-LJZIYVNA.mjs +3 -0
  95. package/dist/chunk-LSVCTLS2.mjs +2 -0
  96. package/dist/chunk-LZY74XTP.mjs +2 -0
  97. package/dist/chunk-MC4LRSVH.mjs +2 -0
  98. package/dist/chunk-MCEXN4G5.mjs +2 -0
  99. package/dist/chunk-MTLAOCFF.mjs +181 -0
  100. package/dist/chunk-MZ66LN3B.mjs +2 -0
  101. package/dist/chunk-N5QWJRRI.mjs +2 -0
  102. package/dist/chunk-NF4MMOUB.mjs +2 -0
  103. package/dist/chunk-NHJYAJ73.mjs +3 -0
  104. package/dist/chunk-NRSD7SVY.mjs +2 -0
  105. package/dist/chunk-NT23I4XW.mjs +2 -0
  106. package/dist/chunk-NUALABIS.mjs +3 -0
  107. package/dist/chunk-NW6LAU22.mjs +2 -0
  108. package/dist/chunk-NWWHDGKF.mjs +5 -0
  109. package/dist/chunk-OFRCVMSJ.mjs +2 -0
  110. package/dist/chunk-OKVQQ3CX.mjs +4 -0
  111. package/dist/chunk-OM24O4KR.mjs +8 -0
  112. package/dist/{chunk-4B2TB5K2.mjs → chunk-PBMOC7KA.mjs} +2 -2
  113. package/dist/chunk-PVTCP43W.mjs +2 -0
  114. package/dist/chunk-Q62HZAJS.mjs +2 -0
  115. package/dist/chunk-QBJWIR3Q.mjs +2 -0
  116. package/dist/chunk-QDSEZX7Z.mjs +6 -0
  117. package/dist/chunk-QR4V4A2Z.mjs +15 -0
  118. package/dist/{chunk-QVGOPHOF.mjs → chunk-QRLVVZ3R.mjs} +1 -1
  119. package/dist/chunk-QW3QG67J.mjs +2 -0
  120. package/dist/chunk-R2T2EVWY.mjs +8 -0
  121. package/dist/{chunk-JJNHKGTD.mjs → chunk-R5RERE6G.mjs} +1 -1
  122. package/dist/chunk-RFHEWT3Y.mjs +5 -0
  123. package/dist/chunk-RS2Z2JQP.mjs +2 -0
  124. package/dist/chunk-S6YEC4GE.mjs +16 -0
  125. package/dist/chunk-SHZLMGGW.mjs +2 -0
  126. package/dist/chunk-TALJQM2O.mjs +2 -0
  127. package/dist/chunk-TLNJWEFY.mjs +22 -0
  128. package/dist/{chunk-ZLS2FRS6.mjs → chunk-TQZU7D7C.mjs} +1 -1
  129. package/dist/chunk-UTKNWYBA.mjs +2 -0
  130. package/dist/chunk-V3TM3TEN.mjs +2 -0
  131. package/dist/chunk-V3XROSP5.mjs +7 -0
  132. package/dist/{chunk-6QBHU4DF.mjs → chunk-V5JTW2LH.mjs} +1 -1
  133. package/dist/chunk-VAXLSISW.mjs +4 -0
  134. package/dist/chunk-VBHI3RG6.mjs +2 -0
  135. package/dist/{chunk-CRDG6EF2.mjs → chunk-VKZJRGDR.mjs} +1 -1
  136. package/dist/chunk-VZXZM7NS.mjs +2 -0
  137. package/dist/chunk-WDS6HEPE.mjs +2 -0
  138. package/dist/chunk-WHGANNEY.mjs +13 -0
  139. package/dist/chunk-WMJWC4QY.mjs +56 -0
  140. package/dist/{chunk-UTMAY3WK.mjs → chunk-WWONJJQS.mjs} +1 -1
  141. package/dist/chunk-X4WNLFIK.mjs +2 -0
  142. package/dist/chunk-XNNCQROX.mjs +11 -0
  143. package/dist/chunk-XRYECF23.mjs +170 -0
  144. package/dist/{chunk-225ALKYI.mjs → chunk-Z4NEXXFK.mjs} +1 -1
  145. package/dist/{chunk-PKVK6WFC.mjs → chunk-ZFVF2YPV.mjs} +2 -2
  146. package/dist/chunk-ZM2IX3R2.mjs +2 -0
  147. package/dist/chunk-ZNGGDUZI.mjs +2 -0
  148. package/dist/chunk-ZOEJQOKT.mjs +2 -0
  149. package/dist/cli.mjs +1 -1
  150. package/dist/server.mjs +1 -1
  151. package/dist/update-fetch.mjs +1 -1
  152. package/dist/worker.mjs +1 -1
  153. package/package.json +1 -1
  154. package/release.json +3 -3
  155. package/skill/SKILL.md +54 -148
  156. package/skill/references/building-blocks.md +4 -4
  157. package/skill/references/charts-and-figures.md +73 -0
  158. package/skill/references/extensions.md +47 -4
  159. package/skill/references/pages-and-data.md +22 -3
  160. package/skill/references/preference-files.md +7 -0
  161. package/skill/references/previews.md +17 -0
  162. package/skill/references/writing-html.md +21 -82
  163. package/web/assets/index-B4uUluLM.js +15 -0
  164. package/web/assets/index-C3vHT8sH.css +1 -0
  165. package/web/index.html +2 -2
  166. package/dist/chunk-2HS7ZBPU.mjs +0 -2
  167. package/dist/chunk-3F57LEN5.mjs +0 -2
  168. package/dist/chunk-4OZWXZE5.mjs +0 -5
  169. package/dist/chunk-5GK7HS62.mjs +0 -2
  170. package/dist/chunk-6GV3CBB2.mjs +0 -2
  171. package/dist/chunk-6NLXUKAY.mjs +0 -4
  172. package/dist/chunk-6XD6U3QA.mjs +0 -5
  173. package/dist/chunk-6Y3HYOBM.mjs +0 -2
  174. package/dist/chunk-7EFHNQ5B.mjs +0 -3
  175. package/dist/chunk-7M2BQQGZ.mjs +0 -2
  176. package/dist/chunk-7UZUQQ7Q.mjs +0 -554
  177. package/dist/chunk-ALZ6ZENZ.mjs +0 -3
  178. package/dist/chunk-BX5AKINW.mjs +0 -15
  179. package/dist/chunk-DR73Y2UJ.mjs +0 -3
  180. package/dist/chunk-EURLTOTZ.mjs +0 -4
  181. package/dist/chunk-F4ZA6JRZ.mjs +0 -3
  182. package/dist/chunk-FNCCVGKX.mjs +0 -2
  183. package/dist/chunk-FOJ3K5Z3.mjs +0 -6
  184. package/dist/chunk-FQ72LZHB.mjs +0 -2
  185. package/dist/chunk-G7N7YFVD.mjs +0 -2
  186. package/dist/chunk-GIRXJBGC.mjs +0 -2
  187. package/dist/chunk-GKOBB6DH.mjs +0 -2
  188. package/dist/chunk-GMJD7ID3.mjs +0 -2
  189. package/dist/chunk-GQJMVSSN.mjs +0 -2
  190. package/dist/chunk-HX4DLE3J.mjs +0 -10
  191. package/dist/chunk-IS7N3N6Q.mjs +0 -168
  192. package/dist/chunk-JEUK3ZO7.mjs +0 -2
  193. package/dist/chunk-JPG2LBQM.mjs +0 -11
  194. package/dist/chunk-JYK5WJPM.mjs +0 -2
  195. package/dist/chunk-KLQP46Y3.mjs +0 -4
  196. package/dist/chunk-L55NOXBE.mjs +0 -4
  197. package/dist/chunk-LCB6MARS.mjs +0 -5
  198. package/dist/chunk-LJLVCU6W.mjs +0 -16
  199. package/dist/chunk-LMUZQK5O.mjs +0 -2
  200. package/dist/chunk-NMF3IPYA.mjs +0 -13
  201. package/dist/chunk-ONKC4BCC.mjs +0 -2
  202. package/dist/chunk-OU6ZZVBX.mjs +0 -5
  203. package/dist/chunk-PUOQ65NC.mjs +0 -2
  204. package/dist/chunk-QJAVCTY7.mjs +0 -2
  205. package/dist/chunk-QP7BOHE4.mjs +0 -2
  206. package/dist/chunk-S3SX3COT.mjs +0 -20
  207. package/dist/chunk-SQ3FQCCN.mjs +0 -8
  208. package/dist/chunk-T4Y2ZSVX.mjs +0 -4
  209. package/dist/chunk-TANZRINB.mjs +0 -2
  210. package/dist/chunk-UGWMMEJ5.mjs +0 -15
  211. package/dist/chunk-UTF7GBQU.mjs +0 -4
  212. package/dist/chunk-V4ZHRALW.mjs +0 -170
  213. package/dist/chunk-XBNFXWAW.mjs +0 -6
  214. package/dist/chunk-XZV72SQ4.mjs +0 -2
  215. package/dist/chunk-YFJB534W.mjs +0 -2
  216. package/dist/chunk-Z6OKLRHC.mjs +0 -2
  217. package/dist/chunk-ZMHUDYLV.mjs +0 -2
  218. package/web/assets/index-D8P8uhDW.js +0 -15
  219. package/web/assets/index-FLb9jCfl.css +0 -1
  220. /package/dist/{chunk-PAREWQGB.mjs → chunk-NOGQX56R.mjs} +0 -0
@@ -0,0 +1 @@
1
+ :root{--font:ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--mono:"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace;--sb-w:270px;--dur:.2s;--texPri:#2c2c2b;--texSec:#7d7a75;--texTer:#a19e99;--texAcc:#5f5e59;--texDis:#bcbab6;--icoPri:#5c5a55;--icoSec:#8e8b86;--sidIco:#91918e;--borPri:#e6e5e3;--borSec:#f0efed;--borPriTra:#1c13011c;--borStrTra:#1b150030;--crumbSep:#d4d3cf;--bacPri:#fff;--bacSec:#f9f8f7;--bacEle:#fff;--popBac:#fff;--sidBac:#f3f2ef;--pageBac:#fff;--galleryPageBac:#fff;--bacIntTra:#211b170d;--bacTerTra:#2a1c0012;--inputBac:#f2f1ee99;--codeBg:#f9f8f7;--blue:#2383e2;--blueLine:#2383e291;--blueBg:#2383e224;--bluBacIntTra:#0079e413;--select:#2383e224;--red:#eb5757;--star:#cb912f;--btnPriBg:#2383e224;--btnPriBgHi:#2383e238;--btnPriTex:#1a69bd;--btnDanBg:#eb575724;--btnDanBgHi:#eb575738;--btnDanTex:#c4403c;--overlay:#0f0f0f99;--tipBg:#0f0f0f;--tipTex:#f0efed;--tipSub:#a19e99;--scrollThumb:#2a1c0024;--floatOutline:#2a1c0012;--shaOutLg:0px 20px 24px 0px #1919190d, 0px 5px 8px 0px #19191907, 0px 0px 0px 1px var(--floatOutline);--gra-tx:#7d7a75;--gra-sw:#f0efed;--gra-bg:#2a1c0012;--gra-bd:#1c13011c;--bro-tx:#9f765a;--bro-sw:#f5ede9;--bro-bg:#8b2e0016;--bro-bd:#7f330028;--ora-tx:#d27b2d;--ora-sw:#fbebde;--ora-bg:#e0650121;--ora-bd:#c4580034;--yel-tx:#cb9434;--yel-sw:#f9f3dc;--yel-bg:#d3a80023;--yel-bd:#d19c0048;--gre-tx:#50946e;--gre-sw:#e8f1ec;--gre-bg:#00642d17;--gre-bd:#00602628;--blu-tx:#387dc9;--blu-sw:#e5f2fc;--blu-bg:#007cd718;--blu-bd:#0076d934;--pur-tx:#9a6bb4;--pur-sw:#f3ebf9;--pur-bg:#6600b214;--pur-bd:#5c00a324;--pin-tx:#c14c8a;--pin-sw:#fae9f1;--pin-bg:#c5005d16;--pin-bd:#b7004e27;--red-tx:#cf5148;--red-sw:#fce9e7;--red-bg:#df160018;--red-bd:#ce18002a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--texPri:#f0efed;--texSec:#ada9a3;--texTer:#7d7a75;--texAcc:#bcbab6;--texDis:#5f5e59;--icoPri:#a9a69e;--icoSec:#ada9a3;--sidIco:#9b9b9b;--borPri:#383836;--borSec:#2c2c2b;--borPriTra:#ffffeb1a;--borStrTra:#fffceb4e;--crumbSep:#383836;--bacPri:#191919;--bacSec:#202020;--bacEle:#202020;--popBac:#252525;--sidBac:#141413;--pageBac:#181818;--galleryPageBac:#191919;--bacIntTra:#ffffff0e;--bacTerTra:#fffff315;--bluBacIntTra:#4499ff1e;--inputBac:#ffffff0e;--codeBg:#ffffff08;--star:#d99e35;--overlay:#0f0f0fcc;--btnPriBg:#439bff3d;--btnPriBgHi:#439bff57;--btnPriTex:#7ab8ff;--btnDanBg:#ff685c3d;--btnDanBgHi:#ff685c57;--btnDanTex:#ff9a90;--tipBg:#2f2f2f;--tipTex:#f0efed;--tipSub:#9b9b9b;--scrollThumb:#fffff324;--floatOutline:#383836;--shaOutLg:0px 0px 0px 1px var(--floatOutline), 0px 14px 28px -6px #19191933, 0px 2px 4px -1px #1919191e;--gra-sw:#383836;--gra-bg:#ffffeb1a;--gra-bd:#ffffeb1a;--bro-sw:#45362d;--bro-bg:#ffb18131;--bro-bd:#ffb18131;--ora-sw:#53361f;--ora-bg:#ff934b47;--ora-bd:#ff934b47;--yel-sw:#504425;--yel-bg:#ffcd4b3d;--yel-bd:#ffcd4b3d;--gre-sw:#263d30;--gre-bg:#6cffac28;--gre-bd:#6cffac28;--blu-sw:#233850;--blu-bg:#439bff3d;--blu-bd:#439bff3d;--pur-sw:#3c2d47;--pur-bg:#c87dff33;--pur-bd:#c87dff33;--pin-sw:#4e2b3c;--pin-bg:#ff67b13b;--pin-bd:#ff67b13b;--red-sw:#502c29;--red-bg:#ff685c3d;--red-bd:#ff685c3d;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}:root[data-theme=dark]{--texPri:#f0efed;--texSec:#ada9a3;--texTer:#7d7a75;--texAcc:#bcbab6;--texDis:#5f5e59;--icoPri:#a9a69e;--icoSec:#ada9a3;--sidIco:#9b9b9b;--borPri:#383836;--borSec:#2c2c2b;--borPriTra:#ffffeb1a;--borStrTra:#fffceb4e;--crumbSep:#383836;--bacPri:#191919;--bacSec:#202020;--bacEle:#202020;--popBac:#252525;--sidBac:#141413;--pageBac:#181818;--galleryPageBac:#191919;--bacIntTra:#ffffff0e;--bacTerTra:#fffff315;--bluBacIntTra:#4499ff1e;--inputBac:#ffffff0e;--codeBg:#ffffff08;--star:#d99e35;--overlay:#0f0f0fcc;--btnPriBg:#439bff3d;--btnPriBgHi:#439bff57;--btnPriTex:#7ab8ff;--btnDanBg:#ff685c3d;--btnDanBgHi:#ff685c57;--btnDanTex:#ff9a90;--tipBg:#2f2f2f;--tipTex:#f0efed;--tipSub:#9b9b9b;--scrollThumb:#fffff324;--floatOutline:#383836;--shaOutLg:0px 0px 0px 1px var(--floatOutline), 0px 14px 28px -6px #19191933, 0px 2px 4px -1px #1919191e;--gra-sw:#383836;--gra-bg:#ffffeb1a;--gra-bd:#ffffeb1a;--bro-sw:#45362d;--bro-bg:#ffb18131;--bro-bd:#ffb18131;--ora-sw:#53361f;--ora-bg:#ff934b47;--ora-bd:#ff934b47;--yel-sw:#504425;--yel-bg:#ffcd4b3d;--yel-bd:#ffcd4b3d;--gre-sw:#263d30;--gre-bg:#6cffac28;--gre-bd:#6cffac28;--blu-sw:#233850;--blu-bg:#439bff3d;--blu-bd:#439bff3d;--pur-sw:#3c2d47;--pur-bg:#c87dff33;--pur-bd:#c87dff33;--pin-sw:#4e2b3c;--pin-bg:#ff67b13b;--pin-bd:#ff67b13b;--red-sw:#502c29;--red-bg:#ff685c3d;--red-bd:#ff685c3d;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}html{scrollbar-color:var(--scrollThumb) transparent}body{font-family:var(--font);background:var(--bacPri);color:var(--texPri);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.5;overflow:hidden}button{font:inherit;color:inherit;cursor:pointer;text-align:inherit;background:0 0;border:0;margin:0;padding:0}svg{fill:none;stroke:currentColor;stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round;width:100%;height:100%;display:block}svg.fill{fill:currentColor;stroke:none}svg.solid{fill:currentColor}svg.lu{stroke-width:1.75px}.ic{display:contents}body.preload *{transition:none!important}@keyframes pop-in{0%{opacity:0;transform:translateY(-2px)}}.app{height:100dvh;font-size:14px;display:flex}.main{background:var(--bacPri);flex-direction:column;flex:1;min-width:0;font-size:16px;display:flex;position:relative}.sandbox-banner{text-align:center;color:var(--texPri);background:var(--yel-sw);flex:none;padding:2px 12px;font-size:12px;font-weight:500}:is(.icon-btn,.g-icon-btn){width:28px;height:28px;color:var(--icoSec);border-radius:6px;flex:none;justify-content:center;align-items:center;transition:background 20ms ease-in;display:inline-flex}:is(.icon-btn,.g-icon-btn) svg{width:20px;height:20px}:is(.icon-btn,.g-icon-btn) svg.lu{width:18px;height:18px}:is(.icon-btn,.g-icon-btn):hover{background:var(--bacIntTra)}.ghost-btn{height:28px;color:var(--texTer);white-space:nowrap;border-radius:6px;align-items:center;gap:6px;padding:0 8px;font-size:14px;display:inline-flex}.ghost-btn svg{width:16px;height:16px}.ghost-btn:hover{background:var(--bacIntTra)}.ghost-btn.sm{height:24px}.row-act{width:20px;height:20px;color:var(--icoSec);border-radius:4px;flex:none;justify-content:center;align-items:center;display:flex}.row-act svg{width:16px;height:16px}.row-act:hover{background:var(--bacTerTra)}.pg-icon{width:20px;height:20px;color:var(--sidIco);flex:none;justify-content:center;align-items:center;font-size:16px;line-height:1;display:inline-flex}.pg-icon svg.lu{width:18px;height:18px}.pg-icon svg.page-outline{width:16px;height:16px}.pg-icon .page-icon{object-fit:cover;border-radius:3px;width:18px;height:18px;display:block}.pg-icon .page-icon.site-icon{object-fit:contain;border-radius:3px;width:16px;height:16px}.pg-icon .glyph-icon{background:currentColor;width:18px;height:18px;display:block;-webkit-mask:none 50%/contain no-repeat;mask:none 50%/contain no-repeat}.glyph-icon[data-icon$=_gray\.svg]{color:var(--lightningcss-light,#55534e)var(--lightningcss-dark,#d3d3d3)}.glyph-icon[data-icon$=_lightgray\.svg]{color:var(--lightningcss-light,#a6a299)var(--lightningcss-dark,#7f7f7f)}.glyph-icon[data-icon$=_brown\.svg]{color:var(--lightningcss-light,#9f6b53)var(--lightningcss-dark,#aa755f)}.glyph-icon[data-icon$=_yellow\.svg]{color:var(--lightningcss-light,#cb912f)var(--lightningcss-dark,#ca8e1b)}.glyph-icon[data-icon$=_orange\.svg]{color:var(--lightningcss-light,#d9730d)var(--lightningcss-dark,#d87620)}.glyph-icon[data-icon$=_green\.svg]{color:var(--lightningcss-light,#448361)var(--lightningcss-dark,#2d9964)}.glyph-icon[data-icon$=_blue\.svg]{color:var(--lightningcss-light,#337ea9)var(--lightningcss-dark,#2e7cd1)}.glyph-icon[data-icon$=_purple\.svg]{color:var(--lightningcss-light,#9065b0)var(--lightningcss-dark,#8d5bc1)}.glyph-icon[data-icon$=_pink\.svg]{color:var(--lightningcss-light,#c14c8a)var(--lightningcss-dark,#c94079)}.glyph-icon[data-icon$=_red\.svg]{color:var(--lightningcss-light,#d44c47)var(--lightningcss-dark,#cd4945)}.menu{z-index:1000;background:var(--popBac);min-width:240px;max-width:320px;box-shadow:var(--shaOutLg);-webkit-user-select:none;user-select:none;border-radius:10px;outline:none;padding:6px 0;font-size:14px;line-height:1.2;animation:.12s ease-out pop-in;position:fixed;top:0;left:0}.menu-head{color:var(--texSec);padding:6px 12px;font-size:12px;font-weight:500;line-height:14px}.menu-item{cursor:pointer;height:28px;color:var(--texPri);border-radius:6px;align-items:center;gap:8px;margin:0 4px 1px;padding:0 8px;display:flex}.menu:not(.controlled) .menu-item:hover,.menu-item.active{background:var(--bacIntTra)}.menu-item.danger:hover,.menu-item.danger.active{color:var(--red)}.menu-item.off,.menu-item.off:hover,.menu-item.off .mi-icon,.menu-item.off:hover .mi-icon{color:var(--texDis);cursor:default}.menu:not(.controlled) .menu-item.off:hover{background:0 0}.menu-item.muted .mi-label,.menu-item.muted .mi-detail{color:var(--texDis)}.menu-item.danger:not(.off):hover .mi-icon,.menu-item.danger:not(.off).active .mi-icon{color:var(--red)}.mi-icon{width:20px;height:20px;color:var(--icoPri);flex:none;justify-content:center;align-items:center;display:flex}.mi-icon svg{width:18px;height:18px}.mi-icon svg.lu{width:16px;height:16px}.mi-label{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.mi-line{text-overflow:ellipsis;display:block;overflow:hidden}.mi-detail{color:var(--texTer);margin-top:2px;font-size:12px}.mi-kbd{max-width:45%;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;flex:none;margin-left:8px;font-size:12px;overflow:hidden}.mi-kbd:empty{display:none}.mi-arrow{width:16px;height:16px;color:var(--texTer);flex:none}.mi-arrow svg{stroke-width:1.6px}.mi-check{width:16px;height:16px;color:var(--texPri);flex:none}.mi-check svg{stroke-width:1.8px}:is(.mi-switch,.g-switch){box-sizing:border-box;background:#8783784d;border-radius:44px;flex:none;align-items:center;width:28px;height:16px;margin-left:8px;padding:2px;transition:background .2s;display:flex;position:relative}:is(.mi-switch,.g-switch).on{background:var(--blue)}:is(.mi-switch,.g-switch)>span{background:#fff;border-radius:50%;flex:none;width:12px;height:12px;transition:transform .2s ease-out;box-shadow:0 1px 2px #0f0f0f33}:is(.mi-switch,.g-switch).on>span{transform:translate(12px)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) :is(.mi-switch,.g-switch):not(.on){background:#caccce4d}}:root[data-theme=dark] :is(.mi-switch,.g-switch):not(.on){background:#caccce4d}.menu-sep{background:var(--bacTerTra);height:1px;margin:3px 12px 4px}.menu-foot{color:var(--texTer);padding:4px 12px 2px;font-size:12px;line-height:1.6}.menu-note{color:var(--texSec);padding:4px 12px 8px;font-size:13px;line-height:1.6}.menu-empty{color:var(--texTer);padding:8px 12px;font-size:13px}.menu-sub{min-width:180px}.menu-wide{width:320px}.settings-menu{width:240px}.pop-search{padding:2px 8px 6px}:is(.pop-input,.g-input){border:1px solid var(--borPriTra);background:var(--inputBac);width:100%;height:28px;color:var(--texPri);font:inherit;border-radius:6px;outline:none;padding:0 8px;font-size:14px}:is(.pop-input,.g-input):focus{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue)}.pop-list{max-height:320px;overflow-y:auto}.trash-item{border-radius:6px;align-items:center;gap:8px;height:30px;margin:0 4px;padding:0 4px 0 8px;display:flex}.trash-item:hover{background:var(--bacIntTra)}.trash-item .t{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.tip{z-index:3000;pointer-events:none;background:var(--tipBg);max-width:260px;color:var(--tipTex);box-shadow:var(--shaOutLg);overflow-wrap:anywhere;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;line-height:1.45;transition:opacity .1s;position:fixed;top:0;left:0}.tip.show{opacity:1}.tip .sub{color:var(--tipSub);font-weight:400}.toast{z-index:2500;background:var(--tipBg);width:fit-content;max-width:min(640px,100vw - 32px);color:var(--tipTex);box-shadow:var(--shaOutLg);opacity:0;pointer-events:none;border-radius:8px;align-items:center;gap:10px;margin:0 auto;padding:8px 14px;font-size:14px;transition:opacity .18s,transform .18s;display:flex;position:fixed;bottom:24px;left:0;right:0;transform:translateY(10px)}.toast.show{opacity:1;transform:none}.toast.show button{pointer-events:auto}.toast.error:before{content:"";background:#ff6b6b;border-radius:50%;flex:none;width:6px;height:6px}.toast button{white-space:nowrap;color:#5ea8f2;border-radius:4px;flex:none;margin-right:-6px;padding:2px 6px;font-weight:500}.toast button:hover{background:#ffffff14}.dialog-overlay{align-items:flex-start;padding-top:18vh}.dialog{background:var(--popBac);width:min(420px,100%);box-shadow:var(--shaOutLg);border-radius:12px;padding:20px 20px 16px;animation:.12s ease-out pop-in}.dialog-title{color:var(--texPri);font-size:16px;font-weight:600;line-height:1.4}.dialog-message{color:var(--texSec);margin-top:8px;font-size:14px;line-height:1.6}.dialog-actions{justify-content:flex-end;gap:8px;margin-top:18px;display:flex}:is(.dialog-btn,.g-btn){height:32px;color:var(--texPri);white-space:nowrap;border-radius:6px;padding:0 14px;font-size:14px;transition:background 20ms ease-in}:is(.dialog-btn,.g-btn):hover:not(:disabled){background:var(--bacIntTra)}:is(.dialog-btn,.g-btn):focus-visible{background:var(--bacTerTra);outline:none}:is(.dialog-btn,.g-btn).primary{background:var(--btnPriBg);color:var(--btnPriTex);font-weight:500}:is(.dialog-btn,.g-btn).primary:hover:not(:disabled),:is(.dialog-btn,.g-btn).primary:focus-visible{background:var(--btnPriBgHi)}:is(.dialog-btn,.g-btn).danger.primary{background:var(--btnDanBg);color:var(--btnDanTex)}:is(.dialog-btn,.g-btn).danger.primary:hover:not(:disabled),:is(.dialog-btn,.g-btn).danger.primary:focus-visible{background:var(--btnDanBgHi)}:is(.dialog-btn,.g-btn):disabled{opacity:.5;cursor:default}.trash-head{justify-content:space-between;align-items:center;gap:16px;display:flex}.trash-head .trash-clear{border:0;height:26px;padding:0 8px;font-size:12px}.pref-overlay.ext-overlay{align-items:flex-start;padding-top:12vh}.pref-dialog.ext-dialog{height:auto;max-height:min(720px,100%)}.ext-empty{text-align:center;flex-direction:column;align-items:center;gap:6px;padding:40px 24px 28px;display:flex}.ext-empty .ext-icon{background:var(--bacIntTra);width:40px;height:40px;color:var(--icoSec);border-radius:10px;flex:none;font-size:18px;line-height:1}.ext-empty .ext-icon svg{stroke-width:1.25px;width:20px;height:20px}.ext-empty-title{color:var(--texPri);margin-top:6px;font-size:14px;font-weight:500;line-height:20px}.ext-empty-hint{max-width:380px;color:var(--texSec);font-size:13px;line-height:1.5}.ext-add{background:var(--bacIntTra);width:100%;height:40px;color:var(--texSec);font:inherit;cursor:pointer;border-radius:10px;justify-content:center;align-items:center;gap:6px;font-size:14px;display:flex}.ext-add:hover,.ext-add[aria-expanded=true]{background:var(--bacTerTra)}.ext-add:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:6px}.ext-add svg{stroke-width:1.6px;width:16px;height:16px}.ext-add+.ext-import{margin-top:8px}.comp-import.ext-import{gap:8px}.ext-import .comp-import-pick{margin:0}.ext-card[data-off] .comp-pack-icon{opacity:.55;filter:grayscale()}.ext-card .comp-toggle:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:44px}.ext-state{align-items:center;gap:6px;min-width:0;display:inline-flex}.ext-state:before{content:"";background:var(--blue);border-radius:50%;flex:none;width:6px;height:6px}.ext-state[data-tone=error]{color:var(--red)}.ext-state[data-tone=error]:before{background:var(--red)}.comp-pack-meta .ext-state{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.comp-pack-meta .ext-state[data-tone=info]{color:var(--texSec)}.ext-view .comp-pack-head .comp-pack-icon{background:var(--bacIntTra)}.ext-view>.comp-note{margin-bottom:6px}.ext-view>.ext-state{margin:2px 0 8px;font-size:13px;line-height:18px;display:flex}.ext-view>.ext-state[data-tone=info]{color:var(--texSec)}.ext-rows{margin-top:10px}.ext-row{border-top:1px solid var(--borSec);grid-template-columns:20px 76px minmax(0,1fr) auto;align-items:center;gap:0 10px;min-height:40px;display:grid}.ext-row:last-child{border-bottom:1px solid var(--borSec)}.ext-row .comp-icon svg{width:18px;height:18px}.ext-row-label{color:var(--texPri);white-space:nowrap;font-size:14px;line-height:20px}.ext-row-value{min-width:0;color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:18px;overflow:hidden}.ext-row-value code{font-family:var(--mono);font-size:12px}.ext-link{height:26px;color:var(--texSec);font:inherit;white-space:nowrap;cursor:pointer;border-radius:6px;flex:none;padding:0 8px;font-size:13px}.ext-link:hover{background:var(--bacIntTra);color:var(--texPri)}.ext-link:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}.ext-state .ext-link{height:20px;color:var(--btnPriTex);margin:-1px 0;padding:0 6px;font-weight:500}.ext-remove{color:var(--red);margin:14px 0 0 -8px}.ext-remove:hover{color:var(--red)}.ext-icon{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.ext-icon img{object-fit:contain;width:24px;height:24px}.ext-dialog .comp-pack-icon .page-icon{width:24px;height:24px}.ext-view>.ext-state{overflow-wrap:anywhere;white-space:pre-wrap}@media (width<=560px){.ext-row{grid-template-columns:20px 64px minmax(0,1fr);row-gap:4px;padding:6px 0}.ext-row>.ext-link{grid-column:3;justify-self:start}}.modal{z-index:1500;background:var(--overlay);justify-content:center;align-items:flex-start;padding:12vh 16px 0;display:flex;position:fixed;inset:0}.search-panel{background:var(--popBac);width:min(620px,100%);box-shadow:var(--shaOutLg);border-radius:12px;animation:.12s ease-out pop-in;overflow:hidden}.search-bar{border-bottom:1px solid var(--borSec);align-items:center;gap:10px;height:52px;padding:0 16px;display:flex}.search-bar svg{width:20px;height:20px;color:var(--icoSec);flex:none}.search-bar input{min-width:0;color:var(--texPri);font:inherit;background:0 0;border:0;outline:0;flex:1;font-size:16px}.search-bar input::placeholder{color:var(--texTer)}.search-list{max-height:60vh;padding:4px 0 8px;overflow-y:auto}.search-item{cursor:pointer;border-radius:6px;align-items:center;gap:10px;height:36px;margin:0 6px;padding:0 10px;display:flex}.search-item.active{background:var(--bacIntTra)}.search-item .t{white-space:nowrap;text-overflow:ellipsis;flex:none;max-width:60%;overflow:hidden}.search-item .path{text-align:right;min-width:0;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:12px;overflow:hidden}.search-main{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.search-line{align-items:center;gap:10px;min-width:0;display:flex}.search-item.with-hit{align-items:flex-start;height:auto;min-height:36px;padding-top:6px;padding-bottom:6px}.search-item.with-hit .pg-icon{margin-top:1px}.search-snippet{min-width:0;color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:18px;overflow:hidden}.search-item.more{align-items:center;height:28px;min-height:0;padding:0 10px 0 40px}.search-item mark{color:var(--texPri);background:0 0;font-weight:600}.search-note{color:var(--texTer);padding:6px 16px 2px;font-size:12px}.link-view{background:var(--pageBac);flex:1;min-height:0;position:relative}.link-view.off,.link-pane.off{display:none}.link-pane{display:flex;position:absolute;inset:0}.link-frame{background:#fff;border:0;flex:1;width:100%;height:100%;display:block}.link-refused{flex:1}.link-refused-icon{width:36px;height:36px;color:var(--texTer);margin-bottom:6px}.link-refused-icon svg{width:36px;height:36px}.link-refused-url{word-break:break-all;max-width:min(560px,90%)!important;color:var(--texTer)!important;font-size:13px!important}.report-view{flex:1;min-height:0;position:relative}.report-frame{background:var(--pageBac);border:0;width:100%;height:100%;display:block}body.dragging iframe,body.resizing iframe{pointer-events:none}.report-state{text-align:center;flex-direction:column;flex:1;justify-content:center;align-items:center;gap:6px;min-height:0;padding:24px;display:flex}.report-state h2{margin:0;font-size:20px;font-weight:600}.report-state p{max-width:460px;color:var(--texSec);margin:0;font-size:14px;line-height:1.6}.report-state .muted{color:var(--texTer)}.report-state-actions{gap:8px;margin-top:10px;display:flex}.report-frame[data-pending]{opacity:0;pointer-events:none;position:absolute;inset:0}.card-underlay{z-index:900;background:var(--overlay);animation:.16s ease-out card-underlay-fade;position:fixed;inset:0}body.card-open .sb-resizer,body.card-open .sb-edge{pointer-events:none}@keyframes card-underlay-fade{0%{opacity:0}}@media (prefers-reduced-motion:reduce){.card-underlay{animation:none}}.report-view.off{display:none}.xf-overlay{z-index:1500;background:var(--overlay);justify-content:center;align-items:center;padding:16px;display:flex;position:fixed;inset:0}.xf-export,.xf-import{background:var(--popBac);box-shadow:var(--shaOutLg);color:var(--texPri);border-radius:12px;animation:.12s ease-out pop-in}.xf-export{width:320px;max-width:100%;padding:24px;font-size:14px}.xf-row{justify-content:space-between;align-items:center;height:28px;display:flex}.xf-label{color:var(--texTer);white-space:nowrap;margin-inline-end:auto;line-height:21px}.xf-select{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;height:28px;color:var(--texPri);border-radius:6px;align-items:center;gap:6px;margin-inline-end:-6px;padding:0 8px;line-height:1.2;transition:background 20ms ease-in;display:flex}.xf-select:hover,.xf-select.open{background:var(--bacIntTra)}.xf-select svg{width:14px;height:14px;color:var(--icoSec);stroke-width:1.6px}.xf-select:focus-visible,.xf-btn:focus-visible,.xf-choose:focus-visible{background:var(--bacTerTra);outline:none}.xf-switch:focus-visible{box-shadow:0 0 0 3px var(--blueBg);outline:none}.xf-scale-row{height:32px}.xf-scale{background:var(--inputBac);width:60px;height:28px;box-shadow:0 0 0 1px var(--borPriTra);color:var(--texPri);font:inherit;text-align:end;border:none;border-radius:6px;outline:none;padding:4px 10px;font-size:14px}.xf-scale:focus{box-shadow:0 0 0 1px var(--blue) inset, 0 0 0 1px var(--blue)}.xf-error{min-height:32px;color:var(--red);align-items:center;padding:4px 0;font-size:12px;line-height:16px;display:flex}.xf-switch-row{height:32px}.xf-switch-row .xf-label{line-height:20px}.xf-switch{box-sizing:content-box;cursor:pointer;background:#8783784d;border-radius:44px;flex-shrink:0;width:26px;height:14px;padding:2px;transition:background .2s,box-shadow .2s;display:flex;position:relative}.xf-switch.on{background:var(--blue)}.xf-switch>span{background:#fff;border-radius:44px;width:14px;height:14px;transition:transform .2s ease-out,background .2s ease-out}.xf-switch.on>span{transform:translate(12px)}.xf-switch.disabled{opacity:.4;cursor:default}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .xf-switch:not(.on){background:#caccce4d}}:root[data-theme=dark] .xf-switch:not(.on){background:#caccce4d}.xf-actions{justify-content:flex-end;align-items:center;gap:8px;margin-top:16px;display:flex}.xf-btn{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:6px;justify-content:center;align-items:center;height:28px;padding:0 8px;font-size:14px;line-height:1.2;transition:background 20ms ease-in;display:inline-flex}.xf-btn.gray{color:var(--texSec)}.xf-btn.gray:hover{background:var(--bacIntTra)}.xf-btn.blue{background:var(--btnPriBg);color:var(--btnPriTex);font-weight:500}.xf-btn.blue:hover,.xf-btn.blue:focus-visible{background:var(--btnPriBgHi)}.xf-btn[aria-disabled=true]{opacity:.4;pointer-events:none}.menu.menu-select{z-index:1600;width:180px;min-width:180px}.menu-select .mi-icon:empty{display:none}.xf-import{flex-direction:column;gap:14px;width:min(460px,100vw - 32px);padding:20px 20px 18px;font-size:14px;display:flex}.xf-import-head{flex-direction:column;gap:2px;min-width:0;display:flex}.xf-import-title{font-size:16px;font-weight:600;line-height:1.4}.xf-import-where{color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:1.5;overflow:hidden}.xf-drop{border:1px dashed var(--borStrTra);color:var(--texPri);cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:10px;flex-direction:column;align-items:center;gap:6px;padding:30px 16px 26px;transition:background .12s,border-color .12s;display:flex}.xf-drop:hover{background:var(--bacIntTra)}.xf-drop.dragging{border-color:var(--blue);background:var(--bluBacIntTra)}.xf-drop:focus-visible{background:var(--bacTerTra);outline:none}.xf-drop svg{width:28px;height:28px;color:var(--icoSec);stroke-width:1.4px;margin-bottom:4px;transition:color .12s}.xf-drop.dragging svg{color:var(--blue)}.xf-drop-main{line-height:20px}.xf-choose{color:var(--blue);margin-inline-start:2px}.xf-drop-kinds,.xf-import-note{color:var(--texTer);font-size:12px;line-height:16px}.pref-overlay{z-index:1500;background:var(--overlay);justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}.pref-dialog{background:var(--bacPri);width:min(880px,100%);height:min(86vh,900px);box-shadow:var(--shaOutLg);border-radius:12px;flex-direction:column;animation:.12s ease-out pop-in;display:flex;overflow:hidden}.pref-head{border-bottom:1px solid var(--borSec);flex:none;align-items:center;gap:10px;height:48px;padding:0 12px 0 20px;display:flex}.pref-title{color:var(--texPri);flex:none;font-size:14px;font-weight:600}.pref-sub{white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--texSec);flex:1;font-size:13px;overflow:hidden}.pref-actions{flex:none;align-items:center;gap:4px;display:flex}.pref-save{height:28px;color:var(--btnPriTex);background:var(--btnPriBg);white-space:nowrap;border-radius:6px;flex:none;padding:0 10px;font-size:14px;font-weight:500}.pref-save:hover:not(:disabled),.pref-save:focus-visible{background:var(--btnPriBgHi);outline:none}.pref-save:disabled{opacity:.5;cursor:default}.pref-note{border-bottom:1px solid var(--borSec);background:var(--bacSec);color:var(--texSec);overflow-wrap:anywhere;flex:none;padding:8px 20px;font-size:13px;line-height:1.5}.pref-body{background:var(--bacPri);flex:1;min-height:0;position:relative}.pref-frame{background:var(--pageBac);border:0;width:100%;height:100%;position:absolute;inset:0}.pref-frame[data-pending]{opacity:0;pointer-events:none}.pref-loading{opacity:0;height:2px;animation:.2s ease-out .3s forwards pref-loading-in;position:absolute;top:0;left:0;right:0;overflow:hidden}.pref-loading:before{content:"";background:var(--borStrTra);border-radius:1px;width:24%;animation:1.6s ease-in-out infinite pref-loading-pass;position:absolute;top:0;bottom:0;left:0}@keyframes pref-loading-in{to{opacity:1}}@keyframes pref-loading-pass{0%{transform:translate(-100%)}to{transform:translate(417%)}}@media (prefers-reduced-motion:reduce){.pref-loading:before{width:100%;animation:none}}.comp-dialog{width:min(640px,100%);height:min(86vh,720px)}.comp-body{flex:1;min-height:0;padding:4px 20px 20px;overflow-y:auto}.comp-group{color:var(--texPri);margin:16px 0 4px;font-size:14px;font-weight:600}.comp-lead,.comp-empty{color:var(--texSec);padding:4px 0 8px;font-size:13px;line-height:1.5}.comp-problem{color:var(--texPri);margin-top:12px;font-size:13px;line-height:1.5}.comp-row{border-top:1px solid var(--borSec);align-items:center;gap:16px;padding:8px 0;display:flex}.comp-row.comp-block{gap:8px;padding:6px 0}.comp-icon{width:20px;height:20px;color:var(--icoPri);flex:none;justify-content:center;align-items:center;display:flex}.comp-icon svg{stroke-width:1.25px;width:20px;height:20px}.comp-name{min-width:0;color:var(--texPri);overflow-wrap:anywhere;flex:1;font-size:14px;line-height:20px}.comp-row.comp-pkg{padding:0;display:block}.comp-line{border-radius:6px;align-items:center;gap:8px;margin:0 -8px;padding:2px 8px;display:flex}.comp-line:hover{background:var(--bacIntTra)}.comp-head{text-align:left;min-width:0;min-height:28px;font:inherit;color:inherit;cursor:pointer;background:0 0;flex:1;align-items:center;gap:8px;padding:0;display:flex}.comp-head .comp-name{flex:0 auto}.comp-chev{width:14px;height:14px;color:var(--texTer);flex:none}.comp-chev svg{stroke-width:1.6px;transition:transform .15s ease-out}.comp-row[data-open] .comp-chev svg{transform:rotate(90deg)}.comp-tag{color:var(--texTer);flex:none;margin-left:auto;padding-left:8px;font-size:12px}.comp-detail{flex-direction:column;gap:2px;padding:0 0 10px 28px;display:flex}.comp-meta{max-width:100%;color:var(--texTer);overflow-wrap:anywhere;font-size:12px;line-height:18px;display:block}.comp-note{color:var(--texSec);overflow-wrap:anywhere;font-size:13px;line-height:18px}.comp-state{color:var(--texTer)}.comp-opts{flex-direction:column;margin-top:6px;display:flex}.comp-opt{text-align:left;font:inherit;color:inherit;cursor:pointer;background:0 0;border-radius:6px;align-items:center;gap:16px;margin:0 -8px;padding:6px 8px;display:flex}.comp-opt:hover{background:var(--bacIntTra)}.comp-opt-text{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.comp-opt .comp-toggle-name{color:var(--texPri);font-size:14px;line-height:20px}.comp-opt-hint{color:var(--texSec);overflow-wrap:anywhere;font-size:13px;line-height:18px}.comp-opt .mi-switch{margin:0}.comp-opt[aria-disabled=true]{cursor:default;opacity:.5}.comp-opt[aria-disabled=true]:hover{background:0 0}.comp-packs{grid-template-columns:repeat(auto-fill,minmax(176px,1fr));gap:8px;margin:4px 0 8px;display:grid}.comp-pack{background:var(--bacIntTra);border-radius:10px;align-items:center;gap:8px;min-height:64px;padding:0 12px 0 0;display:flex;position:relative}.comp-pack:hover{background:var(--bacTerTra)}.comp-pack-open{text-align:left;min-width:0;font:inherit;color:inherit;cursor:pointer;background:0 0;border-radius:10px 0 0 10px;flex:1;align-self:stretch;align-items:center;gap:10px;padding:10px 0 10px 12px;display:flex}.comp-pack-open:focus-visible,.comp-pack-add:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}.comp-pack-icon{background:var(--bacPri);width:32px;height:32px;color:var(--icoPri);border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.comp-pack-icon svg{stroke-width:1.25px;width:18px;height:18px}.comp-pack-words{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.comp-pack-name{color:var(--texPri);white-space:nowrap;text-overflow:ellipsis;font-size:14px;font-weight:500;line-height:20px;overflow:hidden}.comp-pack-meta{min-width:0;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;gap:8px;font-size:12px;line-height:16px;display:flex;overflow:hidden}.comp-pack-author{text-overflow:ellipsis;min-width:0;overflow:hidden}.comp-pack[data-off] .comp-pack-name{color:var(--texSec)}.comp-pack-add{font:inherit;color:var(--texSec);cursor:pointer;justify-content:center;padding:0 12px}.comp-pack-add .comp-pack-icon{width:20px;height:20px;color:var(--texSec);background:0 0}.comp-pack-add .comp-pack-icon svg{stroke-width:1.6px;width:16px;height:16px}.comp-pack-add .comp-pack-name{color:var(--texSec);flex:none;font-weight:400}.comp-pack-add[aria-expanded=true]{background:var(--bacTerTra)}.comp-import{flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 8px;display:flex}.comp-import-row{align-items:center;gap:8px;width:100%;display:flex}.comp-import-row .pop-input{flex:1;min-width:0}.comp-import-row .dialog-btn{flex:none;height:28px;padding:0 12px;font-size:13px}.comp-import-pick{height:24px;font:inherit;color:var(--texSec);cursor:pointer;background:0 0;border-radius:6px;margin:0 -6px;padding:0 6px;font-size:13px}.comp-import-pick:hover:not(:disabled){background:var(--bacIntTra)}.comp-import-error{color:var(--red);overflow-wrap:anywhere;font-size:13px;line-height:1.5}.comp-back{height:26px;font:inherit;color:var(--texSec);cursor:pointer;background:0 0;border-radius:6px;align-items:center;gap:4px;margin:0 0 6px -6px;padding:0 8px 0 6px;font-size:13px;display:inline-flex}.comp-back:hover{background:var(--bacIntTra)}.comp-back-icon{flex:none;width:14px;height:14px;display:flex}.comp-back-icon svg{stroke-width:1.6px;transform:rotate(180deg)}.comp-pack-head{align-items:center;gap:10px;padding:2px 0 6px;display:flex}.comp-pack-view>.comp-note{margin-bottom:6px}.comp-pack-view .comp-lead{padding-top:6px}.comp-toggle{cursor:pointer;background:0 0;flex:none;align-items:center;height:24px;padding:0;display:flex}.comp-toggle .mi-switch{margin:0}.comp-toggle[aria-disabled=true]{cursor:default;opacity:.5}.gallery-extension-anchor:empty{display:none}.gallery-extension-anchor:has(>.gallery-extension-slot:empty){display:none}.gallery-extension-slot.topbar-end{align-items:center;gap:6px;display:flex}.gallery-extension-slot.sidebar-footer{flex-direction:column;display:flex}.extension-setting{justify-content:space-between;align-items:center;gap:16px;padding:16px 0;display:flex}.extension-setting p{margin:6px 0}.extension-setting small{overflow-wrap:anywhere;opacity:.65}.wp-dialog{container-type:inline-size}.menu.wp-menu{z-index:1600}.wp-tabs{border-bottom:1px solid var(--borSec);flex:none;align-items:center;gap:8px;height:44px;padding:0 12px;display:flex}.wp-strip{scrollbar-width:none;flex:1;align-items:center;gap:2px;min-width:0;height:100%;display:flex;position:relative;overflow:auto hidden}.wp-strip::-webkit-scrollbar{display:none}.wp-tab{height:28px;color:var(--texSec);white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:6px;outline:none;flex:none;align-items:center;gap:6px;padding:0 10px;font-size:14px;transition:background 20ms ease-in;display:flex}.wp-tab:hover{background:var(--bacIntTra)}.wp-tab[aria-selected=true]{background:var(--bacIntTra);color:var(--texPri);font-weight:500}.wp-tab[aria-selected=true]:hover{background:var(--bacTerTra)}.wp-tab:focus-visible{box-shadow:0 0 0 2px var(--blue)}.wp-tab-off .wp-tab-name{color:var(--texTer)}.wp-tag{color:var(--texTer);font-size:12px;font-weight:400}.wp-tab .pop-input{width:8em;height:24px;margin:0 -6px;padding:0 6px;font-size:14px;font-weight:400}.wp-tab.wp-dragging{opacity:.4}.wp-new{width:28px;height:28px;color:var(--icoSec);cursor:pointer;border-radius:6px;flex:none;justify-content:center;align-items:center;display:flex}.wp-new:hover{background:var(--bacIntTra)}.wp-new svg{stroke-width:1.6px;width:16px;height:16px}.wp-enable{height:28px;color:var(--texSec);font:inherit;cursor:pointer;border-radius:6px;flex:none;align-items:center;gap:8px;padding:0 4px 0 8px;font-size:13px;display:flex}.wp-enable:hover{background:var(--bacIntTra)}.wp-enable .mi-switch{margin:0}.wp-enable:focus-visible,.wp-new:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}@container (width<=520px){.wp-enable-label{display:none}}.wp-editor{flex-direction:column;flex:1;min-height:0;display:flex}.wp-editor[hidden]{display:none}.wp-tab{position:relative}.wp-tab[data-drop]:after{content:"";background:var(--blue);width:2px;position:absolute;top:0;bottom:0}.wp-tab[data-drop=before]:after{left:-1px}.wp-tab[data-drop=after]:after{right:-1px}.present{z-index:2000;background:var(--bacPri);position:fixed;inset:0}.present-frame{background:var(--pageBac);transform-origin:0 0;border:0;width:100%;height:100%;position:absolute;top:0;left:0}.present-ink{pointer-events:none;touch-action:none;width:100%;height:100%;position:absolute;inset:0}.present:is([data-tool=laser],[data-tool=pen],[data-tool=marker],[data-tool=eraser]) .present-ink{pointer-events:auto}.present[data-tool=laser] .present-ink{cursor:none}.present[data-tool=pen] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Ccircle cx='8' cy='8' r='4' fill='%23e03e3e' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") 8 8,crosshair}.present[data-tool=marker] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Crect x='3' y='3' width='16' height='16' rx='5' fill='rgba(255,204,0,.55)' stroke='rgba(120,90,0,.55)' stroke-width='1'/%3E%3C/svg%3E") 11 11,crosshair}.present[data-tool=eraser] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='10' fill='rgba(140,140,140,.28)' stroke='rgba(110,110,110,.9)' stroke-width='1.5'/%3E%3C/svg%3E") 12 12,default}.present-notice{background:var(--tipBg);color:var(--tipTex);box-shadow:var(--shaOutLg);white-space:nowrap;pointer-events:none;border-radius:8px;padding:8px 14px;font-size:14px;position:absolute;bottom:24px;left:50%;transform:translate(-50%)}.present-bar{background:var(--popBac);box-shadow:var(--shaOutLg);border-radius:10px;align-items:center;gap:2px;padding:4px;transition:opacity .3s;display:flex;position:absolute;bottom:16px;left:16px}.present-bar.idle{opacity:.25}.present-btn{width:32px;height:32px;color:var(--icoPri);border-radius:6px;justify-content:center;align-items:center;display:flex}.present-btn:hover{background:var(--bacIntTra)}.present-btn[aria-pressed=true]{background:var(--bacTerTra);color:var(--texPri)}.present-btn:disabled{opacity:.35;pointer-events:none}.present-btn svg{width:18px;height:18px}.present-sep{background:var(--borSec);flex:none;width:1px;height:18px;margin:0 4px}.present-zoom{min-width:48px;height:32px;color:var(--texPri);font-variant-numeric:tabular-nums;text-align:center;border-radius:6px;flex:none;padding:0 4px;font-size:13px}.present-zoom:hover{background:var(--bacIntTra)}.present-ink{mix-blend-mode:multiply}:root[data-theme=dark] .present-ink{mix-blend-mode:screen}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .present-ink{mix-blend-mode:screen}}body:has(.present) .toast{display:none}.hist-dialog{width:min(920px,100%);height:min(86vh,760px)}.hist-body{flex:1;min-height:0;display:flex}.hist-view{background:var(--bacPri);flex:1;min-width:0;padding:24px 40px 32px;overflow-y:auto}.hist-side{border-left:1px solid var(--borSec);background:var(--bacPri);flex-direction:column;flex:none;width:280px;display:flex}.hist-list{flex:1;min-height:0;padding:6px;overflow-y:auto}.hist-foot{border-top:1px solid var(--borSec);flex:none;justify-content:flex-end;padding:10px 12px;display:flex}.hist-empty{color:var(--texSec);padding:12px 8px;font-size:13px;line-height:1.5}.hist-item{text-align:left;width:100%;font:inherit;color:inherit;cursor:pointer;background:0 0;border-radius:6px;flex-direction:column;align-items:stretch;gap:2px;padding:7px 10px;display:flex}.hist-item:hover{background:var(--bacIntTra)}.hist-item[aria-selected=true]{background:var(--bacTerTra)}.hist-item:focus-visible{background:var(--bacTerTra);outline:none}.hist-line{align-items:baseline;gap:6px;min-width:0;display:flex}.hist-time{color:var(--texPri);white-space:nowrap;font-size:14px;font-weight:500;line-height:20px}.hist-tag{color:var(--btnPriTex);background:var(--btnPriBg);border-radius:4px;flex:none;padding:0 5px;font-size:12px;line-height:18px}.hist-who{color:var(--texSec);white-space:nowrap;margin-left:auto;font-size:12px;line-height:20px}.hist-sum{color:var(--texSec);overflow-wrap:anywhere;font-size:12px;line-height:18px}.hist-block{color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;font-size:12px;line-height:18px;overflow:hidden}.hist-row{color:var(--texPri);white-space:pre-wrap;overflow-wrap:anywhere;gap:6px;margin:0 0 6px;font-size:15px;line-height:1.65;display:flex}.hist-title{margin-bottom:14px;font-size:26px;font-weight:700;line-height:1.3}.hist-h2{margin-top:14px;font-size:20px;font-weight:600;line-height:1.4}.hist-h3,.hist-h4,.hist-h5,.hist-h6{margin-top:10px;font-size:17px;font-weight:600;line-height:1.45}.hist-marker{min-width:14px;color:var(--texSec);flex:none}.hist-more{color:var(--texTer);margin-top:12px;font-size:13px}@media (width<=640px){.hist-body{flex-direction:column-reverse}.hist-side{border-left:0;border-bottom:1px solid var(--borSec);width:auto;max-height:50%}.hist-view{padding:16px}}.sb-container{z-index:20;width:var(--sb-w);background:var(--sidBac);transition:width var(--dur) ease;flex:none;position:relative}.sb-container.collapsed{width:0}.sb-anchor{z-index:9;width:0;position:absolute;top:0;bottom:0;left:0}.sidebar{width:var(--sb-w);height:100%;transition-property:width,opacity,transform,visibility;transition-duration:var(--dur);flex-direction:column;transition-timing-function:ease;display:flex;position:relative}.sidebar .float-bg{z-index:-1;background:var(--sidBac);box-shadow:var(--shaOutLg);border-radius:0 14px 14px 0;display:none;position:absolute;inset:0}.sb-inner{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.sidebar :is(.icon-btn,.g-icon-btn,.row-act){color:var(--sidIco)}.sidebar.floating{height:calc(100vh - 91px);transform:translateX(calc(20px - var(--sb-w))) translateY(59px);opacity:0;visibility:hidden;pointer-events:none}.sidebar.floating .float-bg{display:block}.sidebar.floating .sb-inner{border-radius:0 14px 14px 0}.sidebar.floating:before{content:"";height:15px;position:absolute;top:-15px;left:0;right:0}.sidebar.floating.peek{opacity:1;visibility:visible;pointer-events:auto;transform:translate(0)translateY(59px)}.sidebar.mobile{height:auto;width:min(var(--sb-w), 86vw);visibility:hidden;pointer-events:none;position:fixed;top:0;bottom:0;left:0;transform:translate(-100%)}.sidebar.mobile .float-bg{display:block}.sidebar.mobile .sb-inner{border-radius:0 14px 14px 0}.sidebar.mobile.mobile-open{visibility:visible;pointer-events:auto;transform:none}.sb-backdrop{z-index:1;background:var(--overlay);display:none;position:fixed;inset:0}.sb-backdrop.show{display:block}.sb-edge{z-index:8;width:32px;display:none;position:fixed;top:44px;bottom:0;left:0}.app.peekable .sb-edge{display:block}.sb-web-button{z-index:10;background:var(--sidBac);width:36px;height:36px;color:var(--sidIco);box-shadow:0 0 0 1px var(--floatOutline), 0 2px 8px #00000024;touch-action:none;-webkit-user-select:none;user-select:none;cursor:grab;transition:transform var(--dur) ease;border:0;border-radius:50%;justify-content:center;align-items:center;display:flex;position:fixed;top:0;left:0}.sb-web-button svg{pointer-events:none;width:18px;height:18px}.sb-web-button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}.sb-web-button.dragging{cursor:grabbing;transition:none}.sb-web-drag-cover{z-index:8;cursor:grabbing;position:fixed;inset:0}@media (prefers-reduced-motion:reduce){.sb-web-button{transition:none}}.sb-resizer{cursor:col-resize;z-index:10;width:4px;position:absolute;top:0;bottom:0;right:-2px}.sb-resizer:after{content:"";background:0 0;width:2px;transition:background .15s;position:absolute;top:0;bottom:0;left:0}.sb-resizer:hover:after,body.resizing .sb-resizer:after{background:var(--borStrTra)}body.resizing,body.resizing *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}body.resizing .sb-container,body.resizing .sidebar{transition:none!important}.sb-head{flex-direction:column;flex:none;gap:1px;padding:8px 8px 4px;transition:box-shadow .15s;display:flex}.sb-head.scrolled{box-shadow:0 1px 0 var(--borSec)}.sb-top{align-items:center;gap:5px;height:28px;margin-bottom:7px;padding-left:5px;display:flex}.sidebar.floating .sb-top{display:none}.sb-brand{white-space:nowrap;min-width:0;color:var(--texPri);cursor:default;-webkit-user-select:none;user-select:none;font-family:Iowan Old Style,Palatino Linotype,Palatino,Book Antiqua,Georgia,serif;font-size:19px;font-weight:400;line-height:28px;overflow:hidden}.sb-act{min-width:0;height:30px;color:var(--texSec);text-align:left;border-radius:6px;align-items:center;gap:8px;padding:0 8px;font-size:14px;font-weight:500;transition:background 20ms ease-in;display:flex}.sb-act:hover{background:var(--bacIntTra)}.sb-act-icon{width:22px;height:20px;color:var(--sidIco);flex:none;justify-content:center;align-items:center;display:flex}.sb-act-icon svg{width:18px;height:18px}.sb-act-label{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.sb-brand.home{cursor:pointer}.sb-rows{flex-direction:column;gap:1px;display:flex;position:relative}.sb-page{cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.sb-act.selected{background:var(--bacIntTra);color:var(--texPri)}.sb-act.selected:hover,.sb-act.menu-open,.sb-page:focus-visible{background:var(--bacTerTra)}.sb-page .pg-icon{justify-content:center;align-items:center;width:20px;height:20px;display:flex}.sb-page.renaming{cursor:default}.sb-page .sb-page-actions{margin-right:-2px;padding-right:0}.sb-page:hover .sb-page-actions,.sb-page.menu-open .sb-page-actions{display:flex}.sb-act.drag-src{opacity:.4}body.dragging .sb-act:not(.selected):hover{background:0 0}body.dragging .sb-page-actions{display:none!important}.sb-page .row-rename{margin:0 -2px 0 -6px;font-weight:400}.sb-scroll{scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;flex:1;min-height:0;padding:6px 0 12px;position:relative;overflow:hidden auto}.section{margin:0 8px 4px}.section.expanded{padding-bottom:12px}.sec-head{-webkit-user-select:none;user-select:none;align-items:center;height:30px;padding:0 2px;display:flex}.sec-toggle{border-radius:6px;flex:0 auto;align-items:center;gap:2px;min-width:0;height:22px;padding:0 4px 0 6px;display:inline-flex}.sec-text{white-space:nowrap;text-overflow:ellipsis;min-width:0;line-height:16px;overflow:hidden}.sec-toggle:hover,.sec-head.menu-open .sec-toggle{background:var(--bacIntTra)}.sec-label{color:var(--texTer);font-size:12px;font-weight:500;line-height:16px}.sec-chev{width:12px;height:12px;color:var(--texTer);opacity:0;flex:none;transition:opacity .1s}.sec-chev svg{stroke-width:1.8px;transition:transform .2s ease-out}.section.expanded .sec-chev svg{transform:rotate(90deg)}.sec-toggle:hover .sec-chev,.sec-head.menu-open .sec-chev{opacity:1}.tree{margin-top:1px}.row{height:30px;padding:5px 8px 5px calc(8px + var(--depth,0) * 8px);cursor:pointer;-webkit-user-select:none;user-select:none;color:var(--texAcc);border-radius:6px;align-items:center;margin-bottom:1px;font-size:14px;display:flex;position:relative}.row:hover,.row.menu-open{background:var(--bacIntTra)}.row.selected{background:var(--bacIntTra);color:var(--texPri)}.row.selected:hover,.row.selected.menu-open{background:var(--bacTerTra)}.row-icon{flex:none;justify-content:center;align-items:center;width:22px;height:20px;margin-right:6px;display:flex;position:relative}.row-chevron{width:20px;height:20px;color:var(--texTer);opacity:0;border-radius:4px;justify-content:center;align-items:center;display:flex;position:absolute;top:0;left:1px}.row-chevron svg{stroke-width:1.8px;width:12px;height:12px;transition:transform .2s ease-out}.node.open>.row .row-chevron svg{transform:rotate(90deg)}.row.has-kids:hover .row-chevron{opacity:1}.row.has-kids:hover .pg-icon{opacity:0}.row-chevron:hover{background:var(--bacTerTra)}.row-title{white-space:nowrap;text-overflow:ellipsis;flex:0 auto;min-width:0;line-height:21px;overflow:hidden}.row-actions{flex:none;align-items:center;gap:2px;margin-left:auto;padding-left:4px;display:none}.row:hover .row-actions,.row.menu-open .row-actions{display:flex}.row.renaming{cursor:default}.row.renaming .row-actions{display:none}.row-rename{background:var(--inputBac);min-width:0;height:24px;color:var(--texPri);font:inherit;box-shadow:inset 0 0 0 1px var(--blueLine), 0 0 0 2px var(--blueBg);border:0;border-radius:4px;outline:none;flex:1;margin:0 -2px 0 -6px;padding:0 6px;font-size:14px}@media (hover:none){.row.has-kids .row-chevron{opacity:1}.row.has-kids .pg-icon{opacity:0}}body.dragging,body.dragging *{cursor:grabbing!important;-webkit-user-select:none!important;user-select:none!important}body.dragging .row:not(.selected):hover{background:0 0}body.dragging .row-actions{display:none!important}body.dragging .row:hover .row-chevron{opacity:0}body.dragging .row:hover .pg-icon{opacity:1}.row.drag-src{opacity:.4}.row.drop-inside{background:var(--blueBg)!important}.drop-line{background:var(--blueLine);pointer-events:none;z-index:5;border-radius:2px;height:3px;display:none;position:absolute}.drop-line.show{display:block}.drag-ghost{z-index:3000;pointer-events:none;background:var(--popBac);height:30px;color:var(--texPri);box-shadow:var(--shaOutLg);opacity:.9;white-space:nowrap;border-radius:6px;align-items:center;gap:8px;padding:0 10px 0 8px;font-size:14px;display:flex;position:fixed;top:0;left:0;overflow:hidden}.drag-ghost .t{text-overflow:ellipsis;overflow:hidden}.sb-foot{flex:none;align-items:center;gap:4px;height:44px;padding:0 8px;display:flex}:is(.ws-btn,.g-sidebar-row){min-width:0;height:28px;color:var(--texSec);text-align:left;border-radius:6px;flex:1;align-items:center;gap:8px;padding:0 6px 0 8px;font-size:14px;font-weight:500;display:flex}:is(.ws-btn,.g-sidebar-row) svg{width:18px;height:18px;color:var(--sidIco);flex:none}:is(.ws-btn,.g-sidebar-row):hover,:is(.ws-btn,.g-sidebar-row).menu-open{background:var(--bacIntTra)}.ws-name{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}@media (width<=768px){.sb-resizer{display:none}}.sb-note{color:var(--texTer);margin:4px 16px;font-size:13px}.sb-note.inset{margin:2px 8px 4px;padding-left:8px}.ws-dot{background:var(--texDis);border-radius:50%;flex:none;width:7px;height:7px}.ws-dot.ready{background:var(--gre-tx)}.ws-dot.loading{background:var(--yel-tx)}.ws-dot.offline,.ws-dot.error{background:var(--red-tx)}.sec-head{position:relative}.sec-actions{flex:none;align-items:center;gap:2px;margin-left:auto;padding-left:4px;padding-right:6px;display:none}.sec-head:hover .sec-actions,.sec-head.menu-open .sec-actions{display:flex}.sec-head .row-rename{flex:none;width:calc(100% - 8px);height:24px;margin:0 4px;font-size:12px}body.dragging .sec-actions{display:none!important}.section.drag-src{opacity:.4}.sb-empty{height:26px;margin:2px 0 4px;padding:0 8px 0 38px;line-height:26px}.sb-ext-note{overflow-wrap:anywhere;line-height:1.5}.row-tag{min-width:0;color:var(--texTer);white-space:nowrap;text-align:right;text-overflow:ellipsis;flex:1 1 0;padding-left:6px;font-size:12px;overflow:hidden}.row:hover .row-tag,.row.menu-open .row-tag{display:none}.link-form{padding:0 0 2px}.link-field{padding:2px 12px 6px;display:block}.link-label{color:var(--texSec);margin-bottom:4px;font-size:12px;display:block}.link-error{color:var(--red);margin:0 12px 6px;font-size:13px;line-height:1.5}.link-actions{justify-content:flex-end;gap:8px;padding:6px 12px 4px;display:flex}.link-actions .dialog-btn{height:28px;padding:0 12px;font-size:13px}.row.missing .row-title,.row.missing .pg-icon{color:var(--texTer);opacity:.7}.sec-above{color:var(--texTer);margin-left:4px;font-size:12px;font-weight:400;line-height:16px}.project-form{padding:0 0 2px}.project-path{align-items:center;gap:8px;padding:2px 12px 8px;display:flex}.project-path .pop-input{flex:1;min-width:0}.project-path .dialog-btn{flex:none;height:28px;padding:0 12px;font-size:13px}.project-list{border-top:1px solid var(--borSec);scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;max-height:300px;padding:4px 6px;overflow-y:auto}.project-row{height:30px;padding:5px 8px 5px calc(4px + var(--depth,0) * 8px);cursor:pointer;-webkit-user-select:none;user-select:none;color:var(--texAcc);border-radius:6px;align-items:center;gap:8px;margin-bottom:1px;font-size:14px;display:flex}.project-row:hover{background:var(--bacIntTra)}.project-row.selected{background:var(--bacIntTra);color:var(--texPri)}.project-row.selected:hover{background:var(--bacTerTra)}.project-toggle{width:20px;height:20px;color:var(--texTer);border-radius:4px;flex:none;justify-content:center;align-items:center;display:flex}.project-toggle:hover:not(:disabled){background:var(--bacTerTra)}.project-toggle svg{stroke-width:1.8px;width:12px;height:12px;transition:transform .2s ease-out}.project-toggle[aria-expanded=true] svg{transform:rotate(90deg)}.project-toggle:disabled{visibility:hidden}.project-row .mi-icon{color:var(--sidIco)}.project-document{padding-left:calc(4px + 28px + var(--depth,0) * 8px)}.project-above{color:var(--texTer);margin-left:6px;font-size:12px;font-weight:400}.project-count{color:var(--texTer);flex:none;font-size:12px}.tb-right .icon-btn.annot-open,.tb-right .icon-btn.annot-open:hover{background:var(--bacTerTra)}.menu.annot-list{width:320px;margin-top:4px}.annot-list .menu-scroll{max-height:384px;overflow-y:auto}.annot-list .menu-scroll .menu-item{height:44px}.annot-list .menu-scroll .mi-icon{display:none}.topbar{background:var(--bacPri);z-index:5;flex:none;align-items:center;gap:8px;height:44px;padding:0 12px;display:flex;position:relative}.topbar.tb-page{background:var(--galleryPageBac)}.tb-left{flex:1;align-items:center;min-width:0;display:flex}.tb-menu{color:var(--icoPri);margin:0 4px 0 1px;display:none}.app.sb-collapsed .tb-menu{display:inline-flex}.crumbs{align-items:center;min-width:0;display:flex;overflow:hidden}.crumb-wrap{display:contents}.crumb{white-space:nowrap;min-width:0;max-width:220px;height:24px;color:var(--texPri);border-radius:6px;align-items:center;gap:6px;padding:2px 6px;font-size:14px;display:inline-flex}.crumb:hover{background:var(--bacIntTra)}.crumb .t{text-overflow:ellipsis;overflow:hidden}.crumb .emoji{font-size:14px;line-height:1}.crumb.crumb-rename{width:220px;padding:0}.crumb-rename .row-rename{margin:0}.crumb-sep{color:var(--crumbSep);-webkit-user-select:none;user-select:none;flex:none;margin:0 1px;font-size:13px}.crumb-pop{z-index:1000;background:var(--popBac);width:180px;max-height:calc(100vh - 16px);box-shadow:var(--shaOutLg);-webkit-user-select:none;user-select:none;scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;border-radius:10px;flex-direction:column;gap:1px;padding:4px;font-size:14px;line-height:1.2;display:flex;position:fixed;top:0;left:0;overflow-y:auto}.crumb-pop-head{color:var(--texSec);white-space:nowrap;flex:none;margin:6px 0 8px;padding:0 8px;font-size:12px;font-weight:500}.crumb-pop-item{cursor:pointer;height:28px;color:var(--texPri);border-radius:6px;flex:none;align-items:center;gap:8px;padding:0 8px;display:flex}.crumb-pop-item:hover,.crumb-pop-item.open,.crumb-pop-item.trigger{background:var(--bacIntTra)}.crumb-pop-item.current{background:var(--bluBacIntTra)}.crumb-pop-item .t{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.crumb-pop-item.more{color:var(--texSec)}.crumb-pop-arrow{width:16px;height:16px;color:var(--texDis);flex:none}.crumb-pop-arrow svg{stroke-width:1.8px}.tb-right{flex:none;align-items:center;gap:2px;display:flex}.tb-right .icon-btn{color:var(--icoPri)}.tb-right .icon-btn.on{color:var(--star)}.tb-right .icon-btn.menu-open{background:var(--bacIntTra)}.edited{color:var(--texTer);white-space:nowrap;margin-right:8px;font-size:14px}@media (width<=1000px){.edited{display:none}}.session-badge{white-space:nowrap;border-radius:10px;flex:none;margin-left:8px;padding:1px 8px;font-size:12px;line-height:20px}.session-badge.muted{color:var(--texTer)}.session-badge.warn{color:var(--ora-tx);background:var(--ora-bg)}.session-badge.danger{color:var(--red-tx);background:var(--red-bg)}.menu.look-menu{width:224px;max-width:none;padding-bottom:8px}.look-fonts,.look-row{gap:4px;padding:0 8px;display:flex}.look-fonts{margin-bottom:4px}.look-font,.look-option{min-width:0;color:var(--texPri);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1 1 0;transition:background 20ms ease-in}.look-font{flex-direction:column;align-items:center;padding:8px 4px 6px;display:flex}.look-glyph{white-space:nowrap;height:30px;font-size:24px;line-height:30px}.look-caption{color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;max-width:100%;margin-top:2px;font-size:12px;line-height:16px;overflow:hidden}.look-option{white-space:nowrap;justify-content:center;align-items:center;height:28px;padding:0 4px;font-size:14px;display:flex}.look-font:hover,.look-option:hover{background:var(--bacIntTra)}.look-row.look-off .look-option{opacity:.45}.look-font.on .look-glyph,.look-option.on{color:var(--blue)}.look-font:focus-visible,.look-option:focus-visible{background:var(--bacTerTra);outline:none}.look-menu .menu-sep{margin:8px 12px 4px}.link-crumb{cursor:default}.link-crumb:hover{background:0 0}.link-crumb .pg-icon{flex:none;justify-content:center;align-items:center;width:18px;height:18px;display:flex}.link-crumb .pg-icon svg,.link-crumb .pg-icon img{width:16px;height:16px}.tb-open{color:var(--texSec);margin-right:2px}
package/web/index.html CHANGED
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Gallery</title>
7
7
  <link rel="icon" href="data:," />
8
- <script type="module" crossorigin src="/assets/index-D8P8uhDW.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-FLb9jCfl.css">
8
+ <script type="module" crossorigin src="/assets/index-B4uUluLM.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-C3vHT8sH.css">
10
10
  </head>
11
11
  <body class="preload">
12
12
  <div id="root"></div>
@@ -1,2 +0,0 @@
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,d as P,e as b,l as C}from"./chunk-SQ3FQCCN.mjs";import{a as q}from"./chunk-3F57LEN5.mjs";import{a as u,f as S,g as w,i as E,j as I,k as H}from"./chunk-GMJD7ID3.mjs";import{a as h,b as R}from"./chunk-JEUK3ZO7.mjs";import{b as D,f as L,g as T}from"./chunk-4OZWXZE5.mjs";import{b as N}from"./chunk-PAREWQGB.mjs";import{existsSync as g}from"node:fs";import i from"node:path";import{reportsDirectory as c}from"../browser/shared/paths.mjs";import{idHolder as z,isDocSlug as B,keptName as G,layoutOf as A,listTrash as J}from"../browser/shared/workspace.mjs";import{parentIn as K}from"../browser/shared/outline.mjs";import{joinDefaultTree as Q,joinedLine as V}from"../browser/shared/drafts.mjs";var W="\u65B0\u6587\u6863";async function F(t,n=c){if(G(t))return`"${t}" is a name the workspace keeps for itself: choose another slug.`;if(g(i.join(A(n).preferencesPage,t)))return`"${t}" is the \u5199\u4F5C\u504F\u597D page's slug: choose another slug.`;if(g(i.join(A(n).customPages,t)))return`"${t}" is a custom page's slug (documents and custom pages share one set of names: gallery page list lists them): choose another slug.`;if(g(i.join(n,t)))return`Document already exists: ${h(i.join(n,t))}`;if((await J(n)).some(r=>r.slug===t))return`"${t}" is the slug of something in the trash: choose another slug.`;if(B(t)){let r=await z(t,n);if(r)return`"${t}" would have the page id (${t.slice(4)}) of "${r}" in this workspace, and two documents may not share an address: choose another slug.`}return null}async function fe(t){let{positional:n,options:r,values:U}=L({options:["--no-preview","--no-browser","--first"],values:["--under","--after"],argv:t}),[e,y,$=W]=n;if(n.length<2||n.length>3||!e||!y?.trim()||!$.trim())throw new D("Name the slug and the title (then a description, if you choose one), each quoted when it has spaces.");T(e);let s=H(U,r,{top:!1}),x=await F(e);x&&(console.error(x),process.exit(1));let M=s.under!==void 0||s.after!==void 0||s.first,l=null;if(M){let o=await u(),a=async(X,_)=>{let p=await S(X,_,o);return p.refused&&(console.error(`${p.refused} Nothing made.`),process.exit(1)),p.slug},f=s.under!==void 0?await a(s.under,"--under"):void 0,d=s.after!==void 0?await a(s.after,"--after"):null;d!==null&&f!==void 0&&K(o.children,d)!==f&&(console.error(`${w(o,e,"level",{parent:f,after:d})} Nothing made.`),process.exit(1)),l={parent:f,after:d,first:s.first}}try{await N(e,y,$)}catch(o){if(o.code!=="EEXIST")throw o;console.error(await F(e)??`Document already exists: ${h(i.join(c,e))}`),process.exit(1)}if(await import("./chunk-Z6OKLRHC.mjs").then(({noteNew:o})=>o(e)),console.log(`Created ${h(i.join(c,e,"doc.html"))} and doc.json`),l){let o=await E(e,l),a=await u();o.ok?console.log(`Placed it ${I(a,o)}.`):(console.log(`Not placed (${w(a,e,o.reason,{...l,message:o.message})}): it is at the top level, last; gallery move ${e} puts it where it goes.`),process.exitCode=1)}let v=V(await Q(c,e));v&&console.log(v);for(let o of await R())console.log(o);let j=q(c);j&&console.log(j);let m=await C(e,{skipped:b(r),command:`gallery new ${e}`});console.log(O(m,"replace the starter section with the document's skeleton (each section's heading) as soon as you can outline it, then write it a section at a time, as ordinary HTML, so that the user watches it grow (gallery check fails while the starter section remains).")),console.log(`Hand in: gallery export ${e}, then gallery qa ${e}`);let k=await P(m,r);k&&console.log(k);for(let o of m)console.log(o)}export{W as a,F as b,fe as c};
@@ -1,2 +0,0 @@
1
- import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
- import{a as D,b as M}from"./chunk-QP7BOHE4.mjs";import{c as y,d as j}from"./chunk-L55NOXBE.mjs";import{b as w,f as A}from"./chunk-4OZWXZE5.mjs";import L from"node:fs/promises";import k from"node:path";import{readAnnouncement as T}from"../browser/shared/preview-server.mjs";import{nameProblem as _,nameStops as v,ownName as B,workspaceLabels as K,workspaceName as b,writeWorkspaceName as Q}from"../browser/shared/workspace-name.mjs";import{forgetWorkspace as R,isWorkspace as C,isWorkspaceId as U,readRegistry as F,registerQuietly as x,registerWorkspace as q,SCAN_DEPTH as P,SCAN_LIMIT as z,scanForWorkspaces as J,workspaceId as V,workspaceKey as l}from"../browser/shared/workspace-registry.mjs";import{defaultWorkspace as X,documentsFolder as E,ensureWorkspace as Y,layoutOf as Z}from"../browser/shared/workspace.mjs";import{clashingIds as ee}from"../browser/shared/drafts.mjs";var u=(o,t)=>`${o} ${t}${o===1?"":"s"}`,W=(o,t)=>l(o)===l(t);function oe(o){if(B(o)||W(o,X()))return null;let{name:t}=b(o,{stops:v()});return`\u5DE5\u4F5C\u533A\u540D\u5B57\uFF1A\u6CA1\u6709\uFF08\u522B\u5904\u6309\u6587\u4EF6\u5939\u53EB\u5B83"${t}"\uFF09\uFF1B\u8FD9\u4E2A\u5DE5\u4F5C\u533A\u662F\u4E3A\u4E00\u4E2A\u9879\u76EE\u5EFA\u7684\uFF0C\u5C31\u7528 gallery workspaces --name "<\u9879\u76EE\u540D>" \u5199\u4E0A\u9879\u76EE\u540D`}async function se(o,t){let n=_(t);if(n)throw new w(n);try{let{ours:r,reads:f}=await Y(o);r||(console.error(j(o,f)),process.exit(1))}catch(r){if(!r.code)throw r;console.error(y(o,r.code)),process.exit(1)}let s;try{s=await Q(o,t)}catch(r){console.error(r.code?y(o,r.code):r.message),process.exit(1)}await x(o),console.log(`\u5DE5\u4F5C\u533A\uFF1A${o}`),console.log(`\u540D\u5B57\uFF1A${s.name} (in ${Z(o).marker}${s.before&&s.before!==s.name?`; it was "${s.before}"`:""}): the sidebar and gallery workspaces call it so.`)}async function re(o,t){let n=await R(o);n.length||(console.error(`No registered workspace is ${U(o)?o:k.resolve(o)}: gallery workspaces lists them, with their paths and ws- ids.`),process.exit(1));for(let s of n)console.log(`Forgot ${s} (only the registry changed: nothing on disk).${W(s,t)?" It is the current workspace: the next command run in it registers it again.":""}`)}async function te(o){let t=k.resolve(o??E());await L.stat(t).then(a=>a.isDirectory(),()=>!1)||(console.error(`No such folder: ${t} (--scan names a folder to look in).`),process.exit(1));let n=new Set(F().workspaces.map(({root:a})=>l(a))),{found:s,read:r,cut:f}=await J(t);console.log(`Scanned ${t}, ${P} levels down (${u(r,"folder")}): ${s.length?`${u(s.length,"workspace")}.`:"no workspace."}`);let i=v();for(let a of s){let{name:d}=b(a,{stops:i});if(n.has(l(a))){await x(a),console.log(` \u5DF2\u767B\u8BB0\uFF1A${a}\uFF08${d}\uFF09`);continue}try{await q(a)}catch(m){console.log(` \u6CA1\u80FD\u767B\u8BB0\uFF08${m.code??m.message}\uFF09\uFF1A${a}`);continue}console.log(` \u65B0\u767B\u8BB0\uFF1A${a}\uFF08${d}\uFF09`)}f&&console.log(`Stopped after ${u(z,"folder")}: gallery workspaces --scan <a folder further down> looks at the rest.`),s.length&&console.log("gallery workspaces lists them; gallery list <words> --all searches their documents.")}async function ne(o){let t=C(o);t&&await x(o);let n=F().workspaces,s=[o,...n.map(({root:e})=>e).filter(e=>!W(e,o))],r=new Map(n.map(({root:e,seen:c})=>[l(e),Date.parse(c)])),f=E(),i=v({documents:f}),a=await Promise.all(s.map(async e=>{let c=C(e),p=c?await D(e):[];return{root:e,there:c,count:p.length,edited:p.reduce((g,{edited:h})=>Math.max(g,h),0),named:{root:e,...b(e,{stops:i})}}})),[d,...m]=a;m.sort((e,c)=>c.there-e.there||c.edited-e.edited||(r.get(l(c.root))??0)-(r.get(l(e.root))??0));let I=[d,...m],G=new Map(K(I.map(({named:e})=>e)).map(e=>[l(e.root),e])),$=await T();console.log($?`Gallery \u670D\u52A1\uFF1Ahttp://127.0.0.1:${$.port}/ (pid ${$.pid})`:"Gallery \u670D\u52A1\uFF1A\u672A\u542F\u52A8");let N=n.length;console.log(`${u(N,"workspace")} on this machine's registry; the current one first (*):`);for(let e of I){let{name:c,own:p,above:g}=G.get(l(e.root)),h=e===d,S=[...p||!e.there?[]:["\u6CA1\u6709\u8D77\u540D\uFF1A\u7528\u7684\u662F\u6587\u4EF6\u5939\u7684\u540D\u5B57"],...e.there?[]:[h?"\u8FD8\u6CA1\u6709\u5EFA":"\u4E0D\u5728\u4E86\uFF1A\u6587\u4EF6\u5939\u6216\u5B83\u7684 gallery.json \u627E\u4E0D\u5230\u4E86"]],H=g?k.isAbsolute(g)?`\uFF08${g}\uFF09`:`\uFF08\u4E0A\u4E00\u7EA7\uFF1A${g}\uFF09`:"";console.log(`${h?"*":" "} ${c}${H} ${V(e.root)}${S.length?` \uFF08${S.join("\uFF1B")}\uFF09`:""}`),console.log(` \u8DEF\u5F84\uFF1A${e.root}`),e.there&&console.log(` \u6587\u6863\uFF1A${e.count?`${e.count} \u7BC7\uFF1B\u4E0A\u6B21\u7F16\u8F91\uFF1A${M(e.edited)}`:"\u6CA1\u6709"}`)}for(let{id:e,roots:c}of ee())console.log(`${e} \u662F ${c.length} \u4E2A\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\u5171\u7528\u7684\u7F16\u53F7\uFF08${c.join("\u3001")}\uFF09\uFF1A\u4FA7\u8FB9\u680F\u91CC\u5B83\u4EEC\u7684\u5E95\u7A3F\u90FD\u627E\u4E0D\u5230\uFF1Bgallery workspaces --forget <\u8DEF\u5F84> \u53BB\u6389\u5176\u4E2D\u4E00\u4E2A`);let O=t?oe(o):null;O&&console.log(O),m.some(({there:e})=>!e)&&console.log("One no longer there stays registered (a drive may come back): gallery workspaces --forget <\u8DEF\u5F84> takes it off, nothing on disk changed."),N<=1&&console.log(`gallery workspaces --scan registers the workspaces already on this machine (in the Documents folder, ${P} levels down; or --scan <folder>).`),console.log("gallery list <words> --all searches the documents of them all; every command takes --workspace <\u8DEF\u5F84> to work in one.")}async function we(o,t){let{positional:n,options:s,values:r}=A({options:["--scan"],values:["--name","--forget"],argv:o});if([s.has("--scan"),r.has("--name"),r.has("--forget")].filter(Boolean).length>1)throw new w("One of --scan, --name and --forget at a time.");if(n.length>(s.has("--scan")?1:0))throw new w(s.has("--scan")?"--scan takes one folder at most.":"gallery workspaces names no folder: --scan <folder> looks in one, --workspace <dir> names the current workspace.");let i=k.resolve(t.workspace);return r.has("--name")?se(i,r.get("--name")):r.has("--forget")?re(r.get("--forget"),i):s.has("--scan")?te(n[0]):ne(i)}export{oe as a,we as b};
@@ -1,5 +0,0 @@
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 y from"node:fs";import{fileURLToPath as S}from"node:url";import{namedPlace as h}from"../browser/shared/page-address.mjs";import{pageLinks as w}from"../browser/shared/page-links.mjs";import{reportsDirectory as b}from"../browser/shared/paths.mjs";import{listReportSlugs as g,slugPattern as x}from"../browser/shared/reports.mjs";import{RESERVED as v,isSlugName as N,listTrash as O}from"../browser/shared/workspace.mjs";var m=e=>/^--.|^-[A-Za-z]/.test(e),a=class extends Error{constructor(n){super(n),this.name="UsageError"}};function A(e){let n=y.readFileSync(S(e),"utf8").split(/\r?\n/),t=n.findIndex(s=>!s.startsWith("//"));return n.slice(0,t===-1?n.length:t).map(s=>s.replace(/^\/\/ ?/,"")).join(`
3
- `)}var E=e=>/^Usage: (gallery \S+|npm run \S+|node \S+)/.exec(e)?.[1]??"this command",P=e=>e.split(`
4
- `)[0],R=(e,n,t=P(e))=>{let s=E(e);return`${n}
5
- ${t} (${s}${s.startsWith("npm run")?" --":""} --help says more)`},T=e=>{let n=e.indexOf("--");return(n===-1?e:e.slice(0,n)).some(t=>t==="--help"||t==="-h")};function $({options:e=[],values:n=[],argv:t=process.argv.slice(2)}={}){let s=t.indexOf("--"),[o,r]=s===-1?[t,[]]:[t.slice(0,s),t.slice(s+1)],l=[],u=new Set,p=new Map;for(let c=0;c<o.length;c++){let i=o[c],[f,k]=i.startsWith("--")&&i.includes("=")?[i.slice(0,i.indexOf("=")),i.slice(i.indexOf("=")+1)]:[i,void 0];if(!m(i))l.push(i);else if(n.includes(f)){let d=k??(c+1<o.length&&!m(o[c+1])?o[++c]:void 0);if(!d)throw new a(`${f} takes a value`);p.set(f,d)}else if(e.includes(i))u.add(i);else throw new a(`Unknown option: ${i}`)}return{positional:[...l,...r],options:u,values:p}}function U(e){if(!x.test(e))throw new a(`Not a document's slug: ${e} (lowercase kebab-case).`);if(v.has(e))throw new a(`Not a document's slug: ${e} (a name the workspace keeps for itself).`);return e}async function L(e){let n=await O(b),t=n.filter(({kind:r})=>r==="document"),s=h(e,w(t));if(s)return`${e} is a document in the trash ("${t.find(({slug:r})=>r===s.slug).title}"): it has to be restored in the workbench first.`;let o=n.find(({kind:r,slug:l})=>r==="page"&&l===e);return o?`${e} is a custom page in the trash ("${o.title}"), not a document: once it is restored in the workbench, gallery page open ${e} opens it.`:null}async function W(e){let n=(await g()).filter(N),t=h(e,w(n.map(o=>({slug:o}))));if(t)return t;let s=await L(e);if(s)throw new a(s);if(!x.test(e))throw new a(`Not a document's slug, link or address: ${e} (gallery list shows them).`);return{slug:U(e),block:null}}async function D({options:e=[],values:n=[],argv:t,noneIsAll:s=!1}={}){let{positional:o,options:r,values:l}=$({options:["--all",...e],values:n,argv:t}),u=r.has("--all");if(u&&o.length>0)throw new a("Name documents or pass --all, not both.");if(!u&&o.length===0&&!s)throw new a("Name a document (or pass --all).");let p=await Promise.all(o.map(W));return{slugs:u||o.length===0?await g():[...new Set(p.map(({slug:c})=>c))],options:r,values:l}}async function Z(e,{documents:n=!1,...t}={}){let s=A(e),o=t.argv??process.argv.slice(2);T(o)&&(console.log(s),process.exit(0));try{return n?await D({...t,argv:o}):$({...t,argv:o})}catch(r){if(!(r instanceof a))throw r;console.error(R(s,r.message)),process.exit(2)}}export{m as a,a as b,A as c,R as d,T as e,$ as f,U as g,L as h,W as i,D as j,Z as k};
@@ -1,2 +0,0 @@
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{i as p}from"./chunk-S3SX3COT.mjs";import{g as b}from"./chunk-VRPVVMRB.mjs";import{g as k}from"./chunk-BX5AKINW.mjs";import{k as d}from"./chunk-FJLM7YE7.mjs";import{workspaceBase as v}from"../browser/shared/service-location.mjs";import j from"node:fs/promises";import f from"node:path";import{editStateDirectory as m,reportsDirectory as h}from"../browser/shared/paths.mjs";import{findPreviewServer as $}from"../browser/shared/preview-server.mjs";import{documentDirectory as S,documentFiles as g,isDocumentSource as D}from"../browser/shared/workspace.mjs";var u=e=>f.resolve(e),N=e=>f.basename(g(f.dirname(e)).json),O={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 w(e,n,o="hand-in",l=3e4){let t=`127.0.0.1:${e.port}`,s;try{s=await fetch(`http://${t}${v(h)}/__gallery/edit/${o}`,{method:"POST",headers:{"Content-Type":"application/json",Origin:`http://${t}`,"X-Gallery-Token":e.token},body:JSON.stringify({slug:n,workspace:h}),signal:AbortSignal.timeout(l)})}catch(a){return a.name==="TimeoutError"?{ok:!1,reason:"timeout"}:null}let i=await s.json().catch(()=>null);return typeof i?.ok!="boolean"||["elsewhere","token","host","origin"].includes(i.reason)?null:i}async function C(e){let n=await $(),o=null,l=[],t=new Map,s=[];for(let i of e){let{html:a,json:c}=g(S(i,h)),r=n?await w(n,i):null;if(r===null&&(o??=p({reportsDirectory:h,stateDirectory:m,finish:d}),r=await o.handIn(i),r.ok&&await o.settleNotes(i)),!r.ok){r.reason!=="missing"&&t.set(i,[`${u(a)} was not handed in: ${O[r.reason]??r.message??r.reason}`]);continue}if(r.repeated?.length){t.set(i,k(r.repeated));continue}s.push(...R(a,r)),r.written&&(r.changes.length&&s.push(...b(a,r.changes,{reread:!1})),r.added&&s.push(...L(a,r.given,r.added)),l.push(u(a))),T(r)&&l.push(u(c))}return{written:l,failures:t,lines:s}}async function H(e){let n=await $();if(n){for(let o of e)if(await w(n,o,"settle")===null)return}}async function K(e,{wait:n=3e4}={}){try{let o=await $(),l=o?await w(o,e,"round",n):null;return l!==null?l.ok?l.ended===!0:null:await p({reportsDirectory:h,stateDirectory:m,finish:d}).beginRound(e)}catch{return null}}async function W(e){try{let n=p({reportsDirectory:h,stateDirectory:m,finish:d}),{html:o}=g(S(e,h));await n.noteTaken(e,await j.readFile(o,"utf8"))}catch{}}var T=({title:e=null,icon:n=null})=>!!(e&&typeof e.from=="string"&&e.from!==e.to||n&&!n.missing),x=10;function L(e,n,o=n?.length??0,{pending:l=!1}={}){let t=`${o} block${o===1?"":"s"}`;if(l){let i=[`ids ${u(e)}: ${t} without an id yet: the export gives ${o===1?"it":"each"} one`];return o>x?i:[...i,...n.map(({line:a,tag:c})=>` line ${a} ${c}`)]}let s=[`ids ${u(e)}: ${t} given an id`];return!n||o>x?s:[...s,...n.map(({line:i,tag:a,id:c})=>` line ${i} ${a} \u2192 ${c}`)]}function R(e,{title:n=null,icon:o=null}={},{pending:l=!1}={}){let t=u(f.dirname(e)),s=N(e),i=(c,r,y)=>l?`${c} not ${r} yet (${y}): the export writes ${c.includes(" and ")?"them":"it"}`:`${c} written ${r}: ${y}`,a=[];if(n){let c=[...n.page?["<title>"]:[],...typeof n.from=="string"&&n.from!==n.to?[`${s}'s title`]:[]];c.length&&a.push(`title ${t}: ${i(c.join(" and "),"as its h1 says it",JSON.stringify(n.to))}`)}return o?.missing?a.push(`icon ${t}: ${s} has the icon ${JSON.stringify(o.from)} and the page's header none: write it there (<div class="doc-icon">\u2026</div> before the h1) or take "icon" out of ${s} (the export leaves ${s}'s as it is)`):o&&a.push(`icon ${t}: ${i(`${s}'s icon`,"as its header has it",o.to===null?"none":JSON.stringify(o.to))}`),a}function X(e,{by:n="this export"}={}){let o=e.length===1,l=[...e.filter(t=>D(f.basename(t))).map(t=>f.basename(t)).filter((t,s,i)=>i.indexOf(t)===s).map(t=>`${t}: the kit's markup, block ids`),...e.filter(t=>/^(doc|report)\.json$/.test(f.basename(t))).map(t=>f.basename(t)).filter((t,s,i)=>i.indexOf(t)===s).map(t=>`${t}: the title or icon said above`)];return`Re-read ${e.join(", ")} before editing ${o?"it":"them"}: ${n} wrote ${o?"it":"them"} (${l.join("; ")}).`}export{C as a,H as b,K as c,W as d,L as e,R as f,X as g};
@@ -1,2 +0,0 @@
1
- import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
- import{d as v}from"./chunk-2OHANJ6Q.mjs";import t from"node:fs/promises";import a from"node:path";import{randomBytes as F}from"node:crypto";import{defaultWorkspace as k,layoutOf as M}from"../browser/shared/workspace.mjs";import{withOutlineLock as L}from"../browser/shared/outline.mjs";import{extensionDirectory as P,extensionPath as x,forgetExtensionGrant as z,readManifest as O}from"../browser/shared/extension-manifest.mjs";import{findPreviewServer as T}from"../browser/shared/preview-server.mjs";var b=100*1024*1024,B=1e4;async function I(e,p){let c=await T({answering:!0});if(!c)return null;let n=`http://127.0.0.1:${c.port}`,o=await fetch(`${n}/__gallery/extensions/${e}`,{method:"POST",headers:{Origin:n,"Content-Type":"application/json","X-Gallery-Token":c.token},body:JSON.stringify(p)}),y=await o.json();if(!o.ok)throw new Error(y.message??"\u6269\u5C55\u64CD\u4F5C\u5931\u8D25");return y}async function N(e,{inService:p=!1,beforeReplace:c=async()=>{}}={}){if(e=a.resolve(e),!p){let s=await I("install",{path:e});if(s)return s.installed}let n=M(k()).extensions;if(await t.mkdir(n,{recursive:!0}),(await t.lstat(n)).isSymbolicLink())throw new Error("\u6269\u5C55\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");let o=await t.mkdtemp(a.join(n,".install-")),y=0,Z=0,d=s=>{if(y+=s,++Z>B||y>b)throw new Error("\u6269\u5C55\u8D85\u8FC7 100MB \u6216 10000 \u4E2A\u6587\u4EF6")};try{let s=await t.lstat(e);if(s.isSymbolicLink())throw new Error("\u5B89\u88C5\u6E90\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");if(s.isDirectory()){let r=async(f,u)=>{for(let w of await t.readdir(f,{withFileTypes:!0})){x(w.name);let i=a.join(f,w.name),m=a.join(u,w.name);if(w.isDirectory())d(0),await t.mkdir(m),await r(i,m);else if(w.isFile())d((await t.stat(i)).size),await t.copyFile(i,m);else throw new Error("\u6269\u5C55\u53EA\u80FD\u5305\u542B\u666E\u901A\u6587\u4EF6\u548C\u6587\u4EF6\u5939")}};await r(e,o)}else if(s.isFile()&&e.toLowerCase().endsWith(".zip")){if(s.size>b)throw new Error("\u6269\u5C55 ZIP \u8D85\u8FC7 100MB");let r=v(e);try{let f=new Set,u=r.entries.find(i=>i.name==="extension.json")??r.entries.find(i=>/^[^/]+\/extension.json$/.test(i.name));if(!u)throw new Error("ZIP \u4E2D\u6CA1\u6709 extension.json");let w=u.name.slice(0,-14);for(let i of r.entries){if(x(i.name),!i.name.startsWith(w))throw new Error("ZIP \u7684\u6587\u4EF6\u5FC5\u987B\u5728\u540C\u4E00\u4E2A\u6269\u5C55\u6587\u4EF6\u5939\u5185");let m=i.name.slice(w.length),$=x(m),S=m.toLowerCase();if(f.has(S))throw new Error("ZIP \u4E2D\u5B58\u5728\u91CD\u540D\u6587\u4EF6");f.add(S),d(i.size);let j=a.join(o,...$);await t.mkdir(a.dirname(j),{recursive:!0}),await r.extract(i,j)}}finally{r.close()}}else throw new Error("\u8BF7\u9009\u62E9\u6269\u5C55\u6587\u4EF6\u5939\u6216 ZIP");let E=await O(o),h=E.id??a.basename(e).replace(/\.zip$/i,""),l=P(h),g=a.join(n,`.old-${F(8).toString("hex")}`);return await c(h),await L(k(),async()=>{let r=await t.lstat(l).catch(()=>null);if(r?.isSymbolicLink())throw new Error("\u5DF2\u5B89\u88C5\u7684\u6269\u5C55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");await z(h),r&&await t.rename(l,g);try{await t.rename(o,l)}catch(f){throw r&&await t.rename(g,l),f}r&&await t.rm(g,{recursive:!0,force:!0})}),{id:h,folder:l,agent:E.agent?a.join(l,E.agent):null}}finally{await t.rm(o,{recursive:!0,force:!0})}}async function Y(e,{inService:p=!1,beforeReplace:c=async()=>{}}={}){if(!p&&await I("remove",{id:e}))return;let n=P(e);if((await t.lstat(a.dirname(n))).isSymbolicLink())throw new Error("\u6269\u5C55\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");await c(e),await L(k(),async()=>{if((await t.lstat(n)).isSymbolicLink())throw new Error("\u6269\u5C55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");await z(e),await t.rm(n,{recursive:!0})})}export{N as a,Y as b};
@@ -1,4 +0,0 @@
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,b as Z,c as ot,d as q}from"./chunk-W5NPH5UA.mjs";import{e as L}from"./chunk-ECZBLQKK.mjs";import{D as nt,a as _,b as V,l as tt,m as D,o as et}from"./chunk-E7656LR7.mjs";import{b as J,c as P,e as Q}from"./chunk-A55HN5OK.mjs";import{IDENTITY as Ne}from"../browser/editor/components/registry.mjs";function gt(e){let{blocks:a,locks:r,units:n,boxes:c}=L(e),l=wt(e,[...a.map(t=>({at:t.innerStart-1,text:` data-ge-block="${t.id}"`})),...r.map(t=>({at:t.at,text:` data-ge-lock="${t.reason}"`})),...n.map(t=>({at:t.at,text:` data-ge-unit="${t.id}"${t.grid?" data-ge-grid":""}${t.keep?` data-ge-keep="${t.keep.reason}"${t.keep.own?" data-ge-keep-own":""}`:""}`})),...n.filter(t=>t.lead!==null).map(t=>({at:t.lead,text:` data-ge-lead="${t.id}"`})),...c.map(t=>({at:t.at,text:` data-ge-box="${t.id}"${t.pure?" data-ge-pure":""}`}))]),p={version:_(e),blocks:a.map(t=>({id:t.id,tag:t.tag,kind:t.kind,caps:Object.keys(t.caps),inner:e.slice(t.innerStart,t.innerEnd),atoms:t.atoms,unit:t.unit,...t.path?{path:t.path}:{},...t.self!==null?{self:!0}:{}})),units:n.map(t=>({id:t.id,kind:t.kind,parent:t.parent,hash:D(e,t),...t.blockId?{blockId:t.blockId}:{},...t.keep?{keep:t.keep}:{},...t.grid?{grid:!0}:{},...t.parts?{parts:t.parts}:{}})),boxes:c.map(t=>({id:t.id,kind:t.kind,unit:t.unit,...t.key!==null?{key:t.key}:{}}))};return{html:l,map:p}}function wt(e,a,r=!0){let n=[],c=0;for(let l of[...a].sort((p,t)=>p.at-t.at)){if(e[l.at]!==">"){if(r)throw new Error(`Unexpected start tag before offset ${l.at}.`);continue}let p=et(e,l.at);n.push(e.slice(c,p),l.text),c=p}return n.push(e.slice(c)),n.join("")}Q();import{COMPONENTS as kt,instancesOf as xt,partOf as st}from"../browser/shared/components/index.mjs";import{attr as rt}from"../browser/shared/html-tree.mjs";var at=new Set(["main","section","article","aside","nav","header","footer","div","details","dialog","figure","blockquote","table","ul","ol","dl"]),Nt=new Set(["script","style","template","textarea","title","xmp","iframe","noembed","noframes","noscript","plaintext","pre","code","kbd","samp","var","svg","math"]),It=kt.filter(e=>e.match&&e.pairs);function Ot(e){let a=e.replace(/^/," "),r=J(a,{sourceCodeLocationInfo:!0}),n=f=>a.slice(0,f).split(`
3
- `).length,c=[],l=(f,d,s)=>c.push({key:f,tag:a.slice(d,s).replace(/\s+/g," "),line:n(d),offset:d});V(r,"main")||l("no <main> in the file",0,0);let p=[],t=new Set,k=f=>{for(let d of f.childNodes??[]){let s=d.sourceCodeLocation;if(d.nodeName==="#comment"){s&&p.push([s.startOffset,s.endOffset]);continue}if(d.tagName){if(s?.startTag&&p.push([s.startTag.startOffset,s.startTag.endOffset]),Nt.has(d.tagName)){s&&p.push([s.startOffset,s.endOffset??a.length]);continue}s?.endTag&&t.add(s.endTag.startOffset),at.has(d.tagName)&&s?.startTag&&!s.endTag&&l(`<${d.tagName}> not closed`,s.startTag.startOffset,s.startTag.endOffset),k(d)}}};k(r),p.sort((f,d)=>f[0]-d[0]);let N="",h=0;for(let[f,d]of p)d<=h||(N+=a.slice(h,Math.max(h,f))+" ".repeat(d-Math.max(h,f)),h=d);N+=a.slice(h);for(let f of N.matchAll(/<\/([A-Za-z][A-Za-z0-9]*)[^<>]*>?/g)){let d=f[1].toLowerCase();at.has(d)&&!t.has(f.index)&&l(`</${d}> closes nothing`,f.index,f.index+f[0].length)}for(let f of It)for(let d of xt(r,f))for(let{a:s,attrA:g,b:x,attrB:A}of f.pairs){let o=st(d,f.parts[s].at).map(M=>rt(M,g)),u=st(d,f.parts[x].at).map(M=>rt(M,A)),j=M=>new Set(M).size===M.length,I=j(o)&&j(u)&&o.length===u.length&&o.every(M=>u.includes(M)),b=d.sourceCodeLocation;!I&&b&&l(`${f.id}: ${s} and ${x} do not pair`,b.startOffset,b.startTag?.endOffset??b.startOffset)}return c.sort((f,d)=>f.offset-d.offset).map(({key:f,tag:d,line:s})=>({key:f,tag:d,line:s,text:`${f} (line ${s})`}))}Q();import{treeText as z}from"../browser/shared/annotations.mjs";import{attr as F}from"../browser/shared/html-tree.mjs";var it=2e3*2e3,G=2e3,ct=50,lt=1500;function ft(e,a,r,n){let c="",l=a;for(let p of n)p.end<=l||p.start>=r||(p.start>l&&(c+=e.slice(l,p.start)),l=Math.max(l,p.end));return c+e.slice(l,r)}var dt=e=>e.replace(/\s+/g," ").trim(),bt=e=>/\S/.test(e.replace(/<!--[^]*?-->/g,"").replace(/<[^>]*>/g,"").replace(/\u0000/g,"")),pt=e=>e.companion?[{start:e.start,end:e.end},{start:e.companion.start,end:e.companion.end}]:[{start:e.start,end:e.end}];function H(e){let a=L(e),{units:r,blocks:n}=a,c=r[0]?.node??n[0]?.node??null;for(;c?.parentNode;)c=c.parentNode;let l=c?tt(e,[c]):[],p=[...r].sort((o,u)=>o.start-u.start||u.end-o.end),t=new Map,k=[];for(let o of p){for(;k.length&&k.at(-1).end<=o.start;)k.pop();t.set(o,k.at(-1)??null),k.push(o)}for(let o of r.filter(u=>u.companion)){let{start:u,end:j}=o.companion;for(let I of r){if(I===o||I.start<u||I.end>j)continue;let b=t.get(I);(!b||b.start<u)&&t.set(I,o)}}let N=new Map;for(let o of r){let u=t.get(o);u&&N.set(u,[...N.get(u)??[],o])}let h=n.find(o=>o.kind==="title")??null,f=[...r.map(o=>({unit:o,at:o.elStart})),...h?[{unit:null,at:h.start}]:[]].sort((o,u)=>o.at-u.at),d=new Map(f.map((o,u)=>[o.unit,u])),s=new Map;for(let o of r)o.blockId&&s.set(o.blockId,(s.get(o.blockId)??0)+1);let g=f.map(({unit:o})=>{if(!o){let $=dt(ft(e,h.start,h.end,l));return{unit:null,title:!0,kind:"title",key:`title\0${$}`,own:$,counts:1,parent:null,blockId:null,text:z(h.node).slice(0,G)}}let u=N.get(o)??[],j=[...u.flatMap(pt),...l].sort(($,R)=>$.start-R.start),I=dt(pt(o).map(({start:$,end:R})=>ft(e,$,R,j)).join("\0")),b=u.length>0&&!bt(I),M=t.get(o);return{unit:o,kind:o.kind,key:`${o.kind}\0${I}`,own:I,counts:b?0:1,parent:M?d.get(M):null,blockId:o.blockId,text:z(o.node).slice(0,G)}}),x=null;return{rows:g,scanned:a,ref:o=>o.title?{title:!0}:o.blockId&&s.get(o.blockId)===1?{id:o.blockId}:(x??=(()=>{let u=new Map,j=new Map;for(let{unit:I}of f){if(!I)continue;let b=D(e,I);j.set(I,{hash:b,nth:u.get(b)??0}),u.set(b,(u.get(b)??0)+1)}return j})(),x.get(o.unit))}}function St(e,a){if(e.length*a.length<=it)return Z(e,a);let r=s=>s.reduce((g,x)=>g.set(x,(g.get(x)??0)+1),new Map),[n,c]=[r(e),r(a)],l=new Map;a.forEach((s,g)=>{c.get(s)===1&&n.get(s)===1&&l.set(s,g)});let p=[];e.forEach((s,g)=>{l.has(s)&&p.push([g,l.get(s)])});let t=[],k=[];p.forEach(([,s],g)=>{let x=0,A=t.length;for(;x<A;){let o=x+A>>1;p[t[o]][1]<s?x=o+1:A=o}k[g]=x>0?t[x-1]:-1,t[x]=g});let N=[];for(let s=t.at(-1)??-1;s>=0;s=k[s])N.unshift(p[s]);let h=[],[f,d]=[0,0];for(let[s,g]of[...N,[e.length,a.length]]){if((s-f)*(g-d)<=it)for(let[x,A]of Z(e.slice(f,s),a.slice(d,g)))h.push([f+x,d+A]);s<e.length&&h.push([s,g]),[f,d]=[s+1,g+1]}return h}var ut=(e,a)=>a.nested?z(P(e.slice(a.innerStart,a.innerEnd))):z(a.node),mt=e=>e.match(/[A-Za-z0-9]+|\s+|[^A-Za-z0-9\s]/gu)?.length??0,ht=({scanned:e},a)=>(a.title?e.blocks.filter(r=>r.kind==="title"):e.blocks.filter(r=>r.unit===a.unit.id)).sort((r,n)=>r.innerStart-n.innerStart);function yt(e){let a=[],r=n=>{for(let c of n.childNodes??[])c.tagName==="tr"?a.push((c.childNodes??[]).filter(l=>l.tagName==="td"||l.tagName==="th").map(l=>z(l).replace(/\s+/g," ")).join(" \xB7 ")):c.tagName&&r(c.tagName==="template"?c.content:c)};return r(e),a.length?a.join(`
4
- `):z(e)}function Mt(e,a,r){let n=e[a],c=0;for(let N=n.parent;N!==null;N=e[N].parent)r(N)&&(c+=1);let l=n.title?"h1":n.unit.node.tagName,p=n.title?n.text:yt(P(n.own.replace(/\u0000/g," "))).slice(0,G),t={kind:n.kind,tag:l,depth:c,text:p},k=l==="li"?n.unit.node.parentNode:null;if((k?.tagName==="ul"||k?.tagName==="ol")&&(t.marker=k.tagName,k.tagName==="ol")){let N=(k.childNodes??[]).filter(h=>h.tagName==="li");t.number=(Number.parseInt(F(k,"start")??"1",10)||1)+N.indexOf(n.unit.node)}return t}function $t(e,a){if(e===a)return null;let r=H(e),n=H(a),[c,l]=[r.rows.map(i=>i.key),n.rows.map(i=>i.key)],p=St(c,l);if(p.length===c.length&&p.length===l.length)return null;let t=i=>{let w=new Map;for(let S of i)S.blockId&&w.set(S.blockId,(w.get(S.blockId)??0)+1);return S=>!!S.blockId&&w.get(S.blockId)===1},[k,N]=[t(r.rows),t(n.rows)],h=[],[f,d]=[0,0];for(let[i,w]of[...p,[c.length,l.length]]){let S=new Map;for(let m=d;m<w;m++)N(n.rows[m])&&S.set(n.rows[m].blockId,m);let T=[],v=d-1;for(let m=f;m<i;m++){let O=k(r.rows[m])?S.get(r.rows[m].blockId):void 0;O!==void 0&&O>v&&(T.push([m,O]),v=O)}let B=[],[y,E]=[f,d];for(let[m,O]of[...T,[i,w]]){for(;y<m;y++){let C=r.rows[y];for(let W=E;W<O;W++){let Y=n.rows[W];if(Y.kind===C.kind&&(C.title||ot(C.own,Y.own))){B.push([y,W]),E=W+1;break}}}m<i&&B.push([m,O]),[y,E]=[m+1,O+1]}B.sort((m,O)=>m[0]-O[0]),[y,E]=[f,d];for(let[m,O]of[...B,[i,w]]){for(;y<m;y++)h.push({type:"del",i:y});for(;E<O;E++)h.push({type:"ins",j:E});m<i&&h.push({type:"chg",i:m,j:O}),[y,E]=[m+1,O+1]}i<c.length&&h.push({type:"same",i,j:w}),[f,d]=[i+1,w+1]}let s=new Set(h.filter(i=>i.type==="ins").map(i=>i.j)),g=new Set(h.filter(i=>i.type==="del").map(i=>i.i)),x=(i,w)=>{let S=new Set;for(let T of w)if(i[T].counts)for(let v=i[T].parent;v!==null;v=i[v].parent)S.add(v);return T=>i[T].counts||(S.has(T)?0:1)},[A,o]=[x(n.rows,s),x(r.rows,g)],u={added:0,changed:0,removed:0},j=[],I=[],b=[],M,$=null,R=null,K=i=>{if(!$)return;let w=Math.max(0,$.rows.length-ct);b.push({...i!==null?{before:n.ref(n.rows[i])}:R!==null?{after:n.ref(n.rows[R])}:{into:"main"},count:$.count,rows:$.rows.slice(0,ct),...w?{more:w}:{}}),$=null},X=i=>g.has(i)&&r.rows[i].counts>0;for(let i of h){if(i.type==="del"){$??={count:0,rows:[]},$.count+=o(i.i),u.removed+=o(i.i),X(i.i)&&$.rows.push(Mt(r.rows,i.i,X));continue}if(K(i.j),R=i.j,i.type==="ins"){let w=n.rows[i.j];u.added+=A(i.j),(w.parent===null||!s.has(w.parent))&&j.push({ref:n.ref(w)})}else if(i.type==="chg"){let[w,S]=[r.rows[i.i],n.rows[i.j]];u.changed+=1;let T=ht(r,w),v=ht(n,S),B=[],y=T.length!==v.length||T.length===0||T.some((E,m)=>E.tag!==v[m].tag);y||(T.forEach((E,m)=>{let[O,C]=[ut(e,E),ut(a,v[m])];mt(O)>lt||mt(C)>lt?y=!0:O!==C&&B.push({nth:m,base:O})}),B.length===0&&(y=!0)),y&&(B=[]),I.push({ref:n.ref(S),...y?{whole:!0}:{texts:B}}),S.title&&(M={base:w.text})}}return K(null),{counts:u,added:j,changed:I,...M?{title:M}:{},removed:b}}function Tt(e){let{units:a}=L(e),r=c=>{for(let l=c;l;l=l.parentNode)if(l.tagName&&(F(l,"data-doc-placeholder")!==void 0||l.tagName==="header"||(F(l,"class")??"").split(/\s+/).includes("doc-header")))return!1;return!0},n=c=>/^(img|picture|svg|canvas|video|audio|iframe|object|embed)$/.test(c.tagName??"")||(c.childNodes??[]).some(n);return!a.some(c=>r(c.node)&&(z(c.node)!==""||n(c.node)))}function jt(e,a){try{return q({current:e,ids:!0,...a}).text}catch{return e}}function Et(e,a){try{let r=L(e).blocks.find(c=>c.kind==="title");if(!r)return e;let n=U({current:e,edits:[{id:r.id,parts:[{keep:!0,html:a}]}],ids:!1});return n.ok?n.text:e}catch{return e}}var we=(e,a,r,n)=>nt.installed.rewrite(e,a,r,{packages:n});export{gt as a,Ot as b,$t as c,Tt as d,jt as e,Et as f,we as g};
@@ -1,5 +0,0 @@
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 $,b as u}from"./chunk-6GV3CBB2.mjs";import"./chunk-2OHANJ6Q.mjs";import{b as r,f as c}from"./chunk-4OZWXZE5.mjs";import"./chunk-5L7RYZCL.mjs";import{listCapabilities as k,readManifest as v}from"../browser/shared/extension-manifest.mjs";import x from"node:path";import d from"node:fs/promises";import{SIDEBAR_FILE as w,readSidebarText as E}from"../browser/shared/extension-sidebar.mjs";import{extensionSource as N,listExtensions as S,readExtension as I}from"../browser/shared/extensions.mjs";import{isExtensionId as y}from"../browser/shared/outline-shape.mjs";import{withOutlineLock as A}from"../browser/shared/outline.mjs";import{reportsDirectory as f}from"../browser/shared/paths.mjs";import{defaultWorkspace as p,ensureWorkspace as O,layoutOf as g}from"../browser/shared/workspace.mjs";var h=s=>`${s} ${s===1?"entry":"entries"}`;async function L(s){if(s.length>0)throw new r("list takes nothing: gallery extension check <id> reads one.");let o=await k();return S(f,{all:!0}).then(t=>{if(console.log(`Public columns: ${g(p()).extensions} (gallery extension new <id> "<title>").`),t.length===0){console.log(`No extensions visible from ${f}. Use gallery extension new <id> "<title>" (references/extensions.md says how to fill its entries).`);return}console.log(`${t.length} extension${t.length===1?"":"s"} visible from ${f}:`);for(let e of t){let n=e.missing?`no ${w}: it gives the sidebar no column`:e.error?`\u6761\u76EE\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.error.message}`:`${e.title}, ${h(e.count)}${e.notes.length?`, ${e.notes.length} note${e.notes.length===1?"":"s"}`:""}`;console.log(` ${e.id} ${n}`),console.log(` ${e.file}`);let i=o.find(a=>a.id===e.id);i?.manifest&&console.log(` Script: ${!!i.manifest.workbench?.script}; backend: ${!!i.manifest.server}; enabled: ${i.enabled}`),i?.agent&&console.log(` Agent instructions: ${i.agent}`)}console.log("gallery extension check <id> prints what the sidebar shows of one.")})}function b(s,o,t=[]){for(let e of s){let n=e.url?e.url:"(no address: a click opens and closes what is under it)";t.push(`${" ".repeat(o)}${e.id} ${e.icon?`${e.icon} `:""}${e.title} ${n}`),b(e.children??[],o+1,t)}return t}async function F(s){if(s.length!==1)throw new r("Name one extension: gallery extension check <id>.");let[o]=s;if(!y(o))throw new r(`Not an extension's id: ${o} (its folder's name under extensions/: lowercase letters, digits and dashes, 48 at most).`);let t=await N(f,o);t||(console.error(`No extension "${o}" visible from ${f}: gallery extension list shows them.`),process.exit(1));let e=await I(t.root,o),n=t.file;if(e.missing){if(await v(t.folder).catch(()=>null)){console.log(`OK ${o}: extension.json (${t.folder})`);return}console.error(`FAIL ${n}: there is no ${w}; the folder gives the sidebar no column until it has one (references/extensions.md says how it is written).`),process.exit(1)}e.error&&(console.error(`FAIL ${n}: ${e.error.message}`),console.error(`The sidebar shows the column "${e.title}" with one row: \u6761\u76EE\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.error.message}`),process.exit(1)),console.log(`The sidebar shows the column ${e.title}${e.icon?` (${e.icon})`:""}, ${h(e.count)}, in the order the file gives (an entry with an address opens it beside the sidebar, one without opens and closes what is under it):`),console.log(e.title);for(let i of b(e.entries,1))console.log(i);for(let i of e.notes)console.log(`note: ${i.message}`);console.log(`OK ${o}: ${h(e.count)} (${n})`)}async function T(s){if(s.length!==2||!y(s[0]))throw new r('Use gallery extension new <id> "<title>".');let[o,t]=s,e=E(JSON.stringify({title:t,entries:[]}));if(e.error)throw new r(e.error.message);let n=p();if(!(await O(n)).ours)throw new r(`Not a Gallery workspace: ${n}`);let i=x.join(g(n).extensions,o),a=x.join(i,w);await A(n,async()=>{for(let l of[g(n).extensions,i]){await d.mkdir(l,{recursive:!0});let m=await d.lstat(l);if(!m.isDirectory()||m.isSymbolicLink())throw new r(`Not an ordinary directory: ${l}`)}try{await d.writeFile(a,JSON.stringify({title:e.sidebar.title,entries:[]},null,2)+`
3
- `,{flag:"wx"})}catch(l){throw l.code==="EEXIST"?new r(`Already exists: ${a}. Read and edit this file instead.`):l}}),console.log(`Created public extension ${o}
4
- ${a}`)}async function M(s){let[o,...t]=s;if(o==="new"){let{positional:e}=c({argv:t});return T(e)}if(o==="install"||o==="remove"){let{positional:e}=c({argv:t});if(e.length!==1)throw new r(`gallery extension ${o} <${o==="install"?"folder | zip":"id"}>`);if(o==="remove")await u(e[0]),console.log(`Removed extension ${e[0]}`);else{let n=await $(e[0]);console.log(`Installed ${n.id}: ${n.folder}
5
- Next: enable it in Gallery Settings > Extensions. Its backend starts on first use after enabling.`),n.agent&&console.log(`Agent instructions: ${n.agent}`)}return}if(o==="list"){let{positional:e}=c({argv:t});return L(e)}if(o==="check"){let{positional:e}=c({argv:t});return F(e)}throw new r(o?`No such action: extension ${o} (new, list, check, install, remove).`:"Say what to do: gallery extension new <id> <title>, list or check <id>.")}export{M as run};
@@ -1,2 +0,0 @@
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 u,c as f,d}from"./chunk-T4Y2ZSVX.mjs";import{b as p}from"./chunk-5GK7HS62.mjs";import{j as n}from"./chunk-4OZWXZE5.mjs";import{l as i,t as a,w as c}from"./chunk-BX5AKINW.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};
@@ -1,3 +0,0 @@
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}from"./chunk-JEUK3ZO7.mjs";import"./chunk-6NLXUKAY.mjs";import{f as D}from"./chunk-VRPVVMRB.mjs";import{b as d,f as J,i as k}from"./chunk-4OZWXZE5.mjs";import{c as F}from"./chunk-U5XL7D6A.mjs";import"./chunk-HYMEEXKN.mjs";import{a as A}from"./chunk-UMHUSOPJ.mjs";import"./chunk-W5NPH5UA.mjs";import"./chunk-ECZBLQKK.mjs";import"./chunk-E7656LR7.mjs";import"./chunk-TKWEX4FD.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{existsSync as E}from"node:fs";import R from"node:fs/promises";import m from"node:path";import{iconKind as q}from"../browser/shared/emoji/icon-value.mjs";import{writeAtomic as z}from"../browser/shared/files.mjs";import{reportsDirectory as C}from"../browser/shared/paths.mjs";import{roleOf as M}from"../browser/shared/reports.mjs";import{documentDirectory as P,documentFiles as T,pageSlug as U}from"../browser/shared/workspace.mjs";var K=o=>o.replace(/\s+/g," ").trim(),_=o=>o.replace(/^[a-z]:\/(?:[^/]+\/)*?(?=icons\/(?:tabler\/)?[^/]+$)/i,"/"),h=o=>o===null?"none":JSON.stringify(o);async function ie(o){let{positional:u,values:c}=J({values:["--title","--icon","--description"],argv:o});if(u.length!==1)throw new d("Name one document, then what to set: --title, --icon, --description.");if(!["--title","--icon","--description"].some(e=>c.has(e)))throw new d('Say what to set: --title "<title>", --icon <emoji|none|\u2026>, --description "<text>".');let n=c.has("--title")?K(c.get("--title")):void 0,p=c.has("--description")?K(c.get("--description")):void 0;if(n==="")throw new d("--title takes the words of the title: a document's title is never empty.");if(p==="")throw new d("--description takes words: a document's description is never empty.");let t;if(c.has("--icon")){let e=_(c.get("--icon").trim()),f=e==="none"?"none":q(e);if(!f||/["<>&]/.test(e))throw new d(`Not a page icon: ${e} (an emoji, none, an icon of the \u56FE\u6807 tab as /icons/<name>_<color>.svg, or a picture of the document's assets/).`);if(f==="glyph"&&!F(e))throw new d(`No such icon of the \u56FE\u6807 tab: ${e}.`);t=f==="none"?null:e}let{slug:w}=await k(u[0]),$=P(w,C);(w===await U(C)||await M($)==="instructions")&&(console.error(`${u[0]} is the \u5199\u4F5C\u504F\u597D page: only the user changes it.`),process.exit(1));let{html:r,json:s}=T($);E(r)||(console.error(`No document "${u[0]}": ${a(r)} does not exist (gallery list lists those there are).`),process.exit(1)),t&&q(t)==="image"&&!E(m.join($,...t.split("/")))&&(console.error(`No picture ${t} in ${a($)}: put it in its assets/ first.`),process.exit(1));let i;try{if(i=JSON.parse(await R.readFile(s,"utf8")),!i||typeof i!="object"||Array.isArray(i))throw new Error("not an object")}catch(e){console.error(`${a(s)} does not read (${e.code??e.message}): mend it first.`),process.exit(1)}let b=null,N=!1;for(let e=1;n!==void 0||t!==void 0;e++){let f=await R.readFile(r,"utf8"),v=A(f),y=D(v,{title:n,icon:t});if(y.missing&&(console.error(`${a(r)} has no title to ${n!==void 0?"set":"put the icon before"}: write it as an h1.doc-title in the page's header (writing-html.md, "The page").`),process.exit(1)),b=y.before,y.text===v)break;if(await z(r,y.text,{expect:f})){N=!0;break}e===3&&(console.error(`${a(r)} kept changing while it was being written (the page saving, or an Agent writing it?): nothing written. Run gallery set again.`),process.exit(1))}let l={...i};n!==void 0&&(l.title=n),p!==void 0&&(l.description=p),t===null?delete l.icon:t!==void 0&&(l.icon=t);let x=JSON.stringify(l)!==JSON.stringify(i);x&&await z(s,`${JSON.stringify(l,null,2)}
3
- `);let S=m.basename(r),g=[];n!==void 0&&g.push(` title: ${h(b.title)} \u2192 ${h(n)} (${S}'s h1 and <title>, ${m.basename(s)})`),t!==void 0&&g.push(` icon: ${h(b.icon)} \u2192 ${h(t)} (${S}'s header, ${m.basename(s)})`),p!==void 0&&g.push(` description: ${h(typeof i.description=="string"?i.description:null)} \u2192 ${h(p)} (${m.basename(s)})`);let j=[...N?[a(r)]:[],...x?[a(s)]:[]];if(j.length===0){console.log(`Nothing to change: ${w} has ${g.length===1?"that already":"those already"}.`);return}console.log(`Set ${w}:`);for(let e of g)console.log(e);let O=j.length===1;console.log(`Re-read ${j.join(", ")} before editing ${O?"it":"them"}: gallery set wrote ${O?"it":"them"} (${[...N?[`${S}: its header`]:[],...x?[`${m.basename(s)}: ${["title","icon","description"].filter(e=>JSON.stringify(l[e])!==JSON.stringify(i[e])).join(", ")}`]:[]].join("; ")}).`)}export{ie as run};
@@ -1,2 +0,0 @@
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{refusal as ct,said as at}from"../browser/shared/i18n/index.mjs";import{SITE_ICON_BYTES as it,SITE_ICON_TYPES as lt,loginTitle as ut}from"../browser/shared/web-links.mjs";import $ from"node:http";import z from"node:https";import Y from"node:net";import S from"node:tls";import P from"node:zlib";import{Readable as B}from"node:stream";import{execFile as j}from"node:child_process";import{promisify as M}from"node:util";var A=M(j),X=/^(localhost|127\.|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.|\[?::1\]?$|0\.0\.0\.0)/i;function K(t,e){let n=t.toLowerCase();for(let r of e){let o=r.trim().toLowerCase();if(!o)continue;if(o==="*")return!0;if(o==="<local>"){if(!n.includes("."))return!0;continue}if(o.includes("*")){if(new RegExp(`^${o.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(n))return!0;continue}let s=o.replace(/^\./,"").replace(/:\d+$/,"");if(n===s||n.endsWith(`.${s}`))return!0}return!1}var N=t=>/^[a-z]+:\/\//i.test(t)?t:`http://${t}`;function V(t=process.env){let e=t.HTTPS_PROXY||t.https_proxy||t.HTTP_PROXY||t.http_proxy||t.ALL_PROXY||t.all_proxy;return e?{url:N(e),bypass:(t.NO_PROXY||t.no_proxy||"").split(",")}:null}async function J(){let{stdout:t}=await A("reg",["query","HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"],{windowsHide:!0,timeout:3e3}),e=o=>new RegExp(`^\\s*${o}\\s+REG_\\w+\\s+(.*)$`,"mi").exec(t)?.[1]?.trim();if(Number.parseInt(e("ProxyEnable")||"0",16)!==1)return null;let n=e("ProxyServer");if(!n)return null;let r=n;if(n.includes("=")){let o=Object.fromEntries(n.split(";").map(s=>s.split("=").map(c=>c.trim())));if(r=o.https||o.http,!r)return null}return{url:N(r),bypass:(e("ProxyOverride")||"").split(";")}}async function Q(){let{stdout:t}=await A("scutil",["--proxy"],{timeout:3e3}),e=r=>new RegExp(`\\b${r}\\s*:\\s*(\\S+)`).exec(t)?.[1];if(e("HTTPSEnable")!=="1"||!e("HTTPSProxy"))return null;let n=[...t.matchAll(/^\s*\d+\s*:\s*(\S+)\s*$/gm)].map(r=>r[1]);return{url:`http://${e("HTTPSProxy")}:${e("HTTPSPort")||80}`,bypass:n}}var C=null,I=0;async function Z(){let t=V();if(t)return t;if(C!==null&&Date.now()-I<3e4)return C||null;let e=null;try{process.platform==="win32"?e=await J():process.platform==="darwin"&&(e=await Q())}catch{e=null}return C=e||!1,I=Date.now(),e}async function tt(t){let e;try{e=new URL(t).hostname}catch{return null}if(X.test(e))return null;let n=await Z();return n&&!K(e,n.bypass)&&/^http:/i.test(n.url)?n.url:null}var R=t=>t.username?{"proxy-authorization":`Basic ${Buffer.from(`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`).toString("base64")}`}:{};function _(t,e,n,r){return new Promise((o,s)=>{let c=$.request({host:t.hostname,port:t.port||80,method:"CONNECT",path:`${e}:${n}`,headers:{host:`${e}:${n}`,...R(t)},signal:r});c.once("connect",(a,l)=>{a.statusCode===200?o(l):(l.destroy(),s(Object.assign(new Error(`the proxy answered ${a.statusCode}`),{proxyAnswered:a.statusCode})))}),c.once("error",s),c.end()})}function et(t,{method:e,headers:n,signal:r},o){let s=new URL(t),c=new URL(o),a={"accept-encoding":"gzip, deflate, br",...n};return new Promise((l,i)=>{let u=f=>{f.once("response",l),f.once("error",i),f.end()};if(s.protocol==="http:"){u($.request({host:c.hostname,port:c.port||80,method:e,path:s.href,headers:{...a,host:s.host,...R(c)},signal:r}));return}_(c,s.hostname,s.port||443,r).then(f=>{u(z.request(s,{method:e,headers:{...a,host:s.host},defaultPort:443,signal:r,createConnection:()=>S.connect({socket:f,servername:s.hostname,ALPNProtocols:["http/1.1"]})}))},i)})}function T(t,e){let n=new Headers;for(let[l,i]of Object.entries(t.headers))n.set(l,Array.isArray(i)?i.join(", "):String(i));let r=(t.headers["content-encoding"]||"").toLowerCase(),o={gzip:P.createGunzip,"x-gzip":P.createGunzip,deflate:P.createInflate,br:P.createBrotliDecompress}[r],s=o?t.pipe(o()):t;o&&(t.on("error",l=>s.destroy(l)),n.delete("content-encoding"),n.delete("content-length"));let c=[101,204,205,304].includes(t.statusCode);c&&t.resume();let a=new Response(c?null:B.toWeb(s),{status:t.statusCode,statusText:t.statusMessage,headers:n});return Object.defineProperty(a,"url",{value:e}),a}async function nt(t,{method:e="GET",headers:n={},signal:r}={},o){for(let s=0;;s++){let c=await et(t,{method:e,headers:n,signal:r},o),a=c.headers.location;if([301,302,303,307,308].includes(c.statusCode)&&a&&s<10){c.resume(),t=new URL(a,t).href,c.statusCode===303&&(e="GET");continue}return T(c,t)}}var v=t=>t.includes(":")?`[${t}]`:t,ot=t=>/^[\d.]+$/.test(t)||t.includes(":");function Pt(t,{address:e,proxy:n=null,headers:r={},signal:o,connect:s=(a,l)=>Y.connect({host:a,port:l}),ca:c=null}){let a=Number(t.port)||(t.protocol==="https:"?443:80),l=e===null;if(l&&!(n&&t.protocol==="https:"))return Promise.reject(new Error("fetchPinned: only an https address is handed to a proxy by its name"));let i=ot(t.hostname)?void 0:t.hostname,u={"accept-encoding":"gzip, deflate, br",...r,host:t.host},f=`${t.pathname}${t.search}`,L=l||c?[...S.rootCertificates,...c?[c]:[]]:null,b=d=>S.connect({socket:d,servername:i,ALPNProtocols:["http/1.1"],...L?{ca:L}:{},...l?{rejectUnauthorized:!0}:{}}),F=d=>new Promise((x,m)=>{if(o?.aborted)return d.destroy(),m(o.reason);let h=b(d),g=()=>h.destroy(o.reason);o?.addEventListener("abort",g,{once:!0}),h.on("error",p=>{o?.removeEventListener("abort",g),m(p)}),h.once("close",()=>m(new Error("the connection closed before TLS was done"))),h.once("secureConnect",()=>{if(o?.removeEventListener("abort",g),l&&!h.authorized){let p=Object.assign(new Error(`the certificate failed (${h.authorizationError})`),{code:String(h.authorizationError)});return h.destroy(),m(p)}x(h)})});return new Promise((d,x)=>{let m=p=>{let w=(t.protocol==="https:"?z:$).request({method:"GET",signal:o,...p});w.once("response",D=>d(T(D,t.href))),w.once("error",x),w.end()};if(!n){m({host:e,port:a,path:f,headers:u,createConnection:()=>t.protocol==="https:"?b(s(e,a)):s(e,a)});return}let h=new URL(n),g=p=>x(p?.proxyAnswered||o?.aborted?p:Object.assign(p??new Error("the proxy was not reached"),{proxyFailed:!0}));if(t.protocol==="http:"){let p=$.request({host:h.hostname,port:h.port||80,method:"GET",path:`http://${v(e)}:${a}${f}`,headers:{...u,...R(h)},agent:!1,signal:o});p.once("response",w=>d(T(w,t.href))),p.once("error",g),p.end();return}_(h,l?t.hostname:v(e),a,o).then(p=>F(p).then(w=>m({host:l?t.hostname:e,port:a,path:f,headers:u,createConnection:()=>w}),x),g)})}async function rt(t,e={}){let n=await tt(t);if(n)try{return await nt(t,e,n)}catch(r){if(e.signal?.aborted)throw r}return fetch(t,e)}var st="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0 Safari/537.36";async function y(t,{timeout:e=1e4,accept:n="*/*",headers:r={},unreachable:o="\u6253\u4E0D\u5F00\u8FD9\u4E2A\u7F51\u9875",protocols:s=["http:","https:"]}={}){let c;try{c=new URL(t)}catch{throw Object.assign(new Error("\u4E0D\u662F\u7F51\u5740"),{reason:"url"})}if(!s.includes(c.protocol))throw Object.assign(new Error("\u53EA\u652F\u6301 http(s) \u7F51\u5740"),{reason:"url"});return rt(c,{redirect:"follow",signal:AbortSignal.timeout(e),headers:{"user-agent":st,accept:n,...r}}).catch(()=>{throw Object.assign(new Error(o),{reason:"download"})})}async function E(t,e){let n=t.body.getReader(),r=[],o=0;for(;;){let{done:s,value:c}=await n.read();if(s)break;if(r.push(Buffer.from(c)),o+=c.length,o>=e){n.cancel().catch(()=>{});break}}return Buffer.concat(r)}async function O(t,e){let n=await E(t,e+1);return n.length<=e?n:null}var ft={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},H=t=>t.replace(/&(#x[0-9a-f]+|#\d+|\w+);/gi,(e,n)=>{if(n[0]==="#"){let r=n[1]==="x"||n[1]==="X"?parseInt(n.slice(2),16):Number(n.slice(1));return Number.isFinite(r)&&r>0&&r<=1114111?String.fromCodePoint(r):e}return ft[n.toLowerCase()]??e}),U=t=>H(String(t??"")).replace(/\s+/g," ").trim();function pt(t){let e={};for(let n of t.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+))/g))e[n[1].toLowerCase()]=n[3]??n[4]??n[5]??"";return e}function k(t,e){let n=/charset=([\w-]+)/i.exec(e??"")?.[1];n||(n=/<meta[^>]+charset=["']?([\w-]+)/i.exec(t.subarray(0,4096).toString("latin1"))?.[1]);try{return new TextDecoder(n||"utf-8").decode(t)}catch{return new TextDecoder("utf-8").decode(t)}}function q(t,e){let n=t.search(/<\/head>/i),r=n>0?t.slice(0,n):t.slice(0,3e5),o={},s=[];for(let[i]of r.matchAll(/<(meta|link)\b[^>]*>/gi)){let u=pt(i);if(/^<meta/i.test(i)){let f=(u.property||u.name||u.itemprop||"").toLowerCase();f&&u.content!==void 0&&!(f in o)&&(o[f]=u.content)}else u.rel&&u.href&&/(^|\s)(icon|shortcut icon|apple-touch-icon)(\s|$)/i.test(u.rel)&&s.push({rel:u.rel.toLowerCase(),href:u.href})}let c=i=>{try{return i?new URL(H(i),e).href:null}catch{return null}},a=/<title[^>]*>([\s\S]*?)<\/title>/i.exec(r)?.[1],l=s.find(i=>/(^|\s)icon(\s|$)/.test(i.rel))??s.find(i=>i.rel.includes("icon"));return{title:U(o["og:title"]||o["twitter:title"]||a||"").slice(0,300),description:U(o["og:description"]||o["twitter:description"]||o.description||"").slice(0,600),icon:c(l?.href)||c("/favicon.ico"),cover:c(o["og:image"]||o["og:image:url"]||o["og:image:secure_url"]||o["twitter:image"]||o["twitter:image:src"])}}async function ht(t){if(!t)return null;try{let e=await y(t,{timeout:8e3,accept:"image/*,*/*;q=0.5",protocols:["http:","https:","data:"]}),n=(e.headers.get("content-type")??"").split(";")[0].trim();if(!e.ok||!/^image\//.test(n))return null;let r=await O(e,5*1024*1024);return r?.length?r:null}catch{return null}}async function Rt(t){try{let e=await y(t,{timeout:8e3,accept:"text/html,*/*;q=0.8"});if(e.body?.cancel().catch(()=>{}),[401,403].includes(e.status)||W(e.url))return{frameable:!0,reason:"auth"};if(!e.ok)return{frameable:!0,reason:"unknown"};let n=(e.headers.get("x-frame-options")??"").toLowerCase(),r=(e.headers.get("content-security-policy")??"").split(",").map(o=>/(?:^|;)\s*frame-ancestors\s+([^;]*)/i.exec(o)?.[1]?.trim().toLowerCase()).filter(o=>o!==void 0);return r.length?r.some(o=>o==="'none'"||o==="'self'")?{frameable:!1,reason:"frame-ancestors"}:{frameable:!0,...r.every(o=>o==="*")?{}:{reason:"unknown"}}:n.split(",").some(o=>/^(deny|sameorigin)$/.test(o.trim()))?{frameable:!1,reason:"x-frame-options"}:{frameable:!0}}catch(e){return e.reason==="url"?{frameable:!1,reason:"url"}:{frameable:!0,reason:"unknown"}}}function W(t){try{let e=new URL(t);return/^(?:login|signin|passport|sso)\./i.test(e.hostname)||/\/(?:login|signin|sign-in|oauth2\/challenge)(?:[/.]|$)/i.test(e.pathname)}catch{return!1}}async function Ot(t){try{let e=await y(t,{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.8",headers:{"accept-language":"zh-CN,zh;q=0.9,en;q=0.8"}});if([401,403].includes(e.status)||W(e.url))return e.body?.cancel().catch(()=>{}),{title:"",reason:"auth"};let n=e.headers.get("content-type")??"";if(!e.ok||!/html|xml/i.test(n))return e.body?.cancel().catch(()=>{}),{title:"",reason:"unknown"};let r=q(k(await E(e,1.5*1024*1024),n),e.url||t).title;return ut(r)?{title:"",reason:"auth"}:{title:r.slice(0,200)}}catch{return{title:"",reason:"unknown"}}}function dt(t){let e=t.subarray(0,16);return e[0]===137&&e.toString("latin1",1,4)==="PNG"?"image/png":e[0]===0&&e[1]===0&&e[2]===1&&e[3]===0?"image/x-icon":e.toString("latin1",0,3)==="GIF"?"image/gif":e[0]===255&&e[1]===216&&e[2]===255?"image/jpeg":e.toString("latin1",0,4)==="RIFF"&&e.toString("latin1",8,12)==="WEBP"?"image/webp":/^\s*(<\?xml[^>]*>\s*)?<svg[\s>]/i.test(t.subarray(0,512).toString("utf8"))?"image/svg+xml":null}async function G(t,e){if(!t||e<=0)return null;try{let n=await y(t,{timeout:e,accept:"image/*,*/*;q=0.5",protocols:["http:","https:","data:"]});if(!n.ok)return n.body?.cancel().catch(()=>{}),null;let r=(n.headers.get("content-type")??"").split(";")[0].trim().toLowerCase(),o=await O(n,it);if(!o?.length)return null;let s=lt.includes(r)?r:dt(o);return s?`data:${s};base64,${o.toString("base64")}`:null}catch{return null}}async function kt(t,{timeout:e=4e3,env:n=process.env}={}){if(n.GALLERY_SITE_ICON==="off")return null;if(n.GALLERY_SITE_ICON==="local"){let i="";try{i=new URL(t).hostname.replace(/^\[|\]$/g,"")}catch{}if(!/^(127\.\d+\.\d+\.\d+|localhost|::1)$/i.test(i))return null}let r=Date.now()+e,o=()=>r-Date.now(),s=t,c=null;try{let i=await y(t,{timeout:o(),accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.8"});s=i.url||t;let u=i.headers.get("content-type")??"";i.ok&&/html|xml/i.test(u)?c=q(k(await E(i,512*1024),u),s).icon:i.body?.cancel().catch(()=>{})}catch{return null}let a=null;try{a=new URL("/favicon.ico",s).href}catch{}return await G(c,o())??(c!==a?G(a,o()):null)}async function qt(t,e,{icon:n=!0,cover:r=!0}={}){let o=await y(t,{accept:"text/html,application/xhtml+xml;q=0.9,*/*;q=0.8",headers:{"accept-language":"zh-CN,zh;q=0.9,en;q=0.8"}}),s=o.url||new URL(t).href,c=o.headers.get("content-type")??"";if(!o.ok)throw ct(at("\u7F51\u9875\u8FD4\u56DE {0}",o.status),{reason:"download"});if(!/html|xml/i.test(c))return o.body?.cancel().catch(()=>{}),{url:s,title:"",description:"",icon:null,cover:null};let a=q(k(await E(o,1.5*1024*1024),c),s),l=async(f,L)=>{let b=await ht(f);try{return b?await e(b,L):null}catch{return null}},[i,u]=await Promise.all([n?l(a.icon,"bookmark-icon"):null,r?l(a.cover,"bookmark-cover"):null]);return{url:s,title:a.title,description:a.description,icon:i,cover:u}}export{tt as a,Pt as b,y as c,O as d,Rt as e,Ot as f,kt as g,qt as h};