"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[6008],{6008:function(t,e,r){r.r(e),r.d(e,{sc_form:function(){return m}});var n=r(9394),a=r(467),i=r(3029),o=r(2901),s=r(9280),u=r.n(s),c=r(1346);function f(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return l(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var _n=0,n=function(){};return{s:n,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){o=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(o)throw a}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function h(t){var e=new FormData(t),r={};return e.forEach((function(t,e){r[e]=t})),r}var m=function(){return(0,o.A)((function t(e){(0,i.A)(this,t),(0,c.r)(this,e),this.scSubmit=(0,c.c)(this,"scSubmit",7),this.scFormSubmit=(0,c.c)(this,"scFormSubmit",7),this.scFormChange=(0,c.c)(this,"scFormChange",7),this.novalidate=!1}),[{key:"getFormData",value:(l=(0,a.A)(u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new FormData(this.formElement));case 1:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})},{key:"getFormJson",value:(s=(0,a.A)(u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",h(this.formElement));case 1:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"handleChange",value:(r=(0,a.A)(u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.scFormChange.emit(h(this.formElement));case 1:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"submit",value:(e=(0,a.A)(u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.submitForm());case 1:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"getFormControls",value:function(){return(0,n.A)(this.form.querySelectorAll("*"))}},{key:"validate",value:(t=(0,a.A)(u().mark((function t(){var e,r,n,a,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.getFormControls(),r=e.filter((function(t){return"function"==typeof t.reportValidity})),this.novalidate){t.next=25;break}n=f(r),t.prev=4,n.s();case 6:if((a=n.n()).done){t.next=17;break}if((i=a.value).offsetWidth||i.offsetHeight||i.getClientRects().length){t.next=10;break}return t.abrupt("continue",15);case 10:return t.next=12,i.reportValidity();case 12:if(t.sent){t.next=15;break}return t.abrupt("return",!1);case 15:t.next=6;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(4),n.e(t.t0);case 22:return t.prev=22,n.f(),t.finish(22);case 25:return t.abrupt("return",!0);case 26:case"end":return t.stop()}}),t,this,[[4,19,22,25]])}))),function(){return t.apply(this,arguments)})},{key:"submitForm",value:function(){var t=document.createElement("button");this.formElement&&(t.type="submit",t.style.position="absolute",t.style.width="0",t.style.height="0",t.style.clip="rect(0 0 0 0)",t.style.clipPath="inset(50%)",t.style.overflow="hidden",t.style.whiteSpace="nowrap",this.formElement.append(t),t.click(),t.remove())}},{key:"render",value:function(){var t,e=this;return(0,c.h)("div",{key:"afbedd7cc354e641c4b615628c8dbb813729624c",part:"base",class:"form",role:"form"},(0,c.h)("form",{key:"a9b5b52081af16eb861563374927591112f893ce",part:"form",ref:function(t){return e.formElement=t},class:"test",onSubmit:(t=(0,a.A)(u().mark((function t(r){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r.preventDefault(),t.next=3,e.validate();case 3:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:e.scSubmit.emit(),e.scFormSubmit.emit();case 8:case"end":return t.stop()}}),t)}))),function(_x){return t.apply(this,arguments)}),novalidate:this.novalidate},(0,c.h)("slot",{key:"8bdf63e445592e71155c9a7d3db57a88eb0374c3"})))}},{key:"form",get:function(){return(0,c.a)(this)}}]);var t,e,r,s,l}();m.style=":host{display:block}::slotted(*:not(:last-child)){margin-bottom:var(--sc-form-row-spacing, 0.75em)}::slotted(*:not(:last-child)).wp-block-spacer{margin-bottom:0}::slotted(*:focus-within),::slotted(*:active){position:relative;z-index:var(--sc-form-focus-within-z-index, auto);}"}}]);