@outmarket-ai/react-sdk 0.1.0-alpha.15 → 0.1.0-alpha.16
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-DsAqKH8L.js → AddNoteDialog-BXcMKqZ1.js} +1 -1
- package/dist/{AlertDialog-0mx6VBtb.js → AlertDialog-C9DEDOJk.js} +1 -1
- package/dist/{ApproveWorkflowsList-C38LCW1C.js → ApproveWorkflowsList-vTI3IV60.js} +1 -1
- package/dist/{BORLetterEditor-P4fgfawx.js → BORLetterEditor-ZqsUBeyo.js} +1 -1
- package/dist/{BillDetailModal-zCr3ppbC.js → BillDetailModal-gaWcjakb.js} +1 -1
- package/dist/{CoiIssueHolderModal-BLz8hM1c.js → CoiIssueHolderModal-Vr1ThjTe.js} +1 -1
- package/dist/{DeletePromptDialog-oJuB-qqB.js → DeletePromptDialog-YvD5xrRK.js} +1 -1
- package/dist/{EmailFormatSelectionDialog-DmaGe8wo.js → EmailFormatSelectionDialog-oj2ChYBP.js} +1 -1
- package/dist/{ExcelExportPreviewDialog-Bjb6o-9N.js → ExcelExportPreviewDialog-D_BU3Eg-.js} +1 -1
- package/dist/{ExplainPanel-CSppTbZR.js → ExplainPanel-BJhF28It.js} +1 -1
- package/dist/{ExportDialog-D218hMW2.js → ExportDialog-C9WAwcY6.js} +1 -1
- package/dist/{ExportToAmsDialog-B4hHXr0f.js → ExportToAmsDialog-yNazjk-T.js} +1 -1
- package/dist/{ExportToDriveDialog-Dq7gvYYQ.js → ExportToDriveDialog-DF2Xh1eR.js} +1 -1
- package/dist/{FeedbackTool-BliuShfv.js → FeedbackTool-C46OtXYp.js} +1 -1
- package/dist/{LayerDetailModal-DxlLy0id.js → LayerDetailModal-Bv61_jif.js} +1 -1
- package/dist/{LogoEditor-Cp-dYD-6.js → LogoEditor-BHAUcQs0.js} +1 -1
- package/dist/{MarkdownExportPreviewDialog-Ane3qAcW.js → MarkdownExportPreviewDialog-CzxJcujF.js} +1 -1
- package/dist/{NotificationDrawer-Hlkt42WC.js → NotificationDrawer-aCSJFdvC.js} +1 -1
- package/dist/{PhoneNumbersDisplay-BuZJwlVC.js → PhoneNumbersDisplay-D9j6xmhs.js} +1 -1
- package/dist/{PlanSelector-CS5aEIs7.js → PlanSelector-en46Xov8.js} +1 -1
- package/dist/{PlanSettingsModal-DDq4rkDI.js → PlanSettingsModal-Dl6h72F2.js} +1 -1
- package/dist/{PlanWizardModal-CdA4fnNa.js → PlanWizardModal-CnYby_bO.js} +1 -1
- package/dist/{RenameAssetDialog-CkgOmLaX.js → RenameAssetDialog-WHSL2LgD.js} +1 -1
- package/dist/{SaveBlockDialog-DLxi9nIH.js → SaveBlockDialog-DSRB4Q4k.js} +1 -1
- package/dist/{SaveOutlineDialog-BWWBsxkh.js → SaveOutlineDialog-BJbc7Nl2.js} +1 -1
- package/dist/{SavePromptDialog-BHEmAaUn.js → SavePromptDialog-dUc-2L1J.js} +1 -1
- package/dist/{ShareResourceDialog-DCnB5bfo.js → ShareResourceDialog-2pvneQGX.js} +1 -1
- package/dist/{TermsNoticeModal-XyCiR9qc.js → TermsNoticeModal-CufQhNaq.js} +1 -1
- package/dist/{TowerAlertModal-rsS9iUeh.js → TowerAlertModal-XNulb1R-.js} +1 -1
- package/dist/{TowerSummaryModal-Fk4EuK1R.js → TowerSummaryModal-C1bFQfEh.js} +1 -1
- package/dist/{VaultSettingsDialog-DDppumyY.js → VaultSettingsDialog-BJC4SwoX.js} +1 -1
- package/dist/{ViewNoteDialog-bPrmfiBI.js → ViewNoteDialog-C6ks5tQb.js} +1 -1
- package/dist/{WhatsNewProvider-eehwMkJ7.js → WhatsNewProvider-Dn8IRE1u.js} +1 -1
- package/dist/{WidgetRawDataView-D8a2-r9A.js → WidgetRawDataView-BjHRsvKa.js} +1 -1
- package/dist/{abap-B4he9Yo-.js → abap-BqgX6Jp5.js} +1 -1
- package/dist/{abnf-CpD3Hrr5.js → abnf-9nUCt17M.js} +1 -1
- package/dist/{actionscript-pGLZyQ8i.js → actionscript-DRn78CzV.js} +1 -1
- package/dist/{activityLog-CLKedEV7.js → activityLog-CwyQhA_Z.js} +1 -1
- package/dist/{ada-CG4zikpA.js → ada-D0V4GqUu.js} +1 -1
- package/dist/{agda-bcxSyfWR.js → agda-DMCvJ9CI.js} +1 -1
- package/dist/{al-YemUtvQK.js → al-Dc3Md0On.js} +1 -1
- package/dist/{antlr4-BmZtbJPN.js → antlr4-Cns5AxBH.js} +1 -1
- package/dist/{apacheconf-Co_ph8v9.js → apacheconf-DQ_lO0kV.js} +1 -1
- package/dist/{apex-DR2aiKLv.js → apex-BkNT_K1N.js} +1 -1
- package/dist/{apl-D4TJVNDo.js → apl-DTbWXkzB.js} +1 -1
- package/dist/{applescript-DhKZ4T8y.js → applescript-C0q9v0t_.js} +1 -1
- package/dist/{aql-j6BaUBBC.js → aql-i_-jAzHU.js} +1 -1
- package/dist/{arduino-CrqYM27X.js → arduino-D_mvVpbS.js} +1 -1
- package/dist/{arff-2BjkcTza.js → arff-BFwj4isq.js} +1 -1
- package/dist/{asciidoc-43tdwYgM.js → asciidoc-KVPcjjW6.js} +1 -1
- package/dist/{asm6502-NSeor5Cr.js → asm6502-CiDuQWfC.js} +1 -1
- package/dist/{asmatmel-C8REgKio.js → asmatmel-LtBULuN8.js} +1 -1
- package/dist/{aspnet-1uLqTUwo.js → aspnet-mZO7mfdv.js} +1 -1
- package/dist/{autohotkey-DrxIqKwF.js → autohotkey-t8MhgJ3y.js} +1 -1
- package/dist/{autoit-Z6wuOCnw.js → autoit-D9xXYHEI.js} +1 -1
- package/dist/{avisynth-l7f7VjOn.js → avisynth-BpX45RoI.js} +1 -1
- package/dist/{avro-idl-paSiL6_x.js → avro-idl-DyYKL9Lg.js} +1 -1
- package/dist/{bash-BiUxseEe.js → bash-KXrp0wlw.js} +1 -1
- package/dist/{basic-CVxPdl6n.js → basic-0BMZz-kV.js} +1 -1
- package/dist/{batch-D-rMJWOc.js → batch-CCRucjat.js} +1 -1
- package/dist/{bbcode-C86m27vF.js → bbcode-DxjollMP.js} +1 -1
- package/dist/{bell-muY9w-hZ.js → bell-DvlROquw.js} +1 -1
- package/dist/{bicep-Dy_CnRFd.js → bicep-BjcgBZz0.js} +1 -1
- package/dist/{birb-BhQnZvov.js → birb-CdM4qTaZ.js} +1 -1
- package/dist/{bison-G1uu3sik.js → bison-B10zEa0C.js} +1 -1
- package/dist/{blockEditorContent-BPbtViH6.js → blockEditorContent-B2FYvfS-.js} +1 -1
- package/dist/{bnf-Ch0_ZqyE.js → bnf-C2XE5KeH.js} +1 -1
- package/dist/{brainfuck-k9_qbovy.js → brainfuck-D-4ijYnA.js} +1 -1
- package/dist/{brightscript-UqKpOltR.js → brightscript-s4XTOtCp.js} +1 -1
- package/dist/{bro-D2RwG72r.js → bro-BzMJ7Vda.js} +1 -1
- package/dist/{bsl-dmW0YTp1.js → bsl-ogXzC0G1.js} +1 -1
- package/dist/{c-CmlUKmO2.js → c-DgklJjuR.js} +1 -1
- package/dist/{calendar-DbwHWv2b.js → calendar-D4LgtZMv.js} +1 -1
- package/dist/{cfscript-CdHqA4LI.js → cfscript-hNHeNOEh.js} +1 -1
- package/dist/{chaiscript-CKAmMrbU.js → chaiscript-iIeabmwd.js} +1 -1
- package/dist/{cil-DsBaJm30.js → cil-C3OpSUjK.js} +1 -1
- package/dist/{clike-DqB9J7TY.js → clike-CbLsh2Lv.js} +1 -1
- package/dist/{clojure-Nve-9UH3.js → clojure-CUgRihct.js} +1 -1
- package/dist/{cmake-js6NWyyt.js → cmake-BHSI_9ml.js} +1 -1
- package/dist/{cobol-B_wu0Obn.js → cobol-Ck2yDur6.js} +1 -1
- package/dist/{coffeescript-DUuNiif1.js → coffeescript--CLcihJ4.js} +1 -1
- package/dist/{concurnas-B5tbKa8t.js → concurnas-pvZ_mOF8.js} +1 -1
- package/dist/{contactsList-Dv26oK0n.js → contactsList-BVi25HoN.js} +2 -2
- package/dist/{copyPreviewToClipboard-CUzpcOJ4.js → copyPreviewToClipboard-ui8loMip.js} +1 -1
- package/dist/{coq-D63lMOQM.js → coq-BTaxcgj5.js} +1 -1
- package/dist/{core-4YXaUasB.js → core-DNTo4ZLu.js} +1 -1
- package/dist/{cpp-NDXhCCjc.js → cpp-U9FGFBMq.js} +1 -1
- package/dist/{crystal-BcraUmlp.js → crystal-DsuNVX4-.js} +1 -1
- package/dist/{csharp-DZerei0C.js → csharp-B8c-DtTF.js} +1 -1
- package/dist/{cshtml-lz_54AZm.js → cshtml-DWuuzO9R.js} +1 -1
- package/dist/{csp-BRiljof4.js → csp-DxMynwD7.js} +1 -1
- package/dist/{css-Cm_ar1jH.js → css-DFCjheZD.js} +1 -1
- package/dist/{css-extras-NDIBZDtG.js → css-extras-CQh9Oo2p.js} +1 -1
- package/dist/{csv-DmK8tlv-.js → csv-CwG8W0tw.js} +1 -1
- package/dist/{cypher-cBe2gjEl.js → cypher-o-Q8GpfX.js} +1 -1
- package/dist/{d-C-Cze9Fu.js → d-0ThVA6Oz.js} +1 -1
- package/dist/{dart-4_HKHCon.js → dart-M5nEw5ef.js} +1 -1
- package/dist/{dataweave-DW4YFyxs.js → dataweave-BTRDZd7l.js} +1 -1
- package/dist/{dax-C9sZYVas.js → dax-CiEuRcKH.js} +1 -1
- package/dist/{dhall-BcH_MRx9.js → dhall-ByT7jh_y.js} +1 -1
- package/dist/{diff-B_IVcD9b.js → diff-DPbCV6fN.js} +1 -1
- package/dist/{django-B6VfYhKN.js → django-Dbn95OGf.js} +1 -1
- package/dist/{dns-zone-file-C-GYDmxY.js → dns-zone-file-BOGWMM1o.js} +1 -1
- package/dist/{docker-Cy9dbOBH.js → docker-DrPpOx7z.js} +1 -1
- package/dist/{dot-7qCRl6pb.js → dot-ChAqu9Z8.js} +1 -1
- package/dist/{ebnf-DyW7rtg9.js → ebnf-Djhy3lcy.js} +1 -1
- package/dist/{editCarrierDialog-BbIe8X48.js → editCarrierDialog-DD1hIP3Q.js} +1 -1
- package/dist/{editorconfig-lMSFqUtk.js → editorconfig-Dt7UoEf4.js} +1 -1
- package/dist/{eiffel-CpgF9qZc.js → eiffel-BW5BEUjx.js} +1 -1
- package/dist/{ejs-D3PBNepo.js → ejs-DE3_VDy5.js} +1 -1
- package/dist/{elixir-84EzJm1S.js → elixir-DpFPjwew.js} +1 -1
- package/dist/{elm-nKmvkr_8.js → elm-DGrvKKdw.js} +1 -1
- package/dist/{erb-BpuxqUhP.js → erb-DLf3ql4j.js} +1 -1
- package/dist/{erlang-DS2DhgUD.js → erlang-DZX80HV3.js} +1 -1
- package/dist/{etlua-DHQi-bQK.js → etlua-B-hLKbDu.js} +1 -1
- package/dist/{excel-formula-BR3M-aVF.js → excel-formula-CLFXB5bv.js} +1 -1
- package/dist/{exportFileGeneration-B3cDBzgW.js → exportFileGeneration-TN0srRUc.js} +1 -1
- package/dist/{exportImageReadiness-CMkHkh1A.js → exportImageReadiness-BxqWxsco.js} +1 -1
- package/dist/{exportImageReadinessNotifier-CYl7ifFv.js → exportImageReadinessNotifier-gxFLw3OD.js} +1 -1
- package/dist/{exportPageHtml-C1G7X30T.js → exportPageHtml-3os6ERoG.js} +1 -1
- package/dist/{exportPreviewToDocx-4Gng-9uD.js → exportPreviewToDocx-Cdx3cTeU.js} +2 -2
- package/dist/{exportPreviewToPdf-DdcuCQrK.js → exportPreviewToPdf-B7xjCu0j.js} +1 -1
- package/dist/{factor-DkO3eXKo.js → factor-CkPux6n1.js} +1 -1
- package/dist/{false-DN97hqNF.js → false-DC13Q8du.js} +1 -1
- package/dist/{firestore-security-rules-Dhw60aGq.js → firestore-security-rules-U5gzKXvv.js} +1 -1
- package/dist/{flask-conical-CreTJ-LS.js → flask-conical-nC8mH7pZ.js} +1 -1
- package/dist/{flow-De3TTYmE.js → flow-Dn2Cbnwa.js} +1 -1
- package/dist/{fortran-DwGpCQmQ.js → fortran-Cjnl0mS1.js} +1 -1
- package/dist/{fsharp-D3Jj4PIi.js → fsharp-9bBxei_x.js} +1 -1
- package/dist/{ftl-9xTPl3jR.js → ftl-B8nYled0.js} +1 -1
- package/dist/{gap-DHN03GP0.js → gap-7XbwIGDA.js} +1 -1
- package/dist/{gcode-BjRQgcNC.js → gcode-Dl8YYfiO.js} +1 -1
- package/dist/{gdscript-BDy3-hZS.js → gdscript-UE4SzoSH.js} +1 -1
- package/dist/{gedcom-CEDU4TZb.js → gedcom-CNRweabJ.js} +1 -1
- package/dist/{gherkin-Dfcnxs3j.js → gherkin-OcBCJhAR.js} +1 -1
- package/dist/{git-CDreoQUz.js → git-C7CrD71c.js} +1 -1
- package/dist/{glsl-Bu6WcPWw.js → glsl-DgxTBEll.js} +1 -1
- package/dist/{gml-pDJrnT1B.js → gml-D4uvSgTT.js} +1 -1
- package/dist/{gn-Db78s_xg.js → gn-CQItPYoL.js} +1 -1
- package/dist/{go-Dng5OytZ.js → go-cxacs8lI.js} +1 -1
- package/dist/{go-module-Bl1MG88w.js → go-module-CGtYT7ul.js} +1 -1
- package/dist/{graphql-C9sI7-hE.js → graphql-Ckpsa1vf.js} +1 -1
- package/dist/{groovy--0Y10FUD.js → groovy-DdoqI2W9.js} +1 -1
- package/dist/{haml-BTGzlQ2G.js → haml-BXXPiicq.js} +1 -1
- package/dist/{handlebars-Bce81Gh4.js → handlebars-p50xGbhW.js} +1 -1
- package/dist/{haskell-Bg6KfG3X.js → haskell-CSjHODzN.js} +1 -1
- package/dist/{haxe-Bt0b-Ef3.js → haxe-BNJv_mjK.js} +1 -1
- package/dist/{hcl-Bk6HQ5X1.js → hcl-D5GaoKpk.js} +1 -1
- package/dist/{highlighter-B3JZJnPi.js → highlighter-BA3cj_rw.js} +1 -1
- package/dist/{hlsl-D-GMGEr_.js → hlsl-CrWZY_JC.js} +1 -1
- package/dist/{hoon-EFr5lF33.js → hoon-D8fxFPgQ.js} +1 -1
- package/dist/{hpkp-BwC5yPfI.js → hpkp-CDXVdksJ.js} +1 -1
- package/dist/{hsts-DtqifsML.js → hsts-DaqLGhl2.js} +1 -1
- package/dist/{http-CPT87cW_.js → http-DMq0r1ob.js} +1 -1
- package/dist/{ichigojam-DhntRZcw.js → ichigojam-DO3yRLga.js} +1 -1
- package/dist/{icon-gDEXpDko.js → icon-DYgsCUbt.js} +1 -1
- package/dist/{icu-message-format-BwH5kQ-f.js → icu-message-format-C-yIk6i3.js} +1 -1
- package/dist/{idris-rIfT9YJc.js → idris-BcMnvaZR.js} +1 -1
- package/dist/{iecst-B0HgDjUt.js → iecst-DNu7Wqgu.js} +1 -1
- package/dist/{ignore-OkwZCyRI.js → ignore-Cs_UVgYl.js} +1 -1
- package/dist/{image-plus-BqkptflW.js → image-plus-CaRUwRF7.js} +1 -1
- package/dist/{index-BTuvrj45.js → index-CNHn8tVc.js} +1 -1
- package/dist/{index-N89j9aJK.js → index-CfpedKNG.js} +1 -1
- package/dist/{index-BJb3ecPu.js → index-D0lEPM6q.js} +1 -1
- package/dist/{index-BoHVr3Hx.js → index-DHNorzYp.js} +1 -1
- package/dist/index-DYKYPQU9.js +1 -0
- package/dist/{index-BL4Uo-Ry.js → index-EXM3eC5B.js} +1 -1
- package/dist/{index-kBILvESv.js → index-NPOcZ2DK.js} +1 -1
- package/dist/{index.client-Bh8BPURf.js → index.client-CAZURgAJ.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inform7-SrEdjjZv.js → inform7-B2E2qd7c.js} +1 -1
- package/dist/{ini-IJ6RXQ2y.js → ini-DcQ7hxWn.js} +1 -1
- package/dist/{io-BCCUSV8p.js → io-DjmtTkTU.js} +1 -1
- package/dist/{j-DKzQRf5P.js → j-C6IIjCgf.js} +1 -1
- package/dist/{java-9jL_HiW6.js → java-CNKt23Qo.js} +1 -1
- package/dist/{javadoc-DIOMmvfa.js → javadoc-tZDkZvKD.js} +1 -1
- package/dist/{javadoclike-ByLuHxJQ.js → javadoclike-CS4VEqnC.js} +1 -1
- package/dist/{javascript-CViUjats.js → javascript-DosTVR_L.js} +1 -1
- package/dist/{javastacktrace-IFpj3c3B.js → javastacktrace-CrUXYJUd.js} +1 -1
- package/dist/{jexl-BVs0bn9G.js → jexl-Cbh1tMjv.js} +1 -1
- package/dist/{jolie-1ls6O3_-.js → jolie-Duvbfgac.js} +1 -1
- package/dist/{jq-BJHa701w.js → jq-Ck04okw3.js} +1 -1
- package/dist/{js-extras-LoR1lxl6.js → js-extras-BePtYuEl.js} +1 -1
- package/dist/{js-templates-D5O546h9.js → js-templates-B-f2ZkE0.js} +1 -1
- package/dist/{jsdoc-C0tB1zUK.js → jsdoc-DPYkeZsH.js} +1 -1
- package/dist/{json-hE_H9RiS.js → json-B7QykXp8.js} +1 -1
- package/dist/{json5-H_iwJBk5.js → json5-PGzoTfRb.js} +1 -1
- package/dist/{jsonp-CwqBf0yE.js → jsonp-BNkQPh8f.js} +1 -1
- package/dist/{jsstacktrace-wZKceg2p.js → jsstacktrace-BJ-zGXtV.js} +1 -1
- package/dist/{jsx-Ytb1dIyf.js → jsx-muxTSxqR.js} +1 -1
- package/dist/{julia-Bv8oymp0.js → julia-DPeDRWHf.js} +1 -1
- package/dist/{keepalived-BmE2x8AC.js → keepalived-Bjjk4Y2-.js} +1 -1
- package/dist/{keyman-CIFdXMSi.js → keyman-BWzUv0Tk.js} +1 -1
- package/dist/{kotlin-A8lrGVan.js → kotlin-BJ_myg-j.js} +1 -1
- package/dist/{kumir-CMhPtOu5.js → kumir-mVDCXmmq.js} +1 -1
- package/dist/{kusto-DuWb1-kK.js → kusto-CMoO7v3A.js} +1 -1
- package/dist/{latex-B3uyQDxR.js → latex-Cj719ebl.js} +1 -1
- package/dist/{latte-B1GQy2ix.js → latte-5ZPLy_rP.js} +1 -1
- package/dist/{less-CntecGj8.js → less-DR9ofw7x.js} +1 -1
- package/dist/{lilypond-LNM7kQZR.js → lilypond-CLGnhFaZ.js} +1 -1
- package/dist/{link-2-off-BxzkY1Ur.js → link-2-off-D1odjiY5.js} +1 -1
- package/dist/{liquid-DBOYJfm0.js → liquid-JMIxDMKb.js} +1 -1
- package/dist/{lisp-kafg5MX6.js → lisp-DUI9FDhI.js} +1 -1
- package/dist/{livescript-D6PwIi7x.js → livescript-DwTBLc1j.js} +1 -1
- package/dist/{llvm-B1kaZnIy.js → llvm-DO9bITTH.js} +1 -1
- package/dist/{lock-keyhole-DfS15qW4.js → lock-keyhole-DwDf6EZg.js} +1 -1
- package/dist/{log-DvHie8wl.js → log-Bs9apQzr.js} +1 -1
- package/dist/{lolcode-DE_2Sv2Z.js → lolcode-BigHAi_3.js} +1 -1
- package/dist/{lua-Du74QFSp.js → lua-D1gCUjYj.js} +1 -1
- package/dist/{lucide-react-xoZEWBpb.js → lucide-react-Dgoe-P89.js} +1 -1
- package/dist/{luckyexcel.umd-BK5PGZ8o.js → luckyexcel.umd-W5PLD_Er.js} +1 -1
- package/dist/{magma-DI9_bW7_.js → magma-5SQLKcoo.js} +1 -1
- package/dist/{makefile-Cv1uWVvG.js → makefile-p3yOHzON.js} +1 -1
- package/dist/{markdown-EvxXNrwj.js → markdown-BzOSvWML.js} +1 -1
- package/dist/{markup-mmERB--g.js → markup-DRGz9zbO.js} +1 -1
- package/dist/{markup-templating-dBRYowad.js → markup-templating-BY70k6h4.js} +1 -1
- package/dist/{matlab-BIlvlES1.js → matlab-Y3sUMfuD.js} +1 -1
- package/dist/{maxscript-BenAOzeA.js → maxscript-S83gN8Tk.js} +1 -1
- package/dist/{mel-DbH-OZhM.js → mel-Bo9sDUgd.js} +1 -1
- package/dist/{mermaid-C2b8fR4P.js → mermaid-DB1WBKXu.js} +1 -1
- package/dist/{mizar-LcyU4WDc.js → mizar-D-V__A_A.js} +1 -1
- package/dist/{mongodb-BH3WSNjS.js → mongodb-CcD1QnEE.js} +1 -1
- package/dist/{monkey-ucjCrL2e.js → monkey-DSpf80b7.js} +1 -1
- package/dist/{moonscript-stunCPYk.js → moonscript-Cfp9ErBx.js} +1 -1
- package/dist/{n1ql-Cn9lnFPU.js → n1ql-CkchNjok.js} +1 -1
- package/dist/{n4js-Bb1StS4k.js → n4js-C2qZKrFy.js} +1 -1
- package/dist/{nand2tetris-hdl-C7uULKRT.js → nand2tetris-hdl-D0w-sn3c.js} +1 -1
- package/dist/{naniscript-13En9m2B.js → naniscript-CAWjPGv0.js} +1 -1
- package/dist/{nasm-rxRlUVp8.js → nasm-WTF-uC5Z.js} +1 -1
- package/dist/{neon-DqF7C6Iz.js → neon-C3StIxqS.js} +1 -1
- package/dist/{nevod-84exonv8.js → nevod-BVL-7JyU.js} +1 -1
- package/dist/{nginx-DOHGh0Id.js → nginx-DR9J_3vc.js} +1 -1
- package/dist/{nim-C7YWJWBx.js → nim-DcdkLkWI.js} +1 -1
- package/dist/{nix-CLJFi-O7.js → nix-8g7Pk_Tc.js} +1 -1
- package/dist/{nsis-DB84ewMz.js → nsis-dZ9Nr3BK.js} +1 -1
- package/dist/{objectivec-B8NTWicx.js → objectivec-C5nDsZdC.js} +1 -1
- package/dist/{ocaml-DwYYO9sT.js → ocaml-DDAQWGzL.js} +1 -1
- package/dist/{opencl-SVAFVx66.js → opencl-CAjwdPia.js} +1 -1
- package/dist/{openqasm-fgm2awaj.js → openqasm-DZI4c2V_.js} +1 -1
- package/dist/{oz-BdjQm4SR.js → oz-DyDMUNJy.js} +1 -1
- package/dist/{paintbrush-1ni65PvN.js → paintbrush-CoZyM9w2.js} +1 -1
- package/dist/{parigp-CsH81SMa.js → parigp-CIq_seKA.js} +1 -1
- package/dist/{parser-QcEYEtRg.js → parser-BKiwwpSR.js} +1 -1
- package/dist/{pascal-CNpNBNml.js → pascal-CznVm8T1.js} +1 -1
- package/dist/{pascaligo-DbPamlfA.js → pascaligo-CG4QyBa8.js} +1 -1
- package/dist/{pcaxis-BjG-0noK.js → pcaxis-BuxUnHUZ.js} +1 -1
- package/dist/{pen-tool-DmROxtVd.js → pen-tool-B3d9v3cK.js} +1 -1
- package/dist/{peoplecode-dt97d09H.js → peoplecode-B8CWhx9D.js} +1 -1
- package/dist/{perl-sefLZb19.js → perl-CutwWkZX.js} +1 -1
- package/dist/{php-DLU5npqP.js → php-Bm0UURkz.js} +1 -1
- package/dist/{php-extras-D-fYKv26.js → php-extras-BID0v00n.js} +1 -1
- package/dist/{phpdoc-BqA6ziBC.js → phpdoc-24Oz9-LZ.js} +1 -1
- package/dist/{plsql-Bu_lrm1G.js → plsql-C6BXPR7g.js} +1 -1
- package/dist/{plyr-LoQ8qUcP.js → plyr-CuHKxx4q.js} +1 -1
- package/dist/{powerquery-DzIdunlO.js → powerquery-DubWOvPB.js} +1 -1
- package/dist/{powershell-BKj7vvvb.js → powershell--VoPQ6y-.js} +1 -1
- package/dist/{processing-CuBiQGJ2.js → processing-B01ZtwTn.js} +1 -1
- package/dist/{prolog-CywLWr-O.js → prolog-BtX6XFxy.js} +1 -1
- package/dist/{promql-C8rRLRMl.js → promql-Bpacgz1D.js} +1 -1
- package/dist/{properties-D9TMZ635.js → properties-BGOQyKbS.js} +1 -1
- package/dist/{protobuf-SDACUBPf.js → protobuf-Q5PixUin.js} +1 -1
- package/dist/{psl-DcBD8zi2.js → psl-BuPhPKUH.js} +1 -1
- package/dist/{pug-DRepT70p.js → pug-CBL84bxd.js} +1 -1
- package/dist/{puppet-BlE8kNcZ.js → puppet-C3vOs2_4.js} +1 -1
- package/dist/{pure-ChJ_GeuH.js → pure-DWVlypI9.js} +1 -1
- package/dist/{purebasic-ijcXSdas.js → purebasic-BjiAoKIG.js} +1 -1
- package/dist/{purescript-BYasXnBW.js → purescript-DG53-ntL.js} +1 -1
- package/dist/{python-IoRcbsRa.js → python-Cqi2dq-D.js} +1 -1
- package/dist/{q-DtkMniRo.js → q-DYcnhAJE.js} +1 -1
- package/dist/{qml-Bw_cxjZK.js → qml-Ct9zDSWc.js} +1 -1
- package/dist/{qore-u_KejgBU.js → qore--ouW7gVP.js} +1 -1
- package/dist/{qsharp-BzFo8zaQ.js → qsharp-D3rTiDse.js} +1 -1
- package/dist/{quill-JYKwrDJd.js → quill-CnRN97Et.js} +1 -1
- package/dist/{r-ylmh4pTo.js → r-OJnn0f3P.js} +1 -1
- package/dist/{racket-CGXWnbuY.js → racket-DfstO2-7.js} +1 -1
- package/dist/{reason-dwUxHJlq.js → reason-C-DX-DlF.js} +1 -1
- package/dist/{regex-WxjOmnkF.js → regex-C8CFNlFO.js} +1 -1
- package/dist/{rego-9_6WpM6y.js → rego-Iex0zmP1.js} +1 -1
- package/dist/{renpy-CzJ4gzYr.js → renpy-DrghVWpS.js} +1 -1
- package/dist/{rest-D08SQF2m.js → rest-BlcIVAxH.js} +1 -1
- package/dist/{rip-CD63-drT.js → rip-dgGkpcVP.js} +1 -1
- package/dist/{roboconf-DdrIPym0.js → roboconf-BbFETeWe.js} +1 -1
- package/dist/{robotframework--wQHHMLv.js → robotframework-BdtcV7KZ.js} +1 -1
- package/dist/{ruby-DN-LW5as.js → ruby-BTZHoTS-.js} +1 -1
- package/dist/{runtime-1GIBxgTL.js → runtime-DM500Cza.js} +26 -26
- package/dist/{rust-DopRRCLc.js → rust-BrxDMff5.js} +1 -1
- package/dist/{sas-BY4I-hC-.js → sas-BIQT8kMN.js} +1 -1
- package/dist/{sass-Dkltpip8.js → sass-CQApi5gc.js} +1 -1
- package/dist/{scala-Olhac0l0.js → scala-DzpGbP4W.js} +1 -1
- package/dist/{scheme-B79aeAdi.js → scheme-DD-biW6P.js} +1 -1
- package/dist/{scss-BDX7YAUH.js → scss-BI-e7yn5.js} +1 -1
- package/dist/{shell-session-CBmJ9b2a.js → shell-session-DwyoCw0V.js} +1 -1
- package/dist/{smali-Kr5kGxHd.js → smali-BMHN9Lan.js} +1 -1
- package/dist/{smalltalk-DOuJzmr_.js → smalltalk-iOUew2kj.js} +1 -1
- package/dist/{smarty-DoKHFL9x.js → smarty-BSuTZi-X.js} +1 -1
- package/dist/{sml-Ln4fI4Yr.js → sml-BhYV-UU-.js} +1 -1
- package/dist/{solidity-C7D1Pd2Z.js → solidity-BB7VnzhP.js} +1 -1
- package/dist/{solution-file-fZg9SHyj.js → solution-file-DAJSaTrH.js} +1 -1
- package/dist/{soy-BsCowrTt.js → soy-B_B4YBZo.js} +1 -1
- package/dist/{sparql-C5MZRrOn.js → sparql-8-CrDoIQ.js} +1 -1
- package/dist/{splunk-spl-DpDJvIha.js → splunk-spl-CgHWzKfY.js} +1 -1
- package/dist/{sqf-C5IzFPJb.js → sqf-xmmWIvFN.js} +1 -1
- package/dist/{sql-vsnMtP-l.js → sql-C_u_3fMo.js} +1 -1
- package/dist/{squirrel-BpsPscZX.js → squirrel-CXH9c9bP.js} +1 -1
- package/dist/{stan-DjfnS87e.js → stan-CoKUIJrg.js} +1 -1
- package/dist/{stylus-wRpw9vzu.js → stylus-DO0sC_DH.js} +1 -1
- package/dist/{swift-DeWaFA6W.js → swift-C95D1hmW.js} +1 -1
- package/dist/{systemd-fkh0L0i1.js → systemd-DYKfqKfy.js} +1 -1
- package/dist/{t4-cs-i3vtyijD.js → t4-cs-DosJvZR5.js} +1 -1
- package/dist/{t4-templating-DoHMIwN7.js → t4-templating-DVRMHlVb.js} +1 -1
- package/dist/{t4-vb-C2ulr21q.js → t4-vb-CnwxOrl3.js} +1 -1
- package/dist/{table-KvQocwk1.js → table-gSgxHLCJ.js} +1 -1
- package/dist/{tap-BTa9Dh6c.js → tap-DDDE9TQB.js} +1 -1
- package/dist/{tcl-wtdDkq4H.js → tcl-Bb-60yUD.js} +1 -1
- package/dist/templateSelectorDialog-SYCFWALQ.js +2 -0
- package/dist/{textile-DEr1snGd.js → textile-D3JusoKP.js} +1 -1
- package/dist/{toml-DCRwrqDx.js → toml-Cg6eTW0y.js} +1 -1
- package/dist/{tremor-C7QRJM6Y.js → tremor-BPZJr8HN.js} +1 -1
- package/dist/{tsx-JaiD7eYM.js → tsx-BFNqB0BB.js} +1 -1
- package/dist/{tt2-Bx0gLG2Y.js → tt2-D5IpAePA.js} +1 -1
- package/dist/{turtle-BuVPKKO9.js → turtle-BB8zrql_.js} +1 -1
- package/dist/{twig-CapjDVvV.js → twig-QPbF69q-.js} +1 -1
- package/dist/{typescript-Be8dd-uT.js → typescript-BoHrZFgn.js} +1 -1
- package/dist/{typoscript-B6OWo560.js → typoscript-BPdT83X8.js} +1 -1
- package/dist/{unrealscript-rJm2cr4-.js → unrealscript-D5jUyuBV.js} +1 -1
- package/dist/{uorazor-C6DOQvbd.js → uorazor-Bgz8dZph.js} +1 -1
- package/dist/{uri-CWE8PD0D.js → uri-B7IC57MQ.js} +1 -1
- package/dist/{usePromptLibraryMutations-HBsp4sM5.js → usePromptLibraryMutations-DtNd3B58.js} +1 -1
- package/dist/{useSupabaseBlobUrl-NMrxgESw.js → useSupabaseBlobUrl-C6zcEi_X.js} +1 -1
- package/dist/{useTermsNotice-B3hxXCi4.js → useTermsNotice-Wdk5yELM.js} +1 -1
- package/dist/{user-plus-DpL6x1pM.js → user-plus-Dc20zINv.js} +1 -1
- package/dist/{user-round-plus-CbDzHwU6.js → user-round-plus-c5-nvSXv.js} +1 -1
- package/dist/{v-CcHa3Igw.js → v-Bnh7gR05.js} +1 -1
- package/dist/{vala-hRTtwyJJ.js → vala-CphZBFOo.js} +1 -1
- package/dist/{vbnet-By473JT5.js → vbnet-6NP5qzru.js} +1 -1
- package/dist/{velocity-C6mr0f2t.js → velocity-Dv-8qntX.js} +1 -1
- package/dist/{verilog-Rq_1nlVg.js → verilog-B7NfqkuV.js} +1 -1
- package/dist/{vhdl-DdOeqvKi.js → vhdl-CgCeQHaq.js} +1 -1
- package/dist/{vim-gvEGA_lC.js → vim-CRJWzxah.js} +1 -1
- package/dist/{visual-basic--YWpsQen.js → visual-basic-C-dHQ5XN.js} +1 -1
- package/dist/{warpscript-dSh5uTTF.js → warpscript-ptJsJVMl.js} +1 -1
- package/dist/{wasm-DEvoLguN.js → wasm-CPHRbmGu.js} +1 -1
- package/dist/{web-idl-CC3yB_AB.js → web-idl-DX9bih1z.js} +1 -1
- package/dist/{wiki-y1qwXWwM.js → wiki-CO14PTMz.js} +1 -1
- package/dist/{wolfram-CilYs5si.js → wolfram-CjtIW_sE.js} +1 -1
- package/dist/{wren-DrIC3HYJ.js → wren-BMDTkZl3.js} +1 -1
- package/dist/{xeora-DuLLn58W.js → xeora-Fyuv-Z_H.js} +1 -1
- package/dist/{xml-doc-C9DLnSAq.js → xml-doc-Dy4Fvdqz.js} +1 -1
- package/dist/{xojo-DW6sG-rr.js → xojo-BEy9ptcU.js} +1 -1
- package/dist/{xquery-CXv2uVM_.js → xquery-Q94NcTJL.js} +1 -1
- package/dist/{yaml-clfRdCZ4.js → yaml-y_rYVhC3.js} +1 -1
- package/dist/{yang-0cw6wmWG.js → yang-2xG9BVrE.js} +1 -1
- package/dist/{zig-viko7Uou.js → zig-dhvMLvKa.js} +1 -1
- package/package.json +4 -4
- package/dist/index-xDkmPs2K.js +0 -1
- package/dist/templateSelectorDialog-Cp9UY_rl.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useState as l}from"react";import{c9 as b,c3 as N,c4 as f,ca as v,c5 as x,cb as y,aZ as C,cc as A,bG as m}from"./runtime-
|
|
1
|
+
import{jsx as i,jsxs as n}from"react/jsx-runtime";import{useState as l}from"react";import{c9 as b,c3 as N,c4 as f,ca as v,c5 as x,cb as y,aZ as C,cc as A,bG as m}from"./runtime-DM500Cza.js";import"react-dom";import"react-dom/client";function D({isOpen:h,onOpenChange:c,onAddNote:g,isAddingNote:p}){const[r,s]=l(""),[o,d]=l(""),[u,a]=l({title:"",description:""});return b(),i(N,{open:h,onOpenChange:e=>{c(e),e||(s(""),d(""),a({title:"",description:""}))},children:n(f,{className:"sm:max-w-[425px]","data-testid":"add-note-dialog",children:[i(v,{children:i(x,{children:"Add Note"})}),n("form",{onSubmit:async e=>{e.preventDefault();const t={title:r.trim()?"":"Title is required",description:o.trim()?"":"Description is required"};if(a(t),!(t.title||t.description))try{await g(r,o),s(""),d("")}catch{}},className:"contents",children:[n("div",{className:"grid gap-4 py-4 px-4",children:[i(y,{label:"Title","data-testid":"note-title-input",value:r,onChange:e=>{s(e.target.value),a(t=>({...t,title:""}))},placeholder:"Enter note title",errorMessage:u.title,required:!0}),i(C,{label:"Description","data-testid":"note-description-input",value:o,onChange:e=>{d(e.target.value),a(t=>({...t,description:""}))},placeholder:"Enter note description",rows:5,errorMessage:u.description,required:!0})]}),n(A,{children:[i(m,{type:"button",variant:"outline",onClick:()=>c(!1),disabled:p,children:"Cancel"}),i(m,{type:"submit",isLoading:p,"data-testid":"add-note-submit-button",children:"Add Note"})]})]})]})})}export{D as AddNoteDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as l}from"react/jsx-runtime";import*as u from"react";import{c3 as g,c4 as y,ca as b,c5 as v,cy as x,cc as k,cz as d,bG as i}from"./runtime-
|
|
1
|
+
import{jsx as a,jsxs as l}from"react/jsx-runtime";import*as u from"react";import{c3 as g,c4 as y,ca as b,c5 as v,cy as x,cc as k,cz as d,bG as i}from"./runtime-DM500Cza.js";const A=({isOpen:h,onClose:n,onConfirm:t,title:m,description:f,confirmText:e="Confirm",cancelText:C="Cancel",dataTestId:p="alert-dialog",confirmVariant:c="destructive"})=>{const[o,r]=u.useState(!1),s=async()=>{try{r(!0),await t()}finally{r(!1),n()}};return a(g,{open:h,onOpenChange:n,children:l(y,{"data-testid":p,children:[a(b,{children:a(v,{children:m})}),a(x,{children:f}),l(k,{children:[a(d,{asChild:!0,children:a(i,{variant:"outline",onClick:n,"data-testid":"alert-dialog-cancel-button",children:C})}),typeof t=="function"&&t.constructor.name==="AsyncFunction"?a(i,{variant:c,onClick:s,isLoading:o,"data-testid":"alert-dialog-confirm-button",children:e}):a(d,{asChild:!0,children:a(i,{variant:c,onClick:s,isLoading:o,"data-testid":"alert-dialog-confirm-button",children:e})})]})]})})};export{A as AlertDialog};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as s,jsx as a,Fragment as b}from"react/jsx-runtime";import h from"react";import{ch as L,ci as S,cj as U,ck as O,cl as H,cm as P,cn as V,bG as n,co as q,aA as B,cp as D,cq as G,cr as g,cs as C,bH as E,ac as K,ct as f,cu as M,cv as I,cw as c}from"./runtime-
|
|
1
|
+
import{jsxs as s,jsx as a,Fragment as b}from"react/jsx-runtime";import h from"react";import{ch as L,ci as S,cj as U,ck as O,cl as H,cm as P,cn as V,bG as n,co as q,aA as B,cp as D,cq as G,cr as g,cs as C,bH as E,ac as K,ct as f,cu as M,cv as I,cw as c}from"./runtime-DM500Cza.js";import"react-dom";import"react-dom/client";import{F as J,C as Q}from"./flask-conical-nC8mH7pZ.js";const X=({onEdit:u,searchQuery:d=""})=>{const{captureException:w}=L(),z=S(),{isFeatureEnabled:T}=U(),j=T(O.CREATE_WORKFLOW_TESTBENCH),[A,m]=h.useState(!1),[i,p]=h.useState(null),{data:v=[],isLoading:F,isFetching:N,refetch:x}=H({offset:0,limit:100,status:null}),y=h.useMemo(()=>{const e=d.trim().toLowerCase();return e?v.filter(t=>{const l=(t.name||"").toLowerCase(),o=(t.description||"").toLowerCase();return l.includes(e)||o.includes(e)}):v},[v,d]),$=P(),W=V(),R=async(e,t)=>{var l,o;try{const r=await $.mutateAsync({uuid:e,reviewNotes:"Approved by admin"});(l=r==null?void 0:r.data)!=null&&l.success?c({title:"Success",description:`Workflow "${t}" approved successfully.`}):c({title:"Error",description:((o=r==null?void 0:r.data)==null?void 0:o.error)||"Failed to approve workflow"})}catch(r){w({error:r,contexts:{workflow_operation:{operation:"approveWorkflow",workflowUuid:e,workflowName:t}}}),c({title:"Error",description:"Failed to approve workflow"})}},k=(e,t)=>{p({uuid:e,name:t}),m(!0)},_=async()=>{var e;if(i)try{const t=await W.mutateAsync({uuid:i.uuid});(e=t==null?void 0:t.data)!=null&&e.success?(c({title:"Success",description:`Workflow "${i.name}" has been removed successfully.`}),x()):c({title:"Error",description:"Failed to remove workflow",variant:"destructive"})}catch(t){w({error:t,contexts:{workflow_operation:{operation:"deleteWorkflow",workflowUuid:i.uuid,workflowName:i.name}}}),c({title:"Error",description:"Failed to remove workflow",variant:"destructive"})}finally{p(null),m(!1)}};return s("div",{className:"space-y-6",children:[a("div",{className:"flex items-center justify-between",children:s("div",{children:[s("div",{className:"flex items-center",children:[a("h3",{className:"text-lg font-medium",children:"All Workflow Proposals"}),a(n,{onClick:()=>x(),variant:"ghost",size:"sm",icon:a(q,{className:N?"animate-spin":""}),disabled:N})]}),a("p",{className:"text-sm text-neutral03 mt-1",children:"Review workflow proposals submitted by team members, including pending, approved, and rejected ones."})]})}),F?a("div",{className:"flex items-center justify-center min-h-[40vh] h-full",children:a(B,{size:12})}):y.length===0?a(D,{className:"shadow-none",children:s(G,{className:"flex flex-col items-center justify-center py-12",children:[a(g,{className:"w-12 h-12 text-neutral03 mb-4"}),a("p",{className:"text-neutral03 mb-2 text-center",children:d.trim()?`No workflow proposals match "${d.trim()}".`:"No workflow proposals found."}),!d.trim()&&a("p",{className:"text-sm text-neutral03 text-center",children:"Team members haven't submitted any workflow proposals yet."})]})}):a("div",{className:"space-y-4",children:y.map(e=>{var t,l,o,r;return a("div",{className:"space-y-0",children:s("div",{className:`
|
|
2
2
|
relative p-6 border border-border-primary min-h-[160px] flex flex-col group
|
|
3
3
|
transition-all duration-200 ease-in-out
|
|
4
4
|
bg-secondary-background rounded-lg hover:bg-gray-50 dark:hover:bg-neutral-800 hover:border-primary01/40
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as n,jsxs as g,Fragment as E}from"react/jsx-runtime";import Z,{forwardRef as ct,useCallback as U,useRef as T,useEffect as M,useState as S,useMemo as _}from"react";import{fO as tt,fP as ne,fQ as w,fR as et,fS as ht,fT as ut,fU as ie,fV as pt,fW as ft,fX as gt,fY as mt,fZ as bt,f_ as yt,f$ as vt,g0 as wt,g1 as nt,g2 as xt,g3 as It,g4 as Ct,cL as Ot,g5 as oe,g6 as se,g7 as Ut,g8 as kt,g9 as re,ga as le,gb as ae,gc as de,gd as ce,ge as Tt,gf as he,gg as ue,gh as pe,gi as fe,gj as D,gk as F,gl as ge,gm as Nt,gn as St,go as zt,gp as Et,gq as q,gr as J,eD as me,eE as be,gs as ye,gt as ve,gu as we,gv as xe,gw as Ie,gx as Ce,gy as G,gz as Oe,gA as Ue,j as Dt,gB as ke,gC as Te,bS as Ne,bT as Se,fJ as ze,bV as Ee,ch as De,cj as Me,gD as Ae,cw as it,gE as Mt,gF as Pe,gG as He,d5 as Re,e7 as Le,c7 as At,bX as Fe,aA as ot,gH as Be,c_ as Ve,c$ as Ke,gI as $e,gJ as We,gK as je,gL as _e,gM as qe,gN as Je,gO as Ge,ck as Xe,gP as Qe,gQ as Ye,gR as Ze,gS as Pt,gT as tn,gU as en,gV as nn,dx as on,gW as sn}from"./runtime-1GIBxgTL.js";import{createPortal as Ht}from"react-dom";import{P as rn,A as ln,a as an,b as dn}from"./paintbrush-1ni65PvN.js";import{A as cn,L as hn}from"./link-2-off-BxzkY1Ur.js";const X=ct(({editor:t,alignmentType:e,alignment:o,index:i,orientation:r,hideWhenUnavailable:s=!1,onAligned:d,text:l,onClick:f,children:u,...a},h)=>{const{editor:m}=tt(t),{isVisible:b,handleAlign:x,label:I,canAlignCell:v,Icon:z,isActive:k}=ne({editor:m,alignmentType:e,alignment:o,index:i,orientation:r,hideWhenUnavailable:s,onAligned:d}),P=U(H=>{f==null||f(H),!H.defaultPrevented&&x()},[x,f]);return b?n(w,{type:"button",disabled:!v,"data-style":"ghost","data-active-state":k?"on":"off","data-disabled":!v,role:"button",tabIndex:-1,"aria-label":I,"aria-pressed":k,tooltip:I,onClick:P,...a,ref:h,children:u??g(E,{children:[n(z,{className:"tiptap-button-icon"}),l&&n("span",{className:"tiptap-button-text",children:l})]})}):null});X.displayName="TableAlignCellButton";const st=ct(({editor:t,action:e,hideWhenUnavailable:o=!1,onExecuted:i,text:r,onClick:s,children:d,...l},f)=>{const{editor:u}=tt(t),{isVisible:a,handleExecute:h,label:m,canExecute:b,Icon:x}=et({editor:u,action:e,hideWhenUnavailable:o,onExecuted:i}),I=U(v=>{s==null||s(v),!v.defaultPrevented&&h()},[h,s]);return a?n(w,{type:"button",disabled:!b,"data-style":"ghost","data-active-state":"off","data-disabled":!b,role:"button",tabIndex:-1,"aria-label":m,"aria-pressed":!1,tooltip:m,onClick:I,...l,ref:f,children:d??g(E,{children:[n(x,{className:"tiptap-button-icon"}),r&&n("span",{className:"tiptap-button-text",children:r})]})}):null});st.displayName="TableMergeSplitCellButton";function un(t,e){const o=Math.min(t.top,e.top),i=Math.max(t.bottom,e.bottom),r=Math.min(t.left,e.left),s=Math.max(t.right,e.right)-r,d=i-o,l=r,f=o;return new DOMRect(l,f,s,d)}var pn=class{constructor({editor:t,element:e,view:o,updateDelay:i=250,resizeDelay:r=60,shouldShow:s,appendTo:d,getReferencedVirtualElement:l,options:f}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:a,state:h,from:m,to:b})=>{const{doc:x,selection:I}=h,{empty:v}=I,z=!x.textBetween(m,b).length&&ie(h.selection),k=this.element.contains(document.activeElement);return!(!(a.hasFocus()||k)||v||z||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(h=this.element.parentNode)!=null&&h.contains(a.relatedTarget)||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(a,h)=>{const m=!(h!=null&&h.selection.eq(a.state.selection)),b=!(h!=null&&h.doc.eq(a.state.doc));!m&&!b||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,m,b,h)},this.updateDelay))},this.updateHandler=(a,h,m,b)=>{const{composing:x}=a;if(!(x||!h&&!m)){if(!this.getShouldShow(b)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:a})=>{a.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=t,this.element=e,this.view=o,this.updateDelay=i,this.resizeDelay=r,this.appendTo=d,this.scrollTarget=(u=f==null?void 0:f.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...f},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(pt(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(ft(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(gt(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(mt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(bt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(yt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(vt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(wt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t;const{selection:e}=this.editor.state,o=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(o)return o;const i=nt(this.view,e.from,e.to);let r={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(e instanceof xt){let s=this.view.nodeDOM(e.from);const d=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");d&&(s=d),s&&(r={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof It){const{$anchorCell:s,$headCell:d}=e,l=s?s.pos:d.pos,f=d?d.pos:s.pos,u=this.view.nodeDOM(l),a=this.view.nodeDOM(f);if(!u||!a)return;const h=u===a?u.getBoundingClientRect():un(u.getBoundingClientRect(),a.getBoundingClientRect());r={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return r}updatePosition(){const t=this.virtualElement;t&&Ct(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:o,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${e}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:o}=t,i=o.selection.from!==o.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,e);return}const r=!(e!=null&&e.selection.eq(t.state.selection)),s=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,r,s,e)}getShouldShow(t){var e;const{state:o}=this.view,{selection:i}=o,{ranges:r}=i,s=Math.min(...r.map(l=>l.$from.pos)),d=Math.max(...r.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:t,from:s,to:d}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1",(t=(typeof this.appendTo=="function"?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Rt=t=>new ht({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new pn({view:e,...t})});Ot.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Rt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fn=class{constructor({editor:t,element:e,view:o,options:i,appendTo:r,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:d,state:l})=>{const{selection:f}=l,{$anchor:u,empty:a}=f,h=u.depth===1,m=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!d.hasFocus()||!a||!h||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(d,l,f,u)=>{const{composing:a}=d;if(!(a||!l&&!f)){if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var l;if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&(l=this.element.parentNode)!=null&&l.contains(d.relatedTarget)||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=e,this.view=o,this.appendTo=r,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return oe(t,{textSerializers:se(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(pt(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(ft(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(gt(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(mt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(bt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(yt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(vt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(wt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:o}=this.view,{selection:i}=o,{ranges:r}=i,s=Math.min(...r.map(l=>l.$from.pos)),d=Math.max(...r.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:o,oldState:t,from:s,to:d})}updatePosition(){const{selection:t}=this.editor.state,e=nt(this.view,t.from,t.to);Ct({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const o=!(e!=null&&e.selection.eq(t.state.selection)),i=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,o,i,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1",(t=(typeof this.appendTo=="function"?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Lt=t=>new ht({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new fn({view:e,...t})});Ot.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Lt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var gn=Z.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:o,resizeDelay:i,appendTo:r,shouldShow:s=null,getReferencedVirtualElement:d,options:l,children:f,...u},a)=>{const h=T(document.createElement("div"));typeof a=="function"?a(h.current):a&&(a.current=h.current);const{editor:m}=Ut(),b=e||m,x={updateDelay:o,resizeDelay:i,appendTo:r,pluginKey:t,shouldShow:s,getReferencedVirtualElement:d,options:l},I=T(x);return I.current=x,M(()=>{if(b!=null&&b.isDestroyed)return;if(!b){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=h.current;v.style.visibility="hidden",v.style.position="absolute";const z=Rt({...I.current,editor:b,element:v});b.registerPlugin(z);const k=I.current.pluginKey;return()=>{b.unregisterPlugin(k),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[b]),Ht(n("div",{...u,children:f}),h.current)});Z.forwardRef(({pluginKey:t="floatingMenu",editor:e,appendTo:o,shouldShow:i=null,options:r,children:s,...d},l)=>{const f=T(document.createElement("div"));typeof l=="function"?l(f.current):l&&(l.current=f.current);const{editor:u}=Ut();return M(()=>{const a=f.current;if(a.style.visibility="hidden",a.style.position="absolute",e!=null&&e.isDestroyed||u!=null&&u.isDestroyed)return;const h=e||u;if(!h){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const m=Lt({editor:h,element:a,pluginKey:t,appendTo:o,shouldShow:i,options:r});return h.registerPlugin(m),()=>{h.unregisterPlugin(t),window.requestAnimationFrame(()=>{a.parentNode&&a.parentNode.removeChild(a)})}},[e,u,o,t,i,r]),Ht(n("div",{...d,children:s}),f.current)});function Ft(t){return t.isInline&&t.type.isAtom}function mn(t){if(!t.type.isTextblock)return!1;let e=!1,o=!1;return t.forEach(i=>{var r;Ft(i)?e=!0:i.isText?(r=i.text)!=null&&r.trim()&&(o=!0):o=!0}),e&&!o}function bn(t){if(!(t instanceof xt))return!1;const{node:e}=t;return e.type.isTextblock?mn(e):!0}function yn(t,e){if(!(t instanceof kt)||t.empty)return!1;const{from:o,to:i}=t;if(e.textBetween(o,i).trim()!=="")return!1;let r=!1;return e.nodesBetween(o,i,s=>{Ft(s)&&(r=!0)}),r}const Bt="inlineStyle",Vt="textStyle",Kt=["font-family","font-size"],vn=t=>{if(!t)return null;const e=t.split(";").map(o=>o.trim()).filter(o=>{var i;if(!o)return!1;const r=(i=o.split(":")[0])==null?void 0:i.trim().toLowerCase();return!!r&&!Kt.includes(r)}).join("; ");return e.length>0?e:null},$t=t=>{const e=t.attrs??{};return e.fontFamily||e.fontSize?!0:typeof e.style=="string"?Kt.some(o=>new RegExp(`(^|;)\\s*${o}\\s*:`,"i").test(e.style)):!1},wn=t=>{if(!t||!t.isEditable)return!1;const{selection:e,doc:o}=t.state;if(e.empty)return!1;let i=!1;return o.nodesBetween(e.from,e.to,r=>{if(i)return!1;if(!r.isInline)return!0;for(const s of r.marks)if((s.type.name===Bt||s.type.name===Vt)&&$t(s))return i=!0,!1;return!0}),i},xn=t=>{if(!t||!t.isEditable)return!1;const{state:e,view:o}=t,{selection:i}=e;if(i.empty)return!1;const r=e.tr;return e.doc.nodesBetween(i.from,i.to,(s,d)=>(s.isInline&&s.marks.forEach(l=>{if(l.type.name!==Bt&&l.type.name!==Vt||!$t(l))return;const f=d,u=d+s.nodeSize,a={...l.attrs};a.fontFamily=null,a.fontSize=null,typeof a.style=="string"&&(a.style=vn(a.style));const h=Object.values(a).some(m=>m!=null&&m!=="");r.removeMark(f,u,l.type),h&&r.addMark(f,u,l.type.create(a))}),!0)),r.docChanged?(o.dispatch(r),t.commands.focus(),!0):!1};function In(t,e,o){const i=t!==null&&t.from===e.from&&t.to===e.to?t:{from:e.from,to:e.to,left:o.left,width:o.width};return{anchor:i,rect:{left:i.left,width:i.width,top:o.top,height:o.height}}}function Cn(t){return t.docChanged?t.steps.every(e=>e instanceof re||e instanceof le):!0}const On="--",Un=({editor:t,open:e,onOpenChange:o})=>{const i=ae(),r=de(t),s=r??ce(t),d=U(m=>{Tt(t,i.toStorage(i.round(m)))},[t,i]),l=U(m=>{s!==null&&d(he(i,i.toDisplay(s),m))},[d,s,i]),f=U(()=>{Tt(t,null)},[t]);if(!ue(t))return null;const u=s===null?null:i.round(i.toDisplay(s)),a=`Font size (${i.unit})`,h=i.isPt?pe:fe;return g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Decrease font size",tooltip:"Decrease font size","data-testid":"bubble-font-size-decrease",disabled:s===null||s<=Nt.min,onClick:()=>l(-1),children:n(ge,{className:"tiptap-button-icon"})}),n(St,{placement:"bottom",open:e,onOpenChange:o,trigger:n(J,{render:g(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":a,tooltip:a,"data-testid":"bubble-font-size-trigger",children:[n("span",{className:"tiptap-button-text",children:u===null?On:String(u)}),n(me,{className:"tiptap-button-icon"})]})}),children:n(zt,{portal:!0,children:g(Et,{children:[n(q,{render:n(w,{"data-style":"ghost"}),"data-testid":"bubble-font-size-default",disabled:r===null,onClick:f,children:n("span",{className:"tiptap-button-text",children:"Default size"})}),h.map(m=>n(q,{render:n(w,{"data-style":"ghost","data-active-state":u===m?"on":"off"}),"data-testid":`bubble-font-size-option-${m}`,onClick:()=>d(m),children:n("span",{className:"tiptap-button-text",children:m})},m))]})})}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Increase font size",tooltip:"Increase font size","data-testid":"bubble-font-size-increase",disabled:s===null||s>=Nt.max,onClick:()=>l(1),children:n(be,{className:"tiptap-button-icon"})})]})]})},kn="1000";function Wt(t){const{selection:e}=t;return bn(e)||yn(e,t.doc)?!1:!e.empty&&!(e instanceof It)}const Tn=({editor:t,mode:e="full",orderedListStyles:o=!1,onComment:i})=>{const[r,s]=S(null),[d,l]=S(""),[,f]=S({}),[u,a]=S(!1),h=T(!1),m=T(t.state.selection.empty),[b,x]=S(0),I=T(null),v=T(!1),z=T(null),k=T(null),P=U(()=>{const{selection:c}=t.state;if(!(c instanceof kt))return null;const O=nt(t.view,c.from,c.to),p=In(k.current,c,O);k.current=p.anchor;const N=new DOMRect(p.rect.left,p.rect.top,p.rect.width,p.rect.height);return{getBoundingClientRect:()=>N,getClientRects:()=>[N]}},[t]),H=U(c=>{c&&(c.style.zIndex=kn)},[]),B=(ye(t,"textStyle")||{}).color||void 0;M(()=>{const c=({transaction:O})=>{Cn(O)||(k.current=null);const p=t.state.selection.empty,N=m.current;m.current=p,!(p&&N&&!h.current)&&f({})};return t.on("transaction",c),()=>{t.off("transaction",c)}},[t]),M(()=>{u||(s(null),l(""),x(c=>c+1),I.current=null)},[u]),M(()=>{const c=()=>{if(v.current){v.current=!1,I.current={from:t.state.selection.from,to:t.state.selection.to};return}const{from:O,to:p}=t.state.selection,N=I.current;N&&(N.from!==O||N.to!==p)&&(s(null),l(""),x(Y=>Y+1)),I.current={from:O,to:p}};return t.on("selectionUpdate",c),()=>{t.off("selectionUpdate",c)}},[t]);const A=()=>{var c;try{const{$from:O}=t.state.selection,p=O.node(O.depth);return((c=p==null?void 0:p.attrs)==null?void 0:c.nodeTextAlign)||null}catch{return null}},j=U(()=>{const{href:c}=t.getAttributes("link");return c||""},[t]),R=U(()=>{s(null),l("")},[]),L=U(()=>{let c=d.trim();c&&(/^https?:\/\//i.test(c)||(c=`https://${c}`),v.current=!0,t.chain().focus().setLink({href:c}).run(),s(null),l(""))},[t,d]),V=U(()=>{v.current=!0,t.chain().focus().unsetLink().run(),s(null),l("")},[t]),Q=U(()=>{r==="link"?(s(null),l("")):(s("link"),l(j()),requestAnimationFrame(()=>{var c;(c=z.current)==null||c.focus()}))},[r,j]),K=u||Wt(t.state);return n(gn,{ref:H,editor:t,updateDelay:100,getReferencedVirtualElement:P,options:{placement:"top",offset:8,flip:!0,onShow:()=>{h.current=!0,a(!0)},onHide:()=>{h.current=!1,a(!1)}},shouldShow:({state:c})=>r!==null?!0:Wt(c),children:K&&g("div",{className:"flex items-center gap-1 bg-white rounded-lg shadow-lg border border-neutral06 p-1 dark:bg-neutral-900",onMouseDown:c=>{c.preventDefault()},children:[n(ve,{editor:t,orderedListStyles:o&&e!=="blueprint",open:r==="turnInto",onOpenChange:c=>s(c?"turnInto":null)}),n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("bold")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Bold",tooltip:"Bold",onClick:()=>t.chain().focus().toggleBold().run(),children:n(we,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("italic")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Italic",tooltip:"Italic",onClick:()=>t.chain().focus().toggleItalic().run(),children:n(xe,{className:"tiptap-button-icon"})}),e!=="blueprint"&&g(E,{children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("underline")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Underline",tooltip:"Underline",onClick:()=>t.chain().focus().toggleUnderline().run(),children:n(Ie,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("strike")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Strikethrough",tooltip:"Strikethrough",onClick:()=>t.chain().focus().toggleStrike().run(),children:n(Ce,{className:"tiptap-button-icon"})})]})]}),e!=="blueprint"&&n(Un,{editor:t,open:r==="fontSize",onOpenChange:c=>s(c?"fontSize":null)}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(G,{editor:t,kind:"text",placement:"bottom",open:r==="textColor",onOpenChange:c=>s(c?"textColor":null),trigger:n(J,{render:n(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Text Color",tooltip:"Text Color",children:n(Oe,{className:"tiptap-button-icon",style:B?{color:B}:void 0})})})}),n(G,{editor:t,kind:"highlight",placement:"bottom",open:r==="highlightColor",onOpenChange:c=>s(c?"highlightColor":null),trigger:n(J,{render:n(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight Color",tooltip:"Highlight Color",children:n(rn,{className:"tiptap-button-icon"})})})})]})]}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost","data-active-state":A()==="left"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Left",tooltip:"Align Left",onClick:()=>t.chain().focus().setNodeTextAlign("left").run(),children:n(ln,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="center"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Center",tooltip:"Align Center",onClick:()=>t.chain().focus().setNodeTextAlign("center").run(),children:n(an,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="right"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Right",tooltip:"Align Right",onClick:()=>t.chain().focus().setNodeTextAlign("right").run(),children:n(dn,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="justify"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Justify",tooltip:"Align Justify",onClick:()=>t.chain().focus().setNodeTextAlign("justify").run(),children:n(cn,{className:"tiptap-button-icon"})})]})]}),n(D,{orientation:"vertical"}),g("div",{className:"relative",children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("link")?"on":"off",role:"button",tabIndex:-1,"aria-label":t.isActive("link")?"Edit Link":"Add Link",tooltip:t.isActive("link")?"Edit Link":"Add Link",onClick:Q,children:t.isActive("link")?n(hn,{className:"tiptap-button-icon"}):n(Ue,{className:"tiptap-button-icon"})}),r==="link"&&n("div",{className:"absolute top-full left-0 mt-2 w-80 bg-white border border-neutral06 rounded-lg shadow-lg z-50 dark:bg-neutral-900",onMouseDown:c=>c.stopPropagation(),children:g("div",{className:"flex flex-col gap-2 p-3",children:[n("label",{htmlFor:"link-url",className:"text-sm font-medium text-neutral02",children:t.isActive("link")?"Edit Link":"Add Link"}),n("input",{ref:z,id:"link-url",type:"url",value:d,onChange:c=>l(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),L()):c.key==="Escape"&&(c.preventDefault(),R())},placeholder:"https://example.com",className:"px-3 py-2 text-sm border border-neutral06 rounded-md focus:outline-none focus:ring-2 focus:ring-primary01 focus:border-transparent bg-white dark:bg-neutral-900"}),g("div",{className:"flex gap-2 justify-end",children:[t.isActive("link")&&n("button",{type:"button",onClick:V,className:"px-3 py-1.5 text-sm font-medium text-red01 hover:bg-red-50 rounded-md transition-colors",children:"Remove"}),n("button",{type:"button",onClick:R,className:"px-3 py-1.5 text-sm font-medium text-neutral02 hover:bg-neutral07 rounded-md transition-colors",children:"Cancel"}),n("button",{type:"button",onClick:L,disabled:!d.trim(),className:Dt("px-3 py-1.5 text-sm font-medium text-white rounded-md transition-colors",d.trim()?"bg-primary01 hover:bg-primary02":"bg-neutral06 cursor-not-allowed"),children:t.isActive("link")?"Update":"Add"})]})]})})]}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Reset font to default",tooltip:"Reset font to default",disabled:!wn(t),onClick:()=>{v.current=!0,xn(t)},children:n(ke,{className:"tiptap-button-icon"})})]}),e!=="blueprint"&&t.isActive("table")&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(X,{editor:t,alignmentType:"text",alignment:"left",hideWhenUnavailable:!0}),n(X,{editor:t,alignmentType:"text",alignment:"center",hideWhenUnavailable:!0}),n(X,{editor:t,alignmentType:"text",alignment:"right",hideWhenUnavailable:!0})]}),n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(st,{editor:t,action:"merge",hideWhenUnavailable:!0}),n(st,{editor:t,action:"split",hideWhenUnavailable:!0})]})]}),i&&g(E,{children:[n(D,{orientation:"vertical"}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Comment",tooltip:"Comment",onClick:i,children:n(Te,{className:"tiptap-button-icon"})})]})]},b)})};function Nn({isReadOnly:t,isStreaming:e,isSaving:o}){return t||e||o?null:g(Ne,{delayDuration:200,children:[n(Se,{asChild:!0,children:g("span",{className:"flex items-center gap-1 text-xs text-neutral03 flex-shrink-0 cursor-default","data-testid":"bor-letter-editable-indicator",children:[n(ze,{className:"w-3 h-3"}),n("span",{children:"Editable"})]})}),n(Ee,{children:"Click anywhere in the letter to edit \u2014 changes save automatically"})]})}const Sn=on(()=>import("./MarkdownExportPreviewDialog-Ane3qAcW.js").then(t=>t.MarkdownExportPreviewDialog),{}),zn=1500;function En(){const t=et({action:"merge"}),e=et({action:"split"}),o=sn({resetAttrs:!0});return{mergeAction:{icon:t.Icon,label:t.label,onClick:t.handleExecute,isAvailable:t.canExecute},splitAction:{icon:e.Icon,label:e.label,onClick:e.handleExecute,isAvailable:e.canExecute},clearAction:{icon:o.Icon,label:o.label,onClick:o.handleClear,isAvailable:o.canClearRowColumnContent}}}function Dn({editor:t}){const[e,o]=S(!1),i=U(()=>{o(!1),t==null||t.commands.unfreezeHandles()},[t]),r=U(s=>{o(s),t&&(s?t.commands.freezeHandles():t.commands.unfreezeHandles())},[t]);return{isMenuOpen:e,handleMenuToggle:r,closeMenu:i}}const rt=({action:t})=>{const{icon:e,label:o,onClick:i,isActive:r=!1}=t;return g(q,{render:n(w,{"data-style":"ghost","data-active-state":r?"on":"off"}),onClick:i,children:[n(e,{className:"tiptap-button-icon"}),n("span",{className:"tiptap-button-text",children:o})]})},jt=Z.forwardRef(({editor:t,onOpenChange:e,className:o,...i},r)=>{const{editor:s}=tt(t),{isMenuOpen:d,handleMenuToggle:l,closeMenu:f}=Dn({editor:s}),{mergeAction:u,splitAction:a,clearAction:h}=En(),{canFitToWidth:m,handleFitToWidth:b,label:x,Icon:I}=Qe({editor:s,hideWhenUnavailable:!1});M(()=>{e==null||e(d)},[d,e]);const v=u.isAvailable||a.isAvailable;return n(St,{open:d,onOpenChange:l,placement:"bottom-start",trigger:n(J,{ref:r,className:nn("expandable-menu-button",d&&"menu-opened",o),"aria-label":"Table cells option","aria-haspopup":"menu","aria-expanded":d,...i,children:n(en,{className:"tiptap-button-icon"})}),children:g(zt,{autoFocusOnShow:!0,modal:!0,onClose:f,children:[n(Ye,{style:Ze}),g(Et,{style:{minWidth:"15rem"},children:[v&&g(Pt,{children:[u.isAvailable&&n(rt,{action:u}),a.isAvailable&&n(rt,{action:a}),n(D,{orientation:"horizontal"})]}),g(Pt,{children:[n(G,{kind:"text"}),n(G,{kind:"background"}),n(tn,{}),h.isAvailable&&n(rt,{action:h}),g(q,{render:n(w,{"data-style":"ghost","data-active-state":"off"}),onClick:b,disabled:!m,children:[n(I,{className:"tiptap-button-icon"}),n("span",{className:"tiptap-button-text",children:x})]})]})]})]})})});jt.displayName="BORTableCellHandleMenu";function Mn({markdownContent:t,tiptapContent:e,title:o,isStreaming:i,onContentChange:r,onSave:s,conversationId:d,letterId:l,toolInfo:f,getMessageIdForArtifact:u,onDownloadAllLetters:a,completedLettersCount:h=0,uploadedFiles:m,isReadOnly:b}){const x=T(null),{captureException:I}=De(),{isFeatureEnabled:v}=Me(),[z]=S(!1),[k,P]=S(!1),[H,B]=S(!1),[A,j]=S("pdf"),R=T(!1),L=T(null),V=T(!1),Q=!l||!d,K=_(()=>Ae(async y=>{if(s){P(!0);try{await s(y)}catch(C){I({error:C}),it({title:"Auto-save failed",description:"Changes could not be saved",variant:"destructive"})}finally{P(!1)}}},zn),[s,I]);M(()=>()=>{K.cancel()},[K]);const c=U(()=>e&&e.content&&e.content.length>0?e:t&&t.trim()?Mt(t):{type:"doc",content:[]},[e,t]),O=_(()=>c(),[c]),p=Pe({immediatelyRender:!1,editable:!i&&!b,autofocus:!1,extensions:He,content:{type:"doc",content:[]},onUpdate:({editor:y})=>{if(!V.current||i||b)return;R.current=!0;const C=y.getJSON();L.current=C,r&&r(C),K(C),setTimeout(()=>{R.current=!1},100)}});M(()=>{p&&!p.isDestroyed&&p.setEditable(!i&&!b)},[p,i,b]),M(()=>{if(!p||p.isDestroyed||R.current&&!i)return;const y=O.content&&O.content.length>0;if(i){p.commands.setContent(O),L.current=O;return}y&&(p.commands.setContent(O),p.commands.setTextSelection(0),L.current=O,V.current||(V.current=!0))},[p,O,i]);const N=y=>{if(!x.current||i)throw new Error("Could not find content to export");const C=lt();C&&(j(y),Yt(C),B(!0))},Y=async()=>N("pdf"),_t=async()=>N("docx"),qt=()=>{B(!1)},Jt=async(y,C,$)=>{var at;try{if(!l||!d)throw new Error("Missing letter ID or conversation ID");const W=u==null?void 0:u(l);if(!W)throw new Error("Could not find message for this letter");const te=y==="like"?"POSITIVE":"NEGATIVE",ee={reasons:C,artifact_id:l,message_id:W,conversation_id:d,feedback_text:$||void 0,tool_id:f==null?void 0:f.id},dt=await Ge(W,te,$||void 0,ee,{tool_name:f==null?void 0:f.name},v(Xe.AI_FEEDBACK_NOTIFICATIONS));if(dt.statusCode!==200||!((at=dt.data)!=null&&at.success))throw new Error("Failed to submit feedback");it({title:"Feedback Submitted",description:"Your feedback submitted successfully.",variant:"success"})}catch(W){I({error:W,contexts:{payload:{letterId:l,conversationId:d,toolInfo:f}}}),it({title:"Error",description:"Failed to submit feedback. Please try again.",variant:"destructive"})}},Gt=_(()=>{const y=()=>{const C=x.current;if(!C)throw new Error("BOR letter export invoked before the editor container mounted");return C};return{generatePdf:C=>Le(y(),o,C),generateWord:C=>Re(y(),o,!1,C)}},[o]),Xt=p&&p.getText().trim().length>0||i||t&&t.trim().length>0||e&&e.content&&e.content.length>0,lt=U(()=>{if(p&&!p.isDestroyed){const y=p.getJSON();if(y&&y.content&&y.content.length>0)return y}return e&&e.content&&e.content.length>0?e:t&&t.trim()?Mt(t):null},[p,e,t]),[Qt,Yt]=S(null),Zt=_(()=>{if(p&&!p.isDestroyed){const y=p.getText();if(y!=null&&y.trim())return y}return(t==null?void 0:t.trim())??""},[p,t]);return g("div",{className:"flex flex-col h-full rounded-b-lg overflow-hidden",children:[g("div",{className:"flex justify-between gap-2 items-center py-4 px-6 bg-white z-10 border-b border-border-primary dark:bg-neutral-900",children:[g("div",{className:"flex items-center gap-3 truncate",children:[n(At,{className:"w-4 h-4 flex-shrink-0"}),n(Fe,{tooltipContent:o,children:n("h2",{className:"text-base font-semibold truncate",children:o})}),i&&n(ot,{size:4,className:"flex-shrink-0"}),k&&!i&&!b&&g("div",{className:"flex items-center gap-1 text-xs text-neutral03",children:[n(ot,{size:3,className:"text-current"}),n("span",{children:"Saving..."})]}),n(Nn,{isReadOnly:b,isStreaming:i,isSaving:k})]}),n(Be,{originFeature:"workflows",contentRef:x,fileGenerators:Gt,defaultName:o,disabled:i||!Xt,showCopy:!0,showDownload:!0,showExport:!0,copyTooltip:"Copy Letter",onExportPDF:Y,onExportWord:_t,isExportingPDFExternal:z,uploadedFiles:m,artifactContent:Zt,testIdPrefix:"bor-letter",feedbackConfig:d&&l?{isDisabled:Q,onSubmit:Jt,artifactId:l}:void 0,customButtonsAfter:a&&h>1?[{key:"export-all-pdf",icon:n(Ve,{className:"h-4 w-4"}),tooltip:`Export All Letters as PDF (${h})`,onClick:()=>a("pdf")},{key:"export-all-docx",icon:n(Ke,{className:"h-4 w-4"}),tooltip:`Export All Letters as DOCX (${h})`,onClick:()=>a("docx")}]:void 0,layoutMode:"grouped",exportTiptapContent:lt()})]}),n($e,{className:"flex-1 bg-white rounded-b-lg dark:bg-neutral-900",children:n("div",{className:"p-6",children:g("div",{ref:x,className:Dt("max-w-3xl mx-auto bg-white rounded-lg p-8 overflow-visible","shadow-[0_4px_20px_rgba(0,0,0,0.08)]",i&&"min-h-[200px]"),children:[n("style",{jsx:!0,global:!0,children:`
|
|
1
|
+
import{jsx as n,jsxs as g,Fragment as E}from"react/jsx-runtime";import Z,{forwardRef as ct,useCallback as U,useRef as T,useEffect as M,useState as S,useMemo as _}from"react";import{fO as tt,fP as ne,fQ as w,fR as et,fS as ht,fT as ut,fU as ie,fV as pt,fW as ft,fX as gt,fY as mt,fZ as bt,f_ as yt,f$ as vt,g0 as wt,g1 as nt,g2 as xt,g3 as It,g4 as Ct,cL as Ot,g5 as oe,g6 as se,g7 as Ut,g8 as kt,g9 as re,ga as le,gb as ae,gc as de,gd as ce,ge as Tt,gf as he,gg as ue,gh as pe,gi as fe,gj as D,gk as F,gl as ge,gm as Nt,gn as St,go as zt,gp as Et,gq as q,gr as J,eD as me,eE as be,gs as ye,gt as ve,gu as we,gv as xe,gw as Ie,gx as Ce,gy as G,gz as Oe,gA as Ue,j as Dt,gB as ke,gC as Te,bS as Ne,bT as Se,fJ as ze,bV as Ee,ch as De,cj as Me,gD as Ae,cw as it,gE as Mt,gF as Pe,gG as He,d5 as Re,e7 as Le,c7 as At,bX as Fe,aA as ot,gH as Be,c_ as Ve,c$ as Ke,gI as $e,gJ as We,gK as je,gL as _e,gM as qe,gN as Je,gO as Ge,ck as Xe,gP as Qe,gQ as Ye,gR as Ze,gS as Pt,gT as tn,gU as en,gV as nn,dx as on,gW as sn}from"./runtime-DM500Cza.js";import{createPortal as Ht}from"react-dom";import{P as rn,A as ln,a as an,b as dn}from"./paintbrush-CoZyM9w2.js";import{A as cn,L as hn}from"./link-2-off-D1odjiY5.js";const X=ct(({editor:t,alignmentType:e,alignment:o,index:i,orientation:r,hideWhenUnavailable:s=!1,onAligned:d,text:l,onClick:f,children:u,...a},h)=>{const{editor:m}=tt(t),{isVisible:b,handleAlign:x,label:I,canAlignCell:v,Icon:z,isActive:k}=ne({editor:m,alignmentType:e,alignment:o,index:i,orientation:r,hideWhenUnavailable:s,onAligned:d}),P=U(H=>{f==null||f(H),!H.defaultPrevented&&x()},[x,f]);return b?n(w,{type:"button",disabled:!v,"data-style":"ghost","data-active-state":k?"on":"off","data-disabled":!v,role:"button",tabIndex:-1,"aria-label":I,"aria-pressed":k,tooltip:I,onClick:P,...a,ref:h,children:u??g(E,{children:[n(z,{className:"tiptap-button-icon"}),l&&n("span",{className:"tiptap-button-text",children:l})]})}):null});X.displayName="TableAlignCellButton";const st=ct(({editor:t,action:e,hideWhenUnavailable:o=!1,onExecuted:i,text:r,onClick:s,children:d,...l},f)=>{const{editor:u}=tt(t),{isVisible:a,handleExecute:h,label:m,canExecute:b,Icon:x}=et({editor:u,action:e,hideWhenUnavailable:o,onExecuted:i}),I=U(v=>{s==null||s(v),!v.defaultPrevented&&h()},[h,s]);return a?n(w,{type:"button",disabled:!b,"data-style":"ghost","data-active-state":"off","data-disabled":!b,role:"button",tabIndex:-1,"aria-label":m,"aria-pressed":!1,tooltip:m,onClick:I,...l,ref:f,children:d??g(E,{children:[n(x,{className:"tiptap-button-icon"}),r&&n("span",{className:"tiptap-button-text",children:r})]})}):null});st.displayName="TableMergeSplitCellButton";function un(t,e){const o=Math.min(t.top,e.top),i=Math.max(t.bottom,e.bottom),r=Math.min(t.left,e.left),s=Math.max(t.right,e.right)-r,d=i-o,l=r,f=o;return new DOMRect(l,f,s,d)}var pn=class{constructor({editor:t,element:e,view:o,updateDelay:i=250,resizeDelay:r=60,shouldShow:s,appendTo:d,getReferencedVirtualElement:l,options:f}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:a,state:h,from:m,to:b})=>{const{doc:x,selection:I}=h,{empty:v}=I,z=!x.textBetween(m,b).length&&ie(h.selection),k=this.element.contains(document.activeElement);return!(!(a.hasFocus()||k)||v||z||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var h;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(h=this.element.parentNode)!=null&&h.contains(a.relatedTarget)||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(a,h)=>{const m=!(h!=null&&h.selection.eq(a.state.selection)),b=!(h!=null&&h.doc.eq(a.state.doc));!m&&!b||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,m,b,h)},this.updateDelay))},this.updateHandler=(a,h,m,b)=>{const{composing:x}=a;if(!(x||!h&&!m)){if(!this.getShouldShow(b)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:a})=>{a.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=t,this.element=e,this.view=o,this.updateDelay=i,this.resizeDelay=r,this.appendTo=d,this.scrollTarget=(u=f==null?void 0:f.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...f},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(pt(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(ft(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(gt(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(mt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(bt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(yt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(vt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(wt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t;const{selection:e}=this.editor.state,o=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(o)return o;const i=nt(this.view,e.from,e.to);let r={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(e instanceof xt){let s=this.view.nodeDOM(e.from);const d=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");d&&(s=d),s&&(r={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof It){const{$anchorCell:s,$headCell:d}=e,l=s?s.pos:d.pos,f=d?d.pos:s.pos,u=this.view.nodeDOM(l),a=this.view.nodeDOM(f);if(!u||!a)return;const h=u===a?u.getBoundingClientRect():un(u.getBoundingClientRect(),a.getBoundingClientRect());r={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return r}updatePosition(){const t=this.virtualElement;t&&Ct(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:o,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${e}px`,this.element.style.top=`${o}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:o}=t,i=o.selection.from!==o.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,e);return}const r=!(e!=null&&e.selection.eq(t.state.selection)),s=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,r,s,e)}getShouldShow(t){var e;const{state:o}=this.view,{selection:i}=o,{ranges:r}=i,s=Math.min(...r.map(l=>l.$from.pos)),d=Math.max(...r.map(l=>l.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:o,oldState:t,from:s,to:d}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1",(t=(typeof this.appendTo=="function"?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Rt=t=>new ht({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new pn({view:e,...t})});Ot.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Rt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fn=class{constructor({editor:t,element:e,view:o,options:i,appendTo:r,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:d,state:l})=>{const{selection:f}=l,{$anchor:u,empty:a}=f,h=u.depth===1,m=u.parent.isTextblock&&!u.parent.type.spec.code&&!u.parent.textContent&&u.parent.childCount===0&&!this.getTextContent(u.parent);return!(!d.hasFocus()||!a||!h||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(d,l,f,u)=>{const{composing:a}=d;if(!(a||!l&&!f)){if(!this.getShouldShow(u)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var l;if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&(l=this.element.parentNode)!=null&&l.contains(d.relatedTarget)||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=e,this.view=o,this.appendTo=r,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(o,o.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return oe(t,{textSerializers:se(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(pt(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(ft(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(gt(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(mt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(bt(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(yt(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(vt(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(wt(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:o}=this.view,{selection:i}=o,{ranges:r}=i,s=Math.min(...r.map(l=>l.$from.pos)),d=Math.max(...r.map(l=>l.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:o,oldState:t,from:s,to:d})}updatePosition(){const{selection:t}=this.editor.state,e=nt(this.view,t.from,t.to);Ct({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const o=!(e!=null&&e.selection.eq(t.state.selection)),i=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,o,i,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1",(t=(typeof this.appendTo=="function"?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Lt=t=>new ht({key:typeof t.pluginKey=="string"?new ut(t.pluginKey):t.pluginKey,view:e=>new fn({view:e,...t})});Ot.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Lt({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var gn=Z.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:o,resizeDelay:i,appendTo:r,shouldShow:s=null,getReferencedVirtualElement:d,options:l,children:f,...u},a)=>{const h=T(document.createElement("div"));typeof a=="function"?a(h.current):a&&(a.current=h.current);const{editor:m}=Ut(),b=e||m,x={updateDelay:o,resizeDelay:i,appendTo:r,pluginKey:t,shouldShow:s,getReferencedVirtualElement:d,options:l},I=T(x);return I.current=x,M(()=>{if(b!=null&&b.isDestroyed)return;if(!b){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const v=h.current;v.style.visibility="hidden",v.style.position="absolute";const z=Rt({...I.current,editor:b,element:v});b.registerPlugin(z);const k=I.current.pluginKey;return()=>{b.unregisterPlugin(k),window.requestAnimationFrame(()=>{v.parentNode&&v.parentNode.removeChild(v)})}},[b]),Ht(n("div",{...u,children:f}),h.current)});Z.forwardRef(({pluginKey:t="floatingMenu",editor:e,appendTo:o,shouldShow:i=null,options:r,children:s,...d},l)=>{const f=T(document.createElement("div"));typeof l=="function"?l(f.current):l&&(l.current=f.current);const{editor:u}=Ut();return M(()=>{const a=f.current;if(a.style.visibility="hidden",a.style.position="absolute",e!=null&&e.isDestroyed||u!=null&&u.isDestroyed)return;const h=e||u;if(!h){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const m=Lt({editor:h,element:a,pluginKey:t,appendTo:o,shouldShow:i,options:r});return h.registerPlugin(m),()=>{h.unregisterPlugin(t),window.requestAnimationFrame(()=>{a.parentNode&&a.parentNode.removeChild(a)})}},[e,u,o,t,i,r]),Ht(n("div",{...d,children:s}),f.current)});function Ft(t){return t.isInline&&t.type.isAtom}function mn(t){if(!t.type.isTextblock)return!1;let e=!1,o=!1;return t.forEach(i=>{var r;Ft(i)?e=!0:i.isText?(r=i.text)!=null&&r.trim()&&(o=!0):o=!0}),e&&!o}function bn(t){if(!(t instanceof xt))return!1;const{node:e}=t;return e.type.isTextblock?mn(e):!0}function yn(t,e){if(!(t instanceof kt)||t.empty)return!1;const{from:o,to:i}=t;if(e.textBetween(o,i).trim()!=="")return!1;let r=!1;return e.nodesBetween(o,i,s=>{Ft(s)&&(r=!0)}),r}const Bt="inlineStyle",Vt="textStyle",Kt=["font-family","font-size"],vn=t=>{if(!t)return null;const e=t.split(";").map(o=>o.trim()).filter(o=>{var i;if(!o)return!1;const r=(i=o.split(":")[0])==null?void 0:i.trim().toLowerCase();return!!r&&!Kt.includes(r)}).join("; ");return e.length>0?e:null},$t=t=>{const e=t.attrs??{};return e.fontFamily||e.fontSize?!0:typeof e.style=="string"?Kt.some(o=>new RegExp(`(^|;)\\s*${o}\\s*:`,"i").test(e.style)):!1},wn=t=>{if(!t||!t.isEditable)return!1;const{selection:e,doc:o}=t.state;if(e.empty)return!1;let i=!1;return o.nodesBetween(e.from,e.to,r=>{if(i)return!1;if(!r.isInline)return!0;for(const s of r.marks)if((s.type.name===Bt||s.type.name===Vt)&&$t(s))return i=!0,!1;return!0}),i},xn=t=>{if(!t||!t.isEditable)return!1;const{state:e,view:o}=t,{selection:i}=e;if(i.empty)return!1;const r=e.tr;return e.doc.nodesBetween(i.from,i.to,(s,d)=>(s.isInline&&s.marks.forEach(l=>{if(l.type.name!==Bt&&l.type.name!==Vt||!$t(l))return;const f=d,u=d+s.nodeSize,a={...l.attrs};a.fontFamily=null,a.fontSize=null,typeof a.style=="string"&&(a.style=vn(a.style));const h=Object.values(a).some(m=>m!=null&&m!=="");r.removeMark(f,u,l.type),h&&r.addMark(f,u,l.type.create(a))}),!0)),r.docChanged?(o.dispatch(r),t.commands.focus(),!0):!1};function In(t,e,o){const i=t!==null&&t.from===e.from&&t.to===e.to?t:{from:e.from,to:e.to,left:o.left,width:o.width};return{anchor:i,rect:{left:i.left,width:i.width,top:o.top,height:o.height}}}function Cn(t){return t.docChanged?t.steps.every(e=>e instanceof re||e instanceof le):!0}const On="--",Un=({editor:t,open:e,onOpenChange:o})=>{const i=ae(),r=de(t),s=r??ce(t),d=U(m=>{Tt(t,i.toStorage(i.round(m)))},[t,i]),l=U(m=>{s!==null&&d(he(i,i.toDisplay(s),m))},[d,s,i]),f=U(()=>{Tt(t,null)},[t]);if(!ue(t))return null;const u=s===null?null:i.round(i.toDisplay(s)),a=`Font size (${i.unit})`,h=i.isPt?pe:fe;return g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Decrease font size",tooltip:"Decrease font size","data-testid":"bubble-font-size-decrease",disabled:s===null||s<=Nt.min,onClick:()=>l(-1),children:n(ge,{className:"tiptap-button-icon"})}),n(St,{placement:"bottom",open:e,onOpenChange:o,trigger:n(J,{render:g(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":a,tooltip:a,"data-testid":"bubble-font-size-trigger",children:[n("span",{className:"tiptap-button-text",children:u===null?On:String(u)}),n(me,{className:"tiptap-button-icon"})]})}),children:n(zt,{portal:!0,children:g(Et,{children:[n(q,{render:n(w,{"data-style":"ghost"}),"data-testid":"bubble-font-size-default",disabled:r===null,onClick:f,children:n("span",{className:"tiptap-button-text",children:"Default size"})}),h.map(m=>n(q,{render:n(w,{"data-style":"ghost","data-active-state":u===m?"on":"off"}),"data-testid":`bubble-font-size-option-${m}`,onClick:()=>d(m),children:n("span",{className:"tiptap-button-text",children:m})},m))]})})}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Increase font size",tooltip:"Increase font size","data-testid":"bubble-font-size-increase",disabled:s===null||s>=Nt.max,onClick:()=>l(1),children:n(be,{className:"tiptap-button-icon"})})]})]})},kn="1000";function Wt(t){const{selection:e}=t;return bn(e)||yn(e,t.doc)?!1:!e.empty&&!(e instanceof It)}const Tn=({editor:t,mode:e="full",orderedListStyles:o=!1,onComment:i})=>{const[r,s]=S(null),[d,l]=S(""),[,f]=S({}),[u,a]=S(!1),h=T(!1),m=T(t.state.selection.empty),[b,x]=S(0),I=T(null),v=T(!1),z=T(null),k=T(null),P=U(()=>{const{selection:c}=t.state;if(!(c instanceof kt))return null;const O=nt(t.view,c.from,c.to),p=In(k.current,c,O);k.current=p.anchor;const N=new DOMRect(p.rect.left,p.rect.top,p.rect.width,p.rect.height);return{getBoundingClientRect:()=>N,getClientRects:()=>[N]}},[t]),H=U(c=>{c&&(c.style.zIndex=kn)},[]),B=(ye(t,"textStyle")||{}).color||void 0;M(()=>{const c=({transaction:O})=>{Cn(O)||(k.current=null);const p=t.state.selection.empty,N=m.current;m.current=p,!(p&&N&&!h.current)&&f({})};return t.on("transaction",c),()=>{t.off("transaction",c)}},[t]),M(()=>{u||(s(null),l(""),x(c=>c+1),I.current=null)},[u]),M(()=>{const c=()=>{if(v.current){v.current=!1,I.current={from:t.state.selection.from,to:t.state.selection.to};return}const{from:O,to:p}=t.state.selection,N=I.current;N&&(N.from!==O||N.to!==p)&&(s(null),l(""),x(Y=>Y+1)),I.current={from:O,to:p}};return t.on("selectionUpdate",c),()=>{t.off("selectionUpdate",c)}},[t]);const A=()=>{var c;try{const{$from:O}=t.state.selection,p=O.node(O.depth);return((c=p==null?void 0:p.attrs)==null?void 0:c.nodeTextAlign)||null}catch{return null}},j=U(()=>{const{href:c}=t.getAttributes("link");return c||""},[t]),R=U(()=>{s(null),l("")},[]),L=U(()=>{let c=d.trim();c&&(/^https?:\/\//i.test(c)||(c=`https://${c}`),v.current=!0,t.chain().focus().setLink({href:c}).run(),s(null),l(""))},[t,d]),V=U(()=>{v.current=!0,t.chain().focus().unsetLink().run(),s(null),l("")},[t]),Q=U(()=>{r==="link"?(s(null),l("")):(s("link"),l(j()),requestAnimationFrame(()=>{var c;(c=z.current)==null||c.focus()}))},[r,j]),K=u||Wt(t.state);return n(gn,{ref:H,editor:t,updateDelay:100,getReferencedVirtualElement:P,options:{placement:"top",offset:8,flip:!0,onShow:()=>{h.current=!0,a(!0)},onHide:()=>{h.current=!1,a(!1)}},shouldShow:({state:c})=>r!==null?!0:Wt(c),children:K&&g("div",{className:"flex items-center gap-1 bg-white rounded-lg shadow-lg border border-neutral06 p-1 dark:bg-neutral-900",onMouseDown:c=>{c.preventDefault()},children:[n(ve,{editor:t,orderedListStyles:o&&e!=="blueprint",open:r==="turnInto",onOpenChange:c=>s(c?"turnInto":null)}),n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("bold")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Bold",tooltip:"Bold",onClick:()=>t.chain().focus().toggleBold().run(),children:n(we,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("italic")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Italic",tooltip:"Italic",onClick:()=>t.chain().focus().toggleItalic().run(),children:n(xe,{className:"tiptap-button-icon"})}),e!=="blueprint"&&g(E,{children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("underline")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Underline",tooltip:"Underline",onClick:()=>t.chain().focus().toggleUnderline().run(),children:n(Ie,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("strike")?"on":"off",role:"button",tabIndex:-1,"aria-label":"Strikethrough",tooltip:"Strikethrough",onClick:()=>t.chain().focus().toggleStrike().run(),children:n(Ce,{className:"tiptap-button-icon"})})]})]}),e!=="blueprint"&&n(Un,{editor:t,open:r==="fontSize",onOpenChange:c=>s(c?"fontSize":null)}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(G,{editor:t,kind:"text",placement:"bottom",open:r==="textColor",onOpenChange:c=>s(c?"textColor":null),trigger:n(J,{render:n(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Text Color",tooltip:"Text Color",children:n(Oe,{className:"tiptap-button-icon",style:B?{color:B}:void 0})})})}),n(G,{editor:t,kind:"highlight",placement:"bottom",open:r==="highlightColor",onOpenChange:c=>s(c?"highlightColor":null),trigger:n(J,{render:n(w,{type:"button","data-style":"ghost","data-appearance":"default",role:"button",tabIndex:-1,"aria-label":"Highlight Color",tooltip:"Highlight Color",children:n(rn,{className:"tiptap-button-icon"})})})})]})]}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(w,{type:"button","data-style":"ghost","data-active-state":A()==="left"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Left",tooltip:"Align Left",onClick:()=>t.chain().focus().setNodeTextAlign("left").run(),children:n(ln,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="center"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Center",tooltip:"Align Center",onClick:()=>t.chain().focus().setNodeTextAlign("center").run(),children:n(an,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="right"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Right",tooltip:"Align Right",onClick:()=>t.chain().focus().setNodeTextAlign("right").run(),children:n(dn,{className:"tiptap-button-icon"})}),n(w,{type:"button","data-style":"ghost","data-active-state":A()==="justify"?"on":"off",role:"button",tabIndex:-1,"aria-label":"Align Justify",tooltip:"Align Justify",onClick:()=>t.chain().focus().setNodeTextAlign("justify").run(),children:n(cn,{className:"tiptap-button-icon"})})]})]}),n(D,{orientation:"vertical"}),g("div",{className:"relative",children:[n(w,{type:"button","data-style":"ghost","data-active-state":t.isActive("link")?"on":"off",role:"button",tabIndex:-1,"aria-label":t.isActive("link")?"Edit Link":"Add Link",tooltip:t.isActive("link")?"Edit Link":"Add Link",onClick:Q,children:t.isActive("link")?n(hn,{className:"tiptap-button-icon"}):n(Ue,{className:"tiptap-button-icon"})}),r==="link"&&n("div",{className:"absolute top-full left-0 mt-2 w-80 bg-white border border-neutral06 rounded-lg shadow-lg z-50 dark:bg-neutral-900",onMouseDown:c=>c.stopPropagation(),children:g("div",{className:"flex flex-col gap-2 p-3",children:[n("label",{htmlFor:"link-url",className:"text-sm font-medium text-neutral02",children:t.isActive("link")?"Edit Link":"Add Link"}),n("input",{ref:z,id:"link-url",type:"url",value:d,onChange:c=>l(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),L()):c.key==="Escape"&&(c.preventDefault(),R())},placeholder:"https://example.com",className:"px-3 py-2 text-sm border border-neutral06 rounded-md focus:outline-none focus:ring-2 focus:ring-primary01 focus:border-transparent bg-white dark:bg-neutral-900"}),g("div",{className:"flex gap-2 justify-end",children:[t.isActive("link")&&n("button",{type:"button",onClick:V,className:"px-3 py-1.5 text-sm font-medium text-red01 hover:bg-red-50 rounded-md transition-colors",children:"Remove"}),n("button",{type:"button",onClick:R,className:"px-3 py-1.5 text-sm font-medium text-neutral02 hover:bg-neutral07 rounded-md transition-colors",children:"Cancel"}),n("button",{type:"button",onClick:L,disabled:!d.trim(),className:Dt("px-3 py-1.5 text-sm font-medium text-white rounded-md transition-colors",d.trim()?"bg-primary01 hover:bg-primary02":"bg-neutral06 cursor-not-allowed"),children:t.isActive("link")?"Update":"Add"})]})]})})]}),e!=="blueprint"&&g(E,{children:[n(D,{orientation:"vertical"}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Reset font to default",tooltip:"Reset font to default",disabled:!wn(t),onClick:()=>{v.current=!0,xn(t)},children:n(ke,{className:"tiptap-button-icon"})})]}),e!=="blueprint"&&t.isActive("table")&&g(E,{children:[n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(X,{editor:t,alignmentType:"text",alignment:"left",hideWhenUnavailable:!0}),n(X,{editor:t,alignmentType:"text",alignment:"center",hideWhenUnavailable:!0}),n(X,{editor:t,alignmentType:"text",alignment:"right",hideWhenUnavailable:!0})]}),n(D,{orientation:"vertical"}),g(F,{orientation:"horizontal",children:[n(st,{editor:t,action:"merge",hideWhenUnavailable:!0}),n(st,{editor:t,action:"split",hideWhenUnavailable:!0})]})]}),i&&g(E,{children:[n(D,{orientation:"vertical"}),n(w,{type:"button","data-style":"ghost",role:"button",tabIndex:-1,"aria-label":"Comment",tooltip:"Comment",onClick:i,children:n(Te,{className:"tiptap-button-icon"})})]})]},b)})};function Nn({isReadOnly:t,isStreaming:e,isSaving:o}){return t||e||o?null:g(Ne,{delayDuration:200,children:[n(Se,{asChild:!0,children:g("span",{className:"flex items-center gap-1 text-xs text-neutral03 flex-shrink-0 cursor-default","data-testid":"bor-letter-editable-indicator",children:[n(ze,{className:"w-3 h-3"}),n("span",{children:"Editable"})]})}),n(Ee,{children:"Click anywhere in the letter to edit \u2014 changes save automatically"})]})}const Sn=on(()=>import("./MarkdownExportPreviewDialog-CzxJcujF.js").then(t=>t.MarkdownExportPreviewDialog),{}),zn=1500;function En(){const t=et({action:"merge"}),e=et({action:"split"}),o=sn({resetAttrs:!0});return{mergeAction:{icon:t.Icon,label:t.label,onClick:t.handleExecute,isAvailable:t.canExecute},splitAction:{icon:e.Icon,label:e.label,onClick:e.handleExecute,isAvailable:e.canExecute},clearAction:{icon:o.Icon,label:o.label,onClick:o.handleClear,isAvailable:o.canClearRowColumnContent}}}function Dn({editor:t}){const[e,o]=S(!1),i=U(()=>{o(!1),t==null||t.commands.unfreezeHandles()},[t]),r=U(s=>{o(s),t&&(s?t.commands.freezeHandles():t.commands.unfreezeHandles())},[t]);return{isMenuOpen:e,handleMenuToggle:r,closeMenu:i}}const rt=({action:t})=>{const{icon:e,label:o,onClick:i,isActive:r=!1}=t;return g(q,{render:n(w,{"data-style":"ghost","data-active-state":r?"on":"off"}),onClick:i,children:[n(e,{className:"tiptap-button-icon"}),n("span",{className:"tiptap-button-text",children:o})]})},jt=Z.forwardRef(({editor:t,onOpenChange:e,className:o,...i},r)=>{const{editor:s}=tt(t),{isMenuOpen:d,handleMenuToggle:l,closeMenu:f}=Dn({editor:s}),{mergeAction:u,splitAction:a,clearAction:h}=En(),{canFitToWidth:m,handleFitToWidth:b,label:x,Icon:I}=Qe({editor:s,hideWhenUnavailable:!1});M(()=>{e==null||e(d)},[d,e]);const v=u.isAvailable||a.isAvailable;return n(St,{open:d,onOpenChange:l,placement:"bottom-start",trigger:n(J,{ref:r,className:nn("expandable-menu-button",d&&"menu-opened",o),"aria-label":"Table cells option","aria-haspopup":"menu","aria-expanded":d,...i,children:n(en,{className:"tiptap-button-icon"})}),children:g(zt,{autoFocusOnShow:!0,modal:!0,onClose:f,children:[n(Ye,{style:Ze}),g(Et,{style:{minWidth:"15rem"},children:[v&&g(Pt,{children:[u.isAvailable&&n(rt,{action:u}),a.isAvailable&&n(rt,{action:a}),n(D,{orientation:"horizontal"})]}),g(Pt,{children:[n(G,{kind:"text"}),n(G,{kind:"background"}),n(tn,{}),h.isAvailable&&n(rt,{action:h}),g(q,{render:n(w,{"data-style":"ghost","data-active-state":"off"}),onClick:b,disabled:!m,children:[n(I,{className:"tiptap-button-icon"}),n("span",{className:"tiptap-button-text",children:x})]})]})]})]})})});jt.displayName="BORTableCellHandleMenu";function Mn({markdownContent:t,tiptapContent:e,title:o,isStreaming:i,onContentChange:r,onSave:s,conversationId:d,letterId:l,toolInfo:f,getMessageIdForArtifact:u,onDownloadAllLetters:a,completedLettersCount:h=0,uploadedFiles:m,isReadOnly:b}){const x=T(null),{captureException:I}=De(),{isFeatureEnabled:v}=Me(),[z]=S(!1),[k,P]=S(!1),[H,B]=S(!1),[A,j]=S("pdf"),R=T(!1),L=T(null),V=T(!1),Q=!l||!d,K=_(()=>Ae(async y=>{if(s){P(!0);try{await s(y)}catch(C){I({error:C}),it({title:"Auto-save failed",description:"Changes could not be saved",variant:"destructive"})}finally{P(!1)}}},zn),[s,I]);M(()=>()=>{K.cancel()},[K]);const c=U(()=>e&&e.content&&e.content.length>0?e:t&&t.trim()?Mt(t):{type:"doc",content:[]},[e,t]),O=_(()=>c(),[c]),p=Pe({immediatelyRender:!1,editable:!i&&!b,autofocus:!1,extensions:He,content:{type:"doc",content:[]},onUpdate:({editor:y})=>{if(!V.current||i||b)return;R.current=!0;const C=y.getJSON();L.current=C,r&&r(C),K(C),setTimeout(()=>{R.current=!1},100)}});M(()=>{p&&!p.isDestroyed&&p.setEditable(!i&&!b)},[p,i,b]),M(()=>{if(!p||p.isDestroyed||R.current&&!i)return;const y=O.content&&O.content.length>0;if(i){p.commands.setContent(O),L.current=O;return}y&&(p.commands.setContent(O),p.commands.setTextSelection(0),L.current=O,V.current||(V.current=!0))},[p,O,i]);const N=y=>{if(!x.current||i)throw new Error("Could not find content to export");const C=lt();C&&(j(y),Yt(C),B(!0))},Y=async()=>N("pdf"),_t=async()=>N("docx"),qt=()=>{B(!1)},Jt=async(y,C,$)=>{var at;try{if(!l||!d)throw new Error("Missing letter ID or conversation ID");const W=u==null?void 0:u(l);if(!W)throw new Error("Could not find message for this letter");const te=y==="like"?"POSITIVE":"NEGATIVE",ee={reasons:C,artifact_id:l,message_id:W,conversation_id:d,feedback_text:$||void 0,tool_id:f==null?void 0:f.id},dt=await Ge(W,te,$||void 0,ee,{tool_name:f==null?void 0:f.name},v(Xe.AI_FEEDBACK_NOTIFICATIONS));if(dt.statusCode!==200||!((at=dt.data)!=null&&at.success))throw new Error("Failed to submit feedback");it({title:"Feedback Submitted",description:"Your feedback submitted successfully.",variant:"success"})}catch(W){I({error:W,contexts:{payload:{letterId:l,conversationId:d,toolInfo:f}}}),it({title:"Error",description:"Failed to submit feedback. Please try again.",variant:"destructive"})}},Gt=_(()=>{const y=()=>{const C=x.current;if(!C)throw new Error("BOR letter export invoked before the editor container mounted");return C};return{generatePdf:C=>Le(y(),o,C),generateWord:C=>Re(y(),o,!1,C)}},[o]),Xt=p&&p.getText().trim().length>0||i||t&&t.trim().length>0||e&&e.content&&e.content.length>0,lt=U(()=>{if(p&&!p.isDestroyed){const y=p.getJSON();if(y&&y.content&&y.content.length>0)return y}return e&&e.content&&e.content.length>0?e:t&&t.trim()?Mt(t):null},[p,e,t]),[Qt,Yt]=S(null),Zt=_(()=>{if(p&&!p.isDestroyed){const y=p.getText();if(y!=null&&y.trim())return y}return(t==null?void 0:t.trim())??""},[p,t]);return g("div",{className:"flex flex-col h-full rounded-b-lg overflow-hidden",children:[g("div",{className:"flex justify-between gap-2 items-center py-4 px-6 bg-white z-10 border-b border-border-primary dark:bg-neutral-900",children:[g("div",{className:"flex items-center gap-3 truncate",children:[n(At,{className:"w-4 h-4 flex-shrink-0"}),n(Fe,{tooltipContent:o,children:n("h2",{className:"text-base font-semibold truncate",children:o})}),i&&n(ot,{size:4,className:"flex-shrink-0"}),k&&!i&&!b&&g("div",{className:"flex items-center gap-1 text-xs text-neutral03",children:[n(ot,{size:3,className:"text-current"}),n("span",{children:"Saving..."})]}),n(Nn,{isReadOnly:b,isStreaming:i,isSaving:k})]}),n(Be,{originFeature:"workflows",contentRef:x,fileGenerators:Gt,defaultName:o,disabled:i||!Xt,showCopy:!0,showDownload:!0,showExport:!0,copyTooltip:"Copy Letter",onExportPDF:Y,onExportWord:_t,isExportingPDFExternal:z,uploadedFiles:m,artifactContent:Zt,testIdPrefix:"bor-letter",feedbackConfig:d&&l?{isDisabled:Q,onSubmit:Jt,artifactId:l}:void 0,customButtonsAfter:a&&h>1?[{key:"export-all-pdf",icon:n(Ve,{className:"h-4 w-4"}),tooltip:`Export All Letters as PDF (${h})`,onClick:()=>a("pdf")},{key:"export-all-docx",icon:n(Ke,{className:"h-4 w-4"}),tooltip:`Export All Letters as DOCX (${h})`,onClick:()=>a("docx")}]:void 0,layoutMode:"grouped",exportTiptapContent:lt()})]}),n($e,{className:"flex-1 bg-white rounded-b-lg dark:bg-neutral-900",children:n("div",{className:"p-6",children:g("div",{ref:x,className:Dt("max-w-3xl mx-auto bg-white rounded-lg p-8 overflow-visible","shadow-[0_4px_20px_rgba(0,0,0,0.08)]",i&&"min-h-[200px]"),children:[n("style",{jsx:!0,global:!0,children:`
|
|
2
2
|
.bor-letter-editor .ProseMirror {
|
|
3
3
|
outline: none;
|
|
4
4
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{c3 as o,c4 as p,ca as h,c5 as x,c7 as b,ct as v,cc as f,bG as g}from"./runtime-
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{c3 as o,c4 as p,ca as h,c5 as x,c7 as b,ct as v,cc as f,bG as g}from"./runtime-DM500Cza.js";function i(r){return r==null?"\u2014":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(r)}function c(r){if(!r)return"\u2014";try{return new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return r}}function N(r){return r?r.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase()):"\u2014"}function t({label:r,value:s}){return n("div",{className:"flex justify-between py-1.5",children:[e("span",{className:"text-neutral03 text-sm",children:r}),e("span",{className:"text-neutral01 text-sm font-medium text-right",children:s})]})}function y({open:r,onClose:s,metadata:a,sourceName:d}){if(!a)return null;const m=a.billingPeriodStart||a.billingPeriodEnd?`${c(a.billingPeriodStart)} \u2013 ${c(a.billingPeriodEnd)}`:"\u2014";return e(o,{open:r,onOpenChange:l=>!l&&s(),children:n(p,{className:"!w-[60vw] !max-w-[800px] max-h-[90vh] overflow-hidden flex flex-col",children:[e(h,{children:n(x,{className:"flex items-center gap-2",children:[e(b,{className:"h-5 w-5 text-neutral03"}),"Bill Details"]})}),n("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:[n("div",{children:[e("h4",{className:"text-xs font-semibold text-neutral03 uppercase tracking-wide mb-2",children:"Source"}),e("div",{className:"rounded-lg border border-neutral06 p-3",children:e("p",{className:"text-sm font-medium text-neutral01 truncate",children:d})})]}),n("div",{children:[e("h4",{className:"text-xs font-semibold text-neutral03 uppercase tracking-wide mb-2",children:"Bill Information"}),n("div",{className:"rounded-lg border border-neutral06 p-3 divide-y divide-neutral06",children:[a.companyName&&e(t,{label:"Company",value:a.companyName}),a.carrier&&e(t,{label:"Carrier",value:a.carrier}),a.groupId&&e(t,{label:"Group ID",value:a.groupId}),a.division&&e(t,{label:"Division",value:a.division}),a.fundingType&&e(t,{label:"Funding Type",value:N(a.fundingType)}),e(t,{label:"Billing Period",value:m}),a.dueDate&&e(t,{label:"Due Date",value:c(a.dueDate)})]})]}),n("div",{children:[e("h4",{className:"text-xs font-semibold text-neutral03 uppercase tracking-wide mb-2",children:"Financial Summary"}),n("div",{className:"rounded-lg border border-neutral06 p-3 divide-y divide-neutral06",children:[e(t,{label:"Current Premium",value:i(a.currentPremium)}),e(t,{label:"Adjustments",value:i(a.totalAdjustments)}),e(t,{label:"Discounts",value:i(a.totalDiscounts)}),e(t,{label:"Prior Balance",value:i(a.priorBalance)}),n("div",{className:"flex justify-between py-1.5 font-semibold",children:[e("span",{className:"text-neutral01 text-sm",children:"Total Billed"}),e("span",{className:"text-neutral01 text-sm",children:i(a.totalBilled)})]})]})]}),a.planSummaries&&a.planSummaries.length>0&&n("div",{children:[n("h4",{className:"text-xs font-semibold text-neutral03 uppercase tracking-wide mb-2",children:["Plans (",a.planSummaries.length,")"]}),e("div",{className:"space-y-2",children:a.planSummaries.map((l,u)=>n("div",{className:"rounded-lg border border-neutral06 p-3",children:[n("div",{className:"flex items-center justify-between mb-1",children:[e("span",{className:"text-sm font-medium text-neutral01 truncate",children:l.planName||"Unnamed Plan"}),l.planType&&e(v,{variant:"primary",size:"xs",className:"ml-2 uppercase",children:l.planType})]}),n("div",{className:"flex items-center gap-4 text-xs text-neutral03",children:[n("span",{children:["Premium: ",i(l.currentPremiums)]}),l.adjustments!=null&&l.adjustments!==0&&n("span",{children:["Adj: ",i(l.adjustments)]})]})]},u))})]})]}),e(f,{className:"px-6 py-4",children:e(g,{variant:"outline",onClick:s,children:"Close"})})]})})}export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as s}from"react";import{c3 as x,c4 as b,ca as w,c5 as N,cy as k,cb as p,dd as O,cc as z,bG as v}from"./runtime-
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as s}from"react";import{c3 as x,c4 as b,ca as w,c5 as N,cy as k,cb as p,dd as O,cc as z,bG as v}from"./runtime-DM500Cza.js";function y({open:f,onClose:g,onSubmit:C}){const[o,r]=s(""),[t,n]=s(""),[d,l]=s(""),[c,h]=s(null),u=()=>{r(""),n(""),l(""),h(null)},m=()=>{u(),g()};return e(x,{open:f,onOpenChange:a=>!a&&m(),children:i(b,{"data-testid":"coi-issue-holder-modal",children:[i(w,{children:[e(N,{children:"Issue to another holder"}),e(k,{children:"Re-issue this certificate to a new holder. The coverage is unchanged \u2014 only the certificate holder is swapped. No compliance check is run."})]}),i("div",{className:"flex flex-col gap-3 px-4",children:[e(p,{label:"New holder name",placeholder:"e.g. Turner Construction Company",value:o,onChange:a=>r(a.target.value),variant:"outlined",size:"sm","data-testid":"coi-issue-holder-name"}),e(p,{label:"New holder address",placeholder:"e.g. 375 Hudson St, New York, NY 10014",value:t,onChange:a=>n(a.target.value),variant:"outlined",size:"sm","data-testid":"coi-issue-holder-address"}),e(O,{label:"Description of operations (optional)",placeholder:"Optional \u2014 overrides the description of operations.",value:d,onChange:a=>l(a.target.value),variant:"outlined",size:"sm",rows:3,"data-testid":"coi-issue-holder-description"}),c&&e("p",{className:"text-sm text-red02","data-testid":"coi-issue-holder-error",children:c})]}),i(z,{children:[e(v,{variant:"outline",onClick:m,"data-testid":"coi-issue-holder-cancel",children:"Cancel"}),e(v,{onClick:()=>{if(!o.trim()||!t.trim()){h("Enter the new holder\u2019s name and address to continue.");return}C({name:o.trim(),address:t.trim(),descriptionOfOperations:d.trim()||void 0}),u()},"data-testid":"coi-issue-holder-submit",children:"Issue certificate"})]})]})})}export{y as CoiIssueHolderModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as l,Fragment as u}from"react/jsx-runtime";import{useState as L,useEffect as w}from"react";import{bC as M,cj as U,ck as D,ch as k,bB as B,c3 as j,c4 as I,ca as _,c5 as q,bQ as F,ct as E,cI as Y,cc as H,bG as O,cJ as J}from"./runtime-
|
|
1
|
+
import{jsx as o,jsxs as l,Fragment as u}from"react/jsx-runtime";import{useState as L,useEffect as w}from"react";import{bC as M,cj as U,ck as D,ch as k,bB as B,c3 as j,c4 as I,ca as _,c5 as q,bQ as F,ct as E,cI as Y,cc as H,bG as O,cJ as J}from"./runtime-DM500Cza.js";import{u as Q}from"./usePromptLibraryMutations-DtNd3B58.js";import{L as z}from"./lock-keyhole-DwDf6EZg.js";const K=({isOpen:h,setIsOpen:y,savedItems:i,query:x,onSuccess:S})=>{const[s,p]=L([]),[P,v]=L(!1),{isAdmin:d,user:c}=M(),{isFeatureEnabled:G}=U(),f=G(D.SHARED_PROMPTS_ALL_MEMBERS),{deletePromptAsync:T,isDeleting:m}=Q(),{captureException:A}=k(),{toast:N}=B();w(()=>{if(h&&i.length>0){const e=i.filter(r=>{var n;return r.promptLevel==="SYSTEM"?!1:r.promptLevel==="ORG"?d||f&&((n=r.createdBy)==null?void 0:n.id)===(c==null?void 0:c.id):!0});if(e.length===0){p([]),v(!1);return}const t=e.filter(r=>r.promptLevel==="USER"),a=e.filter(r=>r.promptLevel==="ORG");if(t.length>0&&a.length>0){const r=[];t.length>0&&r.push("USER"),a.length>0&&r.push("ORG"),p(r),v(!0)}else p(e.map(r=>r.promptLevel)),v(!1)}},[h,i,d]);const g=e=>{p(t=>t.includes(e)?t.length===1?t:t.filter(a=>a!==e):[...t,e])},C=async()=>{try{const e=i.filter(n=>{var b;return n.promptLevel==="SYSTEM"||n.promptLevel==="ORG"&&!d&&!(f&&((b=n.createdBy)==null?void 0:b.id)===(c==null?void 0:c.id))?!1:s.includes(n.promptLevel)}).map(n=>T({promptId:n.id,suppressToast:!0}));await Promise.all(e);const t=s.includes("USER"),a=s.includes("ORG");let r;t&&a?r='Successfully deleted prompt from "My Prompts" and "Shared Prompts"':t?r='Successfully deleted prompt from "My Prompts"':a?r='Successfully deleted prompt from "Shared Prompts"':r="Successfully deleted prompt",N({title:"Deleted prompt",description:r,variant:"success"}),y(!1),S==null||S()}catch(e){A({error:e,contexts:{promptLibrary:{query:J(x),selectedLevels:s,isAdmin:d,itemsToDelete:i.length}}})}},R=()=>{m||y(!1)};return o(j,{open:h,onOpenChange:R,children:l(I,{className:"sm:max-w-[400px]",children:[o(_,{children:o(q,{children:"Remove from Prompt library"})}),o("div",{className:"grid gap-4 px-4",children:P?l(u,{children:[o("p",{className:"text-sm text-neutral03",children:"This prompt is saved in multiple locations. Choose which ones to remove it from:"}),l("div",{className:"grid gap-3",children:[o(F,{children:"Remove from"}),l("div",{className:"flex items-center gap-3",children:[i.some(e=>e.promptLevel==="USER")&&o(E,{variant:s.includes("USER")?"destructive":"outline",interactive:!0,onClick:()=>g("USER"),className:"cursor-pointer select-none",icon:o(z,{}),children:"Private"}),i.some(e=>e.promptLevel==="ORG")&&(d||f&&i.some(e=>{var t;return e.promptLevel==="ORG"&&((t=e.createdBy)==null?void 0:t.id)===(c==null?void 0:c.id)}))&&o(E,{variant:s.includes("ORG")?"destructive":"outline",interactive:!0,onClick:()=>g("ORG"),className:"cursor-pointer select-none",icon:o(Y,{}),children:"Shared"})]})]})]}):o("p",{className:"text-sm text-neutral03",children:(()=>{const e=s.includes("USER"),t=s.includes("ORG");return e&&t?l(u,{children:["Are you sure you want to remove this prompt from both ",o("strong",{children:"Private"})," and"," ",o("strong",{children:"Shared"})," libraries? This action cannot be undone."]}):e?l(u,{children:["Are you sure you want to remove this prompt from your ",o("strong",{children:"Private"})," library? This action cannot be undone."]}):t?l(u,{children:["Are you sure you want to remove this prompt from the ",o("strong",{children:"Shared"})," library? This action cannot be undone."]}):"Are you sure you want to remove this prompt from your library? This action cannot be undone."})()})}),l(H,{className:"border-t border-border-primary",children:[o(O,{variant:"outline",onClick:R,disabled:m,children:"Cancel"}),o(O,{variant:"destructive",onClick:C,disabled:s.length===0||m,isLoading:m,children:m?"Removing...":"Remove"})]})]})})};export{K as DeletePromptDialog};
|
package/dist/{EmailFormatSelectionDialog-DmaGe8wo.js → EmailFormatSelectionDialog-oj2ChYBP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{memo as v,useState as C,useCallback as n,useMemo as y}from"react";import{c3 as S,c4 as k,ca as z,c5 as w,bP as E,j as F,cc as _,bG as m,c_ as D,c$ as O,d0 as p}from"./runtime-
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{memo as v,useState as C,useCallback as n,useMemo as y}from"react";import{c3 as S,c4 as k,ca as z,c5 as w,bP as E,j as F,cc as _,bG as m,c_ as D,c$ as O,d0 as p}from"./runtime-DM500Cza.js";const P=[{id:"pdf",label:"PDF",description:"Branded PDF document",icon:e(D,{size:20})},{id:"word",label:"Word",description:"Microsoft Word document",icon:e(O,{size:20})},{id:"excel_single",label:"Excel (Single Sheet)",description:"All tables in one sheet",icon:e(p,{size:20})},{id:"excel_multiple",label:"Excel (Multiple Sheets)",description:"Each table in separate sheet",icon:e(p,{size:20})}],j=({isOpen:u,onClose:s,onSubmit:c,hasTableContent:o})=>{const[a,r]=C(["pdf"]),x=n(i=>{r(l=>l.includes(i)?l.filter(N=>N!==i):[...l,i])},[]),b=n(()=>{a.length!==0&&c(a)},[a,c]),d=n(()=>{r(["pdf"]),s()},[s]),f="Next",g=y(()=>P.filter(i=>i.id==="excel_single"||i.id==="excel_multiple"?o:!0),[o]);return e(S,{open:u,onOpenChange:i=>!i&&d(),children:t(k,{className:"w-[480px]",closeOnOutsideClick:!1,children:[e(z,{children:e(w,{children:"Select Attachment Formats"})}),t("div",{className:"px-4 py-2",children:[e("p",{className:"text-sm text-neutral03 mb-4",children:"Choose the formats you want to attach to your email"}),e("div",{className:"space-y-2",children:g.map(i=>{const l=a.includes(i.id);return t("button",{type:"button",onClick:()=>x(i.id),className:F("w-full flex items-center gap-3 p-3 rounded-lg border transition-colors","hover:bg-neutral08",l?"border-primary bg-primary/5":"border-neutral05"),children:[e(E,{checked:l,size:"lg",className:"pointer-events-none"}),e("div",{className:"flex-shrink-0",children:i.icon}),t("div",{className:"flex-1 text-left",children:[e("div",{className:"text-sm font-medium text-neutral01",children:i.label}),e("div",{className:"text-xs text-neutral03",children:i.description})]})]},i.id)})}),e("p",{className:"text-xs text-neutral04 mt-4",children:"You can preview and customize branding in the next step before attaching."})]}),t(_,{children:[e(m,{variant:"outline",onClick:d,children:"Cancel"}),e(m,{onClick:b,disabled:a.length===0,children:f})]})]})})},h=v(j);h.displayName="EmailFormatSelectionDialog";export{h as EmailFormatSelectionDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as a,Fragment as te}from"react/jsx-runtime";import{useState as d,useMemo as ge,useRef as g,useEffect as A,useCallback as w}from"react";import{bB as Ae,bD as Ge,cN as je,ch as ze,de as Ie,cj as _e,ck as Be,df as y,dg as Ue,dh as Je,di as E,F as G,dj as Xe,dk as qe,dl as Me,dm as Ye,dn as Ke,dp as Qe,c3 as $e,c4 as He,ca as Ve,c5 as We,aA as le,dq as Ze,bG as N,dr as ye,ds as er,a6 as rr,dt as ne,j as Ne,du as tr,at as lr,dv as nr,dw as ar,cc as sr,dx as or}from"./runtime-1GIBxgTL.js";import"react-dom";import"react-dom/client";const ir=or(()=>import("./runtime-1GIBxgTL.js").then(o=>o.oS).then(o=>o.ExcelExportPreview),{loading:()=>r(le,{})}),cr=({isOpen:o,onClose:j,getExportContent:q,generateBlob:z,fileName:I,mode:ae="separate",title:Se="Download Excel Preview"})=>{var se,oe;const{toast:M}=Ae(),{preferences:i,setPreferences:ie}=Ge(),Y=je(),{captureException:S}=ze(),{themes:we,isLoading:Ee}=Ie(),{isFeatureEnabled:Ce}=_e(),u=Ce(Be.TEMPLATE_PAGE_STYLES),[f,_]=d(null),Oe=ge(()=>{const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];try{return typeof e=="string"?JSON.parse(e):e}catch{return null}},[i]),s=Ue(o,Oe),{pageStyle:C,isLoading:B}=Je({pageStyleId:f??"",enabled:u&&!!f}),[ce,de]=d(null),[U,ue]=d(null),[ke,Le]=d(null),[K,O]=d(!1),[k,me]=d(!1),[he,L]=d(null),p=(i==null?void 0:i[y.GLOBAL.COMPANY_FONT_FAMILY])||"",[T,h]=d(E),[F,v]=d(p||((oe=(se=G)==null?void 0:se[0])==null?void 0:oe.value)||"sans-serif");Xe(o?F:null);const[Q,x]=d(""),[fe,pe]=d(!0),[ve,b]=d("main"),$=g(!1),J=g(null),H=g(0);A(()=>{if(!o||$.current)return;$.current=!0;const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];if(e)try{const t=typeof e=="string"?JSON.parse(e):e;u||(t!=null&&t.componentColors&&h(t.componentColors),t!=null&&t.themeName&&x(t.themeName)),t!=null&&t.documentFont&&v(t.documentFont)}catch{}},[o,i,u]);const V=g(!1),X=g(0),W=g(!1),[Te,Z]=d(!1);A(()=>{if(!o||!u)return;const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];let t;try{const l=typeof e=="string"?JSON.parse(e):e;t=l==null?void 0:l.pageStyleId}catch{}if(t){!W.current&&t!==f&&_(t),Z(!0);return}if(V.current)return;V.current=!0;const n=++X.current;(async()=>{var l,c;try{const m=await qe(),R=(c=(l=m==null?void 0:m.data)==null?void 0:l.pageStyle)==null?void 0:c.id;R&&X.current===n&&_(re=>re??R)}catch(m){S({error:m,extra:{context:"ExcelExportPreviewDialog getDefaultPageStyle"}})}finally{X.current===n&&Z(!0)}})()},[o,u,i,f,S]);const P=u&&(!Te||!!f&&!C&&B)||s.isResolving,ee=g(!1);A(()=>{var e,t,n,l,c,m;if(!u)return;if(!f){if(!ee.current)return;h(E),v(p||((t=(e=G)==null?void 0:e[0])==null?void 0:t.value)||"sans-serif"),x("");return}if(!C){if(B)return;h(E),v(p||((l=(n=G)==null?void 0:n[0])==null?void 0:l.value)||"sans-serif"),x("");return}const{componentColors:R,fontName:re}=Me({pageStyle:{theme:C.theme}});R&&h(R),v(re||p||((m=(c=G)==null?void 0:c[0])==null?void 0:m.value)||"sans-serif"),x(""),ee.current=!0},[u,f,C,B,p]),A(()=>{var e,t;o||($.current=!1,H.current+=1,V.current=!1,ee.current=!1,W.current=!1,X.current+=1,_(null),Z(!1),u&&(h(E),v(p||((t=(e=G)==null?void 0:e[0])==null?void 0:t.value)||"sans-serif"),x("")),J.current=null,de(null),ue(null),L(null),b("main"))},[o,u,p]);const D=ge(()=>({componentColors:T,documentFont:F,logoDataUrl:s.logoDataUrl??void 0,logoOnFirstSheetOnly:s.firstSheetOnly}),[T,F,s.logoDataUrl,s.firstSheetOnly]),xe=w(()=>{if(!z){const n=J.current??(q==null?void 0:q());if(!n){L("No table content available for export"),O(!1);return}J.current=n}O(!0),L(null);const e=++H.current,t=()=>e!==H.current;requestAnimationFrame(()=>{(async()=>{try{const n=z?await z(D):await Ye(J.current,I,ae,void 0,D);if(t())return;ue(n),Le(D);const l=new FileReader;l.onload=()=>{if(t())return;const c=l.result.split(",")[1]??null;de(c),O(!1)},l.onerror=()=>{t()||(L("Failed to generate preview"),O(!1))},l.readAsDataURL(n)}catch(n){if(t())return;L(n instanceof Error?n.message:"Failed to generate Excel"),O(!1)}})()})},[z,q,I,ae,D]);A(()=>{!o||P||xe()},[o,P,xe]);const Fe=w((e,t)=>{h(n=>Ke(n,e,t))},[]),Pe=w((e,t,n)=>{h(l=>{const c=JSON.parse(JSON.stringify(l)),m=c.textStyles||{};return c.textStyles={...m,[e]:{...m[e]||{},[t]:n}},c})},[]),De=w(e=>{x(e.name);const{font:t,...n}=e.themeData;h(n),t!=null&&t.all&&v(t.all),b("main")},[]),be=w(()=>{const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];let t={};try{const l=(typeof e=="string"?JSON.parse(e):e)??{};l&&typeof l=="object"&&(t=l)}catch(l){S({error:l,extra:{context:"export settings snapshot unparseable"}});return}const n=JSON.stringify({...t,logoEnabled:s.enabled,logoOnFirstSheetOnly:s.firstSheetOnly});Qe(y.GLOBAL.EXPORT_SETTINGS,n,"USER").then(l=>{if((l==null?void 0:l.statusCode)!==200){S({error:new Error(`logo preference save rejected: ${l==null?void 0:l.statusCode}`),extra:{context:"persistLogoChoices"}});return}ie(c=>({...c,[y.GLOBAL.EXPORT_SETTINGS]:n})),Y.invalidateQueries({queryKey:["preferences"]}),Y.invalidateQueries({queryKey:["bootstrapAppData"]})}).catch(l=>{S({error:l instanceof Error?l:new Error(String(l)),extra:{context:"persistLogoChoices"}})})},[i,ie,Y,S,s.enabled,s.firstSheetOnly]),Re=w(()=>{if(U){me(!0);try{be();const e=URL.createObjectURL(U),t=document.createElement("a");t.href=e,t.download=`${I}.xlsx`,t.click(),URL.revokeObjectURL(e),M({title:"Download Successful",description:"Excel spreadsheet has been downloaded successfully",variant:"success"}),j()}catch(e){M({title:"Download Failed",description:e instanceof Error?e.message:"An unknown error occurred",variant:"destructive"})}finally{me(!1)}}},[U,I,be,j,M]);return r($e,{open:o,onOpenChange:j,children:a(He,{className:"max-w-[1400px] w-[80vw] h-[85vh] p-0 gap-0 flex flex-col",closeOnOutsideClick:!1,children:[r(Ve,{className:"px-6 py-4 border-b border-border-primary flex-shrink-0",children:r(We,{children:Se})}),a("div",{className:"flex-1 flex overflow-hidden",children:[a("div",{className:"flex-1 overflow-auto p-6 relative",children:[(K||P)&&a("div",{className:"flex items-center justify-center h-full",children:[r(le,{size:8,className:"text-muted-foreground"}),r("span",{className:"ml-3 text-muted-foreground",children:"Generating preview..."})]}),he&&r("div",{className:"flex items-center justify-center h-full text-destructive",children:he}),ce&&!K&&!P&&r(ir,{excelBytes:ce,componentColors:T,documentFont:F,logoDataUrl:s.logoDataUrl??void 0}),!fe&&r("button",{onClick:()=>pe(!0),className:"absolute top-4 right-4 p-2 rounded-md border border-border-primary bg-white hover:bg-neutral06 transition-colors shadow-sm dark:bg-neutral-900",children:r(Ze,{className:"h-4 w-4 text-neutral01"})})]}),fe&&r("div",{className:"w-[320px] flex-shrink-0 border-l border-border-primary flex flex-col bg-white dark:bg-neutral-900",children:ve==="customize"?a(te,{children:[a("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border-primary",children:[r(N,{variant:"ghost",size:"iconSm",onClick:()=>b("main"),"aria-label":"Back",icon:r(ye,{className:"text-neutral01"})}),r("span",{className:"text-sm font-medium text-neutral01",children:"Customize Theme"})]}),r("div",{className:"flex-1 overflow-y-auto",children:r(er,{colors:T,onColorChange:Fe,onTextStyleChange:Pe,renderColorPicker:e=>r(rr,{color:e.color,onChange:e.onChange,usePortal:!0,showColorText:!1,showEditIcon:!1,showBorders:!1,compact:!0})})})]}):ve==="themes"?a(te,{children:[a("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border-primary",children:[r(N,{variant:"ghost",size:"iconSm",onClick:()=>b("main"),"aria-label":"Back",icon:r(ye,{className:"text-neutral01"})}),r("span",{className:"text-sm font-medium text-neutral01",children:"Select Theme"})]}),a("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[a("button",{className:Ne("w-full p-3 rounded-lg border text-left transition-colors",Q?"border-border-primary hover:bg-neutral06":"border-blue-500 bg-blue-50"),onClick:()=>{x(""),h(E),b("main")},children:[r("div",{className:"text-sm font-medium mb-2",children:"Default Theme"}),r(ne,{colors:E})]}),Ee&&r("div",{className:"flex justify-center py-4",children:r(le,{size:5,className:"text-muted-foreground"})}),we.map(e=>a("button",{className:Ne("w-full p-3 rounded-lg border text-left transition-colors",Q===e.name?"border-blue-500 bg-blue-50":"border-border-primary hover:bg-neutral06"),onClick:()=>De(e),children:[r("div",{className:"text-sm font-medium mb-2",children:e.name}),r(ne,{colors:e.themeData})]},e.id))]})]}):a(te,{children:[a("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-primary",children:[r("span",{className:"text-sm font-medium text-neutral01",children:"Settings"}),r(N,{variant:"ghost",size:"iconSm",onClick:()=>pe(!1),"aria-label":"Close settings panel",icon:r(tr,{className:"text-neutral01"})})]}),a("div",{className:"flex-1 overflow-y-auto p-4 space-y-5",children:[!u&&a("div",{children:[r("label",{className:"text-xs font-medium text-neutral03 uppercase tracking-wide mb-2 block",children:"Font"}),r(lr,{value:F,onChange:e=>v(e),enableGoogleFonts:!0,showFontPreviews:!0,popoverProps:{sideOffset:4,usePortal:!0,align:"end"}})]}),u?r("div",{className:"-mx-4",children:r(nr,{selectedId:f,selectedPageStyle:C,isResolving:B,onSelect:e=>{W.current=!0,_(e)},disabled:k,isExcel:!0})}):a("div",{children:[r("label",{className:"text-xs font-medium text-neutral03 uppercase tracking-wide mb-2 block",children:"Theme"}),a("div",{className:"border border-border-primary rounded-lg p-3",children:[r("div",{className:"text-sm font-medium mb-2",children:Q||"Default Theme"}),r(ne,{colors:T}),a("div",{className:"flex gap-2 mt-3",children:[r(N,{variant:"outline",size:"sm",className:"flex-1 text-xs",onClick:()=>b("customize"),children:"Customize"}),r(N,{variant:"outline",size:"sm",className:"flex-1 text-xs",onClick:()=>b("themes"),children:"Change"})]})]})]}),r("div",{className:"-mx-4",children:r(ar,{logoDataUrl:s.resolvedLogo,enabled:s.enabled,onEnabledChange:s.setEnabled,firstSheetOnly:s.firstSheetOnly,onFirstSheetOnlyChange:s.setFirstSheetOnly,isResolving:s.isResolving,onChange:s.setLogo,onPickAsset:s.setLogoFromAsset,disabled:k})})]})]})})]}),r(sr,{className:"px-6 py-4 border-t border-border-primary flex-shrink-0 flex sm:justify-between",children:a("div",{className:"flex gap-2 justify-end w-full",children:[r(N,{variant:"outline",onClick:j,disabled:k,children:"Cancel"}),r(N,{onClick:Re,disabled:!U||ke!==D||K||P,isLoading:k,children:k?"Downloading...":"Download as Excel"})]})})]})})};export{cr as ExcelExportPreviewDialog};
|
|
1
|
+
import{jsx as r,jsxs as a,Fragment as te}from"react/jsx-runtime";import{useState as d,useMemo as ge,useRef as g,useEffect as A,useCallback as w}from"react";import{bB as Ae,bD as Ge,cN as je,ch as ze,de as Ie,cj as _e,ck as Be,df as y,dg as Ue,dh as Je,di as E,F as G,dj as Xe,dk as qe,dl as Me,dm as Ye,dn as Ke,dp as Qe,c3 as $e,c4 as He,ca as Ve,c5 as We,aA as le,dq as Ze,bG as N,dr as ye,ds as er,a6 as rr,dt as ne,j as Ne,du as tr,at as lr,dv as nr,dw as ar,cc as sr,dx as or}from"./runtime-DM500Cza.js";import"react-dom";import"react-dom/client";const ir=or(()=>import("./runtime-DM500Cza.js").then(o=>o.oS).then(o=>o.ExcelExportPreview),{loading:()=>r(le,{})}),cr=({isOpen:o,onClose:j,getExportContent:q,generateBlob:z,fileName:I,mode:ae="separate",title:Se="Download Excel Preview"})=>{var se,oe;const{toast:M}=Ae(),{preferences:i,setPreferences:ie}=Ge(),Y=je(),{captureException:S}=ze(),{themes:we,isLoading:Ee}=Ie(),{isFeatureEnabled:Ce}=_e(),u=Ce(Be.TEMPLATE_PAGE_STYLES),[f,_]=d(null),Oe=ge(()=>{const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];try{return typeof e=="string"?JSON.parse(e):e}catch{return null}},[i]),s=Ue(o,Oe),{pageStyle:C,isLoading:B}=Je({pageStyleId:f??"",enabled:u&&!!f}),[ce,de]=d(null),[U,ue]=d(null),[ke,Le]=d(null),[K,O]=d(!1),[k,me]=d(!1),[he,L]=d(null),p=(i==null?void 0:i[y.GLOBAL.COMPANY_FONT_FAMILY])||"",[T,h]=d(E),[F,v]=d(p||((oe=(se=G)==null?void 0:se[0])==null?void 0:oe.value)||"sans-serif");Xe(o?F:null);const[Q,x]=d(""),[fe,pe]=d(!0),[ve,b]=d("main"),$=g(!1),J=g(null),H=g(0);A(()=>{if(!o||$.current)return;$.current=!0;const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];if(e)try{const t=typeof e=="string"?JSON.parse(e):e;u||(t!=null&&t.componentColors&&h(t.componentColors),t!=null&&t.themeName&&x(t.themeName)),t!=null&&t.documentFont&&v(t.documentFont)}catch{}},[o,i,u]);const V=g(!1),X=g(0),W=g(!1),[Te,Z]=d(!1);A(()=>{if(!o||!u)return;const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];let t;try{const l=typeof e=="string"?JSON.parse(e):e;t=l==null?void 0:l.pageStyleId}catch{}if(t){!W.current&&t!==f&&_(t),Z(!0);return}if(V.current)return;V.current=!0;const n=++X.current;(async()=>{var l,c;try{const m=await qe(),R=(c=(l=m==null?void 0:m.data)==null?void 0:l.pageStyle)==null?void 0:c.id;R&&X.current===n&&_(re=>re??R)}catch(m){S({error:m,extra:{context:"ExcelExportPreviewDialog getDefaultPageStyle"}})}finally{X.current===n&&Z(!0)}})()},[o,u,i,f,S]);const P=u&&(!Te||!!f&&!C&&B)||s.isResolving,ee=g(!1);A(()=>{var e,t,n,l,c,m;if(!u)return;if(!f){if(!ee.current)return;h(E),v(p||((t=(e=G)==null?void 0:e[0])==null?void 0:t.value)||"sans-serif"),x("");return}if(!C){if(B)return;h(E),v(p||((l=(n=G)==null?void 0:n[0])==null?void 0:l.value)||"sans-serif"),x("");return}const{componentColors:R,fontName:re}=Me({pageStyle:{theme:C.theme}});R&&h(R),v(re||p||((m=(c=G)==null?void 0:c[0])==null?void 0:m.value)||"sans-serif"),x(""),ee.current=!0},[u,f,C,B,p]),A(()=>{var e,t;o||($.current=!1,H.current+=1,V.current=!1,ee.current=!1,W.current=!1,X.current+=1,_(null),Z(!1),u&&(h(E),v(p||((t=(e=G)==null?void 0:e[0])==null?void 0:t.value)||"sans-serif"),x("")),J.current=null,de(null),ue(null),L(null),b("main"))},[o,u,p]);const D=ge(()=>({componentColors:T,documentFont:F,logoDataUrl:s.logoDataUrl??void 0,logoOnFirstSheetOnly:s.firstSheetOnly}),[T,F,s.logoDataUrl,s.firstSheetOnly]),xe=w(()=>{if(!z){const n=J.current??(q==null?void 0:q());if(!n){L("No table content available for export"),O(!1);return}J.current=n}O(!0),L(null);const e=++H.current,t=()=>e!==H.current;requestAnimationFrame(()=>{(async()=>{try{const n=z?await z(D):await Ye(J.current,I,ae,void 0,D);if(t())return;ue(n),Le(D);const l=new FileReader;l.onload=()=>{if(t())return;const c=l.result.split(",")[1]??null;de(c),O(!1)},l.onerror=()=>{t()||(L("Failed to generate preview"),O(!1))},l.readAsDataURL(n)}catch(n){if(t())return;L(n instanceof Error?n.message:"Failed to generate Excel"),O(!1)}})()})},[z,q,I,ae,D]);A(()=>{!o||P||xe()},[o,P,xe]);const Fe=w((e,t)=>{h(n=>Ke(n,e,t))},[]),Pe=w((e,t,n)=>{h(l=>{const c=JSON.parse(JSON.stringify(l)),m=c.textStyles||{};return c.textStyles={...m,[e]:{...m[e]||{},[t]:n}},c})},[]),De=w(e=>{x(e.name);const{font:t,...n}=e.themeData;h(n),t!=null&&t.all&&v(t.all),b("main")},[]),be=w(()=>{const e=i==null?void 0:i[y.GLOBAL.EXPORT_SETTINGS];let t={};try{const l=(typeof e=="string"?JSON.parse(e):e)??{};l&&typeof l=="object"&&(t=l)}catch(l){S({error:l,extra:{context:"export settings snapshot unparseable"}});return}const n=JSON.stringify({...t,logoEnabled:s.enabled,logoOnFirstSheetOnly:s.firstSheetOnly});Qe(y.GLOBAL.EXPORT_SETTINGS,n,"USER").then(l=>{if((l==null?void 0:l.statusCode)!==200){S({error:new Error(`logo preference save rejected: ${l==null?void 0:l.statusCode}`),extra:{context:"persistLogoChoices"}});return}ie(c=>({...c,[y.GLOBAL.EXPORT_SETTINGS]:n})),Y.invalidateQueries({queryKey:["preferences"]}),Y.invalidateQueries({queryKey:["bootstrapAppData"]})}).catch(l=>{S({error:l instanceof Error?l:new Error(String(l)),extra:{context:"persistLogoChoices"}})})},[i,ie,Y,S,s.enabled,s.firstSheetOnly]),Re=w(()=>{if(U){me(!0);try{be();const e=URL.createObjectURL(U),t=document.createElement("a");t.href=e,t.download=`${I}.xlsx`,t.click(),URL.revokeObjectURL(e),M({title:"Download Successful",description:"Excel spreadsheet has been downloaded successfully",variant:"success"}),j()}catch(e){M({title:"Download Failed",description:e instanceof Error?e.message:"An unknown error occurred",variant:"destructive"})}finally{me(!1)}}},[U,I,be,j,M]);return r($e,{open:o,onOpenChange:j,children:a(He,{className:"max-w-[1400px] w-[80vw] h-[85vh] p-0 gap-0 flex flex-col",closeOnOutsideClick:!1,children:[r(Ve,{className:"px-6 py-4 border-b border-border-primary flex-shrink-0",children:r(We,{children:Se})}),a("div",{className:"flex-1 flex overflow-hidden",children:[a("div",{className:"flex-1 overflow-auto p-6 relative",children:[(K||P)&&a("div",{className:"flex items-center justify-center h-full",children:[r(le,{size:8,className:"text-muted-foreground"}),r("span",{className:"ml-3 text-muted-foreground",children:"Generating preview..."})]}),he&&r("div",{className:"flex items-center justify-center h-full text-destructive",children:he}),ce&&!K&&!P&&r(ir,{excelBytes:ce,componentColors:T,documentFont:F,logoDataUrl:s.logoDataUrl??void 0}),!fe&&r("button",{onClick:()=>pe(!0),className:"absolute top-4 right-4 p-2 rounded-md border border-border-primary bg-white hover:bg-neutral06 transition-colors shadow-sm dark:bg-neutral-900",children:r(Ze,{className:"h-4 w-4 text-neutral01"})})]}),fe&&r("div",{className:"w-[320px] flex-shrink-0 border-l border-border-primary flex flex-col bg-white dark:bg-neutral-900",children:ve==="customize"?a(te,{children:[a("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border-primary",children:[r(N,{variant:"ghost",size:"iconSm",onClick:()=>b("main"),"aria-label":"Back",icon:r(ye,{className:"text-neutral01"})}),r("span",{className:"text-sm font-medium text-neutral01",children:"Customize Theme"})]}),r("div",{className:"flex-1 overflow-y-auto",children:r(er,{colors:T,onColorChange:Fe,onTextStyleChange:Pe,renderColorPicker:e=>r(rr,{color:e.color,onChange:e.onChange,usePortal:!0,showColorText:!1,showEditIcon:!1,showBorders:!1,compact:!0})})})]}):ve==="themes"?a(te,{children:[a("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border-primary",children:[r(N,{variant:"ghost",size:"iconSm",onClick:()=>b("main"),"aria-label":"Back",icon:r(ye,{className:"text-neutral01"})}),r("span",{className:"text-sm font-medium text-neutral01",children:"Select Theme"})]}),a("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[a("button",{className:Ne("w-full p-3 rounded-lg border text-left transition-colors",Q?"border-border-primary hover:bg-neutral06":"border-blue-500 bg-blue-50"),onClick:()=>{x(""),h(E),b("main")},children:[r("div",{className:"text-sm font-medium mb-2",children:"Default Theme"}),r(ne,{colors:E})]}),Ee&&r("div",{className:"flex justify-center py-4",children:r(le,{size:5,className:"text-muted-foreground"})}),we.map(e=>a("button",{className:Ne("w-full p-3 rounded-lg border text-left transition-colors",Q===e.name?"border-blue-500 bg-blue-50":"border-border-primary hover:bg-neutral06"),onClick:()=>De(e),children:[r("div",{className:"text-sm font-medium mb-2",children:e.name}),r(ne,{colors:e.themeData})]},e.id))]})]}):a(te,{children:[a("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-primary",children:[r("span",{className:"text-sm font-medium text-neutral01",children:"Settings"}),r(N,{variant:"ghost",size:"iconSm",onClick:()=>pe(!1),"aria-label":"Close settings panel",icon:r(tr,{className:"text-neutral01"})})]}),a("div",{className:"flex-1 overflow-y-auto p-4 space-y-5",children:[!u&&a("div",{children:[r("label",{className:"text-xs font-medium text-neutral03 uppercase tracking-wide mb-2 block",children:"Font"}),r(lr,{value:F,onChange:e=>v(e),enableGoogleFonts:!0,showFontPreviews:!0,popoverProps:{sideOffset:4,usePortal:!0,align:"end"}})]}),u?r("div",{className:"-mx-4",children:r(nr,{selectedId:f,selectedPageStyle:C,isResolving:B,onSelect:e=>{W.current=!0,_(e)},disabled:k,isExcel:!0})}):a("div",{children:[r("label",{className:"text-xs font-medium text-neutral03 uppercase tracking-wide mb-2 block",children:"Theme"}),a("div",{className:"border border-border-primary rounded-lg p-3",children:[r("div",{className:"text-sm font-medium mb-2",children:Q||"Default Theme"}),r(ne,{colors:T}),a("div",{className:"flex gap-2 mt-3",children:[r(N,{variant:"outline",size:"sm",className:"flex-1 text-xs",onClick:()=>b("customize"),children:"Customize"}),r(N,{variant:"outline",size:"sm",className:"flex-1 text-xs",onClick:()=>b("themes"),children:"Change"})]})]})]}),r("div",{className:"-mx-4",children:r(ar,{logoDataUrl:s.resolvedLogo,enabled:s.enabled,onEnabledChange:s.setEnabled,firstSheetOnly:s.firstSheetOnly,onFirstSheetOnlyChange:s.setFirstSheetOnly,isResolving:s.isResolving,onChange:s.setLogo,onPickAsset:s.setLogoFromAsset,disabled:k})})]})]})})]}),r(sr,{className:"px-6 py-4 border-t border-border-primary flex-shrink-0 flex sm:justify-between",children:a("div",{className:"flex gap-2 justify-end w-full",children:[r(N,{variant:"outline",onClick:j,disabled:k,children:"Cancel"}),r(N,{onClick:Re,disabled:!U||ke!==D||K||P,isLoading:k,children:k?"Downloading...":"Download as Excel"})]})})]})})};export{cr as ExcelExportPreviewDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as m,jsx as o,Fragment as Ie}from"react/jsx-runtime";import{useCallback as z,useState as A,Fragment as Je,useRef as X,useEffect as Z,useMemo as k}from"react";import{cN as Be,ch as Ve,cE as Fe,jc as Ee,bK as le,bL as se,bN as de,bO as ce,j as ee,cX as ue,aA as ze,bY as Ue,bG as U,dr as ne,bU as Ge,jd as te,cw as me,je as Re,jf as I,ah as We,jg as qe,eA as ae,eV as Qe,jh as Ye,eu as He,ji as Xe,c3 as Ze,c4 as en,c5 as pe,bF as nn,jj as tn}from"./runtime-1GIBxgTL.js";import{WidgetRawDataView as an}from"./WidgetRawDataView-D8a2-r9A.js";import"react-dom";import"react-dom/client";const on=e=>{const n=Be(),{captureException:t}=Ve(),a=Fe({mutationFn:async i=>{try{const r=await Ee(i);if(r.statusCode!==200){const l=new Error("Failed to add widget");throw t(l,{extra:{dashboardId:i.dashboardId,statusCode:r.statusCode}}),l}return r.data}catch(r){throw t(r,{extra:{dashboardId:i.dashboardId}}),r}},onSuccess:(i,r)=>{n.invalidateQueries({queryKey:["dashboardsV2"]}),n.invalidateQueries({queryKey:["dashboardV2",r.dashboardId]})},onError:i=>{}});return{addWidget:a.mutate,addWidgetAsync:a.mutateAsync,isLoading:a.isPending,isError:a.isError,error:a.error}},he=6,rn=10,ln=5,sn=100,fe=1e-9,ge="Deepest level \u2014 open the data view (top-right) to see the underlying records.",dn="Deepest level \u2014 no further breakdown.",cn="Deepest level \u2014 no further breakdown to chart.",un=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function J(e){return e==null||Number.isNaN(e)?"\u2014":un.format(e)}function xe(e){return e==null||Number.isNaN(e)?"\u2014":`${e>0?"+":""}${J(e)}`}function G(e){return e==null||Number.isNaN(e)?"\u2014":`${Math.round(e*100)}%`}function K(e){const n=e.replace(/[_-]+/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e}const be=(e,n)=>{var t;return((t=e.find(a=>a.name===n))==null?void 0:t.label)??""};function mn({kpiOptions:e,selectedKpiName:n,onKpiChange:t}){return e.length<=1?o("span",{className:"font-semibold text-foreground","data-testid":"explain-kpi-static",children:be(e,n)||"this number"}):m(le,{value:n??void 0,onValueChange:t,children:[o(se,{className:"h-8 w-auto min-w-[7rem] gap-1 border-border bg-card","data-testid":"explain-kpi-select",displayValue:be(e,n)}),o(de,{children:e.map(a=>o(ce,{value:a.name,children:a.label},a.name))})]})}function pn({dimensions:e,selectedDimensionColumn:n,onDimensionChange:t}){return m(le,{value:n??void 0,onValueChange:t,children:[o(se,{className:"h-8 w-auto min-w-[7rem] gap-1 border-border bg-card","data-testid":"explain-dimension-select",displayValue:n?K(n):""}),o(de,{children:e.map(a=>o(ce,{value:a.column,subtext:G(a.score),children:K(a.column)},a.column))})]})}function hn({kpiOptions:e,selectedKpiName:n,onKpiChange:t,dimensions:a,selectedDimensionColumn:i,onDimensionChange:r}){return m("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground","data-testid":"explain-controls",children:[o("span",{children:"Break down"}),o(mn,{kpiOptions:e,selectedKpiName:n,onKpiChange:t}),o("span",{children:"by"}),o(pn,{dimensions:a,selectedDimensionColumn:i,onDimensionChange:r})]})}function ve({label:e,share:n,badge:t,caption:a,drillable:i}){const r=Math.max(0,Math.min(100,n*100));return m(Ie,{children:[m("div",{className:"flex items-baseline justify-between gap-2",children:[m("span",{className:"flex min-w-0 items-center gap-1",children:[o("span",{className:"truncate text-sm text-foreground",title:e,children:e}),i&&o(ue,{className:"size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/seg:opacity-100"})]}),o("span",{className:"shrink-0 text-sm font-medium text-foreground",children:t})]}),o("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-subtle",children:o("div",{className:"h-full rounded-full bg-primary",style:{width:`${r}%`}})}),o("div",{className:"text-xs text-muted-foreground",children:a})]})}function fn(e){const{onDescend:n}=e;return n?o("li",{children:o("button",{type:"button",onClick:n,className:ee("group/seg w-full space-y-1 rounded-md p-1.5 text-left transition-colors","hover:bg-subtle focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),children:o(ve,{...e,drillable:!0})})}):o("li",{className:"space-y-1",children:o(ve,{...e,drillable:!1})})}const gn=(e,n)=>n==="composition"?e.levelShare:e.contributionShare!=null?Math.abs(e.contributionShare):e.levelShare,xn=(e,n,t)=>n==="composition"?G(e.levelShare):t&&e.contributionShare!=null?G(e.contributionShare):xe(e.diff),bn=(e,n)=>{if(n==="composition")return`${J(e.curr)} of total`;const t=J(e.curr);return`${e.prior==null?"\u2014":J(e.prior)} \u2192 ${t}`};function vn({title:e,dimension:n,mode:t,exact:a,onDescend:i}){const r=n.segments.slice(0,ln);return m("section",{className:"space-y-2",children:[m("div",{className:"flex items-baseline justify-between gap-2",children:[o("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),m("span",{className:"text-xs text-muted-foreground",children:["by ",n.column]})]}),o("ul",{className:"space-y-2.5",children:r.map(l=>o(fn,{label:l.name,share:gn(l,t),badge:xn(l,t,a),caption:bn(l,t),onDescend:i?()=>i(l.name):void 0},`${n.column}-${l.name}`))})]})}const yn={exact_contribution:"Exact contribution \u2014 this KPI sums, so each segment\u2019s share of the change is precise.",descriptive:"Descriptive \u2014 this KPI can\u2019t be split additively, so these are the segments that moved most.",composition_only:"Composition \u2014 no meaningful prior to compare against, so this shows only what the number is made of."},Nn=e=>e>0?"text-emerald-600 dark:text-emerald-400":e<0?"text-red-600 dark:text-red-400":"text-muted-foreground";function ye({headline:e}){const n=e.prior!=null;return m("div",{className:"space-y-1",children:[o("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e.kpiLabel}),m("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:J(e.curr)}),n&&m("span",{className:ee("text-sm font-medium",Nn(e.diff)),children:[xe(e.diff),e.growth!=null&&` (${G(e.growth)})`]})]}),n&&m("div",{className:"text-xs text-muted-foreground",children:["vs prior ",J(e.prior)]})]})}function wn({method:e}){return m("div",{className:"flex items-start gap-2 rounded-md border border-border bg-subtle p-2.5",children:[o(Ge,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),o("p",{className:"text-xs leading-snug text-muted-foreground",children:yn[e]})]})}function Cn({dimension:e}){return e?m("p",{className:"text-xs text-muted-foreground","data-testid":"explain-runner-up",children:["also strong: ",K(e.column)," \xB7 ",G(e.score)]}):null}function kn({explanation:e}){const{analyzedCount:n,totalCandidateCount:t}=e,a=t>n?`${n} of ${t} dimensions analyzed`:`${n} dimension${n===1?"":"s"} analyzed`;return m("div",{className:"border-t border-border pt-3 text-[11px] leading-snug text-muted-foreground",children:[a,". Calculated live from your latest data."]})}const ie={loading:{title:"Analyzing\u2026",body:"Finding what\u2019s driving this number."},empty:{title:"Nothing to break down",body:"This metric has no dimensions to break it down by."},error:{title:"Couldn\u2019t load the breakdown",body:"Something went wrong loading the breakdown. Please try again shortly."}},Dn={title:"No further breakdown here",body:"This level can\u2019t be broken down any further. Step back to explore a different split."};function Ne({onBack:e}){return o(U,{variant:"outline",size:"sm",leftIcon:o(ne,{}),onClick:e,className:"mt-1","data-testid":"explain-state-back-button",children:"Back one level"})}function Pn({status:e,canGoBack:n=!1,onBack:t}){if(e==="loading")return m("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[o(ze,{size:8}),o("div",{className:"text-sm font-medium text-foreground",children:ie.loading.title}),o("p",{className:"max-w-xs text-xs text-muted-foreground",children:ie.loading.body})]});if(e==="empty"||e==="error"){const a=e==="empty"&&n?Dn:ie[e];return m("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[o(Ue,{className:"size-6 text-muted-foreground"}),o("div",{className:"text-sm font-medium text-foreground",children:a.title}),o("p",{className:"max-w-xs text-xs text-muted-foreground",children:a.body}),n&&t&&o(Ne,{onBack:t})]})}return null}function Sn({explanation:e,canViewRecords:n,onDrillUp:t}){return m("div",{className:"flex flex-col items-start gap-5",children:[o(ye,{headline:e.headline}),o("p",{className:"text-xs text-muted-foreground",children:n?ge:dn}),t&&o(Ne,{onBack:t})]})}function Kn({explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,selectedDimension:d,onDimensionChange:p,isMovement:s,canDescend:f}){const{dimensions:h}=e;if(l)return o(Sn,{explanation:e,canViewRecords:r,onDrillUp:c});const x=h.find(u=>u.column!==(d==null?void 0:d.column))??null,v=e.method==="exact_contribution";return m("div",{className:"flex flex-col gap-5",children:[o(ye,{headline:e.headline}),o(hn,{kpiOptions:n,selectedKpiName:t,onKpiChange:a,dimensions:h,selectedDimensionColumn:(d==null?void 0:d.column)??null,onDimensionChange:p}),o(wn,{method:e.method}),d&&m("div",{className:"space-y-2",children:[o(vn,{title:s?"What moved":"What it\u2019s made of",dimension:d,mode:s?"movement":"composition",exact:s&&v,onDescend:f?u=>i(d.column,u):void 0}),o(Cn,{dimension:x})]}),o(kn,{explanation:e})]})}function we(e,n){var t,a,i;return((t=e.kpis)==null?void 0:t.find(r=>r.name===n))??((a=e.kpis)==null?void 0:a.find(r=>r.isPrimaryKpi))??((i=e.kpis)==null?void 0:i[0])}function Ce(e){var n;return(n=e==null?void 0:e.periods)==null?void 0:n[0]}function Ln(e,n,t){var a;const i=(a=e==null?void 0:e.data)==null?void 0:a[0],r=Ce(i?we(i,n):void 0);return{kpiName:n,kpiLabel:t,curr:(r==null?void 0:r.curr)??0,prior:(r==null?void 0:r.prior)??null,diff:(r==null?void 0:r.diff)??0,growth:(r==null?void 0:r.growth)??null}}function $n(e,n){return((e==null?void 0:e.data)??[]).map(t=>{const a=Ce(we(t,n));return{name:t.entityName,curr:(a==null?void 0:a.curr)??0,prior:(a==null?void 0:a.prior)??null,diff:(a==null?void 0:a.diff)??0}})}const Mn=[/(^|_)(id|uuid|guid|number|no|key)$/i,/_id$/i,/_uuid$/i],Tn=e=>Mn.some(n=>n.test(e));function ke(e,n){return e.filter(t=>t===n||!Tn(t))}function _n(e,n,t,a,i){const r=new Set(e),l=s=>s===t?r.has(s):r.has(s)?!i||a.has(s):!1,c=new Set,d=[],p=[...t?[t]:[],...n,...e];for(const s of p)c.has(s)||(c.add(s),l(s)&&d.push(s));return d}function jn({safeGroupbyMap:e,primaryKpiName:n,datasetProperties:t,datasetColumns:a,widgetGroupBy:i,excludeColumns:r}){const l=new Set(r??[]),c=h=>h.filter(x=>!l.has(x)),d=On(t==null?void 0:t.keyDimensions),p=new Set(a.filter(h=>h.allowGrouping).map(h=>h.columnName));if(e&&n in e){const h=e[n]??[],x=a.length>0,v=_n(h,d,i,p,x),u=c(ke(v,i));return{dims:u.slice(0,he),source:"safe_map",totalCandidateCount:u.length}}let s=d.filter(h=>p.has(h));i&&!s.includes(i)&&(s=[i,...s]);const f=c(ke(s,i));return{dims:f.slice(0,he),source:"key_dimensions",totalCandidateCount:f.length}}function De(e,n){if(n.length===0)return e;const t=n.map(a=>({filterColumn:a.column,filterValues:[a.value],logicalOperator:"AND",syntaxString:"="}));return[...e??[],...t]}function On(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function Pe(e,n,t){var a,i;const r=((a=e.kpiNamesAndCalculationPeriods)==null?void 0:a.find(l=>l.kpiName===n))??((i=e.kpiNamesAndCalculationPeriods)==null?void 0:i[0])??null;return{...e,groupByColumnName:null,topN:null,rowLimit:null,rowOffset:null,timeCohort:null,kpiComparisonPeriod:t,columnLevels:void 0,topNPerLevel:void 0,sankeyShowOthers:void 0,sankeyComparisonPeriod:void 0,rankChartCarrierName:void 0,chartSpecificConfig:void 0,additionalParams:null,forecastConfig:void 0,kpiNamesAndCalculationPeriods:r?[{...r,sortBy:null,sortOrder:null,sortPriority:null}]:null}}function Se(e,n){return{...e,groupByColumnName:n,topN:rn}}const An=12,In=14,Ke=120;function Jn(e,n,t){const a=`${e} by ${K(n)}`;if(t.length===0)return a;const i=t.map(l=>`${K(l.column)}: ${l.value}`).join(" > "),r=`${a} \u2014 ${i}`;return r.length<=Ke?r:`${r.slice(0,Ke-1).trimEnd()}\u2026`}function Bn({baseParams:e,selectedKpiName:n,kpiLabel:t,comparisonPeriod:a,recordFilterJson:i,selectedDimensionColumn:r,resolvedChartType:l,path:c}){const d={...Pe(e,n,a),filterJson:i},p=Se(d,r);return{label:Jn(t,r,c),widgetType:l,data:{params:p},metadata:{},width:An,height:In}}function Vn(){const{layouts:e}=te.getState();return e.reduce((n,t)=>Math.max(n,t.y+t.h),0)}function Fn({dashboardId:e}){const{addWidgetAsync:n,isLoading:t}=on();return{exportToDashboard:z(async a=>{try{const i=await n({dashboardId:e,...a,xPosition:0,yPosition:Vn()});return te.getState().addWidgetFromApiResponse(i.widget),me({title:"Added to dashboard",description:"The widget was added to the bottom of this dashboard.",variant:"success"}),i.widget.id}catch{return me({title:"Could not add to dashboard",description:"Please try again.",variant:"destructive"}),null}},[n,e]),isExporting:t}}function En({context:e,kpiLabel:n,selectedDimensionColumn:t,resolvedChartType:a}){const{exportToDashboard:i,isExporting:r}=Fn({dashboardId:e.dashboardId}),l=z(()=>{if(r)return;const c=Bn({baseParams:e.baseParams,selectedKpiName:e.selectedKpiName,kpiLabel:n,comparisonPeriod:e.comparisonPeriod,recordFilterJson:e.recordFilterJson,selectedDimensionColumn:t,resolvedChartType:a,path:e.path});i(c).then(d=>{var p;d&&((p=e.onExported)==null||p.call(e,d))})},[e,n,t,a,i,r]);return o(U,{variant:"outline",size:"sm",leftIcon:o(Re,{}),isLoading:r,disabled:r,onClick:l,className:"shrink-0","data-testid":"explain-add-to-dashboard-button",children:"Add to dashboard"})}const zn=new Set([I.BarChart,I.DonutChart,I.PieChart,I.PieChartWithLegend,I.TreemapChart]);function Un(e){return e!=null&&zn.has(e)?e:I.BarChart}const Gn="No data to chart at this level.";function Le({children:e}){return o("div",{className:"flex h-full min-h-[12rem] items-center justify-center px-6 text-center",children:o("p",{className:"max-w-xs text-xs text-muted-foreground",children:e})})}function Rn({explanation:e,selectedDimension:n,widgetChartType:t,isLeaf:a,canViewRecords:i,canDescend:r,onDescend:l,exportContext:c}){const d=e.headline.kpiLabel;if(a)return m("div",{className:"flex h-full flex-col gap-3","data-testid":"explain-chart-pane",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:d}),o(Le,{children:i?ge:cn})]});const p=(n==null?void 0:n.report)??null,s=p!=null&&Array.isArray(p.data)&&p.data.length>0,f=Un(t),h=n?`${d} by ${K(n.column)}`:d,x=(n==null?void 0:n.column)??null,v=r&&x?u=>l(x,u):void 0;return m("div",{className:"flex h-full flex-col gap-3","data-testid":"explain-chart-pane",children:[m("div",{className:"flex items-start justify-between gap-2",children:[o("h3",{className:"min-w-0 truncate text-sm font-semibold text-foreground",title:h,children:h}),c&&n&&o(En,{context:c,kpiLabel:d,selectedDimensionColumn:n.column,resolvedChartType:f})]}),s?o(We,{children:o("div",{className:"min-h-[20rem] flex-1","data-testid":"explain-chart",children:o(qe,{mode:"dashboard",chartType:f,reportData:p,chartOptions:{},onSegmentClick:v})})}):o(Le,{children:Gn})]})}function Wn({explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,widgetChartType:d,exportContext:p}){const{dimensions:s}=e,[f,h]=A(()=>{var N;return e.leadDimensionColumn??((N=s[0])==null?void 0:N.column)??null}),x=s.find(N=>N.column===f)??s[0]??null,v=e.hasPrior&&e.method!=="composition_only",u=s.length>1;return m("div",{className:"flex h-full flex-col overflow-y-auto md:flex-row md:overflow-hidden","data-testid":"explain-two-pane",children:[o("div",{className:"w-full shrink-0 border-b border-border p-4 md:w-2/5 md:shrink md:overflow-y-auto md:border-b-0 md:border-r",children:o(Kn,{explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,selectedDimension:x,onDimensionChange:h,isMovement:v,canDescend:u})}),o("div",{className:"w-full p-4 md:w-3/5 md:overflow-y-auto",children:o(Rn,{explanation:e,selectedDimension:x,widgetChartType:d,isLeaf:l,canViewRecords:r,canDescend:u,onDescend:i,exportContext:p})})]})}const qn=e=>{const n=e.length-1,t={index:-1,label:"All",isCurrent:e.length===0},a=e.map((i,r)=>({index:r,label:`${K(i.column)}: ${i.value}`,isCurrent:r===n}));return[t,...a]};function Qn({path:e,onDrillUpTo:n,interactive:t=!0}){const a=qn(e);return o("div",{className:"flex flex-wrap items-center gap-x-1 gap-y-1 border-b border-border bg-subtle px-4 py-2.5 text-xs","data-testid":"explain-breadcrumb",children:a.map((i,r)=>m(Je,{children:[r>0&&o(ue,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.isCurrent?o("span",{className:"max-w-xs truncate rounded-md bg-primary/10 px-2 py-0.5 font-semibold text-primary",title:i.label,children:i.label}):t?o(U,{variant:"link",size:"xs",className:"h-auto min-w-0 max-w-xs justify-start p-0 text-left text-xs text-muted-foreground hover:text-foreground",onClick:()=>n(i.index),title:i.label,children:o("span",{className:"truncate",children:i.label})}):o("span",{className:"max-w-xs truncate text-muted-foreground",title:i.label,children:i.label})]},i.index))})}const Yn=new Set(["sum","count","count_true","total"]),Hn=new Set(["average","avg","mean","rate","rate_true","rate_false","ratio"]),Xn=3,Zn=3,et=e=>Math.max(0,Math.min(1,e));function nt(e){const n=(e??"").toLowerCase().trim();return Yn.has(n)?"additive":Hn.has(n)?"ratio":"distinct"}const R=e=>e.reduce((n,t)=>n+t,0);function tt(e){if(e.comparisonPeriod===ae.None)return!1;const n=Math.max(1,Math.abs(e.headline.curr)),t=fe*n;return Math.abs(e.headline.diff)>t?!0:e.dimensions.some(a=>a.groups.some(i=>Math.abs(i.diff)>t))}function at(e,n,t){return n?e==="additive"&&t?"exact_contribution":"descriptive":"composition_only"}function it(e,n){const t=[...e];return n?t.sort((a,i)=>Math.abs(i.diff)-Math.abs(a.diff)):t.sort((a,i)=>i.curr-a.curr),t}function ot(e,n){const t=e.map(i=>n?Math.abs(i.diff):Math.max(0,i.curr)),a=R(t);return a<=0?n?null:0:R(t.slice(0,Xn))/a}function rt(e,n){const t=e.length;if(t<2)return 0;const a=e.map(d=>n?Math.abs(d.diff):Math.max(0,d.curr)),i=R(a);if(i<=0)return 0;const r=Math.min(Zn,t-1),l=R(a.slice(0,r))/i,c=r/t;return et((l-c)/(1-c))}function lt(e){return e==null?!1:e<2||e>sn}function st({dim:e,hasPrior:n,totalDiff:t,canDecompose:a}){const i=it(e.groups,n),r=R(e.groups.map(c=>Math.max(0,c.curr))),l=i.map(c=>({...c,contributionShare:a?c.diff/t:null,levelShare:r>0?Math.max(0,c.curr)/r:0}));return{column:e.column,segments:l,concentration:ot(i,n),score:rt(i,n),cardinality:e.cardinality,report:e.report}}function dt(e,n){return n.score-e.score}function ct(e){var n;const t=nt(e.metricStrategy),a=tt(e),i=e.headline.diff,r=Math.max(1,Math.abs(e.headline.curr)),l=t==="additive"&&a&&Math.abs(i)>fe*r,c=at(t,a,l),d=e.dimensions.filter(s=>s.groups.length>0).filter(s=>!lt(s.cardinality)).map(s=>st({dim:s,hasPrior:a,totalDiff:i,canDecompose:l})).sort(dt),p=c==="composition_only"?null:((n=d[0])==null?void 0:n.column)??null;return{headline:e.headline,method:c,metricStrategy:t,comparisonPeriod:e.comparisonPeriod,hasPrior:a,dimensions:d,leadDimensionColumn:p,analyzedCount:e.dimensions.length,totalCandidateCount:e.totalCandidateCount}}function ut(e,n){const t=Qe({queryKey:["kpiSafeGroupbyMap",e],queryFn:async()=>{if(!e)return null;try{const a=await Ye(e);return a.statusCode<200||a.statusCode>=300||!a.data?(console.warn(`[explain] dataset_get_kpi_safe_groupby_map unavailable (status ${a.statusCode}); falling back to key dimensions.`),null):a.data}catch(a){return console.warn("[explain] dataset_get_kpi_safe_groupby_map threw; falling back to key dimensions.",a),null}},staleTime:3e5,refetchOnWindowFocus:!1,retry:!1,enabled:!!e&&n});return{safeGroupbyMap:t.data??null,isLoading:t.isLoading}}const mt=e=>ae.None,pt=e=>(e==null?void 0:e.kpiComparisonPeriod)??ae.None,ht=e=>{var n,t;return((t=(n=e==null?void 0:e.kpiNamesAndCalculationPeriods)==null?void 0:n.find(a=>a.kpiName))==null?void 0:t.kpiName)??null};function ft({enabled:e,baseParams:n}){const t=(n==null?void 0:n.datasetName)??null,a=ht(n),i=mt(),r=pt(n),{datasetKpis:l,datasetColumns:c,datasetConfig:d,isLoading:p}=He(t,e),{safeGroupbyMap:s,isLoading:f}=ut(t,e),h=p||f,{getKpiDataAsync:x}=Xe({cancelOngoingRequests:!1}),v=X(x);v.current=x;const[u,N]=A([]),[L,B]=A(null),V=X(null);Z(()=>{a&&a!==V.current&&(V.current=a,B(a),N([]))},[a]);const b=L??a,W=z(g=>{B(g),N([])},[]),F=z((g,w)=>{N(j=>[...j,{column:g,value:w}])},[]),$=z(g=>{N(w=>g<0?[]:w.slice(0,g+1))},[]),M=k(()=>((n==null?void 0:n.kpiNamesAndCalculationPeriods)??[]).filter(g=>!!g.kpiName).map(g=>{var w;return{name:g.kpiName,label:((w=l.find(j=>j.kpiName===g.kpiName))==null?void 0:w.kpiLabel)??g.kpiName}}),[n==null?void 0:n.kpiNamesAndCalculationPeriods,l]),P=k(()=>b?l.find(g=>g.kpiName===b):void 0,[l,b]),T=(P==null?void 0:P.kpiLabel)??b??"",_=P==null?void 0:P.kpiMetricsStrategy,C=k(()=>u.map(g=>g.column),[u]),D=k(()=>jn({safeGroupbyMap:s,primaryKpiName:b??"",datasetProperties:d==null?void 0:d.properties,datasetColumns:c,widgetGroupBy:n==null?void 0:n.groupByColumnName,excludeColumns:C}),[s,b,d,c,n==null?void 0:n.groupByColumnName,C]),q=k(()=>De((n==null?void 0:n.filterJson)??null,u),[n==null?void 0:n.filterJson,u]),[Q,S]=A("idle"),[Y,y]=A(null),E=X(0),Me=k(()=>JSON.stringify({baseParams:n,effectiveKpiName:b,comparisonPeriod:i,dims:D.dims,metricStrategy:_,path:u,inputsLoading:h}),[n,b,i,D.dims,_,u,h]);return Z(()=>{if(!e||!n||!b){S("idle");return}if(D.dims.length===0&&h){E.current++,S("loading"),y(null);return}const g=++E.current;S("loading"),y(null),(async()=>{try{const w={...Pe(n,b,i),filterJson:q},j=D.dims.map(O=>({dim:O,params:Se(w,O)})),[Te,..._e]=await Promise.all([v.current(w),...j.map(O=>v.current(O.params))]);if(g!==E.current)return;const je=Ln($e(Te),b,T),Oe=j.map((O,Ae)=>{var re;const H=$e(_e[Ae]);return{column:O.dim,groups:$n(H,b),cardinality:((re=H==null?void 0:H.metadata)==null?void 0:re.distinctCountColumnValues)??null,report:H}}),oe=ct({headline:je,dimensions:Oe,metricStrategy:_,comparisonPeriod:i,totalCandidateCount:D.totalCandidateCount});if(g!==E.current)return;y(oe),S(oe.dimensions.length===0?"empty":"ready")}catch(w){if(g!==E.current)return;console.warn("[explain] failed to build widget explanation",w),S("error")}})()},[e,Me]),{status:Q,explanation:Y,kpiOptions:M,selectedKpiName:b,setSelectedKpiName:W,path:u,descend:F,drillUpTo:$,recordFilterJson:q,comparisonPeriod:i,exportComparisonPeriod:r,isLeaf:D.dims.length===0&&u.length>0}}function $e(e){return!e||e.statusCode!==200?null:e.data??null}const gt="What\u2019s driving this number";function xt({open:e,onOpenChange:n,baseParams:t,rawDataParams:a,canViewRecords:i=!1,widgetLabel:r,widgetChartType:l,dashboardId:c,widgetId:d,onExported:p}){const{status:s,explanation:f,kpiOptions:h,selectedKpiName:x,setSelectedKpiName:v,path:u,descend:N,drillUpTo:L,recordFilterJson:B,exportComparisonPeriod:V,isLeaf:b}=ft({enabled:e,baseParams:t}),W=te(y=>y.hasPermissionToEdit),[F,$]=A("drill"),M=F==="records"&&i,P=i&&u.length>0&&(b||s==="empty"),T=M||P;Z(()=>{!i&&F==="records"&&$("drill")},[i,F]);const _=k(()=>De(null,u)??[],[u]),C=k(()=>a?{...a,rawDataFilterJson:[..._,...a.rawDataFilterJson??[]],filterJson:[...a.filterJson??[],...(t==null?void 0:t.filterJson)??[]]}:null,[a,_,t==null?void 0:t.filterJson]),D=C?[C.datasetName,JSON.stringify(C.filterJson??null),JSON.stringify(C.rawDataFilterJson??null),JSON.stringify(C.columnsToSelect??null)].join("|"):void 0,q=k(()=>!W||!c||!t||!x?null:{dashboardId:c,baseParams:t,selectedKpiName:x,comparisonPeriod:V,recordFilterJson:B,path:u,onExported:p},[W,c,t,x,V,B,u,p]),Q=!!f&&(s==="ready"||b),S=f&&`${f.headline.kpiName}|${u.map(y=>`${y.column}=${y.value}`).join(">")}|${f.dimensions.map(y=>y.column).join(",")}`,Y=(f==null?void 0:f.headline.kpiLabel)??gt;return o(Ze,{open:e,onOpenChange:y=>{n(y),y||($("drill"),setTimeout(()=>{document.body.style.pointerEvents=""},100))},children:o(en,{className:ee("w-full overflow-hidden p-0",T?"max-w-6xl":"max-w-5xl"),"data-testid":"explain-panel",children:m("div",{className:"flex h-[80vh] max-h-[calc(100dvh-9rem)] w-full flex-col overflow-hidden",children:[m("div",{className:"flex items-start justify-between gap-2 border-b border-border px-4 py-3 pr-10",children:[M?m("div",{className:"flex min-w-0 items-center gap-2",children:[o(U,{variant:"ghost",size:"sm",leftIcon:o(ne,{}),"data-testid":"explain-records-back-button",onClick:()=>$("drill"),children:"Back to drill-down"}),o(pe,{children:"Records"})]}):m("div",{className:"min-w-0",children:[o(pe,{children:"Drill down"}),o("p",{className:"mt-1 truncate text-xs text-muted-foreground",title:Y,children:Y})]}),i&&!T&&o(nn,{variant:"ghost",size:"iconSm",tooltip:"View records","aria-label":"View records","data-testid":"explain-view-records-button",icon:o(tn,{}),className:"shrink-0 text-muted-foreground",onClick:()=>$("records")}),P&&!M&&o(U,{variant:"ghost",size:"sm",leftIcon:o(ne,{}),onClick:()=>L(u.length-2),"data-testid":"explain-leaf-back-button",className:"shrink-0",children:"Back one level"})]}),(u.length>0||Q&&f)&&o(Qn,{path:u,onDrillUpTo:L,interactive:!M}),o("div",{className:"min-h-0 flex-1 overflow-hidden",children:T&&C?o(an,{isActive:e&&T,rawDataQueryParams:C,exportFileName:r,dashboardId:c,widgetId:d,widgetType:l??void 0},D):Q&&f?o(Wn,{explanation:f,kpiOptions:h,selectedKpiName:x,onKpiChange:v,onDescend:N,canViewRecords:i,isLeaf:b,onDrillUp:()=>L(u.length-2),widgetChartType:l,exportContext:q},S):o("div",{className:"flex h-full items-center justify-center overflow-y-auto p-4",children:o(Pn,{status:s,canGoBack:u.length>0,onBack:()=>L(u.length-2)})})})]})})})}export{xt as ExplainPanel};
|
|
1
|
+
import{jsxs as m,jsx as o,Fragment as Ie}from"react/jsx-runtime";import{useCallback as z,useState as A,Fragment as Je,useRef as X,useEffect as Z,useMemo as k}from"react";import{cN as Be,ch as Ve,cE as Fe,jc as Ee,bK as le,bL as se,bN as de,bO as ce,j as ee,cX as ue,aA as ze,bY as Ue,bG as U,dr as ne,bU as Ge,jd as te,cw as me,je as Re,jf as I,ah as We,jg as qe,eA as ae,eV as Qe,jh as Ye,eu as He,ji as Xe,c3 as Ze,c4 as en,c5 as pe,bF as nn,jj as tn}from"./runtime-DM500Cza.js";import{WidgetRawDataView as an}from"./WidgetRawDataView-BjHRsvKa.js";import"react-dom";import"react-dom/client";const on=e=>{const n=Be(),{captureException:t}=Ve(),a=Fe({mutationFn:async i=>{try{const r=await Ee(i);if(r.statusCode!==200){const l=new Error("Failed to add widget");throw t(l,{extra:{dashboardId:i.dashboardId,statusCode:r.statusCode}}),l}return r.data}catch(r){throw t(r,{extra:{dashboardId:i.dashboardId}}),r}},onSuccess:(i,r)=>{n.invalidateQueries({queryKey:["dashboardsV2"]}),n.invalidateQueries({queryKey:["dashboardV2",r.dashboardId]})},onError:i=>{}});return{addWidget:a.mutate,addWidgetAsync:a.mutateAsync,isLoading:a.isPending,isError:a.isError,error:a.error}},he=6,rn=10,ln=5,sn=100,fe=1e-9,ge="Deepest level \u2014 open the data view (top-right) to see the underlying records.",dn="Deepest level \u2014 no further breakdown.",cn="Deepest level \u2014 no further breakdown to chart.",un=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1});function J(e){return e==null||Number.isNaN(e)?"\u2014":un.format(e)}function xe(e){return e==null||Number.isNaN(e)?"\u2014":`${e>0?"+":""}${J(e)}`}function G(e){return e==null||Number.isNaN(e)?"\u2014":`${Math.round(e*100)}%`}function K(e){const n=e.replace(/[_-]+/g," ").trim();return n?n.charAt(0).toUpperCase()+n.slice(1):e}const be=(e,n)=>{var t;return((t=e.find(a=>a.name===n))==null?void 0:t.label)??""};function mn({kpiOptions:e,selectedKpiName:n,onKpiChange:t}){return e.length<=1?o("span",{className:"font-semibold text-foreground","data-testid":"explain-kpi-static",children:be(e,n)||"this number"}):m(le,{value:n??void 0,onValueChange:t,children:[o(se,{className:"h-8 w-auto min-w-[7rem] gap-1 border-border bg-card","data-testid":"explain-kpi-select",displayValue:be(e,n)}),o(de,{children:e.map(a=>o(ce,{value:a.name,children:a.label},a.name))})]})}function pn({dimensions:e,selectedDimensionColumn:n,onDimensionChange:t}){return m(le,{value:n??void 0,onValueChange:t,children:[o(se,{className:"h-8 w-auto min-w-[7rem] gap-1 border-border bg-card","data-testid":"explain-dimension-select",displayValue:n?K(n):""}),o(de,{children:e.map(a=>o(ce,{value:a.column,subtext:G(a.score),children:K(a.column)},a.column))})]})}function hn({kpiOptions:e,selectedKpiName:n,onKpiChange:t,dimensions:a,selectedDimensionColumn:i,onDimensionChange:r}){return m("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground","data-testid":"explain-controls",children:[o("span",{children:"Break down"}),o(mn,{kpiOptions:e,selectedKpiName:n,onKpiChange:t}),o("span",{children:"by"}),o(pn,{dimensions:a,selectedDimensionColumn:i,onDimensionChange:r})]})}function ve({label:e,share:n,badge:t,caption:a,drillable:i}){const r=Math.max(0,Math.min(100,n*100));return m(Ie,{children:[m("div",{className:"flex items-baseline justify-between gap-2",children:[m("span",{className:"flex min-w-0 items-center gap-1",children:[o("span",{className:"truncate text-sm text-foreground",title:e,children:e}),i&&o(ue,{className:"size-3.5 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/seg:opacity-100"})]}),o("span",{className:"shrink-0 text-sm font-medium text-foreground",children:t})]}),o("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-subtle",children:o("div",{className:"h-full rounded-full bg-primary",style:{width:`${r}%`}})}),o("div",{className:"text-xs text-muted-foreground",children:a})]})}function fn(e){const{onDescend:n}=e;return n?o("li",{children:o("button",{type:"button",onClick:n,className:ee("group/seg w-full space-y-1 rounded-md p-1.5 text-left transition-colors","hover:bg-subtle focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"),children:o(ve,{...e,drillable:!0})})}):o("li",{className:"space-y-1",children:o(ve,{...e,drillable:!1})})}const gn=(e,n)=>n==="composition"?e.levelShare:e.contributionShare!=null?Math.abs(e.contributionShare):e.levelShare,xn=(e,n,t)=>n==="composition"?G(e.levelShare):t&&e.contributionShare!=null?G(e.contributionShare):xe(e.diff),bn=(e,n)=>{if(n==="composition")return`${J(e.curr)} of total`;const t=J(e.curr);return`${e.prior==null?"\u2014":J(e.prior)} \u2192 ${t}`};function vn({title:e,dimension:n,mode:t,exact:a,onDescend:i}){const r=n.segments.slice(0,ln);return m("section",{className:"space-y-2",children:[m("div",{className:"flex items-baseline justify-between gap-2",children:[o("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e}),m("span",{className:"text-xs text-muted-foreground",children:["by ",n.column]})]}),o("ul",{className:"space-y-2.5",children:r.map(l=>o(fn,{label:l.name,share:gn(l,t),badge:xn(l,t,a),caption:bn(l,t),onDescend:i?()=>i(l.name):void 0},`${n.column}-${l.name}`))})]})}const yn={exact_contribution:"Exact contribution \u2014 this KPI sums, so each segment\u2019s share of the change is precise.",descriptive:"Descriptive \u2014 this KPI can\u2019t be split additively, so these are the segments that moved most.",composition_only:"Composition \u2014 no meaningful prior to compare against, so this shows only what the number is made of."},Nn=e=>e>0?"text-emerald-600 dark:text-emerald-400":e<0?"text-red-600 dark:text-red-400":"text-muted-foreground";function ye({headline:e}){const n=e.prior!=null;return m("div",{className:"space-y-1",children:[o("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e.kpiLabel}),m("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:J(e.curr)}),n&&m("span",{className:ee("text-sm font-medium",Nn(e.diff)),children:[xe(e.diff),e.growth!=null&&` (${G(e.growth)})`]})]}),n&&m("div",{className:"text-xs text-muted-foreground",children:["vs prior ",J(e.prior)]})]})}function wn({method:e}){return m("div",{className:"flex items-start gap-2 rounded-md border border-border bg-subtle p-2.5",children:[o(Ge,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),o("p",{className:"text-xs leading-snug text-muted-foreground",children:yn[e]})]})}function Cn({dimension:e}){return e?m("p",{className:"text-xs text-muted-foreground","data-testid":"explain-runner-up",children:["also strong: ",K(e.column)," \xB7 ",G(e.score)]}):null}function kn({explanation:e}){const{analyzedCount:n,totalCandidateCount:t}=e,a=t>n?`${n} of ${t} dimensions analyzed`:`${n} dimension${n===1?"":"s"} analyzed`;return m("div",{className:"border-t border-border pt-3 text-[11px] leading-snug text-muted-foreground",children:[a,". Calculated live from your latest data."]})}const ie={loading:{title:"Analyzing\u2026",body:"Finding what\u2019s driving this number."},empty:{title:"Nothing to break down",body:"This metric has no dimensions to break it down by."},error:{title:"Couldn\u2019t load the breakdown",body:"Something went wrong loading the breakdown. Please try again shortly."}},Dn={title:"No further breakdown here",body:"This level can\u2019t be broken down any further. Step back to explore a different split."};function Ne({onBack:e}){return o(U,{variant:"outline",size:"sm",leftIcon:o(ne,{}),onClick:e,className:"mt-1","data-testid":"explain-state-back-button",children:"Back one level"})}function Pn({status:e,canGoBack:n=!1,onBack:t}){if(e==="loading")return m("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[o(ze,{size:8}),o("div",{className:"text-sm font-medium text-foreground",children:ie.loading.title}),o("p",{className:"max-w-xs text-xs text-muted-foreground",children:ie.loading.body})]});if(e==="empty"||e==="error"){const a=e==="empty"&&n?Dn:ie[e];return m("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[o(Ue,{className:"size-6 text-muted-foreground"}),o("div",{className:"text-sm font-medium text-foreground",children:a.title}),o("p",{className:"max-w-xs text-xs text-muted-foreground",children:a.body}),n&&t&&o(Ne,{onBack:t})]})}return null}function Sn({explanation:e,canViewRecords:n,onDrillUp:t}){return m("div",{className:"flex flex-col items-start gap-5",children:[o(ye,{headline:e.headline}),o("p",{className:"text-xs text-muted-foreground",children:n?ge:dn}),t&&o(Ne,{onBack:t})]})}function Kn({explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,selectedDimension:d,onDimensionChange:p,isMovement:s,canDescend:f}){const{dimensions:h}=e;if(l)return o(Sn,{explanation:e,canViewRecords:r,onDrillUp:c});const x=h.find(u=>u.column!==(d==null?void 0:d.column))??null,v=e.method==="exact_contribution";return m("div",{className:"flex flex-col gap-5",children:[o(ye,{headline:e.headline}),o(hn,{kpiOptions:n,selectedKpiName:t,onKpiChange:a,dimensions:h,selectedDimensionColumn:(d==null?void 0:d.column)??null,onDimensionChange:p}),o(wn,{method:e.method}),d&&m("div",{className:"space-y-2",children:[o(vn,{title:s?"What moved":"What it\u2019s made of",dimension:d,mode:s?"movement":"composition",exact:s&&v,onDescend:f?u=>i(d.column,u):void 0}),o(Cn,{dimension:x})]}),o(kn,{explanation:e})]})}function we(e,n){var t,a,i;return((t=e.kpis)==null?void 0:t.find(r=>r.name===n))??((a=e.kpis)==null?void 0:a.find(r=>r.isPrimaryKpi))??((i=e.kpis)==null?void 0:i[0])}function Ce(e){var n;return(n=e==null?void 0:e.periods)==null?void 0:n[0]}function Ln(e,n,t){var a;const i=(a=e==null?void 0:e.data)==null?void 0:a[0],r=Ce(i?we(i,n):void 0);return{kpiName:n,kpiLabel:t,curr:(r==null?void 0:r.curr)??0,prior:(r==null?void 0:r.prior)??null,diff:(r==null?void 0:r.diff)??0,growth:(r==null?void 0:r.growth)??null}}function $n(e,n){return((e==null?void 0:e.data)??[]).map(t=>{const a=Ce(we(t,n));return{name:t.entityName,curr:(a==null?void 0:a.curr)??0,prior:(a==null?void 0:a.prior)??null,diff:(a==null?void 0:a.diff)??0}})}const Mn=[/(^|_)(id|uuid|guid|number|no|key)$/i,/_id$/i,/_uuid$/i],Tn=e=>Mn.some(n=>n.test(e));function ke(e,n){return e.filter(t=>t===n||!Tn(t))}function _n(e,n,t,a,i){const r=new Set(e),l=s=>s===t?r.has(s):r.has(s)?!i||a.has(s):!1,c=new Set,d=[],p=[...t?[t]:[],...n,...e];for(const s of p)c.has(s)||(c.add(s),l(s)&&d.push(s));return d}function jn({safeGroupbyMap:e,primaryKpiName:n,datasetProperties:t,datasetColumns:a,widgetGroupBy:i,excludeColumns:r}){const l=new Set(r??[]),c=h=>h.filter(x=>!l.has(x)),d=On(t==null?void 0:t.keyDimensions),p=new Set(a.filter(h=>h.allowGrouping).map(h=>h.columnName));if(e&&n in e){const h=e[n]??[],x=a.length>0,v=_n(h,d,i,p,x),u=c(ke(v,i));return{dims:u.slice(0,he),source:"safe_map",totalCandidateCount:u.length}}let s=d.filter(h=>p.has(h));i&&!s.includes(i)&&(s=[i,...s]);const f=c(ke(s,i));return{dims:f.slice(0,he),source:"key_dimensions",totalCandidateCount:f.length}}function De(e,n){if(n.length===0)return e;const t=n.map(a=>({filterColumn:a.column,filterValues:[a.value],logicalOperator:"AND",syntaxString:"="}));return[...e??[],...t]}function On(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function Pe(e,n,t){var a,i;const r=((a=e.kpiNamesAndCalculationPeriods)==null?void 0:a.find(l=>l.kpiName===n))??((i=e.kpiNamesAndCalculationPeriods)==null?void 0:i[0])??null;return{...e,groupByColumnName:null,topN:null,rowLimit:null,rowOffset:null,timeCohort:null,kpiComparisonPeriod:t,columnLevels:void 0,topNPerLevel:void 0,sankeyShowOthers:void 0,sankeyComparisonPeriod:void 0,rankChartCarrierName:void 0,chartSpecificConfig:void 0,additionalParams:null,forecastConfig:void 0,kpiNamesAndCalculationPeriods:r?[{...r,sortBy:null,sortOrder:null,sortPriority:null}]:null}}function Se(e,n){return{...e,groupByColumnName:n,topN:rn}}const An=12,In=14,Ke=120;function Jn(e,n,t){const a=`${e} by ${K(n)}`;if(t.length===0)return a;const i=t.map(l=>`${K(l.column)}: ${l.value}`).join(" > "),r=`${a} \u2014 ${i}`;return r.length<=Ke?r:`${r.slice(0,Ke-1).trimEnd()}\u2026`}function Bn({baseParams:e,selectedKpiName:n,kpiLabel:t,comparisonPeriod:a,recordFilterJson:i,selectedDimensionColumn:r,resolvedChartType:l,path:c}){const d={...Pe(e,n,a),filterJson:i},p=Se(d,r);return{label:Jn(t,r,c),widgetType:l,data:{params:p},metadata:{},width:An,height:In}}function Vn(){const{layouts:e}=te.getState();return e.reduce((n,t)=>Math.max(n,t.y+t.h),0)}function Fn({dashboardId:e}){const{addWidgetAsync:n,isLoading:t}=on();return{exportToDashboard:z(async a=>{try{const i=await n({dashboardId:e,...a,xPosition:0,yPosition:Vn()});return te.getState().addWidgetFromApiResponse(i.widget),me({title:"Added to dashboard",description:"The widget was added to the bottom of this dashboard.",variant:"success"}),i.widget.id}catch{return me({title:"Could not add to dashboard",description:"Please try again.",variant:"destructive"}),null}},[n,e]),isExporting:t}}function En({context:e,kpiLabel:n,selectedDimensionColumn:t,resolvedChartType:a}){const{exportToDashboard:i,isExporting:r}=Fn({dashboardId:e.dashboardId}),l=z(()=>{if(r)return;const c=Bn({baseParams:e.baseParams,selectedKpiName:e.selectedKpiName,kpiLabel:n,comparisonPeriod:e.comparisonPeriod,recordFilterJson:e.recordFilterJson,selectedDimensionColumn:t,resolvedChartType:a,path:e.path});i(c).then(d=>{var p;d&&((p=e.onExported)==null||p.call(e,d))})},[e,n,t,a,i,r]);return o(U,{variant:"outline",size:"sm",leftIcon:o(Re,{}),isLoading:r,disabled:r,onClick:l,className:"shrink-0","data-testid":"explain-add-to-dashboard-button",children:"Add to dashboard"})}const zn=new Set([I.BarChart,I.DonutChart,I.PieChart,I.PieChartWithLegend,I.TreemapChart]);function Un(e){return e!=null&&zn.has(e)?e:I.BarChart}const Gn="No data to chart at this level.";function Le({children:e}){return o("div",{className:"flex h-full min-h-[12rem] items-center justify-center px-6 text-center",children:o("p",{className:"max-w-xs text-xs text-muted-foreground",children:e})})}function Rn({explanation:e,selectedDimension:n,widgetChartType:t,isLeaf:a,canViewRecords:i,canDescend:r,onDescend:l,exportContext:c}){const d=e.headline.kpiLabel;if(a)return m("div",{className:"flex h-full flex-col gap-3","data-testid":"explain-chart-pane",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:d}),o(Le,{children:i?ge:cn})]});const p=(n==null?void 0:n.report)??null,s=p!=null&&Array.isArray(p.data)&&p.data.length>0,f=Un(t),h=n?`${d} by ${K(n.column)}`:d,x=(n==null?void 0:n.column)??null,v=r&&x?u=>l(x,u):void 0;return m("div",{className:"flex h-full flex-col gap-3","data-testid":"explain-chart-pane",children:[m("div",{className:"flex items-start justify-between gap-2",children:[o("h3",{className:"min-w-0 truncate text-sm font-semibold text-foreground",title:h,children:h}),c&&n&&o(En,{context:c,kpiLabel:d,selectedDimensionColumn:n.column,resolvedChartType:f})]}),s?o(We,{children:o("div",{className:"min-h-[20rem] flex-1","data-testid":"explain-chart",children:o(qe,{mode:"dashboard",chartType:f,reportData:p,chartOptions:{},onSegmentClick:v})})}):o(Le,{children:Gn})]})}function Wn({explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,widgetChartType:d,exportContext:p}){const{dimensions:s}=e,[f,h]=A(()=>{var N;return e.leadDimensionColumn??((N=s[0])==null?void 0:N.column)??null}),x=s.find(N=>N.column===f)??s[0]??null,v=e.hasPrior&&e.method!=="composition_only",u=s.length>1;return m("div",{className:"flex h-full flex-col overflow-y-auto md:flex-row md:overflow-hidden","data-testid":"explain-two-pane",children:[o("div",{className:"w-full shrink-0 border-b border-border p-4 md:w-2/5 md:shrink md:overflow-y-auto md:border-b-0 md:border-r",children:o(Kn,{explanation:e,kpiOptions:n,selectedKpiName:t,onKpiChange:a,onDescend:i,canViewRecords:r,isLeaf:l,onDrillUp:c,selectedDimension:x,onDimensionChange:h,isMovement:v,canDescend:u})}),o("div",{className:"w-full p-4 md:w-3/5 md:overflow-y-auto",children:o(Rn,{explanation:e,selectedDimension:x,widgetChartType:d,isLeaf:l,canViewRecords:r,canDescend:u,onDescend:i,exportContext:p})})]})}const qn=e=>{const n=e.length-1,t={index:-1,label:"All",isCurrent:e.length===0},a=e.map((i,r)=>({index:r,label:`${K(i.column)}: ${i.value}`,isCurrent:r===n}));return[t,...a]};function Qn({path:e,onDrillUpTo:n,interactive:t=!0}){const a=qn(e);return o("div",{className:"flex flex-wrap items-center gap-x-1 gap-y-1 border-b border-border bg-subtle px-4 py-2.5 text-xs","data-testid":"explain-breadcrumb",children:a.map((i,r)=>m(Je,{children:[r>0&&o(ue,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.isCurrent?o("span",{className:"max-w-xs truncate rounded-md bg-primary/10 px-2 py-0.5 font-semibold text-primary",title:i.label,children:i.label}):t?o(U,{variant:"link",size:"xs",className:"h-auto min-w-0 max-w-xs justify-start p-0 text-left text-xs text-muted-foreground hover:text-foreground",onClick:()=>n(i.index),title:i.label,children:o("span",{className:"truncate",children:i.label})}):o("span",{className:"max-w-xs truncate text-muted-foreground",title:i.label,children:i.label})]},i.index))})}const Yn=new Set(["sum","count","count_true","total"]),Hn=new Set(["average","avg","mean","rate","rate_true","rate_false","ratio"]),Xn=3,Zn=3,et=e=>Math.max(0,Math.min(1,e));function nt(e){const n=(e??"").toLowerCase().trim();return Yn.has(n)?"additive":Hn.has(n)?"ratio":"distinct"}const R=e=>e.reduce((n,t)=>n+t,0);function tt(e){if(e.comparisonPeriod===ae.None)return!1;const n=Math.max(1,Math.abs(e.headline.curr)),t=fe*n;return Math.abs(e.headline.diff)>t?!0:e.dimensions.some(a=>a.groups.some(i=>Math.abs(i.diff)>t))}function at(e,n,t){return n?e==="additive"&&t?"exact_contribution":"descriptive":"composition_only"}function it(e,n){const t=[...e];return n?t.sort((a,i)=>Math.abs(i.diff)-Math.abs(a.diff)):t.sort((a,i)=>i.curr-a.curr),t}function ot(e,n){const t=e.map(i=>n?Math.abs(i.diff):Math.max(0,i.curr)),a=R(t);return a<=0?n?null:0:R(t.slice(0,Xn))/a}function rt(e,n){const t=e.length;if(t<2)return 0;const a=e.map(d=>n?Math.abs(d.diff):Math.max(0,d.curr)),i=R(a);if(i<=0)return 0;const r=Math.min(Zn,t-1),l=R(a.slice(0,r))/i,c=r/t;return et((l-c)/(1-c))}function lt(e){return e==null?!1:e<2||e>sn}function st({dim:e,hasPrior:n,totalDiff:t,canDecompose:a}){const i=it(e.groups,n),r=R(e.groups.map(c=>Math.max(0,c.curr))),l=i.map(c=>({...c,contributionShare:a?c.diff/t:null,levelShare:r>0?Math.max(0,c.curr)/r:0}));return{column:e.column,segments:l,concentration:ot(i,n),score:rt(i,n),cardinality:e.cardinality,report:e.report}}function dt(e,n){return n.score-e.score}function ct(e){var n;const t=nt(e.metricStrategy),a=tt(e),i=e.headline.diff,r=Math.max(1,Math.abs(e.headline.curr)),l=t==="additive"&&a&&Math.abs(i)>fe*r,c=at(t,a,l),d=e.dimensions.filter(s=>s.groups.length>0).filter(s=>!lt(s.cardinality)).map(s=>st({dim:s,hasPrior:a,totalDiff:i,canDecompose:l})).sort(dt),p=c==="composition_only"?null:((n=d[0])==null?void 0:n.column)??null;return{headline:e.headline,method:c,metricStrategy:t,comparisonPeriod:e.comparisonPeriod,hasPrior:a,dimensions:d,leadDimensionColumn:p,analyzedCount:e.dimensions.length,totalCandidateCount:e.totalCandidateCount}}function ut(e,n){const t=Qe({queryKey:["kpiSafeGroupbyMap",e],queryFn:async()=>{if(!e)return null;try{const a=await Ye(e);return a.statusCode<200||a.statusCode>=300||!a.data?(console.warn(`[explain] dataset_get_kpi_safe_groupby_map unavailable (status ${a.statusCode}); falling back to key dimensions.`),null):a.data}catch(a){return console.warn("[explain] dataset_get_kpi_safe_groupby_map threw; falling back to key dimensions.",a),null}},staleTime:3e5,refetchOnWindowFocus:!1,retry:!1,enabled:!!e&&n});return{safeGroupbyMap:t.data??null,isLoading:t.isLoading}}const mt=e=>ae.None,pt=e=>(e==null?void 0:e.kpiComparisonPeriod)??ae.None,ht=e=>{var n,t;return((t=(n=e==null?void 0:e.kpiNamesAndCalculationPeriods)==null?void 0:n.find(a=>a.kpiName))==null?void 0:t.kpiName)??null};function ft({enabled:e,baseParams:n}){const t=(n==null?void 0:n.datasetName)??null,a=ht(n),i=mt(),r=pt(n),{datasetKpis:l,datasetColumns:c,datasetConfig:d,isLoading:p}=He(t,e),{safeGroupbyMap:s,isLoading:f}=ut(t,e),h=p||f,{getKpiDataAsync:x}=Xe({cancelOngoingRequests:!1}),v=X(x);v.current=x;const[u,N]=A([]),[L,B]=A(null),V=X(null);Z(()=>{a&&a!==V.current&&(V.current=a,B(a),N([]))},[a]);const b=L??a,W=z(g=>{B(g),N([])},[]),F=z((g,w)=>{N(j=>[...j,{column:g,value:w}])},[]),$=z(g=>{N(w=>g<0?[]:w.slice(0,g+1))},[]),M=k(()=>((n==null?void 0:n.kpiNamesAndCalculationPeriods)??[]).filter(g=>!!g.kpiName).map(g=>{var w;return{name:g.kpiName,label:((w=l.find(j=>j.kpiName===g.kpiName))==null?void 0:w.kpiLabel)??g.kpiName}}),[n==null?void 0:n.kpiNamesAndCalculationPeriods,l]),P=k(()=>b?l.find(g=>g.kpiName===b):void 0,[l,b]),T=(P==null?void 0:P.kpiLabel)??b??"",_=P==null?void 0:P.kpiMetricsStrategy,C=k(()=>u.map(g=>g.column),[u]),D=k(()=>jn({safeGroupbyMap:s,primaryKpiName:b??"",datasetProperties:d==null?void 0:d.properties,datasetColumns:c,widgetGroupBy:n==null?void 0:n.groupByColumnName,excludeColumns:C}),[s,b,d,c,n==null?void 0:n.groupByColumnName,C]),q=k(()=>De((n==null?void 0:n.filterJson)??null,u),[n==null?void 0:n.filterJson,u]),[Q,S]=A("idle"),[Y,y]=A(null),E=X(0),Me=k(()=>JSON.stringify({baseParams:n,effectiveKpiName:b,comparisonPeriod:i,dims:D.dims,metricStrategy:_,path:u,inputsLoading:h}),[n,b,i,D.dims,_,u,h]);return Z(()=>{if(!e||!n||!b){S("idle");return}if(D.dims.length===0&&h){E.current++,S("loading"),y(null);return}const g=++E.current;S("loading"),y(null),(async()=>{try{const w={...Pe(n,b,i),filterJson:q},j=D.dims.map(O=>({dim:O,params:Se(w,O)})),[Te,..._e]=await Promise.all([v.current(w),...j.map(O=>v.current(O.params))]);if(g!==E.current)return;const je=Ln($e(Te),b,T),Oe=j.map((O,Ae)=>{var re;const H=$e(_e[Ae]);return{column:O.dim,groups:$n(H,b),cardinality:((re=H==null?void 0:H.metadata)==null?void 0:re.distinctCountColumnValues)??null,report:H}}),oe=ct({headline:je,dimensions:Oe,metricStrategy:_,comparisonPeriod:i,totalCandidateCount:D.totalCandidateCount});if(g!==E.current)return;y(oe),S(oe.dimensions.length===0?"empty":"ready")}catch(w){if(g!==E.current)return;console.warn("[explain] failed to build widget explanation",w),S("error")}})()},[e,Me]),{status:Q,explanation:Y,kpiOptions:M,selectedKpiName:b,setSelectedKpiName:W,path:u,descend:F,drillUpTo:$,recordFilterJson:q,comparisonPeriod:i,exportComparisonPeriod:r,isLeaf:D.dims.length===0&&u.length>0}}function $e(e){return!e||e.statusCode!==200?null:e.data??null}const gt="What\u2019s driving this number";function xt({open:e,onOpenChange:n,baseParams:t,rawDataParams:a,canViewRecords:i=!1,widgetLabel:r,widgetChartType:l,dashboardId:c,widgetId:d,onExported:p}){const{status:s,explanation:f,kpiOptions:h,selectedKpiName:x,setSelectedKpiName:v,path:u,descend:N,drillUpTo:L,recordFilterJson:B,exportComparisonPeriod:V,isLeaf:b}=ft({enabled:e,baseParams:t}),W=te(y=>y.hasPermissionToEdit),[F,$]=A("drill"),M=F==="records"&&i,P=i&&u.length>0&&(b||s==="empty"),T=M||P;Z(()=>{!i&&F==="records"&&$("drill")},[i,F]);const _=k(()=>De(null,u)??[],[u]),C=k(()=>a?{...a,rawDataFilterJson:[..._,...a.rawDataFilterJson??[]],filterJson:[...a.filterJson??[],...(t==null?void 0:t.filterJson)??[]]}:null,[a,_,t==null?void 0:t.filterJson]),D=C?[C.datasetName,JSON.stringify(C.filterJson??null),JSON.stringify(C.rawDataFilterJson??null),JSON.stringify(C.columnsToSelect??null)].join("|"):void 0,q=k(()=>!W||!c||!t||!x?null:{dashboardId:c,baseParams:t,selectedKpiName:x,comparisonPeriod:V,recordFilterJson:B,path:u,onExported:p},[W,c,t,x,V,B,u,p]),Q=!!f&&(s==="ready"||b),S=f&&`${f.headline.kpiName}|${u.map(y=>`${y.column}=${y.value}`).join(">")}|${f.dimensions.map(y=>y.column).join(",")}`,Y=(f==null?void 0:f.headline.kpiLabel)??gt;return o(Ze,{open:e,onOpenChange:y=>{n(y),y||($("drill"),setTimeout(()=>{document.body.style.pointerEvents=""},100))},children:o(en,{className:ee("w-full overflow-hidden p-0",T?"max-w-6xl":"max-w-5xl"),"data-testid":"explain-panel",children:m("div",{className:"flex h-[80vh] max-h-[calc(100dvh-9rem)] w-full flex-col overflow-hidden",children:[m("div",{className:"flex items-start justify-between gap-2 border-b border-border px-4 py-3 pr-10",children:[M?m("div",{className:"flex min-w-0 items-center gap-2",children:[o(U,{variant:"ghost",size:"sm",leftIcon:o(ne,{}),"data-testid":"explain-records-back-button",onClick:()=>$("drill"),children:"Back to drill-down"}),o(pe,{children:"Records"})]}):m("div",{className:"min-w-0",children:[o(pe,{children:"Drill down"}),o("p",{className:"mt-1 truncate text-xs text-muted-foreground",title:Y,children:Y})]}),i&&!T&&o(nn,{variant:"ghost",size:"iconSm",tooltip:"View records","aria-label":"View records","data-testid":"explain-view-records-button",icon:o(tn,{}),className:"shrink-0 text-muted-foreground",onClick:()=>$("records")}),P&&!M&&o(U,{variant:"ghost",size:"sm",leftIcon:o(ne,{}),onClick:()=>L(u.length-2),"data-testid":"explain-leaf-back-button",className:"shrink-0",children:"Back one level"})]}),(u.length>0||Q&&f)&&o(Qn,{path:u,onDrillUpTo:L,interactive:!M}),o("div",{className:"min-h-0 flex-1 overflow-hidden",children:T&&C?o(an,{isActive:e&&T,rawDataQueryParams:C,exportFileName:r,dashboardId:c,widgetId:d,widgetType:l??void 0},D):Q&&f?o(Wn,{explanation:f,kpiOptions:h,selectedKpiName:x,onKpiChange:v,onDescend:N,canViewRecords:i,isLeaf:b,onDrillUp:()=>L(u.length-2),widgetChartType:l,exportContext:q},S):o("div",{className:"flex h-full items-center justify-center overflow-y-auto p-4",children:o(Pn,{status:s,canGoBack:u.length>0,onBack:()=>L(u.length-2)})})})]})})})}export{xt as ExplainPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as l,jsx as e,Fragment as R}from"react/jsx-runtime";import Ma,{useMemo as L,useState as b,useEffect as me,useCallback as M,useRef as Et}from"react";import{ch as $e,fq as He,gX as Z,gY as Re,gZ as je,g_ as ee,g$ as _a,h0 as Pt,bB as Oa,h1 as Ba,bG as j,co as $a,bX as pe,O as Ha,h2 as Ra,h3 as ja,h4 as Ft,h5 as It,cK as Ga,h6 as Va,h7 as Ua,h8 as qa,h9 as Xa,ha as Wa,hb as Qa,hc as za,hd as Ja,e5 as Ka,he as Ya,hf as Za,cV as ei,cX as ti,cc as Ge,cY as Ve,cZ as ai,d2 as ue,j as kt,cM as ii,cP as St,cj as ri,ck as li,cQ as Ue,c3 as ni,c4 as oi,ca as qe,c5 as Xe,hg as si,hh as ci,aD as di,bQ as te,cb as hi,bK as We,bL as Qe,bM as ze,bN as Je,c_ as mi,c$ as pi,bO as Q,d0 as At,d1 as Ke,hi as ui,hj as fi,bP as Tt,hk as gi,cw as z,d4 as Dt}from"./runtime-
|
|
1
|
+
import{jsxs as l,jsx as e,Fragment as R}from"react/jsx-runtime";import Ma,{useMemo as L,useState as b,useEffect as me,useCallback as M,useRef as Et}from"react";import{ch as $e,fq as He,gX as Z,gY as Re,gZ as je,g_ as ee,g$ as _a,h0 as Pt,bB as Oa,h1 as Ba,bG as j,co as $a,bX as pe,O as Ha,h2 as Ra,h3 as ja,h4 as Ft,h5 as It,cK as Ga,h6 as Va,h7 as Ua,h8 as qa,h9 as Xa,ha as Wa,hb as Qa,hc as za,hd as Ja,e5 as Ka,he as Ya,hf as Za,cV as ei,cX as ti,cc as Ge,cY as Ve,cZ as ai,d2 as ue,j as kt,cM as ii,cP as St,cj as ri,ck as li,cQ as Ue,c3 as ni,c4 as oi,ca as qe,c5 as Xe,hg as si,hh as ci,aD as di,bQ as te,cb as hi,bK as We,bL as Qe,bM as ze,bN as Je,c_ as mi,c$ as pi,bO as Q,d0 as At,d1 as Ke,hi as ui,hj as fi,bP as Tt,hk as gi,cw as z,d4 as Dt}from"./runtime-DM500Cza.js";import{C as xi}from"./calendar-D4LgtZMv.js";import{u as vi}from"./useSupabaseBlobUrl-C6zcEi_X.js";const bi=(a,i,r,o,n,s)=>["epic","activities","infinite",a,i,r,o,n,s],yi=({accountId:a,accountTypeCode:i="CUST",activityStatus:r="All",activityCode:o,associatedToId:n,associatedToType:s,enabled:u=!0})=>{var h;const{captureException:m}=$e(),c=He({queryKey:bi(a,i,r,o,n,s),queryFn:async({pageParam:v=0})=>{const F={account_id:a,account_type_code:i,activity_status:r,page_number:v,...o&&{activity_code:o},...n&&{associated_to_id:n},...s&&{associated_to_type:s}};try{const g=await Re.listActivities(F);if(je(g))throw new ee;if(_a(g))return{activities:[],totalFound:0,totalCount:0,pageNumber:v,totalPages:0,hasMorePages:!1,status:"success",message:""};if(Pt(g)){const{message:A,statusCode:C}=g;throw new Z(A??"Epic is temporarily unavailable. Please try again.",C)}if(g.status!=="success")throw new Error(g.message||"Failed to fetch activities");return g}catch(g){throw g instanceof ee||g instanceof Z||m({error:g,extra:{pageParam:v,accountId:a,accountTypeCode:i,activityStatus:r}}),g}},getNextPageParam:(v,F)=>{if(v.hasMorePages)return F.length},initialPageParam:0,enabled:u&&!!a,staleTime:300*1e3,gcTime:600*1e3,retry:(v,F)=>F instanceof Z&&v<1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),x=L(()=>{var v;return(v=c.data)!=null&&v.pages?c.data.pages.reduce((F,g)=>[...F,...g.activities||[]],[]):[]},[(h=c.data)==null?void 0:h.pages]);return{...c,activities:x,hasMoreActivities:c.hasNextPage,loadMoreActivities:c.fetchNextPage,isLoadingMore:c.isFetchingNextPage}},Ye=50,Lt=(a,i,r,o)=>["epic","policies","infinite",a,i,r,o],Ni=({clientId:a,policyNumber:i,status:r="All",expirationDateBegins:o,enabled:n=!0,drainAll:s=!1})=>{var u,h;const{captureException:m}=$e(),c=He({queryKey:Lt(a,i,r,o),queryFn:async({pageParam:E=0})=>{const _={client_id:a,page_number:E,...i&&{policy_number:i,policy_number_comparison_type:"Containing"},...r&&{status:r},...o&&{expiration_date_begins:o}};try{const I=await Re.listPolicies(_);if(je(I))throw new ee;if(Pt(I)){const{message:p,statusCode:w}=I;throw new Z(p??"Epic is temporarily unavailable. Please try again.",w)}if(I.status!=="success")throw new Error(I.message||"Failed to fetch policies");return I}catch(I){throw I instanceof ee||I instanceof Z||m({error:I,extra:{pageParam:E,clientId:a}}),I}},getNextPageParam:(E,_)=>E.hasMorePages?_.length:void 0,initialPageParam:0,enabled:n&&!!a,staleTime:300*1e3,gcTime:600*1e3,retry:(E,_)=>_ instanceof Z&&E<1,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),x=L(()=>{var E;return(((E=c.data)==null?void 0:E.pages)??[]).flatMap(_=>_.policies??[])},[(u=c.data)==null?void 0:u.pages]),v=n&&!!a,{hasNextPage:F,isFetchingNextPage:g,isError:A,fetchNextPage:C}=c,$=((h=c.data)==null?void 0:h.pages.length)??0,[W,T]=b(Ye),X=JSON.stringify(Lt(a,i,r,o));me(()=>{T(Ye)},[X]);const B=M(()=>{T(E=>Math.max(E,$)+Ye)},[$]),G=$>=W,H=s&&v&&!G&&!A&&!!F;return me(()=>{!H||g||C({cancelRefetch:!1})},[H,g,C,$]),{...c,policies:x,hasMorePolicies:c.hasNextPage,loadMorePolicies:c.fetchNextPage,isLoadingMore:c.isFetchingNextPage,isDraining:H||s&&v&&!G&&g,isDrainCapped:s&&G&&!!F,extendDrain:B}},wi=a=>{const i=["epic","clients","infinite"];return a&&Object.keys(a).length>0?[...i,a]:i},Ci=({enabled:a=!0,filters:i={}}={})=>{var r;const{toast:o}=Oa(),{captureException:n}=$e(),s=He({queryKey:wi(i),queryFn:async({pageParam:h=0})=>{const m={page_number:h,...i};try{const c=await Re.listClients(m);if(je(c))throw new ee;if(c.status!=="success")throw new Error(c.message||"Failed to fetch clients");return c}catch(c){if(c instanceof ee)throw c;const x=c instanceof Error?c.message:"An unknown error occurred";throw o({title:"Couldn't reach Epic right now",description:x,variant:"destructive"}),n({error:c,extra:{pageParam:h,filters:i}}),c}},getNextPageParam:(h,m)=>{if(h.hasMorePages)return m.length},initialPageParam:0,enabled:a,staleTime:300*1e3,gcTime:600*1e3,retry:!1}),u=L(()=>{var h;return(h=s.data)!=null&&h.pages?s.data.pages.reduce((m,c)=>[...m,...c.clients||[]],[]):[]},[(r=s.data)==null?void 0:r.pages]);return{...s,clients:u,hasMoreClients:s.hasNextPage,loadMoreClients:s.fetchNextPage,isLoadingMore:s.isFetchingNextPage}},Ei=()=>{const a=Ba();return l("div",{role:"alert","data-testid":"epic-user-code-missing-alert",className:"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100",children:[e("p",{className:"font-medium",children:"Your Epic access isn't set up yet"}),e("p",{className:"mt-1 text-amber-800 dark:text-amber-200",children:"Ask your administrator to map your Epic operator code in the Applied Epic integration settings, then reopen this dialog."}),a?e("p",{className:"mt-1 text-amber-800 dark:text-amber-200","data-testid":"epic-user-code-missing-alert-contacts",children:a}):null]})},Mt=(a,i)=>a instanceof Z?a.userMessage:i,_t=({message:a,onRetry:i,disabled:r=!1,"data-testid":o})=>l("div",{role:"alert","data-testid":o,className:"mt-1 flex items-center justify-between gap-2",children:[e("p",{className:"text-xs text-error min-w-0",children:a}),e(j,{variant:"outline",size:"xs",leftIcon:e($a,{className:"h-3 w-3"}),onClick:i,disabled:r,className:"shrink-0","data-testid":o?`${o}-retry`:void 0,children:"Retry"})]}),Pi="Untitled Policy",Ot=a=>{const i=Ha(a);return Number.isNaN(i.getTime())||i.getFullYear()<1970?"N/A":Ra(i)},Bt=a=>{const i=a.description||Pi;return{value:String(a.policyId),label:i,customRender:l("div",{className:"flex flex-col flex-1 min-w-0",children:[e(pe,{tooltipContent:i,side:"right",children:e("span",{className:"truncate text-sm block",children:i})}),l("div",{className:"flex gap-3 text-xs text-neutral03",children:[l("span",{className:"min-w-0 truncate",children:["Policy #: ",a.policyNumber||"N/A"]}),l("span",{className:"flex items-center gap-1 shrink-0 whitespace-nowrap",children:[e(xi,{size:12}),Ot(a.effectiveDate)," - ",Ot(a.expirationDate)]}),l("span",{className:"min-w-0 truncate",children:["ID: ",a.policyId]})]})]})}},Fi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";function $t(a){return a.startsWith("data:")||a.startsWith("blob:")?!0:a.startsWith("/")&&!a.startsWith("//")}async function Ii(a,i){const r=JSON.parse(JSON.stringify(a)),o=async n=>{for(const s of n){if(!s||typeof s!="object")continue;const u=s;if(typeof u.src=="string"&&u.src.length>0&&!$t(u.src)){let h=null;try{h=await i(u.src)}catch{h=null}u.src=h&&$t(h)?h:Fi}Array.isArray(u.objects)&&await o(u.objects)}};return Array.isArray(r.objects)&&await o(r.objects),r}async function ki({json:a,width:i,height:r,multiplier:o=2}){if(typeof document>"u")throw new Error("rasterizeChromeBand requires a browser document");const n=document.createElement("canvas"),s=new ja(n,i,r);try{return s.workspaceWidth=i,s.workspaceHeight=r,await s.loadFromJSON(a,{awaitImages:!0}),s.canvas.renderAll(),s.canvas.toDataURL({format:"png",multiplier:o})}finally{s.dispose()}}const Si={A4:"a4",Letter:"us-letter"};function Ai(a){return a||null}async function Ht(a,i,r,o,n){const s=Ai(a);if(!s||!Va(s))return null;const u=Qa(n,r),h=Ua(s,i,u);if(!h)return null;const m=qa(a,u),c=Xa(u),x=await Ii(h,o);return{html:`<img src="${await ki({json:x,width:c,height:m})}" style="display:block;width:100%;" alt="" />`,height:Wa(m)}}async function Ti(a,i,r,o,n,s="portrait",u="A4"){var h,m;let c="",x="",v,F;if(!a)return{headerHtml:c,footerHtml:x};const g=Si[u]??"us-letter";if(i){const C=await Ht(a.headerBlock,"header",s,n??o,g);C&&(c=C.html,v=C.height)}if(r){const C=await Ht(a.footerBlock,"footer",s,n??o,g);C&&(x=C.html,F=C.height)}if(!a.metadata)return{headerHtml:c,footerHtml:x,headerHeight:v,footerHeight:F};const A=Ft(a.metadata);return i&&!c&&(h=A.header)!=null&&h.template&&(c=await It(A.header.template,o)),r&&!x&&(m=A.footer)!=null&&m.template&&(x=await It(A.footer.template,o)),{headerHtml:c,footerHtml:x,headerHeight:v,footerHeight:F}}function Di(a){let i="";if(!(a!=null&&a.themeData))return i;const r=a.themeData;if(r.heading&&(i+=`
|
|
2
2
|
h1 { color: ${r.heading.h1??"#1a1a1a"} !important; }
|
|
3
3
|
h2 { color: ${r.heading.h2??"#2d2d2d"} !important; }
|
|
4
4
|
h3 { color: ${r.heading.h3??"#404040"} !important; }
|