(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const n=window.wp.element,t=window.wp.htmlEntities,o=window.wc.components,i=window.wp.i18n,r=({options:e,initialValues:t})=>{const[r,l]=(0,n.useState)(t);return(0,n.createElement)(o.TreeSelectControl,{value:r,onChange:e=>{document.body.dispatchEvent(new CustomEvent("wc_region_picker_update",{detail:e})),l(e)},options:e,placeholder:(0,i.__)("Start typing to filter zones","woocommerce"),selectAllLabel:(0,i.__)("Select all countries","woocommerce"),individuallySelectParent:!0,maxVisibleTags:5})},l=window.wc.currency,c=window.wc.number,a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=(e,n)=>{if("number"==typeof n)return(0,c.numberFormat)(e,n);if("string"==typeof n){const t=a(e.decimalSeparator),o=a(e.thousandSeparator),i=new RegExp(`^\\s*(\\d+|\\d{1,3}(?:${o}\\d{3})*)(?:${t}\\d+)?\\s*$`);return n.replace(i,(n=>{const t=(0,c.parseNumber)(e,n);return(0,c.numberFormat)(e,t)}))}return n},w=()=>{const e=(0,n.useContext)(l.CurrencyContext);return(0,n.useEffect)((()=>{window.wc.ShippingCurrencyContext=window.wc.ShippingCurrencyContext||e,window.wc.ShippingCurrencyNumberFormat=window.wc.ShippingCurrencyNumberFormat||d}),[e]),null},p=(e,n)=>Array.isArray(e)?e.map((e=>p(e,n))):(e.label&&(e.label=n(e.label)),e.children&&(e.children=p(e.children,n)),e);var u,s;const m=document.getElementById("wc-shipping-zone-region-picker-root"),g=null!==(u=p(window.shippingZoneMethodsLocalizeScript?.region_options,t.decodeEntities))&&void 0!==u?u:[],y=null!==(s=window.shippingZoneMethodsLocalizeScript?.locations)&&void 0!==s?s:[];m&&(0,n.createRoot)(m).render((0,n.createElement)((()=>(0,n.createElement)("div",null,(0,n.createElement)(w,null),(0,n.createElement)(r,{options:g,initialValues:y}))),null)),(window.wc=window.wc||{}).shippingSettingsRegionPicker=e})();