6 lines
96 KiB
JavaScript
6 lines
96 KiB
JavaScript
|
(()=>{var e={184:(e,t)=>{var n;!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var i=r.apply(null,n);i&&e.push(i)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var s in n)o.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()},856:function(e){e.exports=function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(e,o,r){return n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,n,o){var r=[null];r.push.apply(r,n);var a=new(Function.bind.apply(e,r));return o&&t(a,o.prototype),a},n.apply(null,arguments)}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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)?r(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var a=Object.hasOwnProperty,i=Object.setPrototypeOf,s=Object.isFrozen,l=Object.getPrototypeOf,c=Object.getOwnPropertyDescriptor,u=Object.freeze,d=Object.seal,p=Object.create,m="undefined"!=typeof Reflect&&Reflect,f=m.apply,h=m.construct;f||(f=function(e,t,n){return e.apply(t,n)}),u||(u=function(e){return e}),d||(d=function(e){return e}),h||(h=function(e,t){return n(e,o(t))});var g,v=k(Array.prototype.forEach),C=k(Array.prototype.pop),y=k(Array.prototype.push),E=k(String.prototype.toLowerCase),b=k(String.prototype.toString),w=k(String.prototype.match),N=k(String.prototype.replace),S=k(String.prototype.indexOf),x=k(String.prototype.trim),A=k(RegExp.prototype.test),T=(g=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h(g,t)});function k(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return f(e,t,o)}}function _(e,t,n){var o;n=null!==(o=n)&&void 0!==o?o:E,i&&i(e,null);for(var r=t.length;r--;){var a=t[r];if("string"==typeof a){var l=n(a);l!==a&&(s(t)||(t[r]=l),a=l)}e[a]=!0}return e}function R(e){var t,n=p(null);for(t in e)!0===f(a,e,[t])&&(n[t]=e[t]);return n}function M(e,t){for(;null!==e;){var n=c(e,t);if(n){if(n.get)return k(n.get);if("function"==typeof n.value)return k(n.value)}e=l(e)}return function(e){return console.warn("fallback value for",e),null}}var L=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","pr
|
||
|
(0,h._n)("Show %s more option","Show %s more options",t,"woocommerce"),t)},(0,h.sprintf)(/* translators: %s number of options to reveal. */
|
||
|
(0,h._n)("Show %s more","Show %s more",t,"woocommerce"),t)))}),[o,c,u]),f=(0,a.useMemo)((()=>u&&(0,e.createElement)("li",{key:"show-less",className:"show-less"},(0,e.createElement)("button",{onClick:()=>{d(!1)},"aria-expanded":!0,"aria-label":(0,h.__)("Show less options","woocommerce")},(0,h.__)("Show less","woocommerce")))),[u]),g=(0,a.useMemo)((()=>{const t=o.length>c+5;return(0,e.createElement)(a.Fragment,null,o.map(((o,i)=>(0,e.createElement)(a.Fragment,{key:o.value},(0,e.createElement)("li",{...t&&!u&&i>=c&&{hidden:!0}},(0,e.createElement)(te.CheckboxControl,{id:o.value,className:"wc-block-checkbox-list__checkbox",label:o.label,checked:r.includes(o.value),onChange:()=>{n(o.value)},disabled:l})),t&&i===c-1&&m))),t&&f)}),[o,n,r,u,c,f,m,l]),v=s()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return(0,e.createElement)("ul",{className:v},i?p:g)};n(708);const oe=({text:t,screenReaderText:n="",element:o="li",className:r="",radius:a="small",children:i=null,...l})=>{const c=o,u=s()(r,"wc-block-components-chip","wc-block-components-chip--radius-"+a),d=Boolean(n&&n!==t);return(0,e.createElement)(c,{className:u,...l},(0,e.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&(0,e.createElement)("span",{className:"screen-reader-text"},n),i)},re=(0,a.forwardRef)((function({icon:e,size:t=24,...n},o){return(0,a.cloneElement)(e,{width:t,height:t,...n,ref:o})})),ae=(0,e.createElement)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(m.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),ie=({ariaLabel:t="",className:n="",disabled:o=!1,onRemove:r=(()=>{}),removeOnAnyClick:a=!1,text:i,screenReaderText:l="",...c})=>{const u=a?"span":"button";if(!t){const e=l&&"string"==typeof l?l:i;t="string"!=typeof e?/* translators: Remove chip. */
|
||
|
(0,h.__)("Remove","woocommerce"):(0,h.sprintf)(/* translators: %s text of the chip to remove. */
|
||
|
(0,h.__)('Remove "%s"',"woocommerce"),e)}const d={"aria-label":t,disabled:o,onClick:r,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||r()}},p=a?d:{},m=a?{"aria-hidden":!0}:d;return(0,e.createElement)(oe,{...c,...p,className:s()(n,"is-removable"),element:a?"button":c.element,screenReaderText:l,text:i},(0,e.createElement)(u,{className:"wc-block-components-chip__remove",...m},(0,e.createElement)(re,{className:"wc-block-components-chip__remove-icon",icon:ae,size:16,role:"img"})))};n(656),n(47);const se=({children:t,className:n="",headingLevel:o,...r})=>{const a=s()("wc-block-components-title",n),i=`h${o}`;return(0,e.createElement)(i,{className:a,...r},t)},le=({title:t,stepHeadingContent:n})=>(0,e.createElement)("div",{className:"wc-block-components-checkout-step__heading"},(0,e.createElement)(se,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!n&&(0,e.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},n)),ce=({id:t,className:n,title:o,legend:r,description:a,children:i,disabled:l=!1,showStepNumber:c=!0,stepHeadingContent:u=(()=>{})})=>{const d=r||o?"fieldset":"div";return(0,e.createElement)(d,{className:s()(n,"wc-block-components-checkout-step",{"wc-block-components-checkout-step--with-step-number":c,"wc-block-components-checkout-step--disabled":l}),id:t,disabled:l},!(!r&&!o)&&(0,e.createElement)("legend",{className:"screen-reader-text"},r||o),!!o&&(0,e.createElement)(le,{title:o,stepHeadingContent:u()}),(0,e.createElement)("div",{className:"wc-block-components-checkout-step__container"},!!a&&(0,e.createElement)("p",{className:"wc-block-components-checkout-step__description"},a),(0,e.createElement)("div",{className:"wc-block-components-checkout-step__content"},i)))};function ue(){}function de(e){return!!(e||"").match(/\d/)}function pe(e){return null==e}function me(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function fe(e,t){void 0===t&&(t=!0);var n="-"===e[0],o=n&&t,r=(e=e.replace("-","")).split(".");return{beforeDecimal:r[0],afterDecimal:r[1]||"",hasNagation:n,addNegation:o}}function he(e,t,n){for(var o="",r=n?"0":"",a=0;a<=t-1;a++)o+=e[a]||r;return o}function ge(e,t){return Array(t+1).join(e)}function ve(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function Ce(e,t,n){return Math.min(Math.max(e,t),n)}function ye(e){return Math.max(e.selectionStart,e.selectionEnd)}var Ee={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:ue,onChange:ue,onKeyDown:ue,onMouseUp:ue,onFocus:ue,onBlur:ue,isAllowed:function(){return!0}},be=function(e){function n(t){e.call(this,t);var n=t.defaultValue;this.validateProps();var o=this.formatValueProp(n);this.state={value:o,numAsString:this.removeFormatting(o),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){this.setState({mounted:!0})},n.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},n.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},n.prototype.updateValueIfRequired=function(e){var t=this,n=t.props,o=t.state,r=t.focusedElm,a=o.value,i=o.numAsString;if(void 0===i&&(i=""),e!==n){this.validateProps();var s=this.formatNumString(i),l=pe(n.value)?s:this.formatValueProp(),c=this.removeFormatting(l),u=parseFloat(c),d=parseFloat(i);(isNaN(u)&&isNaN(d)||u===d)&&s===a&&(null!==r||l===a)||this.updateValue({formattedValue:l,numAsString:c,
|
||
|
(0,h.__)("Please enter a valid %s","woocommerce"),e.toLowerCase());return r||a||i?s:t.validationMessage||s};var It=n(890);const Pt=new Map([["BA",/^([7-8]{1})([0-9]{4})$/],["GB",/^([A-Z]){1}([0-9]{1,2}|[A-Z][0-9][A-Z]|[A-Z][0-9]{2}|[A-Z][0-9]|[0-9][A-Z]){1}([ ])?([0-9][A-Z]{2}){1}|BFPO(?:\s)?([0-9]{1,4})$|BFPO(c\/o[0-9]{1,3})$/i],["IN",/^[1-9]{1}[0-9]{2}\s{0,1}[0-9]{3}$/],["JP",/^([0-9]{3})([-]?)([0-9]{4})$/],["KH",/^[0-9]{6}$/],["LI",/^(94[8-9][0-9])$/],["NI",/^[1-9]{1}[0-9]{4}$/],["NL",/^([1-9][0-9]{3})(\s?)(?!SA|SD|SS)[A-Z]{2}$/i],["SI",/^([1-9][0-9]{3})$/]]),Ft=(new Map([...It.O,...Pt]),(0,a.forwardRef)((({className:t,id:n,type:o="text",ariaDescribedBy:r,errorId:i,focusOnMount:l=!1,onChange:c,showError:u=!0,errorMessage:p="",value:m="",customValidation:f=(()=>!0),customFormatter:h=(e=>e),label:g,validateOnMount:v=!0,instanceId:C="",...y},E)=>{const[b,w]=(0,a.useState)(!0),N=qe(m),S=(0,a.useRef)(null),x=(0,d.useInstanceId)(Ft,"",C),A=void 0!==n?n:"textinput-"+x,T=void 0!==i?i:A,{setValidationErrors:k,hideValidationError:_,clearValidationError:R}=(0,Ze.useDispatch)(Ke.VALIDATION_STORE_KEY),M=(0,a.useRef)(f);(0,a.useEffect)((()=>{M.current=f}),[f]);const{validationError:L,validationErrorId:O}=(0,Ze.useSelect)((e=>{const t=e(Ke.VALIDATION_STORE_KEY);return{validationError:t.getValidationError(T),validationErrorId:t.getValidationErrorId(T)}})),D=(0,a.useCallback)(((e=!0)=>{const t=S.current||null;null!==t&&(t.value=t.value.trim(),t.setCustomValidity(""),t.checkValidity()&&M.current(t)?R(T):k({[T]:{message:g?$t(g,t):t.validationMessage,hidden:e}}))}),[R,T,k,g]);var $;(0,a.useImperativeHandle)(E,(function(){return{revalidate(){D(!m)}}}),[D,m]),(0,a.useEffect)((()=>{var e,t;if(m!==N&&(m||N)&&S&&null!==S.current&&(null===(e=S.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==S.current){const e=h(S.current.value);e!==m?c(e):D(!0)}}),[D,h,m,N,c]),(0,a.useEffect)((()=>{var e;b&&(w(!1),l&&(null===(e=S.current)||void 0===e||e.focus()),!v&&l||D(!0))}),[v,l,b,w,D]),(0,a.useEffect)((()=>()=>{R(T)}),[R,T]),""!==p&&(!(e=>null===e)($=L)&&$ instanceof Object&&$.constructor===Object)&&(L.message=p);const I=(null==L?void 0:L.message)&&!(null!=L&&L.hidden),P=u&&I&&O?O:r;return(0,e.createElement)(Lt,{className:s()(t,{"has-error":I}),"aria-invalid":!0===I,id:A,type:o,feedback:u?(0,e.createElement)(Ot,{errorMessage:p,propertyName:T}):null,ref:S,onChange:e=>{_(T),D(!0);const t=h(e);t!==m&&c(t)},onBlur:()=>D(!1),ariaDescribedBy:P,value:m,title:"",label:g,...y})}))),Bt=Ft;n(943);const Ht=({value:t,currency:n})=>(0,a.isValidElement)(t)?(0,e.createElement)("div",{className:"wc-block-components-totals-item__value"},t):Number.isFinite(t)?(0,e.createElement)(Se,{className:"wc-block-components-totals-item__value",currency:n||{},value:t}):null,Vt=({className:t,currency:n,label:o,value:r,description:a})=>(0,e.createElement)("div",{className:s()("wc-block-components-totals-item",t)},(0,e.createElement)("span",{className:"wc-block-components-totals-item__label"},o),(0,e.createElement)(Ht,{value:r,currency:n}),(0,e.createElement)("div",{className:"wc-block-components-totals-item__description"},a)),Ut=window.wc.wcSettings,Gt=({currency:t,values:n,className:o})=>{const{total_items:r,total_items_tax:a}=n,i=parseInt(r,10),s=parseInt(a,10);return(0,e.createElement)(Vt,{className:o,currency:t,label:(0,h.__)("Subtotal","woocommerce"),value:(0,Ut.getSetting)("displayCartPricesIncludingTax",!1)?i+s:i})},Zt=({currency:t,values:n,className:o,showRateAfterTaxName:r})=>{const{total_tax:a,tax_lines:i}=n;if(!(0,Ut.getSetting)("taxesEnabled",!0)&&parseInt(a,10)<=0)return null;const l=(0,Ut.getSetting)("displayItemizedTaxes",!1),c=l&&i.length>0?(0,e.createElement)(e.Fragment,null,i.map((({name:n,rate:a,price:i},l)=>{const c=`${n}${r?` ${a}`:""}`;return(0,e.createElement)(Vt,{key:`tax-line-${l}`,className:s()("wc-block-components-totals-taxes",o),currency:t,label:c,value:parseInt(i,10)})}))," "):null;return l?c:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Vt,{className:s()("wc-block-components-totals-taxes",o),currency:t,label
|