@justifi/webcomponents 5.4.4 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (872) hide show
  1. package/dist/cjs/Api-KMweahmp.js +74 -0
  2. package/dist/cjs/{Business-d88b77fd.js → Business-DyiDiIuO.js} +1 -1
  3. package/dist/cjs/{Checkout-5352009d.js → Checkout-RAGvjVPj.js} +1 -1
  4. package/dist/cjs/{ComponentError-233ac749.js → ComponentError-C4MdBBMe.js} +1 -0
  5. package/dist/cjs/{Payment-bccd8f7d.js → Payment-CQCmj3Ck.js} +2 -2
  6. package/dist/cjs/{SubAccount-2a302ead.js → Refund-CpurRc4w.js} +104 -1
  7. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +10 -0
  8. package/dist/cjs/additional-questions-details_5.cjs.entry.js +5 -11
  9. package/dist/cjs/{badge-364e6311.js → badge-DwSZ83Bm.js} +2 -2
  10. package/dist/cjs/bank-account-document-form-inputs_4.cjs.entry.js +25 -43
  11. package/dist/cjs/bank-account-form_9.cjs.entry.js +93 -97
  12. package/dist/cjs/{business-additional-questions-schema-8568cb79.js → business-additional-questions-schema-mzZ2gYHQ.js} +2 -2
  13. package/dist/cjs/business-details-core.cjs.entry.js +6 -10
  14. package/dist/cjs/{business-form-options-62e9c8ab.js → business-form-options-BCj0efiD.js} +1 -1
  15. package/dist/cjs/{business-identity-schema-518ab6eb.js → business-identity-schema-dt0zCW0R.js} +2 -2
  16. package/dist/cjs/{business.service-6e8a29a2.js → business.service-Crmkeulk.js} +23 -8
  17. package/dist/cjs/{button-4a9fd41e.js → button-Cp4u5YgP.js} +2 -2
  18. package/dist/cjs/{check-pkg-version-e6dcbeb7.js → check-pkg-version-C4d9pl8G.js} +3 -3
  19. package/dist/cjs/{checkout.service-0a7835dc.js → checkout.service-DP9FnXBx.js} +13 -10
  20. package/dist/cjs/checkouts-list-core.cjs.entry.js +25 -31
  21. package/dist/cjs/{payments-list-params-state-442d9944.js → checkouts-list-params-state-DX4jg37H.js} +1 -1
  22. package/dist/cjs/{checkouts-table-8a1b49ff.js → checkouts-table-nsXjlcI1.js} +4 -4
  23. package/dist/cjs/custom-popper_4.cjs.entry.js +27 -52
  24. package/dist/cjs/{dispute.service-6efc7d7f.js → dispute.service-F-M8EJxq.js} +20 -11
  25. package/dist/cjs/{event-types-5a6ce2b0.js → event-types-CjInBN20.js} +3 -3
  26. package/dist/cjs/form-alert_5.cjs.entry.js +10 -19
  27. package/dist/cjs/form-control-checkbox.cjs.entry.js +9 -18
  28. package/dist/cjs/form-control-date.cjs.entry.js +9 -19
  29. package/dist/cjs/{form-control-error-text-3cff9b7b.js → form-control-error-text-NbHDc1JL.js} +2 -2
  30. package/dist/cjs/form-control-file-v2_2.cjs.entry.js +11 -30
  31. package/dist/cjs/{form-control-help-text-94ffed2c.js → form-control-help-text-bc3qGHAG.js} +2 -2
  32. package/dist/cjs/form-control-help-text.cjs.entry.js +1 -5
  33. package/dist/cjs/form-control-monetary-provisioning.cjs.entry.js +13 -22
  34. package/dist/cjs/form-control-monetary.cjs.entry.js +13 -22
  35. package/dist/cjs/form-control-number-masked_2.cjs.entry.js +12 -25
  36. package/dist/cjs/form-control-number.cjs.entry.js +9 -18
  37. package/dist/cjs/form-control-radio.cjs.entry.js +7 -17
  38. package/dist/cjs/{get-business-d8f5db51.js → get-business-BBzGEPBG.js} +3 -3
  39. package/dist/cjs/get-payment-details-DQyJtwTw.js +42 -0
  40. package/dist/cjs/get-payout-csv-Jr_0DmmY.js +24 -0
  41. package/dist/cjs/{get-subaccounts-ae5b35a8.js → get-subaccounts-zwxhG-O3.js} +11 -10
  42. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +262 -270
  43. package/dist/cjs/{header-1-43b2b905.js → header-1-kwWMtg3s.js} +2 -2
  44. package/dist/cjs/{header-3-eb250a04.js → header-3-CNWIH9ZU.js} +2 -2
  45. package/dist/cjs/{helpers-602962eb.js → helpers-B5OCqlIM.js} +1 -1
  46. package/dist/cjs/{iframe-input-styles-state-d0de0b24.js → iframe-input-styles-state-jHHRvqzM.js} +2 -2
  47. package/dist/cjs/iframe-input.cjs.entry.js +1640 -0
  48. package/dist/cjs/{index-750475a3.js → index-1MT3Z4XI.js} +1 -1
  49. package/dist/cjs/{index-5b9a3b5f.js → index-BRQfozbS.js} +460 -271
  50. package/dist/cjs/{index-d2d0b181.js → index-DzQdh5ij.js} +4 -5
  51. package/dist/cjs/index.esm-CVuJLXJZ.js +11807 -0
  52. package/dist/cjs/{input-handlers-cff032bb.js → input-handlers-DYl_0IwC.js} +1 -1
  53. package/dist/cjs/{insurance-state-71f8b653.js → insurance-state-DbXkNYds.js} +3 -3
  54. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +64 -94
  55. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +36 -86
  56. package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +36 -54
  57. package/dist/cjs/justifi-business-details.cjs.entry.js +16 -20
  58. package/dist/cjs/justifi-business-form.cjs.entry.js +34 -38
  59. package/dist/cjs/justifi-business-representative-form-inputs.cjs.entry.js +6 -11
  60. package/dist/cjs/justifi-checkout-core.cjs.entry.js +31 -34
  61. package/dist/cjs/justifi-checkout.cjs.entry.js +23 -29
  62. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +15 -18
  63. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +25 -30
  64. package/dist/cjs/justifi-details.cjs.entry.js +3 -6
  65. package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +5 -11
  66. package/dist/cjs/justifi-dispute-management.cjs.entry.js +19 -23
  67. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +38 -52
  68. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +13 -16
  69. package/dist/cjs/justifi-order-terminals.cjs.entry.js +29 -37
  70. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +29 -52
  71. package/dist/cjs/justifi-payment-details.cjs.entry.js +24 -52
  72. package/dist/cjs/justifi-payment-provisioning-core.cjs.entry.js +15 -23
  73. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +15 -16
  74. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +195 -0
  75. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +11 -17
  76. package/dist/cjs/justifi-payments-list.cjs.entry.js +25 -29
  77. package/dist/cjs/justifi-payout-details.cjs.entry.js +24 -28
  78. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +203 -0
  79. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +9 -12
  80. package/dist/cjs/justifi-payouts-list.cjs.entry.js +29 -34
  81. package/dist/cjs/justifi-refund-payment.cjs.entry.js +189 -69
  82. package/dist/cjs/justifi-season-interruption-insurance-core.cjs.entry.js +10 -27
  83. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +24 -35
  84. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +24 -26
  85. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +29 -29
  86. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +21 -25
  87. package/dist/cjs/justifi-terminals-list.cjs.entry.js +26 -31
  88. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +24 -28
  89. package/dist/cjs/loader.cjs.js +3 -5
  90. package/dist/cjs/lodash-CvSCBJ_8.js +17216 -0
  91. package/dist/cjs/package-S6wVKDKx.js +9 -0
  92. package/dist/cjs/pagination-menu.cjs.entry.js +3 -5
  93. package/dist/cjs/{parts-5ca90f9a.js → parts-D_uKOPFe.js} +3 -1
  94. package/dist/cjs/payment-details-core.cjs.entry.js +19 -22
  95. package/dist/cjs/{payment-provisioning-actions-382ab48c.js → payment-provisioning-actions-BkWSDJQQ.js} +2 -2
  96. package/dist/cjs/payment.service-BstXaxH5.js +27 -0
  97. package/dist/cjs/payments-list-core.cjs.entry.js +25 -30
  98. package/dist/cjs/{terminal-orders-list-params-state-c419078f.js → payments-list-params-state-DX4jg37H.js} +1 -1
  99. package/dist/cjs/{payments-status-075aad0a.js → payments-status-CQq7KrHL.js} +2 -2
  100. package/dist/cjs/{payments-table-a076755a.js → payments-table-ClOxMnZ8.js} +4 -4
  101. package/dist/cjs/payout-details-core.cjs.entry.js +14 -18
  102. package/dist/cjs/payout.service-DWOtnFdn.js +34 -0
  103. package/dist/cjs/payouts-list-core.cjs.entry.js +26 -33
  104. package/dist/cjs/{checkouts-list-params-state-644d3639.js → payouts-list-params-state-DX4jg37H.js} +1 -1
  105. package/dist/cjs/{payouts-status-ced97c2b.js → payouts-status-BdfV3jvX.js} +2 -2
  106. package/dist/cjs/{payouts-table-aedce326.js → payouts-table-Bo3pLf4Z.js} +4 -4
  107. package/dist/cjs/{schema-validations-a7cefbdf.js → schema-validations-p4OCdblz.js} +4 -4
  108. package/dist/cjs/{skeleton-e8aa41d0.js → skeleton-BXVndBVC.js} +2 -2
  109. package/dist/cjs/{spinner-580453f2.js → spinner-CSH2OUiV.js} +2 -2
  110. package/dist/cjs/{styled-host-94309bab.js → styled-host-CzJ8Ux1t.js} +2 -3
  111. package/dist/cjs/table-filters-menu.cjs.entry.js +4 -10
  112. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +24 -29
  113. package/dist/cjs/{payouts-list-params-state-033b76d6.js → terminal-orders-list-params-state-DX4jg37H.js} +1 -1
  114. package/dist/cjs/{terminal-orders-table-3b247193.js → terminal-orders-table-CXmVc7uU.js} +35 -5
  115. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +6 -12
  116. package/dist/cjs/{terminal.service-ab62c344.js → terminal.service-ghxwDinY.js} +11 -11
  117. package/dist/cjs/terminals-list-core.cjs.entry.js +25 -31
  118. package/dist/cjs/terminals-list-params-state-DX4jg37H.js +22 -0
  119. package/dist/cjs/{terminals-table-594643fd.js → terminals-table-vYbTPOpy.js} +4 -4
  120. package/dist/cjs/utils-DmZ8Dia3.js +23987 -0
  121. package/dist/cjs/{utils-f8714daa.js → utils-DxbncJhj.js} +2 -2
  122. package/dist/cjs/{utils-7a478c37.js → utils-l0veqT9y.js} +1 -1
  123. package/dist/cjs/webcomponents.cjs.js +7 -7
  124. package/dist/collection/actions/payment/get-payment-details.js +5 -2
  125. package/dist/collection/actions/payment/get-payment-transactions.js +34 -0
  126. package/dist/collection/actions/payout/get-payout-transactions.js +34 -0
  127. package/dist/collection/actions/refund/refund-actions.js +31 -0
  128. package/dist/collection/api/Api.js +32 -13
  129. package/dist/collection/api/ComponentError.js +1 -0
  130. package/dist/collection/api/PaymentBalanceTransaction.js +45 -0
  131. package/dist/collection/api/PayoutBalanceTransaction.js +35 -0
  132. package/dist/collection/api/Refund.js +32 -0
  133. package/dist/collection/api/TerminalOrder.js +3 -0
  134. package/dist/collection/api/index.js +3 -0
  135. package/dist/collection/api/services/analytics.service.js +1 -1
  136. package/dist/collection/api/services/business.service.js +22 -7
  137. package/dist/collection/api/services/checkout.service.js +6 -3
  138. package/dist/collection/api/services/dispute.service.js +13 -4
  139. package/dist/collection/api/services/insurance.service.js +8 -2
  140. package/dist/collection/api/services/payment.service.js +7 -3
  141. package/dist/collection/api/services/payout.service.js +8 -3
  142. package/dist/collection/api/services/provision.service.js +4 -1
  143. package/dist/collection/api/services/refund.service.js +10 -0
  144. package/dist/collection/api/services/reports.service.js +1 -1
  145. package/dist/collection/api/services/subaccounts.service.js +1 -1
  146. package/dist/collection/api/services/terminal.service.js +4 -4
  147. package/dist/collection/api/services/terminal_orders.service.js +5 -1
  148. package/dist/collection/collection-manifest.json +5 -5
  149. package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +4 -4
  150. package/dist/collection/components/business-details/business-details-core.js +4 -3
  151. package/dist/collection/components/business-details/business-details.js +6 -8
  152. package/dist/collection/components/business-details/generic-info-details/generic-info-details.js +4 -4
  153. package/dist/collection/components/business-details/legal-address-details/legal-address-details.js +4 -4
  154. package/dist/collection/components/business-details/owner-details/owner-details.js +4 -4
  155. package/dist/collection/components/business-details/representative-details/representative-details.js +4 -4
  156. package/dist/collection/components/business-forms/business-form/additional-questions/additional-questions.js +4 -2
  157. package/dist/collection/components/business-forms/business-form/business-core-info/business-core-info.js +4 -2
  158. package/dist/collection/components/business-forms/business-form/business-form.js +20 -13
  159. package/dist/collection/components/business-forms/business-form/business-representative/business-representative.js +6 -4
  160. package/dist/collection/components/business-forms/business-form/legal-address-form/legal-address-form.js +4 -3
  161. package/dist/collection/components/business-forms/owner-form/identity-address/identity-address-form.js +11 -7
  162. package/dist/collection/components/business-forms/owner-form/owner-form-core.js +34 -22
  163. package/dist/collection/components/business-forms/owner-form/owner-form-inputs.js +10 -6
  164. package/dist/collection/components/business-forms/owner-form/owner-form.js +22 -19
  165. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step-core.js +15 -11
  166. package/dist/collection/components/business-forms/payment-provisioning/additional-questions/business-additional-questions-form-step.js +9 -10
  167. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-document-inputs.js +11 -8
  168. package/dist/collection/components/business-forms/payment-provisioning/bank-account/bank-account-form-inputs.js +13 -10
  169. package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step-core.js +23 -16
  170. package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step.js +9 -12
  171. package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-documents-on-file.js +6 -2
  172. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step-core.js +17 -12
  173. package/dist/collection/components/business-forms/payment-provisioning/business-core-info/business-core-info-form-step.js +9 -10
  174. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step-core.js +20 -14
  175. package/dist/collection/components/business-forms/payment-provisioning/business-owners/business-owners-form-step.js +9 -10
  176. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-inputs.js +10 -6
  177. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step-core.js +14 -10
  178. package/dist/collection/components/business-forms/payment-provisioning/business-representative/business-representative-form-step.js +9 -10
  179. package/dist/collection/components/business-forms/payment-provisioning/form-control-monetary-provisioning.js +31 -21
  180. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step-core.js +14 -10
  181. package/dist/collection/components/business-forms/payment-provisioning/legal-address-form/legal-address-form-step.js +9 -10
  182. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-core.js +24 -16
  183. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-buttons.js +20 -14
  184. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning-form-steps.js +21 -12
  185. package/dist/collection/components/business-forms/payment-provisioning/payment-provisioning.js +12 -8
  186. package/dist/collection/components/business-forms/payment-provisioning/terms-and-conditions/business-terms-conditions-form-step.js +13 -13
  187. package/dist/collection/components/checkout/bank-account-form/bank-account-form.js +3 -2
  188. package/dist/collection/components/checkout/billing-form/billing-form-schema.js +21 -0
  189. package/dist/collection/components/checkout/billing-form/billing-form.js +203 -0
  190. package/dist/collection/components/checkout/card-form/card-form.js +5 -4
  191. package/dist/collection/components/checkout/checkout-core.js +88 -37
  192. package/dist/collection/components/checkout/checkout.js +70 -28
  193. package/dist/collection/components/checkout/new-payment-method.js +110 -30
  194. package/dist/collection/components/checkout/payment-method-options.js +91 -36
  195. package/dist/collection/components/checkout/saved-payment-method.js +7 -4
  196. package/dist/collection/components/checkout/sezzle-payment-method.js +19 -15
  197. package/dist/collection/components/checkouts-list/checkouts-list-core.js +17 -14
  198. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +7 -5
  199. package/dist/collection/components/checkouts-list/checkouts-list.js +16 -12
  200. package/dist/collection/components/dispute-management/dispute-management-core.js +11 -8
  201. package/dist/collection/components/dispute-management/dispute-management.js +12 -9
  202. package/dist/collection/components/dispute-management/dispute-notification.js +11 -9
  203. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +10 -9
  204. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +10 -8
  205. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +10 -8
  206. package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +21 -14
  207. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +16 -13
  208. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +10 -8
  209. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +10 -8
  210. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +10 -8
  211. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +10 -8
  212. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +10 -8
  213. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +5 -4
  214. package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +7 -6
  215. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance-core.js +44 -30
  216. package/dist/collection/components/insurance/season-interruption/season-interruption-insurance.js +40 -32
  217. package/dist/collection/components/order-terminals/order-terminals.js +19 -14
  218. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +19 -13
  219. package/dist/collection/components/payment-details/payment-details-core.js +13 -12
  220. package/dist/collection/components/payment-details/payment-details.js +29 -6
  221. package/dist/collection/components/payment-transactions-list/payment-transactions-list.js +248 -0
  222. package/dist/collection/components/payment-transactions-list/payment-transactions-table.js +45 -0
  223. package/dist/collection/components/payments-list/payments-list-core.js +12 -11
  224. package/dist/collection/components/payments-list/payments-list-filters.js +17 -12
  225. package/dist/collection/components/payments-list/payments-list.js +16 -11
  226. package/dist/collection/components/payout-details/payout-details-core.js +11 -8
  227. package/dist/collection/components/payout-details/payout-details.js +11 -9
  228. package/dist/collection/components/payout-transactions-list/payout-transactions-list.js +250 -0
  229. package/dist/collection/components/payout-transactions-list/payout-transactions-table.js +47 -0
  230. package/dist/collection/components/payouts-list/payouts-list-core.js +21 -16
  231. package/dist/collection/components/payouts-list/payouts-list-filters.js +8 -6
  232. package/dist/collection/components/payouts-list/payouts-list.js +16 -13
  233. package/dist/collection/components/refund-payment/refund-loading.js +6 -0
  234. package/dist/collection/components/refund-payment/refund-payment-schema.js +26 -11
  235. package/dist/collection/components/refund-payment/refund-payment.js +157 -57
  236. package/dist/collection/components/terminal-orders-list/terminal-order-status.js +15 -0
  237. package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +12 -11
  238. package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +18 -11
  239. package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +16 -11
  240. package/dist/collection/components/terminal-orders-list/terminal-orders-table.js +11 -1
  241. package/dist/collection/components/terminals-list/terminals-list-core.js +17 -14
  242. package/dist/collection/components/terminals-list/terminals-list-filters.js +10 -7
  243. package/dist/collection/components/terminals-list/terminals-list.js +16 -12
  244. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +71 -19
  245. package/dist/collection/styles/parts.js +2 -1
  246. package/dist/collection/ui-components/custom-popper/custom-popper.js +19 -8
  247. package/dist/collection/ui-components/details/details.js +3 -4
  248. package/dist/collection/ui-components/filters/table-filters-menu.js +8 -7
  249. package/dist/collection/ui-components/form/form-control-checkbox.js +25 -17
  250. package/dist/collection/ui-components/form/form-control-date.js +32 -21
  251. package/dist/collection/ui-components/form/form-control-file-v2.js +23 -18
  252. package/dist/collection/ui-components/form/form-control-file.js +28 -21
  253. package/dist/collection/ui-components/form/form-control-monetary.js +35 -23
  254. package/dist/collection/ui-components/form/form-control-number-masked.js +28 -19
  255. package/dist/collection/ui-components/form/form-control-number.js +25 -17
  256. package/dist/collection/ui-components/form/form-control-radio.js +28 -19
  257. package/dist/collection/ui-components/form/form-control-select.js +29 -19
  258. package/dist/collection/ui-components/form/form-control-text.js +32 -21
  259. package/dist/collection/ui-components/form/form-control-textarea.js +32 -21
  260. package/dist/collection/ui-components/form/form-helpers/form-alert/form-alert.js +6 -6
  261. package/dist/collection/ui-components/form/form-helpers/form-control-help-text/form-control-help-text.js +6 -6
  262. package/dist/collection/ui-components/form/form-helpers/form-control-tooltip/form-control-tooltip.js +3 -6
  263. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  264. package/dist/collection/ui-components/form/iframe-input.js +14 -12
  265. package/dist/collection/ui-components/pagination-menu/pagination-menu.js +6 -0
  266. package/dist/collection/utils/utils.js +8 -0
  267. package/dist/docs.d.ts +8 -0
  268. package/dist/docs.json +2216 -947
  269. package/dist/esm/Api-C9CDE-UM.js +72 -0
  270. package/dist/esm/{Business-0855931c.js → Business-D6XNzizo.js} +2 -2
  271. package/dist/esm/{Checkout-18d8bf94.js → Checkout-Dfpql997.js} +1 -1
  272. package/dist/esm/{ComponentError-c61dce41.js → ComponentError-SdntD1xf.js} +2 -1
  273. package/dist/esm/{Document-1907c0d4.js → Document-Ct-uNz2r.js} +1 -1
  274. package/dist/esm/{Payment-806af354.js → Payment-BADkZFaz.js} +2 -2
  275. package/dist/esm/{SubAccount-7520271c.js → Refund-DOvd7RJp.js} +102 -2
  276. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +7 -0
  277. package/dist/esm/additional-questions-details_5.entry.js +5 -9
  278. package/dist/esm/{badge-1be14e8c.js → badge-D5PvLnZT.js} +3 -3
  279. package/dist/esm/bank-account-document-form-inputs_4.entry.js +25 -41
  280. package/dist/esm/bank-account-form_9.entry.js +91 -93
  281. package/dist/esm/{business-additional-questions-schema-56308a54.js → business-additional-questions-schema-W6okG5Xu.js} +2 -2
  282. package/dist/esm/business-details-core.entry.js +6 -8
  283. package/dist/esm/{business-form-options-86a13078.js → business-form-options-Bn05PRR4.js} +1 -1
  284. package/dist/esm/{business-identity-schema-24fcc4ef.js → business-identity-schema-lqdJS3MT.js} +2 -2
  285. package/dist/esm/{business.service-999196a4.js → business.service-B136meVo.js} +23 -8
  286. package/dist/esm/{button-fcee4da7.js → button-wgHJf7hN.js} +2 -2
  287. package/dist/esm/{check-pkg-version-47fc35a7.js → check-pkg-version-iIBw3nCc.js} +3 -3
  288. package/dist/esm/{checkout.service-e38e477f.js → checkout.service-92ld4w-G.js} +13 -10
  289. package/dist/esm/checkouts-list-core.entry.js +25 -29
  290. package/dist/esm/{checkouts-list-params-state-7bdf00bd.js → checkouts-list-params-state-qgJxi6iW.js} +1 -1
  291. package/dist/esm/{checkouts-table-39a031a0.js → checkouts-table-DQfjKgR-.js} +4 -4
  292. package/dist/esm/custom-popper_4.entry.js +27 -50
  293. package/dist/esm/{dispute.service-7ba6d5a4.js → dispute.service-H2Oaq2af.js} +20 -11
  294. package/dist/esm/{event-types-1bc52f1f.js → event-types-Dv-I6YqZ.js} +3 -3
  295. package/dist/esm/form-alert_5.entry.js +10 -17
  296. package/dist/esm/form-control-checkbox.entry.js +9 -16
  297. package/dist/esm/form-control-date.entry.js +9 -17
  298. package/dist/esm/{form-control-error-text-176d20d8.js → form-control-error-text-nyeinPVQ.js} +2 -2
  299. package/dist/esm/form-control-file-v2_2.entry.js +11 -28
  300. package/dist/esm/{form-control-help-text-83764e14.js → form-control-help-text-QhxeQeTV.js} +2 -2
  301. package/dist/esm/form-control-help-text.entry.js +1 -3
  302. package/dist/esm/form-control-monetary-provisioning.entry.js +13 -20
  303. package/dist/esm/form-control-monetary.entry.js +13 -20
  304. package/dist/esm/form-control-number-masked_2.entry.js +12 -23
  305. package/dist/esm/form-control-number.entry.js +9 -16
  306. package/dist/esm/form-control-radio.entry.js +7 -15
  307. package/dist/esm/{get-business-b7511690.js → get-business-B3c5gg1D.js} +3 -3
  308. package/dist/esm/get-payment-details-Bzh5t6A8.js +40 -0
  309. package/dist/esm/get-payout-csv-bM3pZLKB.js +22 -0
  310. package/dist/esm/{get-subaccounts-3c6b9e84.js → get-subaccounts-BB3Sqb3H.js} +10 -9
  311. package/dist/esm/gross-payment-chart-core.entry.js +262 -268
  312. package/dist/esm/{header-1-215a146f.js → header-1-DNg4xuR6.js} +2 -2
  313. package/dist/esm/{header-3-afd16f23.js → header-3-BD_mh7vB.js} +2 -2
  314. package/dist/esm/{helpers-96ea3464.js → helpers-Mu7LQT-w.js} +2 -2
  315. package/dist/esm/{iframe-input-styles-state-ff730fe5.js → iframe-input-styles-state-DeH54Fkx.js} +3 -3
  316. package/dist/esm/iframe-input.entry.js +1638 -0
  317. package/dist/esm/{index-a47fdc7f.js → index-4sfb1rKO.js} +4 -5
  318. package/dist/esm/{index-d9a73ce3.js → index-Ce_F4E0f.js} +1 -1
  319. package/dist/esm/{index-29fcfdf5.js → index-D4-FKsCU.js} +459 -250
  320. package/dist/esm/index.esm-BCNUj0Dx.js +11801 -0
  321. package/dist/esm/{input-handlers-270ac806.js → input-handlers-CX6mSvOM.js} +1 -1
  322. package/dist/esm/{insurance-state-d2df8e88.js → insurance-state-CXUWRQQk.js} +3 -3
  323. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +64 -92
  324. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +36 -84
  325. package/dist/esm/justifi-additional-statement_8.entry.js +36 -52
  326. package/dist/esm/justifi-business-details.entry.js +16 -18
  327. package/dist/esm/justifi-business-form.entry.js +34 -36
  328. package/dist/esm/justifi-business-representative-form-inputs.entry.js +6 -9
  329. package/dist/esm/justifi-checkout-core.entry.js +31 -32
  330. package/dist/esm/justifi-checkout.entry.js +23 -27
  331. package/dist/esm/justifi-checkouts-list-filters.entry.js +15 -16
  332. package/dist/esm/justifi-checkouts-list.entry.js +25 -28
  333. package/dist/esm/justifi-details.entry.js +3 -4
  334. package/dist/esm/justifi-dispute-management-core.entry.js +5 -9
  335. package/dist/esm/justifi-dispute-management.entry.js +19 -21
  336. package/dist/esm/justifi-dispute-notification_3.entry.js +38 -50
  337. package/dist/esm/justifi-gross-payment-chart.entry.js +13 -14
  338. package/dist/esm/justifi-order-terminals.entry.js +26 -32
  339. package/dist/esm/justifi-owner-form_3.entry.js +29 -50
  340. package/dist/esm/justifi-payment-details.entry.js +22 -48
  341. package/dist/esm/justifi-payment-provisioning-core.entry.js +15 -21
  342. package/dist/esm/justifi-payment-provisioning.entry.js +15 -14
  343. package/dist/esm/justifi-payment-transactions-list.entry.js +193 -0
  344. package/dist/esm/justifi-payments-list-filters.entry.js +11 -15
  345. package/dist/esm/justifi-payments-list.entry.js +25 -27
  346. package/dist/esm/justifi-payout-details.entry.js +21 -23
  347. package/dist/esm/justifi-payout-transactions-list.entry.js +201 -0
  348. package/dist/esm/justifi-payouts-list-filters.entry.js +9 -10
  349. package/dist/esm/justifi-payouts-list.entry.js +27 -30
  350. package/dist/esm/justifi-refund-payment.entry.js +189 -67
  351. package/dist/esm/justifi-season-interruption-insurance-core.entry.js +10 -25
  352. package/dist/esm/justifi-season-interruption-insurance.entry.js +24 -33
  353. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +19 -19
  354. package/dist/esm/justifi-terminal-orders-list.entry.js +28 -26
  355. package/dist/esm/justifi-terminals-list-filters.entry.js +17 -19
  356. package/dist/esm/justifi-terminals-list.entry.js +25 -28
  357. package/dist/esm/justifi-tokenize-payment-method.entry.js +24 -26
  358. package/dist/esm/loader.js +4 -4
  359. package/dist/esm/lodash-BqWxUrkh.js +17214 -0
  360. package/dist/esm/package-DGWLSvML.js +7 -0
  361. package/dist/esm/pagination-menu.entry.js +3 -3
  362. package/dist/esm/{parts-fd740f54.js → parts-6ctk_bhj.js} +3 -2
  363. package/dist/esm/payment-details-core.entry.js +19 -20
  364. package/dist/esm/{payment-provisioning-actions-beadac34.js → payment-provisioning-actions-CZYFFdTf.js} +3 -3
  365. package/dist/esm/payment.service-CeGn-K_X.js +25 -0
  366. package/dist/esm/payments-list-core.entry.js +25 -28
  367. package/dist/esm/{payments-list-params-state-d05b24aa.js → payments-list-params-state-qgJxi6iW.js} +1 -1
  368. package/dist/esm/{payments-status-74d22728.js → payments-status-nKLMqTrO.js} +2 -2
  369. package/dist/esm/{payments-table-8134f5e1.js → payments-table-BrvZHeak.js} +4 -4
  370. package/dist/esm/payout-details-core.entry.js +14 -16
  371. package/dist/esm/payout.service-dukCI9Kl.js +32 -0
  372. package/dist/esm/payouts-list-core.entry.js +26 -31
  373. package/dist/esm/{payouts-list-params-state-ebcee300.js → payouts-list-params-state-qgJxi6iW.js} +1 -1
  374. package/dist/esm/{payouts-status-29d31099.js → payouts-status-tVJFGPCs.js} +2 -2
  375. package/dist/esm/{payouts-table-c1ced46a.js → payouts-table-CgfTp9tE.js} +4 -4
  376. package/dist/esm/{schema-validations-5af4266a.js → schema-validations-BsbYeDDR.js} +5 -5
  377. package/dist/esm/{skeleton-ab3f676e.js → skeleton-D8dsThNX.js} +2 -2
  378. package/dist/esm/{spinner-27479716.js → spinner-BVJ-upD0.js} +2 -2
  379. package/dist/esm/{styled-host-32228b45.js → styled-host-D594Ui4d.js} +2 -3
  380. package/dist/esm/table-filters-menu.entry.js +4 -8
  381. package/dist/esm/terminal-orders-list-core.entry.js +24 -27
  382. package/dist/esm/{terminal-orders-list-params-state-8fec0a0b.js → terminal-orders-list-params-state-qgJxi6iW.js} +1 -1
  383. package/dist/esm/{terminal-orders-table-93e84d25.js → terminal-orders-table-CgioW1d8.js} +35 -5
  384. package/dist/esm/terminal-quantity-selector.entry.js +6 -10
  385. package/dist/esm/{terminal.service-d173566d.js → terminal.service-L0EoPXUE.js} +11 -11
  386. package/dist/esm/terminals-list-core.entry.js +25 -29
  387. package/dist/esm/terminals-list-params-state-qgJxi6iW.js +16 -0
  388. package/dist/esm/{terminals-table-ff24bf27.js → terminals-table-D7LKwR85.js} +4 -4
  389. package/dist/esm/{utils-96d9c205.js → utils-1z8cNzLu.js} +2 -2
  390. package/dist/esm/utils-BWcTxbSg.js +23969 -0
  391. package/dist/esm/{utils-fd99b806.js → utils-Dccsn9BY.js} +2 -2
  392. package/dist/esm/webcomponents.js +6 -5
  393. package/dist/module/Api.js +32 -76
  394. package/dist/module/Business.js +2 -2
  395. package/dist/module/ComponentError.js +2 -1
  396. package/dist/module/Document.js +1 -1
  397. package/dist/module/{SubAccount.js → Refund.js} +101 -1
  398. package/dist/module/_commonjsHelpers.js +7 -0
  399. package/dist/module/additional-questions-details2.js +1 -2
  400. package/dist/module/additional-questions.js +2 -3
  401. package/dist/module/additional-statement.js +6 -9
  402. package/dist/module/badge.js +1 -1
  403. package/dist/module/bank-account-document-inputs.js +4 -6
  404. package/dist/module/bank-account-form-inputs2.js +1 -5
  405. package/dist/module/bank-account-form2.js +0 -1
  406. package/dist/module/billing-form.js +122 -4
  407. package/dist/module/business-additional-questions-form-step-core.js +7 -11
  408. package/dist/module/business-additional-questions-form-step.js +1 -6
  409. package/dist/module/business-additional-questions-schema.js +1 -1
  410. package/dist/module/business-address-schema.js +1 -1
  411. package/dist/module/business-bank-account-form-step-core.js +13 -18
  412. package/dist/module/business-bank-account-form-step.js +3 -9
  413. package/dist/module/business-core-info-form-step-core.js +6 -11
  414. package/dist/module/business-core-info-form-step.js +1 -6
  415. package/dist/module/business-core-info-schema.js +1 -1
  416. package/dist/module/business-core-info.js +2 -3
  417. package/dist/module/business-details-core2.js +1 -3
  418. package/dist/module/business-documents-on-file2.js +1 -1
  419. package/dist/module/business-form-options.js +1 -1
  420. package/dist/module/business-identity-schema.js +1 -1
  421. package/dist/module/business-owners-form-step-core.js +5 -11
  422. package/dist/module/business-owners-form-step.js +1 -6
  423. package/dist/module/business-representative-form-inputs.js +1 -4
  424. package/dist/module/business-representative-form-step-core.js +5 -9
  425. package/dist/module/business-representative-form-step.js +1 -6
  426. package/dist/module/business-representative.js +3 -4
  427. package/dist/module/business-terms-conditions-form-step.js +6 -12
  428. package/dist/module/business.service.js +22 -7
  429. package/dist/module/button.js +1 -1
  430. package/dist/module/cancellation-policy.js +6 -8
  431. package/dist/module/card-form2.js +2 -3
  432. package/dist/module/check-pkg-version.js +1 -1
  433. package/dist/module/checkout-core.js +57 -69
  434. package/dist/module/checkout.service.js +7 -4
  435. package/dist/module/checkouts-list-core2.js +12 -17
  436. package/dist/module/custom-popper2.js +13 -16
  437. package/dist/module/customer-details.js +6 -8
  438. package/dist/module/details.js +0 -1
  439. package/dist/module/dispute-management-core.js +4 -8
  440. package/dist/module/dispute-notification.js +3 -6
  441. package/dist/module/dispute-response-actions.js +16 -7
  442. package/dist/module/dispute-response-core.js +12 -16
  443. package/dist/module/dispute-response.js +6 -12
  444. package/dist/module/duplicate-charge.js +6 -8
  445. package/dist/module/electronic-evidence.js +5 -7
  446. package/dist/module/event-types2.js +21 -61
  447. package/dist/module/event-types3.js +61 -21
  448. package/dist/module/form-alert2.js +1 -3
  449. package/dist/module/form-control-checkbox2.js +6 -13
  450. package/dist/module/form-control-date2.js +6 -14
  451. package/dist/module/form-control-file-v22.js +2 -10
  452. package/dist/module/form-control-file2.js +5 -15
  453. package/dist/module/form-control-help-text.js +1 -1
  454. package/dist/module/form-control-help-text2.js +30 -9
  455. package/dist/module/form-control-help-text3.js +9 -32
  456. package/dist/module/form-control-monetary-provisioning2.js +8 -15
  457. package/dist/module/form-control-monetary2.js +9 -17
  458. package/dist/module/form-control-number-masked2.js +4 -12
  459. package/dist/module/form-control-number.js +6 -13
  460. package/dist/module/form-control-radio2.js +6 -14
  461. package/dist/module/form-control-select2.js +5 -13
  462. package/dist/module/form-control-text2.js +5 -14
  463. package/dist/module/form-control-textarea2.js +7 -16
  464. package/dist/module/form-control-tooltip2.js +0 -3
  465. package/dist/module/form.js +9773 -903
  466. package/dist/module/generic-info-details2.js +0 -1
  467. package/dist/module/get-business.js +2 -2
  468. package/dist/module/get-payment-details.js +40 -0
  469. package/dist/module/get-payout-csv.js +3 -27
  470. package/dist/module/get-subaccounts.js +5 -4
  471. package/dist/module/gross-payment-chart-core2.js +257 -264
  472. package/dist/module/helpers.js +1 -1
  473. package/dist/module/hidden-input2.js +3 -3
  474. package/dist/module/identity-address-form.js +2 -5
  475. package/dist/module/iframe-input-styles-state.js +2 -2
  476. package/dist/module/iframe-input2.js +1481 -1478
  477. package/dist/module/index.js +1 -1
  478. package/dist/module/index2.js +3 -4
  479. package/dist/module/index3.js +1 -1
  480. package/dist/module/{billing-form.d.ts → justifi-billing-form.d.ts} +4 -4
  481. package/dist/module/justifi-billing-form.js +6 -0
  482. package/dist/module/justifi-business-details.js +1 -5
  483. package/dist/module/justifi-business-form.js +7 -10
  484. package/dist/module/justifi-checkout.js +47 -62
  485. package/dist/module/justifi-checkouts-list-filters.js +4 -5
  486. package/dist/module/justifi-checkouts-list.js +8 -11
  487. package/dist/module/justifi-dispute-management.js +6 -9
  488. package/dist/module/justifi-gross-payment-chart.js +4 -7
  489. package/dist/module/justifi-order-terminals.js +6 -13
  490. package/dist/module/justifi-payment-details.js +6 -38
  491. package/dist/module/justifi-payment-provisioning.js +5 -6
  492. package/dist/module/justifi-payment-transactions-list.d.ts +11 -0
  493. package/dist/module/justifi-payment-transactions-list.js +229 -0
  494. package/dist/module/justifi-payments-list-filters.js +6 -11
  495. package/dist/module/justifi-payments-list.js +8 -10
  496. package/dist/module/justifi-payout-details.js +8 -10
  497. package/dist/module/justifi-payout-transactions-list.d.ts +11 -0
  498. package/dist/module/justifi-payout-transactions-list.js +237 -0
  499. package/dist/module/justifi-payouts-list-filters.js +4 -6
  500. package/dist/module/justifi-payouts-list.js +10 -13
  501. package/dist/module/justifi-refund-payment.js +184 -61
  502. package/dist/module/justifi-season-interruption-insurance.js +13 -23
  503. package/dist/module/justifi-terminal-orders-list-filters.js +8 -9
  504. package/dist/module/justifi-terminal-orders-list.js +13 -11
  505. package/dist/module/justifi-terminals-list-filters.js +6 -8
  506. package/dist/module/justifi-terminals-list.js +8 -11
  507. package/dist/module/justifi-tokenize-payment-method.js +46 -58
  508. package/dist/module/legal-address-details2.js +1 -2
  509. package/dist/module/legal-address-form-step-core.js +6 -10
  510. package/dist/module/legal-address-form-step.js +1 -6
  511. package/dist/module/legal-address-form.js +1 -3
  512. package/dist/module/lodash.js +17201 -17191
  513. package/dist/module/new-payment-method.js +43 -55
  514. package/dist/module/owner-details2.js +0 -1
  515. package/dist/module/owner-form-core2.js +8 -18
  516. package/dist/module/owner-form-inputs2.js +1 -4
  517. package/dist/module/owner-form.js +1 -11
  518. package/dist/module/package.js +3 -77
  519. package/dist/module/pagination-menu2.js +1 -1
  520. package/dist/module/parts.js +3 -2
  521. package/dist/module/payment-details-core2.js +11 -13
  522. package/dist/module/payment-method-options.js +43 -61
  523. package/dist/module/payment-provisioning-actions.js +2 -2
  524. package/dist/module/payment-provisioning-core.js +8 -14
  525. package/dist/module/payment-provisioning-form-buttons.js +2 -8
  526. package/dist/module/payment-provisioning-form-steps.js +2 -7
  527. package/dist/module/payment.service.js +8 -4
  528. package/dist/module/payments-list-core2.js +10 -14
  529. package/dist/module/payout-details-core2.js +6 -9
  530. package/dist/module/payout.service.js +32 -0
  531. package/dist/module/payouts-list-core2.js +14 -20
  532. package/dist/module/product-or-service.js +5 -7
  533. package/dist/module/refund-policy.js +6 -8
  534. package/dist/module/representative-details2.js +0 -1
  535. package/dist/module/saved-payment-method.js +4 -6
  536. package/dist/module/schema-validations.js +2 -2
  537. package/dist/module/season-interruption-insurance-core.js +4 -20
  538. package/dist/module/sezzle-payment-method.js +3 -12
  539. package/dist/module/shipping-details.js +6 -8
  540. package/dist/module/spinner.js +1 -1
  541. package/dist/module/styled-host.js +1 -2
  542. package/dist/module/table-filters-menu2.js +3 -7
  543. package/dist/module/terminal-orders-list-core2.js +35 -15
  544. package/dist/module/terminal-quantity-selector2.js +4 -8
  545. package/dist/module/terminal.service.js +5 -5
  546. package/dist/module/terminals-list-core2.js +12 -17
  547. package/dist/module/utils.js +1 -1
  548. package/dist/module/utils2.js +23787 -3819
  549. package/dist/module/utils4.js +2 -2
  550. package/dist/types/actions/payment/get-payment-details.d.ts +4 -2
  551. package/dist/types/actions/payment/get-payment-transactions.d.ts +11 -0
  552. package/dist/types/actions/payout/get-payout-transactions.d.ts +10 -0
  553. package/dist/types/actions/refund/refund-actions.d.ts +12 -0
  554. package/dist/types/api/Api.d.ts +30 -5
  555. package/dist/types/api/ComponentError.d.ts +2 -1
  556. package/dist/types/api/Payment.d.ts +1 -11
  557. package/dist/types/api/PaymentBalanceTransaction.d.ts +42 -0
  558. package/dist/types/api/PayoutBalanceTransaction.d.ts +46 -0
  559. package/dist/types/api/Refund.d.ts +45 -0
  560. package/dist/types/api/TerminalOrder.d.ts +4 -1
  561. package/dist/types/api/index.d.ts +3 -0
  562. package/dist/types/api/services/payment.service.d.ts +4 -2
  563. package/dist/types/api/services/payout.service.d.ts +3 -1
  564. package/dist/types/api/services/refund.service.d.ts +7 -0
  565. package/dist/types/components/business-forms/payment-provisioning/form-control-monetary-provisioning.d.ts +1 -1
  566. package/dist/types/components/business-forms/schemas/business-form-schema.d.ts +3 -3
  567. package/dist/types/components/business-forms/schemas/business-identity-schema.d.ts +1 -1
  568. package/dist/types/components/checkout/{billing-forms → billing-form}/billing-form-schema.d.ts +1 -11
  569. package/dist/types/components/checkout/{billing-forms/billing-form → billing-form}/billing-form.d.ts +8 -6
  570. package/dist/types/components/checkout/checkout-core.d.ts +6 -2
  571. package/dist/types/components/checkout/checkout.d.ts +6 -2
  572. package/dist/types/components/checkout/new-payment-method.d.ts +7 -3
  573. package/dist/types/components/checkout/payment-method-options.d.ts +6 -2
  574. package/dist/types/components/payment-details/payment-details.d.ts +1 -0
  575. package/dist/types/components/payment-transactions-list/payment-transactions-list.d.ts +32 -0
  576. package/dist/types/components/payment-transactions-list/payment-transactions-table.d.ts +43 -0
  577. package/dist/types/components/payout-transactions-list/payout-transactions-list.d.ts +33 -0
  578. package/dist/types/components/payout-transactions-list/payout-transactions-table.d.ts +45 -0
  579. package/dist/types/components/refund-payment/refund-loading.d.ts +1 -0
  580. package/dist/types/components/refund-payment/refund-payment-schema.d.ts +6 -6
  581. package/dist/types/components/refund-payment/refund-payment.d.ts +18 -12
  582. package/dist/types/components/terminal-orders-list/terminal-orders-list-filters.d.ts +1 -1
  583. package/dist/types/components/tokenize-payment-method/tokenize-payment-method.d.ts +4 -0
  584. package/dist/types/components.d.ts +123 -74
  585. package/dist/types/stencil-public-runtime.d.ts +28 -0
  586. package/dist/types/styles/parts.d.ts +6 -5
  587. package/dist/types/ui-components/form/form-control-monetary.d.ts +1 -1
  588. package/dist/types/utils/utils.d.ts +1 -0
  589. package/dist/webcomponents/p-009c6766.entry.js +1 -0
  590. package/dist/webcomponents/p-048ed3f0.entry.js +1 -0
  591. package/dist/webcomponents/p-0764cfde.entry.js +1 -0
  592. package/dist/webcomponents/p-08dcbb41.entry.js +1 -0
  593. package/dist/webcomponents/p-0b0e44c4.entry.js +1 -0
  594. package/dist/webcomponents/p-0b1bbf91.entry.js +1 -0
  595. package/dist/webcomponents/p-0c9c8d6f.entry.js +1 -0
  596. package/dist/webcomponents/p-103692ef.entry.js +1 -0
  597. package/dist/webcomponents/p-103deee0.entry.js +1 -0
  598. package/dist/webcomponents/p-10ad134d.entry.js +1 -0
  599. package/dist/webcomponents/p-175a913f.entry.js +1 -0
  600. package/dist/webcomponents/p-1c2bedfe.entry.js +1 -0
  601. package/dist/webcomponents/p-1ydcg9ti.js +1 -0
  602. package/dist/webcomponents/p-36656ed1.entry.js +1 -0
  603. package/dist/webcomponents/p-3678f5fb.entry.js +1 -0
  604. package/dist/webcomponents/p-3b1f69fd.entry.js +1 -0
  605. package/dist/webcomponents/p-405f135e.entry.js +1 -0
  606. package/dist/webcomponents/p-40614f67.entry.js +1 -0
  607. package/dist/webcomponents/p-41a0b83c.entry.js +1 -0
  608. package/dist/webcomponents/p-4361ae88.entry.js +1 -0
  609. package/dist/webcomponents/p-487514c2.entry.js +1 -0
  610. package/dist/webcomponents/p-4994c980.entry.js +1 -0
  611. package/dist/webcomponents/p-4c4cc0ad.entry.js +20 -0
  612. package/dist/webcomponents/p-4d5b8876.entry.js +1 -0
  613. package/dist/webcomponents/p-529bf046.entry.js +1 -0
  614. package/dist/webcomponents/p-5321c7d5.entry.js +1 -0
  615. package/dist/webcomponents/p-54aa7e86.entry.js +1 -0
  616. package/dist/webcomponents/p-5aeOUdhX.js +1 -0
  617. package/dist/webcomponents/p-601669bb.entry.js +1 -0
  618. package/dist/webcomponents/p-63c835b9.entry.js +1 -0
  619. package/dist/webcomponents/p-656ec7b6.entry.js +1 -0
  620. package/dist/webcomponents/p-6ctk_bhj.js +1 -0
  621. package/dist/webcomponents/p-6d36d6a7.entry.js +1 -0
  622. package/dist/webcomponents/p-76e7c283.entry.js +1 -0
  623. package/dist/webcomponents/p-81a1be23.entry.js +1 -0
  624. package/dist/webcomponents/p-81d682ba.entry.js +1 -0
  625. package/dist/webcomponents/p-85681d97.entry.js +1 -0
  626. package/dist/webcomponents/p-88539215.entry.js +1 -0
  627. package/dist/webcomponents/p-896e4fb2.entry.js +1 -0
  628. package/dist/webcomponents/p-8bc32c27.entry.js +1 -0
  629. package/dist/webcomponents/p-8d4d2ac3.entry.js +1 -0
  630. package/dist/webcomponents/p-9349d32e.entry.js +1 -0
  631. package/dist/webcomponents/p-938e0dbc.entry.js +1 -0
  632. package/dist/webcomponents/p-94d81903.entry.js +1 -0
  633. package/dist/webcomponents/p-9767500b.entry.js +1 -0
  634. package/dist/webcomponents/p-9cf5ed80.entry.js +1 -0
  635. package/dist/webcomponents/p-AVaenhw9.js +1 -0
  636. package/dist/webcomponents/p-B2H14Naw.js +1 -0
  637. package/dist/webcomponents/p-B4iBNBBM.js +1 -0
  638. package/dist/webcomponents/p-BAXE_ZfF.js +1 -0
  639. package/dist/webcomponents/p-BBsCnePk.js +1 -0
  640. package/dist/webcomponents/p-BFTU3MAI.js +1 -0
  641. package/dist/webcomponents/p-BHbsXXRt.js +1 -0
  642. package/dist/webcomponents/p-BLdGqrQH.js +1 -0
  643. package/dist/webcomponents/p-BODr6HXb.js +1 -0
  644. package/dist/webcomponents/p-Bde7dY9t.js +9 -0
  645. package/dist/webcomponents/{p-1366a019.js → p-BjB_yKBJ.js} +1 -1
  646. package/dist/webcomponents/p-BoPxMyJA.js +1 -0
  647. package/dist/webcomponents/{p-5d1d2fd7.js → p-BrvbVMVq.js} +1 -1
  648. package/dist/webcomponents/p-BupmNfQ5.js +1 -0
  649. package/dist/webcomponents/p-BvWS8buZ.js +1 -0
  650. package/dist/webcomponents/{p-ca6cdfe6.js → p-BwgcVN7d.js} +1 -1
  651. package/dist/webcomponents/p-BxGoUIgN.js +1 -0
  652. package/dist/webcomponents/{p-3f5e6602.js → p-Bxs6fi7a.js} +1 -1
  653. package/dist/webcomponents/p-C3uv9u0l.js +1 -0
  654. package/dist/webcomponents/{p-87f8c596.js → p-C5RuuShs.js} +1 -1
  655. package/dist/webcomponents/p-CCN8wTYX.js +1 -0
  656. package/dist/webcomponents/p-CG9te8PM.js +1 -0
  657. package/dist/webcomponents/p-CGz3XHQc.js +1 -0
  658. package/dist/webcomponents/p-CRgzzPY4.js +1 -0
  659. package/dist/webcomponents/p-CZLIteZz.js +1 -0
  660. package/dist/webcomponents/p-C_9TcvwA.js +1 -0
  661. package/dist/webcomponents/p-CbZjB3qJ.js +1 -0
  662. package/dist/webcomponents/p-CfbB7agn.js +1 -0
  663. package/dist/webcomponents/{p-4cc3c7f9.js → p-CgS6VBEy.js} +1 -1
  664. package/dist/webcomponents/p-CpTwq2jw.js +1 -0
  665. package/dist/webcomponents/{p-61f0a2ce.js → p-Ct-uNz2r.js} +1 -1
  666. package/dist/webcomponents/p-Cy4aIACq.js +1 -0
  667. package/dist/webcomponents/p-D4-FKsCU.js +2 -0
  668. package/dist/webcomponents/{p-12074378.js → p-D5q9gEvl.js} +1 -1
  669. package/dist/webcomponents/p-D5wGYrfz.js +1 -0
  670. package/dist/webcomponents/{p-701a13ca.js → p-D6mhG0dV.js} +1 -1
  671. package/dist/webcomponents/p-DArbkdtn.js +1 -0
  672. package/dist/webcomponents/{p-a5579f53.js → p-DBfKxfCX.js} +1 -1
  673. package/dist/webcomponents/p-DEa8EbZW.js +1 -0
  674. package/dist/webcomponents/p-DGWLSvML.js +1 -0
  675. package/dist/webcomponents/p-DPC4A7AZ.js +1 -0
  676. package/dist/webcomponents/p-DVnVdicA.js +1 -0
  677. package/dist/webcomponents/p-DavDfnxI.js +1 -0
  678. package/dist/webcomponents/{p-70be104e.js → p-DgQyL5KO.js} +1 -1
  679. package/dist/webcomponents/p-DmBEzYCU.js +1 -0
  680. package/dist/webcomponents/p-Dt-vy9Le.js +1 -0
  681. package/dist/webcomponents/p-EbYREopN.js +1 -0
  682. package/dist/webcomponents/{p-c9b78275.js → p-IA90llLO.js} +1 -1
  683. package/dist/webcomponents/p-NI7Keg2H.js +1 -0
  684. package/dist/webcomponents/{p-9dd8685c.js → p-SdntD1xf.js} +1 -1
  685. package/dist/webcomponents/p-XazJ9qLe.js +1 -0
  686. package/dist/webcomponents/p-Xql8Xhsx.js +1 -0
  687. package/dist/webcomponents/p-a4e7d24f.entry.js +1 -0
  688. package/dist/webcomponents/p-a78bf0f7.entry.js +1 -0
  689. package/dist/webcomponents/p-a83bf2c0.entry.js +1 -0
  690. package/dist/webcomponents/p-b15d6c77.entry.js +1 -0
  691. package/dist/webcomponents/p-b5dd55b1.entry.js +1 -0
  692. package/dist/webcomponents/p-b8096d2b.entry.js +1 -0
  693. package/dist/webcomponents/p-bbc56c17.entry.js +1 -0
  694. package/dist/webcomponents/p-bc3d56a7.entry.js +1 -0
  695. package/dist/webcomponents/p-bf83ba04.entry.js +1 -0
  696. package/dist/webcomponents/p-bplwtwD3.js +1 -0
  697. package/dist/webcomponents/p-c5b66da3.entry.js +1 -0
  698. package/dist/webcomponents/p-c7dc7184.entry.js +1 -0
  699. package/dist/webcomponents/p-cb8b91ea.entry.js +1 -0
  700. package/dist/webcomponents/p-d7ea4db7.entry.js +1 -0
  701. package/dist/webcomponents/p-dadb97e1.entry.js +1 -0
  702. package/dist/webcomponents/p-dafac427.entry.js +1 -0
  703. package/dist/webcomponents/p-dca205de.entry.js +1 -0
  704. package/dist/webcomponents/p-df3fb523.entry.js +1 -0
  705. package/dist/webcomponents/p-f-9W4QBD.js +1 -0
  706. package/dist/webcomponents/p-f604d6ea.entry.js +1 -0
  707. package/dist/webcomponents/p-ffbf35a4.entry.js +1 -0
  708. package/dist/webcomponents/{p-bfe9748b.js → p-lvlr3zXn.js} +1 -1
  709. package/dist/webcomponents/p-obi7kkCX.js +1 -0
  710. package/dist/webcomponents/webcomponents.esm.js +1 -1
  711. package/package.json +6 -7
  712. package/dist/cjs/Api-83d93333.js +0 -118
  713. package/dist/cjs/billing-form_3.cjs.entry.js +0 -1733
  714. package/dist/cjs/get-payout-csv-7607c71e.js +0 -49
  715. package/dist/cjs/index.esm-544c08fd.js +0 -2937
  716. package/dist/cjs/lodash-dbf6a6a4.js +0 -17206
  717. package/dist/cjs/package-5a9f02b2.js +0 -83
  718. package/dist/cjs/payment.service-537e049d.js +0 -23
  719. package/dist/cjs/terminals-list-params-state-236f06f6.js +0 -22
  720. package/dist/cjs/utils-4120664c.js +0 -4018
  721. package/dist/collection/components/checkout/billing-forms/billing-form/billing-form.js +0 -137
  722. package/dist/collection/components/checkout/billing-forms/billing-form-schema.js +0 -26
  723. package/dist/collection/components/checkout/billing-forms/billing-form-wrapper.js +0 -183
  724. package/dist/collection/components/checkout/billing-forms/postal-form/postal-form.js +0 -136
  725. package/dist/esm/Api-52242eb0.js +0 -116
  726. package/dist/esm/billing-form_3.entry.js +0 -1727
  727. package/dist/esm/get-payout-csv-fa34f40b.js +0 -46
  728. package/dist/esm/index.esm-feedf26f.js +0 -2931
  729. package/dist/esm/lodash-faeb5a52.js +0 -17204
  730. package/dist/esm/package-c8466624.js +0 -81
  731. package/dist/esm/payment.service-af5bd8be.js +0 -21
  732. package/dist/esm/terminals-list-params-state-e4b2ec23.js +0 -16
  733. package/dist/esm/utils-ec50661e.js +0 -4001
  734. package/dist/loader/package.json +0 -11
  735. package/dist/module/billing-form-schema.js +0 -16
  736. package/dist/module/billing-form-wrapper.js +0 -114
  737. package/dist/module/billing-form2.js +0 -90
  738. package/dist/module/justifi-billing-form-wrapper.d.ts +0 -11
  739. package/dist/module/justifi-billing-form-wrapper.js +0 -6
  740. package/dist/module/postal-form.d.ts +0 -11
  741. package/dist/module/postal-form.js +0 -6
  742. package/dist/module/postal-form2.js +0 -83
  743. package/dist/types/components/checkout/billing-forms/billing-form-wrapper.d.ts +0 -19
  744. package/dist/types/components/checkout/billing-forms/postal-form/postal-form.d.ts +0 -20
  745. package/dist/webcomponents/p-01033194.js +0 -1
  746. package/dist/webcomponents/p-04d6b37e.entry.js +0 -1
  747. package/dist/webcomponents/p-092515e0.js +0 -1
  748. package/dist/webcomponents/p-0b61d4d3.entry.js +0 -1
  749. package/dist/webcomponents/p-0c7ec110.entry.js +0 -1
  750. package/dist/webcomponents/p-0f0020e1.entry.js +0 -1
  751. package/dist/webcomponents/p-0fa216eb.entry.js +0 -1
  752. package/dist/webcomponents/p-1361d8eb.entry.js +0 -1
  753. package/dist/webcomponents/p-13717638.entry.js +0 -1
  754. package/dist/webcomponents/p-142bfae3.js +0 -1
  755. package/dist/webcomponents/p-1cfa5df9.entry.js +0 -1
  756. package/dist/webcomponents/p-1ff8810b.js +0 -1
  757. package/dist/webcomponents/p-2123c150.js +0 -1
  758. package/dist/webcomponents/p-21def20b.entry.js +0 -1
  759. package/dist/webcomponents/p-23cd76af.entry.js +0 -1
  760. package/dist/webcomponents/p-25b82529.entry.js +0 -1
  761. package/dist/webcomponents/p-27546fa9.entry.js +0 -1
  762. package/dist/webcomponents/p-275c3dc9.js +0 -1
  763. package/dist/webcomponents/p-2783e363.js +0 -2
  764. package/dist/webcomponents/p-290fa30d.entry.js +0 -1
  765. package/dist/webcomponents/p-2a9d7f6b.js +0 -1
  766. package/dist/webcomponents/p-2aad7e3b.entry.js +0 -1
  767. package/dist/webcomponents/p-2b8aaa7d.entry.js +0 -1
  768. package/dist/webcomponents/p-3075b7e1.entry.js +0 -1
  769. package/dist/webcomponents/p-31dcaeaf.entry.js +0 -1
  770. package/dist/webcomponents/p-35c296fc.entry.js +0 -1
  771. package/dist/webcomponents/p-373a19fe.entry.js +0 -1
  772. package/dist/webcomponents/p-375657fe.entry.js +0 -1
  773. package/dist/webcomponents/p-3cc7527a.entry.js +0 -1
  774. package/dist/webcomponents/p-3cf317d3.entry.js +0 -1
  775. package/dist/webcomponents/p-407d6d29.entry.js +0 -1
  776. package/dist/webcomponents/p-4451de8d.entry.js +0 -1
  777. package/dist/webcomponents/p-4f7432c3.entry.js +0 -1
  778. package/dist/webcomponents/p-536497fe.entry.js +0 -1
  779. package/dist/webcomponents/p-536fb8e2.js +0 -1
  780. package/dist/webcomponents/p-537bce77.js +0 -1
  781. package/dist/webcomponents/p-54556fc6.js +0 -1
  782. package/dist/webcomponents/p-56c7fc8d.js +0 -1
  783. package/dist/webcomponents/p-58ee6ce9.js +0 -1
  784. package/dist/webcomponents/p-5a541d35.js +0 -1
  785. package/dist/webcomponents/p-5a9d7ca0.entry.js +0 -1
  786. package/dist/webcomponents/p-5b76dbe1.entry.js +0 -1
  787. package/dist/webcomponents/p-5f6b4bc9.js +0 -1
  788. package/dist/webcomponents/p-645db2cb.entry.js +0 -1
  789. package/dist/webcomponents/p-673c1bca.js +0 -1
  790. package/dist/webcomponents/p-753d983c.entry.js +0 -1
  791. package/dist/webcomponents/p-76549a24.js +0 -1
  792. package/dist/webcomponents/p-7d85af5c.js +0 -1
  793. package/dist/webcomponents/p-7e8732f7.entry.js +0 -1
  794. package/dist/webcomponents/p-81a6c3e2.entry.js +0 -1
  795. package/dist/webcomponents/p-829480e7.entry.js +0 -1
  796. package/dist/webcomponents/p-86605101.js +0 -1
  797. package/dist/webcomponents/p-87a4fb5b.js +0 -1
  798. package/dist/webcomponents/p-927cb6df.js +0 -1
  799. package/dist/webcomponents/p-94e4f1f1.entry.js +0 -1
  800. package/dist/webcomponents/p-96c23cda.entry.js +0 -1
  801. package/dist/webcomponents/p-9a9732e1.js +0 -1
  802. package/dist/webcomponents/p-9fecad5a.js +0 -1
  803. package/dist/webcomponents/p-a3cced75.entry.js +0 -1
  804. package/dist/webcomponents/p-a5f5cc2e.entry.js +0 -1
  805. package/dist/webcomponents/p-a8c69f51.entry.js +0 -1
  806. package/dist/webcomponents/p-ab45511e.js +0 -1
  807. package/dist/webcomponents/p-ad713ab6.entry.js +0 -1
  808. package/dist/webcomponents/p-adecb91a.entry.js +0 -1
  809. package/dist/webcomponents/p-ae7edce5.js +0 -1
  810. package/dist/webcomponents/p-ae891abb.entry.js +0 -1
  811. package/dist/webcomponents/p-af3315b5.entry.js +0 -1
  812. package/dist/webcomponents/p-b218af87.entry.js +0 -1
  813. package/dist/webcomponents/p-b50ca848.entry.js +0 -1
  814. package/dist/webcomponents/p-b84ee6d8.js +0 -1
  815. package/dist/webcomponents/p-b8664571.entry.js +0 -1
  816. package/dist/webcomponents/p-bb4b3f79.entry.js +0 -1
  817. package/dist/webcomponents/p-beec0b60.js +0 -1
  818. package/dist/webcomponents/p-bf12999f.js +0 -1
  819. package/dist/webcomponents/p-bf195b35.js +0 -1
  820. package/dist/webcomponents/p-bfc2d88a.js +0 -1
  821. package/dist/webcomponents/p-c6be72b0.js +0 -10
  822. package/dist/webcomponents/p-c8b78136.js +0 -1
  823. package/dist/webcomponents/p-cbad44b7.js +0 -1
  824. package/dist/webcomponents/p-cc2f75a3.entry.js +0 -1
  825. package/dist/webcomponents/p-ccb9ee53.js +0 -1
  826. package/dist/webcomponents/p-cd93c62b.entry.js +0 -19
  827. package/dist/webcomponents/p-d757fcf5.js +0 -1
  828. package/dist/webcomponents/p-dbc1a95b.js +0 -1
  829. package/dist/webcomponents/p-dd2938d3.entry.js +0 -1
  830. package/dist/webcomponents/p-de03d0f8.js +0 -1
  831. package/dist/webcomponents/p-dec18cc4.js +0 -1
  832. package/dist/webcomponents/p-e1ae5e80.entry.js +0 -1
  833. package/dist/webcomponents/p-e3855f51.entry.js +0 -1
  834. package/dist/webcomponents/p-e73be1b9.entry.js +0 -1
  835. package/dist/webcomponents/p-e9867f8b.entry.js +0 -1
  836. package/dist/webcomponents/p-ef1db3da.entry.js +0 -1
  837. package/dist/webcomponents/p-f13b2991.entry.js +0 -1
  838. package/dist/webcomponents/p-f20466f7.entry.js +0 -1
  839. package/dist/webcomponents/p-f20b6ce1.js +0 -1
  840. package/dist/webcomponents/p-f4739d31.js +0 -1
  841. package/dist/webcomponents/p-f4aeb100.js +0 -1
  842. package/dist/webcomponents/p-f8fccf44.js +0 -1
  843. package/dist/webcomponents/p-f930504f.entry.js +0 -1
  844. package/dist/webcomponents/p-faa35b47.entry.js +0 -1
  845. package/dist/webcomponents/p-fb2db8da.entry.js +0 -1
  846. package/dist/webcomponents/p-fca89e9b.entry.js +0 -1
  847. /package/dist/cjs/{Dispute-eb6bad54.js → Dispute-CruQTF6_.js} +0 -0
  848. /package/dist/cjs/{Document-0b828345.js → Document-rXGBUaOh.js} +0 -0
  849. /package/dist/cjs/{Pagination-0da8f095.js → Pagination-Dediz133.js} +0 -0
  850. /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
  851. /package/dist/cjs/{event-types-8edaabbb.js → event-types-BWQT2lwu.js} +0 -0
  852. /package/dist/cjs/{event-types-180a85a9.js → event-types-DNOUef41.js} +0 -0
  853. /package/dist/cjs/{form-input-masks-0879c139.js → form-input-masks-DgXd0f4V.js} +0 -0
  854. /package/dist/cjs/{state-options-4fbcb48a.js → state-options-CIT9xdTz.js} +0 -0
  855. /package/dist/cjs/{utils-bc03ca40.js → utils-DAyWinG2.js} +0 -0
  856. /package/dist/esm/{Dispute-5fd28ec9.js → Dispute-7MWRbTXI.js} +0 -0
  857. /package/dist/esm/{Pagination-afc8f96d.js → Pagination-CLHwhyvu.js} +0 -0
  858. /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  859. /package/dist/esm/{event-types-07cdb9a0.js → event-types-Bg2SZArf.js} +0 -0
  860. /package/dist/esm/{event-types-5c87de02.js → event-types-XYgDHrVL.js} +0 -0
  861. /package/dist/esm/{form-input-masks-0e18300f.js → form-input-masks-B-iV5cYd.js} +0 -0
  862. /package/dist/esm/{state-options-a356fb11.js → state-options-BX8GieXu.js} +0 -0
  863. /package/dist/esm/{utils-20cdf321.js → utils-BnjCmwMr.js} +0 -0
  864. /package/dist/webcomponents/{p-abdbcd8e.js → p-7MWRbTXI.js} +0 -0
  865. /package/dist/webcomponents/{p-525db3e8.js → p-B-iV5cYd.js} +0 -0
  866. /package/dist/webcomponents/{p-6078a370.js → p-BX8GieXu.js} +0 -0
  867. /package/dist/webcomponents/{p-667ebd79.js → p-Bg2SZArf.js} +0 -0
  868. /package/dist/webcomponents/{p-e3c22aa9.js → p-BnjCmwMr.js} +0 -0
  869. /package/dist/webcomponents/{p-56f6ce4c.js → p-CLHwhyvu.js} +0 -0
  870. /package/dist/webcomponents/{p-1ad5995e.js → p-Ce_F4E0f.js} +0 -0
  871. /package/dist/webcomponents/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
  872. /package/dist/webcomponents/{p-73f9be7c.js → p-XYgDHrVL.js} +0 -0
@@ -1,2931 +0,0 @@
1
- function isFunction(value) {
2
- return typeof value === 'function';
3
- }
4
-
5
- function createErrorClass(createImpl) {
6
- const _super = (instance) => {
7
- Error.call(instance);
8
- instance.stack = new Error().stack;
9
- };
10
- const ctorFunc = createImpl(_super);
11
- ctorFunc.prototype = Object.create(Error.prototype);
12
- ctorFunc.prototype.constructor = ctorFunc;
13
- return ctorFunc;
14
- }
15
-
16
- const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
17
- _super(this);
18
- this.message = errors
19
- ? `${errors.length} errors occurred during unsubscription:
20
- ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
21
- : '';
22
- this.name = 'UnsubscriptionError';
23
- this.errors = errors;
24
- });
25
-
26
- function arrRemove(arr, item) {
27
- if (arr) {
28
- const index = arr.indexOf(item);
29
- 0 <= index && arr.splice(index, 1);
30
- }
31
- }
32
-
33
- class Subscription {
34
- constructor(initialTeardown) {
35
- this.initialTeardown = initialTeardown;
36
- this.closed = false;
37
- this._parentage = null;
38
- this._finalizers = null;
39
- }
40
- unsubscribe() {
41
- let errors;
42
- if (!this.closed) {
43
- this.closed = true;
44
- const { _parentage } = this;
45
- if (_parentage) {
46
- this._parentage = null;
47
- if (Array.isArray(_parentage)) {
48
- for (const parent of _parentage) {
49
- parent.remove(this);
50
- }
51
- }
52
- else {
53
- _parentage.remove(this);
54
- }
55
- }
56
- const { initialTeardown: initialFinalizer } = this;
57
- if (isFunction(initialFinalizer)) {
58
- try {
59
- initialFinalizer();
60
- }
61
- catch (e) {
62
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
63
- }
64
- }
65
- const { _finalizers } = this;
66
- if (_finalizers) {
67
- this._finalizers = null;
68
- for (const finalizer of _finalizers) {
69
- try {
70
- execFinalizer(finalizer);
71
- }
72
- catch (err) {
73
- errors = errors !== null && errors !== void 0 ? errors : [];
74
- if (err instanceof UnsubscriptionError) {
75
- errors = [...errors, ...err.errors];
76
- }
77
- else {
78
- errors.push(err);
79
- }
80
- }
81
- }
82
- }
83
- if (errors) {
84
- throw new UnsubscriptionError(errors);
85
- }
86
- }
87
- }
88
- add(teardown) {
89
- var _a;
90
- if (teardown && teardown !== this) {
91
- if (this.closed) {
92
- execFinalizer(teardown);
93
- }
94
- else {
95
- if (teardown instanceof Subscription) {
96
- if (teardown.closed || teardown._hasParent(this)) {
97
- return;
98
- }
99
- teardown._addParent(this);
100
- }
101
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
102
- }
103
- }
104
- }
105
- _hasParent(parent) {
106
- const { _parentage } = this;
107
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
108
- }
109
- _addParent(parent) {
110
- const { _parentage } = this;
111
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
112
- }
113
- _removeParent(parent) {
114
- const { _parentage } = this;
115
- if (_parentage === parent) {
116
- this._parentage = null;
117
- }
118
- else if (Array.isArray(_parentage)) {
119
- arrRemove(_parentage, parent);
120
- }
121
- }
122
- remove(teardown) {
123
- const { _finalizers } = this;
124
- _finalizers && arrRemove(_finalizers, teardown);
125
- if (teardown instanceof Subscription) {
126
- teardown._removeParent(this);
127
- }
128
- }
129
- }
130
- Subscription.EMPTY = (() => {
131
- const empty = new Subscription();
132
- empty.closed = true;
133
- return empty;
134
- })();
135
- const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
136
- function isSubscription(value) {
137
- return (value instanceof Subscription ||
138
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
139
- }
140
- function execFinalizer(finalizer) {
141
- if (isFunction(finalizer)) {
142
- finalizer();
143
- }
144
- else {
145
- finalizer.unsubscribe();
146
- }
147
- }
148
-
149
- const config = {
150
- onUnhandledError: null,
151
- onStoppedNotification: null,
152
- Promise: undefined,
153
- useDeprecatedSynchronousErrorHandling: false,
154
- useDeprecatedNextContext: false,
155
- };
156
-
157
- const timeoutProvider = {
158
- setTimeout(handler, timeout, ...args) {
159
- const { delegate } = timeoutProvider;
160
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
161
- return delegate.setTimeout(handler, timeout, ...args);
162
- }
163
- return setTimeout(handler, timeout, ...args);
164
- },
165
- clearTimeout(handle) {
166
- const { delegate } = timeoutProvider;
167
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
168
- },
169
- delegate: undefined,
170
- };
171
-
172
- function reportUnhandledError(err) {
173
- timeoutProvider.setTimeout(() => {
174
- const { onUnhandledError } = config;
175
- if (onUnhandledError) {
176
- onUnhandledError(err);
177
- }
178
- else {
179
- throw err;
180
- }
181
- });
182
- }
183
-
184
- function noop() { }
185
-
186
- const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
187
- function errorNotification(error) {
188
- return createNotification('E', undefined, error);
189
- }
190
- function nextNotification(value) {
191
- return createNotification('N', value, undefined);
192
- }
193
- function createNotification(kind, value, error) {
194
- return {
195
- kind,
196
- value,
197
- error,
198
- };
199
- }
200
-
201
- let context = null;
202
- function errorContext(cb) {
203
- if (config.useDeprecatedSynchronousErrorHandling) {
204
- const isRoot = !context;
205
- if (isRoot) {
206
- context = { errorThrown: false, error: null };
207
- }
208
- cb();
209
- if (isRoot) {
210
- const { errorThrown, error } = context;
211
- context = null;
212
- if (errorThrown) {
213
- throw error;
214
- }
215
- }
216
- }
217
- else {
218
- cb();
219
- }
220
- }
221
-
222
- class Subscriber extends Subscription {
223
- constructor(destination) {
224
- super();
225
- this.isStopped = false;
226
- if (destination) {
227
- this.destination = destination;
228
- if (isSubscription(destination)) {
229
- destination.add(this);
230
- }
231
- }
232
- else {
233
- this.destination = EMPTY_OBSERVER;
234
- }
235
- }
236
- static create(next, error, complete) {
237
- return new SafeSubscriber(next, error, complete);
238
- }
239
- next(value) {
240
- if (this.isStopped) {
241
- handleStoppedNotification(nextNotification(value), this);
242
- }
243
- else {
244
- this._next(value);
245
- }
246
- }
247
- error(err) {
248
- if (this.isStopped) {
249
- handleStoppedNotification(errorNotification(err), this);
250
- }
251
- else {
252
- this.isStopped = true;
253
- this._error(err);
254
- }
255
- }
256
- complete() {
257
- if (this.isStopped) {
258
- handleStoppedNotification(COMPLETE_NOTIFICATION, this);
259
- }
260
- else {
261
- this.isStopped = true;
262
- this._complete();
263
- }
264
- }
265
- unsubscribe() {
266
- if (!this.closed) {
267
- this.isStopped = true;
268
- super.unsubscribe();
269
- this.destination = null;
270
- }
271
- }
272
- _next(value) {
273
- this.destination.next(value);
274
- }
275
- _error(err) {
276
- try {
277
- this.destination.error(err);
278
- }
279
- finally {
280
- this.unsubscribe();
281
- }
282
- }
283
- _complete() {
284
- try {
285
- this.destination.complete();
286
- }
287
- finally {
288
- this.unsubscribe();
289
- }
290
- }
291
- }
292
- const _bind = Function.prototype.bind;
293
- function bind(fn, thisArg) {
294
- return _bind.call(fn, thisArg);
295
- }
296
- class ConsumerObserver {
297
- constructor(partialObserver) {
298
- this.partialObserver = partialObserver;
299
- }
300
- next(value) {
301
- const { partialObserver } = this;
302
- if (partialObserver.next) {
303
- try {
304
- partialObserver.next(value);
305
- }
306
- catch (error) {
307
- handleUnhandledError(error);
308
- }
309
- }
310
- }
311
- error(err) {
312
- const { partialObserver } = this;
313
- if (partialObserver.error) {
314
- try {
315
- partialObserver.error(err);
316
- }
317
- catch (error) {
318
- handleUnhandledError(error);
319
- }
320
- }
321
- else {
322
- handleUnhandledError(err);
323
- }
324
- }
325
- complete() {
326
- const { partialObserver } = this;
327
- if (partialObserver.complete) {
328
- try {
329
- partialObserver.complete();
330
- }
331
- catch (error) {
332
- handleUnhandledError(error);
333
- }
334
- }
335
- }
336
- }
337
- class SafeSubscriber extends Subscriber {
338
- constructor(observerOrNext, error, complete) {
339
- super();
340
- let partialObserver;
341
- if (isFunction(observerOrNext) || !observerOrNext) {
342
- partialObserver = {
343
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
344
- error: error !== null && error !== void 0 ? error : undefined,
345
- complete: complete !== null && complete !== void 0 ? complete : undefined,
346
- };
347
- }
348
- else {
349
- let context;
350
- if (this && config.useDeprecatedNextContext) {
351
- context = Object.create(observerOrNext);
352
- context.unsubscribe = () => this.unsubscribe();
353
- partialObserver = {
354
- next: observerOrNext.next && bind(observerOrNext.next, context),
355
- error: observerOrNext.error && bind(observerOrNext.error, context),
356
- complete: observerOrNext.complete && bind(observerOrNext.complete, context),
357
- };
358
- }
359
- else {
360
- partialObserver = observerOrNext;
361
- }
362
- }
363
- this.destination = new ConsumerObserver(partialObserver);
364
- }
365
- }
366
- function handleUnhandledError(error) {
367
- {
368
- reportUnhandledError(error);
369
- }
370
- }
371
- function defaultErrorHandler(err) {
372
- throw err;
373
- }
374
- function handleStoppedNotification(notification, subscriber) {
375
- const { onStoppedNotification } = config;
376
- onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
377
- }
378
- const EMPTY_OBSERVER = {
379
- closed: true,
380
- next: noop,
381
- error: defaultErrorHandler,
382
- complete: noop,
383
- };
384
-
385
- const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
386
-
387
- function identity(x) {
388
- return x;
389
- }
390
-
391
- function pipeFromArray(fns) {
392
- if (fns.length === 0) {
393
- return identity;
394
- }
395
- if (fns.length === 1) {
396
- return fns[0];
397
- }
398
- return function piped(input) {
399
- return fns.reduce((prev, fn) => fn(prev), input);
400
- };
401
- }
402
-
403
- class Observable {
404
- constructor(subscribe) {
405
- if (subscribe) {
406
- this._subscribe = subscribe;
407
- }
408
- }
409
- lift(operator) {
410
- const observable = new Observable();
411
- observable.source = this;
412
- observable.operator = operator;
413
- return observable;
414
- }
415
- subscribe(observerOrNext, error, complete) {
416
- const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
417
- errorContext(() => {
418
- const { operator, source } = this;
419
- subscriber.add(operator
420
- ?
421
- operator.call(subscriber, source)
422
- : source
423
- ?
424
- this._subscribe(subscriber)
425
- :
426
- this._trySubscribe(subscriber));
427
- });
428
- return subscriber;
429
- }
430
- _trySubscribe(sink) {
431
- try {
432
- return this._subscribe(sink);
433
- }
434
- catch (err) {
435
- sink.error(err);
436
- }
437
- }
438
- forEach(next, promiseCtor) {
439
- promiseCtor = getPromiseCtor(promiseCtor);
440
- return new promiseCtor((resolve, reject) => {
441
- const subscriber = new SafeSubscriber({
442
- next: (value) => {
443
- try {
444
- next(value);
445
- }
446
- catch (err) {
447
- reject(err);
448
- subscriber.unsubscribe();
449
- }
450
- },
451
- error: reject,
452
- complete: resolve,
453
- });
454
- this.subscribe(subscriber);
455
- });
456
- }
457
- _subscribe(subscriber) {
458
- var _a;
459
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
460
- }
461
- [observable]() {
462
- return this;
463
- }
464
- pipe(...operations) {
465
- return pipeFromArray(operations)(this);
466
- }
467
- toPromise(promiseCtor) {
468
- promiseCtor = getPromiseCtor(promiseCtor);
469
- return new promiseCtor((resolve, reject) => {
470
- let value;
471
- this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
472
- });
473
- }
474
- }
475
- Observable.create = (subscribe) => {
476
- return new Observable(subscribe);
477
- };
478
- function getPromiseCtor(promiseCtor) {
479
- var _a;
480
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
481
- }
482
- function isObserver(value) {
483
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
484
- }
485
- function isSubscriber(value) {
486
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
487
- }
488
-
489
- const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
490
- _super(this);
491
- this.name = 'ObjectUnsubscribedError';
492
- this.message = 'object unsubscribed';
493
- });
494
-
495
- class Subject extends Observable {
496
- constructor() {
497
- super();
498
- this.closed = false;
499
- this.currentObservers = null;
500
- this.observers = [];
501
- this.isStopped = false;
502
- this.hasError = false;
503
- this.thrownError = null;
504
- }
505
- lift(operator) {
506
- const subject = new AnonymousSubject(this, this);
507
- subject.operator = operator;
508
- return subject;
509
- }
510
- _throwIfClosed() {
511
- if (this.closed) {
512
- throw new ObjectUnsubscribedError();
513
- }
514
- }
515
- next(value) {
516
- errorContext(() => {
517
- this._throwIfClosed();
518
- if (!this.isStopped) {
519
- if (!this.currentObservers) {
520
- this.currentObservers = Array.from(this.observers);
521
- }
522
- for (const observer of this.currentObservers) {
523
- observer.next(value);
524
- }
525
- }
526
- });
527
- }
528
- error(err) {
529
- errorContext(() => {
530
- this._throwIfClosed();
531
- if (!this.isStopped) {
532
- this.hasError = this.isStopped = true;
533
- this.thrownError = err;
534
- const { observers } = this;
535
- while (observers.length) {
536
- observers.shift().error(err);
537
- }
538
- }
539
- });
540
- }
541
- complete() {
542
- errorContext(() => {
543
- this._throwIfClosed();
544
- if (!this.isStopped) {
545
- this.isStopped = true;
546
- const { observers } = this;
547
- while (observers.length) {
548
- observers.shift().complete();
549
- }
550
- }
551
- });
552
- }
553
- unsubscribe() {
554
- this.isStopped = this.closed = true;
555
- this.observers = this.currentObservers = null;
556
- }
557
- get observed() {
558
- var _a;
559
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
560
- }
561
- _trySubscribe(subscriber) {
562
- this._throwIfClosed();
563
- return super._trySubscribe(subscriber);
564
- }
565
- _subscribe(subscriber) {
566
- this._throwIfClosed();
567
- this._checkFinalizedStatuses(subscriber);
568
- return this._innerSubscribe(subscriber);
569
- }
570
- _innerSubscribe(subscriber) {
571
- const { hasError, isStopped, observers } = this;
572
- if (hasError || isStopped) {
573
- return EMPTY_SUBSCRIPTION;
574
- }
575
- this.currentObservers = null;
576
- observers.push(subscriber);
577
- return new Subscription(() => {
578
- this.currentObservers = null;
579
- arrRemove(observers, subscriber);
580
- });
581
- }
582
- _checkFinalizedStatuses(subscriber) {
583
- const { hasError, thrownError, isStopped } = this;
584
- if (hasError) {
585
- subscriber.error(thrownError);
586
- }
587
- else if (isStopped) {
588
- subscriber.complete();
589
- }
590
- }
591
- asObservable() {
592
- const observable = new Observable();
593
- observable.source = this;
594
- return observable;
595
- }
596
- }
597
- Subject.create = (destination, source) => {
598
- return new AnonymousSubject(destination, source);
599
- };
600
- class AnonymousSubject extends Subject {
601
- constructor(destination, source) {
602
- super();
603
- this.destination = destination;
604
- this.source = source;
605
- }
606
- next(value) {
607
- var _a, _b;
608
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
609
- }
610
- error(err) {
611
- var _a, _b;
612
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
613
- }
614
- complete() {
615
- var _a, _b;
616
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
617
- }
618
- _subscribe(subscriber) {
619
- var _a, _b;
620
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
621
- }
622
- }
623
-
624
- class BehaviorSubject extends Subject {
625
- constructor(_value) {
626
- super();
627
- this._value = _value;
628
- }
629
- get value() {
630
- return this.getValue();
631
- }
632
- _subscribe(subscriber) {
633
- const subscription = super._subscribe(subscriber);
634
- !subscription.closed && subscriber.next(this._value);
635
- return subscription;
636
- }
637
- getValue() {
638
- const { hasError, thrownError, _value } = this;
639
- if (hasError) {
640
- throw thrownError;
641
- }
642
- this._throwIfClosed();
643
- return _value;
644
- }
645
- next(value) {
646
- super.next((this._value = value));
647
- }
648
- }
649
-
650
- class FormController {
651
- constructor(schema) {
652
- this.values = new BehaviorSubject({});
653
- this.errors = new BehaviorSubject({});
654
- this._initialValues = {};
655
- this._values = {};
656
- this._errors = {};
657
- this._isValid = true;
658
- this._schema = schema;
659
- }
660
- processArrayError(obj, property, remainingProperties, message) {
661
- // Extract array name and index from the property string
662
- const [arrayName, indexStr] = property
663
- .match(/^([a-zA-Z0-9]+)\[(\d+)\]/)
664
- .slice(1);
665
- const index = parseInt(indexStr, 10);
666
- // Ensure the array exists and has an entry at the given index
667
- obj[arrayName] = obj[arrayName] || [];
668
- obj[arrayName][index] = obj[arrayName][index] || {};
669
- // Recursively set the error if there are remaining properties, else set the error message
670
- if (remainingProperties.length) {
671
- this.setNestedError(obj[arrayName][index], remainingProperties, message);
672
- }
673
- else {
674
- obj[arrayName][index] = message;
675
- }
676
- }
677
- processRegularError(obj, property, remainingProperties, message) {
678
- // Ensure the property exists
679
- obj[property] = obj[property] || {};
680
- // Recursively set the error if there are remaining properties, else set the error message
681
- if (remainingProperties.length) {
682
- this.setNestedError(obj[property], remainingProperties, message);
683
- }
684
- else {
685
- obj[property] = message;
686
- }
687
- }
688
- setNestedError(obj, properties, message) {
689
- const property = properties.shift();
690
- const isArrayError = property.includes('[');
691
- if (isArrayError) {
692
- this.processArrayError(obj, property, properties, message);
693
- }
694
- else {
695
- this.processRegularError(obj, property, properties, message);
696
- }
697
- }
698
- setError(obj, path, message) {
699
- // Convert path to properties array
700
- const properties = Array.isArray(path) ? path : path.split('.');
701
- this.setNestedError(obj, properties, message);
702
- }
703
- async validate(context) {
704
- this._isValid = true;
705
- this._errors = {};
706
- try {
707
- await this._schema.validate(this._values, { context, abortEarly: false });
708
- }
709
- catch (err) {
710
- this._isValid = false;
711
- err.inner.forEach((item) => {
712
- this.setError(this._errors, item.path, item.message);
713
- });
714
- }
715
- this.errors.next(this._errors);
716
- return this._isValid;
717
- }
718
- async validateAndSubmit(submitHandler, context) {
719
- const isValid = await this.validate(context || {});
720
- if (isValid) {
721
- submitHandler(this._values);
722
- }
723
- }
724
- setInitialValues(values) {
725
- this._initialValues = values;
726
- this._values = values;
727
- this.values.next(this._values);
728
- }
729
- setValues(values) {
730
- this._values = Object.assign(Object.assign({}, this._values), values);
731
- this.values.next(this._values);
732
- }
733
- resetValues() {
734
- this._values = this._initialValues;
735
- this.values.next(this._values);
736
- }
737
- getInitialValues() {
738
- return this._initialValues;
739
- }
740
- }
741
-
742
- /**
743
- * Based on Kendo UI Core expression code <https://github.com/telerik/kendo-ui-core#license-information>
744
- */
745
-
746
- function Cache(maxSize) {
747
- this._maxSize = maxSize;
748
- this.clear();
749
- }
750
- Cache.prototype.clear = function () {
751
- this._size = 0;
752
- this._values = Object.create(null);
753
- };
754
- Cache.prototype.get = function (key) {
755
- return this._values[key]
756
- };
757
- Cache.prototype.set = function (key, value) {
758
- this._size >= this._maxSize && this.clear();
759
- if (!(key in this._values)) this._size++;
760
-
761
- return (this._values[key] = value)
762
- };
763
-
764
- var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g,
765
- DIGIT_REGEX = /^\d+$/,
766
- LEAD_DIGIT_REGEX = /^\d/,
767
- SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,
768
- CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/,
769
- MAX_CACHE_SIZE = 512;
770
-
771
- var pathCache = new Cache(MAX_CACHE_SIZE),
772
- setCache = new Cache(MAX_CACHE_SIZE),
773
- getCache = new Cache(MAX_CACHE_SIZE);
774
-
775
- var propertyExpr = {
776
- Cache: Cache,
777
-
778
- split: split,
779
-
780
- normalizePath: normalizePath,
781
-
782
- setter: function (path) {
783
- var parts = normalizePath(path);
784
-
785
- return (
786
- setCache.get(path) ||
787
- setCache.set(path, function setter(obj, value) {
788
- var index = 0;
789
- var len = parts.length;
790
- var data = obj;
791
-
792
- while (index < len - 1) {
793
- var part = parts[index];
794
- if (
795
- part === '__proto__' ||
796
- part === 'constructor' ||
797
- part === 'prototype'
798
- ) {
799
- return obj
800
- }
801
-
802
- data = data[parts[index++]];
803
- }
804
- data[parts[index]] = value;
805
- })
806
- )
807
- },
808
-
809
- getter: function (path, safe) {
810
- var parts = normalizePath(path);
811
- return (
812
- getCache.get(path) ||
813
- getCache.set(path, function getter(data) {
814
- var index = 0,
815
- len = parts.length;
816
- while (index < len) {
817
- if (data != null || !safe) data = data[parts[index++]];
818
- else return
819
- }
820
- return data
821
- })
822
- )
823
- },
824
-
825
- join: function (segments) {
826
- return segments.reduce(function (path, part) {
827
- return (
828
- path +
829
- (isQuoted(part) || DIGIT_REGEX.test(part)
830
- ? '[' + part + ']'
831
- : (path ? '.' : '') + part)
832
- )
833
- }, '')
834
- },
835
-
836
- forEach: function (path, cb, thisArg) {
837
- forEach(Array.isArray(path) ? path : split(path), cb, thisArg);
838
- },
839
- };
840
-
841
- function normalizePath(path) {
842
- return (
843
- pathCache.get(path) ||
844
- pathCache.set(
845
- path,
846
- split(path).map(function (part) {
847
- return part.replace(CLEAN_QUOTES_REGEX, '$2')
848
- })
849
- )
850
- )
851
- }
852
-
853
- function split(path) {
854
- return path.match(SPLIT_REGEX) || ['']
855
- }
856
-
857
- function forEach(parts, iter, thisArg) {
858
- var len = parts.length,
859
- part,
860
- idx,
861
- isArray,
862
- isBracket;
863
-
864
- for (idx = 0; idx < len; idx++) {
865
- part = parts[idx];
866
-
867
- if (part) {
868
- if (shouldBeQuoted(part)) {
869
- part = '"' + part + '"';
870
- }
871
-
872
- isBracket = isQuoted(part);
873
- isArray = !isBracket && /^\d+$/.test(part);
874
-
875
- iter.call(thisArg, part, isBracket, isArray, idx, parts);
876
- }
877
- }
878
- }
879
-
880
- function isQuoted(str) {
881
- return (
882
- typeof str === 'string' && str && ["'", '"'].indexOf(str.charAt(0)) !== -1
883
- )
884
- }
885
-
886
- function hasLeadingNumber(part) {
887
- return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX)
888
- }
889
-
890
- function hasSpecialChars(part) {
891
- return SPEC_CHAR_REGEX.test(part)
892
- }
893
-
894
- function shouldBeQuoted(part) {
895
- return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part))
896
- }
897
-
898
- const reWords = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g;
899
-
900
- const words = (str) => str.match(reWords) || [];
901
-
902
- const upperFirst = (str) => str[0].toUpperCase() + str.slice(1);
903
-
904
- const join = (str, d) => words(str).join(d).toLowerCase();
905
-
906
- const camelCase = (str) =>
907
- words(str).reduce(
908
- (acc, next) =>
909
- `${acc}${
910
- !acc
911
- ? next.toLowerCase()
912
- : next[0].toUpperCase() + next.slice(1).toLowerCase()
913
- }`,
914
- '',
915
- );
916
-
917
- const pascalCase = (str) => upperFirst(camelCase(str));
918
-
919
- const snakeCase = (str) => join(str, '_');
920
-
921
- const kebabCase = (str) => join(str, '-');
922
-
923
- const sentenceCase = (str) => upperFirst(join(str, ' '));
924
-
925
- const titleCase = (str) => words(str).map(upperFirst).join(' ');
926
-
927
- var tinyCase = {
928
- words,
929
- upperFirst,
930
- camelCase,
931
- pascalCase,
932
- snakeCase,
933
- kebabCase,
934
- sentenceCase,
935
- titleCase,
936
- };
937
-
938
- var toposort$2 = {exports: {}};
939
-
940
- /**
941
- * Topological sorting function
942
- *
943
- * @param {Array} edges
944
- * @returns {Array}
945
- */
946
-
947
- toposort$2.exports = function(edges) {
948
- return toposort(uniqueNodes(edges), edges)
949
- };
950
-
951
- toposort$2.exports.array = toposort;
952
-
953
- function toposort(nodes, edges) {
954
- var cursor = nodes.length
955
- , sorted = new Array(cursor)
956
- , visited = {}
957
- , i = cursor
958
- // Better data structures make algorithm much faster.
959
- , outgoingEdges = makeOutgoingEdges(edges)
960
- , nodesHash = makeNodesHash(nodes);
961
-
962
- // check for unknown nodes
963
- edges.forEach(function(edge) {
964
- if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
965
- throw new Error('Unknown node. There is an unknown node in the supplied edges.')
966
- }
967
- });
968
-
969
- while (i--) {
970
- if (!visited[i]) visit(nodes[i], i, new Set());
971
- }
972
-
973
- return sorted
974
-
975
- function visit(node, i, predecessors) {
976
- if(predecessors.has(node)) {
977
- var nodeRep;
978
- try {
979
- nodeRep = ", node was:" + JSON.stringify(node);
980
- } catch(e) {
981
- nodeRep = "";
982
- }
983
- throw new Error('Cyclic dependency' + nodeRep)
984
- }
985
-
986
- if (!nodesHash.has(node)) {
987
- throw new Error('Found unknown node. Make sure to provided all involved nodes. Unknown node: '+JSON.stringify(node))
988
- }
989
-
990
- if (visited[i]) return;
991
- visited[i] = true;
992
-
993
- var outgoing = outgoingEdges.get(node) || new Set();
994
- outgoing = Array.from(outgoing);
995
-
996
- if (i = outgoing.length) {
997
- predecessors.add(node);
998
- do {
999
- var child = outgoing[--i];
1000
- visit(child, nodesHash.get(child), predecessors);
1001
- } while (i)
1002
- predecessors.delete(node);
1003
- }
1004
-
1005
- sorted[--cursor] = node;
1006
- }
1007
- }
1008
-
1009
- function uniqueNodes(arr){
1010
- var res = new Set();
1011
- for (var i = 0, len = arr.length; i < len; i++) {
1012
- var edge = arr[i];
1013
- res.add(edge[0]);
1014
- res.add(edge[1]);
1015
- }
1016
- return Array.from(res)
1017
- }
1018
-
1019
- function makeOutgoingEdges(arr){
1020
- var edges = new Map();
1021
- for (var i = 0, len = arr.length; i < len; i++) {
1022
- var edge = arr[i];
1023
- if (!edges.has(edge[0])) edges.set(edge[0], new Set());
1024
- if (!edges.has(edge[1])) edges.set(edge[1], new Set());
1025
- edges.get(edge[0]).add(edge[1]);
1026
- }
1027
- return edges
1028
- }
1029
-
1030
- function makeNodesHash(arr){
1031
- var res = new Map();
1032
- for (var i = 0, len = arr.length; i < len; i++) {
1033
- res.set(arr[i], i);
1034
- }
1035
- return res
1036
- }
1037
-
1038
- const toposort$1 = toposort$2.exports;
1039
-
1040
- const toString = Object.prototype.toString;
1041
- const errorToString = Error.prototype.toString;
1042
- const regExpToString = RegExp.prototype.toString;
1043
- const symbolToString = typeof Symbol !== 'undefined' ? Symbol.prototype.toString : () => '';
1044
- const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
1045
- function printNumber(val) {
1046
- if (val != +val) return 'NaN';
1047
- const isNegativeZero = val === 0 && 1 / val < 0;
1048
- return isNegativeZero ? '-0' : '' + val;
1049
- }
1050
- function printSimpleValue(val, quoteStrings = false) {
1051
- if (val == null || val === true || val === false) return '' + val;
1052
- const typeOf = typeof val;
1053
- if (typeOf === 'number') return printNumber(val);
1054
- if (typeOf === 'string') return quoteStrings ? `"${val}"` : val;
1055
- if (typeOf === 'function') return '[Function ' + (val.name || 'anonymous') + ']';
1056
- if (typeOf === 'symbol') return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
1057
- const tag = toString.call(val).slice(8, -1);
1058
- if (tag === 'Date') return isNaN(val.getTime()) ? '' + val : val.toISOString(val);
1059
- if (tag === 'Error' || val instanceof Error) return '[' + errorToString.call(val) + ']';
1060
- if (tag === 'RegExp') return regExpToString.call(val);
1061
- return null;
1062
- }
1063
- function printValue(value, quoteStrings) {
1064
- let result = printSimpleValue(value, quoteStrings);
1065
- if (result !== null) return result;
1066
- return JSON.stringify(value, function (key, value) {
1067
- let result = printSimpleValue(this[key], quoteStrings);
1068
- if (result !== null) return result;
1069
- return value;
1070
- }, 2);
1071
- }
1072
-
1073
- function toArray(value) {
1074
- return value == null ? [] : [].concat(value);
1075
- }
1076
-
1077
- let _Symbol$toStringTag, _Symbol$hasInstance, _Symbol$toStringTag2;
1078
- let strReg = /\$\{\s*(\w+)\s*\}/g;
1079
- _Symbol$toStringTag = Symbol.toStringTag;
1080
- class ValidationErrorNoStack {
1081
- constructor(errorOrErrors, value, field, type) {
1082
- this.name = void 0;
1083
- this.message = void 0;
1084
- this.value = void 0;
1085
- this.path = void 0;
1086
- this.type = void 0;
1087
- this.params = void 0;
1088
- this.errors = void 0;
1089
- this.inner = void 0;
1090
- this[_Symbol$toStringTag] = 'Error';
1091
- this.name = 'ValidationError';
1092
- this.value = value;
1093
- this.path = field;
1094
- this.type = type;
1095
- this.errors = [];
1096
- this.inner = [];
1097
- toArray(errorOrErrors).forEach(err => {
1098
- if (ValidationError.isError(err)) {
1099
- this.errors.push(...err.errors);
1100
- const innerErrors = err.inner.length ? err.inner : [err];
1101
- this.inner.push(...innerErrors);
1102
- } else {
1103
- this.errors.push(err);
1104
- }
1105
- });
1106
- this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
1107
- }
1108
- }
1109
- _Symbol$hasInstance = Symbol.hasInstance;
1110
- _Symbol$toStringTag2 = Symbol.toStringTag;
1111
- class ValidationError extends Error {
1112
- static formatError(message, params) {
1113
- const path = params.label || params.path || 'this';
1114
- if (path !== params.path) params = Object.assign({}, params, {
1115
- path
1116
- });
1117
- if (typeof message === 'string') return message.replace(strReg, (_, key) => printValue(params[key]));
1118
- if (typeof message === 'function') return message(params);
1119
- return message;
1120
- }
1121
- static isError(err) {
1122
- return err && err.name === 'ValidationError';
1123
- }
1124
- constructor(errorOrErrors, value, field, type, disableStack) {
1125
- const errorNoStack = new ValidationErrorNoStack(errorOrErrors, value, field, type);
1126
- if (disableStack) {
1127
- return errorNoStack;
1128
- }
1129
- super();
1130
- this.value = void 0;
1131
- this.path = void 0;
1132
- this.type = void 0;
1133
- this.params = void 0;
1134
- this.errors = [];
1135
- this.inner = [];
1136
- this[_Symbol$toStringTag2] = 'Error';
1137
- this.name = errorNoStack.name;
1138
- this.message = errorNoStack.message;
1139
- this.type = errorNoStack.type;
1140
- this.value = errorNoStack.value;
1141
- this.path = errorNoStack.path;
1142
- this.errors = errorNoStack.errors;
1143
- this.inner = errorNoStack.inner;
1144
- if (Error.captureStackTrace) {
1145
- Error.captureStackTrace(this, ValidationError);
1146
- }
1147
- }
1148
- static [_Symbol$hasInstance](inst) {
1149
- return ValidationErrorNoStack[Symbol.hasInstance](inst) || super[Symbol.hasInstance](inst);
1150
- }
1151
- }
1152
-
1153
- let mixed = {
1154
- default: '${path} is invalid',
1155
- required: '${path} is a required field',
1156
- defined: '${path} must be defined',
1157
- notNull: '${path} cannot be null',
1158
- oneOf: '${path} must be one of the following values: ${values}',
1159
- notOneOf: '${path} must not be one of the following values: ${values}',
1160
- notType: ({
1161
- path,
1162
- type,
1163
- value,
1164
- originalValue
1165
- }) => {
1166
- const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : '.';
1167
- return type !== 'mixed' ? `${path} must be a \`${type}\` type, ` + `but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path} must match the configured type. ` + `The validated value was: \`${printValue(value, true)}\`` + castMsg;
1168
- }
1169
- };
1170
- let string = {
1171
- length: '${path} must be exactly ${length} characters',
1172
- min: '${path} must be at least ${min} characters',
1173
- max: '${path} must be at most ${max} characters',
1174
- matches: '${path} must match the following: "${regex}"',
1175
- email: '${path} must be a valid email',
1176
- url: '${path} must be a valid URL',
1177
- uuid: '${path} must be a valid UUID',
1178
- datetime: '${path} must be a valid ISO date-time',
1179
- datetime_precision: '${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits',
1180
- datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
1181
- trim: '${path} must be a trimmed string',
1182
- lowercase: '${path} must be a lowercase string',
1183
- uppercase: '${path} must be a upper case string'
1184
- };
1185
- let number = {
1186
- min: '${path} must be greater than or equal to ${min}',
1187
- max: '${path} must be less than or equal to ${max}',
1188
- lessThan: '${path} must be less than ${less}',
1189
- moreThan: '${path} must be greater than ${more}',
1190
- positive: '${path} must be a positive number',
1191
- negative: '${path} must be a negative number',
1192
- integer: '${path} must be an integer'
1193
- };
1194
- let date = {
1195
- min: '${path} field must be later than ${min}',
1196
- max: '${path} field must be at earlier than ${max}'
1197
- };
1198
- let boolean = {
1199
- isValue: '${path} field must be ${value}'
1200
- };
1201
- let object = {
1202
- noUnknown: '${path} field has unspecified keys: ${unknown}'
1203
- };
1204
- let array = {
1205
- min: '${path} field must have at least ${min} items',
1206
- max: '${path} field must have less than or equal to ${max} items',
1207
- length: '${path} must have ${length} items'
1208
- };
1209
- let tuple = {
1210
- notType: params => {
1211
- const {
1212
- path,
1213
- value,
1214
- spec
1215
- } = params;
1216
- const typeLen = spec.types.length;
1217
- if (Array.isArray(value)) {
1218
- if (value.length < typeLen) return `${path} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
1219
- if (value.length > typeLen) return `${path} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
1220
- }
1221
- return ValidationError.formatError(mixed.notType, params);
1222
- }
1223
- };
1224
- Object.assign(Object.create(null), {
1225
- mixed,
1226
- string,
1227
- number,
1228
- date,
1229
- object,
1230
- array,
1231
- boolean,
1232
- tuple
1233
- });
1234
-
1235
- const isSchema = obj => obj && obj.__isYupSchema__;
1236
-
1237
- class Condition {
1238
- static fromOptions(refs, config) {
1239
- if (!config.then && !config.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
1240
- let {
1241
- is,
1242
- then,
1243
- otherwise
1244
- } = config;
1245
- let check = typeof is === 'function' ? is : (...values) => values.every(value => value === is);
1246
- return new Condition(refs, (values, schema) => {
1247
- var _branch;
1248
- let branch = check(...values) ? then : otherwise;
1249
- return (_branch = branch == null ? void 0 : branch(schema)) != null ? _branch : schema;
1250
- });
1251
- }
1252
- constructor(refs, builder) {
1253
- this.fn = void 0;
1254
- this.refs = refs;
1255
- this.refs = refs;
1256
- this.fn = builder;
1257
- }
1258
- resolve(base, options) {
1259
- let values = this.refs.map(ref =>
1260
- // TODO: ? operator here?
1261
- ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
1262
- let schema = this.fn(values, base, options);
1263
- if (schema === undefined ||
1264
- // @ts-ignore this can be base
1265
- schema === base) {
1266
- return base;
1267
- }
1268
- if (!isSchema(schema)) throw new TypeError('conditions must return a schema object');
1269
- return schema.resolve(options);
1270
- }
1271
- }
1272
-
1273
- const prefixes = {
1274
- context: '$',
1275
- value: '.'
1276
- };
1277
- class Reference {
1278
- constructor(key, options = {}) {
1279
- this.key = void 0;
1280
- this.isContext = void 0;
1281
- this.isValue = void 0;
1282
- this.isSibling = void 0;
1283
- this.path = void 0;
1284
- this.getter = void 0;
1285
- this.map = void 0;
1286
- if (typeof key !== 'string') throw new TypeError('ref must be a string, got: ' + key);
1287
- this.key = key.trim();
1288
- if (key === '') throw new TypeError('ref must be a non-empty string');
1289
- this.isContext = this.key[0] === prefixes.context;
1290
- this.isValue = this.key[0] === prefixes.value;
1291
- this.isSibling = !this.isContext && !this.isValue;
1292
- let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : '';
1293
- this.path = this.key.slice(prefix.length);
1294
- this.getter = this.path && propertyExpr.getter(this.path, true);
1295
- this.map = options.map;
1296
- }
1297
- getValue(value, parent, context) {
1298
- let result = this.isContext ? context : this.isValue ? value : parent;
1299
- if (this.getter) result = this.getter(result || {});
1300
- if (this.map) result = this.map(result);
1301
- return result;
1302
- }
1303
-
1304
- /**
1305
- *
1306
- * @param {*} value
1307
- * @param {Object} options
1308
- * @param {Object=} options.context
1309
- * @param {Object=} options.parent
1310
- */
1311
- cast(value, options) {
1312
- return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
1313
- }
1314
- resolve() {
1315
- return this;
1316
- }
1317
- describe() {
1318
- return {
1319
- type: 'ref',
1320
- key: this.key
1321
- };
1322
- }
1323
- toString() {
1324
- return `Ref(${this.key})`;
1325
- }
1326
- static isRef(value) {
1327
- return value && value.__isYupRef;
1328
- }
1329
- }
1330
-
1331
- // @ts-ignore
1332
- Reference.prototype.__isYupRef = true;
1333
-
1334
- const isAbsent = value => value == null;
1335
-
1336
- function createValidation(config) {
1337
- function validate({
1338
- value,
1339
- path = '',
1340
- options,
1341
- originalValue,
1342
- schema
1343
- }, panic, next) {
1344
- const {
1345
- name,
1346
- test,
1347
- params,
1348
- message,
1349
- skipAbsent
1350
- } = config;
1351
- let {
1352
- parent,
1353
- context,
1354
- abortEarly = schema.spec.abortEarly,
1355
- disableStackTrace = schema.spec.disableStackTrace
1356
- } = options;
1357
- function resolve(item) {
1358
- return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
1359
- }
1360
- function createError(overrides = {}) {
1361
- const nextParams = Object.assign({
1362
- value,
1363
- originalValue,
1364
- label: schema.spec.label,
1365
- path: overrides.path || path,
1366
- spec: schema.spec,
1367
- disableStackTrace: overrides.disableStackTrace || disableStackTrace
1368
- }, params, overrides.params);
1369
- for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
1370
- const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
1371
- error.params = nextParams;
1372
- return error;
1373
- }
1374
- const invalid = abortEarly ? panic : next;
1375
- let ctx = {
1376
- path,
1377
- parent,
1378
- type: name,
1379
- from: options.from,
1380
- createError,
1381
- resolve,
1382
- options,
1383
- originalValue,
1384
- schema
1385
- };
1386
- const handleResult = validOrError => {
1387
- if (ValidationError.isError(validOrError)) invalid(validOrError);else if (!validOrError) invalid(createError());else next(null);
1388
- };
1389
- const handleError = err => {
1390
- if (ValidationError.isError(err)) invalid(err);else panic(err);
1391
- };
1392
- const shouldSkip = skipAbsent && isAbsent(value);
1393
- if (shouldSkip) {
1394
- return handleResult(true);
1395
- }
1396
- let result;
1397
- try {
1398
- var _result;
1399
- result = test.call(ctx, value, ctx);
1400
- if (typeof ((_result = result) == null ? void 0 : _result.then) === 'function') {
1401
- if (options.sync) {
1402
- throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. ` + `This test will finish after the validate call has returned`);
1403
- }
1404
- return Promise.resolve(result).then(handleResult, handleError);
1405
- }
1406
- } catch (err) {
1407
- handleError(err);
1408
- return;
1409
- }
1410
- handleResult(result);
1411
- }
1412
- validate.OPTIONS = config;
1413
- return validate;
1414
- }
1415
-
1416
- function getIn(schema, path, value, context = value) {
1417
- let parent, lastPart, lastPartDebug;
1418
-
1419
- // root path: ''
1420
- if (!path) return {
1421
- parent,
1422
- parentPath: path,
1423
- schema
1424
- };
1425
- propertyExpr.forEach(path, (_part, isBracket, isArray) => {
1426
- let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
1427
- schema = schema.resolve({
1428
- context,
1429
- parent,
1430
- value
1431
- });
1432
- let isTuple = schema.type === 'tuple';
1433
- let idx = isArray ? parseInt(part, 10) : 0;
1434
- if (schema.innerType || isTuple) {
1435
- if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
1436
- if (value && idx >= value.length) {
1437
- throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. ` + `because there is no value at that index. `);
1438
- }
1439
- parent = value;
1440
- value = value && value[idx];
1441
- schema = isTuple ? schema.spec.types[idx] : schema.innerType;
1442
- }
1443
-
1444
- // sometimes the array index part of a path doesn't exist: "nested.arr.child"
1445
- // in these cases the current part is the next schema and should be processed
1446
- // in this iteration. For cases where the index signature is included this
1447
- // check will fail and we'll handle the `child` part on the next iteration like normal
1448
- if (!isArray) {
1449
- if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. ` + `(failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
1450
- parent = value;
1451
- value = value && value[part];
1452
- schema = schema.fields[part];
1453
- }
1454
- lastPart = part;
1455
- lastPartDebug = isBracket ? '[' + _part + ']' : '.' + _part;
1456
- });
1457
- return {
1458
- schema,
1459
- parent,
1460
- parentPath: lastPart
1461
- };
1462
- }
1463
-
1464
- class ReferenceSet extends Set {
1465
- describe() {
1466
- const description = [];
1467
- for (const item of this.values()) {
1468
- description.push(Reference.isRef(item) ? item.describe() : item);
1469
- }
1470
- return description;
1471
- }
1472
- resolveAll(resolve) {
1473
- let result = [];
1474
- for (const item of this.values()) {
1475
- result.push(resolve(item));
1476
- }
1477
- return result;
1478
- }
1479
- clone() {
1480
- return new ReferenceSet(this.values());
1481
- }
1482
- merge(newItems, removeItems) {
1483
- const next = this.clone();
1484
- newItems.forEach(value => next.add(value));
1485
- removeItems.forEach(value => next.delete(value));
1486
- return next;
1487
- }
1488
- }
1489
-
1490
- // tweaked from https://github.com/Kelin2025/nanoclone/blob/0abeb7635bda9b68ef2277093f76dbe3bf3948e1/src/index.js
1491
- function clone(src, seen = new Map()) {
1492
- if (isSchema(src) || !src || typeof src !== 'object') return src;
1493
- if (seen.has(src)) return seen.get(src);
1494
- let copy;
1495
- if (src instanceof Date) {
1496
- // Date
1497
- copy = new Date(src.getTime());
1498
- seen.set(src, copy);
1499
- } else if (src instanceof RegExp) {
1500
- // RegExp
1501
- copy = new RegExp(src);
1502
- seen.set(src, copy);
1503
- } else if (Array.isArray(src)) {
1504
- // Array
1505
- copy = new Array(src.length);
1506
- seen.set(src, copy);
1507
- for (let i = 0; i < src.length; i++) copy[i] = clone(src[i], seen);
1508
- } else if (src instanceof Map) {
1509
- // Map
1510
- copy = new Map();
1511
- seen.set(src, copy);
1512
- for (const [k, v] of src.entries()) copy.set(k, clone(v, seen));
1513
- } else if (src instanceof Set) {
1514
- // Set
1515
- copy = new Set();
1516
- seen.set(src, copy);
1517
- for (const v of src) copy.add(clone(v, seen));
1518
- } else if (src instanceof Object) {
1519
- // Object
1520
- copy = {};
1521
- seen.set(src, copy);
1522
- for (const [k, v] of Object.entries(src)) copy[k] = clone(v, seen);
1523
- } else {
1524
- throw Error(`Unable to clone ${src}`);
1525
- }
1526
- return copy;
1527
- }
1528
-
1529
- // If `CustomSchemaMeta` isn't extended with any keys, we'll fall back to a
1530
- // loose Record definition allowing free form usage.
1531
- class Schema {
1532
- constructor(options) {
1533
- this.type = void 0;
1534
- this.deps = [];
1535
- this.tests = void 0;
1536
- this.transforms = void 0;
1537
- this.conditions = [];
1538
- this._mutate = void 0;
1539
- this.internalTests = {};
1540
- this._whitelist = new ReferenceSet();
1541
- this._blacklist = new ReferenceSet();
1542
- this.exclusiveTests = Object.create(null);
1543
- this._typeCheck = void 0;
1544
- this.spec = void 0;
1545
- this.tests = [];
1546
- this.transforms = [];
1547
- this.withMutation(() => {
1548
- this.typeError(mixed.notType);
1549
- });
1550
- this.type = options.type;
1551
- this._typeCheck = options.check;
1552
- this.spec = Object.assign({
1553
- strip: false,
1554
- strict: false,
1555
- abortEarly: true,
1556
- recursive: true,
1557
- disableStackTrace: false,
1558
- nullable: false,
1559
- optional: true,
1560
- coerce: true
1561
- }, options == null ? void 0 : options.spec);
1562
- this.withMutation(s => {
1563
- s.nonNullable();
1564
- });
1565
- }
1566
-
1567
- // TODO: remove
1568
- get _type() {
1569
- return this.type;
1570
- }
1571
- clone(spec) {
1572
- if (this._mutate) {
1573
- if (spec) Object.assign(this.spec, spec);
1574
- return this;
1575
- }
1576
-
1577
- // if the nested value is a schema we can skip cloning, since
1578
- // they are already immutable
1579
- const next = Object.create(Object.getPrototypeOf(this));
1580
-
1581
- // @ts-expect-error this is readonly
1582
- next.type = this.type;
1583
- next._typeCheck = this._typeCheck;
1584
- next._whitelist = this._whitelist.clone();
1585
- next._blacklist = this._blacklist.clone();
1586
- next.internalTests = Object.assign({}, this.internalTests);
1587
- next.exclusiveTests = Object.assign({}, this.exclusiveTests);
1588
-
1589
- // @ts-expect-error this is readonly
1590
- next.deps = [...this.deps];
1591
- next.conditions = [...this.conditions];
1592
- next.tests = [...this.tests];
1593
- next.transforms = [...this.transforms];
1594
- next.spec = clone(Object.assign({}, this.spec, spec));
1595
- return next;
1596
- }
1597
- label(label) {
1598
- let next = this.clone();
1599
- next.spec.label = label;
1600
- return next;
1601
- }
1602
- meta(...args) {
1603
- if (args.length === 0) return this.spec.meta;
1604
- let next = this.clone();
1605
- next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
1606
- return next;
1607
- }
1608
- withMutation(fn) {
1609
- let before = this._mutate;
1610
- this._mutate = true;
1611
- let result = fn(this);
1612
- this._mutate = before;
1613
- return result;
1614
- }
1615
- concat(schema) {
1616
- if (!schema || schema === this) return this;
1617
- if (schema.type !== this.type && this.type !== 'mixed') throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
1618
- let base = this;
1619
- let combined = schema.clone();
1620
- const mergedSpec = Object.assign({}, base.spec, combined.spec);
1621
- combined.spec = mergedSpec;
1622
- combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
1623
-
1624
- // manually merge the blacklist/whitelist (the other `schema` takes
1625
- // precedence in case of conflicts)
1626
- combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
1627
- combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
1628
-
1629
- // start with the current tests
1630
- combined.tests = base.tests;
1631
- combined.exclusiveTests = base.exclusiveTests;
1632
-
1633
- // manually add the new tests to ensure
1634
- // the deduping logic is consistent
1635
- combined.withMutation(next => {
1636
- schema.tests.forEach(fn => {
1637
- next.test(fn.OPTIONS);
1638
- });
1639
- });
1640
- combined.transforms = [...base.transforms, ...combined.transforms];
1641
- return combined;
1642
- }
1643
- isType(v) {
1644
- if (v == null) {
1645
- if (this.spec.nullable && v === null) return true;
1646
- if (this.spec.optional && v === undefined) return true;
1647
- return false;
1648
- }
1649
- return this._typeCheck(v);
1650
- }
1651
- resolve(options) {
1652
- let schema = this;
1653
- if (schema.conditions.length) {
1654
- let conditions = schema.conditions;
1655
- schema = schema.clone();
1656
- schema.conditions = [];
1657
- schema = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema);
1658
- schema = schema.resolve(options);
1659
- }
1660
- return schema;
1661
- }
1662
- resolveOptions(options) {
1663
- var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
1664
- return Object.assign({}, options, {
1665
- from: options.from || [],
1666
- strict: (_options$strict = options.strict) != null ? _options$strict : this.spec.strict,
1667
- abortEarly: (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly,
1668
- recursive: (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive,
1669
- disableStackTrace: (_options$disableStack = options.disableStackTrace) != null ? _options$disableStack : this.spec.disableStackTrace
1670
- });
1671
- }
1672
-
1673
- /**
1674
- * Run the configured transform pipeline over an input value.
1675
- */
1676
-
1677
- cast(value, options = {}) {
1678
- let resolvedSchema = this.resolve(Object.assign({
1679
- value
1680
- }, options));
1681
- let allowOptionality = options.assert === 'ignore-optionality';
1682
- let result = resolvedSchema._cast(value, options);
1683
- if (options.assert !== false && !resolvedSchema.isType(result)) {
1684
- if (allowOptionality && isAbsent(result)) {
1685
- return result;
1686
- }
1687
- let formattedValue = printValue(value);
1688
- let formattedResult = printValue(result);
1689
- throw new TypeError(`The value of ${options.path || 'field'} could not be cast to a value ` + `that satisfies the schema type: "${resolvedSchema.type}". \n\n` + `attempted value: ${formattedValue} \n` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ''));
1690
- }
1691
- return result;
1692
- }
1693
- _cast(rawValue, options) {
1694
- let value = rawValue === undefined ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this), rawValue);
1695
- if (value === undefined) {
1696
- value = this.getDefault(options);
1697
- }
1698
- return value;
1699
- }
1700
- _validate(_value, options = {}, panic, next) {
1701
- let {
1702
- path,
1703
- originalValue = _value,
1704
- strict = this.spec.strict
1705
- } = options;
1706
- let value = _value;
1707
- if (!strict) {
1708
- value = this._cast(value, Object.assign({
1709
- assert: false
1710
- }, options));
1711
- }
1712
- let initialTests = [];
1713
- for (let test of Object.values(this.internalTests)) {
1714
- if (test) initialTests.push(test);
1715
- }
1716
- this.runTests({
1717
- path,
1718
- value,
1719
- originalValue,
1720
- options,
1721
- tests: initialTests
1722
- }, panic, initialErrors => {
1723
- // even if we aren't ending early we can't proceed further if the types aren't correct
1724
- if (initialErrors.length) {
1725
- return next(initialErrors, value);
1726
- }
1727
- this.runTests({
1728
- path,
1729
- value,
1730
- originalValue,
1731
- options,
1732
- tests: this.tests
1733
- }, panic, next);
1734
- });
1735
- }
1736
-
1737
- /**
1738
- * Executes a set of validations, either schema, produced Tests or a nested
1739
- * schema validate result.
1740
- */
1741
- runTests(runOptions, panic, next) {
1742
- let fired = false;
1743
- let {
1744
- tests,
1745
- value,
1746
- originalValue,
1747
- path,
1748
- options
1749
- } = runOptions;
1750
- let panicOnce = arg => {
1751
- if (fired) return;
1752
- fired = true;
1753
- panic(arg, value);
1754
- };
1755
- let nextOnce = arg => {
1756
- if (fired) return;
1757
- fired = true;
1758
- next(arg, value);
1759
- };
1760
- let count = tests.length;
1761
- let nestedErrors = [];
1762
- if (!count) return nextOnce([]);
1763
- let args = {
1764
- value,
1765
- originalValue,
1766
- path,
1767
- options,
1768
- schema: this
1769
- };
1770
- for (let i = 0; i < tests.length; i++) {
1771
- const test = tests[i];
1772
- test(args, panicOnce, function finishTestRun(err) {
1773
- if (err) {
1774
- Array.isArray(err) ? nestedErrors.push(...err) : nestedErrors.push(err);
1775
- }
1776
- if (--count <= 0) {
1777
- nextOnce(nestedErrors);
1778
- }
1779
- });
1780
- }
1781
- }
1782
- asNestedTest({
1783
- key,
1784
- index,
1785
- parent,
1786
- parentPath,
1787
- originalParent,
1788
- options
1789
- }) {
1790
- const k = key != null ? key : index;
1791
- if (k == null) {
1792
- throw TypeError('Must include `key` or `index` for nested validations');
1793
- }
1794
- const isIndex = typeof k === 'number';
1795
- let value = parent[k];
1796
- const testOptions = Object.assign({}, options, {
1797
- // Nested validations fields are always strict:
1798
- // 1. parent isn't strict so the casting will also have cast inner values
1799
- // 2. parent is strict in which case the nested values weren't cast either
1800
- strict: true,
1801
- parent,
1802
- value,
1803
- originalValue: originalParent[k],
1804
- // FIXME: tests depend on `index` being passed around deeply,
1805
- // we should not let the options.key/index bleed through
1806
- key: undefined,
1807
- // index: undefined,
1808
- [isIndex ? 'index' : 'key']: k,
1809
- path: isIndex || k.includes('.') ? `${parentPath || ''}[${isIndex ? k : `"${k}"`}]` : (parentPath ? `${parentPath}.` : '') + key
1810
- });
1811
- return (_, panic, next) => this.resolve(testOptions)._validate(value, testOptions, panic, next);
1812
- }
1813
- validate(value, options) {
1814
- var _options$disableStack2;
1815
- let schema = this.resolve(Object.assign({}, options, {
1816
- value
1817
- }));
1818
- let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;
1819
- return new Promise((resolve, reject) => schema._validate(value, options, (error, parsed) => {
1820
- if (ValidationError.isError(error)) error.value = parsed;
1821
- reject(error);
1822
- }, (errors, validated) => {
1823
- if (errors.length) reject(new ValidationError(errors, validated, undefined, undefined, disableStackTrace));else resolve(validated);
1824
- }));
1825
- }
1826
- validateSync(value, options) {
1827
- var _options$disableStack3;
1828
- let schema = this.resolve(Object.assign({}, options, {
1829
- value
1830
- }));
1831
- let result;
1832
- let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema.spec.disableStackTrace;
1833
- schema._validate(value, Object.assign({}, options, {
1834
- sync: true
1835
- }), (error, parsed) => {
1836
- if (ValidationError.isError(error)) error.value = parsed;
1837
- throw error;
1838
- }, (errors, validated) => {
1839
- if (errors.length) throw new ValidationError(errors, value, undefined, undefined, disableStackTrace);
1840
- result = validated;
1841
- });
1842
- return result;
1843
- }
1844
- isValid(value, options) {
1845
- return this.validate(value, options).then(() => true, err => {
1846
- if (ValidationError.isError(err)) return false;
1847
- throw err;
1848
- });
1849
- }
1850
- isValidSync(value, options) {
1851
- try {
1852
- this.validateSync(value, options);
1853
- return true;
1854
- } catch (err) {
1855
- if (ValidationError.isError(err)) return false;
1856
- throw err;
1857
- }
1858
- }
1859
- _getDefault(options) {
1860
- let defaultValue = this.spec.default;
1861
- if (defaultValue == null) {
1862
- return defaultValue;
1863
- }
1864
- return typeof defaultValue === 'function' ? defaultValue.call(this, options) : clone(defaultValue);
1865
- }
1866
- getDefault(options
1867
- // If schema is defaulted we know it's at least not undefined
1868
- ) {
1869
- let schema = this.resolve(options || {});
1870
- return schema._getDefault(options);
1871
- }
1872
- default(def) {
1873
- if (arguments.length === 0) {
1874
- return this._getDefault();
1875
- }
1876
- let next = this.clone({
1877
- default: def
1878
- });
1879
- return next;
1880
- }
1881
- strict(isStrict = true) {
1882
- return this.clone({
1883
- strict: isStrict
1884
- });
1885
- }
1886
- nullability(nullable, message) {
1887
- const next = this.clone({
1888
- nullable
1889
- });
1890
- next.internalTests.nullable = createValidation({
1891
- message,
1892
- name: 'nullable',
1893
- test(value) {
1894
- return value === null ? this.schema.spec.nullable : true;
1895
- }
1896
- });
1897
- return next;
1898
- }
1899
- optionality(optional, message) {
1900
- const next = this.clone({
1901
- optional
1902
- });
1903
- next.internalTests.optionality = createValidation({
1904
- message,
1905
- name: 'optionality',
1906
- test(value) {
1907
- return value === undefined ? this.schema.spec.optional : true;
1908
- }
1909
- });
1910
- return next;
1911
- }
1912
- optional() {
1913
- return this.optionality(true);
1914
- }
1915
- defined(message = mixed.defined) {
1916
- return this.optionality(false, message);
1917
- }
1918
- nullable() {
1919
- return this.nullability(true);
1920
- }
1921
- nonNullable(message = mixed.notNull) {
1922
- return this.nullability(false, message);
1923
- }
1924
- required(message = mixed.required) {
1925
- return this.clone().withMutation(next => next.nonNullable(message).defined(message));
1926
- }
1927
- notRequired() {
1928
- return this.clone().withMutation(next => next.nullable().optional());
1929
- }
1930
- transform(fn) {
1931
- let next = this.clone();
1932
- next.transforms.push(fn);
1933
- return next;
1934
- }
1935
-
1936
- /**
1937
- * Adds a test function to the schema's queue of tests.
1938
- * tests can be exclusive or non-exclusive.
1939
- *
1940
- * - exclusive tests, will replace any existing tests of the same name.
1941
- * - non-exclusive: can be stacked
1942
- *
1943
- * If a non-exclusive test is added to a schema with an exclusive test of the same name
1944
- * the exclusive test is removed and further tests of the same name will be stacked.
1945
- *
1946
- * If an exclusive test is added to a schema with non-exclusive tests of the same name
1947
- * the previous tests are removed and further tests of the same name will replace each other.
1948
- */
1949
-
1950
- test(...args) {
1951
- let opts;
1952
- if (args.length === 1) {
1953
- if (typeof args[0] === 'function') {
1954
- opts = {
1955
- test: args[0]
1956
- };
1957
- } else {
1958
- opts = args[0];
1959
- }
1960
- } else if (args.length === 2) {
1961
- opts = {
1962
- name: args[0],
1963
- test: args[1]
1964
- };
1965
- } else {
1966
- opts = {
1967
- name: args[0],
1968
- message: args[1],
1969
- test: args[2]
1970
- };
1971
- }
1972
- if (opts.message === undefined) opts.message = mixed.default;
1973
- if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters');
1974
- let next = this.clone();
1975
- let validate = createValidation(opts);
1976
- let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
1977
- if (opts.exclusive) {
1978
- if (!opts.name) throw new TypeError('Exclusive tests must provide a unique `name` identifying the test');
1979
- }
1980
- if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
1981
- next.tests = next.tests.filter(fn => {
1982
- if (fn.OPTIONS.name === opts.name) {
1983
- if (isExclusive) return false;
1984
- if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
1985
- }
1986
- return true;
1987
- });
1988
- next.tests.push(validate);
1989
- return next;
1990
- }
1991
- when(keys, options) {
1992
- if (!Array.isArray(keys) && typeof keys !== 'string') {
1993
- options = keys;
1994
- keys = '.';
1995
- }
1996
- let next = this.clone();
1997
- let deps = toArray(keys).map(key => new Reference(key));
1998
- deps.forEach(dep => {
1999
- // @ts-ignore readonly array
2000
- if (dep.isSibling) next.deps.push(dep.key);
2001
- });
2002
- next.conditions.push(typeof options === 'function' ? new Condition(deps, options) : Condition.fromOptions(deps, options));
2003
- return next;
2004
- }
2005
- typeError(message) {
2006
- let next = this.clone();
2007
- next.internalTests.typeError = createValidation({
2008
- message,
2009
- name: 'typeError',
2010
- skipAbsent: true,
2011
- test(value) {
2012
- if (!this.schema._typeCheck(value)) return this.createError({
2013
- params: {
2014
- type: this.schema.type
2015
- }
2016
- });
2017
- return true;
2018
- }
2019
- });
2020
- return next;
2021
- }
2022
- oneOf(enums, message = mixed.oneOf) {
2023
- let next = this.clone();
2024
- enums.forEach(val => {
2025
- next._whitelist.add(val);
2026
- next._blacklist.delete(val);
2027
- });
2028
- next.internalTests.whiteList = createValidation({
2029
- message,
2030
- name: 'oneOf',
2031
- skipAbsent: true,
2032
- test(value) {
2033
- let valids = this.schema._whitelist;
2034
- let resolved = valids.resolveAll(this.resolve);
2035
- return resolved.includes(value) ? true : this.createError({
2036
- params: {
2037
- values: Array.from(valids).join(', '),
2038
- resolved
2039
- }
2040
- });
2041
- }
2042
- });
2043
- return next;
2044
- }
2045
- notOneOf(enums, message = mixed.notOneOf) {
2046
- let next = this.clone();
2047
- enums.forEach(val => {
2048
- next._blacklist.add(val);
2049
- next._whitelist.delete(val);
2050
- });
2051
- next.internalTests.blacklist = createValidation({
2052
- message,
2053
- name: 'notOneOf',
2054
- test(value) {
2055
- let invalids = this.schema._blacklist;
2056
- let resolved = invalids.resolveAll(this.resolve);
2057
- if (resolved.includes(value)) return this.createError({
2058
- params: {
2059
- values: Array.from(invalids).join(', '),
2060
- resolved
2061
- }
2062
- });
2063
- return true;
2064
- }
2065
- });
2066
- return next;
2067
- }
2068
- strip(strip = true) {
2069
- let next = this.clone();
2070
- next.spec.strip = strip;
2071
- return next;
2072
- }
2073
-
2074
- /**
2075
- * Return a serialized description of the schema including validations, flags, types etc.
2076
- *
2077
- * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
2078
- */
2079
- describe(options) {
2080
- const next = (options ? this.resolve(options) : this).clone();
2081
- const {
2082
- label,
2083
- meta,
2084
- optional,
2085
- nullable
2086
- } = next.spec;
2087
- const description = {
2088
- meta,
2089
- label,
2090
- optional,
2091
- nullable,
2092
- default: next.getDefault(options),
2093
- type: next.type,
2094
- oneOf: next._whitelist.describe(),
2095
- notOneOf: next._blacklist.describe(),
2096
- tests: next.tests.map(fn => ({
2097
- name: fn.OPTIONS.name,
2098
- params: fn.OPTIONS.params
2099
- })).filter((n, idx, list) => list.findIndex(c => c.name === n.name) === idx)
2100
- };
2101
- return description;
2102
- }
2103
- }
2104
- // @ts-expect-error
2105
- Schema.prototype.__isYupSchema__ = true;
2106
- for (const method of ['validate', 'validateSync']) Schema.prototype[`${method}At`] = function (path, value, options = {}) {
2107
- const {
2108
- parent,
2109
- parentPath,
2110
- schema
2111
- } = getIn(this, path, value, options.context);
2112
- return schema[method](parent && parent[parentPath], Object.assign({}, options, {
2113
- parent,
2114
- path
2115
- }));
2116
- };
2117
- for (const alias of ['equals', 'is']) Schema.prototype[alias] = Schema.prototype.oneOf;
2118
- for (const alias of ['not', 'nope']) Schema.prototype[alias] = Schema.prototype.notOneOf;
2119
-
2120
- const returnsTrue = () => true;
2121
- function create$8(spec) {
2122
- return new MixedSchema(spec);
2123
- }
2124
- class MixedSchema extends Schema {
2125
- constructor(spec) {
2126
- super(typeof spec === 'function' ? {
2127
- type: 'mixed',
2128
- check: spec
2129
- } : Object.assign({
2130
- type: 'mixed',
2131
- check: returnsTrue
2132
- }, spec));
2133
- }
2134
- }
2135
- create$8.prototype = MixedSchema.prototype;
2136
-
2137
- function create$7() {
2138
- return new BooleanSchema();
2139
- }
2140
- class BooleanSchema extends Schema {
2141
- constructor() {
2142
- super({
2143
- type: 'boolean',
2144
- check(v) {
2145
- if (v instanceof Boolean) v = v.valueOf();
2146
- return typeof v === 'boolean';
2147
- }
2148
- });
2149
- this.withMutation(() => {
2150
- this.transform((value, _raw, ctx) => {
2151
- if (ctx.spec.coerce && !ctx.isType(value)) {
2152
- if (/^(true|1)$/i.test(String(value))) return true;
2153
- if (/^(false|0)$/i.test(String(value))) return false;
2154
- }
2155
- return value;
2156
- });
2157
- });
2158
- }
2159
- isTrue(message = boolean.isValue) {
2160
- return this.test({
2161
- message,
2162
- name: 'is-value',
2163
- exclusive: true,
2164
- params: {
2165
- value: 'true'
2166
- },
2167
- test(value) {
2168
- return isAbsent(value) || value === true;
2169
- }
2170
- });
2171
- }
2172
- isFalse(message = boolean.isValue) {
2173
- return this.test({
2174
- message,
2175
- name: 'is-value',
2176
- exclusive: true,
2177
- params: {
2178
- value: 'false'
2179
- },
2180
- test(value) {
2181
- return isAbsent(value) || value === false;
2182
- }
2183
- });
2184
- }
2185
- default(def) {
2186
- return super.default(def);
2187
- }
2188
- defined(msg) {
2189
- return super.defined(msg);
2190
- }
2191
- optional() {
2192
- return super.optional();
2193
- }
2194
- required(msg) {
2195
- return super.required(msg);
2196
- }
2197
- notRequired() {
2198
- return super.notRequired();
2199
- }
2200
- nullable() {
2201
- return super.nullable();
2202
- }
2203
- nonNullable(msg) {
2204
- return super.nonNullable(msg);
2205
- }
2206
- strip(v) {
2207
- return super.strip(v);
2208
- }
2209
- }
2210
- create$7.prototype = BooleanSchema.prototype;
2211
-
2212
- /**
2213
- * This file is a modified version of the file from the following repository:
2214
- * Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
2215
- * NON-CONFORMANT EDITION.
2216
- * © 2011 Colin Snover <http://zetafleet.com>
2217
- * Released under MIT license.
2218
- */
2219
-
2220
- // prettier-ignore
2221
- // 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
2222
- const isoReg = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
2223
- function parseIsoDate(date) {
2224
- const struct = parseDateStruct(date);
2225
- if (!struct) return Date.parse ? Date.parse(date) : Number.NaN;
2226
-
2227
- // timestamps without timezone identifiers should be considered local time
2228
- if (struct.z === undefined && struct.plusMinus === undefined) {
2229
- return new Date(struct.year, struct.month, struct.day, struct.hour, struct.minute, struct.second, struct.millisecond).valueOf();
2230
- }
2231
- let totalMinutesOffset = 0;
2232
- if (struct.z !== 'Z' && struct.plusMinus !== undefined) {
2233
- totalMinutesOffset = struct.hourOffset * 60 + struct.minuteOffset;
2234
- if (struct.plusMinus === '+') totalMinutesOffset = 0 - totalMinutesOffset;
2235
- }
2236
- return Date.UTC(struct.year, struct.month, struct.day, struct.hour, struct.minute + totalMinutesOffset, struct.second, struct.millisecond);
2237
- }
2238
- function parseDateStruct(date) {
2239
- var _regexResult$7$length, _regexResult$;
2240
- const regexResult = isoReg.exec(date);
2241
- if (!regexResult) return null;
2242
-
2243
- // use of toNumber() avoids NaN timestamps caused by “undefined”
2244
- // values being passed to Date constructor
2245
- return {
2246
- year: toNumber(regexResult[1]),
2247
- month: toNumber(regexResult[2], 1) - 1,
2248
- day: toNumber(regexResult[3], 1),
2249
- hour: toNumber(regexResult[4]),
2250
- minute: toNumber(regexResult[5]),
2251
- second: toNumber(regexResult[6]),
2252
- millisecond: regexResult[7] ?
2253
- // allow arbitrary sub-second precision beyond milliseconds
2254
- toNumber(regexResult[7].substring(0, 3)) : 0,
2255
- precision: (_regexResult$7$length = (_regexResult$ = regexResult[7]) == null ? void 0 : _regexResult$.length) != null ? _regexResult$7$length : undefined,
2256
- z: regexResult[8] || undefined,
2257
- plusMinus: regexResult[9] || undefined,
2258
- hourOffset: toNumber(regexResult[10]),
2259
- minuteOffset: toNumber(regexResult[11])
2260
- };
2261
- }
2262
- function toNumber(str, defaultValue = 0) {
2263
- return Number(str) || defaultValue;
2264
- }
2265
-
2266
- // Taken from HTML spec: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
2267
- let rEmail =
2268
- // eslint-disable-next-line
2269
- /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
2270
- let rUrl =
2271
- // eslint-disable-next-line
2272
- /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
2273
-
2274
- // eslint-disable-next-line
2275
- let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
2276
- let yearMonthDay = '^\\d{4}-\\d{2}-\\d{2}';
2277
- let hourMinuteSecond = '\\d{2}:\\d{2}:\\d{2}';
2278
- let zOrOffset = '(([+-]\\d{2}(:?\\d{2})?)|Z)';
2279
- let rIsoDateTime = new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`);
2280
- let isTrimmed = value => isAbsent(value) || value === value.trim();
2281
- let objStringTag = {}.toString();
2282
- function create$6() {
2283
- return new StringSchema();
2284
- }
2285
- class StringSchema extends Schema {
2286
- constructor() {
2287
- super({
2288
- type: 'string',
2289
- check(value) {
2290
- if (value instanceof String) value = value.valueOf();
2291
- return typeof value === 'string';
2292
- }
2293
- });
2294
- this.withMutation(() => {
2295
- this.transform((value, _raw, ctx) => {
2296
- if (!ctx.spec.coerce || ctx.isType(value)) return value;
2297
-
2298
- // don't ever convert arrays
2299
- if (Array.isArray(value)) return value;
2300
- const strValue = value != null && value.toString ? value.toString() : value;
2301
-
2302
- // no one wants plain objects converted to [Object object]
2303
- if (strValue === objStringTag) return value;
2304
- return strValue;
2305
- });
2306
- });
2307
- }
2308
- required(message) {
2309
- return super.required(message).withMutation(schema => schema.test({
2310
- message: message || mixed.required,
2311
- name: 'required',
2312
- skipAbsent: true,
2313
- test: value => !!value.length
2314
- }));
2315
- }
2316
- notRequired() {
2317
- return super.notRequired().withMutation(schema => {
2318
- schema.tests = schema.tests.filter(t => t.OPTIONS.name !== 'required');
2319
- return schema;
2320
- });
2321
- }
2322
- length(length, message = string.length) {
2323
- return this.test({
2324
- message,
2325
- name: 'length',
2326
- exclusive: true,
2327
- params: {
2328
- length
2329
- },
2330
- skipAbsent: true,
2331
- test(value) {
2332
- return value.length === this.resolve(length);
2333
- }
2334
- });
2335
- }
2336
- min(min, message = string.min) {
2337
- return this.test({
2338
- message,
2339
- name: 'min',
2340
- exclusive: true,
2341
- params: {
2342
- min
2343
- },
2344
- skipAbsent: true,
2345
- test(value) {
2346
- return value.length >= this.resolve(min);
2347
- }
2348
- });
2349
- }
2350
- max(max, message = string.max) {
2351
- return this.test({
2352
- name: 'max',
2353
- exclusive: true,
2354
- message,
2355
- params: {
2356
- max
2357
- },
2358
- skipAbsent: true,
2359
- test(value) {
2360
- return value.length <= this.resolve(max);
2361
- }
2362
- });
2363
- }
2364
- matches(regex, options) {
2365
- let excludeEmptyString = false;
2366
- let message;
2367
- let name;
2368
- if (options) {
2369
- if (typeof options === 'object') {
2370
- ({
2371
- excludeEmptyString = false,
2372
- message,
2373
- name
2374
- } = options);
2375
- } else {
2376
- message = options;
2377
- }
2378
- }
2379
- return this.test({
2380
- name: name || 'matches',
2381
- message: message || string.matches,
2382
- params: {
2383
- regex
2384
- },
2385
- skipAbsent: true,
2386
- test: value => value === '' && excludeEmptyString || value.search(regex) !== -1
2387
- });
2388
- }
2389
- email(message = string.email) {
2390
- return this.matches(rEmail, {
2391
- name: 'email',
2392
- message,
2393
- excludeEmptyString: true
2394
- });
2395
- }
2396
- url(message = string.url) {
2397
- return this.matches(rUrl, {
2398
- name: 'url',
2399
- message,
2400
- excludeEmptyString: true
2401
- });
2402
- }
2403
- uuid(message = string.uuid) {
2404
- return this.matches(rUUID, {
2405
- name: 'uuid',
2406
- message,
2407
- excludeEmptyString: false
2408
- });
2409
- }
2410
- datetime(options) {
2411
- let message = '';
2412
- let allowOffset;
2413
- let precision;
2414
- if (options) {
2415
- if (typeof options === 'object') {
2416
- ({
2417
- message = '',
2418
- allowOffset = false,
2419
- precision = undefined
2420
- } = options);
2421
- } else {
2422
- message = options;
2423
- }
2424
- }
2425
- return this.matches(rIsoDateTime, {
2426
- name: 'datetime',
2427
- message: message || string.datetime,
2428
- excludeEmptyString: true
2429
- }).test({
2430
- name: 'datetime_offset',
2431
- message: message || string.datetime_offset,
2432
- params: {
2433
- allowOffset
2434
- },
2435
- skipAbsent: true,
2436
- test: value => {
2437
- if (!value || allowOffset) return true;
2438
- const struct = parseDateStruct(value);
2439
- if (!struct) return false;
2440
- return !!struct.z;
2441
- }
2442
- }).test({
2443
- name: 'datetime_precision',
2444
- message: message || string.datetime_precision,
2445
- params: {
2446
- precision
2447
- },
2448
- skipAbsent: true,
2449
- test: value => {
2450
- if (!value || precision == undefined) return true;
2451
- const struct = parseDateStruct(value);
2452
- if (!struct) return false;
2453
- return struct.precision === precision;
2454
- }
2455
- });
2456
- }
2457
-
2458
- //-- transforms --
2459
- ensure() {
2460
- return this.default('').transform(val => val === null ? '' : val);
2461
- }
2462
- trim(message = string.trim) {
2463
- return this.transform(val => val != null ? val.trim() : val).test({
2464
- message,
2465
- name: 'trim',
2466
- test: isTrimmed
2467
- });
2468
- }
2469
- lowercase(message = string.lowercase) {
2470
- return this.transform(value => !isAbsent(value) ? value.toLowerCase() : value).test({
2471
- message,
2472
- name: 'string_case',
2473
- exclusive: true,
2474
- skipAbsent: true,
2475
- test: value => isAbsent(value) || value === value.toLowerCase()
2476
- });
2477
- }
2478
- uppercase(message = string.uppercase) {
2479
- return this.transform(value => !isAbsent(value) ? value.toUpperCase() : value).test({
2480
- message,
2481
- name: 'string_case',
2482
- exclusive: true,
2483
- skipAbsent: true,
2484
- test: value => isAbsent(value) || value === value.toUpperCase()
2485
- });
2486
- }
2487
- }
2488
- create$6.prototype = StringSchema.prototype;
2489
-
2490
- //
2491
- // Number Interfaces
2492
- //
2493
-
2494
- let invalidDate = new Date('');
2495
- let isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';
2496
- class DateSchema extends Schema {
2497
- constructor() {
2498
- super({
2499
- type: 'date',
2500
- check(v) {
2501
- return isDate(v) && !isNaN(v.getTime());
2502
- }
2503
- });
2504
- this.withMutation(() => {
2505
- this.transform((value, _raw, ctx) => {
2506
- // null -> InvalidDate isn't useful; treat all nulls as null and let it fail on
2507
- // nullability check vs TypeErrors
2508
- if (!ctx.spec.coerce || ctx.isType(value) || value === null) return value;
2509
- value = parseIsoDate(value);
2510
-
2511
- // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
2512
- return !isNaN(value) ? new Date(value) : DateSchema.INVALID_DATE;
2513
- });
2514
- });
2515
- }
2516
- prepareParam(ref, name) {
2517
- let param;
2518
- if (!Reference.isRef(ref)) {
2519
- let cast = this.cast(ref);
2520
- if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
2521
- param = cast;
2522
- } else {
2523
- param = ref;
2524
- }
2525
- return param;
2526
- }
2527
- min(min, message = date.min) {
2528
- let limit = this.prepareParam(min, 'min');
2529
- return this.test({
2530
- message,
2531
- name: 'min',
2532
- exclusive: true,
2533
- params: {
2534
- min
2535
- },
2536
- skipAbsent: true,
2537
- test(value) {
2538
- return value >= this.resolve(limit);
2539
- }
2540
- });
2541
- }
2542
- max(max, message = date.max) {
2543
- let limit = this.prepareParam(max, 'max');
2544
- return this.test({
2545
- message,
2546
- name: 'max',
2547
- exclusive: true,
2548
- params: {
2549
- max
2550
- },
2551
- skipAbsent: true,
2552
- test(value) {
2553
- return value <= this.resolve(limit);
2554
- }
2555
- });
2556
- }
2557
- }
2558
- DateSchema.INVALID_DATE = invalidDate;
2559
-
2560
- // @ts-expect-error
2561
- function sortFields(fields, excludedEdges = []) {
2562
- let edges = [];
2563
- let nodes = new Set();
2564
- let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));
2565
- function addNode(depPath, key) {
2566
- let node = propertyExpr.split(depPath)[0];
2567
- nodes.add(node);
2568
- if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);
2569
- }
2570
- for (const key of Object.keys(fields)) {
2571
- let value = fields[key];
2572
- nodes.add(key);
2573
- if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);else if (isSchema(value) && 'deps' in value) value.deps.forEach(path => addNode(path, key));
2574
- }
2575
- return toposort$1.array(Array.from(nodes), edges).reverse();
2576
- }
2577
-
2578
- function findIndex(arr, err) {
2579
- let idx = Infinity;
2580
- arr.some((key, ii) => {
2581
- var _err$path;
2582
- if ((_err$path = err.path) != null && _err$path.includes(key)) {
2583
- idx = ii;
2584
- return true;
2585
- }
2586
- });
2587
- return idx;
2588
- }
2589
- function sortByKeyOrder(keys) {
2590
- return (a, b) => {
2591
- return findIndex(keys, a) - findIndex(keys, b);
2592
- };
2593
- }
2594
-
2595
- const parseJson = (value, _, ctx) => {
2596
- if (typeof value !== 'string') {
2597
- return value;
2598
- }
2599
- let parsed = value;
2600
- try {
2601
- parsed = JSON.parse(value);
2602
- } catch (err) {
2603
- /* */
2604
- }
2605
- return ctx.isType(parsed) ? parsed : value;
2606
- };
2607
-
2608
- // @ts-ignore
2609
- function deepPartial(schema) {
2610
- if ('fields' in schema) {
2611
- const partial = {};
2612
- for (const [key, fieldSchema] of Object.entries(schema.fields)) {
2613
- partial[key] = deepPartial(fieldSchema);
2614
- }
2615
- return schema.setFields(partial);
2616
- }
2617
- if (schema.type === 'array') {
2618
- const nextArray = schema.optional();
2619
- if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
2620
- return nextArray;
2621
- }
2622
- if (schema.type === 'tuple') {
2623
- return schema.optional().clone({
2624
- types: schema.spec.types.map(deepPartial)
2625
- });
2626
- }
2627
- if ('optional' in schema) {
2628
- return schema.optional();
2629
- }
2630
- return schema;
2631
- }
2632
- const deepHas = (obj, p) => {
2633
- const path = [...propertyExpr.normalizePath(p)];
2634
- if (path.length === 1) return path[0] in obj;
2635
- let last = path.pop();
2636
- let parent = propertyExpr.getter(propertyExpr.join(path), true)(obj);
2637
- return !!(parent && last in parent);
2638
- };
2639
- let isObject = obj => Object.prototype.toString.call(obj) === '[object Object]';
2640
- function unknown(ctx, value) {
2641
- let known = Object.keys(ctx.fields);
2642
- return Object.keys(value).filter(key => known.indexOf(key) === -1);
2643
- }
2644
- const defaultSort = sortByKeyOrder([]);
2645
- function create$3(spec) {
2646
- return new ObjectSchema(spec);
2647
- }
2648
- class ObjectSchema extends Schema {
2649
- constructor(spec) {
2650
- super({
2651
- type: 'object',
2652
- check(value) {
2653
- return isObject(value) || typeof value === 'function';
2654
- }
2655
- });
2656
- this.fields = Object.create(null);
2657
- this._sortErrors = defaultSort;
2658
- this._nodes = [];
2659
- this._excludedEdges = [];
2660
- this.withMutation(() => {
2661
- if (spec) {
2662
- this.shape(spec);
2663
- }
2664
- });
2665
- }
2666
- _cast(_value, options = {}) {
2667
- var _options$stripUnknown;
2668
- let value = super._cast(_value, options);
2669
-
2670
- //should ignore nulls here
2671
- if (value === undefined) return this.getDefault(options);
2672
- if (!this._typeCheck(value)) return value;
2673
- let fields = this.fields;
2674
- let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
2675
- let props = [].concat(this._nodes, Object.keys(value).filter(v => !this._nodes.includes(v)));
2676
- let intermediateValue = {}; // is filled during the transform below
2677
- let innerOptions = Object.assign({}, options, {
2678
- parent: intermediateValue,
2679
- __validating: options.__validating || false
2680
- });
2681
- let isChanged = false;
2682
- for (const prop of props) {
2683
- let field = fields[prop];
2684
- let exists = (prop in value);
2685
- if (field) {
2686
- let fieldValue;
2687
- let inputValue = value[prop];
2688
-
2689
- // safe to mutate since this is fired in sequence
2690
- innerOptions.path = (options.path ? `${options.path}.` : '') + prop;
2691
- field = field.resolve({
2692
- value: inputValue,
2693
- context: options.context,
2694
- parent: intermediateValue
2695
- });
2696
- let fieldSpec = field instanceof Schema ? field.spec : undefined;
2697
- let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
2698
- if (fieldSpec != null && fieldSpec.strip) {
2699
- isChanged = isChanged || prop in value;
2700
- continue;
2701
- }
2702
- fieldValue = !options.__validating || !strict ?
2703
- // TODO: use _cast, this is double resolving
2704
- field.cast(value[prop], innerOptions) : value[prop];
2705
- if (fieldValue !== undefined) {
2706
- intermediateValue[prop] = fieldValue;
2707
- }
2708
- } else if (exists && !strip) {
2709
- intermediateValue[prop] = value[prop];
2710
- }
2711
- if (exists !== prop in intermediateValue || intermediateValue[prop] !== value[prop]) {
2712
- isChanged = true;
2713
- }
2714
- }
2715
- return isChanged ? intermediateValue : value;
2716
- }
2717
- _validate(_value, options = {}, panic, next) {
2718
- let {
2719
- from = [],
2720
- originalValue = _value,
2721
- recursive = this.spec.recursive
2722
- } = options;
2723
- options.from = [{
2724
- schema: this,
2725
- value: originalValue
2726
- }, ...from];
2727
- // this flag is needed for handling `strict` correctly in the context of
2728
- // validation vs just casting. e.g strict() on a field is only used when validating
2729
- options.__validating = true;
2730
- options.originalValue = originalValue;
2731
- super._validate(_value, options, panic, (objectErrors, value) => {
2732
- if (!recursive || !isObject(value)) {
2733
- next(objectErrors, value);
2734
- return;
2735
- }
2736
- originalValue = originalValue || value;
2737
- let tests = [];
2738
- for (let key of this._nodes) {
2739
- let field = this.fields[key];
2740
- if (!field || Reference.isRef(field)) {
2741
- continue;
2742
- }
2743
- tests.push(field.asNestedTest({
2744
- options,
2745
- key,
2746
- parent: value,
2747
- parentPath: options.path,
2748
- originalParent: originalValue
2749
- }));
2750
- }
2751
- this.runTests({
2752
- tests,
2753
- value,
2754
- originalValue,
2755
- options
2756
- }, panic, fieldErrors => {
2757
- next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);
2758
- });
2759
- });
2760
- }
2761
- clone(spec) {
2762
- const next = super.clone(spec);
2763
- next.fields = Object.assign({}, this.fields);
2764
- next._nodes = this._nodes;
2765
- next._excludedEdges = this._excludedEdges;
2766
- next._sortErrors = this._sortErrors;
2767
- return next;
2768
- }
2769
- concat(schema) {
2770
- let next = super.concat(schema);
2771
- let nextFields = next.fields;
2772
- for (let [field, schemaOrRef] of Object.entries(this.fields)) {
2773
- const target = nextFields[field];
2774
- nextFields[field] = target === undefined ? schemaOrRef : target;
2775
- }
2776
- return next.withMutation(s =>
2777
- // XXX: excludes here is wrong
2778
- s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges]));
2779
- }
2780
- _getDefault(options) {
2781
- if ('default' in this.spec) {
2782
- return super._getDefault(options);
2783
- }
2784
-
2785
- // if there is no default set invent one
2786
- if (!this._nodes.length) {
2787
- return undefined;
2788
- }
2789
- let dft = {};
2790
- this._nodes.forEach(key => {
2791
- var _innerOptions;
2792
- const field = this.fields[key];
2793
- let innerOptions = options;
2794
- if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
2795
- innerOptions = Object.assign({}, innerOptions, {
2796
- parent: innerOptions.value,
2797
- value: innerOptions.value[key]
2798
- });
2799
- }
2800
- dft[key] = field && 'getDefault' in field ? field.getDefault(innerOptions) : undefined;
2801
- });
2802
- return dft;
2803
- }
2804
- setFields(shape, excludedEdges) {
2805
- let next = this.clone();
2806
- next.fields = shape;
2807
- next._nodes = sortFields(shape, excludedEdges);
2808
- next._sortErrors = sortByKeyOrder(Object.keys(shape));
2809
- // XXX: this carries over edges which may not be what you want
2810
- if (excludedEdges) next._excludedEdges = excludedEdges;
2811
- return next;
2812
- }
2813
- shape(additions, excludes = []) {
2814
- return this.clone().withMutation(next => {
2815
- let edges = next._excludedEdges;
2816
- if (excludes.length) {
2817
- if (!Array.isArray(excludes[0])) excludes = [excludes];
2818
- edges = [...next._excludedEdges, ...excludes];
2819
- }
2820
-
2821
- // XXX: excludes here is wrong
2822
- return next.setFields(Object.assign(next.fields, additions), edges);
2823
- });
2824
- }
2825
- partial() {
2826
- const partial = {};
2827
- for (const [key, schema] of Object.entries(this.fields)) {
2828
- partial[key] = 'optional' in schema && schema.optional instanceof Function ? schema.optional() : schema;
2829
- }
2830
- return this.setFields(partial);
2831
- }
2832
- deepPartial() {
2833
- const next = deepPartial(this);
2834
- return next;
2835
- }
2836
- pick(keys) {
2837
- const picked = {};
2838
- for (const key of keys) {
2839
- if (this.fields[key]) picked[key] = this.fields[key];
2840
- }
2841
- return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));
2842
- }
2843
- omit(keys) {
2844
- const remaining = [];
2845
- for (const key of Object.keys(this.fields)) {
2846
- if (keys.includes(key)) continue;
2847
- remaining.push(key);
2848
- }
2849
- return this.pick(remaining);
2850
- }
2851
- from(from, to, alias) {
2852
- let fromGetter = propertyExpr.getter(from, true);
2853
- return this.transform(obj => {
2854
- if (!obj) return obj;
2855
- let newObj = obj;
2856
- if (deepHas(obj, from)) {
2857
- newObj = Object.assign({}, obj);
2858
- if (!alias) delete newObj[from];
2859
- newObj[to] = fromGetter(obj);
2860
- }
2861
- return newObj;
2862
- });
2863
- }
2864
-
2865
- /** Parse an input JSON string to an object */
2866
- json() {
2867
- return this.transform(parseJson);
2868
- }
2869
- noUnknown(noAllow = true, message = object.noUnknown) {
2870
- if (typeof noAllow !== 'boolean') {
2871
- message = noAllow;
2872
- noAllow = true;
2873
- }
2874
- let next = this.test({
2875
- name: 'noUnknown',
2876
- exclusive: true,
2877
- message: message,
2878
- test(value) {
2879
- if (value == null) return true;
2880
- const unknownKeys = unknown(this.schema, value);
2881
- return !noAllow || unknownKeys.length === 0 || this.createError({
2882
- params: {
2883
- unknown: unknownKeys.join(', ')
2884
- }
2885
- });
2886
- }
2887
- });
2888
- next.spec.noUnknown = noAllow;
2889
- return next;
2890
- }
2891
- unknown(allow = true, message = object.noUnknown) {
2892
- return this.noUnknown(!allow, message);
2893
- }
2894
- transformKeys(fn) {
2895
- return this.transform(obj => {
2896
- if (!obj) return obj;
2897
- const result = {};
2898
- for (const key of Object.keys(obj)) result[fn(key)] = obj[key];
2899
- return result;
2900
- });
2901
- }
2902
- camelCase() {
2903
- return this.transformKeys(tinyCase.camelCase);
2904
- }
2905
- snakeCase() {
2906
- return this.transformKeys(tinyCase.snakeCase);
2907
- }
2908
- constantCase() {
2909
- return this.transformKeys(key => tinyCase.snakeCase(key).toUpperCase());
2910
- }
2911
- describe(options) {
2912
- const next = (options ? this.resolve(options) : this).clone();
2913
- const base = super.describe(options);
2914
- base.fields = {};
2915
- for (const [key, value] of Object.entries(next.fields)) {
2916
- var _innerOptions2;
2917
- let innerOptions = options;
2918
- if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {
2919
- innerOptions = Object.assign({}, innerOptions, {
2920
- parent: innerOptions.value,
2921
- value: innerOptions.value[key]
2922
- });
2923
- }
2924
- base.fields[key] = value.describe(innerOptions);
2925
- }
2926
- return base;
2927
- }
2928
- }
2929
- create$3.prototype = ObjectSchema.prototype;
2930
-
2931
- export { FormController as F, create$6 as a, create$8 as b, create$3 as c, create$7 as d };