@outmarket-ai/react-sdk 0.1.0-alpha.4 → 0.1.0-alpha.5

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 (356) hide show
  1. package/dist/{AddNoteDialog-DVworhpI.js → AddNoteDialog-BFqKVczb.js} +1 -1
  2. package/dist/{AlertDialog-PgMpgwt1.js → AlertDialog-B5A0Q4IQ.js} +1 -1
  3. package/dist/{ApproveWorkflowsList-CK-waxz-.js → ApproveWorkflowsList-BOFGEqL5.js} +1 -1
  4. package/dist/{BORLetterEditor-DoZp3mO0.js → BORLetterEditor-BdJG-dx0.js} +1 -1
  5. package/dist/{BillDetailModal-DnPBDW-c.js → BillDetailModal-g56r3EEB.js} +1 -1
  6. package/dist/{CoiIssueHolderModal-DGVd4CSc.js → CoiIssueHolderModal-DTxQ7uEr.js} +1 -1
  7. package/dist/{DeletePromptDialog-Dhx6R7W7.js → DeletePromptDialog-D0dQixhy.js} +1 -1
  8. package/dist/{EmailFormatSelectionDialog-D8SE6FsN.js → EmailFormatSelectionDialog-BVYMu9hG.js} +1 -1
  9. package/dist/{ExcelExportPreviewDialog-DCRA-Wl7.js → ExcelExportPreviewDialog-d_yVrSbN.js} +1 -1
  10. package/dist/{ExplainPanel-Bhek4QEe.js → ExplainPanel-yadgv6xZ.js} +1 -1
  11. package/dist/{ExportDialog-z-dChevT.js → ExportDialog-dxDAeqKT.js} +1 -1
  12. package/dist/{ExportToAmsDialog-vWwf9tEN.js → ExportToAmsDialog-DU6w5x-T.js} +1 -1
  13. package/dist/{ExportToDriveDialog-Cp5l5n9d.js → ExportToDriveDialog-C31SnH54.js} +1 -1
  14. package/dist/{FeedbackTool-rTqaNBeg.js → FeedbackTool-Die_bfsW.js} +1 -1
  15. package/dist/{LayerDetailModal-CsKEVGkh.js → LayerDetailModal-DXiyhJU5.js} +1 -1
  16. package/dist/{LogoEditor-BYu9iugA.js → LogoEditor-DL2Y4KWG.js} +1 -1
  17. package/dist/{MarkdownExportPreviewDialog-Df_gX66S.js → MarkdownExportPreviewDialog-Cz1jDiw2.js} +1 -1
  18. package/dist/{NotificationDrawer-lC_1oEWC.js → NotificationDrawer-ASEbPZnQ.js} +1 -1
  19. package/dist/{PhoneNumbersDisplay-Cw-jAPNw.js → PhoneNumbersDisplay-PjaAe7_T.js} +1 -1
  20. package/dist/{PlanSelector-Bh4JzMql.js → PlanSelector-DoCZpvIh.js} +1 -1
  21. package/dist/{PlanSettingsModal-BlhE5SFt.js → PlanSettingsModal-CFWzZXZR.js} +1 -1
  22. package/dist/{PlanWizardModal-B7Dhf0go.js → PlanWizardModal-BopYR9-W.js} +1 -1
  23. package/dist/{RenameAssetDialog-DCd7aA4Y.js → RenameAssetDialog-CPrytCjJ.js} +1 -1
  24. package/dist/{SaveBlockDialog-ELOfUMl3.js → SaveBlockDialog-qP5X8XtG.js} +1 -1
  25. package/dist/{SaveOutlineDialog-CqtRpJ8p.js → SaveOutlineDialog-CjV5KYh1.js} +1 -1
  26. package/dist/{SavePromptDialog-D6_NBFqf.js → SavePromptDialog-Cnqj_Bcr.js} +1 -1
  27. package/dist/{ShareResourceDialog-hr-6ey98.js → ShareResourceDialog-CnuXPaqj.js} +1 -1
  28. package/dist/{TermsNoticeModal-DWvhC9R5.js → TermsNoticeModal-CE1Dg3gg.js} +1 -1
  29. package/dist/{TowerAlertModal-Det-z3UZ.js → TowerAlertModal-DLBXzopZ.js} +1 -1
  30. package/dist/{TowerSummaryModal-BiqEA0S9.js → TowerSummaryModal-Bp3m0UDX.js} +1 -1
  31. package/dist/{VaultSettingsDialog-DCzqFdbE.js → VaultSettingsDialog-Cdaxi_Ts.js} +1 -1
  32. package/dist/{ViewNoteDialog-DOcnWTYn.js → ViewNoteDialog-DwEHlpoH.js} +1 -1
  33. package/dist/{WhatsNewProvider-BAZ3AzDG.js → WhatsNewProvider-Dx-XX1g6.js} +1 -1
  34. package/dist/{WidgetRawDataView-BSxQLAtp.js → WidgetRawDataView-lO3i7T5S.js} +1 -1
  35. package/dist/{abap-DO2K4iWT.js → abap-BFj82fkC.js} +1 -1
  36. package/dist/{abnf-CWAPtxDt.js → abnf-d-MGygKq.js} +1 -1
  37. package/dist/{actionscript-TzpIbBzh.js → actionscript-DijFJFtb.js} +1 -1
  38. package/dist/{activityLog-B3BPmYcY.js → activityLog-BWQ8gAUv.js} +1 -1
  39. package/dist/{ada-DfgSF6rv.js → ada-r7gDH1uf.js} +1 -1
  40. package/dist/{agda-UhEpUG16.js → agda-VjRLXwUK.js} +1 -1
  41. package/dist/{al-C9IWUhja.js → al-C9SzJ03b.js} +1 -1
  42. package/dist/{antlr4-CMH6c8vE.js → antlr4-CVJG_Iq1.js} +1 -1
  43. package/dist/{apacheconf-DchiyKF6.js → apacheconf-aGq2cAAj.js} +1 -1
  44. package/dist/{apex-DoFS3if4.js → apex-DZ_fjkZD.js} +1 -1
  45. package/dist/{apl-DrvmmUC5.js → apl-C3NFkx8o.js} +1 -1
  46. package/dist/{applescript-7MxODg4-.js → applescript-4_VUUqQq.js} +1 -1
  47. package/dist/{aql-BD-VCYyW.js → aql--QB48lve.js} +1 -1
  48. package/dist/{arduino-CeMP01z0.js → arduino-NbwA2H0i.js} +1 -1
  49. package/dist/{arff-BD9TKSJ7.js → arff-zXC-IU2S.js} +1 -1
  50. package/dist/{asciidoc-ClhPpI2V.js → asciidoc-CnmdySho.js} +1 -1
  51. package/dist/{asm6502-p73yggnw.js → asm6502-_09Vl8ie.js} +1 -1
  52. package/dist/{asmatmel-CYWJzOZI.js → asmatmel-DRYw6d4s.js} +1 -1
  53. package/dist/{aspnet-Ce6okmoX.js → aspnet-wtoec4Si.js} +1 -1
  54. package/dist/{autohotkey-BQ4k1ZoR.js → autohotkey-q33-X-ib.js} +1 -1
  55. package/dist/{autoit-D-QYSnVB.js → autoit-AVjxlVTl.js} +1 -1
  56. package/dist/{avisynth-BU_5fN-E.js → avisynth-CL1jY12A.js} +1 -1
  57. package/dist/{avro-idl-D3oTLpnC.js → avro-idl-BCRDgQ4P.js} +1 -1
  58. package/dist/{bash-BsJ0FYh7.js → bash-DzUGEPU8.js} +1 -1
  59. package/dist/{basic-C3aWC6RN.js → basic-DmuTbotZ.js} +1 -1
  60. package/dist/{batch-D5odmLgC.js → batch-DVaLAYQT.js} +1 -1
  61. package/dist/{bbcode-BaVPhTeQ.js → bbcode-71txf6aK.js} +1 -1
  62. package/dist/{bell-Boo5_RfV.js → bell-D5P50-Cy.js} +1 -1
  63. package/dist/{bicep-BGa5z2OW.js → bicep-CTyTB8VV.js} +1 -1
  64. package/dist/{birb-CS1-2V3J.js → birb-Us_iim8V.js} +1 -1
  65. package/dist/{bison-BHaaHT3v.js → bison-B9t1S-Ec.js} +1 -1
  66. package/dist/{blockEditorContent-D5VnBuIl.js → blockEditorContent-B7w6VixN.js} +1 -1
  67. package/dist/{bnf-dY1z4swK.js → bnf-BZsZs4W_.js} +1 -1
  68. package/dist/{brainfuck-CK9lWVz7.js → brainfuck-DZBnWcdB.js} +1 -1
  69. package/dist/{brightscript-D6FFooBs.js → brightscript-ByjyfIKe.js} +1 -1
  70. package/dist/{bro-Bt8gF2px.js → bro-DFWEKeXC.js} +1 -1
  71. package/dist/{bsl-DKXIZmOj.js → bsl-VkVz6nie.js} +1 -1
  72. package/dist/{c-B-2k_Fzd.js → c-tj18QBkg.js} +1 -1
  73. package/dist/{calendar-DxMBLT5c.js → calendar-BnD6Fz6s.js} +1 -1
  74. package/dist/{cfscript-CzAebbQY.js → cfscript-knqemS9O.js} +1 -1
  75. package/dist/{chaiscript-BtFfenwh.js → chaiscript-ErUM1sKB.js} +1 -1
  76. package/dist/{cil-DB7kYah2.js → cil-3EPmDz3O.js} +1 -1
  77. package/dist/{clike-ByLAhiiD.js → clike-C_n99p7n.js} +1 -1
  78. package/dist/{clojure-B0O6w5xx.js → clojure-C72Tz5Go.js} +1 -1
  79. package/dist/{cmake-DUSL6ndO.js → cmake-CxGwTbqi.js} +1 -1
  80. package/dist/{cobol-D2Jms6i1.js → cobol-B5Vm7mhM.js} +1 -1
  81. package/dist/{coffeescript-4IYyCIvX.js → coffeescript-CzPQdZGx.js} +1 -1
  82. package/dist/{concurnas-BAabfTbt.js → concurnas-B602GXTT.js} +1 -1
  83. package/dist/{contactsList-JTOPBCtO.js → contactsList-Drnl9PuT.js} +2 -2
  84. package/dist/{copyPreviewToClipboard-CZq6_tqM.js → copyPreviewToClipboard-DlYtI7OU.js} +1 -1
  85. package/dist/{coq-C-bHpO1v.js → coq-BUrdQjPC.js} +1 -1
  86. package/dist/{core-dahUPM1O.js → core-bYH40U-s.js} +1 -1
  87. package/dist/{cpp-CMfWp1GT.js → cpp-BF2RkL9p.js} +1 -1
  88. package/dist/{crystal-pURgJz0j.js → crystal-CH7TXhqt.js} +1 -1
  89. package/dist/{csharp-hRQi5p8l.js → csharp-Ca_ZibKY.js} +1 -1
  90. package/dist/{cshtml-COyBRHgd.js → cshtml-CmouUxlH.js} +1 -1
  91. package/dist/{csp-DpKVmOtl.js → csp-DQ7bdPJD.js} +1 -1
  92. package/dist/{css-CvdoMil_.js → css-DOBmtXeh.js} +1 -1
  93. package/dist/{css-extras-yl5cKfeT.js → css-extras-BA9bazu-.js} +1 -1
  94. package/dist/{csv-DDkBLHxr.js → csv-B6QYQjOr.js} +1 -1
  95. package/dist/{cypher-D3SgGEIt.js → cypher-QrjZiaiW.js} +1 -1
  96. package/dist/{d-CKRL6bOv.js → d-CUuLy72U.js} +1 -1
  97. package/dist/{dart-k5i49MdZ.js → dart-CU1ATRnE.js} +1 -1
  98. package/dist/{dataweave-C2jQLO6A.js → dataweave-BO9-ic9I.js} +1 -1
  99. package/dist/{dax-DX2GtdeQ.js → dax-D-B-zdpU.js} +1 -1
  100. package/dist/{dhall-CIs5mqxE.js → dhall-DwmQxkEA.js} +1 -1
  101. package/dist/{diff-Cpe4kLkd.js → diff-BEoEnhvj.js} +1 -1
  102. package/dist/{django-CxMiLs-C.js → django-B80wc6Mt.js} +1 -1
  103. package/dist/{dns-zone-file-D8pyQ4U-.js → dns-zone-file-CzEjjFmu.js} +1 -1
  104. package/dist/{docker-DdqDWFn0.js → docker-NHXuYEF5.js} +1 -1
  105. package/dist/{dot-DWMBdz51.js → dot-fk45y7qK.js} +1 -1
  106. package/dist/{ebnf-DuREZmgV.js → ebnf-CvSMtCQA.js} +1 -1
  107. package/dist/{editCarrierDialog-DGmb5Q7u.js → editCarrierDialog-Dta8pB-f.js} +1 -1
  108. package/dist/{editorconfig-aeClCGV2.js → editorconfig-C7onPTlB.js} +1 -1
  109. package/dist/{eiffel-CGalHsS_.js → eiffel-Dy7iQWGA.js} +1 -1
  110. package/dist/{ejs-B1DlgKEP.js → ejs-CTbOCEgz.js} +1 -1
  111. package/dist/{elixir-DnbdN_75.js → elixir-C_LRALnG.js} +1 -1
  112. package/dist/{elm-CVoFCGPP.js → elm-D8NarkA1.js} +1 -1
  113. package/dist/{erb-CQhG6xLV.js → erb-ZX988up0.js} +1 -1
  114. package/dist/{erlang-rpUGZnhm.js → erlang-CBQVWNW-.js} +1 -1
  115. package/dist/{etlua-Dkk0Q9vi.js → etlua-F-tmQkF_.js} +1 -1
  116. package/dist/{excel-formula-BMMClb5l.js → excel-formula-CJZ9tRP5.js} +1 -1
  117. package/dist/{exportFileGeneration-C2AmVa2I.js → exportFileGeneration-DXYd0nVL.js} +1 -1
  118. package/dist/{exportImageReadiness-CKbk6ouE.js → exportImageReadiness-BLHV4KA3.js} +1 -1
  119. package/dist/{exportImageReadinessNotifier-BdGb_jYS.js → exportImageReadinessNotifier-MPE3aQ-X.js} +1 -1
  120. package/dist/{exportPageHtml-DTMmohn8.js → exportPageHtml-nOa0TJeA.js} +1 -1
  121. package/dist/{exportPreviewToDocx-aug3Vo5O.js → exportPreviewToDocx-BUqku1Sa.js} +2 -2
  122. package/dist/{exportPreviewToPdf-CU5noJGQ.js → exportPreviewToPdf-C6wvIs_-.js} +1 -1
  123. package/dist/{factor-CO9XN1sC.js → factor-tIVreoq5.js} +1 -1
  124. package/dist/{false-DupdfhN_.js → false-CJu2Anx0.js} +1 -1
  125. package/dist/{firestore-security-rules-CCs_B9tQ.js → firestore-security-rules-CmUapWLQ.js} +1 -1
  126. package/dist/{flask-conical-BwSs4rQp.js → flask-conical-D21xFJN8.js} +1 -1
  127. package/dist/{flow-BOj57yFZ.js → flow-B15PTRNZ.js} +1 -1
  128. package/dist/{fortran-CYrSpZx5.js → fortran-BmJihbbX.js} +1 -1
  129. package/dist/{fsharp-uiOUOdp9.js → fsharp-BscjUi5J.js} +1 -1
  130. package/dist/{ftl-DpuLEYui.js → ftl-BGGXJ6KT.js} +1 -1
  131. package/dist/{gap-D-fUFq1_.js → gap-WxK7VHL3.js} +1 -1
  132. package/dist/{gcode-CDyds_er.js → gcode-CAh6zFOb.js} +1 -1
  133. package/dist/{gdscript-FqcuLyHx.js → gdscript-C1mVAaUg.js} +1 -1
  134. package/dist/{gedcom-CaRtP_h2.js → gedcom-DGTcIBSF.js} +1 -1
  135. package/dist/{gherkin-BJsmZGWs.js → gherkin-DE4Wrwgu.js} +1 -1
  136. package/dist/{git-D5uqp_DK.js → git-BIbzT_PX.js} +1 -1
  137. package/dist/{glsl-BFDcfHdp.js → glsl-DUNURAiH.js} +1 -1
  138. package/dist/{gml-CRAABc14.js → gml-DaqEftOj.js} +1 -1
  139. package/dist/{gn-fI9NBu0T.js → gn-DQLaa9yu.js} +1 -1
  140. package/dist/{go-_DK2Syrs.js → go-XU9tHkkW.js} +1 -1
  141. package/dist/{go-module-C43GA4Kk.js → go-module-DX8m7Pg-.js} +1 -1
  142. package/dist/{graphql-CVLxu_XQ.js → graphql-Do6wpdr2.js} +1 -1
  143. package/dist/{groovy-BS0tD1VI.js → groovy-DrAxE0jg.js} +1 -1
  144. package/dist/{haml-xEdOEX2s.js → haml-qsQsVIlw.js} +1 -1
  145. package/dist/{handlebars-CuEcCKs9.js → handlebars-BXLdUzMW.js} +1 -1
  146. package/dist/{haskell-Df1RY4qu.js → haskell-D_0g1ASO.js} +1 -1
  147. package/dist/{haxe-UhfBaz70.js → haxe-Cy-38gzD.js} +1 -1
  148. package/dist/{hcl-1HqdHuVp.js → hcl-oQWxokEc.js} +1 -1
  149. package/dist/{highlighter-Buwe0rNe.js → highlighter-CURsYV0l.js} +1 -1
  150. package/dist/{hlsl-BAqhaLDA.js → hlsl-CfKrPbMI.js} +1 -1
  151. package/dist/{hoon-C3_iwBYG.js → hoon-9J2XJltI.js} +1 -1
  152. package/dist/{hpkp-ARJfZ4mC.js → hpkp-DKtH5vql.js} +1 -1
  153. package/dist/{hsts-D1J-QDMh.js → hsts-HQ3HWkgX.js} +1 -1
  154. package/dist/{http-Da4WxW2B.js → http-64c8Hjvf.js} +1 -1
  155. package/dist/{ichigojam-DleLLCDI.js → ichigojam-C6-0kxfY.js} +1 -1
  156. package/dist/{icon-Xt4F5-NV.js → icon-C-_ByOv_.js} +1 -1
  157. package/dist/{icu-message-format-WqKqnC9Y.js → icu-message-format-BPQ1nVKD.js} +1 -1
  158. package/dist/{idris-BqfGiGlD.js → idris-CoZEo5pm.js} +1 -1
  159. package/dist/{iecst-Cc_XBUs1.js → iecst-BnTzoxhf.js} +1 -1
  160. package/dist/{ignore-gATfvIE1.js → ignore-DfnWViB9.js} +1 -1
  161. package/dist/{image-plus-CO1yH2Ow.js → image-plus-BwG5nZ7K.js} +1 -1
  162. package/dist/{index-C6KnW8Cr.js → index-BepnFeVC.js} +1 -1
  163. package/dist/index-Bu3qyOV8.js +1 -0
  164. package/dist/{index-Df4zFd9n.js → index-BwYwjETZ.js} +1 -1
  165. package/dist/{index-BhoJBdgR.js → index-C1P1_CNq.js} +1 -1
  166. package/dist/{index-C6TitxT6.js → index-DECNOj9-.js} +1 -1
  167. package/dist/{index-DmLpfBZR.js → index-DScMTeaz.js} +1 -1
  168. package/dist/{index-BPrphOc0.js → index-Dxbj7vIl.js} +1 -1
  169. package/dist/{index.client-88ufWAAE.js → index.client-B5zFhoJh.js} +1 -1
  170. package/dist/index.js +1 -1
  171. package/dist/{inform7-BgEHvsCZ.js → inform7-BPRO3aAa.js} +1 -1
  172. package/dist/{ini-BtEy4MK2.js → ini-zHUVjgUr.js} +1 -1
  173. package/dist/{io-CSvpapn4.js → io-Bv95cSmU.js} +1 -1
  174. package/dist/{j-Didym1W-.js → j-BtSzS9Pj.js} +1 -1
  175. package/dist/{java-CkdA89my.js → java-CBX7Afrh.js} +1 -1
  176. package/dist/{javadoc-BYLSROwK.js → javadoc-BjHPomnu.js} +1 -1
  177. package/dist/{javadoclike-CGYELFtX.js → javadoclike-Ddq_PySg.js} +1 -1
  178. package/dist/{javascript-CKtGWKVN.js → javascript-D1cz2ex2.js} +1 -1
  179. package/dist/{javastacktrace-B00BRtrk.js → javastacktrace-1s18mRzp.js} +1 -1
  180. package/dist/{jexl-3pbGX8yg.js → jexl-CTXCBi6O.js} +1 -1
  181. package/dist/{jolie-D7NjWzie.js → jolie-D8W3RneJ.js} +1 -1
  182. package/dist/{jq-DXIstDdt.js → jq-AO_BccyZ.js} +1 -1
  183. package/dist/{js-extras-H4uavHsm.js → js-extras-DWMW29Iv.js} +1 -1
  184. package/dist/{js-templates-B6Ita7EV.js → js-templates-CDbWfi7F.js} +1 -1
  185. package/dist/{jsdoc-QUxFVOXY.js → jsdoc-DEcTie_T.js} +1 -1
  186. package/dist/{json-B0y3Rda9.js → json-C1Z0IfeX.js} +1 -1
  187. package/dist/{json5-BehiI5_D.js → json5-doDfZZ34.js} +1 -1
  188. package/dist/{jsonp-Bb_Gc27H.js → jsonp-n4iW7eMt.js} +1 -1
  189. package/dist/{jsstacktrace-7j6SVBSu.js → jsstacktrace-CRqg9RfL.js} +1 -1
  190. package/dist/{jsx-mg9vUZeR.js → jsx-Jvs6xdub.js} +1 -1
  191. package/dist/{julia-yWSJJybO.js → julia-BqA0NZPA.js} +1 -1
  192. package/dist/{keepalived-BleZRAIN.js → keepalived-haaPzWka.js} +1 -1
  193. package/dist/{keyman-Cf58Lywg.js → keyman-B93Tzmac.js} +1 -1
  194. package/dist/{kotlin-BKqcpAwe.js → kotlin-CaZ-4WIR.js} +1 -1
  195. package/dist/{kumir-qw3I30oC.js → kumir-DQfWFmny.js} +1 -1
  196. package/dist/{kusto-C__Nks-2.js → kusto-mDWog6AD.js} +1 -1
  197. package/dist/{latex-CqEHEnk2.js → latex-U8CFQzLE.js} +1 -1
  198. package/dist/{latte-CWEUU8e2.js → latte-BvtZqu7t.js} +1 -1
  199. package/dist/{less-3nOPsPiL.js → less-C00dmRdl.js} +1 -1
  200. package/dist/{lilypond-BkWk0b-E.js → lilypond-AhMKLq3F.js} +1 -1
  201. package/dist/{link-2-off-DZ6Fftvz.js → link-2-off-B2Y-IvB0.js} +1 -1
  202. package/dist/{liquid-CxH6TiQl.js → liquid-BjLB3No7.js} +1 -1
  203. package/dist/{lisp-BqfK9Hgz.js → lisp-Bp0TVHeN.js} +1 -1
  204. package/dist/{livescript-DxFySKSC.js → livescript-Ce009BRo.js} +1 -1
  205. package/dist/{llvm-CggHQ6lD.js → llvm-Ilm4p1-X.js} +1 -1
  206. package/dist/{lock-keyhole-B9Z5S-TO.js → lock-keyhole-BVZK5CqU.js} +1 -1
  207. package/dist/{log-C-_cUEEi.js → log-BeI8INbW.js} +1 -1
  208. package/dist/{lolcode-BQDXN4fM.js → lolcode-jAfjVf4Z.js} +1 -1
  209. package/dist/{lua-EACVudL-.js → lua-RtaSlmjN.js} +1 -1
  210. package/dist/{lucide-react-BFep-4-F.js → lucide-react-DepvLOwl.js} +1 -1
  211. package/dist/{luckyexcel.umd-CyYOC7kV.js → luckyexcel.umd-D9DarZEc.js} +1 -1
  212. package/dist/{magma-ClRm5PT8.js → magma-DlB3_pMN.js} +1 -1
  213. package/dist/{makefile-iWsaltUo.js → makefile--48ExQFt.js} +1 -1
  214. package/dist/{markdown-Cig1eXAg.js → markdown-B_mycPiS.js} +1 -1
  215. package/dist/{markup-DCwRIlpj.js → markup-BaaXmLT8.js} +1 -1
  216. package/dist/{markup-templating-CGVke3UH.js → markup-templating-u9YGVCKn.js} +1 -1
  217. package/dist/{matlab-DgD6_SjW.js → matlab-BDgcK20L.js} +1 -1
  218. package/dist/{maxscript-cKebt-Dy.js → maxscript-CeJB8Ecj.js} +1 -1
  219. package/dist/{mel-CEKGMyLY.js → mel-x0R2Wim4.js} +1 -1
  220. package/dist/{mermaid-DXgzB5JN.js → mermaid-C7tLV2_j.js} +1 -1
  221. package/dist/{mizar-BzDW-ykC.js → mizar-D5L8FTiA.js} +1 -1
  222. package/dist/{mongodb-BJLR68zT.js → mongodb-Bdmmzp2M.js} +1 -1
  223. package/dist/{monkey-JM8UNtrR.js → monkey-BRRY4tyA.js} +1 -1
  224. package/dist/{moonscript-BH2Xjrgb.js → moonscript-DNZINKKY.js} +1 -1
  225. package/dist/{n1ql-CSPAM6un.js → n1ql-WOjzO2eo.js} +1 -1
  226. package/dist/{n4js-BWYVZEox.js → n4js-BR1qKw7L.js} +1 -1
  227. package/dist/{nand2tetris-hdl-DB8e4A3h.js → nand2tetris-hdl-296qg9ap.js} +1 -1
  228. package/dist/{naniscript-I4eJIJgf.js → naniscript-NKeqC3C4.js} +1 -1
  229. package/dist/{nasm-DX_py-dz.js → nasm-DxH9bTAb.js} +1 -1
  230. package/dist/{neon-DkAB0STZ.js → neon-CRWzIjmn.js} +1 -1
  231. package/dist/{nevod-D7cLSUTe.js → nevod-BrH5YOHR.js} +1 -1
  232. package/dist/{nginx-ChrufzUl.js → nginx-CorxjDIB.js} +1 -1
  233. package/dist/{nim-BxK5p60z.js → nim-Db8ot6UP.js} +1 -1
  234. package/dist/{nix-DO-Kh-dL.js → nix-wXaMgcLn.js} +1 -1
  235. package/dist/{nsis-ftQZglgh.js → nsis-CDk-_p5C.js} +1 -1
  236. package/dist/{objectivec-BzVO_B18.js → objectivec-69VS7Pid.js} +1 -1
  237. package/dist/{ocaml-DJ0xU0Mz.js → ocaml-B09craEt.js} +1 -1
  238. package/dist/{opencl-DHx1EorL.js → opencl-BxceJXoM.js} +1 -1
  239. package/dist/{openqasm-DRp1Pd2Y.js → openqasm-CxZgZxtA.js} +1 -1
  240. package/dist/{oz-DyACzc4-.js → oz-DLZvzCIz.js} +1 -1
  241. package/dist/{paintbrush-DEfgsxEB.js → paintbrush-Bda6Gd8g.js} +1 -1
  242. package/dist/{parigp-BalQj1yZ.js → parigp-DXGLanD6.js} +1 -1
  243. package/dist/{parser-BFWej3kv.js → parser-DxcxPNZt.js} +1 -1
  244. package/dist/{pascal-DLXltWIS.js → pascal-CMq9CY5z.js} +1 -1
  245. package/dist/{pascaligo-CqJ3PtbA.js → pascaligo-CdT5PN9X.js} +1 -1
  246. package/dist/{pcaxis-BaKMqj0j.js → pcaxis-DFR3cdbT.js} +1 -1
  247. package/dist/{pen-tool-CUcy0GZ_.js → pen-tool-BEWBeln3.js} +1 -1
  248. package/dist/{peoplecode-C09vco0R.js → peoplecode-BDakrQ7O.js} +1 -1
  249. package/dist/{perl-CoE2XjzQ.js → perl-k5LyouXi.js} +1 -1
  250. package/dist/{php-B86DKdpZ.js → php-DfZD1VLq.js} +1 -1
  251. package/dist/{php-extras-sfNZZS76.js → php-extras-MpaRPVSc.js} +1 -1
  252. package/dist/{phpdoc-Bzw05jie.js → phpdoc-DX03jeRL.js} +1 -1
  253. package/dist/{plsql-CS0eQem7.js → plsql-_EoXFiET.js} +1 -1
  254. package/dist/{plyr-EEbww6qs.js → plyr-u-nUGKGf.js} +1 -1
  255. package/dist/{powerquery-B6olBSow.js → powerquery-zcuGCGDd.js} +1 -1
  256. package/dist/{powershell-Cp_DczCV.js → powershell-BGwhav3B.js} +1 -1
  257. package/dist/{processing-Cd_bV0xW.js → processing-C1wwuk_a.js} +1 -1
  258. package/dist/{prolog-DXVSkVC4.js → prolog-7buhcocm.js} +1 -1
  259. package/dist/{promql-BabLYLLJ.js → promql-Bg1w7_hg.js} +1 -1
  260. package/dist/{properties-DkT5ynaz.js → properties-BtISaJQV.js} +1 -1
  261. package/dist/{protobuf-CYBJhc9z.js → protobuf-MSwSG1bm.js} +1 -1
  262. package/dist/{psl-D2uvv-7O.js → psl-8CK4lzxB.js} +1 -1
  263. package/dist/{pug-w53q9tFf.js → pug-BgYTWTwT.js} +1 -1
  264. package/dist/{puppet-DUtockK4.js → puppet-CzZ4t1kd.js} +1 -1
  265. package/dist/{pure-BvQ49iyV.js → pure-DsPXw07p.js} +1 -1
  266. package/dist/{purebasic-VNPGPitL.js → purebasic-BP0XCW9e.js} +1 -1
  267. package/dist/{purescript-jeg8VLBQ.js → purescript-Bmks6H_G.js} +1 -1
  268. package/dist/{python-DwgIeMCw.js → python-IZ5Cl5_j.js} +1 -1
  269. package/dist/{q-98VTpKuT.js → q-qhgWfu2A.js} +1 -1
  270. package/dist/{qml-Bmc9qK-i.js → qml-LhySLLKo.js} +1 -1
  271. package/dist/{qore-CI-uQgYX.js → qore-sUIrInnk.js} +1 -1
  272. package/dist/{qsharp-DcdJVbL1.js → qsharp-kXM5Glz4.js} +1 -1
  273. package/dist/{quill-DCQohBYq.js → quill-CAQd2XNe.js} +1 -1
  274. package/dist/{r-DOkiw5xi.js → r-B_o-K-oG.js} +1 -1
  275. package/dist/{racket-D0ciUaKZ.js → racket-DBg52WRV.js} +1 -1
  276. package/dist/{reason-_vfxWgtu.js → reason-B4RxpG6a.js} +1 -1
  277. package/dist/{regex-DE0tGMua.js → regex-5kLDsT68.js} +1 -1
  278. package/dist/{rego-B8y6TW0Q.js → rego-CSNIvZJc.js} +1 -1
  279. package/dist/{renpy-C0JjmKd8.js → renpy-9amCyfN6.js} +1 -1
  280. package/dist/{rest-OrcBO0tU.js → rest-CiSQpBvu.js} +1 -1
  281. package/dist/{rip-CuSj2R3f.js → rip-bQamghlK.js} +1 -1
  282. package/dist/{roboconf-DwWl8zjT.js → roboconf-C9ixzobq.js} +1 -1
  283. package/dist/{robotframework-Z7I8QRqO.js → robotframework-DI8qVoWb.js} +1 -1
  284. package/dist/{ruby-pRRjQgKE.js → ruby-zdZlmF95.js} +1 -1
  285. package/dist/{runtime-E_iChIE5.js → runtime-Epi5dRMP.js} +25 -25
  286. package/dist/{rust-C0qbxx_t.js → rust-CIxZvyTa.js} +1 -1
  287. package/dist/{sas-Bud4-smM.js → sas-CxJiNmJN.js} +1 -1
  288. package/dist/{sass-CqDaYCFL.js → sass-BTgFDAPx.js} +1 -1
  289. package/dist/{scala-FNuAyCC5.js → scala-BuPoIa9o.js} +1 -1
  290. package/dist/{scheme-Bo5woo70.js → scheme-w2E2gymp.js} +1 -1
  291. package/dist/{scss-D4o3ki9S.js → scss-DHVSAU8G.js} +1 -1
  292. package/dist/{shell-session-D_3Wy0-M.js → shell-session-VvuBbTfv.js} +1 -1
  293. package/dist/{smali-D9Vl7REz.js → smali-DGgfZVy3.js} +1 -1
  294. package/dist/{smalltalk-DqKxBD7R.js → smalltalk-Bh1MmXkH.js} +1 -1
  295. package/dist/{smarty-DkRR5e3j.js → smarty--rGsXfQG.js} +1 -1
  296. package/dist/{sml-D5CAsBy7.js → sml-DPj1eRFK.js} +1 -1
  297. package/dist/{solidity-C5c1z119.js → solidity-RzPZUy8G.js} +1 -1
  298. package/dist/{solution-file-CUsgeaWQ.js → solution-file-Dbe0ySFo.js} +1 -1
  299. package/dist/{soy-DTStOcmc.js → soy-1idTlTs5.js} +1 -1
  300. package/dist/{sparql-CDn9g55l.js → sparql-CJhju5B-.js} +1 -1
  301. package/dist/{splunk-spl-ReF1fdpD.js → splunk-spl-No3ABOw1.js} +1 -1
  302. package/dist/{sqf-Bqx_jZDw.js → sqf-CmpM-Ycb.js} +1 -1
  303. package/dist/{sql-ibhCFPiq.js → sql-JaWcgd5f.js} +1 -1
  304. package/dist/{squirrel-D9oGXfit.js → squirrel-DgcEUXhq.js} +1 -1
  305. package/dist/{stan-BRZBUsbz.js → stan-DpnDy_tS.js} +1 -1
  306. package/dist/styles.css +1 -1
  307. package/dist/{stylus-yYQctMq3.js → stylus-tgSdsOBY.js} +1 -1
  308. package/dist/{swift-BUjCDnyk.js → swift-CNoXcjp3.js} +1 -1
  309. package/dist/{systemd-CV4Y8OgX.js → systemd-C6uFJYy3.js} +1 -1
  310. package/dist/{t4-cs-DMcxL6mp.js → t4-cs-D829QSSW.js} +1 -1
  311. package/dist/{t4-templating-ZACiT0zT.js → t4-templating-DTgQCOVB.js} +1 -1
  312. package/dist/{t4-vb-B8J5Hps_.js → t4-vb-BB9cD-f7.js} +1 -1
  313. package/dist/{table-4acwkuJg.js → table-DrqiRBcA.js} +1 -1
  314. package/dist/{tap-Bx6Iqyzs.js → tap-DKm74Qmu.js} +1 -1
  315. package/dist/{tcl-CVwB3Dsw.js → tcl-BVidQ2wK.js} +1 -1
  316. package/dist/{templateSelectorDialog-Dcz6NH6A.js → templateSelectorDialog-Db4k8gIl.js} +2 -2
  317. package/dist/{textile-IaxKlkk0.js → textile-CgVl-H2o.js} +1 -1
  318. package/dist/{toml-DjZHuZX5.js → toml-BJCWGGmW.js} +1 -1
  319. package/dist/{tremor-CznQ9vJF.js → tremor-XJODhidW.js} +1 -1
  320. package/dist/{tsx-BmNJPw2C.js → tsx-BWfohWSQ.js} +1 -1
  321. package/dist/{tt2-Ctxpxu1u.js → tt2-DkdrSMst.js} +1 -1
  322. package/dist/{turtle-BZPYYKLu.js → turtle-CKRX5-Y9.js} +1 -1
  323. package/dist/{twig-Cw8jSiqx.js → twig-CfftD9wM.js} +1 -1
  324. package/dist/{typescript-cZ9h0V2d.js → typescript-D_0m_1xR.js} +1 -1
  325. package/dist/{typoscript-WQ7YKLB-.js → typoscript-BMe73WN3.js} +1 -1
  326. package/dist/{unrealscript-UXeEAnKD.js → unrealscript-BTjx7r2m.js} +1 -1
  327. package/dist/{uorazor-BtAxw67D.js → uorazor-DlpE1SwD.js} +1 -1
  328. package/dist/{uri-BE83Qwvw.js → uri-Bi6UkGG9.js} +1 -1
  329. package/dist/{usePromptLibraryMutations-BM83duEt.js → usePromptLibraryMutations-DbhMrCr6.js} +1 -1
  330. package/dist/{useSupabaseBlobUrl-DnJSMs0R.js → useSupabaseBlobUrl-COHpP0Oe.js} +1 -1
  331. package/dist/{useTermsNotice-94RI9CUn.js → useTermsNotice-uvdqGgvU.js} +1 -1
  332. package/dist/{user-plus-5w3t48xd.js → user-plus-CBb6a4OE.js} +1 -1
  333. package/dist/{user-round-plus-BRIw6kPj.js → user-round-plus-BQZMiRsx.js} +1 -1
  334. package/dist/{v-DpgFP2Dd.js → v-q9Dyv2u4.js} +1 -1
  335. package/dist/{vala-DEwsaN_K.js → vala-CbtLCG-6.js} +1 -1
  336. package/dist/{vbnet-BeaS2z7x.js → vbnet-MV6Qwc98.js} +1 -1
  337. package/dist/{velocity-C58bvCMW.js → velocity-CtwhXtiC.js} +1 -1
  338. package/dist/{verilog-DpW-M8YY.js → verilog-CysyKyLX.js} +1 -1
  339. package/dist/{vhdl-CES-ghMR.js → vhdl-wk_c4oqB.js} +1 -1
  340. package/dist/{vim-DmYuq9CP.js → vim-B_d8CqW4.js} +1 -1
  341. package/dist/{visual-basic-DrzTY1tX.js → visual-basic-988L0ydQ.js} +1 -1
  342. package/dist/{warpscript-xcmdSCxC.js → warpscript-66xRXxTc.js} +1 -1
  343. package/dist/{wasm-CiVYgcew.js → wasm-DdBK5awq.js} +1 -1
  344. package/dist/{web-idl-dINBdUWj.js → web-idl-CBq8x93c.js} +1 -1
  345. package/dist/{wiki-BXhtrrjC.js → wiki-C8t26iJ-.js} +1 -1
  346. package/dist/{wolfram-DzIIDXLW.js → wolfram-Cktsa-Nh.js} +1 -1
  347. package/dist/{wren-B8QH3Gtk.js → wren-Bq1wofFF.js} +1 -1
  348. package/dist/{xeora-BCMjl5Lf.js → xeora-B4u7VMjm.js} +1 -1
  349. package/dist/{xml-doc-r61sS-Iw.js → xml-doc-Dp9Nk7X1.js} +1 -1
  350. package/dist/{xojo-gTN8hoeI.js → xojo-r5j0TeKE.js} +1 -1
  351. package/dist/{xquery-BJ0dcIrW.js → xquery-DkNuvQRs.js} +1 -1
  352. package/dist/{yaml-ClmLsU2A.js → yaml-BMkE9PpR.js} +1 -1
  353. package/dist/{yang-Ce4m3ORP.js → yang-qbgGczUv.js} +1 -1
  354. package/dist/{zig-aXnk8i-T.js → zig-B7R4zlNV.js} +1 -1
  355. package/package.json +2 -2
  356. package/dist/index-Be16CwLh.js +0 -1
@@ -1 +1 @@
1
- import{dy as g}from"./runtime-E_iChIE5.js";import{r as f}from"./ruby-3lCor9Ik.js";import{r as d}from"./markup-templating-RD0xxf_6.js";function b(a,o){for(var n=0;n<o.length;n++){const r=o[n];if(typeof r!="string"&&!Array.isArray(r)){for(const e in r)if(e!=="default"&&!(e in a)){const t=Object.getOwnPropertyDescriptor(r,e);t&&Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>r[e]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var i,s;function c(){if(s)return i;s=1;var a=f(),o=d();i=n,n.displayName="erb",n.aliases=[];function n(r){r.register(a),r.register(o),(function(e){e.languages.erb={delimiter:{pattern:/^(\s*)<%=?|%>(?=\s*$)/,lookbehind:!0,alias:"punctuation"},ruby:{pattern:/\s*\S[\s\S]*/,alias:"language-ruby",inside:e.languages.ruby}},e.hooks.add("before-tokenize",function(t){var l=/<%=?(?:[^\r\n]|[\r\n](?!=begin)|[\r\n]=begin\s(?:[^\r\n]|[\r\n](?!=end))*[\r\n]=end)+?%>/g;e.languages["markup-templating"].buildPlaceholders(t,"erb",l)}),e.hooks.add("after-tokenize",function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"erb")})})(r)}return i}var u=c();const p=g(u),m=b({__proto__:null,default:p},[u]);export{m as e};
1
+ import{dy as g}from"./runtime-Epi5dRMP.js";import{r as f}from"./ruby-3lCor9Ik.js";import{r as d}from"./markup-templating-RD0xxf_6.js";function b(a,o){for(var n=0;n<o.length;n++){const r=o[n];if(typeof r!="string"&&!Array.isArray(r)){for(const e in r)if(e!=="default"&&!(e in a)){const t=Object.getOwnPropertyDescriptor(r,e);t&&Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>r[e]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var i,s;function c(){if(s)return i;s=1;var a=f(),o=d();i=n,n.displayName="erb",n.aliases=[];function n(r){r.register(a),r.register(o),(function(e){e.languages.erb={delimiter:{pattern:/^(\s*)<%=?|%>(?=\s*$)/,lookbehind:!0,alias:"punctuation"},ruby:{pattern:/\s*\S[\s\S]*/,alias:"language-ruby",inside:e.languages.ruby}},e.hooks.add("before-tokenize",function(t){var l=/<%=?(?:[^\r\n]|[\r\n](?!=begin)|[\r\n]=begin\s(?:[^\r\n]|[\r\n](?!=end))*[\r\n]=end)+?%>/g;e.languages["markup-templating"].buildPlaceholders(t,"erb",l)}),e.hooks.add("after-tokenize",function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"erb")})})(r)}return i}var u=c();const p=g(u),m=b({__proto__:null,default:p},[u]);export{m as e};
@@ -1 +1 @@
1
- import{dy as d}from"./runtime-E_iChIE5.js";function f(e,n){for(var o=0;o<n.length;o++){const t=n[o];if(typeof t!="string"&&!Array.isArray(t)){for(const r in t)if(r!=="default"&&!(r in e)){const a=Object.getOwnPropertyDescriptor(t,r);a&&Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var i,b;function u(){if(b)return i;b=1,i=e,e.displayName="erlang",e.aliases=[];function e(n){n.languages.erlang={comment:/%.+/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},"quoted-function":{pattern:/'(?:\\.|[^\\'\r\n])+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'(?:\\.|[^\\'\r\n])+'/,alias:"atom"},boolean:/\b(?:false|true)\b/,keyword:/\b(?:after|case|catch|end|fun|if|of|receive|try|when)\b/,number:[/\$\\?./,/\b\d+#[a-z0-9]+/i,/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i],function:/\b[a-z][\w@]*(?=\()/,variable:{pattern:/(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,lookbehind:!0},operator:[/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b/,{pattern:/(^|[^<])<(?!<)/,lookbehind:!0},{pattern:/(^|[^>])>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/}}return i}var l=u();const s=d(l),c=f({__proto__:null,default:s},[l]);export{c as e};
1
+ import{dy as d}from"./runtime-Epi5dRMP.js";function f(e,n){for(var o=0;o<n.length;o++){const t=n[o];if(typeof t!="string"&&!Array.isArray(t)){for(const r in t)if(r!=="default"&&!(r in e)){const a=Object.getOwnPropertyDescriptor(t,r);a&&Object.defineProperty(e,r,a.get?a:{enumerable:!0,get:()=>t[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var i,b;function u(){if(b)return i;b=1,i=e,e.displayName="erlang",e.aliases=[];function e(n){n.languages.erlang={comment:/%.+/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},"quoted-function":{pattern:/'(?:\\.|[^\\'\r\n])+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'(?:\\.|[^\\'\r\n])+'/,alias:"atom"},boolean:/\b(?:false|true)\b/,keyword:/\b(?:after|case|catch|end|fun|if|of|receive|try|when)\b/,number:[/\$\\?./,/\b\d+#[a-z0-9]+/i,/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i],function:/\b[a-z][\w@]*(?=\()/,variable:{pattern:/(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,lookbehind:!0},operator:[/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:and|andalso|band|bnot|bor|bsl|bsr|bxor|div|not|or|orelse|rem|xor)\b/,{pattern:/(^|[^<])<(?!<)/,lookbehind:!0},{pattern:/(^|[^>])>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/}}return i}var l=u();const s=d(l),c=f({__proto__:null,default:s},[l]);export{c as e};
@@ -1 +1 @@
1
- import{dy as f}from"./runtime-E_iChIE5.js";import{r as g}from"./lua-BeIBSVZf.js";import{r as c}from"./markup-templating-RD0xxf_6.js";function p(n,o){for(var r=0;r<o.length;r++){const t=o[r];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in n)){const a=Object.getOwnPropertyDescriptor(t,e);a&&Object.defineProperty(n,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var i,l;function d(){if(l)return i;l=1;var n=g(),o=c();i=r,r.displayName="etlua",r.aliases=[];function r(t){t.register(n),t.register(o),(function(e){e.languages.etlua={delimiter:{pattern:/^<%[-=]?|-?%>$/,alias:"punctuation"},"language-lua":{pattern:/[\s\S]+/,inside:e.languages.lua}},e.hooks.add("before-tokenize",function(a){var s=/<%[\s\S]+?%>/g;e.languages["markup-templating"].buildPlaceholders(a,"etlua",s)}),e.hooks.add("after-tokenize",function(a){e.languages["markup-templating"].tokenizePlaceholders(a,"etlua")})})(t)}return i}var u=d();const m=f(u),y=p({__proto__:null,default:m},[u]);export{y as e};
1
+ import{dy as f}from"./runtime-Epi5dRMP.js";import{r as g}from"./lua-BeIBSVZf.js";import{r as c}from"./markup-templating-RD0xxf_6.js";function p(n,o){for(var r=0;r<o.length;r++){const t=o[r];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in n)){const a=Object.getOwnPropertyDescriptor(t,e);a&&Object.defineProperty(n,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var i,l;function d(){if(l)return i;l=1;var n=g(),o=c();i=r,r.displayName="etlua",r.aliases=[];function r(t){t.register(n),t.register(o),(function(e){e.languages.etlua={delimiter:{pattern:/^<%[-=]?|-?%>$/,alias:"punctuation"},"language-lua":{pattern:/[\s\S]+/,inside:e.languages.lua}},e.hooks.add("before-tokenize",function(a){var s=/<%[\s\S]+?%>/g;e.languages["markup-templating"].buildPlaceholders(a,"etlua",s)}),e.hooks.add("after-tokenize",function(a){e.languages["markup-templating"].tokenizePlaceholders(a,"etlua")})})(t)}return i}var u=d();const m=f(u),y=p({__proto__:null,default:m},[u]);export{y as e};
@@ -1 +1 @@
1
- import{dy as u}from"./runtime-E_iChIE5.js";function d(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(r,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var i,l;function p(){if(l)return i;l=1,i=e,e.displayName="excelFormula",e.aliases=[];function e(t){t.languages["excel-formula"]={comment:{pattern:/(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i,lookbehind:!0,greedy:!0},string:{pattern:/"(?:[^"]|"")*"(?!")/,greedy:!0},reference:{pattern:/(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/,greedy:!0,alias:"string",inside:{operator:/!$/,punctuation:/'/,sheet:{pattern:/[^[\]]+$/,alias:"function"},file:{pattern:/\[[^[\]]+\]$/,inside:{punctuation:/[[\]]/}},path:/[\s\S]+/}},"function-name":{pattern:/\b[A-Z]\w*(?=\()/i,alias:"keyword"},range:{pattern:/\$?\b(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)\b/i,alias:"property",inside:{operator:/:/,cell:/\$?[A-Z]+\$?\d+/i,column:/\$?[A-Z]+/i,row:/\$?\d+/}},cell:{pattern:/\b[A-Z]+\d+\b|\$[A-Za-z]+\$?\d+\b|\b[A-Za-z]+\$\d+\b/,alias:"property"},number:/(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,boolean:/\b(?:FALSE|TRUE)\b/i,operator:/[-+*/^%=&,]|<[=>]?|>=?/,punctuation:/[[\]();{}|]/},t.languages.xlsx=t.languages.xls=t.languages["excel-formula"]}return i}var s=p();const c=u(s),b=d({__proto__:null,default:c},[s]);export{b as e};
1
+ import{dy as u}from"./runtime-Epi5dRMP.js";function d(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const o=Object.getOwnPropertyDescriptor(r,a);o&&Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var i,l;function p(){if(l)return i;l=1,i=e,e.displayName="excelFormula",e.aliases=[];function e(t){t.languages["excel-formula"]={comment:{pattern:/(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i,lookbehind:!0,greedy:!0},string:{pattern:/"(?:[^"]|"")*"(?!")/,greedy:!0},reference:{pattern:/(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/,greedy:!0,alias:"string",inside:{operator:/!$/,punctuation:/'/,sheet:{pattern:/[^[\]]+$/,alias:"function"},file:{pattern:/\[[^[\]]+\]$/,inside:{punctuation:/[[\]]/}},path:/[\s\S]+/}},"function-name":{pattern:/\b[A-Z]\w*(?=\()/i,alias:"keyword"},range:{pattern:/\$?\b(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)\b/i,alias:"property",inside:{operator:/:/,cell:/\$?[A-Z]+\$?\d+/i,column:/\$?[A-Z]+/i,row:/\$?\d+/}},cell:{pattern:/\b[A-Z]+\d+\b|\$[A-Za-z]+\$?\d+\b|\b[A-Za-z]+\$\d+\b/,alias:"property"},number:/(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,boolean:/\b(?:FALSE|TRUE)\b/i,operator:/[-+*/^%=&,]|<[=>]?|>=?/,punctuation:/[[\]();{}|]/},t.languages.xlsx=t.languages.xls=t.languages["excel-formula"]}return i}var s=p();const c=u(s),b=d({__proto__:null,default:c},[s]);export{b as e};
@@ -1 +1 @@
1
- import{d5 as o,d6 as t}from"./runtime-E_iChIE5.js";async function f({fileType:n,artifactContent:l,artifactName:a,pdfBlobGenerator:r,fileGenerators:e}){return n==="PDF"?r?r():e!=null&&e.generatePdf?e.generatePdf():null:n==="DOC"?l?o(l,a):e!=null&&e.generateWord?e.generateWord():null:n==="EXCEL_SINGLE"?l?t(l,a,"single"):e!=null&&e.generateExcel?e.generateExcel("single"):null:n==="EXCEL_MULTI"?l?t(l,a,"separate"):e!=null&&e.generateExcel?e.generateExcel("separate"):null:null}export{f as g};
1
+ import{d5 as o,d6 as t}from"./runtime-Epi5dRMP.js";async function f({fileType:n,artifactContent:l,artifactName:a,pdfBlobGenerator:r,fileGenerators:e}){return n==="PDF"?r?r():e!=null&&e.generatePdf?e.generatePdf():null:n==="DOC"?l?o(l,a):e!=null&&e.generateWord?e.generateWord():null:n==="EXCEL_SINGLE"?l?t(l,a,"single"):e!=null&&e.generateExcel?e.generateExcel("single"):null:n==="EXCEL_MULTI"?l?t(l,a,"separate"):e!=null&&e.generateExcel?e.generateExcel("separate"):null:null}export{f as g};
@@ -1 +1 @@
1
- import{dT as v,dU as R,dV as h,dW as p,dX as E,dY as T,dZ as P,d_ as S,d$ as W}from"./runtime-E_iChIE5.js";import{e0 as A,e1 as B,e2 as D,d4 as $,dP as F}from"./runtime-E_iChIE5.js";function H(){let n;const e=()=>(n??(n=import("./exportImageReadinessNotifier-BdGb_jYS.js").then(t=>t.createToastExportReadinessNotifier())),n),a=t=>{console.warn("Export readiness: could not show the image-loading notice",t)};return{showWaiting:(t,s)=>{e().then(o=>o.showWaiting(t,s)).catch(a)},dismissWaiting:()=>{e().then(t=>t.dismissWaiting()).catch(a)},confirmFailedImages:(t,s)=>e().then(o=>o.confirmFailedImages(t,s))}}function L(n,e){console.warn(`Export readiness: ${n} canvas image load(s) not tied to the exported pages still pending after ${e} ms \u2014 not holding the export for them`),import("./index.client-88ufWAAE.js").then(({addBreadcrumb:a})=>a({category:"export",level:"warning",message:"export readiness: tracker-only bound hit",data:{trackerCount:n,boundMs:e}})).catch(()=>{})}const Y=250,G=1500,w=8e3;function U(n){const e=n.deps??{};return{getTrackerCount:e.getTrackerCount??W,reportTrackerBoundHit:e.reportTrackerBoundHit??(a=>L(a,w)),subscribeTracker:e.subscribeTracker??S,collectCanvasState:e.collectCanvasState??(a=>R(a)),notifier:e.notifier??H()}}function X(n,e,a,t){return new Promise((s,o)=>{const i=[];let g=!1,C=!1,I=!1,u=!1,x="";const f=r=>{g||(g=!0,i.forEach(d=>d()),u&&e.notifier.dismissWaiting(),r?o(r):s())},_=()=>f(new T),c=()=>{if(!g)try{const r=p(n,e.collectCanvasState),d=r.pending.length+r.loadingImgCount,O=d+r.loadingMarkerCount,l=e.getTrackerCount(),k=l>0&&!I;if(O===0&&!k){l>0&&e.reportTrackerBoundHit(l),f();return}if(!C)return;const m={count:Math.max(d,r.loadingMarkerCount,k?l:0),names:E(r.pending)},b=`${m.count}|${m.names.join("|")}`;if(u&&b===x)return;u=!0,x=b,e.notifier.showWaiting(m,_)}catch(r){f(r instanceof Error?r:new Error(String(r)))}},y=setInterval(c,a);i.push(()=>clearInterval(y));const N=setTimeout(()=>{C=!0,c()},t);i.push(()=>clearTimeout(N));const M=setTimeout(()=>{I=!0,c()},w);i.push(()=>clearTimeout(M)),i.push(e.subscribeTracker(c)),c()})}async function Z(n,e={}){const a=U(e);await X(n,a,e.pollIntervalMs??Y,e.noticeDelayMs??G);const{failed:t,failedByCanvas:s}=p(n,a.collectCanvasState);if(t.length!==0){if(!await a.notifier.confirmFailedImages(E(t),t.length))throw new T("Export cancelled: some photos could not be loaded");s.forEach((o,i)=>P(i,o))}}function j(n,e){const a=v(n);if(!a)return;const{pending:t,failed:s}=(e??R)(a);if(t.length>0)throw new h(t);const o=s.filter(i=>!i.acknowledged);if(o.length>0)throw new h(o,"failed")}export{A as EXPORT_IMAGE_LOADING_ATTR,B as EXPORT_LAZY_PENDING_ATTR,T as ExportCancelledError,h as ExportImageNotReadyError,w as TRACKER_ONLY_BOUND_MS,j as assertCanvasImagesSettled,Z as awaitExportImagesReady,D as describePendingImages,v as fabricCanvasOf,E as imageNamesOf,$ as isExportCancelledError,F as isExportImageNotReadyError,p as snapshotPageImages};
1
+ import{dT as v,dU as R,dV as h,dW as p,dX as E,dY as T,dZ as P,d_ as S,d$ as W}from"./runtime-Epi5dRMP.js";import{e0 as A,e1 as B,e2 as D,d4 as $,dP as F}from"./runtime-Epi5dRMP.js";function H(){let n;const e=()=>(n??(n=import("./exportImageReadinessNotifier-MPE3aQ-X.js").then(t=>t.createToastExportReadinessNotifier())),n),a=t=>{console.warn("Export readiness: could not show the image-loading notice",t)};return{showWaiting:(t,s)=>{e().then(o=>o.showWaiting(t,s)).catch(a)},dismissWaiting:()=>{e().then(t=>t.dismissWaiting()).catch(a)},confirmFailedImages:(t,s)=>e().then(o=>o.confirmFailedImages(t,s))}}function L(n,e){console.warn(`Export readiness: ${n} canvas image load(s) not tied to the exported pages still pending after ${e} ms \u2014 not holding the export for them`),import("./index.client-B5zFhoJh.js").then(({addBreadcrumb:a})=>a({category:"export",level:"warning",message:"export readiness: tracker-only bound hit",data:{trackerCount:n,boundMs:e}})).catch(()=>{})}const Y=250,G=1500,w=8e3;function U(n){const e=n.deps??{};return{getTrackerCount:e.getTrackerCount??W,reportTrackerBoundHit:e.reportTrackerBoundHit??(a=>L(a,w)),subscribeTracker:e.subscribeTracker??S,collectCanvasState:e.collectCanvasState??(a=>R(a)),notifier:e.notifier??H()}}function X(n,e,a,t){return new Promise((s,o)=>{const i=[];let g=!1,C=!1,I=!1,u=!1,x="";const f=r=>{g||(g=!0,i.forEach(d=>d()),u&&e.notifier.dismissWaiting(),r?o(r):s())},_=()=>f(new T),c=()=>{if(!g)try{const r=p(n,e.collectCanvasState),d=r.pending.length+r.loadingImgCount,O=d+r.loadingMarkerCount,l=e.getTrackerCount(),k=l>0&&!I;if(O===0&&!k){l>0&&e.reportTrackerBoundHit(l),f();return}if(!C)return;const m={count:Math.max(d,r.loadingMarkerCount,k?l:0),names:E(r.pending)},b=`${m.count}|${m.names.join("|")}`;if(u&&b===x)return;u=!0,x=b,e.notifier.showWaiting(m,_)}catch(r){f(r instanceof Error?r:new Error(String(r)))}},y=setInterval(c,a);i.push(()=>clearInterval(y));const N=setTimeout(()=>{C=!0,c()},t);i.push(()=>clearTimeout(N));const M=setTimeout(()=>{I=!0,c()},w);i.push(()=>clearTimeout(M)),i.push(e.subscribeTracker(c)),c()})}async function Z(n,e={}){const a=U(e);await X(n,a,e.pollIntervalMs??Y,e.noticeDelayMs??G);const{failed:t,failedByCanvas:s}=p(n,a.collectCanvasState);if(t.length!==0){if(!await a.notifier.confirmFailedImages(E(t),t.length))throw new T("Export cancelled: some photos could not be loaded");s.forEach((o,i)=>P(i,o))}}function j(n,e){const a=v(n);if(!a)return;const{pending:t,failed:s}=(e??R)(a);if(t.length>0)throw new h(t);const o=s.filter(i=>!i.acknowledged);if(o.length>0)throw new h(o,"failed")}export{A as EXPORT_IMAGE_LOADING_ATTR,B as EXPORT_LAZY_PENDING_ATTR,T as ExportCancelledError,h as ExportImageNotReadyError,w as TRACKER_ONLY_BOUND_MS,j as assertCanvasImagesSettled,Z as awaitExportImagesReady,D as describePendingImages,v as fabricCanvasOf,E as imageNamesOf,$ as isExportCancelledError,F as isExportImageNotReadyError,p as snapshotPageImages};
@@ -1 +1 @@
1
- import{jsx as u}from"react/jsx-runtime";import{createRoot as f}from"react-dom/client";import{cw as g,dB as h,dC as x}from"./runtime-E_iChIE5.js";const a=3;function r(t){return t.length<=1?t[0]??"":t.length>a?`${t.slice(0,a).join(", ")} and ${t.length-a} more`:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const l=t=>t===1?"image":"images";function d(t){const i=r(t.names),n="The export continues as soon as they finish.";return{title:`Waiting for ${t.count} ${l(t.count)} to finish loading\u2026`,description:i?`Still loading: ${i}. ${n}`:n}}function m(t,i){const n=r(t);return{title:n?`Couldn't load photo for ${n}`:`Couldn't load ${i} ${l(i)}`,description:"Export anyway to use a placeholder in its place, or cancel and try again once the photo is available."}}function $(t,i){return typeof document>"u"?Promise.resolve(!1):new Promise(n=>{const o=document.createElement("div");document.body.appendChild(o);const e=f(o);let s=!1;const c=p=>{s||(s=!0,n(p),setTimeout(()=>{e.unmount(),o.remove()},0))};e.render(u(h,{isOpen:!0,onClose:()=>c(!1),onConfirm:()=>c(!0),title:t,description:i,confirmText:"Export anyway",cancelText:"Cancel export",confirmVariant:"primary",closeOnOutsideClick:!1,"data-testid":"export-failed-images-dialog"}))})}function C(){let t;return{showWaiting:(i,n)=>{const{title:o,description:e}=d(i);t=g({...t===void 0?{}:{id:t},title:o,description:e,variant:"info",persistent:!0,progress:"indeterminate",action:{label:"Cancel export",onClick:n}})},dismissWaiting:()=>{t!==void 0&&x(t),t=void 0},confirmFailedImages:(i,n)=>{const{title:o,description:e}=m(i,n);return $(o,e)}}}export{C as createToastExportReadinessNotifier,m as describeFailed,d as describeWaiting,r as formatImageNames};
1
+ import{jsx as u}from"react/jsx-runtime";import{createRoot as f}from"react-dom/client";import{cw as g,dB as h,dC as x}from"./runtime-Epi5dRMP.js";const a=3;function r(t){return t.length<=1?t[0]??"":t.length>a?`${t.slice(0,a).join(", ")} and ${t.length-a} more`:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}const l=t=>t===1?"image":"images";function d(t){const i=r(t.names),n="The export continues as soon as they finish.";return{title:`Waiting for ${t.count} ${l(t.count)} to finish loading\u2026`,description:i?`Still loading: ${i}. ${n}`:n}}function m(t,i){const n=r(t);return{title:n?`Couldn't load photo for ${n}`:`Couldn't load ${i} ${l(i)}`,description:"Export anyway to use a placeholder in its place, or cancel and try again once the photo is available."}}function $(t,i){return typeof document>"u"?Promise.resolve(!1):new Promise(n=>{const o=document.createElement("div");document.body.appendChild(o);const e=f(o);let s=!1;const c=p=>{s||(s=!0,n(p),setTimeout(()=>{e.unmount(),o.remove()},0))};e.render(u(h,{isOpen:!0,onClose:()=>c(!1),onConfirm:()=>c(!0),title:t,description:i,confirmText:"Export anyway",cancelText:"Cancel export",confirmVariant:"primary",closeOnOutsideClick:!1,"data-testid":"export-failed-images-dialog"}))})}function C(){let t;return{showWaiting:(i,n)=>{const{title:o,description:e}=d(i);t=g({...t===void 0?{}:{id:t},title:o,description:e,variant:"info",persistent:!0,progress:"indeterminate",action:{label:"Cancel export",onClick:n}})},dismissWaiting:()=>{t!==void 0&&x(t),t=void 0},confirmFailedImages:(i,n)=>{const{title:o,description:e}=m(i,n);return $(o,e)}}}export{C as createToastExportReadinessNotifier,m as describeFailed,d as describeWaiting,r as formatImageNames};
@@ -1,4 +1,4 @@
1
- import{assertCanvasImagesSettled as $}from"./exportImageReadiness-CKbk6ouE.js";import{eM as B,dV as D,e1 as O,eN as w,eO as M,eP as U}from"./runtime-E_iChIE5.js";function k(t){return t&&t.length>0?new Set(t):null}async function _(t){return(await import("./runtime-E_iChIE5.js").then(e=>e.e)).default.stages.find(e=>{var n;const i=(n=e.container)==null?void 0:n.call(e);return i&&(t.contains(i)||i.contains(t))})??null}async function K(t,e=5e3){var n,i,o;const a=t.find("Image"),r=[],l=[];for(const s of a){const h=(n=s.image)==null?void 0:n.call(s);h&&(h.complete||(l.push(((i=s.id)==null?void 0:i.call(s))||((o=s.name)==null?void 0:o.call(s))||`image-${l.length+1}`),r.push(new Promise(p=>{const g=()=>{h.removeEventListener("load",g),h.removeEventListener("error",g),p()};h.addEventListener("load",g,{once:!0}),h.addEventListener("error",g,{once:!0})}))))}if(r.length===0)return;let c;const u=new Promise(s=>{c=setTimeout(()=>s(!0),e)}),f=Promise.all(r).then(()=>!1),d=await Promise.race([f,u]);if(c&&clearTimeout(c),d)throw new D(l.map(s=>({id:s})))}function C(t,e){typeof t.set=="function"?t.set("visible",e):t.visible=e}function I(t,e,n,i){for(const o of t){if(!o||typeof o!="object")continue;const a=o;if(typeof a.id=="string"&&e.has(a.id)){n.push({object:a,visible:a.visible}),i==null||i.add(a.id),C(a,!1);continue}const r=Array.isArray(a._objects)?a._objects:typeof a.getObjects=="function"?a.getObjects():[];r.length>0&&I(r,e,n,i)}}function Z(t){for(const e of t)C(e.object,e.visible)}function Q(t,e,n,i){const o=t.find(a=>{const r=typeof a.id=="function"?a.id():void 0;return typeof r=="string"&&r!==""&&e.has(r)});for(const a of o)n.push({node:a,visible:a.visible()}),i==null||i.add(a.id()),a.hide()}function V(t){for(const e of t)e.node.visible(e.visible)}function W(t,e,n,i){const o=k(i==null?void 0:i.hideObjectIds),a=t.__fabric;if(a&&typeof a.toCanvasElement=="function"){if(o&&typeof a.getObjects!="function")return null;const r=[];try{o&&typeof a.getObjects=="function"&&I(a.getObjects(),o,r,i==null?void 0:i.hiddenObjectIdSink);const l=a.toCanvasElement(e);if(l&&l.width>0&&l.height>0)return l}catch{}finally{Z(r)}}return null}const G=300;function J(t){var e;const n=Number.parseFloat(((e=t.style)==null?void 0:e.height)??"");return Number.isFinite(n)&&n>0?n:t.height}function X(t){const e=J(t);return e>0&&e<=G}function b(t,e=1,n=.98,i){var o;if(!t.width||!t.height)return null;$(t);const a=e>0?e:1,r=X(t),l=(((o=i==null?void 0:i.hideObjectIds)==null?void 0:o.length)??0)>0,c=a!==1||l?W(t,a,void 0,i):null;if(!c&&l)return null;const u=c||t,f=document.createElement("canvas");c?(f.width=c.width,f.height=c.height):(f.width=Math.round(t.width*a),f.height=Math.round(t.height*a));const d=f.getContext("2d");return d?(r||(d.fillStyle="#ffffff",d.fillRect(0,0,f.width,f.height)),d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(u,0,0,f.width,f.height),f.toDataURL(r?"image/png":"image/jpeg",n)||null):u.toDataURL(r?"image/png":"image/jpeg",n)||null}function A(t,e,n,i){return b(t,e,n,i)}function Y(t){return t.querySelector("canvas.lower-canvas")||t.querySelector("canvas")}function v(t){const e=t.split(",")[1]||"",n=atob(e),i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i}async function P(t,e={}){const{pixelRatio:n=4,quality:i=.98,format:o="dataUrl",skipHiddenText:a=!1,hideObjectIds:r,hiddenObjectIdSink:l}=e,c=await _(t);if(!c){const h=Y(t);if(h){const p=A(h,n,i,{hideObjectIds:r,hiddenObjectIdSink:l});return p?o==="buffer"?v(p):p:null}return console.warn("[capturePreviewStage] No Konva stage or canvas found in element"),null}await B(),await K(c);const u=c.find("Text"),f=[],d=[];let s=null;try{const h=k(r);h&&Q(c,h,d,l),u.forEach((g,m)=>{f[m]=g.opacity(),!a&&g.opacity()===0&&g.opacity(g.getAttr("_dataOpacity")??1)}),u.forEach(g=>{if(g.opacity()>0){const m=g.fontSize();g.fontSize(m+.001),g.fontSize(m)}}),c.batchDraw();const p=c.toCanvas({pixelRatio:n});s=b(p,1,i)}finally{u.forEach((h,p)=>{f[p]!==void 0&&h.opacity(f[p])}),V(d),c.batchDraw()}return s?o==="buffer"?v(s):s:null}function x(t){const e=Number.parseFloat(t.dataset.expectedLeft??""),n=Number.parseFloat(t.dataset.expectedTop??"");Number.isFinite(e)&&(t.style.left=`${e}px`),Number.isFinite(n)&&(t.style.top=`${n}px`)}function tt(t){const e=t.querySelectorAll(".text-rich-display");if(e.length===0)return"";const n=[];return e.forEach(i=>{const o=i.cloneNode(!0);o.style.pointerEvents="auto",x(o),n.push(o.outerHTML)}),n.join("")}async function q(t,e={}){const{pixelRatio:n=4,quality:i=.98,format:o="dataUrl",skipHiddenText:a=!1,hideObjectIds:r,hiddenObjectIdSink:l}=e,c=t.parentElement;if(c){const f=await P(c,{pixelRatio:n,quality:i,format:o,skipHiddenText:a,hideObjectIds:r,hiddenObjectIdSink:l});if(f)return f}const u=A(t,n,i,{hideObjectIds:r,hiddenObjectIdSink:l});return u?o==="buffer"?v(u):u:null}const y=32,j=250,et=250,nt=5e3;function N(t){if(!(t.width>0)||!(t.height>0))return!1;const e=document.createElement("canvas");e.width=y,e.height=y;const n=e.getContext("2d",{willReadFrequently:!0});if(!n)return!1;try{n.drawImage(t,0,0,y,y);const{data:i}=n.getImageData(0,0,y,y);for(let o=0;o<i.length;o+=4)if(i[o+3]!==0&&(i[o]<j||i[o+1]<j||i[o+2]<j))return!1;return!0}catch{return!1}}const S=t=>Array.from(t.querySelectorAll("canvas:not(.upper-canvas)")),E=t=>S(t).some(e=>!N(e));async function R(t){const e=Date.now()+nt;for(;Date.now()<e;)if(await new Promise(n=>{setTimeout(n,et)}),E(t))return!0;return!1}function it(t){var e;const n=(e=t.getBoundingClientRect)==null?void 0:e.call(t);if(n&&n.width>0&&n.height>0)return{width:n.width,height:n.height};const i=typeof window<"u"&&window.devicePixelRatio>0?window.devicePixelRatio:1;return{width:t.width/i,height:t.height/i}}const T=[".page-actions-bar",".page-action-btn",".margin-indicators","[data-fabric-canvas-placeholder]"],ot="objId";async function at(t,e={}){if(t.querySelector(`[${O}="true"]`))throw new Error("buildFabricPageClone: page still has a canvas that has not rendered (lazy preview)");const n=await L(t,e);if(!e.expectNonBlankCanvas||n.sawNonBlankCanvas)return n.clone;if(await R(t)){const i=await L(t,e);if(i.sawNonBlankCanvas)return i.clone}throw new Error("buildFabricPageClone: page expected canvas content but every canvas baked blank")}async function L(t,e){var n;const{hideObjectIds:i,stripRichTextOverlays:o=!1,expectNonBlankCanvas:a=!1}=e,r=t.cloneNode(!0);T.forEach(d=>{r.querySelectorAll(d).forEach(s=>s.remove())});const l=new Set;if(o&&i&&i.length>0){const d=new Set(i);r.querySelectorAll(".text-rich-display").forEach(s=>{const h=s.dataset[ot];typeof h=="string"&&d.has(h)&&(l.add(h),s.remove())})}r.querySelectorAll(".text-rich-display").forEach(d=>x(d));const c=S(t),u=S(r);let f=!1;for(let d=0;d<u.length;d++){const s=c[d],h=u[d];if(!(!s||!h||s.width<=0||s.height<=0)){a&&!f&&!N(s)&&(f=!0),$(s);const p=await q(s,{pixelRatio:4,quality:.98,skipHiddenText:!0,hideObjectIds:i,hiddenObjectIdSink:l});if(!p||typeof p!="string")throw new Error(`buildFabricPageClone: canvas ${d+1} of ${u.length} produced no image`);const g=document.createElement("img");g.src=p;const{width:m,height:z}=it(s);g.style.width=s.style.width||`${m}px`,g.style.height=s.style.height||`${z}px`,g.style.display="block",g.style.margin="0",g.style.padding="0",g.style.border="0",g.style.imageRendering="-webkit-optimize-contrast",(n=h.parentElement)==null||n.replaceChild(g,h)}}if(r.querySelectorAll("canvas.upper-canvas").forEach(d=>d.remove()),o&&i&&i.length>0){const d=i.filter(s=>!l.has(s));if(d.length>0)throw new Error(`buildFabricPageClone: ${d.length} lifted object(s) were not removed from the clone (${d.join(", ")})`)}return{clone:r,sawNonBlankCanvas:f}}const rt=new Set(["arial","helvetica","times new roman","courier","courier new","verdana","georgia","comic sans ms","calibri","cambria","aptos","segoe ui","tahoma","trebuchet ms","calibri light","book antiqua","garamond","century gothic","palatino linotype"]),st=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","inherit","initial","unset"]),F=/^[A-Za-z0-9][A-Za-z0-9 ]{0,49}$/,ct=/font-family:\s*([^;"}<]+)/gi,lt=5e3,dt=12;function ut(t){const e=(t.split(",")[0]??"").replace(/['"]/g,"").trim();if(!e||!F.test(e))return"";const n=e.toLowerCase();return st.has(n)||rt.has(n)?"":e}function ft(t){const e=new Set;for(const n of t){if(!n)continue;const i=n.replace(/&quot;/g,"'");for(const o of i.matchAll(ct)){const a=o[1];if(!a)continue;const r=ut(a);r&&e.add(r)}}return Array.from(e).slice(0,dt)}async function ht(t){const e=new AbortController,n=setTimeout(()=>e.abort(),lt);try{const i=await fetch(t,{signal:e.signal});return i.ok?await i.text():null}catch{return null}finally{clearTimeout(n)}}async function gt(t){if(!F.test(t))return null;const e=t.replace(/ /g,"+"),n=["300;400;500;600;700","400;700","400"];for(const i of n){const o=await ht(`https://fonts.googleapis.com/css2?family=${e}:wght@${i}&display=swap`);if(o)return o}return null}async function pt(t,e=[]){const n=new Set(e.filter(Boolean).map(o=>o.toLowerCase())),i=t.filter(o=>!n.has(o.toLowerCase()));return i.length===0?"":(await Promise.all(i.map(o=>gt(o)))).filter(o=>!!o).join(`
1
+ import{assertCanvasImagesSettled as $}from"./exportImageReadiness-BLHV4KA3.js";import{eM as B,dV as D,e1 as O,eN as w,eO as M,eP as U}from"./runtime-Epi5dRMP.js";function k(t){return t&&t.length>0?new Set(t):null}async function _(t){return(await import("./runtime-Epi5dRMP.js").then(e=>e.e)).default.stages.find(e=>{var n;const i=(n=e.container)==null?void 0:n.call(e);return i&&(t.contains(i)||i.contains(t))})??null}async function K(t,e=5e3){var n,i,o;const a=t.find("Image"),r=[],l=[];for(const s of a){const h=(n=s.image)==null?void 0:n.call(s);h&&(h.complete||(l.push(((i=s.id)==null?void 0:i.call(s))||((o=s.name)==null?void 0:o.call(s))||`image-${l.length+1}`),r.push(new Promise(p=>{const g=()=>{h.removeEventListener("load",g),h.removeEventListener("error",g),p()};h.addEventListener("load",g,{once:!0}),h.addEventListener("error",g,{once:!0})}))))}if(r.length===0)return;let c;const u=new Promise(s=>{c=setTimeout(()=>s(!0),e)}),f=Promise.all(r).then(()=>!1),d=await Promise.race([f,u]);if(c&&clearTimeout(c),d)throw new D(l.map(s=>({id:s})))}function C(t,e){typeof t.set=="function"?t.set("visible",e):t.visible=e}function I(t,e,n,i){for(const o of t){if(!o||typeof o!="object")continue;const a=o;if(typeof a.id=="string"&&e.has(a.id)){n.push({object:a,visible:a.visible}),i==null||i.add(a.id),C(a,!1);continue}const r=Array.isArray(a._objects)?a._objects:typeof a.getObjects=="function"?a.getObjects():[];r.length>0&&I(r,e,n,i)}}function Z(t){for(const e of t)C(e.object,e.visible)}function Q(t,e,n,i){const o=t.find(a=>{const r=typeof a.id=="function"?a.id():void 0;return typeof r=="string"&&r!==""&&e.has(r)});for(const a of o)n.push({node:a,visible:a.visible()}),i==null||i.add(a.id()),a.hide()}function V(t){for(const e of t)e.node.visible(e.visible)}function W(t,e,n,i){const o=k(i==null?void 0:i.hideObjectIds),a=t.__fabric;if(a&&typeof a.toCanvasElement=="function"){if(o&&typeof a.getObjects!="function")return null;const r=[];try{o&&typeof a.getObjects=="function"&&I(a.getObjects(),o,r,i==null?void 0:i.hiddenObjectIdSink);const l=a.toCanvasElement(e);if(l&&l.width>0&&l.height>0)return l}catch{}finally{Z(r)}}return null}const G=300;function J(t){var e;const n=Number.parseFloat(((e=t.style)==null?void 0:e.height)??"");return Number.isFinite(n)&&n>0?n:t.height}function X(t){const e=J(t);return e>0&&e<=G}function b(t,e=1,n=.98,i){var o;if(!t.width||!t.height)return null;$(t);const a=e>0?e:1,r=X(t),l=(((o=i==null?void 0:i.hideObjectIds)==null?void 0:o.length)??0)>0,c=a!==1||l?W(t,a,void 0,i):null;if(!c&&l)return null;const u=c||t,f=document.createElement("canvas");c?(f.width=c.width,f.height=c.height):(f.width=Math.round(t.width*a),f.height=Math.round(t.height*a));const d=f.getContext("2d");return d?(r||(d.fillStyle="#ffffff",d.fillRect(0,0,f.width,f.height)),d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(u,0,0,f.width,f.height),f.toDataURL(r?"image/png":"image/jpeg",n)||null):u.toDataURL(r?"image/png":"image/jpeg",n)||null}function A(t,e,n,i){return b(t,e,n,i)}function Y(t){return t.querySelector("canvas.lower-canvas")||t.querySelector("canvas")}function v(t){const e=t.split(",")[1]||"",n=atob(e),i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i}async function P(t,e={}){const{pixelRatio:n=4,quality:i=.98,format:o="dataUrl",skipHiddenText:a=!1,hideObjectIds:r,hiddenObjectIdSink:l}=e,c=await _(t);if(!c){const h=Y(t);if(h){const p=A(h,n,i,{hideObjectIds:r,hiddenObjectIdSink:l});return p?o==="buffer"?v(p):p:null}return console.warn("[capturePreviewStage] No Konva stage or canvas found in element"),null}await B(),await K(c);const u=c.find("Text"),f=[],d=[];let s=null;try{const h=k(r);h&&Q(c,h,d,l),u.forEach((g,m)=>{f[m]=g.opacity(),!a&&g.opacity()===0&&g.opacity(g.getAttr("_dataOpacity")??1)}),u.forEach(g=>{if(g.opacity()>0){const m=g.fontSize();g.fontSize(m+.001),g.fontSize(m)}}),c.batchDraw();const p=c.toCanvas({pixelRatio:n});s=b(p,1,i)}finally{u.forEach((h,p)=>{f[p]!==void 0&&h.opacity(f[p])}),V(d),c.batchDraw()}return s?o==="buffer"?v(s):s:null}function x(t){const e=Number.parseFloat(t.dataset.expectedLeft??""),n=Number.parseFloat(t.dataset.expectedTop??"");Number.isFinite(e)&&(t.style.left=`${e}px`),Number.isFinite(n)&&(t.style.top=`${n}px`)}function tt(t){const e=t.querySelectorAll(".text-rich-display");if(e.length===0)return"";const n=[];return e.forEach(i=>{const o=i.cloneNode(!0);o.style.pointerEvents="auto",x(o),n.push(o.outerHTML)}),n.join("")}async function q(t,e={}){const{pixelRatio:n=4,quality:i=.98,format:o="dataUrl",skipHiddenText:a=!1,hideObjectIds:r,hiddenObjectIdSink:l}=e,c=t.parentElement;if(c){const f=await P(c,{pixelRatio:n,quality:i,format:o,skipHiddenText:a,hideObjectIds:r,hiddenObjectIdSink:l});if(f)return f}const u=A(t,n,i,{hideObjectIds:r,hiddenObjectIdSink:l});return u?o==="buffer"?v(u):u:null}const y=32,j=250,et=250,nt=5e3;function N(t){if(!(t.width>0)||!(t.height>0))return!1;const e=document.createElement("canvas");e.width=y,e.height=y;const n=e.getContext("2d",{willReadFrequently:!0});if(!n)return!1;try{n.drawImage(t,0,0,y,y);const{data:i}=n.getImageData(0,0,y,y);for(let o=0;o<i.length;o+=4)if(i[o+3]!==0&&(i[o]<j||i[o+1]<j||i[o+2]<j))return!1;return!0}catch{return!1}}const S=t=>Array.from(t.querySelectorAll("canvas:not(.upper-canvas)")),E=t=>S(t).some(e=>!N(e));async function R(t){const e=Date.now()+nt;for(;Date.now()<e;)if(await new Promise(n=>{setTimeout(n,et)}),E(t))return!0;return!1}function it(t){var e;const n=(e=t.getBoundingClientRect)==null?void 0:e.call(t);if(n&&n.width>0&&n.height>0)return{width:n.width,height:n.height};const i=typeof window<"u"&&window.devicePixelRatio>0?window.devicePixelRatio:1;return{width:t.width/i,height:t.height/i}}const T=[".page-actions-bar",".page-action-btn",".margin-indicators","[data-fabric-canvas-placeholder]"],ot="objId";async function at(t,e={}){if(t.querySelector(`[${O}="true"]`))throw new Error("buildFabricPageClone: page still has a canvas that has not rendered (lazy preview)");const n=await L(t,e);if(!e.expectNonBlankCanvas||n.sawNonBlankCanvas)return n.clone;if(await R(t)){const i=await L(t,e);if(i.sawNonBlankCanvas)return i.clone}throw new Error("buildFabricPageClone: page expected canvas content but every canvas baked blank")}async function L(t,e){var n;const{hideObjectIds:i,stripRichTextOverlays:o=!1,expectNonBlankCanvas:a=!1}=e,r=t.cloneNode(!0);T.forEach(d=>{r.querySelectorAll(d).forEach(s=>s.remove())});const l=new Set;if(o&&i&&i.length>0){const d=new Set(i);r.querySelectorAll(".text-rich-display").forEach(s=>{const h=s.dataset[ot];typeof h=="string"&&d.has(h)&&(l.add(h),s.remove())})}r.querySelectorAll(".text-rich-display").forEach(d=>x(d));const c=S(t),u=S(r);let f=!1;for(let d=0;d<u.length;d++){const s=c[d],h=u[d];if(!(!s||!h||s.width<=0||s.height<=0)){a&&!f&&!N(s)&&(f=!0),$(s);const p=await q(s,{pixelRatio:4,quality:.98,skipHiddenText:!0,hideObjectIds:i,hiddenObjectIdSink:l});if(!p||typeof p!="string")throw new Error(`buildFabricPageClone: canvas ${d+1} of ${u.length} produced no image`);const g=document.createElement("img");g.src=p;const{width:m,height:z}=it(s);g.style.width=s.style.width||`${m}px`,g.style.height=s.style.height||`${z}px`,g.style.display="block",g.style.margin="0",g.style.padding="0",g.style.border="0",g.style.imageRendering="-webkit-optimize-contrast",(n=h.parentElement)==null||n.replaceChild(g,h)}}if(r.querySelectorAll("canvas.upper-canvas").forEach(d=>d.remove()),o&&i&&i.length>0){const d=i.filter(s=>!l.has(s));if(d.length>0)throw new Error(`buildFabricPageClone: ${d.length} lifted object(s) were not removed from the clone (${d.join(", ")})`)}return{clone:r,sawNonBlankCanvas:f}}const rt=new Set(["arial","helvetica","times new roman","courier","courier new","verdana","georgia","comic sans ms","calibri","cambria","aptos","segoe ui","tahoma","trebuchet ms","calibri light","book antiqua","garamond","century gothic","palatino linotype"]),st=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","inherit","initial","unset"]),F=/^[A-Za-z0-9][A-Za-z0-9 ]{0,49}$/,ct=/font-family:\s*([^;"}<]+)/gi,lt=5e3,dt=12;function ut(t){const e=(t.split(",")[0]??"").replace(/['"]/g,"").trim();if(!e||!F.test(e))return"";const n=e.toLowerCase();return st.has(n)||rt.has(n)?"":e}function ft(t){const e=new Set;for(const n of t){if(!n)continue;const i=n.replace(/&quot;/g,"'");for(const o of i.matchAll(ct)){const a=o[1];if(!a)continue;const r=ut(a);r&&e.add(r)}}return Array.from(e).slice(0,dt)}async function ht(t){const e=new AbortController,n=setTimeout(()=>e.abort(),lt);try{const i=await fetch(t,{signal:e.signal});return i.ok?await i.text():null}catch{return null}finally{clearTimeout(n)}}async function gt(t){if(!F.test(t))return null;const e=t.replace(/ /g,"+"),n=["300;400;500;600;700","400;700","400"];for(const i of n){const o=await ht(`https://fonts.googleapis.com/css2?family=${e}:wght@${i}&display=swap`);if(o)return o}return null}async function pt(t,e=[]){const n=new Set(e.filter(Boolean).map(o=>o.toLowerCase())),i=t.filter(o=>!n.has(o.toLowerCase()));return i.length===0?"":(await Promise.all(i.map(o=>gt(o)))).filter(o=>!!o).join(`
2
2
  `)}const H="objId";function mt(t,e,n){if(!t)return t;const i=new Set(e),o=new DOMParser().parseFromString(t,"text/html").body;o.querySelectorAll(".text-rich-display").forEach(r=>{const l=r.dataset[H];typeof l=="string"&&i.has(l)&&(n.add(l),r.remove())});const a=[...o.querySelectorAll(".text-rich-display")].map(r=>r.dataset[H]).filter(r=>typeof r=="string"&&i.has(r));if(a.length>0)throw new Error(`stripLiftedOverlays: ${a.length} lifted overlay(s) survived the strip (${a.join(", ")})`);return o.innerHTML}async function yt(t,e,n,i,o={}){var a;if(t.querySelector(`[${O}="true"]`))throw new Error("buildKonvaPageHtml: page still has a canvas that has not rendered (lazy preview)");const r=(a=o.hideObjectIds)!=null&&a.length?o.hideObjectIds:void 0,l=new Set;o.expectNonBlankCanvas&&!E(t)&&await R(t);const c=await P(t,{pixelRatio:4,quality:.98,skipHiddenText:!0,...r?{hideObjectIds:r,hiddenObjectIdSink:l}:{}});if(!c||typeof c!="string")return null;if(o.expectNonBlankCanvas&&!E(t))throw new Error("buildKonvaPageHtml: page expected canvas content but every canvas baked blank");const u=tt(t),f=r?mt(u,r,l):u;if(r){const s=r.filter(h=>!l.has(h));if(s.length>0)throw new Error(`buildKonvaPageHtml: ${s.length} lifted object(s) were not removed from the page (${s.join(", ")})`)}const d=i===void 0?"Page":`Page ${i}`;return`<div style="width: ${e}px; height: ${n}px; margin: 0; padding: 0; overflow: hidden; position: relative;"><img src="${c}" style="width: ${e}px; height: ${n}px; display: block; image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges;" alt="${d}" />${f}</div>`}function wt(){try{return Array.from(document.styleSheets).map(t=>{try{return Array.from(t.cssRules).map(e=>e.cssText).join(`
3
3
  `)}catch{return""}}).join(`
4
4
  `)}catch(t){return console.warn("Could not extract all stylesheets:",t),""}}async function vt(t,e,n,i){let o=wt();try{const c=ft(i),u=await pt(c,[t]);u&&(o+=`
@@ -1,4 +1,4 @@
1
- import{hy as Qr,hz as Ve,hA as bt,hB as to,hC as eo,hD as no,hE as ro,hF as we,hG as oo,hH as io,hI as $t,hJ as rt,hK as Lt,hL as ye,hM as ao,hN as Je,hO as ve,hP as lo,hQ as L,hR as _,hS as R,hT as Ke,hU as Ze,hV as Rt,hW as so,hX as co,hY as uo,hZ as Y,h_ as fo,h$ as ho,i0 as Pe,i1 as go,i2 as po,i3 as It,i4 as mo,i5 as Qe,i6 as xo,i7 as bo,dS as Tt,cK as wo,i8 as tn,i9 as yo,ia as Ee,ib as vo,ic as en,id as Po,ie as Eo,ig as To,ih as Ao,ii as nn,ij as So,ik as Co,il as No,im as Fo,b_ as rn,d4 as on,eM as Mo,dO as te,io as $o,ip as Io,iq as ko,dP as Te,eN as ee,eO as Ht,ir as ht,is as an,it as ln,iu as Oo,iv as Ae,iw as Lo,ix as Ro,iy as Ho,iz as sn,dN as Do}from"./runtime-E_iChIE5.js";import{e as Se,d as zo,b as cn,a as jo,f as un}from"./exportPageHtml-DTMmohn8.js";import"react";import{awaitExportImagesReady as Bo}from"./exportImageReadiness-CKbk6ouE.js";function Wo(t,e){const n=typeof t=="string"?t:new XMLSerializer().serializeToString(t),r=e.scale,o=Math.max(1,Math.round(e.width*r)),i=Math.max(1,Math.round(e.height*r)),a=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a);return new Promise((s,c)=>{const u=new Image,d=()=>URL.revokeObjectURL(l);u.onload=()=>{try{const f=document.createElement("canvas");f.width=o,f.height=i;const g=f.getContext("2d");if(!g){c(new Error("svgToPngDataUrl: 2D canvas context unavailable"));return}g.fillStyle="#ffffff",g.fillRect(0,0,o,i),g.imageSmoothingEnabled=!0,g.imageSmoothingQuality="high",g.drawImage(u,0,0,o,i),s(f.toDataURL("image/png"))}catch(f){c(f instanceof Error?f:new Error(String(f)))}finally{d()}},u.onerror=()=>{d(),c(new Error("svgToPngDataUrl: failed to load serialized SVG"))},u.src=l})}function dn(t){return t.length>=4&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?"png":t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255?"jpg":t.length>=4&&t[0]===71&&t[1]===73&&t[2]===70&&t[3]===56?"gif":t.length>=2&&t[0]===66&&t[1]===77?"bmp":t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80?"webp":null}function _o(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const o=r.naturalWidth||r.width,i=r.naturalHeight||r.height,a=document.createElement("canvas");a.width=Math.max(1,o),a.height=Math.max(1,i);const l=a.getContext("2d");if(!l){n(new Error("rasterizeToPngImage: 2D canvas context unavailable"));return}l.fillStyle="#ffffff",l.fillRect(0,0,a.width,a.height),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(r,0,0,a.width,a.height),e({bytes:Se(a.toDataURL("image/png")),type:"png",intrinsicWidth:o||void 0,intrinsicHeight:i||void 0})}catch(o){n(o instanceof Error?o:new Error(String(o)))}},r.onerror=()=>n(new Error("rasterizeToPngImage: failed to load image")),r.src=t})}async function fn(t,e){if(t.length===0)throw new Error("bytesToDocxImage: empty image body");const n=dn(t);return n&&n!=="webp"?{bytes:t,type:n}:_o(e)}async function qo(t){const e=await fetch(t);if(!e.ok)throw new Error(`fetchImageForDocx: HTTP ${e.status}`);return fn(new Uint8Array(await e.arrayBuffer()),t)}const Uo="layoutslot",hn={sm:120,md:240,lg:360},Go=12240,Xo=15840,gn=120,pn=90,Dt={style:rt.NONE,size:0,color:"auto"},mn={top:Dt,bottom:Dt,left:Dt,right:Dt,insideHorizontal:Dt,insideVertical:Dt},Yo={top:bt.TOP,middle:bt.CENTER,bottom:bt.BOTTOM},Vo=new Set(["p","h1","h2","h3","h4"]),xn=(t,e)=>Array.from(t.children).filter(n=>n.tagName.toLowerCase()===e),Ce=()=>new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}});function Jo(t){if(!/<(columns|layout)[\s>]/i.test(t))return{html:t,containers:[]};const e=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html"),n=[];return e.body.querySelectorAll("columns, layout").forEach(r=>{var o;if((o=r.parentElement)!=null&&o.closest("columns, layout"))return;const i=n.push(r.outerHTML)-1,a=e.createElement(Uo);a.setAttribute("data-layout-idx",String(i)),r.replaceWith(a)}),{html:e.body.innerHTML,containers:n}}function bn(t){const e=lo(t);return e===ao?void 0:e.slice(1).toUpperCase()}function ne(t){return t.containerWidthTwips&&t.containerWidthTwips>0?t.containerWidthTwips:(t.isLandscape?Xo:Go)-(t.leftMarginPx??40)*15-(t.rightMarginPx??40)*15}function Ko(t,e,n){const r=t&&oo.test(t)?io(t):null,o=r&&r.length===e?r:Array.from({length:e},()=>1);return wn(o,n)}function Zo(t,e){return wn(Array.from({length:t},()=>1),e)}function wn(t,e){const n=t.reduce((i,a)=>i+a,0),r=t.map(i=>Math.max(1,Math.floor(e*i/n))),o=r.reduce((i,a)=>i+a,0);return r[r.length-1]=r[r.length-1]+(e-o),r}function yn(t,e,n,r){return r(t,{...n,leftMarginPx:0,rightMarginPx:0,containerWidthTwips:e})}function Qo(t){return t.length===0?[Ce()]:t[t.length-1]instanceof $t?[...t,Ce()]:t}function vn({elements:t,fill:e,widthTwips:n,valign:r,gapTwips:o,index:i,count:a}){const l=Math.round(o/2),s=i===0?0:l,c=i===a-1?0:l;return new Je({children:Qo(t),width:{size:n,type:Lt.DXA},shading:e?{type:ve.CLEAR,color:"auto",fill:e}:void 0,borders:mn,margins:e?{top:pn,bottom:pn,left:Math.max(s,gn),right:Math.max(c,gn)}:{top:0,bottom:0,left:s,right:c},verticalAlign:r})}function Ne(t,e,n){return new $t({rows:t,layout:ye.FIXED,columnWidths:e,width:{size:e.reduce((r,o)=>r+o,0),type:Lt.DXA},indent:{size:(n.leftMarginPx??40)*15,type:Lt.DXA},borders:mn})}function ti(t,e){t[t.length-1]instanceof $t&&t.push(Ce()),t.push(e)}async function Pn(t,e,n){const r=ne(e),o=[];for(const i of t){const a=bn(i.el.getAttribute("bg"));if(!a){o.push(...await n(i.html,e));continue}const l=await yn(i.html,r,e,n),s=vn({elements:l,fill:a,widthTwips:r,valign:bt.TOP,gapTwips:0,index:0,count:1});ti(o,Ne([new we({children:[s]})],[r],e))}return o}async function En(t,e,n,r,o,i){const a=e.length,l=[];for(let s=0;s<a;s++){const c=t[s],u=c?await yn(c.html,e[s],o,i):[];l.push(vn({elements:u,fill:c?bn(c.el.getAttribute("bg")):void 0,widthTwips:e[s],valign:n,gapTwips:r,index:s,count:a}))}return new we({children:l})}async function ei(t,e,n){const r=xn(t,"column");if(r.length===0)return n(t.innerHTML,e);const o=r.map(l=>({el:l,html:l.innerHTML}));if(Qr(t.getAttribute("direction"))==="vertical")return Pn(o,e,n);const i=Ko(t.getAttribute("ratio"),o.length,ne(e)),a=await En(o,i,Yo[to(t.getAttribute("valign"))],hn[Ve(t.getAttribute("gap"))],e,n);return[Ne([a],i,e)]}function ni(t,e){const n=t.cloneNode(!0),r=n.ownerDocument,o=r.createElement("strong");o.textContent=`${e}. `;const i=Array.from(n.children).find(a=>Vo.has(a.tagName.toLowerCase()));if(i)i.prepend(o);else{const a=r.createElement("p");a.appendChild(o),n.prepend(a)}return n.innerHTML}async function ri(t,e,n){const r=xn(t,"cell");if(r.length===0)return n(t.innerHTML,e);const o=eo(t.getAttribute("variant")),i=no(ro(t.getAttribute("columns")),r.length,o),a=r.map((u,d)=>({el:u,html:o==="timeline"?ni(u,d+1):u.innerHTML}));if(i<=1)return Pn(a,e,n);const l=Zo(i,ne(e)),s=hn[Ve(t.getAttribute("gap"))],c=[];for(let u=0;u<a.length;u+=i)c.push(await En(a.slice(u,u+i),l,bt.TOP,s,e,n));return[Ne(c,l,e)]}async function oi(t,e,n){const r=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.firstElementChild;if(!r)return[];const o=r.tagName.toLowerCase();return o==="columns"?ei(r,e,n):o==="layout"?ri(r,e,n):n(r.innerHTML,e)}const ot="Arial",ii={"sans-serif":ot,"system-ui":ot,"ui-sans-serif":ot,"ui-rounded":ot,"-apple-system":ot,blinkmacsystemfont:ot,serif:"Times New Roman","ui-serif":"Times New Roman",monospace:"Courier New","ui-monospace":"Courier New",cursive:ot,fantasy:ot,math:ot,emoji:ot,fangsong:ot};function wt(t){if(!t)return ot;const e=(t.split(",")[0]??"").trim().replace(/^['"]|['"]$/g,"").trim();return e?ii[e.toLowerCase()]??e:ot}const yt=t=>new Ze({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:t}}}),zt=t=>new Ze({name:"w:instrText",attributes:{space:{key:"xml:space",value:"preserve"}}}).addChildElement(t);function ai(t,e,n){const r=o=>new R({...n,children:[o]});return[r(yt("begin")),r(zt(`PAGEREF ${t} \\h`)),r(yt("separate")),new R({...n,text:e}),r(yt("end"))]}const li=t=>new R({...t,children:[Ke.CURRENT]}),si=t=>new R({...t,children:[Ke.TOTAL_PAGES]}),ci=t=>t.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Tn=' < 1 "" "',An=(t,e)=>[e(yt("begin")),e(zt(t)),e(yt("separate")),e(yt("end"))];function ui(t,e){const n=o=>new R({...e,children:[o]}),r="field"in t?[n(zt(Tn)),...An(t.field,n),n(zt('"'))]:[n(zt(`${Tn}${ci(t.literal)}"`))];return[n(yt("begin")),n(zt("IF ")),...An("PAGE",n),...r,n(yt("separate")),n(yt("end"))]}const di=t=>t==="export-preview"?xo:bo;function Sn(t){return t.contentWidthPx!==void 0?t.contentWidthPx:t.isLandscape?Tt.CONTENT_AREA_LANDSCAPE.width:Tt.CONTENT_AREA.width}const Cn=24,Fe=15,Z=t=>({before:t*Fe,after:t*Fe}),Nn={h1:Z(16),h2:Z(12),h3:Z(8),h4:Z(4),p:Z(4),list:Z(16),table:Z(16),hr:Z(16),img:Z(8),chart:Z(8),layout:Z(8)},fi={...Nn,h1:Z(20),h2:Z(14),p:Z(3),list:Z(12),table:Z(12)},Fn=t=>t==="export-preview"?fi:Nn,At=t=>Math.round(t*1.5),jt=(t,e,n)=>{const r=(n.previewContext==="export-preview"?co:uo)[e];return Math.round(t*(r??1.2)*Fe)},Bt=_.AT_LEAST,Vt=t=>{if(t==="center")return Y.CENTER;if(t==="right")return Y.RIGHT;if(t==="justify")return Y.JUSTIFIED},hi={left:Y.LEFT,center:Y.CENTER,right:Y.RIGHT,justify:Y.JUSTIFIED},gi=/data-node-text-align="(left|center|right|justify)"/i,pi=/(?:^|[;\s"'])text-align\s*:\s*(left|center|right|justify)/i,re=t=>{var e,n;if(!t)return;const r=((e=t.match(gi))==null?void 0:e[1])??((n=t.match(pi))==null?void 0:n[1]);return r?hi[r.toLowerCase()]:void 0},mi=/<(?:p|h[1-4])\b([^>]*)>/i,oe=t=>{var e;return(e=t.match(mi))==null?void 0:e[1]},Mn={top:bt.TOP,middle:bt.CENTER,bottom:bt.BOTTOM},xi=/data-node-vertical-align="(top|middle|bottom)"/i,bi=/(?:^|[;\s"'])vertical-align\s*:\s*(top|middle|bottom)/i,$n=t=>t==="top"||t==="middle"||t==="bottom",wi=(t,e)=>{var n,r,o;const i=(o=((n=t.match(xi))==null?void 0:n[1])??((r=t.match(bi))==null?void 0:r[1]))==null?void 0:o.toLowerCase();return $n(i)?Mn[i]:$n(e)?Mn[e]:bt.TOP},kt=(t,e)=>{var n;const r=di(t.previewContext)[e],o=(n=t.componentColors)==null?void 0:n.textStyles,i=o==null?void 0:o[e];return{...r,...i}},k=t=>so(t),yi={color:/(?:^|;)\s*color\s*:\s*([^;"]+)/i,"background-color":/(?:^|;)\s*background-color\s*:\s*([^;"]+)/i,"text-transform":/(?:^|;)\s*text-transform\s*:\s*([^;"]+)/i,"font-size":/(?:^|;)\s*font-size\s*:\s*([^;"]+)/i};function vi(t){const[,e,n]=(t==null?void 0:t.match(/^(\d*\.?\d+)\s*(px|pt)$/i))??[];if(!e||!n)return;const r=parseFloat(e);if(!(!Number.isFinite(r)||r<=0))return n.toLowerCase()==="pt"?Math.round(r*2):At(r)}function ie(t,e,n){var r,o;return(t==null?void 0:t.trim())||((o=(r=e.match(yi[n]))==null?void 0:r[1])==null?void 0:o.trim())||void 0}const Pi=new Set(["span","mark","b","strong","i","em","u","a","code"]),Ei=new Set(["none","lowercase","capitalize","full-width","full-size-kana","initial"]),In=/[\u{1F000}-\u{1FFFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2B00}-\u{2BFF}][\uFE0F\u20E3]?/gu,Me="Segoe UI Emoji";function Ti(t){const e=new RegExp(In.source,In.flags),n=[];let r=0,o;for(;(o=e.exec(t))!==null;)o.index>r&&n.push({text:t.slice(r,o.index),isEmoji:!1}),n.push({text:o[0],isEmoji:!0}),r=e.lastIndex;return r<t.length&&n.push({text:t.slice(r),isEmoji:!1}),n.length===0?[{text:t,isEmoji:!1}]:n}function $e(t,e,n=Cn,r){const o=[],i=wt(e.documentFont),a=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").querySelector("div");if(!a)return o;let l=0;function s(c,u){var d,f,g,x,P;if(c.nodeType===Node.TEXT_NODE){const T=c.textContent||"";if(!T)return;const A=Ti(T);for(const y of A){if(!y.text)continue;const C=l;l=0,o.push(new R({break:C||void 0,text:y.text,bold:u.bold,italics:u.italic,underline:u.underline?{}:void 0,allCaps:u.allCaps,color:u.color,shading:u.shadingFill?{type:ve.CLEAR,color:"auto",fill:u.shadingFill}:void 0,font:y.isEmoji?{ascii:Me,hAnsi:Me,cs:Me}:{ascii:i,hAnsi:i},size:u.sizeHalfPoints??n}))}return}if(c.nodeType!==Node.ELEMENT_NODE)return;const p=c,b=p.tagName.toLowerCase();if(b==="br"){l+=1;return}const h=p.getAttribute("style")||"",m={...u};(b==="b"||b==="strong")&&(m.bold=!0),(b==="i"||b==="em")&&(m.italic=!0),b==="u"&&(m.underline=!0);const S=k(ie((d=p.style)==null?void 0:d.color,h,"color"));S&&(m.color=S);const M=vi(ie((f=p.style)==null?void 0:f.fontSize,h,"font-size"));M&&(m.sizeHalfPoints=M);const E=(x=ie((g=p.style)==null?void 0:g.textTransform,h,"text-transform"))==null?void 0:x.toLowerCase();if(E==="uppercase"?m.allCaps=!0:E&&Ei.has(E)&&(m.allCaps=void 0),Pi.has(b)){const T=k(ie((P=p.style)==null?void 0:P.backgroundColor,h,"background-color"));T&&(m.shadingFill=T)}for(const T of Array.from(c.childNodes))s(T,m)}return s(a,{bold:(r==null?void 0:r.bold)??!1,italic:(r==null?void 0:r.italic)??!1,underline:(r==null?void 0:r.underline)??!1,color:e.defaultTextColor}),l>1&&o.push(new R({break:l-1,font:{ascii:i,hAnsi:i},size:n})),o}function Ai(t,e,n){var r,o;const i=wt(e.documentFont),a=(e.leftMarginPx??40)*15,l=(e.rightMarginPx??40)*15,s=kt(e,"paragraph"),c=(o=(r=e.componentColors)==null?void 0:r.paragraph)!=null&&o.textColor?k(e.componentColors.paragraph.textColor):void 0,u=$e(t,{...e,defaultTextColor:c||e.defaultTextColor},At(s.fontSize),{bold:s.bold,italic:s.italic,underline:s.underline});return new L({children:u.length>0?u:[new R({text:"",font:i})],alignment:re(oe(t))??Vt(s.textAlign),spacing:{before:n.before,after:n.after,line:jt(s.fontSize,"paragraph",e),lineRule:Bt},indent:{left:a,right:l}})}const kn="\uE000";function Si(t){const e=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").querySelector("div");if(!e)return[""];e.querySelectorAll("br").forEach(r=>r.replaceWith(kn));const n=(e.textContent??"").replace(/[ \t\n\r\f]+/g," ").split(kn).map(r=>r.replace(/^ +| +$/g,"").replace(/\u00a0/g," "));return n.length>1&&n[n.length-1]===""&&n.pop(),n}function ae(t,e,n,r){var o,i;const a=wt(n.documentFont),l=(o=n.componentColors)==null?void 0:o.heading,s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=kt(n,`h${e}`),d=(i=t.match(/\bid="(dest-[^"]+)"/i))==null?void 0:i[1],f=Si(t);let g;if(l){const h=l[`h${e}`];h&&(g=k(h))}const x=k(l==null?void 0:l[`h${e}Bg`]),P={1:Rt.HEADING_1,2:Rt.HEADING_2,3:Rt.HEADING_3,4:Rt.HEADING_4},p=f.map((h,m)=>new R({break:m>0?1:void 0,text:h,font:a,size:At(u.fontSize),bold:u.bold,italics:u.italic,color:g,underline:u.underline?{}:void 0,shading:x?{type:ve.CLEAR,color:"auto",fill:x}:void 0})),b=d?[new Qe({id:d,children:p})]:p;return new L({children:b,heading:P[e],keepNext:!0,alignment:re(oe(t))??Vt(u.textAlign),spacing:{before:r.before,after:r.after,line:jt(u.fontSize,`h${e}`,n),lineRule:Bt},indent:{left:s,right:c}})}function On(t){switch(t){case"a":return"lower-letter-numbering";case"i":return"lower-roman-numbering";default:return"default-numbering"}}function Ln(t){var e,n;const r=(e=t.match(/<ol\b[^>]*>/i))==null?void 0:e[0];return((n=r==null?void 0:r.match(/\stype=["']?([^"'\s>]+)/i))==null?void 0:n[1])??null}let Ci=0;const Rn=()=>Ci+=1;function Hn(t,e,n,r){var o;const i=wt(n.documentFont),a=(o=n.componentColors)==null?void 0:o.list,l=kt(n,"listText"),s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=a!=null&&a.textColor?k(a.textColor):void 0,d=e?{reference:On(Ln(t)),level:0,instance:Rn()}:void 0,f=[],g=/<li[^>]*>(.*?)<\/li>/gi;let x;for(;(x=g.exec(t))!==null;)f.push(x[1]);return f.map((P,p)=>{const b=p===0,h=p===f.length-1,m=$e(P,{...n,defaultTextColor:u||n.defaultTextColor},At(l.fontSize),{bold:l.bold,italic:l.italic,underline:l.underline});return new L({children:m.length>0?m:[new R({text:"",font:i})],bullet:e?void 0:{level:0},numbering:d,alignment:Vt(l.textAlign),spacing:{before:b?r.before:0,after:h?r.after:90,line:jt(l.fontSize,"listText",n),lineRule:Bt},indent:{left:s+360,hanging:360,right:c}})})}function Ni(t){const e=t.match(/<(p|h[1-4])(?:\s[^>]*)?>[\s\S]*?<\/\1>/gi);if(!e||e.length<2)return[t];const n=r=>{var o;return((o=new DOMParser().parseFromString(r,"text/html").body.textContent)==null?void 0:o.trim())??""};return e.map(n).join("").replace(/\s+/g,"")!==n(t).replace(/\s+/g,"")?[t]:e}const Ie="data-cell-list",Dn=/<(ul|ol)\b[^>]*>((?:(?!<(?:ul|ol)\b)[\s\S])*?)<\/\1>/i;function Fi(t){let e=t;for(let n=e.match(Dn);n;n=e.match(Dn)){const r=n[0],o=(n[1]??"").toLowerCase(),i=n[2]??"",a=o==="ol"?Ln(r):null,l=o==="ol"?` ${Ie}-instance="${Rn()}"`+(a?` ${Ie}-type="${a}"`:""):"",s=i.replace(/<li\b[^>]*>\s*<p\b/gi,`<p ${Ie}="${o}"${l}`),c=n.index??0;e=e.slice(0,c)+s+e.slice(c+r.length)}return e}const Mi=t=>{var e,n,r,o;const i=(n=(e=t==null?void 0:t.match(/data-cell-list="(ul|ol)"/i))==null?void 0:e[1])==null?void 0:n.toLowerCase();if(i==="ul")return{kind:"ul"};if(i==="ol")return{kind:"ol",instance:Number(((r=t==null?void 0:t.match(/data-cell-list-instance="(\d+)"/i))==null?void 0:r[1])??0),type:((o=t==null?void 0:t.match(/data-cell-list-type="([^"]+)"/i))==null?void 0:o[1])??null}},$i=t=>{if(!t)return{};const e={left:360,hanging:360};return t.kind==="ul"?{bullet:{level:0},indent:e}:{numbering:{reference:On(t.type),level:0,instance:t.instance},indent:e}},zn=15,jn=t=>{var e;const n=wo((e=t.componentColors)==null?void 0:e.table),r=Math.round(n.y*zn),o=Math.round(n.x*zn);return{top:r,bottom:r,left:o,right:o}},Ii=t=>{const e=jn(t);return e.top+e.bottom},Bn=300,ki=100,Oi=15840,Li=12240;function Ri(t,e){var n;const r=parseInt(((n=t.match(/data-row-twips="(\d+)"/i))==null?void 0:n[1])??"",10);if(!Number.isFinite(r)||r<=0)return Bn;const o=e.isLandscape?Li:Oi,i=e.contentHeightPx&&e.contentHeightPx>0?Math.round(e.contentHeightPx*15):o;return r>i?Bn:Math.max(ki,r-Ii(e))}function Wn(t,e){var n,r;const o=(n=e.componentColors)==null?void 0:n.table,i=kt(e,"tableHeader").verticalAlign,a=jn(e),l=wt(e.documentFont),s=(e.leftMarginPx??40)*15,c=ne(e),u=t.match(/data-col-twips="([\d,]+)"/i),d=u!=null&&u[1]?u[1].split(",").map(M=>parseInt(M,10)).filter(M=>M>0):void 0,f=!!d&&d.length>0,g=[],x=[],P=[],p=/<(thead|tbody|tfoot)[^>]*>(?:[\s\S]*?)<\/\1>/gi;let b;for(;(b=p.exec(t))!==null;)P.push({tag:(b[1]??"").toLowerCase(),start:b.index,end:b.index+b[0].length});const h=new Map,m=/<tr([^>]*)>([\s\S]*?)<\/tr>/gi;let S;for(;(S=m.exec(t))!==null;){const M=S[1]??"",E=S[2]??"",T=S.index,A=P.findIndex(z=>T>=z.start&&T<z.end),y=(h.get(A)??0)+1;h.set(A,y);const C=(((r=P[A])==null?void 0:r.tag)??"tbody")==="tbody"&&y%2===0,D=[],V=/<th[\s>]/i.test(E),st=/<td[\s>]/i.test(E),tt=V&&!st;let ut=0;const gt=/<(th|td)([^>]*)>([\s\S]*?)<\/\1>/gi;let vt;for(;(vt=gt.exec(E))!==null;){const z=vt[2]||"",v=vt[3]||"",N=(vt[1]||"").toLowerCase()==="th",O=N&&tt,$=N&&!tt,j=O?"tableHeader":$?"tableHeaderColumn":"tableCell",U=kt(e,j),et=$?U.verticalAlign??i:U.verticalAlign,K=(o==null?void 0:o.headerColumnText)||(o==null?void 0:o.headerText),pt=O?o!=null&&o.headerText?k(o.headerText):void 0:$?K?k(K):void 0:o!=null&&o.cellText?k(o.cellText):void 0,Ct=re(z),J=Ni(Fi(v)),it=J.map(B=>re(oe(B))),nt=J.map(B=>Mi(oe(B))),dt=J.map(B=>$e(B,{...e,defaultTextColor:pt},At(U.fontSize),{bold:U.bold,italic:U.italic,underline:U.underline})),at=z.match(/colspan="(\d+)"/i),Ot=at!=null&&at[1]?parseInt(at[1],10):void 0,Gt=z.match(/rowspan="(\d+)"/i),Xt=Gt!=null&&Gt[1]?parseInt(Gt[1],10):void 0,Pt=Ot&&Ot>1?Ot:1,Nt=Xt&&Xt>1?Xt:1;for(;(x[ut]??0)>0;)ut+=1;const ft=ut;if(Nt>1)for(let B=ft;B<ft+Pt;B+=1)x[B]=Nt;ut=ft+Pt;const Ft=z.match(/data-colwidth="(\d+)"/i),Yt=z.match(new RegExp("(?<!min-)width:\\s*(\\d+)px","i")),Qt=Ft!=null&&Ft[1]?parseInt(Ft[1],10):Yt!=null&&Yt[1]?parseInt(Yt[1],10):void 0,xe=Qt?Math.round(Qt*15):void 0,Mt=(d&&ft+Pt<=d.length?d.slice(ft,ft+Pt).reduce((B,lt)=>B+lt,0):void 0)??xe,be=dt.map((B,lt)=>new L({children:B.length>0?B:[new R({text:"",font:l})],...$i(nt[lt]),alignment:it[lt]??Ct??Vt(U.textAlign),spacing:{before:0,after:0,...e.previewContext==="export-preview"?{line:jt(U.fontSize,j,e),lineRule:Bt}:{line:240,lineRule:_.AUTO}}}));D.push(new Je({children:be,columnSpan:Pt>1?Pt:void 0,rowSpan:Nt>1?Nt:void 0,width:Mt?{size:Mt,type:Lt.DXA}:void 0,shading:(()=>{const B=z.match(/background-color:\s*([^;"]+)/i),lt=B!=null&&B[1]?k(B[1].trim()):void 0;if(lt)return{fill:lt};if(O&&o!=null&&o.headerBg)return{fill:k(o.headerBg)||"FFFFFF"};if($){const Et=(o==null?void 0:o.headerColumnBg)||(o==null?void 0:o.headerBg);if(Et)return{fill:k(Et)||"FFFFFF"}}return!N&&C&&o!=null&&o.alternateRowBg?{fill:k(o.alternateRowBg)||"FFFFFF"}:{fill:o!=null&&o.cellBg&&k(o.cellBg)||"FFFFFF"}})(),borders:o!=null&&o.border?{top:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0,margins:{...a},verticalAlign:wi(z,et)}))}for(let z=0;z<x.length;z+=1)x[z]=Math.max(0,(x[z]??0)-1);D.length>0&&g.push(new we({children:D,cantSplit:!0,tableHeader:tt,height:{value:Ri(M,e),rule:mo.ATLEAST}}))}return new $t({rows:g,layout:f?ye.FIXED:ye.AUTOFIT,...f?{columnWidths:d}:{},width:{size:f?d.reduce((M,E)=>M+E,0):c,type:Lt.DXA},indent:{size:s,type:Lt.DXA},borders:o!=null&&o.border?{top:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},insideHorizontal:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},insideVertical:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0})}function _n(t){let e=t;for(;/<[^>]+>/.test(e);)e=e.replace(/<[^>]+>/g,"");return e}function Hi(t,e){var n;const r=wt(e.documentFont),o=(e.leftMarginPx??40)*15,i=(e.rightMarginPx??40)*15,a=(n=t.match(/\bdata-dest="(dest-[^"]+)"/i))==null?void 0:n[1];let l="dotted";/border-bottom:.*solid/i.test(t)?l="line":/border-bottom:.*dotted/i.test(t)?l="dotted":/font-weight:\s*500/i.test(t)||/margin-bottom:\s*8px/i.test(t)?l="modern":/font-size:\s*0\.9em/i.test(t)||/font-size:\s*0\.85em/i.test(t)?l="compact":/\[\d+\]|\[\.\.\.\]/.test(t)&&(l="simple");const s=t.match(/margin-left:\s*(\d+)px/),c=s?parseInt(s[1],10):0,u=/<span([^>]*)>(.*?)<\/span>/gi,d=[];let f;for(;(f=u.exec(t))!==null;)d.push({attrs:f[1]||"",content:f[2]||""});if(d.length<1)return null;const g=_n(d[0].content.replace(/&nbsp;/g," ").replace(/&amp;/g,"&")).trim();let x="";for(let z=d.length-1;z>=1;z--){const v=_n(d[z].content).trim();if(/\d+/.test(v)||v==="..."){x=v.replace(/^\[|\]$/g,"");break}}const P=o+Math.round(c/24)*300,p=12240-i,b=l==="line"||l==="modern",h=l==="compact"?"888888":void 0,m=kt(e,"paragraph").fontSize,S=l==="compact"?m*.9:m,M=l==="compact"?m*.85:l==="modern"?m*.95:m,E=At(S),T=At(M),A=l==="simple"?"[":"",y=l==="simple"?"]":"",C=`${A}${x}${y}`,D=l==="dotted"?Pe.DOT:l==="line"?Pe.UNDERSCORE:Pe.NONE,V=l==="modern"?60:l==="compact"?30:60,st=l==="modern"?180:l==="compact"?30:120,tt={font:r,size:T,bold:b||void 0,color:h},ut=e.tocPagerefFields&&a&&/^\d+$/.test(x)?[...A?[new R({...tt,text:A})]:[],...ai(a,x,tt),...y?[new R({...tt,text:y})]:[]]:[new R({...tt,text:C})],gt=[new R({text:g,font:r,size:E,bold:void 0}),new R({children:[new fo],font:r,size:T}),...ut],vt=a?[new ho({anchor:a,children:gt})]:gt;return new L({children:vt,tabStops:[{type:go.RIGHT,position:p,leader:D}],spacing:{before:V,after:st,line:jt(Math.max(S,M),"paragraph",e),lineRule:Bt},indent:{left:P,right:i}})}function Di(t,e){const n=(t.leftMarginPx??40)*15,r=(t.rightMarginPx??40)*15;return new L({children:[new R({text:""})],border:{bottom:{style:rt.SINGLE,size:6,space:1,color:"E0E0E0"}},spacing:{before:e.before,after:e.after,line:240,lineRule:_.AUTO},indent:{left:n,right:r}})}const zi=320,ji=3;function Jt(t){if(!t||!/^\d+(\.\d+)?$/.test(t.trim()))return;const e=Number(t);return e>0?e:void 0}function ke(t,e,n){const r=wt(e.documentFont),o=(e.leftMarginPx??40)*15,i=(e.rightMarginPx??40)*15,a={style:rt.SINGLE,size:6,space:4,color:"E0E0E0"};return new L({children:[new R({text:t,font:r,size:Cn,italics:!0})],border:{top:a,bottom:a,left:a,right:a},alignment:Y.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO},indent:{left:o,right:i}})}function Oe(t,e,n){return ke(`Chart: ${t} (see PDF export)`,e,n)}function Le(t,e,n){const r=t!=null&&t.trim()?`Image: ${t.trim()} (could not be embedded)`:"Image (could not be embedded)";return ke(r,e,n)}async function Bi(t,e,n){var r;const o=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.querySelector("[data-chart-type]");if(!o)return[];const i=o.getAttribute("data-chart-type")||"chart",a=o.querySelector("svg");if(a){const s=Sn(e),c=Jt(a.getAttribute("width")),u=Jt(a.getAttribute("height")),d=Jt((r=(o.getAttribute("style")||"").match(/height:\s*([\d.]+)px/i))==null?void 0:r[1]),f=c??s,g=u??d??zi;try{const x=await Wo(a,{width:f,height:g,scale:ji}),P=Se(x);if(P.length>0)return[new L({children:[new It({type:"png",data:P,transformation:{width:f,height:g}})],alignment:Y.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO}})]}catch(x){console.error(`Failed to rasterize chart "${i}" for DOCX:`,x)}return[Oe(i,e,n)]}const l=o.querySelector("table");return l?[Wn(l.outerHTML,e)]:[Oe(i,e,n)]}function Wi(t,e,n,r,o){let i=t,a=e;const l=!!n&&!!r;return!i&&!a&&l?(i=n,a=r):i&&!a?a=l?i*(r/n):i*(2/3):!i&&a&&(i=l?a*(n/r):a*(3/2)),i||(i=o),a||(a=Math.round(i*(2/3))),i>o&&(a=Math.round(a*(o/i)),i=o),{width:Math.round(i),height:Math.round(a)}}function _i(t){return t==="center"?Y.CENTER:t==="right"?Y.RIGHT:Y.LEFT}async function qi(t,e,n){const r=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.querySelector("img"),o=(r==null?void 0:r.getAttribute("src"))||"",i=(r==null?void 0:r.getAttribute("alt"))||void 0,a=Jt(r==null?void 0:r.getAttribute("width")),l=Jt(r==null?void 0:r.getAttribute("height")),s=_i(r==null?void 0:r.getAttribute("data-align"));if(!o)return Le(i,e,n);const c=Sn(e);try{const u=await po(o,void 0,"original")||o,d=u.startsWith("data:")?await fn(Se(u),u):await qo(u);if(d.bytes.length===0)return Le(i,e,n);const{width:f,height:g}=Wi(a,l,d.intrinsicWidth,d.intrinsicHeight,c);return new L({children:[new It({type:d.type,data:d.bytes,transformation:{width:f,height:g}})],alignment:s,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO}})}catch(u){return console.error("Failed to embed inline image for DOCX:",u),Le(i,e,n)}}const Ui=/^\s*<([a-z][a-z0-9]*)/i,qn=t=>{var e,n;return((n=(e=t.match(Ui))==null?void 0:e[1])==null?void 0:n.toLowerCase())??""};function Gi(t){switch(qn(t)){case"chartslot":return"chart";case"layoutslot":return"layout";case"h1":return/class="[^"]*section-title-from-h2/i.test(t)?"h2":"h1";case"h2":return"h2";case"h3":return"h3";case"h4":return"h4";case"ul":case"ol":return"list";case"table":return"table";case"hr":return"hr";case"img":return"img";default:return"p"}}const Re=t=>t!=="table";function Xi(t,e){const n=Fn(e.previewContext),r=t.map(s=>n[s]),o=e.containerWidthTwips===void 0,i=t.map((s,c)=>c===0&&!o?r[c].before:0),a=t.map((s,c)=>Re(s)?r[c].after:0),l=t.map(()=>0);for(let s=1;s<t.length;s++){const c=Math.max(r[s-1].after,r[s].before);l[s]=c,Re(t[s])?i[s]=Math.max(0,c-a[s-1]):Re(t[s-1])&&(a[s-1]=c)}return{spacing:t.map((s,c)=>({before:i[c],after:a[c]})),collapsedGap:l}}const Yi=2,Vi=20;function Ji(t){return new L({children:[new R({text:"",size:Yi})],spacing:{before:0,after:t,line:Vi,lineRule:_.EXACT}})}async function Un(t,e={},n=!1){var r,o;const i=[],a=/<div[^>]*data-toc-page="[^"]*"[^>]*>.*?<\/div>/gi,l=t.match(a)||[];if(l.length>0){const b=t.match(/<h1[^>]*>(.*?)<\/h1>/i);if(b){const h=wt(e.documentFont),m=(r=e.componentColors)==null?void 0:r.heading,S=(e.leftMarginPx??40)*15,M=(e.rightMarginPx??40)*15,E=kt(e,"h1");let T;if(m){const A=m.h1;A&&(T=k(A))}i.push(new L({children:[new R({text:((o=b[1])==null?void 0:o.replace(/<[^>]+>/g,"").trim())||"Table of Contents",font:h,size:At(E.fontSize),bold:E.bold,italics:E.italic,color:T,underline:E.underline?{}:void 0})],heading:Rt.HEADING_1,alignment:Vt(E.textAlign),spacing:{before:0,after:Fn(e.previewContext).h1.after,line:jt(E.fontSize,"h1",e),lineRule:Bt},indent:{left:S,right:M}}))}for(const h of l)try{const m=Hi(h,e);m&&i.push(m)}catch(m){console.error("Failed to parse TOC item:",m)}return i}t=t.replace(/<div[^>]*data-page-break="true"[^>]*>.*?<\/div>/gis,""),t=t.replace(/<div[^>]*class="page-break-marker"[^>]*>.*?<\/div>/gis,"");const{html:s,containers:c}=Jo(t);t=s;const u=[];if(/data-chart-type=/i.test(t)){const b=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html");b.body.querySelectorAll("[data-chart-type]").forEach(h=>{const m=u.push(h.outerHTML)-1,S=b.createElement("chartslot");S.setAttribute("data-chart-idx",String(m)),h.replaceWith(S)}),t=b.body.innerHTML}t=t.replace(/<div[^>]*class="page-content[^"]*"[^>]*>/gi,""),t=t.replace(/<\/div>/gi,""),t=t.replace(/<p[^>]*>\s*(<img[^>]*>)\s*<\/p>/gi,"$1");const d=/(<h[1-4][^>]*>[\s\S]*?<\/h[1-4]>|<p[^>]*>[\s\S]*?<\/p>|<ul[^>]*>[\s\S]*?<\/ul>|<ol[^>]*>[\s\S]*?<\/ol>|<table[^>]*>[\s\S]*?<\/table>|<hr[^>]*>|<img[^>]*>|<chartslot[^>]*><\/chartslot>|<layoutslot[^>]*><\/layoutslot>)/gi,f=t.match(d)||[],g=f.map(Gi),{spacing:x,collapsedGap:P}=Xi(g,e);let p=0;for(let b=0;b<f.length;b++){const h=f[b],m=x[b],S=i.length,M=b===0?0:Math.max(0,P[b]-p),E=b===0||g[b]==="table"?m:{before:M,after:m.after};try{switch(qn(h)){case"chartslot":{const y=h.match(/data-chart-idx="(\d+)"/i),C=y?u[Number(y[1])]:void 0;C?i.push(...await Bi(C,e,E)):i.push(Oe("chart",e,E));break}case"layoutslot":{const y=h.match(/data-layout-idx="(\d+)"/i),C=y?c[Number(y[1])]:void 0;C?i.push(...await oi(C,e,Un)):i.push(ke("Layout section (see PDF export)",e,E));break}case"h1":{const y=/class="[^"]*section-title-from-h2/i.test(h)?2:1;i.push(ae(h,y,e,E));break}case"h2":i.push(ae(h,2,e,E));break;case"h3":i.push(ae(h,3,e,E));break;case"h4":i.push(ae(h,4,e,E));break;case"ul":i.push(...Hn(h,!1,e,E));break;case"ol":i.push(...Hn(h,!0,e,E));break;case"table":i.push(Wn(h,e));break;case"hr":i.push(Di(e,E));break;case"img":i.push(await qi(h,e,E));break;default:i.push(Ai(h,e,E))}}catch(y){console.error("Failed to parse block:",h,y)}const T=i[S]instanceof $t,A=T&&i[S-1]instanceof $t;if(S>0&&T&&(A||M>0)&&i.splice(S,0,Ji(M)),i.length>S){const y=i[i.length-1]instanceof $t,C=g[b]!=="layout";p=y||!C?0:m.after}}return i.length===0&&i.push(new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}})),i}const Ki=["MM/DD/YYYY","DD/MM/YYYY","DD MMM YYYY","MMM DD, YYYY","YYYY-MM-DD"];function Zi(t){return typeof t=="string"&&Ki.includes(t)}const He=987654321,le=987654322,De=/\{%[^%\n]*%\}/g;function Gn(t){const e=t.slice(2,-2).toLowerCase();return e==="page_number"?"page-number":e==="total_pages"?"total-pages":"text"}function Qi(t){return JSON.stringify([t.bold??!1,t.italics??!1,t.underline??!1,t.strike??!1,t.color??"",t.fontSizePx??0,t.fontFamily??""])}function Wt(t,e,n,r=!1){const o=t==="text"?{kind:t,text:e,...n}:{kind:t,...n};return r?{...o,hiddenAtPageZero:!0}:o}function ta(t,e){return Ee(t==="page-number"?"{%page_number%}":"{%total_pages%}",{pageNumber:0,variableValues:e.variableValues,currentDateText:e.currentDateText})===""}function ea(t,e,n){const r=[];let o="",i=null,a={};const l=()=>{i!==null&&o!==""&&r.push(Wt("text",o,a)),o="",i=null};for(const s of t){const c=e(s.rawIndex);if(s.kind!=="text"){l(),r.push(Wt(s.kind,"",c,ta(s.kind,n)));continue}if(s.text==="")continue;const u=Qi(c);u!==i&&(l(),i=u,a=c),o+=s.text}return l(),r}function se(t,e,n){const r={pageNumber:0,variableValues:n.variableValues,currentDateText:n.currentDateText},o=[];let i=0;for(const a of t.matchAll(De)){const l=a.index;for(let u=i;u<l;u++)o.push({kind:"text",text:t[u],rawIndex:u});const s=a[0],c=Gn(s);o.push({kind:c,text:c==="text"?Ee(s,r):"",rawIndex:l}),i=l+s.length}for(let a=i;a<t.length;a++)o.push({kind:"text",text:t[a],rawIndex:a});return ea(o,e,n)}function Xn(t){for(const e of t.matchAll(De))if(Gn(e[0])!=="text")return!0;return!1}function Yn(t,e){const n={pageNumber:e.pageNumber,totalPages:e.totalPages,variableValues:e.variableValues,currentDateText:e.currentDateText},r=new Array(t.length+1);let o="",i=0;const a=(l,s)=>{for(let c=l;c<s;c++)r[c]=o.length,o+=t[c]};for(const l of t.matchAll(De)){const s=l.index;a(i,s);const c=l[0];for(let u=s;u<s+c.length;u++)r[u]=o.length;o+=Ee(c,n),i=s+c.length}return a(i,t.length),r[t.length]=o.length,{painted:o,paintedOffsets:r}}function Vn(t,e){const n=en(t,He,le),r=en(t,0,le)==="",o=[];for(const i of n.split(new RegExp(`(${He}|${le})`)))i!==""&&(i===String(He)?o.push(Wt("page-number","",e,r)):i===String(le)?o.push(Wt("total-pages","",e,r)):o.push(Wt("text",i,e,r)));return o}function Jn(t,e,n){const r=t==null?void 0:t.pageNumberFormat;if(!tn(r))return null;const o=yo(t,n.pageNumber,n.totalPages);return o===void 0?null:{runs:Vn(r,e),painted:o}}function na(t,e,n){const r=t,o=r==null?void 0:r.pageNumberFormat;if(tn(o))return Vn(o,e);const i=r==null?void 0:r.dateFormat;return Zi(i)?[Wt("text",vo(i,n),e)]:null}const Kn=new Set(["paragraph","heading","blockquote"]),ra=t=>(t.content??[]).some(e=>Kn.has(e.type??""));function Zn(t){const e=t;if(!e||typeof e!="object"||!Array.isArray(e.content))return null;let n="",r=!1,o=0;const i=a=>{var l;switch(a.type){case"text":n+=a.text??"";return;case"variable":{const s=(l=a.attrs)==null?void 0:l.name;if(typeof s!="string"||s==="")return;r=!0,n+=`{%${s}%}`;return}case"hardBreak":n+=`
1
+ import{hy as Qr,hz as Ve,hA as bt,hB as to,hC as eo,hD as no,hE as ro,hF as we,hG as oo,hH as io,hI as $t,hJ as rt,hK as Lt,hL as ye,hM as ao,hN as Je,hO as ve,hP as lo,hQ as L,hR as _,hS as R,hT as Ke,hU as Ze,hV as Rt,hW as so,hX as co,hY as uo,hZ as Y,h_ as fo,h$ as ho,i0 as Pe,i1 as go,i2 as po,i3 as It,i4 as mo,i5 as Qe,i6 as xo,i7 as bo,dS as Tt,cK as wo,i8 as tn,i9 as yo,ia as Ee,ib as vo,ic as en,id as Po,ie as Eo,ig as To,ih as Ao,ii as nn,ij as So,ik as Co,il as No,im as Fo,b_ as rn,d4 as on,eM as Mo,dO as te,io as $o,ip as Io,iq as ko,dP as Te,eN as ee,eO as Ht,ir as ht,is as an,it as ln,iu as Oo,iv as Ae,iw as Lo,ix as Ro,iy as Ho,iz as sn,dN as Do}from"./runtime-Epi5dRMP.js";import{e as Se,d as zo,b as cn,a as jo,f as un}from"./exportPageHtml-nOa0TJeA.js";import"react";import{awaitExportImagesReady as Bo}from"./exportImageReadiness-BLHV4KA3.js";function Wo(t,e){const n=typeof t=="string"?t:new XMLSerializer().serializeToString(t),r=e.scale,o=Math.max(1,Math.round(e.width*r)),i=Math.max(1,Math.round(e.height*r)),a=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a);return new Promise((s,c)=>{const u=new Image,d=()=>URL.revokeObjectURL(l);u.onload=()=>{try{const f=document.createElement("canvas");f.width=o,f.height=i;const g=f.getContext("2d");if(!g){c(new Error("svgToPngDataUrl: 2D canvas context unavailable"));return}g.fillStyle="#ffffff",g.fillRect(0,0,o,i),g.imageSmoothingEnabled=!0,g.imageSmoothingQuality="high",g.drawImage(u,0,0,o,i),s(f.toDataURL("image/png"))}catch(f){c(f instanceof Error?f:new Error(String(f)))}finally{d()}},u.onerror=()=>{d(),c(new Error("svgToPngDataUrl: failed to load serialized SVG"))},u.src=l})}function dn(t){return t.length>=4&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?"png":t.length>=3&&t[0]===255&&t[1]===216&&t[2]===255?"jpg":t.length>=4&&t[0]===71&&t[1]===73&&t[2]===70&&t[3]===56?"gif":t.length>=2&&t[0]===66&&t[1]===77?"bmp":t.length>=12&&t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80?"webp":null}function _o(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const o=r.naturalWidth||r.width,i=r.naturalHeight||r.height,a=document.createElement("canvas");a.width=Math.max(1,o),a.height=Math.max(1,i);const l=a.getContext("2d");if(!l){n(new Error("rasterizeToPngImage: 2D canvas context unavailable"));return}l.fillStyle="#ffffff",l.fillRect(0,0,a.width,a.height),l.imageSmoothingEnabled=!0,l.imageSmoothingQuality="high",l.drawImage(r,0,0,a.width,a.height),e({bytes:Se(a.toDataURL("image/png")),type:"png",intrinsicWidth:o||void 0,intrinsicHeight:i||void 0})}catch(o){n(o instanceof Error?o:new Error(String(o)))}},r.onerror=()=>n(new Error("rasterizeToPngImage: failed to load image")),r.src=t})}async function fn(t,e){if(t.length===0)throw new Error("bytesToDocxImage: empty image body");const n=dn(t);return n&&n!=="webp"?{bytes:t,type:n}:_o(e)}async function qo(t){const e=await fetch(t);if(!e.ok)throw new Error(`fetchImageForDocx: HTTP ${e.status}`);return fn(new Uint8Array(await e.arrayBuffer()),t)}const Uo="layoutslot",hn={sm:120,md:240,lg:360},Go=12240,Xo=15840,gn=120,pn=90,Dt={style:rt.NONE,size:0,color:"auto"},mn={top:Dt,bottom:Dt,left:Dt,right:Dt,insideHorizontal:Dt,insideVertical:Dt},Yo={top:bt.TOP,middle:bt.CENTER,bottom:bt.BOTTOM},Vo=new Set(["p","h1","h2","h3","h4"]),xn=(t,e)=>Array.from(t.children).filter(n=>n.tagName.toLowerCase()===e),Ce=()=>new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}});function Jo(t){if(!/<(columns|layout)[\s>]/i.test(t))return{html:t,containers:[]};const e=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html"),n=[];return e.body.querySelectorAll("columns, layout").forEach(r=>{var o;if((o=r.parentElement)!=null&&o.closest("columns, layout"))return;const i=n.push(r.outerHTML)-1,a=e.createElement(Uo);a.setAttribute("data-layout-idx",String(i)),r.replaceWith(a)}),{html:e.body.innerHTML,containers:n}}function bn(t){const e=lo(t);return e===ao?void 0:e.slice(1).toUpperCase()}function ne(t){return t.containerWidthTwips&&t.containerWidthTwips>0?t.containerWidthTwips:(t.isLandscape?Xo:Go)-(t.leftMarginPx??40)*15-(t.rightMarginPx??40)*15}function Ko(t,e,n){const r=t&&oo.test(t)?io(t):null,o=r&&r.length===e?r:Array.from({length:e},()=>1);return wn(o,n)}function Zo(t,e){return wn(Array.from({length:t},()=>1),e)}function wn(t,e){const n=t.reduce((i,a)=>i+a,0),r=t.map(i=>Math.max(1,Math.floor(e*i/n))),o=r.reduce((i,a)=>i+a,0);return r[r.length-1]=r[r.length-1]+(e-o),r}function yn(t,e,n,r){return r(t,{...n,leftMarginPx:0,rightMarginPx:0,containerWidthTwips:e})}function Qo(t){return t.length===0?[Ce()]:t[t.length-1]instanceof $t?[...t,Ce()]:t}function vn({elements:t,fill:e,widthTwips:n,valign:r,gapTwips:o,index:i,count:a}){const l=Math.round(o/2),s=i===0?0:l,c=i===a-1?0:l;return new Je({children:Qo(t),width:{size:n,type:Lt.DXA},shading:e?{type:ve.CLEAR,color:"auto",fill:e}:void 0,borders:mn,margins:e?{top:pn,bottom:pn,left:Math.max(s,gn),right:Math.max(c,gn)}:{top:0,bottom:0,left:s,right:c},verticalAlign:r})}function Ne(t,e,n){return new $t({rows:t,layout:ye.FIXED,columnWidths:e,width:{size:e.reduce((r,o)=>r+o,0),type:Lt.DXA},indent:{size:(n.leftMarginPx??40)*15,type:Lt.DXA},borders:mn})}function ti(t,e){t[t.length-1]instanceof $t&&t.push(Ce()),t.push(e)}async function Pn(t,e,n){const r=ne(e),o=[];for(const i of t){const a=bn(i.el.getAttribute("bg"));if(!a){o.push(...await n(i.html,e));continue}const l=await yn(i.html,r,e,n),s=vn({elements:l,fill:a,widthTwips:r,valign:bt.TOP,gapTwips:0,index:0,count:1});ti(o,Ne([new we({children:[s]})],[r],e))}return o}async function En(t,e,n,r,o,i){const a=e.length,l=[];for(let s=0;s<a;s++){const c=t[s],u=c?await yn(c.html,e[s],o,i):[];l.push(vn({elements:u,fill:c?bn(c.el.getAttribute("bg")):void 0,widthTwips:e[s],valign:n,gapTwips:r,index:s,count:a}))}return new we({children:l})}async function ei(t,e,n){const r=xn(t,"column");if(r.length===0)return n(t.innerHTML,e);const o=r.map(l=>({el:l,html:l.innerHTML}));if(Qr(t.getAttribute("direction"))==="vertical")return Pn(o,e,n);const i=Ko(t.getAttribute("ratio"),o.length,ne(e)),a=await En(o,i,Yo[to(t.getAttribute("valign"))],hn[Ve(t.getAttribute("gap"))],e,n);return[Ne([a],i,e)]}function ni(t,e){const n=t.cloneNode(!0),r=n.ownerDocument,o=r.createElement("strong");o.textContent=`${e}. `;const i=Array.from(n.children).find(a=>Vo.has(a.tagName.toLowerCase()));if(i)i.prepend(o);else{const a=r.createElement("p");a.appendChild(o),n.prepend(a)}return n.innerHTML}async function ri(t,e,n){const r=xn(t,"cell");if(r.length===0)return n(t.innerHTML,e);const o=eo(t.getAttribute("variant")),i=no(ro(t.getAttribute("columns")),r.length,o),a=r.map((u,d)=>({el:u,html:o==="timeline"?ni(u,d+1):u.innerHTML}));if(i<=1)return Pn(a,e,n);const l=Zo(i,ne(e)),s=hn[Ve(t.getAttribute("gap"))],c=[];for(let u=0;u<a.length;u+=i)c.push(await En(a.slice(u,u+i),l,bt.TOP,s,e,n));return[Ne(c,l,e)]}async function oi(t,e,n){const r=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.firstElementChild;if(!r)return[];const o=r.tagName.toLowerCase();return o==="columns"?ei(r,e,n):o==="layout"?ri(r,e,n):n(r.innerHTML,e)}const ot="Arial",ii={"sans-serif":ot,"system-ui":ot,"ui-sans-serif":ot,"ui-rounded":ot,"-apple-system":ot,blinkmacsystemfont:ot,serif:"Times New Roman","ui-serif":"Times New Roman",monospace:"Courier New","ui-monospace":"Courier New",cursive:ot,fantasy:ot,math:ot,emoji:ot,fangsong:ot};function wt(t){if(!t)return ot;const e=(t.split(",")[0]??"").trim().replace(/^['"]|['"]$/g,"").trim();return e?ii[e.toLowerCase()]??e:ot}const yt=t=>new Ze({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:t}}}),zt=t=>new Ze({name:"w:instrText",attributes:{space:{key:"xml:space",value:"preserve"}}}).addChildElement(t);function ai(t,e,n){const r=o=>new R({...n,children:[o]});return[r(yt("begin")),r(zt(`PAGEREF ${t} \\h`)),r(yt("separate")),new R({...n,text:e}),r(yt("end"))]}const li=t=>new R({...t,children:[Ke.CURRENT]}),si=t=>new R({...t,children:[Ke.TOTAL_PAGES]}),ci=t=>t.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Tn=' < 1 "" "',An=(t,e)=>[e(yt("begin")),e(zt(t)),e(yt("separate")),e(yt("end"))];function ui(t,e){const n=o=>new R({...e,children:[o]}),r="field"in t?[n(zt(Tn)),...An(t.field,n),n(zt('"'))]:[n(zt(`${Tn}${ci(t.literal)}"`))];return[n(yt("begin")),n(zt("IF ")),...An("PAGE",n),...r,n(yt("separate")),n(yt("end"))]}const di=t=>t==="export-preview"?xo:bo;function Sn(t){return t.contentWidthPx!==void 0?t.contentWidthPx:t.isLandscape?Tt.CONTENT_AREA_LANDSCAPE.width:Tt.CONTENT_AREA.width}const Cn=24,Fe=15,Z=t=>({before:t*Fe,after:t*Fe}),Nn={h1:Z(16),h2:Z(12),h3:Z(8),h4:Z(4),p:Z(4),list:Z(16),table:Z(16),hr:Z(16),img:Z(8),chart:Z(8),layout:Z(8)},fi={...Nn,h1:Z(20),h2:Z(14),p:Z(3),list:Z(12),table:Z(12)},Fn=t=>t==="export-preview"?fi:Nn,At=t=>Math.round(t*1.5),jt=(t,e,n)=>{const r=(n.previewContext==="export-preview"?co:uo)[e];return Math.round(t*(r??1.2)*Fe)},Bt=_.AT_LEAST,Vt=t=>{if(t==="center")return Y.CENTER;if(t==="right")return Y.RIGHT;if(t==="justify")return Y.JUSTIFIED},hi={left:Y.LEFT,center:Y.CENTER,right:Y.RIGHT,justify:Y.JUSTIFIED},gi=/data-node-text-align="(left|center|right|justify)"/i,pi=/(?:^|[;\s"'])text-align\s*:\s*(left|center|right|justify)/i,re=t=>{var e,n;if(!t)return;const r=((e=t.match(gi))==null?void 0:e[1])??((n=t.match(pi))==null?void 0:n[1]);return r?hi[r.toLowerCase()]:void 0},mi=/<(?:p|h[1-4])\b([^>]*)>/i,oe=t=>{var e;return(e=t.match(mi))==null?void 0:e[1]},Mn={top:bt.TOP,middle:bt.CENTER,bottom:bt.BOTTOM},xi=/data-node-vertical-align="(top|middle|bottom)"/i,bi=/(?:^|[;\s"'])vertical-align\s*:\s*(top|middle|bottom)/i,$n=t=>t==="top"||t==="middle"||t==="bottom",wi=(t,e)=>{var n,r,o;const i=(o=((n=t.match(xi))==null?void 0:n[1])??((r=t.match(bi))==null?void 0:r[1]))==null?void 0:o.toLowerCase();return $n(i)?Mn[i]:$n(e)?Mn[e]:bt.TOP},kt=(t,e)=>{var n;const r=di(t.previewContext)[e],o=(n=t.componentColors)==null?void 0:n.textStyles,i=o==null?void 0:o[e];return{...r,...i}},k=t=>so(t),yi={color:/(?:^|;)\s*color\s*:\s*([^;"]+)/i,"background-color":/(?:^|;)\s*background-color\s*:\s*([^;"]+)/i,"text-transform":/(?:^|;)\s*text-transform\s*:\s*([^;"]+)/i,"font-size":/(?:^|;)\s*font-size\s*:\s*([^;"]+)/i};function vi(t){const[,e,n]=(t==null?void 0:t.match(/^(\d*\.?\d+)\s*(px|pt)$/i))??[];if(!e||!n)return;const r=parseFloat(e);if(!(!Number.isFinite(r)||r<=0))return n.toLowerCase()==="pt"?Math.round(r*2):At(r)}function ie(t,e,n){var r,o;return(t==null?void 0:t.trim())||((o=(r=e.match(yi[n]))==null?void 0:r[1])==null?void 0:o.trim())||void 0}const Pi=new Set(["span","mark","b","strong","i","em","u","a","code"]),Ei=new Set(["none","lowercase","capitalize","full-width","full-size-kana","initial"]),In=/[\u{1F000}-\u{1FFFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2B00}-\u{2BFF}][\uFE0F\u20E3]?/gu,Me="Segoe UI Emoji";function Ti(t){const e=new RegExp(In.source,In.flags),n=[];let r=0,o;for(;(o=e.exec(t))!==null;)o.index>r&&n.push({text:t.slice(r,o.index),isEmoji:!1}),n.push({text:o[0],isEmoji:!0}),r=e.lastIndex;return r<t.length&&n.push({text:t.slice(r),isEmoji:!1}),n.length===0?[{text:t,isEmoji:!1}]:n}function $e(t,e,n=Cn,r){const o=[],i=wt(e.documentFont),a=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").querySelector("div");if(!a)return o;let l=0;function s(c,u){var d,f,g,x,P;if(c.nodeType===Node.TEXT_NODE){const T=c.textContent||"";if(!T)return;const A=Ti(T);for(const y of A){if(!y.text)continue;const C=l;l=0,o.push(new R({break:C||void 0,text:y.text,bold:u.bold,italics:u.italic,underline:u.underline?{}:void 0,allCaps:u.allCaps,color:u.color,shading:u.shadingFill?{type:ve.CLEAR,color:"auto",fill:u.shadingFill}:void 0,font:y.isEmoji?{ascii:Me,hAnsi:Me,cs:Me}:{ascii:i,hAnsi:i},size:u.sizeHalfPoints??n}))}return}if(c.nodeType!==Node.ELEMENT_NODE)return;const p=c,b=p.tagName.toLowerCase();if(b==="br"){l+=1;return}const h=p.getAttribute("style")||"",m={...u};(b==="b"||b==="strong")&&(m.bold=!0),(b==="i"||b==="em")&&(m.italic=!0),b==="u"&&(m.underline=!0);const S=k(ie((d=p.style)==null?void 0:d.color,h,"color"));S&&(m.color=S);const M=vi(ie((f=p.style)==null?void 0:f.fontSize,h,"font-size"));M&&(m.sizeHalfPoints=M);const E=(x=ie((g=p.style)==null?void 0:g.textTransform,h,"text-transform"))==null?void 0:x.toLowerCase();if(E==="uppercase"?m.allCaps=!0:E&&Ei.has(E)&&(m.allCaps=void 0),Pi.has(b)){const T=k(ie((P=p.style)==null?void 0:P.backgroundColor,h,"background-color"));T&&(m.shadingFill=T)}for(const T of Array.from(c.childNodes))s(T,m)}return s(a,{bold:(r==null?void 0:r.bold)??!1,italic:(r==null?void 0:r.italic)??!1,underline:(r==null?void 0:r.underline)??!1,color:e.defaultTextColor}),l>1&&o.push(new R({break:l-1,font:{ascii:i,hAnsi:i},size:n})),o}function Ai(t,e,n){var r,o;const i=wt(e.documentFont),a=(e.leftMarginPx??40)*15,l=(e.rightMarginPx??40)*15,s=kt(e,"paragraph"),c=(o=(r=e.componentColors)==null?void 0:r.paragraph)!=null&&o.textColor?k(e.componentColors.paragraph.textColor):void 0,u=$e(t,{...e,defaultTextColor:c||e.defaultTextColor},At(s.fontSize),{bold:s.bold,italic:s.italic,underline:s.underline});return new L({children:u.length>0?u:[new R({text:"",font:i})],alignment:re(oe(t))??Vt(s.textAlign),spacing:{before:n.before,after:n.after,line:jt(s.fontSize,"paragraph",e),lineRule:Bt},indent:{left:a,right:l}})}const kn="\uE000";function Si(t){const e=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").querySelector("div");if(!e)return[""];e.querySelectorAll("br").forEach(r=>r.replaceWith(kn));const n=(e.textContent??"").replace(/[ \t\n\r\f]+/g," ").split(kn).map(r=>r.replace(/^ +| +$/g,"").replace(/\u00a0/g," "));return n.length>1&&n[n.length-1]===""&&n.pop(),n}function ae(t,e,n,r){var o,i;const a=wt(n.documentFont),l=(o=n.componentColors)==null?void 0:o.heading,s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=kt(n,`h${e}`),d=(i=t.match(/\bid="(dest-[^"]+)"/i))==null?void 0:i[1],f=Si(t);let g;if(l){const h=l[`h${e}`];h&&(g=k(h))}const x=k(l==null?void 0:l[`h${e}Bg`]),P={1:Rt.HEADING_1,2:Rt.HEADING_2,3:Rt.HEADING_3,4:Rt.HEADING_4},p=f.map((h,m)=>new R({break:m>0?1:void 0,text:h,font:a,size:At(u.fontSize),bold:u.bold,italics:u.italic,color:g,underline:u.underline?{}:void 0,shading:x?{type:ve.CLEAR,color:"auto",fill:x}:void 0})),b=d?[new Qe({id:d,children:p})]:p;return new L({children:b,heading:P[e],keepNext:!0,alignment:re(oe(t))??Vt(u.textAlign),spacing:{before:r.before,after:r.after,line:jt(u.fontSize,`h${e}`,n),lineRule:Bt},indent:{left:s,right:c}})}function On(t){switch(t){case"a":return"lower-letter-numbering";case"i":return"lower-roman-numbering";default:return"default-numbering"}}function Ln(t){var e,n;const r=(e=t.match(/<ol\b[^>]*>/i))==null?void 0:e[0];return((n=r==null?void 0:r.match(/\stype=["']?([^"'\s>]+)/i))==null?void 0:n[1])??null}let Ci=0;const Rn=()=>Ci+=1;function Hn(t,e,n,r){var o;const i=wt(n.documentFont),a=(o=n.componentColors)==null?void 0:o.list,l=kt(n,"listText"),s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=a!=null&&a.textColor?k(a.textColor):void 0,d=e?{reference:On(Ln(t)),level:0,instance:Rn()}:void 0,f=[],g=/<li[^>]*>(.*?)<\/li>/gi;let x;for(;(x=g.exec(t))!==null;)f.push(x[1]);return f.map((P,p)=>{const b=p===0,h=p===f.length-1,m=$e(P,{...n,defaultTextColor:u||n.defaultTextColor},At(l.fontSize),{bold:l.bold,italic:l.italic,underline:l.underline});return new L({children:m.length>0?m:[new R({text:"",font:i})],bullet:e?void 0:{level:0},numbering:d,alignment:Vt(l.textAlign),spacing:{before:b?r.before:0,after:h?r.after:90,line:jt(l.fontSize,"listText",n),lineRule:Bt},indent:{left:s+360,hanging:360,right:c}})})}function Ni(t){const e=t.match(/<(p|h[1-4])(?:\s[^>]*)?>[\s\S]*?<\/\1>/gi);if(!e||e.length<2)return[t];const n=r=>{var o;return((o=new DOMParser().parseFromString(r,"text/html").body.textContent)==null?void 0:o.trim())??""};return e.map(n).join("").replace(/\s+/g,"")!==n(t).replace(/\s+/g,"")?[t]:e}const Ie="data-cell-list",Dn=/<(ul|ol)\b[^>]*>((?:(?!<(?:ul|ol)\b)[\s\S])*?)<\/\1>/i;function Fi(t){let e=t;for(let n=e.match(Dn);n;n=e.match(Dn)){const r=n[0],o=(n[1]??"").toLowerCase(),i=n[2]??"",a=o==="ol"?Ln(r):null,l=o==="ol"?` ${Ie}-instance="${Rn()}"`+(a?` ${Ie}-type="${a}"`:""):"",s=i.replace(/<li\b[^>]*>\s*<p\b/gi,`<p ${Ie}="${o}"${l}`),c=n.index??0;e=e.slice(0,c)+s+e.slice(c+r.length)}return e}const Mi=t=>{var e,n,r,o;const i=(n=(e=t==null?void 0:t.match(/data-cell-list="(ul|ol)"/i))==null?void 0:e[1])==null?void 0:n.toLowerCase();if(i==="ul")return{kind:"ul"};if(i==="ol")return{kind:"ol",instance:Number(((r=t==null?void 0:t.match(/data-cell-list-instance="(\d+)"/i))==null?void 0:r[1])??0),type:((o=t==null?void 0:t.match(/data-cell-list-type="([^"]+)"/i))==null?void 0:o[1])??null}},$i=t=>{if(!t)return{};const e={left:360,hanging:360};return t.kind==="ul"?{bullet:{level:0},indent:e}:{numbering:{reference:On(t.type),level:0,instance:t.instance},indent:e}},zn=15,jn=t=>{var e;const n=wo((e=t.componentColors)==null?void 0:e.table),r=Math.round(n.y*zn),o=Math.round(n.x*zn);return{top:r,bottom:r,left:o,right:o}},Ii=t=>{const e=jn(t);return e.top+e.bottom},Bn=300,ki=100,Oi=15840,Li=12240;function Ri(t,e){var n;const r=parseInt(((n=t.match(/data-row-twips="(\d+)"/i))==null?void 0:n[1])??"",10);if(!Number.isFinite(r)||r<=0)return Bn;const o=e.isLandscape?Li:Oi,i=e.contentHeightPx&&e.contentHeightPx>0?Math.round(e.contentHeightPx*15):o;return r>i?Bn:Math.max(ki,r-Ii(e))}function Wn(t,e){var n,r;const o=(n=e.componentColors)==null?void 0:n.table,i=kt(e,"tableHeader").verticalAlign,a=jn(e),l=wt(e.documentFont),s=(e.leftMarginPx??40)*15,c=ne(e),u=t.match(/data-col-twips="([\d,]+)"/i),d=u!=null&&u[1]?u[1].split(",").map(M=>parseInt(M,10)).filter(M=>M>0):void 0,f=!!d&&d.length>0,g=[],x=[],P=[],p=/<(thead|tbody|tfoot)[^>]*>(?:[\s\S]*?)<\/\1>/gi;let b;for(;(b=p.exec(t))!==null;)P.push({tag:(b[1]??"").toLowerCase(),start:b.index,end:b.index+b[0].length});const h=new Map,m=/<tr([^>]*)>([\s\S]*?)<\/tr>/gi;let S;for(;(S=m.exec(t))!==null;){const M=S[1]??"",E=S[2]??"",T=S.index,A=P.findIndex(z=>T>=z.start&&T<z.end),y=(h.get(A)??0)+1;h.set(A,y);const C=(((r=P[A])==null?void 0:r.tag)??"tbody")==="tbody"&&y%2===0,D=[],V=/<th[\s>]/i.test(E),st=/<td[\s>]/i.test(E),tt=V&&!st;let ut=0;const gt=/<(th|td)([^>]*)>([\s\S]*?)<\/\1>/gi;let vt;for(;(vt=gt.exec(E))!==null;){const z=vt[2]||"",v=vt[3]||"",N=(vt[1]||"").toLowerCase()==="th",O=N&&tt,$=N&&!tt,j=O?"tableHeader":$?"tableHeaderColumn":"tableCell",U=kt(e,j),et=$?U.verticalAlign??i:U.verticalAlign,K=(o==null?void 0:o.headerColumnText)||(o==null?void 0:o.headerText),pt=O?o!=null&&o.headerText?k(o.headerText):void 0:$?K?k(K):void 0:o!=null&&o.cellText?k(o.cellText):void 0,Ct=re(z),J=Ni(Fi(v)),it=J.map(B=>re(oe(B))),nt=J.map(B=>Mi(oe(B))),dt=J.map(B=>$e(B,{...e,defaultTextColor:pt},At(U.fontSize),{bold:U.bold,italic:U.italic,underline:U.underline})),at=z.match(/colspan="(\d+)"/i),Ot=at!=null&&at[1]?parseInt(at[1],10):void 0,Gt=z.match(/rowspan="(\d+)"/i),Xt=Gt!=null&&Gt[1]?parseInt(Gt[1],10):void 0,Pt=Ot&&Ot>1?Ot:1,Nt=Xt&&Xt>1?Xt:1;for(;(x[ut]??0)>0;)ut+=1;const ft=ut;if(Nt>1)for(let B=ft;B<ft+Pt;B+=1)x[B]=Nt;ut=ft+Pt;const Ft=z.match(/data-colwidth="(\d+)"/i),Yt=z.match(new RegExp("(?<!min-)width:\\s*(\\d+)px","i")),Qt=Ft!=null&&Ft[1]?parseInt(Ft[1],10):Yt!=null&&Yt[1]?parseInt(Yt[1],10):void 0,xe=Qt?Math.round(Qt*15):void 0,Mt=(d&&ft+Pt<=d.length?d.slice(ft,ft+Pt).reduce((B,lt)=>B+lt,0):void 0)??xe,be=dt.map((B,lt)=>new L({children:B.length>0?B:[new R({text:"",font:l})],...$i(nt[lt]),alignment:it[lt]??Ct??Vt(U.textAlign),spacing:{before:0,after:0,...e.previewContext==="export-preview"?{line:jt(U.fontSize,j,e),lineRule:Bt}:{line:240,lineRule:_.AUTO}}}));D.push(new Je({children:be,columnSpan:Pt>1?Pt:void 0,rowSpan:Nt>1?Nt:void 0,width:Mt?{size:Mt,type:Lt.DXA}:void 0,shading:(()=>{const B=z.match(/background-color:\s*([^;"]+)/i),lt=B!=null&&B[1]?k(B[1].trim()):void 0;if(lt)return{fill:lt};if(O&&o!=null&&o.headerBg)return{fill:k(o.headerBg)||"FFFFFF"};if($){const Et=(o==null?void 0:o.headerColumnBg)||(o==null?void 0:o.headerBg);if(Et)return{fill:k(Et)||"FFFFFF"}}return!N&&C&&o!=null&&o.alternateRowBg?{fill:k(o.alternateRowBg)||"FFFFFF"}:{fill:o!=null&&o.cellBg&&k(o.cellBg)||"FFFFFF"}})(),borders:o!=null&&o.border?{top:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0,margins:{...a},verticalAlign:wi(z,et)}))}for(let z=0;z<x.length;z+=1)x[z]=Math.max(0,(x[z]??0)-1);D.length>0&&g.push(new we({children:D,cantSplit:!0,tableHeader:tt,height:{value:Ri(M,e),rule:mo.ATLEAST}}))}return new $t({rows:g,layout:f?ye.FIXED:ye.AUTOFIT,...f?{columnWidths:d}:{},width:{size:f?d.reduce((M,E)=>M+E,0):c,type:Lt.DXA},indent:{size:s,type:Lt.DXA},borders:o!=null&&o.border?{top:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},insideHorizontal:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"},insideVertical:{style:rt.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0})}function _n(t){let e=t;for(;/<[^>]+>/.test(e);)e=e.replace(/<[^>]+>/g,"");return e}function Hi(t,e){var n;const r=wt(e.documentFont),o=(e.leftMarginPx??40)*15,i=(e.rightMarginPx??40)*15,a=(n=t.match(/\bdata-dest="(dest-[^"]+)"/i))==null?void 0:n[1];let l="dotted";/border-bottom:.*solid/i.test(t)?l="line":/border-bottom:.*dotted/i.test(t)?l="dotted":/font-weight:\s*500/i.test(t)||/margin-bottom:\s*8px/i.test(t)?l="modern":/font-size:\s*0\.9em/i.test(t)||/font-size:\s*0\.85em/i.test(t)?l="compact":/\[\d+\]|\[\.\.\.\]/.test(t)&&(l="simple");const s=t.match(/margin-left:\s*(\d+)px/),c=s?parseInt(s[1],10):0,u=/<span([^>]*)>(.*?)<\/span>/gi,d=[];let f;for(;(f=u.exec(t))!==null;)d.push({attrs:f[1]||"",content:f[2]||""});if(d.length<1)return null;const g=_n(d[0].content.replace(/&nbsp;/g," ").replace(/&amp;/g,"&")).trim();let x="";for(let z=d.length-1;z>=1;z--){const v=_n(d[z].content).trim();if(/\d+/.test(v)||v==="..."){x=v.replace(/^\[|\]$/g,"");break}}const P=o+Math.round(c/24)*300,p=12240-i,b=l==="line"||l==="modern",h=l==="compact"?"888888":void 0,m=kt(e,"paragraph").fontSize,S=l==="compact"?m*.9:m,M=l==="compact"?m*.85:l==="modern"?m*.95:m,E=At(S),T=At(M),A=l==="simple"?"[":"",y=l==="simple"?"]":"",C=`${A}${x}${y}`,D=l==="dotted"?Pe.DOT:l==="line"?Pe.UNDERSCORE:Pe.NONE,V=l==="modern"?60:l==="compact"?30:60,st=l==="modern"?180:l==="compact"?30:120,tt={font:r,size:T,bold:b||void 0,color:h},ut=e.tocPagerefFields&&a&&/^\d+$/.test(x)?[...A?[new R({...tt,text:A})]:[],...ai(a,x,tt),...y?[new R({...tt,text:y})]:[]]:[new R({...tt,text:C})],gt=[new R({text:g,font:r,size:E,bold:void 0}),new R({children:[new fo],font:r,size:T}),...ut],vt=a?[new ho({anchor:a,children:gt})]:gt;return new L({children:vt,tabStops:[{type:go.RIGHT,position:p,leader:D}],spacing:{before:V,after:st,line:jt(Math.max(S,M),"paragraph",e),lineRule:Bt},indent:{left:P,right:i}})}function Di(t,e){const n=(t.leftMarginPx??40)*15,r=(t.rightMarginPx??40)*15;return new L({children:[new R({text:""})],border:{bottom:{style:rt.SINGLE,size:6,space:1,color:"E0E0E0"}},spacing:{before:e.before,after:e.after,line:240,lineRule:_.AUTO},indent:{left:n,right:r}})}const zi=320,ji=3;function Jt(t){if(!t||!/^\d+(\.\d+)?$/.test(t.trim()))return;const e=Number(t);return e>0?e:void 0}function ke(t,e,n){const r=wt(e.documentFont),o=(e.leftMarginPx??40)*15,i=(e.rightMarginPx??40)*15,a={style:rt.SINGLE,size:6,space:4,color:"E0E0E0"};return new L({children:[new R({text:t,font:r,size:Cn,italics:!0})],border:{top:a,bottom:a,left:a,right:a},alignment:Y.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO},indent:{left:o,right:i}})}function Oe(t,e,n){return ke(`Chart: ${t} (see PDF export)`,e,n)}function Le(t,e,n){const r=t!=null&&t.trim()?`Image: ${t.trim()} (could not be embedded)`:"Image (could not be embedded)";return ke(r,e,n)}async function Bi(t,e,n){var r;const o=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.querySelector("[data-chart-type]");if(!o)return[];const i=o.getAttribute("data-chart-type")||"chart",a=o.querySelector("svg");if(a){const s=Sn(e),c=Jt(a.getAttribute("width")),u=Jt(a.getAttribute("height")),d=Jt((r=(o.getAttribute("style")||"").match(/height:\s*([\d.]+)px/i))==null?void 0:r[1]),f=c??s,g=u??d??zi;try{const x=await Wo(a,{width:f,height:g,scale:ji}),P=Se(x);if(P.length>0)return[new L({children:[new It({type:"png",data:P,transformation:{width:f,height:g}})],alignment:Y.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO}})]}catch(x){console.error(`Failed to rasterize chart "${i}" for DOCX:`,x)}return[Oe(i,e,n)]}const l=o.querySelector("table");return l?[Wn(l.outerHTML,e)]:[Oe(i,e,n)]}function Wi(t,e,n,r,o){let i=t,a=e;const l=!!n&&!!r;return!i&&!a&&l?(i=n,a=r):i&&!a?a=l?i*(r/n):i*(2/3):!i&&a&&(i=l?a*(n/r):a*(3/2)),i||(i=o),a||(a=Math.round(i*(2/3))),i>o&&(a=Math.round(a*(o/i)),i=o),{width:Math.round(i),height:Math.round(a)}}function _i(t){return t==="center"?Y.CENTER:t==="right"?Y.RIGHT:Y.LEFT}async function qi(t,e,n){const r=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html").body.querySelector("img"),o=(r==null?void 0:r.getAttribute("src"))||"",i=(r==null?void 0:r.getAttribute("alt"))||void 0,a=Jt(r==null?void 0:r.getAttribute("width")),l=Jt(r==null?void 0:r.getAttribute("height")),s=_i(r==null?void 0:r.getAttribute("data-align"));if(!o)return Le(i,e,n);const c=Sn(e);try{const u=await po(o,void 0,"original")||o,d=u.startsWith("data:")?await fn(Se(u),u):await qo(u);if(d.bytes.length===0)return Le(i,e,n);const{width:f,height:g}=Wi(a,l,d.intrinsicWidth,d.intrinsicHeight,c);return new L({children:[new It({type:d.type,data:d.bytes,transformation:{width:f,height:g}})],alignment:s,spacing:{before:n.before,after:n.after,line:240,lineRule:_.AUTO}})}catch(u){return console.error("Failed to embed inline image for DOCX:",u),Le(i,e,n)}}const Ui=/^\s*<([a-z][a-z0-9]*)/i,qn=t=>{var e,n;return((n=(e=t.match(Ui))==null?void 0:e[1])==null?void 0:n.toLowerCase())??""};function Gi(t){switch(qn(t)){case"chartslot":return"chart";case"layoutslot":return"layout";case"h1":return/class="[^"]*section-title-from-h2/i.test(t)?"h2":"h1";case"h2":return"h2";case"h3":return"h3";case"h4":return"h4";case"ul":case"ol":return"list";case"table":return"table";case"hr":return"hr";case"img":return"img";default:return"p"}}const Re=t=>t!=="table";function Xi(t,e){const n=Fn(e.previewContext),r=t.map(s=>n[s]),o=e.containerWidthTwips===void 0,i=t.map((s,c)=>c===0&&!o?r[c].before:0),a=t.map((s,c)=>Re(s)?r[c].after:0),l=t.map(()=>0);for(let s=1;s<t.length;s++){const c=Math.max(r[s-1].after,r[s].before);l[s]=c,Re(t[s])?i[s]=Math.max(0,c-a[s-1]):Re(t[s-1])&&(a[s-1]=c)}return{spacing:t.map((s,c)=>({before:i[c],after:a[c]})),collapsedGap:l}}const Yi=2,Vi=20;function Ji(t){return new L({children:[new R({text:"",size:Yi})],spacing:{before:0,after:t,line:Vi,lineRule:_.EXACT}})}async function Un(t,e={},n=!1){var r,o;const i=[],a=/<div[^>]*data-toc-page="[^"]*"[^>]*>.*?<\/div>/gi,l=t.match(a)||[];if(l.length>0){const b=t.match(/<h1[^>]*>(.*?)<\/h1>/i);if(b){const h=wt(e.documentFont),m=(r=e.componentColors)==null?void 0:r.heading,S=(e.leftMarginPx??40)*15,M=(e.rightMarginPx??40)*15,E=kt(e,"h1");let T;if(m){const A=m.h1;A&&(T=k(A))}i.push(new L({children:[new R({text:((o=b[1])==null?void 0:o.replace(/<[^>]+>/g,"").trim())||"Table of Contents",font:h,size:At(E.fontSize),bold:E.bold,italics:E.italic,color:T,underline:E.underline?{}:void 0})],heading:Rt.HEADING_1,alignment:Vt(E.textAlign),spacing:{before:0,after:Fn(e.previewContext).h1.after,line:jt(E.fontSize,"h1",e),lineRule:Bt},indent:{left:S,right:M}}))}for(const h of l)try{const m=Hi(h,e);m&&i.push(m)}catch(m){console.error("Failed to parse TOC item:",m)}return i}t=t.replace(/<div[^>]*data-page-break="true"[^>]*>.*?<\/div>/gis,""),t=t.replace(/<div[^>]*class="page-break-marker"[^>]*>.*?<\/div>/gis,"");const{html:s,containers:c}=Jo(t);t=s;const u=[];if(/data-chart-type=/i.test(t)){const b=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html");b.body.querySelectorAll("[data-chart-type]").forEach(h=>{const m=u.push(h.outerHTML)-1,S=b.createElement("chartslot");S.setAttribute("data-chart-idx",String(m)),h.replaceWith(S)}),t=b.body.innerHTML}t=t.replace(/<div[^>]*class="page-content[^"]*"[^>]*>/gi,""),t=t.replace(/<\/div>/gi,""),t=t.replace(/<p[^>]*>\s*(<img[^>]*>)\s*<\/p>/gi,"$1");const d=/(<h[1-4][^>]*>[\s\S]*?<\/h[1-4]>|<p[^>]*>[\s\S]*?<\/p>|<ul[^>]*>[\s\S]*?<\/ul>|<ol[^>]*>[\s\S]*?<\/ol>|<table[^>]*>[\s\S]*?<\/table>|<hr[^>]*>|<img[^>]*>|<chartslot[^>]*><\/chartslot>|<layoutslot[^>]*><\/layoutslot>)/gi,f=t.match(d)||[],g=f.map(Gi),{spacing:x,collapsedGap:P}=Xi(g,e);let p=0;for(let b=0;b<f.length;b++){const h=f[b],m=x[b],S=i.length,M=b===0?0:Math.max(0,P[b]-p),E=b===0||g[b]==="table"?m:{before:M,after:m.after};try{switch(qn(h)){case"chartslot":{const y=h.match(/data-chart-idx="(\d+)"/i),C=y?u[Number(y[1])]:void 0;C?i.push(...await Bi(C,e,E)):i.push(Oe("chart",e,E));break}case"layoutslot":{const y=h.match(/data-layout-idx="(\d+)"/i),C=y?c[Number(y[1])]:void 0;C?i.push(...await oi(C,e,Un)):i.push(ke("Layout section (see PDF export)",e,E));break}case"h1":{const y=/class="[^"]*section-title-from-h2/i.test(h)?2:1;i.push(ae(h,y,e,E));break}case"h2":i.push(ae(h,2,e,E));break;case"h3":i.push(ae(h,3,e,E));break;case"h4":i.push(ae(h,4,e,E));break;case"ul":i.push(...Hn(h,!1,e,E));break;case"ol":i.push(...Hn(h,!0,e,E));break;case"table":i.push(Wn(h,e));break;case"hr":i.push(Di(e,E));break;case"img":i.push(await qi(h,e,E));break;default:i.push(Ai(h,e,E))}}catch(y){console.error("Failed to parse block:",h,y)}const T=i[S]instanceof $t,A=T&&i[S-1]instanceof $t;if(S>0&&T&&(A||M>0)&&i.splice(S,0,Ji(M)),i.length>S){const y=i[i.length-1]instanceof $t,C=g[b]!=="layout";p=y||!C?0:m.after}}return i.length===0&&i.push(new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}})),i}const Ki=["MM/DD/YYYY","DD/MM/YYYY","DD MMM YYYY","MMM DD, YYYY","YYYY-MM-DD"];function Zi(t){return typeof t=="string"&&Ki.includes(t)}const He=987654321,le=987654322,De=/\{%[^%\n]*%\}/g;function Gn(t){const e=t.slice(2,-2).toLowerCase();return e==="page_number"?"page-number":e==="total_pages"?"total-pages":"text"}function Qi(t){return JSON.stringify([t.bold??!1,t.italics??!1,t.underline??!1,t.strike??!1,t.color??"",t.fontSizePx??0,t.fontFamily??""])}function Wt(t,e,n,r=!1){const o=t==="text"?{kind:t,text:e,...n}:{kind:t,...n};return r?{...o,hiddenAtPageZero:!0}:o}function ta(t,e){return Ee(t==="page-number"?"{%page_number%}":"{%total_pages%}",{pageNumber:0,variableValues:e.variableValues,currentDateText:e.currentDateText})===""}function ea(t,e,n){const r=[];let o="",i=null,a={};const l=()=>{i!==null&&o!==""&&r.push(Wt("text",o,a)),o="",i=null};for(const s of t){const c=e(s.rawIndex);if(s.kind!=="text"){l(),r.push(Wt(s.kind,"",c,ta(s.kind,n)));continue}if(s.text==="")continue;const u=Qi(c);u!==i&&(l(),i=u,a=c),o+=s.text}return l(),r}function se(t,e,n){const r={pageNumber:0,variableValues:n.variableValues,currentDateText:n.currentDateText},o=[];let i=0;for(const a of t.matchAll(De)){const l=a.index;for(let u=i;u<l;u++)o.push({kind:"text",text:t[u],rawIndex:u});const s=a[0],c=Gn(s);o.push({kind:c,text:c==="text"?Ee(s,r):"",rawIndex:l}),i=l+s.length}for(let a=i;a<t.length;a++)o.push({kind:"text",text:t[a],rawIndex:a});return ea(o,e,n)}function Xn(t){for(const e of t.matchAll(De))if(Gn(e[0])!=="text")return!0;return!1}function Yn(t,e){const n={pageNumber:e.pageNumber,totalPages:e.totalPages,variableValues:e.variableValues,currentDateText:e.currentDateText},r=new Array(t.length+1);let o="",i=0;const a=(l,s)=>{for(let c=l;c<s;c++)r[c]=o.length,o+=t[c]};for(const l of t.matchAll(De)){const s=l.index;a(i,s);const c=l[0];for(let u=s;u<s+c.length;u++)r[u]=o.length;o+=Ee(c,n),i=s+c.length}return a(i,t.length),r[t.length]=o.length,{painted:o,paintedOffsets:r}}function Vn(t,e){const n=en(t,He,le),r=en(t,0,le)==="",o=[];for(const i of n.split(new RegExp(`(${He}|${le})`)))i!==""&&(i===String(He)?o.push(Wt("page-number","",e,r)):i===String(le)?o.push(Wt("total-pages","",e,r)):o.push(Wt("text",i,e,r)));return o}function Jn(t,e,n){const r=t==null?void 0:t.pageNumberFormat;if(!tn(r))return null;const o=yo(t,n.pageNumber,n.totalPages);return o===void 0?null:{runs:Vn(r,e),painted:o}}function na(t,e,n){const r=t,o=r==null?void 0:r.pageNumberFormat;if(tn(o))return Vn(o,e);const i=r==null?void 0:r.dateFormat;return Zi(i)?[Wt("text",vo(i,n),e)]:null}const Kn=new Set(["paragraph","heading","blockquote"]),ra=t=>(t.content??[]).some(e=>Kn.has(e.type??""));function Zn(t){const e=t;if(!e||typeof e!="object"||!Array.isArray(e.content))return null;let n="",r=!1,o=0;const i=a=>{var l;switch(a.type){case"text":n+=a.text??"";return;case"variable":{const s=(l=a.attrs)==null?void 0:l.name;if(typeof s!="string"||s==="")return;r=!0,n+=`{%${s}%}`;return}case"hardBreak":n+=`
2
2
  `;return;default:Kn.has(a.type??"")&&!ra(a)&&(o>0&&(n+=`
3
3
  `),o++);break}for(const s of a.content??[])i(s)};return i(e),r?n:null}const Kt=t=>t==="page",oa=["fontFamily","fontSize","fontWeight","fontStyle","underline","linethrough","fill"];function w(t){return typeof t=="number"&&Number.isFinite(t)}function ze(t){if(typeof t!="string")return;const e=t.trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(e);if(n){const i=n[1];return i.length===3?`#${i.split("").map(a=>a+a).join("")}`.toLowerCase():`#${i.slice(0,6)}`.toLowerCase()}const r=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(e);if(!r)return;const o=i=>{const a=Math.max(0,Math.min(255,Math.round(Number.parseFloat(i))));return Number.isFinite(a)?a.toString(16).padStart(2,"0"):"00"};return`#${o(r[1])}${o(r[2])}${o(r[3])}`}function je(t){if(typeof t=="number")return t>=600;if(typeof t!="string")return!1;if(t.toLowerCase()==="bold"||t.toLowerCase()==="bolder")return!0;const e=Number.parseInt(t,10);return Number.isFinite(e)&&e>=600}function Qn(t,e){const n={};je(t.fontWeight)&&(n.bold=!0);const r=t.fontStyle;(r==="italic"||r==="oblique")&&(n.italics=!0),t.underline===!0&&(n.underline=!0),t.linethrough===!0&&(n.strike=!0);const o=ze(t.fill);return o&&(n.color=o),w(t.fontSize)&&t.fontSize>0&&(n.fontSizePx=t.fontSize*e),typeof t.fontFamily=="string"&&t.fontFamily.trim()!==""&&(n.fontFamily=t.fontFamily.replace(/['"]/g,"").trim()),n}function tr(t){const e={};if(!t)return e;for(const n of oa)t[n]!==void 0&&(e[n]=t[n]);return e}function Be(t,e,n){return t.map(r=>r.runs.reduce((o,i)=>Math.max(o,i.fontSizePx??e),e)*n)}const ia="000",aa=.75;let ce;function la(){if(ce===void 0)try{ce=document.createElement("canvas").getContext("2d")}catch{ce=null}return ce}function er(t,e,n){const r=la();if(!r)return null;try{const o=e.fontFamily??"sans-serif";r.font=`${e.italics?"italic ":""}${e.bold?"bold ":""}${n}px "${o}"`;const i=r.measureText(t).width;return w(i)?i:null}catch{return null}}function sa(t,e,n){const r=e.fontSizePx??n,o=t.length*r*aa,i=er(t,e,r);return i===null?o:Math.max(i,o)}const nr=t=>t.lines.some(e=>e.runs.some(n=>n.kind==="page-number"||n.kind==="total-pages"));function ca(t){const e=t.totalPages;return w(e)&&e>0?String(Math.trunc(e)):ia}function ua(t,e,n){if(!e||!nr(t))return t;const r=ca(n),o=t.lines.reduce((i,a,l)=>{var s;const c=((s=t.linePitchPx)==null?void 0:s[l])??t.lineHeightPx,u=a.runs.reduce((d,f)=>d+sa(f.kind==="text"?f.text??"":r,f,c),0);return Math.max(i,u)},0);return{...t,widthPx:o,align:"left"}}function ue(t){return t==="center"?"center":t==="right"?"right":"left"}function da(t){return t&&typeof t=="object"?t:null}function fa(t){const e=typeof t.rawText=="string"&&t.rawText!==""?t.rawText:null,n=typeof t.text=="string"?t.text:null;let r=e??n,o=da(e?t.rawStyles:t.styles);if(r===null)return null;if(t.richContent!=null&&!r.includes("{%")){const a=Zn(t.richContent);a!==null&&(r=a,o=null)}const i=r.split(`
4
4
  `);if(o)for(const[a,l]of Object.entries(o)){const s=Number(a),c=i[s];if(c===void 0||!l||typeof l!="object")return{lines:i,styles:null};for(const u of Object.keys(l))if(Number(u)>=c.length)return{lines:i,styles:null}}return{lines:i,styles:o}}const ha=t=>t.map((e,n)=>({text:e,sourceLineIndex:n,sourceCharOffset:0}));function rr(t){const e=t._textLines;return!Array.isArray(e)||typeof t.text!="string"?!1:e.length!==t.text.split(`
@@ -7,5 +7,5 @@ import{hy as Qr,hz as Ve,hA as bt,hB as to,hC as eo,hD as no,hE as ro,hF as we,h
7
7
  `:" "),l.runs.forEach((c,u)=>{c.kind!=="text"||typeof c.text!="string"||(r.push({line:s,run:u,start:o.length,length:c.text.length}),o+=c.text)})}),r.length===0)return t;const i=Ao(o,e),a=t.map(l=>({...l,runs:l.runs.map(s=>({...s}))}));for(const l of r)a[l.line].runs[l.run].text=i.slice(l.start,l.start+l.length);return a}function Ma(t,e,n,r,o,i){var a;const l=(a=t.getBoundingRect)==null?void 0:a.call(t);if(!l||!w(l.left)||!w(l.top))return null;const s=hr(t,e,"scaleY"),c=tr(t),u=Qn(c,s),d=na(t,u,o),f=!d&&i&&rr(t),g=f?ga(t,n):null;if(f&&!g)return null;const x=d?null:g??ha(n.lines),P=d?[{runs:d}]:x.map(({text:m,sourceLineIndex:S,sourceCharOffset:M})=>({runs:se(m,E=>{var T,A;const y=(A=(T=n.styles)==null?void 0:T[S])==null?void 0:A[M+E];return y?Qn({...c,...tr(y)},s):u},r)}));if(P.every(m=>m.runs.length===0))return null;const p=x?x.map((m,S)=>S===0||m.sourceLineIndex!==x[S-1].sourceLineIndex):[!0],b=w(t.fontSize)&&t.fontSize>0?t.fontSize:0,h=w(t.lineHeight)&&t.lineHeight>0?t.lineHeight:1;return{leftPx:l.left,topPx:l.top,widthPx:l.width,heightPx:l.height,align:ue(t.textAlign),lineHeightPx:b*h*s,linePitchPx:Be(P,b*s,h),lines:Fa(P,t.textTransform,p)}}function $a(t){return String(t.type??"").toLowerCase()!=="textbox"}function Ia(t,e,n){if(sr(t.textAlign))return null;const r=t._textLines;if(!Array.isArray(r)||r.length===0||typeof t.getLineWidth!="function")return null;const o=[];for(let i=0;i<r.length;i+=1){const a=t.getLineWidth(i);if(!w(a))return null;o.push(a*n)}return cr(e,o)}function gr(t,e,n,r,o,i,a,l){for(const s of t){if(!s||typeof s!="object")continue;const c=s,u=fa(c),d=r==="band"&&We((u==null?void 0:u.lines)??null,c,n);if(u&&pa(c,e,u.lines,d,Kt(r))){if(dr(c,l))continue;const g=Ma(c,e,u,n,o,Kt(r));g&&qe(i,g,()=>Na(c),r,$a(c),n,a,x=>Ia(c,x,hr(c,e,"scaleX")));continue}const f=fr(c);f.length>0&&gr(f,[...e,c],n,r,o,i,a,l)}}const ka=t=>[...Array.isArray(t.children)?t.children:[],...Array.isArray(t.objects)?t.objects:[]];function Oa(t,e){const n=t==null?void 0:t.objects;if(!Array.isArray(n))return null;const r=[...n];for(;r.length>0;){const o=r.shift();if(!(!o||typeof o!="object")){if(o.id===e)return o;r.push(...ka(o))}}return null}function La(t,e){const n=Oa(t,e.id);if(!n)return null;if(Po(n))return n;if(e.textIndex<0)return null;const r=[];return Eo([n],o=>r.push(o)),r[e.textIndex]??null}function pr(t,e){return!e||t.sourceCanvasJson==null?null:La(t.sourceCanvasJson,e)}function Ue(t){if(!t)return null;const e=typeof t.text=="string"?t.text:null,n=Zn(t.richContent)??e;return n===null?null:n.split(`
8
8
  `)}const de=t=>t.replace(/\s+/g," ").trim();function Ra(t){const{kind:e,text:n,hiddenAtPageZero:r,...o}=t;return o}function mr(t){var e;const n=[];for(const r of t.runs){const o=Ra(r);for(let i=0;i<(((e=r.text)==null?void 0:e.length)??0);i++)n.push(o)}return n}function xr(t,e,n,r){const o=or(n);if(!e||!o)return t;const i=t.lines.map(u=>u.runs.map(d=>d.text??"").join("")),a=u=>mr(t.lines[u]??{runs:[]})[0]??r,l=Jn(e,a(0),o);if(l)return t.lines.length!==1||de(l.painted)!==de(i[0])?t:{...t,lines:[{runs:l.runs}]};const s=Ue(e);if(s===null||!s.some(Xn)||s.length!==t.lines.length)return t;const c=s.map(u=>Yn(u,o));for(const[u,d]of i.entries())if(de(c[u].painted)!==de(d))return t;return{...t,lines:s.map((u,d)=>{const f=mr(t.lines[d]),g=c[d].paintedOffsets,x=a(d);return{runs:se(u,P=>f[g[P]??0]??x,n)}})}}function Ha(){var t;const e=(t=globalThis.Konva)==null?void 0:t.stages;return Array.isArray(e)?e:[]}function Da(t){return Ha().find(e=>{var n,r;return(r=(n=e.container)==null?void 0:n.call(e))==null?void 0:r.contains(t)})??null}function br(t,e){const n={},r=typeof t.fontStyle()=="string"?t.fontStyle():"";/italic|oblique/i.test(r)&&(n.italics=!0),je(r.replace(/italic|oblique|normal/gi,"").trim())&&(n.bold=!0);const o=typeof t.textDecoration()=="string"?t.textDecoration():"";o.includes("underline")&&(n.underline=!0),o.includes("line-through")&&(n.strike=!0);const i=ze(t.fill());i&&(n.color=i);const a=t.fontSize();w(a)&&a>0&&(n.fontSizePx=a*e);const l=Pr(t.fontFamily());return l&&(n.fontFamily=l),n}function za(t){for(let r=t.getParent();r;r=r.getParent()){const o=r.id();if(!(typeof o!="string"||o==="")){if(r.find("Text").length===1)return o;break}}const e=t.id();if(typeof e=="string"&&e!=="")return e;_t+=1;const n=`band-text-lift-${_t}`;return t.id(n),n}function ja(t,e,n){if(!t.isVisible()||t.getAbsoluteOpacity()!==1||t.hasShadow()||t.getAbsoluteRotation()!==0)return!1;const r=t.text();if(typeof r!="string")return!1;if(r.trim()==="")return e;const o=t.textArr;return!Array.isArray(o)||o.length===r.split(`
9
9
  `).length?!0:n&&!r.includes("{%")}function Ba(t,e){const n=t.text().split(`
10
- `);if(!e)return n;const r=t.textArr;return!Array.isArray(r)||r.length===n.length?n:r.map(o=>typeof(o==null?void 0:o.text)=="string"?o.text:"")}function wr(t,e){var n;const r=(n=t.attrs)==null?void 0:n[e];return r==null||r==="auto"}function yr(t){const e=t.getAbsoluteScale();return w(e==null?void 0:e.y)&&e.y>0?e.y:1}function Wa(t,e,n,r,o){const i=t.getClientRect({relativeTo:e,skipShadow:!0,skipStroke:!0});if(!i||!w(i.x)||!w(i.y))return null;const a=t.getAbsoluteScale(),l=w(a==null?void 0:a.x)&&a.x>0?a.x:1,s=yr(t),c=br(t,s),u=Ba(t,o),d=u.map(m=>({runs:se(m,()=>c,n)}));if(!r&&d.every(m=>m.runs.length===0))return null;const f=w(t.fontSize())?t.fontSize():0,g=f*(w(t.lineHeight())?t.lineHeight():1),x=u.length*g,P=w(t.padding())?t.padding():0,p=t.verticalAlign(),b=t.getHeight()-x-P*2,h=wr(t,"height")?0:p==="middle"?b/2:p==="bottom"?b:0;return{leftPx:i.x+P*l,topPx:i.y+(P+h)*s,widthPx:i.width-P*2*l,heightPx:x*s,align:ue(t.align()),lineHeightPx:g*s,linePitchPx:Be(d,f*s,w(t.lineHeight())?t.lineHeight():1),lines:d}}function _a(t,e){if(sr(t.align()))return null;const n=t.textArr;if(!Array.isArray(n)||n.length===0)return null;const r=t.getAbsoluteScale(),o=w(r==null?void 0:r.x)&&r.x>0?r.x:1,i=[];for(const a of n){if(!w(a==null?void 0:a.width))return null;i.push(a.width*o)}return cr(e,i)}function qa(t){for(let n=t.getParent();n;n=n.getParent()){const r=n.id();if(!(typeof r!="string"||r===""))return{id:r,textIndex:n.find("Text").indexOf(t)}}const e=t.id();return typeof e=="string"&&e!==""?{id:e,textIndex:0}:null}function Ua(t){return!t.isVisible()||t.getClassName()==="Text"?!1:t.getAbsoluteOpacity()>0}function Ga(t,e){const n=t.getClientRect({relativeTo:e});return!n||!w(n.x)||!w(n.y)||!w(n.width)||!w(n.height)?null:{leftPx:n.x,topPx:n.y,widthPx:n.width,heightPx:n.height}}function Xa(t){const e=[],n=new Map,r=o=>{var i;const a=(i=o.getChildren)==null?void 0:i.call(o);if(a){for(const l of a)r(l);return}n.set(o,e.length),e.push({occludes:Ua(o),rect:Ga(o,t)})};return r(t),{steps:e,indexOf:n}}function vr(t,e,n,r,o,i,a){var l;if(t.getClassName()==="Text"){const c=t,u=r==="band"?pr(n,qa(c)):null,d=r==="band"&&We(Ue(u),u,n);if(!ja(c,d,Kt(r))||dr(c,a))return;const f=Wa(c,e,n,d,Kt(r));if(!f)return;const g=xr(f,u,n,br(c,yr(c)));if(g.lines.every(x=>x.runs.length===0))return;qe(o,g,()=>za(c),r,wr(c,"width"),n,i,x=>_a(c,x));return}const s=(l=t.getChildren)==null?void 0:l.call(t);if(s)for(const c of s)vr(c,e,n,r,o,i,a)}function fe(t){const e=/^(-?\d*\.?\d+)px$/.exec((t??"").trim());if(!e)return;const n=Number.parseFloat(e[1]);return Number.isFinite(n)?n:void 0}function Pr(t){var e;if(typeof t!="string")return;const n=(e=t.split(",")[0])==null?void 0:e.replace(/['"]/g,"").trim();return n!==void 0&&n!==""?n:void 0}const Ya="ul, ol, mark, img, table",Zt=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","LI"]),Ge=t=>Array.from(t.children).some(e=>Zt.has(e.tagName));function he(t,e){const n={...e};switch(t.tagName){case"STRONG":case"B":n.bold=!0;break;case"EM":case"I":n.italics=!0;break;case"U":n.underline=!0;break;case"S":case"STRIKE":case"DEL":n.strike=!0;break}const r=t.style;r.fontWeight!==""&&(je(r.fontWeight)?n.bold=!0:delete n.bold),(r.fontStyle==="italic"||r.fontStyle==="oblique")&&(n.italics=!0);const o=`${r.textDecoration} ${r.textDecorationLine}`;o.includes("underline")&&(n.underline=!0),o.includes("line-through")&&(n.strike=!0);const i=ze(r.color);i&&(n.color=i);const a=Pr(r.fontFamily);a&&(n.fontFamily=a);const l=fe(r.fontSize);return l!==void 0&&l>0&&(n.fontSizePx=l),n}function Er(t){const e=(r,o)=>{if(r.nodeType===Node.TEXT_NODE)return o;if(r.nodeType!==Node.ELEMENT_NODE)return null;const i=r;if(i.tagName==="BR")return null;const a=he(i,o);for(const l of Array.from(i.childNodes)){const s=e(l,a);if(s)return s}return i.childNodes.length===0?a:null},n=he(t,{});for(const r of Array.from(t.childNodes)){const o=e(r,n);if(o)return o}return n}function Va(t,e){const n=[""],r=[[]];let o=0;const i=()=>{n.push(""),r.push([])},a=(s,c)=>{const u=n.length-1;n[u]+=s;for(let d=0;d<s.length;d++)r[u].push(c)},l=(s,c)=>{if(s.nodeType===Node.TEXT_NODE){a(s.textContent??"",c);return}if(s.nodeType!==Node.ELEMENT_NODE)return;const u=s;if(u.tagName==="BR"){const f=u.parentElement;(!f||!Zt.has(f.tagName)||f.childNodes.length!==1)&&i();return}Zt.has(u.tagName)&&!Ge(u)&&(o>0&&i(),o+=1);const d=he(u,c);for(const f of Array.from(u.childNodes))l(f,d)};for(const s of Array.from(t.childNodes))l(s,e);return{lines:n,charStyles:r}}const Ja=(t,e)=>t.bold===e.bold&&t.italics===e.italics&&t.underline===e.underline&&t.strike===e.strike&&t.color===e.color&&t.fontSizePx===e.fontSizePx&&t.fontFamily===e.fontFamily;function Ka(t){let e=null;for(const n of t.charStyles)for(const r of n)if(e===null)e=r;else if(!Ja(e,r))return null;return e}const Za=1,Qa=t=>t.replace(/\s+/g," ");function tl(t){const e=[];let n=0;for(let r=1;r<t.length;r++)/\s/.test(t[r-1])&&!/\s/.test(t[r])&&(e.push(t.slice(n,r)),n=r);return e.push(t.slice(n)),e}function el(t,e,n,r){const o=s=>er(Qa(s),e,n),i=o(t);if(i===null||i<=r)return[t];const a=[];let l="";for(const s of tl(t)){const c=l+s,u=o(c.trimEnd());if(u===null)return[t];l.trim()!==""&&u>r?(a.push(l.trimEnd()),l=s):l=c}return a.push(l),a}function nl(t,e,n){if(Tr(e)||t.lines.some(l=>l.includes("{%")))return t;const r=Ka(t),o=r==null?void 0:r.fontSizePx;if(!r||!w(o)||o<=0)return t;const i=[],a=[];for(const l of t.lines)for(const s of el(l,r,o,n+Za))i.push(s),a.push(new Array(s.length).fill(r));return{lines:i,charStyles:a}}function rl(t){for(const e of Array.from(t.querySelectorAll("*")))if(Zt.has(e.tagName)&&!Ge(e)){if(e.style.textAlign!=="")return ue(e.style.textAlign);break}return ue(t.style.textAlign)}function ol(t,e,n,r){if(t.querySelector(Ya))return null;const o=t.style.opacity;if(o!==""&&Number.parseFloat(o)!==1)return null;const i=/rotate\(\s*(-?\d*\.?\d+)deg/.exec(t.style.transform??"");if(i&&Number.parseFloat(i[1])!==0)return null;const a=Number.parseFloat(t.dataset.expectedLeft??""),l=Number.parseFloat(t.dataset.expectedTop??""),s=fe(t.style.width)??fe(t.style.minWidth);if(!w(a)||!w(l)||s===void 0||s<=0)return null;const c=he(t,{}),u=c.fontSizePx??0,d=Number.parseFloat(t.style.lineHeight);if(u<=0||!w(d)||d<=0)return null;const f=Va(t,c),g=r?nl(f,t,s):f,x=g.lines.map((h,m)=>({runs:se(h,S=>{var M;return((M=g.charStyles[m])==null?void 0:M[S])??c},e)}));if(!n&&x.every(h=>h.runs.length===0))return null;const P=x.every(h=>h.runs.length===0)?Er(t).fontSizePx??u:u,p=Be(x,Math.max(u,P),d),b=p.reduce((h,m)=>h+m,0);return t.offsetHeight>b+2?null:{leftPx:a,topPx:l,widthPx:s,heightPx:b,align:rl(t),lineHeightPx:u*d,linePitchPx:p,lines:x}}function il(t,e){const n=t.getBoundingClientRect();if(!w(n==null?void 0:n.left)||!w(n.top))return null;const r=n.width>0&&t.offsetWidth>0?n.width/t.offsetWidth:1;if(!w(r)||r<=0)return null;const o=Array.from(t.querySelectorAll("*")).filter(c=>Zt.has(c.tagName)&&!Ge(c));let i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const c of o.length>0?o:[t]){const u=document.createRange();u.selectNodeContents(c);const d=u.getBoundingClientRect();if(!w(d==null?void 0:d.left)||!w(d.top)||!w(d.width)||!w(d.height))return null;i=Math.min(i,d.left),a=Math.min(a,d.top),l=Math.max(l,d.left+d.width),s=Math.max(s,d.top+d.height)}return!w(i)||!w(a)?null:{leftPx:e.leftPx+(i-n.left)/r,topPx:e.topPx+(a-n.top)/r,widthPx:(l-i)/r,heightPx:(s-a)/r}}const Tr=t=>fe(t.style.width)===void 0;function al(t){const e=t.dataset.objId;if(typeof e=="string"&&e!=="")return e;_t+=1;const n=`band-text-lift-${_t}`;return t.dataset.objId=n,n}function ll(t){return t.querySelector("canvas.lower-canvas")??t.querySelector("canvas")}function Ar(t,e,n,r){var o,i,a;try{const l=ll(t);if(!l)return null;const s=l.__fabric;if(s&&typeof s.getObjects=="function"){const u={items:[],liftedObjectIds:[]},d=ma(s);d||(o=r==null?void 0:r.onUnreadableBounds)==null||o.call(r);const f=s.getObjects();return gr(f,[],e,n,new Date,u,d,Ca(f)),u}const c=Da(l);if(c){const u={items:[],liftedObjectIds:[]},d=xa(c);d||(i=r==null?void 0:r.onUnreadableBounds)==null||i.call(r),vr(c,c,e,n,u,d,Xa(c));for(const f of Array.from(t.querySelectorAll(".text-rich-display"))){const g=f.dataset.objId,x=n==="band"&&g?pr(e,{id:g,textIndex:0}):null,P=n==="band"&&We(Ue(x),x,e),p=ol(f,e,P,Kt(n));if(!p)continue;const b=xr(p,x,e,Er(f));b.lines.every(h=>h.runs.length===0)||qe(u,b,()=>al(f),n,Tr(f),e,d,h=>il(f,h))}return u}return null}catch(l){return(a=r==null?void 0:r.onError)==null||a.call(r,l),null}}function sl(t,e,n){return Ar(t,e,"band",n)}function cl(t,e,n){return Ar(t,e,"page",n)}const ul=9525,dl=15,qt=t=>Math.round(t*ul),fl=t=>Math.round(t*dl),hl="http://schemas.openxmlformats.org/drawingml/2006/main",gl="http://schemas.microsoft.com/office/word/2010/wordprocessingShape",pl={left:Y.LEFT,center:Y.CENTER,right:Y.RIGHT},Sr=900,ml=251658240,xl=t=>({id:Sr+t,name:`Editable text ${Sr+t}`,relativeHeight:ml+t});function St(t){const e=nn.fromXmlString(t).root,[n,...r]=e;if(r.length>0||!(n instanceof nn))throw new Error(`expected exactly one root element, got ${e.length}, in: ${t}`);return n}function Cr(t,e,n){if(!Number.isFinite(t)||t<=0)throw new Error(`anchored text box ${e} is not a positive EMU extent (${t}) for "${n.name}": ${n.widthPx}x${n.heightPx}px at (${n.pageLeftPx}, ${n.pageTopPx})`);return t}function bl(t){const e=Cr(qt(t.widthPx),"cx",t),n=Cr(qt(t.heightPx),"cy",t),r=St(`<wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${e}" cy="${n}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/><a:ln><a:noFill/></a:ln></wps:spPr></wps:wsp>`),o=St("<w:txbxContent/>");for(const u of t.lines)o.push(new L({alignment:pl[t.align],spacing:{before:0,after:0,line:fl(u.linePitchPx),lineRule:_.EXACT},children:[...u.runs]}));const i=St("<wps:txbx/>");i.push(o),r.push(i),r.push(St('<wps:bodyPr rot="0" spcFirstLastPara="0" vertOverflow="overflow" horzOverflow="overflow" vert="horz" wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" numCol="1" spcCol="0" rtlCol="0" fromWordArt="0" anchor="t" anchorCtr="0" forceAA="0" compatLnSpc="1"><a:prstTxWarp prst="textNoShape"><a:avLst/></a:prstTxWarp><a:spAutoFit/></wps:bodyPr>'));const a=St(`<a:graphicData uri="${gl}"/>`);a.push(r);const l=St(`<a:graphic xmlns:a="${hl}"/>`);l.push(a);const s=St(`<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" relativeHeight="${t.relativeHeight}" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1"><wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="page"><wp:posOffset>${qt(t.pageLeftPx)}</wp:posOffset></wp:positionH><wp:positionV relativeFrom="page"><wp:posOffset>${qt(t.pageTopPx)}</wp:posOffset></wp:positionV><wp:extent cx="${e}" cy="${n}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${t.id}" name="${t.name}"/><wp:cNvGraphicFramePr/></wp:anchor>`);s.push(l);const c=St("<w:drawing/>");return c.push(s),c}const wl=t=>new L({children:[new R({children:[bl(t)]})],spacing:{before:0,after:0,line:1,lineRule:_.EXACT}}),Nr=1.5,yl=.02,Fr=16,vl=.5/Nr;function Mr(t,e){let n=0;for(const r of t.lines)for(const o of r.runs){const i=(o.fontSizePx??Fr)*e;i>0&&(n=Math.max(n,vl/i))}return n}const Pl=t=>Math.round(t*Nr);function El(t,e,n){return t==="center"?e-n/2:t==="right"?e-n:e}const Tl=(t,e,n)=>({font:wt(t.fontFamily??e),size:Pl((t.fontSizePx??Fr)*n),color:t.color,bold:t.bold,italics:t.italics,strike:t.strike,underline:t.underline?{}:void 0}),$r=t=>t.totalPagesAsField||t.resolvedTotalPages===void 0;function Al(t,e){return t.kind==="page-number"?{field:"PAGE"}:t.kind==="total-pages"?$r(e)?{field:"NUMPAGES"}:{literal:e.resolvedTotalPages??""}:{literal:t.text??""}}function Sl(t,e,n,r){const o=Tl(t,e,r);return t.hiddenAtPageZero?[...ui(Al(t,n),o)]:t.kind==="page-number"?[li(o)]:t.kind==="total-pages"?[$r(n)?si(o):new R({...o,text:n.resolvedTotalPages??""})]:[new R({...o,text:t.text??""})]}function Ir(t,e,n,r){const o=t.widthPx*e.scale,i=o*(yl+(e.extraWidthPadRatio??0));return wl({...xl(e.itemIndex),pageLeftPx:El(t.align,e.pageLeftPx,i),pageTopPx:e.pageTopPx,widthPx:o+i,heightPx:t.heightPx*e.scale,align:t.align,lines:t.lines.map((a,l)=>{var s;return{linePitchPx:(((s=t.linePitchPx)==null?void 0:s[l])??t.lineHeightPx)*e.scale,runs:a.runs.flatMap(c=>Sl(c,n,r,e.scale))}})})}function kr(t){return new L({children:[new It({type:t.type,data:t.data,transformation:{width:t.widthPx,height:t.heightPx},floating:{horizontalPosition:{relative:No.PAGE,offset:qt(t.offsetXPx)},verticalPosition:{relative:Co.PAGE,offset:qt(t.offsetYPx)},behindDocument:!0,allowOverlap:!0,wrap:{type:So.NONE}}})],spacing:{before:0,after:0,line:1,lineRule:_.EXACT}})}const Cl=(t,e)=>e.bandKind==="header"?t.topPx:e.pageHeightPx-e.bandHeightPx+t.topPx,Nl=t=>t.bandKind==="header"?0:t.pageHeightPx-t.bandHeightPx,Fl=(t,e)=>new L({children:[new It({type:t.type,data:t.data,transformation:{width:e.pageWidthPx,height:e.bandHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO}});function Ml(t,e,n,r,o){return t.items.length===0?[Fl(e,n)]:[kr({...e,widthPx:n.pageWidthPx,heightPx:n.bandHeightPx,offsetXPx:0,offsetYPx:Nl(n)}),...t.items.map((i,a)=>Ir(i,{pageLeftPx:i.leftPx,pageTopPx:Cl(i,n),scale:1,itemIndex:a,extraWidthPadRatio:Mr(i,1)},r,o))]}const $l={totalPagesAsField:!1},Il=t=>t.displayWidthPx/t.canvasWidthPx,kl=t=>t.displayHeightPx/t.canvasHeightPx;function Or(t,e,n){if(!Number.isFinite(t)||t<=0)throw new Error(`canvas page ${e} scale is not a positive number (${t}): ${JSON.stringify(n)}`);return t}const Ol=(t,e)=>new L({children:[new It({type:t.type,data:t.data,transformation:{width:e.displayWidthPx,height:e.displayHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO},alignment:Y.CENTER});function Ll(t){for(const e of t.lines)for(const n of e.runs){if(n.kind!=="text")throw new Error(`page extraction produced field run kind: ${n.kind}`);if(n.hiddenAtPageZero)throw new Error("page extraction produced a page-zero conditional run")}}function Rl(t,e,n,r,o=0){if(t.items.length===0)return[Ol(e,n)];t.items.forEach(Ll);const i=Or(Il(n),"horizontal",n),a=Or(kl(n),"vertical",n);return[kr({...e,widthPx:n.displayWidthPx,heightPx:n.displayHeightPx,offsetXPx:n.offsetXPx,offsetYPx:0}),...t.items.map((l,s)=>Ir(l,{pageLeftPx:l.leftPx*i+n.offsetXPx,pageTopPx:l.topPx*a,scale:i,itemIndex:o+s,extraWidthPadRatio:Mr(l,i)},r,$l))]}const Hl=8,Dl=40,Xe=4,zl=95,jl=4e8,Bl=t=>t.width*t.height*Xe*Xe,Wl={format:"jpeg",quality:zl},_l={format:"png",omitBackground:!0},ge=t=>`page:${t}`,Ut=(t,e)=>`${e}:${t}`,Lr=t=>t&&t.items.length>0?t.liftedObjectIds:void 0;async function ql(t){await Mo(),await Bo(t)}async function Ul(t,e,n,r,o){const i=[],a=new Map,l=new Map,s=new Map,c=d=>d instanceof Error?d.message:String(d),u=(d,f,g,x)=>{const P=`${x}|${g.width}x${g.height}|${f}`;let p=l.get(P);p===void 0&&(p=i.length,i.push({html:f,dimensions:g,kind:x}),l.set(P,p)),a.set(d,p)};for(let d=0;d<t.length;d++){const f=t[d],g=e[d],x=n[d];if(!f||!g||!x)continue;if(te(f)){try{const p=Lr(o==null?void 0:o.get(d)),b=$o(f),h=f.useFabric?(await cn(x,{...p?{hideObjectIds:p,stripRichTextOverlays:!0}:{},expectNonBlankCanvas:b})).outerHTML:await jo(x,g.width,g.height,d+1,{...p?{hideObjectIds:p}:{},expectNonBlankCanvas:b});h&&u(ge(d),h,{width:g.width,height:g.height},"page")}catch(p){s.set(ge(d),c(p)),console.warn(`DOCX server capture: could not build HTML for page ${d+1}`,p)}continue}if(f.skipHeaderFooter)continue;const P=[{kind:"header",selector:".docx-export-header",height:g.headerBand},{kind:"footer",selector:".docx-export-footer",height:g.footerBand}];for(const p of P){const b=x.querySelector(p.selector);if(!b)continue;const h=Ut(d,p.kind);try{const m=Lr(r==null?void 0:r.get(h)),S=await cn(b,m?{hideObjectIds:m,stripRichTextOverlays:!0}:{});u(h,S.outerHTML,{width:g.width,height:p.height},"band")}catch(m){s.set(h,c(m)),console.warn(`DOCX server capture: could not build ${p.kind} HTML for page ${d+1}`,m)}}}if(r)for(const d of r.keys())a.has(d)||console.warn(`DOCX server capture: band extraction "${d}" has no capture job \u2014 its band will not be lifted`);if(o)for(const d of o.keys()){const f=ge(d);if(!a.has(f)){const g=s.get(f)??"no HTML was produced for it";console.warn(`DOCX server capture: page extraction for page ${d+1} has no capture job (${g}) \u2014 that page has no server image either, so the export will fail with a named capture miss`)}}return{entries:i,keyToEntry:a,jobFailures:s}}async function Gl(t){const{pages:e,geometry:n,documentFont:r,componentColors:o,documentMargins:i,bandExtractions:a,pageExtractions:l}=t,s=new Map;try{const c=e.map((T,A)=>document.getElementById(`page-${A+1}`));await ql(c);const{entries:u,keyToEntry:d,jobFailures:f}=await Ul(e,n,c,a,l);if(u.length===0)return{images:s,jobFailures:f};const{styles:g,customProperties:x}=await zo(r,o,i,u.map(T=>T.html)),P=new Array(u.length).fill(null);let p;const b=(T,A)=>{const y=[];let C=[],D=0;for(const V of T){const st=Bl(u[V].dimensions),tt=C.length>=A,ut=D+st>jl;C.length>0&&(tt||ut)&&(y.push(C),C=[],D=0),C.push(V),D+=st}return C.length>0&&y.push(C),y},h=async(T,A,y)=>{for(const C of b(T,y))try{const D=await Fo({pages:C.map(V=>u[V].html),styles:g,fontFamily:r||"system-ui, sans-serif",customProperties:x,dimensions:{width:Tt.US_LETTER.width,height:Tt.US_LETTER.height},pageDimensions:C.map(V=>u[V].dimensions),pixelRatio:Xe,...A});C.forEach((V,st)=>{P[V]=D[st]??null})}catch(D){p??(p=D instanceof Error?D.message:String(D)),console.error("DOCX server capture: page-image batch failed",D)}},m=T=>u.reduce((A,y,C)=>(y.kind===T&&A.push(C),A),[]),S=async T=>{const A=y=>T.filter(C=>u[C].kind===y);await h(A("page"),Wl,Hl),await h(A("band"),_l,Dl)},M=()=>u.reduce((T,A,y)=>(P[y]||T.push(y),T),[]);await S([...m("page"),...m("band")]);const E=M();if(E.length>0){const T=new Set(E),A=[];d.forEach((D,V)=>{T.has(D)&&A.push(V)}),await S(E);const y=M(),C=p??null;y.length===0&&(p=void 0),rn({error:new Error("DOCX export: server page capture retried"),extra:{context:"exportPreviewToDocx.serverCaptureRetry",retriedJobKeys:A,retriedEntryCount:E.length,recoveredCount:E.length-y.length,stillMissingCount:y.length,firstPassFailureReason:C}})}return d.forEach((T,A)=>{s.set(A,P[T]??null)}),{images:s,jobFailures:f,...p?{failureReason:p}:{}}}catch(c){if(on(c))throw c;return console.error("DOCX server capture: pre-pass failed",c),{images:s,jobFailures:new Map,failureReason:c instanceof Error?c.message:String(c)}}}function Xl(t){if(t.length===0)return null;const e=t.reduce((o,i)=>Math.max(o,i.reduce((a,l)=>a+(l.colSpan||1),0)),0);if(e===0)return null;const n=t.find(o=>o.length===e&&o.every(i=>(i.colSpan||1)===1));if(!n)return null;const r=n.map(o=>o.widthPx);return r.some(o=>!o||o<=0)?null:r.map(o=>Math.round(o*15))}const Rr="img, table, canvas, svg, hr",Yl=t=>t.split(";").some(e=>{const n=e.indexOf(":");if(n===-1)return!1;const r=e.slice(0,n).trim().toLowerCase();return r!=="background"&&r!=="background-image"?!1:e.slice(n+1).toLowerCase().includes("url(")}),Vl=t=>[t,...Array.from(t.querySelectorAll("[style]"))].some(e=>Yl(e.getAttribute("style")??"")),Jl=t=>(t.textContent??"").trim()!==""||t.matches(Rr)||t.querySelector(Rr)?!1:!Vl(t);function Hr(t){let e=t.lastElementChild;for(;e&&Jl(e);)e.remove(),e=t.lastElementChild}function pe(t){return dn(t)==="jpg"?"jpg":"png"}class Ye extends Error{constructor(e){super(e),this.name="DocxServerCaptureError"}}const Dr=10,Kl=Tt.US_LETTER.width,Zl=Tt.US_LETTER.height,Ql=.15,ts=4,zr=t=>Do(t),jr=t=>{if(Ho(t)){const n=ht(t.canvasWidth/96),r=ht(t.canvasHeight/96);return t.canvasWidth>t.canvasHeight?{width:r,height:n,orientation:sn.LANDSCAPE}:{width:n,height:r,orientation:void 0}}const e=t.orientation==="landscape";return{width:ht(8.5),height:ht(11),orientation:e?sn.LANDSCAPE:void 0}},Br=(t,e)=>{const{width:n,height:r}=zr(t),o=t.orientation==="landscape";return{width:n,height:r,headerBand:o?e.landscapeHeader:e.header,footerBand:o?e.landscapeFooter:e.footer}};function Wr(t,e){const n=Array.from(t.querySelectorAll("table")),r=Array.from(e.querySelectorAll("table"));n.forEach((o,i)=>{const a=r[i];if(!a)return;const l=Array.from(o.querySelectorAll("tr")).map(c=>Array.from(c.children).map(u=>({colSpan:u.colSpan||1,widthPx:u.offsetWidth}))),s=Xl(l);s&&a.setAttribute("data-col-twips",s.join(","))})}function _r(t,e){const n=Array.from(t.querySelectorAll("tr")),r=Array.from(e.querySelectorAll("tr"));n.forEach((o,i)=>{const a=r[i];if(!a)return;const l=o.offsetHeight;l>0&&a.setAttribute("data-row-twips",String(Math.round(l*15)))})}const es="markdown-export-preview-container",ns=[{kind:"header",selector:".docx-export-header"},{kind:"footer",selector:".docx-export-footer"}],qr=t=>t.id==="cover-page"||t.id.startsWith("toc-page"),Ur=(t,e)=>!!t&&t.items.some(n=>n.lines.some(r=>r.runs.some(e))),Gr=(t,e)=>Ur(t,n=>n.kind===e),Xr=(t,e)=>t.items.length===0?!1:e>=1?!0:!Ur(t,n=>n.kind==="page-number"&&n.hiddenAtPageZero!==!0),Yr="canvas-blocking",rs=()=>{const t=new Map,e=n=>{const r=t.get(n);if(r!==void 0)return r;let o=2166136261;for(let a=0;a<n.length;a++)o^=n[a],o=Math.imul(o,16777619);const i=`${n.length}.${(o>>>0).toString(36)}`;return t.set(n,i),i};return({bandKind:n,imageBuffer:r,bandHeightPx:o,extraction:i,pageSize:a})=>{const l=`${n}|${a.width}x${a.height}|${String(a.orientation)}|${o}`;if(!r||r.length===0)return`${l}|empty`;const s=e(r);return i?`${l}|lifted|${s}|${JSON.stringify(i.items)}`:`${l}|raster|${s}`}};let Vr;const me=()=>Vr??(Vr=import("./index.client-88ufWAAE.js")),os=(t,e,n)=>{me().then(({addBreadcrumb:r})=>r({category:"docx-export",level:"warning",message:"docx editable chrome fallback",data:{band:t,page:e,...n?{error:n}:{}}})).catch(()=>{})},is=(t,e)=>{me().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx editable canvas text fallback",data:{page:t,...e?{error:e}:{}}})).catch(()=>{})},Jr=t=>{var e;if(!(t instanceof Error))return String(t);const n=(((e=t.stack)==null?void 0:e.split(`
10
+ `);if(!e)return n;const r=t.textArr;return!Array.isArray(r)||r.length===n.length?n:r.map(o=>typeof(o==null?void 0:o.text)=="string"?o.text:"")}function wr(t,e){var n;const r=(n=t.attrs)==null?void 0:n[e];return r==null||r==="auto"}function yr(t){const e=t.getAbsoluteScale();return w(e==null?void 0:e.y)&&e.y>0?e.y:1}function Wa(t,e,n,r,o){const i=t.getClientRect({relativeTo:e,skipShadow:!0,skipStroke:!0});if(!i||!w(i.x)||!w(i.y))return null;const a=t.getAbsoluteScale(),l=w(a==null?void 0:a.x)&&a.x>0?a.x:1,s=yr(t),c=br(t,s),u=Ba(t,o),d=u.map(m=>({runs:se(m,()=>c,n)}));if(!r&&d.every(m=>m.runs.length===0))return null;const f=w(t.fontSize())?t.fontSize():0,g=f*(w(t.lineHeight())?t.lineHeight():1),x=u.length*g,P=w(t.padding())?t.padding():0,p=t.verticalAlign(),b=t.getHeight()-x-P*2,h=wr(t,"height")?0:p==="middle"?b/2:p==="bottom"?b:0;return{leftPx:i.x+P*l,topPx:i.y+(P+h)*s,widthPx:i.width-P*2*l,heightPx:x*s,align:ue(t.align()),lineHeightPx:g*s,linePitchPx:Be(d,f*s,w(t.lineHeight())?t.lineHeight():1),lines:d}}function _a(t,e){if(sr(t.align()))return null;const n=t.textArr;if(!Array.isArray(n)||n.length===0)return null;const r=t.getAbsoluteScale(),o=w(r==null?void 0:r.x)&&r.x>0?r.x:1,i=[];for(const a of n){if(!w(a==null?void 0:a.width))return null;i.push(a.width*o)}return cr(e,i)}function qa(t){for(let n=t.getParent();n;n=n.getParent()){const r=n.id();if(!(typeof r!="string"||r===""))return{id:r,textIndex:n.find("Text").indexOf(t)}}const e=t.id();return typeof e=="string"&&e!==""?{id:e,textIndex:0}:null}function Ua(t){return!t.isVisible()||t.getClassName()==="Text"?!1:t.getAbsoluteOpacity()>0}function Ga(t,e){const n=t.getClientRect({relativeTo:e});return!n||!w(n.x)||!w(n.y)||!w(n.width)||!w(n.height)?null:{leftPx:n.x,topPx:n.y,widthPx:n.width,heightPx:n.height}}function Xa(t){const e=[],n=new Map,r=o=>{var i;const a=(i=o.getChildren)==null?void 0:i.call(o);if(a){for(const l of a)r(l);return}n.set(o,e.length),e.push({occludes:Ua(o),rect:Ga(o,t)})};return r(t),{steps:e,indexOf:n}}function vr(t,e,n,r,o,i,a){var l;if(t.getClassName()==="Text"){const c=t,u=r==="band"?pr(n,qa(c)):null,d=r==="band"&&We(Ue(u),u,n);if(!ja(c,d,Kt(r))||dr(c,a))return;const f=Wa(c,e,n,d,Kt(r));if(!f)return;const g=xr(f,u,n,br(c,yr(c)));if(g.lines.every(x=>x.runs.length===0))return;qe(o,g,()=>za(c),r,wr(c,"width"),n,i,x=>_a(c,x));return}const s=(l=t.getChildren)==null?void 0:l.call(t);if(s)for(const c of s)vr(c,e,n,r,o,i,a)}function fe(t){const e=/^(-?\d*\.?\d+)px$/.exec((t??"").trim());if(!e)return;const n=Number.parseFloat(e[1]);return Number.isFinite(n)?n:void 0}function Pr(t){var e;if(typeof t!="string")return;const n=(e=t.split(",")[0])==null?void 0:e.replace(/['"]/g,"").trim();return n!==void 0&&n!==""?n:void 0}const Ya="ul, ol, mark, img, table",Zt=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","LI"]),Ge=t=>Array.from(t.children).some(e=>Zt.has(e.tagName));function he(t,e){const n={...e};switch(t.tagName){case"STRONG":case"B":n.bold=!0;break;case"EM":case"I":n.italics=!0;break;case"U":n.underline=!0;break;case"S":case"STRIKE":case"DEL":n.strike=!0;break}const r=t.style;r.fontWeight!==""&&(je(r.fontWeight)?n.bold=!0:delete n.bold),(r.fontStyle==="italic"||r.fontStyle==="oblique")&&(n.italics=!0);const o=`${r.textDecoration} ${r.textDecorationLine}`;o.includes("underline")&&(n.underline=!0),o.includes("line-through")&&(n.strike=!0);const i=ze(r.color);i&&(n.color=i);const a=Pr(r.fontFamily);a&&(n.fontFamily=a);const l=fe(r.fontSize);return l!==void 0&&l>0&&(n.fontSizePx=l),n}function Er(t){const e=(r,o)=>{if(r.nodeType===Node.TEXT_NODE)return o;if(r.nodeType!==Node.ELEMENT_NODE)return null;const i=r;if(i.tagName==="BR")return null;const a=he(i,o);for(const l of Array.from(i.childNodes)){const s=e(l,a);if(s)return s}return i.childNodes.length===0?a:null},n=he(t,{});for(const r of Array.from(t.childNodes)){const o=e(r,n);if(o)return o}return n}function Va(t,e){const n=[""],r=[[]];let o=0;const i=()=>{n.push(""),r.push([])},a=(s,c)=>{const u=n.length-1;n[u]+=s;for(let d=0;d<s.length;d++)r[u].push(c)},l=(s,c)=>{if(s.nodeType===Node.TEXT_NODE){a(s.textContent??"",c);return}if(s.nodeType!==Node.ELEMENT_NODE)return;const u=s;if(u.tagName==="BR"){const f=u.parentElement;(!f||!Zt.has(f.tagName)||f.childNodes.length!==1)&&i();return}Zt.has(u.tagName)&&!Ge(u)&&(o>0&&i(),o+=1);const d=he(u,c);for(const f of Array.from(u.childNodes))l(f,d)};for(const s of Array.from(t.childNodes))l(s,e);return{lines:n,charStyles:r}}const Ja=(t,e)=>t.bold===e.bold&&t.italics===e.italics&&t.underline===e.underline&&t.strike===e.strike&&t.color===e.color&&t.fontSizePx===e.fontSizePx&&t.fontFamily===e.fontFamily;function Ka(t){let e=null;for(const n of t.charStyles)for(const r of n)if(e===null)e=r;else if(!Ja(e,r))return null;return e}const Za=1,Qa=t=>t.replace(/\s+/g," ");function tl(t){const e=[];let n=0;for(let r=1;r<t.length;r++)/\s/.test(t[r-1])&&!/\s/.test(t[r])&&(e.push(t.slice(n,r)),n=r);return e.push(t.slice(n)),e}function el(t,e,n,r){const o=s=>er(Qa(s),e,n),i=o(t);if(i===null||i<=r)return[t];const a=[];let l="";for(const s of tl(t)){const c=l+s,u=o(c.trimEnd());if(u===null)return[t];l.trim()!==""&&u>r?(a.push(l.trimEnd()),l=s):l=c}return a.push(l),a}function nl(t,e,n){if(Tr(e)||t.lines.some(l=>l.includes("{%")))return t;const r=Ka(t),o=r==null?void 0:r.fontSizePx;if(!r||!w(o)||o<=0)return t;const i=[],a=[];for(const l of t.lines)for(const s of el(l,r,o,n+Za))i.push(s),a.push(new Array(s.length).fill(r));return{lines:i,charStyles:a}}function rl(t){for(const e of Array.from(t.querySelectorAll("*")))if(Zt.has(e.tagName)&&!Ge(e)){if(e.style.textAlign!=="")return ue(e.style.textAlign);break}return ue(t.style.textAlign)}function ol(t,e,n,r){if(t.querySelector(Ya))return null;const o=t.style.opacity;if(o!==""&&Number.parseFloat(o)!==1)return null;const i=/rotate\(\s*(-?\d*\.?\d+)deg/.exec(t.style.transform??"");if(i&&Number.parseFloat(i[1])!==0)return null;const a=Number.parseFloat(t.dataset.expectedLeft??""),l=Number.parseFloat(t.dataset.expectedTop??""),s=fe(t.style.width)??fe(t.style.minWidth);if(!w(a)||!w(l)||s===void 0||s<=0)return null;const c=he(t,{}),u=c.fontSizePx??0,d=Number.parseFloat(t.style.lineHeight);if(u<=0||!w(d)||d<=0)return null;const f=Va(t,c),g=r?nl(f,t,s):f,x=g.lines.map((h,m)=>({runs:se(h,S=>{var M;return((M=g.charStyles[m])==null?void 0:M[S])??c},e)}));if(!n&&x.every(h=>h.runs.length===0))return null;const P=x.every(h=>h.runs.length===0)?Er(t).fontSizePx??u:u,p=Be(x,Math.max(u,P),d),b=p.reduce((h,m)=>h+m,0);return t.offsetHeight>b+2?null:{leftPx:a,topPx:l,widthPx:s,heightPx:b,align:rl(t),lineHeightPx:u*d,linePitchPx:p,lines:x}}function il(t,e){const n=t.getBoundingClientRect();if(!w(n==null?void 0:n.left)||!w(n.top))return null;const r=n.width>0&&t.offsetWidth>0?n.width/t.offsetWidth:1;if(!w(r)||r<=0)return null;const o=Array.from(t.querySelectorAll("*")).filter(c=>Zt.has(c.tagName)&&!Ge(c));let i=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const c of o.length>0?o:[t]){const u=document.createRange();u.selectNodeContents(c);const d=u.getBoundingClientRect();if(!w(d==null?void 0:d.left)||!w(d.top)||!w(d.width)||!w(d.height))return null;i=Math.min(i,d.left),a=Math.min(a,d.top),l=Math.max(l,d.left+d.width),s=Math.max(s,d.top+d.height)}return!w(i)||!w(a)?null:{leftPx:e.leftPx+(i-n.left)/r,topPx:e.topPx+(a-n.top)/r,widthPx:(l-i)/r,heightPx:(s-a)/r}}const Tr=t=>fe(t.style.width)===void 0;function al(t){const e=t.dataset.objId;if(typeof e=="string"&&e!=="")return e;_t+=1;const n=`band-text-lift-${_t}`;return t.dataset.objId=n,n}function ll(t){return t.querySelector("canvas.lower-canvas")??t.querySelector("canvas")}function Ar(t,e,n,r){var o,i,a;try{const l=ll(t);if(!l)return null;const s=l.__fabric;if(s&&typeof s.getObjects=="function"){const u={items:[],liftedObjectIds:[]},d=ma(s);d||(o=r==null?void 0:r.onUnreadableBounds)==null||o.call(r);const f=s.getObjects();return gr(f,[],e,n,new Date,u,d,Ca(f)),u}const c=Da(l);if(c){const u={items:[],liftedObjectIds:[]},d=xa(c);d||(i=r==null?void 0:r.onUnreadableBounds)==null||i.call(r),vr(c,c,e,n,u,d,Xa(c));for(const f of Array.from(t.querySelectorAll(".text-rich-display"))){const g=f.dataset.objId,x=n==="band"&&g?pr(e,{id:g,textIndex:0}):null,P=n==="band"&&We(Ue(x),x,e),p=ol(f,e,P,Kt(n));if(!p)continue;const b=xr(p,x,e,Er(f));b.lines.every(h=>h.runs.length===0)||qe(u,b,()=>al(f),n,Tr(f),e,d,h=>il(f,h))}return u}return null}catch(l){return(a=r==null?void 0:r.onError)==null||a.call(r,l),null}}function sl(t,e,n){return Ar(t,e,"band",n)}function cl(t,e,n){return Ar(t,e,"page",n)}const ul=9525,dl=15,qt=t=>Math.round(t*ul),fl=t=>Math.round(t*dl),hl="http://schemas.openxmlformats.org/drawingml/2006/main",gl="http://schemas.microsoft.com/office/word/2010/wordprocessingShape",pl={left:Y.LEFT,center:Y.CENTER,right:Y.RIGHT},Sr=900,ml=251658240,xl=t=>({id:Sr+t,name:`Editable text ${Sr+t}`,relativeHeight:ml+t});function St(t){const e=nn.fromXmlString(t).root,[n,...r]=e;if(r.length>0||!(n instanceof nn))throw new Error(`expected exactly one root element, got ${e.length}, in: ${t}`);return n}function Cr(t,e,n){if(!Number.isFinite(t)||t<=0)throw new Error(`anchored text box ${e} is not a positive EMU extent (${t}) for "${n.name}": ${n.widthPx}x${n.heightPx}px at (${n.pageLeftPx}, ${n.pageTopPx})`);return t}function bl(t){const e=Cr(qt(t.widthPx),"cx",t),n=Cr(qt(t.heightPx),"cy",t),r=St(`<wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${e}" cy="${n}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/><a:ln><a:noFill/></a:ln></wps:spPr></wps:wsp>`),o=St("<w:txbxContent/>");for(const u of t.lines)o.push(new L({alignment:pl[t.align],spacing:{before:0,after:0,line:fl(u.linePitchPx),lineRule:_.EXACT},children:[...u.runs]}));const i=St("<wps:txbx/>");i.push(o),r.push(i),r.push(St('<wps:bodyPr rot="0" spcFirstLastPara="0" vertOverflow="overflow" horzOverflow="overflow" vert="horz" wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" numCol="1" spcCol="0" rtlCol="0" fromWordArt="0" anchor="t" anchorCtr="0" forceAA="0" compatLnSpc="1"><a:prstTxWarp prst="textNoShape"><a:avLst/></a:prstTxWarp><a:spAutoFit/></wps:bodyPr>'));const a=St(`<a:graphicData uri="${gl}"/>`);a.push(r);const l=St(`<a:graphic xmlns:a="${hl}"/>`);l.push(a);const s=St(`<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" relativeHeight="${t.relativeHeight}" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1"><wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="page"><wp:posOffset>${qt(t.pageLeftPx)}</wp:posOffset></wp:positionH><wp:positionV relativeFrom="page"><wp:posOffset>${qt(t.pageTopPx)}</wp:posOffset></wp:positionV><wp:extent cx="${e}" cy="${n}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${t.id}" name="${t.name}"/><wp:cNvGraphicFramePr/></wp:anchor>`);s.push(l);const c=St("<w:drawing/>");return c.push(s),c}const wl=t=>new L({children:[new R({children:[bl(t)]})],spacing:{before:0,after:0,line:1,lineRule:_.EXACT}}),Nr=1.5,yl=.02,Fr=16,vl=.5/Nr;function Mr(t,e){let n=0;for(const r of t.lines)for(const o of r.runs){const i=(o.fontSizePx??Fr)*e;i>0&&(n=Math.max(n,vl/i))}return n}const Pl=t=>Math.round(t*Nr);function El(t,e,n){return t==="center"?e-n/2:t==="right"?e-n:e}const Tl=(t,e,n)=>({font:wt(t.fontFamily??e),size:Pl((t.fontSizePx??Fr)*n),color:t.color,bold:t.bold,italics:t.italics,strike:t.strike,underline:t.underline?{}:void 0}),$r=t=>t.totalPagesAsField||t.resolvedTotalPages===void 0;function Al(t,e){return t.kind==="page-number"?{field:"PAGE"}:t.kind==="total-pages"?$r(e)?{field:"NUMPAGES"}:{literal:e.resolvedTotalPages??""}:{literal:t.text??""}}function Sl(t,e,n,r){const o=Tl(t,e,r);return t.hiddenAtPageZero?[...ui(Al(t,n),o)]:t.kind==="page-number"?[li(o)]:t.kind==="total-pages"?[$r(n)?si(o):new R({...o,text:n.resolvedTotalPages??""})]:[new R({...o,text:t.text??""})]}function Ir(t,e,n,r){const o=t.widthPx*e.scale,i=o*(yl+(e.extraWidthPadRatio??0));return wl({...xl(e.itemIndex),pageLeftPx:El(t.align,e.pageLeftPx,i),pageTopPx:e.pageTopPx,widthPx:o+i,heightPx:t.heightPx*e.scale,align:t.align,lines:t.lines.map((a,l)=>{var s;return{linePitchPx:(((s=t.linePitchPx)==null?void 0:s[l])??t.lineHeightPx)*e.scale,runs:a.runs.flatMap(c=>Sl(c,n,r,e.scale))}})})}function kr(t){return new L({children:[new It({type:t.type,data:t.data,transformation:{width:t.widthPx,height:t.heightPx},floating:{horizontalPosition:{relative:No.PAGE,offset:qt(t.offsetXPx)},verticalPosition:{relative:Co.PAGE,offset:qt(t.offsetYPx)},behindDocument:!0,allowOverlap:!0,wrap:{type:So.NONE}}})],spacing:{before:0,after:0,line:1,lineRule:_.EXACT}})}const Cl=(t,e)=>e.bandKind==="header"?t.topPx:e.pageHeightPx-e.bandHeightPx+t.topPx,Nl=t=>t.bandKind==="header"?0:t.pageHeightPx-t.bandHeightPx,Fl=(t,e)=>new L({children:[new It({type:t.type,data:t.data,transformation:{width:e.pageWidthPx,height:e.bandHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO}});function Ml(t,e,n,r,o){return t.items.length===0?[Fl(e,n)]:[kr({...e,widthPx:n.pageWidthPx,heightPx:n.bandHeightPx,offsetXPx:0,offsetYPx:Nl(n)}),...t.items.map((i,a)=>Ir(i,{pageLeftPx:i.leftPx,pageTopPx:Cl(i,n),scale:1,itemIndex:a,extraWidthPadRatio:Mr(i,1)},r,o))]}const $l={totalPagesAsField:!1},Il=t=>t.displayWidthPx/t.canvasWidthPx,kl=t=>t.displayHeightPx/t.canvasHeightPx;function Or(t,e,n){if(!Number.isFinite(t)||t<=0)throw new Error(`canvas page ${e} scale is not a positive number (${t}): ${JSON.stringify(n)}`);return t}const Ol=(t,e)=>new L({children:[new It({type:t.type,data:t.data,transformation:{width:e.displayWidthPx,height:e.displayHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO},alignment:Y.CENTER});function Ll(t){for(const e of t.lines)for(const n of e.runs){if(n.kind!=="text")throw new Error(`page extraction produced field run kind: ${n.kind}`);if(n.hiddenAtPageZero)throw new Error("page extraction produced a page-zero conditional run")}}function Rl(t,e,n,r,o=0){if(t.items.length===0)return[Ol(e,n)];t.items.forEach(Ll);const i=Or(Il(n),"horizontal",n),a=Or(kl(n),"vertical",n);return[kr({...e,widthPx:n.displayWidthPx,heightPx:n.displayHeightPx,offsetXPx:n.offsetXPx,offsetYPx:0}),...t.items.map((l,s)=>Ir(l,{pageLeftPx:l.leftPx*i+n.offsetXPx,pageTopPx:l.topPx*a,scale:i,itemIndex:o+s,extraWidthPadRatio:Mr(l,i)},r,$l))]}const Hl=8,Dl=40,Xe=4,zl=95,jl=4e8,Bl=t=>t.width*t.height*Xe*Xe,Wl={format:"jpeg",quality:zl},_l={format:"png",omitBackground:!0},ge=t=>`page:${t}`,Ut=(t,e)=>`${e}:${t}`,Lr=t=>t&&t.items.length>0?t.liftedObjectIds:void 0;async function ql(t){await Mo(),await Bo(t)}async function Ul(t,e,n,r,o){const i=[],a=new Map,l=new Map,s=new Map,c=d=>d instanceof Error?d.message:String(d),u=(d,f,g,x)=>{const P=`${x}|${g.width}x${g.height}|${f}`;let p=l.get(P);p===void 0&&(p=i.length,i.push({html:f,dimensions:g,kind:x}),l.set(P,p)),a.set(d,p)};for(let d=0;d<t.length;d++){const f=t[d],g=e[d],x=n[d];if(!f||!g||!x)continue;if(te(f)){try{const p=Lr(o==null?void 0:o.get(d)),b=$o(f),h=f.useFabric?(await cn(x,{...p?{hideObjectIds:p,stripRichTextOverlays:!0}:{},expectNonBlankCanvas:b})).outerHTML:await jo(x,g.width,g.height,d+1,{...p?{hideObjectIds:p}:{},expectNonBlankCanvas:b});h&&u(ge(d),h,{width:g.width,height:g.height},"page")}catch(p){s.set(ge(d),c(p)),console.warn(`DOCX server capture: could not build HTML for page ${d+1}`,p)}continue}if(f.skipHeaderFooter)continue;const P=[{kind:"header",selector:".docx-export-header",height:g.headerBand},{kind:"footer",selector:".docx-export-footer",height:g.footerBand}];for(const p of P){const b=x.querySelector(p.selector);if(!b)continue;const h=Ut(d,p.kind);try{const m=Lr(r==null?void 0:r.get(h)),S=await cn(b,m?{hideObjectIds:m,stripRichTextOverlays:!0}:{});u(h,S.outerHTML,{width:g.width,height:p.height},"band")}catch(m){s.set(h,c(m)),console.warn(`DOCX server capture: could not build ${p.kind} HTML for page ${d+1}`,m)}}}if(r)for(const d of r.keys())a.has(d)||console.warn(`DOCX server capture: band extraction "${d}" has no capture job \u2014 its band will not be lifted`);if(o)for(const d of o.keys()){const f=ge(d);if(!a.has(f)){const g=s.get(f)??"no HTML was produced for it";console.warn(`DOCX server capture: page extraction for page ${d+1} has no capture job (${g}) \u2014 that page has no server image either, so the export will fail with a named capture miss`)}}return{entries:i,keyToEntry:a,jobFailures:s}}async function Gl(t){const{pages:e,geometry:n,documentFont:r,componentColors:o,documentMargins:i,bandExtractions:a,pageExtractions:l}=t,s=new Map;try{const c=e.map((T,A)=>document.getElementById(`page-${A+1}`));await ql(c);const{entries:u,keyToEntry:d,jobFailures:f}=await Ul(e,n,c,a,l);if(u.length===0)return{images:s,jobFailures:f};const{styles:g,customProperties:x}=await zo(r,o,i,u.map(T=>T.html)),P=new Array(u.length).fill(null);let p;const b=(T,A)=>{const y=[];let C=[],D=0;for(const V of T){const st=Bl(u[V].dimensions),tt=C.length>=A,ut=D+st>jl;C.length>0&&(tt||ut)&&(y.push(C),C=[],D=0),C.push(V),D+=st}return C.length>0&&y.push(C),y},h=async(T,A,y)=>{for(const C of b(T,y))try{const D=await Fo({pages:C.map(V=>u[V].html),styles:g,fontFamily:r||"system-ui, sans-serif",customProperties:x,dimensions:{width:Tt.US_LETTER.width,height:Tt.US_LETTER.height},pageDimensions:C.map(V=>u[V].dimensions),pixelRatio:Xe,...A});C.forEach((V,st)=>{P[V]=D[st]??null})}catch(D){p??(p=D instanceof Error?D.message:String(D)),console.error("DOCX server capture: page-image batch failed",D)}},m=T=>u.reduce((A,y,C)=>(y.kind===T&&A.push(C),A),[]),S=async T=>{const A=y=>T.filter(C=>u[C].kind===y);await h(A("page"),Wl,Hl),await h(A("band"),_l,Dl)},M=()=>u.reduce((T,A,y)=>(P[y]||T.push(y),T),[]);await S([...m("page"),...m("band")]);const E=M();if(E.length>0){const T=new Set(E),A=[];d.forEach((D,V)=>{T.has(D)&&A.push(V)}),await S(E);const y=M(),C=p??null;y.length===0&&(p=void 0),rn({error:new Error("DOCX export: server page capture retried"),extra:{context:"exportPreviewToDocx.serverCaptureRetry",retriedJobKeys:A,retriedEntryCount:E.length,recoveredCount:E.length-y.length,stillMissingCount:y.length,firstPassFailureReason:C}})}return d.forEach((T,A)=>{s.set(A,P[T]??null)}),{images:s,jobFailures:f,...p?{failureReason:p}:{}}}catch(c){if(on(c))throw c;return console.error("DOCX server capture: pre-pass failed",c),{images:s,jobFailures:new Map,failureReason:c instanceof Error?c.message:String(c)}}}function Xl(t){if(t.length===0)return null;const e=t.reduce((o,i)=>Math.max(o,i.reduce((a,l)=>a+(l.colSpan||1),0)),0);if(e===0)return null;const n=t.find(o=>o.length===e&&o.every(i=>(i.colSpan||1)===1));if(!n)return null;const r=n.map(o=>o.widthPx);return r.some(o=>!o||o<=0)?null:r.map(o=>Math.round(o*15))}const Rr="img, table, canvas, svg, hr",Yl=t=>t.split(";").some(e=>{const n=e.indexOf(":");if(n===-1)return!1;const r=e.slice(0,n).trim().toLowerCase();return r!=="background"&&r!=="background-image"?!1:e.slice(n+1).toLowerCase().includes("url(")}),Vl=t=>[t,...Array.from(t.querySelectorAll("[style]"))].some(e=>Yl(e.getAttribute("style")??"")),Jl=t=>(t.textContent??"").trim()!==""||t.matches(Rr)||t.querySelector(Rr)?!1:!Vl(t);function Hr(t){let e=t.lastElementChild;for(;e&&Jl(e);)e.remove(),e=t.lastElementChild}function pe(t){return dn(t)==="jpg"?"jpg":"png"}class Ye extends Error{constructor(e){super(e),this.name="DocxServerCaptureError"}}const Dr=10,Kl=Tt.US_LETTER.width,Zl=Tt.US_LETTER.height,Ql=.15,ts=4,zr=t=>Do(t),jr=t=>{if(Ho(t)){const n=ht(t.canvasWidth/96),r=ht(t.canvasHeight/96);return t.canvasWidth>t.canvasHeight?{width:r,height:n,orientation:sn.LANDSCAPE}:{width:n,height:r,orientation:void 0}}const e=t.orientation==="landscape";return{width:ht(8.5),height:ht(11),orientation:e?sn.LANDSCAPE:void 0}},Br=(t,e)=>{const{width:n,height:r}=zr(t),o=t.orientation==="landscape";return{width:n,height:r,headerBand:o?e.landscapeHeader:e.header,footerBand:o?e.landscapeFooter:e.footer}};function Wr(t,e){const n=Array.from(t.querySelectorAll("table")),r=Array.from(e.querySelectorAll("table"));n.forEach((o,i)=>{const a=r[i];if(!a)return;const l=Array.from(o.querySelectorAll("tr")).map(c=>Array.from(c.children).map(u=>({colSpan:u.colSpan||1,widthPx:u.offsetWidth}))),s=Xl(l);s&&a.setAttribute("data-col-twips",s.join(","))})}function _r(t,e){const n=Array.from(t.querySelectorAll("tr")),r=Array.from(e.querySelectorAll("tr"));n.forEach((o,i)=>{const a=r[i];if(!a)return;const l=o.offsetHeight;l>0&&a.setAttribute("data-row-twips",String(Math.round(l*15)))})}const es="markdown-export-preview-container",ns=[{kind:"header",selector:".docx-export-header"},{kind:"footer",selector:".docx-export-footer"}],qr=t=>t.id==="cover-page"||t.id.startsWith("toc-page"),Ur=(t,e)=>!!t&&t.items.some(n=>n.lines.some(r=>r.runs.some(e))),Gr=(t,e)=>Ur(t,n=>n.kind===e),Xr=(t,e)=>t.items.length===0?!1:e>=1?!0:!Ur(t,n=>n.kind==="page-number"&&n.hiddenAtPageZero!==!0),Yr="canvas-blocking",rs=()=>{const t=new Map,e=n=>{const r=t.get(n);if(r!==void 0)return r;let o=2166136261;for(let a=0;a<n.length;a++)o^=n[a],o=Math.imul(o,16777619);const i=`${n.length}.${(o>>>0).toString(36)}`;return t.set(n,i),i};return({bandKind:n,imageBuffer:r,bandHeightPx:o,extraction:i,pageSize:a})=>{const l=`${n}|${a.width}x${a.height}|${String(a.orientation)}|${o}`;if(!r||r.length===0)return`${l}|empty`;const s=e(r);return i?`${l}|lifted|${s}|${JSON.stringify(i.items)}`:`${l}|raster|${s}`}};let Vr;const me=()=>Vr??(Vr=import("./index.client-B5zFhoJh.js")),os=(t,e,n)=>{me().then(({addBreadcrumb:r})=>r({category:"docx-export",level:"warning",message:"docx editable chrome fallback",data:{band:t,page:e,...n?{error:n}:{}}})).catch(()=>{})},is=(t,e)=>{me().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx editable canvas text fallback",data:{page:t,...e?{error:e}:{}}})).catch(()=>{})},Jr=t=>{var e;if(!(t instanceof Error))return String(t);const n=(((e=t.stack)==null?void 0:e.split(`
11
11
  `)[1])??"").trim();return n?`${t.message} @ ${n}`:t.message},Kr=(t,e)=>{me().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx text lift bounds unreadable",data:{surface:t,page:e}})).catch(()=>{})},Zr=(t,e,n)=>{me().then(({captureMessage:r})=>r(`docx text lift threw on ${t} (page ${e}): ${n}`,"warning")).catch(()=>{})},as=async t=>{var e,n,r;const{pages:o,documentFont:i,componentColors:a,documentName:l="Document",returnBlobOnly:s=!1,documentMargins:c,headerBandHeight:u=Tt.HEADER_FOOTER.height,footerBandHeight:d=Tt.HEADER_FOOTER.height,landscapeHeaderBandHeight:f=u,landscapeFooterBandHeight:g=d,cssContainerClass:x}=t,P=x===es?"export-preview":"document-builder";if(!o||o.length===0)throw new Error("No pages to export");try{const p={header:u,footer:d,landscapeHeader:f,landscapeFooter:g},b=o.filter(v=>v&&qr(v)).length,h=o.length-b,m=v=>{const N=o[v];return!N||qr(N)?0:v+1-b},S=h===o.length?{totalPagesAsField:!0}:{totalPagesAsField:!1,resolvedTotalPages:String(h)},M=((e=t.variableValues)==null?void 0:e.date)??Io(),E=(()=>{var v,N;const O=new Map,$={header:(v=t.headerKonvaData)==null?void 0:v.konvaJson,footer:(N=t.footerKonvaData)==null?void 0:N.konvaJson};for(let j=0;j<o.length;j++){const U=o[j];if(!U||te(U)||U.skipHeaderFooter)continue;const et=document.getElementById(`page-${j+1}`);if(!et)continue;const K=m(j),pt=ko(t.variableValues,K,h);delete pt.page_number,delete pt.total_pages;const Ct={variableValues:pt,currentDateText:M,pageNumber:K,totalPages:h};for(const J of ns){const it=et.querySelector(J.selector);if(!it)continue;let nt;const dt=sl(it,{...Ct,sourceCanvasJson:$[J.kind]},{onError:at=>{nt=at},onUnreadableBounds:()=>Kr(J.kind,j+1)});if(!dt){const at=nt===void 0?void 0:Jr(nt);os(J.kind,j+1,at),at!==void 0&&Zr(J.kind,j+1,at);continue}Xr(dt,K)&&O.set(Ut(j,J.kind),dt)}}return O})(),T=(()=>{const v=new Map,N={...t.variableValues??{}};for(let O=0;O<o.length;O++){const $=o[O];if(!$||!te($)||$.pdfPageImport)continue;const j=document.getElementById(`page-${O+1}`);if(!j)continue;let U;const et=cl(j,{variableValues:N,currentDateText:M},{onError:K=>{U=K},onUnreadableBounds:()=>Kr("page",O+1)});if(!et){const K=U===void 0?void 0:Jr(U);is(O+1,K),K!==void 0&&Zr("page",O+1,K);continue}Xr(et,m(O))&&v.set(O,et)}return v})(),A=await Gl({pages:o,geometry:o.map(v=>Br(v??{},p)),documentFont:i,componentColors:a,documentMargins:c,bandExtractions:E,pageExtractions:T}),y=[],C=v=>{const N=A.jobFailures.get(v);return N?`reconciliation/clone threw: ${N}`:A.failureReason?`batch failed: ${A.failureReason}`:A.images.has(v)?"server could not render":"no capture job was produced"},D=(v,N,O)=>{const $=A.images.get(v);return $&&$.length>0?$:(y.push(`page ${N+1} ${O} (${C(v)})`),null)},V=[];let st=!1,tt=0;const ut=rs(),gt={header:null,footer:null};for(let v=0;v<o.length;v++){const N=o[v];if(!N)continue;const O=v+1,$=document.getElementById(`page-${O}`);if(!$){console.warn(`DOCX export: page-${O} not found in DOM`),y.push(`page ${O} (page element not found in the DOM)`);continue}const j=te(N),U=N.orientation==="landscape",{width:et,height:K,headerBand:pt,footerBand:Ct}=Br(N,p),J=[];let it=null,nt=null,dt="";if(j){if($){const q=D(ge(v),v,"page");if(q&&q.length>0){const F=N.canvasWidth||Kl,G=N.canvasHeight||Zl,I=et,Q=K,mt=F/G,W=I/Q;let X,H;mt>W?(X=I,H=I/mt):(H=Q,X=Q*mt),N.destAnchor&&(H=Math.min(H,Q-ts),J.push(new L({heading:Rt.HEADING_1,children:[new Qe({id:N.destAnchor,children:[new R({text:N.destTitle||"",size:2,color:"FFFFFF"})]})],spacing:{before:0,after:0,line:1,lineRule:_.EXACT}})));const ct=pe(q),xt=T.get(v);xt?(J.push(...Rl(xt,{data:q,type:ct},{canvasWidthPx:F,canvasHeightPx:G,displayWidthPx:X,displayHeightPx:H,offsetXPx:(I-X)/2},i??"",tt)),tt+=xt.items.length):J.push(new L({children:[new It({type:ct,data:q,transformation:{width:X,height:H}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO},alignment:Y.CENTER}))}}}else{const q=$.querySelector(".preview-page-content");if(q){const F=q.cloneNode(!0);Wr(q,F),_r(q,F),F.querySelectorAll("[data-fabric-canvas-placeholder]").forEach(I=>I.remove()),Hr(F);const G=Array.from(F.querySelectorAll("canvas:not(.upper-canvas)"));for(const I of G){const Q=Array.from(q.querySelectorAll("canvas:not(.upper-canvas)")),mt=Array.from(F.querySelectorAll("canvas:not(.upper-canvas)")).indexOf(I),W=Q[mt];if(W&&W.width>0&&W.height>0)try{const X=un(W,4,.95);if(X){const H=document.createElement("img");H.src=X,H.style.width=W.style.width||`${W.width}px`,H.style.height=W.style.height||`${W.height}px`,H.style.display="block",(n=I.parentElement)==null||n.replaceChild(H,I)}}catch(X){if(Te(X))throw X}}dt=F.innerHTML}else{const F=$.cloneNode(!0);Wr($,F),_r($,F);const G=F.querySelector(".page-header"),I=F.querySelector(".page-footer");G&&G.remove(),I&&I.remove(),F.querySelectorAll("[data-fabric-canvas-placeholder]").forEach(W=>W.remove()),Hr(F);const Q=Array.from(F.querySelectorAll("canvas:not(.upper-canvas)")),mt=Array.from($.querySelectorAll("canvas:not(.upper-canvas)"));for(let W=0;W<Q.length;W++){const X=Q[W],H=mt[W];if(X&&H&&H.width>0&&H.height>0)try{const ct=un(H,4,.95);if(ct){const xt=document.createElement("img");xt.src=ct,xt.style.width=H.style.width||`${H.width}px`,xt.style.height=H.style.height||`${H.height}px`,xt.style.display="block",(r=X.parentElement)==null||r.replaceChild(xt,X)}}catch(ct){if(Te(ct))throw ct}}dt=F.innerHTML}if(!N.skipHeaderFooter){const F=$.querySelector(".docx-export-header"),G=$.querySelector(".docx-export-footer");F&&(it=D(Ut(v,"header"),v,"header")),G&&(nt=D(Ut(v,"footer"),v,"footer"))}if(dt){const F=ee((c==null?void 0:c.left)??Ht.left),G=ee((c==null?void 0:c.right)??Ht.right),I=await Un(dt,{componentColors:a,documentFont:i,leftMarginPx:F,rightMarginPx:G,isLandscape:U,contentWidthPx:et-F-G,contentHeightPx:K-(it&&it.length>0?pt:0)-(nt&&nt.length>0?Ct:0)-ee((c==null?void 0:c.top)??Ht.top)-ee((c==null?void 0:c.bottom)??Ht.bottom),previewContext:P,tocPagerefFields:!0},j);J.push(...I)}}const at=!!it&&it.length>0,Ot=!!nt&&nt.length>0,Gt=at?pe(it):"png",Xt=Ot?pe(nt):"png",Pt=at?pt/96:0,Nt=Ot?Ct/96:0,ft=E.get(Ut(v,"header")),Ft=E.get(Ut(v,"footer")),Yt=m(v)<1,Qt=ft!==void 0||Ft!==void 0,xe=Gr(ft,"page-number")||Gr(Ft,"page-number");let Mt=null;Yt?Qt&&(Mt=0):!st&&xe&&(Mt=m(v),st=!0);const be=(q,F,G,I,Q)=>!F||F.length===0?[new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}})]:Q?Ml(Q,{data:F,type:G},{bandKind:q,pageWidthPx:et,pageHeightPx:K,bandHeightPx:I},i??"",S):[new L({children:[new It({type:G,data:F,transformation:{width:et,height:I}})],spacing:{before:0,after:0,line:240,lineRule:_.AUTO}})],B=j?{top:0,right:0,bottom:0,left:0,header:0,footer:0}:{top:ht(Pt+((c==null?void 0:c.top)??Ht.top)),right:ht(0),bottom:ht(Math.max(Nt,Nt+((c==null?void 0:c.bottom)??Ht.bottom)-Ql)),left:ht(0),header:0,footer:0},lt=jr(N),Et={properties:{page:{margin:B,size:{width:lt.width,height:lt.height,orientation:lt.orientation},...Mt!==null?{pageNumbers:{start:Mt}}:{}}},children:J.length>0?J:[new L({text:"",spacing:{before:0,after:0,line:240,lineRule:_.AUTO}})]};if(j){const q=()=>new L({text:"",spacing:{before:0,after:0,line:1,lineRule:_.EXACT}});Et.headers={default:new an({children:[q()]})},Et.footers={default:new ln({children:[q()]})},gt.header=Yr,gt.footer=Yr}else{const q=(I,Q,mt,W,X,H)=>{const ct=ut({bandKind:I,imageBuffer:Q,bandHeightPx:W,extraction:X,pageSize:lt});if(ct!==gt[I])return gt[I]=ct,H(be(I,Q,mt,W,X))},F=q("header",it,Gt,pt,ft,I=>({default:new an({children:I})}));F&&(Et.headers=F);const G=q("footer",nt,Xt,Ct,Ft,I=>({default:new ln({children:I})}));G&&(Et.footers=G)}V.push(Et)}if(y.length>0){const v=y.slice(0,Dr).join("; "),N=y.length-Dr,O=N>0?` (and ${N} more)`:"",$=`DOCX export failed: the server did not return ${y.length} page image(s) \u2014 ${v}${O}`;throw rn({error:new Error($),extra:{context:"exportPreviewToDocx.serverCaptureFailed",missCount:y.length,misses:y,batchFailureReason:A.failureReason??null}}),new Ye($)}const vt=new Oo({numbering:{config:[{reference:"default-numbering",format:Ae.DECIMAL},{reference:"lower-letter-numbering",format:Ae.LOWER_LETTER},{reference:"lower-roman-numbering",format:Ae.LOWER_ROMAN}].map(({reference:v,format:N})=>({reference:v,levels:[{level:0,format:N,text:"%1.",alignment:Y.START,style:{paragraph:{indent:{left:ht(.5),hanging:ht(.25)}}}}]}))},sections:V}),z=await Lo.toBlob(vt);if(s)return z;Ro.saveAs(z,`${l}.docx`)}catch(p){throw on(p)||(console.error("Export to DOCX failed:",p),p instanceof Ye||Te(p))?p:new Error("Failed to export document to DOCX")}};export{Ye as DocxServerCaptureError,jr as docxPageSize,as as exportPreviewToDocx,zr as pageFrameSize,pe as sniffDocxBandType};
@@ -1 +1 @@
1
- import{dN as j,dO as D,dP as S,b_ as Q,dQ as W,dR as z,dS as U,c1 as J,c2 as Y,d4 as G}from"./runtime-E_iChIE5.js";import{b as X,a as Z,N as ee,n as te,c as re,d as oe}from"./exportPageHtml-DTMmohn8.js";import{awaitExportImagesReady as ae}from"./exportImageReadiness-CKbk6ouE.js";const ne=t=>new Promise(i=>{if(t.complete){i();return}if(typeof t.addEventListener!="function"){i();return}const s=()=>i();t.addEventListener("load",s,{once:!0}),t.addEventListener("error",s,{once:!0})});async function se(t){return t.src.startsWith("data:")?t.src:(await ne(t),new Promise((i,s)=>{const a=document.createElement("canvas"),p=a.getContext("2d");if(!p){s(new Error("Could not get canvas context"));return}const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{try{a.width=l.naturalWidth||t.naturalWidth||t.width||100,a.height=l.naturalHeight||t.naturalHeight||t.height||100,p.drawImage(l,0,0),i(a.toDataURL("image/png"))}catch(m){console.error("Error converting image to base64:",m),s(new Error("Failed to convert image to base64"))}},l.onerror=m=>{console.error("Error loading image:",m),s(new Error("Failed to load image"))},l.src=t.src}))}const ie=U.US_LETTER.width,ce=U.US_LETTER.height,$=(t,i)=>{const s=t.get(i);if(s===null)return 0;const a=Number.parseInt(s,10);return Number.isFinite(a)&&a>=0?a:0},I=t=>{const i=t.get("x-native-pages-fallback-kinds");if(!(t.get("x-native-pages-requested")!==null||t.get("x-native-pages-spliced")!==null||t.get("x-native-pages-fallback")!==null||i!==null))return null;const s=new Map;for(const p of(i??"").split(",")){const l=p.lastIndexOf(":");if(l<=0)continue;const m=p.slice(0,l).trim(),F=Number.parseInt(p.slice(l+1),10);!m||!Number.isFinite(F)||F<=0||s.set(m,(s.get(m)??0)+F)}let a=0;for(const p of s.values())a+=p;return{requested:$(t,"x-native-pages-requested"),spliced:$(t,"x-native-pages-spliced"),fallback:Math.max($(t,"x-native-pages-fallback"),a),fallbackKinds:Object.fromEntries(s)}},le=async t=>{const{pages:i,documentName:s,documentFont:a,componentColors:p,cssContainerClass:l,returnBlobOnly:m=!1,companyLogo:F,applyHeadingColors:de=!1,headerKonvaData:ue,footerKonvaData:pe,documentMargins:H,variableValues:me,onSpliceReport:k}=t;try{const d=i.map((r,o)=>document.getElementById(`page-${o+1}`));await ae(d);const c=new Array(i.length);await Promise.all(i.map(async(r,o)=>{const b=o+1,{width:C,height:O}=j(r),A=`<div style="width: ${C}px; height: ${O}px; background: white;"></div>`;if(!r){c[o]=A;return}const x=d[o];if(!x){c[o]=A;return}if(D(r)&&r.useFabric)try{const e=await X(x);c[o]=e.outerHTML}catch(e){if(S(e))throw e;console.error(`Failed to capture V2 canvas page ${b}:`,e),Q({error:e instanceof Error?e:new Error(String(e)),extra:{context:"exportPreviewToPdf.canvasPageCaptureFailed",pageNumber:b,reason:e instanceof Error?e.message:String(e)}}),c[o]=A}else if(D(r))try{c[o]=await Z(x,C,O,b)??A}catch(e){if(S(e))throw e;console.error(`Failed to capture canvas page ${b}:`,e),c[o]=A}else try{const e=x.cloneNode(!0);ee.forEach(n=>{e.querySelectorAll(n).forEach(g=>g.remove())}),e.querySelectorAll(".text-rich-display").forEach(n=>te(n));const P=Array.from(e.querySelectorAll("canvas:not(.upper-canvas)"));if(P.length>0){const n=Array.from(x.querySelectorAll("canvas:not(.upper-canvas)"));for(let g=0;g<P.length;g++){const E=P[g],u=n[g];if(u&&u.width>0&&u.height>0)try{const w=await re(u,{pixelRatio:4,quality:.98,skipHiddenText:!0});if(w&&typeof w=="string"){const h=document.createElement("img");h.src=w,h.style.width=`${u.style.width||u.width+"px"}`,h.style.height=`${u.style.height||u.height+"px"}`,h.style.display="block",h.style.margin="0",h.style.padding="0",h.style.border="0",h.style.imageRendering="-webkit-optimize-contrast";const q=E.parentElement;q&&q.replaceChild(h,E)}}catch(w){if(S(w))throw w;console.warn(`Failed to capture canvas ${g+1}:`,w)}}}const L=Array.from(e.querySelectorAll("img"));if(L.length>0){const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",g=L.map(async E=>{try{const u=await se(E);return E.src=u,!0}catch(u){return console.warn("Failed to convert image to base64, using placeholder:",u),E.src=n,!1}});await Promise.all(g)}e.querySelectorAll("[data-section-id]").forEach(n=>{n.removeAttribute("data-section-id"),n.removeAttribute("onmouseover"),n.removeAttribute("onmouseout"),n.removeAttribute("onclick")}),e.querySelectorAll('[data-page-break="true"], .page-break-marker').forEach(n=>n.remove()),e.querySelectorAll("canvas.upper-canvas").forEach(n=>n.remove()),a&&(e.style.fontFamily=a);let R=e.outerHTML;if(l){const n=a?`font-family: ${a};`:"";R=`<div class="${l}" style="${n}">${R}</div>`}c[o]=R}catch(e){if(S(e))throw e;console.error(`Failed to process HTML page ${b}:`,e),c[o]=A}})),i.forEach((r,o)=>{r!=null&&r.destAnchor&&c[o]&&(c[o]=`${W(r.destAnchor,r.destTitle??"")}${c[o]}`)});const{styles:B,customProperties:V}=await oe(a,p,H,c),{pageDimensions:N,nativePageSources:T}=z(i),K=JSON.stringify({styles:B,fontFamily:a||"system-ui, sans-serif",customProperties:V,dimensions:{width:ie,height:ce},documentName:s||"document",...N?{pageDimensions:N}:{},...T?{nativePageSources:T}:{}}),y=[],M=K.slice(0,-1);y.push(M+',"pages":[');for(let r=0;r<c.length;r++)r>0&&y.push(","),y.push(JSON.stringify(c[r])),c[r]="";y.push("]}");const _=new Blob(y,{type:"application/json"});y.length=0;const f=await J(`${Y}/document_builder/export/pdf`,{method:"POST",body:_});if(!f.ok){const r=await f.text().catch(()=>"Unknown error");throw console.error("PDF export failed:",{status:f.status,statusText:f.statusText,error:r}),new Error(`Failed to generate PDF: Server returned ${f.status} ${f.statusText}`)}k==null||k(I(f.headers));const v=await f.blob();if(!v)throw new Error("Failed to generate PDF: No data received from server");if(!(v instanceof Blob))throw new Error(`Failed to generate PDF: Invalid response format (received ${typeof v})`);if(v.size===0)throw new Error("Failed to generate PDF: Received empty file");if(!m){const r=window.URL.createObjectURL(v),o=document.createElement("a");o.href=r,o.download=`${s||"document"}.pdf`,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(r)}return v}catch(d){throw G(d)||(console.error("PDF export error:",d),((d==null?void 0:d.code)==="ERR_NETWORK"||(d==null?void 0:d.code)==="ECONNABORTED")&&console.error("Network/timeout error details:",{code:d.code,message:d.message,config:d.config})),d}};export{le as exportPreviewToPdf,I as parseSpliceReportHeaders};
1
+ import{dN as j,dO as D,dP as S,b_ as Q,dQ as W,dR as z,dS as U,c1 as J,c2 as Y,d4 as G}from"./runtime-Epi5dRMP.js";import{b as X,a as Z,N as ee,n as te,c as re,d as oe}from"./exportPageHtml-nOa0TJeA.js";import{awaitExportImagesReady as ae}from"./exportImageReadiness-BLHV4KA3.js";const ne=t=>new Promise(i=>{if(t.complete){i();return}if(typeof t.addEventListener!="function"){i();return}const s=()=>i();t.addEventListener("load",s,{once:!0}),t.addEventListener("error",s,{once:!0})});async function se(t){return t.src.startsWith("data:")?t.src:(await ne(t),new Promise((i,s)=>{const a=document.createElement("canvas"),p=a.getContext("2d");if(!p){s(new Error("Could not get canvas context"));return}const l=new Image;l.crossOrigin="anonymous",l.onload=()=>{try{a.width=l.naturalWidth||t.naturalWidth||t.width||100,a.height=l.naturalHeight||t.naturalHeight||t.height||100,p.drawImage(l,0,0),i(a.toDataURL("image/png"))}catch(m){console.error("Error converting image to base64:",m),s(new Error("Failed to convert image to base64"))}},l.onerror=m=>{console.error("Error loading image:",m),s(new Error("Failed to load image"))},l.src=t.src}))}const ie=U.US_LETTER.width,ce=U.US_LETTER.height,$=(t,i)=>{const s=t.get(i);if(s===null)return 0;const a=Number.parseInt(s,10);return Number.isFinite(a)&&a>=0?a:0},I=t=>{const i=t.get("x-native-pages-fallback-kinds");if(!(t.get("x-native-pages-requested")!==null||t.get("x-native-pages-spliced")!==null||t.get("x-native-pages-fallback")!==null||i!==null))return null;const s=new Map;for(const p of(i??"").split(",")){const l=p.lastIndexOf(":");if(l<=0)continue;const m=p.slice(0,l).trim(),F=Number.parseInt(p.slice(l+1),10);!m||!Number.isFinite(F)||F<=0||s.set(m,(s.get(m)??0)+F)}let a=0;for(const p of s.values())a+=p;return{requested:$(t,"x-native-pages-requested"),spliced:$(t,"x-native-pages-spliced"),fallback:Math.max($(t,"x-native-pages-fallback"),a),fallbackKinds:Object.fromEntries(s)}},le=async t=>{const{pages:i,documentName:s,documentFont:a,componentColors:p,cssContainerClass:l,returnBlobOnly:m=!1,companyLogo:F,applyHeadingColors:de=!1,headerKonvaData:ue,footerKonvaData:pe,documentMargins:H,variableValues:me,onSpliceReport:k}=t;try{const d=i.map((r,o)=>document.getElementById(`page-${o+1}`));await ae(d);const c=new Array(i.length);await Promise.all(i.map(async(r,o)=>{const b=o+1,{width:C,height:O}=j(r),A=`<div style="width: ${C}px; height: ${O}px; background: white;"></div>`;if(!r){c[o]=A;return}const x=d[o];if(!x){c[o]=A;return}if(D(r)&&r.useFabric)try{const e=await X(x);c[o]=e.outerHTML}catch(e){if(S(e))throw e;console.error(`Failed to capture V2 canvas page ${b}:`,e),Q({error:e instanceof Error?e:new Error(String(e)),extra:{context:"exportPreviewToPdf.canvasPageCaptureFailed",pageNumber:b,reason:e instanceof Error?e.message:String(e)}}),c[o]=A}else if(D(r))try{c[o]=await Z(x,C,O,b)??A}catch(e){if(S(e))throw e;console.error(`Failed to capture canvas page ${b}:`,e),c[o]=A}else try{const e=x.cloneNode(!0);ee.forEach(n=>{e.querySelectorAll(n).forEach(g=>g.remove())}),e.querySelectorAll(".text-rich-display").forEach(n=>te(n));const P=Array.from(e.querySelectorAll("canvas:not(.upper-canvas)"));if(P.length>0){const n=Array.from(x.querySelectorAll("canvas:not(.upper-canvas)"));for(let g=0;g<P.length;g++){const E=P[g],u=n[g];if(u&&u.width>0&&u.height>0)try{const w=await re(u,{pixelRatio:4,quality:.98,skipHiddenText:!0});if(w&&typeof w=="string"){const h=document.createElement("img");h.src=w,h.style.width=`${u.style.width||u.width+"px"}`,h.style.height=`${u.style.height||u.height+"px"}`,h.style.display="block",h.style.margin="0",h.style.padding="0",h.style.border="0",h.style.imageRendering="-webkit-optimize-contrast";const q=E.parentElement;q&&q.replaceChild(h,E)}}catch(w){if(S(w))throw w;console.warn(`Failed to capture canvas ${g+1}:`,w)}}}const L=Array.from(e.querySelectorAll("img"));if(L.length>0){const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",g=L.map(async E=>{try{const u=await se(E);return E.src=u,!0}catch(u){return console.warn("Failed to convert image to base64, using placeholder:",u),E.src=n,!1}});await Promise.all(g)}e.querySelectorAll("[data-section-id]").forEach(n=>{n.removeAttribute("data-section-id"),n.removeAttribute("onmouseover"),n.removeAttribute("onmouseout"),n.removeAttribute("onclick")}),e.querySelectorAll('[data-page-break="true"], .page-break-marker').forEach(n=>n.remove()),e.querySelectorAll("canvas.upper-canvas").forEach(n=>n.remove()),a&&(e.style.fontFamily=a);let R=e.outerHTML;if(l){const n=a?`font-family: ${a};`:"";R=`<div class="${l}" style="${n}">${R}</div>`}c[o]=R}catch(e){if(S(e))throw e;console.error(`Failed to process HTML page ${b}:`,e),c[o]=A}})),i.forEach((r,o)=>{r!=null&&r.destAnchor&&c[o]&&(c[o]=`${W(r.destAnchor,r.destTitle??"")}${c[o]}`)});const{styles:B,customProperties:V}=await oe(a,p,H,c),{pageDimensions:N,nativePageSources:T}=z(i),K=JSON.stringify({styles:B,fontFamily:a||"system-ui, sans-serif",customProperties:V,dimensions:{width:ie,height:ce},documentName:s||"document",...N?{pageDimensions:N}:{},...T?{nativePageSources:T}:{}}),y=[],M=K.slice(0,-1);y.push(M+',"pages":[');for(let r=0;r<c.length;r++)r>0&&y.push(","),y.push(JSON.stringify(c[r])),c[r]="";y.push("]}");const _=new Blob(y,{type:"application/json"});y.length=0;const f=await J(`${Y}/document_builder/export/pdf`,{method:"POST",body:_});if(!f.ok){const r=await f.text().catch(()=>"Unknown error");throw console.error("PDF export failed:",{status:f.status,statusText:f.statusText,error:r}),new Error(`Failed to generate PDF: Server returned ${f.status} ${f.statusText}`)}k==null||k(I(f.headers));const v=await f.blob();if(!v)throw new Error("Failed to generate PDF: No data received from server");if(!(v instanceof Blob))throw new Error(`Failed to generate PDF: Invalid response format (received ${typeof v})`);if(v.size===0)throw new Error("Failed to generate PDF: Received empty file");if(!m){const r=window.URL.createObjectURL(v),o=document.createElement("a");o.href=r,o.download=`${s||"document"}.pdf`,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(r)}return v}catch(d){throw G(d)||(console.error("PDF export error:",d),((d==null?void 0:d.code)==="ERR_NETWORK"||(d==null?void 0:d.code)==="ECONNABORTED")&&console.error("Network/timeout error details:",{code:d.code,message:d.message,config:d.config})),d}};export{le as exportPreviewToPdf,I as parseSpliceReportHeaders};