1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7032],{7032:(e,t,a)=>{a.r(t),a.d(t,{default:()=>N});var l=a(95155),n=a(12115),r=a(90235),s=a(33789),c=a(47507),u=a(93656),i=a(11035),o=a(91242),d=a(20844),x=a(49573),p=a(13213);let h=["US","MX","CA"],m=(()=>{try{return new Intl.DisplayNames(["en"],{type:"region"})}catch(e){return null}})();function f(e){try{var t;return null!=(t=null==m?void 0:m.of(e))?t:e}catch(t){return e}}let b=(0,o.X)().sort((e,t)=>f(e).localeCompare(f(t)));function j(e){let{countryCode:t}=e;return(0,l.jsx)(u.default,{src:"https://flagcdn.com/w20/".concat(t.toLowerCase(),".png"),alt:t,width:20,height:15,quality:i.H6,sizes:"20px",className:"inline-block h-[15px] w-5 shrink-0 rounded-sm object-cover"})}let N=e=>{let{field:t,value:a,error:u,onChange:i}=e,o=(0,n.useRef)(null),m=e=>{e.stopPropagation()},N=(0,n.useCallback)(()=>{if(!a)return{country:"US",nationalNumber:""};if(a.startsWith("+")){let e=(0,d.l)(a);if(e)return{country:e.country||"US",nationalNumber:e.nationalNumber||a.replace(/^\+\d+/,"")}}return{country:"US",nationalNumber:a.replace(/\D/g,"")}},[a])(),[y,g]=(0,n.useState)(N.country),[C,k]=(0,n.useState)(N.nationalNumber),v="".concat(t.id).concat("__country");(0,n.useEffect)(()=>{i(v,y)},[v,i,y]);let w=(0,n.useCallback)((e,t)=>(0,x.r)(e,t),[]),D=(0,n.useCallback)(e=>{g(e);let a=C.replace(/\D/g,"");k(w(a,e));let l=(0,p.K)(e),n=a?"+".concat(l).concat(a):"";i(t.id,n)},[t.id,C,w,i]),S=(0,n.useCallback)(e=>{let a=e.target.value.replace(/\D/g,"");k(w(a,y));let l=(0,p.K)(y),n=a?"+".concat(l).concat(a):"";i(t.id,n)},[t.id,y,w,i]),K=(0,n.useCallback)(e=>{let a=e.clipboardData.getData("text"),l=(0,d.l)(a);if(l&&l.country){e.preventDefault();let a=l.country;g(a),k(w(l.nationalNumber||"",a)),i(t.id,l.number||"");return}},[w,i,t.id]),_=(0,n.useCallback)(()=>{if(C){let e=C.replace(/\D/g,""),a=(0,p.K)(y),l=e?"+".concat(a).concat(e):"";i(t.id,l)}},[C,y,i,t.id]),U=(0,p.K)(y);return(0,l.jsxs)("div",{className:"space-y-2",onClick:m,onTouchStart:m,children:[(0,l.jsx)(r.J,{htmlFor:t.id,className:"block font-semibold mb-1",children:t.label}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsxs)(c.l6,{value:y,onValueChange:D,children:[(0,l.jsx)(c.bq,{className:"w-auto min-w-[90px] text-inherit",children:(0,l.jsx)(c.yv,{children:(0,l.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,l.jsx)(j,{countryCode:y}),(0,l.jsxs)("span",{children:["+",U]})]})})}),(0,l.jsxs)(c.gC,{className:"max-h-[300px]",children:[h.map(e=>(0,l.jsx)(c.eb,{value:e,children:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)(j,{countryCode:e}),(0,l.jsxs)("span",{children:["+",(0,p.K)(e)]}),(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:f(e)})]})},e)),(0,l.jsx)("div",{className:"px-2 py-1.5 text-xs text-muted-foreground border-t my-1",children:"Other countries"}),b.filter(e=>!h.includes(e)).map(e=>{let t;try{t=(0,p.K)(e)}catch(e){return null}return(0,l.jsx)(c.eb,{value:e,children:(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)(j,{countryCode:e}),(0,l.jsxs)("span",{children:["+",t]}),(0,l.jsx)("span",{className:"text-muted-foreground text-xs",children:f(e)})]})},e)})]})]}),(0,l.jsx)(s.p,{ref:o,id:t.id,type:"tel",placeholder:t.placeholder||"(555) 123-4567",value:C,onChange:S,onPaste:K,onBlur:_,className:"flex-1 ".concat(u?"border-red-500":"")})]}),u&&(0,l.jsx)("p",{className:"text-sm text-red-500",children:u})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.