@jant/core 1.0.0 → 1.0.1

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 (1482) hide show
  1. package/README.md +11 -13
  2. package/bin/commands/assets/prepare.js +3 -3
  3. package/bin/commands/assets/upload.js +192 -15
  4. package/bin/commands/db/execute-file.js +12 -4
  5. package/bin/commands/db/export.js +115 -2
  6. package/bin/commands/db/rehearse.js +2 -2
  7. package/bin/commands/deploy.js +190 -3
  8. package/bin/commands/migrate.js +91 -69
  9. package/bin/commands/posts/rebuild-html.js +184 -0
  10. package/bin/commands/reset-password.js +30 -17
  11. package/bin/commands/search/reindex.js +175 -0
  12. package/bin/commands/setup.js +138 -0
  13. package/bin/commands/site/export.js +146 -285
  14. package/bin/commands/site/import.js +3164 -2
  15. package/bin/commands/site/pull-media.js +5 -8
  16. package/bin/commands/site/snapshot/export.js +79 -106
  17. package/bin/commands/site/snapshot/import.js +141 -84
  18. package/bin/commands/start.js +72 -1
  19. package/bin/commands/telegram/register-webhooks.js +124 -0
  20. package/bin/commands/uploads/cleanup.js +48 -7
  21. package/bin/jant.js +91 -33
  22. package/bin/lib/cloudflare-setup.js +499 -0
  23. package/bin/lib/command-registry.js +120 -0
  24. package/bin/lib/d1-query.js +139 -22
  25. package/bin/lib/hugo-markdown.js +106 -0
  26. package/bin/lib/import-sources.js +151 -0
  27. package/bin/lib/migration-artifacts.js +19 -0
  28. package/bin/lib/migration-rehearsal.js +27 -0
  29. package/bin/lib/migration-runner.js +29 -7
  30. package/bin/lib/node-database.js +32 -0
  31. package/bin/lib/node-env.js +141 -0
  32. package/bin/lib/r2-query.js +2 -2
  33. package/bin/lib/renamed-arguments.js +56 -0
  34. package/bin/lib/runtime-target.js +64 -0
  35. package/bin/lib/site-pull-media.js +78 -36
  36. package/bin/lib/site-selection.js +98 -73
  37. package/bin/lib/site-snapshot.js +968 -86
  38. package/bin/lib/sql-export.js +154 -18
  39. package/bin/lib/thread-collection-migration.js +326 -0
  40. package/bin/lib/wrangler-cli.js +37 -2
  41. package/bin/lib/wrangler-json.js +35 -0
  42. package/bin/lib/zip-archive.js +187 -0
  43. package/dist/app-Gt7_skt6.js +114115 -0
  44. package/dist/client/.vite/manifest.json +255 -90
  45. package/dist/client/_assets/chunks/confirm-D7GrwsCN.js +45 -0
  46. package/dist/client/_assets/chunks/create-editor-5Y49x7h5.js +261 -0
  47. package/dist/client/_assets/chunks/emoji-mart-C4RpRKcU.js +716 -0
  48. package/dist/client/_assets/chunks/footnote-rail-BJwswtVQ.js +1 -0
  49. package/dist/client/_assets/chunks/heic-to-CuP2Qlsw.js +1 -0
  50. package/dist/client/_assets/chunks/jant-locale-picker-DL6mIOT5.js +69 -0
  51. package/dist/client/_assets/chunks/lit-DW8VmJAT.js +2 -0
  52. package/dist/client/_assets/chunks/mediabunny-DRaCQ1r-.js +31 -0
  53. package/dist/client/_assets/chunks/rolldown-runtime-hePW80VL.js +1 -0
  54. package/dist/client/_assets/chunks/settings-paths-h6RjIe3C.js +84 -0
  55. package/dist/client/_assets/chunks/site-header-nav-DzXsFk05.js +1 -0
  56. package/dist/client/_assets/chunks/slug-format-Dsi0e9Xn.js +1 -0
  57. package/dist/client/_assets/chunks/slugify-DlHLyUHS.js +1 -0
  58. package/dist/client/_assets/chunks/sortable-list-DWNKv782.js +2 -0
  59. package/dist/client/_assets/chunks/types-D5iF3H1a.js +1 -0
  60. package/dist/client/_assets/chunks/unsafe-html-B5ZEXaxg.js +1 -0
  61. package/dist/client/_assets/chunks/unsafe-svg-DTZZEvLU.js +2 -0
  62. package/dist/client/_assets/client-BaqmpPQ-.css +2 -0
  63. package/dist/client/_assets/client-C6melOtG.js +296 -0
  64. package/dist/client/_assets/client-auth-Ccq8kSqq.js +828 -0
  65. package/dist/client/_assets/client-author-CGVvrNZ8.css +2 -0
  66. package/dist/client/_assets/client-compose-oxzPb3SS.js +2004 -0
  67. package/dist/client/_assets/client-manage-C1eDB1Rc.js +2170 -0
  68. package/dist/client/_assets/client-settings-DIM44Zqh.js +1112 -0
  69. package/dist/constants-DEgyqWDl.js +767 -0
  70. package/dist/index.d.ts +44 -0
  71. package/dist/index.js +26 -80
  72. package/dist/node.js +185 -22
  73. package/package.json +55 -50
  74. package/src/app.tsx +204 -132
  75. package/src/auth.ts +18 -1
  76. package/src/client/archive-nav.js +2 -1
  77. package/src/client/audio-player.ts +7 -3
  78. package/src/client/audio-processor.ts +24 -15
  79. package/src/client/audio-waveform.ts +49 -0
  80. package/src/client/avatar-upload.ts +10 -10
  81. package/src/client/collection-dialog-host.ts +72 -0
  82. package/src/client/collection-navigation.ts +79 -0
  83. package/src/client/collection-page-actions.ts +83 -1
  84. package/src/client/components/collection-dialog-types.ts +49 -0
  85. package/src/client/components/collection-manager-types.ts +41 -6
  86. package/src/client/components/collection-types.ts +1 -15
  87. package/src/client/components/compose-format-convert.ts +259 -0
  88. package/src/client/components/compose-title-from-heading.ts +66 -0
  89. package/src/client/components/compose-types.ts +162 -2
  90. package/src/client/components/inline-image-issues.ts +17 -0
  91. package/src/client/components/jant-collection-dialog.ts +722 -0
  92. package/src/client/components/jant-collection-directory.ts +673 -175
  93. package/src/client/components/jant-collection-form.ts +54 -232
  94. package/src/client/components/jant-command-palette.ts +235 -78
  95. package/src/client/components/jant-compose-dialog.ts +3084 -1210
  96. package/src/client/components/jant-compose-editor.ts +1277 -422
  97. package/src/client/components/jant-compose-fullscreen.ts +81 -50
  98. package/src/client/components/jant-config-editor.ts +732 -0
  99. package/src/client/components/jant-confirm-dialog.ts +13 -11
  100. package/src/client/components/jant-locale-picker.ts +418 -0
  101. package/src/client/components/jant-media-lightbox.ts +376 -131
  102. package/src/client/components/jant-nav-manager.ts +2260 -473
  103. package/src/client/components/jant-post-menu.ts +1237 -330
  104. package/src/client/components/jant-post-picker.ts +324 -0
  105. package/src/client/components/jant-repo-picker-types.ts +6 -1
  106. package/src/client/components/jant-repo-picker.ts +140 -108
  107. package/src/client/components/jant-settings-avatar.ts +31 -27
  108. package/src/client/components/jant-settings-general.ts +659 -330
  109. package/src/client/components/jant-settings-language.ts +1087 -0
  110. package/src/client/components/jant-smart-collection-dialog.ts +1018 -0
  111. package/src/client/components/jant-text-preview.ts +117 -115
  112. package/src/client/components/nav-manager-types.ts +128 -13
  113. package/src/client/components/settings-types.ts +46 -20
  114. package/src/client/components/smart-collection-conditions.ts +285 -0
  115. package/src/client/components/smart-collection-dialog-types.ts +68 -0
  116. package/src/client/compose-bridge.ts +465 -255
  117. package/src/client/compose-launch.ts +119 -17
  118. package/src/client/compose-shortcuts.ts +53 -8
  119. package/src/client/compose-triggers.ts +50 -0
  120. package/src/client/copy-field.ts +108 -0
  121. package/src/client/custom-url-menu.ts +60 -4
  122. package/src/client/feed-video-player.ts +63 -3
  123. package/src/client/footnote-rail.ts +478 -0
  124. package/src/client/hydrate-partial.ts +27 -0
  125. package/src/client/icons.ts +13 -0
  126. package/src/client/image-plan.ts +165 -0
  127. package/src/client/image-processor.ts +223 -86
  128. package/src/client/image-worker-client.ts +45 -0
  129. package/src/client/image-worker.ts +135 -0
  130. package/src/client/json.ts +56 -2
  131. package/src/client/lazy-entries.ts +95 -0
  132. package/src/client/lazy-slugify.ts +2 -2
  133. package/src/client/media-lightbox-events.ts +63 -0
  134. package/src/client/media-scroll-hint.ts +103 -9
  135. package/src/client/mediabunny.ts +29 -0
  136. package/src/client/note-expand.ts +63 -0
  137. package/src/client/palette-search-trigger.ts +35 -0
  138. package/src/client/post-picker.ts +41 -0
  139. package/src/client/post-refresh.ts +135 -0
  140. package/src/client/random-uuid.ts +23 -0
  141. package/src/client/runtime-paths.ts +74 -1
  142. package/src/client/settings-bridge.ts +4 -7
  143. package/src/client/site-header-fragment.ts +38 -0
  144. package/src/client/site-header-nav.d.ts +1 -0
  145. package/src/client/site-header-nav.js +122 -52
  146. package/src/client/slash-discovery-bridge.ts +9 -0
  147. package/src/client/slash-discovery.ts +200 -0
  148. package/src/client/smart-collection-dialog-host.ts +116 -0
  149. package/src/client/smart-collection-page-actions.ts +208 -0
  150. package/src/client/thread-context.ts +115 -110
  151. package/src/client/tiptap/bubble-menu.ts +173 -46
  152. package/src/client/tiptap/continuous-lists.ts +102 -0
  153. package/src/client/tiptap/create-editor.ts +13 -0
  154. package/src/client/tiptap/extensions.ts +30 -16
  155. package/src/client/tiptap/floating-position.ts +216 -2
  156. package/src/client/tiptap/footnotes.ts +156 -0
  157. package/src/client/tiptap/image-input-rules.ts +48 -0
  158. package/src/client/tiptap/image-node.ts +189 -7
  159. package/src/client/tiptap/inline-image-upload.ts +180 -52
  160. package/src/client/tiptap/insert-paragraph-around.ts +79 -0
  161. package/src/client/tiptap/link-input-rules.ts +4 -4
  162. package/src/client/tiptap/link-toolbar.ts +85 -31
  163. package/src/client/tiptap/markdown-clipboard.ts +663 -13
  164. package/src/client/tiptap/paste-media.ts +49 -33
  165. package/src/client/tiptap/rehost-images.ts +108 -0
  166. package/src/client/tiptap/slash-commands.ts +13 -1
  167. package/src/client/tiptap/structural-keymap.ts +322 -0
  168. package/src/client/tiptap/tab-indent.ts +8 -22
  169. package/src/client/tiptap/table-control-labels.ts +30 -0
  170. package/src/client/tiptap/table-controls.ts +537 -0
  171. package/src/client/tiptap/table-size-picker.ts +254 -0
  172. package/src/client/tiptap/toolbar-mode.ts +0 -43
  173. package/src/client/toast.ts +156 -22
  174. package/src/client/types/vite-worker.d.ts +12 -0
  175. package/src/client/upload-session.ts +99 -44
  176. package/src/client/upload-with-metadata.ts +3 -13
  177. package/src/client/video-processor.ts +360 -107
  178. package/src/client-auth.ts +15 -30
  179. package/src/client-compose.ts +19 -0
  180. package/src/client-manage.ts +13 -0
  181. package/src/client-settings.ts +14 -0
  182. package/src/client-site.ts +10 -3
  183. package/src/client.ts +9 -0
  184. package/src/db/backfills/0004_register_apple_touch_media_rows.sql +65 -0
  185. package/src/db/backfills/0005_split_thread_activity_from_quiet_replies.sql +68 -0
  186. package/src/db/backfills/0006_clear_mirrored_page_nav_labels.sql +31 -0
  187. package/src/db/backfills/0007_restore_external_redirect_scheme.sql +20 -0
  188. package/src/db/backfills/0008_turn_off_featured_only_discover.sql +11 -0
  189. package/src/db/migration-status.ts +92 -0
  190. package/src/db/migrations/0018_yummy_franklin_richards.sql +6 -0
  191. package/src/db/migrations/0019_bored_magus.sql +2 -0
  192. package/src/db/migrations/0020_free_zaladane.sql +1 -0
  193. package/src/db/migrations/0021_thankful_phalanx.sql +16 -0
  194. package/src/db/migrations/0022_old_gressill.sql +24 -0
  195. package/src/db/migrations/0023_broad_terror.sql +20 -0
  196. package/src/db/migrations/0024_red_the_twelve.sql +3 -0
  197. package/src/db/migrations/0025_exotic_wendell_rand.sql +1 -0
  198. package/src/db/migrations/0026_absent_rhodey.sql +14 -0
  199. package/src/db/migrations/0027_old_blue_blade.sql +39 -0
  200. package/src/db/migrations/0028_superb_post.sql +2 -0
  201. package/src/db/migrations/0029_boring_magma.sql +1 -0
  202. package/src/db/migrations/0030_typical_vivisector.sql +50 -0
  203. package/src/db/migrations/0031_many_ego.sql +3 -0
  204. package/src/db/migrations/0032_married_tomas.sql +3 -0
  205. package/src/db/migrations/0033_busy_johnny_storm.sql +198 -0
  206. package/src/db/migrations/0034_cheerful_rumiko_fujikawa.sql +35 -0
  207. package/src/db/migrations/meta/0018_snapshot.json +2225 -0
  208. package/src/db/migrations/meta/0019_snapshot.json +2238 -0
  209. package/src/db/migrations/meta/0020_snapshot.json +2129 -0
  210. package/src/db/migrations/meta/0021_snapshot.json +2121 -0
  211. package/src/db/migrations/meta/0022_snapshot.json +2267 -0
  212. package/src/db/migrations/meta/0023_snapshot.json +2396 -0
  213. package/src/db/migrations/meta/0024_snapshot.json +2417 -0
  214. package/src/db/migrations/meta/0025_snapshot.json +2424 -0
  215. package/src/db/migrations/meta/0026_snapshot.json +2511 -0
  216. package/src/db/migrations/meta/0027_snapshot.json +2511 -0
  217. package/src/db/migrations/meta/0028_snapshot.json +2511 -0
  218. package/src/db/migrations/meta/0029_snapshot.json +2519 -0
  219. package/src/db/migrations/meta/0030_snapshot.json +2541 -0
  220. package/src/db/migrations/meta/0031_snapshot.json +2562 -0
  221. package/src/db/migrations/meta/0032_snapshot.json +2582 -0
  222. package/src/db/migrations/meta/0033_snapshot.json +2816 -0
  223. package/src/db/migrations/meta/0034_snapshot.json +2816 -0
  224. package/src/db/migrations/meta/_journal.json +120 -1
  225. package/src/db/migrations/pg/0016_familiar_lionheart.sql +6 -0
  226. package/src/db/migrations/pg/0017_bright_beyonder.sql +2 -0
  227. package/src/db/migrations/pg/0018_red_warlock.sql +1 -0
  228. package/src/db/migrations/pg/0019_gray_natasha_romanoff.sql +20 -0
  229. package/src/db/migrations/pg/0020_bizarre_smasher.sql +24 -0
  230. package/src/db/migrations/pg/0021_sharp_puppet_master.sql +20 -0
  231. package/src/db/migrations/pg/0022_blushing_blue_shield.sql +3 -0
  232. package/src/db/migrations/pg/0023_organic_zemo.sql +1 -0
  233. package/src/db/migrations/pg/0024_high_violations.sql +14 -0
  234. package/src/db/migrations/pg/0025_moaning_epoch.sql +39 -0
  235. package/src/db/migrations/pg/0026_talented_killer_shrike.sql +2 -0
  236. package/src/db/migrations/pg/0027_short_cannonball.sql +1 -0
  237. package/src/db/migrations/pg/0028_perfect_sharon_carter.sql +27 -0
  238. package/src/db/migrations/pg/0029_rare_hairball.sql +3 -0
  239. package/src/db/migrations/pg/0030_abandoned_nighthawk.sql +3 -0
  240. package/src/db/migrations/pg/0031_strong_ultimatum.sql +128 -0
  241. package/src/db/migrations/pg/0032_furry_multiple_man.sql +6 -0
  242. package/src/db/migrations/pg/meta/0016_snapshot.json +2840 -0
  243. package/src/db/migrations/pg/meta/0017_snapshot.json +2862 -0
  244. package/src/db/migrations/pg/meta/0018_snapshot.json +2739 -0
  245. package/src/db/migrations/pg/meta/0019_snapshot.json +2718 -0
  246. package/src/db/migrations/pg/meta/0020_snapshot.json +2904 -0
  247. package/src/db/migrations/pg/meta/0021_snapshot.json +3060 -0
  248. package/src/db/migrations/pg/meta/0022_snapshot.json +3078 -0
  249. package/src/db/migrations/pg/meta/0023_snapshot.json +3084 -0
  250. package/src/db/migrations/pg/meta/0024_snapshot.json +3204 -0
  251. package/src/db/migrations/pg/meta/0025_snapshot.json +3204 -0
  252. package/src/db/migrations/pg/meta/0026_snapshot.json +3204 -0
  253. package/src/db/migrations/pg/meta/0027_snapshot.json +3211 -0
  254. package/src/db/migrations/pg/meta/0028_snapshot.json +3248 -0
  255. package/src/db/migrations/pg/meta/0029_snapshot.json +3289 -0
  256. package/src/db/migrations/pg/meta/0030_snapshot.json +3329 -0
  257. package/src/db/migrations/pg/meta/0031_snapshot.json +3660 -0
  258. package/src/db/migrations/pg/meta/0032_snapshot.json +3660 -0
  259. package/src/db/migrations/pg/meta/_journal.json +120 -1
  260. package/src/db/pg/node.ts +30 -0
  261. package/src/db/pg/schema.ts +399 -100
  262. package/src/db/post-visibility.ts +117 -0
  263. package/src/db/rehearsal-fixtures/pg-v0.3.39.json +159 -0
  264. package/src/db/rehearsal-fixtures/pg-v0.3.39.sql +78 -0
  265. package/src/db/rehearsal-fixtures/pinned-reply-memberships.json +60 -0
  266. package/src/db/rehearsal-fixtures/pinned-reply-memberships.sql +304 -0
  267. package/src/db/rehearsal-fixtures/v0.3.39.json +170 -0
  268. package/src/db/rehearsal-fixtures/v0.3.39.sql +78 -0
  269. package/src/db/schema.ts +437 -103
  270. package/src/db/thread-activity.ts +101 -0
  271. package/src/i18n/context.tsx +12 -2
  272. package/src/i18n/coverage.generated.ts +17 -0
  273. package/src/i18n/detect.ts +18 -68
  274. package/src/i18n/i18n.ts +18 -2
  275. package/src/i18n/index.ts +3 -0
  276. package/src/i18n/locales/glossary.zh-Hans.yml +44 -4
  277. package/src/i18n/locales/glossary.zh-Hant.yml +44 -4
  278. package/src/i18n/locales/public/en.po +832 -259
  279. package/src/i18n/locales/public/en.ts +1 -1
  280. package/src/i18n/locales/public/zh-Hans.po +818 -244
  281. package/src/i18n/locales/public/zh-Hans.ts +1 -1
  282. package/src/i18n/locales/public/zh-Hant.po +818 -244
  283. package/src/i18n/locales/public/zh-Hant.ts +1 -1
  284. package/src/i18n/locales/settings/en.po +1537 -104
  285. package/src/i18n/locales/settings/en.ts +1 -1
  286. package/src/i18n/locales/settings/zh-Hans.po +1585 -152
  287. package/src/i18n/locales/settings/zh-Hans.ts +1 -1
  288. package/src/i18n/locales/settings/zh-Hant.po +1588 -155
  289. package/src/i18n/locales/settings/zh-Hant.ts +1 -1
  290. package/src/i18n/locales.ts +178 -2
  291. package/src/i18n/middleware.ts +45 -17
  292. package/src/i18n/supported-locales.ts +234 -0
  293. package/src/index.ts +46 -80
  294. package/src/lib/address.ts +57 -0
  295. package/src/lib/api-collections.ts +173 -0
  296. package/src/lib/api-custom-urls.ts +44 -0
  297. package/src/lib/api-media.ts +66 -15
  298. package/src/lib/api-nav-items.ts +62 -0
  299. package/src/lib/api-post-input.ts +156 -0
  300. package/src/lib/api-posts.ts +343 -39
  301. package/src/lib/api-public-posts.ts +243 -0
  302. package/src/lib/api-search.ts +53 -2
  303. package/src/lib/api-settings.ts +387 -55
  304. package/src/lib/api-threads.ts +230 -0
  305. package/src/lib/asset-path.ts +98 -1
  306. package/src/lib/build-env.ts +16 -0
  307. package/src/lib/collection-groups.ts +5 -1
  308. package/src/lib/collection-paths.ts +3 -10
  309. package/src/lib/collection-sort.ts +78 -5
  310. package/src/lib/constants.ts +74 -3
  311. package/src/lib/copy-field.ts +36 -0
  312. package/src/lib/crypto.ts +40 -0
  313. package/src/lib/csp-builder.ts +30 -11
  314. package/src/lib/deferred.ts +79 -0
  315. package/src/lib/discover-ping.ts +141 -0
  316. package/src/lib/discover.ts +457 -0
  317. package/src/lib/env-values.ts +140 -0
  318. package/src/lib/env.ts +381 -11
  319. package/src/lib/errors.ts +33 -7
  320. package/src/lib/feed-path.ts +31 -0
  321. package/src/lib/feed-policy.ts +401 -0
  322. package/src/lib/feed.ts +1311 -66
  323. package/src/lib/filter-dimensions.ts +1356 -0
  324. package/src/lib/footnotes.ts +264 -0
  325. package/src/lib/github-sync-repo-name.ts +45 -0
  326. package/src/lib/github-sync-site-config.ts +10 -4
  327. package/src/lib/github-sync-status.tsx +87 -0
  328. package/src/lib/github-sync-trigger.ts +7 -51
  329. package/src/lib/hosted-domain-check.ts +21 -80
  330. package/src/lib/hosted-domain.ts +1 -1
  331. package/src/lib/hosted-signin.ts +10 -4
  332. package/src/lib/http-cache.ts +148 -0
  333. package/src/lib/hugo-markdown.ts +83 -10
  334. package/src/lib/icons.ts +126 -20
  335. package/src/lib/ids.ts +138 -8
  336. package/src/lib/image-dimensions.ts +258 -0
  337. package/src/lib/image.ts +17 -4
  338. package/src/lib/jant-branding.ts +1 -0
  339. package/src/lib/jant-docs.ts +42 -0
  340. package/src/lib/lang-detect.ts +308 -0
  341. package/src/lib/link-preview.ts +25 -0
  342. package/src/lib/markdown-manager.ts +598 -11
  343. package/src/lib/markdown.ts +10 -3
  344. package/src/lib/media-helpers.ts +13 -1
  345. package/src/lib/mp4-track-flags.ts +71 -0
  346. package/src/lib/navigation.ts +103 -37
  347. package/src/lib/pagination.ts +28 -24
  348. package/src/lib/per-language-surfaces.ts +67 -0
  349. package/src/lib/post-body-html.ts +138 -0
  350. package/src/lib/post-display.ts +147 -21
  351. package/src/lib/post-list-cursor.ts +221 -0
  352. package/src/lib/post-meta.ts +39 -2
  353. package/src/lib/public-storage.ts +43 -0
  354. package/src/lib/rate-limit-d1.ts +99 -0
  355. package/src/lib/rate-limit-memory.ts +105 -0
  356. package/src/lib/rate-limit.ts +136 -0
  357. package/src/lib/render.tsx +104 -4
  358. package/src/lib/resolve-config.ts +233 -30
  359. package/src/lib/schemas.ts +681 -193
  360. package/src/lib/settings-paths.ts +5 -0
  361. package/src/lib/site-header-fragment.tsx +38 -0
  362. package/src/lib/site-skill.ts +78 -0
  363. package/src/lib/site-unavailable-page.ts +47 -0
  364. package/src/lib/slug.ts +51 -7
  365. package/src/lib/slugify.ts +118 -0
  366. package/src/lib/sse.ts +1 -1
  367. package/src/lib/startup-config.ts +77 -13
  368. package/src/lib/storage.ts +26 -0
  369. package/src/lib/structured-data.ts +113 -0
  370. package/src/lib/summary.ts +150 -15
  371. package/src/lib/telegram-entities.ts +240 -0
  372. package/src/lib/telegram-pool-webhooks.ts +86 -0
  373. package/src/lib/telegram-settings-status.tsx +109 -0
  374. package/src/lib/telegram.ts +363 -0
  375. package/src/lib/theme.ts +34 -26
  376. package/src/lib/thread-fold.ts +209 -0
  377. package/src/lib/thread-query.ts +171 -0
  378. package/src/lib/time.ts +169 -17
  379. package/src/lib/timeline.ts +237 -145
  380. package/src/lib/timezones.ts +54 -14
  381. package/src/lib/tiptap-render.ts +357 -78
  382. package/src/lib/tiptap-to-markdown.ts +13 -7
  383. package/src/lib/translit.ts +288 -0
  384. package/src/lib/upload.ts +142 -14
  385. package/src/lib/url-fetch.ts +364 -0
  386. package/src/lib/url.ts +391 -21
  387. package/src/lib/version.ts +10 -8
  388. package/src/lib/view-language.ts +436 -0
  389. package/src/lib/view.ts +206 -75
  390. package/src/lib/viewer-context.ts +62 -0
  391. package/src/lib/worker-response-cache.ts +11 -18
  392. package/src/middleware/auth.ts +133 -46
  393. package/src/middleware/cache-control.ts +125 -0
  394. package/src/middleware/config.ts +51 -13
  395. package/src/middleware/cors.ts +4 -4
  396. package/src/middleware/cross-origin.ts +124 -0
  397. package/src/middleware/error-handler.ts +52 -3
  398. package/src/middleware/onboarding.ts +42 -11
  399. package/src/middleware/public-content-access.ts +39 -0
  400. package/src/middleware/secure-headers.ts +44 -3
  401. package/src/middleware/session.ts +124 -0
  402. package/src/middleware/validate.ts +133 -0
  403. package/src/node/index.ts +6 -1
  404. package/src/node/request-handler.ts +139 -8
  405. package/src/node/runtime.ts +43 -11
  406. package/src/preset.css +178 -38
  407. package/src/routes/api/collections.ts +158 -89
  408. package/src/routes/api/custom-urls.ts +40 -52
  409. package/src/routes/api/discover.ts +107 -0
  410. package/src/routes/api/export.ts +9 -5
  411. package/src/routes/api/github-sync.tsx +102 -137
  412. package/src/routes/api/internal/post-body-html.ts +43 -0
  413. package/src/routes/api/internal/search-reindex.ts +40 -0
  414. package/src/routes/api/internal/sites.ts +196 -17
  415. package/src/routes/api/internal/uploads.ts +2 -7
  416. package/src/routes/api/mcp.ts +4 -0
  417. package/src/routes/api/media.ts +79 -0
  418. package/src/routes/api/nav-items.ts +181 -64
  419. package/src/routes/api/posts.ts +282 -241
  420. package/src/routes/api/public/posts.ts +26 -277
  421. package/src/routes/api/public/threads.ts +140 -0
  422. package/src/routes/api/search.ts +34 -35
  423. package/src/routes/api/settings.ts +191 -109
  424. package/src/routes/api/smart-collections.ts +177 -0
  425. package/src/routes/api/telegram.ts +742 -0
  426. package/src/routes/api/threads.ts +138 -0
  427. package/src/routes/api/upload.ts +84 -286
  428. package/src/routes/api/uploads.ts +153 -126
  429. package/src/routes/auth/dev.ts +5 -7
  430. package/src/routes/auth/hosted-sso.ts +9 -6
  431. package/src/routes/auth/setup.tsx +995 -178
  432. package/src/routes/auth/signin.tsx +134 -13
  433. package/src/routes/compose.tsx +51 -37
  434. package/src/routes/dash/custom-urls.tsx +6 -46
  435. package/src/routes/dash/settings.tsx +1039 -136
  436. package/src/routes/discover-announce.ts +96 -0
  437. package/src/routes/feed/feed.ts +192 -189
  438. package/src/routes/feed/sitemap.ts +291 -34
  439. package/src/routes/hosted/domain-check.ts +9 -14
  440. package/src/routes/pages/archive.tsx +621 -388
  441. package/src/routes/pages/brand.tsx +2 -1
  442. package/src/routes/pages/collection.tsx +202 -224
  443. package/src/routes/pages/collections.tsx +42 -46
  444. package/src/routes/pages/featured.tsx +56 -13
  445. package/src/routes/pages/home.tsx +53 -49
  446. package/src/routes/pages/language.tsx +113 -0
  447. package/src/routes/pages/latest.tsx +42 -50
  448. package/src/routes/pages/new.tsx +10 -0
  449. package/src/routes/pages/page.tsx +504 -88
  450. package/src/routes/pages/partials.tsx +79 -15
  451. package/src/routes/pages/search.tsx +51 -11
  452. package/src/routes/pages/smart-collection.tsx +273 -0
  453. package/src/routes/pages/subscribe.tsx +183 -0
  454. package/src/routes/pages/theme-sample.tsx +3 -4
  455. package/src/routes/site-skill.ts +18 -0
  456. package/src/runtime/cloudflare.ts +47 -14
  457. package/src/runtime/index.ts +29 -1
  458. package/src/runtime/node.ts +106 -15
  459. package/src/runtime/readiness.ts +37 -5
  460. package/src/runtime/site.ts +97 -25
  461. package/src/services/about-page.ts +164 -0
  462. package/src/services/auth.ts +89 -55
  463. package/src/services/bootstrap.ts +409 -28
  464. package/src/services/collection-directory-position.ts +76 -0
  465. package/src/services/collection.ts +659 -252
  466. package/src/services/custom-url.ts +146 -31
  467. package/src/services/export-theme/assets/client-site.css +1 -1
  468. package/src/services/export-theme/assets/client-site.js +128 -104
  469. package/src/services/export-theme/layouts/_default/alias.html +27 -1
  470. package/src/services/export-theme/layouts/_default/baseof.html +3 -2
  471. package/src/services/export-theme/layouts/_default/list.html +3 -50
  472. package/src/services/export-theme/layouts/_default/rss.xml +107 -55
  473. package/src/services/export-theme/layouts/collection/single.html +1 -1
  474. package/src/services/export-theme/layouts/collections/list.html +3 -3
  475. package/src/services/export-theme/layouts/featured/list.html +3 -5
  476. package/src/services/export-theme/layouts/index.html +19 -18
  477. package/src/services/export-theme/layouts/partials/collection-members.html +100 -0
  478. package/src/services/export-theme/layouts/partials/collection-threads.html +33 -0
  479. package/src/services/export-theme/layouts/partials/featured-members.html +35 -0
  480. package/src/services/export-theme/layouts/partials/featured-thread.html +63 -0
  481. package/src/services/export-theme/layouts/partials/feed-post-content.xml +130 -3
  482. package/src/services/export-theme/layouts/partials/footer.html +2 -2
  483. package/src/services/export-theme/layouts/partials/head.html +2 -2
  484. package/src/services/export-theme/layouts/partials/header.html +5 -3
  485. package/src/services/export-theme/layouts/partials/jant-data.html +23 -0
  486. package/src/services/export-theme/layouts/partials/latest-members.html +48 -0
  487. package/src/services/export-theme/layouts/partials/media-gallery.html +62 -35
  488. package/src/services/export-theme/layouts/partials/pagination.html +14 -13
  489. package/src/services/export-theme/layouts/partials/post-card.html +8 -4
  490. package/src/services/export-theme/layouts/partials/reply.html +2 -1
  491. package/src/services/export-theme/layouts/partials/smart-collection-members.html +129 -0
  492. package/src/services/export-theme/layouts/partials/thread-preview.html +41 -31
  493. package/src/services/export-theme/layouts/post/list.html +1 -1
  494. package/src/services/export-theme/layouts/smart_collection/list.html +24 -0
  495. package/src/services/export-theme/styles/main.css +147 -38
  496. package/src/services/export-theme/theme.toml +1 -1
  497. package/src/services/export.ts +1099 -195
  498. package/src/services/github-app-installations.ts +172 -7
  499. package/src/services/github-sync.ts +89 -23
  500. package/src/services/hosted-handoff.ts +106 -6
  501. package/src/services/index.ts +83 -21
  502. package/src/services/language.ts +445 -0
  503. package/src/services/mcp.ts +409 -573
  504. package/src/services/media.ts +387 -319
  505. package/src/services/navigation.ts +772 -73
  506. package/src/services/path.ts +302 -46
  507. package/src/services/post.ts +3277 -776
  508. package/src/services/search.ts +131 -55
  509. package/src/services/settings.ts +345 -64
  510. package/src/services/site-admin.ts +385 -53
  511. package/src/services/site.ts +160 -32
  512. package/src/services/smart-collection.ts +643 -0
  513. package/src/services/telegram.ts +628 -0
  514. package/src/services/text-attachment.ts +94 -0
  515. package/src/services/thread.ts +400 -0
  516. package/src/services/upload-session.ts +68 -30
  517. package/src/style-author.css +27 -0
  518. package/src/style-cjk-jp.css +1 -1
  519. package/src/style-cjk-kr.css +1 -1
  520. package/src/style-cjk-tc.css +1 -1
  521. package/src/style-cjk.css +1 -1
  522. package/src/styles/components-author.css +1622 -0
  523. package/src/styles/components.css +22 -1009
  524. package/src/styles/site-media.css +204 -46
  525. package/src/styles/tokens.css +263 -61
  526. package/src/styles/ui-author.css +7581 -0
  527. package/src/styles/ui.css +1973 -6553
  528. package/src/types/app-context.ts +59 -1
  529. package/src/types/bindings.ts +32 -3
  530. package/src/types/config.ts +406 -31
  531. package/src/types/constants.ts +262 -13
  532. package/src/types/entities.ts +101 -10
  533. package/src/types/operations.ts +92 -12
  534. package/src/types/props.ts +208 -43
  535. package/src/types/raw-assets.d.ts +5 -0
  536. package/src/types/views.ts +114 -13
  537. package/src/ui/color-themes.ts +39 -10
  538. package/src/ui/compose/ComposeDialog.tsx +369 -16
  539. package/src/ui/compose/ComposePrompt.tsx +1 -5
  540. package/src/ui/dash/appearance/AdvancedContent.tsx +2 -2
  541. package/src/ui/dash/appearance/CodeInjectionContent.tsx +12 -16
  542. package/src/ui/dash/appearance/ColorThemeContent.tsx +264 -29
  543. package/src/ui/dash/appearance/NavigationContent.tsx +506 -20
  544. package/src/ui/dash/appearance/system-nav-descriptions.ts +75 -0
  545. package/src/ui/dash/settings/AccountMenuContent.tsx +4 -43
  546. package/src/ui/dash/settings/ApiTokensContent.tsx +2 -1
  547. package/src/ui/dash/settings/ConfigEditorContent.tsx +597 -0
  548. package/src/ui/dash/settings/GeneralContent.tsx +314 -70
  549. package/src/ui/dash/settings/GitHubSyncContent.tsx +25 -0
  550. package/src/ui/dash/settings/LanguageContent.tsx +409 -0
  551. package/src/ui/dash/settings/SettingsDirectory.tsx +26 -1
  552. package/src/ui/dash/settings/SettingsRootContent.tsx +125 -22
  553. package/src/ui/dash/settings/TelegramContent.tsx +549 -0
  554. package/src/ui/dash/settings/discover-copy.ts +116 -0
  555. package/src/ui/feed/CuratedThreadPreview.tsx +23 -6
  556. package/src/ui/feed/LinkCard.tsx +79 -82
  557. package/src/ui/feed/LinkPreview.tsx +7 -26
  558. package/src/ui/feed/NoteCard.tsx +95 -51
  559. package/src/ui/feed/PostStatusBadges.tsx +103 -51
  560. package/src/ui/feed/QuoteCard.tsx +86 -56
  561. package/src/ui/feed/ThreadPreview.tsx +95 -75
  562. package/src/ui/feed/TimelineFeed.tsx +1 -7
  563. package/src/ui/feed/thread-preview-state.ts +35 -63
  564. package/src/ui/font-themes.ts +101 -43
  565. package/src/ui/layouts/BaseLayout.tsx +326 -61
  566. package/src/ui/layouts/SiteLayout.tsx +437 -238
  567. package/src/ui/pages/ArchivePage.tsx +498 -315
  568. package/src/ui/pages/BrandPage.tsx +1 -1
  569. package/src/ui/pages/CollectionPage.tsx +186 -97
  570. package/src/ui/pages/CollectionsPage.tsx +17 -26
  571. package/src/ui/pages/ComposePage.tsx +12 -1
  572. package/src/ui/pages/FeaturedPage.tsx +1 -1
  573. package/src/ui/pages/HomePage.tsx +24 -6
  574. package/src/ui/pages/PostPage.tsx +162 -24
  575. package/src/ui/pages/SearchPage.tsx +27 -19
  576. package/src/ui/pages/SmartCollectionPage.tsx +434 -0
  577. package/src/ui/pages/SubscribePage.tsx +234 -0
  578. package/src/ui/pages/ThemeSamplePage.tsx +1 -1
  579. package/src/ui/shared/CollectionDirectory.tsx +204 -15
  580. package/src/ui/shared/CollectionsManager.tsx +93 -62
  581. package/src/ui/shared/CopyField.tsx +127 -0
  582. package/src/ui/shared/DecorativeQuoteMark.tsx +2 -13
  583. package/src/ui/shared/DraftPreviewBar.tsx +49 -0
  584. package/src/ui/shared/EmptyPostContent.tsx +23 -0
  585. package/src/ui/shared/HomePageBranding.tsx +2 -2
  586. package/src/ui/shared/Icon.tsx +60 -0
  587. package/src/ui/shared/IconSprite.tsx +56 -0
  588. package/src/ui/shared/MediaGallery.tsx +175 -52
  589. package/src/ui/shared/Pagination.tsx +21 -6
  590. package/src/ui/shared/PostFooter.tsx +62 -84
  591. package/src/ui/shared/archive-labels.ts +98 -0
  592. package/src/ui/shared/collection-management-labels.ts +127 -18
  593. package/src/ui/shared/custom-icons.ts +168 -0
  594. package/src/ui/shared/icon-collector.ts +39 -0
  595. package/src/ui/shared/navigation-labels.ts +45 -73
  596. package/src/ui/shared/post-article-attributes.ts +54 -0
  597. package/src/ui/shared/smart-collection-labels.ts +343 -0
  598. package/src/vendor/datastar.js +9 -1956
  599. package/src/vendor/datastar.js.map +4 -4
  600. package/bin/commands/collections.js +0 -268
  601. package/bin/commands/export.js +0 -110
  602. package/bin/commands/import-site.js +0 -2619
  603. package/bin/commands/media.js +0 -302
  604. package/bin/commands/migrate-text-attachments.js +0 -183
  605. package/bin/commands/posts.js +0 -262
  606. package/bin/commands/search.js +0 -53
  607. package/bin/commands/settings.js +0 -93
  608. package/bin/lib/http-api.js +0 -223
  609. package/bin/lib/media-upload.js +0 -206
  610. package/dist/app-B5db9mS0.js +0 -5
  611. package/dist/app-CwCepTko.js +0 -31334
  612. package/dist/client/_assets/chunks/heic-to-DUUaO23q.js +0 -1
  613. package/dist/client/_assets/chunks/module-DcsAZQZ_.js +0 -716
  614. package/dist/client/_assets/chunks/native-DpcrFAPh.js +0 -1
  615. package/dist/client/_assets/chunks/url-pLre2DM_.js +0 -1
  616. package/dist/client/_assets/client-C_kImWZj.css +0 -2
  617. package/dist/client/_assets/client-D95FNDg5.js +0 -272
  618. package/dist/client/_assets/client-auth-BRFl5zQA.js +0 -4547
  619. package/dist/env-wCpMcNXs.js +0 -252
  620. package/dist/github-api-CficQztC.js +0 -176
  621. package/dist/github-app-F4qZ05xk.js +0 -275
  622. package/dist/github-sync-zohnA9qv.js +0 -4696
  623. package/dist/url-FvvgARU9.js +0 -305
  624. package/src/__tests__/bin/content-cli.test.ts +0 -179
  625. package/src/__tests__/bin/media-cli.test.ts +0 -192
  626. package/src/__tests__/bin/uploads-cleanup.test.ts +0 -77
  627. package/src/__tests__/export-hugo-build.test.ts +0 -178
  628. package/src/__tests__/export-import-roundtrip.test.ts +0 -265
  629. package/src/__tests__/export-service.test.ts +0 -803
  630. package/src/__tests__/helpers/app.ts +0 -159
  631. package/src/__tests__/helpers/db.ts +0 -136
  632. package/src/__tests__/helpers/export-fixtures.ts +0 -108
  633. package/src/__tests__/helpers/lingui-core-macro-mock.ts +0 -46
  634. package/src/__tests__/import-site-command.test.ts +0 -414
  635. package/src/__tests__/site-media-parser.test.ts +0 -216
  636. package/src/__tests__/site-pull-media.test.ts +0 -256
  637. package/src/client/__tests__/avatar-upload.test.ts +0 -186
  638. package/src/client/__tests__/collection-form-bridge.test.ts +0 -207
  639. package/src/client/__tests__/collection-page-actions.test.ts +0 -112
  640. package/src/client/__tests__/collection-picker-order.test.ts +0 -53
  641. package/src/client/__tests__/collection-sort-menu.test.ts +0 -78
  642. package/src/client/__tests__/compose-bridge.test.ts +0 -552
  643. package/src/client/__tests__/compose-discovery.test.ts +0 -155
  644. package/src/client/__tests__/compose-launch.test.ts +0 -120
  645. package/src/client/__tests__/compose-shortcuts.test.ts +0 -274
  646. package/src/client/__tests__/confirm.test.ts +0 -98
  647. package/src/client/__tests__/custom-url-menu.test.ts +0 -104
  648. package/src/client/__tests__/feed-video-player.test.ts +0 -44
  649. package/src/client/__tests__/form-enter-submit.test.ts +0 -110
  650. package/src/client/__tests__/post-form-bridge.test.ts +0 -82
  651. package/src/client/__tests__/site-header-nav.test.ts +0 -250
  652. package/src/client/__tests__/sortable-list.test.ts +0 -95
  653. package/src/client/__tests__/thread-context.test.ts +0 -117
  654. package/src/client/__tests__/toast.test.ts +0 -46
  655. package/src/client/collection-form-bridge.ts +0 -174
  656. package/src/client/components/__tests__/jant-collection-directory.test.ts +0 -387
  657. package/src/client/components/__tests__/jant-collection-form.test.ts +0 -340
  658. package/src/client/components/__tests__/jant-compose-dialog.test.ts +0 -4524
  659. package/src/client/components/__tests__/jant-compose-editor.test.ts +0 -1203
  660. package/src/client/components/__tests__/jant-compose-fullscreen.test.ts +0 -424
  661. package/src/client/components/__tests__/jant-media-lightbox.test.ts +0 -237
  662. package/src/client/components/__tests__/jant-nav-manager.test.ts +0 -326
  663. package/src/client/components/__tests__/jant-post-form.test.ts +0 -193
  664. package/src/client/components/__tests__/jant-post-menu.test.ts +0 -695
  665. package/src/client/components/__tests__/jant-settings-avatar.test.ts +0 -312
  666. package/src/client/components/__tests__/jant-settings-general.test.ts +0 -544
  667. package/src/client/components/__tests__/jant-text-preview.test.ts +0 -206
  668. package/src/client/components/jant-post-form.ts +0 -422
  669. package/src/client/components/post-form-template.ts +0 -352
  670. package/src/client/components/post-form-types.ts +0 -96
  671. package/src/client/media-metadata.ts +0 -247
  672. package/src/client/multipart-upload.ts +0 -196
  673. package/src/client/nav-manager-bridge.ts +0 -54
  674. package/src/client/post-form-bridge.ts +0 -193
  675. package/src/client/tiptap/__tests__/block-insertion.test.ts +0 -65
  676. package/src/client/tiptap/__tests__/floating-position.test.ts +0 -74
  677. package/src/client/tiptap/__tests__/footnotes.test.ts +0 -692
  678. package/src/client/tiptap/__tests__/link-toolbar.test.ts +0 -210
  679. package/src/client/tiptap/__tests__/markdown-clipboard.test.ts +0 -48
  680. package/src/client/tiptap/__tests__/paste-media.test.ts +0 -39
  681. package/src/client/tiptap/exitable-marks.ts +0 -73
  682. package/src/client/tiptap/wrapping-input-rules.ts +0 -102
  683. package/src/db/__tests__/d1-query.test.ts +0 -84
  684. package/src/db/__tests__/demo-canonical-snapshot.test.ts +0 -78
  685. package/src/db/__tests__/demo-env-loader.test.ts +0 -114
  686. package/src/db/__tests__/dialect.test.ts +0 -42
  687. package/src/db/__tests__/migration-artifacts.test.ts +0 -82
  688. package/src/db/__tests__/migration-rehearsal.test.ts +0 -77
  689. package/src/db/__tests__/migration-runner.test.ts +0 -72
  690. package/src/db/__tests__/migrations.test.ts +0 -426
  691. package/src/db/__tests__/r2-query.test.ts +0 -102
  692. package/src/db/__tests__/wrangler-config.test.ts +0 -86
  693. package/src/db/pg/__tests__/node.test.ts +0 -96
  694. package/src/db/rehearsal-fixtures/demo-current.json +0 -25
  695. package/src/db/rehearsal-fixtures/demo-current.sql +0 -186
  696. package/src/i18n/__tests__/context.test.tsx +0 -38
  697. package/src/i18n/__tests__/detect.test.ts +0 -132
  698. package/src/i18n/__tests__/fallback.test.ts +0 -40
  699. package/src/i18n/__tests__/message-placeholders.test.ts +0 -43
  700. package/src/i18n/__tests__/middleware.test.ts +0 -83
  701. package/src/lib/__tests__/asset-path.test.ts +0 -54
  702. package/src/lib/__tests__/blurhash-placeholder.test.ts +0 -99
  703. package/src/lib/__tests__/collection-groups.test.ts +0 -80
  704. package/src/lib/__tests__/collection-sort.test.ts +0 -45
  705. package/src/lib/__tests__/constants.test.ts +0 -44
  706. package/src/lib/__tests__/csp-builder.test.ts +0 -68
  707. package/src/lib/__tests__/display-text.test.ts +0 -27
  708. package/src/lib/__tests__/embed-providers.test.ts +0 -104
  709. package/src/lib/__tests__/embed-render.test.ts +0 -60
  710. package/src/lib/__tests__/excerpt.test.ts +0 -150
  711. package/src/lib/__tests__/favicon.test.ts +0 -151
  712. package/src/lib/__tests__/feed.test.ts +0 -209
  713. package/src/lib/__tests__/hosted-control-plane.test.ts +0 -106
  714. package/src/lib/__tests__/hosted-domain.test.ts +0 -78
  715. package/src/lib/__tests__/hosted-signin.test.ts +0 -112
  716. package/src/lib/__tests__/icons.test.ts +0 -20
  717. package/src/lib/__tests__/image.test.ts +0 -111
  718. package/src/lib/__tests__/jant-branding.test.ts +0 -160
  719. package/src/lib/__tests__/markdown-roundtrip-embed.test.ts +0 -88
  720. package/src/lib/__tests__/markdown-to-tiptap.test.ts +0 -444
  721. package/src/lib/__tests__/markdown.test.ts +0 -175
  722. package/src/lib/__tests__/nanoid.test.ts +0 -26
  723. package/src/lib/__tests__/navigation.test.ts +0 -148
  724. package/src/lib/__tests__/page-title.test.ts +0 -20
  725. package/src/lib/__tests__/password.test.ts +0 -60
  726. package/src/lib/__tests__/post-display.test.ts +0 -100
  727. package/src/lib/__tests__/post-meta.test.ts +0 -129
  728. package/src/lib/__tests__/public-storage.test.ts +0 -75
  729. package/src/lib/__tests__/resolve-config.test.ts +0 -341
  730. package/src/lib/__tests__/schemas.test.ts +0 -818
  731. package/src/lib/__tests__/search-snippet.test.ts +0 -43
  732. package/src/lib/__tests__/site-resolution.test.ts +0 -39
  733. package/src/lib/__tests__/slug-format.test.ts +0 -54
  734. package/src/lib/__tests__/slug.test.ts +0 -126
  735. package/src/lib/__tests__/sse.test.ts +0 -98
  736. package/src/lib/__tests__/startup-config.test.ts +0 -87
  737. package/src/lib/__tests__/storage.test.ts +0 -379
  738. package/src/lib/__tests__/summary.test.ts +0 -663
  739. package/src/lib/__tests__/theme.test.ts +0 -138
  740. package/src/lib/__tests__/time.test.ts +0 -218
  741. package/src/lib/__tests__/timeline.test.ts +0 -746
  742. package/src/lib/__tests__/timezones.test.ts +0 -94
  743. package/src/lib/__tests__/tiptap-render.test.ts +0 -224
  744. package/src/lib/__tests__/tiptap-to-markdown.test.ts +0 -420
  745. package/src/lib/__tests__/url.test.ts +0 -228
  746. package/src/lib/__tests__/video-playback.test.ts +0 -48
  747. package/src/lib/__tests__/view.test.ts +0 -770
  748. package/src/lib/__tests__/worker-response-cache.test.ts +0 -311
  749. package/src/lib/__tests__/youtube.test.ts +0 -99
  750. package/src/lib/github-sync-queue-handler.ts +0 -69
  751. package/src/lib/github-sync-worker.ts +0 -72
  752. package/src/lib/job-queue-cf.ts +0 -18
  753. package/src/lib/job-queue-db.ts +0 -149
  754. package/src/lib/job-queue.ts +0 -35
  755. package/src/middleware/__tests__/auth.test.ts +0 -499
  756. package/src/middleware/__tests__/error-handler.test.ts +0 -37
  757. package/src/middleware/__tests__/onboarding.test.ts +0 -211
  758. package/src/middleware/__tests__/secure-headers.test.ts +0 -138
  759. package/src/node/__tests__/cli-db-execute-file.test.ts +0 -109
  760. package/src/node/__tests__/cli-deploy.test.ts +0 -124
  761. package/src/node/__tests__/cli-export.test.ts +0 -66
  762. package/src/node/__tests__/cli-migrate.test.ts +0 -111
  763. package/src/node/__tests__/cli-reset-password.test.ts +0 -91
  764. package/src/node/__tests__/cli-runtime-target.test.ts +0 -37
  765. package/src/node/__tests__/cli-site-selection.test.ts +0 -133
  766. package/src/node/__tests__/cli-site-snapshot.test.ts +0 -636
  767. package/src/node/__tests__/cli-site-token-env.test.ts +0 -137
  768. package/src/node/__tests__/runtime.test.ts +0 -346
  769. package/src/routes/__tests__/compose.test.ts +0 -354
  770. package/src/routes/api/__tests__/attachments.test.ts +0 -92
  771. package/src/routes/api/__tests__/collections.test.ts +0 -556
  772. package/src/routes/api/__tests__/mcp.test.ts +0 -389
  773. package/src/routes/api/__tests__/nav-items.test.ts +0 -461
  774. package/src/routes/api/__tests__/posts.test.ts +0 -1080
  775. package/src/routes/api/__tests__/search.test.ts +0 -113
  776. package/src/routes/api/__tests__/settings.test.ts +0 -606
  777. package/src/routes/api/__tests__/upload-multipart.test.ts +0 -732
  778. package/src/routes/api/__tests__/upload.test.ts +0 -132
  779. package/src/routes/api/__tests__/uploads.test.ts +0 -422
  780. package/src/routes/api/internal/__tests__/api-tokens.test.ts +0 -55
  781. package/src/routes/api/internal/__tests__/sites.test.ts +0 -515
  782. package/src/routes/api/internal/__tests__/uploads.test.ts +0 -131
  783. package/src/routes/api/internal/text-attachments.ts +0 -60
  784. package/src/routes/api/public/__tests__/posts.test.ts +0 -372
  785. package/src/routes/api/upload-multipart.ts +0 -344
  786. package/src/routes/auth/__tests__/dev.test.ts +0 -135
  787. package/src/routes/auth/__tests__/hosted-sso.test.ts +0 -169
  788. package/src/routes/auth/__tests__/setup.test.ts +0 -128
  789. package/src/routes/dash/__tests__/font-theme.test.ts +0 -100
  790. package/src/routes/dash/__tests__/settings-avatar.test.ts +0 -265
  791. package/src/routes/feed/__tests__/feed.test.ts +0 -475
  792. package/src/routes/feed/__tests__/sitemap.test.ts +0 -64
  793. package/src/routes/hosted/__tests__/domain-check.test.ts +0 -94
  794. package/src/routes/pages/__tests__/collection-routing.test.ts +0 -176
  795. package/src/routes/pages/__tests__/collections.test.ts +0 -100
  796. package/src/routes/pages/__tests__/featured.test.ts +0 -119
  797. package/src/runtime/__tests__/node.test.ts +0 -258
  798. package/src/runtime/__tests__/readiness.test.ts +0 -89
  799. package/src/services/__tests__/api-token.test.ts +0 -138
  800. package/src/services/__tests__/auth.test.ts +0 -348
  801. package/src/services/__tests__/collection.test.ts +0 -1032
  802. package/src/services/__tests__/custom-url.test.ts +0 -220
  803. package/src/services/__tests__/github-app-installations.test.ts +0 -181
  804. package/src/services/__tests__/github-sync-classify.test.ts +0 -189
  805. package/src/services/__tests__/github-sync-push.test.ts +0 -159
  806. package/src/services/__tests__/hosted-handoff.test.ts +0 -123
  807. package/src/services/__tests__/media.test.ts +0 -1304
  808. package/src/services/__tests__/navigation.test.ts +0 -671
  809. package/src/services/__tests__/post-timeline.test.ts +0 -575
  810. package/src/services/__tests__/post.test.ts +0 -2076
  811. package/src/services/__tests__/search.test.ts +0 -326
  812. package/src/services/__tests__/settings.test.ts +0 -445
  813. package/src/services/__tests__/site-admin.test.ts +0 -48
  814. package/src/services/__tests__/site-profile.test.ts +0 -175
  815. package/src/styles/fonts/et-book/et-book-bold-line-figures.woff +0 -0
  816. package/src/styles/fonts/et-book/et-book-display-italic-old-style-figures.woff +0 -0
  817. package/src/styles/fonts/et-book/et-book-roman-line-figures.woff +0 -0
  818. package/src/styles/fonts/et-book.css +0 -31
  819. package/src/styles/fonts/latin.css +0 -5
  820. package/src/styles/fonts/noto-serif-jp/400/057a6a98bda7fe57105ddaa99ec82015.woff2 +0 -0
  821. package/src/styles/fonts/noto-serif-jp/400/0acd1fe2b2ea1ad1bfee7ae1fa139d27.woff2 +0 -0
  822. package/src/styles/fonts/noto-serif-jp/400/0c2ab6b295e55f356f8020d4e7747522.woff2 +0 -0
  823. package/src/styles/fonts/noto-serif-jp/400/0c5f9492af03a4fa42c784de94649de1.woff2 +0 -0
  824. package/src/styles/fonts/noto-serif-jp/400/0d9a936885a4c39077438effd3779cbd.woff2 +0 -0
  825. package/src/styles/fonts/noto-serif-jp/400/0e645da524f7cfc0e8c3c03fb2b08428.woff2 +0 -0
  826. package/src/styles/fonts/noto-serif-jp/400/135e83b403475c5dc9e49b43501a5b84.woff2 +0 -0
  827. package/src/styles/fonts/noto-serif-jp/400/13b2c53b30e6a3e4de7132dbc18dbdfc.woff2 +0 -0
  828. package/src/styles/fonts/noto-serif-jp/400/15d95680dc31cc6ce20e0a5464106dc4.woff2 +0 -0
  829. package/src/styles/fonts/noto-serif-jp/400/1733f27476507ca68b68a803bc533cc2.woff2 +0 -0
  830. package/src/styles/fonts/noto-serif-jp/400/188c2db794f3dd7a45889ddbc81da9bb.woff2 +0 -0
  831. package/src/styles/fonts/noto-serif-jp/400/1cf737900dd49c2e88f1b3221a82a602.woff2 +0 -0
  832. package/src/styles/fonts/noto-serif-jp/400/233d3a685ee18276b319363474599d47.woff2 +0 -0
  833. package/src/styles/fonts/noto-serif-jp/400/284b53bbefb06924cf236d24c8ed5641.woff2 +0 -0
  834. package/src/styles/fonts/noto-serif-jp/400/2a56eaf19d1d38a6b57e2a388f733676.woff2 +0 -0
  835. package/src/styles/fonts/noto-serif-jp/400/2abfbab82b6a7c04426afc054d2464da.woff2 +0 -0
  836. package/src/styles/fonts/noto-serif-jp/400/2e6f4bb71ef6b38765d51acc5a79f638.woff2 +0 -0
  837. package/src/styles/fonts/noto-serif-jp/400/31194d303a67561926a544ed0e072aee.woff2 +0 -0
  838. package/src/styles/fonts/noto-serif-jp/400/3623d96698132c61e861f984ce11cc23.woff2 +0 -0
  839. package/src/styles/fonts/noto-serif-jp/400/39211b02f24c69cbd1b54f6d41b01933.woff2 +0 -0
  840. package/src/styles/fonts/noto-serif-jp/400/3e24063b19abd2b051af986a6870046d.woff2 +0 -0
  841. package/src/styles/fonts/noto-serif-jp/400/4410f876d27c9821839474b6b1059fd7.woff2 +0 -0
  842. package/src/styles/fonts/noto-serif-jp/400/479329a39a3eb6c0047e6b0981919855.woff2 +0 -0
  843. package/src/styles/fonts/noto-serif-jp/400/527ff336279465617aafbafe1a830632.woff2 +0 -0
  844. package/src/styles/fonts/noto-serif-jp/400/56b40518ea0608e62826bd44ee27f5f9.woff2 +0 -0
  845. package/src/styles/fonts/noto-serif-jp/400/5acc7f736217259db79a42bf44241c48.woff2 +0 -0
  846. package/src/styles/fonts/noto-serif-jp/400/5c05f8b75c9d7f25b3c04ca711cf43b3.woff2 +0 -0
  847. package/src/styles/fonts/noto-serif-jp/400/5e0124c7265f1b4cf0fc797b94efbebc.woff2 +0 -0
  848. package/src/styles/fonts/noto-serif-jp/400/615a7e0d63f257109d599b2a1977de68.woff2 +0 -0
  849. package/src/styles/fonts/noto-serif-jp/400/61a2c80d0c924d5a6187c02e8d1d1642.woff2 +0 -0
  850. package/src/styles/fonts/noto-serif-jp/400/62fc94f8d4c5a750b7f25e7387539910.woff2 +0 -0
  851. package/src/styles/fonts/noto-serif-jp/400/639c7c6b0b0c27c738702741cfa4b8c0.woff2 +0 -0
  852. package/src/styles/fonts/noto-serif-jp/400/68a3a4bf337f8a0722be76676e20b850.woff2 +0 -0
  853. package/src/styles/fonts/noto-serif-jp/400/6abdd163d2c4b85698db8aa1ce149361.woff2 +0 -0
  854. package/src/styles/fonts/noto-serif-jp/400/73b794d885b88f7befb7ea8ab1780a15.woff2 +0 -0
  855. package/src/styles/fonts/noto-serif-jp/400/743f290baf027d4626a86e22f3d44600.woff2 +0 -0
  856. package/src/styles/fonts/noto-serif-jp/400/757019c01c5e2c2b0f54293cea3b5636.woff2 +0 -0
  857. package/src/styles/fonts/noto-serif-jp/400/76f117a3baacda304a71965a17266a13.woff2 +0 -0
  858. package/src/styles/fonts/noto-serif-jp/400/77747f17625a259fb405b7bbdd84ac4b.woff2 +0 -0
  859. package/src/styles/fonts/noto-serif-jp/400/788498548ddfb710d6ef3c7bff79fa97.woff2 +0 -0
  860. package/src/styles/fonts/noto-serif-jp/400/78ea6c40923ce95367e3517dd1e5a849.woff2 +0 -0
  861. package/src/styles/fonts/noto-serif-jp/400/7f9a6c9286b68de9c72b0024f7beeb40.woff2 +0 -0
  862. package/src/styles/fonts/noto-serif-jp/400/823d1bb11097331238d103c7f72138dc.woff2 +0 -0
  863. package/src/styles/fonts/noto-serif-jp/400/888ba53510213d5d1f6a7deb60e569b6.woff2 +0 -0
  864. package/src/styles/fonts/noto-serif-jp/400/892aa49b2529c89bb4076d4aa51fe30f.woff2 +0 -0
  865. package/src/styles/fonts/noto-serif-jp/400/95ff41191c76ef893ac70a1043e95e44.woff2 +0 -0
  866. package/src/styles/fonts/noto-serif-jp/400/96c75862c8cec51a7c05ff025fea86cd.woff2 +0 -0
  867. package/src/styles/fonts/noto-serif-jp/400/9b21e8244f5930c48ad5073f83777b6c.woff2 +0 -0
  868. package/src/styles/fonts/noto-serif-jp/400/9fce02d1a09f464c36c9fcfb14a354c5.woff2 +0 -0
  869. package/src/styles/fonts/noto-serif-jp/400/a0a6755c7e3f9e4cf03387027dd9f16c.woff2 +0 -0
  870. package/src/styles/fonts/noto-serif-jp/400/a4475c442c6b259354c9eda62e64e7df.woff2 +0 -0
  871. package/src/styles/fonts/noto-serif-jp/400/a4a39b5f048671aa37c2b2a9581ab08a.woff2 +0 -0
  872. package/src/styles/fonts/noto-serif-jp/400/a534449d67561ac9b06489f64e57ad98.woff2 +0 -0
  873. package/src/styles/fonts/noto-serif-jp/400/a919a8c6fec6d7e8bb21177965f2e9d7.woff2 +0 -0
  874. package/src/styles/fonts/noto-serif-jp/400/ad67113f88b59582991cb0c5d33ea19f.woff2 +0 -0
  875. package/src/styles/fonts/noto-serif-jp/400/adb6e613fb99c6dd660b727101f554a8.woff2 +0 -0
  876. package/src/styles/fonts/noto-serif-jp/400/adc4a98a89870ef984ee8f4b57c8a3a5.woff2 +0 -0
  877. package/src/styles/fonts/noto-serif-jp/400/b12379ab782468d725519cd07a7d15bc.woff2 +0 -0
  878. package/src/styles/fonts/noto-serif-jp/400/b55486f8a459c838fe329d4e79a8c211.woff2 +0 -0
  879. package/src/styles/fonts/noto-serif-jp/400/bb0b15492b8cdbbec57c0bcfa0aa9241.woff2 +0 -0
  880. package/src/styles/fonts/noto-serif-jp/400/bedc74b423b7293b6ad0bdecc61c42cc.woff2 +0 -0
  881. package/src/styles/fonts/noto-serif-jp/400/bfb00d4a4c48661bd0be99f300a0faae.woff2 +0 -0
  882. package/src/styles/fonts/noto-serif-jp/400/c1b0df29ae41d764904df84e9ac83d1e.woff2 +0 -0
  883. package/src/styles/fonts/noto-serif-jp/400/c42c67070cfe99cf823df92d81c7fa6e.woff2 +0 -0
  884. package/src/styles/fonts/noto-serif-jp/400/c4d749e45ecd5a5aed5a0bb3ebfd355d.woff2 +0 -0
  885. package/src/styles/fonts/noto-serif-jp/400/c96d83978add28b356c22c4c84916733.woff2 +0 -0
  886. package/src/styles/fonts/noto-serif-jp/400/cb7ccd6494256f7a2977b7c2b0225592.woff2 +0 -0
  887. package/src/styles/fonts/noto-serif-jp/400/ce41d70ce6a069a498525c9e15c45cf2.woff2 +0 -0
  888. package/src/styles/fonts/noto-serif-jp/400/d509ee5c8241bc7c3de2039d75564fa5.woff2 +0 -0
  889. package/src/styles/fonts/noto-serif-jp/400/d675d717cd329bfd4c0524f76ae1579c.woff2 +0 -0
  890. package/src/styles/fonts/noto-serif-jp/400/dc8f6256445e68199540be9ade33529f.woff2 +0 -0
  891. package/src/styles/fonts/noto-serif-jp/400/e8c15be62faf978d208925e79ea6a10d.woff2 +0 -0
  892. package/src/styles/fonts/noto-serif-jp/400/e91c4d941ed9f5c2f3e27f205a3a225e.woff2 +0 -0
  893. package/src/styles/fonts/noto-serif-jp/400/e9c566be7a5d38a9085225f7372bc82b.woff2 +0 -0
  894. package/src/styles/fonts/noto-serif-jp/400/e9ebc567a711eeb29019ddae3e0ce7fe.woff2 +0 -0
  895. package/src/styles/fonts/noto-serif-jp/400/ecb8875a56c7b038b35432fda41ae128.woff2 +0 -0
  896. package/src/styles/fonts/noto-serif-jp/400/f1661731474b78bdf81114daf10b254f.woff2 +0 -0
  897. package/src/styles/fonts/noto-serif-jp/400/f2c58dee206ba9355046fc23d05491f7.woff2 +0 -0
  898. package/src/styles/fonts/noto-serif-jp/400/f50ac27ea4358d67fdda403c2bb52467.woff2 +0 -0
  899. package/src/styles/fonts/noto-serif-jp/400/f55334112f8e8be82d65db29887a663f.woff2 +0 -0
  900. package/src/styles/fonts/noto-serif-jp/400/f740e93f3c0277ecc616594103bca683.woff2 +0 -0
  901. package/src/styles/fonts/noto-serif-jp/400/f7633b5af033d76ff2fb3c3c266d77c5.woff2 +0 -0
  902. package/src/styles/fonts/noto-serif-jp/400/f7d8468cba2335a83ee414ea68291bab.woff2 +0 -0
  903. package/src/styles/fonts/noto-serif-jp/400/fc9ae5b600fb711f2d67e93ce768cba4.woff2 +0 -0
  904. package/src/styles/fonts/noto-serif-jp/400/fd1bceb55d3e0183ac2454b8532fec7d.woff2 +0 -0
  905. package/src/styles/fonts/noto-serif-jp/700/02611a045a7fe83a12014e3debc9f731.woff2 +0 -0
  906. package/src/styles/fonts/noto-serif-jp/700/0f5e1a18987dbc84ca05188c129e1936.woff2 +0 -0
  907. package/src/styles/fonts/noto-serif-jp/700/112743a4ab5fdd1498dfdf2b11336380.woff2 +0 -0
  908. package/src/styles/fonts/noto-serif-jp/700/1211f03d3ff5759a702631445793f60e.woff2 +0 -0
  909. package/src/styles/fonts/noto-serif-jp/700/147b24c2f08d03bbed30887d4cb3311c.woff2 +0 -0
  910. package/src/styles/fonts/noto-serif-jp/700/16663e567f81f4725a1522f37e18f71f.woff2 +0 -0
  911. package/src/styles/fonts/noto-serif-jp/700/1824321da801e6257b902f3d1d09054c.woff2 +0 -0
  912. package/src/styles/fonts/noto-serif-jp/700/1a3a92c7c060a71a6c35819b9ebcdbb9.woff2 +0 -0
  913. package/src/styles/fonts/noto-serif-jp/700/1fba7ec0e412e911bf31841de5a8a4e4.woff2 +0 -0
  914. package/src/styles/fonts/noto-serif-jp/700/28a97af9ab9d38983d20f39ff09840e1.woff2 +0 -0
  915. package/src/styles/fonts/noto-serif-jp/700/2bfaadaf3479c72286248e6de0be0ec9.woff2 +0 -0
  916. package/src/styles/fonts/noto-serif-jp/700/2c8c55e4cec85ce77e95cac9d330f5cf.woff2 +0 -0
  917. package/src/styles/fonts/noto-serif-jp/700/2ed9981d2e8983365bd051159b976b6d.woff2 +0 -0
  918. package/src/styles/fonts/noto-serif-jp/700/2f4c633e923ba30c6ba376367379fc91.woff2 +0 -0
  919. package/src/styles/fonts/noto-serif-jp/700/349965eee0a9b6c984a319ab96a4ece9.woff2 +0 -0
  920. package/src/styles/fonts/noto-serif-jp/700/36cda3eae13370b934bba4429fab9078.woff2 +0 -0
  921. package/src/styles/fonts/noto-serif-jp/700/3aa13f1843d7c8fa16109b6395a9a29d.woff2 +0 -0
  922. package/src/styles/fonts/noto-serif-jp/700/3e2c06bdd9dcab29aeaeb0cfb7fa608a.woff2 +0 -0
  923. package/src/styles/fonts/noto-serif-jp/700/424123f9371ba357087363263eeafcda.woff2 +0 -0
  924. package/src/styles/fonts/noto-serif-jp/700/43b3bbf43055c3e65db9cdf2c5b18c1c.woff2 +0 -0
  925. package/src/styles/fonts/noto-serif-jp/700/44704471b60c18b3ecec5300a88f1102.woff2 +0 -0
  926. package/src/styles/fonts/noto-serif-jp/700/46604090efbb99c2db1800928af0a239.woff2 +0 -0
  927. package/src/styles/fonts/noto-serif-jp/700/46998df85d31e629c0142f0556f5e7c5.woff2 +0 -0
  928. package/src/styles/fonts/noto-serif-jp/700/49902f1c41b281f8eb3771abdd4dccb8.woff2 +0 -0
  929. package/src/styles/fonts/noto-serif-jp/700/4db4f31a16965baa42cb7dad667a8f04.woff2 +0 -0
  930. package/src/styles/fonts/noto-serif-jp/700/572b9e28f1e6d89b765a16d809db84a1.woff2 +0 -0
  931. package/src/styles/fonts/noto-serif-jp/700/5921cef36750ff6092d94b83a802823b.woff2 +0 -0
  932. package/src/styles/fonts/noto-serif-jp/700/59e95d8b5332dcdae894a19946ab767d.woff2 +0 -0
  933. package/src/styles/fonts/noto-serif-jp/700/5ec349ff62b9ee5fe0c6dae867704dc4.woff2 +0 -0
  934. package/src/styles/fonts/noto-serif-jp/700/601f812e8b1eafecd5ba585a6a6d7962.woff2 +0 -0
  935. package/src/styles/fonts/noto-serif-jp/700/6025ddaf99d86cc8bfd781006b19fbd6.woff2 +0 -0
  936. package/src/styles/fonts/noto-serif-jp/700/60f6e28b3f0400b0e8fe32c3c7116102.woff2 +0 -0
  937. package/src/styles/fonts/noto-serif-jp/700/64a404d675f1d726f0891b7a80794595.woff2 +0 -0
  938. package/src/styles/fonts/noto-serif-jp/700/7158022889c6c177062ac85036e7af10.woff2 +0 -0
  939. package/src/styles/fonts/noto-serif-jp/700/7e38ca789a9e76ac91d9256374e154f0.woff2 +0 -0
  940. package/src/styles/fonts/noto-serif-jp/700/815a0b797465190f60d8b1a04656c42e.woff2 +0 -0
  941. package/src/styles/fonts/noto-serif-jp/700/8726558cf297cbda831cc19514897205.woff2 +0 -0
  942. package/src/styles/fonts/noto-serif-jp/700/8855472f3c02f6c7ebb3216617ebe4af.woff2 +0 -0
  943. package/src/styles/fonts/noto-serif-jp/700/8e231d707f0c4f8e3cde90a6b52a79aa.woff2 +0 -0
  944. package/src/styles/fonts/noto-serif-jp/700/9064c12fd72c7aba235d8c3881755b91.woff2 +0 -0
  945. package/src/styles/fonts/noto-serif-jp/700/911b9e53e9814de2998c60bf3115f560.woff2 +0 -0
  946. package/src/styles/fonts/noto-serif-jp/700/92fdc376bce277874e75db666f175b44.woff2 +0 -0
  947. package/src/styles/fonts/noto-serif-jp/700/930a23430f0eb64480d7fe5f82834e21.woff2 +0 -0
  948. package/src/styles/fonts/noto-serif-jp/700/93bed0e5f2dd5a21cf73304fcfbc149d.woff2 +0 -0
  949. package/src/styles/fonts/noto-serif-jp/700/93f3ea6918533d96d9c252378b9a4af0.woff2 +0 -0
  950. package/src/styles/fonts/noto-serif-jp/700/95a0951d2a2722ff773a1a45e8c474d6.woff2 +0 -0
  951. package/src/styles/fonts/noto-serif-jp/700/982cd1765ca6bbb3e6547e47834d5148.woff2 +0 -0
  952. package/src/styles/fonts/noto-serif-jp/700/9b0c3caac458c7bc9c9133e40405ddea.woff2 +0 -0
  953. package/src/styles/fonts/noto-serif-jp/700/9f3bdab4025dc7c5ba1a5871e62e8918.woff2 +0 -0
  954. package/src/styles/fonts/noto-serif-jp/700/a00e94d4f04df6aa659db9c4954c7efe.woff2 +0 -0
  955. package/src/styles/fonts/noto-serif-jp/700/a2b0597837e382aca19919c4b74e58c8.woff2 +0 -0
  956. package/src/styles/fonts/noto-serif-jp/700/a373e85c96aa0dc303092429fb837e51.woff2 +0 -0
  957. package/src/styles/fonts/noto-serif-jp/700/a6e044424780a57610833cc856c15bf5.woff2 +0 -0
  958. package/src/styles/fonts/noto-serif-jp/700/a7c58070d68dc1724e9d4e781afb78db.woff2 +0 -0
  959. package/src/styles/fonts/noto-serif-jp/700/accc43762ad05edfbff66ba1380d192a.woff2 +0 -0
  960. package/src/styles/fonts/noto-serif-jp/700/ad47bcd6d4663026d648c132d969318d.woff2 +0 -0
  961. package/src/styles/fonts/noto-serif-jp/700/af57a2e8c72f9ba0efb1af771d32c124.woff2 +0 -0
  962. package/src/styles/fonts/noto-serif-jp/700/b0ae5f374e43dac992a4a5d334cebc0b.woff2 +0 -0
  963. package/src/styles/fonts/noto-serif-jp/700/b91234c10fd8b8c8abc88e03afe66a1f.woff2 +0 -0
  964. package/src/styles/fonts/noto-serif-jp/700/b9317198f118a1dfd8ddf2b82ec028f3.woff2 +0 -0
  965. package/src/styles/fonts/noto-serif-jp/700/ba825ae79b1a6f7e0cce5215fcb5c96f.woff2 +0 -0
  966. package/src/styles/fonts/noto-serif-jp/700/bc6183ac08f0fac78c46f80c10cf7c92.woff2 +0 -0
  967. package/src/styles/fonts/noto-serif-jp/700/bc8ccea5abf6598cf3cfa97eb59804bb.woff2 +0 -0
  968. package/src/styles/fonts/noto-serif-jp/700/bc95a792cbca6639214c9b0da13392ff.woff2 +0 -0
  969. package/src/styles/fonts/noto-serif-jp/700/bcfa62f35731856246c146d3a6932bf3.woff2 +0 -0
  970. package/src/styles/fonts/noto-serif-jp/700/c063897793f593eb26d6ff7b7baaba18.woff2 +0 -0
  971. package/src/styles/fonts/noto-serif-jp/700/c6c2971ad1f3221f6cf84028aa0f477e.woff2 +0 -0
  972. package/src/styles/fonts/noto-serif-jp/700/c97f41eef722121d86f55d553c056a39.woff2 +0 -0
  973. package/src/styles/fonts/noto-serif-jp/700/ca62704509932d3232d62918de97af3f.woff2 +0 -0
  974. package/src/styles/fonts/noto-serif-jp/700/d1f064825fa5784b5c930652bd831cce.woff2 +0 -0
  975. package/src/styles/fonts/noto-serif-jp/700/d2faabcedd19f016e7b21bce073c0ec8.woff2 +0 -0
  976. package/src/styles/fonts/noto-serif-jp/700/d320171e57480510f87dbbc7d5264b0a.woff2 +0 -0
  977. package/src/styles/fonts/noto-serif-jp/700/d3a72a99d365dddfbca8d017a8011368.woff2 +0 -0
  978. package/src/styles/fonts/noto-serif-jp/700/d42aafa0f246ad3b4c16fe96d3a3a432.woff2 +0 -0
  979. package/src/styles/fonts/noto-serif-jp/700/d4aaf23c13ae808a4bed617afd13aa07.woff2 +0 -0
  980. package/src/styles/fonts/noto-serif-jp/700/d6bb686bddfbe8f38a36a68e609a8667.woff2 +0 -0
  981. package/src/styles/fonts/noto-serif-jp/700/d9020ff69a83b2a6ee1f42ae480f7db0.woff2 +0 -0
  982. package/src/styles/fonts/noto-serif-jp/700/da90a9012ab2d98f759e3fa0820ef502.woff2 +0 -0
  983. package/src/styles/fonts/noto-serif-jp/700/df10d94bea357a43313e20da5d84bd30.woff2 +0 -0
  984. package/src/styles/fonts/noto-serif-jp/700/e34b2b141e472dc776c86fdf8eea23b0.woff2 +0 -0
  985. package/src/styles/fonts/noto-serif-jp/700/e444fd88f1390636e603d0d681538ac8.woff2 +0 -0
  986. package/src/styles/fonts/noto-serif-jp/700/e79898628283edc27180fc39d0d769c1.woff2 +0 -0
  987. package/src/styles/fonts/noto-serif-jp/700/eaf332445a40942928e5f5750c1c3116.woff2 +0 -0
  988. package/src/styles/fonts/noto-serif-jp/700/f91cd722855f4269256eae1187df64ec.woff2 +0 -0
  989. package/src/styles/fonts/noto-serif-jp/700/fc895f5ce66b656f4a933097bf2a8775.woff2 +0 -0
  990. package/src/styles/fonts/noto-serif-jp/700/fca6720fd14c467d29a90f18ef3859b9.woff2 +0 -0
  991. package/src/styles/fonts/noto-serif-jp/700/fd1bb507bcbf04856eeb7f7fd47ea579.woff2 +0 -0
  992. package/src/styles/fonts/noto-serif-jp/noto-serif-jp.css +0 -3349
  993. package/src/styles/fonts/noto-serif-kr/400/033466ef683afe931f7f520cfb42d928.woff2 +0 -0
  994. package/src/styles/fonts/noto-serif-kr/400/05da12edb9d52210581dc6ec4541031f.woff2 +0 -0
  995. package/src/styles/fonts/noto-serif-kr/400/0968e4861204b51f62a2f8e9f15dd5e0.woff2 +0 -0
  996. package/src/styles/fonts/noto-serif-kr/400/0d5dec931dc885f07fe5cd5af8bed675.woff2 +0 -0
  997. package/src/styles/fonts/noto-serif-kr/400/1076f0f6f66d28d7a2f16427faad4413.woff2 +0 -0
  998. package/src/styles/fonts/noto-serif-kr/400/12ef1ba76bd20b004b865266a1aa70b3.woff2 +0 -0
  999. package/src/styles/fonts/noto-serif-kr/400/152395634a207579552f8cb54db88599.woff2 +0 -0
  1000. package/src/styles/fonts/noto-serif-kr/400/1a08931435f885e707edb85978ea3bb6.woff2 +0 -0
  1001. package/src/styles/fonts/noto-serif-kr/400/31a197213ae61d7043c81013f52d10d6.woff2 +0 -0
  1002. package/src/styles/fonts/noto-serif-kr/400/37dbd564820cce2f7b3331e442da0df3.woff2 +0 -0
  1003. package/src/styles/fonts/noto-serif-kr/400/37dc8505b20b37a2477a9121b16d44a7.woff2 +0 -0
  1004. package/src/styles/fonts/noto-serif-kr/400/3ac0a07878cacdc98bb889f40f5970d3.woff2 +0 -0
  1005. package/src/styles/fonts/noto-serif-kr/400/491bbba374093fff045f55803a22bfef.woff2 +0 -0
  1006. package/src/styles/fonts/noto-serif-kr/400/4d38e56738156625329d93bd5c8cc74a.woff2 +0 -0
  1007. package/src/styles/fonts/noto-serif-kr/400/57e9a86651366c1ba299e47aa7e358c2.woff2 +0 -0
  1008. package/src/styles/fonts/noto-serif-kr/400/57f89adeae55aa7fe2add3fc1801ce03.woff2 +0 -0
  1009. package/src/styles/fonts/noto-serif-kr/400/5df9ce98c75f8c50fb4fff7f01a23925.woff2 +0 -0
  1010. package/src/styles/fonts/noto-serif-kr/400/60020a830d809c26970cf8e48ba1eeda.woff2 +0 -0
  1011. package/src/styles/fonts/noto-serif-kr/400/60bcfa3ea7446eb42394aab02d28be40.woff2 +0 -0
  1012. package/src/styles/fonts/noto-serif-kr/400/63fafcb069520613d0ea35ad3e6b1e42.woff2 +0 -0
  1013. package/src/styles/fonts/noto-serif-kr/400/65a60d87c64228d258a123cbe85f5f31.woff2 +0 -0
  1014. package/src/styles/fonts/noto-serif-kr/400/6968e889e18891d912809fe484c2e745.woff2 +0 -0
  1015. package/src/styles/fonts/noto-serif-kr/400/70714891ad3fbfc3d5f10a8669dacc5a.woff2 +0 -0
  1016. package/src/styles/fonts/noto-serif-kr/400/761d84afca8d7f34eebefe538adba827.woff2 +0 -0
  1017. package/src/styles/fonts/noto-serif-kr/400/76e07530323418ec723c5d7634c9bcca.woff2 +0 -0
  1018. package/src/styles/fonts/noto-serif-kr/400/773819b7b9b8fd404a929867c0fd677e.woff2 +0 -0
  1019. package/src/styles/fonts/noto-serif-kr/400/7817dd16805145d8538ad57590f69f5a.woff2 +0 -0
  1020. package/src/styles/fonts/noto-serif-kr/400/7b59f0ec7792b18458dc5a361e37884c.woff2 +0 -0
  1021. package/src/styles/fonts/noto-serif-kr/400/7c3945788a689a69356c1a622d69d48b.woff2 +0 -0
  1022. package/src/styles/fonts/noto-serif-kr/400/835b6505bb9eea9678925a1fa885353d.woff2 +0 -0
  1023. package/src/styles/fonts/noto-serif-kr/400/8b5c9ef81159f31d2ab35f45ca4373e0.woff2 +0 -0
  1024. package/src/styles/fonts/noto-serif-kr/400/8b91c7c2ed390f1278b9befa3aa87233.woff2 +0 -0
  1025. package/src/styles/fonts/noto-serif-kr/400/8fb45117a62d92dce44a80f0b729ead5.woff2 +0 -0
  1026. package/src/styles/fonts/noto-serif-kr/400/90b7848e9b1623b77bdcf155e90b839c.woff2 +0 -0
  1027. package/src/styles/fonts/noto-serif-kr/400/985d4d41afa0934a4eb2de35473fb9a2.woff2 +0 -0
  1028. package/src/styles/fonts/noto-serif-kr/400/9bb38fd05201de666b88b82d56a386f7.woff2 +0 -0
  1029. package/src/styles/fonts/noto-serif-kr/400/9eff2ab2a9d2ced47ab761bf6fdb11ec.woff2 +0 -0
  1030. package/src/styles/fonts/noto-serif-kr/400/9f1963fe8d4d6878d717d872a8f3fdb5.woff2 +0 -0
  1031. package/src/styles/fonts/noto-serif-kr/400/a0d00fe4816c95a8c7dffd445ef00b03.woff2 +0 -0
  1032. package/src/styles/fonts/noto-serif-kr/400/a0f199077fa1a33bc2a1e01c64de7fe6.woff2 +0 -0
  1033. package/src/styles/fonts/noto-serif-kr/400/a7c35e42a659347e490c3cb7983b2e7f.woff2 +0 -0
  1034. package/src/styles/fonts/noto-serif-kr/400/aa662092cf249707123ca4d575e2764b.woff2 +0 -0
  1035. package/src/styles/fonts/noto-serif-kr/400/aae1eda193285ab817a2d1b408440326.woff2 +0 -0
  1036. package/src/styles/fonts/noto-serif-kr/400/b0cb664cb2e1371efda8943c0b7dcd1c.woff2 +0 -0
  1037. package/src/styles/fonts/noto-serif-kr/400/b0d1cdced482352cf0d3ae58638aacb9.woff2 +0 -0
  1038. package/src/styles/fonts/noto-serif-kr/400/b320f5d185b2cff933ac549c184031c5.woff2 +0 -0
  1039. package/src/styles/fonts/noto-serif-kr/400/ba9c59d7dfa4494db1bb764ada81467d.woff2 +0 -0
  1040. package/src/styles/fonts/noto-serif-kr/400/bab547459d514f46206e340c4bb2dc88.woff2 +0 -0
  1041. package/src/styles/fonts/noto-serif-kr/400/bcc39eda837bb7a7a3d37c8c60fffb81.woff2 +0 -0
  1042. package/src/styles/fonts/noto-serif-kr/400/bd73264d7f98776708d5d6f3c9b78fcc.woff2 +0 -0
  1043. package/src/styles/fonts/noto-serif-kr/400/bed610b217d500f5975cfc9fe6157570.woff2 +0 -0
  1044. package/src/styles/fonts/noto-serif-kr/400/bf8901f8f11d4f433ea17dabc9370ea6.woff2 +0 -0
  1045. package/src/styles/fonts/noto-serif-kr/400/c4143bb9f2fe77b6ccf20088a8904650.woff2 +0 -0
  1046. package/src/styles/fonts/noto-serif-kr/400/c7ff3f6bbdcd5f604b7343602ab904df.woff2 +0 -0
  1047. package/src/styles/fonts/noto-serif-kr/400/c945c62368357d05a53206620460fb30.woff2 +0 -0
  1048. package/src/styles/fonts/noto-serif-kr/400/ce022e18a1377ac509443c3c3790b431.woff2 +0 -0
  1049. package/src/styles/fonts/noto-serif-kr/400/cf9cffe56636322f62b40d61130fbc5e.woff2 +0 -0
  1050. package/src/styles/fonts/noto-serif-kr/400/d20d8944bc0b85f5b2aae4b24f343516.woff2 +0 -0
  1051. package/src/styles/fonts/noto-serif-kr/400/d36644d6502527e1fff205d0c7eca434.woff2 +0 -0
  1052. package/src/styles/fonts/noto-serif-kr/400/d40ab99c7a38026f411c8f112f742b48.woff2 +0 -0
  1053. package/src/styles/fonts/noto-serif-kr/400/dc6e234ded795e91f76d6647f628fbf0.woff2 +0 -0
  1054. package/src/styles/fonts/noto-serif-kr/400/dd0cfdfdac0866e66d587e2b5a9e9961.woff2 +0 -0
  1055. package/src/styles/fonts/noto-serif-kr/400/de304c8a02e45ded4f8dcc479d167198.woff2 +0 -0
  1056. package/src/styles/fonts/noto-serif-kr/400/e8c364c16daa04835bf32d293d2598db.woff2 +0 -0
  1057. package/src/styles/fonts/noto-serif-kr/400/ec86e23683052da5cfdc3b77641bd15a.woff2 +0 -0
  1058. package/src/styles/fonts/noto-serif-kr/400/eda1b0cb6d1719dd9bedcf3216a9e8de.woff2 +0 -0
  1059. package/src/styles/fonts/noto-serif-kr/400/ee6fce20b420a480714607c66d7f97e5.woff2 +0 -0
  1060. package/src/styles/fonts/noto-serif-kr/400/eee3836d6ac17ebb2c450bbcbc9db121.woff2 +0 -0
  1061. package/src/styles/fonts/noto-serif-kr/400/f5738255e92d8dd34a46d1bcdf4c4074.woff2 +0 -0
  1062. package/src/styles/fonts/noto-serif-kr/400/fa6e58ce4b52695e7ae19bbea6336ec8.woff2 +0 -0
  1063. package/src/styles/fonts/noto-serif-kr/400/fd2069e6e8588c70b4f11364093b81f2.woff2 +0 -0
  1064. package/src/styles/fonts/noto-serif-kr/700/04b8bde59cff68eeee74fb1914eb09c7.woff2 +0 -0
  1065. package/src/styles/fonts/noto-serif-kr/700/05ac821472e235943ed1435e4bb8ecad.woff2 +0 -0
  1066. package/src/styles/fonts/noto-serif-kr/700/074c1f8483d5a4d8c45c8c5f3e4cbb32.woff2 +0 -0
  1067. package/src/styles/fonts/noto-serif-kr/700/1380210a722ac9aeef54005ad7b015c9.woff2 +0 -0
  1068. package/src/styles/fonts/noto-serif-kr/700/17c7f5d0a45e92ede0e5dec3a2c77efa.woff2 +0 -0
  1069. package/src/styles/fonts/noto-serif-kr/700/1be602ad456b0d75902d352116cb35fd.woff2 +0 -0
  1070. package/src/styles/fonts/noto-serif-kr/700/2612c60f9dc5459ac42763591240a1d6.woff2 +0 -0
  1071. package/src/styles/fonts/noto-serif-kr/700/2ab8cf1f23a5ac7939a7876054e711a7.woff2 +0 -0
  1072. package/src/styles/fonts/noto-serif-kr/700/34e6750e00c3a911ef87dc66b336594d.woff2 +0 -0
  1073. package/src/styles/fonts/noto-serif-kr/700/36f3df4730cfca4fc77fe52b52e6a126.woff2 +0 -0
  1074. package/src/styles/fonts/noto-serif-kr/700/37887deb7a9c466cf2af6ee7ff372ea6.woff2 +0 -0
  1075. package/src/styles/fonts/noto-serif-kr/700/3aba89c4d4281553078de4622b498cbb.woff2 +0 -0
  1076. package/src/styles/fonts/noto-serif-kr/700/3d88558097559d775231194d43745ba7.woff2 +0 -0
  1077. package/src/styles/fonts/noto-serif-kr/700/3dc3e8c35524cad2d1236f3393104ccf.woff2 +0 -0
  1078. package/src/styles/fonts/noto-serif-kr/700/45140742dfa8686b58db2899ce89f89a.woff2 +0 -0
  1079. package/src/styles/fonts/noto-serif-kr/700/469d2754e315e77270c12fa0ab28026c.woff2 +0 -0
  1080. package/src/styles/fonts/noto-serif-kr/700/4c0760284569b87d8f2290c324953973.woff2 +0 -0
  1081. package/src/styles/fonts/noto-serif-kr/700/4cba92c942694bdc479bc54101bb1aa4.woff2 +0 -0
  1082. package/src/styles/fonts/noto-serif-kr/700/4e7d263c30bb48604069a3b4404d4eeb.woff2 +0 -0
  1083. package/src/styles/fonts/noto-serif-kr/700/5279c7e465d9871edf51fd02e691eee7.woff2 +0 -0
  1084. package/src/styles/fonts/noto-serif-kr/700/54bfdb6f21f9d6191e5100580239e14f.woff2 +0 -0
  1085. package/src/styles/fonts/noto-serif-kr/700/56be5e32fd01668fe5ba814d94905839.woff2 +0 -0
  1086. package/src/styles/fonts/noto-serif-kr/700/615b38e0b5bb3ea68426f44f47706e6f.woff2 +0 -0
  1087. package/src/styles/fonts/noto-serif-kr/700/65e9c4585d71bf48a5c62f367010da16.woff2 +0 -0
  1088. package/src/styles/fonts/noto-serif-kr/700/6b75213eb0be40ce84241eb2bb438a2e.woff2 +0 -0
  1089. package/src/styles/fonts/noto-serif-kr/700/7520ca6ca8c60eb1e62d50e71c8d30f1.woff2 +0 -0
  1090. package/src/styles/fonts/noto-serif-kr/700/759a647b77791b1e98f99bc0ab5317a7.woff2 +0 -0
  1091. package/src/styles/fonts/noto-serif-kr/700/76e51630143b95b6322ef93ad330da7a.woff2 +0 -0
  1092. package/src/styles/fonts/noto-serif-kr/700/79aa7c8c842c4a27cf57c0a3a1ffca5a.woff2 +0 -0
  1093. package/src/styles/fonts/noto-serif-kr/700/7cc72fd2c9105560422b6a67c6162945.woff2 +0 -0
  1094. package/src/styles/fonts/noto-serif-kr/700/7d0ea0690e432462f4d05a23d720ec19.woff2 +0 -0
  1095. package/src/styles/fonts/noto-serif-kr/700/7dffa5c1bec57e0903fd62357401ff1a.woff2 +0 -0
  1096. package/src/styles/fonts/noto-serif-kr/700/82f6ccc063960eed1cdfd1d61ada8862.woff2 +0 -0
  1097. package/src/styles/fonts/noto-serif-kr/700/845b4b67564d62cf5cad242f7ac08ea5.woff2 +0 -0
  1098. package/src/styles/fonts/noto-serif-kr/700/84c8e7bc0931008ed91f44ed12dfea94.woff2 +0 -0
  1099. package/src/styles/fonts/noto-serif-kr/700/887a11290ba78b1e66c6d2f67043005e.woff2 +0 -0
  1100. package/src/styles/fonts/noto-serif-kr/700/88db1d042074fb6e66821ffc10941930.woff2 +0 -0
  1101. package/src/styles/fonts/noto-serif-kr/700/8dc18c0cebe6aa4bf4c45dbb831048ab.woff2 +0 -0
  1102. package/src/styles/fonts/noto-serif-kr/700/919a879bd2d580d8491a31a449390689.woff2 +0 -0
  1103. package/src/styles/fonts/noto-serif-kr/700/91da6cb174bebfb96976e2f1316be2fe.woff2 +0 -0
  1104. package/src/styles/fonts/noto-serif-kr/700/934dfdbed2bb2c4b6129199d699a34fa.woff2 +0 -0
  1105. package/src/styles/fonts/noto-serif-kr/700/97d7a17234f2b5030ae9697ae00aded2.woff2 +0 -0
  1106. package/src/styles/fonts/noto-serif-kr/700/995c4fda62d25c3b79dd5987737df6ae.woff2 +0 -0
  1107. package/src/styles/fonts/noto-serif-kr/700/9d0afa53dc2f92ba42024f55f11f6779.woff2 +0 -0
  1108. package/src/styles/fonts/noto-serif-kr/700/9e13a47242926f1cd7d68c08d9ef8889.woff2 +0 -0
  1109. package/src/styles/fonts/noto-serif-kr/700/a379ada89abd750c587ded29f77e731c.woff2 +0 -0
  1110. package/src/styles/fonts/noto-serif-kr/700/a48be56ce5d3a99dc8f8331398004412.woff2 +0 -0
  1111. package/src/styles/fonts/noto-serif-kr/700/a806759e72987951d6d08b7cbdf36a1b.woff2 +0 -0
  1112. package/src/styles/fonts/noto-serif-kr/700/a88481ec8bc7be11cb66e46781a79bb9.woff2 +0 -0
  1113. package/src/styles/fonts/noto-serif-kr/700/a9a016d4a93409f65278327e8a8bb38d.woff2 +0 -0
  1114. package/src/styles/fonts/noto-serif-kr/700/ab92d41062a7644faa45f50bf384454a.woff2 +0 -0
  1115. package/src/styles/fonts/noto-serif-kr/700/b326a8a9c33b554db570da94f60bc380.woff2 +0 -0
  1116. package/src/styles/fonts/noto-serif-kr/700/b6117ff2993b11bb1fdc7ea3588a010c.woff2 +0 -0
  1117. package/src/styles/fonts/noto-serif-kr/700/b61982951bd51b724143c30dfaaa9fe9.woff2 +0 -0
  1118. package/src/styles/fonts/noto-serif-kr/700/c0098958e20db68cab90097b5e62516f.woff2 +0 -0
  1119. package/src/styles/fonts/noto-serif-kr/700/c4bfaa5e50798246e3770718b7a7c84a.woff2 +0 -0
  1120. package/src/styles/fonts/noto-serif-kr/700/c84598999133455503042e06f4ab79cb.woff2 +0 -0
  1121. package/src/styles/fonts/noto-serif-kr/700/ca9a533988d7019597a60d4e17127e0c.woff2 +0 -0
  1122. package/src/styles/fonts/noto-serif-kr/700/cf2b28f90f47276f7e2688a65e88a101.woff2 +0 -0
  1123. package/src/styles/fonts/noto-serif-kr/700/d689b1861d7e4377dd72ad3013482612.woff2 +0 -0
  1124. package/src/styles/fonts/noto-serif-kr/700/d9047070d72a816b3dba9d40c2d85e69.woff2 +0 -0
  1125. package/src/styles/fonts/noto-serif-kr/700/da04549f3f4ed28076b01b8cd710d313.woff2 +0 -0
  1126. package/src/styles/fonts/noto-serif-kr/700/da7af303f8c645f9a9dbae0e6e32dd35.woff2 +0 -0
  1127. package/src/styles/fonts/noto-serif-kr/700/df9568257eb29b156449fdd4bec5ec76.woff2 +0 -0
  1128. package/src/styles/fonts/noto-serif-kr/700/e067cd0ed76c90cd0a93c9339253f20b.woff2 +0 -0
  1129. package/src/styles/fonts/noto-serif-kr/700/e08b07772e7bed3cec2832d43f7fd339.woff2 +0 -0
  1130. package/src/styles/fonts/noto-serif-kr/700/e12150d5a39b30be8f567968c7a527b0.woff2 +0 -0
  1131. package/src/styles/fonts/noto-serif-kr/700/e53fcb2381eee345db4f6f973dd95a3e.woff2 +0 -0
  1132. package/src/styles/fonts/noto-serif-kr/700/e5bd313ef81f687d398aacb11cec3069.woff2 +0 -0
  1133. package/src/styles/fonts/noto-serif-kr/700/eb5afb3d952b8593782caec6026514b6.woff2 +0 -0
  1134. package/src/styles/fonts/noto-serif-kr/700/edd6a4f608d04fc0351d7688cfc321e4.woff2 +0 -0
  1135. package/src/styles/fonts/noto-serif-kr/700/f9695c6c4df2bf6bc03045ff79d4f01f.woff2 +0 -0
  1136. package/src/styles/fonts/noto-serif-kr/700/fada6eaa68ff8816afe43d2a36c5423e.woff2 +0 -0
  1137. package/src/styles/fonts/noto-serif-kr/700/fbcc4bf5367218951172bdee6f77d7a6.woff2 +0 -0
  1138. package/src/styles/fonts/noto-serif-kr/noto-serif-kr.css +0 -2601
  1139. package/src/styles/fonts/noto-serif-sc/400/02629e5d0a9860b7fe32ec1f0563213a.woff2 +0 -0
  1140. package/src/styles/fonts/noto-serif-sc/400/031089da45fbfb7dc18ac827bef4c56e.woff2 +0 -0
  1141. package/src/styles/fonts/noto-serif-sc/400/03ac785139320b7b13bac9c150bf72bf.woff2 +0 -0
  1142. package/src/styles/fonts/noto-serif-sc/400/0b1f83a3c7e715560a55ad9eb0fb1c94.woff2 +0 -0
  1143. package/src/styles/fonts/noto-serif-sc/400/14b040a2dda256936bc7b3470e548394.woff2 +0 -0
  1144. package/src/styles/fonts/noto-serif-sc/400/189f272ea2600c74d576b7b15c014922.woff2 +0 -0
  1145. package/src/styles/fonts/noto-serif-sc/400/1fbccc182322b513f57cd156a9a491b0.woff2 +0 -0
  1146. package/src/styles/fonts/noto-serif-sc/400/21e0a71d86be7b8a9e812e7af09dd061.woff2 +0 -0
  1147. package/src/styles/fonts/noto-serif-sc/400/265e048cc9f2f8a711ba585a534d5351.woff2 +0 -0
  1148. package/src/styles/fonts/noto-serif-sc/400/2ae2ca951489c9d50cde5b36a2a5515b.woff2 +0 -0
  1149. package/src/styles/fonts/noto-serif-sc/400/2ba802b14f21a58fc61606c88fa93373.woff2 +0 -0
  1150. package/src/styles/fonts/noto-serif-sc/400/2deb444546774c3a3ab38c75eb69cdfb.woff2 +0 -0
  1151. package/src/styles/fonts/noto-serif-sc/400/2fbccf9a3853eb59db1a825e044515fd.woff2 +0 -0
  1152. package/src/styles/fonts/noto-serif-sc/400/2ff009fa8701505d7f3dc6c83763f019.woff2 +0 -0
  1153. package/src/styles/fonts/noto-serif-sc/400/31424fe5d54692e7c8b38021ccb8597c.woff2 +0 -0
  1154. package/src/styles/fonts/noto-serif-sc/400/360c190344c26278bbc50e2f4d6a2b3f.woff2 +0 -0
  1155. package/src/styles/fonts/noto-serif-sc/400/39b0bbc910af9d2d6dcd8bd4abd6387d.woff2 +0 -0
  1156. package/src/styles/fonts/noto-serif-sc/400/3adc8f6350cf5067bcb6dc5e44c45d41.woff2 +0 -0
  1157. package/src/styles/fonts/noto-serif-sc/400/3bed5bd57de8f738e53cddaea88983d9.woff2 +0 -0
  1158. package/src/styles/fonts/noto-serif-sc/400/3c201fd8d1bb20abe7d06b940e83a4d9.woff2 +0 -0
  1159. package/src/styles/fonts/noto-serif-sc/400/3d385ea0880df7204258e290648ec012.woff2 +0 -0
  1160. package/src/styles/fonts/noto-serif-sc/400/3dc1a4f0d7af59e16b5162a2b077a442.woff2 +0 -0
  1161. package/src/styles/fonts/noto-serif-sc/400/3dc68e473fe23bd076dd46785cd23583.woff2 +0 -0
  1162. package/src/styles/fonts/noto-serif-sc/400/435b7dca567809813fcb395a27ed83a0.woff2 +0 -0
  1163. package/src/styles/fonts/noto-serif-sc/400/43693195e775d515689fa035394067fd.woff2 +0 -0
  1164. package/src/styles/fonts/noto-serif-sc/400/43fb49e5b79ee7e553869d84e6e08b1e.woff2 +0 -0
  1165. package/src/styles/fonts/noto-serif-sc/400/44dcbbc3cc8f22e613b342d691511ab6.woff2 +0 -0
  1166. package/src/styles/fonts/noto-serif-sc/400/474fac21b12b7efd71f7c321578878b0.woff2 +0 -0
  1167. package/src/styles/fonts/noto-serif-sc/400/4a23fe6e82fd496b5eb20401b6164efe.woff2 +0 -0
  1168. package/src/styles/fonts/noto-serif-sc/400/4bc743968cf1c3ce5711de67ef1ccc4d.woff2 +0 -0
  1169. package/src/styles/fonts/noto-serif-sc/400/4cf0f292f3358bd2f73b1cf4ec1476f3.woff2 +0 -0
  1170. package/src/styles/fonts/noto-serif-sc/400/501f66f24bce8234441954de1b568403.woff2 +0 -0
  1171. package/src/styles/fonts/noto-serif-sc/400/53a88404451448cd2e620a0ca0e45a20.woff2 +0 -0
  1172. package/src/styles/fonts/noto-serif-sc/400/557cd00c5d6827e13d72a0c71b23587b.woff2 +0 -0
  1173. package/src/styles/fonts/noto-serif-sc/400/563fa31542d553f25abab65cf7f81e1d.woff2 +0 -0
  1174. package/src/styles/fonts/noto-serif-sc/400/56e1c4734bbbb38af2fbc262bf6e98f2.woff2 +0 -0
  1175. package/src/styles/fonts/noto-serif-sc/400/5947f5da5da9a352a2b534ee64bfc29a.woff2 +0 -0
  1176. package/src/styles/fonts/noto-serif-sc/400/5a10741e41259e235841440394c0763d.woff2 +0 -0
  1177. package/src/styles/fonts/noto-serif-sc/400/60d8b0805a0a8c54a6cca216004beff5.woff2 +0 -0
  1178. package/src/styles/fonts/noto-serif-sc/400/61bf4287453da4025d03fa6b2dba66ca.woff2 +0 -0
  1179. package/src/styles/fonts/noto-serif-sc/400/638369541268ed5a10af97ad77498c73.woff2 +0 -0
  1180. package/src/styles/fonts/noto-serif-sc/400/687d0f0f90a9b23e40102e16ad8e9836.woff2 +0 -0
  1181. package/src/styles/fonts/noto-serif-sc/400/6e2164fad867d166de2e5b274f04a563.woff2 +0 -0
  1182. package/src/styles/fonts/noto-serif-sc/400/6eefc9d430171c1e1e4034ecadee31c8.woff2 +0 -0
  1183. package/src/styles/fonts/noto-serif-sc/400/71eafb8fbe3a734283517e230ad8b6db.woff2 +0 -0
  1184. package/src/styles/fonts/noto-serif-sc/400/751f54dbb115140d5b645a6ba4aff5d3.woff2 +0 -0
  1185. package/src/styles/fonts/noto-serif-sc/400/7609e7e74dd4d916a7abc7ecc7d95f7e.woff2 +0 -0
  1186. package/src/styles/fonts/noto-serif-sc/400/76b9d6fe838ae4151d95ce7200aa2bf6.woff2 +0 -0
  1187. package/src/styles/fonts/noto-serif-sc/400/78ce29fed872e44fc9014d94875d2aac.woff2 +0 -0
  1188. package/src/styles/fonts/noto-serif-sc/400/79a85a253e9b3f12d2e2cb15e16b3003.woff2 +0 -0
  1189. package/src/styles/fonts/noto-serif-sc/400/7caa14a095a6bc313aab780fe4ff7999.woff2 +0 -0
  1190. package/src/styles/fonts/noto-serif-sc/400/7d138084cf03c14116b11297fce0e3e3.woff2 +0 -0
  1191. package/src/styles/fonts/noto-serif-sc/400/880162ae92cd9e120eb4e4e11fae459d.woff2 +0 -0
  1192. package/src/styles/fonts/noto-serif-sc/400/8f2b960c2823670e94f5b08aa65657e6.woff2 +0 -0
  1193. package/src/styles/fonts/noto-serif-sc/400/8f89f57230d184f92a36e241874229d7.woff2 +0 -0
  1194. package/src/styles/fonts/noto-serif-sc/400/9180de34b48b325200a97e267befff32.woff2 +0 -0
  1195. package/src/styles/fonts/noto-serif-sc/400/95df3b9f681d9df411c30aea5b24f2e0.woff2 +0 -0
  1196. package/src/styles/fonts/noto-serif-sc/400/975af5a496e8d87d821910aa9fe4d598.woff2 +0 -0
  1197. package/src/styles/fonts/noto-serif-sc/400/97a874bbf55ce89a4ab7cd27c7e938b1.woff2 +0 -0
  1198. package/src/styles/fonts/noto-serif-sc/400/9fd53607094e329fa8e5c785b3ff0f1a.woff2 +0 -0
  1199. package/src/styles/fonts/noto-serif-sc/400/a578742770fcd2226e3c45b5b6efdcb0.woff2 +0 -0
  1200. package/src/styles/fonts/noto-serif-sc/400/ae401fb4db80d5ff5cd3f8d9bc811070.woff2 +0 -0
  1201. package/src/styles/fonts/noto-serif-sc/400/b0ab3a7f319ce6dd3c9a4de2674e7c72.woff2 +0 -0
  1202. package/src/styles/fonts/noto-serif-sc/400/b159deb135e9946eea0572d52778170b.woff2 +0 -0
  1203. package/src/styles/fonts/noto-serif-sc/400/b91450304d9ac44f5c6e0da0792e055d.woff2 +0 -0
  1204. package/src/styles/fonts/noto-serif-sc/400/baa325551b381c5e035ef143e56d4abe.woff2 +0 -0
  1205. package/src/styles/fonts/noto-serif-sc/400/c0c7836749e585cee24ab2f8457c5b01.woff2 +0 -0
  1206. package/src/styles/fonts/noto-serif-sc/400/c2ac4ef1860812036ca2b8c4e4089bdc.woff2 +0 -0
  1207. package/src/styles/fonts/noto-serif-sc/400/c31019c08bd22464f7a88f090281404c.woff2 +0 -0
  1208. package/src/styles/fonts/noto-serif-sc/400/c57ee3b49b7e45b995539a6b2c51f138.woff2 +0 -0
  1209. package/src/styles/fonts/noto-serif-sc/400/cd75ca47da9ae4c0899e37d4c543319b.woff2 +0 -0
  1210. package/src/styles/fonts/noto-serif-sc/400/d12ce1d8445213317f9163283e58a05d.woff2 +0 -0
  1211. package/src/styles/fonts/noto-serif-sc/400/d28fb13acf9ced9f0657fd4012c81cd2.woff2 +0 -0
  1212. package/src/styles/fonts/noto-serif-sc/400/d3714e6b90de8e2085dfb2514464dd6a.woff2 +0 -0
  1213. package/src/styles/fonts/noto-serif-sc/400/d3beff96216c8af1aa79246476b6a323.woff2 +0 -0
  1214. package/src/styles/fonts/noto-serif-sc/400/d3e311f30c811dc339c262a79a51877e.woff2 +0 -0
  1215. package/src/styles/fonts/noto-serif-sc/400/d51f4cdc83711e510f5d25f03235597e.woff2 +0 -0
  1216. package/src/styles/fonts/noto-serif-sc/400/d5df4a8dfd4328c67d933b3912c6ad0f.woff2 +0 -0
  1217. package/src/styles/fonts/noto-serif-sc/400/dccda6a2e2db3b530788bdfa2acd1979.woff2 +0 -0
  1218. package/src/styles/fonts/noto-serif-sc/400/f5237486197aeff59341a1ff38b8eff8.woff2 +0 -0
  1219. package/src/styles/fonts/noto-serif-sc/400/f553d54ef931066712d8f3f0ce018e1b.woff2 +0 -0
  1220. package/src/styles/fonts/noto-serif-sc/400/f649cba8e14c33d6bf2265483b14b895.woff2 +0 -0
  1221. package/src/styles/fonts/noto-serif-sc/400/f6839df1bf7cb4dc8d27e5ea55bbe633.woff2 +0 -0
  1222. package/src/styles/fonts/noto-serif-sc/400/f6b7304e028980f77a7f7007bb540abd.woff2 +0 -0
  1223. package/src/styles/fonts/noto-serif-sc/400/f8db8bef0a6e1178835d350ae0d384a1.woff2 +0 -0
  1224. package/src/styles/fonts/noto-serif-sc/400/fb4649a82c50620773d79820e2e5ff13.woff2 +0 -0
  1225. package/src/styles/fonts/noto-serif-sc/400/fb9402d6c6357a825affc402f14d5a7e.woff2 +0 -0
  1226. package/src/styles/fonts/noto-serif-sc/700/0041f681602cc834bb5c55ced0155b8e.woff2 +0 -0
  1227. package/src/styles/fonts/noto-serif-sc/700/00c9ac960d866ffaf8a866e5939024e2.woff2 +0 -0
  1228. package/src/styles/fonts/noto-serif-sc/700/02e48e353415a00e0f556608cab33a43.woff2 +0 -0
  1229. package/src/styles/fonts/noto-serif-sc/700/02faf6bb0ab4d56ada037c0bbaf9b9f7.woff2 +0 -0
  1230. package/src/styles/fonts/noto-serif-sc/700/057a3d44d7fc606f113d863376d0ecf0.woff2 +0 -0
  1231. package/src/styles/fonts/noto-serif-sc/700/10f2b44b3711d3f5bdcc30d373b543d1.woff2 +0 -0
  1232. package/src/styles/fonts/noto-serif-sc/700/14c1506106d92621bafb11016735194e.woff2 +0 -0
  1233. package/src/styles/fonts/noto-serif-sc/700/154a2c266902003bd8b7449386b10776.woff2 +0 -0
  1234. package/src/styles/fonts/noto-serif-sc/700/19e39850472250bfdbce654d30859879.woff2 +0 -0
  1235. package/src/styles/fonts/noto-serif-sc/700/1b5d0d740450fb996749464c9b882025.woff2 +0 -0
  1236. package/src/styles/fonts/noto-serif-sc/700/1bca0a2a8840ad0ee9414940593db144.woff2 +0 -0
  1237. package/src/styles/fonts/noto-serif-sc/700/1cda27dcaab977ae4ef5d5ab2a10ae03.woff2 +0 -0
  1238. package/src/styles/fonts/noto-serif-sc/700/1f4bc38a1c50f55f335f5411cae47696.woff2 +0 -0
  1239. package/src/styles/fonts/noto-serif-sc/700/2022cf097cb952d9fe75b53b4587d2c3.woff2 +0 -0
  1240. package/src/styles/fonts/noto-serif-sc/700/2240a3c43ca5ef59ae3c348c7884792f.woff2 +0 -0
  1241. package/src/styles/fonts/noto-serif-sc/700/280e3d2b58e9ad3501816072e01b0c13.woff2 +0 -0
  1242. package/src/styles/fonts/noto-serif-sc/700/2874d07e228da9583b0e73646dacd498.woff2 +0 -0
  1243. package/src/styles/fonts/noto-serif-sc/700/29d49891713a2785a3a383001cf58c59.woff2 +0 -0
  1244. package/src/styles/fonts/noto-serif-sc/700/2d81eb6ab0ebbc0cabfb3a3341ba8800.woff2 +0 -0
  1245. package/src/styles/fonts/noto-serif-sc/700/3179006d1c7ebfa50d27482a2859d9a0.woff2 +0 -0
  1246. package/src/styles/fonts/noto-serif-sc/700/34c2edb3c37f71258f5c4a31091f0c6c.woff2 +0 -0
  1247. package/src/styles/fonts/noto-serif-sc/700/389a950f2a1211946d294716e679e381.woff2 +0 -0
  1248. package/src/styles/fonts/noto-serif-sc/700/42a74b6a625bbf0a9616ed4db3152c88.woff2 +0 -0
  1249. package/src/styles/fonts/noto-serif-sc/700/457485e72835364662dfead6281638c1.woff2 +0 -0
  1250. package/src/styles/fonts/noto-serif-sc/700/488846410760fe128dae939836ca5423.woff2 +0 -0
  1251. package/src/styles/fonts/noto-serif-sc/700/48eb0a91e50c7f026e248c64145e72af.woff2 +0 -0
  1252. package/src/styles/fonts/noto-serif-sc/700/4b0e79ba18b2ce424fa93e84996d7cba.woff2 +0 -0
  1253. package/src/styles/fonts/noto-serif-sc/700/54e301f412730f391225db59dae1c8d5.woff2 +0 -0
  1254. package/src/styles/fonts/noto-serif-sc/700/597d69d0710e0178b162afb0a0c20401.woff2 +0 -0
  1255. package/src/styles/fonts/noto-serif-sc/700/5cc23a76e122d0ad2f7cede41bc35b27.woff2 +0 -0
  1256. package/src/styles/fonts/noto-serif-sc/700/5d48855bed5f3554eff91b573d7376ac.woff2 +0 -0
  1257. package/src/styles/fonts/noto-serif-sc/700/5ddcbe564b29ef08632e1aeb33455435.woff2 +0 -0
  1258. package/src/styles/fonts/noto-serif-sc/700/605667a998e91e2b6a4a3cd7c31fe5a9.woff2 +0 -0
  1259. package/src/styles/fonts/noto-serif-sc/700/67f32ceea9e78e5109f87724ad886010.woff2 +0 -0
  1260. package/src/styles/fonts/noto-serif-sc/700/68f2fab82ec8e9291f08c3145111549c.woff2 +0 -0
  1261. package/src/styles/fonts/noto-serif-sc/700/69519ada3f3f74ca20aacb8af48ab6b4.woff2 +0 -0
  1262. package/src/styles/fonts/noto-serif-sc/700/6a6e884fb2b65ec5b4a3d5ecd0d01a6a.woff2 +0 -0
  1263. package/src/styles/fonts/noto-serif-sc/700/6e1a8b45b01939088c3a8cfcf8c10681.woff2 +0 -0
  1264. package/src/styles/fonts/noto-serif-sc/700/70adaf50c56d5ff859c64d35e0f1e34e.woff2 +0 -0
  1265. package/src/styles/fonts/noto-serif-sc/700/72ee453ac0e19bd2c631c8921c44e3de.woff2 +0 -0
  1266. package/src/styles/fonts/noto-serif-sc/700/753b5f6fb254bacb6618ace25af3df60.woff2 +0 -0
  1267. package/src/styles/fonts/noto-serif-sc/700/76d4244186d118eea245d1385a4de2ec.woff2 +0 -0
  1268. package/src/styles/fonts/noto-serif-sc/700/7a86b155111ba20f3e87306ff6beac77.woff2 +0 -0
  1269. package/src/styles/fonts/noto-serif-sc/700/7b1e76975b0984e6f83e3f9f8069e784.woff2 +0 -0
  1270. package/src/styles/fonts/noto-serif-sc/700/7b6c60131822a0e4d36d980d52509d4e.woff2 +0 -0
  1271. package/src/styles/fonts/noto-serif-sc/700/7cbda564cb2dd4799ab9e89d51286aa7.woff2 +0 -0
  1272. package/src/styles/fonts/noto-serif-sc/700/7f60eefa15956d6f06dd92404887d58c.woff2 +0 -0
  1273. package/src/styles/fonts/noto-serif-sc/700/7f8c15e0ecb102738981d9fa4cb6b921.woff2 +0 -0
  1274. package/src/styles/fonts/noto-serif-sc/700/812b5a4b87f3a7b4afc1cfebc864f413.woff2 +0 -0
  1275. package/src/styles/fonts/noto-serif-sc/700/812dfb7f8144d01b3cc9d5ce0b472f40.woff2 +0 -0
  1276. package/src/styles/fonts/noto-serif-sc/700/84742b1ede4f0bb6d27131298eba21b4.woff2 +0 -0
  1277. package/src/styles/fonts/noto-serif-sc/700/8555f0285e3d28e95e2fc0ccccd9caff.woff2 +0 -0
  1278. package/src/styles/fonts/noto-serif-sc/700/8e04e64c8f68d292a18d4160fbde8671.woff2 +0 -0
  1279. package/src/styles/fonts/noto-serif-sc/700/958efb9b2fa2ea0008ffef009885f9f8.woff2 +0 -0
  1280. package/src/styles/fonts/noto-serif-sc/700/9ca9b71010a5faeee7047ef97aeee13b.woff2 +0 -0
  1281. package/src/styles/fonts/noto-serif-sc/700/9cd0b77920b9d6c64eb686493123fc76.woff2 +0 -0
  1282. package/src/styles/fonts/noto-serif-sc/700/9ebd27835ffcbd794e67151ab046ce68.woff2 +0 -0
  1283. package/src/styles/fonts/noto-serif-sc/700/a077f51cfb5cffb4ff4d8e229c0e9e79.woff2 +0 -0
  1284. package/src/styles/fonts/noto-serif-sc/700/a397997b579d3945c9c70a979c17a8ad.woff2 +0 -0
  1285. package/src/styles/fonts/noto-serif-sc/700/a68d9d5027803832bb28e78cdcd04949.woff2 +0 -0
  1286. package/src/styles/fonts/noto-serif-sc/700/a904b05966368bcf90b632c7c2e5f76b.woff2 +0 -0
  1287. package/src/styles/fonts/noto-serif-sc/700/aa218a2c45f3749537ce876201e5152b.woff2 +0 -0
  1288. package/src/styles/fonts/noto-serif-sc/700/aa28db16818f9eaa8c817f289e1c3270.woff2 +0 -0
  1289. package/src/styles/fonts/noto-serif-sc/700/aa96d698491c2540e2dcf7009c65c456.woff2 +0 -0
  1290. package/src/styles/fonts/noto-serif-sc/700/ae25c41034ddc1a9e0b41f5034c9aa4b.woff2 +0 -0
  1291. package/src/styles/fonts/noto-serif-sc/700/ae289ae3f8cdb54a3a6c07174517afec.woff2 +0 -0
  1292. package/src/styles/fonts/noto-serif-sc/700/b02dfa2aa52cbdb1b2f11a9f44335469.woff2 +0 -0
  1293. package/src/styles/fonts/noto-serif-sc/700/b2e326f7f9b807451bf9c745df747efe.woff2 +0 -0
  1294. package/src/styles/fonts/noto-serif-sc/700/c33c59feccf391f0c5f1f5d24e36d1fe.woff2 +0 -0
  1295. package/src/styles/fonts/noto-serif-sc/700/c82fd9456d7465b5e5bd3659e9b14c55.woff2 +0 -0
  1296. package/src/styles/fonts/noto-serif-sc/700/c90b7b65d2b9696fbf3a506738f94d68.woff2 +0 -0
  1297. package/src/styles/fonts/noto-serif-sc/700/cba6ad3981cb7861428d4be169ee8124.woff2 +0 -0
  1298. package/src/styles/fonts/noto-serif-sc/700/cc26525aa2af1f0b929af32ce50a7fba.woff2 +0 -0
  1299. package/src/styles/fonts/noto-serif-sc/700/cd0e7b51eddb22a77a09b025c0281434.woff2 +0 -0
  1300. package/src/styles/fonts/noto-serif-sc/700/cd6d074f3957d58bac58437fc97e5e33.woff2 +0 -0
  1301. package/src/styles/fonts/noto-serif-sc/700/cef249b6d013fb0cc0d574176bc23811.woff2 +0 -0
  1302. package/src/styles/fonts/noto-serif-sc/700/d0bd387fda28e58d3c9b3efa2468dd8a.woff2 +0 -0
  1303. package/src/styles/fonts/noto-serif-sc/700/da93ae099ff3b7aae27b3f674d3fc721.woff2 +0 -0
  1304. package/src/styles/fonts/noto-serif-sc/700/e264213b9e102dabc603adb6e4fda5e6.woff2 +0 -0
  1305. package/src/styles/fonts/noto-serif-sc/700/e7c7ef3669ae48c0a736f06ca471e1d7.woff2 +0 -0
  1306. package/src/styles/fonts/noto-serif-sc/700/e81a742cacef744130c40de1b90837d8.woff2 +0 -0
  1307. package/src/styles/fonts/noto-serif-sc/700/e8b755172122d1d0a5dd453e96b0ff24.woff2 +0 -0
  1308. package/src/styles/fonts/noto-serif-sc/700/e99280299c305402eaa5271a3e36c49b.woff2 +0 -0
  1309. package/src/styles/fonts/noto-serif-sc/700/e9c66b085052ece66bfadf45f711d3e1.woff2 +0 -0
  1310. package/src/styles/fonts/noto-serif-sc/700/ed7c6dafaa6d8bcf015ef0ca574837df.woff2 +0 -0
  1311. package/src/styles/fonts/noto-serif-sc/700/f2900a1d30c3a33129f4e2225669bd0e.woff2 +0 -0
  1312. package/src/styles/fonts/noto-serif-sc/700/fa7d3b99744d7f2dc9e00864a97a62d6.woff2 +0 -0
  1313. package/src/styles/fonts/noto-serif-sc/700/fb0e90665980954719c2eb685b130bc0.woff2 +0 -0
  1314. package/src/styles/fonts/noto-serif-sc/noto-serif-sc.css +0 -3615
  1315. package/src/styles/fonts/noto-serif-tc/400/008ea9091e332c639ceb18874eacd60c.woff2 +0 -0
  1316. package/src/styles/fonts/noto-serif-tc/400/053bd3d7aec0040d0cc50c261a1f4e3e.woff2 +0 -0
  1317. package/src/styles/fonts/noto-serif-tc/400/0713613227cc4c686c45a279f8bdc166.woff2 +0 -0
  1318. package/src/styles/fonts/noto-serif-tc/400/0e97f44ebc65384c346fe19bcc52fa20.woff2 +0 -0
  1319. package/src/styles/fonts/noto-serif-tc/400/1139d32ae2bdeb26c0c8f31330aa9a9f.woff2 +0 -0
  1320. package/src/styles/fonts/noto-serif-tc/400/15f8c0df47fd639d1b0d9bd5cf507c9b.woff2 +0 -0
  1321. package/src/styles/fonts/noto-serif-tc/400/1668bd859ffe15bed7d5563117d8d5fb.woff2 +0 -0
  1322. package/src/styles/fonts/noto-serif-tc/400/190e3f8632494e7c095117f26b1c811e.woff2 +0 -0
  1323. package/src/styles/fonts/noto-serif-tc/400/19ad151c22ce1befe0a9ea643fbee570.woff2 +0 -0
  1324. package/src/styles/fonts/noto-serif-tc/400/1c820b5295868008ca7c78afa5b7655d.woff2 +0 -0
  1325. package/src/styles/fonts/noto-serif-tc/400/1fbe225742c69f4ba9ea5f74922f0ca1.woff2 +0 -0
  1326. package/src/styles/fonts/noto-serif-tc/400/2a7cedfcd6e4c7cec36f4fd7b0f329c2.woff2 +0 -0
  1327. package/src/styles/fonts/noto-serif-tc/400/2acea04a920f6af31e7db97052f563c6.woff2 +0 -0
  1328. package/src/styles/fonts/noto-serif-tc/400/2e98b666924b8e0a09d1aeeefd24bdd2.woff2 +0 -0
  1329. package/src/styles/fonts/noto-serif-tc/400/2fd3fceb6faed5e3db768e88d7614dca.woff2 +0 -0
  1330. package/src/styles/fonts/noto-serif-tc/400/35cf5dd04315e0b906e1a413d7905a2f.woff2 +0 -0
  1331. package/src/styles/fonts/noto-serif-tc/400/387c811226f303af62f1e21aae6f5c83.woff2 +0 -0
  1332. package/src/styles/fonts/noto-serif-tc/400/3b41385fc27419c19822060daa0b5cb3.woff2 +0 -0
  1333. package/src/styles/fonts/noto-serif-tc/400/3cbe4a697fd595ef42c899de7d3e5445.woff2 +0 -0
  1334. package/src/styles/fonts/noto-serif-tc/400/3d83dacbbec3d8532ae9afede21f3aab.woff2 +0 -0
  1335. package/src/styles/fonts/noto-serif-tc/400/47479c470fae70f10b7c964a7ecbf274.woff2 +0 -0
  1336. package/src/styles/fonts/noto-serif-tc/400/4dc0728df0f2ba70796f45f05654c7ba.woff2 +0 -0
  1337. package/src/styles/fonts/noto-serif-tc/400/4dc2bc2c55b47f57d13b63aa6b1c8bd4.woff2 +0 -0
  1338. package/src/styles/fonts/noto-serif-tc/400/4e1cc6aafb411b572c8d3511e925ecf1.woff2 +0 -0
  1339. package/src/styles/fonts/noto-serif-tc/400/5227dbe9933760a48baff21ebd13fc98.woff2 +0 -0
  1340. package/src/styles/fonts/noto-serif-tc/400/526b263e72c189f4b065738aaa6d423a.woff2 +0 -0
  1341. package/src/styles/fonts/noto-serif-tc/400/54da934819a917f561b439bfd10f88b6.woff2 +0 -0
  1342. package/src/styles/fonts/noto-serif-tc/400/5bfc7a121c35ae42623ef804fb525e0e.woff2 +0 -0
  1343. package/src/styles/fonts/noto-serif-tc/400/5f90024544c2907c6c0203c6210c50be.woff2 +0 -0
  1344. package/src/styles/fonts/noto-serif-tc/400/649b12d7cee7bb981842946e4547e6ca.woff2 +0 -0
  1345. package/src/styles/fonts/noto-serif-tc/400/653bef2ed891ae48d8ed712283080649.woff2 +0 -0
  1346. package/src/styles/fonts/noto-serif-tc/400/67d2a81f06ba352f17fbdc3a5e6ea59e.woff2 +0 -0
  1347. package/src/styles/fonts/noto-serif-tc/400/68304f3229cf763465f044fccb5892c0.woff2 +0 -0
  1348. package/src/styles/fonts/noto-serif-tc/400/688a88911e4da17b609196a959b8b930.woff2 +0 -0
  1349. package/src/styles/fonts/noto-serif-tc/400/6db6ddf72c38a78ce44c1327701152e1.woff2 +0 -0
  1350. package/src/styles/fonts/noto-serif-tc/400/77a7533bd21ccd33192d142a93555aa8.woff2 +0 -0
  1351. package/src/styles/fonts/noto-serif-tc/400/7d65a3d6a65050eb5e6eca43398aeba4.woff2 +0 -0
  1352. package/src/styles/fonts/noto-serif-tc/400/7dfc711962c8771f97e7c8898a6bcb65.woff2 +0 -0
  1353. package/src/styles/fonts/noto-serif-tc/400/7ef123b62d530fcba73974fa265e0aae.woff2 +0 -0
  1354. package/src/styles/fonts/noto-serif-tc/400/80466082a896fd328f30a78593c7c568.woff2 +0 -0
  1355. package/src/styles/fonts/noto-serif-tc/400/8a3c84b0df36f851f5fea75ee8757951.woff2 +0 -0
  1356. package/src/styles/fonts/noto-serif-tc/400/8b0c8c9f8cfa9fa090d97c5a5efb1f4c.woff2 +0 -0
  1357. package/src/styles/fonts/noto-serif-tc/400/8dc035a34c76e6515ca203e2df182588.woff2 +0 -0
  1358. package/src/styles/fonts/noto-serif-tc/400/8eb06109812cb80be44f47b8179c2709.woff2 +0 -0
  1359. package/src/styles/fonts/noto-serif-tc/400/904324af375d5fd370af1054355a050e.woff2 +0 -0
  1360. package/src/styles/fonts/noto-serif-tc/400/911a2092d64d6d6494b254d819af2b91.woff2 +0 -0
  1361. package/src/styles/fonts/noto-serif-tc/400/9de02d745b8e25c6411fb152fb067748.woff2 +0 -0
  1362. package/src/styles/fonts/noto-serif-tc/400/9eb33a430058d839ebbe2af4b2e0daa9.woff2 +0 -0
  1363. package/src/styles/fonts/noto-serif-tc/400/9f5a73aa8ba417688019d628f334db07.woff2 +0 -0
  1364. package/src/styles/fonts/noto-serif-tc/400/a0f0c06d5c7a3ffa97706178cce212a8.woff2 +0 -0
  1365. package/src/styles/fonts/noto-serif-tc/400/a38c1830367f784181b6f544b0b11bbd.woff2 +0 -0
  1366. package/src/styles/fonts/noto-serif-tc/400/a9cf85e27428c14351d30eac8cbc8d91.woff2 +0 -0
  1367. package/src/styles/fonts/noto-serif-tc/400/aa0ce6740f301351761a0615cc8b2e99.woff2 +0 -0
  1368. package/src/styles/fonts/noto-serif-tc/400/bc3f0cb8b55ee11d32b94ca488976f8d.woff2 +0 -0
  1369. package/src/styles/fonts/noto-serif-tc/400/bcb3307527d6d0033bf0f17660b91e71.woff2 +0 -0
  1370. package/src/styles/fonts/noto-serif-tc/400/bf1acc86e17b4229c548828a9d6f455d.woff2 +0 -0
  1371. package/src/styles/fonts/noto-serif-tc/400/c3fbc1f2557c343863a10698f8c966a2.woff2 +0 -0
  1372. package/src/styles/fonts/noto-serif-tc/400/c5c1c0be944ea39a3f50a02d32f5b759.woff2 +0 -0
  1373. package/src/styles/fonts/noto-serif-tc/400/c5f1075caf6d1344ee720de85114a521.woff2 +0 -0
  1374. package/src/styles/fonts/noto-serif-tc/400/cae29b3f8951eaf20d2f61c2206e28d9.woff2 +0 -0
  1375. package/src/styles/fonts/noto-serif-tc/400/d043b8d7a48bb0ac59ee1f1477d88eee.woff2 +0 -0
  1376. package/src/styles/fonts/noto-serif-tc/400/d320b000b5978c7251148a6a154741b8.woff2 +0 -0
  1377. package/src/styles/fonts/noto-serif-tc/400/da13b136efb1d1e4c76575af8f79a698.woff2 +0 -0
  1378. package/src/styles/fonts/noto-serif-tc/400/da2cf0ec56bf69374ee37764c7e3ea3d.woff2 +0 -0
  1379. package/src/styles/fonts/noto-serif-tc/400/daf62255dd60679946f28c442ca62533.woff2 +0 -0
  1380. package/src/styles/fonts/noto-serif-tc/400/dd01a1035345f6921a48525b8ce08f06.woff2 +0 -0
  1381. package/src/styles/fonts/noto-serif-tc/400/e4fb59479cedc87ba79785590bf861ca.woff2 +0 -0
  1382. package/src/styles/fonts/noto-serif-tc/400/e5d00355f73293d40b61299459d17ca5.woff2 +0 -0
  1383. package/src/styles/fonts/noto-serif-tc/400/e647b8d2efc501c0cc0e407249cc7135.woff2 +0 -0
  1384. package/src/styles/fonts/noto-serif-tc/400/e6e60ffb2ebd1828628764b507060aea.woff2 +0 -0
  1385. package/src/styles/fonts/noto-serif-tc/400/f00eb499abb94fa7b799d6d8c9b050e9.woff2 +0 -0
  1386. package/src/styles/fonts/noto-serif-tc/400/f7d36ffff7a75c9c6216d576a57dd00d.woff2 +0 -0
  1387. package/src/styles/fonts/noto-serif-tc/400/f7f3f63e7a149cd89eccab3b52171d05.woff2 +0 -0
  1388. package/src/styles/fonts/noto-serif-tc/400/fcc41f6a067ddd658bba5c9dff234a32.woff2 +0 -0
  1389. package/src/styles/fonts/noto-serif-tc/400/fd6ad889fcf3583bd9b0b6db53aad434.woff2 +0 -0
  1390. package/src/styles/fonts/noto-serif-tc/700/0c055db157e7a13f3103cc2a6b67fec3.woff2 +0 -0
  1391. package/src/styles/fonts/noto-serif-tc/700/0d3f5cc265cb6c439c517f2c4cebbddf.woff2 +0 -0
  1392. package/src/styles/fonts/noto-serif-tc/700/1259e5825b314fe2b8bb96d6e8069ee5.woff2 +0 -0
  1393. package/src/styles/fonts/noto-serif-tc/700/12c518ebfe62818af550c08947e359e7.woff2 +0 -0
  1394. package/src/styles/fonts/noto-serif-tc/700/145831a59caa06d894022fe60212ed21.woff2 +0 -0
  1395. package/src/styles/fonts/noto-serif-tc/700/169a096e61d38a773216f51d1ec2cc06.woff2 +0 -0
  1396. package/src/styles/fonts/noto-serif-tc/700/1884a2b22d314c7d57707f03aec348e0.woff2 +0 -0
  1397. package/src/styles/fonts/noto-serif-tc/700/1e2640116bbba817f43c43cc69371cf1.woff2 +0 -0
  1398. package/src/styles/fonts/noto-serif-tc/700/2573703213da30d3ba18925b100b2c2b.woff2 +0 -0
  1399. package/src/styles/fonts/noto-serif-tc/700/26839c0e47c73514b8d8f660d24d6b19.woff2 +0 -0
  1400. package/src/styles/fonts/noto-serif-tc/700/2a22e14a9ad53f2abb3c7e85017b7d12.woff2 +0 -0
  1401. package/src/styles/fonts/noto-serif-tc/700/2b3e8c5703b91f39f6027f43f0da6f4b.woff2 +0 -0
  1402. package/src/styles/fonts/noto-serif-tc/700/2f27ee4fb2cf6a280e110e09c18ef73e.woff2 +0 -0
  1403. package/src/styles/fonts/noto-serif-tc/700/31342cebfa5ea7fac06b4ea372d96bc5.woff2 +0 -0
  1404. package/src/styles/fonts/noto-serif-tc/700/375329ba0b50b94b35006498e555867c.woff2 +0 -0
  1405. package/src/styles/fonts/noto-serif-tc/700/427577dcb707d1d35eebd155b4222aa7.woff2 +0 -0
  1406. package/src/styles/fonts/noto-serif-tc/700/450a5b53be0a8a778bb0b623e86b652f.woff2 +0 -0
  1407. package/src/styles/fonts/noto-serif-tc/700/477866c8396474a17317dcac3e7a014f.woff2 +0 -0
  1408. package/src/styles/fonts/noto-serif-tc/700/478ebdaadda7775c391c5dcab4e697df.woff2 +0 -0
  1409. package/src/styles/fonts/noto-serif-tc/700/48d6a97a185c799be4fe67aaf7edf213.woff2 +0 -0
  1410. package/src/styles/fonts/noto-serif-tc/700/490edb9fc8a4356aea556eed32287464.woff2 +0 -0
  1411. package/src/styles/fonts/noto-serif-tc/700/4c4bdd0b3f3a52e28f3b643c1c5d43be.woff2 +0 -0
  1412. package/src/styles/fonts/noto-serif-tc/700/4c96411f3693a9a8657a9c1190f82bce.woff2 +0 -0
  1413. package/src/styles/fonts/noto-serif-tc/700/4c9aa12aba2a6a57410eacaff7427916.woff2 +0 -0
  1414. package/src/styles/fonts/noto-serif-tc/700/4cca7233bf8ce5dec2e5d146b993d626.woff2 +0 -0
  1415. package/src/styles/fonts/noto-serif-tc/700/4d0a9128d06ea857f203bf5d007b1ab9.woff2 +0 -0
  1416. package/src/styles/fonts/noto-serif-tc/700/4e5384920bbb155d9d8d74887b09ea5b.woff2 +0 -0
  1417. package/src/styles/fonts/noto-serif-tc/700/50cfd672bfa62512ba090420acf35c87.woff2 +0 -0
  1418. package/src/styles/fonts/noto-serif-tc/700/551b1d7a0b80c8d42af09863cdca7f01.woff2 +0 -0
  1419. package/src/styles/fonts/noto-serif-tc/700/555d990ab3fd7d3d66c6d1fa9a82fec5.woff2 +0 -0
  1420. package/src/styles/fonts/noto-serif-tc/700/5979c33a7eb5963bf8e83e46931b5fb5.woff2 +0 -0
  1421. package/src/styles/fonts/noto-serif-tc/700/59966ee0b069b577510fe68c350da0ee.woff2 +0 -0
  1422. package/src/styles/fonts/noto-serif-tc/700/60a14064ed334f0155795d795e926abe.woff2 +0 -0
  1423. package/src/styles/fonts/noto-serif-tc/700/611b62d5fd9698d9b5ce495ba6f14c93.woff2 +0 -0
  1424. package/src/styles/fonts/noto-serif-tc/700/6e83fe0b6e708eaf1c3003d6dee11488.woff2 +0 -0
  1425. package/src/styles/fonts/noto-serif-tc/700/70861376e5d4f92f8aa7aa1b2749b617.woff2 +0 -0
  1426. package/src/styles/fonts/noto-serif-tc/700/7124d150570d39ced8d45507dc11ca1e.woff2 +0 -0
  1427. package/src/styles/fonts/noto-serif-tc/700/79a7fdf7d9c722b5723ae25e6ff8e203.woff2 +0 -0
  1428. package/src/styles/fonts/noto-serif-tc/700/8c8393bc875f1ee36697a2113f4421ea.woff2 +0 -0
  1429. package/src/styles/fonts/noto-serif-tc/700/8e6c9bb43afb8cbbff7cf1055e67c9bd.woff2 +0 -0
  1430. package/src/styles/fonts/noto-serif-tc/700/90ac4f9d2aa02afdace2843b49fc18bb.woff2 +0 -0
  1431. package/src/styles/fonts/noto-serif-tc/700/90b6f57d77847f512fd11db74fa912f1.woff2 +0 -0
  1432. package/src/styles/fonts/noto-serif-tc/700/913759e6690f9fc0746a20b96f4bdcb4.woff2 +0 -0
  1433. package/src/styles/fonts/noto-serif-tc/700/9154e26efe532a85a27d80902f5a2d6c.woff2 +0 -0
  1434. package/src/styles/fonts/noto-serif-tc/700/94e7ed67f1557b76fead6b6e456a0415.woff2 +0 -0
  1435. package/src/styles/fonts/noto-serif-tc/700/95127a92346c04fec1fa81d6295b0a28.woff2 +0 -0
  1436. package/src/styles/fonts/noto-serif-tc/700/9fbc06b2e3ff16b9d705c76db563ef17.woff2 +0 -0
  1437. package/src/styles/fonts/noto-serif-tc/700/a3b929542e6c5a0644b73a7c8a8b6c03.woff2 +0 -0
  1438. package/src/styles/fonts/noto-serif-tc/700/a8857f5d478f101c053ba02d2f223e90.woff2 +0 -0
  1439. package/src/styles/fonts/noto-serif-tc/700/aa64c9953af43ca65832f413895bb433.woff2 +0 -0
  1440. package/src/styles/fonts/noto-serif-tc/700/ada8f0241244c60ec8d3d59ad37f20a5.woff2 +0 -0
  1441. package/src/styles/fonts/noto-serif-tc/700/b341de0bc0bfe194a6c28dcfb566029e.woff2 +0 -0
  1442. package/src/styles/fonts/noto-serif-tc/700/b846c293981ca5429eabaa967f222f26.woff2 +0 -0
  1443. package/src/styles/fonts/noto-serif-tc/700/be64f9379412876e00fd3a0bfa6b6fe9.woff2 +0 -0
  1444. package/src/styles/fonts/noto-serif-tc/700/befed8a4fa817773fa7109db6fe07f56.woff2 +0 -0
  1445. package/src/styles/fonts/noto-serif-tc/700/c09ee2b219982f8d46ad9968b7e6e0ba.woff2 +0 -0
  1446. package/src/styles/fonts/noto-serif-tc/700/c39ec937c6a8d124e8b68cf829ea5ad4.woff2 +0 -0
  1447. package/src/styles/fonts/noto-serif-tc/700/c3fd21315345ae541f6e98067059fa19.woff2 +0 -0
  1448. package/src/styles/fonts/noto-serif-tc/700/c568a16e3168ceb1f191b70022c492ea.woff2 +0 -0
  1449. package/src/styles/fonts/noto-serif-tc/700/c5e66d60be3375835bbd8d6b797f6eac.woff2 +0 -0
  1450. package/src/styles/fonts/noto-serif-tc/700/cd10a3af2133805d8c92104d1ee6ff18.woff2 +0 -0
  1451. package/src/styles/fonts/noto-serif-tc/700/d15a3317942b7d31978a759fbf2222c8.woff2 +0 -0
  1452. package/src/styles/fonts/noto-serif-tc/700/d740dc2e854aaa7b3dcdd3ed25455eeb.woff2 +0 -0
  1453. package/src/styles/fonts/noto-serif-tc/700/d8325ba7ae651bc30440905bd67b95f1.woff2 +0 -0
  1454. package/src/styles/fonts/noto-serif-tc/700/e2204cf85edcb96c5de5c3dcf240da9d.woff2 +0 -0
  1455. package/src/styles/fonts/noto-serif-tc/700/e3e913e145ddcd9323b2a0972967feb6.woff2 +0 -0
  1456. package/src/styles/fonts/noto-serif-tc/700/f2fb1f1fbf7e44afb53c672ec286a22e.woff2 +0 -0
  1457. package/src/styles/fonts/noto-serif-tc/700/f372129c60aaece937cf7b91ee75c9b8.woff2 +0 -0
  1458. package/src/styles/fonts/noto-serif-tc/700/f5d7487963d43c89da63aaf10f2e6fb7.woff2 +0 -0
  1459. package/src/styles/fonts/noto-serif-tc/700/f75496953a40ff241178240209f56990.woff2 +0 -0
  1460. package/src/styles/fonts/noto-serif-tc/700/f92d74d1d217d21b39075ff23f79f7fd.woff2 +0 -0
  1461. package/src/styles/fonts/noto-serif-tc/700/f9d6d981d8b87b3e469027277f585741.woff2 +0 -0
  1462. package/src/styles/fonts/noto-serif-tc/700/fa8ed469ef290bfeb571418fe0abb628.woff2 +0 -0
  1463. package/src/styles/fonts/noto-serif-tc/700/fb61b690208eff56e6d8432951270901.woff2 +0 -0
  1464. package/src/styles/fonts/noto-serif-tc/700/ff0937ad63cda71ff420945ead55ab4d.woff2 +0 -0
  1465. package/src/styles/fonts/noto-serif-tc/noto-serif-tc.css +0 -3104
  1466. package/src/ui/__tests__/color-themes.test.ts +0 -48
  1467. package/src/ui/__tests__/font-themes.test.ts +0 -141
  1468. package/src/ui/dash/appearance/__tests__/NavigationContent.test.tsx +0 -54
  1469. package/src/ui/dash/settings/__tests__/AccountMenuContent.test.tsx +0 -67
  1470. package/src/ui/dash/settings/__tests__/GeneralContent.test.tsx +0 -75
  1471. package/src/ui/feed/__tests__/thread-preview.test.ts +0 -316
  1472. package/src/ui/feed/__tests__/timeline-cards.test.ts +0 -353
  1473. package/src/ui/layouts/__tests__/BaseLayout.test.tsx +0 -239
  1474. package/src/ui/layouts/__tests__/SiteLayout.test.tsx +0 -76
  1475. package/src/ui/pages/CollectionEditorPage.tsx +0 -175
  1476. package/src/ui/pages/__tests__/ArchivePage.test.tsx +0 -72
  1477. package/src/ui/shared/__tests__/format-chars.test.ts +0 -35
  1478. package/src/ui/shared/__tests__/home-page-branding.test.tsx +0 -14
  1479. package/src/ui/shared/__tests__/media-gallery.test.ts +0 -109
  1480. package/src/ui/shared/__tests__/navigation-labels.test.ts +0 -154
  1481. package/src/ui/shared/__tests__/pagination.test.ts +0 -63
  1482. package/src/ui/shared/__tests__/post-footer.test.ts +0 -147
@@ -1,5 +1,3167 @@
1
- import { run as runSiteImport } from "../import-site.js";
1
+ import { openAsBlob } from "node:fs";
2
+ import { mkdtemp, readFile, readdir, rm, stat } from "node:fs/promises";
3
+ import { resolve, join, extname, dirname, basename } from "node:path";
4
+ import { tmpdir } from "node:os";
5
+ import { parseArgs } from "node:util";
6
+ import {
7
+ CLI_API_TOKEN_ENV_VAR,
8
+ getCliApiToken,
9
+ } from "../../lib/cli-api-token.js";
10
+ import {
11
+ extractAttachmentBlocks,
12
+ findImageUrls,
13
+ normalizeImportedBody,
14
+ rewriteMediaReferences,
15
+ } from "../../lib/site-media-parser.js";
16
+ import { parseFrontMatter as parseFrontMatterShared } from "../../lib/hugo-markdown.js";
17
+ import { extractZipFile } from "../../lib/zip-archive.js";
18
+ import { fetchPublic, resolveInside } from "../../lib/import-sources.js";
19
+ import { findPositionalUrl } from "../../lib/renamed-arguments.js";
20
+
21
+ /**
22
+ * Parse front matter from a Markdown file.
23
+ * Delegates to the shared hugo-markdown module.
24
+ */
25
+ const parseFrontMatter = parseFrontMatterShared;
26
+
27
+ /**
28
+ * Newest `data/jant.toml` format version this importer reads. `site export`
29
+ * writes `SITE_EXPORT_FORMAT_VERSION` from `src/services/export.ts`; a test
30
+ * keeps the two equal.
31
+ */
32
+ export const SUPPORTED_SITE_EXPORT_VERSION = 2;
33
+
34
+ /**
35
+ * Refuse an export written in a format newer than this importer reads.
36
+ *
37
+ * An export from before the version field, or from any version up to
38
+ * {@link SUPPORTED_SITE_EXPORT_VERSION}, is accepted.
39
+ *
40
+ * @param {{ extra?: { jant_export?: { format?: string, version?: unknown } } } | null} siteConfig
41
+ * The merged config from `loadSiteConfig`
42
+ * @returns {string | null} An error message, or null when the export can be read
43
+ * @example
44
+ * ```js
45
+ * checkSiteExportVersion({ extra: { jant_export: { format: "jant-site", version: 2 } } });
46
+ * // "This export uses format version 2, …"
47
+ * ```
48
+ */
49
+ function checkSiteExportVersion(siteConfig) {
50
+ const version = siteConfig?.extra?.jant_export?.version;
51
+ if (typeof version !== "number" || version <= SUPPORTED_SITE_EXPORT_VERSION) {
52
+ return null;
53
+ }
54
+ return `This export uses format version ${version}, and this Jant reads up to version ${SUPPORTED_SITE_EXPORT_VERSION}. Upgrade @jant/core, then import again.`;
55
+ }
56
+
57
+ async function parseToml(content) {
58
+ const { parse } = await import("smol-toml");
59
+ return parse(content);
60
+ }
61
+
62
+ /**
63
+ * Static directories of a Jant Hugo export, in Hugo's lookup order: the root
64
+ * `static/` (user overrides) before `themes/jant/static/`, where Jant writes
65
+ * `custom.css`, `favicon.ico`, and `apple-touch-icon.png`.
66
+ */
67
+ const IMPORT_STATIC_DIRS = [["static"], ["themes", "jant", "static"]];
68
+
69
+ /**
70
+ * Read custom.css from the first static directory of a Jant Hugo export that
71
+ * has one.
72
+ */
73
+ async function readImportCustomCss(rootDir) {
74
+ for (const staticDir of IMPORT_STATIC_DIRS) {
75
+ const css = await readFile(
76
+ join(rootDir, ...staticDir, "custom.css"),
77
+ "utf-8",
78
+ ).catch(() => null);
79
+ if (css !== null) {
80
+ return css;
81
+ }
82
+ }
83
+ return "";
84
+ }
85
+
86
+ function resolveImportUrl(url, siteConfig) {
87
+ if (typeof url !== "string" || url.trim() === "" || url.startsWith("data:")) {
88
+ return url;
89
+ }
90
+
91
+ const baseUrl =
92
+ typeof siteConfig?.base_url === "string" ? siteConfig.base_url : "";
93
+ if (!baseUrl) {
94
+ return url;
95
+ }
96
+
97
+ try {
98
+ return new URL(url, baseUrl).toString();
99
+ } catch {
100
+ return url;
101
+ }
102
+ }
103
+
104
+ function resolveImportSiteAssetUrl(path, siteConfig) {
105
+ if (typeof path !== "string" || path.trim() === "") {
106
+ return path;
107
+ }
108
+
109
+ const baseUrl =
110
+ typeof siteConfig?.base_url === "string" ? siteConfig.base_url : "";
111
+ if (!baseUrl) {
112
+ return path;
113
+ }
114
+
115
+ try {
116
+ const parsedBaseUrl = new URL(baseUrl);
117
+ const sitePathPrefix = getImportSitePathPrefix(siteConfig);
118
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
119
+ const publicPath =
120
+ sitePathPrefix &&
121
+ normalizedPath !== sitePathPrefix &&
122
+ !normalizedPath.startsWith(`${sitePathPrefix}/`)
123
+ ? `${sitePathPrefix}${normalizedPath}`
124
+ : normalizedPath;
125
+ return new URL(publicPath, parsedBaseUrl.origin).toString();
126
+ } catch {
127
+ return resolveImportUrl(path, siteConfig);
128
+ }
129
+ }
130
+
131
+ function getImportSitePathPrefix(siteConfig) {
132
+ const baseUrl =
133
+ typeof siteConfig?.base_url === "string" ? siteConfig.base_url : "";
134
+ if (!baseUrl) {
135
+ return "";
136
+ }
137
+
138
+ try {
139
+ const pathname = new URL(baseUrl).pathname.replace(/\/+$/, "");
140
+ return pathname === "/" ? "" : pathname;
141
+ } catch {
142
+ return "";
143
+ }
144
+ }
145
+
146
+ async function resolveImportLocalAssetPath(rawUrl, siteConfig, sourceRootDir) {
147
+ if (
148
+ !sourceRootDir ||
149
+ typeof rawUrl !== "string" ||
150
+ rawUrl.trim() === "" ||
151
+ rawUrl.startsWith("data:")
152
+ ) {
153
+ return null;
154
+ }
155
+
156
+ const resolvedUrl = resolveImportUrl(rawUrl, siteConfig);
157
+ if (typeof resolvedUrl !== "string" || resolvedUrl.trim() === "") {
158
+ return null;
159
+ }
160
+
161
+ let pathname = "";
162
+ try {
163
+ pathname = new URL(
164
+ resolvedUrl,
165
+ typeof siteConfig?.base_url === "string" && siteConfig.base_url
166
+ ? siteConfig.base_url
167
+ : "https://jant.invalid",
168
+ ).pathname;
169
+ } catch {
170
+ return null;
171
+ }
172
+
173
+ const sitePathPrefix = getImportSitePathPrefix(siteConfig);
174
+ if (sitePathPrefix && pathname.startsWith(`${sitePathPrefix}/`)) {
175
+ pathname = pathname.slice(sitePathPrefix.length + 1);
176
+ } else {
177
+ pathname = pathname.replace(/^\/+/, "");
178
+ }
179
+
180
+ if (!pathname) {
181
+ return null;
182
+ }
183
+
184
+ for (const staticDir of IMPORT_STATIC_DIRS) {
185
+ const fullPath = resolveInside(sourceRootDir, ...staticDir, pathname);
186
+ if (!fullPath) continue;
187
+ const fileStat = await stat(fullPath).catch(() => null);
188
+ if (fileStat?.isFile()) {
189
+ return fullPath;
190
+ }
191
+ }
192
+
193
+ return null;
194
+ }
195
+
196
+ /**
197
+ * Read one asset as a Blob, from the export's files or its URL.
198
+ *
199
+ * A local file comes back file-backed (`openAsBlob`): an upload streams it
200
+ * from disk. Reading every file into memory first held gigabytes during the
201
+ * import of a real site, since Node does not count Blob memory toward the
202
+ * garbage collector's pressure.
203
+ *
204
+ * @param {{ sourceUrl?: string, sourceFilePath?: string | null, mimeType?: string, originalName?: string }} options
205
+ * @returns {Promise<{ blob: Blob, filename: string, contentType: string } | null>}
206
+ * The asset, or null when a remote source is missing or unreachable
207
+ */
208
+ async function readImportAsset(options) {
209
+ const { sourceUrl, sourceFilePath, mimeType, originalName } = options;
210
+
211
+ if (sourceFilePath) {
212
+ const filename =
213
+ originalName || basename(sourceFilePath) || getFilenameFromUrl(sourceUrl);
214
+ const contentType = mimeType || guessMimeType(filename);
215
+ return {
216
+ blob: await openAsBlob(sourceFilePath, { type: contentType }),
217
+ filename,
218
+ contentType,
219
+ };
220
+ }
221
+
222
+ if (!sourceUrl) {
223
+ return null;
224
+ }
225
+
226
+ const response = await fetchPublic(sourceUrl);
227
+ if (!response.ok) {
228
+ return null;
229
+ }
230
+
231
+ const bytes = new Uint8Array(await response.arrayBuffer());
232
+ const filename = originalName || getFilenameFromUrl(sourceUrl) || "file";
233
+ const contentType =
234
+ mimeType ||
235
+ response.headers.get("content-type")?.split(";")[0] ||
236
+ guessMimeType(filename);
237
+ return {
238
+ blob: new Blob([bytes], { type: contentType }),
239
+ filename,
240
+ contentType,
241
+ };
242
+ }
243
+
244
+ async function readMediaSpecAsset(media, field = "src") {
245
+ if (field === "poster") {
246
+ return readImportAsset({
247
+ sourceUrl: media.poster,
248
+ sourceFilePath: media.posterFilePath,
249
+ });
250
+ }
251
+
252
+ return readImportAsset({
253
+ sourceUrl: media.src,
254
+ sourceFilePath: media.srcFilePath,
255
+ mimeType: media.mimeType,
256
+ originalName: media.originalName,
257
+ });
258
+ }
259
+
260
+ function normalizeImportPathKey(value) {
261
+ if (typeof value !== "string") {
262
+ return null;
263
+ }
264
+
265
+ const trimmed = value.trim();
266
+ if (!trimmed) {
267
+ return null;
268
+ }
269
+
270
+ return trimmed
271
+ .toLowerCase()
272
+ .replace(/^\/+|\/+$/g, "")
273
+ .replace(/\/+/g, "/");
274
+ }
275
+
276
+ function normalizeImportAliasPath(value) {
277
+ const pathKey = normalizeImportPathKey(value);
278
+ return pathKey ? `/${pathKey}` : null;
279
+ }
280
+
281
+ /**
282
+ * Resolve the historical root slugs that should become custom-URL aliases
283
+ * pointing at the current root post. Hugo's `aliases:` on a root also
284
+ * contains every reply slug; we strip those (reply slugs are claimed by
285
+ * their own bundles) and keep only entries that aren't the root itself.
286
+ *
287
+ * `root_aliases:` is the authoritative record of the root's own historical
288
+ * slugs (the exporter writes it for round-trip), so when present we prefer
289
+ * it. Otherwise we fall back to `aliases:` minus reply slugs.
290
+ */
291
+ function getRootAliasPathsForImport(
292
+ aliases,
293
+ rootAliases,
294
+ postSlug,
295
+ replySlugPaths,
296
+ ) {
297
+ const rootSlugPath = normalizeImportAliasPath(postSlug);
298
+ const aliasPaths = [];
299
+ const seen = new Set();
300
+
301
+ // Prefer the explicit `root_aliases:` list when the exporter wrote it.
302
+ const source =
303
+ Array.isArray(rootAliases) && rootAliases.length > 0
304
+ ? rootAliases
305
+ : Array.isArray(aliases)
306
+ ? aliases
307
+ : [];
308
+
309
+ for (const alias of source) {
310
+ const aliasPath = normalizeImportAliasPath(alias);
311
+ if (!aliasPath) {
312
+ continue;
313
+ }
314
+ if (aliasPath === rootSlugPath) {
315
+ continue;
316
+ }
317
+ if (replySlugPaths.has(aliasPath)) {
318
+ // Reply slugs live in their own bundles — never route their URL back
319
+ // to the root as a custom alias.
320
+ continue;
321
+ }
322
+ if (seen.has(aliasPath)) {
323
+ continue;
324
+ }
325
+ seen.add(aliasPath);
326
+ aliasPaths.push(aliasPath);
327
+ }
328
+
329
+ return aliasPaths;
330
+ }
331
+
332
+ async function assertImportSlugAvailable(target, slug, label, kind) {
333
+ if (!slug) {
334
+ return;
335
+ }
336
+
337
+ const available = await target.checkPostSlugAvailability(slug);
338
+ if (!available) {
339
+ console.error(
340
+ `Import conflict: ${kind} slug "${slug}" for ${label} is already in use. Import into an empty site or remove the existing content first.`,
341
+ );
342
+ process.exit(1);
343
+ }
344
+ }
345
+
346
+ /**
347
+ * Download a media file and upload it to the Jant API.
348
+ * Returns the new URL, or null on failure.
349
+ */
350
+ /**
351
+ * Upload one media file through the site's API.
352
+ *
353
+ * Throws when the file can't be read or the site refuses it, so a caller
354
+ * decides whether that is fatal (the export's own media) or leaves a link in
355
+ * place (an image in the body). It used to return null for either, and a
356
+ * post was created without the file and without a word.
357
+ *
358
+ * @param {Record<string, unknown>} media - A normalized media spec
359
+ * @param {string} apiUrl - Target site URL
360
+ * @param {string} token - API token
361
+ * @returns {Promise<{ url: string, id: string }>} The uploaded media
362
+ */
363
+ async function uploadRemoteMedia(media, apiUrl, token) {
364
+ const asset = await readMediaSpecAsset(media);
365
+ if (!asset) {
366
+ throw new Error(`Couldn't read ${media.src}`);
367
+ }
368
+
369
+ const formData = new FormData();
370
+ formData.append("file", asset.blob, asset.filename);
371
+ if (media.alt) formData.append("alt", media.alt);
372
+ if (media.summary) formData.append("summary", media.summary);
373
+ if (media.width) formData.append("width", String(media.width));
374
+ if (media.height) formData.append("height", String(media.height));
375
+ if (media.blurhash) formData.append("blurhash", media.blurhash);
376
+ if (media.waveform) formData.append("waveform", media.waveform);
377
+ if (media.durationSeconds) {
378
+ formData.append("durationSeconds", String(media.durationSeconds));
379
+ }
380
+
381
+ if (media.poster) {
382
+ const posterAsset = await readMediaSpecAsset(media, "poster");
383
+ if (posterAsset) {
384
+ formData.append("poster", posterAsset.blob, posterAsset.filename);
385
+ } else {
386
+ console.warn(`Warning: couldn't read the poster ${media.poster}`);
387
+ }
388
+ }
389
+
390
+ const uploadResponse = await fetch(`${apiUrl}/api/upload`, {
391
+ method: "POST",
392
+ headers: { Authorization: `Bearer ${token}` },
393
+ body: formData,
394
+ });
395
+
396
+ if (!uploadResponse.ok) {
397
+ const detail = (await uploadResponse.text().catch(() => "")).slice(0, 300);
398
+ throw new Error(
399
+ `The site refused ${media.src}: HTTP ${uploadResponse.status}${detail ? ` ${detail}` : ""}`,
400
+ );
401
+ }
402
+ const data = await uploadResponse.json();
403
+ return { url: data.url, id: data.id };
404
+ }
405
+
406
+ function getFilenameFromUrl(fileUrl) {
407
+ try {
408
+ const pathname = new URL(fileUrl).pathname;
409
+ return pathname.split("/").pop() || "file";
410
+ } catch {
411
+ return fileUrl.split("/").pop() || "file";
412
+ }
413
+ }
414
+
415
+ function guessMimeType(filename) {
416
+ const ext = extname(filename).toLowerCase();
417
+ switch (ext) {
418
+ case ".jpg":
419
+ case ".jpeg":
420
+ return "image/jpeg";
421
+ case ".png":
422
+ return "image/png";
423
+ case ".gif":
424
+ return "image/gif";
425
+ case ".webp":
426
+ return "image/webp";
427
+ case ".svg":
428
+ return "image/svg+xml";
429
+ case ".avif":
430
+ return "image/avif";
431
+ case ".bmp":
432
+ return "image/bmp";
433
+ case ".ico":
434
+ return "image/x-icon";
435
+ case ".mp4":
436
+ return "video/mp4";
437
+ case ".mp3":
438
+ return "audio/mpeg";
439
+ case ".pdf":
440
+ return "application/pdf";
441
+ case ".json":
442
+ return "application/json";
443
+ case ".md":
444
+ return "text/markdown";
445
+ case ".csv":
446
+ return "text/csv";
447
+ case ".txt":
448
+ return "text/plain";
449
+ default:
450
+ return "application/octet-stream";
451
+ }
452
+ }
453
+
454
+ function normalizeImportedBodySegment(markdown) {
455
+ const extracted = extractAttachmentBlocks(markdown);
456
+ const normalized = normalizeImportedBody(extracted.markdown);
457
+
458
+ return {
459
+ markdown: normalized.markdown,
460
+ attachments: [...extracted.attachments, ...normalized.attachments],
461
+ };
462
+ }
463
+
464
+ function isAbsoluteUrl(value) {
465
+ return typeof value === "string" && /^https?:\/\//i.test(value);
466
+ }
467
+
468
+ /**
469
+ * True when `url` points to a different location than the import target —
470
+ * i.e. has a scheme (`https://`, `data:`) or is protocol-relative (`//cdn…`).
471
+ * False for relative paths (`/media/x`, `./x`, `x`), which always belong to
472
+ * the source site and must be rehosted. Used to filter the body-fallback
473
+ * upload when `--skip-remote-media` is set.
474
+ */
475
+ function isAbsoluteImportUrl(value) {
476
+ if (typeof value !== "string") return false;
477
+ return /^([a-z][a-z0-9+.\-]*:|\/\/)/i.test(value);
478
+ }
479
+
480
+ /**
481
+ * Resolve a `media:` entry's `src` or `poster` reference to a local disk
482
+ * path when the export bundled the bytes under `static/`. Absolute URLs
483
+ * (remote-linked media) skip the disk lookup — the uploader fetches them
484
+ * directly.
485
+ */
486
+ async function resolveJantMediaDiskPath(ref, sourceRootDir) {
487
+ if (typeof ref !== "string" || !ref.trim()) return null;
488
+ if (isAbsoluteUrl(ref)) return null;
489
+ const normalized = ref.startsWith("/") ? ref.slice(1) : ref;
490
+ // `src` comes from front matter, so it must not climb out of `static/`.
491
+ const fullPath = resolveInside(join(sourceRootDir, "static"), normalized);
492
+ if (!fullPath) return null;
493
+ const fileStat = await stat(fullPath).catch(() => null);
494
+ return fileStat?.isFile() ? fullPath : null;
495
+ }
496
+
497
+ /**
498
+ * Build a media spec for upload from a flat `media:` front-matter entry.
499
+ *
500
+ * The entry's `src` is either a site-relative path
501
+ * (`/media/{id}.webp` — bytes live under `static/` in the exported site)
502
+ * or an absolute public URL (the exporter linked to an existing
503
+ * R2/S3/local-proxy host rather than re-bundling the bytes). Poster
504
+ * frames follow the same rule. The import uploader already knows how
505
+ * to handle both forms via `readImportAsset`.
506
+ */
507
+ async function mediaSpecFromJantMedia(entry, sourceRootDir) {
508
+ if (!entry || typeof entry.src !== "string" || !entry.src.trim()) {
509
+ return null;
510
+ }
511
+
512
+ const srcFilePath = await resolveJantMediaDiskPath(entry.src, sourceRootDir);
513
+ if (!srcFilePath && !isAbsoluteUrl(entry.src)) {
514
+ // Relative src but file not on disk — can't upload.
515
+ return null;
516
+ }
517
+
518
+ const poster =
519
+ typeof entry.poster === "string" && entry.poster.trim()
520
+ ? entry.poster
521
+ : null;
522
+ const posterFilePath = poster
523
+ ? await resolveJantMediaDiskPath(poster, sourceRootDir)
524
+ : null;
525
+
526
+ const originalName =
527
+ typeof entry.original_name === "string" && entry.original_name.trim()
528
+ ? entry.original_name
529
+ : srcFilePath
530
+ ? basename(srcFilePath)
531
+ : undefined;
532
+
533
+ return {
534
+ kind: typeof entry.kind === "string" ? entry.kind : undefined,
535
+ src: entry.src,
536
+ srcFilePath,
537
+ poster,
538
+ posterFilePath,
539
+ mimeType: typeof entry.mime_type === "string" ? entry.mime_type : undefined,
540
+ originalName,
541
+ size: typeof entry.size === "number" ? entry.size : undefined,
542
+ width: typeof entry.width === "number" ? entry.width : undefined,
543
+ height: typeof entry.height === "number" ? entry.height : undefined,
544
+ alt: typeof entry.alt === "string" ? entry.alt : undefined,
545
+ position: typeof entry.position === "string" ? entry.position : undefined,
546
+ blurhash: typeof entry.blurhash === "string" ? entry.blurhash : undefined,
547
+ waveform: typeof entry.waveform === "string" ? entry.waveform : undefined,
548
+ summary: typeof entry.summary === "string" ? entry.summary : undefined,
549
+ chars: typeof entry.chars === "number" ? entry.chars : undefined,
550
+ durationSeconds:
551
+ typeof entry.duration_seconds === "number"
552
+ ? entry.duration_seconds
553
+ : undefined,
554
+ };
555
+ }
556
+
557
+ async function normalizeMediaSpec(spec, siteConfig, sourceRootDir) {
558
+ if (!spec || typeof spec.src !== "string" || spec.src.trim() === "") {
559
+ return null;
560
+ }
561
+
562
+ const src = resolveImportUrl(spec.src, siteConfig);
563
+ const poster =
564
+ typeof spec.poster === "string"
565
+ ? resolveImportUrl(spec.poster, siteConfig)
566
+ : null;
567
+
568
+ return {
569
+ kind: spec.kind,
570
+ src,
571
+ srcFilePath:
572
+ spec.srcFilePath ??
573
+ (await resolveImportLocalAssetPath(spec.src, siteConfig, sourceRootDir)),
574
+ poster,
575
+ posterFilePath:
576
+ spec.posterFilePath ??
577
+ (typeof spec.poster === "string"
578
+ ? await resolveImportLocalAssetPath(
579
+ spec.poster,
580
+ siteConfig,
581
+ sourceRootDir,
582
+ )
583
+ : null),
584
+ mimeType: spec.mimeType || undefined,
585
+ originalName: spec.originalName || undefined,
586
+ size: typeof spec.size === "number" ? spec.size : undefined,
587
+ width: typeof spec.width === "number" ? spec.width : undefined,
588
+ height: typeof spec.height === "number" ? spec.height : undefined,
589
+ alt: typeof spec.alt === "string" ? spec.alt : undefined,
590
+ position: typeof spec.position === "string" ? spec.position : undefined,
591
+ blurhash: typeof spec.blurhash === "string" ? spec.blurhash : undefined,
592
+ waveform: typeof spec.waveform === "string" ? spec.waveform : undefined,
593
+ summary: typeof spec.summary === "string" ? spec.summary : undefined,
594
+ chars: typeof spec.chars === "number" ? spec.chars : undefined,
595
+ };
596
+ }
597
+
598
+ /**
599
+ * Coerce a `<figure data-jant-node="attachment" data-jant-kind="text">` meta
600
+ * block into the shape `createTextAttachment` wants on import.
601
+ *
602
+ * Two source shapes are supported:
603
+ *
604
+ * 1. Inline (legacy exports): the meta JSON carries the markdown itself under
605
+ * `contentFormat: "markdown"` + `content: "..."`. Used before text
606
+ * attachments got their own public URL.
607
+ * 2. Reference (current exports): the meta JSON only carries `kind: "text"`
608
+ * + `src: <url>` pointing at the `.md` artifact. We fetch that URL
609
+ * (falling back to `--pull-media` local disk via
610
+ * `resolveImportLocalAssetPath`, same as images) and use the bytes as
611
+ * the markdown body.
612
+ *
613
+ * Returns `null` when the spec isn't a text attachment or we can't get
614
+ * usable content (unreachable URL, empty body, etc.) — caller drops the
615
+ * attachment rather than creating an empty one.
616
+ */
617
+ async function normalizeTextAttachmentSpec(spec, siteConfig, sourceRootDir) {
618
+ if (!spec || spec.kind !== "text") {
619
+ return null;
620
+ }
621
+
622
+ const summary = typeof spec.summary === "string" ? spec.summary : undefined;
623
+
624
+ // Legacy inline content path — no network fetch needed.
625
+ if (
626
+ spec.contentFormat === "markdown" &&
627
+ typeof spec.content === "string" &&
628
+ spec.content.trim() !== ""
629
+ ) {
630
+ return {
631
+ type: "text",
632
+ contentFormat: "markdown",
633
+ content: spec.content,
634
+ summary,
635
+ };
636
+ }
637
+
638
+ // Reference path — fetch the markdown from the stored `src` URL.
639
+ if (typeof spec.src !== "string" || spec.src.trim() === "") {
640
+ return null;
641
+ }
642
+
643
+ const sourceUrl = resolveImportUrl(spec.src, siteConfig);
644
+ if (typeof sourceUrl !== "string" || sourceUrl.trim() === "") {
645
+ return null;
646
+ }
647
+
648
+ const asset = await readImportAsset({
649
+ sourceUrl,
650
+ sourceFilePath: await resolveImportLocalAssetPath(
651
+ spec.src,
652
+ siteConfig,
653
+ sourceRootDir,
654
+ ),
655
+ });
656
+
657
+ if (!asset) {
658
+ return null;
659
+ }
660
+
661
+ let markdown;
662
+ try {
663
+ markdown = await asset.blob.text();
664
+ } catch {
665
+ return null;
666
+ }
667
+
668
+ if (markdown.trim() === "") {
669
+ return null;
670
+ }
671
+
672
+ return {
673
+ type: "text",
674
+ contentFormat: "markdown",
675
+ content: markdown,
676
+ summary,
677
+ };
678
+ }
679
+
680
+ async function buildImportedAttachments(
681
+ attachmentSpecs,
682
+ target,
683
+ siteConfig,
684
+ sourceRootDir,
685
+ ) {
686
+ const attachments = [];
687
+ let uploaded = 0;
688
+
689
+ for (const spec of attachmentSpecs) {
690
+ const textAttachment = await normalizeTextAttachmentSpec(
691
+ spec,
692
+ siteConfig,
693
+ sourceRootDir,
694
+ );
695
+ if (textAttachment) {
696
+ attachments.push(textAttachment);
697
+ continue;
698
+ }
699
+
700
+ const normalized = await normalizeMediaSpec(
701
+ spec,
702
+ siteConfig,
703
+ sourceRootDir,
704
+ );
705
+ if (!normalized || normalized.src.startsWith("data:")) continue;
706
+ let result;
707
+ try {
708
+ result = await target.uploadMedia(normalized);
709
+ } catch (err) {
710
+ // The post's own attachment: creating the post without it would lose
711
+ // the file quietly.
712
+ throw new Error(`Couldn't upload ${spec.src}: ${err.message}`, {
713
+ cause: err,
714
+ });
715
+ }
716
+ if (!result) continue;
717
+ attachments.push({
718
+ type: "media",
719
+ mediaId: result.id,
720
+ ...(typeof normalized.alt === "string" ? { alt: normalized.alt } : {}),
721
+ });
722
+ uploaded += 1;
723
+ }
724
+
725
+ return { attachments, uploaded };
726
+ }
727
+
728
+ async function uploadMediaList(mediaSpecs, target, siteConfig, sourceRootDir) {
729
+ const urlMap = new Map();
730
+ const mediaIds = [];
731
+ let uploaded = 0;
732
+
733
+ for (const spec of mediaSpecs) {
734
+ const normalized = await normalizeMediaSpec(
735
+ spec,
736
+ siteConfig,
737
+ sourceRootDir,
738
+ );
739
+ if (!normalized || normalized.src.startsWith("data:")) continue;
740
+ let result;
741
+ try {
742
+ result = await target.uploadMedia(normalized);
743
+ } catch (err) {
744
+ // A body image may be a third party's; the Markdown keeps its URL.
745
+ console.warn(`Warning: kept ${spec.src} as a link. ${err.message}`);
746
+ continue;
747
+ }
748
+ if (!result) continue;
749
+ // Key the rewrite map by the *original* URL as it appears in the body
750
+ // (e.g. `/media/...`). `normalized.src` has been resolved against
751
+ // `siteConfig.base_url` and becomes absolute, which would never match
752
+ // `node.url` from the markdown AST during `rewriteMediaReferences`.
753
+ if (typeof spec.src === "string" && spec.src.trim() !== "") {
754
+ urlMap.set(spec.src, result.url);
755
+ }
756
+ if (normalized.src !== spec.src) {
757
+ urlMap.set(normalized.src, result.url);
758
+ }
759
+ mediaIds.push(result.id);
760
+ uploaded += 1;
761
+ }
762
+
763
+ return { urlMap, mediaIds, uploaded };
764
+ }
765
+
766
+ /**
767
+ * Upload each media spec referenced by a bundle's front matter. Accepts
768
+ * both site-relative entries (bytes on disk under `static/`, via
769
+ * `srcFilePath`) and absolute-URL entries (remote-linked media — the
770
+ * uploader fetches the URL). Returns a `urlMap` (for rewriting in-body
771
+ * references) and an ordered `mediaIds` list for post attachment.
772
+ */
773
+ async function uploadBundleResources(resourceSpecs, target) {
774
+ const urlMap = new Map();
775
+ const mediaIds = [];
776
+ let uploaded = 0;
777
+
778
+ for (const spec of resourceSpecs) {
779
+ if (!spec) continue;
780
+ if (!spec.srcFilePath && !isAbsoluteUrl(spec.src)) continue;
781
+ let result;
782
+ try {
783
+ result = await target.uploadMedia(spec);
784
+ } catch (err) {
785
+ // The post's own attachment: creating the post without it would lose
786
+ // the file quietly.
787
+ throw new Error(`Couldn't upload ${spec.src}: ${err.message}`, {
788
+ cause: err,
789
+ });
790
+ }
791
+ if (!result) continue;
792
+ urlMap.set(spec.src, result.url);
793
+ mediaIds.push(result.id);
794
+ uploaded += 1;
795
+ }
796
+
797
+ return { urlMap, mediaIds, uploaded };
798
+ }
799
+
800
+ function coerceBoolean(value) {
801
+ if (typeof value === "boolean") return value;
802
+ if (typeof value === "string") {
803
+ const normalized = value.trim().toLowerCase();
804
+ return normalized === "true" || normalized === "1" || normalized === "yes";
805
+ }
806
+ return false;
807
+ }
808
+
809
+ /**
810
+ * Build a unified "site config" object from Hugo's split config files.
811
+ *
812
+ * Hugo writes two sources of truth:
813
+ * - `hugo.toml`: baseURL, title, languageCode, theme params
814
+ * - `data/jant.toml`: everything Jant owns — nav items, branding modes,
815
+ * site_footer, avatar urls, display preferences, and the ordered
816
+ * collections directory under `[[directory]]`.
817
+ *
818
+ * Where both carry a value, `data/jant.toml` wins: it records the site,
819
+ * while `hugo.toml` configures a Hugo build the author may have edited.
820
+ * `hugo.toml` fills in only for exports that predate `data/jant.toml`.
821
+ *
822
+ * This merger normalizes them into a single shape that downstream helpers
823
+ * (`buildSettingsUpdatesFromConfig`, `normalizeImportedNavItems`,
824
+ * `normalizeImportedCollectionDirectory`, `buildSiteAvatarImport`) already
825
+ * know how to read. The shape is intentionally a superset — nothing
826
+ * depends on `hugo.toml`-only vs `data/jant.toml`-only fields, so extra
827
+ * keys are harmless if they leak through.
828
+ */
829
+ async function loadSiteConfig(rootDir) {
830
+ const hugoTomlText = await readFile(
831
+ join(rootDir, "hugo.toml"),
832
+ "utf-8",
833
+ ).catch(() => null);
834
+ const jantDataText = await readFile(
835
+ join(rootDir, "data", "jant.toml"),
836
+ "utf-8",
837
+ ).catch(() => null);
838
+
839
+ if (!hugoTomlText && !jantDataText) {
840
+ return null;
841
+ }
842
+
843
+ const hugoToml = hugoTomlText ? await parseToml(hugoTomlText) : {};
844
+ const jantData = jantDataText ? await parseToml(jantDataText) : {};
845
+
846
+ const params = hugoToml.params ?? {};
847
+
848
+ // `data/jant.toml` is the export's record of the site; `hugo.toml` is the
849
+ // Hugo site's configuration, which the author may have edited to build it.
850
+ // Read jant.toml first, and hugo.toml only for exports that predate it.
851
+ const fromJantData = (jantKey, fallback) =>
852
+ typeof jantData[jantKey] === "string" ? jantData[jantKey] : fallback;
853
+ const title = fromJantData(
854
+ "site_name",
855
+ typeof hugoToml.title === "string" ? hugoToml.title : "",
856
+ );
857
+ const description = fromJantData(
858
+ "site_description",
859
+ typeof params.description === "string" ? params.description : "",
860
+ );
861
+ const baseUrl =
862
+ typeof hugoToml.baseURL === "string"
863
+ ? hugoToml.baseURL
864
+ : typeof hugoToml.baseurl === "string"
865
+ ? hugoToml.baseurl
866
+ : "";
867
+ const language = fromJantData(
868
+ "site_language",
869
+ (typeof hugoToml.languageCode === "string" && hugoToml.languageCode) ||
870
+ (typeof hugoToml.defaultContentLanguage === "string" &&
871
+ hugoToml.defaultContentLanguage) ||
872
+ "en",
873
+ );
874
+
875
+ const directoryItems = Array.isArray(jantData.directory)
876
+ ? jantData.directory
877
+ : [];
878
+ const directoryExported = Array.isArray(jantData.directory);
879
+
880
+ return {
881
+ // Public base URL (used for resolving relative media URLs).
882
+ base_url: baseUrl,
883
+ title,
884
+ description,
885
+ default_language: language,
886
+ extra: {
887
+ jant: {
888
+ theme_id: fromJantData("theme_id", String(params.theme_id ?? "")),
889
+ default_theme_id: fromJantData(
890
+ "default_theme_id",
891
+ String(params.default_theme_id ?? ""),
892
+ ),
893
+ font_theme_id: fromJantData(
894
+ "font_theme_id",
895
+ String(params.font_theme_id ?? ""),
896
+ ),
897
+ theme_mode: fromJantData("theme_mode", String(params.theme_mode ?? "")),
898
+ show_jant_branding_on_home: coerceBoolean(
899
+ jantData.show_jant_branding_on_home ??
900
+ params.show_jant_branding_on_home,
901
+ ),
902
+ show_header_avatar: coerceBoolean(
903
+ jantData.show_header_avatar ?? params.show_header_avatar,
904
+ ),
905
+ noindex: coerceBoolean(jantData.noindex ?? params.noindex),
906
+ public_api_enabled: coerceBoolean(
907
+ jantData.public_api_enabled ?? params.public_api_enabled ?? true,
908
+ ),
909
+ rss_feeds_enabled: coerceBoolean(
910
+ jantData.rss_feeds_enabled ?? params.rss_feeds_enabled ?? true,
911
+ ),
912
+ site_footer_markdown:
913
+ typeof jantData.site_footer_markdown === "string"
914
+ ? jantData.site_footer_markdown
915
+ : "",
916
+ time_zone:
917
+ typeof jantData.time_zone === "string" ? jantData.time_zone : "",
918
+ main_rss_feed:
919
+ typeof jantData.main_rss_feed === "string"
920
+ ? jantData.main_rss_feed
921
+ : "",
922
+ multilingual_enabled: coerceBoolean(jantData.multilingual_enabled),
923
+ additional_languages:
924
+ typeof jantData.additional_languages === "string"
925
+ ? jantData.additional_languages
926
+ : undefined,
927
+ site_avatar_mode:
928
+ typeof jantData.site_avatar_mode === "string"
929
+ ? jantData.site_avatar_mode
930
+ : "none",
931
+ site_avatar_url:
932
+ typeof jantData.site_avatar_url === "string"
933
+ ? jantData.site_avatar_url
934
+ : typeof params.site_avatar_url === "string"
935
+ ? params.site_avatar_url
936
+ : "",
937
+ favicon_mode:
938
+ typeof jantData.favicon_mode === "string"
939
+ ? jantData.favicon_mode
940
+ : "default",
941
+ favicon_url:
942
+ typeof jantData.favicon_path === "string"
943
+ ? jantData.favicon_path
944
+ : "/favicon.ico",
945
+ apple_touch_mode:
946
+ typeof jantData.apple_touch_mode === "string"
947
+ ? jantData.apple_touch_mode
948
+ : "default",
949
+ apple_touch_icon_url:
950
+ typeof jantData.apple_touch_icon_path === "string"
951
+ ? jantData.apple_touch_icon_path
952
+ : "/apple-touch-icon.png",
953
+ nav: Array.isArray(jantData.nav) ? jantData.nav : [],
954
+ nav_exported: Array.isArray(jantData.nav),
955
+ collections_directory: directoryItems,
956
+ collections_directory_exported: directoryExported,
957
+ custom_urls: Array.isArray(jantData.custom_url)
958
+ ? jantData.custom_url
959
+ : [],
960
+ },
961
+ jant_export: {
962
+ format:
963
+ typeof jantData.format === "string" ? jantData.format : "jant-site",
964
+ version: jantData.version,
965
+ },
966
+ },
967
+ };
968
+ }
969
+
970
+ /**
971
+ * A Collection's or Smart Collection's description from its section page:
972
+ * `description` since 1.0, `summary_text` before.
973
+ *
974
+ * @param {Record<string, unknown>} frontMatter - The section page's front matter
975
+ * @returns {string | undefined} The description, or undefined when blank
976
+ */
977
+ function readCollectionDescription(frontMatter) {
978
+ const value =
979
+ typeof frontMatter.description === "string"
980
+ ? frontMatter.description
981
+ : frontMatter.summary_text;
982
+ return typeof value === "string" && value.trim() ? value : undefined;
983
+ }
984
+
985
+ function buildSettingsUpdatesFromConfig(siteConfig, customCss = "") {
986
+ const jant = siteConfig?.extra?.jant || {};
987
+ const themeId = String(jant.theme_id || "");
988
+ const defaultThemeId = String(jant.default_theme_id || "");
989
+ const fontThemeId = String(jant.font_theme_id || "");
990
+ const themeMode = String(jant.theme_mode || "");
991
+ return {
992
+ SITE_NAME: String(siteConfig?.title || ""),
993
+ SITE_DESCRIPTION: String(siteConfig?.description || ""),
994
+ SITE_LANGUAGE: String(siteConfig?.default_language || "en"),
995
+ SITE_FOOTER: String(jant.site_footer_markdown || ""),
996
+ SHOW_JANT_BRANDING_ON_HOME: jant.show_jant_branding_on_home
997
+ ? "true"
998
+ : "false",
999
+ NOINDEX: jant.noindex ? "true" : "false",
1000
+ PUBLIC_API_ENABLED: jant.public_api_enabled === false ? "false" : "true",
1001
+ RSS_FEEDS_ENABLED: jant.rss_feeds_enabled === false ? "false" : "true",
1002
+ SHOW_HEADER_AVATAR: jant.show_header_avatar ? "true" : "false",
1003
+ THEME: themeId && themeId !== defaultThemeId ? themeId : "",
1004
+ FONT_THEME: fontThemeId && fontThemeId !== "default" ? fontThemeId : "",
1005
+ THEME_MODE:
1006
+ themeMode === "light" || themeMode === "dark" ? themeMode : "auto",
1007
+ CUSTOM_CSS: customCss,
1008
+ ...(typeof jant.time_zone === "string" && jant.time_zone
1009
+ ? { TIME_ZONE: jant.time_zone }
1010
+ : {}),
1011
+ ...(jant.main_rss_feed === "latest" || jant.main_rss_feed === "featured"
1012
+ ? { MAIN_RSS_FEED: jant.main_rss_feed }
1013
+ : {}),
1014
+ // Restored by the server's language service, after SITE_LANGUAGE.
1015
+ ...(typeof jant.additional_languages === "string"
1016
+ ? {
1017
+ ADDITIONAL_LANGUAGES: jant.additional_languages,
1018
+ MULTILINGUAL_ENABLED: jant.multilingual_enabled ? "true" : "false",
1019
+ }
1020
+ : {}),
1021
+ };
1022
+ }
1023
+
1024
+ /**
1025
+ * Appearance settings: `PUT /api/settings` takes them, and `appearanceSettingKeys`
1026
+ * in `src/lib/api-settings.ts` lists the same keys.
1027
+ */
1028
+ const APPEARANCE_SETTING_KEYS = new Set([
1029
+ "THEME",
1030
+ "FONT_THEME",
1031
+ "THEME_MODE",
1032
+ "CUSTOM_CSS",
1033
+ "SHOW_HEADER_AVATAR",
1034
+ ]);
1035
+
1036
+ /**
1037
+ * The site's languages, restored through `PUT /api/settings/import`, which
1038
+ * applies the language rules; `languageSettingKeys` lists the same keys.
1039
+ */
1040
+ const LANGUAGE_SETTING_KEYS = new Set([
1041
+ "MULTILINGUAL_ENABLED",
1042
+ "ADDITIONAL_LANGUAGES",
1043
+ ]);
1044
+
1045
+ /**
1046
+ * Sort an export's settings into the requests that restore them.
1047
+ *
1048
+ * Appearance goes in a request of its own so that a theme this Jant no longer
1049
+ * has costs the import its appearance only, not everything else.
1050
+ *
1051
+ * @param {Record<string, string>} updates - Settings read from the export
1052
+ * @returns {{ editable: Record<string, string>, appearance: Record<string, string>, languages: Record<string, string> }}
1053
+ * @example
1054
+ * splitSettingsUpdatesForImport({ SITE_NAME: "Blog", THEME: "paper" });
1055
+ * // { editable: { SITE_NAME: "Blog" }, appearance: { THEME: "paper" }, languages: {} }
1056
+ */
1057
+ function splitSettingsUpdatesForImport(updates) {
1058
+ const editable = {};
1059
+ const appearance = {};
1060
+ const languages = {};
1061
+ for (const [key, value] of Object.entries(updates)) {
1062
+ if (APPEARANCE_SETTING_KEYS.has(key)) appearance[key] = value;
1063
+ else if (LANGUAGE_SETTING_KEYS.has(key)) languages[key] = value;
1064
+ else editable[key] = value;
1065
+ }
1066
+ return { editable, appearance, languages };
1067
+ }
1068
+
1069
+ const NAV_PLACEMENTS = new Set(["header", "more"]);
1070
+ const NAV_ITEM_TYPES = new Set([
1071
+ "system",
1072
+ "link",
1073
+ "collection",
1074
+ "smart_collection",
1075
+ "page",
1076
+ ]);
1077
+
1078
+ /**
1079
+ * The slug a nav URL names, for exports older than `collection_slug` and
1080
+ * `post_slug`: `/now` or `/now/` → `now`. Anything else names no slug.
1081
+ *
1082
+ * @param {unknown} url - The exported nav URL
1083
+ * @returns {string | null} The slug, or null
1084
+ */
1085
+ function getSlugFromNavUrl(url) {
1086
+ if (typeof url !== "string") return null;
1087
+ const match = url.match(/^\/([^/?#]+)\/?$/);
1088
+ return match ? decodeURIComponent(match[1]) : null;
1089
+ }
1090
+
1091
+ function normalizeImportedNavItems(siteConfig) {
1092
+ const jant = siteConfig?.extra?.jant || {};
1093
+ const navItems = jant.nav;
1094
+ if (!Array.isArray(navItems)) {
1095
+ return {
1096
+ exported: Boolean(jant.nav_exported),
1097
+ items: [],
1098
+ };
1099
+ }
1100
+
1101
+ return {
1102
+ exported: true,
1103
+ items: navItems
1104
+ .map((item) => {
1105
+ if (!item || typeof item !== "object") return null;
1106
+ const type = NAV_ITEM_TYPES.has(item.type) ? item.type : "link";
1107
+ const placement = NAV_PLACEMENTS.has(item.placement)
1108
+ ? item.placement
1109
+ : "header";
1110
+ const label = typeof item.label === "string" ? item.label : "";
1111
+ const url = typeof item.url === "string" ? item.url : "";
1112
+ const customLabel =
1113
+ typeof item.custom_label === "string" && item.custom_label.trim()
1114
+ ? item.custom_label
1115
+ : null;
1116
+
1117
+ if (type === "system") {
1118
+ if (typeof item.system_key !== "string" || !item.system_key) {
1119
+ return null;
1120
+ }
1121
+ return { type, systemKey: item.system_key, customLabel, placement };
1122
+ }
1123
+ if (type === "collection") {
1124
+ const slug =
1125
+ typeof item.collection_slug === "string"
1126
+ ? item.collection_slug
1127
+ : getSlugFromNavUrl(url);
1128
+ return { type, slug, customLabel, label, url, placement };
1129
+ }
1130
+ if (type === "page") {
1131
+ const slug =
1132
+ typeof item.post_slug === "string"
1133
+ ? item.post_slug
1134
+ : getSlugFromNavUrl(url);
1135
+ return { type, slug, customLabel, label, url, placement };
1136
+ }
1137
+ if (type === "smart_collection") {
1138
+ const slug =
1139
+ typeof item.smart_collection_slug === "string"
1140
+ ? item.smart_collection_slug
1141
+ : getSlugFromNavUrl(url);
1142
+ return { type, slug, customLabel, label, url, placement };
1143
+ }
1144
+ if (!label || !url) return null;
1145
+ return { type: "link", label: customLabel ?? label, url, placement };
1146
+ })
1147
+ .filter(Boolean),
1148
+ };
1149
+ }
1150
+
1151
+ /**
1152
+ * The custom URLs an export lists that name no post or collection: redirects,
1153
+ * and legacy archive URLs the importer reports but can't recreate.
1154
+ *
1155
+ * @param {Record<string, unknown>} siteConfig - From `loadSiteConfig`
1156
+ * @returns {Array<{ path: string, kind: "redirect" | "archive", to?: string, status?: 301 | 302, archiveQuery?: string }>}
1157
+ */
1158
+ function normalizeImportedCustomUrls(siteConfig) {
1159
+ const entries = siteConfig?.extra?.jant?.custom_urls;
1160
+ if (!Array.isArray(entries)) return [];
1161
+
1162
+ return entries
1163
+ .map((entry) => {
1164
+ if (!entry || typeof entry !== "object") return null;
1165
+ const path =
1166
+ typeof entry.path === "string" ? entry.path.replace(/^\/+/, "") : "";
1167
+ if (!path) return null;
1168
+ if (entry.kind === "redirect" && typeof entry.to === "string") {
1169
+ return {
1170
+ path,
1171
+ kind: "redirect",
1172
+ to: entry.to,
1173
+ status: entry.status === 302 ? 302 : 301,
1174
+ };
1175
+ }
1176
+ if (entry.kind === "archive") {
1177
+ return {
1178
+ path,
1179
+ kind: "archive",
1180
+ archiveQuery:
1181
+ typeof entry.archive_query === "string"
1182
+ ? entry.archive_query
1183
+ : undefined,
1184
+ };
1185
+ }
1186
+ return null;
1187
+ })
1188
+ .filter(Boolean);
1189
+ }
1190
+
1191
+ /**
1192
+ * The create request for one imported nav item, once the posts and
1193
+ * collections it may point at exist. A target that didn't come across stays
1194
+ * in the navigation as a plain link to the same address.
1195
+ *
1196
+ * @param {Record<string, unknown>} item - From `normalizeImportedNavItems`
1197
+ * @param {{ collectionSlugToId: Map<string, string>, smartCollectionSlugToId: Map<string, string>, postSlugToId: Map<string, string> }} targets
1198
+ * @returns {{ payload: Record<string, unknown>, customLabel: string | null, warning: string | null }}
1199
+ */
1200
+ function buildNavItemCreateRequest(item, targets) {
1201
+ const { placement, customLabel } = item;
1202
+
1203
+ if (item.type === "system") {
1204
+ return {
1205
+ payload: { type: "system", systemKey: item.systemKey, placement },
1206
+ customLabel,
1207
+ warning: null,
1208
+ };
1209
+ }
1210
+ if (item.type === "link") {
1211
+ return {
1212
+ payload: { type: "link", label: item.label, url: item.url, placement },
1213
+ customLabel: null,
1214
+ warning: null,
1215
+ };
1216
+ }
1217
+
1218
+ const targetId =
1219
+ item.type === "collection"
1220
+ ? targets.collectionSlugToId.get(item.slug)
1221
+ : item.type === "smart_collection"
1222
+ ? targets.smartCollectionSlugToId.get(item.slug)
1223
+ : item.type === "page"
1224
+ ? targets.postSlugToId.get(item.slug)
1225
+ : undefined;
1226
+ if (targetId) {
1227
+ const targetField =
1228
+ item.type === "collection"
1229
+ ? "collectionId"
1230
+ : item.type === "smart_collection"
1231
+ ? "smartCollectionId"
1232
+ : "postId";
1233
+ return {
1234
+ payload: {
1235
+ type: item.type,
1236
+ [targetField]: targetId,
1237
+ ...(customLabel ? { label: customLabel } : {}),
1238
+ placement,
1239
+ },
1240
+ customLabel: null,
1241
+ warning: null,
1242
+ };
1243
+ }
1244
+
1245
+ return {
1246
+ payload: {
1247
+ type: "link",
1248
+ label: customLabel ?? item.label,
1249
+ url: item.url,
1250
+ placement,
1251
+ },
1252
+ customLabel: null,
1253
+ warning: `The ${item.type.replace("_", " ")} behind "${item.label}" wasn't imported; it stays in the navigation as a link to ${item.url}.`,
1254
+ };
1255
+ }
1256
+
1257
+ /**
1258
+ * The create request for one exported smart collection.
1259
+ *
1260
+ * The conditions arrive as the export spells them, with the collection one
1261
+ * naming a slug; it becomes this site's ID. When that collection didn't come
1262
+ * across, the smart collection is skipped rather than created without the
1263
+ * condition, which would widen it to posts it never held.
1264
+ *
1265
+ * @param {{ slug: string, frontMatter: Record<string, unknown> }} bundle - A `type: smart_collection` section
1266
+ * @param {Map<string, string>} collectionSlugToId - Imported collections
1267
+ * @returns {{ payload: Record<string, unknown> | null, warning: string | null }}
1268
+ * @example
1269
+ * buildSmartCollectionCreateRequest(bundle, new Map([["ideas", "col_01…"]]));
1270
+ */
1271
+ function buildSmartCollectionCreateRequest(bundle, collectionSlugToId) {
1272
+ const frontMatter = bundle.frontMatter;
1273
+ const exported = frontMatter.selection;
1274
+ const selection =
1275
+ exported && typeof exported === "object" && !Array.isArray(exported)
1276
+ ? { ...exported }
1277
+ : {};
1278
+
1279
+ if (selection.collection !== undefined) {
1280
+ const collectionId =
1281
+ typeof selection.collection === "string"
1282
+ ? collectionSlugToId.get(selection.collection)
1283
+ : undefined;
1284
+ if (!collectionId) {
1285
+ return {
1286
+ payload: null,
1287
+ warning: `skipped the smart collection /${bundle.slug}: the collection it filters by, "${selection.collection}", wasn't imported.`,
1288
+ };
1289
+ }
1290
+ selection.collection = [collectionId];
1291
+ }
1292
+
1293
+ const title =
1294
+ typeof frontMatter.title === "string" && frontMatter.title.trim()
1295
+ ? frontMatter.title
1296
+ : bundle.slug;
1297
+ return {
1298
+ payload: {
1299
+ slug: bundle.slug,
1300
+ title,
1301
+ ...(readCollectionDescription(frontMatter)
1302
+ ? { description: readCollectionDescription(frontMatter) }
1303
+ : {}),
1304
+ selection,
1305
+ // `sortOrder` since 0.10, `sort` before: a site on either version
1306
+ // reads its own name and drops the other.
1307
+ ...(typeof frontMatter.sort_order === "string"
1308
+ ? { sortOrder: frontMatter.sort_order, sort: frontMatter.sort_order }
1309
+ : {}),
1310
+ ...(typeof frontMatter.display_layout === "string"
1311
+ ? { layout: frontMatter.display_layout }
1312
+ : {}),
1313
+ },
1314
+ warning: null,
1315
+ };
1316
+ }
1317
+
1318
+ function normalizeImportedCollectionDirectory(siteConfig) {
1319
+ const jant = siteConfig?.extra?.jant || {};
1320
+ const directoryItems = jant.collections_directory;
1321
+ if (!Array.isArray(directoryItems)) {
1322
+ return {
1323
+ exported: Boolean(jant.collections_directory_exported),
1324
+ items: [],
1325
+ };
1326
+ }
1327
+
1328
+ return {
1329
+ exported: true,
1330
+ items: directoryItems
1331
+ .map((item) => {
1332
+ if (!item || typeof item !== "object") return null;
1333
+
1334
+ if (
1335
+ (item.type === "collection" || item.type === "smart_collection") &&
1336
+ typeof item.slug === "string" &&
1337
+ item.slug.trim()
1338
+ ) {
1339
+ return {
1340
+ type: item.type,
1341
+ slug: item.slug.trim(),
1342
+ };
1343
+ }
1344
+
1345
+ if (item.type === "divider") {
1346
+ return {
1347
+ type: "divider",
1348
+ label: typeof item.label === "string" ? item.label : null,
1349
+ };
1350
+ }
1351
+
1352
+ if (
1353
+ item.type === "link" &&
1354
+ typeof item.label === "string" &&
1355
+ typeof item.url === "string"
1356
+ ) {
1357
+ return {
1358
+ type: "link",
1359
+ label: item.label,
1360
+ url: item.url,
1361
+ description:
1362
+ typeof item.description === "string" && item.description.trim()
1363
+ ? item.description
1364
+ : null,
1365
+ };
1366
+ }
1367
+
1368
+ return null;
1369
+ })
1370
+ .filter(Boolean),
1371
+ };
1372
+ }
1373
+
1374
+ async function buildSiteAvatarImport(siteConfig, sourceRootDir) {
1375
+ const exportInfo = siteConfig?.extra?.jant_export || {};
1376
+ if (exportInfo.format !== "jant-site") {
1377
+ return null;
1378
+ }
1379
+
1380
+ const jant = siteConfig?.extra?.jant || {};
1381
+ const siteAvatarMode =
1382
+ jant.site_avatar_mode === "custom" ||
1383
+ (typeof jant.site_avatar_url === "string" && jant.site_avatar_url.trim())
1384
+ ? "custom"
1385
+ : "none";
1386
+ const faviconMode = jant.favicon_mode === "custom" ? "custom" : "default";
1387
+ const appleTouchMode =
1388
+ jant.apple_touch_mode === "custom" ||
1389
+ (typeof jant.apple_touch_icon_url === "string" &&
1390
+ jant.apple_touch_icon_url.trim())
1391
+ ? "custom"
1392
+ : "default";
1393
+
1394
+ if (siteAvatarMode !== "custom") {
1395
+ return { mode: "remove" };
1396
+ }
1397
+
1398
+ if (!jant.site_avatar_url || typeof jant.site_avatar_url !== "string") {
1399
+ throw new Error(
1400
+ 'Jant export marked site_avatar_mode="custom" but site_avatar_url is missing',
1401
+ );
1402
+ }
1403
+
1404
+ const faviconRawUrl =
1405
+ faviconMode === "custom"
1406
+ ? typeof jant.favicon_url === "string" && jant.favicon_url.trim()
1407
+ ? jant.favicon_url
1408
+ : "/favicon.ico"
1409
+ : null;
1410
+ const appleTouchRawUrl =
1411
+ appleTouchMode === "custom"
1412
+ ? typeof jant.apple_touch_icon_url === "string" &&
1413
+ jant.apple_touch_icon_url.trim()
1414
+ ? jant.apple_touch_icon_url
1415
+ : "/apple-touch-icon.png"
1416
+ : null;
1417
+
1418
+ return {
1419
+ mode: "set",
1420
+ avatarUrl: resolveImportUrl(jant.site_avatar_url, siteConfig),
1421
+ avatarFilePath: await resolveImportLocalAssetPath(
1422
+ jant.site_avatar_url,
1423
+ siteConfig,
1424
+ sourceRootDir,
1425
+ ),
1426
+ faviconUrl: faviconRawUrl
1427
+ ? resolveImportSiteAssetUrl(faviconRawUrl, siteConfig)
1428
+ : null,
1429
+ faviconFilePath: faviconRawUrl
1430
+ ? await resolveImportLocalAssetPath(
1431
+ faviconRawUrl,
1432
+ siteConfig,
1433
+ sourceRootDir,
1434
+ )
1435
+ : null,
1436
+ appleTouchUrl: appleTouchRawUrl
1437
+ ? resolveImportSiteAssetUrl(appleTouchRawUrl, siteConfig)
1438
+ : null,
1439
+ appleTouchFilePath: appleTouchRawUrl
1440
+ ? await resolveImportLocalAssetPath(
1441
+ appleTouchRawUrl,
1442
+ siteConfig,
1443
+ sourceRootDir,
1444
+ )
1445
+ : null,
1446
+ };
1447
+ }
1448
+
1449
+ async function reorderCollectionDirectoryItems(target, orderedIds) {
1450
+ const dedupedIds = [];
1451
+ const seenIds = new Set();
1452
+ for (const id of orderedIds) {
1453
+ if (typeof id !== "string" || !id || seenIds.has(id)) continue;
1454
+ seenIds.add(id);
1455
+ dedupedIds.push(id);
1456
+ }
1457
+
1458
+ let moves = 0;
1459
+
1460
+ for (let index = 0; index < dedupedIds.length; index += 1) {
1461
+ const itemId = dedupedIds[index];
1462
+ const currentItems = await target.listCollectionDirectoryItems();
1463
+ const currentIds = currentItems.map((item) => item.id);
1464
+ const currentIndex = currentIds.indexOf(itemId);
1465
+ if (currentIndex === -1) continue;
1466
+
1467
+ if (index === 0) {
1468
+ if (currentIndex === 0) continue;
1469
+ const beforeId = currentIds.find((id) => id !== itemId) ?? null;
1470
+ await target.moveCollectionDirectoryItem(itemId, null, beforeId);
1471
+ moves += 1;
1472
+ continue;
1473
+ }
1474
+
1475
+ const afterId = dedupedIds[index - 1];
1476
+ const afterIndex = currentIds.indexOf(afterId);
1477
+ if (afterIndex === -1) continue;
1478
+ if (currentIds[afterIndex + 1] === itemId) continue;
1479
+
1480
+ const beforeId =
1481
+ currentIds.slice(afterIndex + 1).find((id) => id !== itemId) ?? null;
1482
+ await target.moveCollectionDirectoryItem(itemId, afterId, beforeId);
1483
+ moves += 1;
1484
+ }
1485
+
1486
+ return moves;
1487
+ }
1488
+
1489
+ async function syncImportedCollectionDirectory(
1490
+ target,
1491
+ importedDirectory,
1492
+ collectionSlugToId,
1493
+ smartCollectionSlugToId,
1494
+ ) {
1495
+ if (!importedDirectory.exported) {
1496
+ return { created: 0, deleted: 0, moved: 0 };
1497
+ }
1498
+
1499
+ let deleted = 0;
1500
+ const existingItems = await target.listCollectionDirectoryItems();
1501
+ // Collections and smart collections get their row when they are created;
1502
+ // dividers and links exist only in the directory and are rebuilt from it.
1503
+ for (const item of existingItems) {
1504
+ if (item.type === "collection" || item.type === "smart_collection") {
1505
+ continue;
1506
+ }
1507
+ const removed = await target.deleteCollectionDirectoryItem(item.id);
1508
+ if (removed !== false) {
1509
+ deleted += 1;
1510
+ }
1511
+ }
1512
+
1513
+ let currentItems = await target.listCollectionDirectoryItems();
1514
+ // Directory rows by what they list: `collection:<id>` or
1515
+ // `smart_collection:<id>`.
1516
+ const rowIdsByTarget = new Map();
1517
+ for (const item of currentItems) {
1518
+ if (item.type === "collection" && item.collectionId) {
1519
+ rowIdsByTarget.set(`collection:${item.collectionId}`, item.id);
1520
+ } else if (item.type === "smart_collection" && item.smartCollectionId) {
1521
+ rowIdsByTarget.set(`smart_collection:${item.smartCollectionId}`, item.id);
1522
+ }
1523
+ }
1524
+
1525
+ const desiredIds = [];
1526
+ const seenTargets = new Set();
1527
+ let created = 0;
1528
+
1529
+ for (const item of importedDirectory.items) {
1530
+ if (item.type === "collection" || item.type === "smart_collection") {
1531
+ const targetId =
1532
+ item.type === "collection"
1533
+ ? collectionSlugToId.get(item.slug)
1534
+ : smartCollectionSlugToId.get(item.slug);
1535
+ const key = `${item.type}:${targetId}`;
1536
+ if (!targetId || seenTargets.has(key)) {
1537
+ continue;
1538
+ }
1539
+ seenTargets.add(key);
1540
+ const directoryItemId = rowIdsByTarget.get(key);
1541
+ if (directoryItemId) {
1542
+ desiredIds.push(directoryItemId);
1543
+ }
1544
+ continue;
1545
+ }
1546
+
1547
+ const createdItem = await target.createCollectionDirectoryItem(
1548
+ item.type === "divider"
1549
+ ? {
1550
+ type: "divider",
1551
+ ...(item.label !== null ? { label: item.label } : {}),
1552
+ }
1553
+ : {
1554
+ type: "link",
1555
+ label: item.label,
1556
+ url: item.url,
1557
+ ...(item.description ? { description: item.description } : {}),
1558
+ },
1559
+ );
1560
+ desiredIds.push(createdItem.id);
1561
+ created += 1;
1562
+ }
1563
+
1564
+ currentItems = await target.listCollectionDirectoryItems();
1565
+ const currentIds = currentItems.map((item) => item.id);
1566
+ const desiredIdSet = new Set(desiredIds);
1567
+ const moved = await reorderCollectionDirectoryItems(target, [
1568
+ ...desiredIds,
1569
+ ...currentIds.filter((id) => !desiredIdSet.has(id)),
1570
+ ]);
1571
+
1572
+ return { created, deleted, moved };
1573
+ }
1574
+
1575
+ function buildIncompleteSetupError(targetLabel) {
1576
+ return [
1577
+ `${targetLabel} has not completed setup.`,
1578
+ "Finish /setup first to create the site and admin account, then run the import again.",
1579
+ "Until setup is finished, imports cannot write site settings, navigation, collections, or posts.",
1580
+ ].join("\n");
1581
+ }
1582
+
1583
+ async function detectRemoteSetupStatus(apiUrl) {
1584
+ try {
1585
+ const response = await fetch(`${apiUrl}/setup`, {
1586
+ redirect: "manual",
1587
+ });
1588
+
1589
+ if (response.status === 200) {
1590
+ return false;
1591
+ }
1592
+
1593
+ if (response.status >= 300 && response.status < 400) {
1594
+ return true;
1595
+ }
1596
+ } catch {
1597
+ return null;
1598
+ }
1599
+
1600
+ return null;
1601
+ }
1602
+
1603
+ async function getIncompleteSetupError(target, targetLabel) {
1604
+ const isSetupComplete = await target.getSetupStatus();
1605
+ if (isSetupComplete !== false) {
1606
+ return null;
1607
+ }
1608
+
1609
+ return buildIncompleteSetupError(targetLabel);
1610
+ }
1611
+
1612
+ class ApiError extends Error {
1613
+ constructor(status, text) {
1614
+ super(`HTTP ${status}: ${text}`);
1615
+ this.status = status;
1616
+ }
1617
+ }
1618
+
1619
+ async function apiCall(method, path, apiUrl, token, body) {
1620
+ const headers = {
1621
+ Authorization: `Bearer ${token}`,
1622
+ "Content-Type": "application/json",
1623
+ };
1624
+
1625
+ let response;
1626
+ try {
1627
+ response = await fetch(`${apiUrl}${path}`, {
1628
+ method,
1629
+ headers,
1630
+ body: body ? JSON.stringify(body) : undefined,
1631
+ });
1632
+ } catch (err) {
1633
+ const cause = err.cause?.code || err.cause?.message || err.message;
1634
+ if (
1635
+ cause === "UNABLE_TO_VERIFY_LEAF_SIGNATURE" ||
1636
+ cause?.includes("certificate")
1637
+ ) {
1638
+ console.error(`\nCertificate error connecting to ${apiUrl}`);
1639
+ console.error(
1640
+ "The certificate is not signed by a CA that Node trusts. For a local",
1641
+ );
1642
+ console.error("or self-signed target, trust this machine's CA store:");
1643
+ console.error(" NODE_OPTIONS=--use-system-ca jant site import ...");
1644
+ process.exit(1);
1645
+ }
1646
+ throw new Error(
1647
+ `Network error calling ${method} ${apiUrl}${path}: ${cause}`,
1648
+ );
1649
+ }
1650
+
1651
+ if (!response.ok) {
1652
+ const text = await response.text();
1653
+ throw new ApiError(response.status, text);
1654
+ }
1655
+
1656
+ return response.json();
1657
+ }
1658
+
1659
+ function toRemotePostPayload(data) {
1660
+ if (data?.format !== "quote") {
1661
+ return data;
1662
+ }
1663
+
1664
+ const { title, url, ...rest } = data;
1665
+ return {
1666
+ ...rest,
1667
+ ...(typeof title === "string" && title.trim() ? { sourceName: title } : {}),
1668
+ ...(typeof url === "string" && url.trim() ? { sourceUrl: url } : {}),
1669
+ };
1670
+ }
1671
+
1672
+ function createRemoteTarget(apiUrl, token) {
1673
+ return {
1674
+ async close() {},
1675
+ async getSetupStatus() {
1676
+ return detectRemoteSetupStatus(apiUrl);
1677
+ },
1678
+ async updateSettings(updates) {
1679
+ return apiCall("PUT", "/api/settings", apiUrl, token, updates);
1680
+ },
1681
+ async restoreLanguages(updates) {
1682
+ return apiCall("PUT", "/api/settings/import", apiUrl, token, updates);
1683
+ },
1684
+ async listNavItems() {
1685
+ const result = await apiCall("GET", "/api/nav-items", apiUrl, token);
1686
+ return result.navItems || [];
1687
+ },
1688
+ async createNavItem(data) {
1689
+ return apiCall("POST", "/api/nav-items", apiUrl, token, data);
1690
+ },
1691
+ async deleteNavItem(id) {
1692
+ return apiCall("DELETE", `/api/nav-items/${id}`, apiUrl, token);
1693
+ },
1694
+ async updateNavItem(id, data) {
1695
+ return apiCall("PUT", `/api/nav-items/${id}`, apiUrl, token, data);
1696
+ },
1697
+ async createCustomUrl(data) {
1698
+ return apiCall("POST", "/api/custom-urls", apiUrl, token, data);
1699
+ },
1700
+ async removeSiteAvatar() {
1701
+ return apiCall("DELETE", "/api/settings/avatar", apiUrl, token);
1702
+ },
1703
+ async uploadSiteAvatar(data) {
1704
+ const avatarAsset = await readImportAsset({
1705
+ sourceUrl: data.avatarUrl,
1706
+ sourceFilePath: data.avatarFilePath,
1707
+ });
1708
+ if (!avatarAsset) {
1709
+ throw new Error(`Failed to read site avatar: ${data.avatarUrl}`);
1710
+ }
1711
+
1712
+ const formData = new FormData();
1713
+ formData.append("file", avatarAsset.blob, avatarAsset.filename);
1714
+
1715
+ if (data.faviconUrl || data.faviconFilePath) {
1716
+ const faviconAsset = await readImportAsset({
1717
+ sourceUrl: data.faviconUrl,
1718
+ sourceFilePath: data.faviconFilePath,
1719
+ mimeType: "image/x-icon",
1720
+ originalName: "favicon.ico",
1721
+ });
1722
+ if (faviconAsset) {
1723
+ formData.append("favicon", faviconAsset.blob, faviconAsset.filename);
1724
+ }
1725
+ }
1726
+
1727
+ if (data.appleTouchUrl) {
1728
+ const appleTouchAsset = await readImportAsset({
1729
+ sourceUrl: data.appleTouchUrl,
1730
+ sourceFilePath: data.appleTouchFilePath,
1731
+ });
1732
+ if (appleTouchAsset) {
1733
+ formData.append(
1734
+ "appleTouch",
1735
+ appleTouchAsset.blob,
1736
+ appleTouchAsset.filename,
1737
+ );
1738
+ }
1739
+ }
1740
+
1741
+ const response = await fetch(`${apiUrl}/api/settings/avatar`, {
1742
+ method: "POST",
1743
+ headers: { Authorization: `Bearer ${token}` },
1744
+ body: formData,
1745
+ });
1746
+
1747
+ if (!response.ok) {
1748
+ throw new Error(`HTTP ${response.status}: ${await response.text()}`);
1749
+ }
1750
+
1751
+ return response.json();
1752
+ },
1753
+ async syncSiteAvatar(data) {
1754
+ await this.removeSiteAvatar();
1755
+ if (!data) {
1756
+ return { success: true };
1757
+ }
1758
+ return this.uploadSiteAvatar(data);
1759
+ },
1760
+ async listCollections() {
1761
+ const existing = await apiCall("GET", "/api/collections", apiUrl, token);
1762
+ return existing.collections || [];
1763
+ },
1764
+ async listCollectionDirectoryItems() {
1765
+ const existing = await apiCall("GET", "/api/collections", apiUrl, token);
1766
+ return existing.directoryItems || [];
1767
+ },
1768
+ async createCollection(data) {
1769
+ return apiCall("POST", "/api/collections", apiUrl, token, data);
1770
+ },
1771
+ async listSmartCollections() {
1772
+ const result = await apiCall(
1773
+ "GET",
1774
+ "/api/smart-collections",
1775
+ apiUrl,
1776
+ token,
1777
+ );
1778
+ return result.smartCollections || [];
1779
+ },
1780
+ async createSmartCollection(data) {
1781
+ const result = await apiCall(
1782
+ "POST",
1783
+ "/api/smart-collections",
1784
+ apiUrl,
1785
+ token,
1786
+ data,
1787
+ );
1788
+ // Bare since 0.10; earlier sites wrap it in `smartCollection`.
1789
+ return result.smartCollection ?? result;
1790
+ },
1791
+ async createCollectionDirectoryItem(data) {
1792
+ return apiCall(
1793
+ "POST",
1794
+ "/api/collections/directory-items",
1795
+ apiUrl,
1796
+ token,
1797
+ data,
1798
+ );
1799
+ },
1800
+ async moveCollectionDirectoryItem(id, after, before) {
1801
+ return apiCall(
1802
+ "PUT",
1803
+ `/api/collections/directory-items/${id}/move`,
1804
+ apiUrl,
1805
+ token,
1806
+ { after, before },
1807
+ );
1808
+ },
1809
+ async deleteCollectionDirectoryItem(id) {
1810
+ return apiCall(
1811
+ "DELETE",
1812
+ `/api/collections/directory-items/${id}`,
1813
+ apiUrl,
1814
+ token,
1815
+ );
1816
+ },
1817
+ async createPost(data) {
1818
+ return apiCall(
1819
+ "POST",
1820
+ "/api/posts",
1821
+ apiUrl,
1822
+ token,
1823
+ toRemotePostPayload(data),
1824
+ );
1825
+ },
1826
+ async linkTranslation(postId, otherPostId) {
1827
+ return apiCall(
1828
+ "POST",
1829
+ `/api/posts/${postId}/translations`,
1830
+ apiUrl,
1831
+ token,
1832
+ { postId: otherPostId },
1833
+ );
1834
+ },
1835
+ async createAlias(path, targetSlug, targetType = "post") {
1836
+ return apiCall("POST", "/api/custom-urls", apiUrl, token, {
1837
+ path,
1838
+ targetType,
1839
+ targetId: targetSlug,
1840
+ });
1841
+ },
1842
+ async uploadMedia(media) {
1843
+ return uploadRemoteMedia(media, apiUrl, token);
1844
+ },
1845
+ async checkPostSlugAvailability(slug) {
1846
+ const result = await apiCall(
1847
+ "GET",
1848
+ `/api/posts/slug?mode=check&slug=${encodeURIComponent(slug)}`,
1849
+ apiUrl,
1850
+ token,
1851
+ );
1852
+ return Boolean(result.available);
1853
+ },
1854
+ };
1855
+ }
1856
+
1857
+ function getBundleTimestamp(bundle) {
1858
+ return parseImportTimestamp(bundle.frontMatter.date);
1859
+ }
1860
+
1861
+ function getBundleSourceId(bundle) {
1862
+ return typeof bundle.frontMatter.id === "string" ? bundle.frontMatter.id : "";
1863
+ }
1864
+
1865
+ /**
1866
+ * Order bundles by `date`, then by the original TypeID (time-sortable, so it
1867
+ * breaks a same-second tie the way the source site did), then by directory.
1868
+ *
1869
+ * @param {{ frontMatter: Record<string, unknown>, dir: string }} a
1870
+ * @param {{ frontMatter: Record<string, unknown>, dir: string }} b
1871
+ * @returns {number} Negative when `a` comes first
1872
+ */
1873
+ function compareBundlesByDateThenId(a, b) {
1874
+ const aDate = getBundleTimestamp(a);
1875
+ const bDate = getBundleTimestamp(b);
1876
+ if (aDate !== null && bDate !== null && aDate !== bDate) return aDate - bDate;
1877
+ if (aDate !== null && bDate === null) return -1;
1878
+ if (aDate === null && bDate !== null) return 1;
1879
+
1880
+ const aId = getBundleSourceId(a);
1881
+ const bId = getBundleSourceId(b);
1882
+ if (aId && bId && aId !== bId) return aId < bId ? -1 : 1;
1883
+
1884
+ return basename(a.dir).localeCompare(basename(b.dir));
1885
+ }
1886
+
1887
+ /**
1888
+ * Order reply bundles by their exported `weight` (position in the Thread),
1889
+ * falling back to {@link compareBundlesByDateThenId} for older exports.
1890
+ *
1891
+ * @param {{ frontMatter: Record<string, unknown>, dir: string }} a
1892
+ * @param {{ frontMatter: Record<string, unknown>, dir: string }} b
1893
+ * @returns {number} Negative when `a` comes first
1894
+ */
1895
+ function compareReplyBundles(a, b) {
1896
+ const aWeight = a.frontMatter.weight;
1897
+ const bWeight = b.frontMatter.weight;
1898
+ if (
1899
+ typeof aWeight === "number" &&
1900
+ typeof bWeight === "number" &&
1901
+ aWeight !== bWeight
1902
+ ) {
1903
+ return aWeight - bWeight;
1904
+ }
1905
+ return compareBundlesByDateThenId(a, b);
1906
+ }
1907
+
1908
+ /**
1909
+ * Walk `content/` and classify each `_index.md` / `index.md` bundle by its
1910
+ * front-matter `type`. Returns ordered root-post bundles (with child reply
1911
+ * bundles attached), collection landing pages, and smart collection pages.
1912
+ *
1913
+ * Algorithm:
1914
+ * 1. Recurse into `content/` collecting every directory that has either
1915
+ * `_index.md` (branch bundle / section) or `index.md` (leaf bundle).
1916
+ * 2. For each `_index.md`, read front matter. `type: "post"` (or a
1917
+ * missing `type` with post-shaped keys) → root bundle. `type:
1918
+ * "collection"` → collection landing page, `type: "smart_collection"` →
1919
+ * smart collection conditions. Other known section types
1920
+ * (`home`, `featured`, `archive`, `collections`) are recorded and
1921
+ * skipped for post import.
1922
+ * 3. For each root bundle, enumerate immediate child directories; any
1923
+ * child dir containing `index.md` becomes a reply leaf bundle.
1924
+ * 4. Reply bundles are sorted by `weight` (Thread position), then `date`,
1925
+ * then the original ID; root bundles by `date`, then the original ID.
1926
+ * Creating posts in that order keeps same-second ties as they were.
1927
+ */
1928
+ async function walkHugoContent(rootDir) {
1929
+ const contentDir = join(rootDir, "content");
1930
+ const contentStat = await stat(contentDir).catch(() => null);
1931
+ if (!contentStat?.isDirectory()) {
1932
+ console.error(`No content/ directory found in ${rootDir}`);
1933
+ process.exit(1);
1934
+ }
1935
+
1936
+ // Map of absolute dir → { frontMatter, body, kind, slug, dir, children[] }
1937
+ const dirs = new Map();
1938
+
1939
+ async function readBundle(dir, fileName) {
1940
+ const filePath = join(dir, fileName);
1941
+ const content = await readFile(filePath, "utf-8").catch(() => null);
1942
+ if (content === null) return null;
1943
+ const { frontMatter, body } = await parseFrontMatter(content);
1944
+ return { frontMatter, body };
1945
+ }
1946
+
1947
+ async function walk(dir) {
1948
+ const entries = await readdir(dir, { withFileTypes: true }).catch(
1949
+ () => null,
1950
+ );
1951
+ if (!entries) return;
1952
+
1953
+ const hasIndex = entries.some(
1954
+ (entry) => entry.isFile() && entry.name === "_index.md",
1955
+ );
1956
+ const hasLeaf = entries.some(
1957
+ (entry) => entry.isFile() && entry.name === "index.md",
1958
+ );
1959
+
1960
+ if (hasIndex) {
1961
+ const parsed = await readBundle(dir, "_index.md");
1962
+ if (parsed) {
1963
+ const type =
1964
+ typeof parsed.frontMatter.type === "string"
1965
+ ? parsed.frontMatter.type
1966
+ : null;
1967
+ const slug =
1968
+ typeof parsed.frontMatter.slug === "string"
1969
+ ? parsed.frontMatter.slug
1970
+ : basename(dir);
1971
+ dirs.set(dir, {
1972
+ kind: type || "post",
1973
+ slug,
1974
+ dir,
1975
+ frontMatter: parsed.frontMatter,
1976
+ body: parsed.body,
1977
+ file: "_index.md",
1978
+ children: [],
1979
+ });
1980
+ }
1981
+ } else if (hasLeaf) {
1982
+ const parsed = await readBundle(dir, "index.md");
1983
+ if (parsed) {
1984
+ const slug =
1985
+ typeof parsed.frontMatter.slug === "string"
1986
+ ? parsed.frontMatter.slug
1987
+ : basename(dir);
1988
+ dirs.set(dir, {
1989
+ kind: "leaf",
1990
+ slug,
1991
+ dir,
1992
+ frontMatter: parsed.frontMatter,
1993
+ body: parsed.body,
1994
+ file: "index.md",
1995
+ children: [],
1996
+ });
1997
+ }
1998
+ }
1999
+
2000
+ for (const entry of entries) {
2001
+ if (entry.isDirectory()) {
2002
+ await walk(join(dir, entry.name));
2003
+ }
2004
+ }
2005
+ }
2006
+
2007
+ await walk(contentDir);
2008
+
2009
+ // Attach leaf children to their parent root bundles.
2010
+ const rootBundles = [];
2011
+ const collectionBundles = [];
2012
+ const smartCollectionBundles = [];
2013
+
2014
+ for (const record of dirs.values()) {
2015
+ if (record.kind === "leaf") {
2016
+ const parentDir = dirname(record.dir);
2017
+ const parent = dirs.get(parentDir);
2018
+ if (parent && (parent.kind === "post" || parent.kind === null)) {
2019
+ parent.children.push(record);
2020
+ }
2021
+ continue;
2022
+ }
2023
+ if (record.kind === "collection") {
2024
+ collectionBundles.push(record);
2025
+ continue;
2026
+ }
2027
+ if (record.kind === "smart_collection") {
2028
+ smartCollectionBundles.push(record);
2029
+ continue;
2030
+ }
2031
+ if (record.kind === "post") {
2032
+ rootBundles.push(record);
2033
+ continue;
2034
+ }
2035
+ // home / featured / archive / collections / anything else — skip.
2036
+ }
2037
+
2038
+ // Replies in Thread order: the exported `weight`, which follows Jant's own
2039
+ // order (creation time, then ID). Older exports have no weight; `date` then
2040
+ // the original ID come next, since replies written in one second tie on
2041
+ // `date`, and the directory name last.
2042
+ for (const root of rootBundles) {
2043
+ root.children.sort(compareReplyBundles);
2044
+ }
2045
+
2046
+ // Roots in creation order, oldest first, so the new IDs keep the original
2047
+ // order among posts that share a second: lists break those ties by ID.
2048
+ rootBundles.sort(compareBundlesByDateThenId);
2049
+
2050
+ return { rootBundles, collectionBundles, smartCollectionBundles };
2051
+ }
2052
+
2053
+ /**
2054
+ * Resolve the collection memberships listed in a post bundle's top-level
2055
+ * `collections:` front-matter array into `{collectionId, createdAt,
2056
+ * position, pinnedAt}` records the post-create APIs expect.
2057
+ *
2058
+ * Drops entries whose slug doesn't map to a known collection — the
2059
+ * importer prints no warning (collections without slugs are already
2060
+ * filtered by the exporter).
2061
+ */
2062
+ function resolveCollectionMemberships(frontMatter, collectionSlugToId) {
2063
+ const collections = Array.isArray(frontMatter.collections)
2064
+ ? frontMatter.collections
2065
+ : [];
2066
+ const entries = [];
2067
+ const ids = [];
2068
+ for (const raw of collections) {
2069
+ if (!raw || typeof raw.slug !== "string") continue;
2070
+ const id = collectionSlugToId.get(raw.slug);
2071
+ if (!id) continue;
2072
+ const entry = { collectionId: id };
2073
+ const createdAt = parseImportTimestamp(raw.collected_at);
2074
+ if (createdAt !== null) {
2075
+ entry.createdAt = createdAt;
2076
+ }
2077
+ if (typeof raw.position === "number" && Number.isFinite(raw.position)) {
2078
+ entry.position = raw.position;
2079
+ }
2080
+ const pinnedAt = parseImportTimestamp(raw.pinned_at);
2081
+ if (pinnedAt !== null) {
2082
+ entry.pinnedAt = pinnedAt;
2083
+ }
2084
+ entries.push(entry);
2085
+ ids.push(id);
2086
+ }
2087
+ return { entries, ids };
2088
+ }
2089
+
2090
+ /**
2091
+ * Resolve one Thread's collection memberships from its root and every reply.
2092
+ *
2093
+ * Current exports write `collections:` only on the root bundle. Older exports
2094
+ * wrote it per post, so import must take the union before creating the root.
2095
+ * Duplicate memberships retain all historical information by taking the
2096
+ * greatest collected/pinned timestamps and the smallest position.
2097
+ */
2098
+ function resolveThreadCollectionMemberships(rootBundle, collectionSlugToId) {
2099
+ const byCollectionId = new Map();
2100
+ const bundles = [rootBundle, ...(rootBundle.children ?? [])];
2101
+
2102
+ for (const bundle of bundles) {
2103
+ const { entries } = resolveCollectionMemberships(
2104
+ bundle.frontMatter,
2105
+ collectionSlugToId,
2106
+ );
2107
+
2108
+ for (const entry of entries) {
2109
+ const current = byCollectionId.get(entry.collectionId);
2110
+ if (!current) {
2111
+ byCollectionId.set(entry.collectionId, { ...entry });
2112
+ continue;
2113
+ }
2114
+
2115
+ if (entry.createdAt !== undefined) {
2116
+ current.createdAt =
2117
+ current.createdAt === undefined
2118
+ ? entry.createdAt
2119
+ : Math.max(current.createdAt, entry.createdAt);
2120
+ }
2121
+ if (entry.position !== undefined) {
2122
+ current.position =
2123
+ current.position === undefined
2124
+ ? entry.position
2125
+ : Math.min(current.position, entry.position);
2126
+ }
2127
+ if (entry.pinnedAt !== undefined) {
2128
+ current.pinnedAt =
2129
+ current.pinnedAt === undefined
2130
+ ? entry.pinnedAt
2131
+ : Math.max(current.pinnedAt, entry.pinnedAt);
2132
+ }
2133
+ }
2134
+ }
2135
+
2136
+ const entries = [...byCollectionId.values()];
2137
+ return {
2138
+ entries,
2139
+ ids: entries.map((entry) => entry.collectionId),
2140
+ };
2141
+ }
2142
+
2143
+ function parseImportTimestamp(value) {
2144
+ if (typeof value !== "string" || value.trim() === "") return null;
2145
+ const timestamp = Date.parse(value);
2146
+ return Number.isFinite(timestamp) ? Math.floor(timestamp / 1000) : null;
2147
+ }
2148
+
2149
+ function getImportedRootLastActivityAt(frontMatter) {
2150
+ return (
2151
+ parseImportTimestamp(frontMatter.last_activity_at) ??
2152
+ parseImportTimestamp(frontMatter.date)
2153
+ );
2154
+ }
2155
+
2156
+ function getImportedPostStatus(frontMatter) {
2157
+ if (frontMatter.status === "draft" || frontMatter.status === "published") {
2158
+ return frontMatter.status;
2159
+ }
2160
+ return frontMatter.draft ? "draft" : "published";
2161
+ }
2162
+
2163
+ function shouldImportReplyQuietly(rootFrontMatter, replyFrontMatter) {
2164
+ if (getImportedPostStatus(replyFrontMatter) !== "published") return false;
2165
+
2166
+ // Exports since quiet_reply became a stored column say so explicitly.
2167
+ if (typeof replyFrontMatter.quiet_reply === "boolean") {
2168
+ return replyFrontMatter.quiet_reply;
2169
+ }
2170
+
2171
+ // Older bundles: a reply published after the root's recorded last activity
2172
+ // can only have gotten there by skipping the bump, so it was quiet.
2173
+ const rootLastActivityAt = getImportedRootLastActivityAt(rootFrontMatter);
2174
+ const replyPublishedAt = parseImportTimestamp(replyFrontMatter.date);
2175
+ return (
2176
+ rootLastActivityAt !== null &&
2177
+ replyPublishedAt !== null &&
2178
+ replyPublishedAt > rootLastActivityAt
2179
+ );
2180
+ }
2181
+
2182
+ /**
2183
+ * The post a Thread's next reply has to answer: the site's rule, the last post
2184
+ * in Thread order. The root comes first whatever its creation time, so the
2185
+ * first reply always ends the Thread; after that the newest reply by creation
2186
+ * time, then by ID, does.
2187
+ *
2188
+ * @param {{ id: string, createdAt: number, replyToId?: string | null }} tail - The current end
2189
+ * @param {{ id: string, createdAt: number, replyToId?: string | null } | null | undefined} created - The post just created
2190
+ * @returns {{ id: string, createdAt: number, replyToId?: string | null }} The new end
2191
+ * @example
2192
+ * getNextThreadTail(
2193
+ * { id: "root", createdAt: 20, replyToId: null },
2194
+ * { id: "r1", createdAt: 10, replyToId: "root" },
2195
+ * );
2196
+ * // r1: a reply older than the root still ends the Thread
2197
+ */
2198
+ function getNextThreadTail(tail, created) {
2199
+ if (!created?.id) return tail;
2200
+ return compareThreadOrder(created, tail) > 0 ? created : tail;
2201
+ }
2202
+
2203
+ /**
2204
+ * Compare two posts of one Thread the way the site orders them (`threadOrder`
2205
+ * in the post service): the root first, then creation time, then ID.
2206
+ *
2207
+ * @param {{ id: string, createdAt: number, replyToId?: string | null }} a
2208
+ * @param {{ id: string, createdAt: number, replyToId?: string | null }} b
2209
+ * @returns {number} Negative when `a` comes first, positive when `b` does
2210
+ * @example
2211
+ * compareThreadOrder({ id: "r1", createdAt: 10, replyToId: "root" },
2212
+ * { id: "root", createdAt: 20, replyToId: null }); // 1
2213
+ */
2214
+ function compareThreadOrder(a, b) {
2215
+ const rank = (post) => (post.replyToId ? 1 : 0);
2216
+ if (rank(a) !== rank(b)) return rank(a) - rank(b);
2217
+ if (a.createdAt !== b.createdAt) return a.createdAt - b.createdAt;
2218
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
2219
+ }
2220
+
2221
+ /**
2222
+ * Build the payload for `target.createPost()` from a parsed bundle. Works
2223
+ * for both root bundles (`forReply: false`) and reply leaf bundles — the
2224
+ * front-matter shape is identical aside from `build:` and the parent link.
2225
+ */
2226
+ function buildPostPayloadFromBundle(bundle, options) {
2227
+ const { frontMatter } = bundle;
2228
+ const format =
2229
+ typeof frontMatter.format === "string" ? frontMatter.format : "note";
2230
+ const slug =
2231
+ typeof frontMatter.slug === "string" ? frontMatter.slug : undefined;
2232
+ const status =
2233
+ frontMatter.status === "draft" || frontMatter.status === "published"
2234
+ ? frontMatter.status
2235
+ : frontMatter.draft
2236
+ ? "draft"
2237
+ : "published";
2238
+ // Accept every canonical visibility value (see `VISIBILITIES` in
2239
+ // `src/types/constants.ts`). Anything else — or missing — falls back to
2240
+ // the service default (`public`).
2241
+ const visibility =
2242
+ frontMatter.visibility === "public" ||
2243
+ frontMatter.visibility === "latest_hidden" ||
2244
+ frontMatter.visibility === "private"
2245
+ ? frontMatter.visibility
2246
+ : undefined;
2247
+ const { entries: collectionEntries, ids: collectionIds } =
2248
+ options.memberships;
2249
+
2250
+ const data = {
2251
+ format,
2252
+ title:
2253
+ format === "quote"
2254
+ ? typeof frontMatter.source_name === "string"
2255
+ ? frontMatter.source_name
2256
+ : undefined
2257
+ : typeof frontMatter.title === "string"
2258
+ ? frontMatter.title
2259
+ : undefined,
2260
+ bodyMarkdown: options.bodyMarkdown || undefined,
2261
+ slug,
2262
+ status,
2263
+ visibility,
2264
+ collectionIds:
2265
+ collectionEntries.length === 0 && collectionIds.length > 0
2266
+ ? collectionIds
2267
+ : undefined,
2268
+ collectionEntries:
2269
+ collectionEntries.length > 0 ? collectionEntries : undefined,
2270
+ attachments:
2271
+ options.attachments.length > 0 ? options.attachments : undefined,
2272
+ publishedAt:
2273
+ status === "published" && typeof frontMatter.date === "string"
2274
+ ? Math.floor(new Date(frontMatter.date).getTime() / 1000)
2275
+ : undefined,
2276
+ // `date` holds the publish time of a published post and the creation
2277
+ // time of a draft; `created` and `updated` are written when they differ.
2278
+ createdAt:
2279
+ parseImportTimestamp(frontMatter.created) ??
2280
+ parseImportTimestamp(frontMatter.date) ??
2281
+ undefined,
2282
+ updatedAt:
2283
+ parseImportTimestamp(frontMatter.updated) ??
2284
+ parseImportTimestamp(frontMatter.date) ??
2285
+ undefined,
2286
+ featuredAt:
2287
+ typeof frontMatter.featured_at === "string" && frontMatter.featured_at
2288
+ ? Math.floor(new Date(frontMatter.featured_at).getTime() / 1000)
2289
+ : undefined,
2290
+ pinnedAt:
2291
+ typeof frontMatter.pinned_at === "string" && frontMatter.pinned_at
2292
+ ? Math.floor(new Date(frontMatter.pinned_at).getTime() / 1000)
2293
+ : undefined,
2294
+ rating:
2295
+ typeof frontMatter.rating === "number" ? frontMatter.rating : undefined,
2296
+ // Roots only: replies take the root's language from the service, and a
2297
+ // reply bundle has no language of its own in the export.
2298
+ language:
2299
+ !options.replyToId && typeof frontMatter.language === "string"
2300
+ ? frontMatter.language
2301
+ : undefined,
2302
+ quietReply: options.quietReply ? true : undefined,
2303
+ };
2304
+
2305
+ if (options.replyToId) {
2306
+ data.replyToId = options.replyToId;
2307
+ }
2308
+
2309
+ if (format === "link" && typeof frontMatter.link_url === "string") {
2310
+ data.url = frontMatter.link_url;
2311
+ }
2312
+ if (format === "quote") {
2313
+ if (typeof frontMatter.quote_text === "string") {
2314
+ data.quoteText = frontMatter.quote_text;
2315
+ }
2316
+ if (
2317
+ typeof frontMatter.source_url === "string" &&
2318
+ frontMatter.source_url.trim()
2319
+ ) {
2320
+ data.url = frontMatter.source_url;
2321
+ }
2322
+ }
2323
+
2324
+ return data;
2325
+ }
2326
+
2327
+ export const __test__ = {
2328
+ isAbsoluteImportUrl,
2329
+ resolveImportUrl,
2330
+ readMediaSpecAsset,
2331
+ normalizeMediaSpec,
2332
+ normalizeTextAttachmentSpec,
2333
+ extractAttachmentBlocks,
2334
+ buildImportedAttachments,
2335
+ uploadMediaList,
2336
+ uploadBundleResources,
2337
+ buildSettingsUpdatesFromConfig,
2338
+ splitSettingsUpdatesForImport,
2339
+ normalizeImportedNavItems,
2340
+ buildNavItemCreateRequest,
2341
+ buildSmartCollectionCreateRequest,
2342
+ normalizeImportedCustomUrls,
2343
+ normalizeImportedCollectionDirectory,
2344
+ buildSiteAvatarImport,
2345
+ reorderCollectionDirectoryItems,
2346
+ syncImportedCollectionDirectory,
2347
+ getRootAliasPathsForImport,
2348
+ toRemotePostPayload,
2349
+ buildIncompleteSetupError,
2350
+ detectRemoteSetupStatus,
2351
+ getIncompleteSetupError,
2352
+ loadSiteConfig,
2353
+ checkSiteExportVersion,
2354
+ walkHugoContent,
2355
+ mediaSpecFromJantMedia,
2356
+ resolveCollectionMemberships,
2357
+ resolveThreadCollectionMemberships,
2358
+ buildPostPayloadFromBundle,
2359
+ shouldImportReplyQuietly,
2360
+ getNextThreadTail,
2361
+ };
2362
+
2363
+ function printImportUsage() {
2364
+ console.log("Usage: jant site import --url <url> [options]");
2365
+ console.log("");
2366
+ console.log("Import a Hugo export directory or ZIP into a Jant site.");
2367
+ console.log("");
2368
+ console.log("Options:");
2369
+ console.log(" --url Jant site URL (required)");
2370
+ console.log(
2371
+ " --path Path to export directory or ZIP file (default: jant-site-export.zip)",
2372
+ );
2373
+ console.log(" --dry-run Parse and validate without making API calls");
2374
+ console.log(
2375
+ " --skip-remote-media Skip uploading absolute-URL images found in body (relative paths and declared media still import)",
2376
+ );
2377
+ console.log(" --token API token (overrides JANT_API_TOKEN)");
2378
+ console.log("");
2379
+ console.log(
2380
+ "Import expects an empty target site and fails on slug or alias conflicts.",
2381
+ );
2382
+ console.log("");
2383
+ console.log("Authentication:");
2384
+ console.log(` export ${CLI_API_TOKEN_ENV_VAR}=jnt_your_token`);
2385
+ console.log(
2386
+ " jant site import --url https://your-site.example --path ./export",
2387
+ );
2388
+ console.log("");
2389
+ console.log("Examples:");
2390
+ console.log(
2391
+ " jant site import --url https://your-site.example --path ./jant-site",
2392
+ );
2393
+ console.log(
2394
+ " jant site import --url https://your-site.example --path ./jant-site-export.zip",
2395
+ );
2396
+ }
2
2397
 
3
2398
  export async function run(argv) {
4
- return runSiteImport(argv);
2399
+ const { values, positionals } = parseArgs({
2400
+ args: argv,
2401
+ allowPositionals: true,
2402
+ options: {
2403
+ url: { type: "string" },
2404
+ token: { type: "string" },
2405
+ // What `site export` writes when given no --output.
2406
+ path: { type: "string", default: "jant-site-export.zip" },
2407
+ "dry-run": { type: "boolean", default: false },
2408
+ "skip-remote-media": { type: "boolean", default: false },
2409
+ help: { type: "boolean", short: "h" },
2410
+ },
2411
+ });
2412
+
2413
+ if (values.help) {
2414
+ printImportUsage();
2415
+ process.exit(0);
2416
+ }
2417
+
2418
+ const positionalError = findPositionalUrl("site import", positionals);
2419
+ if (positionalError) {
2420
+ console.error(`Error: ${positionalError}`);
2421
+ process.exit(1);
2422
+ }
2423
+
2424
+ const url = values.url?.trim();
2425
+ if (!url) {
2426
+ console.error("Error: --url is required");
2427
+ console.error("");
2428
+ printImportUsage();
2429
+ process.exit(1);
2430
+ }
2431
+
2432
+ const dryRun = values["dry-run"];
2433
+ const token = getCliApiToken(process.env, values.token);
2434
+ if (!token && !dryRun) {
2435
+ console.error(
2436
+ `Error: site import requires ${CLI_API_TOKEN_ENV_VAR} or --token (unless using --dry-run)`,
2437
+ );
2438
+ console.error("");
2439
+ console.error(` export ${CLI_API_TOKEN_ENV_VAR}=jnt_your_token`);
2440
+ process.exit(1);
2441
+ }
2442
+
2443
+ const apiUrl = url.replace(/\/$/, "");
2444
+ const skipRemoteMedia = values["skip-remote-media"];
2445
+ const target = dryRun ? null : createRemoteTarget(apiUrl, token);
2446
+ /** Exported translation-group ID → IDs of the posts created for it. */
2447
+ const translationGroups = new Map();
2448
+
2449
+ // 1. Read source — directory or ZIP
2450
+ const inputPath = resolve(process.cwd(), values.path);
2451
+ const inputStat = await stat(inputPath).catch(() => null);
2452
+
2453
+ if (!inputStat) {
2454
+ console.error(`Path not found: ${inputPath}`);
2455
+ process.exit(1);
2456
+ }
2457
+
2458
+ let sourceRootDir = inputPath;
2459
+ let tempSourceRootDir = null;
2460
+
2461
+ if (inputStat.isFile()) {
2462
+ console.log(`Reading ZIP ${inputPath}...`);
2463
+ tempSourceRootDir = await mkdtemp(join(tmpdir(), "jant-site-import-"));
2464
+ sourceRootDir = tempSourceRootDir;
2465
+ await extractZipFile(inputPath, sourceRootDir);
2466
+ } else {
2467
+ console.log(`Reading directory ${inputPath}...`);
2468
+ }
2469
+
2470
+ const { rootBundles, collectionBundles, smartCollectionBundles } =
2471
+ await walkHugoContent(sourceRootDir);
2472
+ const siteConfig = await loadSiteConfig(sourceRootDir);
2473
+ const versionError = checkSiteExportVersion(siteConfig);
2474
+ if (versionError) {
2475
+ console.error(`Error: ${versionError}`);
2476
+ if (tempSourceRootDir) {
2477
+ await rm(tempSourceRootDir, { recursive: true, force: true });
2478
+ }
2479
+ process.exit(1);
2480
+ }
2481
+ const customCss = await readImportCustomCss(sourceRootDir);
2482
+
2483
+ try {
2484
+ const replyCount = rootBundles.reduce(
2485
+ (sum, root) => sum + root.children.length,
2486
+ 0,
2487
+ );
2488
+ console.log(
2489
+ `Found ${rootBundles.length} posts (+${replyCount} replies), ${collectionBundles.length} collections, and ${smartCollectionBundles.length} smart collections`,
2490
+ );
2491
+ const importedCollectionDirectory = siteConfig
2492
+ ? normalizeImportedCollectionDirectory(siteConfig)
2493
+ : { exported: false, items: [] };
2494
+ const importedNav = siteConfig
2495
+ ? normalizeImportedNavItems(siteConfig)
2496
+ : { exported: false, items: [] };
2497
+ const importedCustomUrls = siteConfig
2498
+ ? normalizeImportedCustomUrls(siteConfig)
2499
+ : [];
2500
+
2501
+ if (target) {
2502
+ const setupError = await getIncompleteSetupError(
2503
+ target,
2504
+ `Target site at ${apiUrl}`,
2505
+ );
2506
+ if (setupError) {
2507
+ console.error("");
2508
+ console.error(setupError);
2509
+ console.error("");
2510
+ process.exit(1);
2511
+ }
2512
+ }
2513
+
2514
+ if (siteConfig) {
2515
+ const settingsUpdates = buildSettingsUpdatesFromConfig(
2516
+ siteConfig,
2517
+ customCss,
2518
+ );
2519
+ const avatarImport = await buildSiteAvatarImport(
2520
+ siteConfig,
2521
+ sourceRootDir,
2522
+ );
2523
+
2524
+ if (dryRun) {
2525
+ console.log("[dry-run] Would apply exported site settings");
2526
+ if (importedNav.exported) {
2527
+ console.log(
2528
+ `[dry-run] Would replace navigation with ${importedNav.items.length} items`,
2529
+ );
2530
+ }
2531
+ if (avatarImport) {
2532
+ if (avatarImport.mode === "remove") {
2533
+ console.log("[dry-run] Would remove existing site avatar");
2534
+ } else {
2535
+ console.log("[dry-run] Would import exported site avatar");
2536
+ }
2537
+ }
2538
+ } else {
2539
+ const { editable, appearance, languages } =
2540
+ splitSettingsUpdatesForImport(settingsUpdates);
2541
+ try {
2542
+ const result = await target.updateSettings(editable);
2543
+ if (result?.rejectedKeys?.length) {
2544
+ console.warn(
2545
+ `Warning: Some site settings were rejected: ${result.rejectedKeys.join(", ")}`,
2546
+ );
2547
+ }
2548
+ } catch (err) {
2549
+ console.error(
2550
+ `Error applying exported site settings: ${err.message}`,
2551
+ );
2552
+ process.exit(1);
2553
+ }
2554
+
2555
+ if (Object.keys(appearance).length > 0) {
2556
+ try {
2557
+ await target.updateSettings(appearance);
2558
+ } catch (err) {
2559
+ console.warn(
2560
+ `Warning: kept this site's theme, fonts, and custom CSS: ${err.message}`,
2561
+ );
2562
+ }
2563
+ }
2564
+
2565
+ if (Object.keys(languages).length > 0) {
2566
+ try {
2567
+ await target.restoreLanguages(languages);
2568
+ } catch (err) {
2569
+ console.error(
2570
+ `Error restoring the site's languages: ${err.message}`,
2571
+ );
2572
+ process.exit(1);
2573
+ }
2574
+ }
2575
+
2576
+ if (avatarImport) {
2577
+ try {
2578
+ await target.syncSiteAvatar(
2579
+ avatarImport.mode === "set" ? avatarImport : null,
2580
+ );
2581
+ } catch (err) {
2582
+ // Non-fatal: continue the rest of the import even if the avatar
2583
+ // source asset is unreachable (e.g. unreadable file, stale URL).
2584
+ // The rest of the site data is far more valuable than losing the
2585
+ // entire import over a single image.
2586
+ console.warn(
2587
+ `Warning: Could not import site avatar — continuing without it. (${err.message})`,
2588
+ );
2589
+ }
2590
+ }
2591
+ }
2592
+ }
2593
+
2594
+ // 3. Fetch existing collections and create missing ones
2595
+ const collectionSlugToId = new Map();
2596
+ // Custom URLs recreated, for collections here and for posts in step 4.
2597
+ let aliasesCreated = 0;
2598
+ let aliasesSkipped = 0;
2599
+ // Root posts by slug, for navigation entries that point at a page.
2600
+ const postSlugToId = new Map();
2601
+
2602
+ if (!dryRun) {
2603
+ try {
2604
+ const existingCollections = await target.listCollections();
2605
+ for (const col of existingCollections) {
2606
+ collectionSlugToId.set(col.slug, col.id);
2607
+ }
2608
+ } catch (err) {
2609
+ console.error(`Error fetching existing collections: ${err.message}`);
2610
+ process.exit(1);
2611
+ }
2612
+ }
2613
+
2614
+ for (const bundle of collectionBundles) {
2615
+ const slug = bundle.slug;
2616
+
2617
+ if (collectionSlugToId.has(slug)) {
2618
+ console.error(
2619
+ `Import conflict: collection slug "${slug}" is already in use. Import into an empty site or remove the existing collection first.`,
2620
+ );
2621
+ process.exit(1);
2622
+ }
2623
+
2624
+ if (dryRun) {
2625
+ console.log(
2626
+ `[dry-run] Would create collection: ${bundle.frontMatter.title || slug}`,
2627
+ );
2628
+ collectionSlugToId.set(slug, `dry-run-${slug}`);
2629
+ continue;
2630
+ }
2631
+
2632
+ try {
2633
+ const result = await target.createCollection({
2634
+ title: bundle.frontMatter.title || slug,
2635
+ slug,
2636
+ description: readCollectionDescription(bundle.frontMatter),
2637
+ sortOrder:
2638
+ typeof bundle.frontMatter.sort_order === "string"
2639
+ ? bundle.frontMatter.sort_order
2640
+ : undefined,
2641
+ });
2642
+ collectionSlugToId.set(slug, result.id);
2643
+ console.log(`Created collection: ${bundle.frontMatter.title || slug}`);
2644
+ } catch (err) {
2645
+ console.error(`Error creating collection "${slug}": ${err.message}`);
2646
+ process.exit(1);
2647
+ }
2648
+
2649
+ // Custom URLs that name the collection.
2650
+ const collectionAliases = Array.isArray(bundle.frontMatter.aliases)
2651
+ ? bundle.frontMatter.aliases.filter(
2652
+ (alias) => typeof alias === "string" && alias.trim(),
2653
+ )
2654
+ : [];
2655
+ for (const alias of collectionAliases) {
2656
+ try {
2657
+ await target.createAlias(alias, slug, "collection");
2658
+ aliasesCreated++;
2659
+ } catch (err) {
2660
+ aliasesSkipped++;
2661
+ console.warn(
2662
+ `Warning: couldn't add ${alias} for collection /${slug}: ${err.message}`,
2663
+ );
2664
+ }
2665
+ }
2666
+ }
2667
+
2668
+ // Smart collections after collections, which their conditions may name.
2669
+ // They hold no posts, so nothing about them waits for the posts below.
2670
+ const smartCollectionSlugToId = new Map();
2671
+ if (!dryRun) {
2672
+ try {
2673
+ for (const existing of await target.listSmartCollections()) {
2674
+ smartCollectionSlugToId.set(existing.slug, existing.id);
2675
+ }
2676
+ } catch (err) {
2677
+ console.error(
2678
+ `Error fetching existing smart collections: ${err.message}`,
2679
+ );
2680
+ process.exit(1);
2681
+ }
2682
+ }
2683
+
2684
+ for (const bundle of smartCollectionBundles) {
2685
+ const slug = bundle.slug;
2686
+ if (smartCollectionSlugToId.has(slug)) {
2687
+ console.error(
2688
+ `Import conflict: smart collection slug "${slug}" is already in use. Import into an empty site or remove the existing smart collection first.`,
2689
+ );
2690
+ process.exit(1);
2691
+ }
2692
+
2693
+ const request = buildSmartCollectionCreateRequest(
2694
+ bundle,
2695
+ collectionSlugToId,
2696
+ );
2697
+ if (!request.payload) {
2698
+ console.warn(`Warning: ${request.warning}`);
2699
+ continue;
2700
+ }
2701
+
2702
+ if (dryRun) {
2703
+ console.log(
2704
+ `[dry-run] Would create smart collection: ${request.payload.title}`,
2705
+ );
2706
+ smartCollectionSlugToId.set(slug, `dry-run-${slug}`);
2707
+ continue;
2708
+ }
2709
+
2710
+ try {
2711
+ const created = await target.createSmartCollection(request.payload);
2712
+ smartCollectionSlugToId.set(slug, created.id);
2713
+ console.log(`Created smart collection: ${request.payload.title}`);
2714
+ } catch (err) {
2715
+ console.error(
2716
+ `Error creating smart collection "${slug}": ${err.message}`,
2717
+ );
2718
+ process.exit(1);
2719
+ }
2720
+ }
2721
+
2722
+ if (importedCollectionDirectory.exported) {
2723
+ if (dryRun) {
2724
+ console.log(
2725
+ `[dry-run] Would restore collection directory with ${importedCollectionDirectory.items.length} items`,
2726
+ );
2727
+ } else {
2728
+ try {
2729
+ await syncImportedCollectionDirectory(
2730
+ target,
2731
+ importedCollectionDirectory,
2732
+ collectionSlugToId,
2733
+ smartCollectionSlugToId,
2734
+ );
2735
+ } catch (err) {
2736
+ console.error(
2737
+ `Error restoring collections directory: ${err.message}`,
2738
+ );
2739
+ process.exit(1);
2740
+ }
2741
+ }
2742
+ }
2743
+
2744
+ // 4. Process posts — root bundle first, then each reply leaf, then aliases.
2745
+ let postsCreated = 0;
2746
+ let repliesCreated = 0;
2747
+ let mediaUploaded = 0;
2748
+
2749
+ for (const rootBundle of rootBundles) {
2750
+ const { frontMatter: rootFm } = rootBundle;
2751
+ const postSlug = rootBundle.slug;
2752
+ const format = typeof rootFm.format === "string" ? rootFm.format : "note";
2753
+ const postLabel =
2754
+ (format === "quote"
2755
+ ? typeof rootFm.source_name === "string"
2756
+ ? rootFm.source_name
2757
+ : null
2758
+ : typeof rootFm.title === "string"
2759
+ ? rootFm.title
2760
+ : null) ||
2761
+ postSlug ||
2762
+ "(untitled)";
2763
+
2764
+ if (!dryRun) {
2765
+ await assertImportSlugAvailable(target, postSlug, postLabel, "post");
2766
+ }
2767
+
2768
+ // Normalize body + extract embedded attachment blocks.
2769
+ const normalizedRoot = normalizeImportedBodySegment(rootBundle.body);
2770
+ let rootBody = normalizedRoot.markdown;
2771
+ let importedAttachments = [];
2772
+
2773
+ // Upload media declared in flat `media:` front matter. Each entry's
2774
+ // `src` is either a site-relative path (bytes under `static/`) or an
2775
+ // absolute URL (media still served by the original provider).
2776
+ // Text attachments (`kind: "text"`) live under the same `media:` key
2777
+ // but must be imported via `normalizeTextAttachmentSpec` so the body
2778
+ // is decoded and stored as a text attachment rather than uploaded as
2779
+ // a generic media file.
2780
+ const rootResourceSpecs = [];
2781
+ const rootTextAttachmentEntries = [];
2782
+ if (Array.isArray(rootFm.media)) {
2783
+ for (const entry of rootFm.media) {
2784
+ if (entry && typeof entry === "object" && entry.kind === "text") {
2785
+ rootTextAttachmentEntries.push(entry);
2786
+ continue;
2787
+ }
2788
+ const spec = await mediaSpecFromJantMedia(entry, sourceRootDir);
2789
+ if (spec) rootResourceSpecs.push(spec);
2790
+ }
2791
+ }
2792
+
2793
+ const rootResourceIds = [];
2794
+ if (!dryRun && rootResourceSpecs.length > 0) {
2795
+ const result = await uploadBundleResources(rootResourceSpecs, target);
2796
+ mediaUploaded += result.uploaded;
2797
+ if (result.urlMap.size > 0) {
2798
+ rootBody = rewriteMediaReferences(rootBody, result.urlMap);
2799
+ }
2800
+ rootResourceIds.push(...result.mediaIds);
2801
+ }
2802
+
2803
+ // Fallback: rewrite any leftover in-body image URLs (covers hand-
2804
+ // authored Hugo content where the exporter didn't declare resources).
2805
+ // `--skip-remote-media` filters out absolute URLs here so we only
2806
+ // rehost relative paths (the source site's own files).
2807
+ if (!dryRun) {
2808
+ const fallbackUrls = findImageUrls(rootBody).filter(
2809
+ (url) => !skipRemoteMedia || !isAbsoluteImportUrl(url),
2810
+ );
2811
+ const imageMedia = fallbackUrls.map((src) => ({ src }));
2812
+ const uploadResult = await uploadMediaList(
2813
+ imageMedia,
2814
+ target,
2815
+ siteConfig,
2816
+ sourceRootDir,
2817
+ );
2818
+ mediaUploaded += uploadResult.uploaded;
2819
+ if (uploadResult.urlMap.size > 0) {
2820
+ rootBody = rewriteMediaReferences(rootBody, uploadResult.urlMap);
2821
+ }
2822
+ }
2823
+
2824
+ if (!dryRun) {
2825
+ const attachmentResult = await buildImportedAttachments(
2826
+ normalizedRoot.attachments,
2827
+ target,
2828
+ siteConfig,
2829
+ sourceRootDir,
2830
+ );
2831
+ importedAttachments = attachmentResult.attachments;
2832
+ mediaUploaded += attachmentResult.uploaded;
2833
+ }
2834
+
2835
+ // Also attach every uploaded root page-resource as a media attachment
2836
+ // so the post record carries them even when none appear in body text.
2837
+ for (const mediaId of rootResourceIds) {
2838
+ importedAttachments.push({ type: "media", mediaId });
2839
+ }
2840
+
2841
+ // Build text attachments declared in the flat `media:` front matter.
2842
+ // These reference a `.md` artifact that holds the full body; the
2843
+ // normalizer fetches the bytes (local disk first, then remote URL)
2844
+ // and decodes them.
2845
+ if (!dryRun) {
2846
+ for (const textEntry of rootTextAttachmentEntries) {
2847
+ const textAttachment = await normalizeTextAttachmentSpec(
2848
+ textEntry,
2849
+ siteConfig,
2850
+ sourceRootDir,
2851
+ );
2852
+ if (textAttachment) importedAttachments.push(textAttachment);
2853
+ }
2854
+ }
2855
+
2856
+ const memberships = resolveThreadCollectionMemberships(
2857
+ rootBundle,
2858
+ collectionSlugToId,
2859
+ );
2860
+ const postData = buildPostPayloadFromBundle(rootBundle, {
2861
+ bodyMarkdown: rootBody,
2862
+ attachments: importedAttachments,
2863
+ memberships,
2864
+ replyToId: null,
2865
+ });
2866
+
2867
+ if (dryRun) {
2868
+ console.log(`[dry-run] Would create post: ${postLabel} (${format})`);
2869
+ if (rootBundle.children.length > 0) {
2870
+ console.log(` [dry-run] With ${rootBundle.children.length} replies`);
2871
+ }
2872
+ postsCreated++;
2873
+ repliesCreated += rootBundle.children.length;
2874
+ continue;
2875
+ }
2876
+
2877
+ const progress = `[${postsCreated + 1}/${rootBundles.length}]`;
2878
+ let post;
2879
+ try {
2880
+ post = await target.createPost(postData);
2881
+ postsCreated++;
2882
+ if (post?.id && post.slug) postSlugToId.set(post.slug, post.id);
2883
+ // Translation groups are rebuilt after every post exists: the group ID
2884
+ // in the export is opaque and its members can appear in any order, so
2885
+ // there is nothing to link to until the whole run is done.
2886
+ const groupKey =
2887
+ typeof rootFm.translation_group === "string"
2888
+ ? rootFm.translation_group.trim()
2889
+ : "";
2890
+ if (groupKey && post?.id) {
2891
+ const members = translationGroups.get(groupKey) ?? [];
2892
+ members.push(post.id);
2893
+ translationGroups.set(groupKey, members);
2894
+ }
2895
+ const replyInfo =
2896
+ rootBundle.children.length > 0
2897
+ ? ` (+${rootBundle.children.length} replies)`
2898
+ : "";
2899
+ console.log(`${progress} Created: ${postLabel}${replyInfo}`);
2900
+ } catch (err) {
2901
+ console.error(`Error creating post "${postLabel}": ${err.message}`);
2902
+ process.exit(1);
2903
+ }
2904
+
2905
+ // Create replies before aliases so reply slugs can claim their paths.
2906
+ if (!post) continue;
2907
+ const replySlugPaths = new Set();
2908
+ // Jant threads are linear: a reply must point at the current end of the
2909
+ // thread, which the site reads as its last post in Thread order — the
2910
+ // root first, then replies by creation time, then ID. Creation times
2911
+ // are restored from the export (or taken from `date` in an older one),
2912
+ // so a reply sent after another can carry the earlier time; the end is
2913
+ // then the one with the later time, not the one sent last. Track it by
2914
+ // the site's rule.
2915
+ let threadTail = post;
2916
+ for (const replyBundle of rootBundle.children) {
2917
+ const replyFm = replyBundle.frontMatter;
2918
+ const replySlug = replyBundle.slug;
2919
+ const replyFormat =
2920
+ typeof replyFm.format === "string" ? replyFm.format : "note";
2921
+ const replyLabel =
2922
+ (replyFormat === "quote"
2923
+ ? typeof replyFm.source_name === "string"
2924
+ ? replyFm.source_name
2925
+ : null
2926
+ : typeof replyFm.title === "string"
2927
+ ? replyFm.title
2928
+ : null) ||
2929
+ replySlug ||
2930
+ "(untitled reply)";
2931
+
2932
+ const replySlugPath = normalizeImportAliasPath(replySlug);
2933
+ if (replySlugPath) replySlugPaths.add(replySlugPath);
2934
+
2935
+ await assertImportSlugAvailable(
2936
+ target,
2937
+ replySlug,
2938
+ `${replyLabel} in ${postLabel}`,
2939
+ "reply",
2940
+ );
2941
+
2942
+ const normalizedReply = normalizeImportedBodySegment(replyBundle.body);
2943
+ let replyBody = normalizedReply.markdown;
2944
+ let replyAttachments = [];
2945
+
2946
+ const replyResourceSpecs = [];
2947
+ const replyTextAttachmentEntries = [];
2948
+ if (Array.isArray(replyFm.media)) {
2949
+ for (const entry of replyFm.media) {
2950
+ if (entry && typeof entry === "object" && entry.kind === "text") {
2951
+ replyTextAttachmentEntries.push(entry);
2952
+ continue;
2953
+ }
2954
+ const spec = await mediaSpecFromJantMedia(entry, sourceRootDir);
2955
+ if (spec) replyResourceSpecs.push(spec);
2956
+ }
2957
+ }
2958
+
2959
+ const replyResourceIds = [];
2960
+ if (replyResourceSpecs.length > 0) {
2961
+ const result = await uploadBundleResources(
2962
+ replyResourceSpecs,
2963
+ target,
2964
+ );
2965
+ mediaUploaded += result.uploaded;
2966
+ if (result.urlMap.size > 0) {
2967
+ replyBody = rewriteMediaReferences(replyBody, result.urlMap);
2968
+ }
2969
+ replyResourceIds.push(...result.mediaIds);
2970
+ }
2971
+
2972
+ {
2973
+ const fallbackUrls = findImageUrls(replyBody).filter(
2974
+ (url) => !skipRemoteMedia || !isAbsoluteImportUrl(url),
2975
+ );
2976
+ const imageMedia = fallbackUrls.map((src) => ({ src }));
2977
+ const uploadResult = await uploadMediaList(
2978
+ imageMedia,
2979
+ target,
2980
+ siteConfig,
2981
+ sourceRootDir,
2982
+ );
2983
+ mediaUploaded += uploadResult.uploaded;
2984
+ if (uploadResult.urlMap.size > 0) {
2985
+ replyBody = rewriteMediaReferences(replyBody, uploadResult.urlMap);
2986
+ }
2987
+ }
2988
+
2989
+ const attachmentResult = await buildImportedAttachments(
2990
+ normalizedReply.attachments,
2991
+ target,
2992
+ siteConfig,
2993
+ sourceRootDir,
2994
+ );
2995
+ replyAttachments = attachmentResult.attachments;
2996
+ mediaUploaded += attachmentResult.uploaded;
2997
+ for (const mediaId of replyResourceIds) {
2998
+ replyAttachments.push({ type: "media", mediaId });
2999
+ }
3000
+
3001
+ for (const textEntry of replyTextAttachmentEntries) {
3002
+ const textAttachment = await normalizeTextAttachmentSpec(
3003
+ textEntry,
3004
+ siteConfig,
3005
+ sourceRootDir,
3006
+ );
3007
+ if (textAttachment) replyAttachments.push(textAttachment);
3008
+ }
3009
+
3010
+ const replyData = buildPostPayloadFromBundle(replyBundle, {
3011
+ bodyMarkdown: replyBody,
3012
+ attachments: replyAttachments,
3013
+ memberships: { entries: [], ids: [] },
3014
+ replyToId: threadTail.id,
3015
+ quietReply: shouldImportReplyQuietly(rootFm, replyFm),
3016
+ });
3017
+
3018
+ try {
3019
+ const createdReply = await target.createPost(replyData);
3020
+ repliesCreated++;
3021
+ threadTail = getNextThreadTail(threadTail, createdReply);
3022
+ } catch (err) {
3023
+ console.error(` Error creating reply: ${err.message}`);
3024
+ process.exit(1);
3025
+ }
3026
+ }
3027
+
3028
+ // Create exported root aliases after replies. Historical root slugs
3029
+ // round-trip via `root_aliases:`; reply slugs are handled by their
3030
+ // own bundles so we strip them from the alias list.
3031
+ const rootTargetSlug = postSlug || post.slug;
3032
+ const aliases = Array.isArray(rootFm.aliases) ? rootFm.aliases : [];
3033
+ const rootAliases = Array.isArray(rootFm.root_aliases)
3034
+ ? rootFm.root_aliases
3035
+ : [];
3036
+ const aliasPaths = getRootAliasPathsForImport(
3037
+ aliases,
3038
+ rootAliases,
3039
+ rootTargetSlug,
3040
+ replySlugPaths,
3041
+ );
3042
+ // An address an earlier release allowed can be one this release
3043
+ // refuses, such as `/~me`. The post is in already; losing one old way
3044
+ // in is better than stopping with the site half imported.
3045
+ for (const aliasPath of aliasPaths) {
3046
+ try {
3047
+ await target.createAlias(aliasPath, rootTargetSlug);
3048
+ aliasesCreated++;
3049
+ } catch (err) {
3050
+ aliasesSkipped++;
3051
+ console.warn(
3052
+ `Warning: couldn't add ${aliasPath} for "${postLabel}": ${err.message}`,
3053
+ );
3054
+ }
3055
+ }
3056
+ }
3057
+
3058
+ // Rebuild translation groups. Each member is linked to the first one, so a
3059
+ // group of N takes N-1 calls and never asks the server to merge two groups
3060
+ // — which it refuses, on purpose.
3061
+ let translationsLinked = 0;
3062
+ for (const [groupKey, members] of translationGroups) {
3063
+ if (members.length < 2) continue;
3064
+ const [anchor, ...rest] = members;
3065
+ for (const memberId of rest) {
3066
+ try {
3067
+ await target.linkTranslation(anchor, memberId);
3068
+ translationsLinked++;
3069
+ } catch (err) {
3070
+ // A clash here means the export itself held two posts in the same
3071
+ // language for one group. Say so and keep going: the posts are
3072
+ // imported either way, they are just not linked.
3073
+ console.warn(
3074
+ `Warning: could not link a translation in group "${groupKey}": ${err.message}`,
3075
+ );
3076
+ }
3077
+ }
3078
+ }
3079
+
3080
+ // Navigation and custom URLs go last: they point at posts and
3081
+ // collections, which exist by now.
3082
+ let customUrlsCreated = 0;
3083
+ if (!dryRun && target) {
3084
+ if (importedNav.exported) {
3085
+ try {
3086
+ const existingNavItems = await target.listNavItems();
3087
+ for (const item of existingNavItems) {
3088
+ await target.deleteNavItem(item.id);
3089
+ }
3090
+ for (const item of importedNav.items) {
3091
+ const request = buildNavItemCreateRequest(item, {
3092
+ collectionSlugToId,
3093
+ smartCollectionSlugToId,
3094
+ postSlugToId,
3095
+ });
3096
+ if (request.warning) console.warn(`Warning: ${request.warning}`);
3097
+ const created = await target.createNavItem(request.payload);
3098
+ if (request.customLabel && created?.id) {
3099
+ await target.updateNavItem(created.id, {
3100
+ label: request.customLabel,
3101
+ });
3102
+ }
3103
+ }
3104
+ } catch (err) {
3105
+ console.error(`Error importing navigation: ${err.message}`);
3106
+ process.exit(1);
3107
+ }
3108
+ }
3109
+
3110
+ for (const customUrl of importedCustomUrls) {
3111
+ if (customUrl.kind === "archive") {
3112
+ console.warn(
3113
+ `Warning: skipped /${customUrl.path}, an archive URL (${customUrl.archiveQuery ?? "no filter"}). Archive URLs can no longer be created. Create a smart collection at /${customUrl.path} with the same conditions, here or on the source site before exporting.`,
3114
+ );
3115
+ continue;
3116
+ }
3117
+ try {
3118
+ await target.createCustomUrl({
3119
+ path: customUrl.path,
3120
+ targetType: "redirect",
3121
+ toPath: customUrl.to,
3122
+ redirectType: String(customUrl.status),
3123
+ });
3124
+ customUrlsCreated++;
3125
+ } catch (err) {
3126
+ console.warn(
3127
+ `Warning: couldn't recreate the redirect /${customUrl.path} → ${customUrl.to}: ${err.message}`,
3128
+ );
3129
+ }
3130
+ }
3131
+ } else if (dryRun && importedCustomUrls.length > 0) {
3132
+ console.log(
3133
+ `[dry-run] Would recreate ${importedCustomUrls.length} custom URLs`,
3134
+ );
3135
+ }
3136
+
3137
+ await target?.close();
3138
+
3139
+ // 5. Summary
3140
+ console.log("");
3141
+ console.log("Import complete:");
3142
+ console.log(` Posts created: ${postsCreated}`);
3143
+ console.log(` Replies created: ${repliesCreated}`);
3144
+ console.log(` Media uploaded: ${mediaUploaded}`);
3145
+ if (translationsLinked > 0) {
3146
+ console.log(` Translations linked: ${translationsLinked}`);
3147
+ }
3148
+ if (aliasesCreated > 0) {
3149
+ console.log(` Aliases created: ${aliasesCreated}`);
3150
+ }
3151
+ if (aliasesSkipped > 0) {
3152
+ console.log(
3153
+ ` Aliases skipped: ${aliasesSkipped} (see the warnings above)`,
3154
+ );
3155
+ }
3156
+ if (customUrlsCreated > 0) {
3157
+ console.log(` Redirects created: ${customUrlsCreated}`);
3158
+ }
3159
+ if (dryRun) {
3160
+ console.log(" (dry-run mode — no changes were made)");
3161
+ }
3162
+ } finally {
3163
+ if (tempSourceRootDir) {
3164
+ await rm(tempSourceRootDir, { recursive: true, force: true });
3165
+ }
3166
+ }
5
3167
  }