@outmarket-ai/react-sdk 0.1.0-alpha.9 → 0.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/README.md +61 -1
  2. package/dist/index.d.ts +8 -2
  3. package/dist/index.js +1 -1
  4. package/dist/pdf.worker.min.mjs +2 -21
  5. package/dist/styles.css +1 -11
  6. package/package.json +11 -5
  7. package/dist/AddNoteDialog-DhseSUVW.js +0 -1
  8. package/dist/AlertDialog-Dx1Z4OrM.js +0 -1
  9. package/dist/ApproveWorkflowsList-Cx2xNqu9.js +0 -5
  10. package/dist/BORLetterEditor-CpXL7MT-.js +0 -119
  11. package/dist/BillDetailModal-Cj9d5gIA.js +0 -1
  12. package/dist/CoiIssueHolderModal-CE854JKK.js +0 -1
  13. package/dist/DeletePromptDialog-C3Shx90V.js +0 -1
  14. package/dist/EmailFormatSelectionDialog-Bo3-G8L0.js +0 -1
  15. package/dist/ExcelExportPreviewDialog-NvbX8KK1.js +0 -1
  16. package/dist/ExplainPanel-BQwsIk-9.js +0 -1
  17. package/dist/ExportDialog-CGnw6GPb.js +0 -30
  18. package/dist/ExportToAmsDialog-CuW-XMnY.js +0 -1
  19. package/dist/ExportToDriveDialog-oEm9wL-h.js +0 -1
  20. package/dist/FeedbackTool-la43Nk0I.js +0 -30
  21. package/dist/LayerDetailModal-B-gtAIMb.js +0 -1
  22. package/dist/LogoEditor-CiD5nrq_.js +0 -1
  23. package/dist/MarkdownExportPreviewDialog-CVlZsnV-.js +0 -5
  24. package/dist/NotificationDrawer-DkiU4k1-.js +0 -7
  25. package/dist/PhoneNumbersDisplay-BcKFVIhh.js +0 -1
  26. package/dist/PlanSelector-CbuGEmUO.js +0 -26
  27. package/dist/PlanSettingsModal-CYLAXbUO.js +0 -1
  28. package/dist/PlanWizardModal-D9GRljeC.js +0 -1
  29. package/dist/RenameAssetDialog-Rx-mnefu.js +0 -1
  30. package/dist/SaveBlockDialog-T9mHc5hu.js +0 -1
  31. package/dist/SaveOutlineDialog-Ce0eEWTR.js +0 -1
  32. package/dist/SavePromptDialog-D3lm7H51.js +0 -1
  33. package/dist/ShareResourceDialog-ACYRf6LZ.js +0 -1
  34. package/dist/TermsNoticeModal-AgvfPy5K.js +0 -1
  35. package/dist/TowerAlertModal-sRGrwqdf.js +0 -1
  36. package/dist/TowerSummaryModal-4Dk1iV4z.js +0 -1
  37. package/dist/VaultSettingsDialog-DddN5Jq6.js +0 -1
  38. package/dist/ViewNoteDialog-D0V651HA.js +0 -1
  39. package/dist/WhatsNewProvider-CcmOzaKL.js +0 -36
  40. package/dist/WidgetRawDataView-DUzIDMuO.js +0 -1
  41. package/dist/abap-V7zjtt5B.js +0 -1
  42. package/dist/abnf-Cs8-oUtO.js +0 -1
  43. package/dist/actionscript-T2YELVMS.js +0 -1
  44. package/dist/activityLog-Dh4AWnxR.js +0 -1
  45. package/dist/ada-DnnX8eVy.js +0 -1
  46. package/dist/agda-B11duiie.js +0 -1
  47. package/dist/al-CQYsuVVM.js +0 -1
  48. package/dist/antlr4-4B1Sc4kw.js +0 -1
  49. package/dist/apacheconf-CEWWS0Xl.js +0 -1
  50. package/dist/apex-Bw9Gtufo.js +0 -1
  51. package/dist/apl-GPUaXahd.js +0 -1
  52. package/dist/applescript-ClGuMaSV.js +0 -1
  53. package/dist/aql-B0NbAClI.js +0 -1
  54. package/dist/arduino-ClbHu-uo.js +0 -1
  55. package/dist/arff-DuOU54aX.js +0 -1
  56. package/dist/asciidoc-BhtWnAkY.js +0 -1
  57. package/dist/asm6502-DQTasU9k.js +0 -1
  58. package/dist/asmatmel-DTAwUCm0.js +0 -1
  59. package/dist/aspnet-By_Uv-R2.js +0 -1
  60. package/dist/autohotkey--_I21FCo.js +0 -1
  61. package/dist/autoit-CvH4ufrU.js +0 -1
  62. package/dist/avisynth-DFZaFA4R.js +0 -1
  63. package/dist/avro-idl-BSSj5FmU.js +0 -1
  64. package/dist/bash-Dq5JElW2.js +0 -1
  65. package/dist/bash-Jzmc6JlP.js +0 -1
  66. package/dist/basic-CC56mfFq.js +0 -1
  67. package/dist/basic-CJsDLcso.js +0 -1
  68. package/dist/batch-BYpJ9kPS.js +0 -1
  69. package/dist/bbcode-UXb4O2FT.js +0 -1
  70. package/dist/bell-B4nDPvYM.js +0 -7
  71. package/dist/bicep-ha95m6NM.js +0 -1
  72. package/dist/birb-BM8QRfSV.js +0 -1
  73. package/dist/bison-BaRrGKdN.js +0 -1
  74. package/dist/blockEditorContent-BL5d7zzw.js +0 -166
  75. package/dist/bnf-bWLwOaU4.js +0 -1
  76. package/dist/brainfuck-COJQXt-t.js +0 -1
  77. package/dist/brightscript-BsJBKxjD.js +0 -1
  78. package/dist/bro-Bp53uiUK.js +0 -1
  79. package/dist/bsl-tLrmQ80l.js +0 -1
  80. package/dist/c-C4WJRAOR.js +0 -1
  81. package/dist/c-DA5TVlGb.js +0 -1
  82. package/dist/calendar-CCDvKYJL.js +0 -7
  83. package/dist/cfscript-iUOvrdw6.js +0 -1
  84. package/dist/chaiscript-Bdsn6xqe.js +0 -1
  85. package/dist/cil-Bg4_FSZp.js +0 -1
  86. package/dist/clike-CStN-Ul5.js +0 -1
  87. package/dist/clike-fTAcdHbS.js +0 -1
  88. package/dist/clojure-CP23saqo.js +0 -1
  89. package/dist/cmake-CUC1Yn75.js +0 -1
  90. package/dist/cobol-DRCg5sRL.js +0 -1
  91. package/dist/coffeescript-c3ArqojV.js +0 -1
  92. package/dist/concurnas-BkGymU0R.js +0 -1
  93. package/dist/confetti.module-gccwWOTG.js +0 -2
  94. package/dist/contactsList-CSPk7SYS.js +0 -18
  95. package/dist/copyPreviewToClipboard-CrY57HL-.js +0 -170
  96. package/dist/coq-DfqiQwQs.js +0 -1
  97. package/dist/core-DnSu5wN6.js +0 -9
  98. package/dist/cpp-C2xoosyb.js +0 -1
  99. package/dist/cpp-DBmYs6pK.js +0 -1
  100. package/dist/crystal-_Ltdvkfv.js +0 -1
  101. package/dist/csharp-CzFXtKq-.js +0 -1
  102. package/dist/csharp-DhrYzyQg.js +0 -1
  103. package/dist/cshtml-CPggulxs.js +0 -1
  104. package/dist/csp-C5jhDYKS.js +0 -1
  105. package/dist/css-CHGm_5Ug.js +0 -1
  106. package/dist/css-Dr8mrUZQ.js +0 -1
  107. package/dist/css-extras-CR_At87f.js +0 -1
  108. package/dist/csv-BjMjkdsd.js +0 -1
  109. package/dist/cypher-Cz3MYOsR.js +0 -1
  110. package/dist/d-U3DXoBKs.js +0 -1
  111. package/dist/dart-nkmISAms.js +0 -1
  112. package/dist/dataweave-Bqffbm3l.js +0 -1
  113. package/dist/dax-BUmQo96b.js +0 -1
  114. package/dist/dhall-tqKETJ5N.js +0 -1
  115. package/dist/diff-BN3mhZNK.js +0 -3
  116. package/dist/django-XpzvhI3_.js +0 -1
  117. package/dist/dns-zone-file-BvWpwvpy.js +0 -1
  118. package/dist/docker-8-TsERHq.js +0 -1
  119. package/dist/dot-Bedmh4He.js +0 -1
  120. package/dist/ebnf-CQ1Owm1r.js +0 -1
  121. package/dist/editCarrierDialog-qiULFMcT.js +0 -1
  122. package/dist/editorconfig-D11MkCqN.js +0 -1
  123. package/dist/eiffel-5RW8i1s_.js +0 -1
  124. package/dist/ejs-CnXtml3v.js +0 -1
  125. package/dist/elixir-C65-GKuK.js +0 -1
  126. package/dist/elm-DzDSmMCu.js +0 -1
  127. package/dist/erb-v570YtNg.js +0 -1
  128. package/dist/erlang-COVM6kne.js +0 -1
  129. package/dist/etlua-CYTkdOD8.js +0 -1
  130. package/dist/excel-formula-CVF6JFUc.js +0 -1
  131. package/dist/exportFileGeneration-BryemPIm.js +0 -1
  132. package/dist/exportImageReadiness-BIPaS2Oz.js +0 -1
  133. package/dist/exportImageReadinessNotifier-CDPE8TMc.js +0 -1
  134. package/dist/exportPageHtml-BnFgCZsS.js +0 -5
  135. package/dist/exportPreviewToDocx-CNUCdnzi.js +0 -11
  136. package/dist/exportPreviewToPdf-CVhRJw77.js +0 -1
  137. package/dist/factor-BYWyb9mM.js +0 -1
  138. package/dist/false-PO5fTmEz.js +0 -1
  139. package/dist/firestore-security-rules-Dhmp_MBi.js +0 -1
  140. package/dist/flask-conical-DfeNzqKY.js +0 -7
  141. package/dist/flow-Jw0KAy-j.js +0 -1
  142. package/dist/fortran-DOu6I6CX.js +0 -1
  143. package/dist/fsharp-Bg82wKKC.js +0 -1
  144. package/dist/ftl-B4QashNa.js +0 -1
  145. package/dist/gap-B-C4phMB.js +0 -1
  146. package/dist/gcode-C7cgkMxN.js +0 -1
  147. package/dist/gdscript-BZGfyeaC.js +0 -1
  148. package/dist/gedcom-hWBLXHFN.js +0 -1
  149. package/dist/gherkin-C0cPQhL5.js +0 -1
  150. package/dist/git-CvbRDRuD.js +0 -1
  151. package/dist/glsl-Dio579_l.js +0 -1
  152. package/dist/gml-DMy1gp8J.js +0 -1
  153. package/dist/gn-CXmdkSGX.js +0 -1
  154. package/dist/go-BK7Ey8q8.js +0 -1
  155. package/dist/go-module-DGHMlQxT.js +0 -1
  156. package/dist/graphql-C3tOz3S9.js +0 -1
  157. package/dist/groovy-BWSmsMKq.js +0 -1
  158. package/dist/haml-D761Lwkw.js +0 -1
  159. package/dist/handlebars-CFzuNVeU.js +0 -1
  160. package/dist/haskell-D2HwqYTs.js +0 -1
  161. package/dist/haskell-fKcSYgFk.js +0 -1
  162. package/dist/haxe-BsTBOPWq.js +0 -1
  163. package/dist/hcl-CjEa7mhm.js +0 -1
  164. package/dist/highlighter-Bi2kuv8f.js +0 -7
  165. package/dist/hlsl-B3Bf2Jd1.js +0 -1
  166. package/dist/hoon-DdoFvX8i.js +0 -1
  167. package/dist/hpkp-BPcGR8EQ.js +0 -1
  168. package/dist/hsts-oLeDVYg4.js +0 -1
  169. package/dist/http-C65ao8FS.js +0 -1
  170. package/dist/ichigojam-NdH0fggR.js +0 -1
  171. package/dist/icon-CjpIDepR.js +0 -1
  172. package/dist/icu-message-format-A3pDj87f.js +0 -1
  173. package/dist/idris-CRHPBU_F.js +0 -1
  174. package/dist/iecst-DitcXByQ.js +0 -1
  175. package/dist/ignore-CmXNr-En.js +0 -1
  176. package/dist/image-plus-B3MMgEPL.js +0 -7
  177. package/dist/index-BYll8ylX.js +0 -2
  178. package/dist/index-BtR975tI.js +0 -1
  179. package/dist/index-CVaFIPrZ.js +0 -13
  180. package/dist/index-CkWdb2Ws.js +0 -1
  181. package/dist/index-Ct2s_UPb.js +0 -1
  182. package/dist/index-OBC-S4JF.js +0 -3
  183. package/dist/index-pjV8dzev.js +0 -1
  184. package/dist/index-s1LikHjO.js +0 -1
  185. package/dist/index.client-D86od2fV.js +0 -501
  186. package/dist/inform7-sEqx2-7g.js +0 -1
  187. package/dist/ini-DfvMWacy.js +0 -1
  188. package/dist/io-CfaIzWvO.js +0 -1
  189. package/dist/j-D_qDpCvj.js +0 -1
  190. package/dist/java-CZIvhO6U.js +0 -1
  191. package/dist/java-D5YF95hZ.js +0 -1
  192. package/dist/javadoc-4Rdti3Lf.js +0 -1
  193. package/dist/javadoclike-gz6ZNgII.js +0 -1
  194. package/dist/javadoclike-odLU89VS.js +0 -1
  195. package/dist/javascript-BHdRPnNL.js +0 -1
  196. package/dist/javascript-CEunhhi4.js +0 -1
  197. package/dist/javastacktrace-DTySuujE.js +0 -1
  198. package/dist/jexl-B-55AiTX.js +0 -1
  199. package/dist/jolie-Cerm6rPa.js +0 -1
  200. package/dist/jq-CxYM2bpe.js +0 -1
  201. package/dist/js-extras-B96Xzdzr.js +0 -1
  202. package/dist/js-templates-BJfSNsZD.js +0 -1
  203. package/dist/jsdoc-oC7vbq5i.js +0 -1
  204. package/dist/json-D4kK7Ph_.js +0 -1
  205. package/dist/json-DROiTAr2.js +0 -1
  206. package/dist/json5-DxXL3eT7.js +0 -1
  207. package/dist/jsonp-ar2fV8fZ.js +0 -1
  208. package/dist/jsstacktrace-BINMgU-E.js +0 -1
  209. package/dist/jsx-CqAdGZ8z.js +0 -1
  210. package/dist/jsx-DjXnni8N.js +0 -1
  211. package/dist/julia-DqnOG3a3.js +0 -1
  212. package/dist/keepalived-ByxR9AfG.js +0 -1
  213. package/dist/keyman-B0WzsmDf.js +0 -1
  214. package/dist/kotlin-cdNFHPRk.js +0 -1
  215. package/dist/kumir-dCYrmqEc.js +0 -1
  216. package/dist/kusto-BiAufrSD.js +0 -1
  217. package/dist/latex-Clo76c6g.js +0 -1
  218. package/dist/latte-BClgsIsm.js +0 -1
  219. package/dist/less-D0ZziKfg.js +0 -1
  220. package/dist/lilypond-D-j7r1t-.js +0 -1
  221. package/dist/link-2-off-B6MiQbkR.js +0 -7
  222. package/dist/liquid-B6DAEC2l.js +0 -1
  223. package/dist/lisp-CEcGfDXG.js +0 -1
  224. package/dist/livescript-Tz5wJNbl.js +0 -1
  225. package/dist/llvm-Dv3C4y-V.js +0 -1
  226. package/dist/lock-keyhole-p1wVc-9Y.js +0 -7
  227. package/dist/log-NVPAjhVz.js +0 -1
  228. package/dist/lolcode-De45ux4z.js +0 -1
  229. package/dist/lua-BeIBSVZf.js +0 -1
  230. package/dist/lua-CSN67GiU.js +0 -1
  231. package/dist/lucide-react-Dwxi-V4B.js +0 -7
  232. package/dist/luckyexcel.umd-JVs96sZB.js +0 -12
  233. package/dist/magma-CaUgW-If.js +0 -1
  234. package/dist/makefile-C_Q-8hQ9.js +0 -1
  235. package/dist/markdown-BSGp8L4I.js +0 -1
  236. package/dist/markup-C46YaeBf.js +0 -1
  237. package/dist/markup-D_Wa_fyo.js +0 -1
  238. package/dist/markup-templating-D-FRJF7C.js +0 -1
  239. package/dist/markup-templating-RD0xxf_6.js +0 -1
  240. package/dist/matlab-BaDneZBA.js +0 -1
  241. package/dist/maxscript-fnWefuCx.js +0 -1
  242. package/dist/mel-BfRfAwlY.js +0 -1
  243. package/dist/mermaid-BQn_FD9x.js +0 -1
  244. package/dist/mizar-DEGTGWko.js +0 -1
  245. package/dist/mongodb-BfLZtkrZ.js +0 -1
  246. package/dist/monkey-B64xijTv.js +0 -1
  247. package/dist/moonscript-DB17HjmC.js +0 -1
  248. package/dist/n1ql-hqkhi-L2.js +0 -1
  249. package/dist/n4js-BYUcZZDj.js +0 -1
  250. package/dist/nand2tetris-hdl-Deux5UAx.js +0 -1
  251. package/dist/naniscript-jeJO_Cwe.js +0 -1
  252. package/dist/nasm-DO__GDMC.js +0 -1
  253. package/dist/neon-k-XmqJK1.js +0 -1
  254. package/dist/nevod-CVbTPaTU.js +0 -1
  255. package/dist/nginx-Tr7fUd5Q.js +0 -1
  256. package/dist/nim-DoVTJHY6.js +0 -1
  257. package/dist/nix-D3dcpYSM.js +0 -1
  258. package/dist/nsis-Dg9SRrGb.js +0 -1
  259. package/dist/objectivec-DR-DvLAX.js +0 -1
  260. package/dist/ocaml-F3JoCAcv.js +0 -1
  261. package/dist/opencl-7oQl32PR.js +0 -1
  262. package/dist/openqasm-CKAaKI3L.js +0 -1
  263. package/dist/oz-BRgcnbzh.js +0 -1
  264. package/dist/paintbrush-CTOxtIk9.js +0 -7
  265. package/dist/parigp-bc7o-JYX.js +0 -1
  266. package/dist/parser-Dh9T84aa.js +0 -1
  267. package/dist/pascal-Mc9TrqVN.js +0 -1
  268. package/dist/pascaligo-Bu5Nfubu.js +0 -1
  269. package/dist/pcaxis-CeA8o0Aa.js +0 -1
  270. package/dist/pen-tool-BG-0jVP8.js +0 -7
  271. package/dist/peoplecode-DMMP6xme.js +0 -1
  272. package/dist/perl-pjwABpJK.js +0 -1
  273. package/dist/php-B9N6PoaM.js +0 -1
  274. package/dist/php-D0A5Cwxv.js +0 -1
  275. package/dist/php-extras-WT2OUkhI.js +0 -1
  276. package/dist/phpdoc-BXRRdQyT.js +0 -1
  277. package/dist/plsql-BhY3w0-9.js +0 -1
  278. package/dist/plyr-DCr4Ncz4.js +0 -2
  279. package/dist/powerquery-DF59uGya.js +0 -1
  280. package/dist/powershell-BNMQ_G2y.js +0 -1
  281. package/dist/processing-JexFWMaq.js +0 -1
  282. package/dist/prolog--bkGGaUb.js +0 -1
  283. package/dist/promql-BguTah4b.js +0 -1
  284. package/dist/properties-21I9dpC7.js +0 -1
  285. package/dist/protobuf-C0LuKyr-.js +0 -1
  286. package/dist/psl-_DpEFNrY.js +0 -1
  287. package/dist/pug-C-A1gqPF.js +0 -1
  288. package/dist/puppet-ChOfG5zw.js +0 -1
  289. package/dist/pure-Bix-aADQ.js +0 -1
  290. package/dist/purebasic-DOms9tc7.js +0 -1
  291. package/dist/purescript-L-AGCGHP.js +0 -1
  292. package/dist/python-ChreXwvT.js +0 -1
  293. package/dist/q-w16v1aiR.js +0 -1
  294. package/dist/qml-DiMezLXL.js +0 -1
  295. package/dist/qore-DR2g9gsH.js +0 -1
  296. package/dist/qsharp-C0P6--Sc.js +0 -1
  297. package/dist/quill-C2A8QePO.js +0 -49
  298. package/dist/r-HQDwuLXo.js +0 -1
  299. package/dist/racket-Gz0Tynq_.js +0 -1
  300. package/dist/react-sdk.css +0 -7
  301. package/dist/reason-DBZ2sbZf.js +0 -1
  302. package/dist/regex-lCxC2f-X.js +0 -1
  303. package/dist/rego-CK6sX92A.js +0 -1
  304. package/dist/renpy-DtMBoTkk.js +0 -1
  305. package/dist/rest-DT-jpd1T.js +0 -1
  306. package/dist/rip-BeCJeoFQ.js +0 -1
  307. package/dist/roboconf-DQznEGKV.js +0 -1
  308. package/dist/robotframework-DXfgQqPU.js +0 -1
  309. package/dist/ruby-3lCor9Ik.js +0 -1
  310. package/dist/ruby-DPvt_xbw.js +0 -1
  311. package/dist/runtime-Dn4RiA4k.js +0 -6691
  312. package/dist/rust-BMc_Yoiv.js +0 -1
  313. package/dist/sas-0PXWaOIL.js +0 -1
  314. package/dist/sass-eNYNq8W7.js +0 -1
  315. package/dist/scala-CyhPM_cs.js +0 -1
  316. package/dist/scheme-CdQ15Dry.js +0 -1
  317. package/dist/scheme-DkN0sF0_.js +0 -1
  318. package/dist/scss-Dy6G_PiM.js +0 -1
  319. package/dist/shell-session-1NCwql3m.js +0 -1
  320. package/dist/smali-j9qYXhoq.js +0 -1
  321. package/dist/smalltalk-D8MDc5CV.js +0 -1
  322. package/dist/smarty-Bc1ihKhR.js +0 -1
  323. package/dist/sml-C6hRyyWz.js +0 -1
  324. package/dist/solidity-BQQmiGFI.js +0 -1
  325. package/dist/solution-file-MWLYI-NZ.js +0 -1
  326. package/dist/soy-CXN6tOb4.js +0 -1
  327. package/dist/sparql-C-R8Gias.js +0 -1
  328. package/dist/splunk-spl-B_ygCXaC.js +0 -1
  329. package/dist/sqf-Zq41ozXt.js +0 -1
  330. package/dist/sql-BxmFV8oZ.js +0 -1
  331. package/dist/sql-aYT6xcy6.js +0 -1
  332. package/dist/squirrel-go-JCyyj.js +0 -1
  333. package/dist/stan-DgTU6nBX.js +0 -1
  334. package/dist/stylus-D8xMSxFz.js +0 -1
  335. package/dist/swift-DDKLVbtw.js +0 -1
  336. package/dist/systemd-CVI591rs.js +0 -2
  337. package/dist/t4-cs-D4CxVwOS.js +0 -1
  338. package/dist/t4-templating-BzJ2F4We.js +0 -1
  339. package/dist/t4-templating-DCXEabnB.js +0 -1
  340. package/dist/t4-vb-Bxs17kz4.js +0 -1
  341. package/dist/table-C4pYCXjv.js +0 -7
  342. package/dist/tableToMarkdown-CNmfuY27.js +0 -3
  343. package/dist/tap-qeDv6-X-.js +0 -1
  344. package/dist/tcl-B4LiNtEH.js +0 -1
  345. package/dist/templateSelectorDialog-DkOR3EVS.js +0 -2
  346. package/dist/textile-fSaG4-pZ.js +0 -1
  347. package/dist/toml-Dkmu12eX.js +0 -1
  348. package/dist/tremor-DdjJs31u.js +0 -1
  349. package/dist/tsx-Do1jr-aP.js +0 -1
  350. package/dist/tt2-BlqLFdd5.js +0 -1
  351. package/dist/turtle-BfhtjCXi.js +0 -1
  352. package/dist/turtle-UC3jR8N2.js +0 -1
  353. package/dist/twig-Dfr2sL0m.js +0 -1
  354. package/dist/typescript-fgz3QQiH.js +0 -1
  355. package/dist/typescript-y5LBWDhp.js +0 -1
  356. package/dist/typoscript-DqDEKl5c.js +0 -1
  357. package/dist/unrealscript-e9RCjvlz.js +0 -1
  358. package/dist/uorazor-CoHM_uv6.js +0 -1
  359. package/dist/uri-B4z44HxE.js +0 -1
  360. package/dist/usePromptLibraryMutations-DK7AzgzY.js +0 -1
  361. package/dist/useSupabaseBlobUrl-D9O3nyTh.js +0 -1
  362. package/dist/useTermsNotice-BJqwp7Hj.js +0 -1
  363. package/dist/user-plus-DXpUkE2I.js +0 -7
  364. package/dist/user-round-plus-DE6UUMZ6.js +0 -7
  365. package/dist/v-49Lixibt.js +0 -1
  366. package/dist/vala-BkpQ1izY.js +0 -1
  367. package/dist/vbnet-DUoEkDlO.js +0 -1
  368. package/dist/vbnet-LHlE90my.js +0 -1
  369. package/dist/velocity-c4kJdiwm.js +0 -1
  370. package/dist/verilog-CJyeWxAh.js +0 -1
  371. package/dist/vhdl-LArWr_il.js +0 -1
  372. package/dist/vim-Dv7JUrwn.js +0 -1
  373. package/dist/visual-basic-7MKQqLwe.js +0 -1
  374. package/dist/warpscript-_8Izrgfd.js +0 -1
  375. package/dist/wasm-znUgjSxD.js +0 -1
  376. package/dist/web-idl-jFkNLO1i.js +0 -1
  377. package/dist/wiki-CFXfbO63.js +0 -1
  378. package/dist/wolfram-Ch26p3vt.js +0 -1
  379. package/dist/wren-ChmtUIOJ.js +0 -1
  380. package/dist/xeora-C44TNzQZ.js +0 -1
  381. package/dist/xlsx-uaO0TYvF.js +0 -142
  382. package/dist/xml-doc-CbcCzx5D.js +0 -1
  383. package/dist/xojo-BgNHj7YG.js +0 -1
  384. package/dist/xquery-y_0Tk4Bz.js +0 -1
  385. package/dist/yaml-DbYRgcYc.js +0 -1
  386. package/dist/yaml-GRhlHhYd.js +0 -1
  387. package/dist/yang-BLo0KhOp.js +0 -1
  388. package/dist/zig-DLqaTzcX.js +0 -1
@@ -1 +0,0 @@
1
- import{jsxs as a,jsx as l,Fragment as b}from"react/jsx-runtime";import cl,{useState as c,useRef as Ul,useMemo as A,useCallback as g,useEffect as M}from"react";import{cM as $l,cN as Bl,cO as Vl,cP as dl,cQ as ql,cR as Ql,cS as Kl,cT as se,cU as Wl,bX as y,Z as ol,c3 as zl,c4 as Zl,ca as re,c5 as ce,bG as p,cV as Yl,cW as Hl,cX as Jl,cY as Fe,cZ as et,cc as de,bQ as T,cb as lt,bK as ml,bL as hl,bM as ul,bN as pl,c_ as tt,c$ as at,bO as oe,d0 as xl,d1 as K,d2 as me,aD as it,j as fl,cw as I,d3 as nt,d4 as st}from"./runtime-Dn4RiA4k.js";import{g as rt}from"./exportFileGeneration-BryemPIm.js";const ct=[{value:"PDF",label:"PDF",icon:tt},{value:"DOC",label:"Word Document",icon:at}],dt=[{value:"EXCEL_SINGLE",label:"Single Sheet Excel",icon:xl},{value:"EXCEL_MULTI",label:"Multi Sheet Excel",icon:xl}],vl=(o,w)=>!o||!o.trim()?w!=null&&w.allowEmpty?null:"Please enter an artifact name":o.includes("/")?"Cannot contain forward slashes (/)":o.includes("\\")?"Cannot contain backslashes (\\)":/[<>:"|?*]/.test(o)?'Cannot contain: < > : " | ? *':null,ot=({folder:o,onFolderClick:w,onSelectFolder:he,isLoading:x})=>{var C;const[ue,W]=c(!1);return a("div",{className:"flex items-center gap-3 p-3 hover:bg-neutral08 border-b last:border-b-0 min-h-[56px] cursor-pointer",onMouseEnter:()=>!x&&W(!0),onMouseLeave:()=>W(!1),onClick:()=>w(o),children:[l("div",{className:"flex-shrink-0",children:l(me,{className:"w-5 h-5 text-neutral03"})}),l("div",{className:"flex-1 min-w-0",children:l("div",{className:"text-sm font-medium truncate",children:o.name})}),l("div",{className:"flex items-center gap-2",children:((C=o.folder)==null?void 0:C.acceptsAttachments)!==!1&&l(p,{size:"sm",onClick:v=>{v.stopPropagation(),he(o)},disabled:x,className:fl("h-8 px-2 text-xs transition-opacity duration-200",ue?"opacity-100":"opacity-0"),children:"Select Folder"})})]})},mt=({isOpen:o,onClose:w,originFeature:he,providerType:x,defaultArtifactName:C="",hasTable:ue=!1,fileGenerators:W,providerLabel:v="AMS",artifactContent:pe="",excelOnly:Nl=!1,singleExcelOnly:xe=!1})=>{var Ae;const D=Nl||xe,{isExportBlocked:gl,refuseExport:bl}=$l(),Me=Bl(),{attachToTypes:Te,canListActivities:yl,canListPolicies:wl,clientNameSearch:Cl,isFolderSupported:fe,isFolderRequired:El,isActivityRequiredForExport:E,isActivityScopedToPolicy:h}=Vl(x),kl=Cl==="required",O=Te.includes("Activity")&&yl||E,z=Te.includes("Policy")&&wl||h,Ie=O||z,[N,De]=c(dl(C)),[f,Oe]=c(D?"EXCEL_SINGLE":"PDF"),[i,ve]=c(null),[d,Re]=c(!1),[je,k]=c(!1),[Ne,Z]=c(""),[_e,Y]=c(null),[H,J]=c(1),ge=Ul(null),[Pl,Ge]=c(!1),[u,P]=c([]),[Xe,Ue]=c("Activity"),[r,S]=c(null),[s,R]=c(null),[$e,Be]=c(""),j=ql($e,500),[be,ee]=c(0),[ye,we]=c(0),[_,Ce]=c([]),[G,X]=c([]),[U,le]=c([]),Ee=A(()=>N?vl(N,{allowEmpty:!0}):null,[N]),{clients:$,isLoadingClients:ke,hasMoreClients:te,selectClient:Ve,selectedClient:Pe,currentFolderItems:qe,navigateToFolder:Se,navigateToRoot:Le,isLoadingAttachments:Qe,clearClientSelection:Ke,setSearchText:We,onClientsPageChange:ae,currentClientsPage:B}=Ql({providerType:x,isAmsTab:o,keepClientsEnabled:!0}),Sl=g(()=>{te&&!ke&&ae(B+1)},[te,ke,ae,B]),{activities:V,isLoading:ie,hasMorePages:L}=Kl({providerType:x,clientId:(i==null?void 0:i.id)||"",policyId:h?s==null?void 0:s.id:void 0,offset:be*se.activities,limit:se.activities,enabled:!!i&&O&&(!h||!!s)}),{policies:q,isLoading:ne,hasMorePages:F}=Wl({providerType:x,clientId:(i==null?void 0:i.id)||"",offset:ye*se.policies,limit:se.policies,enabled:!!i&&z}),Q=cl.useRef(null);M(()=>{if(Q.current===null){Q.current=j;return}Q.current!==j&&(Ce([]),We(j),Q.current=j)},[j,We]),M(()=>{B===0&&$.length>0?Ce($):B>0&&$.length>0&&Ce(e=>{const t=new Set(e.map(m=>m.id)),n=$.filter(m=>!t.has(m.id));return n.length===0?e:[...e,...n]})},[$,B]),M(()=>{o&&(De(dl(C)),Oe(D?"EXCEL_SINGLE":"PDF"),ve(null),Be(""),Z(""),Y(null),k(!1),P([]),J(1),ge.current=null,Ge(!1),Ue(O?"Activity":"Policy"),S(null),R(null),ee(0),we(0),X([]),le([]),Ke(),Q.current="",ae(0))},[o,C,Ke,ae,D]),M(()=>{be===0?X(e=>e.length===0&&V.length===0?e:V):V.length>0&&X(e=>{const t=new Set(e.map(m=>m.id)),n=V.filter(m=>!t.has(m.id));return n.length===0?e:[...e,...n]})},[V,be]),M(()=>{ye===0?le(e=>e.length===0&&q.length===0?e:q):q.length>0&&le(e=>{const t=new Set(e.map(m=>m.id)),n=q.filter(m=>!t.has(m.id));return n.length===0?e:[...e,...n]})},[q,ye]),M(()=>{Pe&&ve(Pe)},[Pe]);const Ll=g(e=>{Be(e)},[]),Fl=g(e=>{const t=_.find(n=>n.id===e);t&&(ve(t),Ve(t),S(null),R(null),P([]),Z(""),Y(null),k(!1),ee(0),we(0),X([]),le([]))},[_,Ve]),Al=g(e=>{Ue(e),S(null),R(null)},[]),ze=g(e=>{if(e==="none")S(null);else{const t=G.find(n=>n.id===e);S(t||null)}},[G]),Ze=g(e=>{if(e==="none")R(null);else{const t=U.find(n=>n.id===e);R(t||null)}h&&(S(null),X([]),ee(0))},[U,h]),Ye=g(()=>{L&&!ie&&ee(e=>e+1)},[L,ie]),He=g(()=>{F&&!ne&&we(e=>e+1)},[F,ne]),Ml=A(()=>{const e=_.map(t=>({value:t.id,label:t.name,customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[a("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[l(y,{tooltipContent:t.name,side:"right",children:l("span",{className:"truncate text-sm block",children:t.name})}),l(ol,{tags:t.tags})]}),a("span",{className:"text-xs text-neutral03",children:[t.type," \u2022 ",t.status]})]})}));return i&&!_.some(t=>t.id===i.id)&&e.unshift({value:i.id,label:i.name,customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[a("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[l(y,{tooltipContent:i.name,side:"right",children:l("span",{className:"truncate text-sm block",children:i.name})}),l(ol,{tags:i.tags})]}),a("span",{className:"text-xs text-neutral03",children:[i.type," \u2022 ",i.status]})]})}),e},[_,i]),Je=A(()=>{const e=[];if(E||e.push({value:"none",label:"None"}),G.forEach(t=>{e.push({value:t.id,label:t.name,customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[l(y,{tooltipContent:t.name,side:"right",children:l("span",{className:"truncate text-sm block",children:t.name})}),l(y,{tooltipContent:`Code: ${t.code}`,side:"right",children:a("span",{className:"truncate text-xs text-neutral03 block",children:["Code: ",t.code]})})]})})}),r&&!G.some(t=>t.id===r.id)){const t=E?0:1;e.splice(t,0,{value:r.id,label:r.name,customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[l(y,{tooltipContent:r.name,side:"right",children:l("span",{className:"truncate text-sm block",children:r.name})}),l(y,{tooltipContent:`Code: ${r.code}`,side:"right",children:a("span",{className:"truncate text-xs text-neutral03 block",children:["Code: ",r.code]})})]})})}return e},[G,r,E]),el=A(()=>{const e=[];if(h||e.push({value:"none",label:"None"}),U.forEach(t=>{e.push({value:t.id,label:t.name||"Untitled Policy",customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[l(y,{tooltipContent:t.name||"Untitled Policy",side:"right",children:l("span",{className:"truncate text-sm block",children:t.name||"Untitled Policy"})}),l("div",{className:"flex gap-3 text-xs text-neutral03",children:a("span",{children:["Number: ",t.number]})})]})})}),s&&!U.some(t=>t.id===s.id)){const t=h?0:1;e.splice(t,0,{value:s.id,label:s.name||"Untitled Policy",customRender:a("div",{className:"flex flex-col flex-1 min-w-0",children:[l(y,{tooltipContent:s.name||"Untitled Policy",side:"right",children:l("span",{className:"truncate text-sm block",children:s.name||"Untitled Policy"})}),l("div",{className:"flex gap-3 text-xs text-neutral03",children:a("span",{children:["Number: ",s.number]})})]})})}return e},[U,s,h]),ll=async()=>{if(gl){bl();return}Re(!0);try{let e,t;r?(e=r.id,t="Activity"):s&&(e=s.id,t="Policy");let n="";f==="PDF"?n="pdf":f==="DOC"?n="doc":(f==="EXCEL_SINGLE"||f==="EXCEL_MULTI")&&(n="xlsx");const m=await rt({fileType:f,artifactContent:pe,artifactName:N,pdfBlobGenerator:ge.current,fileGenerators:W});if(!m)throw new Error("Failed to generate file");const rl=`${N.trim()}.${n}`;if((await nt.createAttachment({fileName:rl,fileBlob:m,clientId:i.id,attachToId:e,attachToType:t,folderId:fe?_e:void 0},x,he)).status)Me.invalidateQueries({queryKey:["ams",x,"folder"],refetchType:"none"}),Me.invalidateQueries({queryKey:["ams",x,"attachments"],refetchType:"none"}),I({title:`Exported to ${v}`,description:`${rl} has been uploaded to ${i.name}`,variant:"success"}),w();else throw new Error("Export failed - server returned unsuccessful status")}catch(e){if(st(e))return;console.error("Export to AMS failed:",e),I({title:"Export Failed",description:e instanceof Error?e.message:"An unknown error occurred",variant:"destructive"})}finally{Re(!1)}},tl=()=>{d||(J(1),w())},Tl=()=>{const e=vl(N);if(e){I({title:"Validation Error",description:e,variant:"destructive"});return}if(!i){I({title:"Validation Error",description:"Please select a client",variant:"destructive"});return}if(h&&!s){I({title:"Validation Error",description:"Please select a policy",variant:"destructive"});return}if(E&&!r){I({title:"Validation Error",description:"Please select an activity",variant:"destructive"});return}J(2)},al=()=>{J(1)},Il=e=>{switch(e){case"PDF":return"PDF";case"DOC":return"Word Document";case"EXCEL_SINGLE":return"Single Sheet Excel";case"EXCEL_MULTI":return"Multi Sheet Excel";default:return e}},Dl=g(e=>{ge.current=e,Ge(!0)},[]),il=H===2&&!!pe&&!xe,Ol=e=>{e.type==="folder"&&(Se(e.id,e.name),P(t=>{var n;return[...t,{id:e.id,name:e.name,acceptsAttachments:(n=e.folder)==null?void 0:n.acceptsAttachments}]}))},Rl=e=>{const t=[...u.map(n=>n.name),e.name].join("/");Z(t),Y(e.id),k(!1)},jl=()=>{var e;const t=u.map(m=>m.name).join("/");Z(t);const n=u.length>0?(e=u[u.length-1])==null?void 0:e.id:null;Y(n||null),k(!1)},_l=()=>{if(u.length>0){const e=u.slice(0,-1);if(P(e),e.length===0)Le();else{const t=e[e.length-1];Se(t.id,t.name)}}},Gl=()=>{P([]),Le()},nl=e=>{if(e===-1)Gl();else{const t=u.slice(0,e+1);if(P(t),t.length>0){const n=t[t.length-1];Se(n.id,n.name)}else Le()}},Xl=A(()=>[{name:"Root",id:"",index:-1},...u.map((e,t)=>({...e,index:t}))],[u]),sl=A(()=>qe.filter(e=>e.type==="folder"),[qe]);return l(zl,{open:o,onOpenChange:tl,children:l(Zl,{className:fl("sm:max-w-[650px] transition-all duration-200 w-full",je?"sm:max-w-[650px] w-[70vw] h-[70vh] max-h-[700px] flex flex-col gap-1":"",il?"sm:max-w-[1400px] w-[90vw] h-[90vh] p-0 gap-0 flex flex-col":""),closeOnOutsideClick:!1,children:je?a(b,{children:[a(re,{className:"flex-shrink-0 px-6 pt-6",children:[l(ce,{children:"Select destination folder"}),i&&a("div",{className:"text-sm text-neutral03 mt-1",children:["Client: ",i.name]})]}),l("div",{className:"flex-1 flex flex-col gap-1 p-4 min-h-0",children:a("div",{className:"flex-1 flex flex-col border rounded-lg min-h-0 overflow-hidden",children:[l("div",{className:"flex-shrink-0 flex items-center justify-between p-3 border-b bg-neutral08 min-h-[56px]",children:a("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[u.length>0&&l(p,{variant:"ghost",size:"sm",onClick:_l,className:"h-6 w-6 p-0 flex-shrink-0",children:l(Yl,{className:"w-4 h-4"})}),l("button",{onClick:()=>nl(-1),className:"hover:text-primary text-neutral03 flex-shrink-0 p-1 rounded hover:bg-neutral07",title:v,children:l(Hl,{className:"w-4 h-4"})}),Xl.filter(e=>e.name!=="Root").map((e,t)=>a(cl.Fragment,{children:[l(Jl,{className:"w-4 h-4 text-neutral04 flex-shrink-0"}),l("button",{onClick:()=>nl(e.index),className:"text-sm hover:text-primary truncate",children:e.name})]},e.id||t))]})}),l("div",{className:"flex-1 overflow-y-auto",children:Qe?l("div",{className:"space-y-0",children:Array(5).fill(0).map((e,t)=>a("div",{className:"flex items-center gap-3 p-3 border-b last:border-b-0 min-h-[56px]",children:[l(Fe,{className:"w-5 h-5 rounded-md"}),l(Fe,{className:"flex-1 h-4 rounded-md"}),l(Fe,{className:"w-24 h-8 rounded-md"})]},t))}):sl.length===0?a("div",{className:"flex flex-col items-center justify-center py-8 h-full",children:[l(et,{className:"w-8 h-8 text-neutral03 mb-2"}),l("div",{className:"text-sm text-neutral03",children:"No folders in this location"})]}):l("div",{className:"space-y-0",children:sl.map(e=>l(ot,{folder:e,onFolderClick:Ol,onSelectFolder:Rl,isLoading:Qe},e.id))})})]})}),a(de,{className:"flex-shrink-0 px-6 pb-6 pt-4 border-t border-border-primary",children:[l(p,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),l(p,{onClick:jl,disabled:u.length===0||((Ae=u[u.length-1])==null?void 0:Ae.acceptsAttachments)===!1,children:"Select Folder"})]})]}):H===1?a(b,{children:[l(re,{className:"px-6 pt-6 flex-shrink-0",children:a(ce,{children:["Export to ",v]})}),a("div",{className:"px-6 py-4 flex-1 min-h-0 min-w-0 overflow-hidden",children:[a("div",{className:"grid grid-cols-[1fr_140px] gap-3 pb-4",children:[a("div",{className:"space-y-2",children:[l(T,{htmlFor:"artifact-name",className:"text-sm font-medium text-neutral-700",children:"Artifact name"}),l(lt,{id:"artifact-name",size:"sm",value:N,onChange:e=>De(e.target.value),placeholder:"Enter artifact name",disabled:d,required:!0,className:"h-10",error:!!Ee,errorMessage:Ee||void 0})]}),a("div",{className:"space-y-2",children:[l(T,{htmlFor:"file-type",className:"text-sm font-medium text-neutral-700",children:"Type"}),a(ml,{value:f,onValueChange:e=>Oe(e),children:[l(hl,{id:"file-type",disabled:d,className:"h-10 w-full",children:l(ul,{placeholder:"Select file type"})}),a(pl,{children:[!D&&ct.map(e=>l(oe,{value:e.value,children:a("div",{className:"flex items-center gap-2",children:[l(e.icon,{className:"h-4 w-4 flex-shrink-0"}),l("span",{children:e.label})]})},e.value)),(ue||D)&&dt.filter(e=>!xe||e.value==="EXCEL_SINGLE").map(e=>l(oe,{value:e.value,children:a("div",{className:"flex items-center gap-2",children:[l(e.icon,{className:"h-4 w-4 flex-shrink-0"}),l("span",{children:e.label})]})},e.value))]})]})]})]}),l("div",{className:"border-t border-gray-200 my-2 dark:border-neutral-800"}),a("div",{className:"space-y-2 pb-2 pt-3",children:[l(T,{htmlFor:"client-select",className:"text-sm font-medium text-neutral-700",children:"Attached To"}),l(K,{id:"client-select",options:Ml,value:(i==null?void 0:i.id)||"",onChange:Fl,placeholder:"Select Client",searchPlaceholder:"Search clients...",emptyMessage:kl&&!$e?"Type a client name to search":"No clients found",disabled:d,isLoadingItems:ke,hasMore:te,onLoadMore:te?Sl:void 0,onSearchChange:Ll,showSearch:!0,className:"w-full h-10",popoverProps:{avoidCollisions:!0,sideOffset:4,align:"start",usePortal:!0}})]}),Ie&&h?a("div",{className:"space-y-3 pb-4",children:[a("div",{className:"space-y-2",children:[l(T,{className:"text-sm font-medium text-neutral-700",children:"Policy"}),l(K,{id:"policy-select",options:el,value:(s==null?void 0:s.id)||"",onChange:Ze,placeholder:"Select policy...",searchPlaceholder:"Search policies...",emptyMessage:"No policies found",disabled:d||!i,isLoadingItems:ne,onLoadMore:F?He:void 0,hasMore:F,showSearch:!0,className:"w-full h-10",popoverProps:{avoidCollisions:!0,sideOffset:4,align:"start",usePortal:!0}})]}),a("div",{className:"space-y-2",children:[l(T,{className:"text-sm font-medium text-neutral-700",children:"Activity"}),l(K,{id:"activity-select",options:Je,value:(r==null?void 0:r.id)||"",onChange:ze,placeholder:s?"Select activity...":"Select a policy first",searchPlaceholder:"Search activities...",emptyMessage:"No activities found",disabled:d||!i||!s,isLoadingItems:ie,onLoadMore:L?Ye:void 0,hasMore:L,showSearch:!0,className:"w-full h-10",popoverProps:{avoidCollisions:!0,sideOffset:4,align:"start",usePortal:!0}})]})]}):Ie?a("div",{className:"grid grid-cols-[140px_1fr] gap-3 pb-4",children:[l("div",{className:"space-y-2",children:a(ml,{value:Xe,onValueChange:Al,disabled:d||!i,children:[l(hl,{id:"related-entity",className:"h-10 w-full",children:l(ul,{placeholder:"Select type"})}),a(pl,{children:[O&&l(oe,{value:"Activity",children:"Activity"}),z&&l(oe,{value:"Policy",children:"Policy"})]})]})}),l("div",{className:"space-y-2 min-w-0",children:Xe==="Activity"&&O?l("div",{className:"w-full min-w-0",children:l(K,{id:"activity-select",options:Je,value:(r==null?void 0:r.id)||"none",onChange:ze,placeholder:"Choose...",searchPlaceholder:"Search activities...",emptyMessage:"No activities found",disabled:d||!i,isLoadingItems:ie,onLoadMore:L?Ye:void 0,hasMore:L,showSearch:!0,className:"w-full h-10 max-w-full",popoverProps:{avoidCollisions:!0,sideOffset:4,align:"start",usePortal:!0}})}):z?l("div",{className:"w-full min-w-0",children:l(K,{id:"policy-select",options:el,value:(s==null?void 0:s.id)||"none",onChange:Ze,placeholder:"Choose...",searchPlaceholder:"Search policies...",emptyMessage:"No policies found",disabled:d||!i,isLoadingItems:ne,onLoadMore:F?He:void 0,hasMore:F,showSearch:!0,className:"w-full h-10 max-w-full",popoverProps:{avoidCollisions:!0,sideOffset:4,align:"start",usePortal:!0}})}):null})]}):null,fe&&a(b,{children:[l("div",{className:"border-t border-gray-200 my-2 dark:border-neutral-800"}),a("div",{className:"space-y-2 pt-3",children:[l(T,{htmlFor:"destination-folder",className:"text-sm font-medium text-neutral-700",children:"Destination folder"}),a("div",{className:"flex items-center gap-2",children:[l("div",{className:"flex-1 h-10 px-3 py-2 border border-border-primary rounded-md bg-white flex items-center gap-2 dark:bg-neutral-900",children:Ne?a(b,{children:[l(me,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),l("span",{className:"text-sm truncate",children:Ne})]}):a(b,{children:[l(me,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),l("span",{className:"text-sm text-neutral03",children:v})]})}),l(p,{variant:"outline",onClick:()=>k(!0),disabled:d||!i,className:"h-10",children:"Browse"})]})]})]})]}),a(de,{className:"px-6 pb-6 pt-4 flex-shrink-0 border-t",children:[l(p,{variant:"outline",onClick:tl,disabled:d,children:"Cancel"}),l(p,{onClick:Tl,disabled:d||!!Ee||!i||El&&!_e||h&&!s||E&&!r,children:"Next"})]})]}):H===2?il?a(b,{children:[l(re,{className:"px-6 py-4 border-b border-border-primary flex-shrink-0",children:l(ce,{children:"Export Preview"})}),l(it,{markdownContent:pe,documentName:N,isActive:o&&H===2,isExporting:d,onGeneratePdfBlobReady:f==="PDF"?Dl:void 0}),a(de,{className:"px-6 py-4 border-t border-border-primary flex-shrink-0",children:[l(p,{variant:"outline",onClick:al,disabled:d,children:"Back"}),l(p,{onClick:ll,disabled:f==="PDF"?!Pl:!1,isLoading:d,children:d?"Exporting...":`Export to ${v}`})]})]}):a(b,{children:[l(re,{className:"px-6 pt-6 flex-shrink-0",children:a(ce,{children:["Confirm Export to ",v]})}),l("div",{className:"px-6 py-4 flex-1 min-h-0",children:a("div",{className:"space-y-4",children:[l("p",{className:"text-sm text-neutral03",children:"Please review the export details below:"}),a("div",{className:"border border-border-primary rounded-lg p-4 space-y-3 bg-neutral08",children:[a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"File Name"}),a("span",{className:"text-sm text-right",children:[N,".",f.toLowerCase().replace("excel_single","xlsx").replace("excel_multi","xlsx").replace("doc","doc")]})]}),a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"File Type"}),l("span",{className:"text-sm",children:Il(f)})]}),l("div",{className:"border-t border-border-primary my-2"}),a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"Client"}),l("span",{className:"text-sm text-right max-w-[250px] truncate",children:i==null?void 0:i.name})]}),h&&s&&a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"Policy"}),l("span",{className:"text-sm text-right max-w-[250px] truncate",children:s.name||"N/A"})]}),h&&r&&a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"Activity"}),l("span",{className:"text-sm text-right max-w-[250px] truncate",children:r.name})]}),!h&&(r||s)&&a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:r?"Activity":"Policy"}),l("span",{className:"text-sm text-right max-w-[250px] truncate",children:r?r.name:(s==null?void 0:s.name)||"N/A"})]}),fe&&a(b,{children:[l("div",{className:"border-t border-border-primary my-2"}),a("div",{className:"flex justify-between items-start",children:[l("span",{className:"text-sm font-medium text-neutral03",children:"Destination Folder"}),a("div",{className:"flex items-center gap-2",children:[l(me,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),l("span",{className:"text-sm text-right",children:Ne||v})]})]})]})]})]})}),a(de,{className:"px-6 pb-6 pt-4 flex-shrink-0 border-t",children:[l(p,{variant:"outline",onClick:al,disabled:d,children:"Back"}),l(p,{onClick:ll,isLoading:d,disabled:d,children:"Export"})]})]}):null})})};export{mt as ExportToAmsDialog};
@@ -1 +0,0 @@
1
- import{jsx as e,jsxs as l,Fragment as N}from"react/jsx-runtime";import te,{useState as s,useRef as De,useMemo as $,useCallback as u}from"react";import{cN as Le,cM as Fe,cP as ne,d7 as Se,d8 as Me,c3 as Pe,c4 as Te,ca as M,c5 as P,bG as c,cV as Oe,cW as Ge,cX as _e,cY as B,cZ as je,cc as T,bQ as A,cb as Ie,bK as Xe,bL as $e,bM as Be,bN as Ae,c_ as ze,c$ as Re,bO as se,d0 as ce,d2 as z,d9 as de,aD as Ue,j as oe,da as Ve,cw as R,db as We,dc as qe,d4 as Ke}from"./runtime-Dn4RiA4k.js";import{g as Qe}from"./exportFileGeneration-BryemPIm.js";const Ye=[{value:"PDF",label:"PDF",icon:ze},{value:"DOC",label:"Word Document",icon:Re}],Ze=[{value:"EXCEL_SINGLE",label:"Single Sheet Excel",icon:ce},{value:"EXCEL_MULTI",label:"Multi Sheet Excel",icon:ce}],me=(t,h)=>!t||!t.trim()?h!=null&&h.allowEmpty?null:"Please enter an artifact name":t.includes("/")?"Cannot contain forward slashes (/)":t.includes("\\")?"Cannot contain backslashes (\\)":/[<>:"|?*]/.test(t)?'Cannot contain: < > : " | ? *':null,He=({folder:t,onNavigate:h,onSelect:b,isLoading:w})=>{const[O,f]=s(!1),m=t.itemType!=="site",o=t.itemType==="site"?e(Ve,{className:"w-5 h-5 text-neutral03"}):t.itemType==="drive"?e(de,{className:"w-5 h-5 text-neutral03"}):e(z,{className:"w-5 h-5 text-neutral03"});return l("div",{className:"flex items-center gap-3 p-3 hover:bg-neutral08 border-b last:border-b-0 min-h-[56px] cursor-pointer",onMouseEnter:()=>!w&&f(!0),onMouseLeave:()=>f(!1),onClick:()=>h(t),children:[e("div",{className:"flex-shrink-0",children:o}),e("div",{className:"flex-1 min-w-0",children:e("div",{className:"text-sm font-medium truncate",children:t.name})}),m&&e("div",{className:"flex items-center gap-2",children:e(c,{size:"sm",onClick:C=>{C.stopPropagation(),b(t)},disabled:w,className:oe("h-8 px-2 text-xs transition-opacity duration-200",O?"opacity-100":"opacity-0"),children:"Select Folder"})})]})},Je={google_drive:"Google Drive",onedrive:"OneDrive"},ea=({isOpen:t,onClose:h,defaultArtifactName:b="",hasTable:w=!1,fileGenerators:O,artifactContent:f="",provider:m,singleExcelOnly:o=!1})=>{var C;const g=Je[m]??m,U=m==="onedrive"?"My OneDrive (root)":"My Drive (root)",he=Le(),{isExportBlocked:pe,refuseExport:xe}=Fe(),[d,V]=s(ne(b)),[p,W]=s(o?"EXCEL_SINGLE":"PDF"),[n,q]=s(!1),[G,y]=s(!1),[_,k]=s(""),[K,D]=s(null),[L,F]=s(1),[ue,v]=s(void 0),[i,E]=s([]),j=De(null),[fe,Q]=s(!1),I=$(()=>d?me(d,{allowEmpty:!0}):null,[d]),{data:X,isLoading:Y}=Se({folderId:ue,foldersOnly:!0,enabled:t&&G,provider:m}),Z=$(()=>(X==null?void 0:X.pages.flatMap(a=>a.files).filter(a=>a.mimeType===Me))??[],[X]);te.useEffect(()=>{t&&(V(ne(b)),W(o?"EXCEL_SINGLE":"PDF"),k(""),D(null),y(!1),E([]),v(void 0),F(1),j.current=null,Q(!1))},[t,b,o]);const ve=u(a=>{v(a.id),E(r=>[...r,{id:a.id,name:a.name,itemType:a.itemType}])},[]),Ne=u(a=>{const r=[...i.map(x=>x.name),a.name].join("/");k(r),D(a.id),y(!1)},[i]),be=u(()=>{var a;if(i.length===0)k(""),D(null);else{const r=i.map(x=>x.name).join("/");k(r),D(((a=i[i.length-1])==null?void 0:a.id)??null)}y(!1)},[i]),ge=u(()=>{var a;if(i.length>0){const r=i.slice(0,-1);E(r),v(r.length>0?(a=r[r.length-1])==null?void 0:a.id:void 0)}},[i]),H=u(()=>{E([]),v(void 0)},[]),J=u(a=>{var r;if(a===-1)H();else{const x=i.slice(0,a+1);E(x),v((r=x[x.length-1])==null?void 0:r.id)}},[i,H]),S=m==="onedrive"?"My OneDrive":"My Drive",ye=$(()=>[{name:S,id:"",index:-1},...i.map((a,r)=>({...a,index:r}))],[i,S]),Ee=(i.length>0?(C=i[i.length-1])==null?void 0:C.itemType:void 0)!=="site",we=()=>{const a=me(d);if(a){R({title:"Validation Error",description:a,variant:"destructive"});return}F(2)},ee=()=>F(1),Ce=u(a=>{j.current=a,Q(!0)},[]),ae=a=>{switch(a){case"PDF":return"pdf";case"DOC":return"doc";case"EXCEL_SINGLE":case"EXCEL_MULTI":return"xlsx"}},ke=a=>{switch(a){case"PDF":return"PDF";case"DOC":return"Word Document";case"EXCEL_SINGLE":return"Single Sheet Excel";case"EXCEL_MULTI":return"Multi Sheet Excel"}},le=async()=>{if(pe){xe();return}q(!0);try{const a=await Qe({fileType:p,artifactContent:f,artifactName:d,pdfBlobGenerator:j.current,fileGenerators:O});if(!a)throw new Error("Failed to generate file");const r=`${d.trim()}.${ae(p)}`;await We(a,r,K??void 0,m),he.invalidateQueries({queryKey:[qe]}),R({title:`Exported to ${g}`,description:`${r} has been uploaded successfully`,variant:"success"}),h()}catch(a){if(Ke(a))return;console.error(`Export to ${g} failed:`,a),R({title:"Export Failed",description:a instanceof Error?a.message:"An unknown error occurred",variant:"destructive"})}finally{q(!1)}},re=()=>{n||(F(1),h())},ie=L===2&&!!f&&!o;return e(Pe,{open:t,onOpenChange:re,children:e(Te,{className:oe("sm:max-w-[650px] transition-all duration-200 w-full",G?"sm:max-w-[650px] w-[70vw] h-[70vh] max-h-[700px] flex flex-col gap-1":"",ie?"sm:max-w-[1400px] w-[90vw] h-[90vh] p-0 gap-0 flex flex-col":""),closeOnOutsideClick:!1,children:G?l(N,{children:[e(M,{className:"flex-shrink-0 px-6 pt-6",children:e(P,{children:"Select destination folder"})}),e("div",{className:"flex-1 flex flex-col gap-1 p-4 min-h-0",children:l("div",{className:"flex-1 flex flex-col border rounded-lg min-h-0 overflow-hidden",children:[e("div",{className:"flex-shrink-0 flex items-center justify-between p-3 border-b bg-neutral08 min-h-[56px]",children:l("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[i.length>0&&e(c,{variant:"ghost",size:"sm",onClick:ge,className:"h-6 w-6 p-0 flex-shrink-0",children:e(Oe,{className:"w-4 h-4"})}),e("button",{onClick:()=>J(-1),className:"hover:text-primary text-neutral03 flex-shrink-0 p-1 rounded hover:bg-neutral07",title:S,children:e(Ge,{className:"w-4 h-4"})}),ye.filter(a=>a.name!==S).map((a,r)=>l(te.Fragment,{children:[e(_e,{className:"w-4 h-4 text-neutral04 flex-shrink-0"}),e("button",{onClick:()=>J(a.index),className:"text-sm hover:text-primary truncate",children:a.name})]},a.id||r))]})}),e("div",{className:"flex-1 overflow-y-auto",children:Y?e("div",{className:"space-y-0",children:Array(5).fill(0).map((a,r)=>l("div",{className:"flex items-center gap-3 p-3 border-b last:border-b-0 min-h-[56px]",children:[e(B,{className:"w-5 h-5 rounded-md"}),e(B,{className:"flex-1 h-4 rounded-md"}),e(B,{className:"w-24 h-8 rounded-md"})]},r))}):Z.length===0?l("div",{className:"flex flex-col items-center justify-center py-8 h-full",children:[e(je,{className:"w-8 h-8 text-neutral03 mb-2"}),e("div",{className:"text-sm text-neutral03",children:"No folders in this location"})]}):e("div",{className:"space-y-0",children:Z.map(a=>e(He,{folder:a,onNavigate:ve,onSelect:Ne,isLoading:Y},a.id))})})]})}),l(T,{className:"flex-shrink-0 px-6 pb-6 pt-4 border-t border-border-primary",children:[e(c,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e(c,{onClick:be,disabled:!Ee,children:i.length===0?"Select Root":"Select Folder"})]})]}):L===1?l(N,{children:[e(M,{className:"px-6 pt-6 flex-shrink-0",children:l(P,{children:["Export to ",g]})}),l("div",{className:"px-6 py-4 flex-1 min-h-0 min-w-0 overflow-hidden",children:[l("div",{className:"grid grid-cols-[1fr_140px] gap-3 pb-4",children:[l("div",{className:"space-y-2",children:[e(A,{htmlFor:"drive-artifact-name",className:"text-sm font-medium text-neutral-700",children:"Artifact name"}),e(Ie,{id:"drive-artifact-name",size:"sm",value:d,onChange:a=>V(a.target.value),placeholder:"Enter artifact name",disabled:n,required:!0,className:"h-10",error:!!I,errorMessage:I||void 0})]}),l("div",{className:"space-y-2",children:[e(A,{htmlFor:"drive-file-type",className:"text-sm font-medium text-neutral-700",children:"Type"}),l(Xe,{value:p,onValueChange:a=>W(a),children:[e($e,{id:"drive-file-type",disabled:n,className:"h-10 w-full",children:e(Be,{placeholder:"Select file type"})}),l(Ae,{children:[!o&&Ye.map(a=>e(se,{value:a.value,children:l("div",{className:"flex items-center gap-2",children:[e(a.icon,{className:"h-4 w-4 flex-shrink-0"}),e("span",{children:a.label})]})},a.value)),(w||o)&&Ze.filter(a=>!o||a.value==="EXCEL_SINGLE").map(a=>e(se,{value:a.value,children:l("div",{className:"flex items-center gap-2",children:[e(a.icon,{className:"h-4 w-4 flex-shrink-0"}),e("span",{children:a.label})]})},a.value))]})]})]})]}),e("div",{className:"border-t border-gray-200 my-2"}),l("div",{className:"space-y-2 pt-3",children:[e(A,{htmlFor:"drive-destination-folder",className:"text-sm font-medium text-neutral-700",children:"Destination folder"}),l("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex-1 h-10 px-3 py-2 border border-border-primary rounded-md bg-white flex items-center gap-2",children:_?l(N,{children:[e(z,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),e("span",{className:"text-sm truncate",children:_})]}):l(N,{children:[e(de,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),e("span",{className:"text-sm text-neutral03",children:U})]})}),e(c,{variant:"outline",onClick:()=>{y(!0),v(K??void 0)},disabled:n,className:"h-10",children:"Browse"})]})]})]}),l(T,{className:"px-6 pb-6 pt-4 flex-shrink-0 border-t",children:[e(c,{variant:"outline",onClick:re,disabled:n,children:"Cancel"}),e(c,{onClick:we,disabled:n||!!I||!d.trim(),children:"Next"})]})]}):L===2?ie?l(N,{children:[e(M,{className:"px-6 py-4 border-b border-border-primary flex-shrink-0",children:e(P,{children:"Export Preview"})}),e(Ue,{markdownContent:f,documentName:d,isActive:t&&L===2,isExporting:n,onGeneratePdfBlobReady:p==="PDF"?Ce:void 0}),l(T,{className:"px-6 py-4 border-t border-border-primary flex-shrink-0",children:[e(c,{variant:"outline",onClick:ee,disabled:n,children:"Back"}),e(c,{onClick:le,disabled:p==="PDF"?!fe:!1,isLoading:n,children:n?"Exporting...":`Export to ${g}`})]})]}):l(N,{children:[e(M,{className:"px-6 pt-6 flex-shrink-0",children:l(P,{children:["Confirm Export to ",g]})}),e("div",{className:"px-6 py-4 flex-1 min-h-0",children:l("div",{className:"space-y-4",children:[e("p",{className:"text-sm text-neutral03",children:"Please review the export details below:"}),l("div",{className:"border border-border-primary rounded-lg p-4 space-y-3 bg-neutral08",children:[l("div",{className:"flex justify-between items-start",children:[e("span",{className:"text-sm font-medium text-neutral03",children:"File Name"}),l("span",{className:"text-sm text-right",children:[d,".",ae(p)]})]}),l("div",{className:"flex justify-between items-start",children:[e("span",{className:"text-sm font-medium text-neutral03",children:"File Type"}),e("span",{className:"text-sm",children:ke(p)})]}),e("div",{className:"border-t border-border-primary my-2"}),l("div",{className:"flex justify-between items-start",children:[e("span",{className:"text-sm font-medium text-neutral03",children:"Destination Folder"}),l("div",{className:"flex items-center gap-2",children:[e(z,{className:"w-4 h-4 text-neutral03 flex-shrink-0"}),e("span",{className:"text-sm text-right",children:_||U})]})]})]})]})}),l(T,{className:"px-6 pb-6 pt-4 flex-shrink-0 border-t",children:[e(c,{variant:"outline",onClick:ee,disabled:n,children:"Back"}),e(c,{onClick:le,isLoading:n,disabled:n,children:"Export"})]})]}):null})})};export{ea as ExportToDriveDialog};
@@ -1,30 +0,0 @@
1
- import{jsx as n,jsxs as h,Fragment as je}from"react/jsx-runtime";import{useState as x,useEffect as q,useRef as de}from"react";import{bB as De,bC as Me,bD as ze,bE as Be,s as We,L as Oe,bF as Z,j as ce,bG as R,bH as me,bI as ue,bJ as M,bK as Je,bL as Ve,bM as _e,bN as qe,bO as Ze,aZ as Ye,bP as Ke,bQ as Qe,bR as Xe,bS as et,bT as tt,bU as nt,bV as it,bW as at,bX as ot,bY as rt,bZ as st,b_ as pe,b$ as lt,c0 as dt,c1 as ct,c2 as mt}from"./runtime-Dn4RiA4k.js";import"react-dom";import"react-dom/client";import{E as ut,P as pt,C as ht}from"./pen-tool-BG-0jVP8.js";import{H as ft}from"./highlighter-Bi2kuv8f.js";import{g as gt}from"./index-CVaFIPrZ.js";const bt=()=>{const i=navigator.userAgent;let l="Unknown",s="Unknown";if(i.includes("Chrome")&&!i.includes("Edg")){l="Chrome";const t=i.match(/Chrome\/([0-9.]+)/);s=(t==null?void 0:t[1])??"Unknown"}else if(i.includes("Firefox")){l="Firefox";const t=i.match(/Firefox\/([0-9.]+)/);s=(t==null?void 0:t[1])??"Unknown"}else if(i.includes("Safari")&&!i.includes("Chrome")){l="Safari";const t=i.match(/Version\/([0-9.]+)/);s=(t==null?void 0:t[1])??"Unknown"}else if(i.includes("Edg")){l="Edge";const t=i.match(/Edg\/([0-9.]+)/);s=(t==null?void 0:t[1])??"Unknown"}return{name:l,version:s,userAgent:i,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled,onLine:navigator.onLine}},wt=()=>{const i=/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),l=/iPad|Android(?=.*Mobile)/i.test(navigator.userAgent);return{screenResolution:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,isMobile:i,isTablet:l,touchSupported:"ontouchstart"in window||navigator.maxTouchPoints>0}},vt=()=>{const i=new Date,l=Intl.DateTimeFormat().resolvedOptions().timeZone;let s;if(window.performance&&window.performance.getEntriesByType){const t=window.performance.getEntriesByType("navigation");if(t.length>0){const r=t[0];r&&r.loadEventEnd&&(s=Math.round(r.loadEventEnd))}}return{url:window.location.href,title:document.title,referrer:document.referrer,timestamp:i.toISOString(),timezone:l,loadTime:s}},yt=()=>{const i={},l=window.performance;if("memory"in window.performance&&l.memory){const t=l.memory,r=Math.round(t.usedJSHeapSize/(1024*1024)),f=Math.round(t.totalJSHeapSize/(1024*1024)),k=Math.round(t.jsHeapSizeLimit/(1024*1024));r>=0&&f>=0&&k>0&&(i.memoryUsage=r,i.totalJSHeapSize=f,i.jsHeapSizeLimit=k)}if("connection"in navigator){const t=navigator.connection;i.connectionType=(t==null?void 0:t.type)||"unknown",i.effectiveType=(t==null?void 0:t.effectiveType)||"unknown",i.downlink=t==null?void 0:t.downlink,i.rtt=t==null?void 0:t.rtt,i.saveData=t==null?void 0:t.saveData}const s={};if(window.performance&&window.performance.getEntriesByType){const t=window.performance.getEntriesByType("navigation");if(t.length>0){const r=t[0];r&&r.domContentLoadedEventEnd&&(s.domContentLoaded=Math.round(r.domContentLoadedEventEnd)),r&&r.loadEventEnd&&(s.loadComplete=Math.round(r.loadEventEnd))}window.performance.getEntriesByType("paint").forEach(r=>{r.name==="first-paint"?s.firstPaint=Math.round(r.startTime):r.name==="first-contentful-paint"&&(s.firstContentfulPaint=Math.round(r.startTime))})}if(Object.keys(s).length>0&&(i.navigationTiming=s),window.performance&&window.performance.getEntriesByType){const t=window.performance.getEntriesByType("resource");if(t.length>0){const r=t.reduce((f,k)=>f+(k.transferSize||0),0);i.resourceTiming={totalResources:t.length,totalTransferSize:Math.round(r/1024)}}}return i},xt=()=>({browser:bt(),device:wt(),page:vt(),performance:yt()}),kt=i=>new Promise((l,s)=>{const t=new FileReader;t.onload=()=>{typeof t.result=="string"?l(t.result):s(new Error("Failed to read file as data URL"))},t.onerror=()=>s(t.error??new Error("Failed to read file")),t.readAsDataURL(i)}),Et=i=>{var l,s;const t=i.split(","),r=((s=(l=t[0])==null?void 0:l.match(/:(.*?);/))==null?void 0:s[1])||"image/png",f=atob(t[1]||"");let k=f.length;const v=new Uint8Array(k);for(;k--;)v[k]=f.charCodeAt(k);return new Blob([v],{type:r})},w={PEN:"pen",HIGHLIGHTER:"highlighter"},Nt="Tell us what happened or what you'd like to see",he=[{value:"bug",label:"Something's broken",icon:n(rt,{className:"w-4 h-4 text-error"}),description:"Something isn't working as expected.",descriptionPlaceholder:"What happened, and what did you expect instead?"},{value:"enhancement",label:"I have an idea",icon:n(st,{className:"w-4 h-4 text-warning"}),description:"An idea to improve what already works.",descriptionPlaceholder:"What would you like to be able to do?"},{value:"other",label:"Something else",icon:n(ht,{className:"w-4 h-4 text-primary-text"}),description:"A question or anything else.",descriptionPlaceholder:"What's on your mind?"}],Ct=i=>{if(typeof i=="string")return i;if(!i||typeof i!="object")return;const{detail:l,error:s}=i;if(typeof l=="string")return l;if(l&&typeof l=="object"){const{message:t,error:r}=l;if(typeof t=="string")return t;if(typeof r=="string")return r}return typeof s=="string"?s:void 0},It=({onClose:i,initialScreenshot:l})=>{var s,t,r;const[f,k]=x(""),[v,Y]=x(""),[F,K]=x(l||null),[L,z]=x([]),[B,fe]=x(w.PEN),[Q,X]=x(!1),[C,$]=x(null),[N,ee]=x(!1),[G,ge]=x(!0),[te,be]=x("p0"),[P,ne]=x([]),[W,O]=x(!1),[we,ve]=x(null),{toast:J}=De(),{user:a}=Me(),{currentPlan:A,commitSha:S}=ze(),{clientInstanceId:ie}=Be(),j=We.getItem(Oe.CONNECTED_TENANT_ID,!0,"");q(()=>{be(v==="bug"?"p0":"p1")},[v]);const ae=de(null),D=de(null);q(()=>{try{const e=xt();ve(e)}catch(e){console.warn("Failed to capture system info:",e)}},[]),q(()=>{const e=o=>{var d;const y=(d=o.clipboardData)==null?void 0:d.items;if(y)for(let c=0;c<y.length;c++){const p=y[c];if(p&&p.type.startsWith("image/")){const u=p.getAsFile();if(!u)continue;const g=new FileReader;g.onload=()=>{typeof g.result=="string"&&K(g.result)},g.readAsDataURL(u),o.preventDefault();return}}};return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[]);const ye=e=>{const o=e.target.getStage().getPointerPosition(),d={tool:B,points:[o.x,o.y]};$(d),X(!0)},xe=e=>{if(!Q||!C)return;const o=e.target.getStage().getPointerPosition(),d=C;$({...d,points:[...d.points,o.x,o.y]})},ke=()=>{!Q||!C||(z([...L,C]),$(null),X(!1))},Ee=()=>{z([]),$(null)},oe=async(e,o=!1)=>{var d,y;try{const c=await lt([e],"public/feedback");if(c.statusCode!==200)throw new Error(`Failed to upload ${o?"screenshot":"file"}`);if((d=c.data)!=null&&d.url){const p=c.data.url,u=p.replace("supabase://file-uploads/",""),g=3600*24*180,H=await dt({path:u,expiration:g});if(H.statusCode===200&&(y=H.data)!=null&&y.signedUrl)return{success:!0,name:e.name,rawUrl:p,signedUrl:H.data.signedUrl};throw new Error(`Failed to get signed URL for ${o?"screenshot":e.name}`)}else throw new Error(`No URL returned from upload for ${o?"screenshot":e.name}`)}catch{if(o)try{const c=await kt(e);return{success:!1,name:e.name,dataUrl:c}}catch{return{success:!1,name:e.name}}return{success:!1,name:e.name}}},Ne=async(e,o,d,y=[])=>{var c;let p;try{const g=gt();g&&(await Promise.race([g.flush(),new Promise(H=>setTimeout(H,2e3))]),p=g.getReplayId())}catch{}const u=await ct(`${mt}/feedback/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e,body:o,feedbackType:v,priority:te,reporterEmail:(a==null?void 0:a.isImpersonating)&&(a==null?void 0:a.impersonatedBy)||(a==null?void 0:a.email)||"unknown",reporterName:(a==null?void 0:a.name)||"unknown",reporterRole:(a==null?void 0:a.role)||"unknown",clientInstanceId:ie||"unknown",tenantId:j||"unknown",isCustomerIssue:!((c=a==null?void 0:a.email)!=null&&c.includes("outmarket.ai")),feedbackText:f,screenshotUrl:d,additionalFiles:y,isConsentGiven:G,planLabel:(A==null?void 0:A.planLabel)||"unknown",systemInfo:we,sentryReplayId:p,commitSha:S&&S!=="unknown"?S:void 0,latestCommitSha:S&&S!=="unknown"?S:void 0})});if(!u.ok){const g=await u.json().catch(()=>null);throw new Error(Ct(g)||"Failed to submit feedback")}return await u.json()},Ce=async()=>{var e;if(!(!f.trim()||!v)){J({title:"Submitting feedback...",description:"Your feedback is being processed",variant:"default"}),V();try{ee(!0),O(!0);const o=[];let d=null;if(F){const m=ae.current;if(m)try{const b=document.createElement("canvas"),I=D.current;if(I){b.width=I.naturalWidth||I.width,b.height=I.naturalHeight||I.height;const E=b.getContext("2d");if(E){E.drawImage(I,0,0,b.width,b.height);const Le=m.width(),Pe=m.height(),_=b.width/Le,Ue=b.height/Pe;L.forEach(Ae=>{const T=Ae;if(E.beginPath(),E.strokeStyle=T.tool===w.HIGHLIGHTER?"#FFFF00":"#FF0000",E.lineWidth=T.tool===w.HIGHLIGHTER?15*_:2*_,E.globalAlpha=T.tool===w.HIGHLIGHTER?.3:1,E.lineCap="round",E.lineJoin="round",T&&Array.isArray(T.points)&&T.points.length>0)for(let U=0;U<T.points.length;U+=2){const se=(T.points[U]??0)*_,le=(T.points[U+1]??0)*Ue;U===0?E.moveTo(se,le):E.lineTo(se,le)}E.stroke()}),E.globalAlpha=1;const Re=b.toDataURL("image/png"),$e=Et(Re),Ge=new File([$e],"feedback-screenshot.png",{type:"image/png"});d=oe(Ge,!0),o.push(d)}}}catch(b){pe({error:b,extra:{context:"screenshot_preparation",feedbackText:f,feedbackType:v,reporterEmail:(a==null?void 0:a.email)||"unknown",hasAnnotations:L.length>0,annotationsCount:L.length},detailedErrorMessage:"Failed to prepare screenshot with annotations for feedback submission"})}}const y=[];if(P.length>0)for(const m of P){if(!m)continue;const b=oe(m).then(I=>(y.push(I),I));o.push(b)}await Promise.all(o);const c=d?await d:null;O(!1);let p=`[${v.toUpperCase()}] ${f.split(`
2
- `)[0]}`;p.length>100&&(p=p.slice(0,97)+"..."),a!=null&&a.email.includes("outmarket.ai")||(p=`[Customer Issue] ${p}`,p.length>100&&(p=p.slice(0,97)+"..."));let u=`## Description
3
- ${f}
4
-
5
- `;if(a){const m=!!(a.isImpersonating&&a.impersonatedBy),b=m?a.impersonatedBy:a.email;u+=`## Reporter
6
- - Name: ${a.name||"Not provided"}
7
- - Email: ${b||"Not provided"}
8
- - Role: ${a.role||"Not provided"}
9
- - Plan: ${(A==null?void 0:A.planLabel)||"Not provided"}
10
- - Client Instance ID: ${ie||"Not provided"}
11
- - Tenant ID: ${j||"Not provided"}
12
- ${j?`- [View tenant](https://supabase.com/dashboard/project/${j})
13
- `:""}`,m&&(u+=`- Impersonating: ${a.email||"Not provided"}
14
- `),u+=`
15
- `}u+=`## Consent
16
- - Data access consent: ${G?"Given":"Not given"}
17
-
18
- `,c&&(u+=`## Screenshot
19
-
20
- `,c.success&&c.signedUrl?u+=`![Screenshot](${c.signedUrl})
21
-
22
- `:c.dataUrl&&(u+=`![Screenshot](${c.dataUrl})
23
-
24
- `));const g=y.filter(m=>m.success&&m.signedUrl);g.length>0&&(u+=`## Additional Files
25
-
26
- `,g.forEach(m=>{m.name.match(/\.(jpg|jpeg|png|gif|webp)$/i)?u+=`![${m.name}](${m.signedUrl})
27
-
28
- `:u+=`[${m.name}](${m.signedUrl})
29
-
30
- `}));const H=c!=null&&c.success?c.signedUrl:void 0,Fe=g.map(m=>m.signedUrl).filter(m=>!!m);await Ne(p,u,H,Fe),J({title:"Success",description:"Feedback submitted successfully",variant:"success"})}catch(o){pe({error:o,extra:{context:"feedback_submission",feedbackText:f,feedbackType:v,reporterEmail:(a==null?void 0:a.email)||"unknown",reporterName:(a==null?void 0:a.name)||"unknown",priority:te,hasScreenshot:!!F,additionalFilesCount:P.length,isConsentGiven:G,isCustomerIssue:!((e=a==null?void 0:a.email)!=null&&e.includes("outmarket.ai"))},detailedErrorMessage:"Failed to submit feedback - main submission process error"}),J({title:"Error",description:"There was an error submitting your feedback. Please try again.",variant:"destructive"})}finally{ee(!1),O(!1)}}},V=()=>{K(null),z([]),k(""),Y(""),i()},re=e=>{fe(e)},Ie=e=>{Y(e)},Te=((s=he.find(e=>e.value===v))==null?void 0:s.descriptionPlaceholder)??Nt,He=e=>{if(!e.target.files||e.target.files.length===0)return;const o=Array.from(e.target.files);ne(d=>[...d,...o]),e.target.value=""},Se=e=>{ne(o=>o.filter((d,y)=>y!==e))};return n("div",{id:"feedback-container",className:"fixed inset-0 z-[70] bg-black/30 flex items-center justify-center",children:h("div",{className:"bg-background border border-border-primary rounded-lg shadow-lg w-[92%] max-w-[1200px] max-h-[85vh] flex flex-col",children:[h("div",{className:"p-4 border-b border-border-primary flex justify-between items-center gap-4",children:[n("h2",{className:"text-lg font-semibold leading-none tracking-tight",children:"Send Feedback"}),h("div",{className:"flex items-center gap-2",children:[n(Z,{size:"sm",variant:"ghost",onClick:Ee,className:"transition-all !duration-100",icon:n(ut,{className:"w-4 h-4"}),tooltip:"Erase All Annotations"}),n(Z,{size:"sm",variant:"outline",onClick:()=>re(w.PEN),className:ce("transition-all !duration-100",B===w.PEN&&"text-primary border-primary"),icon:n(pt,{className:"w-4 h-4"}),tooltip:"Pen"}),n(Z,{variant:"outline",size:"sm",onClick:()=>re(w.HIGHLIGHTER),className:ce("transition-all !duration-100",B===w.HIGHLIGHTER&&"text-primary border-primary"),icon:n(ft,{className:"w-4 h-4"}),tooltip:"Highlighter"}),n(R,{variant:"ghost",size:"icon",onClick:V,disabled:N,"aria-label":"Close","data-testid":"close-feedback-button",className:"ml-2",children:n(me,{className:"w-4 h-4"})})]})]}),h("div",{className:"flex-1 min-h-0 p-4 flex flex-col md:flex-row gap-4",children:[h("div",{className:"flex-1 min-h-0 min-w-0 overflow-hidden border border-border-primary rounded relative",children:[!F&&h("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-secondary-text px-4 text-center",children:["No screenshot captured. Take one with ",ue()?"Cmd-Shift-Ctrl-4":"Win-Shift-S"," and paste it here (",ue()?"Cmd":"Ctrl","+V)."]}),F&&h(je,{children:[n("img",{src:F,alt:"Screenshot",className:"w-full h-full object-contain block",ref:D}),n("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:n(M.Stage,{ref:ae,width:((t=D.current)==null?void 0:t.clientWidth)||window.innerWidth*.7,height:((r=D.current)==null?void 0:r.clientHeight)||window.innerHeight*.6,onMouseDown:ye,onMouseMove:xe,onMouseUp:ke,className:"pointer-events-auto",children:h(M.Layer,{children:[L.map((e,o)=>{const d=e;return n(M.Line,{points:d.points,stroke:d.tool===w.HIGHLIGHTER?"#FFFF00":"#FF0000",strokeWidth:d.tool===w.HIGHLIGHTER?15:2,opacity:d.tool===w.HIGHLIGHTER?.3:1,tension:.5,lineCap:"round",lineJoin:"round"},o)}),C&&n(M.Line,{points:C.points,stroke:C.tool===w.HIGHLIGHTER?"#FFFF00":"#FF0000",strokeWidth:C.tool===w.HIGHLIGHTER?15:2,opacity:C.tool===w.HIGHLIGHTER?.3:1,tension:.5,lineCap:"round",lineJoin:"round"})]})})})]})]}),h("div",{className:"w-full md:w-[350px] md:min-w-[350px] min-h-0 overflow-y-auto flex flex-col gap-4 px-px",children:[n("div",{children:h(Je,{value:v,onValueChange:Ie,disabled:N,children:[n(Ve,{id:"feedback-type","data-testid":"feedback-type",label:"Feedback Type","aria-label":"Feedback Type",required:!0,placeholder:"Select a feedback type...",children:n(_e,{placeholder:"Select a feedback type..."})}),n(qe,{className:"w-[var(--radix-select-trigger-width)] [&_[data-radix-select-viewport]]:min-w-0",style:{zIndex:80},children:he.map(e=>n(Ze,{value:e.value,leftComponent:e.icon,subtext:e.description,children:e.label},e.value))})]})}),n("div",{children:n(Ye,{value:f,onChange:e=>k(e.target.value),placeholder:Te,rows:7,label:"Description",expandable:!1,disabled:N,required:!0})}),n(Ke,{size:"sm",checked:G,onChange:e=>ge(e),disabled:N,label:"Share diagnostic logs with Outmarket support","data-testid":"feedback-consent"}),h("div",{children:[h("div",{className:"flex items-center gap-1 text-sm font-medium text-primary-text mb-2",children:[n(Qe,{children:"Additional Files"}),n(Xe,{children:h(et,{delayDuration:0,children:[n(tt,{asChild:!0,children:h("span",{tabIndex:0,className:"inline-flex cursor-help text-muted-foreground",children:[n(nt,{className:"h-4 w-4","aria-hidden":"true"}),n("span",{className:"sr-only",children:"About additional files"})]})}),n(it,{children:n("p",{children:"Upload additional images or videos to help explain the issue"})})]})})]}),h("div",{className:"flex flex-col gap-2",children:[h("div",{className:"flex items-center gap-2",children:[n(R,{variant:"outline",size:"sm",onClick:()=>{var e;return(e=document.getElementById("additional-files"))==null?void 0:e.click()},leftIcon:n(at,{className:"w-4 h-4"}),disabled:N||W,children:"Upload Images/Videos"}),n("input",{type:"file",id:"additional-files",className:"hidden",accept:"image/*,video/*,.pdf,application/pdf,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",multiple:!0,onChange:He,disabled:N||W})]}),P.length>0&&n("div",{className:"max-h-40 overflow-y-auto border border-border-primary rounded-md p-2",children:P.map((e,o)=>h("div",{className:"flex items-center justify-between py-1 px-2 text-sm border-b border-border-primary last:border-b-0",children:[n(ot,{tooltipContent:e.name,children:n("div",{className:"truncate max-w-[250px]",children:e.name})}),n(R,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-error",onClick:()=>Se(o),disabled:N||W,children:n(me,{className:"h-4 w-4"})})]},o))})]})]})]})]}),h("div",{className:"p-4 border-t border-border-primary flex justify-end gap-2",children:[n(R,{variant:"outline",onClick:V,disabled:N,children:"Cancel"}),n(R,{onClick:Ce,disabled:!f.trim()||!v||N,isLoading:N,children:"Submit Feedback"})]})]})})};export{It as default};
@@ -1 +0,0 @@
1
- import{jsx as t,jsxs as a}from"react/jsx-runtime";import{c3 as m,c4 as u,ca as o,c5 as x}from"./runtime-Dn4RiA4k.js";function l(e){return`$${e.toLocaleString()}`}function g({layer:e,onClose:s}){if(!e)return null;const c=e.coverageType==="excess-follow-form"?"Excess Follow-Form":e.coverageType;return t(m,{open:!!e,onOpenChange:r=>{r||s()},children:a(u,{style:{width:768,maxHeight:"85vh",display:"flex",flexDirection:"column"},children:[a(o,{children:[t(x,{className:"text-base",children:e.carrier}),t("p",{className:"text-sm text-gray-500 mt-0.5 dark:text-neutral-400",children:e.layerName})]}),a("div",{className:"space-y-5 px-5 pb-5 overflow-y-auto",children:[a("div",{className:"grid grid-cols-2 gap-4",children:[t(i,{label:"Attachment Point",value:l(e.attachmentPoint)}),t(i,{label:"Limit",value:l(e.limit),highlight:!0}),e.aggregateLimit!=null&&t(i,{label:"Aggregate Limit",value:l(e.aggregateLimit)}),e.premium!=null&&t(i,{label:"Premium",value:l(e.premium)}),e.deductible!=null&&t(i,{label:"Deductible",value:l(e.deductible)}),e.selfInsuredRetention!=null&&t(i,{label:"Self-Insured Retention",value:l(e.selfInsuredRetention)})]}),a("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Coverage Type"}),t("p",{className:"font-medium text-gray-800 capitalize dark:text-neutral-200",children:c})]}),e.policyNumber&&a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Policy Number"}),t("p",{className:"font-medium text-gray-800 dark:text-neutral-200",children:e.policyNumber})]}),e.effectiveDate&&a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Effective Date"}),t("p",{className:"font-medium text-gray-800 dark:text-neutral-200",children:e.effectiveDate})]}),e.expirationDate&&a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Expiration Date"}),t("p",{className:"font-medium text-gray-800 dark:text-neutral-200",children:e.expirationDate})]}),e.followForm!=null&&a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Follow Form"}),t("p",{className:"font-medium text-gray-800 dark:text-neutral-200",children:e.followForm?"Yes":"No"})]}),e.valuationClause&&a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Valuation Clause"}),t("p",{className:"font-medium text-gray-800 capitalize dark:text-neutral-200",children:e.valuationClause.replace(/_/g," ")})]}),a("div",{children:[t("span",{className:"text-gray-500 text-xs dark:text-neutral-400",children:"Source Document"}),t("p",{className:"font-medium text-gray-800 truncate dark:text-neutral-200",title:e.sourceDocument,children:e.sourceDocument})]})]}),Array.isArray(e.coinsurance)&&e.coinsurance.length>0&&t(d,{title:"Coinsurance Participants",children:t("div",{className:"space-y-1.5",children:e.coinsurance.map((r,n)=>a("div",{className:"flex items-center justify-between text-sm bg-blue-50 rounded-md px-3 py-2 dark:bg-blue-950/40",children:[t("span",{className:"text-gray-800 font-medium dark:text-neutral-100",children:r.carrier}),a("div",{className:"flex items-center gap-3",children:[r.participationPercentage!=null&&a("span",{className:"text-blue-700 font-semibold dark:text-blue-300",children:[r.participationPercentage,"%"]}),r.participationAmount!=null&&t("span",{className:"text-gray-600 dark:text-neutral-300",children:l(r.participationAmount)})]})]},n))})}),e.sublimits&&e.sublimits.length>0&&t(d,{title:"Sublimits",children:t("div",{className:"grid grid-cols-2 gap-1.5",children:e.sublimits.map((r,n)=>a("div",{className:"flex justify-between text-sm bg-gray-50 rounded-md px-3 py-1.5 dark:bg-neutral-900",children:[t("span",{className:"text-gray-600 dark:text-neutral-400",children:r.name}),t("span",{className:"font-medium text-gray-800 dark:text-neutral-200",children:l(r.limit)})]},n))})}),e.exclusions&&e.exclusions.length>0&&t(d,{title:"Exclusions",children:t("div",{className:"flex flex-wrap gap-1.5",children:e.exclusions.map((r,n)=>t("span",{className:"text-xs bg-red-50 text-red-700 border border-red-200 px-2.5 py-1 rounded-md dark:bg-red-950/40 dark:text-red-300 dark:border-red-900",children:r},n))})}),e.endorsements&&e.endorsements.length>0&&t(d,{title:"Endorsements",children:t("div",{className:"flex flex-wrap gap-1.5",children:e.endorsements.map((r,n)=>t("span",{className:"text-xs bg-green-50 text-green-700 border border-green-200 px-2.5 py-1 rounded-md dark:bg-green-950/40 dark:text-green-300 dark:border-green-900",children:r},n))})})]})]})})}function i({label:e,value:s,highlight:c}){return a("div",{className:"bg-gray-50 rounded-lg px-3 py-2 dark:bg-neutral-900",children:[t("span",{className:"text-xs text-gray-500 dark:text-neutral-400",children:e}),t("p",{className:c?"text-lg font-bold text-gray-900 dark:text-neutral-100":"text-base font-semibold text-gray-800 dark:text-neutral-200",children:s})]})}function d({title:e,children:s}){return a("div",{children:[t("h4",{className:"text-xs font-medium text-gray-500 uppercase tracking-wide mb-2 dark:text-neutral-400",children:e}),s]})}export{g as LayerDetailModal};
@@ -1 +0,0 @@
1
- import{jsxs as N,Fragment as $e,jsx as a}from"react/jsx-runtime";import*as Be from"react";import{useState as U,useMemo as Le,useCallback as D,memo as ge,forwardRef as _e,useEffect as Pt,useRef as fe,useImperativeHandle as St}from"react";import{bB as Ie,eV as Ut,iT as Ge,ch as Mt,cN as Et,iU as ne,D as Ae,iV as Qe,iW as Ht,iX as Wt,iY as zt,iZ as qt,i_ as Bt,i$ as _t,j0 as Gt,l as Qt,m as Kt,bD as Vt,bC as Jt,ed as Ke,df as Yt,cL as Ve,j1 as Zt,j2 as Xt,aA as Je,aM as Ye,bF as Ze,fJ as ea,eF as De,eE as Xe,dB as ta,j3 as et,j4 as ye,j5 as tt,dr as aa,dG as at,cb as na,bG as oe,eH as ra,c3 as nt,c4 as rt,ca as st,cc as sa,cz as ia,cY as la,cZ as oa,bW as it,dx as Oe,j6 as da,cX as ca,j7 as lt,j8 as ua,c5 as ma,ea as pa,eb as ha,ec as ot,hn as dt,j9 as ga,ja as fa,jb as ct,he as ut}from"./runtime-Dn4RiA4k.js";import"./index-pjV8dzev.js";import"react-dom";import"react-dom/client";import{I as ya}from"./image-plus-B3MMgEPL.js";const ke=1e3,mt=25,pt=({folderPath:e="public/document_builder",recursive:n=!0,searchQuery:s="",resultLimit:r,resultOffset:i,sortBy:l="alphabetical",excludeFolders:d=!1,pVersionType:v="thumbnail",enabled:x=!0}={})=>{var F,I;const{toast:j}=Ie(),R=Ut({queryKey:["documentAssets",e,n,s,l,d,v,r??"all",r!==void 0?i??0:0],queryFn:async()=>{var M,O;try{if(r!==void 0){const W=await Ge({folderPath:e,recursive:n,searchQuery:s,resultLimit:r,resultOffset:i,sortBy:l,excludeFolders:d,pVersionType:v});if(W.statusCode!==200)throw new Error("Failed to fetch document assets");return W.data||{data:[],metadata:{query:s,limit:r,offset:i??0,totalCount:0}}}const P=[];let E=0,H=s,q=0,X=!0;for(let W=0;W<mt;W+=1){const G=await Ge({folderPath:e,recursive:n,searchQuery:s,resultLimit:ke,resultOffset:q,sortBy:l,excludeFolders:d,pVersionType:v});if(G.statusCode!==200)throw new Error("Failed to fetch document assets");const T=G.data,B=(T==null?void 0:T.data)??[];P.push(...B);const J=((M=T==null?void 0:T.metadata)==null?void 0:M.totalCount)??0;if(J>0&&(E=J),H=((O=T==null?void 0:T.metadata)==null?void 0:O.query)??s,B.length<ke||E>0&&P.length>=E){X=!1;break}q+=ke}return X&&console.warn(`[useDocumentAssetsList] Hit the ${mt}-page safety cap after ${P.length} assets \u2014 list truncated.`),{data:P,metadata:{query:H,limit:P.length,offset:0,totalCount:Math.max(E,P.length)}}}catch(P){throw j({title:"Error",description:"Failed to fetch document assets. Please try again.",variant:"destructive"}),P}},enabled:x,refetchOnWindowFocus:!1,staleTime:300*1e3,gcTime:600*1e3});return{assets:((F=R.data)==null?void 0:F.data)||[],metadata:(I=R.data)==null?void 0:I.metadata,isLoading:R.isLoading,error:R.error,refetch:R.refetch}};function va(e){const n=e.lastIndexOf("/");return n>=0?e.slice(0,n):""}function ba(e,n){return`${va(e)}/${n.trim()}`}const wa=["image/png","image/jpeg","image/jpg","image/svg+xml"],ht=e=>e.message?`${e.filename} (${e.message})`:e.filename,xa=["thumbnail","original","compressed"],Ca=e=>{for(const n of xa){const s=`${Ae}${e}:${n}`;Gt(s),Qt(Kt(s))}},Fe=100,Na=e=>`${e} ${e===1?"item":"items"}`,$a=e=>{const n=e==null?void 0:e.detail;return typeof n=="string"&&n?n:"The items could not be moved."},La=(e={})=>{const{filterPath:n,allowedTypes:s=wa,imagesOnly:r=!0}=e,{captureException:i}=Mt(),{toast:l}=Ie(),d=Et(),[v,x]=U(!1),[F,I]=U(!1),[j,R]=U(!1),[M,O]=U(!1),[P,E]=U(!1),{assets:H,isLoading:q,refetch:X}=pt({}),W=Le(()=>{let g=H.filter(c=>c.type===ne.FILE);return n&&(g=g.filter(c=>c.path.startsWith(n))),r&&(g=g.filter(c=>c.name.toLowerCase().endsWith(".png")||c.name.toLowerCase().endsWith(".jpg")||c.name.toLowerCase().endsWith(".jpeg")||c.name.toLowerCase().endsWith(".svg"))),g.map(c=>({id:c.id||`${c.name}-${c.path}`,src:c.id?`${Ae}${c.id}:thumbnail`:c.path,originalSrc:c.id?`${Ae}${c.id}:original`:c.path,name:c.name,path:c.path,createdAt:c.createdAt,type:c.type})).sort((c,b)=>!c.createdAt||!b.createdAt?0:new Date(c.createdAt).getTime()-new Date(b.createdAt).getTime())},[H,n,r]),G=D(g=>Array.from(g).filter(c=>s.includes(c.type)),[s]),T=D(async(g,c)=>{const b=G(g);if(b.length===0)return l({title:"Invalid file types",description:"Only PNG, JPG, and SVG files are allowed.",variant:"destructive"}),null;try{x(!0);const p=await Qe(b,{path:c});if(p.statusCode===200){const w=p.data,_=(w==null?void 0:w.count)??0,A=((w==null?void 0:w.assets)??[]).filter(ee=>ee.status==="error");return _===0||(w==null?void 0:w.status)==="error"?(l({title:"Upload failed",description:A.length>0?A.map(ht).join(", "):"No files could be uploaded.",variant:"destructive"}),null):(l({title:"Upload successful",description:`${_} file(s) uploaded successfully.`,variant:"success"}),A.length>0&&l({title:"Some files failed to upload",description:A.map(ht).join(", "),variant:"destructive"}),await d.invalidateQueries({queryKey:["documentAssets"]}),(w==null?void 0:w.assets)||null)}else throw new Error("Upload failed")}catch(p){return l({title:"Upload failed",description:p instanceof Error?p.message:"An unknown error occurred",variant:"destructive"}),i({error:p,contexts:{payload:{filesCount:b.length,path:c}}}),null}finally{x(!1)}},[G,l,i,d]),B=D(async(g,c)=>{try{if(I(!0),(await Ht(g)).statusCode===200)return l({title:"Image deleted",description:c?`"${c}" deleted successfully.`:"Image deleted successfully.",variant:"success"}),await d.invalidateQueries({queryKey:["documentAssets"]}),Ca(g),!0;throw new Error("Delete failed")}catch(b){return l({title:"Delete failed",description:b instanceof Error?b.message:"An unknown error occurred",variant:"destructive"}),i({error:b,contexts:{payload:{assetId:g,assetName:c}}}),!1}finally{I(!1)}},[l,i,d]),J=D(async(g,c="public/document_builder")=>{const b=`${c}/${g.trim()}`;try{const p=await Wt({path:b});if(p.statusCode===201||p.statusCode===200)return l({title:"Category created",description:`Category "${g}" created successfully.`,variant:"success"}),await d.invalidateQueries({queryKey:["documentAssets"]}),!0;throw new Error("Failed to create category")}catch(p){return l({title:"Failed to create category",description:p instanceof Error?p.message:"An unknown error occurred",variant:"destructive"}),i({error:p,contexts:{payload:{categoryName:g,categoryPath:b}}}),!1}},[l,i,d]),pe=D(async(g,c,b=!0)=>{try{const p=await zt({path:g,recursive:b});if(p.statusCode===204||p.statusCode===200)return l({title:"Category deleted",description:c?`Category "${c}" and all its contents deleted successfully.`:"Category deleted successfully.",variant:"success"}),await d.invalidateQueries({queryKey:["documentAssets"]}),!0;throw new Error("Failed to delete category")}catch(p){return l({title:"Failed to delete category",description:p instanceof Error?p.message:"An unknown error occurred",variant:"destructive"}),i({error:p,contexts:{payload:{categoryPath:g,categoryName:c}}}),!1}},[l,i,d]),de=D(async(g,c,b)=>{try{if(R(!0),(await qt({assetId:g,newFilename:c})).statusCode===200)return l({title:"Image renamed",description:b?`"${b}" renamed to "${c}" successfully.`:"Image renamed successfully.",variant:"success"}),await d.invalidateQueries({queryKey:["documentAssets"]}),!0;throw new Error("Rename failed")}catch(p){return l({title:"Rename failed",description:p instanceof Error?p.message:"An unknown error occurred",variant:"destructive"}),i({error:p,contexts:{payload:{assetId:g,newFilename:c}}}),!1}finally{R(!1)}},[l,i,d]),Q=D(async(g,c)=>{const b=ba(g,c);try{O(!0);const p=await Bt({oldPath:g,newPath:b}),w=p.data;if(p.statusCode===200&&(w==null?void 0:w.success)!==!1)return l({title:"Folder renamed",description:`Folder renamed to "${c}" successfully.`,variant:"success"}),await d.invalidateQueries({queryKey:["documentAssets"]}),{success:!0,newPath:(w==null?void 0:w.newPath)??b};const _=(w==null?void 0:w.detail)??(w==null?void 0:w.message)??"A folder with that name already exists.";return l({title:"Rename failed",description:_,variant:"destructive"}),{success:!1,error:_}}catch(p){const w=p instanceof Error?p.message:"An unknown error occurred";return l({title:"Rename failed",description:w,variant:"destructive"}),i({error:p,contexts:{payload:{oldPath:g,newPath:b}}}),{success:!1,error:w}}finally{O(!1)}},[l,i,d]),re=D(async({targetPath:g,targetName:c,assetIds:b,folderPaths:p})=>{var w;const _=b.length+p.length,A=[],ee=new Set;let S=0;try{E(!0);let K=null;for(let V=0;V<_;V+=Fe){const Z=p.slice(V,V+Fe),ae=Math.max(0,V-p.length),se=b.slice(ae,ae+Fe-Z.length),ce=[...se,...Z];if(K===null){const Y=await _t({targetPath:g,assetIds:se,folderPaths:Z});if(Y.statusCode===200&&Y.data){const he=Y.data;S+=((w=he.moved)==null?void 0:w.length)??0,A.push(...(he.failed??[]).map(({source:ue,message:Ce})=>({source:ue,message:Ce}))),ce.forEach(ue=>ee.add(ue));continue}K=$a(Y.data)}const xe=K;A.push(...ce.map(Y=>({source:Y,message:xe}))),ce.forEach(Y=>ee.add(Y))}if(S>0&&await d.invalidateQueries({queryKey:["documentAssets"]}),K!==null&&S===0)return l({title:"Move failed",description:K,variant:"destructive"}),{success:!1,movedCount:0,failed:A};const te=A[0];return te?(l({title:S>0?"Some items were not moved":"Move failed",description:`Moved ${S} of ${_} \u2014 ${A.length} failed: ${te.message}`,variant:"destructive"}),{success:!1,movedCount:S,failed:A}):(l({title:"Move complete",description:`Moved ${Na(S)} to ${c}`,variant:"success"}),{success:!0,movedCount:S,failed:A})}catch(K){const te=K instanceof Error?K.message:"An unknown error occurred",V=[...b,...p].filter(Z=>!ee.has(Z));return A.push(...V.map(Z=>({source:Z,message:te}))),l({title:S>0?"Some items were not moved":"Move failed",description:S>0?`Moved ${S} of ${_} \u2014 ${A.length} failed: ${te}`:te,variant:"destructive"}),i({error:K,contexts:{payload:{targetPath:g,assetIds:b,folderPaths:p}}}),await d.invalidateQueries({queryKey:["documentAssets"]}),{success:!1,movedCount:S,failed:A}}finally{E(!1)}},[l,i,d]);return{assets:W,rawAssets:H,isLoading:q,isUploading:v,isDeleting:F,isRenaming:j,isRenamingFolder:M,isMoving:P,uploadAssets:T,deleteAsset:B,renameAsset:de,renameFolder:Q,moveItems:re,createCategory:J,deleteCategory:pe,validateFiles:G,refetch:X}};function gt(){const{preferences:e}=Vt(),{user:n,isSuperAdmin:s}=Jt(),r=s||(n==null?void 0:n.role)===Ke.Admin||(n==null?void 0:n.role)===Ke.SuperAdmin,i=e==null?void 0:e[Yt.IMAGE_LIBRARY.RESTRICT_NON_ADMIN_UPDATES],l=i===!0||i==="true";return Le(()=>({canManageImageLibrary:r||!l}),[r,l])}const ve={LOGO:"public/document_builder/logo",BACKGROUND:"public/document_builder/background",PROFILES:"public/document_builder/profiles",CLIPBOARD:"public/document_builder/clipboard-uploads"};Ve.create({name:"fontFamily",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontFamily:{default:null,parseHTML:e=>{var n;return((n=e.style.fontFamily)==null?void 0:n.replace(/['"]+/g,""))||null},renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]}}),Ve.create({name:"fontSize",addGlobalAttributes(){return[{types:["textStyle"],attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize||null,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]}}),Zt.create({name:"variable",group:"inline",inline:!0,atom:!0,selectable:!1,draggable:!1,addAttributes(){return{name:{default:null,parseHTML:e=>e.getAttribute("data-variable"),renderHTML:e=>e.name?{"data-variable":e.name}:{}},displayName:{default:null,parseHTML:e=>e.getAttribute("data-display-name"),renderHTML:e=>e.displayName?{"data-display-name":e.displayName}:{}},value:{default:null,parseHTML:e=>e.getAttribute("data-variable-value"),renderHTML:e=>e.value==null?{}:{"data-variable-value":e.value}},casedValue:{default:null,parseHTML:()=>null,renderHTML:()=>({})}}},parseHTML(){return[{tag:"span[data-variable]"}]},renderHTML({node:e,HTMLAttributes:n}){const s=e.attrs.displayName||e.attrs.name||"",r=e.attrs.value!=null&&e.attrs.value!=="";return["span",Xt(n,{class:r?"variable-highlight variable-highlight--bound":"variable-highlight"}),e.attrs.casedValue??(r?String(e.attrs.value):`[${s}]`)]},renderText({node:e}){return`{%${e.attrs.name}%}`}});const Ia={sm:"aspect-square",md:"aspect-square",lg:"aspect-square"},ft=ge(({id:e,src:n,name:s,isUploading:r=!1,isDeleting:i=!1,isRenaming:l=!1,disabled:d=!1,onClick:v,onDelete:x,onRename:F,onDragStart:I,draggable:j=!1,size:R="md",objectFit:M="contain",className:O="",showDeleteButton:P=!0,showRenameButton:E=!0})=>{const H=d||r||i||l,q=T=>{!H&&v&&v(T)},X=T=>{!r&&I&&I(T)},W=T=>{T.stopPropagation(),x&&!i&&x()},G=T=>{T.stopPropagation(),F&&!l&&F()};return N("div",{className:`${Ia[R]} rounded-lg overflow-hidden group transition-all duration-200 border border-neutral06 hover:border-primary02 hover:shadow-md relative bg-neutral07 ${r?"cursor-default":H?"cursor-not-allowed opacity-50":j?"cursor-grab active:cursor-grabbing hover:cursor-pointer":"cursor-pointer"} ${O}`,draggable:j&&!r,onDragStart:X,onClick:q,title:`${s} ${r?"(uploading...)":j?"(drag to canvas)":""}`,children:[r?N($e,{children:[a("img",{src:n,alt:s,className:"w-full h-full object-contain opacity-50",loading:"lazy"}),a("div",{className:"absolute inset-0 bg-neutral07 flex items-center justify-center z-10",children:a(Je,{size:6,className:"text-neutral03"})})]}):a(Ye,{src:n,alt:s,className:"w-full h-full transition-transform duration-200 group-hover:scale-105",objectFit:M,outerClassName:"w-full h-full",lazy:!0}),!r&&E&&F&&a("div",{className:"absolute top-1 left-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-20",children:a(Ze,{variant:"ghost",size:"sm",onClick:G,className:"!p-1 !w-6 !h-6 !min-w-0 bg-white/90 dark:bg-neutral-900/90 !rounded-full shadow-sm",title:"Rename image",disabled:l,icon:a(ea,{className:"h-3 w-3 text-neutral02"}),tooltip:"Rename image"})}),!r&&P&&x&&a("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-20",children:a(Ze,{variant:"ghost",size:"sm",onClick:W,className:"!p-1 !w-6 !h-6 !min-w-0 bg-white/90 dark:bg-neutral-900/90 !rounded-full shadow-sm",title:"Delete image",disabled:i,icon:a(De,{className:"h-3 w-3 text-error"}),tooltip:"Delete image"})})]})},(e,n)=>e.id===n.id&&e.src===n.src&&e.isUploading===n.isUploading&&e.isDeleting===n.isDeleting&&e.isRenaming===n.isRenaming&&e.disabled===n.disabled);ft.displayName="AssetThumbnail";const Aa={sm:"aspect-square",md:"aspect-square",lg:"aspect-square"},Da={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"},yt=ge(({onClick:e,size:n="md",disabled:s=!1,title:r="Upload new image",className:i=""})=>a("div",{onClick:s?void 0:e,className:`${Aa[n]} border-2 border-dashed border-neutral04 rounded-lg flex items-center justify-center transition-colors group ${s?"cursor-not-allowed opacity-50":"cursor-pointer hover:border-primary02 hover:bg-primary05"} ${i}`,title:r,children:a(Xe,{className:`${Da[n]} text-neutral03 ${!s&&"group-hover:text-primary02"} transition-colors`})}));yt.displayName="AddAssetButton";const Oa="image/png,image/jpeg,image/jpg,image/svg+xml",vt=_e(({onFileSelect:e,accept:n=Oa,multiple:s=!0,disabled:r=!1,id:i},l)=>{const d=D(v=>{e(v.target.files),v.target.value=""},[e]);return a("input",{ref:l,id:i,type:"file",multiple:s,accept:n,onChange:d,disabled:r,className:"hidden"})});vt.displayName="AssetUploadInput";const bt=ge(({isOpen:e,onClose:n,onConfirm:s,assetName:r,assetType:i="image",imageCount:l=0,title:d,description:v})=>a(ta,{isOpen:e,onClose:n,onConfirm:s,title:d||(i==="category"?"Delete Category":"Delete Image"),description:v||(i==="category"?l>0?`Are you sure you want to delete the "${r}" category? This will permanently delete all ${l} image${l!==1?"s":""} in this category. This action cannot be undone.`:`Are you sure you want to delete the "${r}" category? This action cannot be undone.`:`Are you sure you want to delete "${r}"? This action cannot be undone.`),confirmText:"Delete",cancelText:"Cancel",modal:!0,closeOnOutsideClick:!1}));bt.displayName="DeleteAssetDialog";const ka=Object.freeze(Object.defineProperty({__proto__:null,DeleteAssetDialog:bt},Symbol.toStringTag,{value:"Module"})),wt=Oe(()=>import("./runtime-Dn4RiA4k.js").then(e=>e.oR).then(e=>e.FolderNameDialog),{}),xt=Oe(()=>Promise.resolve().then(()=>ka).then(e=>e.DeleteAssetDialog),{}),Fa=Oe(()=>import("./RenameAssetDialog-Rx-mnefu.js").then(e=>e.RenameAssetDialog),{});function Ta(e,n){const s=`${n}/`,r=[],i=[],l=new Map;for(const d of e){if(d.type!==ne.FILE||!d.path.startsWith(s))continue;const v=d.path.slice(s.length),x=v.indexOf("/");if(x<=0)continue;const F=`${n}/${v.slice(0,x)}`;l.set(F,(l.get(F)??0)+1)}for(const d of e){if(!d.path.startsWith(s))continue;const v=d.path.slice(s.length);v.length===0||v.includes("/")||(d.type===ne.FOLDER?r.push({name:d.name,path:d.path,imageCount:l.get(d.path)??0}):d.type===ne.FILE&&i.push(d))}return r.sort((d,v)=>d.name.localeCompare(v.name)),{folders:r,fileAssets:i}}function Te(e){const n=e.lastIndexOf("/");return n>=0?e.slice(0,n):""}const ja="Untitled";function je(e){var n,s;return((s=(n=e.assetMetadata)==null?void 0:n.originalFilename)==null?void 0:s.trim())||ja}const be=[{name:"Logo",path:ve.LOGO},{name:"Background",path:ve.BACKGROUND},{name:"Profiles",path:ve.PROFILES},{name:"Clipboard Uploads",path:ve.CLIPBOARD}],Re=_e(({onImageSelect:e,gridColumns:n=3,hideDeleteButton:s,hideHeader:r,pickerMode:i=!1},l)=>{const[d,v]=U("logo"),[x,F]=U(""),{assets:I,isLoading:j}=pt({}),{toast:R}=Ie(),{canManageImageLibrary:M}=gt(),O=!M,{uploadAssets:P,deleteAsset:E,renameAsset:H,createCategory:q,deleteCategory:X,isDeleting:W,isRenaming:G,validateFiles:T}=La(),[B,J]=U(()=>be.map(t=>({id:t.name.toLowerCase(),name:t.name,images:[],isDefault:!0,path:t.path,isFetched:!1,fileCount:0,isCountFetched:!1})));Pt(()=>{if(I.length===0)return;const t="public/document_builder/",u=I.filter(f=>{if(f.type!==ne.FOLDER||!f.path.startsWith(t))return!1;const y=f.path.slice(t.length);return y.length>0&&!y.includes("/")}).map(f=>{const y=I.filter(C=>C.path.startsWith(f.path)&&C.type===ne.FILE),$=be.find(C=>C.path===f.path||C.name.toLowerCase()===f.name.toLowerCase()),L=!!$,ie=L?$.name.toLowerCase():f.id||`${f.name}-${f.path}`;return{id:ie,name:f.name,images:y.map(C=>({id:C.id||`${C.name}-${C.path}`,src:C.id?ye(C.id):C.path,thumbnailSrc:C.id?et(C.id):C.path,name:je(C),category:ie,path:C.path,isLoaded:!1,createdAt:C.createdAt})).sort((C,le)=>!C.createdAt||!le.createdAt?0:new Date(C.createdAt).getTime()-new Date(le.createdAt).getTime()),isDefault:L,path:f.path,isFetched:!0,fileCount:y.length,isCountFetched:!0}}),m=be.map(f=>u.find($=>$.path===f.path||$.name.toLowerCase()===f.name.toLowerCase())||{id:f.name.toLowerCase(),name:f.name,images:[],isDefault:!0,path:f.path,isFetched:!0,fileCount:0,isCountFetched:!0}),h=u.filter(f=>!be.some(y=>f.path===y.path||f.name.toLowerCase()===y.name.toLowerCase())),k=[...m,...h];J(f=>k.map(y=>{const $=f.find(L=>L.id===y.id);return $&&$.images.filter(L=>L.isUploading).forEach(L=>{L.src.startsWith("blob:")&&URL.revokeObjectURL(L.src)}),y}))},[I]);const[pe,de]=U(null),[Q,re]=U(null),[g,c]=U(null),[b,p]=U(null),[w,_]=U({}),[A,ee]=U(null),[S,K]=U(null),te=fe({}),V=fe(B);V.current=B;const Z=D(t=>w[t.id]??t.path??"",[w]);St(l,()=>({createCategory:async t=>{await q(t)},getActiveCategoryPath:()=>{if(!d)return null;const t=V.current.find(u=>u.id===d);return t?w[t.id]??t.path??null:null}}),[q,d,w]);const ae=D(async(t,u)=>{if(!u)return;const m=T(u);if(m.length===0)return;if(O){R({title:"Image library is admin-managed",description:"Only admins can add images to the shared library.",variant:"destructive"});return}const h=V.current.find($=>$.id===t);if(!(h!=null&&h.path))return;const k=w[t]??h.path,f=Date.now(),y=m.map($=>{const L=URL.createObjectURL($);return{id:`temp_${t}_${f}_${Math.random()}`,src:L,thumbnailSrc:L,name:$.name,category:t,path:`${k}/${$.name}`,isUploading:!0,isLoaded:!0,uploadTimestamp:f}});J($=>$.map(L=>L.id===t?{...L,images:[...L.images,...y]}:L)),await P(m,k)||(J($=>$.map(L=>L.id===t?{...L,images:L.images.filter(ie=>!ie.isUploading)}:L)),y.forEach($=>URL.revokeObjectURL($.src)))},[T,P,w,O,R]),se=D(t=>{var u;(u=te.current[t])==null||u.click()},[]),ce=(t,u)=>{t.preventDefault(),t.stopPropagation(),de(u)},xe=t=>{t.preventDefault(),t.stopPropagation(),de(null)},Y=D((t,u)=>{t.preventDefault(),t.stopPropagation(),de(null);const m=t.dataTransfer.files;ae(u,m)},[ae]),he=D(async t=>{if(t.isUploading){J(u=>u.map(m=>m.id===t.category?{...m,images:m.images.filter(h=>h.id!==t.id)}:m)),URL.revokeObjectURL(t.src),c(null),re(null);return}await E(t.id,t.name)&&J(u=>u.map(m=>m.id===t.category?{...m,images:m.images.filter(h=>h.id!==t.id)}:m)),c(null),re(null)},[E]),ue=D(async(t,u)=>{if(!t.id){p(null);return}await H(t.id,u,t.name)&&J(m=>m.map(h=>h.id===t.category?{...h,images:h.images.map(k=>k.id===t.id?{...k,name:u}:k)}:h)),p(null)},[H]),Ce=D(async(t,u)=>{await X(u.path,u.name,!0)&&_(m=>{const h=m[t];if(!h||h!==u.path&&!h.startsWith(`${u.path}/`))return m;const k={...m},f=Te(u.path),y=V.current.find($=>$.id===t);return!f||y!=null&&y.path&&f===y.path?delete k[t]:k[t]=f,k}),ee(null)},[X]),At=D(async t=>S?await q(t,S.parentPath):!1,[q,S]),Se=D((t,u)=>{const m=t.currentTarget.querySelector("img");let h=u.width,k=u.height;m&&(!h||!k)&&(h=m.naturalWidth,k=m.naturalHeight);const f={type:"image",src:u.src,name:u.name,category:u.category,path:u.path,width:h,height:k};if(t.dataTransfer.setData("application/json",JSON.stringify(f)),t.dataTransfer.effectAllowed="copy",m&&m.src&&!m.src.startsWith(tt)){const y=document.createElement("img");y.src=m.src,y.style.position="absolute",y.style.top="-1000px",y.style.width="80px",y.style.height="80px",y.style.objectFit="contain",y.style.pointerEvents="none",y.style.border="2px solid #000",y.style.borderRadius="4px",y.style.backgroundColor="white",document.body.appendChild(y),t.dataTransfer.setDragImage(y,40,40),setTimeout(()=>{document.body.contains(y)&&document.body.removeChild(y)},0)}},[]),Ue=D((t,u)=>{if(t.isUploading)return;let m=t;if(u){const h=u.currentTarget.querySelector("img");h&&h.naturalWidth&&h.naturalHeight&&(m={...t,width:h.naturalWidth,height:h.naturalHeight})}e?e(m):re(m)},[e]),Dt=D(t=>{const u=j||!t.isFetched,m=Z(t),h=!!t.path&&m!==t.path,k=s||O,{folders:f,fileAssets:y}=m?Ta(I,m):{folders:[],fileAssets:[]},$=y.map(o=>({id:o.id||`${o.name}-${o.path}`,src:o.id?ye(o.id):o.path,thumbnailSrc:o.id?et(o.id):o.path,name:je(o),category:t.id,path:o.path,isLoaded:!1,createdAt:o.createdAt})).sort((o,z)=>!o.createdAt||!z.createdAt?0:new Date(o.createdAt).getTime()-new Date(z.createdAt).getTime()),L=t.images.filter(o=>o.isUploading&&o.path&&Te(o.path)===m),ie=f.length===0&&$.length===0&&L.length===0,C=x.trim().toLowerCase(),le=o=>o.toLowerCase().includes(C),We=C?f.filter(o=>le(o.name)):f,ze=C?$.filter(o=>le(o.name)):$,qe=C?L.filter(o=>le(o.name)):L,Ft=!!C&&We.length===0&&ze.length===0&&qe.length===0,Tt=()=>{if(!h||!t.path)return;const o=Te(m);_(z=>{const Ne={...z};return!o||o===t.path?delete Ne[t.id]:Ne[t.id]=o,Ne})},jt=o=>{_(z=>({...z,[t.id]:o}))},Rt=()=>u?a("div",{className:"grid gap-3",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:[...Array(n*2)].map((o,z)=>a(la,{className:"aspect-square rounded-lg"},z))}):t.isLoading?N("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a(Je,{size:6,className:"text-neutral03 mb-2"}),a("p",{className:"text-xs text-neutral03",children:"Loading images..."})]}):ie?N("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a(oa,{className:"h-6 w-6 text-neutral03 mb-2"}),a("p",{className:"text-xs text-neutral03 mb-3",children:O?"No images in this folder.":"No images in this folder. Upload or drop images here."}),!O&&a(oe,{variant:"outline",size:"sm",onClick:()=>se(t.id),className:"flex items-center gap-2",leftIcon:a(it,{className:"h-4 w-4"}),children:"Upload Images"})]}):Ft?N("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[a(at,{className:"h-6 w-6 text-neutral03 mb-2"}),N("p",{className:"text-xs text-neutral03",children:['No images match "',x,'".']})]}):N("div",{className:"grid gap-3 items-start",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:[!C&&!O&&a(yt,{onClick:()=>se(t.id)}),We.map(o=>{const z=o.name.toLowerCase().replace(/\s+/g,"-");return a(Ct,{folder:o,testId:`image-options-folder-${t.id}-${z}`,onOpen:()=>jt(o.path),onDelete:k?void 0:()=>ee({categoryId:t.id,folder:o})},o.path)}),[...ze,...qe].map(o=>N("div",{className:"flex flex-col gap-1 min-w-0",children:[a(ft,{id:o.id,src:o.thumbnailSrc,name:o.name,isUploading:o.isUploading,isDeleting:W,isRenaming:G,draggable:!o.isUploading&&!i,onDragStart:i?void 0:z=>Se(z,o),onClick:z=>Ue(o,z),onDelete:k?void 0:()=>c(o),showDeleteButton:!k}),a("p",{title:o.name,className:"text-xs text-neutral01 truncate",children:o.name})]},o.id))]});return N("div",{className:`flex-1 min-h-0 flex flex-col transition-colors duration-200 ${pe===t.id?"bg-primary05/40":""}`,onDragOver:o=>ce(o,t.id),onDragLeave:xe,onDrop:o=>Y(o,t.id),children:[N("div",{className:`flex items-center gap-2 px-4 ${r?"pt-1":"pt-3"} pb-4 shrink-0`,children:[h?N("button",{type:"button","data-testid":`image-options-back-${t.id}`,onClick:Tt,className:"inline-flex items-center gap-1 text-xs text-primary01 hover:underline shrink-0",children:[a(aa,{className:"h-3.5 w-3.5"}),"Back"]}):null,h&&a("span",{"data-testid":`image-options-current-folder-${t.id}`,title:m,className:"text-xs font-medium text-neutral01 capitalize truncate shrink-0",children:m.split("/").pop()}),N("div",{className:"relative flex-1 min-w-0",children:[a(at,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-neutral03"}),a(na,{type:"search",value:x,onChange:o=>F(o.target.value),placeholder:"Search images","data-testid":`image-options-search-${t.id}`,className:"h-8 w-full pl-7 text-xs"})]}),!i&&!O&&a(oe,{size:"sm",variant:"outline","data-testid":`image-options-new-folder-${t.id}`,onClick:()=>K({categoryId:t.id,parentPath:m}),className:"shrink-0 h-8 px-3 text-xs",leftIcon:a(ra,{className:"h-3.5 w-3.5"}),children:"New Folder"})]}),a("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pb-4",children:Rt()}),a(vt,{ref:o=>{o&&(te.current[t.id]=o)},id:`asset-upload-${t.id}`,onFileSelect:o=>ae(t.id,o)})]})},[I,Z,se,Se,Ue,ae,Y,W,G,j,pe,n,s,r,i,x,O]),[Ot,Me]=U(!1),kt=D(async t=>await q(t),[q]),Ee=B.find(t=>t.id===d)??null,me=x.trim().toLowerCase(),He=Le(()=>{if(!me)return null;const t=new Map;for(const u of B){if(!u.path)continue;const m=I.filter(h=>h.type===ne.FILE&&h.path.startsWith(`${u.path}/`)&&je(h).toLowerCase().includes(me)).length;t.set(u.id,m)}return t},[me,B,I]);return N($e,{children:[N("div",{"data-testid":"image-options",className:"flex flex-col h-[640px] max-h-[70vh] bg-white overflow-hidden dark:bg-neutral-900",children:[!r&&a("div",{"data-testid":"image-options-header",className:"flex items-center justify-between px-4 py-3 border-b border-neutral06 shrink-0",children:a("span",{className:"text-sm font-semibold text-neutral01",children:"Image Library"})}),N("div",{className:"flex flex-1 min-h-0",children:[N("div",{"data-testid":"image-options-categories",className:`w-[170px] shrink-0 border-r border-neutral06 overflow-y-auto px-2 pb-2 ${r?"pt-1":"pt-2"}`,children:[!i&&!O&&a(oe,{size:"sm",variant:"outline","data-testid":"image-options-new-category",onClick:()=>Me(!0),className:"w-full justify-center mb-3",leftIcon:a(Xe,{className:"h-3.5 w-3.5"}),children:"Add category"}),j&&B.every(t=>!t.isFetched)?a("ul",{className:"flex flex-col gap-1",children:Array.from({length:4}).map((t,u)=>a("li",{className:"h-9 rounded-md bg-neutral07 animate-pulse"},u))}):B.length===0?a("p",{className:"text-[11px] text-neutral03 px-2 py-2",children:"No categories yet."}):a("ul",{className:"flex flex-col gap-0.5",children:B.map(t=>{const u=d===t.id,m=t.name.toLowerCase().replace(/\s+/g,"-"),h=me?(He==null?void 0:He.get(t.id))??0:t.fileCount??0,k=me?!0:h>0;return a("li",{children:N("button",{type:"button","data-testid":`image-options-category-${m}`,"aria-current":u?"true":void 0,onClick:()=>v(t.id),className:`w-full flex items-center justify-between gap-2 h-9 px-3 rounded-md text-xs font-medium capitalize transition-colors ${u?"bg-primary05 text-primary01":"text-neutral02 hover:bg-neutral07"}`,children:[a("span",{className:"truncate",children:t.name}),k&&a("span",{className:`shrink-0 text-[11px] font-normal normal-case ${u?"text-primary01":"text-neutral03"}`,children:h})]})},t.id)})})]}),a("div",{"data-testid":"image-options-pane",className:"flex-1 min-w-0 min-h-0 flex flex-col",children:Ee?Dt(Ee):a("div",{className:"h-full flex items-center justify-center text-xs text-neutral03 px-4 text-center",children:"Select or create a category to get started."})})]})]}),Q&&a(nt,{open:!!Q,onOpenChange:()=>re(null),children:N(rt,{className:"w-full max-w-2xl",children:[a(st,{className:"flex flex-row items-center gap-1.5 text-center sm:text-left",children:a("span",{className:"text-lg font-semibold leading-none tracking-tight",children:Q.name})}),a("div",{className:"flex justify-center p-4",children:a("div",{className:"relative w-full",style:{maxHeight:"384px",aspectRatio:Q.width&&Q.height?`${Q.width} / ${Q.height}`:"auto"},children:a(Ye,{src:Q.src,alt:Q.name,className:"w-full h-full object-contain rounded-lg",objectFit:"contain",outerClassName:"w-full h-full"})})}),N(sa,{children:[!O&&a(oe,{variant:"destructive",onClick:()=>c(Q),leftIcon:a(De,{className:"h-4 w-4"}),disabled:W,isLoading:W,children:"Delete"}),a(ia,{asChild:!0,children:a(oe,{variant:"outline",disabled:W,children:"Close"})})]})]})}),a(xt,{isOpen:!!g,onClose:()=>c(null),onConfirm:async()=>{g&&await he(g)},assetName:g==null?void 0:g.name,assetType:"image"}),a(Fa,{isOpen:!!b,onClose:()=>p(null),onConfirm:async t=>{b&&await ue(b,t)},currentName:b==null?void 0:b.name,isRenaming:G}),a(wt,{isOpen:Ot,onClose:()=>Me(!1),onSubmit:kt,title:"Create New Category",inputLabel:"Category Name",placeholder:"Enter category name"}),a(wt,{isOpen:!!S,onClose:()=>K(null),onSubmit:At,title:"Create New Folder"}),a(xt,{isOpen:!!A,onClose:()=>ee(null),onConfirm:async()=>{A&&await Ce(A.categoryId,A.folder)},assetName:A==null?void 0:A.folder.name,assetType:"category",imageCount:A==null?void 0:A.folder.imageCount})]})});Re.displayName="ImageOptions";const Ct=ge(({folder:e,testId:n,onOpen:s,onDelete:r})=>N("div",{className:"relative group",children:[N("button",{type:"button","data-testid":n,onClick:s,title:e.name,className:"aspect-square w-full rounded-lg border border-neutral06 bg-neutral08 hover:border-primary02 hover:bg-primary05/30 focus:outline-none focus:ring-2 focus:ring-primary02 flex flex-col items-center justify-center gap-1 transition-colors p-2",children:[a(da,{className:"h-6 w-6 text-neutral03",strokeWidth:1.5}),a("span",{className:"text-[11px] font-medium text-neutral02 capitalize truncate max-w-full",children:e.name}),N("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-neutral03",children:[e.imageCount,a(ca,{className:"h-3 w-3"})]})]}),r&&a("button",{type:"button","data-testid":`${n}-delete`,"aria-label":`Delete folder ${e.name}`,title:`Delete folder ${e.name}`,onClick:i=>{i.stopPropagation(),r()},className:"absolute top-1.5 right-1.5 w-6 h-6 inline-flex items-center justify-center rounded-md bg-white/90 dark:bg-neutral-900/90 text-neutral02 shadow-sm border border-neutral06 opacity-0 group-hover:opacity-100 hover:text-red-600 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary02 transition-opacity",children:a(De,{className:"h-3.5 w-3.5"})})]}));Ct.displayName="FolderTile";const Nt="Image library is admin-managed",$t="Only admins can upload new images. Ask your admin for access, or pick an existing image from the library.",Ra=`${Nt}. ${$t}`;function Pa(e){return!Number.isFinite(e)||e<1?1:Math.floor(e)}function Sa(e){const n=Pa(e),s=[];let r=0;const i=()=>{for(;r<n&&s.length>0;)s.shift().execute()};return{run:l=>new Promise((d,v)=>{const x=()=>{r+=1,Promise.resolve().then(l).then(d,v).finally(()=>{r-=1,i()})};s.push({execute:x}),i()}),get activeCount(){return r},get pendingCount(){return s.length}}}const Ua=e=>`${e.userId}/document_builder/document_images/${e.documentScope}`,Ma=e=>new Promise(n=>{const s=URL.createObjectURL(e),r=new Image;r.onload=()=>{URL.revokeObjectURL(s),n({width:r.naturalWidth||void 0,height:r.naturalHeight||void 0})},r.onerror=()=>{URL.revokeObjectURL(s),n({})},r.src=s}),Ea=3,Ha=async(e,n)=>{const s=e.filter(lt),r=async l=>{var d,v,x;const[F,I]=await Promise.all([Ma(l),Qe([l],{path:Ua(n),compress:!0})]),j=ua(I);if(!j){const R=(x=(v=(d=I.data)==null?void 0:d.assets)==null?void 0:v[0])==null?void 0:x.message;throw new Error(R||`Inline image upload failed (${I.statusCode})`)}return{assetId:j.assetId,src:`${tt}${j.assetId}`,...F}},i=Sa(Ea);return Promise.all(s.map(l=>i.run(()=>r(l))))},Pe="Image upload failed \u2014 nothing was inserted.",Wa=`Unsupported image type \u2014 choose a ${ct.map(e=>e.replace("image/","").toUpperCase()).join(", ")} file.`,za=ct.join(","),Lt=e=>({assetId:e.id,src:fa(e.src)==="asset-ref"?e.src:ye(e.id),width:e.width,height:e.height});function qa({sessionRef:e,onOpenChange:n,uploadCtx:s,onInsert:r,onError:i,gridColumns:l}){const[d,v]=U(!1),{canManageImageLibrary:x}=gt(),F=!x,I=fe(null),j=D(async M=>{const O=Array.from(M.target.files??[]);if(M.target.value="",O.length===0)return;if(F){i==null||i(Ra);return}if(!s){i==null||i(Pe);return}if(!O.some(lt)){i==null||i(Wa);return}const P=e.current.id,E=()=>e.current.open&&e.current.id===P;v(!0);try{const H=await Ha(O,s);if(!E())return;if(H.length===0){i==null||i(Pe);return}r(H),n(!1)}catch{if(!E())return;i==null||i(Pe)}finally{v(!1)}},[s,F,i,r,n,e]),R=D(M=>{d||(r([Lt(M)]),n(!1))},[d,r,n]);return N($e,{children:[N(pa,{defaultValue:F?"library":"upload",className:"px-6 pb-6",children:[N(ha,{children:[a(ot,{value:"upload","data-testid":"insert-image-tab-upload",children:"Upload"}),a(ot,{value:"library","data-testid":"insert-image-tab-library",children:"Image Library"})]}),a(dt,{value:"upload",children:F?N("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border py-10 text-center","data-testid":"inline-image-upload-restricted",children:[a(ga,{className:"h-8 w-8 text-muted-foreground"}),a("p",{className:"text-sm font-medium text-foreground",children:Nt}),a("p",{className:"max-w-[380px] text-xs text-muted-foreground",children:$t})]}):N("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border-primary py-10 text-center",children:[a(ya,{className:"h-8 w-8 text-neutral03"}),a("p",{className:"text-sm text-neutral02",children:"PNG, JPG or WEBP. Images are stored securely with your document."}),a(oe,{variant:"primary",size:"sm",leftIcon:a(it,{className:"h-4 w-4"}),disabled:!s||d,isLoading:d,onClick:()=>{var M;return(M=I.current)==null?void 0:M.click()},"data-testid":"inline-image-upload-trigger",children:d?"Uploading\u2026":"Choose images"}),!s&&a("p",{className:"text-xs text-neutral03",children:"Uploads are unavailable until the document finishes loading."})]})}),a(dt,{value:"library",children:a("div",{className:"max-h-[70vh]",children:a(Re,{pickerMode:!0,hideHeader:!0,hideDeleteButton:!0,gridColumns:l,onImageSelect:R})})})]}),a("input",{ref:I,type:"file",accept:za,multiple:!0,className:"hidden","data-testid":"inline-image-file-input",onChange:j})]})}function Ba({onOpenChange:e,onInsert:n,gridColumns:s}){const r=D(i=>{n([Lt(i)]),e(!1)},[n,e]);return a("div",{className:"px-6 pb-6",children:a("div",{className:"max-h-[70vh]",children:a(Re,{pickerMode:!0,hideHeader:!0,hideDeleteButton:!0,gridColumns:s,onImageSelect:r})})})}function _a({open:e,onOpenChange:n,uploadCtx:s,onInsert:r,onError:i,title:l="Insert Image",gridColumns:d}){const v=s===void 0,x=fe({open:e,id:0});return x.current.open!==e&&(x.current={open:e,id:x.current.id+1}),a(nt,{open:e,onOpenChange:n,children:N(rt,{className:"w-full sm:max-w-[720px] p-0 overflow-hidden",closeOnOutsideClick:v,children:[a(st,{className:"px-6 pt-6",children:a(ma,{children:l})}),v?a(Ba,{onOpenChange:n,onInsert:r,gridColumns:d}):a(qa,{sessionRef:x,onOpenChange:n,uploadCtx:s,onInsert:r,onError:i,gridColumns:d})]})})}const we="/images/image-placeholder.svg";function It(e){return e?/^(https?:|data:|blob:|\/)/.test(e):!0}function Ga({src:e,className:n,companyLogo:s}){const[r,i]=Be.useState(()=>It(e)?e:"");return Be.useEffect(()=>{if(It(e)){i(e);return}let l=!1;return ut(e,we,void 0,void 0,{companyLogo:s}).then(d=>{l||i(d)}).catch(()=>{l||i(we)}),()=>{l=!0}},[e,s]),r?a("img",{src:r,alt:"Logo",className:n}):null}function Qa({isOpen:e,onClose:n,onSelect:s}){return a(_a,{open:e,onOpenChange:r=>{r||n()},title:"Select image",onInsert:r=>{const i=r[0];i&&s(ye(i.assetId))}})}async function Ka(e){try{const n=await ut(e,we);return!n||n===we?null:await new Promise(s=>{const r=new Image;r.onload=()=>{if(!r.naturalWidth||!r.naturalHeight){s(null);return}s({naturalWidth:r.naturalWidth,naturalHeight:r.naturalHeight})},r.onerror=()=>s(null),r.src=n})}catch{return null}}export{Qa as LogoLibraryDialog,Ga as ResolvedLogoImg,Ka as captureImageNaturalSize};
@@ -1,5 +0,0 @@
1
- import{jsx as l,jsxs as C}from"react/jsx-runtime";import{useMemo as H,useState as u,useEffect as S,useCallback as d}from"react";import{bD as se,bC as Ye,df as ce,dD as Je,e3 as de,e4 as ue,bU as Qe,ch as Ze,bB as Ke,cM as en,e5 as nn,e6 as on,e7 as tn,d5 as ln,e8 as X,d4 as me,e9 as an,c_ as pe,d0 as rn,c3 as sn,c4 as cn,ca as dn,c5 as un,ea as mn,eb as pn,ec as fn,aD as xn,cc as hn,bG as gn,bF as yn,c$ as bn}from"./runtime-Dn4RiA4k.js";const vn=({className:o})=>{const{preferences:t}=se(),{isAdmin:a}=Ye();return t!=null&&t[ce.GLOBAL.COMPANY_LOGO]?null:l(Je,{variant:"warning",icon:l(Qe,{size:18}),message:a?C("p",{className:"text-sm",children:["We noticed that your company logo and theme have not been configured. For most effective use of templates, please configure them in"," ",l(de,{href:ue.company,className:"inline-flex items-center font-medium hover:opacity-70 underline underline-offset-2",children:"Company Settings \u2192"})]}):C("p",{className:"text-sm",children:["We noticed that your company logo and theme have not been configured. For most effective use of templates, please request your admin to configure them in"," ",l(de,{href:ue.company,className:"inline-flex items-center font-medium hover:opacity-70 underline underline-offset-2",children:"Company Settings \u2192"})]}),className:o})};function wn(o){const t=[];return(o.includes("pdf")||o.includes("word"))&&t.push("document"),o.includes("excel_single")&&t.push("excel_single"),o.includes("excel_multiple")&&t.push("excel_multiple"),t}function fe(o){return o==="document"?"pdf":"excel"}function Cn(o){return o==="excel_multiple"?"separate":"single"}function On(o){const t=o.includes("pdf"),a=o.includes("word");return t&&a?"PDF & Word":a?"Word":"PDF"}function Fn(o){return o.includes("pdf")?l(pe,{size:16}):l(bn,{size:16})}const Dn=({isOpen:o,onClose:t,markdownContent:a,tiptapContent:xe,tiptapContents:he,title:ge="Download Preview",exportButtonText:ye="Download as PDF",documentName:O,pageBreakBetweenItems:be=!1,exportFormat:P="pdf",excelMode:_="single",excelExportSettings:y,onBlobGenerated:c,onDocxBlobGenerated:G,showDocumentTitleControls:ve=!1,seedDocumentTitleFromContent:we=!1,hideDocumentTitle:Ce=!1,emailFormats:i,onAllBlobsGenerated:N,enablePageStyle:Oe=!0,enableOrientationControl:Fe=!1,initialOrientationMode:k,onOrientationModeChange:M})=>{const{captureException:F}=Ze(),{toast:b}=Ke(),{isExportBlocked:De,refuseExport:Ee}=en(),D=H(()=>i?wn(i):[],[i]),Se=D.length>1,m=!!i&&i.length>0,[s,L]=u(null);S(()=>{D.length>0?L(D[0]):L(null)},[D]);const U=m&&s?fe(s):P,Ne=m&&s?Cn(s):_,[T,q]=u(null),[f,V]=u(null),[$,Y]=u(null),[p,J]=u(null),[v,A]=u(!1),[z,Q]=u(y);S(()=>{o||(Q(y),ne(null))},[o,y]);const[Z,ke]=u(!0),[x,K]=u(O||"");S(()=>{O&&K(O)},[O]);const Te=d(e=>{K(e)},[]),[$e,ee]=u(k??"auto");S(()=>{k!==void 0&&ee(k)},[k]);const Ae=d(e=>{ee(e),M==null||M(e)},[M]),[w,ne]=u(null),Be=d(e=>{e.isExcel&&e.logoEnabled!==void 0&&ne({logo:e.sessionLogo,enabled:e.logoEnabled,firstSheetOnly:e.logoOnFirstSheetOnly,switchesTouched:e.logoSwitchesTouched}),Q(n=>({componentColors:e.componentColors,documentFont:e.documentFont,logoDataUrl:e.isExcel?e.logoDataUrl:n==null?void 0:n.logoDataUrl,logoOnFirstSheetOnly:e.isExcel?e.logoOnFirstSheetOnly:n==null?void 0:n.logoOnFirstSheetOnly}))},[]),Pe=d(e=>{ke(e)},[]),_e=d(e=>{q(()=>e)},[]),Ge=d(e=>{V(()=>e)},[]),Me=d(e=>{Y(()=>e)},[]),Le=d(e=>{J(()=>e)},[]),h=U==="excel",g=U==="docx",oe=h?"Excel":g?"DOCX":"PDF",R=h?".xlsx":g?".docx":".pdf";S(()=>{q(null),V(null),Y(null),J(null)},[s]);const B=H(()=>typeof a=="string"?a:Array.isArray(a)?a.join(`
2
-
3
- `):"",[a]),{companyLogo:W}=nn({}),{preferences:j}=se(),te=d(async e=>{if((w==null?void 0:w.enabled)===!1||w&&w.logo!==void 0||!W||e!=null&&e.logoDataUrl)return e;let n=null;try{const r=j==null?void 0:j[ce.GLOBAL.EXPORT_SETTINGS];n=(typeof r=="string"?JSON.parse(r):r)??null}catch{}if((n==null?void 0:n.logoEnabled)===!1)return e;try{const r=await on(W);return{...e,logoDataUrl:r,logoOnFirstSheetOnly:(e==null?void 0:e.logoOnFirstSheetOnly)??(n==null?void 0:n.logoOnFirstSheetOnly)}}catch(r){return F({error:r,extra:{context:"tabbed export logo fallback"}}),e}},[w,W,j,F]),Ue=d(async()=>{var e;if(!(!i||!N)){A(!0);try{const n=x||"document",r=z||y,I=r==null?void 0:r.documentFont,ae=((e=r==null?void 0:r.componentColors)==null?void 0:e.styleFirstColumnAsHeader)??!1,qe=i.map(async E=>{if(E==="pdf")return{blob:s==="document"&&f?await f():await tn(B,n,void 0,I,ae),filename:`${n}.pdf`,contentType:"application/pdf"};if(E==="word")return{blob:s==="document"&&p?await p():await ln(B,n,ae),filename:`${n}.docx`,contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};{const re=E==="excel_multiple"?"separate":"single",ie=await X(B,n,re,!0,await te(r));return ie?{blob:ie,filename:`${n}${re==="separate"?"_sheets":""}.xlsx`,contentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}:null}}),Ve=(await Promise.all(qe)).filter(E=>E!==null);N(Ve),t()}catch(n){if(me(n))return;F({error:n,extra:{emailFormats:i}}),b({title:"Export Failed",description:n instanceof Error?n.message:"An unknown error occurred",variant:"destructive"})}finally{A(!1)}}},[i,N,s,f,p,B,x,z,y,te,t,F,b]),ze=async()=>{if(De){Ee();return}if(m&&N){await Ue();return}A(!0);try{if(G&&p){const e=await p(),n=`${x||"document"}.docx`;G(e,n)}if(h){const e=typeof a=="string"?a:Array.isArray(a)?a.join(`
4
-
5
- `):"",n=z||y;if(c){const r=await X(e,x||"export",_,!0,n);if(r){const I=`${x||"export"}${R}`;c(r,I)}t()}else await X(e,x||"export",_,!1,n),t(),b({title:"Download Successful",description:"Excel spreadsheet has been downloaded successfully",variant:"success"})}else if(g)if(c&&p){const e=await p(),n=`${x||"document"}${R}`;c(e,n),t()}else $&&(await $(),t(),b({title:"Download Successful",description:`${oe} has been downloaded successfully`,variant:"success"}));else if(c&&f){const e=await f(),n=`${x||"document"}${R}`;c(e,n),t()}else T&&(await T(),t(),b({title:"Download Successful",description:`${oe} has been downloaded successfully`,variant:"success"}))}catch(e){if(me(e))return;F({error:e,extra:{markdownContent:a,exportFormat:P}}),b({title:c?"Export Failed":"Download Failed",description:e instanceof Error?e.message:"An unknown error occurred",variant:"destructive"})}finally{A(!1)}},Re=H(()=>{if(m){if(!s)return!1;const e=fe(s);return e==="excel"?!!a:e==="docx"?!!p:!!f}return h?!!a:g?c?!!p:!!$:c?!!f:!!T},[m,s,h,g,a,f,p,T,$,c]),We=an(),le=!h&&We>0,je=Re&&!Z&&!le,Ie=h||m,He=d(e=>e==="document"?i?On(i):"Document":e==="excel_single"?"Excel (Single Sheet)":"Excel (Separate Sheets)",[i]),Xe=d(e=>e==="document"?i?Fn(i):l(pe,{size:16}):l(rn,{size:16}),[i]);return l(sn,{open:o,onOpenChange:t,children:C(cn,{className:"max-w-[1400px] w-[90vw] h-[90vh] p-0 gap-0 flex flex-col",closeOnOutsideClick:!1,children:[C("div",{className:"flex-shrink-0",children:[l(dn,{className:"px-6 py-4 border-b border-border-primary",children:l(un,{children:ge})}),l(vn,{className:"mx-6 my-4"}),Se&&s&&l("div",{className:"px-4 border-b border-border-primary",children:l(mn,{value:s,onValueChange:e=>L(e),children:l(pn,{variant:"outline",className:"justify-start gap-4",children:D.map(e=>l(fn,{value:e,variant:"outline",disabled:v||Z,children:C("span",{className:"flex items-center gap-1.5",children:[Xe(e),He(e)]})},e))})})})]}),l(xn,{markdownContent:a,tiptapContent:xe??void 0,tiptapContents:he,documentName:O,onDocumentNameChange:Te,isActive:o,isExporting:v,exportFormat:U,onExportSettingsChange:Ie?Be:void 0,initialExcelLogo:w,onSettingsLoadingChange:Pe,onExportReady:_e,onGeneratePdfBlobReady:m||c&&!g?Ge:void 0,onDocxExportReady:Me,onGenerateDocxBlobReady:m||c&&g||G?Le:void 0,pageBreakBetweenItems:be,excelMode:Ne,showDocumentTitleControls:ve,seedDocumentTitleFromContent:we,hideDocumentTitle:Ce,enablePageStyle:Oe,enableOrientationControl:Fe,initialOrientationMode:$e,onOrientationModeChange:Ae},m?s:P),l(hn,{className:"px-6 py-4 border-t border-border-primary flex-shrink-0 flex sm:justify-between",children:C("div",{className:"flex gap-2 justify-end w-full",children:[l(gn,{variant:"outline",onClick:t,disabled:v,children:"Cancel"}),l(yn,{onClick:ze,disabled:!je,isLoading:v,tooltip:le&&!v?"Waiting for images to finish loading\u2026":void 0,children:v?m||c?"Preparing...":"Downloading...":ye})]})})]})})};export{Dn as MarkdownExportPreviewDialog};
@@ -1,7 +0,0 @@
1
- import{jsxs as u,jsx as n}from"react/jsx-runtime";import ve,{useMemo as v,useState as $,useCallback as k,useRef as I,useEffect as q}from"react";import{iA as Q,iB as Ce,j as ae,fN as Ae,iC as Ue,bG as M,iD as Le,cY as _,iE as ne,iF as ie,iG as Me,iH as _e,eV as re,bD as X,cX as Te,fA as Ie,fC as Re,ac as oe,iI as Ee,iJ as le,iK as De,s as se,L as ce,iL as $e,bH as Be,iM as Ge,iN as Se,bC as ze,cN as je,ci as Oe,cj as Fe,ck as Pe,ah as Ve,iO as We,iP as He,iQ as qe,iR as Ye,ea as Ke,eb as Je,ec as ue,fF as Qe,gI as Xe,iS as Ze}from"./runtime-Dn4RiA4k.js";import"react-dom";import"react-dom/client";import{B as de}from"./bell-B4nDPvYM.js";const et=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],tt=Q("book-open",et);const at=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],nt=Q("compass",at);const it=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],rt=Q("external-link",it);function ot(e){const t=Date.now(),a=new Date(e).getTime(),i=Math.floor((t-a)/1e3);if(i<60)return"now";const l=Math.floor(i/60);if(l<60)return`${l}m`;const r=Math.floor(l/60);if(r<24)return`${r}h`;const o=Math.floor(r/24);if(o<30)return`${o}d`;const s=Math.floor(o/30);return s<12?`${s}mo`:`${Math.floor(o/365)}y`}function Z({title:e,body:t,imageUrl:a,actionUrl:i,createdAt:l,isRead:r=!1,onClick:o,disabled:s=!1,"data-testid":c}){const g=!s&&!!i&&!!o;return u("div",{onClick:g?o:void 0,className:ae("ui-group ui-rounded-lg ui-border ui-overflow-hidden ui-transition-colors",r?"ui-border-neutral-200 dark:ui-border-neutral-700 ui-bg-white dark:ui-bg-neutral-900":"ui-border-blue-200 dark:ui-border-blue-500/20 ui-bg-blue-50 dark:ui-bg-blue-500/10",g?"ui-cursor-pointer hover:ui-border-neutral-300 dark:hover:ui-border-neutral-600":"ui-cursor-default"),"data-testid":c,children:[u("div",{className:"ui-flex ui-items-start ui-gap-3 ui-p-4",children:[u("div",{className:"ui-flex-1 ui-min-w-0",children:[n("p",{className:"ui-text-sm ui-font-semibold ui-text-neutral01",children:e}),t&&n("p",{className:"ui-text-xs ui-text-neutral03 ui-mt-1",children:t})]}),n("span",{className:"ui-text-xs ui-text-neutral04 ui-whitespace-nowrap ui-flex-shrink-0",children:ot(l)})]}),a&&n("div",{className:"ui-px-4 ui-pb-4",children:n("img",{src:a,alt:e,loading:"eager",decoding:"async",className:"ui-block ui-w-full ui-h-[200px] ui-rounded-md ui-object-cover ui-bg-neutral-100 dark:ui-bg-neutral-800"})}),i&&n("div",{className:"ui-flex ui-justify-end ui-px-4 ui-pb-3",children:n(Ce,{className:"ui-h-4 ui-w-4 ui-text-neutral04 ui-opacity-0 group-hover:ui-opacity-100 ui-transition-opacity"})})]})}function lt({onBack:e,label:t}){return n("div",{className:"ui-px-4 ui-pt-3 ui-pb-2",children:u(M,{variant:"ghost",size:"sm",className:"ui-text-primary",onClick:e,"data-testid":"announcement-detail-back",children:[n(Le,{className:"ui-h-4 ui-w-4 ui-mr-1.5"}),t]})})}function st(){return u("div",{className:"ui-flex-1 ui-overflow-y-auto ui-px-5 ui-pb-6","data-testid":"announcement-detail-skeleton",children:[n(_,{className:"ui-w-full ui-h-[220px] ui-rounded-lg ui-mb-4"}),n(_,{className:"ui-h-6 ui-w-2/3 ui-mb-2"}),n(_,{className:"ui-h-3 ui-w-1/3 ui-mb-4"}),n(_,{className:"ui-h-3 ui-w-full ui-mb-2"}),n(_,{className:"ui-h-3 ui-w-11/12 ui-mb-2"}),n(_,{className:"ui-h-3 ui-w-4/5"})]})}function ct({onRetry:e}){return u("div",{className:"ui-flex-1 ui-flex ui-flex-col ui-items-center ui-justify-center ui-px-5 ui-pb-6 ui-text-center","data-testid":"announcement-detail-error",children:[n("p",{className:"ui-text-sm ui-text-neutral03",children:"Couldn't load this announcement."}),n(M,{variant:"ghost",size:"sm",className:"ui-mt-2 ui-text-primary",onClick:e,"data-testid":"announcement-detail-retry",children:"Retry"})]})}function ut({learnMore:e,custom:t}){return t?u(M,{variant:"outline",size:"sm",onClick:t.onClick,"data-testid":"announcement-detail-custom-cta",children:[n(rt,{className:"ui-h-4 ui-w-4 ui-mr-1.5"}),t.label]}):e?u(M,{variant:"outline",size:"sm",onClick:e.onClick,isLoading:e.loading,"data-testid":"announcement-learn-more",children:[n(tt,{className:"ui-h-4 ui-w-4 ui-mr-1.5"}),e.label??"Learn more"]}):null}function dt({actions:e}){const{learnMore:t,custom:a,takeTour:i}=e;return!t&&!a&&!i?null:u("div",{className:"ui-shrink-0 ui-flex ui-flex-wrap ui-items-center ui-gap-3 ui-border-t ui-border-border ui-px-5 ui-py-3",children:[n(ut,{learnMore:t,custom:a}),i&&u(M,{variant:"primary",size:"sm",onClick:i.onClick,"data-testid":"announcement-take-tour",children:[n(nt,{className:"ui-h-4 ui-w-4 ui-mr-1.5"}),"Take the tour"]})]})}function ee({title:e,markdown:t,imageUrl:a,updatedAtLabel:i,onBack:l,backLabel:r="Back to notifications",actions:o,isLoading:s=!1,error:c}){return u("div",{className:"ui-flex ui-flex-col ui-h-full ui-min-h-0",children:[n(lt,{onBack:l,label:r}),s?n(st,{}):c?n(ct,{onRetry:c.onRetry}):u("div",{className:"ui-flex-1 ui-overflow-y-auto ui-px-5 ui-pb-6",children:[a&&n("img",{src:a,alt:e,loading:"eager",decoding:"async",className:"ui-block ui-w-full ui-h-[220px] ui-rounded-lg ui-object-cover ui-bg-neutral-100 dark:ui-bg-neutral-800 ui-mb-4"}),n("h2",{className:"ui-text-lg ui-font-semibold ui-text-neutral01",children:e}),i&&u("p",{className:"ui-text-xs ui-text-neutral04 ui-mt-1 ui-mb-4",children:["Last updated ",i]}),n(Ae,{content:t??"",components:Ue,disableVirtualization:!0,className:"announcement-article ui-text-sm"})]}),!s&&!c&&o&&n(dt,{actions:o})]})}function mt({items:e,onItemClick:t,disabled:a=!1,renderItem:i,"data-testid":l}){return n("div",{className:"ui-flex ui-flex-col ui-gap-4 ui-px-4 ui-pb-4","data-testid":l,children:e.map(r=>i?n(ve.Fragment,{children:i(r)},r.id):n(Z,{title:r.title,body:r.body,imageUrl:r.imageUrl,actionUrl:r.actionUrl,createdAt:r.createdAt,isRead:r.isRead,onClick:t?()=>t(r.id):void 0,disabled:a,"data-testid":"notification-item"},r.id))})}const me=async(e,t,a)=>{const i={p_limit:e,p_offset:t};return(a==null?void 0:a.notificationType)!==void 0&&(i.p_notification_type=a.notificationType),(a==null?void 0:a.moduleNames)!==void 0&&(i.p_module_names=a.moduleNames),(a==null?void 0:a.includeNoModule)!==void 0&&(i.p_include_no_module=a.includeNoModule),ne.post(`${ie}/get_notifications`,i)},ft=async e=>ne.post(`${ie}/get_notification_module_facets`,{p_notification_type:e}),ht=async e=>Me.get(`/ingestion/announcements/${e}/content`);function pt(){const e=_e("agent_platform");return v(()=>{const t=new Set;return e||t.add("agent_platform"),t},[e])}const gt=e=>["announcement-content",e],bt=180*1e3;async function yt(e){const t=await ht(e);if(t.statusCode!==200||!t.data)throw new Error(`Announcement content fetch failed (${t.statusCode})`);return t.data}function fe(e,t){const{data:a,isLoading:i,isError:l,refetch:r}=re({queryKey:gt(e??""),queryFn:async()=>{if(!e)throw new Error("Missing broadcastId for announcement content");return yt(e)},enabled:t&&!!e,staleTime:bt,refetchOnWindowFocus:!1});return{content:a??null,isLoading:i,isError:l,refetch:()=>{r()}}}function Nt(e){return e.split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function xt(e){const t=Date.now(),a=new Date(e).getTime(),i=Math.floor((t-a)/1e3);if(i<60)return"now";const l=Math.floor(i/60);if(l<60)return`${l}m`;const r=Math.floor(l/60);if(r<24)return`${r}h`;const o=Math.floor(r/24);if(o<30)return`${o}d`;const s=Math.floor(o/30);return s<12?`${s}mo`:`${Math.floor(o/365)}y`}function wt({notification:e,onClick:t,disabled:a}){const{modules:i}=X(),l=()=>{var r;if(e.actorName)return n(Ie,{size:"sm",name:e.actorName,children:n(Re,{children:e.actorName})});const o=e.moduleName?(r=i.find(s=>s.name===e.moduleName))==null?void 0:r.icon:void 0;return o!=null&&o.outlineValue?n(oe,{name:o.outlineValue,type:o.outlineType,size:20,className:"text-neutral03"}):e.icon?n(oe,{name:Nt(e.icon),type:"lucide",size:20,className:"text-neutral03"}):n(de,{size:20,className:"text-neutral03"})};return u("div",{onClick:()=>t(e),className:ae("group flex items-start gap-3 px-4 py-3 transition-colors",e.isRead?"bg-white dark:bg-neutral-900":"bg-blue-50 dark:bg-blue-500/10",a||!e.actionUrl?"cursor-default":"cursor-pointer hover:bg-neutral08"),"data-testid":"notification-item",children:[n("div",{className:"flex-shrink-0 mt-0.5",children:l()}),u("div",{className:"flex-1 min-w-0",children:[n("p",{className:"text-sm leading-snug text-neutral01 font-medium",children:e.title}),e.body&&n("p",{className:"text-xs text-neutral03 mt-0.5 line-clamp-2",children:e.body})]}),u("div",{className:"flex flex-col items-end justify-between self-stretch flex-shrink-0",children:[n("span",{className:"text-xs text-neutral04 whitespace-nowrap",children:xt(e.createdAt)}),e.actionUrl&&n(Te,{className:"h-4 w-4 text-neutral04 opacity-0 group-hover:opacity-100 transition-opacity"})]})]})}function kt({showBanner:e}){return u("div",{className:"rounded-lg border border-border overflow-hidden","data-testid":"notification-item-skeleton",children:[e&&n(_,{className:"h-[200px] w-full rounded-none"}),u("div",{className:"flex flex-col gap-2 p-3",children:[n(_,{className:"h-4 w-3/4"}),n(_,{className:"h-3 w-full"})]})]})}function vt({onRetry:e,disabled:t}){return u("div",{className:"rounded-lg border border-border bg-card p-4 text-center","data-testid":"notification-item-error",children:[n("p",{className:"text-sm text-neutral03",children:"Couldn't load this announcement."}),n(M,{variant:"ghost",size:"sm",className:"mt-1 text-primary",onClick:e,disabled:t,"data-testid":"notification-item-retry",children:"Retry"})]})}const he="#";function Ct({notification:e,onClick:t,disabled:a}){const{content:i,isLoading:l,isError:r,refetch:o}=fe(e.broadcastId,!0);return l?n(kt,{showBanner:!!(e.gcsPath||e.imageUrl)}):r||!i?n(vt,{onRetry:o,disabled:a}):n(Z,{title:i.title,body:i.description,imageUrl:i.imageUrl,actionUrl:he,createdAt:e.createdAt,isRead:e.isRead,onClick:()=>t(e),disabled:a,"data-testid":"notification-item"})}function At({notification:e,onClick:t,disabled:a}){const i=e.actionUrl??(e.markdown?he:null);return n(Z,{title:e.title,body:e.body,imageUrl:e.imageUrl,actionUrl:i,createdAt:e.createdAt,isRead:e.isRead,onClick:()=>t(e),disabled:a,"data-testid":"notification-item"})}function Ut(e){return e.notification.gcsPath?n(Ct,{...e}):n(At,{...e})}function Lt({notifications:e,onClick:t,disabled:a}){const i=v(()=>new Map(e.map(r=>[r.id,r])),[e]),l=v(()=>e.map(r=>({id:r.id,title:r.title,createdAt:r.createdAt})),[e]);return n(mt,{items:l,renderItem:r=>{const o=i.get(r.id);return o?n(Ut,{notification:o,onClick:t,disabled:a}):null}})}function Mt(){var e;try{const t=se.getItem(ce.CLIENT_INSTANCE_IDENTIFIER,!0,""),a=se.getItem(ce.AUTHORIZED_INSTANCES,!0,[]);return(e=a==null?void 0:a.find(i=>i.id===t))==null?void 0:e.name}catch{return}}function _t({pylonArticleUrl:e,ctaUrl:t,tourId:a,onCloseDrawer:i}){const{startTourManually:l}=Ee(),[r,o]=$(!1),s=!!(a&&Object.prototype.hasOwnProperty.call(le,a)),c=k(async()=>{if(!e)return;o(!0);const f=window.open("about:blank","_blank");f&&(f.opener=null);try{const p=Mt(),N=await De(e,p);if(f&&N)f.location.href=N;else if(N){const w=window.open(N,"_blank");w&&(w.opener=null)}else f&&f.close()}catch{f==null||f.close()}finally{o(!1)}},[e]),g=k(()=>{t!=null&&t.startsWith("https://")&&window.open(t,"_blank","noopener,noreferrer")},[t]),b=k(()=>{!a||!Object.prototype.hasOwnProperty.call(le,a)||(i(),l(a))},[a,i,l]);return{onLearnMore:c,isLearnMoreLoading:r,onCustomCta:g,hasTour:s,onTakeTour:b}}function Tt(e){const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}function It(e,t){return e.gcsPath?t?{title:t.title,imageUrl:t.imageUrl,markdown:t.markdown,pylonArticleUrl:t.pylonArticleUrl,ctaLabel:t.ctaLabel,ctaUrl:t.ctaUrl,tourId:t.tourId}:null:{title:e.title,imageUrl:e.imageUrl,markdown:e.markdown,pylonArticleUrl:null,ctaLabel:null,ctaUrl:null,tourId:null}}function Rt({detail:e,lastUpdated:t,onBack:a,onCloseDrawer:i}){const l=v(()=>$e.sanitize(e.markdown??""),[e.markdown]),{onLearnMore:r,isLearnMoreLoading:o,onCustomCta:s,hasTour:c,onTakeTour:g}=_t({pylonArticleUrl:e.pylonArticleUrl,ctaUrl:e.ctaUrl,tourId:e.tourId,onCloseDrawer:i}),b=v(()=>{const f=!!e.ctaUrl,p=!f&&!!e.pylonArticleUrl;if(!(!f&&!p&&!c))return{custom:f?{label:e.ctaLabel??"Learn more",onClick:s}:void 0,learnMore:p?{onClick:()=>{r()},loading:o,label:e.ctaLabel??void 0}:void 0,takeTour:c?{onClick:g}:void 0}},[e.ctaUrl,e.ctaLabel,e.pylonArticleUrl,c,o,s,r,g]);return n(ee,{title:e.title,markdown:l,imageUrl:e.imageUrl,updatedAtLabel:t,onBack:a,actions:b})}function Et({announcement:e,onBack:t,onCloseDrawer:a}){const i=!!e.gcsPath,{content:l,isLoading:r,refetch:o}=fe(e.broadcastId,i),s=Tt(e.createdAt),c=It(e,l);return c?n(Rt,{detail:c,lastUpdated:s,onBack:t,onCloseDrawer:a}):i&&r?n(ee,{title:"",onBack:t,isLoading:!0}):n(ee,{title:"",onBack:t,error:{onRetry:o}})}function Dt({groups:e,selectedGroups:t,onToggle:a,onClearAll:i,disabled:l=!1}){return u("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3","data-testid":"notification-module-filter-chips",children:[e.map(r=>{const o=t.includes(r.name);return u(M,{type:"button",variant:"pill",size:"xs",disabled:l,"data-state":o?"active":"inactive","aria-pressed":o,className:"shrink-0 !rounded-md",contentClassName:"gap-1",onClick:()=>a(r.name),"data-testid":`notification-module-chip-${r.name}`,children:[r.label,o&&n(Be,{className:"h-3 w-3","aria-hidden":"true"})]},r.name)}),t.length>0&&n(M,{type:"button",variant:"ghost",size:"xs",disabled:l,onClick:i,className:"shrink-0 text-neutral04 hover:text-foreground","data-testid":"notification-module-clear-all",children:"Clear all"})]})}const z={name:"__general__",label:"General"},$t=["workflows","document_builder","experts","vault","market","assistant_agent"];function Bt(e,t){if(!e||e==="global")return z;const a=t.find(l=>l.name===e);if(!a)return z;if(!a.parentName)return{name:a.name,label:a.label};const i=t.find(l=>l.name===a.parentName);return i?{name:i.name,label:i.label}:{name:a.name,label:a.label}}function pe(e){const t=$t.indexOf(e);return t===-1?Number.MAX_SAFE_INTEGER:t}function Gt(e){const t=[...e.filter(a=>a.name!==z.name)].sort((a,i)=>{const l=pe(a.name)-pe(i.name);return l!==0?l:a.label.localeCompare(i.label)});return e.some(a=>a.name===z.name)&&t.push(z),t}function St({type:e,enabled:t,userId:a,onRemoteChange:i,onRowDeleted:l}){const r=I(i);r.current=i;const o=I(l);o.current=l,q(()=>{if(!t||!a)return;let s=!1,c=null;const g=()=>{c&&clearTimeout(c),c=setTimeout(()=>{s||r.current()},400)};let b=null;return(async()=>{const f=await Ge({table:"notifications",event:Se.ALL,channelName:`notification-feed-${e}-${a}`},{disableInactivityCheck:!0,onInsert:p=>{s||!(p!=null&&p.id)||g()},onDelete:p=>{s||!(p!=null&&p.id)||(o.current(p.id),g())}});s?f.unsubscribe():b=f.unsubscribe})(),()=>{s=!0,c&&clearTimeout(c),b==null||b(),b=null}},[e,t,a])}const Y=20,ge=["notification-module-facets"];function be({type:e,enabled:t}){const{user:a}=ze(),{modules:i}=X(),l=je(),r=pt(),[o,s]=$([]),[c,g]=$(!1),[b,f]=$(!0),[p,N]=$([]),w=I(0),B=I([]);B.current=o;const U=I(0),{data:T}=re({queryKey:[...ge,e,(a==null?void 0:a.id)??null],queryFn:()=>ft(e),enabled:t,staleTime:6e4,refetchOnWindowFocus:!1}),{groups:G,rawNamesByGroup:j}=v(()=>{const m=Array.isArray(T==null?void 0:T.data)?T==null?void 0:T.data:[],d=new Map,x=new Map;return m.forEach(A=>{var S;if(A.moduleName&&r.has(A.moduleName))return;const L=Bt(A.moduleName,i);d.has(L.name)||(d.set(L.name,L),x.set(L.name,[])),A.moduleName&&A.moduleName!=="global"&&((S=x.get(L.name))==null||S.push(A.moduleName))}),{groups:Gt(Array.from(d.values())),rawNamesByGroup:x}},[T,i,r]),R=v(()=>{const m=new Set(G.map(d=>d.name));return p.filter(d=>m.has(d))},[p,G]),E=v(()=>{if(R.length===0)return{notificationType:e};const m=new Set;let d=!1;return R.forEach(x=>{x===z.name&&(d=!0),(j.get(x)??[]).forEach(A=>m.add(A))}),{notificationType:e,...m.size>0?{moduleNames:Array.from(m).sort()}:{},...d?{includeNoModule:!0}:{}}},[e,R,j]),h=I(E);h.current=E;const C=k(async(m,d,x,A)=>{const S=U.current;g(!0);try{const L=await me(m,d,A);if(U.current!==S)return;if(L.statusCode===200&&Array.isArray(L.data)){const D=L.data;s(P=>x?[...P,...D]:D),f(D.length===m),w.current=d+D.length;return}const H=await me(m,d);if(U.current!==S)return;if(H.statusCode===200&&Array.isArray(H.data)){const D=H.data.filter(P=>P.notificationType===e);s(P=>x?[...P,...D]:D),f(!1),w.current=d+H.data.length}}finally{U.current===S&&g(!1)}},[e]),O=k(()=>{const m=Math.max(Y,B.current.length+1);C(m,0,!1,h.current)},[C]),y=I(a==null?void 0:a.id);q(()=>{y.current!==(a==null?void 0:a.id)&&(y.current=a==null?void 0:a.id,U.current+=1,s([]),N([]),f(!0),w.current=0)},[a==null?void 0:a.id]);const W=v(()=>JSON.stringify(E),[E]);q(()=>{t&&(U.current+=1,C(Y,0,!1,h.current))},[t,W,a==null?void 0:a.id,C]);const K=k(()=>{O(),l.invalidateQueries({queryKey:ge})},[O,l]),J=k(m=>{B.current.some(d=>d.id===m)&&s(d=>d.filter(x=>x.id!==m))},[]);St({type:e,enabled:t,userId:a==null?void 0:a.id,onRemoteChange:K,onRowDeleted:J});const ye=k(m=>{N(d=>d.includes(m)?d.filter(x=>x!==m):[...d,m])},[]),Ne=k(()=>N([]),[]),xe=k(()=>{!c&&b&&C(Y,w.current,!0,h.current)},[c,b,C]),we=k(()=>{s(m=>m.map(d=>d.isRead?d:{...d,isRead:!0,readAt:new Date().toISOString()}))},[]),F=v(()=>o.filter(m=>!r.has(m.moduleName??"")),[o,r]),ke=v(()=>F.filter(m=>!m.isRead).length,[F]),te=I(null);return q(()=>{!t||c||!b||o.length===0||F.length>0||te.current!==w.current&&(te.current=w.current,C(Y,w.current,!0,h.current))},[t,c,b,o.length,F.length,C]),{groups:G,selectedGroups:R,toggleGroup:ye,clearGroups:Ne,notifications:F,isLoading:c,hasMore:b,fetchMore:xe,unreadCount:ke,markAllLocallyRead:we}}const V={ACTIVITY:"activity",WHATS_NEW:"whats_new"};function zt({open:e,onClose:t}){const a=Oe(),{modules:i}=X(),{isFeatureEnabled:l}=Fe(),r=l(Pe.FEATURE_ANNOUNCEMENT),[o,s]=$(V.ACTIVITY),[c,g]=$(null),b=r?o:V.ACTIVITY,f=b===V.WHATS_NEW,p=be({type:"activity",enabled:e}),N=be({type:"feature_announcement",enabled:e&&r}),w=y=>{s(y)},B=p.clearGroups,U=p.markAllLocallyRead,T=N.clearGroups,G=N.markAllLocallyRead,j=k(()=>{B(),U(),T(),G()},[B,U,T,G]),R=p.unreadCount,E=N.unreadCount,h=f?N:p,C=h.groups.length>=1,O=y=>{if(h.isLoading)return;if(y.markdown||y.gcsPath){g(y);return}const W=Ze(y.actionUrl,y.moduleName,K=>i.find(J=>J.name===K));W&&(a.push(W),t())};return n(Ve,{children:n(We,{open:e,onOpenChange:y=>{y||(g(null),j(),t())},children:u(He,{side:"right",className:"w-[480px] !top-[63px] max-h-[calc(100vh-63px)] max-w-full font-sans border-l border-border !rounded-none !shadow-[-4px_0px_20px_rgba(18,7,96,0.08)]","data-testid":"notification-drawer",children:[n(qe,{className:"border-none",children:u(Ye,{className:"flex items-center","data-testid":"notification-drawer-title",children:[n(de,{className:"w-5 h-5 text-text-primary mr-2"}),"Notifications"]})}),c?n("div",{className:"flex min-h-0 flex-1 flex-col",children:n(Et,{announcement:c,onBack:()=>g(null),onCloseDrawer:()=>{g(null),j(),t()}})}):n("div",{className:"flex min-h-0 flex-1 flex-col",children:n(Ke,{value:b,onValueChange:w,className:"w-full flex flex-col h-full",children:u("div",{className:"flex flex-col h-full",children:[r&&u(Je,{className:"justify-start bg-transparent px-4",variant:"underline","data-testid":"notification-tabs-list",children:[u(ue,{value:V.ACTIVITY,variant:"underline","data-testid":"notification-activity-tab",children:["Activity",R>0?` (${R})`:""]}),u(ue,{value:V.WHATS_NEW,variant:"underline","data-testid":"notification-whats-new-tab",children:["What's New",E>0?` (${E})`:""]})]}),C&&n(Dt,{groups:h.groups,selectedGroups:h.selectedGroups,onToggle:h.toggleGroup,onClearAll:h.clearGroups,disabled:h.isLoading}),n("div",{className:"flex-1 flex flex-col min-h-0",children:h.notifications.length===0&&!h.isLoading?n("div",{className:"flex-1 flex items-center justify-center",children:n(Qe,{title:f?"No announcements yet":"No notifications",description:f?"Product updates and announcements will appear here.":"Notifications will appear here when actions are triggered."})}):u(Xe,{className:"flex-1 min-h-0",children:[f?n(Lt,{notifications:h.notifications,onClick:O,disabled:h.isLoading}):n("div",{children:h.notifications.map(y=>n(wt,{notification:y,onClick:O,disabled:h.isLoading},y.id))}),h.hasMore&&h.notifications.length>0&&n("div",{className:"px-4 py-3",children:n(M,{variant:"ghost",size:"sm",className:"w-full text-xs text-neutral03",onClick:y=>{y.stopPropagation(),h.fetchMore()},isLoading:h.isLoading,children:"Load more"})})]})})]})})})]})})})}export{zt as NotificationDrawer};
2
- /**
3
- * @license lucide-react v0.539.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */
@@ -1 +0,0 @@
1
- import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as f}from"react";import{bB as C,cA as D,cB as T,cC as M,cr as j,cD as E}from"./runtime-Dn4RiA4k.js";const L=({primaryPhone:v,additionalPhones:y=[],maxDisplay:A=2,enableCopy:l=!0})=>{const[$,d]=f(!1),[N,p]=f(null),{toast:u}=C();let c;const m=e=>{if(!e)return"";if(e.includes("(")&&e.includes(")")&&e.includes("-"))return e;const r=e.replace(/\D/g,"");if(r.length===10)return r.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");if(r.length===11&&r.startsWith("1"))return`+1 ${r.slice(1).replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")}`;if(r.length>11){const n=r.length-10,a=r.slice(0,n),o=r.slice(n);return`+${a} ${o.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3")}`}return r.length>=7&&r.length===7?r.replace(/(\d{3})(\d{4})/,"$1-$2"):e},P=async(e,r)=>{if(r.preventDefault(),r.stopPropagation(),!!l)try{const n=e.replace(/\D/g,"");let a=e;e.startsWith("+")?a="+"+n:a=n,await navigator.clipboard.writeText(a),p(e),u({title:"Phone Number Copied",description:`${m(e)} copied to clipboard`,variant:"success"}),setTimeout(()=>p(null),2e3)}catch{u({title:"Copy Failed",description:"Unable to copy phone number to clipboard",variant:"destructive"})}},s=[v,...y||[]].filter(e=>e&&e.trim()!=="");if(s.length===0)return t("span",{className:"text-neutral04",children:"-"});const h=({phone:e,index:r,isPrimary:n=!1})=>{const a=N===e,o=m(e);return t("span",{className:`px-2 py-0.5 text-sm border rounded group relative transition-all duration-200 ${l?"cursor-pointer hover:bg-neutral06 hover:border-neutral05":""} ${n?"bg-blue07 border-blue06 text-blue02 dark:bg-blue02/15 dark:border-blue03/40 dark:text-blue05":"bg-neutral07 border-neutral06"} ${a?"bg-green-50 border-green-200 dark:bg-green-900/30 dark:border-green-700/50":""}`,title:l?`Click to copy: ${o}`:o,onClick:w=>P(e,w),children:i("div",{className:"flex items-center gap-1",children:[t("span",{children:o}),l&&t("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:a?t(j,{className:"h-3 w-3 text-green-600"}):t(E,{className:"h-3 w-3 text-neutral04"})})]})},r)},b=s[0],g=s.length-1,k=()=>{clearTimeout(c),d(!0)},x=()=>{c=setTimeout(()=>d(!1),300)};return i("div",{className:"flex flex-wrap items-center gap-2",children:[b&&t(h,{phone:b,index:0,isPrimary:!0}),g>0&&i(D,{open:$,children:[t(T,{children:i("span",{className:"px-2 py-0.5 text-sm bg-neutral07 border border-neutral06 rounded cursor-pointer hover:bg-neutral06",onMouseEnter:k,onMouseLeave:x,children:["+",g]})}),t(M,{className:"w-72 max-h-80 overflow-y-auto",onMouseEnter:()=>clearTimeout(c),onMouseLeave:x,children:i("div",{className:"flex flex-col gap-2",children:[t("div",{className:"text-sm font-medium text-neutral01 mb-2",children:"All Phone Numbers:"}),t("div",{className:"flex flex-wrap gap-2",children:s.map((e,r)=>t(h,{phone:e,index:r,isPrimary:r===0},r))}),l&&t("div",{className:"text-xs text-neutral04 mt-2 pt-2 border-t border-neutral06",children:"\u{1F4A1} Tip: Click any phone number to copy it to clipboard"})]})})]})]})};export{L as P};
@@ -1,26 +0,0 @@
1
- import{jsx as a,jsxs as s,Fragment as C}from"react/jsx-runtime";import*as fe from"react";import{useState as v,useMemo as T,useEffect as k}from"react";import{eV as ge,eW as xe,bD as ye,df as ve,eX as be,eY as Ne,c3 as we,c4 as Ce,aC as $e,ca as Me,eZ as Se,cz as Ae,aA as Y,e_ as De,j as $,ct as V,e$ as Pe,bG as Fe}from"./runtime-Dn4RiA4k.js";import"react-dom";import"react-dom/client";const Le=300*1e3,Oe=({code:e,enabled:t})=>{var n;const r=ge({queryKey:["validateDiscountCode",e],queryFn:()=>xe(e),enabled:!!e,staleTime:Le,refetchOnWindowFocus:!1});return{data:(n=r.data)==null?void 0:n.data,isLoading:r.isLoading,isFetching:r.isFetching,isError:r.isError,error:r.error,refetch:r.refetch}},ke="usd";function Q(e){if(!e)return new Set;const t=`${e.code} ${e.coupon.name||""}`.toLowerCase(),n=new Set;return t.includes("year")&&n.add("year"),t.includes("quarter")&&n.add("quarter"),t.includes("month")&&n.add("month"),n}function X(e){return e.percentOff?`${e.percentOff}% off`:e.amountOff&&(!e.currency||e.currency.toLowerCase()===ke)?`$${e.amountOff/100} off`:"discount"}function b(e,t){var n,r;if(!t)return!1;const o=Q(t);if(o.size===0)return!0;const i=(n=e.recurring)==null?void 0:n.interval,d=((r=e.recurring)==null?void 0:r.intervalCount)||1;let c="";return i==="month"&&d===1&&(c="month"),i==="month"&&d===3&&(c="quarter"),i==="year"&&d===1&&(c="year"),o.has(c)}function N(e,t,n){if(!(t!=null&&t.coupon)||n&&!b(n,t))return e;const{percentOff:r,amountOff:o}=t.coupon;return r?e*(1-r/100):o?Math.max(0,e-o/100):e}function G(e,t,n){if(!e.recurring)return 0;const r=e.recurring.interval,o=e.recurring.intervalCount||1;if(e.unitAmount){let i=e.unitAmount/100;return t&&n!=null&&n.coupon&&(i=N(i,n,e)),r==="month"&&o===1?i:r==="month"&&o===3?i/3:r==="year"&&o===1?i/12:i}return r==="month"&&o===1?200:r==="month"&&o===3?180:r==="year"&&o===1?167:0}function z(e,t,n){const r=G(e,t,n);return`$${Math.round(r)}`}const I=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0});function R(e){return e.unitAmount?e.unitAmount/100:null}function ze(e,t){const n=t==null?void 0:t.coupon;return!n||!b(e,t)?!1:!n.percentOff&&!!n.amountOff}function W(e,t,n){const r=R(e);if(r===null)return null;const o=r*n,i=N(o,t,e),d=ze(e,t);return{total:I.format(i),perSeat:I.format(d?r:N(r,t,e)),discountNote:d?`less ${I.format(o-i)}`:null}}function K(e){if(!e.recurring)return"One-time";const t=e.recurring.interval,n=e.recurring.intervalCount||1;return t==="month"&&n===1?"Monthly":t==="month"&&n===3?"Quarterly":t==="year"&&n===1?"Yearly":"Custom"}function Z(e){if(!e.recurring)return"Perfect for one-time purchases";const t=e.recurring.interval,n=e.recurring.intervalCount||1;return t==="month"&&n===1?"Simple & Flexible":t==="month"&&n===3?"Best balance of flexibility & savings":t==="year"&&n===1?"Maximum savings":"Flexible billing option"}function H(e){var t,n;return((t=e.recurring)==null?void 0:t.interval)==="year"&&(((n=e.recurring)==null?void 0:n.intervalCount)||1)===1}function M(e){if(!e.recurring)return 0;const t=e.recurring.interval,n=e.recurring.intervalCount||1;return t==="month"?n:t==="year"?n*12:0}function J(e,t,n){if(!e.recurring)return{amount:"Contact Sales",period:""};const r=e.recurring.interval,o=e.recurring.intervalCount||1;let i="",d,c="",f;r==="month"&&o===1?c="monthly":r==="month"&&o===3?c="quarterly":r==="year"&&o===1&&(c="yearly");const p=t.reduce((u,h)=>{const l=M(u),m=M(h);return m<l&&m>0?h:u});if(e.unitAmount){const u=e.unitAmount/100,h=N(u,n,e);if(n&&h!==u?(i=`$${h.toFixed(2)}`,d=`$${u.toFixed(2)}`):i=`$${u.toFixed(2)}`,p!=null&&p.unitAmount&&p.id!==e.id){const l=p.unitAmount/100,m=M(p),x=M(e),g=(n?N(l,n,p):l)/m*x-h;if(g>0){const S=g/x*12;f=`$${Math.round(S)} per user/year`}}}else r==="month"&&o===1?i="$200.00":r==="month"&&o===3?(i="$540.00",f="$240.00 per year/user"):r==="year"&&o===1&&(i="$2000.00",f="$400 per year/user");return{amount:i,originalAmount:d,period:c,savings:f}}const Ie=(e,t)=>!e||!e.valid||!e.promotionCodeId||!e.coupon?null:{promotionCodeId:e.promotionCodeId,code:e.code||t,coupon:e.coupon},qe=({presetDiscountCode:e,appliedDiscount:t,data:n,isLoading:r,isFetching:o,isError:i})=>!e||t||i?!1:r||o||n===void 0,Ue=`
2
- @keyframes confetti-fall {
3
- 0% {
4
- transform: translateY(-100%) rotate(0deg);
5
- opacity: 1;
6
- }
7
- 100% {
8
- transform: translateY(100vh) rotate(720deg);
9
- opacity: 0;
10
- }
11
- }
12
-
13
- @keyframes confetti-shake {
14
- 0%, 100% { transform: translateX(0); }
15
- 25% { transform: translateX(-10px); }
16
- 75% { transform: translateX(10px); }
17
- }
18
-
19
- .confetti-piece {
20
- position: absolute;
21
- width: 10px;
22
- height: 10px;
23
- top: -10px;
24
- animation: confetti-fall 2.5s ease-out forwards;
25
- }
26
- `,_e=({show:e})=>{if(!e)return null;const t=["#6366f1","#22c55e","#f59e0b","#ec4899","#3b82f6","#8b5cf6"],n=Array.from({length:50},(r,o)=>({id:o,left:`${Math.random()*100}%`,delay:`${Math.random()*.5}s`,color:t[Math.floor(Math.random()*t.length)],size:Math.random()*8+6,shape:Math.random()>.5?"circle":"square"}));return s(C,{children:[a("style",{children:Ue}),a("div",{className:"absolute inset-0 overflow-hidden pointer-events-none z-50",children:n.map(r=>a("div",{className:"confetti-piece",style:{left:r.left,animationDelay:r.delay,backgroundColor:r.color,width:r.size,height:r.size,borderRadius:r.shape==="circle"?"50%":"2px"}},r.id))})]})},ee=()=>{const{showUpgradeModal:e,setShowUpgradeModal:t,currentPlan:n,modules:r,preferences:o}=ye(),i=o==null?void 0:o[ve.GLOBAL.STRIPE_DISCOUNT_CODE],{upgradeSubscription:d,isLoading:c}=be(),{monthlyPrice:f,quarterlyPrice:p,yearlyPrice:u,isLoading:h,sortPricesByAmount:l,productName:m}=Ne(!!e),[x,g]=v(null),[S,A]=v(""),[q,U]=v(!1),[P,ie]=v(null),[Be,oe]=v(null),[le,se]=v(!1),{data:F,isLoading:ce,isFetching:_,isError:ue,refetch:j}=Oe({code:i,enabled:!0}),E=T(()=>Ie(F,i||""),[F,i]),w=P??E,L=qe({presetDiscountCode:i,appliedDiscount:w,data:F,isLoading:ce,isFetching:_,isError:ue});k(()=>{e&&i&&!E&&!_&&j()},[e,i]),k(()=>{e||(A(""),ie(null),oe(null),se(!1))},[e]);const de=T(()=>{const y=[f,p,u].filter(O=>O!==null);return l(y)},[f,p,u,l]),me=(y,O)=>{if(L){j();return}const he=b(O,w)?w==null?void 0:w.promotionCodeId:void 0;g(y),d(y,he)},[D,B]=v(null);k(()=>{typeof e=="string"?B(e):e===!0&&B(null)},[e]);const pe=D&&r.find(y=>y.name===D)||null;return a(we,{open:!!e,onOpenChange:y=>!y&&t(!1),children:a(Ce,{className:D?"sm:max-w-3xl max-h-[90vh] overflow-y-auto p-0 gap-0 w-full":"sm:max-w-5xl max-h-[90vh] overflow-y-auto p-0 gap-0 w-full",children:D?a($e,{module:pe,modalView:!0}):s(C,{children:[a(_e,{show:le}),a(Me,{children:s("div",{className:"flex items-center justify-between",children:[s("div",{className:"flex items-center gap-4",children:[a(Se,{className:"w-12 h-12"}),s("div",{className:"flex flex-col gap-1",children:[s("h2",{className:"text-xl font-medium text-neutral01",children:["Upgrade to ",m||"Paid Plan"]}),a("p",{className:"text-text-secondary text-sm",children:"You're one step away from unlocking your full potential"})]})]}),a(Ae,{})]})}),a("div",{className:"px-8 py-6",children:h?s("div",{className:"flex flex-col items-center justify-center py-16",children:[a(Y,{size:10,className:"mb-3"}),a("span",{className:"text-neutral03",children:"Loading pricing plans..."})]}):s(C,{children:[De,L&&s("div",{className:"mb-4 flex items-center gap-2 text-sm text-neutral03",children:[a(Y,{size:4}),a("span",{children:"Applying your discount..."})]}),a(ae,{prices:de,onSelectPlan:me,isLoading:c||L,selectedPriceId:x,sortPricesByAmount:l,appliedDiscount:w})]})})]})})})},je=Object.freeze(Object.defineProperty({__proto__:null,UpgradeDialog:ee},Symbol.toStringTag,{value:"Module"})),te="mb-4 flex min-h-[1.5rem] items-center";function Ee(e,t,n){return n?{kind:"loading"}:t?b(e,t)?{kind:"applied",code:t.code,value:X(t.coupon)}:{kind:"none"}:{kind:"none"}}function ne({price:e,discount:t,isValidating:n}){const r=Ee(e,t,n);return r.kind==="none"?null:r.kind==="loading"?a("div",{className:$(te,"animate-pulse"),"aria-hidden":"true","data-testid":"coupon-note-loading",children:a("span",{className:"h-3.5 w-40 rounded bg-muted-foreground/20"})}):a("div",{className:te,"data-testid":"coupon-note-applied",children:a(V,{variant:"success",size:"sm",pill:!0,icon:a(Pe,{"aria-hidden":"true"}),children:`${r.code} \xB7 ${r.value} applied`})})}function re({price:e,seats:t,appliedDiscount:n=null,period:r}){const o=W(e,n,t);if(!o)return null;const{total:i,perSeat:d,discountNote:c}=o;return s("div",{className:"mt-4 border-t border-neutral06 pt-3","data-testid":"plan-seat-total",children:[s("p",{className:"text-sm font-semibold text-neutral01",children:[i," billed ",r]}),s("p",{className:"mt-0.5 text-xs text-neutral03",children:[t," seats \xD7 ",d,c?`, ${c}`:""]})]})}function ae({prices:e,onSelectPlan:t,isLoading:n=!1,selectedPriceId:r=null,sortPricesByAmount:o,appliedDiscount:i=null,subtitleText:d="Instant activation",showCouponNote:c=!1,isValidatingDiscount:f=!1,seats:p}){const u=fe.useMemo(()=>o(e),[e,o]),h=p??0;return u.length===0?a("div",{className:"text-center py-12",children:a("p",{className:"text-neutral03",children:"No pricing plans available at this time."})}):a("div",{className:$("grid gap-6",u.length===1?"grid-cols-1":u.length===2?"grid-cols-1 md:grid-cols-2":"grid-cols-1 md:grid-cols-3"),children:u.map(l=>{const m=J(l,u,i),x=H(l),g=K(l),S=Z(l),A=z(l,!1,i),q=z(l,!0,i),U=b(l,i);return a("div",{className:$("relative border rounded-xl p-6 bg-white transition-all dark:bg-neutral-900",x?"border border-primary":"border border-neutral06",n&&r===l.id&&"opacity-75 pointer-events-none"),children:s("div",{className:"flex flex-col h-full",children:[s("div",{className:"mb-4",children:[s("div",{className:"flex items-center gap-2 mb-1",children:[a("h3",{className:"text-xl font-semibold text-neutral01",children:g}),x&&a(V,{variant:"custom",className:"bg-green06 text-green01 border-0 text-xs font-medium rounded-full px-2.5 py-0.5",children:"Best value"})]}),a("p",{className:$("text-sm","text-neutral03"),children:S})]}),s("div",{className:"mb-6",children:[s("div",{className:"flex items-baseline gap-1 mb-1",children:[U?s(C,{children:[a("span",{className:"text-4xl font-bold text-neutral01",children:q}),a("span",{className:"text-lg text-neutral04 line-through ml-1",children:A})]}):a("span",{className:"text-4xl font-bold text-neutral01",children:A}),a("span",{className:"text-neutral03 text-sm ml-1",children:"per user / month"})]}),s("p",{className:"text-sm text-neutral03",children:[m.originalAmount?s(C,{children:[a("span",{className:"line-through text-neutral04",children:m.originalAmount})," ",a("span",{className:"text-neutral01",children:m.amount})]}):a("span",{children:m.amount})," ","billed ",m.period]}),m.savings&&s("p",{className:"text-sm text-green02 font-medium mt-1",children:["Save ",m.savings]}),h>1&&a(re,{price:l,seats:h,appliedDiscount:i,period:m.period})]}),c&&a(ne,{price:l,discount:i,isValidating:f}),s("div",{className:"mt-auto space-y-3",children:[a(Fe,{onClick:P=>{P.stopPropagation(),t(l.id,l)},disabled:n,isLoading:n&&r===l.id,variant:x?"primary":"outline",className:$("w-full h-11 text-sm font-semibold transition-all"),"data-testid":`upgrade-plan-${g.toLowerCase()}`,children:g==="Monthly"?"Choose Monthly":g==="Quarterly"?"Choose Quarterly":"Choose Yearly"}),a("p",{className:"text-xs text-neutral03 text-center",children:d})]})]})},l.id)})})}export{ne as C,ae as P,re as S,ee as U,W as a,K as b,Q as c,X as d,N as e,z as f,J as g,M as h,Z as i,G as j,R as k,H as l,je as m,b as s};
@@ -1 +0,0 @@
1
- import{jsxs as n,jsx as e,Fragment as re}from"react/jsx-runtime";import S,{useMemo as _,useState as A,useEffect as Ce}from"react";import{f0 as V,f1 as j,bG as v,j as g,f2 as ie,bQ as Ne,f3 as we,f4 as ke,f5 as oe,f6 as Ie,bF as ce,co as Re,f7 as L,f8 as Ae,f9 as O,fa as q,fb as Te,fc as J,fd as Se,fe as de,bP as Ve,ff as $e,cb as ue,fg as Z,fh as Be,c3 as De,c4 as Fe,ca as ze,c5 as Ee,cc as Pe}from"./runtime-Dn4RiA4k.js";const pe="border border-primary01 text-primary01 hover:!bg-transparent hover:!text-primary01",me="border border-transparent text-neutral04 hover:text-neutral02";function Me({value:t,onChange:s}){return n("div",{className:"inline-flex items-center rounded-lg border border-neutral06 p-0.5 shrink-0",children:[e(v,{variant:"ghost",size:"sm","data-testid":"benefits-bca-global-side-employer",onClick:()=>s("employer"),"aria-pressed":t==="employer",className:g("!h-7 px-2.5 text-xs",t==="employer"?pe:me),children:"ER"}),e(v,{variant:"ghost",size:"sm","data-testid":"benefits-bca-global-side-employee",onClick:()=>s("employee"),"aria-pressed":t==="employee",className:g("!h-7 px-2.5 text-xs",t==="employee"?pe:me),children:"EE"})]})}function Ke({global:t,onUpdateGlobal:s,onApplyToAllBands:u,isAgeBased:r,bandCount:a,disabled:i}){const l=r?"bands":"tiers";return n("div",{className:"rounded-lg border border-neutral06 bg-neutral08 p-3 mb-3",children:[n("div",{className:"flex items-center gap-3 flex-wrap",children:[n("span",{className:"text-xs font-semibold text-neutral02",children:["Apply to all ",l,":"]}),n("div",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"text-xs text-neutral03",children:"Contribution"}),e(Me,{value:t.side,onChange:h=>s({side:h})}),e(V,{value:t.employeeValue,type:t.employeeType,onChange:h=>s({employeeValue:h}),testId:"benefits-bca-global-employee-contribution-input"}),e(j,{value:t.employeeType,onChange:h=>s({employeeType:h}),percentTestId:"benefits-bca-global-contribution-type-percent",fixedTestId:"benefits-bca-global-contribution-type-fixed"})]}),n(v,{variant:"outline",size:"sm","data-testid":"benefits-bca-apply-to-all-button",onClick:u,disabled:i||a===0,title:i?"Enter a valid contribution value":`Apply these values to all ${a} ${l}`,children:["Apply to all ",a>0?`${a} `:"",l]})]}),n("p",{className:"mt-2 text-[11px] text-neutral03",children:["Editing these values changes nothing on its own. Click the button to overwrite per-",r?"band":"tier"," values below."]})]})}const he=S.memo(Ke);he.displayName="ApplyToAllBandsBar";function be({instance:t,plan:s}){return t.displayName||s.planName}function je(t,s,u){return s.filter(r=>r.instance.instanceId!==t).map(r=>{const a=u[r.instance.instanceId];return{value:r.instance.instanceId,label:be(r),disabled:a!=null&&a!==t}})}function Le({instance:t,plan:s,displayName:u,baselineForInstanceIds:r,orderedInstances:a,comparePlanInstanceIds:i,onDisplayNameChange:l,onBaselineForInstancesChange:h,showComparisonControls:c=!0}){const y=t.instanceId,N=S.useMemo(()=>new Map(a.map(p=>[p.instance.instanceId,be(p)])),[a]),C=p=>N.get(p)??p,o=je(y,a,i);return n(re,{children:[n("div",{children:[e(ie,{label:"Display Name",borderless:!1,value:u,onChange:l,onBlur:()=>{u.trim()||l(s.planName)},testId:"benefits-bca-display-name-input"}),u&&u!==s.planName&&n("p",{className:"mt-1 text-xs text-neutral04 italic",children:["Original: ",s.planName]})]}),c&&n("div",{className:"flex flex-col gap-1.5",children:[e(Ne,{children:"Select plans to compare against this plan"}),e("div",{"data-testid":"benefits-bca-modal-compare-against-multiselect",children:e(we,{options:o,value:r,onValueChange:h,placeholder:"Select plans\u2026",searchPlaceholder:"Search plans\u2026",emptyMessage:"No other plans to compare.",wrap:!0,usePortal:!0,renderOption:(p,b)=>{const x=i[p.value];return n("span",{"data-testid":`benefits-bca-modal-compare-against-option-${p.value}`,"data-disabled":p.disabled?"true":void 0,"data-checked":b?"true":void 0,className:"flex flex-1 items-center justify-between gap-2 min-w-0",children:[n("span",{className:"flex flex-col min-w-0",children:[e("span",{className:"truncate",children:p.label}),p.disabled&&x&&n("span",{className:"text-xs text-muted-foreground",children:["Compares against ",C(x)]})]}),b&&e(ke,{className:"h-4 w-4 ml-2 flex-shrink-0"})]})}})}),n("p",{className:"text-xs text-neutral03",children:["These plans show their difference measured against"," ",u||s.planName,". Each plan can compare against only one baseline; plans already compared against another are disabled."]})]})]})}const fe=S.memo(Le);fe.displayName="PlanSettingsHeaderFields";const Oe="Counts come from the census for age-banded and per-age plans.";function Ge({rowConfigs:t,tiers:s,costBasis:u="current",isAgeBased:r,onUpdateTier:a,defaultCountForRow:i,showContribution:l=!0,isCountMode:h=!1,showRenewalRate:c=!1,allowAgeCount:y=!1}){const N=u==="renewal",C=r&&!h&&!y;return e("div",{className:"rounded-lg border border-neutral06 overflow-hidden",children:n("table",{className:"w-full text-sm",children:[e("thead",{children:n("tr",{className:"bg-neutral08 border-b border-neutral06",children:[e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03",children:r?"Age band":"Coverage tier"}),e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03",children:c?"Current Rate":N?"Renewal Rate":"Current Rate"}),c&&e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03",children:"Renewal Rate"}),e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03 w-24",children:r?"People":"Census"}),l&&e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03",children:"Contribution"}),e("th",{className:"px-3 py-2 text-left text-xs font-medium text-neutral03 w-14",children:"Reset"})]})}),e("tbody",{className:"divide-y divide-neutral06",children:t.map(o=>{const p=s[o.key];if(!p)return null;const b=c||!N?o.baseCurrentRate:o.baseRenewalRate,x=o.baseRenewalRate,R=i(o),w=()=>a(o.key,{rateCurrent:b!=null?b.toFixed(2):"",rateRenewal:c&&x!=null?x.toFixed(2):"",censusCount:String(R??""),employeeContributionType:L.type,employeeContributionValue:String(L.value),dependentContributionType:L.type,dependentContributionValue:String(L.value),customDisplayName:""});return n("tr",{children:[e("td",{className:"px-3 py-2 text-sm text-neutral01 font-medium",children:e(ie,{value:p.customDisplayName,onChange:f=>a(o.key,{customDisplayName:f}),placeholder:o.defaultLabel,testId:`benefits-bca-tier-display-name-input-${o.key}`})}),e("td",{className:"px-3 py-2",children:e(oe,{value:p.rateCurrent,onChange:f=>a(o.key,{rateCurrent:f}),testId:`benefits-bca-tier-rate-input-${o.key}`})}),c&&e("td",{className:"px-3 py-2",children:e(oe,{value:p.rateRenewal,onChange:f=>a(o.key,{rateRenewal:f}),testId:`benefits-bca-tier-renewal-rate-input-${o.key}`})}),e("td",{className:"px-3 py-2 w-24",children:e(Ie,{value:p.censusCount,onChange:f=>a(o.key,{censusCount:f}),disabled:C,disabledTitle:Oe,testId:`benefits-bca-tier-census-input-${o.key}`})}),l&&e("td",{className:"px-3 py-2",children:n("div",{className:"flex items-center gap-1.5",children:[e(V,{value:p.employeeContributionValue,type:p.employeeContributionType,onChange:f=>a(o.key,{employeeContributionValue:f}),testId:`benefits-bca-tier-employee-contribution-input-${o.key}`}),e(j,{value:p.employeeContributionType,onChange:f=>a(o.key,{employeeContributionType:f,dependentContributionType:f}),percentTestId:`benefits-bca-tier-contribution-type-percent-${o.key}`,fixedTestId:`benefits-bca-tier-contribution-type-fixed-${o.key}`})]})}),e("td",{className:"px-3 py-2 text-center",children:e(ce,{variant:"ghost",size:"sm","data-testid":`benefits-bca-tier-reset-button-${o.key}`,onClick:w,className:"text-neutral04 hover:text-neutral02 h-auto p-1.5",tooltip:r?"Reset band to defaults":"Reset tier to defaults",children:e(Re,{className:"w-4 h-4"})})})]},o.key)})})]})})}const ye=S.memo(Ge);ye.displayName="RateContributionTable";const $="px-3 py-2 text-left text-xs font-medium text-neutral03",G="px-3 py-2 align-middle",ee="text-[10px] uppercase tracking-wide text-neutral04",U="w-20",te=g(U,"shrink-0");function xe({singleValue:t}){return t?e("div",{className:"flex items-center gap-2",children:e("span",{className:g(ee,U),children:"Contribution"})}):n("div",{className:"flex items-center gap-2",children:[e("span",{className:g(ee,U),children:"Current"}),e("span",{className:g(ee,U),children:"Renewal"})]})}function ge({coordinateKey:t,values:s,onChange:u,singleValue:r}){const a=Te(s[t],"percent"),i=c=>u(t,{...a,...c}),l=c=>{const y=Number(c);return Number.isFinite(y)?y:0},h=e(j,{value:a.type,onChange:c=>i({type:c}),percentTestId:`contribution-cell-${t}-type-percent`,fixedTestId:`contribution-cell-${t}-type-fixed`});return r?n("div",{className:"flex items-center gap-2",children:[e("div",{className:te,children:e(V,{type:a.type,value:a.current!=null?String(a.current):"",onChange:c=>i({current:l(c),renewal:l(c)}),widthClassName:"!w-full",ariaLabel:"Contribution",testId:`contribution-cell-${t}`})}),h]}):n("div",{className:"flex items-center gap-2",children:[e("div",{className:te,children:e(V,{type:a.type,value:a.current!=null?String(a.current):"",onChange:c=>i({current:l(c)}),widthClassName:"!w-full",ariaLabel:"Current contribution",testId:`contribution-cell-${t}`})}),e("div",{className:te,children:e(V,{type:a.type,value:a.renewal!=null?String(a.renewal):"",onChange:c=>i({renewal:l(c)}),widthClassName:"!w-full",ariaLabel:"Renewal contribution",testId:`contribution-cell-${t}-renewal`})}),h]})}function Ue({factors:t,coordinates:s,values:u,onChange:r,singleValue:a}){const i=Ae(t,s);return s.length===0?e("p",{className:"text-sm text-neutral04",children:"No buckets to fill for the selected axes."}):i.is2d?e("div",{className:"rounded-lg border border-neutral06 overflow-hidden",children:n("table",{className:"w-full text-sm",children:[n("thead",{children:[n("tr",{className:"bg-neutral08",children:[n("th",{rowSpan:2,className:g($,"border-b border-neutral06 text-neutral04 align-bottom"),children:[O(i.rowAxis)," \\ ",O(i.colAxis)]}),i.colValues.map(l=>e("th",{className:$,children:q(i.colAxis,l)},l))]}),e("tr",{className:"bg-neutral08 border-b border-neutral06",children:i.colValues.map(l=>e("th",{className:g($,"font-normal"),children:e(xe,{singleValue:a})},l))})]}),e("tbody",{className:"divide-y divide-neutral06",children:i.rowValues.map(l=>n("tr",{children:[e("td",{className:g(G,"text-sm text-neutral02"),children:q(i.rowAxis,l)}),i.colValues.map(h=>e("td",{className:G,children:e(ge,{coordinateKey:i.cellKey(l,h),values:u,onChange:r,singleValue:a})},h))]},l))})]})}):e("div",{className:"rounded-lg border border-neutral06 overflow-hidden",children:n("table",{className:"w-full text-sm",children:[e("thead",{children:n("tr",{className:"bg-neutral08 border-b border-neutral06",children:[e("th",{className:$,children:O(i.rowAxis)}),e("th",{className:$,children:e(xe,{singleValue:a})})]})}),e("tbody",{className:"divide-y divide-neutral06",children:i.rowValues.map(l=>n("tr",{children:[e("td",{className:g(G,"text-sm text-neutral02"),children:q(i.rowAxis,l)}),e("td",{className:G,children:e(ge,{coordinateKey:i.cellKey(l),values:u,onChange:r,singleValue:a})})]},l))})]})})}const ve="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",ne="personType",H="border border-primary01 text-primary01 hover:!bg-transparent hover:!text-primary01",Q="border border-transparent text-neutral04 hover:text-neutral02";function He({value:t,onChange:s}){return n("div",{className:"inline-flex items-center rounded-lg border border-neutral06 p-0.5 shrink-0",children:[e(v,{variant:"ghost",size:"sm","data-testid":"contribution-side-employee",onClick:()=>s("employee"),"aria-pressed":t==="employee",className:t==="employee"?H:Q,children:"Employee Contribution"}),e(v,{variant:"ghost",size:"sm","data-testid":"contribution-side-employer",onClick:()=>s("employer"),"aria-pressed":t==="employer",className:t==="employer"?H:Q,children:"Employer Subsidy"})]})}function Qe({value:t,onChange:s}){return n("div",{className:"inline-flex items-center rounded-lg border border-neutral06 p-0.5 shrink-0",children:[e(v,{variant:"ghost",size:"sm","data-testid":"contribution-renewal-direction-increase",onClick:()=>s("increase"),"aria-pressed":t==="increase",className:t==="increase"?H:Q,children:"Increase"}),e(v,{variant:"ghost",size:"sm","data-testid":"contribution-renewal-direction-decrease",onClick:()=>s("decrease"),"aria-pressed":t==="decrease",className:t==="decrease"?H:Q,children:"Decrease"})]})}const ae=t=>{const s=t.trim();if(s==="")return;const u=Number(s);return Number.isFinite(u)?u:void 0};function le({label:t,value:s,onChange:u,type:r,onTypeChange:a,onApply:i,testId:l}){return n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"text-xs text-neutral04",children:t}),e(j,{value:r,onChange:a,percentTestId:`${l}-type-percent`,fixedTestId:`${l}-type-fixed`}),e(ue,{variant:"outlined",size:"sm",type:"number",value:s,onChange:h=>u(h.target.value),onKeyDown:h=>h.key==="Enter"&&i(),className:g("!h-auto !w-20 px-2 py-1",ve),"data-testid":l}),e(v,{variant:"outline",size:"sm",onClick:i,"data-testid":`${l}-apply`,children:"Apply"})]})}function We({bucketsFor:t,defaultDefinition:s,value:u,onChange:r,singleValue:a=!1,hideSplitByDependent:i=!1}){const l=u??s,h=u!=null,c=s.factors.filter(m=>m!==ne),y=l.factors.includes(ne),N=l.factors.join("|"),{droppedCount:C,cellKeys:o}=_(()=>{const{coordinates:m,droppedCount:d}=t(l.factors);return{droppedCount:d,cellKeys:J(l.factors,m)}},[t,N]),p=_(()=>{const m={...l.values};for(const d of o)m[d]==null&&(m[d]=Se(l.type));return m},[o,l.values,l.type]),b=_(()=>({...l,values:p}),[l,p]),[x,R]=A(""),[w,f]=A("percent"),[B,W]=A(""),[D,X]=A("percent"),[F,z]=A(""),[T,Y]=A("increase");Ce(()=>{!i||!y||r(de(b,c,J(c,t(c).coordinates)))},[i,y,c,b,t,r]);const E=m=>{const d=m?[...c,ne]:c,k=J(d,t(d).coordinates);r(de(b,d,k))},P=(m,d,k)=>{const K=ae(d);K!=null&&r({...b,values:Z(b.values,o,m,K,k)})},I=(m,d)=>{const k=ae(m);if(k==null)return;const K=Z(b.values,o,"current",k,d);r({...b,values:Z(K,o,"renewal",k,d)})},M=()=>{const m=ae(F);if(m==null)return;const d=(T==="increase"?1:-1)*Math.abs(m);r({...b,values:Be(b.values,o,d)})};return n("section",{className:"flex flex-col gap-3","data-testid":"contribution-definition-section",children:[n("div",{children:[e("h4",{className:"text-sm font-medium text-neutral01",children:"Contribution table"}),n("p",{className:"text-xs text-neutral04",children:["Set the ",O(c[0]??"")," contribution",i?".":", optionally split by dependent."]})]}),n("div",{className:"flex flex-col rounded-lg border border-neutral06 bg-neutral08",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-3 px-3 py-2.5",children:[e(He,{value:b.side,onChange:m=>r({...b,side:m})}),n("div",{className:"flex items-center gap-2",children:[!i&&n("label",{className:"flex items-center gap-2 text-sm text-neutral02",children:[e(Ve,{checked:y,onChange:E,"data-testid":"contribution-split-person-type"}),"Split by dependent"]}),h&&e(ce,{variant:"ghost",size:"icon",tooltip:"Reset to plan defaults",onClick:()=>r(void 0),className:"text-neutral04 hover:text-destructive","data-testid":"contribution-reset-default",children:e($e,{className:"h-4 w-4"})})]})]}),n("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-neutral07 px-3 py-2.5",children:[e("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral04",children:"Bulk update"}),a?e(le,{label:"Set all",value:x,onChange:R,type:w,onTypeChange:f,onApply:()=>I(x,w),testId:"contribution-bulk-current"}):n(re,{children:[e(le,{label:"Current",value:x,onChange:R,type:w,onTypeChange:f,onApply:()=>P("current",x,w),testId:"contribution-bulk-current"}),e(le,{label:"Renewal",value:B,onChange:W,type:D,onTypeChange:X,onApply:()=>P("renewal",B,D),testId:"contribution-bulk-renewal"})]})]}),!a&&n("div",{className:"flex items-center justify-between gap-2 border-t border-neutral07 px-3 py-2.5",children:[n("div",{className:"flex items-center gap-2",children:[e("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral04",children:"Renewal rate change"}),e(Qe,{value:T,onChange:Y}),e("span",{className:"text-xs text-neutral04",children:"by"}),n("div",{className:"relative",children:[e(ue,{variant:"outlined",size:"sm",type:"number",min:"0",step:"any",value:F,onChange:m=>z(m.target.value),onKeyDown:m=>m.key==="Enter"&&M(),className:g("!h-auto !w-20 px-2 py-1 pr-6",ve),"data-testid":"contribution-renewal-rate-change"}),e("span",{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-xs text-neutral04",children:"%"})]})]}),e(v,{variant:"outline",size:"sm",onClick:M,"data-testid":"contribution-renewal-rate-change-apply",children:"Apply"})]})]}),C>0?n("p",{className:"text-xs text-warning","data-testid":"contribution-dropped-warning",children:[C," ",C===1?"person is":"people are"," missing a selected attribute and won\u2019t be priced."]}):null,e(Ue,{factors:b.factors,coordinates:o,values:b.values,singleValue:a,onChange:(m,d)=>r({...b,values:{...b.values,[m]:d}})})]})}function Xe(t,s){return s?t?"Override rates and census counts per age band. Leave blanks to use the plan default.":"Override rates & census count for specific coverage tiers. Leave blanks to use extracted data from documents":t?"Override rates, census counts, and employer contribution per age band. Leave blanks to use the plan default.":"Override rates & census count for specific coverage tiers. Leave blanks to use extracted data from documents"}function Ye({open:t,instance:s,plan:u,draft:r,onPatch:a,onUpdateTier:i,onUpdateGlobal:l,onApplyToAllBands:h,onApply:c,onClose:y,rowConfigs:N,contributionColumns:C,costBasis:o,isAgeBased:p,comparePlanInstanceIds:b,orderedInstances:x,defaultCountForRow:R,settingsModalSections:w,validation:f,showComparisonControls:B=!0,showRateAndContribution:W=!0,showRenewalRate:D=!1,allowAgeCount:X=!1,showContributionDefinition:F,contributionBucketsFor:z,contributionDefaultDefinition:T,contributionSingleValue:Y,isCountMode:E=!1}){const P=N.length,I=!!F&&z!=null&&T!=null,M=I?"Rate & Census":"Rate & Contribution",m=Xe(p,I);return e(De,{open:t,onOpenChange:d=>!d&&y(),children:n(Fe,{"data-testid":"benefits-bca-plan-settings-modal",className:"!w-[70vw] !max-w-[1100px] max-h-[85vh] overflow-hidden flex flex-col",closeOnOutsideClick:!1,children:[e(ze,{children:n(Ee,{children:["Plan Settings: ",r.displayName||u.planName]})}),e("div",{className:"flex-1 overflow-y-auto p-6",children:n("div",{className:"space-y-6",children:[e(fe,{instance:s,plan:u,displayName:r.displayName,baselineForInstanceIds:r.baselineForInstanceIds,orderedInstances:x,comparePlanInstanceIds:b,onDisplayNameChange:d=>a({displayName:d}),onBaselineForInstancesChange:d=>a({baselineForInstanceIds:d}),showComparisonControls:B}),W&&n("div",{children:[e("h3",{className:"text-sm font-semibold text-neutral01 mb-1",children:M}),e("p",{className:"text-xs text-neutral03 mb-3",children:m}),!I&&e(he,{global:r.globalContribution,onUpdateGlobal:l,onApplyToAllBands:h,contributionColumns:C,isAgeBased:p,bandCount:P,disabled:f.hasInvalidGlobal}),e(ye,{rowConfigs:N,tiers:r.tiers,contributionColumns:C,costBasis:o,isAgeBased:p,onUpdateTier:i,defaultCountForRow:R,showContribution:!I,isCountMode:E,showRenewalRate:D,allowAgeCount:X})]}),I&&e(We,{bucketsFor:z,defaultDefinition:T,value:r.contributionDefinition,onChange:d=>a({contributionDefinition:d}),singleValue:Y,hideSplitByDependent:E}),w==null?void 0:w.map(d=>n("div",{children:[d.title&&e("h3",{className:"text-sm font-semibold text-neutral01 mb-1",children:d.title}),d.render({draftSlice:r,setDraftSlice:k=>a(k),instanceId:s.instanceId,plan:u})]},d.id))]})}),e(Pe,{className:"!justify-end",children:n("div",{className:"flex items-center gap-2",children:[e(v,{variant:"outline","data-testid":"benefits-bca-modal-cancel-button",onClick:y,children:"Cancel"}),e(v,{"data-testid":"benefits-bca-modal-apply-button",onClick:c,disabled:f.hasInvalidContribution,title:f.hasInvalidContribution?"Enter a valid contribution rate for every tier":void 0,children:"Apply"})]})})]})})}const se=S.memo(Ye);se.displayName="PlanSettingsModal";export{se as PlanSettingsModal,se as default};
@@ -1 +0,0 @@
1
- import{jsx as c,jsxs as b}from"react/jsx-runtime";import{useState as C,useCallback as y,useMemo as G,useRef as F,useEffect as K}from"react";import{eQ as H,eR as j,eS as J,bK as X,bL as Y,bN as Z,bO as L,bG as S,ct as ee,bP as ne,j as I,eT as D,c3 as se,c4 as te,ca as ae,c5 as re,eU as le,dD as U,cc as oe}from"./runtime-Dn4RiA4k.js";function ie(n={}){const[l,o]=C(n.stepIndex??0),[a,g]=C(n.billMergeGroups??[]),[u,s]=C(n.censusMergeGroups??[]),[t,r]=C(n.groupMappings??new Map),[p,e]=C(n.dismissedAutoMappings??new Set),x=y(()=>{o(d=>d===0?1:d)},[]),i=y(()=>{o(d=>d===1?0:d)},[]),f=y(d=>{g(d)},[]),h=y(d=>{s(d)},[]),w=y(d=>{r(d)},[]),m=y(d=>{e(d)},[]);return{stepIndex:l,billMergeGroups:a,censusMergeGroups:u,groupMappings:t,dismissedAutoMappings:p,next:x,back:i,setBillMergeGroups:f,setCensusMergeGroups:h,setGroupMappings:w,setDismissedAutoMappings:m}}function O(n,l){const o=j(n??null),a=j(l??null);return o===null||a===null?!0:o===a}function W(n,l){var o,a;const g=new Map,u=new Set;for(const s of l){const t=((o=s.planType)==null?void 0:o.toLowerCase())??null;if(t)for(let r=0;r<n.length;r++){if(u.has(r))continue;const p=n[r],e=((a=p.planType)==null?void 0:a.toLowerCase())??null;if(t===e&&O(s.carrier,p.carrier)){g.set(s.planName,p.planName),u.add(r);break}}}for(const s of l){if(g.has(s.planName))continue;let t=0,r=null;for(let p=0;p<n.length;p++){if(u.has(p))continue;const e=n[p].planName;if(!O(s.carrier,n[p].carrier))continue;const x=H(s.planName.toLowerCase(),e.toLowerCase());x>=.85&&x>t&&(t=x,r=p)}r!==null&&(g.set(s.planName,n[r].planName),u.add(r))}return g}const B="__none__";function _(n,l,o){const a=[],g=new Set;for(const u of n){const s=u.planNames.filter(t=>l.has(t));if(s.length!==0)if(s.length===1){const t=s[0],r=o.get(t);if(!r)continue;a.push({bucketKey:t,planNames:s,bucket:r}),g.add(t)}else{const t=o.get(u.id);if(!t)continue;a.push({bucketKey:u.id,planNames:s,bucket:t});for(const r of s)g.add(r)}}for(const[u,s]of o)g.has(u)||a.some(t=>t.bucketKey===u)||a.push({bucketKey:u,planNames:[u],bucket:s});return a}function ce(n,l,o,a){const g=[];for(const[p,e]of o)g.push({planName:p,planType:e.planType,carrier:e.carrier});const u=[];for(const[p,e]of a)u.push({planName:p,planType:e.planType,carrier:e.carrier});const s=W(u,g),t=new Map;for(const p of l)for(const e of p.planNames)t.set(e,p.bucketKey);const r=new Map;for(const p of n){const e=new Set;let x=!0;for(const i of p.planNames){const f=s.get(i);if(!f){x=!1;break}const h=t.get(f);if(!h){x=!1;break}e.add(h)}x&&e.size===1&&r.set(p.bucketKey,[...e][0])}return r}function pe(n,l){const o=n.map(r=>({planName:r.bucket.planName,planType:r.bucket.planType,carrier:r.bucket.carrier})),a=l.map(r=>({planName:r.bucket.planName,planType:r.bucket.planType,carrier:r.bucket.carrier})),g=W(a,o),u=new Map;for(const r of n)u.set(r.bucket.planName,r.bucketKey);const s=new Map;for(const r of l)s.set(r.bucket.planName,r.bucketKey);const t=new Map;for(const[r,p]of g){const e=u.get(r),x=s.get(p);e&&x&&t.set(e,x)}return t}function ue({billBuckets:n,censusBuckets:l,billGroups:o,censusGroups:a,mergedBillBuckets:g,mergedCensusBuckets:u,groupMappings:s,dismissedAutoMappings:t,onGroupMappingsChange:r,onDismissedAutoMappingsChange:p}){const e=G(()=>_(o,n,g),[o,n,g]),x=G(()=>_(a,l,u),[a,l,u]),i=G(()=>{const m=ce(e,x,n,l),d=pe(e,x),N=new Map;for(const[k,M]of d)N.set(k,M);for(const[k,M]of m)N.set(k,M);return N},[e,x,n,l]),f=F("");K(()=>{const m=new Map(s),d=new Set(m.values());let N=!1;for(const M of e){if(m.has(M.bucketKey)||t.has(M.bucketKey))continue;const v=i.get(M.bucketKey);v&&(d.has(v)||(m.set(M.bucketKey,v),d.add(v),N=!0))}if(!N)return;const k=[...m].sort().join("|");k!==f.current&&(f.current=k,r(m))},[i,e,t,s,r]);const h=y((m,d)=>{const N=new Map(s);if(d!==B){for(const[M,v]of N)v===d&&M!==m&&N.delete(M);N.set(m,d)}else N.delete(m);r(N);const k=new Set(t);d===B?k.add(m):k.delete(m),p(k)},[t,s,p,r]),w=G(()=>x.map(m=>({value:m.bucketKey,label:m.bucket.planName})),[x]);return c("div",{className:"border border-neutral06 rounded-xl overflow-hidden bg-card",children:b("table",{className:"w-full text-sm border-collapse table-fixed",children:[c("thead",{className:"bg-neutral08 border-b border-neutral06",children:b("tr",{children:[b("th",{className:"h-12 px-5 py-3 text-left text-sm font-medium text-neutral01 w-[360px]",children:["Bill Group (",e.length,")"]}),c("th",{className:"h-12 px-5 py-3 text-left text-sm font-medium text-neutral01",children:"Type"}),c("th",{className:"h-12 px-5 py-3 text-center text-sm font-medium text-neutral01 w-28",children:"Enrollees"}),c("th",{className:"h-12 px-5 py-3 text-center text-sm font-medium text-neutral01 w-14"}),c("th",{className:"h-12 px-5 py-3 text-left text-sm font-medium text-neutral01 w-[360px]",children:"Census Group"})]})}),c("tbody",{className:"divide-y divide-neutral06",children:e.length===0?c("tr",{children:c("td",{colSpan:5,className:"px-5 py-6 text-center text-sm text-neutral04",children:"No bill groups available."})}):e.map(m=>{const d=s.get(m.bucketKey)??B;return b("tr",{className:"h-[72px]","data-testid":`mapping-step-row-${m.bucketKey}`,children:[c("td",{className:"px-5 py-4 text-sm font-medium text-neutral01 break-words",children:m.bucket.planName}),c("td",{className:"px-5 py-4 text-sm text-neutral02",children:m.bucket.planType??"-"}),c("td",{className:"px-5 py-4 text-center text-sm text-neutral02",children:m.bucket.employees.length}),c("td",{className:"px-5 py-4 text-center",children:c(J,{className:"h-4 w-4 text-neutral03 inline-block"})}),c("td",{className:"px-5 py-4",children:b(X,{value:d,onValueChange:N=>h(m.bucketKey,N),children:[c(Y,{placeholder:"Select census group",className:"h-9 text-sm","data-testid":`mapping-step-select-${m.bucketKey}`}),b(Z,{children:[c(L,{value:B,children:"(none)"}),w.map(N=>c(L,{value:N.value,children:N.label},N.value))]})]})})]},m.bucketKey)})})]})})}function de(n){const l=n==null?void 0:n.trim().toLowerCase();return l&&l.length>0?l:null}function me(n,l){const o=[];for(const s of l){const t=n.get(s);t&&o.push(t)}if(o.length<2)return 0;const a=new Set(o.map(s=>s.planName)),g=new Map;for(const s of o)for(const t of s.employees)g.set(t,(g.get(t)??0)+1);let u=0;for(const[s,t]of g){if(t<2)continue;const r=new Set;for(const p of s.enrollments){if(p.planName==null||!a.has(p.planName))continue;const e=de(p.coverageTier);e&&r.add(e)}r.size>1&&u++}return u}function E(n){return(n.sourceNames&&n.sourceNames.length>0?[...n.sourceNames].sort():["(unknown source)"]).join("|")}function ge(n){const l=n.split("|");return l.length===1?l[0]:`Shared across: ${l.join(", ")}`}function R({rawBuckets:n,groups:l,onGroupsChange:o}){const[a,g]=C(new Set),u=G(()=>{const i=new Set;for(const f of l)if(!(f.planNames.length<2))for(const h of f.planNames)i.add(h);return i},[l]),s=G(()=>{const i=[];for(const[f,h]of n)u.has(f)||i.push(h);return i},[n,u]),t=G(()=>{const i=new Map;for(const f of s){const h=E(f),w=i.get(h);w?w.push(f):i.set(h,[f])}return[...i.entries()].map(([f,h])=>({sig:f,buckets:h}))},[s]),r=G(()=>{if(a.size===0)return null;for(const i of s)if(a.has(i.planName))return E(i);return null},[a,s]),p=y(i=>{g(f=>{const h=new Set(f);return h.has(i)?(h.delete(i),h):(h.add(i),h)})},[]),e=y(()=>{const i=[...a];if(i.length<2)return;const f={id:crypto.randomUUID(),planNames:i};o([...l,f]),g(new Set)},[l,o,a]),x=y(i=>{o(l.filter(f=>f.id!==i))},[l,o]);return{selected:a,selectedSignature:r,togglePlan:p,sections:t,groupSelected:e,ungroup:x}}function Q({title:n,rawBuckets:l,groups:o,selected:a,selectedSignature:g,sections:u,onTogglePlan:s,onGroupSelected:t,onUngroup:r}){const p=G(()=>o.filter(i=>i.planNames.length>=2),[o]),e=a.size>=2,x=u.length>1;return b("div",{className:"flex flex-col border border-neutral06 rounded-xl overflow-hidden bg-card",children:[b("div",{className:"flex items-center justify-between px-4 py-3 border-b border-neutral06 bg-neutral08",children:[c("span",{className:"text-sm font-semibold text-neutral01",children:n}),b(S,{variant:"primary",size:"sm",disabled:!e,onClick:t,"data-testid":`merge-step-${n.toLowerCase()}-group-button`,children:["Group ",a.size>0?`${a.size} plans`:"plans"]})]}),b("div",{className:"flex-1 overflow-y-auto",children:[p.length===0&&u.length===0&&c("p",{className:"text-sm text-neutral04 text-center py-6",children:"No plans available."}),p.length>0&&c("div",{className:"divide-y divide-neutral06",children:p.map(i=>{const f=me(l,i.planNames),h=new Set;for(const m of i.planNames){const d=l.get(m);if(d)for(const N of d.employees)h.add(N)}const w=i.planNames.join(" + ");return c("div",{className:"px-4 py-3 bg-primary05/10","data-testid":`merge-step-${n.toLowerCase()}-group-${i.id}`,children:b("div",{className:"flex items-start justify-between gap-3",children:[b("div",{className:"min-w-0 flex-1",children:[c("p",{className:"text-sm font-medium text-neutral01 break-words",children:w}),b("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[b("span",{className:"text-xs text-neutral03",children:[h.size," ",h.size===1?"person":"people"]}),f>0&&b(ee,{variant:"warning",size:"xxs",children:[f," tier conflict",f===1?"":"s"]})]})]}),c(S,{variant:"outline",size:"sm",onClick:()=>r(i.id),"data-testid":`merge-step-${n.toLowerCase()}-ungroup-${i.id}`,children:"Ungroup"})]})},i.id)})}),u.map((i,f)=>{const h=g!=null&&g!==i.sig;return b("div",{"data-testid":`merge-step-${n.toLowerCase()}-section-${f}`,className:I(f>0&&"border-t-4 border-neutral06"),children:[x&&c("div",{className:"px-4 py-2 bg-neutral08/60 border-b border-neutral06",children:c("p",{className:"text-[11px] font-semibold text-neutral02 uppercase tracking-wide truncate",children:ge(i.sig)})}),c("div",{className:"divide-y divide-neutral06",children:i.buckets.map(w=>{const m=a.has(w.planName),d=h&&!m;return b("label",{className:I("flex items-center gap-3 px-4 py-3 transition-colors",d?"cursor-not-allowed opacity-50":"cursor-pointer hover:bg-neutral08",m&&"bg-primary05/5"),title:d?"Cross-document merging is not allowed. Clear your selection first.":void 0,children:[c(ne,{"data-testid":`merge-step-${n.toLowerCase()}-plan-checkbox-${w.planName}`,checked:m,disabled:d,onChange:()=>{d||s(w.planName)}}),b("div",{className:"min-w-0 flex-1",children:[c("p",{className:"text-sm font-medium text-neutral01 truncate",children:w.planName}),b("div",{className:"flex items-center gap-2 mt-0.5",children:[w.planType&&c("span",{className:"text-[10px] text-neutral04 uppercase",children:w.planType}),b("span",{className:"text-[10px] text-neutral04",children:[w.employees.length," enrollee",w.employees.length===1?"":"s"]})]})]})]},w.planName)})})]},i.sig)})]})]})}function fe({billBuckets:n,censusBuckets:l,billGroups:o,censusGroups:a,onBillGroupsChange:g,onCensusGroupsChange:u}){const s=R({rawBuckets:n,groups:o,onGroupsChange:g}),t=R({rawBuckets:l,groups:a,onGroupsChange:u});return b("div",{className:"grid grid-cols-2 gap-4 h-full",children:[c(Q,{title:"Bill",rawBuckets:n,groups:o,selected:s.selected,selectedSignature:s.selectedSignature,sections:s.sections,onTogglePlan:s.togglePlan,onGroupSelected:s.groupSelected,onUngroup:s.ungroup}),c(Q,{title:"Census",rawBuckets:l,groups:a,selected:t.selected,selectedSignature:t.selectedSignature,sections:t.sections,onTogglePlan:t.togglePlan,onGroupSelected:t.groupSelected,onUngroup:t.ungroup})]})}const he=[{id:"merge",label:"Merge"},{id:"map",label:"Map"}];function be({open:n,onClose:l,billBuckets:o,censusBuckets:a,initialBillGroups:g,initialCensusGroups:u,initialGroupMappings:s,initialDismissedAutoMappings:t,onSave:r,confirmMode:p}){const e=ie({billMergeGroups:g,censusMergeGroups:u,groupMappings:s,dismissedAutoMappings:t}),{setBillMergeGroups:x,setCensusMergeGroups:i,setGroupMappings:f,setDismissedAutoMappings:h}=e;K(()=>{n&&(x(g),i(u),f(new Map(s)),h(new Set(t)))},[n,g,u,s,t]);const w=G(()=>D(o,e.billMergeGroups),[o,e.billMergeGroups]),m=G(()=>D(a,e.censusMergeGroups),[a,e.censusMergeGroups]);K(()=>{const z=V(e.billMergeGroups,o.keys()),q=V(e.censusMergeGroups,a.keys());let T=!1;const A=new Map;for(const[$,P]of e.groupMappings){if(!z.has($)||!q.has(P)){T=!0;continue}A.set($,P)}T&&f(A)},[e.billMergeGroups,e.censusMergeGroups,o,a]);const d=e.groupMappings.size>0,N=o.size===0,k=a.size===0,M=N||k,v=y(()=>{r({billGroups:e.billMergeGroups,censusGroups:e.censusMergeGroups,groupMappings:new Map(e.groupMappings),dismissedAutoMappings:new Set(e.dismissedAutoMappings)}),l()},[l,r,e.billMergeGroups,e.censusMergeGroups,e.dismissedAutoMappings,e.groupMappings]);return c(se,{open:n,onOpenChange:z=>{!z&&!p&&l()},children:b(te,{"data-testid":"benefits-bill-recon-wizard-modal",className:"w-full max-w-[1280px] max-h-[90vh] overflow-hidden flex flex-col !gap-0",hideCloseButton:p,closeOnOutsideClick:!p,children:[b(ae,{className:"p-5 space-y-3",children:[c(re,{className:"text-xl text-neutral01",children:"Plan Inventory & Mapping"}),c(le,{steps:he,currentStep:e.stepIndex+1})]}),b("div",{className:"flex-1 overflow-y-auto px-5 py-3 min-h-0",children:[e.stepIndex===0&&M&&c(U,{variant:"warning",className:"mb-3",message:xe(N,k)}),e.stepIndex===1&&!d&&c(U,{variant:"info",className:"mb-3",message:"Map the plans to proceed."}),e.stepIndex===0?c(fe,{billBuckets:o,censusBuckets:a,billGroups:e.billMergeGroups,censusGroups:e.censusMergeGroups,onBillGroupsChange:e.setBillMergeGroups,onCensusGroupsChange:e.setCensusMergeGroups}):c(ue,{billBuckets:o,censusBuckets:a,billGroups:e.billMergeGroups,censusGroups:e.censusMergeGroups,mergedBillBuckets:w,mergedCensusBuckets:m,groupMappings:e.groupMappings,dismissedAutoMappings:e.dismissedAutoMappings,onGroupMappingsChange:e.setGroupMappings,onDismissedAutoMappingsChange:e.setDismissedAutoMappings})]}),c(oe,{className:"p-5 sm:justify-between",children:b("div",{className:"flex items-center justify-between w-full",children:[p?c("span",{}):c(S,{variant:"outline","data-testid":"benefits-bill-recon-wizard-cancel",onClick:l,children:"Cancel"}),b("div",{className:"flex items-center gap-3",children:[e.stepIndex===1&&c(S,{variant:"outline","data-testid":"benefits-bill-recon-wizard-back",onClick:e.back,children:"Back"}),e.stepIndex===0?c(S,{variant:"primary","data-testid":"benefits-bill-recon-wizard-next",onClick:e.next,disabled:M,children:"Next"}):c(S,{variant:"primary","data-testid":"benefits-bill-recon-wizard-confirm",onClick:v,disabled:!d,children:"Confirm"})]})]})})]})})}function xe(n,l){return n&&l?"We couldn't find any plan information in the bill or the census. Please re-run with different documents.":n?"We couldn't find any plan information in the bill document. Please re-run with a different bill.":"We couldn't find any plan information in the census document. Please re-run with a different census."}function V(n,l){const o=new Set;for(const a of n)o.add(a.id),a.planNames.length===1&&o.add(a.planNames[0]);for(const a of l)o.add(a);return o}export{be as PlanWizardModal};
@@ -1 +0,0 @@
1
- import{jsx as a,jsxs as i}from"react/jsx-runtime";import{useState as g,useEffect as C,useCallback as h}from"react";import{c3 as N,c4 as v,ca as w,cb as k,cc as y,cz as D,bG as p}from"./runtime-Dn4RiA4k.js";const O=({isOpen:r,onClose:x,onConfirm:m,currentName:s="",isRenaming:t=!1})=>{const[n,o]=g(""),d=e=>{const l=e.lastIndexOf(".");return l>0?e.substring(0,l):e},u=e=>{const l=e.lastIndexOf(".");return l>0?e.substring(l):""};C(()=>{r&&s&&o(d(s))},[r,s]);const c=h(async()=>{if(!n.trim())return;const e=u(s),l=n.trim()+e;await m(l)},[n,s,m]),b=h(e=>{e.key==="Enter"&&!t&&n.trim()&&(e.preventDefault(),c())},[c,t,n]),f=u(s);return a(N,{open:r,onOpenChange:e=>!e&&!t&&x(),children:i(v,{className:"w-full max-w-md p-6",children:[a(w,{className:"text-lg font-semibold",children:"Rename Image"}),i("div",{className:"py-4 px-1",children:[a("label",{className:"block text-sm font-medium text-neutral02 mb-2",children:"New filename"}),i("div",{className:"flex items-center gap-2",children:[a(k,{value:n,onChange:e=>o(e.target.value),onKeyDown:b,placeholder:"Enter new filename",disabled:t,autoFocus:!0,className:"flex-1"}),f&&a("span",{className:"text-sm text-neutral03 shrink-0",children:f})]})]}),i(y,{children:[a(D,{asChild:!0,children:a(p,{variant:"outline",disabled:t,children:"Cancel"})}),a(p,{onClick:c,disabled:t||!n.trim()||n===d(s),isLoading:t,children:"Rename"})]})]})})};export{O as RenameAssetDialog};
@@ -1 +0,0 @@
1
- import{jsx as a,jsxs as m}from"react/jsx-runtime";import{useMemo as T,useState as v,useCallback as B}from"react";import{bD as E,bC as _,ed as g,df as O,bB as I,ee as A,ef as D,c3 as j,c4 as L,ca as M,c5 as P,cb as R,aZ as K,bQ as z,T as H,cc as q,bG as k}from"./runtime-Dn4RiA4k.js";import"react-dom";import"react-dom/client";function C(){const{preferences:d}=E(),{user:n,isSuperAdmin:o}=_(),i=o||(n==null?void 0:n.role)===g.Admin||(n==null?void 0:n.role)===g.SuperAdmin,t=d==null?void 0:d[O.BLOCKS.RESTRICT_NON_ADMIN_BLOCK_CREATION],l=t===!0||t==="true";return T(()=>({canCreateBlocks:i||!l}),[i,l])}const y=({initialTitle:d,initialDescription:n,content:o,contentType:i,onClose:t,isEditing:l,blockId:b,dialogTitle:S,onSuccess:s})=>{const[c,w]=v(d.trim()||"New Block"),[u,N]=v(n||""),[r,h]=v(!1),{toast:p}=I(),{canCreateBlocks:f}=C(),x=B(async()=>{if(!l&&!f){p({title:"Not allowed",description:"Your administrator has disabled creating blocks.",variant:"destructive"});return}h(!0);try{if(l&&b){const e=await A({blockId:b,name:c,content:o,description:u,contentType:i,metadata:{}});e.statusCode!==200?p({title:"Error",description:"Error updating block. Please try again.",variant:"destructive"}):s==null||s(e.data)}else{const e=await D({name:c,content:o,description:u,contentType:i,metadata:{}});e.statusCode!==200?p({title:"Error",description:"Error creating block. Please try again.",variant:"destructive"}):s==null||s(e.data)}t()}finally{h(!1)}},[c,u,o,i,t,l,b,f,p,s]);return a(j,{open:!0,onOpenChange:e=>!e&&t(),children:m(L,{className:"w-full sm:max-w-[900px]",closeOnOutsideClick:!1,children:[a(M,{children:a(P,{children:S||"Save Section as Block"})}),m("div",{className:"p-4 space-y-4 max-h-[60vh] overflow-y-auto",children:[a("div",{className:"space-y-2",children:a(R,{value:c,onChange:e=>w(e.target.value),placeholder:"Enter block title",disabled:r,label:"Title",required:!0})}),a("div",{className:"space-y-2",children:a(K,{value:u,onChange:e=>N(e.target.value),placeholder:"Enter block description (optional)",rows:3,disabled:r,label:"Description",expandable:!1})}),m("div",{className:"flex flex-col gap-2",children:[a(z,{children:"Preview"}),a("div",{className:"mt-1 w-full p-3 !pt-0 border text-sm max-h-[25vh] overflow-y-auto prose prose-sm max-w-none block-editor !shadow-none !rounded-md focus:outline-none",dangerouslySetInnerHTML:{__html:H(o,"BlockContent")},contentEditable:!0})]})]}),m(q,{className:"border-t border-border-primary",children:[a(k,{variant:"outline",onClick:t,disabled:r,children:"Cancel"}),a(k,{onClick:x,disabled:!c||r,isLoading:r,children:r?"Saving...":"Save Block"})]})]})})},F=Object.freeze(Object.defineProperty({__proto__:null,SaveBlockDialog:y},Symbol.toStringTag,{value:"Module"}));export{y as S,F as a,C as u};
@@ -1 +0,0 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as b}from"react";import{bB as x,ch as C,c3 as O,c4 as y,ca as N,c5 as S,bQ as w,cb as F,cc as E,bG as p}from"./runtime-Dn4RiA4k.js";const k=({isOpen:h,setIsOpen:c,outlines:t,onSuccess:u,onCreateOutline:v,isCreating:n})=>{const[d,s]=b(""),{toast:o}=x(),{captureException:g}=C(),f=async i=>{i.preventDefault();const l=new FormData(i.target).get("name");if(!l.trim()){o({title:"Error",description:"Please enter an outline name",variant:"destructive"});return}if(!t||t.length===0){o({title:"Error",description:"No outlines to save",variant:"destructive"});return}try{const a=await v({name:l.trim(),outlines:[...t]});await(u==null?void 0:u(a)),c(!1),s("")}catch(a){o({title:"Failed to save outline",description:a instanceof Error?a.message:"An unknown error occurred",variant:"destructive"}),g({error:a,extra:{outlineName:l,outlinesCount:t.length,outlines:JSON.stringify(t)}})}},m=()=>{n||(c(!1),s(""))};return e(O,{open:h,onOpenChange:m,children:e(y,{className:"sm:max-w-[425px]",closeOnOutsideClick:!1,children:r("form",{onSubmit:f,children:[e(N,{children:e(S,{children:"Save Outline"})}),r("div",{className:"grid gap-4 p-4",children:[e("p",{className:"text-sm text-neutral02",children:"Give this outline a name so you can easily find it later."}),r("div",{className:"grid gap-2",children:[e(w,{htmlFor:"name",children:"Outline name"}),e(F,{id:"name",name:"name",required:!0,autoFocus:!0,placeholder:"e.g., Commercial Auto Proposal",value:d,onChange:i=>s(i.target.value),disabled:n})]})]}),r(E,{children:[e(p,{variant:"outline",type:"button",onClick:m,disabled:n,children:"Cancel"}),e(p,{type:"submit",isLoading:n,disabled:n||!d.trim(),children:"Save"})]})]})})})};export{k as default};