var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}var window = _____WB$wombat$assign$function_____("window");
var self = _____WB$wombat$assign$function_____("self");
var document = _____WB$wombat$assign$function_____("document");
var location = _____WB$wombat$assign$function_____("location");
var top = _____WB$wombat$assign$function_____("top");
var parent = _____WB$wombat$assign$function_____("parent");
var frames = _____WB$wombat$assign$function_____("frames");
var opener = _____WB$wombat$assign$function_____("opener");
import{ag as a,ah as u,ai as m}from"./app.ZXowmuNl.js";import{A as c,p as d,g,i as f}from"./getCountryCallingCode.Dn4Edoqc.js";const p=/[()\-._ ]+/g;class _{formatter;regionCode;countryCode;constructor(t){const e=i(t);this.regionCode=e?t:a,this.countryCode=this.getCountryCodeFromRegionCode(t),this.formatter=new c(this.regionCode)}format(t){return this.updateCountryCode(t),this.formatter.reset(),y(t,this.formatter,this.countryCode)||""}update(t){const e=i(t);this.regionCode=e?t:a,this.countryCode=this.getCountryCodeFromRegionCode(this.regionCode),this.formatter=new c(this.regionCode)}getNormalizedNumber(t){try{return d(t,this.regionCode).format("E.164")}catch{return t}}getNationalNumber(t){if(!this.regionCode||s(t).length<4)return"";try{return d(t,this.regionCode).nationalNumber||""}catch{return""}}getCountryCodeFromRegionCode(t){try{return i(t)?parseInt(g(t),10):u}catch{return u}}updateCountryCode(t){if(t.indexOf("+")===-1||s(t).length<1)return;let e;const o=h(t);if(s(t).length>10)e=o;else{const n=l(t);n&&o&&this.countryCode!==n&&(e=o)}e&&this.update(e)}}function l(r){try{const t=h(r);return t&&i(t)?parseInt(g(t),10):u}catch{return parseInt(r.split(" ")[0].replace("+",""),10)}}function y(r,t,e){let o;for(const n of r.replace(p,""))o=t.input(n);if(e===u&&o?.startsWith("+")){const[n,...C]=o.split(" ");return C.length?`${n} ${C.join("-")}`:o}return o}function h(r){try{const t=d(r);return t.country||m.get(Number(t.countryCallingCode))}catch{return a}}function i(r){return f(r)}function s(r){return r.replace(/\D/g,"")}export{_ as default};