adp-web-components 0.3.13 → 0.3.14

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 (236) hide show
  1. package/dist/cjs/dead-stock-lookup_3.cjs.entry.js +5 -5
  2. package/dist/cjs/flexible-container.cjs.entry.js +1 -1
  3. package/dist/cjs/form-checkbox.cjs.entry.js +3 -3
  4. package/dist/cjs/form-date-picker.cjs.entry.js +1 -1
  5. package/dist/cjs/form-dialog_13.cjs.entry.js +35 -17
  6. package/dist/cjs/{form-input-PYkIVe7J.js → form-input-BBY_3Qk7.js} +8 -6
  7. package/dist/cjs/form-input_7.cjs.entry.js +9 -9
  8. package/dist/cjs/form-switch.cjs.entry.js +3 -3
  9. package/dist/cjs/form-time-picker.cjs.entry.js +1 -1
  10. package/dist/cjs/{functions-Bu1AQDD2.js → functions-DBDDNNNX.js} +4 -10
  11. package/dist/cjs/general-form.cjs.entry.js +4 -4
  12. package/dist/cjs/general-inquiry-form.cjs.entry.js +4 -4
  13. package/dist/cjs/{get-language-from-url-p2OXldYh.js → get-language-from-url-9TyZFCRO.js} +4 -0
  14. package/dist/cjs/{get-local-language-BR0p0bBg.js → get-local-language-DjRj7WaF.js} +1 -1
  15. package/dist/cjs/{get-mock-files-Dljv5P4k.js → get-mock-files-Br7Co-Fj.js} +1 -1
  16. package/dist/cjs/information-table.cjs.entry.js +1 -1
  17. package/dist/cjs/loading-spinner.cjs.entry.js +1 -1
  18. package/dist/cjs/manufacturer-part-lookup.cjs.entry.js +3 -3
  19. package/dist/cjs/part-lookup.cjs.entry.js +2 -2
  20. package/dist/cjs/service-booking-form.cjs.entry.js +4 -4
  21. package/dist/cjs/shift-accordion.cjs.entry.js +1 -1
  22. package/dist/cjs/shift-slider.cjs.entry.js +1 -1
  23. package/dist/cjs/shift-tab-content.cjs.entry.js +1 -1
  24. package/dist/cjs/shift-tabs_2.cjs.entry.js +2 -2
  25. package/dist/cjs/ssc-lookup-form.cjs.entry.js +4 -4
  26. package/dist/cjs/test-drive-form.cjs.entry.js +4 -4
  27. package/dist/cjs/{validation-jJwLyk27.js → validation-5ZUxalyW.js} +3 -1
  28. package/dist/cjs/vehicle-accessories_7.cjs.entry.js +8 -8
  29. package/dist/cjs/vehicle-lookup.cjs.entry.js +3 -3
  30. package/dist/cjs/vehicle-quotation-form.cjs.entry.js +3 -3
  31. package/dist/collection/components/components/flexible-container.css +1 -1
  32. package/dist/collection/components/components/information-table.css +1 -1
  33. package/dist/collection/components/components/loading-spinner.css +1 -1
  34. package/dist/collection/components/components/shift-accordion.css +1 -1
  35. package/dist/collection/components/components/shift-portal.css +1 -1
  36. package/dist/collection/components/components/shift-select-dropdown.css +1 -1
  37. package/dist/collection/components/components/shift-select.css +1 -1
  38. package/dist/collection/components/components/shift-slider.css +1 -1
  39. package/dist/collection/components/components/shift-tab-content.css +1 -1
  40. package/dist/collection/components/components/shift-tabs.css +1 -1
  41. package/dist/collection/components/form-elements/form-file.js +22 -4
  42. package/dist/collection/components/form-elements/form-inputs.css +1 -1
  43. package/dist/collection/components/forms/defaults/validation.js +2 -1
  44. package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -1
  45. package/dist/collection/components/part-lookup/distributor-lookup.css +1 -1
  46. package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -1
  47. package/dist/collection/components/part-lookup/manufacturer-part-lookup.css +1 -1
  48. package/dist/collection/components/part-lookup/part-lookup.css +1 -1
  49. package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -1
  50. package/dist/collection/components/vehicle-lookup/vehicle-claimable-items.css +1 -1
  51. package/dist/collection/components/vehicle-lookup/vehicle-item-claim-form.css +1 -1
  52. package/dist/collection/components/vehicle-lookup/vehicle-lookup.css +1 -1
  53. package/dist/collection/components/vehicle-lookup/vehicle-paint-thickness.css +1 -1
  54. package/dist/collection/components/vehicle-lookup/vehicle-sale-information.css +1 -1
  55. package/dist/collection/components/vehicle-lookup/vehicle-service-history.css +1 -1
  56. package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -1
  57. package/dist/collection/components/vehicle-lookup/vehicle-warranty-details.css +1 -1
  58. package/dist/collection/features/form-hook/form-hook.js +4 -0
  59. package/dist/collection/features/form-hook/functions.js +2 -8
  60. package/dist/collection/features/form-hook/inputs/form-input.js +7 -5
  61. package/dist/components/dead-stock-lookup.js +1 -1
  62. package/dist/components/distributor-lookup.js +1 -1
  63. package/dist/components/flexible-container.js +1 -1
  64. package/dist/components/form-checkbox.js +1 -1
  65. package/dist/components/form-date-picker.js +1 -1
  66. package/dist/components/form-file.js +1 -1
  67. package/dist/components/form-input-preview.js +1 -1
  68. package/dist/components/form-input.js +1 -1
  69. package/dist/components/form-phone-number.js +1 -1
  70. package/dist/components/form-picker-input.js +1 -1
  71. package/dist/components/form-select.js +1 -1
  72. package/dist/components/form-shadow-input.js +1 -1
  73. package/dist/components/form-stepper-control.js +1 -1
  74. package/dist/components/form-stepper-submit.js +1 -1
  75. package/dist/components/form-stepper.js +1 -1
  76. package/dist/components/form-structure-error.js +1 -1
  77. package/dist/components/form-structure.js +1 -1
  78. package/dist/components/form-submit.js +1 -1
  79. package/dist/components/form-switch.js +1 -1
  80. package/dist/components/form-text-area.js +1 -1
  81. package/dist/components/form-time-picker.js +1 -1
  82. package/dist/components/form-vin-input.js +1 -1
  83. package/dist/components/general-form.js +1 -1
  84. package/dist/components/general-inquiry-form.js +1 -1
  85. package/dist/components/information-table.js +1 -1
  86. package/dist/components/loading-spinner.js +1 -1
  87. package/dist/components/manufacturer-lookup.js +1 -1
  88. package/dist/components/manufacturer-part-lookup.js +1 -1
  89. package/dist/components/{p-B8g3fLoh.js → p-0Leiluv7.js} +1 -1
  90. package/dist/components/{p-B42vuL_p.js → p-9zux5VXM.js} +1 -1
  91. package/dist/components/p-A2T8KqHs.js +5 -0
  92. package/dist/components/{p-dRP9cgZF.js → p-ABcgwu6F.js} +1 -1
  93. package/dist/components/{p-CD1XArUc.js → p-B2ZE4oRD.js} +1 -1
  94. package/dist/components/p-B5T-06-W.js +5 -0
  95. package/dist/components/{p-DbAAihIH.js → p-B6_q3Jaz.js} +1 -1
  96. package/dist/components/p-B6gnG2lN.js +5 -0
  97. package/dist/components/{p-CjByjVT0.js → p-B6ib31CX.js} +1 -1
  98. package/dist/components/p-BL5YkEz-.js +5 -0
  99. package/dist/components/{p-BsgLxjfx.js → p-BTfZ7GAi.js} +1 -1
  100. package/dist/components/{p-Hlqj6HsH.js → p-BUGOUxbr.js} +1 -1
  101. package/dist/components/{p-D-0CfzDk.js → p-Bu1VjE_4.js} +1 -1
  102. package/dist/components/p-CCpbwft_.js +5 -0
  103. package/dist/components/{p-ubqjXh5U.js → p-CH5Rb3vr.js} +1 -1
  104. package/dist/components/{p-C55Gk63d.js → p-CK3C2jeL.js} +1 -1
  105. package/dist/components/{p-BNs9PHd8.js → p-CN6RvIb-.js} +1 -1
  106. package/dist/components/{p-CtyIp56a.js → p-COyo4v_L.js} +1 -1
  107. package/dist/components/p-CYGQmS-P.js +5 -0
  108. package/dist/components/{p-ClDpIRF9.js → p-CbL2RmJ1.js} +1 -1
  109. package/dist/components/{p-BMxw31OW.js → p-CgimfOQ7.js} +1 -1
  110. package/dist/components/{p-BDHTK4yJ.js → p-CsqoymFO.js} +1 -1
  111. package/dist/components/{p-BHYsBcpG.js → p-DIMe8nY5.js} +1 -1
  112. package/dist/components/{p-DNZ31iYw.js → p-DJ66XSRQ.js} +1 -1
  113. package/dist/components/{p-DJ0awYVE.js → p-DJa_zubh.js} +1 -1
  114. package/dist/components/p-DQopO8HS.js +5 -0
  115. package/dist/components/{p-BFAzCUQY.js → p-DTQIIqm5.js} +1 -1
  116. package/dist/components/p-Dal_X4-W.js +5 -0
  117. package/dist/components/{p-CMgPnaDZ.js → p-DdUaptEO.js} +1 -1
  118. package/dist/components/{p-CoAe_PpX.js → p-Dhy4YWgm.js} +1 -1
  119. package/dist/{shift-components/p-BLdwm9KB.js → components/p-DlJAm0cB.js} +1 -1
  120. package/dist/components/p-DoGNkDP-.js +5 -0
  121. package/dist/components/{p-DBErZTaY.js → p-DwJkEi88.js} +1 -1
  122. package/dist/components/{p-B3Vlmu9F.js → p-SQ4fUegy.js} +1 -1
  123. package/dist/components/p-WdDnbO6s.js +5 -0
  124. package/dist/components/{p-Cl-rntc3.js → p-Y2dufCGw.js} +1 -1
  125. package/dist/components/{p-Dv_BQG7D.js → p-_i2jGDlH.js} +1 -1
  126. package/dist/components/{p-BjLQXN9e.js → p-emKMuKu4.js} +1 -1
  127. package/dist/components/p-puPUmTHi.js +5 -0
  128. package/dist/components/{p-8EOK_QhL.js → p-qYvbkatn.js} +1 -1
  129. package/dist/components/p-vYuOlXCR.js +5 -0
  130. package/dist/components/part-lookup.js +1 -1
  131. package/dist/components/service-booking-form.js +1 -1
  132. package/dist/components/shift-accordion.js +1 -1
  133. package/dist/components/shift-portal.js +1 -1
  134. package/dist/components/shift-select-dropdown.js +1 -1
  135. package/dist/components/shift-select.js +1 -1
  136. package/dist/components/shift-slider.js +1 -1
  137. package/dist/components/shift-tab-content.js +1 -1
  138. package/dist/components/shift-tabs.js +1 -1
  139. package/dist/components/ssc-lookup-form.js +1 -1
  140. package/dist/components/test-drive-form.js +1 -1
  141. package/dist/components/vehicle-accessories.js +1 -1
  142. package/dist/components/vehicle-claimable-items.js +1 -1
  143. package/dist/components/vehicle-item-claim-form.js +1 -1
  144. package/dist/components/vehicle-lookup.js +1 -1
  145. package/dist/components/vehicle-paint-thickness.js +1 -1
  146. package/dist/components/vehicle-quotation-form.js +1 -1
  147. package/dist/components/vehicle-sale-information.js +1 -1
  148. package/dist/components/vehicle-service-history.js +1 -1
  149. package/dist/components/vehicle-specification.js +1 -1
  150. package/dist/components/vehicle-warranty-details.js +1 -1
  151. package/dist/esm/dead-stock-lookup_3.entry.js +5 -5
  152. package/dist/esm/flexible-container.entry.js +1 -1
  153. package/dist/esm/form-checkbox.entry.js +3 -3
  154. package/dist/esm/form-date-picker.entry.js +1 -1
  155. package/dist/esm/form-dialog_13.entry.js +35 -17
  156. package/dist/esm/{form-input-DAgayhNz.js → form-input-B8SwfkAd.js} +8 -6
  157. package/dist/esm/form-input_7.entry.js +9 -9
  158. package/dist/esm/form-switch.entry.js +3 -3
  159. package/dist/esm/form-time-picker.entry.js +1 -1
  160. package/dist/esm/{functions-DHzedl_R.js → functions-DG73G3O6.js} +4 -10
  161. package/dist/esm/general-form.entry.js +4 -4
  162. package/dist/esm/general-inquiry-form.entry.js +4 -4
  163. package/dist/esm/{get-language-from-url-U4hZ4dwn.js → get-language-from-url-C1D-aPDq.js} +4 -0
  164. package/dist/esm/{get-local-language-TRD6vPH7.js → get-local-language-DsJgnZ5L.js} +1 -1
  165. package/dist/esm/{get-mock-files-K2mWecRb.js → get-mock-files-_k2h1OdV.js} +1 -1
  166. package/dist/esm/information-table.entry.js +1 -1
  167. package/dist/esm/loading-spinner.entry.js +1 -1
  168. package/dist/esm/manufacturer-part-lookup.entry.js +3 -3
  169. package/dist/esm/part-lookup.entry.js +2 -2
  170. package/dist/esm/service-booking-form.entry.js +4 -4
  171. package/dist/esm/shift-accordion.entry.js +1 -1
  172. package/dist/esm/shift-slider.entry.js +1 -1
  173. package/dist/esm/shift-tab-content.entry.js +1 -1
  174. package/dist/esm/shift-tabs_2.entry.js +2 -2
  175. package/dist/esm/ssc-lookup-form.entry.js +4 -4
  176. package/dist/esm/test-drive-form.entry.js +4 -4
  177. package/dist/esm/{validation-oieVWBn1.js → validation-lB1iHxfZ.js} +3 -2
  178. package/dist/esm/vehicle-accessories_7.entry.js +8 -8
  179. package/dist/esm/vehicle-lookup.entry.js +3 -3
  180. package/dist/esm/vehicle-quotation-form.entry.js +3 -3
  181. package/dist/integration-manifest.json +1 -1
  182. package/dist/shift-components/{p-fe7ece41.entry.js → p-04b02a2a.entry.js} +1 -1
  183. package/dist/shift-components/{p-6b82a9b3.entry.js → p-1416551c.entry.js} +1 -1
  184. package/dist/shift-components/{p-0dd7911f.entry.js → p-2b0e3d27.entry.js} +1 -1
  185. package/dist/shift-components/p-2f764c75.entry.js +5 -0
  186. package/dist/shift-components/p-50819229.entry.js +5 -0
  187. package/dist/shift-components/{p-fa39d151.entry.js → p-56f69d7f.entry.js} +1 -1
  188. package/dist/shift-components/p-64205a8d.entry.js +5 -0
  189. package/dist/shift-components/{p-d33c83ac.entry.js → p-6a10c7ff.entry.js} +1 -1
  190. package/dist/shift-components/{p-10511716.entry.js → p-79faecaa.entry.js} +1 -1
  191. package/dist/shift-components/{p-981d1f44.entry.js → p-7ff0ea83.entry.js} +1 -1
  192. package/dist/shift-components/{p-7a41a739.entry.js → p-8387da9d.entry.js} +1 -1
  193. package/dist/shift-components/{p-22648595.entry.js → p-83a38f2f.entry.js} +1 -1
  194. package/dist/shift-components/{p-e979caa9.entry.js → p-89853d6c.entry.js} +1 -1
  195. package/dist/shift-components/p-8e478de8.entry.js +5 -0
  196. package/dist/shift-components/{p-960fedbb.entry.js → p-9fbdc7fd.entry.js} +1 -1
  197. package/dist/shift-components/p-C582V9TT.js +5 -0
  198. package/dist/shift-components/p-CEfxRHUk.js +5 -0
  199. package/dist/shift-components/{p-rsylYLbj.js → p-C_AHRam8.js} +1 -1
  200. package/dist/{components/p-CnZZ3ASF.js → shift-components/p-D6ZxBLEm.js} +1 -1
  201. package/dist/shift-components/p-HI9vdFQP.js +5 -0
  202. package/dist/shift-components/{p-bc966aa0.entry.js → p-acd9087d.entry.js} +1 -1
  203. package/dist/shift-components/{p-2f904561.entry.js → p-b4f9de18.entry.js} +1 -1
  204. package/dist/shift-components/{p-332ebda4.entry.js → p-bd772f48.entry.js} +1 -1
  205. package/dist/shift-components/{p-a55ceb19.entry.js → p-c3f88c4c.entry.js} +1 -1
  206. package/dist/shift-components/{p-61ecc144.entry.js → p-cc3bdbd7.entry.js} +1 -1
  207. package/dist/shift-components/{p-23df4ed2.entry.js → p-d5db4fb4.entry.js} +1 -1
  208. package/dist/shift-components/{p-3fcb1657.entry.js → p-d73f83a1.entry.js} +1 -1
  209. package/dist/shift-components/p-e65d8cc3.entry.js +5 -0
  210. package/dist/shift-components/{p-a4086c90.entry.js → p-f148f0db.entry.js} +1 -1
  211. package/dist/shift-components/{p-CC1CaPP4.js → p-pUYjpajc.js} +1 -1
  212. package/dist/shift-components/shift-components.esm.js +1 -1
  213. package/dist/stencil-docs.json +1 -1
  214. package/dist/types/components/form-elements/form-file.d.ts +1 -0
  215. package/dist/types/components/forms/defaults/validation.d.ts +2 -0
  216. package/package.json +1 -1
  217. package/dist/components/p-50EIzP4j.js +0 -5
  218. package/dist/components/p-BDlZ35Dv.js +0 -5
  219. package/dist/components/p-BcRom3sV.js +0 -5
  220. package/dist/components/p-BshR1DsJ.js +0 -5
  221. package/dist/components/p-C24AOawm.js +0 -5
  222. package/dist/components/p-CK6WFXQF.js +0 -5
  223. package/dist/components/p-CKrwCtec.js +0 -5
  224. package/dist/components/p-CLkGfAsm.js +0 -5
  225. package/dist/components/p-CvcaE6Ss.js +0 -5
  226. package/dist/components/p-DlG98nFs.js +0 -5
  227. package/dist/components/p-G9UmKW9m.js +0 -5
  228. package/dist/components/p-Wv20cFTm.js +0 -5
  229. package/dist/shift-components/p-031f2ae6.entry.js +0 -5
  230. package/dist/shift-components/p-0578b913.entry.js +0 -5
  231. package/dist/shift-components/p-1500556f.entry.js +0 -5
  232. package/dist/shift-components/p-46e5146f.entry.js +0 -5
  233. package/dist/shift-components/p-BY1wHcOT.js +0 -5
  234. package/dist/shift-components/p-BuurMgGN.js +0 -5
  235. package/dist/shift-components/p-b611f72e.entry.js +0 -5
  236. package/dist/shift-components/p-yhCrSkom.js +0 -5
@@ -1,5 +0,0 @@
1
- /*!
2
- * Built by ShiftSoftware
3
- * Copyright (c)
4
- */
5
- import{f as i}from"./p-Cg4V9l26.js";class t{constructor(t,s,h){this.haltValidation=!1,this.isSubmitted=!1,this.stepFormValues={},this.watchers={},this.cachedValues={},this.subscribers=[],this.validationType="onSubmit",this.subscribedFields={},this.formErrors={},this.backButtonContexts=[],this.pendingRequests={},this.openDialog=()=>{},this.subscribe=(i,t)=>{var s,h,r,e;if(this.subscribers.push({name:i,context:t}),null==t?void 0:t.partialValidation){const o=(null===(h=null===(s=this.schemaObject)||void 0===s?void 0:s.fields)||void 0===h?void 0:h[i])||(null===(e=null===(r=this.basicSchemaObject)||void 0===r?void 0:r.fields)||void 0===e?void 0:e[i]);if(o){const s=t.partialValidation(o);s&&(this.schemaObject=this.schemaObject.shape({[i]:s}))}}if(null==t?void 0:t.validate){const s=t.validate();s&&(this.schemaObject=this.schemaObject.shape({[i]:s}))}},this.unsubscribe=i=>{var t,s,h;const r=null===(t=this.basicSchemaObject)||void 0===t?void 0:t.fields[i];r?this.schemaObject=this.schemaObject.shape({[i]:r}):(null===(h=null===(s=this.schemaObject)||void 0===s?void 0:s.fields)||void 0===h?void 0:h[i])&&(this.schemaObject=this.schemaObject.omit([i])),this.subscribers=this.subscribers.filter((({name:t})=>t!==i))},this.getStepLabels=(i="en",t)=>{var s,h,r,e;t||(t=null===(s=this.formStructure)||void 0===s?void 0:s.currentStep);let o={back:"",title:"",stepCell:"",stepTitle:"",submitButton:""};try{o=null===(e=null===(r=null===(h=this.context.structure)||void 0===h?void 0:h.steps)||void 0===r?void 0:r[t-1])||void 0===e?void 0:e[i]}catch(i){}return o},this.addWatcher=(i,t)=>{this.watchers[i]||((null==i?void 0:i.trim())?this.watchers[i]=t||(({form:i})=>{i.rerender({rerenderForm:!0})}):this.watchers.all=({form:i})=>{i.rerender({rerenderForm:!0})})},this.removeWatcher=i=>{delete this.watchers[i]},this.onInput=i=>{const t=i.target;let s=t.value;"checkbox"===t.type&&(s=t.checked);const h=Object.assign(Object.assign({},this.getValues()),{[t.name]:s});this.onValuesUpdate&&this.onValuesUpdate(h),this.validateForm(t.name,s)},this.resetFormErrorMessage=()=>this.context.errorMessage="",this.getFormErrors=()=>this.formErrors,this.getFormLocale=()=>[this.context.locale,this.context.language],this.setCachedValues=i=>{this.cachedValues=i},this.getValue=i=>this.getValues()[i],this.getValues=()=>{const i=(this.context.el.shadowRoot||this.context.el).querySelector("form");if(!i)return{};const t=new FormData(i),s=Object.fromEntries(t.entries());return i.querySelectorAll("[name]").forEach((i=>{var t,h,r;const e=null===(t=this.subscribers.find((t=>t.name===i.name)))||void 0===t?void 0:t.context;if(e&&(null==e?void 0:e.getValue))s[i.name]=e.getValue();else if(i.disabled)s[i.name]=i.value;else if("file"===i.type){const t=Array.from((null==i?void 0:i.files)||[]),e=null===(r=null===(h=this.subscribers.find((t=>t.name===(null==i?void 0:i.name))))||void 0===h?void 0:h.context)||void 0===r?void 0:r.sasFiles,o=t.map(((i,t)=>(null==e?void 0:e[t])?Object.assign({name:i.name,size:i.size,type:i.type,lastModified:i.lastModified},e[t]):i));s[i.name]=o}})),Object.assign(Object.assign({},this.cachedValues),s)},this.focusFirstInput=i=>{var t;if(i.length){const s=this.context.el.shadowRoot||this.context.el,h=i.map((i=>s.querySelector(`*[name="${i.name}"]`))).filter((i=>i)).sort(((i,t)=>i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING?1:0));h[0]&&(h[0].hidden?null===(t=h[0].parentElement)||void 0===t||t.scrollIntoView({behavior:"smooth",block:"center"}):h[0].focus())}},this.hasItemInStructure=(i,t=this.context.structure)=>{var s;if(!t)return!0;if("string"==typeof t)return t===i;const{tag:h,name:r,children:e,isHidden:o,step:n}=t;return(!n||n==(null===(s=this.formStructure)||void 0===s?void 0:s.currentStep))&&(!(h!==i&&r!==i||o)||!!Array.isArray(e)&&e.some((t=>this.hasItemInStructure(i,t))))},this.updateStep=(t,s=!1)=>{var h,r,e,o,n,l;let d=this.formStructure.currentStep;s?d=t:d+=t,d<1&&(d=1),d>(null===(e=null===(r=null===(h=this.context)||void 0===h?void 0:h.structure)||void 0===r?void 0:r.steps)||void 0===e?void 0:e.length)&&(t=null===(l=null===(n=null===(o=this.context)||void 0===o?void 0:o.structure)||void 0===n?void 0:n.steps)||void 0===l?void 0:l.length),this.formStructure.currentStep=d,this.backButtonContexts.forEach((t=>i(t))),this.rerender({rerenderAll:!0})},this.submitForm=async()=>{var i,t,s,h,r,e;try{this.isSubmitted=!0,this.context.isLoading=!0,this.signal({isError:!1,disabled:!0});const o=Object.assign(Object.assign({},this.cachedValues),this.getValues()),n=this.schemaObject.describe();Object.entries(n.fields).filter((([i,t])=>"boolean"===t.type)).forEach((([i])=>{o[i]="string"==typeof o[i]&&"true"===o[i]}));const l=Object.keys(this.schemaObject.fields).filter((i=>!this.hasItemInStructure(i))),d=await this.schemaObject.omit(l).validate(o,{abortEarly:!1,context:this.requiredContext});(null===(t=null===(i=this.context)||void 0===i?void 0:i.structure)||void 0===t?void 0:t.steps)?(this.stepFormValues=Object.assign(Object.assign({},null==this?void 0:this.stepFormValues),d),(null===(r=null===(h=null===(s=this.context)||void 0===s?void 0:s.structure)||void 0===h?void 0:h.steps)||void 0===r?void 0:r.length)===(null===(e=this.formStructure)||void 0===e?void 0:e.currentStep)?await this.context.formSubmit(this.stepFormValues):this.updateStep(1)):await this.context.formSubmit(d)}catch(i){if("ValidationError"===i.name){this.formErrors={};const t=[];i.inner.forEach((i=>{i.path&&(this.formErrors[i.path]=i.message,t.find((t=>t.name===i.path))||t.push({isError:!0,name:i.path,errorMessage:i.message}))})),console.log(this.formErrors),this.signal(t),this.focusFirstInput(t),this.rerender({rerenderAll:!0,rerenderForm:!0})}else console.error("Unexpected Error:",i)}finally{this.signal({disabled:!1}),this.context.isLoading=!1}},this.onSubmit=i=>{i.preventDefault(),this.submitForm()},this.submit=()=>{this.submitForm()},this.getRequiredContext=()=>{var i,t;const s={};try{return(null===(i=this.context.structure)||void 0===i?void 0:i.requiredContext)?(Object.entries(null===(t=this.context.structure)||void 0===t?void 0:t.requiredContext).forEach((([i,t])=>{s[`${i}Required`]=t})),s):s}catch(i){return s}},this.getInputState=i=>{const t=this.schemaObject.resolve({context:this.requiredContext}),s=t.describe().fields[i];let h=!1;try{t.validateSyncAt(i,{[i]:void 0},{context:this.requiredContext})}catch(i){h=!0}return this.subscribedFields[i]||(this.subscribedFields[i]={name:i,isRequired:h,isError:!1,disabled:!1,errorMessage:"",continuousValidation:!1,meta:null==s?void 0:s.meta}),this.subscribedFields[i]},this.signal=i=>{Array.isArray(i)?i.forEach((i=>{this.subscribedFields[i.name]&&Object.assign(this.subscribedFields[i.name],i)})):Object.values(this.subscribedFields).forEach((t=>Object.assign(t,i)))},this.validateInput=i=>{const t=this.getValues()[i]||"";return this.validateForm(i,t,!1)},this.rerender=({inputName:t,rerenderAll:s,rerenderForm:h})=>{var r;if(h&&(i(this.context),(null==this?void 0:this.formStructure)&&i(null==this?void 0:this.formStructure)),s)this.subscribers.forEach((t=>i(t.context)));else if(t){const s=null===(r=this.subscribers.find((i=>i.name===t)))||void 0===r?void 0:r.context;i(s)}},this.validateForm=(i,t,s=!0)=>{var h,r;if(setTimeout((()=>{const s=Object.assign(Object.assign({},this.getValues()),{[i]:t}),h=this.watchers[i];h&&h({form:this,values:s}),this.watchers.all&&this.watchers.all({form:this,values:s})}),50),s){if(this.haltValidation)return;if(!this.isSubmitted&&"always"!==this.validationType&&!(null===(h=this.subscribedFields[i])||void 0===h?void 0:h.continuousValidation))return}const e=null===(r=this.subscribedFields[i])||void 0===r?void 0:r.isError;try{return this.schemaObject.fields[i].validateSync(t,{context:this.requiredContext}),this.signal([{name:i,isError:!1}]),!1!==e&&this.rerender({inputName:i||"",rerenderForm:!0}),{isError:!1,errorMessage:""}}catch(t){if(t.message)return this.signal([{name:i,isError:!0,errorMessage:t.message}]),this.rerender({inputName:i||"",rerenderForm:!0}),{isError:!0,errorMessage:t.message}}finally{try{this.subscribedFields[i].continuousValidation=!0}catch(i){}}},this.context=t,this.schemaObject=s,this.basicSchemaObject=s,this.formController={onSubmit:this.onSubmit,onInput:this.onInput},(null==h?void 0:h.validationType)&&(this.validationType=h.validationType),this.requiredContext=this.getRequiredContext()}reset(){this.haltValidation=!0,this.updateStep(1,!0),this.stepFormValues={},this.subscribers.forEach((i=>{var t,s;(null===(t=i.context)||void 0===t?void 0:t.reset)&&(null===(s=i.context)||void 0===s||s.reset())})),this.pendingRequests={},this.isSubmitted=!1,this.signal({isError:!1,disabled:!1}),setTimeout((()=>{this.haltValidation=!1,setTimeout((()=>{this.rerender({rerenderForm:!0,rerenderAll:!0})}),50)}),50)}}const s={en:"en",english:"en",ar:"ar",arabic:"ar",ku:"ku",ckb:"ku",kurdish:"ku",sorani:"ku",ru:"ru",russian:"ru"};function h(){if("undefined"==typeof window)return"en";const{pathname:i,search:t}=window.location,h=new URLSearchParams(t),r=h.get("lang")||h.get("lng")||h.get("language");if(r){const i=r.toLowerCase();if(s[i])return s[i]}const e=i.toLowerCase();for(const i in s)if(e.includes(`/${i}`))return s[i];return"en"}export{t as F,h as g}