@bendyline/squisq 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +24 -0
  3. package/dist/{ContentContainer-BXUlIf18.d.ts → ContentContainer-B2w9sUoL.d.ts} +15 -0
  4. package/dist/{Doc-DynJleo-.d.ts → Doc-BubIpWsp.d.ts} +1 -1
  5. package/dist/{ImageEditDoc-Ca4Tr9uN.d.ts → ImageEditDoc-CGxk5CHc.d.ts} +1 -1
  6. package/dist/{annotationCoercion-Dr_DY9Hx.d.ts → annotationCoercion-PtRQhk5V.d.ts} +1 -1
  7. package/dist/chunk-2L55443L.js +0 -0
  8. package/dist/{chunk-VWCJ2WXC.js → chunk-2ZWIXGAC.js} +0 -1
  9. package/dist/{chunk-VYFRI7R6.js → chunk-32R2RZAO.js} +72 -3
  10. package/dist/chunk-3IGPAPQ7.js +645 -0
  11. package/dist/{chunk-QE7TWGVT.js → chunk-4VOD55SX.js} +0 -1
  12. package/dist/{chunk-3E5F2XMR.js → chunk-67L6WRJN.js} +0 -1
  13. package/dist/{chunk-5DKBFXPY.js → chunk-6ECMNUIP.js} +26 -18
  14. package/dist/{chunk-JI77MGAK.js → chunk-7ARJZYQY.js} +159 -120
  15. package/dist/{chunk-DBS6RIFL.js → chunk-7N4G32LG.js} +0 -1
  16. package/dist/{chunk-JOQYPRDZ.js → chunk-7YEZFHLS.js} +10 -8
  17. package/dist/{chunk-2UQOHYE2.js → chunk-7ZAAICW4.js} +0 -1
  18. package/dist/{chunk-66QO7XFB.js → chunk-ACZOVWX3.js} +117 -7
  19. package/dist/{chunk-5J4HKRJF.js → chunk-BAOV476U.js} +0 -1
  20. package/dist/chunk-BCCXTMN5.js +699 -0
  21. package/dist/{chunk-JHZWYRSW.js → chunk-C33GTPUZ.js} +11 -4
  22. package/dist/{chunk-QUUPYOSP.js → chunk-CB45YGAM.js} +2 -3
  23. package/dist/{chunk-XNLB57UD.js → chunk-DYPMOPIW.js} +18 -2
  24. package/dist/{chunk-VR7UPJ7C.js → chunk-FCG3BIZN.js} +12 -1
  25. package/dist/{chunk-5UYI3RJB.js → chunk-FDYDYL77.js} +54 -40
  26. package/dist/{chunk-OTKVFVL6.js → chunk-I2O6W7DX.js} +116 -44
  27. package/dist/{chunk-Q7LROV2H.js → chunk-NKNMGIIN.js} +0 -1
  28. package/dist/chunk-OPO5K4DZ.js +241 -0
  29. package/dist/{chunk-TUWMK62B.js → chunk-PUS54YU6.js} +45 -2
  30. package/dist/chunk-QKPXHDLR.js +0 -0
  31. package/dist/{chunk-GZY66SDN.js → chunk-R3KTTOMS.js} +0 -1
  32. package/dist/{chunk-ILWDXLUK.js → chunk-RS5AP3J4.js} +49 -10
  33. package/dist/chunk-WV5ARNDA.js +0 -0
  34. package/dist/{chunk-4X3JQXNM.js → chunk-XOFT65EX.js} +1 -2
  35. package/dist/{chunk-FVTQSNR7.js → chunk-XRW6P7IF.js} +13 -5
  36. package/dist/chunk-XWNNA3KE.js +0 -0
  37. package/dist/chunk-YZNGMV3G.js +0 -0
  38. package/dist/{chunk-R2YZTCLO.js → chunk-ZQKZSJAX.js} +1 -2
  39. package/dist/doc/index.d.ts +27 -12
  40. package/dist/doc/index.js +16 -17
  41. package/dist/generate/index.d.ts +2 -2
  42. package/dist/generate/index.js +2 -3
  43. package/dist/icons/index.js +3 -4
  44. package/dist/icons/inlineIconMarker.js +1 -2
  45. package/dist/imageEdit/index.d.ts +48 -17
  46. package/dist/imageEdit/index.js +3 -4
  47. package/dist/index.d.ts +11 -11
  48. package/dist/index.js +60 -33
  49. package/dist/jsonForm/index.d.ts +10 -3
  50. package/dist/jsonForm/index.js +8 -7
  51. package/dist/markdown/index.d.ts +75 -11
  52. package/dist/markdown/index.js +32 -7
  53. package/dist/{materializePageSection-DDzubQXo.d.ts → materializePageSection-wSLA2A1g.d.ts} +2 -2
  54. package/dist/narration/index.d.ts +16 -3
  55. package/dist/narration/index.js +13 -14
  56. package/dist/random/index.d.ts +11 -2
  57. package/dist/random/index.js +2 -3
  58. package/dist/recommend/index.d.ts +1 -1
  59. package/dist/recommend/index.js +3 -4
  60. package/dist/schemas/index.d.ts +5 -5
  61. package/dist/schemas/index.js +5 -6
  62. package/dist/spatial/index.d.ts +2 -1
  63. package/dist/spatial/index.js +1 -2
  64. package/dist/storage/index.d.ts +4 -2
  65. package/dist/storage/index.js +1 -2
  66. package/dist/{themeLibrary-B72m0W1y.d.ts → themeLibrary-DU9mUmVl.d.ts} +1 -1
  67. package/dist/timing/index.js +3 -4
  68. package/dist/transform/index.d.ts +3 -3
  69. package/dist/transform/index.js +6 -7
  70. package/dist/{types-C4kiRn_k.d.ts → types-8QjefM9J.d.ts} +38 -2
  71. package/dist/{types-BwMPl2CB.d.ts → types-CUNc9biN.d.ts} +24 -1
  72. package/dist/versions/index.d.ts +14 -11
  73. package/dist/versions/index.js +2 -3
  74. package/package.json +4 -2
  75. package/dist/chunk-2UQOHYE2.js.map +0 -1
  76. package/dist/chunk-3E5F2XMR.js.map +0 -1
  77. package/dist/chunk-4X3JQXNM.js.map +0 -1
  78. package/dist/chunk-5DKBFXPY.js.map +0 -1
  79. package/dist/chunk-5J4HKRJF.js.map +0 -1
  80. package/dist/chunk-5UYI3RJB.js.map +0 -1
  81. package/dist/chunk-66QO7XFB.js.map +0 -1
  82. package/dist/chunk-AMIR72JP.js +0 -380
  83. package/dist/chunk-AMIR72JP.js.map +0 -1
  84. package/dist/chunk-DBS6RIFL.js.map +0 -1
  85. package/dist/chunk-DNJKBAI7.js +0 -1
  86. package/dist/chunk-DNJKBAI7.js.map +0 -1
  87. package/dist/chunk-ET53IIEP.js +0 -1
  88. package/dist/chunk-ET53IIEP.js.map +0 -1
  89. package/dist/chunk-FVTQSNR7.js.map +0 -1
  90. package/dist/chunk-GZY66SDN.js.map +0 -1
  91. package/dist/chunk-ILWDXLUK.js.map +0 -1
  92. package/dist/chunk-JHZWYRSW.js.map +0 -1
  93. package/dist/chunk-JI77MGAK.js.map +0 -1
  94. package/dist/chunk-JOQYPRDZ.js.map +0 -1
  95. package/dist/chunk-OTKVFVL6.js.map +0 -1
  96. package/dist/chunk-PGGGKYWG.js +0 -1
  97. package/dist/chunk-PGGGKYWG.js.map +0 -1
  98. package/dist/chunk-Q7LROV2H.js.map +0 -1
  99. package/dist/chunk-QE7TWGVT.js.map +0 -1
  100. package/dist/chunk-QUUPYOSP.js.map +0 -1
  101. package/dist/chunk-R2GC6RLD.js +0 -344
  102. package/dist/chunk-R2GC6RLD.js.map +0 -1
  103. package/dist/chunk-R2YZTCLO.js.map +0 -1
  104. package/dist/chunk-S7A5D7ZJ.js +0 -174
  105. package/dist/chunk-S7A5D7ZJ.js.map +0 -1
  106. package/dist/chunk-TUWMK62B.js.map +0 -1
  107. package/dist/chunk-V543AI2F.js +0 -1
  108. package/dist/chunk-V543AI2F.js.map +0 -1
  109. package/dist/chunk-VR7UPJ7C.js.map +0 -1
  110. package/dist/chunk-VWCJ2WXC.js.map +0 -1
  111. package/dist/chunk-VYFRI7R6.js.map +0 -1
  112. package/dist/chunk-XNLB57UD.js.map +0 -1
  113. package/dist/chunk-ZLQKNOZQ.js +0 -1
  114. package/dist/chunk-ZLQKNOZQ.js.map +0 -1
  115. package/dist/doc/index.js.map +0 -1
  116. package/dist/generate/index.js.map +0 -1
  117. package/dist/icons/index.js.map +0 -1
  118. package/dist/icons/inlineIconMarker.js.map +0 -1
  119. package/dist/imageEdit/index.js.map +0 -1
  120. package/dist/index.js.map +0 -1
  121. package/dist/jsonForm/index.js.map +0 -1
  122. package/dist/markdown/index.js.map +0 -1
  123. package/dist/narration/index.js.map +0 -1
  124. package/dist/random/index.js.map +0 -1
  125. package/dist/recommend/index.js.map +0 -1
  126. package/dist/schemas/index.js.map +0 -1
  127. package/dist/spatial/index.js.map +0 -1
  128. package/dist/storage/index.js.map +0 -1
  129. package/dist/timing/index.js.map +0 -1
  130. package/dist/transform/index.js.map +0 -1
  131. package/dist/versions/index.js.map +0 -1
  132. package/src/__tests__/animationUtils.test.ts +0 -117
  133. package/src/__tests__/annotationCoercion.test.ts +0 -243
  134. package/src/__tests__/applyNarrationTiming.test.ts +0 -190
  135. package/src/__tests__/applyRenderStyle.test.ts +0 -146
  136. package/src/__tests__/asciiDiagramBattle.test.ts +0 -246
  137. package/src/__tests__/asciiDiagramDetect.test.ts +0 -162
  138. package/src/__tests__/asciiDiagramMapping.test.ts +0 -38
  139. package/src/__tests__/asciiDiagramParse.test.ts +0 -233
  140. package/src/__tests__/asciiDiagramPipeline.test.ts +0 -273
  141. package/src/__tests__/asciiDiagramRender.test.ts +0 -162
  142. package/src/__tests__/asciiDiagramRepair.test.ts +0 -84
  143. package/src/__tests__/asciiTimelineDetect.test.ts +0 -157
  144. package/src/__tests__/asciiTimelineParse.test.ts +0 -205
  145. package/src/__tests__/asciiTimelinePipeline.test.ts +0 -349
  146. package/src/__tests__/asciiTimelineRender.test.ts +0 -376
  147. package/src/__tests__/atmosphereLayers.test.ts +0 -108
  148. package/src/__tests__/attrTokens.test.ts +0 -167
  149. package/src/__tests__/colorUtils.test.ts +0 -112
  150. package/src/__tests__/contentContainer.test.ts +0 -325
  151. package/src/__tests__/contentExtractor.test.ts +0 -243
  152. package/src/__tests__/coverBlock.test.ts +0 -310
  153. package/src/__tests__/customTemplateSample.test.ts +0 -144
  154. package/src/__tests__/customTemplatesFrontmatter.test.ts +0 -221
  155. package/src/__tests__/customThemesFrontmatter.test.ts +0 -146
  156. package/src/__tests__/dataTable.test.ts +0 -145
  157. package/src/__tests__/diagramBlock.test.ts +0 -122
  158. package/src/__tests__/diagramLayout.test.ts +0 -134
  159. package/src/__tests__/diagramText.test.ts +0 -26
  160. package/src/__tests__/docToMarkdownMedia.test.ts +0 -83
  161. package/src/__tests__/drawing.test.ts +0 -109
  162. package/src/__tests__/drawingBlock.test.ts +0 -124
  163. package/src/__tests__/drawingLayout.test.ts +0 -171
  164. package/src/__tests__/fixtures/asciiDiagramBattle.ts +0 -512
  165. package/src/__tests__/fixtures/asciiDiagrams.ts +0 -287
  166. package/src/__tests__/fixtures/asciiTimelines.ts +0 -35
  167. package/src/__tests__/fixtures/treeviewFixtures.ts +0 -243
  168. package/src/__tests__/geohash.test.ts +0 -110
  169. package/src/__tests__/getLayers.test.ts +0 -243
  170. package/src/__tests__/getLayersFallback.test.ts +0 -103
  171. package/src/__tests__/haversine.test.ts +0 -63
  172. package/src/__tests__/iconResolve.test.ts +0 -122
  173. package/src/__tests__/imageEditExportSvg.test.ts +0 -70
  174. package/src/__tests__/imageEditState.test.ts +0 -74
  175. package/src/__tests__/imageEditVersions.test.ts +0 -243
  176. package/src/__tests__/inferDocumentTitle.test.ts +0 -50
  177. package/src/__tests__/inlineIconMarker.test.ts +0 -36
  178. package/src/__tests__/inputDescriptors.test.ts +0 -162
  179. package/src/__tests__/jsonForm.chooseControl.test.ts +0 -86
  180. package/src/__tests__/jsonForm.evaluateWhen.test.ts +0 -59
  181. package/src/__tests__/jsonForm.inferSchema.test.ts +0 -25
  182. package/src/__tests__/jsonForm.pointer.test.ts +0 -149
  183. package/src/__tests__/jsonForm.tokens.test.ts +0 -84
  184. package/src/__tests__/layoutBlock.test.ts +0 -83
  185. package/src/__tests__/layoutLayout.test.ts +0 -169
  186. package/src/__tests__/localForageAdapter.test.ts +0 -155
  187. package/src/__tests__/majorApiTypes.test.ts +0 -18
  188. package/src/__tests__/markdown.test.ts +0 -1009
  189. package/src/__tests__/markdownIcons.test.ts +0 -104
  190. package/src/__tests__/markdownSanitize.test.ts +0 -81
  191. package/src/__tests__/markdownToDoc.test.ts +0 -957
  192. package/src/__tests__/matchFontFamily.test.ts +0 -114
  193. package/src/__tests__/materializeBlockLayers.test.ts +0 -167
  194. package/src/__tests__/materializePageSections.test.ts +0 -404
  195. package/src/__tests__/materializeTestUtils.ts +0 -17
  196. package/src/__tests__/mediaAnnotations.test.ts +0 -91
  197. package/src/__tests__/mediaSchedule.test.ts +0 -118
  198. package/src/__tests__/narrationAlign.test.ts +0 -150
  199. package/src/__tests__/narrationFeatures.test.ts +0 -71
  200. package/src/__tests__/narrationNuclei.test.ts +0 -45
  201. package/src/__tests__/narrationPacing.test.ts +0 -189
  202. package/src/__tests__/narrationScript.test.ts +0 -149
  203. package/src/__tests__/narrationSessionRepro.test.ts +0 -62
  204. package/src/__tests__/narrationSidecar.test.ts +0 -88
  205. package/src/__tests__/narrationSyllables.test.ts +0 -65
  206. package/src/__tests__/narrationTestSignals.ts +0 -167
  207. package/src/__tests__/narrationVad.test.ts +0 -66
  208. package/src/__tests__/pageStyle.test.ts +0 -258
  209. package/src/__tests__/pandocAttrParse.test.ts +0 -187
  210. package/src/__tests__/recommendTemplates.test.ts +0 -183
  211. package/src/__tests__/resolveDocTheme.test.ts +0 -69
  212. package/src/__tests__/rootExports.test.ts +0 -61
  213. package/src/__tests__/scopedContentContainer.test.ts +0 -109
  214. package/src/__tests__/seededRandom.test.ts +0 -142
  215. package/src/__tests__/shapeGeometry.test.ts +0 -138
  216. package/src/__tests__/shapeVocabulary.test.ts +0 -133
  217. package/src/__tests__/storage.test.ts +0 -60
  218. package/src/__tests__/structuredData.test.ts +0 -249
  219. package/src/__tests__/surface.test.ts +0 -68
  220. package/src/__tests__/templateAnnotationParse.test.ts +0 -173
  221. package/src/__tests__/templateInputs.test.ts +0 -69
  222. package/src/__tests__/templateMetadata.test.ts +0 -32
  223. package/src/__tests__/templates.test.ts +0 -710
  224. package/src/__tests__/themeCompile.test.ts +0 -225
  225. package/src/__tests__/themeValidator.test.ts +0 -131
  226. package/src/__tests__/timing.test.ts +0 -167
  227. package/src/__tests__/transformProvenance.test.ts +0 -160
  228. package/src/__tests__/transformV2.test.ts +0 -163
  229. package/src/__tests__/transitionNormalize.test.ts +0 -61
  230. package/src/__tests__/treeviewBattle.test.ts +0 -76
  231. package/src/__tests__/treeviewDetect.test.ts +0 -168
  232. package/src/__tests__/treeviewParse.test.ts +0 -118
  233. package/src/__tests__/treeviewPipeline.test.ts +0 -183
  234. package/src/__tests__/treeviewRender.test.ts +0 -91
  235. package/src/__tests__/validateDoc.test.ts +0 -260
  236. package/src/__tests__/versions.test.ts +0 -459
  237. package/src/doc/annotationBlocks.ts +0 -117
  238. package/src/doc/applyNarrationTiming.ts +0 -244
  239. package/src/doc/asciiDiagram/chars.ts +0 -210
  240. package/src/doc/asciiDiagram/detect.ts +0 -175
  241. package/src/doc/asciiDiagram/index.ts +0 -38
  242. package/src/doc/asciiDiagram/mapping.ts +0 -225
  243. package/src/doc/asciiDiagram/parse.ts +0 -1095
  244. package/src/doc/asciiDiagram/render.ts +0 -963
  245. package/src/doc/asciiDiagram/repair.ts +0 -400
  246. package/src/doc/asciiDiagram/types.ts +0 -65
  247. package/src/doc/asciiTimeline/detect.ts +0 -138
  248. package/src/doc/asciiTimeline/index.ts +0 -26
  249. package/src/doc/asciiTimeline/mapping.ts +0 -43
  250. package/src/doc/asciiTimeline/parse.ts +0 -870
  251. package/src/doc/asciiTimeline/render.ts +0 -427
  252. package/src/doc/asciiTimeline/types.ts +0 -73
  253. package/src/doc/asciiTimeline/wrappedFlow.ts +0 -427
  254. package/src/doc/audioMapping.ts +0 -442
  255. package/src/doc/customTemplatesFrontmatter.ts +0 -273
  256. package/src/doc/customThemesFrontmatter.ts +0 -95
  257. package/src/doc/docToMarkdown.ts +0 -284
  258. package/src/doc/index.ts +0 -161
  259. package/src/doc/markdownToDoc.ts +0 -1054
  260. package/src/doc/materializeBlockLayers.ts +0 -465
  261. package/src/doc/mediaAnnotations.ts +0 -120
  262. package/src/doc/page/PageSection.ts +0 -174
  263. package/src/doc/page/materializePageSection.ts +0 -616
  264. package/src/doc/page/resolvePageBlock.ts +0 -108
  265. package/src/doc/page/sectionExtractors.ts +0 -466
  266. package/src/doc/pageCss.ts +0 -628
  267. package/src/doc/resolveDocTheme.ts +0 -56
  268. package/src/doc/standaloneAnnotation.ts +0 -58
  269. package/src/doc/structuredData.ts +0 -301
  270. package/src/doc/templateInputs.ts +0 -424
  271. package/src/doc/templates/__tests__/customTemplate.test.ts +0 -170
  272. package/src/doc/templates/__tests__/customTemplateRegistry.test.ts +0 -124
  273. package/src/doc/templates/__tests__/listBlock.test.ts +0 -64
  274. package/src/doc/templates/accentImage.ts +0 -362
  275. package/src/doc/templates/captionUtils.ts +0 -56
  276. package/src/doc/templates/comparisonBar.ts +0 -173
  277. package/src/doc/templates/coverBlock.ts +0 -255
  278. package/src/doc/templates/customTemplate.ts +0 -51
  279. package/src/doc/templates/dataTable.ts +0 -102
  280. package/src/doc/templates/dateEvent.ts +0 -147
  281. package/src/doc/templates/definitionCard.ts +0 -140
  282. package/src/doc/templates/diagramBlock.ts +0 -403
  283. package/src/doc/templates/diagramLayout.ts +0 -159
  284. package/src/doc/templates/drawingBlock.ts +0 -325
  285. package/src/doc/templates/drawingLayout.ts +0 -539
  286. package/src/doc/templates/factCard.ts +0 -146
  287. package/src/doc/templates/fallbackBlock.ts +0 -123
  288. package/src/doc/templates/featureBlock.ts +0 -209
  289. package/src/doc/templates/fullBleedQuote.ts +0 -83
  290. package/src/doc/templates/imageWithCaption.ts +0 -186
  291. package/src/doc/templates/index.ts +0 -642
  292. package/src/doc/templates/inputDescriptors.ts +0 -451
  293. package/src/doc/templates/layoutBlock.ts +0 -43
  294. package/src/doc/templates/layoutLayout.ts +0 -243
  295. package/src/doc/templates/listBlock.ts +0 -207
  296. package/src/doc/templates/mapBlock.ts +0 -138
  297. package/src/doc/templates/metadata.ts +0 -130
  298. package/src/doc/templates/persistentLayers.ts +0 -526
  299. package/src/doc/templates/photoGrid.ts +0 -190
  300. package/src/doc/templates/pullQuote.ts +0 -141
  301. package/src/doc/templates/quoteBlock.ts +0 -141
  302. package/src/doc/templates/registry.ts +0 -88
  303. package/src/doc/templates/sectionHeader.ts +0 -120
  304. package/src/doc/templates/statHighlight.ts +0 -146
  305. package/src/doc/templates/templateNames.ts +0 -22
  306. package/src/doc/templates/timelineBlock.ts +0 -613
  307. package/src/doc/templates/titleBlock.ts +0 -150
  308. package/src/doc/templates/tokens/__tests__/resolveTokens.test.ts +0 -487
  309. package/src/doc/templates/tokens/resolveTokens.ts +0 -453
  310. package/src/doc/templates/treeBlock.ts +0 -131
  311. package/src/doc/templates/twoColumn.ts +0 -263
  312. package/src/doc/templates/videoPullQuote.ts +0 -142
  313. package/src/doc/templates/videoWithCaption.ts +0 -135
  314. package/src/doc/treeview/chars.ts +0 -72
  315. package/src/doc/treeview/detect.ts +0 -145
  316. package/src/doc/treeview/index.ts +0 -30
  317. package/src/doc/treeview/mapping.ts +0 -95
  318. package/src/doc/treeview/parse.ts +0 -201
  319. package/src/doc/treeview/render.ts +0 -41
  320. package/src/doc/treeview/types.ts +0 -43
  321. package/src/doc/utils/animationUtils.ts +0 -399
  322. package/src/doc/utils/applyRenderStyle.ts +0 -106
  323. package/src/doc/utils/diagramText.ts +0 -78
  324. package/src/doc/utils/imageTreatment.ts +0 -70
  325. package/src/doc/utils/nearest.ts +0 -59
  326. package/src/doc/utils/shapeGeometry.ts +0 -614
  327. package/src/doc/utils/themeUtils.ts +0 -243
  328. package/src/doc/validate.ts +0 -575
  329. package/src/generate/contentExtractor.ts +0 -921
  330. package/src/generate/index.ts +0 -18
  331. package/src/generate/templateMapper.ts +0 -177
  332. package/src/icons/iconData.ts +0 -31
  333. package/src/icons/index.ts +0 -26
  334. package/src/icons/inlineIconMarker.ts +0 -73
  335. package/src/icons/resolve.ts +0 -139
  336. package/src/imageEdit/ImageEditVersionManager.ts +0 -73
  337. package/src/imageEdit/export.ts +0 -410
  338. package/src/imageEdit/index.ts +0 -72
  339. package/src/imageEdit/persistence.ts +0 -113
  340. package/src/imageEdit/state.ts +0 -112
  341. package/src/imageEdit/versionPaths.ts +0 -44
  342. package/src/imageEdit/versions.ts +0 -152
  343. package/src/index.ts +0 -15
  344. package/src/internal/immutable.ts +0 -58
  345. package/src/jsonForm/chooseControl.ts +0 -88
  346. package/src/jsonForm/evaluateWhen.ts +0 -59
  347. package/src/jsonForm/index.ts +0 -32
  348. package/src/jsonForm/inferSchema.ts +0 -25
  349. package/src/jsonForm/pointer.ts +0 -154
  350. package/src/jsonForm/tokens.ts +0 -78
  351. package/src/jsonForm/types.ts +0 -167
  352. package/src/markdown/annotationCoercion.ts +0 -295
  353. package/src/markdown/attrTokens.ts +0 -243
  354. package/src/markdown/convert.ts +0 -1353
  355. package/src/markdown/htmlParse.ts +0 -212
  356. package/src/markdown/index.ts +0 -152
  357. package/src/markdown/parse.ts +0 -103
  358. package/src/markdown/sanitize.ts +0 -318
  359. package/src/markdown/stringify.ts +0 -207
  360. package/src/markdown/types.ts +0 -710
  361. package/src/markdown/utils.ts +0 -459
  362. package/src/narration/align.ts +0 -514
  363. package/src/narration/features.ts +0 -231
  364. package/src/narration/index.ts +0 -86
  365. package/src/narration/nuclei.ts +0 -118
  366. package/src/narration/pacing.ts +0 -211
  367. package/src/narration/script.ts +0 -239
  368. package/src/narration/session.ts +0 -100
  369. package/src/narration/sidecar.ts +0 -187
  370. package/src/narration/syllables.ts +0 -85
  371. package/src/narration/trace.ts +0 -50
  372. package/src/narration/types.ts +0 -299
  373. package/src/narration/vad.ts +0 -131
  374. package/src/ngeohash.d.ts +0 -11
  375. package/src/random/SeededRandom.ts +0 -127
  376. package/src/random/index.ts +0 -1
  377. package/src/recommend/index.ts +0 -16
  378. package/src/recommend/numberHighlight.ts +0 -25
  379. package/src/recommend/templates.ts +0 -393
  380. package/src/schemas/BlockTemplates.ts +0 -1046
  381. package/src/schemas/CustomTemplates.ts +0 -126
  382. package/src/schemas/Doc.ts +0 -1073
  383. package/src/schemas/ImageEditDoc.ts +0 -102
  384. package/src/schemas/LayoutStrategy.ts +0 -178
  385. package/src/schemas/Media.ts +0 -179
  386. package/src/schemas/MediaProvider.ts +0 -70
  387. package/src/schemas/PageStyle.ts +0 -213
  388. package/src/schemas/Theme.ts +0 -413
  389. package/src/schemas/Transitions.ts +0 -224
  390. package/src/schemas/Types.ts +0 -15
  391. package/src/schemas/Viewport.ts +0 -91
  392. package/src/schemas/colorUtils.ts +0 -219
  393. package/src/schemas/fontStacks.ts +0 -339
  394. package/src/schemas/index.ts +0 -31
  395. package/src/schemas/pageStyleDefaults.ts +0 -204
  396. package/src/schemas/themeCompile.ts +0 -244
  397. package/src/schemas/themeConstants.ts +0 -2
  398. package/src/schemas/themeLibrary.ts +0 -60
  399. package/src/schemas/themeValidator.ts +0 -609
  400. package/src/schemas/themes/bold.json +0 -77
  401. package/src/schemas/themes/cinematic.json +0 -143
  402. package/src/schemas/themes/documentary.json +0 -125
  403. package/src/schemas/themes/gezellig.json +0 -123
  404. package/src/schemas/themes/index.ts +0 -53
  405. package/src/schemas/themes/magazine.json +0 -126
  406. package/src/schemas/themes/minimalist.json +0 -74
  407. package/src/schemas/themes/morning-light.json +0 -117
  408. package/src/schemas/themes/standard-dark.json +0 -109
  409. package/src/schemas/themes/standard.json +0 -98
  410. package/src/schemas/themes/tech-dark.json +0 -143
  411. package/src/schemas/themes/warm-earth.json +0 -74
  412. package/src/spatial/Geohash.ts +0 -196
  413. package/src/spatial/Haversine.ts +0 -59
  414. package/src/spatial/index.ts +0 -2
  415. package/src/storage/ContentContainer.ts +0 -220
  416. package/src/storage/LocalForageAdapter.ts +0 -103
  417. package/src/storage/LocalStorageAdapter.ts +0 -57
  418. package/src/storage/MediaProviderFromContainer.ts +0 -92
  419. package/src/storage/MemoryStorageAdapter.ts +0 -37
  420. package/src/storage/ScopedContentContainer.ts +0 -143
  421. package/src/storage/Storage.ts +0 -28
  422. package/src/storage/index.ts +0 -9
  423. package/src/timing/index.ts +0 -17
  424. package/src/timing/narrationTiming.ts +0 -220
  425. package/src/timing/readingTime.ts +0 -94
  426. package/src/transform/applyTransform.ts +0 -122
  427. package/src/transform/blockAnalyzer.ts +0 -181
  428. package/src/transform/index.ts +0 -23
  429. package/src/transform/registry.ts +0 -217
  430. package/src/transform/styles/dataDriven.ts +0 -18
  431. package/src/transform/styles/documentary.ts +0 -18
  432. package/src/transform/styles/index.ts +0 -5
  433. package/src/transform/styles/magazine.ts +0 -19
  434. package/src/transform/styles/minimal.ts +0 -18
  435. package/src/transform/styles/narrative.ts +0 -19
  436. package/src/transform/templateSelector.ts +0 -389
  437. package/src/transform/timingAllocator.ts +0 -257
  438. package/src/transform/types.ts +0 -158
  439. package/src/versions/DocumentVersionManager.ts +0 -70
  440. package/src/versions/gitignore.ts +0 -34
  441. package/src/versions/index.ts +0 -56
  442. package/src/versions/operations.ts +0 -144
  443. package/src/versions/paths.ts +0 -51
  444. package/src/versions/snapshotStore.ts +0 -202
  445. package/src/versions/timestamp.ts +0 -48
  446. package/src/versions/types.ts +0 -93
@@ -0,0 +1,699 @@
1
+ // src/markdown/htmlParse.ts
2
+ import { fromHtml } from "hast-util-from-html";
3
+ var HAST_PROP_TO_ATTR = {
4
+ className: "class",
5
+ htmlFor: "for",
6
+ httpEquiv: "http-equiv",
7
+ acceptCharset: "accept-charset"
8
+ };
9
+ var VOID_ELEMENTS = /* @__PURE__ */ new Set([
10
+ "area",
11
+ "base",
12
+ "br",
13
+ "col",
14
+ "embed",
15
+ "hr",
16
+ "img",
17
+ "input",
18
+ "link",
19
+ "meta",
20
+ "param",
21
+ "source",
22
+ "track",
23
+ "wbr"
24
+ ]);
25
+ function propertyToAttribute(prop) {
26
+ if (HAST_PROP_TO_ATTR[prop]) return HAST_PROP_TO_ATTR[prop];
27
+ if (prop.length > 4 && prop.startsWith("data") && prop[4] >= "A" && prop[4] <= "Z") {
28
+ return "data-" + prop.slice(4).replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^-/, "");
29
+ }
30
+ if (prop.length > 4 && prop.startsWith("aria") && prop[4] >= "A" && prop[4] <= "Z") {
31
+ return "aria-" + prop.slice(4).replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^-/, "");
32
+ }
33
+ return prop.toLowerCase();
34
+ }
35
+ function convertHastProperties(properties) {
36
+ const attrs = {};
37
+ for (const [key, value] of Object.entries(properties)) {
38
+ if (value === false || value === void 0 || value === null) continue;
39
+ const attrName = propertyToAttribute(key);
40
+ if (value === true) {
41
+ attrs[attrName] = "";
42
+ } else if (Array.isArray(value)) {
43
+ attrs[attrName] = value.join(" ");
44
+ } else {
45
+ attrs[attrName] = String(value);
46
+ }
47
+ }
48
+ return attrs;
49
+ }
50
+ function hastChildrenToNodes(children) {
51
+ const result = [];
52
+ for (const child of children) {
53
+ const node = hastNodeToHtmlNode(child);
54
+ if (node) result.push(node);
55
+ }
56
+ return result;
57
+ }
58
+ function hastNodeToHtmlNode(node) {
59
+ switch (node.type) {
60
+ case "element": {
61
+ const tagName = node.tagName;
62
+ const properties = node.properties ?? {};
63
+ const children = node.children ?? [];
64
+ return {
65
+ type: "htmlElement",
66
+ tagName,
67
+ attributes: convertHastProperties(properties),
68
+ children: hastChildrenToNodes(children),
69
+ selfClosing: VOID_ELEMENTS.has(tagName) && children.length === 0
70
+ };
71
+ }
72
+ case "text":
73
+ return {
74
+ type: "htmlText",
75
+ value: node.value
76
+ };
77
+ case "comment":
78
+ return {
79
+ type: "htmlComment",
80
+ value: node.value
81
+ };
82
+ case "doctype":
83
+ return null;
84
+ default:
85
+ return null;
86
+ }
87
+ }
88
+ function parseHtmlToNodes(html) {
89
+ if (!html || !html.trim()) return [];
90
+ try {
91
+ const tree = fromHtml(html, { fragment: true });
92
+ return hastChildrenToNodes(tree.children);
93
+ } catch {
94
+ return [{ type: "htmlText", value: html }];
95
+ }
96
+ }
97
+ function escapeHtmlAttr(value) {
98
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
99
+ }
100
+ function stringifyNode(node) {
101
+ switch (node.type) {
102
+ case "htmlElement": {
103
+ const attrs = Object.entries(node.attributes).map(([k, v]) => v === "" ? k : `${k}="${escapeHtmlAttr(v)}"`).join(" ");
104
+ const open = attrs ? `<${node.tagName} ${attrs}>` : `<${node.tagName}>`;
105
+ if (node.selfClosing) return open;
106
+ const inner = node.children.map(stringifyNode).join("");
107
+ return `${open}${inner}</${node.tagName}>`;
108
+ }
109
+ case "htmlText":
110
+ return node.value;
111
+ case "htmlComment":
112
+ return `<!--${node.value}-->`;
113
+ }
114
+ }
115
+ function stringifyHtmlNodes(nodes) {
116
+ return nodes.map(stringifyNode).join("");
117
+ }
118
+
119
+ // src/markdown/utils.ts
120
+ function getChildren(node) {
121
+ if ("children" in node && Array.isArray(node.children)) {
122
+ return node.children;
123
+ }
124
+ return [];
125
+ }
126
+ function walkMarkdownTree(node, visitor, parent) {
127
+ const skip = visitor(node, parent);
128
+ if (skip === true) return;
129
+ const children = getChildren(node);
130
+ for (const child of children) {
131
+ walkMarkdownTree(child, visitor, node);
132
+ }
133
+ }
134
+ function findNodesByType(root, type) {
135
+ const results = [];
136
+ walkMarkdownTree(root, (node) => {
137
+ if (node.type === type) {
138
+ results.push(node);
139
+ }
140
+ });
141
+ return results;
142
+ }
143
+ function extractPlainText(node) {
144
+ if ("value" in node && typeof node.value === "string") {
145
+ return node.value;
146
+ }
147
+ const children = getChildren(node);
148
+ const separator = node.type === "list" || node.type === "listItem" ? "\n" : "";
149
+ return children.map(extractPlainText).join(separator);
150
+ }
151
+ function countNodes(node) {
152
+ let count = 1;
153
+ const children = getChildren(node);
154
+ for (const child of children) {
155
+ count += countNodes(child);
156
+ }
157
+ return count;
158
+ }
159
+ var YAML_TRUE = /* @__PURE__ */ new Set(["true", "True", "TRUE"]);
160
+ var YAML_FALSE = /* @__PURE__ */ new Set(["false", "False", "FALSE"]);
161
+ var YAML_NULL = /* @__PURE__ */ new Set(["null", "Null", "NULL", "~"]);
162
+ var YAML_CANONICAL_NUMBER_RE = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:e[+-][0-9]+)?$/;
163
+ function isCanonicalNumber(text) {
164
+ return YAML_CANONICAL_NUMBER_RE.test(text) && String(Number(text)) === text;
165
+ }
166
+ function assignKey(map, key, value) {
167
+ Object.defineProperty(map, key, {
168
+ value,
169
+ enumerable: true,
170
+ configurable: true,
171
+ writable: true
172
+ });
173
+ }
174
+ function indentOf(line) {
175
+ return line.length - line.trimStart().length;
176
+ }
177
+ function isSkippableLine(line) {
178
+ const trimmed = line.trim();
179
+ return trimmed === "" || trimmed.startsWith("#");
180
+ }
181
+ function nextSignificant(cur) {
182
+ let j = cur.i;
183
+ while (j < cur.lines.length && isSkippableLine(cur.lines[j])) j++;
184
+ return j;
185
+ }
186
+ function isSequenceItem(content) {
187
+ return content === "-" || content.startsWith("- ");
188
+ }
189
+ function readQuotedScalar(text) {
190
+ const quote = text[0];
191
+ if (quote === '"') {
192
+ for (let i = 1; i < text.length; i++) {
193
+ if (text[i] === "\\") {
194
+ i++;
195
+ continue;
196
+ }
197
+ if (text[i] !== '"') continue;
198
+ const raw = text.slice(0, i + 1);
199
+ try {
200
+ return { value: JSON.parse(raw), rest: text.slice(i + 1) };
201
+ } catch {
202
+ return { value: raw.slice(1, -1), rest: text.slice(i + 1) };
203
+ }
204
+ }
205
+ return null;
206
+ }
207
+ if (quote === "'") {
208
+ let value = "";
209
+ for (let i = 1; i < text.length; i++) {
210
+ if (text[i] !== "'") {
211
+ value += text[i];
212
+ continue;
213
+ }
214
+ if (text[i + 1] === "'") {
215
+ value += "'";
216
+ i++;
217
+ continue;
218
+ }
219
+ return { value, rest: text.slice(i + 1) };
220
+ }
221
+ return null;
222
+ }
223
+ return null;
224
+ }
225
+ function splitMappingKey(content) {
226
+ if (content.startsWith("{") || content.startsWith("[")) return null;
227
+ if (content.startsWith('"') || content.startsWith("'")) {
228
+ const quoted = readQuotedScalar(content);
229
+ if (!quoted) return null;
230
+ const after = quoted.rest;
231
+ if (after === ":" || after.startsWith(": ") || after.startsWith(": ")) {
232
+ return { key: quoted.value, rest: after.slice(1).trim() };
233
+ }
234
+ return null;
235
+ }
236
+ for (let i = 0; i < content.length; i++) {
237
+ if (content[i] !== ":") continue;
238
+ const next = content[i + 1];
239
+ if (next !== void 0 && next !== " " && next !== " ") continue;
240
+ const key = content.slice(0, i).trim();
241
+ if (!key) return null;
242
+ return { key, rest: content.slice(i + 1).trim() };
243
+ }
244
+ const colon = content.indexOf(":");
245
+ if (colon > 0 && content[colon + 1] !== "/") {
246
+ const key = content.slice(0, colon).trim();
247
+ if (key && !key.includes(" ")) return { key, rest: content.slice(colon + 1).trim() };
248
+ }
249
+ return null;
250
+ }
251
+ function foldBlockLines(lines) {
252
+ const parts = [];
253
+ let i = 0;
254
+ while (i < lines.length) {
255
+ const line = lines[i];
256
+ if (line === "") {
257
+ parts.push("\n");
258
+ i++;
259
+ continue;
260
+ }
261
+ if (/^\s/.test(line)) {
262
+ parts.push((parts.length > 0 ? "\n" : "") + line);
263
+ i++;
264
+ continue;
265
+ }
266
+ parts.push(line);
267
+ i++;
268
+ while (i < lines.length && lines[i] !== "" && !/^\s/.test(lines[i])) {
269
+ parts.push(` ${lines[i]}`);
270
+ i++;
271
+ }
272
+ }
273
+ return parts.join("");
274
+ }
275
+ function parseBlockScalar(cur, keyIndent, folded, chomp) {
276
+ const blockLines = [];
277
+ let j = cur.i;
278
+ for (; j < cur.lines.length; j++) {
279
+ const line = cur.lines[j];
280
+ if (line.trim() === "") {
281
+ blockLines.push("");
282
+ continue;
283
+ }
284
+ if (indentOf(line) <= keyIndent) break;
285
+ blockLines.push(line);
286
+ }
287
+ cur.i = j;
288
+ if (chomp !== "+") {
289
+ while (blockLines.length > 0 && blockLines[blockLines.length - 1] === "") blockLines.pop();
290
+ }
291
+ let commonIndent = Infinity;
292
+ for (const line of blockLines) {
293
+ if (line === "") continue;
294
+ commonIndent = Math.min(commonIndent, indentOf(line));
295
+ }
296
+ if (!isFinite(commonIndent)) commonIndent = 0;
297
+ const dedented = blockLines.map((line) => line === "" ? "" : line.slice(commonIndent));
298
+ return folded ? foldBlockLines(dedented) : dedented.join("\n");
299
+ }
300
+ function scalarFromText(text) {
301
+ if (text === "" || YAML_NULL.has(text)) return null;
302
+ if (YAML_TRUE.has(text)) return true;
303
+ if (YAML_FALSE.has(text)) return false;
304
+ if (isCanonicalNumber(text)) return Number(text);
305
+ return text;
306
+ }
307
+ function collectPlainContinuation(cur, keyIndent, first) {
308
+ const parts = [first];
309
+ while (cur.i < cur.lines.length) {
310
+ const line = cur.lines[cur.i];
311
+ if (isSkippableLine(line)) break;
312
+ if (indentOf(line) <= keyIndent) break;
313
+ parts.push(line.trim());
314
+ cur.i++;
315
+ }
316
+ return parts.join(" ");
317
+ }
318
+ function parseValue(cur, keyIndent, inline) {
319
+ const blockScalar = /^([|>])([0-9]*)([+-]?)$/.exec(inline);
320
+ if (blockScalar) {
321
+ return parseBlockScalar(cur, keyIndent, blockScalar[1] === ">", blockScalar[3]);
322
+ }
323
+ if (inline === "") return parseNodeBelowKey(cur, keyIndent);
324
+ if (inline.startsWith('"') || inline.startsWith("'")) {
325
+ const quoted = readQuotedScalar(inline);
326
+ if (quoted && quoted.rest.trim() === "") return quoted.value;
327
+ const quote = inline[0];
328
+ if (inline.length >= 2 && inline.endsWith(quote)) {
329
+ const body = inline.slice(1, -1);
330
+ return quote === "'" ? body.replace(/''/g, "'") : body;
331
+ }
332
+ return inline;
333
+ }
334
+ if (inline === "[]") return [];
335
+ if (inline === "{}") return {};
336
+ if (inline.startsWith("{") || inline.startsWith("[")) return inline;
337
+ return scalarFromText(collectPlainContinuation(cur, keyIndent, inline));
338
+ }
339
+ function parseNodeBelowKey(cur, keyIndent) {
340
+ const j = nextSignificant(cur);
341
+ if (j >= cur.lines.length) return null;
342
+ const line = cur.lines[j];
343
+ const ind = indentOf(line);
344
+ const content = line.slice(ind);
345
+ if (isSequenceItem(content) && ind >= keyIndent) {
346
+ cur.i = j;
347
+ return parseSequence(cur, ind);
348
+ }
349
+ if (ind > keyIndent) {
350
+ cur.i = j;
351
+ if (splitMappingKey(content)) return parseMapping(cur, ind);
352
+ cur.i = j + 1;
353
+ return scalarFromText(collectPlainContinuation(cur, keyIndent, content.trim()));
354
+ }
355
+ return null;
356
+ }
357
+ function parseNodeBelowDash(cur, dashIndent) {
358
+ const j = nextSignificant(cur);
359
+ if (j >= cur.lines.length) return null;
360
+ const line = cur.lines[j];
361
+ const ind = indentOf(line);
362
+ if (ind <= dashIndent) return null;
363
+ const content = line.slice(ind);
364
+ cur.i = j;
365
+ if (isSequenceItem(content)) return parseSequence(cur, ind);
366
+ if (splitMappingKey(content)) return parseMapping(cur, ind);
367
+ cur.i = j + 1;
368
+ return scalarFromText(collectPlainContinuation(cur, dashIndent, content.trim()));
369
+ }
370
+ function parseSequence(cur, indent) {
371
+ const items = [];
372
+ for (; ; ) {
373
+ const j = nextSignificant(cur);
374
+ if (j >= cur.lines.length) {
375
+ cur.i = j;
376
+ break;
377
+ }
378
+ const line = cur.lines[j];
379
+ const ind = indentOf(line);
380
+ if (ind !== indent) break;
381
+ const content = line.slice(ind);
382
+ if (!isSequenceItem(content)) break;
383
+ const afterDash = content.slice(1);
384
+ const itemText = afterDash.trimStart();
385
+ if (itemText === "") {
386
+ cur.i = j + 1;
387
+ items.push(parseNodeBelowDash(cur, ind));
388
+ continue;
389
+ }
390
+ const itemCol = ind + 1 + (afterDash.length - itemText.length);
391
+ const entry = splitMappingKey(itemText);
392
+ if (entry) {
393
+ cur.lines[j] = " ".repeat(itemCol) + itemText;
394
+ cur.i = j;
395
+ items.push(parseMapping(cur, itemCol));
396
+ continue;
397
+ }
398
+ cur.i = j + 1;
399
+ items.push(parseValue(cur, ind, itemText));
400
+ }
401
+ return items;
402
+ }
403
+ function parseMapping(cur, indent) {
404
+ const map = {};
405
+ for (; ; ) {
406
+ const j = nextSignificant(cur);
407
+ if (j >= cur.lines.length) {
408
+ cur.i = j;
409
+ break;
410
+ }
411
+ const line = cur.lines[j];
412
+ const ind = indentOf(line);
413
+ if (ind !== indent) break;
414
+ const content = line.slice(ind);
415
+ if (isSequenceItem(content)) break;
416
+ const entry = splitMappingKey(content);
417
+ if (!entry) break;
418
+ cur.i = j + 1;
419
+ assignKey(map, entry.key, parseValue(cur, indent, entry.rest));
420
+ }
421
+ return map;
422
+ }
423
+ function parseFrontmatter(yaml) {
424
+ if (!yaml || !yaml.trim()) return null;
425
+ const cur = { lines: yaml.replace(/\r\n?/g, "\n").split("\n"), i: 0 };
426
+ const result = {};
427
+ for (; ; ) {
428
+ const j = nextSignificant(cur);
429
+ if (j >= cur.lines.length) break;
430
+ cur.i = j;
431
+ const map = parseMapping(cur, indentOf(cur.lines[j]));
432
+ for (const [key, value] of Object.entries(map)) assignKey(result, key, value);
433
+ if (cur.i <= j) cur.i = j + 1;
434
+ }
435
+ return Object.keys(result).length > 0 ? result : null;
436
+ }
437
+ function formatBlockScalar(value) {
438
+ const body = value.split("\n").map((line) => line === "" ? "" : ` ${line}`).join("\n");
439
+ return `|-
440
+ ${body}`;
441
+ }
442
+ var FRONTMATTER_BLOCK_RE = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n)?/;
443
+ function formatFrontmatterValue(value) {
444
+ if (typeof value === "boolean" || typeof value === "number") return String(value);
445
+ if (/[\r\n]/.test(value)) return formatBlockScalar(value.replace(/\r\n?/g, "\n"));
446
+ if (value !== "[]" && value !== "{}" && /^[{[]/.test(value)) return value;
447
+ const needsQuote = /^\s|\s$/.test(value) || /^[!&*?|>%@`~]/.test(value) || /[:#]/.test(value) || value === "" || value === "[]" || value === "{}" || YAML_TRUE.has(value) || YAML_FALSE.has(value) || YAML_NULL.has(value) || value !== "" && !Number.isNaN(Number(value)) || /^["']/.test(value) && /["']$/.test(value);
448
+ if (!needsQuote) return value;
449
+ const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
450
+ return `"${escaped}"`;
451
+ }
452
+ function formatFrontmatterKey(key) {
453
+ return /^[A-Za-z0-9_](?:[A-Za-z0-9 _.-]*[A-Za-z0-9_.-])?$/.test(key) ? key : formatFrontmatterValue(key);
454
+ }
455
+ function isPlainRecord(value) {
456
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
457
+ const proto = Object.getPrototypeOf(value);
458
+ return proto === Object.prototype || proto === null;
459
+ }
460
+ function isOmittedValue(value) {
461
+ return value === void 0 || typeof value === "function" || typeof value === "symbol";
462
+ }
463
+ function toScalar(value) {
464
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
465
+ return value;
466
+ }
467
+ if (value instanceof Date) return value.toISOString();
468
+ return String(value);
469
+ }
470
+ function pushScalar(out, pad, prefix, value) {
471
+ const formatted = formatFrontmatterValue(toScalar(value));
472
+ if (!formatted.includes("\n")) {
473
+ out.push(`${pad}${prefix}${formatted}`);
474
+ return;
475
+ }
476
+ const [head, ...body] = formatted.split("\n");
477
+ out.push(`${pad}${prefix}${head}`);
478
+ for (const line of body) out.push(line === "" ? "" : `${pad}${line}`);
479
+ }
480
+ function emitSequence(items, indent, out) {
481
+ const pad = " ".repeat(indent);
482
+ for (const item of items) {
483
+ if (item === null || isOmittedValue(item)) {
484
+ out.push(`${pad}- null`);
485
+ continue;
486
+ }
487
+ if (Array.isArray(item)) {
488
+ if (item.length === 0) {
489
+ out.push(`${pad}- []`);
490
+ continue;
491
+ }
492
+ out.push(`${pad}-`);
493
+ emitSequence(item, indent + 2, out);
494
+ continue;
495
+ }
496
+ if (isPlainRecord(item)) {
497
+ const sub = [];
498
+ emitMapping(item, indent + 2, sub);
499
+ if (sub.length === 0) {
500
+ out.push(`${pad}- {}`);
501
+ continue;
502
+ }
503
+ sub[0] = `${pad}- ${sub[0].slice(indent + 2)}`;
504
+ out.push(...sub);
505
+ continue;
506
+ }
507
+ pushScalar(out, pad, "- ", item);
508
+ }
509
+ }
510
+ function emitMapping(map, indent, out) {
511
+ const pad = " ".repeat(indent);
512
+ for (const [rawKey, value] of Object.entries(map)) {
513
+ if (isOmittedValue(value)) continue;
514
+ const key = formatFrontmatterKey(rawKey);
515
+ if (value === null) {
516
+ out.push(`${pad}${key}: null`);
517
+ continue;
518
+ }
519
+ if (Array.isArray(value)) {
520
+ if (value.length === 0) {
521
+ out.push(`${pad}${key}: []`);
522
+ continue;
523
+ }
524
+ out.push(`${pad}${key}:`);
525
+ emitSequence(value, indent + 2, out);
526
+ continue;
527
+ }
528
+ if (isPlainRecord(value)) {
529
+ const sub = [];
530
+ emitMapping(value, indent + 2, sub);
531
+ if (sub.length === 0) {
532
+ out.push(`${pad}${key}: {}`);
533
+ continue;
534
+ }
535
+ out.push(`${pad}${key}:`);
536
+ out.push(...sub);
537
+ continue;
538
+ }
539
+ pushScalar(out, pad, `${key}: `, value);
540
+ }
541
+ }
542
+ function formatFrontmatterYaml(frontmatter) {
543
+ const out = [];
544
+ emitMapping(frontmatter, 0, out);
545
+ return out.join("\n");
546
+ }
547
+ function setFrontmatterValues(source, updates) {
548
+ const updateKeys = Object.keys(updates);
549
+ if (updateKeys.length === 0) return source;
550
+ const match = source.match(FRONTMATTER_BLOCK_RE);
551
+ const handled = /* @__PURE__ */ new Set();
552
+ if (match) {
553
+ const inner = match[1];
554
+ const lines = inner.split(/\r?\n/);
555
+ const newLines = [];
556
+ const firstSignificant = lines.find((line) => !isSkippableLine(line));
557
+ const rootIndent = firstSignificant === void 0 ? 0 : indentOf(firstSignificant);
558
+ let i = 0;
559
+ while (i < lines.length) {
560
+ const line = lines[i];
561
+ const ind = indentOf(line);
562
+ const entry = isSkippableLine(line) || ind !== rootIndent ? null : splitMappingKey(line.slice(ind));
563
+ if (!entry) {
564
+ newLines.push(line);
565
+ i++;
566
+ continue;
567
+ }
568
+ let end = i + 1;
569
+ while (end < lines.length) {
570
+ if (lines[end].trim() === "") {
571
+ let probe = end;
572
+ while (probe < lines.length && lines[probe].trim() === "") probe++;
573
+ if (probe < lines.length && indentOf(lines[probe]) > rootIndent) {
574
+ end = probe;
575
+ continue;
576
+ }
577
+ break;
578
+ }
579
+ if (indentOf(lines[end]) <= rootIndent) break;
580
+ end++;
581
+ }
582
+ if (!Object.prototype.hasOwnProperty.call(updates, entry.key)) {
583
+ for (let k = i; k < end; k++) newLines.push(lines[k]);
584
+ i = end;
585
+ continue;
586
+ }
587
+ handled.add(entry.key);
588
+ const next = updates[entry.key];
589
+ if (next !== null && next !== void 0) {
590
+ pushScalar(newLines, " ".repeat(rootIndent), `${formatFrontmatterKey(entry.key)}: `, next);
591
+ }
592
+ i = end;
593
+ }
594
+ for (const key of updateKeys) {
595
+ if (handled.has(key)) continue;
596
+ const next = updates[key];
597
+ if (next === null || next === void 0) continue;
598
+ pushScalar(newLines, "", `${formatFrontmatterKey(key)}: `, next);
599
+ }
600
+ const nonEmpty = newLines.filter((l) => l.trim().length > 0);
601
+ const rest = source.slice(match[0].length);
602
+ if (nonEmpty.length === 0) return rest;
603
+ return `---
604
+ ${newLines.join("\n")}
605
+ ---
606
+ ${rest}`;
607
+ }
608
+ const fresh = [];
609
+ for (const key of updateKeys) {
610
+ const next = updates[key];
611
+ if (next === null || next === void 0) continue;
612
+ pushScalar(fresh, "", `${formatFrontmatterKey(key)}: `, next);
613
+ }
614
+ if (fresh.length === 0) return source;
615
+ return `---
616
+ ${fresh.join("\n")}
617
+ ---
618
+ ${source}`;
619
+ }
620
+ function createDocument(...children) {
621
+ return {
622
+ type: "document",
623
+ children
624
+ };
625
+ }
626
+ function inferDocumentTitle(doc) {
627
+ const fmTitle = doc.frontmatter?.title;
628
+ if (typeof fmTitle === "string") {
629
+ const trimmed = fmTitle.trim();
630
+ if (trimmed) return trimmed;
631
+ }
632
+ let best = null;
633
+ for (const node of doc.children) {
634
+ if (node.type !== "heading") continue;
635
+ const text = extractPlainText(node).trim();
636
+ if (!text) continue;
637
+ if (best === null || node.depth < best.depth) {
638
+ best = { depth: node.depth, text };
639
+ if (best.depth === 1) break;
640
+ }
641
+ }
642
+ return best?.text;
643
+ }
644
+ function readFrontmatterThemeId(frontmatter) {
645
+ if (!frontmatter) return void 0;
646
+ const keys = ["squisq-theme", "themeId", "theme"];
647
+ for (const key of keys) {
648
+ const raw = frontmatter[key];
649
+ if (typeof raw === "string") {
650
+ const trimmed = raw.trim();
651
+ if (trimmed) return trimmed;
652
+ }
653
+ }
654
+ return void 0;
655
+ }
656
+ function plainTextFromInlineHtml(html) {
657
+ const BLOCK = /* @__PURE__ */ new Set([
658
+ "p",
659
+ "div",
660
+ "h1",
661
+ "h2",
662
+ "h3",
663
+ "h4",
664
+ "h5",
665
+ "h6",
666
+ "li",
667
+ "blockquote",
668
+ "pre"
669
+ ]);
670
+ const walk = (nodes) => nodes.map((n) => {
671
+ if (n.type === "htmlText") return n.value;
672
+ if (n.type !== "htmlElement") return "";
673
+ const tag = n.tagName.toLowerCase();
674
+ if (tag === "br") return "\n";
675
+ const inner = walk(n.children);
676
+ return BLOCK.has(tag) ? `${inner}
677
+ ` : inner;
678
+ }).join("");
679
+ return walk(parseHtmlToNodes(html)).replace(/\u00A0/g, " ").replace(/\n{3,}/g, "\n\n").trim();
680
+ }
681
+
682
+ export {
683
+ parseHtmlToNodes,
684
+ stringifyHtmlNodes,
685
+ getChildren,
686
+ walkMarkdownTree,
687
+ findNodesByType,
688
+ extractPlainText,
689
+ countNodes,
690
+ parseFrontmatter,
691
+ formatBlockScalar,
692
+ formatFrontmatterValue,
693
+ formatFrontmatterYaml,
694
+ setFrontmatterValues,
695
+ createDocument,
696
+ inferDocumentTitle,
697
+ readFrontmatterThemeId,
698
+ plainTextFromInlineHtml
699
+ };