@fluid-app/fluid-cli-theme-dev 0.1.58 → 0.1.60

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 (252) hide show
  1. package/README.md +109 -0
  2. package/dist/dist-cli-preview/.vite/manifest.json +1831 -0
  3. package/dist/dist-cli-preview/account-screens.js +1 -0
  4. package/dist/dist-cli-preview/capabilities.json +1 -0
  5. package/dist/dist-cli-preview/chunks/Breadcrumb-CZ-skiUy.js +91 -0
  6. package/dist/dist-cli-preview/chunks/Combobox-BGiCYa56.js +1455 -0
  7. package/dist/dist-cli-preview/chunks/ContactsScreen-vsNgy_gn.js +6930 -0
  8. package/dist/dist-cli-preview/chunks/MemberManagementProviders-DMwkh3JW.js +1509 -0
  9. package/dist/dist-cli-preview/chunks/MessagingScreen-DzJOwPGH.js +38475 -0
  10. package/dist/dist-cli-preview/chunks/MobileActionSheet-DqVPgFKI.js +2895 -0
  11. package/dist/dist-cli-preview/chunks/MySiteScreen-BSmWlCKA.js +4950 -0
  12. package/dist/dist-cli-preview/chunks/OrdersScreen-CVEl9FnN.js +1349 -0
  13. package/dist/dist-cli-preview/chunks/OrdersScreen-d4fJE_dm.js +9 -0
  14. package/dist/dist-cli-preview/chunks/ProfileScreen-BC5gyJDY.js +2581 -0
  15. package/dist/dist-cli-preview/chunks/SubscriptionsScreen-CFM4Pufg.js +38 -0
  16. package/dist/dist-cli-preview/chunks/account-screen-runtime-DxhJm6Qd.js +12407 -0
  17. package/dist/dist-cli-preview/chunks/ar-4OhalXtk.js +628 -0
  18. package/dist/dist-cli-preview/chunks/ar-8iaFSgop.js +189 -0
  19. package/dist/dist-cli-preview/chunks/ar-B7NQmkZ1.js +341 -0
  20. package/dist/dist-cli-preview/chunks/ar-DEUMqcX3.js +563 -0
  21. package/dist/dist-cli-preview/chunks/ar-DT9j-dOi.js +720 -0
  22. package/dist/dist-cli-preview/chunks/ar-D_B30x0o.js +176 -0
  23. package/dist/dist-cli-preview/chunks/arrow-left-UFKI-PQf.js +14 -0
  24. package/dist/dist-cli-preview/chunks/bg-CIgMfa9k.js +176 -0
  25. package/dist/dist-cli-preview/chunks/bg-CS2zt-UV.js +720 -0
  26. package/dist/dist-cli-preview/chunks/bg-CxfL8rZN.js +341 -0
  27. package/dist/dist-cli-preview/chunks/bg-DOdbUYGw.js +563 -0
  28. package/dist/dist-cli-preview/chunks/bg-D_C_HmWn.js +189 -0
  29. package/dist/dist-cli-preview/chunks/bg-DeBjzn9B.js +628 -0
  30. package/dist/dist-cli-preview/chunks/bn-BAGJspTJ.js +563 -0
  31. package/dist/dist-cli-preview/chunks/bn-BgnBXWHo.js +176 -0
  32. package/dist/dist-cli-preview/chunks/bn-CRBwi_3N.js +628 -0
  33. package/dist/dist-cli-preview/chunks/bn-CdhHCK--.js +341 -0
  34. package/dist/dist-cli-preview/chunks/bn-DiqHsF7K.js +720 -0
  35. package/dist/dist-cli-preview/chunks/bn-UEAt87N9.js +189 -0
  36. package/dist/dist-cli-preview/chunks/cli-preview-DunPfnjU.js +151 -0
  37. package/dist/dist-cli-preview/chunks/client.gen-CSTBgfxj.js +672 -0
  38. package/dist/dist-cli-preview/chunks/contacts-CpYlEgAq.js +4 -0
  39. package/dist/dist-cli-preview/chunks/countries-api-adapter-B3usO25w.js +108 -0
  40. package/dist/dist-cli-preview/chunks/create-card-entry-container-DHgsbSyr.js +23942 -0
  41. package/dist/dist-cli-preview/chunks/cs-B8rJsMOS.js +189 -0
  42. package/dist/dist-cli-preview/chunks/cs-ChKaPMtV.js +563 -0
  43. package/dist/dist-cli-preview/chunks/cs-CkdXQxaf.js +720 -0
  44. package/dist/dist-cli-preview/chunks/cs-DTe-xGeI.js +341 -0
  45. package/dist/dist-cli-preview/chunks/cs-DmLSumGB.js +176 -0
  46. package/dist/dist-cli-preview/chunks/cs-jXPm6Nhj.js +628 -0
  47. package/dist/dist-cli-preview/chunks/da-7uI_CROE.js +628 -0
  48. package/dist/dist-cli-preview/chunks/da-B8Cl_vkl.js +341 -0
  49. package/dist/dist-cli-preview/chunks/da-Bee-xQNq.js +563 -0
  50. package/dist/dist-cli-preview/chunks/da-DYlEkykt.js +720 -0
  51. package/dist/dist-cli-preview/chunks/da-EfkyseOR.js +176 -0
  52. package/dist/dist-cli-preview/chunks/da-J--1RxZp.js +189 -0
  53. package/dist/dist-cli-preview/chunks/de-BTNiErdB.js +189 -0
  54. package/dist/dist-cli-preview/chunks/de-CIhZnrdS.js +720 -0
  55. package/dist/dist-cli-preview/chunks/de-CKtChtTF.js +628 -0
  56. package/dist/dist-cli-preview/chunks/de-D8cYy8G-.js +341 -0
  57. package/dist/dist-cli-preview/chunks/de-EARi-xk5.js +176 -0
  58. package/dist/dist-cli-preview/chunks/de-zeOnL7Nl.js +563 -0
  59. package/dist/dist-cli-preview/chunks/el-0NNTwBnJ.js +563 -0
  60. package/dist/dist-cli-preview/chunks/el-BPz4rb5a.js +176 -0
  61. package/dist/dist-cli-preview/chunks/el-Bg6zRbVK.js +720 -0
  62. package/dist/dist-cli-preview/chunks/el-CUjODD23.js +628 -0
  63. package/dist/dist-cli-preview/chunks/el-Chjin2JW.js +341 -0
  64. package/dist/dist-cli-preview/chunks/el-DYay96x-.js +189 -0
  65. package/dist/dist-cli-preview/chunks/es-CFZtv6aF.js +176 -0
  66. package/dist/dist-cli-preview/chunks/es-CGgD1AV1.js +720 -0
  67. package/dist/dist-cli-preview/chunks/es-CXXB8ubn.js +628 -0
  68. package/dist/dist-cli-preview/chunks/es-Cf56ydFZ.js +189 -0
  69. package/dist/dist-cli-preview/chunks/es-DirUtV7k.js +563 -0
  70. package/dist/dist-cli-preview/chunks/es-mp8RwFN4.js +341 -0
  71. package/dist/dist-cli-preview/chunks/fi-91gcpxoy.js +341 -0
  72. package/dist/dist-cli-preview/chunks/fi-BfDoQ1rt.js +628 -0
  73. package/dist/dist-cli-preview/chunks/fi-Bn9_l4IH.js +176 -0
  74. package/dist/dist-cli-preview/chunks/fi-Bo5QdhP_.js +563 -0
  75. package/dist/dist-cli-preview/chunks/fi-CC2YqekN.js +189 -0
  76. package/dist/dist-cli-preview/chunks/fi-DUhIWph7.js +720 -0
  77. package/dist/dist-cli-preview/chunks/fr-BSouGEGN.js +176 -0
  78. package/dist/dist-cli-preview/chunks/fr-BnYsse99.js +563 -0
  79. package/dist/dist-cli-preview/chunks/fr-C32S8PvA.js +720 -0
  80. package/dist/dist-cli-preview/chunks/fr-DIQcYUq-.js +628 -0
  81. package/dist/dist-cli-preview/chunks/fr-Do6AIa1z.js +189 -0
  82. package/dist/dist-cli-preview/chunks/fr-ekvUCKTH.js +341 -0
  83. package/dist/dist-cli-preview/chunks/he-B7QiuquT.js +341 -0
  84. package/dist/dist-cli-preview/chunks/he-BYEZTUry.js +176 -0
  85. package/dist/dist-cli-preview/chunks/he-CO8gUz9X.js +628 -0
  86. package/dist/dist-cli-preview/chunks/he-DaWGyHjM.js +189 -0
  87. package/dist/dist-cli-preview/chunks/he-pFefco4W.js +563 -0
  88. package/dist/dist-cli-preview/chunks/he-xSGbvsti.js +720 -0
  89. package/dist/dist-cli-preview/chunks/hey-api-client-DSvKWGPq.js +153 -0
  90. package/dist/dist-cli-preview/chunks/hi-BLnEaAml.js +176 -0
  91. package/dist/dist-cli-preview/chunks/hi-BMFNssNU.js +720 -0
  92. package/dist/dist-cli-preview/chunks/hi-BXBdXuFm.js +189 -0
  93. package/dist/dist-cli-preview/chunks/hi-DNNhi7ud.js +341 -0
  94. package/dist/dist-cli-preview/chunks/hi-DVSXxEzh.js +628 -0
  95. package/dist/dist-cli-preview/chunks/hi-Uqd1FKtv.js +563 -0
  96. package/dist/dist-cli-preview/chunks/hr-B1T2UY_p.js +176 -0
  97. package/dist/dist-cli-preview/chunks/hr-B432GvmU.js +720 -0
  98. package/dist/dist-cli-preview/chunks/hr-BJR58Xci.js +563 -0
  99. package/dist/dist-cli-preview/chunks/hr-CAwxMKX_.js +341 -0
  100. package/dist/dist-cli-preview/chunks/hr-DBrPFNLx.js +189 -0
  101. package/dist/dist-cli-preview/chunks/hr-yH6ab4ea.js +628 -0
  102. package/dist/dist-cli-preview/chunks/hu-BcC628Ln.js +189 -0
  103. package/dist/dist-cli-preview/chunks/hu-Bv0_YQEn.js +628 -0
  104. package/dist/dist-cli-preview/chunks/hu-D_oQwH4Q.js +341 -0
  105. package/dist/dist-cli-preview/chunks/hu-Q0aE9GvJ.js +720 -0
  106. package/dist/dist-cli-preview/chunks/hu-TNzzMEzp.js +563 -0
  107. package/dist/dist-cli-preview/chunks/hu-cQw9hgLe.js +176 -0
  108. package/dist/dist-cli-preview/chunks/id-Becf5X73.js +720 -0
  109. package/dist/dist-cli-preview/chunks/id-CLvNjXjm.js +189 -0
  110. package/dist/dist-cli-preview/chunks/id-CzSVbo5E.js +628 -0
  111. package/dist/dist-cli-preview/chunks/id-Vudf_d_f.js +563 -0
  112. package/dist/dist-cli-preview/chunks/id-Zd_5csjz.js +176 -0
  113. package/dist/dist-cli-preview/chunks/id-oeAszBoo.js +341 -0
  114. package/dist/dist-cli-preview/chunks/isAfter-BUGgByEf.js +1414 -0
  115. package/dist/dist-cli-preview/chunks/it-BlwQOBaX.js +720 -0
  116. package/dist/dist-cli-preview/chunks/it-C0jghILa.js +563 -0
  117. package/dist/dist-cli-preview/chunks/it-CmxC_FIJ.js +176 -0
  118. package/dist/dist-cli-preview/chunks/it-D5BXSiSl.js +189 -0
  119. package/dist/dist-cli-preview/chunks/it-Dme6GXSG.js +341 -0
  120. package/dist/dist-cli-preview/chunks/it-xT70eFoJ.js +628 -0
  121. package/dist/dist-cli-preview/chunks/ja-BJ7phJBG.js +720 -0
  122. package/dist/dist-cli-preview/chunks/ja-Bc8dA1LN.js +189 -0
  123. package/dist/dist-cli-preview/chunks/ja-BcOunH2q.js +176 -0
  124. package/dist/dist-cli-preview/chunks/ja-CRnvQNCa.js +341 -0
  125. package/dist/dist-cli-preview/chunks/ja-CfYfDP_F.js +563 -0
  126. package/dist/dist-cli-preview/chunks/ja-Dh3z4uJk.js +628 -0
  127. package/dist/dist-cli-preview/chunks/ko-8mk8A3_I.js +341 -0
  128. package/dist/dist-cli-preview/chunks/ko-Bnp-5GAn.js +720 -0
  129. package/dist/dist-cli-preview/chunks/ko-CG_0ufw6.js +176 -0
  130. package/dist/dist-cli-preview/chunks/ko-CJ-8gCc9.js +189 -0
  131. package/dist/dist-cli-preview/chunks/ko-CnpxBQ2W.js +628 -0
  132. package/dist/dist-cli-preview/chunks/ko-CtkKNEZB.js +563 -0
  133. package/dist/dist-cli-preview/chunks/log-out-CBUq5Hd-.js +15 -0
  134. package/dist/dist-cli-preview/chunks/map-pin-DHfjSyoR.js +20 -0
  135. package/dist/dist-cli-preview/chunks/messaging-DkyH4CPP.js +4 -0
  136. package/dist/dist-cli-preview/chunks/mount-account-screen-pc1VISwF.js +11041 -0
  137. package/dist/dist-cli-preview/chunks/ms-BF5gF9D5.js +189 -0
  138. package/dist/dist-cli-preview/chunks/ms-Bs0GvdOw.js +341 -0
  139. package/dist/dist-cli-preview/chunks/ms-CyhqvfOb.js +563 -0
  140. package/dist/dist-cli-preview/chunks/ms-D6Cf3VUm.js +628 -0
  141. package/dist/dist-cli-preview/chunks/ms-DR0U3aeO.js +720 -0
  142. package/dist/dist-cli-preview/chunks/ms-DTN7PIDq.js +176 -0
  143. package/dist/dist-cli-preview/chunks/mysite-wvfITV7T.js +4 -0
  144. package/dist/dist-cli-preview/chunks/nl-C1v8tc97.js +720 -0
  145. package/dist/dist-cli-preview/chunks/nl-C5fWLZkK.js +189 -0
  146. package/dist/dist-cli-preview/chunks/nl-Cgt3zlZ8.js +628 -0
  147. package/dist/dist-cli-preview/chunks/nl-DWtWnOvH.js +563 -0
  148. package/dist/dist-cli-preview/chunks/nl-tsI6lLxl.js +341 -0
  149. package/dist/dist-cli-preview/chunks/nl-x2lc8Ct5.js +176 -0
  150. package/dist/dist-cli-preview/chunks/no-BeVycdYu.js +563 -0
  151. package/dist/dist-cli-preview/chunks/no-DMot6qX0.js +341 -0
  152. package/dist/dist-cli-preview/chunks/no-Dk9D1gjY.js +189 -0
  153. package/dist/dist-cli-preview/chunks/no-R8FScfrK.js +176 -0
  154. package/dist/dist-cli-preview/chunks/no-dhNRqvE4.js +720 -0
  155. package/dist/dist-cli-preview/chunks/no-xVFexdWN.js +628 -0
  156. package/dist/dist-cli-preview/chunks/orders-c13r499A.js +4 -0
  157. package/dist/dist-cli-preview/chunks/pl-BH1bEHfg.js +720 -0
  158. package/dist/dist-cli-preview/chunks/pl-Bl9G1yOR.js +176 -0
  159. package/dist/dist-cli-preview/chunks/pl-Cu0JzUUV.js +563 -0
  160. package/dist/dist-cli-preview/chunks/pl-D7AZQwtK.js +189 -0
  161. package/dist/dist-cli-preview/chunks/pl-Dl0M9JDp.js +628 -0
  162. package/dist/dist-cli-preview/chunks/pl-DmTxONNg.js +341 -0
  163. package/dist/dist-cli-preview/chunks/plus-C-lo0pFM.js +14 -0
  164. package/dist/dist-cli-preview/chunks/profile-CoWo9Sxe.js +4 -0
  165. package/dist/dist-cli-preview/chunks/pt-62Kd-NN1.js +189 -0
  166. package/dist/dist-cli-preview/chunks/pt-BAq7bseT.js +628 -0
  167. package/dist/dist-cli-preview/chunks/pt-DgmwnAV-.js +341 -0
  168. package/dist/dist-cli-preview/chunks/pt-K0EDcWuR.js +720 -0
  169. package/dist/dist-cli-preview/chunks/pt-nD60RpwN.js +176 -0
  170. package/dist/dist-cli-preview/chunks/pt-voHVxH2b.js +563 -0
  171. package/dist/dist-cli-preview/chunks/ro-B4M17oRc.js +341 -0
  172. package/dist/dist-cli-preview/chunks/ro-CFfjUJ1T.js +563 -0
  173. package/dist/dist-cli-preview/chunks/ro-CtL0oK2c.js +628 -0
  174. package/dist/dist-cli-preview/chunks/ro-D6ybG7vp.js +176 -0
  175. package/dist/dist-cli-preview/chunks/ro-DTauvv2V.js +189 -0
  176. package/dist/dist-cli-preview/chunks/ro-DUxhal7c.js +720 -0
  177. package/dist/dist-cli-preview/chunks/ru-45VizwWQ.js +628 -0
  178. package/dist/dist-cli-preview/chunks/ru-BS2gZnbs.js +341 -0
  179. package/dist/dist-cli-preview/chunks/ru-C0oMeuhb.js +176 -0
  180. package/dist/dist-cli-preview/chunks/ru-COxlz18L.js +563 -0
  181. package/dist/dist-cli-preview/chunks/ru-CjEXCUxb.js +720 -0
  182. package/dist/dist-cli-preview/chunks/ru-g5Cz5HSk.js +189 -0
  183. package/dist/dist-cli-preview/chunks/schemas-9_ZwC5nC.js +3977 -0
  184. package/dist/dist-cli-preview/chunks/screen-route-slug-utils-B254xI_J.js +14954 -0
  185. package/dist/dist-cli-preview/chunks/sheet-haptics-context-D2WUiXJm.js +116 -0
  186. package/dist/dist-cli-preview/chunks/sidebar-CMSWZCPS.js +848 -0
  187. package/dist/dist-cli-preview/chunks/sk-BGDxj2sS.js +563 -0
  188. package/dist/dist-cli-preview/chunks/sk-BdDjjHfn.js +341 -0
  189. package/dist/dist-cli-preview/chunks/sk-Bpdt_mn0.js +176 -0
  190. package/dist/dist-cli-preview/chunks/sk-DX2wOf1g.js +628 -0
  191. package/dist/dist-cli-preview/chunks/sk-QbdQWjZy.js +714 -0
  192. package/dist/dist-cli-preview/chunks/sk-YuAeAaeZ.js +189 -0
  193. package/dist/dist-cli-preview/chunks/store-api-context-BIdILNWL.js +16 -0
  194. package/dist/dist-cli-preview/chunks/subscriptions-BHALQrcU.js +4 -0
  195. package/dist/dist-cli-preview/chunks/sv-BlNLvbmj.js +628 -0
  196. package/dist/dist-cli-preview/chunks/sv-CEmTDhJy.js +176 -0
  197. package/dist/dist-cli-preview/chunks/sv-CW7FL5HA.js +341 -0
  198. package/dist/dist-cli-preview/chunks/sv-CiCeNX1x.js +720 -0
  199. package/dist/dist-cli-preview/chunks/sv-DefBhX0c.js +563 -0
  200. package/dist/dist-cli-preview/chunks/sv-iaAh80e4.js +189 -0
  201. package/dist/dist-cli-preview/chunks/th-BNEA6ESz.js +720 -0
  202. package/dist/dist-cli-preview/chunks/th-BYBMKmSh.js +341 -0
  203. package/dist/dist-cli-preview/chunks/th-DMPCj1Fg.js +189 -0
  204. package/dist/dist-cli-preview/chunks/th-DV3lk4-6.js +563 -0
  205. package/dist/dist-cli-preview/chunks/th-F8oLBw5n.js +176 -0
  206. package/dist/dist-cli-preview/chunks/th-fPXxGW_m.js +628 -0
  207. package/dist/dist-cli-preview/chunks/tl-BMLmbhme.js +628 -0
  208. package/dist/dist-cli-preview/chunks/tl-BXIS85ly.js +176 -0
  209. package/dist/dist-cli-preview/chunks/tl-CDigaLsK.js +341 -0
  210. package/dist/dist-cli-preview/chunks/tl-DVdSJCnc.js +563 -0
  211. package/dist/dist-cli-preview/chunks/tl-fdtlfqan.js +720 -0
  212. package/dist/dist-cli-preview/chunks/tl-w5CgYWXn.js +189 -0
  213. package/dist/dist-cli-preview/chunks/tr-BA1MDk8A.js +563 -0
  214. package/dist/dist-cli-preview/chunks/tr-CHri_kqV.js +189 -0
  215. package/dist/dist-cli-preview/chunks/tr-DD75kuPl.js +720 -0
  216. package/dist/dist-cli-preview/chunks/tr-Mq5Hfqt2.js +628 -0
  217. package/dist/dist-cli-preview/chunks/tr-PxiurNCr.js +341 -0
  218. package/dist/dist-cli-preview/chunks/tr-YXIIDIEV.js +176 -0
  219. package/dist/dist-cli-preview/chunks/trash-2-Bq4IqH0j.js +137 -0
  220. package/dist/dist-cli-preview/chunks/uk-B4aYnJ8t.js +341 -0
  221. package/dist/dist-cli-preview/chunks/uk-ByJtQJHi.js +189 -0
  222. package/dist/dist-cli-preview/chunks/uk-CCVTTskN.js +720 -0
  223. package/dist/dist-cli-preview/chunks/uk-CS0tJc6H.js +628 -0
  224. package/dist/dist-cli-preview/chunks/uk-CYYjeT-V.js +176 -0
  225. package/dist/dist-cli-preview/chunks/uk-DGb0m_JV.js +563 -0
  226. package/dist/dist-cli-preview/chunks/use-optional-store-Csor1Z3z.js +22 -0
  227. package/dist/dist-cli-preview/chunks/useInfiniteQuery-BpFtQ7DH.js +67 -0
  228. package/dist/dist-cli-preview/chunks/user-BGrQJ1GJ.js +31 -0
  229. package/dist/dist-cli-preview/chunks/users-DBL0isYy.js +27 -0
  230. package/dist/dist-cli-preview/chunks/vi-BoKSdzH3.js +341 -0
  231. package/dist/dist-cli-preview/chunks/vi-CHKjehVL.js +628 -0
  232. package/dist/dist-cli-preview/chunks/vi-DFicISRE.js +189 -0
  233. package/dist/dist-cli-preview/chunks/vi-DT4XS4HU.js +176 -0
  234. package/dist/dist-cli-preview/chunks/vi-RFwPNQ96.js +720 -0
  235. package/dist/dist-cli-preview/chunks/vi-SG6trKny.js +563 -0
  236. package/dist/dist-cli-preview/chunks/zh_CN-BJVGrpVl.js +714 -0
  237. package/dist/dist-cli-preview/chunks/zh_CN-BeGANQIJ.js +176 -0
  238. package/dist/dist-cli-preview/chunks/zh_CN-BwpNGMQN.js +189 -0
  239. package/dist/dist-cli-preview/chunks/zh_CN-CFu3GI2I.js +563 -0
  240. package/dist/dist-cli-preview/chunks/zh_CN-DrCrXsZC.js +341 -0
  241. package/dist/dist-cli-preview/chunks/zh_CN-x6mJyUQH.js +628 -0
  242. package/dist/dist-cli-preview/chunks/zh_TW-CorN6cwY.js +720 -0
  243. package/dist/dist-cli-preview/chunks/zh_TW-D9gGVyEb.js +176 -0
  244. package/dist/dist-cli-preview/chunks/zh_TW-DdD6Hf_A.js +628 -0
  245. package/dist/dist-cli-preview/chunks/zh_TW-JmyC1W5K.js +341 -0
  246. package/dist/dist-cli-preview/chunks/zh_TW-Oq4Chn8F.js +189 -0
  247. package/dist/dist-cli-preview/chunks/zh_TW-kUnD3TL4.js +563 -0
  248. package/dist/index.mjs +1220 -513
  249. package/dist/index.mjs.map +1 -1
  250. package/dist/skills/themes-review/SKILL.md +2 -2
  251. package/dist/skills/themes-review/references/navigation.md +3 -1
  252. package/package.json +60 -10
@@ -0,0 +1,2581 @@
1
+ import { c as H, i as mt, l as v, j as a, G as ht, H as se, J as pt, K as J, M as ae, I as ve, N as P, R as S, B as ie, D as Pe, E as oe, x as gt, O as B, U as xt, V as $, W as D, X as _t, Y as bt, Z as yt, P as vt, _ as Y, z as le, $ as Ae, q as jt, a0 as wt, a1 as Ct } from "./account-screen-runtime-DxhJm6Qd.js";
2
+ import { u as M, a as Nt, b as O, c as St, d as Et, M as Pt } from "./MemberManagementProviders-DMwkh3JW.js";
3
+ import { O as At } from "./OrdersScreen-CVEl9FnN.js";
4
+ import { F as W, e as Mt, f as Rt, S as Lt, P as Ft, a as It, b as kt, d as Dt, A as Ot, B as Me, C as Re, c as zt, g as Tt, u as Bt, i as Ut, h as $t, T as qt, j as Qt, k as Vt, m as Ht, E as Kt, l as Le } from "./create-card-entry-container-DHgsbSyr.js";
5
+ import { u as ce } from "./isAfter-BUGgByEf.js";
6
+ import { u as Gt } from "./trash-2-Bq4IqH0j.js";
7
+ import { R as Fe, D as Yt, u as q, o as ee, s as F } from "./schemas-9_ZwC5nC.js";
8
+ import { I as Wt } from "./sheet-haptics-context-D2WUiXJm.js";
9
+ import { u as K } from "./sidebar-CMSWZCPS.js";
10
+ import { u as Xt } from "./countries-api-adapter-B3usO25w.js";
11
+ import { M as Zt } from "./map-pin-DHfjSyoR.js";
12
+ import { A as je } from "./arrow-left-UFKI-PQf.js";
13
+ import { L as Jt } from "./log-out-CBUq5Hd-.js";
14
+ /**
15
+ * @license lucide-react v0.575.0 - ISC
16
+ *
17
+ * This source code is licensed under the ISC license.
18
+ * See the LICENSE file in the root directory of this source tree.
19
+ */
20
+ const er = [
21
+ ["rect", { width: "20", height: "14", x: "2", y: "5", rx: "2", key: "ynyp8z" }],
22
+ ["line", { x1: "2", x2: "22", y1: "10", y2: "10", key: "1b3vmo" }]
23
+ ], Ie = H("credit-card", er);
24
+ /**
25
+ * @license lucide-react v0.575.0 - ISC
26
+ *
27
+ * This source code is licensed under the ISC license.
28
+ * See the LICENSE file in the root directory of this source tree.
29
+ */
30
+ const tr = [
31
+ ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
32
+ ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
33
+ ["path", { d: "M2 5h12", key: "or177f" }],
34
+ ["path", { d: "M7 2h1", key: "1t2jsx" }],
35
+ ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
36
+ ["path", { d: "M14 18h6", key: "1m8k6r" }]
37
+ ], rr = H("languages", tr);
38
+ /**
39
+ * @license lucide-react v0.575.0 - ISC
40
+ *
41
+ * This source code is licensed under the ISC license.
42
+ * See the LICENSE file in the root directory of this source tree.
43
+ */
44
+ const nr = [
45
+ ["path", { d: "m2 9 3-3 3 3", key: "1ltn5i" }],
46
+ ["path", { d: "M13 18H7a2 2 0 0 1-2-2V6", key: "1r6tfw" }],
47
+ ["path", { d: "m22 15-3 3-3-3", key: "4rnwn2" }],
48
+ ["path", { d: "M11 6h6a2 2 0 0 1 2 2v10", key: "2f72bc" }]
49
+ ], ke = H("repeat-2", nr);
50
+ /**
51
+ * @license lucide-react v0.575.0 - ISC
52
+ *
53
+ * This source code is licensed under the ISC license.
54
+ * See the LICENSE file in the root directory of this source tree.
55
+ */
56
+ const sr = [
57
+ [
58
+ "path",
59
+ {
60
+ d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
61
+ key: "r04s7s"
62
+ }
63
+ ]
64
+ ], ar = H("star", sr);
65
+ /**
66
+ * @license lucide-react v0.575.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */
71
+ const ir = [
72
+ ["circle", { cx: "12", cy: "8", r: "5", key: "1hypcn" }],
73
+ ["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
74
+ ], or = H("user-round", ir);
75
+ var X = { exports: {} }, Z = {};
76
+ /**
77
+ * @license React
78
+ * use-sync-external-store-shim.production.js
79
+ *
80
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
81
+ *
82
+ * This source code is licensed under the MIT license found in the
83
+ * LICENSE file in the root directory of this source tree.
84
+ */
85
+ var we;
86
+ function lr() {
87
+ if (we) return Z;
88
+ we = 1;
89
+ var e = mt();
90
+ function i(o, c) {
91
+ return o === c && (o !== 0 || 1 / o === 1 / c) || o !== o && c !== c;
92
+ }
93
+ var t = typeof Object.is == "function" ? Object.is : i, l = e.useState, d = e.useEffect, u = e.useLayoutEffect, h = e.useDebugValue;
94
+ function p(o, c) {
95
+ var f = c(), m = l({ inst: { value: f, getSnapshot: c } }), g = m[0].inst, x = m[1];
96
+ return u(
97
+ function() {
98
+ g.value = f, g.getSnapshot = c, s(g) && x({ inst: g });
99
+ },
100
+ [o, f, c]
101
+ ), d(
102
+ function() {
103
+ return s(g) && x({ inst: g }), o(function() {
104
+ s(g) && x({ inst: g });
105
+ });
106
+ },
107
+ [o]
108
+ ), h(f), f;
109
+ }
110
+ function s(o) {
111
+ var c = o.getSnapshot;
112
+ o = o.value;
113
+ try {
114
+ var f = c();
115
+ return !t(o, f);
116
+ } catch {
117
+ return !0;
118
+ }
119
+ }
120
+ function r(o, c) {
121
+ return c();
122
+ }
123
+ var n = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : p;
124
+ return Z.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : n, Z;
125
+ }
126
+ var Ce;
127
+ function cr() {
128
+ return Ce || (Ce = 1, X.exports = lr()), X.exports;
129
+ }
130
+ var dr = cr();
131
+ function ur() {
132
+ return dr.useSyncExternalStore(
133
+ fr,
134
+ () => !0,
135
+ () => !1
136
+ );
137
+ }
138
+ function fr() {
139
+ return () => {
140
+ };
141
+ }
142
+ var de = "Avatar", [mr] = ht(de), [hr, De] = mr(de), Oe = v.forwardRef(
143
+ (e, i) => {
144
+ const { __scopeAvatar: t, ...l } = e, [d, u] = v.useState("idle");
145
+ return /* @__PURE__ */ a.jsx(
146
+ hr,
147
+ {
148
+ scope: t,
149
+ imageLoadingStatus: d,
150
+ onImageLoadingStatusChange: u,
151
+ children: /* @__PURE__ */ a.jsx(se.span, { ...l, ref: i })
152
+ }
153
+ );
154
+ }
155
+ );
156
+ Oe.displayName = de;
157
+ var ze = "AvatarImage", Te = v.forwardRef(
158
+ (e, i) => {
159
+ const { __scopeAvatar: t, src: l, onLoadingStatusChange: d = () => {
160
+ }, ...u } = e, h = De(ze, t), p = pr(l, u), s = pt((r) => {
161
+ d(r), h.onImageLoadingStatusChange(r);
162
+ });
163
+ return J(() => {
164
+ p !== "idle" && s(p);
165
+ }, [p, s]), p === "loaded" ? /* @__PURE__ */ a.jsx(se.img, { ...u, ref: i, src: l }) : null;
166
+ }
167
+ );
168
+ Te.displayName = ze;
169
+ var Be = "AvatarFallback", Ue = v.forwardRef(
170
+ (e, i) => {
171
+ const { __scopeAvatar: t, delayMs: l, ...d } = e, u = De(Be, t), [h, p] = v.useState(l === void 0);
172
+ return v.useEffect(() => {
173
+ if (l !== void 0) {
174
+ const s = window.setTimeout(() => p(!0), l);
175
+ return () => window.clearTimeout(s);
176
+ }
177
+ }, [l]), h && u.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ a.jsx(se.span, { ...d, ref: i }) : null;
178
+ }
179
+ );
180
+ Ue.displayName = Be;
181
+ function Ne(e, i) {
182
+ return e ? i ? (e.src !== i && (e.src = i), e.complete && e.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
183
+ }
184
+ function pr(e, { referrerPolicy: i, crossOrigin: t }) {
185
+ const l = ur(), d = v.useRef(null), u = l ? (d.current || (d.current = new window.Image()), d.current) : null, [h, p] = v.useState(
186
+ () => Ne(u, e)
187
+ );
188
+ return J(() => {
189
+ p(Ne(u, e));
190
+ }, [u, e]), J(() => {
191
+ const s = (o) => () => {
192
+ p(o);
193
+ };
194
+ if (!u) return;
195
+ const r = s("loaded"), n = s("error");
196
+ return u.addEventListener("load", r), u.addEventListener("error", n), i && (u.referrerPolicy = i), typeof t == "string" && (u.crossOrigin = t), () => {
197
+ u.removeEventListener("load", r), u.removeEventListener("error", n);
198
+ };
199
+ }, [u, t, i]), h;
200
+ }
201
+ var gr = Oe, xr = Te, _r = Ue;
202
+ function br({
203
+ className: e,
204
+ size: i = "default",
205
+ ...t
206
+ }) {
207
+ return /* @__PURE__ */ a.jsx(
208
+ gr,
209
+ {
210
+ "data-slot": "avatar",
211
+ "data-size": i,
212
+ className: ae(
213
+ "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
214
+ e
215
+ ),
216
+ ...t
217
+ }
218
+ );
219
+ }
220
+ function yr({
221
+ className: e,
222
+ ...i
223
+ }) {
224
+ return /* @__PURE__ */ a.jsx(
225
+ xr,
226
+ {
227
+ "data-slot": "avatar-image",
228
+ className: ae("aspect-square size-full", e),
229
+ ...i
230
+ }
231
+ );
232
+ }
233
+ function vr({
234
+ className: e,
235
+ ...i
236
+ }) {
237
+ return /* @__PURE__ */ a.jsx(
238
+ _r,
239
+ {
240
+ "data-slot": "avatar-fallback",
241
+ className: ae(
242
+ "bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",
243
+ e
244
+ ),
245
+ ...i
246
+ }
247
+ );
248
+ }
249
+ function jr({
250
+ control: e,
251
+ isOpen: i,
252
+ onSubmit: t,
253
+ handleClose: l,
254
+ languageOptions: d,
255
+ errorMsg: u,
256
+ isSubmitting: h,
257
+ email: p,
258
+ onChangeEmail: s,
259
+ isChangingEmail: r,
260
+ pendingEmail: n,
261
+ disableNameEdit: o = !1,
262
+ presentation: c = "dialog"
263
+ }) {
264
+ const { t: f } = M(), [m, g] = v.useState(!1), [x, N] = v.useState(""), [j, _] = v.useState(void 0), w = async () => {
265
+ _(void 0);
266
+ const A = x.trim();
267
+ if (!A) {
268
+ _(f("please_enter_new_email"));
269
+ return;
270
+ }
271
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(A)) {
272
+ _(f("please_enter_valid_email"));
273
+ return;
274
+ }
275
+ if (p && A.toLowerCase() === p.toLowerCase()) {
276
+ _(f("new_email_must_be_different"));
277
+ return;
278
+ }
279
+ try {
280
+ await s?.(A), g(!1), N("");
281
+ } catch (y) {
282
+ _(
283
+ y instanceof Error ? y.message : f("failed_to_initiate_email_change")
284
+ );
285
+ }
286
+ }, E = () => {
287
+ g(!1), N(""), _(void 0);
288
+ }, I = () => {
289
+ E(), l();
290
+ };
291
+ return /* @__PURE__ */ a.jsxs(
292
+ Fe,
293
+ {
294
+ open: i,
295
+ onOpenChange: (A) => !A && I(),
296
+ title: f("edit_profile"),
297
+ presentation: c,
298
+ children: [
299
+ /* @__PURE__ */ a.jsxs("div", { className: "space-y-4", children: [
300
+ /* @__PURE__ */ a.jsx(
301
+ W,
302
+ {
303
+ control: e,
304
+ name: "first_name",
305
+ label: f("first_name"),
306
+ disabled: o,
307
+ readOnly: o,
308
+ "aria-readonly": o || void 0,
309
+ "aria-describedby": o ? "name-edit-disabled-hint" : void 0
310
+ }
311
+ ),
312
+ /* @__PURE__ */ a.jsx(
313
+ W,
314
+ {
315
+ control: e,
316
+ name: "last_name",
317
+ label: f("last_name"),
318
+ disabled: o,
319
+ readOnly: o,
320
+ "aria-readonly": o || void 0,
321
+ "aria-describedby": o ? "name-edit-disabled-hint" : void 0
322
+ }
323
+ ),
324
+ o && /* @__PURE__ */ a.jsx(
325
+ "p",
326
+ {
327
+ id: "name-edit-disabled-hint",
328
+ className: "text-muted-foreground text-xs",
329
+ children: f("name_change_disabled_hint")
330
+ }
331
+ ),
332
+ /* @__PURE__ */ a.jsx(
333
+ W,
334
+ {
335
+ control: e,
336
+ name: "phone_number",
337
+ label: f("phone_number"),
338
+ type: "tel"
339
+ }
340
+ ),
341
+ /* @__PURE__ */ a.jsx(
342
+ Mt,
343
+ {
344
+ control: e,
345
+ name: "bio",
346
+ label: f("bio"),
347
+ rows: 3,
348
+ placeholder: f("add_a_short_bio")
349
+ }
350
+ ),
351
+ /* @__PURE__ */ a.jsx(
352
+ Rt,
353
+ {
354
+ control: e,
355
+ name: "language",
356
+ label: f("language"),
357
+ options: d,
358
+ placeholder: f("select_an_option")
359
+ }
360
+ )
361
+ ] }),
362
+ p && /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
363
+ /* @__PURE__ */ a.jsx("label", { className: "text-foreground text-sm font-medium", children: f("email") }),
364
+ m ? /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
365
+ /* @__PURE__ */ a.jsx(
366
+ Wt,
367
+ {
368
+ type: "email",
369
+ placeholder: f("enter_new_email_placeholder"),
370
+ value: x,
371
+ onChange: (A) => {
372
+ N(A.target.value), _(void 0);
373
+ },
374
+ onKeyDown: (A) => {
375
+ A.key === "Enter" && (A.preventDefault(), w()), A.key === "Escape" && E();
376
+ },
377
+ "aria-invalid": !!j || void 0,
378
+ autoFocus: !0
379
+ }
380
+ ),
381
+ j && /* @__PURE__ */ a.jsx("p", { className: "text-destructive text-xs", children: j }),
382
+ /* @__PURE__ */ a.jsxs("div", { className: "bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5", children: [
383
+ /* @__PURE__ */ a.jsx(ve, { className: "text-primary mt-0.5 size-4 shrink-0" }),
384
+ /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-xs", children: f("email_verification_hint") })
385
+ ] }),
386
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2", children: [
387
+ /* @__PURE__ */ a.jsx(
388
+ P,
389
+ {
390
+ type: "button",
391
+ variant: "outline",
392
+ size: "sm",
393
+ onClick: E,
394
+ children: f("cancel")
395
+ }
396
+ ),
397
+ /* @__PURE__ */ a.jsxs(
398
+ P,
399
+ {
400
+ type: "button",
401
+ size: "sm",
402
+ onClick: w,
403
+ disabled: !x.trim() || r,
404
+ children: [
405
+ r && /* @__PURE__ */ a.jsx("div", { className: "mr-2 size-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current" }),
406
+ f(r ? "sending" : "send_verification")
407
+ ]
408
+ }
409
+ )
410
+ ] })
411
+ ] }) : n ? /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
412
+ /* @__PURE__ */ a.jsx("div", { className: "bg-muted text-muted-foreground min-w-0 rounded-md px-3 py-2 text-sm", children: p }),
413
+ /* @__PURE__ */ a.jsxs("div", { className: "bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5", children: [
414
+ /* @__PURE__ */ a.jsx(ve, { className: "text-primary mt-0.5 size-4 shrink-0" }),
415
+ /* @__PURE__ */ a.jsxs("p", { className: "text-muted-foreground text-xs", children: [
416
+ f("changing_email_to"),
417
+ " ",
418
+ /* @__PURE__ */ a.jsx("span", { className: "text-foreground font-medium", children: n }),
419
+ ". ",
420
+ f("check_new_email_verification")
421
+ ] })
422
+ ] })
423
+ ] }) : /* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
424
+ /* @__PURE__ */ a.jsx("div", { className: "bg-muted text-muted-foreground min-w-0 flex-1 rounded-md px-3 py-2 text-sm", children: p }),
425
+ s && /* @__PURE__ */ a.jsx(
426
+ P,
427
+ {
428
+ type: "button",
429
+ variant: "outline",
430
+ size: "sm",
431
+ onClick: () => g(!0),
432
+ className: "shrink-0",
433
+ children: f("change")
434
+ }
435
+ )
436
+ ] })
437
+ ] }),
438
+ u && /* @__PURE__ */ a.jsx("p", { className: "text-destructive text-sm", children: u }),
439
+ /* @__PURE__ */ a.jsx(Yt, { className: "flex flex-row items-center justify-end", children: /* @__PURE__ */ a.jsx("div", { className: "flex-1 text-right", children: /* @__PURE__ */ a.jsxs(P, { type: "button", onClick: t, children: [
440
+ h && /* @__PURE__ */ a.jsx("div", { className: "mr-2 size-4 animate-spin rounded-full border-2 border-current/30 border-t-current" }),
441
+ f(h ? "saving" : "save_changes")
442
+ ] }) }) })
443
+ ]
444
+ }
445
+ );
446
+ }
447
+ function wr(e, i) {
448
+ if (!e) return !1;
449
+ const t = e.member_type_detail?.permissions;
450
+ if (t) {
451
+ const l = t[i];
452
+ return l !== void 0 ? l === !0 : t.search_enabled === !0;
453
+ }
454
+ return e.member_type !== "customer";
455
+ }
456
+ function Cr(e) {
457
+ return wr(e, "rep_eligible");
458
+ }
459
+ var Nr = Object.defineProperty, G = Object.getOwnPropertySymbols, $e = Object.prototype.hasOwnProperty, qe = Object.prototype.propertyIsEnumerable, Se = (e, i, t) => i in e ? Nr(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, te = (e, i) => {
460
+ for (var t in i || (i = {}))
461
+ $e.call(i, t) && Se(e, t, i[t]);
462
+ if (G)
463
+ for (var t of G(i))
464
+ qe.call(i, t) && Se(e, t, i[t]);
465
+ return e;
466
+ }, re = (e, i) => {
467
+ var t = {};
468
+ for (var l in e)
469
+ $e.call(e, l) && i.indexOf(l) < 0 && (t[l] = e[l]);
470
+ if (e != null && G)
471
+ for (var l of G(e))
472
+ i.indexOf(l) < 0 && qe.call(e, l) && (t[l] = e[l]);
473
+ return t;
474
+ };
475
+ /**
476
+ * @license QR Code generator library (TypeScript)
477
+ * Copyright (c) Project Nayuki.
478
+ * SPDX-License-Identifier: MIT
479
+ */
480
+ var T;
481
+ ((e) => {
482
+ const i = class b {
483
+ /*-- Constructor (low level) and fields --*/
484
+ // Creates a new QR Code with the given version number,
485
+ // error correction level, data codeword bytes, and mask number.
486
+ // This is a low-level API that most users should not use directly.
487
+ // A mid-level API is the encodeSegments() function.
488
+ constructor(s, r, n, o) {
489
+ if (this.version = s, this.errorCorrectionLevel = r, this.modules = [], this.isFunction = [], s < b.MIN_VERSION || s > b.MAX_VERSION)
490
+ throw new RangeError("Version value out of range");
491
+ if (o < -1 || o > 7)
492
+ throw new RangeError("Mask value out of range");
493
+ this.size = s * 4 + 17;
494
+ let c = [];
495
+ for (let m = 0; m < this.size; m++)
496
+ c.push(!1);
497
+ for (let m = 0; m < this.size; m++)
498
+ this.modules.push(c.slice()), this.isFunction.push(c.slice());
499
+ this.drawFunctionPatterns();
500
+ const f = this.addEccAndInterleave(n);
501
+ if (this.drawCodewords(f), o == -1) {
502
+ let m = 1e9;
503
+ for (let g = 0; g < 8; g++) {
504
+ this.applyMask(g), this.drawFormatBits(g);
505
+ const x = this.getPenaltyScore();
506
+ x < m && (o = g, m = x), this.applyMask(g);
507
+ }
508
+ }
509
+ d(0 <= o && o <= 7), this.mask = o, this.applyMask(o), this.drawFormatBits(o), this.isFunction = [];
510
+ }
511
+ /*-- Static factory functions (high level) --*/
512
+ // Returns a QR Code representing the given Unicode text string at the given error correction level.
513
+ // As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
514
+ // Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
515
+ // QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
516
+ // ecl argument if it can be done without increasing the version.
517
+ static encodeText(s, r) {
518
+ const n = e.QrSegment.makeSegments(s);
519
+ return b.encodeSegments(n, r);
520
+ }
521
+ // Returns a QR Code representing the given binary data at the given error correction level.
522
+ // This function always encodes using the binary segment mode, not any text mode. The maximum number of
523
+ // bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
524
+ // The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
525
+ static encodeBinary(s, r) {
526
+ const n = e.QrSegment.makeBytes(s);
527
+ return b.encodeSegments([n], r);
528
+ }
529
+ /*-- Static factory functions (mid level) --*/
530
+ // Returns a QR Code representing the given segments with the given encoding parameters.
531
+ // The smallest possible QR Code version within the given range is automatically
532
+ // chosen for the output. Iff boostEcl is true, then the ECC level of the result
533
+ // may be higher than the ecl argument if it can be done without increasing the
534
+ // version. The mask number is either between 0 to 7 (inclusive) to force that
535
+ // mask, or -1 to automatically choose an appropriate mask (which may be slow).
536
+ // This function allows the user to create a custom sequence of segments that switches
537
+ // between modes (such as alphanumeric and byte) to encode text in less space.
538
+ // This is a mid-level API; the high-level API is encodeText() and encodeBinary().
539
+ static encodeSegments(s, r, n = 1, o = 40, c = -1, f = !0) {
540
+ if (!(b.MIN_VERSION <= n && n <= o && o <= b.MAX_VERSION) || c < -1 || c > 7)
541
+ throw new RangeError("Invalid value");
542
+ let m, g;
543
+ for (m = n; ; m++) {
544
+ const _ = b.getNumDataCodewords(m, r) * 8, w = h.getTotalBits(s, m);
545
+ if (w <= _) {
546
+ g = w;
547
+ break;
548
+ }
549
+ if (m >= o)
550
+ throw new RangeError("Data too long");
551
+ }
552
+ for (const _ of [b.Ecc.MEDIUM, b.Ecc.QUARTILE, b.Ecc.HIGH])
553
+ f && g <= b.getNumDataCodewords(m, _) * 8 && (r = _);
554
+ let x = [];
555
+ for (const _ of s) {
556
+ t(_.mode.modeBits, 4, x), t(_.numChars, _.mode.numCharCountBits(m), x);
557
+ for (const w of _.getData())
558
+ x.push(w);
559
+ }
560
+ d(x.length == g);
561
+ const N = b.getNumDataCodewords(m, r) * 8;
562
+ d(x.length <= N), t(0, Math.min(4, N - x.length), x), t(0, (8 - x.length % 8) % 8, x), d(x.length % 8 == 0);
563
+ for (let _ = 236; x.length < N; _ ^= 253)
564
+ t(_, 8, x);
565
+ let j = [];
566
+ for (; j.length * 8 < x.length; )
567
+ j.push(0);
568
+ return x.forEach((_, w) => j[w >>> 3] |= _ << 7 - (w & 7)), new b(m, r, j, c);
569
+ }
570
+ /*-- Accessor methods --*/
571
+ // Returns the color of the module (pixel) at the given coordinates, which is false
572
+ // for light or true for dark. The top left corner has the coordinates (x=0, y=0).
573
+ // If the given coordinates are out of bounds, then false (light) is returned.
574
+ getModule(s, r) {
575
+ return 0 <= s && s < this.size && 0 <= r && r < this.size && this.modules[r][s];
576
+ }
577
+ // Modified to expose modules for easy access
578
+ getModules() {
579
+ return this.modules;
580
+ }
581
+ /*-- Private helper methods for constructor: Drawing function modules --*/
582
+ // Reads this object's version field, and draws and marks all function modules.
583
+ drawFunctionPatterns() {
584
+ for (let n = 0; n < this.size; n++)
585
+ this.setFunctionModule(6, n, n % 2 == 0), this.setFunctionModule(n, 6, n % 2 == 0);
586
+ this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
587
+ const s = this.getAlignmentPatternPositions(), r = s.length;
588
+ for (let n = 0; n < r; n++)
589
+ for (let o = 0; o < r; o++)
590
+ n == 0 && o == 0 || n == 0 && o == r - 1 || n == r - 1 && o == 0 || this.drawAlignmentPattern(s[n], s[o]);
591
+ this.drawFormatBits(0), this.drawVersion();
592
+ }
593
+ // Draws two copies of the format bits (with its own error correction code)
594
+ // based on the given mask and this object's error correction level field.
595
+ drawFormatBits(s) {
596
+ const r = this.errorCorrectionLevel.formatBits << 3 | s;
597
+ let n = r;
598
+ for (let c = 0; c < 10; c++)
599
+ n = n << 1 ^ (n >>> 9) * 1335;
600
+ const o = (r << 10 | n) ^ 21522;
601
+ d(o >>> 15 == 0);
602
+ for (let c = 0; c <= 5; c++)
603
+ this.setFunctionModule(8, c, l(o, c));
604
+ this.setFunctionModule(8, 7, l(o, 6)), this.setFunctionModule(8, 8, l(o, 7)), this.setFunctionModule(7, 8, l(o, 8));
605
+ for (let c = 9; c < 15; c++)
606
+ this.setFunctionModule(14 - c, 8, l(o, c));
607
+ for (let c = 0; c < 8; c++)
608
+ this.setFunctionModule(this.size - 1 - c, 8, l(o, c));
609
+ for (let c = 8; c < 15; c++)
610
+ this.setFunctionModule(8, this.size - 15 + c, l(o, c));
611
+ this.setFunctionModule(8, this.size - 8, !0);
612
+ }
613
+ // Draws two copies of the version bits (with its own error correction code),
614
+ // based on this object's version field, iff 7 <= version <= 40.
615
+ drawVersion() {
616
+ if (this.version < 7)
617
+ return;
618
+ let s = this.version;
619
+ for (let n = 0; n < 12; n++)
620
+ s = s << 1 ^ (s >>> 11) * 7973;
621
+ const r = this.version << 12 | s;
622
+ d(r >>> 18 == 0);
623
+ for (let n = 0; n < 18; n++) {
624
+ const o = l(r, n), c = this.size - 11 + n % 3, f = Math.floor(n / 3);
625
+ this.setFunctionModule(c, f, o), this.setFunctionModule(f, c, o);
626
+ }
627
+ }
628
+ // Draws a 9*9 finder pattern including the border separator,
629
+ // with the center module at (x, y). Modules can be out of bounds.
630
+ drawFinderPattern(s, r) {
631
+ for (let n = -4; n <= 4; n++)
632
+ for (let o = -4; o <= 4; o++) {
633
+ const c = Math.max(Math.abs(o), Math.abs(n)), f = s + o, m = r + n;
634
+ 0 <= f && f < this.size && 0 <= m && m < this.size && this.setFunctionModule(f, m, c != 2 && c != 4);
635
+ }
636
+ }
637
+ // Draws a 5*5 alignment pattern, with the center module
638
+ // at (x, y). All modules must be in bounds.
639
+ drawAlignmentPattern(s, r) {
640
+ for (let n = -2; n <= 2; n++)
641
+ for (let o = -2; o <= 2; o++)
642
+ this.setFunctionModule(s + o, r + n, Math.max(Math.abs(o), Math.abs(n)) != 1);
643
+ }
644
+ // Sets the color of a module and marks it as a function module.
645
+ // Only used by the constructor. Coordinates must be in bounds.
646
+ setFunctionModule(s, r, n) {
647
+ this.modules[r][s] = n, this.isFunction[r][s] = !0;
648
+ }
649
+ /*-- Private helper methods for constructor: Codewords and masking --*/
650
+ // Returns a new byte string representing the given data with the appropriate error correction
651
+ // codewords appended to it, based on this object's version and error correction level.
652
+ addEccAndInterleave(s) {
653
+ const r = this.version, n = this.errorCorrectionLevel;
654
+ if (s.length != b.getNumDataCodewords(r, n))
655
+ throw new RangeError("Invalid argument");
656
+ const o = b.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][r], c = b.ECC_CODEWORDS_PER_BLOCK[n.ordinal][r], f = Math.floor(b.getNumRawDataModules(r) / 8), m = o - f % o, g = Math.floor(f / o);
657
+ let x = [];
658
+ const N = b.reedSolomonComputeDivisor(c);
659
+ for (let _ = 0, w = 0; _ < o; _++) {
660
+ let E = s.slice(w, w + g - c + (_ < m ? 0 : 1));
661
+ w += E.length;
662
+ const I = b.reedSolomonComputeRemainder(E, N);
663
+ _ < m && E.push(0), x.push(E.concat(I));
664
+ }
665
+ let j = [];
666
+ for (let _ = 0; _ < x[0].length; _++)
667
+ x.forEach((w, E) => {
668
+ (_ != g - c || E >= m) && j.push(w[_]);
669
+ });
670
+ return d(j.length == f), j;
671
+ }
672
+ // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
673
+ // data area of this QR Code. Function modules need to be marked off before this is called.
674
+ drawCodewords(s) {
675
+ if (s.length != Math.floor(b.getNumRawDataModules(this.version) / 8))
676
+ throw new RangeError("Invalid argument");
677
+ let r = 0;
678
+ for (let n = this.size - 1; n >= 1; n -= 2) {
679
+ n == 6 && (n = 5);
680
+ for (let o = 0; o < this.size; o++)
681
+ for (let c = 0; c < 2; c++) {
682
+ const f = n - c, g = (n + 1 & 2) == 0 ? this.size - 1 - o : o;
683
+ !this.isFunction[g][f] && r < s.length * 8 && (this.modules[g][f] = l(s[r >>> 3], 7 - (r & 7)), r++);
684
+ }
685
+ }
686
+ d(r == s.length * 8);
687
+ }
688
+ // XORs the codeword modules in this QR Code with the given mask pattern.
689
+ // The function modules must be marked and the codeword bits must be drawn
690
+ // before masking. Due to the arithmetic of XOR, calling applyMask() with
691
+ // the same mask value a second time will undo the mask. A final well-formed
692
+ // QR Code needs exactly one (not zero, two, etc.) mask applied.
693
+ applyMask(s) {
694
+ if (s < 0 || s > 7)
695
+ throw new RangeError("Mask value out of range");
696
+ for (let r = 0; r < this.size; r++)
697
+ for (let n = 0; n < this.size; n++) {
698
+ let o;
699
+ switch (s) {
700
+ case 0:
701
+ o = (n + r) % 2 == 0;
702
+ break;
703
+ case 1:
704
+ o = r % 2 == 0;
705
+ break;
706
+ case 2:
707
+ o = n % 3 == 0;
708
+ break;
709
+ case 3:
710
+ o = (n + r) % 3 == 0;
711
+ break;
712
+ case 4:
713
+ o = (Math.floor(n / 3) + Math.floor(r / 2)) % 2 == 0;
714
+ break;
715
+ case 5:
716
+ o = n * r % 2 + n * r % 3 == 0;
717
+ break;
718
+ case 6:
719
+ o = (n * r % 2 + n * r % 3) % 2 == 0;
720
+ break;
721
+ case 7:
722
+ o = ((n + r) % 2 + n * r % 3) % 2 == 0;
723
+ break;
724
+ default:
725
+ throw new Error("Unreachable");
726
+ }
727
+ !this.isFunction[r][n] && o && (this.modules[r][n] = !this.modules[r][n]);
728
+ }
729
+ }
730
+ // Calculates and returns the penalty score based on state of this QR Code's current modules.
731
+ // This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
732
+ getPenaltyScore() {
733
+ let s = 0;
734
+ for (let c = 0; c < this.size; c++) {
735
+ let f = !1, m = 0, g = [0, 0, 0, 0, 0, 0, 0];
736
+ for (let x = 0; x < this.size; x++)
737
+ this.modules[c][x] == f ? (m++, m == 5 ? s += b.PENALTY_N1 : m > 5 && s++) : (this.finderPenaltyAddHistory(m, g), f || (s += this.finderPenaltyCountPatterns(g) * b.PENALTY_N3), f = this.modules[c][x], m = 1);
738
+ s += this.finderPenaltyTerminateAndCount(f, m, g) * b.PENALTY_N3;
739
+ }
740
+ for (let c = 0; c < this.size; c++) {
741
+ let f = !1, m = 0, g = [0, 0, 0, 0, 0, 0, 0];
742
+ for (let x = 0; x < this.size; x++)
743
+ this.modules[x][c] == f ? (m++, m == 5 ? s += b.PENALTY_N1 : m > 5 && s++) : (this.finderPenaltyAddHistory(m, g), f || (s += this.finderPenaltyCountPatterns(g) * b.PENALTY_N3), f = this.modules[x][c], m = 1);
744
+ s += this.finderPenaltyTerminateAndCount(f, m, g) * b.PENALTY_N3;
745
+ }
746
+ for (let c = 0; c < this.size - 1; c++)
747
+ for (let f = 0; f < this.size - 1; f++) {
748
+ const m = this.modules[c][f];
749
+ m == this.modules[c][f + 1] && m == this.modules[c + 1][f] && m == this.modules[c + 1][f + 1] && (s += b.PENALTY_N2);
750
+ }
751
+ let r = 0;
752
+ for (const c of this.modules)
753
+ r = c.reduce((f, m) => f + (m ? 1 : 0), r);
754
+ const n = this.size * this.size, o = Math.ceil(Math.abs(r * 20 - n * 10) / n) - 1;
755
+ return d(0 <= o && o <= 9), s += o * b.PENALTY_N4, d(0 <= s && s <= 2568888), s;
756
+ }
757
+ /*-- Private helper functions --*/
758
+ // Returns an ascending list of positions of alignment patterns for this version number.
759
+ // Each position is in the range [0,177), and are used on both the x and y axes.
760
+ // This could be implemented as lookup table of 40 variable-length lists of integers.
761
+ getAlignmentPatternPositions() {
762
+ if (this.version == 1)
763
+ return [];
764
+ {
765
+ const s = Math.floor(this.version / 7) + 2, r = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (s * 2 - 2)) * 2;
766
+ let n = [6];
767
+ for (let o = this.size - 7; n.length < s; o -= r)
768
+ n.splice(1, 0, o);
769
+ return n;
770
+ }
771
+ }
772
+ // Returns the number of data bits that can be stored in a QR Code of the given version number, after
773
+ // all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
774
+ // The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
775
+ static getNumRawDataModules(s) {
776
+ if (s < b.MIN_VERSION || s > b.MAX_VERSION)
777
+ throw new RangeError("Version number out of range");
778
+ let r = (16 * s + 128) * s + 64;
779
+ if (s >= 2) {
780
+ const n = Math.floor(s / 7) + 2;
781
+ r -= (25 * n - 10) * n - 55, s >= 7 && (r -= 36);
782
+ }
783
+ return d(208 <= r && r <= 29648), r;
784
+ }
785
+ // Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
786
+ // QR Code of the given version number and error correction level, with remainder bits discarded.
787
+ // This stateless pure function could be implemented as a (40*4)-cell lookup table.
788
+ static getNumDataCodewords(s, r) {
789
+ return Math.floor(b.getNumRawDataModules(s) / 8) - b.ECC_CODEWORDS_PER_BLOCK[r.ordinal][s] * b.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][s];
790
+ }
791
+ // Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
792
+ // implemented as a lookup table over all possible parameter values, instead of as an algorithm.
793
+ static reedSolomonComputeDivisor(s) {
794
+ if (s < 1 || s > 255)
795
+ throw new RangeError("Degree out of range");
796
+ let r = [];
797
+ for (let o = 0; o < s - 1; o++)
798
+ r.push(0);
799
+ r.push(1);
800
+ let n = 1;
801
+ for (let o = 0; o < s; o++) {
802
+ for (let c = 0; c < r.length; c++)
803
+ r[c] = b.reedSolomonMultiply(r[c], n), c + 1 < r.length && (r[c] ^= r[c + 1]);
804
+ n = b.reedSolomonMultiply(n, 2);
805
+ }
806
+ return r;
807
+ }
808
+ // Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
809
+ static reedSolomonComputeRemainder(s, r) {
810
+ let n = r.map((o) => 0);
811
+ for (const o of s) {
812
+ const c = o ^ n.shift();
813
+ n.push(0), r.forEach((f, m) => n[m] ^= b.reedSolomonMultiply(f, c));
814
+ }
815
+ return n;
816
+ }
817
+ // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
818
+ // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
819
+ static reedSolomonMultiply(s, r) {
820
+ if (s >>> 8 || r >>> 8)
821
+ throw new RangeError("Byte out of range");
822
+ let n = 0;
823
+ for (let o = 7; o >= 0; o--)
824
+ n = n << 1 ^ (n >>> 7) * 285, n ^= (r >>> o & 1) * s;
825
+ return d(n >>> 8 == 0), n;
826
+ }
827
+ // Can only be called immediately after a light run is added, and
828
+ // returns either 0, 1, or 2. A helper function for getPenaltyScore().
829
+ finderPenaltyCountPatterns(s) {
830
+ const r = s[1];
831
+ d(r <= this.size * 3);
832
+ const n = r > 0 && s[2] == r && s[3] == r * 3 && s[4] == r && s[5] == r;
833
+ return (n && s[0] >= r * 4 && s[6] >= r ? 1 : 0) + (n && s[6] >= r * 4 && s[0] >= r ? 1 : 0);
834
+ }
835
+ // Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
836
+ finderPenaltyTerminateAndCount(s, r, n) {
837
+ return s && (this.finderPenaltyAddHistory(r, n), r = 0), r += this.size, this.finderPenaltyAddHistory(r, n), this.finderPenaltyCountPatterns(n);
838
+ }
839
+ // Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
840
+ finderPenaltyAddHistory(s, r) {
841
+ r[0] == 0 && (s += this.size), r.pop(), r.unshift(s);
842
+ }
843
+ };
844
+ i.MIN_VERSION = 1, i.MAX_VERSION = 40, i.PENALTY_N1 = 3, i.PENALTY_N2 = 3, i.PENALTY_N3 = 40, i.PENALTY_N4 = 10, i.ECC_CODEWORDS_PER_BLOCK = [
845
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
846
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
847
+ [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
848
+ // Low
849
+ [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
850
+ // Medium
851
+ [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
852
+ // Quartile
853
+ [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
854
+ // High
855
+ ], i.NUM_ERROR_CORRECTION_BLOCKS = [
856
+ // Version: (note that index 0 is for padding, and is set to an illegal value)
857
+ //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
858
+ [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
859
+ // Low
860
+ [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
861
+ // Medium
862
+ [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
863
+ // Quartile
864
+ [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
865
+ // High
866
+ ], e.QrCode = i;
867
+ function t(p, s, r) {
868
+ if (s < 0 || s > 31 || p >>> s)
869
+ throw new RangeError("Value out of range");
870
+ for (let n = s - 1; n >= 0; n--)
871
+ r.push(p >>> n & 1);
872
+ }
873
+ function l(p, s) {
874
+ return (p >>> s & 1) != 0;
875
+ }
876
+ function d(p) {
877
+ if (!p)
878
+ throw new Error("Assertion error");
879
+ }
880
+ const u = class C {
881
+ /*-- Constructor (low level) and fields --*/
882
+ // Creates a new QR Code segment with the given attributes and data.
883
+ // The character count (numChars) must agree with the mode and the bit buffer length,
884
+ // but the constraint isn't checked. The given bit buffer is cloned and stored.
885
+ constructor(s, r, n) {
886
+ if (this.mode = s, this.numChars = r, this.bitData = n, r < 0)
887
+ throw new RangeError("Invalid argument");
888
+ this.bitData = n.slice();
889
+ }
890
+ /*-- Static factory functions (mid level) --*/
891
+ // Returns a segment representing the given binary data encoded in
892
+ // byte mode. All input byte arrays are acceptable. Any text string
893
+ // can be converted to UTF-8 bytes and encoded as a byte mode segment.
894
+ static makeBytes(s) {
895
+ let r = [];
896
+ for (const n of s)
897
+ t(n, 8, r);
898
+ return new C(C.Mode.BYTE, s.length, r);
899
+ }
900
+ // Returns a segment representing the given string of decimal digits encoded in numeric mode.
901
+ static makeNumeric(s) {
902
+ if (!C.isNumeric(s))
903
+ throw new RangeError("String contains non-numeric characters");
904
+ let r = [];
905
+ for (let n = 0; n < s.length; ) {
906
+ const o = Math.min(s.length - n, 3);
907
+ t(parseInt(s.substring(n, n + o), 10), o * 3 + 1, r), n += o;
908
+ }
909
+ return new C(C.Mode.NUMERIC, s.length, r);
910
+ }
911
+ // Returns a segment representing the given text string encoded in alphanumeric mode.
912
+ // The characters allowed are: 0 to 9, A to Z (uppercase only), space,
913
+ // dollar, percent, asterisk, plus, hyphen, period, slash, colon.
914
+ static makeAlphanumeric(s) {
915
+ if (!C.isAlphanumeric(s))
916
+ throw new RangeError("String contains unencodable characters in alphanumeric mode");
917
+ let r = [], n;
918
+ for (n = 0; n + 2 <= s.length; n += 2) {
919
+ let o = C.ALPHANUMERIC_CHARSET.indexOf(s.charAt(n)) * 45;
920
+ o += C.ALPHANUMERIC_CHARSET.indexOf(s.charAt(n + 1)), t(o, 11, r);
921
+ }
922
+ return n < s.length && t(C.ALPHANUMERIC_CHARSET.indexOf(s.charAt(n)), 6, r), new C(C.Mode.ALPHANUMERIC, s.length, r);
923
+ }
924
+ // Returns a new mutable list of zero or more segments to represent the given Unicode text string.
925
+ // The result may use various segment modes and switch modes to optimize the length of the bit stream.
926
+ static makeSegments(s) {
927
+ return s == "" ? [] : C.isNumeric(s) ? [C.makeNumeric(s)] : C.isAlphanumeric(s) ? [C.makeAlphanumeric(s)] : [C.makeBytes(C.toUtf8ByteArray(s))];
928
+ }
929
+ // Returns a segment representing an Extended Channel Interpretation
930
+ // (ECI) designator with the given assignment value.
931
+ static makeEci(s) {
932
+ let r = [];
933
+ if (s < 0)
934
+ throw new RangeError("ECI assignment value out of range");
935
+ if (s < 128)
936
+ t(s, 8, r);
937
+ else if (s < 16384)
938
+ t(2, 2, r), t(s, 14, r);
939
+ else if (s < 1e6)
940
+ t(6, 3, r), t(s, 21, r);
941
+ else
942
+ throw new RangeError("ECI assignment value out of range");
943
+ return new C(C.Mode.ECI, 0, r);
944
+ }
945
+ // Tests whether the given string can be encoded as a segment in numeric mode.
946
+ // A string is encodable iff each character is in the range 0 to 9.
947
+ static isNumeric(s) {
948
+ return C.NUMERIC_REGEX.test(s);
949
+ }
950
+ // Tests whether the given string can be encoded as a segment in alphanumeric mode.
951
+ // A string is encodable iff each character is in the following set: 0 to 9, A to Z
952
+ // (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
953
+ static isAlphanumeric(s) {
954
+ return C.ALPHANUMERIC_REGEX.test(s);
955
+ }
956
+ /*-- Methods --*/
957
+ // Returns a new copy of the data bits of this segment.
958
+ getData() {
959
+ return this.bitData.slice();
960
+ }
961
+ // (Package-private) Calculates and returns the number of bits needed to encode the given segments at
962
+ // the given version. The result is infinity if a segment has too many characters to fit its length field.
963
+ static getTotalBits(s, r) {
964
+ let n = 0;
965
+ for (const o of s) {
966
+ const c = o.mode.numCharCountBits(r);
967
+ if (o.numChars >= 1 << c)
968
+ return 1 / 0;
969
+ n += 4 + c + o.bitData.length;
970
+ }
971
+ return n;
972
+ }
973
+ // Returns a new array of bytes representing the given string encoded in UTF-8.
974
+ static toUtf8ByteArray(s) {
975
+ s = encodeURI(s);
976
+ let r = [];
977
+ for (let n = 0; n < s.length; n++)
978
+ s.charAt(n) != "%" ? r.push(s.charCodeAt(n)) : (r.push(parseInt(s.substring(n + 1, n + 3), 16)), n += 2);
979
+ return r;
980
+ }
981
+ };
982
+ u.NUMERIC_REGEX = /^[0-9]*$/, u.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, u.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
983
+ let h = u;
984
+ e.QrSegment = u;
985
+ })(T || (T = {}));
986
+ ((e) => {
987
+ ((i) => {
988
+ const t = class {
989
+ // The QR Code can tolerate about 30% erroneous codewords
990
+ /*-- Constructor and fields --*/
991
+ constructor(d, u) {
992
+ this.ordinal = d, this.formatBits = u;
993
+ }
994
+ };
995
+ t.LOW = new t(0, 1), t.MEDIUM = new t(1, 0), t.QUARTILE = new t(2, 3), t.HIGH = new t(3, 2), i.Ecc = t;
996
+ })(e.QrCode || (e.QrCode = {}));
997
+ })(T || (T = {}));
998
+ ((e) => {
999
+ ((i) => {
1000
+ const t = class {
1001
+ /*-- Constructor and fields --*/
1002
+ constructor(d, u) {
1003
+ this.modeBits = d, this.numBitsCharCount = u;
1004
+ }
1005
+ /*-- Method --*/
1006
+ // (Package-private) Returns the bit width of the character count field for a segment in
1007
+ // this mode in a QR Code at the given version number. The result is in the range [0, 16].
1008
+ numCharCountBits(d) {
1009
+ return this.numBitsCharCount[Math.floor((d + 7) / 17)];
1010
+ }
1011
+ };
1012
+ t.NUMERIC = new t(1, [10, 12, 14]), t.ALPHANUMERIC = new t(2, [9, 11, 13]), t.BYTE = new t(4, [8, 16, 16]), t.KANJI = new t(8, [8, 10, 12]), t.ECI = new t(7, [0, 0, 0]), i.Mode = t;
1013
+ })(e.QrSegment || (e.QrSegment = {}));
1014
+ })(T || (T = {}));
1015
+ var U = T;
1016
+ /**
1017
+ * @license qrcode.react
1018
+ * Copyright (c) Paul O'Shannessy
1019
+ * SPDX-License-Identifier: ISC
1020
+ */
1021
+ var Sr = {
1022
+ L: U.QrCode.Ecc.LOW,
1023
+ M: U.QrCode.Ecc.MEDIUM,
1024
+ Q: U.QrCode.Ecc.QUARTILE,
1025
+ H: U.QrCode.Ecc.HIGH
1026
+ }, Qe = 128, Ve = "L", He = "#FFFFFF", Ke = "#000000", Ge = !1, Ye = 1, Er = 4, Pr = 0, Ar = 0.1;
1027
+ function We(e, i = 0) {
1028
+ const t = [];
1029
+ return e.forEach(function(l, d) {
1030
+ let u = null;
1031
+ l.forEach(function(h, p) {
1032
+ if (!h && u !== null) {
1033
+ t.push(
1034
+ `M${u + i} ${d + i}h${p - u}v1H${u + i}z`
1035
+ ), u = null;
1036
+ return;
1037
+ }
1038
+ if (p === l.length - 1) {
1039
+ if (!h)
1040
+ return;
1041
+ u === null ? t.push(`M${p + i},${d + i} h1v1H${p + i}z`) : t.push(
1042
+ `M${u + i},${d + i} h${p + 1 - u}v1H${u + i}z`
1043
+ );
1044
+ return;
1045
+ }
1046
+ h && u === null && (u = p);
1047
+ });
1048
+ }), t.join("");
1049
+ }
1050
+ function Xe(e, i) {
1051
+ return e.slice().map((t, l) => l < i.y || l >= i.y + i.h ? t : t.map((d, u) => u < i.x || u >= i.x + i.w ? d : !1));
1052
+ }
1053
+ function Mr(e, i, t, l) {
1054
+ if (l == null)
1055
+ return null;
1056
+ const d = e.length + t * 2, u = Math.floor(i * Ar), h = d / i, p = (l.width || u) * h, s = (l.height || u) * h, r = l.x == null ? e.length / 2 - p / 2 : l.x * h, n = l.y == null ? e.length / 2 - s / 2 : l.y * h, o = l.opacity == null ? 1 : l.opacity;
1057
+ let c = null;
1058
+ if (l.excavate) {
1059
+ let m = Math.floor(r), g = Math.floor(n), x = Math.ceil(p + r - m), N = Math.ceil(s + n - g);
1060
+ c = { x: m, y: g, w: x, h: N };
1061
+ }
1062
+ const f = l.crossOrigin;
1063
+ return { x: r, y: n, h: s, w: p, excavation: c, opacity: o, crossOrigin: f };
1064
+ }
1065
+ function Rr(e, i) {
1066
+ return i != null ? Math.max(Math.floor(i), 0) : e ? Er : Pr;
1067
+ }
1068
+ function Ze({
1069
+ value: e,
1070
+ level: i,
1071
+ minVersion: t,
1072
+ includeMargin: l,
1073
+ marginSize: d,
1074
+ imageSettings: u,
1075
+ size: h,
1076
+ boostLevel: p
1077
+ }) {
1078
+ let s = S.useMemo(() => {
1079
+ const m = (Array.isArray(e) ? e : [e]).reduce((g, x) => (g.push(...U.QrSegment.makeSegments(x)), g), []);
1080
+ return U.QrCode.encodeSegments(
1081
+ m,
1082
+ Sr[i],
1083
+ t,
1084
+ void 0,
1085
+ void 0,
1086
+ p
1087
+ );
1088
+ }, [e, i, t, p]);
1089
+ const { cells: r, margin: n, numCells: o, calculatedImageSettings: c } = S.useMemo(() => {
1090
+ let f = s.getModules();
1091
+ const m = Rr(l, d), g = f.length + m * 2, x = Mr(
1092
+ f,
1093
+ h,
1094
+ m,
1095
+ u
1096
+ );
1097
+ return {
1098
+ cells: f,
1099
+ margin: m,
1100
+ numCells: g,
1101
+ calculatedImageSettings: x
1102
+ };
1103
+ }, [s, h, u, l, d]);
1104
+ return {
1105
+ qrcode: s,
1106
+ margin: n,
1107
+ cells: r,
1108
+ numCells: o,
1109
+ calculatedImageSettings: c
1110
+ };
1111
+ }
1112
+ var Lr = (function() {
1113
+ try {
1114
+ new Path2D().addPath(new Path2D());
1115
+ } catch {
1116
+ return !1;
1117
+ }
1118
+ return !0;
1119
+ })(), Fr = S.forwardRef(
1120
+ function(i, t) {
1121
+ const l = i, {
1122
+ value: d,
1123
+ size: u = Qe,
1124
+ level: h = Ve,
1125
+ bgColor: p = He,
1126
+ fgColor: s = Ke,
1127
+ includeMargin: r = Ge,
1128
+ minVersion: n = Ye,
1129
+ boostLevel: o,
1130
+ marginSize: c,
1131
+ imageSettings: f
1132
+ } = l, g = re(l, [
1133
+ "value",
1134
+ "size",
1135
+ "level",
1136
+ "bgColor",
1137
+ "fgColor",
1138
+ "includeMargin",
1139
+ "minVersion",
1140
+ "boostLevel",
1141
+ "marginSize",
1142
+ "imageSettings"
1143
+ ]), { style: x } = g, N = re(g, ["style"]), j = f?.src, _ = S.useRef(null), w = S.useRef(null), E = S.useCallback(
1144
+ (z) => {
1145
+ _.current = z, typeof t == "function" ? t(z) : t && (t.current = z);
1146
+ },
1147
+ [t]
1148
+ ), [I, A] = S.useState(!1), { margin: L, cells: y, numCells: Q, calculatedImageSettings: R } = Ze({
1149
+ value: d,
1150
+ level: h,
1151
+ minVersion: n,
1152
+ boostLevel: o,
1153
+ includeMargin: r,
1154
+ marginSize: c,
1155
+ imageSettings: f,
1156
+ size: u
1157
+ });
1158
+ S.useEffect(() => {
1159
+ if (_.current != null) {
1160
+ const z = _.current, k = z.getContext("2d");
1161
+ if (!k)
1162
+ return;
1163
+ let xe = y;
1164
+ const V = w.current, _e = R != null && V !== null && V.complete && V.naturalHeight !== 0 && V.naturalWidth !== 0;
1165
+ _e && R.excavation != null && (xe = Xe(
1166
+ y,
1167
+ R.excavation
1168
+ ));
1169
+ const be = window.devicePixelRatio || 1;
1170
+ z.height = z.width = u * be;
1171
+ const ye = u / Q * be;
1172
+ k.scale(ye, ye), k.fillStyle = p, k.fillRect(0, 0, Q, Q), k.fillStyle = s, Lr ? k.fill(new Path2D(We(xe, L))) : y.forEach(function(ct, dt) {
1173
+ ct.forEach(function(ut, ft) {
1174
+ ut && k.fillRect(ft + L, dt + L, 1, 1);
1175
+ });
1176
+ }), R && (k.globalAlpha = R.opacity), _e && k.drawImage(
1177
+ V,
1178
+ R.x + L,
1179
+ R.y + L,
1180
+ R.w,
1181
+ R.h
1182
+ );
1183
+ }
1184
+ }), S.useEffect(() => {
1185
+ A(!1);
1186
+ }, [j]);
1187
+ const lt = te({ height: u, width: u }, x);
1188
+ let ge = null;
1189
+ return j != null && (ge = /* @__PURE__ */ S.createElement(
1190
+ "img",
1191
+ {
1192
+ src: j,
1193
+ key: j,
1194
+ style: { display: "none" },
1195
+ onLoad: () => {
1196
+ A(!0);
1197
+ },
1198
+ ref: w,
1199
+ crossOrigin: R?.crossOrigin
1200
+ }
1201
+ )), /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement(
1202
+ "canvas",
1203
+ te({
1204
+ style: lt,
1205
+ height: u,
1206
+ width: u,
1207
+ ref: E,
1208
+ role: "img"
1209
+ }, N)
1210
+ ), ge);
1211
+ }
1212
+ );
1213
+ Fr.displayName = "QRCodeCanvas";
1214
+ var Je = S.forwardRef(
1215
+ function(i, t) {
1216
+ const l = i, {
1217
+ value: d,
1218
+ size: u = Qe,
1219
+ level: h = Ve,
1220
+ bgColor: p = He,
1221
+ fgColor: s = Ke,
1222
+ includeMargin: r = Ge,
1223
+ minVersion: n = Ye,
1224
+ boostLevel: o,
1225
+ title: c,
1226
+ marginSize: f,
1227
+ imageSettings: m
1228
+ } = l, g = re(l, [
1229
+ "value",
1230
+ "size",
1231
+ "level",
1232
+ "bgColor",
1233
+ "fgColor",
1234
+ "includeMargin",
1235
+ "minVersion",
1236
+ "boostLevel",
1237
+ "title",
1238
+ "marginSize",
1239
+ "imageSettings"
1240
+ ]), { margin: x, cells: N, numCells: j, calculatedImageSettings: _ } = Ze({
1241
+ value: d,
1242
+ level: h,
1243
+ minVersion: n,
1244
+ boostLevel: o,
1245
+ includeMargin: r,
1246
+ marginSize: f,
1247
+ imageSettings: m,
1248
+ size: u
1249
+ });
1250
+ let w = N, E = null;
1251
+ m != null && _ != null && (_.excavation != null && (w = Xe(
1252
+ N,
1253
+ _.excavation
1254
+ )), E = /* @__PURE__ */ S.createElement(
1255
+ "image",
1256
+ {
1257
+ href: m.src,
1258
+ height: _.h,
1259
+ width: _.w,
1260
+ x: _.x + x,
1261
+ y: _.y + x,
1262
+ preserveAspectRatio: "none",
1263
+ opacity: _.opacity,
1264
+ crossOrigin: _.crossOrigin
1265
+ }
1266
+ ));
1267
+ const I = We(w, x);
1268
+ return /* @__PURE__ */ S.createElement(
1269
+ "svg",
1270
+ te({
1271
+ height: u,
1272
+ width: u,
1273
+ viewBox: `0 0 ${j} ${j}`,
1274
+ ref: t,
1275
+ role: "img"
1276
+ }, g),
1277
+ !!c && /* @__PURE__ */ S.createElement("title", null, c),
1278
+ /* @__PURE__ */ S.createElement(
1279
+ "path",
1280
+ {
1281
+ fill: p,
1282
+ d: `M0,0 h${j}v${j}H0z`,
1283
+ shapeRendering: "crispEdges"
1284
+ }
1285
+ ),
1286
+ /* @__PURE__ */ S.createElement("path", { fill: s, d: I, shapeRendering: "crispEdges" }),
1287
+ E
1288
+ );
1289
+ }
1290
+ );
1291
+ Je.displayName = "QRCodeSVG";
1292
+ function Ir(e, i) {
1293
+ oe({ title: e, type: i });
1294
+ }
1295
+ function kr({
1296
+ onToast: e,
1297
+ /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */
1298
+ background: i,
1299
+ textColor: t,
1300
+ accentColor: l,
1301
+ padding: d,
1302
+ borderRadius: u,
1303
+ /* eslint-enable @typescript-eslint/no-unused-vars */
1304
+ ...h
1305
+ }) {
1306
+ const { currentSlug: p } = ie(), s = e ?? Ir, r = p.split("/")[1], n = r !== void 0, { data: o } = Pe(), c = o?.id, f = o === void 0;
1307
+ return /* @__PURE__ */ a.jsx("div", { ...h, children: /* @__PURE__ */ a.jsx(Lt, { children: /* @__PURE__ */ a.jsx(Ft, { children: /* @__PURE__ */ a.jsx(It, { children: n ? /* @__PURE__ */ a.jsx(
1308
+ kt,
1309
+ {
1310
+ token: r,
1311
+ onToast: s
1312
+ }
1313
+ ) : /* @__PURE__ */ a.jsx(
1314
+ Dt,
1315
+ {
1316
+ customerId: c,
1317
+ isLoadingCustomer: f,
1318
+ onToast: s
1319
+ }
1320
+ ) }) }) }) });
1321
+ }
1322
+ const ne = "profile/", Dr = /* @__PURE__ */ new Set(["orders", "subscriptions"]);
1323
+ function Ee(e) {
1324
+ return e.startsWith(ne) ? e.slice(ne.length) : e;
1325
+ }
1326
+ function Or({
1327
+ children: e
1328
+ }) {
1329
+ const { currentSlug: i, previousSlug: t, navigate: l } = ie();
1330
+ function d(u) {
1331
+ const h = u.split("/")[0] ?? "";
1332
+ l(Dr.has(h) ? `${ne}${u}` : u);
1333
+ }
1334
+ return /* @__PURE__ */ a.jsx(
1335
+ gt,
1336
+ {
1337
+ currentSlug: Ee(i),
1338
+ previousSlug: t === null ? null : Ee(t),
1339
+ navItems: [],
1340
+ basePath: "/profile",
1341
+ navigate: d,
1342
+ children: e
1343
+ }
1344
+ );
1345
+ }
1346
+ function et() {
1347
+ const e = Nt();
1348
+ return B({
1349
+ queryKey: _t.languages(),
1350
+ queryFn: async () => {
1351
+ const i = [];
1352
+ let t;
1353
+ const l = /* @__PURE__ */ new Set();
1354
+ do {
1355
+ if (t) {
1356
+ if (typeof t != "string" || l.has(t))
1357
+ throw new Error("Language pagination did not advance");
1358
+ l.add(t);
1359
+ }
1360
+ const d = await e.listLanguages({ limit: 100, cursor: t });
1361
+ i.push(...d.languages), t = d.meta.pagination?.next_cursor ?? void 0;
1362
+ } while (t);
1363
+ return i;
1364
+ }
1365
+ });
1366
+ }
1367
+ function tt() {
1368
+ const e = xt(), i = $(), { setLocale: t } = D();
1369
+ return q({
1370
+ mutationFn: (l) => e.updateAccount({ account: l }),
1371
+ onSuccess: (l, d) => {
1372
+ i.setQueryData(bt.detail(), l.account), d.language_iso && l.account.language_iso && t(l.account.language_iso);
1373
+ }
1374
+ });
1375
+ }
1376
+ function zr({
1377
+ account: e,
1378
+ onClose: i
1379
+ }) {
1380
+ const { t } = M(), { isMobile: l } = K(), d = ce(), u = et(), h = tt(), p = d.data?.allow_name_edit === !1, s = Gt(
1381
+ ee({
1382
+ first_name: p ? F() : F().min(1, t("first_name_is_required")),
1383
+ last_name: p ? F() : F().min(1, t("last_name_is_required")),
1384
+ phone_number: F().optional(),
1385
+ bio: F().optional(),
1386
+ language: F()
1387
+ }),
1388
+ {
1389
+ defaultValues: {
1390
+ first_name: e.first_name,
1391
+ last_name: e.last_name,
1392
+ phone_number: e.phone ?? "",
1393
+ bio: e.bio ?? "",
1394
+ language: e.language_iso ?? ""
1395
+ }
1396
+ }
1397
+ ), r = s.handleSubmit(async (n) => {
1398
+ if (!h.isPending)
1399
+ try {
1400
+ const o = await d.refetch({ throwOnError: !0 });
1401
+ await h.mutateAsync({
1402
+ ...o.data?.allow_name_edit !== !1 ? { first_name: n.first_name, last_name: n.last_name } : {},
1403
+ phone: n.phone_number ?? "",
1404
+ bio: n.bio ?? "",
1405
+ ...n.language ? { language_iso: n.language } : {}
1406
+ }), oe({ title: t("profile_updated"), type: "success" }), i();
1407
+ } catch {
1408
+ s.setError("root", { message: t("failed_to_update_profile") });
1409
+ }
1410
+ });
1411
+ return /* @__PURE__ */ a.jsx(
1412
+ jr,
1413
+ {
1414
+ control: s.control,
1415
+ isOpen: !0,
1416
+ onSubmit: () => {
1417
+ r();
1418
+ },
1419
+ handleClose: () => {
1420
+ !h.isPending && !s.formState.isSubmitting && i();
1421
+ },
1422
+ email: e.email,
1423
+ languageOptions: u.data?.map((n) => ({
1424
+ name: n.name,
1425
+ value: n.code
1426
+ })),
1427
+ errorMsg: s.formState.errors.root?.message ?? (u.error ? t("profile_languages_unavailable") : void 0),
1428
+ isSubmitting: h.isPending || s.formState.isSubmitting,
1429
+ disableNameEdit: p,
1430
+ presentation: l ? "bottom-sheet" : "dialog"
1431
+ }
1432
+ );
1433
+ }
1434
+ const ue = ["memberStorefront", "profile", "addresses"];
1435
+ function fe() {
1436
+ const e = O();
1437
+ return B({
1438
+ queryKey: ue,
1439
+ queryFn: () => e.fetchAddresses()
1440
+ });
1441
+ }
1442
+ function rt(e) {
1443
+ const i = Xt(), { locale: t } = D();
1444
+ return B({
1445
+ queryKey: ["memberStorefront", "profile", "countries", t],
1446
+ queryFn: () => i.listCountries({ languageIso: t }),
1447
+ enabled: e
1448
+ });
1449
+ }
1450
+ function Tr() {
1451
+ const e = O(), i = $();
1452
+ return q({
1453
+ mutationFn: async ({
1454
+ addressId: t,
1455
+ body: l
1456
+ }) => {
1457
+ if (t === void 0) return e.createAddress(l);
1458
+ await e.updateAddress(t, l);
1459
+ },
1460
+ onSuccess: () => i.invalidateQueries({ queryKey: ue })
1461
+ });
1462
+ }
1463
+ function Br() {
1464
+ const e = O(), i = $();
1465
+ return q({
1466
+ mutationFn: (t) => e.deleteAddress(t),
1467
+ onSuccess: () => i.invalidateQueries({ queryKey: ue })
1468
+ });
1469
+ }
1470
+ function me(e) {
1471
+ return {
1472
+ id: e.id,
1473
+ address1: e.street1,
1474
+ address2: e.street2,
1475
+ city: e.city,
1476
+ country_code: e.country,
1477
+ default: e.default,
1478
+ name: e.name,
1479
+ postal_code: e.zip,
1480
+ phone: e.phone ?? null,
1481
+ state: e.state,
1482
+ subdivision_code: null
1483
+ };
1484
+ }
1485
+ function nt({
1486
+ isOpen: e,
1487
+ onClose: i,
1488
+ selectedAddress: t,
1489
+ onAddressCreated: l
1490
+ }) {
1491
+ const { t: d } = M(), { isMobile: u } = K(), { locale: h } = D(), p = rt(e), s = fe(), r = Tr(), n = v.useCallback(
1492
+ (o) => Promise.resolve(
1493
+ p.data?.countries.find((c) => c.code === o)?.states.map((c) => ({
1494
+ name: c.name,
1495
+ isoCode: c.code
1496
+ })) ?? []
1497
+ ),
1498
+ [p.data]
1499
+ );
1500
+ if (e && p.error) throw p.error;
1501
+ return e && p.isPending ? /* @__PURE__ */ a.jsx("p", { role: "status", children: d("profile_loading") }) : /* @__PURE__ */ a.jsx(
1502
+ Ot,
1503
+ {
1504
+ isOpen: e,
1505
+ onClose: () => {
1506
+ r.isPending || (r.reset(), i());
1507
+ },
1508
+ selectedAddress: t,
1509
+ presentation: u ? "bottom-sheet" : "dialog",
1510
+ defaultCountry: t?.country_code ?? s.data?.addresses.find((o) => o.default)?.country ?? "US",
1511
+ languageIso: h,
1512
+ countries: p.data?.countries.map((o) => ({
1513
+ iso: o.code,
1514
+ name: o.name
1515
+ })),
1516
+ fetchStates: n,
1517
+ t: (o) => d(o),
1518
+ isSubmitting: r.isPending,
1519
+ error: r.error ? d(
1520
+ t ? "failed_to_update_address" : "failed_to_create_address"
1521
+ ) : p.error ? d("unexpected_error") : void 0,
1522
+ onSubmit: (o) => {
1523
+ if (r.isPending) return;
1524
+ const c = o.address;
1525
+ r.mutate(
1526
+ {
1527
+ addressId: t?.id,
1528
+ body: {
1529
+ address: {
1530
+ name: c.name,
1531
+ street1: c.address1,
1532
+ street2: c.address2,
1533
+ city: c.city,
1534
+ state: c.state,
1535
+ zip: c.postal_code,
1536
+ country: c.country_code,
1537
+ phone: c.phone,
1538
+ default: c.default
1539
+ }
1540
+ }
1541
+ },
1542
+ {
1543
+ onSuccess: (f) => {
1544
+ f && l?.(me(f)), r.reset(), i();
1545
+ }
1546
+ }
1547
+ );
1548
+ }
1549
+ }
1550
+ );
1551
+ }
1552
+ function Ur() {
1553
+ const { t: e } = M(), i = fe(), t = Br(), l = v.useRef(null), [d, u] = v.useState(), [h, p] = v.useState(null);
1554
+ if (i.error) throw i.error;
1555
+ function s() {
1556
+ requestAnimationFrame(() => l.current?.focus());
1557
+ }
1558
+ return /* @__PURE__ */ a.jsxs(
1559
+ "div",
1560
+ {
1561
+ ref: l,
1562
+ role: "region",
1563
+ tabIndex: -1,
1564
+ "aria-label": e("shipping_addresses"),
1565
+ className: "space-y-4 outline-none",
1566
+ children: [
1567
+ i.isPending && /* @__PURE__ */ a.jsx("p", { role: "status", className: "text-muted-foreground text-sm", children: e("profile_loading") }),
1568
+ !i.isPending && !i.data?.addresses.length && /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-sm", children: e("no_saved_addresses_found") }),
1569
+ i.data?.addresses.map((r) => /* @__PURE__ */ a.jsxs(
1570
+ "section",
1571
+ {
1572
+ "aria-label": r.street1,
1573
+ className: "bg-card text-card-foreground border-border space-y-4 rounded-xl border p-5",
1574
+ children: [
1575
+ /* @__PURE__ */ a.jsxs("div", { className: "space-y-1 text-sm", children: [
1576
+ /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
1577
+ /* @__PURE__ */ a.jsx("p", { className: "font-medium", children: r.name }),
1578
+ r.default && /* @__PURE__ */ a.jsx(Me, { variant: "secondary", children: e("default") })
1579
+ ] }),
1580
+ /* @__PURE__ */ a.jsx("p", { children: r.street1 }),
1581
+ r.street2 && /* @__PURE__ */ a.jsx("p", { children: r.street2 }),
1582
+ /* @__PURE__ */ a.jsx("p", { children: [r.city, r.state, r.zip].filter(Boolean).join(", ") }),
1583
+ /* @__PURE__ */ a.jsx("p", { children: r.country })
1584
+ ] }),
1585
+ /* @__PURE__ */ a.jsxs("div", { className: "flex gap-2", children: [
1586
+ /* @__PURE__ */ a.jsx(
1587
+ P,
1588
+ {
1589
+ variant: "outline",
1590
+ size: "sm",
1591
+ onClick: () => u(r),
1592
+ children: e("edit_address")
1593
+ }
1594
+ ),
1595
+ !r.default && /* @__PURE__ */ a.jsx(
1596
+ P,
1597
+ {
1598
+ variant: "ghost",
1599
+ size: "sm",
1600
+ onClick: () => {
1601
+ t.reset(), p(r);
1602
+ },
1603
+ children: e("delete_address")
1604
+ }
1605
+ )
1606
+ ] })
1607
+ ]
1608
+ },
1609
+ r.id
1610
+ )),
1611
+ /* @__PURE__ */ a.jsx(P, { onClick: () => u(null), children: e("add_address") }),
1612
+ d !== void 0 && /* @__PURE__ */ a.jsx(
1613
+ nt,
1614
+ {
1615
+ isOpen: !0,
1616
+ selectedAddress: d ? me(d) : null,
1617
+ onClose: () => {
1618
+ u(void 0), s();
1619
+ }
1620
+ }
1621
+ ),
1622
+ /* @__PURE__ */ a.jsx(
1623
+ Re,
1624
+ {
1625
+ title: e("delete_address"),
1626
+ description: e("delete_address_message"),
1627
+ actionText: e("delete"),
1628
+ openDialog: h !== null,
1629
+ setOpenDialog: (r) => {
1630
+ !r && !t.isPending && (p(null), s());
1631
+ },
1632
+ isLoading: t.isPending,
1633
+ errorMsg: t.error ? e("unable_to_delete_address") : void 0,
1634
+ onAction: () => {
1635
+ !h || t.isPending || t.mutate(h.id, {
1636
+ onSuccess: () => {
1637
+ p(null), s();
1638
+ }
1639
+ });
1640
+ }
1641
+ }
1642
+ )
1643
+ ]
1644
+ }
1645
+ );
1646
+ }
1647
+ function st() {
1648
+ const e = O();
1649
+ return B({
1650
+ queryKey: ["memberStorefront", "profile", "points"],
1651
+ queryFn: async () => {
1652
+ try {
1653
+ return await e.fetchPointsLedgers();
1654
+ } catch (i) {
1655
+ if (typeof i == "object" && i !== null && "status" in i && i.status === 403)
1656
+ return null;
1657
+ throw i;
1658
+ }
1659
+ }
1660
+ });
1661
+ }
1662
+ function $r() {
1663
+ const { t: e } = M(), { locale: i } = D(), t = st(), l = ce();
1664
+ if (t.error) throw t.error;
1665
+ if (t.isPending || !l.data)
1666
+ return /* @__PURE__ */ a.jsx("p", { role: "status", children: e("profile_loading") });
1667
+ if (!t.data)
1668
+ return /* @__PURE__ */ a.jsx("p", { role: "status", children: e("profile_points_unavailable") });
1669
+ const d = t.data.points_ledgers, u = d[0]?.total_balance ?? 0, h = u === 1 ? l.data.reward_points_label_singular : l.data.reward_points_label_plural, p = l.data.reward_points_label_plural, s = h.charAt(0).toLocaleUpperCase(i) + h.slice(1), r = p.charAt(0).toLocaleUpperCase(i) + p.slice(1), n = new Intl.NumberFormat(i), o = new Intl.DateTimeFormat(i, { dateStyle: "medium" });
1670
+ return /* @__PURE__ */ a.jsxs("div", { className: "space-y-6", children: [
1671
+ /* @__PURE__ */ a.jsxs("section", { className: "bg-card text-card-foreground border-border space-y-2 rounded-xl border p-6", children: [
1672
+ /* @__PURE__ */ a.jsx("h2", { className: "text-muted-foreground text-sm", children: e("points_available", { label: s }) }),
1673
+ /* @__PURE__ */ a.jsx("p", { className: "text-4xl font-semibold tabular-nums", children: n.format(u) })
1674
+ ] }),
1675
+ /* @__PURE__ */ a.jsxs("section", { className: "space-y-3", children: [
1676
+ /* @__PURE__ */ a.jsx("h2", { className: "font-semibold", children: e("points_history", { label: r }) }),
1677
+ d.length ? /* @__PURE__ */ a.jsx("ol", { className: "border-border divide-border divide-y rounded-xl border", children: d.map((c) => /* @__PURE__ */ a.jsxs(
1678
+ "li",
1679
+ {
1680
+ className: "flex items-center justify-between gap-4 p-4",
1681
+ children: [
1682
+ /* @__PURE__ */ a.jsxs("div", { className: "space-y-1", children: [
1683
+ /* @__PURE__ */ a.jsx("p", { className: "text-sm font-medium", children: c.metadata?.transaction_type === "order_refund" ? e("profile_points_refunded", { label: r }) : e(
1684
+ c.amount > 0 ? "points_awarded" : "points_redeemed",
1685
+ { label: r }
1686
+ ) }),
1687
+ /* @__PURE__ */ a.jsx(
1688
+ "time",
1689
+ {
1690
+ className: "text-muted-foreground text-xs",
1691
+ dateTime: c.created_at,
1692
+ children: o.format(new Date(c.created_at))
1693
+ }
1694
+ )
1695
+ ] }),
1696
+ /* @__PURE__ */ a.jsxs("span", { className: "font-medium tabular-nums", children: [
1697
+ c.amount > 0 ? "+" : "",
1698
+ n.format(c.amount)
1699
+ ] })
1700
+ ]
1701
+ },
1702
+ c.id
1703
+ )) }) : /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-sm", children: e("no_points_history_found", { label: r }) })
1704
+ ] })
1705
+ ] });
1706
+ }
1707
+ function qr({
1708
+ children: e
1709
+ }) {
1710
+ const i = v.useRef(null), [t, l] = v.useState(null);
1711
+ return v.useEffect(() => {
1712
+ if (!i.current) return;
1713
+ const d = zt(i.current);
1714
+ return l(d), () => d.remove();
1715
+ }, []), /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1716
+ /* @__PURE__ */ a.jsx("span", { ref: i, hidden: !0 }),
1717
+ t && yt.createPortal(
1718
+ /* @__PURE__ */ a.jsx(vt, { container: t, children: e }),
1719
+ t
1720
+ )
1721
+ ] });
1722
+ }
1723
+ function Qr({
1724
+ onClose: e
1725
+ }) {
1726
+ const i = fe(), { t } = M(), { isMobile: l } = K();
1727
+ return /* @__PURE__ */ a.jsx(qr, { children: i.data ? /* @__PURE__ */ a.jsx(
1728
+ Vr,
1729
+ {
1730
+ initialAddresses: i.data.addresses,
1731
+ onClose: e
1732
+ }
1733
+ ) : /* @__PURE__ */ a.jsxs(
1734
+ Fe,
1735
+ {
1736
+ open: !0,
1737
+ onOpenChange: (d) => {
1738
+ d || e();
1739
+ },
1740
+ title: t("add_payment_method"),
1741
+ presentation: l ? "bottom-sheet" : "dialog",
1742
+ children: [
1743
+ /* @__PURE__ */ a.jsx("p", { role: i.error ? "alert" : "status", children: t(i.error ? "unexpected_error" : "profile_loading") }),
1744
+ i.error && /* @__PURE__ */ a.jsx(
1745
+ P,
1746
+ {
1747
+ disabled: i.isFetching,
1748
+ onClick: () => {
1749
+ i.refetch();
1750
+ },
1751
+ children: t("profile_try_again")
1752
+ }
1753
+ )
1754
+ ]
1755
+ }
1756
+ ) });
1757
+ }
1758
+ function Vr({
1759
+ initialAddresses: e,
1760
+ onClose: i
1761
+ }) {
1762
+ const { t } = M(), { isMobile: l } = K(), d = O(), u = $(), [h, p] = v.useState(), s = v.useMemo(() => Tt(d), [d]), [r] = v.useState(
1763
+ () => e.map(me)
1764
+ );
1765
+ async function n() {
1766
+ await u.invalidateQueries({ queryKey: Y.paymentMethods.all }), i();
1767
+ }
1768
+ const o = Bt({
1769
+ payApi: d,
1770
+ t: (f) => t(f),
1771
+ onApproved: n,
1772
+ onFailed: p,
1773
+ onCanceled: () => {
1774
+ }
1775
+ }), c = q({
1776
+ mutationFn: (f) => d.createPaymentMethod({
1777
+ payment_method: {
1778
+ ...f.payment_method,
1779
+ type: "card",
1780
+ token_provider: qt,
1781
+ default: f.set_as_default
1782
+ },
1783
+ billing_address_id: f.billing_address_id,
1784
+ browser_info: $t()
1785
+ }),
1786
+ onSuccess: async (f) => {
1787
+ Ut(f) ? await o.begin(f) : await n();
1788
+ },
1789
+ onError: () => p(t("failed_to_add_payment_method"))
1790
+ });
1791
+ return /* @__PURE__ */ a.jsxs(Qt, { api: s, children: [
1792
+ /* @__PURE__ */ a.jsx(
1793
+ Vt,
1794
+ {
1795
+ isOpen: !0,
1796
+ jwt: "",
1797
+ savedAddresses: r,
1798
+ defaultBillingAddressId: r.find((f) => f.default)?.id,
1799
+ presentation: l ? "bottom-sheet" : "dialog",
1800
+ t: (f) => t(f),
1801
+ error: h,
1802
+ isSubmitting: c.isPending || o.isActive,
1803
+ preventClose: c.isPending || o.isActive,
1804
+ onClose: () => {
1805
+ !c.isPending && !o.isActive && i();
1806
+ },
1807
+ onSubmit: (f) => {
1808
+ c.isPending || o.isActive || (p(void 0), c.mutate(f));
1809
+ },
1810
+ renderAddressFormDialog: ({
1811
+ isOpen: f,
1812
+ onClose: m,
1813
+ onAddressCreated: g
1814
+ }) => f ? /* @__PURE__ */ a.jsx(
1815
+ nt,
1816
+ {
1817
+ isOpen: !0,
1818
+ onClose: m,
1819
+ selectedAddress: null,
1820
+ onAddressCreated: g
1821
+ }
1822
+ ) : null
1823
+ }
1824
+ ),
1825
+ o.modal
1826
+ ] });
1827
+ }
1828
+ function at() {
1829
+ const e = O();
1830
+ return B({
1831
+ queryKey: Y.paymentMethods.list(),
1832
+ queryFn: () => e.fetchPaymentMethods()
1833
+ });
1834
+ }
1835
+ function it() {
1836
+ const e = O(), i = $();
1837
+ return q({
1838
+ mutationFn: ({ id: t, body: l }) => e.updatePaymentMethod(t, l),
1839
+ onSuccess: () => i.invalidateQueries({ queryKey: Y.paymentMethods.all })
1840
+ });
1841
+ }
1842
+ function Hr() {
1843
+ const e = O(), i = $();
1844
+ return q({
1845
+ mutationFn: (t) => e.deletePaymentMethod(t),
1846
+ onSuccess: () => i.invalidateQueries({ queryKey: Y.paymentMethods.all })
1847
+ });
1848
+ }
1849
+ function Kr({
1850
+ card: e,
1851
+ onClose: i
1852
+ }) {
1853
+ const { t } = M(), { locale: l } = D(), { isMobile: d } = K(), u = rt(!0), h = it(), p = v.useMemo(() => Ht(e), [e]), s = v.useCallback(
1854
+ (r) => Promise.resolve(
1855
+ u.data?.countries.find((n) => n.code === r)?.states.map((n) => ({
1856
+ name: n.name,
1857
+ isoCode: n.code
1858
+ })) ?? []
1859
+ ),
1860
+ [u.data]
1861
+ );
1862
+ if (u.error) throw u.error;
1863
+ return u.isPending ? /* @__PURE__ */ a.jsx("p", { role: "status", children: t("profile_loading") }) : /* @__PURE__ */ a.jsx(
1864
+ Kt,
1865
+ {
1866
+ isOpen: !0,
1867
+ paymentMethod: p,
1868
+ billingAddress: p.billing_address,
1869
+ countries: u.data?.countries.map((r) => ({
1870
+ iso: r.code,
1871
+ name: r.name
1872
+ })),
1873
+ fetchStates: s,
1874
+ languageIso: l,
1875
+ presentation: d ? "bottom-sheet" : "dialog",
1876
+ isSubmitting: h.isPending,
1877
+ error: h.error ? t("failed_to_update_payment_method") : void 0,
1878
+ onClose: () => {
1879
+ h.isPending || i();
1880
+ },
1881
+ onSubmit: (r) => {
1882
+ if (h.isPending) return;
1883
+ const n = r.billing_address;
1884
+ h.mutate(
1885
+ {
1886
+ id: e.id,
1887
+ body: {
1888
+ payment_method: {
1889
+ default: r.set_as_default,
1890
+ billing_address: {
1891
+ name: n.name,
1892
+ street1: n.address1,
1893
+ street2: n.address2,
1894
+ city: n.city,
1895
+ state: n.state,
1896
+ zip: n.zip,
1897
+ country: n.country_code
1898
+ }
1899
+ }
1900
+ }
1901
+ },
1902
+ { onSuccess: i }
1903
+ );
1904
+ }
1905
+ }
1906
+ );
1907
+ }
1908
+ function Gr() {
1909
+ const { t: e } = M(), { preview: i } = le(), t = at(), l = it(), d = Hr(), u = v.useRef(null), h = v.useRef(null), [p, s] = v.useState(!1), [r, n] = v.useState(null), [o, c] = v.useState(null);
1910
+ function f() {
1911
+ requestAnimationFrame(() => {
1912
+ (u.current?.isConnected ? u.current : h.current?.querySelector("button") ?? h.current)?.focus();
1913
+ });
1914
+ }
1915
+ return /* @__PURE__ */ a.jsxs(
1916
+ "div",
1917
+ {
1918
+ ref: h,
1919
+ role: "region",
1920
+ tabIndex: -1,
1921
+ "aria-label": e("payment_methods"),
1922
+ className: "space-y-4 outline-none",
1923
+ children: [
1924
+ t.isPending && /* @__PURE__ */ a.jsx("p", { role: "status", children: e("profile_loading") }),
1925
+ t.error && /* @__PURE__ */ a.jsxs("div", { role: "alert", className: "space-y-3", children: [
1926
+ /* @__PURE__ */ a.jsx("p", { children: e("profile_payments_load_failed") }),
1927
+ /* @__PURE__ */ a.jsx(
1928
+ P,
1929
+ {
1930
+ variant: "outline",
1931
+ disabled: t.isFetching,
1932
+ onClick: () => {
1933
+ t.refetch();
1934
+ },
1935
+ children: e("profile_payments_retry")
1936
+ }
1937
+ )
1938
+ ] }),
1939
+ t.data?.payment_methods.length === 0 && /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-sm", children: e("profile_no_saved_cards") }),
1940
+ t.data?.payment_methods.map((m) => /* @__PURE__ */ a.jsxs(
1941
+ "section",
1942
+ {
1943
+ className: "bg-card text-card-foreground border-border space-y-4 rounded-xl border p-5",
1944
+ children: [
1945
+ /* @__PURE__ */ a.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
1946
+ /* @__PURE__ */ a.jsx("h2", { className: "font-medium", children: e("profile_card_ending", {
1947
+ brand: m.brand || e("card_fallback"),
1948
+ lastFour: m.last_four
1949
+ }) }),
1950
+ m.default && /* @__PURE__ */ a.jsx(Me, { variant: "secondary", children: e("default") })
1951
+ ] }),
1952
+ m.exp_month !== null && m.exp_year !== null && /* @__PURE__ */ a.jsxs("p", { className: "text-muted-foreground text-sm", children: [
1953
+ e("card_expires"),
1954
+ " ",
1955
+ m.exp_month,
1956
+ "/",
1957
+ m.exp_year
1958
+ ] }),
1959
+ /* @__PURE__ */ a.jsxs("div", { className: "flex flex-wrap gap-2", children: [
1960
+ /* @__PURE__ */ a.jsx(
1961
+ P,
1962
+ {
1963
+ variant: "outline",
1964
+ size: "sm",
1965
+ onClick: (g) => {
1966
+ u.current = g.currentTarget, n(m);
1967
+ },
1968
+ disabled: i || l.isPending || d.isPending,
1969
+ children: e("edit_card")
1970
+ }
1971
+ ),
1972
+ !m.default && /* @__PURE__ */ a.jsx(
1973
+ P,
1974
+ {
1975
+ variant: "outline",
1976
+ size: "sm",
1977
+ disabled: i || l.isPending || d.isPending,
1978
+ onClick: () => {
1979
+ l.isPending || l.mutate({
1980
+ id: m.id,
1981
+ body: { payment_method: { default: !0 } }
1982
+ });
1983
+ },
1984
+ children: e("set_as_default_payment_method")
1985
+ }
1986
+ ),
1987
+ /* @__PURE__ */ a.jsx(
1988
+ P,
1989
+ {
1990
+ variant: "ghost",
1991
+ size: "sm",
1992
+ disabled: i || l.isPending || d.isPending,
1993
+ onClick: (g) => {
1994
+ u.current = g.currentTarget, d.reset(), c(m);
1995
+ },
1996
+ children: e("delete_card")
1997
+ }
1998
+ )
1999
+ ] })
2000
+ ]
2001
+ },
2002
+ m.id
2003
+ )),
2004
+ l.error && /* @__PURE__ */ a.jsx("p", { role: "alert", className: "text-destructive text-sm", children: e("failed_to_set_default_payment_method") }),
2005
+ /* @__PURE__ */ a.jsx(
2006
+ P,
2007
+ {
2008
+ onClick: (m) => {
2009
+ u.current = m.currentTarget, s(!0);
2010
+ },
2011
+ disabled: i || l.isPending || d.isPending,
2012
+ children: e("add_payment_method")
2013
+ }
2014
+ ),
2015
+ p && /* @__PURE__ */ a.jsx(
2016
+ Qr,
2017
+ {
2018
+ onClose: () => {
2019
+ s(!1), f();
2020
+ }
2021
+ }
2022
+ ),
2023
+ r && /* @__PURE__ */ a.jsx(
2024
+ Kr,
2025
+ {
2026
+ card: r,
2027
+ onClose: () => {
2028
+ n(null), f();
2029
+ }
2030
+ }
2031
+ ),
2032
+ /* @__PURE__ */ a.jsx(
2033
+ Re,
2034
+ {
2035
+ title: e("delete_credit_card"),
2036
+ description: e("delete_credit_card_message"),
2037
+ actionText: e("delete"),
2038
+ openDialog: o !== null,
2039
+ setOpenDialog: (m) => {
2040
+ !m && !d.isPending && (c(null), f());
2041
+ },
2042
+ isLoading: d.isPending,
2043
+ errorMsg: d.error ? e("unable_to_delete_payment_method") : void 0,
2044
+ onAction: () => {
2045
+ o && !d.isPending && d.mutate(o.id, {
2046
+ onSuccess: () => {
2047
+ c(null), f();
2048
+ }
2049
+ });
2050
+ }
2051
+ }
2052
+ )
2053
+ ]
2054
+ }
2055
+ );
2056
+ }
2057
+ function he({
2058
+ icon: e,
2059
+ label: i,
2060
+ detail: t,
2061
+ busy: l,
2062
+ onOpen: d,
2063
+ triggerRef: u
2064
+ }) {
2065
+ return /* @__PURE__ */ a.jsxs(
2066
+ "button",
2067
+ {
2068
+ type: "button",
2069
+ ref: u,
2070
+ onClick: d,
2071
+ className: "bg-card text-card-foreground border-border hover:bg-muted focus-visible:ring-ring flex min-h-20 w-full items-center gap-4 rounded-xl border p-5 text-left focus-visible:ring-2",
2072
+ children: [
2073
+ /* @__PURE__ */ a.jsx(e, { "aria-hidden": "true", className: "size-5" }),
2074
+ /* @__PURE__ */ a.jsxs("span", { className: "flex-1 space-y-1", children: [
2075
+ /* @__PURE__ */ a.jsx("span", { className: "block font-medium", children: i }),
2076
+ /* @__PURE__ */ a.jsx(
2077
+ "span",
2078
+ {
2079
+ className: "text-muted-foreground block text-sm",
2080
+ role: l ? "status" : void 0,
2081
+ children: t
2082
+ }
2083
+ )
2084
+ ] }),
2085
+ /* @__PURE__ */ a.jsx(
2086
+ Ae,
2087
+ {
2088
+ "aria-hidden": "true",
2089
+ className: "text-muted-foreground size-4"
2090
+ }
2091
+ )
2092
+ ]
2093
+ }
2094
+ );
2095
+ }
2096
+ function pe({
2097
+ message: e,
2098
+ retryLabel: i,
2099
+ isRetrying: t,
2100
+ onRetry: l
2101
+ }) {
2102
+ return /* @__PURE__ */ a.jsxs("div", { role: "alert", className: "border-border space-y-3 rounded-xl border p-5", children: [
2103
+ /* @__PURE__ */ a.jsx("p", { className: "text-sm", children: e }),
2104
+ /* @__PURE__ */ a.jsx(
2105
+ P,
2106
+ {
2107
+ variant: "outline",
2108
+ size: "sm",
2109
+ disabled: t,
2110
+ onClick: l,
2111
+ children: i
2112
+ }
2113
+ )
2114
+ ] });
2115
+ }
2116
+ function Yr({
2117
+ onOpen: e,
2118
+ triggerRef: i
2119
+ }) {
2120
+ const { t } = M(), l = at(), d = l.data?.payment_methods.find((u) => u.default);
2121
+ return l.error ? /* @__PURE__ */ a.jsx(
2122
+ pe,
2123
+ {
2124
+ message: t("profile_payments_load_failed"),
2125
+ retryLabel: t("profile_payments_retry"),
2126
+ isRetrying: l.isFetching,
2127
+ onRetry: () => void l.refetch()
2128
+ }
2129
+ ) : /* @__PURE__ */ a.jsx(
2130
+ he,
2131
+ {
2132
+ icon: Ie,
2133
+ label: t("profile_default_payment"),
2134
+ detail: l.isPending ? t("profile_loading") : d ? t("profile_card_ending", {
2135
+ brand: d.brand || t("card_fallback"),
2136
+ lastFour: d.last_four
2137
+ }) : t("profile_no_default_payment"),
2138
+ busy: l.isPending,
2139
+ onOpen: e,
2140
+ triggerRef: i
2141
+ }
2142
+ );
2143
+ }
2144
+ function ot(e, i, t) {
2145
+ const l = {
2146
+ dateStyle: "medium",
2147
+ ...t ? { timeZone: t } : {}
2148
+ };
2149
+ try {
2150
+ return new Intl.DateTimeFormat(i, l).format(e);
2151
+ } catch {
2152
+ return new Intl.DateTimeFormat("en-US", l).format(e);
2153
+ }
2154
+ }
2155
+ function Wr(e, i) {
2156
+ if (!e) return null;
2157
+ const t = new Date(e);
2158
+ return Number.isNaN(t.getTime()) ? null : ot(t, i);
2159
+ }
2160
+ function Xr(e, i) {
2161
+ if (!e) return null;
2162
+ const t = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`);
2163
+ return Number.isNaN(t.getTime()) ? null : ot(t, i, "UTC");
2164
+ }
2165
+ const Zr = ee({
2166
+ subscription: ee({
2167
+ token: F(),
2168
+ plan_name: F().nullish(),
2169
+ next_billing_date: F().nullish()
2170
+ }).nullish()
2171
+ });
2172
+ async function Jr(e = jt) {
2173
+ const i = await e(
2174
+ "/api/member-storefront/subscriptions/next",
2175
+ {
2176
+ headers: { Accept: "application/json" },
2177
+ credentials: "same-origin"
2178
+ }
2179
+ );
2180
+ if (!i.ok)
2181
+ throw new Error(`Next subscription request failed (${i.status})`);
2182
+ const { subscription: t } = Zr.parse(await i.json());
2183
+ return t ? {
2184
+ token: t.token,
2185
+ planName: t.plan_name ?? null,
2186
+ nextBillingDate: t.next_billing_date ?? null
2187
+ } : null;
2188
+ }
2189
+ function en() {
2190
+ const e = St(), i = v.useMemo(() => Et(e), [e]);
2191
+ return B({
2192
+ queryKey: ["memberStorefront", "profile", "latest-order"],
2193
+ queryFn: async () => (await i.fetchCustomerOrders({ limit: 1 })).orders[0] ?? null
2194
+ });
2195
+ }
2196
+ function tn() {
2197
+ const { fetch: e } = le();
2198
+ return B({
2199
+ queryKey: ["memberStorefront", "profile", "next-subscription"],
2200
+ queryFn: () => Jr(e)
2201
+ });
2202
+ }
2203
+ function rn({
2204
+ onOpen: e,
2205
+ triggerRef: i
2206
+ }) {
2207
+ const { t } = M(), { locale: l } = D(), d = en();
2208
+ if (d.error)
2209
+ return /* @__PURE__ */ a.jsx(
2210
+ pe,
2211
+ {
2212
+ message: t("profile_orders_load_failed"),
2213
+ retryLabel: t("profile_orders_retry"),
2214
+ isRetrying: d.isFetching,
2215
+ onRetry: () => void d.refetch()
2216
+ }
2217
+ );
2218
+ const u = d.data, h = d.isPending ? t("profile_loading") : u ? [
2219
+ u.order_number ? `#${u.order_number}` : null,
2220
+ Wr(u.created_at, l)
2221
+ ].filter(Boolean).join(" · ") || t("profile_view_orders") : t("profile_no_orders");
2222
+ return /* @__PURE__ */ a.jsx(
2223
+ he,
2224
+ {
2225
+ icon: Le,
2226
+ label: t("profile_latest_order"),
2227
+ detail: h,
2228
+ busy: d.isPending,
2229
+ onOpen: () => e(u?.token ?? null),
2230
+ triggerRef: i
2231
+ }
2232
+ );
2233
+ }
2234
+ function nn({
2235
+ onOpen: e,
2236
+ triggerRef: i
2237
+ }) {
2238
+ const { t } = M(), { locale: l } = D(), d = tn();
2239
+ if (d.error)
2240
+ return /* @__PURE__ */ a.jsx(
2241
+ pe,
2242
+ {
2243
+ message: t("profile_subscription_load_failed"),
2244
+ retryLabel: t("profile_subscription_retry"),
2245
+ isRetrying: d.isFetching,
2246
+ onRetry: () => void d.refetch()
2247
+ }
2248
+ );
2249
+ const u = d.data, h = Xr(u?.nextBillingDate, l), p = d.isPending ? t("profile_loading") : u ? [
2250
+ u.planName,
2251
+ h ? t("profile_next_bill_on", { date: h }) : null
2252
+ ].filter(Boolean).join(" · ") || t("profile_view_subscriptions") : t("profile_no_next_subscription");
2253
+ return /* @__PURE__ */ a.jsx(
2254
+ he,
2255
+ {
2256
+ icon: ke,
2257
+ label: t("profile_next_subscription"),
2258
+ detail: p,
2259
+ busy: d.isPending,
2260
+ onOpen: () => e(u?.token ?? null),
2261
+ triggerRef: i
2262
+ }
2263
+ );
2264
+ }
2265
+ function sn({
2266
+ onOpenPayment: e,
2267
+ paymentTriggerRef: i,
2268
+ onOpenOrder: t,
2269
+ orderTriggerRef: l,
2270
+ onOpenSubscription: d,
2271
+ subscriptionTriggerRef: u
2272
+ }) {
2273
+ const { t: h } = M();
2274
+ return /* @__PURE__ */ a.jsxs("section", { "aria-label": h("profile_at_a_glance"), className: "space-y-3", children: [
2275
+ /* @__PURE__ */ a.jsx("h2", { className: "text-muted-foreground text-sm font-medium", children: h("profile_at_a_glance") }),
2276
+ /* @__PURE__ */ a.jsxs("div", { className: "space-y-3", children: [
2277
+ /* @__PURE__ */ a.jsx(
2278
+ Yr,
2279
+ {
2280
+ onOpen: e,
2281
+ triggerRef: i
2282
+ }
2283
+ ),
2284
+ /* @__PURE__ */ a.jsx(rn, { onOpen: t, triggerRef: l }),
2285
+ /* @__PURE__ */ a.jsx(
2286
+ nn,
2287
+ {
2288
+ onOpen: d,
2289
+ triggerRef: u
2290
+ }
2291
+ )
2292
+ ] })
2293
+ ] });
2294
+ }
2295
+ function an({
2296
+ initialLanguage: e
2297
+ }) {
2298
+ const { t: i } = M(), t = et(), l = tt(), [d, u] = v.useState(e);
2299
+ if (t.error) throw t.error;
2300
+ return /* @__PURE__ */ a.jsxs(
2301
+ "form",
2302
+ {
2303
+ className: "bg-card border-border space-y-5 rounded-xl border p-6",
2304
+ onSubmit: (h) => {
2305
+ h.preventDefault(), !(!d || l.isPending) && l.mutate(
2306
+ { language_iso: d },
2307
+ {
2308
+ onSuccess: () => oe({ title: i("profile_updated"), type: "success" })
2309
+ }
2310
+ );
2311
+ },
2312
+ children: [
2313
+ /* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
2314
+ /* @__PURE__ */ a.jsx(wt, { htmlFor: "profile-language", children: i("language") }),
2315
+ /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-sm", children: i("profile_language_hint") }),
2316
+ /* @__PURE__ */ a.jsxs(
2317
+ "select",
2318
+ {
2319
+ id: "profile-language",
2320
+ className: "border-input bg-background text-foreground focus-visible:ring-ring h-10 w-full rounded-md border px-3 text-sm focus-visible:ring-2",
2321
+ value: d,
2322
+ onChange: (h) => u(h.target.value),
2323
+ disabled: t.isPending || l.isPending,
2324
+ required: !0,
2325
+ children: [
2326
+ /* @__PURE__ */ a.jsx("option", { value: "", children: i("select_an_option") }),
2327
+ t.data?.map((h) => /* @__PURE__ */ a.jsx("option", { value: h.code, children: h.name }, h.code))
2328
+ ]
2329
+ }
2330
+ )
2331
+ ] }),
2332
+ l.error && /* @__PURE__ */ a.jsx("p", { role: "alert", className: "text-destructive text-sm", children: i("failed_to_update_profile") }),
2333
+ /* @__PURE__ */ a.jsx(
2334
+ P,
2335
+ {
2336
+ type: "submit",
2337
+ disabled: !d || t.isPending || l.isPending,
2338
+ children: l.isPending ? i("saving") : i("save_changes")
2339
+ }
2340
+ )
2341
+ ]
2342
+ }
2343
+ );
2344
+ }
2345
+ function on() {
2346
+ const { t: e } = M(), i = Pe(), t = ce(), { currentSlug: l, navigate: d } = ie(), { preview: u } = le(), h = st(), { locale: p } = D(), s = v.useRef(""), r = v.useRef({});
2347
+ if (i.error) throw i.error;
2348
+ if (t.error) throw t.error;
2349
+ if (!i.data || !t.data)
2350
+ return /* @__PURE__ */ a.jsx("p", { role: "status", className: "text-muted-foreground p-6", children: e("profile_loading") });
2351
+ const n = i.data, o = `${n.first_name} ${n.last_name}`.trim() || e("account_fallback"), c = Cr(n), f = l === "profile/language", m = l === "profile/addresses", g = l === "profile/payment-methods", x = l === "profile/points", N = l === "profile/orders" || l.startsWith("profile/orders/"), j = l === "profile/subscriptions" || l.startsWith("profile/subscriptions/"), _ = N || j, w = l === "profile/orders" || l === "profile/subscriptions", E = t.data.reward_points_label_plural, I = E.charAt(0).toLocaleUpperCase(p) + E.slice(1), A = [
2352
+ {
2353
+ slug: "profile/information",
2354
+ label: e("personal_information"),
2355
+ icon: or,
2356
+ dialog: !0
2357
+ },
2358
+ {
2359
+ slug: "profile/payment-methods",
2360
+ label: e("payment_methods"),
2361
+ icon: Ie
2362
+ },
2363
+ { slug: "profile/addresses", label: e("shipping_addresses"), icon: Zt },
2364
+ {
2365
+ slug: "orders",
2366
+ label: e("orders"),
2367
+ icon: Le
2368
+ },
2369
+ {
2370
+ slug: "subscriptions",
2371
+ label: e("subscriptions"),
2372
+ icon: ke
2373
+ },
2374
+ {
2375
+ slug: "profile/language",
2376
+ label: e("language"),
2377
+ icon: rr,
2378
+ value: n.language_iso?.toUpperCase()
2379
+ },
2380
+ ...h.data ? [
2381
+ {
2382
+ slug: "profile/points",
2383
+ label: I,
2384
+ icon: ar,
2385
+ value: new Intl.NumberFormat(p).format(
2386
+ h.data.points_ledgers[0]?.total_balance ?? 0
2387
+ )
2388
+ }
2389
+ ] : []
2390
+ ];
2391
+ function L() {
2392
+ const y = s.current || l;
2393
+ d("profile"), requestAnimationFrame(
2394
+ () => (r.current[y] ?? r.current[l])?.focus()
2395
+ );
2396
+ }
2397
+ return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2398
+ /* @__PURE__ */ a.jsx(Ct, { children: /* @__PURE__ */ a.jsx("span", { className: "text-lg font-semibold", children: e("breadcrumb") }) }),
2399
+ _ ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2400
+ w && /* @__PURE__ */ a.jsx("div", { className: "px-5 pt-6 md:px-8", children: /* @__PURE__ */ a.jsxs(P, { variant: "ghost", onClick: L, children: [
2401
+ /* @__PURE__ */ a.jsx(je, { "aria-hidden": "true", className: "size-4" }),
2402
+ e("profile_back")
2403
+ ] }) }),
2404
+ /* @__PURE__ */ a.jsx(Or, { children: N ? /* @__PURE__ */ a.jsx(At, {}) : /* @__PURE__ */ a.jsx(kr, {}) })
2405
+ ] }) : /* @__PURE__ */ a.jsxs("main", { className: "mx-auto w-full max-w-3xl space-y-8 p-4 sm:p-8", children: [
2406
+ f || m || x || g ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2407
+ /* @__PURE__ */ a.jsxs(P, { variant: "ghost", onClick: L, children: [
2408
+ /* @__PURE__ */ a.jsx(je, { "aria-hidden": "true", className: "size-4" }),
2409
+ e("profile_back")
2410
+ ] }),
2411
+ /* @__PURE__ */ a.jsx("h1", { className: "text-2xl font-semibold", children: x ? I : e(
2412
+ g ? "payment_methods" : m ? "shipping_addresses" : "language"
2413
+ ) }),
2414
+ g ? /* @__PURE__ */ a.jsx(Gr, {}) : m ? /* @__PURE__ */ a.jsx(Ur, {}) : x ? /* @__PURE__ */ a.jsx($r, {}) : /* @__PURE__ */ a.jsx(an, { initialLanguage: n.language_iso ?? "" })
2415
+ ] }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
2416
+ /* @__PURE__ */ a.jsxs(
2417
+ "section",
2418
+ {
2419
+ "aria-label": e("personal_information"),
2420
+ className: c ? "bg-card text-card-foreground border-border rounded-2xl border p-6" : "py-4",
2421
+ children: [
2422
+ /* @__PURE__ */ a.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4 sm:gap-6", children: [
2423
+ /* @__PURE__ */ a.jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3 sm:gap-4", children: [
2424
+ /* @__PURE__ */ a.jsxs(br, { className: "size-12 shrink-0 sm:size-16", children: [
2425
+ /* @__PURE__ */ a.jsx(
2426
+ yr,
2427
+ {
2428
+ src: n.avatar_url ?? void 0,
2429
+ alt: ""
2430
+ }
2431
+ ),
2432
+ /* @__PURE__ */ a.jsx(vr, { children: `${n.first_name[0] ?? ""}${n.last_name[0] ?? ""}` })
2433
+ ] }),
2434
+ /* @__PURE__ */ a.jsxs("div", { className: "min-w-0 space-y-1", children: [
2435
+ c && /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-xs font-medium", children: e("member_of", { company: t.data.name }) }),
2436
+ /* @__PURE__ */ a.jsx("h1", { className: "text-xl font-semibold tracking-tight break-words sm:text-2xl", children: o }),
2437
+ /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground text-sm break-all", children: n.email })
2438
+ ] })
2439
+ ] }),
2440
+ c && n.mysite_url && /* @__PURE__ */ a.jsx(
2441
+ "a",
2442
+ {
2443
+ href: n.mysite_url,
2444
+ target: "_blank",
2445
+ rel: "noopener noreferrer",
2446
+ "aria-label": e("profile_qr_code"),
2447
+ className: "bg-background text-foreground border-border focus-visible:ring-ring rounded-lg border p-2 focus-visible:ring-2",
2448
+ children: /* @__PURE__ */ a.jsx(
2449
+ Je,
2450
+ {
2451
+ value: n.mysite_url,
2452
+ size: 80,
2453
+ bgColor: "var(--background)",
2454
+ fgColor: "var(--foreground)"
2455
+ }
2456
+ )
2457
+ }
2458
+ )
2459
+ ] }),
2460
+ n.bio && /* @__PURE__ */ a.jsx("p", { className: "text-muted-foreground mt-5 text-sm leading-relaxed", children: n.bio })
2461
+ ]
2462
+ }
2463
+ ),
2464
+ /* @__PURE__ */ a.jsxs(
2465
+ "section",
2466
+ {
2467
+ "aria-labelledby": "profile-preferences",
2468
+ className: "space-y-3",
2469
+ children: [
2470
+ /* @__PURE__ */ a.jsx(
2471
+ "h2",
2472
+ {
2473
+ id: "profile-preferences",
2474
+ className: "text-muted-foreground text-xs font-semibold tracking-wide uppercase",
2475
+ children: e("account_preferences")
2476
+ }
2477
+ ),
2478
+ /* @__PURE__ */ a.jsx("div", { className: "border-border divide-border divide-y overflow-hidden rounded-xl border", children: A.map((y) => /* @__PURE__ */ a.jsxs(
2479
+ "button",
2480
+ {
2481
+ type: "button",
2482
+ ref: (Q) => {
2483
+ r.current[y.slug] = Q;
2484
+ },
2485
+ "aria-haspopup": y.dialog ? "dialog" : void 0,
2486
+ "aria-expanded": y.dialog ? l === y.slug : void 0,
2487
+ onClick: () => {
2488
+ s.current = y.slug, d(y.slug);
2489
+ },
2490
+ className: "bg-card text-card-foreground hover:bg-muted focus-visible:ring-ring flex min-h-16 w-full items-center gap-4 px-5 py-4 text-left focus-visible:ring-2",
2491
+ children: [
2492
+ /* @__PURE__ */ a.jsx(y.icon, { "aria-hidden": "true", className: "size-5" }),
2493
+ /* @__PURE__ */ a.jsx("span", { className: "flex-1 font-medium", children: y.label }),
2494
+ y.value && /* @__PURE__ */ a.jsx("span", { className: "text-muted-foreground text-sm tabular-nums", children: y.value }),
2495
+ /* @__PURE__ */ a.jsx(
2496
+ Ae,
2497
+ {
2498
+ "aria-hidden": "true",
2499
+ className: "text-muted-foreground size-4"
2500
+ }
2501
+ )
2502
+ ]
2503
+ },
2504
+ y.slug
2505
+ )) })
2506
+ ]
2507
+ }
2508
+ ),
2509
+ /* @__PURE__ */ a.jsx(
2510
+ sn,
2511
+ {
2512
+ paymentTriggerRef: (y) => {
2513
+ r.current["profile/default-payment"] = y;
2514
+ },
2515
+ onOpenPayment: () => {
2516
+ s.current = "profile/default-payment", d("profile/payment-methods");
2517
+ },
2518
+ orderTriggerRef: (y) => {
2519
+ r.current["profile/latest-order"] = y;
2520
+ },
2521
+ onOpenOrder: (y) => {
2522
+ s.current = "profile/latest-order", d(y ? `orders/${y}` : "orders");
2523
+ },
2524
+ subscriptionTriggerRef: (y) => {
2525
+ r.current["profile/next-subscription"] = y;
2526
+ },
2527
+ onOpenSubscription: (y) => {
2528
+ s.current = "profile/next-subscription", d(y ? `subscriptions/${y}` : "subscriptions");
2529
+ }
2530
+ }
2531
+ ),
2532
+ h.error && /* @__PURE__ */ a.jsxs(
2533
+ "div",
2534
+ {
2535
+ role: "alert",
2536
+ className: "border-border space-y-3 rounded-xl border p-4",
2537
+ children: [
2538
+ /* @__PURE__ */ a.jsx("p", { className: "text-sm", children: e("profile_points_load_failed") }),
2539
+ /* @__PURE__ */ a.jsx(
2540
+ P,
2541
+ {
2542
+ variant: "outline",
2543
+ size: "sm",
2544
+ disabled: h.isFetching,
2545
+ onClick: () => {
2546
+ h.refetch().then((y) => {
2547
+ y.isSuccess && requestAnimationFrame(
2548
+ () => (r.current["profile/points"] ?? r.current["profile/information"])?.focus()
2549
+ );
2550
+ });
2551
+ },
2552
+ children: e("profile_points_retry")
2553
+ }
2554
+ )
2555
+ ]
2556
+ }
2557
+ ),
2558
+ /* @__PURE__ */ a.jsxs(
2559
+ "a",
2560
+ {
2561
+ href: u ? void 0 : new URL("/auth/sign_out", window.location.origin).href,
2562
+ "aria-disabled": u || void 0,
2563
+ tabIndex: u ? -1 : void 0,
2564
+ className: "text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-h-11 items-center gap-3 rounded-md px-1 text-sm focus-visible:ring-2",
2565
+ children: [
2566
+ /* @__PURE__ */ a.jsx(Jt, { "aria-hidden": "true", className: "size-4" }),
2567
+ e("sign_out")
2568
+ ]
2569
+ }
2570
+ )
2571
+ ] }),
2572
+ l === "profile/information" && /* @__PURE__ */ a.jsx(zr, { account: n, onClose: L })
2573
+ ] })
2574
+ ] });
2575
+ }
2576
+ function wn() {
2577
+ return /* @__PURE__ */ a.jsx(Pt, { children: /* @__PURE__ */ a.jsx(on, {}) });
2578
+ }
2579
+ export {
2580
+ wn as default
2581
+ };