@outmarket-ai/react-sdk 0.1.0-alpha.42 → 0.1.0-alpha.44
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.
- package/dist/{AddNoteDialog-BL3Sm6OJ.js → AddNoteDialog-Rscj7ywA.js} +1 -1
- package/dist/{AlertDialog-lKoY4zqF.js → AlertDialog-Ck74fY_i.js} +1 -1
- package/dist/{ApproveWorkflowsList-mQWijmI5.js → ApproveWorkflowsList-BBNYqKpI.js} +1 -1
- package/dist/{BORLetterEditor-D3Twq9i1.js → BORLetterEditor-C2LqJr3D.js} +1 -1
- package/dist/{BillDetailModal-DSfDC8Lu.js → BillDetailModal-CuUK6nzN.js} +1 -1
- package/dist/{CoiIssueHolderModal-BTMUf-JD.js → CoiIssueHolderModal-Dbnq42Eu.js} +1 -1
- package/dist/{ConfirmationDialog-0Kg3aMN2.js → ConfirmationDialog-B4AYtu2J.js} +1 -1
- package/dist/{DeletePromptDialog-DLyXSge-.js → DeletePromptDialog-fng618F8.js} +1 -1
- package/dist/{EmailFormatSelectionDialog-DxKpe40f.js → EmailFormatSelectionDialog-DGhQ-PFn.js} +1 -1
- package/dist/{ExcelExportPreviewDialog-S8On-Koy.js → ExcelExportPreviewDialog-BXBEArrD.js} +1 -1
- package/dist/{ExplainPanel-BrILcblJ.js → ExplainPanel-BoHpfWbO.js} +1 -1
- package/dist/{ExportDialog-DYt7AnX0.js → ExportDialog-C30TC7tR.js} +1 -1
- package/dist/{ExportToAmsDialog-DyjQCzym.js → ExportToAmsDialog-Qb3IvQLI.js} +1 -1
- package/dist/{ExportToDriveDialog-C-cE8ekD.js → ExportToDriveDialog-BR8ccBAm.js} +1 -1
- package/dist/{FeedbackTool-BtmP7rmt.js → FeedbackTool-BRLzVE1v.js} +1 -1
- package/dist/{LayerDetailModal-DbZKBxxq.js → LayerDetailModal-DIeS9rzn.js} +1 -1
- package/dist/{LogoEditor-B9DscT57.js → LogoEditor-BqVYEHx-.js} +1 -1
- package/dist/{MarkdownExportPreviewDialog-pupZK9Gg.js → MarkdownExportPreviewDialog-PsbyVK7k.js} +1 -1
- package/dist/{NotificationDrawer-81MmvOXU.js → NotificationDrawer-ClFQb63Q.js} +1 -1
- package/dist/{PhoneNumbersDisplay-DfML97T5.js → PhoneNumbersDisplay-CClGxi77.js} +1 -1
- package/dist/{PlanSelector-CPD4KBke.js → PlanSelector-DPkd9ovm.js} +1 -1
- package/dist/{PlanSettingsModal-HndBXQ7j.js → PlanSettingsModal-BiE6IndG.js} +1 -1
- package/dist/{PlanWizardModal-COUVeKuE.js → PlanWizardModal-D2T9m4oI.js} +1 -1
- package/dist/{RenameAssetDialog-BL89YOOo.js → RenameAssetDialog-DyTr1q9l.js} +1 -1
- package/dist/{SaveBlockDialog-D5VvMe9m.js → SaveBlockDialog-ChwTCWr4.js} +1 -1
- package/dist/{SaveOutlineDialog-GtcAQ-t-.js → SaveOutlineDialog-BBVesswr.js} +1 -1
- package/dist/{SavePromptDialog-Tu7mkM0N.js → SavePromptDialog-CmEVLt1d.js} +1 -1
- package/dist/{ShareResourceDialog-S4DIJBTQ.js → ShareResourceDialog-96Frvf7Y.js} +1 -1
- package/dist/{TermsNoticeModal-BfUykq5X.js → TermsNoticeModal-BCrp_mmB.js} +1 -1
- package/dist/{TowerAlertModal-CAzaojdq.js → TowerAlertModal-D0xn61mD.js} +1 -1
- package/dist/{TowerSummaryModal-BT82wKtb.js → TowerSummaryModal-BRXZTZG2.js} +1 -1
- package/dist/{VaultSettingsDialog-B3uNOwms.js → VaultSettingsDialog-CzmfRoYw.js} +1 -1
- package/dist/{ViewNoteDialog-C0UHO5B5.js → ViewNoteDialog-BE0P1gJZ.js} +1 -1
- package/dist/{WhatsNewProvider-BKweg2kz.js → WhatsNewProvider-DWvFlY6f.js} +1 -1
- package/dist/{WidgetRawDataView-BbXMlcZj.js → WidgetRawDataView-BhBH1MRV.js} +1 -1
- package/dist/{abap-BtjY2Gk1.js → abap-Bpa95KhE.js} +1 -1
- package/dist/{abnf-B0fILoGu.js → abnf-B2qSvJRy.js} +1 -1
- package/dist/{actionscript-BXThvhng.js → actionscript-yWjI6SzD.js} +1 -1
- package/dist/{activityLog-OVDNQxv9.js → activityLog-Cm65MpqN.js} +1 -1
- package/dist/{ada-C7SVMokY.js → ada-B0hIQwco.js} +1 -1
- package/dist/{agda-CEMTg3Vt.js → agda-DQVz7FOY.js} +1 -1
- package/dist/{al-B7R5iNPA.js → al-Bma_HYAy.js} +1 -1
- package/dist/{antlr4-Mdz3P2Th.js → antlr4-D3vn8H33.js} +1 -1
- package/dist/{apacheconf-Wf-qyzCe.js → apacheconf-kZIhI_Rh.js} +1 -1
- package/dist/{apex-C8bCOOoj.js → apex-DubT7IP7.js} +1 -1
- package/dist/{apl-Ce91TW6v.js → apl-Dfr9elW3.js} +1 -1
- package/dist/{applescript-Db4vyuRi.js → applescript-BYindlo8.js} +1 -1
- package/dist/{aql-CqEb__hU.js → aql-15GcbZWw.js} +1 -1
- package/dist/{arduino-Cy9he2uO.js → arduino-ByLLuVbQ.js} +1 -1
- package/dist/{arff-DSrtHEfk.js → arff-OPojJLUz.js} +1 -1
- package/dist/{asciidoc-DWG4qfhh.js → asciidoc-Cl2v4xvv.js} +1 -1
- package/dist/{asm6502-K0B0_cBY.js → asm6502-CB7yVfmz.js} +1 -1
- package/dist/{asmatmel-DoRzpnBr.js → asmatmel-K6Lx6ZK5.js} +1 -1
- package/dist/{aspnet-BEM0gW1x.js → aspnet-dBH1pcUx.js} +1 -1
- package/dist/{autohotkey-Dha62lh5.js → autohotkey-RXR1Zgc5.js} +1 -1
- package/dist/{autoit-BCEAlnC7.js → autoit-a4Owx7OM.js} +1 -1
- package/dist/{avisynth-Jg8tPEQk.js → avisynth-BGZMSyM2.js} +1 -1
- package/dist/{avro-idl-C_clRKB4.js → avro-idl-CeDTcckU.js} +1 -1
- package/dist/{bash-BMbPRzHq.js → bash-BRHXXDN_.js} +1 -1
- package/dist/{basic-O0yRjHi0.js → basic-agbCSM_c.js} +1 -1
- package/dist/{batch-C2z_4zCZ.js → batch-DJX2p8s2.js} +1 -1
- package/dist/{bbcode-BS86I4wH.js → bbcode-Pjt_r6Zw.js} +1 -1
- package/dist/{bell-aIz9WV3k.js → bell-BTslamVx.js} +1 -1
- package/dist/{bicep-CvVad-g7.js → bicep-6wBEPqE6.js} +1 -1
- package/dist/{birb-CQ044-Jz.js → birb-Dk8PWwZg.js} +1 -1
- package/dist/{bison-Dmz8jgi6.js → bison-DdgM5ASb.js} +1 -1
- package/dist/{blockEditorContent-CeFKrF1X.js → blockEditorContent-D_bHd1_J.js} +1 -1
- package/dist/{bnf-YuoozTJi.js → bnf-DqfD8DaA.js} +1 -1
- package/dist/{brainfuck-CFFdB3B6.js → brainfuck-N5wdszpE.js} +1 -1
- package/dist/{brightscript-BkWs_Kb6.js → brightscript-CXu0RZA8.js} +1 -1
- package/dist/{bro-DEHf0ivr.js → bro-Dz5ORgap.js} +1 -1
- package/dist/{bsl-c-E5LNZ4.js → bsl-BJlP8tfn.js} +1 -1
- package/dist/{c-DTpMZoLM.js → c-CuTIIDgr.js} +1 -1
- package/dist/{calendar-DjTrBUeX.js → calendar-COOOT1Ui.js} +1 -1
- package/dist/{cfscript-D_JrroiU.js → cfscript-PRhCDM21.js} +1 -1
- package/dist/{chaiscript-mUb-Edz3.js → chaiscript-B2XOntND.js} +1 -1
- package/dist/{cil-CHKFeGC_.js → cil-C5RRTuzk.js} +1 -1
- package/dist/{clike-Bd59oN2L.js → clike-DGwSB17e.js} +1 -1
- package/dist/{clojure-BX3YBmoM.js → clojure-DbD5dPEE.js} +1 -1
- package/dist/{cmake-CGoFFQCc.js → cmake-CqRykLp2.js} +1 -1
- package/dist/{cobol-Dz_6eOgB.js → cobol-Ccv66ygs.js} +1 -1
- package/dist/{coffeescript-Cn7sq8hK.js → coffeescript-PLHWfrJQ.js} +1 -1
- package/dist/{concurnas-DYLH81MD.js → concurnas-BMrKYohj.js} +1 -1
- package/dist/{contactsList-Ch5jeUOH.js → contactsList-BdZBuEO-.js} +2 -2
- package/dist/{copyPreviewToClipboard-40XmsWIt.js → copyPreviewToClipboard-D1EGxfqs.js} +1 -1
- package/dist/{coq-BoZmm6jd.js → coq-CCpuVc4x.js} +1 -1
- package/dist/{core-CHi0Wgxd.js → core-BA0hq8VL.js} +1 -1
- package/dist/{cpp-Bo3aCvZF.js → cpp-CWetzYsY.js} +1 -1
- package/dist/{crystal-4_sRgnve.js → crystal-BKjZToZI.js} +1 -1
- package/dist/{csharp-6ejhOgy6.js → csharp-BHdPnIXZ.js} +1 -1
- package/dist/{cshtml-Cu4TSb8e.js → cshtml-BhdbtnUu.js} +1 -1
- package/dist/{csp-hoP4N6kc.js → csp-BXWZvhkd.js} +1 -1
- package/dist/{css-Bh_rQWpe.js → css-DdJYCXrX.js} +1 -1
- package/dist/{css-extras-hq-nbKqC.js → css-extras-CPU90kpm.js} +1 -1
- package/dist/{csv-w_RzKwzg.js → csv-D0K9ZLzY.js} +1 -1
- package/dist/{cypher-CXcZZ638.js → cypher-K4ksHWPK.js} +1 -1
- package/dist/{d-D1EymN-G.js → d-DYMp_Wuk.js} +1 -1
- package/dist/{dart-o0IybdTB.js → dart-CmjMK4z3.js} +1 -1
- package/dist/{dataweave-VMX-HA42.js → dataweave-CAJNqvFu.js} +1 -1
- package/dist/{dax-BeL_8Pwa.js → dax-iIP-NSas.js} +1 -1
- package/dist/{dhall-DZQL2FWS.js → dhall-CQ6lAxSG.js} +1 -1
- package/dist/{diff-C9l6tswX.js → diff-C9RdrWEd.js} +1 -1
- package/dist/{django-Dc13FvEf.js → django-D32Qg_Dz.js} +1 -1
- package/dist/{dns-zone-file-DhrLt8yp.js → dns-zone-file-Be9O0pFj.js} +1 -1
- package/dist/{docker-BfA7UHoW.js → docker-D8w5V8hf.js} +1 -1
- package/dist/{dot-lWCSYl2-.js → dot-BMDzcO4Q.js} +1 -1
- package/dist/{ebnf-8Xlol4f5.js → ebnf-C7OTCtDH.js} +1 -1
- package/dist/{editCarrierDialog-CYwSD2CU.js → editCarrierDialog-C3LLoIri.js} +1 -1
- package/dist/{editorconfig-Cqu067CN.js → editorconfig-qppn9AA4.js} +1 -1
- package/dist/{eiffel-Oo1iBMLY.js → eiffel-BkhN1ai7.js} +1 -1
- package/dist/{ejs-CpbusCpG.js → ejs-CkBbijWp.js} +1 -1
- package/dist/{elixir-DVFXIudR.js → elixir-C5r70aeL.js} +1 -1
- package/dist/{elm-BkaS52P3.js → elm-CT45-ZSY.js} +1 -1
- package/dist/{erb-BNXxGChw.js → erb-CkhfnYKi.js} +1 -1
- package/dist/{erlang-Bjs0A22T.js → erlang-DGDEI4cI.js} +1 -1
- package/dist/{etlua-C9hLbPK3.js → etlua-BxRQuWCi.js} +1 -1
- package/dist/{excel-formula-CgqBNjVP.js → excel-formula-DBI78Wpo.js} +1 -1
- package/dist/{exportFileGeneration-Dv_Z_77N.js → exportFileGeneration-jv6-MI8B.js} +1 -1
- package/dist/{exportImageReadiness-BoevQPa1.js → exportImageReadiness-CDj5qZi9.js} +1 -1
- package/dist/{exportImageReadinessNotifier-p2fx6KU3.js → exportImageReadinessNotifier-CeLSrlmS.js} +1 -1
- package/dist/{exportPageHtml-CRCK_zW3.js → exportPageHtml-YIUR3iCw.js} +1 -1
- package/dist/{exportPreviewToDocx-g0iBOyj3.js → exportPreviewToDocx-BZYEefQ4.js} +2 -2
- package/dist/{exportPreviewToPdf-kvHmpSxI.js → exportPreviewToPdf-DaXjpfml.js} +1 -1
- package/dist/{factor-D0qzGXW4.js → factor-DW-YbHRy.js} +1 -1
- package/dist/{false-BHFommOp.js → false-CIwoK_bp.js} +1 -1
- package/dist/{firestore-security-rules-SYUDSFd3.js → firestore-security-rules-DbQNYCYQ.js} +1 -1
- package/dist/{flask-conical-BlcQC1Xz.js → flask-conical-Da3wtJcE.js} +1 -1
- package/dist/{flow-8FOc49ra.js → flow-Cn0-1PK0.js} +1 -1
- package/dist/{fortran-B0xhoYas.js → fortran-BsEXgIqG.js} +1 -1
- package/dist/{fsharp-CrWKUTyq.js → fsharp-C2bO32k2.js} +1 -1
- package/dist/{ftl-B85yYWNH.js → ftl-CLSjhWQn.js} +1 -1
- package/dist/{gap-BAd1PC_H.js → gap-CBZ8TbG9.js} +1 -1
- package/dist/{gcode-5oUcHyKp.js → gcode-BIGw5Zoj.js} +1 -1
- package/dist/{gdscript-BElLqSyR.js → gdscript-DRDBJ-b6.js} +1 -1
- package/dist/{gedcom-BsJOhe4e.js → gedcom-BQf-XBul.js} +1 -1
- package/dist/{gherkin-BMDQzdau.js → gherkin-CYc6Amj6.js} +1 -1
- package/dist/{git-CCqawO3N.js → git-KgBaBS5O.js} +1 -1
- package/dist/{glsl-CUfT16WJ.js → glsl-DHJk6hAC.js} +1 -1
- package/dist/{gml-Cpqx_xus.js → gml-dadmAxnP.js} +1 -1
- package/dist/{gn-PCN8R7tz.js → gn-CfvXXPul.js} +1 -1
- package/dist/{go-D7fNfqWp.js → go-ByoRUu_w.js} +1 -1
- package/dist/{go-module-CN5KAF4L.js → go-module-ClzLogu-.js} +1 -1
- package/dist/{graphql-BdFDmBWC.js → graphql-BOymJWDj.js} +1 -1
- package/dist/{groovy-DiKbwTj3.js → groovy-CHqHkjta.js} +1 -1
- package/dist/{haml-Dw0ct3tF.js → haml-B6GJtQk2.js} +1 -1
- package/dist/{handlebars-DYLjH1Q0.js → handlebars-AuAgc0-f.js} +1 -1
- package/dist/{haskell-CMK-RJPf.js → haskell-DXnJEJus.js} +1 -1
- package/dist/{haxe-DFGWbV9g.js → haxe-D8E0QiBV.js} +1 -1
- package/dist/{hcl-CTCwCJJv.js → hcl-CpHiQfcO.js} +1 -1
- package/dist/{highlighter-7ZESWI1X.js → highlighter-DAPZ5ZEj.js} +1 -1
- package/dist/{hlsl-Dw1SKlHX.js → hlsl-DYsPT6yo.js} +1 -1
- package/dist/{hoon-BCq8820T.js → hoon-Drd_pk4j.js} +1 -1
- package/dist/{hpkp-CGr_XWMR.js → hpkp-DSLiy4_v.js} +1 -1
- package/dist/{hsts-VFGy3fr3.js → hsts-B_PKsKHu.js} +1 -1
- package/dist/{http-CuuPEC3E.js → http-Cf1M5FbK.js} +1 -1
- package/dist/{ichigojam-DWwrKSnc.js → ichigojam-BrObYT8Z.js} +1 -1
- package/dist/{icon-COoNwJnS.js → icon-C3S0RIlo.js} +1 -1
- package/dist/{icu-message-format-Cg46kuX5.js → icu-message-format-Cf5Qt4s1.js} +1 -1
- package/dist/{idris-Dxs2dA_2.js → idris-CXLbI--J.js} +1 -1
- package/dist/{iecst-9G10M9pe.js → iecst-QPbbIddO.js} +1 -1
- package/dist/{ignore-CuTF7tsd.js → ignore-Drp6REDq.js} +1 -1
- package/dist/{image-plus-FNz0ZnSz.js → image-plus-BcyqmHS0.js} +1 -1
- package/dist/{index-Dft2yzO4.js → index-C0Gkblqe.js} +1 -1
- package/dist/{index-DDBLkod5.js → index-CBlf4ZHC.js} +1 -1
- package/dist/{index-BR36r3TL.js → index-CSAs9f_t.js} +1 -1
- package/dist/{index-QozruD8V.js → index-CYwSz9D6.js} +1 -1
- package/dist/index-Cby4FZtk.js +1 -0
- package/dist/{index-Cu1GLvQ4.js → index-DNmsYMzw.js} +1 -1
- package/dist/{index-REErRU-p.js → index-DwvbZ9qn.js} +1 -1
- package/dist/{index.client-DnYTdAFV.js → index.client-BJx0ctif.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inform7-D-ymq8Bt.js → inform7-BACjKVvp.js} +1 -1
- package/dist/{ini-B5jcGlhM.js → ini-DjEl7XDu.js} +1 -1
- package/dist/{io-BvYj-LAB.js → io-BgTCr5Ol.js} +1 -1
- package/dist/{j-BfhmYaPX.js → j-bKl98o4i.js} +1 -1
- package/dist/{java-CS4dnM2E.js → java-Dd1qQPUu.js} +1 -1
- package/dist/{javadoc-BauB4kTg.js → javadoc-Cjg7_vYe.js} +1 -1
- package/dist/{javadoclike-BMmEUVhv.js → javadoclike-BCcCNpHL.js} +1 -1
- package/dist/{javascript-6McBPi8B.js → javascript-DqPXVYkL.js} +1 -1
- package/dist/{javastacktrace-59IBZvQt.js → javastacktrace-9TWEhEcV.js} +1 -1
- package/dist/{jexl-BFP2KXwK.js → jexl-KD77OyKm.js} +1 -1
- package/dist/{jolie-DNAF57RN.js → jolie-DSjytNuc.js} +1 -1
- package/dist/{jq-B8P4tJGj.js → jq-BXF3-PqX.js} +1 -1
- package/dist/{js-extras-Cku-44De.js → js-extras-Bpy1yDzs.js} +1 -1
- package/dist/{js-templates-C1ZiV0f4.js → js-templates-Nl3vE30e.js} +1 -1
- package/dist/{jsdoc-D-_h4xSG.js → jsdoc-D6QQrQYo.js} +1 -1
- package/dist/{json-DIaB0_R6.js → json-B3GCDKdg.js} +1 -1
- package/dist/{json5-C8PPw3mR.js → json5-D_-69nn_.js} +1 -1
- package/dist/{jsonp-DMJl-nX0.js → jsonp-JcAa3C4I.js} +1 -1
- package/dist/{jsstacktrace-D7IZ4iSV.js → jsstacktrace-D9GmUGI4.js} +1 -1
- package/dist/{jsx-S98-1sIz.js → jsx-BNLUlg-T.js} +1 -1
- package/dist/{julia-C1YdZLu0.js → julia-O4TTvxpe.js} +1 -1
- package/dist/{keepalived-DcTsjyMv.js → keepalived-DnHZTPB6.js} +1 -1
- package/dist/{keyman-B68L4-qz.js → keyman-DTcchL5f.js} +1 -1
- package/dist/{kotlin-B5-Rx1mc.js → kotlin-CCK89SI-.js} +1 -1
- package/dist/{kumir-Cd9erQvc.js → kumir-ecs2TNgC.js} +1 -1
- package/dist/{kusto-lF8EagBv.js → kusto-0MwyroVg.js} +1 -1
- package/dist/{latex-xoe9qirG.js → latex-CXlebZd6.js} +1 -1
- package/dist/{latte-CMdvy035.js → latte-B-m2aQBk.js} +1 -1
- package/dist/{less-tJSbzFHS.js → less-D57oMxoB.js} +1 -1
- package/dist/{lilypond-DJBUWHzH.js → lilypond-4ugjbXbl.js} +1 -1
- package/dist/{link-2-off-8fV2ekju.js → link-2-off-Ca2lgyZa.js} +1 -1
- package/dist/{liquid-oVQvB8Wr.js → liquid-CrgrRg9C.js} +1 -1
- package/dist/{lisp-D5CwkZcC.js → lisp-DXIUy7zh.js} +1 -1
- package/dist/{livescript-BuW6EwkD.js → livescript-aHUKAE2I.js} +1 -1
- package/dist/{llvm-yNRd_LeP.js → llvm-CPeVTDR4.js} +1 -1
- package/dist/{lock-keyhole-CyldMnli.js → lock-keyhole-uMCobyq9.js} +1 -1
- package/dist/{log-JQbqLdLk.js → log-M9-gwZMd.js} +1 -1
- package/dist/{lolcode-DID_7JBn.js → lolcode-C0TXGyuZ.js} +1 -1
- package/dist/{lua-C3VgwKZV.js → lua-DcdvB7SD.js} +1 -1
- package/dist/{lucide-react-Bq8c72fE.js → lucide-react-Cb6uZUCM.js} +1 -1
- package/dist/{luckyexcel.umd-BjBylUr7.js → luckyexcel.umd-CMJ-jTWA.js} +1 -1
- package/dist/{magma-lt-cstNb.js → magma-CbuALZN6.js} +1 -1
- package/dist/{makefile-DoMhsJeA.js → makefile-Ctl2m72g.js} +1 -1
- package/dist/{markdown-BacVqRMt.js → markdown-BBB83qSM.js} +1 -1
- package/dist/{markup-B2FVwcMg.js → markup-ChaAbQEE.js} +1 -1
- package/dist/{markup-templating-C_ouWVlp.js → markup-templating-BC6zTNOf.js} +1 -1
- package/dist/{matlab-BhiBixSs.js → matlab-BV4wZqtC.js} +1 -1
- package/dist/{maxscript-EiqQoVWO.js → maxscript-BeGQh6fd.js} +1 -1
- package/dist/{mel-B5OfW7xQ.js → mel-CkXjXFiq.js} +1 -1
- package/dist/{mermaid-BpKLJGMO.js → mermaid-DTn-xMIg.js} +1 -1
- package/dist/{mizar-Dvvj7mq_.js → mizar-B5G36J76.js} +1 -1
- package/dist/{mongodb-Bv8Wcm7Y.js → mongodb-pzXK78PB.js} +1 -1
- package/dist/{monkey-D_sgNiA6.js → monkey-D0Okz-Hv.js} +1 -1
- package/dist/{moonscript-BnVRa5so.js → moonscript-hZPS2rnh.js} +1 -1
- package/dist/{n1ql-bPu1PMrT.js → n1ql-i590EfVo.js} +1 -1
- package/dist/{n4js-B5ExWQra.js → n4js-Bm2BOb-b.js} +1 -1
- package/dist/{nand2tetris-hdl-DCeQuBS-.js → nand2tetris-hdl-otzVnETn.js} +1 -1
- package/dist/{naniscript-COW9TL_e.js → naniscript-DXuKBlLb.js} +1 -1
- package/dist/{nasm-D6RaNR50.js → nasm-CYm5PYml.js} +1 -1
- package/dist/{neon-BijhfX6B.js → neon-Bo6tY83f.js} +1 -1
- package/dist/{nevod-dQ-WkV3Q.js → nevod-Gcs2A1zm.js} +1 -1
- package/dist/{nginx-C0hQyazg.js → nginx-DEoE4eVH.js} +1 -1
- package/dist/{nim-DXekxnzx.js → nim-TdrtAfLM.js} +1 -1
- package/dist/{nix-DBR3ERDQ.js → nix-DmcVWv_a.js} +1 -1
- package/dist/{nsis-BcQ6nEGD.js → nsis-PBw8jCEI.js} +1 -1
- package/dist/{objectivec-C6wC3eAi.js → objectivec-qbUbr2e8.js} +1 -1
- package/dist/{ocaml-b2yKGH9o.js → ocaml-DN65ghCF.js} +1 -1
- package/dist/{opencl-CIFgJt0P.js → opencl-Bp2scBGb.js} +1 -1
- package/dist/{openqasm-C9yx2bUM.js → openqasm-DiYNdKZA.js} +1 -1
- package/dist/{oz-DzGW6ITm.js → oz-CfCCMcrx.js} +1 -1
- package/dist/{paintbrush-DTuHCM_m.js → paintbrush-D27bg9DR.js} +1 -1
- package/dist/{parigp-G3lSQw9K.js → parigp-Dbi-TagY.js} +1 -1
- package/dist/{parser-B2ogcFjD.js → parser-Df90cPRN.js} +1 -1
- package/dist/{pascal-Bkjx6VZd.js → pascal-8FyaRBQi.js} +1 -1
- package/dist/{pascaligo-CMZVuBYU.js → pascaligo-z2M6k-2Q.js} +1 -1
- package/dist/{pcaxis-BwYEsd3J.js → pcaxis-CRBcuDL7.js} +1 -1
- package/dist/{pen-tool-D02kRNyt.js → pen-tool-uVg30dx-.js} +1 -1
- package/dist/{peoplecode-DxkNwFOY.js → peoplecode-eoVCpjRQ.js} +1 -1
- package/dist/{perl-D4LbFyq2.js → perl-CTl4omd_.js} +1 -1
- package/dist/{php-BcW58FIc.js → php-DC6ow60x.js} +1 -1
- package/dist/{php-extras-ChOBfD-8.js → php-extras-Dwhm3AVj.js} +1 -1
- package/dist/{phpdoc-lrCTBQZr.js → phpdoc-B5RIivBB.js} +1 -1
- package/dist/{plsql-1rlVyAEu.js → plsql-DASNBsn8.js} +1 -1
- package/dist/{plyr-Dlh2LrbR.js → plyr-Ce5vKEUV.js} +1 -1
- package/dist/{powerquery-Bx73HKMU.js → powerquery-DdnoovHd.js} +1 -1
- package/dist/{powershell-dKeJ_IGt.js → powershell-yqxKLKdg.js} +1 -1
- package/dist/{processing-aDvykLV8.js → processing-CAPvkmLV.js} +1 -1
- package/dist/{prolog-Bre7RdDy.js → prolog-B6cfhgQo.js} +1 -1
- package/dist/{promql-Byf9K1iz.js → promql-DCw0LI19.js} +1 -1
- package/dist/{properties-Cs8aJvIJ.js → properties-meXDNQgv.js} +1 -1
- package/dist/{protobuf-B_9dls1V.js → protobuf-fkTMKSyY.js} +1 -1
- package/dist/{psl-BNANlWfV.js → psl-DZPPYzVM.js} +1 -1
- package/dist/{pug-BXokMJLM.js → pug-518ifITl.js} +1 -1
- package/dist/{puppet-CrHH2b2q.js → puppet-s2x78VFh.js} +1 -1
- package/dist/{pure-C5UCsCVI.js → pure-DpzUWVMd.js} +1 -1
- package/dist/{purebasic-CvZKWVM-.js → purebasic-lpyyjWMT.js} +1 -1
- package/dist/{purescript-D1da5Ald.js → purescript-DRPDJYKO.js} +1 -1
- package/dist/{python-CYIJDWTd.js → python-DdiRRIKn.js} +1 -1
- package/dist/{q-DkD0lTyE.js → q-C5Y_0UoU.js} +1 -1
- package/dist/{qml-D-3OTrTl.js → qml-BGfSJxxc.js} +1 -1
- package/dist/{qore-sQ9Hdgyw.js → qore-CYzA0gog.js} +1 -1
- package/dist/{qsharp-Dfc8KAzv.js → qsharp-NJOrkaw5.js} +1 -1
- package/dist/{quill-D4H5XIiV.js → quill-CgGppInx.js} +1 -1
- package/dist/{r-CJJWrv-L.js → r-GRt27eZV.js} +1 -1
- package/dist/{racket-D3oHj5fW.js → racket-D8g6_6bU.js} +1 -1
- package/dist/{reason-Q-VIQKk1.js → reason-BQg_azTe.js} +1 -1
- package/dist/{regex-Bwyw-L38.js → regex-CLnGg2F9.js} +1 -1
- package/dist/{rego-BbDScrhh.js → rego-B_vKrfdB.js} +1 -1
- package/dist/{renpy-BfJKitfO.js → renpy-C-gLQSc-.js} +1 -1
- package/dist/{rest-Ce79jxn0.js → rest-DC51IBzb.js} +1 -1
- package/dist/{rip-Bej-SOfd.js → rip-CiK5FgGO.js} +1 -1
- package/dist/{roboconf-C9iVJI0J.js → roboconf-DvqYNykk.js} +1 -1
- package/dist/{robotframework-rGeHQVwa.js → robotframework-DNhOUpTF.js} +1 -1
- package/dist/{ruby-iYE3SDbU.js → ruby-DBIMJkdP.js} +1 -1
- package/dist/{runtime-BZPovGQX.js → runtime-BifHPIs0.js} +101 -101
- package/dist/{rust-CfI7l1ML.js → rust-mLfW4Jis.js} +1 -1
- package/dist/{sas-sslOwRD1.js → sas-DodITxZ6.js} +1 -1
- package/dist/{sass-BlGOUIwG.js → sass-BSLEX7Yz.js} +1 -1
- package/dist/{scala-DYQKNXXC.js → scala-DCO-Xgiy.js} +1 -1
- package/dist/{scheme-DiWMArjj.js → scheme-B80QclYj.js} +1 -1
- package/dist/{scss-DdfuXwm3.js → scss-BcSMUf22.js} +1 -1
- package/dist/{shell-session-bdnS7ruo.js → shell-session-C59QXsqi.js} +1 -1
- package/dist/{smali-DgvEjt7a.js → smali-FbC4U8-2.js} +1 -1
- package/dist/{smalltalk-DcHT2rn4.js → smalltalk-DGhaYsG5.js} +1 -1
- package/dist/{smarty-FN5NJFKy.js → smarty-BBvzKP8A.js} +1 -1
- package/dist/{sml-C9QJAl4v.js → sml-CFNJ4sWx.js} +1 -1
- package/dist/{solidity-0l9B6-nR.js → solidity-C4SkB9lJ.js} +1 -1
- package/dist/{solution-file-DLj0nRVA.js → solution-file-CIOXRDPU.js} +1 -1
- package/dist/{soy-BBR8awYJ.js → soy-B0QWMSsQ.js} +1 -1
- package/dist/{sparql-C7L9EFit.js → sparql-B1emdHxl.js} +1 -1
- package/dist/{splunk-spl-Drow-3Da.js → splunk-spl-BQT5CpVn.js} +1 -1
- package/dist/{sqf-BaIw8PT3.js → sqf-COJ36VWV.js} +1 -1
- package/dist/{sql-t_NwcXfz.js → sql-Cm6Rxm3F.js} +1 -1
- package/dist/{squirrel-JSpHua9M.js → squirrel-BvbuDiB5.js} +1 -1
- package/dist/{stan-BTzdW2t3.js → stan-8SccDLeL.js} +1 -1
- package/dist/styles.css +1 -1
- package/dist/{stylus-RA_3v-LB.js → stylus-BXIkN-mU.js} +1 -1
- package/dist/{swift-DQq88ffU.js → swift-Bfnd6xcE.js} +1 -1
- package/dist/{systemd-BQnVQWRV.js → systemd-DlB6VQpH.js} +1 -1
- package/dist/{t4-cs-Bblul3h5.js → t4-cs-C1jMgzWz.js} +1 -1
- package/dist/{t4-templating-DAok_hJC.js → t4-templating-D6Zr_zsI.js} +1 -1
- package/dist/{t4-vb-D53wHxbS.js → t4-vb-Bq71PqzO.js} +1 -1
- package/dist/{table-C1VKWO_j.js → table-CPrbaW5I.js} +1 -1
- package/dist/{tap-BFZMxvss.js → tap-DyR67KdS.js} +1 -1
- package/dist/{tcl-DCUCGJuR.js → tcl-DJgbJar5.js} +1 -1
- package/dist/{templateSelectorDialog-BRmj60Du.js → templateSelectorDialog-BNvjBhpq.js} +2 -2
- package/dist/{textile-D0TjRItH.js → textile-CPVNLoud.js} +1 -1
- package/dist/{toml-PqOLjnTj.js → toml-DmBxHMBz.js} +1 -1
- package/dist/{tremor-Cm_0Gx5s.js → tremor-DnT0QtrJ.js} +1 -1
- package/dist/{tsx-DBZ13Lhy.js → tsx-DASGNI4o.js} +1 -1
- package/dist/{tt2-DX5b2ZB1.js → tt2-KkSOzlcQ.js} +1 -1
- package/dist/{turtle-CV53cLP4.js → turtle-Bou6NsTX.js} +1 -1
- package/dist/{twig-CWKiQyhn.js → twig-DBuvt9EN.js} +1 -1
- package/dist/{typescript-BkIb5kbg.js → typescript-DtZbZDta.js} +1 -1
- package/dist/{typoscript-DJ-HtpUv.js → typoscript-CKxngJhN.js} +1 -1
- package/dist/{unrealscript-CXdpgqgm.js → unrealscript-CBOTq3tc.js} +1 -1
- package/dist/{uorazor-Bg2ZRLMr.js → uorazor-DPCvYi6m.js} +1 -1
- package/dist/{uri-DifYmE6B.js → uri-BQgLu96d.js} +1 -1
- package/dist/{usePromptLibraryMutations-gEFMJU6N.js → usePromptLibraryMutations-8U9vDhzf.js} +1 -1
- package/dist/{useSupabaseBlobUrl-B3Ufzeil.js → useSupabaseBlobUrl-DrqlnXWA.js} +1 -1
- package/dist/{useTermsNotice-AVSbxqpq.js → useTermsNotice-CkE_Q5Tp.js} +1 -1
- package/dist/{user-plus-B2OFYwVz.js → user-plus-4IThLzWj.js} +1 -1
- package/dist/{user-round-plus-Pv9Y8TjN.js → user-round-plus-CLd-3D3w.js} +1 -1
- package/dist/{v-Bpb_o-Fj.js → v-CpbsHXeZ.js} +1 -1
- package/dist/{vala-CeIQ35dO.js → vala-BHVtC0lQ.js} +1 -1
- package/dist/{vbnet-BXmEUFcL.js → vbnet-uysrqtli.js} +1 -1
- package/dist/{velocity-C-8BBlDc.js → velocity-D_kHHfYP.js} +1 -1
- package/dist/{verilog-yUrCA172.js → verilog-UzNA6NFZ.js} +1 -1
- package/dist/{vhdl-BOb0epZ4.js → vhdl-C5EKOU92.js} +1 -1
- package/dist/{vim-xfDOXNIX.js → vim-B2VGKk7h.js} +1 -1
- package/dist/{visual-basic-D9PTzTAa.js → visual-basic-4WOV357e.js} +1 -1
- package/dist/{warpscript-DtZbP8O-.js → warpscript-DpaRP7Xh.js} +1 -1
- package/dist/{wasm-jWeJ6aCO.js → wasm-CykGgr5f.js} +1 -1
- package/dist/{web-idl-VEEcg4z4.js → web-idl-C2TZZI4F.js} +1 -1
- package/dist/{wiki-CTL4WqDq.js → wiki-CE9RoQN4.js} +1 -1
- package/dist/{wolfram-B7YGtYZl.js → wolfram-CoSA8VPo.js} +1 -1
- package/dist/{wren-BootWn8l.js → wren-DC5-ldaC.js} +1 -1
- package/dist/{xeora-DtI_6jtb.js → xeora-BYrkBqgs.js} +1 -1
- package/dist/{xml-doc-DuHejg1Z.js → xml-doc-6JSg6fqu.js} +1 -1
- package/dist/{xojo--KSB90m9.js → xojo-CdLVgTt3.js} +1 -1
- package/dist/{xquery-CGYw7xk3.js → xquery-kWK0GIxx.js} +1 -1
- package/dist/{yaml-DCghmV5z.js → yaml-CH2rnZTp.js} +1 -1
- package/dist/{yang-D50DnKJe.js → yang-JPmPQYEP.js} +1 -1
- package/dist/{zig-DTPiGNZM.js → zig-BHP1XdGd.js} +1 -1
- package/package.json +2 -2
- package/dist/index-BAHu38SP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dw as g}from"./runtime-
|
|
1
|
+
import{dw as g}from"./runtime-BifHPIs0.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{dw as d}from"./runtime-
|
|
1
|
+
import{dw as d}from"./runtime-BifHPIs0.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{dw as f}from"./runtime-
|
|
1
|
+
import{dw as f}from"./runtime-BifHPIs0.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{dw as u}from"./runtime-
|
|
1
|
+
import{dw as u}from"./runtime-BifHPIs0.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{d3 as o,d4 as t}from"./runtime-
|
|
1
|
+
import{d3 as o,d4 as t}from"./runtime-BifHPIs0.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{dR as v,dS as R,dT as h,dU as p,dV as E,dW as T,dX as O,dY as W,dZ as A}from"./runtime-
|
|
1
|
+
import{dR as v,dS as R,dT as h,dU as p,dV as E,dW as T,dX as O,dY as W,dZ as A}from"./runtime-BifHPIs0.js";import{d_ as B,d$ as P,e0 as D,d2 as $,dN as F}from"./runtime-BifHPIs0.js";function H(){let n;const e=()=>(n??(n=import("./exportImageReadinessNotifier-CeLSrlmS.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-BJx0ctif.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??A,reportTrackerBoundHit:e.reportTrackerBoundHit??(a=>L(a,w)),subscribeTracker:e.subscribeTracker??W,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())},N=()=>f(new T),c=()=>{if(!g)try{const r=p(n,e.collectCanvasState),d=r.pending.length+r.loadingImgCount,S=d+r.loadingMarkerCount,l=e.getTrackerCount(),k=l>0&&!I;if(S===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,N)}catch(r){f(r instanceof Error?r:new Error(String(r)))}},_=setInterval(c,a);i.push(()=>clearInterval(_));const y=setTimeout(()=>{C=!0,c()},t);i.push(()=>clearTimeout(y));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)=>O(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{B as EXPORT_IMAGE_LOADING_ATTR,P 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};
|
package/dist/{exportImageReadinessNotifier-p2fx6KU3.js → exportImageReadinessNotifier-CeLSrlmS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as u}from"react/jsx-runtime";import{createRoot as f}from"react-dom/client";import{cu as g,dz as h,dA as x}from"./runtime-
|
|
1
|
+
import{jsx as u}from"react/jsx-runtime";import{createRoot as f}from"react-dom/client";import{cu as g,dz as h,dA as x}from"./runtime-BifHPIs0.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 y(){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{y as createToastExportReadinessNotifier,m as describeFailed,d as describeWaiting,r as formatImageNames};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{assertCanvasImagesSettled as $}from"./exportImageReadiness-
|
|
1
|
+
import{assertCanvasImagesSettled as $}from"./exportImageReadiness-CDj5qZi9.js";import{eK as B,dT as D,d$ as k,eL as w,eM as M,eN as K}from"./runtime-BifHPIs0.js";function O(t){return t&&t.length>0?new Set(t):null}async function U(t){return(await import("./runtime-BifHPIs0.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 _(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 W(t){for(const e of t)e.node.visible(e.visible)}function G(t,e,n,i){const o=O(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 J=300;function V(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=V(t);return e>0&&e<=J}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?G(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 P(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 A(t,e={}){const{pixelRatio:n=4,quality:i=.98,format:o="dataUrl",skipHiddenText:a=!1,hideObjectIds:r,hiddenObjectIdSink:l}=e,c=await U(t);if(!c){const h=Y(t);if(h){const p=P(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 _(c);const u=c.find("Text"),f=[],d=[];let s=null;try{const h=O(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])}),W(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`),t.style.setProperty("text-rendering","geometricPrecision")}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 A(c,{pixelRatio:n,quality:i,format:o,skipHiddenText:a,hideObjectIds:r,hiddenObjectIdSink:l});if(f)return f}const u=P(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 T(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 R=[".page-actions-bar",".page-action-btn",".margin-indicators","[data-fabric-canvas-placeholder]"],ot="objId";async function at(t,e={}){if(t.querySelector(`[${k}="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 T(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);R.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(/"/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(`[${k}="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 T(t);const c=await A(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{hP as po,hQ as rn,hR as we,hS as mo,hT as xo,hU as bo,hV as yo,hW as Et,hX as wo,hY as vo,hZ as Me,h_ as oe,h$ as He,i0 as Tt,i1 as Po,i2 as on,i3 as At,i4 as Eo,i5 as R,i6 as q,i7 as H,i8 as an,i9 as ln,ia as De,ib as To,ic as Ao,id as So,ie as X,ig as Co,ih as No,ii as St,ij as Fo,ik as Mo,il as $e,im as $o,io as sn,ip as Io,iq as Oo,dQ as Se,cI as Lo,ir as cn,is as ko,it as Ct,iu as Ro,iv as un,iw as Ho,ix as Do,iy as zo,iz as Bo,iA as jo,iB as dn,iC as Wo,iD as Uo,iE as _o,iF as qo,bY as fn,d2 as hn,eK as Go,dM as it,iG as Xo,iH as Yo,iI as Vo,dN as Nt,eL as at,eM as ze,iJ as pe,iK as gn,iL as pn,iM as Ko,iN as Ft,iO as Jo,iP as Zo,iQ as Qo,iR as mn,dL as ei}from"./runtime-BZPovGQX.js";import{e as Mt,d as ti,b as xn,a as ni,f as bn}from"./exportPageHtml-CRCK_zW3.js";import"react";import{awaitExportImagesReady as ri}from"./exportImageReadiness-BoevQPa1.js";function oi(e,t){const n=typeof e=="string"?e:new XMLSerializer().serializeToString(e),r=t.scale,o=Math.max(1,Math.round(t.width*r)),i=Math.max(1,Math.round(t.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 yn(e){return e.length>=4&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"png":e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?"jpg":e.length>=4&&e[0]===71&&e[1]===73&&e[2]===70&&e[3]===56?"gif":e.length>=2&&e[0]===66&&e[1]===77?"bmp":e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?"webp":null}const Ze=(e,t)=>e>0&&t>0?{width:e,height:t}:null,ii=[196,200,204],ai=218,li=e=>e>=192&&e<=207&&!ii.includes(e);function si(e){let t=2;for(;t+9<=e.byteLength;){if(e.getUint8(t)!==255)return null;const n=e.getUint8(t+1);if(n===255)t+=1;else{if(li(n))return Ze(e.getUint16(t+7),e.getUint16(t+5));if(n===ai)return null;t+=2+e.getUint16(t+2)}}return null}const ci=12,ui=40;function di(e){if(e.byteLength<22)return null;const t=e.getUint32(14,!0);return t===ci?Ze(e.getUint16(18,!0),e.getUint16(20,!0)):t<ui||e.byteLength<26?null:Ze(e.getInt32(18,!0),Math.abs(e.getInt32(22,!0)))}function fi(e,t){const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return t==="png"?e.length>=24?Ze(n.getUint32(16),n.getUint32(20)):null:t==="gif"?e.length>=10?Ze(n.getUint16(6,!0),n.getUint16(8,!0)):null:t==="bmp"?di(n):si(n)}function hi(e){return new Promise((t,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),t({bytes:Mt(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=e})}async function wn(e,t){if(e.length===0)throw new Error("bytesToDocxImage: empty image body");const n=yn(e);if(n&&n!=="webp"){const r=fi(e,n);return r?{bytes:e,type:n,intrinsicWidth:r.width,intrinsicHeight:r.height}:{bytes:e,type:n}}return hi(t)}async function gi(e){const t=await fetch(e);if(!t.ok)throw new Error(`fetchImageForDocx: HTTP ${t.status}`);return wn(new Uint8Array(await t.arrayBuffer()),e)}const pi="layoutslot",vn={sm:120,md:240,lg:360},mi=12240,xi=15840,Pn=120,En=90,Be={style:oe.NONE,size:0,color:"auto"},Tn={top:Be,bottom:Be,left:Be,right:Be,insideHorizontal:Be,insideVertical:Be},bi={top:we.TOP,middle:we.CENTER,bottom:we.BOTTOM},yi=new Set(["p","h1","h2","h3","h4"]),An=(e,t)=>Array.from(e.children).filter(n=>n.tagName.toLowerCase()===t),$t=()=>new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}});function wi(e){if(!/<(columns|layout)[\s>]/i.test(e))return{html:e,containers:[]};const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html"),n=[];return t.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=t.createElement(pi);a.setAttribute("data-layout-idx",String(i)),r.replaceWith(a)}),{html:t.body.innerHTML,containers:n}}function Sn(e){const t=Eo(e);return t===Po?void 0:t.slice(1).toUpperCase()}function lt(e){return e.containerWidthTwips&&e.containerWidthTwips>0?e.containerWidthTwips:(e.isLandscape?xi:mi)-(e.leftMarginPx??40)*15-(e.rightMarginPx??40)*15}function vi(e,t,n){const r=e&&wo.test(e)?vo(e):null,o=r&&r.length===t?r:Array.from({length:t},()=>1);return Cn(o,n)}function Pi(e,t){return Cn(Array.from({length:e},()=>1),t)}function Cn(e,t){const n=e.reduce((i,a)=>i+a,0),r=e.map(i=>Math.max(1,Math.floor(t*i/n))),o=r.reduce((i,a)=>i+a,0);return r[r.length-1]=r[r.length-1]+(t-o),r}function Nn(e,t,n,r){return r(e,{...n,leftMarginPx:0,rightMarginPx:0,containerWidthTwips:t})}function Ei(e){return e.length===0?[$t()]:e[e.length-1]instanceof Me?[...e,$t()]:e}function Fn({elements:e,fill:t,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 on({children:Ei(e),width:{size:n,type:He.DXA},shading:t?{type:At.CLEAR,color:"auto",fill:t}:void 0,borders:Tn,margins:t?{top:En,bottom:En,left:Math.max(s,Pn),right:Math.max(c,Pn)}:{top:0,bottom:0,left:s,right:c},verticalAlign:r})}function It(e,t,n){return new Me({rows:e,layout:Tt.FIXED,columnWidths:t,width:{size:t.reduce((r,o)=>r+o,0),type:He.DXA},indent:{size:(n.leftMarginPx??40)*15,type:He.DXA},borders:Tn})}function Ti(e,t){e[e.length-1]instanceof Me&&e.push($t()),e.push(t)}async function Mn(e,t,n){const r=lt(t),o=[];for(const i of e){const a=Sn(i.el.getAttribute("bg"));if(!a){o.push(...await n(i.html,t));continue}const l=await Nn(i.html,r,t,n),s=Fn({elements:l,fill:a,widthTwips:r,valign:we.TOP,gapTwips:0,index:0,count:1});Ti(o,It([new Et({children:[s]})],[r],t))}return o}async function $n(e,t,n,r,o,i){const a=t.length,l=[];for(let s=0;s<a;s++){const c=e[s],u=c?await Nn(c.html,t[s],o,i):[];l.push(Fn({elements:u,fill:c?Sn(c.el.getAttribute("bg")):void 0,widthTwips:t[s],valign:n,gapTwips:r,index:s,count:a}))}return new Et({children:l})}async function Ai(e,t,n){const r=An(e,"column");if(r.length===0)return n(e.innerHTML,t);const o=r.map(l=>({el:l,html:l.innerHTML}));if(po(e.getAttribute("direction"))==="vertical")return Mn(o,t,n);const i=vi(e.getAttribute("ratio"),o.length,lt(t)),a=await $n(o,i,bi[mo(e.getAttribute("valign"))],vn[rn(e.getAttribute("gap"))],t,n);return[It([a],i,t)]}function Si(e,t){const n=e.cloneNode(!0),r=n.ownerDocument,o=r.createElement("strong");o.textContent=`${t}. `;const i=Array.from(n.children).find(a=>yi.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 Ci(e,t,n){const r=An(e,"cell");if(r.length===0)return n(e.innerHTML,t);const o=xo(e.getAttribute("variant")),i=bo(yo(e.getAttribute("columns")),r.length,o),a=r.map((u,d)=>({el:u,html:o==="timeline"?Si(u,d+1):u.innerHTML}));if(i<=1)return Mn(a,t,n);const l=Pi(i,lt(t)),s=vn[rn(e.getAttribute("gap"))],c=[];for(let u=0;u<a.length;u+=i)c.push(await $n(a.slice(u,u+i),l,we.TOP,s,t,n));return[It(c,l,t)]}async function Ni(e,t,n){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body.firstElementChild;if(!r)return[];const o=r.tagName.toLowerCase();return o==="columns"?Ai(r,t,n):o==="layout"?Ci(r,t,n):n(r.innerHTML,t)}const ie="Arial",Fi={"sans-serif":ie,"system-ui":ie,"ui-sans-serif":ie,"ui-rounded":ie,"-apple-system":ie,blinkmacsystemfont:ie,serif:"Times New Roman","ui-serif":"Times New Roman",monospace:"Courier New","ui-monospace":"Courier New",cursive:ie,fantasy:ie,math:ie,emoji:ie,fangsong:ie};function ve(e){if(!e)return ie;const t=(e.split(",")[0]??"").trim().replace(/^['"]|['"]$/g,"").trim();return t?Fi[t.toLowerCase()]??t:ie}const Pe=e=>new ln({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e}}}),je=e=>new ln({name:"w:instrText",attributes:{space:{key:"xml:space",value:"preserve"}}}).addChildElement(e);function Mi(e,t,n){const r=o=>new H({...n,children:[o]});return[r(Pe("begin")),r(je(`PAGEREF ${e} \\h`)),r(Pe("separate")),new H({...n,text:t}),r(Pe("end"))]}const $i=e=>new H({...e,children:[an.CURRENT]}),Ii=e=>new H({...e,children:[an.TOTAL_PAGES]}),Oi=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),In=' < 1 "" "',On=(e,t)=>[t(Pe("begin")),t(je(e)),t(Pe("separate")),t(Pe("end"))];function Li(e,t){const n=o=>new H({...t,children:[o]}),r="field"in e?[n(je(In)),...On(e.field,n),n(je('"'))]:[n(je(`${In}${Oi(e.literal)}"`))];return[n(Pe("begin")),n(je("IF ")),...On("PAGE",n),...r,n(Pe("separate")),n(Pe("end"))]}const ki=e=>e==="export-preview"?Io:Oo;function Ln(e){return e.contentWidthPx!==void 0?e.contentWidthPx:e.isLandscape?Se.CONTENT_AREA_LANDSCAPE.width:Se.CONTENT_AREA.width}const kn=24,Ot=15,Q=e=>({before:e*Ot,after:e*Ot}),Rn={h1:Q(16),h2:Q(12),h3:Q(8),h4:Q(4),p:Q(4),list:Q(16),table:Q(16),hr:Q(16),img:Q(8),chart:Q(8),layout:Q(8)},Ri={...Rn,h1:Q(20),h2:Q(14),p:Q(12),list:Q(12),table:Q(12)},Hn=e=>e==="export-preview"?Ri:Rn,Ce=e=>Math.round(e*1.5),We=(e,t,n)=>{const r=(n.previewContext==="export-preview"?Ao:So)[t];return Math.round(e*(r??1.2)*Ot)},Ue=q.AT_LEAST,Qe=e=>{if(e==="center")return X.CENTER;if(e==="right")return X.RIGHT;if(e==="justify")return X.JUSTIFIED},Hi={left:X.LEFT,center:X.CENTER,right:X.RIGHT,justify:X.JUSTIFIED},Di=/data-node-text-align="(left|center|right|justify)"/i,zi=/(?:^|[;\s"'])text-align\s*:\s*(left|center|right|justify)/i,st=e=>{var t,n;if(!e)return;const r=((t=e.match(Di))==null?void 0:t[1])??((n=e.match(zi))==null?void 0:n[1]);return r?Hi[r.toLowerCase()]:void 0},Bi=/<(?:p|h[1-4])\b([^>]*)>/i,ct=e=>{var t;return(t=e.match(Bi))==null?void 0:t[1]},Dn={top:we.TOP,middle:we.CENTER,bottom:we.BOTTOM},ji=/data-node-vertical-align="(top|middle|bottom)"/i,Wi=/(?:^|[;\s"'])vertical-align\s*:\s*(top|middle|bottom)/i,zn=e=>e==="top"||e==="middle"||e==="bottom",Ui=(e,t)=>{var n,r,o;const i=(o=((n=e.match(ji))==null?void 0:n[1])??((r=e.match(Wi))==null?void 0:r[1]))==null?void 0:o.toLowerCase();return zn(i)?Dn[i]:zn(t)?Dn[t]:we.TOP},Ie=(e,t)=>{var n;const r=ki(e.previewContext)[t],o=(n=e.componentColors)==null?void 0:n.textStyles,i=o==null?void 0:o[t];return{...r,...i}},k=e=>To(e),_i={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 qi(e){const[,t,n]=(e==null?void 0:e.match(/^(\d*\.?\d+)\s*(px|pt)$/i))??[];if(!t||!n)return;const r=parseFloat(t);if(!(!Number.isFinite(r)||r<=0))return n.toLowerCase()==="pt"?Math.round(r*2):Ce(r)}function ut(e,t,n){var r,o;return(e==null?void 0:e.trim())||((o=(r=t.match(_i[n]))==null?void 0:r[1])==null?void 0:o.trim())||void 0}const Gi=new Set(["span","mark","b","strong","i","em","u","a","code"]),Xi=new Set(["none","lowercase","capitalize","full-width","full-size-kana","initial"]),Bn=/[\u{1F000}-\u{1FFFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2B00}-\u{2BFF}][\uFE0F\u20E3]?/gu,Lt="Segoe UI Emoji";function Yi(e){const t=new RegExp(Bn.source,Bn.flags),n=[];let r=0,o;for(;(o=t.exec(e))!==null;)o.index>r&&n.push({text:e.slice(r,o.index),isEmoji:!1}),n.push({text:o[0],isEmoji:!0}),r=t.lastIndex;return r<e.length&&n.push({text:e.slice(r),isEmoji:!1}),n.length===0?[{text:e,isEmoji:!1}]:n}function kt(e,t,n=kn,r){const o=[],i=ve(t.documentFont),a=new DOMParser().parseFromString(`<div>${e}</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=Yi(T);for(const w of A){if(!w.text)continue;const N=l;l=0,o.push(new H({break:N||void 0,text:w.text,bold:u.bold,italics:u.italic,underline:u.underline?{}:void 0,allCaps:u.allCaps,color:u.color,shading:u.shadingFill?{type:At.CLEAR,color:"auto",fill:u.shadingFill}:void 0,font:w.isEmoji?{ascii:Lt,hAnsi:Lt,cs:Lt}:{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 C=k(ut((d=p.style)==null?void 0:d.color,h,"color"));C&&(m.color=C);const M=qi(ut((f=p.style)==null?void 0:f.fontSize,h,"font-size"));M&&(m.sizeHalfPoints=M);const E=(x=ut((g=p.style)==null?void 0:g.textTransform,h,"text-transform"))==null?void 0:x.toLowerCase();if(E==="uppercase"?m.allCaps=!0:E&&Xi.has(E)&&(m.allCaps=void 0),Gi.has(b)){const T=k(ut((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:t.defaultTextColor}),l>1&&o.push(new H({break:l-1,font:{ascii:i,hAnsi:i},size:n})),o}function Vi(e,t,n){var r,o;const i=ve(t.documentFont),a=(t.leftMarginPx??40)*15,l=(t.rightMarginPx??40)*15,s=Ie(t,"paragraph"),c=(o=(r=t.componentColors)==null?void 0:r.paragraph)!=null&&o.textColor?k(t.componentColors.paragraph.textColor):void 0,u=kt(e,{...t,defaultTextColor:c||t.defaultTextColor},Ce(s.fontSize),{bold:s.bold,italic:s.italic,underline:s.underline});return new R({children:u.length>0?u:[new H({text:"",font:i})],alignment:st(ct(e))??Qe(s.textAlign),spacing:{before:n.before,after:n.after,line:We(s.fontSize,"paragraph",t),lineRule:Ue},indent:{left:a,right:l}})}const jn="\uE000";function Ki(e){const t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").querySelector("div");if(!t)return[""];t.querySelectorAll("br").forEach(r=>r.replaceWith(jn));const n=(t.textContent??"").replace(/[ \t\n\r\f]+/g," ").split(jn).map(r=>r.replace(/^ +| +$/g,"").replace(/\u00a0/g," "));return n.length>1&&n[n.length-1]===""&&n.pop(),n}function dt(e,t,n,r){var o,i;const a=ve(n.documentFont),l=(o=n.componentColors)==null?void 0:o.heading,s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=Ie(n,`h${t}`),d=(i=e.match(/\bid="(dest-[^"]+)"/i))==null?void 0:i[1],f=Ki(e);let g;if(l){const h=l[`h${t}`];h&&(g=k(h))}const x=k(l==null?void 0:l[`h${t}Bg`]),P={1:De.HEADING_1,2:De.HEADING_2,3:De.HEADING_3,4:De.HEADING_4},p=f.map((h,m)=>new H({break:m>0?1:void 0,text:h,font:a,size:Ce(u.fontSize),bold:u.bold,italics:u.italic,color:g,underline:u.underline?{}:void 0,shading:x?{type:At.CLEAR,color:"auto",fill:x}:void 0})),b=d?[new sn({id:d,children:p})]:p;return new R({children:b,heading:P[t],keepNext:!0,alignment:st(ct(e))??Qe(u.textAlign),spacing:{before:r.before,after:r.after,line:We(u.fontSize,`h${t}`,n),lineRule:Ue},indent:{left:s,right:c}})}function Wn(e){switch(e){case"a":return"lower-letter-numbering";case"i":return"lower-roman-numbering";default:return"default-numbering"}}function Un(e){var t,n;const r=(t=e.match(/<ol\b[^>]*>/i))==null?void 0:t[0];return((n=r==null?void 0:r.match(/\stype=["']?([^"'\s>]+)/i))==null?void 0:n[1])??null}let Ji=0;const _n=()=>Ji+=1;function qn(e,t,n,r){var o;const i=ve(n.documentFont),a=(o=n.componentColors)==null?void 0:o.list,l=Ie(n,"listText"),s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=a!=null&&a.textColor?k(a.textColor):void 0,d=t?{reference:Wn(Un(e)),level:0,instance:_n()}:void 0,f=[],g=/<li[^>]*>(.*?)<\/li>/gi;let x;for(;(x=g.exec(e))!==null;)f.push(x[1]);return f.map((P,p)=>{const b=p===0,h=p===f.length-1,m=kt(P,{...n,defaultTextColor:u||n.defaultTextColor},Ce(l.fontSize),{bold:l.bold,italic:l.italic,underline:l.underline});return new R({children:m.length>0?m:[new H({text:"",font:i})],bullet:t?void 0:{level:0},numbering:d,alignment:Qe(l.textAlign),spacing:{before:b?r.before:0,after:h?r.after:90,line:We(l.fontSize,"listText",n),lineRule:Ue},indent:{left:s+360,hanging:360,right:c}})})}function Zi(e){const t=e.match(/<(p|h[1-4])(?:\s[^>]*)?>[\s\S]*?<\/\1>/gi);if(!t||t.length<2)return[e];const n=r=>{var o;return((o=new DOMParser().parseFromString(r,"text/html").body.textContent)==null?void 0:o.trim())??""};return t.map(n).join("").replace(/\s+/g,"")!==n(e).replace(/\s+/g,"")?[e]:t}const Rt="data-cell-list",Gn=/<(ul|ol)\b[^>]*>((?:(?!<(?:ul|ol)\b)[\s\S])*?)<\/\1>/i;function Qi(e){let t=e;for(let n=t.match(Gn);n;n=t.match(Gn)){const r=n[0],o=(n[1]??"").toLowerCase(),i=n[2]??"",a=o==="ol"?Un(r):null,l=o==="ol"?` ${Rt}-instance="${_n()}"`+(a?` ${Rt}-type="${a}"`:""):"",s=i.replace(/<li\b[^>]*>\s*<p\b/gi,`<p ${Rt}="${o}"${l}`),c=n.index??0;t=t.slice(0,c)+s+t.slice(c+r.length)}return t}const ea=e=>{var t,n,r,o;const i=(n=(t=e==null?void 0:e.match(/data-cell-list="(ul|ol)"/i))==null?void 0:t[1])==null?void 0:n.toLowerCase();if(i==="ul")return{kind:"ul"};if(i==="ol")return{kind:"ol",instance:Number(((r=e==null?void 0:e.match(/data-cell-list-instance="(\d+)"/i))==null?void 0:r[1])??0),type:((o=e==null?void 0:e.match(/data-cell-list-type="([^"]+)"/i))==null?void 0:o[1])??null}},ta=e=>{if(!e)return{};const t={left:360,hanging:360};return e.kind==="ul"?{bullet:{level:0},indent:t}:{numbering:{reference:Wn(e.type),level:0,instance:e.instance},indent:t}},Xn=15,Yn=e=>{var t;const n=Lo((t=e.componentColors)==null?void 0:t.table),r=Math.round(n.y*Xn),o=Math.round(n.x*Xn);return{top:r,bottom:r,left:o,right:o}},na=e=>{const t=Yn(e);return t.top+t.bottom},Vn=300,ra=100,oa=15840,ia=12240;function aa(e,t){var n;const r=parseInt(((n=e.match(/data-row-twips="(\d+)"/i))==null?void 0:n[1])??"",10);if(!Number.isFinite(r)||r<=0)return Vn;const o=t.isLandscape?ia:oa,i=t.contentHeightPx&&t.contentHeightPx>0?Math.round(t.contentHeightPx*15):o;return r>i?Vn:Math.max(ra,r-na(t))}function Kn(e,t){var n,r;const o=(n=t.componentColors)==null?void 0:n.table,i=Ie(t,"tableHeader").verticalAlign,a=Yn(t),l=ve(t.documentFont),s=(t.leftMarginPx??40)*15,c=lt(t),u=e.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(e))!==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 C;for(;(C=m.exec(e))!==null;){const M=C[1]??"",E=C[2]??"",T=C.index,A=P.findIndex(I=>T>=I.start&&T<I.end),w=(h.get(A)??0)+1;h.set(A,w);const N=(((r=P[A])==null?void 0:r.tag)??"tbody")==="tbody"&&w%2===0,j=[],Y=/<th[\s>]/i.test(E),se=/<td[\s>]/i.test(E),ne=Y&&!se;let ae=0;const ce=/<(th|td)([^>]*)>([\s\S]*?)<\/\1>/gi;let Ee;for(;(Ee=ce.exec(E))!==null;){const I=Ee[2]||"",Te=Ee[3]||"",Ye=(Ee[1]||"").toLowerCase()==="th",Oe=Ye&&ne,v=Ye&&!ne,F=Oe?"tableHeader":v?"tableHeaderColumn":"tableCell",$=Ie(t,F),L=v?$.verticalAlign??i:$.verticalAlign,U=(o==null?void 0:o.headerColumnText)||(o==null?void 0:o.headerText),ue=Oe?o!=null&&o.headerText?k(o.headerText):void 0:v?U?k(U):void 0:o!=null&&o.cellText?k(o.cellText):void 0,re=st(I),V=Zi(Qi(Te)),ge=V.map(D=>st(ct(D))),Ae=V.map(D=>ea(ct(D))),ee=V.map(D=>kt(D,{...t,defaultTextColor:ue},Ce($.fontSize),{bold:$.bold,italic:$.italic,underline:$.underline})),te=I.match(/colspan="(\d+)"/i),Z=te!=null&&te[1]?parseInt(te[1],10):void 0,le=I.match(/rowspan="(\d+)"/i),K=le!=null&&le[1]?parseInt(le[1],10):void 0,de=Z&&Z>1?Z:1,fe=K&&K>1?K:1;for(;(x[ae]??0)>0;)ae+=1;const me=ae;if(fe>1)for(let D=me;D<me+de;D+=1)x[D]=fe;ae=me+de;const Le=I.match(/data-colwidth="(\d+)"/i),Ve=I.match(new RegExp("(?<!min-)width:\\s*(\\d+)px","i")),rt=Le!=null&&Le[1]?parseInt(Le[1],10):Ve!=null&&Ve[1]?parseInt(Ve[1],10):void 0,Pt=rt?Math.round(rt*15):void 0,Ke=(d&&me+de<=d.length?d.slice(me,me+de).reduce((D,xe)=>D+xe,0):void 0)??Pt,ke=ee.map((D,xe)=>new R({children:D.length>0?D:[new H({text:"",font:l})],...ta(Ae[xe]),alignment:ge[xe]??re??Qe($.textAlign),spacing:{before:0,after:0,...t.previewContext==="export-preview"?{line:We($.fontSize,F,t),lineRule:Ue}:{line:240,lineRule:q.AUTO}}}));j.push(new on({children:ke,columnSpan:de>1?de:void 0,rowSpan:fe>1?fe:void 0,width:Ke?{size:Ke,type:He.DXA}:void 0,shading:(()=>{const D=I.match(/background-color:\s*([^;"]+)/i),xe=D!=null&&D[1]?k(D[1].trim()):void 0;if(xe)return{fill:xe};if(Oe&&o!=null&&o.headerBg)return{fill:k(o.headerBg)||"FFFFFF"};if(v){const ot=(o==null?void 0:o.headerColumnBg)||(o==null?void 0:o.headerBg);if(ot)return{fill:k(ot)||"FFFFFF"}}return!Ye&&N&&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:oe.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0,margins:{...a},verticalAlign:Ui(I,L)}))}for(let I=0;I<x.length;I+=1)x[I]=Math.max(0,(x[I]??0)-1);j.length>0&&g.push(new Et({children:j,cantSplit:!0,tableHeader:ne,height:{value:aa(M,t),rule:$o.ATLEAST}}))}return new Me({rows:g,layout:f?Tt.FIXED:Tt.AUTOFIT,...f?{columnWidths:d}:{},width:{size:f?d.reduce((M,E)=>M+E,0):c,type:He.DXA},indent:{size:s,type:He.DXA},borders:o!=null&&o.border?{top:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},insideHorizontal:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},insideVertical:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0})}function Jn(e){let t=e;for(;/<[^>]+>/.test(t);)t=t.replace(/<[^>]+>/g,"");return t}function la(e,t){var n;const r=ve(t.documentFont),o=(t.leftMarginPx??40)*15,i=(t.rightMarginPx??40)*15,a=(n=e.match(/\bdata-dest="(dest-[^"]+)"/i))==null?void 0:n[1];let l="dotted";/border-bottom:.*solid/i.test(e)?l="line":/border-bottom:.*dotted/i.test(e)?l="dotted":/font-weight:\s*500/i.test(e)||/margin-bottom:\s*8px/i.test(e)?l="modern":/font-size:\s*0\.9em/i.test(e)||/font-size:\s*0\.85em/i.test(e)?l="compact":/\[\d+\]|\[\.\.\.\]/.test(e)&&(l="simple");const s=e.match(/margin-left:\s*(\d+)px/),c=s?parseInt(s[1],10):0,u=/<span([^>]*)>(.*?)<\/span>/gi,d=[];let f;for(;(f=u.exec(e))!==null;)d.push({attrs:f[1]||"",content:f[2]||""});if(d.length<1)return null;const g=Jn(d[0].content.replace(/ /g," ").replace(/&/g,"&")).trim();let x="";for(let I=d.length-1;I>=1;I--){const Te=Jn(d[I].content).trim();if(/\d+/.test(Te)||Te==="..."){x=Te.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=Ie(t,"paragraph").fontSize,C=l==="compact"?m*.9:m,M=l==="compact"?m*.85:l==="modern"?m*.95:m,E=Ce(C),T=Ce(M),A=l==="simple"?"[":"",w=l==="simple"?"]":"",N=`${A}${x}${w}`,j=l==="dotted"?St.DOT:l==="line"?St.UNDERSCORE:St.NONE,Y=l==="modern"?60:l==="compact"?30:60,se=l==="modern"?180:l==="compact"?30:120,ne={font:r,size:T,bold:b||void 0,color:h},ae=t.tocPagerefFields&&a&&/^\d+$/.test(x)?[...A?[new H({...ne,text:A})]:[],...Mi(a,x,ne),...w?[new H({...ne,text:w})]:[]]:[new H({...ne,text:N})],ce=[new H({text:g,font:r,size:E,bold:void 0}),new H({children:[new Co],font:r,size:T}),...ae],Ee=a?[new No({anchor:a,children:ce})]:ce;return new R({children:Ee,tabStops:[{type:Fo.RIGHT,position:p,leader:j}],spacing:{before:Y,after:se,line:We(Math.max(C,M),"paragraph",t),lineRule:Ue},indent:{left:P,right:i}})}function sa(e,t){const n=(e.leftMarginPx??40)*15,r=(e.rightMarginPx??40)*15;return new R({children:[new H({text:""})],border:{bottom:{style:oe.SINGLE,size:6,space:1,color:"E0E0E0"}},spacing:{before:t.before,after:t.after,line:240,lineRule:q.AUTO},indent:{left:n,right:r}})}const ca=320,ua=3;function et(e){if(!e||!/^\d+(\.\d+)?$/.test(e.trim()))return;const t=Number(e);return t>0?t:void 0}function Ht(e,t,n){const r=ve(t.documentFont),o=(t.leftMarginPx??40)*15,i=(t.rightMarginPx??40)*15,a={style:oe.SINGLE,size:6,space:4,color:"E0E0E0"};return new R({children:[new H({text:e,font:r,size:kn,italics:!0})],border:{top:a,bottom:a,left:a,right:a},alignment:X.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO},indent:{left:o,right:i}})}function Dt(e,t,n){return Ht(`Chart: ${e} (see PDF export)`,t,n)}function zt(e,t,n){const r=e!=null&&e.trim()?`Image: ${e.trim()} (could not be embedded)`:"Image (could not be embedded)";return Ht(r,t,n)}async function da(e,t,n){var r;const o=new DOMParser().parseFromString(`<body>${e}</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=Ln(t),c=et(a.getAttribute("width")),u=et(a.getAttribute("height")),d=et((r=(o.getAttribute("style")||"").match(/height:\s*([\d.]+)px/i))==null?void 0:r[1]),f=c??s,g=u??d??ca;try{const x=await oi(a,{width:f,height:g,scale:ua}),P=Mt(x);if(P.length>0)return[new R({children:[new $e({type:"png",data:P,transformation:{width:f,height:g}})],alignment:X.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO}})]}catch(x){console.error(`Failed to rasterize chart "${i}" for DOCX:`,x)}return[Dt(i,t,n)]}const l=o.querySelector("table");return l?[Kn(l.outerHTML,t)]:[Dt(i,t,n)]}function fa(e,t,n,r,o){let i=e,a=t;const l=!!n&&!!r;return!i&&!a&&l?(i=n,a=r):i&&l?a=i*(r/n):i&&!a?a=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 ha(e){return e==="center"?X.CENTER:e==="right"?X.RIGHT:X.LEFT}async function ga(e,t,n){const r=new DOMParser().parseFromString(`<body>${e}</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=et(r==null?void 0:r.getAttribute("width")),l=et(r==null?void 0:r.getAttribute("height")),s=ha(r==null?void 0:r.getAttribute("data-align"));if(!o)return zt(i,t,n);const c=Ln(t);try{const u=await Mo(o,void 0,"original")||o,d=u.startsWith("data:")?await wn(Mt(u),u):await gi(u);if(d.bytes.length===0)return zt(i,t,n);const{width:f,height:g}=fa(a,l,d.intrinsicWidth,d.intrinsicHeight,c);return new R({children:[new $e({type:d.type,data:d.bytes,transformation:{width:f,height:g}})],alignment:s,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO}})}catch(u){return console.error("Failed to embed inline image for DOCX:",u),zt(i,t,n)}}const pa=/^\s*<([a-z][a-z0-9]*)/i,Zn=e=>{var t,n;return((n=(t=e.match(pa))==null?void 0:t[1])==null?void 0:n.toLowerCase())??""};function ma(e){switch(Zn(e)){case"chartslot":return"chart";case"layoutslot":return"layout";case"h1":return/class="[^"]*section-title-from-h2/i.test(e)?"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 Bt=e=>e!=="table";function xa(e,t){const n=Hn(t.previewContext),r=e.map(s=>n[s]),o=t.containerWidthTwips===void 0,i=e.map((s,c)=>c===0&&!o?r[c].before:0),a=e.map((s,c)=>Bt(s)?r[c].after:0),l=e.map(()=>0);for(let s=1;s<e.length;s++){const c=Math.max(r[s-1].after,r[s].before);l[s]=c,Bt(e[s])?i[s]=Math.max(0,c-a[s-1]):Bt(e[s-1])&&(a[s-1]=c)}return{spacing:e.map((s,c)=>({before:i[c],after:a[c]})),collapsedGap:l}}const ba=2,ya=20;function wa(e){return new R({children:[new H({text:"",size:ba})],spacing:{before:0,after:e,line:ya,lineRule:q.EXACT}})}async function Qn(e,t={},n=!1){var r,o;const i=[],a=/<div[^>]*data-toc-page="[^"]*"[^>]*>.*?<\/div>/gi,l=e.match(a)||[];if(l.length>0){const b=e.match(/<h1[^>]*>(.*?)<\/h1>/i);if(b){const h=ve(t.documentFont),m=(r=t.componentColors)==null?void 0:r.heading,C=(t.leftMarginPx??40)*15,M=(t.rightMarginPx??40)*15,E=Ie(t,"h1");let T;if(m){const A=m.h1;A&&(T=k(A))}i.push(new R({children:[new H({text:((o=b[1])==null?void 0:o.replace(/<[^>]+>/g,"").trim())||"Table of Contents",font:h,size:Ce(E.fontSize),bold:E.bold,italics:E.italic,color:T,underline:E.underline?{}:void 0})],heading:De.HEADING_1,alignment:Qe(E.textAlign),spacing:{before:0,after:Hn(t.previewContext).h1.after,line:We(E.fontSize,"h1",t),lineRule:Ue},indent:{left:C,right:M}}))}for(const h of l)try{const m=la(h,t);m&&i.push(m)}catch(m){console.error("Failed to parse TOC item:",m)}return i}e=e.replace(/<div[^>]*data-page-break="true"[^>]*>.*?<\/div>/gis,""),e=e.replace(/<div[^>]*class="page-break-marker"[^>]*>.*?<\/div>/gis,"");const{html:s,containers:c}=wi(e);e=s;const u=[];if(/data-chart-type=/i.test(e)){const b=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");b.body.querySelectorAll("[data-chart-type]").forEach(h=>{const m=u.push(h.outerHTML)-1,C=b.createElement("chartslot");C.setAttribute("data-chart-idx",String(m)),h.replaceWith(C)}),e=b.body.innerHTML}e=e.replace(/<div[^>]*class="page-content[^"]*"[^>]*>/gi,""),e=e.replace(/<\/div>/gi,""),e=e.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=e.match(d)||[],g=f.map(ma),{spacing:x,collapsedGap:P}=xa(g,t);let p=0;for(let b=0;b<f.length;b++){const h=f[b],m=x[b],C=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(Zn(h)){case"chartslot":{const w=h.match(/data-chart-idx="(\d+)"/i),N=w?u[Number(w[1])]:void 0;N?i.push(...await da(N,t,E)):i.push(Dt("chart",t,E));break}case"layoutslot":{const w=h.match(/data-layout-idx="(\d+)"/i),N=w?c[Number(w[1])]:void 0;N?i.push(...await Ni(N,t,Qn)):i.push(Ht("Layout section (see PDF export)",t,E));break}case"h1":{const w=/class="[^"]*section-title-from-h2/i.test(h)?2:1;i.push(dt(h,w,t,E));break}case"h2":i.push(dt(h,2,t,E));break;case"h3":i.push(dt(h,3,t,E));break;case"h4":i.push(dt(h,4,t,E));break;case"ul":i.push(...qn(h,!1,t,E));break;case"ol":i.push(...qn(h,!0,t,E));break;case"table":i.push(Kn(h,t));break;case"hr":i.push(sa(t,E));break;case"img":i.push(await ga(h,t,E));break;default:i.push(Vi(h,t,E))}}catch(w){console.error("Failed to parse block:",h,w)}const T=i[C]instanceof Me,A=T&&i[C-1]instanceof Me;if(C>0&&T&&(A||M>0)&&i.splice(C,0,wa(M)),i.length>C){const w=i[i.length-1]instanceof Me,N=g[b]!=="layout";p=w||!N?0:m.after}}return i.length===0&&i.push(new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}})),i}const va=["MM/DD/YYYY","DD/MM/YYYY","DD MMM YYYY","MMM DD, YYYY","YYYY-MM-DD"];function Pa(e){return typeof e=="string"&&va.includes(e)}const jt=987654321,ft=987654322,Wt=/\{%[^%\n]*%\}/g;function er(e){const t=e.slice(2,-2).toLowerCase();return t==="page_number"?"page-number":t==="total_pages"?"total-pages":"text"}function Ea(e){return JSON.stringify([e.bold??!1,e.italics??!1,e.underline??!1,e.strike??!1,e.color??"",e.fontSizePx??0,e.fontFamily??""])}function _e(e,t,n,r=!1){const o=e==="text"?{kind:e,text:t,...n}:{kind:e,...n};return r?{...o,hiddenAtPageZero:!0}:o}function Ta(e,t){return Ct(e==="page-number"?"{%page_number%}":"{%total_pages%}",{pageNumber:0,variableValues:t.variableValues,currentDateText:t.currentDateText})===""}function Aa(e,t,n){const r=[];let o="",i=null,a={};const l=()=>{i!==null&&o!==""&&r.push(_e("text",o,a)),o="",i=null};for(const s of e){const c=t(s.rawIndex);if(s.kind!=="text"){l(),r.push(_e(s.kind,"",c,Ta(s.kind,n)));continue}if(s.text==="")continue;const u=Ea(c);u!==i&&(l(),i=u,a=c),o+=s.text}return l(),r}function ht(e,t,n){const r={pageNumber:0,variableValues:n.variableValues,currentDateText:n.currentDateText},o=[];let i=0;for(const a of e.matchAll(Wt)){const l=a.index;for(let u=i;u<l;u++)o.push({kind:"text",text:e[u],rawIndex:u});const s=a[0],c=er(s);o.push({kind:c,text:c==="text"?Ct(s,r):"",rawIndex:l}),i=l+s.length}for(let a=i;a<e.length;a++)o.push({kind:"text",text:e[a],rawIndex:a});return Aa(o,t,n)}function tr(e){for(const t of e.matchAll(Wt))if(er(t[0])!=="text")return!0;return!1}function nr(e,t){const n={pageNumber:t.pageNumber,totalPages:t.totalPages,variableValues:t.variableValues,currentDateText:t.currentDateText},r=new Array(e.length+1);let o="",i=0;const a=(l,s)=>{for(let c=l;c<s;c++)r[c]=o.length,o+=e[c]};for(const l of e.matchAll(Wt)){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+=Ct(c,n),i=s+c.length}return a(i,e.length),r[e.length]=o.length,{painted:o,paintedOffsets:r}}function rr(e,t){const n=un(e,jt,ft),r=un(e,0,ft)==="",o=[];for(const i of n.split(new RegExp(`(${jt}|${ft})`)))i!==""&&(i===String(jt)?o.push(_e("page-number","",t,r)):i===String(ft)?o.push(_e("total-pages","",t,r)):o.push(_e("text",i,t,r)));return o}function or(e,t,n){const r=e==null?void 0:e.pageNumberFormat;if(!cn(r))return null;const o=ko(e,n.pageNumber,n.totalPages);return o===void 0?null:{runs:rr(r,t),painted:o}}function Sa(e,t,n){const r=e,o=r==null?void 0:r.pageNumberFormat;if(cn(o))return rr(o,t);const i=r==null?void 0:r.dateFormat;return Pa(i)?[_e("text",Ro(i,n),t)]:null}const ir=new Set(["paragraph","heading","blockquote"]),Ca=e=>(e.content??[]).some(t=>ir.has(t.type??""));function ar(e){const t=e;if(!t||typeof t!="object"||!Array.isArray(t.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{hP as po,hQ as rn,hR as we,hS as mo,hT as xo,hU as bo,hV as yo,hW as Et,hX as wo,hY as vo,hZ as Me,h_ as oe,h$ as He,i0 as Tt,i1 as Po,i2 as on,i3 as At,i4 as Eo,i5 as R,i6 as q,i7 as H,i8 as an,i9 as ln,ia as De,ib as To,ic as Ao,id as So,ie as X,ig as Co,ih as No,ii as St,ij as Fo,ik as Mo,il as $e,im as $o,io as sn,ip as Io,iq as Oo,dQ as Se,cI as Lo,ir as cn,is as ko,it as Ct,iu as Ro,iv as un,iw as Ho,ix as Do,iy as zo,iz as Bo,iA as jo,iB as dn,iC as Wo,iD as Uo,iE as _o,iF as qo,bY as fn,d2 as hn,eK as Go,dM as it,iG as Xo,iH as Yo,iI as Vo,dN as Nt,eL as at,eM as ze,iJ as pe,iK as gn,iL as pn,iM as Ko,iN as Ft,iO as Jo,iP as Zo,iQ as Qo,iR as mn,dL as ei}from"./runtime-BifHPIs0.js";import{e as Mt,d as ti,b as xn,a as ni,f as bn}from"./exportPageHtml-YIUR3iCw.js";import"react";import{awaitExportImagesReady as ri}from"./exportImageReadiness-CDj5qZi9.js";function oi(e,t){const n=typeof e=="string"?e:new XMLSerializer().serializeToString(e),r=t.scale,o=Math.max(1,Math.round(t.width*r)),i=Math.max(1,Math.round(t.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 yn(e){return e.length>=4&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"png":e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?"jpg":e.length>=4&&e[0]===71&&e[1]===73&&e[2]===70&&e[3]===56?"gif":e.length>=2&&e[0]===66&&e[1]===77?"bmp":e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?"webp":null}const Ze=(e,t)=>e>0&&t>0?{width:e,height:t}:null,ii=[196,200,204],ai=218,li=e=>e>=192&&e<=207&&!ii.includes(e);function si(e){let t=2;for(;t+9<=e.byteLength;){if(e.getUint8(t)!==255)return null;const n=e.getUint8(t+1);if(n===255)t+=1;else{if(li(n))return Ze(e.getUint16(t+7),e.getUint16(t+5));if(n===ai)return null;t+=2+e.getUint16(t+2)}}return null}const ci=12,ui=40;function di(e){if(e.byteLength<22)return null;const t=e.getUint32(14,!0);return t===ci?Ze(e.getUint16(18,!0),e.getUint16(20,!0)):t<ui||e.byteLength<26?null:Ze(e.getInt32(18,!0),Math.abs(e.getInt32(22,!0)))}function fi(e,t){const n=new DataView(e.buffer,e.byteOffset,e.byteLength);return t==="png"?e.length>=24?Ze(n.getUint32(16),n.getUint32(20)):null:t==="gif"?e.length>=10?Ze(n.getUint16(6,!0),n.getUint16(8,!0)):null:t==="bmp"?di(n):si(n)}function hi(e){return new Promise((t,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),t({bytes:Mt(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=e})}async function wn(e,t){if(e.length===0)throw new Error("bytesToDocxImage: empty image body");const n=yn(e);if(n&&n!=="webp"){const r=fi(e,n);return r?{bytes:e,type:n,intrinsicWidth:r.width,intrinsicHeight:r.height}:{bytes:e,type:n}}return hi(t)}async function gi(e){const t=await fetch(e);if(!t.ok)throw new Error(`fetchImageForDocx: HTTP ${t.status}`);return wn(new Uint8Array(await t.arrayBuffer()),e)}const pi="layoutslot",vn={sm:120,md:240,lg:360},mi=12240,xi=15840,Pn=120,En=90,Be={style:oe.NONE,size:0,color:"auto"},Tn={top:Be,bottom:Be,left:Be,right:Be,insideHorizontal:Be,insideVertical:Be},bi={top:we.TOP,middle:we.CENTER,bottom:we.BOTTOM},yi=new Set(["p","h1","h2","h3","h4"]),An=(e,t)=>Array.from(e.children).filter(n=>n.tagName.toLowerCase()===t),$t=()=>new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}});function wi(e){if(!/<(columns|layout)[\s>]/i.test(e))return{html:e,containers:[]};const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html"),n=[];return t.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=t.createElement(pi);a.setAttribute("data-layout-idx",String(i)),r.replaceWith(a)}),{html:t.body.innerHTML,containers:n}}function Sn(e){const t=Eo(e);return t===Po?void 0:t.slice(1).toUpperCase()}function lt(e){return e.containerWidthTwips&&e.containerWidthTwips>0?e.containerWidthTwips:(e.isLandscape?xi:mi)-(e.leftMarginPx??40)*15-(e.rightMarginPx??40)*15}function vi(e,t,n){const r=e&&wo.test(e)?vo(e):null,o=r&&r.length===t?r:Array.from({length:t},()=>1);return Cn(o,n)}function Pi(e,t){return Cn(Array.from({length:e},()=>1),t)}function Cn(e,t){const n=e.reduce((i,a)=>i+a,0),r=e.map(i=>Math.max(1,Math.floor(t*i/n))),o=r.reduce((i,a)=>i+a,0);return r[r.length-1]=r[r.length-1]+(t-o),r}function Nn(e,t,n,r){return r(e,{...n,leftMarginPx:0,rightMarginPx:0,containerWidthTwips:t})}function Ei(e){return e.length===0?[$t()]:e[e.length-1]instanceof Me?[...e,$t()]:e}function Fn({elements:e,fill:t,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 on({children:Ei(e),width:{size:n,type:He.DXA},shading:t?{type:At.CLEAR,color:"auto",fill:t}:void 0,borders:Tn,margins:t?{top:En,bottom:En,left:Math.max(s,Pn),right:Math.max(c,Pn)}:{top:0,bottom:0,left:s,right:c},verticalAlign:r})}function It(e,t,n){return new Me({rows:e,layout:Tt.FIXED,columnWidths:t,width:{size:t.reduce((r,o)=>r+o,0),type:He.DXA},indent:{size:(n.leftMarginPx??40)*15,type:He.DXA},borders:Tn})}function Ti(e,t){e[e.length-1]instanceof Me&&e.push($t()),e.push(t)}async function Mn(e,t,n){const r=lt(t),o=[];for(const i of e){const a=Sn(i.el.getAttribute("bg"));if(!a){o.push(...await n(i.html,t));continue}const l=await Nn(i.html,r,t,n),s=Fn({elements:l,fill:a,widthTwips:r,valign:we.TOP,gapTwips:0,index:0,count:1});Ti(o,It([new Et({children:[s]})],[r],t))}return o}async function $n(e,t,n,r,o,i){const a=t.length,l=[];for(let s=0;s<a;s++){const c=e[s],u=c?await Nn(c.html,t[s],o,i):[];l.push(Fn({elements:u,fill:c?Sn(c.el.getAttribute("bg")):void 0,widthTwips:t[s],valign:n,gapTwips:r,index:s,count:a}))}return new Et({children:l})}async function Ai(e,t,n){const r=An(e,"column");if(r.length===0)return n(e.innerHTML,t);const o=r.map(l=>({el:l,html:l.innerHTML}));if(po(e.getAttribute("direction"))==="vertical")return Mn(o,t,n);const i=vi(e.getAttribute("ratio"),o.length,lt(t)),a=await $n(o,i,bi[mo(e.getAttribute("valign"))],vn[rn(e.getAttribute("gap"))],t,n);return[It([a],i,t)]}function Si(e,t){const n=e.cloneNode(!0),r=n.ownerDocument,o=r.createElement("strong");o.textContent=`${t}. `;const i=Array.from(n.children).find(a=>yi.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 Ci(e,t,n){const r=An(e,"cell");if(r.length===0)return n(e.innerHTML,t);const o=xo(e.getAttribute("variant")),i=bo(yo(e.getAttribute("columns")),r.length,o),a=r.map((u,d)=>({el:u,html:o==="timeline"?Si(u,d+1):u.innerHTML}));if(i<=1)return Mn(a,t,n);const l=Pi(i,lt(t)),s=vn[rn(e.getAttribute("gap"))],c=[];for(let u=0;u<a.length;u+=i)c.push(await $n(a.slice(u,u+i),l,we.TOP,s,t,n));return[It(c,l,t)]}async function Ni(e,t,n){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html").body.firstElementChild;if(!r)return[];const o=r.tagName.toLowerCase();return o==="columns"?Ai(r,t,n):o==="layout"?Ci(r,t,n):n(r.innerHTML,t)}const ie="Arial",Fi={"sans-serif":ie,"system-ui":ie,"ui-sans-serif":ie,"ui-rounded":ie,"-apple-system":ie,blinkmacsystemfont:ie,serif:"Times New Roman","ui-serif":"Times New Roman",monospace:"Courier New","ui-monospace":"Courier New",cursive:ie,fantasy:ie,math:ie,emoji:ie,fangsong:ie};function ve(e){if(!e)return ie;const t=(e.split(",")[0]??"").trim().replace(/^['"]|['"]$/g,"").trim();return t?Fi[t.toLowerCase()]??t:ie}const Pe=e=>new ln({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e}}}),je=e=>new ln({name:"w:instrText",attributes:{space:{key:"xml:space",value:"preserve"}}}).addChildElement(e);function Mi(e,t,n){const r=o=>new H({...n,children:[o]});return[r(Pe("begin")),r(je(`PAGEREF ${e} \\h`)),r(Pe("separate")),new H({...n,text:t}),r(Pe("end"))]}const $i=e=>new H({...e,children:[an.CURRENT]}),Ii=e=>new H({...e,children:[an.TOTAL_PAGES]}),Oi=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),In=' < 1 "" "',On=(e,t)=>[t(Pe("begin")),t(je(e)),t(Pe("separate")),t(Pe("end"))];function Li(e,t){const n=o=>new H({...t,children:[o]}),r="field"in e?[n(je(In)),...On(e.field,n),n(je('"'))]:[n(je(`${In}${Oi(e.literal)}"`))];return[n(Pe("begin")),n(je("IF ")),...On("PAGE",n),...r,n(Pe("separate")),n(Pe("end"))]}const ki=e=>e==="export-preview"?Io:Oo;function Ln(e){return e.contentWidthPx!==void 0?e.contentWidthPx:e.isLandscape?Se.CONTENT_AREA_LANDSCAPE.width:Se.CONTENT_AREA.width}const kn=24,Ot=15,Q=e=>({before:e*Ot,after:e*Ot}),Rn={h1:Q(16),h2:Q(12),h3:Q(8),h4:Q(4),p:Q(4),list:Q(16),table:Q(16),hr:Q(16),img:Q(8),chart:Q(8),layout:Q(8)},Ri={...Rn,h1:Q(20),h2:Q(14),p:Q(12),list:Q(12),table:Q(12)},Hn=e=>e==="export-preview"?Ri:Rn,Ce=e=>Math.round(e*1.5),We=(e,t,n)=>{const r=(n.previewContext==="export-preview"?Ao:So)[t];return Math.round(e*(r??1.2)*Ot)},Ue=q.AT_LEAST,Qe=e=>{if(e==="center")return X.CENTER;if(e==="right")return X.RIGHT;if(e==="justify")return X.JUSTIFIED},Hi={left:X.LEFT,center:X.CENTER,right:X.RIGHT,justify:X.JUSTIFIED},Di=/data-node-text-align="(left|center|right|justify)"/i,zi=/(?:^|[;\s"'])text-align\s*:\s*(left|center|right|justify)/i,st=e=>{var t,n;if(!e)return;const r=((t=e.match(Di))==null?void 0:t[1])??((n=e.match(zi))==null?void 0:n[1]);return r?Hi[r.toLowerCase()]:void 0},Bi=/<(?:p|h[1-4])\b([^>]*)>/i,ct=e=>{var t;return(t=e.match(Bi))==null?void 0:t[1]},Dn={top:we.TOP,middle:we.CENTER,bottom:we.BOTTOM},ji=/data-node-vertical-align="(top|middle|bottom)"/i,Wi=/(?:^|[;\s"'])vertical-align\s*:\s*(top|middle|bottom)/i,zn=e=>e==="top"||e==="middle"||e==="bottom",Ui=(e,t)=>{var n,r,o;const i=(o=((n=e.match(ji))==null?void 0:n[1])??((r=e.match(Wi))==null?void 0:r[1]))==null?void 0:o.toLowerCase();return zn(i)?Dn[i]:zn(t)?Dn[t]:we.TOP},Ie=(e,t)=>{var n;const r=ki(e.previewContext)[t],o=(n=e.componentColors)==null?void 0:n.textStyles,i=o==null?void 0:o[t];return{...r,...i}},k=e=>To(e),_i={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 qi(e){const[,t,n]=(e==null?void 0:e.match(/^(\d*\.?\d+)\s*(px|pt)$/i))??[];if(!t||!n)return;const r=parseFloat(t);if(!(!Number.isFinite(r)||r<=0))return n.toLowerCase()==="pt"?Math.round(r*2):Ce(r)}function ut(e,t,n){var r,o;return(e==null?void 0:e.trim())||((o=(r=t.match(_i[n]))==null?void 0:r[1])==null?void 0:o.trim())||void 0}const Gi=new Set(["span","mark","b","strong","i","em","u","a","code"]),Xi=new Set(["none","lowercase","capitalize","full-width","full-size-kana","initial"]),Bn=/[\u{1F000}-\u{1FFFF}\u{2600}-\u{27BF}\u{2300}-\u{23FF}\u{2B00}-\u{2BFF}][\uFE0F\u20E3]?/gu,Lt="Segoe UI Emoji";function Yi(e){const t=new RegExp(Bn.source,Bn.flags),n=[];let r=0,o;for(;(o=t.exec(e))!==null;)o.index>r&&n.push({text:e.slice(r,o.index),isEmoji:!1}),n.push({text:o[0],isEmoji:!0}),r=t.lastIndex;return r<e.length&&n.push({text:e.slice(r),isEmoji:!1}),n.length===0?[{text:e,isEmoji:!1}]:n}function kt(e,t,n=kn,r){const o=[],i=ve(t.documentFont),a=new DOMParser().parseFromString(`<div>${e}</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=Yi(T);for(const w of A){if(!w.text)continue;const N=l;l=0,o.push(new H({break:N||void 0,text:w.text,bold:u.bold,italics:u.italic,underline:u.underline?{}:void 0,allCaps:u.allCaps,color:u.color,shading:u.shadingFill?{type:At.CLEAR,color:"auto",fill:u.shadingFill}:void 0,font:w.isEmoji?{ascii:Lt,hAnsi:Lt,cs:Lt}:{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 C=k(ut((d=p.style)==null?void 0:d.color,h,"color"));C&&(m.color=C);const M=qi(ut((f=p.style)==null?void 0:f.fontSize,h,"font-size"));M&&(m.sizeHalfPoints=M);const E=(x=ut((g=p.style)==null?void 0:g.textTransform,h,"text-transform"))==null?void 0:x.toLowerCase();if(E==="uppercase"?m.allCaps=!0:E&&Xi.has(E)&&(m.allCaps=void 0),Gi.has(b)){const T=k(ut((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:t.defaultTextColor}),l>1&&o.push(new H({break:l-1,font:{ascii:i,hAnsi:i},size:n})),o}function Vi(e,t,n){var r,o;const i=ve(t.documentFont),a=(t.leftMarginPx??40)*15,l=(t.rightMarginPx??40)*15,s=Ie(t,"paragraph"),c=(o=(r=t.componentColors)==null?void 0:r.paragraph)!=null&&o.textColor?k(t.componentColors.paragraph.textColor):void 0,u=kt(e,{...t,defaultTextColor:c||t.defaultTextColor},Ce(s.fontSize),{bold:s.bold,italic:s.italic,underline:s.underline});return new R({children:u.length>0?u:[new H({text:"",font:i})],alignment:st(ct(e))??Qe(s.textAlign),spacing:{before:n.before,after:n.after,line:We(s.fontSize,"paragraph",t),lineRule:Ue},indent:{left:a,right:l}})}const jn="\uE000";function Ki(e){const t=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html").querySelector("div");if(!t)return[""];t.querySelectorAll("br").forEach(r=>r.replaceWith(jn));const n=(t.textContent??"").replace(/[ \t\n\r\f]+/g," ").split(jn).map(r=>r.replace(/^ +| +$/g,"").replace(/\u00a0/g," "));return n.length>1&&n[n.length-1]===""&&n.pop(),n}function dt(e,t,n,r){var o,i;const a=ve(n.documentFont),l=(o=n.componentColors)==null?void 0:o.heading,s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=Ie(n,`h${t}`),d=(i=e.match(/\bid="(dest-[^"]+)"/i))==null?void 0:i[1],f=Ki(e);let g;if(l){const h=l[`h${t}`];h&&(g=k(h))}const x=k(l==null?void 0:l[`h${t}Bg`]),P={1:De.HEADING_1,2:De.HEADING_2,3:De.HEADING_3,4:De.HEADING_4},p=f.map((h,m)=>new H({break:m>0?1:void 0,text:h,font:a,size:Ce(u.fontSize),bold:u.bold,italics:u.italic,color:g,underline:u.underline?{}:void 0,shading:x?{type:At.CLEAR,color:"auto",fill:x}:void 0})),b=d?[new sn({id:d,children:p})]:p;return new R({children:b,heading:P[t],keepNext:!0,alignment:st(ct(e))??Qe(u.textAlign),spacing:{before:r.before,after:r.after,line:We(u.fontSize,`h${t}`,n),lineRule:Ue},indent:{left:s,right:c}})}function Wn(e){switch(e){case"a":return"lower-letter-numbering";case"i":return"lower-roman-numbering";default:return"default-numbering"}}function Un(e){var t,n;const r=(t=e.match(/<ol\b[^>]*>/i))==null?void 0:t[0];return((n=r==null?void 0:r.match(/\stype=["']?([^"'\s>]+)/i))==null?void 0:n[1])??null}let Ji=0;const _n=()=>Ji+=1;function qn(e,t,n,r){var o;const i=ve(n.documentFont),a=(o=n.componentColors)==null?void 0:o.list,l=Ie(n,"listText"),s=(n.leftMarginPx??40)*15,c=(n.rightMarginPx??40)*15,u=a!=null&&a.textColor?k(a.textColor):void 0,d=t?{reference:Wn(Un(e)),level:0,instance:_n()}:void 0,f=[],g=/<li[^>]*>(.*?)<\/li>/gi;let x;for(;(x=g.exec(e))!==null;)f.push(x[1]);return f.map((P,p)=>{const b=p===0,h=p===f.length-1,m=kt(P,{...n,defaultTextColor:u||n.defaultTextColor},Ce(l.fontSize),{bold:l.bold,italic:l.italic,underline:l.underline});return new R({children:m.length>0?m:[new H({text:"",font:i})],bullet:t?void 0:{level:0},numbering:d,alignment:Qe(l.textAlign),spacing:{before:b?r.before:0,after:h?r.after:90,line:We(l.fontSize,"listText",n),lineRule:Ue},indent:{left:s+360,hanging:360,right:c}})})}function Zi(e){const t=e.match(/<(p|h[1-4])(?:\s[^>]*)?>[\s\S]*?<\/\1>/gi);if(!t||t.length<2)return[e];const n=r=>{var o;return((o=new DOMParser().parseFromString(r,"text/html").body.textContent)==null?void 0:o.trim())??""};return t.map(n).join("").replace(/\s+/g,"")!==n(e).replace(/\s+/g,"")?[e]:t}const Rt="data-cell-list",Gn=/<(ul|ol)\b[^>]*>((?:(?!<(?:ul|ol)\b)[\s\S])*?)<\/\1>/i;function Qi(e){let t=e;for(let n=t.match(Gn);n;n=t.match(Gn)){const r=n[0],o=(n[1]??"").toLowerCase(),i=n[2]??"",a=o==="ol"?Un(r):null,l=o==="ol"?` ${Rt}-instance="${_n()}"`+(a?` ${Rt}-type="${a}"`:""):"",s=i.replace(/<li\b[^>]*>\s*<p\b/gi,`<p ${Rt}="${o}"${l}`),c=n.index??0;t=t.slice(0,c)+s+t.slice(c+r.length)}return t}const ea=e=>{var t,n,r,o;const i=(n=(t=e==null?void 0:e.match(/data-cell-list="(ul|ol)"/i))==null?void 0:t[1])==null?void 0:n.toLowerCase();if(i==="ul")return{kind:"ul"};if(i==="ol")return{kind:"ol",instance:Number(((r=e==null?void 0:e.match(/data-cell-list-instance="(\d+)"/i))==null?void 0:r[1])??0),type:((o=e==null?void 0:e.match(/data-cell-list-type="([^"]+)"/i))==null?void 0:o[1])??null}},ta=e=>{if(!e)return{};const t={left:360,hanging:360};return e.kind==="ul"?{bullet:{level:0},indent:t}:{numbering:{reference:Wn(e.type),level:0,instance:e.instance},indent:t}},Xn=15,Yn=e=>{var t;const n=Lo((t=e.componentColors)==null?void 0:t.table),r=Math.round(n.y*Xn),o=Math.round(n.x*Xn);return{top:r,bottom:r,left:o,right:o}},na=e=>{const t=Yn(e);return t.top+t.bottom},Vn=300,ra=100,oa=15840,ia=12240;function aa(e,t){var n;const r=parseInt(((n=e.match(/data-row-twips="(\d+)"/i))==null?void 0:n[1])??"",10);if(!Number.isFinite(r)||r<=0)return Vn;const o=t.isLandscape?ia:oa,i=t.contentHeightPx&&t.contentHeightPx>0?Math.round(t.contentHeightPx*15):o;return r>i?Vn:Math.max(ra,r-na(t))}function Kn(e,t){var n,r;const o=(n=t.componentColors)==null?void 0:n.table,i=Ie(t,"tableHeader").verticalAlign,a=Yn(t),l=ve(t.documentFont),s=(t.leftMarginPx??40)*15,c=lt(t),u=e.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(e))!==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 C;for(;(C=m.exec(e))!==null;){const M=C[1]??"",E=C[2]??"",T=C.index,A=P.findIndex(I=>T>=I.start&&T<I.end),w=(h.get(A)??0)+1;h.set(A,w);const N=(((r=P[A])==null?void 0:r.tag)??"tbody")==="tbody"&&w%2===0,j=[],Y=/<th[\s>]/i.test(E),se=/<td[\s>]/i.test(E),ne=Y&&!se;let ae=0;const ce=/<(th|td)([^>]*)>([\s\S]*?)<\/\1>/gi;let Ee;for(;(Ee=ce.exec(E))!==null;){const I=Ee[2]||"",Te=Ee[3]||"",Ye=(Ee[1]||"").toLowerCase()==="th",Oe=Ye&&ne,v=Ye&&!ne,F=Oe?"tableHeader":v?"tableHeaderColumn":"tableCell",$=Ie(t,F),L=v?$.verticalAlign??i:$.verticalAlign,U=(o==null?void 0:o.headerColumnText)||(o==null?void 0:o.headerText),ue=Oe?o!=null&&o.headerText?k(o.headerText):void 0:v?U?k(U):void 0:o!=null&&o.cellText?k(o.cellText):void 0,re=st(I),V=Zi(Qi(Te)),ge=V.map(D=>st(ct(D))),Ae=V.map(D=>ea(ct(D))),ee=V.map(D=>kt(D,{...t,defaultTextColor:ue},Ce($.fontSize),{bold:$.bold,italic:$.italic,underline:$.underline})),te=I.match(/colspan="(\d+)"/i),Z=te!=null&&te[1]?parseInt(te[1],10):void 0,le=I.match(/rowspan="(\d+)"/i),K=le!=null&&le[1]?parseInt(le[1],10):void 0,de=Z&&Z>1?Z:1,fe=K&&K>1?K:1;for(;(x[ae]??0)>0;)ae+=1;const me=ae;if(fe>1)for(let D=me;D<me+de;D+=1)x[D]=fe;ae=me+de;const Le=I.match(/data-colwidth="(\d+)"/i),Ve=I.match(new RegExp("(?<!min-)width:\\s*(\\d+)px","i")),rt=Le!=null&&Le[1]?parseInt(Le[1],10):Ve!=null&&Ve[1]?parseInt(Ve[1],10):void 0,Pt=rt?Math.round(rt*15):void 0,Ke=(d&&me+de<=d.length?d.slice(me,me+de).reduce((D,xe)=>D+xe,0):void 0)??Pt,ke=ee.map((D,xe)=>new R({children:D.length>0?D:[new H({text:"",font:l})],...ta(Ae[xe]),alignment:ge[xe]??re??Qe($.textAlign),spacing:{before:0,after:0,...t.previewContext==="export-preview"?{line:We($.fontSize,F,t),lineRule:Ue}:{line:240,lineRule:q.AUTO}}}));j.push(new on({children:ke,columnSpan:de>1?de:void 0,rowSpan:fe>1?fe:void 0,width:Ke?{size:Ke,type:He.DXA}:void 0,shading:(()=>{const D=I.match(/background-color:\s*([^;"]+)/i),xe=D!=null&&D[1]?k(D[1].trim()):void 0;if(xe)return{fill:xe};if(Oe&&o!=null&&o.headerBg)return{fill:k(o.headerBg)||"FFFFFF"};if(v){const ot=(o==null?void 0:o.headerColumnBg)||(o==null?void 0:o.headerBg);if(ot)return{fill:k(ot)||"FFFFFF"}}return!Ye&&N&&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:oe.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0,margins:{...a},verticalAlign:Ui(I,L)}))}for(let I=0;I<x.length;I+=1)x[I]=Math.max(0,(x[I]??0)-1);j.length>0&&g.push(new Et({children:j,cantSplit:!0,tableHeader:ne,height:{value:aa(M,t),rule:$o.ATLEAST}}))}return new Me({rows:g,layout:f?Tt.FIXED:Tt.AUTOFIT,...f?{columnWidths:d}:{},width:{size:f?d.reduce((M,E)=>M+E,0):c,type:He.DXA},indent:{size:s,type:He.DXA},borders:o!=null&&o.border?{top:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},bottom:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},left:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},right:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},insideHorizontal:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"},insideVertical:{style:oe.SINGLE,size:1,color:k(o.border)||"000000"}}:void 0})}function Jn(e){let t=e;for(;/<[^>]+>/.test(t);)t=t.replace(/<[^>]+>/g,"");return t}function la(e,t){var n;const r=ve(t.documentFont),o=(t.leftMarginPx??40)*15,i=(t.rightMarginPx??40)*15,a=(n=e.match(/\bdata-dest="(dest-[^"]+)"/i))==null?void 0:n[1];let l="dotted";/border-bottom:.*solid/i.test(e)?l="line":/border-bottom:.*dotted/i.test(e)?l="dotted":/font-weight:\s*500/i.test(e)||/margin-bottom:\s*8px/i.test(e)?l="modern":/font-size:\s*0\.9em/i.test(e)||/font-size:\s*0\.85em/i.test(e)?l="compact":/\[\d+\]|\[\.\.\.\]/.test(e)&&(l="simple");const s=e.match(/margin-left:\s*(\d+)px/),c=s?parseInt(s[1],10):0,u=/<span([^>]*)>(.*?)<\/span>/gi,d=[];let f;for(;(f=u.exec(e))!==null;)d.push({attrs:f[1]||"",content:f[2]||""});if(d.length<1)return null;const g=Jn(d[0].content.replace(/ /g," ").replace(/&/g,"&")).trim();let x="";for(let I=d.length-1;I>=1;I--){const Te=Jn(d[I].content).trim();if(/\d+/.test(Te)||Te==="..."){x=Te.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=Ie(t,"paragraph").fontSize,C=l==="compact"?m*.9:m,M=l==="compact"?m*.85:l==="modern"?m*.95:m,E=Ce(C),T=Ce(M),A=l==="simple"?"[":"",w=l==="simple"?"]":"",N=`${A}${x}${w}`,j=l==="dotted"?St.DOT:l==="line"?St.UNDERSCORE:St.NONE,Y=l==="modern"?60:l==="compact"?30:60,se=l==="modern"?180:l==="compact"?30:120,ne={font:r,size:T,bold:b||void 0,color:h},ae=t.tocPagerefFields&&a&&/^\d+$/.test(x)?[...A?[new H({...ne,text:A})]:[],...Mi(a,x,ne),...w?[new H({...ne,text:w})]:[]]:[new H({...ne,text:N})],ce=[new H({text:g,font:r,size:E,bold:void 0}),new H({children:[new Co],font:r,size:T}),...ae],Ee=a?[new No({anchor:a,children:ce})]:ce;return new R({children:Ee,tabStops:[{type:Fo.RIGHT,position:p,leader:j}],spacing:{before:Y,after:se,line:We(Math.max(C,M),"paragraph",t),lineRule:Ue},indent:{left:P,right:i}})}function sa(e,t){const n=(e.leftMarginPx??40)*15,r=(e.rightMarginPx??40)*15;return new R({children:[new H({text:""})],border:{bottom:{style:oe.SINGLE,size:6,space:1,color:"E0E0E0"}},spacing:{before:t.before,after:t.after,line:240,lineRule:q.AUTO},indent:{left:n,right:r}})}const ca=320,ua=3;function et(e){if(!e||!/^\d+(\.\d+)?$/.test(e.trim()))return;const t=Number(e);return t>0?t:void 0}function Ht(e,t,n){const r=ve(t.documentFont),o=(t.leftMarginPx??40)*15,i=(t.rightMarginPx??40)*15,a={style:oe.SINGLE,size:6,space:4,color:"E0E0E0"};return new R({children:[new H({text:e,font:r,size:kn,italics:!0})],border:{top:a,bottom:a,left:a,right:a},alignment:X.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO},indent:{left:o,right:i}})}function Dt(e,t,n){return Ht(`Chart: ${e} (see PDF export)`,t,n)}function zt(e,t,n){const r=e!=null&&e.trim()?`Image: ${e.trim()} (could not be embedded)`:"Image (could not be embedded)";return Ht(r,t,n)}async function da(e,t,n){var r;const o=new DOMParser().parseFromString(`<body>${e}</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=Ln(t),c=et(a.getAttribute("width")),u=et(a.getAttribute("height")),d=et((r=(o.getAttribute("style")||"").match(/height:\s*([\d.]+)px/i))==null?void 0:r[1]),f=c??s,g=u??d??ca;try{const x=await oi(a,{width:f,height:g,scale:ua}),P=Mt(x);if(P.length>0)return[new R({children:[new $e({type:"png",data:P,transformation:{width:f,height:g}})],alignment:X.CENTER,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO}})]}catch(x){console.error(`Failed to rasterize chart "${i}" for DOCX:`,x)}return[Dt(i,t,n)]}const l=o.querySelector("table");return l?[Kn(l.outerHTML,t)]:[Dt(i,t,n)]}function fa(e,t,n,r,o){let i=e,a=t;const l=!!n&&!!r;return!i&&!a&&l?(i=n,a=r):i&&l?a=i*(r/n):i&&!a?a=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 ha(e){return e==="center"?X.CENTER:e==="right"?X.RIGHT:X.LEFT}async function ga(e,t,n){const r=new DOMParser().parseFromString(`<body>${e}</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=et(r==null?void 0:r.getAttribute("width")),l=et(r==null?void 0:r.getAttribute("height")),s=ha(r==null?void 0:r.getAttribute("data-align"));if(!o)return zt(i,t,n);const c=Ln(t);try{const u=await Mo(o,void 0,"original")||o,d=u.startsWith("data:")?await wn(Mt(u),u):await gi(u);if(d.bytes.length===0)return zt(i,t,n);const{width:f,height:g}=fa(a,l,d.intrinsicWidth,d.intrinsicHeight,c);return new R({children:[new $e({type:d.type,data:d.bytes,transformation:{width:f,height:g}})],alignment:s,spacing:{before:n.before,after:n.after,line:240,lineRule:q.AUTO}})}catch(u){return console.error("Failed to embed inline image for DOCX:",u),zt(i,t,n)}}const pa=/^\s*<([a-z][a-z0-9]*)/i,Zn=e=>{var t,n;return((n=(t=e.match(pa))==null?void 0:t[1])==null?void 0:n.toLowerCase())??""};function ma(e){switch(Zn(e)){case"chartslot":return"chart";case"layoutslot":return"layout";case"h1":return/class="[^"]*section-title-from-h2/i.test(e)?"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 Bt=e=>e!=="table";function xa(e,t){const n=Hn(t.previewContext),r=e.map(s=>n[s]),o=t.containerWidthTwips===void 0,i=e.map((s,c)=>c===0&&!o?r[c].before:0),a=e.map((s,c)=>Bt(s)?r[c].after:0),l=e.map(()=>0);for(let s=1;s<e.length;s++){const c=Math.max(r[s-1].after,r[s].before);l[s]=c,Bt(e[s])?i[s]=Math.max(0,c-a[s-1]):Bt(e[s-1])&&(a[s-1]=c)}return{spacing:e.map((s,c)=>({before:i[c],after:a[c]})),collapsedGap:l}}const ba=2,ya=20;function wa(e){return new R({children:[new H({text:"",size:ba})],spacing:{before:0,after:e,line:ya,lineRule:q.EXACT}})}async function Qn(e,t={},n=!1){var r,o;const i=[],a=/<div[^>]*data-toc-page="[^"]*"[^>]*>.*?<\/div>/gi,l=e.match(a)||[];if(l.length>0){const b=e.match(/<h1[^>]*>(.*?)<\/h1>/i);if(b){const h=ve(t.documentFont),m=(r=t.componentColors)==null?void 0:r.heading,C=(t.leftMarginPx??40)*15,M=(t.rightMarginPx??40)*15,E=Ie(t,"h1");let T;if(m){const A=m.h1;A&&(T=k(A))}i.push(new R({children:[new H({text:((o=b[1])==null?void 0:o.replace(/<[^>]+>/g,"").trim())||"Table of Contents",font:h,size:Ce(E.fontSize),bold:E.bold,italics:E.italic,color:T,underline:E.underline?{}:void 0})],heading:De.HEADING_1,alignment:Qe(E.textAlign),spacing:{before:0,after:Hn(t.previewContext).h1.after,line:We(E.fontSize,"h1",t),lineRule:Ue},indent:{left:C,right:M}}))}for(const h of l)try{const m=la(h,t);m&&i.push(m)}catch(m){console.error("Failed to parse TOC item:",m)}return i}e=e.replace(/<div[^>]*data-page-break="true"[^>]*>.*?<\/div>/gis,""),e=e.replace(/<div[^>]*class="page-break-marker"[^>]*>.*?<\/div>/gis,"");const{html:s,containers:c}=wi(e);e=s;const u=[];if(/data-chart-type=/i.test(e)){const b=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");b.body.querySelectorAll("[data-chart-type]").forEach(h=>{const m=u.push(h.outerHTML)-1,C=b.createElement("chartslot");C.setAttribute("data-chart-idx",String(m)),h.replaceWith(C)}),e=b.body.innerHTML}e=e.replace(/<div[^>]*class="page-content[^"]*"[^>]*>/gi,""),e=e.replace(/<\/div>/gi,""),e=e.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=e.match(d)||[],g=f.map(ma),{spacing:x,collapsedGap:P}=xa(g,t);let p=0;for(let b=0;b<f.length;b++){const h=f[b],m=x[b],C=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(Zn(h)){case"chartslot":{const w=h.match(/data-chart-idx="(\d+)"/i),N=w?u[Number(w[1])]:void 0;N?i.push(...await da(N,t,E)):i.push(Dt("chart",t,E));break}case"layoutslot":{const w=h.match(/data-layout-idx="(\d+)"/i),N=w?c[Number(w[1])]:void 0;N?i.push(...await Ni(N,t,Qn)):i.push(Ht("Layout section (see PDF export)",t,E));break}case"h1":{const w=/class="[^"]*section-title-from-h2/i.test(h)?2:1;i.push(dt(h,w,t,E));break}case"h2":i.push(dt(h,2,t,E));break;case"h3":i.push(dt(h,3,t,E));break;case"h4":i.push(dt(h,4,t,E));break;case"ul":i.push(...qn(h,!1,t,E));break;case"ol":i.push(...qn(h,!0,t,E));break;case"table":i.push(Kn(h,t));break;case"hr":i.push(sa(t,E));break;case"img":i.push(await ga(h,t,E));break;default:i.push(Vi(h,t,E))}}catch(w){console.error("Failed to parse block:",h,w)}const T=i[C]instanceof Me,A=T&&i[C-1]instanceof Me;if(C>0&&T&&(A||M>0)&&i.splice(C,0,wa(M)),i.length>C){const w=i[i.length-1]instanceof Me,N=g[b]!=="layout";p=w||!N?0:m.after}}return i.length===0&&i.push(new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}})),i}const va=["MM/DD/YYYY","DD/MM/YYYY","DD MMM YYYY","MMM DD, YYYY","YYYY-MM-DD"];function Pa(e){return typeof e=="string"&&va.includes(e)}const jt=987654321,ft=987654322,Wt=/\{%[^%\n]*%\}/g;function er(e){const t=e.slice(2,-2).toLowerCase();return t==="page_number"?"page-number":t==="total_pages"?"total-pages":"text"}function Ea(e){return JSON.stringify([e.bold??!1,e.italics??!1,e.underline??!1,e.strike??!1,e.color??"",e.fontSizePx??0,e.fontFamily??""])}function _e(e,t,n,r=!1){const o=e==="text"?{kind:e,text:t,...n}:{kind:e,...n};return r?{...o,hiddenAtPageZero:!0}:o}function Ta(e,t){return Ct(e==="page-number"?"{%page_number%}":"{%total_pages%}",{pageNumber:0,variableValues:t.variableValues,currentDateText:t.currentDateText})===""}function Aa(e,t,n){const r=[];let o="",i=null,a={};const l=()=>{i!==null&&o!==""&&r.push(_e("text",o,a)),o="",i=null};for(const s of e){const c=t(s.rawIndex);if(s.kind!=="text"){l(),r.push(_e(s.kind,"",c,Ta(s.kind,n)));continue}if(s.text==="")continue;const u=Ea(c);u!==i&&(l(),i=u,a=c),o+=s.text}return l(),r}function ht(e,t,n){const r={pageNumber:0,variableValues:n.variableValues,currentDateText:n.currentDateText},o=[];let i=0;for(const a of e.matchAll(Wt)){const l=a.index;for(let u=i;u<l;u++)o.push({kind:"text",text:e[u],rawIndex:u});const s=a[0],c=er(s);o.push({kind:c,text:c==="text"?Ct(s,r):"",rawIndex:l}),i=l+s.length}for(let a=i;a<e.length;a++)o.push({kind:"text",text:e[a],rawIndex:a});return Aa(o,t,n)}function tr(e){for(const t of e.matchAll(Wt))if(er(t[0])!=="text")return!0;return!1}function nr(e,t){const n={pageNumber:t.pageNumber,totalPages:t.totalPages,variableValues:t.variableValues,currentDateText:t.currentDateText},r=new Array(e.length+1);let o="",i=0;const a=(l,s)=>{for(let c=l;c<s;c++)r[c]=o.length,o+=e[c]};for(const l of e.matchAll(Wt)){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+=Ct(c,n),i=s+c.length}return a(i,e.length),r[e.length]=o.length,{painted:o,paintedOffsets:r}}function rr(e,t){const n=un(e,jt,ft),r=un(e,0,ft)==="",o=[];for(const i of n.split(new RegExp(`(${jt}|${ft})`)))i!==""&&(i===String(jt)?o.push(_e("page-number","",t,r)):i===String(ft)?o.push(_e("total-pages","",t,r)):o.push(_e("text",i,t,r)));return o}function or(e,t,n){const r=e==null?void 0:e.pageNumberFormat;if(!cn(r))return null;const o=ko(e,n.pageNumber,n.totalPages);return o===void 0?null:{runs:rr(r,t),painted:o}}function Sa(e,t,n){const r=e,o=r==null?void 0:r.pageNumberFormat;if(cn(o))return rr(o,t);const i=r==null?void 0:r.dateFormat;return Pa(i)?[_e("text",Ro(i,n),t)]:null}const ir=new Set(["paragraph","heading","blockquote"]),Ca=e=>(e.content??[]).some(t=>ir.has(t.type??""));function ar(e){const t=e;if(!t||typeof t!="object"||!Array.isArray(t.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:ir.has(a.type??"")&&!Ca(a)&&(o>0&&(n+=`
|
|
3
3
|
`),o++);break}for(const s of a.content??[])i(s)};return i(t),r?n:null}const tt=e=>e==="page",Na=["fontFamily","fontSize","fontWeight","fontStyle","underline","linethrough","fill"];function y(e){return typeof e=="number"&&Number.isFinite(e)}function Ut(e){if(typeof e!="string")return;const t=e.trim(),n=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(t);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(t);if(!r){const i=t.toLowerCase();if(!/^(?![a-f]+$)[a-z]+$/.test(i)||i in Object.prototype)return;const a=new jo(i);return a.isUnrecognised||a.getAlpha()===0?void 0:`#${a.toHex().toLowerCase()}`}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 _t(e){if(typeof e=="number")return e>=600;if(typeof e!="string")return!1;if(e.toLowerCase()==="bold"||e.toLowerCase()==="bolder")return!0;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=600}function lr(e,t){const n={};_t(e.fontWeight)&&(n.bold=!0);const r=e.fontStyle;(r==="italic"||r==="oblique")&&(n.italics=!0),e.underline===!0&&(n.underline=!0),e.linethrough===!0&&(n.strike=!0);const o=Ut(e.fill);return o&&(n.color=o),y(e.fontSize)&&e.fontSize>0&&(n.fontSizePx=e.fontSize*t),typeof e.fontFamily=="string"&&e.fontFamily.trim()!==""&&(n.fontFamily=e.fontFamily.replace(/['"]/g,"").trim()),n}function sr(e){const t={};if(!e)return t;for(const n of Na)e[n]!==void 0&&(t[n]=e[n]);return t}function qt(e,t,n){return e.map(r=>r.runs.reduce((o,i)=>Math.max(o,i.fontSizePx??t),t)*n)}const Fa="000",Ma=.75;let gt;function $a(){if(gt===void 0)try{gt=document.createElement("canvas").getContext("2d")}catch{gt=null}return gt}function cr(e,t,n){const r=$a();if(!r)return null;try{const o=t.fontFamily??"sans-serif";r.font=`${t.italics?"italic ":""}${t.bold?"bold ":""}${n}px "${o}"`;const i=r.measureText(e).width;return y(i)?i:null}catch{return null}}function Ia(e,t,n){const r=t.fontSizePx??n,o=e.length*r*Ma,i=cr(e,t,r);return i===null?o:Math.max(i,o)}const ur=e=>e.lines.some(t=>t.runs.some(n=>n.kind==="page-number"||n.kind==="total-pages"));function Oa(e){const t=e.totalPages;return y(t)&&t>0?String(Math.trunc(t)):Fa}function La(e,t,n){if(!t||!ur(e))return e;const r=Oa(n),o=e.lines.reduce((i,a,l)=>{var s;const c=((s=e.linePitchPx)==null?void 0:s[l])??e.lineHeightPx,u=a.runs.reduce((d,f)=>d+Ia(f.kind==="text"?f.text??"":r,f,c),0);return Math.max(i,u)},0);return{...e,widthPx:o,align:"left"}}function pt(e){return e==="center"?"center":e==="right"?"right":"left"}function ka(e){return e&&typeof e=="object"?e:null}function Ra(e){const t=typeof e.rawText=="string"&&e.rawText!==""?e.rawText:null,n=typeof e.text=="string"?e.text:null;let r=t??n,o=ka(t?e.rawStyles:e.styles);if(r===null)return null;if(e.richContent!=null&&!r.includes("{%")){const a=ar(e.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=e=>e.map((t,n)=>({text:t,sourceLineIndex:n,sourceCharOffset:0}));function dr(e){const t=e._textLines;return!Array.isArray(t)||typeof e.text!="string"?!1:t.length!==e.text.split(`
|
|
@@ -7,5 +7,5 @@ import{hP as po,hQ as rn,hR as we,hS as mo,hT as xo,hU as bo,hV as yo,hW as Et,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 e;const i=Bo(o,t),a=e.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 el(e,t,n,r,o,i){var a;const l=(a=e.getBoundingRect)==null?void 0:a.call(e);if(!l||!y(l.left)||!y(l.top))return null;const s=vr(e,t,"scaleY"),c=sr(e),u=lr(c,s),d=Sa(e,u,o),f=!d&&i&&dr(e),g=f?Da(e,n):null;if(f&&!g)return null;const x=d?null:g??Ha(n.lines),P=d?[{runs:d}]:x.map(({text:m,sourceLineIndex:C,sourceCharOffset:M})=>({runs:ht(m,E=>{var T,A;const w=(A=(T=n.styles)==null?void 0:T[C])==null?void 0:A[M+E];return w?lr({...c,...sr(w)},s):u},r)}));if(P.every(m=>m.runs.length===0))return null;const p=x?x.map((m,C)=>C===0||m.sourceLineIndex!==x[C-1].sourceLineIndex):[!0],b=y(e.fontSize)&&e.fontSize>0?e.fontSize:0,h=y(e.lineHeight)&&e.lineHeight>0?e.lineHeight:1;return{leftPx:l.left,topPx:l.top,widthPx:l.width,heightPx:l.height,align:pt(e.textAlign),lineHeightPx:b*h*s,linePitchPx:qt(P,b*s,h),lines:Qa(P,e.textTransform,p)}}function tl(e){return String(e.type??"").toLowerCase()!=="textbox"}function nl(e,t,n){if(mr(e.textAlign))return null;const r=e._textLines;if(!Array.isArray(r)||r.length===0||typeof e.getLineWidth!="function")return null;const o=[];for(let i=0;i<r.length;i+=1){const a=e.getLineWidth(i);if(!y(a))return null;o.push(a*n)}return xr(t,o)}function Pr(e,t,n,r,o,i,a,l){for(const s of e){if(!s||typeof s!="object")continue;const c=s,u=Ra(c),d=r==="band"&&Gt((u==null?void 0:u.lines)??null,c,n);if(u&&za(c,t,u.lines,d,tt(r))){if(yr(c,l))continue;const g=el(c,t,u,n,o,tt(r));g&&Yt(i,g,()=>Za(c),r,tl(c),n,a,x=>nl(c,x,vr(c,t,"scaleX")));continue}const f=wr(c);f.length>0&&Pr(f,[...t,c],n,r,o,i,a,l)}}const rl=e=>[...Array.isArray(e.children)?e.children:[],...Array.isArray(e.objects)?e.objects:[]];function ol(e,t){const n=e==null?void 0:e.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===t)return o;r.push(...rl(o))}}return null}function il(e,t){const n=ol(e,t.id);if(!n)return null;if(Ho(n))return n;if(t.textIndex<0)return null;const r=[];return Do([n],o=>r.push(o)),r[t.textIndex]??null}function Er(e,t){return!t||e.sourceCanvasJson==null?null:il(e.sourceCanvasJson,t)}function Vt(e){if(!e)return null;const t=typeof e.text=="string"?e.text:null,n=ar(e.richContent)??t;return n===null?null:n.split(`
|
|
8
8
|
`)}const mt=e=>e.replace(/\s+/g," ").trim();function al(e){const{kind:t,text:n,hiddenAtPageZero:r,...o}=e;return o}function Tr(e){var t;const n=[];for(const r of e.runs){const o=al(r);for(let i=0;i<(((t=r.text)==null?void 0:t.length)??0);i++)n.push(o)}return n}function Ar(e,t,n,r){const o=fr(n);if(!t||!o)return e;const i=e.lines.map(u=>u.runs.map(d=>d.text??"").join("")),a=u=>Tr(e.lines[u]??{runs:[]})[0]??r,l=or(t,a(0),o);if(l)return e.lines.length!==1||mt(l.painted)!==mt(i[0])?e:{...e,lines:[{runs:l.runs}]};const s=Vt(t);if(s===null||!s.some(tr)||s.length!==e.lines.length)return e;const c=s.map(u=>nr(u,o));for(const[u,d]of i.entries())if(mt(c[u].painted)!==mt(d))return e;return{...e,lines:s.map((u,d)=>{const f=Tr(e.lines[d]),g=c[d].paintedOffsets,x=a(d);return{runs:ht(u,P=>f[g[P]??0]??x,n)}})}}function ll(){var e;const t=(e=globalThis.Konva)==null?void 0:e.stages;return Array.isArray(t)?t:[]}function sl(e){return ll().find(t=>{var n,r;return(r=(n=t.container)==null?void 0:n.call(t))==null?void 0:r.contains(e)})??null}function Sr(e,t){const n={},r=typeof e.fontStyle()=="string"?e.fontStyle():"";/italic|oblique/i.test(r)&&(n.italics=!0),_t(r.replace(/italic|oblique|normal/gi,"").trim())&&(n.bold=!0);const o=typeof e.textDecoration()=="string"?e.textDecoration():"";o.includes("underline")&&(n.underline=!0),o.includes("line-through")&&(n.strike=!0);const i=Ut(e.fill());i&&(n.color=i);const a=e.fontSize();y(a)&&a>0&&(n.fontSizePx=a*t);const l=Mr(e.fontFamily());return l&&(n.fontFamily=l),n}function cl(e){for(let r=e.getParent();r;r=r.getParent()){const o=r.id();if(!(typeof o!="string"||o==="")){if(r.find("Text").length===1)return o;break}}const t=e.id();if(typeof t=="string"&&t!=="")return t;qe+=1;const n=`band-text-lift-${qe}`;return e.id(n),n}function ul(e,t,n){if(!e.isVisible()||e.getAbsoluteOpacity()!==1||e.hasShadow()||e.getAbsoluteRotation()!==0)return!1;const r=e.text();if(typeof r!="string")return!1;if(r.trim()==="")return t;const o=e.textArr;return!Array.isArray(o)||o.length===r.split(`
|
|
9
9
|
`).length?!0:n&&!r.includes("{%")}function dl(e,t){const n=e.text().split(`
|
|
10
|
-
`);if(!t)return n;const r=e.textArr;return!Array.isArray(r)||r.length===n.length?n:r.map(o=>typeof(o==null?void 0:o.text)=="string"?o.text:"")}function Cr(e,t){var n;const r=(n=e.attrs)==null?void 0:n[t];return r==null||r==="auto"}function Nr(e){const t=e.getAbsoluteScale();return y(t==null?void 0:t.y)&&t.y>0?t.y:1}function fl(e,t,n,r,o){const i=e.getClientRect({relativeTo:t,skipShadow:!0,skipStroke:!0});if(!i||!y(i.x)||!y(i.y))return null;const a=e.getAbsoluteScale(),l=y(a==null?void 0:a.x)&&a.x>0?a.x:1,s=Nr(e),c=Sr(e,s),u=dl(e,o),d=u.map(m=>({runs:ht(m,()=>c,n)}));if(!r&&d.every(m=>m.runs.length===0))return null;const f=y(e.fontSize())?e.fontSize():0,g=f*(y(e.lineHeight())?e.lineHeight():1),x=u.length*g,P=y(e.padding())?e.padding():0,p=e.verticalAlign(),b=e.getHeight()-x-P*2,h=Cr(e,"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:pt(e.align()),lineHeightPx:g*s,linePitchPx:qt(d,f*s,y(e.lineHeight())?e.lineHeight():1),lines:d}}function hl(e,t){if(mr(e.align()))return null;const n=e.textArr;if(!Array.isArray(n)||n.length===0)return null;const r=e.getAbsoluteScale(),o=y(r==null?void 0:r.x)&&r.x>0?r.x:1,i=[];for(const a of n){if(!y(a==null?void 0:a.width))return null;i.push(a.width*o)}return xr(t,i)}function gl(e){for(let n=e.getParent();n;n=n.getParent()){const r=n.id();if(!(typeof r!="string"||r===""))return{id:r,textIndex:n.find("Text").indexOf(e)}}const t=e.id();return typeof t=="string"&&t!==""?{id:t,textIndex:0}:null}function pl(e){return!e.isVisible()||e.getClassName()==="Text"?!1:e.getAbsoluteOpacity()>0}function ml(e,t){const n=e.getClientRect({relativeTo:t});return!n||!y(n.x)||!y(n.y)||!y(n.width)||!y(n.height)?null:{leftPx:n.x,topPx:n.y,widthPx:n.width,heightPx:n.height}}function xl(e){const t=[],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,t.length),t.push({occludes:pl(o),rect:ml(o,e)})};return r(e),{steps:t,indexOf:n}}function Fr(e,t,n,r,o,i,a){var l;if(e.getClassName()==="Text"){const c=e,u=r==="band"?Er(n,gl(c)):null,d=r==="band"&&Gt(Vt(u),u,n);if(!ul(c,d,tt(r))||yr(c,a))return;const f=fl(c,t,n,d,tt(r));if(!f)return;const g=Ar(f,u,n,Sr(c,Nr(c)));if(g.lines.every(x=>x.runs.length===0))return;Yt(o,g,()=>cl(c),r,Cr(c,"width"),n,i,x=>hl(c,x));return}const s=(l=e.getChildren)==null?void 0:l.call(e);if(s)for(const c of s)Fr(c,t,n,r,o,i,a)}function xt(e){const t=/^(-?\d*\.?\d+)px$/.exec((e??"").trim());if(!t)return;const n=Number.parseFloat(t[1]);return Number.isFinite(n)?n:void 0}function Mr(e){var t;if(typeof e!="string")return;const n=(t=e.split(",")[0])==null?void 0:t.replace(/['"]/g,"").trim();return n!==void 0&&n!==""?n:void 0}const bl="ul, ol, mark, img, table",nt=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","LI"]),Kt=e=>Array.from(e.children).some(t=>nt.has(t.tagName));function bt(e,t){const n={...t};switch(e.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=e.style;r.fontWeight!==""&&(_t(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=Ut(r.color);i&&(n.color=i);const a=Mr(r.fontFamily);a&&(n.fontFamily=a);const l=xt(r.fontSize);return l!==void 0&&l>0&&(n.fontSizePx=l),n}function $r(e){const t=(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=bt(i,o);for(const l of Array.from(i.childNodes)){const s=t(l,a);if(s)return s}return i.childNodes.length===0?a:null},n=bt(e,{});for(const r of Array.from(e.childNodes)){const o=t(r,n);if(o)return o}return n}function yl(e,t){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||!nt.has(f.tagName)||f.childNodes.length!==1)&&i();return}nt.has(u.tagName)&&!Kt(u)&&(o>0&&i(),o+=1);const d=bt(u,c);for(const f of Array.from(u.childNodes))l(f,d)};for(const s of Array.from(e.childNodes))l(s,t);return{lines:n,charStyles:r}}const wl=(e,t)=>e.bold===t.bold&&e.italics===t.italics&&e.underline===t.underline&&e.strike===t.strike&&e.color===t.color&&e.fontSizePx===t.fontSizePx&&e.fontFamily===t.fontFamily;function vl(e){let t=null;for(const n of e.charStyles)for(const r of n)if(t===null)t=r;else if(!wl(t,r))return null;return t}const Pl=1,El=e=>e.replace(/\s+/g," ");function Tl(e){const t=[];let n=0;for(let r=1;r<e.length;r++)/\s/.test(e[r-1])&&!/\s/.test(e[r])&&(t.push(e.slice(n,r)),n=r);return t.push(e.slice(n)),t}function Al(e,t,n,r){const o=s=>cr(El(s),t,n),i=o(e);if(i===null||i<=r)return[e];const a=[];let l="";for(const s of Tl(e)){const c=l+s,u=o(c.trimEnd());if(u===null)return[e];l.trim()!==""&&u>r?(a.push(l.trimEnd()),l=s):l=c}return a.push(l),a}function Sl(e,t,n){if(Ir(t)||e.lines.some(l=>l.includes("{%")))return e;const r=vl(e),o=r==null?void 0:r.fontSizePx;if(!r||!y(o)||o<=0)return e;const i=[],a=[];for(const l of e.lines)for(const s of Al(l,r,o,n+Pl))i.push(s),a.push(new Array(s.length).fill(r));return{lines:i,charStyles:a}}function Cl(e){for(const t of Array.from(e.querySelectorAll("*")))if(nt.has(t.tagName)&&!Kt(t)){if(t.style.textAlign!=="")return pt(t.style.textAlign);break}return pt(e.style.textAlign)}function Nl(e,t,n,r){if(e.querySelector(bl))return null;const o=e.style.opacity;if(o!==""&&Number.parseFloat(o)!==1)return null;const i=/rotate\(\s*(-?\d*\.?\d+)deg/.exec(e.style.transform??"");if(i&&Number.parseFloat(i[1])!==0)return null;const a=Number.parseFloat(e.dataset.expectedLeft??""),l=Number.parseFloat(e.dataset.expectedTop??""),s=xt(e.style.width)??xt(e.style.minWidth);if(!y(a)||!y(l)||s===void 0||s<=0)return null;const c=bt(e,{}),u=c.fontSizePx??0,d=Number.parseFloat(e.style.lineHeight);if(u<=0||!y(d)||d<=0)return null;const f=yl(e,c),g=r?Sl(f,e,s):f,x=g.lines.map((h,m)=>({runs:ht(h,C=>{var M;return((M=g.charStyles[m])==null?void 0:M[C])??c},t)}));if(!n&&x.every(h=>h.runs.length===0))return null;const P=x.every(h=>h.runs.length===0)?$r(e).fontSizePx??u:u,p=qt(x,Math.max(u,P),d),b=p.reduce((h,m)=>h+m,0);return e.offsetHeight>b+2?null:{leftPx:a,topPx:l,widthPx:s,heightPx:b,align:Cl(e),lineHeightPx:u*d,linePitchPx:p,lines:x}}function Fl(e,t){const n=e.getBoundingClientRect();if(!y(n==null?void 0:n.left)||!y(n.top))return null;const r=n.width>0&&e.offsetWidth>0?n.width/e.offsetWidth:1;if(!y(r)||r<=0)return null;const o=Array.from(e.querySelectorAll("*")).filter(c=>nt.has(c.tagName)&&!Kt(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:[e]){const u=document.createRange();u.selectNodeContents(c);const d=u.getBoundingClientRect();if(!y(d==null?void 0:d.left)||!y(d.top)||!y(d.width)||!y(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!y(i)||!y(a)?null:{leftPx:t.leftPx+(i-n.left)/r,topPx:t.topPx+(a-n.top)/r,widthPx:(l-i)/r,heightPx:(s-a)/r}}const Ir=e=>xt(e.style.width)===void 0;function Ml(e){const t=e.dataset.objId;if(typeof t=="string"&&t!=="")return t;qe+=1;const n=`band-text-lift-${qe}`;return e.dataset.objId=n,n}function $l(e){return e.querySelector("canvas.lower-canvas")??e.querySelector("canvas")}function Or(e,t,n,r){var o,i,a;try{const l=$l(e);if(!l)return null;const s=l.__fabric;if(s&&typeof s.getObjects=="function"){const u={items:[],liftedObjectIds:[]},d=Ba(s);d||(o=r==null?void 0:r.onUnreadableBounds)==null||o.call(r);const f=s.getObjects();return Pr(f,[],t,n,new Date,u,d,Ja(f)),u}const c=sl(l);if(c){const u={items:[],liftedObjectIds:[]},d=ja(c);d||(i=r==null?void 0:r.onUnreadableBounds)==null||i.call(r),Fr(c,c,t,n,u,d,xl(c));for(const f of Array.from(e.querySelectorAll(".text-rich-display"))){const g=f.dataset.objId,x=n==="band"&&g?Er(t,{id:g,textIndex:0}):null,P=n==="band"&&Gt(Vt(x),x,t),p=Nl(f,t,P,tt(n));if(!p)continue;const b=Ar(p,x,t,$r(f));b.lines.every(h=>h.runs.length===0)||Yt(u,b,()=>Ml(f),n,Ir(f),t,d,h=>Fl(f,h))}return u}return null}catch(l){return(a=r==null?void 0:r.onError)==null||a.call(r,l),null}}function Il(e,t,n){return Or(e,t,"band",n)}function Ol(e,t,n){return Or(e,t,"page",n)}const Ll=9525,kl=15,Ge=e=>Math.round(e*Ll),Rl=e=>Math.round(e*kl),Hl="http://schemas.openxmlformats.org/drawingml/2006/main",Dl="http://schemas.microsoft.com/office/word/2010/wordprocessingShape",zl={left:X.LEFT,center:X.CENTER,right:X.RIGHT},Lr=900,Bl=251658240,jl=e=>({id:Lr+e,name:`Editable text ${Lr+e}`,relativeHeight:Bl+e});function Ne(e){const t=dn.fromXmlString(e).root,[n,...r]=t;if(r.length>0||!(n instanceof dn))throw new Error(`expected exactly one root element, got ${t.length}, in: ${e}`);return n}function kr(e,t,n){if(!Number.isFinite(e)||e<=0)throw new Error(`anchored text box ${t} is not a positive EMU extent (${e}) for "${n.name}": ${n.widthPx}x${n.heightPx}px at (${n.pageLeftPx}, ${n.pageTopPx})`);return e}function Wl(e){const t=kr(Ge(e.widthPx),"cx",e),n=kr(Ge(e.heightPx),"cy",e),r=Ne(`<wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${t}" 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=Ne("<w:txbxContent/>");for(const u of e.lines)o.push(new R({alignment:zl[e.align],spacing:{before:0,after:0,line:Rl(u.linePitchPx),lineRule:q.EXACT},children:[...u.runs]}));const i=Ne("<wps:txbx/>");i.push(o),r.push(i),r.push(Ne('<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=Ne(`<a:graphicData uri="${Dl}"/>`);a.push(r);const l=Ne(`<a:graphic xmlns:a="${Hl}"/>`);l.push(a);const s=Ne(`<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" relativeHeight="${e.relativeHeight}" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1"><wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="page"><wp:posOffset>${Ge(e.pageLeftPx)}</wp:posOffset></wp:positionH><wp:positionV relativeFrom="page"><wp:posOffset>${Ge(e.pageTopPx)}</wp:posOffset></wp:positionV><wp:extent cx="${t}" cy="${n}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${e.id}" name="${e.name}"/><wp:cNvGraphicFramePr/></wp:anchor>`);s.push(l);const c=Ne("<w:drawing/>");return c.push(s),c}const Ul=e=>new R({children:[new H({children:[Wl(e)]})],spacing:{before:0,after:0,line:1,lineRule:q.EXACT}}),Rr=1.5,_l=.02,Hr=16,ql=.5/Rr;function Dr(e,t){let n=0;for(const r of e.lines)for(const o of r.runs){const i=(o.fontSizePx??Hr)*t;i>0&&(n=Math.max(n,ql/i))}return n}const Gl=e=>Math.round(e*Rr);function Xl(e,t,n){return e==="center"?t-n/2:e==="right"?t-n:t}const Yl=(e,t,n)=>({font:ve(e.fontFamily??t),size:Gl((e.fontSizePx??Hr)*n),color:e.color,bold:e.bold,italics:e.italics,strike:e.strike,underline:e.underline?{}:void 0}),zr=e=>e.totalPagesAsField||e.resolvedTotalPages===void 0;function Vl(e,t){return e.kind==="page-number"?{field:"PAGE"}:e.kind==="total-pages"?zr(t)?{field:"NUMPAGES"}:{literal:t.resolvedTotalPages??""}:{literal:e.text??""}}function Kl(e,t,n,r){const o=Yl(e,t,r);return e.hiddenAtPageZero?[...Li(Vl(e,n),o)]:e.kind==="page-number"?[$i(o)]:e.kind==="total-pages"?[zr(n)?Ii(o):new H({...o,text:n.resolvedTotalPages??""})]:[new H({...o,text:e.text??""})]}function Br(e,t,n,r){const o=e.widthPx*t.scale,i=o*(_l+(t.extraWidthPadRatio??0));return Ul({...jl(t.itemIndex),pageLeftPx:Xl(e.align,t.pageLeftPx,i),pageTopPx:t.pageTopPx,widthPx:o+i,heightPx:e.heightPx*t.scale,align:e.align,lines:e.lines.map((a,l)=>{var s;return{linePitchPx:(((s=e.linePitchPx)==null?void 0:s[l])??e.lineHeightPx)*t.scale,runs:a.runs.flatMap(c=>Kl(c,n,r,t.scale))}})})}function jr(e){return new R({children:[new $e({type:e.type,data:e.data,transformation:{width:e.widthPx,height:e.heightPx},floating:{horizontalPosition:{relative:_o.PAGE,offset:Ge(e.offsetXPx)},verticalPosition:{relative:Uo.PAGE,offset:Ge(e.offsetYPx)},behindDocument:!0,allowOverlap:!0,wrap:{type:Wo.NONE}}})],spacing:{before:0,after:0,line:1,lineRule:q.EXACT}})}const Jl=(e,t)=>t.bandKind==="header"?e.topPx:t.pageHeightPx-t.bandHeightPx+e.topPx,Zl=e=>e.bandKind==="header"?0:e.pageHeightPx-e.bandHeightPx,Ql=(e,t)=>new R({children:[new $e({type:e.type,data:e.data,transformation:{width:t.pageWidthPx,height:t.bandHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO}});function es(e,t,n,r,o){return e.items.length===0?[Ql(t,n)]:[jr({...t,widthPx:n.pageWidthPx,heightPx:n.bandHeightPx,offsetXPx:0,offsetYPx:Zl(n)}),...e.items.map((i,a)=>Br(i,{pageLeftPx:i.leftPx,pageTopPx:Jl(i,n),scale:1,itemIndex:a,extraWidthPadRatio:Dr(i,1)},r,o))]}const ts={totalPagesAsField:!1},ns=e=>e.displayWidthPx/e.canvasWidthPx,rs=e=>e.displayHeightPx/e.canvasHeightPx;function Wr(e,t,n){if(!Number.isFinite(e)||e<=0)throw new Error(`canvas page ${t} scale is not a positive number (${e}): ${JSON.stringify(n)}`);return e}const os=(e,t)=>new R({children:[new $e({type:e.type,data:e.data,transformation:{width:t.displayWidthPx,height:t.displayHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO},alignment:X.CENTER});function is(e){for(const t of e.lines)for(const n of t.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 as(e,t,n,r,o=0){if(e.items.length===0)return[os(t,n)];e.items.forEach(is);const i=Wr(ns(n),"horizontal",n),a=Wr(rs(n),"vertical",n);return[jr({...t,widthPx:n.displayWidthPx,heightPx:n.displayHeightPx,offsetXPx:n.offsetXPx,offsetYPx:0}),...e.items.map((l,s)=>Br(l,{pageLeftPx:l.leftPx*i+n.offsetXPx,pageTopPx:l.topPx*a,scale:i,itemIndex:o+s,extraWidthPadRatio:Dr(l,i)},r,ts))]}const ls="data-table-continuation",ss="data-cloned-header-row",cs="data-paragraph-continuation",us="data-list-continuation",ds=["UL","OL"],fs='[data-page-break="true"]',hs=e=>/display:\s*none/.test(e.getAttribute("style")??""),Ur=e=>Array.from(e.children).filter(t=>!hs(t)),Jt=(e,t,n,r)=>e.tagName===n&&t.tagName===n&&e.getAttribute(r)==="true",gs=(e,t)=>{const n=e.querySelector(":scope > tbody")??e;t.querySelectorAll(":scope > tbody > tr, :scope > tr").forEach(r=>{r.getAttribute(ss)!=="true"&&n.appendChild(r)})},_r=e=>e.querySelector(fs)!==null;function ps(e,t){const n=Ur(e),r=n[n.length-1],o=Ur(t)[0];if(r&&o){if(Jt(o,r,"TABLE",ls))gs(r,o),o.remove();else if(Jt(o,r,"P",cs))r.textContent=`${r.textContent??""} ${o.textContent??""}`.trim(),o.remove();else if(ds.some(i=>Jt(o,r,i,us))){for(;o.firstChild;)r.appendChild(o.firstChild);o.remove()}}for(;t.firstChild;)e.appendChild(t.firstChild)}const ms=8,xs=40,Zt=4,bs=95,ys=4e8,ws=e=>e.width*e.height*Zt*Zt,vs={format:"jpeg",quality:bs},Ps={format:"png",omitBackground:!0},yt=e=>`page:${e}`,Xe=(e,t)=>`${t}:${e}`,qr=e=>e&&e.items.length>0?e.liftedObjectIds:void 0;async function Es(e){await Go(),await ri(e)}async function Ts(e,t,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<e.length;d++){const f=e[d],g=t[d],x=n[d];if(!f||!g||!x)continue;if(it(f)){try{const p=qr(o==null?void 0:o.get(d)),b=Xo(f),h=f.useFabric?(await xn(x,{...p?{hideObjectIds:p,stripRichTextOverlays:!0}:{},expectNonBlankCanvas:b})).outerHTML:await ni(x,g.width,g.height,d+1,{...p?{hideObjectIds:p}:{},expectNonBlankCanvas:b});h&&u(yt(d),h,{width:g.width,height:g.height},"page")}catch(p){s.set(yt(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=Xe(d,p.kind);try{const m=qr(r==null?void 0:r.get(h)),C=await xn(b,m?{hideObjectIds:m,stripRichTextOverlays:!0}:{});u(h,C.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=yt(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 As(e){const{pages:t,geometry:n,documentFont:r,componentColors:o,documentMargins:i,bandExtractions:a,pageExtractions:l}=e,s=new Map;try{const c=t.map((T,A)=>document.getElementById(`page-${A+1}`));await Es(c);const{entries:u,keyToEntry:d,jobFailures:f}=await Ts(t,n,c,a,l);if(u.length===0)return{images:s,jobFailures:f};const{styles:g,customProperties:x}=await ti(r,o,i,u.map(T=>T.html)),P=new Array(u.length).fill(null);let p;const b=(T,A)=>{const w=[];let N=[],j=0;for(const Y of T){const se=ws(u[Y].dimensions),ne=N.length>=A,ae=j+se>ys;N.length>0&&(ne||ae)&&(w.push(N),N=[],j=0),N.push(Y),j+=se}return N.length>0&&w.push(N),w},h=async(T,A,w)=>{for(const N of b(T,w))try{const j=await qo({pages:N.map(Y=>u[Y].html),styles:g,fontFamily:r||"system-ui, sans-serif",customProperties:x,dimensions:{width:Se.US_LETTER.width,height:Se.US_LETTER.height},pageDimensions:N.map(Y=>u[Y].dimensions),pixelRatio:Zt,...A});N.forEach((Y,se)=>{P[Y]=j[se]??null})}catch(j){p??(p=j instanceof Error?j.message:String(j)),console.error("DOCX server capture: page-image batch failed",j)}},m=T=>u.reduce((A,w,N)=>(w.kind===T&&A.push(N),A),[]),C=async T=>{const A=w=>T.filter(N=>u[N].kind===w);await h(A("page"),vs,ms),await h(A("band"),Ps,xs)},M=()=>u.reduce((T,A,w)=>(P[w]||T.push(w),T),[]);await C([...m("page"),...m("band")]);const E=M();if(E.length>0){const T=new Set(E),A=[];d.forEach((j,Y)=>{T.has(j)&&A.push(Y)}),await C(E);const w=M(),N=p??null;w.length===0&&(p=void 0),fn({error:new Error("DOCX export: server page capture retried"),extra:{context:"exportPreviewToDocx.serverCaptureRetry",retriedJobKeys:A,retriedEntryCount:E.length,recoveredCount:E.length-w.length,stillMissingCount:w.length,firstPassFailureReason:N}})}return d.forEach((T,A)=>{s.set(A,P[T]??null)}),{images:s,jobFailures:f,...p?{failureReason:p}:{}}}catch(c){if(hn(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 Ss(e){if(e.length===0)return null;const t=e.reduce((o,i)=>Math.max(o,i.reduce((a,l)=>a+(l.colSpan||1),0)),0);if(t===0)return null;const n=e.find(o=>o.length===t&&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 Gr="img, table, canvas, svg, hr",Cs=e=>e.split(";").some(t=>{const n=t.indexOf(":");if(n===-1)return!1;const r=t.slice(0,n).trim().toLowerCase();return r!=="background"&&r!=="background-image"?!1:t.slice(n+1).toLowerCase().includes("url(")}),Ns=e=>[e,...Array.from(e.querySelectorAll("[style]"))].some(t=>Cs(t.getAttribute("style")??"")),Fs=e=>(e.textContent??"").trim()!==""||e.matches(Gr)||e.querySelector(Gr)?!1:!Ns(e);function Xr(e){let t=e.lastElementChild;for(;t&&Fs(t);)t.remove(),t=e.lastElementChild}function wt(e){return yn(e)==="jpg"?"jpg":"png"}class Qt extends Error{constructor(t){super(t),this.name="DocxServerCaptureError"}}const Yr=10,Ms=Se.US_LETTER.width,$s=Se.US_LETTER.height,Is=.15,Os=4,Vr=e=>ei(e),Kr=e=>{if(Qo(e)){const n=pe(e.canvasWidth/96),r=pe(e.canvasHeight/96);return e.canvasWidth>e.canvasHeight?{width:r,height:n,orientation:mn.LANDSCAPE}:{width:n,height:r,orientation:void 0}}const t=e.orientation==="landscape";return{width:pe(8.5),height:pe(11),orientation:t?mn.LANDSCAPE:void 0}},Jr=(e,t)=>{const{width:n,height:r}=Vr(e),o=e.orientation==="landscape";return{width:n,height:r,headerBand:o?t.landscapeHeader:t.header,footerBand:o?t.landscapeFooter:t.footer}};function Zr(e,t){const n=Array.from(e.querySelectorAll("table")),r=Array.from(t.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=Ss(l);s&&a.setAttribute("data-col-twips",s.join(","))})}function Qr(e,t){const n=Array.from(e.querySelectorAll("tr")),r=Array.from(t.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 eo="markdown-export-preview-container",Ls=[{kind:"header",selector:".docx-export-header"},{kind:"footer",selector:".docx-export-footer"}],to=e=>e.id==="cover-page"||e.id.startsWith("toc-page"),no=(e,t)=>!!e&&e.items.some(n=>n.lines.some(r=>r.runs.some(t))),ro=(e,t)=>no(e,n=>n.kind===t),oo=(e,t)=>e.items.length===0?!1:t>=1?!0:!no(e,n=>n.kind==="page-number"&&n.hiddenAtPageZero!==!0),io="canvas-blocking",ks=()=>{const e=new Map,t=n=>{const r=e.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 e.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=t(r);return i?`${l}|lifted|${s}|${JSON.stringify(i.items)}`:`${l}|raster|${s}`}};let ao;const vt=()=>ao??(ao=import("./index.client-DnYTdAFV.js")),Rs=(e,t,n)=>{vt().then(({addBreadcrumb:r})=>r({category:"docx-export",level:"warning",message:"docx editable chrome fallback",data:{band:e,page:t,...n?{error:n}:{}}})).catch(()=>{})},Hs=(e,t)=>{vt().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx editable canvas text fallback",data:{page:e,...t?{error:t}:{}}})).catch(()=>{})},lo=e=>{var t;if(!(e instanceof Error))return String(e);const n=(((t=e.stack)==null?void 0:t.split(`
|
|
10
|
+
`);if(!t)return n;const r=e.textArr;return!Array.isArray(r)||r.length===n.length?n:r.map(o=>typeof(o==null?void 0:o.text)=="string"?o.text:"")}function Cr(e,t){var n;const r=(n=e.attrs)==null?void 0:n[t];return r==null||r==="auto"}function Nr(e){const t=e.getAbsoluteScale();return y(t==null?void 0:t.y)&&t.y>0?t.y:1}function fl(e,t,n,r,o){const i=e.getClientRect({relativeTo:t,skipShadow:!0,skipStroke:!0});if(!i||!y(i.x)||!y(i.y))return null;const a=e.getAbsoluteScale(),l=y(a==null?void 0:a.x)&&a.x>0?a.x:1,s=Nr(e),c=Sr(e,s),u=dl(e,o),d=u.map(m=>({runs:ht(m,()=>c,n)}));if(!r&&d.every(m=>m.runs.length===0))return null;const f=y(e.fontSize())?e.fontSize():0,g=f*(y(e.lineHeight())?e.lineHeight():1),x=u.length*g,P=y(e.padding())?e.padding():0,p=e.verticalAlign(),b=e.getHeight()-x-P*2,h=Cr(e,"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:pt(e.align()),lineHeightPx:g*s,linePitchPx:qt(d,f*s,y(e.lineHeight())?e.lineHeight():1),lines:d}}function hl(e,t){if(mr(e.align()))return null;const n=e.textArr;if(!Array.isArray(n)||n.length===0)return null;const r=e.getAbsoluteScale(),o=y(r==null?void 0:r.x)&&r.x>0?r.x:1,i=[];for(const a of n){if(!y(a==null?void 0:a.width))return null;i.push(a.width*o)}return xr(t,i)}function gl(e){for(let n=e.getParent();n;n=n.getParent()){const r=n.id();if(!(typeof r!="string"||r===""))return{id:r,textIndex:n.find("Text").indexOf(e)}}const t=e.id();return typeof t=="string"&&t!==""?{id:t,textIndex:0}:null}function pl(e){return!e.isVisible()||e.getClassName()==="Text"?!1:e.getAbsoluteOpacity()>0}function ml(e,t){const n=e.getClientRect({relativeTo:t});return!n||!y(n.x)||!y(n.y)||!y(n.width)||!y(n.height)?null:{leftPx:n.x,topPx:n.y,widthPx:n.width,heightPx:n.height}}function xl(e){const t=[],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,t.length),t.push({occludes:pl(o),rect:ml(o,e)})};return r(e),{steps:t,indexOf:n}}function Fr(e,t,n,r,o,i,a){var l;if(e.getClassName()==="Text"){const c=e,u=r==="band"?Er(n,gl(c)):null,d=r==="band"&&Gt(Vt(u),u,n);if(!ul(c,d,tt(r))||yr(c,a))return;const f=fl(c,t,n,d,tt(r));if(!f)return;const g=Ar(f,u,n,Sr(c,Nr(c)));if(g.lines.every(x=>x.runs.length===0))return;Yt(o,g,()=>cl(c),r,Cr(c,"width"),n,i,x=>hl(c,x));return}const s=(l=e.getChildren)==null?void 0:l.call(e);if(s)for(const c of s)Fr(c,t,n,r,o,i,a)}function xt(e){const t=/^(-?\d*\.?\d+)px$/.exec((e??"").trim());if(!t)return;const n=Number.parseFloat(t[1]);return Number.isFinite(n)?n:void 0}function Mr(e){var t;if(typeof e!="string")return;const n=(t=e.split(",")[0])==null?void 0:t.replace(/['"]/g,"").trim();return n!==void 0&&n!==""?n:void 0}const bl="ul, ol, mark, img, table",nt=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","LI"]),Kt=e=>Array.from(e.children).some(t=>nt.has(t.tagName));function bt(e,t){const n={...t};switch(e.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=e.style;r.fontWeight!==""&&(_t(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=Ut(r.color);i&&(n.color=i);const a=Mr(r.fontFamily);a&&(n.fontFamily=a);const l=xt(r.fontSize);return l!==void 0&&l>0&&(n.fontSizePx=l),n}function $r(e){const t=(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=bt(i,o);for(const l of Array.from(i.childNodes)){const s=t(l,a);if(s)return s}return i.childNodes.length===0?a:null},n=bt(e,{});for(const r of Array.from(e.childNodes)){const o=t(r,n);if(o)return o}return n}function yl(e,t){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||!nt.has(f.tagName)||f.childNodes.length!==1)&&i();return}nt.has(u.tagName)&&!Kt(u)&&(o>0&&i(),o+=1);const d=bt(u,c);for(const f of Array.from(u.childNodes))l(f,d)};for(const s of Array.from(e.childNodes))l(s,t);return{lines:n,charStyles:r}}const wl=(e,t)=>e.bold===t.bold&&e.italics===t.italics&&e.underline===t.underline&&e.strike===t.strike&&e.color===t.color&&e.fontSizePx===t.fontSizePx&&e.fontFamily===t.fontFamily;function vl(e){let t=null;for(const n of e.charStyles)for(const r of n)if(t===null)t=r;else if(!wl(t,r))return null;return t}const Pl=1,El=e=>e.replace(/\s+/g," ");function Tl(e){const t=[];let n=0;for(let r=1;r<e.length;r++)/\s/.test(e[r-1])&&!/\s/.test(e[r])&&(t.push(e.slice(n,r)),n=r);return t.push(e.slice(n)),t}function Al(e,t,n,r){const o=s=>cr(El(s),t,n),i=o(e);if(i===null||i<=r)return[e];const a=[];let l="";for(const s of Tl(e)){const c=l+s,u=o(c.trimEnd());if(u===null)return[e];l.trim()!==""&&u>r?(a.push(l.trimEnd()),l=s):l=c}return a.push(l),a}function Sl(e,t,n){if(Ir(t)||e.lines.some(l=>l.includes("{%")))return e;const r=vl(e),o=r==null?void 0:r.fontSizePx;if(!r||!y(o)||o<=0)return e;const i=[],a=[];for(const l of e.lines)for(const s of Al(l,r,o,n+Pl))i.push(s),a.push(new Array(s.length).fill(r));return{lines:i,charStyles:a}}function Cl(e){for(const t of Array.from(e.querySelectorAll("*")))if(nt.has(t.tagName)&&!Kt(t)){if(t.style.textAlign!=="")return pt(t.style.textAlign);break}return pt(e.style.textAlign)}function Nl(e,t,n,r){if(e.querySelector(bl))return null;const o=e.style.opacity;if(o!==""&&Number.parseFloat(o)!==1)return null;const i=/rotate\(\s*(-?\d*\.?\d+)deg/.exec(e.style.transform??"");if(i&&Number.parseFloat(i[1])!==0)return null;const a=Number.parseFloat(e.dataset.expectedLeft??""),l=Number.parseFloat(e.dataset.expectedTop??""),s=xt(e.style.width)??xt(e.style.minWidth);if(!y(a)||!y(l)||s===void 0||s<=0)return null;const c=bt(e,{}),u=c.fontSizePx??0,d=Number.parseFloat(e.style.lineHeight);if(u<=0||!y(d)||d<=0)return null;const f=yl(e,c),g=r?Sl(f,e,s):f,x=g.lines.map((h,m)=>({runs:ht(h,C=>{var M;return((M=g.charStyles[m])==null?void 0:M[C])??c},t)}));if(!n&&x.every(h=>h.runs.length===0))return null;const P=x.every(h=>h.runs.length===0)?$r(e).fontSizePx??u:u,p=qt(x,Math.max(u,P),d),b=p.reduce((h,m)=>h+m,0);return e.offsetHeight>b+2?null:{leftPx:a,topPx:l,widthPx:s,heightPx:b,align:Cl(e),lineHeightPx:u*d,linePitchPx:p,lines:x}}function Fl(e,t){const n=e.getBoundingClientRect();if(!y(n==null?void 0:n.left)||!y(n.top))return null;const r=n.width>0&&e.offsetWidth>0?n.width/e.offsetWidth:1;if(!y(r)||r<=0)return null;const o=Array.from(e.querySelectorAll("*")).filter(c=>nt.has(c.tagName)&&!Kt(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:[e]){const u=document.createRange();u.selectNodeContents(c);const d=u.getBoundingClientRect();if(!y(d==null?void 0:d.left)||!y(d.top)||!y(d.width)||!y(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!y(i)||!y(a)?null:{leftPx:t.leftPx+(i-n.left)/r,topPx:t.topPx+(a-n.top)/r,widthPx:(l-i)/r,heightPx:(s-a)/r}}const Ir=e=>xt(e.style.width)===void 0;function Ml(e){const t=e.dataset.objId;if(typeof t=="string"&&t!=="")return t;qe+=1;const n=`band-text-lift-${qe}`;return e.dataset.objId=n,n}function $l(e){return e.querySelector("canvas.lower-canvas")??e.querySelector("canvas")}function Or(e,t,n,r){var o,i,a;try{const l=$l(e);if(!l)return null;const s=l.__fabric;if(s&&typeof s.getObjects=="function"){const u={items:[],liftedObjectIds:[]},d=Ba(s);d||(o=r==null?void 0:r.onUnreadableBounds)==null||o.call(r);const f=s.getObjects();return Pr(f,[],t,n,new Date,u,d,Ja(f)),u}const c=sl(l);if(c){const u={items:[],liftedObjectIds:[]},d=ja(c);d||(i=r==null?void 0:r.onUnreadableBounds)==null||i.call(r),Fr(c,c,t,n,u,d,xl(c));for(const f of Array.from(e.querySelectorAll(".text-rich-display"))){const g=f.dataset.objId,x=n==="band"&&g?Er(t,{id:g,textIndex:0}):null,P=n==="band"&&Gt(Vt(x),x,t),p=Nl(f,t,P,tt(n));if(!p)continue;const b=Ar(p,x,t,$r(f));b.lines.every(h=>h.runs.length===0)||Yt(u,b,()=>Ml(f),n,Ir(f),t,d,h=>Fl(f,h))}return u}return null}catch(l){return(a=r==null?void 0:r.onError)==null||a.call(r,l),null}}function Il(e,t,n){return Or(e,t,"band",n)}function Ol(e,t,n){return Or(e,t,"page",n)}const Ll=9525,kl=15,Ge=e=>Math.round(e*Ll),Rl=e=>Math.round(e*kl),Hl="http://schemas.openxmlformats.org/drawingml/2006/main",Dl="http://schemas.microsoft.com/office/word/2010/wordprocessingShape",zl={left:X.LEFT,center:X.CENTER,right:X.RIGHT},Lr=900,Bl=251658240,jl=e=>({id:Lr+e,name:`Editable text ${Lr+e}`,relativeHeight:Bl+e});function Ne(e){const t=dn.fromXmlString(e).root,[n,...r]=t;if(r.length>0||!(n instanceof dn))throw new Error(`expected exactly one root element, got ${t.length}, in: ${e}`);return n}function kr(e,t,n){if(!Number.isFinite(e)||e<=0)throw new Error(`anchored text box ${t} is not a positive EMU extent (${e}) for "${n.name}": ${n.widthPx}x${n.heightPx}px at (${n.pageLeftPx}, ${n.pageTopPx})`);return e}function Wl(e){const t=kr(Ge(e.widthPx),"cx",e),n=kr(Ge(e.heightPx),"cy",e),r=Ne(`<wps:wsp><wps:cNvSpPr txBox="1"/><wps:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${t}" 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=Ne("<w:txbxContent/>");for(const u of e.lines)o.push(new R({alignment:zl[e.align],spacing:{before:0,after:0,line:Rl(u.linePitchPx),lineRule:q.EXACT},children:[...u.runs]}));const i=Ne("<wps:txbx/>");i.push(o),r.push(i),r.push(Ne('<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=Ne(`<a:graphicData uri="${Dl}"/>`);a.push(r);const l=Ne(`<a:graphic xmlns:a="${Hl}"/>`);l.push(a);const s=Ne(`<wp:anchor distT="0" distB="0" distL="0" distR="0" simplePos="0" relativeHeight="${e.relativeHeight}" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1"><wp:simplePos x="0" y="0"/><wp:positionH relativeFrom="page"><wp:posOffset>${Ge(e.pageLeftPx)}</wp:posOffset></wp:positionH><wp:positionV relativeFrom="page"><wp:posOffset>${Ge(e.pageTopPx)}</wp:posOffset></wp:positionV><wp:extent cx="${t}" cy="${n}"/><wp:effectExtent l="0" t="0" r="0" b="0"/><wp:wrapNone/><wp:docPr id="${e.id}" name="${e.name}"/><wp:cNvGraphicFramePr/></wp:anchor>`);s.push(l);const c=Ne("<w:drawing/>");return c.push(s),c}const Ul=e=>new R({children:[new H({children:[Wl(e)]})],spacing:{before:0,after:0,line:1,lineRule:q.EXACT}}),Rr=1.5,_l=.02,Hr=16,ql=.5/Rr;function Dr(e,t){let n=0;for(const r of e.lines)for(const o of r.runs){const i=(o.fontSizePx??Hr)*t;i>0&&(n=Math.max(n,ql/i))}return n}const Gl=e=>Math.round(e*Rr);function Xl(e,t,n){return e==="center"?t-n/2:e==="right"?t-n:t}const Yl=(e,t,n)=>({font:ve(e.fontFamily??t),size:Gl((e.fontSizePx??Hr)*n),color:e.color,bold:e.bold,italics:e.italics,strike:e.strike,underline:e.underline?{}:void 0}),zr=e=>e.totalPagesAsField||e.resolvedTotalPages===void 0;function Vl(e,t){return e.kind==="page-number"?{field:"PAGE"}:e.kind==="total-pages"?zr(t)?{field:"NUMPAGES"}:{literal:t.resolvedTotalPages??""}:{literal:e.text??""}}function Kl(e,t,n,r){const o=Yl(e,t,r);return e.hiddenAtPageZero?[...Li(Vl(e,n),o)]:e.kind==="page-number"?[$i(o)]:e.kind==="total-pages"?[zr(n)?Ii(o):new H({...o,text:n.resolvedTotalPages??""})]:[new H({...o,text:e.text??""})]}function Br(e,t,n,r){const o=e.widthPx*t.scale,i=o*(_l+(t.extraWidthPadRatio??0));return Ul({...jl(t.itemIndex),pageLeftPx:Xl(e.align,t.pageLeftPx,i),pageTopPx:t.pageTopPx,widthPx:o+i,heightPx:e.heightPx*t.scale,align:e.align,lines:e.lines.map((a,l)=>{var s;return{linePitchPx:(((s=e.linePitchPx)==null?void 0:s[l])??e.lineHeightPx)*t.scale,runs:a.runs.flatMap(c=>Kl(c,n,r,t.scale))}})})}function jr(e){return new R({children:[new $e({type:e.type,data:e.data,transformation:{width:e.widthPx,height:e.heightPx},floating:{horizontalPosition:{relative:_o.PAGE,offset:Ge(e.offsetXPx)},verticalPosition:{relative:Uo.PAGE,offset:Ge(e.offsetYPx)},behindDocument:!0,allowOverlap:!0,wrap:{type:Wo.NONE}}})],spacing:{before:0,after:0,line:1,lineRule:q.EXACT}})}const Jl=(e,t)=>t.bandKind==="header"?e.topPx:t.pageHeightPx-t.bandHeightPx+e.topPx,Zl=e=>e.bandKind==="header"?0:e.pageHeightPx-e.bandHeightPx,Ql=(e,t)=>new R({children:[new $e({type:e.type,data:e.data,transformation:{width:t.pageWidthPx,height:t.bandHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO}});function es(e,t,n,r,o){return e.items.length===0?[Ql(t,n)]:[jr({...t,widthPx:n.pageWidthPx,heightPx:n.bandHeightPx,offsetXPx:0,offsetYPx:Zl(n)}),...e.items.map((i,a)=>Br(i,{pageLeftPx:i.leftPx,pageTopPx:Jl(i,n),scale:1,itemIndex:a,extraWidthPadRatio:Dr(i,1)},r,o))]}const ts={totalPagesAsField:!1},ns=e=>e.displayWidthPx/e.canvasWidthPx,rs=e=>e.displayHeightPx/e.canvasHeightPx;function Wr(e,t,n){if(!Number.isFinite(e)||e<=0)throw new Error(`canvas page ${t} scale is not a positive number (${e}): ${JSON.stringify(n)}`);return e}const os=(e,t)=>new R({children:[new $e({type:e.type,data:e.data,transformation:{width:t.displayWidthPx,height:t.displayHeightPx}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO},alignment:X.CENTER});function is(e){for(const t of e.lines)for(const n of t.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 as(e,t,n,r,o=0){if(e.items.length===0)return[os(t,n)];e.items.forEach(is);const i=Wr(ns(n),"horizontal",n),a=Wr(rs(n),"vertical",n);return[jr({...t,widthPx:n.displayWidthPx,heightPx:n.displayHeightPx,offsetXPx:n.offsetXPx,offsetYPx:0}),...e.items.map((l,s)=>Br(l,{pageLeftPx:l.leftPx*i+n.offsetXPx,pageTopPx:l.topPx*a,scale:i,itemIndex:o+s,extraWidthPadRatio:Dr(l,i)},r,ts))]}const ls="data-table-continuation",ss="data-cloned-header-row",cs="data-paragraph-continuation",us="data-list-continuation",ds=["UL","OL"],fs='[data-page-break="true"]',hs=e=>/display:\s*none/.test(e.getAttribute("style")??""),Ur=e=>Array.from(e.children).filter(t=>!hs(t)),Jt=(e,t,n,r)=>e.tagName===n&&t.tagName===n&&e.getAttribute(r)==="true",gs=(e,t)=>{const n=e.querySelector(":scope > tbody")??e;t.querySelectorAll(":scope > tbody > tr, :scope > tr").forEach(r=>{r.getAttribute(ss)!=="true"&&n.appendChild(r)})},_r=e=>e.querySelector(fs)!==null;function ps(e,t){const n=Ur(e),r=n[n.length-1],o=Ur(t)[0];if(r&&o){if(Jt(o,r,"TABLE",ls))gs(r,o),o.remove();else if(Jt(o,r,"P",cs))r.textContent=`${r.textContent??""} ${o.textContent??""}`.trim(),o.remove();else if(ds.some(i=>Jt(o,r,i,us))){for(;o.firstChild;)r.appendChild(o.firstChild);o.remove()}}for(;t.firstChild;)e.appendChild(t.firstChild)}const ms=8,xs=40,Zt=4,bs=95,ys=4e8,ws=e=>e.width*e.height*Zt*Zt,vs={format:"jpeg",quality:bs},Ps={format:"png",omitBackground:!0},yt=e=>`page:${e}`,Xe=(e,t)=>`${t}:${e}`,qr=e=>e&&e.items.length>0?e.liftedObjectIds:void 0;async function Es(e){await Go(),await ri(e)}async function Ts(e,t,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<e.length;d++){const f=e[d],g=t[d],x=n[d];if(!f||!g||!x)continue;if(it(f)){try{const p=qr(o==null?void 0:o.get(d)),b=Xo(f),h=f.useFabric?(await xn(x,{...p?{hideObjectIds:p,stripRichTextOverlays:!0}:{},expectNonBlankCanvas:b})).outerHTML:await ni(x,g.width,g.height,d+1,{...p?{hideObjectIds:p}:{},expectNonBlankCanvas:b});h&&u(yt(d),h,{width:g.width,height:g.height},"page")}catch(p){s.set(yt(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=Xe(d,p.kind);try{const m=qr(r==null?void 0:r.get(h)),C=await xn(b,m?{hideObjectIds:m,stripRichTextOverlays:!0}:{});u(h,C.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=yt(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 As(e){const{pages:t,geometry:n,documentFont:r,componentColors:o,documentMargins:i,bandExtractions:a,pageExtractions:l}=e,s=new Map;try{const c=t.map((T,A)=>document.getElementById(`page-${A+1}`));await Es(c);const{entries:u,keyToEntry:d,jobFailures:f}=await Ts(t,n,c,a,l);if(u.length===0)return{images:s,jobFailures:f};const{styles:g,customProperties:x}=await ti(r,o,i,u.map(T=>T.html)),P=new Array(u.length).fill(null);let p;const b=(T,A)=>{const w=[];let N=[],j=0;for(const Y of T){const se=ws(u[Y].dimensions),ne=N.length>=A,ae=j+se>ys;N.length>0&&(ne||ae)&&(w.push(N),N=[],j=0),N.push(Y),j+=se}return N.length>0&&w.push(N),w},h=async(T,A,w)=>{for(const N of b(T,w))try{const j=await qo({pages:N.map(Y=>u[Y].html),styles:g,fontFamily:r||"system-ui, sans-serif",customProperties:x,dimensions:{width:Se.US_LETTER.width,height:Se.US_LETTER.height},pageDimensions:N.map(Y=>u[Y].dimensions),pixelRatio:Zt,...A});N.forEach((Y,se)=>{P[Y]=j[se]??null})}catch(j){p??(p=j instanceof Error?j.message:String(j)),console.error("DOCX server capture: page-image batch failed",j)}},m=T=>u.reduce((A,w,N)=>(w.kind===T&&A.push(N),A),[]),C=async T=>{const A=w=>T.filter(N=>u[N].kind===w);await h(A("page"),vs,ms),await h(A("band"),Ps,xs)},M=()=>u.reduce((T,A,w)=>(P[w]||T.push(w),T),[]);await C([...m("page"),...m("band")]);const E=M();if(E.length>0){const T=new Set(E),A=[];d.forEach((j,Y)=>{T.has(j)&&A.push(Y)}),await C(E);const w=M(),N=p??null;w.length===0&&(p=void 0),fn({error:new Error("DOCX export: server page capture retried"),extra:{context:"exportPreviewToDocx.serverCaptureRetry",retriedJobKeys:A,retriedEntryCount:E.length,recoveredCount:E.length-w.length,stillMissingCount:w.length,firstPassFailureReason:N}})}return d.forEach((T,A)=>{s.set(A,P[T]??null)}),{images:s,jobFailures:f,...p?{failureReason:p}:{}}}catch(c){if(hn(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 Ss(e){if(e.length===0)return null;const t=e.reduce((o,i)=>Math.max(o,i.reduce((a,l)=>a+(l.colSpan||1),0)),0);if(t===0)return null;const n=e.find(o=>o.length===t&&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 Gr="img, table, canvas, svg, hr",Cs=e=>e.split(";").some(t=>{const n=t.indexOf(":");if(n===-1)return!1;const r=t.slice(0,n).trim().toLowerCase();return r!=="background"&&r!=="background-image"?!1:t.slice(n+1).toLowerCase().includes("url(")}),Ns=e=>[e,...Array.from(e.querySelectorAll("[style]"))].some(t=>Cs(t.getAttribute("style")??"")),Fs=e=>(e.textContent??"").trim()!==""||e.matches(Gr)||e.querySelector(Gr)?!1:!Ns(e);function Xr(e){let t=e.lastElementChild;for(;t&&Fs(t);)t.remove(),t=e.lastElementChild}function wt(e){return yn(e)==="jpg"?"jpg":"png"}class Qt extends Error{constructor(t){super(t),this.name="DocxServerCaptureError"}}const Yr=10,Ms=Se.US_LETTER.width,$s=Se.US_LETTER.height,Is=.15,Os=4,Vr=e=>ei(e),Kr=e=>{if(Qo(e)){const n=pe(e.canvasWidth/96),r=pe(e.canvasHeight/96);return e.canvasWidth>e.canvasHeight?{width:r,height:n,orientation:mn.LANDSCAPE}:{width:n,height:r,orientation:void 0}}const t=e.orientation==="landscape";return{width:pe(8.5),height:pe(11),orientation:t?mn.LANDSCAPE:void 0}},Jr=(e,t)=>{const{width:n,height:r}=Vr(e),o=e.orientation==="landscape";return{width:n,height:r,headerBand:o?t.landscapeHeader:t.header,footerBand:o?t.landscapeFooter:t.footer}};function Zr(e,t){const n=Array.from(e.querySelectorAll("table")),r=Array.from(t.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=Ss(l);s&&a.setAttribute("data-col-twips",s.join(","))})}function Qr(e,t){const n=Array.from(e.querySelectorAll("tr")),r=Array.from(t.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 eo="markdown-export-preview-container",Ls=[{kind:"header",selector:".docx-export-header"},{kind:"footer",selector:".docx-export-footer"}],to=e=>e.id==="cover-page"||e.id.startsWith("toc-page"),no=(e,t)=>!!e&&e.items.some(n=>n.lines.some(r=>r.runs.some(t))),ro=(e,t)=>no(e,n=>n.kind===t),oo=(e,t)=>e.items.length===0?!1:t>=1?!0:!no(e,n=>n.kind==="page-number"&&n.hiddenAtPageZero!==!0),io="canvas-blocking",ks=()=>{const e=new Map,t=n=>{const r=e.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 e.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=t(r);return i?`${l}|lifted|${s}|${JSON.stringify(i.items)}`:`${l}|raster|${s}`}};let ao;const vt=()=>ao??(ao=import("./index.client-BJx0ctif.js")),Rs=(e,t,n)=>{vt().then(({addBreadcrumb:r})=>r({category:"docx-export",level:"warning",message:"docx editable chrome fallback",data:{band:e,page:t,...n?{error:n}:{}}})).catch(()=>{})},Hs=(e,t)=>{vt().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx editable canvas text fallback",data:{page:e,...t?{error:t}:{}}})).catch(()=>{})},lo=e=>{var t;if(!(e instanceof Error))return String(e);const n=(((t=e.stack)==null?void 0:t.split(`
|
|
11
11
|
`)[1])??"").trim();return n?`${e.message} @ ${n}`:e.message},so=(e,t)=>{vt().then(({addBreadcrumb:n})=>n({category:"docx-export",level:"warning",message:"docx text lift bounds unreadable",data:{surface:e,page:t}})).catch(()=>{})},co=(e,t,n)=>{vt().then(({captureMessage:r})=>r(`docx text lift threw on ${e} (page ${t}): ${n}`,"warning")).catch(()=>{})},Ds=async e=>{var t,n,r;const{pages:o,documentFont:i,componentColors:a,documentName:l="Document",returnBlobOnly:s=!1,documentMargins:c,headerBandHeight:u=Se.HEADER_FOOTER.height,footerBandHeight:d=Se.HEADER_FOOTER.height,landscapeHeaderBandHeight:f=u,landscapeFooterBandHeight:g=d,cssContainerClass:x}=e,P=x===eo?"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&&to(v)).length,h=o.length-b,m=v=>{const F=o[v];return!F||to(F)?0:v+1-b},C=h===o.length?{totalPagesAsField:!0}:{totalPagesAsField:!1,resolvedTotalPages:String(h)},M=((t=e.variableValues)==null?void 0:t.date)??Yo(),E=(()=>{var v,F;const $=new Map,L={header:(v=e.headerKonvaData)==null?void 0:v.konvaJson,footer:(F=e.footerKonvaData)==null?void 0:F.konvaJson};for(let U=0;U<o.length;U++){const ue=o[U];if(!ue||it(ue)||ue.skipHeaderFooter)continue;const re=document.getElementById(`page-${U+1}`);if(!re)continue;const V=m(U),ge=Vo(e.variableValues,V,h);delete ge.page_number,delete ge.total_pages;const Ae={variableValues:ge,currentDateText:M,pageNumber:V,totalPages:h};for(const ee of Ls){const te=re.querySelector(ee.selector);if(!te)continue;let Z;const le=Il(te,{...Ae,sourceCanvasJson:L[ee.kind]},{onError:K=>{Z=K},onUnreadableBounds:()=>so(ee.kind,U+1)});if(!le){const K=Z===void 0?void 0:lo(Z);Rs(ee.kind,U+1,K),K!==void 0&&co(ee.kind,U+1,K);continue}oo(le,V)&&$.set(Xe(U,ee.kind),le)}}return $})(),T=(()=>{const v=new Map,F={...e.variableValues??{}};for(let $=0;$<o.length;$++){const L=o[$];if(!L||!it(L)||L.pdfPageImport)continue;const U=document.getElementById(`page-${$+1}`);if(!U)continue;let ue;const re=Ol(U,{variableValues:F,currentDateText:M},{onError:V=>{ue=V},onUnreadableBounds:()=>so("page",$+1)});if(!re){const V=ue===void 0?void 0:lo(ue);Hs($+1,V),V!==void 0&&co("page",$+1,V);continue}oo(re,m($))&&v.set($,re)}return v})(),A=await As({pages:o,geometry:o.map(v=>Jr(v??{},p)),documentFont:i,componentColors:a,documentMargins:c,bandExtractions:E,pageExtractions:T}),w=[],N=v=>{const F=A.jobFailures.get(v);return F?`reconciliation/clone threw: ${F}`:A.failureReason?`batch failed: ${A.failureReason}`:A.images.has(v)?"server could not render":"no capture job was produced"},j=(v,F,$)=>{const L=A.images.get(v);return L&&L.length>0?L:(w.push(`page ${F+1} ${$} (${N(v)})`),null)},Y=[];let se=!1,ne=0;const ae=ks(),ce={header:null,footer:null},Ee=x===eo;let I=null;const Te=async()=>{const v=I;I=null,await(v==null?void 0:v.close())};for(let v=0;v<o.length;v++){const F=o[v];if(!F)continue;const $=v+1,L=document.getElementById(`page-${$}`);if(!L){console.warn(`DOCX export: page-${$} not found in DOM`),w.push(`page ${$} (page element not found in the DOM)`);continue}const U=it(F),ue=F.orientation==="landscape",{width:re,height:V,headerBand:ge,footerBand:Ae}=Jr(F,p),ee=[];let te=null,Z=null,le="",K=null,de=!1,fe=null;if(U){if(L){const z=j(yt(v),v,"page");if(z&&z.length>0){const S=F.canvasWidth||Ms,W=F.canvasHeight||$s,O=re,J=V,be=S/W,_=O/J;let G,B;be>_?(G=O,B=O/be):(B=J,G=J*be),F.destAnchor&&(B=Math.min(B,J-Os),ee.push(new R({heading:De.HEADING_1,children:[new sn({id:F.destAnchor,children:[new H({text:F.destTitle||"",size:2,color:"FFFFFF"})]})],spacing:{before:0,after:0,line:1,lineRule:q.EXACT}})));const he=wt(z),ye=T.get(v);ye?(ee.push(...as(ye,{data:z,type:he},{canvasWidthPx:S,canvasHeightPx:W,displayWidthPx:G,displayHeightPx:B,offsetXPx:(O-G)/2},i??"",ne)),ne+=ye.items.length):ee.push(new R({children:[new $e({type:he,data:z,transformation:{width:G,height:B}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO},alignment:X.CENTER}))}}}else{const z=L.querySelector(".preview-page-content");if(z){const S=z.cloneNode(!0);Zr(z,S),Qr(z,S),S.querySelectorAll("[data-fabric-canvas-placeholder]").forEach(O=>O.remove()),Xr(S);const W=Array.from(S.querySelectorAll("canvas:not(.upper-canvas)"));for(const O of W){const J=Array.from(z.querySelectorAll("canvas:not(.upper-canvas)")),be=Array.from(S.querySelectorAll("canvas:not(.upper-canvas)")).indexOf(O),_=J[be];if(_&&_.width>0&&_.height>0)try{const G=bn(_,4,.95);if(G){const B=document.createElement("img");B.src=G,B.style.width=_.style.width||`${_.width}px`,B.style.height=_.style.height||`${_.height}px`,B.style.display="block",(n=O.parentElement)==null||n.replaceChild(B,O)}}catch(G){if(Nt(G))throw G}}le=S.innerHTML,K=S,de=_r(z)}else{const S=L.cloneNode(!0);Zr(L,S),Qr(L,S);const W=S.querySelector(".page-header"),O=S.querySelector(".page-footer");W&&W.remove(),O&&O.remove(),S.querySelectorAll("[data-fabric-canvas-placeholder]").forEach(_=>_.remove()),Xr(S);const J=Array.from(S.querySelectorAll("canvas:not(.upper-canvas)")),be=Array.from(L.querySelectorAll("canvas:not(.upper-canvas)"));for(let _=0;_<J.length;_++){const G=J[_],B=be[_];if(G&&B&&B.width>0&&B.height>0)try{const he=bn(B,4,.95);if(he){const ye=document.createElement("img");ye.src=he,ye.style.width=B.style.width||`${B.width}px`,ye.style.height=B.style.height||`${B.height}px`,ye.style.display="block",(r=G.parentElement)==null||r.replaceChild(ye,G)}}catch(he){if(Nt(he))throw he}}le=S.innerHTML,K=S,de=_r(L)}if(!F.skipHeaderFooter){const S=L.querySelector(".docx-export-header"),W=L.querySelector(".docx-export-footer");S&&(te=j(Xe(v,"header"),v,"header")),W&&(Z=j(Xe(v,"footer"),v,"footer"))}if(le){const S=at((c==null?void 0:c.left)??ze.left),W=at((c==null?void 0:c.right)??ze.right),O={componentColors:a,documentFont:i,leftMarginPx:S,rightMarginPx:W,isLandscape:ue,contentWidthPx:re-S-W,contentHeightPx:V-(te&&te.length>0?ge:0)-(Z&&Z.length>0?Ae:0)-at((c==null?void 0:c.top)??ze.top)-at((c==null?void 0:c.bottom)??ze.bottom),previewContext:P,tocPagerefFields:!0};fe=J=>Qn(J,O,U)}}const me=!!te&&te.length>0,Le=!!Z&&Z.length>0,Ve=me?wt(te):"png",rt=Le?wt(Z):"png",Pt=me?ge/96:0,Ke=Le?Ae/96:0,ke=E.get(Xe(v,"header")),D=E.get(Xe(v,"footer")),xe=m(v)<1,ot=ke!==void 0||D!==void 0,uo=ro(ke,"page-number")||ro(D,"page-number");let Je=null;xe?ot&&(Je=0):!se&&uo&&(Je=m(v),se=!0);const fo=(z,S,W,O,J)=>!S||S.length===0?[new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}})]:J?es(J,{data:S,type:W},{bandKind:z,pageWidthPx:re,pageHeightPx:V,bandHeightPx:O},i??"",C):[new R({children:[new $e({type:W,data:S,transformation:{width:re,height:O}})],spacing:{before:0,after:0,line:240,lineRule:q.AUTO}})],en=U?{top:0,right:0,bottom:0,left:0,header:0,footer:0}:{top:pe(Pt+((c==null?void 0:c.top)??ze.top)),right:pe(0),bottom:pe(Math.max(Ke,Ke+((c==null?void 0:c.bottom)??ze.bottom)-Is)),left:pe(0),header:0,footer:0},Fe=Kr(F),tn=JSON.stringify({margins:en,pageSize:Fe}),ho=ae({bandKind:"header",imageBuffer:te,bandHeightPx:ge,extraction:ke,pageSize:Fe}),go=ae({bandKind:"footer",imageBuffer:Z,bandHeightPx:Ae,extraction:D,pageSize:Fe});if(I&&K&&F.continuesFlow===!0&&!I.endsWithPageBreak&&I.layoutKey===tn&&Je===null&&ho===ce.header&&go===ce.footer){ps(I.root,K),I.endsWithPageBreak=de;continue}await Te();const nn=Ee&&K!==null&&fe!==null;fe&&!nn&&ee.push(...await fe(le));const Re={properties:{page:{margin:en,size:{width:Fe.width,height:Fe.height,orientation:Fe.orientation},...Je!==null?{pageNumbers:{start:Je}}:{}}},children:ee.length>0?ee:[new R({text:"",spacing:{before:0,after:0,line:240,lineRule:q.AUTO}})]};if(U){const z=()=>new R({text:"",spacing:{before:0,after:0,line:1,lineRule:q.EXACT}});Re.headers={default:new gn({children:[z()]})},Re.footers={default:new pn({children:[z()]})},ce.header=io,ce.footer=io}else{const z=(O,J,be,_,G,B)=>{const he=ae({bandKind:O,imageBuffer:J,bandHeightPx:_,extraction:G,pageSize:Fe});if(he!==ce[O])return ce[O]=he,B(fo(O,J,be,_,G))},S=z("header",te,Ve,ge,ke,O=>({default:new gn({children:O})}));S&&(Re.headers=S);const W=z("footer",Z,rt,Ae,D,O=>({default:new pn({children:O})}));W&&(Re.footers=W)}if(Y.push(Re),nn&&K&&fe){const z=K,S=fe;I={root:z,layoutKey:tn,endsWithPageBreak:de,close:async()=>{const W=await S(z.innerHTML);W.length>0&&(Re.children=W)}}}}if(await Te(),w.length>0){const v=w.slice(0,Yr).join("; "),F=w.length-Yr,$=F>0?` (and ${F} more)`:"",L=`DOCX export failed: the server did not return ${w.length} page image(s) \u2014 ${v}${$}`;throw fn({error:new Error(L),extra:{context:"exportPreviewToDocx.serverCaptureFailed",missCount:w.length,misses:w,batchFailureReason:A.failureReason??null}}),new Qt(L)}const Ye=new Ko({numbering:{config:[{reference:"default-numbering",format:Ft.DECIMAL},{reference:"lower-letter-numbering",format:Ft.LOWER_LETTER},{reference:"lower-roman-numbering",format:Ft.LOWER_ROMAN}].map(({reference:v,format:F})=>({reference:v,levels:[{level:0,format:F,text:"%1.",alignment:X.START,style:{paragraph:{indent:{left:pe(.5),hanging:pe(.25)}}}}]}))},sections:Y}),Oe=await Jo.toBlob(Ye);if(s)return Oe;Zo.saveAs(Oe,`${l}.docx`)}catch(p){throw hn(p)||(console.error("Export to DOCX failed:",p),p instanceof Qt||Nt(p))?p:new Error("Failed to export document to DOCX")}};export{Qt as DocxServerCaptureError,Kr as docxPageSize,Ds as exportPreviewToDocx,Vr as pageFrameSize,wt as sniffDocxBandType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{dL as Q,dM as D,dN as P,bY as W,dO as _,dP as Y,dQ as U,b$ as z,c0 as J,d2 as G}from"./runtime-
|
|
1
|
+
import{dL as Q,dM as D,dN as P,bY as W,dO as _,dP as Y,dQ as U,b$ as z,c0 as J,d2 as G}from"./runtime-BifHPIs0.js";import{b as X,a as Z,N as ee,n as te,c as re,d as oe}from"./exportPageHtml-YIUR3iCw.js";import{awaitExportImagesReady as ae}from"./exportImageReadiness-CDj5qZi9.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,k=(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:k(t,"x-native-pages-requested"),spliced:k(t,"x-native-pages-spliced"),fallback:Math.max(k(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:N}=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:L}=Q(r),A=`<div style="width: ${C}px; height: ${L}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(P(e))throw e;console.error(`Failed to capture V2 canvas page ${b}:`,e),W({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,L,b)??A}catch(e){if(P(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 S=Array.from(e.querySelectorAll("canvas:not(.upper-canvas)"));if(S.length>0){const n=Array.from(x.querySelectorAll("canvas:not(.upper-canvas)"));for(let g=0;g<S.length;g++){const E=S[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(P(w))throw w;console.warn(`Failed to capture canvas ${g+1}:`,w)}}}const O=Array.from(e.querySelectorAll("img"));if(O.length>0){const n="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",g=O.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 $=e.outerHTML;if(l){const n=a?`font-family: ${a};`:"";$=`<div class="${l}" style="${n}">${$}</div>`}c[o]=$}catch(e){if(P(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]=`${_(r.destAnchor,r.destTitle??"")}${c[o]}`)});const{styles:B,customProperties:M}=await oe(a,p,H,c),{pageDimensions:R,nativePageSources:T}=Y(i),V=JSON.stringify({styles:B,fontFamily:a||"system-ui, sans-serif",customProperties:M,dimensions:{width:ie,height:ce},documentName:s||"document",...R?{pageDimensions:R}:{},...T?{nativePageSources:T}:{}}),y=[],K=V.slice(0,-1);y.push(K+',"pages":[');for(let r=0;r<c.length;r++)r>0&&y.push(","),y.push(JSON.stringify(c[r])),c[r]="";y.push("]}");const j=new Blob(y,{type:"application/json"});y.length=0;const f=await z(`${J}/document_builder/export/pdf`,{method:"POST",body:j});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}`)}N==null||N(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};
|