bookish-press 0.5.192 → 0.5.193

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 (436) hide show
  1. package/dist/_app/immutable/assets/Authors-0d526c21.css +1 -0
  2. package/dist/_app/immutable/assets/Authors-d1ca6aa3.css +1 -0
  3. package/dist/_app/immutable/assets/BookList-1e316155.css +1 -0
  4. package/dist/_app/immutable/assets/BookList-f982329c.css +1 -0
  5. package/dist/_app/immutable/assets/Button-683f94f5.css +2 -0
  6. package/dist/_app/immutable/assets/Button-e37c3ab4.css +1 -0
  7. package/dist/_app/immutable/assets/Chapter-d3458d18.css +1 -0
  8. package/dist/_app/immutable/assets/Chapter-fd98eb93.css +1 -0
  9. package/dist/_app/immutable/assets/ChapterBody-9179f500.css +1 -0
  10. package/dist/_app/immutable/assets/ChapterBody-a7ddad8c.css +1 -0
  11. package/dist/_app/immutable/assets/ChapterNumber-c590ef3b.css +1 -0
  12. package/dist/_app/immutable/assets/ChapterNumber-f1d0088b.css +1 -0
  13. package/dist/_app/immutable/assets/ChapterTitle-132a58c6.css +1 -0
  14. package/dist/_app/immutable/assets/ChapterTitle-a375ea84.css +1 -0
  15. package/dist/_app/immutable/assets/DarkToggle-324aa5f1.css +1 -0
  16. package/dist/_app/immutable/assets/DarkToggle-a1126472.css +1 -0
  17. package/dist/_app/immutable/assets/Edition-8b27cade.css +1 -0
  18. package/dist/_app/immutable/assets/Edition-c91ce507.css +1 -0
  19. package/dist/_app/immutable/assets/Embed-0db9be84.css +1 -0
  20. package/dist/_app/immutable/assets/Embed-e297693d.css +1 -0
  21. package/dist/_app/immutable/assets/Feedback-6226b606.css +1 -0
  22. package/dist/_app/immutable/assets/Feedback-ee2d9de1.css +1 -0
  23. package/dist/_app/immutable/assets/Format-30ea15fb.css +1 -0
  24. package/dist/_app/immutable/assets/Format-4a255f60.css +21 -0
  25. package/dist/_app/immutable/assets/Glossary-696d7060.css +1 -0
  26. package/dist/_app/immutable/assets/Glossary-e0ebf939.css +1 -0
  27. package/dist/_app/immutable/assets/Head-11348233.css +1 -0
  28. package/dist/_app/immutable/assets/Head-aba1befc.css +1 -0
  29. package/dist/_app/immutable/assets/Icon-cd9f602a.css +1 -0
  30. package/dist/_app/immutable/assets/Icon-fbbba6cc.css +3 -0
  31. package/dist/_app/immutable/assets/Index-27b49740.css +1 -0
  32. package/dist/_app/immutable/assets/Index-f6666510.css +1 -0
  33. package/dist/_app/immutable/assets/Instructions-396b701a.css +1 -0
  34. package/dist/_app/immutable/assets/Instructions-c156b7f7.css +1 -0
  35. package/dist/_app/immutable/assets/Large-7248ed66.css +1 -0
  36. package/dist/_app/immutable/assets/Large-e8510437.css +1 -0
  37. package/dist/_app/immutable/assets/Lead-0005aeac.css +1 -0
  38. package/dist/_app/immutable/assets/Lead-5877073a.css +1 -0
  39. package/dist/_app/immutable/assets/Link-43d195b8.css +1 -0
  40. package/dist/_app/immutable/assets/Link-a29a626e.css +1 -0
  41. package/dist/_app/immutable/assets/Link-cbc3ccfd.css +1 -0
  42. package/dist/_app/immutable/assets/Link-ea313bbf.css +1 -0
  43. package/dist/_app/immutable/assets/Loading-3ac6d51d.css +1 -0
  44. package/dist/_app/immutable/assets/Loading-6ee67a4a.css +1 -0
  45. package/dist/_app/immutable/assets/Media-a5397681.css +1 -0
  46. package/dist/_app/immutable/assets/Media-eb62dad2.css +1 -0
  47. package/dist/_app/immutable/assets/Muted-2d8ec279.css +1 -0
  48. package/dist/_app/immutable/assets/Muted-57703595.css +1 -0
  49. package/dist/_app/immutable/assets/Outline-848693bd.css +1 -0
  50. package/dist/_app/immutable/assets/Outline-f6bd015e.css +5 -0
  51. package/dist/_app/immutable/assets/PageHeader-2b6c7ada.css +1 -0
  52. package/dist/_app/immutable/assets/PageHeader-da9d418b.css +1 -0
  53. package/dist/_app/immutable/assets/Paragraph-01e3aad7.css +1 -0
  54. package/dist/_app/immutable/assets/Paragraph-7f19cc8e.css +1 -0
  55. package/dist/_app/immutable/assets/Permissions-8af5ea43.css +1 -0
  56. package/dist/_app/immutable/assets/Permissions-fd4b44f3.css +1 -0
  57. package/dist/_app/immutable/assets/Print-59605fef.css +1 -0
  58. package/dist/_app/immutable/assets/Print-e64e14ab.css +1 -0
  59. package/dist/_app/immutable/assets/References-0b18fc46.css +2 -0
  60. package/dist/_app/immutable/assets/References-d70cb1bf.css +1 -0
  61. package/dist/_app/immutable/assets/Rows-07fb2a04.css +1 -0
  62. package/dist/_app/immutable/assets/Rows-4ced10e6.css +1 -0
  63. package/dist/_app/immutable/assets/Search-3f0933c0.css +1 -0
  64. package/dist/_app/immutable/assets/Search-c6d55600.css +1 -0
  65. package/dist/_app/immutable/assets/Section-2b198a5b.css +1 -0
  66. package/dist/_app/immutable/assets/Section-e2c611bc.css +1 -0
  67. package/dist/_app/immutable/assets/Switch-5ae826ed.css +1 -0
  68. package/dist/_app/immutable/assets/Switch-5f61ca79.css +1 -0
  69. package/dist/_app/immutable/assets/TableOfContents-1eb14800.css +1 -0
  70. package/dist/_app/immutable/assets/TableOfContents-e208c385.css +1 -0
  71. package/dist/_app/immutable/assets/TextInput-1594694e.css +1 -0
  72. package/dist/_app/immutable/assets/TextInput-70a0c716.css +2 -0
  73. package/dist/_app/immutable/assets/_error-1d5c4e5a.css +3 -0
  74. package/dist/_app/immutable/assets/_error-2a1b730c.css +1 -0
  75. package/dist/_app/immutable/assets/_layout-2a89a5bc.css +10 -0
  76. package/dist/_app/immutable/assets/_layout-b89c5db4.css +1 -0
  77. package/dist/_app/immutable/assets/_page-b4364e7c.css +1 -0
  78. package/dist/_app/immutable/assets/_page-d554b167.css +1 -0
  79. package/dist/_app/immutable/chunks/0-391221a6.js +1 -0
  80. package/dist/_app/immutable/chunks/1-6f456e31.js +1 -0
  81. package/dist/_app/immutable/chunks/10-2e7bb350.js +1 -0
  82. package/dist/_app/immutable/chunks/11-bd8f6140.js +1 -0
  83. package/dist/_app/immutable/chunks/12-7da99a0d.js +1 -0
  84. package/dist/_app/immutable/chunks/13-c3b259cf.js +1 -0
  85. package/dist/_app/immutable/chunks/14-638f36e2.js +1 -0
  86. package/dist/_app/immutable/chunks/15-eccea1da.js +1 -0
  87. package/dist/_app/immutable/chunks/16-f212cc13.js +1 -0
  88. package/dist/_app/immutable/chunks/17-f7645981.js +1 -0
  89. package/dist/_app/immutable/chunks/18-80899467.js +1 -0
  90. package/dist/_app/immutable/chunks/19-a24387d5.js +1 -0
  91. package/dist/_app/immutable/chunks/2-46f8e5ff.js +1 -0
  92. package/dist/_app/immutable/chunks/20-6034c472.js +1 -0
  93. package/dist/_app/immutable/chunks/21-f1ee95d7.js +1 -0
  94. package/dist/_app/immutable/chunks/22-09b27807.js +1 -0
  95. package/dist/_app/immutable/chunks/23-4b5a8a3a.js +1 -0
  96. package/dist/_app/immutable/chunks/24-3c4a016e.js +1 -0
  97. package/dist/_app/immutable/chunks/25-da39d143.js +1 -0
  98. package/dist/_app/immutable/chunks/26-3f6c485e.js +1 -0
  99. package/dist/_app/immutable/chunks/27-1c8ed342.js +1 -0
  100. package/dist/_app/immutable/chunks/28-e41167eb.js +1 -0
  101. package/dist/_app/immutable/chunks/29-7756650f.js +1 -0
  102. package/dist/_app/immutable/chunks/3-fca44a2c.js +1 -0
  103. package/dist/_app/immutable/chunks/30-3cdf8a0b.js +1 -0
  104. package/dist/_app/immutable/chunks/31-2a0cc201.js +1 -0
  105. package/dist/_app/immutable/chunks/32-482d396e.js +1 -0
  106. package/dist/_app/immutable/chunks/33-1214b085.js +1 -0
  107. package/dist/_app/immutable/chunks/34-47c6e06f.js +1 -0
  108. package/dist/_app/immutable/chunks/4-446921f7.js +1 -0
  109. package/dist/_app/immutable/chunks/5-e3572995.js +1 -0
  110. package/dist/_app/immutable/chunks/6-e7a2f2f5.js +1 -0
  111. package/dist/_app/immutable/chunks/7-3815480a.js +1 -0
  112. package/dist/_app/immutable/chunks/8-a5f2d72a.js +1 -0
  113. package/dist/_app/immutable/chunks/9-4d225c18.js +1 -0
  114. package/dist/_app/immutable/chunks/Authors-34afa7d2.js +1 -0
  115. package/dist/_app/immutable/chunks/BookList-136bbb7d.js +1 -0
  116. package/dist/_app/immutable/chunks/Button-b59ec206.js +1 -0
  117. package/dist/_app/immutable/chunks/Chapter-4b09b8df.js +13 -0
  118. package/dist/_app/immutable/chunks/ChapterBody-e3121609.js +2 -0
  119. package/dist/_app/immutable/chunks/ChapterNumber-efbfa4d5.js +1 -0
  120. package/dist/_app/immutable/chunks/ChapterTitle-2ef94d38.js +1 -0
  121. package/dist/_app/immutable/chunks/Contexts-9f2cc2fa.js +35 -0
  122. package/dist/_app/immutable/chunks/DarkToggle-6b16bf9c.js +58 -0
  123. package/dist/_app/immutable/chunks/Edition-0196ace9.js +15 -0
  124. package/dist/_app/immutable/chunks/Editions-75264e71.js +17 -0
  125. package/dist/_app/immutable/chunks/Embed-8f6c7b1e.js +1 -0
  126. package/dist/_app/immutable/chunks/Feedback-02155d4f.js +1 -0
  127. package/dist/_app/immutable/chunks/Firebase-c97744dc.js +3340 -0
  128. package/dist/_app/immutable/chunks/Format-4d4050b8.js +16 -0
  129. package/dist/_app/immutable/chunks/Glossary-994211ff.js +5 -0
  130. package/dist/_app/immutable/chunks/Head-8b87dcf9.js +1 -0
  131. package/dist/_app/immutable/chunks/Icon-6d10b010.js +1 -0
  132. package/dist/_app/immutable/chunks/Index-a477a5e9.js +3 -0
  133. package/dist/_app/immutable/chunks/Instructions-289ea859.js +1 -0
  134. package/dist/_app/immutable/chunks/Large-d20a134b.js +1 -0
  135. package/dist/_app/immutable/chunks/Lead-2e56c23a.js +1 -0
  136. package/dist/_app/immutable/chunks/Link-9ed8813f.js +1 -0
  137. package/dist/_app/immutable/chunks/Link-bf3cfc4a.js +1 -0
  138. package/dist/_app/immutable/chunks/Loading-960c572a.js +1 -0
  139. package/dist/_app/immutable/chunks/Media-395a62c0.js +11 -0
  140. package/dist/_app/immutable/chunks/Muted-6c007c27.js +1 -0
  141. package/dist/_app/immutable/chunks/Outline-8482e267.js +10 -0
  142. package/dist/_app/immutable/chunks/PageHeader-ae302247.js +1 -0
  143. package/dist/_app/immutable/chunks/Paragraph-86b48564.js +1 -0
  144. package/dist/_app/immutable/chunks/Permissions-2fd12288.js +1 -0
  145. package/dist/_app/immutable/chunks/PossibleChapter-149a86eb.js +1 -0
  146. package/dist/_app/immutable/chunks/Print-3fa5354a.js +1 -0
  147. package/dist/_app/immutable/chunks/References-db6c4c00.js +7 -0
  148. package/dist/_app/immutable/chunks/Rows-2e420ce9.js +1 -0
  149. package/dist/_app/immutable/chunks/Search-a4a69c2c.js +3 -0
  150. package/dist/_app/immutable/chunks/Section-e4f40e8b.js +1 -0
  151. package/dist/_app/immutable/chunks/Switch-2beb5fed.js +1 -0
  152. package/dist/_app/immutable/chunks/TableOfContents-b4c8911f.js +25 -0
  153. package/dist/_app/immutable/chunks/TextInput-9a2845d7.js +1 -0
  154. package/dist/_app/immutable/chunks/Theme-40b1ca02.js +1 -0
  155. package/dist/_app/immutable/chunks/Unknown-b8b5c2c9.js +3 -0
  156. package/dist/_app/immutable/chunks/_layout-744122fc.js +1 -0
  157. package/dist/_app/immutable/chunks/control-e7f5239e.js +1 -0
  158. package/dist/_app/immutable/chunks/dark-86e1a6f5.js +1 -0
  159. package/dist/_app/immutable/chunks/index-437f4d21.js +4 -0
  160. package/dist/_app/immutable/chunks/navigation-e50a9b06.js +1 -0
  161. package/dist/_app/immutable/chunks/singletons-3041590b.js +1 -0
  162. package/dist/_app/immutable/chunks/stores-63c51a3f.js +1 -0
  163. package/dist/_app/immutable/components/error.svelte-8032a6bb.js +1 -0
  164. package/dist/_app/immutable/components/layout.svelte-ec4f57bc.js +1 -0
  165. package/dist/_app/immutable/components/pages/(app)/_layout.svelte-fb2c53ee.js +3 -0
  166. package/dist/_app/immutable/components/pages/(app)/_page.svelte-f762e334.js +17 -0
  167. package/dist/_app/immutable/components/pages/(app)/about/_page.svelte-0abc2e61.js +59 -0
  168. package/dist/_app/immutable/components/pages/(app)/confirm/_page.svelte-b93010ab.js +1 -0
  169. package/dist/_app/immutable/components/pages/(app)/email/_page.svelte-0dbfae76.js +1 -0
  170. package/dist/_app/immutable/components/pages/(app)/login/_page.svelte-3936d831.js +3 -0
  171. package/dist/_app/immutable/components/pages/(app)/read/_page.svelte-a7177144.js +1 -0
  172. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/_chapterid_/_page.svelte-09312bf2.js +1 -0
  173. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/_layout.svelte-dbf0531e.js +1 -0
  174. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/_page.svelte-624e897f.js +1 -0
  175. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/glossary/_page.svelte-40fd954c.js +1 -0
  176. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/index/__letter__/_page.svelte-b516c009.js +1 -0
  177. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/media/_page.svelte-3074c96c.js +1 -0
  178. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/print/_page.svelte-388ee9e3.js +1 -0
  179. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/references/_page.svelte-41167df1.js +1 -0
  180. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/search/_page.svelte-03a6f0de.js +1 -0
  181. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/theme/_page.svelte-314b9acb.js +15 -0
  182. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/__editionid_edition__/unknown/_page.svelte-5a6c3272.js +1 -0
  183. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/_layout.svelte-8bc62b8c.js +1 -0
  184. package/dist/_app/immutable/components/pages/(app)/write/_bookid_/editions/_page.svelte-ba2ac9d6.js +1 -0
  185. package/dist/_app/immutable/components/pages/(app)/write/_error.svelte-45a36b1c.js +1 -0
  186. package/dist/_app/immutable/components/pages/(app)/write/_layout.svelte-f292be56.js +1 -0
  187. package/dist/_app/immutable/components/pages/(app)/write/_page.svelte-6b12e63c.js +1 -0
  188. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/_chapterid_/_page.svelte-39cc7ab8.js +1 -0
  189. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/_page.svelte-47d6142c.js +1 -0
  190. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/glossary/_page.svelte-da39265b.js +1 -0
  191. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/index/__letter__/_page.svelte-bf1f4c4a.js +1 -0
  192. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/media/_page.svelte-d8ddb855.js +1 -0
  193. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/print/_page.svelte-cd6495d9.js +1 -0
  194. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/references/_page.svelte-32bc454f.js +1 -0
  195. package/dist/_app/immutable/components/pages/(reader)/_bookid_/__editionid_edition__/search/_page.svelte-97bc25f7.js +1 -0
  196. package/dist/_app/immutable/components/pages/(reader)/_bookid_/_layout.svelte-6e9ac5df.js +1 -0
  197. package/dist/_app/immutable/components/pages/(reader)/_error.svelte-be0856b0.js +1 -0
  198. package/dist/_app/immutable/modules/pages/(reader)/_bookid_/_layout.ts-f423fff7.js +1 -0
  199. package/dist/_app/immutable/start-0f124364.js +1 -0
  200. package/dist/_app/version.json +1 -0
  201. package/dist/components/controls/DarkToggle.svelte.d.ts +1 -1
  202. package/dist/icons/favicon.png +0 -0
  203. package/dist/icons/icon.png +0 -0
  204. package/dist/icons/ios-icon.png +0 -0
  205. package/dist/index.html +38 -0
  206. package/package.json +1 -1
  207. package/dist/components/Auth.svelte +0 -55
  208. package/dist/components/Authentication.js +0 -1
  209. package/dist/components/BookPreview.svelte +0 -101
  210. package/dist/components/Link.svelte +0 -52
  211. package/dist/components/app/BookList.svelte +0 -19
  212. package/dist/components/app/Button.svelte +0 -52
  213. package/dist/components/app/Feedback.svelte +0 -40
  214. package/dist/components/app/Head.svelte +0 -15
  215. package/dist/components/app/Large.svelte +0 -8
  216. package/dist/components/app/Lead.svelte +0 -12
  217. package/dist/components/app/Link.svelte +0 -36
  218. package/dist/components/app/Options.svelte +0 -24
  219. package/dist/components/app/Paragraph.svelte +0 -20
  220. package/dist/components/app/Section.svelte +0 -12
  221. package/dist/components/app/Table.svelte +0 -32
  222. package/dist/components/app/TextInput.svelte +0 -39
  223. package/dist/components/chapter/Atom.svelte +0 -43
  224. package/dist/components/chapter/Block.svelte +0 -37
  225. package/dist/components/chapter/Callout.svelte +0 -41
  226. package/dist/components/chapter/CaptionedCode.svelte +0 -77
  227. package/dist/components/chapter/ChapterBody.svelte +0 -68
  228. package/dist/components/chapter/Citations.svelte +0 -134
  229. package/dist/components/chapter/Code.svelte +0 -167
  230. package/dist/components/chapter/Comment.svelte +0 -62
  231. package/dist/components/chapter/Definition.svelte +0 -77
  232. package/dist/components/chapter/Embed.svelte +0 -211
  233. package/dist/components/chapter/ErrorMessage.svelte +0 -9
  234. package/dist/components/chapter/ExtendedPrism.js +0 -69
  235. package/dist/components/chapter/Figure.svelte +0 -90
  236. package/dist/components/chapter/Footnote.svelte +0 -89
  237. package/dist/components/chapter/Format.svelte +0 -81
  238. package/dist/components/chapter/InlineCode.svelte +0 -22
  239. package/dist/components/chapter/Label.svelte +0 -47
  240. package/dist/components/chapter/Link.svelte +0 -58
  241. package/dist/components/chapter/List.svelte +0 -86
  242. package/dist/components/chapter/Marginal.svelte +0 -208
  243. package/dist/components/chapter/Paragraph.svelte +0 -96
  244. package/dist/components/chapter/Positioned.svelte +0 -33
  245. package/dist/components/chapter/Problem.svelte +0 -15
  246. package/dist/components/chapter/Python.svelte +0 -128
  247. package/dist/components/chapter/Quote.svelte +0 -79
  248. package/dist/components/chapter/Rule.svelte +0 -15
  249. package/dist/components/chapter/Table.svelte +0 -40
  250. package/dist/components/chapter/Text.svelte +0 -87
  251. package/dist/components/editor/BookishEditor.svelte +0 -886
  252. package/dist/components/editor/CalloutEditor.svelte +0 -10
  253. package/dist/components/editor/CaptionedCodeEditor.svelte +0 -26
  254. package/dist/components/editor/CaretContext.js +0 -1
  255. package/dist/components/editor/CaretState.js +0 -1
  256. package/dist/components/editor/CaretUtilities.js +0 -1
  257. package/dist/components/editor/CaretView.svelte +0 -82
  258. package/dist/components/editor/CitationsEditor.svelte +0 -53
  259. package/dist/components/editor/Clipboard.js +0 -1
  260. package/dist/components/editor/Command.js +0 -1
  261. package/dist/components/editor/Commands.js +0 -1494
  262. package/dist/components/editor/ConfirmButton.svelte +0 -23
  263. package/dist/components/editor/DefinitionEditor.svelte +0 -36
  264. package/dist/components/editor/EmbedEditor.svelte +0 -137
  265. package/dist/components/editor/Icon.svelte +0 -17
  266. package/dist/components/editor/ImageChooser.svelte +0 -89
  267. package/dist/components/editor/InlineCodeEditor.svelte +0 -12
  268. package/dist/components/editor/LabelEditor.svelte +0 -32
  269. package/dist/components/editor/LanguageEditor.svelte +0 -14
  270. package/dist/components/editor/LinkEditor.svelte +0 -101
  271. package/dist/components/editor/Note.svelte +0 -10
  272. package/dist/components/editor/Permissions.svelte +0 -93
  273. package/dist/components/editor/PositionEditor.svelte +0 -17
  274. package/dist/components/editor/QuoteEditor.svelte +0 -10
  275. package/dist/components/editor/Switch.svelte +0 -83
  276. package/dist/components/editor/TableEditor.svelte +0 -10
  277. package/dist/components/editor/TextEditor.svelte +0 -230
  278. package/dist/components/editor/Toggle.svelte +0 -41
  279. package/dist/components/editor/Toolbar.svelte +0 -255
  280. package/dist/components/editor/ToolbarGroup.svelte +0 -35
  281. package/dist/components/editor/ToolbarSpacer.svelte +0 -8
  282. package/dist/components/editor/URLEditor.svelte +0 -15
  283. package/dist/components/editor/UndoState.js +0 -1
  284. package/dist/components/editor/icons/annotate.svg +0 -1
  285. package/dist/components/editor/icons/block.svg +0 -1
  286. package/dist/components/editor/icons/bold.svg +0 -1
  287. package/dist/components/editor/icons/bullets.svg +0 -1
  288. package/dist/components/editor/icons/callout.svg +0 -1
  289. package/dist/components/editor/icons/citation.svg +0 -8
  290. package/dist/components/editor/icons/clear.svg +0 -1
  291. package/dist/components/editor/icons/clipboard.svg +0 -1
  292. package/dist/components/editor/icons/code.svg +0 -1
  293. package/dist/components/editor/icons/columnafter.svg +0 -1
  294. package/dist/components/editor/icons/columnbefore.svg +0 -1
  295. package/dist/components/editor/icons/comment.svg +0 -1
  296. package/dist/components/editor/icons/copy.svg +0 -1
  297. package/dist/components/editor/icons/cut.svg +0 -1
  298. package/dist/components/editor/icons/define.svg +0 -7
  299. package/dist/components/editor/icons/deletecolumn.svg +0 -1
  300. package/dist/components/editor/icons/deleterow.svg +0 -1
  301. package/dist/components/editor/icons/footnote.svg +0 -8
  302. package/dist/components/editor/icons/header1.svg +0 -7
  303. package/dist/components/editor/icons/header2.svg +0 -7
  304. package/dist/components/editor/icons/header3.svg +0 -7
  305. package/dist/components/editor/icons/home.svg +0 -1
  306. package/dist/components/editor/icons/indent.svg +0 -1
  307. package/dist/components/editor/icons/italic.svg +0 -1
  308. package/dist/components/editor/icons/label.svg +0 -1
  309. package/dist/components/editor/icons/left.svg +0 -1
  310. package/dist/components/editor/icons/level.svg +0 -1
  311. package/dist/components/editor/icons/link.svg +0 -1
  312. package/dist/components/editor/icons/list.svg +0 -1
  313. package/dist/components/editor/icons/media.svg +0 -1
  314. package/dist/components/editor/icons/middle.svg +0 -1
  315. package/dist/components/editor/icons/numbers.svg +0 -10
  316. package/dist/components/editor/icons/paragraph.svg +0 -1
  317. package/dist/components/editor/icons/paste.svg +0 -10
  318. package/dist/components/editor/icons/quote.svg +0 -1
  319. package/dist/components/editor/icons/redo.svg +0 -1
  320. package/dist/components/editor/icons/right.svg +0 -1
  321. package/dist/components/editor/icons/rowabove.svg +0 -1
  322. package/dist/components/editor/icons/rowbelow.svg +0 -1
  323. package/dist/components/editor/icons/rule.svg +0 -1
  324. package/dist/components/editor/icons/sub.svg +0 -1
  325. package/dist/components/editor/icons/super.svg +0 -1
  326. package/dist/components/editor/icons/table.svg +0 -1
  327. package/dist/components/editor/icons/text.svg +0 -1
  328. package/dist/components/editor/icons/time.svg +0 -1
  329. package/dist/components/editor/icons/undo.svg +0 -1
  330. package/dist/components/editor/icons/unindent.svg +0 -1
  331. package/dist/components/editor/icons/unlink.svg +0 -1
  332. package/dist/components/page/Acknowledgements.svelte +0 -40
  333. package/dist/components/page/Authors.svelte +0 -86
  334. package/dist/components/page/BookLoader.svelte +0 -59
  335. package/dist/components/page/BulkReferenceEditor.svelte +0 -63
  336. package/dist/components/page/Chapter.svelte +0 -395
  337. package/dist/components/page/ChapterContext.js +0 -1
  338. package/dist/components/page/ChapterNumber.svelte +0 -9
  339. package/dist/components/page/ChapterTitle.svelte +0 -16
  340. package/dist/components/page/Contexts.js +0 -144
  341. package/dist/components/page/DefinitionView.svelte +0 -167
  342. package/dist/components/page/Description.svelte +0 -34
  343. package/dist/components/page/Edition.svelte +0 -154
  344. package/dist/components/page/EditionLoader.svelte +0 -99
  345. package/dist/components/page/Editions.svelte +0 -109
  346. package/dist/components/page/Glossary.svelte +0 -77
  347. package/dist/components/page/Header.svelte +0 -195
  348. package/dist/components/page/Index.svelte +0 -157
  349. package/dist/components/page/Instructions.svelte +0 -31
  350. package/dist/components/page/License.svelte +0 -45
  351. package/dist/components/page/Loading.svelte +0 -103
  352. package/dist/components/page/Media.svelte +0 -106
  353. package/dist/components/page/MediaPreview.svelte +0 -55
  354. package/dist/components/page/Muted.svelte +0 -10
  355. package/dist/components/page/Outline.svelte +0 -366
  356. package/dist/components/page/Page.svelte +0 -84
  357. package/dist/components/page/PageHeader.svelte +0 -19
  358. package/dist/components/page/PageParagraph.svelte +0 -18
  359. package/dist/components/page/PossibleChapter.svelte +0 -14
  360. package/dist/components/page/PossibleReference.svelte +0 -12
  361. package/dist/components/page/Print.svelte +0 -32
  362. package/dist/components/page/Publish.svelte +0 -135
  363. package/dist/components/page/Reference.svelte +0 -291
  364. package/dist/components/page/References.svelte +0 -55
  365. package/dist/components/page/Rows.svelte +0 -54
  366. package/dist/components/page/Search.svelte +0 -148
  367. package/dist/components/page/Status.svelte +0 -58
  368. package/dist/components/page/SubdomainEditor.svelte +0 -45
  369. package/dist/components/page/TableOfContents.svelte +0 -315
  370. package/dist/components/page/TableOfContentsImage.svelte +0 -27
  371. package/dist/components/page/TableOfContentsRow.svelte +0 -119
  372. package/dist/components/page/ThemeEditor.svelte +0 -189
  373. package/dist/components/page/ThemeEditorPreview.svelte +0 -49
  374. package/dist/components/page/ThemeSetEditor.svelte +0 -19
  375. package/dist/components/page/ThemeVariableEditor.svelte +0 -37
  376. package/dist/components/page/Title.svelte +0 -12
  377. package/dist/components/page/Unknown.svelte +0 -36
  378. package/dist/components/page/margins.js +0 -149
  379. package/dist/index.js +0 -16
  380. package/dist/models/CRUD.js +0 -263
  381. package/dist/models/Firebase.js +0 -36
  382. package/dist/models/book/Book.js +0 -135
  383. package/dist/models/book/BookMedia.js +0 -107
  384. package/dist/models/book/BookSaveStatus.js +0 -8
  385. package/dist/models/book/Chapter.js +0 -212
  386. package/dist/models/book/ChapterID.js +0 -10
  387. package/dist/models/book/Definition.js +0 -1
  388. package/dist/models/book/Edition.js +0 -620
  389. package/dist/models/book/Reference.js +0 -78
  390. package/dist/models/book/Schema.js +0 -115
  391. package/dist/models/book/Theme.js +0 -477
  392. package/dist/models/book/ThemeColors.js +0 -1
  393. package/dist/models/book/Words.js +0 -110
  394. package/dist/models/chapter/AtomNode.js +0 -38
  395. package/dist/models/chapter/BlockNode.js +0 -136
  396. package/dist/models/chapter/BlocksNode.js +0 -904
  397. package/dist/models/chapter/BlocksNode.test.js +0 -568
  398. package/dist/models/chapter/Bookkeeping.js +0 -1
  399. package/dist/models/chapter/CalloutNode.js +0 -58
  400. package/dist/models/chapter/Caret.js +0 -74
  401. package/dist/models/chapter/ChapterNode.js +0 -117
  402. package/dist/models/chapter/CitationsNode.js +0 -36
  403. package/dist/models/chapter/CodeNode.js +0 -173
  404. package/dist/models/chapter/CommentNode.js +0 -58
  405. package/dist/models/chapter/DefinitionNode.js +0 -28
  406. package/dist/models/chapter/Edit.js +0 -1
  407. package/dist/models/chapter/EmbedNode.js +0 -168
  408. package/dist/models/chapter/ErrorNode.js +0 -43
  409. package/dist/models/chapter/FootnoteNode.js +0 -47
  410. package/dist/models/chapter/FormatNode.js +0 -740
  411. package/dist/models/chapter/FormatNode.test.js +0 -96
  412. package/dist/models/chapter/InlineCodeNode.js +0 -31
  413. package/dist/models/chapter/LabelNode.js +0 -40
  414. package/dist/models/chapter/LinkNode.js +0 -28
  415. package/dist/models/chapter/ListNode.js +0 -431
  416. package/dist/models/chapter/ListNode.test.js +0 -54
  417. package/dist/models/chapter/MetadataNode.js +0 -32
  418. package/dist/models/chapter/Node.js +0 -220
  419. package/dist/models/chapter/Node.test.js +0 -29
  420. package/dist/models/chapter/ParagraphNode.js +0 -148
  421. package/dist/models/chapter/ParagraphNode.test.js +0 -30
  422. package/dist/models/chapter/Parser.js +0 -838
  423. package/dist/models/chapter/Parser.test.js +0 -25
  424. package/dist/models/chapter/Position.js +0 -1
  425. package/dist/models/chapter/QuoteNode.js +0 -99
  426. package/dist/models/chapter/RootNode.js +0 -1
  427. package/dist/models/chapter/RuleNode.js +0 -36
  428. package/dist/models/chapter/TableNode.js +0 -231
  429. package/dist/models/chapter/TableNode.test.js +0 -29
  430. package/dist/models/chapter/TextNode.js +0 -176
  431. package/dist/models/chapter/TextNode.test.js +0 -6
  432. package/dist/util/dark.js +0 -16
  433. package/dist/util/getSubdomain.js +0 -24
  434. package/dist/util/isMobile.js +0 -6
  435. package/dist/util/mineReference.js +0 -100
  436. package/dist/util/scrollToEyeLevel.js +0 -10
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(reader)/_bookid_/__editionid_edition__/references/_page.svelte-32bc454f.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(reader)/_bookid_/__editionid_edition__/search/_page.svelte-97bc25f7.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(app)/write/_error.svelte-45a36b1c.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(app)/write/_bookid_/_layout.svelte-8bc62b8c.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(app)/write/_bookid_/__editionid_edition__/_layout.svelte-dbf0531e.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(reader)/_error.svelte-be0856b0.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{_ as r}from"./_layout-744122fc.js";import{default as t}from"../components/pages/(reader)/_bookid_/_layout.svelte-6e9ac5df.js";export{t as component,r as universal};
@@ -0,0 +1 @@
1
+ import{default as t}from"../components/pages/(app)/_page.svelte-f762e334.js";export{t as component};
@@ -0,0 +1 @@
1
+ import{S as K,i as Q,s as W,D as te,k as j,l as q,m as I,h as m,n as k,R as D,b,L as H,E as ne,F as le,G as oe,f as h,t as g,N as re,a as A,c as N,H as M,g as S,d as T,I as ie,j as se,x as V,e as p,y as F,z as B,A as P,q as v,r as w,B as fe,v as ae,M as ue,C as L}from"./index-437f4d21.js";import{g as ce,O as z}from"./Contexts-9f2cc2fa.js";import{N as _e,T as me}from"./Icon-6d10b010.js";import{F as he}from"./Format-4d4050b8.js";import{B as X}from"./Button-b59ec206.js";function de(s){let e,t,o,a,f;const u=s[6].default,r=te(u,s,s[5],null);return{c(){e=j("div"),r&&r.c(),this.h()},l(c){e=q(c,"DIV",{class:!0,tabindex:!0,role:!0,"aria-checked":!0});var n=I(e);r&&r.l(n),n.forEach(m),this.h()},h(){k(e,"class",t=D(`bookish-app-interactive ${s[2]===s[1].Saving?" bookish-text-editor-saving":""} ${s[2]===s[1].Error?" bookish-text-editor-error":""}`)+" svelte-3ytcl3"),k(e,"tabindex","0"),k(e,"role","switch"),k(e,"aria-checked",s[0])},m(c,n){b(c,e,n),r&&r.m(e,null),o=!0,a||(f=[H(e,"keydown",s[7]),H(e,"click",s[3])],a=!0)},p(c,[n]){r&&r.p&&(!o||n&32)&&ne(r,u,c,c[5],o?oe(u,c[5],n,null):le(c[5]),null),(!o||n&6&&t!==(t=D(`bookish-app-interactive ${c[2]===c[1].Saving?" bookish-text-editor-saving":""} ${c[2]===c[1].Error?" bookish-text-editor-error":""}`)+" svelte-3ytcl3"))&&k(e,"class",t),(!o||n&1)&&k(e,"aria-checked",c[0])},i(c){o||(h(r,c),o=!0)},o(c){g(r,c),o=!1},d(c){c&&m(e),r&&r.d(c),a=!1,re(f)}}}function be(s,e,t){let{$$slots:o={},$$scope:a}=e;var f;(function(i){i[i.Viewing=0]="Viewing",i[i.Saving=1]="Saving",i[i.Error=2]="Error"})(f||(f={}));let{on:u}=e,{save:r}=e,c=f.Viewing;function n(){t(2,c=f.Saving);const i=r(!u);if(i===void 0){t(2,c=f.Viewing);return}i.then(()=>t(2,c=f.Viewing)).catch(()=>t(2,c=f.Error))}const l=i=>i.key==="Enter"||i.key==="Space"?n():void 0;return s.$$set=i=>{"on"in i&&t(0,u=i.on),"save"in i&&t(4,r=i.save),"$$scope"in i&&t(5,a=i.$$scope)},[u,f,c,n,r,a,o,l]}class Pe extends K{constructor(e){super(),Q(this,e,be,de,W,{on:0,save:4})}}function G(s,e,t){const o=s.slice();return o[16]=e[t],o[18]=t,o}function ge(s){let e,t,o,a,f,u=s[7],r=[];for(let n=0;n<u.length;n+=1)r[n]=R(G(s,u,n));const c=n=>g(r[n],1,1,()=>{r[n]=null});return{c(){e=j("em"),t=v("by"),o=A();for(let n=0;n<r.length;n+=1)r[n].c();a=p()},l(n){e=q(n,"EM",{});var l=I(e);t=w(l,"by"),l.forEach(m),o=N(n);for(let i=0;i<r.length;i+=1)r[i].l(n);a=p()},m(n,l){b(n,e,l),M(e,t),b(n,o,l);for(let i=0;i<r.length;i+=1)r[i].m(n,l);b(n,a,l),f=!0},p(n,l){if(l&441){u=n[7];let i;for(i=0;i<u.length;i+=1){const d=G(n,u,i);r[i]?(r[i].p(d,l),h(r[i],1)):(r[i]=R(d),r[i].c(),h(r[i],1),r[i].m(a.parentNode,a))}for(S(),i=u.length;i<r.length;i+=1)c(i);T()}},i(n){if(!f){for(let l=0;l<u.length;l+=1)h(r[l]);f=!0}},o(n){r=r.filter(Boolean);for(let l=0;l<r.length;l+=1)g(r[l]);f=!1},d(n){n&&m(e),n&&m(o),ue(r,n),n&&m(a)}}}function ke(s){let e;return{c(){e=v("No authors")},l(t){e=w(t,"No authors")},m(t,o){b(t,e,o)},p:L,i:L,o:L,d(t){t&&m(e)}}}function pe(s){let e,t,o;return t=new he({props:{node:z.parseFormat(s[8],s[16])}}),{c(){e=j("span"),V(t.$$.fragment)},l(a){e=q(a,"SPAN",{});var f=I(e);F(t.$$.fragment,f),f.forEach(m)},m(a,f){b(a,e,f),B(t,e,null),o=!0},p(a,f){const u={};f&384&&(u.node=z.parseFormat(a[8],a[16])),t.$set(u)},i(a){o||(h(t.$$.fragment,a),o=!0)},o(a){g(t.$$.fragment,a),o=!1},d(a){a&&m(e),P(t)}}}function ve(s){let e,t,o,a,f,u;function r(...n){return s[13](s[16],s[18],...n)}t=new me({props:{text:s[16],label:"Author name editor",placeholder:"author",valid:s[12],save:r}});function c(){return s[14](s[18])}return a=new X({props:{tooltip:"remove this author",command:c,$$slots:{default:[we]},$$scope:{ctx:s}}}),{c(){e=j("span"),V(t.$$.fragment),o=A(),V(a.$$.fragment),f=A(),this.h()},l(n){e=q(n,"SPAN",{class:!0});var l=I(e);F(t.$$.fragment,l),o=N(l),F(a.$$.fragment,l),l.forEach(m),f=N(n),this.h()},h(){k(e,"class","author-editor svelte-1jk446c")},m(n,l){b(n,e,l),B(t,e,null),M(e,o),B(a,e,null),b(n,f,l),u=!0},p(n,l){s=n;const i={};l&128&&(i.text=s[16]),l&152&&(i.save=r),t.$set(i);const d={};l&16&&(d.command=c),l&524288&&(d.$$scope={dirty:l,ctx:s}),a.$set(d)},i(n){u||(h(t.$$.fragment,n),h(a.$$.fragment,n),u=!0)},o(n){g(t.$$.fragment,n),g(a.$$.fragment,n),u=!1},d(n){n&&m(e),P(t),P(a),n&&m(f)}}}function we(s){let e;return{c(){e=v("⨉")},l(t){e=w(t,"⨉")},m(t,o){b(t,e,o)},d(t){t&&m(e)}}}function O(s){let e;return{c(){e=v(", ")},l(t){e=w(t,", ")},m(t,o){b(t,e,o)},d(t){t&&m(e)}}}function R(s){let e,t,o,a,f;const u=[ve,pe],r=[];function c(l,i){return l[0]&&!l[5]?0:1}e=c(s),t=r[e]=u[e](s);let n=s[18]<s[7].length-1&&O();return{c(){t.c(),o=p(),n&&n.c(),a=p()},l(l){t.l(l),o=p(),n&&n.l(l),a=p()},m(l,i){r[e].m(l,i),b(l,o,i),n&&n.m(l,i),b(l,a,i),f=!0},p(l,i){let d=e;e=c(l),e===d?r[e].p(l,i):(S(),g(r[d],1,1,()=>{r[d]=null}),T(),t=r[e],t?t.p(l,i):(t=r[e]=u[e](l),t.c()),h(t,1),t.m(o.parentNode,o)),l[18]<l[7].length-1?n||(n=O(),n.c(),n.m(a.parentNode,a)):n&&(n.d(1),n=null)},i(l){f||(h(t),f=!0)},o(l){g(t),f=!1},d(l){r[e].d(l),l&&m(o),n&&n.d(l),l&&m(a)}}}function U(s){let e,t,o,a;e=new X({props:{tooltip:"add author",command:s[10],$$slots:{default:[ye]},$$scope:{ctx:s}}});let f=s[2]!==void 0&&s[1].length===0&&J(s);return{c(){V(e.$$.fragment),t=A(),f&&f.c(),o=p()},l(u){F(e.$$.fragment,u),t=N(u),f&&f.l(u),o=p()},m(u,r){B(e,u,r),b(u,t,r),f&&f.m(u,r),b(u,o,r),a=!0},p(u,r){const c={};r&524288&&(c.$$scope={dirty:r,ctx:u}),e.$set(c),u[2]!==void 0&&u[1].length===0?f?r&6&&h(f,1):(f=J(u),f.c(),h(f,1),f.m(o.parentNode,o)):f&&(S(),g(f,1,1,()=>{f=null}),T())},i(u){a||(h(e.$$.fragment,u),h(f),a=!0)},o(u){g(e.$$.fragment,u),g(f),a=!1},d(u){P(e,u),u&&m(t),f&&f.d(u),u&&m(o)}}}function ye(s){let e;return{c(){e=v("+ author")},l(t){e=w(t,"+ author")},m(t,o){b(t,e,o)},d(t){t&&m(e)}}}function J(s){let e,t;return e=new _e({props:{$$slots:{default:[Ee]},$$scope:{ctx:s}}}),{c(){V(e.$$.fragment)},l(o){F(e.$$.fragment,o)},m(o,a){B(e,o,a),t=!0},i(o){t||(h(e.$$.fragment,o),t=!0)},o(o){g(e.$$.fragment,o),t=!1},d(o){P(e,o)}}}function Ee(s){let e;return{c(){e=v("(showing book authors) ")},l(t){e=w(t,"(showing book authors) ")},m(t,o){b(t,e,o)},d(t){t&&m(e)}}}function Ae(s){let e,t,o,a,f;const u=[ke,ge],r=[];function c(l,i){return l[7]===void 0?0:1}t=c(s),o=r[t]=u[t](s);let n=s[0]&&U(s);return{c(){e=j("p"),o.c(),a=A(),n&&n.c(),this.h()},l(l){e=q(l,"P",{class:!0});var i=I(e);o.l(i),a=N(i),n&&n.l(i),i.forEach(m),this.h()},h(){k(e,"class","bookish-authors svelte-1jk446c")},m(l,i){b(l,e,i),r[t].m(e,null),M(e,a),n&&n.m(e,null),s[15](e),f=!0},p(l,[i]){let d=t;t=c(l),t===d?r[t].p(l,i):(S(),g(r[d],1,1,()=>{r[d]=null}),T(),o=r[t],o?o.p(l,i):(o=r[t]=u[t](l),o.c()),h(o,1),o.m(e,a)),l[0]?n?(n.p(l,i),i&1&&h(n,1)):(n=U(l),n.c(),h(n,1),n.m(e,null)):n&&(S(),g(n,1,1,()=>{n=null}),T())},i(l){f||(h(o),h(n),f=!0)},o(l){g(o),g(n),f=!1},d(l){l&&m(e),r[t].d(),n&&n.d(),s[15](null)}}}function Ne(s,e,t){let o,a,f,{editable:u}=e,{authors:r}=e,{inheritedAuthors:c=void 0}=e,{add:n}=e,{edit:l}=e,{remove:i}=e,d=ce();ie(s,d,_=>t(8,f=_));let y=null;async function Y(){if(n(),await fe(),r.length>0&&y){const _=y.querySelectorAll("input");if(_.length>0){const E=_[_.length-1];E instanceof HTMLElement&&E.focus()}}}se(()=>{});const Z=()=>{},$=(_,E,C)=>_.length>0&&C===""?i(E):l(E,C),x=_=>i(_);function ee(_){ae[_?"unshift":"push"](()=>{y=_,t(6,y)})}return s.$$set=_=>{"editable"in _&&t(0,u=_.editable),"authors"in _&&t(1,r=_.authors),"inheritedAuthors"in _&&t(2,c=_.inheritedAuthors),"add"in _&&t(11,n=_.add),"edit"in _&&t(3,l=_.edit),"remove"in _&&t(4,i=_.remove)},s.$$.update=()=>{s.$$.dirty&6&&t(5,o=r.length===0&&c!==void 0),s.$$.dirty&38&&t(7,a=o?c:r)},[u,r,c,l,i,o,y,a,f,d,Y,n,Z,$,x,ee]}class je extends K{constructor(e){super(),Q(this,e,Ne,Ae,W,{editable:0,authors:1,inheritedAuthors:2,add:11,edit:3,remove:4})}}export{je as A,Pe as T};
@@ -0,0 +1 @@
1
+ import{S as se,i as ie,s as ae,k as C,a as R,x as q,l as B,m as I,h,c as F,y as H,n as A,a4 as X,b as P,H as w,z as j,f as v,g as J,t as E,d as K,A as z,M as ce,q as O,r as T,u as fe,C as G}from"./index-437f4d21.js";import{E as Y,O as Q}from"./Contexts-9f2cc2fa.js";import{C as ue}from"./ChapterBody-e3121609.js";import{E as _e}from"./Embed-8f6c7b1e.js";import{L as Z}from"./Link-9ed8813f.js";function x(o,e,n){const t=o.slice();return t[10]=e[n],t[12]=n,t}function ee(o){let e,n;return e=new _e({props:{node:o[1],imageOnly:!0,editable:!1}}),{c(){q(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,l){j(e,t,l),n=!0},p(t,l){const s={};l&2&&(s.node=t[1]),e.$set(s)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function he(o){let e,n;return{c(){e=C("h2"),n=O(o[2]),this.h()},l(t){e=B(t,"H2",{class:!0});var l=I(e);n=T(l,o[2]),l.forEach(h),this.h()},h(){A(e,"class","title svelte-1b3les5")},m(t,l){P(t,e,l),w(e,n)},p(t,l){l&4&&fe(n,t[2])},d(t){t&&h(e)}}}function te(o){let e,n;return{c(){e=C("em"),n=O("No authors")},l(t){e=B(t,"EM",{});var l=I(e);n=T(l,"No authors"),l.forEach(h)},m(t,l){P(t,e,l),w(e,n)},p:G,d(t){t&&h(e)}}}function le(o){let e;return{c(){e=O(", ")},l(n){e=T(n,", ")},m(n,t){P(n,e,t)},d(n){n&&h(e)}}}function ne(o){let e,n=o[10]+"",t,l=o[12]!==o[4].length-1&&le();return{c(){e=C("span"),t=O(n),l&&l.c()},l(s){e=B(s,"SPAN",{});var i=I(e);t=T(i,n),l&&l.l(i),i.forEach(h)},m(s,i){P(s,e,i),w(e,t),l&&l.m(e,null)},p(s,i){i&16&&n!==(n=s[10]+"")&&fe(t,n),s[12]!==s[4].length-1?l||(l=le(),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},d(s){s&&h(e),l&&l.d()}}}function me(o){let e,n;return e=new ue({props:{node:Q.parseChapter(void 0,o[3])}}),{c(){q(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,l){j(e,t,l),n=!0},p(t,l){const s={};l&8&&(s.node=Q.parseChapter(void 0,t[3])),e.$set(s)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function de(o){let e,n;return{c(){e=C("em"),n=O("No description")},l(t){e=B(t,"EM",{});var l=I(e);n=T(l,"No description"),l.forEach(h)},m(t,l){P(t,e,l),w(e,n)},p:G,i:G,o:G,d(t){t&&h(e)}}}function ge(o){let e;return{c(){e=O("Editions")},l(n){e=T(n,"Editions")},m(n,t){P(n,e,t)},d(n){n&&h(e)}}}function pe(o){let e,n,t,l,s,i,a,c,b,g,u,D,k,V,_=o[1]instanceof Y&&ee(o);s=new Z({props:{to:o[0],$$slots:{default:[he]},$$scope:{ctx:o}}});let N=o[4],d=[];for(let r=0;r<N.length;r+=1)d[r]=ne(x(o,N,r));let m=null;N.length||(m=te());const U=[de,me],L=[];function W(r,f){return r[3].length===0?0:1}return g=W(o),u=L[g]=U[g](o),k=new Z({props:{to:`${o[0]}/editions`,$$slots:{default:[ge]},$$scope:{ctx:o}}}),{c(){e=C("article"),n=C("div"),_&&_.c(),t=R(),l=C("div"),q(s.$$.fragment),i=R(),a=C("p");for(let r=0;r<d.length;r+=1)d[r].c();m&&m.c(),c=R(),b=C("div"),u.c(),D=R(),q(k.$$.fragment),this.h()},l(r){e=B(r,"ARTICLE",{class:!0});var f=I(e);n=B(f,"DIV",{class:!0});var y=I(n);_&&_.l(y),y.forEach(h),t=F(f),l=B(f,"DIV",{class:!0});var $=I(l);H(s.$$.fragment,$),i=F($),a=B($,"P",{class:!0});var S=I(a);for(let M=0;M<d.length;M+=1)d[M].l(S);m&&m.l(S),S.forEach(h),c=F($),b=B($,"DIV",{class:!0});var p=I(b);u.l(p),p.forEach(h),D=F($),H(k.$$.fragment,$),$.forEach(h),f.forEach(h),this.h()},h(){A(n,"class","cover svelte-1b3les5"),X(n,"empty",o[1]===null),A(a,"class","authors svelte-1b3les5"),A(b,"class","description svelte-1b3les5"),A(l,"class","content svelte-1b3les5"),A(e,"class","book-preview svelte-1b3les5")},m(r,f){P(r,e,f),w(e,n),_&&_.m(n,null),w(e,t),w(e,l),j(s,l,null),w(l,i),w(l,a);for(let y=0;y<d.length;y+=1)d[y].m(a,null);m&&m.m(a,null),w(l,c),w(l,b),L[g].m(b,null),w(l,D),j(k,l,null),V=!0},p(r,[f]){r[1]instanceof Y?_?(_.p(r,f),f&2&&v(_,1)):(_=ee(r),_.c(),v(_,1),_.m(n,null)):_&&(J(),E(_,1,1,()=>{_=null}),K()),(!V||f&2)&&X(n,"empty",r[1]===null);const y={};if(f&1&&(y.to=r[0]),f&8196&&(y.$$scope={dirty:f,ctx:r}),s.$set(y),f&16){N=r[4];let p;for(p=0;p<N.length;p+=1){const M=x(r,N,p);d[p]?d[p].p(M,f):(d[p]=ne(M),d[p].c(),d[p].m(a,null))}for(;p<d.length;p+=1)d[p].d(1);d.length=N.length,!N.length&&m?m.p(r,f):N.length?m&&(m.d(1),m=null):(m=te(),m.c(),m.m(a,null))}let $=g;g=W(r),g===$?L[g].p(r,f):(J(),E(L[$],1,1,()=>{L[$]=null}),K(),u=L[g],u?u.p(r,f):(u=L[g]=U[g](r),u.c()),v(u,1),u.m(b,null));const S={};f&1&&(S.to=`${r[0]}/editions`),f&8192&&(S.$$scope={dirty:f,ctx:r}),k.$set(S)},i(r){V||(v(_),v(s.$$.fragment,r),v(u),v(k.$$.fragment,r),V=!0)},o(r){E(_),E(s.$$.fragment,r),E(u),E(k.$$.fragment,r),V=!1},d(r){r&&h(e),_&&_.d(),z(s),ce(d,r),m&&m.d(),L[g].d(),z(k)}}}function be(o,e,n){let t,l,s,i,a,c,b,g,{book:u}=e,{write:D=!1}=e;return o.$$set=k=>{"book"in k&&n(5,u=k.book),"write"in k&&n(6,D=k.write)},o.$$.update=()=>{o.$$.dirty&32&&n(8,t=u.getID()),o.$$.dirty&32&&n(9,l=u.getCover()),o.$$.dirty&32&&n(4,s=u.getAuthors()),o.$$.dirty&32&&n(3,i=u.getDescription()),o.$$.dirty&32&&n(7,a=u.getSubdomain()),o.$$.dirty&32&&n(2,c=u.getTitle()),o.$$.dirty&512&&n(1,b=l===null?null:Q.parseEmbed(void 0,l)),o.$$.dirty&448&&n(0,g=a===null||D?t===void 0?"":(D?"/write/":"/")+t:`/${a}`)},[g,b,c,i,s,u,D,a,t,l]}class ke extends se{constructor(e){super(),ie(this,e,be,pe,ae,{book:5,write:6})}}function oe(o,e,n){const t=o.slice();return t[2]=e[n],t}function re(o){let e,n;return e=new ke({props:{book:o[2],write:o[1]}}),{c(){q(e.$$.fragment)},l(t){H(e.$$.fragment,t)},m(t,l){j(e,t,l),n=!0},p(t,l){const s={};l&1&&(s.book=t[2]),l&2&&(s.write=t[1]),e.$set(s)},i(t){n||(v(e.$$.fragment,t),n=!0)},o(t){E(e.$$.fragment,t),n=!1},d(t){z(e,t)}}}function ve(o){let e,n,t=o[0],l=[];for(let i=0;i<t.length;i+=1)l[i]=re(oe(o,t,i));const s=i=>E(l[i],1,1,()=>{l[i]=null});return{c(){e=C("section");for(let i=0;i<l.length;i+=1)l[i].c();this.h()},l(i){e=B(i,"SECTION",{class:!0});var a=I(e);for(let c=0;c<l.length;c+=1)l[c].l(a);a.forEach(h),this.h()},h(){A(e,"class","previews svelte-3xj6xd")},m(i,a){P(i,e,a);for(let c=0;c<l.length;c+=1)l[c].m(e,null);n=!0},p(i,[a]){if(a&3){t=i[0];let c;for(c=0;c<t.length;c+=1){const b=oe(i,t,c);l[c]?(l[c].p(b,a),v(l[c],1)):(l[c]=re(b),l[c].c(),v(l[c],1),l[c].m(e,null))}for(J(),c=t.length;c<l.length;c+=1)s(c);K()}},i(i){if(!n){for(let a=0;a<t.length;a+=1)v(l[a]);n=!0}},o(i){l=l.filter(Boolean);for(let a=0;a<l.length;a+=1)E(l[a]);n=!1},d(i){i&&h(e),ce(l,i)}}}function $e(o,e,n){let{books:t}=e,{write:l}=e;return o.$$set=s=>{"books"in s&&n(0,t=s.books),"write"in s&&n(1,l=s.write)},[t,l]}class Ie extends se{constructor(e){super(),ie(this,e,$e,ve,ae,{books:0,write:1})}}export{Ie as B};
@@ -0,0 +1 @@
1
+ import{S as y,i as g,s as k,D as B,k as E,l as N,m as S,h as d,n as o,R as r,b as T,L as b,a0 as q,E as v,F as C,G as D,f as F,t as G,N as L,a1 as c,a2 as h}from"./index-437f4d21.js";function O(t){let e,u,i,f,_;const m=t[6].default,l=B(m,t,t[5],null);return{c(){e=E("button"),l&&l.c(),this.h()},l(s){e=N(s,"BUTTON",{class:!0,title:!0,"aria-label":!0,type:!0});var a=S(e);l&&l.l(a),a.forEach(d),this.h()},h(){o(e,"class",u=r(t[4].class)+" svelte-1bf37e0"),o(e,"title",t[1]),o(e,"aria-label",t[1]),o(e,"type",t[0]),e.disabled=t[2]},m(s,a){T(s,e,a),l&&l.m(e,null),i=!0,f||(_=[b(e,"mousedown",function(){q(t[3])&&t[3].apply(this,arguments)}),b(e,"keypress",t[7])],f=!0)},p(s,[a]){t=s,l&&l.p&&(!i||a&32)&&v(l,m,t,t[5],i?D(m,t[5],a,null):C(t[5]),null),(!i||a&16&&u!==(u=r(t[4].class)+" svelte-1bf37e0"))&&o(e,"class",u),(!i||a&2)&&o(e,"title",t[1]),(!i||a&2)&&o(e,"aria-label",t[1]),(!i||a&1)&&o(e,"type",t[0]),(!i||a&4)&&(e.disabled=t[2])},i(s){i||(F(l,s),i=!0)},o(s){G(l,s),i=!1},d(s){s&&d(e),l&&l.d(s),f=!1,L(_)}}}function R(t,e,u){let{$$slots:i={},$$scope:f}=e,{type:_=null}=e,{tooltip:m}=e,{disabled:l=!1}=e,{command:s}=e;const a=n=>n.key===" "||n.key==="Enter"?s():void 0;return t.$$set=n=>{u(4,e=c(c({},e),h(n))),"type"in n&&u(0,_=n.type),"tooltip"in n&&u(1,m=n.tooltip),"disabled"in n&&u(2,l=n.disabled),"command"in n&&u(3,s=n.command),"$$scope"in n&&u(5,f=n.$$scope)},e=h(e),[_,m,l,s,e,f,i,a]}class j extends y{constructor(e){super(),g(this,e,R,O,k,{type:0,tooltip:1,disabled:2,command:3})}}export{j as B};
@@ -0,0 +1,13 @@
1
+ import{S as Pe,i as Se,s as De,e as A,b as k,f as h,g as Y,t as w,d as H,h as g,I as Q,o as oe,Y as Oe,x as C,y as I,z as B,A as T,a as S,k as U,c as D,l as M,m as z,n as G,q as y,r as N,M as Ye,H as K,u as X,C as J}from"./index-437f4d21.js";import{d as He,g as Ue,k as Me,aj as ze,a7 as We,Z as Ve,V as x,a6 as qe,a2 as O,O as Ze,ad as je,a4 as Fe,a5 as re}from"./Contexts-9f2cc2fa.js";import{P as Ge,H as Je,O as Ke,T as Qe,B as Xe}from"./Outline-8482e267.js";import{A as xe,T as et}from"./Authors-34afa7d2.js";import{T as tt}from"./Icon-6d10b010.js";import{I as de}from"./Instructions-289ea859.js";import{C as _e}from"./ChapterBody-e3121609.js";import{P as nt,b as ot}from"./Format-4d4050b8.js";import{C as he}from"./ChapterNumber-efbfa4d5.js";import{w as le}from"./singletons-3041590b.js";import{g as rt}from"./navigation-e50a9b06.js";import{M as ge}from"./Muted-6c007c27.js";import{P as lt}from"./PageHeader-ae302247.js";import{P as st}from"./Permissions-2fd12288.js";function se(){let r=document.getElementsByClassName("outline")[0];if(!r)return;let t=100;if(window.getComputedStyle(r).getPropertyValue("left")!=="0px"){let n=r.getBoundingClientRect(),e;if(Array.from(document.getElementsByClassName("inset-left")).forEach(o=>{let l=o.getBoundingClientRect();n.bottom<l.top-t||n.top>l.bottom+t||(e=l)}),e){let o=e,s=(n.bottom<o.top?t:n.bottom<o.top+t?t-(n.bottom-o.top):n.top>o.bottom-t?t-(o.bottom-n.top):n.top>o.bottom?t:0)/t;r.style.opacity=""+s*s}else r.style.removeProperty("opacity")}else r.style.removeProperty("opacity")}function F(){let r=document.getElementsByClassName("bookish-chapter-body")[0];if(r===void 0)return;let t=document.getElementsByClassName("bookish")[0],n=r.getBoundingClientRect().width,e=null,o=document.getElementsByClassName("inset-right");const l=document.getElementsByClassName("bookish-marginal");Array.from(l).forEach(s=>{const a=s;if(a!==null)if(window.getComputedStyle(a).getPropertyValue("position")!=="fixed"){if(a.parentElement){let i=a.parentElement.closest(".bookish-marginal"),f=a.getBoundingClientRect(),p=a.parentElement.getBoundingClientRect().top+window.scrollY-(t.getBoundingClientRect().top+window.scrollY);i!==null&&e?(a.style.left="0",a.style.top=""+(e-(i.getBoundingClientRect().top+window.scrollY))+"px",e=e+f.height):(e===null||e<p?(a.style.top=p+"px",e=p+f.height):(a.style.top=e+"px",e=e+f.height),o.length>0&&Array.from(o).forEach(m=>{let d=m.getBoundingClientRect(),v=d.top+window.scrollY,P=v+d.height,$=a.getBoundingClientRect().top+window.scrollY,E=$+f.height;if(e!==null&&($<=v&&E>=v||$<=P&&E>=P||$>=v&&E<=P)){let u=e-f.height+(P-$);a.style.top=u+"px",e=u+f.height}}),a.style.left="calc(2rem + "+n+"px)")}}else a.style.removeProperty("top"),a.style.removeProperty("left")})}let ie=r=>{window.scrollTo({top:r.getBoundingClientRect().top+window.scrollY-window.innerHeight/3,behavior:"smooth"})};function ae(r,t,n){const e=r.slice();return e[35]=t[n],e}function te(r){const t=r.slice(),n=t[4].getReferences();return t[34]=n,t}function fe(r){let t,n;return t=new Ge({props:{afterLoaded:r[15],title:`${r[4].getTitle()} - ${r[0].getTitle()}`,$$slots:{default:[At]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&17&&(l.title=`${e[4].getTitle()} - ${e[0].getTitle()}`),o[0]&2047|o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function it(r){let t,n;return t=new Ke({props:{slot:"outline",collapse:r[10]!==void 0,previous:r[4].getPreviousChapterID(r[3]),next:r[4].getNextChapterID(r[3]),listener:r[24]}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&1024&&(l.collapse=e[10]!==void 0),o[0]&24&&(l.previous=e[4].getPreviousChapterID(e[3])),o[0]&24&&(l.next=e[4].getNextChapterID(e[3])),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function ue(r){let t,n;return t=new ge({props:{$$slots:{default:[at]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&561|o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function at(r){let t,n,e,o;return e=new tt({props:{text:r[0].getID(),label:"Chapter URL ID editor",save:r[21],placeholder:"chapter name",valid:r[22],saveOnExit:!0}}),{c(){t=U("em"),n=y("bookish.press/book/"),C(e.$$.fragment)},l(l){t=M(l,"EM",{});var s=z(t);n=N(s,"bookish.press/book/"),s.forEach(g),I(e.$$.fragment,l)},m(l,s){k(l,t,s),K(t,n),B(e,l,s),o=!0},p(l,s){const a={};s[0]&1&&(a.text=l[0].getID()),s[0]&545&&(a.save=l[21]),s[0]&17&&(a.valid=l[22]),e.$set(a)},i(l){o||(h(e.$$.fragment,l),o=!0)},o(l){w(e.$$.fragment,l),o=!1},d(l){l&&g(t),T(e,l)}}}function ft(r){let t,n;return t=new he({props:{$$slots:{default:[ct]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&256|o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function ut(r){let t,n;return t=new et({props:{on:r[0].isNumbered(),save:r[23],$$slots:{default:[ht]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&1&&(l.on=e[0].isNumbered()),o[0]&1&&(l.save=e[23]),o[0]&256|o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function ct(r){let t,n;return{c(){t=y("Chapter "),n=y(r[8])},l(e){t=N(e,"Chapter "),n=N(e,r[8])},m(e,o){k(e,t,o),k(e,n,o)},p(e,o){o[0]&256&&X(n,e[8])},d(e){e&&g(t),e&&g(n)}}}function pt(r){let t,n;return t=new ge({props:{$$slots:{default:[dt]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function mt(r){let t,n;return{c(){t=y("Chapter "),n=y(r[8])},l(e){t=N(e,"Chapter "),n=N(e,r[8])},m(e,o){k(e,t,o),k(e,n,o)},p(e,o){o[0]&256&&X(n,e[8])},i:J,o:J,d(e){e&&g(t),e&&g(n)}}}function dt(r){let t;return{c(){t=y("Unnumbered")},l(n){t=N(n,"Unnumbered")},m(n,e){k(n,t,e)},d(n){n&&g(t)}}}function _t(r){let t,n,e,o;const l=[mt,pt],s=[];function a(i,f){return i[8]!==void 0?0:1}return t=a(r),n=s[t]=l[t](r),{c(){n.c(),e=A()},l(i){n.l(i),e=A()},m(i,f){s[t].m(i,f),k(i,e,f),o=!0},p(i,f){let _=t;t=a(i),t===_?s[t].p(i,f):(Y(),w(s[_],1,1,()=>{s[_]=null}),H(),n=s[t],n?n.p(i,f):(n=s[t]=l[t](i),n.c()),h(n,1),n.m(e.parentNode,e))},i(i){o||(h(n),o=!0)},o(i){w(n),o=!1},d(i){s[t].d(i),i&&g(e)}}}function ht(r){let t,n;return t=new he({props:{$$slots:{default:[_t]},$$scope:{ctx:r}}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&256|o[1]&128&&(l.$$scope={dirty:o,ctx:e}),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function ce(r){let t,n;return{c(){t=U("span"),n=y(r[7]),this.h()},l(e){t=M(e,"SPAN",{class:!0});var o=z(t);n=N(o,r[7]),o.forEach(g),this.h()},h(){G(t,"class","section-name svelte-1ff4ttx")},m(e,o){k(e,t,o),K(t,n)},p(e,o){o[0]&128&&X(n,e[7])},d(e){e&&g(t)}}}function gt(r){let t,n,e,o,l,s,a=r[16]&&r[9]&&ue(r);const i=[ut,ft],f=[];function _(m,d){return m[16]?0:m[8]!==void 0?1:-1}~(n=_(r))&&(e=f[n]=i[n](r));let p=r[7]!==void 0&&r[7].length>0&&ce(r);return{c(){a&&a.c(),t=S(),e&&e.c(),o=S(),p&&p.c(),l=A()},l(m){a&&a.l(m),t=D(m),e&&e.l(m),o=D(m),p&&p.l(m),l=A()},m(m,d){a&&a.m(m,d),k(m,t,d),~n&&f[n].m(m,d),k(m,o,d),p&&p.m(m,d),k(m,l,d),s=!0},p(m,d){m[16]&&m[9]?a?(a.p(m,d),d[0]&512&&h(a,1)):(a=ue(m),a.c(),h(a,1),a.m(t.parentNode,t)):a&&(Y(),w(a,1,1,()=>{a=null}),H());let v=n;n=_(m),n===v?~n&&f[n].p(m,d):(e&&(Y(),w(f[v],1,1,()=>{f[v]=null}),H()),~n?(e=f[n],e?e.p(m,d):(e=f[n]=i[n](m),e.c()),h(e,1),e.m(o.parentNode,o)):e=null),m[7]!==void 0&&m[7].length>0?p?p.p(m,d):(p=ce(m),p.c(),p.m(l.parentNode,l)):p&&(p.d(1),p=null)},i(m){s||(h(a),h(e),s=!0)},o(m){w(a),w(e),s=!1},d(m){a&&a.d(m),m&&g(t),~n&&f[n].d(m),m&&g(o),p&&p.d(m),m&&g(l)}}}function $t(r){let t,n;return t=new xe({props:{editable:x(),slot:"after",authors:r[0].getAuthors(),inheritedAuthors:r[4].getAuthors(),add:r[18],edit:r[19],remove:r[20]}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&1&&(l.authors=e[0].getAuthors()),o[0]&16&&(l.inheritedAuthors=e[4].getAuthors()),o[0]&1&&(l.add=e[18]),o[0]&1&&(l.edit=e[19]),o[0]&1&&(l.remove=e[20]),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function bt(r){let t;return{c(){t=y(`Edit your chapter's title, authors, and cover image above. You can
2
+ also change the ID of the chapter, which is the text that appears in
3
+ the chapter URL. Write your chapter text below, formatting options
4
+ in the toolbar above to add headers, lists, tables, comments,
5
+ citations, footnotes, and more. It's okay to try things, you can
6
+ always undo. Saves are automatic.`)},l(n){t=N(n,`Edit your chapter's title, authors, and cover image above. You can
7
+ also change the ID of the chapter, which is the text that appears in
8
+ the chapter URL. Write your chapter text below, formatting options
9
+ in the toolbar above to add headers, lists, tables, comments,
10
+ citations, footnotes, and more. It's okay to try things, you can
11
+ always undo. Saves are automatic.`)},m(n,e){k(n,t,e)},d(n){n&&g(t)}}}function wt(r){let t,n;return{c(){t=U("span"),n=y("Loading...")},l(e){t=M(e,"SPAN",{});var o=z(t);n=N(o,"Loading..."),o.forEach(g)},m(e,o){k(e,t,o),K(t,n)},p:J,i:J,o:J,d(e){e&&g(t)}}}function kt(r){let t,n,e,o;const l=[Et,vt],s=[];function a(i,f){return i[16]?0:1}return t=a(r),n=s[t]=l[t](r),{c(){n.c(),e=A()},l(i){n.l(i),e=A()},m(i,f){s[t].m(i,f),k(i,e,f),o=!0},p(i,f){n.p(i,f)},i(i){o||(h(n),o=!0)},o(i){w(n),o=!1},d(i){s[t].d(i),i&&g(e)}}}function vt(r){let t,n;return t=new _e({props:{node:r[2]}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&4&&(l.node=e[2]),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function Et(r){let t,n;return t=new Xe({props:{text:r[2].toBookdown(),parser:r[28],save:r[29],chapter:!0,autofocus:!0,component:_e,placeholder:"write here",leasee:re(r[13],r[12],r[0].id),lease:r[30]}}),{c(){C(t.$$.fragment)},l(e){I(t.$$.fragment,e)},m(e,o){B(t,e,o),n=!0},p(e,o){const l={};o[0]&4&&(l.text=e[2].toBookdown()),o[0]&16&&(l.parser=e[28]),o[0]&1&&(l.save=e[29]),o[0]&1&&(l.leasee=re(e[13],e[12],e[0].id)),o[0]&1&&(l.lease=e[30]),t.$set(l)},i(e){n||(h(t.$$.fragment,e),n=!0)},o(e){w(t.$$.fragment,e),n=!1},d(e){T(t,e)}}}function pe(r){let t,n,e,o;t=new Qe({props:{$$slots:{default:[Ct]},$$scope:{ctx:r}}});let l=[...r[6]].sort(),s=[];for(let i=0;i<l.length;i+=1)s[i]=me(ae(r,l,i));const a=i=>w(s[i],1,1,()=>{s[i]=null});return{c(){C(t.$$.fragment),n=S(),e=U("ol");for(let i=0;i<s.length;i+=1)s[i].c()},l(i){I(t.$$.fragment,i),n=D(i),e=M(i,"OL",{});var f=z(e);for(let _=0;_<s.length;_+=1)s[_].l(f);f.forEach(g)},m(i,f){B(t,i,f),k(i,n,f),k(i,e,f);for(let _=0;_<s.length;_+=1)s[_].m(e,null);o=!0},p(i,f){const _={};if(f[1]&128&&(_.$$scope={dirty:f,ctx:i}),t.$set(_),f[0]&80){l=[...i[6]].sort();let p;for(p=0;p<l.length;p+=1){const m=ae(i,l,p);s[p]?(s[p].p(m,f),h(s[p],1)):(s[p]=me(m),s[p].c(),h(s[p],1),s[p].m(e,null))}for(Y(),p=l.length;p<s.length;p+=1)a(p);H()}},i(i){if(!o){h(t.$$.fragment,i);for(let f=0;f<l.length;f+=1)h(s[f]);o=!0}},o(i){w(t.$$.fragment,i),s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)w(s[f]);o=!1},d(i){T(t,i),i&&g(n),i&&g(e),Ye(s,i)}}}function Ct(r){let t;return{c(){t=y("References")},l(n){t=N(n,"References")},m(n,e){k(n,t,e)},d(n){n&&g(t)}}}function It(r){let t,n,e;return n=new nt({props:{$$slots:{default:[Tt]},$$scope:{ctx:r}}}),{c(){t=U("li"),C(n.$$.fragment)},l(o){t=M(o,"LI",{});var l=z(t);I(n.$$.fragment,l),l.forEach(g)},m(o,l){k(o,t,l),B(n,t,null),e=!0},p(o,l){const s={};l[0]&64|l[1]&128&&(s.$$scope={dirty:l,ctx:o}),n.$set(s)},i(o){e||(h(n.$$.fragment,o),e=!0)},o(o){w(n.$$.fragment,o),e=!1},d(o){o&&g(t),T(n)}}}function Bt(r){let t,n,e,o,l;return n=new ot({props:{node:r[34][r[35]],edit:!0}}),{c(){t=U("li"),C(n.$$.fragment),e=S(),this.h()},l(s){t=M(s,"LI",{class:!0,id:!0});var a=z(t);I(n.$$.fragment,a),e=D(a),a.forEach(g),this.h()},h(){G(t,"class","bookish-reference"),G(t,"id",o="ref-"+r[35])},m(s,a){k(s,t,a),B(n,t,null),K(t,e),l=!0},p(s,a){const i={};a[0]&80&&(i.node=s[34][s[35]]),n.$set(i),(!l||a[0]&64&&o!==(o="ref-"+s[35]))&&G(t,"id",o)},i(s){l||(h(n.$$.fragment,s),l=!0)},o(s){w(n.$$.fragment,s),l=!1},d(s){s&&g(t),T(n)}}}function Tt(r){let t,n,e=r[35]+"",o;return{c(){t=y("Unknown reference: "),n=U("code"),o=y(e)},l(l){t=N(l,"Unknown reference: "),n=M(l,"CODE",{});var s=z(n);o=N(s,e),s.forEach(g)},m(l,s){k(l,t,s),k(l,n,s),K(n,o)},p(l,s){s[0]&64&&e!==(e=l[35]+"")&&X(o,e)},d(l){l&&g(t),l&&g(n)}}}function me(r){let t,n,e,o;const l=[Bt,It],s=[];function a(i,f){return i[35]in i[34]?0:1}return t=a(r),n=s[t]=l[t](r),{c(){n.c(),e=A()},l(i){n.l(i),e=A()},m(i,f){s[t].m(i,f),k(i,e,f),o=!0},p(i,f){let _=t;t=a(i),t===_?s[t].p(i,f):(Y(),w(s[_],1,1,()=>{s[_]=null}),H(),n=s[t],n?n.p(i,f):(n=s[t]=l[t](i),n.c()),h(n,1),n.m(e.parentNode,e))},i(i){o||(h(n),o=!0)},o(i){w(n),o=!1},d(i){s[t].d(i),i&&g(e)}}}function yt(r){let t,n,e,o,l,s;return t=new lt({props:{$$slots:{default:[Nt]},$$scope:{ctx:r}}}),e=new de({props:{editable:r[16],$$slots:{default:[Lt]},$$scope:{ctx:r}}}),l=new st({props:{uids:r[0].uids,inheriteduids:Array.from(new Set([...r[4].uids,...r[9]?r[9].uids:[]])),atleastone:!1,writable:x(),change:r[31]}}),{c(){C(t.$$.fragment),n=S(),C(e.$$.fragment),o=S(),C(l.$$.fragment)},l(a){I(t.$$.fragment,a),n=D(a),I(e.$$.fragment,a),o=D(a),I(l.$$.fragment,a)},m(a,i){B(t,a,i),k(a,n,i),B(e,a,i),k(a,o,i),B(l,a,i),s=!0},p(a,i){const f={};i[1]&128&&(f.$$scope={dirty:i,ctx:a}),t.$set(f);const _={};i[1]&128&&(_.$$scope={dirty:i,ctx:a}),e.$set(_);const p={};i[0]&1&&(p.uids=a[0].uids),i[0]&528&&(p.inheriteduids=Array.from(new Set([...a[4].uids,...a[9]?a[9].uids:[]]))),i[0]&1&&(p.change=a[31]),l.$set(p)},i(a){s||(h(t.$$.fragment,a),h(e.$$.fragment,a),h(l.$$.fragment,a),s=!0)},o(a){w(t.$$.fragment,a),w(e.$$.fragment,a),w(l.$$.fragment,a),s=!1},d(a){T(t,a),a&&g(n),T(e,a),a&&g(o),T(l,a)}}}function Nt(r){let t;return{c(){t=y("Editors")},l(n){t=N(n,"Editors")},m(n,e){k(n,t,e)},d(n){n&&g(t)}}}function Lt(r){let t;return{c(){t=y(`These authors can edit this chapter. Add an email here to
12
+ provide chapter-level edit permissions.`)},l(n){t=N(n,`These authors can edit this chapter. Add an email here to
13
+ provide chapter-level edit permissions.`)},m(n,e){k(n,t,e)},d(n){n&&g(t)}}}function At(r){let t,n,e,o,l,s,a,i,f,_=r[16]||qe(),p,m;t=new Je({props:{editable:x(),id:r[0].id,header:r[0].getTitle(),label:"Chapter title",tags:r[4].getTags(),save:r[25],getImage:r[26],setImage:r[27],print:r[1],$$slots:{after:[$t],before:[gt],outline:[it]},$$scope:{ctx:r}}}),e=new de({props:{editable:r[16],$$slots:{default:[bt]},$$scope:{ctx:r}}});const d=[kt,wt],v=[];function P(u,b){return u[2]?0:1}s=P(r),a=v[s]=d[s](r);let $=r[6]&&r[6].size>0&&pe(te(r)),E=_&&yt(r);return{c(){C(t.$$.fragment),n=S(),C(e.$$.fragment),o=S(),l=U("section"),a.c(),i=S(),$&&$.c(),f=S(),E&&E.c(),p=A(),this.h()},l(u){I(t.$$.fragment,u),n=D(u),I(e.$$.fragment,u),o=D(u),l=M(u,"SECTION",{class:!0});var b=z(l);a.l(b),b.forEach(g),i=D(u),$&&$.l(u),f=D(u),E&&E.l(u),p=A(),this.h()},h(){G(l,"class","chapter-content")},m(u,b){B(t,u,b),k(u,n,b),B(e,u,b),k(u,o,b),k(u,l,b),v[s].m(l,null),k(u,i,b),$&&$.m(u,b),k(u,f,b),E&&E.m(u,b),k(u,p,b),m=!0},p(u,b){const R={};b[0]&1&&(R.id=u[0].id),b[0]&1&&(R.header=u[0].getTitle()),b[0]&16&&(R.tags=u[4].getTags()),b[0]&1&&(R.save=u[25]),b[0]&1&&(R.getImage=u[26]),b[0]&1&&(R.setImage=u[27]),b[0]&2&&(R.print=u[1]),b[0]&1977|b[1]&128&&(R.$$scope={dirty:b,ctx:u}),t.$set(R);const q={};b[1]&128&&(q.$$scope={dirty:b,ctx:u}),e.$set(q);let Z=s;s=P(u),s===Z?v[s].p(u,b):(Y(),w(v[Z],1,1,()=>{v[Z]=null}),H(),a=v[s],a?a.p(u,b):(a=v[s]=d[s](u),a.c()),h(a,1),a.m(l,null)),u[6]&&u[6].size>0?$?($.p(te(u),b),b[0]&64&&h($,1)):($=pe(te(u)),$.c(),h($,1),$.m(f.parentNode,f)):$&&(Y(),w($,1,1,()=>{$=null}),H()),_&&E.p(u,b)},i(u){m||(h(t.$$.fragment,u),h(e.$$.fragment,u),h(a),h($),h(E),m=!0)},o(u){w(t.$$.fragment,u),w(e.$$.fragment,u),w(a),w($),w(E),m=!1},d(u){T(t,u),u&&g(n),T(e,u),u&&g(o),u&&g(l),v[s].d(),u&&g(i),$&&$.d(u),u&&g(f),E&&E.d(u),u&&g(p)}}}function Rt(r){let t,n,e=r[4]&&fe(r);return{c(){e&&e.c(),t=A()},l(o){e&&e.l(o),t=A()},m(o,l){e&&e.m(o,l),k(o,t,l),n=!0},p(o,l){o[4]?e?(e.p(o,l),l[0]&16&&h(e,1)):(e=fe(o),e.c(),h(e,1),e.m(t.parentNode,t)):e&&(Y(),w(e,1,1,()=>{e=null}),H())},i(o){n||(h(e),n=!0)},o(o){w(e),n=!1},d(o){e&&e.d(o),o&&g(t)}}}function V(){localStorage.setItem("scrollposition",""+window.scrollY)}function $e(){return typeof location>"u"?void 0:location}function Pt(){var r,t;return((t=(r=$e())==null?void 0:r.search.split("&")[0])==null?void 0:t.split("=")[1])??void 0}function St(){var t,n;const r=(n=(t=$e())==null?void 0:t.search.split("&")[1])==null?void 0:n.split("=")[1];return r===void 0?void 0:parseInt(r)}function Dt(r,t,n){let e,o,l,s,a,i,f,_,p,m,{chapter:d}=t,{print:v=!1}=t,P=He();Q(r,P,c=>n(9,p=c));let $=Ue();Q(r,$,c=>n(4,_=c));let E=Me();Q(r,E,c=>n(32,f=c));let u=le(void 0);Q(r,u,c=>n(10,m=c));let b;oe(()=>{const c=()=>{const j=window.location.hash.substring(1),W=j?document.getElementById(j):null;W&&(n(17,b=j),setTimeout(()=>ee.observe(W),2500))},L=()=>{se(),c()};window.addEventListener("scroll",L);const ne=new ResizeObserver(()=>F());ne.observe(document.body),window.addEventListener("beforeunload",V),window.addEventListener("visibilitychange",V),window.addEventListener("pagehide",V),window.addEventListener("pushstate",c),window.addEventListener("popstate",c),window.addEventListener("hashchange",c);const ee=new IntersectionObserver(j=>{j.forEach(W=>{W.intersectionRatio===0&&W.target.id===window.location.hash.substring(1)&&(history.pushState("",document.title,window.location.pathname+window.location.search),ee.unobserve(W.target),n(17,b=void 0))})});return c(),F(),()=>{window.removeEventListener("scroll",L),ne.unobserve(document.body),window.removeEventListener("beforeunload",V),window.removeEventListener("visibilitychange",V),window.removeEventListener("pagehide",V),localStorage.removeItem("scrollposition"),window.removeEventListener("pushstate",c),window.removeEventListener("popstate",c),window.removeEventListener("hashchange",c),ee.disconnect()}}),oe(()=>F());function R(){if(F(),location.search){const c=document.getElementsByClassName("bookish-text bookish-content-highlight"),L=St();L&&c.length>0&&L<c.length&&L>=0&&ie(c[L])}else if(b){const c=document.getElementById(b);c&&ie(c)}else{const c=performance.getEntriesByType("navigation"),L=localStorage.getItem("scrollposition");L!==null&&c.length>0&&c[c.length-1].type==="reload"?window.scrollTo(0,parseInt(L)):window.scrollTo(0,0)}}let q=le();Oe(ze,q);let Z=We()||Ve()||x()||f!==void 0&&f.user!==null&&d.isEditor(f.user.uid);const be=()=>O($,d,d.withAuthor("")),we=(c,L)=>O($,d,d.withRenamedAuthor(c,L)),ke=c=>O($,d,d.withoutAuthor(c)),ve=c=>{p&&(O($,d,d.withChapterID(c)),rt(`/write/${p.getID()}/${i}/${c}`))},Ee=c=>/^[a-zA-Z0-9]+$/.test(c)?d.getID()!==c&&(_!=null&&_.hasChapter(c))?"There's already a chapter that has this ID.":void 0:"Chapter IDs must be one or more letters or numbers",Ce=c=>O($,d,d.asNumbered(c)),Ie=c=>{c&&u.set(void 0),se()},Be=c=>O($,d,d.withTitle(c)),Te=()=>d.getImage(),ye=c=>O($,d,d.withImage(c)),Ne=c=>Ze.parseChapter(_,c),Le=c=>c instanceof je?O($,d,d.withAST(c)):void 0,Ae=c=>Fe(E,$,d.id,c),Re=c=>O($,d,d.withEditors(c));return r.$$set=c=>{"chapter"in c&&n(0,d=c.chapter),"print"in c&&n(1,v=c.print)},r.$$.update=()=>{r.$$.dirty[0]&1&&n(3,e=d.getID()),r.$$.dirty[0]&24&&n(8,o=_==null?void 0:_.getChapterNumber(e)),r.$$.dirty[0]&24&&n(7,l=_==null?void 0:_.getChapterSection(e)),r.$$.dirty[0]&17&&n(2,s=_?d.getAST(_):void 0),r.$$.dirty[0]&4&&n(6,a=s?s.getCitations():void 0),r.$$.dirty[0]&16&&n(5,i=_?_.getEditionNumber():void 0),r.$$.dirty[0]&131073&&q.set({chapter:d,highlightedWord:Pt(),highlightedID:b,marginal:u,layoutMarginals:F})},[d,v,s,e,_,i,a,l,o,p,m,P,$,E,u,R,Z,b,be,we,ke,ve,Ee,Ce,Ie,Be,Te,ye,Ne,Le,Ae,Re]}class Kt extends Pe{constructor(t){super(),Se(this,t,Dt,Rt,De,{chapter:0,print:1},null,[-1,-1])}}export{Kt as C};
@@ -0,0 +1,2 @@
1
+ import{S as V,i as z,a5 as M,x as b,y as k,z as v,f as m,t as h,A as w,k as y,l as D,m as B,h as _,n as $,R as X,b as p,g as F,a6 as x,a7 as ee,d as U,e as C,s as Qe,a as A,q,c as Q,r as R,H as P,L as pe,M as Fe,N as He,o as Ge,j as We,u as W,v as Ke,I as te,a4 as le,C as Y,a1 as ne,a8 as H,a9 as G,aa as oe,Y as Xe}from"./index-437f4d21.js";import{V as ce,b as Ye,r as Ue,a as Je,g as Ze,c as xe,P as Me,E as et,C as tt,Q as lt,i as nt,W as ot,R as rt,e as st,X as at}from"./Contexts-9f2cc2fa.js";import{w as it}from"./singletons-3041590b.js";import{P as Ve,F as ze,E as ft}from"./Embed-8f6c7b1e.js";import{C as de,T as ut,P as _e,F as J}from"./Format-4d4050b8.js";import{R as ct}from"./Rows-2e420ce9.js";function $e(r,t,l){const e=r.slice();return e[1]=t[l],e}function be(r,t){let l,e,n;return e=new he({props:{node:t[1]}}),{key:r,first:null,c(){l=C(),b(e.$$.fragment),this.h()},l(o){l=C(),k(e.$$.fragment,o),this.h()},h(){this.first=l},m(o,a){p(o,l,a),v(e,o,a),n=!0},p(o,a){t=o;const i={};a&1&&(i.node=t[1]),e.$set(i)},i(o){n||(m(e.$$.fragment,o),n=!0)},o(o){h(e.$$.fragment,o),n=!1},d(o){o&&_(l),w(e,o)}}}function dt(r){let t,l=[],e=new Map,n,o,a=r[0].getBlocks();const i=s=>s[1].nodeID;for(let s=0;s<a.length;s+=1){let f=$e(r,a,s),u=i(f);e.set(u,l[s]=be(u,f))}return{c(){t=y("section");for(let s=0;s<l.length;s+=1)l[s].c();this.h()},l(s){t=D(s,"SECTION",{class:!0,"data-nodeid":!0});var f=B(t);for(let u=0;u<l.length;u+=1)l[u].l(f);f.forEach(_),this.h()},h(){$(t,"class",X("bookish-callout")+" svelte-mtblh5"),$(t,"data-nodeid",n=r[0].nodeID)},m(s,f){p(s,t,f);for(let u=0;u<l.length;u+=1)l[u].m(t,null);o=!0},p(s,f){f&1&&(a=s[0].getBlocks(),F(),l=x(l,f,i,1,s,a,e,t,ee,be,null,$e),U()),(!o||f&1&&n!==(n=s[0].nodeID))&&$(t,"data-nodeid",n)},i(s){if(!o){for(let f=0;f<a.length;f+=1)m(l[f]);o=!0}},o(s){for(let f=0;f<l.length;f+=1)h(l[f]);o=!1},d(s){s&&_(t);for(let f=0;f<l.length;f+=1)l[f].d()}}}function _t(r){let t,l;return t=new Ve({props:{position:r[0].getPosition(),$$slots:{default:[dt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,[n]){const o={};n&1&&(o.position=e[0].getPosition()),n&17&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function ht(r,t,l){let{node:e}=t;return r.$$set=n=>{"node"in n&&l(0,e=n.node)},[e]}class mt extends V{constructor(t){super(),z(this,t,ht,_t,M,{node:0})}}function ke(r,t,l){const e=r.slice();return e[13]=t[l],e[15]=l,e}function gt(r){let t;return{c(){t=q(r[2])},l(l){t=R(l,r[2])},m(l,e){p(l,t,e)},p(l,e){e&4&&W(t,l[2])},d(l){l&&_(t)}}}function ve(r){let t;return{c(){t=y("br")},l(l){t=D(l,"BR",{})},m(l,e){p(l,t,e)},d(l){l&&_(t)}}}function we(r){let t,l=r[13]+"",e,n=r[15]<r[5].length-1&&ve();return{c(){t=y("span"),e=q(l),n&&n.c(),this.h()},l(o){t=D(o,"SPAN",{class:!0});var a=B(t);e=R(a,l),n&&n.l(a),a.forEach(_),this.h()},h(){$(t,"class","python-output-line")},m(o,a){p(o,t,a),P(t,e),n&&n.m(t,null)},p(o,a){a&32&&l!==(l=o[13]+"")&&W(e,l),o[15]<o[5].length-1?n||(n=ve(),n.c(),n.m(t,null)):n&&(n.d(1),n=null)},d(o){o&&_(t),n&&n.d()}}}function pt(r){let t,l,e,n,o,a="↻",i,s,f,u,d="▶︎",c,g,N,j,E,re,me;l=new de({props:{inline:!1,language:"python",editable:!0,edited:r[7],nodeID:r[0].nodeID,$$slots:{default:[gt]},$$scope:{ctx:r}}});let K=r[5],T=[];for(let I=0;I<K.length;I+=1)T[I]=we(ke(r,K,I));return{c(){t=y("div"),b(l.$$.fragment),e=A(),n=y("div"),o=y("button"),i=q(a),f=A(),u=y("button"),c=q(d),N=A(),j=y("div");for(let I=0;I<T.length;I+=1)T[I].c();this.h()},l(I){t=D(I,"DIV",{class:!0});var O=B(t);k(l.$$.fragment,O),e=Q(O),n=D(O,"DIV",{class:!0});var S=B(n);o=D(S,"BUTTON",{class:!0});var L=B(o);i=R(L,a),L.forEach(_),f=Q(S),u=D(S,"BUTTON",{class:!0});var Z=B(u);c=R(Z,d),Z.forEach(_),N=Q(S),j=D(S,"DIV",{class:!0});var ge=B(j);for(let se=0;se<T.length;se+=1)T[se].l(ge);ge.forEach(_),S.forEach(_),O.forEach(_),this.h()},h(){o.disabled=s=r[1]===r[2],$(o,"class","svelte-isz2ud"),u.disabled=g=!r[3],$(u,"class","svelte-isz2ud"),$(j,"class","bookish-python-output svelte-isz2ud"),$(n,"class","bookish-python-controls svelte-isz2ud"),$(t,"class","bookish-python svelte-isz2ud")},m(I,O){p(I,t,O),v(l,t,null),P(t,e),P(t,n),P(n,o),P(o,i),P(n,f),P(n,u),P(u,c),P(n,N),P(n,j);for(let S=0;S<T.length;S+=1)T[S].m(j,null);r[10](t),E=!0,re||(me=[pe(o,"click",r[6]),pe(u,"click",r[8])],re=!0)},p(I,[O]){const S={};if(O&1&&(S.nodeID=I[0].nodeID),O&65540&&(S.$$scope={dirty:O,ctx:I}),l.$set(S),(!E||O&6&&s!==(s=I[1]===I[2]))&&(o.disabled=s),(!E||O&8&&g!==(g=!I[3]))&&(u.disabled=g),O&32){K=I[5];let L;for(L=0;L<K.length;L+=1){const Z=ke(I,K,L);T[L]?T[L].p(Z,O):(T[L]=we(Z),T[L].c(),T[L].m(j,null))}for(;L<T.length;L+=1)T[L].d(1);T.length=K.length}},i(I){E||(m(l.$$.fragment,I),E=!0)},o(I){h(l.$$.fragment,I),E=!1},d(I){I&&_(t),w(l),Fe(T,I),r[10](null),re=!1,He(me)}}}function Ce(){return window.hasOwnProperty("Sk")}function $t(r,t,l){let e,{node:n}=t,{startCode:o}=t,a=o,i="",s=Ce(),f=null;Ge(()=>{if(document.getElementById("skulpt")===null){let E=document.createElement("script");E.type="text/javascript",E.async=!0,E.id="skulpt",E.onload=()=>l(3,s=!0),E.src="https://cdn.jsdelivr.net/combine/npm/skulpt@1.2.0/dist/skulpt.min.js,npm/skulpt@1.2.0/dist/skulpt-stdlib.min.js",document.getElementsByTagName("head")[0].appendChild(E)}}),We(()=>{if(f){let E=f.querySelector(".bookish-python-output");E&&(E.scrollTop=E.scrollHeight)}});function u(){l(2,a=o)}function d(E){l(2,a=E)}function c(E){l(9,i+=E)}function g(){Ce()&&(l(9,i="Executing..."),setTimeout(()=>N(),500))}function N(){if(l(9,i=""),Sk){Sk.configure({output:c});try{Sk&&Sk.importMainWithBody("<stdin>",!1,a,!0)}catch(E){c(E)}}}function j(E){Ke[E?"unshift":"push"](()=>{f=E,l(4,f)})}return r.$$set=E=>{"node"in E&&l(0,n=E.node),"startCode"in E&&l(1,o=E.startCode)},r.$$.update=()=>{r.$$.dirty&512&&l(5,e=i.split(`
2
+ `))},[n,o,a,s,f,e,u,d,g,i,j]}class bt extends V{constructor(t){super(),z(this,t,$t,pt,Qe,{node:0,startCode:1})}}function kt(r){let t,l;return t=new de({props:{editable:!1,inline:!1,language:r[0].getLanguage(),nodeID:r[0].getCodeNode().nodeID,$$slots:{default:[Ct]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.language=e[0].getLanguage()),n&1&&(o.nodeID=e[0].getCodeNode().nodeID),n&65&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function vt(r){let t,l;return t=new bt({props:{node:r[0],startCode:r[0].getCode()}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),n&1&&(o.startCode=e[0].getCode()),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function wt(r){let t,l,e,n,o,a,i,s;return e=new ut({props:{node:r[0].getCodeNode()}}),i=new de({props:{editable:!1,inline:!1,language:r[0].getLanguage(),nodeID:r[0].getCodeNode().nodeID,$$slots:{default:[Et]},$$scope:{ctx:r}}}),{c(){t=y("div"),l=y("code"),b(e.$$.fragment),o=A(),a=y("div"),b(i.$$.fragment),this.h()},l(f){t=D(f,"DIV",{class:!0});var u=B(t);l=D(u,"CODE",{class:!0});var d=B(l);k(e.$$.fragment,d),d.forEach(_),o=Q(u),a=D(u,"DIV",{class:!0});var c=B(a);k(i.$$.fragment,c),c.forEach(_),u.forEach(_),this.h()},h(){$(l,"class",n=X(`bookish-code bookish-code-block language-${r[2]} ${r[1]?"":"hidden"}`)+" svelte-2xo0k7"),$(a,"class","code svelte-2xo0k7"),le(a,"inside",r[1]),$(t,"class","container svelte-2xo0k7")},m(f,u){p(f,t,u),P(t,l),v(e,l,null),P(t,o),P(t,a),v(i,a,null),s=!0},p(f,u){const d={};u&1&&(d.node=f[0].getCodeNode()),e.$set(d),(!s||u&6&&n!==(n=X(`bookish-code bookish-code-block language-${f[2]} ${f[1]?"":"hidden"}`)+" svelte-2xo0k7"))&&$(l,"class",n);const c={};u&1&&(c.language=f[0].getLanguage()),u&1&&(c.nodeID=f[0].getCodeNode().nodeID),u&65&&(c.$$scope={dirty:u,ctx:f}),i.$set(c),(!s||u&2)&&le(a,"inside",f[1])},i(f){s||(m(e.$$.fragment,f),m(i.$$.fragment,f),s=!0)},o(f){h(e.$$.fragment,f),h(i.$$.fragment,f),s=!1},d(f){f&&_(t),w(e),w(i)}}}function Ct(r){let t=r[0].getCode()+"",l;return{c(){l=q(t)},l(e){l=R(e,t)},m(e,n){p(e,l,n)},p(e,n){n&1&&t!==(t=e[0].getCode()+"")&&W(l,t)},d(e){e&&_(l)}}}function Et(r){let t=r[0].getCode()+"",l;return{c(){l=q(t)},l(e){l=R(e,t)},m(e,n){p(e,l,n)},p(e,n){n&1&&t!==(t=e[0].getCode()+"")&&W(l,t)},d(e){e&&_(l)}}}function Ee(r){let t,l=r[0].getLanguage()+"",e;return{c(){t=y("aside"),e=q(l),this.h()},l(n){t=D(n,"ASIDE",{class:!0});var o=B(t);e=R(o,l),o.forEach(_),this.h()},h(){$(t,"class","language svelte-2xo0k7")},m(n,o){p(n,t,o),P(t,e)},p(n,o){o&1&&l!==(l=n[0].getLanguage()+"")&&W(e,l)},d(n){n&&_(t)}}}function Nt(r){let t,l,e,n,o=r[0].getLanguage()!=="plaintext",a,i;const s=[wt,vt,kt],f=[];function u(c,g){return g&1&&(t=null),c[3]?0:(t==null&&(t=!!(c[0].getLanguage()==="python"&&c[0].isExecutable())),t?1:2)}l=u(r,-1),e=f[l]=s[l](r);let d=o&&Ee(r);return{c(){e.c(),n=A(),d&&d.c(),a=C()},l(c){e.l(c),n=Q(c),d&&d.l(c),a=C()},m(c,g){f[l].m(c,g),p(c,n,g),d&&d.m(c,g),p(c,a,g),i=!0},p(c,g){let N=l;l=u(c,g),l===N?f[l].p(c,g):(F(),h(f[N],1,1,()=>{f[N]=null}),U(),e=f[l],e?e.p(c,g):(e=f[l]=s[l](c),e.c()),m(e,1),e.m(n.parentNode,n)),g&1&&(o=c[0].getLanguage()!=="plaintext"),o?d?d.p(c,g):(d=Ee(c),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i(c){i||(m(e),i=!0)},o(c){h(e),i=!1},d(c){f[l].d(c),c&&_(n),d&&d.d(c),c&&_(a)}}}function It(r){let t,l;return t=new ze({props:{node:r[0],caption:r[0].getCaption(),$$slots:{default:[Nt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,[n]){const o={};n&1&&(o.node=e[0]),n&1&&(o.caption=e[0].getCaption()),n&71&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function yt(r,t,l){let e,n,o,{node:a}=t,i=ce(),s=Ye();return te(r,s,f=>l(5,o=f)),r.$$set=f=>{"node"in f&&l(0,a=f.node)},r.$$.update=()=>{var f,u;r.$$.dirty&1&&l(2,e=a.getLanguage()),r.$$.dirty&33&&l(1,n=((f=o==null?void 0:o.range)==null?void 0:f.start.node)===a.getCodeNode()||((u=o==null?void 0:o.range)==null?void 0:u.end.node)===a.getCodeNode())},[a,n,e,i,s,o]}class Dt extends V{constructor(t){super(),z(this,t,yt,It,M,{node:0})}}function Bt(r){let t,l,e=r[0].getError()+"",n,o;return{c(){t=y("span"),l=q("Error: "),n=q(e),this.h()},l(a){t=D(a,"SPAN",{"data-nodeid":!0});var i=B(t);l=R(i,"Error: "),n=R(i,e),i.forEach(_),this.h()},h(){$(t,"data-nodeid",o=r[0].nodeID)},m(a,i){p(a,t,i),P(t,l),P(t,n)},p(a,i){i&1&&e!==(e=a[0].getError()+"")&&W(n,e),i&1&&o!==(o=a[0].nodeID)&&$(t,"data-nodeid",o)},d(a){a&&_(t)}}}function Pt(r){let t,l;return t=new _e({props:{$$slots:{default:[Bt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,[n]){const o={};n&3&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function Tt(r,t,l){let{node:e}=t;return r.$$set=n=>{"node"in n&&l(0,e=n.node)},[e]}class Lt extends V{constructor(t){super(),z(this,t,Tt,Pt,M,{node:0})}}function Ne(r,t,l){const e=r.slice();return e[1]=t[l],e}function qt(r){let t,l,e;return l=new J({props:{node:r[1]}}),{c(){t=y("li"),b(l.$$.fragment),this.h()},l(n){t=D(n,"LI",{class:!0});var o=B(t);k(l.$$.fragment,o),o.forEach(_),this.h()},h(){$(t,"class","svelte-1mrdldt")},m(n,o){p(n,t,o),v(l,t,null),e=!0},p(n,o){const a={};o&1&&(a.node=n[1]),l.$set(a)},i(n){e||(m(l.$$.fragment,n),e=!0)},o(n){h(l.$$.fragment,n),e=!1},d(n){n&&_(t),w(l)}}}function Rt(r){let t,l;return t=new je({props:{node:r[1]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[1]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function Ie(r,t){let l,e,n,o,a;const i=[Rt,qt],s=[];function f(u,d){return u[1]instanceof Ue?0:1}return e=f(t),n=s[e]=i[e](t),{key:r,first:null,c(){l=C(),n.c(),o=C(),this.h()},l(u){l=C(),n.l(u),o=C(),this.h()},h(){this.first=l},m(u,d){p(u,l,d),s[e].m(u,d),p(u,o,d),a=!0},p(u,d){t=u;let c=e;e=f(t),e===c?s[e].p(t,d):(F(),h(s[c],1,1,()=>{s[c]=null}),U(),n=s[e],n?n.p(t,d):(n=s[e]=i[e](t),n.c()),m(n,1),n.m(o.parentNode,o))},i(u){a||(m(n),a=!0)},o(u){h(n),a=!1},d(u){u&&_(l),s[e].d(u),u&&_(o)}}}function ae(r){let t,l=[],e=new Map,n,o,a=r[0].getItems();const i=u=>u[1].nodeID;for(let u=0;u<a.length;u+=1){let d=Ne(r,a,u),c=i(d);e.set(c,l[u]=Ie(c,d))}let s=[{"data-nodeid":n=r[0].nodeID},{class:"svelte-1mrdldt"}],f={};for(let u=0;u<s.length;u+=1)f=ne(f,s[u]);return{c(){t=y(r[0].isNumbered()?"ol":"ul");for(let u=0;u<l.length;u+=1)l[u].c();this.h()},l(u){t=D(u,((r[0].isNumbered()?"ol":"ul")||"null").toUpperCase(),{"data-nodeid":!0,class:!0});var d=B(t);for(let c=0;c<l.length;c+=1)l[c].l(d);d.forEach(_),this.h()},h(){/-/.test(r[0].isNumbered()?"ol":"ul")?H(t,f):G(t,f)},m(u,d){p(u,t,d);for(let c=0;c<l.length;c+=1)l[c].m(t,null);o=!0},p(u,d){d&1&&(a=u[0].getItems(),F(),l=x(l,d,i,1,u,a,e,t,ee,Ie,null,Ne),U()),f=oe(s,[(!o||d&1&&n!==(n=u[0].nodeID))&&{"data-nodeid":n},{class:"svelte-1mrdldt"}]),/-/.test(u[0].isNumbered()?"ol":"ul")?H(t,f):G(t,f)},i(u){if(!o){for(let d=0;d<a.length;d+=1)m(l[d]);o=!0}},o(u){for(let d=0;d<l.length;d+=1)h(l[d]);o=!1},d(u){u&&_(t);for(let d=0;d<l.length;d+=1)l[d].d()}}}function Ot(r){let t=r[0].isNumbered()?"ol":"ul",l,e=(r[0].isNumbered()?"ol":"ul")&&ae(r);return{c(){e&&e.c(),l=C()},l(n){e&&e.l(n),l=C()},m(n,o){e&&e.m(n,o),p(n,l,o)},p(n,[o]){n[0].isNumbered(),t?M(t,n[0].isNumbered()?"ol":"ul")?(e.d(1),e=ae(n),e.c(),e.m(l.parentNode,l)):e.p(n,o):(e=ae(n),e.c(),e.m(l.parentNode,l)),t=n[0].isNumbered()?"ol":"ul"},i:Y,o(n){h(e)},d(n){n&&_(l),e&&e.d(n)}}}function St(r,t,l){let{node:e}=t;return r.$$set=n=>{"node"in n&&l(0,e=n.node)},[e]}class je extends V{constructor(t){super(),z(this,t,St,Ot,M,{node:0})}}function Ft(r){let t=`h${r[4]+1}`,l,e=`h${r[4]+1}`&&ie(r);return{c(){e&&e.c(),l=C()},l(n){e&&e.l(n),l=C()},m(n,o){e&&e.m(n,o),p(n,l,o)},p(n,o){`h${n[4]+1}`?t?M(t,`h${n[4]+1}`)?(e.d(1),e=ie(n),e.c(),e.m(l.parentNode,l)):e.p(n,o):(e=ie(n),e.c(),e.m(l.parentNode,l)):t&&(e.d(1),e=null),t=`h${n[4]+1}`},i:Y,o(n){h(e)},d(n){n&&_(l),e&&e.d(n)}}}function Ut(r){let t,l,e,n;return l=new J({props:{node:r[0].getFormat(),placeholder:r[1]??"¶"}}),{c(){t=y("p"),b(l.$$.fragment),this.h()},l(o){t=D(o,"P",{"data-nodeid":!0,class:!0});var a=B(t);k(l.$$.fragment,a),a.forEach(_),this.h()},h(){$(t,"data-nodeid",e=r[0].nodeID),$(t,"class","svelte-6oqugy"),le(t,"placeholder",r[1])},m(o,a){p(o,t,a),v(l,t,null),n=!0},p(o,a){const i={};a&1&&(i.node=o[0].getFormat()),a&2&&(i.placeholder=o[1]??"¶"),l.$set(i),(!n||a&1&&e!==(e=o[0].nodeID))&&$(t,"data-nodeid",e),(!n||a&2)&&le(t,"placeholder",o[1])},i(o){n||(m(l.$$.fragment,o),n=!0)},o(o){h(l.$$.fragment,o),n=!1},d(o){o&&_(t),w(l)}}}function ie(r){let t,l,e,n,o;l=new J({props:{node:r[0].getFormat()}});let a=[{class:e=X(r[3])+" svelte-6oqugy"},{id:r[2]},{"data-nodeid":n=r[0].nodeID}],i={};for(let s=0;s<a.length;s+=1)i=ne(i,a[s]);return{c(){t=y(`h${r[4]+1}`),b(l.$$.fragment),this.h()},l(s){t=D(s,(`h${r[4]+1}`||"null").toUpperCase(),{class:!0,id:!0,"data-nodeid":!0});var f=B(t);k(l.$$.fragment,f),f.forEach(_),this.h()},h(){/-/.test(`h${r[4]+1}`)?H(t,i):G(t,i)},m(s,f){p(s,t,f),v(l,t,null),o=!0},p(s,f){const u={};f&1&&(u.node=s[0].getFormat()),l.$set(u),i=oe(a,[(!o||f&8&&e!==(e=X(s[3])+" svelte-6oqugy"))&&{class:e},(!o||f&4)&&{id:s[2]},(!o||f&1&&n!==(n=s[0].nodeID))&&{"data-nodeid":n}]),/-/.test(`h${s[4]+1}`)?H(t,i):G(t,i)},i(s){o||(m(l.$$.fragment,s),o=!0)},o(s){h(l.$$.fragment,s),o=!1},d(s){s&&_(t),w(l)}}}function Mt(r){let t,l,e,n;const o=[Ut,Ft],a=[];function i(s,f){return s[4]===0?0:1}return t=i(r),l=a[t]=o[t](r),{c(){l.c(),e=C()},l(s){l.l(s),e=C()},m(s,f){a[t].m(s,f),p(s,e,f),n=!0},p(s,[f]){let u=t;t=i(s),t===u?a[t].p(s,f):(F(),h(a[u],1,1,()=>{a[u]=null}),U(),l=a[t],l?l.p(s,f):(l=a[t]=o[t](s),l.c()),m(l,1),l.m(e.parentNode,e))},i(s){n||(m(l),n=!0)},o(s){h(l),n=!1},d(s){a[t].d(s),s&&_(e)}}}function Vt(r,t,l){let e,n,o,a,i,s,{node:f}=t,{placeholder:u=void 0}=t,d=Je();te(r,d,N=>l(8,a=N));let c=Ze();te(r,c,N=>l(10,s=N));let g=xe();return te(r,g,N=>l(9,i=N)),r.$$set=N=>{"node"in N&&l(0,f=N.node),"placeholder"in N&&l(1,u=N.placeholder)},r.$$.update=()=>{r.$$.dirty&1&&l(4,e=f.getLevel()),r.$$.dirty&1537&&l(2,n=f.getLevel()===0||s===void 0?void 0:"header-"+(i.getHeaders().indexOf(f)??"")),r.$$.dirty&261&&l(3,o=f.getLevel()===0?void 0:"page-header"+(a&&a.highlightedID===n?" bookish-content-highlight":""))},[f,u,n,o,e,d,c,g,a,i,s]}class Ae extends V{constructor(t){super(),z(this,t,Vt,Mt,M,{node:0,placeholder:1})}}function ye(r,t,l){const e=r.slice();return e[2]=t[l],e}function De(r,t){let l,e,n;return e=new he({props:{node:t[2]}}),{key:r,first:null,c(){l=C(),b(e.$$.fragment),this.h()},l(o){l=C(),k(e.$$.fragment,o),this.h()},h(){this.first=l},m(o,a){p(o,l,a),v(e,o,a),n=!0},p(o,a){t=o;const i={};a&1&&(i.node=t[2]),e.$set(i)},i(o){n||(m(e.$$.fragment,o),n=!0)},o(o){h(e.$$.fragment,o),n=!1},d(o){o&&_(l),w(e,o)}}}function Be(r){let t,l,e,n;return l=new J({props:{node:r[1],placeholder:"credit"}}),{c(){t=y("figcaption"),b(l.$$.fragment),this.h()},l(o){t=D(o,"FIGCAPTION",{class:!0});var a=B(t);k(l.$$.fragment,a),a.forEach(_),this.h()},h(){$(t,"class",e="caption "+(r[1].isEmptyText()?"empty":"")+" svelte-1n0n2lt")},m(o,a){p(o,t,a),v(l,t,null),n=!0},p(o,a){const i={};a&2&&(i.node=o[1]),l.$set(i),(!n||a&2&&e!==(e="caption "+(o[1].isEmptyText()?"empty":"")+" svelte-1n0n2lt"))&&$(t,"class",e)},i(o){n||(m(l.$$.fragment,o),n=!0)},o(o){h(l.$$.fragment,o),n=!1},d(o){o&&_(t),w(l)}}}function zt(r){let t,l,e=[],n=new Map,o,a,i,s=r[0].getBlocks();const f=d=>d[2].nodeID;for(let d=0;d<s.length;d+=1){let c=ye(r,s,d),g=f(c);n.set(g,e[d]=De(g,c))}let u=r[1]&&Be(r);return{c(){t=y("figure"),l=y("blockquote");for(let d=0;d<e.length;d+=1)e[d].c();a=A(),u&&u.c(),this.h()},l(d){t=D(d,"FIGURE",{class:!0});var c=B(t);l=D(c,"BLOCKQUOTE",{class:!0,"data-nodeid":!0});var g=B(l);for(let N=0;N<e.length;N+=1)e[N].l(g);g.forEach(_),a=Q(c),u&&u.l(c),c.forEach(_),this.h()},h(){$(l,"class","quote svelte-1n0n2lt"),$(l,"data-nodeid",o=r[0].nodeID),$(t,"class","svelte-1n0n2lt")},m(d,c){p(d,t,c),P(t,l);for(let g=0;g<e.length;g+=1)e[g].m(l,null);P(t,a),u&&u.m(t,null),i=!0},p(d,c){c&1&&(s=d[0].getBlocks(),F(),e=x(e,c,f,1,d,s,n,l,ee,De,null,ye),U()),(!i||c&1&&o!==(o=d[0].nodeID))&&$(l,"data-nodeid",o),d[1]?u?(u.p(d,c),c&2&&m(u,1)):(u=Be(d),u.c(),m(u,1),u.m(t,null)):u&&(F(),h(u,1,1,()=>{u=null}),U())},i(d){if(!i){for(let c=0;c<s.length;c+=1)m(e[c]);m(u),i=!0}},o(d){for(let c=0;c<e.length;c+=1)h(e[c]);h(u),i=!1},d(d){d&&_(t);for(let c=0;c<e.length;c+=1)e[c].d();u&&u.d()}}}function jt(r){let t,l;return t=new Ve({props:{position:r[0].getPosition(),$$slots:{default:[zt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,[n]){const o={};n&1&&(o.position=e[0].getPosition()),n&35&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function At(r,t,l){let e,{node:n}=t;return r.$$set=o=>{"node"in o&&l(0,n=o.node)},r.$$.update=()=>{r.$$.dirty&1&&l(1,e=n.getCredit())},[n,e]}class Qt extends V{constructor(t){super(),z(this,t,At,jt,M,{node:0})}}function Ht(r){let t,l;return{c(){t=y("hr"),this.h()},l(e){t=D(e,"HR",{"data-nodeid":!0,class:!0}),this.h()},h(){$(t,"data-nodeid",l=r[0].nodeID),$(t,"class","svelte-e0e90u")},m(e,n){p(e,t,n)},p(e,[n]){n&1&&l!==(l=e[0].nodeID)&&$(t,"data-nodeid",l)},i:Y,o:Y,d(e){e&&_(t)}}}function Gt(r,t,l){let{node:e}=t;return r.$$set=n=>{"node"in n&&l(0,e=n.node)},[e]}class Wt extends V{constructor(t){super(),z(this,t,Gt,Ht,M,{node:0})}}function Pe(r,t,l){const e=r.slice();return e[4]=t[l],e[6]=l,e}function Te(r,t,l){const e=r.slice();return e[7]=t[l],e}function Kt(r){let t=[],l=new Map,e,n,o=r[4];const a=i=>i[7].nodeID;for(let i=0;i<o.length;i+=1){let s=Te(r,o,i),f=a(s);l.set(f,t[i]=Le(f,s))}return{c(){for(let i=0;i<t.length;i+=1)t[i].c();e=C()},l(i){for(let s=0;s<t.length;s+=1)t[s].l(i);e=C()},m(i,s){for(let f=0;f<t.length;f+=1)t[f].m(i,s);p(i,e,s),n=!0},p(i,s){s&2&&(o=i[4],F(),t=x(t,s,a,1,i,o,l,e.parentNode,ee,Le,e,Te),U())},i(i){if(!n){for(let s=0;s<o.length;s+=1)m(t[s]);n=!0}},o(i){for(let s=0;s<t.length;s+=1)h(t[s]);n=!1},d(i){for(let s=0;s<t.length;s+=1)t[s].d(i);i&&_(e)}}}function Xt(r){let t=r[6]===0?"th":"td",l,e=(r[6]===0?"th":"td")&&ue(r);return{c(){e&&e.c(),l=C()},l(n){e&&e.l(n),l=C()},m(n,o){e&&e.m(n,o),p(n,l,o)},p(n,o){n[6],t?M(t,n[6]===0?"th":"td")?(e.d(1),e=ue(n),e.c(),e.m(l.parentNode,l)):e.p(n,o):(e=ue(n),e.c(),e.m(l.parentNode,l)),t=n[6]===0?"th":"td"},i:Y,o(n){h(e)},d(n){n&&_(l),e&&e.d(n)}}}function fe(r){let t,l,e;l=new J({props:{node:r[7]}});let n=[{class:"svelte-1vr8kpd"}],o={};for(let a=0;a<n.length;a+=1)o=ne(o,n[a]);return{c(){t=y(r[6]===0?"th":"td"),b(l.$$.fragment),this.h()},l(a){t=D(a,((r[6]===0?"th":"td")||"null").toUpperCase(),{class:!0});var i=B(t);k(l.$$.fragment,i),i.forEach(_),this.h()},h(){/-/.test(r[6]===0?"th":"td")?H(t,o):G(t,o)},m(a,i){p(a,t,i),v(l,t,null),e=!0},p(a,i){const s={};i&2&&(s.node=a[7]),l.$set(s),o=oe(n,[{class:"svelte-1vr8kpd"}]),/-/.test(a[6]===0?"th":"td")?H(t,o):G(t,o)},i(a){e||(m(l.$$.fragment,a),e=!0)},o(a){h(l.$$.fragment,a),e=!1},d(a){a&&_(t),w(l)}}}function Le(r,t){let l,e=t[6]===0?"th":"td",n,o=(t[6]===0?"th":"td")&&fe(t);return{key:r,first:null,c(){l=C(),o&&o.c(),n=C(),this.h()},l(a){l=C(),o&&o.l(a),n=C(),this.h()},h(){this.first=l},m(a,i){p(a,l,i),o&&o.m(a,i),p(a,n,i)},p(a,i){t=a,t[6],e?M(e,t[6]===0?"th":"td")?(o.d(1),o=fe(t),o.c(),o.m(n.parentNode,n)):o.p(t,i):(o=fe(t),o.c(),o.m(n.parentNode,n)),e=t[6]===0?"th":"td"},i:Y,o(a){h(o)},d(a){a&&_(l),a&&_(n),o&&o.d(a)}}}function ue(r){let t,l,e=r[1].reduce(r[3],0)+"",n,o,a,i;a=new J({props:{node:r[4][0]}});let s=[{class:"svelte-1vr8kpd"}],f={};for(let u=0;u<s.length;u+=1)f=ne(f,s[u]);return{c(){t=y(r[6]===0?"th":"td"),l=q("colspan="),n=q(e),o=q(">"),b(a.$$.fragment),this.h()},l(u){t=D(u,((r[6]===0?"th":"td")||"null").toUpperCase(),{class:!0});var d=B(t);l=R(d,"colspan="),n=R(d,e),o=R(d,">"),k(a.$$.fragment,d),d.forEach(_),this.h()},h(){/-/.test(r[6]===0?"th":"td")?H(t,f):G(t,f)},m(u,d){p(u,t,d),P(t,l),P(t,n),P(t,o),v(a,t,null),i=!0},p(u,d){(!i||d&2)&&e!==(e=u[1].reduce(u[3],0)+"")&&W(n,e);const c={};d&2&&(c.node=u[4][0]),a.$set(c),f=oe(s,[{class:"svelte-1vr8kpd"}]),/-/.test(u[6]===0?"th":"td")?H(t,f):G(t,f)},i(u){i||(m(a.$$.fragment,u),i=!0)},o(u){h(a.$$.fragment,u),i=!1},d(u){u&&_(t),w(a)}}}function qe(r){let t,l,e,n,o;const a=[Xt,Kt],i=[];function s(f,u){return f[4].length===1?0:1}return l=s(r),e=i[l]=a[l](r),{c(){t=y("tr"),e.c(),n=A(),this.h()},l(f){t=D(f,"TR",{class:!0});var u=B(t);e.l(u),n=Q(u),u.forEach(_),this.h()},h(){$(t,"class",X(r[2]?"editable":null)+" svelte-1vr8kpd")},m(f,u){p(f,t,u),i[l].m(t,null),P(t,n),o=!0},p(f,u){let d=l;l=s(f),l===d?i[l].p(f,u):(F(),h(i[d],1,1,()=>{i[d]=null}),U(),e=i[l],e?e.p(f,u):(e=i[l]=a[l](f),e.c()),m(e,1),e.m(t,n))},i(f){o||(m(e),o=!0)},o(f){h(e),o=!1},d(f){f&&_(t),i[l].d()}}}function Yt(r){let t,l,e=r[1],n=[];for(let a=0;a<e.length;a+=1)n[a]=qe(Pe(r,e,a));const o=a=>h(n[a],1,1,()=>{n[a]=null});return{c(){for(let a=0;a<n.length;a+=1)n[a].c();t=C()},l(a){for(let i=0;i<n.length;i+=1)n[i].l(a);t=C()},m(a,i){for(let s=0;s<n.length;s+=1)n[s].m(a,i);p(a,t,i),l=!0},p(a,i){if(i&6){e=a[1];let s;for(s=0;s<e.length;s+=1){const f=Pe(a,e,s);n[s]?(n[s].p(f,i),m(n[s],1)):(n[s]=qe(f),n[s].c(),m(n[s],1),n[s].m(t.parentNode,t))}for(F(),s=e.length;s<n.length;s+=1)o(s);U()}},i(a){if(!l){for(let i=0;i<e.length;i+=1)m(n[i]);l=!0}},o(a){n=n.filter(Boolean);for(let i=0;i<n.length;i+=1)h(n[i]);l=!1},d(a){Fe(n,a),a&&_(t)}}}function Jt(r){let t,l;return t=new ct({props:{$$slots:{default:[Yt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1026&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function Zt(r){let t,l;return t=new ze({props:{node:r[0],caption:r[0].getCaption(),$$slots:{default:[Jt]},$$scope:{ctx:r}}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,[n]){const o={};n&1&&(o.node=e[0]),n&1&&(o.caption=e[0].getCaption()),n&1026&&(o.$$scope={dirty:n,ctx:e}),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function xt(r,t,l){let e,{node:n}=t,o=ce();const a=(i,s)=>Math.max(s.length,i);return r.$$set=i=>{"node"in i&&l(0,n=i.node)},r.$$.update=()=>{r.$$.dirty&1&&l(1,e=n.getRows())},[n,e,o,a]}class el extends V{constructor(t){super(),z(this,t,xt,Zt,M,{node:0})}}function tl(r){let t,l,e;return l=new _e({props:{$$slots:{default:[cl]},$$scope:{ctx:r}}}),{c(){t=y("p"),b(l.$$.fragment)},l(n){t=D(n,"P",{});var o=B(t);k(l.$$.fragment,o),o.forEach(_)},m(n,o){p(n,t,o),v(l,t,null),e=!0},p(n,o){const a={};o&4&&(a.$$scope={dirty:o,ctx:n}),l.$set(a)},i(n){e||(m(l.$$.fragment,n),e=!0)},o(n){h(l.$$.fragment,n),e=!1},d(n){n&&_(t),w(l)}}}function ll(r){let t,l;return t=new el({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function nl(r){let t,l;return t=new Wt({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function ol(r){let t,l;return t=new Lt({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function rl(r){let t,l;return t=new Dt({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function sl(r){let t,l;return t=new Qt({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function al(r){let t,l;return t=new mt({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function il(r){let t,l;return t=new ft({props:{node:r[0],editable:r[1]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function fl(r){let t,l;return t=new je({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function ul(r){let t,l;return t=new Ae({props:{node:r[0]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&1&&(o.node=e[0]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function cl(r){let t;return{c(){t=q("Unknown node type")},l(l){t=R(l,"Unknown node type")},m(l,e){p(l,t,e)},d(l){l&&_(t)}}}function dl(r){let t,l,e,n;const o=[ul,fl,il,al,sl,rl,ol,nl,ll,tl],a=[];function i(s,f){return s[0]instanceof Me?0:s[0]instanceof Ue?1:s[0]instanceof et?2:s[0]instanceof tt?3:s[0]instanceof lt?4:s[0]instanceof nt?5:s[0]instanceof ot?6:s[0]instanceof rt?7:s[0]instanceof st?8:9}return t=i(r),l=a[t]=o[t](r),{c(){l.c(),e=C()},l(s){l.l(s),e=C()},m(s,f){a[t].m(s,f),p(s,e,f),n=!0},p(s,[f]){let u=t;t=i(s),t===u?a[t].p(s,f):(F(),h(a[u],1,1,()=>{a[u]=null}),U(),l=a[t],l?l.p(s,f):(l=a[t]=o[t](s),l.c()),m(l,1),l.m(e.parentNode,e))},i(s){n||(m(l),n=!0)},o(s){h(l),n=!1},d(s){a[t].d(s),s&&_(e)}}}function _l(r,t,l){let{node:e}=t,n=ce();return r.$$set=o=>{"node"in o&&l(0,e=o.node)},[e,n]}class he extends V{constructor(t){super(),z(this,t,_l,dl,M,{node:0})}}function Re(r,t,l){const e=r.slice();return e[6]=t[l],e}function Oe(r){let t,l,e;return l=new _e({props:{$$slots:{default:[hl]},$$scope:{ctx:r}}}),{c(){t=y("p"),b(l.$$.fragment)},l(n){t=D(n,"P",{});var o=B(t);k(l.$$.fragment,o),o.forEach(_)},m(n,o){p(n,t,o),v(l,t,null),e=!0},p(n,o){const a={};o&528&&(a.$$scope={dirty:o,ctx:n}),l.$set(a)},i(n){e||(m(l.$$.fragment,n),e=!0)},o(n){h(l.$$.fragment,n),e=!1},d(n){n&&_(t),w(l)}}}function hl(r){let t=r[4].length+" "+(r[4].length>1?"errors":"error"),l,e;return{c(){l=q(t),e=q(" below")},l(n){l=R(n,t),e=R(n," below")},m(n,o){p(n,l,o),p(n,e,o)},p(n,o){o&16&&t!==(t=n[4].length+" "+(n[4].length>1?"errors":"error"))&&W(l,t)},d(n){n&&_(l),n&&_(e)}}}function ml(r){let t=[],l=new Map,e,n,o=r[0].getBlocks();const a=i=>i[6].nodeID;for(let i=0;i<o.length;i+=1){let s=Re(r,o,i),f=a(s);l.set(f,t[i]=Se(f,s))}return{c(){for(let i=0;i<t.length;i+=1)t[i].c();e=C()},l(i){for(let s=0;s<t.length;s+=1)t[s].l(i);e=C()},m(i,s){for(let f=0;f<t.length;f+=1)t[f].m(i,s);p(i,e,s),n=!0},p(i,s){s&1&&(o=i[0].getBlocks(),F(),t=x(t,s,a,1,i,o,l,e.parentNode,ee,Se,e,Re),U())},i(i){if(!n){for(let s=0;s<o.length;s+=1)m(t[s]);n=!0}},o(i){for(let s=0;s<t.length;s+=1)h(t[s]);n=!1},d(i){for(let s=0;s<t.length;s+=1)t[s].d(i);i&&_(e)}}}function gl(r){let t,l;return t=new Ae({props:{node:r[3][0],placeholder:r[1]}}),{c(){b(t.$$.fragment)},l(e){k(t.$$.fragment,e)},m(e,n){v(t,e,n),l=!0},p(e,n){const o={};n&8&&(o.node=e[3][0]),n&2&&(o.placeholder=e[1]),t.$set(o)},i(e){l||(m(t.$$.fragment,e),l=!0)},o(e){h(t.$$.fragment,e),l=!1},d(e){w(t,e)}}}function Se(r,t){let l,e,n;return e=new he({props:{node:t[6]}}),{key:r,first:null,c(){l=C(),b(e.$$.fragment),this.h()},l(o){l=C(),k(e.$$.fragment,o),this.h()},h(){this.first=l},m(o,a){p(o,l,a),v(e,o,a),n=!0},p(o,a){t=o;const i={};a&1&&(i.node=t[6]),e.$set(i)},i(o){n||(m(e.$$.fragment,o),n=!0)},o(o){h(e.$$.fragment,o),n=!1},d(o){o&&_(l),w(e,o)}}}function pl(r){let t,l,e,n,o,a,i,s=r[2]&&r[4].length>0&&Oe(r);const f=[gl,ml],u=[];function d(c,g){return g&8&&(e=null),e==null&&(e=!!(c[3].length===1&&c[3][0]instanceof Me&&c[3][0].getFormat().isEmptyText())),e?0:1}return n=d(r,-1),o=u[n]=f[n](r),{c(){t=y("section"),s&&s.c(),l=A(),o.c(),this.h()},l(c){t=D(c,"SECTION",{class:!0,"data-nodeid":!0});var g=B(t);s&&s.l(g),l=Q(g),o.l(g),g.forEach(_),this.h()},h(){$(t,"class","bookish-chapter-body svelte-rc12q7"),$(t,"data-nodeid",a=r[0].nodeID)},m(c,g){p(c,t,g),s&&s.m(t,null),P(t,l),u[n].m(t,null),i=!0},p(c,[g]){c[2]&&c[4].length>0?s?(s.p(c,g),g&20&&m(s,1)):(s=Oe(c),s.c(),m(s,1),s.m(t,l)):s&&(F(),h(s,1,1,()=>{s=null}),U());let N=n;n=d(c,g),n===N?u[n].p(c,g):(F(),h(u[N],1,1,()=>{u[N]=null}),U(),o=u[n],o?o.p(c,g):(o=u[n]=f[n](c),o.c()),m(o,1),o.m(t,null)),(!i||g&1&&a!==(a=c[0].nodeID))&&$(t,"data-nodeid",a)},i(c){i||(m(s),m(o),i=!0)},o(c){h(s),h(o),i=!1},d(c){c&&_(t),s&&s.d(),u[n].d()}}}function $l(r,t,l){let e,n,{node:o}=t,{placeholder:a=""}=t,{editable:i=!1}=t,s=it(o);return Xe(at,s),r.$$set=f=>{"node"in f&&l(0,o=f.node),"placeholder"in f&&l(1,a=f.placeholder),"editable"in f&&l(2,i=f.editable)},r.$$.update=()=>{r.$$.dirty&1&&l(4,e=o.getErrors()),r.$$.dirty&1&&l(3,n=o.getBlocks()),r.$$.dirty&1&&s.set(o)},[o,a,i,n,e]}class Nl extends V{constructor(t){super(),z(this,t,$l,pl,M,{node:0,placeholder:1,editable:2})}}export{Nl as C};
@@ -0,0 +1 @@
1
+ import{S as i,i as _,s as u,D as f,k as c,l as p,m as h,h as o,n as m,b as d,E as $,F as b,G as v,f as g,t as C}from"./index-437f4d21.js";function y(n){let t,a;const r=n[1].default,s=f(r,n,n[0],null);return{c(){t=c("span"),s&&s.c(),this.h()},l(e){t=p(e,"SPAN",{class:!0});var l=h(t);s&&s.l(l),l.forEach(o),this.h()},h(){m(t,"class","bookish-chapter-number svelte-1r3rzh7")},m(e,l){d(e,t,l),s&&s.m(t,null),a=!0},p(e,[l]){s&&s.p&&(!a||l&1)&&$(s,r,e,e[0],a?v(r,e[0],l,null):b(e[0]),null)},i(e){a||(g(s,e),a=!0)},o(e){C(s,e),a=!1},d(e){e&&o(t),s&&s.d(e)}}}function N(n,t,a){let{$$slots:r={},$$scope:s}=t;return n.$$set=e=>{"$$scope"in e&&a(0,s=e.$$scope)},[s,r]}class k extends i{constructor(t){super(),_(this,t,N,y,u,{})}}export{k as C};
@@ -0,0 +1 @@
1
+ import{S as w,i as E,s as H,e as h,b as m,g as L,t as f,d as S,f as u,h as _,D as d,k,l as $,m as b,n as g,E as v,F as y,G as C,x as T,y as q,z,A}from"./index-437f4d21.js";import{L as D}from"./Link-bf3cfc4a.js";function F(a){let e,s;const n=a[1].default,t=d(n,a,a[2],null);return{c(){e=k("h3"),t&&t.c(),this.h()},l(l){e=$(l,"H3",{class:!0});var o=b(e);t&&t.l(o),o.forEach(_),this.h()},h(){g(e,"class","svelte-1mmxwag")},m(l,o){m(l,e,o),t&&t.m(e,null),s=!0},p(l,o){t&&t.p&&(!s||o&4)&&v(t,n,l,l[2],s?C(n,l[2],o,null):y(l[2]),null)},i(l){s||(u(t,l),s=!0)},o(l){f(t,l),s=!1},d(l){l&&_(e),t&&t.d(l)}}}function G(a){let e,s;return e=new D({props:{to:a[0],$$slots:{default:[N]},$$scope:{ctx:a}}}),{c(){T(e.$$.fragment)},l(n){q(e.$$.fragment,n)},m(n,t){z(e,n,t),s=!0},p(n,t){const l={};t&1&&(l.to=n[0]),t&4&&(l.$$scope={dirty:t,ctx:n}),e.$set(l)},i(n){s||(u(e.$$.fragment,n),s=!0)},o(n){f(e.$$.fragment,n),s=!1},d(n){A(e,n)}}}function N(a){let e,s;const n=a[1].default,t=d(n,a,a[2],null);return{c(){e=k("h3"),t&&t.c(),this.h()},l(l){e=$(l,"H3",{class:!0});var o=b(e);t&&t.l(o),o.forEach(_),this.h()},h(){g(e,"class","svelte-1mmxwag")},m(l,o){m(l,e,o),t&&t.m(e,null),s=!0},p(l,o){t&&t.p&&(!s||o&4)&&v(t,n,l,l[2],s?C(n,l[2],o,null):y(l[2]),null)},i(l){s||(u(t,l),s=!0)},o(l){f(t,l),s=!1},d(l){l&&_(e),t&&t.d(l)}}}function j(a){let e,s,n,t;const l=[G,F],o=[];function p(r,i){return r[0]?0:1}return e=p(a),s=o[e]=l[e](a),{c(){s.c(),n=h()},l(r){s.l(r),n=h()},m(r,i){o[e].m(r,i),m(r,n,i),t=!0},p(r,[i]){let c=e;e=p(r),e===c?o[e].p(r,i):(L(),f(o[c],1,1,()=>{o[c]=null}),S(),s=o[e],s?s.p(r,i):(s=o[e]=l[e](r),s.c()),u(s,1),s.m(n.parentNode,n))},i(r){t||(u(s),t=!0)},o(r){f(s),t=!1},d(r){o[e].d(r),r&&_(n)}}}function B(a,e,s){let{$$slots:n={},$$scope:t}=e,{link:l=void 0}=e;return a.$$set=o=>{"link"in o&&s(0,l=o.link),"$$scope"in o&&s(2,t=o.$$scope)},[l,n,t]}class K extends w{constructor(e){super(),E(this,e,B,j,H,{link:0})}}export{K as C};
@@ -0,0 +1,35 @@
1
+ var Ee=Object.defineProperty;var Me=(d,i,t)=>i in d?Ee(d,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[i]=t;var m=(d,i,t)=>(Me(d,typeof i!="symbol"?i+"":i,t),t),Te=(d,i,t)=>{if(!i.has(d))throw TypeError("Cannot "+t)};var n=(d,i,t)=>(Te(d,i,"read from private field"),t?t.call(d):i.get(d)),R=(d,i,t)=>{if(i.has(d))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(d):i.set(d,t)},k=(d,i,t,e)=>(Te(d,i,"write to private field"),e?e.call(d,t):i.set(d,t),t);import{Z as xt,_ as q}from"./index-437f4d21.js";import{p as De}from"./stores-63c51a3f.js";import{s as Lt,r as re,l as je,g as me,u as Ue,d as $e,c as se,e as S,j as le,f as Ne,T as jt,Q as de,U as ce,A as Ft,G as We,h as ue,i as Be,O as He,B as Ge}from"./Firebase-c97744dc.js";let Je=1;class qt{constructor(){m(this,"nodeID");this.nodeID=Je++}getID(){return this.nodeID}traverse(i,t){const e=t===void 0?[this]:[...t,this];this.traverseChildren(i,e),i.call(void 0,this,e)}traverseChildren(i,t){this.getChildren().forEach(s=>s.traverse(i,t))}getNodes(){const i=[];return this.traverse(t=>i.push(t)),i}getNodeBefore(i,t){const e=this.getNodes();let s;for(const r of e){if(r===i)return s;t(r)&&(s=r)}}getNodeAfter(i,t){const e=this.getNodes();let s=!1;for(const r of e){if(s&&t(r))return r;r===i&&(s=!0)}}sortRange(i){const t=i.start.node,e=i.end.node;if(t===e)return{start:{node:t,index:Math.min(i.start.index,i.end.index)},end:{node:e,index:Math.max(i.start.index,i.end.index)}};const s=t.getCommonAncestor(this,e);if(s===void 0)return i;let r=s.getNodes().indexOf(t),o=s.getNodes().indexOf(e);if(r<0||o<0)throw Error("Couldn't find caret range node(s) in this tree.");return r===void 0||o===void 0||r<o?i:r===o?{start:{node:i.start.node,index:Math.min(i.start.index,i.end.index)},end:{node:i.end.node,index:Math.max(i.start.index,i.end.index)}}:{start:i.end,end:i.start}}getNode(i){return this.getNodes().find(t=>t.getID()===i)}getIndexOf(i){const t=this.getNodes().indexOf(i);return t>=0?t:void 0}contains(i){let t=!1;return this.traverse(e=>{e===i&&(t=!0)}),t}getParentsOf(i){let t;if(this.traverse((s,r)=>{s===i&&(t=r)}),t===void 0)return;const e=[...t];return e.pop(),e}getParent(i){return i.getParentOf(this)}hasAncestor(i,t){let e=i.getParentOf(this);for(;e;){if(e===t)return!0;e=i.getParentOf(e)}return!1}getClosestParentOfType(i,t){let e=i.getParentOf(this);for(;e;){if(e instanceof t)return e;e=i.getParentOf(e)}}isInside(i,t){return this.getClosestParentMatching(i,e=>e instanceof t)!==void 0}getClosestParentMatching(i,t){let e=i.getParentOf(this);for(;e;){if(t.call(void 0,e))return e;e=i.getParentOf(e)}}getFarthestParentMatching(i,t){const e=this.getAncestors(i).filter(t);return e.length>0?e[e.length-1]:void 0}getAncestors(i){const t=[];let e=i.getParentOf(this);for(;e;)t.push(e),e=i.getParentOf(e);return t}getCommonAncestor(i,t){const e=this.getAncestors(i),s=t.getAncestors(i);for(let r=0;r<e.length;r++)for(let o=0;o<s.length;o++)if(e[r]===s[o])return e[r]}withNodeReplaced(i,t){if(i===this)return t;const e=this.getChildren();for(let s=0;s<e.length;s++){const r=e[s];if(r===i)return this.withChildReplaced(i,t);const o=r.withNodeReplaced(i,t);if(o!==void 0)return this.withChildReplaced(r,o)}}withNodeInserted(i,t){}copyRange(i){const t=this.sortRange(i),e=t.start.node.getCommonAncestor(this,t.end.node);if(e!==void 0)return e.withContentInRange(t)}}var O;const Pt=class extends qt{constructor(t=""){super();R(this,O,void 0);k(this,O,t)}getType(){return"text"}getText(){return n(this,O)}getLength(){return n(this,O).length}getCaretPositionCount(){return n(this,O).length}getParentOf(){}getFirstCaret(){return{node:this,index:0}}getLastCaret(){return{node:this,index:n(this,O).length}}toText(){return n(this,O)}toBookdown(){return n(this,O).replace(/\\/g,"\\\\").replace(/_/g,"\\_").replace(/\*/g,"\\*").replace(/`/g,"\\`").replace(/</g,"\\<").replace(/\^/g,"\\^").replace(/{/g,"\\{").replace(/~/g,"\\~").replace(/ %/g," \\%").replace(/\[/g,"\\[").replace(/@/g,"\\@").replace(/(:)([a-z])/g,"\\:$2")}toHTML(){return n(this,O).replace("<","&lt;").replace(">","&gt;").replace("&","&amp;").replace('"',"&quot;").replace("'","&#39;")}getChildren(){return[]}copy(){return new Pt(n(this,O))}isItalic(t){return this.getAncestors(t).filter(e=>e instanceof p&&e.getFormat()==="_").length>0}isBold(t){return this.getAncestors(t).filter(e=>e instanceof p&&e.getFormat()==="*").length>0}isEmpty(){return this.getLength()===0}getFormat(t){return this.getClosestParentOfType(t,p)}getFormatRoot(t){const e=this.getClosestParentMatching(t,s=>s instanceof T);return e&&e.getMeta()instanceof p?e.getMeta():this.getFarthestParentMatching(t,s=>s instanceof p)}getBlocks(t){return this.getClosestParentOfType(t,Vt)}getNextCaret(t){return t<n(this,O).length?{node:this,index:t+1}:void 0}getPreviousCaret(t){return t>0?{node:this,index:t-1}:void 0}nextWord(t,e){e===void 0&&(e=0);let s=e+1;for(;s<this.getLength()&&n(this,O).charAt(s).match(/\W/);)s++;for(;s<this.getLength()&&n(this,O).charAt(s).match(/\w/);)s++;if(s<this.getLength()||s===this.getLength()&&n(this,O).charAt(s-1).match(/\w/))return{node:this,index:s};const r=this.getFormatRoot(t),o=r?r.getTextNodes():void 0,a=t.getNextTextOrAtom(this),h=a==null?void 0:a.nextWord(t);return o&&a&&this===o[o.length-1]?{node:a,index:0}:h===void 0?{node:this,index:n(this,O).length}:h}previousWord(t,e){e===void 0&&(e=n(this,O).length);let s=e-1;for(;s>0&&n(this,O).charAt(s-1).match(/\W/);)s--;for(;s>0&&n(this,O).charAt(s-1).match(/\w/);)s--;if(s>0||s===0&&n(this,O).charAt(0).match(/\w/))return{node:this,index:s};const r=this.getFormatRoot(t),o=r?r.getTextNodes():void 0,a=t.getPreviousTextOrAtom(this),h=a==null?void 0:a.previousWord(t);return o&&a&&this===o[0]?{node:a,index:a instanceof Pt?a.getLength():0}:h===void 0?{node:this,index:0}:h}withChildReplaced(){}withCharacterAt(t,e){if(!(e<0||e>n(this,O).length))return new Pt(n(this,O).slice(0,e)+t+n(this,O).slice(e))}withoutRange(t){if(t.start.node!==this&&t.end.node!==this)return;const e=Math.max(0,Math.min(t.start.index,t.end.index)),s=Math.min(n(this,O).length,Math.max(t.start.index,t.end.index));return new Pt(n(this,O).substring(0,e)+n(this,O).substring(s))}withContentInRange(t){const e=t.start.node===this,s=t.end.node===this;return new Pt(n(this,O).substring(e?t.start.index:0,s?t.end.index:n(this,O).length))}};let g=Pt;O=new WeakMap;var Rt,ie;class Tt extends qt{constructor(t,e){super();R(this,Rt,void 0);R(this,ie,void 0);k(this,Rt,t),k(this,ie,e)}getMeta(){return n(this,ie)}getText(){return n(this,Rt)}getChildren(){return[n(this,Rt)]}getParentOf(t){return n(this,Rt)===t?this:void 0}withChildReplaced(t,e){if(n(this,Rt)===t&&e!==void 0)return this.withText(e)}withContentInRange(t){const e=n(this,Rt).withContentInRange(t);if(e!==void 0)return this.withText(e)}}Rt=new WeakMap,ie=new WeakMap;var J,B;const $=class extends qt{constructor(t,e){super();R(this,J,void 0);R(this,B,void 0);k(this,J,t),k(this,B,e.filter((s,r,o)=>{if(r===0||!(s instanceof g)||s.getLength()>0)return!0;const a=o[r-1];return!(a instanceof g&&a.getLength()===0)}))}getType(){return"formatted"}getFormat(){return n(this,J)}getSegments(){return n(this,B)}isEmpty(){return n(this,B).length===0}isEmptyText(){return n(this,B).length===1&&n(this,B)[0]instanceof g&&n(this,B)[0].getText()===""}getLength(){return n(this,B).length}getParentOf(t){return n(this,B).map(e=>e===t?this:e.getParentOf(t)).find(e=>e!==void 0)}toText(){return n(this,B).map(t=>t.toText()).join(" ")}toHTML(){const t=n(this,J),e=n(this,B).map(s=>s.toHTML()).join("");return t==="*"?`<strong>${e}</strong>`:t==="_"?`<em>${e}</em>`:t==="^"?`<sup>${e}</sup>`:t==="v"?`<sub>${e}</sub>`:e}toBookdown(){return(n(this,J)==="v"?"^v":n(this,J))+n(this,B).map(t=>t instanceof T?t.toBookdown(this):t.toBookdown()).join("")+(n(this,J)==="v"?"^":n(this,J))}getChildren(){return n(this,B)}getFirstTextNode(){return this.getTextNodes()[0]}getLastTextNode(){const t=this.getTextNodes();return t[t.length-1]}copy(){return new $(n(this,J),n(this,B).map(t=>t.copy()))}getTextNodes(){return this.getNodes().filter(t=>t instanceof g)}getTextAndAtomNodes(){return this.getNodes().filter(t=>t instanceof g||t instanceof T)}getAdjacentTextOrAtom(t,e){const s=this.getTextAndAtomNodes(),r=s.indexOf(t);return r===void 0?void 0:e?r>=0&&r<s.length-1?s[r+1]:void 0:r>0&&r<=s.length?s[r-1]:void 0}getNextTextOrAtom(t){return this.getAdjacentTextOrAtom(t,!0)}getPreviousTextOrAtom(t){return this.getAdjacentTextOrAtom(t,!1)}getAdjacentCaret(t,e){if(!(t.node instanceof g)&&!(t.node instanceof T))return;if(t.node instanceof g){const r=e?t.node.getNextCaret(t.index):t.node.getPreviousCaret(t.index);if(r!==void 0)return r}const s=this.getAdjacentTextOrAtom(t.node,e);if(s!==void 0)return{node:s,index:e?s instanceof g?s.isEmpty()?0:1:0:s instanceof g?s.isEmpty()?0:s.getLength()-1:0}}getFirstCaret(){if(this.getTextNodes().length!==0)return{node:this.getTextNodes()[0],index:0}}getLastCaret(){const t=this.getTextNodes();if(t.length===0)return;const e=t[t.length-1];return{node:e,index:e.getLength()}}getSelection(){const t=this.getFirstTextNode(),e=this.getLastTextNode();return{start:{node:t,index:0},end:{node:e,index:e.getLength()}}}getIndexOfTextNode(t){return this.getTextNodes().indexOf(t)}getSelectedText(t){if(!(t.start.node instanceof g)||!(t.end.node instanceof g))return;const e=this.getIndexOfTextNode(t.start.node),s=this.getIndexOfTextNode(t.end.node);if(!(e===void 0||s===void 0))return this.getTextNodes().map((r,o)=>r===t.start.node?r===t.end.node?r.getText().substring(t.start.index,t.end.index):r.getText().substring(t.start.index):o>e&&o<s?r.getText():r===t.end.node?r.getText().substring(0,t.end.index):"").join("")}withTextIfEmpty(){return this.isEmpty()?this.withSegmentAppended(new g):this}withSegmentPrepended(t){return new $(n(this,J),[t,...n(this,B)])}withSegmentAppended(t){return new $(n(this,J),[...n(this,B),t])}withSegmentReplaced(t,e){const s=n(this,B).indexOf(t);if(s<0)return;const r=n(this,B).slice();return r[s]=e,new $(n(this,J),r)}withoutSegment(t){const e=n(this,B).indexOf(t);if(e<0)return;const s=n(this,B).slice();return s.splice(e,1),new $(n(this,J),s)}withChildReplaced(t,e){return e===void 0?this.withoutSegment(t):this.withSegmentReplaced(t,e)}split(t){if(!(t.node instanceof g)||!this.contains(t.node))return;const e=this.getFirstCaret(),s=this.getLastCaret();if(e===void 0||s===void 0)return;const r=this.withoutRange({start:t,end:s}),o=this.withoutRange({start:e,end:t});if(r!==void 0&&o!==void 0)return[r,o]}withoutRange(t){return this.withFormat(t,void 0)}withFormat(t,e){if(!(t.start.node instanceof g||t.start.node instanceof T)||!(t.end.node instanceof g||t.end.node instanceof T)||!(this.contains(t.start.node)&&this.contains(t.end.node)))return;const s=this.sortRange(t),r=_(this,s.start),o=_(this,s.end);if(r===void 0||o===void 0)return;let a=r===o;const h=this.getNodes().filter(y=>!(y instanceof $));let c=0,u=!1,l=!1,f=0,b=0;e===void 0?l=!0:(h.forEach(y=>{const bt=this.getParentOf(y);if(y instanceof g&&bt instanceof $){if(!u)if(y.getText().length===0)c===r&&a&&(u=!0,l=bt.getFormats(this).includes(e));else{const It=bt.getFormats(this).includes(e),it=r>c&&r<c+y.getCaretPositionCount()-1||o>c&&o<c+y.getCaretPositionCount()-1,Ut=r>=c&&o<=c+y.getCaretPositionCount();c+=y.getCaretPositionCount(),(Ut||it)&&(f++,It&&b++)}}else return!0}),f>0&&b===f&&(l=!0));let x=[{format:"",segments:[]}],v=0,I="",et=!1,ft;function vt(){I.length>0&&(x[0].segments.push(new g(I)),I="")}function At(){return r!==void 0&&o!==void 0&&v>=r&&v<o}function St(){return x.map(y=>y.format).filter(y=>y!=="")}function G(){const y=x[0];x.shift(),(y.segments.length>0||a&&v===r)&&x[0].segments.push(new $(y.format,y.segments))}for(h.forEach(y=>{const bt=this.getParentOf(y);if(y instanceof g){const It=y.getClosestParentOfType(this,T);if(It instanceof T&&It.getMeta()!==this&&It.getMeta()instanceof $)v+=y.getCaretPositionCount();else if(bt instanceof $)if(y.getText().length===0)v===r&&a&&(et=!0,v++);else for(let it=0;it<=y.getText().length;it++){let Ut=y.getFormat(this),Ot=Ut?Ut.getFormats(this):[];e!==void 0&&(v===r&&a||At())&&(e===""?Ot=[]:!l&&!Ot.includes(e)?Ot.push(e):l&&Ot.includes(e)&&Ot.splice(Ot.indexOf(e),1)),St().forEach($t=>{if(!Ot.includes($t)){for(vt();x[0].format!==$t;)G();G(),!et&&v===r&&a&&(ft=new g,x[0].segments.push(ft),x.unshift({format:$t,segments:[]}))}}),Ot.forEach($t=>{St().includes($t)||(vt(),x.unshift({format:$t,segments:[]}),!et&&v===r&&a&&(ft=new g,x[0].segments.push(ft),G()))}),it<y.getLength()&&((e!==void 0||!At())&&(I+=y.getText().charAt(it)),v++)}else if(bt instanceof Tt){vt();for(let it=0;it<y.getText().length;it++)(e!==void 0||!At())&&(I+=y.getText().charAt(it)),v++;I.length>0&&(x[0].segments.push(bt.withText(new g(I))),I="")}}else if(y instanceof T){if(vt(),e!==void 0||v<r||v>o){let It=y;const it=y.getMeta();if(it instanceof $&&it.contains(t.start.node)&&it.contains(t.end.node)){const Ut=it.withFormat(t,e);It=y.withMeta(Ut)}x[0].segments.push(It!==void 0?It:y)}v++}}),vt();x.length>1;)G();let V=new $(x[0].format,x[0].segments);return V.getTextAndAtomNodes().length===0?V=new $("",[new g]):(n(V,B)[0]instanceof T&&(V=V.withSegmentPrepended(new g)),n(V,B)[V.getLength()-1]instanceof T&&(V=V.withSegmentAppended(new g))),V}withRangeFormatted(t,e){const s=ze(this,t);if(s===void 0)return;const r=this.withFormat(t,e);if(r===void 0)return;const o=rt(r,s.start),a=e===void 0?o:rt(r,s.end);if(!(o===void 0||a===void 0))return{root:r,range:{start:o,end:a}}}getFormats(t){let e=this;const s=[];for(;e instanceof $;)n(e,J)!==""&&s.push(n(e,J)),e=e.getParent(t);return s}withSegmentAt(t,e){if(!(e.node instanceof g))return;const s=n(this,B).indexOf(e.node);if(s<0)return;const r=new g(e.node.getText().substring(0,e.index)),o=new g(e.node.getText().substring(e.index)),a=n(this,B).slice();return a.splice(s,1,r,t,o),new $(n(this,J),a)}withSegmentAtSelection(t,e){let s=this.getSelectedText(t),r=this;const o=this.sortRange(t);let a=o.start;if(o.start.node!==o.end.node||o.start.index!==o.end.index){const l=_(this,o.start);if(l===void 0||(r=this.withoutRange(o),r===void 0))return;const f=rt(r,l);if(f===void 0)return;a=f}const h=e.call(void 0,s||""),c=r.withSegmentAt(h,a);if(c===void 0)return;const u=h instanceof T?h.getDefaultCaret():h instanceof $?h.getFirstCaret():h instanceof Tt?{node:h.getText(),index:0}:h instanceof g?{node:h,index:0}:void 0;if(u!==void 0)return{root:c,range:{start:u,end:u}}}withoutContentBefore(t){return this.withContentAt(t,!1)}withoutContentAfter(t){return this.withContentAt(t,!0)}withContentAt(t,e){let s;if(e){const r=this.getLastCaret();if(r===void 0)return;s={start:t,end:r}}else{const r=this.getFirstCaret();if(r===void 0)return;s={start:r,end:t}}return this.withoutRange(s)}withContentInRange(t){const e=this.contains(t.start.node),s=this.contains(t.end.node);if(!e&&!s)return this.copy();const r=e?t.start:this.getFirstCaret(),o=s?t.end:this.getLastCaret();if(r===void 0||o===void 0)return;const a=_(this,r),h=_(this,o);if(a===void 0||h===void 0)return;const c=this.withoutContentBefore(r);if(c===void 0)return;const u=rt(c,h-a);if(u!==void 0)return c.withoutContentAfter(u)}withSegmentsAppended(t){return new $(n(this,J),[...n(this,B),...t.getSegments()])}withoutAdjacentContent(t,e){return this.withoutCharacter(t,e)}withoutCharacter(t,e){if(!this.contains(t.node))return;const s=this.getAdjacentCaret(t,e);if(s!==void 0)if(t.node instanceof T){const r=this.withNodeReplaced(t.node,void 0);return r===void 0?void 0:{root:r,range:{start:s,end:s}}}else if(s.node instanceof T){const r=this.withNodeReplaced(s.node,void 0);return r===void 0?void 0:{root:r,range:{start:t,end:t}}}else{const r=_(this,e?t:s);if(r===void 0)return;const o=this.withoutRange({start:t,end:s});if(o===void 0)return;const a=rt(o,r);return a===void 0?void 0:{root:o,range:{start:a,end:a}}}}withNodeInserted(t,e){if(n(this,B).indexOf(t.node)<0||!(e instanceof $||e instanceof g||e instanceof Tt||e instanceof T))return;const r=this.withSegmentAt(e,t),o=e instanceof T?e.getDefaultCaret():e instanceof $?e.getLastCaret():e instanceof Tt?{node:e.getText(),index:e.getText().getLength()}:{node:e,index:e.getLength()};if(!(r===void 0||o===void 0))return{root:r,range:{start:o,end:o}}}};let p=$;J=new WeakMap,B=new WeakMap;var Et;class T extends qt{constructor(t){super();R(this,Et,void 0);k(this,Et,t)}getMeta(){return n(this,Et)}getChildren(){return n(this,Et)instanceof qt?[n(this,Et)]:[]}nextWord(t){const e=t.getNextTextOrAtom(this);return e?{node:e,index:0}:{node:this,index:0}}previousWord(t){const e=t.getPreviousTextOrAtom(this);return e?{node:e,index:e instanceof g?e.getLength():0}:{node:this,index:0}}getFormatRoot(t){return this.getFarthestParentMatching(t,e=>e instanceof p)}getCaretPositionCount(){return 1}}Et=new WeakMap;function Fe(d){return d.getNodes().filter(i=>i instanceof g||i instanceof T)}function Se(d){const i=[];return d.traverse((t,e)=>{t instanceof p&&e.length>0&&!(e[e.length-1]instanceof p)&&i.push(t)}),i}function _(d,i){let t=Se(d);t.length===0&&(t=[d]);let e=0;for(let s=0;s<t.length;s++){const r=Fe(t[s]);for(let o=0;o<r.length;o++){const a=r[o];if(a!==i.node)e+=a.getCaretPositionCount();else return e+i.index}e++}}function rt(d,i){let t=Se(d);t.length===0&&(t=[d]);let e=0;for(let s=0;s<t.length;s++){const r=Fe(t[s]);for(let o=0;o<r.length;o++){const a=r[o];if(i>=e&&i<=e+a.getCaretPositionCount()){if(o<r.length-1){const h=r[o+1];if(h instanceof g&&h.getLength()===0)return{node:h,index:0}}return{node:a,index:i-e}}e+=a.getCaretPositionCount()}e++}}function ze(d,i){const t=_(d,i.start),e=_(d,i.end);if(!(t===void 0||e===void 0))return{start:t,end:e}}function pi(d,i){const t=rt(d,i.start),e=rt(d,i.end);if(!(t===void 0||e===void 0))return{start:t,end:e}}class tt extends qt{isEmpty(){return this.getFormats().every(i=>i.isEmptyText())}getTextNodes(){return this.getNodes().filter(i=>i instanceof g)}getFirstCaret(){return this.getFormats()[0].getFirstCaret()}getLastCaret(){const i=this.getFormats();return i.length===0?void 0:i[i.length-1].getLastCaret()}getAdjacentCaret(i,t){const e=t?this.getFormats():this.getFormats().reverse();for(let s=0;s<e.length;s++){const r=e[s];if(r.contains(i.node)){const o=r.getAdjacentCaret(i,t);return o===void 0?s<e.length-1?t?e[s+1].getFirstCaret():e[s+1].getLastCaret():void 0:o}}}getNextTextOrAtom(i){var t;return(t=this.getAdjacentCaret({node:i,index:i instanceof g?i.getLength():0},!0))==null?void 0:t.node}getPreviousTextOrAtom(i){var t;return(t=this.getAdjacentCaret({node:i,index:0},!0))==null?void 0:t.node}withSegmentAtSelection(i,t){let e=this,s=i.start;if(!(s.node instanceof g))return;const r=s.node.getClosestParentOfType(e,p);if(r===void 0)return;const o=r.withSegmentAtSelection(i,t);if(o===void 0||!(o.root instanceof p))return;const a=e.withNodeReplaced(r,o.root);if(a!==void 0)return{root:a,range:o.range}}withoutAdjacentContent(i,t){const e=t?this.getFormats():this.getFormats().reverse();let s,r;for(;e.length>0;){const o=e.shift();if(o){const a=o.withoutAdjacentContent(i,t);if(a){s=o,r=a;break}}}if(r&&s){const o=this.withChildReplaced(s,r.root);if(o)return{root:o,range:r.range}}}withRangeFormatted(i,t){const e=this.sortRange(i),s=this.getFormats();let r=this,o=!1;const a=_(this,e.start),h=_(this,e.end);if(!(a===void 0||h===void 0)){for(let c=0;c<s.length;c++){const u=s[c],l=u.contains(e.start.node),f=u.contains(e.end.node);if((l||f)&&(o=!0),o){const b=l?e.start:u.getFirstCaret(),x=f?e.end:u.getLastCaret();if(b&&x){const v=u.withRangeFormatted({start:b,end:x},t);if(v===void 0)return;const I=v.root,et=I.isEmptyText()&&!l&&!f;if(r=r.withNodeReplaced(u,et?void 0:I),r===void 0)return}}f&&(o=!1)}if(r){const c=rt(r,a),u=t===void 0?c:rt(r,h);return c===void 0||u===void 0?void 0:{root:r,range:{start:c,end:u}}}}}}var K,w;const A=class extends tt{constructor(t,e){super();R(this,K,void 0);R(this,w,void 0);k(this,K,e);let s=t.map(r=>r instanceof p?r.withTextIfEmpty():r).filter(r=>!r.isEmpty());k(this,w,s)}getType(){return"list"}isNumbered(){return n(this,K)}isEmpty(){return n(this,w).length===0||n(this,w).every(t=>t instanceof A&&t.isEmpty())}getItems(){return n(this,w)}getChildren(){return n(this,w)}getListItems(){return n(this,w).filter(t=>t instanceof A)}getLength(){return n(this,w).length}getLastItem(){return this.getFirstLastItem(!1)}getFirstItem(){return this.getFirstLastItem(!0)}getFormats(){return n(this,w).reduce((t,e)=>t.concat(e instanceof p?[e]:e.getFormats()),[])}getFirstLastItem(t){if(n(this,w).length===0)return;const e=n(this,w)[t?0:this.getLength()-1];return e instanceof p?e:e.getFirstLastItem(t)}getLevel(t){const e=t.getParentOf(this);return e instanceof A?e.getLevel(t)+1:1}toText(){return n(this,w).map(t=>t.toText()).join(" ")}toBookdown(t=1){return this.isNumbered()?n(this,w).map((e,s)=>(e instanceof A?"":s+1+".".repeat(t)+" ")+e.toBookdown(t+1)).join(`
2
+ `):n(this,w).map(e=>(e instanceof A?"":"*".repeat(t)+" ")+e.toBookdown(t+1)).join(`
3
+ `)}toHTML(){return this.isNumbered()?`<ol>${n(this,w).map(t=>`<li>${t.toHTML()}</li>`).join("")}</ol>`:`<ul>${n(this,w).map(t=>`<li>${t.toHTML()}</li>`).join("")}</ul>`}getParentOf(t){return n(this,w).map(e=>e===t?this:e.getParentOf(t)).find(e=>e!==void 0)}atBeginningOfItem(t,e){const s=e.node.getFarthestParentMatching(t,r=>r instanceof p);return s!==void 0&&e.node.hasAncestor(t,this)&&e.index===0&&s.getTextNodes()[0]===e.node}getItemContaining(t){const e=n(this,w).find(r=>r.getParentOf(t.node)!==void 0);if(e===void 0)return;const s=n(this,w).indexOf(e);if(s!==void 0)return s}getItem(t){if(!(t<0||t>=n(this,w).length))return n(this,w)[t]}getFirstCaret(){return n(this,w).length===0?void 0:n(this,w)[0].getFirstCaret()}copy(){return new A(n(this,w).map(t=>t.copy()),n(this,K))}withStyle(t){return new A(n(this,w),t)}withItemAppended(t){return new A([...n(this,w),t],n(this,K))}withItemPrepended(t){return new A([t,...n(this,w)],n(this,K))}withItemAt(t,e){if(e<0||e>n(this,w).length)return;const s=n(this,w).slice();return s.splice(e,0,t),new A(s,n(this,K))}withItemAfter(t,e){const s=n(this,w).indexOf(e);if(!(s<0))return this.withItemAt(t,s+1)}withItemBefore(t,e){const s=n(this,w).indexOf(e);if(!(s<0))return this.withItemAt(t,s)}withItemReplaced(t,e){if(t<0||t>=n(this,w).length)return;const s=n(this,w).slice();return s[t]=e,new A(s,n(this,K))}withoutItemAt(t){if(t<0||t>=n(this,w).length)return;const e=n(this,w).slice();return e.splice(t,1),new A(e,n(this,K))}withoutItem(t){const e=n(this,w).indexOf(t);if(!(e<0))return this.withoutItemAt(e)}withListAppended(t){return new A([...n(this,w),...n(t,w)],n(this,K))}withItemMergedBackwards(t){var r,o;if(t<=0||t>=n(this,w).length)return;const e=n(this,w)[t];let s=n(this,w)[t-1];if(e instanceof A){if(s instanceof A)return;const a=e.getFirstItem();if(a===void 0)return;const h=e.withChildReplaced(a,void 0);if(h===void 0)return;const c=this.withChildReplaced(e,h);if(c===void 0)return;const u=s.getLastCaret();if(u===void 0)return;const l=_(s,u);if(l===void 0)return;const f=s.withSegmentsAppended(a),b=c.withChildReplaced(s,f);if(b===void 0)return;const x=rt(f,l);return x===void 0?void 0:[b,x]}else if(s instanceof A){const a=s.getLastItem();if(a===void 0)return;const h=a.getLastCaret();if(h===void 0)return;const c=_(a,h);if(c===void 0)return;const u=a.withSegmentsAppended(e),l=s.withChildReplaced(a,u);if(l===void 0)return;const f=(r=this.withChildReplaced(s,l))==null?void 0:r.withoutItemAt(t);if(f===void 0)return;const b=rt(u,c);return b===void 0?void 0:[f,b]}else{const a=s.getLastCaret();if(a===void 0)return;const h=_(s,a);if(h===void 0)return;const c=s.withSegmentsAppended(e),u=(o=this.withItemReplaced(t-1,c))==null?void 0:o.withoutItemAt(t);if(u===void 0)return;const l=rt(c,h);return l===void 0?void 0:[u,l]}}withItemSplit(t){var a,h;const e=n(this,w).find(c=>c instanceof p&&c.contains(t.node));if(e===void 0)return;const s=e.split(t);if(s===void 0)return;const[r,o]=s;return(h=(a=this.withItemAfter(o,e))==null?void 0:a.withItemAfter(r,e))==null?void 0:h.withoutItem(e)}withItemIndented(t){var e,s;for(let r=0;r<n(this,w).length;r++){const o=n(this,w)[r];if(o===t){const a=n(this,w)[r-1],h=n(this,w)[r+1];return a instanceof A?(e=this.withItemReplaced(r-1,a.withItemAppended(t)))==null?void 0:e.withoutItemAt(r):h instanceof A?(s=this.withItemReplaced(r+1,h.withItemPrepended(t)))==null?void 0:s.withoutItemAt(r):this.withItemReplaced(r,new A([t],n(this,K)))}else if(o instanceof A){const a=o.withItemIndented(t);if(a!==void 0)return this.withItemReplaced(r,a)}}}withItemUnindented(t){for(let e=0;e<n(this,w).length;e++){const s=n(this,w)[e];if(s instanceof A){const r=n(s,w).indexOf(t);if(r>=0){const o=new A(n(s,w).slice(0,r),n(this,K)),a=new A(n(s,w).slice(r+1),n(this,K));let h=n(this,w).slice(0,e);return o.getLength()>0&&h.push(o),h.push(t),a.getLength()>0&&h.push(a),h=h.concat(n(this,w).slice(e+1)),new A(h,n(this,K))}else{const o=s.withItemUnindented(t);if(o!==void 0)return this.withItemReplaced(e,o)}}}}withChildReplaced(t,e){const s=n(this,w).indexOf(t);if(!(s<0))return new A(e===void 0?[...n(this,w).slice(0,s),...n(this,w).slice(s+1)]:[...n(this,w).slice(0,s),e,...n(this,w).slice(s+1)],n(this,K))}withContentInRange(t){const e=this.contains(t.start.node),s=this.contains(t.end.node);if(!e&&!s)return this.copy();const r=[];let o=!1,a=!1;for(let h=0;h<n(this,w).length;h++){if(n(this,w)[h].contains(t.start.node)&&(o=!0),(e&&o||!e)&&(s&&!a||!s)){const c=n(this,w)[h].withContentInRange(t);if(c===void 0)return;r.push(c)}n(this,w)[h].contains(t.end.node)&&(a=!0)}return new A(r,n(this,K))}withNodeInserted(t,e){var c;if(!this.contains(t.node)||!(e instanceof A))return;const s=n(this,w).find(u=>u.contains(t.node));if(s===void 0)return;const r=e.getItems();let o=s,a=this;for(;r.length>0;){let u=r.shift();if(u===void 0)return;if(o===s){const l=s.withNodeInserted(t,u);if(l===void 0||!(l.root instanceof p))return;u=l.root,a=a.withChildReplaced(s,u)}else a=a.withItemAfter(u,o);if(a===void 0)return;o=u}const h=o instanceof p?o.getLastCaret():(c=o.getLastItem())==null?void 0:c.getLastCaret();if(h!==void 0)return{root:a,range:{start:h,end:h}}}withRangeFormatted(t,e){const s=this.sortRange(t),r=this.getItemContaining(s.start),o=this.getItemContaining(s.end),a=super.withRangeFormatted(s,e);if(a&&e===void 0&&r!==void 0&&o!==void 0&&r!==o){const h=a.root,c=o-(n(this,w).length-n(h,w).length);if(c>0&&h.getLength()>1){const u=h.withItemMergedBackwards(c);return u===void 0?void 0:{root:u[0],range:{start:u[1],end:u[1]}}}}return a}};let Y=A;K=new WeakMap,w=new WeakMap;var E,z;const ht=class extends tt{constructor(t=0,e){super();R(this,E,void 0);R(this,z,void 0);let s=e??new p("",[new g]);if(s.getLength()>0){const r=s.getSegments()[0],o=s.getSegments()[s.getLength()-1];(r instanceof T||r instanceof Tt)&&(s=s.withSegmentPrepended(new g)),(o instanceof T||o instanceof Tt)&&(s=s.withSegmentAppended(new g))}s=s.withTextIfEmpty(),k(this,E,s),k(this,z,t)}getType(){return"paragraph"}getLevel(){return n(this,z)}getFormat(){return n(this,E)}getFormats(){return[n(this,E)]}getChildren(){return[n(this,E)]}getFirstTextNode(){return this.getFormat().getFirstTextNode()}getLastTextNode(){return this.getFormat().getLastTextNode()}getTextNodes(){return this.getNodes().filter(t=>t instanceof g)}getFirstCaret(){return n(this,E).getFirstCaret()}getLastCaret(){return n(this,E).getLastCaret()}getSelection(){const t=this.getFirstTextNode(),e=this.getLastTextNode();return{start:{node:t,index:0},end:{node:e,index:e.getLength()}}}getParentOf(t){return t===n(this,E)?this:n(this,E).getParentOf(t)}toText(){return n(this,E).toText()}toBookdown(){return(n(this,z)===1?"# ":n(this,z)===2?"## ":n(this,z)===3?"### ":"")+n(this,E).toBookdown()}toHTML(){const t=n(this,z)===1?"h1":n(this,z)===2||n(this,z)===3?"h2":"p";return`<${t}>${n(this,E).toHTML()}</${t}>`}withLevel(t){return new ht(t,n(this,E))}withContent(t){return new ht(n(this,z),t)}withParagraphAppended(t){return new ht(n(this,z),new p("",[...n(this,E).getSegments(),...n(t,E).getSegments()]))}withParagraphPrepended(t){return new ht(n(this,z),new p("",[...n(t,E).getSegments(),...n(this,E).getSegments()]))}split(t){if(!(t.node instanceof g)||this.getParentOf(t.node)===void 0)return;const e=this.getLastTextNode();if(t.node===e&&t.index===e.getLength())return[this.copy(),new ht];const s=this.getFirstTextNode();if(t.node===s&&t.index===0)return[new ht,this.copy()];const r=n(this,E).withoutContentAfter(t),o=n(this,E).withoutContentBefore(t);if(!(o===void 0||r===void 0))return[new ht(n(this,z),r),new ht(n(this,z),o)]}copy(){return new ht(n(this,z),n(this,E).copy())}withChildReplaced(t,e){return t===n(this,E)&&(e instanceof p||e===void 0)?new ht(n(this,z),e):void 0}withContentInRange(t){const e=n(this,E).withContentInRange(t);if(e!==void 0)return new ht(n(this,z),e)}};let W=ht;E=new WeakMap,z=new WeakMap;var L,Q,at,ot,zt;const yt=class extends tt{constructor(t,e,s,r){super();R(this,L,void 0);R(this,Q,void 0);R(this,at,void 0);R(this,ot,void 0);R(this,zt,void 0);const o=e.charAt(e.length-1)==="!";k(this,L,t),k(this,at,s),k(this,ot,o?e.slice(0,-1):e),k(this,zt,o),k(this,Q,r===void 0?new p("",[new g]):r.withTextIfEmpty())}getType(){return"code"}getCodeNode(){return n(this,L)}getCode(){return n(this,L).getText()}getCaption(){return n(this,Q)}getPosition(){return n(this,at)}getLanguage(){return n(this,ot)}isExecutable(){return n(this,zt)}getFormats(){return[n(this,Q)]}toText(){return""}toHTML(){return`<pre><code>${n(this,L).toHTML()}</code><pre><center>${n(this,Q).toHTML()}</center>`}toBookdown(){return"`"+(n(this,ot)!=="plaintext"?n(this,ot):"")+(n(this,zt)?"!":"")+`
4
+ `+n(this,L).getText().replace(/`/g,"\\`")+"\n`"+(n(this,at)!=="|"?n(this,at):"")+n(this,Q).toBookdown()}getChildren(){return[n(this,L),n(this,Q)]}copy(){return new yt(n(this,L).copy(),n(this,ot),n(this,at),n(this,Q).copy())}getParentOf(t){return t==n(this,L)||t===n(this,Q)?this:n(this,Q).getParentOf(t)}withChildReplaced(t,e){const s=t===n(this,L)&&e instanceof g?e:void 0,r=t===n(this,Q)&&(e instanceof p||e===void 0)?e:void 0;return s||r?new yt(s||n(this,L),n(this,ot),n(this,at),r||n(this,Q)):void 0}withPosition(t){return new yt(n(this,L),n(this,ot),t,n(this,Q))}withLanguage(t){return new yt(n(this,L),t,n(this,at),n(this,Q))}withExecutable(t){return new yt(n(this,L),t?n(this,ot)+"!":n(this,ot),n(this,at),n(this,Q))}withCaption(t){return new yt(n(this,L),n(this,ot),n(this,at),t)}withContentInRange(t){if(!this.contains(t.start.node)&&!this.contains(t.end.node))return this.copy();const e=n(this,Q).contains(t.start.node)?new g:n(this,L).withContentInRange(t),s=t.end.node===n(this,L)?new p("",[new g]):n(this,Q).withContentInRange(t);if(!(e===void 0||s===void 0))return new yt(e,n(this,ot),n(this,at),s)}withRangeFormatted(t,e){let s=this,r=super.withRangeFormatted(t,e);if(e!==void 0)return r;r&&(s=r.root);const o=this.sortRange(t),a=o.start.node===n(this,L),h=o.end.node===n(this,L);if(a){const c=n(this,L).withoutRange({start:{node:n(this,L),index:o.start.index},end:{node:n(this,L),index:h?o.end.index:n(this,L).getLength()}});if(c===void 0||(s=s.withChildReplaced(n(this,L),c),s===void 0))return;const u={node:c,index:o.start.index};return{root:s,range:{start:u,end:u}}}else return r}withNodeInserted(t,e){if(t.node!==n(this,L))return;const s=e.getNodes().filter(h=>h instanceof g).map(h=>h.getText()).join(""),r=n(this,L).withCharacterAt(s,t.index);if(r===void 0)return;const o=this.withChildReplaced(n(this,L),r);if(o===void 0)return;const a={node:r,index:t.index+s.length};return{root:o,range:{start:a,end:a}}}};let Ht=yt;L=new WeakMap,Q=new WeakMap,at=new WeakMap,ot=new WeakMap,zt=new WeakMap;const Zt="*";var M,st,P,j,dt;const gt=class extends tt{constructor(t,e,s,r,o="|"){super();R(this,M,void 0);R(this,st,void 0);R(this,P,void 0);R(this,j,void 0);R(this,dt,void 0);k(this,M,t),k(this,st,e),k(this,P,s===void 0?new p("",[new g]):s.withTextIfEmpty()),k(this,j,r==null?new p("",[new g]):r.withTextIfEmpty()),k(this,dt,o)}getType(){return"embed"}isVideo(){return n(this,M).includes("https://www.youtube.com")||n(this,M).includes("https://youtu.be")||n(this,M).includes("https://www.tiktok.com")||n(this,M).includes("vimeo.com")}getURL(){return n(this,M).split(Zt)[0]}getSmallURL(){return this.isLocal()?"images/small/"+this.getURL():this.hasSmallURL()?n(this,M).split(Zt)[1]:this.getURL()}hasSmallURL(){return n(this,M).split(Zt).length>1&&n(this,M).split(Zt)[1].trim().length>0}isHosted(){return n(this,M).includes("bookish")}isLocal(){return n(this,M).length>0&&!n(this,M).startsWith("http")}getDescription(){return n(this,st)}getCaption(){return n(this,P)}getCredit(){return n(this,j)}getPosition(){return n(this,dt)}getFormats(){return[n(this,P),n(this,j)]}getChildren(){return[n(this,P),n(this,j)]}getParentOf(t){if(t===n(this,P)||t===n(this,j))return this;const e=n(this,P).getParentOf(t);if(e)return e;const s=n(this,j).getParentOf(t);if(s)return s}toText(){return n(this,P).toText()}toHTML(){return`<img src="${this.getURL()}" alt="${this.getDescription()}" />`}toBookdown(){return`|${n(this,M)}|${n(this,st)}|${n(this,P).toBookdown()}|${n(this,j).toBookdown()}|`}toJSON(){return{url:n(this,M),alt:n(this,st),caption:n(this,P).toText(),credit:n(this,j).toText()}}copy(){return new gt(n(this,M),n(this,st),n(this,P).copy(),n(this,j).copy(),n(this,dt))}withChildReplaced(t,e){const s=t===n(this,P)&&(e===void 0||e instanceof p)?e:n(this,P),r=t===n(this,j)&&(e===void 0||e instanceof p)?e:n(this,j);return s||r?new gt(n(this,M),n(this,st),s,r,n(this,dt)):void 0}withURL(t){return t.includes("www.youtube.com/watch?v=")&&(t=t.replace("/watch?v=","/embed/")),new gt(t,n(this,st),n(this,P),n(this,j),n(this,dt))}withURLs(t,e){return new gt(t+Zt+e,n(this,st),n(this,P),n(this,j),n(this,dt))}withDescription(t){return new gt(n(this,M),t,n(this,P),n(this,j),n(this,dt))}withCaption(t){return new gt(n(this,M),n(this,st),t,n(this,j),n(this,dt))}withCredit(t){return new gt(n(this,M),n(this,st),n(this,P),t,n(this,dt))}withPosition(t){return new gt(n(this,M),n(this,st),n(this,P),n(this,j),t)}withContentInRange(t){if(!this.contains(t.start.node)&&!this.contains(t.end.node))return this.copy();const e=n(this,j).contains(t.end.node)||n(this,j).contains(t.start.node)?n(this,j).withContentInRange(t):new p("",[new g]),s=n(this,P).contains(t.start.node)||n(this,P).contains(t.end.node)?n(this,P).withContentInRange(t):new p("",[new g]);if(!(s===void 0||e===void 0))return new gt(n(this,M),n(this,st),s,e,n(this,dt))}nextWord(){return n(this,P).getFirstCaret()}previousWord(t){const e=t.getPreviousTextOrAtom(n(this,P).getFirstTextNode());return e?{node:e,index:e instanceof g?e.getLength():0}:{node:this,index:0}}};let Dt=gt;M=new WeakMap,st=new WeakMap,P=new WeakMap,j=new WeakMap,dt=new WeakMap;var F;const Nt=class extends tt{constructor(t){super();R(this,F,void 0);const e=[];for(let s=0;s<t.length;s++){const r=t[s],o=s===0?void 0:t[s-1];r instanceof Y&&o instanceof Y&&r.isNumbered()===o.isNumbered()?e[e.length-1]=o.withListAppended(r):e.push(r)}k(this,F,e),n(this,F).length===0&&n(this,F).push(new W)}getBlocks(){return n(this,F)}getFormats(){return this.getBlocks().reduce((t,e)=>t.concat(e.getFormats()),[])}getIndexOf(t){const e=n(this,F).indexOf(t);return e<0?void 0:e}getBlockBefore(t){const e=n(this,F).indexOf(t);if(!(e<=0))return n(this,F)[e-1]}getBlockAfter(t){const e=n(this,F).indexOf(t);if(!(e<0||e>n(this,F).length-2))return n(this,F)[e+1]}getBlocksBetween(t,e){const s=this.getIndexOf(t),r=this.getIndexOf(e);if(s!==void 0&&r!==void 0){if(s>r){const h=t;t=e,e=h}const o=[];let a=!1;for(let h=0;h<n(this,F).length;h++){let c=n(this,F)[h];if(c===t&&(a=!0),a&&o.push(c),c===e)break}return o}}getBlocksInRange(t){const e=this.getBlockOfCaret(t.start),s=t.end===t.start?e:this.getBlockOfCaret(t.end);if(e===void 0||s===void 0)return;const r=[];let o=!1;return this.getNodes().filter(a=>a instanceof tt).forEach(a=>{a===e&&(o=!0),o&&a instanceof tt&&r.push(a),o&&a===s&&(o=!1)}),r}getBlockOfCaret(t){return t.node.getClosestParentOfType(this,tt)}getParentOf(t){return n(this,F).map(e=>e===t?this:e.getParentOf(t)).find(e=>e!==void 0)}getTextNodes(){return this.getNodes().filter(t=>t instanceof g)}getAtomNodes(){return this.getNodes().filter(t=>t instanceof T)}getTextAndAtomNodes(){return this.getNodes().filter(t=>t instanceof g||t instanceof T)}getIndexOfTextNode(t){return this.getTextNodes().indexOf(t)}getFirstCaret(){const t=this.getTextNodes();return t.length===0?void 0:{node:t[0],index:0}}getLastCaret(){const t=this.getTextNodes();return t.length===0?void 0:{node:t[t.length-1],index:t[t.length-1].getLength()}}getAdjacentCaret(t,e){if(!this.contains(t.node))return;const s=t.node.getFarthestParentMatching(this,u=>u instanceof Ht);if(s&&t.node===s.getCodeNode()){const u=e?t.node.getNextCaret(t.index):t.node.getPreviousCaret(t.index);if(u!==void 0)return u;if(e)return s.getCaption().getFirstCaret();const l=this.getNodes().filter(I=>I instanceof tt),f=l.indexOf(s);if(f<=0)return;const x=l[f-1].getFormats();return x[x.length-1].getLastCaret()}const r=t.node.getFarthestParentMatching(this,u=>u instanceof p);if(r===void 0)return;const o=r.getAdjacentCaret(t,e);if(o!==void 0)return o;const a=this.getNodes().filter(u=>{const l=u.getParent(this);return u instanceof g&&l instanceof Ht||u instanceof p&&!(l instanceof T)&&!(l instanceof p)}),h=a.indexOf(r),c=h<0||a.length===0?void 0:a[h+(e?1:-1)];if(c!==void 0)return e?c.getFirstCaret():c.getLastCaret()}getSelectedFormatRange(t,e){const s=this.getNodes().filter(f=>f instanceof p&&!(this.getParentOf(f)instanceof p)),r=s.indexOf(t);if(r<0)return;const o=s.find(f=>f.contains(e.start.node)),a=s.find(f=>f.contains(e.end.node));if(o===void 0||a===void 0)return;const h=s.indexOf(o),c=s.indexOf(a);if(h<0||c<0||r<h||r>c)return;const u=r===h?e.start:t.getFirstCaret(),l=r===c?e.end:t.getLastCaret();if(!(u===void 0||l===void 0))return{start:u,end:l}}withContentInRange(t){const e=this.contains(t.start.node),s=this.contains(t.end.node);if(!e&&!s)return this.copy();let r=!1,o=!1;const a=[];for(let h=0;h<n(this,F).length;h++){if(n(this,F)[h].contains(t.start.node)&&(r=!0),(e&&r||!e)&&(s&&!o||!s)){const c=n(this,F)[h].withContentInRange(t);if(c===void 0)return;a.push(c)}n(this,F)[h].contains(t.end.node)&&(o=!0)}return this.create(a)}withBlockInserted(t,e,s){const r=n(this,F).indexOf(t);if(r<0)return;const o=n(this,F).slice();return o.splice(r+(s?0:1),0,e),this.create(o)}withBlockAppended(t){let e=n(this,F).slice();return e.push(t),this.create(e)}withoutBlock(t){return this.create(n(this,F).filter(e=>e!==t))}withBlockInsertedBefore(t,e){return this.withBlockInserted(t,e,!0)}withBlockInsertedAfter(t,e){return this.withBlockInserted(t,e,!1)}withSelectionSplit(t){var o,a;let e=t.start,s=this;if(t.start.node!==t.end.node||t.start.index!==t.end.index){const h=s.withoutRange(t);if(h===void 0||!(h.root instanceof Nt))return;s=h.root,e=h.range.start}const r=e.node.getClosestParentOfType(s,tt);if(r!==void 0)if(r instanceof W){const h=r,c=h.split(e);if(c===void 0)return;const[u,l]=c,f=l.getFirstCaret();if(f===void 0)return;const b=h.getParent(s);if(!(b instanceof Nt))return;const x=(a=(o=b.withBlockInsertedBefore(h,u))==null?void 0:o.withBlockInsertedAfter(h,l))==null?void 0:a.withoutBlock(h);if(x===void 0)return;const v=s.withNodeReplaced(b,x);return v===void 0?void 0:{root:v,range:{start:f,end:f}}}else{const h=r.getParent(s);if(!(h instanceof Nt))return;const c=new W,u=c.getFirstCaret();if(u===void 0)return;const l=h.withBlockInsertedAfter(r,c);if(l===void 0)return;const f=s.withNodeReplaced(h,l);return f===void 0?void 0:{root:f,range:{start:u,end:u}}}}withoutRange(t){return this.withRangeFormatted(t,void 0)}withoutAtom(t){const e=t.getFarthestParentMatching(this,u=>u instanceof p);if(e===void 0)return;const s=e.getPreviousTextOrAtom(t),r=e.getNextTextOrAtom(t),o=new g,a=s===void 0&&r==null?e.withSegmentReplaced(t,o):e.withoutSegment(t),h={node:s||r||o,index:s&&s instanceof g?s.getLength():0};if(a===void 0)return;const c=this.withNodeReplaced(e,a);if(c!==void 0)return{root:c,range:{start:h,end:h}}}withRangeFormatted(t,e){var b,x;if(!(t.start.node instanceof g||t.start.node instanceof T)||!(t.end.node instanceof g||t.end.node instanceof T))return;if(e===void 0&&t.start.node instanceof T&&t.end.node instanceof T&&t.start.node===t.end.node)return this.withoutAtom(t.start.node);let s=t;if(e===""&&t.start.node===t.end.node&&t.start.index===t.end.index){const v=(b=t.start.node.getFormatRoot(this))==null?void 0:b.getSelection();if(v===void 0)return;s=v}const r=this.sortRange(s),o=_(this,r.start),a=_(this,r.end);if(o===void 0||a===void 0)return;let h=this,c=[],u=!1;for(let v=0;v<n(this,F).length;v++){const I=n(this,F)[v],et=I.contains(r.start.node),ft=I.contains(r.end.node);if(et||ft||u){u=!0;const vt=et?r.start:I.getFirstCaret(),At=ft?r.end:I.getLastCaret();if(vt===void 0||At===void 0)return;if(!et&&!ft&&e===void 0){if(h=h.withChildReplaced(I,void 0),h===void 0)return}else{const St=I.withRangeFormatted({start:vt,end:At},e);if(St===void 0)return;let G=St.root;if(!G.isEmpty()&&G instanceof Y&&!et&&ft){const V=G.getItem(0);if(V instanceof p){const y=G.withoutItem(V);if(y===void 0)return;G=y;const bt=(x=h.withChildReplaced(I,G))==null?void 0:x.withBlockInsertedBefore(G,new W(0,V));if(bt===void 0)return;h=bt}}else G.isEmpty()||c.push(G),h=h.withChildReplaced(I,G.isEmpty()?void 0:G);if(h===void 0)return}}I.contains(r.end.node)&&(u=!1)}if(e===void 0&&c.length>=2){const v=c[0],I=c[c.length-1];if(v instanceof W&&I instanceof W&&(h=h.withNodeReplaced(v,v.withContent(v.getFormat().withSegmentsAppended(I.getFormat()))),h===void 0||(h=h.withNodeReplaced(I,void 0),h===void 0)))return}const l=rt(h,o),f=e===void 0?l:rt(h,a);if(!(l===void 0||f===void 0))return{root:h,range:{start:l,end:f}}}withSegmentAtSelection(t,e){let s=this,r=t.start;if(!(r.node instanceof g))return;const o=r.node.getClosestParentOfType(s,p);if(o===void 0)return;const a=o.withSegmentAtSelection(t,e);if(a===void 0||!(a.root instanceof p))return;const h=s.withNodeReplaced(o,a.root);if(h!==void 0)return{root:h,range:a.range}}withParagraphsAsLists(t,e){const s=this.sortRange(t),r=this.getBlocksInRange(s);if(r===void 0||!r.every(c=>c instanceof W))return;const o=[[]];let a;r.forEach(c=>{a===void 0||c.getParent(this)===a.getParent(this)?o[o.length-1].push(c):o.push([c]),a=c});let h=this;for(let c=0;c<o.length;c++){const u=o[c],l=new Y(u.map(v=>v.getFormat()),e),f=u[0].getParent(h);if(f===void 0)return;let b=f.withBlockInsertedBefore(u[0],l);for(let v=0;v<u.length;v++)if(b=b==null?void 0:b.withoutBlock(u[v]),b===void 0)return;const x=h.withNodeReplaced(f,b);if(x===void 0||!(x instanceof Nt))return;h=x}return h}withListsAsParagraphs(t){let e=this;const s=this.sortRange(t),r=this.getBlocksInRange(s);if(r===void 0)return;const o=r.filter(h=>h instanceof Y),a=[...new Set(o.map(h=>h.getParent(this)instanceof Y?h.getFarthestParentMatching(this,c=>c instanceof Y):h).filter(h=>h!==void 0))];if(a.length!==0){for(let h=0;h<a.length;h++){const c=a[h],u=c.getNodes().filter(f=>f instanceof p).map(f=>new W(0,f));for(let f=u.length-1;f>=0;f--){const b=u[f],x=e.withBlockInsertedAfter(c,b);if(x===void 0)return;e=x}const l=e.withoutBlock(c);if(l===void 0)return;e=l}return e}}withListsIndented(t,e){let s=this;const r=t.start.node.getCommonAncestor(s,t.end.node),o=r==null?void 0:r.getNodes(),a=o==null?void 0:o.filter(b=>b instanceof p&&s.getParentOf(b)instanceof Y),h=o==null?void 0:o.indexOf(t.start.node),c=o==null?void 0:o.indexOf(t.end.node);if(a===void 0||h===void 0||c===void 0)return;const u=h<c?t.start.node:t.end.node,l=h<c?t.end.node:t.start.node;let f=!1;for(let b=0;b<a.length;b++){const x=a[b];if(u.hasAncestor(s,x)&&(f=!0),f){const v=x.getFarthestParentMatching(s,I=>I instanceof Y);if(v instanceof Y){const I=e?v.withItemIndented(x):v.withItemUnindented(x);if(I===void 0)return;const et=s.withChildReplaced(v,I);if(et===void 0)return;s=et}}l.hasAncestor(s,x)&&(f=!1)}return s}withListAsStyle(t,e){return this.withNodeReplaced(t,t.withStyle(e))}withoutAdjacentContent(t,e){var r,o,a;if(!this.contains(t.node))return;const s=this.getParentsOf(t.node);for(;s&&s.length>0;){const h=s.pop();if(h instanceof p){const c=h.withoutCharacter(t,e);if(c!==void 0){const u=this.withNodeReplaced(h,c.root);return u===void 0?void 0:{root:u,range:c.range}}}else if(h instanceof Ht){const c=h.getCodeNode().withoutRange({start:t,end:{node:t.node,index:t.index+(e?1:-1)}});if(c===void 0)return;const u=h.withChildReplaced(h.getCodeNode(),c);if(u===void 0)return;const l=this.withNodeReplaced(h,u),f={node:c,index:Math.max(0,t.index+(e?0:-1))};return l===void 0?void 0:{root:l,range:{start:f,end:f}}}else if(h instanceof Y){const c=h.getItemContaining(t);if(c===void 0)break;if(h.getLength()>1){const u=h.withItemMergedBackwards(c);if(u===void 0)return;const[l,f]=u,b=this.withNodeReplaced(h,l);return b===void 0?void 0:{root:b,range:{start:f,end:f}}}else if(s.length>0&&s[s.length-1]instanceof Nt){const u=h.getItem(0);if(!(u instanceof p))return;const l=new W(0,u),f=this.withNodeReplaced(h,l),b=l.getFirstCaret();return f===void 0||b===void 0?void 0:{root:f,range:{start:b,end:b}}}}else if(h instanceof W){const c=e?h.getLastCaret():h.getFirstCaret();if(c===void 0)return;const u=s[s.length-1],l=e?u.getBlockAfter(h):u.getBlockBefore(h);if(c.node===t.node&&c.index===t.index&&l!==void 0)if(l instanceof W){const f=e?h.getLastCaret():l.getLastCaret();if(f===void 0)return;const b=_(e?h.getFormat():l.getFormat(),f);if(b===void 0)return;const x=e?l.withParagraphPrepended(h):l.withParagraphAppended(h);if(x===void 0)return;const v=this.withNodeReplaced(u,(r=u.withChildReplaced(l,x))==null?void 0:r.withoutBlock(h));if(v===void 0)return;const I=rt(x.getFormat(),b);return I===void 0?void 0:{root:v,range:{start:I,end:I}}}else if(l instanceof Y)if(e){const f=l.getFirstItem();if(f!==void 0){const b=h.withContent(h.getFormat().withSegmentsAppended(f)),x=(o=u.withNodeReplaced(h,b))==null?void 0:o.withNodeReplaced(f,void 0);return x===void 0?void 0:{root:x,range:{start:t,end:t}}}}else{const f=l.getLastItem();if(f!==void 0){const b=f.withSegmentAppended(h.getFormat()),x=(a=u.withNodeReplaced(f,b))==null?void 0:a.withoutBlock(h),v=h.getFormat().getFirstCaret();return x===void 0||v===void 0?void 0:{root:x,range:{start:v,end:v}}}}else{const f=this.withNodeReplaced(u,u.withoutBlock(l));return f===void 0?void 0:{root:f,range:{start:t,end:t}}}}}}withNodeInserted(t,e){if(!this.contains(t.node))return;const s=e instanceof Nt?e.getBlocks():e instanceof tt?[e]:[];if(s.length===0)return;const r=n(this,F).find(u=>u.contains(t.node));if(r===void 0)return;let o=r,a=this;for(;s.length>0;){let u=s.shift();if(u===void 0)return;if(o===r&&r instanceof W&&u instanceof W){if(u=r.withParagraphAppended(u),u===void 0)return;a=a.withChildReplaced(r,u)}else if(o===r&&r instanceof Y&&u instanceof Y){const l=r.withNodeInserted(t,u);if(l===void 0||!(l.root instanceof tt))return;u=l.root,a=a.withChildReplaced(r,u)}else a=a.withBlockInsertedAfter(o,u);if(a===void 0)return;o=u}const h=o.getFormats();let c;if(h.length===0){const u=new W(0,new p("",[new g]));if(c=u.getFirstCaret(),a=a.withBlockInsertedAfter(o,u),c===void 0||a===void 0)return}else if(c=h[h.length-1].getLastCaret(),c===void 0)return;return{root:a,range:{start:c,end:c}}}toHTML(){return n(this,F).map(t=>t.toHTML()).join("")}};let Vt=Nt;F=new WeakMap;var Ct;const Wt=class extends Vt{constructor(t,e="|"){super(t);R(this,Ct,void 0);k(this,Ct,e)}getType(){return"callout"}getPosition(){return n(this,Ct)}toText(){return this.getBlocks().map(t=>t.toText()).join(" ")}toHTML(){return`<hr/>${super.toHTML()}<hr/>`}toBookdown(){return`=
5
+ `+this.getBlocks().map(t=>t.toBookdown()).join(`
6
+
7
+ `)+`
8
+ =`+(n(this,Ct)!=="|"?n(this,Ct):"")}getChildren(){return this.getBlocks()}copy(){return new Wt(this.getBlocks().map(t=>t.copy()),n(this,Ct))}withPosition(t){return new Wt(this.getBlocks(),t)}withChildReplaced(t,e){const s=this.getBlocks().indexOf(t);if(s<0)return;const r=e===void 0?[...this.getBlocks().slice(0,s),...this.getBlocks().slice(s+1)]:[...this.getBlocks().slice(0,s),e,...this.getBlocks().slice(s+1)];return new Wt(r,n(this,Ct))}create(t){return new Wt(t,n(this,Ct))}};let pe=Wt;Ct=new WeakMap;var Mt,Qt;const ke=class extends tt{constructor(t,e){super();R(this,Mt,void 0);R(this,Qt,void 0);k(this,Mt,t),k(this,Qt,e)}getType(){return"error"}getError(){return n(this,Qt)}getFormats(){return[]}toText(){return""}toBookdown(){return n(this,Mt)??""}toHTML(){return n(this,Mt)??""}getChildren(){return[]}getParentOf(){}copy(){return new ke(n(this,Mt),n(this,Qt))}withChildReplaced(){}withContentInRange(){return this.copy()}};let mt=ke;Mt=new WeakMap,Qt=new WeakMap;class Gt extends T{constructor(i){super(i===void 0?new p("",[new g]):i.withTextIfEmpty())}getType(){return"footnote"}getDefaultCaret(){return this.getMeta().getFirstCaret()}toText(){return this.getMeta().toText()}toBookdown(){return`{${this.getMeta().toBookdown()}}`}toHTML(){return`(${this.getMeta().toHTML()})`}copy(){return new Gt(this.getMeta().copy())}getParentOf(i){return i===this.getMeta()?this:this.getMeta().getParentOf(i)}withChildReplaced(i,t){return i===this.getMeta()&&t!==void 0?new Gt(t):void 0}withMeta(i){return new Gt(i)}withContentInRange(i){const t=this.getMeta().withContentInRange(i);if(t!==void 0)return this.withMeta(t)}}class te extends T{constructor(i){super(i)}getType(){return"citations"}getDefaultCaret(){return{node:this,index:0}}toText(){return""}toBookdown(){return`<${this.getMeta().join(",")}>`}toHTML(){return`(${this.getMeta().join(",")})`}getParentOf(){}copy(){return new te([...this.getMeta()])}withMeta(i){return new te(i)}withChildReplaced(){}withContentInRange(){return this.copy()}}const Ae="LABELNOIDERROR";class ee extends T{constructor(i){super(i===Ae?"":i)}getType(){return"label"}getDefaultCaret(){return{node:this,index:0}}toText(){return""}toHTML(){return""}toBookdown(i){var s;const t=this.getMeta(),e=(s=i==null?void 0:i.getNextTextOrAtom(this))==null?void 0:s.toBookdown();return`:${t===""?Ae:t}${e!=null&&e.startsWith(" ")?"":" "}`}getParentOf(){}copy(){return new ee(this.getMeta())}withMeta(i){return new ee(i)}withChildReplaced(){}withContentInRange(){return this.copy()}}class Jt extends T{constructor(i){super(i.withTextIfEmpty())}getType(){return"comment"}toText(){return""}toHTML(){return`(${this.getMeta().toHTML()})`}getDefaultCaret(){return this.getMeta().getFirstCaret()}toBookdown(i){const t=i==null?void 0:i.getTextAndAtomNodes().filter(s=>s===this||!this.contains(s));let e;if(t){const s=t.indexOf(this),r=t[s-1];e=r instanceof g?r:void 0}return`${e!==void 0&&!e.getText().endsWith(" ")?" ":""}%${this.getMeta().toBookdown()}%`}copy(){return new Jt(this.getMeta().copy())}withChildReplaced(i,t){return i instanceof p&&t instanceof p&&i===this.getMeta()?new Jt(t):void 0}getParentOf(i){return i===this.getMeta()?this:this.getMeta().getParentOf(i)}withMeta(i){return new Jt(i)}withContentInRange(i){const t=this.getMeta().withContentInRange(i);if(t!==void 0)return this.withMeta(t)}}var kt;const _t=class extends Vt{constructor(t,e){super(t);R(this,kt,void 0);k(this,kt,e===void 0?{symbols:{}}:e)}getType(){return"chapter"}getChapter(){return this}create(t){return new _t(t,n(this,kt))}getErrors(){return this.getNodes().filter(t=>t instanceof mt)}getCitations(){const t=new Set;return this.getNodes().filter(e=>e instanceof te).forEach(e=>e.getMeta().forEach(s=>t.add(s))),t}getFootnotes(){return this.getNodes().filter(t=>t instanceof Gt)}getHeaders(){return this.getNodes().filter(t=>t instanceof W&&t.getLevel()>0)}getEmbeds(){return this.getNodes().filter(t=>t instanceof Dt)}getComments(){return this.getNodes().filter(t=>t instanceof Jt)}getLabels(){return this.getNodes().filter(t=>t instanceof ee)}hasLabel(t){return this.getLabels().find(e=>e.getMeta()===t)!==void 0}getCitationNumber(t){const e=Array.from(this.getCitations()).sort().indexOf(t);return e<0?null:e+1}toText(){return this.getBlocks().map(t=>t.toText()).join(" ")}toBookdown(){return Object.keys(n(this,kt).symbols).sort().map(t=>`@${t}: ${n(this,kt).symbols[t]}
9
+
10
+ `).join("")+this.getBlocks().map(t=>t.toBookdown()).join(`
11
+
12
+ `)}getNextTextOrAtom(t){const e=this.getTextAndAtomNodes(),s=e.indexOf(t);return s===void 0?void 0:s<e.length-1?e[s+1]:void 0}getPreviousTextOrAtom(t){const e=this.getTextAndAtomNodes(),s=e.indexOf(t);return s===void 0?void 0:s>0?e[s-1]:void 0}getChildren(){return this.getBlocks()}withChildReplaced(t,e){const s=this.getBlocks().indexOf(t);if(s<0)return;const r=e===void 0?[...this.getBlocks().slice(0,s),...this.getBlocks().slice(s+1)]:[...this.getBlocks().slice(0,s),e,...this.getBlocks().slice(s+1)];return new _t(r,n(this,kt))}copy(){return new _t(this.getBlocks().map(t=>t.copy()),n(this,kt))}};let xe=_t;kt=new WeakMap;class Kt extends Tt{constructor(i,t=""){super(i===void 0?new g:i,t)}getType(){return"definition"}toText(){return this.getText().toText()}toHTML(){return`${this.getText().toHTML()}`}toBookdown(){return`~${this.getText().toBookdown()}~${this.getMeta()}`}copy(){return new Kt(this.getText(),this.getMeta())}withMeta(i){return new Kt(this.getText(),i)}withText(i){return new Kt(i,this.getMeta())}}class Xt extends Tt{constructor(i,t="plaintext"){super(i===void 0?new g:i,t)}getType(){return"inline-code"}toText(){return this.getText().getText()}toHTML(){return`<code>${this.getMeta()}</code>`}toBookdown(){return"`"+this.getText().toBookdown().replace(/`/g,"\\`")+"`"+(this.getMeta()==="plaintext"?"":this.getMeta())}copy(){return new Xt(this.getText(),this.getMeta())}withMeta(i){return new Xt(this.getText(),i)}withText(i){return new Xt(i,this.getMeta())}}class Yt extends Tt{constructor(i,t=""){super(i===void 0?new g:i,t)}getType(){return"link"}toText(){return this.getText().toText()}toHTML(){return`<a href="${this.getMeta()}">${this.getText().toHTML()}</a>`}toBookdown(){return`[${this.getText().toBookdown()}|${this.getMeta()}]`}copy(){return new Yt(this.getText(),this.getMeta())}withMeta(i){return new Yt(this.getText(),i)}withText(i){return new Yt(i,this.getMeta())}}var H,pt;const Bt=class extends Vt{constructor(t,e,s="|"){super(t);R(this,H,void 0);R(this,pt,void 0);k(this,pt,s),k(this,H,e===void 0?new p("",[new g]):e.withTextIfEmpty())}getType(){return"quote"}getCredit(){return n(this,H)}getPosition(){return n(this,pt)}getFormats(){return[n(this,H)]}toText(){return this.getBlocks().map(t=>t.toText()).join(" ")+(n(this,H)?" "+n(this,H).toText():"")}toBookdown(){return`"
13
+ ${this.getBlocks().map(t=>t.toBookdown()).join(`
14
+
15
+ `)}
16
+ "${n(this,pt)==="|"?"":n(this,pt)}${n(this,H)?n(this,H).toBookdown():""}`}toHTML(){return`"${super.toHTML()}"<center>${n(this,H).toHTML()}</center>`}getChildren(){return[...this.getBlocks(),n(this,H)]}getParentOf(t){if(t===n(this,H))return this;const e=n(this,H).getParentOf(t);return e!==void 0?e:super.getParentOf(t)}copy(){return new Bt(this.getBlocks().map(t=>t.copy()))}create(t){return new Bt(t,n(this,H),n(this,pt))}withChildReplaced(t,e){if(n(this,H)===t&&(e instanceof p||e===void 0))return new Bt(this.getBlocks(),e,n(this,pt));if(e!==void 0&&!(e instanceof tt))return;const s=this.getBlocks().indexOf(t);if(s<0)return;const r=e===void 0?[...this.getBlocks().slice(0,s),...this.getBlocks().slice(s+1)]:[...this.getBlocks().slice(0,s),e,...this.getBlocks().slice(s+1)];return new Bt(r,n(this,H),n(this,pt))}withCredit(t){return new Bt(this.getBlocks(),t,n(this,pt))}withPosition(t){return new Bt(this.getBlocks(),n(this,H),t)}withContentInRange(t){const e=super.withContentInRange(t);if(e===void 0)return;const s=this.getBlocks().find(r=>r.contains(t.end.node))!==void 0?new p("",[new g]):n(this,H).withContentInRange(t);return e.withNodeReplaced(n(this,H),s)}};let ve=Bt;H=new WeakMap,pt=new WeakMap;class ut{constructor(i,t="",e="",s="",r="",o="",a="",h=!1){m(this,"citationID");m(this,"authors");m(this,"year");m(this,"title");m(this,"source");m(this,"url");m(this,"summary");m(this,"short");this.citationID=i,this.authors=t,this.year=e,this.title=s,this.source=r,this.url=o,this.summary=a,this.short=h}toText(){return this.authors+" "+this.year+" "+this.title+" "+this.source+(this.summary?this.summary:"")}toList(){return[this.authors,this.year,this.title,this.source,this.url,this.summary]}copy(){return new ut(this.citationID,this.authors,this.year,this.title,this.source,this.url,this.summary,this.short)}withChildReplaced(){}withContentInRange(){return this.copy()}withCitationID(i){return new ut(i,this.authors,this.year,this.title,this.source,this.url,this.summary,this.short)}withAuthors(i){return new ut(this.citationID,i,this.year,this.title,this.source,this.url,this.summary,this.short)}withYear(i){return new ut(this.citationID,this.authors,i,this.title,this.source,this.url,this.summary,this.short)}withTitle(i){return new ut(this.citationID,this.authors,this.year,i,this.source,this.url,this.summary,this.short)}withSource(i){return new ut(this.citationID,this.authors,this.year,this.title,i,this.url,this.summary,this.short)}withURL(i){return new ut(this.citationID,this.authors,this.year,this.title,this.source,i,this.summary,this.short)}withSummary(i){return new ut(this.citationID,this.authors,this.year,this.title,this.source,this.url,i,this.short)}equals(i){return this.authors===i.authors&&this.year===i.year&&this.title===i.title&&this.source===i.source&&this.summary==i.summary&&this.short===i.short}}class Ce extends tt{constructor(){super()}getType(){return"rule"}toText(){return""}toBookdown(){return"-"}toHTML(){return"<hr/>"}getParentOf(){}getFormats(){return[]}getChildren(){return[]}copy(){return new Ce}withChildReplaced(){}withContentInRange(){return this.copy()}}var C,U,nt;const wt=class extends tt{constructor(t,e,s){super();R(this,C,void 0);R(this,U,void 0);R(this,nt,void 0);k(this,C,t.map(r=>r.map(o=>o.withTextIfEmpty()))),k(this,nt,e||"|"),k(this,U,s===void 0?new p("",[new g]):s.withTextIfEmpty())}getType(){return"table"}getRows(){return n(this,C)}getRowCount(){return n(this,C).length}getColumnCount(){return n(this,C).length===0?0:n(this,C)[0].length}getPosition(){return n(this,nt)}getCaption(){return n(this,U)}getFormats(){const t=[];return n(this,C).forEach(e=>e.forEach(s=>{t.push(s)})),[...t,n(this,U)]}getNextCell(t,e=1){let s,r=!1;for(const o of n(this,C))for(const a of o){if(r)return a;if(a===t)if(e>0)r=!0;else return s;s=a}}toText(){return n(this,C).map(t=>t.map(e=>e.toText()).join(", ")).join(", ")}toBookdown(){return n(this,C).map(t=>`,${t.map(e=>e.toBookdown()).join("|")}`).join(`
17
+ `)+`
18
+ ${n(this,nt)==="|"?"":n(this,nt)}${n(this,U)?""+n(this,U).toBookdown():""}`}toHTML(){return`<table><tbody>${n(this,C).map(t=>`<tr>${t.map(e=>`<td>${e.toHTML()}</td>`).join("")}`).join("")}</tbody></table><center>${n(this,U).toHTML()}</center>`}getChildren(){const t=[];return n(this,C).forEach(e=>e.forEach(s=>t.push(s))),t.push(n(this,U)),t}locate(t){for(let e=0;e<n(this,C).length;e++){const s=n(this,C)[e];for(let r=0;r<s.length;r++)if(s[r]===t)return{row:e,column:r}}}getCell(t,e){return t>=0&&t<n(this,C).length&&n(this,C).length>0&&e>=0&&e<n(this,C)[0].length?n(this,C)[t][e]:void 0}getParentOf(t){for(let e=0;e<n(this,C).length;e++){const s=n(this,C)[e];for(let r=0;r<s.length;r++){if(s[r]===t)return this;const o=s[r].getParentOf(t);if(o!==void 0)return o}}return t===n(this,U)?this:n(this,U).getParentOf(t)}copy(){const t=[];return n(this,C).forEach(e=>{const s=[];e.forEach(r=>s.push(r.copy())),t.push(s)}),new wt(t,n(this,nt),n(this,U)?n(this,U).copy():void 0)}withChildReplaced(t,e){if(t===n(this,U)&&(e instanceof p||e===void 0))return new wt(n(this,C),n(this,nt),e);if(t instanceof p&&e instanceof p){let s=0,r=-1;for(;s<n(this,C).length&&(r=n(this,C)[s].indexOf(t),!(r>=0));s++);if(s<n(this,C).length&&r>=0){const o=n(this,C).map(a=>[...a]);return o[s][r]=e,new wt(o,n(this,nt),n(this,U))}}}withNewRow(t){if(t<0||t>n(this,C).length)return;const e=n(this,C).length===0?0:n(this,C)[0].length,s=[];for(let o=0;o<e;o++)s.push(new p("",[new g]));const r=n(this,C).slice();return r.splice(t,0,s),new wt(r,n(this,nt),n(this,U))}withoutRow(t){if(t<0||t>=n(this,C).length)return;const e=n(this,C).slice();return e.splice(t,1),new wt(e,n(this,nt),n(this,U))}withoutColumn(t){if(t<0||t>=this.getColumnCount())return;const e=n(this,C).slice();for(let s=0;s<n(this,C).length;s++)e[s].splice(t,1);return new wt(e,n(this,nt),n(this,U))}withNewColumn(t){if(n(this,C).length>0&&(t<0||t>n(this,C)[0].length))return;const e=n(this,C).slice();for(let s=0;s<n(this,C).length;s++)e[s]=e[s].slice(),e[s].splice(t,0,new p("",[new g]));return new wt(e,n(this,nt),n(this,U))}withContentInRange(t){const e=this.contains(t.start.node),s=this.contains(t.end.node);if(!e&&!s)return this.copy();let r=0,o=0,a=!1,h=!1,c=[];for(;r<n(this,C).length;r++,o=0){const l=n(this,C)[r];if(!(e&&!a&&l.find(f=>f.contains(t.start.node))===void 0)){if(s&&h)break;for(c.push([]);o<l.length;o++){!a&&l[o].contains(t.start.node)&&(a=!0);const f=l[o].withContentInRange(t);if(f===void 0)return;c[c.length-1].push((e&&a||!e)&&(s&&!h||!s)?f:new p("",[new g])),l[o].contains(t.end.node)&&(h=!0)}}}const u=n(this,U).withContentInRange(t);if(u!==void 0)return new wt(c,n(this,nt),u)}withPosition(t){return new wt(n(this,C),t,n(this,U))}};let be=wt;C=new WeakMap,U=new WeakMap,nt=new WeakMap;const oe=/^[0-9]+\.+/,Oe=/^\*+\s+/;class ct{constructor(i,t){m(this,"book");m(this,"text");m(this,"index");m(this,"openedDoubleQuote");m(this,"metadata");if(typeof t!="string")throw"Parser expected a string but received "+typeof t;this.book=i,this.text=t,this.index=0,this.openedDoubleQuote=!1,this.metadata={symbols:{}}}static preprocessSymbols(i,t){if(i&&i.getSymbols())for(const[e,s]of Object.entries(i.getSymbols()))t=t.replace(new RegExp("([^\\\\])@"+e+"\\b","g"),"$1"+s);return t}static parseChapter(i,t){return new ct(i,i===void 0?t:ct.preprocessSymbols(i,t)).parseChapter()}static parseFormat(i,t){return new ct(i,i===void 0?t:ct.preprocessSymbols(i,t)).parseFormat()}static parseEmbed(i,t){return new ct(i,i===void 0?t:ct.preprocessSymbols(i,t)).parseEmbed()}peek(){return this.more()?this.text.charAt(this.index):null}more(){return this.index<this.text.length}nextIsEmptyParagraph(){return this.text.charAt(this.index)===`
19
+ `&&this.text.charAt(this.index+1)===`
20
+ `&&this.text.charAt(this.index+2)===`
21
+ `}nextIsWhitespace(){return(this.peek()===" "||this.peek()===" "||this.peek()===`
22
+ `)&&!this.nextIsEmptyParagraph()}read(i=!0){if(!this.more())return null;let t=this.text.charAt(this.index);return i&&(t===`
23
+ `&&(this.openedDoubleQuote=!1),t==='"'?(this.openedDoubleQuote?t="”":t="“",this.openedDoubleQuote=!this.openedDoubleQuote):t==="'"&&(/\s/.test(this.text.charAt(this.index-1))?t="‘":t="’"),t==="-"&&this.text.charAt(this.index+1)==="-"&&this.text.charAt(this.index)!==`
24
+ `&&(this.index++,t="—")),this.index++,t}unread(){this.index--}rest(){return this.text.substring(this.index)}charBeforeNext(){return this.index===0?null:this.text.charAt(this.index-1)}charAfterNext(){return this.index===this.text.length-1?null:this.text.charAt(this.index+1)}restOfLine(){const i=this.text.substring(this.index).indexOf(`
25
+ `)+this.index;return i<0?this.text.substring(this.index):this.text.substring(this.index,Math.max(this.index,i))}nextIs(i){return this.more()?this.text.substring(this.index,this.index+i.length)===i:!1}nextIsContentDelimiter(){const i=this.peek(),t=this.charAfterNext();return i===`
26
+ `||i==="_"||i==="*"||i==="`"||i==="@"||i==="~"||i===":"&&t!==null&&t.match(/[a-z]/i)!==null||i==="^"||i==="<"||i==="{"||this.charBeforeNext()===" "&&i==="%"||i==="["||i==="\\"}nextMatches(i){return this.more()?i.test(this.rest()):!1}isBlankLine(){return this.restOfLine().trim()===""}readWhitespace(){let i=this.peek();for(;i!==null&&/^[ \t]/.test(i);)this.read(),i=this.peek()}readUntilNewLine(){let i="";for(;this.more()&&this.peek()!==`
27
+ `;)i=i+this.read();return i}readUntilNewlineOr(i){let t="";for(;this.more()&&!this.nextIs(`
28
+ `)&&!this.nextIs(i);)t=t+this.read();return t}parseChapter(){let i=[];this.parseSymbols();let t=this.text.substring(0,this.index),e=this.rest();for(const[r,o]of Object.entries(this.metadata.symbols))e=e.replace(new RegExp("([^\\\\])@"+r+"\\b","g"),"$1"+o);this.book&&(e=ct.preprocessSymbols(this.book,e)),this.text=t+e;let s=0;for(;this.more();)for(s=0,i.push(this.parseBlock());this.nextIsWhitespace();)this.peek()===`
29
+ `&&s++,this.read();return(i.length===0||s>1)&&i.push(new W),new xe(i,this.metadata)}parseSymbols(){for(this.readWhitespace();this.nextIs("@");){this.read();let i=this.readUntilNewlineOr(":");if(!/^[a-zA-Z0-9]+$/.test(i)){new mt(this.readUntilNewLine(),i.trim()===""?"Did you mean to declare a symbol? Use an @ symbol, then a name of only numbers and letters, then a colon, then whatever content you want it to represent.":"'"+i+"' isn't a valid name for a symbol; letters and numbers only");return}if(this.readWhitespace(),!this.nextIs(":")){new mt(this.readUntilNewLine(),"Symbol names are to be followed by a ':'");return}this.read(),this.readWhitespace();let t=this.index;for(this.parseBlock(),this.metadata.symbols[i]=this.text.substring(t,this.index).trim();this.nextIsWhitespace();)this.read()}}parseBlock(){for(;this.nextIs("%");)this.readUntilNewLine();return this.nextIs("#")?this.parseHeader():this.nextIs("-")?this.parseRule():this.nextIs("|")?this.parseEmbed():this.nextMatches(Oe)||this.nextMatches(oe)?this.parseList():this.nextMatches(/^`[a-zA-Z!]*[ \t]*\n/)?this.parseCode():this.nextMatches(/^"[ \t]*\n/)?this.parseQuote():this.nextMatches(/^=[ \t]*\n/)?this.parseCallout():this.nextIs(",")?this.parseTable():this.parseParagraph()}parseParagraph(){return this.nextIsEmptyParagraph()?(this.read(),this.read(),new W(0,new p("",[new g]))):new W(0,this.parseFormat())}parseHeader(){let i=0;for(;this.nextIs("#");)this.read(),i++;return this.readWhitespace(),new W(Math.min(3,i),this.parseFormat())}parseRule(){return this.readUntilNewLine(),new Ce}parseList(){let i=this.nextMatches(oe);const t=[];let e,s;for(;this.nextMatches(oe)||this.nextMatches(Oe);){i=this.nextMatches(oe),e=s,s=0;let r;if(i)for(r=this.index,this.readUntilNewlineOr("."),r=this.index-r;this.nextIs(".");)this.read(),s++;else for(s=0;this.nextIs("*");)this.read(),s++;if(e===void 0||e===s){this.readWhitespace();const o=this.parseFormat();t.push(o.isEmpty()?o.withSegmentAppended(new g):o)}else{let o=s;for(;o>0;)this.unread(),o--;if(r!==void 0)for(;r>0;)this.unread(),r--;if(s<e)break;t.push(this.parseList()),s=e}for(this.readWhitespace();this.nextIsWhitespace();)this.read(),this.readWhitespace();if(this.nextIsEmptyParagraph())break}return new Y(t,i)}parseCode(){this.read();let i=this.readUntilNewLine();this.read();let t="";for(;this.more()&&!this.nextIs("`");){let r=this.read(!1);r==="\\"&&this.nextIs("`")&&(this.read(),r="`"),t=t+r}t=t.trim(),this.nextIs("`")&&this.read();let e=this.parsePosition();const s=this.parseFormat();return new Ht(new g(t),i,e,s)}parsePosition(){let i="|";return this.nextIs("<")?(i="<",this.read()):this.nextIs(">")&&(i=">",this.read()),i}parseQuote(){const i=[];for(this.read(),this.readWhitespace(),this.read();this.more()&&!this.nextIs('"');){const s=this.parseBlock();for(s!==null&&i.push(s);this.nextIsWhitespace();)this.read()}this.read();const t=this.parsePosition();this.readWhitespace();const e=this.nextIs(`
30
+ `)?void 0:this.parseFormat();return new ve(i,e,t)}parseCallout(){const i=[];for(this.read(),this.readWhitespace(),this.read();this.more()&&!this.nextIs("=");){const e=this.parseBlock();for(e!==null&&i.push(e);this.peek()===" "||this.peek()===" "||this.peek()===`
31
+ `;)this.read()}this.read();const t=this.parsePosition();return this.readWhitespace(),new pe(i,t)}parseTable(){const i=[];for(;this.more()&&this.nextIs(",");){let s=[];for(;this.more()&&!this.nextIs(`
32
+ `);)this.read(),this.readWhitespace(),s.push(this.parseFormat("|"));i.push(s),this.read()}const t=this.parsePosition(),e=this.parseFormat();return new be(i,t,e)}parseFormat(i){const t=[];for(;this.more()&&!this.nextIs(`
33
+ `);){const e=this.peek(),s=this.charAfterNext();if(e==="_"||e==="*"||e==="^")t.push(this.parseStyle(e));else if(this.nextIs("`"))t.push(this.parseInlineCode());else if(this.nextIs("<"))t.push(this.parseCitations());else if(this.nextIs("{"))t.push(this.parseFootnote());else if(this.nextIs("~"))t.push(this.parseDefinition());else if(this.nextIs("\\"))t.push(this.parseEscaped());else if(this.nextIs("["))t.push(this.parseLink());else if(this.charBeforeNext()===" "&&this.nextIs("%"))t.push(this.parseComment());else if(e==="@"){this.read();let r="",o=this.peek();for(;o!==null&&/[a-zA-Z0-9]/.test(o);)r=r+this.read(),o=this.peek();t.push(new mt(void 0,"Couldn't find symbol @"+r))}else if(e===":"&&s!==null&&s.match(/[a-z]/i))t.push(this.parseLabel());else{let r="";for(;this.more()&&(!i||!this.nextIs(i))&&!this.nextIsContentDelimiter()&&!this.nextIs(`
34
+ `);)r=r+this.read();t.push(new g(r))}if(this.peek()===i)break}return new p("",t)}parseEmbed(){this.read();const i=this.readUntilNewlineOr("|");let t,e,s;this.peek()==="|"&&(this.read(),t=this.readUntilNewlineOr("|"),this.peek()==="|"&&(this.read(),e=this.parseFormat("|"),this.peek()==="|"&&(this.read(),s=this.parseFormat("|"),this.peek()==="|"&&this.read())));const r=this.parsePosition();return new Dt(i,t??"",e,s,r)}parseComment(){this.read();const i=this.parseFormat("%");return this.peek()==="%"&&this.read(),new Jt(i)}parseLabel(){this.read();let i="",t=this.peek();for(;t!==null&&t.match(/[a-z]/i);)i=i+this.read(),t=this.peek();return new ee(i)}parseStyle(i){const t=this.read();let e=!1;const s=[];let r="";if(t==="^"&&this.peek()==="v"&&(this.read(),e=!0),t===null)return new mt(void 0,"Somehow parsing formatted text at end of file.");for(;this.more()&&this.peek()!==t&&!this.nextIs(`
35
+ `);)this.nextIsContentDelimiter()?(r!==""&&s.push(new g(r)),s.push(this.parseFormat(i)),r=""):r=r+this.read();return r!==""&&s.push(new g(r)),this.nextIs(t)?this.read():s.push(new mt(void 0,"Unclosed "+t)),new p(e?"v":t,s)}parseInlineCode(){this.read();let i="";for(;this.more()&&!this.nextIs("`");){let s=this.read(!1);s==="\\"&&this.nextIs("`")&&(this.read(),s="`"),i=i+s}this.nextIs("`")&&this.read();let t="",e=this.peek();if(e!==null&&/^[a-z]$/.test(e))do t=t+this.read(),e=this.peek();while(e!==null&&/^[a-z]$/.test(e));else t="plaintext";return new Xt(new g(i),t)}parseCitations(){let i="";this.read(),i=this.readUntilNewlineOr(">"),this.peek()===">"&&this.read();const t=i.split(",").map(e=>e.trim()).filter(e=>e.length>0);return new te(t)}parseFootnote(){this.read();const i=this.parseFormat("}");return this.read(),new Gt(i)}parseDefinition(){this.read();const i=this.readUntilNewlineOr("~");this.read();let t="",e=this.peek();for(;e!==null&&/[a-zA-Z]/.test(e);)t=t+this.read(),e=this.peek();return new Kt(new g(i),t)}parseEscaped(){this.read();const i=this.read();return i?new g(i):new mt(void 0,"Unterminated escape.")}parseLink(){this.read();const i=this.readUntilNewlineOr("|");if(this.peek()!=="|")return this.readUntilNewLine(),new mt(void 0,"Missing '|' in link");this.read();let t=this.readUntilNewlineOr("]");return this.peek()!=="]"?(this.readUntilNewLine(),new mt(void 0,"Missing ] in link")):(this.read(),new Yt(new g(i),t))}}const Qe=["a","about","all","also","and","are","as","at","be","because","but","by","can","come","could","day","do","does","even","find","first","for","from","get","give","go","has","have","he","her","here","him","his","how","I","if","in","into","is","it","its","just","know","like","look","make","man","many","me","more","my","new","no","not","now","of","on","one","only","or","other","our","out","people","say","see","she","so","some","take","tell","than","that","the","their","them","then","there","these","they","thing","think","this","those","time","to","two","up","use","very","want","was","way","we","well","went","what","when","which","who","will","with","would","year","yes","you","your"];class Z{constructor(i,t,e,s,r,o,a,h,c,u){m(this,"ref");m(this,"id");m(this,"title");m(this,"authors");m(this,"image");m(this,"numbered");m(this,"forthcoming");m(this,"section");m(this,"text");m(this,"uids");m(this,"_ast");m(this,"_index");m(this,"_wordCount");m(this,"edits",[]);m(this,"lastEdit",0);m(this,"listeners",new Set);this.ref=i,this.id=t,this.title=e,this.authors=s.slice(),this.image=r,this.numbered=o,this.forthcoming=a,this.section=h,this.text=c,this.uids=u}static fromJSON(i,t){return new Z(i.ref,i.id,i.title,i.authors??[],i.image??null,i.numbered===!0||i.numbered===void 0,i.forthcoming===!0,i.section,i.text??t,i.uids)}toJSON(){const i={id:this.id,title:this.title,authors:this.authors.slice(),image:this.image,numbered:this.numbered,forthcoming:this.forthcoming,uids:this.uids};return this.ref&&(i.ref=this.ref),this.section&&(i.section=this.section),i}getRef(){return this.ref}withEditors(i){return new Z(this.ref,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,this.text,i)}withRef(i){return new Z(i,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}withoutRef(){return new Z(void 0,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}getID(){return this.id}withChapterID(i){return new Z(this.ref,i,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}getSection(){return this.section}withSection(i){return new Z(this.ref,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,i,this.text,this.uids)}isForthcoming(){return this.forthcoming}asForthcoming(i){return new Z(this.ref,this.id,this.title,this.authors,this.image,this.numbered,i,this.section,this.text,this.uids)}isNumbered(){return this.numbered}asNumbered(i){return new Z(this.ref,this.id,this.title,this.authors,this.image,i,this.forthcoming,this.section,this.text,this.uids)}isEditor(i){return this.uids.includes(i)}getText(){return this.text}withText(i){return new Z(this.ref,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,i,this.uids)}withAST(i){const t=new Z(this.ref,this.id,this.title,this.authors,this.image,this.numbered,this.forthcoming,this.section,i.toBookdown(),this.uids);return t._ast=i,t}getAuthors(){return this.authors}withAuthor(i){return new Z(this.ref,this.id,this.title,[...this.authors,i],this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}withRenamedAuthor(i,t){return i<0||i>=this.authors.length?this:new Z(this.ref,this.id,this.title,[...this.authors.slice(0,i),t,...this.authors.slice(i+1)],this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}withoutAuthor(i){return i<0||i>=this.authors.length?this:new Z(this.ref,this.id,this.title,[...this.authors.slice(0,i),...this.authors.slice(i+1)],this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}getTitle(){return this.title}withTitle(i){return new Z(this.ref,this.id,i,this.authors,this.image,this.numbered,this.forthcoming,this.section,this.text,this.uids)}getImage(){return this.image}withImage(i){return new Z(this.ref,this.id,this.title,this.authors,i,this.numbered,this.forthcoming,this.section,this.text,this.uids)}getAST(i){return this._ast===void 0&&(this._ast=ct.parseChapter(i,this.text)),this._ast}getWordCount(i){return this._wordCount===void 0&&(this._wordCount=this.getAST(i).toText().split(/\s+/).length),this._wordCount}getReadingTime(i){return this.isForthcoming()?void 0:Math.max(1,Math.round(this.getWordCount(i)/150))}getIndex(i){if(this._index===void 0){const t=this.getAST(i);let e=new Set;Qe.forEach(a=>e.add(a));const r=t.toText().split(/\b/),o={};r.forEach((a,h)=>{if(/[a-zA-Z\u2019]+/.test(a)&&(a=a.toLowerCase(),!e.has(a)&&a.indexOf("’")<0&&a.length>2&&a.substring(a.length-2,a.length)!=="ly")){a in o||(o[a]=[]);let c={left:r.slice(Math.max(0,h-10),Math.max(0,h-1)+1).join(""),match:r[h],right:r.slice(Math.min(r.length-1,h+1),Math.min(r.length-1,h+10)+1).join("")};o[a.toLowerCase()].push(c)}}),this._index=o}return this._index}toString(){return`${this.title} by ${this.authors.join(", ")}: ${this.text.substring(0,32)}}`}}const N={TableOfContentsID:"",ReferencesID:"references",SearchID:"search",MediaID:"media",IndexID:"index",GlossaryID:"glossary",UnknownID:"unknown"};class D{constructor(i,t,e,s,r,o,a,h,c,u,l,f,b,x,v,I,et,ft,vt,At,St){m(this,"bookRef");m(this,"editionRef");m(this,"uids");m(this,"title");m(this,"authors");m(this,"number");m(this,"summary");m(this,"published");m(this,"images");m(this,"description");m(this,"chapters");m(this,"license");m(this,"acknowledgements");m(this,"tags");m(this,"sources");m(this,"references");m(this,"symbols");m(this,"glossary");m(this,"theme");m(this,"base");m(this,"active");this.bookRef=i,this.editionRef=t,this.uids=e,this.title=s,this.authors=r,this.number=o,this.summary=a,this.published=h,this.images=c,this.description=u,this.chapters=l.slice(),this.license=f,this.acknowledgements=b,this.tags=x.slice(),this.sources=Object.assign({},v),this.references={};for(const[G,V]of Object.entries(I))this.references[G]=V instanceof ut?V:D.parseReference(G,V,this);this.symbols=Object.assign({},et),this.glossary=Object.assign({},ft),this.theme=vt,this.base=At,this.active=St}static fromJSON(i,t){return new D(t.bookRef,i,t.uids,t.title,t.authors,t.number,t.summary,t.published,t.images,t.description,t.chapters.map(e=>Z.fromJSON(e,"")),t.license,t.acknowledgements,t.tags??[],t.sources??{},t.references??{},t.symbols??{},t.glossary??{},t.theme,t.base??"",t.active)}static parseReference(i,t,e,s=!1){if(typeof t=="string")return ct.parseFormat(e,t);{let[r,o,a,h,c,u]=t;if(h.charAt(0)==="#"){let l=e.getSource(h);l!==null&&(h=l)}return new ut(i,r??"",o??"",a??"",h??"",c??"",u??"",s)}}toObject(){const i={};for(const[e,s]of Object.entries(this.references))i[e]=s instanceof ut?s.toList():s.toBookdown();return{bookRef:this.bookRef,title:this.title,authors:this.authors,number:this.number,summary:this.summary,published:this.published,images:Object.assign({},this.images),description:this.description,chapters:this.chapters.map(e=>e.toJSON()),license:this.license,acknowledgements:this.acknowledgements,tags:this.tags.slice(),sources:Object.assign({},this.sources),references:i,symbols:Object.assign({},this.symbols),glossary:Object.assign({},this.glossary),theme:this.theme,base:this.base,uids:this.uids.slice(),chapteruids:this.getChapterUIDS(),active:this.active}}getBookRef(){return this.bookRef}getEditionRef(){return this.editionRef}getChapterUIDS(){return Array.from(new Set(this.chapters.map(i=>i.uids).flat()))}withRef(i){return new D(this.bookRef,i,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getTitle(){return this.title}withTitle(i){return new D(this.bookRef,this.editionRef,this.uids,i,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getDescription(){return this.description}setDescription(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,i,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getAcknowledgements(){return this.acknowledgements}withAcknowledgements(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,i,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}withSummary(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,i,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}asPublished(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,i?Date.now():null,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getLicense(){return this.license}setLicense(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,i,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getChapters(){return this.chapters.slice()}hasChapter(i){return this.getChapter(i)!==void 0||["references","glossary","index","search","media"].includes(i)}getChapter(i){return this.chapters.find(t=>t.getID()===i)}getChapterByRef(i){return this.chapters.find(t=>t.ref!==void 0&&t.ref.id===i.id)}getChapterPosition(i){for(var t=0;t<this.chapters.length;t++)if(this.chapters[t].getID()===i)return t}getChapterCount(){return this.chapters.length}withChapters(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,i,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}withChapterText(i){return this.withChapters(this.chapters.map(t=>{if(t.ref===void 0)return t;const e=i.find(([s,r])=>t.ref!==void 0&&t.ref.id===s.id&&t.text!==r&&r!==void 0);return e?t.withText(e[1]):t}))}withRevisedChapter(i,t){const e=this.chapters.indexOf(i);return e<0?this:this.withChapters([...this.chapters.slice(0,e),t,...this.chapters.slice(e+1)])}withoutRefs(){return this.withRef(void 0).withChapters(this.chapters.map(i=>i.withoutRef()))}withIncrementedEditionNumber(){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number+1,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}withNewChapter(){let i=1;for(;this.hasChapter("chapter"+i);)i++;const t=new Z(void 0,`chapter${i}`,"Untitled Chapter",[],null,!0,!1,void 0,"",[]);return this.withChapters([...this.chapters,t])}withoutChapter(i){let t=this.chapters.findIndex(e=>e.getID()===i);return t<0?this:this.withChapters([...this.chapters.slice(0,t),...this.chapters.slice(t+1)])}withMovedChapter(i,t){let e=this.chapters.findIndex(o=>o.getID()===i);if(e+t<0||e+t>=this.chapters.length)return this;const s=this.chapters.slice(),r=s[e+t];return s[e+t]=s[e],s[e]=r,new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,s,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}getSymbols(){return this.symbols}hasReferences(){return Object.keys(this.references).length>0}getReferences(){return Object.assign({},this.references)}getReference(i){return i in this.references?this.references[i]:void 0}withReferences(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,i,this.symbols,this.glossary,this.theme,this.base,this.active)}withNewReferences(i){const t=Object.assign({},this.references);for(const e of i)t[e.citationID]=e;return this.withReferences(t)}withEditedReference(i){if(!(i.citationID in this.references))return this;const t=Object.assign({},this.references);return t[i.citationID]=i,this.withReferences(t)}withEditedReferenceID(i,t){if(!(t.citationID in this.references))return;const e=Object.assign({},this.references);return delete e[t.citationID],e[i]=t.withCitationID(i),this.withReferences(e)}withoutReference(i){if(!(i in this.references))return this;const t=Object.assign({},this.references);return delete t[i],this.withReferences(t)}hasGlossary(){return Object.keys(this.glossary).length>0}getGlossary(){return Object.assign({},this.glossary)}hasDefinition(i){return i in this.glossary}withGlossary(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,i,this.theme,this.base,this.active)}withDefinition(i,t,e,s){const r=Object.assign({},this.glossary);return r[i]={phrase:t,definition:e,synonyms:s},this.withGlossary(r)}withoutDefinition(i){const t=Object.assign({},this.glossary);return delete t[i],this.withGlossary(t)}withEditedDefinition(i,t){const e=Object.assign({},this.glossary);return e[i]=t,this.withGlossary(e)}withEditedDefinitionID(i,t){if(!(i in this.glossary))return;const e=Object.assign({},this.glossary),s=e[i];return delete e[i],e[t]=s,this.withGlossary(e)}getTags(){return this.tags}getTheme(){return this.theme}withTheme(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,i,this.base,this.active)}withThemeValue(i,t,e){if(this.theme===null)return this;if(i==="imports")return this;const s=Object.assign({},this.theme),r=Object.assign({},this.theme[i]);return r[t]=e,s[i]=r,this.withTheme(s)}getAuthors(){return[...this.authors]}withAuthors(i){return new D(this.bookRef,this.editionRef,this.uids,this.title,i,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}withAuthor(i){return this.withAuthors([...this.authors,i])}withAuthorName(i,t){return i<0||i>=this.authors.length?this:this.withAuthors([...this.authors.slice(0,i),t,...this.authors.slice(i+1)])}withoutAuthor(i){return i<0||i>=this.authors.length?this:this.withAuthors([...this.authors.slice(0,i),...this.authors.slice(i+1)])}withEditors(i){return new D(this.bookRef,this.editionRef,i,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}hasImage(i){return this.images[i]!==null}getImage(i){return this.images[i]??null}withImage(i,t){const e=Object.assign({},this.images);return e[i]=t,new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,e,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,this.active)}isEditor(i){return this.uids.includes(i)}isChapterEditor(i){return this.getChapterUIDS().includes(i)}getLeasee(i){return this.active[i]}hasLease(i,t){return this.active[t]===i}isLeased(i){return i in this.active}withLock(i,t,e){const s=Object.assign({},this.active);return e?s[t]=i:delete s[t],new D(this.bookRef,this.editionRef,this.uids,this.title,this.authors,this.number,this.summary,this.published,this.images,this.description,this.chapters,this.license,this.acknowledgements,this.tags,this.sources,this.references,this.symbols,this.glossary,this.theme,this.base,s)}getBookReadingTime(){return this.chapters.map(i=>i.getReadingTime(this)).reduce((i,t)=>i===void 0?0:t===void 0?i:i+t,0)}getChapterNumber(i){let t=1,e=null;if(this.chapters.forEach(s=>{s.getID()===i?(e=t,s.isNumbered()||(e=null)):s.isNumbered()&&t++}),e!==null)return e}getSource(i){return i.charAt(0)==="#"&&i.substring(1)in this.sources?this.sources[i.substring(1)]:null}getChapterName(i){const t=this.getChapter(i);return t==null?void 0:t.getTitle()}getChapterSection(i){const t=this.getChapter(i);return t==null?void 0:t.getSection()}getFootnoteSymbol(i){let t="abcdefghijklmnopqrstuvwxyz";return i<t.length?t.charAt(i):t.charAt(Math.floor(i/t.length)-1)+t.charAt(i%t.length)}getBookIndex(){const i={};return this.chapters.forEach(t=>{let e=t.getIndex(this);e&&Object.keys(e).forEach(s=>{s!==""&&s.length>2&&(s in i||(i[s]=new Set),i[s].add(t.getID()))})}),i}getNextChapterID(i){switch(i){case N.ReferencesID:return this.hasGlossary()?N.GlossaryID:N.IndexID;case N.GlossaryID:return N.IndexID;case N.IndexID:return N.SearchID;case N.SearchID:return N.MediaID;case N.MediaID:return N.TableOfContentsID;case N.TableOfContentsID:return this.chapters.length>0?this.chapters[0].getID():null;default:let t=!1;for(let e=0;e<this.chapters.length;e++){let s=this.chapters[e];if(s.getID()===i)t=!0;else if(t&&!s.isForthcoming())return s.getID()}return t?this.hasReferences()?N.ReferencesID:this.hasGlossary()?N.GlossaryID:N.IndexID:null}}getPreviousChapterID(i){switch(i){case N.ReferencesID:return this.chapters.length>0?this.chapters[this.chapters.length-1].getID():null;case N.GlossaryID:return this.hasReferences()?N.ReferencesID:this.chapters.length>0?this.chapters[this.chapters.length-1].getID():N.TableOfContentsID;case N.IndexID:return this.hasGlossary()?N.GlossaryID:this.hasReferences()?N.ReferencesID:this.chapters.length>0?this.chapters[this.chapters.length-1].getID():N.TableOfContentsID;case N.SearchID:return N.IndexID;case N.MediaID:return N.SearchID;default:let t=!1;for(let e=this.chapters.length-1;e>=0;e--){let s=this.chapters[e];if(s.getID()===i)t=!0;else if(t&&!s.isForthcoming())return s.getID()}return t?N.TableOfContentsID:null}}getEmbeds(){let i=[];const t=this.getImage("cover");if(t){let s=ct.parseEmbed(this,t);s instanceof Dt&&i.push(s)}return this.getChapters().forEach(s=>{var h;const r=s.getImage();let o=r===null?void 0:ct.parseEmbed(this,r);o&&o instanceof Dt&&i.push(o);let a=(h=s==null?void 0:s.getAST(this))==null?void 0:h.getEmbeds();a&&a.forEach(c=>i.push(c))}),["references","glossary","index","search","media"].forEach(s=>{const r=this.getImage(s);if(r){let o=ct.parseEmbed(this,r);o instanceof Dt&&i.push(o)}}),i}isLatestEdition(i){var e;const t=i.getLatestEditionID();return t!==void 0&&t===((e=this.editionRef)==null?void 0:e.id)}isLatestPublishedEdition(i){var e;const t=i.getLatestPublishedEditionID();return t!==void 0&&t===((e=this.editionRef)==null?void 0:e.id)}getEditionNumber(){return this.number}getEditionLabel(){const i=this.number;return`${i}${i===1?"st":i===2?"nd":i===3?"rd":""}`}getInfo(){return this.editionRef===void 0?void 0:{ref:this.editionRef,summary:this.summary,number:this.number,published:this.published,editionuids:this.uids,chapteruids:Array.from(new Set(this.chapters.map(i=>i.uids).flat()))}}}let he;const qe=new Uint8Array(16);function Ve(){if(!he&&(he=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!he))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return he(qe)}const X=[];for(let d=0;d<256;++d)X.push((d+256).toString(16).slice(1));function Ze(d,i=0){return(X[d[i+0]]+X[d[i+1]]+X[d[i+2]]+X[d[i+3]]+"-"+X[d[i+4]]+X[d[i+5]]+"-"+X[d[i+6]]+X[d[i+7]]+"-"+X[d[i+8]]+X[d[i+9]]+"-"+X[d[i+10]]+X[d[i+11]]+X[d[i+12]]+X[d[i+13]]+X[d[i+14]]+X[d[i+15]]).toLowerCase()}const Ke=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Le={randomUUID:Ke};function Xe(d,i,t){if(Le.randomUUID&&!i&&!d)return Le.randomUUID();d=d||{};const e=d.random||(d.rng||Ve)();if(e[6]=e[6]&15|64,e[8]=e[8]&63|128,i){t=t||0;for(let s=0;s<16;++s)i[t+s]=e[s];return i}return Ze(e)}class Ye{constructor(i){m(this,"book");m(this,"_images");m(this,"observers",new Set);this.book=i}notify(i){this.observers.add(i),this.getImages().then(t=>i(t))}stopNotifying(i){this.observers.delete(i)}async getImages(){return this._images===void 0?this.cacheImages():this._images}getImagePath(){return`images/${this.book.getID()}/`}async cacheImages(){if(Lt===void 0)return[];this._images=(await this.retrieveImages()).filter(i=>i!==void 0);for(const i of this.observers)i(this._images.slice());return this._images}async retrieveImages(){if(Lt===void 0)return[];const i=re(Lt,this.getImagePath());return je(i).then(t=>Promise.all(t.items.map(e=>me(e).then(s=>{const r={url:s,description:"",ref:e};return this._images!==void 0&&this._images.push(r),r}))))}getThumbnailURL(i,t,e,s,r=0){me(t).then(o=>s(i,o)).catch(()=>r>25?e("Couldn't get the image's thumbnail URL"):setTimeout(()=>this.getThumbnailURL(i,t,e,s,r+1),200))}upload(i,t,e,s){if(Lt===void 0)return;const r=`image-${Xe()}`,o=re(Lt,`${this.getImagePath()}/${r}`),a=re(Lt,`${this.getImagePath()}/thumbnails/${r}`);Ue(o,i).then(h=>{me(h.ref).then(c=>this.getThumbnailURL(c,a,e,s)).catch(()=>e("Unable to get image URL."))}).then(()=>this.cacheImages()).catch(()=>e("Unable to upload image."))}async remove(i){if(Lt===void 0)return;const t=re(Lt,i.ref.fullPath);return await $e(t),await this.cacheImages()}}class lt{constructor(i,t,e,s,r,o,a,h){m(this,"id");m(this,"title");m(this,"authors");m(this,"description");m(this,"cover");m(this,"published");m(this,"editions");m(this,"domain");m(this,"uids");m(this,"media");this.id=i,this.title=t,this.authors=e,this.description=s,this.cover=r,this.published=o.some(c=>c.published!==null),this.editions=o.sort((c,u)=>c.number-u.number),this.domain=a,this.uids=h,this.media=new Ye(this)}getMedia(){return this.media}static fromJSON(i,t){return new lt(i,t.title,t.authors,t.description,t.cover,t.editions,t.domain,t.uids)}toJSON(){return{title:this.title,authors:this.authors,description:this.description,cover:this.cover,published:this.published,domain:this.domain,editions:this.editions,uids:this.uids,readuids:Array.from(new Set(this.editions.map(t=>[...t.editionuids,...t.chapteruids]).flat()))}}getSubdomain(){return this.domain}hasSubdomain(i){return this.domain===i}withSubdomain(i){return new lt(this.id,this.title,this.authors,this.description,this.cover,this.editions,i.length===0?null:i,this.uids)}getTitle(){return this.title}withTitle(i){return new lt(this.id,i,this.authors,this.description,this.cover,this.editions,this.domain,this.uids)}getDescription(){return this.description}withDescription(i){return new lt(this.id,this.title,this.authors,i,this.cover,this.editions,this.domain,this.uids)}getCover(){return this.cover}withCover(i){return new lt(this.id,this.title,this.authors,this.description,i,this.editions,this.domain,this.uids)}getAuthors(){return this.authors}withAuthors(i){return new lt(this.id,this.title,i,this.description,this.cover,this.editions,this.domain,this.uids)}getID(){return this.id}getEditionNumberID(i){const t=this.editions.find(e=>e.number===i);return t?t.ref.id:void 0}getLatestPublishedEditionID(){var i;return(i=this.editions.filter(t=>t.published!==null)[0])==null?void 0:i.ref.id}getLatestEditionID(){var i;return(i=this.editions[0])==null?void 0:i.ref.id}getEditions(){return this.editions.slice()}getPublishedEditionCount(){return this.editions.filter(i=>i.published).length}isEditor(i){return this.uids.includes(i)}withEditors(i){return new lt(this.id,this.title,this.authors,this.description,this.cover,this.editions,this.domain,i)}withEditions(i){return new lt(this.id,this.title,this.authors,this.description,this.cover,i,this.domain,this.uids)}withRevisedEdition(i,t){const e=t.getInfo();if(e===void 0)return this;if(i===void 0)return this.withEditions([...this.editions,e]);const s=this.editions.findIndex(r=>r.number===i.number);return s<0?this:this.withEditions([...this.editions.slice(0,s),e,...this.editions.slice(s+1)])}hasPublishedEdition(){return this.editions.some(i=>i.published!==null)}}function ae(d,i){return`books/${d}/editions/${i}`}const ne="Not connected to database";function fe(d,i){if(!S)throw ne;try{return le(Ne(jt(S,"books"),d),t=>i(t.empty?[]:t.docs.map(e=>lt.fromJSON(e.id,e.data()))))}catch{throw"Issue querying database"}}function xi(d){return fe(se("published","==",!0),d)}function vi(d,i){return fe(se("uids","array-contains",d),i)}function bi(d,i){return fe(se("readuids","array-contains",d),i)}function Ci(d,i){return fe(se("domain","==",d),i)}function Ii(d,i){if(!S)throw ne;return Ft(S,"books",d),le(Ft(S,"books",d),t=>{t.metadata.hasPendingWrites||i(t.exists()?lt.fromJSON(d,t.data()):null)})}function yi(d,i,t){if(!S)throw ne;return le(Ft(S,"books",d,"editions",i),e=>{e.metadata.hasPendingWrites||t(e.exists()?D.fromJSON(e.ref,e.data()):null)})}function Ri(d,i,t){if(!S)throw ne;return le(jt(S,"books",d,"editions",i,"chapters"),e=>{const s=[];e.forEach(r=>{s.push([r.ref,r.data().text])}),t(s)})}async function ki(d){if(!ue)throw Error("Can't publish, no connection to Firebase functions.");const t=await Be(ue,"getUserEmails")({uids:d});return new Map(Object.entries(t.data))}async function Ti(d){if(!ue)throw Error("Can't publish, no connection to Firebase functions.");return(await Be(ue,"createUserWithEmail")({email:d})).data}async function Ai(d){if(!S)throw Error("Can't create book, not connected to Firebase.");const i={title:"Untitled",authors:[],description:"",cover:null,published:!1,domain:null,editions:[],uids:[d],readuids:[]},t=await de(jt(S,"books"),i);let e=lt.fromJSON(t.id,i),s=new D(t,void 0,[],"Untitled",[],1,"",null,{},"",[],"All rights reserved.","",[],{},{},{},{},null,null,{}).withNewChapter();const r=await de(jt(S,"books",t.id,"editions"),s.toObject());s=s.withRef(r);const o=s.getInfo();return o&&(e=e.withEditions([o])),await Ie(e),await Pe(e,void 0,s),t.id}async function Oi(d){if(!S)throw Error("Can't publish draft, no Firebase connection.");const i=d.getLatestEditionID();if(i===void 0)throw"No editions on this book";const t=await He(Ft(S,"books",d.id,"editions",i)),e=t.exists()?t.data():void 0;if(e===void 0)return d;const s=e.withoutRefs(),r=await de(jt(S,"editions"),s.toObject());return Pe(d,void 0,s.withRef(r)),d=d.withEditions([s.getInfo(),...d.getEditions()]),Ie(d),d}async function _e(d,i,t,e){if(!S)throw ne;return d.editionRef===void 0?!1:e&&d.hasLease(i,t)||!e&&!d.hasLease(i,t)?!0:(await ce(Ft(S,ae(d.bookRef.id,d.editionRef.id)),d.withLock(i,t,e).toObject()),e)}async function Pe(d,i,t){if(!S)throw Error("Can't update edition, not connected to Firebase.");const e=t.getEditionRef();if(!e)throw Error("Book given has no ID");const s=new Map;for(const r of t.chapters)if(r.ref===void 0){const o=await de(jt(S,ae(t.bookRef.id,e.id),"chapters"),{text:r.text});t=t.withRevisedChapter(r,r.withRef(o)),s.set(r.id,o)}else{const o=i===void 0?void 0:i.getChapterByRef(r.ref);(o===void 0||r.text!==o.text)&&await ce(Ft(S,ae(t.bookRef.id,e.id),"chapters",r.ref.id),{text:r.text})}if(i)for(const r of i.chapters)r.ref&&t.getChapterByRef(r.ref)===void 0&&await We(r.ref);if(i!==void 0){const r=i.getInfo(),o=t.getInfo();if(r&&o){const a=Object.keys(r),h=Object.keys(o);(a.length!==h.length||!a.every(c=>r[c]===o[c]))&&Ie(d.withRevisedEdition(i,t))}}return await ce(Ft(S,ae(t.bookRef.id,e.id)),t.toObject()),s}async function Ie(d){if(!S)throw Error("Can't update book, not connected to Firebase.");await ce(Ft(S,"books",d.getID()),d.toJSON())}async function Li(d,i){if(!S)throw Error("Not connected to Firebase.");return await ti(d)===null}async function ti(d){if(!S)throw Error("Not connected to Firebase.");const i=await Ge(Ne(jt(S,"books"),se("domain","==",d)));return i.empty?null:i.docs[0].id}const ei=Symbol("dark");function Ni(){return xt(ei)}const ii=Symbol("user");function ge(){return xt(ii)}const si=Symbol("book");function ye(){return xt(si)}const ni=Symbol("edition");function Re(){return xt(ni)}const ri=Symbol("chaptertext");function Bi(){return xt(ri)}const oi=Symbol("chapter");function hi(){return xt(oi)}const ai=Symbol("root");function Fi(){return xt(ai)}function Si(d,i,t){const e=q(d);e&&d.set(e.withRevisedChapter(i,t))}function we(){var d;return((d=q(De).route.id)==null?void 0:d.startsWith("/(app)/write"))??!1}function Pi(){if(!we())return!1;const d=q(ge()),i=q(hi()),t=q(Re()),e=q(ye());return i!==void 0&&t!==void 0&&e!==void 0&&d!==void 0&&d.user!==null&&(i.chapter.isEditor(d.user.uid)||t.isEditor(d.user.uid)||e.isEditor(d.user.uid))}function Ei(){if(!we())return!1;const d=q(ge()),i=q(Re()),t=q(ye());return i!==void 0&&t!==void 0&&d!==void 0&&d.user!==null&&(i.isEditor(d.user.uid)||t.isEditor(d.user.uid))}function Mi(){if(!we())return!1;const d=q(ge()),i=q(Re());return i!==void 0&&d!==void 0&&d.user!==null&&i.isChapterEditor(d.user.uid)}function Di(){if(!we())return!1;const d=q(ge()),i=q(ye());return i!==void 0&&d!==void 0&&d.user!==null&&i.isEditor(d.user.uid)}const di=Symbol("base");function ji(){return xt(di)}const ci=Symbol("caret");function Ui(){return xt(ci)}const ui=Symbol("status");function $i(){return xt(ui)}const li=Symbol("editors");function Wi(){return xt(li)}async function Hi(d,i,t,e){const s=q(i),r=q(d);if(s&&r&&r.user){await _e(s,r.user.uid,t,e);const o=q(i),a=q(d);return o&&a&&a.user?(i.set(o.withLock(a.user.uid,t,e)),!0):!1}else return!1}function Gi(d,i,t){const e=q(i),s=q(d);if(e!==void 0&&s!==void 0&&s.user!==null){const r=e.getLeasee(t);return r===void 0?!1:r===s.user.uid?!0:r}else return!1}export{vi as $,T as A,si as B,pe as C,Kt as D,Dt as E,p as F,Ri as G,ei as H,Xt as I,di as J,lt as K,Yt as L,D as M,xi as N,ct as O,W as P,ve as Q,Ce as R,ui as S,g as T,ii as U,Pi as V,mt as W,ai as X,ji as Y,Ei as Z,ut as _,hi as a,bi as a0,Ai as a1,Si as a2,Li as a3,Hi as a4,Gi as a5,Mi as a6,Di as a7,N as a8,tt as a9,Tt as aa,ze as ab,qt as ac,xe as ad,pi as ae,Ni as af,Wi as ag,Ti as ah,Oi as ai,oi as aj,Z as ak,Ui as b,Fi as c,ye as d,be as e,ee as f,Re as g,te as h,Ht as i,$i as j,ge as k,ci as l,ni as m,ri as n,li as o,ki as p,Ie as q,Y as r,Vt as s,Gt as t,Pe as u,Jt as v,Ci as w,Ii as x,Bi as y,yi as z};