@wakastellar/ui 4.0.1 → 4.1.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 (622) hide show
  1. package/dist/blocks/_shared/identity/InviteUserPanel.cjs.js +1 -1
  2. package/dist/blocks/_shared/identity/RoleSelect.cjs.js +1 -1
  3. package/dist/blocks/_shared/identity/SidePushLayout.cjs.js +1 -1
  4. package/dist/blocks/activity-timeline/index.cjs.js +1 -1
  5. package/dist/blocks/activity-timeline/index.es.js +1 -1
  6. package/dist/blocks/antivirus-dashboard/index.cjs.js +1 -1
  7. package/dist/blocks/antivirus-dashboard/index.es.js +1 -1
  8. package/dist/blocks/api-keys-manager/index.cjs.js +1 -1
  9. package/dist/blocks/apm-overview/index.cjs.js +1 -1
  10. package/dist/blocks/auth-2fa/index.cjs.js +2 -2
  11. package/dist/blocks/auth-2fa/index.es.js +1 -1
  12. package/dist/blocks/avatar-upload/index.cjs.js +1 -1
  13. package/dist/blocks/avatar-upload/index.es.js +13 -13
  14. package/dist/blocks/calendar-view/index.cjs.js +1 -1
  15. package/dist/blocks/calendar-view/index.es.js +1 -1
  16. package/dist/blocks/chat/index.cjs.js +1 -1
  17. package/dist/blocks/chat/index.es.js +162 -162
  18. package/dist/blocks/chat/widget.cjs.js +1 -1
  19. package/dist/blocks/chat/widget.es.js +19 -13
  20. package/dist/blocks/chat-interface/index.cjs.js +1 -1
  21. package/dist/blocks/chat-interface/index.es.js +1 -1
  22. package/dist/blocks/checkout-flow/index.cjs.js +1 -1
  23. package/dist/blocks/checkout-flow/index.es.js +1 -1
  24. package/dist/blocks/cicd-builder/index.cjs.js +1 -1
  25. package/dist/blocks/clamav-service-status/index.cjs.js +1 -1
  26. package/dist/blocks/cloud-cost-dashboard/index.cjs.js +1 -1
  27. package/dist/blocks/container-orchestrator/index.cjs.js +1 -1
  28. package/dist/blocks/container-orchestrator/index.es.js +2 -1
  29. package/dist/blocks/dashboard/index.cjs.js +1 -1
  30. package/dist/blocks/dashboard/index.es.js +2 -2
  31. package/dist/blocks/dashboard-kpi/index.cjs.js +1 -1
  32. package/dist/blocks/dashboard-kpi/index.es.js +1 -1
  33. package/dist/blocks/database-admin/index.cjs.js +1 -1
  34. package/dist/blocks/deployment-dashboard/index.cjs.js +1 -1
  35. package/dist/blocks/deployment-dashboard/index.es.js +1 -1
  36. package/dist/blocks/empty-states/index.cjs.js +1 -1
  37. package/dist/blocks/empty-states/index.es.js +1 -1
  38. package/dist/blocks/error-pages/index.cjs.js +1 -1
  39. package/dist/blocks/error-pages/index.es.js +1 -1
  40. package/dist/blocks/faq/index.cjs.js +1 -1
  41. package/dist/blocks/faq/index.es.js +1 -1
  42. package/dist/blocks/file-manager/index.cjs.js +1 -1
  43. package/dist/blocks/file-manager/index.es.js +1 -1
  44. package/dist/blocks/file-scan-uploader/index.cjs.js +1 -1
  45. package/dist/blocks/file-scan-uploader/index.es.js +2 -2
  46. package/dist/blocks/footer/index.cjs.js +1 -1
  47. package/dist/blocks/gitops-sync-status/index.cjs.js +1 -1
  48. package/dist/blocks/header/index.cjs.js +1 -1
  49. package/dist/blocks/header/index.es.js +1 -1
  50. package/dist/blocks/headtab/index.cjs.js +1 -1
  51. package/dist/blocks/i18n-editor/index.cjs.js +1 -1
  52. package/dist/blocks/i18n-editor/index.es.js +127 -127
  53. package/dist/blocks/incident-manager/index.cjs.js +1 -1
  54. package/dist/blocks/infrastructure-map/index.cjs.js +1 -1
  55. package/dist/blocks/kanban-board/index.cjs.js +1 -1
  56. package/dist/blocks/kanban-board/index.es.js +1 -1
  57. package/dist/blocks/landing/index.cjs.js +1 -1
  58. package/dist/blocks/landing/index.es.js +1 -1
  59. package/dist/blocks/language-selector/index.cjs.js +1 -1
  60. package/dist/blocks/layout/index.cjs.js +1 -1
  61. package/dist/blocks/login/index.cjs.js +1 -1
  62. package/dist/blocks/on-call-schedule/index.cjs.js +1 -1
  63. package/dist/blocks/player-profile/index.cjs.js +1 -1
  64. package/dist/blocks/player-profile/index.es.js +1 -1
  65. package/dist/blocks/pricing/index.cjs.js +1 -1
  66. package/dist/blocks/pricing/index.es.js +1 -1
  67. package/dist/blocks/profile/index.cjs.js +1 -1
  68. package/dist/blocks/profile/index.es.js +1 -1
  69. package/dist/blocks/profile-list/index.cjs.js +1 -1
  70. package/dist/blocks/quarantine-manager/index.cjs.js +1 -1
  71. package/dist/blocks/quarantine-manager/index.es.js +1 -1
  72. package/dist/blocks/release-notes/index.cjs.js +1 -1
  73. package/dist/blocks/scan-history-log/index.cjs.js +1 -1
  74. package/dist/blocks/scan-history-log/index.es.js +1 -1
  75. package/dist/blocks/scan-policy-editor/index.cjs.js +1 -1
  76. package/dist/blocks/scan-report-generator/index.cjs.js +1 -1
  77. package/dist/blocks/settings/index.cjs.js +1 -1
  78. package/dist/blocks/settings/index.es.js +1 -1
  79. package/dist/blocks/sidebar/index.cjs.js +1 -1
  80. package/dist/blocks/sidebar/index.es.js +1 -1
  81. package/dist/blocks/signature-database-manager/index.cjs.js +1 -1
  82. package/dist/blocks/team-form/index.cjs.js +1 -1
  83. package/dist/blocks/threat-alert-banner/index.cjs.js +1 -1
  84. package/dist/blocks/user-management/index.cjs.js +1 -1
  85. package/dist/blocks/waka-doc-shell/index.cjs.js +1 -1
  86. package/dist/blocks/wizard/index.cjs.js +1 -1
  87. package/dist/blocks/wizard/index.es.js +37 -37
  88. package/dist/charts.cjs.js +1 -1
  89. package/dist/charts.es.js +8 -8
  90. package/dist/cli/index.cjs +5 -1
  91. package/dist/components/DataTable/DataTable.cjs.js +1 -1
  92. package/dist/components/DataTable/DataTable.es.js +68 -66
  93. package/dist/components/DataTable/DataTableAdvanced.cjs.js +1 -1
  94. package/dist/components/DataTable/DataTableColumnResizer.cjs.js +1 -1
  95. package/dist/components/DataTable/DataTableContextMenu.cjs.js +1 -1
  96. package/dist/components/DataTable/DataTableEditCell.cjs.js +1 -1
  97. package/dist/components/DataTable/DataTableFilters.cjs.js +1 -1
  98. package/dist/components/DataTable/DataTableGrouping.cjs.js +1 -1
  99. package/dist/components/DataTable/DataTablePagination.cjs.js +1 -1
  100. package/dist/components/DataTable/DataTablePagination.d.ts +3 -1
  101. package/dist/components/DataTable/DataTablePagination.es.js +38 -27
  102. package/dist/components/DataTable/DataTableSelection.cjs.js +1 -1
  103. package/dist/components/DataTable/DataTableToolbar.cjs.js +1 -1
  104. package/dist/components/DataTable/hooks/useDataTable.cjs.js +1 -1
  105. package/dist/components/DataTable/hooks/useDataTable.es.js +5 -1
  106. package/dist/components/DataTable/hooks/useDataTableAdvanced.cjs.js +1 -1
  107. package/dist/components/DataTable/hooks/useDataTableEdit.cjs.js +1 -1
  108. package/dist/components/DataTable/hooks/useDataTableExport.cjs.js +2 -2
  109. package/dist/components/DataTable/hooks/useDataTableImport.cjs.js +2 -2
  110. package/dist/components/DataTable/hooks/useDataTableImport.es.js +2 -1
  111. package/dist/components/DataTable/hooks/useDataTableTheme.cjs.js +1 -1
  112. package/dist/components/DataTable/hooks/useDataTableVirtualization.cjs.js +1 -1
  113. package/dist/components/DataTable/hooks/useTableLayout.cjs.js +1 -1
  114. package/dist/components/DataTable/utils.cjs.js +1 -1
  115. package/dist/components/accordion/index.cjs.js +1 -1
  116. package/dist/components/alert/index.cjs.js +1 -1
  117. package/dist/components/alert-dialog/index.cjs.js +1 -1
  118. package/dist/components/aspect-ratio/index.cjs.js +1 -1
  119. package/dist/components/avatar/index.cjs.js +1 -1
  120. package/dist/components/badge/index.cjs.js +1 -1
  121. package/dist/components/button/index.cjs.js +1 -1
  122. package/dist/components/calendar/index.cjs.js +1 -1
  123. package/dist/components/card/index.cjs.js +1 -1
  124. package/dist/components/checkbox/index.cjs.js +1 -1
  125. package/dist/components/code/index.cjs.js +2 -2
  126. package/dist/components/code/index.es.js +3 -2
  127. package/dist/components/collapsible/index.cjs.js +1 -1
  128. package/dist/components/command/index.cjs.js +1 -1
  129. package/dist/components/context-menu/index.cjs.js +1 -1
  130. package/dist/components/dialog/index.cjs.js +1 -1
  131. package/dist/components/dropdown-menu/index.cjs.js +1 -1
  132. package/dist/components/editor/blocks/index.cjs.js +1 -1
  133. package/dist/components/editor/blocks/index.es.js +12 -12
  134. package/dist/components/editor/blocks/waka-acceptance-criteria-block.cjs.js +1 -1
  135. package/dist/components/editor/blocks/waka-ai-assist-block.cjs.js +1 -1
  136. package/dist/components/editor/blocks/waka-api-endpoint-block.cjs.js +1 -1
  137. package/dist/components/editor/blocks/waka-code-playground-block.cjs.js +1 -1
  138. package/dist/components/editor/blocks/waka-comment-thread-block.cjs.js +1 -1
  139. package/dist/components/editor/blocks/waka-diagram-block.cjs.js +3 -3
  140. package/dist/components/editor/blocks/waka-diagram-block.es.js +21 -40
  141. package/dist/components/editor/blocks/waka-embed-block.cjs.js +1 -1
  142. package/dist/components/editor/blocks/waka-slash-menu-block.cjs.js +1 -1
  143. package/dist/components/editor/blocks/waka-user-story-block.cjs.js +1 -1
  144. package/dist/components/editor/blocks/waka-version-diff-block.cjs.js +1 -1
  145. package/dist/components/editor/waka-ai-writer.cjs.js +1 -1
  146. package/dist/components/editor/waka-collaborative-editor.cjs.js +1 -1
  147. package/dist/components/editor/waka-diff-viewer.cjs.js +1 -1
  148. package/dist/components/editor/waka-dnd-editor.cjs.js +1 -1
  149. package/dist/components/editor/waka-document-editor.cjs.js +1 -1
  150. package/dist/components/editor/waka-document-editor.es.js +1 -1
  151. package/dist/components/editor/waka-editor-elements.cjs.js +1 -1
  152. package/dist/components/editor/waka-editor-leaves.cjs.js +1 -1
  153. package/dist/components/editor/waka-editor-toolbar.cjs.js +1 -1
  154. package/dist/components/editor/waka-editor.cjs.js +1 -1
  155. package/dist/components/editor/waka-floating-toolbar.cjs.js +1 -1
  156. package/dist/components/editor/waka-markdown-editor.cjs.js +1 -1
  157. package/dist/components/editor/waka-mention-editor.cjs.js +1 -1
  158. package/dist/components/editor/waka-mention-editor.es.js +2 -2
  159. package/dist/components/editor/waka-slash-menu.cjs.js +1 -1
  160. package/dist/components/editor/waka-spec-editor.cjs.js +1 -1
  161. package/dist/components/form/index.cjs.js +1 -1
  162. package/dist/components/hover-card/index.cjs.js +1 -1
  163. package/dist/components/input/index.cjs.js +1 -1
  164. package/dist/components/input-otp/index.cjs.js +1 -1
  165. package/dist/components/input-otp/index.es.js +2 -1
  166. package/dist/components/label/index.cjs.js +1 -1
  167. package/dist/components/language-selector/index.cjs.js +1 -1
  168. package/dist/components/menubar/index.cjs.js +1 -1
  169. package/dist/components/navigation-menu/index.cjs.js +1 -1
  170. package/dist/components/popover/index.cjs.js +1 -1
  171. package/dist/components/progress/index.cjs.js +1 -1
  172. package/dist/components/radio-group/index.cjs.js +1 -1
  173. package/dist/components/resizable/index.cjs.js +1 -1
  174. package/dist/components/resizable/index.es.js +9 -9
  175. package/dist/components/scroll-area/index.cjs.js +1 -1
  176. package/dist/components/select/index.cjs.js +1 -1
  177. package/dist/components/separator/index.cjs.js +1 -1
  178. package/dist/components/sheet/index.cjs.js +1 -1
  179. package/dist/components/skeleton/index.cjs.js +1 -1
  180. package/dist/components/slider/index.cjs.js +1 -1
  181. package/dist/components/switch/index.cjs.js +1 -1
  182. package/dist/components/table/index.cjs.js +1 -1
  183. package/dist/components/tabs/index.cjs.js +1 -1
  184. package/dist/components/textarea/index.cjs.js +1 -1
  185. package/dist/components/theme-selector/index.cjs.js +1 -1
  186. package/dist/components/toast/index.cjs.js +1 -1
  187. package/dist/components/toaster/index.cjs.js +1 -1
  188. package/dist/components/toggle/index.cjs.js +1 -1
  189. package/dist/components/toggle-group/index.cjs.js +1 -1
  190. package/dist/components/tooltip/index.cjs.js +1 -1
  191. package/dist/components/typography/index.cjs.js +1 -1
  192. package/dist/components/waka-3d-pie-chart/index.cjs.js +1 -1
  193. package/dist/components/waka-3d-pie-chart/index.es.js +1 -1
  194. package/dist/components/waka-achievement-unlock/index.cjs.js +1 -1
  195. package/dist/components/waka-achievement-unlock/index.es.js +1 -1
  196. package/dist/components/waka-activity-feed/index.cjs.js +2 -2
  197. package/dist/components/waka-activity-feed/index.es.js +1 -1
  198. package/dist/components/waka-ad-banner/index.cjs.js +1 -1
  199. package/dist/components/waka-ad-banner/index.es.js +18 -15
  200. package/dist/components/waka-ad-fallback/index.cjs.js +1 -1
  201. package/dist/components/waka-ad-fallback/index.es.js +1 -1
  202. package/dist/components/waka-ad-inline/index.cjs.js +1 -1
  203. package/dist/components/waka-ad-inline/index.es.js +2 -2
  204. package/dist/components/waka-ad-interstitial/index.cjs.js +1 -1
  205. package/dist/components/waka-ad-interstitial/index.es.js +3 -3
  206. package/dist/components/waka-ad-placeholder/index.cjs.js +2 -2
  207. package/dist/components/waka-ad-placeholder/index.es.js +1 -1
  208. package/dist/components/waka-ad-provider/index.cjs.js +1 -1
  209. package/dist/components/waka-ad-provider/index.es.js +1 -1
  210. package/dist/components/waka-ad-sidebar/index.cjs.js +1 -1
  211. package/dist/components/waka-ad-sidebar/index.es.js +2 -2
  212. package/dist/components/waka-ad-sticky-footer/index.cjs.js +1 -1
  213. package/dist/components/waka-ad-sticky-footer/index.es.js +2 -2
  214. package/dist/components/waka-address-autocomplete/index.cjs.js +2 -2
  215. package/dist/components/waka-address-autocomplete/index.es.js +10 -6
  216. package/dist/components/waka-admincrumb/index.cjs.js +1 -1
  217. package/dist/components/waka-alert-panel/index.cjs.js +1 -1
  218. package/dist/components/waka-alert-stack/index.cjs.js +1 -1
  219. package/dist/components/waka-alert-stack/index.es.js +1 -1
  220. package/dist/components/waka-allocation-matrix/index.cjs.js +2 -2
  221. package/dist/components/waka-allocation-matrix/index.es.js +1 -1
  222. package/dist/components/waka-approval-chain/index.cjs.js +1 -1
  223. package/dist/components/waka-approval-chain/index.es.js +1 -1
  224. package/dist/components/waka-artifact-list/index.cjs.js +1 -1
  225. package/dist/components/waka-artifact-list/index.es.js +1 -1
  226. package/dist/components/waka-audit-log/index.cjs.js +2 -2
  227. package/dist/components/waka-audit-log/index.es.js +1 -1
  228. package/dist/components/waka-autocomplete/index.cjs.js +1 -1
  229. package/dist/components/waka-autocomplete/index.es.js +3 -2
  230. package/dist/components/waka-badge-showcase/index.cjs.js +1 -1
  231. package/dist/components/waka-barcode/index.cjs.js +1 -1
  232. package/dist/components/waka-barcode/index.es.js +1 -1
  233. package/dist/components/waka-biometric-prompt/index.cjs.js +2 -2
  234. package/dist/components/waka-biometric-prompt/index.es.js +1 -1
  235. package/dist/components/waka-bottom-sheet/index.cjs.js +1 -1
  236. package/dist/components/waka-bottom-sheet/index.es.js +12 -7
  237. package/dist/components/waka-breadcrumb/index.cjs.js +1 -1
  238. package/dist/components/waka-breadcrumb/index.es.js +1 -1
  239. package/dist/components/waka-breadcrumb-path/index.cjs.js +1 -1
  240. package/dist/components/waka-breadcrumb-path/index.es.js +1 -1
  241. package/dist/components/waka-budget-burn/index.cjs.js +2 -2
  242. package/dist/components/waka-budget-burn/index.es.js +3 -3
  243. package/dist/components/waka-build-matrix/index.cjs.js +1 -1
  244. package/dist/components/waka-capacity-planner/index.cjs.js +2 -2
  245. package/dist/components/waka-capacity-planner/index.es.js +1 -1
  246. package/dist/components/waka-carousel/index.cjs.js +1 -1
  247. package/dist/components/waka-carousel/index.es.js +2 -2
  248. package/dist/components/waka-cart-summary/index.cjs.js +1 -1
  249. package/dist/components/waka-cart-summary/index.es.js +2 -2
  250. package/dist/components/waka-challenge-timer/index.cjs.js +1 -1
  251. package/dist/components/waka-charts/WakaAreaChart.cjs.js +1 -1
  252. package/dist/components/waka-charts/WakaAreaChart.es.js +2 -2
  253. package/dist/components/waka-charts/WakaBarChart.cjs.js +1 -1
  254. package/dist/components/waka-charts/WakaBarChart.es.js +2 -2
  255. package/dist/components/waka-charts/WakaChart.cjs.js +1 -1
  256. package/dist/components/waka-charts/WakaChart.es.js +1 -1
  257. package/dist/components/waka-charts/WakaLineChart.cjs.js +1 -1
  258. package/dist/components/waka-charts/WakaLineChart.es.js +2 -2
  259. package/dist/components/waka-charts/WakaMiniChart.cjs.js +1 -1
  260. package/dist/components/waka-charts/WakaMiniChart.es.js +2 -2
  261. package/dist/components/waka-charts/WakaPieChart.cjs.js +1 -1
  262. package/dist/components/waka-charts/WakaPieChart.es.js +2 -2
  263. package/dist/components/waka-charts/WakaSparkline.cjs.js +1 -1
  264. package/dist/components/waka-charts/WakaSparkline.es.js +1 -1
  265. package/dist/components/waka-charts/dataTableHelpers.cjs.js +1 -1
  266. package/dist/components/waka-charts/dataTableHelpers.es.js +1 -1
  267. package/dist/components/waka-charts/hooks/useChartTheme.cjs.js +1 -1
  268. package/dist/components/waka-charts/hooks/useChartTheme.es.js +1 -1
  269. package/dist/components/waka-charts/hooks/useRechartsLoader.cjs.js +1 -1
  270. package/dist/components/waka-charts/hooks/useRechartsLoader.es.js +1 -1
  271. package/dist/components/waka-chat-bubble/index.cjs.js +1 -1
  272. package/dist/components/waka-checklist/index.cjs.js +2 -2
  273. package/dist/components/waka-checklist/index.es.js +1 -1
  274. package/dist/components/waka-checkout-stepper/index.cjs.js +1 -1
  275. package/dist/components/waka-checkout-stepper/index.es.js +1 -1
  276. package/dist/components/waka-cohort-table/index.cjs.js +2 -2
  277. package/dist/components/waka-cohort-table/index.es.js +1 -1
  278. package/dist/components/waka-color-picker/index.cjs.js +2 -2
  279. package/dist/components/waka-color-picker/index.es.js +1 -1
  280. package/dist/components/waka-combo-counter/index.cjs.js +1 -1
  281. package/dist/components/waka-combobox/index.cjs.js +1 -1
  282. package/dist/components/waka-combobox/index.es.js +3 -2
  283. package/dist/components/waka-command-bar/index.cjs.js +1 -1
  284. package/dist/components/waka-compare-period/index.cjs.js +2 -2
  285. package/dist/components/waka-compare-period/index.es.js +7 -5
  286. package/dist/components/waka-config-comparator/index.cjs.js +1 -1
  287. package/dist/components/waka-config-comparator/index.es.js +1 -1
  288. package/dist/components/waka-connection-matrix/index.cjs.js +1 -1
  289. package/dist/components/waka-connection-matrix/index.es.js +1 -1
  290. package/dist/components/waka-container-list/index.cjs.js +1 -1
  291. package/dist/components/waka-container-list/index.es.js +1 -1
  292. package/dist/components/waka-content-recommendation/index.cjs.js +1 -1
  293. package/dist/components/waka-content-recommendation/index.es.js +2 -2
  294. package/dist/components/waka-contribution-graph/index.cjs.js +1 -1
  295. package/dist/components/waka-contribution-graph/index.es.js +4 -4
  296. package/dist/components/waka-cost-breakdown/index.cjs.js +1 -1
  297. package/dist/components/waka-cost-breakdown/index.es.js +7 -7
  298. package/dist/components/waka-coupon-input/index.cjs.js +2 -2
  299. package/dist/components/waka-coupon-input/index.es.js +1 -1
  300. package/dist/components/waka-credit-activity-feed/index.cjs.js +2 -2
  301. package/dist/components/waka-credit-activity-feed/index.es.js +1 -1
  302. package/dist/components/waka-credit-alert/index.cjs.js +1 -1
  303. package/dist/components/waka-credit-alert/index.es.js +1 -1
  304. package/dist/components/waka-credit-balance/index.cjs.js +1 -1
  305. package/dist/components/waka-credit-balance/index.es.js +3 -3
  306. package/dist/components/waka-credit-breakdown/index.cjs.js +1 -1
  307. package/dist/components/waka-credit-breakdown/index.es.js +1 -1
  308. package/dist/components/waka-credit-burn-rate/index.cjs.js +1 -1
  309. package/dist/components/waka-credit-burn-rate/index.es.js +1 -1
  310. package/dist/components/waka-credit-card-input/index.cjs.js +1 -1
  311. package/dist/components/waka-credit-card-input/index.es.js +1 -1
  312. package/dist/components/waka-credit-history/index.cjs.js +1 -1
  313. package/dist/components/waka-credit-history/index.es.js +1 -1
  314. package/dist/components/waka-credit-meter/index.cjs.js +2 -2
  315. package/dist/components/waka-credit-meter/index.es.js +3 -3
  316. package/dist/components/waka-credit-pricing-pack/index.cjs.js +1 -1
  317. package/dist/components/waka-credit-pricing-pack/index.es.js +1 -1
  318. package/dist/components/waka-credit-projection/index.cjs.js +1 -1
  319. package/dist/components/waka-credit-projection/index.es.js +1 -1
  320. package/dist/components/waka-credit-quota/index.cjs.js +1 -1
  321. package/dist/components/waka-credit-quota/index.es.js +3 -3
  322. package/dist/components/waka-credit-receipt/index.cjs.js +1 -1
  323. package/dist/components/waka-credit-receipt/index.es.js +1 -1
  324. package/dist/components/waka-credit-top-up/index.cjs.js +1 -1
  325. package/dist/components/waka-credit-top-up/index.es.js +1 -1
  326. package/dist/components/waka-credit-transaction/index.cjs.js +1 -1
  327. package/dist/components/waka-credit-transaction/index.es.js +1 -1
  328. package/dist/components/waka-credit-transfer-form/index.cjs.js +1 -1
  329. package/dist/components/waka-credit-transfer-form/index.es.js +1 -1
  330. package/dist/components/waka-credit-usage-chart/index.cjs.js +1 -1
  331. package/dist/components/waka-credit-usage-chart/index.es.js +1 -1
  332. package/dist/components/waka-daily-reward/index.cjs.js +1 -1
  333. package/dist/components/waka-database-card/index.cjs.js +1 -1
  334. package/dist/components/waka-database-card/index.es.js +1 -1
  335. package/dist/components/waka-date-range-picker/index.cjs.js +1 -1
  336. package/dist/components/waka-date-range-picker/index.es.js +3 -2
  337. package/dist/components/waka-datetime-picker/index.cjs.js +1 -1
  338. package/dist/components/waka-datetime-picker/index.es.js +4 -1
  339. package/dist/components/waka-datetime-picker.form-integration/index.cjs.js +1 -1
  340. package/dist/components/waka-dependency-tree/index.cjs.js +1 -1
  341. package/dist/components/waka-dependency-tree/index.es.js +1 -1
  342. package/dist/components/waka-deployment-lane/index.cjs.js +1 -1
  343. package/dist/components/waka-deployment-lane/index.es.js +1 -1
  344. package/dist/components/waka-device-trust/index.cjs.js +2 -2
  345. package/dist/components/waka-device-trust/index.es.js +1 -1
  346. package/dist/components/waka-doc-breadcrumb/index.cjs.js +1 -1
  347. package/dist/components/waka-doc-callout/index.cjs.js +1 -1
  348. package/dist/components/waka-doc-code-block/index.cjs.js +1 -1
  349. package/dist/components/waka-doc-nav/index.cjs.js +1 -1
  350. package/dist/components/waka-doc-renderer/index.cjs.js +1 -1
  351. package/dist/components/waka-doc-search/index.cjs.js +1 -1
  352. package/dist/components/waka-doc-table/index.cjs.js +1 -1
  353. package/dist/components/waka-doc-toc/index.cjs.js +1 -1
  354. package/dist/components/waka-doc-toolbar/index.cjs.js +1 -1
  355. package/dist/components/waka-doc-version/index.cjs.js +1 -1
  356. package/dist/components/waka-dock/index.cjs.js +1 -1
  357. package/dist/components/waka-dock/index.es.js +2 -2
  358. package/dist/components/waka-drawer/index.cjs.js +1 -1
  359. package/dist/components/waka-drawer/index.es.js +1 -1
  360. package/dist/components/waka-empty-state/index.cjs.js +1 -1
  361. package/dist/components/waka-env-var-editor/index.cjs.js +1 -1
  362. package/dist/components/waka-error-shake/index.cjs.js +1 -1
  363. package/dist/components/waka-feature-announcement/index.cjs.js +2 -2
  364. package/dist/components/waka-feature-announcement/index.es.js +1 -1
  365. package/dist/components/waka-feature-flag-row/index.cjs.js +1 -1
  366. package/dist/components/waka-file-upload/index.cjs.js +1 -1
  367. package/dist/components/waka-file-upload/index.es.js +2 -2
  368. package/dist/components/waka-floating-nav/index.cjs.js +1 -1
  369. package/dist/components/waka-floating-nav/index.es.js +1 -1
  370. package/dist/components/waka-flow-diagram/index.cjs.js +1 -1
  371. package/dist/components/waka-funnel-chart/index.cjs.js +2 -2
  372. package/dist/components/waka-funnel-chart/index.es.js +1 -1
  373. package/dist/components/waka-glow-card/index.cjs.js +1 -1
  374. package/dist/components/waka-glow-card/index.es.js +3 -3
  375. package/dist/components/waka-goal-progress/index.cjs.js +3 -3
  376. package/dist/components/waka-goal-progress/index.es.js +3 -3
  377. package/dist/components/waka-haptic-button/index.cjs.js +1 -1
  378. package/dist/components/waka-health-pulse/index.cjs.js +2 -2
  379. package/dist/components/waka-health-pulse/index.es.js +1 -1
  380. package/dist/components/waka-heatmap/index.cjs.js +1 -1
  381. package/dist/components/waka-heatmap/index.es.js +3 -3
  382. package/dist/components/waka-hotspot/index.cjs.js +1 -1
  383. package/dist/components/waka-image/index.cjs.js +1 -1
  384. package/dist/components/waka-image/index.es.js +1 -1
  385. package/dist/components/waka-incident-timeline/index.cjs.js +1 -1
  386. package/dist/components/waka-incident-timeline/index.es.js +3 -2
  387. package/dist/components/waka-invoice-preview/index.cjs.js +1 -1
  388. package/dist/components/waka-invoice-preview/index.es.js +1 -1
  389. package/dist/components/waka-kanban/index.cjs.js +1 -1
  390. package/dist/components/waka-kanban/index.es.js +1 -1
  391. package/dist/components/waka-kpi-dashboard/index.cjs.js +1 -1
  392. package/dist/components/waka-kpi-dashboard/index.es.js +6 -4
  393. package/dist/components/waka-kubernetes-overview/index.cjs.js +1 -1
  394. package/dist/components/waka-kubernetes-overview/index.es.js +1 -1
  395. package/dist/components/waka-leaderboard/index.cjs.js +1 -1
  396. package/dist/components/waka-level-progress/index.cjs.js +2 -2
  397. package/dist/components/waka-level-progress/index.es.js +2 -2
  398. package/dist/components/waka-liquid-button/index.cjs.js +1 -1
  399. package/dist/components/waka-loading-orbit/index.cjs.js +1 -1
  400. package/dist/components/waka-log-viewer/index.cjs.js +1 -1
  401. package/dist/components/waka-loot-box/index.cjs.js +2 -2
  402. package/dist/components/waka-loot-box/index.es.js +1 -1
  403. package/dist/components/waka-magic-link/index.cjs.js +2 -2
  404. package/dist/components/waka-magnetic-button/index.cjs.js +1 -1
  405. package/dist/components/waka-mention-input/index.cjs.js +1 -1
  406. package/dist/components/waka-mention-input/index.es.js +52 -40
  407. package/dist/components/waka-metric-sparkline/index.cjs.js +1 -1
  408. package/dist/components/waka-metric-sparkline/index.es.js +1 -1
  409. package/dist/components/waka-migration-list/index.cjs.js +1 -1
  410. package/dist/components/waka-milestone-road/index.cjs.js +2 -2
  411. package/dist/components/waka-milestone-road/index.es.js +5 -5
  412. package/dist/components/waka-modal/index.cjs.js +1 -1
  413. package/dist/components/waka-modal/index.es.js +1 -1
  414. package/dist/components/waka-morph-button/index.cjs.js +2 -2
  415. package/dist/components/waka-morph-button/index.es.js +6 -2
  416. package/dist/components/waka-network-topology/index.cjs.js +1 -1
  417. package/dist/components/waka-network-topology/index.es.js +4 -2
  418. package/dist/components/waka-notifications/index.cjs.js +1 -1
  419. package/dist/components/waka-number-input/index.cjs.js +1 -1
  420. package/dist/components/waka-number-input/index.es.js +1 -1
  421. package/dist/components/waka-orbital-menu/index.cjs.js +1 -1
  422. package/dist/components/waka-orbital-menu/index.es.js +1 -1
  423. package/dist/components/waka-order-tracker/index.cjs.js +1 -1
  424. package/dist/components/waka-order-tracker/index.es.js +3 -2
  425. package/dist/components/waka-outstream-video/index.cjs.js +1 -1
  426. package/dist/components/waka-outstream-video/index.es.js +2 -2
  427. package/dist/components/waka-pagination/index.cjs.js +1 -1
  428. package/dist/components/waka-pagination/index.es.js +1 -1
  429. package/dist/components/waka-password-strength/index.cjs.js +2 -2
  430. package/dist/components/waka-password-strength/index.es.js +3 -3
  431. package/dist/components/waka-payment-method-picker/index.cjs.js +1 -1
  432. package/dist/components/waka-payment-method-picker/index.es.js +1 -1
  433. package/dist/components/waka-permission-matrix/index.cjs.js +2 -2
  434. package/dist/components/waka-permission-matrix/index.es.js +3 -2
  435. package/dist/components/waka-phone-input/index.cjs.js +1 -1
  436. package/dist/components/waka-phone-input/index.es.js +5 -3
  437. package/dist/components/waka-pipeline-view/index.cjs.js +2 -2
  438. package/dist/components/waka-pipeline-view/index.es.js +1 -1
  439. package/dist/components/waka-player-card/index.cjs.js +2 -2
  440. package/dist/components/waka-player-card/index.es.js +4 -4
  441. package/dist/components/waka-pod-card/index.cjs.js +1 -1
  442. package/dist/components/waka-pod-card/index.es.js +1 -1
  443. package/dist/components/waka-points-popup/index.cjs.js +1 -1
  444. package/dist/components/waka-points-popup/index.es.js +5 -1
  445. package/dist/components/waka-power-up/index.cjs.js +1 -1
  446. package/dist/components/waka-presence-indicator/index.cjs.js +2 -2
  447. package/dist/components/waka-presence-indicator/index.es.js +1 -1
  448. package/dist/components/waka-pricing-table/index.cjs.js +2 -2
  449. package/dist/components/waka-pricing-table/index.es.js +1 -1
  450. package/dist/components/waka-product-card/index.cjs.js +1 -1
  451. package/dist/components/waka-progress-onboarding/index.cjs.js +3 -3
  452. package/dist/components/waka-progress-onboarding/index.es.js +1 -1
  453. package/dist/components/waka-pull-to-refresh/index.cjs.js +1 -1
  454. package/dist/components/waka-qrcode/index.cjs.js +1 -1
  455. package/dist/components/waka-qrcode/index.es.js +1 -1
  456. package/dist/components/waka-query-explain/index.cjs.js +1 -1
  457. package/dist/components/waka-quest-card/index.cjs.js +2 -2
  458. package/dist/components/waka-quest-card/index.es.js +4 -1
  459. package/dist/components/waka-quota-bar/index.cjs.js +2 -2
  460. package/dist/components/waka-quota-bar/index.es.js +11 -4
  461. package/dist/components/waka-radar-score/index.cjs.js +1 -1
  462. package/dist/components/waka-radar-score/index.es.js +6 -6
  463. package/dist/components/waka-rank-badge/index.cjs.js +2 -2
  464. package/dist/components/waka-rank-badge/index.es.js +1 -1
  465. package/dist/components/waka-rating-input/index.cjs.js +2 -2
  466. package/dist/components/waka-rating-input/index.es.js +1 -1
  467. package/dist/components/waka-reaction-picker/index.cjs.js +1 -1
  468. package/dist/components/waka-reaction-picker/index.es.js +7 -4
  469. package/dist/components/waka-region-map/index.cjs.js +1 -1
  470. package/dist/components/waka-region-map/index.es.js +1 -1
  471. package/dist/components/waka-resource-gauge/index.cjs.js +2 -2
  472. package/dist/components/waka-resource-gauge/index.es.js +3 -3
  473. package/dist/components/waka-resource-pool/index.cjs.js +2 -2
  474. package/dist/components/waka-resource-pool/index.es.js +1 -1
  475. package/dist/components/waka-rich-text-editor/index.cjs.js +1 -1
  476. package/dist/components/waka-rich-text-editor/index.es.js +1 -1
  477. package/dist/components/waka-rollback-slider/index.cjs.js +2 -2
  478. package/dist/components/waka-rollback-slider/index.es.js +5 -3
  479. package/dist/components/waka-sankey-diagram/index.cjs.js +2 -2
  480. package/dist/components/waka-sankey-diagram/index.es.js +5 -5
  481. package/dist/components/waka-schedule-picker/index.cjs.js +1 -1
  482. package/dist/components/waka-schedule-picker/index.es.js +3 -2
  483. package/dist/components/waka-scratch-card/index.cjs.js +2 -2
  484. package/dist/components/waka-scratch-card/index.es.js +1 -1
  485. package/dist/components/waka-season-pass/index.cjs.js +1 -1
  486. package/dist/components/waka-secret-card/index.cjs.js +1 -1
  487. package/dist/components/waka-security-scan-result/index.cjs.js +1 -1
  488. package/dist/components/waka-security-score/index.cjs.js +2 -2
  489. package/dist/components/waka-security-score/index.es.js +5 -5
  490. package/dist/components/waka-segmented-control/index.cjs.js +1 -1
  491. package/dist/components/waka-segmented-control/index.es.js +1 -1
  492. package/dist/components/waka-server-rack/index.cjs.js +1 -1
  493. package/dist/components/waka-service-graph/index.cjs.js +1 -1
  494. package/dist/components/waka-session-manager/index.cjs.js +1 -1
  495. package/dist/components/waka-session-manager/index.es.js +3 -2
  496. package/dist/components/waka-signature-pad/index.cjs.js +1 -1
  497. package/dist/components/waka-signature-pad/index.es.js +1 -1
  498. package/dist/components/waka-skeleton-wave/index.cjs.js +1 -1
  499. package/dist/components/waka-skill-tree/index.cjs.js +2 -2
  500. package/dist/components/waka-skill-tree/index.es.js +32 -32
  501. package/dist/components/waka-sla-tracker/index.cjs.js +1 -1
  502. package/dist/components/waka-sla-tracker/index.es.js +1 -1
  503. package/dist/components/waka-slider-range/index.cjs.js +1 -1
  504. package/dist/components/waka-slider-range/index.es.js +3 -3
  505. package/dist/components/waka-spin-wheel/index.cjs.js +2 -2
  506. package/dist/components/waka-spin-wheel/index.es.js +6 -6
  507. package/dist/components/waka-spinner/index.cjs.js +1 -1
  508. package/dist/components/waka-sponsored-badge/index.cjs.js +1 -1
  509. package/dist/components/waka-sponsored-badge/index.es.js +1 -1
  510. package/dist/components/waka-sponsored-card/index.cjs.js +1 -1
  511. package/dist/components/waka-sponsored-card/index.es.js +2 -2
  512. package/dist/components/waka-sponsored-feed/index.cjs.js +1 -1
  513. package/dist/components/waka-sponsored-feed/index.es.js +2 -2
  514. package/dist/components/waka-spotlight/index.cjs.js +1 -1
  515. package/dist/components/waka-spotlight/index.es.js +2 -1
  516. package/dist/components/waka-stat/index.cjs.js +1 -1
  517. package/dist/components/waka-stat/index.es.js +1 -1
  518. package/dist/components/waka-stats-hexagon/index.cjs.js +1 -1
  519. package/dist/components/waka-stats-hexagon/index.es.js +9 -9
  520. package/dist/components/waka-status-matrix/index.cjs.js +1 -1
  521. package/dist/components/waka-status-matrix/index.es.js +1 -1
  522. package/dist/components/waka-stepper/index.cjs.js +1 -1
  523. package/dist/components/waka-stepper/index.es.js +1 -1
  524. package/dist/components/waka-streak-counter/index.cjs.js +1 -1
  525. package/dist/components/waka-success-explosion/index.cjs.js +1 -1
  526. package/dist/components/waka-swipe-card/index.cjs.js +1 -1
  527. package/dist/components/waka-swipe-card/index.es.js +2 -2
  528. package/dist/components/waka-tabs-morph/index.cjs.js +1 -1
  529. package/dist/components/waka-tabs-morph/index.es.js +1 -1
  530. package/dist/components/waka-tag-input/index.cjs.js +1 -1
  531. package/dist/components/waka-tag-input/index.es.js +3 -2
  532. package/dist/components/waka-team-banner/index.cjs.js +2 -2
  533. package/dist/components/waka-team-banner/index.es.js +1 -1
  534. package/dist/components/waka-terminal-output/index.cjs.js +2 -2
  535. package/dist/components/waka-terminal-output/index.es.js +5 -3
  536. package/dist/components/waka-test-report/index.cjs.js +1 -1
  537. package/dist/components/waka-theme-creator/index.cjs.js +1 -1
  538. package/dist/components/waka-theme-manager/index.cjs.js +1 -1
  539. package/dist/components/waka-theme-manager/index.es.js +5 -2
  540. package/dist/components/waka-thread-view/index.cjs.js +2 -2
  541. package/dist/components/waka-thread-view/index.es.js +1 -1
  542. package/dist/components/waka-tilt-card/index.cjs.js +1 -1
  543. package/dist/components/waka-tilt-card/index.es.js +8 -6
  544. package/dist/components/waka-time-picker/index.cjs.js +1 -1
  545. package/dist/components/waka-time-picker/index.es.js +10 -6
  546. package/dist/components/waka-timeline/index.cjs.js +1 -1
  547. package/dist/components/waka-timeline/index.es.js +1 -1
  548. package/dist/components/waka-tooltip-tour/index.cjs.js +3 -3
  549. package/dist/components/waka-tooltip-tour/index.es.js +53 -51
  550. package/dist/components/waka-tour-guide/index.cjs.js +2 -2
  551. package/dist/components/waka-tour-guide/index.es.js +1 -1
  552. package/dist/components/waka-tournament-bracket/index.cjs.js +2 -2
  553. package/dist/components/waka-tournament-bracket/index.es.js +1 -1
  554. package/dist/components/waka-trace-viewer/index.cjs.js +1 -1
  555. package/dist/components/waka-tree/index.cjs.js +1 -1
  556. package/dist/components/waka-tree/index.es.js +1 -1
  557. package/dist/components/waka-treemap-chart/index.cjs.js +1 -1
  558. package/dist/components/waka-treemap-chart/index.es.js +1 -1
  559. package/dist/components/waka-two-factor-setup/index.cjs.js +2 -2
  560. package/dist/components/waka-two-factor-setup/index.es.js +5 -4
  561. package/dist/components/waka-typewriter/index.cjs.js +1 -1
  562. package/dist/components/waka-typewriter/index.es.js +7 -2
  563. package/dist/components/waka-typing-indicator/index.cjs.js +2 -2
  564. package/dist/components/waka-typing-indicator/index.es.js +1 -1
  565. package/dist/components/waka-versus-card/index.cjs.js +3 -3
  566. package/dist/components/waka-versus-card/index.es.js +5 -4
  567. package/dist/components/waka-video/index.cjs.js +1 -1
  568. package/dist/components/waka-video/index.es.js +1 -1
  569. package/dist/components/waka-video-ad/index.cjs.js +1 -1
  570. package/dist/components/waka-video-ad/index.es.js +3 -3
  571. package/dist/components/waka-video-call/index.cjs.js +2 -2
  572. package/dist/components/waka-video-call/index.es.js +1 -1
  573. package/dist/components/waka-video-overlay/index.cjs.js +1 -1
  574. package/dist/components/waka-video-overlay/index.es.js +2 -2
  575. package/dist/components/waka-virtual-list/index.cjs.js +1 -1
  576. package/dist/components/waka-virtual-list/index.es.js +1 -1
  577. package/dist/components/waka-voice-message/index.cjs.js +1 -1
  578. package/dist/components/waka-voice-message/index.es.js +6 -5
  579. package/dist/components/waka-welcome-modal/index.cjs.js +2 -2
  580. package/dist/components/waka-welcome-modal/index.es.js +1 -1
  581. package/dist/components/waka-xp-bar/index.cjs.js +1 -1
  582. package/dist/components/waka-xp-bar/index.es.js +2 -2
  583. package/dist/context/admincrumb-context.cjs.js +1 -1
  584. package/dist/context/language-context.cjs.js +1 -1
  585. package/dist/context/language-context.es.js +2 -2
  586. package/dist/context/theme-context.cjs.js +1 -1
  587. package/dist/context/theme-provider.cjs.js +1 -1
  588. package/dist/context/theme-provider.es.js +9 -6
  589. package/dist/context/waka-provider.cjs.js +1 -1
  590. package/dist/context/waka-provider.es.js +57 -53
  591. package/dist/doc.cjs.js +1 -1
  592. package/dist/editor.cjs.js +1 -1
  593. package/dist/export.cjs.js +1 -1
  594. package/dist/hooks/use-toast.cjs.js +1 -1
  595. package/dist/hooks/use-translation.cjs.js +1 -1
  596. package/dist/index.cjs.js +1 -1
  597. package/dist/index.d.ts +2 -0
  598. package/dist/index.es.js +279 -278
  599. package/dist/lib/i18n.cjs.js +1 -1
  600. package/dist/lib/i18n.es.js +11 -9
  601. package/dist/locales/default-resources.cjs.js +1 -0
  602. package/dist/locales/default-resources.d.ts +155 -0
  603. package/dist/locales/default-resources.es.js +150 -0
  604. package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.cjs.js +13 -13
  605. package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.es.js +13 -13
  606. package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.cjs.js +1 -1
  607. package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.es.js +19 -19
  608. package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.cjs.js +1 -1
  609. package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.es.js +24 -25
  610. package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.cjs.js +1 -1
  611. package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.es.js +26 -23
  612. package/dist/rich-text.cjs.js +1 -1
  613. package/dist/ui.css +1 -1
  614. package/dist/utils/cn.cjs.js +1 -1
  615. package/dist/utils/datetime-helpers.cjs.js +1 -1
  616. package/dist/utils/theme-loader.cjs.js +1 -1
  617. package/dist/utils/tweak.cjs.js +1 -1
  618. package/package.json +28 -27
  619. package/src/components/DataTable/DataTable.tsx +2 -0
  620. package/src/components/DataTable/DataTablePagination.tsx +28 -8
  621. package/src/components/DataTable/hooks/useDataTable.ts +13 -0
  622. package/src/components/editor/blocks/waka-diagram-block.tsx +7 -36
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../button/index.cjs.js`),r=require(`../input/index.cjs.js`);let i=require(`react`);i=e.__toESM(i);let a=require(`lucide-react`),o=require(`react/jsx-runtime`);function s(e,t,n){let r=e;return t!==void 0&&r<t&&(r=t),n!==void 0&&r>n&&(r=n),r}function c(e,t){let n=10**t;return Math.round(e*n)/n}function l({value:e,onChange:l,min:u,max:d,step:f=1,precision:p=0,placeholder:m=`0`,disabled:h=!1,error:g=!1,size:_=`md`,buttonPosition:v=`sides`,allowEmpty:y=!1,formatValue:b,parseValue:x,className:S,id:C,name:w}){let[T,E]=i.useState(e===void 0?``:b?b(e):String(e)),[D,O]=i.useState(!1);i.useEffect(()=>{D||E(e===void 0?``:b?b(e):String(e))},[e,b,D]);let k=e=>{let t=e.target.value;if(E(t),t===``&&y){l?.(void 0);return}let n;if(x)n=x(t);else{let e=t.replace(`,`,`.`);n=parseFloat(e)}if(n!==void 0&&!isNaN(n)){let e=s(c(n,p),u,d);l?.(e)}},A=()=>{if(O(!1),e!==void 0)E(b?b(e):String(e));else if(!y){let e=u===void 0?0:u;l?.(e),E(b?b(e):String(e))}},j=()=>{O(!0)},M=()=>{let t=s(c((e??(u===void 0?0:u))+f,p),u,d);l?.(t)},N=()=>{let t=s(c((e??(u===void 0?0:u))-f,p),u,d);l?.(t)},P=e=>{e.key===`ArrowUp`?(e.preventDefault(),M()):e.key===`ArrowDown`&&(e.preventDefault(),N())},F={sm:`h-8 text-xs`,md:`h-9 text-sm`,lg:`h-10 text-base`},I={sm:`h-8 w-8`,md:`h-9 w-9`,lg:`h-10 w-10`},L={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},R=d===void 0||(e??0)<d,z=u===void 0||(e??0)>u,B=(e,r)=>{let i=e===`increment`,s=i?a.Plus:a.Minus,c=i?M:N,l=i?R:z;return(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(I[_],`flex-shrink-0`,r===`left`&&`rounded-r-none border-r-0`,r===`right`&&`rounded-l-none border-l-0`),onClick:c,disabled:h||!l,tabIndex:-1,"aria-label":i?`Augmenter`:`Diminuer`,children:(0,o.jsx)(s,{className:L[_]})})};return v===`none`?(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`text-center`,g&&`border-destructive focus-visible:ring-destructive`,S)}):v===`right`?(0,o.jsxs)(`div`,{className:t.cn(`flex`,S),children:[(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`rounded-r-none`,g&&`border-destructive focus-visible:ring-destructive`)}),(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(`h-[50%] w-6 rounded-none rounded-tr-md border-l-0 border-b-0`,_===`sm`&&`h-4`,_===`lg`&&`h-5`),onClick:M,disabled:h||!R,tabIndex:-1,"aria-label":`Augmenter`,children:(0,o.jsx)(a.Plus,{className:`h-2.5 w-2.5`})}),(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(`h-[50%] w-6 rounded-none rounded-br-md border-l-0`,_===`sm`&&`h-4`,_===`lg`&&`h-5`),onClick:N,disabled:h||!z,tabIndex:-1,"aria-label":`Diminuer`,children:(0,o.jsx)(a.Minus,{className:`h-2.5 w-2.5`})})]})]}):(0,o.jsxs)(`div`,{className:t.cn(`flex`,S),children:[B(`decrement`,`left`),(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`rounded-none text-center`,g&&`border-destructive focus-visible:ring-destructive`)}),B(`increment`,`right`)]})}function u(e={}){let{initialValue:t,min:n,max:r,step:a=1}=e,[o,c]=i.useState(t);return{value:o,onChange:c,increment:()=>{c(e=>s((e??(n===void 0?0:n))+a,n,r))},decrement:()=>{c(e=>s((e??(n===void 0?0:n))-a,n,r))},reset:()=>c(t),clear:()=>c(void 0),min:n,max:r,step:a}}exports.default=l,exports.useNumberInput=u;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../button/index.cjs.js"),r=require("../input/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");function s(e,t,n){let r=e;return t!==void 0&&r<t&&(r=t),n!==void 0&&r>n&&(r=n),r}function c(e,t){let n=10**t;return Math.round(e*n)/n}function l({value:e,onChange:l,min:u,max:d,step:f=1,precision:p=0,placeholder:m=`0`,disabled:h=!1,error:g=!1,size:_=`md`,buttonPosition:v=`sides`,allowEmpty:y=!1,formatValue:b,parseValue:x,className:S,id:C,name:w}){let[T,E]=i.useState(e===void 0?``:b?b(e):String(e)),[D,O]=i.useState(!1);i.useEffect(()=>{D||E(e===void 0?``:b?b(e):String(e))},[e,b,D]);let k=e=>{let t=e.target.value;if(E(t),t===``&&y){l?.(void 0);return}let n;if(x)n=x(t);else{let e=t.replace(`,`,`.`);n=parseFloat(e)}if(n!==void 0&&!isNaN(n)){let e=s(c(n,p),u,d);l?.(e)}},A=()=>{if(O(!1),e!==void 0)E(b?b(e):String(e));else if(!y){let e=u===void 0?0:u;l?.(e),E(b?b(e):String(e))}},j=()=>{O(!0)},M=()=>{let t=s(c((e??(u===void 0?0:u))+f,p),u,d);l?.(t)},N=()=>{let t=s(c((e??(u===void 0?0:u))-f,p),u,d);l?.(t)},P=e=>{e.key===`ArrowUp`?(e.preventDefault(),M()):e.key===`ArrowDown`&&(e.preventDefault(),N())},F={sm:`h-8 text-xs`,md:`h-9 text-sm`,lg:`h-10 text-base`},I={sm:`h-8 w-8`,md:`h-9 w-9`,lg:`h-10 w-10`},L={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},R=d===void 0||(e??0)<d,z=u===void 0||(e??0)>u,B=(e,r)=>{let i=e===`increment`,s=i?a.Plus:a.Minus,c=i?M:N,l=i?R:z;return(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(I[_],`flex-shrink-0`,r===`left`&&`rounded-r-none border-r-0`,r===`right`&&`rounded-l-none border-l-0`),onClick:c,disabled:h||!l,tabIndex:-1,"aria-label":i?`Augmenter`:`Diminuer`,children:(0,o.jsx)(s,{className:L[_]})})};return v===`none`?(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`text-center`,g&&`border-destructive focus-visible:ring-destructive`,S)}):v===`right`?(0,o.jsxs)(`div`,{className:t.cn(`flex`,S),children:[(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`rounded-r-none`,g&&`border-destructive focus-visible:ring-destructive`)}),(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(`h-[50%] w-6 rounded-none rounded-tr-md border-l-0 border-b-0`,_===`sm`&&`h-4`,_===`lg`&&`h-5`),onClick:M,disabled:h||!R,tabIndex:-1,"aria-label":`Augmenter`,children:(0,o.jsx)(a.Plus,{className:`h-2.5 w-2.5`})}),(0,o.jsx)(n.Button,{type:`button`,variant:`outline`,size:`icon`,className:t.cn(`h-[50%] w-6 rounded-none rounded-br-md border-l-0`,_===`sm`&&`h-4`,_===`lg`&&`h-5`),onClick:N,disabled:h||!z,tabIndex:-1,"aria-label":`Diminuer`,children:(0,o.jsx)(a.Minus,{className:`h-2.5 w-2.5`})})]})]}):(0,o.jsxs)(`div`,{className:t.cn(`flex`,S),children:[B(`decrement`,`left`),(0,o.jsx)(r.Input,{id:C,name:w,type:`text`,inputMode:`decimal`,value:T,onChange:k,onBlur:A,onFocus:j,onKeyDown:P,placeholder:m,disabled:h,className:t.cn(F[_],`rounded-none text-center`,g&&`border-destructive focus-visible:ring-destructive`)}),B(`increment`,`right`)]})}function u(e={}){let{initialValue:t,min:n,max:r,step:a=1}=e,[o,c]=i.useState(t);return{value:o,onChange:c,increment:()=>{c(e=>s((e??(n===void 0?0:n))+a,n,r))},decrement:()=>{c(e=>s((e??(n===void 0?0:n))-a,n,r))},reset:()=>c(t),clear:()=>c(void 0),min:n,max:r,step:a}}exports.WakaNumberInput=l,exports.default=l,exports.useNumberInput=u;
@@ -175,4 +175,4 @@ function d(e = {}) {
175
175
  };
176
176
  }
177
177
  //#endregion
178
- export { u as default, d as useNumberInput };
178
+ export { u as WakaNumberInput, u as default, d as useNumberInput };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);function i(e=!1){let[t,r]=n.useState(e);return{isOpen:t,toggle:n.useCallback(()=>{r(e=>!e)},[]),open:n.useCallback(()=>{r(!0)},[]),close:n.useCallback(()=>{r(!1)},[]),setIsOpen:r}}function a({items:e,isOpen:i,onOpenChange:a,radius:o=120,itemSize:s=`default`,centerSize:c=`default`,centerContent:l,animationDuration:u=300,startAngle:d=-90,angleSpan:f=360,showLabels:p=!0,labelPosition:m=`outside`,className:h,itemClassName:g,centerClassName:_}){let[v,y]=n.useState(!1),[b,x]=n.useState(null),[S,C]=n.useState(0),w=i!==void 0,T=w?i:v,E=n.useCallback(()=>{w?a?.(!T):y(e=>!e)},[w,T,a]),D={sm:40,default:56,lg:72},O={sm:48,default:64,lg:80},k=D[s],A=O[c],j=(e,t)=>{let n=d+e*(f/(f===360?t:t-1||1))+S,r=n*Math.PI/180;return{x:Math.cos(r)*o,y:Math.sin(r)*o,angle:n}},M=(e,t,n)=>{let r=m===`outside`?k/2+8:0,i=(n%360+360)%360;return m===`inside`?{transform:`translate(-50%, -50%)`,textAlign:`center`}:i>=315||i<45?{transform:`translate(-50%, calc(-100% - ${r}px))`,textAlign:`center`}:i>=45&&i<135?{transform:`translate(${r}px, -50%)`,textAlign:`left`}:i>=135&&i<225?{transform:`translate(-50%, ${r}px)`,textAlign:`center`}:{transform:`translate(calc(-100% - ${r}px), -50%)`,textAlign:`right`}},N=(o+k)*2+40;return(0,r.jsxs)(`div`,{className:t.cn(`relative inline-flex items-center justify-center`,h),style:{width:N,height:N},children:[e.map((n,i)=>{let{x:a,y:o,angle:s}=j(i,e.length),c=b===n.id,l=M(a,o,s);return(0,r.jsxs)(`div`,{className:`absolute`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) translate(${a}px, ${o}px)`,opacity:+!!T,scale:+!!T,transition:`all ${u}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,transitionDelay:T?`${i*50}ms`:`${(e.length-i-1)*30}ms`,pointerEvents:T?`auto`:`none`},onMouseEnter:()=>x(n.id),onMouseLeave:()=>x(null),children:[(0,r.jsx)(`button`,{type:`button`,onClick:()=>{n.disabled||n.onClick?.()},disabled:n.disabled,className:t.cn(`relative flex items-center justify-center rounded-full transition-all duration-200`,`bg-background border-2 border-border shadow-lg`,`hover:scale-110 hover:shadow-xl hover:border-primary`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,`active:scale-95`,n.disabled&&`opacity-50 cursor-not-allowed hover:scale-100`,g),style:{width:k,height:k,backgroundColor:n.color,borderColor:c?void 0:n.color},children:(0,r.jsx)(`span`,{className:t.cn(`transition-transform duration-200`,c&&`scale-110`),children:n.icon})}),p&&c&&(0,r.jsx)(`div`,{className:t.cn(`absolute left-1/2 top-1/2 z-10 whitespace-nowrap`,`rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-150`),style:{transform:l.transform,textAlign:l.textAlign},children:n.label})]},n.id)}),(0,r.jsxs)(`button`,{type:`button`,onClick:E,className:t.cn(`relative z-10 flex items-center justify-center rounded-full`,`bg-primary text-primary-foreground shadow-xl`,`transition-all duration-300 ease-out`,`hover:shadow-2xl hover:scale-105`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,`active:scale-95`,_),style:{width:A,height:A},"aria-expanded":T,"aria-label":T?`Close menu`:`Open menu`,children:[(0,r.jsx)(`span`,{className:`transition-transform duration-300`,style:{transform:`rotate(${T?45:0}deg)`},children:l||(0,r.jsxs)(`svg`,{width:A*.4,height:A*.4,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,r.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}),T&&(0,r.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-primary animate-ping opacity-20`,style:{animationDuration:`1s`,animationIterationCount:`1`}})]}),(0,r.jsx)(`div`,{className:t.cn(`absolute pointer-events-none rounded-full border-2 border-dashed border-muted-foreground/20`,`transition-all duration-300`),style:{width:o*2,height:o*2,opacity:+!!T,scale:T?1:.8}}),T&&e.length>3&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`button`,{type:`button`,onClick:()=>C(t=>t-f/e.length),className:t.cn(`absolute z-20 flex items-center justify-center`,`w-8 h-8 rounded-full bg-muted text-muted-foreground`,`hover:bg-accent hover:text-accent-foreground`,`transition-all duration-200`,`focus:outline-none focus:ring-2 focus:ring-primary`),style:{left:8,top:`50%`,transform:`translateY(-50%)`},"aria-label":`Rotate left`,children:(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:(0,r.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>C(t=>t+f/e.length),className:t.cn(`absolute z-20 flex items-center justify-center`,`w-8 h-8 rounded-full bg-muted text-muted-foreground`,`hover:bg-accent hover:text-accent-foreground`,`transition-all duration-200`,`focus:outline-none focus:ring-2 focus:ring-primary`),style:{right:8,top:`50%`,transform:`translateY(-50%)`},"aria-label":`Rotate right`,children:(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:(0,r.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]})]})}function o({direction:e=`top`,...t}){let n={top:{startAngle:-180,angleSpan:180},bottom:{startAngle:0,angleSpan:180},left:{startAngle:-270,angleSpan:180},right:{startAngle:-90,angleSpan:180}};return(0,r.jsx)(a,{...t,startAngle:n[e].startAngle,angleSpan:n[e].angleSpan})}exports.WakaOrbitalMenuCompact=o,exports.default=a,exports.useOrbitalMenu=i;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("react/jsx-runtime");function i(e=!1){let[t,r]=n.useState(e);return{isOpen:t,toggle:n.useCallback(()=>{r(e=>!e)},[]),open:n.useCallback(()=>{r(!0)},[]),close:n.useCallback(()=>{r(!1)},[]),setIsOpen:r}}function a({items:e,isOpen:i,onOpenChange:a,radius:o=120,itemSize:s=`default`,centerSize:c=`default`,centerContent:l,animationDuration:u=300,startAngle:d=-90,angleSpan:f=360,showLabels:p=!0,labelPosition:m=`outside`,className:h,itemClassName:g,centerClassName:_}){let[v,y]=n.useState(!1),[b,x]=n.useState(null),[S,C]=n.useState(0),w=i!==void 0,T=w?i:v,E=n.useCallback(()=>{w?a?.(!T):y(e=>!e)},[w,T,a]),D={sm:40,default:56,lg:72},O={sm:48,default:64,lg:80},k=D[s],A=O[c],j=(e,t)=>{let n=d+e*(f/(f===360?t:t-1||1))+S,r=n*Math.PI/180;return{x:Math.cos(r)*o,y:Math.sin(r)*o,angle:n}},M=(e,t,n)=>{let r=m===`outside`?k/2+8:0,i=(n%360+360)%360;return m===`inside`?{transform:`translate(-50%, -50%)`,textAlign:`center`}:i>=315||i<45?{transform:`translate(-50%, calc(-100% - ${r}px))`,textAlign:`center`}:i>=45&&i<135?{transform:`translate(${r}px, -50%)`,textAlign:`left`}:i>=135&&i<225?{transform:`translate(-50%, ${r}px)`,textAlign:`center`}:{transform:`translate(calc(-100% - ${r}px), -50%)`,textAlign:`right`}},N=(o+k)*2+40;return(0,r.jsxs)(`div`,{className:t.cn(`relative inline-flex items-center justify-center`,h),style:{width:N,height:N},children:[e.map((n,i)=>{let{x:a,y:o,angle:s}=j(i,e.length),c=b===n.id,l=M(a,o,s);return(0,r.jsxs)(`div`,{className:`absolute`,style:{left:`50%`,top:`50%`,transform:`translate(-50%, -50%) translate(${a}px, ${o}px)`,opacity:+!!T,scale:+!!T,transition:`all ${u}ms cubic-bezier(0.68, -0.55, 0.265, 1.55)`,transitionDelay:T?`${i*50}ms`:`${(e.length-i-1)*30}ms`,pointerEvents:T?`auto`:`none`},onMouseEnter:()=>x(n.id),onMouseLeave:()=>x(null),children:[(0,r.jsx)(`button`,{type:`button`,onClick:()=>{n.disabled||n.onClick?.()},disabled:n.disabled,className:t.cn(`relative flex items-center justify-center rounded-full transition-all duration-200`,`bg-background border-2 border-border shadow-lg`,`hover:scale-110 hover:shadow-xl hover:border-primary`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,`active:scale-95`,n.disabled&&`opacity-50 cursor-not-allowed hover:scale-100`,g),style:{width:k,height:k,backgroundColor:n.color,borderColor:c?void 0:n.color},children:(0,r.jsx)(`span`,{className:t.cn(`transition-transform duration-200`,c&&`scale-110`),children:n.icon})}),p&&c&&(0,r.jsx)(`div`,{className:t.cn(`absolute left-1/2 top-1/2 z-10 whitespace-nowrap`,`rounded-md bg-foreground px-2 py-1 text-xs font-medium text-background shadow-lg`,`animate-in fade-in-0 zoom-in-95 duration-150`),style:{transform:l.transform,textAlign:l.textAlign},children:n.label})]},n.id)}),(0,r.jsxs)(`button`,{type:`button`,onClick:E,className:t.cn(`relative z-10 flex items-center justify-center rounded-full`,`bg-primary text-primary-foreground shadow-xl`,`transition-all duration-300 ease-out`,`hover:shadow-2xl hover:scale-105`,`focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2`,`active:scale-95`,_),style:{width:A,height:A},"aria-expanded":T,"aria-label":T?`Close menu`:`Open menu`,children:[(0,r.jsx)(`span`,{className:`transition-transform duration-300`,style:{transform:`rotate(${T?45:0}deg)`},children:l||(0,r.jsxs)(`svg`,{width:A*.4,height:A*.4,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,r.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]})}),T&&(0,r.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-primary animate-ping opacity-20`,style:{animationDuration:`1s`,animationIterationCount:`1`}})]}),(0,r.jsx)(`div`,{className:t.cn(`absolute pointer-events-none rounded-full border-2 border-dashed border-muted-foreground/20`,`transition-all duration-300`),style:{width:o*2,height:o*2,opacity:+!!T,scale:T?1:.8}}),T&&e.length>3&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`button`,{type:`button`,onClick:()=>C(t=>t-f/e.length),className:t.cn(`absolute z-20 flex items-center justify-center`,`w-8 h-8 rounded-full bg-muted text-muted-foreground`,`hover:bg-accent hover:text-accent-foreground`,`transition-all duration-200`,`focus:outline-none focus:ring-2 focus:ring-primary`),style:{left:8,top:`50%`,transform:`translateY(-50%)`},"aria-label":`Rotate left`,children:(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:(0,r.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,r.jsx)(`button`,{type:`button`,onClick:()=>C(t=>t+f/e.length),className:t.cn(`absolute z-20 flex items-center justify-center`,`w-8 h-8 rounded-full bg-muted text-muted-foreground`,`hover:bg-accent hover:text-accent-foreground`,`transition-all duration-200`,`focus:outline-none focus:ring-2 focus:ring-primary`),style:{right:8,top:`50%`,transform:`translateY(-50%)`},"aria-label":`Rotate right`,children:(0,r.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,focusable:`false`,children:(0,r.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]})]})}function o({direction:e=`top`,...t}){let n={top:{startAngle:-180,angleSpan:180},bottom:{startAngle:0,angleSpan:180},left:{startAngle:-270,angleSpan:180},right:{startAngle:-90,angleSpan:180}};return(0,r.jsx)(a,{...t,startAngle:n[e].startAngle,angleSpan:n[e].angleSpan})}exports.WakaOrbitalMenu=a,exports.default=a,exports.WakaOrbitalMenuCompact=o,exports.useOrbitalMenu=i;
@@ -240,4 +240,4 @@ function s({ direction: e = "top", ...t }) {
240
240
  });
241
241
  }
242
242
  //#endregion
243
- export { s as WakaOrbitalMenuCompact, o as default, a as useOrbitalMenu };
243
+ export { o as WakaOrbitalMenu, o as default, s as WakaOrbitalMenuCompact, a as useOrbitalMenu };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={ordered:{icon:r.Box,label:`Ordered`,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,description:`Order placed successfully`},processing:{icon:r.Package,label:`Processing`,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-100 dark:bg-amber-900/30`,description:`Order is being prepared`},shipped:{icon:r.PackageCheck,label:`Shipped`,color:`text-purple-600 dark:text-purple-400`,bgColor:`bg-purple-100 dark:bg-purple-900/30`,description:`Package has been shipped`},out_for_delivery:{icon:r.Truck,label:`Out for Delivery`,color:`text-orange-600 dark:text-orange-400`,bgColor:`bg-orange-100 dark:bg-orange-900/30`,description:`Package is out for delivery`},delivered:{icon:r.CheckCircle,label:`Delivered`,color:`text-green-600 dark:text-green-400`,bgColor:`bg-green-100 dark:bg-green-900/30`,description:`Package has been delivered`}},o=[`ordered`,`processing`,`shipped`,`out_for_delivery`,`delivered`];function s(e={}){let{initialOrder:t,autoRefreshInterval:r,fetchOrderUpdates:i}=e,[a,s]=n.useState(t||null),[c,l]=n.useState(!1),[u,d]=n.useState(null),f=n.useCallback(async()=>{if(!(!a||!i)){l(!0),d(null);try{s(await i(a.orderId))}catch(e){d(e instanceof Error?e.message:`Failed to refresh order`)}finally{l(!1)}}},[a,i]);n.useEffect(()=>{if(!r||!i||!a)return;let e=setInterval(f,r);return()=>clearInterval(e)},[r,i,a,f]);let p=n.useMemo(()=>a?Math.max(0,o.indexOf(a.status)):0,[a]),m=a?.status===`delivered`;return{order:a,setOrder:s,isLoading:c,error:u,refresh:f,currentStepIndex:p,isDelivered:m,progressPercentage:n.useMemo(()=>Math.max(0,Math.min(100,p/(o.length-1)*100)),[p]),timeUntilDelivery:n.useMemo(()=>{if(!a?.estimatedDelivery||m)return null;let e=new Date,t=new Date(a.estimatedDelivery).getTime()-e.getTime();if(t<=0)return`Arriving today`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`${n} day${n===1?``:`s`}`:`${r} hour${r===1?``:`s`}`},[a?.estimatedDelivery,m])}}function c(e){return new Date(e).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}function l(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function u({status:e,isActive:n,isCompleted:r,size:o}){let s=a[e],c=s.icon;return(0,i.jsx)(`div`,{className:t.cn(`rounded-full flex items-center justify-center flex-shrink-0 border-2 transition-all duration-300`,{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[o],r||n?t.cn(s.bgColor,`border-transparent`):`bg-muted border-muted-foreground/20`,n&&`ring-4 ring-offset-2 ring-offset-background animate-pulse`,n&&e===`delivered`?`ring-green-500/30`:n?`ring-primary/30`:``),children:(0,i.jsx)(c,{className:t.cn({sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`}[o],`transition-colors duration-300`,r||n?s.color:`text-muted-foreground`)})})}function d({isCompleted:e,orientation:n,size:r}){let a={sm:n===`horizontal`?`h-0.5`:`w-0.5`,md:n===`horizontal`?`h-1`:`w-1`,lg:n===`horizontal`?`h-1`:`w-1`};return(0,i.jsx)(`div`,{className:t.cn(`transition-all duration-500`,n===`horizontal`?t.cn(`flex-1 mx-1`,a[r]):t.cn(`min-h-[32px] mx-auto my-1`,a[r]),e?`bg-green-500`:`bg-muted`)})}function f({status:e,index:n,currentIndex:o,isLast:s,timestamp:f,orientation:p,size:m}){let h=a[e],g=n<o,_=n===o,v={sm:`text-xs`,md:`text-sm`,lg:`text-base`},y={sm:`text-[10px]`,md:`text-xs`,lg:`text-sm`};return p===`horizontal`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center flex-1 min-w-[80px]`,children:[(0,i.jsx)(u,{status:e,isActive:_,isCompleted:g,size:m}),(0,i.jsxs)(`div`,{className:`mt-2 text-center`,children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium transition-colors duration-300`,v[m],g||_?`text-foreground`:`text-muted-foreground`),children:h.label}),f&&(g||_)&&(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground mt-0.5`,y[m]),children:c(f)})]})]}),!s&&(0,i.jsx)(d,{isCompleted:g,orientation:`horizontal`,size:m})]}):(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,i.jsx)(u,{status:e,isActive:_,isCompleted:g,size:m}),!s&&(0,i.jsx)(d,{isCompleted:g,orientation:`vertical`,size:m})]}),(0,i.jsxs)(`div`,{className:t.cn(`flex-1 pb-6`,!s&&`min-h-[80px]`),children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium transition-colors duration-300`,v[m],g||_?`text-foreground`:`text-muted-foreground`),children:h.label}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground mt-0.5`,y[m]),children:h.description}),f&&(g||_)&&(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground mt-1`,y[m]),children:[(0,i.jsx)(r.Clock,{className:`inline-block h-3 w-3 mr-1`}),l(f)]})]})]})}function p({trackingNumber:e,carrier:a,onCopy:o,onTrackWithCarrier:s,size:c}){let[l,u]=n.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),u(!0),o?.(e),setTimeout(()=>u(!1),2e3)}catch{let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),u(!0),o?.(e),setTimeout(()=>u(!1),2e3)}},f={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:`Tracking:`}),(0,i.jsx)(`code`,{className:t.cn(`px-2 py-1 bg-muted rounded font-mono`,f[c]),children:e}),(0,i.jsx)(`button`,{onClick:d,className:t.cn(`p-1.5 rounded hover:bg-muted transition-colors`,`text-muted-foreground hover:text-foreground`),title:l?`Copied!`:`Copy tracking number`,children:l?(0,i.jsx)(r.CheckCircle,{className:`h-4 w-4 text-green-500`}):(0,i.jsx)(r.Copy,{className:`h-4 w-4`})})]}),a&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:`Carrier:`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.logoUrl?(0,i.jsx)(`img`,{src:a.logoUrl,alt:a.name,className:`h-5 w-auto`}):(0,i.jsx)(`span`,{className:t.cn(`font-medium`,f[c]),children:a.name}),a.serviceType&&(0,i.jsxs)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:[`(`,a.serviceType,`)`]})]}),a.trackingUrl&&(0,i.jsxs)(`button`,{onClick:()=>s?.(a.trackingUrl),className:t.cn(`inline-flex items-center gap-1 px-2 py-1 rounded`,`text-primary hover:bg-primary/10 transition-colors`,f[c]),children:[(0,i.jsx)(r.ExternalLink,{className:`h-3 w-3`}),`Track on `,a.name]})]})]})}function m({address:e,size:n}){let a={sm:`text-xs`,md:`text-sm`,lg:`text-base`},o=e.type===`business`?r.Building:r.Home;return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-3 p-3 bg-muted/50 rounded-lg`,a[n]),children:[(0,i.jsx)(`div`,{className:`flex-shrink-0`,children:(0,i.jsx)(`div`,{className:`p-2 bg-background rounded-full`,children:(0,i.jsx)(o,{className:`h-4 w-4 text-muted-foreground`})})}),(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.street1}),e.street2&&(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.street2}),(0,i.jsxs)(`p`,{className:`text-muted-foreground`,children:[e.city,`, `,e.state,` `,e.postalCode]}),(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.country}),e.phone&&(0,i.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.phone})]})]})}function h({updates:e,size:o}){let[s,c]=n.useState(!1),u=[...e].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),d=s?u:u.slice(0,3),f={sm:`text-xs`,md:`text-sm`,lg:`text-base`},p={sm:`text-[10px]`,md:`text-xs`,lg:`text-sm`};return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`h4`,{className:t.cn(`font-medium`,f[o]),children:`Status Updates`}),(0,i.jsx)(`div`,{className:`space-y-1`,children:d.map((e,n)=>{let s=a[e.status];return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-3 p-2 rounded-lg transition-colors`,n===0?`bg-muted/50`:`hover:bg-muted/30`),children:[(0,i.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:(0,i.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,s.bgColor.replace(`/30`,``))})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium`,p[o]),children:e.message}),(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 text-muted-foreground mt-0.5`,p[o]),children:[(0,i.jsx)(`span`,{children:l(e.timestamp)}),e.location&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{children:`-`}),(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.MapPin,{className:`h-3 w-3`}),e.location]})]})]})]})]},e.id)})}),u.length>3&&(0,i.jsx)(`button`,{onClick:()=>c(!s),className:t.cn(`flex items-center gap-1 text-primary hover:text-primary/80 transition-colors`,p[o]),children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.ChevronUp,{className:`h-3 w-3`}),`Show less`]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`}),`Show `,u.length-3,` more update`,u.length-3==1?``:`s`]})})]})}function g({mapUrl:e,address:n,size:a}){let o={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:`relative rounded-lg overflow-hidden border bg-muted`,children:[e?(0,i.jsx)(`img`,{src:e,alt:`Delivery location map`,className:`w-full h-32 object-cover`}):(0,i.jsxs)(`div`,{className:`w-full h-32 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,i.jsx)(r.Map,{className:`h-8 w-8`}),(0,i.jsx)(`span`,{className:o[a],children:`Map preview unavailable`})]}),(0,i.jsx)(`div`,{className:t.cn(`absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-background/90 to-transparent`,o[a]),children:(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-foreground`,children:[(0,i.jsx)(r.Navigation,{className:`h-3 w-3`}),(0,i.jsxs)(`span`,{className:`truncate`,children:[n.city,`, `,n.state]})]})})]})}function _({estimatedDelivery:e,deliveredAt:n,isDelivered:a,size:o}){let s={sm:`text-xs`,md:`text-sm`,lg:`text-base`},u={sm:`text-sm`,md:`text-base`,lg:`text-lg`};return a&&n?(0,i.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-green-100 dark:bg-green-900/30 rounded-lg`,children:[(0,i.jsx)(r.CheckCircle,{className:`h-5 w-5 text-green-600 dark:text-green-400 flex-shrink-0`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{className:t.cn(`text-green-600 dark:text-green-400`,s[o]),children:`Delivered`}),(0,i.jsx)(`p`,{className:t.cn(`font-semibold text-green-700 dark:text-green-300`,u[o]),children:l(n)})]})]}):e?(0,i.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-muted/50 rounded-lg`,children:[(0,i.jsx)(r.Calendar,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,s[o]),children:`Estimated Delivery`}),(0,i.jsx)(`p`,{className:t.cn(`font-semibold`,u[o]),children:c(e)})]})]}):null}function v({order:e,orientation:a=`horizontal`,showMapPreview:s=!0,showHistory:l=!0,showAddress:u=!0,onCopyTracking:d,onTrackWithCarrier:v,onRefresh:y,isRefreshing:b=!1,size:x=`md`,className:S}){let C=o.indexOf(e.status),w=e.status===`delivered`,T=n.useMemo(()=>{let t={ordered:e.orderDate,processing:void 0,shipped:void 0,out_for_delivery:void 0,delivered:e.deliveredAt};return e.updates.forEach(e=>{t[e.status]||(t[e.status]=e.timestamp)}),t},[e]),E={sm:`text-sm`,md:`text-base`,lg:`text-lg`},D={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:t.cn(`w-full`,S),children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-6`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`h3`,{className:t.cn(`font-semibold`,E[x]),children:[`Order #`,e.orderId]}),(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground`,D[x]),children:[`Placed on `,c(e.orderDate)]})]}),y&&(0,i.jsx)(`button`,{onClick:y,disabled:b,className:t.cn(`p-2 rounded-lg hover:bg-muted transition-colors`,`text-muted-foreground hover:text-foreground`,b&&`animate-spin`),title:`Refresh order status`,children:(0,i.jsx)(r.RefreshCw,{className:`h-4 w-4`})})]}),(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(_,{estimatedDelivery:e.estimatedDelivery,deliveredAt:e.deliveredAt,isDelivered:w,size:x})}),(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(`nav`,{"aria-label":`Order progress`,className:t.cn(a===`horizontal`?`flex items-start`:`flex flex-col`),children:o.map((e,t)=>(0,i.jsx)(f,{status:e,index:t,currentIndex:C,isLast:t===o.length-1,timestamp:T[e],orientation:a,size:x},e))})}),e.trackingNumber&&(0,i.jsx)(`div`,{className:`mb-6 p-4 border rounded-lg`,children:(0,i.jsx)(p,{trackingNumber:e.trackingNumber,carrier:e.carrier,onCopy:d,onTrackWithCarrier:v,size:x})}),s&&(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(g,{mapUrl:e.mapPreviewUrl,address:e.deliveryAddress,size:x})}),u&&(0,i.jsxs)(`div`,{className:`mb-6`,children:[(0,i.jsx)(`h4`,{className:t.cn(`font-medium mb-2`,D[x]),children:`Delivery Address`}),(0,i.jsx)(m,{address:e.deliveryAddress,size:x})]}),l&&e.updates.length>0&&(0,i.jsx)(`div`,{children:(0,i.jsx)(h,{updates:e.updates,size:x})})]})}exports.default=v,exports.useOrderTracker=s;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={ordered:{icon:r.Box,label:`Ordered`,color:`text-blue-600 dark:text-blue-400`,bgColor:`bg-blue-100 dark:bg-blue-900/30`,description:`Order placed successfully`},processing:{icon:r.Package,label:`Processing`,color:`text-amber-600 dark:text-amber-400`,bgColor:`bg-amber-100 dark:bg-amber-900/30`,description:`Order is being prepared`},shipped:{icon:r.PackageCheck,label:`Shipped`,color:`text-purple-600 dark:text-purple-400`,bgColor:`bg-purple-100 dark:bg-purple-900/30`,description:`Package has been shipped`},out_for_delivery:{icon:r.Truck,label:`Out for Delivery`,color:`text-orange-600 dark:text-orange-400`,bgColor:`bg-orange-100 dark:bg-orange-900/30`,description:`Package is out for delivery`},delivered:{icon:r.CheckCircle,label:`Delivered`,color:`text-green-600 dark:text-green-400`,bgColor:`bg-green-100 dark:bg-green-900/30`,description:`Package has been delivered`}},o=[`ordered`,`processing`,`shipped`,`out_for_delivery`,`delivered`];function s(e={}){let{initialOrder:t,autoRefreshInterval:r,fetchOrderUpdates:i}=e,[a,s]=n.useState(t||null),[c,l]=n.useState(!1),[u,d]=n.useState(null),f=n.useCallback(async()=>{if(!(!a||!i)){l(!0),d(null);try{let e=await i(a.orderId);s(e)}catch(e){d(e instanceof Error?e.message:`Failed to refresh order`)}finally{l(!1)}}},[a,i]);n.useEffect(()=>{if(!r||!i||!a)return;let e=setInterval(f,r);return()=>clearInterval(e)},[r,i,a,f]);let p=n.useMemo(()=>a?Math.max(0,o.indexOf(a.status)):0,[a]),m=a?.status===`delivered`;return{order:a,setOrder:s,isLoading:c,error:u,refresh:f,currentStepIndex:p,isDelivered:m,progressPercentage:n.useMemo(()=>Math.max(0,Math.min(100,p/(o.length-1)*100)),[p]),timeUntilDelivery:n.useMemo(()=>{if(!a?.estimatedDelivery||m)return null;let e=new Date,t=new Date(a.estimatedDelivery).getTime()-e.getTime();if(t<=0)return`Arriving today`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`${n} day${n===1?``:`s`}`:`${r} hour${r===1?``:`s`}`},[a?.estimatedDelivery,m])}}function c(e){return new Date(e).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})}function l(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function u({status:e,isActive:n,isCompleted:r,size:o}){let s=a[e],c=s.icon;return(0,i.jsx)(`div`,{className:t.cn(`rounded-full flex items-center justify-center flex-shrink-0 border-2 transition-all duration-300`,{sm:`h-8 w-8`,md:`h-10 w-10`,lg:`h-12 w-12`}[o],r||n?t.cn(s.bgColor,`border-transparent`):`bg-muted border-muted-foreground/20`,n&&`ring-4 ring-offset-2 ring-offset-background animate-pulse`,n&&e===`delivered`?`ring-green-500/30`:n?`ring-primary/30`:``),children:(0,i.jsx)(c,{className:t.cn({sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`}[o],`transition-colors duration-300`,r||n?s.color:`text-muted-foreground`)})})}function d({isCompleted:e,orientation:n,size:r}){let a={sm:n===`horizontal`?`h-0.5`:`w-0.5`,md:n===`horizontal`?`h-1`:`w-1`,lg:n===`horizontal`?`h-1`:`w-1`};return(0,i.jsx)(`div`,{className:t.cn(`transition-all duration-500`,n===`horizontal`?t.cn(`flex-1 mx-1`,a[r]):t.cn(`min-h-[32px] mx-auto my-1`,a[r]),e?`bg-green-500`:`bg-muted`)})}function f({status:e,index:n,currentIndex:o,isLast:s,timestamp:f,orientation:p,size:m}){let h=a[e],g=n<o,_=n===o,v={sm:`text-xs`,md:`text-sm`,lg:`text-base`},y={sm:`text-[10px]`,md:`text-xs`,lg:`text-sm`};return p===`horizontal`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center flex-1 min-w-[80px]`,children:[(0,i.jsx)(u,{status:e,isActive:_,isCompleted:g,size:m}),(0,i.jsxs)(`div`,{className:`mt-2 text-center`,children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium transition-colors duration-300`,v[m],g||_?`text-foreground`:`text-muted-foreground`),children:h.label}),f&&(g||_)&&(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground mt-0.5`,y[m]),children:c(f)})]})]}),!s&&(0,i.jsx)(d,{isCompleted:g,orientation:`horizontal`,size:m})]}):(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,i.jsx)(u,{status:e,isActive:_,isCompleted:g,size:m}),!s&&(0,i.jsx)(d,{isCompleted:g,orientation:`vertical`,size:m})]}),(0,i.jsxs)(`div`,{className:t.cn(`flex-1 pb-6`,!s&&`min-h-[80px]`),children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium transition-colors duration-300`,v[m],g||_?`text-foreground`:`text-muted-foreground`),children:h.label}),(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground mt-0.5`,y[m]),children:h.description}),f&&(g||_)&&(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground mt-1`,y[m]),children:[(0,i.jsx)(r.Clock,{className:`inline-block h-3 w-3 mr-1`}),l(f)]})]})]})}function p({trackingNumber:e,carrier:a,onCopy:o,onTrackWithCarrier:s,size:c}){let[l,u]=n.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),u(!0),o?.(e),setTimeout(()=>u(!1),2e3)}catch{let t=document.createElement(`textarea`);t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),u(!0),o?.(e),setTimeout(()=>u(!1),2e3)}},f={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:`Tracking:`}),(0,i.jsx)(`code`,{className:t.cn(`px-2 py-1 bg-muted rounded font-mono`,f[c]),children:e}),(0,i.jsx)(`button`,{onClick:d,className:t.cn(`p-1.5 rounded hover:bg-muted transition-colors`,`text-muted-foreground hover:text-foreground`),title:l?`Copied!`:`Copy tracking number`,children:l?(0,i.jsx)(r.CheckCircle,{className:`h-4 w-4 text-green-500`}):(0,i.jsx)(r.Copy,{className:`h-4 w-4`})})]}),a&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:`Carrier:`}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.logoUrl?(0,i.jsx)(`img`,{src:a.logoUrl,alt:a.name,className:`h-5 w-auto`}):(0,i.jsx)(`span`,{className:t.cn(`font-medium`,f[c]),children:a.name}),a.serviceType&&(0,i.jsxs)(`span`,{className:t.cn(`text-muted-foreground`,f[c]),children:[`(`,a.serviceType,`)`]})]}),a.trackingUrl&&(0,i.jsxs)(`button`,{onClick:()=>s?.(a.trackingUrl),className:t.cn(`inline-flex items-center gap-1 px-2 py-1 rounded`,`text-primary hover:bg-primary/10 transition-colors`,f[c]),children:[(0,i.jsx)(r.ExternalLink,{className:`h-3 w-3`}),`Track on `,a.name]})]})]})}function m({address:e,size:n}){let a={sm:`text-xs`,md:`text-sm`,lg:`text-base`},o=e.type===`business`?r.Building:r.Home;return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-3 p-3 bg-muted/50 rounded-lg`,a[n]),children:[(0,i.jsx)(`div`,{className:`flex-shrink-0`,children:(0,i.jsx)(`div`,{className:`p-2 bg-background rounded-full`,children:(0,i.jsx)(o,{className:`h-4 w-4 text-muted-foreground`})})}),(0,i.jsxs)(`div`,{className:`flex-1`,children:[(0,i.jsx)(`p`,{className:`font-medium`,children:e.name}),(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.street1}),e.street2&&(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.street2}),(0,i.jsxs)(`p`,{className:`text-muted-foreground`,children:[e.city,`, `,e.state,` `,e.postalCode]}),(0,i.jsx)(`p`,{className:`text-muted-foreground`,children:e.country}),e.phone&&(0,i.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.phone})]})]})}function h({updates:e,size:o}){let[s,c]=n.useState(!1),u=[...e].sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),d=s?u:u.slice(0,3),f={sm:`text-xs`,md:`text-sm`,lg:`text-base`},p={sm:`text-[10px]`,md:`text-xs`,lg:`text-sm`};return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`h4`,{className:t.cn(`font-medium`,f[o]),children:`Status Updates`}),(0,i.jsx)(`div`,{className:`space-y-1`,children:d.map((e,n)=>{let s=a[e.status];return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-3 p-2 rounded-lg transition-colors`,n===0?`bg-muted/50`:`hover:bg-muted/30`),children:[(0,i.jsx)(`div`,{className:`flex-shrink-0 mt-0.5`,children:(0,i.jsx)(`div`,{className:t.cn(`h-2 w-2 rounded-full`,s.bgColor.replace(`/30`,``))})}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`p`,{className:t.cn(`font-medium`,p[o]),children:e.message}),(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 text-muted-foreground mt-0.5`,p[o]),children:[(0,i.jsx)(`span`,{children:l(e.timestamp)}),e.location&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{children:`-`}),(0,i.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,i.jsx)(r.MapPin,{className:`h-3 w-3`}),e.location]})]})]})]})]},e.id)})}),u.length>3&&(0,i.jsx)(`button`,{onClick:()=>c(!s),className:t.cn(`flex items-center gap-1 text-primary hover:text-primary/80 transition-colors`,p[o]),children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.ChevronUp,{className:`h-3 w-3`}),`Show less`]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`}),`Show `,u.length-3,` more update`,u.length-3==1?``:`s`]})})]})}function g({mapUrl:e,address:n,size:a}){let o={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:`relative rounded-lg overflow-hidden border bg-muted`,children:[e?(0,i.jsx)(`img`,{src:e,alt:`Delivery location map`,className:`w-full h-32 object-cover`}):(0,i.jsxs)(`div`,{className:`w-full h-32 flex flex-col items-center justify-center gap-2 text-muted-foreground`,children:[(0,i.jsx)(r.Map,{className:`h-8 w-8`}),(0,i.jsx)(`span`,{className:o[a],children:`Map preview unavailable`})]}),(0,i.jsx)(`div`,{className:t.cn(`absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-background/90 to-transparent`,o[a]),children:(0,i.jsxs)(`div`,{className:`flex items-center gap-1 text-foreground`,children:[(0,i.jsx)(r.Navigation,{className:`h-3 w-3`}),(0,i.jsxs)(`span`,{className:`truncate`,children:[n.city,`, `,n.state]})]})})]})}function _({estimatedDelivery:e,deliveredAt:n,isDelivered:a,size:o}){let s={sm:`text-xs`,md:`text-sm`,lg:`text-base`},u={sm:`text-sm`,md:`text-base`,lg:`text-lg`};return a&&n?(0,i.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-green-100 dark:bg-green-900/30 rounded-lg`,children:[(0,i.jsx)(r.CheckCircle,{className:`h-5 w-5 text-green-600 dark:text-green-400 flex-shrink-0`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{className:t.cn(`text-green-600 dark:text-green-400`,s[o]),children:`Delivered`}),(0,i.jsx)(`p`,{className:t.cn(`font-semibold text-green-700 dark:text-green-300`,u[o]),children:l(n)})]})]}):e?(0,i.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-muted/50 rounded-lg`,children:[(0,i.jsx)(r.Calendar,{className:`h-5 w-5 text-muted-foreground flex-shrink-0`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{className:t.cn(`text-muted-foreground`,s[o]),children:`Estimated Delivery`}),(0,i.jsx)(`p`,{className:t.cn(`font-semibold`,u[o]),children:c(e)})]})]}):null}function v({order:e,orientation:a=`horizontal`,showMapPreview:s=!0,showHistory:l=!0,showAddress:u=!0,onCopyTracking:d,onTrackWithCarrier:v,onRefresh:y,isRefreshing:b=!1,size:x=`md`,className:S}){let C=o.indexOf(e.status),w=e.status===`delivered`,T=n.useMemo(()=>{let t={ordered:e.orderDate,processing:void 0,shipped:void 0,out_for_delivery:void 0,delivered:e.deliveredAt};return e.updates.forEach(e=>{t[e.status]||(t[e.status]=e.timestamp)}),t},[e]),E={sm:`text-sm`,md:`text-base`,lg:`text-lg`},D={sm:`text-xs`,md:`text-sm`,lg:`text-base`};return(0,i.jsxs)(`div`,{className:t.cn(`w-full`,S),children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-6`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`h3`,{className:t.cn(`font-semibold`,E[x]),children:[`Order #`,e.orderId]}),(0,i.jsxs)(`p`,{className:t.cn(`text-muted-foreground`,D[x]),children:[`Placed on `,c(e.orderDate)]})]}),y&&(0,i.jsx)(`button`,{onClick:y,disabled:b,className:t.cn(`p-2 rounded-lg hover:bg-muted transition-colors`,`text-muted-foreground hover:text-foreground`,b&&`animate-spin`),title:`Refresh order status`,children:(0,i.jsx)(r.RefreshCw,{className:`h-4 w-4`})})]}),(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(_,{estimatedDelivery:e.estimatedDelivery,deliveredAt:e.deliveredAt,isDelivered:w,size:x})}),(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(`nav`,{"aria-label":`Order progress`,className:t.cn(a===`horizontal`?`flex items-start`:`flex flex-col`),children:o.map((e,t)=>(0,i.jsx)(f,{status:e,index:t,currentIndex:C,isLast:t===o.length-1,timestamp:T[e],orientation:a,size:x},e))})}),e.trackingNumber&&(0,i.jsx)(`div`,{className:`mb-6 p-4 border rounded-lg`,children:(0,i.jsx)(p,{trackingNumber:e.trackingNumber,carrier:e.carrier,onCopy:d,onTrackWithCarrier:v,size:x})}),s&&(0,i.jsx)(`div`,{className:`mb-6`,children:(0,i.jsx)(g,{mapUrl:e.mapPreviewUrl,address:e.deliveryAddress,size:x})}),u&&(0,i.jsxs)(`div`,{className:`mb-6`,children:[(0,i.jsx)(`h4`,{className:t.cn(`font-medium mb-2`,D[x]),children:`Delivery Address`}),(0,i.jsx)(m,{address:e.deliveryAddress,size:x})]}),l&&e.updates.length>0&&(0,i.jsx)(`div`,{children:(0,i.jsx)(h,{updates:e.updates,size:x})})]})}exports.WakaOrderTracker=v,exports.default=v,exports.useOrderTracker=s;
@@ -53,7 +53,8 @@ function w(e = {}) {
53
53
  if (!(!a || !i)) {
54
54
  c(!0), u(null);
55
55
  try {
56
- o(await i(a.orderId));
56
+ let e = await i(a.orderId);
57
+ o(e);
57
58
  } catch (e) {
58
59
  u(e instanceof Error ? e.message : "Failed to refresh order");
59
60
  } finally {
@@ -534,4 +535,4 @@ function F({ order: n, orientation: r = "horizontal", showMapPreview: i = !0, sh
534
535
  });
535
536
  }
536
537
  //#endregion
537
- export { F as default, w as useOrderTracker };
538
+ export { F as WakaOrderTracker, F as default, w as useOrderTracker };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../waka-ad-provider/index.cjs.js`),r=require(`../waka-sponsored-badge/index.cjs.js`);let i=require(`react`);i=e.__toESM(i);let a=require(`lucide-react`),o=require(`react/jsx-runtime`);function s({slotId:e,collapseOnEnd:s=!0,collapseDuration:c=300,muted:l=!0,showClose:u=!0,closeAfter:d=0,visibilityThreshold:f=.5,className:p,onComplete:m,onClose:h}){let g=(0,i.useRef)(null),_=(0,i.useRef)(null),{config:v,isReady:y,hasConsent:b,getCustomAd:x,trackEvent:S}=n.useAdContext(),{isVisible:C}=n.useAdVisibility(g,f),[w,T]=(0,i.useState)(`loading`),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(l),[A,j]=(0,i.useState)(!1),[M,N]=(0,i.useState)(`auto`),[P,F]=(0,i.useState)(!1);(0,i.useEffect)(()=>{!y||b===!1||(async()=>{try{let t=await x(e);t?.videoUrl?(D(t),T(`loaded`),S({type:`loaded`,slotId:e,timestamp:new Date})):T(`collapsed`)}catch{T(`collapsed`)}})()},[y,b,e,x,S]),(0,i.useEffect)(()=>{!_.current||w!==`loaded`||(C?_.current.play().then(()=>{P||(F(!0),S({type:`impression`,slotId:e,timestamp:new Date}),E?.impressionUrl&&fetch(E.impressionUrl,{mode:`no-cors`}).catch(()=>{}))}).catch(()=>{}):_.current.pause())},[C,w,P,e,E,S]),(0,i.useEffect)(()=>{if(d===0||!P)return;let e=setTimeout(()=>{I()},d*1e3);return()=>clearTimeout(e)},[d,P]),(0,i.useEffect)(()=>{w===`loaded`&&g.current&&N(g.current.offsetHeight)},[w]);let I=()=>{s?(j(!0),N(0),setTimeout(()=>{T(`collapsed`),h?.()},c)):(T(`collapsed`),h?.())},L=()=>{S({type:`viewable`,slotId:e,timestamp:new Date,data:{completed:!0}}),m?.(),I()},R=()=>{_.current&&(_.current.muted=!O,k(!O))},z=()=>{E&&(S({type:`click`,slotId:e,timestamp:new Date}),E.clickUrl&&fetch(E.clickUrl,{mode:`no-cors`}).catch(()=>{}),E.targetUrl&&window.open(E.targetUrl,`_blank`,`noopener,noreferrer`))};return w===`collapsed`||w===`error`?null:w===`loading`?(0,o.jsx)(`div`,{ref:g,className:t.cn(`w-full aspect-video bg-muted animate-pulse rounded-lg`,p)}):(0,o.jsx)(`div`,{ref:g,className:t.cn(`relative w-full overflow-hidden rounded-lg bg-black`,A&&`transition-all`,p),style:{height:M,transitionDuration:`${c}ms`},children:(0,o.jsxs)(`div`,{className:`relative aspect-video`,children:[(0,o.jsx)(`video`,{ref:_,src:E?.videoUrl,muted:O,playsInline:!0,loop:!1,onClick:z,onEnded:L,className:`w-full h-full object-contain cursor-pointer`}),(0,o.jsxs)(`div`,{className:`absolute inset-0 pointer-events-none`,children:[(0,o.jsxs)(`div`,{className:`absolute top-0 left-0 right-0 p-3 flex items-center justify-between bg-gradient-to-b from-black/50 to-transparent pointer-events-auto`,children:[(0,o.jsx)(r.default,{variant:`dark`,size:`sm`,sponsor:E?.sponsor}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:R,className:`p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors`,children:O?(0,o.jsx)(a.VolumeX,{className:`h-4 w-4 text-white`}):(0,o.jsx)(a.Volume2,{className:`h-4 w-4 text-white`})}),u&&(0,o.jsx)(`button`,{type:`button`,onClick:I,className:`p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors`,children:(0,o.jsx)(a.X,{className:`h-4 w-4 text-white`})})]})]}),E?.cta&&(0,o.jsx)(`div`,{className:`absolute bottom-3 left-3 right-3 pointer-events-auto`,children:(0,o.jsx)(`button`,{type:`button`,onClick:z,className:`w-full px-4 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors text-center`,children:E.cta})})]})]})})}exports.default=s;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../waka-ad-provider/index.cjs.js"),r=require("../waka-sponsored-badge/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");function s({slotId:e,collapseOnEnd:s=!0,collapseDuration:c=300,muted:l=!0,showClose:u=!0,closeAfter:d=0,visibilityThreshold:f=.5,className:p,onComplete:m,onClose:h}){let g=(0,i.useRef)(null),_=(0,i.useRef)(null),{config:v,isReady:y,hasConsent:b,getCustomAd:x,trackEvent:S}=n.useAdContext(),{isVisible:C}=n.useAdVisibility(g,f),[w,T]=(0,i.useState)(`loading`),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(l),[A,j]=(0,i.useState)(!1),[M,N]=(0,i.useState)(`auto`),[P,F]=(0,i.useState)(!1);(0,i.useEffect)(()=>{!y||b===!1||(async()=>{try{let t=await x(e);t?.videoUrl?(D(t),T(`loaded`),S({type:`loaded`,slotId:e,timestamp:new Date})):T(`collapsed`)}catch{T(`collapsed`)}})()},[y,b,e,x,S]),(0,i.useEffect)(()=>{!_.current||w!==`loaded`||(C?_.current.play().then(()=>{P||(F(!0),S({type:`impression`,slotId:e,timestamp:new Date}),E?.impressionUrl&&fetch(E.impressionUrl,{mode:`no-cors`}).catch(()=>{}))}).catch(()=>{}):_.current.pause())},[C,w,P,e,E,S]),(0,i.useEffect)(()=>{if(d===0||!P)return;let e=setTimeout(()=>{I()},d*1e3);return()=>clearTimeout(e)},[d,P]),(0,i.useEffect)(()=>{w===`loaded`&&g.current&&N(g.current.offsetHeight)},[w]);let I=()=>{s?(j(!0),N(0),setTimeout(()=>{T(`collapsed`),h?.()},c)):(T(`collapsed`),h?.())},L=()=>{S({type:`viewable`,slotId:e,timestamp:new Date,data:{completed:!0}}),m?.(),I()},R=()=>{_.current&&(_.current.muted=!O,k(!O))},z=()=>{E&&(S({type:`click`,slotId:e,timestamp:new Date}),E.clickUrl&&fetch(E.clickUrl,{mode:`no-cors`}).catch(()=>{}),E.targetUrl&&window.open(E.targetUrl,`_blank`,`noopener,noreferrer`))};return w===`collapsed`||w===`error`?null:w===`loading`?(0,o.jsx)(`div`,{ref:g,className:t.cn(`w-full aspect-video bg-muted animate-pulse rounded-lg`,p)}):(0,o.jsx)(`div`,{ref:g,className:t.cn(`relative w-full overflow-hidden rounded-lg bg-black`,A&&`transition-all`,p),style:{height:M,transitionDuration:`${c}ms`},children:(0,o.jsxs)(`div`,{className:`relative aspect-video`,children:[(0,o.jsx)(`video`,{ref:_,src:E?.videoUrl,muted:O,playsInline:!0,loop:!1,onClick:z,onEnded:L,className:`w-full h-full object-contain cursor-pointer`}),(0,o.jsxs)(`div`,{className:`absolute inset-0 pointer-events-none`,children:[(0,o.jsxs)(`div`,{className:`absolute top-0 left-0 right-0 p-3 flex items-center justify-between bg-gradient-to-b from-black/50 to-transparent pointer-events-auto`,children:[(0,o.jsx)(r.WakaSponsoredBadge,{variant:`dark`,size:`sm`,sponsor:E?.sponsor}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`button`,{type:`button`,onClick:R,className:`p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors`,children:O?(0,o.jsx)(a.VolumeX,{className:`h-4 w-4 text-white`}):(0,o.jsx)(a.Volume2,{className:`h-4 w-4 text-white`})}),u&&(0,o.jsx)(`button`,{type:`button`,onClick:I,className:`p-1.5 rounded-full bg-black/50 hover:bg-black/70 transition-colors`,children:(0,o.jsx)(a.X,{className:`h-4 w-4 text-white`})})]})]}),E?.cta&&(0,o.jsx)(`div`,{className:`absolute bottom-3 left-3 right-3 pointer-events-auto`,children:(0,o.jsx)(`button`,{type:`button`,onClick:z,className:`w-full px-4 py-2 bg-primary text-primary-foreground rounded-lg font-medium hover:bg-primary/90 transition-colors text-center`,children:E.cta})})]})]})})}exports.WakaOutstreamVideo=s,exports.default=s;
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  import { cn as e } from "../../utils/cn.es.js";
4
4
  import { useAdContext as t, useAdVisibility as n } from "../waka-ad-provider/index.es.js";
5
- import r from "../waka-sponsored-badge/index.es.js";
5
+ import { WakaSponsoredBadge as r } from "../waka-sponsored-badge/index.es.js";
6
6
  import { useEffect as i, useRef as a, useState as o } from "react";
7
7
  import { Volume2 as s, VolumeX as c, X as l } from "lucide-react";
8
8
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
@@ -129,4 +129,4 @@ function f({ slotId: f, collapseOnEnd: p = !0, collapseDuration: m = 300, muted:
129
129
  });
130
130
  }
131
131
  //#endregion
132
- export { f as default };
132
+ export { f as WakaOutstreamVideo, f as default };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../button/index.cjs.js`),r=require(`../select/index.cjs.js`);let i=require(`react`);i=e.__toESM(i);let a=require(`lucide-react`),o=require(`react/jsx-runtime`);function s(e,t,n){if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor((n-3)/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`)}else if(e>=t-i-1){r.push(`ellipsis`);for(let e=Math.max(t-n+2,2);e<=t-1;e++)r.push(e)}else{r.push(`ellipsis`);for(let t=e-i;t<=e+i;t++)r.push(t);r.push(`ellipsis`)}return t>1&&r.push(t),r}function c({page:e,totalPages:i,onPageChange:c,pageSize:l=10,pageSizeOptions:u=[10,20,50,100],onPageSizeChange:d,totalItems:f,showPageSizeSelector:p=!1,showItemsInfo:m=!1,showFirstLast:h=!0,maxVisiblePages:g=7,size:_=`md`,variant:v=`outline`,className:y,labels:b={}}){let{page:x=`Page`,of:S=`sur`,items:C=`éléments`,itemsPerPage:w=`par page`,first:T=`Première page`,previous:E=`Page précédente`,next:D=`Page suivante`,last:O=`Dernière page`}=b,k={sm:`h-7 w-7 text-xs`,md:`h-8 w-8 text-sm`,lg:`h-10 w-10 text-base`},A={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},j=s(e,i,g),M=t=>{t>=1&&t<=i&&t!==e&&c(t)},N=f?(e-1)*l+1:null,P=f?Math.min(e*l,f):null;return(0,o.jsxs)(`nav`,{role:`navigation`,"aria-label":`Pagination`,className:t.cn(`flex flex-wrap items-center gap-4 justify-between`,y),children:[m&&f!==void 0&&(0,o.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[N,`-`,P,` `,S,` `,f,` `,C]}),p&&d&&(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-sm text-muted-foreground whitespace-nowrap`,children:[w,`:`]}),(0,o.jsxs)(r.Select,{value:String(l),onValueChange:e=>d(Number(e)),children:[(0,o.jsx)(r.SelectTrigger,{className:t.cn(`w-[70px]`,_===`sm`?`h-7`:_===`lg`?`h-10`:`h-8`),children:(0,o.jsx)(r.SelectValue,{})}),(0,o.jsx)(r.SelectContent,{children:u.map(e=>(0,o.jsx)(r.SelectItem,{value:String(e),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[h&&(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(1),disabled:e===1,"aria-label":T,children:(0,o.jsx)(a.ChevronsLeft,{className:A[_]})}),(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(e-1),disabled:e===1,"aria-label":E,children:(0,o.jsx)(a.ChevronLeft,{className:A[_]})}),(0,o.jsx)(`div`,{className:`flex items-center gap-1`,children:j.map((r,i)=>{if(r===`ellipsis`)return(0,o.jsx)(`span`,{className:t.cn(`flex items-center justify-center text-muted-foreground`,k[_]),children:(0,o.jsx)(a.MoreHorizontal,{className:A[_]})},`ellipsis-${i}`);let s=r===e;return(0,o.jsx)(n.Button,{variant:s?`default`:v,size:`icon`,className:t.cn(k[_],s&&`pointer-events-none`),onClick:()=>M(r),"aria-label":`${x} ${r}`,"aria-current":s?`page`:void 0,children:r},r)})}),(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(e+1),disabled:e===i,"aria-label":D,children:(0,o.jsx)(a.ChevronRight,{className:A[_]})}),h&&(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(i),disabled:e===i,"aria-label":O,children:(0,o.jsx)(a.ChevronsRight,{className:A[_]})})]}),!m&&i>0&&(0,o.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[x,` `,e,` `,S,` `,i]})]})}function l({totalItems:e,initialPageSize:t=10,initialPage:n=1}){let[r,a]=i.useState(n),[o,s]=i.useState(t),c=Math.ceil(e/o);i.useEffect(()=>{r>c&&c>0&&a(c)},[r,c]);let l=e=>{s(e),a(1)},u=()=>{r<c&&a(r+1)},d=()=>{r>1&&a(r-1)},f=()=>a(1),p=()=>a(c),m=(r-1)*o,h=Math.min(m+o-1,e-1);return{page:r,pageSize:o,totalPages:c,setPage:a,setPageSize:l,nextPage:u,prevPage:d,firstPage:f,lastPage:p,canNextPage:r<c,canPrevPage:r>1,startIndex:m,endIndex:h}}exports.default=c,exports.usePagination=l;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../button/index.cjs.js"),r=require("../select/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");function s(e,t,n){if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor((n-3)/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`)}else if(e>=t-i-1){r.push(`ellipsis`);for(let e=Math.max(t-n+2,2);e<=t-1;e++)r.push(e)}else{r.push(`ellipsis`);for(let t=e-i;t<=e+i;t++)r.push(t);r.push(`ellipsis`)}return t>1&&r.push(t),r}function c({page:e,totalPages:i,onPageChange:c,pageSize:l=10,pageSizeOptions:u=[10,20,50,100],onPageSizeChange:d,totalItems:f,showPageSizeSelector:p=!1,showItemsInfo:m=!1,showFirstLast:h=!0,maxVisiblePages:g=7,size:_=`md`,variant:v=`outline`,className:y,labels:b={}}){let{page:x=`Page`,of:S=`sur`,items:C=`éléments`,itemsPerPage:w=`par page`,first:T=`Première page`,previous:E=`Page précédente`,next:D=`Page suivante`,last:O=`Dernière page`}=b,k={sm:`h-7 w-7 text-xs`,md:`h-8 w-8 text-sm`,lg:`h-10 w-10 text-base`},A={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},j=s(e,i,g),M=t=>{t>=1&&t<=i&&t!==e&&c(t)},N=f?(e-1)*l+1:null,P=f?Math.min(e*l,f):null;return(0,o.jsxs)(`nav`,{role:`navigation`,"aria-label":`Pagination`,className:t.cn(`flex flex-wrap items-center gap-4 justify-between`,y),children:[m&&f!==void 0&&(0,o.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[N,`-`,P,` `,S,` `,f,` `,C]}),p&&d&&(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-sm text-muted-foreground whitespace-nowrap`,children:[w,`:`]}),(0,o.jsxs)(r.Select,{value:String(l),onValueChange:e=>d(Number(e)),children:[(0,o.jsx)(r.SelectTrigger,{className:t.cn(`w-[70px]`,_===`sm`?`h-7`:_===`lg`?`h-10`:`h-8`),children:(0,o.jsx)(r.SelectValue,{})}),(0,o.jsx)(r.SelectContent,{children:u.map(e=>(0,o.jsx)(r.SelectItem,{value:String(e),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[h&&(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(1),disabled:e===1,"aria-label":T,children:(0,o.jsx)(a.ChevronsLeft,{className:A[_]})}),(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(e-1),disabled:e===1,"aria-label":E,children:(0,o.jsx)(a.ChevronLeft,{className:A[_]})}),(0,o.jsx)(`div`,{className:`flex items-center gap-1`,children:j.map((r,i)=>{if(r===`ellipsis`)return(0,o.jsx)(`span`,{className:t.cn(`flex items-center justify-center text-muted-foreground`,k[_]),children:(0,o.jsx)(a.MoreHorizontal,{className:A[_]})},`ellipsis-${i}`);let s=r===e;return(0,o.jsx)(n.Button,{variant:s?`default`:v,size:`icon`,className:t.cn(k[_],s&&`pointer-events-none`),onClick:()=>M(r),"aria-label":`${x} ${r}`,"aria-current":s?`page`:void 0,children:r},r)})}),(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(e+1),disabled:e===i,"aria-label":D,children:(0,o.jsx)(a.ChevronRight,{className:A[_]})}),h&&(0,o.jsx)(n.Button,{variant:v,size:`icon`,className:k[_],onClick:()=>M(i),disabled:e===i,"aria-label":O,children:(0,o.jsx)(a.ChevronsRight,{className:A[_]})})]}),!m&&i>0&&(0,o.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[x,` `,e,` `,S,` `,i]})]})}function l({totalItems:e,initialPageSize:t=10,initialPage:n=1}){let[r,a]=i.useState(n),[o,s]=i.useState(t),c=Math.ceil(e/o);i.useEffect(()=>{r>c&&c>0&&a(c)},[r,c]);let l=e=>{s(e),a(1)},u=()=>{r<c&&a(r+1)},d=()=>{r>1&&a(r-1)},f=()=>a(1),p=()=>a(c),m=(r-1)*o,h=Math.min(m+o-1,e-1);return{page:r,pageSize:o,totalPages:c,setPage:a,setPageSize:l,nextPage:u,prevPage:d,firstPage:f,lastPage:p,canNextPage:r<c,canPrevPage:r>1,startIndex:m,endIndex:h}}exports.WakaPagination=c,exports.default=c,exports.usePagination=l;
@@ -180,4 +180,4 @@ function _({ totalItems: e, initialPageSize: t = 10, initialPage: n = 1 }) {
180
180
  };
181
181
  }
182
182
  //#endregion
183
- export { g as default, _ as usePagination };
183
+ export { g as WakaPagination, g as default, _ as usePagination };
@@ -1,4 +1,4 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={weak:{label:`Weak`,color:`bg-red-500`,bgColor:`bg-red-500/20`,percent:20},fair:{label:`Fair`,color:`bg-orange-500`,bgColor:`bg-orange-500/20`,percent:40},good:{label:`Good`,color:`bg-yellow-500`,bgColor:`bg-yellow-500/20`,percent:60},strong:{label:`Strong`,color:`bg-lime-500`,bgColor:`bg-lime-500/20`,percent:80},"very-strong":{label:`Very Strong`,color:`bg-green-500`,bgColor:`bg-green-500/20`,percent:100}},o=e=>{let{minLength:t=8,requireUppercase:n=!0,requireLowercase:r=!0,requireNumber:i=!0,requireSpecialChar:a=!0}=e,o=[];return o.push({key:`minLength`,label:`At least ${t} characters`,validate:e=>e.length>=t,required:!0}),n&&o.push({key:`uppercase`,label:`Contains uppercase letter`,validate:e=>/[A-Z]/.test(e),required:!0}),r&&o.push({key:`lowercase`,label:`Contains lowercase letter`,validate:e=>/[a-z]/.test(e),required:!0}),i&&o.push({key:`number`,label:`Contains number`,validate:e=>/[0-9]/.test(e),required:!0}),a&&o.push({key:`specialChar`,label:`Contains special character`,validate:e=>/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e),required:!0}),o};function s(e,t={}){let{customRequirements:r=[],overrideRequirements:i}=t,a=n.useMemo(()=>i||[...o(t),...r],[t.minLength,t.requireUppercase,t.requireLowercase,t.requireNumber,t.requireSpecialChar,r,i]);return n.useMemo(()=>{if(!e)return{level:`weak`,score:0,metRequirements:[],unmetRequirements:a.map(e=>e.key),isValid:!1};let t=[],n=[],r=0,i=0;a.forEach(a=>{a.validate(e)?(t.push(a.key),a.required!==!1&&r++):n.push(a.key),a.required!==!1&&i++});let o=i>0?r/i*100:0,s=Math.min(20,Math.max(0,e.length-8)*2),c=Math.min(10,t.length*2),l=Math.min(100,o+s+c),u;return u=l<20?`weak`:l<40?`fair`:l<60?`good`:l<80?`strong`:`very-strong`,{level:u,score:l,metRequirements:t,unmetRequirements:n,isValid:r===i}},[e,a])}function c({level:e,score:r,animated:o=!0,size:s=`default`,showLabel:c=!0,className:l}){let[u,d]=n.useState(0),f=a[e];return n.useEffect(()=>{if(!o){d(r);return}let e=u,t=r-e,n=Date.now(),i=()=>{let r=Date.now()-n,a=Math.min(r/300,1);d(e+t*(1-(1-a)**3)),a<1&&requestAnimationFrame(i)};requestAnimationFrame(i)},[r,o]),(0,i.jsxs)(`div`,{className:t.cn(`space-y-1.5`,l),children:[c&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Password strength`}),(0,i.jsx)(`span`,{className:t.cn(`font-medium transition-colors duration-300`,e===`weak`&&`text-red-500`,e===`fair`&&`text-orange-500`,e===`good`&&`text-yellow-500`,e===`strong`&&`text-lime-500`,e===`very-strong`&&`text-green-500`),children:f.label})]}),(0,i.jsx)(`div`,{className:t.cn(`relative w-full overflow-hidden rounded-full bg-muted`,{sm:`h-1`,default:`h-2`,lg:`h-3`}[s]),children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-300 ease-out`,f.color,o&&`animate-strength-glow`),style:{width:`${u}%`},children:o&&(0,i.jsx)(`div`,{className:`absolute inset-0 overflow-hidden rounded-full`,children:(0,i.jsx)(`div`,{className:`animate-strength-shine absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent`})})})}),(0,i.jsx)(`style`,{children:`
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={weak:{label:`Weak`,color:`bg-red-500`,bgColor:`bg-red-500/20`,percent:20},fair:{label:`Fair`,color:`bg-orange-500`,bgColor:`bg-orange-500/20`,percent:40},good:{label:`Good`,color:`bg-yellow-500`,bgColor:`bg-yellow-500/20`,percent:60},strong:{label:`Strong`,color:`bg-lime-500`,bgColor:`bg-lime-500/20`,percent:80},"very-strong":{label:`Very Strong`,color:`bg-green-500`,bgColor:`bg-green-500/20`,percent:100}},o=e=>{let{minLength:t=8,requireUppercase:n=!0,requireLowercase:r=!0,requireNumber:i=!0,requireSpecialChar:a=!0}=e,o=[];return o.push({key:`minLength`,label:`At least ${t} characters`,validate:e=>e.length>=t,required:!0}),n&&o.push({key:`uppercase`,label:`Contains uppercase letter`,validate:e=>/[A-Z]/.test(e),required:!0}),r&&o.push({key:`lowercase`,label:`Contains lowercase letter`,validate:e=>/[a-z]/.test(e),required:!0}),i&&o.push({key:`number`,label:`Contains number`,validate:e=>/[0-9]/.test(e),required:!0}),a&&o.push({key:`specialChar`,label:`Contains special character`,validate:e=>/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(e),required:!0}),o};function s(e,t={}){let{customRequirements:r=[],overrideRequirements:i}=t,a=n.useMemo(()=>i||[...o(t),...r],[t.minLength,t.requireUppercase,t.requireLowercase,t.requireNumber,t.requireSpecialChar,r,i]);return n.useMemo(()=>{if(!e)return{level:`weak`,score:0,metRequirements:[],unmetRequirements:a.map(e=>e.key),isValid:!1};let t=[],n=[],r=0,i=0;a.forEach(a=>{a.validate(e)?(t.push(a.key),a.required!==!1&&r++):n.push(a.key),a.required!==!1&&i++});let o=i>0?r/i*100:0,s=Math.min(20,Math.max(0,e.length-8)*2),c=Math.min(10,t.length*2),l=Math.min(100,o+s+c),u;return u=l<20?`weak`:l<40?`fair`:l<60?`good`:l<80?`strong`:`very-strong`,{level:u,score:l,metRequirements:t,unmetRequirements:n,isValid:r===i}},[e,a])}function c({level:e,score:r,animated:o=!0,size:s=`default`,showLabel:c=!0,className:l}){let[u,d]=n.useState(0),f=a[e];return n.useEffect(()=>{if(!o){d(r);return}let e=u,t=r-e,n=Date.now(),i=()=>{let r=Date.now()-n,a=Math.min(r/300,1),o=1-(1-a)**3;d(e+t*o),a<1&&requestAnimationFrame(i)};requestAnimationFrame(i)},[r,o]),(0,i.jsxs)(`div`,{className:t.cn(`space-y-1.5`,l),children:[c&&(0,i.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Password strength`}),(0,i.jsx)(`span`,{className:t.cn(`font-medium transition-colors duration-300`,e===`weak`&&`text-red-500`,e===`fair`&&`text-orange-500`,e===`good`&&`text-yellow-500`,e===`strong`&&`text-lime-500`,e===`very-strong`&&`text-green-500`),children:f.label})]}),(0,i.jsx)(`div`,{className:t.cn(`relative w-full overflow-hidden rounded-full bg-muted`,{sm:`h-1`,default:`h-2`,lg:`h-3`}[s]),children:(0,i.jsx)(`div`,{className:t.cn(`h-full rounded-full transition-all duration-300 ease-out`,f.color,o&&`animate-strength-glow`),style:{width:`${u}%`},children:o&&(0,i.jsx)(`div`,{className:`absolute inset-0 overflow-hidden rounded-full`,children:(0,i.jsx)(`div`,{className:`animate-strength-shine absolute inset-0 bg-gradient-to-r from-transparent via-white/30 to-transparent`})})})}),(0,i.jsx)(`style`,{children:`
2
2
  @keyframes strength-shine {
3
3
  0% { transform: translateX(-100%); }
4
4
  50%, 100% { transform: translateX(100%); }
@@ -22,4 +22,4 @@
22
22
  .animate-requirement-check {
23
23
  animation: requirement-check 0.3s ease-out;
24
24
  }
25
- `})]})}function u({requirements:e,metRequirements:n,animated:r=!0,size:a=`default`,className:o}){return(0,i.jsx)(`div`,{className:t.cn(`space-y-2`,o),children:e.map(e=>(0,i.jsx)(l,{requirement:e,isMet:n.includes(e.key),animated:r,size:a},e.key))})}function d({value:e,onChange:a,showToggle:o=!0,placeholder:s=`Enter password`,label:c,disabled:l=!1,error:u,size:d=`default`,strengthLevel:f,className:p}){let[m,h]=n.useState(!1),g=n.useId(),_={sm:{input:`h-8 text-sm px-3`,icon:`h-4 w-4`,button:`h-8 w-8`},default:{input:`h-10 text-base px-4`,icon:`h-5 w-5`,button:`h-10 w-10`},lg:{input:`h-12 text-lg px-5`,icon:`h-6 w-6`,button:`h-12 w-12`}}[d],v=f?t.cn(f===`weak`&&`focus-visible:ring-red-500/50`,f===`fair`&&`focus-visible:ring-orange-500/50`,f===`good`&&`focus-visible:ring-yellow-500/50`,f===`strong`&&`focus-visible:ring-lime-500/50`,f===`very-strong`&&`focus-visible:ring-green-500/50`):``;return(0,i.jsxs)(`div`,{className:t.cn(`space-y-1.5`,p),children:[c&&(0,i.jsx)(`label`,{htmlFor:g,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:c}),(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3`,children:f===`very-strong`||f===`strong`?(0,i.jsx)(r.ShieldCheck,{className:t.cn(_.icon,`text-green-500`)}):f===`weak`?(0,i.jsx)(r.ShieldAlert,{className:t.cn(_.icon,`text-red-500`)}):(0,i.jsx)(r.Shield,{className:t.cn(_.icon,`text-muted-foreground`)})}),(0,i.jsx)(`input`,{id:g,type:m?`text`:`password`,value:e,onChange:e=>a(e.target.value),placeholder:s,disabled:l,className:t.cn(`flex w-full rounded-md border border-input bg-background ring-offset-background`,`file:border-0 file:bg-transparent file:text-sm file:font-medium`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:cursor-not-allowed disabled:opacity-50`,`transition-all duration-200`,_.input,`pl-10`,o&&`pr-10`,u&&`border-destructive focus-visible:ring-destructive`,v)}),o&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>h(!m),disabled:l,className:t.cn(`absolute inset-y-0 right-0 flex items-center justify-center`,`text-muted-foreground hover:text-foreground`,`transition-colors duration-200`,`disabled:cursor-not-allowed disabled:opacity-50`,_.button),"aria-label":m?`Hide password`:`Show password`,children:m?(0,i.jsx)(r.EyeOff,{className:_.icon}):(0,i.jsx)(r.Eye,{className:_.icon})})]}),u&&(0,i.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]})}function f({password:e,onPasswordChange:r,minLength:a=8,showInput:l=!0,showToggle:f=!0,showStrengthBar:p=!0,showChecklist:m=!0,showStrengthLabel:h=!0,animated:g=!0,customRequirements:_=[],overrideRequirements:v,requireUppercase:y=!0,requireLowercase:b=!0,requireNumber:x=!0,requireSpecialChar:S=!0,size:C=`default`,placeholder:w=`Enter password`,label:T,disabled:E=!1,error:D,className:O,onStrengthChange:k}){let A=s(e,{minLength:a,customRequirements:_,overrideRequirements:v,requireUppercase:y,requireLowercase:b,requireNumber:x,requireSpecialChar:S}),j=n.useMemo(()=>v||[...o({minLength:a,requireUppercase:y,requireLowercase:b,requireNumber:x,requireSpecialChar:S}),..._],[a,y,b,x,S,_,v]),M=n.useRef(null);return n.useEffect(()=>{k&&(!M.current||M.current.level!==A.level||M.current.score!==A.score)&&(k(A),M.current=A)},[A,k]),(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,{sm:`gap-3`,default:`gap-4`,lg:`gap-5`}[C],O),children:[l&&r&&(0,i.jsx)(d,{value:e,onChange:r,showToggle:f,placeholder:w,label:T,disabled:E,error:D,size:C,strengthLevel:e.length>0?A.level:void 0}),p&&e.length>0&&(0,i.jsx)(c,{level:A.level,score:A.score,animated:g,size:C,showLabel:h}),m&&(0,i.jsx)(u,{requirements:j,metRequirements:A.metRequirements,animated:g,size:C})]})}function p({password:e,minLength:n=8,requireUppercase:r=!0,requireLowercase:o=!0,requireNumber:c=!0,requireSpecialChar:l=!0,className:u}){let{level:d,score:f}=s(e,{minLength:n,requireUppercase:r,requireLowercase:o,requireNumber:c,requireSpecialChar:l});if(!e)return null;let p=a[d];return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2`,u),children:[(0,i.jsx)(`div`,{className:`flex gap-1`,children:[`weak`,`fair`,`good`,`strong`,`very-strong`].map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`h-1 w-4 rounded-full transition-all duration-300`,n<=[`weak`,`fair`,`good`,`strong`,`very-strong`].indexOf(d)?p.color:`bg-muted`)},e))}),(0,i.jsx)(`span`,{className:t.cn(`text-xs font-medium transition-colors duration-300`,d===`weak`&&`text-red-500`,d===`fair`&&`text-orange-500`,d===`good`&&`text-yellow-500`,d===`strong`&&`text-lime-500`,d===`very-strong`&&`text-green-500`),children:p.label})]})}exports.WakaPasswordStrengthIndicator=p,exports.default=f,exports.usePasswordStrength=s;
25
+ `})]})}function u({requirements:e,metRequirements:n,animated:r=!0,size:a=`default`,className:o}){return(0,i.jsx)(`div`,{className:t.cn(`space-y-2`,o),children:e.map(e=>(0,i.jsx)(l,{requirement:e,isMet:n.includes(e.key),animated:r,size:a},e.key))})}function d({value:e,onChange:a,showToggle:o=!0,placeholder:s=`Enter password`,label:c,disabled:l=!1,error:u,size:d=`default`,strengthLevel:f,className:p}){let[m,h]=n.useState(!1),g=n.useId(),_={sm:{input:`h-8 text-sm px-3`,icon:`h-4 w-4`,button:`h-8 w-8`},default:{input:`h-10 text-base px-4`,icon:`h-5 w-5`,button:`h-10 w-10`},lg:{input:`h-12 text-lg px-5`,icon:`h-6 w-6`,button:`h-12 w-12`}}[d],v=f?t.cn(f===`weak`&&`focus-visible:ring-red-500/50`,f===`fair`&&`focus-visible:ring-orange-500/50`,f===`good`&&`focus-visible:ring-yellow-500/50`,f===`strong`&&`focus-visible:ring-lime-500/50`,f===`very-strong`&&`focus-visible:ring-green-500/50`):``;return(0,i.jsxs)(`div`,{className:t.cn(`space-y-1.5`,p),children:[c&&(0,i.jsx)(`label`,{htmlFor:g,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,children:c}),(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3`,children:f===`very-strong`||f===`strong`?(0,i.jsx)(r.ShieldCheck,{className:t.cn(_.icon,`text-green-500`)}):f===`weak`?(0,i.jsx)(r.ShieldAlert,{className:t.cn(_.icon,`text-red-500`)}):(0,i.jsx)(r.Shield,{className:t.cn(_.icon,`text-muted-foreground`)})}),(0,i.jsx)(`input`,{id:g,type:m?`text`:`password`,value:e,onChange:e=>a(e.target.value),placeholder:s,disabled:l,className:t.cn(`flex w-full rounded-md border border-input bg-background ring-offset-background`,`file:border-0 file:bg-transparent file:text-sm file:font-medium`,`placeholder:text-muted-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,`disabled:cursor-not-allowed disabled:opacity-50`,`transition-all duration-200`,_.input,`pl-10`,o&&`pr-10`,u&&`border-destructive focus-visible:ring-destructive`,v)}),o&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>h(!m),disabled:l,className:t.cn(`absolute inset-y-0 right-0 flex items-center justify-center`,`text-muted-foreground hover:text-foreground`,`transition-colors duration-200`,`disabled:cursor-not-allowed disabled:opacity-50`,_.button),"aria-label":m?`Hide password`:`Show password`,children:m?(0,i.jsx)(r.EyeOff,{className:_.icon}):(0,i.jsx)(r.Eye,{className:_.icon})})]}),u&&(0,i.jsx)(`p`,{className:`text-sm text-destructive`,children:u})]})}function f({password:e,onPasswordChange:r,minLength:a=8,showInput:l=!0,showToggle:f=!0,showStrengthBar:p=!0,showChecklist:m=!0,showStrengthLabel:h=!0,animated:g=!0,customRequirements:_=[],overrideRequirements:v,requireUppercase:y=!0,requireLowercase:b=!0,requireNumber:x=!0,requireSpecialChar:S=!0,size:C=`default`,placeholder:w=`Enter password`,label:T,disabled:E=!1,error:D,className:O,onStrengthChange:k}){let A=s(e,{minLength:a,customRequirements:_,overrideRequirements:v,requireUppercase:y,requireLowercase:b,requireNumber:x,requireSpecialChar:S}),j=n.useMemo(()=>v||[...o({minLength:a,requireUppercase:y,requireLowercase:b,requireNumber:x,requireSpecialChar:S}),..._],[a,y,b,x,S,_,v]),M=n.useRef(null);return n.useEffect(()=>{k&&(!M.current||M.current.level!==A.level||M.current.score!==A.score)&&(k(A),M.current=A)},[A,k]),(0,i.jsxs)(`div`,{className:t.cn(`flex flex-col`,{sm:`gap-3`,default:`gap-4`,lg:`gap-5`}[C],O),children:[l&&r&&(0,i.jsx)(d,{value:e,onChange:r,showToggle:f,placeholder:w,label:T,disabled:E,error:D,size:C,strengthLevel:e.length>0?A.level:void 0}),p&&e.length>0&&(0,i.jsx)(c,{level:A.level,score:A.score,animated:g,size:C,showLabel:h}),m&&(0,i.jsx)(u,{requirements:j,metRequirements:A.metRequirements,animated:g,size:C})]})}function p({password:e,minLength:n=8,requireUppercase:r=!0,requireLowercase:o=!0,requireNumber:c=!0,requireSpecialChar:l=!0,className:u}){let{level:d,score:f}=s(e,{minLength:n,requireUppercase:r,requireLowercase:o,requireNumber:c,requireSpecialChar:l});if(!e)return null;let p=a[d];return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2`,u),children:[(0,i.jsx)(`div`,{className:`flex gap-1`,children:[`weak`,`fair`,`good`,`strong`,`very-strong`].map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`h-1 w-4 rounded-full transition-all duration-300`,n<=[`weak`,`fair`,`good`,`strong`,`very-strong`].indexOf(d)?p.color:`bg-muted`)},e))}),(0,i.jsx)(`span`,{className:t.cn(`text-xs font-medium transition-colors duration-300`,d===`weak`&&`text-red-500`,d===`fair`&&`text-orange-500`,d===`good`&&`text-yellow-500`,d===`strong`&&`text-lime-500`,d===`very-strong`&&`text-green-500`),children:p.label})]})}exports.WakaPasswordStrength=f,exports.default=f,exports.WakaPasswordStrengthIndicator=p,exports.usePasswordStrength=s;
@@ -105,8 +105,8 @@ function m({ level: n, score: r, animated: i = !0, size: a = "default", showLabe
105
105
  return;
106
106
  }
107
107
  let e = c, t = r - e, n = Date.now(), a = () => {
108
- let r = Date.now() - n, i = Math.min(r / 300, 1);
109
- f(e + t * (1 - (1 - i) ** 3)), i < 1 && requestAnimationFrame(a);
108
+ let r = Date.now() - n, i = Math.min(r / 300, 1), o = 1 - (1 - i) ** 3;
109
+ f(e + t * o), i < 1 && requestAnimationFrame(a);
110
110
  };
111
111
  requestAnimationFrame(a);
112
112
  }, [r, i]), /* @__PURE__ */ u("div", {
@@ -342,4 +342,4 @@ function y({ password: t, minLength: n = 8, requireUppercase: r = !0, requireLow
342
342
  });
343
343
  }
344
344
  //#endregion
345
- export { y as WakaPasswordStrengthIndicator, v as default, p as usePasswordStrength };
345
+ export { v as WakaPasswordStrength, v as default, y as WakaPasswordStrengthIndicator, p as usePasswordStrength };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#1A1F71`}),(0,i.jsx)(`path`,{d:`M19.5 21H17L18.8 11H21.3L19.5 21ZM15.1 11L12.7 18L12.4 16.5L11.5 12C11.5 12 11.4 11 10 11H6.1L6 11.2C6 11.2 7.5 11.5 9.3 12.6L11.5 21H14.1L17.9 11H15.1ZM35 21H37.3L35.3 11H33.2C32.1 11 31.8 11.9 31.8 11.9L28 21H30.6L31.1 19.5H34.3L35 21ZM31.9 17.5L33.3 13.5L34.1 17.5H31.9ZM28.4 13.5L28.7 11.8C28.7 11.8 27.3 11.2 25.8 11.2C24.2 11.2 21.4 11.9 21.4 14.5C21.4 17 24.9 17 24.9 18.3C24.9 19.6 21.7 19.3 20.4 18.3L20.1 20.1C20.1 20.1 21.5 20.8 23.5 20.8C25.5 20.8 27.6 19.7 27.6 17.3C27.6 14.8 24 14.5 24 13.4C24 12.3 26.5 12.4 27.7 13.1L28.4 13.5Z`,fill:`white`})]}),o=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#252525`}),(0,i.jsx)(`circle`,{cx:`19`,cy:`16`,r:`9`,fill:`#EB001B`}),(0,i.jsx)(`circle`,{cx:`29`,cy:`16`,r:`9`,fill:`#F79E1B`}),(0,i.jsx)(`path`,{d:`M24 9.5C25.9 11 27.1 13.4 27.1 16C27.1 18.6 25.9 21 24 22.5C22.1 21 20.9 18.6 20.9 16C20.9 13.4 22.1 11 24 9.5Z`,fill:`#FF5F00`})]}),s=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#006FCF`}),(0,i.jsx)(`path`,{d:`M10 20V12H14.5L15.5 13.5L16.5 12H35V19.5C35 19.5 34.3 20 33.5 20H23.5L22.5 18.5V20H19V18C19 18 18.5 18.5 17.5 18.5H16.5V20H10ZM11 13V19H13.5L15.5 16L17.5 19H20V15.5L22 19H24L26 15.5V19H28V13H25L23 16.5L21 13H11ZM29 13V19H31V17H33C34.1 17 35 16.1 35 15C35 13.9 34.1 13 33 13H29ZM31 14.5H32.5C32.8 14.5 33 14.7 33 15C33 15.3 32.8 15.5 32.5 15.5H31V14.5Z`,fill:`white`})]}),c=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#003087`}),(0,i.jsx)(`path`,{d:`M19.5 8H25C27.8 8 29.5 9.5 29 12.5C28.5 16 26 17.5 23.5 17.5H21.5L20.5 23H17L19.5 8Z`,fill:`#009CDE`}),(0,i.jsx)(`path`,{d:`M22 10H26.5C28.5 10 29.5 11 29.2 13C28.8 15.5 27 16.5 25 16.5H23.5L22.8 20.5H20L22 10Z`,fill:`white`})]}),l=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#000000`}),(0,i.jsx)(`path`,{d:`M15.5 11.5C16.2 10.6 16.7 9.4 16.5 8.2C15.4 8.3 14.1 9 13.3 9.9C12.6 10.7 12 11.9 12.2 13.1C13.4 13.2 14.7 12.4 15.5 11.5Z`,fill:`white`}),(0,i.jsx)(`path`,{d:`M16.5 13.3C14.9 13.2 13.5 14.2 12.7 14.2C11.9 14.2 10.7 13.4 9.4 13.4C7.7 13.4 6.1 14.4 5.2 16C3.3 19.2 4.7 24 6.5 26.6C7.4 27.9 8.5 29.3 9.9 29.3C11.2 29.2 11.7 28.4 13.3 28.4C14.8 28.4 15.3 29.3 16.7 29.2C18.1 29.2 19.1 27.9 20 26.6C21 25.1 21.4 23.7 21.5 23.6C21.4 23.6 18.4 22.4 18.4 18.9C18.3 16 20.7 14.6 20.8 14.5C19.4 12.5 17.3 12.3 16.5 13.3Z`,fill:`white`,transform:`scale(0.6) translate(12, 1)`}),(0,i.jsx)(`text`,{x:`24`,y:`19`,fill:`white`,fontSize:`8`,fontFamily:`system-ui`,fontWeight:`600`,children:`Pay`})]}),u=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#FFFFFF`,stroke:`#E0E0E0`}),(0,i.jsx)(`path`,{d:`M22.8 16.6V20.4H21.4V10H25.2C26.1 10 26.9 10.3 27.6 10.9C28.3 11.5 28.6 12.3 28.6 13.3C28.6 14.3 28.3 15.1 27.6 15.7C26.9 16.3 26.1 16.6 25.1 16.6H22.8ZM22.8 11.3V15.3H25.2C25.7 15.3 26.2 15.1 26.5 14.7C26.9 14.3 27.1 13.9 27.1 13.3C27.1 12.8 26.9 12.3 26.5 11.9C26.1 11.5 25.7 11.3 25.1 11.3H22.8Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M32.8 13.4C33.9 13.4 34.8 13.7 35.5 14.4C36.2 15.1 36.5 15.9 36.5 17V20.4H35.1V19.3H35C34.4 20.2 33.6 20.6 32.5 20.6C31.6 20.6 30.8 20.3 30.2 19.8C29.6 19.3 29.3 18.6 29.3 17.8C29.3 17 29.6 16.3 30.3 15.8C30.9 15.3 31.8 15 32.9 15C33.8 15 34.6 15.2 35.1 15.5V15.2C35.1 14.7 34.9 14.2 34.5 13.9C34.1 13.5 33.6 13.3 33 13.3C32.1 13.3 31.5 13.7 31 14.4L29.8 13.7C30.5 12.8 31.5 13.4 32.8 13.4ZM30.8 17.8C30.8 18.2 31 18.5 31.3 18.8C31.6 19.1 32 19.2 32.5 19.2C33.2 19.2 33.8 19 34.3 18.5C34.8 18 35.1 17.5 35.1 16.9C34.6 16.5 33.9 16.3 33.1 16.3C32.5 16.3 32 16.5 31.6 16.8C31.1 17.1 30.8 17.4 30.8 17.8Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M43 13.6L38.7 23.3H37.2L38.8 19.9L36 13.6H37.6L39.5 18.3L41.4 13.6H43Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M16.5 15.5C16.5 15.1 16.5 14.7 16.4 14.3H10.5V16.6H13.9C13.8 17.3 13.4 18 12.7 18.4V19.9H14.7C15.9 18.8 16.5 17.3 16.5 15.5Z`,fill:`#4285F4`}),(0,i.jsx)(`path`,{d:`M10.5 21.3C12.1 21.3 13.5 20.8 14.7 19.9L12.7 18.4C12.1 18.8 11.4 19 10.5 19C9 19 7.7 18 7.2 16.7H5.2V18.2C6.3 20.2 8.3 21.3 10.5 21.3Z`,fill:`#34A853`}),(0,i.jsx)(`path`,{d:`M7.2 16.7C7 16.2 6.9 15.6 6.9 15C6.9 14.4 7 13.8 7.2 13.3V11.8H5.2C4.6 13 4.2 14.4 4.2 15C4.2 15.6 4.6 17 5.2 18.2L7.2 16.7Z`,fill:`#FBBC05`}),(0,i.jsx)(`path`,{d:`M10.5 11C11.5 11 12.4 11.4 13.1 12L14.8 10.3C13.5 9.1 12.1 8.5 10.5 8.5C8.3 8.5 6.3 9.6 5.2 11.8L7.2 13.3C7.7 12 9 11 10.5 11Z`,fill:`#EA4335`})]}),d=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#1E3A5F`}),(0,i.jsx)(`path`,{d:`M24 7L10 14V16H38V14L24 7Z`,fill:`white`}),(0,i.jsx)(`rect`,{x:`12`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`18`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`27`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`33`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`10`,y:`25`,width:`28`,height:`2`,fill:`white`})]}),f=[{type:`credit_card`,label:`Credit or Debit Card`,description:`Pay securely with your card`,acceptedBrands:[`visa`,`mastercard`,`amex`]},{type:`paypal`,label:`PayPal`,description:`Fast and secure payment`},{type:`apple_pay`,label:`Apple Pay`,description:`Pay with Face ID or Touch ID`},{type:`google_pay`,label:`Google Pay`,description:`Fast checkout with Google`},{type:`bank_transfer`,label:`Bank Transfer`,description:`Direct bank payment`}],p=({type:e,brand:n,className:f})=>{let p=t.cn(`h-8 w-12 rounded`,f);if(e===`credit_card`&&n)switch(n){case`visa`:return(0,i.jsx)(a,{className:p});case`mastercard`:return(0,i.jsx)(o,{className:p});case`amex`:return(0,i.jsx)(s,{className:p});default:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)})}switch(e){case`credit_card`:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)});case`paypal`:return(0,i.jsx)(c,{className:p});case`apple_pay`:return(0,i.jsx)(l,{className:p});case`google_pay`:return(0,i.jsx)(u,{className:p});case`bank_transfer`:return(0,i.jsx)(d,{className:p});default:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)})}},m=({brands:e,className:n})=>(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-1`,n),children:[e.includes(`visa`)&&(0,i.jsx)(a,{className:`h-6 w-9`}),e.includes(`mastercard`)&&(0,i.jsx)(o,{className:`h-6 w-9`}),e.includes(`amex`)&&(0,i.jsx)(s,{className:`h-6 w-9`})]});function h({value:e,onChange:a,savedMethods:o=[],options:s=f,showAddNew:c=!0,onAddNew:l,onDelete:u,allowDelete:d=!0,variant:h=`card`,size:v=`md`,layout:y=`list`,columns:b=2,showBrandIcons:x=!0,disabled:S=!1,className:C,label:w,error:T,required:E=!1}){let[D,O]=n.useState(null),k={sm:{container:`p-3`,text:`text-sm`,subtext:`text-xs`,icon:`h-5 w-8`,gap:`gap-2`},md:{container:`p-4`,text:`text-base`,subtext:`text-sm`,icon:`h-6 w-10`,gap:`gap-3`},lg:{container:`p-5`,text:`text-lg`,subtext:`text-base`,icon:`h-8 w-12`,gap:`gap-4`}},A={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`},j=(e,t)=>{S||a?.(e,t)},M=e=>{S||l?.(e)},N=(e,t)=>{e.stopPropagation(),!S&&u?.(t)},P=e=>o.filter(t=>t.type===e),F=t=>e===t,I=e=>(0,i.jsx)(`div`,{className:t.cn(`h-5 w-5 rounded-full border-2 flex items-center justify-center transition-all duration-200`,e?`border-primary bg-primary`:`border-muted-foreground/30`),children:e&&(0,i.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary-foreground animate-in zoom-in-50 duration-200`})}),L=e=>(0,i.jsx)(`div`,{className:t.cn(`h-6 w-6 rounded-full flex items-center justify-center transition-all duration-200`,e?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:e&&(0,i.jsx)(r.Check,{className:`h-4 w-4 animate-in zoom-in-50 duration-200`})}),R=e=>{let n=F(e.id);return(0,i.jsx)(`button`,{type:`button`,onClick:()=>j(e.id,e),disabled:S,className:t.cn(`group relative w-full text-left rounded-lg border transition-all duration-200`,k[v].container,h===`card`&&[`bg-card hover:bg-accent/50`,n&&`border-primary ring-2 ring-primary/20 bg-primary/5`,!n&&`border-border hover:border-primary/50`],h===`radio`&&[`bg-transparent hover:bg-accent/30`,n&&`border-primary`,!n&&`border-border`],S&&`opacity-50 cursor-not-allowed`,!S&&`cursor-pointer`),children:(0,i.jsxs)(`div`,{className:t.cn(`flex items-center`,k[v].gap),children:[h===`radio`&&I(n),(0,i.jsx)(p,{type:e.type,brand:e.brand,className:k[v].icon}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`div`,{className:t.cn(`font-medium truncate`,k[v].text),children:e.label||g(e)}),(0,i.jsx)(`div`,{className:t.cn(`text-muted-foreground`,k[v].subtext),children:_(e)})]}),e.isDefault&&(0,i.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-medium bg-primary/10 text-primary rounded-full`,children:`Default`}),h===`card`&&L(n),d&&u&&(0,i.jsx)(`button`,{type:`button`,onClick:t=>N(t,e.id),className:t.cn(`opacity-0 group-hover:opacity-100 p-1.5 rounded-md transition-all duration-200`,`text-muted-foreground hover:text-destructive hover:bg-destructive/10`),"aria-label":`Delete ${e.label||`payment method`}`,children:(0,i.jsx)(r.Trash2,{className:`h-4 w-4`})})]})},e.id)};return(0,i.jsxs)(`div`,{className:t.cn(`w-full`,C),children:[w&&(0,i.jsxs)(`label`,{className:`block text-sm font-medium mb-2`,children:[w,E&&(0,i.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,i.jsxs)(`div`,{className:t.cn(y===`list`&&`space-y-3`,y===`grid`&&t.cn(`grid gap-3`,A[b])),role:`radiogroup`,"aria-label":w||`Payment method selection`,children:[o.length>0&&!s.length&&(0,i.jsx)(i.Fragment,{children:o.map(R)}),s.map(e=>{let n=P(e.type),a=F(e.type),o=D===e.type;return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>{n.length>0?O(o?null:e.type):j(e.type,e)},disabled:S||e.disabled,className:t.cn(`group relative w-full text-left rounded-lg border transition-all duration-200`,k[v].container,h===`card`&&[`bg-card hover:bg-accent/50`,a&&`border-primary ring-2 ring-primary/20 bg-primary/5`,!a&&`border-border hover:border-primary/50`],h===`radio`&&[`bg-transparent hover:bg-accent/30`,a&&`border-primary`,!a&&`border-border`],(S||e.disabled)&&`opacity-50 cursor-not-allowed`,!(S||e.disabled)&&`cursor-pointer`),children:(0,i.jsxs)(`div`,{className:t.cn(`flex items-center`,k[v].gap),children:[h===`radio`&&I(a),(0,i.jsx)(p,{type:e.type,className:k[v].icon}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`div`,{className:t.cn(`font-medium`,k[v].text),children:e.label}),e.description&&(0,i.jsx)(`div`,{className:t.cn(`text-muted-foreground`,k[v].subtext),children:e.description})]}),e.type===`credit_card`&&x&&e.acceptedBrands&&(0,i.jsx)(m,{brands:e.acceptedBrands}),h===`card`&&n.length===0&&L(a),n.length>0&&(0,i.jsxs)(`span`,{className:t.cn(`px-2 py-0.5 text-xs font-medium rounded-full`,`bg-muted text-muted-foreground`),children:[n.length,` saved`]})]})}),o&&n.length>0&&(0,i.jsxs)(`div`,{className:`ml-4 pl-4 border-l-2 border-muted space-y-2 animate-in slide-in-from-top-2 duration-200`,children:[n.map(R),c&&(0,i.jsxs)(`button`,{type:`button`,onClick:()=>M(e.type),disabled:S,className:t.cn(`w-full flex items-center gap-3 p-3 rounded-lg border border-dashed`,`text-muted-foreground hover:text-foreground hover:border-primary/50`,`transition-all duration-200`,S&&`opacity-50 cursor-not-allowed`),children:[(0,i.jsx)(r.Plus,{className:`h-5 w-5`}),(0,i.jsxs)(`span`,{className:k[v].subtext,children:[`Add new `,e.label.toLowerCase()]})]})]})]},e.type)}),c&&!s.length&&(0,i.jsxs)(`button`,{type:`button`,onClick:()=>M(`credit_card`),disabled:S,className:t.cn(`w-full flex items-center justify-center gap-3 rounded-lg border-2 border-dashed`,k[v].container,`text-muted-foreground hover:text-foreground hover:border-primary/50`,`transition-all duration-200`,S&&`opacity-50 cursor-not-allowed`),children:[(0,i.jsx)(r.Plus,{className:`h-5 w-5`}),(0,i.jsx)(`span`,{className:t.cn(`font-medium`,k[v].text),children:`Add Payment Method`})]})]}),T&&(0,i.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:T})]})}function g(e){switch(e.type){case`credit_card`:let t=e.brand?e.brand.charAt(0).toUpperCase()+e.brand.slice(1):`Card`;return e.last4?`${t} ending in ${e.last4}`:t;case`paypal`:return e.email||`PayPal`;case`apple_pay`:return`Apple Pay`;case`google_pay`:return`Google Pay`;case`bank_transfer`:return e.bankName||`Bank Account`;default:return`Payment Method`}}function _(e){switch(e.type){case`credit_card`:return e.expiryDate?`Expires ${e.expiryDate}`:e.last4?`**** **** **** ${e.last4}`:``;case`paypal`:return e.email||``;case`bank_transfer`:return e.last4?`Account ending in ${e.last4}`:``;default:return``}}function v(e){return(0,i.jsx)(h,{variant:`card`,layout:`grid`,columns:2,...e})}function y(e){return(0,i.jsx)(h,{variant:`radio`,layout:`list`,...e})}function b(e){return(0,i.jsx)(h,{variant:`radio`,size:`sm`,...e})}function x(e=[],t=f){let[r,i]=n.useState(e.find(e=>e.isDefault)?.id||e[0]?.id),[a,o]=n.useState(e);return{value:r,onChange:i,selectedMethod:n.useMemo(()=>{let e=a.find(e=>e.id===r);if(e)return e;let n=t.find(e=>e.type===r);if(n)return{type:n.type,id:n.type}},[r,a,t]),methods:a,addMethod:n.useCallback(e=>{o(t=>[...t,e]),i(e.id)},[]),removeMethod:n.useCallback(e=>{o(t=>t.filter(t=>t.id!==e)),r===e&&i(a[0]?.id)},[r,a]),setDefault:n.useCallback(e=>{o(t=>t.map(t=>({...t,isDefault:t.id===e})))},[]),options:t}}exports.WakaPaymentMethodPickerCards=v,exports.WakaPaymentMethodPickerCompact=b,exports.WakaPaymentMethodPickerRadio=y,exports.default=h,exports.usePaymentMethodPicker=x;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#1A1F71`}),(0,i.jsx)(`path`,{d:`M19.5 21H17L18.8 11H21.3L19.5 21ZM15.1 11L12.7 18L12.4 16.5L11.5 12C11.5 12 11.4 11 10 11H6.1L6 11.2C6 11.2 7.5 11.5 9.3 12.6L11.5 21H14.1L17.9 11H15.1ZM35 21H37.3L35.3 11H33.2C32.1 11 31.8 11.9 31.8 11.9L28 21H30.6L31.1 19.5H34.3L35 21ZM31.9 17.5L33.3 13.5L34.1 17.5H31.9ZM28.4 13.5L28.7 11.8C28.7 11.8 27.3 11.2 25.8 11.2C24.2 11.2 21.4 11.9 21.4 14.5C21.4 17 24.9 17 24.9 18.3C24.9 19.6 21.7 19.3 20.4 18.3L20.1 20.1C20.1 20.1 21.5 20.8 23.5 20.8C25.5 20.8 27.6 19.7 27.6 17.3C27.6 14.8 24 14.5 24 13.4C24 12.3 26.5 12.4 27.7 13.1L28.4 13.5Z`,fill:`white`})]}),o=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#252525`}),(0,i.jsx)(`circle`,{cx:`19`,cy:`16`,r:`9`,fill:`#EB001B`}),(0,i.jsx)(`circle`,{cx:`29`,cy:`16`,r:`9`,fill:`#F79E1B`}),(0,i.jsx)(`path`,{d:`M24 9.5C25.9 11 27.1 13.4 27.1 16C27.1 18.6 25.9 21 24 22.5C22.1 21 20.9 18.6 20.9 16C20.9 13.4 22.1 11 24 9.5Z`,fill:`#FF5F00`})]}),s=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#006FCF`}),(0,i.jsx)(`path`,{d:`M10 20V12H14.5L15.5 13.5L16.5 12H35V19.5C35 19.5 34.3 20 33.5 20H23.5L22.5 18.5V20H19V18C19 18 18.5 18.5 17.5 18.5H16.5V20H10ZM11 13V19H13.5L15.5 16L17.5 19H20V15.5L22 19H24L26 15.5V19H28V13H25L23 16.5L21 13H11ZM29 13V19H31V17H33C34.1 17 35 16.1 35 15C35 13.9 34.1 13 33 13H29ZM31 14.5H32.5C32.8 14.5 33 14.7 33 15C33 15.3 32.8 15.5 32.5 15.5H31V14.5Z`,fill:`white`})]}),c=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#003087`}),(0,i.jsx)(`path`,{d:`M19.5 8H25C27.8 8 29.5 9.5 29 12.5C28.5 16 26 17.5 23.5 17.5H21.5L20.5 23H17L19.5 8Z`,fill:`#009CDE`}),(0,i.jsx)(`path`,{d:`M22 10H26.5C28.5 10 29.5 11 29.2 13C28.8 15.5 27 16.5 25 16.5H23.5L22.8 20.5H20L22 10Z`,fill:`white`})]}),l=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#000000`}),(0,i.jsx)(`path`,{d:`M15.5 11.5C16.2 10.6 16.7 9.4 16.5 8.2C15.4 8.3 14.1 9 13.3 9.9C12.6 10.7 12 11.9 12.2 13.1C13.4 13.2 14.7 12.4 15.5 11.5Z`,fill:`white`}),(0,i.jsx)(`path`,{d:`M16.5 13.3C14.9 13.2 13.5 14.2 12.7 14.2C11.9 14.2 10.7 13.4 9.4 13.4C7.7 13.4 6.1 14.4 5.2 16C3.3 19.2 4.7 24 6.5 26.6C7.4 27.9 8.5 29.3 9.9 29.3C11.2 29.2 11.7 28.4 13.3 28.4C14.8 28.4 15.3 29.3 16.7 29.2C18.1 29.2 19.1 27.9 20 26.6C21 25.1 21.4 23.7 21.5 23.6C21.4 23.6 18.4 22.4 18.4 18.9C18.3 16 20.7 14.6 20.8 14.5C19.4 12.5 17.3 12.3 16.5 13.3Z`,fill:`white`,transform:`scale(0.6) translate(12, 1)`}),(0,i.jsx)(`text`,{x:`24`,y:`19`,fill:`white`,fontSize:`8`,fontFamily:`system-ui`,fontWeight:`600`,children:`Pay`})]}),u=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#FFFFFF`,stroke:`#E0E0E0`}),(0,i.jsx)(`path`,{d:`M22.8 16.6V20.4H21.4V10H25.2C26.1 10 26.9 10.3 27.6 10.9C28.3 11.5 28.6 12.3 28.6 13.3C28.6 14.3 28.3 15.1 27.6 15.7C26.9 16.3 26.1 16.6 25.1 16.6H22.8ZM22.8 11.3V15.3H25.2C25.7 15.3 26.2 15.1 26.5 14.7C26.9 14.3 27.1 13.9 27.1 13.3C27.1 12.8 26.9 12.3 26.5 11.9C26.1 11.5 25.7 11.3 25.1 11.3H22.8Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M32.8 13.4C33.9 13.4 34.8 13.7 35.5 14.4C36.2 15.1 36.5 15.9 36.5 17V20.4H35.1V19.3H35C34.4 20.2 33.6 20.6 32.5 20.6C31.6 20.6 30.8 20.3 30.2 19.8C29.6 19.3 29.3 18.6 29.3 17.8C29.3 17 29.6 16.3 30.3 15.8C30.9 15.3 31.8 15 32.9 15C33.8 15 34.6 15.2 35.1 15.5V15.2C35.1 14.7 34.9 14.2 34.5 13.9C34.1 13.5 33.6 13.3 33 13.3C32.1 13.3 31.5 13.7 31 14.4L29.8 13.7C30.5 12.8 31.5 13.4 32.8 13.4ZM30.8 17.8C30.8 18.2 31 18.5 31.3 18.8C31.6 19.1 32 19.2 32.5 19.2C33.2 19.2 33.8 19 34.3 18.5C34.8 18 35.1 17.5 35.1 16.9C34.6 16.5 33.9 16.3 33.1 16.3C32.5 16.3 32 16.5 31.6 16.8C31.1 17.1 30.8 17.4 30.8 17.8Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M43 13.6L38.7 23.3H37.2L38.8 19.9L36 13.6H37.6L39.5 18.3L41.4 13.6H43Z`,fill:`#5F6368`}),(0,i.jsx)(`path`,{d:`M16.5 15.5C16.5 15.1 16.5 14.7 16.4 14.3H10.5V16.6H13.9C13.8 17.3 13.4 18 12.7 18.4V19.9H14.7C15.9 18.8 16.5 17.3 16.5 15.5Z`,fill:`#4285F4`}),(0,i.jsx)(`path`,{d:`M10.5 21.3C12.1 21.3 13.5 20.8 14.7 19.9L12.7 18.4C12.1 18.8 11.4 19 10.5 19C9 19 7.7 18 7.2 16.7H5.2V18.2C6.3 20.2 8.3 21.3 10.5 21.3Z`,fill:`#34A853`}),(0,i.jsx)(`path`,{d:`M7.2 16.7C7 16.2 6.9 15.6 6.9 15C6.9 14.4 7 13.8 7.2 13.3V11.8H5.2C4.6 13 4.2 14.4 4.2 15C4.2 15.6 4.6 17 5.2 18.2L7.2 16.7Z`,fill:`#FBBC05`}),(0,i.jsx)(`path`,{d:`M10.5 11C11.5 11 12.4 11.4 13.1 12L14.8 10.3C13.5 9.1 12.1 8.5 10.5 8.5C8.3 8.5 6.3 9.6 5.2 11.8L7.2 13.3C7.7 12 9 11 10.5 11Z`,fill:`#EA4335`})]}),d=({className:e})=>(0,i.jsxs)(`svg`,{viewBox:`0 0 48 32`,className:e,fill:`none`,children:[(0,i.jsx)(`rect`,{width:`48`,height:`32`,rx:`4`,fill:`#1E3A5F`}),(0,i.jsx)(`path`,{d:`M24 7L10 14V16H38V14L24 7Z`,fill:`white`}),(0,i.jsx)(`rect`,{x:`12`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`18`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`27`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`33`,y:`17`,width:`3`,height:`7`,fill:`white`}),(0,i.jsx)(`rect`,{x:`10`,y:`25`,width:`28`,height:`2`,fill:`white`})]}),f=[{type:`credit_card`,label:`Credit or Debit Card`,description:`Pay securely with your card`,acceptedBrands:[`visa`,`mastercard`,`amex`]},{type:`paypal`,label:`PayPal`,description:`Fast and secure payment`},{type:`apple_pay`,label:`Apple Pay`,description:`Pay with Face ID or Touch ID`},{type:`google_pay`,label:`Google Pay`,description:`Fast checkout with Google`},{type:`bank_transfer`,label:`Bank Transfer`,description:`Direct bank payment`}],p=({type:e,brand:n,className:f})=>{let p=t.cn(`h-8 w-12 rounded`,f);if(e===`credit_card`&&n)switch(n){case`visa`:return(0,i.jsx)(a,{className:p});case`mastercard`:return(0,i.jsx)(o,{className:p});case`amex`:return(0,i.jsx)(s,{className:p});default:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)})}switch(e){case`credit_card`:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)});case`paypal`:return(0,i.jsx)(c,{className:p});case`apple_pay`:return(0,i.jsx)(l,{className:p});case`google_pay`:return(0,i.jsx)(u,{className:p});case`bank_transfer`:return(0,i.jsx)(d,{className:p});default:return(0,i.jsx)(r.CreditCard,{className:t.cn(`h-6 w-6 text-muted-foreground`,f)})}},m=({brands:e,className:n})=>(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-1`,n),children:[e.includes(`visa`)&&(0,i.jsx)(a,{className:`h-6 w-9`}),e.includes(`mastercard`)&&(0,i.jsx)(o,{className:`h-6 w-9`}),e.includes(`amex`)&&(0,i.jsx)(s,{className:`h-6 w-9`})]});function h({value:e,onChange:a,savedMethods:o=[],options:s=f,showAddNew:c=!0,onAddNew:l,onDelete:u,allowDelete:d=!0,variant:h=`card`,size:v=`md`,layout:y=`list`,columns:b=2,showBrandIcons:x=!0,disabled:S=!1,className:C,label:w,error:T,required:E=!1}){let[D,O]=n.useState(null),k={sm:{container:`p-3`,text:`text-sm`,subtext:`text-xs`,icon:`h-5 w-8`,gap:`gap-2`},md:{container:`p-4`,text:`text-base`,subtext:`text-sm`,icon:`h-6 w-10`,gap:`gap-3`},lg:{container:`p-5`,text:`text-lg`,subtext:`text-base`,icon:`h-8 w-12`,gap:`gap-4`}},A={1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`},j=(e,t)=>{S||a?.(e,t)},M=e=>{S||l?.(e)},N=(e,t)=>{e.stopPropagation(),!S&&u?.(t)},P=e=>o.filter(t=>t.type===e),F=t=>e===t,I=e=>(0,i.jsx)(`div`,{className:t.cn(`h-5 w-5 rounded-full border-2 flex items-center justify-center transition-all duration-200`,e?`border-primary bg-primary`:`border-muted-foreground/30`),children:e&&(0,i.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary-foreground animate-in zoom-in-50 duration-200`})}),L=e=>(0,i.jsx)(`div`,{className:t.cn(`h-6 w-6 rounded-full flex items-center justify-center transition-all duration-200`,e?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:e&&(0,i.jsx)(r.Check,{className:`h-4 w-4 animate-in zoom-in-50 duration-200`})}),R=e=>{let n=F(e.id);return(0,i.jsx)(`button`,{type:`button`,onClick:()=>j(e.id,e),disabled:S,className:t.cn(`group relative w-full text-left rounded-lg border transition-all duration-200`,k[v].container,h===`card`&&[`bg-card hover:bg-accent/50`,n&&`border-primary ring-2 ring-primary/20 bg-primary/5`,!n&&`border-border hover:border-primary/50`],h===`radio`&&[`bg-transparent hover:bg-accent/30`,n&&`border-primary`,!n&&`border-border`],S&&`opacity-50 cursor-not-allowed`,!S&&`cursor-pointer`),children:(0,i.jsxs)(`div`,{className:t.cn(`flex items-center`,k[v].gap),children:[h===`radio`&&I(n),(0,i.jsx)(p,{type:e.type,brand:e.brand,className:k[v].icon}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`div`,{className:t.cn(`font-medium truncate`,k[v].text),children:e.label||g(e)}),(0,i.jsx)(`div`,{className:t.cn(`text-muted-foreground`,k[v].subtext),children:_(e)})]}),e.isDefault&&(0,i.jsx)(`span`,{className:`px-2 py-0.5 text-xs font-medium bg-primary/10 text-primary rounded-full`,children:`Default`}),h===`card`&&L(n),d&&u&&(0,i.jsx)(`button`,{type:`button`,onClick:t=>N(t,e.id),className:t.cn(`opacity-0 group-hover:opacity-100 p-1.5 rounded-md transition-all duration-200`,`text-muted-foreground hover:text-destructive hover:bg-destructive/10`),"aria-label":`Delete ${e.label||`payment method`}`,children:(0,i.jsx)(r.Trash2,{className:`h-4 w-4`})})]})},e.id)};return(0,i.jsxs)(`div`,{className:t.cn(`w-full`,C),children:[w&&(0,i.jsxs)(`label`,{className:`block text-sm font-medium mb-2`,children:[w,E&&(0,i.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,i.jsxs)(`div`,{className:t.cn(y===`list`&&`space-y-3`,y===`grid`&&t.cn(`grid gap-3`,A[b])),role:`radiogroup`,"aria-label":w||`Payment method selection`,children:[o.length>0&&!s.length&&(0,i.jsx)(i.Fragment,{children:o.map(R)}),s.map(e=>{let n=P(e.type),a=F(e.type),o=D===e.type;return(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>{n.length>0?O(o?null:e.type):j(e.type,e)},disabled:S||e.disabled,className:t.cn(`group relative w-full text-left rounded-lg border transition-all duration-200`,k[v].container,h===`card`&&[`bg-card hover:bg-accent/50`,a&&`border-primary ring-2 ring-primary/20 bg-primary/5`,!a&&`border-border hover:border-primary/50`],h===`radio`&&[`bg-transparent hover:bg-accent/30`,a&&`border-primary`,!a&&`border-border`],(S||e.disabled)&&`opacity-50 cursor-not-allowed`,!(S||e.disabled)&&`cursor-pointer`),children:(0,i.jsxs)(`div`,{className:t.cn(`flex items-center`,k[v].gap),children:[h===`radio`&&I(a),(0,i.jsx)(p,{type:e.type,className:k[v].icon}),(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsx)(`div`,{className:t.cn(`font-medium`,k[v].text),children:e.label}),e.description&&(0,i.jsx)(`div`,{className:t.cn(`text-muted-foreground`,k[v].subtext),children:e.description})]}),e.type===`credit_card`&&x&&e.acceptedBrands&&(0,i.jsx)(m,{brands:e.acceptedBrands}),h===`card`&&n.length===0&&L(a),n.length>0&&(0,i.jsxs)(`span`,{className:t.cn(`px-2 py-0.5 text-xs font-medium rounded-full`,`bg-muted text-muted-foreground`),children:[n.length,` saved`]})]})}),o&&n.length>0&&(0,i.jsxs)(`div`,{className:`ml-4 pl-4 border-l-2 border-muted space-y-2 animate-in slide-in-from-top-2 duration-200`,children:[n.map(R),c&&(0,i.jsxs)(`button`,{type:`button`,onClick:()=>M(e.type),disabled:S,className:t.cn(`w-full flex items-center gap-3 p-3 rounded-lg border border-dashed`,`text-muted-foreground hover:text-foreground hover:border-primary/50`,`transition-all duration-200`,S&&`opacity-50 cursor-not-allowed`),children:[(0,i.jsx)(r.Plus,{className:`h-5 w-5`}),(0,i.jsxs)(`span`,{className:k[v].subtext,children:[`Add new `,e.label.toLowerCase()]})]})]})]},e.type)}),c&&!s.length&&(0,i.jsxs)(`button`,{type:`button`,onClick:()=>M(`credit_card`),disabled:S,className:t.cn(`w-full flex items-center justify-center gap-3 rounded-lg border-2 border-dashed`,k[v].container,`text-muted-foreground hover:text-foreground hover:border-primary/50`,`transition-all duration-200`,S&&`opacity-50 cursor-not-allowed`),children:[(0,i.jsx)(r.Plus,{className:`h-5 w-5`}),(0,i.jsx)(`span`,{className:t.cn(`font-medium`,k[v].text),children:`Add Payment Method`})]})]}),T&&(0,i.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:T})]})}function g(e){switch(e.type){case`credit_card`:let t=e.brand?e.brand.charAt(0).toUpperCase()+e.brand.slice(1):`Card`;return e.last4?`${t} ending in ${e.last4}`:t;case`paypal`:return e.email||`PayPal`;case`apple_pay`:return`Apple Pay`;case`google_pay`:return`Google Pay`;case`bank_transfer`:return e.bankName||`Bank Account`;default:return`Payment Method`}}function _(e){switch(e.type){case`credit_card`:return e.expiryDate?`Expires ${e.expiryDate}`:e.last4?`**** **** **** ${e.last4}`:``;case`paypal`:return e.email||``;case`bank_transfer`:return e.last4?`Account ending in ${e.last4}`:``;default:return``}}function v(e){return(0,i.jsx)(h,{variant:`card`,layout:`grid`,columns:2,...e})}function y(e){return(0,i.jsx)(h,{variant:`radio`,layout:`list`,...e})}function b(e){return(0,i.jsx)(h,{variant:`radio`,size:`sm`,...e})}function x(e=[],t=f){let[r,i]=n.useState(e.find(e=>e.isDefault)?.id||e[0]?.id),[a,o]=n.useState(e);return{value:r,onChange:i,selectedMethod:n.useMemo(()=>{let e=a.find(e=>e.id===r);if(e)return e;let n=t.find(e=>e.type===r);if(n)return{type:n.type,id:n.type}},[r,a,t]),methods:a,addMethod:n.useCallback(e=>{o(t=>[...t,e]),i(e.id)},[]),removeMethod:n.useCallback(e=>{o(t=>t.filter(t=>t.id!==e)),r===e&&i(a[0]?.id)},[r,a]),setDefault:n.useCallback(e=>{o(t=>t.map(t=>({...t,isDefault:t.id===e})))},[]),options:t}}exports.WakaPaymentMethodPicker=h,exports.default=h,exports.WakaPaymentMethodPickerCards=v,exports.WakaPaymentMethodPickerCompact=b,exports.WakaPaymentMethodPickerRadio=y,exports.usePaymentMethodPicker=x;
@@ -517,4 +517,4 @@ function T(e = [], n = g) {
517
517
  };
518
518
  }
519
519
  //#endregion
520
- export { S as WakaPaymentMethodPickerCards, w as WakaPaymentMethodPickerCompact, C as WakaPaymentMethodPickerRadio, y as default, T as usePaymentMethodPicker };
520
+ export { y as WakaPaymentMethodPicker, y as default, S as WakaPaymentMethodPickerCards, w as WakaPaymentMethodPickerCompact, C as WakaPaymentMethodPickerRadio, T as usePaymentMethodPicker };
@@ -1,4 +1,4 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={sm:{cell:`w-10 h-10`,header:`h-12`,roleHeader:`w-24`,permissionCell:`min-w-[180px]`,text:`text-xs`,icon:`h-3.5 w-3.5`,padding:`p-1`},md:{cell:`w-12 h-12`,header:`h-14`,roleHeader:`w-32`,permissionCell:`min-w-[220px]`,text:`text-sm`,icon:`h-4 w-4`,padding:`p-2`},lg:{cell:`w-14 h-14`,header:`h-16`,roleHeader:`w-40`,permissionCell:`min-w-[260px]`,text:`text-base`,icon:`h-5 w-5`,padding:`p-3`}},o=[`#ef4444`,`#3b82f6`,`#22c55e`,`#a855f7`,`#f59e0b`,`#06b6d4`,`#ec4899`,`#8b5cf6`];function s(e,t){return`${e}:${t}`}function c(e,t){return e.color||o[t%o.length]}function l({roles:e,permissions:t,categories:r,initialValues:i=[],onPermissionChange:a}){let[o,c]=n.useState(()=>{let e=new Map;return i.forEach(t=>{if(!t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),e}),[l]=n.useState(()=>{let e=new Map;return i.forEach(t=>{if(t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),e}),[u,d]=n.useState(``),[f,p]=n.useState(new Set),[m,h]=n.useState([]),[g,_]=n.useState(`none`),v=n.useRef(i),y=n.useCallback((e,t,n)=>{let r=s(e,t);c(e=>{let t=new Map(e);return t.set(r,n),t}),a?.(e,t,n)},[a]),b=n.useCallback((e,t)=>{let n=s(e,t);return o.has(n)?o.get(n)||!1:l.get(n)||!1},[o,l]),x=n.useCallback((e,t)=>{let n=s(e,t);return!o.has(n)&&l.has(n)},[o,l]),S=n.useCallback((e,t)=>{y(e,t,!b(e,t))},[b,y]),C=n.useCallback(e=>{c(n=>{let r=new Map(n);return t.forEach(t=>{let n=s(e,t.id);r.set(n,!0)}),r})},[t]),w=n.useCallback(e=>{c(n=>{let r=new Map(n);return t.forEach(t=>{let n=s(e,t.id);r.set(n,!1)}),r})},[t]),T=n.useCallback(t=>{c(n=>{let r=new Map(n);return e.forEach(e=>{let n=s(e.id,t);r.set(n,!0)}),r})},[e]),E=n.useCallback(t=>{c(n=>{let r=new Map(n);return e.forEach(e=>{let n=s(e.id,t);r.set(n,!1)}),r})},[e]),D=n.useCallback(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=n.useCallback(()=>{p(new Set)},[]),k=n.useCallback(()=>{p(new Set(r.map(e=>e.id)))},[r]),A=n.useCallback(e=>{h(t=>t.includes(e)?t:t.length>=2?[t[1],e]:[...t,e])},[]),j=n.useCallback(e=>{h(t=>t.filter(t=>t!==e))},[]),M=n.useCallback(()=>{h([]),_(`none`)},[]),N=n.useMemo(()=>{if(!u.trim())return t;let e=u.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))},[t,u]);return{values:o,inheritedValues:l,setPermission:y,getPermission:b,isInherited:x,togglePermission:S,enableAllForRole:C,disableAllForRole:w,enableForAllRoles:T,disableForAllRoles:E,searchQuery:u,setSearchQuery:d,collapsedCategories:f,toggleCategory:D,expandAll:O,collapseAll:k,compareRoles:m,setCompareRoles:h,addToComparison:A,removeFromComparison:j,clearComparison:M,compareMode:g,setCompareMode:_,filteredPermissions:N,groupedPermissions:n.useMemo(()=>{let e=new Map;return r.forEach(t=>{e.set(t.id,[])}),N.forEach(t=>{let n=e.get(t.categoryId)||[];e.set(t.categoryId,[...n,t])}),e},[N,r]),exportValues:n.useCallback(()=>{let e=[];return o.forEach((t,n)=>{let[r,i]=n.split(`:`);e.push({roleId:r,permissionId:i,granted:t})}),l.forEach((t,n)=>{let[r,i]=n.split(`:`);e.push({roleId:r,permissionId:i,granted:t,inherited:!0})}),e},[o,l]),importValues:n.useCallback(e=>{let t=new Map;e.forEach(e=>{if(!e.inherited){let n=s(e.roleId,e.permissionId);t.set(n,e.granted)}}),c(t)},[]),reset:n.useCallback(()=>{let e=new Map;v.current.forEach(t=>{if(!t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),c(e)},[]),copyRolePermissions:n.useCallback((e,n)=>{c(r=>{let i=new Map(r);return t.forEach(t=>{let a=s(e,t.id),o=s(n,t.id),c=r.get(a)||l.get(a)||!1;i.set(o,c)}),i})},[t,l]),getRolePermissionCount:n.useCallback(e=>{let n=0;return t.forEach(t=>{b(e,t.id)&&n++}),{granted:n,total:t.length}},[t,b]),getCategoryPermissionCount:n.useCallback((e,n)=>{let r=t.filter(e=>e.categoryId===n),i=0;return r.forEach(t=>{b(e,t.id)&&i++}),{granted:i,total:r.length}},[t,b]),rolesDiffer:n.useCallback((e,t,n)=>b(e,n)!==b(t,n),[b])}}function u({granted:e,inherited:n,readOnly:o,highlighted:s,size:c,onToggle:l}){let u=a[c];return(0,i.jsxs)(`div`,{className:t.cn(`relative flex items-center justify-center border border-border/50 transition-all duration-200`,u.cell,u.padding,!o&&!n&&`cursor-pointer hover:bg-accent/50`,n&&`bg-muted/30`,s&&`ring-2 ring-amber-400 ring-inset`,e?n?`bg-green-50 dark:bg-green-950/30`:`bg-green-100 dark:bg-green-900/40`:`bg-background`),onClick:!o&&!n?l:void 0,title:n?`Inherited permission (read-only)`:o?`Read-only`:e?`Click to revoke`:`Click to grant`,children:[e?(0,i.jsx)(r.Check,{className:t.cn(u.icon,n?`text-green-400 dark:text-green-600`:`text-green-600 dark:text-green-400`)}):(0,i.jsx)(r.X,{className:t.cn(u.icon,`text-muted-foreground/40`)}),n&&(0,i.jsx)(`div`,{className:`absolute -top-0.5 -right-0.5`,children:(0,i.jsx)(r.GitBranch,{className:`h-3 w-3 text-amber-500`})}),o&&!n&&(0,i.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5`,children:(0,i.jsx)(r.Lock,{className:`h-2.5 w-2.5 text-muted-foreground/50`})})]})}function d({category:e,isCollapsed:n,roleCount:o,showIcon:s,size:c,onToggle:l}){let u=a[c];return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 bg-muted/50 border-y border-border cursor-pointer hover:bg-muted/70 transition-colors`,u.padding,u.text),onClick:l,style:{gridColumn:`span ${o+1}`},children:[n?(0,i.jsx)(r.ChevronRight,{className:u.icon}):(0,i.jsx)(r.ChevronDown,{className:u.icon}),s&&e.icon&&(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,i.jsx)(`span`,{className:`font-semibold`,children:e.name}),e.description&&(0,i.jsxs)(`span`,{className:`text-muted-foreground ml-2 hidden sm:inline`,children:[`- `,e.description]})]})}function f({role:e,color:o,size:s,showBulkActions:c,readOnly:l,isComparing:u,permissionCount:d,onEnableAll:f,onDisableAll:p,onCompareToggle:m}){let h=a[s],[g,_]=n.useState(!1);return(0,i.jsxs)(`div`,{className:t.cn(`relative flex flex-col items-center justify-center border-b border-border bg-background`,h.header,h.padding,u&&`ring-2 ring-inset`,`min-w-[80px]`),style:{borderTopColor:o,borderTopWidth:3,...u&&{boxShadow:`inset 0 0 0 2px ${o}`}},children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(r.Users,{className:t.cn(h.icon,`text-muted-foreground`)}),(0,i.jsx)(`span`,{className:t.cn(h.text,`font-semibold truncate max-w-[100px]`),title:e.name,children:e.name})]}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d.granted,`/`,d.total]}),c&&!l&&(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>_(!g),className:`p-1 rounded hover:bg-muted transition-colors`,children:(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`})}),g&&(0,i.jsxs)(`div`,{className:`absolute top-full right-0 mt-1 z-20 bg-popover border rounded-lg shadow-lg p-1 min-w-[120px]`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{f(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.CheckSquare,{className:`h-3.5 w-3.5`}),`Enable All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{p(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Square,{className:`h-3.5 w-3.5`}),`Disable All`]}),(0,i.jsx)(`hr`,{className:`my-1 border-border`}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{m(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Eye,{className:`h-3.5 w-3.5`}),u?`Remove from Compare`:`Compare`]})]})]}),g&&(0,i.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>_(!1)})]})}function p({permission:e,roles:o,size:s,readOnly:c,showBulkActions:l,compareRoles:d,compareMode:f,getPermission:p,isInherited:m,togglePermission:h,enableForAllRoles:g,disableForAllRoles:_,rolesDiffer:v,getRoleColor:y}){let b=a[s],[x,S]=n.useState(!1),C=f===`highlight-diff`&&d.length===2&&v(d[0],d[1],e.id);return(0,i.jsxs)(`div`,{className:`contents group`,children:[(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 bg-background border-b border-r border-border`,b.permissionCell,b.padding,b.text,`sticky left-0 z-10`),children:[(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),e.inherited&&(0,i.jsx)(`span`,{title:`Inherited permission`,children:(0,i.jsx)(r.GitBranch,{className:`h-3 w-3 text-amber-500 flex-shrink-0`})})]}),e.description&&(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),l&&!c&&(0,i.jsxs)(`div`,{className:`relative opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>S(!x),className:`p-1 rounded hover:bg-muted transition-colors`,children:(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`})}),x&&(0,i.jsxs)(`div`,{className:`absolute top-full left-0 mt-1 z-20 bg-popover border rounded-lg shadow-lg p-1 min-w-[120px]`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),S(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.CheckSquare,{className:`h-3.5 w-3.5`}),`Grant All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{_(e.id),S(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Square,{className:`h-3.5 w-3.5`}),`Revoke All`]})]}),x&&(0,i.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>S(!1)})]})]}),o.map((t,n)=>{let r=p(t.id,e.id),a=m(t.id,e.id),o=d.includes(t.id);return(0,i.jsx)(u,{granted:r,inherited:a,readOnly:c,highlighted:C&&o,size:s,onToggle:()=>h(t.id,e.id)},`${e.id}-${t.id}`)})]})}function m({roles:e,permissions:o,categories:s,initialValues:u=[],readOnly:m=!1,enableComparison:h=!0,enableBulkOperations:g=!0,enableSearch:_=!0,showInheritance:v=!0,showCategoryIcons:y=!0,collapsibleCategories:b=!0,stickyHeader:x=!0,cellSize:S=`md`,onPermissionChange:C,onBulkChange:w,onSave:T,className:E}){let D=l({roles:e,permissions:o,categories:s,initialValues:u,onPermissionChange:C}),O=a[S],k=n.useMemo(()=>[...s].sort((e,t)=>(e.order||0)-(t.order||0)),[s]),A=n.useMemo(()=>[...e].sort((e,t)=>(e.order||0)-(t.order||0)),[e]);return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,E),children:[_&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,i.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,i.jsx)(r.Search,{className:t.cn(O.icon,`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`)}),(0,i.jsx)(`input`,{type:`text`,placeholder:`Search permissions...`,value:D.searchQuery,onChange:e=>D.setSearchQuery(e.target.value),className:t.cn(`w-full pl-10 pr-4 py-2 border border-border rounded-lg bg-background`,O.text,`focus:outline-none focus:ring-2 focus:ring-primary/50`)}),D.searchQuery&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>D.setSearchQuery(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,i.jsx)(r.X,{className:O.icon})})]}),b&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:D.expandAll,className:t.cn(`flex items-center gap-1 px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:[(0,i.jsx)(r.ChevronDown,{className:O.icon}),`Expand All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:D.collapseAll,className:t.cn(`flex items-center gap-1 px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:[(0,i.jsx)(r.ChevronRight,{className:O.icon}),`Collapse All`]})]}),h&&D.compareRoles.length===2&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t.cn(O.text,`text-muted-foreground`),children:`Compare:`}),(0,i.jsx)(`div`,{className:`flex rounded-lg border border-border overflow-hidden`,children:[`none`,`highlight-diff`].map(e=>(0,i.jsx)(`button`,{type:`button`,onClick:()=>D.setCompareMode(e),className:t.cn(`px-3 py-1.5 transition-colors`,O.text,D.compareMode===e?`bg-primary text-primary-foreground`:`bg-background hover:bg-muted`),children:e===`none`?`Off`:`Highlight Diff`},e))}),(0,i.jsx)(`button`,{type:`button`,onClick:D.clearComparison,className:t.cn(`px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:`Clear`})]})]}),v&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 text-sm text-muted-foreground`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-green-100 dark:bg-green-900/40 rounded border border-border/50`,children:(0,i.jsx)(r.Check,{className:`h-3.5 w-3.5 text-green-600 dark:text-green-400`})}),(0,i.jsx)(`span`,{children:`Granted`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-green-50 dark:bg-green-950/30 rounded border border-border/50`,children:(0,i.jsx)(r.Check,{className:`h-3.5 w-3.5 text-green-400 dark:text-green-600`})}),(0,i.jsx)(`span`,{children:`Inherited`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-background rounded border border-border/50`,children:(0,i.jsx)(r.X,{className:`h-3.5 w-3.5 text-muted-foreground/40`})}),(0,i.jsx)(`span`,{children:`Not granted`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.GitBranch,{className:`h-4 w-4 text-amber-500`}),(0,i.jsx)(`span`,{children:`Inherited indicator`})]})]}),(0,i.jsx)(`div`,{className:`overflow-auto rounded-lg border border-border`,children:(0,i.jsxs)(`div`,{className:`grid min-w-max`,style:{gridTemplateColumns:`${O.permissionCell} repeat(${A.length}, ${O.cell.split(` `)[0].replace(`w-`,`minmax(`)}, 1fr))`},children:[(0,i.jsxs)(`div`,{className:t.cn(`flex items-center justify-center bg-muted/50 border-b border-r border-border font-semibold`,O.header,O.padding,O.text,x&&`sticky top-0 left-0 z-30`),children:[(0,i.jsx)(r.Shield,{className:t.cn(O.icon,`mr-2`)}),`Permissions`]}),A.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(x&&`sticky top-0 z-20`),children:(0,i.jsx)(f,{role:e,color:c(e,n),size:S,showBulkActions:g,readOnly:m,isComparing:D.compareRoles.includes(e.id),permissionCount:D.getRolePermissionCount(e.id),onEnableAll:()=>D.enableAllForRole(e.id),onDisableAll:()=>D.disableAllForRole(e.id),onCompareToggle:()=>{D.compareRoles.includes(e.id)?D.removeFromComparison(e.id):D.addToComparison(e.id)}})},e.id)),k.map(e=>{let t=D.groupedPermissions.get(e.id)||[],r=D.collapsedCategories.has(e.id);return t.length===0?null:(0,i.jsxs)(n.Fragment,{children:[b&&(0,i.jsx)(d,{category:e,isCollapsed:r,roleCount:A.length,showIcon:y,size:S,onToggle:()=>D.toggleCategory(e.id)}),!r&&t.map(e=>(0,i.jsx)(p,{permission:e,roles:A,size:S,readOnly:m,showBulkActions:g,compareRoles:D.compareRoles,compareMode:D.compareMode,getPermission:D.getPermission,isInherited:D.isInherited,togglePermission:D.togglePermission,enableForAllRoles:D.enableForAllRoles,disableForAllRoles:D.disableForAllRoles,rolesDiffer:D.rolesDiffer,getRoleColor:c},e.id))]},e.id)})]})}),!m&&T&&(0,i.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:D.reset,className:t.cn(`px-4 py-2 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:`Reset`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{T?.(D.exportValues())},className:t.cn(`px-4 py-2 rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,O.text),children:`Save Permissions`})]}),(0,i.jsx)(`style`,{children:`
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={sm:{cell:`w-10 h-10`,header:`h-12`,roleHeader:`w-24`,permissionCell:`min-w-[180px]`,text:`text-xs`,icon:`h-3.5 w-3.5`,padding:`p-1`},md:{cell:`w-12 h-12`,header:`h-14`,roleHeader:`w-32`,permissionCell:`min-w-[220px]`,text:`text-sm`,icon:`h-4 w-4`,padding:`p-2`},lg:{cell:`w-14 h-14`,header:`h-16`,roleHeader:`w-40`,permissionCell:`min-w-[260px]`,text:`text-base`,icon:`h-5 w-5`,padding:`p-3`}},o=[`#ef4444`,`#3b82f6`,`#22c55e`,`#a855f7`,`#f59e0b`,`#06b6d4`,`#ec4899`,`#8b5cf6`];function s(e,t){return`${e}:${t}`}function c(e,t){return e.color||o[t%o.length]}function l({roles:e,permissions:t,categories:r,initialValues:i=[],onPermissionChange:a}){let[o,c]=n.useState(()=>{let e=new Map;return i.forEach(t=>{if(!t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),e}),[l]=n.useState(()=>{let e=new Map;return i.forEach(t=>{if(t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),e}),[u,d]=n.useState(``),[f,p]=n.useState(new Set),[m,h]=n.useState([]),[g,_]=n.useState(`none`),v=n.useRef(i),y=n.useCallback((e,t,n)=>{let r=s(e,t);c(e=>{let t=new Map(e);return t.set(r,n),t}),a?.(e,t,n)},[a]),b=n.useCallback((e,t)=>{let n=s(e,t);return o.has(n)?o.get(n)||!1:l.get(n)||!1},[o,l]),x=n.useCallback((e,t)=>{let n=s(e,t);return!o.has(n)&&l.has(n)},[o,l]),S=n.useCallback((e,t)=>{let n=b(e,t);y(e,t,!n)},[b,y]),C=n.useCallback(e=>{c(n=>{let r=new Map(n);return t.forEach(t=>{let n=s(e,t.id);r.set(n,!0)}),r})},[t]),w=n.useCallback(e=>{c(n=>{let r=new Map(n);return t.forEach(t=>{let n=s(e,t.id);r.set(n,!1)}),r})},[t]),T=n.useCallback(t=>{c(n=>{let r=new Map(n);return e.forEach(e=>{let n=s(e.id,t);r.set(n,!0)}),r})},[e]),E=n.useCallback(t=>{c(n=>{let r=new Map(n);return e.forEach(e=>{let n=s(e.id,t);r.set(n,!1)}),r})},[e]),D=n.useCallback(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=n.useCallback(()=>{p(new Set)},[]),k=n.useCallback(()=>{p(new Set(r.map(e=>e.id)))},[r]),A=n.useCallback(e=>{h(t=>t.includes(e)?t:t.length>=2?[t[1],e]:[...t,e])},[]),j=n.useCallback(e=>{h(t=>t.filter(t=>t!==e))},[]),M=n.useCallback(()=>{h([]),_(`none`)},[]),N=n.useMemo(()=>{if(!u.trim())return t;let e=u.toLowerCase();return t.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))},[t,u]);return{values:o,inheritedValues:l,setPermission:y,getPermission:b,isInherited:x,togglePermission:S,enableAllForRole:C,disableAllForRole:w,enableForAllRoles:T,disableForAllRoles:E,searchQuery:u,setSearchQuery:d,collapsedCategories:f,toggleCategory:D,expandAll:O,collapseAll:k,compareRoles:m,setCompareRoles:h,addToComparison:A,removeFromComparison:j,clearComparison:M,compareMode:g,setCompareMode:_,filteredPermissions:N,groupedPermissions:n.useMemo(()=>{let e=new Map;return r.forEach(t=>{e.set(t.id,[])}),N.forEach(t=>{let n=e.get(t.categoryId)||[];e.set(t.categoryId,[...n,t])}),e},[N,r]),exportValues:n.useCallback(()=>{let e=[];return o.forEach((t,n)=>{let[r,i]=n.split(`:`);e.push({roleId:r,permissionId:i,granted:t})}),l.forEach((t,n)=>{let[r,i]=n.split(`:`);e.push({roleId:r,permissionId:i,granted:t,inherited:!0})}),e},[o,l]),importValues:n.useCallback(e=>{let t=new Map;e.forEach(e=>{if(!e.inherited){let n=s(e.roleId,e.permissionId);t.set(n,e.granted)}}),c(t)},[]),reset:n.useCallback(()=>{let e=new Map;v.current.forEach(t=>{if(!t.inherited){let n=s(t.roleId,t.permissionId);e.set(n,t.granted)}}),c(e)},[]),copyRolePermissions:n.useCallback((e,n)=>{c(r=>{let i=new Map(r);return t.forEach(t=>{let a=s(e,t.id),o=s(n,t.id),c=r.get(a)||l.get(a)||!1;i.set(o,c)}),i})},[t,l]),getRolePermissionCount:n.useCallback(e=>{let n=0;return t.forEach(t=>{b(e,t.id)&&n++}),{granted:n,total:t.length}},[t,b]),getCategoryPermissionCount:n.useCallback((e,n)=>{let r=t.filter(e=>e.categoryId===n),i=0;return r.forEach(t=>{b(e,t.id)&&i++}),{granted:i,total:r.length}},[t,b]),rolesDiffer:n.useCallback((e,t,n)=>b(e,n)!==b(t,n),[b])}}function u({granted:e,inherited:n,readOnly:o,highlighted:s,size:c,onToggle:l}){let u=a[c];return(0,i.jsxs)(`div`,{className:t.cn(`relative flex items-center justify-center border border-border/50 transition-all duration-200`,u.cell,u.padding,!o&&!n&&`cursor-pointer hover:bg-accent/50`,n&&`bg-muted/30`,s&&`ring-2 ring-amber-400 ring-inset`,e?n?`bg-green-50 dark:bg-green-950/30`:`bg-green-100 dark:bg-green-900/40`:`bg-background`),onClick:!o&&!n?l:void 0,title:n?`Inherited permission (read-only)`:o?`Read-only`:e?`Click to revoke`:`Click to grant`,children:[e?(0,i.jsx)(r.Check,{className:t.cn(u.icon,n?`text-green-400 dark:text-green-600`:`text-green-600 dark:text-green-400`)}):(0,i.jsx)(r.X,{className:t.cn(u.icon,`text-muted-foreground/40`)}),n&&(0,i.jsx)(`div`,{className:`absolute -top-0.5 -right-0.5`,children:(0,i.jsx)(r.GitBranch,{className:`h-3 w-3 text-amber-500`})}),o&&!n&&(0,i.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5`,children:(0,i.jsx)(r.Lock,{className:`h-2.5 w-2.5 text-muted-foreground/50`})})]})}function d({category:e,isCollapsed:n,roleCount:o,showIcon:s,size:c,onToggle:l}){let u=a[c];return(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 bg-muted/50 border-y border-border cursor-pointer hover:bg-muted/70 transition-colors`,u.padding,u.text),onClick:l,style:{gridColumn:`span ${o+1}`},children:[n?(0,i.jsx)(r.ChevronRight,{className:u.icon}):(0,i.jsx)(r.ChevronDown,{className:u.icon}),s&&e.icon&&(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:e.icon}),(0,i.jsx)(`span`,{className:`font-semibold`,children:e.name}),e.description&&(0,i.jsxs)(`span`,{className:`text-muted-foreground ml-2 hidden sm:inline`,children:[`- `,e.description]})]})}function f({role:e,color:o,size:s,showBulkActions:c,readOnly:l,isComparing:u,permissionCount:d,onEnableAll:f,onDisableAll:p,onCompareToggle:m}){let h=a[s],[g,_]=n.useState(!1);return(0,i.jsxs)(`div`,{className:t.cn(`relative flex flex-col items-center justify-center border-b border-border bg-background`,h.header,h.padding,u&&`ring-2 ring-inset`,`min-w-[80px]`),style:{borderTopColor:o,borderTopWidth:3,...u&&{boxShadow:`inset 0 0 0 2px ${o}`}},children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(r.Users,{className:t.cn(h.icon,`text-muted-foreground`)}),(0,i.jsx)(`span`,{className:t.cn(h.text,`font-semibold truncate max-w-[100px]`),title:e.name,children:e.name})]}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[d.granted,`/`,d.total]}),c&&!l&&(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>_(!g),className:`p-1 rounded hover:bg-muted transition-colors`,children:(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`})}),g&&(0,i.jsxs)(`div`,{className:`absolute top-full right-0 mt-1 z-20 bg-popover border rounded-lg shadow-lg p-1 min-w-[120px]`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{f(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.CheckSquare,{className:`h-3.5 w-3.5`}),`Enable All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{p(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Square,{className:`h-3.5 w-3.5`}),`Disable All`]}),(0,i.jsx)(`hr`,{className:`my-1 border-border`}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{m(),_(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Eye,{className:`h-3.5 w-3.5`}),u?`Remove from Compare`:`Compare`]})]})]}),g&&(0,i.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>_(!1)})]})}function p({permission:e,roles:o,size:s,readOnly:c,showBulkActions:l,compareRoles:d,compareMode:f,getPermission:p,isInherited:m,togglePermission:h,enableForAllRoles:g,disableForAllRoles:_,rolesDiffer:v,getRoleColor:y}){let b=a[s],[x,S]=n.useState(!1),C=f===`highlight-diff`&&d.length===2&&v(d[0],d[1],e.id);return(0,i.jsxs)(`div`,{className:`contents group`,children:[(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 bg-background border-b border-r border-border`,b.permissionCell,b.padding,b.text,`sticky left-0 z-10`),children:[(0,i.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`span`,{className:`font-medium truncate`,children:e.name}),e.inherited&&(0,i.jsx)(`span`,{title:`Inherited permission`,children:(0,i.jsx)(r.GitBranch,{className:`h-3 w-3 text-amber-500 flex-shrink-0`})})]}),e.description&&(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:e.description})]}),l&&!c&&(0,i.jsxs)(`div`,{className:`relative opacity-0 group-hover:opacity-100 transition-opacity`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>S(!x),className:`p-1 rounded hover:bg-muted transition-colors`,children:(0,i.jsx)(r.ChevronDown,{className:`h-3 w-3`})}),x&&(0,i.jsxs)(`div`,{className:`absolute top-full left-0 mt-1 z-20 bg-popover border rounded-lg shadow-lg p-1 min-w-[120px]`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{g(e.id),S(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.CheckSquare,{className:`h-3.5 w-3.5`}),`Grant All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{_(e.id),S(!1)},className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm hover:bg-accent rounded transition-colors`,children:[(0,i.jsx)(r.Square,{className:`h-3.5 w-3.5`}),`Revoke All`]})]}),x&&(0,i.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>S(!1)})]})]}),o.map((t,n)=>{let r=p(t.id,e.id),a=m(t.id,e.id),o=d.includes(t.id);return(0,i.jsx)(u,{granted:r,inherited:a,readOnly:c,highlighted:C&&o,size:s,onToggle:()=>h(t.id,e.id)},`${e.id}-${t.id}`)})]})}function m({roles:e,permissions:o,categories:s,initialValues:u=[],readOnly:m=!1,enableComparison:h=!0,enableBulkOperations:g=!0,enableSearch:_=!0,showInheritance:v=!0,showCategoryIcons:y=!0,collapsibleCategories:b=!0,stickyHeader:x=!0,cellSize:S=`md`,onPermissionChange:C,onBulkChange:w,onSave:T,className:E}){let D=l({roles:e,permissions:o,categories:s,initialValues:u,onPermissionChange:C}),O=a[S],k=n.useMemo(()=>[...s].sort((e,t)=>(e.order||0)-(t.order||0)),[s]),A=n.useMemo(()=>[...e].sort((e,t)=>(e.order||0)-(t.order||0)),[e]);return(0,i.jsxs)(`div`,{className:t.cn(`space-y-4`,E),children:[_&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,i.jsxs)(`div`,{className:`relative flex-1 max-w-sm`,children:[(0,i.jsx)(r.Search,{className:t.cn(O.icon,`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`)}),(0,i.jsx)(`input`,{type:`text`,placeholder:`Search permissions...`,value:D.searchQuery,onChange:e=>D.setSearchQuery(e.target.value),className:t.cn(`w-full pl-10 pr-4 py-2 border border-border rounded-lg bg-background`,O.text,`focus:outline-none focus:ring-2 focus:ring-primary/50`)}),D.searchQuery&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>D.setSearchQuery(``),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,i.jsx)(r.X,{className:O.icon})})]}),b&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsxs)(`button`,{type:`button`,onClick:D.expandAll,className:t.cn(`flex items-center gap-1 px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:[(0,i.jsx)(r.ChevronDown,{className:O.icon}),`Expand All`]}),(0,i.jsxs)(`button`,{type:`button`,onClick:D.collapseAll,className:t.cn(`flex items-center gap-1 px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:[(0,i.jsx)(r.ChevronRight,{className:O.icon}),`Collapse All`]})]}),h&&D.compareRoles.length===2&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t.cn(O.text,`text-muted-foreground`),children:`Compare:`}),(0,i.jsx)(`div`,{className:`flex rounded-lg border border-border overflow-hidden`,children:[`none`,`highlight-diff`].map(e=>(0,i.jsx)(`button`,{type:`button`,onClick:()=>D.setCompareMode(e),className:t.cn(`px-3 py-1.5 transition-colors`,O.text,D.compareMode===e?`bg-primary text-primary-foreground`:`bg-background hover:bg-muted`),children:e===`none`?`Off`:`Highlight Diff`},e))}),(0,i.jsx)(`button`,{type:`button`,onClick:D.clearComparison,className:t.cn(`px-3 py-1.5 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:`Clear`})]})]}),v&&(0,i.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 text-sm text-muted-foreground`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-green-100 dark:bg-green-900/40 rounded border border-border/50`,children:(0,i.jsx)(r.Check,{className:`h-3.5 w-3.5 text-green-600 dark:text-green-400`})}),(0,i.jsx)(`span`,{children:`Granted`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-green-50 dark:bg-green-950/30 rounded border border-border/50`,children:(0,i.jsx)(r.Check,{className:`h-3.5 w-3.5 text-green-400 dark:text-green-600`})}),(0,i.jsx)(`span`,{children:`Inherited`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 bg-background rounded border border-border/50`,children:(0,i.jsx)(r.X,{className:`h-3.5 w-3.5 text-muted-foreground/40`})}),(0,i.jsx)(`span`,{children:`Not granted`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.GitBranch,{className:`h-4 w-4 text-amber-500`}),(0,i.jsx)(`span`,{children:`Inherited indicator`})]})]}),(0,i.jsx)(`div`,{className:`overflow-auto rounded-lg border border-border`,children:(0,i.jsxs)(`div`,{className:`grid min-w-max`,style:{gridTemplateColumns:`${O.permissionCell} repeat(${A.length}, ${O.cell.split(` `)[0].replace(`w-`,`minmax(`)}, 1fr))`},children:[(0,i.jsxs)(`div`,{className:t.cn(`flex items-center justify-center bg-muted/50 border-b border-r border-border font-semibold`,O.header,O.padding,O.text,x&&`sticky top-0 left-0 z-30`),children:[(0,i.jsx)(r.Shield,{className:t.cn(O.icon,`mr-2`)}),`Permissions`]}),A.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(x&&`sticky top-0 z-20`),children:(0,i.jsx)(f,{role:e,color:c(e,n),size:S,showBulkActions:g,readOnly:m,isComparing:D.compareRoles.includes(e.id),permissionCount:D.getRolePermissionCount(e.id),onEnableAll:()=>D.enableAllForRole(e.id),onDisableAll:()=>D.disableAllForRole(e.id),onCompareToggle:()=>{D.compareRoles.includes(e.id)?D.removeFromComparison(e.id):D.addToComparison(e.id)}})},e.id)),k.map(e=>{let t=D.groupedPermissions.get(e.id)||[],r=D.collapsedCategories.has(e.id);return t.length===0?null:(0,i.jsxs)(n.Fragment,{children:[b&&(0,i.jsx)(d,{category:e,isCollapsed:r,roleCount:A.length,showIcon:y,size:S,onToggle:()=>D.toggleCategory(e.id)}),!r&&t.map(e=>(0,i.jsx)(p,{permission:e,roles:A,size:S,readOnly:m,showBulkActions:g,compareRoles:D.compareRoles,compareMode:D.compareMode,getPermission:D.getPermission,isInherited:D.isInherited,togglePermission:D.togglePermission,enableForAllRoles:D.enableForAllRoles,disableForAllRoles:D.disableForAllRoles,rolesDiffer:D.rolesDiffer,getRoleColor:c},e.id))]},e.id)})]})}),!m&&T&&(0,i.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:D.reset,className:t.cn(`px-4 py-2 border border-border rounded-lg`,`bg-background hover:bg-muted transition-colors`,O.text),children:`Reset`}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{T?.(D.exportValues())},className:t.cn(`px-4 py-2 rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,O.text),children:`Save Permissions`})]}),(0,i.jsx)(`style`,{children:`
2
2
  @keyframes permission-check {
3
3
  0% { transform: scale(0.8); opacity: 0; }
4
4
  50% { transform: scale(1.2); }
@@ -17,4 +17,4 @@
17
17
  .permission-highlighted {
18
18
  animation: permission-highlight 2s ease-in-out infinite;
19
19
  }
20
- `})]})}exports.default=m,exports.usePermissionMatrix=l;
20
+ `})]})}exports.WakaPermissionMatrix=m,exports.default=m,exports.usePermissionMatrix=l;
@@ -79,7 +79,8 @@ function b({ roles: e, permissions: n, categories: r, initialValues: i = [], onP
79
79
  let n = v(e, t);
80
80
  return !o.has(n) && c.has(n);
81
81
  }, [o, c]), S = t.useCallback((e, t) => {
82
- y(e, t, !b(e, t));
82
+ let n = b(e, t);
83
+ y(e, t, !n);
83
84
  }, [b, y]), C = t.useCallback((e) => {
84
85
  s((t) => {
85
86
  let r = new Map(t);
@@ -593,4 +594,4 @@ function T({ roles: r, permissions: o, categories: c, initialValues: d = [], rea
593
594
  });
594
595
  }
595
596
  //#endregion
596
- export { T as default, b as usePermissionMatrix };
597
+ export { T as WakaPermissionMatrix, T as default, b as usePermissionMatrix };
@@ -1 +1 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`),n=require(`../input/index.cjs.js`),r=require(`../popover/index.cjs.js`);let i=require(`react`);i=e.__toESM(i);let a=require(`lucide-react`),o=require(`react/jsx-runtime`);var s=[{code:`US`,name:`United States`,dialCode:`+1`,flag:`🇺🇸`,format:`(###) ###-####`,priority:1},{code:`GB`,name:`United Kingdom`,dialCode:`+44`,flag:`🇬🇧`,format:`#### ######`,priority:2},{code:`CA`,name:`Canada`,dialCode:`+1`,flag:`🇨🇦`,format:`(###) ###-####`,priority:3},{code:`FR`,name:`France`,dialCode:`+33`,flag:`🇫🇷`,format:`# ## ## ## ##`,priority:4},{code:`DE`,name:`Germany`,dialCode:`+49`,flag:`🇩🇪`,format:`### #######`,priority:5},{code:`AF`,name:`Afghanistan`,dialCode:`+93`,flag:`🇦🇫`,format:`## ### ####`},{code:`AL`,name:`Albania`,dialCode:`+355`,flag:`🇦🇱`,format:`## ### ####`},{code:`DZ`,name:`Algeria`,dialCode:`+213`,flag:`🇩🇿`,format:`### ## ## ##`},{code:`AR`,name:`Argentina`,dialCode:`+54`,flag:`🇦🇷`,format:`## ####-####`},{code:`AU`,name:`Australia`,dialCode:`+61`,flag:`🇦🇺`,format:`### ### ###`},{code:`AT`,name:`Austria`,dialCode:`+43`,flag:`🇦🇹`,format:`### #######`},{code:`BE`,name:`Belgium`,dialCode:`+32`,flag:`🇧🇪`,format:`### ## ## ##`},{code:`BR`,name:`Brazil`,dialCode:`+55`,flag:`🇧🇷`,format:`## #####-####`},{code:`CN`,name:`China`,dialCode:`+86`,flag:`🇨🇳`,format:`### #### ####`},{code:`CO`,name:`Colombia`,dialCode:`+57`,flag:`🇨🇴`,format:`### ### ####`},{code:`HR`,name:`Croatia`,dialCode:`+385`,flag:`🇭🇷`,format:`## ### ####`},{code:`CZ`,name:`Czech Republic`,dialCode:`+420`,flag:`🇨🇿`,format:`### ### ###`},{code:`DK`,name:`Denmark`,dialCode:`+45`,flag:`🇩🇰`,format:`## ## ## ##`},{code:`EG`,name:`Egypt`,dialCode:`+20`,flag:`🇪🇬`,format:`### ### ####`},{code:`FI`,name:`Finland`,dialCode:`+358`,flag:`🇫🇮`,format:`## ### ####`},{code:`GR`,name:`Greece`,dialCode:`+30`,flag:`🇬🇷`,format:`### ### ####`},{code:`HK`,name:`Hong Kong`,dialCode:`+852`,flag:`🇭🇰`,format:`#### ####`},{code:`HU`,name:`Hungary`,dialCode:`+36`,flag:`🇭🇺`,format:`## ### ####`},{code:`IN`,name:`India`,dialCode:`+91`,flag:`🇮🇳`,format:`##### #####`},{code:`ID`,name:`Indonesia`,dialCode:`+62`,flag:`🇮🇩`,format:`### ### ####`},{code:`IE`,name:`Ireland`,dialCode:`+353`,flag:`🇮🇪`,format:`## ### ####`},{code:`IL`,name:`Israel`,dialCode:`+972`,flag:`🇮🇱`,format:`## ### ####`},{code:`IT`,name:`Italy`,dialCode:`+39`,flag:`🇮🇹`,format:`### ### ####`},{code:`JP`,name:`Japan`,dialCode:`+81`,flag:`🇯🇵`,format:`## #### ####`},{code:`KR`,name:`South Korea`,dialCode:`+82`,flag:`🇰🇷`,format:`## #### ####`},{code:`MY`,name:`Malaysia`,dialCode:`+60`,flag:`🇲🇾`,format:`## ### ####`},{code:`MX`,name:`Mexico`,dialCode:`+52`,flag:`🇲🇽`,format:`### ### ####`},{code:`NL`,name:`Netherlands`,dialCode:`+31`,flag:`🇳🇱`,format:`# ## ## ## ##`},{code:`NZ`,name:`New Zealand`,dialCode:`+64`,flag:`🇳🇿`,format:`## ### ####`},{code:`NO`,name:`Norway`,dialCode:`+47`,flag:`🇳🇴`,format:`### ## ###`},{code:`PK`,name:`Pakistan`,dialCode:`+92`,flag:`🇵🇰`,format:`### #######`},{code:`PH`,name:`Philippines`,dialCode:`+63`,flag:`🇵🇭`,format:`### ### ####`},{code:`PL`,name:`Poland`,dialCode:`+48`,flag:`🇵🇱`,format:`### ### ###`},{code:`PT`,name:`Portugal`,dialCode:`+351`,flag:`🇵🇹`,format:`### ### ###`},{code:`RO`,name:`Romania`,dialCode:`+40`,flag:`🇷🇴`,format:`### ### ###`},{code:`RU`,name:`Russia`,dialCode:`+7`,flag:`🇷🇺`,format:`### ###-##-##`},{code:`SA`,name:`Saudi Arabia`,dialCode:`+966`,flag:`🇸🇦`,format:`## ### ####`},{code:`SG`,name:`Singapore`,dialCode:`+65`,flag:`🇸🇬`,format:`#### ####`},{code:`ZA`,name:`South Africa`,dialCode:`+27`,flag:`🇿🇦`,format:`## ### ####`},{code:`ES`,name:`Spain`,dialCode:`+34`,flag:`🇪🇸`,format:`### ### ###`},{code:`SE`,name:`Sweden`,dialCode:`+46`,flag:`🇸🇪`,format:`## ### ## ##`},{code:`CH`,name:`Switzerland`,dialCode:`+41`,flag:`🇨🇭`,format:`## ### ## ##`},{code:`TW`,name:`Taiwan`,dialCode:`+886`,flag:`🇹🇼`,format:`### ### ###`},{code:`TH`,name:`Thailand`,dialCode:`+66`,flag:`🇹🇭`,format:`## ### ####`},{code:`TR`,name:`Turkey`,dialCode:`+90`,flag:`🇹🇷`,format:`### ### ####`},{code:`UA`,name:`Ukraine`,dialCode:`+380`,flag:`🇺🇦`,format:`## ### ####`},{code:`AE`,name:`United Arab Emirates`,dialCode:`+971`,flag:`🇦🇪`,format:`## ### ####`},{code:`VN`,name:`Vietnam`,dialCode:`+84`,flag:`🇻🇳`,format:`## ### ####`}];function c(e,t){if(!t)return e;let n=e.replace(/\D/g,``),r=``,i=0;for(let e=0;e<t.length&&i<n.length;e++)t[e]===`#`?(r+=n[i],i++):r+=t[e];return i<n.length&&(r+=n.slice(i)),r}function l(e){return e.replace(/\D/g,``)}function u(e){return e.format?e.format.replace(/#/g,`0`):``}function d(e,t,n){let r=l(e);if(r.length<6||r.length>15)return!1;if(t.format){let e=(t.format.match(/#/g)||[]).length;if(Math.abs(r.length-e)>2)return!1}return!0}function f(e){return s.find(t=>t.code.toLowerCase()===e.toLowerCase())}function p(e){return s.find(t=>t.dialCode===e)}function m(e,t){let n=t?.map(e=>e.toUpperCase())||[];return[...e].sort((e,t)=>{let r=e.priority||999,i=t.priority||999,a=n.indexOf(e.code),o=n.indexOf(t.code);return a!==-1&&o===-1?-1:a===-1&&o!==-1?1:a!==-1&&o!==-1?a-o:r===i?e.name.localeCompare(t.name):r-i})}function h(e={}){let{initialCountry:t=`US`,initialValue:n=``,validate:r}=e,[a,o]=i.useState(t),[u,p]=i.useState(n),m=i.useMemo(()=>f(a)||s[0],[a]),h=i.useMemo(()=>c(u,m.format),[u,m.format]),g=i.useMemo(()=>`${m.dialCode} ${h}`.trim(),[m.dialCode,h]),_=i.useMemo(()=>{let e={countryCode:m.code,dialCode:m.dialCode,nationalNumber:l(u),fullNumber:g,isValid:!0};return r?r(e):d(u,m)},[u,m,g,r]),v=i.useMemo(()=>({countryCode:m.code,dialCode:m.dialCode,nationalNumber:l(u),fullNumber:g,isValid:_}),[m,u,g,_]),y=i.useCallback(e=>{o(e)},[]),b=i.useCallback(()=>{p(``)},[]);return{country:m,setCountry:y,nationalNumber:h,setNationalNumber:p,value:v,isValid:_,format:i.useCallback(e=>c(e,m.format),[m.format]),unformat:i.useCallback(e=>l(e),[]),clear:b,getFullNumber:i.useCallback(()=>g,[g])}}function g({value:e,onChange:p,defaultCountry:h=`US`,placeholder:g,disabled:v=!1,error:y=!1,size:b=`md`,showCopy:x=!0,showClear:S=!0,onCopy:C,countries:w,preferredCountries:T,validate:E,className:D,id:O,name:k,required:ee=!1,autoFocus:A=!1}){let[j,M]=i.useState(!1),[N,P]=i.useState(``),[F,I]=i.useState(()=>f(h)||s[0]),[L,R]=i.useState(``),[z,B]=i.useState(!1),V=i.useRef(null),H=i.useRef(null);i.useEffect(()=>{if(e)if(typeof e==`string`)R(l(e));else{let t=f(e.countryCode);t&&I(t),R(e.nationalNumber)}},[]);let U=i.useMemo(()=>{let e=s;if(w&&w.length>0){let t=w.map(e=>e.toUpperCase());e=s.filter(e=>t.includes(e.code))}return m(e,T)},[w,T]),W=i.useMemo(()=>{if(!N)return U;let e=N.toLowerCase();return U.filter(t=>t.name.toLowerCase().includes(e)||t.code.toLowerCase().includes(e)||t.dialCode.includes(e))},[U,N]),{popularCountries:G,otherCountries:K}=i.useMemo(()=>({popularCountries:W.filter(e=>e.priority&&e.priority<=5),otherCountries:W.filter(e=>!e.priority||e.priority>5)}),[W]),q=i.useMemo(()=>c(L,F.format),[L,F.format]),J=i.useMemo(()=>`${F.dialCode} ${q}`.trim(),[F.dialCode,q]),Y=i.useMemo(()=>{if(!L)return!1;let e={countryCode:F.code,dialCode:F.dialCode,nationalNumber:l(L),fullNumber:J,isValid:!0};return E?E(e):d(L,F)},[L,F,J,E]),X=i.useCallback((e,t)=>{let n=c(t,e.format),r=`${e.dialCode} ${n}`.trim(),i=l(t),a={countryCode:e.code,dialCode:e.dialCode,nationalNumber:i,fullNumber:r,isValid:d(t,e,E)};p?.(a)},[p,E]),te=e=>{let t=e.target.value,n=l(t);R(n),X(F,n)},Z=e=>{I(e),M(!1),P(``),X(e,L),setTimeout(()=>V.current?.focus(),0)},ne=async()=>{let e=J;try{await navigator.clipboard.writeText(e),B(!0),C?.(e),setTimeout(()=>B(!1),2e3)}catch{console.error(`Failed to copy to clipboard`)}},re=()=>{R(``),X(F,``),V.current?.focus()};i.useEffect(()=>{j&&setTimeout(()=>H.current?.focus(),0)},[j]);let Q={sm:`h-8 text-xs`,md:`h-9 text-sm`,lg:`h-10 text-base`},$={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},ie={sm:`px-2`,md:`px-3`,lg:`px-4`},ae=g||u(F)||`Enter phone number`,oe=L.length>0;return(0,o.jsxs)(`div`,{className:t.cn(`relative`,D),children:[(0,o.jsxs)(`div`,{className:t.cn(`flex items-center rounded-md border border-input bg-transparent shadow-sm transition-colors`,`focus-within:ring-1 focus-within:ring-ring`,y&&`border-destructive focus-within:ring-destructive`,v&&`cursor-not-allowed opacity-50`,Q[b]),children:[(0,o.jsxs)(r.Popover,{open:j,onOpenChange:M,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,disabled:v,className:t.cn(`flex items-center gap-1 border-r border-input bg-muted/50 rounded-l-md transition-colors`,`hover:bg-muted focus:outline-none focus:bg-muted`,ie[b],Q[b],v&&`pointer-events-none`),"aria-label":`Select country`,"aria-expanded":j,children:[(0,o.jsx)(`span`,{className:`text-base`,role:`img`,"aria-label":F.name,children:F.flag}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:F.dialCode}),(0,o.jsx)(a.ChevronDown,{className:t.cn($[b],`text-muted-foreground transition-transform`,j&&`rotate-180`)})]})}),(0,o.jsxs)(r.PopoverContent,{className:`w-64 p-0`,align:`start`,sideOffset:4,children:[(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3 py-2`,children:[(0,o.jsx)(a.Search,{className:`h-4 w-4 text-muted-foreground mr-2 flex-shrink-0`}),(0,o.jsx)(`input`,{ref:H,type:`text`,placeholder:`Search countries...`,value:N,onChange:e=>P(e.target.value),className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`}),N&&(0,o.jsx)(`button`,{type:`button`,onClick:()=>P(``),className:`text-muted-foreground hover:text-foreground`,children:(0,o.jsx)(a.X,{className:`h-3 w-3`})})]}),(0,o.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[G.length>0&&!N&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`px-3 py-1.5 text-xs font-medium text-muted-foreground`,children:`Popular`}),G.map(e=>(0,o.jsx)(_,{country:e,isSelected:F.code===e.code,onClick:()=>Z(e)},`popular-${e.code}`)),(0,o.jsx)(`div`,{className:`mx-3 my-1 border-b`})]}),!N&&K.length>0&&(0,o.jsx)(`div`,{className:`px-3 py-1.5 text-xs font-medium text-muted-foreground`,children:`All Countries`}),(N?W:K).map(e=>(0,o.jsx)(_,{country:e,isSelected:F.code===e.code,onClick:()=>Z(e)},e.code)),W.length===0&&(0,o.jsx)(`div`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No countries found`})]})]})]}),(0,o.jsx)(`div`,{className:`flex items-center pl-2`,children:(0,o.jsx)(a.Phone,{className:t.cn($[b],`text-muted-foreground`)})}),(0,o.jsx)(n.Input,{ref:V,id:O,name:k,type:`tel`,inputMode:`tel`,value:q,onChange:te,placeholder:ae,disabled:v,required:ee,autoFocus:A,autoComplete:`tel-national`,className:t.cn(`border-0 shadow-none focus-visible:ring-0 flex-1`,Q[b]),"aria-label":`Phone number`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1 pr-2`,children:[oe&&(0,o.jsx)(`div`,{className:t.cn(`flex items-center justify-center`,Y?`text-green-500`:`text-muted-foreground/50`),children:Y?(0,o.jsx)(a.Check,{className:$[b]}):(0,o.jsx)(a.AlertCircle,{className:t.cn($[b],`opacity-50`)})}),S&&L&&!v&&(0,o.jsx)(`button`,{type:`button`,onClick:re,className:`text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded`,"aria-label":`Clear phone number`,children:(0,o.jsx)(a.X,{className:$[b]})}),x&&L&&!v&&(0,o.jsx)(`button`,{type:`button`,onClick:ne,className:t.cn(`transition-colors p-0.5 rounded`,z?`text-green-500`:`text-muted-foreground hover:text-foreground`),"aria-label":z?`Copied!`:`Copy phone number`,children:z?(0,o.jsx)(a.Check,{className:$[b]}):(0,o.jsx)(a.Copy,{className:$[b]})})]})]}),k&&(0,o.jsx)(`input`,{type:`hidden`,name:`${k}_full`,value:J})]})}function _({country:e,isSelected:n,onClick:r}){return(0,o.jsxs)(`button`,{type:`button`,onClick:r,className:t.cn(`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus:outline-none focus:bg-accent focus:text-accent-foreground`,n&&`bg-accent`),children:[(0,o.jsx)(`span`,{className:`text-base`,role:`img`,"aria-label":e.name,children:e.flag}),(0,o.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.name}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.dialCode}),n&&(0,o.jsx)(a.Check,{className:`h-4 w-4 text-primary flex-shrink-0`})]})}exports.COUNTRIES=s,exports.default=g,exports.formatPhoneNumber=c,exports.getCountryByCode=f,exports.getCountryByDialCode=p,exports.unformatPhoneNumber=l,exports.usePhoneInput=h;
1
+ "use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../input/index.cjs.js"),r=require("../popover/index.cjs.js");let i=require("react");i=e.__toESM(i);let a=require("lucide-react"),o=require("react/jsx-runtime");var s=[{code:`US`,name:`United States`,dialCode:`+1`,flag:`🇺🇸`,format:`(###) ###-####`,priority:1},{code:`GB`,name:`United Kingdom`,dialCode:`+44`,flag:`🇬🇧`,format:`#### ######`,priority:2},{code:`CA`,name:`Canada`,dialCode:`+1`,flag:`🇨🇦`,format:`(###) ###-####`,priority:3},{code:`FR`,name:`France`,dialCode:`+33`,flag:`🇫🇷`,format:`# ## ## ## ##`,priority:4},{code:`DE`,name:`Germany`,dialCode:`+49`,flag:`🇩🇪`,format:`### #######`,priority:5},{code:`AF`,name:`Afghanistan`,dialCode:`+93`,flag:`🇦🇫`,format:`## ### ####`},{code:`AL`,name:`Albania`,dialCode:`+355`,flag:`🇦🇱`,format:`## ### ####`},{code:`DZ`,name:`Algeria`,dialCode:`+213`,flag:`🇩🇿`,format:`### ## ## ##`},{code:`AR`,name:`Argentina`,dialCode:`+54`,flag:`🇦🇷`,format:`## ####-####`},{code:`AU`,name:`Australia`,dialCode:`+61`,flag:`🇦🇺`,format:`### ### ###`},{code:`AT`,name:`Austria`,dialCode:`+43`,flag:`🇦🇹`,format:`### #######`},{code:`BE`,name:`Belgium`,dialCode:`+32`,flag:`🇧🇪`,format:`### ## ## ##`},{code:`BR`,name:`Brazil`,dialCode:`+55`,flag:`🇧🇷`,format:`## #####-####`},{code:`CN`,name:`China`,dialCode:`+86`,flag:`🇨🇳`,format:`### #### ####`},{code:`CO`,name:`Colombia`,dialCode:`+57`,flag:`🇨🇴`,format:`### ### ####`},{code:`HR`,name:`Croatia`,dialCode:`+385`,flag:`🇭🇷`,format:`## ### ####`},{code:`CZ`,name:`Czech Republic`,dialCode:`+420`,flag:`🇨🇿`,format:`### ### ###`},{code:`DK`,name:`Denmark`,dialCode:`+45`,flag:`🇩🇰`,format:`## ## ## ##`},{code:`EG`,name:`Egypt`,dialCode:`+20`,flag:`🇪🇬`,format:`### ### ####`},{code:`FI`,name:`Finland`,dialCode:`+358`,flag:`🇫🇮`,format:`## ### ####`},{code:`GR`,name:`Greece`,dialCode:`+30`,flag:`🇬🇷`,format:`### ### ####`},{code:`HK`,name:`Hong Kong`,dialCode:`+852`,flag:`🇭🇰`,format:`#### ####`},{code:`HU`,name:`Hungary`,dialCode:`+36`,flag:`🇭🇺`,format:`## ### ####`},{code:`IN`,name:`India`,dialCode:`+91`,flag:`🇮🇳`,format:`##### #####`},{code:`ID`,name:`Indonesia`,dialCode:`+62`,flag:`🇮🇩`,format:`### ### ####`},{code:`IE`,name:`Ireland`,dialCode:`+353`,flag:`🇮🇪`,format:`## ### ####`},{code:`IL`,name:`Israel`,dialCode:`+972`,flag:`🇮🇱`,format:`## ### ####`},{code:`IT`,name:`Italy`,dialCode:`+39`,flag:`🇮🇹`,format:`### ### ####`},{code:`JP`,name:`Japan`,dialCode:`+81`,flag:`🇯🇵`,format:`## #### ####`},{code:`KR`,name:`South Korea`,dialCode:`+82`,flag:`🇰🇷`,format:`## #### ####`},{code:`MY`,name:`Malaysia`,dialCode:`+60`,flag:`🇲🇾`,format:`## ### ####`},{code:`MX`,name:`Mexico`,dialCode:`+52`,flag:`🇲🇽`,format:`### ### ####`},{code:`NL`,name:`Netherlands`,dialCode:`+31`,flag:`🇳🇱`,format:`# ## ## ## ##`},{code:`NZ`,name:`New Zealand`,dialCode:`+64`,flag:`🇳🇿`,format:`## ### ####`},{code:`NO`,name:`Norway`,dialCode:`+47`,flag:`🇳🇴`,format:`### ## ###`},{code:`PK`,name:`Pakistan`,dialCode:`+92`,flag:`🇵🇰`,format:`### #######`},{code:`PH`,name:`Philippines`,dialCode:`+63`,flag:`🇵🇭`,format:`### ### ####`},{code:`PL`,name:`Poland`,dialCode:`+48`,flag:`🇵🇱`,format:`### ### ###`},{code:`PT`,name:`Portugal`,dialCode:`+351`,flag:`🇵🇹`,format:`### ### ###`},{code:`RO`,name:`Romania`,dialCode:`+40`,flag:`🇷🇴`,format:`### ### ###`},{code:`RU`,name:`Russia`,dialCode:`+7`,flag:`🇷🇺`,format:`### ###-##-##`},{code:`SA`,name:`Saudi Arabia`,dialCode:`+966`,flag:`🇸🇦`,format:`## ### ####`},{code:`SG`,name:`Singapore`,dialCode:`+65`,flag:`🇸🇬`,format:`#### ####`},{code:`ZA`,name:`South Africa`,dialCode:`+27`,flag:`🇿🇦`,format:`## ### ####`},{code:`ES`,name:`Spain`,dialCode:`+34`,flag:`🇪🇸`,format:`### ### ###`},{code:`SE`,name:`Sweden`,dialCode:`+46`,flag:`🇸🇪`,format:`## ### ## ##`},{code:`CH`,name:`Switzerland`,dialCode:`+41`,flag:`🇨🇭`,format:`## ### ## ##`},{code:`TW`,name:`Taiwan`,dialCode:`+886`,flag:`🇹🇼`,format:`### ### ###`},{code:`TH`,name:`Thailand`,dialCode:`+66`,flag:`🇹🇭`,format:`## ### ####`},{code:`TR`,name:`Turkey`,dialCode:`+90`,flag:`🇹🇷`,format:`### ### ####`},{code:`UA`,name:`Ukraine`,dialCode:`+380`,flag:`🇺🇦`,format:`## ### ####`},{code:`AE`,name:`United Arab Emirates`,dialCode:`+971`,flag:`🇦🇪`,format:`## ### ####`},{code:`VN`,name:`Vietnam`,dialCode:`+84`,flag:`🇻🇳`,format:`## ### ####`}];function c(e,t){if(!t)return e;let n=e.replace(/\D/g,``),r=``,i=0;for(let e=0;e<t.length&&i<n.length;e++)t[e]===`#`?(r+=n[i],i++):r+=t[e];return i<n.length&&(r+=n.slice(i)),r}function l(e){return e.replace(/\D/g,``)}function u(e){return e.format?e.format.replace(/#/g,`0`):``}function d(e,t,n){let r=l(e);if(r.length<6||r.length>15)return!1;if(t.format){let e=(t.format.match(/#/g)||[]).length;if(Math.abs(r.length-e)>2)return!1}return!0}function f(e){return s.find(t=>t.code.toLowerCase()===e.toLowerCase())}function p(e){return s.find(t=>t.dialCode===e)}function m(e,t){let n=t?.map(e=>e.toUpperCase())||[];return[...e].sort((e,t)=>{let r=e.priority||999,i=t.priority||999,a=n.indexOf(e.code),o=n.indexOf(t.code);return a!==-1&&o===-1?-1:a===-1&&o!==-1?1:a!==-1&&o!==-1?a-o:r===i?e.name.localeCompare(t.name):r-i})}function h(e={}){let{initialCountry:t=`US`,initialValue:n=``,validate:r}=e,[a,o]=i.useState(t),[u,p]=i.useState(n),m=i.useMemo(()=>f(a)||s[0],[a]),h=i.useMemo(()=>c(u,m.format),[u,m.format]),g=i.useMemo(()=>`${m.dialCode} ${h}`.trim(),[m.dialCode,h]),_=i.useMemo(()=>{let e={countryCode:m.code,dialCode:m.dialCode,nationalNumber:l(u),fullNumber:g,isValid:!0};return r?r(e):d(u,m)},[u,m,g,r]),v=i.useMemo(()=>({countryCode:m.code,dialCode:m.dialCode,nationalNumber:l(u),fullNumber:g,isValid:_}),[m,u,g,_]),y=i.useCallback(e=>{o(e)},[]),b=i.useCallback(()=>{p(``)},[]);return{country:m,setCountry:y,nationalNumber:h,setNationalNumber:p,value:v,isValid:_,format:i.useCallback(e=>c(e,m.format),[m.format]),unformat:i.useCallback(e=>l(e),[]),clear:b,getFullNumber:i.useCallback(()=>g,[g])}}function g({value:e,onChange:p,defaultCountry:h=`US`,placeholder:g,disabled:v=!1,error:y=!1,size:b=`md`,showCopy:x=!0,showClear:S=!0,onCopy:C,countries:w,preferredCountries:T,validate:E,className:D,id:O,name:k,required:ee=!1,autoFocus:A=!1}){let[j,M]=i.useState(!1),[N,P]=i.useState(``),[F,I]=i.useState(()=>f(h)||s[0]),[L,R]=i.useState(``),[z,B]=i.useState(!1),V=i.useRef(null),H=i.useRef(null);i.useEffect(()=>{if(e)if(typeof e==`string`){let t=l(e);R(t)}else{let t=f(e.countryCode);t&&I(t),R(e.nationalNumber)}},[]);let U=i.useMemo(()=>{let e=s;if(w&&w.length>0){let t=w.map(e=>e.toUpperCase());e=s.filter(e=>t.includes(e.code))}return m(e,T)},[w,T]),W=i.useMemo(()=>{if(!N)return U;let e=N.toLowerCase();return U.filter(t=>t.name.toLowerCase().includes(e)||t.code.toLowerCase().includes(e)||t.dialCode.includes(e))},[U,N]),{popularCountries:G,otherCountries:K}=i.useMemo(()=>({popularCountries:W.filter(e=>e.priority&&e.priority<=5),otherCountries:W.filter(e=>!e.priority||e.priority>5)}),[W]),q=i.useMemo(()=>c(L,F.format),[L,F.format]),J=i.useMemo(()=>`${F.dialCode} ${q}`.trim(),[F.dialCode,q]),Y=i.useMemo(()=>{if(!L)return!1;let e={countryCode:F.code,dialCode:F.dialCode,nationalNumber:l(L),fullNumber:J,isValid:!0};return E?E(e):d(L,F)},[L,F,J,E]),X=i.useCallback((e,t)=>{let n=c(t,e.format),r=`${e.dialCode} ${n}`.trim(),i=l(t),a={countryCode:e.code,dialCode:e.dialCode,nationalNumber:i,fullNumber:r,isValid:d(t,e,E)};p?.(a)},[p,E]),te=e=>{let t=e.target.value,n=l(t);R(n),X(F,n)},Z=e=>{I(e),M(!1),P(``),X(e,L),setTimeout(()=>V.current?.focus(),0)},ne=async()=>{let e=J;try{await navigator.clipboard.writeText(e),B(!0),C?.(e),setTimeout(()=>B(!1),2e3)}catch{console.error(`Failed to copy to clipboard`)}},re=()=>{R(``),X(F,``),V.current?.focus()};i.useEffect(()=>{j&&setTimeout(()=>H.current?.focus(),0)},[j]);let Q={sm:`h-8 text-xs`,md:`h-9 text-sm`,lg:`h-10 text-base`},$={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},ie={sm:`px-2`,md:`px-3`,lg:`px-4`},ae=g||u(F)||`Enter phone number`,oe=L.length>0;return(0,o.jsxs)(`div`,{className:t.cn(`relative`,D),children:[(0,o.jsxs)(`div`,{className:t.cn(`flex items-center rounded-md border border-input bg-transparent shadow-sm transition-colors`,`focus-within:ring-1 focus-within:ring-ring`,y&&`border-destructive focus-within:ring-destructive`,v&&`cursor-not-allowed opacity-50`,Q[b]),children:[(0,o.jsxs)(r.Popover,{open:j,onOpenChange:M,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,disabled:v,className:t.cn(`flex items-center gap-1 border-r border-input bg-muted/50 rounded-l-md transition-colors`,`hover:bg-muted focus:outline-none focus:bg-muted`,ie[b],Q[b],v&&`pointer-events-none`),"aria-label":`Select country`,"aria-expanded":j,children:[(0,o.jsx)(`span`,{className:`text-base`,role:`img`,"aria-label":F.name,children:F.flag}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:F.dialCode}),(0,o.jsx)(a.ChevronDown,{className:t.cn($[b],`text-muted-foreground transition-transform`,j&&`rotate-180`)})]})}),(0,o.jsxs)(r.PopoverContent,{className:`w-64 p-0`,align:`start`,sideOffset:4,children:[(0,o.jsxs)(`div`,{className:`flex items-center border-b px-3 py-2`,children:[(0,o.jsx)(a.Search,{className:`h-4 w-4 text-muted-foreground mr-2 flex-shrink-0`}),(0,o.jsx)(`input`,{ref:H,type:`text`,placeholder:`Search countries...`,value:N,onChange:e=>P(e.target.value),className:`flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground`}),N&&(0,o.jsx)(`button`,{type:`button`,onClick:()=>P(``),className:`text-muted-foreground hover:text-foreground`,children:(0,o.jsx)(a.X,{className:`h-3 w-3`})})]}),(0,o.jsxs)(`div`,{className:`max-h-64 overflow-y-auto`,children:[G.length>0&&!N&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`px-3 py-1.5 text-xs font-medium text-muted-foreground`,children:`Popular`}),G.map(e=>(0,o.jsx)(_,{country:e,isSelected:F.code===e.code,onClick:()=>Z(e)},`popular-${e.code}`)),(0,o.jsx)(`div`,{className:`mx-3 my-1 border-b`})]}),!N&&K.length>0&&(0,o.jsx)(`div`,{className:`px-3 py-1.5 text-xs font-medium text-muted-foreground`,children:`All Countries`}),(N?W:K).map(e=>(0,o.jsx)(_,{country:e,isSelected:F.code===e.code,onClick:()=>Z(e)},e.code)),W.length===0&&(0,o.jsx)(`div`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No countries found`})]})]})]}),(0,o.jsx)(`div`,{className:`flex items-center pl-2`,children:(0,o.jsx)(a.Phone,{className:t.cn($[b],`text-muted-foreground`)})}),(0,o.jsx)(n.Input,{ref:V,id:O,name:k,type:`tel`,inputMode:`tel`,value:q,onChange:te,placeholder:ae,disabled:v,required:ee,autoFocus:A,autoComplete:`tel-national`,className:t.cn(`border-0 shadow-none focus-visible:ring-0 flex-1`,Q[b]),"aria-label":`Phone number`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1 pr-2`,children:[oe&&(0,o.jsx)(`div`,{className:t.cn(`flex items-center justify-center`,Y?`text-green-500`:`text-muted-foreground/50`),children:Y?(0,o.jsx)(a.Check,{className:$[b]}):(0,o.jsx)(a.AlertCircle,{className:t.cn($[b],`opacity-50`)})}),S&&L&&!v&&(0,o.jsx)(`button`,{type:`button`,onClick:re,className:`text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded`,"aria-label":`Clear phone number`,children:(0,o.jsx)(a.X,{className:$[b]})}),x&&L&&!v&&(0,o.jsx)(`button`,{type:`button`,onClick:ne,className:t.cn(`transition-colors p-0.5 rounded`,z?`text-green-500`:`text-muted-foreground hover:text-foreground`),"aria-label":z?`Copied!`:`Copy phone number`,children:z?(0,o.jsx)(a.Check,{className:$[b]}):(0,o.jsx)(a.Copy,{className:$[b]})})]})]}),k&&(0,o.jsx)(`input`,{type:`hidden`,name:`${k}_full`,value:J})]})}function _({country:e,isSelected:n,onClick:r}){return(0,o.jsxs)(`button`,{type:`button`,onClick:r,className:t.cn(`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors`,`hover:bg-accent hover:text-accent-foreground`,`focus:outline-none focus:bg-accent focus:text-accent-foreground`,n&&`bg-accent`),children:[(0,o.jsx)(`span`,{className:`text-base`,role:`img`,"aria-label":e.name,children:e.flag}),(0,o.jsx)(`span`,{className:`flex-1 text-left truncate`,children:e.name}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.dialCode}),n&&(0,o.jsx)(a.Check,{className:`h-4 w-4 text-primary flex-shrink-0`})]})}exports.COUNTRIES=s,exports.WakaPhoneInput=g,exports.default=g,exports.formatPhoneNumber=c,exports.getCountryByCode=f,exports.getCountryByDialCode=p,exports.unformatPhoneNumber=l,exports.usePhoneInput=h;
@@ -466,8 +466,10 @@ function S(e = {}) {
466
466
  function C({ value: x, onChange: S, defaultCountry: C = "US", placeholder: ne, disabled: T = !1, error: re = !1, size: E = "md", showCopy: ie = !0, showClear: ae = !0, onCopy: oe, countries: D, preferredCountries: O, validate: k, className: se, id: ce, name: A, required: le = !1, autoFocus: ue = !1 }) {
467
467
  let [j, M] = a.useState(!1), [N, P] = a.useState(""), [F, I] = a.useState(() => b(C) || g[0]), [L, R] = a.useState(""), [z, B] = a.useState(!1), V = a.useRef(null), H = a.useRef(null);
468
468
  a.useEffect(() => {
469
- if (x) if (typeof x == "string") R(v(x));
470
- else {
469
+ if (x) if (typeof x == "string") {
470
+ let e = v(x);
471
+ R(e);
472
+ } else {
471
473
  let e = b(x.countryCode);
472
474
  e && I(e), R(x.nationalNumber);
473
475
  }
@@ -702,4 +704,4 @@ function w({ country: t, isSelected: n, onClick: r }) {
702
704
  });
703
705
  }
704
706
  //#endregion
705
- export { g as COUNTRIES, C as default, _ as formatPhoneNumber, b as getCountryByCode, x as getCountryByDialCode, v as unformatPhoneNumber, S as usePhoneInput };
707
+ export { g as COUNTRIES, C as WakaPhoneInput, C as default, _ as formatPhoneNumber, b as getCountryByCode, x as getCountryByDialCode, v as unformatPhoneNumber, S as usePhoneInput };