/*! For license information please see shipping-settings-region-picker.js.LICENSE.txt */
(()=>{"use strict";var e={93359:(e,r,n)=>{var o=n(99196),t=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function s(e,r,n){var o,s={},a=null,p=null;for(o in void 0!==n&&(a=""+n),void 0!==r.key&&(a=""+r.key),void 0!==r.ref&&(p=r.ref),r)i.call(r,o)&&!l.hasOwnProperty(o)&&(s[o]=r[o]);if(e&&e.defaultProps)for(o in r=e.defaultProps)void 0===s[o]&&(s[o]=r[o]);return{$$typeof:t,type:e,key:a,ref:p,props:s,_owner:c.current}}r.jsx=s,r.jsxs=s},81514:(e,r,n)=>{e.exports=n(93359)},99196:e=>{e.exports=window.React}},r={};function n(o){var t=r[o];if(void 0!==t)return t.exports;var i=r[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{n.r(o);const e=window.wp.element,r=window.wp.htmlEntities,t=window.wc.components,i=window.wp.i18n;var c=n(81514);const l=({options:r,initialValues:n})=>{const[o,l]=(0,e.useState)(n);return(0,c.jsx)(t.TreeSelectControl,{value:o,onChange:e=>{document.body.dispatchEvent(new CustomEvent("wc_region_picker_update",{detail:e})),l(e)},options:r,placeholder:(0,i.__)("Start typing to filter zones","woocommerce"),selectAllLabel:(0,i.__)("Select all countries","woocommerce"),individuallySelectParent:!0,maxVisibleTags:5})},s=window.wc.currency,a=window.wc.number,p=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=(e,r)=>{if("number"==typeof r)return(0,a.numberFormat)(e,r);if("string"==typeof r){const n=p(e.decimalSeparator),o=p(e.thousandSeparator),t=new RegExp(`^\\s*(\\d+|\\d{1,3}(?:${o}\\d{3})*)(?:${n}\\d+)?\\s*$`);return r.replace(t,(r=>{const n=(0,a.parseNumber)(e,r);return(0,a.numberFormat)(e,n)}))}return r},u=()=>{const r=(0,e.useContext)(s.CurrencyContext);return(0,e.useEffect)((()=>{window.wc.ShippingCurrencyContext=window.wc.ShippingCurrencyContext||r,window.wc.ShippingCurrencyNumberFormat=window.wc.ShippingCurrencyNumberFormat||d}),[r]),null},w=(e,r)=>Array.isArray(e)?e.map((e=>w(e,r))):(e.label&&(e.label=r(e.label)),e.children&&(e.children=w(e.children,r)),e);var m,y;const f=document.getElementById("wc-shipping-zone-region-picker-root"),_=null!==(m=w(window.shippingZoneMethodsLocalizeScript?.region_options,r.decodeEntities))&&void 0!==m?m:[],g=null!==(y=window.shippingZoneMethodsLocalizeScript?.locations)&&void 0!==y?y:[],S=()=>(0,c.jsxs)("div",{children:[(0,c.jsx)(u,{}),(0,c.jsx)(l,{options:_,initialValues:g})]});f&&(0,e.createRoot)(f).render((0,c.jsx)(S,{}))})(),(window.wc=window.wc||{}).shippingSettingsRegionPicker=o})();