Files
medicalalert-web-reloaded/wp/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/blocks-components.js
Rachit Bhargava 22f10a9edd Merged in release/release-1.09 (pull request #10)
Release/release 1.09

* Install missing plugins 
* rs set to 1

* rebase pantheon for aws

* rebase pantheon for aws

* prod config change

* prod config change

* fix campaing issue

* revert


Approved-by: Jay Sharma
2023-12-27 20:55:58 +00:00

5 lines
25 KiB
JavaScript

(()=>{var e={184:(e,t)=>{var o;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var a=typeof o;if("string"===a||"number"===a)e.push(o);else if(Array.isArray(o)){if(o.length){var i=r.apply(null,o);i&&e.push(i)}}else if("object"===a)if(o.toString===Object.prototype.toString)for(var s in o)n.call(o,s)&&o[s]&&e.push(s);else e.push(o.toString())}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(o=function(){return r}.apply(t,[]))||(e.exports=o)}()},198:()=>{},550:()=>{},708:()=>{},656:()=>{},78:()=>{},26:()=>{},129:()=>{}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";o.r(n),o.d(n,{CheckboxList:()=>c,Chip:()=>d,FormStep:()=>m,FormattedMonetaryAmount:()=>R,Label:()=>b,RadioControl:()=>I,RadioControlAccordion:()=>$,RadioControlOption:()=>j,RadioControlOptionLayout:()=>M,RemovableChip:()=>v,Spinner:()=>L});const e=window.React;var t=o.n(e);const r=window.wp.i18n,a=window.wp.element;var i=o(184),s=o.n(i);const l=window.wc.blocksCheckout;o(550);const c=({className:t,onChange:o,options:n=[],checked:i=[],isLoading:c=!1,isDisabled:u=!1,limit:p=10})=>{const[m,d]=(0,a.useState)(!1),h=(0,a.useMemo)((()=>[...Array(5)].map(((t,o)=>(0,e.createElement)("li",{key:o,style:{width:Math.floor(75*Math.random())+25+"%"}})))),[]),f=(0,a.useMemo)((()=>{const t=n.length-p;return!m&&(0,e.createElement)("li",{key:"show-more",className:"show-more"},(0,e.createElement)("button",{onClick:()=>{d(!0)},"aria-expanded":!1,"aria-label":(0,r.sprintf)(/* translators: %s is referring the remaining count of options */
(0,r._n)("Show %s more option","Show %s more options",t,"woocommerce"),t)},(0,r.sprintf)(/* translators: %s number of options to reveal. */
(0,r._n)("Show %s more","Show %s more",t,"woocommerce"),t)))}),[n,p,m]),g=(0,a.useMemo)((()=>m&&(0,e.createElement)("li",{key:"show-less",className:"show-less"},(0,e.createElement)("button",{onClick:()=>{d(!1)},"aria-expanded":!0,"aria-label":(0,r.__)("Show less options","woocommerce")},(0,r.__)("Show less","woocommerce")))),[m]),v=(0,a.useMemo)((()=>{const t=n.length>p+5;return(0,e.createElement)(a.Fragment,null,n.map(((n,r)=>(0,e.createElement)(a.Fragment,{key:n.value},(0,e.createElement)("li",{...t&&!m&&r>=p&&{hidden:!0}},(0,e.createElement)(l.CheckboxControl,{id:n.value,className:"wc-block-checkbox-list__checkbox",label:n.label,checked:i.includes(n.value),onChange:()=>{o(n.value)},disabled:u})),t&&r===p-1&&f))),t&&g)}),[n,o,i,m,p,g,f,u]),b=s()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":c},t);return(0,e.createElement)("ul",{className:b},c?h:v)};o(198);const u=({children:t,className:o,headingLevel:n,...r})=>{const a=s()("wc-block-components-title",o),i=`h${n}`;return(0,e.createElement)(i,{className:a,...r},t)};o(656);const p=({title:t,stepHeadingContent:o})=>(0,e.createElement)("div",{className:"wc-block-components-checkout-step__heading"},(0,e.createElement)(u,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},t),!!o&&(0,e.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},o)),m=({id:t,className:o,title:n,legend:r,description:a,children:i,disabled:l=!1,showStepNumber:c=!0,stepHeadingContent:u=(()=>{})})=>{const m=r||n?"fieldset":"div";return(0,e.createElement)(m,{className:s()(o,"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&&!n)&&(0,e.createElement)("legend",{className:"screen-reader-text"},r||n),!!n&&(0,e.createElement)(p,{title:n,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)))};o(708);const d=({text:t,screenReaderText:o="",element:n="li",className:r="",radius:a="small",children:i=null,...l})=>{const c=n,u=s()(r,"wc-block-components-chip","wc-block-components-chip--radius-"+a),p=Boolean(o&&o!==t);return(0,e.createElement)(c,{className:u,...l},(0,e.createElement)("span",{"aria-hidden":p,className:"wc-block-components-chip__text"},t),p&&(0,e.createElement)("span",{className:"screen-reader-text"},o),i)},h=function(e){let{icon:t,size:o=24,...n}=e;return(0,a.cloneElement)(t,{width:o,height:o,...n})},f=window.wp.primitives,g=(0,a.createElement)(f.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(f.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"})),v=({ariaLabel:t="",className:o="",disabled:n=!1,onRemove:a=(()=>{}),removeOnAnyClick:i=!1,text:l,screenReaderText:c="",...u})=>{const p=i?"span":"button";if(!t){const e=c&&"string"==typeof c?c:l;t="string"!=typeof e?/* translators: Remove chip. */
(0,r.__)("Remove","woocommerce"):(0,r.sprintf)(/* translators: %s text of the chip to remove. */
(0,r.__)('Remove "%s"',"woocommerce"),e)}const m={"aria-label":t,disabled:n,onClick:a,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||a()}},f=i?m:{},v=i?{"aria-hidden":!0}:m;return(0,e.createElement)(d,{...u,...f,className:s()(o,"is-removable"),element:i?"button":u.element,screenReaderText:c,text:l},(0,e.createElement)(p,{className:"wc-block-components-chip__remove",...v},(0,e.createElement)(h,{className:"wc-block-components-chip__remove-icon",icon:g,size:16})))},b=({label:t,screenReaderLabel:o,wrapperElement:n,wrapperProps:r={}})=>{let i;const l=null!=t,c=null!=o;return!l&&c?(i=n||"span",r={...r,className:s()(r.className,"screen-reader-text")},(0,e.createElement)(i,{...r},o)):(i=n||a.Fragment,l&&c&&t!==o?(0,e.createElement)(i,{...r},(0,e.createElement)("span",{"aria-hidden":"true"},t),(0,e.createElement)("span",{className:"screen-reader-text"},o)):(0,e.createElement)(i,{...r},t))};function y(){}function w(e){return!!(e||"").match(/\d/)}function S(e){return null==e}function x(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function N(e,t){void 0===t&&(t=!0);var o="-"===e[0],n=o&&t,r=(e=e.replace("-","")).split(".");return{beforeDecimal:r[0],afterDecimal:r[1]||"",hasNagation:o,addNegation:n}}function k(e,t,o){for(var n="",r=o?"0":"",a=0;a<=t-1;a++)n+=e[a]||r;return n}function E(e,t){return Array(t+1).join(e)}function _(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var o=e.createTextRange();return o.move("character",t),o.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function C(e,t,o){return Math.min(Math.max(e,t),o)}function P(e){return Math.max(e.selectionStart,e.selectionEnd)}var F={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:y,onChange:y,onKeyDown:y,onMouseUp:y,onFocus:y,onBlur:y,isAllowed:function(){return!0}},D=function(e){function o(t){e.call(this,t);var o=t.defaultValue;this.validateProps();var n=this.formatValueProp(o);this.state={value:n,numAsString:this.removeFormatting(n),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&&(o.__proto__=e),o.prototype=Object.create(e&&e.prototype),o.prototype.constructor=o,o.prototype.componentDidMount=function(){this.setState({mounted:!0})},o.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},o.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},o.prototype.updateValueIfRequired=function(e){var t=this,o=t.props,n=t.state,r=t.focusedElm,a=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==o){this.validateProps();var s=this.formatNumString(i),l=S(o.value)?s:this.formatValueProp(),c=this.removeFormatting(l),u=parseFloat(c),p=parseFloat(i);(isNaN(u)&&isNaN(p)||u===p)&&s===a&&(null!==r||l===a)||this.updateValue({formattedValue:l,numAsString:c,input:r,source:"prop",event:null})}},o.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,o=this.getSeparators().decimalSeparator,n=this.getNumberRegex(!0),r="-"===e[0];r&&(e=e.replace("-","")),o&&0===t&&(e=e.split(o)[0]);var a=(e=(e.match(n)||[]).join("").replace(o,".")).indexOf(".");return-1!==a&&(e=e.substring(0,a)+"."+e.substring(a+1,e.length).replace(new RegExp(x(o),"g"),"")),r&&(e="-"+e),e},o.prototype.getNumberRegex=function(e,t){var o=this.props,n=o.format,r=o.decimalScale,a=o.customNumerals,i=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(a?a.join(""):"")+"]"+(!i||0===r||t||n?"":"|"+x(i)),e?"g":void 0)},o.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,o=t.thousandSeparator,n=t.allowedDecimalSeparators;return!0===o&&(o=","),n||(n=[e,"."]),{decimalSeparator:e,thousandSeparator:o,allowedDecimalSeparators:n}},o.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},o.prototype.getValueObject=function(e,t){var o=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(o)?void 0:o}},o.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),o=t.decimalSeparator,n=t.thousandSeparator;if(o===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+n+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+o+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},o.prototype.setPatchedCaretPosition=function(e,t,o){_(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===o&&_(e,t)}),0)},o.prototype.correctCaretPosition=function(e,t,o){var n=this.props,r=n.prefix,a=n.suffix,i=n.format;if(""===e)return 0;if(t=C(t,0,e.length),!i){var s="-"===e[0];return C(t,r.length+(s?1:0),e.length-a.length)}if("function"==typeof i)return t;if("#"===i[t]&&w(e[t]))return t;if("#"===i[t-1]&&w(e[t-1]))return t;var l=i.indexOf("#");t=C(t,l,i.lastIndexOf("#")+1);for(var c=i.substring(t,i.length).indexOf("#"),u=t,p=t+(-1===c?0:c);u>l&&("#"!==i[u]||!w(e[u]));)u-=1;return!w(e[p])||"left"===o&&t!==l||t-u<p-t?w(e[u])?u+1:u:p},o.prototype.getCaretPosition=function(e,t,o){var n,r,a=this.props.format,i=this.state.value,s=this.getNumberRegex(!0),l=(e.match(s)||[]).join(""),c=(t.match(s)||[]).join("");for(n=0,r=0;r<o;r++){var u=e[r]||"",p=t[n]||"";if((u.match(s)||u===p)&&("0"!==u||!p.match(s)||"0"===p||l.length===c.length)){for(;u!==t[n]&&n<t.length;)n++;n++}}return"string"!=typeof a||i||(n=t.length),this.correctCaretPosition(t,n)},o.prototype.removePrefixAndSuffix=function(e){var t=this.props,o=t.format,n=t.prefix,r=t.suffix;if(!o&&e){var a="-"===e[0];a&&(e=e.substring(1,e.length));var i=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(r);e=r&&-1!==i&&i===e.length-r.length?e.substring(0,i):e,a&&(e="-"+e)}return e},o.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),o=0,n="",r=0,a=t.length;r<=a;r++){var i=t[r]||"",s=r===a?e.length:e.indexOf(i,o);if(-1===s){n=e;break}n+=e.substring(o,s),o=s+i.length}return(n.match(this.getNumberRegex(!0))||[]).join("")},o.prototype.removeFormatting=function(e){var t=this.props,o=t.format,n=t.removeFormatting;return e?(o?e="string"==typeof o?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},o.prototype.formatWithPattern=function(e){for(var t=this.props.format,o=0,n=t.split(""),r=0,a=t.length;r<a;r++)"#"===t[r]&&(n[r]=e[o]||this.getMaskAtIndex(o),o+=1);return n.join("")},o.prototype.formatAsNumber=function(e){var t=this.props,o=t.decimalScale,n=t.fixedDecimalScale,r=t.prefix,a=t.suffix,i=t.allowNegative,s=t.thousandsGroupStyle,l=this.getSeparators(),c=l.thousandSeparator,u=l.decimalSeparator,p=-1!==e.indexOf(".")||o&&n,m=N(e,i),d=m.beforeDecimal,h=m.afterDecimal,f=m.addNegation;return void 0!==o&&(h=k(h,o,n)),c&&(d=function(e,t,o){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(o),r=e.search(/[1-9]/);return r=-1===r?e.length:r,e.substring(0,r)+e.substring(r,e.length).replace(n,"$1"+t)}(d,c,s)),r&&(d=r+d),a&&(h+=a),f&&(d="-"+d),d+(p&&u||"")+h},o.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,o=t.format,n=t.allowEmptyFormatting,r=t.customNumerals,a=e;if(r&&10===r.length){var i=new RegExp("["+r.join("")+"]","g");a=e.replace(i,(function(e){return r.indexOf(e).toString()}))}return""!==e||n?"-"!==e||o?"string"==typeof o?this.formatWithPattern(a):"function"==typeof o?o(a):this.formatAsNumber(a):"-":""},o.prototype.formatValueProp=function(e){var t=this.props,o=t.format,n=t.decimalScale,r=t.fixedDecimalScale,a=t.allowEmptyFormatting,i=this.props,s=i.value,l=i.isNumericString,c=!(s=S(s)?e:s)&&0!==s;return c&&a&&(s=""),c&&!a?"":("number"==typeof s&&(s=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var o=e.split(/[eE]/g),n=o[0],r=o[1];if(!(r=Number(r)))return t+n;var a=1+r,i=(n=n.replace(".","")).length;return a<0?n="0."+E("0",Math.abs(a))+n:a>=i?n+=E("0",a-i):n=(n.substring(0,a)||"0")+"."+n.substring(a),t+n}(s),l=!0),"Infinity"===s&&l&&(s=""),l&&!o&&"number"==typeof n&&(s=function(e,t,o){if(-1!==["","-"].indexOf(e))return e;var n=-1!==e.indexOf(".")&&t,r=N(e),a=r.beforeDecimal,i=r.afterDecimal,s=r.hasNagation,l=parseFloat("0."+(i||"0")),c=(i.length<=t?"0."+i:l.toFixed(t)).split(".");return(s?"-":"")+a.split("").reverse().reduce((function(e,t,o){return e.length>o?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),c[0])+(n?".":"")+k(c[1]||"",Math.min(t,i.length),o)}(s,n,r)),l?this.formatNumString(s):this.formatInput(s))},o.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,o=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),r=o.test(e),a=n.test(e);return e=e.replace(/-/g,""),r&&!a&&t&&(e="-"+e),e},o.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},o.prototype.isCharacterAFormat=function(e,t){var o=this.props,n=o.format,r=o.prefix,a=o.suffix,i=o.decimalScale,s=o.fixedDecimalScale,l=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!(n||!(e<r.length||e>=t.length-a.length||i&&s&&t[e]===l))},o.prototype.correctInputValue=function(e,t,o){var n=this,r=this.props,a=r.format,i=r.allowNegative,s=r.prefix,l=r.suffix,c=r.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,d=this.state.numAsString||"",h=this.selectionBeforeInput,f=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var o=0,n=0,r=e.length,a=t.length;e[o]===t[o]&&o<r;)o++;for(;e[r-1-n]===t[a-1-n]&&a-n>o&&r-n>o;)n++;return{start:o,end:r-n}}(t,o),b=v.start,y=v.end;if(!a&&b===y&&-1!==p.indexOf(o[f])){var w=0===c?"":m;return o.substr(0,f)+w+o.substr(f+1,o.length)}var S=a?0:s.length,x=t.length-(a?0:l.length);if(o.length>t.length||!o.length||b===y||0===f&&g===t.length||0===b&&y===t.length||f===S&&g===x)return o;var k=t.substr(b,y-b);if([].concat(k).find((function(e,o){return n.isCharacterAFormat(o+b,t)}))){var E=t.substr(b),_={},C=[];[].concat(E).forEach((function(e,o){n.isCharacterAFormat(o+b,t)?_[o]=e:o>k.length-1&&C.push(e)})),Object.keys(_).forEach((function(e){C.length>e?C.splice(e,0,_[e]):C.push(_[e])})),o=t.substr(0,b)+C.join("")}if(!a){var P=this.removeFormatting(o),F=N(P,i),D=F.beforeDecimal,O=F.afterDecimal,A=F.addNegation,R=e<o.indexOf(m)+1;if(P.length<d.length&&R&&""===D&&!parseFloat(O))return A?"-":""}return o},o.prototype.updateValue=function(e){var t=e.formattedValue,o=e.input,n=e.setCaretPosition;void 0===n&&(n=!0);var r=e.source,a=e.event,i=e.numAsString,s=e.caretPos,l=this.props.onValueChange,c=this.state.value;if(o){if(void 0===s&&n){var u=e.inputValue||o.value,p=P(o);o.value=t,s=this.getCaretPosition(u,t,p)}o.value=t,n&&this.setPatchedCaretPosition(o,s,t)}void 0===i&&(i=this.removeFormatting(t)),t!==c&&(this.setState({value:t,numAsString:i}),l(this.getValueObject(t,i),{event:a,source:r}))},o.prototype.onChange=function(e){var t=e.target,o=t.value,n=this.state,r=this.props,a=r.isAllowed,i=n.value||"",s=P(t);o=this.correctInputValue(s,i,o);var l=this.formatInput(o)||"",c=this.removeFormatting(l),u=a(this.getValueObject(l,c));u||(l=i),this.updateValue({formattedValue:l,numAsString:c,inputValue:o,input:t,event:e,source:"event"}),u&&r.onChange(e)},o.prototype.onBlur=function(e){var t=this.props,o=this.state,n=t.format,r=t.onBlur,a=t.allowLeadingZeros,i=o.numAsString,s=o.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!n){isNaN(parseFloat(i))&&(i=""),a||(i=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var o=e.split("."),n=o[0].replace(/^0+/,"")||"0",r=o[1]||"";return(t?"-":"")+n+(r?"."+r:"")}(i));var l=this.formatNumString(i);if(l!==s)return this.updateValue({formattedValue:l,numAsString:i,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void r(e)}r(e)},o.prototype.onKeyDown=function(e){var t,o=e.target,n=e.key,r=o.selectionStart,a=o.selectionEnd,i=o.value;void 0===i&&(i="");var s=this.props,l=s.decimalScale,c=s.fixedDecimalScale,u=s.prefix,p=s.suffix,m=s.format,d=s.onKeyDown,h=void 0!==l&&c,f=this.getNumberRegex(!1,h),g=new RegExp("-"),v="string"==typeof m;if(this.selectionBeforeInput={selectionStart:r,selectionEnd:a},"ArrowLeft"===n||"Backspace"===n?t=r-1:"ArrowRight"===n?t=r+1:"Delete"===n&&(t=r),void 0!==t&&r===a){var b=t,y=v?m.indexOf("#"):u.length,w=v?m.lastIndexOf("#")+1:i.length-p.length;if("ArrowLeft"===n||"ArrowRight"===n){var S="ArrowLeft"===n?"left":"right";b=this.correctCaretPosition(i,t,S)}else if("Delete"!==n||f.test(i[t])||g.test(i[t])){if("Backspace"===n&&!f.test(i[t]))if(r<=y+1&&"-"===i[0]&&void 0===m){var x=i.substring(1);this.updateValue({formattedValue:x,caretPos:b,input:o,event:e,source:"event"})}else if(!g.test(i[t])){for(;!f.test(i[b-1])&&b>y;)b--;b=this.correctCaretPosition(i,b,"left")}}else for(;!f.test(i[b])&&b<w;)b++;(b!==t||t<y||t>w)&&(e.preventDefault(),this.setPatchedCaretPosition(o,b,i)),e.isUnitTestRun&&this.setPatchedCaretPosition(o,b,i),d(e)}else d(e)},o.prototype.onMouseUp=function(e){var t=e.target,o=t.selectionStart,n=t.selectionEnd,r=t.value;if(void 0===r&&(r=""),o===n){var a=this.correctCaretPosition(r,o);a!==o&&this.setPatchedCaretPosition(t,a,r)}this.props.onMouseUp(e)},o.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var o=e.target,n=o.selectionStart,r=o.selectionEnd,a=o.value;void 0===a&&(a="");var i=t.correctCaretPosition(a,n);i===n||0===n&&r===a.length||t.setPatchedCaretPosition(o,i,a),t.props.onFocus(e)}),0)},o.prototype.render=function(){var e=this.props,o=e.type,n=e.displayType,r=e.customInput,a=e.renderText,i=e.getInputRef,s=e.format,l=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(o[n]=e[n]);return o}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),c=this.state,u=c.value,p=c.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(s)?"numeric":void 0,m=Object.assign({inputMode:p},l,{type:o,value:u,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return a?a(u,l)||null:t().createElement("span",Object.assign({},l,{ref:i}),u);if(r){var d=r;return t().createElement(d,Object.assign({},m,{ref:i}))}return t().createElement("input",Object.assign({},m,{ref:i}))},o}(t().Component);D.defaultProps=F;const O=D;o(78);const A=e=>({thousandSeparator:null==e?void 0:e.thousandSeparator,decimalSeparator:null==e?void 0:e.decimalSeparator,fixedDecimalScale:!0,prefix:null==e?void 0:e.prefix,suffix:null==e?void 0:e.suffix,isNumericString:!0}),R=({className:t,value:o,currency:n,onValueChange:r,displayType:a="text",...i})=>{var l;const c="string"==typeof o?parseInt(o,10):o;if(!Number.isFinite(c))return null;const u=c/10**n.minorUnit;if(!Number.isFinite(u))return null;const p=s()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),m=null!==(l=i.decimalScale)&&void 0!==l?l:null==n?void 0:n.minorUnit,d={...i,...A(n),decimalScale:m,value:void 0,currency:void 0,onValueChange:void 0},h=r?e=>{const t=+e.value*10**n.minorUnit;r(t)}:()=>{};return(0,e.createElement)(O,{className:p,displayType:a,...d,value:u,onValueChange:h})},V=window.wp.compose,M=({label:t,secondaryLabel:o,description:n,secondaryDescription:r,id:a})=>(0,e.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},(0,e.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&(0,e.createElement)("span",{id:a&&`${a}__label`,className:"wc-block-components-radio-control__label"},t),o&&(0,e.createElement)("span",{id:a&&`${a}__secondary-label`,className:"wc-block-components-radio-control__secondary-label"},o)),(n||r)&&(0,e.createElement)("div",{className:"wc-block-components-radio-control__description-group"},n&&(0,e.createElement)("span",{id:a&&`${a}__description`,className:"wc-block-components-radio-control__description"},n),r&&(0,e.createElement)("span",{id:a&&`${a}__secondary-description`,className:"wc-block-components-radio-control__secondary-description"},r))),j=({checked:t,name:o,onChange:n,option:r,disabled:a=!1})=>{const{value:i,label:l,description:c,secondaryLabel:u,secondaryDescription:p}=r;return(0,e.createElement)("label",{className:s()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${o}-${i}`},(0,e.createElement)("input",{id:`${o}-${i}`,className:"wc-block-components-radio-control__input",type:"radio",name:o,value:i,onChange:e=>n(e.target.value),checked:t,"aria-describedby":s()({[`${o}-${i}__label`]:l,[`${o}-${i}__secondary-label`]:u,[`${o}-${i}__description`]:c,[`${o}-${i}__secondary-description`]:p}),disabled:a}),(0,e.createElement)(M,{id:`${o}-${i}`,label:l,secondaryLabel:u,description:c,secondaryDescription:p}))};o(26);const T=({className:t="",id:o,selected:n="",onChange:r,options:a=[],disabled:i=!1})=>{const l=(0,V.useInstanceId)(T),c=o||l;return a.length?(0,e.createElement)("div",{className:s()("wc-block-components-radio-control",t)},a.map((t=>(0,e.createElement)(j,{key:`${c}-${t.value}`,name:`radio-control-${c}`,checked:t.value===n,option:t,onChange:e=>{r(e),"function"==typeof t.onChange&&t.onChange(e)},disabled:i})))):null},I=T,$=(0,V.withInstanceId)((({className:t,instanceId:o,id:n,selected:r,onChange:a,options:i=[]})=>{const l=n||o;return i.length?(0,e.createElement)("div",{className:s()("wc-block-components-radio-control",t)},i.map((t=>{const o="object"==typeof t&&"content"in t,n=t.value===r;return(0,e.createElement)("div",{className:"wc-block-components-radio-control-accordion-option",key:t.value},(0,e.createElement)(j,{name:`radio-control-${l}`,checked:n,option:t,onChange:e=>{a(e),"function"==typeof t.onChange&&t.onChange(e)}}),o&&n&&(0,e.createElement)("div",{className:s()("wc-block-components-radio-control-accordion-content",{"wc-block-components-radio-control-accordion-content-hide":!n})},t.content))}))):null}));o(129);const L=()=>(0,e.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})})(),(this.wc=this.wc||{}).blocksComponents=n})();