@zonos/elements 1.3.231 → 1.3.232

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 (293) hide show
  1. package/dist/cjs/{cart-9b519566.js → cart-bc615014.js} +5 -5
  2. package/dist/cjs/{debounce-2c9f3f1e.js → debounce-815d1517.js} +1 -1
  3. package/dist/cjs/{getBorderRadius-c7d9f676.js → getBorderRadius-2ef1170d.js} +1 -1
  4. package/dist/cjs/{hasInclusivePrice-12605be9.js → hasInclusivePrice-84145546.js} +1 -1
  5. package/dist/cjs/{index-1c710d00.js → index-69fa8852.js} +352 -4
  6. package/dist/cjs/index.cjs.js +7 -7
  7. package/dist/cjs/{isDarkColor-994c38e4.js → isDarkColor-878e600e.js} +1 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/{localization-38af974b.js → localization-39516612.js} +2 -2
  10. package/dist/cjs/{paypal-e8fa2302.js → paypal-1d6f1a71.js} +5 -5
  11. package/dist/cjs/{placeTestOrder-6388881f.js → placeTestOrder-a5469e40.js} +2 -2
  12. package/dist/cjs/{renderFallback-bb2c4bce.js → renderFallback-c2576fbe.js} +4 -4
  13. package/dist/cjs/{translationStore-f2d5eae9.js → translationStore-08d3ff9c.js} +182 -2
  14. package/dist/cjs/{updateCheckoutSessionAttributes-a4899e90.js → updateCheckoutSessionAttributes-3a1db9de.js} +1 -1
  15. package/dist/cjs/zonos-address_11.cjs.entry.js +14 -14
  16. package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
  17. package/dist/cjs/zonos-banner_2.cjs.entry.js +3 -3
  18. package/dist/cjs/zonos-button_3.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +126 -18
  20. package/dist/cjs/zonos-checkout.cjs.entry.js +10 -10
  21. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +7 -7
  23. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +10 -10
  24. package/dist/cjs/zonos-collect.cjs.entry.js +9 -9
  25. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  26. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +4 -4
  27. package/dist/cjs/zonos-controller.cjs.entry.js +7 -7
  28. package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
  29. package/dist/cjs/zonos-country-select_4.cjs.entry.js +5 -5
  30. package/dist/cjs/zonos-elements.cjs.js +2 -2
  31. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +9 -9
  32. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  33. package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
  34. package/dist/cjs/zonos-input.cjs.entry.js +3 -3
  35. package/dist/cjs/zonos-language-select_2.cjs.entry.js +4 -4
  36. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  37. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  38. package/dist/cjs/zonos-stripe-input.cjs.entry.js +4 -4
  39. package/dist/cjs/zonos-text.cjs.entry.js +2 -2
  40. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  41. package/dist/cjs/zonos-tooltip.cjs.entry.js +1 -1
  42. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  43. package/dist/cjs/{zonosStore-5d489c65.js → zonosStore-37a4b4f4.js} +1 -1
  44. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +4 -0
  45. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +115 -6
  46. package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
  47. package/dist/collection/components/store/translationStore/strings.base.js +9 -0
  48. package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
  49. package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
  50. package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
  51. package/dist/collection/components/store/translationStore/strings.french.js +9 -0
  52. package/dist/collection/components/store/translationStore/strings.german.js +9 -0
  53. package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
  54. package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
  55. package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
  56. package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
  57. package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
  58. package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
  59. package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
  60. package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
  61. package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
  62. package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
  63. package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
  64. package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
  65. package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
  66. package/dist/collection/components/store/translationStore.js +1 -1
  67. package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
  68. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  69. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  70. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
  71. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  72. package/dist/collection/types/InputFieldLabel.js +1 -0
  73. package/dist/collection/types/generated/graphql.internal.types.js +488 -1
  74. package/dist/esm/{cart-bc0e1598.js → cart-14f305b3.js} +5 -5
  75. package/dist/esm/{debounce-f081e4d8.js → debounce-c4785346.js} +1 -1
  76. package/dist/esm/{getBorderRadius-6281d902.js → getBorderRadius-877f6389.js} +1 -1
  77. package/dist/esm/{hasInclusivePrice-706cc09d.js → hasInclusivePrice-0eda8ba9.js} +1 -1
  78. package/dist/esm/{index-55a03023.js → index-0bbe9693.js} +352 -4
  79. package/dist/esm/index.js +7 -7
  80. package/dist/esm/{isDarkColor-83e0c27e.js → isDarkColor-9ddd90cc.js} +1 -1
  81. package/dist/esm/loader.js +3 -3
  82. package/dist/esm/{localization-53f67640.js → localization-c5029ffc.js} +2 -2
  83. package/dist/esm/{paypal-3a6a048d.js → paypal-fded8844.js} +5 -5
  84. package/dist/esm/{placeTestOrder-917731cf.js → placeTestOrder-2250f719.js} +2 -2
  85. package/dist/esm/{renderFallback-cd0e40d9.js → renderFallback-dbf1e3ae.js} +4 -4
  86. package/dist/esm/{translationStore-d241dcf7.js → translationStore-690c4e04.js} +182 -2
  87. package/dist/esm/{updateCheckoutSessionAttributes-160720f6.js → updateCheckoutSessionAttributes-047a6cd4.js} +1 -1
  88. package/dist/esm/zonos-address_11.entry.js +14 -14
  89. package/dist/esm/zonos-badge.entry.js +2 -2
  90. package/dist/esm/zonos-banner_2.entry.js +3 -3
  91. package/dist/esm/zonos-button_3.entry.js +4 -4
  92. package/dist/esm/zonos-cart-items_13.entry.js +126 -18
  93. package/dist/esm/zonos-checkout.entry.js +10 -10
  94. package/dist/esm/zonos-collapse.entry.js +2 -2
  95. package/dist/esm/zonos-collect-cart-items_3.entry.js +7 -7
  96. package/dist/esm/zonos-collect-finish_6.entry.js +10 -10
  97. package/dist/esm/zonos-collect.entry.js +9 -9
  98. package/dist/esm/zonos-component.entry.js +1 -1
  99. package/dist/esm/zonos-confirm-dialog_2.entry.js +4 -4
  100. package/dist/esm/zonos-controller.entry.js +7 -7
  101. package/dist/esm/zonos-country-flag.entry.js +4 -4
  102. package/dist/esm/zonos-country-select_4.entry.js +5 -5
  103. package/dist/esm/zonos-elements.js +3 -3
  104. package/dist/esm/zonos-empty-state-payment_4.entry.js +9 -9
  105. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  106. package/dist/esm/zonos-hello.entry.js +5 -5
  107. package/dist/esm/zonos-input.entry.js +3 -3
  108. package/dist/esm/zonos-language-select_2.entry.js +4 -4
  109. package/dist/esm/zonos-logo.entry.js +2 -2
  110. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  111. package/dist/esm/zonos-stripe-input.entry.js +4 -4
  112. package/dist/esm/zonos-text.entry.js +2 -2
  113. package/dist/esm/zonos-toggle.entry.js +2 -2
  114. package/dist/esm/zonos-tooltip.entry.js +1 -1
  115. package/dist/esm/zonos-v-stack.entry.js +2 -2
  116. package/dist/esm/{zonosStore-e3d0493a.js → zonosStore-b434e436.js} +1 -1
  117. package/dist/esm-es5/{cart-bc0e1598.js → cart-14f305b3.js} +1 -1
  118. package/dist/esm-es5/{debounce-f081e4d8.js → debounce-c4785346.js} +1 -1
  119. package/dist/esm-es5/{getBorderRadius-6281d902.js → getBorderRadius-877f6389.js} +1 -1
  120. package/dist/esm-es5/{hasInclusivePrice-706cc09d.js → hasInclusivePrice-0eda8ba9.js} +1 -1
  121. package/dist/esm-es5/index-0bbe9693.js +2 -0
  122. package/dist/esm-es5/index.js +1 -1
  123. package/dist/esm-es5/{isDarkColor-83e0c27e.js → isDarkColor-9ddd90cc.js} +1 -1
  124. package/dist/esm-es5/loader.js +1 -1
  125. package/dist/esm-es5/{localization-53f67640.js → localization-c5029ffc.js} +1 -1
  126. package/dist/esm-es5/{paypal-3a6a048d.js → paypal-fded8844.js} +1 -1
  127. package/dist/esm-es5/placeTestOrder-2250f719.js +1 -0
  128. package/dist/esm-es5/{renderFallback-cd0e40d9.js → renderFallback-dbf1e3ae.js} +1 -1
  129. package/dist/esm-es5/translationStore-690c4e04.js +1 -0
  130. package/dist/esm-es5/{updateCheckoutSessionAttributes-160720f6.js → updateCheckoutSessionAttributes-047a6cd4.js} +1 -1
  131. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  132. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  133. package/dist/esm-es5/zonos-banner_2.entry.js +1 -1
  134. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  135. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  136. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  137. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  138. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  139. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  140. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  141. package/dist/esm-es5/zonos-component.entry.js +1 -1
  142. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -1
  143. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  144. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  145. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  146. package/dist/esm-es5/zonos-elements.js +1 -1
  147. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  148. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  149. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  150. package/dist/esm-es5/zonos-input.entry.js +1 -1
  151. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  152. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  153. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  154. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  155. package/dist/esm-es5/zonos-text.entry.js +1 -1
  156. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  157. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  158. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  159. package/dist/esm-es5/{zonosStore-e3d0493a.js → zonosStore-b434e436.js} +1 -1
  160. package/dist/scripts/index.d.ts +31 -2
  161. package/dist/scripts/index.js +1 -1
  162. package/dist/scripts/loadZonos.js +1 -1
  163. package/dist/scripts/zonos.js +1 -1
  164. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +11 -0
  165. package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
  166. package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
  167. package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
  168. package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
  169. package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
  170. package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
  171. package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
  172. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
  173. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
  174. package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
  175. package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
  176. package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
  177. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
  178. package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
  179. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
  180. package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
  181. package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
  182. package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
  183. package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
  184. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
  185. package/dist/types/components/store/translationStore.d.ts +1 -1
  186. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  187. package/dist/types/types/InputFieldLabel.d.ts +1 -0
  188. package/dist/types/types/generated/graphql.frontend.types.d.ts +1 -1
  189. package/dist/types/types/generated/graphql.frontend.types.ts +1 -1
  190. package/dist/types/types/generated/graphql.internal.types.d.ts +503 -3
  191. package/dist/types/types/generated/graphql.internal.types.ts +520 -3
  192. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  193. package/dist/zonos-elements/index.esm.js +1 -1
  194. package/dist/zonos-elements/{p-b91df44b.system.entry.js → p-00ac999f.system.entry.js} +1 -1
  195. package/dist/zonos-elements/{p-4523b982.entry.js → p-00ec22b2.entry.js} +1 -1
  196. package/dist/zonos-elements/{p-0bc8e55c.system.entry.js → p-03ff7b01.system.entry.js} +1 -1
  197. package/dist/zonos-elements/{p-5f7a9b69.system.entry.js → p-0a90dd80.system.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-9a444a82.system.entry.js → p-100f6a88.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-d15cd138.entry.js → p-143d706b.entry.js} +1 -1
  200. package/dist/zonos-elements/{p-ee8fcde6.js → p-14d7489d.js} +1 -1
  201. package/dist/zonos-elements/p-1d5aa016.system.js +1 -0
  202. package/dist/zonos-elements/{p-30981f80.entry.js → p-1eae4987.entry.js} +1 -1
  203. package/dist/zonos-elements/p-1f894984.js +1 -0
  204. package/dist/zonos-elements/{p-cb70de13.system.entry.js → p-23b45714.system.entry.js} +1 -1
  205. package/dist/zonos-elements/{p-433d76b4.system.js → p-23d497e3.system.js} +1 -1
  206. package/dist/zonos-elements/{p-7c96a585.js → p-2557b96b.js} +1 -1
  207. package/dist/zonos-elements/{p-f912e9c3.entry.js → p-27874c22.entry.js} +1 -1
  208. package/dist/zonos-elements/{p-ac26a931.entry.js → p-2ca8b037.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-d9486c57.entry.js → p-2dbcecf4.entry.js} +1 -1
  210. package/dist/zonos-elements/{p-db73c11a.entry.js → p-30e835a8.entry.js} +1 -1
  211. package/dist/zonos-elements/{p-ff1722d0.system.entry.js → p-316f9052.system.entry.js} +1 -1
  212. package/dist/zonos-elements/{p-3eda5c2c.entry.js → p-3185968f.entry.js} +1 -1
  213. package/dist/zonos-elements/{p-fa90adb8.entry.js → p-31975752.entry.js} +1 -1
  214. package/dist/zonos-elements/{p-6bab9096.entry.js → p-31af91f0.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-38f42f10.system.entry.js → p-452fb638.system.entry.js} +1 -1
  216. package/dist/zonos-elements/{p-c998e4ed.entry.js → p-4592ae49.entry.js} +1 -1
  217. package/dist/zonos-elements/{p-ff522088.system.entry.js → p-4e41143a.system.entry.js} +1 -1
  218. package/dist/zonos-elements/{p-f548807d.system.entry.js → p-52b87408.system.entry.js} +1 -1
  219. package/dist/zonos-elements/{p-cb11d11b.system.entry.js → p-540cec7e.system.entry.js} +1 -1
  220. package/dist/zonos-elements/{p-d2f7ea09.entry.js → p-55e2e4ed.entry.js} +1 -1
  221. package/dist/zonos-elements/{p-bb707dfd.system.js → p-561be3a2.system.js} +1 -1
  222. package/dist/zonos-elements/{p-a199bb13.js → p-5762e217.js} +1 -1
  223. package/dist/zonos-elements/{p-e688e493.js → p-57fa64d7.js} +1 -1
  224. package/dist/zonos-elements/{p-360d7101.system.entry.js → p-59ebb8c7.system.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-abc0fb80.js → p-5c680f72.js} +1 -1
  226. package/dist/zonos-elements/{p-cbb01de9.entry.js → p-5f398c28.entry.js} +1 -1
  227. package/dist/zonos-elements/p-5f77d19e.js +1 -0
  228. package/dist/zonos-elements/{p-9bdad585.system.entry.js → p-60469388.system.entry.js} +1 -1
  229. package/dist/zonos-elements/{p-7730879e.system.js → p-652e80f0.system.js} +1 -1
  230. package/dist/zonos-elements/{p-4da7b6a8.system.entry.js → p-6adfb3af.system.entry.js} +1 -1
  231. package/dist/zonos-elements/{p-91fa43ef.entry.js → p-74ca7739.entry.js} +1 -1
  232. package/dist/zonos-elements/{p-419c292c.system.js → p-767a31a8.system.js} +1 -1
  233. package/dist/zonos-elements/{p-2eaa5013.system.entry.js → p-770852bf.system.entry.js} +1 -1
  234. package/dist/zonos-elements/{p-f688d7a4.system.js → p-7c705c76.system.js} +1 -1
  235. package/dist/zonos-elements/{p-22338b4a.system.entry.js → p-81ba2820.system.entry.js} +1 -1
  236. package/dist/zonos-elements/{p-2008df67.js → p-82739127.js} +2 -2
  237. package/dist/zonos-elements/p-88ea9f82.entry.js +1 -0
  238. package/dist/zonos-elements/p-8a23bbf5.js +1 -0
  239. package/dist/zonos-elements/{p-bc963b03.entry.js → p-905d2490.entry.js} +1 -1
  240. package/dist/zonos-elements/{p-24e26a2c.system.js → p-909e2bc3.system.js} +1 -1
  241. package/dist/zonos-elements/{p-b658c28a.entry.js → p-936b54c1.entry.js} +1 -1
  242. package/dist/zonos-elements/{p-304bdbc2.system.entry.js → p-93f2e1ee.system.entry.js} +1 -1
  243. package/dist/zonos-elements/p-989d3af9.system.js +2 -0
  244. package/dist/zonos-elements/{p-d96545ae.entry.js → p-9b8750f3.entry.js} +1 -1
  245. package/dist/zonos-elements/{p-55c6ff14.system.entry.js → p-a0a4e43d.system.entry.js} +1 -1
  246. package/dist/zonos-elements/{p-0047fecf.system.js → p-a25428eb.system.js} +1 -1
  247. package/dist/zonos-elements/{p-4697f061.system.entry.js → p-a2819807.system.entry.js} +1 -1
  248. package/dist/zonos-elements/{p-6d423364.entry.js → p-a6e74856.entry.js} +1 -1
  249. package/dist/zonos-elements/p-ab41bab5.js +2 -0
  250. package/dist/zonos-elements/p-ae940a99.js +1 -0
  251. package/dist/zonos-elements/{p-dc56b469.system.entry.js → p-b1fd1ec2.system.entry.js} +1 -1
  252. package/dist/zonos-elements/{p-7af39c98.js → p-b2a0ab4a.js} +1 -1
  253. package/dist/zonos-elements/{p-3f35b8b1.system.entry.js → p-b7ea5f4f.system.entry.js} +1 -1
  254. package/dist/zonos-elements/{p-c81f6387.entry.js → p-bf9d889f.entry.js} +1 -1
  255. package/dist/zonos-elements/p-c1ecab92.entry.js +1 -0
  256. package/dist/zonos-elements/{p-81b357f7.system.js → p-c2442878.system.js} +1 -1
  257. package/dist/zonos-elements/{p-7e5bd9af.system.entry.js → p-c288c6da.system.entry.js} +1 -1
  258. package/dist/zonos-elements/{p-b4bf2f03.entry.js → p-c50cc926.entry.js} +1 -1
  259. package/dist/zonos-elements/{p-b6ef4a5e.system.entry.js → p-c5cb2364.system.entry.js} +1 -1
  260. package/dist/zonos-elements/{p-57413c34.system.js → p-c6e3d747.system.js} +1 -1
  261. package/dist/zonos-elements/{p-2dc38ef3.entry.js → p-c7b658cb.entry.js} +1 -1
  262. package/dist/zonos-elements/p-cf765af3.system.js +1 -0
  263. package/dist/zonos-elements/{p-89c5164b.system.js → p-d45285aa.system.js} +1 -1
  264. package/dist/zonos-elements/{p-bccd49d7.system.entry.js → p-d556c6d1.system.entry.js} +1 -1
  265. package/dist/zonos-elements/{p-1a67ae71.system.entry.js → p-db628e49.system.entry.js} +1 -1
  266. package/dist/zonos-elements/{p-c28da00e.entry.js → p-e03e1a62.entry.js} +1 -1
  267. package/dist/zonos-elements/{p-d852d6da.system.entry.js → p-e7874318.system.entry.js} +1 -1
  268. package/dist/zonos-elements/{p-c20429ea.entry.js → p-e8949e7e.entry.js} +1 -1
  269. package/dist/zonos-elements/{p-3a242dfc.system.js → p-ea0b5d10.system.js} +1 -1
  270. package/dist/zonos-elements/{p-c9be03e0.entry.js → p-eae3462c.entry.js} +1 -1
  271. package/dist/zonos-elements/{p-b669050d.system.entry.js → p-eea0eb57.system.entry.js} +1 -1
  272. package/dist/zonos-elements/p-f892595d.system.entry.js +1 -0
  273. package/dist/zonos-elements/{p-23c46dfa.system.js → p-f8d56ba9.system.js} +1 -1
  274. package/dist/zonos-elements/p-fc776473.js +1 -0
  275. package/dist/zonos-elements/{p-cec35a21.entry.js → p-fd3b46ee.entry.js} +1 -1
  276. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  277. package/dist/zonos-elements/zonos-elements.js +1 -1
  278. package/package.json +1 -1
  279. package/dist/esm-es5/index-55a03023.js +0 -2
  280. package/dist/esm-es5/placeTestOrder-917731cf.js +0 -1
  281. package/dist/esm-es5/translationStore-d241dcf7.js +0 -1
  282. package/dist/zonos-elements/p-0ffd710e.js +0 -1
  283. package/dist/zonos-elements/p-3f0ca5f9.js +0 -1
  284. package/dist/zonos-elements/p-4f5be8f0.entry.js +0 -1
  285. package/dist/zonos-elements/p-516a9666.system.js +0 -1
  286. package/dist/zonos-elements/p-5fc34563.system.js +0 -2
  287. package/dist/zonos-elements/p-6d563f33.system.entry.js +0 -1
  288. package/dist/zonos-elements/p-7920d79c.system.js +0 -1
  289. package/dist/zonos-elements/p-b30c2ad9.js +0 -2
  290. package/dist/zonos-elements/p-bdeb20cb.js +0 -1
  291. package/dist/zonos-elements/p-c0e080e3.js +0 -1
  292. package/dist/zonos-elements/p-e27a9450.js +0 -1
  293. package/dist/zonos-elements/p-ede9e968.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-89c5164b.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-7920d79c.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c;return{setters:[function(n){r=n.c;e=n.z},function(n){t=n.j;o=n.h;i=n.l},function(n){a=n.a;u=n.l},function(n){c=n.a}],execute:function(){var s=this;var v=function(n){var r=!!n.find((function(n){return n.testKey in a}));if(!r){u("No available test key found in response","info",{response:n})}return!!n.find((function(n){return n.testKey in a}))};var l=n("f",(function(n){if(!v(n)){return[]}return n.filter((function(n){var r;var e=a[n.testKey]&&!n.selectedVariantKey;var t=n.selectedVariantKey&&!!((r=a[n.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(n.selectedVariantKey));return e||t})).map((function(n){return Object.assign(Object.assign({},n),{expiresAt:n.expiresAt||Date.now()+d,selectedVariantKey:n.selectedVariantKey||null})}))}));var d=n("V",60*60*24*1e3);var f=r({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:t(localStorage.getItem("zonos--enabled-variant-test-keys"))}),w=f.onChange,y=f.state;n({q:w,s:y});w("enabledVariantTestKeys",(function(){var n;if(!((n=y.enabledVariantTestKeys)===null||n===void 0?void 0:n.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(y.enabledVariantTestKeys))}));w("checkoutSessionId",(function(){if(!y.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",y.checkoutSessionId)}));var m=n("b",(function(n){y.enabledVariantTestKeys=l(n)}));var h=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,o("/api/zonos-elements/get-countries",{method:"GET"})];case 1:n=i.sent(),r=n.errors,e=n.json;if(r.length||!e){return[2,null]}return[2,e];case 2:t=i.sent();return[2,null];case 3:return[2]}}))}))};var g=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,a,u;return __generator(this,(function(c){switch(c.label){case 0:if(!n){return[2,null]}e="/api/zonos-elements/country-landed-cost/".concat(n);return[4,o(e)];case 1:t=c.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching country landed cost: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,u||null]}}))}))};var _={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var p=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,a,u,c,s,v,l,d;var f=n.country,w=n.isGuaranteed,y=n.sourceCurrency,m=n.targetCurrency;return __generator(this,(function(n){switch(n.label){case 0:if(y===m&&!w){return[2,_]}e=new URLSearchParams;e.set("sourceCurrency",y);e.set("targetCurrency",m);e.set("isGuaranteed",String(w));e.set("country",f||"");return[4,o("/api/zonos-elements/exchange-rates?".concat(e.toString()))];case 1:t=n.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching country landed cost: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,_]}c=u.exchangeRateCreate,s=c.rate,v=c.targetFormat;l=u.maxAge;if(s){sessionStorage.setItem(f+"_rate",JSON.stringify(s));d={rate:s,targetFormat:v};return[2,{exchangeRate:d,maxAge:l}]}return[2,_]}}))}))};var z=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,a;return __generator(this,(function(u){switch(u.label){case 0:if(!n){return[2,null]}return[4,o("/api/zonos-elements/inclusive-prices/".concat(n))];case 1:e=u.sent(),t=e.errors,a=e.json;if(t.length||!a){i("Error fetching country inclusive price setting: ".concat((r=t.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,a||null]}}))}))};var b=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,a,u;var c=n.countryCode,s=n.localeTo,v=n.storeId;return __generator(this,(function(n){switch(n.label){case 0:e=new URLSearchParams;e.set("countryCode",c);e.set("storeId",v.toString());if(s){e.set("localeTo",s)}return[4,o("/api/zonos-elements/locale-messages?".concat(e.toString()))];case 1:t=n.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching exchange rate",(r=a.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,u.locale_countryCodesPage]}}))}))};var S=function(n){if(n&&/^[A-Z]{2}$/.test(n)){return n}return null};var C=n("g",(function(n){var r=new URLSearchParams(n||window.location.search);var e=function(n){var e=r.get(n);return S(e)};var t=e("zCountry");var o=e("country");var i=e("customerCountry");return t||o||i}));var I=n("e",(function(){var n=new URL(window.location.href);var r=window.sessionStorage.getItem("zonos--country");var e=C(n.searchParams)||r;return e}));var L=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,i,a;return __generator(this,(function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);n=I();r=new URLSearchParams;if(n){r.set("zCountry",n)}return[4,o("/api/zonos-elements/localization?".concat(r.toString()))];case 1:e=u.sent(),t=e.errors,i=e.json;if(t.length||!i){return[2,{country:null,locale:null}]}return[2,{country:i.country,locale:i.locale}];case 2:a=u.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var k=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,a,u,c;return __generator(this,(function(s){switch(s.label){case 0:if((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean)]}return[4,o("/api/zonos-elements/shipping-zones")];case 1:t=s.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching shipping zones: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}c=(e=u===null||u===void 0?void 0:u.shippingZones)===null||e===void 0?void 0:e.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean);return[2,c||null]}}))}))};var A=n("o",(function(n){var r=Q.inclusivePricingConfigurations.find((function(n){return n.shipToCountry===Q.selectedCountryCode}));if(!r){return n}var e=r.effectiveRate;return n*(1+e)}));var E=n("n",(function(n){var r=Q.exchangeRate;if(!r||!n||isNaN(n)){return n}var e=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var t=n*r.rate;var o=t.toFixed(e);return Number(o)}));var x=function(n){var r=n.amount,e=n.currency,t=n.targetFormat;var o=e||Q.targetCurrency;var i=(t===null||t===void 0?void 0:t.scale)||2;var a=window.navigator.userAgent.indexOf("MSIE ")!==-1;var u=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(a||!u){var c=Number(r).toFixed(i).replace(".","|dec|").replace(",",(t===null||t===void 0?void 0:t.thousandsDelimiter)||"").replace("|dec|",(t===null||t===void 0?void 0:t.decimalDelimiter)||"");return c}var s=new Intl.NumberFormat(window.navigator.language,{currency:o,currencyDisplay:"code",minimumFractionDigits:i,style:"currency"}).format(r);return s.replace(new RegExp("".concat(o,"\\s+")),"")};var N=n("d",(function(n){var r=n.amount,t=n.currency;if(isNaN(r)||r!==0&&!r){return""}var o=e.overrideCurrencyFormat;var i=Q.exchangeRate;var a=t||Q.targetCurrency;if(typeof o==="function"){return o({amount:r,currencyCode:a,numberFormat:function(n){var r=n.amount;return x({amount:r,currency:a,targetFormat:(i===null||i===void 0?void 0:i.targetFormat)||null})}})}var u=(i||{}).targetFormat;if(!u||!i){return"".concat(r.toFixed(2)," ").concat(a)}var c=u.scale||2;var s=window.navigator.userAgent.indexOf("MSIE ")!==-1;var v=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(s||!v){var l=Number(r).toFixed(c).replace(".","|dec|").replace(",",u.thousandsDelimiter||"").replace("|dec|",u.decimalDelimiter||"");var d="".concat(l).concat(u.currencyCode!=="USD"?" ".concat(u.currencyCode):"");return d}var f=(o===null||o===void 0?void 0:o.currencyDisplay)||"symbol";var w=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:f,minimumFractionDigits:c,style:"currency"}).format(r);var y=f==="code"?"".concat(w.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):w;return y}));var D=n("m",(function(n){var r=E(n);var e=N({amount:r});return e}));var P=n("i",(function(n){try{document.createDocumentFragment().querySelector(n)}catch(n){return false}return true}));var j=function(n){var r=n||".money";if(!P(r)){i('Currency element selector "'.concat(r,'" is not valid.'));return null}var e=document.querySelectorAll(r);if(!e.length){u('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(e)};var B=function(n){var r;var e=n.getAttribute("data-domestic");var t=n.getAttribute("data-zintl");var o=(r=n.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!o){return null}if(!e||n.textContent!==t&&t){n.setAttribute("data-domestic",o);return parseFloat(o)}return parseFloat(e)};var R=7e3;var T="z--blur";var U=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(e){switch(e.label){case 0:n=window.zonosBlurCurrencyOnInitIntervalId;if(!n){return[2]}return[4,new Promise((function(n){return setTimeout(n,500)}))];case 1:e.sent();clearInterval(n);r=document.querySelectorAll(".".concat(T));r.forEach((function(n){n.classList.remove(T)}));window.zonosBlurCurrencyOnInitIntervalId=undefined;return[2]}}))}))};var F=function(n){return __awaiter(s,[n],void 0,(function(n){var r=n.specificSelector,e=n.timeoutId;return __generator(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){return setTimeout(n,500)}))];case 1:n.sent();if(e){clearTimeout(e)}r.classList.remove(T);return[2]}}))}))};var O=function(n){var r=n.currencySelector,e=n.specificSelector;if(!r&&!e){return}if(e){e.classList.add(T)}else{var t=document.querySelectorAll([r].filter(Boolean).join(","));t.forEach((function(n){n.classList.add(T)}))}};var G=function(n){if(typeof window==="undefined"){return}O({specificSelector:n});var r=setTimeout((function(){void F({specificSelector:n,timeoutId:r})}),R);return r};var K=function(){if(typeof window==="undefined"){return}if(window.zonosBlurCurrencyOnInitIntervalId){return}O({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});var n=setInterval((function(){O({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=n;setTimeout((function(){void U()}),R)};var M=function(n){var r;var t=B(n);if(!t||isNaN(t)){return}var o=n.getAttribute("data-zintl");var i=parseFloat(n.getAttribute("data-zrate")||"1");var a=n.getAttribute("data-zcountry-code");var u=Q.exchangeRate&&Q.targetCurrency===Q.exchangeRate.targetFormat.currencyCode;var c=((r=Q.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(u&&(n.textContent!==o||c!==i||a!==Q.selectedCountryCode)){var s=G(n);var v=A(t);var l=typeof e.currencyConverter==="function"&&e.currencyConverter({convert:E,convertAndFormat:D,currencyCode:Q.targetCurrency,format:function(n){return N({amount:n})},originalAmount:v,selector:n});var d=l||D(v);if(d!==n.textContent){n.textContent=d}n.setAttribute("data-zrate",c.toString());n.setAttribute("data-zintl",d);n.setAttribute("data-zcountry-code",Q.selectedCountryCode||"");void F({specificSelector:n,timeoutId:s})}};var V=function(){var n=e.helloSettings.currencyElementSelector;var r=j(n);if(!(r===null||r===void 0?void 0:r.length)){return}if(!Q.exchangeRate){i("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(n){M(n)}))};var J=n("k",(function(){if(e.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){void U();return}V()}));var q=function(n){var r;var e=(r=Q.shippingZoneCountries)===null||r===void 0?void 0:r[n];if(e){return e.currencyCode}return null};var Z=n("j",(function(n){if(!n){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||e.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",n);var o="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,o)}}));var $=r({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricingConfigurations:[],inclusivePricingIsFetching:false,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),H=$.dispose,Y=$.onChange,Q=$.state;n({c:Y,l:Q});var W=function(n){return __awaiter(s,void 0,void 0,(function(){var r,t,o;return __generator(this,(function(i){switch(i.label){case 0:return[4,p({country:Q.selectedCountryCode,isGuaranteed:n,sourceCurrency:e.sourceCurrency,targetCurrency:Q.targetCurrency})];case 1:r=i.sent(),t=r.exchangeRate,o=r.maxAge;if(t){Q.exchangeRate=t;J()}return[2,{maxAge:o}]}}))}))};var X="CA";var nn=n("p",(function(n){if(Q.selectedCountryCode&&n.includes(Q.selectedCountryCode)){return Q.selectedCountryCode}return X}));var rn=function(n){return __awaiter(s,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:if(!n){return[2]}Q.inclusivePricingIsFetching=true;return[4,z(n)];case 1:r=e.sent();Q.inclusivePricingConfigurations=r||[];Q.inclusivePricingIsFetching=false;return[2]}}))}))};var en=function(n){var r=n.isGuaranteed,e=n.maxAge;if(Q.exchangeRateTimeout){clearTimeout(Q.exchangeRateTimeout)}var t=5*60;var o=e||t;Q.exchangeRateTimeout=setTimeout((function(){return __awaiter(s,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,rn(Q.selectedCountryCode)];case 1:e.sent();return[4,W(r)];case 2:n=e.sent().maxAge;en({isGuaranteed:r,maxAge:n});return[2]}}))}))}),o*1e3)};var tn=function(n){return __awaiter(s,[n],void 0,(function(n){var r,t,o,i,a,c,s,v;var l=n.isInitializing;return __generator(this,(function(n){switch(n.label){case 0:u("get new localization store");o=Q.isDisabledCountry,i=Q.isShippableCountry,a=Q.selectedCountryCode;if(e.helloSettings.currencyBehavior==="DISABLED"||!i||o||!a){return[2]}c=e.checkoutSettings.visibilityStatus==="ENABLED";K();return[4,W(c)];case 1:s=n.sent().maxAge;en({isGuaranteed:c,maxAge:s});if(l&&((r=window.Zonos.cartSettings)===null||r===void 0?void 0:r.inclusivePriceConfigurations)){Q.inclusivePricingConfigurations=((t=window.Zonos.cartSettings)===null||t===void 0?void 0:t.inclusivePriceConfigurations)||[];void U()}if(!!window.Zonos.isLegacyCheckout)return[3,3];Q.inclusivePricingIsFetching=true;return[4,Promise.all([g(Q.selectedCountryCode),rn(Q.selectedCountryCode)])];case 2:v=n.sent()[0];Q.countryLandedCost=v;void U();return[3,4];case 3:u("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");n.label=4;case 4:return[2]}}))}))};var on=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(t){switch(t.label){case 0:u("Getting custom messages for ".concat(Q.selectedCountryCode));if(!Q.selectedCountryCode||!e.storeId){return[2]}return[4,b({countryCode:Q.selectedCountryCode,localeTo:Q.selectedLocale,storeId:e.storeId})];case 1:n=t.sent();r=n.flatMap((function(n){var r;return{countryCode:Q.selectedCountryCode,message:(r=n.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:n.pageName}}));Q.customMessages=r;return[2]}}))}))};var an=function(){var n=new URL(window.location.href);var r=n.searchParams.get("zonosLocale");return r};var un=function(){if(Q.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var cn=function(n){if(n==="UK"){return"GB"}return n};var sn=n("a",(function(n){var r=n.isInitializing,t=n.newSelectedCountryCode;var o,i;u("Updating selected country code to ".concat(t));var a=!Q.selectedCountryCode;Q.selectedCountryCode=cn(t);var c=Q.selectedCountryCode,s=Q.shippingZoneCountries;var v=!!s&&!!c&&!!s[c]&&!e.disabledCountries.includes(c);Q.isShippableCountry=v;u("".concat(Q.selectedCountryCode," is a shippable country: ").concat(Q.isShippableCountry));var l=!!c&&e.disabledCountries.includes(c);Q.isDisabledCountry=l;u("".concat(Q.selectedCountryCode," is a disabled country: ").concat(Q.isDisabledCountry));un();if(!c){return}var d=q(c);if(!a){(o=e.onCountryChange)===null||o===void 0?void 0:o.call(e,{countryCode:c,currencyCode:d,isShippableCountry:v})}if(!d){return}Q.targetCurrency=d;void tn({isInitializing:r});window.sessionStorage.setItem("zonos--country",c);Z(c);(i=document.querySelector("zonos-hello"))===null||i===void 0?void 0:i.setAttribute("z-country",c)}));var vn=function(n){var r=e.helloSettings.showCountryList;var t=Q.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){Q.helloCountryList=t;return}if(r==="ALL"){Q.helloCountryList=n;return}Q.helloCountryList=r.reduce((function(r,e){var t;var o=n===null||n===void 0?void 0:n[e];return o?Object.assign(Object.assign({},r),(t={},t[e]=o,t)):r}),{})};var ln=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e;return __generator(this,(function(t){switch(t.label){case 0:if(!y.checkoutSessionId){return[2,null]}return[4,o("/api/zonos-elements/update-checkout-session-metadata",{body:{id:y.checkoutSessionId,metadata:[{key:"language",value:Q.selectedLocale}]},method:"POST"})];case 1:n=t.sent(),r=n.errors,e=n.json;if(r.length||!e){i("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:e}]}return[2,{errors:[],json:e}]}}))}))};var dn=n("r",(function(n){Q.selectedLocale=n;c(n);void ln();void on()}));var fn=n("h",(function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,i,a,c,s,v;return __generator(this,(function(l){switch(l.label){case 0:return[4,Promise.all([h(),k(),L()])];case 1:r=l.sent(),e=r[0],t=r[1],o=r[2];i=t===null||t===void 0?void 0:t.reduce((function(n,r){var t;var o=e===null||e===void 0?void 0:e[r];return o?Object.assign(Object.assign({},n),(t={},t[r]=o,t)):n}),{});Q.shippingZoneCountries=i||null;Q.inclusivePricingConfigurations=((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.inclusivePriceConfigurations)||[];vn(e||{});a=o.country,c=o.locale;u("Country code from localization: ".concat(a));u("Locale from localization: ".concat(c));sn({isInitializing:true,newSelectedCountryCode:a||null});s=an();dn(s||c||"en");v=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!Q.selectedCountryCode&&v.some((function(n){return window.location.origin.includes(n)}))){sn({isInitializing:true,newSelectedCountryCode:"CA"})}Q.localizationLoaded=true;return[2]}}))}))}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,r,e,t){function o(n){return n instanceof e?n:new e((function(r){r(n)}))}return new(e||(e=Promise))((function(e,i){function a(n){try{c(t.next(n))}catch(n){i(n)}}function u(n){try{c(t["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):o(n.value).then(a,u)}c((t=t.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(r){return c([n,r])}}function c(u){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(e=0)),e)try{if(t=1,o&&(i=u[0]&2?o["return"]:u[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,u[1])).done)return i;if(o=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:e.label++;return{value:u[1],done:false};case 5:e.label++;o=u[1];u=[0];continue;case 7:u=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){e.label=u[1];break}if(u[0]===6&&e.label<i[1]){e.label=i[1];i=u;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(u);break}if(i[2])e.ops.pop();e.trys.pop();continue}u=r.call(n,e)}catch(n){u=[6,n];o=0}finally{t=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-d45285aa.system.js","./p-01174496.system.js","./p-d938f42f.system.js","./p-1d5aa016.system.js"],(function(n){"use strict";var r,e,t,o,i,a,u,c;return{setters:[function(n){r=n.c;e=n.z},function(n){t=n.j;o=n.h;i=n.l},function(n){a=n.a;u=n.l},function(n){c=n.a}],execute:function(){var s=this;var v=function(n){var r=!!n.find((function(n){return n.testKey in a}));if(!r){u("No available test key found in response","info",{response:n})}return!!n.find((function(n){return n.testKey in a}))};var l=n("f",(function(n){if(!v(n)){return[]}return n.filter((function(n){var r;var e=a[n.testKey]&&!n.selectedVariantKey;var t=n.selectedVariantKey&&!!((r=a[n.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(n.selectedVariantKey));return e||t})).map((function(n){return Object.assign(Object.assign({},n),{expiresAt:n.expiresAt||Date.now()+d,selectedVariantKey:n.selectedVariantKey||null})}))}));var d=n("V",60*60*24*1e3);var f=r({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:t(localStorage.getItem("zonos--enabled-variant-test-keys"))}),w=f.onChange,y=f.state;n({q:w,s:y});w("enabledVariantTestKeys",(function(){var n;if(!((n=y.enabledVariantTestKeys)===null||n===void 0?void 0:n.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(y.enabledVariantTestKeys))}));w("checkoutSessionId",(function(){if(!y.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",y.checkoutSessionId)}));var m=n("b",(function(n){y.enabledVariantTestKeys=l(n)}));var h=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);return[4,o("/api/zonos-elements/get-countries",{method:"GET"})];case 1:n=i.sent(),r=n.errors,e=n.json;if(r.length||!e){return[2,null]}return[2,e];case 2:t=i.sent();return[2,null];case 3:return[2]}}))}))};var g=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,a,u;return __generator(this,(function(c){switch(c.label){case 0:if(!n){return[2,null]}e="/api/zonos-elements/country-landed-cost/".concat(n);return[4,o(e)];case 1:t=c.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching country landed cost: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,u||null]}}))}))};var _={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var p=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,a,u,c,s,v,l,d;var f=n.country,w=n.isGuaranteed,y=n.sourceCurrency,m=n.targetCurrency;return __generator(this,(function(n){switch(n.label){case 0:if(y===m&&!w){return[2,_]}e=new URLSearchParams;e.set("sourceCurrency",y);e.set("targetCurrency",m);e.set("isGuaranteed",String(w));e.set("country",f||"");return[4,o("/api/zonos-elements/exchange-rates?".concat(e.toString()))];case 1:t=n.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching country landed cost: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,_]}c=u.exchangeRateCreate,s=c.rate,v=c.targetFormat;l=u.maxAge;if(s){sessionStorage.setItem(f+"_rate",JSON.stringify(s));d={rate:s,targetFormat:v};return[2,{exchangeRate:d,maxAge:l}]}return[2,_]}}))}))};var z=function(n){return __awaiter(s,void 0,void 0,(function(){var r,e,t,a;return __generator(this,(function(u){switch(u.label){case 0:if(!n){return[2,null]}return[4,o("/api/zonos-elements/inclusive-prices/".concat(n))];case 1:e=u.sent(),t=e.errors,a=e.json;if(t.length||!a){i("Error fetching country inclusive price setting: ".concat((r=t.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,a||null]}}))}))};var b=function(n){return __awaiter(s,[n],void 0,(function(n){var r,e,t,a,u;var c=n.countryCode,s=n.localeTo,v=n.storeId;return __generator(this,(function(n){switch(n.label){case 0:e=new URLSearchParams;e.set("countryCode",c);e.set("storeId",v.toString());if(s){e.set("localeTo",s)}return[4,o("/api/zonos-elements/locale-messages?".concat(e.toString()))];case 1:t=n.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching exchange rate",(r=a.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,u.locale_countryCodesPage]}}))}))};var S=function(n){if(n&&/^[A-Z]{2}$/.test(n)){return n}return null};var C=n("g",(function(n){var r=new URLSearchParams(n||window.location.search);var e=function(n){var e=r.get(n);return S(e)};var t=e("zCountry");var o=e("country");var i=e("customerCountry");return t||o||i}));var I=n("e",(function(){var n=new URL(window.location.href);var r=window.sessionStorage.getItem("zonos--country");var e=C(n.searchParams)||r;return e}));var L=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,i,a;return __generator(this,(function(u){switch(u.label){case 0:u.trys.push([0,2,,3]);n=I();r=new URLSearchParams;if(n){r.set("zCountry",n)}return[4,o("/api/zonos-elements/localization?".concat(r.toString()))];case 1:e=u.sent(),t=e.errors,i=e.json;if(t.length||!i){return[2,{country:null,locale:null}]}return[2,{country:i.country,locale:i.locale}];case 2:a=u.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var k=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,a,u,c;return __generator(this,(function(s){switch(s.label){case 0:if((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean)]}return[4,o("/api/zonos-elements/shipping-zones")];case 1:t=s.sent(),a=t.errors,u=t.json;if(a.length||!u){i("Error fetching shipping zones: ".concat((r=a.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}c=(e=u===null||u===void 0?void 0:u.shippingZones)===null||e===void 0?void 0:e.flatMap((function(n){return n===null||n===void 0?void 0:n.countryCodes})).filter(Boolean);return[2,c||null]}}))}))};var A=n("o",(function(n){var r=Q.inclusivePricingConfigurations.find((function(n){return n.shipToCountry===Q.selectedCountryCode}));if(!r){return n}var e=r.effectiveRate;return n*(1+e)}));var E=n("n",(function(n){var r=Q.exchangeRate;if(!r||!n||isNaN(n)){return n}var e=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var t=n*r.rate;var o=t.toFixed(e);return Number(o)}));var x=function(n){var r=n.amount,e=n.currency,t=n.targetFormat;var o=e||Q.targetCurrency;var i=(t===null||t===void 0?void 0:t.scale)||2;var a=window.navigator.userAgent.indexOf("MSIE ")!==-1;var u=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(a||!u){var c=Number(r).toFixed(i).replace(".","|dec|").replace(",",(t===null||t===void 0?void 0:t.thousandsDelimiter)||"").replace("|dec|",(t===null||t===void 0?void 0:t.decimalDelimiter)||"");return c}var s=new Intl.NumberFormat(window.navigator.language,{currency:o,currencyDisplay:"code",minimumFractionDigits:i,style:"currency"}).format(r);return s.replace(new RegExp("".concat(o,"\\s+")),"")};var N=n("d",(function(n){var r=n.amount,t=n.currency;if(isNaN(r)||r!==0&&!r){return""}var o=e.overrideCurrencyFormat;var i=Q.exchangeRate;var a=t||Q.targetCurrency;if(typeof o==="function"){return o({amount:r,currencyCode:a,numberFormat:function(n){var r=n.amount;return x({amount:r,currency:a,targetFormat:(i===null||i===void 0?void 0:i.targetFormat)||null})}})}var u=(i||{}).targetFormat;if(!u||!i){return"".concat(r.toFixed(2)," ").concat(a)}var c=u.scale||2;var s=window.navigator.userAgent.indexOf("MSIE ")!==-1;var v=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(s||!v){var l=Number(r).toFixed(c).replace(".","|dec|").replace(",",u.thousandsDelimiter||"").replace("|dec|",u.decimalDelimiter||"");var d="".concat(l).concat(u.currencyCode!=="USD"?" ".concat(u.currencyCode):"");return d}var f=(o===null||o===void 0?void 0:o.currencyDisplay)||"symbol";var w=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:f,minimumFractionDigits:c,style:"currency"}).format(r);var y=f==="code"?"".concat(w.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):w;return y}));var D=n("m",(function(n){var r=E(n);var e=N({amount:r});return e}));var P=n("i",(function(n){try{document.createDocumentFragment().querySelector(n)}catch(n){return false}return true}));var j=function(n){var r=n||".money";if(!P(r)){i('Currency element selector "'.concat(r,'" is not valid.'));return null}var e=document.querySelectorAll(r);if(!e.length){u('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(e)};var B=function(n){var r;var e=n.getAttribute("data-domestic");var t=n.getAttribute("data-zintl");var o=(r=n.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!o){return null}if(!e||n.textContent!==t&&t){n.setAttribute("data-domestic",o);return parseFloat(o)}return parseFloat(e)};var R=7e3;var T="z--blur";var U=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(e){switch(e.label){case 0:n=window.zonosBlurCurrencyOnInitIntervalId;if(!n){return[2]}return[4,new Promise((function(n){return setTimeout(n,500)}))];case 1:e.sent();clearInterval(n);r=document.querySelectorAll(".".concat(T));r.forEach((function(n){n.classList.remove(T)}));window.zonosBlurCurrencyOnInitIntervalId=undefined;return[2]}}))}))};var F=function(n){return __awaiter(s,[n],void 0,(function(n){var r=n.specificSelector,e=n.timeoutId;return __generator(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){return setTimeout(n,500)}))];case 1:n.sent();if(e){clearTimeout(e)}r.classList.remove(T);return[2]}}))}))};var O=function(n){var r=n.currencySelector,e=n.specificSelector;if(!r&&!e){return}if(e){e.classList.add(T)}else{var t=document.querySelectorAll([r].filter(Boolean).join(","));t.forEach((function(n){n.classList.add(T)}))}};var G=function(n){if(typeof window==="undefined"){return}O({specificSelector:n});var r=setTimeout((function(){void F({specificSelector:n,timeoutId:r})}),R);return r};var K=function(){if(typeof window==="undefined"){return}if(window.zonosBlurCurrencyOnInitIntervalId){return}O({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});var n=setInterval((function(){O({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=n;setTimeout((function(){void U()}),R)};var M=function(n){var r;var t=B(n);if(!t||isNaN(t)){return}var o=n.getAttribute("data-zintl");var i=parseFloat(n.getAttribute("data-zrate")||"1");var a=n.getAttribute("data-zcountry-code");var u=Q.exchangeRate&&Q.targetCurrency===Q.exchangeRate.targetFormat.currencyCode;var c=((r=Q.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(u&&(n.textContent!==o||c!==i||a!==Q.selectedCountryCode)){var s=G(n);var v=A(t);var l=typeof e.currencyConverter==="function"&&e.currencyConverter({convert:E,convertAndFormat:D,currencyCode:Q.targetCurrency,format:function(n){return N({amount:n})},originalAmount:v,selector:n});var d=l||D(v);if(d!==n.textContent){n.textContent=d}n.setAttribute("data-zrate",c.toString());n.setAttribute("data-zintl",d);n.setAttribute("data-zcountry-code",Q.selectedCountryCode||"");void F({specificSelector:n,timeoutId:s})}};var V=function(){var n=e.helloSettings.currencyElementSelector;var r=j(n);if(!(r===null||r===void 0?void 0:r.length)){return}if(!Q.exchangeRate){i("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(n){M(n)}))};var J=n("k",(function(){if(e.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){void U();return}V()}));var q=function(n){var r;var e=(r=Q.shippingZoneCountries)===null||r===void 0?void 0:r[n];if(e){return e.currencyCode}return null};var Z=n("j",(function(n){if(!n){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||e.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",n);var o="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,o)}}));var $=r({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricingConfigurations:[],inclusivePricingIsFetching:false,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),H=$.dispose,Y=$.onChange,Q=$.state;n({c:Y,l:Q});var W=function(n){return __awaiter(s,void 0,void 0,(function(){var r,t,o;return __generator(this,(function(i){switch(i.label){case 0:return[4,p({country:Q.selectedCountryCode,isGuaranteed:n,sourceCurrency:e.sourceCurrency,targetCurrency:Q.targetCurrency})];case 1:r=i.sent(),t=r.exchangeRate,o=r.maxAge;if(t){Q.exchangeRate=t;J()}return[2,{maxAge:o}]}}))}))};var X="CA";var nn=n("p",(function(n){if(Q.selectedCountryCode&&n.includes(Q.selectedCountryCode)){return Q.selectedCountryCode}return X}));var rn=function(n){return __awaiter(s,void 0,void 0,(function(){var r;return __generator(this,(function(e){switch(e.label){case 0:if(!n){return[2]}Q.inclusivePricingIsFetching=true;return[4,z(n)];case 1:r=e.sent();Q.inclusivePricingConfigurations=r||[];Q.inclusivePricingIsFetching=false;return[2]}}))}))};var en=function(n){var r=n.isGuaranteed,e=n.maxAge;if(Q.exchangeRateTimeout){clearTimeout(Q.exchangeRateTimeout)}var t=5*60;var o=e||t;Q.exchangeRateTimeout=setTimeout((function(){return __awaiter(s,void 0,void 0,(function(){var n;return __generator(this,(function(e){switch(e.label){case 0:return[4,rn(Q.selectedCountryCode)];case 1:e.sent();return[4,W(r)];case 2:n=e.sent().maxAge;en({isGuaranteed:r,maxAge:n});return[2]}}))}))}),o*1e3)};var tn=function(n){return __awaiter(s,[n],void 0,(function(n){var r,t,o,i,a,c,s,v;var l=n.isInitializing;return __generator(this,(function(n){switch(n.label){case 0:u("get new localization store");o=Q.isDisabledCountry,i=Q.isShippableCountry,a=Q.selectedCountryCode;if(e.helloSettings.currencyBehavior==="DISABLED"||!i||o||!a){return[2]}c=e.checkoutSettings.visibilityStatus==="ENABLED";K();return[4,W(c)];case 1:s=n.sent().maxAge;en({isGuaranteed:c,maxAge:s});if(l&&((r=window.Zonos.cartSettings)===null||r===void 0?void 0:r.inclusivePriceConfigurations)){Q.inclusivePricingConfigurations=((t=window.Zonos.cartSettings)===null||t===void 0?void 0:t.inclusivePriceConfigurations)||[];void U()}if(!!window.Zonos.isLegacyCheckout)return[3,3];Q.inclusivePricingIsFetching=true;return[4,Promise.all([g(Q.selectedCountryCode),rn(Q.selectedCountryCode)])];case 2:v=n.sent()[0];Q.countryLandedCost=v;void U();return[3,4];case 3:u("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");n.label=4;case 4:return[2]}}))}))};var on=function(){return __awaiter(s,void 0,void 0,(function(){var n,r;return __generator(this,(function(t){switch(t.label){case 0:u("Getting custom messages for ".concat(Q.selectedCountryCode));if(!Q.selectedCountryCode||!e.storeId){return[2]}return[4,b({countryCode:Q.selectedCountryCode,localeTo:Q.selectedLocale,storeId:e.storeId})];case 1:n=t.sent();r=n.flatMap((function(n){var r;return{countryCode:Q.selectedCountryCode,message:(r=n.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:n.pageName}}));Q.customMessages=r;return[2]}}))}))};var an=function(){var n=new URL(window.location.href);var r=n.searchParams.get("zonosLocale");return r};var un=function(){if(Q.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var cn=function(n){if(n==="UK"){return"GB"}return n};var sn=n("a",(function(n){var r=n.isInitializing,t=n.newSelectedCountryCode;var o,i;u("Updating selected country code to ".concat(t));var a=!Q.selectedCountryCode;Q.selectedCountryCode=cn(t);var c=Q.selectedCountryCode,s=Q.shippingZoneCountries;var v=!!s&&!!c&&!!s[c]&&!e.disabledCountries.includes(c);Q.isShippableCountry=v;u("".concat(Q.selectedCountryCode," is a shippable country: ").concat(Q.isShippableCountry));var l=!!c&&e.disabledCountries.includes(c);Q.isDisabledCountry=l;u("".concat(Q.selectedCountryCode," is a disabled country: ").concat(Q.isDisabledCountry));un();if(!c){return}var d=q(c);if(!a){(o=e.onCountryChange)===null||o===void 0?void 0:o.call(e,{countryCode:c,currencyCode:d,isShippableCountry:v})}if(!d){return}Q.targetCurrency=d;void tn({isInitializing:r});window.sessionStorage.setItem("zonos--country",c);Z(c);(i=document.querySelector("zonos-hello"))===null||i===void 0?void 0:i.setAttribute("z-country",c)}));var vn=function(n){var r=e.helloSettings.showCountryList;var t=Q.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){Q.helloCountryList=t;return}if(r==="ALL"){Q.helloCountryList=n;return}Q.helloCountryList=r.reduce((function(r,e){var t;var o=n===null||n===void 0?void 0:n[e];return o?Object.assign(Object.assign({},r),(t={},t[e]=o,t)):r}),{})};var ln=function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e;return __generator(this,(function(t){switch(t.label){case 0:if(!y.checkoutSessionId){return[2,null]}return[4,o("/api/zonos-elements/update-checkout-session-metadata",{body:{id:y.checkoutSessionId,metadata:[{key:"language",value:Q.selectedLocale}]},method:"POST"})];case 1:n=t.sent(),r=n.errors,e=n.json;if(r.length||!e){i("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:e}]}return[2,{errors:[],json:e}]}}))}))};var dn=n("r",(function(n){Q.selectedLocale=n;c(n);void ln();void on()}));var fn=n("h",(function(){return __awaiter(s,void 0,void 0,(function(){var n,r,e,t,o,i,a,c,s,v;return __generator(this,(function(l){switch(l.label){case 0:return[4,Promise.all([h(),k(),L()])];case 1:r=l.sent(),e=r[0],t=r[1],o=r[2];i=t===null||t===void 0?void 0:t.reduce((function(n,r){var t;var o=e===null||e===void 0?void 0:e[r];return o?Object.assign(Object.assign({},n),(t={},t[r]=o,t)):n}),{});Q.shippingZoneCountries=i||null;Q.inclusivePricingConfigurations=((n=window.Zonos.cartSettings)===null||n===void 0?void 0:n.inclusivePriceConfigurations)||[];vn(e||{});a=o.country,c=o.locale;u("Country code from localization: ".concat(a));u("Locale from localization: ".concat(c));sn({isInitializing:true,newSelectedCountryCode:a||null});s=an();dn(s||c||"en");v=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!Q.selectedCountryCode&&v.some((function(n){return window.location.origin.includes(n)}))){sn({isInitializing:true,newSelectedCountryCode:"CA"})}Q.localizationLoaded=true;return[2]}}))}))}))}}}));
@@ -1 +1 @@
1
- import{_ as t,b as n,i as r,d as i}from"./p-7af39c98.js";var o=t,e=/\s/,u=/^\s+/,f=n,a=r,c=function(t){return t?t.slice(0,function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}(t)+1).replace(u,""):t},v=i,s=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,m=/^0o[0-7]+$/i,p=parseInt,y=i,T=function(){return o.Date.now()},b=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||a(t)&&"[object Symbol]"==f(t)}(t))return NaN;if(v(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=v(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=c(t);var r=d.test(t);return r||m.test(t)?p(t.slice(2),r?2:8):s.test(t)?NaN:+t},l=Math.max,h=Math.min,x=function(t,n,r){var i,o,e,u,f,a,c=0,v=!1,s=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(n){var r=i,e=o;return i=o=void 0,c=n,u=t.apply(e,r)}function p(t){var r=t-a;return void 0===a||r>=n||r<0||s&&t-c>=e}function x(){var t=T();if(p(t))return N(t);f=setTimeout(x,function(t){var r=n-(t-a);return s?h(r,e-(t-c)):r}(t))}function N(t){return f=void 0,d&&i?m(t):(i=o=void 0,u)}function $(){var t=T(),r=p(t);if(i=arguments,o=this,a=t,r){if(void 0===f)return function(t){return c=t,f=setTimeout(x,n),v?m(t):u}(a);if(s)return clearTimeout(f),f=setTimeout(x,n),m(a)}return void 0===f&&(f=setTimeout(x,n)),u}return n=b(n)||0,y(r)&&(v=!!r.leading,e=(s="maxWait"in r)?l(b(r.maxWait)||0,n):e,d="trailing"in r?!!r.trailing:d),$.cancel=function(){void 0!==f&&clearTimeout(f),c=0,i=a=o=f=void 0},$.flush=function(){return void 0===f?u:N(T())},$};export{x as d}
1
+ import{_ as t,b as n,i as r,d as i}from"./p-b2a0ab4a.js";var o=t,e=/\s/,u=/^\s+/,f=n,a=r,c=function(t){return t?t.slice(0,function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}(t)+1).replace(u,""):t},v=i,s=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,m=/^0o[0-7]+$/i,p=parseInt,b=i,y=function(){return o.Date.now()},T=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||a(t)&&"[object Symbol]"==f(t)}(t))return NaN;if(v(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=v(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=c(t);var r=d.test(t);return r||m.test(t)?p(t.slice(2),r?2:8):s.test(t)?NaN:+t},l=Math.max,h=Math.min,x=function(t,n,r){var i,o,e,u,f,a,c=0,v=!1,s=!1,d=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function m(n){var r=i,e=o;return i=o=void 0,c=n,u=t.apply(e,r)}function p(t){var r=t-a;return void 0===a||r>=n||r<0||s&&t-c>=e}function x(){var t=y();if(p(t))return N(t);f=setTimeout(x,function(t){var r=n-(t-a);return s?h(r,e-(t-c)):r}(t))}function N(t){return f=void 0,d&&i?m(t):(i=o=void 0,u)}function $(){var t=y(),r=p(t);if(i=arguments,o=this,a=t,r){if(void 0===f)return function(t){return c=t,f=setTimeout(x,n),v?m(t):u}(a);if(s)return clearTimeout(f),f=setTimeout(x,n),m(a)}return void 0===f&&(f=setTimeout(x,n)),u}return n=T(n)||0,b(r)&&(v=!!r.leading,e=(s="maxWait"in r)?l(T(r.maxWait)||0,n):e,d="trailing"in r?!!r.trailing:d),$.cancel=function(){void 0!==f&&clearTimeout(f),c=0,i=a=o=f=void 0},$.flush=function(){return void 0===f?u:N(y())},$};export{x as d}
@@ -1 +1 @@
1
- import{a as t}from"./p-7af39c98.js";var e={exports:{}};e.exports=function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}var e=/^\s+/,r=/\s+$/;function a(n,i){if(i=i||{},(n=n||"")instanceof a)return n;if(!(this instanceof a))return new a(n,i);var f=function(a){var n={r:0,g:0,b:0},i=1,f=null,h=null,s=null,o=!1,u=!1;return"string"==typeof a&&(a=function(t){t=t.replace(e,"").replace(r,"").toLowerCase();var a,n=!1;if(y[t])t=y[t],n=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(a=$.rgb.exec(t))?{r:a[1],g:a[2],b:a[3]}:(a=$.rgba.exec(t))?{r:a[1],g:a[2],b:a[3],a:a[4]}:(a=$.hsl.exec(t))?{h:a[1],s:a[2],l:a[3]}:(a=$.hsla.exec(t))?{h:a[1],s:a[2],l:a[3],a:a[4]}:(a=$.hsv.exec(t))?{h:a[1],s:a[2],v:a[3]}:(a=$.hsva.exec(t))?{h:a[1],s:a[2],v:a[3],a:a[4]}:(a=$.hex8.exec(t))?{r:F(a[1]),g:F(a[2]),b:F(a[3]),a:E(a[4]),format:n?"name":"hex8"}:(a=$.hex6.exec(t))?{r:F(a[1]),g:F(a[2]),b:F(a[3]),format:n?"name":"hex"}:(a=$.hex4.exec(t))?{r:F(a[1]+""+a[1]),g:F(a[2]+""+a[2]),b:F(a[3]+""+a[3]),a:E(a[4]+""+a[4]),format:n?"name":"hex8"}:!!(a=$.hex3.exec(t))&&{r:F(a[1]+""+a[1]),g:F(a[2]+""+a[2]),b:F(a[3]+""+a[3]),format:n?"name":"hex"}}(a)),"object"==t(a)&&(j(a.r)&&j(a.g)&&j(a.b)?(l=a.r,c=a.g,d=a.b,n={r:255*w(l,255),g:255*w(c,255),b:255*w(d,255)},o=!0,u="%"===String(a.r).substr(-1)?"prgb":"rgb"):j(a.h)&&j(a.s)&&j(a.v)?(f=R(a.s),h=R(a.v),n=function(t,e,r){t=6*w(t,360),e=w(e,100),r=w(r,100);var a=Math.floor(t),n=t-a,i=r*(1-e),f=r*(1-n*e),h=r*(1-(1-n)*e),s=a%6;return{r:255*[r,f,i,i,h,r][s],g:255*[h,r,r,f,i,i][s],b:255*[i,i,h,r,r,f][s]}}(a.h,f,h),o=!0,u="hsv"):j(a.h)&&j(a.s)&&j(a.l)&&(f=R(a.s),s=R(a.l),n=function(t,e,r){var a,n,i;function f(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=w(t,360),e=w(e,100),r=w(r,100),0===e)a=n=i=r;else{var h=r<.5?r*(1+e):r+e-r*e,s=2*r-h;a=f(s,h,t+1/3),n=f(s,h,t),i=f(s,h,t-1/3)}return{r:255*a,g:255*n,b:255*i}}(a.h,f,s),o=!0,u="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=A(i),{ok:o,format:a.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:i};var l,c,d}(n);this._originalInput=n,this._r=f.r,this._g=f.g,this._b=f.b,this._a=f.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||f.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=f.ok}function n(t,e,r){t=w(t,255),e=w(e,255),r=w(r,255);var a,n,i=Math.max(t,e,r),f=Math.min(t,e,r),h=(i+f)/2;if(i==f)a=n=0;else{var s=i-f;switch(n=h>.5?s/(2-i-f):s/(i+f),i){case t:a=(e-r)/s+(e<r?6:0);break;case e:a=(r-t)/s+2;break;case r:a=(t-e)/s+4}a/=6}return{h:a,s:n,l:h}}function i(t,e,r){t=w(t,255),e=w(e,255),r=w(r,255);var a,n,i=Math.max(t,e,r),f=Math.min(t,e,r),h=i,s=i-f;if(n=0===i?0:s/i,i==f)a=0;else{switch(i){case t:a=(e-r)/s+(e<r?6:0);break;case e:a=(r-t)/s+2;break;case r:a=(t-e)/s+4}a/=6}return{h:a,s:n,v:h}}function f(t,e,r,a){var n=[S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function h(t,e,r,a){return[S(q(a)),S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16))].join("")}function s(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.s-=e/100,r.s=x(r.s),a(r)}function o(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.s+=e/100,r.s=x(r.s),a(r)}function u(t){return a(t).desaturate(100)}function l(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.l+=e/100,r.l=x(r.l),a(r)}function c(t,e){e=0===e?0:e||10;var r=a(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-e/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-e/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-e/100*255))),a(r)}function d(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.l-=e/100,r.l=x(r.l),a(r)}function g(t,e){var r=a(t).toHsl(),n=(r.h+e)%360;return r.h=n<0?360+n:n,a(r)}function b(t){var e=a(t).toHsl();return e.h=(e.h+180)%360,a(e)}function m(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=a(t).toHsl(),n=[a(t)],i=360/e,f=1;f<e;f++)n.push(a({h:(r.h+f*i)%360,s:r.s,l:r.l}));return n}function v(t){var e=a(t).toHsl(),r=e.h;return[a(t),a({h:(r+72)%360,s:e.s,l:e.l}),a({h:(r+216)%360,s:e.s,l:e.l})]}function M(t,e,r){e=e||6,r=r||30;var n=a(t).toHsl(),i=360/r,f=[a(t)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,f.push(a(n));return f}function p(t,e){e=e||6;for(var r=a(t).toHsv(),n=r.h,i=r.s,f=r.v,h=[],s=1/e;e--;)h.push(a({h:n,s:i,v:f})),f=(f+s)%1;return h}a.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,a=this.toRgb();return e=a.g/255,r=a.b/255,.2126*((t=a.r/255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=A(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),a=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+a+"%)":"hsva("+e+", "+r+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var t=n(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=n(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),a=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+a+"%)":"hsla("+e+", "+r+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return f(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,a,n){var i=[S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16)),S(q(a))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*w(this._r,255))+"%",g:Math.round(100*w(this._g,255))+"%",b:Math.round(100*w(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%)":"rgba("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(k[f(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=a(t);r="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1;return e||!(this._a<1&&this._a>=0)||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return a(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(c,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(o,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(m,[3])},tetrad:function(){return this._applyCombination(m,[4])}},a.fromRatio=function(e,r){if("object"==t(e)){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]="a"===i?e[i]:R(e[i]));e=n}return a(e,r)},a.equals=function(t,e){return!(!t||!e)&&a(t).toRgbString()==a(e).toRgbString()},a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},a.mix=function(t,e,r){r=0===r?0:r||50;var n=a(t).toRgb(),i=a(e).toRgb(),f=r/100;return a({r:(i.r-n.r)*f+n.r,g:(i.g-n.g)*f+n.g,b:(i.b-n.b)*f+n.b,a:(i.a-n.a)*f+n.a})},a.readability=function(t,e){var r=a(t),n=a(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)},a.isReadable=function(t,e,r){var n,i,f,h,s,o=a.readability(t,e);switch(i=!1,(f=r,"AA"!==(h=((f=f||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==h&&(h="AA"),"small"!==(s=(f.size||"small").toLowerCase())&&"large"!==s&&(s="small"),n={level:h,size:s}).level+n.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},a.mostReadable=function(t,e,r){var n,i,f,h,s=null,o=0;i=(r=r||{}).includeFallbackColors,f=r.level,h=r.size;for(var u=0;u<e.length;u++)(n=a.readability(t,e[u]))>o&&(o=n,s=a(e[u]));return a.isReadable(t,s,{level:f,size:h})||!i?s:(r.includeFallbackColors=!1,a.mostReadable(t,["#fff","#000"],r))};var y=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},k=a.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(y);function A(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function w(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function x(t){return Math.min(1,Math.max(0,t))}function F(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function q(t){return Math.round(255*parseFloat(t)).toString(16)}function E(t){return F(t)/255}var H,N,I,$=(N="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",I="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{CSS_UNIT:new RegExp(H),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+I),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+I),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+I),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function j(t){return!!$.CSS_UNIT.exec(t)}return a}();const r=e.exports,a=t=>r(t).isDark();export{a as i,r as t}
1
+ import{a as t}from"./p-b2a0ab4a.js";var e={exports:{}};e.exports=function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}var e=/^\s+/,r=/\s+$/;function a(n,i){if(i=i||{},(n=n||"")instanceof a)return n;if(!(this instanceof a))return new a(n,i);var f=function(a){var n={r:0,g:0,b:0},i=1,f=null,h=null,s=null,o=!1,u=!1;return"string"==typeof a&&(a=function(t){t=t.replace(e,"").replace(r,"").toLowerCase();var a,n=!1;if(y[t])t=y[t],n=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};return(a=$.rgb.exec(t))?{r:a[1],g:a[2],b:a[3]}:(a=$.rgba.exec(t))?{r:a[1],g:a[2],b:a[3],a:a[4]}:(a=$.hsl.exec(t))?{h:a[1],s:a[2],l:a[3]}:(a=$.hsla.exec(t))?{h:a[1],s:a[2],l:a[3],a:a[4]}:(a=$.hsv.exec(t))?{h:a[1],s:a[2],v:a[3]}:(a=$.hsva.exec(t))?{h:a[1],s:a[2],v:a[3],a:a[4]}:(a=$.hex8.exec(t))?{r:F(a[1]),g:F(a[2]),b:F(a[3]),a:E(a[4]),format:n?"name":"hex8"}:(a=$.hex6.exec(t))?{r:F(a[1]),g:F(a[2]),b:F(a[3]),format:n?"name":"hex"}:(a=$.hex4.exec(t))?{r:F(a[1]+""+a[1]),g:F(a[2]+""+a[2]),b:F(a[3]+""+a[3]),a:E(a[4]+""+a[4]),format:n?"name":"hex8"}:!!(a=$.hex3.exec(t))&&{r:F(a[1]+""+a[1]),g:F(a[2]+""+a[2]),b:F(a[3]+""+a[3]),format:n?"name":"hex"}}(a)),"object"==t(a)&&(j(a.r)&&j(a.g)&&j(a.b)?(l=a.r,c=a.g,d=a.b,n={r:255*w(l,255),g:255*w(c,255),b:255*w(d,255)},o=!0,u="%"===String(a.r).substr(-1)?"prgb":"rgb"):j(a.h)&&j(a.s)&&j(a.v)?(f=R(a.s),h=R(a.v),n=function(t,e,r){t=6*w(t,360),e=w(e,100),r=w(r,100);var a=Math.floor(t),n=t-a,i=r*(1-e),f=r*(1-n*e),h=r*(1-(1-n)*e),s=a%6;return{r:255*[r,f,i,i,h,r][s],g:255*[h,r,r,f,i,i][s],b:255*[i,i,h,r,r,f][s]}}(a.h,f,h),o=!0,u="hsv"):j(a.h)&&j(a.s)&&j(a.l)&&(f=R(a.s),s=R(a.l),n=function(t,e,r){var a,n,i;function f(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=w(t,360),e=w(e,100),r=w(r,100),0===e)a=n=i=r;else{var h=r<.5?r*(1+e):r+e-r*e,s=2*r-h;a=f(s,h,t+1/3),n=f(s,h,t),i=f(s,h,t-1/3)}return{r:255*a,g:255*n,b:255*i}}(a.h,f,s),o=!0,u="hsl"),a.hasOwnProperty("a")&&(i=a.a)),i=A(i),{ok:o,format:a.format||u,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:i};var l,c,d}(n);this._originalInput=n,this._r=f.r,this._g=f.g,this._b=f.b,this._a=f.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||f.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=f.ok}function n(t,e,r){t=w(t,255),e=w(e,255),r=w(r,255);var a,n,i=Math.max(t,e,r),f=Math.min(t,e,r),h=(i+f)/2;if(i==f)a=n=0;else{var s=i-f;switch(n=h>.5?s/(2-i-f):s/(i+f),i){case t:a=(e-r)/s+(e<r?6:0);break;case e:a=(r-t)/s+2;break;case r:a=(t-e)/s+4}a/=6}return{h:a,s:n,l:h}}function i(t,e,r){t=w(t,255),e=w(e,255),r=w(r,255);var a,n,i=Math.max(t,e,r),f=Math.min(t,e,r),h=i,s=i-f;if(n=0===i?0:s/i,i==f)a=0;else{switch(i){case t:a=(e-r)/s+(e<r?6:0);break;case e:a=(r-t)/s+2;break;case r:a=(t-e)/s+4}a/=6}return{h:a,s:n,v:h}}function f(t,e,r,a){var n=[S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function h(t,e,r,a){return[S(q(a)),S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16))].join("")}function s(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.s-=e/100,r.s=x(r.s),a(r)}function o(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.s+=e/100,r.s=x(r.s),a(r)}function u(t){return a(t).desaturate(100)}function l(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.l+=e/100,r.l=x(r.l),a(r)}function c(t,e){e=0===e?0:e||10;var r=a(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-e/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-e/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-e/100*255))),a(r)}function d(t,e){e=0===e?0:e||10;var r=a(t).toHsl();return r.l-=e/100,r.l=x(r.l),a(r)}function g(t,e){var r=a(t).toHsl(),n=(r.h+e)%360;return r.h=n<0?360+n:n,a(r)}function b(t){var e=a(t).toHsl();return e.h=(e.h+180)%360,a(e)}function m(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=a(t).toHsl(),n=[a(t)],i=360/e,f=1;f<e;f++)n.push(a({h:(r.h+f*i)%360,s:r.s,l:r.l}));return n}function v(t){var e=a(t).toHsl(),r=e.h;return[a(t),a({h:(r+72)%360,s:e.s,l:e.l}),a({h:(r+216)%360,s:e.s,l:e.l})]}function M(t,e,r){e=e||6,r=r||30;var n=a(t).toHsl(),i=360/r,f=[a(t)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,f.push(a(n));return f}function p(t,e){e=e||6;for(var r=a(t).toHsv(),n=r.h,i=r.s,f=r.v,h=[],s=1/e;e--;)h.push(a({h:n,s:i,v:f})),f=(f+s)%1;return h}a.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,a=this.toRgb();return e=a.g/255,r=a.b/255,.2126*((t=a.r/255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=A(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),a=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+a+"%)":"hsva("+e+", "+r+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var t=n(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=n(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),a=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+a+"%)":"hsla("+e+", "+r+"%, "+a+"%, "+this._roundA+")"},toHex:function(t){return f(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,a,n){var i=[S(Math.round(t).toString(16)),S(Math.round(e).toString(16)),S(Math.round(r).toString(16)),S(q(a))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*w(this._r,255))+"%",g:Math.round(100*w(this._g,255))+"%",b:Math.round(100*w(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%)":"rgba("+Math.round(100*w(this._r,255))+"%, "+Math.round(100*w(this._g,255))+"%, "+Math.round(100*w(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(k[f(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+h(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=a(t);r="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1;return e||!(this._a<1&&this._a>=0)||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return a(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(c,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(o,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(m,[3])},tetrad:function(){return this._applyCombination(m,[4])}},a.fromRatio=function(e,r){if("object"==t(e)){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]="a"===i?e[i]:R(e[i]));e=n}return a(e,r)},a.equals=function(t,e){return!(!t||!e)&&a(t).toRgbString()==a(e).toRgbString()},a.random=function(){return a.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},a.mix=function(t,e,r){r=0===r?0:r||50;var n=a(t).toRgb(),i=a(e).toRgb(),f=r/100;return a({r:(i.r-n.r)*f+n.r,g:(i.g-n.g)*f+n.g,b:(i.b-n.b)*f+n.b,a:(i.a-n.a)*f+n.a})},a.readability=function(t,e){var r=a(t),n=a(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)},a.isReadable=function(t,e,r){var n,i,f,h,s,o=a.readability(t,e);switch(i=!1,(f=r,"AA"!==(h=((f=f||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==h&&(h="AA"),"small"!==(s=(f.size||"small").toLowerCase())&&"large"!==s&&(s="small"),n={level:h,size:s}).level+n.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},a.mostReadable=function(t,e,r){var n,i,f,h,s=null,o=0;i=(r=r||{}).includeFallbackColors,f=r.level,h=r.size;for(var u=0;u<e.length;u++)(n=a.readability(t,e[u]))>o&&(o=n,s=a(e[u]));return a.isReadable(t,s,{level:f,size:h})||!i?s:(r.includeFallbackColors=!1,a.mostReadable(t,["#fff","#000"],r))};var y=a.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},k=a.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(y);function A(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function w(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function x(t){return Math.min(1,Math.max(0,t))}function F(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function q(t){return Math.round(255*parseFloat(t)).toString(16)}function E(t){return F(t)/255}var H,N,I,$=(N="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",I="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{CSS_UNIT:new RegExp(H),rgb:new RegExp("rgb"+N),rgba:new RegExp("rgba"+I),hsl:new RegExp("hsl"+N),hsla:new RegExp("hsla"+I),hsv:new RegExp("hsv"+N),hsva:new RegExp("hsva"+I),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function j(t){return!!$.CSS_UNIT.exec(t)}return a}();const r=e.exports,a=t=>r(t).isDark();export{a as i,r as t}
@@ -1 +1 @@
1
- System.register(["./p-5fc34563.system.js","./p-89c5164b.system.js","./p-23e7c655.system.js","./p-433d76b4.system.js","./p-c5d1217f.system.js","./p-d938f42f.system.js"],(function(o){"use strict";var s,e,i,t,n,r,a,l,d;return{setters:[function(o){s=o.r;e=o.c;i=o.h;t=o.H},function(o){n=o.f;r=o.z},function(o){a=o.c},function(o){l=o.g},function(o){d=o.i},function(){}],execute:function(){var h=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--zonos--selected-border-color, var(--zonos-elements-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:16px;-ms-flex-align:center;align-items:center;gap:16px;cursor:pointer;border:1px solid var(--zonos-elements-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));border-top-right-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));border-bottom-left-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--zonos--selected-border-color, var(--zonos-elements-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";var c=h;var p=o("zonos_shipping_rich_radio",function(){function o(o){var i=this;s(this,o);this.radioSelected=e(this,"radioSelected",7);this.selectedItem=null;this.handleRichRadioSelect=function(o){var s;(s=i.radioSelected)===null||s===void 0?void 0:s.emit(o)};this.getRadioItemStyleVariables=function(){var o=i.borderColor||r.appearance.colorSecondary;var s=d(o)?"var(--zonos-elements-".concat(o,")"):o;return{"--zonos--border-radius":l({overrideBorderStyle:i.borderStyle}),"--zonos--selected-border-color":s||"unset"}}}o.prototype.render=function(){var o=this;var s;return i(t,{key:"34abb7026ed7d382870f912b5e5c5631e4f06f76",class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:Object.assign(Object.assign({},this.getRadioItemStyleVariables()),{"--zonos--font-family":n()})},(s=this.items)===null||s===void 0?void 0:s.map((function(s){var e;var t=((e=o.selectedItem)===null||e===void 0?void 0:e.value)===s.value;return i("div",{"aria-hidden":"true",class:a(["zonos--shipping-rich-radio-item",t&&"selected"]),onClick:function(){return o.handleRichRadioSelect(s)}},i("input",{checked:t,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:s.value}),i("div",{class:"zonos--shipping-info"},i("div",{class:"zonos--shipping-detail"},i("zonos-text",{class:"zonos--shipping-label",type:"label"},s.label),(s.sublabel||s.caption)&&i("div",{class:"zonos--sub-detail"},s.sublabel&&i("zonos-text",{textColor:"gray-800"},s.sublabel),s.caption&&i("zonos-text",{textColor:"gray-600"},s.caption))),i("zonos-text",{type:"semiBoldLabel"},s.price)))})))};return o}());p.style=c}}}));
1
+ System.register(["./p-989d3af9.system.js","./p-d45285aa.system.js","./p-23e7c655.system.js","./p-23d497e3.system.js","./p-c5d1217f.system.js","./p-d938f42f.system.js"],(function(o){"use strict";var s,e,i,t,n,r,a,l,d;return{setters:[function(o){s=o.r;e=o.c;i=o.h;t=o.H},function(o){n=o.f;r=o.z},function(o){a=o.c},function(o){l=o.g},function(o){d=o.i},function(){}],execute:function(){var h=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host input{margin:0;accent-color:var(--zonos--selected-border-color, var(--zonos-elements-blue-600))}:host .zonos--shipping-rich-radio-item{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;padding:16px;-ms-flex-align:center;align-items:center;gap:16px;cursor:pointer;border:1px solid var(--zonos-elements-gray-200)}:host .zonos--shipping-rich-radio-item:first-child{border-top-left-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));border-top-right-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:last-child{border-bottom-right-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));border-bottom-left-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--shipping-rich-radio-item:not(:last-child){border-bottom:none}:host .zonos--shipping-rich-radio-item.selected{outline:1px solid var(--zonos--selected-border-color, var(--zonos-elements-blue-600));outline-offset:-1px}:host .zonos--shipping-info{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}:host .zonos--shipping-detail{-ms-flex:1;flex:1}:host .zonos--sub-detail{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap}";var p=h;var c=o("zonos_shipping_rich_radio",function(){function o(o){var i=this;s(this,o);this.radioSelected=e(this,"radioSelected",7);this.selectedItem=null;this.handleRichRadioSelect=function(o){var s;(s=i.radioSelected)===null||s===void 0?void 0:s.emit(o)};this.getRadioItemStyleVariables=function(){var o=i.borderColor||r.appearance.colorSecondary;var s=d(o)?"var(--zonos-elements-".concat(o,")"):o;return{"--zonos--border-radius":l({overrideBorderStyle:i.borderStyle}),"--zonos--selected-border-color":s||"unset"}}}o.prototype.render=function(){var o=this;var s;return i(t,{key:"34abb7026ed7d382870f912b5e5c5631e4f06f76",class:"zonos--shipping-rich-radio zonos--elements","data-theme":this.theme,style:Object.assign(Object.assign({},this.getRadioItemStyleVariables()),{"--zonos--font-family":n()})},(s=this.items)===null||s===void 0?void 0:s.map((function(s){var e;var t=((e=o.selectedItem)===null||e===void 0?void 0:e.value)===s.value;return i("div",{"aria-hidden":"true",class:a(["zonos--shipping-rich-radio-item",t&&"selected"]),onClick:function(){return o.handleRichRadioSelect(s)}},i("input",{checked:t,class:"zonos--shipping-rich-radio-input",name:"zonos--shipping-rich-radio",type:"radio",value:s.value}),i("div",{class:"zonos--shipping-info"},i("div",{class:"zonos--shipping-detail"},i("zonos-text",{class:"zonos--shipping-label",type:"label"},s.label),(s.sublabel||s.caption)&&i("div",{class:"zonos--sub-detail"},s.sublabel&&i("zonos-text",{textColor:"gray-800"},s.sublabel),s.caption&&i("zonos-text",{textColor:"gray-600"},s.caption))),i("zonos-text",{type:"semiBoldLabel"},s.price)))})))};return o}());c.style=p}}}));
@@ -1 +1 @@
1
- import{z as e,c as t}from"./p-7af39c98.js";import{s as o,l as n,e as s,f as r,b as i}from"./p-7c96a585.js";import{t as a}from"./p-c0e080e3.js";import{f as d,h as l,g as c,a as u,s as m,l as p,j as v}from"./p-41dd1cb8.js";import{l as h,b as y}from"./p-0a377722.js";import{i as g}from"./p-e688e493.js";import{g as w}from"./p-0ffd710e.js";const f=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const s=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=s[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||s.slice(1).join(" ").trim()||""}},b=({currentAddress:e,translatedAddress:t})=>{var o,n,s,r,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(s=t.line2)||void 0===s?void 0:s[u||""])||u||"",name:(null===(r=t.name)||void 0===r?void 0:r[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},S=e=>{var t;const r="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=L.stripeLinkEventData,a=L.stripeAddressEventData,d=L.stripeShippingSameAsBilling?L.stripeAddressEventData:L.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=b({currentAddress:a,translatedAddress:L.translatedAddress.address}),{firstName:c,lastName:u}=f({name:l.name}),m=b({currentAddress:d,translatedAddress:L.translatedAddress.address}),{firstName:p,lastName:v}=f({name:m.name}),h=s()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:p,lastName:v,phone:m.phone},cartCurrencyCode:null===(t=se.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||n.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:L.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!r,landedCostAdjustments:se.promoCode?[{amount:0,productId:null,promoCode:se.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:L.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},C=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=L.stripeLinkEventData,n=L.stripeAddressEventData,s=L.stripeShippingSameAsBilling?L.stripeAddressEventData:L.stripeBillingAddressEventData;if(h({stripeAddressData:n,stripeBillingAddressData:s},"info"),!n||!s)throw new Error("Missing stripe address data");const r=b({currentAddress:n,translatedAddress:L.translatedAddress.address}),{firstName:i,lastName:a}=f({name:r.name}),d=b({currentAddress:s,translatedAddress:L.translatedAddress.address}),{firstName:l,lastName:c}=f({name:d.name}),u=se.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),m=se.promoCode?[{amount:0,productId:null,promoCode:se.promoCode,sku:null,type:"PROMO_CODE"},...u]:u;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:c,phone:d.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:L.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:r.phone},isTest:e,items:se.items,landedCostAdjustments:m,shipToTaxId:L.taxId,shippingAddress:{addressLine1:r.line1,addressLine2:r.line2,city:r.city,country:r.country,postalCode:r.postal_code,state:r.state}}};const O=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,s,r;const i=C(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:d.vercel});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(s=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===s?void 0:s.message)||"Unknown error"}`);const{errors:c,json:u}=await l("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(r=c.find(Boolean))||void 0===r?void 0:r.message)||"Unknown error"}`);return a})(n);return e}const{errors:s,json:r}=await l("/api/zonos-elements/calculate-landed-cost",{body:C(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r){if("The user aborted a request."===(null===(o=s[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(s.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!r)throw new Error("Failed to calculate landed cost");return r}return r})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n,s,r,i;const{errors:a,json:d}=await l("/api/zonos-elements/cart-calculate-landed-cost",{body:S(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(s=a[0])||void 0===s?void 0:s.message.includes("signal is aborted"))||(null===(r=a[0])||void 0===r?void 0:r.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:t,cartId:o}),{cartWorkflow:s}=n,r=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},r),{itemCreateWorkflow:s.items})},A=async({checkoutSessionId:t,eventName:o,metadata:s})=>{var r,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(r=window.Zonos)||void 0===r?void 0:r.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((c()||u()||p)&&!window.Zonos.zonosConversionTest)return;const v=n.selectedCountryCode,h=e.organizationId;if(!t)return void m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:y,checkoutSessionId:t,eventName:o,metadata:s,organizationId:h,trackEventLogs:d}});h||m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:y,checkoutSessionId:t,eventName:o,metadata:s,organizationId:h,trackEventLogs:d}});const g={checkoutSessionId:t,countryCode:v,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},s),{trackEventLogs:d}),organizationId:h};await l("/api/zonos-elements/track-conversion-event",{body:g,method:"POST"})},k=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},I=e=>e.sort(((e,t)=>e.amount-t.amount)),N=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await l(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(p("Failed to retrieve checkout session info before confirming payment ",t),m({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:y}}),{errorMessage:a("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(p("Landed cost is not found in the checkout session before confirming payment."),m({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:y}}),{errorMessage:a('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},j=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},T=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:E,reset:P,state:L}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),D=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},x=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},R=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return v(e)},U=async t=>{var o,s;const r=L.clientSecret;if(!L.stripe)return void h("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:s,overrideSecondaryColor:r,overrideTheme:i,paypalEnabled:a})=>{const d=s||e.appearance.colorPrimary,l=r||e.appearance.colorSecondary,c=d&&g(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},j({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},T({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:L.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:r,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(L.stripeElementsOptions);if(!L.stripeElements||!L.stripeElementsForBillingAddress)return L.stripeElementsForBillingAddress=null===(o=L.stripe)||void 0===o?void 0:o.elements(i),h("Stripe elements for billing address initialized"),L.stripeElements=null===(s=L.stripe)||void 0===s?void 0:s.elements(i),L.stripeElementsOptions=i,void h("Stripe elements initialized");a||(L.stripeElements.update(i),L.stripeElementsForBillingAddress.update(i),L.stripeElementsOptions=i,L.stripeElements.fetchUpdates()),h("Stripe elements updated")},_=()=>{sessionStorage.removeItem("zonos--client-secret"),P(),L.stripe=window.Zonos.stripe},z=({address:e,firstName:t,lastName:n,name:s,phone:r})=>{const{firstName:i,lastName:a}=f({firstName:t,lastName:n,name:s});return i&&a||m({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:s}}),r||m({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:r}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:r||"",postal_code:e.postal_code,state:e.state}},B=async()=>{var e,t,n,s;if(!(null===(e=L.stripeAddressEventData)||void 0===e?void 0:e.complete)||!L.stripeShippingSameAsBilling&&!(null===(t=L.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!L.stripeBillingAddressEventData)return{partiesCreated:!1};if(!se.landedCostData)return{partiesCreated:!1};const r=null===(n=se.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!r)return m({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,s,r;const i=JSON.stringify(null===(e=L.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=L.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=L.stripeAddressEventData)||void 0===n?void 0:n.value),d=!L.stripeShippingSameAsBilling&&JSON.stringify(null===(s=L.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===s?void 0:s.value)!==JSON.stringify(null===(r=L.stripeBillingAddressEventData)||void 0===r?void 0:r.value);return i||a||d||L.taxIdUsedWhenAsyncAddressUpdate!==L.taxId||L.companyNameUsedWhenAsyncAddressUpdate!==L.companyName})();if(!i)return{partiesCreated:!1};const a=z({address:L.stripeAddressEventData.value.address,firstName:L.stripeAddressEventData.value.firstName,lastName:L.stripeAddressEventData.value.lastName,name:L.stripeAddressEventData.value.name,phone:L.stripeAddressEventData.value.phone}),d=L.stripeShippingSameAsBilling?a:z({address:L.stripeBillingAddressEventData.value.address,firstName:L.stripeBillingAddressEventData.value.firstName,lastName:L.stripeBillingAddressEventData.value.lastName,name:L.stripeBillingAddressEventData.value.name,phone:L.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:u,json:v}=await l("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:L.companyName,email:(null===(s=L.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isTest:c,rootId:r,taxId:L.taxId},method:"POST"});return u.length||!v?(p("Error occurs when creating parties",JSON.stringify(u,null,2)),m({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:u,json:v}}),{partiesCreated:!1}):(L.companyNameUsedWhenAsyncAddressUpdate=L.companyName,L.stripeAddressUsedWhenAsyncAddressUpdate=L.stripeAddressEventData,L.stripeBillingAddressUsedWhenAsyncAddressUpdate=L.stripeBillingAddressEventData,L.taxIdUsedWhenAsyncAddressUpdate=L.taxId,L.partyBillingId=v.billToPartyId,L.partyShippingId=v.shipToPartyId,{partiesCreated:!0})},F=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),J=async t=>{var n,s,r,i;const a=(null==t?void 0:t.retries)||0,d=!!(null==t?void 0:t.applyingPromocode),l=(()=>{var e;const t=se.landedCostData&&(null===(e=se.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==se.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=L.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.value),n=L.stripeAddressEventData&&JSON.stringify(F(L.stripeAddressEventData.value))!==JSON.stringify(L.stripeAddressUsedWhenFetchingLC),s=!L.stripeShippingSameAsBilling&&L.stripeBillingAddressEventData&&JSON.stringify(F(L.stripeBillingAddressEventData.value))!==JSON.stringify(L.stripeBillingAddressUsedWhenFetchingLC);return o||n||s})();return h("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!se.landedCostData&&!L.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,s;const r=!!(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=L.stripeAddressEventData)||void 0===o?void 0:o.complete),a=L.stripeShippingSameAsBilling?i:!!(null===(n=L.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const s=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,r=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===se.addressFormRenderType&&(r&&t in r?r[t]:null)||(s&&t in s?s[t]:null)})((null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US");return!!(i&&a&&r)||(d&&L.stripeAddressEventData?r&&L.stripeAddressEventData.value.firstName&&L.stripeAddressEventData.value.lastName&&L.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&L.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&L.stripeAddressEventData.value.address.postal_code.length>=3)&&L.stripeAddressEventData.value.phone&&L.stripeAddressEventData.value.phone.length>0:i&&a&&r)})())return{isRequestNotReady:!0};if(l&&(null===(n=L.fetchingLandedCostAbortController)||void 0===n||n.abort(),L.fetchingLandedCostAbortController=null),!l&&!d)return{isRequestNotReady:!1};a?(L.isFetchingLandedCost=!1,setTimeout((()=>{L.isFetchingLandedCost=!0}),300)):L.isFetchingLandedCost=!0,L.stripeAddressEventData&&(L.stripeAddressUsedWhenFetchingLC={countryCode:L.stripeAddressEventData.value.address.country,postalCode:L.stripeAddressEventData.value.address.postal_code,state:L.stripeAddressEventData.value.address.state}),L.stripeBillingAddressEventData&&(L.stripeBillingAddressUsedWhenFetchingLC={countryCode:L.stripeBillingAddressEventData.value.address.country,postalCode:L.stripeBillingAddressEventData.value.address.postal_code,state:L.stripeBillingAddressEventData.value.address.state}),L.stripeLinkEventData&&(L.stripeLinkUsedWhenFetchingLC=Object.assign({},L.stripeLinkEventData));try{fe(),await(async()=>{var e;const t=new AbortController;L.fetchingLandedCostAbortController=t,fe();const{checkoutSessionWorkflow:n,errors:s,itemCreateWorkflow:r,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await O(t);se.customQuotingError=(null===(e=null==s?void 0:s.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,se.shippingData=I((null==d?void 0:d.filter(Boolean))||[]),de(r),L.fetchingLandedCostAbortController=null,se.partiesData=(null==a?void 0:a.filter(Boolean))||[],se.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&A({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=se.promoCodeApplied&&!se.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));se.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",se.promoCode)})();const e=null===(s=se.shippingData)||void 0===s?void 0:s.find(Boolean),t=null===(r=se.landedCostData)||void 0===r?void 0:r.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ue({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(se.landedCostData=[],se.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(a<1)return await J(Object.assign(Object.assign({},t),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=L.stripeAddressEventData)||void 0===i?void 0:i.value;m({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}p(e)}return L.isFetchingLandedCost=!1,{isRequestNotReady:!1}},M=async()=>{var e,t;await J({applyingPromocode:!0}),"payment"===se.step&&Se(),await B();const o=null===(e=se.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=se.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await ye({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},W=()=>{se.promoCode="",sessionStorage.removeItem("zonos--promo-code"),se.promoCodeError=!1,se.promoCodeApplied=!1},$=async()=>{"payment"===se.step&&Se(),W(),await M()},q=e=>{let t=[],o=!0;const n=window.Zonos.isCollect;switch(e){case"succeeded":t=[a("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",a("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],n&&(t=[a("Thank you for submitting your payment. We appreciate your prompt attention."),"",a("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[a("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[a("Payment failed. Please try another payment method.")],n&&(t=[a("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[a("Something went wrong.")]}return{isError:o,messages:t}},Y=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(p("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(L.shouldInventoryRefund=!0,null):null:a("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:se.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw m({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:se.items}}),e}},H=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},K=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=q(t);return{error:e,messages:o}}const o=e||L.clientSecret;if(!L.stripe||!o)return p("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[a("Something went wrong.")]};const{paymentIntent:n}=await L.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:r,messages:i}=q(s);return{error:r,messages:i,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},G=async e=>{var t,n;const s=!!(null===(t=L.stripePaymentEventData)||void 0===t?void 0:t.complete),r=L.stripeElements,i=L.stripe,d=L.clientSecret;if(L.customErrorMessage=null,!(null===(n=se.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await N();if(!l.valid)throw L.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(i&&r&&s&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),A({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await i.confirmPayment({confirmParams:{return_url:e.toString()},elements:r,redirect:"if_required"});if(h("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(a("Payment failed. Please try another payment method."))}},V=()=>{var e;const t=se.items.reduce(((e,t)=>e+t.amount*t.quantity),0),s=o.enabledVariantTestKeys||[];return{adjustmentsAmount:se.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=se.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:se.customerAuthenticationToken||void 0,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:L.skipPaymentIntent,varianceTestInput:s}},Z=async()=>{var e;if(!o.checkoutSessionId)return m({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:y,cartId:window.Zonos.cartId}}),void ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});const{errors:t,json:n}=await l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return p("Error occurs when getting payment intent",JSON.stringify(t,null,2)),m({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});pe(n.checkoutSessionPaymentIntentCreate)},Q=async()=>{var e,t;if(!n.targetCurrency)return p("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;L.isFetchingSession=!0;const o=V();h("Checkout session body","info",o);const{errors:s,json:r}=await l("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(L.isFetchingSession=!1,s.length||!r){const t=null===(e=s.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return p("Error occurred when creating checkout session",JSON.stringify(s,null,2)),!1}const i=r.checkoutSessionCreate;return pe(i),ue({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),h("Exchange rate updated for cart items (checkout session create)","info",se.exchangeRate),h("done-init-checkout-session"),!0},X=async()=>{const t=o.checkoutSessionId;if(!t)return p("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return h('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:L.checkoutSettlementCurrency},method:"POST"}),s=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&s===L.checkoutSettlementCurrency?(h(`Updated checkout session to settlement currency "${s}".`),!0):(p("Failed to update checkout session base currency"),!1)},ee=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:s,line2:r,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&s&&(o.line1={[e.line1]:s}),e.line2&&r&&(o.line2={[e.line2]:r}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},te=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,s,r;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:s})=>{const r=!!(null==o?void 0:o.complete);if(!r||!(s?r:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=f({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=f({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:k({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:s?void 0:k({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:L.stripeAddressEventData,stripeBillingAddressEventData:L.stripeBillingAddressEventData,stripeShippingSameAsBilling:L.stripeShippingSameAsBilling});if(!i)return void(L.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const s=JSON.stringify(null===(e=L.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeAddressEventData)||void 0===t?void 0:t.value),r=!L.stripeShippingSameAsBilling&&JSON.stringify(null===(o=L.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=L.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return s||r})();if(!a)return;const{errors:d,json:c}=await l("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!c)return p("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(L.translatedAddress={address:{},billingAddress:{}});L.stripeAddressUsedWhenValidatingAddress=L.stripeAddressEventData,L.stripeBillingAddressUsedWhenValidatingAddress=L.stripeBillingAddressEventData;const u=null===(o=L.stripeAddressEventData)||void 0===o?void 0:o.value.address,m=null===(n=L.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;L.translatedAddress={address:u?ee({currentAddress:Object.assign(Object.assign({},u),{name:null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:L.stripeShippingSameAsBilling?{}:ee({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=L.stripeBillingAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.billingAddress||null})}};E("clientSecret",(e=>{e&&L.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:oe,reset:ne,state:se}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:u(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),re=e=>{switch(e){case"DAYS":return a("days");case"WEEKS":return a("weeks");default:return a("business days")}},ie=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:re(o.type)}:null},ae=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),de=e=>{h("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=se.items.find((t=>ae({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return se.restrictedItems=t,se.items=se.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>ae({item1:t,item2:e})))}))),{cartItems:se.items,restrictedItems:t}},le=()=>{o.checkoutSessionId=null,ne()},ce=({messages:e,title:t})=>{le(),_(),se.step="error",se.error={messages:e,title:t}},ue=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{se.exchangeRate=o.exchangeRate,se.adjustmentTotal=o.adjustments,se.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,se.subtotal=o.items,se.total=o.total,se.currency=o.presentmentCurrencyCode,se.dutiesTaxesFeesEstimate=e||null},me=()=>!!se.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),pe=e=>{var t,n,s,a,d;L.clientSecret=e.clientSecret,L.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,L.customerProfile=e.customerProfile,se.checkoutSession=e,e.id||m({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:y,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const l=r(e.varianceTestResults||[]);i(l);const c=(null===(s=null===(n=null===(t=se.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===s?void 0:s.value)||(null===(d=null===(a=window.Zonos.cartData)||void 0===a?void 0:a.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===d?void 0:d.value)||null;c&&(h(`Found externalConfirmationPageURL: ${c}`),se.externalConfirmationPageURL=c)},ve=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:r,itemsAmount:i,landedCostId:d,shouldInitSessionOnFailure:c})=>{var u;if(d&&se.selectedLandedCost&&(ue({dutiesTaxesFeesEstimate:r,method:se.landedCostMethod,subtotals:se.selectedLandedCost.subtotals}),h("Exchange rate updated for cart items (landed cost subtotal)","info",se.exchangeRate)),!o.checkoutSessionId)return h("Could not update cart total without checkout session id","info"),!1;const{errors:m,json:v}=await(async({adjustmentsAmount:e,cartId:t,currency:s,id:r,itemsAmount:i,landedCostId:a,presentmentCountryCode:d})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:m}=await l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:L.partyBillingId,cartId:t,currency:s,customerAuthenticationToken:se.customerAuthenticationToken||void 0,id:r,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:L.partyShippingId,skipPaymentIntent:L.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!m?(p("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:m}):{errors:[],json:m}})({adjustmentsAmount:e,billToPartyId:L.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:i,landedCostId:d,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:L.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(m.length>0||!v){if(p("Error occurs when updating checkout session."),c){h("Initiating checkout session on failure","info");const e=await Q();return h(`stripeStoreInitCheckoutSession: ${e}`),!!e||(ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")}),!1)}return!1}return d||(ue({method:(null===(u=v.checkoutSessionUpdate.landedCost)||void 0===u?void 0:u.method)||"DDP",subtotals:v.checkoutSessionUpdate.subtotals}),h("Exchange rate updated for cart items (checkout session update)","info",se.exchangeRate)),pe(v.checkoutSessionUpdate),!0},he=t=>{var o,n,s;return"DAP"===t.method&&(null===(n=null===(o=e.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US"))||"DAP"===t.method&&t.remittance.length&&"ZONOS"===t.landedCostGuaranteeCode?"DDP":t.method},ye=async({applySubtotalsOnly:t,landedCostId:n,selectedShippingOption:s})=>{var r,i,a,d,l,c,u,m,p,v,y;h("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:s}),se.selectedShippingOption=s;const g=ie(se.selectedShippingOption);if(g){const{maxTransit:e,minTransit:t,unit:o}=g;se.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else se.selectedShippingOptionTransitTime="";const w=null===(r=se.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(se.selectedLandedCost=w||null,!w)return!1;const f=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;f&&h(`DAP quote, using estimate: ${f}`,"info"),se.landedCostMethod=he(w.landedCost),se.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));se.isSelectedShippingAboveDeminimis=S,se.isSelectedShippingGuarantee=b;let C=!1;t?(ue({dutiesTaxesFeesEstimate:f,method:se.landedCostMethod,subtotals:w.subtotals}),h("Exchange rate updated for cart items (landed cost subtotal)","info",se.exchangeRate),C=!0):C=await ve({adjustmentsAmount:se.adjustmentTotal,billToPartyId:L.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:f,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:L.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(u=se.items.find(Boolean))||void 0===u?void 0:u.currencyCode,A=(null===(m=L.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return L.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=se.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(v=e.genericSettings)||void 0===v?void 0:v.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},ge=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;h(`==START CHECKOUT TIMEOUT - ${n}==`),se.checkoutTimeoutInterval=setTimeout((()=>{se.checkoutSessionTimeoutShow=!0}),n)},we=()=>{se.checkoutTimeoutInterval&&(clearTimeout(se.checkoutTimeoutInterval),se.checkoutTimeoutInterval=null)},fe=()=>{se.items=se.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),se.restrictedItems=[]},be=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:s=!0})=>{var r;se.adjustments=e,se.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(r=t.find(Boolean))||void 0===r?void 0:r.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(se.currency=i,L.isFetchingSession=!0,await ve({adjustmentsAmount:d,billToPartyId:L.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:L.partyShippingId,shouldInitSessionOnFailure:s,varianceTestInput:o.enabledVariantTestKeys||[]}),L.isFetchingSession=!1)},Se=()=>{"shipping"===se.step?(se.step="customer-info",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})})):"payment"===se.step?(se.step="shipping",se.tabItems=Object.assign(Object.assign({},se.tabItems),{shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})})):"finish"===se.step&&(se.step="payment",se.tabItems=Object.assign(Object.assign({},se.tabItems),{payment:Object.assign(Object.assign({},se.tabItems.payment),{isDone:!1})}))},Ce=()=>{"customer-info"===se.step?(se.step="shipping",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems["customer-info"]),{isDone:!0})})):"shipping"===se.step?(se.step="payment",se.tabItems=Object.assign(Object.assign({},se.tabItems),{shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!0})})):"payment"===se.step&&(se.step="finish")},Oe=()=>{se.step="customer-info",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},se.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})}),se.selectedShippingOption=null,se.isSelectedShippingAboveDeminimis=!1,se.isSelectedShippingGuarantee=!1,se.selectedShippingOptionTransitTime="",se.dutiesTaxesFees=0,se.dutiesTaxesFeesEstimate=0,se.shipping=0,se.total=se.subtotal};export{N as A,E as B,z as C,ye as D,me as E,M as F,$ as G,W as H,q as I,te as J,f as K,B as L,ie as M,he as N,I as O,D as a,x as b,L as c,K as d,se as e,be as f,le as g,Oe as h,U as i,we as j,Q as k,Z as l,ge as m,V as n,ce as o,pe as p,J as q,Ce as r,R as s,A as t,X as u,Y as v,G as w,H as x,_ as y,oe as z}
1
+ import{z as e,c as t}from"./p-b2a0ab4a.js";import{s as o,l as n,e as s,f as r,b as i}from"./p-2557b96b.js";import{t as a}from"./p-5f77d19e.js";import{f as d,h as l,g as c,a as u,s as m,l as p,j as v}from"./p-41dd1cb8.js";import{l as h,b as y}from"./p-0a377722.js";import{i as g}from"./p-57fa64d7.js";import{g as w}from"./p-1f894984.js";const f=({firstName:e,lastName:t,name:o})=>{var n;if(!o&&!e&&!t)return{firstName:"",lastName:""};const s=(null==o?void 0:o.split(/\s+/))||[];return{firstName:(null==e?void 0:e.trim())||(null===(n=s[0])||void 0===n?void 0:n.trim())||"",lastName:(null==t?void 0:t.trim())||s.slice(1).join(" ").trim()||""}},b=({currentAddress:e,translatedAddress:t})=>{var o,n,s,r,i,a;const{city:d,country:l,line1:c,line2:u,postal_code:m,state:p}=e.value.address,v=e.value.name||[e.value.firstName,e.value.lastName].join(" ");return{city:(null===(o=t.city)||void 0===o?void 0:o[d])||d,country:l,line1:(null===(n=t.line1)||void 0===n?void 0:n[c])||c,line2:(null===(s=t.line2)||void 0===s?void 0:s[u||""])||u||"",name:(null===(r=t.name)||void 0===r?void 0:r[v])||v,phone:e.value.phone||"",postal_code:(null===(i=t.postal_code)||void 0===i?void 0:i[m])||m,state:(null===(a=t.state)||void 0===a?void 0:a[p])||p}},S=e=>{var t;const r="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),i=L.stripeLinkEventData,a=L.stripeAddressEventData,d=L.stripeShippingSameAsBilling?L.stripeAddressEventData:L.stripeBillingAddressEventData;if(!a||!d)throw new Error("Missing stripe address data");const l=b({currentAddress:a,translatedAddress:L.translatedAddress.address}),{firstName:c,lastName:u}=f({name:l.name}),m=b({currentAddress:d,translatedAddress:L.translatedAddress.address}),{firstName:p,lastName:v}=f({name:m.name}),h=s()||"US";return{billingAddress:{addressLine1:m.line1,addressLine2:m.line2||"",city:m.city,country:m.country,postalCode:m.postal_code,state:m.state},billingContact:{firstName:p,lastName:v,phone:m.phone},cartCurrencyCode:null===(t=se.items[0])||void 0===t?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:h||n.selectedCountryCode||void 0,checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:L.companyName,email:null==i?void 0:i.value.email,firstName:c,lastName:u,phone:l.phone},isTest:!!r,landedCostAdjustments:se.promoCode?[{amount:0,productId:null,promoCode:se.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:L.taxId,shippingAddress:{addressLine1:l.line1,addressLine2:l.line2,city:l.city,country:l.country,postalCode:l.postal_code,state:l.state}}},C=()=>{const e="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),t=L.stripeLinkEventData,n=L.stripeAddressEventData,s=L.stripeShippingSameAsBilling?L.stripeAddressEventData:L.stripeBillingAddressEventData;if(h({stripeAddressData:n,stripeBillingAddressData:s},"info"),!n||!s)throw new Error("Missing stripe address data");const r=b({currentAddress:n,translatedAddress:L.translatedAddress.address}),{firstName:i,lastName:a}=f({name:r.name}),d=b({currentAddress:s,translatedAddress:L.translatedAddress.address}),{firstName:l,lastName:c}=f({name:d.name}),u=se.adjustments.map((e=>({amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}))),m=se.promoCode?[{amount:0,productId:null,promoCode:se.promoCode,sku:null,type:"PROMO_CODE"},...u]:u;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:c,phone:d.phone},checkoutSessionId:o.checkoutSessionId||"",contact:{companyName:L.companyName,email:null==t?void 0:t.value.email,firstName:i,lastName:a,phone:r.phone},isTest:e,items:se.items,landedCostAdjustments:m,shipToTaxId:L.taxId,shippingAddress:{addressLine1:r.line1,addressLine2:r.line2,city:r.city,country:r.country,postalCode:r.postal_code,state:r.state}}};const O=async t=>{const o=window.Zonos.cartId;if(!o)return await(async t=>{var o;const n=e.checkoutSettings.buildLandedCost;if(n){const e=await(async e=>{var t,o,n,s,r;const i=C(),a=await e({billingAddress:i.billingAddress,billingContact:i.billingContact,checkoutSessionId:i.checkoutSessionId,contact:i.contact,landedCostAdjustments:i.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:i.shippingAddress,zonosApiRoute:d.vercel});if(!a||!(null===(t=a.checkoutSessionWorkflow)||void 0===t?void 0:t.length)&&(null===(o=a.errors)||void 0===o?void 0:o.length))throw new Error(`Failed to build landed cost: ${(null===(s=null===(n=null==a?void 0:a.errors)||void 0===n?void 0:n[0])||void 0===s?void 0:s.message)||"Unknown error"}`);const{errors:c,json:u}=await l("/api/zonos-elements/validate-landed-cost",{body:a,headers:{"Content-Type":"application/json"},method:"POST"});if(!u||c.length)throw new Error(`Invalid landed cost object: ${(null===(r=c.find(Boolean))||void 0===r?void 0:r.message)||"Unknown error"}`);return a})(n);return e}const{errors:s,json:r}=await l("/api/zonos-elements/calculate-landed-cost",{body:C(),method:"POST",signal:null==t?void 0:t.signal});if(s.length||!r){if("The user aborted a request."===(null===(o=s[0])||void 0===o?void 0:o.message))throw new Error("The landed cost calculation request was aborted to initiate a new one.");if(s.forEach((e=>{console.warn(`Error calculating landed cost: ${e.message}`)})),!r)throw new Error("Failed to calculate landed cost");return r}return r})(t);const n=await(async({abortController:e,cartId:t})=>{var o,n,s,r,i;const{errors:a,json:d}=await l("/api/zonos-elements/cart-calculate-landed-cost",{body:S(t),method:"POST",signal:null==e?void 0:e.signal});if(a.length||!d){const e="string"==typeof(null===(o=a[0])||void 0===o?void 0:o.message)&&("The user aborted a request."===(null===(n=a[0])||void 0===n?void 0:n.message)||(null===(s=a[0])||void 0===s?void 0:s.message.includes("signal is aborted"))||(null===(r=a[0])||void 0===r?void 0:r.message.includes("The operation was aborted"))||(null===(i=a[0])||void 0===i?void 0:i.message.includes("Fetch is aborted")));throw new Error(e?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost")}return d})({abortController:t,cartId:o}),{cartWorkflow:s}=n,r=function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(o[n[s]]=e[n[s]])}return o}(n,["cartWorkflow"]);return Object.assign(Object.assign({},r),{itemCreateWorkflow:s.items})},A=async({checkoutSessionId:t,eventName:o,metadata:s})=>{var r,i;const a=Date.now(),d=[...window.Zonos.trackEventLogs];window.Zonos.trackEventLogs.push({checkoutSessionId:t,eventCreated:a,eventName:o});const p=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!(null===(r=window.Zonos)||void 0===r?void 0:r.zonosQaUrl)||!!(null===(i=window.Zonos)||void 0===i?void 0:i.debug);if((c()||u()||p)&&!window.Zonos.zonosConversionTest)return;const v=n.selectedCountryCode,h=e.organizationId;if(!t)return void m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No checkout session id found`],metadata:{allLogs:y,checkoutSessionId:t,eventName:o,metadata:s,organizationId:h,trackEventLogs:d}});h||m({endpoint:"trackConversionEventMetric",errors:[`Event "${o}" - No organization id found`],metadata:{allLogs:y,checkoutSessionId:t,eventName:o,metadata:s,organizationId:h,trackEventLogs:d}});const g={checkoutSessionId:t,countryCode:v,eventCreated:a,eventName:o,metadata:Object.assign(Object.assign({},s),{trackEventLogs:d}),organizationId:h};await l("/api/zonos-elements/track-conversion-event",{body:g,method:"POST"})},k=({address:e,invalidAdddressList:t})=>{if(!e)return;if(!t)return;const o={};return t.city&&(o.city=e.city),t.line1&&(o.line1=e.line1),t.line2&&(o.line2=e.line2),t.postal_code&&(o.postal_code=e.postal_code),t.state&&(o.state=e.state),t.name&&(o.name=e.name),Object.keys(o).length?o:void 0},I=e=>e.sort(((e,t)=>e.amount-t.amount)),N=async()=>{var e;const{errors:t,json:n}=await(async()=>{if(!o.checkoutSessionId)return{errors:[{message:"No checkout session id found"}],json:null};const e=new URLSearchParams;e.set("checkoutSessionId",o.checkoutSessionId);const{errors:t,json:n}=await l(`/api/zonos-elements/get-checkout-session?${e.toString()}`);return{errors:t,json:n}})();return t.length||!n?(p("Failed to retrieve checkout session info before confirming payment ",t),m({endpoint:"validateCheckoutSession",errors:t.map((e=>e.message)),metadata:{allLogs:y}}),{errorMessage:a("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:!1}):(null===(e=n.checkoutSession.landedCost)||void 0===e?void 0:e.id)?{errorMessage:"",valid:!0}:(p("Landed cost is not found in the checkout session before confirming payment."),m({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:y}}),{errorMessage:a('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:!1})},j=({theme:t})=>{const o={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:e.appearance.fontSizeInputValue?`${e.appearance.fontSizeInputValue}px`:void 0,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:e.appearance.fontSizeInputLabel?`${e.appearance.fontSizeInputLabel}px`:void 0},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};return"DARK"===t?Object.assign(Object.assign({},o),{".Action":Object.assign(Object.assign({},o[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},o[".PickerItem--new"]),{color:"white"})}):o},T=({borderStyle:e,theme:t})=>"DARK"===t?{borderRadius:w({overrideBorderStyle:e}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"}:{borderRadius:w({overrideBorderStyle:e}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"},{onChange:E,reset:P,state:L}=t((()=>({checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:!1,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:!1,isFetchingLandedCost:!1,isFetchingSession:!1,partyBillingId:null,partyShippingId:null,shouldInventoryRefund:!1,shouldRenderPayInUsdButton:!1,skipPaymentIntent:"0"!==new URLSearchParams(window.location.search).get("skipPaymentIntent"),stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:!0,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}))),D=()=>{window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")},x=e=>{window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))},R=()=>{const e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return v(e)},U=async t=>{var o,s;const r=L.clientSecret;if(!L.stripe)return void h("Skip. Stripe is not initialized");const i=(({clientSecret:t,overrideBorderRadius:o,overridePrimaryColor:s,overrideSecondaryColor:r,overrideTheme:i,paypalEnabled:a})=>{const d=s||e.appearance.colorPrimary,l=r||e.appearance.colorSecondary,c=d&&g(d)?"night":"flat",u="DARK"===i?"night":"flat",m=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},j({theme:i||"LIGHT"})),theme:i?u:c,variables:Object.assign(Object.assign({},T({borderStyle:o,theme:"LIGHT"})),{colorPrimary:l})},clientSecret:t||void 0,customerSessionClientSecret:L.stripeCustomerSessionClientSecret||void 0,externalPaymentMethodTypes:[...m],locale:n.selectedLocale}})({clientSecret:r,overrideBorderRadius:null==t?void 0:t.overrideBorderRadius,overridePrimaryColor:null==t?void 0:t.overridePrimaryColor,overrideSecondaryColor:null==t?void 0:t.overrideSecondaryColor,overrideTheme:null==t?void 0:t.overrideTheme,paypalEnabled:null==t?void 0:t.paypalEnabled}),a=JSON.stringify(i)===JSON.stringify(L.stripeElementsOptions);if(!L.stripeElements||!L.stripeElementsForBillingAddress)return L.stripeElementsForBillingAddress=null===(o=L.stripe)||void 0===o?void 0:o.elements(i),h("Stripe elements for billing address initialized"),L.stripeElements=null===(s=L.stripe)||void 0===s?void 0:s.elements(i),L.stripeElementsOptions=i,void h("Stripe elements initialized");a||(L.stripeElements.update(i),L.stripeElementsForBillingAddress.update(i),L.stripeElementsOptions=i,L.stripeElements.fetchUpdates()),h("Stripe elements updated")},_=()=>{sessionStorage.removeItem("zonos--client-secret"),P(),L.stripe=window.Zonos.stripe},z=({address:e,firstName:t,lastName:n,name:s,phone:r})=>{const{firstName:i,lastName:a}=f({firstName:t,lastName:n,name:s});return i&&a||m({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,firstName:t,lastName:n,name:s}}),r||m({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,phone:r}}),{city:e.city,country:e.country,firstName:i,lastName:a,line1:e.line1,line2:e.line2,phone:r||"",postal_code:e.postal_code,state:e.state}},B=async()=>{var e,t,n,s;if(!(null===(e=L.stripeAddressEventData)||void 0===e?void 0:e.complete)||!L.stripeShippingSameAsBilling&&!(null===(t=L.stripeBillingAddressEventData)||void 0===t?void 0:t.complete)||!L.stripeBillingAddressEventData)return{partiesCreated:!1};if(!se.landedCostData)return{partiesCreated:!1};const r=null===(n=se.landedCostData.find(Boolean))||void 0===n?void 0:n.landedCost.rootId;if(!r)return m({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}}),{partiesCreated:!1};const i=(()=>{var e,t,o,n,s,r;const i=JSON.stringify(null===(e=L.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.value),a=JSON.stringify(null===(o=L.stripeAddressUsedWhenAsyncAddressUpdate)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=L.stripeAddressEventData)||void 0===n?void 0:n.value),d=!L.stripeShippingSameAsBilling&&JSON.stringify(null===(s=L.stripeBillingAddressUsedWhenAsyncAddressUpdate)||void 0===s?void 0:s.value)!==JSON.stringify(null===(r=L.stripeBillingAddressEventData)||void 0===r?void 0:r.value);return i||a||d||L.taxIdUsedWhenAsyncAddressUpdate!==L.taxId||L.companyNameUsedWhenAsyncAddressUpdate!==L.companyName})();if(!i)return{partiesCreated:!1};const a=z({address:L.stripeAddressEventData.value.address,firstName:L.stripeAddressEventData.value.firstName,lastName:L.stripeAddressEventData.value.lastName,name:L.stripeAddressEventData.value.name,phone:L.stripeAddressEventData.value.phone}),d=L.stripeShippingSameAsBilling?a:z({address:L.stripeBillingAddressEventData.value.address,firstName:L.stripeBillingAddressEventData.value.firstName,lastName:L.stripeBillingAddressEventData.value.lastName,name:L.stripeBillingAddressEventData.value.name,phone:L.stripeBillingAddressEventData.value.phone}),c="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:u,json:v}=await l("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:d,companyName:L.companyName,email:(null===(s=L.stripeLinkEventData)||void 0===s?void 0:s.value.email)||"",isTest:c,rootId:r,taxId:L.taxId},method:"POST"});return u.length||!v?(p("Error occurs when creating parties",JSON.stringify(u,null,2)),m({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:u,json:v}}),{partiesCreated:!1}):(L.companyNameUsedWhenAsyncAddressUpdate=L.companyName,L.stripeAddressUsedWhenAsyncAddressUpdate=L.stripeAddressEventData,L.stripeBillingAddressUsedWhenAsyncAddressUpdate=L.stripeBillingAddressEventData,L.taxIdUsedWhenAsyncAddressUpdate=L.taxId,L.partyBillingId=v.billToPartyId,L.partyShippingId=v.shipToPartyId,{partiesCreated:!0})},F=e=>({countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}),J=async t=>{var n,s,r,i;const a=(null==t?void 0:t.retries)||0,d=!!(null==t?void 0:t.applyingPromocode),l=(()=>{var e;const t=se.landedCostData&&(null===(e=se.landedCostData.find(Boolean))||void 0===e?void 0:e.subtotals.items)!==se.subtotal,o=(()=>{var e,t;const o=JSON.stringify(null===(e=L.stripeLinkUsedWhenFetchingLC)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.value),n=L.stripeAddressEventData&&JSON.stringify(F(L.stripeAddressEventData.value))!==JSON.stringify(L.stripeAddressUsedWhenFetchingLC),s=!L.stripeShippingSameAsBilling&&L.stripeBillingAddressEventData&&JSON.stringify(F(L.stripeBillingAddressEventData.value))!==JSON.stringify(L.stripeBillingAddressUsedWhenFetchingLC);return o||n||s})();return h("isPrefetchInfoOutdated","info",{isAddressOutdated:o}),!se.landedCostData&&!L.isFetchingLandedCost||o||t})();if(!(()=>{var t,o,n,s;const r=!!(null===(t=L.stripeLinkEventData)||void 0===t?void 0:t.complete),i=!!(null===(o=L.stripeAddressEventData)||void 0===o?void 0:o.complete),a=L.stripeShippingSameAsBilling?i:!!(null===(n=L.stripeBillingAddressEventData)||void 0===n?void 0:n.complete),d=(t=>{var o,n;const s=null===(o=e.genericSettings)||void 0===o?void 0:o.countryFields,r=null===(n=e.genericSettings)||void 0===n?void 0:n.stripeCountryFieldLabels;return"stripe"===se.addressFormRenderType&&(r&&t in r?r[t]:null)||(s&&t in s?s[t]:null)})((null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US");return!!(i&&a&&r)||(d&&L.stripeAddressEventData?r&&L.stripeAddressEventData.value.firstName&&L.stripeAddressEventData.value.lastName&&L.stripeAddressEventData.value.address.line1.length>0&&(!d.stateRequired||d.stateRequired&&L.stripeAddressEventData.value.address.state.length>0)&&(!d.zipRequired||d.zipRequired&&L.stripeAddressEventData.value.address.postal_code.length>=3)&&L.stripeAddressEventData.value.phone&&L.stripeAddressEventData.value.phone.length>0:i&&a&&r)})())return{isRequestNotReady:!0};if(l&&(null===(n=L.fetchingLandedCostAbortController)||void 0===n||n.abort(),L.fetchingLandedCostAbortController=null),!l&&!d)return{isRequestNotReady:!1};a?(L.isFetchingLandedCost=!1,setTimeout((()=>{L.isFetchingLandedCost=!0}),300)):L.isFetchingLandedCost=!0,L.stripeAddressEventData&&(L.stripeAddressUsedWhenFetchingLC={countryCode:L.stripeAddressEventData.value.address.country,postalCode:L.stripeAddressEventData.value.address.postal_code,state:L.stripeAddressEventData.value.address.state}),L.stripeBillingAddressEventData&&(L.stripeBillingAddressUsedWhenFetchingLC={countryCode:L.stripeBillingAddressEventData.value.address.country,postalCode:L.stripeBillingAddressEventData.value.address.postal_code,state:L.stripeBillingAddressEventData.value.address.state}),L.stripeLinkEventData&&(L.stripeLinkUsedWhenFetchingLC=Object.assign({},L.stripeLinkEventData));try{fe(),await(async()=>{var e;const t=new AbortController;L.fetchingLandedCostAbortController=t,fe();const{checkoutSessionWorkflow:n,errors:s,itemCreateWorkflow:r,landedCostCalculateWorkflow:i,partyCreateWorkflow:a,shipmentRatingCalculateWorkflow:d}=await O(t);se.customQuotingError=(null===(e=null==s?void 0:s.find((e=>{var t;return"CUSTOM"===(null===(t=e.extensions)||void 0===t?void 0:t.ruleMessageType)})))||void 0===e?void 0:e.message)||null,se.shippingData=I((null==d?void 0:d.filter(Boolean))||[]),de(r),L.fetchingLandedCostAbortController=null,se.partiesData=(null==a?void 0:a.filter(Boolean))||[],se.landedCostData=(null==n?void 0:n.map((e=>{const t=null==i?void 0:i.find((t=>(null==t?void 0:t.id)===e.landedCostId));return t?Object.assign(Object.assign({},e),{landedCost:t}):null})).filter(Boolean))||[],(null==n?void 0:n.length)&&A({checkoutSessionId:o.checkoutSessionId,eventName:"checkout_quoteReceived"});const l=se.promoCodeApplied&&!se.landedCostData.find((e=>{var t;return null===(t=e.landedCost.appliedAdjustments)||void 0===t?void 0:t.find((e=>"PROMO_CODE"===e.type))}));se.promoCodeError=l,l||sessionStorage.setItem("zonos--promo-code",se.promoCode)})();const e=null===(s=se.shippingData)||void 0===s?void 0:s.find(Boolean),t=null===(r=se.landedCostData)||void 0===r?void 0:r.find((t=>t.landedCost.shipmentRating.id===(null==e?void 0:e.id))),n=t?t.subtotals:null;n&&ue({method:(null==t?void 0:t.landedCost.method)||"DDP",subtotals:n})}catch(e){if(se.landedCostData=[],se.shippingData=[],e instanceof Error&&e.message&&!["The landed cost calculation request was aborted to initiate a new one."].includes(e.message)){if(a<1)return await J(Object.assign(Object.assign({},t),{retries:(a||0)+1})),{isRequestNotReady:!1};const o=null===(i=L.stripeAddressEventData)||void 0===i?void 0:i.value;m({endpoint:`Failed to fetch landed cost (${a} retries)`,errors:[e.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:o}})}p(e)}return L.isFetchingLandedCost=!1,{isRequestNotReady:!1}},M=async()=>{var e,t;await J({applyingPromocode:!0}),"payment"===se.step&&Se(),await B();const o=null===(e=se.shippingData)||void 0===e?void 0:e.find(Boolean),n=null===(t=se.landedCostData)||void 0===t?void 0:t.find((e=>e.landedCost.id===(null==o?void 0:o.id)));o&&n&&await ye({applySubtotalsOnly:!1,landedCostId:n.landedCostId,selectedShippingOption:o})},W=()=>{se.promoCode="",sessionStorage.removeItem("zonos--promo-code"),se.promoCodeError=!1,se.promoCodeApplied=!1},$=async()=>{"payment"===se.step&&Se(),W(),await M()},q=e=>{let t=[],o=!0;const n=window.Zonos.isCollect;switch(e){case"succeeded":t=[a("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",a("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")],n&&(t=[a("Thank you for submitting your payment. We appreciate your prompt attention."),"",a("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]),o=!1;break;case"requires_capture":case"processing":t=[a("Payment processing. We'll update you when payment is received.")],o=!1;break;case"requires_payment_method":t=[a("Payment failed. Please try another payment method.")],n&&(t=[a("Payment failed. Please reload the page and try another payment method.")]);break;case"requires_action":o=!1,t=[a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")];default:t=[a("Something went wrong.")]}return{isError:o,messages:t}},Y=async()=>{var t,o;const{onInventoryCheck:n}=e.checkoutSettings,s=!!(null===(o=null===(t=window.Zonos.cartData)||void 0===t?void 0:t.metadata.find((e=>"referenceId"===e.key)))||void 0===o?void 0:o.value);if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&s){const{errors:e,json:t}=await l("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"});return e.length||!t?(p("Error occurs when handling inventory refund","warn",JSON.stringify(e)),null):t.available&&204!==t.status?t.available||200===t.status?(L.shouldInventoryRefund=!0,null):null:a("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")}if("function"!=typeof n)return null;try{return await n({items:se.items})}catch(e){const t=e instanceof Error?e.message:"Unknown error";throw m({endpoint:"onInventoryCheck",errors:[`cartId: ${window.Zonos.cartId} - ${t}`],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:se.items}}),e}},H=async()=>{var e,t;const o=!!(null===(t=null===(e=window.Zonos.cartData)||void 0===e?void 0:e.metadata.find((e=>"referenceId"===e.key)))||void 0===t?void 0:t.value);window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o&&await l("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})},K=async({clientSecret:e,storybookForceStatus:t})=>{if(t){const{isError:e,messages:o}=q(t);return{error:e,messages:o}}const o=e||L.clientSecret;if(!L.stripe||!o)return p("Failed to retrieve payment intent. Stripe is not initialized"),{error:!0,message:[a("Something went wrong.")]};const{paymentIntent:n}=await L.stripe.retrievePaymentIntent(o),s=null==n?void 0:n.status,{isError:r,messages:i}=q(s);return{error:r,messages:i,paymentIntentId:null==n?void 0:n.id,paymentMethod:null==n?void 0:n.payment_method,status:s}},G=async e=>{var t,n;const s=!!(null===(t=L.stripePaymentEventData)||void 0===t?void 0:t.complete),r=L.stripeElements,i=L.stripe,d=L.clientSecret;if(L.customErrorMessage=null,!(null===(n=se.selectedLandedCost)||void 0===n?void 0:n.landedCost.id)&&!(null==e?void 0:e.noLandedCostCheck))throw new Error("Attempted to confirm the payment when no landed cost is found in store");const l=await N();if(!l.valid)throw L.customErrorMessage=l.errorMessage,new Error(l.errorMessage);const c=o.checkoutSessionId;if(i&&r&&s&&d&&c){const e=new URL(window.location.href);e.searchParams.set("payment_intent_client_secret",d),e.searchParams.set("zonosCheckoutSessionId",c),A({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});const{error:t,paymentIntent:o}=await i.confirmPayment({confirmParams:{return_url:e.toString()},elements:r,redirect:"if_required"});if(h("Payment intent confirmed","info",{error:t,paymentIntent:o}),"requires_action"===(null==o?void 0:o.status))throw new Error(a("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."));if(t){if("card_error"===t.type||"validation_error"===t.type)throw new Error(t.message);if("invalid_request_error"===t.type&&"payment_intent_unexpected_state"===t.code)return;throw new Error("An unexpected error occurred.")}if("requires_payment_method"===o.status)throw new Error(a("Payment failed. Please try another payment method."))}},V=()=>{var e;const t=se.items.reduce(((e,t)=>e+t.amount*t.quantity),0),s=o.enabledVariantTestKeys||[];return{adjustmentsAmount:se.adjustments.reduce(((e,t)=>e+t.amount),0),cartId:window.Zonos.cartId,currency:(null===(e=se.items.find(Boolean))||void 0===e?void 0:e.currencyCode)||"",customerAuthenticationToken:se.customerAuthenticationToken||void 0,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:n.selectedCountryCode,skipPaymentIntent:L.skipPaymentIntent,varianceTestInput:s}},Z=async()=>{var e;if(!o.checkoutSessionId)return m({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:y,cartId:window.Zonos.cartId}}),void ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});const{errors:t,json:n}=await l("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:o.checkoutSessionId},method:"POST"}),s=null===(e=null==n?void 0:n.checkoutSessionPaymentIntentCreate)||void 0===e?void 0:e.clientSecret;if(t.length||!s)return p("Error occurs when getting payment intent",JSON.stringify(t,null,2)),m({endpoint:"Error creating payment intent",errors:t.map((e=>e.message)),metadata:{allLogs:y,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,clientSecret:s}}),void ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")});pe(n.checkoutSessionPaymentIntentCreate)},Q=async()=>{var e,t;if(!n.targetCurrency)return p("Failed to create checkout session - missing localizationStore.targetCurrency"),!1;L.isFetchingSession=!0;const o=V();h("Checkout session body","info",o);const{errors:s,json:r}=await l("/api/zonos-elements/create-checkout-session",{body:o,method:"POST"});if(L.isFetchingSession=!1,s.length||!r){const t=null===(e=s.find((e=>e.message)))||void 0===e?void 0:e.message;if(Array.isArray(t)&&t.some((e=>"Cart is expired."===e.message)))throw new Error("Cart is expired.");return p("Error occurred when creating checkout session",JSON.stringify(s,null,2)),!1}const i=r.checkoutSessionCreate;return pe(i),ue({method:(null===(t=i.landedCost)||void 0===t?void 0:t.method)||"DDP",subtotals:i.subtotals}),h("Exchange rate updated for cart items (checkout session create)","info",se.exchangeRate),h("done-init-checkout-session"),!0},X=async()=>{const t=o.checkoutSessionId;if(!t)return p("Failed to update checkout session base currency"),!1;if("LOCAL"===e.checkoutSettings.allowedSettlementCurrencies)return h('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency'),!0;const{json:n}=await l("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:t,currencyCode:L.checkoutSettlementCurrency},method:"POST"}),s=null==n?void 0:n.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;return n&&s===L.checkoutSettlementCurrency?(h(`Updated checkout session to settlement currency "${s}".`),!0):(p("Failed to update checkout session base currency"),!1)},ee=({currentAddress:e,translatedAddressResult:t})=>{const o={};if(!t)return o;const{city:n,line1:s,line2:r,name:i,postal_code:a,state:d}=t;return e.city&&n&&(o.city={[e.city]:n}),e.line1&&s&&(o.line1={[e.line1]:s}),e.line2&&r&&(o.line2={[e.line2]:r}),e.postal_code&&a&&(o.postal_code={[e.postal_code]:a}),e.state&&d&&(o.state={[e.state]:d}),e.name&&i&&(o.name={[e.name]:i}),o},te=async({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t})=>{var o,n,s,r;const i=(({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:o,stripeBillingAddressEventData:n,stripeShippingSameAsBilling:s})=>{const r=!!(null==o?void 0:o.complete);if(!r||!(s?r:null==n?void 0:n.complete))return null;if(!e&&!t)return null;const i=o.value,a=(null==n?void 0:n.value)||null,{firstName:d,lastName:l}=f({firstName:i.firstName,lastName:i.lastName,name:i.name}),c=`${d} ${l}`,{firstName:u,lastName:m}=f({firstName:null==a?void 0:a.firstName,lastName:null==a?void 0:a.lastName,name:(null==a?void 0:a.name)||""}),p=u&&m?`${u} ${m}`:"",v=i.address,h=null==a?void 0:a.address;return{address:k({address:Object.assign(Object.assign({},v),{name:c}),invalidAdddressList:e}),billingAddress:s?void 0:k({address:h?Object.assign(Object.assign({},h),{name:p}):null,invalidAdddressList:t}),destinationCountry:v.country}})({addressInvalidCharactersList:e,billingAddressInvalidCharactersList:t,stripeAddressEventData:L.stripeAddressEventData,stripeBillingAddressEventData:L.stripeBillingAddressEventData,stripeShippingSameAsBilling:L.stripeShippingSameAsBilling});if(!i)return void(L.translatedAddress={address:{},billingAddress:{}});const a=(()=>{var e,t,o,n;const s=JSON.stringify(null===(e=L.stripeAddressUsedWhenValidatingAddress)||void 0===e?void 0:e.value)!==JSON.stringify(null===(t=L.stripeAddressEventData)||void 0===t?void 0:t.value),r=!L.stripeShippingSameAsBilling&&JSON.stringify(null===(o=L.stripeBillingAddressEventData)||void 0===o?void 0:o.value)!==JSON.stringify(null===(n=L.stripeBillingAddressUsedWhenValidatingAddress)||void 0===n?void 0:n.value);return s||r})();if(!a)return;const{errors:d,json:c}=await l("/api/zonos-elements/validate-address",{body:i,method:"POST"});if(d.length||!c)return p("Error occurs when translating address to latin",JSON.stringify(d,null,2)),void(L.translatedAddress={address:{},billingAddress:{}});L.stripeAddressUsedWhenValidatingAddress=L.stripeAddressEventData,L.stripeBillingAddressUsedWhenValidatingAddress=L.stripeBillingAddressEventData;const u=null===(o=L.stripeAddressEventData)||void 0===o?void 0:o.value.address,m=null===(n=L.stripeBillingAddressEventData)||void 0===n?void 0:n.value.address;L.translatedAddress={address:u?ee({currentAddress:Object.assign(Object.assign({},u),{name:null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:L.stripeShippingSameAsBilling?{}:ee({currentAddress:Object.assign(Object.assign({},m),{name:null===(r=L.stripeBillingAddressEventData)||void 0===r?void 0:r.value.name}),translatedAddressResult:c.billingAddress||null})}};E("clientSecret",(e=>{e&&L.stripe&&sessionStorage.setItem("zonos--client-secret",e),e||sessionStorage.removeItem("zonos--client-secret")}));const{onChange:oe,reset:ne,state:se}=t((()=>({addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:!1,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:!1,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:!1,isSelectedShippingGuarantee:!1,isStagingMode:u(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:!1,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:!1,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:!1,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:!1,label:"Shipping",value:"shipping"},payment:{index:3,isDone:!1,label:"Payment",value:"payment"}},total:0}))),re=e=>{switch(e){case"DAYS":return a("days");case"WEEKS":return a("weeks");default:return a("business days")}},ie=e=>{var t;const o=null===(t=e.shippingProfile)||void 0===t?void 0:t.transitTime;return(null==o?void 0:o.min)&&(null==o?void 0:o.max)&&(null==o?void 0:o.type)?{maxTransit:o.max,minTransit:o.min,unit:re(o.type)}:null},ae=({item1:e,item2:t})=>!(!e||!t)&&(t.sku&&e.sku&&e.sku===t.sku||t.description&&e.description&&e.description===t.description||e.name&&t.name&&e.name===t.name),de=e=>{h("Checking item restrictions");const t=e.map((e=>{if(!e.restriction)return null;const{restriction:t}=e,o=se.items.find((t=>ae({item1:t,item2:e})));return Object.assign(Object.assign({matchedItem:o},e),{restriction:t})})).filter(Boolean);return se.restrictedItems=t,se.items=se.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!!t.find((t=>ae({item1:t,item2:e})))}))),{cartItems:se.items,restrictedItems:t}},le=()=>{o.checkoutSessionId=null,ne()},ce=({messages:e,title:t})=>{le(),_(),se.step="error",se.error={messages:e,title:t}},ue=({dutiesTaxesFeesEstimate:e,method:t,subtotals:o})=>{se.exchangeRate=o.exchangeRate,se.adjustmentTotal=o.adjustments,se.dutiesTaxesFees="DAP"===t?null:o.landedCostTotal,se.subtotal=o.items,se.total=o.total,se.currency=o.presentmentCurrencyCode,se.dutiesTaxesFeesEstimate=e||null},me=()=>!!se.items.filter((e=>e.amount>0)).find((e=>!e.isRestricted)),pe=e=>{var t,n,s,a,d;L.clientSecret=e.clientSecret,L.stripeCustomerSessionClientSecret=e.customerSessionClientSecret,L.customerProfile=e.customerProfile,se.checkoutSession=e,e.id||m({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:y,checkoutSession:e}}),e.id&&(o.checkoutSessionId=e.id);const l=r(e.varianceTestResults||[]);i(l);const c=(null===(s=null===(n=null===(t=se.checkoutSession)||void 0===t?void 0:t.metadata)||void 0===n?void 0:n.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===s?void 0:s.value)||(null===(d=null===(a=window.Zonos.cartData)||void 0===a?void 0:a.metadata.find((e=>"externalConfirmationPageURL"===(null==e?void 0:e.key))))||void 0===d?void 0:d.value)||null;c&&(h(`Found externalConfirmationPageURL: ${c}`),se.externalConfirmationPageURL=c)},ve=async({adjustmentsAmount:e,cartId:t,currency:s,dutiesTaxesFeesEstimate:r,itemsAmount:i,landedCostId:d,shouldInitSessionOnFailure:c})=>{var u;if(d&&se.selectedLandedCost&&(ue({dutiesTaxesFeesEstimate:r,method:se.landedCostMethod,subtotals:se.selectedLandedCost.subtotals}),h("Exchange rate updated for cart items (landed cost subtotal)","info",se.exchangeRate)),!o.checkoutSessionId)return h("Could not update cart total without checkout session id","info"),!1;const{errors:m,json:v}=await(async({adjustmentsAmount:e,cartId:t,currency:s,id:r,itemsAmount:i,landedCostId:a,presentmentCountryCode:d})=>{const c=o.enabledVariantTestKeys||[],{errors:u,json:m}=await l("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:e,billToPartyId:L.partyBillingId,cartId:t,currency:s,customerAuthenticationToken:se.customerAuthenticationToken||void 0,id:r,itemsAmount:i,landedCostId:a,metadata:[{key:"language",value:n.selectedLocale}],presentmentCountryCode:d,shipToPartyId:L.partyShippingId,skipPaymentIntent:L.skipPaymentIntent,varianceTestInput:c},method:"POST"});return u.length||!m?(p("Error occurs when updating checkout session",JSON.stringify(u,null,2)),{errors:u,json:m}):{errors:[],json:m}})({adjustmentsAmount:e,billToPartyId:L.partyBillingId,cartId:t,currency:s,id:o.checkoutSessionId,itemsAmount:i,landedCostId:d,presentmentCountryCode:n.selectedCountryCode,shipToPartyId:L.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});if(m.length>0||!v){if(p("Error occurs when updating checkout session."),c){h("Initiating checkout session on failure","info");const e=await Q();return h(`stripeStoreInitCheckoutSession: ${e}`),!!e||(ce({messages:[a("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:a("Error creating Checkout")}),!1)}return!1}return d||(ue({method:(null===(u=v.checkoutSessionUpdate.landedCost)||void 0===u?void 0:u.method)||"DDP",subtotals:v.checkoutSessionUpdate.subtotals}),h("Exchange rate updated for cart items (checkout session update)","info",se.exchangeRate)),pe(v.checkoutSessionUpdate),!0},he=t=>{var o,n,s;return"DAP"===t.method&&(null===(n=null===(o=e.genericSettings)||void 0===o?void 0:o.domesticCountries)||void 0===n?void 0:n.includes((null===(s=L.stripeAddressEventData)||void 0===s?void 0:s.value.address.country)||"US"))||"DAP"===t.method&&t.remittance.length&&"ZONOS"===t.landedCostGuaranteeCode?"DDP":t.method},ye=async({applySubtotalsOnly:t,landedCostId:n,selectedShippingOption:s})=>{var r,i,a,d,l,c,u,m,p,v,y;h("Updating selected shipping option","info",{landedCostId:n,selectedShippingOption:s}),se.selectedShippingOption=s;const g=ie(se.selectedShippingOption);if(g){const{maxTransit:e,minTransit:t,unit:o}=g;se.selectedShippingOptionTransitTime=`${t}-${e} ${o}`}else se.selectedShippingOptionTransitTime="";const w=null===(r=se.landedCostData)||void 0===r?void 0:r.find((e=>e.landedCostId===n));if(se.selectedLandedCost=w||null,!w)return!1;const f=((null===(i=w.landedCost.amountSubtotals)||void 0===i?void 0:i.landedCostTotal)||0)*w.subtotals.exchangeRate.rate;f&&h(`DAP quote, using estimate: ${f}`,"info"),se.landedCostMethod=he(w.landedCost),se.shipping=w.subtotals.shipping;const b="ZONOS"===(null===(a=null==w?void 0:w.landedCost)||void 0===a?void 0:a.landedCostGuaranteeCode),S=!!(null===(l=null===(d=null==w?void 0:w.landedCost)||void 0===d?void 0:d.deMinimis)||void 0===l?void 0:l.find((e=>["DUTY","TAX"].includes(e.type)&&"ABOVE"===e.threshold)));se.isSelectedShippingAboveDeminimis=S,se.isSelectedShippingGuarantee=b;let C=!1;t?(ue({dutiesTaxesFeesEstimate:f,method:se.landedCostMethod,subtotals:w.subtotals}),h("Exchange rate updated for cart items (landed cost subtotal)","info",se.exchangeRate),C=!0):C=await ve({adjustmentsAmount:se.adjustmentTotal,billToPartyId:L.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:f,landedCostId:null===(c=w.landedCost)||void 0===c?void 0:c.id,shipToPartyId:L.partyShippingId,varianceTestInput:o.enabledVariantTestKeys||[]});const O=null===(u=se.items.find(Boolean))||void 0===u?void 0:u.currencyCode,A=(null===(m=L.stripeAddressEventData)||void 0===m?void 0:m.value.address.country)||"US";return L.shouldRenderPayInUsdButton="USD"===O&&"LOCAL_AND_USD"===e.checkoutSettings.allowedSettlementCurrencies&&"USD"!==(null===(p=se.checkoutSession)||void 0===p?void 0:p.subtotals.presentmentCurrencyCode)&&!!(null===(y=null===(v=e.genericSettings)||void 0===v?void 0:v.usdSettlementCountryEnabled)||void 0===y?void 0:y.includes(A)),C},ge=({isPreview:e,sessionTimeout:t})=>{if(e)return;const o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout"),n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):t;h(`==START CHECKOUT TIMEOUT - ${n}==`),se.checkoutTimeoutInterval=setTimeout((()=>{se.checkoutSessionTimeoutShow=!0}),n)},we=()=>{se.checkoutTimeoutInterval&&(clearTimeout(se.checkoutTimeoutInterval),se.checkoutTimeoutInterval=null)},fe=()=>{se.items=se.items.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1}))),se.restrictedItems=[]},be=async({adjustments:e,cartItems:t,landedCostId:n,shouldInitSessionOnFailure:s=!0})=>{var r;se.adjustments=e,se.items=t.map((e=>Object.assign(Object.assign({},e),{isRestricted:!1})));const i=null===(r=t.find(Boolean))||void 0===r?void 0:r.currencyCode,a=t.reduce(((e,t)=>e+t.amount*t.quantity),0),d=e.reduce(((e,t)=>e+t.amount),0);i&&a&&(se.currency=i,L.isFetchingSession=!0,await ve({adjustmentsAmount:d,billToPartyId:L.partyBillingId,cartId:window.Zonos.cartId,currency:i,dutiesTaxesFeesEstimate:0,itemsAmount:a,landedCostId:n,shipToPartyId:L.partyShippingId,shouldInitSessionOnFailure:s,varianceTestInput:o.enabledVariantTestKeys||[]}),L.isFetchingSession=!1)},Se=()=>{"shipping"===se.step?(se.step="customer-info",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})})):"payment"===se.step?(se.step="shipping",se.tabItems=Object.assign(Object.assign({},se.tabItems),{shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})})):"finish"===se.step&&(se.step="payment",se.tabItems=Object.assign(Object.assign({},se.tabItems),{payment:Object.assign(Object.assign({},se.tabItems.payment),{isDone:!1})}))},Ce=()=>{"customer-info"===se.step?(se.step="shipping",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems["customer-info"]),{isDone:!0})})):"shipping"===se.step?(se.step="payment",se.tabItems=Object.assign(Object.assign({},se.tabItems),{shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!0})})):"payment"===se.step&&(se.step="finish")},Oe=()=>{se.step="customer-info",se.tabItems=Object.assign(Object.assign({},se.tabItems),{"customer-info":Object.assign(Object.assign({},se.tabItems["customer-info"]),{isDone:!1}),payment:Object.assign(Object.assign({},se.tabItems.payment),{isDone:!1}),shipping:Object.assign(Object.assign({},se.tabItems.shipping),{isDone:!1})}),se.selectedShippingOption=null,se.isSelectedShippingAboveDeminimis=!1,se.isSelectedShippingGuarantee=!1,se.selectedShippingOptionTransitTime="",se.dutiesTaxesFees=0,se.dutiesTaxesFeesEstimate=0,se.shipping=0,se.total=se.subtotal};export{N as A,E as B,z as C,ye as D,me as E,M as F,$ as G,W as H,q as I,te as J,f as K,B as L,ie as M,he as N,I as O,D as a,x as b,L as c,K as d,se as e,be as f,le as g,Oe as h,U as i,we as j,Q as k,Z as l,ge as m,V as n,ce as o,pe as p,J as q,Ce as r,R as s,A as t,X as u,Y as v,G as w,H as x,_ as y,oe as z}
@@ -1 +1 @@
1
- import{r as t,h as o}from"./p-b30c2ad9.js";const s=class{constructor(o){t(this,o),this.first="",this.middle="",this.last=""}getText(){return(this.first||"")+((t=this.middle)?` ${t}`:"")+((o=this.last)?` ${o}`:"");var t,o}render(){return o("div",{key:"ce1a6a656f02ba26460066561b08f449e9e042bc"},"Hello, World! I'm ",this.getText())}};s.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}div{color:red;font-size:large}";export{s as zonos_component}
1
+ import{r as t,h as o}from"./p-ab41bab5.js";const s=class{constructor(o){t(this,o),this.first="",this.middle="",this.last=""}getText(){return(this.first||"")+((t=this.middle)?` ${t}`:"")+((o=this.last)?` ${o}`:"");var t,o}render(){return o("div",{key:"ce1a6a656f02ba26460066561b08f449e9e042bc"},"Hello, World! I'm ",this.getText())}};s.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}div{color:red;font-size:large}";export{s as zonos_component}