FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
Edit File: 6415.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[6415],{4805:function(e,t,n){n.d(t,{a:function(){return h},b:function(){return c},g:function(){return d}});var i=n(4467),r=n(3453);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,i=function(){};return{s:i,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:i}}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 r,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,r=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw r}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function c(e){for(var t,n="",i=Object.entries(e);t=i.shift();){var o=t,a=(0,r.A)(o,2),l=a[0],c=a[1];if(Array.isArray(c)||c&&c.constructor===Object){var u,d=s(Object.entries(c).reverse());try{for(d.s();!(u=d.n()).done;){var h=(0,r.A)(u.value,2),p=h[0],f=h[1];i.unshift(["".concat(l,"[").concat(p,"]"),f])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==c&&(null===c&&(c=""),n+="&"+[l,c].map(encodeURIComponent).join("="))}return n.substr(1)}function u(e){try{return decodeURIComponent(e)}catch(t){return e}}function d(e){return(function(e){var t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,t){var n=t.split("=").filter(Boolean).map(u),i=(0,r.A)(n,2),o=i[0],s=i[1],l=void 0===s?"":s;return o&&function(e,t,n){for(var i=t.length,r=i-1,o=0;o<i;o++){var s=t[o];!s&&Array.isArray(e)&&(s=e.length.toString()),s=["__proto__","constructor","prototype"].includes(s)?s.toUpperCase():s;var l=!isNaN(Number(t[o+1]));e[s]=o===r?n:e[s]||(l?[]:{}),Array.isArray(e[s])&&!l&&(e[s]=a({},e[s])),e=e[s]}}(e,o.replace(/\]/g,"").split("["),l),e}),Object.create(null))}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!t||!Object.keys(t).length)return e;var n=e,i=e.indexOf("?");return-1!==i&&(t=Object.assign(d(e),t),n=n.substr(0,i)),n+"?"+c(t)}},5489:function(e,t,n){n.d(t,{c:function(){return c},g:function(){return u}});var i,r=n(467),o=n(9280),a=n.n(o),s=n(4805),l=(null===(i=window.scData)||void 0===i?void 0:i.locale)||navigator.language||(null===navigator||void 0===navigator?void 0:navigator.browserLanguage)||(navigator.languages||["en"])[0],c=function(){var e=(0,r.A)(a().mark((function e(){var t,n,i,r,o,c,u,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,s.a)("https://api.surecart.com/v1/public/atlas",{locale:l}),e.next=3,fetch(o);case 3:return c=e.sent,e.next=6,c.json();case 6:return u=e.sent,d=null===(t=(null==u?void 0:u.data)||[])||void 0===t?void 0:t.map((function(e){return{value:e.code,label:e.name}})),e.abrupt("return",(null===(r=null===(i=null===(n=null===window||void 0===window?void 0:window.wp)||void 0===n?void 0:n.hooks)||void 0===i?void 0:i.applyFilters)||void 0===r?void 0:r.call(i,"surecart_address_countries",d))||d);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),u=function(){var e=(0,r.A)(a().mark((function e(t){var n,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(0,s.a)("https://api.surecart.com/v1/public/atlas/".concat(t),{locale:l}),e.next=3,fetch(n);case 3:return i=e.sent,e.next=6,i.json();case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()},6418:function(e,t,n){n.d(t,{F:function(){return v},p:function(){return m},r:function(){return g}});var i=n(9394),r=n(467),o=n(45),a=n(4467),s=n(3029),l=n(2901),c=n(9280),u=n.n(c),d=["email","name","first_name","last_name","phone","password","shipping_city","shipping_country","shipping_line_1","shipping_line_2","shipping_postal_code","shipping_state","billing_city","billing_country","billing_line_1","billing_line_2","billing_postal_code","billing_state","tax_identifier.number_type","tax_identifier.number"];function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,i=function(){};return{s:i,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:i}}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 r,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,r=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw r}}}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){(0,a.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v=function(){return(0,l.A)((function e(t,n){var i=this;(0,s.A)(this,e),this.form=null,this.input=t,this.options=b({form:function(e){var t,n;return(null===(n=null===(t=i.closestElement("sc-form",e))||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("form"))||i.closestElement("form",e)},name:function(e){return e.name},value:function(e){return e.value},disabled:function(e){return e.disabled}},n),this.form=this.options.form(this.input),this.handleFormData=this.handleFormData.bind(this)}),[{key:"closestElement",value:function(e,t){return t?t&&t!=document&&t!=window&&t.closest(e)||this.closestElement(e,t.getRootNode().host):null}},{key:"addFormData",value:function(){this.form&&this.form.addEventListener("formdata",this.handleFormData)}},{key:"removeFormData",value:function(){this.form&&this.form.removeEventListener("formdata",this.handleFormData)}},{key:"handleFormData",value:function(e){var t=this.options.name(this.input),n=this.options.value(this.input);"string"==typeof t&&void 0!==n&&(Array.isArray(n)?n.forEach((function(n){n&&e.formData.append(t,n.toString())})):n&&e.formData.append(t,n.toString()))}}])}(),m=function(e){var t,n=e.email,i=e.name,r=e.first_name,a=e.last_name,s=e.phone,l=e.password,c=e.shipping_city,u=e.shipping_country,h=e.shipping_line_1,p=e.shipping_line_2,f=e.shipping_postal_code,v=e.shipping_state,m=e.billing_city,g=e.billing_country,_=e.billing_line_1,y=e.billing_line_2,k=e.billing_postal_code,x=e.billing_state,w=e["tax_identifier.number_type"],A=e["tax_identifier.number"],C=(0,o.A)(e,d),I=b(b(b(b(b(b({},c?{city:c}:{}),u?{country:u}:{}),h?{line_1:h}:{}),p?{line_2:p}:{}),f?{postal_code:f}:{}),v?{state:v}:{}),O=b(b(b(b(b(b({},m?{city:m}:{}),g?{country:g}:{}),_?{line_1:_}:{}),y?{line_2:y}:{}),k?{postal_code:k}:{}),x?{state:x}:{});return b(b(b(b(b(b(b(b(b(b({},i?{name:i}:{}),n?{email:n}:{}),r?{first_name:r}:{}),a?{last_name:a}:{}),s?{phone:s}:{}),l?{password:l}:{}),Object.keys(I||{}).length?{shipping_address:I}:{}),Object.keys(O||{}).length?{billing_address:O}:{}),w&&A?{tax_identifier:{number:A,number_type:w}}:{}),(null===(t=Object.keys(C))||void 0===t?void 0:t.length)?{metadata:C}:{})},g=function(){var e=(0,r.A)(u().mark((function e(t){var n,r,o,a;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=(0,i.A)(t.shadowRoot.querySelectorAll("*")).filter((function(e){return"function"==typeof e.reportValidity})),r=h(n),e.prev=2,r.s();case 4:if((o=r.n()).done){e.next=13;break}return a=o.value,e.next=8,a.reportValidity();case 8:if(e.sent){e.next=11;break}return e.abrupt("return",!1);case 11:e.next=4;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(2),r.e(e.t0);case 18:return e.prev=18,r.f(),e.finish(18);case 21:return e.abrupt("return",!0);case 22:case"end":return e.stop()}}),e,null,[[2,15,18,21]])})));return function(_x){return e.apply(this,arguments)}}()},1572:function(e,t,n){n.d(t,{a:function(){return b}});var i=n(2901),r=n(3029);function o(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}function a(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}function s(e,t){return function(n,i,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,l=e[t];if(a(n)&&o(i))if("function"==typeof r)if("number"==typeof s){var c={callback:r,priority:s,namespace:i};if(l[n]){var u,d=l[n].handlers;for(u=d.length;u>0&&!(s>=d[u-1].priority);u--);u===d.length?d[u]=c:d.splice(u,0,c),l.__current.forEach((function(e){e.name===n&&e.currentIndex>=u&&e.currentIndex++}))}else l[n]={handlers:[c],runs:0};"hookAdded"!==n&&e.doAction("hookAdded",n,i,r,s)}else console.error("If specified, the hook priority must be a number.");else console.error("The hook callback must be a function.")}}function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i,r){var s=e[t];if(a(i)&&(n||o(r))){if(!s[i])return 0;var l=0;if(n)l=s[i].handlers.length,s[i]={runs:s[i].runs,handlers:[]};else for(var c=s[i].handlers,u=function(e){c[e].namespace===r&&(c.splice(e,1),l++,s.__current.forEach((function(t){t.name===i&&t.currentIndex>=e&&t.currentIndex--})))},d=c.length-1;d>=0;d--)u(d);return"hookRemoved"!==i&&e.doAction("hookRemoved",i,r),l}}}function c(e,t){return function(n,i){var r=e[t];return void 0!==i?n in r&&r[n].handlers.some((function(e){return e.namespace===i})):n in r}}function u(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(i){var r=e[t];r[i]||(r[i]={handlers:[],runs:0}),r[i].runs++;for(var o=r[i].handlers,a=arguments.length,s=new Array(a>1?a-1:0),l=1;l<a;l++)s[l-1]=arguments[l];if(!o||!o.length)return n?s[0]:void 0;var c={name:i,currentIndex:0};for(r.__current.push(c);c.currentIndex<o.length;){var u=o[c.currentIndex].callback.apply(null,s);n&&(s[0]=u),c.currentIndex++}return r.__current.pop(),n?s[0]:void 0}}function d(e,t){return function(){var n,i,r=e[t];return null!==(i=null===(n=r.__current[r.__current.length-1])||void 0===n?void 0:n.name)&&void 0!==i?i:null}}function h(e,t){return function(n){var i=e[t];return void 0===n?void 0!==i.__current[0]:!!i.__current[0]&&n===i.__current[0].name}}function p(e,t){return function(n){var i=e[t];if(a(n))return i[n]&&i[n].runs?i[n].runs:0}}var f=new((0,i.A)((function e(){(0,r.A)(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=s(this,"actions"),this.addFilter=s(this,"filters"),this.removeAction=l(this,"actions"),this.removeFilter=l(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=l(this,"actions",!0),this.removeAllFilters=l(this,"filters",!0),this.doAction=u(this,"actions"),this.applyFilters=u(this,"filters",!0),this.currentAction=d(this,"actions"),this.currentFilter=d(this,"filters"),this.doingAction=h(this,"actions"),this.doingFilter=h(this,"filters"),this.didAction=p(this,"actions"),this.didFilter=p(this,"filters")}))),b=(f.addAction,f.addFilter,f.removeAction,f.removeFilter,f.hasAction,f.hasFilter,f.removeAllActions,f.removeAllFilters,f.doAction,f.applyFilters);f.currentAction,f.currentFilter,f.doingAction,f.doingFilter,f.didAction,f.didFilter,f.actions,f.filters},6402:function(e,t,n){function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"polite",t=document.createElement("div");t.id="a11y-speak-".concat(e),t.className="a11y-speak-region",t.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),t.setAttribute("aria-live",e),t.setAttribute("aria-relevant","additions text"),t.setAttribute("aria-atomic","true");var n=document.body;return n&&n.appendChild(t),t}n.d(t,{s:function(){return a}});var r,o="";function a(e,t){!function(){for(var e=document.getElementsByClassName("a11y-speak-region"),t=document.getElementById("a11y-speak-intro-text"),n=0;n<e.length;n++)e[n].textContent="";t&&t.setAttribute("hidden","hidden")}(),e=function(e){return e=e.replace(/<[^<>]+>/g," "),o===e&&(e+=" "),o=e,e}(e);var n=document.getElementById("a11y-speak-intro-text"),i=document.getElementById("a11y-speak-assertive"),r=document.getElementById("a11y-speak-polite");i&&"assertive"===t?i.textContent=e:r&&(r.textContent=e),n&&n.removeAttribute("hidden")}r=function(){var e=document.getElementById("a11y-speak-intro-text"),t=document.getElementById("a11y-speak-assertive"),n=document.getElementById("a11y-speak-polite");null===e&&function(){var e=document.createElement("p");e.id="a11y-speak-intro-text",e.className="a11y-speak-intro-text",e.textContent=wp.i18n.__("Notifications"),e.setAttribute("style","position: absolute;margin: -1px;padding: 0;height: 1px;width: 1px;overflow: hidden;clip: rect(1px, 1px, 1px, 1px);-webkit-clip-path: inset(50%);clip-path: inset(50%);border: 0;word-wrap: normal !important;"),e.setAttribute("hidden","hidden");var t=document.body;t&&t.appendChild(e)}(),null===t&&i("assertive"),null===n&&i("polite")},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",r):r())},4493:function(e,t,n){function i(){return"rtl"===document.dir}n.d(t,{i:function(){return i}})},6415:function(e,t,n){n.r(t),n.d(t,{sc_address:function(){return _},sc_checkbox:function(){return k},sc_phone_input:function(){return w},sc_tax_id_input:function(){return A}});var i=n(4467),r=n(467),o=n(3029),a=n(2901),s=n(9280),l=n.n(s),c=n(1346),u=n(5489),d=n(6418),h=n(4493),p=n(1572),f=n(6402),b=n(8674);function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){(0,i.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=[{name:"country",priority:30,label:wp.i18n.__("Country","surecart")},{name:"name",priority:40,label:wp.i18n.__("Name or Company Name","surecart")},{name:"line_1",priority:50,label:wp.i18n.__("Address","surecart")},{name:"line_2",priority:60,label:wp.i18n.__("Line 2","surecart")},{name:"city",priority:70,label:wp.i18n.__("City","surecart")},{name:"state",priority:80,label:wp.i18n.__("State / County","surecart")},{name:"postal_code",priority:90,label:wp.i18n.__("Postal Code","surecart")}],_=function(){return(0,a.A)((function e(t){(0,o.A)(this,e),(0,c.r)(this,t),this.scChangeAddress=(0,c.c)(this,"scChangeAddress",7),this.scInputAddress=(0,c.c)(this,"scInputAddress",7),this.address={country:null,city:null,line_1:null,line_2:null,postal_code:null,state:null},this.names={name:"shipping_name",country:"shipping_country",city:"shipping_city",line_1:"shipping_line_1",line_2:"shipping_line_2",postal_code:"shipping_postal_code",state:"shipping_state"},this.loading=!1,this.disabled=void 0,this.label=void 0,this.showName=void 0,this.showLine2=void 0,this.required=!1,this.requireName=!1,this.showCity=!0,this.showPostal=!0,this.countryDetails=null,this.countryChoices=void 0}),[{key:"handleAddressChange",value:(n=(0,r.A)(l().mark((function e(){var t,n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this.address)||void 0===t?void 0:t.country){e.next=2;break}return e.abrupt("return");case 2:if(this.countryDetails&&(null===(n=this.countryDetails)||void 0===n?void 0:n.code)===this.address.country){e.next=6;break}return e.next=5,(0,u.g)(this.address.country);case 5:this.countryDetails=e.sent;case 6:this.scChangeAddress.emit(this.address),this.scInputAddress.emit(this.address);case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleNameChange",value:function(){this.requireName&&(this.showName=!0)}},{key:"decodeHtmlEntities",value:function(e){var t;return(null===(t=(new DOMParser).parseFromString(e,"text/html"))||void 0===t?void 0:t.body.textContent)||e}},{key:"updateAddress",value:function(e){this.address=m(m({},this.address),e)}},{key:"handleAddressInput",value:function(e){this.scInputAddress.emit(m(m({},this.address),e))}},{key:"clearAddress",value:function(){var e;this.address={name:null===(e=this.address)||void 0===e?void 0:e.name,country:null,city:null,line_1:null,line_2:null,postal_code:null,state:null}}},{key:"componentWillLoad",value:function(){this.initCountryChoices(),this.handleAddressChange(),this.handleNameChange()}},{key:"initCountryChoices",value:(t=(0,r.A)(l().mark((function e(){var t,n,i,r=this;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,u.c)();case 2:this.countryChoices=e.sent,i=(null===(n=null===(t=this.countryChoices)||void 0===t?void 0:t.find((function(e){var t;return e.value===(null===(t=r.address)||void 0===t?void 0:t.country)})))||void 0===n?void 0:n.value)||null,this.updateAddress({country:i});case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reportValidity",value:(e=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,d.r)(this.el));case 1:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"sortedFields",value:function(){var e,t,n,i,r=this;return this.countryDetails&&(null===(e=null==this?void 0:this.address)||void 0===e?void 0:e.country)?(null===(i=null===(n=null===(t=null==this?void 0:this.countryDetails)||void 0===t?void 0:t.address_formats)||void 0===n?void 0:n.edit)||void 0===i?void 0:i.match(/{{([^}]+)}}/g).map((function(e){return e.slice(2,-2)})).map((function(e){var t,n,i;return{name:e,label:(null===(n=null===(t=null==r?void 0:r.countryDetails)||void 0===t?void 0:t.address_labels)||void 0===n?void 0:n[e])||(null===(i=null==g?void 0:g.find((function(t){return(null==t?void 0:t.name)===e})))||void 0===i?void 0:i.label)}})))||[]:g}},{key:"regions",value:function(){var e,t,n,i,r,o=(null===(t=null===(e=null==this?void 0:this.countryDetails)||void 0===e?void 0:e.states)||void 0===t?void 0:t.map((function(e){return{value:null==e?void 0:e.code,label:null==e?void 0:e.name}})))||[];return(null===(i=null===(n=null===window||void 0===window?void 0:window.wp)||void 0===n?void 0:n.hooks)||void 0===i?void 0:i.applyFilters)&&(o=window.wp.hooks.applyFilters("surecart_address_regions",o,null===(r=null==this?void 0:this.address)||void 0===r?void 0:r.country)),o}},{key:"getRoundedProps",value:function(e,t){var n=0===e,i=e===t-1;return{squaredTop:i,squaredBottom:n,squared:!i&&!n}}},{key:"render",value:function(){var e,t,n=this,i=null===(t=null!==(e=this.sortedFields())&&void 0!==e?e:[])||void 0===t?void 0:t.filter((function(e){var t,i,r,o;switch(e.name){case"name":return n.showName;case"line_2":return n.showLine2||!!(null===(i=null===(t=null==n?void 0:n.address)||void 0===t?void 0:t.line_2)||void 0===i?void 0:i.length);case"city":return n.showCity;case"state":return!!(null===(r=null==n?void 0:n.regions())||void 0===r?void 0:r.length)&&!!(null===(o=null==n?void 0:n.address)||void 0===o?void 0:o.country);case"postal_code":return n.showPostal;default:return!0}}));return(0,c.h)("div",{class:"sc-address",part:"base"},(0,c.h)("sc-form-control",{label:this.label,exportparts:"label, help-text, form-control",class:"sc-address__control",required:this.required},i.map((function(e,t){var r,o,a,s,l,u,d,h,p,f,b,v,g,_,y,k,x,w=n.getRoundedProps(t,i.length);switch(e.name){case"country":return(0,c.h)("sc-select",m({exportparts:"base:select__base, input, form-control, label, help-text, trigger, panel, caret, search__base, search__input, search__form-control, menu__base, spinner__base, empty",part:"name__input",value:null===(r=n.address)||void 0===r?void 0:r.country,onScChange:function(e){var t;e.target.value!==(null===(t=n.address)||void 0===t?void 0:t.country)&&(n.clearAddress(),n.updateAddress({country:e.target.value}))},choices:n.countryChoices,autocomplete:"country-name",placeholder:e.label,name:null===(o=n.names)||void 0===o?void 0:o.country,search:!0,unselect:!1,disabled:n.disabled,required:n.required,"aria-label":e.label},w));case"name":return(0,c.h)("sc-input",m({exportparts:"base:input__base, input, form-control, label, help-text",value:null===(a=null==n?void 0:n.address)||void 0===a?void 0:a.name,onScChange:function(e){return n.updateAddress({name:e.target.value||null})},onScInput:function(e){return n.handleAddressInput({name:e.target.value||null})},autocomplete:"street-address",placeholder:e.label,name:null===(s=n.names)||void 0===s?void 0:s.name,disabled:n.disabled,required:n.requireName,"aria-label":e.label},w));case"line_1":return(0,c.h)("sc-input",m({exportparts:"base:input__base, input, form-control, label, help-text",value:null===(l=null==n?void 0:n.address)||void 0===l?void 0:l.line_1,onScChange:function(e){return n.updateAddress({line_1:e.target.value||null})},onScInput:function(e){return n.handleAddressInput({line_1:e.target.value||null})},autocomplete:"street-address",placeholder:e.label,name:null===(u=n.names)||void 0===u?void 0:u.line_1,disabled:n.disabled,required:n.required,"aria-label":e.label},w));case"line_2":return(0,c.h)("sc-input",m({exportparts:"base:input__base, input, form-control, label, help-text",value:null===(d=null==n?void 0:n.address)||void 0===d?void 0:d.line_2,onScChange:function(e){return n.updateAddress({line_2:e.target.value||null})},onScInput:function(e){return n.handleAddressInput({line_2:e.target.value||null})},autocomplete:"street-address",placeholder:e.label,name:null===(h=n.names)||void 0===h?void 0:h.line_2,disabled:n.disabled,"aria-label":e.label},w));case"city":return(0,c.h)("sc-input",m({exportparts:"base:input__base, input, form-control, label, help-text",placeholder:e.label,name:null===(p=n.names)||void 0===p?void 0:p.city,value:null===(f=null==n?void 0:n.address)||void 0===f?void 0:f.city,onScChange:function(e){return n.updateAddress({city:e.target.value||null})},onScInput:function(e){return n.handleAddressInput({city:e.target.value||null})},required:n.required,disabled:n.disabled,"aria-label":e.label},w));case"state":return(0,c.h)("sc-select",m({exportparts:"base:select__base, input, form-control, label, help-text, trigger, panel, caret, search__base, search__input, search__form-control, menu__base, spinner__base, empty",placeholder:e.label,name:null===(b=n.names)||void 0===b?void 0:b.state,autocomplete:"address-level1",value:null===(v=null==n?void 0:n.address)||void 0===v?void 0:v.state,onScChange:function(e){var t;return n.updateAddress({state:e.target.value||(null===(t=e.detail)||void 0===t?void 0:t.value)||null})},choices:n.regions(),required:n.required,disabled:n.disabled,search:!0,"aria-label":e.label},w));case"postal_code":return(0,c.h)("sc-input",m({exportparts:"base:input__base, input, form-control, label, help-text",placeholder:e.label,name:null===(g=n.names)||void 0===g?void 0:g.postal_code,onScChange:function(e){return n.updateAddress({postal_code:e.target.value||null})},onScInput:function(e){return n.handleAddressInput({postal_code:e.target.value||null})},autocomplete:"postal-code",required:n.required,value:null===(_=null==n?void 0:n.address)||void 0===_?void 0:_.postal_code,disabled:n.disabled,maxlength:"US"===(null===(y=n.address)||void 0===y?void 0:y.country)?5:void 0,pattern:(null===(k=n.countryDetails)||void 0===k?void 0:k.postal_code_regex)||void 0,customValidity:(null===(x=n.countryDetails)||void 0===x?void 0:x.postal_code_regex)?wp.i18n.__("Please enter a valid postal code","surecart"):void 0,"aria-label":e.label},w));default:return null}}))),this.loading&&(0,c.h)("sc-block-ui",{exportparts:"base:block-ui, content:block-ui__content"}))}},{key:"el",get:function(){return(0,c.a)(this)}}],[{key:"watchers",get:function(){return{address:["handleAddressChange"],requireName:["handleNameChange"]}}}]);var e,t,n}();_.style=":host{display:block}.sc-address{display:block;position:relative}.sc-address [hidden]{display:none}.sc-address--loading{min-height:230px}.sc-address sc-skeleton{display:block;margin-bottom:1em}.sc-address__control{display:block}.sc-address__control>*{margin-bottom:var(--sc-address-column-spacing, -1px)}.sc-address__columns{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;justify-content:space-between}.sc-address__columns>*{flex:1;width:50%;margin-right:var(--sc-address-column-spacing, -1px)}.sc-address__columns>*:last-child{margin-right:0}";var y=0,k=function(){return(0,a.A)((function e(t){(0,o.A)(this,e),(0,c.r)(this,t),this.scBlur=(0,c.c)(this,"scBlur",7),this.scChange=(0,c.c)(this,"scChange",7),this.scFocus=(0,c.c)(this,"scFocus",7),this.inputId="checkbox-".concat(++y),this.labelId="checkbox-label-".concat(y),this.hasFocus=!1,this.name=void 0,this.value=void 0,this.disabled=!1,this.edit=!1,this.required=!1,this.checked=!1,this.indeterminate=!1,this.invalid=!1}),[{key:"firstUpdated",value:function(){this.input.indeterminate=this.indeterminate}},{key:"triggerClick",value:(i=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.click());case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"triggerFocus",value:(n=(0,r.A)(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.focus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(_x){return n.apply(this,arguments)})},{key:"triggerBlur",value:(t=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.blur());case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reportValidity",value:(e=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.invalid=!this.input.checkValidity(),e.abrupt("return",this.input.reportValidity());case 2:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"setCustomValidity",value:function(e){this.input.setCustomValidity(e),this.invalid=!this.input.checkValidity()}},{key:"handleClick",value:function(){this.checked=!this.checked,this.indeterminate=!1}},{key:"handleBlur",value:function(){this.hasFocus=!1,this.scBlur.emit()}},{key:"handleFocus",value:function(){this.hasFocus=!0,this.scFocus.emit()}},{key:"handleLabelMouseDown",value:function(){this.input.focus()}},{key:"handleStateChange",value:function(){this.input.checked=this.checked,this.input.indeterminate=this.indeterminate,this.scChange.emit()}},{key:"componentDidLoad",value:function(){this.formController=new d.F(this.el,{value:function(e){return e.checked?e.value:void 0}}).addFormData()}},{key:"disconnectedCallback",value:function(){var e;null===(e=this.formController)||void 0===e||e.removeFormData()}},{key:"render",value:function(){var e=this,t=this.edit?"div":"label";return(0,c.h)(t,{key:"4eb715b5f0319a3dadfee764d1da0bfb8fabbcc5",part:"base",class:{checkbox:!0,"checkbox--is-required":this.required,"checkbox--checked":this.checked,"checkbox--disabled":this.disabled,"checkbox--focused":this.hasFocus,"checkbox--indeterminate":this.indeterminate,"checkbox--is-rtl":(0,h.i)()},htmlFor:this.inputId,onMouseDown:function(){return e.handleLabelMouseDown()}},(0,c.h)("span",{key:"526e5f492e3e76508767027d8a24c761cc2a3fb9",part:"control",class:"checkbox__control"},this.checked?(0,c.h)("span",{part:"checked-icon",class:"checkbox__icon"},(0,c.h)("svg",{viewBox:"0 0 16 16"},(0,c.h)("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd","stroke-linecap":"round"},(0,c.h)("g",{stroke:"currentColor","stroke-width":"2"},(0,c.h)("g",{transform:"translate(3.428571, 3.428571)"},(0,c.h)("path",{d:"M0,5.71428571 L3.42857143,9.14285714"}),(0,c.h)("path",{d:"M9.14285714,0 L3.42857143,9.14285714"})))))):"",!this.checked&&this.indeterminate?(0,c.h)("span",{part:"indeterminate-icon",class:"checkbox__icon"},(0,c.h)("svg",{viewBox:"0 0 16 16"},(0,c.h)("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd","stroke-linecap":"round"},(0,c.h)("g",{stroke:"currentColor","stroke-width":"2"},(0,c.h)("g",{transform:"translate(2.285714, 6.857143)"},(0,c.h)("path",{d:"M10.2857143,1.14285714 L1.14285714,1.14285714"})))))):"",(0,c.h)("input",{key:"6b77f0b4a28e43c35419f16b593820461bb6d027",id:this.inputId,ref:function(t){return e.input=t},type:"checkbox",name:this.name,value:this.value,checked:this.checked,disabled:this.disabled,required:this.required,role:"checkbox","aria-checked":this.checked?"true":"false","aria-labelledby":this.labelId,onClick:function(){return e.handleClick()},onBlur:function(){return e.handleBlur()},onFocus:function(){return e.handleFocus()}})),(0,c.h)("span",{key:"f6c703ec8424d6e6a4528e16e33b03725f7ce33f",part:"label",id:this.labelId,class:"checkbox__label"},(0,c.h)("slot",{key:"a8fd2a76889fdd3fff577cffef0c1f2e93a835df"})))}},{key:"el",get:function(){return(0,c.a)(this)}}],[{key:"watchers",get:function(){return{checked:["handleStateChange"],indeterminate:["handleStateChange"]}}}]);var e,t,n,i}();k.style=':host{display:block}.checkbox{display:flex;font-family:var(--sc-input-font-family);font-size:var(--sc-input-font-size-medium);font-weight:var(--sc-input-font-weight);color:var(--sc-input-color);vertical-align:middle;cursor:pointer}.checkbox__control{flex:0 0 auto;position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--sc-checkbox-size);height:var(--sc-checkbox-size);border:solid var(--sc-input-border-width) var(--sc-input-border-color);border-radius:2px;background-color:var(--sc-input-background-color);color:var(--sc-color-white);transition:var(--sc-input-transition, var(--sc-transition-medium)) border-color, var(--sc-input-transition, var(--sc-transition-medium)) opacity, var(--sc-input-transition, var(--sc-transition-medium)) background-color, var(--sc-input-transition, var(--sc-transition-medium)) color, var(--sc-input-transition, var(--sc-transition-medium)) box-shadow}.checkbox__control input[type=checkbox]{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}.checkbox__control .checkbox__icon{display:inline-flex;width:var(--sc-checkbox-size);height:var(--sc-checkbox-size)}.checkbox__control .checkbox__icon svg{width:100%;height:100%}.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover{border-color:var(--sc-input-border-color-hover);background-color:var(--sc-input-background-color-hover)}.checkbox.checkbox--focused:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control{border-color:var(--sc-input-border-color-focus);background-color:var(--sc-input-background-color-focus);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.checkbox--checked .checkbox__control,.checkbox--indeterminate .checkbox__control{border-color:var(--sc-color-primary-500);background-color:var(--sc-color-primary-500)}.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover{opacity:0.8}.checkbox.checkbox--checked:not(.checkbox--disabled).checkbox--focused .checkbox__control,.checkbox.checkbox--indeterminate:not(.checkbox--disabled).checkbox--focused .checkbox__control{border-color:var(--sc-color-white);background-color:var(--sc-color-primary-500);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.checkbox--disabled{opacity:0.5;cursor:not-allowed}.checkbox__label{line-height:var(--sc-checkbox-size);margin-top:var(--sc-input-border-width);margin-left:0.5em;flex:1}.checkbox--is-required .checkbox__label:after{content:" *";color:var(--sc-color-danger-500)}::slotted(*){display:inline-block}.checkbox--is-rtl .checkbox__label{margin-left:0;margin-right:0.5em}';var x=0,w=function(){return(0,a.A)((function e(t){(0,o.A)(this,e),(0,c.r)(this,t),this.scChange=(0,c.c)(this,"scChange",7),this.scClear=(0,c.c)(this,"scClear",7),this.scInput=(0,c.c)(this,"scInput",7),this.scFocus=(0,c.c)(this,"scFocus",7),this.scBlur=(0,c.c)(this,"scBlur",7),this.inputId="phone-input-".concat(++x),this.helpId="phone-input-help-text-".concat(x),this.labelId="phone-input-label-".concat(x),this.squared=void 0,this.squaredBottom=void 0,this.squaredTop=void 0,this.squaredLeft=void 0,this.squaredRight=void 0,this.hidden=!1,this.size="medium",this.name=void 0,this.value="",this.pill=!1,this.label=void 0,this.showLabel=!0,this.help="",this.clearable=!1,this.togglePassword=!1,this.placeholder=void 0,this.disabled=!1,this.readonly=!1,this.minlength=void 0,this.maxlength=void 0,this.min=void 0,this.max=void 0,this.step=void 0,this.pattern="[-s#0-9_+/().]*",this.required=!1,this.invalid=!1,this.autocorrect=void 0,this.autocomplete=void 0,this.autofocus=void 0,this.spellcheck=void 0,this.hasFocus=void 0}),[{key:"reportValidity",value:(i=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.reportValidity());case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"triggerFocus",value:(n=(0,r.A)(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.focus(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setCustomValidity",value:(t=(0,r.A)(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.input.setCustomValidity(t),this.invalid=!this.input.checkValidity();case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"triggerBlur",value:(e=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.blur());case 1:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"select",value:function(){return this.input.select()}},{key:"handleBlur",value:function(){this.hasFocus=!1,this.scBlur.emit()}},{key:"handleFocus",value:function(){this.hasFocus=!0,this.scFocus.emit()}},{key:"handleChange",value:function(){this.value=this.input.value,this.scChange.emit()}},{key:"handleInput",value:function(){this.value=this.input.value.replace(/\s/g,""),this.input.value=this.value,this.scInput.emit()}},{key:"handleClearClick",value:function(e){this.value="",this.scClear.emit(),this.scInput.emit(),this.scChange.emit(),this.input.focus(),e.stopPropagation()}},{key:"handleFocusChange",value:function(){var e=this;setTimeout((function(){e.hasFocus&&e.input?e.input.focus():e.input.blur()}),0)}},{key:"handleValueChange",value:function(){this.input&&(this.invalid=!this.input.checkValidity())}},{key:"componentDidLoad",value:function(){this.formController=new d.F(this.el).addFormData(),this.handleFocusChange()}},{key:"disconnectedCallback",value:function(){var e;null===(e=this.formController)||void 0===e||e.removeFormData()}},{key:"render",value:function(){var e,t=this;return(0,c.h)(c.H,{key:"c400aa89456e653998a965b03f2e763e09cb1dec",hidden:this.hidden},(0,c.h)("sc-form-control",{key:"b4690849c56022025c183f21becffac8d2ffeb68",exportparts:"label, help-text, form-control",size:this.size,required:this.required,label:this.label,showLabel:this.showLabel,help:this.help,inputId:this.inputId,helpId:this.helpId,labelId:this.labelId,name:this.name,"aria-label":this.label},(0,c.h)("slot",{key:"12c42616bdfd7d6720ef6e1928b3d17e730900a5",name:"label-end",slot:"label-end"}),(0,c.h)("div",{key:"0fffaf6bc7273b4ed76c1ed57deff7d7518f26a9",part:"base",class:{input:!0,"input--small":"small"===this.size,"input--medium":"medium"===this.size,"input--large":"large"===this.size,"input--focused":this.hasFocus,"input--invalid":this.invalid,"input--disabled":this.disabled,"input--squared":this.squared,"input--squared-bottom":this.squaredBottom,"input--squared-top":this.squaredTop,"input--squared-left":this.squaredLeft,"input--squared-right":this.squaredRight}},(0,c.h)("span",{key:"0f5474834cda4d523fd4666ac3feaecc2c9becfe",part:"prefix",class:"input__prefix"},(0,c.h)("slot",{key:"31a4bfd47440734eabae72231ec05f1b30d8d8e0",name:"prefix"})),(0,c.h)("slot",{key:"54ab62d1340629a1f9d2b6d659230afa5974a6f1"},(0,c.h)("input",{key:"cc7ffb08ba1b05f3c5660ecb684f4042c8bb1b13",part:"input",id:this.inputId,class:"input__control",ref:function(e){return t.input=e},type:"tel",name:this.name,disabled:this.disabled,readonly:this.readonly,required:this.required,placeholder:this.placeholder,minlength:this.minlength,maxlength:this.maxlength,min:this.min,max:this.max,step:this.step,autocomplete:"tel",autocorrect:this.autocorrect,autofocus:this.autofocus,spellcheck:this.spellcheck,pattern:(0,p.a)("surecart/sc-phone-input/pattern",this.pattern),inputmode:"numeric","aria-label":this.label,"aria-labelledby":this.label,"aria-invalid":!!this.invalid,value:this.value,onChange:function(){return t.handleChange()},onInput:function(){return t.handleInput()},onFocus:function(){return t.handleFocus()},onBlur:function(){return t.handleBlur()}})),(0,c.h)("span",{key:"ca0a6164dd0b1587dcf64817c958dc9c0c22a7c0",part:"suffix",class:"input__suffix"},(0,c.h)("slot",{key:"45face690832301b52cc3292920e461c33df46e7",name:"suffix"})),this.clearable&&(null===(e=this.value)||void 0===e?void 0:e.length)>0&&(0,c.h)("button",{key:"d2c64a0c4778df16d1e37936059e5d48348b54f9",part:"clear-button",class:"input__clear",type:"button",onClick:function(e){return t.handleClearClick(e)},tabindex:"-1"},(0,c.h)("slot",{key:"3ee1f703818f71adc990fa99e8f6111c6182a38b",name:"clear-icon"},(0,c.h)("svg",{key:"406b368a9a595ad2f95426885a54a329defc9549",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-x"},(0,c.h)("line",{key:"81f3db4ad15ffc9b19630415f46530aa8a8a0ebc",x1:"18",y1:"6",x2:"6",y2:"18"}),(0,c.h)("line",{key:"52ed62399a365e89ef6b4d521c39a1ec2c73331c",x1:"6",y1:"6",x2:"18",y2:"18"})))))))}},{key:"el",get:function(){return(0,c.a)(this)}}],[{key:"watchers",get:function(){return{hasFocus:["handleFocusChange"],value:["handleValueChange"]}}}]);var e,t,n,i}();w.style=":host{--focus-ring:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary);display:block;position:relative}:host([invalid]) .input,:host([invalid]) .input:hover:not(.input--disabled),:host([invalid]) .input--focused:not(.input--disabled){border-color:var(--sc-input-border-color-invalid);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-input-border-color-invalid)}.input__control[type=number]{-moz-appearance:textfield}.input__control::-webkit-outer-spin-button,.input__control::-webkit-inner-spin-button{-webkit-appearance:none}.input{flex:1 1 auto;display:inline-flex;align-items:center;justify-content:start;position:relative;width:100%;box-sizing:border-box;font-family:var(--sc-input-font-family);font-weight:var(--sc-input-font-weight);letter-spacing:var(--sc-input-letter-spacing);background-color:var(--sc-input-background-color);border:solid 1px var(--sc-input-border-color, var(--sc-input-border));vertical-align:middle;box-shadow:var(--sc-input-box-shadow);transition:var(--sc-transition-fast) color, var(--sc-transition-fast) border, var(--sc-transition-fast) box-shadow;cursor:text}.input:hover:not(.input--disabled){background-color:var(--sc-input-background-color-hover);border-color:var(--sc-input-border-color-hover);z-index:7}.input:hover:not(.input--disabled) .input__control{color:var(--sc-input-color-hover)}.input.input--focused:not(.input--disabled){background-color:var(--sc-input-background-color-focus);border-color:var(--sc-input-border-color-focus);box-shadow:var(--focus-ring);z-index:8}.input.input--focused:not(.input--disabled) .input__control{color:var(--sc-input-color-focus)}.input.input--disabled{background-color:var(--sc-input-background-color-disabled);border-color:var(--sc-input-border-color-disabled);opacity:0.5;cursor:not-allowed}.input.input--disabled .input__control{color:var(--sc-input-color-disabled)}.input.input--disabled .input__control::placeholder{color:var(--sc-input-placeholder-color-disabled)}.input__control{flex:1 1 auto;font-family:inherit;font-size:inherit;font-weight:inherit;min-width:0;height:100%;color:var(--sc-input-color);border:none;background:none;box-shadow:none;padding:0;margin:0;cursor:inherit;-webkit-appearance:none}.input__control::-webkit-search-decoration,.input__control::-webkit-search-cancel-button,.input__control::-webkit-search-results-button,.input__control::-webkit-search-results-decoration{-webkit-appearance:none}.input__control:-webkit-autofill,.input__control:-webkit-autofill:hover,.input__control:-webkit-autofill:focus,.input__control:-webkit-autofill:active{box-shadow:0 0 0 var(--sc-input-height-large) var(--sc-input-background-color-hover) inset !important;-webkit-text-fill-color:var(--sc-input-color)}.input__control::placeholder{color:var(--sc-input-placeholder-color);user-select:none}.input__control:focus{outline:none}.input__prefix,.input__suffix{display:inline-flex;flex:0 0 auto;align-items:center;color:var(--sc-input-color);cursor:default}.input__prefix ::slotted(sc-icon),.input__suffix ::slotted(sc-icon){color:var(--sc-input-icon-color)}.input--small{border-radius:var(--sc-input-border-radius-small);font-size:var(--sc-input-font-size-small);height:var(--sc-input-height-small)}.input--small .input__control{height:calc(var(--sc-input-height-small) - var(--sc-input-border-width) * 2);padding:0 var(--sc-input-spacing-small)}.input--small .input__clear,.input--small .input__password-toggle{margin-right:var(--sc-input-spacing-small)}.input--small .input__prefix ::slotted(*){margin-left:var(--sc-input-spacing-small)}.input--small .input__suffix ::slotted(*){margin-right:var(--sc-input-spacing-small)}.input--small .input__suffix ::slotted(sc-dropdown){margin:0}.input--medium{border-radius:var(--sc-input-border-radius-medium);font-size:var(--sc-input-font-size-medium);height:var(--sc-input-height-medium)}.input--medium .input__control{height:calc(var(--sc-input-height-medium) - var(--sc-input-border-width) * 2);padding:0 var(--sc-input-spacing-medium)}.input--medium .input__clear,.input--medium .input__password-toggle{margin-right:var(--sc-input-spacing-medium)}.input--medium .input__prefix ::slotted(*){margin-left:var(--sc-input-spacing-medium) !important}.input--medium .input__suffix ::slotted(:not(sc-button[size=medium])){margin-right:var(--sc-input-spacing-medium) !important}.input--medium .input__suffix ::slotted(sc-tag){margin-right:var(--sc-input-spacing-small) !important}.input--medium .input__suffix ::slotted(sc-dropdown){margin:3px}.input--large{border-radius:var(--sc-input-border-radius-large);font-size:var(--sc-input-font-size-large);height:var(--sc-input-height-large)}.input--large .input__control{height:calc(var(--sc-input-height-large) - var(--sc-input-border-width) * 2);padding:0 var(--sc-input-spacing-large)}.input--large .input__clear,.input--large .input__password-toggle{margin-right:var(--sc-input-spacing-large)}.input--large .input__prefix ::slotted(*){margin-left:var(--sc-input-spacing-large)}.input--large .input__suffix ::slotted(*){margin-right:var(--sc-input-spacing-large)}.input--large .input__suffix ::slotted(sc-dropdown){margin:3px}.input--pill.input--small{border-radius:var(--sc-input-height-small)}.input--pill.input--medium{border-radius:var(--sc-input-height-medium)}.input--pill.input--large{border-radius:var(--sc-input-height-large)}.input__clear,.input__password-toggle{display:inline-flex;align-items:center;font-size:inherit;color:var(--sc-input-icon-color);border:none;background:none;padding:0;transition:var(--sc-transition-fast) color;cursor:pointer}.input__clear:hover,.input__password-toggle:hover{color:var(--sc-input-icon-color-hover)}.input__clear:focus,.input__password-toggle:focus{outline:none}.input--empty .input__clear{visibility:hidden}.input--squared{border-radius:0}.input--squared-top{border-top-left-radius:0;border-top-right-radius:0}.input--squared-bottom{border-bottom-left-radius:0;border-bottom-right-radius:0}.input--squared-left{border-top-left-radius:0;border-bottom-left-radius:0}.input--squared-right{border-top-right-radius:0;border-bottom-right-radius:0}";var A=function(){return(0,a.A)((function e(t){(0,o.A)(this,e),(0,c.r)(this,t),this.scChange=(0,c.c)(this,"scChange",7),this.scInput=(0,c.c)(this,"scInput",7),this.scInputType=(0,c.c)(this,"scInputType",7),this.scSetState=(0,c.c)(this,"scSetState",7),this.country=void 0,this.show=!1,this.type="other",this.number=null,this.status="unknown",this.loading=void 0,this.help=void 0,this.otherLabel=wp.i18n.__("Tax ID","surecart"),this.caGstLabel=wp.i18n.__("GST Number","surecart"),this.auAbnLabel=wp.i18n.__("ABN Number","surecart"),this.gbVatLabel=wp.i18n.__("UK VAT","surecart"),this.euVatLabel=wp.i18n.__("EU VAT","surecart"),this.taxIdTypes=[],this.required=!1}),[{key:"reportValidity",value:(e=(0,r.A)(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.input.reportValidity());case 1:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"onLabelChange",value:function(){b.z.ca_gst.label=this.caGstLabel||b.z.ca_gst.label,b.z.au_abn.label=this.auAbnLabel||b.z.au_abn.label,b.z.gb_vat.label=this.gbVatLabel||b.z.gb_vat.label,b.z.eu_vat.label=this.euVatLabel||b.z.eu_vat.label,b.z.other.label=this.otherLabel||b.z.other.label}},{key:"componentWillLoad",value:function(){this.onLabelChange()}},{key:"renderStatus",value:function(){return"valid"===this.status?(0,c.h)("sc-icon",{name:"check",slot:"prefix",style:{color:"var(--sc-color-success-500)"}}):"invalid"===this.status?(0,c.h)("sc-icon",{name:"x",slot:"prefix",style:{color:"var(--sc-color-danger-500)"}}):void 0}},{key:"filteredZones",value:function(){var e=this;return this.taxIdTypes.length?Object.keys(b.z).filter((function(t){return e.taxIdTypes.includes(t)})).reduce((function(e,t){return e[t]=b.z[t],e}),{}):b.z}},{key:"onTaxIdTypesChange",value:function(){this.taxIdTypes.length&&(this.type=this.taxIdTypes.includes("other")?"other":this.taxIdTypes[0])}},{key:"getZoneLabel",value:function(){var e,t,n=this.filteredZones()||{};return(null===(e=null==n?void 0:n[(null==this?void 0:this.type)||"other"])||void 0===e?void 0:e.label)||(null===(t=null==n?void 0:n[Object.keys(n)[0]])||void 0===t?void 0:t.label)}},{key:"render",value:function(){var e,t,n,i,r,o=this;return(0,c.h)(c.F,{key:"09421dace8755664f820e1598dcffc7f3d5eb82e"},(0,c.h)("sc-input",{key:"3b851945b1be62ef6ba5ca48aa0f8e9b733939c1",name:"tax_identifier.number_type",required:this.required,value:this.type,style:{display:"none"}}),(0,c.h)("sc-input",{key:"4d536d5aa34a4c97df9e3041ec72140657b8d51c",ref:function(e){return o.input=e},label:this.getZoneLabel(),"aria-label":wp.i18n.__("Tax ID","surecart"),placeholder:wp.i18n.__("Enter Tax ID","surecart"),name:"tax_identifier.number",value:this.number,onScInput:function(e){e.stopImmediatePropagation(),o.scInput.emit({number:e.target.value,number_type:o.type||"other"})},onScChange:function(e){e.stopImmediatePropagation(),o.scChange.emit({number:e.target.value,number_type:o.type||"other"})},help:this.help,required:this.required},this.loading&&"eu_vat"===this.type?(0,c.h)("sc-spinner",{slot:"prefix",style:{"--spinner-size":"10px"}}):this.renderStatus(),1===(null===(e=Object.keys(this.filteredZones()||{}))||void 0===e?void 0:e.length)?(0,c.h)("span",{slot:"suffix"},null===(n=null===(t=Object.values(this.filteredZones()||{}))||void 0===t?void 0:t[0])||void 0===n?void 0:n.label_small):(0,c.h)("sc-dropdown",{slot:"suffix",position:"bottom-right",role:"select","aria-multiselectable":"false","aria-label":wp.i18n.__("Select number type","surecart")},(0,c.h)("sc-button",{type:"text",slot:"trigger",caret:!0,loading:!1,style:{color:"var(--sc-input-label-color)"},tabindex:"0"},null===(r=null===(i=this.filteredZones())||void 0===i?void 0:i[(null==this?void 0:this.type)||"other"])||void 0===r?void 0:r.label_small),(0,c.h)("sc-menu",null,Object.keys(this.filteredZones()||{}).map((function(e){return(0,c.h)("sc-menu-item",{role:"option",onClick:function(){o.scInput.emit({number:o.number,number_type:e}),o.scChange.emit({number:o.number,number_type:e}),o.type=e},onKeyDown:function(t){var n;"Enter"===t.key&&(o.scInput.emit({number:o.number,number_type:e}),o.scChange.emit({number:o.number,number_type:e}),o.type=e,null===(n=o.input)||void 0===n||n.triggerFocus(),(0,f.s)(wp.i18n.sprintf(wp.i18n.__("%s selected","surecart"),b.z[e].label_small,"assertive")))},checked:o.type===e,"aria-selected":o.type===e?"true":"false","aria-label":b.z[e].label_small},b.z[e].label_small)}))))))}}],[{key:"watchers",get:function(){return{otherLabel:["onLabelChange"],caGstLabel:["onLabelChange"],auAbnLabel:["onLabelChange"],gbVatLabel:["onLabelChange"],euVatLabel:["onLabelChange"],taxIdTypes:["onTaxIdTypesChange"]}}}]);var e}();A.style=":host{display:block;z-index:3;position:relative}"},8674:function(e,t,n){n.d(t,{f:function(){return r},z:function(){return i}});var i={ca_gst:{label:wp.i18n.__("GST Number","surecart"),label_small:wp.i18n.__("CA GST","surecart")},au_abn:{label:wp.i18n.__("ABN Number","surecart"),label_small:wp.i18n.__("AU ABN","surecart")},gb_vat:{label:wp.i18n.__("VAT Number","surecart"),label_small:wp.i18n.__("UK VAT","surecart")},eu_vat:{label:wp.i18n.__("VAT Number","surecart"),label_small:wp.i18n.__("EU VAT","surecart")},other:{label:wp.i18n.__("Tax ID","surecart"),label_small:wp.i18n.__("Other","surecart")}},r=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?wp.i18n.__("Estimated Tax","surecart"):wp.i18n.__("Tax","surecart");return e?"".concat(t,": ").concat(e):t}}}]);
Save
Back