@veevarts/design-system 2.0.0-beta.7 → 2.0.0-csm.1

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 (256) hide show
  1. package/README.md +36 -0
  2. package/dist/components/Drawer/Drawer.d.ts +17 -0
  3. package/dist/components/Drawer/index.d.ts +2 -0
  4. package/dist/components/Modal/CloseButton.d.ts +18 -0
  5. package/dist/components/Modal/Modal.d.ts +15 -0
  6. package/dist/components/Modal/index.d.ts +2 -0
  7. package/dist/components/Modal/useLabelledCloseButton.d.ts +13 -0
  8. package/dist/components/Select/Select.d.ts +10 -0
  9. package/dist/components/Table/Table.d.ts +7 -0
  10. package/dist/components/Table/index.d.ts +2 -0
  11. package/dist/components/index.d.ts +6 -0
  12. package/dist/index.cjs +10 -9
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.js +11290 -5926
  15. package/dist/patterns/ActivityTimeline/ActivityTimeline.d.ts +3 -0
  16. package/dist/patterns/ActivityTimeline/index.d.ts +2 -0
  17. package/dist/patterns/ActivityTimeline/styles.d.ts +15 -0
  18. package/dist/patterns/ActivityTimeline/types.d.ts +15 -0
  19. package/dist/patterns/AdminTable/AdminTable.d.ts +1 -0
  20. package/dist/patterns/AdminTable/styles.d.ts +6 -0
  21. package/dist/patterns/AdminToolbar/AdminToolbar.d.ts +13 -2
  22. package/dist/patterns/AdminToolbar/index.d.ts +1 -0
  23. package/dist/patterns/AdminToolbar/styles.d.ts +49 -0
  24. package/dist/patterns/AdminToolbar/types.d.ts +2 -0
  25. package/dist/patterns/AmountList/AmountList.d.ts +3 -0
  26. package/dist/patterns/AmountList/index.d.ts +2 -0
  27. package/dist/patterns/AmountList/styles.d.ts +23 -0
  28. package/dist/patterns/AmountList/types.d.ts +26 -0
  29. package/dist/patterns/ArtifactCard/ArtifactCard.d.ts +19 -0
  30. package/dist/patterns/ArtifactCard/index.d.ts +2 -0
  31. package/dist/patterns/ArtifactCard/styles.d.ts +31 -0
  32. package/dist/patterns/ArtifactCard/types.d.ts +34 -0
  33. package/dist/patterns/AssistantActivity/AssistantActivity.d.ts +15 -0
  34. package/dist/patterns/AssistantActivity/formatAssistantDuration.d.ts +10 -0
  35. package/dist/patterns/AssistantActivity/index.d.ts +3 -0
  36. package/dist/patterns/AssistantActivity/styles.d.ts +31 -0
  37. package/dist/patterns/AssistantActivity/types.d.ts +37 -0
  38. package/dist/patterns/AssistantComposer/AssistantComposer.d.ts +15 -0
  39. package/dist/patterns/AssistantComposer/index.d.ts +2 -0
  40. package/dist/patterns/AssistantComposer/styles.d.ts +27 -0
  41. package/dist/patterns/AssistantComposer/types.d.ts +48 -0
  42. package/dist/patterns/AssistantMarkdown/AssistantMarkdown.d.ts +17 -0
  43. package/dist/patterns/AssistantMarkdown/index.d.ts +3 -0
  44. package/dist/patterns/AssistantMarkdown/parser.d.ts +37 -0
  45. package/dist/patterns/AssistantMarkdown/styles.d.ts +35 -0
  46. package/dist/patterns/AssistantMarkdown/types.d.ts +37 -0
  47. package/dist/patterns/AssistantMessage/AssistantMessage.d.ts +17 -0
  48. package/dist/patterns/AssistantMessage/index.d.ts +2 -0
  49. package/dist/patterns/AssistantMessage/styles.d.ts +45 -0
  50. package/dist/patterns/AssistantMessage/types.d.ts +73 -0
  51. package/dist/patterns/AssistantNotice/AssistantNotice.d.ts +17 -0
  52. package/dist/patterns/AssistantNotice/index.d.ts +2 -0
  53. package/dist/patterns/AssistantNotice/styles.d.ts +36 -0
  54. package/dist/patterns/AssistantNotice/types.d.ts +46 -0
  55. package/dist/patterns/CardList/CardList.d.ts +3 -0
  56. package/dist/patterns/CardList/index.d.ts +2 -0
  57. package/dist/patterns/CardList/styles.d.ts +20 -0
  58. package/dist/patterns/CardList/types.d.ts +20 -0
  59. package/dist/patterns/CardStack/CardStack.d.ts +7 -0
  60. package/dist/patterns/CardStack/index.d.ts +2 -0
  61. package/dist/patterns/CardStack/styles.d.ts +2 -0
  62. package/dist/patterns/CashTenderForm/types.d.ts +6 -0
  63. package/dist/patterns/CellText/CellText.d.ts +16 -0
  64. package/dist/patterns/CellText/index.d.ts +2 -0
  65. package/dist/patterns/CellText/styles.d.ts +7 -0
  66. package/dist/patterns/CitationMarker/CitationMarker.d.ts +16 -0
  67. package/dist/patterns/CitationMarker/index.d.ts +2 -0
  68. package/dist/patterns/CitationMarker/styles.d.ts +19 -0
  69. package/dist/patterns/CitationMarker/types.d.ts +12 -0
  70. package/dist/patterns/DiscardGuard/DiscardGuard.d.ts +23 -0
  71. package/dist/patterns/DiscardGuard/context.d.ts +25 -0
  72. package/dist/patterns/DiscardGuard/index.d.ts +6 -0
  73. package/dist/patterns/DiscardGuard/useDiscardGuard.d.ts +38 -0
  74. package/dist/patterns/DonationAmounts/index.d.ts +1 -1
  75. package/dist/patterns/DonationAmounts/styles.d.ts +32 -0
  76. package/dist/patterns/DonationAmounts/types.d.ts +55 -1
  77. package/dist/patterns/DonationAmounts/utils/currency.d.ts +7 -3
  78. package/dist/patterns/EntityRow/EntityList.d.ts +9 -0
  79. package/dist/patterns/EntityRow/EntityRow.d.ts +3 -0
  80. package/dist/patterns/EntityRow/context.d.ts +2 -0
  81. package/dist/patterns/EntityRow/icons.d.ts +3 -0
  82. package/dist/patterns/EntityRow/index.d.ts +3 -0
  83. package/dist/patterns/EntityRow/initials.d.ts +6 -0
  84. package/dist/patterns/EntityRow/styles.d.ts +59 -0
  85. package/dist/patterns/EntityRow/types.d.ts +118 -0
  86. package/dist/patterns/FilterSelect/FilterSelect.d.ts +3 -0
  87. package/dist/patterns/FilterSelect/FilterSelectGroup.d.ts +3 -0
  88. package/dist/patterns/FilterSelect/index.d.ts +3 -0
  89. package/dist/patterns/FilterSelect/styles.d.ts +17 -0
  90. package/dist/patterns/FilterSelect/types.d.ts +19 -0
  91. package/dist/patterns/InlineConfirm/InlineConfirm.d.ts +38 -0
  92. package/dist/patterns/InlineConfirm/index.d.ts +2 -0
  93. package/dist/patterns/InlineConfirm/styles.d.ts +16 -0
  94. package/dist/patterns/InstallmentFundAssignment/InstallmentFundAssignment.d.ts +1 -1
  95. package/dist/patterns/InstallmentFundAssignment/types.d.ts +3 -0
  96. package/dist/patterns/InstallmentSchedule/InstallmentSchedule.d.ts +1 -1
  97. package/dist/patterns/InstallmentSchedule/InstallmentTable.d.ts +1 -1
  98. package/dist/patterns/InstallmentSchedule/types.d.ts +46 -3
  99. package/dist/patterns/InstallmentSchedule/utils.d.ts +21 -0
  100. package/dist/patterns/KeyValueChip/KeyValueChip.d.ts +1 -0
  101. package/dist/patterns/KeyValueRows/KeyValueRows.d.ts +13 -0
  102. package/dist/patterns/KeyValueRows/index.d.ts +2 -0
  103. package/dist/patterns/KeyValueRows/styles.d.ts +8 -0
  104. package/dist/patterns/LineItemRows/LineItemRows.d.ts +17 -0
  105. package/dist/patterns/LineItemRows/index.d.ts +2 -0
  106. package/dist/patterns/LineItemRows/styles.d.ts +13 -0
  107. package/dist/patterns/ListPanel/ListPanel.d.ts +2 -0
  108. package/dist/patterns/LoadMoreFooter/LoadMoreFooter.d.ts +3 -0
  109. package/dist/patterns/LoadMoreFooter/index.d.ts +2 -0
  110. package/dist/patterns/LoadMoreFooter/styles.d.ts +7 -0
  111. package/dist/patterns/LoadMoreFooter/types.d.ts +10 -0
  112. package/dist/patterns/MetaCard/types.d.ts +2 -0
  113. package/dist/patterns/ModalPanels/ModalPanels.d.ts +35 -0
  114. package/dist/patterns/ModalPanels/context.d.ts +20 -0
  115. package/dist/patterns/ModalPanels/focus.d.ts +44 -0
  116. package/dist/patterns/ModalPanels/index.d.ts +6 -0
  117. package/dist/patterns/ModalPanels/styles.d.ts +13 -0
  118. package/dist/patterns/ModalPanels/useModalPanels.d.ts +30 -0
  119. package/dist/patterns/OutcomeView/index.d.ts +1 -1
  120. package/dist/patterns/OutcomeView/types.d.ts +110 -3
  121. package/dist/patterns/PageHeader/PageHeader.d.ts +1 -0
  122. package/dist/patterns/PaginationSummary/PaginationSummary.d.ts +12 -0
  123. package/dist/patterns/PaginationSummary/index.d.ts +1 -1
  124. package/dist/patterns/PaymentSubAmountInput/PaymentSubAmountInput.d.ts +2 -0
  125. package/dist/patterns/PillTabs/PillTabs.d.ts +3 -0
  126. package/dist/patterns/PillTabs/ids.d.ts +9 -0
  127. package/dist/patterns/PillTabs/index.d.ts +3 -0
  128. package/dist/patterns/PillTabs/styles.d.ts +20 -0
  129. package/dist/patterns/PillTabs/types.d.ts +21 -0
  130. package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/type.d.ts +1 -1
  131. package/dist/patterns/{EventDetails → Programs/EventDetails}/EventDetails.d.ts +3 -1
  132. package/dist/patterns/{OfferCard → Programs/OfferCard}/OfferCard.d.ts +1 -1
  133. package/dist/patterns/{OfferCard → Programs/OfferCard}/types.d.ts +7 -0
  134. package/dist/patterns/Programs/ProgramListItem/ProgramListItem.d.ts +17 -0
  135. package/dist/patterns/Programs/ProgramListItem/index.d.ts +2 -0
  136. package/dist/patterns/Programs/index.d.ts +5 -0
  137. package/dist/patterns/ReasonSelect/types.d.ts +1 -0
  138. package/dist/patterns/RecordCard/RecordCard.d.ts +3 -0
  139. package/dist/patterns/RecordCard/index.d.ts +2 -0
  140. package/dist/patterns/RecordCard/styles.d.ts +16 -0
  141. package/dist/patterns/RecordCard/types.d.ts +22 -0
  142. package/dist/patterns/RecordHeader/RecordHeader.d.ts +3 -0
  143. package/dist/patterns/RecordHeader/index.d.ts +2 -0
  144. package/dist/patterns/RecordHeader/styles.d.ts +43 -0
  145. package/dist/patterns/RecordHeader/types.d.ts +30 -0
  146. package/dist/patterns/RecordLayout/RecordLayout.d.ts +3 -0
  147. package/dist/patterns/RecordLayout/index.d.ts +2 -0
  148. package/dist/patterns/RecordLayout/styles.d.ts +8 -0
  149. package/dist/patterns/RecordLayout/types.d.ts +6 -0
  150. package/dist/patterns/RecordTotals/RecordTotals.d.ts +19 -0
  151. package/dist/patterns/RecordTotals/index.d.ts +2 -0
  152. package/dist/patterns/RecordTotals/styles.d.ts +19 -0
  153. package/dist/patterns/RefundMethodCards/RefundMethodCards.d.ts +4 -0
  154. package/dist/patterns/RefundMethodCards/index.d.ts +2 -0
  155. package/dist/patterns/RefundMethodCards/styles.d.ts +59 -0
  156. package/dist/patterns/RefundMethodCards/types.d.ts +72 -0
  157. package/dist/patterns/RefundProgressList/RefundProgressList.d.ts +4 -0
  158. package/dist/patterns/RefundProgressList/index.d.ts +2 -0
  159. package/dist/patterns/RefundProgressList/styles.d.ts +44 -0
  160. package/dist/patterns/RefundProgressList/types.d.ts +37 -0
  161. package/dist/patterns/RelatedRecordList/RelatedRecordList.d.ts +3 -0
  162. package/dist/patterns/RelatedRecordList/index.d.ts +2 -0
  163. package/dist/patterns/RelatedRecordList/styles.d.ts +19 -0
  164. package/dist/patterns/RelatedRecordList/types.d.ts +17 -0
  165. package/dist/patterns/ScrollToLatest/ScrollToLatest.d.ts +16 -0
  166. package/dist/patterns/ScrollToLatest/index.d.ts +2 -0
  167. package/dist/patterns/ScrollToLatest/styles.d.ts +11 -0
  168. package/dist/patterns/ScrollToLatest/types.d.ts +27 -0
  169. package/dist/patterns/SessionExpiredCard/SessionExpiredCard.d.ts +14 -0
  170. package/dist/patterns/SessionExpiredCard/index.d.ts +2 -0
  171. package/dist/patterns/SessionExpiredCard/type.d.ts +6 -0
  172. package/dist/patterns/SourceList/SourceList.d.ts +12 -0
  173. package/dist/patterns/SourceList/index.d.ts +2 -0
  174. package/dist/patterns/SourceList/styles.d.ts +20 -0
  175. package/dist/patterns/SourceList/types.d.ts +28 -0
  176. package/dist/patterns/SourcePill/SourcePill.d.ts +13 -0
  177. package/dist/patterns/SourcePill/index.d.ts +2 -0
  178. package/dist/patterns/SourcePill/styles.d.ts +19 -0
  179. package/dist/patterns/SourcePill/types.d.ts +19 -0
  180. package/dist/patterns/SplitPaymentSummary/index.d.ts +1 -1
  181. package/dist/patterns/SplitPaymentSummary/types.d.ts +18 -0
  182. package/dist/patterns/StatTiles/StatTiles.d.ts +3 -0
  183. package/dist/patterns/StatTiles/index.d.ts +2 -0
  184. package/dist/patterns/StatTiles/styles.d.ts +8 -0
  185. package/dist/patterns/StatTiles/types.d.ts +12 -0
  186. package/dist/patterns/StatusChip/StatusChip.d.ts +3 -3
  187. package/dist/patterns/StepProgress/StepProgress.d.ts +4 -0
  188. package/dist/patterns/StepProgress/index.d.ts +2 -0
  189. package/dist/patterns/StepProgress/styles.d.ts +29 -0
  190. package/dist/patterns/StepProgress/types.d.ts +43 -0
  191. package/dist/patterns/Summary/components/ActionBar.d.ts +2 -0
  192. package/dist/patterns/Summary/components/GrandTotalRow.d.ts +1 -0
  193. package/dist/patterns/Summary/components/ItemRow.d.ts +1 -0
  194. package/dist/patterns/Summary/components/SummaryBody.d.ts +4 -1
  195. package/dist/patterns/Summary/components/TotalsLineRow.d.ts +3 -2
  196. package/dist/patterns/Summary/types.d.ts +51 -9
  197. package/dist/patterns/TableSkeleton/TableSkeleton.d.ts +1 -0
  198. package/dist/patterns/TileSelect/TileSelect.d.ts +80 -2
  199. package/dist/patterns/TileSelect/index.d.ts +1 -1
  200. package/dist/patterns/TileSelect/styles.d.ts +14 -0
  201. package/dist/patterns/ToolbarButton/ToolbarButton.d.ts +2 -0
  202. package/dist/patterns/UnderlineTabs/UnderlineTabs.d.ts +20 -1
  203. package/dist/patterns/UnderlineTabs/index.d.ts +1 -1
  204. package/dist/patterns/UnderlineTabs/styles.d.ts +10 -0
  205. package/dist/patterns/WizardShell/index.d.ts +1 -1
  206. package/dist/patterns/WizardShell/types.d.ts +9 -1
  207. package/dist/patterns/grid-columns.d.ts +1 -1
  208. package/dist/patterns/index.d.ts +87 -17
  209. package/dist/patterns/shared/hasContent.d.ts +2 -0
  210. package/dist/patterns/shared/index.d.ts +1 -0
  211. package/dist/patterns/shared/motion.d.ts +6 -0
  212. package/dist/patterns/shared/recordTone.d.ts +9 -0
  213. package/dist/patterns/shared/rem.d.ts +4 -0
  214. package/dist/patterns/shared/useContainerWidth.d.ts +6 -0
  215. package/dist/patterns/shared/useDecimalDraft.d.ts +33 -0
  216. package/dist/patterns/shared/usePrefillEdits.d.ts +7 -0
  217. package/dist/providers/DensityProvider.d.ts +7 -0
  218. package/dist/providers/HeroUIProvider.d.ts +14 -1
  219. package/dist/providers/close-label-context.d.ts +18 -0
  220. package/dist/providers/density.d.ts +17 -0
  221. package/dist/providers/index.d.ts +4 -0
  222. package/dist/tailwind/index.cjs +107 -5
  223. package/dist/tailwind/index.d.ts +61 -0
  224. package/dist/tailwind/index.mjs +104 -5
  225. package/dist/test/ReducedMotion.d.ts +4 -0
  226. package/dist/test/RootFontSize.d.ts +5 -0
  227. package/dist/test/backdrop.d.ts +12 -0
  228. package/dist/test/container-width.d.ts +14 -0
  229. package/dist/test/contrast.d.ts +1 -0
  230. package/dist/test/px-class-names.d.ts +1 -0
  231. package/dist/test/px-classes.d.ts +3 -0
  232. package/dist/test/root-font-size.d.ts +8 -0
  233. package/dist/tokens/assistant-surface.d.ts +66 -0
  234. package/dist/tokens/index.d.ts +2 -0
  235. package/dist/tokens/pos-surface.d.ts +23 -4
  236. package/package.json +5 -2
  237. /package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/CatalogItemCard.d.ts +0 -0
  238. /package/dist/patterns/{CatalogItemCard → Programs/CatalogItemCard}/index.d.ts +0 -0
  239. /package/dist/patterns/{EventDetails → Programs/EventDetails}/index.d.ts +0 -0
  240. /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/CustomQuantitySelectorExample.d.ts +0 -0
  241. /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/ListWithEurosCurrencyExample.d.ts +0 -0
  242. /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/ListWithoutAnimationExample.d.ts +0 -0
  243. /package/dist/patterns/{OfferCard → Programs/OfferCard}/examples/index.d.ts +0 -0
  244. /package/dist/patterns/{OfferCard → Programs/OfferCard}/index.d.ts +0 -0
  245. /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/animations.d.ts +0 -0
  246. /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/currency.d.ts +0 -0
  247. /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/index.d.ts +0 -0
  248. /package/dist/patterns/{OfferCard → Programs/OfferCard}/utils/offers.d.ts +0 -0
  249. /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardEmpty.d.ts +0 -0
  250. /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardError.d.ts +0 -0
  251. /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardList.d.ts +0 -0
  252. /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/OfferCardSkeleton.d.ts +0 -0
  253. /package/dist/patterns/{OfferCard → Programs/OfferCard}/variants/index.d.ts +0 -0
  254. /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/SessionTimeline.d.ts +0 -0
  255. /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/index.d.ts +0 -0
  256. /package/dist/patterns/{SessionTimeline → Programs/SessionTimeline}/type.d.ts +0 -0
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),p=require("react"),G=require("lucide-react"),Ce=require("framer-motion"),yn=require("@tiptap/react"),Jn=require("@tiptap/core"),Ci=require("@tiptap/extension-bold"),ki=require("@tiptap/extension-italic"),Si=require("@tiptap/extension-strike"),Ai=require("@tiptap/extension-underline"),$i=require("@tiptap/extension-code"),Di=require("@tiptap/extension-color"),Ei=require("@tiptap/extension-highlight"),Fi=require("@tiptap/extension-link"),Mi=require("@tiptap/extension-text-style"),Li=require("@tiptap/extension-heading"),Ii=require("@tiptap/extension-paragraph"),Ti=require("@tiptap/extension-bullet-list"),_i=require("@tiptap/extension-ordered-list"),Pi=require("@tiptap/extension-task-list"),Oi=require("@tiptap/extension-task-item"),Ri=require("@tiptap/extension-list-item"),zi=require("@tiptap/extension-code-block"),Bi=require("@tiptap/extension-blockquote"),Vi=require("@tiptap/extension-horizontal-rule"),Ui=require("@tiptap/extension-hard-break"),es=require("@tiptap/extension-history"),Hi=require("@tiptap/extension-text-align"),qi=require("@tiptap/extension-document"),Wi=require("@tiptap/extension-text"),Yi=require("@tiptap/extension-dropcursor"),Gi=require("@tiptap/extension-gapcursor"),ge={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},ie={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},oe={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:ht}=ge.neutral,Ki=ge.palettes.warning[700],Qi=ge.palettes.warning[100],ze={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},vn={"--rust":ge.brand.primary[500],"--rust-fill":ze.rustFill,"--rust-border":ze.rustBorder,"--page":ze.page,"--surface":ge.neutral.white,"--border":ze.border,"--hair":ze.hair,"--ink":ht[900],"--ink2":ht[700],"--sub":ht[500],"--muted":ht[400],"--ok":ge.semantic.success,"--ok-fill":ze.okFill,"--warn":Ki,"--warn-fill":Qi,"--danger":ge.semantic.danger,"--danger-fill":ze.dangerFill,"--info":ge.semantic.info,"--info-fill":ze.infoFill};Object.fromEntries(Object.entries(vn).map(([e,n])=>[e.replace(/^--/,""),n]));function Zi({scope:e=".acct",fontFamily:n="'NeueMontreal', system-ui, sans-serif"}={}){const s=Object.entries(vn).map(([r,i])=>` ${r}: ${i};`).join(`
2
- `),a=n?`
3
- font-family: ${n};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),x=require("react"),J=require("lucide-react"),Ie=require("framer-motion"),In=require("@tiptap/react"),Ea=require("@tiptap/core"),Mc=require("@tiptap/extension-bold"),Pc=require("@tiptap/extension-italic"),Tc=require("@tiptap/extension-strike"),Ic=require("@tiptap/extension-underline"),Oc=require("@tiptap/extension-code"),zc=require("@tiptap/extension-color"),Bc=require("@tiptap/extension-highlight"),Vc=require("@tiptap/extension-link"),Uc=require("@tiptap/extension-text-style"),Hc=require("@tiptap/extension-heading"),Wc=require("@tiptap/extension-paragraph"),qc=require("@tiptap/extension-bullet-list"),Gc=require("@tiptap/extension-ordered-list"),Kc=require("@tiptap/extension-task-list"),Yc=require("@tiptap/extension-task-item"),Qc=require("@tiptap/extension-list-item"),Zc=require("@tiptap/extension-code-block"),Xc=require("@tiptap/extension-blockquote"),Jc=require("@tiptap/extension-horizontal-rule"),ed=require("@tiptap/extension-hard-break"),Da=require("@tiptap/extension-history"),td=require("@tiptap/extension-text-align"),sd=require("@tiptap/extension-document"),nd=require("@tiptap/extension-text"),ad=require("@tiptap/extension-dropcursor"),rd=require("@tiptap/extension-gapcursor"),id=require("markdown-it"),Ee={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"},info:{100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#2563EB",600:"#1d4ed8",800:"#1e3a8a",900:"#172554"}}},xe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ge={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:cs}=Ee.neutral,ld=Ee.palettes.warning[700],od=Ee.palettes.warning[100],pt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},On={"--rust":Ee.brand.primary[500],"--rust-fill":pt.rustFill,"--rust-border":pt.rustBorder,"--page":pt.page,"--surface":Ee.neutral.white,"--border":pt.border,"--hair":pt.hair,"--ink":cs[900],"--ink2":cs[700],"--sub":cs[500],"--muted":cs[400],"--ok":Ee.semantic.success,"--ok-fill":pt.okFill,"--warn":ld,"--warn-fill":od,"--danger":Ee.semantic.danger,"--danger-fill":pt.dangerFill,"--info":Ee.semantic.info,"--info-fill":pt.infoFill};Object.fromEntries(Object.entries(On).map(([e,s])=>[e.replace(/^--/,""),s]));function cd({scope:e=".acct",fontFamily:s="'NeueMontreal', system-ui, sans-serif"}={}){const n=Object.entries(On).map(([r,i])=>` ${r}: ${i};`).join(`
2
+ `),a=s?`
3
+ font-family: ${s};
4
4
  color: var(--ink);`:"";return`${e} {
5
- ${s}${a}
5
+ ${n}${a}
6
6
  }
7
- `}const jn={line:"#E7E7E9","line-2":"#F1F1F3","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:ge.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8",destructive:"#A32D2D"};({...jn});function Xi({children:e}){return t.jsx(c.HeroUIProvider,{children:e})}function Ji(e,n){const s=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(l){if(s[l])return r[l]=[];if(!(l in r)){r[l]=null;const o=a[l]&&a[l].parent,d=o&&i(o);d&&(r[l]=[o].concat(d))}return r[l]}return Object.keys(s).concat(Object.keys(a)).forEach(i),r}const Gs=Object.freeze({left:0,top:0,width:16,height:16}),vt=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),wn=Object.freeze({...Gs,...vt}),sn=Object.freeze({...wn,body:"",hidden:!1});function el(e,n){const s={};!e.hFlip!=!n.hFlip&&(s.hFlip=!0),!e.vFlip!=!n.vFlip&&(s.vFlip=!0);const a=((e.rotate||0)+(n.rotate||0))%4;return a&&(s.rotate=a),s}function ts(e,n){const s=el(e,n);for(const a in sn)a in vt?a in e&&!(a in s)&&(s[a]=vt[a]):a in n?s[a]=n[a]:a in e&&(s[a]=e[a]);return s}function tl(e,n,s){const a=e.icons,r=e.aliases||Object.create(null);let i={};function l(o){i=ts(a[o]||r[o],i)}return l(n),s.forEach(l),ts(e,i)}function Ks(e,n){const s=[];if(typeof e!="object"||typeof e.icons!="object")return s;e.not_found instanceof Array&&e.not_found.forEach(r=>{n(r,null),s.push(r)});const a=Ji(e);for(const r in a){const i=a[r];i&&(n(r,tl(e,r,i)),s.push(r))}return s}const nl={provider:"",aliases:{},not_found:{},...Gs};function Pt(e,n){for(const s in n)if(s in e&&typeof e[s]!=typeof n[s])return!1;return!0}function Qs(e){if(typeof e!="object"||e===null)return null;const n=e;if(typeof n.prefix!="string"||!e.icons||typeof e.icons!="object"||!Pt(e,nl))return null;const s=n.icons;for(const r in s){const i=s[r];if(!r||typeof i.body!="string"||!Pt(i,sn))return null}const a=n.aliases||Object.create(null);for(const r in a){const i=a[r],l=i.parent;if(!r||typeof l!="string"||!s[l]&&!a[l]||!Pt(i,sn))return null}return n}const ns=Object.create(null);function sl(e,n){return{provider:e,prefix:n,icons:Object.create(null),missing:new Set}}function Xe(e,n){const s=ns[e]||(ns[e]=Object.create(null));return s[n]||(s[n]=sl(e,n))}function Zs(e,n){return Qs(n)?Ks(n,(s,a)=>{a?e.icons[s]=a:e.missing.add(s)}):[]}function al(e,n,s){try{if(typeof s.body=="string")return e.icons[n]={...s},!0}catch{}return!1}const Xs=/^[a-z0-9]+(-[a-z0-9]+)*$/,At=(e,n,s,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const o=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:o};return n&&!gt(u)?null:u}const i=r[0],l=i.split("-");if(l.length>1){const o={provider:a,prefix:l.shift(),name:l.join("-")};return n&&!gt(o)?null:o}if(s&&a===""){const o={provider:a,prefix:"",name:i};return n&&!gt(o,s)?null:o}return null},gt=(e,n)=>e?!!((n&&e.prefix===""||e.prefix)&&e.name):!1;let ct=!1;function Js(e){return typeof e=="boolean"&&(ct=e),ct}function ss(e){const n=typeof e=="string"?At(e,!0,ct):e;if(n){const s=Xe(n.provider,n.prefix),a=n.name;return s.icons[a]||(s.missing.has(a)?null:void 0)}}function rl(e,n){const s=At(e,!0,ct);if(!s)return!1;const a=Xe(s.provider,s.prefix);return n?al(a,s.name,n):(a.missing.add(s.name),!0)}function il(e,n){if(typeof e!="object")return!1;if(typeof n!="string"&&(n=e.provider||""),ct&&!n&&!e.prefix){let r=!1;return Qs(e)&&(e.prefix="",Ks(e,(i,l)=>{rl(i,l)&&(r=!0)})),r}const s=e.prefix;if(!gt({prefix:s,name:"a"}))return!1;const a=Xe(n,s);return!!Zs(a,e)}const ea=Object.freeze({width:null,height:null}),ta=Object.freeze({...ea,...vt}),ll=/(-?[0-9.]*[0-9]+[0-9.]*)/g,ol=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function as(e,n,s){if(n===1)return e;if(s=s||100,typeof e=="number")return Math.ceil(e*n*s)/s;if(typeof e!="string")return e;const a=e.split(ll);if(a===null||!a.length)return e;const r=[];let i=a.shift(),l=ol.test(i);for(;;){if(l){const o=parseFloat(i);isNaN(o)?r.push(i):r.push(Math.ceil(o*n*s)/s)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");l=!l}}function cl(e,n="defs"){let s="";const a=e.indexOf("<"+n);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+n);if(r===-1||i===-1)break;const l=e.indexOf(">",i);if(l===-1)break;s+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(l+1)}return{defs:s,content:e}}function dl(e,n){return e?"<defs>"+e+"</defs>"+n:n}function ul(e,n,s){const a=cl(e);return dl(a.defs,n+a.content+s)}const fl=e=>e==="unset"||e==="undefined"||e==="none";function ml(e,n){const s={...wn,...e},a={...ta,...n},r={left:s.left,top:s.top,width:s.width,height:s.height};let i=s.body;[s,a].forEach(y=>{const v=[],N=y.hFlip,j=y.vFlip;let C=y.rotate;N?j?C+=2:(v.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),v.push("scale(-1 1)"),r.top=r.left=0):j&&(v.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),v.push("scale(1 -1)"),r.top=r.left=0);let w;switch(C<0&&(C-=Math.floor(C/4)*4),C=C%4,C){case 1:w=r.height/2+r.top,v.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:v.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,v.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}C%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),v.length&&(i=ul(i,'<g transform="'+v.join(" ")+'">',"</g>"))});const l=a.width,o=a.height,d=r.width,u=r.height;let f,m;l===null?(m=o===null?"1em":o==="auto"?u:o,f=as(m,d/u)):(f=l==="auto"?d:l,m=o===null?as(f,u/d):o==="auto"?u:o);const x={},h=(y,v)=>{fl(v)||(x[y]=v.toString())};h("width",f),h("height",m);const b=[r.left,r.top,d,u];return x.viewBox=b.join(" "),{attributes:x,viewBox:b,body:i}}const hl=/\sid="(\S+)"/g,xl="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let pl=0;function gl(e,n=xl){const s=[];let a;for(;a=hl.exec(e);)s.push(a[1]);if(!s.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return s.forEach(i=>{const l=typeof n=="function"?n(i):n+(pl++).toString(),o=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+o+')([")]|\\.[a-z])',"g"),"$1"+l+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const an=Object.create(null);function bl(e,n){an[e]=n}function rn(e){return an[e]||an[""]}function Nn(e){let n;if(typeof e.resources=="string")n=[e.resources];else if(n=e.resources,!(n instanceof Array)||!n.length)return null;return{resources:n,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Cn=Object.create(null),tt=["https://api.simplesvg.com","https://api.unisvg.com"],bt=[];for(;tt.length>0;)tt.length===1||Math.random()>.5?bt.push(tt.shift()):bt.push(tt.pop());Cn[""]=Nn({resources:["https://api.iconify.design"].concat(bt)});function yl(e,n){const s=Nn(n);return s===null?!1:(Cn[e]=s,!0)}function kn(e){return Cn[e]}const vl=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let rs=vl();function jl(e,n){const s=kn(e);if(!s)return 0;let a;if(!s.maxURL)a=0;else{let r=0;s.resources.forEach(l=>{r=Math.max(r,l.length)});const i=n+".json?icons=";a=s.maxURL-r-s.path.length-i.length}return a}function wl(e){return e===404}const Nl=(e,n,s)=>{const a=[],r=jl(e,n),i="icons";let l={type:i,provider:e,prefix:n,icons:[]},o=0;return s.forEach((d,u)=>{o+=d.length+1,o>=r&&u>0&&(a.push(l),l={type:i,provider:e,prefix:n,icons:[]},o=d.length),l.icons.push(d)}),a.push(l),a};function Cl(e){if(typeof e=="string"){const n=kn(e);if(n)return n.path}return"/"}const kl=(e,n,s)=>{if(!rs){s("abort",424);return}let a=Cl(n.provider);switch(n.type){case"icons":{const i=n.prefix,o=n.icons.join(","),d=new URLSearchParams({icons:o});a+=i+".json?"+d.toString();break}case"custom":{const i=n.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:s("abort",400);return}let r=503;rs(e+a).then(i=>{const l=i.status;if(l!==200){setTimeout(()=>{s(wl(l)?"abort":"next",l)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?s("abort",i):s("next",r)});return}setTimeout(()=>{s("success",i)})}).catch(()=>{s("next",r)})},Sl={prepare:Nl,send:kl};function na(e,n){e.forEach(s=>{const a=s.loaderCallbacks;a&&(s.loaderCallbacks=a.filter(r=>r.id!==n))})}function Al(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const n=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!n.length)return;let s=!1;const a=e.provider,r=e.prefix;n.forEach(i=>{const l=i.icons,o=l.pending.length;l.pending=l.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])l.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))l.missing.push({provider:a,prefix:r,name:u});else return s=!0,!0;return!1}),l.pending.length!==o&&(s||na([e],i.id),i.callback(l.loaded.slice(0),l.missing.slice(0),l.pending.slice(0),i.abort))})}))}let $l=0;function Dl(e,n,s){const a=$l++,r=na.bind(null,s,a);if(!n.pending.length)return r;const i={id:a,icons:n,callback:e,abort:r};return s.forEach(l=>{(l.loaderCallbacks||(l.loaderCallbacks=[])).push(i)}),r}function El(e){const n={loaded:[],missing:[],pending:[]},s=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,l=r.prefix,o=r.name,d=s[i]||(s[i]=Object.create(null)),u=d[l]||(d[l]=Xe(i,l));let f;o in u.icons?f=n.loaded:l===""||u.missing.has(o)?f=n.missing:f=n.pending;const m={provider:i,prefix:l,name:o};f.push(m)}),n}function Fl(e,n=!0,s=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?At(r,n,s):r;i&&a.push(i)}),a}const Ml={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ll(e,n,s,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let l;if(e.random){let E=e.resources.slice(0);for(l=[];E.length>1;){const A=Math.floor(Math.random()*E.length);l.push(E[A]),E=E.slice(0,A).concat(E.slice(A+1))}l=l.concat(E)}else l=e.resources.slice(i).concat(e.resources.slice(0,i));const o=Date.now();let d="pending",u=0,f,m=null,x=[],h=[];typeof a=="function"&&h.push(a);function b(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),b(),x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function v(E,A){A&&(h=[]),typeof E=="function"&&h.push(E)}function N(){return{startTime:o,payload:n,status:d,queriesSent:u,queriesPending:x.length,subscribe:v,abort:y}}function j(){d="failed",h.forEach(E=>{E(void 0,f)})}function C(){x.forEach(E=>{E.status==="pending"&&(E.status="aborted")}),x=[]}function w(E,A,L){const M=A!=="success";switch(x=x.filter(_=>_!==E),d){case"pending":break;case"failed":if(M||!e.dataAfterTimeout)return;break;default:return}if(A==="abort"){f=L,j();return}if(M){f=L,x.length||(l.length?S():j());return}if(b(),C(),!e.random){const _=e.resources.indexOf(E.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",h.forEach(_=>{_(L)})}function S(){if(d!=="pending")return;b();const E=l.shift();if(E===void 0){if(x.length){m=setTimeout(()=>{b(),d==="pending"&&(C(),j())},e.timeout);return}j();return}const A={status:"pending",resource:E,callback:(L,M)=>{w(A,L,M)}};x.push(A),u++,m=setTimeout(S,e.rotate),s(E,n,A.callback)}return setTimeout(S),N}function sa(e){const n={...Ml,...e};let s=[];function a(){s=s.filter(o=>o().status==="pending")}function r(o,d,u){const f=Ll(n,o,d,(m,x)=>{a(),u&&u(m,x)});return s.push(f),f}function i(o){return s.find(d=>o(d))||null}return{query:r,find:i,setIndex:o=>{n.index=o},getIndex:()=>n.index,cleanup:a}}function is(){}const Ot=Object.create(null);function Il(e){if(!Ot[e]){const n=kn(e);if(!n)return;const s=sa(n),a={config:n,redundancy:s};Ot[e]=a}return Ot[e]}function Tl(e,n,s){let a,r;if(typeof e=="string"){const i=rn(e);if(!i)return s(void 0,424),is;r=i.send;const l=Il(e);l&&(a=l.redundancy)}else{const i=Nn(e);if(i){a=sa(i);const l=e.resources?e.resources[0]:"",o=rn(l);o&&(r=o.send)}}return!a||!r?(s(void 0,424),is):a.query(n,r,s)().abort}function ls(){}function _l(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Al(e)}))}function Pl(e){const n=[],s=[];return e.forEach(a=>{(a.match(Xs)?n:s).push(a)}),{valid:n,invalid:s}}function nt(e,n,s){function a(){const r=e.pendingIcons;n.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(s&&typeof s=="object")try{if(!Zs(e,s).length){a();return}}catch(r){console.error(r)}a(),_l(e)}function os(e,n){e instanceof Promise?e.then(s=>{n(s)}).catch(()=>{n(null)}):n(e)}function Ol(e,n){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(n).sort():e.iconsToLoad=n,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:s,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){os(e.loadIcons(r,a,s),f=>{nt(e,r,f)});return}if(i){r.forEach(f=>{const m=i(f,a,s);os(m,x=>{const h=x?{prefix:a,icons:{[f]:x}}:null;nt(e,[f],h)})});return}const{valid:l,invalid:o}=Pl(r);if(o.length&&nt(e,o,null),!l.length)return;const d=a.match(Xs)?rn(s):null;if(!d){nt(e,l,null);return}d.prepare(s,a,l).forEach(f=>{Tl(s,f,m=>{nt(e,f.icons,m)})})}))}const Rl=(e,n)=>{const s=Fl(e,!0,Js()),a=El(s);if(!a.pending.length){let d=!0;return n&&setTimeout(()=>{d&&n(a.loaded,a.missing,a.pending,ls)}),()=>{d=!1}}const r=Object.create(null),i=[];let l,o;return a.pending.forEach(d=>{const{provider:u,prefix:f}=d;if(f===o&&u===l)return;l=u,o=f,i.push(Xe(u,f));const m=r[u]||(r[u]=Object.create(null));m[f]||(m[f]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:f,name:m}=d,x=Xe(u,f),h=x.pendingIcons||(x.pendingIcons=new Set);h.has(m)||(h.add(m),r[u][f].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Ol(d,u)}),n?Dl(n,a,i):ls};function zl(e,n){const s={...e};for(const a in n){const r=n[a],i=typeof r;a in ea?(r===null||r&&(i==="string"||i==="number"))&&(s[a]=r):i===typeof s[a]&&(s[a]=a==="rotate"?r%4:r)}return s}const Bl=/[\s,]+/;function Vl(e,n){n.split(Bl).forEach(s=>{switch(s.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Ul(e,n=0){const s=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(s===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(s!==e){let r=0;switch(s){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-s.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return n}function Hl(e,n){let s=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in n)s+=" "+a+'="'+n[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+s+">"+e+"</svg>"}function ql(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Wl(e){return"data:image/svg+xml,"+ql(e)}function Yl(e){return'url("'+Wl(e)+'")'}let it;function Gl(){try{it=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{it=null}}function Kl(e){return it===void 0&&Gl(),it?it.createHTML(e):e}const aa={...ta,inline:!1},Ql={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Zl={display:"inline-block"},ln={backgroundColor:"currentColor"},ra={backgroundColor:"transparent"},cs={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},ds={WebkitMask:ln,mask:ln,background:ra};for(const e in ds){const n=ds[e];for(const s in cs)n[e+s]=cs[s]}const Xl={...aa,inline:!0};function us(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Jl=(e,n,s)=>{const a=n.inline?Xl:aa,r=zl(a,n),i=n.mode||"svg",l={},o=n.style||{},d={...i==="svg"?Ql:{}};if(s){const v=At(s,!1,!0);if(v){const N=["iconify"],j=["provider","prefix"];for(const C of j)v[C]&&N.push("iconify--"+v[C]);d.className=N.join(" ")}}for(let v in n){const N=n[v];if(N!==void 0)switch(v){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=N;break;case"className":d[v]=(d[v]?d[v]+" ":"")+N;break;case"inline":case"hFlip":case"vFlip":r[v]=N===!0||N==="true"||N===1;break;case"flip":typeof N=="string"&&Vl(r,N);break;case"color":l.color=N;break;case"rotate":typeof N=="string"?r[v]=Ul(N):typeof N=="number"&&(r[v]=N);break;case"ariaHidden":case"aria-hidden":N!==!0&&N!=="true"&&delete d["aria-hidden"];break;default:a[v]===void 0&&(d[v]=N)}}const u=ml(e,r),f=u.attributes;if(r.inline&&(l.verticalAlign="-0.125em"),i==="svg"){d.style={...l,...o},Object.assign(d,f);let v=0,N=n.id;return typeof N=="string"&&(N=N.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Kl(gl(u.body,N?()=>N+"ID"+v++:"iconifyReact"))},p.createElement("svg",d)}const{body:m,width:x,height:h}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=Hl(m,{...f,width:x+"",height:h+""});return d.style={...l,"--svg":Yl(y),width:us(f.width),height:us(f.height),...Zl,...b?ln:ra,...o},p.createElement("span",d)};Js(!0);bl("",Sl);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const n=e.IconifyPreload,s="Invalid IconifyPreload syntax.";typeof n=="object"&&n!==null&&(n instanceof Array?n:[n]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!il(a))&&console.error(s)}catch{console.error(s)}})}if(e.IconifyProviders!==void 0){const n=e.IconifyProviders;if(typeof n=="object"&&n!==null)for(let s in n){const a="IconifyProviders["+s+"] is invalid.";try{const r=n[s];if(typeof r!="object"||!r||r.resources===void 0)continue;yl(s,r)||console.error(a)}catch{console.error(a)}}}}function ia(e){const[n,s]=p.useState(!!e.ssr),[a,r]=p.useState({});function i(h){if(h){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const y=ss(b);if(y)return{name:b,data:y}}return{name:""}}const[l,o]=p.useState(i(!!e.ssr));function d(){const h=a.callback;h&&(h(),r({}))}function u(h){if(JSON.stringify(l)!==JSON.stringify(h))return d(),o(h),!0}function f(){var h;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const y=ss(b);if(u({name:b,data:y}))if(y===void 0){const v=Rl([b],f);r({callback:v})}else y&&((h=e.onLoad)===null||h===void 0||h.call(e,b))}p.useEffect(()=>(s(!0),d),[]),p.useEffect(()=>{n&&f()},[e.icon,n]);const{name:m,data:x}=l;return x?Jl({...wn,...x},e,m):e.children?e.children:e.fallback?e.fallback:p.createElement("span",{})}const R=p.forwardRef((e,n)=>ia({...e,_ref:n}));p.forwardRef((e,n)=>ia({inline:!0,...e,_ref:n}));const U=p.forwardRef(({color:e="primary",radius:n="full",testId:s="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:n,"data-testid":s,...a}));U.displayName="Button";function la({code:e,amount:n,onRemove:s,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:n})]}),t.jsx(U,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:s,children:t.jsx(R,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Rt(e,n){return e-n*Math.floor(e/n)}const oa=1721426;function xt(e,n,s,a){n=Sn(e,n);let r=n-1,i=-2;return s<=2?i=0:yt(n)&&(i=-1),oa-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*s-362)/12+i+a)}function yt(e){return e%4===0&&(e%100!==0||e%400===0)}function Sn(e,n){return e==="BC"?1-n:n}function eo(e){let n="AD";return e<=0&&(n="BC",e=1-e),[n,e]}const to={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class $t{fromJulianDay(n){let s=n,a=s-oa,r=Math.floor(a/146097),i=Rt(a,146097),l=Math.floor(i/36524),o=Rt(i,36524),d=Math.floor(o/1461),u=Rt(o,1461),f=Math.floor(u/365),m=r*400+l*100+d*4+f+(l!==4&&f!==4?1:0),[x,h]=eo(m),b=s-xt(x,h,1,1),y=2;s<xt(x,h,3,1)?y=0:yt(h)&&(y=1);let v=Math.floor(((b+y)*12+373)/367),N=s-xt(x,h,v,1)+1;return new dt(x,h,v,N)}toJulianDay(n){return xt(n.era,n.year,n.month,n.day)}getDaysInMonth(n){return to[yt(n.year)?"leapyear":"standard"][n.month-1]}getMonthsInYear(n){return 12}getDaysInYear(n){return yt(n.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(n){return 9999}getEras(){return["BC","AD"]}isInverseEra(n){return n.era==="BC"}balanceDate(n){n.year<=0&&(n.era=n.era==="BC"?"AD":"BC",n.year=1-n.year)}constructor(){this.identifier="gregory"}}function no(e,n){var s,a,r,i;return(i=(r=(s=e.isEqual)===null||s===void 0?void 0:s.call(e,n))!==null&&r!==void 0?r:(a=n.isEqual)===null||a===void 0?void 0:a.call(n,e))!==null&&i!==void 0?i:e.identifier===n.identifier}function ca(e,n){return e.calendar.toJulianDay(e)-n.calendar.toJulianDay(n)}function da(e,n){return fs(e)-fs(n)}function fs(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let zt=null;function ua(){return zt==null&&(zt=new Intl.DateTimeFormat().resolvedOptions().timeZone),zt}function ms(e){e=An(e,new $t);let n=Sn(e.era,e.year);return fa(n,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function fa(e,n,s,a,r,i,l){let o=new Date;return o.setUTCHours(a,r,i,l),o.setUTCFullYear(e,n-1,s),o.getTime()}function hs(e,n){if(n==="UTC")return 0;if(e>0&&n===ua())return new Date(e).getTimezoneOffset()*-6e4;let{year:s,month:a,day:r,hour:i,minute:l,second:o}=ma(e,n);return fa(s,a,r,i,l,o,0)-Math.floor(e/1e3)*1e3}const xs=new Map;function ma(e,n){let s=xs.get(n);s||(s=new Intl.DateTimeFormat("en-US",{timeZone:n,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),xs.set(n,s));let a=s.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ps=864e5;function so(e,n,s,a){return(s===a?[s]:[s,a]).filter(i=>ao(e,n,i))}function ao(e,n,s){let a=ma(s,n);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function ro(e,n,s="compatible"){let a=xa(e);if(n==="UTC")return ms(a);if(n===ua()&&s==="compatible"){a=An(a,new $t);let d=new Date,u=Sn(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=ms(a),i=hs(r-ps,n),l=hs(r+ps,n),o=so(a,n,r-i,r-l);if(o.length===1)return o[0];if(o.length>1)switch(s){case"compatible":case"earlier":return o[0];case"later":return o[o.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(s){case"earlier":return Math.min(r-i,r-l);case"compatible":case"later":return Math.max(r-i,r-l);case"reject":throw new RangeError("No such absolute time found")}}function ha(e,n,s="compatible"){return new Date(ro(e,n,s))}function xa(e,n){let s=0,a=0,r=0,i=0;if("timeZone"in e)({hour:s,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!n)return e;return n&&({hour:s,minute:a,second:r,millisecond:i}=n),new jt(e.calendar,e.era,e.year,e.month,e.day,s,a,r,i)}function An(e,n){if(no(e.calendar,n))return e;let s=n.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=n,a.era=s.era,a.year=s.year,a.month=s.month,a.day=s.day,Je(a),a}function $n(e,n){let s=e.copy(),a="hour"in s?wa(s,n):0;on(s,n.years||0),s.calendar.balanceYearMonth&&s.calendar.balanceYearMonth(s,e),s.month+=n.months||0,cn(s),pa(s),s.day+=(n.weeks||0)*7,s.day+=n.days||0,s.day+=a,io(s),s.calendar.balanceDate&&s.calendar.balanceDate(s),s.year<1&&(s.year=1,s.month=1,s.day=1);let r=s.calendar.getYearsInEra(s);if(s.year>r){var i,l;let d=(i=(l=s.calendar).isInverseEra)===null||i===void 0?void 0:i.call(l,s);s.year=r,s.month=d?1:s.calendar.getMonthsInYear(s),s.day=d?1:s.calendar.getDaysInMonth(s)}s.month<1&&(s.month=1,s.day=1);let o=s.calendar.getMonthsInYear(s);return s.month>o&&(s.month=o,s.day=s.calendar.getDaysInMonth(s)),s.day=Math.max(1,Math.min(s.calendar.getDaysInMonth(s),s.day)),s}function on(e,n){var s,a;!((s=(a=e.calendar).isInverseEra)===null||s===void 0)&&s.call(a,e)&&(n=-n),e.year+=n}function cn(e){for(;e.month<1;)on(e,-1),e.month+=e.calendar.getMonthsInYear(e);let n=0;for(;e.month>(n=e.calendar.getMonthsInYear(e));)e.month-=n,on(e,1)}function io(e){for(;e.day<1;)e.month--,cn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,cn(e)}function pa(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Je(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),pa(e)}function ga(e){let n={};for(let s in e)typeof e[s]=="number"&&(n[s]=-e[s]);return n}function ba(e,n){return $n(e,ga(n))}function ya(e,n){let s=e.copy();return n.era!=null&&(s.era=n.era),n.year!=null&&(s.year=n.year),n.month!=null&&(s.month=n.month),n.day!=null&&(s.day=n.day),Je(s),s}function va(e,n){let s=e.copy();return n.hour!=null&&(s.hour=n.hour),n.minute!=null&&(s.minute=n.minute),n.second!=null&&(s.second=n.second),n.millisecond!=null&&(s.millisecond=n.millisecond),ja(s),s}function lo(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=pt(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=pt(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=pt(e.minute,60);let n=Math.floor(e.hour/24);return e.hour=pt(e.hour,24),n}function ja(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function pt(e,n){let s=e%n;return s<0&&(s+=n),s}function wa(e,n){return e.hour+=n.hours||0,e.minute+=n.minutes||0,e.second+=n.seconds||0,e.millisecond+=n.milliseconds||0,lo(e)}function Na(e,n){let s=e.copy();return wa(s,n),s}function oo(e,n){return Na(e,ga(n))}function Ca(e,n,s,a){let r=e.copy();switch(n){case"era":{let o=e.calendar.getEras(),d=o.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=Be(d,s,0,o.length-1,a?.round),r.era=o[d],Je(r);break}case"year":var i,l;!((i=(l=r.calendar).isInverseEra)===null||i===void 0)&&i.call(l,r)&&(s=-s),r.year=Be(e.year,s,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=Be(e.month,s,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=Be(e.day,s,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+n)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Je(r),r}function ka(e,n,s,a){let r=e.copy();switch(n){case"hour":{let i=e.hour,l=0,o=23;if(a?.hourCycle===12){let d=i>=12;l=d?12:0,o=d?23:11}r.hour=Be(i,s,l,o,a?.round);break}case"minute":r.minute=Be(e.minute,s,0,59,a?.round);break;case"second":r.second=Be(e.second,s,0,59,a?.round);break;case"millisecond":r.millisecond=Be(e.millisecond,s,0,999,a?.round);break;default:throw new Error("Unsupported field "+n)}return r}function Be(e,n,s,a,r=!1){if(r){e+=Math.sign(n),e<s&&(e=a);let i=Math.abs(n);n>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=s)}else e+=n,e<s?e=a-(s-e-1):e>a&&(e=s+(e-a-1));return e}const co=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,uo=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function fo(e){let n=e.match(co);if(!n)throw uo.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let s=new dt(Bt(n[1],0,9999),Bt(n[2],1,12),1);return s.day=Bt(n[3],1,s.calendar.getDaysInMonth(s)),s}function Bt(e,n,s){let a=Number(e);if(a<n||a>s)throw new RangeError(`Value out of range: ${n} <= ${a} <= ${s}`);return a}function Sa(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function Aa(e){let n=An(e,new $t),s;return n.era==="BC"?s=n.year===1?"0000":"-"+String(Math.abs(1-n.year)).padStart(6,"00"):s=String(n.year).padStart(4,"0"),`${s}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}function mo(e){return`${Aa(e)}T${Sa(e)}`}function ho(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Dn(e,n,s){ho(e,n),n.set(e,s)}function $a(e){let n=typeof e[0]=="object"?e.shift():new $t,s;if(typeof e[0]=="string")s=e.shift();else{let l=n.getEras();s=l[l.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[n,s,a,r,i]}var xo=new WeakMap;class dt{copy(){return this.era?new dt(this.calendar,this.era,this.year,this.month,this.day):new dt(this.calendar,this.year,this.month,this.day)}add(n){return $n(this,n)}subtract(n){return ba(this,n)}set(n){return ya(this,n)}cycle(n,s,a){return Ca(this,n,s,a)}toDate(n){return ha(this,n)}toString(){return Aa(this)}compare(n){return ca(this,n)}constructor(...n){Dn(this,xo,{writable:!0,value:void 0});let[s,a,r,i,l]=$a(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,Je(this)}}var po=new WeakMap;class Dt{copy(){return new Dt(this.hour,this.minute,this.second,this.millisecond)}add(n){return Na(this,n)}subtract(n){return oo(this,n)}set(n){return va(this,n)}cycle(n,s,a){return ka(this,n,s,a)}toString(){return Sa(this)}compare(n){return da(this,n)}constructor(n=0,s=0,a=0,r=0){Dn(this,po,{writable:!0,value:void 0}),this.hour=n,this.minute=s,this.second=a,this.millisecond=r,ja(this)}}var go=new WeakMap;class jt{copy(){return this.era?new jt(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new jt(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(n){return $n(this,n)}subtract(n){return ba(this,n)}set(n){return ya(va(this,n),n)}cycle(n,s,a){switch(n){case"era":case"year":case"month":case"day":return Ca(this,n,s,a);default:return ka(this,n,s,a)}}toDate(n,s){return ha(this,n,s)}toString(){return mo(this)}compare(n){let s=ca(this,n);return s===0?da(this,xa(n)):s}constructor(...n){Dn(this,go,{writable:!0,value:void 0});let[s,a,r,i,l]=$a(n);this.calendar=s,this.era=a,this.year=r,this.month=i,this.day=l,this.hour=n.shift()||0,this.minute=n.shift()||0,this.second=n.shift()||0,this.millisecond=n.shift()||0,Je(this)}}const bo="Open time options",yo=320;function gs(e,n){return typeof n=="string"&&n.length>0?`${e} ${n}`:e}function Vt(e){if(!e)return null;const n="hour"in e&&typeof e.hour=="number"?e.hour:0,s="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Dt(n,s,a)}function vo(e,n){const s=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:n===12}).format(s)}function jo(e){const n=[];for(let s=0;s<24;s+=1)for(let a=0;a<60;a+=e)n.push(new Dt(s,a));return n}function wo(e){const{minuteStep:n=15,timeListClassName:s,timeListLabel:a=bo,selectorButtonProps:r,endContent:i,onChange:l,value:o,defaultValue:d,hourCycle:u=12,...f}=e,m=o!==void 0,[x,h]=p.useState(()=>Vt(d)),b=m?Vt(o):x,y=p.useMemo(()=>jo(n),[n]),v=j=>{m||h(j),l?.(j)},N=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(G.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:s??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(j=>{const C=b?.hour===j.hour&&b?.minute===j.minute;return t.jsx(c.Button,{variant:C?"flat":"light",color:C?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>v(j),children:vo(j,u)},`${j.hour}:${j.minute}`)})})})})]});return t.jsx(c.TimeInput,{...f,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,N]}),onChange:j=>v(Vt(j))})}function En(e){if(e.mode==="time")return t.jsx(wo,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:l=!0,calendarWidth:o=yo,disableAnimation:d=!0,classNames:u,...f}=e;return t.jsx(c.DatePicker,{...f,calendarWidth:o,classNames:{...u,popoverContent:gs("min-w-[20rem]",u?.popoverContent),calendarContent:gs("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:l})}const{mode:n,granularity:s="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:s})}function No(e){const n=e?.closest('[role="dialog"]');return n?.parentElement??n??void 0}const Me=p.forwardRef(({popoverProps:e,...n},s)=>{const a=p.useRef(null),[r,i]=p.useState(void 0),l={...e,disableDialogFocus:e?.disableDialogFocus??(r?!0:void 0),portalContainer:e?.portalContainer??r};return p.useEffect(()=>{i(No(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:s,...n,popoverProps:l})})});Me.displayName="Select";function Co({state:e,onSubmit:n,onRemove:s,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:l="GC-XXXX-XXXX-XXXX",applyLabel:o="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[f,m]=p.useState(""),x=p.useId(),[h,b]=p.useState(e);e!==h&&(b(e),e==="applied"&&m(""));const y=()=>{const j=f.trim();j&&n(j)},v=j=>{j.key==="Enter"&&(j.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(la,{code:a.code,amount:a.amount,onRemove:s,removeAriaLabel:d,testId:`${u}-card`})});const N=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:l,value:f,onValueChange:m,onKeyDown:v,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":N?x:void 0}),t.jsx(U,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!f.trim(),onPress:y,children:o})]}),N&&t.jsx("p",{id:x,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const ko={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function So({languages:e,selectedLanguage:n,onLanguageChange:s,label:a}){const r=e.find(i=>i.code===n);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(Me,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(G.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(Me,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:n?[n]:[],onSelectionChange:i=>{const l=Array.from(i)[0]||n;s?.(l)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(G.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Ao({isLoggedIn:e,onLogin:n,onLogout:s,labels:a}){return e?t.jsxs(U,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(U,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(G.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function $o({logo:e,languages:n=[],selectedLanguage:s,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:l,hasLanguages:o,hasAuth:d,labels:u={},className:f}){const m={...ko,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",f),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(o||n.length>0)&&t.jsx(So,{languages:n,selectedLanguage:s,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Ao,{isLoggedIn:r,onLogin:i,onLogout:l,labels:m})]})]})}function Do(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Ut;const Eo=typeof document<"u"?(Ut=p.useInsertionEffect)!==null&&Ut!==void 0?Ut:p.useLayoutEffect:()=>{};function Et(e,n,s){let[a,r]=p.useState(e||n),i=p.useRef(a),l=p.useRef(e!==void 0),o=e!==void 0;p.useEffect(()=>{let m=l.current;m!==o&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}.`),l.current=o},[o]);let d=o?e:a;Eo(()=>{i.current=d});let[,u]=p.useReducer(()=>({}),{}),f=p.useCallback((m,...x)=>{let h=typeof m=="function"?m(i.current):m;Object.is(i.current,h)||(i.current=h,r(h),u(),s?.(h,...x))},[s]);return[d,f]}function Da(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ce.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Ea=p.forwardRef(({color:e="primary",variant:n="default",stepsCount:s=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:l=!1,stepLabelTooltipPlacement:o="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:f="compact",stepCounterFormat:m,onStepChange:x,currentStep:h,hideProgressBars:b=!1,stepClassName:y,className:v,isDisabled:N=!1,...j},C)=>{const[w,S]=Et(h,a,x),E=p.useMemo(()=>{let A,L;const M=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":A="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":A="[--step-color:var(--heroui-secondary)]",L="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":A="[--step-color:var(--heroui-success)]",L="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":A="[--step-color:var(--heroui-warning)]",L="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":A="[--step-color:var(--heroui-danger)]",L="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":A="[--step-color:var(--heroui-default)]",L="[--step-fg-color:var(--heroui-default-foreground)]";break;default:A="[--step-color:var(--heroui-primary)]",L="[--step-fg-color:var(--heroui-primary-foreground)]";break}return M.unshift(L),M.unshift(A),M},[e]);return t.jsxs("nav",{ref:C,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",f==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",v),"data-testid":"stepper-root",...j,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,s):`Step ${w+1} of ${s}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",E,v),"data-testid":"stepper-list",children:Array.from({length:s})?.map((A,L)=>{const M=w===L?"active":w<L?"inactive":"complete",_=n==="activeLabel"&&M==="active"&&!!i?.[L],D=l&&M!=="active"&&!!i?.[L];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${L}`,children:[t.jsx(c.Tooltip,{content:D?i?.[L]:void 0,isDisabled:!D,offset:12,placement:o,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":M==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":N},y),onClick:()=>!N&&S(L),disabled:N,"data-testid":`stepper-step-btn-${L}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:M,className:"relative z-10",children:t.jsx(Ce.m.div,{animate:M,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":M==="complete","shadow-lg":M==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:M==="complete"&&n==="default"?t.jsx(Da,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${L}`}):t.jsx("span",{children:L+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${L}`,children:i[L]}):null]},L)}),L<s-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":L},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":L<w})})})]},L)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,s):`Step ${w+1} of ${s}`}):null]})});Ea.displayName="Stepper";function Fo(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function xe(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s}).format(e)}catch{return`${s} ${e.toFixed(2)}`}}function Ft(e,n="en-US"){try{const s=new Intl.NumberFormat(n,{style:"currency",currency:e}).resolvedOptions();return typeof s.maximumFractionDigits=="number"?s.maximumFractionDigits:2}catch{return 2}}function Fa(e,n,s="en-US"){const a=Ft(n,s),r=Math.pow(10,a);return Math.round(e*r)/r}function dn(e,n,s,a){return Fa(e-n,s,a)}const bs={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},Mo="rgb(156 163 175)",Lo="rgb(107 114 128)",Ma=p.forwardRef(function({color:n="primary",steps:s=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:l=!1,activeColor:o,activeForegroundColor:d,inactiveColor:u=Mo,inactiveLabelColor:f=Lo,activeStepVariant:m="bordered",stepClassName:x,circleClassName:h,progressBarClassName:b,labelsClassName:y,labelSlotClassName:v,activeLabelClassName:N,inactiveLabelClassName:j,className:C,ariaLabel:w="Progress",invalidLabelSuffix:S=", has errors",testId:E,isStepReachable:A,...L},M){const[_,D]=Et(i,a,r),$=bs[n]??bs.primary,I=o??$.active,T=d??$.fg,K=(H,B)=>{const J=H.ariaLabel??(typeof H.title=="string"?H.title:null)??`${B+1}`;return H.invalid?`${J}${S}`:J};return t.jsxs("nav",{...L,"aria-label":w,...E?{"data-testid":E}:{},children:[t.jsx("div",{className:c.cn("flex items-center",C),children:s?.map((H,B)=>{const X=B===_?"active":B<_?"complete":"inactive",J=A?A(B):!0;return t.jsxs(p.Fragment,{children:[t.jsx(U,{ref:M,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${E??"horizontal-steps"}-step-${B}`,"aria-current":X==="active"?"step":void 0,"aria-describedby":H.describedBy,"aria-label":K(H,B),"data-invalid":H.invalid?"true":void 0,isDisabled:!J,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",J?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",H.className,x),onPress:()=>{if(i===void 0){D(B);return}r?.(B)},children:t.jsx(Ce.LazyMotion,{features:Ce.domAnimation,children:t.jsx(Ce.m.div,{animate:X,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",h),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?I:"transparent",borderColor:I,borderWidth:"1.5px",color:m==="solid"?T:I},complete:{backgroundColor:I,borderColor:I,borderWidth:"1.5px",color:I}},children:X==="complete"?t.jsx(Da,{className:"size-4",style:{color:T}}):t.jsx("span",{children:B+1})})})}),B<s.length-1&&!l&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:B<_?I:u}})]},B)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:s?.map((H,B)=>{const X=B<=_;return t.jsxs(p.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",v),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",X?N:j),style:{color:X?I:f},children:H.title})}),B<s.length-1&&!l&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},B)})})]})});Ma.displayName="HorizontalSteps";function Io(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const To=e=>{const n=p.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(_o,{...e},n)},_o=({allItems:e,selected:n,onSelectedChange:s,titleLeft:a,titleRight:r})=>{const[i,l]=p.useState([]),[o,d]=p.useState([]),[u,f]=p.useState(null),[m,x]=p.useState(null),h=p.useMemo(()=>new Set(n),[n]),b=p.useMemo(()=>new Set(e),[e]),y=p.useMemo(()=>e.filter(D=>!h.has(D)),[e,h]),v=D=>{if(D.length===0)return;const $=Array.from(new Set([...n,...D]));s($)},N=D=>{if(D.length===0)return;const $=new Set(D);s(n.filter(I=>!$.has(I)))},j=()=>{i.length!==0&&(v(i),l([]))},C=()=>{o.length!==0&&(N(o),d([]))},w=()=>{y.length!==0&&(v(y),l([]))},S=()=>{n.length!==0&&(s([]),d([]))},E=(D,$,I)=>{const T=Math.min($,I),K=Math.max($,I);return D.slice(T,K+1)},A=(D,$,I)=>{if(I&&u!==null){l(E(y,u,$)),d([]),f($);return}const T=i.includes(D);l(T?i.filter(K=>K!==D):[...i,D]),d([]),f($)},L=(D,$,I)=>{if(I&&m!==null){d(E(n,m,$)),l([]),x($);return}const T=o.includes(D);d(T?o.filter(K=>K!==D):[...o,D]),l([]),x($)},M=(D,$,I)=>{const T=I==="available"?i.includes($)?i:[$]:o.includes($)?o:[$];D.dataTransfer.setData("text/plain",JSON.stringify({source:I,items:T})),D.dataTransfer.effectAllowed="move"},_=(D,$)=>{D.preventDefault();const I=D.dataTransfer.getData("text/plain");if(I)try{const T=JSON.parse(I),K=(T.items||[]).filter(H=>b.has(H));if(K.length===0||T.source===$)return;$==="selected"?(v(K),l([])):(N(K),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:D=>D.preventDefault(),onDrop:D=>_(D,"available"),children:y.map((D,$)=>{const I=i.includes(D);return t.jsx("button",{type:"button",onClick:T=>{A(D,$,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>M(T,D,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:j,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:C,isDisabled:o.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(U,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:S,"data-testid":"move-all-to-available",isDisabled:n.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:D=>D.preventDefault(),onDrop:D=>_(D,"selected"),children:n.map((D,$)=>{const I=o.includes(D);return t.jsx("button",{type:"button",onClick:T=>{L(D,$,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>M(T,D,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${I?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:D},D)})})})]})]})};function ut(e){return typeof e=="string"?e:e.type}function He({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function qe({icon:e,label:n,isActive:s=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:l=16,className:o}){const d=i?`${n} (${i})`:n;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(U,{size:"sm",radius:"sm",color:s?"primary":"default",variant:s?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":n,className:o,children:t.jsx(e,{size:l})})})}const Te={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:n})=>{const s=n?.type==="textColor"?n.color:"";s?e.chain().focus().setColor(s).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:n})=>{const s=n?.type==="highlight"?n.color:"";s?e.chain().focus().setHighlight({color:s}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:n})=>{const s=n?.type==="link"?n.href:"";if(s){const a=n?.type==="link"?n.target:void 0,r=n?.type==="link"?n.rel:void 0;e.chain().focus().setLink({href:s,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:n})=>{const s=n?.type==="heading"?n.level:1;e.chain().focus().toggleHeading({level:s}).run()},canExecute:(e,n)=>{const s=n?.type==="heading"?n.level:1;return e.can().chain().focus().toggleHeading({level:s}).run()},isActive:(e,n)=>n?.type==="heading"?e.isActive("heading",{level:n.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:n})=>{const s=n?.type==="textAlign"?n.alignment:"left";e.chain().focus().setTextAlign(s).run()},canExecute:()=>!0,isActive:(e,n)=>n?.type==="textAlign"?e.isActive({textAlign:n.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Po={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Oo({editor:e,levels:n=[1,2,3,4,5,6],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const l=()=>a(o=>o+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=n.find(l=>e.isActive("heading",{level:l})),i=l=>{const o=Number(l),d=Te.heading;d&&d.execute({editor:e,config:{type:"heading",level:o}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(U,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,startContent:t.jsx(G.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:n.map(l=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:l})?t.jsx(G.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Po[l]},l))})]})}const Ht={bulletList:{label:"Bullet List",icon:G.List},orderedList:{label:"Numbered List",icon:G.ListOrdered},taskList:{label:"Task List",icon:G.ListTodo}};function Ro({editor:e,types:n=["bulletList","orderedList","taskList"],isDisabled:s=!1}){const[,a]=p.useState(0);p.useEffect(()=>{const o=()=>a(d=>d+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=n.find(o=>e.isActive(o)),i=r?Ht[r].icon:G.List,l=o=>{const u=Te[o];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(U,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:s,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:l,children:n.map(o=>{const d=Ht[o].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Ht[o].label},o)})})]})}function zo({colors:e,selectedColor:n,onColorSelect:s,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=n===r;return t.jsx("button",{type:"button",onClick:()=>s(r),className:`
7
+ `}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Ee.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const xt=Ee.palettes.info,ds={light:{content1:"#ffffff",content2:"#f4f4f5"},dark:{content1:"#18181b",content2:"#27272a"}},Gr=["accent","fill","border","user-bubble","assistant-bubble","focus"],zn={light:{accent:xt[600],fill:xt[100],border:xt[200],"user-bubble":ds.light.content2,"assistant-bubble":ds.light.content1,focus:xt[500]},dark:{accent:xt[300],fill:xt[900],border:xt[800],"user-bubble":ds.dark.content2,"assistant-bubble":ds.dark.content1,focus:xt[400]}};function Kr(e){if(!/^#[0-9a-f]{6}$/i.test(e))throw new Error(`bad hex: ${e}`);return[1,3,5].map(s=>parseInt(e.slice(s,s+2),16)).join(" ")}const Yr=e=>`--ai-${e}`,La=e=>Object.fromEntries(Gr.map(s=>[Yr(s),Kr(zn[e][s])])),Fa={light:':root, .light, [data-theme="light"]',dark:".dark"};Fa.light+"",La("light"),Fa.dark+"",La("dark");Object.fromEntries(Gr.map(e=>[e,`rgb(var(${Yr(e)}, ${Kr(zn.light[e])}) / <alpha-value>)`]));const Qr=x.createContext(void 0);function Zr(){return x.useContext(Qr)}function dd({children:e,closeLabel:s,locale:n}){const a=Zr();return t.jsx(c.HeroUIProvider,{locale:n,children:t.jsx(Qr.Provider,{value:s??a,children:e})})}const Xr=x.createContext("default");function Ms(){return x.useContext(Xr)}function ud(e){return Ms()==="touch"?"lg":e}function md({density:e,children:s}){return t.jsx(Xr.Provider,{value:e,children:s})}function fd(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(n).concat(Object.keys(a)).forEach(i),r}const Jr=Object.freeze({left:0,top:0,width:16,height:16}),ks=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Bn=Object.freeze({...Jr,...ks}),vn=Object.freeze({...Bn,body:"",hidden:!1});function pd(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function _a(e,s){const n=pd(e,s);for(const a in vn)a in ks?a in e&&!(a in n)&&(n[a]=ks[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function xd(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=_a(a[l]||r[l],i)}return o(s),n.forEach(o),_a(e,i)}function ei(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=fd(e);for(const r in a){const i=a[r];i&&(s(r,xd(e,r,i)),n.push(r))}return n}const hd={provider:"",aliases:{},not_found:{},...Jr};function Ks(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function ti(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Ks(e,hd))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Ks(i,vn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Ks(i,vn))return null}return s}const Ra=Object.create(null);function bd(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function Rt(e,s){const n=Ra[e]||(Ra[e]=Object.create(null));return n[s]||(n[s]=bd(e,s))}function si(e,s){return ti(s)?ei(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function gd(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const ni=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ps=(e,s,n,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return s&&!ys(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return s&&!ys(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!ys(l,n)?null:l}return null},ys=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let es=!1;function ai(e){return typeof e=="boolean"&&(es=e),es}function Ma(e){const s=typeof e=="string"?Ps(e,!0,es):e;if(s){const n=Rt(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function yd(e,s){const n=Ps(e,!0,es);if(!n)return!1;const a=Rt(n.provider,n.prefix);return s?gd(a,n.name,s):(a.missing.add(n.name),!0)}function vd(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),es&&!s&&!e.prefix){let r=!1;return ti(e)&&(e.prefix="",ei(e,(i,o)=>{yd(i,o)&&(r=!0)})),r}const n=e.prefix;if(!ys({prefix:n,name:"a"}))return!1;const a=Rt(s,n);return!!si(a,e)}const ri=Object.freeze({width:null,height:null}),ii=Object.freeze({...ri,...ks}),wd=/(-?[0-9.]*[0-9]+[0-9.]*)/g,jd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Pa(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(wd);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=jd.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function Nd(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function Cd(e,s){return e?"<defs>"+e+"</defs>"+s:s}function kd(e,s,n){const a=Nd(e);return Cd(a.defs,s+a.content+n)}const Sd=e=>e==="unset"||e==="undefined"||e==="none";function $d(e,s){const n={...Bn,...e},a={...ii,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(y=>{const g=[],v=y.hFlip,j=y.vFlip;let A=y.rotate;v?j?A+=2:(g.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),g.push("scale(-1 1)"),r.top=r.left=0):j&&(g.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),g.push("scale(1 -1)"),r.top=r.left=0);let w;switch(A<0&&(A-=Math.floor(A/4)*4),A=A%4,A){case 1:w=r.height/2+r.top,g.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:g.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,g.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}A%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),g.length&&(i=kd(i,'<g transform="'+g.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let p,m;o===null?(m=l===null?"1em":l==="auto"?u:l,p=Pa(m,d/u)):(p=o==="auto"?d:o,m=l===null?Pa(p,u/d):l==="auto"?u:l);const h={},f=(y,g)=>{Sd(g)||(h[y]=g.toString())};f("width",p),f("height",m);const b=[r.left,r.top,d,u];return h.viewBox=b.join(" "),{attributes:h,viewBox:b,body:i}}const Ad=/\sid="(\S+)"/g,Ed="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Dd=0;function Ld(e,s=Ed){const n=[];let a;for(;a=Ad.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(Dd++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const wn=Object.create(null);function Fd(e,s){wn[e]=s}function jn(e){return wn[e]||wn[""]}function Vn(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Un=Object.create(null),Ot=["https://api.simplesvg.com","https://api.unisvg.com"],vs=[];for(;Ot.length>0;)Ot.length===1||Math.random()>.5?vs.push(Ot.shift()):vs.push(Ot.pop());Un[""]=Vn({resources:["https://api.iconify.design"].concat(vs)});function _d(e,s){const n=Vn(s);return n===null?!1:(Un[e]=n,!0)}function Hn(e){return Un[e]}const Rd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ta=Rd();function Md(e,s){const n=Hn(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function Pd(e){return e===404}const Td=(e,s,n)=>{const a=[],r=Md(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function Id(e){if(typeof e=="string"){const s=Hn(e);if(s)return s.path}return"/"}const Od=(e,s,n)=>{if(!Ta){n("abort",424);return}let a=Id(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;Ta(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(Pd(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},zd={prepare:Td,send:Od};function li(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function Bd(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||li([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Vd=0;function Ud(e,s,n){const a=Vd++,r=li.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Hd(e){const s={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=Rt(i,o));let p;l in u.icons?p=s.loaded:o===""||u.missing.has(l)?p=s.missing:p=s.pending;const m={provider:i,prefix:o,name:l};p.push(m)}),s}function Wd(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Ps(r,s,n):r;i&&a.push(i)}),a}const qd={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Gd(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let $=e.resources.slice(0);for(o=[];$.length>1;){const N=Math.floor(Math.random()*$.length);o.push($[N]),$=$.slice(0,N).concat($.slice(N+1))}o=o.concat($)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,p,m=null,h=[],f=[];typeof a=="function"&&f.push(a);function b(){m&&(clearTimeout(m),m=null)}function y(){d==="pending"&&(d="aborted"),b(),h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function g($,N){N&&(f=[]),typeof $=="function"&&f.push($)}function v(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:h.length,subscribe:g,abort:y}}function j(){d="failed",f.forEach($=>{$(void 0,p)})}function A(){h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function w($,N,C){const k=N!=="success";switch(h=h.filter(_=>_!==$),d){case"pending":break;case"failed":if(k||!e.dataAfterTimeout)return;break;default:return}if(N==="abort"){p=C,j();return}if(k){p=C,h.length||(o.length?E():j());return}if(b(),A(),!e.random){const _=e.resources.indexOf($.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",f.forEach(_=>{_(C)})}function E(){if(d!=="pending")return;b();const $=o.shift();if($===void 0){if(h.length){m=setTimeout(()=>{b(),d==="pending"&&(A(),j())},e.timeout);return}j();return}const N={status:"pending",resource:$,callback:(C,k)=>{w(N,C,k)}};h.push(N),u++,m=setTimeout(E,e.rotate),n($,s,N.callback)}return setTimeout(E),v}function oi(e){const s={...qd,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const p=Gd(s,l,d,(m,h)=>{a(),u&&u(m,h)});return n.push(p),p}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function Ia(){}const Ys=Object.create(null);function Kd(e){if(!Ys[e]){const s=Hn(e);if(!s)return;const n=oi(s),a={config:s,redundancy:n};Ys[e]=a}return Ys[e]}function Yd(e,s,n){let a,r;if(typeof e=="string"){const i=jn(e);if(!i)return n(void 0,424),Ia;r=i.send;const o=Kd(e);o&&(a=o.redundancy)}else{const i=Vn(e);if(i){a=oi(i);const o=e.resources?e.resources[0]:"",l=jn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),Ia):a.query(s,r,n)().abort}function Oa(){}function Qd(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Bd(e)}))}function Zd(e){const s=[],n=[];return e.forEach(a=>{(a.match(ni)?s:n).push(a)}),{valid:s,invalid:n}}function zt(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!si(e,n).length){a();return}}catch(r){console.error(r)}a(),Qd(e)}function za(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function Xd(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){za(e.loadIcons(r,a,n),p=>{zt(e,r,p)});return}if(i){r.forEach(p=>{const m=i(p,a,n);za(m,h=>{const f=h?{prefix:a,icons:{[p]:h}}:null;zt(e,[p],f)})});return}const{valid:o,invalid:l}=Zd(r);if(l.length&&zt(e,l,null),!o.length)return;const d=a.match(ni)?jn(n):null;if(!d){zt(e,o,null);return}d.prepare(n,a,o).forEach(p=>{Yd(n,p,m=>{zt(e,p.icons,m)})})}))}const Jd=(e,s)=>{const n=Wd(e,!0,ai()),a=Hd(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Oa)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:p}=d;if(p===l&&u===o)return;o=u,l=p,i.push(Rt(u,p));const m=r[u]||(r[u]=Object.create(null));m[p]||(m[p]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:p,name:m}=d,h=Rt(u,p),f=h.pendingIcons||(h.pendingIcons=new Set);f.has(m)||(f.add(m),r[u][p].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Xd(d,u)}),s?Ud(s,a,i):Oa};function eu(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in ri?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const tu=/[\s,]+/;function su(e,s){s.split(tu).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function nu(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function au(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function ru(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function iu(e){return"data:image/svg+xml,"+ru(e)}function lu(e){return'url("'+iu(e)+'")'}let Zt;function ou(){try{Zt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Zt=null}}function cu(e){return Zt===void 0&&ou(),Zt?Zt.createHTML(e):e}const ci={...ii,inline:!1},du={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},uu={display:"inline-block"},Nn={backgroundColor:"currentColor"},di={backgroundColor:"transparent"},Ba={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Va={WebkitMask:Nn,mask:Nn,background:di};for(const e in Va){const s=Va[e];for(const n in Ba)s[e+n]=Ba[n]}const mu={...ci,inline:!0};function Ua(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const fu=(e,s,n)=>{const a=s.inline?mu:ci,r=eu(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?du:{}};if(n){const g=Ps(n,!1,!0);if(g){const v=["iconify"],j=["provider","prefix"];for(const A of j)g[A]&&v.push("iconify--"+g[A]);d.className=v.join(" ")}}for(let g in s){const v=s[g];if(v!==void 0)switch(g){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=v;break;case"className":d[g]=(d[g]?d[g]+" ":"")+v;break;case"inline":case"hFlip":case"vFlip":r[g]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&su(r,v);break;case"color":o.color=v;break;case"rotate":typeof v=="string"?r[g]=nu(v):typeof v=="number"&&(r[g]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete d["aria-hidden"];break;default:a[g]===void 0&&(d[g]=v)}}const u=$d(e,r),p=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,p);let g=0,v=s.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:cu(Ld(u.body,v?()=>v+"ID"+g++:"iconifyReact"))},x.createElement("svg",d)}const{body:m,width:h,height:f}=e,b=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),y=au(m,{...p,width:h+"",height:f+""});return d.style={...o,"--svg":lu(y),width:Ua(p.width),height:Ua(p.height),...uu,...b?Nn:di,...l},x.createElement("span",d)};ai(!0);Fd("",zd);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!vd(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;_d(n,r)||console.error(a)}catch{console.error(a)}}}}function ui(e){const[s,n]=x.useState(!!e.ssr),[a,r]=x.useState({});function i(f){if(f){const b=e.icon;if(typeof b=="object")return{name:"",data:b};const y=Ma(b);if(y)return{name:b,data:y}}return{name:""}}const[o,l]=x.useState(i(!!e.ssr));function d(){const f=a.callback;f&&(f(),r({}))}function u(f){if(JSON.stringify(o)!==JSON.stringify(f))return d(),l(f),!0}function p(){var f;const b=e.icon;if(typeof b=="object"){u({name:"",data:b});return}const y=Ma(b);if(u({name:b,data:y}))if(y===void 0){const g=Jd([b],p);r({callback:g})}else y&&((f=e.onLoad)===null||f===void 0||f.call(e,b))}x.useEffect(()=>(n(!0),d),[]),x.useEffect(()=>{s&&p()},[e.icon,s]);const{name:m,data:h}=o;return h?fu({...Bn,...h},e,m):e.children?e.children:e.fallback?e.fallback:x.createElement("span",{})}const M=x.forwardRef((e,s)=>ui({...e,_ref:s}));x.forwardRef((e,s)=>ui({inline:!0,...e,_ref:s}));const O=x.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));O.displayName="Button";function mi({code:e,amount:s,onRemove:n,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:s})]}),t.jsx(O,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(M,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Qs(e,s){return e-s*Math.floor(e/s)}const fi=1721426;function us(e,s,n,a){s=Wn(e,s);let r=s-1,i=-2;return n<=2?i=0:ws(s)&&(i=-1),fi-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function ws(e){return e%4===0&&(e%100!==0||e%400===0)}function Wn(e,s){return e==="BC"?1-s:s}function pu(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const xu={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class Ts{fromJulianDay(s){let n=s,a=n-fi,r=Math.floor(a/146097),i=Qs(a,146097),o=Math.floor(i/36524),l=Qs(i,36524),d=Math.floor(l/1461),u=Qs(l,1461),p=Math.floor(u/365),m=r*400+o*100+d*4+p+(o!==4&&p!==4?1:0),[h,f]=pu(m),b=n-us(h,f,1,1),y=2;n<us(h,f,3,1)?y=0:ws(f)&&(y=1);let g=Math.floor(((b+y)*12+373)/367),v=n-us(h,f,g,1)+1;return new ts(h,f,g,v)}toJulianDay(s){return us(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return xu[ws(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return ws(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function hu(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function pi(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function xi(e,s){return Ha(e)-Ha(s)}function Ha(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Zs=null;function hi(){return Zs==null&&(Zs=new Intl.DateTimeFormat().resolvedOptions().timeZone),Zs}function Wa(e){e=qn(e,new Ts);let s=Wn(e.era,e.year);return bi(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function bi(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function qa(e,s){if(s==="UTC")return 0;if(e>0&&s===hi())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=gi(e,s);return bi(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const Ga=new Map;function gi(e,s){let n=Ga.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ga.set(s,n));let a=n.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Ka=864e5;function bu(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>gu(e,s,i))}function gu(e,s,n){let a=gi(n,s);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function yu(e,s,n="compatible"){let a=vi(e);if(s==="UTC")return Wa(a);if(s===hi()&&n==="compatible"){a=qn(a,new Ts);let d=new Date,u=Wn(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=Wa(a),i=qa(r-Ka,s),o=qa(r+Ka,s),l=bu(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function yi(e,s,n="compatible"){return new Date(yu(e,s,n))}function vi(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new Ss(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function qn(e,s){if(hu(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,Mt(a),a}function Gn(e,s){let n=e.copy(),a="hour"in n?$i(n,s):0;Cn(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,kn(n),wi(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,vu(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function Cn(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function kn(e){for(;e.month<1;)Cn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,Cn(e,1)}function vu(e){for(;e.day<1;)e.month--,kn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,kn(e)}function wi(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Mt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),wi(e)}function ji(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function Ni(e,s){return Gn(e,ji(s))}function Ci(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),Mt(n),n}function ki(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),Si(n),n}function wu(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ms(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ms(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ms(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=ms(e.hour,24),s}function Si(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function ms(e,s){let n=e%s;return n<0&&(n+=s),n}function $i(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,wu(e)}function Ai(e,s){let n=e.copy();return $i(n,s),n}function ju(e,s){return Ai(e,ji(s))}function Ei(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=bt(d,n,0,l.length-1,a?.round),r.era=l[d],Mt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=bt(e.year,n,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=bt(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=bt(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Mt(r),r}function Di(e,s,n,a){let r=e.copy();switch(s){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=bt(i,n,o,l,a?.round);break}case"minute":r.minute=bt(e.minute,n,0,59,a?.round);break;case"second":r.second=bt(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=bt(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function bt(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const Nu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Cu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function ku(e){let s=e.match(Nu);if(!s)throw Cu.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new ts(Xs(s[1],0,9999),Xs(s[2],1,12),1);return n.day=Xs(s[3],1,n.calendar.getDaysInMonth(n)),n}function Xs(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function Li(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function Fi(e){let s=qn(e,new Ts),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function Su(e){return`${Fi(e)}T${Li(e)}`}function $u(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Kn(e,s,n){$u(e,s),s.set(e,n)}function _i(e){let s=typeof e[0]=="object"?e.shift():new Ts,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var Au=new WeakMap;class ts{copy(){return this.era?new ts(this.calendar,this.era,this.year,this.month,this.day):new ts(this.calendar,this.year,this.month,this.day)}add(s){return Gn(this,s)}subtract(s){return Ni(this,s)}set(s){return Ci(this,s)}cycle(s,n,a){return Ei(this,s,n,a)}toDate(s){return yi(this,s)}toString(){return Fi(this)}compare(s){return pi(this,s)}constructor(...s){Kn(this,Au,{writable:!0,value:void 0});let[n,a,r,i,o]=_i(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,Mt(this)}}var Eu=new WeakMap;class Is{copy(){return new Is(this.hour,this.minute,this.second,this.millisecond)}add(s){return Ai(this,s)}subtract(s){return ju(this,s)}set(s){return ki(this,s)}cycle(s,n,a){return Di(this,s,n,a)}toString(){return Li(this)}compare(s){return xi(this,s)}constructor(s=0,n=0,a=0,r=0){Kn(this,Eu,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,Si(this)}}var Du=new WeakMap;class Ss{copy(){return this.era?new Ss(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Ss(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return Gn(this,s)}subtract(s){return Ni(this,s)}set(s){return Ci(ki(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return Ei(this,s,n,a);default:return Di(this,s,n,a)}}toDate(s,n){return yi(this,s,n)}toString(){return Su(this)}compare(s){let n=pi(this,s);return n===0?xi(this,vi(s)):n}constructor(...s){Kn(this,Du,{writable:!0,value:void 0});let[n,a,r,i,o]=_i(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,Mt(this)}}const Lu="Open time options",Fu=320;function Ya(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function Js(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Is(s,n,a)}function _u(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function Ru(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Is(n,a));return s}function Mu(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=Lu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...p}=e,m=l!==void 0,[h,f]=x.useState(()=>Js(d)),b=m?Js(l):h,y=x.useMemo(()=>Ru(s),[s]),g=j=>{m||f(j),o?.(j)},v=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(J.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:y.map(j=>{const A=b?.hour===j.hour&&b?.minute===j.minute;return t.jsx(c.Button,{variant:A?"flat":"light",color:A?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>g(j),children:_u(j,u)},`${j.hour}:${j.minute}`)})})})})]});return t.jsx(c.TimeInput,{...p,value:m?b:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,v]}),onChange:j=>g(Js(j))})}function Yn(e){if(e.mode==="time")return t.jsx(Mu,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=Fu,disableAnimation:d=!0,classNames:u,...p}=e;return t.jsx(c.DatePicker,{...p,calendarWidth:l,classNames:{...u,popoverContent:Ya("min-w-[20rem]",u?.popoverContent),calendarContent:Ya("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:s,granularity:n="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:n})}function Pu({label:e,...s}){return t.jsx("button",{...s,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function Tu(e){return e!==void 0&&e.trim()!==""}function Ri(e,s){const n=Zr();if(x.isValidElement(s))return s;const a=[e,n].find(Tu);return a===void 0?void 0:t.jsx(Pu,{label:a})}const Mi=x.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ri(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});Mi.displayName="Drawer";const as=x.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ri(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});as.displayName="Modal";function Iu(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const st=x.forwardRef(({popoverProps:e,...s},n)=>{const a=x.useRef(null),[r,i]=x.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return x.useEffect(()=>{i(Iu(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});st.displayName="Select";const Ou="text-default-600 data-[hover=true]:text-default-700",Qn=x.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn(Ou,e?.th)}}));Qn.displayName="Table";function zu({state:e,onSubmit:s,onRemove:n,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[p,m]=x.useState(""),h=x.useId(),[f,b]=x.useState(e);e!==f&&(b(e),e==="applied"&&m(""));const y=()=>{const j=p.trim();j&&s(j)},g=j=>{j.key==="Enter"&&(j.preventDefault(),y())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(mi,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const v=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:p,onValueChange:m,onKeyDown:g,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":v?h:void 0}),t.jsx(O,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!p.trim(),onPress:y,children:l})]}),v&&t.jsx("p",{id:h,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Bu={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Vu({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(st,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(J.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(st,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(J.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Uu({isLoggedIn:e,onLogin:s,onLogout:n,labels:a}){return e?t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(O,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(J.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Hu({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:p}){const m={...Bu,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",p),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||s.length>0)&&t.jsx(Vu,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Uu,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function Wu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var en;const qu=typeof document<"u"?(en=x.useInsertionEffect)!==null&&en!==void 0?en:x.useLayoutEffect:()=>{};function Os(e,s,n){let[a,r]=x.useState(e||s),i=x.useRef(a),o=x.useRef(e!==void 0),l=e!==void 0;x.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;qu(()=>{i.current=d});let[,u]=x.useReducer(()=>({}),{}),p=x.useCallback((m,...h)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),n?.(f,...h))},[n]);return[d,p]}function Pi(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Ie.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Ti=x.forwardRef(({color:e="primary",variant:s="default",stepsCount:n=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:p="compact",stepCounterFormat:m,onStepChange:h,currentStep:f,hideProgressBars:b=!1,stepClassName:y,className:g,isDisabled:v=!1,...j},A)=>{const[w,E]=Os(f,a,h),$=x.useMemo(()=>{let N,C;const k=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":N="[--step-color:var(--heroui-primary)]",C="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":N="[--step-color:var(--heroui-secondary)]",C="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":N="[--step-color:var(--heroui-success)]",C="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":N="[--step-color:var(--heroui-warning)]",C="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":N="[--step-color:var(--heroui-danger)]",C="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":N="[--step-color:var(--heroui-default)]",C="[--step-fg-color:var(--heroui-default-foreground)]";break;default:N="[--step-color:var(--heroui-primary)]",C="[--step-fg-color:var(--heroui-primary-foreground)]";break}return k.unshift(C),k.unshift(N),k},[e]);return t.jsxs("nav",{ref:A,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",p==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",g),"data-testid":"stepper-root",...j,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",$,g),"data-testid":"stepper-list",children:Array.from({length:n})?.map((N,C)=>{const k=w===C?"active":w<C?"inactive":"complete",_=s==="activeLabel"&&k==="active"&&!!i?.[C],F=o&&k!=="active"&&!!i?.[C];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${C}`,children:[t.jsx(c.Tooltip,{content:F?i?.[C]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":k==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":v},y),onClick:()=>!v&&E(C),disabled:v,"data-testid":`stepper-step-btn-${C}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Ie.LazyMotion,{features:Ie.domAnimation,children:t.jsx(Ie.m.div,{animate:k,className:"relative z-10",children:t.jsx(Ie.m.div,{animate:k,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":k==="complete","shadow-lg":k==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:k==="complete"&&s==="default"?t.jsx(Pi,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${C}`}):t.jsx("span",{children:C+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${C}`,children:i[C]}):null]},C)}),C<n-1&&!b&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":C},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":C<w})})})]},C)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null]})});Ti.displayName="Stepper";function Gu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Pt(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function Zn(e,s,n="en-US"){const a=Pt(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function Sn(e,s,n,a){return Zn(e-s,n,a)}const Qa={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},Ku="rgb(156 163 175)",Yu="rgb(107 114 128)",Ii=x.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Ku,inactiveLabelColor:p=Yu,activeStepVariant:m="bordered",stepClassName:h,circleClassName:f,progressBarClassName:b,labelsClassName:y,labelSlotClassName:g,activeLabelClassName:v,inactiveLabelClassName:j,className:A,ariaLabel:w="Progress",invalidLabelSuffix:E=", has errors",testId:$,isStepReachable:N,...C},k){const[_,F]=Os(i,a,r),D=Qa[s]??Qa.primary,P=l??D.active,T=d??D.fg,W=(Y,z)=>{const K=Y.ariaLabel??(typeof Y.title=="string"?Y.title:null)??`${z+1}`;return Y.invalid?`${K}${E}`:K};return t.jsxs("nav",{...C,"aria-label":w,...$?{"data-testid":$}:{},children:[t.jsx("div",{className:c.cn("flex items-center",A),children:n?.map((Y,z)=>{const G=z===_?"active":z<_?"complete":"inactive",K=N?N(z):!0;return t.jsxs(x.Fragment,{children:[t.jsx(O,{ref:k,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${$??"horizontal-steps"}-step-${z}`,"aria-current":G==="active"?"step":void 0,"aria-describedby":Y.describedBy,"aria-label":W(Y,z),"data-invalid":Y.invalid?"true":void 0,isDisabled:!K,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",K?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",Y.className,h),onPress:()=>{if(i===void 0){F(z);return}r?.(z)},children:t.jsx(Ie.LazyMotion,{features:Ie.domAnimation,children:t.jsx(Ie.m.div,{animate:G,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?P:"transparent",borderColor:P,borderWidth:"1.5px",color:m==="solid"?T:P},complete:{backgroundColor:P,borderColor:P,borderWidth:"1.5px",color:P}},children:G==="complete"?t.jsx(Pi,{className:"size-4",style:{color:T}}):t.jsx("span",{children:z+1})})})}),z<n.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",b),style:{backgroundColor:z<_?P:u}})]},z)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",y),children:n?.map((Y,z)=>{const G=z<=_;return t.jsxs(x.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",g),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",G?v:j),style:{color:G?P:p},children:Y.title})}),z<n.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",b)})]},z)})})]})});Ii.displayName="HorizontalSteps";function Qu(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const Zu=e=>{const s=x.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Xu,{...e},s)},Xu=({allItems:e,selected:s,onSelectedChange:n,titleLeft:a,titleRight:r})=>{const[i,o]=x.useState([]),[l,d]=x.useState([]),[u,p]=x.useState(null),[m,h]=x.useState(null),f=x.useMemo(()=>new Set(s),[s]),b=x.useMemo(()=>new Set(e),[e]),y=x.useMemo(()=>e.filter(F=>!f.has(F)),[e,f]),g=F=>{if(F.length===0)return;const D=Array.from(new Set([...s,...F]));n(D)},v=F=>{if(F.length===0)return;const D=new Set(F);n(s.filter(P=>!D.has(P)))},j=()=>{i.length!==0&&(g(i),o([]))},A=()=>{l.length!==0&&(v(l),d([]))},w=()=>{y.length!==0&&(g(y),o([]))},E=()=>{s.length!==0&&(n([]),d([]))},$=(F,D,P)=>{const T=Math.min(D,P),W=Math.max(D,P);return F.slice(T,W+1)},N=(F,D,P)=>{if(P&&u!==null){o($(y,u,D)),d([]),p(D);return}const T=i.includes(F);o(T?i.filter(W=>W!==F):[...i,F]),d([]),p(D)},C=(F,D,P)=>{if(P&&m!==null){d($(s,m,D)),o([]),h(D);return}const T=l.includes(F);d(T?l.filter(W=>W!==F):[...l,F]),o([]),h(D)},k=(F,D,P)=>{const T=P==="available"?i.includes(D)?i:[D]:l.includes(D)?l:[D];F.dataTransfer.setData("text/plain",JSON.stringify({source:P,items:T})),F.dataTransfer.effectAllowed="move"},_=(F,D)=>{F.preventDefault();const P=F.dataTransfer.getData("text/plain");if(P)try{const T=JSON.parse(P),W=(T.items||[]).filter(Y=>b.has(Y));if(W.length===0||T.source===D)return;D==="selected"?(g(W),o([])):(v(W),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:y.map((F,D)=>{const P=i.includes(F);return t.jsx("button",{type:"button",onClick:T=>{N(F,D,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>k(T,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:j,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:A,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:y.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(O,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:E,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:s.map((F,D)=>{const P=l.includes(F);return t.jsx("button",{type:"button",onClick:T=>{C(F,D,T.shiftKey)},onMouseDown:T=>{T.shiftKey&&T.preventDefault()},draggable:!0,onDragStart:T=>k(T,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ss(e){return typeof e=="string"?e:e.type}function yt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function wt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const ut={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Ju={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function em({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=ut.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,startContent:t.jsx(J.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(J.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Ju[o]},o))})]})}const tn={bulletList:{label:"Bullet List",icon:J.List},orderedList:{label:"Numbered List",icon:J.ListOrdered},taskList:{label:"Task List",icon:J.ListTodo}};function tm({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,a]=x.useState(0);x.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive(l)),i=r?tn[r].icon:J.List,o=l=>{const u=ut[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:s.map(l=>{const d=tn[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:tn[l].label},l)})})]})}function sm({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(r),className:`
8
8
  w-8 h-8 rounded-full border-2 cursor-pointer
9
9
  transition-all duration-200
10
10
  hover:scale-110 hover:shadow-md
11
11
  focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
12
12
  ${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
13
- `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Bo=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Vo=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function qt(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const ye={min:50,max:200,step:10,default:100},ys={lineHeight:24,toolbarHeight:60},Uo={bold:G.Bold,italic:G.Italic,strike:G.Strikethrough,underline:G.Underline,code:G.Code,textColor:G.Palette,highlight:G.Highlighter,link:G.Link2,paragraph:G.FileText,heading:G.Heading,bulletList:G.List,orderedList:G.ListOrdered,taskList:G.ListTodo,codeBlock:G.CodeSquare,blockquote:G.Quote,horizontalRule:G.Minus,clearMarks:G.Eraser,clearNodes:G.Eraser,undo:G.Undo2,redo:G.Redo2,hardBreak:G.CornerDownLeft,textAlign:G.AlignLeft},Ho={left:G.AlignLeft,center:G.AlignCenter,right:G.AlignRight,justify:G.AlignJustify};function Qe(e){return Uo[e]}function qo({value:e,onChange:n,onApply:s,placeholder:a="#000000"}){const[r,i]=p.useState(""),l=u=>{const f=u.target.value;n(f),r&&i("")},o=()=>{if(!e){i("Please enter a color");return}if(!qt(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),s(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),o())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:l,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:qt(e)?e:"transparent"}})}),t.jsx(U,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:o,"aria-label":"Apply custom color",isDisabled:!e||!qt(e),children:t.jsx(G.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function vs({editor:e,type:n,allowCustomColor:s=!0,label:a,isDisabled:r=!1}){const[i,l]=p.useState(!1),[o,d]=p.useState(""),u=n==="textColor"?Bo:Vo,f=y=>{const v=Te[n];v&&v.execute({editor:e,config:{type:n,color:y}}),l(!1),d("")},m=y=>{f(y)},x=()=>{const y=Te[n];y&&y.execute({editor:e,config:{type:n,color:""}}),l(!1)},h=n==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=n==="textColor"?G.Palette:G.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:l,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(U,{size:"sm",radius:"sm",variant:h?"solid":"bordered",color:h?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(U,{size:"sm",variant:"light",isIconOnly:!0,onPress:x,"aria-label":"Clear color",children:t.jsx(G.X,{size:16})})]}),t.jsx(zo,{colors:u,onColorSelect:f}),s&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(qo,{value:o,onChange:d,onApply:m})]})]})]})})]})}function Wo({zoom:e,onZoomChange:n,min:s=ye.min,max:a=ye.max,step:r=ye.step}){const i=()=>{const m=Math.max(s,e-r);n(m)},l=()=>{const m=Math.min(a,e+r);n(m)},o=()=>{n(ye.default)},d=e<=s,u=e>=a,f=e===ye.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(U,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(G.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:f?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:o,disabled:f,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const nm=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],am=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function sn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Fe={min:50,max:200,step:10,default:100},Za={lineHeight:24,toolbarHeight:60},rm={bold:J.Bold,italic:J.Italic,strike:J.Strikethrough,underline:J.Underline,code:J.Code,textColor:J.Palette,highlight:J.Highlighter,link:J.Link2,paragraph:J.FileText,heading:J.Heading,bulletList:J.List,orderedList:J.ListOrdered,taskList:J.ListTodo,codeBlock:J.CodeSquare,blockquote:J.Quote,horizontalRule:J.Minus,clearMarks:J.Eraser,clearNodes:J.Eraser,undo:J.Undo2,redo:J.Redo2,hardBreak:J.CornerDownLeft,textAlign:J.AlignLeft},im={left:J.AlignLeft,center:J.AlignCenter,right:J.AlignRight,justify:J.AlignJustify};function Dt(e){return rm[e]}function lm({value:e,onChange:s,onApply:n,placeholder:a="#000000"}){const[r,i]=x.useState(""),o=u=>{const p=u.target.value;s(p),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!sn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),n(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:sn(e)?e:"transparent"}})}),t.jsx(O,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!sn(e),children:t.jsx(J.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Xa({editor:e,type:s,allowCustomColor:n=!0,label:a,isDisabled:r=!1}){const[i,o]=x.useState(!1),[l,d]=x.useState(""),u=s==="textColor"?nm:am,p=y=>{const g=ut[s];g&&g.execute({editor:e,config:{type:s,color:y}}),o(!1),d("")},m=y=>{p(y)},h=()=>{const y=ut[s];y&&y.execute({editor:e,config:{type:s,color:""}}),o(!1)},f=s==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),b=s==="textColor"?J.Palette:J.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(b,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(O,{size:"sm",variant:"light",isIconOnly:!0,onPress:h,"aria-label":"Clear color",children:t.jsx(J.X,{size:16})})]}),t.jsx(sm,{colors:u,onColorSelect:p}),n&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(lm,{value:l,onChange:d,onApply:m})]})]})]})})]})}function om({zoom:e,onZoomChange:s,min:n=Fe.min,max:a=Fe.max,step:r=Fe.step}){const i=()=>{const m=Math.max(n,e-r);s(m)},o=()=>{const m=Math.min(a,e+r);s(m)},l=()=>{s(Fe.default)},d=e<=n,u=e>=a,p=e===Fe.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(J.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:p?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:p,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
- ${f?"cursor-default":"cursor-pointer hover:text-primary"}
16
- `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(U,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:l,"aria-label":"Zoom in",children:t.jsx(G.ZoomIn,{size:16})})})]})}function Yo({editor:e,isDisabled:n=!1}){const[s,a]=p.useState(!1),[r,i]=p.useState(""),[l,o]=p.useState(""),[d,u]=p.useState(!1),f=e.isActive("link"),m=h=>{if(h){const{from:b,to:y}=e.state.selection,v=e.isActive("link");let N="";if(v){const C=e.schema.marks.link,w=e.state.doc.resolve(b),S=Jn.getMarkRange(w,C);S&&(N=e.state.doc.textBetween(S.from,S.to,""))}else N=e.state.doc.textBetween(b,y,"");const j=e.getAttributes("link").href||"";i(N),o(j),u(v)}a(h)},x=()=>{if(l.trim()){const{from:h,to:b}=e.state.selection,y=e.schema.marks.link,v=e.state.doc.resolve(h),N=Jn.getMarkRange(v,y),j=N?.from??h,C=N?.to??b,w=e.state.doc.textBetween(j,C,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:j,to:C}).deleteSelection().insertContent(`<a href="${l.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:l.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:s,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(U,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:n,"aria-label":"Link",children:t.jsx(G.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:h=>i(h.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:l,onChange:h=>o(h.target.value),onKeyDown:h=>h.key==="Enter"&&x(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(U,{size:"sm",color:"primary",onPress:x,isDisabled:!l.trim(),children:d?"Update":"Apply"})]})})]})}function Go({children:e,id:n,label:s,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:n,"aria-label":s,className:a,children:e}):t.jsx("div",{id:n,role:"group","aria-label":s,className:`flex items-center gap-2 ${a||""}`,children:e})}function La(e,n){const s=p.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(n.map(o=>ut(o)))).forEach(o=>{const d=Te[o];if(d)try{const u=d.canExecute?.(e)??!0,f=d.isActive?.(e)??!1;i[o]={isActive:f,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${o}`,u),i[o]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,n]),[a,r]=p.useState(s);return p.useEffect(()=>{if(!e)return;const i=()=>{const l={};Array.from(new Set(n.map(d=>ut(d)))).forEach(d=>{const u=Te[d];if(u)try{const f=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;l[d]={isActive:m,isDisabled:!f,canExecute:f}}catch(f){console.warn(`Extension not available for modifier: ${d}`,f),l[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(l)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,n,s]),a}function Ia(e,n){const s=p.useCallback((l,o)=>{if(!e)return;const d=Te[l];if(d)try{d.execute({editor:e,config:o}),n?.({type:"toggle",modifier:l})}catch(u){console.warn(`Failed to execute command for modifier: ${l}`,u)}},[e,n]),a=p.useCallback(l=>{s(l)},[s]),r=p.useCallback((l,o)=>{if(!e)return!1;const d=Te[l];try{return d?.canExecute?.(e,o)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${l}`,u),!1}},[e]),i=p.useCallback((l,o)=>{if(!e)return!1;const d=Te[l];try{return d?.isActive?.(e,o)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${l}`,u),!1}},[e]);return{executeCommand:s,toggleModifier:a,canExecute:r,isActive:i}}function Ko(e=ye.default){const[n,s]=p.useState(e),a=p.useCallback((o=ye.step)=>{s(d=>Math.min(ye.max,d+o))},[]),r=p.useCallback((o=ye.step)=>{s(d=>Math.max(ye.min,d-o))},[]),i=p.useCallback(()=>{s(ye.default)},[]),l=p.useCallback(o=>{const d=Math.max(ye.min,Math.min(ye.max,o));s(d)},[]);return{zoom:n,setZoom:l,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:n<=ye.min,isMaxZoom:n>=ye.max,isDefaultZoom:n===ye.default}}const Qo=["bold","italic","strike","underline","code"];function Zo({editor:e,modifiers:n,onToolbarAction:s}){const a=La(e,n),{toggleModifier:r}=Ia(e,s);if(!e)return null;const i=n.map(l=>ut(l)).filter(l=>Qo.includes(l));return i.length===0?null:t.jsx(Go,{id:"text-formatting",label:"Text formatting",children:i.map(l=>{const o=a[l],d=Qe(l);return t.jsx(qe,{icon:d,label:l.charAt(0).toUpperCase()+l.slice(1),isActive:o?.isActive,isDisabled:o?.isDisabled,onClick:()=>r(l)},l)})})}function Xo({editor:e,modifiers:n,zoom:s=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:l}){const o=La(e,n),{toggleModifier:d,executeCommand:u}=Ia(e,l);if(!e)return null;const f=n.map(A=>ut(A)),m=f.some(A=>["bold","italic","strike","underline","code"].includes(A)),x=f.some(A=>["textColor","highlight"].includes(A)),h=f.includes("heading"),b=f.includes("textAlign"),y=f.some(A=>["bulletList","orderedList","taskList"].includes(A)),v=f.includes("blockquote"),N=f.includes("codeBlock"),j=f.includes("link"),C=f.includes("horizontalRule"),w=f.some(A=>["undo","redo"].includes(A)),S=s!==void 0&&a!==void 0,E=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${E} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(Zo,{editor:e,modifiers:n,onToolbarAction:l}),(x||h||b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),x&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("textColor")&&t.jsx(vs,{editor:e,type:"textColor",label:"Text color",isDisabled:o.textColor?.isDisabled}),f.includes("highlight")&&t.jsx(vs,{editor:e,type:"highlight",label:"Highlight",isDisabled:o.highlight?.isDisabled})]}),(h||b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsx(Oo,{editor:e}),(b||y||v||N||j||C||w||S)&&t.jsx(He,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(A=>{const L=Ho[A],M=e.isActive({textAlign:A});return t.jsx(qe,{icon:L,label:`Align ${A}`,isActive:M,onClick:()=>u("textAlign",{type:"textAlign",alignment:A})},A)})}),(y||v||N||j||C||w||S)&&t.jsx(He,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(Ro,{editor:e,types:f.filter(A=>["bulletList","orderedList","taskList"].includes(A))}),(v||N||j||C||w||S)&&t.jsx(He,{})]}),(v||N||j||C)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[v&&t.jsx(qe,{icon:Qe("blockquote"),label:"Blockquote",isActive:o.blockquote?.isActive,isDisabled:o.blockquote?.isDisabled,onClick:()=>d("blockquote")}),N&&t.jsx(qe,{icon:Qe("codeBlock"),label:"Code block",isActive:o.codeBlock?.isActive,isDisabled:o.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),j&&t.jsx(Yo,{editor:e,isDisabled:o.link?.isDisabled}),C&&t.jsx(qe,{icon:Qe("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||S)&&t.jsx(He,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[f.includes("undo")&&t.jsx(qe,{icon:Qe("undo"),label:"Undo",isDisabled:o.undo?.isDisabled,onClick:()=>d("undo")}),f.includes("redo")&&t.jsx(qe,{icon:Qe("redo"),label:"Redo",isDisabled:o.redo?.isDisabled,onClick:()=>d("redo")})]}),S&&t.jsx(He,{})]}),S&&t.jsx(Wo,{zoom:s,onZoomChange:A=>{a?.(A),l?.({type:"zoom",modifier:`${A}%`})}})]})})}const st={bold:{category:"mark",extension:Ci.Bold,priority:100},italic:{category:"mark",extension:ki.Italic,priority:100},strike:{category:"mark",extension:Si.Strike,priority:100},underline:{category:"mark",extension:Ai.Underline,priority:100},code:{category:"mark",extension:$i.Code,priority:100},textColor:{category:"mark",extension:Di.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Ei.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Fi.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Li.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ti.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:_i.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Pi.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:zi.CodeBlock,priority:100},blockquote:{category:"node",extension:Bi.Blockquote,priority:100},horizontalRule:{category:"node",extension:Vi.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Ui.HardBreak,priority:100},undo:{category:"extension",extension:es.History,priority:50},redo:{category:"extension",extension:es.History,priority:50},textAlign:{category:"extension",extension:Hi.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},Jo=[qi.Document,Wi.Text,Ii.Paragraph,Mi.TextStyle.configure({HTMLAttributes:{}}),Ri.ListItem.configure({HTMLAttributes:{}}),Oi.TaskItem.configure({nested:!0}),Yi.Dropcursor,Gi.Gapcursor];function ec(e){const n=[],s=new Set,a=new Set;Jo.forEach(o=>{o&&(n.push(o),a.add(o.name))});const r=e.map(o=>ut(o)),i=new Set;return r.forEach(o=>{const d=st[o];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),r.forEach(o=>{if(s.has(o))return;const d=st[o];if(!d){console.warn(`Extension config not found for modifier: ${o}`);return}if(d.extension===null){s.add(o);return}const u=d.extension.name;if(a.has(u)){s.add(o);return}const f=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;n.push(f),s.add(o),a.add(u)}),n.sort((o,d)=>{const u=Object.values(st).find(h=>h?.extension?.name===o.name),f=Object.values(st).find(h=>h?.extension?.name===d.name),m=u?.priority??100;return(f?.priority??100)-m})}const Ta={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},tc={h1:`font-size: ${oe.fontSize["4xl"]}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h2:`font-size: ${oe.fontSize["2xl"]}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h3:`font-size: ${oe.fontSize.xl}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h4:`font-size: ${oe.fontSize.lg}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h5:`font-size: ${oe.fontSize.base}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,h6:`font-size: ${oe.fontSize.sm}; font-weight: ${oe.fontWeight.semibold}; line-height: ${oe.lineHeight.tight}; margin: ${ie.md} 0 ${ie.sm} 0;`,p:`min-height: ${oe.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${ie.xl}; margin: ${ie.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${ie.xl}; margin: ${ie.md} 0;`,li:`display: list-item; margin: ${ie.xs} 0;`,strong:`font-weight: ${oe.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${ge.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${oe.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${oe.fontFamily.mono};`,pre:`background: ${ge.neutral.gray[800]}; border-radius: ${ie.sm}; color: ${ge.neutral.gray[100]}; font-family: ${oe.fontFamily.mono}; margin: ${ie.lg} 0; padding: 0.75rem ${ie.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${ge.neutral.gray[300]}; margin: ${ie.lg} 0; padding-left: ${ie.md}; color: ${ge.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${ge.neutral.gray[200]}; margin: ${ie.xl} 0;`,a:`color: ${ge.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${ge.palettes.warning[200]}; border-radius: ${ie.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${ie.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},nc={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function sc(e){if(!e)return e;let n=e;for(const[s,a]of Object.entries(nc)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${s}"[^>]*)>`,"gi");n=n.replace(r,(i,l)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${l} style="${a}">`)}for(const[s,a]of Object.entries(tc)){const r=new RegExp(`<${s}(\\s[^>]*)?>`,"gi");n=n.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const l=i.indexOf(">");return`${i.slice(0,l)} style="${a}"${i.slice(l)}`}})}return n}const ac=({modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})=>{const{editor:r}=yn.useCurrentEditor();return t.jsx(Xo,{editor:r,modifiers:e,zoom:n,onZoomChange:s,onToolbarAction:a})},rc=({showCharacterCount:e,showWordCount:n})=>{const{editor:s}=yn.useCurrentEditor();if(!s||!e&&!n)return null;const a=s.getText(),r=a.length,i=a.split(/\s+/).filter(l=>l.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),n&&t.jsxs("span",{children:[i," words"]})]})},un=p.forwardRef((e,n)=>{const{minRows:s=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:l=!1,showToolbar:o=!0,modifiers:d=Ta.full,variant:u="bordered",initialContent:f,content:m,onContentChange:x,onUpdate:h,onToolbarAction:b,isReadOnly:y=!1,isDisabled:v=!1,includeInlineStyles:N=!0,...j}=e,{zoom:C,setZoom:w}=Ko(),S=ys.lineHeight,E=s*S,A=r?void 0:a*S,L=p.useMemo(()=>ec(d),[d]),{Component:M,label:_,shouldLabelBeOutside:D,getBaseProps:$,getLabelProps:I,getInputWrapperProps:T}=c.useInput({...j,variant:u,ref:n,isMultiline:!0}),K=_?t.jsx("label",{...I(),children:_}):null,H=p.useCallback(({editor:B})=>{const X=B.getHTML(),J=N?sc(X):X,ae=B.getJSON(),q=B.getText(),Z=q.length,Q=q.split(/\s+/).filter(ee=>ee.length>0).length,W={html:J,json:ae,text:q,characters:Z,words:Q};if(x?.(W),h?.(W),"onChange"in j&&typeof j.onChange=="function"){const ee={target:{value:J},currentTarget:{value:J}};j.onChange(ee)}},[x,h,j,N]);return t.jsxs(M,{...$(),children:[D?K:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:A?`${A+ys.toolbarHeight}px`:void 0,overflow:A?"auto":void 0},children:t.jsx(yn.EditorProvider,{editable:!y&&!v,slotBefore:o?t.jsx(ac,{modifiers:d,zoom:C,onZoomChange:w,onToolbarAction:b}):void 0,slotAfter:t.jsx(rc,{showCharacterCount:i,showWordCount:l}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${E}px`,fontSize:`${C}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:L,content:m||f||e.defaultValue||"",onUpdate:H})})]})});un.displayName="TipTapEditor";const _a=p.forwardRef((e,n)=>{const{adapter:s="tiptap",variant:a="bordered",...r}=e;return s==="tiptap"?t.jsx(un,{...r,variant:a,ref:n}):(console.warn(`Adapter "${s}" is not supported. Using TipTap.`),t.jsx(un,{...r,variant:a,ref:n}))});_a.displayName="RichTextArea";function ic(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:0,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}const js=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],lc={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation"},Pa=({presetAmounts:e=js,selectedDonation:n,defaultSelectedDonation:s=null,onChange:a,onAddDonation:r,currency:i="USD",locale:l="en-US",showCustomAmount:o=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:f,mobileColumns:m=2,desktopColumns:x=3,isDisabled:h=!1,buttonVariant:b="bordered",buttonColor:y="default",inputVariant:v="bordered",size:N="md",className:j="",showCard:C=!0})=>{const w={...lc,...f},S=Array.isArray(e)?e:js,E={2:"grid-cols-2",3:"grid-cols-3"},A={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},L=`${E[m]} ${A[x]}`,[M,_]=Et(n,s,a),[D,$]=p.useState(""),[I,T]=p.useState(!1),[K,H]=p.useState(0),B=p.useCallback(Z=>{if(h)return;const Q={amount:Z.amount,isCustom:!1,presetId:Z.id};_(Q),$(""),T(!1),H(W=>W+1),r?.(Q)},[h,_,r]),X=p.useCallback(Z=>{if(h)return;if($(Z!==void 0?String(Z):""),r){_(null);return}if(Z===void 0||isNaN(Z)){_(null);return}_({amount:Z,isCustom:!0})},[h,_,r]),J=p.useCallback(()=>{if(h)return;const Z=D!==""?parseFloat(D):void 0;Z===void 0||isNaN(Z)||r?.({amount:Z,isCustom:!0})},[h,D,r]),ae=p.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),q=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[w.title&&t.jsx("h2",{className:"text-base font-semibold","data-testid":"donation-amounts-title",children:w.title}),S.length>0&&t.jsx("div",{className:c.cn("grid gap-3",L),"data-testid":"donation-amounts-presets",children:S.map(Z=>{const Q=M!==null&&!M.isCustom&&M.presetId===Z.id;return t.jsx(U,{color:Q?"primary":y,variant:Q?"solid":b,className:"w-full",onPress:()=>B(Z),isDisabled:h,"data-testid":`donation-amounts-preset-${Z.id}`,children:Z.label||ic(Z.amount,l,i)},Z.id)})}),o&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:w.customAmountPlaceholder,"aria-label":w.customAmountAriaLabel,onInput:r?()=>{_(null),T(!0)}:void 0,variant:v,radius:"full",size:N,minValue:d,maxValue:u,step:.01,formatOptions:ae,value:D!==""?parseFloat(D):void 0,onValueChange:X,isDisabled:h,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${K}`:M?.isCustom===!1?M.presetId:"custom"),r&&t.jsx(U,{color:"primary",variant:"solid",radius:"full",size:N,className:"shrink-0",onPress:J,isDisabled:h||!I,"data-testid":"donation-amounts-add-button",children:w.addDonationButton})]})]});return C?t.jsx(c.Card,{className:c.cn("w-full",j),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:q})}):t.jsx("div",{className:c.cn("w-full",j),"data-testid":"donation-amounts-plain",children:q})};Pa.displayName="DonationAmounts";const oc=e=>{const n=Math.max(0,e),s=Math.floor(n/60).toString().padStart(2,"0"),a=(n%60).toString().padStart(2,"0");return`${s}:${a} minutes`},cc=e=>{switch(e){case"warning":return G.Clock;case"error":return G.AlertCircle;case"success":return G.CheckCircle;default:return G.Clock}},dc=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Oa=p.forwardRef(({timeLeft:e,defaultTimeLeft:n=1200,onTimeChange:s,onExpire:a,variant:r="info",color:i="primary",message:l="Your cart expires in:",showIcon:o=!0,icon:d,position:u="fixed",autoStart:f=!0,formatTime:m=oc,className:x,...h},b)=>{const[y,v]=Et(e!==void 0?Math.max(0,e):void 0,Math.max(0,n),s),N=p.useRef(null),j=p.useRef(!1);p.useEffect(()=>()=>{N.current&&clearInterval(N.current)},[]),p.useEffect(()=>{if(!f||y<=0){N.current&&(clearInterval(N.current),N.current=null);return}return N.current=setInterval(()=>{v(E=>E<=1?(N.current&&(clearInterval(N.current),N.current=null),j.current||(j.current=!0,a?.()),0):E-1)},1e3),()=>{N.current&&(clearInterval(N.current),N.current=null)}},[f,y,v,a]),p.useEffect(()=>{y>0&&(j.current=!1)},[y]);const C=d||cc(r),w=dc(i),S={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${l} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,S[u],x),...h,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[o&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(C,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:l})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Oa.displayName="ExpireCartTimer";const Wt=({icon:e,children:n,testId:s})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":s,children:[t.jsx(R,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:n})]}),uc=({classes:e="",name:n,imageUrl:s,eventDate:a,eventTime:r,location:i,description:l,showImage:o=!1,compact:d=!1,imageLoading:u="eager",showMoreButtonClassName:f,labels:m})=>{const[x,h]=p.useState(!1),[b,y]=p.useState(!1),v=p.useRef(null);return p.useEffect(()=>{const N=()=>{if(v.current){const j=v.current.scrollHeight>v.current.clientHeight;y(j)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[l]),t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[o&&s&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:u,alt:`Event image for ${n}`,className:"w-full h-full object-cover object-center",src:s,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:n})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:m.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(Wt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(Wt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(Wt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),l&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!x&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:l}}),!x&&b&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(b||x)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(U,{onPress:()=>h(!x),variant:"light",className:c.cn("text-primary",f),size:d?"sm":"md",startContent:t.jsx(R,{icon:x?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:x?m.showLess||"Hide":m.showMore||"Show"})})]})]})]})};function fn(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function fc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const mc={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},Ge=e=>typeof e=="number"&&!isNaN(e),wt=({offer:e,quantity:n,defaultQuantity:s=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:l,slots:o,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:f="default",showCard:m=!0,showDescription:x=!0,showPeopleCount:h=!0,showPrice:b=!0,priceDisplay:y,classNames:v={},"data-testid":N,selectedColor:j="default",compact:C=!1,isSoldOut:w,isMaxReached:S,isRuleBlocked:E,statusTone:A="default",statusLabel:L,disabledReason:M,disabled:_})=>{const D=p.useMemo(()=>({...mc,...l}),[l]),[$,I]=p.useState(s),T=n!==void 0?n:$,K=!!(d||_),H=C||!!e.compact,B=p.useMemo(()=>typeof w=="boolean"?w:typeof e.isSoldOut=="boolean"?e.isSoldOut:!Ge(e.totalTicketsSold)||!Ge(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[w,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),X=p.useMemo(()=>typeof S=="boolean"?S:typeof e.isMaxReached=="boolean"?e.isMaxReached:B||!Ge(e.ticketsAllowed)?!1:T>=e.ticketsAllowed-(e.totalTicketsSold??0),[S,e.isMaxReached,B,e.ticketsAllowed,e.totalTicketsSold,T]),J=p.useMemo(()=>typeof E=="boolean"?E:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[E,e.isRuleBlocked]),ae=M||e.disabledReason,q=K||B||J,Z=te=>{if(q||te>0&&X)return;const he=Math.max(0,T+te);n===void 0&&I(he),a?.(e.id,he)},Q=p.useMemo(()=>{if(B)return"soldOut";if(J)return"ruleBlocked";if(K)return"disabled"},[B,J,K]),W=p.useMemo(()=>A||(B||J?"danger":X?"warning":"default"),[A,B,J,X]),ee=p.useMemo(()=>{if(Q)return Q==="ruleBlocked"?L||ae||D.ruleBlocked:Q==="soldOut"?L||ae||D.soldOut:Q==="disabled"?L||ae||D.disabled:L||D.maxReached},[Q,L,ae,D]),ce={soldOut:"danger",ruleBlocked:W,disabled:"default",maxReached:"warning"},de={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},ve=()=>o?.renderName?o.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",H&&"text-sm",v.name),children:e.name}),be=()=>{if(!b)return null;const te=y?.price??e.price,he=y?.originalPrice,Le=fn(te,i,r);if(o?.renderPrice)return o.renderPrice(te,Le,e);if(Ge(he)&&Ge(te)&&he>te){const pe=fn(he,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",H&&"mt-0.5",v.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",pe,", discounted price ",Le]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",H&&"text-xs",v.originalPrice),children:pe}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",H&&"text-sm",v.discountedPrice),children:Le})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",H&&"text-sm mt-0.5",v.price),children:Le})},Se=()=>!x||!e.description?null:o?.renderDescription?o.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",H&&"mb-2 text-xs text-gray-600",v.description),children:e.description}),_e=()=>{if(!h||!Ge(e.numberOfPeople)||e.numberOfPeople<=0)return null;const te=e.numberOfPeople===1?D.person:D.people;return o?.renderPeopleCount?o.renderPeopleCount(e.numberOfPeople,te,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",H&&"mt-1 text-xs",v.peopleCount),children:[t.jsx(R,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",te]})},Pe=()=>{const te=T===0||q,he=X||q;return o?.renderQuantitySelector?o.renderQuantitySelector({quantity:T,onIncrement:()=>Z(1),onDecrement:()=>Z(-1),isDecrementDisabled:te,isIncrementDisabled:he,isDisabled:q}):t.jsxs("div",{className:c.cn("flex items-center gap-2",v.quantitySelector),children:[t.jsx(U,{"data-testid":"offer-card-decrement-button",onPress:()=>Z(-1),isDisabled:te,variant:u,color:T>0?j:f,radius:"full",isIconOnly:!0,size:H?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(R,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",H&&"text-sm"),children:T}),t.jsx(U,{"data-testid":"offer-card-increment-button",onPress:()=>Z(1),isDisabled:he,variant:u,color:T>0?j:f,radius:"full",isIconOnly:!0,size:H?"md":"sm","aria-label":"Increase quantity",children:t.jsx(R,{icon:"gravity-ui:plus",width:16})})]})},Oe=(te,he)=>o?.renderDisabledState?o.renderDisabledState(te,he):te==="soldOut"&&o?.renderSoldOut?o.renderSoldOut(he):te==="maxReached"&&o?.renderMaxReachedAlert?o.renderMaxReachedAlert(he):t.jsx(c.Chip,{"data-testid":de[te],color:ce[te],variant:te==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",te==="maxReached"?"h-8":"h-10",te==="soldOut"&&v.soldOut,te==="maxReached"&&v.maxReachedAlert,H&&"h-8"),startContent:t.jsx(R,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:he})}),Ve=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",H?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",q||X?"opacity-50 pointer-events-none select-none":""),children:[ve(),be(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",H?"mb-1":"mb-2"),children:[_e(),Se()]})]}),t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",H&&"space-x-1 pb-1 md:p-1",v.compactFooter),children:Q&&ee?Oe(Q,ee):Pe()})]}),Fe=X&&!B&&!J&&!K?t.jsx(Ce.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",v.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Oe("maxReached",ee||D.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",H&&v.compact,v.base),"data-testid":N||`offer-card-${e.id}`,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",H?"pb-0.5":"",v.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Fe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",H?"pt-1":"",v.footer),children:Fe})})]}):t.jsxs("div",{className:c.cn("w-full",H&&v.compact,v.base),"data-testid":N||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",H?"pb-0.5":"",v.body),children:Ve}),t.jsx(Ce.AnimatePresence,{children:Fe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",H?"pt-1":"",v.footer),children:Fe})})]})};wt.displayName="OfferCard";const Ra=({message:e="No offers available.",icon:n="solar:ticket-sale-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const o=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})}const l=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(R,{"data-testid":"offer-card-empty-icon",icon:n,width:s,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})};Ra.displayName="OfferCardEmpty";const hc={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},za=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...hc,...n},l=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:l})};za.displayName="OfferCardError";const xc={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ba=({quantity:e=2,gap:n=4,classNames:s={}})=>{const a=xc[n];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,s.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",s.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ba.displayName="OfferCardSkeleton";const Va={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Ua={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},pc={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ha=({offers:e=[],mapOffer:n,selection:s,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:l="USD",locale:o="en-US",labels:d,slots:u,isDisabled:f=!1,buttonVariant:m="bordered",buttonColor:x="default",showCard:h=!0,animated:b=!0,gap:y=2,compact:v=!1,classNames:N={}})=>{const[j,C]=p.useState(a),w=s!==void 0?s:j,S=p.useCallback((D,$)=>{const I={...w,[D]:Math.max(0,$)};s===void 0&&C(I),r?.(I),i?.(D,I[D])},[w,s,r,i]),E=[...e].sort((D,$)=>(D.position??0)-($.position??0)),A=D=>{const $=n?n(D):D,I=(w??{})[$.id]||0;return{offer:$,quantity:I,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:v}},L=pc[y],M=c.cn("grid mx-auto pt-2",L,N.base),_=D=>{const $=A(D);return t.jsx(wt,{offer:$.offer,quantity:$.quantity,onQuantityChange:$.onQuantityChange,currency:$.currency,locale:$.locale,labels:$.labels,slots:$.slots,isDisabled:$.isDisabled,buttonVariant:$.buttonVariant,buttonColor:$.buttonColor,showCard:$.showCard,compact:$.compact,classNames:N.card},$.offer.id)};return b?t.jsx(Ce.motion.div,{"data-testid":"offer-card-list",className:M,variants:Va,initial:"hidden",animate:"show",children:t.jsx(Ce.AnimatePresence,{children:E.map(D=>{const $=A(D);return t.jsx(Ce.motion.div,{"data-testid":`offer-card-list-item-${$.offer.id}`,className:N.cardWrapper,variants:Ua,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(wt,{offer:$.offer,quantity:$.quantity,onQuantityChange:S,currency:l,locale:o,labels:d,slots:u,isDisabled:f,buttonVariant:m,buttonColor:x,showCard:h,compact:v||$.offer.compact,classNames:N.card})},$.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:M,children:E.map(_)})};Ha.displayName="OfferCardList";var ft=e=>e.type==="checkbox",We=e=>e instanceof Date,ke=e=>e==null;const qa=e=>typeof e=="object";var me=e=>!ke(e)&&!Array.isArray(e)&&qa(e)&&!We(e),Wa=e=>me(e)&&e.target?ft(e.target)?e.target.checked:e.target.value:e,gc=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Ya=(e,n)=>e.has(gc(n)),bc=e=>{const n=e.constructor&&e.constructor.prototype;return me(n)&&n.hasOwnProperty("isPrototypeOf")},Fn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ue(e){if(e instanceof Date)return new Date(e);const n=typeof FileList<"u"&&e instanceof FileList;if(Fn&&(e instanceof Blob||n))return e;const s=Array.isArray(e);if(!s&&!(me(e)&&bc(e)))return e;const a=s?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=ue(e[r]));return a}var Mt=e=>/^\w*$/.test(e),le=e=>e===void 0,Mn=e=>Array.isArray(e)?e.filter(Boolean):[],Ln=e=>Mn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),z=(e,n,s)=>{if(!n||!me(e))return s;const a=(Mt(n)?[n]:Ln(n)).reduce((r,i)=>ke(r)?r:r[i],e);return le(a)||a===e?le(e[n])?s:e[n]:a},Ae=e=>typeof e=="boolean",Ne=e=>typeof e=="function",re=(e,n,s)=>{let a=-1;const r=Mt(n)?[n]:Ln(n),i=r.length,l=i-1;for(;++a<i;){const o=r[a];let d=s;if(a!==l){const u=e[o];d=me(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=d,e=e[o]}};const Nt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},De={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ga=p.createContext(null);Ga.displayName="HookFormControlContext";const In=()=>p.useContext(Ga);var Ka=(e,n,s,a=!0)=>{const r={defaultValues:n._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const l=i;return n._proxyFormState[l]!==De.all&&(n._proxyFormState[l]=!a||De.all),s&&(s[l]=!0),e[l]}});return r};const Tn=typeof window<"u"?p.useLayoutEffect:p.useEffect;function yc(e){const n=In(),{control:s=n,disabled:a,name:r,exact:i}=e||{},[l,o]=p.useState(s._formState),d=p.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Tn(()=>s._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&o({...s._formState,...u})}}),[r,a,i]),p.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),p.useMemo(()=>Ka(l,s,d.current,!1),[l,s])}var $e=e=>typeof e=="string",mn=(e,n,s,a,r)=>$e(e)?(a&&n.watch.add(e),z(s,e,r)):Array.isArray(e)?e.map(i=>(a&&n.watch.add(i),z(s,i))):(a&&(n.watchAll=!0),s),hn=e=>ke(e)||!qa(e);function Ee(e,n,s=new WeakSet){if(hn(e)||hn(n))return Object.is(e,n);if(We(e)&&We(n))return Object.is(e.getTime(),n.getTime());const a=Object.keys(e),r=Object.keys(n);if(a.length!==r.length)return!1;if(s.has(e)||s.has(n))return!0;s.add(e),s.add(n);for(const i of a){const l=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=n[i];if(We(l)&&We(o)||me(l)&&me(o)||Array.isArray(l)&&Array.isArray(o)?!Ee(l,o,s):!Object.is(l,o))return!1}}return!0}function vc(e){const n=In(),{control:s=n,name:a,defaultValue:r,disabled:i,exact:l,compute:o}=e||{},d=p.useRef(r),u=p.useRef(o),f=p.useRef(void 0),m=p.useRef(s),x=p.useRef(a);u.current=o;const[h,b]=p.useState(()=>{const w=s._getWatch(a,d.current);return u.current?u.current(w):w}),y=p.useCallback(w=>{const S=mn(a,s._names,w||s._formValues,!1,d.current);return u.current?u.current(S):S},[s._formValues,s._names,a]),v=p.useCallback(w=>{if(!i){const S=mn(a,s._names,w||s._formValues,!1,d.current);if(u.current){const E=u.current(S);Ee(E,f.current)||(b(E),f.current=E)}else b(S)}},[s._formValues,s._names,i,a]);Tn(()=>((m.current!==s||!Ee(x.current,a))&&(m.current=s,x.current=a,v()),s._subscribe({name:a,formState:{values:!0},exact:l,callback:w=>{v(w.values)}})),[s,l,a,v]),p.useEffect(()=>s._removeUnmounted());const N=m.current!==s,j=x.current,C=p.useMemo(()=>{if(i)return null;const w=!N&&!Ee(j,a);return N||w?y():null},[i,N,a,j,y]);return C!==null?C:h}function jc(e){const n=In(),{name:s,disabled:a,control:r=n,shouldUnregister:i,defaultValue:l,exact:o=!0}=e,d=Ya(r._names.array,s),u=p.useMemo(()=>z(r._formValues,s,z(r._defaultValues,s,l)),[r,s,l]),f=vc({control:r,name:s,defaultValue:u,exact:o}),m=yc({control:r,name:s,exact:o}),x=p.useRef(e),h=p.useRef(void 0),b=p.useRef(r.register(s,{...e.rules,value:f,...Ae(e.disabled)?{disabled:e.disabled}:{}}));x.current=e;const y=p.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!z(m.errors,s)},isDirty:{enumerable:!0,get:()=>!!z(m.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!z(m.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!z(m.validatingFields,s)},error:{enumerable:!0,get:()=>z(m.errors,s)}}),[m,s]),v=p.useCallback(w=>b.current.onChange({target:{value:Wa(w),name:s},type:Nt.CHANGE}),[s]),N=p.useCallback(()=>b.current.onBlur({target:{value:z(r._formValues,s),name:s},type:Nt.BLUR}),[s,r._formValues]),j=p.useCallback(w=>{const S=z(r._fields,s);S&&S._f&&w&&(S._f.ref={focus:()=>Ne(w.focus)&&w.focus(),select:()=>Ne(w.select)&&w.select(),setCustomValidity:E=>Ne(w.setCustomValidity)&&w.setCustomValidity(E),reportValidity:()=>Ne(w.reportValidity)&&w.reportValidity()})},[r._fields,s]),C=p.useMemo(()=>({name:s,value:f,...Ae(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:v,onBlur:N,ref:j}),[s,a,m.disabled,v,N,j,f]);return p.useEffect(()=>{const w=r._options.shouldUnregister||i,S=h.current;S&&S!==s&&!d&&r.unregister(S),r.register(s,{...x.current.rules,...Ae(x.current.disabled)?{disabled:x.current.disabled}:{}});const E=(A,L)=>{const M=z(r._fields,A);M&&M._f&&(M._f.mount=L)};if(E(s,!0),w){const A=ue(z(r._options.defaultValues,s,x.current.defaultValue));re(r._defaultValues,s,A),le(z(r._formValues,s))&&re(r._formValues,s,A)}return!d&&r.register(s),h.current=s,()=>{(d?w&&!r._state.action:w)?r.unregister(s):E(s,!1)}},[s,r,d,i]),p.useEffect(()=>{r._setDisabledField({disabled:a,name:s})},[a,s,r]),p.useMemo(()=>({field:C,formState:m,fieldState:y}),[C,m,y])}const wc=p.createContext(null);wc.displayName="HookFormContext";var Nc=(e,n,s,a,r)=>n?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:r||!0}}:{},lt=e=>Array.isArray(e)?e:[e],ws=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function Qa(e,n){const s={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=n[a];if(r&&me(r)&&i){const l=Qa(r,i);me(l)&&(s[a]=l)}else e[a]&&(s[a]=i)}return s}var we=e=>me(e)&&!Object.keys(e).length,_n=e=>e.type==="file",Ct=e=>{if(!Fn)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Za=e=>e.type==="select-multiple",Pn=e=>e.type==="radio",Cc=e=>Pn(e)||ft(e),Yt=e=>Ct(e)&&e.isConnected;function kc(e,n){const s=n.slice(0,-1).length;let a=0;for(;a<s;)e=le(e)?a++:e[n[a++]];return e}function Sc(e){for(const n in e)if(e.hasOwnProperty(n)&&!le(e[n]))return!1;return!0}function fe(e,n){const s=Array.isArray(n)?n:Mt(n)?[n]:Ln(n),a=s.length===1?e:kc(e,s),r=s.length-1,i=s[r];return a&&delete a[i],r!==0&&(me(a)&&we(a)||Array.isArray(a)&&Sc(a))&&fe(e,s.slice(0,-1)),e}var Ac=e=>{for(const n in e)if(Ne(e[n]))return!0;return!1};function Xa(e){return Array.isArray(e)||me(e)&&!Ac(e)}function xn(e,n={}){for(const s in e){const a=e[s];Xa(a)?(n[s]=Array.isArray(a)?[]:{},xn(a,n[s])):le(a)||(n[s]=!0)}return n}function Ze(e,n,s){s||(s=xn(n));for(const a in e){const r=e[a];if(Xa(r))le(n)||hn(s[a])?s[a]=xn(r,Array.isArray(r)?[]:{}):Ze(r,ke(n)?{}:n[a],s[a]);else{const i=n[a];s[a]=!Ee(r,i)}}return s}const Ns={value:!1,isValid:!1},Cs={value:!0,isValid:!0};var Ja=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!le(e[0].attributes.value)?le(e[0].value)||e[0].value===""?Cs:{value:e[0].value,isValid:!0}:Cs:Ns}return Ns},er=(e,{valueAsNumber:n,valueAsDate:s,setValueAs:a})=>le(e)?e:n?e===""?NaN:e&&+e:s&&$e(e)?new Date(e):a?a(e):e;const ks={isValid:!1,value:null};var tr=e=>Array.isArray(e)?e.reduce((n,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:n,ks):ks;function Ss(e){const n=e.ref;return _n(n)?n.files:Pn(n)?tr(e.refs).value:Za(n)?[...n.selectedOptions].map(({value:s})=>s):ft(n)?Ja(e.refs).value:er(le(n.value)?e.ref.value:n.value,e)}var $c=(e,n,s,a)=>{const r={};for(const i of e){const l=z(n,i);l&&re(r,i,l._f)}return{criteriaMode:s,names:[...e],fields:r,shouldUseNativeValidation:a}},kt=e=>e instanceof RegExp,at=e=>le(e)?e:kt(e)?e.source:me(e)?kt(e.value)?e.value.source:e.value:e,As=e=>({isOnSubmit:!e||e===De.onSubmit,isOnBlur:e===De.onBlur,isOnChange:e===De.onChange,isOnAll:e===De.all,isOnTouch:e===De.onTouched});const $s="AsyncFunction";var Dc=e=>!!e&&!!e.validate&&!!(Ne(e.validate)&&e.validate.constructor.name===$s||me(e.validate)&&Object.values(e.validate).find(n=>n.constructor.name===$s)),Ec=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Ds=(e,n,s)=>!s&&(n.watchAll||n.watch.has(e)||[...n.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const ot=(e,n,s,a)=>{for(const r of s||Object.keys(e)){const i=z(e,r);if(i){const{_f:l,...o}=i;if(l){if(l.refs&&l.refs[0]&&n(l.refs[0],r)&&!a)return!0;if(l.ref&&n(l.ref,l.name)&&!a)return!0;if(ot(o,n))break}else if(me(o)&&ot(o,n))break}}};function Es(e,n,s){const a=z(e,s);if(a||Mt(s))return{error:a,name:s};const r=s.split(".");for(;r.length;){const i=r.join("."),l=z(n,i),o=z(e,i);if(l&&!Array.isArray(l)&&s!==i)return{name:s};if(o&&o.type)return{name:i,error:o};if(o&&o.root&&o.root.type)return{name:`${i}.root`,error:o.root};r.pop()}return{name:s}}var Fc=(e,n,s,a)=>{s(e);const{name:r,...i}=e;return we(i)||Object.keys(i).length>=Object.keys(n).length||Object.keys(i).find(l=>n[l]===(!a||De.all))},Mc=(e,n,s)=>!e||!n||e===n||lt(e).some(a=>a&&(s?a===n:a.startsWith(n)||n.startsWith(a))),Lc=(e,n,s,a,r)=>r.isOnAll?!1:!s&&r.isOnTouch?!(n||e):(s?a.isOnBlur:r.isOnBlur)?!e:(s?a.isOnChange:r.isOnChange)?e:!0,Ic=(e,n)=>!Mn(z(e,n)).length&&fe(e,n),Tc=(e,n,s)=>{const a=lt(z(e,s));return re(a,"root",n[s]),re(e,s,a),e};function Fs(e,n,s="validate"){if($e(e)||Array.isArray(e)&&e.every($e)||Ae(e)&&!e)return{type:s,message:$e(e)?e:"",ref:n}}var Ke=e=>me(e)&&!kt(e)?e:{value:e,message:""},Ms=async(e,n,s,a,r,i)=>{const{ref:l,refs:o,required:d,maxLength:u,minLength:f,min:m,max:x,pattern:h,validate:b,name:y,valueAsNumber:v,mount:N}=e._f,j=z(s,y);if(!N||n.has(y))return{};const C=o?o[0]:l,w=$=>{r&&C.reportValidity&&(C.setCustomValidity(Ae($)?"":$||""),C.reportValidity())},S={},E=Pn(l),A=ft(l),L=E||A,M=(v||_n(l))&&le(l.value)&&le(j)||Ct(l)&&l.value===""||j===""||Array.isArray(j)&&!j.length,_=Nc.bind(null,y,a,S),D=($,I,T,K=Ie.maxLength,H=Ie.minLength)=>{const B=$?I:T;S[y]={type:$?K:H,message:B,ref:l,..._($?K:H,B)}};if(i?!Array.isArray(j)||!j.length:d&&(!L&&(M||ke(j))||Ae(j)&&!j||A&&!Ja(o).isValid||E&&!tr(o).isValid)){const{value:$,message:I}=$e(d)?{value:!!d,message:d}:Ke(d);if($&&(S[y]={type:Ie.required,message:I,ref:C,..._(Ie.required,I)},!a))return w(I),S}if(!M&&(!ke(m)||!ke(x))){let $,I;const T=Ke(x),K=Ke(m);if(!ke(j)&&!isNaN(j)){const H=l.valueAsNumber||j&&+j;ke(T.value)||($=H>T.value),ke(K.value)||(I=H<K.value)}else{const H=l.valueAsDate||new Date(j),B=ae=>new Date(new Date().toDateString()+" "+ae),X=l.type=="time",J=l.type=="week";$e(T.value)&&j&&($=X?B(j)>B(T.value):J?j>T.value:H>new Date(T.value)),$e(K.value)&&j&&(I=X?B(j)<B(K.value):J?j<K.value:H<new Date(K.value))}if(($||I)&&(D(!!$,T.message,K.message,Ie.max,Ie.min),!a))return w(S[y].message),S}if((u||f)&&!M&&($e(j)||i&&Array.isArray(j))){const $=Ke(u),I=Ke(f),T=!ke($.value)&&j.length>+$.value,K=!ke(I.value)&&j.length<+I.value;if((T||K)&&(D(T,$.message,I.message),!a))return w(S[y].message),S}if(h&&!M&&$e(j)){const{value:$,message:I}=Ke(h);if(kt($)&&!j.match($)&&(S[y]={type:Ie.pattern,message:I,ref:l,..._(Ie.pattern,I)},!a))return w(I),S}if(b){if(Ne(b)){const $=await b(j,s),I=Fs($,C);if(I&&(S[y]={...I,..._(Ie.validate,I.message)},!a))return w(I.message),S}else if(me(b)){let $={};for(const I in b){if(!we($)&&!a)break;const T=Fs(await b[I](j,s),C,I);T&&($={...T,..._(I,T.message)},w(T.message),a&&(S[y]=$))}if(!we($)&&(S[y]={ref:C,...$},!a))return S}}return w(!0),S};const _c={mode:De.onSubmit,reValidateMode:De.onChange,shouldFocusError:!0};function Pc(e={}){let n={..._c,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ne(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},a={},r=me(n.defaultValues)||me(n.values)?ue(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:ue(r),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...f};let x={...m};const h={array:ws(),state:ws()},b=n.criteriaMode===De.all,y=g=>k=>{clearTimeout(u),u=setTimeout(g,k)},v=async g=>{if(!l.keepIsValid&&!n.disabled&&(m.isValid||x.isValid||g)){let k;n.resolver?(k=we((await L()).errors),N()):k=await _(a,!0),k!==s.isValid&&h.state.next({isValid:k})}},N=(g,k)=>{!n.disabled&&(m.isValidating||m.validatingFields||x.isValidating||x.validatingFields)&&((g||Array.from(o.mount)).forEach(F=>{F&&(k?re(s.validatingFields,F,k):fe(s.validatingFields,F))}),h.state.next({validatingFields:s.validatingFields,isValidating:!we(s.validatingFields)}))},j=(g,k=[],F,V,O=!0,P=!0)=>{if(V&&F&&!n.disabled){if(l.action=!0,P&&Array.isArray(z(a,g))){const Y=F(z(a,g),V.argA,V.argB);O&&re(a,g,Y)}if(P&&Array.isArray(z(s.errors,g))){const Y=F(z(s.errors,g),V.argA,V.argB);O&&re(s.errors,g,Y),Ic(s.errors,g)}if((m.touchedFields||x.touchedFields)&&P&&Array.isArray(z(s.touchedFields,g))){const Y=F(z(s.touchedFields,g),V.argA,V.argB);O&&re(s.touchedFields,g,Y)}(m.dirtyFields||x.dirtyFields)&&(s.dirtyFields=Ze(r,i)),h.state.next({name:g,isDirty:$(g,k),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else re(i,g,k)},C=(g,k)=>{re(s.errors,g,k),h.state.next({errors:s.errors})},w=g=>{s.errors=g,h.state.next({errors:s.errors,isValid:!1})},S=(g,k,F,V)=>{const O=z(a,g);if(O){const P=z(i,g,le(F)?z(r,g):F);le(P)||V&&V.defaultChecked||k?re(i,g,k?P:Ss(O._f)):K(g,P),l.mount&&!l.action&&v()}},E=(g,k,F,V,O)=>{let P=!1,Y=!1;const ne={name:g};if(!n.disabled){if(!F||V){(m.isDirty||x.isDirty)&&(Y=s.isDirty,s.isDirty=ne.isDirty=$(),P=Y!==ne.isDirty);const se=Ee(z(r,g),k);Y=!!z(s.dirtyFields,g),se?fe(s.dirtyFields,g):re(s.dirtyFields,g,!0),ne.dirtyFields=s.dirtyFields,P=P||(m.dirtyFields||x.dirtyFields)&&Y!==!se}if(F){const se=z(s.touchedFields,g);se||(re(s.touchedFields,g,F),ne.touchedFields=s.touchedFields,P=P||(m.touchedFields||x.touchedFields)&&se!==F)}P&&O&&h.state.next(ne)}return P?ne:{}},A=(g,k,F,V)=>{const O=z(s.errors,g),P=(m.isValid||x.isValid)&&Ae(k)&&s.isValid!==k;if(n.delayError&&F?(d=y(()=>C(g,F)),d(n.delayError)):(clearTimeout(u),d=null,F?re(s.errors,g,F):fe(s.errors,g)),(F?!Ee(O,F):O)||!we(V)||P){const Y={...V,...P&&Ae(k)?{isValid:k}:{},errors:s.errors,name:g};s={...s,...Y},h.state.next(Y)}},L=async g=>(N(g,!0),await n.resolver(i,n.context,$c(g||o.mount,a,n.criteriaMode,n.shouldUseNativeValidation))),M=async g=>{const{errors:k}=await L(g);if(N(g),g)for(const F of g){const V=z(k,F);V?re(s.errors,F,V):fe(s.errors,F)}else s.errors=k;return k},_=async(g,k,F={valid:!0})=>{for(const V in g){const O=g[V];if(O){const{_f:P,...Y}=O;if(P){const ne=o.array.has(P.name),se=O._f&&Dc(O._f);se&&m.validatingFields&&N([P.name],!0);const je=await Ms(O,o.disabled,i,b,n.shouldUseNativeValidation&&!k,ne);if(se&&m.validatingFields&&N([P.name]),je[P.name]&&(F.valid=!1,k||e.shouldUseNativeValidation))break;!k&&(z(je,P.name)?ne?Tc(s.errors,je,P.name):re(s.errors,P.name,je[P.name]):fe(s.errors,P.name))}!we(Y)&&await _(Y,k,F)}}return F.valid},D=()=>{for(const g of o.unMount){const k=z(a,g);k&&(k._f.refs?k._f.refs.every(F=>!Yt(F)):!Yt(k._f.ref))&&ve(g)}o.unMount=new Set},$=(g,k)=>!n.disabled&&(g&&k&&re(i,g,k),!Ee(q(),r)),I=(g,k,F)=>mn(g,o,{...l.mount?i:le(k)?r:$e(g)?{[g]:k}:k},F,k),T=g=>Mn(z(l.mount?i:r,g,n.shouldUnregister?z(r,g,[]):[])),K=(g,k,F={})=>{const V=z(a,g);let O=k;if(V){const P=V._f;P&&(!P.disabled&&re(i,g,er(k,P)),O=Ct(P.ref)&&ke(k)?"":k,Za(P.ref)?[...P.ref.options].forEach(Y=>Y.selected=O.includes(Y.value)):P.refs?ft(P.ref)?P.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(O)?Y.checked=!!O.find(ne=>ne===Y.value):Y.checked=O===Y.value||!!O)}):P.refs.forEach(Y=>Y.checked=Y.value===O):_n(P.ref)?P.ref.value="":(P.ref.value=O,P.ref.type||h.state.next({name:g,values:ue(i)})))}(F.shouldDirty||F.shouldTouch)&&E(g,O,F.shouldTouch,F.shouldDirty,!0),F.shouldValidate&&ae(g)},H=(g,k,F)=>{for(const V in k){if(!k.hasOwnProperty(V))return;const O=k[V],P=g+"."+V,Y=z(a,P);(o.array.has(g)||me(O)||Y&&!Y._f)&&!We(O)?H(P,O,F):K(P,O,F)}},B=(g,k,F={})=>{const V=z(a,g),O=o.array.has(g),P=ue(k);re(i,g,P),O?(h.array.next({name:g,values:ue(i)}),(m.isDirty||m.dirtyFields||x.isDirty||x.dirtyFields)&&F.shouldDirty&&h.state.next({name:g,dirtyFields:Ze(r,i),isDirty:$(g,P)})):V&&!V._f&&!ke(P)?H(g,P,F):K(g,P,F),Ds(g,o)?h.state.next({...s,name:g,values:ue(i)}):h.state.next({name:l.mount?g:void 0,values:ue(i)})},X=async g=>{l.mount=!0;const k=g.target;let F=k.name,V=!0;const O=z(a,F),P=se=>{V=Number.isNaN(se)||We(se)&&isNaN(se.getTime())||Ee(se,z(i,F,se))},Y=As(n.mode),ne=As(n.reValidateMode);if(O){let se,je;const Ue=k.type?Ss(O._f):Wa(g),Re=g.type===Nt.BLUR||g.type===Nt.FOCUS_OUT,ji=!Ec(O._f)&&!n.resolver&&!z(s.errors,F)&&!O._f.deps||Lc(Re,z(s.touchedFields,F),s.isSubmitted,ne,Y),Tt=Ds(F,o,Re);re(i,F,Ue),Re?(!k||!k.readOnly)&&(O._f.onBlur&&O._f.onBlur(g),d&&d(0)):O._f.onChange&&O._f.onChange(g);const _t=E(F,Ue,Re),wi=!we(_t)||Tt;if(!Re&&h.state.next({name:F,type:g.type,values:ue(i)}),ji)return(m.isValid||x.isValid)&&(n.mode==="onBlur"?Re&&v():Re||v()),wi&&h.state.next({name:F,...Tt?{}:_t});if(!Re&&Tt&&h.state.next({...s}),n.resolver){const{errors:Zn}=await L([F]);if(N([F]),P(Ue),V){const Ni=Es(s.errors,a,F),Xn=Es(Zn,a,Ni.name||F);se=Xn.error,F=Xn.name,je=we(Zn)}}else N([F],!0),se=(await Ms(O,o.disabled,i,b,n.shouldUseNativeValidation))[F],N([F]),P(Ue),V&&(se?je=!1:(m.isValid||x.isValid)&&(je=await _(a,!0)));V&&(O._f.deps&&(!Array.isArray(O._f.deps)||O._f.deps.length>0)&&ae(O._f.deps),A(F,je,se,_t))}},J=(g,k)=>{if(z(s.errors,k)&&g.focus)return g.focus(),1},ae=async(g,k={})=>{let F,V;const O=lt(g);if(n.resolver){const P=await M(le(g)?g:O);F=we(P),V=g?!O.some(Y=>z(P,Y)):F}else g?(V=(await Promise.all(O.map(async P=>{const Y=z(a,P);return await _(Y&&Y._f?{[P]:Y}:Y)}))).every(Boolean),!(!V&&!s.isValid)&&v()):V=F=await _(a);return h.state.next({...!$e(g)||(m.isValid||x.isValid)&&F!==s.isValid?{}:{name:g},...n.resolver||!g?{isValid:F}:{},errors:s.errors}),k.shouldFocus&&!V&&ot(a,J,g?O:o.mount),V},q=(g,k)=>{let F={...l.mount?i:r};return k&&(F=Qa(k.dirtyFields?s.dirtyFields:s.touchedFields,F)),le(g)?F:$e(g)?z(F,g):g.map(V=>z(F,V))},Z=(g,k)=>({invalid:!!z((k||s).errors,g),isDirty:!!z((k||s).dirtyFields,g),error:z((k||s).errors,g),isValidating:!!z(s.validatingFields,g),isTouched:!!z((k||s).touchedFields,g)}),Q=g=>{g&&lt(g).forEach(k=>fe(s.errors,k)),h.state.next({errors:g?s.errors:{}})},W=(g,k,F)=>{const V=(z(a,g,{_f:{}})._f||{}).ref,O=z(s.errors,g)||{},{ref:P,message:Y,type:ne,...se}=O;re(s.errors,g,{...se,...k,ref:V}),h.state.next({name:g,errors:s.errors,isValid:!1}),F&&F.shouldFocus&&V&&V.focus&&V.focus()},ee=(g,k)=>Ne(g)?h.state.subscribe({next:F=>"values"in F&&g(I(void 0,k),F)}):I(g,k,!0),ce=g=>h.state.subscribe({next:k=>{Mc(g.name,k.name,g.exact)&&Fc(k,g.formState||m,Le,g.reRenderRoot)&&g.callback({values:{...i},...s,...k,defaultValues:r})}}).unsubscribe,de=g=>(l.mount=!0,x={...x,...g.formState},ce({...g,formState:{...f,...g.formState}})),ve=(g,k={})=>{for(const F of g?lt(g):o.mount)o.mount.delete(F),o.array.delete(F),k.keepValue||(fe(a,F),fe(i,F)),!k.keepError&&fe(s.errors,F),!k.keepDirty&&fe(s.dirtyFields,F),!k.keepTouched&&fe(s.touchedFields,F),!k.keepIsValidating&&fe(s.validatingFields,F),!n.shouldUnregister&&!k.keepDefaultValue&&fe(r,F);h.state.next({values:ue(i)}),h.state.next({...s,...k.keepDirty?{isDirty:$()}:{}}),!k.keepIsValid&&v()},be=({disabled:g,name:k})=>{if(Ae(g)&&l.mount||g||o.disabled.has(k)){const O=o.disabled.has(k)!==!!g;g?o.disabled.add(k):o.disabled.delete(k),O&&l.mount&&!l.action&&v()}},Se=(g,k={})=>{let F=z(a,g);const V=Ae(k.disabled)||Ae(n.disabled);return re(a,g,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:g}},name:g,mount:!0,...k}}),o.mount.add(g),F?be({disabled:Ae(k.disabled)?k.disabled:n.disabled,name:g}):S(g,!0,k.value),{...V?{disabled:k.disabled||n.disabled}:{},...n.progressive?{required:!!k.required,min:at(k.min),max:at(k.max),minLength:at(k.minLength),maxLength:at(k.maxLength),pattern:at(k.pattern)}:{},name:g,onChange:X,onBlur:X,ref:O=>{if(O){Se(g,k),F=z(a,g);const P=le(O.value)&&O.querySelectorAll&&O.querySelectorAll("input,select,textarea")[0]||O,Y=Cc(P),ne=F._f.refs||[];if(Y?ne.find(se=>se===P):P===F._f.ref)return;re(a,g,{_f:{...F._f,...Y?{refs:[...ne.filter(Yt),P,...Array.isArray(z(r,g))?[{}]:[]],ref:{type:P.type,name:g}}:{ref:P}}}),S(g,!1,void 0,P)}else F=z(a,g,{}),F._f&&(F._f.mount=!1),(n.shouldUnregister||k.shouldUnregister)&&!(Ya(o.array,g)&&l.action)&&o.unMount.add(g)}}},_e=()=>n.shouldFocusError&&ot(a,J,o.mount),Pe=g=>{Ae(g)&&(h.state.next({disabled:g}),ot(a,(k,F)=>{const V=z(a,F);V&&(k.disabled=V._f.disabled||g,Array.isArray(V._f.refs)&&V._f.refs.forEach(O=>{O.disabled=V._f.disabled||g}))},0,!1))},Oe=(g,k)=>async F=>{let V;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let O=ue(i);if(h.state.next({isSubmitting:!0}),n.resolver){const{errors:P,values:Y}=await L();N(),s.errors=P,O=ue(Y)}else await _(a);if(o.disabled.size)for(const P of o.disabled)fe(O,P);if(fe(s.errors,"root"),we(s.errors)){h.state.next({errors:{}});try{await g(O,F)}catch(P){V=P}}else k&&await k({...s.errors},F),_e(),setTimeout(_e);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(s.errors)&&!V,submitCount:s.submitCount+1,errors:s.errors}),V)throw V},Ve=(g,k={})=>{z(a,g)&&(le(k.defaultValue)?B(g,ue(z(r,g))):(B(g,k.defaultValue),re(r,g,ue(k.defaultValue))),k.keepTouched||fe(s.touchedFields,g),k.keepDirty||(fe(s.dirtyFields,g),s.isDirty=k.defaultValue?$(g,ue(z(r,g))):$()),k.keepError||(fe(s.errors,g),m.isValid&&v()),h.state.next({...s}))},Fe=(g,k={})=>{const F=g?ue(g):r,V=ue(F),O=we(g),P=O?r:V;if(k.keepDefaultValues||(r=F),!k.keepValues){if(k.keepDirtyValues){const Y=new Set([...o.mount,...Object.keys(Ze(r,i))]);for(const ne of Array.from(Y)){const se=z(s.dirtyFields,ne),je=z(i,ne),Ue=z(P,ne);se&&!le(je)?re(P,ne,je):!se&&!le(Ue)&&B(ne,Ue)}}else{if(Fn&&le(g))for(const Y of o.mount){const ne=z(a,Y);if(ne&&ne._f){const se=Array.isArray(ne._f.refs)?ne._f.refs[0]:ne._f.ref;if(Ct(se)){const je=se.closest("form");if(je){je.reset();break}}}}if(k.keepFieldsRef)for(const Y of o.mount)B(Y,z(P,Y));else a={}}i=n.shouldUnregister?k.keepDefaultValues?ue(r):{}:ue(P),h.array.next({values:{...P}}),h.state.next({values:{...P}})}o={mount:k.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!m.isValid||!!k.keepIsValid||!!k.keepDirtyValues||!n.shouldUnregister&&!we(P),l.watch=!!n.shouldUnregister,l.keepIsValid=!!k.keepIsValid,l.action=!1,k.keepErrors||(s.errors={}),h.state.next({submitCount:k.keepSubmitCount?s.submitCount:0,isDirty:O?!1:k.keepDirty?s.isDirty:!!(k.keepDefaultValues&&!Ee(g,r)),isSubmitted:k.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:O?{}:k.keepDirtyValues?k.keepDefaultValues&&i?Ze(r,i):s.dirtyFields:k.keepDefaultValues&&g?Ze(r,g):k.keepDirty?s.dirtyFields:{},touchedFields:k.keepTouched?s.touchedFields:{},errors:k.keepErrors?s.errors:{},isSubmitSuccessful:k.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},te=(g,k)=>Fe(Ne(g)?g(i):g,{...n.resetOptions,...k}),he=(g,k={})=>{const F=z(a,g),V=F&&F._f;if(V){const O=V.refs?V.refs[0]:V.ref;O.focus&&setTimeout(()=>{O.focus(),k.shouldSelect&&Ne(O.select)&&O.select()})}},Le=g=>{s={...s,...g}},pe={control:{register:Se,unregister:ve,getFieldState:Z,handleSubmit:Oe,setError:W,_subscribe:ce,_runSchema:L,_updateIsValidating:N,_focusError:_e,_getWatch:I,_getDirty:$,_setValid:v,_setFieldArray:j,_setDisabledField:be,_setErrors:w,_getFieldArray:T,_reset:Fe,_resetDefaultValues:()=>Ne(n.defaultValues)&&n.defaultValues().then(g=>{te(g,n.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:D,_disableForm:Pe,_subjects:h,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return l},set _state(g){l=g},get _defaultValues(){return r},get _names(){return o},set _names(g){o=g},get _formState(){return s},get _options(){return n},set _options(g){n={...n,...g}}},subscribe:de,trigger:ae,register:Se,handleSubmit:Oe,watch:ee,setValue:B,getValues:q,reset:te,resetField:Ve,clearErrors:Q,unregister:ve,setError:W,setFocus:he,getFieldState:Z};return{...pe,formControl:pe}}function Oc(e={}){const n=p.useRef(void 0),s=p.useRef(void 0),[a,r]=p.useState({isDirty:!1,isValidating:!1,isLoading:Ne(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ne(e.defaultValues)?void 0:e.defaultValues});if(!n.current)if(e.formControl)n.current={...e.formControl,formState:a},e.defaultValues&&!Ne(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...o}=Pc(e);n.current={...o,formState:a}}const i=n.current.control;return i._options=e,Tn(()=>{const l=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(o=>({...o,isReady:!0})),i._formState.isReady=!0,l},[i]),p.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),p.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),p.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),p.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),p.useEffect(()=>{if(i._proxyFormState.isDirty){const l=i._getDirty();l!==a.isDirty&&i._subjects.state.next({isDirty:l})}},[i,a.isDirty]),p.useEffect(()=>{var l;e.values&&!Ee(e.values,s.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((l=i._options.resetOptions)===null||l===void 0)&&l.keepIsValid||i._setValid(),s.current=e.values,r(o=>({...o}))):i._resetDefaultValues()},[i,e.values]),p.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),n.current.formState=p.useMemo(()=>Ka(a,i),[i,a]),n.current}function Rc(e,n=3){return e%1===0?e.toString():e.toFixed(n).replace(/\.?0+$/,"")}function zc(e,n="en-US",s="USD"){try{return new Intl.NumberFormat(n,{style:"currency",currency:s,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${s} ${e.toFixed(2)}`}}function Bc(e="USD",n="en-US"){try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Vc(e){const n=e.replace(/[^\d.,-]/g,""),s=n.match(/,\d{1,2}$/);let a;s?a=n.replace(/\./g,"").replace(",","."):a=n.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Uc(e,n,s=.001){const a=e-n,r=Math.abs(a)<=s;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function On(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}On();const Hc={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},Gt=()=>({id:On(),amount:0,glAccount:null,isTaxDeductible:!1}),nr=({distribution:e,defaultDistribution:n,glAccounts:s=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:l,onGlAccountChange:o,onTaxDeductibleChange:d,onDelete:u,canDelete:f=!0,canEditTaxDeductible:m=!0,isDisabled:x=!1,labels:h,classNames:b={},"data-testid":y,control:v,name:N,rules:j})=>{const C={...Hc,...h},w=v!==void 0&&N!==void 0,S=Oc({defaultValues:{_internal:n||Gt()}}),E=jc({control:w?v:S.control,name:w?N:"_internal",rules:w?j:void 0}),[A,L]=p.useState(n||Gt()),M=w?E.field.value??Gt():e??A,_=w&&!!E.fieldState?.error,D=w&&(E.fieldState?.isTouched??!1),$=_||D,I=$&&(!M.amount||M.amount<=0),T=$&&!M.glAccount,[K,H]=p.useState(M.glAccount?.name||""),B=p.useCallback(W=>{const ee={...M,...W};w&&E.field.onChange(ee),!w&&e===void 0&&L(ee),i?.(ee)},[M,e,i,w,E]),X=p.useCallback(W=>{const ee=W||0;B({amount:ee}),l?.(ee)},[B,l]),J=p.useCallback(W=>{H(W),r?.(W)},[r]),ae=p.useCallback(W=>{if(W===null){B({glAccount:null}),o?.(null);return}const ce=s.find(de=>String(de.id)===String(W))||null;B({glAccount:ce}),o?.(ce)},[s,B,o]),q=p.useCallback(()=>{H(""),B({glAccount:null}),o?.(null)},[B,o]),Z=p.useCallback(W=>{B({isTaxDeductible:W}),d?.(W)},[B,d]),Q=p.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.amount,t.jsx(c.Tooltip,{content:C.amountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:M.amount||void 0,onValueChange:X,labelPlacement:"outside",placeholder:C.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:x,isInvalid:I,errorMessage:I?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:C.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[C.glAccount,t.jsx(c.Tooltip,{content:C.glAccountTooltip,children:t.jsx(R,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:s,menuTrigger:"input",inputValue:M.glAccount?.name??K,selectedKey:M.glAccount?.id??null,isDisabled:x,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?C.searching:C.noGlAccountsFound},placeholder:C.glAccountPlaceholder,onInputChange:J,onSelectionChange:ae,onClear:q,className:b.glAccountInput,children:W=>t.jsx(c.AutocompleteItem,{textValue:W.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:W.name}),W.code&&t.jsx("span",{className:"text-xs text-default-400",children:W.code})]})},W.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:M.isTaxDeductible,onValueChange:Z,isDisabled:x||!m,className:b.taxDeductibleCheckbox,children:C.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(U,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:x||!f,onPress:Q,startContent:t.jsx(R,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:C.deleteButton})})]})})};nr.displayName="RevenueDistributionCard";const sr=({message:e="No distributions configured",icon:n="solar:document-text-outline",iconSize:s=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const l=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(R,{icon:n,width:s,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:l})};sr.displayName="RevenueDistributionEmpty";const qc={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},ar=({error:e,labels:n,showCard:s=!0,color:a="danger",classNames:r={}})=>{const i={...qc,...n},l=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return s?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:l})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:l})};ar.displayName="RevenueDistributionError";const rr=({rows:e=1,showCard:n=!0,classNames:s={}})=>{const a=Array.from({length:e},(i,l)=>l),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",s.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return n?t.jsx("div",{className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",s.base),children:a.map(i=>r(i))})};rr.displayName="RevenueDistributionSkeleton";function Lt({isOpen:e,labels:n,icon:s,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:l,shouldBlockScroll:o,classNames:d,onClose:u,onConfirm:f}){return t.jsx(c.Modal,{isOpen:e,size:"md",placement:"center",portalContainer:l,shouldBlockScroll:o,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[s&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:s}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:n.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:n.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(U,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:n.cancel}),t.jsx(U,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:f,children:n.confirm})]})]})})}const Wc=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function pn(e){return!e.fund&&Number(e.percentage||0)<=0}function Yc({mode:e,assignments:n}){const s=n.filter(l=>!pn(l)),a=s.filter(l=>l.fund),r=a.reduce((l,o)=>l+Number(o.percentage||0),0),i=s.some(l=>!l.fund||Number(l.percentage||0)<=0);return a.length>=1&&!i&&Math.round(r*100)/100===100}const Gc={title:"Payment assignment",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},ir={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},rt={...ir,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},Kc={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},Qc={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"};function Zc(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const Xc=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,Jc=e=>e.fund!==null;function ed({assignments:e,funds:n,labels:s,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,isFundPickerOpen:l=!1,activeAssignmentId:o=null,modalPortalContainer:d,footer:u,onAssignmentsChange:f,onOpenFundPicker:m,onCloseFundPicker:x,onCollapseChange:h,onSave:b}){const[y,v]=p.useState(null),N=d??y??void 0,j={...Gc,...s},C=e.filter(W=>!pn(W)),S=C.filter(Jc).length>0,E=p.useMemo(()=>e.filter(W=>!pn(W)).reduce((W,ee)=>W+Number(ee.percentage||0),0),[e]),A=Math.round(E*100)/100,L=C.some(W=>!W.fund||Number(W.percentage||0)<=0),M=S&&(A!==100||L),_=`${j.totalError} (${j.total} ${Number(E.toFixed(2))}%)`,D=Yc({mode:"split",assignments:e}),$=S&&A>=100,[I,T]=p.useState(!1),[K,H]=p.useState(!1),B=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Zc,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:j.title})]}),X=(W,ee)=>{f(e.map(ce=>ce.id===W?{...ce,...ee}:ce))},J=()=>{$||f([...e,Wc()])},ae=W=>{e.length<=1||f(e.filter(ee=>ee.id!==W))},q=()=>{if(!r){if(!D){H(!0);return}if(!i){b();return}T(!0)}},Z=()=>{T(!1),b()},Q=W=>{const ee=o??e.find(ce=>!ce.fund)?.id??e[0]?.id;ee&&(f(e.map(ce=>ce.id===ee?{...ce,fund:W}:ce)),x())};return t.jsxs("div",{ref:v,className:c.cn("vvt-pa relative font-sans text-zinc-900",l&&!d&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-fund-assignment"],className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:W=>h?.(!(W==="all"||Array.from(W).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":j.title,title:B,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!S&&t.jsx(c.Alert,{icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:ir,color:"default",variant:"flat",title:j.emptySplit}),S&&t.jsx(td,{assignments:e,labels:j,total:E,hasTotalError:K&&!D||M,validationMessage:_,onSelectFund:W=>m(W),onRemoveFund:ae,onPercentageChange:(W,ee)=>X(W,{percentage:Xc(ee)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(U,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),isDisabled:$,onPress:()=>S?J():m(),children:j.assignSpecificFund}),t.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 bg-brand px-4 text-sm font-medium text-white",startContent:r?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,onPress:q,children:j.saveAssignment})]})]}),u]})},"installment-fund-assignment")}),l&&t.jsx(nd,{funds:n,labels:j,selectedFundIds:e.map(W=>W.fund?.id).filter(Boolean),portalContainer:N,onSelect:Q,onClose:x}),t.jsx(Lt,{isOpen:I,labels:{title:j.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:j.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:j.modifyAssignedFundsWarning})]}),cancel:j.modifyAssignedFundsCancel,confirm:j.modifyAssignedFundsConfirm},icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:N,shouldBlockScroll:!1,classNames:Qc,onClose:()=>T(!1),onConfirm:Z})]})}function td({assignments:e,labels:n,total:s,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:l,onPercentageChange:o}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{className:"flex min-h-15 w-full items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 flex-1 items-center","gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"rounded-full bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(U,{type:"button",variant:"light",radius:"full",className:"px-2 text-sm font-normal text-brand",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(U,{type:"button",size:"lg",variant:"light",radius:"full",className:"justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:n.assignSpecificFund})}),t.jsx("label",{className:"flex w-48 flex-none items-center",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:f=>o(d.id,Number(f.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:Kc})}),e.length>1&&t.jsx(U,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>l(d.id),"aria-label":n.removeFund,children:t.jsx(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(R,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...rt,base:c.cn(rt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(rt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(rt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(rt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${n.total} ${Number(s.toFixed(2))}%`})]})}function nd({funds:e,labels:n,selectedFundIds:s,portalContainer:a,onSelect:r,onClose:i}){const[l,o]=p.useState(""),d=e.filter(u=>{if(s.includes(u.id))return!1;const f=l.trim().toLowerCase();return f?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(f):!0});return t.jsx(c.Modal,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl",base:"max-h-[calc(100%-2rem)] max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:n.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":n.searchPlaceholder,value:l,placeholder:n.searchPlaceholder,onChange:u=>o(u.target.value),startContent:t.jsx(R,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:[t.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900",children:[t.jsx("span",{children:n.glCode}),t.jsx("span",{children:n.accountName}),t.jsx("span",{children:n.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:n.noFunds}),d.map(u=>t.jsxs("div",{className:"grid grid-cols-[1fr_1.3fr_0.6fr] items-center gap-5 px-3 py-2.5 text-sm leading-5 text-zinc-900",children:[t.jsx("span",{children:u.glCode}),t.jsx("span",{children:u.accountName}),t.jsx(U,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"h-9 min-w-24 border-zinc-200 bg-white text-sm font-medium text-zinc-900",onPress:()=>r(u),children:n.select})]},u.id))]})]})]})})}function sd(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const ad={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function rd({totalAmount:e,remainingBalance:n,amountReceived:s,currency:a="USD",locale:r="en-US",labels:i,className:l}){const o={...ad,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",l),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(Kt,{label:o.totalAmount,value:d.format(e)}),t.jsx(Kt,{label:o.remainingBalance,value:d.format(n)}),t.jsx(Kt,{label:o.amountReceived,value:d.format(s)})]})})}function Kt({label:e,value:n}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:n})]})}const id={monthly:1,quarterly:3,annual:12},lr=e=>{const[n,s,a]=e.split("-").map(Number);return{year:n,month:s,day:a}},ld=(e,n)=>new Date(e,n+1,0).getDate(),od=e=>{const n=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${n}-${s}-${a}`},cd=(e,n)=>{const{year:s,month:a,day:r}=lr(e),i=a-1+n,l=s+Math.floor(i/12),o=(i%12+12)%12,d=Math.min(r,ld(l,o));return new Date(l,o,d)},dd=(e,n)=>{const{year:s,month:a,day:r}=lr(e),i=new Date(s,a-1,r);return i.setDate(i.getDate()+n),i};function or(e,n){const s=Math.max(1,Math.floor(n.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/s),i=a-r*s,l=id[n.frequency];return Array.from({length:s},(o,d)=>{const u=n.frequency==="weekly"?dd(n.firstInstallmentDate,d*7):cd(n.firstInstallmentDate,d*(l??1));return{id:crypto.randomUUID(),dueDate:od(u),amount:(r+(d===0?i:0))/100}})}function ud(e){return new Set(e.map((n,s)=>{const a=e[s+1]?.dueDate;return n.dueDate&&a&&n.dueDate>a?n.id:null}).filter(n=>!!n))}function fd(e,n){const s=e[0];return!s||!n||s.dueDate===n?e:[{...s,dueDate:n},...e.slice(1)]}const md={title:"Payments",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total cannot exceed donation amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},hd=["weekly","monthly","quarterly","annual"],xd=Array.from({length:31},(e,n)=>n+1),pd=["numberOfInstallments","frequency","firstInstallmentDate"],gd={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Ls=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),cr=e=>Math.round(e*100)/100,bd=(e,n)=>{const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)},It=e=>{if(!e)return null;try{return fo(e)}catch{return null}},yd=e=>It(e)?.day??1,vd=(e,n)=>new Date(e,n,0).getDate(),jd=(e,n)=>{const s=It(e);if(!s)return e;const a=Math.min(n,vd(s.year,s.month));return s.set({day:a}).toString()},Is=e=>{const n=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${n}`};function wd({mode:e,donationAmount:n,currency:s="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:l="automatic",showTitle:o=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:f=!0,inputs:m=pd,startDate:x,firstInstallmentDateOverride:h,labels:b,classNames:y,isSaving:v=!1,isModeSwitchDisabled:N=!1,onModeChange:j,onAutomaticSettingsChange:C,onInstallmentsChange:w,onSave:S}){const[E,A]=p.useState(null),[L,M]=p.useState(l),_={...md,...b},D=e??L,$=p.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:s}),[s,a]),I=p.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||x||"":x||i.firstInstallmentDate}),[i,m,x]),T=D==="automatic"?fd(or(n,I),m.includes("firstInstallmentDate")?void 0:h):r,K=p.useMemo(()=>cr(T.reduce((de,ve)=>de+Number(ve.amount||0),0)),[T]),H=D==="manual"&&K-n>.009,[B,X]=p.useState(!1),J=o?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(G.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title})]}):void 0,ae=de=>{de!==D&&(e||M(de),j?.(de),de==="manual"&&r.length===0&&w([Ls()]))},q=(de,ve)=>{r.find(Se=>Se.id===de)?.status!=="paid"&&w(r.map(Se=>Se.id===de?{...Se,...ve}:Se))},Z=()=>{w([...r,Ls()])},Q=de=>{r.find(be=>be.id===de)?.status!=="paid"&&w(r.filter(be=>be.id!==de))},W=()=>{if(!v){if(H){X(!0);return}S?.()}},ee=()=>{X(!1),S?.()},ce=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[f||u?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[f?t.jsx(Nd,{mode:D,labels:_,onModeChange:ae,isDisabled:N,className:y?.tabs}):null,u?t.jsx(U,{type:"button",size:"md",color:"primary",radius:"full",className:"ml-auto min-w-36",startContent:v?void 0:t.jsx(R,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:v,onPress:W,children:_.saveInstallments}):null]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[D==="automatic"&&t.jsx(Cd,{settings:I,inputs:m,labels:_,className:y?.controls,onSettingsChange:C}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:D==="automatic"?_.emptyAutomatic:_.emptyManual}),T.length>0&&t.jsx(kd,{mode:D,installments:T,labels:_,formatter:$,locale:a,onUpdateInstallment:q,onRemoveInstallment:Q}),D==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(U,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(G.Plus,{className:"size-5",strokeWidth:2}),onPress:Z,children:_.addInstallment})}),t.jsx(Ad,{total:K,donationAmount:n,hasTotalIncreaseWarning:H,mode:D,installments:T,formatter:$,labels:_,className:y?.summary})]})]});return t.jsxs("div",{ref:A,className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:[d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:J,children:ce},"installment-schedule")}):ce,t.jsx(Lt,{isOpen:B,labels:{title:_.totalIncreaseConfirmationTitle,description:_.totalIncreaseConfirmationDescription,cancel:_.totalIncreaseConfirmationCancel,confirm:_.totalIncreaseConfirmationConfirm},icon:t.jsx(R,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",isConfirming:v,portalContainer:E??void 0,shouldBlockScroll:!1,classNames:gd,onClose:()=>X(!1),onConfirm:ee})]})}function Nd({mode:e,labels:n,className:s,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":n.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",s),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:n.automaticMode},"automatic"),t.jsx(c.Tab,{title:n.manualMode},"manual")]})}function Cd({settings:e,inputs:n,labels:s,className:a,onSettingsChange:r}){const i=l=>{if(l==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:s.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:o=>o.currentTarget.blur(),onChange:o=>{const d=o.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},l);if(l==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(Me,{variant:"bordered",label:s.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:o=>{const d=Array.from(o)[0];typeof d=="string"&&r({...e,frequency:d})},children:hd.map(o=>t.jsx(c.SelectItem,{textValue:s[o],children:s[o]},o))})},l);if(l==="dayOfMonth"){const o=String(yd(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(Me,{variant:"bordered",label:s.dayOfMonth,labelPlacement:"outside",selectedKeys:[o],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:jd(e.firstInstallmentDate,u)})},children:xd.map(d=>t.jsx(c.SelectItem,{textValue:Is(d),children:Is(d)},String(d)))})},l)}return t.jsx("div",{className:"min-w-0",children:t.jsx(En,{variant:"bordered",label:s.firstInstallmentDate,labelPlacement:"outside",value:It(e.firstInstallmentDate),onChange:o=>r({...e,firstInstallmentDate:o?o.toString():""}),startContent:t.jsx(R,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},l)};return n.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:n.map(i)})}function kd({mode:e,installments:n,labels:s,formatter:a,locale:r,onUpdateInstallment:i,onRemoveInstallment:l}){const o=ud(n),d=new Set(n.map(u=>Number(u.amount||0)<=0?u.id:null).filter(u=>!!u));return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",n.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:n.map((u,f)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",f===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",f+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:bd(u.dueDate,r)}),f===0&&n.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:a.format(u.amount)})]},u.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:n.map((u,f)=>{const m=o.has(u.id),x=d.has(u.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:f+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(En,{variant:"bordered","aria-label":`${s.dueDate} ${f+1}`,isDisabled:u.status==="paid",isInvalid:m,errorMessage:m?s.dateOrderError:void 0,value:It(u.dueDate),onChange:h=>i(u.id,{dueDate:h?h.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,step:.01,isDisabled:u.status==="paid",isInvalid:x,errorMessage:x?s.amountGreaterThanZeroError:void 0,value:String(u.amount||""),onChange:h=>i(u.id,{amount:cr(Number(h.target.value||0))}),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}),t.jsx(Sd,{isDisabled:n.length<=1,isPaid:u.status==="paid",label:s.deleteInstallment,onRemove:()=>l(u.id)})]})},u.id)})})}function Sd({isDisabled:e,isPaid:n,label:s,onRemove:a}){const r=t.jsx(U,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||n,onPress:a,"aria-label":s,children:t.jsx(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return n?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Ad({total:e,donationAmount:n,hasTotalIncreaseWarning:s,mode:a,installments:r,formatter:i,labels:l,className:o}){const d=r.length,u=r[0]?.amount??0,f=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(f*100),x=Math.max(n-e,0),h=s?t.jsx("span",{children:l.totalIncreaseWarning}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(f)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(n)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:s?`New total: ${i.format(e)}`:`${l.remaining}: ${i.format(x)}`;return t.jsx(c.Alert,{isClosable:!1,color:s?"warning":"default",variant:"flat",radius:"full",className:o,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:h})}function $d(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,n)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},n))})]})}const Ts={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},dr={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Dd={title:"Payments",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by ID or Date...",editInstallments:"Edit Payment",installmentId:"Payment ID",amount:"Amount",scheduledDate:"Scheduled Date",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},Ed={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Fd=[];function Md({installments:e,currency:n,locale:s="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:l=!0,payNowHiddenStatuses:o=Fd,labels:d,isSaving:u=!1,onEditInstallments:f,onPayInstallment:m,onDeleteInstallment:x}){const[h,b]=p.useState(null),y={...Dd,...d},[v,N]=p.useState(""),j=new Intl.NumberFormat(s,{style:"currency",currency:n}),C=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(G.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:y.title})]}):void 0,w=p.useMemo(()=>{const E=v.trim().toLowerCase();return E?e.filter(A=>{const L=A.status??"scheduled";return[A.id,A.amount,A.dueDate,Qt(A.dueDate,s),L,dr[L]??L].join(" ").toLowerCase().includes(E)}):e},[s,e,v]),S=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:y.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:v,placeholder:y.searchPlaceholder,onChange:E=>N(E.target.value),startContent:t.jsx(R,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(U,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(R,{icon:"solar:pen-outline",className:"size-4"}),isLoading:u,onPress:f,children:y.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",w.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[w.map((E,A)=>{const L=E.status??"scheduled";return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",A+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:E.id||`PMT-${A+1}`})]}),t.jsx(_s,{status:L})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:y.amount}),t.jsx("p",{className:"font-medium text-foreground",children:j.format(E.amount)})]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:y.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Qt(E.dueDate,s)})]})]}),t.jsx(Ps,{status:L,installment:E,labels:y,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:x})]})},E.id)}),w.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:y.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",w.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:y.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:y.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:y.actions})]})}),t.jsxs("tbody",{children:[w.map((E,A)=>{const L=E.status??"scheduled";return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:A+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:E.id||`PMT-${A+1}`})}),t.jsx("td",{className:"px-2 py-3",children:j.format(E.amount)}),t.jsx("td",{className:"px-2 py-3",children:Qt(E.dueDate,s)}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(_s,{status:L})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(Ps,{status:L,installment:E,labels:y,portalContainer:h??void 0,showDelete:l,payNowHiddenStatuses:o,onPayInstallment:m,onDeleteInstallment:x})})]},E.id)}),w.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:y.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:b,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":y.title,title:C,children:S},"installment-table")}):S})}function _s({status:e}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",Ts[e]??Ts.scheduled),startContent:t.jsx(Id,{status:e}),children:dr[e]??e})}function Ps({status:e,installment:n,labels:s,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:l,onDeleteInstallment:o}){const d=!i.includes(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(U,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:e==="paid",startContent:t.jsx(R,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>l?.(n),children:s.payNow}):null,t.jsx(Ld,{isFulfilled:e==="paid",showDelete:r,labels:s,portalContainer:a,onDelete:()=>o(n.id)})]})}function Ld({isFulfilled:e,showDelete:n,labels:s,portalContainer:a,onDelete:r}){const[i,l]=p.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(U,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(R,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:o=>{o==="delete"&&n&&!e&&l(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:n,children:t.jsx(c.DropdownItem,{textValue:s.sendLink,description:s.sendLinkDescription,startContent:t.jsx(R,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:s.sendLink},"send-link")}),n?t.jsx(c.DropdownSection,{title:s.dangerZone,children:t.jsx(c.DropdownItem,{textValue:s.deleteInstallment,className:"text-danger-600",color:"danger",description:s.deleteInstallmentDescription,startContent:t.jsx(R,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:s.deleteInstallment},"delete")}):null]})]}),n?t.jsx(Lt,{isOpen:i,labels:{title:s.deleteInstallmentConfirmationTitle,description:s.deleteInstallmentConfirmationDescription,cancel:s.deleteInstallmentConfirmationCancel,confirm:s.deleteInstallmentConfirmationConfirm},icon:t.jsx(R,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Ed,onClose:()=>l(!1),onConfirm:()=>{l(!1),r()}}):null]})}function Id({status:e}){return e==="paid"?t.jsx(R,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(R,{icon:"solar:close-circle-bold",className:"size-3"}):e==="processing"?t.jsx(R,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(R,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(R,{icon:"solar:calendar-outline",className:"size-3"})}function Qt(e,n){const s=new Date(`${e}T00:00:00`);return Number.isNaN(s.getTime())?e:new Intl.DateTimeFormat(n,{month:"short",day:"numeric",year:"numeric"}).format(s)}const Td={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},_d=({cards:e,locale:n,currency:s,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:l=!1,initialSelectedMembershipId:o=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:f,className:m=""})=>{const x=Array.isArray(e)?e:[],[h,b]=p.useState(o),[y,v]=p.useState(l),N={...Td,...r};p.useEffect(()=>{b(o)},[o]);const j=w=>{if(w===h){d&&f?.(w);return}b(w),f?.(w)},C=w=>{v(w),u?.(w)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:h??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:N.title}),i&&t.jsx(hr,{title:N.renewalTitle,description:N.renewalDescription,value:y,onValueChange:C}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:x.map(w=>t.jsx(ur,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:n,currency:s,isSelected:h===w.id,onSelect:j},w.id))})]})},ur=({itemKey:e,name:n,type:s,price:a,locale:r="en-US",currency:i="USD",showPrice:l=!0,isSelected:o=!1,onSelect:d,compact:u=!1,isDisabled:f=!1,disabledReason:m,statusLabel:x,statusTone:h="default",className:b=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),v=!!d&&!f,N=m||x,j=()=>{v&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:j,className:c.cn("w-full min-h-fit border rounded-3xl",o?"border-primary bg-primary/5":"border-default",f?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":o,isDisabled:f,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:n}),s&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:s})}),N&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:h,size:"sm",variant:"flat",className:"px-2",children:N})]}),l&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},Os="w-full bg-gray-100",Rs={variant:"light",color:"default"},fr=({id:e,title:n,media:s,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:l="aspect-[4/3]",meta:o=[],price:d,action:u,footer:f,onPress:m,isPressable:x=!1,isDisabled:h=!1,compact:b=!1,className:y="",bodyClassName:v="",footerClassName:N="",dataTestId:j})=>{const C=!!(d&&d.value),w=!!u?.label,S=x&&!!m&&!w,E=!S,A=w?{variant:u?.variant??Rs.variant,color:u?.color??Rs.color,size:u?.size??"sm",isDisabled:h||u?.isDisabled,startContent:u?.icon?t.jsx(R,{icon:u.icon,width:16}):void 0}:null,L=s??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Os,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||n,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",l,Os,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(R,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":j||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:S,onPress:m,isDisabled:h,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:L}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",v),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:n}),o.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:o.map((M,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(R,{icon:M.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:M.label})]},`${M.label}-${_}`))}):null,(C||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",N),children:[C?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",b?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),w&&E?t.jsx(U,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:A?.variant,color:A?.color,size:A?.size,startContent:A?.startContent,isDisabled:A?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),f?t.jsx("div",{className:"pt-1",children:f}):null]})]})};fr.displayName="CatalogItemCard";const Pd={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Od={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Rd={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},zd={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},Bd={card:"mt-1",panel:"mt-[22px]"},Vd="bg-acct-page border-acct-border text-acct-muted",Ud={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},Hd={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},qd={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},Wd={empty:"status",error:"alert",success:"status",loading:"status"},Yd={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function Gd(e,n,s,a){if(n===!1)return null;if(e==="loading"&&n===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(p.isValidElement(n))return t.jsx(t.Fragment,{children:n});const r=typeof n=="string"?n:Ud[e];return r?t.jsx(R,{icon:r,width:s,height:s,"aria-hidden":"true",className:a.icon}):null}function et({variant:e="empty",surface:n="card",title:s,titleAs:a="p",description:r,icon:i,actions:l,role:o=Wd[e],ariaLive:d=Yd[e],iconSize:u=24,className:f,classNames:m={},"data-testid":x="feedback-state"}){const h=Gd(e,i,u,m);return t.jsxs("div",{role:o,"aria-live":d,"data-variant":e,"data-testid":x,"data-surface":n,className:c.cn("flex flex-col items-center justify-center text-center",Pd[n],n==="card"?Hd[e]:"bg-transparent",f,m.base),children:[h?t.jsx("span",{"aria-hidden":"true","data-testid":`${x}-icon`,className:c.cn("inline-flex items-center justify-center",Od[n],e==="success"&&n==="card"&&"rounded-full",n==="panel"?Vd:qd[e],m.iconWrapper),children:h}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",n==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${x}-title`,className:c.cn(Rd[n],m.title),children:s}),r?t.jsx("p",{"data-testid":`${x}-description`,className:c.cn(zd[n],m.description),children:r}):null]}),l?t.jsx("div",{"data-testid":`${x}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",Bd[n],m.actions),children:l}):null]})}function Rn(e){return t.jsx(et,{...e,variant:"empty"})}function zn(e){return t.jsx(et,{...e,variant:"error"})}function Bn(e){return t.jsx(et,{...e,variant:"loading"})}function mr(e){return t.jsx(et,{...e,variant:"success"})}et.displayName="FeedbackState";Rn.displayName="EmptyState";zn.displayName="ErrorState";Bn.displayName="LoadingState";mr.displayName="SuccessState";const hr=({title:e,value:n,description:s,onValueChange:a,className:r=""})=>{const i=p.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||s?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),s&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:s})]}),t.jsx(c.Switch,{id:i,isSelected:n,onValueChange:a,"data-testid":"toggle-switch"})]})},Kd={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},Qd=(e,n)=>new Intl.NumberFormat(e,{style:"currency",currency:n}),xr=e=>Object.values(e).reduce((n,s)=>n+Object.values(s).reduce((a,r)=>a+Object.values(r).reduce((i,l)=>i+l.selectedQuantity,0),0),0),Zd=e=>e.reduce((n,s)=>n+s.dates.reduce((a,r)=>a+r.tickets.reduce((i,l)=>i+l.max,0),0),0),Vn=e=>e.flatMap(n=>n.dates.flatMap(s=>s.tickets.map(a=>({exhibition:n,dateGroup:s,ticket:a})))),zs=(e,n,s)=>{const a={};let r=s?n??Zd(e):0;for(const{exhibition:i,dateGroup:l,ticket:o}of Vn(e)){a[i.id]??={},a[i.id][l.id]??={};const d=s?Math.min(o.max,r):0;a[i.id][l.id][o.id]={id:o.id,selectedQuantity:d,originalPrice:o.originalPrice,discountedPrice:o.price},r-=d}return a},Bs=(e,n,s)=>`${e}::${n}::${s}`,Xd=(e,n,s)=>{const a=xr(n);for(const{exhibition:r,dateGroup:i,ticket:l}of Vn(e)){const o=n[r.id]?.[i.id]?.[l.id]?.selectedQuantity??0,d=s===void 0?l.max:Math.min(l.max,s-(a-o));if(d>0&&o<d)return!1}return!0},Jd=({initialQuantity:e=1,minQuantity:n=1,maxQuantity:s=10,onChange:a,disabled:r=!1})=>{const i=Math.max(n,Math.min(s,e)),[l,o]=p.useState(()=>String(i)),[d,u]=p.useState(!1),f=d?l:String(i),m=()=>{r||i>=s||a?.(i+1)},x=()=>{r||i<=n||a?.(i-1)},h=w=>{if(r)return;o(w.target.value);const S=parseInt(w.target.value,10);isNaN(S)||a?.(Math.max(n,Math.min(s,S)))},b=w=>{const S=parseInt(w.target.value,10);if(u(!1),isNaN(S)){a?.(n);return}const E=Math.max(n,Math.min(s,S));E!==S?a?.(E):o(String(E))},y=i<=n,v=i>=s,N="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",j="bg-primary hover:bg-primary/80",C="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:x,disabled:r||y,className:c.cn(N,r||y?C:j),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:f,onChange:h,onFocus:()=>u(!0),onBlur:b,disabled:r,min:n,max:s,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||v,className:c.cn(N,r||v?C:j),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},eu=({label:e,checked:n=!1,onChange:s,disabled:a=!1})=>{const r=()=>{a||s?.(!n)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":n,"data-testid":"checkbox-button","data-checked":n,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:n,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",n?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:n&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},tu=({item:e,quantity:n,onChange:s,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:l})=>{const o=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-n))},d=i?.locale??"en-US",u=i?.currency??"USD",f=Qd(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:f.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:f.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[l.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Jd,{initialQuantity:n,minQuantity:0,maxQuantity:o(),onChange:s})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},nu=({exhibitionId:e,dateGroup:n,isLast:s=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!s&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:n.date}),n.tickets.map((u,f)=>t.jsxs("div",{children:[t.jsx(tu,{item:u,quantity:r(e,n.id,u.id),onChange:m=>a(e,n.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:l,settings:o,labels:d}),f<n.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),su=({title:e,exhibition:n,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o,initialExpanded:d=!1})=>{const[u,f]=p.useState(d),m=n.dates.reduce((h,b)=>h+b.tickets.reduce((y,v)=>y+a(n.id,b.id,v.id),0),0),x=n.dates.some(h=>h.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>f(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${n.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",o.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(R,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${n.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:x?n.dates.map((h,b)=>t.jsx(nu,{exhibitionId:n.id,dateGroup:h,isLast:b===n.dates.length-1,onQuantityChange:s,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:l,labels:o},h.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:o.noUpgradeTicketsAvailable})})})})]})},au=({initialExpanded:e=!1,userMaxLimit:n,labels:s,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:l})=>{const o=p.useMemo(()=>r??[],[r]),d={...Kd,...s},[u,f]=p.useState(()=>zs(o,n,!0)),m=p.useRef(!1),x=p.useMemo(()=>{const j=Vn(o).map(({exhibition:C,dateGroup:w,ticket:S})=>[Bs(C.id,w.id,S.id),S]);return new Map(j)},[o]),h=Xd(o,u,n),b=(j,C,w)=>u[j]?.[C]?.[w]?.selectedQuantity??0,y=()=>xr(u),v=(j,C,w,S)=>{const E=b(j,C,w),A=y()-E;if(n!==void 0&&A+S>n)return;const L=x.get(Bs(j,C,w));if(!L)return;const M={...u,[j]:{...u[j],[C]:{...u[j]?.[C],[w]:{id:w,selectedQuantity:S,originalPrice:L.originalPrice,discountedPrice:L.price}}}};f(M),l?.(M)},N=j=>{const C=zs(o,n,j);f(C),l?.(C)};return p.useEffect(()=>{!m.current&&h&&(l?.(u),m.current=!0)},[h,u,l]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(eu,{label:d.selectAllButtonLabel,checked:h,onChange:N})]}),o.map(j=>t.jsx(su,{title:j.exhibitionName,exhibition:j,onQuantityChange:v,getTicketQuantity:b,getTotalSelectedTickets:y,userMaxLimit:n,settings:a,labels:d,initialExpanded:e},j.id))]})},Zt={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},Xt=e=>{const n={};for(const s of e)s.type==="checkbox"?n[s.id]=[...s.selectedValues]:n[s.id]=s.selectedValue?[s.selectedValue]:[];return n},ru=(e,n)=>{const s={};for(const a of n){if(a.type==="checkbox"){s[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];s[a.id]=r.length>0?r[0]:null}return s},iu=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,pr=({triggerLabel:e,triggerAriaLabel:n,triggerIcon:s="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:l,popoverClassName:o,className:d,sections:u,onConfirm:f,onClear:m,appliedCount:x,countAriaLabel:h,countDisplay:b="badge",confirmLabel:y=Zt.confirm,clearLabel:v=Zt.clear,isOpen:N,defaultOpen:j=!1,onOpenChange:C,isDisabled:w=!1,closeOnConfirm:S=!0,keepOpenAfterClear:E=!1})=>{const[A,L]=p.useState(j),[M,_]=p.useState(()=>Xt(u)),D=N??A,$=x??u.filter(q=>iu(q)).length,I=q=>{q&&_(Xt(u)),N||L(q),C?.(q)},T=(q,Z)=>{_(Q=>({...Q,[q.id]:Z}))},K=(q,Z)=>{_(Q=>({...Q,[q.id]:Z?[Z]:[]}))},H=async()=>{_(Xt(u.map(q=>q.type==="checkbox"?{...q,selectedValues:[]}:{...q,selectedValue:null}))),await m(),E||I(!1)},B=async()=>{const q=ru(M,u);await f(q),S&&I(!1)},X=q=>{if(q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:q.label,value:M[q.id]??[],onValueChange:Q=>T(q,Q),children:q.options.map(Q=>t.jsx(c.Checkbox,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},q.id);const Z=M[q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:q.label,value:Z,onValueChange:Q=>K(q,Q||null),children:q.options.map(Q=>t.jsx(c.Radio,{value:Q.value,isDisabled:Q.isDisabled,children:Q.label},Q.value))},q.id)},J=p.useMemo(()=>$>0?h?.($)||`${$} filters applied`:void 0,[h,$]),ae=p.useMemo(()=>$===0?e||Zt.noLabel:h?h($):`${e} (${$})`,[$,e,h]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:D,onOpenChange:I,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(U,{isDisabled:w,variant:a,color:r,size:i,className:l,"aria-label":n,"aria-haspopup":"dialog","aria-expanded":D,children:[t.jsx(R,{icon:s,width:16}),t.jsx("span",{children:e}),b==="badge"&&$>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":J,children:$}):b==="summary"&&ae!==e?t.jsx("span",{className:"text-xs",children:ae}):null]})}),t.jsx(c.PopoverContent,{className:o,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(q=>X(q)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(U,{variant:"light",color:"default",size:"sm",onPress:H,children:v}),t.jsx(U,{color:"primary",size:"sm",onPress:B,children:y})]})]})})]})})};pr.displayName="FilterPopover";const lu="No sessions available for this date",ou=e=>e==="sold-out"||e==="closed"?"danger":"success",cu=e=>{const n=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof n=="number"?`${n} left`:"Limited":typeof n=="number"?`${n} seats available`:"Available"},Vs=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",du=(e,n)=>n&&e.some(s=>s.date===n)?n:e[0]?.date??null,gr=({heading:e,subheading:n,days:s,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:l=null,onSessionSelect:o,emptyStateMessage:d=lu,statusLabel:u,statusTone:f,sessionAriaLabel:m,dayButtonClassName:x,calendarSlot:h,dayGroupAriaLabel:b,sessionGridAriaLabel:y,className:v,headingClassName:N,subheadingClassName:j})=>{const C=du(s,a),w=s.find(M=>M.date===C),S=i??s.map(M=>({date:M.date,label:M.label})),E=w?.sessions??[],A=M=>M===C?"solid":"bordered",L=M=>{if(!Vs(M)){if(M.id===l){o(null);return}o(M.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",v),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",N),children:e}),n?t.jsx("p",{className:c.cn("text-sm text-gray-700",j),children:n}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[S.map(M=>t.jsx(U,{size:"sm",variant:A(M.date),color:"default",className:c.cn("rounded-full",x),isDisabled:M.isDisabled,onPress:()=>{r(M.date)},children:t.jsx("span",{children:M.label})},M.date)),h?t.jsx("div",{children:h}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[E.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,E.map(M=>{const _=Vs(M),D=M.id===l;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{L(M)},"aria-disabled":_,"aria-pressed":_?void 0:D,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",D?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(M,{isSelected:D,isUnavailable:_}):_?`${M.startTime} ${M.endTime} sold out`:`${M.startTime} ${M.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[M.startTime," – ",M.endTime]}),t.jsx(c.Chip,{size:"sm",color:f?f(M):ou(M.status),variant:"flat",children:u?u(M):cu(M)})]})})},M.id)})]})]})};gr.displayName="SessionTimeline";const uu=(e,n)=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e||n||null,br=({title:e,subtitle:n,eyebrow:s,icon:a,initials:r,actions:i,titleAs:l="h1",className:o,classNames:d={},"data-testid":u="page-header"})=>{const f=uu(a,r);return t.jsxs("header",{"data-testid":u,className:c.cn("flex flex-wrap items-start justify-between gap-4",o,d.base),children:[t.jsxs("div",{className:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{children:[s?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:s}):null,t.jsx(l,{"data-testid":`${u}-title`,className:c.cn("text-3xl font-semibold text-gray-950",d.title),children:e}),n?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn("mt-1 text-sm text-gray-600",d.subtitle),children:n}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn("flex flex-wrap items-center gap-2",d.actions),children:i}):null]})};br.displayName="PageHeader";const fu={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default"},mu={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"}},yr=({status:e,label:n,variant:s="flat",size:a="sm",color:r,startContent:i,className:l,"data-testid":o="status-chip"})=>{if(s==="dot"){const d=mu[e];return t.jsxs("span",{"data-testid":o,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",l),style:{color:d.fg,backgroundColor:d.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),n]})}return t.jsx(c.Chip,{color:r??fu[e],variant:s,size:a,startContent:i,"data-testid":o,"data-status":e,className:c.cn("font-medium",l),children:n})};yr.displayName="StatusChip";const hu={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},Un=({label:e,value:n,size:s="sm",className:a,"data-testid":r="key-value-chip"})=>t.jsxs("span",{"data-testid":r,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",hu[s],a),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:n})]});Un.displayName="KeyValueChip";const vr=({columns:e,rows:n=6,label:s="Loading",barHeight:a=12,alignLastRight:r=!1,className:i,classNames:l={},"data-testid":o="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":o,className:c.cn("w-full",i,l.base),children:[t.jsx("span",{className:"sr-only",children:s}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:n}).map((d,u)=>t.jsx("div",{"data-testid":`${o}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((f,m)=>{const x=m===e.length-1;return t.jsx("div",{className:c.cn(f==="fill"?"flex-1":"shrink-0",r&&x&&"flex justify-end"),style:f==="fill"?void 0:{width:f},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:f==="fill"?"60%":f}})},m)})},u))})]});vr.displayName="TableSkeleton";const jr="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",wr="px-4 text-[13.5px] text-acct-ink2 align-middle",Nr="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Cr="w-full",kr="border-t border-acct-border px-5 py-3.5",Sr=({columns:e,children:n,emptyContent:s,footer:a,ariaLabel:r,className:i,classNames:l={},"data-testid":o="admin-table"})=>t.jsxs("div",{className:c.cn(i,l.base),"data-testid":o,children:[t.jsxs(c.Table,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Cr,l.table),th:c.cn(jr,l.th),tr:c.cn(Nr,l.tr),td:c.cn(wr,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:d=>t.jsx(c.TableColumn,{align:d.align==="right"?"end":"start",width:d.width,children:d.label},d.key)}),t.jsx(c.TableBody,{emptyContent:s,children:n})]}),a?t.jsx("div",{"data-testid":`${o}-footer`,className:c.cn(kr,l.footer),children:a}):null]});Sr.displayName="AdminTable";const xu={md:"w-[280px]",lg:"w-[360px]"},Ar=({searchValue:e,onSearchChange:n,searchLabel:s,searchPlaceholder:a,searchIcon:r,children:i,trailing:l,searchWidth:o="md",className:d,"data-testid":u="admin-toolbar"})=>t.jsxs("div",{role:"search","data-testid":u,className:c.cn("flex flex-wrap items-center gap-3 mb-4",d),children:[t.jsx(c.Input,{type:"search","aria-label":s,placeholder:a??s,value:e,onValueChange:n,startContent:r?t.jsx("span",{"aria-hidden":"true",className:"flex text-acct-muted",children:r}):void 0,"data-testid":`${u}-search`,variant:"bordered",radius:"none",classNames:{base:xu[o],inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"}}),i,l?t.jsx("div",{className:"ml-auto",children:l}):null]});Ar.displayName="AdminToolbar";const pu="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",gu="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",$r=p.forwardRef(function({icon:n,children:s,count:a,className:r,testId:i,...l},o){return t.jsxs(U,{ref:o,"data-testid":i,variant:"light",size:"sm",className:c.cn(gu,r),...l,children:[t.jsx(R,{icon:n,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:s}),a!==void 0&&a>0&&t.jsx("span",{className:pu,children:a})]})});$r.displayName="ToolbarButton";function Dr({items:e,value:n,onChange:s,ariaLabel:a,className:r,"data-testid":i="underline-tabs"}){return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:n,onSelectionChange:l=>s(String(l)),"data-testid":i,classNames:{base:c.cn("w-full mb-6",r),tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:"max-w-fit px-0.5 h-auto pb-3",tabContent:"text-[15px] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust",panel:"p-0"},children:e.map(l=>t.jsx(c.Tab,{title:l.label,"data-testid":`${i}-${l.key}`,children:l.content},l.key))})}Dr.displayName="UnderlineTabs";const Hn="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",qn="font-normal normal-case tracking-normal",Er=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),Fr="text-[13.5px] text-acct-ink",Mr="bg-acct-page text-acct-muted cursor-default",Lr="mt-[5px] text-xs text-acct-sub",Ir="mt-[5px] text-xs text-acct-danger",Tr=({children:e,suffix:n,className:s,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(Hn,s),children:[e,n?t.jsxs("span",{className:qn,children:[" ",n]}):null]});Tr.displayName="AdminFieldLabel";const _r=({label:e,labelSuffix:n,value:s,onChange:a,placeholder:r,disabled:i=!1,readOnly:l=!1,mono:o=!1,autoFocus:d=!1,hint:u,invalid:f=!1,className:m,"data-testid":x="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&n?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:qn,children:[" ",n]})]}):e,value:s,placeholder:r,isDisabled:i,isReadOnly:l,autoFocus:d,isInvalid:f,description:!f&&u?u:void 0,errorMessage:f?u:void 0,onValueChange:a,"data-testid":x,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:Hn,inputWrapper:Er,input:c.cn(Fr,(o||l)&&"font-mono",l&&Mr),description:Lr,errorMessage:Ir}});_r.displayName="AdminTextField";const bu={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Pr=({actions:e,size:n="md",className:s,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",s),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",bu[n]),children:r.icon},r.key))});Pr.displayName="RowActions";const Or=({children:e,placeholder:n="Select…",onOpen:s,onClear:a,ariaLabel:r,icon:i,trailingIcon:l,clearIcon:o,disabled:d=!1,className:u,"data-testid":f="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":f,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(U,{variant:"light",radius:"none",disableAnimation:!0,onPress:s,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${f}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:n}),l?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:l}):null]}),m&&a?t.jsx(U,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${f}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:o}):null]})};Or.displayName="PickerRow";function Rr(e,n,s){if(s<=0||n<=0||e<=0)return{from:0,to:0};const a=(e-1)*n+1;return a>s?{from:0,to:0}:{from:a,to:Math.min(s,e*n)}}const zr=({page:e,pageSize:n,total:s,unit:a,announce:r=!0,className:i,classNames:l={},"data-testid":o="pagination-summary"})=>{const{from:d,to:u}=Rr(e,n,s),f=c.cn("font-semibold text-default-700",l.emphasis);return t.jsxs("p",{"data-testid":o,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",i,l.base),children:["Showing"," ",t.jsx("span",{"data-testid":`${o}-range`,className:f,children:d===0?0:`${d}–${u}`})," ","of"," ",t.jsx("span",{"data-testid":`${o}-total`,className:f,children:s}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})};zr.displayName="PaginationSummary";const Br=({isLoading:e=!1,isError:n=!1,isEmpty:s=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:l,retryLabel:o="Retry",onRetry:d,errorActions:u,errorContent:f,emptyTitle:m="Nothing here yet",emptyDescription:x,emptyIcon:h,emptyActions:b,emptyContent:y,children:v,className:N,classNames:j={},"data-testid":C="list-panel"})=>{const w={base:c.cn("border-0 bg-transparent py-12",j.state)};let S;return e?S=r??t.jsx(Bn,{title:a,classNames:w,"data-testid":`${C}-loading`}):n?S=f??t.jsx(zn,{title:i,description:l,classNames:w,"data-testid":`${C}-error`,actions:u??(d?t.jsx(U,{color:"primary",variant:"flat",onPress:d,children:o}):void 0)}):s?S=y??t.jsx(Rn,{title:m,description:x,icon:h,actions:b,classNames:w,"data-testid":`${C}-empty`}):S=v,t.jsx("section",{"data-testid":C,className:c.cn("rounded-xl bg-white p-2 shadow-sm",N,j.base),children:S})};Br.displayName="ListPanel";const yu=350,vu={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}"},Jt=(e,n)=>Object.entries(n).reduce((s,[a,r])=>s.replace(`{${a}}`,r),e),ju=({dueAmount:e,received:n,defaultReceived:s=null,onChange:a,locale:r="en-US",labels:i,isDisabled:l=!1,maxAmount:o,autoFocus:d=!1,className:u,"data-testid":f="cash-tender-form"})=>{const m={...vu,...i},x=Ft(e.currency,r),h=n!==void 0,[b,y]=p.useState(s??null),v=h?n:b,N=p.useMemo(()=>{const I=typeof v=="number"&&Number.isFinite(v)?v:0,T=dn(I,e.value,e.currency,r);return{received:I,change:T>0?T:0,isValid:I>=e.value&&I>0}},[v,e.value,e.currency,r]),j=p.useCallback(I=>{const T=I.currentTarget;requestAnimationFrame(()=>{T.isConnected&&T.select()})},[]),C=p.useCallback(I=>{if(l)return;const T=I.replace(/[^\d.,]/g,"").replace(",","."),K=T===""?null:Number.parseFloat(T),H=K===null||Number.isNaN(K)?null:K;if(H!==null&&o!==void 0&&H>o)return;h||y(H);const B=typeof H=="number"&&Number.isFinite(H)?H:0,X=dn(B,e.value,e.currency,r);a?.({received:B,change:X>0?X:0,isValid:B>=e.value&&B>0})},[h,l,e.value,e.currency,r,a,o]),w=v==null?"":String(v),S=N.isValid&&N.change>0,E=!N.isValid&&N.received>0,A=xe(N.change,r,e.currency),L=xe(e.value,r,e.currency),[M,_]=p.useState(""),D=p.useRef(null);p.useEffect(()=>{D.current&&clearTimeout(D.current);const I=S?Jt(m.changeMessageTemplate,{change:A}):"",T=S?yu:0;return D.current=setTimeout(()=>_(I),T),()=>{D.current&&clearTimeout(D.current)}},[S,A,m.changeMessageTemplate]);const $=`${f}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",u),"data-testid":f,children:[t.jsx(c.Input,{id:$,label:m.receivedLabel,labelPlacement:"outside",type:"text",inputMode:x===0?"numeric":"decimal",pattern:x===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:w,onChange:I=>C(I.target.value),onFocus:j,placeholder:m.receivedPlaceholder,isDisabled:l,isInvalid:E,errorMessage:E?Jt(m.insufficientMessageTemplate,{due:L}):void 0,variant:"bordered",radius:"lg",autoFocus:d,"data-testid":`${f}-received-input`}),S&&t.jsx(c.Alert,{"data-testid":`${f}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:m.changeLabel,description:Jt(m.changeMessageTemplate,{change:A}),icon:t.jsx(R,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:M})]})},wu={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Us=()=>{const e=new Date,n=s=>String(s).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`},Vr=({dueAmount:e,value:n,defaultValue:s,onChange:a,labels:r,hideDate:i=!1,hideBankName:l=!1,isDisabled:o=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:f=!1,className:m,"data-testid":x="check-tender-form"})=>{const h={...wu,...r},b=n!==void 0,[y,v]=p.useState({checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Us()}),[N,j]=p.useState(!!s?.checkNumber),C=p.useMemo(()=>b?{checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Us()}:y,[b,n,y]),w=p.useCallback(D=>{b||v(D);const $=D.checkNumber.trim(),I={amount:e.value,checkNumber:$,bankName:D.bankName.trim()||void 0,date:i?void 0:D.date,isValid:$.length>0&&e.value>0};a?.(I)},[b,e.value,i,a]),S=p.useCallback(D=>$=>{o||(D==="checkNumber"&&$.length>0&&j(!0),w({...C,[D]:$}))},[C,w,o]),E=p.useCallback(()=>{o||j(!0)},[o]),A=N&&C.checkNumber.trim()==="",L=`${x}-check-number`,M=`${x}-bank-name`,_=`${x}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":x,children:[t.jsx(c.Input,{id:L,label:h.checkNumberLabel,labelPlacement:"outside",type:"text",value:C.checkNumber,onChange:D=>S("checkNumber")(D.target.value),onBlur:E,placeholder:h.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:A,errorMessage:A?h.checkNumberRequiredMessage:void 0,isDisabled:o,variant:"bordered",radius:"lg",autoFocus:f,"data-testid":`${x}-check-number-input`}),!l&&t.jsx(c.Input,{id:M,label:h.bankNameLabel,labelPlacement:"outside",type:"text",value:C.bankName,onChange:D=>S("bankName")(D.target.value),placeholder:h.bankNamePlaceholder,maxLength:u,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:h.dateLabel,labelPlacement:"outside",type:"date",value:C.date,onChange:D=>S("date")(D.target.value),isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${x}-date-input`,className:"sm:col-span-2"})]})};Vr.displayName="CheckTenderForm";const Nu={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},Cu=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],Ur=({dueAmount:e,methodOptions:n=Cu,value:s,defaultValue:a,onChange:r,labels:i,showReference:l=!1,isDisabled:o=!1,className:d,"data-testid":u="other-tender-form"})=>{const f={...Nu,...i},m=s!==void 0,[x,h]=p.useState({method:a?.method??"",reference:a?.reference??""}),b=p.useMemo(()=>m?{method:s?.method??"",reference:s?.reference??""}:x,[m,s,x]),y=p.useCallback(S=>n.find(E=>E.value===S)?.label??"",[n]),v=p.useCallback(S=>{m||h(S);const E=y(S.method),A={amount:e.value,method:S.method,description:E,reference:S.reference.trim()||void 0,isValid:S.method!==""};r?.(A)},[m,e.value,r,y]),N=p.useCallback(S=>{if(o)return;const E=typeof S=="string"?S:Array.from(S)[0]?.toString()??"";v({...b,method:E})},[b,v,o]),j=p.useCallback(S=>{o||v({...b,reference:S})},[b,v,o]),C=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(Me,{id:C,label:f.methodLabel,labelPlacement:"outside",placeholder:f.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:N,isDisabled:o,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:n.map(S=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${S.value}`,children:S.label},S.value))}),l&&t.jsx(c.Input,{id:w,label:f.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:S=>j(S.target.value),placeholder:f.referencePlaceholder,isDisabled:o,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};Ur.displayName="OtherTenderForm";const ku={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Su={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Au={pending:"warning",recorded:"success",failed:"danger"},$u=e=>e==="pending"||e==="recorded",Du=e=>`#${e+1}`,Hr=({total:e,tenders:n,onRemove:s,locale:a="en-US",labels:r,hideCollectedList:i=!1,className:l,"data-testid":o="split-payment-summary"})=>{const d={...ku,...r},{collected:u,remaining:f,isComplete:m}=p.useMemo(()=>{const h=n.reduce((y,v)=>$u(v.status)?y+v.amount:y,0),b=Math.max(e.value-h,0);return{collected:h,remaining:b,isComplete:h>=e.value&&e.value>0}},[n,e.value]),x=h=>h==="pending"?d.statusPending:h==="recorded"?d.statusRecorded:d.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":o,children:[t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${o}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:m?d.completeLabel:d.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${o}-remaining-amount`,children:xe(m?u:f,a,e.currency)})]}),!i&&n.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${o}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:d.collectedHeading}),n.map((h,b)=>t.jsx(Eu,{index:b,tender:h,locale:a,currency:e.currency,removable:!!s&&h.status!=="recorded",onRemove:s?()=>s(h.id):void 0,statusLabel:x(h.status),removeAriaLabel:d.removeAriaLabel,recordedTooltip:d.removeTooltipForRecorded,dataTestId:`${o}-row-${b}`},h.id))]})]})};Hr.displayName="SplitPaymentSummary";const Eu=({index:e,tender:n,locale:s,currency:a,removable:r,onRemove:i,statusLabel:l,removeAriaLabel:o,recordedTooltip:d,dataTestId:u})=>{const f=i?t.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":o,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(R,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:Du(e)}),t.jsx(R,{icon:Su[n.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:n.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(n.amount,s,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Au[n.status],startContent:n.status==="recorded"?t.jsx(R,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):n.status==="failed"?t.jsx(R,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:l}),f&&(r?f:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:f})}))]})},Fu=`
15
+ ${p?"cursor-default":"cursor-pointer hover:text-primary"}
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(O,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(J.ZoomIn,{size:16})})})]})}function cm({editor:e,isDisabled:s=!1}){const[n,a]=x.useState(!1),[r,i]=x.useState(""),[o,l]=x.useState(""),[d,u]=x.useState(!1),p=e.isActive("link"),m=f=>{if(f){const{from:b,to:y}=e.state.selection,g=e.isActive("link");let v="";if(g){const A=e.schema.marks.link,w=e.state.doc.resolve(b),E=Ea.getMarkRange(w,A);E&&(v=e.state.doc.textBetween(E.from,E.to,""))}else v=e.state.doc.textBetween(b,y,"");const j=e.getAttributes("link").href||"";i(v),l(j),u(g)}a(f)},h=()=>{if(o.trim()){const{from:f,to:b}=e.state.selection,y=e.schema.marks.link,g=e.state.doc.resolve(f),v=Ea.getMarkRange(g,y),j=v?.from??f,A=v?.to??b,w=e.state.doc.textBetween(j,A,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:j,to:A}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(O,{size:"sm",radius:"sm",variant:p?"solid":"bordered",color:p?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(J.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:f=>i(f.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&h(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(O,{size:"sm",color:"primary",onPress:h,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function dm({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function Oi(e,s){const n=x.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>ss(l)))).forEach(l=>{const d=ut[l];if(d)try{const u=d.canExecute?.(e)??!0,p=d.isActive?.(e)??!1;i[l]={isActive:p,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[a,r]=x.useState(n);return x.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>ss(d)))).forEach(d=>{const u=ut[d];if(u)try{const p=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!p,canExecute:p}}catch(p){console.warn(`Extension not available for modifier: ${d}`,p),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,n]),a}function zi(e,s){const n=x.useCallback((o,l)=>{if(!e)return;const d=ut[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=x.useCallback(o=>{n(o)},[n]),r=x.useCallback((o,l)=>{if(!e)return!1;const d=ut[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=x.useCallback((o,l)=>{if(!e)return!1;const d=ut[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:n,toggleModifier:a,canExecute:r,isActive:i}}function um(e=Fe.default){const[s,n]=x.useState(e),a=x.useCallback((l=Fe.step)=>{n(d=>Math.min(Fe.max,d+l))},[]),r=x.useCallback((l=Fe.step)=>{n(d=>Math.max(Fe.min,d-l))},[]),i=x.useCallback(()=>{n(Fe.default)},[]),o=x.useCallback(l=>{const d=Math.max(Fe.min,Math.min(Fe.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Fe.min,isMaxZoom:s>=Fe.max,isDefaultZoom:s===Fe.default}}const mm=["bold","italic","strike","underline","code"];function fm({editor:e,modifiers:s,onToolbarAction:n}){const a=Oi(e,s),{toggleModifier:r}=zi(e,n);if(!e)return null;const i=s.map(o=>ss(o)).filter(o=>mm.includes(o));return i.length===0?null:t.jsx(dm,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Dt(o);return t.jsx(wt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function pm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Oi(e,s),{toggleModifier:d,executeCommand:u}=zi(e,o);if(!e)return null;const p=s.map(N=>ss(N)),m=p.some(N=>["bold","italic","strike","underline","code"].includes(N)),h=p.some(N=>["textColor","highlight"].includes(N)),f=p.includes("heading"),b=p.includes("textAlign"),y=p.some(N=>["bulletList","orderedList","taskList"].includes(N)),g=p.includes("blockquote"),v=p.includes("codeBlock"),j=p.includes("link"),A=p.includes("horizontalRule"),w=p.some(N=>["undo","redo"].includes(N)),E=n!==void 0&&a!==void 0,$=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${$} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(fm,{editor:e,modifiers:s,onToolbarAction:o}),(h||f||b||y||g||v||j||A||w||E)&&t.jsx(yt,{})]}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("textColor")&&t.jsx(Xa,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),p.includes("highlight")&&t.jsx(Xa,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||b||y||g||v||j||A||w||E)&&t.jsx(yt,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(em,{editor:e}),(b||y||g||v||j||A||w||E)&&t.jsx(yt,{})]}),b&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(N=>{const C=im[N],k=e.isActive({textAlign:N});return t.jsx(wt,{icon:C,label:`Align ${N}`,isActive:k,onClick:()=>u("textAlign",{type:"textAlign",alignment:N})},N)})}),(y||g||v||j||A||w||E)&&t.jsx(yt,{})]}),y&&t.jsxs(t.Fragment,{children:[t.jsx(tm,{editor:e,types:p.filter(N=>["bulletList","orderedList","taskList"].includes(N))}),(g||v||j||A||w||E)&&t.jsx(yt,{})]}),(g||v||j||A)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[g&&t.jsx(wt,{icon:Dt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),v&&t.jsx(wt,{icon:Dt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),j&&t.jsx(cm,{editor:e,isDisabled:l.link?.isDisabled}),A&&t.jsx(wt,{icon:Dt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||E)&&t.jsx(yt,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[p.includes("undo")&&t.jsx(wt,{icon:Dt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),p.includes("redo")&&t.jsx(wt,{icon:Dt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),E&&t.jsx(yt,{})]}),E&&t.jsx(om,{zoom:n,onZoomChange:N=>{a?.(N),o?.({type:"zoom",modifier:`${N}%`})}})]})})}const Bt={bold:{category:"mark",extension:Mc.Bold,priority:100},italic:{category:"mark",extension:Pc.Italic,priority:100},strike:{category:"mark",extension:Tc.Strike,priority:100},underline:{category:"mark",extension:Ic.Underline,priority:100},code:{category:"mark",extension:Oc.Code,priority:100},textColor:{category:"mark",extension:zc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Bc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Vc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Hc.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:qc.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Gc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Kc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Zc.CodeBlock,priority:100},blockquote:{category:"node",extension:Xc.Blockquote,priority:100},horizontalRule:{category:"node",extension:Jc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:ed.HardBreak,priority:100},undo:{category:"extension",extension:Da.History,priority:50},redo:{category:"extension",extension:Da.History,priority:50},textAlign:{category:"extension",extension:td.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},xm=[sd.Document,nd.Text,Wc.Paragraph,Uc.TextStyle.configure({HTMLAttributes:{}}),Qc.ListItem.configure({HTMLAttributes:{}}),Yc.TaskItem.configure({nested:!0}),ad.Dropcursor,rd.Gapcursor];function hm(e){const s=[],n=new Set,a=new Set;xm.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>ss(l)),i=new Set;return r.forEach(l=>{const d=Bt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=Bt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=Bt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const p=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(p),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(Bt).find(f=>f?.extension?.name===l.name),p=Object.values(Bt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(p?.priority??100)-m})}const Bi={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},bm={h1:`font-size: ${ge.fontSize["4xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h2:`font-size: ${ge.fontSize["2xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h3:`font-size: ${ge.fontSize.xl}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h4:`font-size: ${ge.fontSize.lg}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h5:`font-size: ${ge.fontSize.base}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,h6:`font-size: ${ge.fontSize.sm}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${xe.md} 0 ${xe.sm} 0;`,p:`min-height: ${ge.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${xe.xl}; margin: ${xe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${xe.xl}; margin: ${xe.md} 0;`,li:`display: list-item; margin: ${xe.xs} 0;`,strong:`font-weight: ${ge.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Ee.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ge.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ge.fontFamily.mono};`,pre:`background: ${Ee.neutral.gray[800]}; border-radius: ${xe.sm}; color: ${Ee.neutral.gray[100]}; font-family: ${ge.fontFamily.mono}; margin: ${xe.lg} 0; padding: 0.75rem ${xe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Ee.neutral.gray[300]}; margin: ${xe.lg} 0; padding-left: ${xe.md}; color: ${Ee.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Ee.neutral.gray[200]}; margin: ${xe.xl} 0;`,a:`color: ${Ee.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Ee.palettes.warning[200]}; border-radius: ${xe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${xe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},gm={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function ym(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(gm)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries(bm)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return s}const vm=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=In.useCurrentEditor();return t.jsx(pm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},wm=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=In.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},$n=x.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Bi.full,variant:u="bordered",initialContent:p,content:m,onContentChange:h,onUpdate:f,onToolbarAction:b,isReadOnly:y=!1,isDisabled:g=!1,includeInlineStyles:v=!0,...j}=e,{zoom:A,setZoom:w}=um(),E=Za.lineHeight,$=n*E,N=r?void 0:a*E,C=x.useMemo(()=>hm(d),[d]),{Component:k,label:_,shouldLabelBeOutside:F,getBaseProps:D,getLabelProps:P,getInputWrapperProps:T}=c.useInput({...j,variant:u,ref:s,isMultiline:!0}),W=_?t.jsx("label",{...P(),children:_}):null,Y=x.useCallback(({editor:z})=>{const G=z.getHTML(),K=v?ym(G):G,ae=z.getJSON(),Q=z.getText(),oe=Q.length,ee=Q.split(/\s+/).filter(ie=>ie.length>0).length,q={html:K,json:ae,text:Q,characters:oe,words:ee};if(h?.(q),f?.(q),"onChange"in j&&typeof j.onChange=="function"){const ie={target:{value:K},currentTarget:{value:K}};j.onChange(ie)}},[h,f,j,v]);return t.jsxs(k,{...D(),children:[F?W:null,t.jsx("div",{...T(),className:c.cn(T().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:N?`${N+Za.toolbarHeight}px`:void 0,overflow:N?"auto":void 0},children:t.jsx(In.EditorProvider,{editable:!y&&!g,slotBefore:l?t.jsx(vm,{modifiers:d,zoom:A,onZoomChange:w,onToolbarAction:b}):void 0,slotAfter:t.jsx(wm,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${$}px`,fontSize:`${A}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:C,content:m||p||e.defaultValue||"",onUpdate:Y})})]})});$n.displayName="TipTapEditor";const Vi=x.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx($n,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx($n,{...r,variant:a,ref:s}))});Vi.displayName="RichTextArea";function Ja(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}const Ui="(prefers-reduced-motion: reduce)",Hi="data-pos-reduce-motion",je="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Wi="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",js=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Wi}`;function jm(){return typeof document>"u"?!1:document.documentElement.getAttribute(Hi)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Ui).matches}function rs(){const[e,s]=x.useState(!1);return x.useEffect(()=>{const n=()=>s(jm()),a=typeof window.matchMedia=="function"?window.matchMedia(Ui):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Hi]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const er=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${je} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,tr=`border bg-white shadow-none ${je}`,Nm={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${er} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${tr} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${er} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${tr} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},Cm={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},sr=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],km={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},qi=({presetAmounts:e=sr,selectedDonation:s,defaultSelectedDonation:n=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:p,mobileColumns:m=2,desktopColumns:h=3,isDisabled:f=!1,buttonVariant:b="bordered",buttonColor:y="default",inputVariant:g="bordered",size:v="md",className:j="",showCard:A=!0,variant:w="pill",isRequired:E=!1})=>{const $={...km,...p},N=x.useId(),C=`${N}-title`,k=`${N}-custom`,_=Array.isArray(e)?e:sr,F={2:"grid-cols-2",3:"grid-cols-3"},D={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},P=`${F[m]} ${D[h]}`,[T,W]=Os(s,n,a),[Y,z]=x.useState(""),[G,K]=x.useState(!1),[ae,Q]=x.useState(0),oe=x.useCallback(X=>{if(f)return;const he={amount:X.amount,isCustom:!1,presetId:X.id};W(he),z(""),K(!1),Q(nt=>nt+1),r?.(he)},[f,W,r]),ee=x.useCallback(X=>{if(f)return;if(z(X!==void 0?String(X):""),r){W(null);return}if(K(!1),X===void 0||isNaN(X)){W(null);return}W({amount:X,isCustom:!0})},[f,W,r]),q=x.useCallback(()=>{if(f)return;const X=Y!==""?parseFloat(Y):void 0;X===void 0||isNaN(X)||r?.({amount:X,isCustom:!0})},[f,Y,r]),ie=x.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),V=X=>T!==null&&!T.isCustom&&T.presetId===X.id,te=(X,he)=>{const nt=T?.isCustom===!0,Ke=!r&&G;return t.jsxs("div",{className:X.root,"data-testid":"donation-amounts-root","data-variant":w,children:[$.eyebrow&&t.jsx("p",{className:X.eyebrow,"data-testid":"donation-amounts-eyebrow",children:$.eyebrow}),$.title&&t.jsxs("p",{id:C,className:X.title,"data-testid":"donation-amounts-title",children:[$.title,E&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),$.caption&&t.jsx("p",{className:X.caption,"data-testid":"donation-amounts-caption",children:$.caption}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":$.title?C:void 0,"aria-label":$.title?void 0:$.presetsAriaLabel,className:c.cn(X.grid,w==="tile"&&P),"data-testid":"donation-amounts-presets",children:_.map(ve=>{const Ye=V(ve)&&!Ke;return t.jsxs(O,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":Ye,className:c.cn(X.preset,Ye?X.presetSelected:X.presetIdle),onPress:()=>oe(ve),isDisabled:f,"data-selected":Ye||void 0,"data-testid":`donation-amounts-preset-${ve.id}`,children:[t.jsx("span",{className:c.cn(X.amount,Ye&&X.amountSelected),children:ve.label||Ja(ve.amount,o,i,w!=="pos")}),ve.sublabel&&" ",ve.sublabel&&t.jsx("span",{className:X.sublabel,"data-testid":`donation-amounts-preset-${ve.id}-sublabel`,children:ve.sublabel})]},ve.id)})}),l&&t.jsxs("div",{className:c.cn("flex flex-col",X.inputBase),children:[$.customAmountLabel&&t.jsx("label",{htmlFor:k,className:X.customLabel,"data-testid":"donation-amounts-custom-label",children:$.customAmountLabel}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(c.NumberInput,{id:k,placeholder:$.customAmountPlaceholder,"aria-label":$.customAmountLabel?void 0:$.customAmountAriaLabel,onInput:r?()=>{W(null),K(!0)}:()=>K(!0),onBlur:r?void 0:()=>K(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ie,value:Y!==""?parseFloat(Y):void 0,onValueChange:ee,isDisabled:f,className:"flex-1",classNames:{inputWrapper:c.cn(X.inputWrapper,he.wrapper,(nt||Ke)&&X.inputWrapperActive),input:c.cn(X.input,he.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${ae}`:T?.isCustom===!1?T.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",size:v,className:"shrink-0",onPress:q,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:$.addDonationButton})]})]})]})},se=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[$.title&&t.jsx("h2",{id:C,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:$.title}),_.length>0&&t.jsx("div",{role:"group","aria-labelledby":$.title?C:void 0,"aria-label":$.title?void 0:$.presetsAriaLabel,className:c.cn("grid gap-3",P),"data-testid":"donation-amounts-presets",children:_.map(X=>{const he=T!==null&&!T.isCustom&&T.presetId===X.id;return t.jsx(O,{color:he?"primary":y,variant:he?"solid":b,className:"w-full","aria-pressed":he,onPress:()=>oe(X),isDisabled:f,"data-testid":`donation-amounts-preset-${X.id}`,children:X.label||Ja(X.amount,o,i)},X.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:$.customAmountPlaceholder,"aria-label":$.customAmountAriaLabel,onInput:r?()=>{W(null),K(!0)}:void 0,variant:g,radius:"full",size:v,minValue:d,maxValue:u,step:.01,formatOptions:ie,value:Y!==""?parseFloat(Y):void 0,onValueChange:ee,isDisabled:f,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${ae}`:T?.isCustom===!1?T.presetId:"custom"),r&&t.jsx(O,{color:"primary",variant:"solid",radius:"full",size:v,className:"shrink-0",onPress:q,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:$.addDonationButton})]})]}),_e=w==="pill"?se:te(Nm[w],Cm[w][v]);return A?t.jsx(c.Card,{className:c.cn("w-full",j),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:_e})}):t.jsx("div",{className:c.cn("w-full",j),"data-testid":"donation-amounts-plain",children:_e})};qi.displayName="DonationAmounts";const Sm=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},$m=e=>{switch(e){case"warning":return J.Clock;case"error":return J.AlertCircle;case"success":return J.CheckCircle;default:return J.Clock}},Am=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Gi=x.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:p=!0,formatTime:m=Sm,className:h,...f},b)=>{const[y,g]=Os(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),v=x.useRef(null),j=x.useRef(!1);x.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]),x.useEffect(()=>{if(!p||y<=0){v.current&&(clearInterval(v.current),v.current=null);return}return v.current=setInterval(()=>{g($=>$<=1?(v.current&&(clearInterval(v.current),v.current=null),j.current||(j.current=!0,a?.()),0):$-1)},1e3),()=>{v.current&&(clearInterval(v.current),v.current=null)}},[p,y,g,a]),x.useEffect(()=>{y>0&&(j.current=!1)},[y]);const A=d||$m(r),w=Am(i),E={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:b,role:"banner","aria-live":"polite","aria-label":`${o} ${m(y)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,E[u],h),...f,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(A,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(y)}`,"data-testid":"expire-cart-timer-value",children:m(y)})})]})})})});Gi.displayName="ExpireCartTimer";const kt=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(M,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),Em=({classes:e="",name:s,imageUrl:n,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:p="eager",showMoreButtonClassName:m,labels:h})=>{const[f,b]=x.useState(!1),[y,g]=x.useState(!1),v=x.useRef(null);return x.useEffect(()=>{const j=()=>{if(v.current){const A=v.current.scrollHeight>v.current.clientHeight;g(A)}};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&n&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&n&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:p,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:h.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(kt,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(kt,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(kt,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:v,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&y&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(y||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(O,{onPress:()=>b(!f),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?h.showLess||"Hide":h.showMore||"Show"})})]})]})]})};function An(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Dm(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Lm={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},St=e=>typeof e=="number"&&!isNaN(e),$s=({offer:e,quantity:s,defaultQuantity:n=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:p="default",showCard:m=!0,showDescription:h=!0,showPeopleCount:f=!0,showPrice:b=!0,priceDisplay:y,classNames:g={},"data-testid":v,selectedColor:j="default",selectionMode:A="stepper",compact:w=!1,isSoldOut:E,isMaxReached:$,isRuleBlocked:N,statusTone:C="default",statusLabel:k,disabledReason:_,disabled:F})=>{const D=x.useMemo(()=>({...Lm,...o}),[o]),[P,T]=x.useState(n),W=s!==void 0?s:P,Y=!!(d||F),z=w||!!e.compact,G=A==="press-to-add",K=x.useMemo(()=>typeof E=="boolean"?E:typeof e.isSoldOut=="boolean"?e.isSoldOut:!St(e.totalTicketsSold)||!St(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[E,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),ae=x.useMemo(()=>typeof $=="boolean"?$:typeof e.isMaxReached=="boolean"?e.isMaxReached:K||!St(e.ticketsAllowed)?!1:W>=e.ticketsAllowed-(e.totalTicketsSold??0),[$,e.isMaxReached,K,e.ticketsAllowed,e.totalTicketsSold,W]),Q=x.useMemo(()=>typeof N=="boolean"?N:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[N,e.isRuleBlocked]),oe=_||e.disabledReason,ee=Y||K||Q,q=me=>{if(ee||me>0&&ae)return;const $e=Math.max(0,W+me);s===void 0&&T($e),a?.(e.id,$e)},ie=x.useMemo(()=>{if(K)return"soldOut";if(Q)return"ruleBlocked";if(Y)return"disabled"},[K,Q,Y]),V=x.useMemo(()=>C||(K||Q?"danger":ae?"warning":"default"),[C,K,Q,ae]),te=x.useMemo(()=>{if(ie)return ie==="ruleBlocked"?k||oe||D.ruleBlocked:ie==="soldOut"?k||oe||D.soldOut:ie==="disabled"?k||oe||D.disabled:k||D.maxReached},[ie,k,oe,D]),se={soldOut:"danger",ruleBlocked:V,disabled:"default",maxReached:"warning"},_e={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},X=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",z&&"text-sm",g.name),children:e.name}),he=()=>{if(!b)return null;const me=y?.price??e.price,$e=y?.originalPrice,at=An(me,i,r);if(l?.renderPrice)return l.renderPrice(me,at,e);if(St($e)&&St(me)&&$e>me){const L=An($e,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",z&&"mt-0.5",g.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",L,", discounted price ",at]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",z&&"text-xs",g.originalPrice),children:L}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",z&&"text-sm",g.discountedPrice),children:at})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",z&&"text-sm mt-0.5",g.price),children:at})},nt=()=>!h||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",z&&"mb-2 text-xs text-gray-600",g.description),children:e.description}),Ke=()=>{if(!f||!St(e.numberOfPeople)||e.numberOfPeople<=0)return null;const me=e.numberOfPeople===1?D.person:D.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,me,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",z&&"mt-1 text-xs",g.peopleCount),children:[t.jsx(M,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",me]})},ve=()=>{const me=W===0||ee,$e=ae||ee;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:W,onIncrement:()=>q(1),onDecrement:()=>q(-1),isDecrementDisabled:me,isIncrementDisabled:$e,isDisabled:ee}):t.jsxs("div",{className:c.cn("flex items-center gap-2",g.quantitySelector),children:[t.jsx(O,{"data-testid":"offer-card-decrement-button",onPress:()=>q(-1),isDisabled:me,variant:u,color:W>0?j:p,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(M,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",z&&"text-sm"),children:W}),t.jsx(O,{"data-testid":"offer-card-increment-button",onPress:()=>q(1),isDisabled:$e,variant:u,color:W>0?j:p,radius:"full",isIconOnly:!0,size:z?"md":"sm","aria-label":"Increase quantity",children:t.jsx(M,{icon:"gravity-ui:plus",width:16})})]})},Ye=(me,$e)=>l?.renderDisabledState?l.renderDisabledState(me,$e):me==="soldOut"&&l?.renderSoldOut?l.renderSoldOut($e):me==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert($e):t.jsx(c.Chip,{"data-testid":_e[me],color:se[me],variant:me==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",me==="maxReached"?"h-8":"h-10",me==="soldOut"&&g.soldOut,me==="maxReached"&&g.maxReachedAlert,z&&"h-8"),startContent:t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:$e})}),mt=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",z?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ee||ae?"opacity-50 pointer-events-none select-none":""),children:[X(),he(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",z?"mb-1":"mb-2"),children:[Ke(),nt()]})]}),!G&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",z&&"space-x-1 pb-1 md:p-1",g.compactFooter),children:ie&&te?Ye(ie,te):ve()})]}),Qe=ae&&!K&&!Q&&!Y?t.jsx(Ie.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",g.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:Ye("maxReached",te||D.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",G&&!ee&&!ae&&"cursor-pointer",z&&g.compact,g.base),"data-testid":v||`offer-card-${e.id}`,isPressable:G&&!ee&&!ae,onPress:G&&!ee&&!ae?()=>q(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:mt}),t.jsx(Ie.AnimatePresence,{children:Qe&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Qe})})]}):t.jsxs("div",{className:c.cn("w-full",z&&g.compact,g.base),"data-testid":v||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",z?"pb-0.5":"",g.body),children:mt}),t.jsx(Ie.AnimatePresence,{children:Qe&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",z?"pt-1":"",g.footer),children:Qe})})]})};$s.displayName="OfferCard";const Ki=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(M,{"data-testid":"offer-card-empty-icon",icon:s,width:n,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};Ki.displayName="OfferCardEmpty";const Fm={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Yi=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Fm,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};Yi.displayName="OfferCardError";const _m={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Qi=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=_m[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Qi.displayName="OfferCardSkeleton";const Zi={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Xi={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},Rm={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ji=({offers:e=[],mapOffer:s,selection:n,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:p=!1,buttonVariant:m="bordered",buttonColor:h="default",showCard:f=!0,animated:b=!0,gap:y=2,compact:g=!1,classNames:v={}})=>{const[j,A]=x.useState(a),w=n!==void 0?n:j,E=x.useCallback((F,D)=>{const P={...w,[F]:Math.max(0,D)};n===void 0&&A(P),r?.(P),i?.(F,P[F])},[w,n,r,i]),$=[...e].sort((F,D)=>(F.position??0)-(D.position??0)),N=F=>{const D=s?s(F):F,P=(w??{})[D.id]||0;return{offer:D,quantity:P,onQuantityChange:E,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:h,showCard:f,compact:g}},C=Rm[y],k=c.cn("grid mx-auto pt-2",C,v.base),_=F=>{const D=N(F);return t.jsx($s,{offer:D.offer,quantity:D.quantity,onQuantityChange:D.onQuantityChange,currency:D.currency,locale:D.locale,labels:D.labels,slots:D.slots,isDisabled:D.isDisabled,buttonVariant:D.buttonVariant,buttonColor:D.buttonColor,showCard:D.showCard,compact:D.compact,classNames:v.card},D.offer.id)};return b?t.jsx(Ie.motion.div,{"data-testid":"offer-card-list",className:k,variants:Zi,initial:"hidden",animate:"show",children:t.jsx(Ie.AnimatePresence,{children:$.map(F=>{const D=N(F);return t.jsx(Ie.motion.div,{"data-testid":`offer-card-list-item-${D.offer.id}`,className:v.cardWrapper,variants:Xi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx($s,{offer:D.offer,quantity:D.quantity,onQuantityChange:E,currency:o,locale:l,labels:d,slots:u,isDisabled:p,buttonVariant:m,buttonColor:h,showCard:f,compact:g||D.offer.compact,classNames:v.card})},D.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:k,children:$.map(_)})};Ji.displayName="OfferCardList";var is=e=>e.type==="checkbox",jt=e=>e instanceof Date,Be=e=>e==null;const el=e=>typeof e=="object";var Se=e=>!Be(e)&&!Array.isArray(e)&&el(e)&&!jt(e),tl=e=>Se(e)&&e.target?is(e.target)?e.target.checked:e.target.value:e,Mm=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,sl=(e,s)=>e.has(Mm(s)),Pm=e=>{const s=e.constructor&&e.constructor.prototype;return Se(s)&&s.hasOwnProperty("isPrototypeOf")},Xn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ne(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Xn&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(Se(e)&&Pm(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=Ne(e[r]));return a}var zs=e=>/^\w*$/.test(e),be=e=>e===void 0,Jn=e=>Array.isArray(e)?e.filter(Boolean):[],ea=e=>Jn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),H=(e,s,n)=>{if(!s||!Se(e))return n;const a=(zs(s)?[s]:ea(s)).reduce((r,i)=>Be(r)?r:r[i],e);return be(a)||a===e?be(e[s])?n:e[s]:a},We=e=>typeof e=="boolean",Te=e=>typeof e=="function",pe=(e,s,n)=>{let a=-1;const r=zs(s)?[s]:ea(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=Se(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const As={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},lt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},nl=x.createContext(null);nl.displayName="HookFormControlContext";const ta=()=>x.useContext(nl);var al=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==et.all&&(s._proxyFormState[o]=!a||et.all),n&&(n[o]=!0),e[o]}});return r};const sa=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Tm(e){const s=ta(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=x.useState(n._formState),d=x.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return sa(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),x.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),x.useMemo(()=>al(o,n,d.current,!1),[o,n])}var qe=e=>typeof e=="string",En=(e,s,n,a,r)=>qe(e)?(a&&s.watch.add(e),H(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),H(n,i))):(a&&(s.watchAll=!0),n),Dn=e=>Be(e)||!el(e);function tt(e,s,n=new WeakSet){if(Dn(e)||Dn(s))return Object.is(e,s);if(jt(e)&&jt(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(jt(o)&&jt(l)||Se(o)&&Se(l)||Array.isArray(o)&&Array.isArray(l)?!tt(o,l,n):!Object.is(o,l))return!1}}return!0}function Im(e){const s=ta(),{control:n=s,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=x.useRef(r),u=x.useRef(l),p=x.useRef(void 0),m=x.useRef(n),h=x.useRef(a);u.current=l;const[f,b]=x.useState(()=>{const w=n._getWatch(a,d.current);return u.current?u.current(w):w}),y=x.useCallback(w=>{const E=En(a,n._names,w||n._formValues,!1,d.current);return u.current?u.current(E):E},[n._formValues,n._names,a]),g=x.useCallback(w=>{if(!i){const E=En(a,n._names,w||n._formValues,!1,d.current);if(u.current){const $=u.current(E);tt($,p.current)||(b($),p.current=$)}else b(E)}},[n._formValues,n._names,i,a]);sa(()=>((m.current!==n||!tt(h.current,a))&&(m.current=n,h.current=a,g()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:w=>{g(w.values)}})),[n,o,a,g]),x.useEffect(()=>n._removeUnmounted());const v=m.current!==n,j=h.current,A=x.useMemo(()=>{if(i)return null;const w=!v&&!tt(j,a);return v||w?y():null},[i,v,a,j,y]);return A!==null?A:f}function Om(e){const s=ta(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=sl(r._names.array,n),u=x.useMemo(()=>H(r._formValues,n,H(r._defaultValues,n,o)),[r,n,o]),p=Im({control:r,name:n,defaultValue:u,exact:l}),m=Tm({control:r,name:n,exact:l}),h=x.useRef(e),f=x.useRef(void 0),b=x.useRef(r.register(n,{...e.rules,value:p,...We(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const y=x.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!H(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!H(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!H(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!H(m.validatingFields,n)},error:{enumerable:!0,get:()=>H(m.errors,n)}}),[m,n]),g=x.useCallback(w=>b.current.onChange({target:{value:tl(w),name:n},type:As.CHANGE}),[n]),v=x.useCallback(()=>b.current.onBlur({target:{value:H(r._formValues,n),name:n},type:As.BLUR}),[n,r._formValues]),j=x.useCallback(w=>{const E=H(r._fields,n);E&&E._f&&w&&(E._f.ref={focus:()=>Te(w.focus)&&w.focus(),select:()=>Te(w.select)&&w.select(),setCustomValidity:$=>Te(w.setCustomValidity)&&w.setCustomValidity($),reportValidity:()=>Te(w.reportValidity)&&w.reportValidity()})},[r._fields,n]),A=x.useMemo(()=>({name:n,value:p,...We(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:g,onBlur:v,ref:j}),[n,a,m.disabled,g,v,j,p]);return x.useEffect(()=>{const w=r._options.shouldUnregister||i,E=f.current;E&&E!==n&&!d&&r.unregister(E),r.register(n,{...h.current.rules,...We(h.current.disabled)?{disabled:h.current.disabled}:{}});const $=(N,C)=>{const k=H(r._fields,N);k&&k._f&&(k._f.mount=C)};if($(n,!0),w){const N=Ne(H(r._options.defaultValues,n,h.current.defaultValue));pe(r._defaultValues,n,N),be(H(r._formValues,n))&&pe(r._formValues,n,N)}return!d&&r.register(n),f.current=n,()=>{(d?w&&!r._state.action:w)?r.unregister(n):$(n,!1)}},[n,r,d,i]),x.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),x.useMemo(()=>({field:A,formState:m,fieldState:y}),[A,m,y])}const zm=x.createContext(null);zm.displayName="HookFormContext";var Bm=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},Xt=e=>Array.isArray(e)?e:[e],nr=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function rl(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&Se(r)&&i){const o=rl(r,i);Se(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Pe=e=>Se(e)&&!Object.keys(e).length,na=e=>e.type==="file",Es=e=>{if(!Xn)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},il=e=>e.type==="select-multiple",aa=e=>e.type==="radio",Vm=e=>aa(e)||is(e),nn=e=>Es(e)&&e.isConnected;function Um(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=be(e)?a++:e[s[a++]];return e}function Hm(e){for(const s in e)if(e.hasOwnProperty(s)&&!be(e[s]))return!1;return!0}function Ce(e,s){const n=Array.isArray(s)?s:zs(s)?[s]:ea(s),a=n.length===1?e:Um(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(Se(a)&&Pe(a)||Array.isArray(a)&&Hm(a))&&Ce(e,n.slice(0,-1)),e}var Wm=e=>{for(const s in e)if(Te(e[s]))return!0;return!1};function ll(e){return Array.isArray(e)||Se(e)&&!Wm(e)}function Ln(e,s={}){for(const n in e){const a=e[n];ll(a)?(s[n]=Array.isArray(a)?[]:{},Ln(a,s[n])):be(a)||(s[n]=!0)}return s}function Lt(e,s,n){n||(n=Ln(s));for(const a in e){const r=e[a];if(ll(r))be(s)||Dn(n[a])?n[a]=Ln(r,Array.isArray(r)?[]:{}):Lt(r,Be(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!tt(r,i)}}return n}const ar={value:!1,isValid:!1},rr={value:!0,isValid:!0};var ol=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?rr:{value:e[0].value,isValid:!0}:rr:ar}return ar},cl=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>be(e)?e:s?e===""?NaN:e&&+e:n&&qe(e)?new Date(e):a?a(e):e;const ir={isValid:!1,value:null};var dl=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,ir):ir;function lr(e){const s=e.ref;return na(s)?s.files:aa(s)?dl(e.refs).value:il(s)?[...s.selectedOptions].map(({value:n})=>n):is(s)?ol(e.refs).value:cl(be(s.value)?e.ref.value:s.value,e)}var qm=(e,s,n,a)=>{const r={};for(const i of e){const o=H(s,i);o&&pe(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},Ds=e=>e instanceof RegExp,Vt=e=>be(e)?e:Ds(e)?e.source:Se(e)?Ds(e.value)?e.value.source:e.value:e,or=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched});const cr="AsyncFunction";var Gm=e=>!!e&&!!e.validate&&!!(Te(e.validate)&&e.validate.constructor.name===cr||Se(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===cr)),Km=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),dr=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Jt=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=H(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(Jt(l,s))break}else if(Se(l)&&Jt(l,s))break}}};function ur(e,s,n){const a=H(e,n);if(a||zs(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=H(s,i),l=H(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:n}}var Ym=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Pe(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||et.all))},Qm=(e,s,n)=>!e||!s||e===s||Xt(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),Zm=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,Xm=(e,s)=>!Jn(H(e,s)).length&&Ce(e,s),Jm=(e,s,n)=>{const a=Xt(H(e,n));return pe(a,"root",s[n]),pe(e,n,a),e};function mr(e,s,n="validate"){if(qe(e)||Array.isArray(e)&&e.every(qe)||We(e)&&!e)return{type:n,message:qe(e)?e:"",ref:s}}var $t=e=>Se(e)&&!Ds(e)?e:{value:e,message:""},fr=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:p,min:m,max:h,pattern:f,validate:b,name:y,valueAsNumber:g,mount:v}=e._f,j=H(n,y);if(!v||s.has(y))return{};const A=l?l[0]:o,w=D=>{r&&A.reportValidity&&(A.setCustomValidity(We(D)?"":D||""),A.reportValidity())},E={},$=aa(o),N=is(o),C=$||N,k=(g||na(o))&&be(o.value)&&be(j)||Es(o)&&o.value===""||j===""||Array.isArray(j)&&!j.length,_=Bm.bind(null,y,a,E),F=(D,P,T,W=lt.maxLength,Y=lt.minLength)=>{const z=D?P:T;E[y]={type:D?W:Y,message:z,ref:o,..._(D?W:Y,z)}};if(i?!Array.isArray(j)||!j.length:d&&(!C&&(k||Be(j))||We(j)&&!j||N&&!ol(l).isValid||$&&!dl(l).isValid)){const{value:D,message:P}=qe(d)?{value:!!d,message:d}:$t(d);if(D&&(E[y]={type:lt.required,message:P,ref:A,..._(lt.required,P)},!a))return w(P),E}if(!k&&(!Be(m)||!Be(h))){let D,P;const T=$t(h),W=$t(m);if(!Be(j)&&!isNaN(j)){const Y=o.valueAsNumber||j&&+j;Be(T.value)||(D=Y>T.value),Be(W.value)||(P=Y<W.value)}else{const Y=o.valueAsDate||new Date(j),z=ae=>new Date(new Date().toDateString()+" "+ae),G=o.type=="time",K=o.type=="week";qe(T.value)&&j&&(D=G?z(j)>z(T.value):K?j>T.value:Y>new Date(T.value)),qe(W.value)&&j&&(P=G?z(j)<z(W.value):K?j<W.value:Y<new Date(W.value))}if((D||P)&&(F(!!D,T.message,W.message,lt.max,lt.min),!a))return w(E[y].message),E}if((u||p)&&!k&&(qe(j)||i&&Array.isArray(j))){const D=$t(u),P=$t(p),T=!Be(D.value)&&j.length>+D.value,W=!Be(P.value)&&j.length<+P.value;if((T||W)&&(F(T,D.message,P.message),!a))return w(E[y].message),E}if(f&&!k&&qe(j)){const{value:D,message:P}=$t(f);if(Ds(D)&&!j.match(D)&&(E[y]={type:lt.pattern,message:P,ref:o,..._(lt.pattern,P)},!a))return w(P),E}if(b){if(Te(b)){const D=await b(j,n),P=mr(D,A);if(P&&(E[y]={...P,..._(lt.validate,P.message)},!a))return w(P.message),E}else if(Se(b)){let D={};for(const P in b){if(!Pe(D)&&!a)break;const T=mr(await b[P](j,n),A,P);T&&(D={...T,..._(P,T.message)},w(T.message),a&&(E[y]=D))}if(!Pe(D)&&(E[y]={ref:A,...D},!a))return E}}return w(!0),E};const ef={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function tf(e={}){let s={...ef,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Te(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=Se(s.defaultValues)||Se(s.values)?Ne(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:Ne(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p};let h={...m};const f={array:nr(),state:nr()},b=s.criteriaMode===et.all,y=S=>L=>{clearTimeout(u),u=setTimeout(S,L)},g=async S=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||h.isValid||S)){let L;s.resolver?(L=Pe((await C()).errors),v()):L=await _(a,!0),L!==n.isValid&&f.state.next({isValid:L})}},v=(S,L)=>{!s.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((S||Array.from(l.mount)).forEach(R=>{R&&(L?pe(n.validatingFields,R,L):Ce(n.validatingFields,R))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Pe(n.validatingFields)}))},j=(S,L=[],R,U,B=!0,I=!0)=>{if(U&&R&&!s.disabled){if(o.action=!0,I&&Array.isArray(H(a,S))){const Z=R(H(a,S),U.argA,U.argB);B&&pe(a,S,Z)}if(I&&Array.isArray(H(n.errors,S))){const Z=R(H(n.errors,S),U.argA,U.argB);B&&pe(n.errors,S,Z),Xm(n.errors,S)}if((m.touchedFields||h.touchedFields)&&I&&Array.isArray(H(n.touchedFields,S))){const Z=R(H(n.touchedFields,S),U.argA,U.argB);B&&pe(n.touchedFields,S,Z)}(m.dirtyFields||h.dirtyFields)&&(n.dirtyFields=Lt(r,i)),f.state.next({name:S,isDirty:D(S,L),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pe(i,S,L)},A=(S,L)=>{pe(n.errors,S,L),f.state.next({errors:n.errors})},w=S=>{n.errors=S,f.state.next({errors:n.errors,isValid:!1})},E=(S,L,R,U)=>{const B=H(a,S);if(B){const I=H(i,S,be(R)?H(r,S):R);be(I)||U&&U.defaultChecked||L?pe(i,S,L?I:lr(B._f)):W(S,I),o.mount&&!o.action&&g()}},$=(S,L,R,U,B)=>{let I=!1,Z=!1;const de={name:S};if(!s.disabled){if(!R||U){(m.isDirty||h.isDirty)&&(Z=n.isDirty,n.isDirty=de.isDirty=D(),I=Z!==de.isDirty);const ue=tt(H(r,S),L);Z=!!H(n.dirtyFields,S),ue?Ce(n.dirtyFields,S):pe(n.dirtyFields,S,!0),de.dirtyFields=n.dirtyFields,I=I||(m.dirtyFields||h.dirtyFields)&&Z!==!ue}if(R){const ue=H(n.touchedFields,S);ue||(pe(n.touchedFields,S,R),de.touchedFields=n.touchedFields,I=I||(m.touchedFields||h.touchedFields)&&ue!==R)}I&&B&&f.state.next(de)}return I?de:{}},N=(S,L,R,U)=>{const B=H(n.errors,S),I=(m.isValid||h.isValid)&&We(L)&&n.isValid!==L;if(s.delayError&&R?(d=y(()=>A(S,R)),d(s.delayError)):(clearTimeout(u),d=null,R?pe(n.errors,S,R):Ce(n.errors,S)),(R?!tt(B,R):B)||!Pe(U)||I){const Z={...U,...I&&We(L)?{isValid:L}:{},errors:n.errors,name:S};n={...n,...Z},f.state.next(Z)}},C=async S=>(v(S,!0),await s.resolver(i,s.context,qm(S||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),k=async S=>{const{errors:L}=await C(S);if(v(S),S)for(const R of S){const U=H(L,R);U?pe(n.errors,R,U):Ce(n.errors,R)}else n.errors=L;return L},_=async(S,L,R={valid:!0})=>{for(const U in S){const B=S[U];if(B){const{_f:I,...Z}=B;if(I){const de=l.array.has(I.name),ue=B._f&&Gm(B._f);ue&&m.validatingFields&&v([I.name],!0);const Re=await fr(B,l.disabled,i,b,s.shouldUseNativeValidation&&!L,de);if(ue&&m.validatingFields&&v([I.name]),Re[I.name]&&(R.valid=!1,L||e.shouldUseNativeValidation))break;!L&&(H(Re,I.name)?de?Jm(n.errors,Re,I.name):pe(n.errors,I.name,Re[I.name]):Ce(n.errors,I.name))}!Pe(Z)&&await _(Z,L,R)}}return R.valid},F=()=>{for(const S of l.unMount){const L=H(a,S);L&&(L._f.refs?L._f.refs.every(R=>!nn(R)):!nn(L._f.ref))&&se(S)}l.unMount=new Set},D=(S,L)=>!s.disabled&&(S&&L&&pe(i,S,L),!tt(Q(),r)),P=(S,L,R)=>En(S,l,{...o.mount?i:be(L)?r:qe(S)?{[S]:L}:L},R,L),T=S=>Jn(H(o.mount?i:r,S,s.shouldUnregister?H(r,S,[]):[])),W=(S,L,R={})=>{const U=H(a,S);let B=L;if(U){const I=U._f;I&&(!I.disabled&&pe(i,S,cl(L,I)),B=Es(I.ref)&&Be(L)?"":L,il(I.ref)?[...I.ref.options].forEach(Z=>Z.selected=B.includes(Z.value)):I.refs?is(I.ref)?I.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(B)?Z.checked=!!B.find(de=>de===Z.value):Z.checked=B===Z.value||!!B)}):I.refs.forEach(Z=>Z.checked=Z.value===B):na(I.ref)?I.ref.value="":(I.ref.value=B,I.ref.type||f.state.next({name:S,values:Ne(i)})))}(R.shouldDirty||R.shouldTouch)&&$(S,B,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&ae(S)},Y=(S,L,R)=>{for(const U in L){if(!L.hasOwnProperty(U))return;const B=L[U],I=S+"."+U,Z=H(a,I);(l.array.has(S)||Se(B)||Z&&!Z._f)&&!jt(B)?Y(I,B,R):W(I,B,R)}},z=(S,L,R={})=>{const U=H(a,S),B=l.array.has(S),I=Ne(L);pe(i,S,I),B?(f.array.next({name:S,values:Ne(i)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&R.shouldDirty&&f.state.next({name:S,dirtyFields:Lt(r,i),isDirty:D(S,I)})):U&&!U._f&&!Be(I)?Y(S,I,R):W(S,I,R),dr(S,l)?f.state.next({...n,name:S,values:Ne(i)}):f.state.next({name:o.mount?S:void 0,values:Ne(i)})},G=async S=>{o.mount=!0;const L=S.target;let R=L.name,U=!0;const B=H(a,R),I=ue=>{U=Number.isNaN(ue)||jt(ue)&&isNaN(ue.getTime())||tt(ue,H(i,R,ue))},Z=or(s.mode),de=or(s.reValidateMode);if(B){let ue,Re;const gt=L.type?lr(B._f):tl(S),ft=S.type===As.BLUR||S.type===As.FOCUS_OUT,Fc=!Km(B._f)&&!s.resolver&&!H(n.errors,R)&&!B._f.deps||Zm(ft,H(n.touchedFields,R),n.isSubmitted,de,Z),qs=dr(R,l,ft);pe(i,R,gt),ft?(!L||!L.readOnly)&&(B._f.onBlur&&B._f.onBlur(S),d&&d(0)):B._f.onChange&&B._f.onChange(S);const Gs=$(R,gt,ft),_c=!Pe(Gs)||qs;if(!ft&&f.state.next({name:R,type:S.type,values:Ne(i)}),Fc)return(m.isValid||h.isValid)&&(s.mode==="onBlur"?ft&&g():ft||g()),_c&&f.state.next({name:R,...qs?{}:Gs});if(!ft&&qs&&f.state.next({...n}),s.resolver){const{errors:$a}=await C([R]);if(v([R]),I(gt),U){const Rc=ur(n.errors,a,R),Aa=ur($a,a,Rc.name||R);ue=Aa.error,R=Aa.name,Re=Pe($a)}}else v([R],!0),ue=(await fr(B,l.disabled,i,b,s.shouldUseNativeValidation))[R],v([R]),I(gt),U&&(ue?Re=!1:(m.isValid||h.isValid)&&(Re=await _(a,!0)));U&&(B._f.deps&&(!Array.isArray(B._f.deps)||B._f.deps.length>0)&&ae(B._f.deps),N(R,Re,ue,Gs))}},K=(S,L)=>{if(H(n.errors,L)&&S.focus)return S.focus(),1},ae=async(S,L={})=>{let R,U;const B=Xt(S);if(s.resolver){const I=await k(be(S)?S:B);R=Pe(I),U=S?!B.some(Z=>H(I,Z)):R}else S?(U=(await Promise.all(B.map(async I=>{const Z=H(a,I);return await _(Z&&Z._f?{[I]:Z}:Z)}))).every(Boolean),!(!U&&!n.isValid)&&g()):U=R=await _(a);return f.state.next({...!qe(S)||(m.isValid||h.isValid)&&R!==n.isValid?{}:{name:S},...s.resolver||!S?{isValid:R}:{},errors:n.errors}),L.shouldFocus&&!U&&Jt(a,K,S?B:l.mount),U},Q=(S,L)=>{let R={...o.mount?i:r};return L&&(R=rl(L.dirtyFields?n.dirtyFields:n.touchedFields,R)),be(S)?R:qe(S)?H(R,S):S.map(U=>H(R,U))},oe=(S,L)=>({invalid:!!H((L||n).errors,S),isDirty:!!H((L||n).dirtyFields,S),error:H((L||n).errors,S),isValidating:!!H(n.validatingFields,S),isTouched:!!H((L||n).touchedFields,S)}),ee=S=>{S&&Xt(S).forEach(L=>Ce(n.errors,L)),f.state.next({errors:S?n.errors:{}})},q=(S,L,R)=>{const U=(H(a,S,{_f:{}})._f||{}).ref,B=H(n.errors,S)||{},{ref:I,message:Z,type:de,...ue}=B;pe(n.errors,S,{...ue,...L,ref:U}),f.state.next({name:S,errors:n.errors,isValid:!1}),R&&R.shouldFocus&&U&&U.focus&&U.focus()},ie=(S,L)=>Te(S)?f.state.subscribe({next:R=>"values"in R&&S(P(void 0,L),R)}):P(S,L,!0),V=S=>f.state.subscribe({next:L=>{Qm(S.name,L.name,S.exact)&&Ym(L,S.formState||m,me,S.reRenderRoot)&&S.callback({values:{...i},...n,...L,defaultValues:r})}}).unsubscribe,te=S=>(o.mount=!0,h={...h,...S.formState},V({...S,formState:{...p,...S.formState}})),se=(S,L={})=>{for(const R of S?Xt(S):l.mount)l.mount.delete(R),l.array.delete(R),L.keepValue||(Ce(a,R),Ce(i,R)),!L.keepError&&Ce(n.errors,R),!L.keepDirty&&Ce(n.dirtyFields,R),!L.keepTouched&&Ce(n.touchedFields,R),!L.keepIsValidating&&Ce(n.validatingFields,R),!s.shouldUnregister&&!L.keepDefaultValue&&Ce(r,R);f.state.next({values:Ne(i)}),f.state.next({...n,...L.keepDirty?{isDirty:D()}:{}}),!L.keepIsValid&&g()},_e=({disabled:S,name:L})=>{if(We(S)&&o.mount||S||l.disabled.has(L)){const B=l.disabled.has(L)!==!!S;S?l.disabled.add(L):l.disabled.delete(L),B&&o.mount&&!o.action&&g()}},X=(S,L={})=>{let R=H(a,S);const U=We(L.disabled)||We(s.disabled);return pe(a,S,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:S}},name:S,mount:!0,...L}}),l.mount.add(S),R?_e({disabled:We(L.disabled)?L.disabled:s.disabled,name:S}):E(S,!0,L.value),{...U?{disabled:L.disabled||s.disabled}:{},...s.progressive?{required:!!L.required,min:Vt(L.min),max:Vt(L.max),minLength:Vt(L.minLength),maxLength:Vt(L.maxLength),pattern:Vt(L.pattern)}:{},name:S,onChange:G,onBlur:G,ref:B=>{if(B){X(S,L),R=H(a,S);const I=be(B.value)&&B.querySelectorAll&&B.querySelectorAll("input,select,textarea")[0]||B,Z=Vm(I),de=R._f.refs||[];if(Z?de.find(ue=>ue===I):I===R._f.ref)return;pe(a,S,{_f:{...R._f,...Z?{refs:[...de.filter(nn),I,...Array.isArray(H(r,S))?[{}]:[]],ref:{type:I.type,name:S}}:{ref:I}}}),E(S,!1,void 0,I)}else R=H(a,S,{}),R._f&&(R._f.mount=!1),(s.shouldUnregister||L.shouldUnregister)&&!(sl(l.array,S)&&o.action)&&l.unMount.add(S)}}},he=()=>s.shouldFocusError&&Jt(a,K,l.mount),nt=S=>{We(S)&&(f.state.next({disabled:S}),Jt(a,(L,R)=>{const U=H(a,R);U&&(L.disabled=U._f.disabled||S,Array.isArray(U._f.refs)&&U._f.refs.forEach(B=>{B.disabled=U._f.disabled||S}))},0,!1))},Ke=(S,L)=>async R=>{let U;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let B=Ne(i);if(f.state.next({isSubmitting:!0}),s.resolver){const{errors:I,values:Z}=await C();v(),n.errors=I,B=Ne(Z)}else await _(a);if(l.disabled.size)for(const I of l.disabled)Ce(B,I);if(Ce(n.errors,"root"),Pe(n.errors)){f.state.next({errors:{}});try{await S(B,R)}catch(I){U=I}}else L&&await L({...n.errors},R),he(),setTimeout(he);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Pe(n.errors)&&!U,submitCount:n.submitCount+1,errors:n.errors}),U)throw U},ve=(S,L={})=>{H(a,S)&&(be(L.defaultValue)?z(S,Ne(H(r,S))):(z(S,L.defaultValue),pe(r,S,Ne(L.defaultValue))),L.keepTouched||Ce(n.touchedFields,S),L.keepDirty||(Ce(n.dirtyFields,S),n.isDirty=L.defaultValue?D(S,Ne(H(r,S))):D()),L.keepError||(Ce(n.errors,S),m.isValid&&g()),f.state.next({...n}))},Ye=(S,L={})=>{const R=S?Ne(S):r,U=Ne(R),B=Pe(S),I=B?r:U;if(L.keepDefaultValues||(r=R),!L.keepValues){if(L.keepDirtyValues){const Z=new Set([...l.mount,...Object.keys(Lt(r,i))]);for(const de of Array.from(Z)){const ue=H(n.dirtyFields,de),Re=H(i,de),gt=H(I,de);ue&&!be(Re)?pe(I,de,Re):!ue&&!be(gt)&&z(de,gt)}}else{if(Xn&&be(S))for(const Z of l.mount){const de=H(a,Z);if(de&&de._f){const ue=Array.isArray(de._f.refs)?de._f.refs[0]:de._f.ref;if(Es(ue)){const Re=ue.closest("form");if(Re){Re.reset();break}}}}if(L.keepFieldsRef)for(const Z of l.mount)z(Z,H(I,Z));else a={}}i=s.shouldUnregister?L.keepDefaultValues?Ne(r):{}:Ne(I),f.array.next({values:{...I}}),f.state.next({values:{...I}})}l={mount:L.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!L.keepIsValid||!!L.keepDirtyValues||!s.shouldUnregister&&!Pe(I),o.watch=!!s.shouldUnregister,o.keepIsValid=!!L.keepIsValid,o.action=!1,L.keepErrors||(n.errors={}),f.state.next({submitCount:L.keepSubmitCount?n.submitCount:0,isDirty:B?!1:L.keepDirty?n.isDirty:!!(L.keepDefaultValues&&!tt(S,r)),isSubmitted:L.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:B?{}:L.keepDirtyValues?L.keepDefaultValues&&i?Lt(r,i):n.dirtyFields:L.keepDefaultValues&&S?Lt(r,S):L.keepDirty?n.dirtyFields:{},touchedFields:L.keepTouched?n.touchedFields:{},errors:L.keepErrors?n.errors:{},isSubmitSuccessful:L.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},mt=(S,L)=>Ye(Te(S)?S(i):S,{...s.resetOptions,...L}),Qe=(S,L={})=>{const R=H(a,S),U=R&&R._f;if(U){const B=U.refs?U.refs[0]:U.ref;B.focus&&setTimeout(()=>{B.focus(),L.shouldSelect&&Te(B.select)&&B.select()})}},me=S=>{n={...n,...S}},at={control:{register:X,unregister:se,getFieldState:oe,handleSubmit:Ke,setError:q,_subscribe:V,_runSchema:C,_updateIsValidating:v,_focusError:he,_getWatch:P,_getDirty:D,_setValid:g,_setFieldArray:j,_setDisabledField:_e,_setErrors:w,_getFieldArray:T,_reset:Ye,_resetDefaultValues:()=>Te(s.defaultValues)&&s.defaultValues().then(S=>{mt(S,s.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:nt,_subjects:f,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(S){o=S},get _defaultValues(){return r},get _names(){return l},set _names(S){l=S},get _formState(){return n},get _options(){return s},set _options(S){s={...s,...S}}},subscribe:te,trigger:ae,register:X,handleSubmit:Ke,watch:ie,setValue:z,getValues:Q,reset:mt,resetField:ve,clearErrors:ee,unregister:se,setError:q,setFocus:Qe,getFieldState:oe};return{...at,formControl:at}}function sf(e={}){const s=x.useRef(void 0),n=x.useRef(void 0),[a,r]=x.useState({isDirty:!1,isValidating:!1,isLoading:Te(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Te(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!Te(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=tf(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,sa(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),x.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),x.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),x.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),x.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),x.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),x.useEffect(()=>{var o;e.values&&!tt(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),x.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=x.useMemo(()=>al(a,i),[i,a]),s.current}function nf(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function af(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function rf(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function lf(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function of(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function ra(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ra();const cf={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},an=()=>({id:ra(),amount:0,glAccount:null,isTaxDeductible:!1}),ul=({distribution:e,defaultDistribution:s,glAccounts:n=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:p=!0,canEditTaxDeductible:m=!0,isDisabled:h=!1,labels:f,classNames:b={},"data-testid":y,control:g,name:v,rules:j})=>{const A={...cf,...f},w=g!==void 0&&v!==void 0,E=sf({defaultValues:{_internal:s||an()}}),$=Om({control:w?g:E.control,name:w?v:"_internal",rules:w?j:void 0}),[N,C]=x.useState(s||an()),k=w?$.field.value??an():e??N,_=w&&!!$.fieldState?.error,F=w&&($.fieldState?.isTouched??!1),D=_||F,P=D&&(!k.amount||k.amount<=0),T=D&&!k.glAccount,[W,Y]=x.useState(k.glAccount?.name||""),z=x.useCallback(q=>{const ie={...k,...q};w&&$.field.onChange(ie),!w&&e===void 0&&C(ie),i?.(ie)},[k,e,i,w,$]),G=x.useCallback(q=>{const ie=q||0;z({amount:ie}),o?.(ie)},[z,o]),K=x.useCallback(q=>{Y(q),r?.(q)},[r]),ae=x.useCallback(q=>{if(q===null){z({glAccount:null}),l?.(null);return}const V=n.find(te=>String(te.id)===String(q))||null;z({glAccount:V}),l?.(V)},[n,z,l]),Q=x.useCallback(()=>{Y(""),z({glAccount:null}),l?.(null)},[z,l]),oe=x.useCallback(q=>{z({isTaxDeductible:q}),d?.(q)},[z,d]),ee=x.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":y||"revenue-distribution-card",className:c.cn(b.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",b.body),children:[t.jsx("div",{className:c.cn("shrink-0",b.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${y||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[A.amount,t.jsx(c.Tooltip,{content:A.amountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:k.amount||void 0,onValueChange:G,labelPlacement:"outside",placeholder:A.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:h,isInvalid:P,errorMessage:P?"Amount is required":void 0,minValue:0,step:.01,className:b.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:A.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",b.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${y||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[A.glAccount,t.jsx(c.Tooltip,{content:A.glAccountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:k.glAccount?.name??W,selectedKey:k.glAccount?.id??null,isDisabled:h,isInvalid:T,errorMessage:T?"GL Account is required":void 0,listboxProps:{emptyContent:a?A.searching:A.noGlAccountsFound},placeholder:A.glAccountPlaceholder,onInputChange:K,onSelectionChange:ae,onClear:Q,className:b.glAccountInput,children:q=>t.jsx(c.AutocompleteItem,{textValue:q.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:q.name}),q.code&&t.jsx("span",{className:"text-xs text-default-400",children:q.code})]})},q.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",b.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${y||"revenue-distribution-card"}-tax-deductible`,isSelected:k.isTaxDeductible,onValueChange:oe,isDisabled:h||!m,className:b.taxDeductibleCheckbox,children:A.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",b.deleteContainer),children:t.jsx(O,{"data-testid":`${y||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:h||!p,onPress:ee,startContent:t.jsx(M,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",b.deleteButton),children:A.deleteButton})})]})})};ul.displayName="RevenueDistributionCard";const ml=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(M,{icon:s,width:n,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};ml.displayName="RevenueDistributionEmpty";const df={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},fl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...df,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};fl.displayName="RevenueDistributionError";const pl=({rows:e=1,showCard:s=!0,classNames:n={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>r(i))})};pl.displayName="RevenueDistributionSkeleton";function ia({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:p}){return t.jsx(as,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[n&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:s.cancel}),t.jsx(O,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:p,children:s.confirm})]})]})})}const uf=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function pr(e){return!e.fund&&Number(e.percentage||0)<=0}function mf({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const ff={title:"Payment assignment",saved:"Saved",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},xl={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},Ut={...xl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},pf={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},xf={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function hf(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const bf=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,gf=e=>e.fund!==null;function yf({assignments:e,funds:s,labels:n,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:p,footer:m,onAssignmentsChange:h,onOpenFundPicker:f,onCloseFundPicker:b,onCollapseChange:y,onSave:g}){const[v,j]=x.useState(null),A=p??v??void 0,w={...ff,...n},E=e.filter(V=>!pr(V)),N=E.filter(gf).length>0,C=x.useMemo(()=>e.filter(V=>!pr(V)).reduce((V,te)=>V+Number(te.percentage||0),0),[e]),k=Math.round(C*100)/100,_=E.some(V=>!V.fund||Number(V.percentage||0)<=0),F=N&&(k!==100||_),D=`${w.totalError} (${w.total} ${Number(C.toFixed(2))}%)`,P=mf({mode:"split",assignments:e}),T=N&&k>=100,[W,Y]=x.useState(!1),[z,G]=x.useState(!1),K=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(hf,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:w.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:w.saved}):null]}),ae=(V,te)=>{h(e.map(se=>se.id===V?{...se,...te}:se))},Q=()=>{T||h([...e,uf()])},oe=V=>{e.length<=1||h(e.filter(te=>te.id!==V))},ee=()=>{if(!r){if(!P){G(!0);return}if(!i){g();return}Y(!0)}},q=()=>{Y(!1),g()},ie=V=>{const te=u??e.find(se=>!se.fund)?.id??e[0]?.id;te&&(h(e.map(se=>se.id===te?{...se,fund:V}:se)),b())};return t.jsxs("div",{ref:j,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!p&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:V=>y?.(!(V==="all"||Array.from(V).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":w.title,title:K,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!N&&t.jsx(c.Alert,{icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:xl,color:"default",variant:"flat",title:w.emptySplit}),N&&t.jsx(vf,{assignments:e,labels:w,total:C,hasTotalError:z&&!P||F,validationMessage:D,onSelectFund:V=>f(V),onRemoveFund:oe,onPercentageChange:(V,te)=>ae(V,{percentage:bf(te)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(O,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(J.Plus,{className:"size-5",strokeWidth:2}),isDisabled:T,onPress:()=>N?Q():f(),children:w.assignSpecificFund}),t.jsx(O,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!P||r,onPress:ee,children:w.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(wf,{funds:s,labels:w,selectedFundIds:e.map(V=>V.fund?.id).filter(Boolean),portalContainer:A,onSelect:ie,onClose:b}),t.jsx(ia,{isOpen:W,labels:{title:w.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:w.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:w.modifyAssignedFundsWarning})]}),cancel:w.modifyAssignedFundsCancel,confirm:w.modifyAssignedFundsConfirm},icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:A,shouldBlockScroll:!1,classNames:xf,onClose:()=>Y(!1),onConfirm:q})]})}function vf({assignments:e,labels:s,total:n,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(O,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(O,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(J.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:p=>l(d.id,Number(p.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:pf})}),e.length>1&&t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(d.id),"aria-label":s.removeFund,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(M,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Ut,base:c.cn(Ut.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Ut.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Ut.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Ut.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function wf({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=x.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const p=o.trim().toLowerCase();return p?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(p):!0});return t.jsx(as,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:o,placeholder:s.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(O,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:s.select})]},u.id))]})]})]})})}function jf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const Nf={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function Cf({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...Nf,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(rn,{label:l.totalAmount,value:d.format(e)}),t.jsx(rn,{label:l.remainingBalance,value:d.format(s)}),t.jsx(rn,{label:l.amountReceived,value:d.format(n)})]})})}function rn({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const kf={monthly:1,quarterly:3,annual:12},hl=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},Sf=(e,s)=>new Date(e,s+1,0).getDate(),$f=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},Af=(e,s)=>{const{year:n,month:a,day:r}=hl(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,Sf(o,l));return new Date(o,l,d)},Ef=(e,s)=>{const{year:n,month:a,day:r}=hl(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function bl(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=kf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?Ef(s.firstInstallmentDate,d*7):Af(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:$f(u),amount:(r+(d===0?i:0))/100}})}function Df(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function Lf(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:Df(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function Ff(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function _f(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const Rf=new Set(["paid","partially_refunded","refunded"]);function Nt(e){return e!==void 0&&Rf.has(e)}const Mf={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Pf=["weekly","monthly","quarterly","annual"],Tf=Array.from({length:31},(e,s)=>s+1),If=["numberOfInstallments","frequency","firstInstallmentDate"],xr=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),Ls=e=>Math.round(e*100)/100,Of=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},Bs=e=>{if(!e)return null;try{return ku(e)}catch{return null}},zf=e=>Bs(e)?.day??1,Bf=(e,s)=>new Date(e,s,0).getDate(),Vf=(e,s)=>{const n=Bs(e);if(!n)return e;const a=Math.min(s,Bf(n.year,n.month));return n.set({day:a}).toString()},hr=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function Uf({mode:e,donationAmount:s,currency:n="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:p=!0,inputs:m=If,startDate:h,firstInstallmentDateOverride:f,labels:b,classNames:y,isSaving:g=!1,showSavedIndicator:v=!1,isModeSwitchDisabled:j=!1,onModeChange:A,onAutomaticSettingsChange:w,onInstallmentsChange:E,onSave:$,onCancel:N}){const[C,k]=x.useState(o),_={...Mf,...b},F=e??C,D=x.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),P=x.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||h||"":h||i.firstInstallmentDate}),[i,m,h]),T=F==="automatic"?_f(bl(s,P),m.includes("firstInstallmentDate")?void 0:f):r,W=x.useMemo(()=>Ls(T.reduce((se,_e)=>se+Number(_e.amount||0),0)),[T]),Y=Math.abs(W-s)>.009,z=Ls(s-W)<=0,G=x.useMemo(()=>Lf(r),[r]),K=F==="manual"&&Ff(G),ae=Y||K,Q=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(J.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),v?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,oe=se=>{se!==F&&(e||k(se),A?.(se),se==="manual"&&r.length===0&&E([xr()]))},ee=(se,_e)=>{const X=r.find(he=>he.id===se);Nt(X?.status)||E(r.map(he=>he.id===se?{...he,..._e}:he))},q=()=>{E([...r,xr()])},ie=se=>{const _e=r.find(X=>X.id===se);Nt(_e?.status)||E(r.filter(X=>X.id!==se))},V=()=>{g||ae||$?.()},te=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.content),children:[p||u||N?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[p?t.jsx(Hf,{mode:F,labels:_,onModeChange:oe,isDisabled:j,className:y?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[N?t.jsx(O,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:g,onPress:N,children:_.cancelEdit}):null,u?t.jsx(O,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:g?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:g,isDisabled:g||ae,onPress:V,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",y?.preview),children:[F==="automatic"&&t.jsx(Wf,{settings:P,inputs:m,labels:_,className:y?.controls,onSettingsChange:w}),T.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?_.emptyAutomatic:_.emptyManual}),T.length>0&&t.jsx(qf,{mode:F,installments:T,rowErrors:G,labels:_,formatter:D,locale:a,onUpdateInstallment:ee,onRemoveInstallment:ie}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(O,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(J.Plus,{className:"size-5",strokeWidth:2}),isDisabled:z,onPress:q,children:_.addInstallment})}),t.jsx(Qf,{total:W,donationAmount:s,hasTotalMismatch:Y,mode:F,installments:T,formatter:D,labels:_,className:y?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",y?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",y?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",y?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:Q,children:te},"installment-schedule")}):te})}function Hf({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function Wf({settings:e,inputs:s,labels:n,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:n.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(st,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:Pf.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(zf(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(st,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Vf(e.firstInstallmentDate,u)})},children:Tf.map(d=>t.jsx(c.SelectItem,{textValue:hr(d),children:hr(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Yn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:Bs(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(M,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function qf({mode:e,installments:s,rowErrors:n,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Of(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const p=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),h=n.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Yn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:Nt(d.status),isInvalid:p||m,errorMessage:p?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:Bs(d.dueDate),onChange:f=>o(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Kf,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:Nt(d.status),isInvalid:h,errorMessage:a.amountGreaterThanZeroError,onAmountChange:f=>o(d.id,{amount:f})})}),t.jsx(Yf,{isDisabled:s.length<=1,isPaid:Nt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Gf=/^\d*(?:[.,]\d{0,2})?$/;function Kf({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=x.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Gf.test(u))return;l(u);const p=Number(u.replace(",","."));i(Ls(Number.isFinite(p)?p:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Yf({isDisabled:e,isPaid:s,label:n,onRemove:a}){const r=t.jsx(O,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||s,onPress:a,"aria-label":n,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Qf({total:e,donationAmount:s,hasTotalMismatch:n,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,p=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(p*100),h=Ls(s-e),f=Math.max(h,0),b=Math.max(-h,0),y=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(p)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}),g=a==="automatic"?`Total: ${i.format(e)}`:b>0?`Exceeds by: ${i.format(b)}`:`${o.remaining}: ${i.format(f)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:g}),title:y})}function Zf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},s))})]})}const br={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",partially_refunded:"bg-lime-50 text-lime-800",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},gl={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",partially_refunded:"Partially refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Xf={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",partiallyRefunded:gl.partially_refunded,refundedAmount:"Refunded",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},Jf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},ep=[];function tp({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=ep,showSavedIndicator:d=!1,labels:u,isSaving:p=!1,onEditInstallments:m,onPayInstallment:h,onDeleteInstallment:f}){const[b,y]=x.useState(null),g={...Xf,...u},[v,j]=x.useState(""),A=new Intl.NumberFormat(n,{style:"currency",currency:s}),w=e.some(k=>yl(k)!==null),E=e.some(k=>k.status==="partially_refunded"),$=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(J.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:g.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:g.saved}):null]}):void 0,N=x.useMemo(()=>{const k=v.trim().toLowerCase();if(!k)return e;const _=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(F=>{const D=F.status??"scheduled";return[ln(F),F.id,F.amount,F.dueDate,Ns(F.dueDate,n),on(F,g.paidOn,n),cn(F,g.refundedAmount,_),D,dn(D,g.partiallyRefunded)].join(" ").toLowerCase().includes(k)})},[n,s,e,v,g.paidOn,g.refundedAmount,g.partiallyRefunded]),C=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:g.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:v,placeholder:g.searchPlaceholder,onChange:k=>j(k.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(O,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(M,{icon:"solar:pen-outline",className:"size-4"}),isLoading:p,onPress:m,children:g.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",N.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((k,_)=>{const F=k.status??"scheduled",D=ln(k),P=on(k,g.paidOn,n),T=cn(k,g.refundedAmount,A);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:D||`PMT-${_+1}`})]}),t.jsx(gr,{status:F,label:dn(F,g.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:g.amount}),t.jsx("p",{className:"font-medium text-foreground",children:A.format(k.amount)}),T?t.jsx("p",{className:"text-xs text-default-500",children:T}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:g.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:Ns(k.dueDate,n)}),P?t.jsx("p",{className:"text-xs text-default-500",children:P}):null]})]}),t.jsx(yr,{status:F,installment:k,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:f})]})},k.id)}),N.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:g.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",N.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:w?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:E?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:g.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:g.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:g.actions})]})}),t.jsxs("tbody",{children:[N.map((k,_)=>{const F=k.status??"scheduled",D=ln(k),P=on(k,g.paidOn,n),T=cn(k,g.refundedAmount,A);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:D||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[A.format(k.amount),T?t.jsx("span",{className:"block text-xs",children:T}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[Ns(k.dueDate,n),P?t.jsx("span",{className:"block text-xs",children:P}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(gr,{status:F,label:dn(F,g.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(yr,{status:F,installment:k,labels:g,portalContainer:b??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:h,onDeleteInstallment:f})})]},k.id)}),N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:g.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:y,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":g.title,title:$,children:C},"installment-table")}):C})}function ln(e){return e.name?.trim()||e.id}function on(e,s,n){return!Nt(e.status)||!e.fulfilledAt?null:`${s} ${Ns(e.fulfilledAt,n)}`}function yl(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function cn(e,s,n){const a=yl(e);return a===null?null:`${s} ${n.format(a)}`}function dn(e,s){return e==="partially_refunded"?s:gl[e]??e}function gr({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",br[e]??br.scheduled),startContent:t.jsx(np,{status:e}),children:s})}function yr({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=Nt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(O,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(M,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(s),children:n.payNow}):null,t.jsx(sp,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function sp({isFulfilled:e,showDelete:s,labels:n,portalContainer:a,onDelete:r}){const[i,o]=x.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(M,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(M,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(ia,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(M,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Jf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function np({status:e}){return e==="paid"?t.jsx(M,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(M,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(M,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(M,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(M,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(M,{icon:"solar:calendar-outline",className:"size-3"})}const ap=/^\d{4}-\d{2}-\d{2}$/;function Ns(e,s){const n=ap.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const rp={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},ip=({cards:e,locale:s,currency:n,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:p,className:m=""})=>{const h=Array.isArray(e)?e:[],[f,b]=x.useState(l),[y,g]=x.useState(o),v={...rp,...r};x.useEffect(()=>{b(l)},[l]);const j=w=>{if(w===f){d&&p?.(w);return}b(w),p?.(w)},A=w=>{g(w),u?.(w)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:v.title}),i&&t.jsx(Cl,{title:v.renewalTitle,description:v.renewalDescription,value:y,onValueChange:A}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:h.map(w=>t.jsx(vl,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:s,currency:n,isSelected:f===w.id,onSelect:j},w.id))})]})},vl=({itemKey:e,name:s,type:n,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:p=!1,disabledReason:m,statusLabel:h,statusTone:f="default",className:b=""})=>{const y=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),g=!!d&&!p,v=m||h,j=()=>{g&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:j,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",p?"opacity-60":"",u?"rounded-2xl":"",b),"data-testid":"item-card","data-selected":l,isDisabled:p,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),n&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:n})}),v&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:v})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:y})]})})},vr="w-full bg-gray-100",wr={variant:"light",color:"default"},wl=({id:e,title:s,media:n,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:p,onPress:m,isPressable:h=!1,isDisabled:f=!1,compact:b=!1,className:y="",bodyClassName:g="",footerClassName:v="",dataTestId:j})=>{const A=!!(d&&d.value),w=!!u?.label,E=h&&!!m&&!w,$=!E,N=w?{variant:u?.variant??wr.variant,color:u?.color??wr.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(M,{icon:u.icon,width:16}):void 0}:null,C=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,vr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,vr,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(M,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":j||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",y),isPressable:E,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:C}),t.jsxs(c.CardBody,{className:c.cn("gap-3",b?"p-3":"p-4",g),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",b?"text-sm":""),children:s}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((k,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(M,{icon:k.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:k.label})]},`${k.label}-${_}`))}):null,(A||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",b?"pt-0.5":"",v),children:[A?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",b?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),w&&$?t.jsx(O,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:N?.variant,color:N?.color,size:N?.size,startContent:N?.startContent,isDisabled:N?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),p?t.jsx("div",{className:"pt-1",children:p}):null]})]})};wl.displayName="CatalogItemCard";const lp={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function jl({title:e,subtitle:s,price:n,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(M,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:lp[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}jl.displayName="ProgramListItem";const op={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},cp={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},dp={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},up={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},mp={card:"mt-1",panel:"mt-[22px]"},fp="bg-acct-page border-acct-border text-acct-muted",pp={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},xp={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},hp={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},bp={empty:"status",error:"alert",success:"status",loading:"status"},gp={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function yp(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(x.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:pp[e];return r?t.jsx(M,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function Tt({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=bp[e],ariaLive:d=gp[e],iconSize:u=24,className:p,classNames:m={},"data-testid":h="feedback-state"}){const f=yp(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":h,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",op[s],s==="card"?xp[e]:"bg-transparent",p,m.base),children:[f?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn("inline-flex items-center justify-center",cp[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?fp:hp[e],m.iconWrapper),children:f}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${h}-title`,className:c.cn(dp[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(up[s],m.description),children:r}):null]}),o?t.jsx("div",{"data-testid":`${h}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",mp[s],m.actions),children:o}):null]})}function la(e){return t.jsx(Tt,{...e,variant:"empty"})}function oa(e){return t.jsx(Tt,{...e,variant:"error"})}function ca(e){return t.jsx(Tt,{...e,variant:"loading"})}function Nl(e){return t.jsx(Tt,{...e,variant:"success"})}Tt.displayName="FeedbackState";la.displayName="EmptyState";oa.displayName="ErrorState";ca.displayName="LoadingState";Nl.displayName="SuccessState";const Cl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=x.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},vp={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},wp=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),kl=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),jp=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),da=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),jr=(e,s,n)=>{const a={};let r=n?s??jp(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of da(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},Nr=(e,s,n)=>`${e}::${s}::${n}`,Np=(e,s,n)=>{const a=kl(s);for(const{exhibition:r,dateGroup:i,ticket:o}of da(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},Cp=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=x.useState(()=>String(i)),[d,u]=x.useState(!1),p=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},h=()=>{r||i<=s||a?.(i-1)},f=w=>{if(r)return;l(w.target.value);const E=parseInt(w.target.value,10);isNaN(E)||a?.(Math.max(s,Math.min(n,E)))},b=w=>{const E=parseInt(w.target.value,10);if(u(!1),isNaN(E)){a?.(s);return}const $=Math.max(s,Math.min(n,E));$!==E?a?.($):l(String($))},y=i<=s,g=i>=n,v="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",j="bg-primary hover:bg-primary/80",A="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:h,disabled:r||y,className:c.cn(v,r||y?A:j),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:p,onChange:f,onFocus:()=>u(!0),onBlur:b,disabled:r,min:s,max:n,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||g,className:c.cn(v,r||g?A:j),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},kp=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},Sp=({item:e,quantity:s,onChange:n,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",p=wp(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:p.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:p.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(Cp,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},$p=({exhibitionId:e,dateGroup:s,isLast:n=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!n&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,p)=>t.jsxs("div",{children:[t.jsx(Sp,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),p<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),Ap=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,p]=x.useState(d),m=s.dates.reduce((f,b)=>f+b.tickets.reduce((y,g)=>y+a(s.id,b.id,g.id),0),0),h=s.dates.some(f=>f.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>p(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(M,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:h?s.dates.map((f,b)=>t.jsx($p,{exhibitionId:s.id,dateGroup:f,isLast:b===s.dates.length-1,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},f.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Ep=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=x.useMemo(()=>r??[],[r]),d={...vp,...n},[u,p]=x.useState(()=>jr(l,s,!0)),m=x.useRef(!1),h=x.useMemo(()=>{const j=da(l).map(({exhibition:A,dateGroup:w,ticket:E})=>[Nr(A.id,w.id,E.id),E]);return new Map(j)},[l]),f=Np(l,u,s),b=(j,A,w)=>u[j]?.[A]?.[w]?.selectedQuantity??0,y=()=>kl(u),g=(j,A,w,E)=>{const $=b(j,A,w),N=y()-$;if(s!==void 0&&N+E>s)return;const C=h.get(Nr(j,A,w));if(!C)return;const k={...u,[j]:{...u[j],[A]:{...u[j]?.[A],[w]:{id:w,selectedQuantity:E,originalPrice:C.originalPrice,discountedPrice:C.price}}}};p(k),o?.(k)},v=j=>{const A=jr(l,s,j);p(A),o?.(A)};return x.useEffect(()=>{!m.current&&f&&(o?.(u),m.current=!0)},[f,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(kp,{label:d.selectAllButtonLabel,checked:f,onChange:v})]}),l.map(j=>t.jsx(Ap,{title:j.exhibitionName,exhibition:j,onQuantityChange:g,getTicketQuantity:b,getTotalSelectedTickets:y,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},j.id))]})},un={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},mn=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},Dp=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},Lp=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,Sl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:p,onClear:m,appliedCount:h,countAriaLabel:f,countDisplay:b="badge",confirmLabel:y=un.confirm,clearLabel:g=un.clear,isOpen:v,defaultOpen:j=!1,onOpenChange:A,isDisabled:w=!1,closeOnConfirm:E=!0,keepOpenAfterClear:$=!1})=>{const[N,C]=x.useState(j),[k,_]=x.useState(()=>mn(u)),F=v??N,D=h??u.filter(Q=>Lp(Q)).length,P=Q=>{Q&&_(mn(u)),v||C(Q),A?.(Q)},T=(Q,oe)=>{_(ee=>({...ee,[Q.id]:oe}))},W=(Q,oe)=>{_(ee=>({...ee,[Q.id]:oe?[oe]:[]}))},Y=async()=>{_(mn(u.map(Q=>Q.type==="checkbox"?{...Q,selectedValues:[]}:{...Q,selectedValue:null}))),await m(),$||P(!1)},z=async()=>{const Q=Dp(k,u);await p(Q),E&&P(!1)},G=Q=>{if(Q.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Q.label,value:k[Q.id]??[],onValueChange:ee=>T(Q,ee),children:Q.options.map(ee=>t.jsx(c.Checkbox,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Q.id);const oe=k[Q.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Q.label,value:oe,onValueChange:ee=>W(Q,ee||null),children:Q.options.map(ee=>t.jsx(c.Radio,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Q.id)},K=x.useMemo(()=>D>0?f?.(D)||`${D} filters applied`:void 0,[f,D]),ae=x.useMemo(()=>D===0?e||un.noLabel:f?f(D):`${e} (${D})`,[D,e,f]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:P,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(O,{isDisabled:w,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(M,{icon:n,width:16}),t.jsx("span",{children:e}),b==="badge"&&D>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":K,children:D}):b==="summary"&&ae!==e?t.jsx("span",{className:"text-xs",children:ae}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Q=>G(Q)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(O,{variant:"light",color:"default",size:"sm",onPress:Y,children:g}),t.jsx(O,{color:"primary",size:"sm",onPress:z,children:y})]})]})})]})})};Sl.displayName="FilterPopover";const Fp="No sessions available for this date",_p=e=>e==="sold-out"||e==="closed"?"danger":"success",Rp=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},Cr=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Mp=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,$l=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Fp,statusLabel:u,statusTone:p,sessionAriaLabel:m,dayButtonClassName:h,calendarSlot:f,dayGroupAriaLabel:b,sessionGridAriaLabel:y,className:g,headingClassName:v,subheadingClassName:j})=>{const A=Mp(n,a),w=n.find(k=>k.date===A),E=i??n.map(k=>({date:k.date,label:k.label})),$=w?.sessions??[],N=k=>k===A?"solid":"bordered",C=k=>{if(!Cr(k)){if(k.id===o){l(null);return}l(k.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",g),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",v),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",j),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":b||"Session days",children:[E.map(k=>t.jsx(O,{size:"sm",variant:N(k.date),color:"default",className:c.cn("rounded-full",h),isDisabled:k.isDisabled,onPress:()=>{r(k.date)},children:t.jsx("span",{children:k.label})},k.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":y||"Sessions",children:[$.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,$.map(k=>{const _=Cr(k),F=k.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{C(k)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(k,{isSelected:F,isUnavailable:_}):_?`${k.startTime} ${k.endTime} sold out`:`${k.startTime} ${k.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[k.startTime," – ",k.endTime]}),t.jsx(c.Chip,{size:"sm",color:p?p(k):_p(k.status),variant:"flat",children:u?u(k):Rp(k)})]})})},k.id)})]})]})};$l.displayName="SessionTimeline";const Fn=16,dt=e=>`${e/Fn}rem`;function Pp(){if(typeof document>"u"||typeof getComputedStyle!="function")return Fn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Fn}const ls=(e,s)=>e>=s*Pp(),Tp=1120;function It(){const e=x.useRef(null),[s,n]=x.useState(0),[,a]=x.useState("");return x.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),x.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:s}}const Ip=48,Ze={base:"flex items-start gap-4",baseWide:"mb-5 flex-nowrap",baseNarrow:"mb-[0.875rem] flex-wrap",identity:"flex min-w-0 items-center gap-4",text:"min-w-0",titleWide:"text-[1.6875rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",titleNarrow:"text-[1.375rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",subtitleWide:"mt-[0.4375rem] max-w-[47.5rem] text-[0.875rem] leading-[1.55] text-default-500",subtitleNarrow:"mt-[0.4375rem] max-w-[47.5rem] text-[0.84375rem] leading-[1.55] text-default-500",actionsWide:"ml-auto flex shrink-0 items-center gap-2.5",actionsNarrow:"flex shrink-0 items-center gap-2.5"},Op=(e,s)=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,Al=({title:e,subtitle:s,eyebrow:n,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:p,narrow:m,headerRef:h})=>{const f=Op(a,r);return t.jsxs("header",{ref:h,"data-testid":u,"data-variant":p?"list":void 0,"data-size":p?m?"narrow":"wide":void 0,className:c.cn(p?c.cn(Ze.base,m?Ze.baseNarrow:Ze.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:p?Ze.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{className:p?Ze.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(p?m?Ze.titleNarrow:Ze.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(p?m?Ze.subtitleNarrow:Ze.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(p?m?Ze.actionsNarrow:Ze.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},zp=e=>{const{ref:s,width:n}=It(),a=n>0&&!ls(n,Ip);return t.jsx(Al,{...e,list:!0,narrow:a,headerRef:s})},El=e=>e.variant==="list"?t.jsx(zp,{...e}):t.jsx(Al,{...e,list:!1,narrow:!1});El.displayName="PageHeader";const Ge={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function os(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const Bp={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},_n={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"},info:Ge.info,violet:Ge.violet},Vp={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Up={sm:"px-[0.5625rem] py-[0.1875rem] text-[0.75rem]",md:"px-3 py-[0.3125rem] text-[0.8125rem]",lg:"px-3 py-[0.3125rem] text-[0.8125rem]"},Hp={info:_n.info,violet:_n.violet},Dl=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Ge[Vp[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Up[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=_n[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:Hp[e];return t.jsx(c.Chip,{color:r??Bp[e],variant:n,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};Dl.displayName="StatusChip";const Wp={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},fs={base:"inline-flex items-baseline gap-1 whitespace-nowrap rounded-[0.4375rem] border border-pos-hair bg-default-100",sm:"px-2 py-0.5 text-[0.75rem] leading-[1.5]",md:"px-2.5 py-1 text-[0.8125rem] leading-[1.5]",label:"font-normal text-default-600",value:"font-semibold text-default-900"},Vs=({label:e,value:s,size:n="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(fs.base,fs[n],r),children:[t.jsx("span",{className:fs.label,children:e}),t.jsx("span",{className:fs.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Wp[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Vs.displayName="KeyValueChip";const Ll=({columns:e,rows:s=6,label:n="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,p)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,h)=>{const f=h===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:c.cn(js,l.bar),style:{height:dt(a),width:m==="fill"?"60%":dt(m),maxWidth:"100%"}})},h)})},p):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,h)=>{const f=h===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:m==="fill"?"60%":m}})},h)})},p))})]});Ll.displayName="TableSkeleton";const Fl="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",_l="px-4 text-[13.5px] text-acct-ink2 align-middle",Rl="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Ml="w-full",Pl="border-t border-acct-border px-5 py-3.5",ps={base:"overflow-x-auto",th:"h-auto whitespace-nowrap border-b border-pos-hair bg-transparent px-4 py-[0.875rem] text-left text-[0.6875rem] font-semibold uppercase leading-[1.5] tracking-[.055em] text-default-500 first:rounded-none last:rounded-none last:pr-3",tr:`border-t border-pos-hair transition-colors duration-[120ms] first:border-t-0 data-[focus-visible=true]:outline-offset-[-2px] [tbody>&]:hover:bg-default-50 [tbody>&]:data-[hover=true]:bg-default-50 ${je}`,td:"h-[3.875rem] px-4 data-[focus-visible=true]:outline-offset-[-2px] py-[0.625rem] align-middle text-[0.875rem] text-default-900 last:pr-3"},Tl=({columns:e,children:s,emptyContent:n,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&ps.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(Qn,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Ml,l.table),th:c.cn(u?ps.th:Fl,l.th),tr:c.cn(u?ps.tr:Rl,l.tr),td:c.cn(u?ps.td:_l,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:p=>t.jsx(c.TableColumn,{align:p.align==="right"?"end":"start",width:p.width,children:p.label},p.key)}),t.jsx(c.TableBody,{emptyContent:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&Pl,l.footer),children:a}):null]})};Tl.displayName="AdminTable";const Ht={base:"flex flex-wrap items-center gap-3 mb-4",trailing:"ml-auto",icon:"flex text-acct-muted",inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"},qp={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},Gp=48,rt={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[data-slot=filter-select-group]]:flex [&_[data-slot=filter-select-group]]:flex-wrap [&_[data-slot=filter-select-group]]:!max-w-none [&_[data-slot=filter-select]]:!max-w-none [&_[data-slot=filter-select]]:!min-w-[calc(50%-0.3125rem)] [&_[data-slot=filter-select]]:grow [&_[data-slot=filter-select]]:basis-[calc(50%-0.3125rem)]",searchWide:"ml-auto",searchFill:"min-w-[12.5rem] flex-1",searchNarrow:"basis-full",inputBaseNarrow:"w-full",inputWrapper:"h-[2.375rem] min-h-[2.375rem] !h-[2.375rem] rounded-[0.625rem] border border-pos-field bg-white pl-3 pr-3 shadow-none data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary",innerWrapper:"gap-[0.3125rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0.5",icon:"flex text-default-400 [&_svg]:size-4"},kr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},Fs={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},Sr={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},$r={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Il=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const p=x.useRef(null),m=o==="lg",h=r&&e!==""?t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),p.current?.focus()},className:c.cn(Sr.button,$r[o].button),testId:`${l}-search-clear`,children:t.jsx(M,{icon:"lucide:x","aria-hidden":"true",className:$r[o].icon})}):void 0;return t.jsx(c.Input,{ref:p,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:h,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&Fs.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&Fs.input,r&&Sr.input)}})},Kp=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:p,className:m,"data-testid":h="admin-toolbar"})=>{const{ref:f,width:b}=It(),y=b>0&&!ls(b,Gp),g=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":h,"data-variant":"framed","data-size":y?"narrow":"wide",className:c.cn(rt.base,y&&rt.narrow,m),children:[l,t.jsx("div",{"data-testid":`${h}-search-slot`,className:g?rt.searchFill:y?rt.searchNarrow:rt.searchWide,children:t.jsx(Il,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:h,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-search-icon`,className:c.cn(rt.icon,p==="lg"&&Fs.icon),children:r??t.jsx(M,{icon:"lucide:search"})}),classNames:{base:g?kr.fill:y?rt.inputBaseNarrow:kr[u],inputWrapper:rt.inputWrapper,innerWrapper:rt.innerWrapper,input:rt.input}})}),d]})},Ol=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:p="md",variant:m="default",className:h,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(Kp,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:p,className:h,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn(Ht.base,h),children:[t.jsx(Il,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:p,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Ht.icon,p==="lg"&&Fs.icon),children:r}):void 0,classNames:{base:qp[u],inputWrapper:Ht.inputWrapper,input:Ht.input}}),l,d?t.jsx("div",{className:Ht.trailing,children:d}):null]});Ol.displayName="AdminToolbar";const Yp="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",Qp="ml-0.5 inline-flex min-w-[1.125rem] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",Zp="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",zl=x.forwardRef(function({icon:s,children:n,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(O,{ref:d,"data-testid":o,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(M,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Qp,children:a})]}):t.jsxs(O,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(Zp,i),...l,children:[t.jsx(M,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Yp,children:a})]})});zl.displayName="ToolbarButton";const Ar="w-full mb-4 border-b border-pos-line",Er=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",je].join(" "),Xp={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${je}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${je}`},"sm-primary":{base:Ar,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${Er} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${je}`},"sm-secondary":{base:Ar,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${Er} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${je}`}},Jp="data-[animated=true]:transition-none";function Bl({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",className:o,"data-testid":l="underline-tabs"}){const d=rs(),u=r==="sm",p=Xp[u?`sm-${i}`:"md"],m=e.filter(h=>h.isDisabled).map(h=>h.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:h=>n(String(h)),disabledKeys:m,disableCursorAnimation:u,"data-testid":l,"data-size":r,classNames:{...p,base:c.cn(p.base,o),cursor:c.cn(p.cursor,d&&Jp),panel:"p-0"},children:e.map(h=>t.jsx(c.Tab,{title:h.label,titleValue:h.hint,"data-testid":`${l}-${h.key}`,children:h.content},h.key))})}Bl.displayName="UnderlineTabs";const ua="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",ma="font-normal normal-case tracking-normal",Vl=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),Ul="text-[13.5px] text-acct-ink",Hl="bg-acct-page text-acct-muted cursor-default",Wl="mt-[5px] text-xs text-acct-sub",ql="mt-[5px] text-xs text-acct-danger",Gl=({children:e,suffix:s,className:n,"data-testid":a="admin-field-label"})=>t.jsxs("div",{"data-testid":a,className:c.cn(ua,n),children:[e,s?t.jsxs("span",{className:ma,children:[" ",s]}):null]});Gl.displayName="AdminFieldLabel";const Kl=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:p=!1,className:m,"data-testid":h="admin-text-field"})=>t.jsx(c.Input,{labelPlacement:e?"outside":void 0,label:e&&s?t.jsxs(t.Fragment,{children:[e,t.jsxs("span",{className:ma,children:[" ",s]})]}):e,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:p,description:!p&&u?u:void 0,errorMessage:p?u:void 0,onValueChange:a,"data-testid":h,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",m),label:ua,inputWrapper:Vl,input:c.cn(Ul,(l||o)&&"font-mono",o&&Hl),description:Wl,errorMessage:ql}});Kl.displayName="AdminTextField";const ex={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Yl=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",ex[s]),children:r.icon},r.key))});Yl.displayName="RowActions";const Ql=({children:e,placeholder:s="Select…",onOpen:n,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":p="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":p,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(O,{variant:"light",radius:"none",disableAnimation:!0,onPress:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${p}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${p}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Ql.displayName="PickerRow";const Ve={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},tx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},sx={plain:{row:"rounded-xl px-2",hover:"hover:bg-default-100",overlay:"after:rounded-xl"},bordered:{row:"rounded-lg border border-default-200 bg-white px-3",hover:"hover:bg-default-50",overlay:"after:rounded-lg"}},Zl={md:{row:"min-h-12",content:"py-1",title:"text-sm leading-6",subtitle:"text-xs leading-4",avatar:"sm",control:"md"},lg:{row:"min-h-14",content:"py-1.5",title:"text-base leading-6",subtitle:"text-sm leading-5",avatar:"md",control:"lg"}},nx={md:void 0,lg:"min-h-12 text-base"},ax={none:"",sm:"gap-1",md:"gap-2"},Xl="m-0 flex list-none flex-col p-0",At={row:"flex items-center gap-3 px-2",avatar:{md:"size-8 shrink-0 rounded-full",lg:"size-10 shrink-0 rounded-full"},lines:"flex flex-col gap-2",title:"h-4 rounded-md",subtitle:"h-3 w-44 rounded-md",titleWidths:["w-32","w-28","w-36","w-24","w-40","w-28"]},Jl=x.createContext(!1),rx=()=>t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:t.jsx("path",{d:"m9 5 7 7-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),ix=()=>t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"})]});function lx(e){const s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}function ne(e){return e!=null&&e!==!1&&e!==""}const eo=({title:e,subtitle:s,leading:n,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:p,actions:m,actionsLabel:h,actionsIcon:f,size:b,variant:y="plain",isDisabled:g=!1,as:v,className:j,"data-testid":A="entity-row"})=>{const w=x.useContext(Jl),E=Ms(),$=b??(E==="touch"?"lg":"md"),N=Zl[$],C=sx[y],k=v??(w?"li":"div"),_=x.useId(),F=x.useId(),D=x.useId(),P=i!==void 0||r!==void 0,T=a!==void 0&&a.length>0,W=ne(s),Y=m!==void 0&&m.length>0,z=typeof e=="string"?e:void 0,G=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:N.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??z,getInitials:n.initials!==void 0?q=>q:lx,showFallback:n.src!==void 0,classNames:{base:Ve.avatar},"data-testid":`${A}-leading`}):null,K=t.jsxs(t.Fragment,{children:[G,t.jsxs("span",{className:Ve.text,children:[t.jsxs("span",{className:Ve.titleLine,children:[t.jsx("span",{id:_,className:c.cn(Ve.title,N.title),title:z,children:e}),T&&t.jsx("span",{id:F,className:Ve.tags,children:a.map(q=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:q.tone??"default",className:tx[q.tone??"default"],"data-testid":`${A}-tag-${q.key}`,children:q.label},q.key))})]}),W&&t.jsx("span",{id:D,className:c.cn(Ve.subtitle,N.subtitle),children:s})]})]}),ae=[T?F:null,W?D:null].filter(Boolean).join(" "),Q={"aria-labelledby":_,"aria-describedby":ae===""?void 0:ae,isDisabled:g,className:c.cn(Ve.pressTarget,C.overlay,N.content)},oe=`${A}-trigger`;let ee;return i!==void 0?ee=t.jsx(c.Link,{...Q,"data-testid":oe,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:K}):r!==void 0?ee=t.jsx(O,{...Q,testId:oe,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:K}):ee=t.jsx("div",{className:c.cn(Ve.content,N.content),children:K}),t.jsxs(k,{"data-testid":A,"data-size":$,"data-disabled":g||void 0,className:c.cn(Ve.base,C.row,N.row,P&&!g&&C.hover,j),children:[ee,(ne(d)||Y)&&t.jsxs("div",{className:Ve.side,children:[d,Y&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(O,{isIconOnly:!0,size:N.control,variant:"light",color:"default",radius:"full",isDisabled:g,"aria-label":h,testId:`${A}-menu-trigger`,className:Ve.menuTrigger,children:f??t.jsx(ix,{})})}),t.jsx(c.DropdownMenu,{"aria-label":h,"data-testid":`${A}-menu`,disabledKeys:m.filter(q=>q.isDisabled).map(q=>q.key),onAction:q=>{m.find(ie=>ie.key===q)?.onAction()},items:m,children:q=>t.jsx(c.DropdownItem,{textValue:q.label,color:q.tone==="danger"?"danger":"default",className:c.cn(q.tone==="danger"&&Ve.dangerItem,nx[$]),startContent:q.icon,"data-testid":q["data-testid"]??`${A}-menu-${q.key}`,children:q.label},q.key)})]})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Ve.chevron,"data-testid":`${A}-chevron`,children:p??t.jsx(rx,{})})]})};eo.displayName="EntityRow";const to=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(Xl,ax[a],r),children:t.jsx(Jl.Provider,{value:!0,children:e})});to.displayName="EntityList";const so=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Ms(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=At;return t.jsxs("div",{"data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:Xl,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(At.row,Zl[o].row),children:[t.jsx(c.Skeleton,{className:At.avatar[o]}),t.jsxs("span",{className:At.lines,children:[t.jsx(c.Skeleton,{className:c.cn(At.title,l[u%l.length])}),t.jsx(c.Skeleton,{className:At.subtitle})]})]},u))})]})};so.displayName="EntityListSkeleton";function no(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const ao=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:p}=no(e,s,n),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:p,total:n}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${p}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};ao.displayName="PaginationSummary";const Us="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",ot={base:"overflow-hidden rounded-2xl border border-pos-line bg-white",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",icon:"flex shrink-0 text-default-500 [&_svg]:size-[1.125rem]",action:"ml-auto",description:"m-0 text-[0.84375rem] leading-[1.55] text-default-500 [&_b]:font-bold [&_b]:tabular-nums [&_b]:text-default-900",footer:"flex flex-wrap gap-2",footerAfterContent:"mt-[0.875rem]",footerAfterDescription:"mt-3"},ox={card:Us,flat:""},cx={section:"flex flex-wrap items-center gap-2 px-5 pt-4",aside:"flex flex-wrap items-center gap-[0.5625rem] px-[1.125rem] pt-[0.9375rem]"},dx={section:{padded:"px-5 pb-[1.125rem] pt-[0.875rem]",rows:"px-5 pb-[1.125rem] pt-2.5",flush:"pt-3",none:""},aside:{padded:"px-[1.125rem] pb-[1.125rem] pt-3",rows:"px-[1.125rem] pb-[1.125rem] pt-3",flush:"pt-3",none:""}},ro=({isLoading:e=!1,isError:s=!1,isEmpty:n=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:p,emptyTitle:m="Nothing here yet",emptyDescription:h,emptyIcon:f,emptyActions:b,emptyContent:y,children:g,toolbar:v,variant:j="default",className:A,classNames:w={},"data-testid":E="list-panel"})=>{const $=j==="framed",N={base:c.cn("border-0 bg-transparent py-12",w.state)},C=$?{base:c.cn("px-6 py-[3.625rem]",w.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:N;let k;return e?k=r??t.jsx(ca,{title:a,classNames:N,"data-testid":`${E}-loading`}):s?k=p??t.jsx(oa,{title:i,description:o,classNames:N,"data-testid":`${E}-error`,actions:u??(d?t.jsx(O,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?k=y??t.jsx(la,{surface:$?"panel":void 0,title:m,description:h,icon:f,actions:b,classNames:C,"data-testid":`${E}-empty`}):k=g,t.jsxs("section",{"data-testid":E,"data-variant":$?"framed":void 0,className:c.cn($?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`:"rounded-xl bg-white p-2 shadow-sm",A,w.base),children:[v,k]})};ro.displayName="ListPanel";const fa=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),ns=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},io=(e,s)=>{const[n,a]=x.useState(()=>s(e)),r=(ns(n)??0)===(e??0)?n:s(e),i=x.useCallback(()=>{a(o=>{const l=ns(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},ux=/^[\d.,]+$/,lo=(e,s=Object.is)=>{const n=x.useRef(e),a=x.useRef(null);x.useLayoutEffect(()=>{n.current=e},[e]);const r=x.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=x.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=x.useCallback(()=>{a.current=null},[]);return x.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},oo=(e,s)=>{const n=x.useRef(null),a=x.useRef(s);return x.useLayoutEffect(()=>{a.current=s},[s]),x.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&ux.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),n},mx=350,fx={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}",exactAmountLabel:"Exact",exactAmountAriaTemplate:"Exact amount {amount}",quickAmountsLabel:"Quick cash amounts",quickAmountAriaTemplate:"Add {amount}"},px=7,xx=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,px),hx=(e,s,n)=>{if(!Number.isInteger(e))return fe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return fe(e,s,n)}},bx=(e,s)=>(e??0)===(s??0),Wt=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),gx=({dueAmount:e,received:s,defaultReceived:n=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:p=!1,className:m,"data-testid":h="cash-tender-form"})=>{const f={...fx,...i},b=Pt(e.currency,r),y=s!==void 0,[g,v]=x.useState(n??null),j=y?s:g,{draft:A,setDraft:w,normalize:E}=io(j,V=>V==null?"":String(V)),{isUntouched:$,markEdited:N,markUntouched:C}=lo(j,bx),k=x.useMemo(()=>{const V=typeof j=="number"&&Number.isFinite(j)?j:0,te=Sn(V,e.value,e.currency,r);return{received:V,change:te>0?te:0,isValid:V>=e.value&&V>0}},[j,e.value,e.currency,r]),_=x.useCallback(V=>{const te=V.currentTarget;requestAnimationFrame(()=>{te.isConnected&&te.select()})},[]),F=x.useCallback(V=>{y||v(V);const te=typeof V=="number"&&Number.isFinite(V)?V:0,se=Sn(te,e.value,e.currency,r);a?.({received:te,change:se>0?se:0,isValid:te>=e.value&&te>0})},[y,e.value,e.currency,r,a]),D=x.useCallback(V=>{if(o)return;const te=V.replace(/[^\d.,]/g,"");if(!fa(te,b))return;const se=ns(te);se!==null&&l!==void 0&&se>l||(w(te),N(se),F(se))},[o,l,w,N,b,F]),P=oo($,D),T=x.useMemo(()=>xx(d),[d]),W=V=>l!==void 0&&V>l,Y=()=>{o||W(e.value)||(w(String(e.value)),C(),F(e.value))},z=V=>{if(o)return;const te=$()||typeof j!="number"||!Number.isFinite(j)?0:j,se=Zn(te+V,e.currency,r);W(se)||(w(String(se)),N(se),F(se))},G=k.isValid&&k.change>0,K=!k.isValid&&k.received>0,ae=fe(k.change,r,e.currency),Q=fe(e.value,r,e.currency),[oe,ee]=x.useState(""),q=x.useRef(null);x.useEffect(()=>{q.current&&clearTimeout(q.current);const V=G?Wt(f.changeMessageTemplate,{change:ae}):"",te=G?mx:0;return q.current=setTimeout(()=>ee(V),te),()=>{q.current&&clearTimeout(q.current)}},[G,ae,f.changeMessageTemplate]);const ie=`${h}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":h,children:[t.jsx(c.Input,{ref:P,id:ie,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:b===0?"numeric":"decimal",pattern:b===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:A,onChange:V=>D(V.target.value),onFocus:_,onBlur:E,placeholder:f.receivedPlaceholder,isDisabled:o,isInvalid:K,errorMessage:K?Wt(f.insufficientMessageTemplate,{due:Q}):void 0,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${h}-received-input`}),T.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${h}-quick-amounts`,children:[u&&t.jsxs(O,{variant:"flat",color:"primary",radius:"lg",className:"h-auto min-h-11 min-w-0 whitespace-normal px-2 py-1 text-sm font-semibold leading-tight",isDisabled:o,"aria-label":Wt(f.exactAmountAriaTemplate,{amount:Q}),onPress:Y,"data-testid":`${h}-quick-amount-exact`,children:[f.exactAmountLabel," ",Q]}),T.map(V=>{const te=hx(V,r,e.currency);return t.jsx(O,{variant:"bordered",color:"default",radius:"lg",className:"h-auto min-h-11 min-w-0 px-2 text-base font-semibold text-default-900",isDisabled:o,"aria-label":Wt(f.quickAmountAriaTemplate,{amount:te}),onPress:()=>z(V),"data-testid":`${h}-quick-amount-${V}`,children:te},V)})]})}),G&&t.jsx(c.Alert,{"data-testid":`${h}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Wt(f.changeMessageTemplate,{change:ae}),icon:t.jsx(M,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:oe})]})},yx={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},Dr=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},co=({dueAmount:e,value:s,defaultValue:n,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:p=!1,className:m,"data-testid":h="check-tender-form"})=>{const f={...yx,...r},b=s!==void 0,[y,g]=x.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??Dr()}),[v,j]=x.useState(!!n?.checkNumber),A=x.useMemo(()=>b?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??Dr()}:y,[b,s,y]),w=x.useCallback(F=>{b||g(F);const D=F.checkNumber.trim(),P={amount:e.value,checkNumber:D,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:D.length>0&&e.value>0};a?.(P)},[b,e.value,i,a]),E=x.useCallback(F=>D=>{l||(F==="checkNumber"&&D.length>0&&j(!0),w({...A,[F]:D}))},[A,w,l]),$=x.useCallback(()=>{l||j(!0)},[l]),N=v&&A.checkNumber.trim()==="",C=`${h}-check-number`,k=`${h}-bank-name`,_=`${h}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":h,children:[t.jsx(c.Input,{id:C,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:A.checkNumber,onChange:F=>E("checkNumber")(F.target.value),onBlur:$,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:N,errorMessage:N?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:p,"data-testid":`${h}-check-number-input`}),!o&&t.jsx(c.Input,{id:k,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:A.bankName,onChange:F=>E("bankName")(F.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${h}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:f.dateLabel,labelPlacement:"outside",type:"date",value:A.date,onChange:F=>E("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${h}-date-input`,className:"sm:col-span-2"})]})};co.displayName="CheckTenderForm";const vx={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},wx=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],uo=({dueAmount:e,methodOptions:s=wx,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const p={...vx,...i},m=n!==void 0,[h,f]=x.useState({method:a?.method??"",reference:a?.reference??""}),b=x.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:h,[m,n,h]),y=x.useCallback(E=>s.find($=>$.value===E)?.label??"",[s]),g=x.useCallback(E=>{m||f(E);const $=y(E.method),N={amount:e.value,method:E.method,description:$,reference:E.reference.trim()||void 0,isValid:E.method!==""};r?.(N)},[m,e.value,r,y]),v=x.useCallback(E=>{if(l)return;const $=typeof E=="string"?E:Array.from(E)[0]?.toString()??"";g({...b,method:$})},[b,g,l]),j=x.useCallback(E=>{l||g({...b,reference:E})},[b,g,l]),A=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(st,{id:A,label:p.methodLabel,labelPlacement:"outside",placeholder:p.methodPlaceholder,selectedKeys:b.method?[b.method]:[],onSelectionChange:v,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map(E=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${E.value}`,children:E.label},E.value))}),o&&t.jsx(c.Input,{id:w,label:p.referenceLabel,labelPlacement:"outside",type:"text",value:b.reference,onChange:E=>j(E.target.value),placeholder:p.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};uo.displayName="OtherTenderForm";const jx={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},Nx={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Cx={pending:"warning",recorded:"success",failed:"danger"},kx=e=>e==="pending"||e==="recorded",Sx=e=>`#${e+1}`,mo=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...jx,...r},{collected:p,remaining:m,isComplete:h}=x.useMemo(()=>{const b=s.reduce((g,v)=>kx(v.status)?g+v.amount:g,0),y=Math.max(e.value-b,0);return{collected:b,remaining:y,isComplete:b>=e.value&&e.value>0}},[s,e.value]),f=b=>b==="pending"?u.statusPending:b==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":d,children:[o==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:h?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(h?p:m,a,e.currency)})]}):t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${d}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:h?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(h?p:m,a,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((b,y)=>t.jsx($x,{index:y,tender:b,locale:a,currency:e.currency,removable:!!n&&b.status!=="recorded",onRemove:n?()=>n(b.id):void 0,statusLabel:f(b.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${y}`},b.id))]})]})};mo.displayName="SplitPaymentSummary";const $x=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const p=i?t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:Sx(e)}),t.jsx(M,{icon:Nx[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:Cx[s.status],startContent:s.status==="recorded"?t.jsx(M,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(M,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),p&&(r?p:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:p})}))]})},Ax=`
17
17
  @keyframes pp-modal-in {
18
18
  from { opacity: 0; transform: scale(0.96); }
19
19
  to { opacity: 1; transform: scale(1); }
@@ -38,5 +38,6 @@ ${s}${a}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,qr=p.forwardRef(({children:e,relativeOverlayRoot:n=!0,className:s,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Fu}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",n&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",s),children:e})]}));qr.displayName="ModalShell";const Wr=({title:e,subtitle:n,leading:s,titleClassName:a,onClose:r,closeLabel:i="Close",actions:l,className:o,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",o),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),n&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:n})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[l,r&&t.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(R,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});Wr.displayName="ModalShellHeader";const Yr=({children:e,columns:n=2,className:s,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",n===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",s),"data-testid":a,children:e});Yr.displayName="ModalShellFooter";const Mu={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4"},Lu={1:"grid-cols-1",2:"grid-cols-2"},en=e=>typeof e=="string"?t.jsx(R,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Gr=({options:e,selectedKey:n,onSelect:s,heading:a,ariaLabel:r="Select an option",columnsDesktop:i=3,columnsMobile:l=2,className:o,"data-testid":d="tile-select"})=>{const u=e.find(f=>f.key===n);return t.jsxs("div",{className:c.cn("flex flex-col gap-3",o),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(Me,{"aria-label":a?void 0:r,"aria-labelledby":a?`${d}-heading`:void 0,selectedKeys:n?[n]:[],onSelectionChange:f=>{const x=Array.from(f)[0];typeof x=="string"&&s(x)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${d}-mobile-select`,startContent:u?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(u.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(f=>t.jsx(c.SelectItem,{isDisabled:f.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:en(f.icon)}),"data-testid":f["data-testid"]??`${d}-${f.key}-mobile`,children:f.label},f.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid gap-3",Lu[l],Mu[i]),children:e.map(f=>{const m=n===f.key;return t.jsxs(U,{variant:"bordered",radius:"lg","aria-pressed":m,"aria-label":f.label,isDisabled:f.isDisabled,onPress:()=>s(f.key),"data-testid":f["data-testid"]??`${d}-${f.key}`,className:c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-[80px] px-4 py-4","border bg-transparent transition-colors",m?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),children:[t.jsx("span",{"aria-hidden":"true",children:en(f.icon)}),t.jsx("span",{className:"text-sm font-medium",children:f.label})]},f.key)})})]})};Gr.displayName="TileSelect";const Iu={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},Kr=({total:e,label:n,locale:s="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const l=Iu[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",l.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:n}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",l.amount),"data-testid":`${i}-amount`,children:xe(e.value,s,e.currency)})]})};Kr.displayName="PaymentTotalBanner";const Tu={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},Qr=({title:e,subtitle:n,backdrop:s="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Tu[s],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),n&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:n})]})]});Qr.displayName="LoadingOverlay";const Wn=({cashChange:e,label:n="Cash to return",secondaryLine:s,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:l="left",className:o,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=l==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",o),children:[t.jsx(R,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:n}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),s&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:s})]}),r&&t.jsx(U,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(R,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};Wn.displayName="PaymentCashChangeBanner";const Zr=({title:e,subtitle:n,emailLine:s,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:l="en-US",closeLabel:o="Close",onClose:d,className:u,"data-testid":f="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":f,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(R,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${f}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:n}),s&&a&&t.jsxs("p",{className:"text-default-700",children:[s,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(Wn,{cashChange:r,label:i,locale:l,align:"center",className:"max-w-[400px]","data-testid":`${f}-cash-change`}),d&&t.jsx(U,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${f}-close`,className:"mt-4 w-full",children:o})]})};Zr.displayName="PaymentSuccessView";const Yn=({heading:e,amountLabel:n,value:s,defaultValue:a,onChange:r,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:d,autoFocus:u,maxAmount:f,hideHeading:m=!1,className:x,"data-testid":h="payment-sub-amount-input"})=>{const b=`${h}-input`,y=p.useCallback(N=>{if(f!==void 0){const j=Number.parseFloat(N.replace(",","."));if(Number.isFinite(j)&&j>f)return}r?.(N)},[f,r]),v=p.useCallback(N=>{const j=N.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",x),"data-testid":h,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",m&&"sr-only"),"data-testid":`${h}-heading`,children:e}),t.jsx(c.Input,{id:b,label:n,labelPlacement:"outside",classNames:m?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:s,defaultValue:a,onChange:N=>y(N.target.value),onFocus:v,placeholder:i,isDisabled:l,isInvalid:o,errorMessage:o?d:void 0,variant:"bordered",radius:"lg","aria-invalid":o||void 0,autoFocus:u,"data-testid":`${h}-field`})]})};Yn.displayName="PaymentSubAmountInput";const _u={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},Pu=e=>typeof e=="string"?t.jsx(R,{icon:e,className:"size-5","aria-hidden":"true"}):e,Xr=({isOpen:e,title:n,confirmLabel:s,onConfirm:a,onOpenChange:r,children:i,description:l,cancelLabel:o="Cancel",variant:d="danger",isPending:u=!1,isDismissable:f,isKeyboardDismissDisabled:m=!1,hideIcon:x=!1,icon:h,"data-testid":b="confirm-dialog"})=>{const y=i??l??null,v=_u[d],N=x?null:Pu(h??v.icon);return t.jsx(c.Modal,{isOpen:e,onOpenChange:j=>r?.(j),placement:"center",size:"md",isDismissable:(f??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[N?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",v.tile),children:N}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:n})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(U,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:o}),t.jsx(U,{color:v.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:s})]})]})})};Xr.displayName="ConfirmDialog";const Ou=60,Ru=(e,n,s=Ou)=>n?e>s:e<-s,Jr=(e,n)=>Math.max(0,Math.min(e,n)),zu=160,Bu=(e,n,s=zu)=>Math.min(e,Math.max(0,n-s)),Vu=(e,n,s)=>Jr(e-n,s),Uu=(e,n,s)=>e!==null?Jr(e,s):n?s:0,Hu=e=>e?"":"transition-[height] duration-300 ease-out",qu=e=>({onDrag:(n,s)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(Vu(a,s?.offset?.y??0,e.fullHeight))},onDragEnd:(n,s)=>{Ru(s?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ye=(e,n)=>xe(e.value,n,e.currency),Gn=({item:e,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r=!0})=>{const i=!!e.children&&e.children.length>0,l=!!s&&r;return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)}),l&&t.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>s(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:"flex items-center gap-2 text-sm text-default-500",children:[t.jsx(R,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((o,d)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${o.key??d}`,className:"flex items-center justify-between gap-2 text-sm text-default-500",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.icon,t.jsx("span",{className:"truncate",children:o.label})]}),(o.value!=null||o.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",o.valueTone==="primary"&&"font-medium text-primary"),children:o.value}),o.tooltip!=null&&t.jsx(c.Tooltip,{content:o.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${o.key??d}`,className:"flex shrink-0 items-center",children:t.jsx(R,{icon:"lucide:info",width:16,height:16,className:c.cn(o.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},o.key??d)),i&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(o=>t.jsx(Gn,{item:o,locale:n,onRemove:s,removeAriaLabel:a,showRemoveButton:r},o.id))})]})};Gn.displayName="SummaryItemRow";const ei=({fee:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",s),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ye(e.amount,n)})]});ei.displayName="SummaryServiceFeeRow";const Kn=({row:e,locale:n,emphasized:s,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0})=>{const l=!!a&&i&&!!e.id,o=t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:"whitespace-nowrap text-base",children:Ye(e.amount,n)});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:"flex items-center justify-between text-foreground",children:[t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:c.cn(s?"text-xl font-semibold leading-7":"text-base"),children:e.label}),l?t.jsxs("div",{className:"flex shrink-0 items-center",children:[o,t.jsx(U,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:"ml-1 size-8 min-w-8 p-2 text-danger","aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(R,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):o]})};Kn.displayName="SummaryTotalsLineRow";const ti=({pricesInLabel:e,currency:n,items:s,serviceFee:a,rows:r,locale:i,onRemoveItem:l,removeAriaLabel:o,showRemoveButton:d,emptyState:u,classNames:f})=>{const m=(s?.length??0)>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),n!=null&&t.jsx("span",{children:n})]}),m?t.jsx("div",{className:c.cn("flex flex-col gap-4",f.items),children:s.map(x=>t.jsx(Gn,{item:x,locale:i,onRemove:l,removeAriaLabel:o,showRemoveButton:d},x.id))}):t.jsx("div",{"data-testid":"summary-empty",children:u}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsx(ei,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn("flex flex-col gap-4",f.totalsRows),children:r.map((x,h)=>t.jsx(Kn,{row:x,locale:i,emphasized:h===0},x.key))})]})};ti.displayName="SummaryBody";const ni=({total:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-total",className:c.cn("flex items-center justify-between text-xl font-semibold leading-7 text-foreground",s),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:"whitespace-nowrap text-xl font-semibold leading-7",children:Ye(e.amount,n)})]});ni.displayName="SummaryGrandTotalRow";const si=({secondaryTotal:e,locale:n,className:s})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",s),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ye(e.amount,n)})]});si.displayName="SummarySecondaryTotalRow";const St=({action:e,disabledByLoading:n,className:s,testId:a="summary-cta"})=>t.jsx(U,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",s),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||n,onPress:e.onPress,endContent:t.jsx(R,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});St.displayName="SummaryPrimaryCta";const ai=({title:e,total:n,secondaryTotal:s,locale:a,open:r,progress:i,dragging:l,toggleAriaLabel:o,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":o,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!l&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(R,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!l&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:n.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:Ye(n.amount,a)})]}),s&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:s.label}),t.jsx("span",{className:"whitespace-nowrap",children:Ye(s.amount,a)})]})]})]})});ai.displayName="SummaryCollapseHeader";const ri=({cart:e,ariaLabel:n,onPress:s,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":n,onClick:s,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(R,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});ri.displayName="SummaryCartButton";const ii=({open:e,progress:n,dragging:s,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:l,ctaCaption:o,onToggleOpen:d,classNames:u})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",u.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-n},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:[i&&t.jsx(ri,{cart:i,ariaLabel:l,className:u.cart,onPress:()=>{d?.(),i.onPress?.()}}),a&&t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",u.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:n},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!s&&"transition-opacity duration-300"),children:t.jsx(St,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",u.cta)})})]}),o&&t.jsx("div",{children:o})]});ii.displayName="SummaryActionBar";const Wu="(max-width: 767px)",Yu=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,Gu=(e=Wu)=>{const[n,s]=p.useState(()=>Yu(e));return p.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>s(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),n},li=({title:e="Summary",pricesInLabel:n="Prices are in",currency:s,locale:a="en-US",items:r,serviceFee:i,rows:l,total:o,postTotalRows:d,onRemovePostTotalRow:u,secondaryTotal:f,collapsible:m,isOpen:x,onToggleOpen:h,defaultOpen:b=!1,primaryAction:y,isLoading:v=!1,onRemoveItem:N,showRemoveButton:j,ctaCaption:C,variant:w,cart:S,emptyState:E,labels:A,classNames:L={},"data-testid":M="summary",className:_})=>{const D=A?.removeAriaLabel??"Remove item",$=A?.removePostTotalRowAriaLabel??"Remove applied code",I=A?.toggleAriaLabel??"Toggle summary",T=A?.cartAriaLabel??"View cart",K=Gu(),B=m??(w??(K?"mobile":"main"))==="mobile",[X,J]=p.useState(b),ae=x!==void 0,q=!B||(ae?x:X),Z=p.useCallback(()=>{ae||J(pe=>!pe),h?.()},[ae,h]),[Q,W]=p.useState(0),[ee,ce]=p.useState(null),de=p.useRef(null),ve=p.useRef(null),be=p.useCallback(()=>{const pe=de.current;pe&&W(Bu(pe.scrollHeight,window.innerHeight))},[]),Se=p.useCallback(pe=>{ve.current?.disconnect(),ve.current=null,de.current=pe,pe&&(be(),typeof ResizeObserver<"u"&&(ve.current=new ResizeObserver(be),ve.current.observe(pe)))},[be]);p.useEffect(()=>(window.addEventListener("resize",be),()=>window.removeEventListener("resize",be)),[be]);const _e=qu({open:q,fullHeight:Q,setDragHeight:ce,onToggleOpen:Z}),Pe=ee!==null,Oe=Uu(ee,q,Q),Ve=Q>0?Math.min(1,Math.max(0,Oe/Q)):q?1:0,Fe=t.jsx(ni,{total:o,locale:a,className:L.total}),te=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(pe=>t.jsx(Kn,{row:pe,locale:a,emphasized:!1,onRemove:u,removeAriaLabel:$,showRemoveButton:j},pe.key))}),he=f&&t.jsx(si,{secondaryTotal:f,locale:a,className:L.secondaryTotal}),Le=C!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",L.ctaCaption),children:C}),mt=t.jsx(ti,{pricesInLabel:n,currency:s,items:r,serviceFee:i,rows:l,locale:a,onRemoveItem:N,removeAriaLabel:D,showRemoveButton:j,emptyState:E,classNames:L});return B?t.jsxs(Ce.motion.section,{"data-testid":M,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:_e.onDrag,onDragEnd:_e.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",_,L.base),children:[t.jsx(ai,{title:e,total:o,secondaryTotal:f,locale:a,open:q,progress:Ve,dragging:Pe,toggleAriaLabel:I,onToggleOpen:Z,classNames:L}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!q,style:{height:Oe},className:c.cn("min-h-0",q&&!Pe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!q&&"pointer-events-none",Hu(Pe)),children:t.jsxs("div",{ref:Se,className:"flex flex-col gap-4 pb-4",children:[mt,t.jsx(c.Divider,{className:"bg-default-200"}),Fe,te,he]})}),t.jsx(ii,{open:q,progress:Ve,dragging:Pe,primaryAction:y,isLoading:v,cart:S,cartAriaLabel:T,ctaCaption:Le,onToggleOpen:Z,classNames:L})]}):t.jsxs("section",{"data-testid":M,className:c.cn("flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",_,L.base),children:[t.jsx("div",{className:c.cn("flex items-center justify-between",L.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",L.title),children:e})}),mt,t.jsx(c.Divider,{className:"bg-default-200"}),Fe,te,he,f&&y&&t.jsx(c.Divider,{className:"bg-default-200"}),y&&t.jsx(St,{action:y,disabledByLoading:v,className:c.cn("w-full",L.cta)}),Le]})};li.displayName="Summary";const Ku={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes"},Qu={backgroundColor:jn.destructive,color:"#fff"},Hs="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",tn="absolute top-0 h-5 w-5 opacity-0",oi=({onClose:e,steps:n,activeStepId:s,subtitle:a,onBack:r,primaryAction:i,totalRow:l,secondaryAction:o,hideChrome:d,footerSummary:u,labels:f,className:m,"data-testid":x="wizard-shell",children:h})=>{const b={...Ku,...f},y=n.filter(w=>w.state!=="skipped"),v=n.find(w=>w.id===s),N=Math.max(0,y.findIndex(w=>w.id===s)),j=r??e,C=r?b.back:b.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":x,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${x}-header`,children:[j&&t.jsx(U,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:j,"data-testid":`${x}-header-back`,startContent:t.jsx(R,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:C}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${x}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${x}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${x}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(tn,"left-0"),"data-testid":`${x}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(tn,"left-6"),"data-testid":`${x}-back`}),o&&t.jsx("button",{type:"button","aria-label":o.label,disabled:o.disabled,onClick:o.onClick,className:c.cn(tn,"left-12"),"data-testid":`${x}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[l&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${x}-total`,children:[t.jsx("span",{children:l.label}),l.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:xe(l.amount.value,void 0,l.amount.currency)}),l.badge==="partial"&&t.jsx("span",{className:c.cn(Hs,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${x}-total-partial`,children:b.partialBadge}),l.badge==="owes"&&t.jsx("span",{className:c.cn(Hs,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${x}-total-owes`,children:b.owesBadge})]}),t.jsx(U,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?Qu:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${x}-primary`,children:i.label})]})]}),t.jsx("div",{className:"flex shrink-0 gap-1.5 px-6 py-2.5","data-testid":`${x}-stepper`,children:y.map((w,S)=>t.jsx("span",{className:c.cn("h-1 flex-1 rounded-full",S<N&&"bg-pos-ok",S===N&&"bg-primary",S>N&&"bg-pos-line")},w.id))}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${x}-body`,children:h}),u]})};oi.displayName="WizardShell";const Zu=(e,n,s)=>Math.min(Math.max(e,n),s);function gn(e,n,s){const a=Math.max(1,Math.trunc(n)),r=Zu(Math.trunc(s),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Ft(e.currency)),l=Math.round(e.value*i),o=Math.floor(l/a),d=l-o*a;return{value:(o*r+Math.min(r,d))/i,currency:e.currency}}function Xu(e,n){return gn(e,n,1)}const Ju=e=>Number.isFinite(e)?e.toFixed(2):"",bn=({value:e,expected:n,max:s,onChange:a,ariaLabel:r,isDisabled:i,className:l,"data-testid":o,inputTestId:d})=>{const[u,f]=p.useState(null),m=p.useRef(null),x=Math.abs(e-n)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",x?"border-primary bg-primary-50":"border-pos-line bg-white",l),"data-testid":o,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??Ju(e),onChange:h=>{const b=h.target.value,y=Number.parseFloat(b.replace(",","."));s!==void 0&&Number.isFinite(y)&&y>s+.004||(f(b),Number.isFinite(y)&&y>=0?a(y):b.trim()===""&&a(0))},onFocus:h=>h.currentTarget.select(),onBlur:()=>f(null),"data-testid":d})]})};bn.displayName="AmountCell";const ef={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer — price adjustment",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},tf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",qs="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",nn="absolute h-5 w-5 opacity-0",nf=e=>{const n=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return n;const s=Xu(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(s.value,void 0,s.currency)} · ${n}`},ci=({items:e,selections:n,onSelectionChange:s,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:l,className:o,"data-testid":d="line-item-list"})=>{const u={...ef,...l},f=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":d,children:[e.map(m=>{const x=n[m.id],h=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),v=x?.quantity,N=x?.selected?Math.min(v??y,y):v??0,j=gn(m.paidAmount,y,N).value,C=x?.amount??(x?.selected?j:0),w=N===0&&C>.004,S=A=>s(m.id,{selected:A.quantity>0||A.amount>.004,mode:"full",...A}),E=A=>{const L=Math.min(Math.max(A,0),y);S({quantity:L,amount:gn(m.paidAmount,y,L).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",h&&"opacity-60"),"data-testid":b,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${b}-icon`,children:t.jsx(R,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${b}-detail`,children:m.detail??nf(m)}),w&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${b}-partial`,children:[h?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(bn,{value:C,expected:j,max:m.paidAmount.value,onChange:A=>S({quantity:N,amount:A}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),h?t.jsx("span",{className:tf,"data-testid":`${b}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${b}-qty`,children:[t.jsx("button",{type:"button",className:qs,"aria-label":u.decrease.replace("{name}",m.name),disabled:N===0,onClick:()=>E(N-1),"data-testid":`${b}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${b}-qty-value`,children:N}),t.jsx("button",{type:"button",className:qs,"aria-label":u.increase.replace("{name}",m.name),disabled:N===y,onClick:()=>E(N+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),N>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(y))}),x?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(R,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),N>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(Me,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:A=>{if(A==="all")return;const L=[...A][0];L&&(r?.(m.id,L),a(m.id,L==="stock"))},"data-testid":`${b}-restock`,children:f.map(A=>t.jsx(c.SelectItem,{children:A.label},A.key))})]})]}),!h&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(nn,"right-0 top-0 m-0 p-0"),isSelected:!!x?.selected,onValueChange:A=>s(m.id,{selected:A,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(nn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>S({quantity:N,amount:j}),className:c.cn(nn,"left-5 top-0"),"data-testid":`${b}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(R,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",xe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(bn,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(R,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};ci.displayName="LineItemList";const di=({children:e,className:n,"data-testid":s="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",n),"data-testid":s,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});di.displayName="MetaCard";const ui=({label:e,htmlFor:n,children:s,className:a,"data-testid":r="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",a),"data-testid":r,children:[t.jsx("label",{htmlFor:n,className:"text-[13px] font-medium text-default-600",children:e}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:s})]});ui.displayName="MetaCard.Row";const fi=({label:e,children:n,className:s,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",s),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),n]});fi.displayName="MetaCard.Section";const sf=Object.assign(di,{Row:ui,Section:fi}),mi=({heading:e,icon:n="lucide:rotate-ccw",action:s,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(R,{icon:n,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),s&&t.jsxs("button",{type:"button",disabled:s.disabled,onClick:s.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(R,{icon:s.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),s.label]})]}),a]});mi.displayName="SectionPanel";const hi=({name:e,detail:n,icon:s="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:s,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),n&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:n})]})]});hi.displayName="CustomerCard";const af={label:"Reason for the return",placeholder:"Select a reason…"},xi=({options:e,value:n,onChange:s,error:a,labels:r,className:i,"data-testid":l="reason-select"})=>{const o={...af,...r};return t.jsx(Me,{label:o.label,labelPlacement:"outside",placeholder:o.placeholder,selectedKeys:n?[n]:[],isInvalid:!!a,errorMessage:a,className:c.cn(i),"data-testid":l,onSelectionChange:d=>{if(d==="all")return;const u=[...d][0];u&&s(String(u))},children:e.map(d=>t.jsx(c.SelectItem,{children:d.label},d.id))})};xi.displayName="ReasonSelect";const rf={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},pi=({value:e,onChange:n,maxLength:s,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:l,"data-testid":o="notes-field"})=>{const d={...rf,...i},[u,f]=p.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",l),"data-testid":o,children:[!r&&t.jsx("label",{htmlFor:`${o}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${o}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${o}-textarea`})]}):t.jsx("div",{className:c.cn(l),"data-testid":o,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>n(m.target.value),maxLength:s,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${o}-textarea`}):t.jsxs(U,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>f(!0),"data-testid":`${o}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};pi.displayName="NotesField";const lf={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},of={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Ws="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Qn=({tone:e,title:n,body:s,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:l,className:o,"data-testid":d,retryTestId:u,chooseDifferentTestId:f})=>{const m=lf[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,o),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(R,{icon:of[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[n&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:n}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:s}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(U,{color:"primary",className:Ws,onPress:a,"data-testid":u,children:r}),t.jsx(U,{variant:"bordered",className:c.cn(Ws,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":f,children:l})]})]})]})};Qn.displayName="TenderBanner";const cf={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},df={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},gi=({tenders:e,selectedTenderId:n,onSelect:s,onSplit:a,error:r,labels:i,className:l,"data-testid":o="tender-methods"})=>{const d={...cf,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":o,children:[r&&t.jsx(Qn,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${o}-error`,retryTestId:`${o}-retry`,chooseDifferentTestId:`${o}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${o}-tiles`,children:[e.map(f=>{const m=f.tenderId===n;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>s(f.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${o}-tile-${f.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(R,{icon:df[f.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:f.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(f.maxRefundable.value,void 0,f.maxRefundable.currency)})]})]},f.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${o}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(R,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};gi.displayName="TenderMethods";const uf=e=>e.refunded!==null,ff={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},mf="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",hf="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",bi=({parts:e,refundedSoFar:n,remaining:s,current:a,methods:r,onRefundPart:i,partError:l,onBack:o,busy:d,hideActions:u,labels:f,className:m,"data-testid":x="split-tender-panel"})=>{const h={...ff,...f},b=e.filter(uf),y=e.find(C=>C.tenderId===a.tenderId)?.label,v=!!(r?.length&&a.onTenderChange),N=p.useCallback(C=>{const w=Number.parseFloat(C.replace(",","."));a.onAmountChange(Number.isFinite(w)?w:0)},[a]),j=l?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":x,children:[t.jsx("h3",{className:"sr-only","data-testid":`${x}-title`,children:h.title}),l&&t.jsx(Qn,{tone:j?"danger":"warning",title:j?h.declinedTitle:h.networkTitle,body:j?h.partDeclinedBody:h.partNetworkBody,onRetry:l.onRetry,retryLabel:h.retry,onChooseDifferent:l.onChooseDifferent,chooseDifferentLabel:h.chooseDifferent,className:"mb-[18px]","data-testid":`${x}-part-error`,retryTestId:`${x}-retry`,chooseDifferentTestId:`${x}-choose-different`}),t.jsxs("div",{"data-testid":`${x}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:h.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(s.value,void 0,s.currency)}),t.jsxs("span",{className:"sr-only",children:[h.refundedSoFar,": ",xe(n.value,void 0,n.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:mf,children:h.refundedSoFar}),b.map((C,w)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${x}-part-${C.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",w+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(R,{icon:C.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:C.label}),C.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:C.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(C.refunded.value,void 0,C.refunded.currency)}),t.jsx("span",{className:c.cn(hf,C.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:C.status==="pending"?h.pending:h.succeeded})]},C.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${x}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:h.partHeading.replace("{n}",String(b.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${x}-amount-label`,children:h.amountForPart}),t.jsx(Yn,{heading:h.amountForPart,amountLabel:h.amountForPart,hideHeading:!0,placeholder:"$0.00",value:String(a.amount),onChange:N,maxAmount:s.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${x}-amount`}),v&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${x}-methods`,children:r?.map(C=>{const w=C.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":w,disabled:C.disabled||d,onClick:()=>a.onTenderChange?.(C.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",w?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${x}-method-${C.tenderId}`,children:[C.icon&&t.jsx(R,{icon:C.icon,width:15,height:15,"aria-hidden":"true"}),C.label]},C.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(U,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:o,"data-testid":`${x}-back`,children:h.back}),t.jsx(U,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${x}-submit`,children:h.submit})]})]})};bi.displayName="SplitTenderPanel";const xf={label:"Supervisor authorization",placeholder:"••••"},yi=({pin:e,onChange:n,hint:s,error:a,labels:r,className:i,"data-testid":l="pin-field"})=>{const o={...xf,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":l,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(R,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:o.label}),s&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:s}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":o.label,placeholder:o.placeholder,value:e,onChange:d=>n(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${l}-input`})]})};yi.displayName="PinField";const pf={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}"},gf={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},bf="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Ys="mb-1.5 text-[11px] font-semibold uppercase tracking-[.05em] text-default-500",yf="mx-auto max-w-[1040px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px] shadow-[0_1px_2px_rgba(0,0,0,0.05)]",vf=["email","print"],vi=({state:e,total:n,destinations:s,reason:a,authorizedBy:r,selectedReceipts:i,onSendReceipt:l,onDone:o,frameless:d=!1,labels:u,className:f,"data-testid":m="outcome-view"})=>{const x={...pf,...u},h=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-default-900",f),"aria-live":"polite","data-testid":m,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[60px]","data-testid":`${m}-processing`,children:[t.jsx("div",{className:"mb-4 h-[52px] w-[52px] animate-spin rounded-full border-[5px] border-default-100 border-t-primary",role:"presentation"}),t.jsx("p",{className:"text-[17px] font-semibold",children:x.processing}),h&&t.jsx("p",{className:"mt-2 text-[15px] font-semibold tabular-nums","data-testid":`${m}-processing-total`,children:h})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-default-900",!d&&yf,f),"aria-live":"polite","data-testid":m,children:[t.jsxs("div",{className:"pb-0.5 pt-1 text-center",children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[78px] w-[78px] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx(R,{icon:"solar:check-circle-bold",width:46,height:46,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[22px] font-semibold","data-testid":`${m}-title`,children:x.title}),h&&t.jsx("p",{className:"my-1 text-[30px] font-semibold tabular-nums","data-testid":`${m}-total`,children:h}),a&&t.jsx("p",{className:"text-[13px] text-default-500","data-testid":`${m}-reason`,children:x.reason.replace("{reason}",a)})]}),t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ys,children:x.destinationsTitle}),s.map((b,y)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[11px] text-sm last:border-b-0","data-testid":`${m}-destination-${y}-${b.status}`,children:[t.jsx("span",{className:"font-semibold",children:b.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-default-600",children:xe(b.amount.value,void 0,b.amount.currency)}),t.jsx("span",{className:c.cn(bf,gf[b.status]),children:b.status==="succeeded"?x.succeeded:x.pending})]})]},`${b.label}-${y}`))]}),l&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Ys,children:x.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:vf.map(b=>{const y=i?.includes(b)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":y,onClick:()=>l(b),className:"flex min-h-[44px] w-full items-center gap-2.5 rounded-[10px] p-2 text-left text-sm outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-testid":`${m}-receipt-${b}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:y,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:x[b]})]},b)})})]}),r&&t.jsx("p",{className:"mt-4 text-[12.5px] text-default-500","data-testid":`${m}-authorized-by`,children:x.authorizedBy.replace("{name}",r)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(U,{color:"primary",className:"h-12 w-full rounded-[14px] px-5 text-[15px] font-semibold",onPress:o,"data-testid":`${m}-done`,children:x.done})})]})};vi.displayName="OutcomeView";exports.AdminFieldLabel=Tr;exports.AdminTable=Sr;exports.AdminTextField=_r;exports.AdminToolbar=Ar;exports.AppliedCodeCard=la;exports.Button=U;exports.CashTenderForm=ju;exports.CatalogItemCard=fr;exports.CheckTenderForm=Vr;exports.CommitmentDetails=rd;exports.ConfirmDialog=Xr;exports.ConfirmationModal=Lt;exports.ConfirmationPageTemplate=Do;exports.CustomerCard=hi;exports.DatePicker=En;exports.DimensionChip=Un;exports.DonationAmounts=Pa;exports.EmptyState=Rn;exports.ErrorState=zn;exports.EventDetails=uc;exports.EventDetailsTemplate=Fo;exports.ExpireCartTimer=Oa;exports.FeedbackState=et;exports.FilterPopover=pr;exports.Footer=Io;exports.HeroUIProvider=Xi;exports.HorizontalSteps=Ma;exports.InstallmentFundAssignment=ed;exports.InstallmentFundAssignmentSkeleton=sd;exports.InstallmentSchedule=wd;exports.InstallmentScheduleSkeleton=$d;exports.InstallmentTable=Md;exports.ItemCard=ur;exports.KeyValueChip=Un;exports.LineItemList=ci;exports.ListPanel=Br;exports.LoadingOverlay=Qr;exports.LoadingState=Bn;exports.MembershipSelectCards=_d;exports.MetaCard=sf;exports.ModalShell=qr;exports.ModalShellFooter=Yr;exports.ModalShellHeader=Wr;exports.Multiselect=To;exports.Navbar=$o;exports.NotesField=pi;exports.OfferCard=wt;exports.OfferCardEmpty=Ra;exports.OfferCardError=za;exports.OfferCardList=Ha;exports.OfferCardSkeleton=Ba;exports.OtherTenderForm=Ur;exports.OutcomeView=vi;exports.PageHeader=br;exports.PaginationSummary=zr;exports.PaymentCashChangeBanner=Wn;exports.PaymentSubAmountInput=Yn;exports.PaymentSuccessView=Zr;exports.PaymentTotalBanner=Kr;exports.PickerRow=Or;exports.PinField=yi;exports.RICH_TEXT_PRESETS=Ta;exports.ReasonSelect=xi;exports.RedeemCodeInput=Co;exports.RevenueDistributionCard=nr;exports.RevenueDistributionEmpty=sr;exports.RevenueDistributionError=ar;exports.RevenueDistributionSkeleton=rr;exports.RichTextArea=_a;exports.RowActions=Pr;exports.SectionPanel=mi;exports.Select=Me;exports.SessionTimeline=gr;exports.SplitPaymentSummary=Hr;exports.SplitTenderPanel=bi;exports.StatusChip=yr;exports.Stepper=Ea;exports.SuccessState=mr;exports.Summary=li;exports.TableSkeleton=vr;exports.TenderMethods=gi;exports.TicketSelection=au;exports.TileSelect=Gr;exports.Toggle=hr;exports.ToolbarButton=$r;exports.UnderlineTabs=Dr;exports.WizardShell=oi;exports.adminFieldErrorClass=Ir;exports.adminFieldHintClass=Lr;exports.adminFieldLabelClass=Hn;exports.adminFieldLabelSuffixClass=qn;exports.adminInputClass=Fr;exports.adminInputReadOnlyClass=Mr;exports.adminInputWrapperClass=Er;exports.adminRowClass=Nr;exports.adminSurfaceCss=Zi;exports.adminSurfaceTokens=vn;exports.adminTableClass=Cr;exports.adminTableFooterClass=kr;exports.adminTdClass=wr;exports.adminThClass=jr;exports.calculateAllocationDifference=Uc;exports.computeChange=dn;exports.currencyFractionDigits=Ft;exports.formatMoney=xe;exports.formatOfferCurrency=fn;exports.formatRevenueAmount=Rc;exports.formatRevenueCurrency=zc;exports.generateAutomaticInstallments=or;exports.generateDistributionId=On;exports.getCurrencySymbol=Bc;exports.offerCardVariants=Ua;exports.offerListVariants=Va;exports.pageRange=Rr;exports.parseOfferCurrency=fc;exports.parseRevenueCurrency=Vc;exports.posSurfaceTokens=jn;exports.roundToCurrency=Fa;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,fo=x.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Ax}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));fo.displayName="ModalShell";const po=({title:e,subtitle:s,leading:n,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(M,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});po.displayName="ModalShellHeader";const xo=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",n),"data-testid":a,children:e});xo.displayName="ModalShellFooter";const Ex={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},Dx={1:"grid-cols-1",2:"grid-cols-2"},Ft={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${je} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]"},fn=e=>typeof e=="string"?t.jsx(M,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Lx=e=>t.jsx("span",{"aria-hidden":"true",className:Ft.icon,children:typeof e=="string"?t.jsx(M,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),xs=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${je}`,Fx="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Lr="flex-none",_x=typeof window<"u"?x.useLayoutEffect:x.useEffect,Fr=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",ho=({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:p="md",className:m,"data-testid":h="tile-select"})=>{const f=p==="sm",b=e.find(y=>y.key===s);return i==="compact"?t.jsx(Rx,{options:e,selectedKey:s,onSelect:n,ariaLabel:r,moreLabel:l,dataTestId:h,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":h,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${h}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(st,{"aria-label":a?void 0:r,"aria-labelledby":a?`${h}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const v=Array.from(y)[0];typeof v=="string"&&n(v)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${h}-mobile-select`,startContent:b?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:fn(b.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:fn(y.icon)}),"data-testid":y["data-testid"]??`${h}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${h}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",f?Ft.grid:"gap-3",Dx[u],Ex[d]),"data-size":p,children:e.map(y=>{const g=s===y.key;return t.jsxs(O,{variant:"bordered",radius:"lg","aria-pressed":g,"aria-label":y.label,isDisabled:y.isDisabled,onPress:()=>n(y.key),"data-testid":y["data-testid"]??`${h}-${y.key}`,className:f?c.cn(Ft.tile,g?Ft.active:Ft.idle):c.cn("flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4","border bg-transparent transition-colors",je,g?"border-primary bg-primary-50 text-primary":"border-default-200 text-default-800 hover:bg-default-50"),"data-size":p,children:[f?Lx(y.icon):t.jsx("span",{"aria-hidden":"true",children:fn(y.icon)}),t.jsx("span",{className:f?Ft.label:"text-sm font-medium",children:y.label})]},y.key)})})]})};ho.displayName="TileSelect";function Rx({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=x.useRef(null),p=x.useRef(null),m=x.useMemo(()=>e.map((C,k)=>({option:C,index:k})).filter(({option:C})=>C.alwaysInMenu!==!0).map(({index:C})=>C),[e]),h=m.length<e.length,f=x.useCallback(C=>{const k=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,D)=>F.priority-D.priority||D.index-F.index),_=new Set(k.slice(0,m.length-C).map(F=>F.index));return m.filter(F=>!_.has(F))},[e,m]),[b,y]=x.useState(e.length);_x(()=>{const C=u.current,k=p.current;if(!C||!k)return;const _=()=>{const D=Array.from(k.children),P=D.slice(0,e.length).map(K=>K.getBoundingClientRect().width),T=D[e.length]?.getBoundingClientRect().width??0,W=window.getComputedStyle(C),Y=Number.parseFloat(W.columnGap)||0,z=C.clientWidth-(Number.parseFloat(W.paddingLeft)||0)-(Number.parseFloat(W.paddingRight)||0);if(z<=0||P.some(K=>K===0)){y(m.length);return}const G=K=>{const ae=h||K<m.length,Q=K+(ae?1:0);return f(K).reduce((ee,q)=>ee+(P[q]??0),0)+(ae?T:0)+Y*(Q-1)<=z};for(let K=m.length;K>=1;K-=1)if(G(K)){y(K);return}y(1)};_();const F=new ResizeObserver(_);return F.observe(C),()=>F.disconnect()},[e,o,f,m,h]);const g=Math.max(1,Math.min(b,i??m.length,m.length)),j=!h&&g===m.length-1&&b===m.length?m.length:g,A=h||j<m.length,w=new Set(f(j)),E=e.filter((C,k)=>w.has(k)),$=A?e.filter((C,k)=>!w.has(k)):[],N=$.find(C=>C.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[E.map(C=>t.jsx(O,{variant:"light",radius:"full","aria-pressed":s===C.key,isDisabled:C.isDisabled,onPress:()=>n(C.key),"data-testid":C["data-testid"]??`${d}-${C.key}`,className:c.cn(xs,Fr(s===C.key)),children:C.label},C.key)),$.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(O,{variant:"light",radius:"full","aria-pressed":N!==void 0,"data-testid":`${d}-more`,className:c.cn(xs,"gap-1",N!==void 0?"min-w-0":"min-w-fit",Fr(N!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:N?.label??o}),t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:N?[N.key]:[],disabledKeys:$.filter(C=>C.isDisabled).map(C=>C.key),onAction:C=>n(String(C)),children:$.map(C=>t.jsx(c.DropdownItem,{textValue:C.label,...C.description!==void 0?{description:C.description}:{},"data-testid":C["data-testid"]??`${d}-${C.key}`,children:C.label},C.key))})]})]}),t.jsxs("div",{ref:p,"aria-hidden":"true",className:Fx,children:[e.map(C=>t.jsx(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(xs,Lr),children:C.label},C.key)),t.jsxs(O,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(xs,Lr,"gap-1"),children:[o,t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const Mx={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},bo=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=Mx[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:fe(e.value,n,e.currency)})]})};bo.displayName="PaymentTotalBanner";const Px={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},go=({title:e,subtitle:s,backdrop:n="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Px[n],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});go.displayName="LoadingOverlay";const pa=({cashChange:e,label:s="Cash to return",secondaryLine:n,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(M,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),r&&t.jsx(O,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};pa.displayName="PaymentCashChangeBanner";const yo=({title:e,subtitle:s,emailLine:n,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":p="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":p,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(M,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${p}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(pa,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${p}-cash-change`}),d&&t.jsx(O,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${p}-close`,className:"mt-4 w-full",children:l})]})};yo.displayName="PaymentSuccessView";const xa=({heading:e,amountLabel:s,value:n,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:p,maxAmount:m,hideHeading:h=!1,className:f,"data-testid":b="payment-sub-amount-input"})=>{const y=`${b}-input`,g=n!==void 0,[v,j]=x.useState(a??""),A=g?n:v,{isUntouched:w,markEdited:E}=lo(A),$=x.useCallback(k=>{if(m!==void 0){const _=Number.parseFloat(k.replace(",","."));if(Number.isFinite(_)&&_>m)return}E(k),g||j(k),r?.(k)},[m,r,E,g]),N=oo(w,$),C=x.useCallback(k=>{const _=k.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":b,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",h&&"sr-only"),"data-testid":`${b}-heading`,children:e}),t.jsx(c.Input,{ref:N,id:y,label:s,labelPlacement:"outside",classNames:h?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:A,onChange:k=>$(k.target.value),onFocus:C,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:p,"data-testid":`${b}-field`})]})};xa.displayName="PaymentSubAmountInput";const Tx={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},Ix=e=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e,ha=({isOpen:e,title:s,confirmLabel:n,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:p,isKeyboardDismissDisabled:m=!1,hideIcon:h=!1,icon:f,"data-testid":b="confirm-dialog"})=>{const y=i??o??null,g=Tx[d],v=h?null:Ix(f??g.icon);return t.jsx(as,{isOpen:e,onOpenChange:j=>r?.(j),placement:"center",size:"md",isDismissable:(p??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":b,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[v?t.jsx("div",{"aria-hidden":"true","data-testid":`${b}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",g.tile),children:v}):null,t.jsx("span",{"data-testid":`${b}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),y!==null?t.jsx(c.ModalBody,{"data-testid":`${b}-body`,className:"gap-0 p-0",children:typeof y=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:y}):y}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(O,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${b}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(O,{color:g.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${b}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};ha.displayName="ConfirmDialog";const vt={item:"list-none",box:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",body:"gap-3 px-4 py-3",text:"flex min-w-0 flex-col gap-1",message:"text-sm text-gray-900 [overflow-wrap:anywhere]",description:"text-sm text-gray-600 [overflow-wrap:anywhere]",actions:"flex flex-wrap items-center gap-2"},Ox={danger:"bg-danger-50",warning:"bg-warning-50"},vo=({message:e,description:s,confirmLabel:n,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:p="sm",as:m="div",className:h,"data-testid":f="inline-confirm"})=>{const b=x.useId(),y=x.useId(),g=x.useRef(null),v=x.useRef(null),j=x.useRef(null),A=s!=null,w=x.useRef({isPending:l,containEscape:u,onCancel:i});w.current={isPending:l,containEscape:u,onCancel:i},x.useEffect(()=>{(d==="confirm"?v:j).current?.focus()},[]),x.useEffect(()=>{const N=g.current;if(N===null)return;const C=k=>{k.key==="Escape"&&(w.current.containEscape&&k.stopPropagation(),!w.current.isPending&&w.current.onCancel())};return N.addEventListener("keydown",C),()=>N.removeEventListener("keydown",C)},[]);const E=x.useRef(!1);x.useLayoutEffect(()=>{const N=g.current;if(N===null)return;const C=document.activeElement;if(l){const k=C===null||C===document.body||!N.contains(C),_=C instanceof HTMLButtonElement&&C.disabled;E.current&&(k||_)&&N.focus({preventScroll:!0});return}C===N&&(d==="confirm"?v:j).current?.focus()},[l,d]);const $=t.jsx(c.Card,{ref:g,role:"alertdialog","aria-modal":"false","aria-labelledby":b,"aria-describedby":A?y:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{E.current=!0},onBlur:N=>{const C=N.relatedTarget;E.current=C instanceof Node&&N.currentTarget.contains(C)},className:c.cn(vt.box,Ox[o],m==="div"&&h),"data-testid":f,children:t.jsxs(c.CardBody,{className:vt.body,children:[t.jsxs("div",{className:vt.text,children:[t.jsx("p",{id:b,className:vt.message,children:e}),A?t.jsx("p",{id:y,className:vt.description,children:s}):null]}),t.jsxs("div",{className:vt.actions,children:[t.jsx(O,{ref:v,size:p,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:n}),t.jsx(O,{ref:j,size:p,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(vt.item,h),children:$}):$};vo.displayName="InlineConfirm";const zx={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Hs=x.createContext(zx),ba=x.createContext(null);function Bx(e){const{report:s,unreport:n}=x.useContext(Hs),a=x.useContext(ba),r=x.useId();x.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),x.useEffect(()=>()=>n(r),[n,r])}function Vx(){const{guardScope:e,bypass:s}=x.useContext(Hs);return x.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function wo(){const{guardScope:e}=x.useContext(Hs),s=x.useContext(ba);return x.useCallback(n=>e(s,n),[e,s])}const Ux=({scope:e,children:s})=>t.jsx(ba.Provider,{value:e,children:s}),jo=({guard:e,children:s,title:n="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:p,report:m,unreport:h,guardScope:f}=e.internals,b=x.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:h}),[f,e.bypass,m,h]);return t.jsxs(Hs.Provider,{value:b,children:[s,t.jsx(ha,{isOpen:l!==null,onOpenChange:y=>{y||p()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};jo.displayName="DiscardGuard";const ga=x.createContext(null);function Hx(){const e=x.useContext(ga),s=wo(),n=e?.back,a=x.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const Wx=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function qx(e){for(const s of e.querySelectorAll(Wx))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function _r(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const Gx=new Set(["menu","listbox","dialog","grid","tree"]);function Kx(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||Gx.has(n.getAttribute("role")??""))return n}return null}const Rr="react-aria-focus-scope-restore";class Yx{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&_r(s.last,n)?s.last:null)??(_r(s.entry,n)?s.entry:null)??qx(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?Kx(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const Qx="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Zx="min-w-0 flex-1 truncate text-large font-semibold",Xx="flex shrink-0 items-center gap-2",Jx="size-5";function eh({panels:e,children:s}){const[n]=x.useState(()=>new Yx),{entries:a,back:r}=e,i=a[a.length-1].key,o=x.useRef(null);return x.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(th,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const th=({entryKey:e,isActive:s,canGoBack:n,back:a,memory:r,children:i})=>{const o=x.useRef(null),l=x.useCallback(u=>r.setEntry(e,u),[r,e]);x.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const p=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Rr,p),()=>{u.removeEventListener(Rr,p),r.setContainer(e,null)}},[r,e]);const d=x.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(ga.Provider,{value:d,children:t.jsx(Ux,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},No=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=x.useContext(ga),u=wo(),p=x.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Qx,o),"data-testid":l,children:[m?t.jsx(O,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":p,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(M,{icon:"solar:arrow-left-outline",className:Jx,"aria-hidden":"true"})}):null,t.jsx("h2",{id:p,className:Zx,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:Xx,children:i}):null]})};No.displayName="ModalPanelHeader";function sh(e){const s=x.useRef(1),[n]=x.useState(e),[a,r]=x.useState(()=>[{key:"panel-0",panel:e}]),i=x.useCallback(p=>{const m=`panel-${s.current}`;return s.current+=1,{key:m,panel:p}},[]),o=x.useCallback(p=>{const m=i(p);r(h=>[...h,m])},[i]),l=x.useCallback(()=>{r(p=>p.length>1?p.slice(0,-1):p)},[]),d=x.useCallback(p=>{const m=i(p);r(h=>[...h.slice(0,-1),m])},[i]),u=x.useCallback(p=>{r([i(p===void 0?n:p)])},[i,n]);return x.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function nh(){const e=x.useRef(new Map),[s,n]=x.useState(0),[a,r]=x.useState(null),[i,o]=x.useState(0),l=x.useCallback(()=>{let g=0;for(const v of e.current.values())v.isDirty&&(g+=1);n(g)},[]),d=x.useCallback((g,v)=>{e.current.set(g,v),l()},[l]),u=x.useCallback(g=>{e.current.delete(g),l()},[l]),p=x.useCallback((g,v)=>{let j=!1;for(const A of e.current.values())A.isDirty&&(g===null||A.scope===g)&&(j=!0);j?r({leave:v}):v()},[]),m=x.useCallback(g=>p(null,g),[p]),h=x.useCallback(g=>{for(const v of e.current.values())v.isDirty=!1;l(),r(null),g()},[l]),f=x.useCallback(g=>v=>{v?g(!0):m(()=>g(!1))},[m]),b=x.useCallback(()=>{const g=a?.leave;r(null),o(v=>v+1),g?.()},[a]),y=x.useCallback(()=>r(null),[]);return x.useMemo(()=>({isDirty:s>0,guard:m,bypass:h,guardOpenChange:f,internals:{pending:a,confirmKey:i,confirm:b,keepEditing:y,report:d,unreport:u,guardScope:p}}),[s,m,h,f,a,i,b,y,d,u,p])}const ah=60,rh=(e,s,n=ah)=>s?e>n:e<-n,Co=(e,s)=>Math.max(0,Math.min(e,s)),ih=160,lh=(e,s,n=ih)=>Math.min(e,Math.max(0,s-n)),oh=(e,s,n)=>Co(e-s,n),ch=(e,s,n)=>e!==null?Co(e,n):s?n:0,dh=e=>e?"":"transition-[height] duration-300 ease-out",uh=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(oh(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{rh(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ct=(e,s)=>fe(e.value,s,e.currency),Mr=`opacity-60 transition-opacity ${je}`,ya=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:Ge[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&Mr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:c.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&Mr),children:Ct(e.amount,s)}),l&&t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>n(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),ne(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,p)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??p}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??p}`,className:"flex shrink-0 items-center",children:t.jsx(M,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??p)),o&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(ya,{item:u,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};ya.displayName="SummaryItemRow";const ko=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ct(e.amount,s)})]});ko.displayName="SummaryServiceFeeRow";const va=({row:e,locale:s,emphasized:n,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(n?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(O,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",o&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:c.cn("whitespace-nowrap",!o&&"text-base",e.amountTone==="success"&&"text-success"),children:Ct(e.amount,s)})]})};va.displayName="SummaryTotalsLineRow";const So=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:p,emptyState:m,compact:h=!1,classNames:f})=>{const b=(n?.length??0)>0;return t.jsxs(t.Fragment,{children:[!h&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),b?t.jsx("div",{className:c.cn(h?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:n.map(y=>t.jsx(ya,{item:y,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:p,compact:h},y.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(ko,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(h?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((y,g)=>t.jsx(va,{row:y,locale:i,emphasized:!h&&g===0,onRemove:d,removeAriaLabel:u,showRemoveButton:p,compact:h},y.key))})]})};So.displayName="SummaryBody";const $o=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:Ct(e.amount,s)})]})};$o.displayName="SummaryGrandTotalRow";const Ao=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ct(e.amount,s)})]});Ao.displayName="SummarySecondaryTotalRow";const _s=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(O,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});_s.displayName="SummaryPrimaryCta";const Eo=({title:e,total:s,secondaryTotal:n,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(M,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:Ct(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:Ct(n.amount,a)})]})]})]})});Eo.displayName="SummaryCollapseHeader";const Do=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(M,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});Do.displayName="SummaryCartButton";const Lo=({open:e,progress:s,dragging:n,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:p})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",p.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(Do,{cart:i,ariaLabel:o,className:p.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(_s,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",p.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(_s,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",p.cta)})})]}),l&&t.jsx("div",{children:l})]});Lo.displayName="SummaryActionBar";const mh="(max-width: 767px)",fh=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,ph=(e=mh)=>{const[s,n]=x.useState(()=>fh(e));return x.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Fo=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:p,secondaryTotal:m,collapsible:h,isOpen:f,onToggleOpen:b,defaultOpen:y=!1,primaryAction:g,isLoading:v=!1,onRemoveItem:j,showRemoveButton:A,ctaCaption:w,ctaError:E,variant:$,cart:N,emptyState:C,labels:k,classNames:_={},density:F="default","data-testid":D="summary",className:P})=>{const T=k?.removeAriaLabel??"Remove item",W=k?.removeTotalRowAriaLabel??"Remove discount",Y=k?.removePostTotalRowAriaLabel??"Remove applied code",z=k?.toggleAriaLabel??"Toggle summary",G=k?.cartAriaLabel??"View cart",K=F==="compact",ae=ph(),oe=h??($??(ae?"mobile":"main"))==="mobile",[ee,q]=x.useState(y),ie=f!==void 0,V=!oe||(ie?f:ee),te=x.useCallback(()=>{ie||q(I=>!I),b?.()},[ie,b]),[se,_e]=x.useState(0),[X,he]=x.useState(null),nt=x.useRef(null),Ke=x.useRef(null),ve=x.useCallback(()=>{const I=nt.current;I&&_e(lh(I.scrollHeight,window.innerHeight))},[]),Ye=x.useCallback(I=>{Ke.current?.disconnect(),Ke.current=null,nt.current=I,I&&(ve(),typeof ResizeObserver<"u"&&(Ke.current=new ResizeObserver(ve),Ke.current.observe(I)))},[ve]);x.useEffect(()=>(window.addEventListener("resize",ve),()=>window.removeEventListener("resize",ve)),[ve]);const mt=uh({open:V,fullHeight:se,setDragHeight:he,onToggleOpen:te}),Qe=X!==null,me=ch(X,V,se),$e=se>0?Math.min(1,Math.max(0,me/se)):V?1:0,at=t.jsx($o,{total:l,locale:a,compact:K,className:_.total}),S=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(I=>t.jsx(va,{row:I,locale:a,emphasized:!1,onRemove:p,removeAriaLabel:Y,showRemoveButton:A,compact:K},I.key))}),L=m&&t.jsx(Ao,{secondaryTotal:m,locale:a,className:_.secondaryTotal}),R=w!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:w}),U=E!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:E}),B=t.jsx(So,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:j,removeAriaLabel:T,onRemoveTotalRow:u,removeTotalRowAriaLabel:W,showRemoveButton:A,emptyState:C,compact:K,classNames:_});return oe?t.jsxs(Ie.motion.section,{"data-testid":D,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:mt.onDrag,onDragEnd:mt.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",P,_.base),children:[t.jsx(Eo,{title:e,total:l,secondaryTotal:m,locale:a,open:V,progress:$e,dragging:Qe,toggleAriaLabel:z,onToggleOpen:te,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!V,style:{height:me},className:c.cn("min-h-0",V&&!Qe?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!V&&"pointer-events-none",dh(Qe)),children:t.jsxs("div",{ref:Ye,className:K?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[B,!K&&t.jsx(c.Divider,{className:"bg-default-200"}),at,S,L]})}),t.jsx(Lo,{open:V,progress:$e,dragging:Qe,primaryAction:g,isLoading:v,cart:N,cartAriaLabel:G,ctaCaption:R,ctaError:U,onToggleOpen:te,classNames:_})]}):t.jsxs("section",{"data-testid":D,className:c.cn(K?"flex w-full flex-col gap-3 rounded-2xl border border-default-200 bg-content1 p-4":"flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",P,_.base),children:[!K&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),B,!K&&t.jsx(c.Divider,{className:"bg-default-200"}),at,S,L,m&&g&&t.jsx(c.Divider,{className:"bg-default-200"}),g&&t.jsx(_s,{action:g,disabledByLoading:v,className:c.cn("w-full",_.cta)}),U,R]})};Fo.displayName="Summary";const it={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},Pr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},xh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},hh={ariaLabel:"Progress",completed:"completed"},wa=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...hh,...i},u=e.filter(h=>h.state!=="skipped"),p=Math.max(0,u.findIndex(h=>h.id===s)),m=h=>h<p?"done":h===p?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(it.list,o),"data-testid":l,children:u.map((h,f)=>{const b=m(f),y=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(it.segment,"w-full",Pr[b]),"data-testid":`${l}-segment-${h.id}`}),t.jsxs("span",{className:c.cn(it.name,xh[b]),"data-testid":`${l}-name-${h.id}`,children:[b==="done"&&t.jsx("span",{"aria-hidden":"true",className:it.check,"data-testid":`${l}-check-${h.id}`,children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:h.label}),b==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),g=r?r(h.id,f):f<p,v=b==="active"?"step":void 0;return t.jsx("li",{className:it.item,"aria-current":a?void 0:v,"data-state":b,"data-testid":`${l}-step-${h.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(it.step,it.button),disabled:!g,"aria-current":v,onClick:()=>a(h.id),"data-testid":`${l}-button-${h.id}`,children:y}):t.jsx("div",{className:it.step,children:y})},h.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(it.bare,o),"data-testid":l,children:u.map((h,f)=>t.jsx("span",{className:c.cn(it.segment,"flex-1",Pr[m(f)]),"data-state":m(f)},h.id))})};wa.displayName="StepProgress";const bh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},gh={backgroundColor:le.destructive,color:"#fff"},yh={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},pn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",xn="absolute top-0 h-5 w-5 opacity-0",_o=({onClose:e,steps:s,activeStepId:n,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:p,className:m,"data-testid":h="wizard-shell",children:f})=>{const b={...bh,...p},y=s.find(j=>j.id===n),g=r??e,v=r?b.back:b.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":h,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${h}-header`,children:[g&&t.jsx(O,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:g,"data-testid":`${h}-header-back`,startContent:t.jsx(M,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:v}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${h}-header-title`,children:y?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${h}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${h}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":b.close,onClick:e,className:c.cn(xn,"left-0"),"data-testid":`${h}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":b.back,onClick:r,className:c.cn(xn,"left-6"),"data-testid":`${h}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(xn,"left-12"),"data-testid":`${h}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${h}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:b.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${h}-total-of`,children:fe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(pn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${h}-total-partial`,children:b.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(pn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${h}-total-owes`,children:b.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:pn,style:yh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${h}-total-badge`,children:o.badge.label})]}),t.jsx(O,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?gh:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${h}-primary`,children:i.label})]})]}),t.jsx(wa,{steps:s,activeStepId:n,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${h}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${h}-body`,children:f}),u]})};_o.displayName="WizardShell";const vh=(e,s,n)=>Math.min(Math.max(e,s),n);function Rn(e,s,n){const a=Math.max(1,Math.trunc(s)),r=vh(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Pt(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function wh(e,s){return Rn(e,s,1)}const jh=e=>Number.isFinite(e)?e.toFixed(2):"",Mn=({value:e,expected:s,max:n,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,p]=x.useState(null),m=x.useRef(null),h=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",h?"border-primary bg-primary-50":"border-pos-line bg-white",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??jh(e),onChange:f=>{const b=f.target.value,y=Number.parseFloat(b.replace(",","."));n!==void 0&&Number.isFinite(y)&&y>n+.004||(p(b),Number.isFinite(y)&&y>=0?a(y):b.trim()===""&&a(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>p(null),"data-testid":d})]})};Mn.displayName="AmountCell";const Nh={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer (price adjustment)",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},Ch="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",Tr="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",hn="absolute h-5 w-5 opacity-0",kh=e=>{const s=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=wh(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(n.value,void 0,n.currency)} · ${s}`},Ro=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...Nh,...o},p=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const h=s[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",b=`${d}-row-${m.id}`,y=Math.max(1,Math.trunc(m.quantity)),g=h?.quantity,v=h?.selected?Math.min(g??y,y):g??0,j=Rn(m.paidAmount,y,v).value,A=h?.amount??(h?.selected?j:0),w=v===0&&A>.004,E=N=>n(m.id,{selected:N.quantity>0||N.amount>.004,mode:"full",...N}),$=N=>{const C=Math.min(Math.max(N,0),y);E({quantity:C,amount:Rn(m.paidAmount,y,C).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":b,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${b}-icon`,children:t.jsx(M,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${b}-detail`,children:m.detail??kh(m)}),w&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${b}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${b}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(Mn,{value:A,expected:j,max:m.paidAmount.value,onChange:N=>E({quantity:v,amount:N}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${b}-amount`,inputTestId:`${b}-partial-input-field`}),f?t.jsx("span",{className:Ch,"data-testid":`${b}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${b}-qty`,children:[t.jsx("button",{type:"button",className:Tr,"aria-label":u.decrease.replace("{name}",m.name),disabled:v===0,onClick:()=>$(v-1),"data-testid":`${b}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${b}-qty-value`,children:v}),t.jsx("button",{type:"button",className:Tr,"aria-label":u.increase.replace("{name}",m.name),disabled:v===y,onClick:()=>$(v+1),"data-testid":`${b}-qty-increase`,children:"+"})]})]})]}),v>=y&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${b}-max-note`,children:u.maxNote.replace("{count}",String(y))}),h?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${b}-warning`,children:[t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),v>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(st,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:N=>{if(N==="all")return;const C=[...N][0];C&&(r?.(m.id,C),a(m.id,C==="stock"))},"data-testid":`${b}-restock`,children:p.map(N=>t.jsx(c.SelectItem,{children:N.label},N.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(hn,"right-0 top-0 m-0 p-0"),isSelected:!!h?.selected,onValueChange:N=>n(m.id,{selected:N,mode:"full"}),"aria-label":m.name,"data-testid":`${b}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${b}-partial-input-field"]`)?.focus(),className:c.cn(hn,"left-0 top-0"),"data-testid":`${b}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>E({quantity:v,amount:j}),className:c.cn(hn,"left-5 top-0"),"data-testid":`${b}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(M,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(Mn,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(M,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Ro.displayName="LineItemList";const Sh={color:le.danger},Mo=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Mo.displayName="MetaCard";const Po=({label:e,htmlFor:s,required:n,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Sh,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Po.displayName="MetaCard.Row";const To=({label:e,children:s,className:n,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});To.displayName="MetaCard.Section";const $h=Object.assign(Mo,{Row:Po,Section:To}),Io=({heading:e,icon:s="lucide:rotate-ccw",action:n,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(M,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(M,{icon:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});Io.displayName="SectionPanel";const Oo=({name:e,detail:s,icon:n="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:n,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});Oo.displayName="CustomerCard";const Ah={label:"Reason for the return",placeholder:"Select a reason…"},zo=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...Ah,...i};return t.jsx(st,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const p=[...u][0];p&&n(String(p))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};zo.displayName="ReasonSelect";const Eh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Bo=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...Eh,...i},[u,p]=x.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(O,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>p(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};Bo.displayName="NotesField";const Dh={danger:{surface:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"},warning:{surface:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"}},Lh={danger:"gravity-ui:circle-exclamation-fill",warning:"gravity-ui:triangle-exclamation-fill"},Ir="h-8 min-w-0 rounded-[10px] px-3 text-[13px] font-semibold",Ws=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:p})=>{const m=Dh[e];return t.jsxs("div",{role:"alert",className:c.cn("flex items-start gap-3.5 rounded-[14px] p-4 px-[18px]",m.surface,l),"data-testid":d,children:[t.jsx("div",{className:c.cn("flex h-10 w-10 shrink-0 items-center justify-center rounded-full",m.disc),"aria-hidden":"true",children:t.jsx(M,{icon:Lh[e],width:22,height:22})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[s&&t.jsx("p",{className:c.cn("font-semibold",m.title),children:s}),t.jsx("p",{className:"mt-0.5 text-[13px] text-default-600",children:n}),t.jsxs("div",{className:"mt-3 flex gap-2.5",children:[a&&t.jsx(O,{color:"primary",className:Ir,onPress:a,"data-testid":u,children:r}),t.jsx(O,{variant:"bordered",className:c.cn(Ir,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":p,children:o})]})]})]})};Ws.displayName="TenderBanner";const Fh={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},_h={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},Vo=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...Fh,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(Ws,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(p=>{const m=p.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(p.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${p.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(M,{icon:_h[p.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:p.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(p.maxRefundable.value,void 0,p.maxRefundable.currency)})]})]},p.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};Vo.displayName="TenderMethods";const Rh=e=>e.refunded!==null,Mh={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},Ph="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Th="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Uo=({parts:e,refundedSoFar:s,remaining:n,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:p,className:m,"data-testid":h="split-tender-panel"})=>{const f={...Mh,...p},b=e.filter(Rh),y=e.find(N=>N.tenderId===a.tenderId)?.label,g=!!(r?.length&&a.onTenderChange),v=Pt(n.currency),{draft:j,setDraft:A,normalize:w}=io(a.amount,String),E=x.useCallback(N=>{fa(N,v)&&(A(N),a.onAmountChange(ns(N)??0))},[a,A,v]),$=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":h,children:[t.jsx("h3",{className:"sr-only","data-testid":`${h}-title`,children:f.title}),o&&t.jsx(Ws,{tone:$?"danger":"warning",title:$?f.declinedTitle:f.networkTitle,body:$?f.partDeclinedBody:f.partNetworkBody,onRetry:o.onRetry,retryLabel:f.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${h}-part-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{"data-testid":`${h}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:fe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",fe(s.value,void 0,s.currency)]})]}),b.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Ph,children:f.refundedSoFar}),b.map((N,C)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${h}-part-${N.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",C+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(M,{icon:N.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:N.label}),N.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:N.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(N.refunded.value,void 0,N.refunded.currency)}),t.jsx("span",{className:c.cn(Th,N.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:N.status==="pending"?f.pending:f.succeeded})]},N.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${h}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:f.partHeading.replace("{n}",String(b.length+1))}),y&&t.jsx("span",{className:"text-xs text-default-500",children:y})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${h}-amount-label`,children:f.amountForPart}),t.jsx(xa,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:j,onChange:E,onBlur:w,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${h}-amount`}),g&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${h}-methods`,children:r?.map(N=>{const C=N.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":C,disabled:N.disabled||d,onClick:()=>a.onTenderChange?.(N.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",C?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${h}-method-${N.tenderId}`,children:[N.icon&&t.jsx(M,{icon:N.icon,width:15,height:15,"aria-hidden":"true"}),N.label]},N.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(O,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${h}-back`,children:f.back}),t.jsx(O,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${h}-submit`,children:f.submit})]})]})};Uo.displayName="SplitTenderPanel";const Ho="hsl(var(--heroui-primary))",Ih="hsl(var(--heroui-primary) / 0.05)",Wo="hsl(var(--heroui-default-100))",qo="hsl(var(--heroui-default-600))",ja={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},Oh={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:Ho,backgroundColor:Ih},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Rs={idle:{backgroundColor:Wo,color:qo},selected:{backgroundColor:Ho,color:"#fff"}},zh={backgroundColor:Wo,color:qo},Bh={borderColor:le.line},Or={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},Vh={heading:"Money back to",upTo:"Up to {amount}",noCap:"Tap to add an amount",amountFor:"Amount to {method}",remove:"Remove {method}",declined:"Declined",pending:"Pending",done:"Refunded",retry:"Try again",chooseDifferent:"Choose different method"},Uh=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},Hh=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",p=u==="pending"||u==="done",m=n||p,h=!!(e.removable&&l),f=e.cap?.currency??s,b=Pt(f),y=`${d}-amount`,g=a.amountFor.replace("{method}",e.label),v=x.useCallback($=>{if(!fa($,b))return;const N=ns($);e.cap&&N!==null&&N>e.cap.value||i(e.id,$)},[b,e.cap,e.id,i]),j=x.useCallback($=>{const N=$.currentTarget;requestAnimationFrame(()=>{N.isConnected&&N.select()})},[]),A=u==="declined"?"declined":e.selected?"selected":"idle",w=e.statusLabel??(u==="idle"?void 0:a[u]),E=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Rs.selected:Rs.idle,"data-testid":`${d}-icon`,children:t.jsx(M,{icon:ja[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&w?t.jsx("span",{className:ce.status,style:Or.declined,"data-testid":`${d}-status`,children:w}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),p&&w&&t.jsx("span",{className:ce.badge,style:Or[u],"data-testid":`${d}-status`,children:w})]});return t.jsxs("div",{className:ce.card,style:Oh[A],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.focusRing,h&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:E}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:y,className:"sr-only",children:g}),t.jsx(c.Input,{id:y,"aria-label":g,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:$=>v($.target.value),onFocus:j,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:Uh(f)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,h&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[E,t.jsx("span",{className:ce.lowerSlot,style:zh,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),h&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:n,onClick:()=>l?.(e.id),className:c.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(M,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},Go=({methods:e,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:p,className:m,"data-testid":h="refund-method-cards"})=>{const f={...Vh,...p};return t.jsxs("div",{className:c.cn(ce.root,m),"data-testid":h,children:[d&&t.jsx(Ws,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:ce.banner,"data-testid":`${h}-error`,retryTestId:`${h}-retry`,chooseDifferentTestId:`${h}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:f.heading}),o&&t.jsx(Vs,{variant:"record",label:o.label,value:o.value,"data-testid":`${h}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:ce.grid,"data-testid":`${h}-grid`,children:[e.map(b=>t.jsx(Hh,{method:b,currency:i,busy:u,labels:f,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${h}-method-${b.id}`},b.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(ce.another,ce.focusRing),style:Bh,"data-testid":`${h}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Rs.idle,children:t.jsx(M,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:b=>l.onPick(String(b)),"data-testid":`${h}-another-menu`,children:b=>t.jsx(c.DropdownItem,{textValue:b.label,description:b.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Rs.idle,children:t.jsx(M,{icon:ja[b.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${h}-another-option-${b.id}`,children:b.label},b.id)})]})]})]})};Go.displayName="RefundMethodCards";const Oe={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},Ko="hsl(var(--heroui-primary))",Wh={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:Ko,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},zr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:Ko,color:"#fff"}},qh={backgroundColor:"#fff",color:le.neutral},Et=e=>({color:Ge[e].fg,backgroundColor:Ge[e].bg}),Gh={queued:Et("neutral"),processing:Et("info"),waiting_reader:Et("warn"),waiting_cash:Et("warn"),done:Et("ok"),failed:Et("danger")},Kh={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},Yh={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Br={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Qh=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",Yo=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Kh,...n},o=s??e.find(Qh)?.id;return t.jsxs("div",{className:c.cn(Oe.root,a),"data-testid":r,children:[t.jsx("p",{className:Oe.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:Oe.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,p=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:Oe.row,style:Wh[p],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:Oe.main,children:[t.jsx("span",{className:Oe.iconBox,style:d?zr.active:zr.idle,children:t.jsx(M,{icon:ja[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:Oe.text,children:[t.jsx("span",{className:Oe.label,children:l.label}),l.note&&t.jsx("span",{className:Oe.note,children:l.note})]}),t.jsx("span",{className:Oe.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:Oe.badge,style:Gh[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(M,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[Yh[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:Oe.prompt,style:qh,"data-testid":`${u}-prompt`,children:[Br[l.status]&&t.jsx(M,{icon:Br[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:Oe.promptText,children:l.prompt}),l.action&&t.jsx(O,{color:"primary",className:Oe.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};Yo.displayName="RefundProgressList";const Zh={label:"Supervisor authorization",placeholder:"••••"},Qo=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...Zh,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(M,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};Qo.displayName="PinField";const Xh={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},Jh={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},eb={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},tb="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",qt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",sb="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",nb=["email","print"],Cs=`${je} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,we={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${Cs}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${Cs}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${Cs}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},Zo=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:p,onSendReceipt:m,receiptActions:h,emailReceipt:f,onDone:b,frameless:y=!1,labels:g,className:v,"data-testid":j="outcome-view"})=>{const A={...Xh,...Jh[s],...g},w=x.useId(),E=n?fe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",v),"aria-live":"polite","data-testid":j,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${j}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${Wi}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:A.processing}),E&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${j}-processing-total`,children:E})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!y&&sb,v),"aria-live":"polite","data-testid":j,children:[t.jsxs("div",{className:c.cn("text-center",s==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:we.changeTitle,"data-testid":`${j}-title`,children:A.title}),t.jsx("p",{className:we.changeLabel,children:A.changeDue}),t.jsx("p",{className:we.changeAmount,"data-testid":`${j}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:we.changeCaption,"data-testid":`${j}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${j}-title`,children:A.title}),E&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${j}-total`,children:E}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${j}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${j}-reason`,children:A.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${j}-paid-with`,children:[t.jsx("p",{className:qt,children:A.paidWithTitle}),o.map(($,N)=>t.jsxs("div",{className:we.paidRow,"data-testid":`${j}-paid-with-${N}`,children:[$.icon&&t.jsx("span",{className:we.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(M,{icon:$.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:we.paidLabel,children:$.label}),t.jsx("span",{className:we.paidAmount,children:fe($.amount.value,void 0,$.amount.currency)}),$.status&&t.jsx("span",{className:we.paidStatus,children:$.status})]},`${$.label}-${N}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${j}-outcome`,children:[t.jsx("p",{className:qt,children:A.outcomeTitle}),t.jsx("div",{className:we.groups,children:l.map(($,N)=>t.jsxs("div",{"data-testid":`${j}-outcome-${N}`,children:[t.jsx("p",{className:we.groupLabel,children:$.label}),t.jsx("ul",{className:we.groupItems,"aria-label":$.label,children:$.items.map((C,k)=>t.jsx("li",{className:we.groupItem,children:C},`${C}-${k}`))})]},`${$.label}-${N}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:qt,children:A.destinationsTitle}),a.map(($,N)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${j}-destination-${N}-${$.status}`,children:[t.jsx("span",{className:"font-semibold",children:$.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe($.amount.value,void 0,$.amount.currency)}),t.jsx("span",{className:c.cn(tb,eb[$.status]),children:$.status==="succeeded"?A.succeeded:A.pending})]})]},`${$.label}-${N}`))]}),h&&h.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${j}-receipt-actions`,children:[t.jsx("p",{className:qt,children:A.sendReceipt}),t.jsx("div",{className:we.receiptRow,children:h.map($=>t.jsx(ab,{action:$,controls:$.expanded?w:void 0,"data-testid":`${j}-receipt-action-${$.key}`},$.key))}),f&&t.jsx(rb,{id:w,email:f,labels:A,"data-testid":`${j}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:qt,children:A.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:nb.map($=>{const N=p?.includes($)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":N,onClick:()=>m($),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${je}`,"data-testid":`${j}-receipt-${$}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:N,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:A[$]})]},$)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${j}-authorized-by`,children:A.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(O,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${Cs}`,onPress:b,"data-testid":`${j}-done`,children:A.done})})]})};Zo.displayName="OutcomeView";function ab({action:e,controls:s,"data-testid":n}){return t.jsx(O,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(we.receiptAction,e.expanded&&we.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(M,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":n,children:e.label})}function rb({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:we.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(we.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:we.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(O,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:we.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(M,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${je}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(O,{color:"secondary",className:we.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Me={base:"relative inline-grid min-w-[var(--filter-select-min)] max-w-max shrink grow basis-[var(--filter-select-min)] grid-cols-[minmax(0,1fr)] [--filter-select-min:6rem]",baseActive:"[--filter-select-min:8rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 max-w-[20rem] overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[2.0625rem] text-[0.875rem]",sizerActive:"pr-[3.4375rem] font-semibold",select:"w-full [contain:inline-size]",trigger:"h-[2.375rem] min-h-[2.375rem] rounded-[0.625rem] border-medium border-pos-field bg-white px-2 shadow-none data-[hover=true]:border-default-300 data-[focus=true]:border-primary data-[open=true]:border-primary data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-primary data-[focus-visible=true]:ring-offset-1",triggerActive:"!border-acct-rust-border !bg-acct-rust-fill pr-[1.875rem]",value:"text-[0.875rem] !text-default-900",valueActive:"font-semibold !text-primary-600",iconActive:"!text-primary-600",clear:"absolute right-[1.875rem] top-1/2 z-20 inline-flex size-[1.25rem] -translate-y-1/2 items-center justify-center rounded-md text-primary-600 outline-none hover:bg-white/70 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",clearIcon:"size-[0.8125rem]",optionTitle:"whitespace-normal break-words"},ib="grid shrink grow basis-0 grid-flow-col auto-cols-auto gap-2.5 [--filter-select-cap:16rem] max-w-[calc(var(--filter-select-count)*var(--filter-select-cap)+(var(--filter-select-count)-1)*0.625rem)] [&>[data-slot=filter-select]]:max-w-none",lb="calc(100vw - 1.5rem)",Xo=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(f=>f.value===s)?.label:void 0,u=x.useRef(null),p=x.useRef(null),[m,h]=x.useState();return t.jsxs("div",{ref:u,"data-testid":o,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:c.cn(Me.base,l&&Me.baseActive),style:i===void 0?void 0:{"--filter-select-min":dt(i)},children:[t.jsx(st,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const b=[...f][0];a(b===void 0?null:String(b))},onOpenChange:f=>{f&&h(u.current?.getBoundingClientRect().width)},popoverProps:{ref:p,placement:"bottom-start",style:{minWidth:m,maxWidth:lb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Me.select,Me.cell),trigger:c.cn(Me.trigger,l&&Me.triggerActive),value:c.cn(Me.value,l&&Me.valueActive),selectorIcon:c.cn(l&&Me.iconActive)},children:n.map(f=>t.jsx(c.SelectItem,{classNames:{title:Me.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Me.sizer,l&&Me.sizerActive,Me.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${o}-clear`,className:Me.clear,children:t.jsx(M,{icon:"lucide:x",className:Me.clearIcon,"aria-hidden":"true"})})]})};Xo.displayName="FilterSelect";const Jo=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(ib,s),style:{"--filter-select-count":x.Children.toArray(e).length},children:e});Jo.displayName="FilterSelectGroup";const ht={base:"flex flex-wrap items-center justify-center gap-2.5 border-t border-pos-hair px-5 py-[0.875rem] text-[0.84375rem] text-default-500",idle:"w-full",sentinel:"h-px w-full",spinner:"inline-flex",error:"text-pos-danger"},ec=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=x.useRef(null),d=x.useRef(s),u=x.useRef(!1);return x.useEffect(()=>{d.current=s},[s]),x.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const p=l.current;if(!p||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(h=>{u.current||!h.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(p),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:ht.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:ht.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:ht.base,children:[t.jsx("span",{"aria-hidden":"true",className:ht.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:ht.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:ht.error,children:a}),t.jsx(O,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?ht.base:ht.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};ec.displayName="LoadMoreFooter";const ke={base:"w-full",list:"m-0 list-none p-0",item:"relative border-b border-pos-hair last:border-b-0",card:"block w-full px-4 py-[0.875rem] text-left",cardInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${je}`,headline:"flex items-baseline gap-2.5",headlineWithActions:"pr-[3.25rem]",title:"min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]",amount:"ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900",actions:"absolute right-4 top-[0.1875rem] z-[1]",chips:"mt-[0.5625rem] flex flex-wrap gap-1.5",chipsLine:"mt-[0.5625rem] flex items-center gap-2.5",chipsInline:"flex min-w-0 flex-wrap gap-1.5",rows:"mt-[0.5625rem] block",row:"flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]",rowLabel:"shrink-0 text-default-500",rowValue:"ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]",skeletonRow:"border-b border-pos-hair p-4 last:border-b-0"},Vr=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(ke.headline,s&&ke.headlineWithActions),children:[t.jsx("span",{className:ke.title,children:e.title}),ne(e.amount)&&!s&&t.jsx("span",{className:ke.amount,children:e.amount})]}),s?(ne(e.chips)||ne(e.amount))&&t.jsxs("span",{className:ke.chipsLine,children:[ne(e.chips)&&t.jsx("span",{className:ke.chipsInline,children:e.chips}),ne(e.amount)&&t.jsx("span",{className:ke.amount,children:e.amount})]}):ne(e.chips)&&t.jsx("span",{className:ke.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:ke.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:ke.row,children:[t.jsx("span",{className:ke.rowLabel,children:n.label}),t.jsx("span",{className:ke.rowValue,children:n.value})]},a))})]}),tc=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:ke.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:ke.skeletonRow,children:[t.jsx("div",{className:js,style:{height:dt(13),width:dt(130)}}),t.jsx("div",{className:js,style:{height:dt(11),width:"70%",marginTop:dt(10)}}),t.jsx("div",{className:js,style:{height:dt(11),width:"45%",marginTop:dt(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:ke.list,children:e.map(o=>{const l=ne(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:ke.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn(ke.card,ke.cardInteractive),children:t.jsx(Vr,{item:o,withActions:l})}):t.jsx("div",{className:ke.card,children:t.jsx(Vr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:ke.actions,children:o.actions})]},o.id)})})});tc.displayName="CardList";const ob=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`,band:"flex items-center gap-2.5 border-b border-pos-hair bg-pos-page px-4 py-2.5",back:`inline-flex size-[1.625rem] shrink-0 items-center justify-center rounded-[0.625rem] text-default-500 outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${je}`,backIcon:"size-[0.875rem]",breadcrumb:"min-w-0 flex-1",breadcrumbList:"flex-nowrap gap-[0.375rem]",crumbBase:"min-w-0",crumb:"whitespace-nowrap text-[0.875rem] text-default-500 data-[disabled=true]:opacity-100 data-[current=true]:overflow-hidden data-[current=true]:font-normal data-[current=true]:text-default-900",crumbSeparator:"ms-[0.375rem] px-0 text-default-400 data-[disabled=true]:opacity-100",body:"flex flex-wrap gap-5",bodyWide:"px-5 pb-5 pt-[1.125rem]",bodyNarrow:"p-4",identity:"min-w-0 flex-[1_1_18.75rem]",title:"m-0 font-semibold tracking-[-.02em] text-default-900 [overflow-wrap:anywhere]",titleWide:"text-[1.5rem]",titleNarrow:"text-[1.3125rem]",meta:"m-0 mt-[0.6875rem] flex list-none flex-col gap-[0.4375rem] p-0",metaLine:"flex min-w-0 items-center gap-[0.5625rem] text-[0.84375rem] text-default-700",metaIcon:"flex shrink-0 text-default-400 [&_svg]:size-[0.9375rem]",metaText:"min-w-0 truncate",money:"flex flex-col gap-[0.3125rem]",moneyWide:"ml-auto min-w-[12.5rem] flex-none items-end text-right",moneyNarrow:"w-full items-start text-left",amountLabel:"text-[0.8125rem] text-default-500",amount:"whitespace-nowrap font-bold tracking-[-.03em] tabular-nums text-default-900",amountWide:"text-[1.9375rem] leading-[1.1]",amountNarrow:"text-[1.6875rem] leading-[1.1]",amountCaption:"text-[0.8125rem] text-default-500",recordId:"text-[0.8125rem] text-default-500",chips:"mt-[0.1875rem] flex flex-wrap gap-1.5",chipsWide:"justify-end",chipsNarrow:"justify-start",statItems:"m-0 mt-2.5 flex flex-wrap gap-[1.375rem]",stat:"flex flex-col-reverse",statWide:"text-right",statNarrow:"text-left",statValue:"m-0 text-[0.9375rem] font-bold tabular-nums text-default-900",statLabel:"mt-0.5 text-[0.75rem] text-default-500",statsWide:"px-5 pb-5",statsNarrow:"px-4 pb-4"},sc=x.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));sc.displayName="CrumbBase";const nc=({breadcrumb:e=[],onBack:s,backLabel:n,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:p,stats:m,banner:h,"data-testid":f="record-header"})=>{const{ref:b,width:y}=It(),g=!ls(y,ob),v=e.length>0||!!s,j=!!(p&&p.length>0),A=!!i||ne(o)||ne(l)||ne(d)||ne(u)||j;return t.jsxs("div",{ref:b,"data-testid":f,"data-size":g?"narrow":"wide",className:re.base,children:[v&&t.jsxs("div",{"data-testid":`${f}-band`,className:re.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${f}-back`,className:re.back,children:t.jsx(M,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((w,E)=>t.jsx(c.BreadcrumbItem,{as:sc,"data-testid":`${f}-crumb-${E}`,isDisabled:!w.onClick&&E<e.length-1,onPress:w.onClick?()=>w.onClick?.():void 0,children:w.label},E))})]}),t.jsxs("div",{className:c.cn(re.body,g?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:c.cn(re.title,g?re.titleNarrow:re.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:re.meta,children:r.map((w,E)=>t.jsxs("li",{className:re.metaLine,children:[w.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:w.icon}),t.jsx("span",{className:re.metaText,children:w.text})]},E))})]}),A&&t.jsxs("div",{"data-testid":`${f}-money`,className:c.cn(re.money,g?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),ne(o)&&t.jsx("div",{"data-testid":`${f}-amount`,className:c.cn(re.amount,g?re.amountNarrow:re.amountWide),children:o}),ne(l)&&t.jsx("div",{className:re.amountCaption,children:l}),ne(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:re.recordId,children:d}),ne(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:c.cn(re.chips,g?re.chipsNarrow:re.chipsWide),children:u}),j&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:re.statItems,children:p?.map((w,E)=>t.jsxs("div",{"data-testid":`${f}-stat-${E}`,className:c.cn(re.stat,g?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${E}-label`,className:re.statLabel,children:w.label}),t.jsx("dd",{"data-testid":`${f}-stat-${E}-value`,className:re.statValue,style:w.tone?{color:Ge[w.tone].fg}:void 0,children:w.value})]},w.id??E))})]})]}),ne(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:g?re.statsNarrow:re.statsWide,children:m}),ne(h)&&t.jsx("div",{"data-testid":`${f}-banner`,children:h})]})};nc.displayName="RecordHeader";const cb=50,Gt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},ac=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=It(),i=ne(s),o=i&&r>0&&ls(r,cb),l=t.jsx("div",{"data-testid":`${n}-main`,className:Gt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:Gt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(Gt.base,o?Gt.split:Gt.stacked),children:o?[l,d]:[d,l]})};ac.displayName="RecordLayout";const db=560,Kt={base:"grid gap-3",tile:"min-w-0 rounded-[14px] border border-pos-line bg-white px-[18px] py-4 shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",value:"text-[23px] font-bold leading-[1.2] tracking-[-.02em] tabular-nums text-default-900 [overflow-wrap:anywhere]",label:"mt-[5px] text-[13.5px] text-default-500",caption:"mt-0.5 text-[12.5px] text-default-500"},rc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=It(),r=a>=Tp?Math.max(e.length,1):a>=db?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:Kt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:Kt.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:Kt.value,style:i.tone?{color:Ge[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:Kt.label,children:i.label}),ne(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:Kt.caption,children:i.caption})]},o))})};rc.displayName="StatTiles";const ct={base:"mb-3.5 w-full",tabList:"w-full gap-1 rounded-full border border-pos-line bg-default-100 p-1",cursor:"rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,.10)]",tab:"h-auto flex-1 data-[hover-unselected=true]:opacity-100",tabStill:"rounded-full data-[selected=true]:bg-white data-[selected=true]:shadow-[0_1px_3px_rgba(0,0,0,.10)]",tabContent:"leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"flex items-center whitespace-nowrap",icon:"flex shrink-0",count:"rounded-full bg-default-200 py-px leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},ub={md:{tab:"px-[0.875rem] py-[0.5625rem]",tabContent:"text-[0.84375rem]",title:"gap-[0.4375rem]",icon:"[&_svg]:size-4",count:"px-[0.4375rem] text-[0.71875rem]"},lg:{tab:"px-4 py-3",tabContent:"text-base",title:"gap-2",icon:"[&_svg]:size-5",count:"px-2 text-[0.8125rem]"}},Na="pill-tabs",Ca=(e,s=Na)=>`${s}-tab-${e}`,ka=(e,s=Na)=>`${s}-panel-${e}`,mb=(e,s=Na)=>({role:"tabpanel",id:ka(e,s),"aria-labelledby":Ca(e,s),tabIndex:0}),ic=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=rs(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,p=ub[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:ct.base,tabList:ct.tabList,cursor:ct.cursor,tab:c.cn(ct.tab,p.tab,(l||d)&&ct.tabStill),tabContent:c.cn(p.tabContent,ct.tabContent)},children:e.map(m=>{const h=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:Ca(m.key,u),"aria-controls":ka(m.key,u),"data-testid":h,title:t.jsxs("span",{className:c.cn(ct.title,p.title),children:[ne(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn(ct.icon,p.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${h}-count`,className:c.cn(p.count,ct.count),children:m.count})]})},m.key)})})};ic.displayName="PillTabs";const ye={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${je}`,dot:"mt-[0.4375rem] size-[0.4375rem] shrink-0 rounded-full",body:"flex min-w-0 flex-1 flex-col",title:"text-[0.875rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",meta:"mt-1 flex min-w-0 flex-wrap items-center gap-[0.4375rem] text-[0.78125rem] text-default-500",reference:"min-w-0 font-normal text-primary [overflow-wrap:anywhere]",separator:"text-default-400",timestamp:"tabular-nums",detail:"mt-[0.1875rem] text-[0.78125rem] text-default-500 [overflow-wrap:anywhere] [text-wrap:pretty]",trailing:"max-w-[45%] min-w-min shrink-0 text-right text-[0.90625rem]",amount:"whitespace-nowrap text-[0.90625rem] font-bold tabular-nums text-default-900",note:"text-[0.78125rem] italic text-default-500 [overflow-wrap:anywhere]",footer:"flex items-baseline gap-3 border-t border-pos-line bg-pos-page px-5 py-[0.8125rem]",footerLabel:"min-w-0 text-[0.875rem] font-bold text-default-900 [overflow-wrap:anywhere]",footerAmount:"ml-auto whitespace-nowrap text-[1rem] font-bold tabular-nums text-default-900",footerNote:"border-t border-pos-hair px-5 py-[0.8125rem] text-[0.78125rem] leading-[1.6] text-default-500",empty:"px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500"},Ur=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ye.dot,style:{backgroundColor:Ge[e.tone].fg}}),t.jsxs("span",{className:ye.body,children:[t.jsx("span",{className:ye.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ye.meta,children:[e.reference!=null&&t.jsx("span",{className:ye.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ye.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ye.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ye.detail,children:e.detail})]}),t.jsx("span",{className:ye.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:ye.amount,style:os(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:ye.note,style:e.noteTone==="warn"?{color:Ge.warn.fg}:void 0,children:e.note}):null})]}),lc=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ye.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ye.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:ye.base,children:[t.jsx("ul",{className:ye.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ye.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ye.row,ye.rowInteractive),children:t.jsx(Ur,{row:i,testId:o})}):t.jsx("div",{className:ye.row,children:t.jsx(Ur,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ye.footer,children:[t.jsx("span",{className:ye.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ye.footerAmount,style:os(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ye.footerNote,children:s.note})]})]});lc.displayName="AmountList";const Ue={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},oc=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ue.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ue.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ue.event,!i&&Ue.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ue.rail,children:[t.jsx("span",{className:Ue.dot,style:{backgroundColor:Ge[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ue.connector})]}),t.jsxs("div",{className:Ue.body,children:[t.jsxs("div",{className:Ue.head,children:[t.jsx("span",{className:Ue.title,children:a.title}),t.jsx("span",{className:Ue.timestamp,children:a.timestamp})]}),ne(a.detail)&&t.jsx("div",{className:Ue.detail,children:a.detail}),ne(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ue.actor,children:a.actor})]})]},a.id)})});oc.displayName="ActivityTimeline";const Ae={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Us}`,header:"flex flex-wrap items-center gap-2 px-5 pt-4",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",list:"m-0 list-none p-0",item:"border-t border-pos-hair",itemFirstHeadless:"border-t-0",row:"flex w-full items-center gap-2.5 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${je}`,rowBody:"flex min-w-0 flex-1 flex-col",rowHead:"flex min-w-0 flex-wrap items-center gap-2",primaryLinked:"min-w-0 text-[0.875rem] font-normal text-primary [overflow-wrap:anywhere]",primaryPlain:"min-w-0 text-[0.875rem] font-normal text-default-900 [overflow-wrap:anywhere]",secondary:"mt-[0.1875rem] block min-w-0 truncate text-[0.8125rem] text-default-500",amount:"max-w-[45%] shrink-0 text-right text-[0.875rem] font-semibold tabular-nums text-default-900 [overflow-wrap:anywhere]",empty:"min-w-0 px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500 [overflow-wrap:anywhere]",emptyHeadless:"pt-5"},Hr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ae.rowBody,children:[t.jsxs("span",{className:Ae.rowHead,children:[t.jsx("span",{className:e.onSelect?Ae.primaryLinked:Ae.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Ae.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Ae.amount,style:os(e.amountTone),children:e.amount})]}),cc=({title:e,count:s,rows:n,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=x.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Ae.base,children:[o&&t.jsxs("div",{className:Ae.header,children:[t.jsx("h3",{id:i,className:Ae.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Ae.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Ae.empty,!o&&Ae.emptyHeadless),children:a}):t.jsx("ul",{className:Ae.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Ae.item,d===0&&!o&&Ae.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Ae.row,Ae.rowInteractive),children:t.jsx(Hr,{row:l,testId:u})}):t.jsx("div",{className:Ae.row,children:t.jsx(Hr,{row:l,testId:u})})},l.id)})})]})};cc.displayName="RelatedRecordList";const dc=({title:e,titleAs:s="h2",icon:n,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:p="card",className:m,children:h,"data-testid":f="record-card"})=>{const b=x.useId(),y=ne(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":p,role:y?"group":void 0,"aria-labelledby":y?b:void 0,className:c.cn(ot.base,ox[p],m),children:[y&&t.jsxs("div",{"data-testid":`${f}-header`,className:cx[d],children:[ne(n)&&t.jsx("span",{"aria-hidden":"true",className:ot.icon,children:n}),t.jsx(s,{id:b,className:ot.title,children:e}),ne(a)&&t.jsx("span",{"data-testid":`${f}-count`,className:ot.count,children:a}),r,ne(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:ot.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:dx[d][u],children:[ne(o)&&t.jsx("p",{"data-testid":`${f}-description`,className:ot.description,children:o}),h,ne(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:c.cn(ot.footer,ne(h)?ot.footerAfterContent:ot.footerAfterDescription),children:l})]})]})};dc.displayName="RecordCard";const fb={stack:"flex min-w-0 flex-col gap-[0.875rem]",grid:"grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,18.75rem),1fr))] items-start gap-[0.875rem]"},uc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(fb[e],s),children:n});uc.displayName="CardStack";const hs={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},pb={regular:"py-[0.5625rem]",compact:"py-2"},mc=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:hs.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(hs.row,pb[s]),children:[t.jsx("dt",{className:hs.label,children:a.label}),t.jsx("dd",{className:hs.value,children:a.value})]},a.id??r))});mc.displayName="KeyValueRows";const Xe={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},fc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:Xe.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=ne(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Xe.row,style:r.tone?{backgroundColor:Ge[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Xe.body,children:[t.jsx("div",{className:Xe.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Xe.details,children:r.details.map((l,d)=>t.jsxs(x.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Xe.separator,children:"·"}),t.jsx("span",{className:Xe.detail,children:l})]},d))})]}),t.jsxs("div",{className:Xe.trailing,children:[t.jsxs("span",{className:Xe.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:Xe.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Xe.amount,style:o?{color:Ge.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});fc.displayName="LineItemRows";const xb=37.5,De={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},pc=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=It(),o=i>0&&!ls(i,xb),l=o?De.rowNarrow:De.rowWide,d=o?De.labelNarrow:De.labelWide,u=o?De.noteNarrow:De.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:De.base,children:[e.map(p=>{const m=`${a}-row-${p.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,De.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,De.label),children:p.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,De.note),children:p.note}),t.jsx("span",{"data-testid":`${m}-value`,className:De.value,style:os(p.tone),children:p.value})]},p.id)}),t.jsx("div",{className:De.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,De.totalRow),children:[t.jsx("span",{className:c.cn(d,De.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:De.totalValue,children:s.value})]})}),ne(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:De.memo,children:n})]})};pc.displayName="RecordTotals";const Pn={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},hb={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},xc=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(Pn.base,hb[e]),style:os(s),children:[a,ne(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:Pn.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});xc.displayName="CellText";const hc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:Pn.chipStack,children:e});hc.displayName="ChipStack";function bc({testId:e,title:s,description:n}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}bc.displayName="SessionExpiredCard";const Le={base:"flex w-full min-w-0 flex-col gap-1.5",baseUser:"items-end",baseAssistant:"items-start",header:"flex min-w-0 max-w-full flex-wrap items-center gap-x-2 gap-y-0.5",mark:"inline-flex size-6 flex-none items-center justify-center rounded-full bg-ai-fill text-ai-accent",author:"min-w-0 text-sm font-semibold text-ai-accent [overflow-wrap:anywhere]",meta:"min-w-0 text-xs tabular-nums text-default-500 [overflow-wrap:anywhere]",body:"min-w-0 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]",bodyUser:"max-w-[85%] rounded-2xl rounded-br-md bg-ai-user-bubble px-4 py-2.5",bodyAssistant:"w-full",plain:"whitespace-pre-wrap",status:"m-0 flex min-w-0 items-center gap-1.5 text-xs font-medium [overflow-wrap:anywhere]",statusIcon:"inline-flex size-3.5 flex-none",actions:"flex flex-wrap items-center gap-1",userLabel:"sr-only",statusFallback:"sr-only"},bb={stopped:"text-default-600",error:"text-danger-600 dark:text-danger-500"},gb={stopped:"solar:stop-circle-linear",error:"solar:danger-circle-linear"},yb="solar:stars-minimalistic-linear",vb={stopped:"Stopped",error:"Failed"};function gc(e){return typeof e=="string"?e.trim()!=="":Array.isArray(e)?e.some(gc):ne(e)}function yc({author:e,authorLabel:s,children:n,status:a="complete",statusLabel:r,meta:i,actions:o,icon:l=yb,className:d,classNames:u={},"data-testid":p="assistant-message"}){const m=x.useId(),h=e==="user",f=a==="complete"?null:a==="stopped"?"stopped":"error",b=ne(i)?t.jsx("span",{"data-testid":`${p}-meta`,className:c.cn(Le.meta,u.meta),children:i}):null;return t.jsxs("article",{"aria-labelledby":m,"data-author":e,"data-status":a,"data-testid":p,className:c.cn(Le.base,h?Le.baseUser:Le.baseAssistant,d,u.base),children:[h?t.jsx("span",{id:m,className:Le.userLabel,children:s}):t.jsxs("header",{"data-testid":`${p}-header`,className:c.cn(Le.header,u.header),children:[l?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-mark`,className:Le.mark,children:t.jsx(M,{icon:l,width:14,height:14})}):null,t.jsx("span",{id:m,"data-testid":`${p}-author`,className:Le.author,children:s}),b]}),ne(n)?t.jsx("div",{"data-testid":`${p}-body`,className:c.cn(Le.body,h?Le.bodyUser:Le.bodyAssistant,typeof n=="string"&&Le.plain,u.body),children:n}):null,f?t.jsxs("p",{"data-testid":`${p}-status`,className:c.cn(Le.status,bb[f],u.status),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-status-icon`,className:Le.statusIcon,children:t.jsx(M,{icon:gb[f],width:14,height:14})}),gc(r)?t.jsx("span",{children:r}):t.jsx("span",{className:Le.statusFallback,children:vb[f]})]}):null,h?b:null,ne(o)?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn(Le.actions,u.actions),children:o}):null]})}yc.displayName="AssistantMessage";const He={base:"w-full px-0",item:"shadow-none",trigger:"gap-2 py-1.5",title:"text-sm font-medium text-default-700",indicator:"text-default-500",content:"pb-2 pt-0",list:"m-0 flex list-none flex-col gap-1.5 p-0",row:"flex min-w-0 items-start gap-2 text-sm",icon:"mt-0.5 flex-none",label:"min-w-0 flex-1 text-foreground [overflow-wrap:anywhere]",failed:"flex-none text-danger-700 dark:text-danger-700",duration:"mt-px flex-none text-xs tabular-nums text-default-500",stateLabel:"sr-only"},wb={done:{icon:"solar:check-circle-linear",className:"text-success-600"},failed:{icon:"solar:close-circle-linear",className:"text-danger-600"}};function vc(e){if(!Number.isFinite(e)||e<0)return"";if(e<1e3)return`${Math.floor(e)} ms`;if(e<1e4)return`${(Math.floor(e/100)/10).toFixed(1)} s`;const s=Math.floor(e/1e3);return s<60?`${s} s`:`${Math.floor(s/60)} min ${String(s%60).padStart(2,"0")} s`}const bn="activity",jb={done:"Done",failed:"Failed"};function wc({items:e,title:s,titleText:n,isExpanded:a,defaultExpanded:r=!0,onExpandedChange:i,stateLabels:o,formatDuration:l=vc,className:d,"data-testid":u="assistant-activity"}){const[p,m]=x.useState(r),h=rs(),f=a??p,b={...jb,...o};return e.length===0?null:t.jsx(c.Accordion,{"data-testid":u,disableAnimation:h,selectedKeys:f?new Set([bn]):new Set,onSelectionChange:y=>{const g=y==="all"||y.has(bn);a===void 0&&m(g),i?.(g)},className:c.cn(He.base,d),children:t.jsx(c.AccordionItem,{"data-testid":`${u}-group`,title:s,textValue:typeof s=="string"?s:n,classNames:{base:He.item,trigger:He.trigger,title:He.title,indicator:He.indicator,content:He.content},children:t.jsx("ol",{"data-testid":`${u}-list`,className:He.list,children:e.map(y=>{const g=wb[y.state],v=`${u}-item-${y.id}`;return t.jsxs("li",{"data-testid":v,"data-state":y.state,className:He.row,children:[t.jsx(M,{icon:g.icon,width:16,height:16,"aria-hidden":"true",className:c.cn(He.icon,g.className)}),t.jsxs("span",{className:He.label,children:[y.state==="done"?t.jsxs("span",{className:He.stateLabel,children:[b.done,": "]}):null,y.label]}),y.state==="failed"?t.jsx(c.Chip,{size:"sm",variant:"flat",color:"danger","data-testid":`${v}-failed`,className:He.failed,children:b.failed}):null,y.durationMs!==void 0?t.jsx("span",{"data-testid":`${v}-duration`,className:He.duration,children:l(y.durationMs)}):null]},y.id)})})},bn)})}wc.displayName="AssistantActivity";const gn="dark:bg-default-100",Nb={thinking:{color:"default",base:"bg-ai-fill dark:bg-ai-fill",title:"text-ai-accent",description:"text-default-600",icon:""},info:{color:"default",base:"bg-ai-fill dark:bg-ai-fill",title:"text-ai-accent",description:"text-default-600",icon:"solar:info-circle-linear"},empty:{color:"default",base:gn,title:"text-foreground",description:"text-default-600",icon:"solar:chat-round-line-linear"},error:{color:"danger",base:"",title:"text-danger-700",description:"text-danger-700",icon:"solar:danger-triangle-linear"},caution:{color:"warning",base:"",title:"text-warning-700",description:"text-warning-700",icon:"solar:hourglass-line-linear"},offline:{color:"default",base:gn,title:"text-foreground",description:"text-default-600",icon:"solar:cloud-cross-linear"},blocked:{color:"default",base:gn,title:"text-foreground",description:"text-default-600",icon:"solar:lock-keyhole-minimalistic-linear"}},ze={base:"items-start gap-x-3 px-4 py-3",mainWrapper:"ms-0 min-h-0 min-w-0 items-start justify-start gap-0.5",icon:"mt-0.5 inline-flex size-5 flex-none items-center justify-center",live:"flex w-full min-w-0 flex-col gap-0.5",titleRow:"flex min-w-0 flex-wrap items-baseline gap-x-2",title:"m-0 min-w-0 text-sm font-medium [overflow-wrap:anywhere]",elapsed:"text-sm tabular-nums",description:"m-0 min-w-0 text-sm [overflow-wrap:anywhere]",action:"mt-2 flex flex-wrap items-center gap-2",detailsToggle:"-ms-1.5 h-7 min-w-0 gap-1 px-1.5 text-xs font-medium text-current",detailsWrapper:"w-full min-w-0",detailsChevron:`transition-transform ${je}`,detailsChevronOpen:"rotate-180",details:"mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-content1 p-2 font-mono text-xs text-foreground [overflow-wrap:anywhere]"},Cb={thinking:"status",info:"status",empty:"status",error:"alert",caution:"status",offline:"status",blocked:"status"};function jc({kind:e,title:s,description:n,elapsed:a,action:r,details:i,detailsLabel:o="Details",icon:l,role:d=Cb[e],ariaLive:u=d==="alert"?"assertive":"polite",className:p,classNames:m={},"data-testid":h="assistant-notice"}){const f=Nb[e],b=l===void 0?f.icon:l,y=e==="thinking"&&l===void 0?t.jsx(c.Spinner,{size:"sm",color:"current"}):b?t.jsx(M,{icon:b,width:20,height:20}):null;return t.jsxs(c.Alert,{role:"none","data-kind":e,"data-testid":h,color:f.color,variant:"flat",hideIcon:!0,startContent:y?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-icon`,className:c.cn(ze.icon,f.title),children:y}):void 0,classNames:{base:c.cn(ze.base,f.base,p,m.base),mainWrapper:ze.mainWrapper},children:[t.jsxs("div",{role:d,"aria-live":u,"aria-atomic":"true","data-testid":`${h}-live`,className:ze.live,children:[t.jsxs("div",{className:ze.titleRow,children:[t.jsx("p",{"data-testid":`${h}-title`,className:c.cn(ze.title,f.title,m.title),children:s}),a!=null&&a!==!1?t.jsx("span",{"aria-hidden":"true","data-testid":`${h}-elapsed`,className:c.cn(ze.elapsed,f.title),children:a}):null]}),n!=null&&n!==!1?t.jsx("p",{"data-testid":`${h}-description`,className:c.cn(ze.description,f.description,m.description),children:n}):null]}),r!=null&&r!==!1?t.jsx("div",{"data-testid":`${h}-action`,className:c.cn(ze.action,m.action),children:r}):null,i!=null&&i!==!1?t.jsx(kb,{label:o,toneClass:f.description,className:m.details,dataTestId:h,children:i}):null]})}function kb({label:e,toneClass:s,className:n,dataTestId:a,children:r}){const[i,o]=x.useState(!1),l=x.useId();return t.jsxs("div",{className:ze.detailsWrapper,children:[t.jsx(O,{size:"sm",variant:"light",color:"default",radius:"sm","aria-expanded":i,"aria-controls":l,onPress:()=>o(d=>!d),testId:`${a}-details-toggle`,className:c.cn(ze.detailsToggle,s),endContent:t.jsx(M,{icon:"solar:alt-arrow-down-linear",width:14,height:14,"aria-hidden":"true",className:c.cn(ze.detailsChevron,i&&ze.detailsChevronOpen)}),children:e}),t.jsx("div",{id:l,hidden:!i,"data-testid":`${a}-details`,className:c.cn(ze.details,n),children:r})]})}jc.displayName="AssistantNotice";const Je={base:"flex w-full min-w-0 flex-col gap-2",suggestions:"flex flex-wrap gap-2",suggestion:"h-auto min-h-8 max-w-full whitespace-normal bg-default-100 py-1.5 text-left text-foreground data-[hover=true]:bg-default-200",row:"flex min-w-0 items-end gap-2",field:"min-w-0 flex-1",inputWrapper:"border-default-200 bg-content1 data-[hover=true]:border-default-300 group-data-[focus=true]:border-ai-focus",input:"text-sm text-foreground placeholder:text-default-500",helper:"m-0 flex w-full justify-between gap-2 text-xs text-default-500",count:"ms-auto flex-none tabular-nums",button:"flex-none"};function Nc({value:e,onValueChange:s,onSubmit:n,onStop:a,isRunning:r=!1,isStopDisabled:i=!1,isDisabled:o=!1,label:l,placeholder:d,description:u,sendLabel:p="Send",stopLabel:m="Stop",suggestions:h,suggestionsLabel:f="Suggestions",onSuggestionSelect:b,maxLength:y,minRows:g=2,maxRows:v=8,className:j,"data-testid":A="assistant-composer"}){const w=x.useRef(null),E=x.useId(),$=!o&&!r&&e.trim().length>0,N=r&&a!==void 0,C=()=>{$&&n(e)},k=()=>w.current?.focus(),_=G=>{G.target===w.current&&(G.key!=="Enter"||G.shiftKey||G.nativeEvent.isComposing||G.keyCode===229||(G.preventDefault(),C()))},F=G=>{G.preventDefault(),C(),k()},D=x.useRef(!1),P=x.useRef(N);x.useLayoutEffect(()=>{P.current&&!N&&D.current&&(D.current=!1,w.current?.focus()),P.current=N},[N]),x.useLayoutEffect(()=>{i&&D.current&&(D.current=!1,w.current?.focus())},[i]);const T=()=>{k(),a?.()},W=G=>{s(G.prompt??G.label),w.current?.focus(),b?.(G)},Y=y!==void 0?`${e.length}/${y}`:null,z=ne(u)||Y?t.jsxs("p",{id:E,"data-testid":`${A}-helper`,className:Je.helper,children:[ne(u)?t.jsx("span",{children:u}):null,Y?t.jsx("span",{"data-testid":`${A}-count`,className:Je.count,children:Y}):null]}):null;return t.jsxs("form",{noValidate:!0,"data-testid":A,"data-running":r||void 0,onSubmit:F,onKeyDown:_,className:c.cn(Je.base,j),children:[h&&h.length>0?t.jsx("div",{role:"group","aria-label":f,"data-testid":`${A}-suggestions`,className:Je.suggestions,children:h.map(G=>t.jsx(O,{type:"button",size:"sm",variant:"flat",color:"default",isDisabled:o,onPress:()=>W(G),testId:`${A}-suggestion-${G.key}`,className:Je.suggestion,children:G.label},G.key))}):null,t.jsxs("div",{className:Je.row,onMouseDown:G=>{G.target===G.currentTarget&&G.preventDefault()},children:[t.jsx(c.Textarea,{ref:w,"aria-label":l,placeholder:d,value:e,onValueChange:s,isDisabled:o,maxLength:y,minRows:g,maxRows:v,variant:"bordered","aria-describedby":z?E:void 0,"data-testid":`${A}-field`,className:Je.field,classNames:{inputWrapper:Je.inputWrapper,input:Je.input}}),N?t.jsx(O,{type:"button",isIconOnly:!0,color:"default",variant:"flat","aria-label":m,isDisabled:i,onPress:T,onFocus:()=>{D.current=!0},onBlur:G=>{G.target.disabled||(D.current=!1)},testId:`${A}-stop`,className:Je.button,children:t.jsx(M,{icon:"solar:stop-bold",width:18,height:18,"aria-hidden":"true"})},"stop"):t.jsx(O,{type:"submit",isIconOnly:!0,color:"primary","aria-label":p,isDisabled:!$,testId:`${A}-send`,className:Je.button,children:t.jsx(M,{icon:"solar:arrow-up-linear",width:18,height:18,"aria-hidden":"true"})},"send")]}),z]})}Nc.displayName="AssistantComposer";const Yt={base:"relative flex min-h-0 w-full flex-col",scroller:"min-h-0 flex-1 overflow-y-auto overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ai-focus",content:"min-w-0",jumpBar:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",jump:"pointer-events-auto border border-divider bg-content1 text-foreground shadow-medium"};function Cc({children:e,label:s,followKey:n,jumpLabel:a="Jump to newest",onFollowChange:r,threshold:i=32,className:o,classNames:l={},"data-testid":d="scroll-to-latest"}){const u=x.useRef(null),p=x.useRef(null),m=x.useRef(!0),h=x.useRef(0),f=x.useRef(r),[b,y]=x.useState(!0),[g,v]=x.useState(!1),j=rs();x.useEffect(()=>{f.current=r},[r]);const A=x.useCallback(C=>{m.current!==C&&(m.current=C,y(C),f.current?.(C))},[]),w=x.useCallback(()=>{const C=u.current;C&&v(C.scrollHeight>C.clientHeight)},[]),E=x.useCallback(C=>{const k=u.current;k&&(typeof k.scrollTo=="function"?k.scrollTo({top:k.scrollHeight,behavior:C}):k.scrollTop=k.scrollHeight,h.current=k.scrollTop)},[]);x.useLayoutEffect(()=>{m.current&&E("auto"),w()},[n,E,w]),x.useEffect(()=>{const C=p.current,k=u.current;if(!C||!k||typeof ResizeObserver>"u")return;const _=new ResizeObserver(()=>{m.current&&E("auto"),w()});return _.observe(C),_.observe(k),()=>_.disconnect()},[E,w]);const $=()=>{const C=u.current;if(!C)return;const k=C.scrollTop;C.scrollHeight-k-C.clientHeight<=i?A(!0):k<h.current-1&&A(!1),h.current=k,w()},N=()=>{A(!0),E(j?"auto":"smooth"),u.current?.focus({preventScroll:!0})};return t.jsxs("div",{"data-testid":d,"data-following":b,className:c.cn(Yt.base,o,l.base),children:[t.jsx(c.ScrollShadow,{ref:u,role:"region","aria-label":s,tabIndex:0,size:24,onScroll:$,"data-testid":`${d}-scroller`,className:c.cn(Yt.scroller,l.scroller),children:t.jsx("div",{ref:p,className:c.cn(Yt.content,l.content),children:e})}),!b&&g?t.jsx("div",{className:Yt.jumpBar,children:t.jsx(O,{type:"button",size:"sm",radius:"full",color:"default",variant:"solid",onPress:N,testId:`${d}-jump`,startContent:t.jsx(M,{icon:"solar:arrow-down-linear",width:16,height:16,"aria-hidden":"true"}),className:c.cn(Yt.jump,l.jump),children:a})}):null]})}Cc.displayName="ScrollToLatest";const _t={root:"min-w-0 space-y-3 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]",paragraph:"m-0",heading:{1:"m-0 text-xl font-bold",2:"m-0 text-lg font-semibold",3:"m-0 text-base font-semibold",4:"m-0 text-sm font-semibold",5:"m-0 text-sm font-semibold",6:"m-0 text-sm font-medium"},bulletList:"m-0 list-disc space-y-1 ps-5",orderedList:"m-0 list-decimal space-y-1 ps-5",listItem:"ps-1 [&>ol]:mt-1 [&>ul]:mt-1",blockquote:"m-0 space-y-2 border-s-2 border-default-300 ps-3 text-default-600",code:"rounded bg-default-100 px-1 py-0.5 font-mono text-[0.8125em]",codeWrap:"max-w-full overflow-x-auto rounded-md bg-default-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus",pre:"m-0 whitespace-pre p-3 font-mono text-xs [overflow-wrap:normal]",rule:"my-3 border-0 border-t border-divider",tableWrap:"max-w-full overflow-x-auto rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus",table:"w-full border-collapse text-sm",headerCell:"whitespace-nowrap border-b border-divider px-2 py-1.5 font-semibold",cell:"border-b border-divider px-2 py-1.5 align-top [overflow-wrap:normal]",align:{left:"text-start",center:"text-center",right:"text-end"},link:"text-ai-accent underline underline-offset-2 hover:no-underline",linkDomain:"inline-block text-default-500",srOnly:"sr-only"},Sb=["reference","autolink","html_block","html_inline","strikethrough","replacements","smartquotes","linkify","text_join"];let bs=null;function $b(){return bs||(bs=new id("default",{html:!1,linkify:!1,typographer:!1,breaks:!1}),bs.disable(Sb,!0)),bs}function Ab(e){let s=0,n=e.length;for(;s<n&&e.charCodeAt(s)<=32;)s+=1;for(;n>s&&e.charCodeAt(n-1)<=32;)n-=1;return e.slice(s,n).replace(/[\t\n\r]/g,"")}function kc(e){const s=Ab(e);if(/^https?:/i.test(s)){if(!/^https?:\/\//i.test(s))return null;try{return new URL(s).href}catch{return null}}return/^[/\\]{2}/.test(s)?null:e}const Sc=e=>{if(/^https?:/i.test(e))return kc(e);if(/^mailto:/i.test(e)){const s=e.slice(7).split("?")[0];return s?`mailto:${s}`:null}return null};function Eb(e){try{const s=new URL(e);return s.protocol==="http:"||s.protocol==="https:"?s.hostname.replace(/^www\./,""):s.protocol==="mailto:"?decodeURIComponent(s.pathname):""}catch{return""}}function Tn(e){const s=[],n=[s];for(const a of e){const r=n[n.length-1];if(a.nesting===1){const i={token:a,children:[]};r.push(i),n.push(i.children)}else a.nesting===-1?n.length>1&&n.pop():r.push({token:a,children:[]})}return s}const Wr=/(\[[1-9]\d{0,2}\])/;function Db(e,s,n){return!s.renderCitation||s.inLink||!Wr.test(e)?e:t.jsx(x.Fragment,{children:e.split(Wr).map((a,r)=>{const i=/^\[([1-9]\d{0,2})\]$/.exec(a);return i?t.jsx(x.Fragment,{children:s.renderCitation?.(Number(i[1]))},r):a})},n)}function Lb(e,s,n,a){const r=n.linkPolicy(e.attrGet("href")??""),i=r?kc(r):null;if(!i)return t.jsx(x.Fragment,{children:s},a);const o=Eb(i);return t.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer nofollow","data-testid":`${n.dataTestId}-link`,className:_t.link,children:[s,o?t.jsxs("span",{className:_t.linkDomain,children:[" (",o,")"]}):null,t.jsxs("span",{className:_t.srOnly,children:[" (",n.newTabLabel,")"]})]},a)}function qr(e){const s=/text-align:\s*(left|center|right)/.exec(e.attrGet("style")??"");return s?_t.align[s[1]]:void 0}function Qt(e,s,n){return e.map((a,r)=>Fb(a,s,`${n}.${r}`))}function Fb({token:e,children:s},n,a){const r=()=>Qt(s,n,a),i=_t;switch(e.type){case"paragraph_open":return e.hidden?t.jsx(x.Fragment,{children:r()},a):t.jsx("p",{className:i.paragraph,children:r()},a);case"heading_open":{const o=Math.min(6,Math.max(1,Number(e.tag.slice(1))+n.headingOffset));return x.createElement(`h${o}`,{key:a,className:i.heading[o]},r())}case"bullet_list_open":return t.jsx("ul",{className:i.bulletList,children:r()},a);case"ordered_list_open":{const o=Number(e.attrGet("start")??1);return t.jsx("ol",{start:o===1?void 0:o,className:i.orderedList,children:r()},a)}case"list_item_open":return t.jsx("li",{className:i.listItem,children:r()},a);case"blockquote_open":return t.jsx("blockquote",{className:i.blockquote,children:r()},a);case"table_open":return t.jsx("div",{role:"region","aria-label":n.tableLabel,tabIndex:0,"data-testid":`${n.dataTestId}-table`,className:i.tableWrap,children:t.jsx("table",{className:i.table,children:r()})},a);case"thead_open":return t.jsx("thead",{children:r()},a);case"tbody_open":return t.jsx("tbody",{children:r()},a);case"tr_open":return t.jsx("tr",{children:r()},a);case"th_open":return t.jsx("th",{scope:"col",className:c.cn(i.headerCell,qr(e)??i.align.left),children:r()},a);case"td_open":return t.jsx("td",{className:c.cn(i.cell,qr(e)),children:r()},a);case"strong_open":return t.jsx("strong",{children:r()},a);case"em_open":return t.jsx("em",{children:r()},a);case"link_open":return Lb(e,Qt(s,{...n,inLink:!0},a),n,a);case"inline":return t.jsx(x.Fragment,{children:Qt(Tn(e.children??[]),n,a)},a);case"text":return Db(e.content,n,a);case"text_special":return e.content;case"softbreak":return`
42
+ `;case"hardbreak":return t.jsx("br",{},a);case"code_inline":return t.jsx("code",{className:i.code,children:e.content},a);case"code_block":case"fence":return t.jsx("div",{role:"region","aria-label":n.codeLabel,tabIndex:0,"data-testid":`${n.dataTestId}-code`,className:i.codeWrap,children:t.jsx("pre",{className:i.pre,children:t.jsx("code",{children:e.content})})},a);case"hr":return t.jsx("hr",{className:i.rule},a);case"image":return t.jsx(x.Fragment,{children:Qt(Tn(e.children??[]),n,a)},a);default:return s.length>0?t.jsx(x.Fragment,{children:r()},a):e.content?t.jsx(x.Fragment,{children:e.content},a):null}}function $c({source:e,linkPolicy:s=Sc,headingOffset:n=2,renderCitation:a,newTabLabel:r="opens in a new tab",tableLabel:i="Table",codeLabel:o="Code",className:l,"data-testid":d="assistant-markdown"}){const u=x.useMemo(()=>Tn($b().parse(e,{})),[e]),p={headingOffset:Number.isFinite(n)?Math.trunc(n):2,linkPolicy:s,renderCitation:a,newTabLabel:r,tableLabel:i,codeLabel:o,dataTestId:d,inLink:!1};return t.jsx("div",{"data-testid":d,className:c.cn(_t.root,l),children:Qt(u,p,"md")})}$c.displayName="AssistantMarkdown";const Ac="inline-flex items-center rounded border border-ai-border bg-ai-fill px-1 text-[0.6875rem] font-semibold leading-4 tabular-nums text-ai-accent",gs={base:`ms-0.5 align-baseline ${Ac}`,interactive:"cursor-pointer transition-colors hover:border-ai-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus motion-reduce:transition-none",srOnly:"sr-only"};function Ec({index:e,label:s,onSelect:n,"data-testid":a=`citation-marker-${e}`}){return n?t.jsxs("button",{type:"button","aria-label":s,onClick:n,"data-testid":a,className:c.cn(gs.base,gs.interactive),children:["[",e,"]"]}):t.jsxs("span",{"data-testid":a,className:gs.base,children:[t.jsxs("span",{"aria-hidden":"true",children:["[",e,"]"]}),t.jsx("span",{className:gs.srOnly,children:s})]})}Ec.displayName="CitationMarker";const _b={base:"inline-flex h-auto min-h-8 min-w-0 max-w-full items-center justify-start gap-1.5 rounded-full border border-default-200 bg-content1 px-2.5 py-1 text-xs text-foreground",interactive:"data-[hover=true]:bg-default-100 data-[focus-visible=true]:outline-none data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-ai-focus",disabled:"border-dashed",marker:`flex-none ${Ac}`,srOnly:"sr-only",icon:"flex-none text-default-600",kind:"flex-none font-semibold",title:"min-w-0 truncate",date:"flex-none tabular-nums text-default-600",reason:"flex flex-none items-center gap-1 text-default-600",separator:"flex-none text-default-600"};function Sa({kindLabel:e,title:s,date:n,icon:a,marker:r,onOpen:i,isDisabled:o=!1,disabledReason:l,"data-testid":d="source-pill"}){const u=_b,p=t.jsxs(t.Fragment,{children:[r!==void 0&&(o||!i)?t.jsxs("span",{className:u.srOnly,children:["[",r,"], "]}):null,r!==void 0?t.jsx("span",{"aria-hidden":"true","data-testid":`${d}-marker`,className:u.marker,children:r}):null,a?t.jsx(M,{icon:a,width:14,height:14,"aria-hidden":"true",className:u.icon}):null,t.jsx("span",{className:u.kind,children:e}),t.jsx("span",{"aria-hidden":"true",className:u.separator,children:"·"}),t.jsx("span",{"data-testid":`${d}-title`,className:u.title,children:s}),n?t.jsx("span",{className:u.date,children:n}):null]});return o||!i?t.jsxs("span",{"data-testid":d,"data-disabled":o||void 0,title:s,className:c.cn(u.base,o&&u.disabled),children:[p,o&&l?t.jsxs("span",{"data-testid":`${d}-reason`,className:u.reason,children:[t.jsx(M,{icon:"solar:unlink-minimalistic-linear",width:14,height:14,"aria-hidden":"true"}),l]}):null]}):t.jsx(O,{variant:"light",color:"default",radius:"full",onPress:i,title:s,"aria-label":[r!==void 0?`[${r}]`:null,e,s,n].filter(Boolean).join(", "),testId:d,className:c.cn(u.base,u.interactive),children:p})}Sa.displayName="SourcePill";const Rb={base:"w-full px-0",item:"shadow-none",trigger:`gap-2 py-1.5 ${je}`,title:"text-sm font-medium text-default-700",count:"ms-1 tabular-nums text-default-600",indicator:"text-default-500",content:"pb-2 pt-0",groups:"flex flex-col gap-3",group:"flex flex-col gap-1.5",groupLabel:"m-0 text-xs font-semibold uppercase tracking-wide text-default-600",list:"m-0 flex list-none flex-wrap gap-1.5 p-0",listItem:"max-w-full rounded-full outline-none focus:ring-2 focus:ring-ai-focus"},yn="sources",Mb=1e3,Pb=700;function Tb(e){const s=new Map;for(const n of e){const a=s.get(n.groupKey)??{key:n.groupKey,label:n.groupLabel,items:[]};a.items.push(n),s.set(n.groupKey,a)}return[...s.values()]}const Dc=x.forwardRef(function({items:s,title:n,titleText:a,isExpanded:r,defaultExpanded:i=!1,onExpandedChange:o,className:l,"data-testid":d="source-list"},u){const[p,m]=x.useState(i),h=x.useRef(new Map),f=x.useRef(null),b=x.useRef(null),y=x.useId(),g=rs(),v=r??p,j=C=>{r===void 0&&m(C),o?.(C)},A=(C,k)=>C.scrollIntoView?.({block:"nearest",behavior:k?"smooth":"auto"}),w=(C,k)=>{if(C.focus({preventScroll:!0}),b.current){b.current=C;return}if(!k||g){A(C,!g);return}b.current=C,window.setTimeout(()=>{const _=b.current;_&&(b.current=null,A(_,!0))},Pb)},E=x.useMemo(()=>({onAnimationComplete:C=>{const k=b.current;C!=="enter"||!k||(b.current=null,k.scrollIntoView?.({block:"nearest",behavior:"smooth"}))}}),[]);if(x.useEffect(()=>{v||(f.current=null,b.current=null)},[v]),x.useImperativeHandle(u,()=>({reveal:C=>{if(!s.some(_=>_.id===C))return;const k=h.current.get(C);if(v&&k){w(k,!1);return}f.current={id:C,at:Date.now()},v||j(!0)}})),s.length===0)return null;const $=Rb,N=Tb(s);return t.jsx(c.Accordion,{"data-testid":d,disableAnimation:g,selectedKeys:v?new Set([yn]):new Set,onSelectionChange:C=>j(C==="all"||C.has(yn)),className:c.cn($.base,l),children:t.jsx(c.AccordionItem,{"data-testid":`${d}-group`,motionProps:E,title:t.jsxs(t.Fragment,{children:[n,t.jsxs("span",{className:$.count,children:["(",s.length,")"]})]}),textValue:`${typeof n=="string"?n:a??""} (${s.length})`,classNames:{base:$.item,trigger:$.trigger,title:$.title,indicator:$.indicator,content:$.content},children:t.jsx("div",{className:$.groups,onFocus:C=>C.stopPropagation(),children:N.map((C,k)=>{const _=`${y}-group-${k}`;return t.jsxs("div",{role:"group","aria-labelledby":_,"data-testid":`${d}-kind-${C.key}`,className:$.group,children:[t.jsxs("p",{id:_,className:$.groupLabel,children:[C.label," (",C.items.length,")"]}),t.jsx("ul",{className:$.list,children:C.items.map(F=>t.jsx("li",{tabIndex:-1,ref:D=>{if(!D){h.current.delete(F.id);return}h.current.set(F.id,D);const P=f.current;P?.id===F.id&&(f.current=null,Date.now()-P.at<=Mb&&w(D,!0))},"data-testid":`${d}-item-${F.id}`,className:$.listItem,children:t.jsx(Sa,{...F,"data-testid":`${d}-pill-${F.id}`})},F.id))})]},C.key)})})},yn)})});Dc.displayName="SourceList";const Ib={base:"w-full border border-default-200 bg-content1 shadow-none",deleted:"border-dashed",header:"flex flex-col items-start gap-1 px-4 pb-0 pt-3",kindRow:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-default-600",kind:"inline-flex items-center gap-1.5 font-medium",badge:"inline-flex items-center gap-1 rounded-md border border-default-300 bg-default-100 px-1.5 py-0.5 text-[0.6875rem] font-semibold uppercase tracking-wide text-default-700",title:"m-0 min-w-0 text-sm font-semibold text-foreground [overflow-wrap:anywhere]",titleDeleted:"text-default-600",meta:"text-xs tabular-nums text-default-600 [overflow-wrap:anywhere]",body:"min-w-0 px-4 py-3",skeleton:"flex flex-col gap-2",skeletonLine:"h-3 rounded-md",skeletonWidths:["w-3/4","w-full","w-2/3"],footer:"flex flex-wrap items-center justify-between gap-2 border-t border-divider px-4 py-2.5",status:"flex min-w-0 items-center gap-1.5 text-xs font-medium [overflow-wrap:anywhere]",spinner:"size-3.5",actions:"flex flex-wrap items-center gap-1.5"},Ob={saving:"text-default-600",saved:"text-success-700",failed:"text-danger-700",deleted:"text-default-600"},zb={saved:"solar:check-circle-linear",failed:"solar:danger-triangle-linear",deleted:"solar:trash-bin-minimalistic-linear"};function Bb(e){return x.Children.toArray(e).some(s=>s!=="")}function Lc({title:e,kindLabel:s,icon:n,status:a="saved",statusLabel:r,meta:i,badge:o,children:l,actions:d,titleAs:u="p",className:p,"data-testid":m="artifact-card"}){const h=x.useId(),f=Ib,b=a==="deleted",y=Bb(l),g=!b&&(y||a==="saving");return t.jsxs(c.Card,{as:"article","aria-labelledby":h,shadow:"none",radius:"lg","data-status":a,"data-testid":m,className:c.cn(f.base,b&&f.deleted,p),children:[t.jsxs(c.CardHeader,{className:f.header,children:[t.jsxs("div",{className:f.kindRow,children:[t.jsxs("span",{"data-testid":`${m}-kind`,className:f.kind,children:[n?t.jsx(M,{icon:n,width:16,height:16,"aria-hidden":"true"}):null,s]}),ne(o)?t.jsx("span",{"data-testid":`${m}-badge`,className:f.badge,children:o}):null]}),t.jsx(u,{id:h,"data-testid":`${m}-title`,className:c.cn(f.title,b&&f.titleDeleted),children:e}),ne(i)?t.jsx("div",{"data-testid":`${m}-meta`,className:f.meta,children:i}):null]}),g?t.jsx(c.CardBody,{"data-testid":`${m}-body`,className:f.body,children:y?l:t.jsx("div",{"aria-hidden":"true","data-testid":`${m}-skeleton`,className:f.skeleton,children:f.skeletonWidths.map(v=>t.jsx(c.Skeleton,{className:c.cn(f.skeletonLine,v)},v))})}):null,t.jsxs(c.CardFooter,{className:f.footer,children:[t.jsxs("div",{role:"status","aria-live":"polite","data-testid":`${m}-status`,className:c.cn(f.status,Ob[a]),children:[a==="saving"?t.jsx(c.Spinner,{size:"sm",color:"current","aria-hidden":"true",classNames:{base:f.spinner,wrapper:f.spinner}}):t.jsx(M,{icon:zb[a],width:14,height:14,"aria-hidden":"true"}),t.jsx("span",{children:r})]}),ne(d)?t.jsx("div",{"data-testid":`${m}-actions`,className:f.actions,children:d}):null]})]})}Lc.displayName="ArtifactCard";exports.ActivityTimeline=oc;exports.AdminFieldLabel=Gl;exports.AdminTable=Tl;exports.AdminTextField=Kl;exports.AdminToolbar=Ol;exports.AmountList=lc;exports.AppliedCodeCard=mi;exports.ArtifactCard=Lc;exports.AssistantActivity=wc;exports.AssistantComposer=Nc;exports.AssistantMarkdown=$c;exports.AssistantMessage=yc;exports.AssistantNotice=jc;exports.Button=O;exports.CardList=tc;exports.CardStack=uc;exports.CashTenderForm=gx;exports.CatalogItemCard=wl;exports.CellText=xc;exports.CheckTenderForm=co;exports.ChipStack=hc;exports.CitationMarker=Ec;exports.CommitmentDetails=Cf;exports.ConfirmDialog=ha;exports.ConfirmationModal=ia;exports.ConfirmationPageTemplate=Wu;exports.CustomerCard=Oo;exports.DatePicker=Yn;exports.DensityProvider=md;exports.DimensionChip=Vs;exports.DiscardGuard=jo;exports.DonationAmounts=qi;exports.Drawer=Mi;exports.EmptyState=la;exports.EntityList=to;exports.EntityListSkeleton=so;exports.EntityRow=eo;exports.ErrorState=oa;exports.EventDetails=Em;exports.EventDetailsTemplate=Gu;exports.ExpireCartTimer=Gi;exports.FeedbackState=Tt;exports.FilterPopover=Sl;exports.FilterSelect=Xo;exports.FilterSelectGroup=Jo;exports.Footer=Qu;exports.HeroUIProvider=dd;exports.HorizontalSteps=Ii;exports.InlineConfirm=vo;exports.InstallmentFundAssignment=yf;exports.InstallmentFundAssignmentSkeleton=jf;exports.InstallmentSchedule=Uf;exports.InstallmentScheduleSkeleton=Zf;exports.InstallmentTable=tp;exports.ItemCard=vl;exports.KeyValueChip=Vs;exports.KeyValueRows=mc;exports.LineItemList=Ro;exports.LineItemRows=fc;exports.ListPanel=ro;exports.LoadMoreFooter=ec;exports.LoadingOverlay=go;exports.LoadingState=ca;exports.MembershipSelectCards=ip;exports.MetaCard=$h;exports.Modal=as;exports.ModalPanelHeader=No;exports.ModalPanels=eh;exports.ModalShell=fo;exports.ModalShellFooter=xo;exports.ModalShellHeader=po;exports.Multiselect=Zu;exports.Navbar=Hu;exports.NotesField=Bo;exports.OfferCard=$s;exports.OfferCardEmpty=Ki;exports.OfferCardError=Yi;exports.OfferCardList=Ji;exports.OfferCardSkeleton=Qi;exports.OtherTenderForm=uo;exports.OutcomeView=Zo;exports.PageHeader=El;exports.PaginationSummary=ao;exports.PaymentCashChangeBanner=pa;exports.PaymentSubAmountInput=xa;exports.PaymentSuccessView=yo;exports.PaymentTotalBanner=bo;exports.PickerRow=Ql;exports.PillTabs=ic;exports.PinField=Qo;exports.ProgramListItem=jl;exports.RICH_TEXT_PRESETS=Bi;exports.ReasonSelect=zo;exports.RecordCard=dc;exports.RecordHeader=nc;exports.RecordLayout=ac;exports.RecordTotals=pc;exports.RedeemCodeInput=zu;exports.RefundMethodCards=Go;exports.RefundProgressList=Yo;exports.RelatedRecordList=cc;exports.RevenueDistributionCard=ul;exports.RevenueDistributionEmpty=ml;exports.RevenueDistributionError=fl;exports.RevenueDistributionSkeleton=pl;exports.RichTextArea=Vi;exports.RowActions=Yl;exports.ScrollToLatest=Cc;exports.SectionPanel=Io;exports.Select=st;exports.SessionExpiredCard=bc;exports.SessionTimeline=$l;exports.SourceList=Dc;exports.SourcePill=Sa;exports.SplitPaymentSummary=mo;exports.SplitTenderPanel=Uo;exports.StatTiles=rc;exports.StatusChip=Dl;exports.StepProgress=wa;exports.Stepper=Ti;exports.SuccessState=Nl;exports.Summary=Fo;exports.Table=Qn;exports.TableSkeleton=Ll;exports.TenderMethods=Vo;exports.TicketSelection=Ep;exports.TileSelect=ho;exports.Toggle=Cl;exports.ToolbarButton=zl;exports.UnderlineTabs=Bl;exports.WizardShell=_o;exports.adminFieldErrorClass=ql;exports.adminFieldHintClass=Wl;exports.adminFieldLabelClass=ua;exports.adminFieldLabelSuffixClass=ma;exports.adminInputClass=Ul;exports.adminInputReadOnlyClass=Hl;exports.adminInputWrapperClass=Vl;exports.adminRowClass=Rl;exports.adminSurfaceCss=cd;exports.adminSurfaceTokens=On;exports.adminTableClass=Ml;exports.adminTableFooterClass=Pl;exports.adminTdClass=_l;exports.adminThClass=Fl;exports.assistantSurfaceTokens=zn;exports.calculateAllocationDifference=of;exports.computeChange=Sn;exports.currencyFractionDigits=Pt;exports.defaultAssistantLinkPolicy=Sc;exports.formatAssistantDuration=vc;exports.formatMoney=fe;exports.formatOfferCurrency=An;exports.formatRevenueAmount=nf;exports.formatRevenueCurrency=af;exports.generateAutomaticInstallments=bl;exports.generateDistributionId=ra;exports.getCurrencySymbol=rf;exports.offerCardVariants=Xi;exports.offerListVariants=Zi;exports.pageRange=no;exports.parseOfferCurrency=Dm;exports.parseRevenueCurrency=lf;exports.pillTabId=Ca;exports.pillTabPanelId=ka;exports.pillTabPanelProps=mb;exports.posSurfaceTokens=le;exports.roundToCurrency=Zn;exports.useControlSize=ud;exports.useDensity=Ms;exports.useDiscardGuard=nh;exports.useDiscardGuardActions=Vx;exports.useModalPanel=Hx;exports.useModalPanels=sh;exports.useReportUnsavedChanges=Bx;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
42
43
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:underline}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();