1import{l as e,r as a,c as l,G as n,S as t,a0 as o,a5 as s,w as m,p as i,v as u,D as g,F as r,M as c,O as h,Z as d,C as v,I as L,E as b,a6 as x,a1 as p,n as k,q as f,A as y,L as w,J as C,K as S}from"./Lx7M_2Ho.js";import{a as q}from"./B0pCmiST.js";const I={class:"w-full"},V={class:"relative shrink-0"},B={class:"inline-flex items-center justify-center w-5 h-4.5 flex-shrink-0"},P={key:0,class:"w-5 h-4.5 bg-gray-200 animate-pulse"},z={class:"text-base md:text-md text-gray-600 font-medium min-w-[21px]"},R={key:0,class:"inline-block w-5 rounded bg-gray-200 animate-pulse align-middle"},$={key:1},D={class:"z-10 sticky top-0 bg-white border-b border-gray-200 p-1.5 sm:p-2"},E={key:0},_=["onClick"],A={class:"flex-1"},M={key:1,class:"px-2 sm:px-3 py-3 sm:py-4 text-base text-gray-500 text-center"},j=["placeholder"],U={key:0,class:"block mt-1 text-[10px] sm:text-xs text-red-600"},F=e({__name:"PhoneInput",props:{modelValue:{},required:{type:Boolean},highZIndex:{type:Boolean},error:{},containerClass:{},buttonClass:{},inputClass:{}},emits:["update:modelValue","validity"],setup(e,{emit:F}){const G=[{label:"France (+33)",value:"+33",code:"fr",mask:"6 12 34 56 78",minLength:9,maxLength:9},{label:"Allemagne (+49)",value:"+49",code:"de",mask:"151 23456789",minLength:10,maxLength:11},{label:"Royaume-Uni (+44)",value:"+44",code:"gb",mask:"7400 123456",minLength:10,maxLength:10},{label:"Espagne (+34)",value:"+34",code:"es",mask:"612 34 56 78",minLength:9,maxLength:9},{label:"Italie (+39)",value:"+39",code:"it",mask:"320 1234567",minLength:10,maxLength:10},{label:"Belgique (+32)",value:"+32",code:"be",mask:"470 12 34 56",minLength:9,maxLength:9},{label:"Pays-Bas (+31)",value:"+31",code:"nl",mask:"6 12345678",minLength:9,maxLength:9},{label:"Suisse (+41)",value:"+41",code:"ch",mask:"78 123 45 67",minLength:9,maxLength:9},{label:"Portugal (+351)",value:"+351",code:"pt",mask:"912 345 678",minLength:9,maxLength:9},{label:"Autriche (+43)",value:"+43",code:"at",mask:"664 123456",minLength:10,maxLength:13},{label:"Grèce (+30)",value:"+30",code:"gr",mask:"691 234 5678",minLength:10,maxLength:10},{label:"Suède (+46)",value:"+46",code:"se",mask:"70 123 45 67",minLength:9,maxLength:9},{label:"Norvège (+47)",value:"+47",code:"no",mask:"406 12 345",minLength:8,maxLength:8},{label:"Danemark (+45)",value:"+45",code:"dk",mask:"32 12 34 56",minLength:8,maxLength:8},{label:"Finlande (+358)",value:"+358",code:"fi",mask:"41 2345678",minLength:9,maxLength:10},{label:"Pologne (+48)",value:"+48",code:"pl",mask:"512 345 678",minLength:9,maxLength:9},{label:"Irlande (+353)",value:"+353",code:"ie",mask:"85 123 4567",minLength:9,maxLength:9},{label:"République tchèque (+420)",value:"+420",code:"cz",mask:"601 123 456",minLength:9,maxLength:9},{label:"Roumanie (+40)",value:"+40",code:"ro",mask:"712 345 678",minLength:9,maxLength:9},{label:"Hongrie (+36)",value:"+36",code:"hu",mask:"20 123 4567",minLength:9,maxLength:9},{label:"Bulgarie (+359)",value:"+359",code:"bg",mask:"87 123 4567",minLength:9,maxLength:9},{label:"Slovaquie (+421)",value:"+421",code:"sk",mask:"912 345 678",minLength:9,maxLength:9},{label:"Croatie (+385)",value:"+385",code:"hr",mask:"91 234 5678",minLength:9,maxLength:9},{label:"Luxembourg (+352)",value:"+352",code:"lu",mask:"621 123 456",minLength:9,maxLength:9},{label:"Slovénie (+386)",value:"+386",code:"si",mask:"31 234 567",minLength:8,maxLength:8},{label:"Estonie (+372)",value:"+372",code:"ee",mask:"5123 4567",minLength:7,maxLength:8},{label:"Lettonie (+371)",value:"+371",code:"lv",mask:"21 234 567",minLength:8,maxLength:8},{label:"Lituanie (+370)",value:"+370",code:"lt",mask:"612 34567",minLength:8,maxLength:8},{label:"Serbie (+381)",value:"+381",code:"rs",mask:"60 1234567",minLength:8,maxLength:9},{label:"Ukraine (+380)",value:"+380",code:"ua",mask:"50 123 4567",minLength:9,maxLength:9},{label:"Russie (+7)",value:"+7",code:"ru",mask:"912 345-67-89",minLength:10,maxLength:10},{label:"Maroc (+212)",value:"+212",code:"ma",mask:"612-345678",minLength:9,maxLength:9},{label:"Algérie (+213)",value:"+213",code:"dz",mask:"551 23 45 67",minLength:9,maxLength:9},{label:"Tunisie (+216)",value:"+216",code:"tn",mask:"20 123 456",minLength:8,maxLength:8},{label:"Ãgypte (+20)",value:"+20",code:"eg",mask:"100 123 4567",minLength:10,maxLength:10},{label:"Libye (+218)",value:"+218",code:"ly",mask:"91 2345678",minLength:9,maxLength:10},{label:"Turquie (+90)",value:"+90",code:"tr",mask:"501 234 5678",minLength:10,maxLength:10},{label:"Arabie Saoudite (+966)",value:"+966",code:"sa",mask:"50 123 4567",minLength:9,maxLength:9},{label:"Ãmirats arabes unis (+971)",value:"+971",code:"ae",mask:"50 123 4567",minLength:9,maxLength:9},{label:"Qatar (+974)",value:"+974",code:"qa",mask:"3312 3456",minLength:8,maxLength:8},{label:"Koweït (+965)",value:"+965",code:"kw",mask:"500 12345",minLength:8,maxLength:8},{label:"Bahreïn (+973)",value:"+973",code:"bh",mask:"3600 1234",minLength:8,maxLength:8},{label:"Oman (+968)",value:"+968",code:"om",mask:"9123 4567",minLength:8,maxLength:8},{label:"Liban (+961)",value:"+961",code:"lb",mask:"3 123 456",minLength:7,maxLength:8},{label:"Jordanie (+962)",value:"+962",code:"jo",mask:"7 9012 3456",minLength:9,maxLength:9},{label:"Syrie (+963)",value:"+963",code:"sy",mask:"944 123 456",minLength:9,maxLength:9},{label:"Iraq (+964)",value:"+964",code:"iq",mask:"790 123 4567",minLength:10,maxLength:10},{label:"Yémen (+967)",value:"+967",code:"ye",mask:"712 345 678",minLength:9,maxLength:9},{label:"Palestine (+970)",value:"+970",code:"ps",mask:"599 123 456",minLength:9,maxLength:9},{label:"Israël (+972)",value:"+972",code:"il",mask:"50 123 4567",minLength:9,maxLength:9},{label:"Sénégal (+221)",value:"+221",code:"sn",mask:"77 123 45 67",minLength:9,maxLength:9},{label:"Côte d'Ivoire (+225)",value:"+225",code:"ci",mask:"01 23 45 67",minLength:8,maxLength:10},{label:"Mali (+223)",value:"+223",code:"ml",mask:"65 12 34 56",minLength:8,maxLength:8},{label:"Niger (+227)",value:"+227",code:"ne",mask:"93 12 34 56",minLength:8,maxLength:8},{label:"Burkina Faso (+226)",value:"+226",code:"bf",mask:"70 12 34 56",minLength:8,maxLength:8},{label:"Guinée (+224)",value:"+224",code:"gn",mask:"601 12 34 56",minLength:9,maxLength:9},{label:"Cameroun (+237)",value:"+237",code:"cm",mask:"6 71 23 45 67",minLength:9,maxLength:9},{label:"Nigeria (+234)",value:"+234",code:"ng",mask:"802 123 4567",minLength:10,maxLength:10},{label:"Ghana (+233)",value:"+233",code:"gh",mask:"23 123 4567",minLength:9,maxLength:9},{label:"Kenya (+254)",value:"+254",code:"ke",mask:"712 345678",minLength:9,maxLength:9},{label:"Afrique du Sud (+27)",value:"+27",code:"za",mask:"71 123 4567",minLength:9,maxLength:9},{label:"Ãthiopie (+251)",value:"+251",code:"et",mask:"91 123 4567",minLength:9,maxLength:9},{label:"Tanzanie (+255)",value:"+255",code:"tz",mask:"621 234 567",minLength:9,maxLength:9},{label:"Ouganda (+256)",value:"+256",code:"ug",mask:"712 345678",minLength:9,maxLength:9},{label:"Madagascar (+261)",value:"+261",code:"mg",mask:"32 12 345 67",minLength:9,maxLength:9},{label:"Maurice (+230)",value:"+230",code:"mu",mask:"5251 2345",minLength:8,maxLength:8},{label:"RD Congo (+243)",value:"+243",code:"cd",mask:"991 234 567",minLength:9,maxLength:9},{label:"Ãtats-Unis (+1)",value:"+1",code:"us",mask:"(555) 123-4567",minLength:10,maxLength:10},{label:"Canada (+1)",value:"+1",code:"ca",mask:"(555) 123-4567",minLength:10,maxLength:10},{label:"Mexique (+52)",value:"+52",code:"mx",mask:"55 1234 5678",minLength:10,maxLength:10},{label:"Brésil (+55)",value:"+55",code:"br",mask:"11 91234-5678",minLength:10,maxLength:11},{label:"Argentine (+54)",value:"+54",code:"ar",mask:"11 2345-6789",minLength:10,maxLength:10},{label:"Chili (+56)",value:"+56",code:"cl",mask:"9 1234 5678",minLength:9,maxLength:9},{label:"Colombie (+57)",value:"+57",code:"co",mask:"321 1234567",minLength:10,maxLength:10},{label:"Pérou (+51)",value:"+51",code:"pe",mask:"912 345 678",minLength:9,maxLength:9},{label:"Venezuela (+58)",value:"+58",code:"ve",mask:"412 1234567",minLength:10,maxLength:10},{label:"Ãquateur (+593)",value:"+593",code:"ec",mask:"99 123 4567",minLength:9,maxLength:9},{label:"Bolivie (+591)",value:"+591",code:"bo",mask:"7 1234567",minLength:8,maxLength:8},{label:"Uruguay (+598)",value:"+598",code:"uy",mask:"94 123 456",minLength:8,maxLength:8},{label:"Paraguay (+595)",value:"+595",code:"py",mask:"961 123456",minLength:9,maxLength:9},{label:"Chine (+86)",value:"+86",code:"cn",mask:"131 1234 5678",minLength:11,maxLength:11},{label:"Inde (+91)",value:"+91",code:"in",mask:"81234 56789",minLength:10,maxLength:10},{label:"Japon (+81)",value:"+81",code:"jp",mask:"90 1234 5678",minLength:10,maxLength:10},{label:"Corée du Sud (+82)",value:"+82",code:"kr",mask:"10 1234 5678",minLength:9,maxLength:10},{label:"Pakistan (+92)",value:"+92",code:"pk",mask:"300 1234567",minLength:10,maxLength:10},{label:"Bangladesh (+880)",value:"+880",code:"bd",mask:"1712-345678",minLength:10,maxLength:10},{label:"Philippines (+63)",value:"+63",code:"ph",mask:"905 123 4567",minLength:10,maxLength:10},{label:"Vietnam (+84)",value:"+84",code:"vn",mask:"91 234 56 78",minLength:9,maxLength:10},{label:"Thaïlande (+66)",value:"+66",code:"th",mask:"81 234 5678",minLength:9,maxLength:9},{label:"Indonésie (+62)",value:"+62",code:"id",mask:"812 3456 7890",minLength:10,maxLength:12},{label:"Malaisie (+60)",value:"+60",code:"my",mask:"12-345 6789",minLength:9,maxLength:10},{label:"Singapour (+65)",value:"+65",code:"sg",mask:"8123 4567",minLength:8,maxLength:8},{label:"Sri Lanka (+94)",value:"+94",code:"lk",mask:"71 234 5678",minLength:9,maxLength:9},{label:"Népal (+977)",value:"+977",code:"np",mask:"984-1234567",minLength:10,maxLength:10},{label:"Myanmar (+95)",value:"+95",code:"mm",mask:"9 123 456 789",minLength:8,maxLength:10},{label:"Cambodge (+855)",value:"+855",code:"kh",mask:"12 345 678",minLength:8,maxLength:9},{label:"Laos (+856)",value:"+856",code:"la",mask:"20 1234 5678",minLength:10,maxLength:10},{label:"Australie (+61)",value:"+61",code:"au",mask:"412 345 678",minLength:9,maxLength:9},{label:"Nouvelle-Zélande (+64)",value:"+64",code:"nz",mask:"21 123 4567",minLength:9,maxLength:10},{label:"Fidji (+679)",value:"+679",code:"fj",mask:"701 2345",minLength:7,maxLength:7},{label:"Papouasie-Nouvelle-Guinée (+675)",value:"+675",code:"pg",mask:"7012 3456",minLength:8,maxLength:8}],N=e,T=F,K=a(N.modelValue?.country||""),O=a(N.modelValue?.phone||""),Z=a(!N.modelValue?.phone);a(""),a("");const J=a(!1),Y=a(""),H=a(null),Q=a(null),W=a(null),X=a(null),ee=a(!1),ae=`phone-dropdown-${Math.random().toString(36).substr(2,9)}`,le=l(()=>G.find(e=>e.value===K.value)),ne=l(()=>le.value?le.value.mask:"123-456-7890"),te=l(()=>{if(!Y.value.trim())return G;const e=Y.value.toLowerCase().trim();return G.filter(a=>a.label.toLowerCase().includes(e)||a.value.includes(e)||a.code.toLowerCase().includes(e))}),oe=a({}),se=e=>{e&&e.stopPropagation(),J.value=!J.value,J.value&&(Y.value="",me(),k(()=>{X.value?.focus()}))},me=()=>{if(!H.value)return;const e=H.value.getBoundingClientRect(),a=e.width;oe.value={top:`${e.bottom+window.scrollY+4}px`,left:`${e.left+window.scrollX}px`,width:`${a}px`}},ie=e=>{const a=e.target;if(H.value&&!H.value.contains(a)){const e=document.querySelector(`[data-dropdown-id="${ae}"]`);e&&e.contains(a)||(J.value=!1)}};function ue(e){if(!le.value)return e;const a=e.replace(/\D/g,""),l=le.value.mask;let n="",t=0;for(let o=0;o<l.length&&t<a.length;o++){const e=l[o];e&&/\d/.test(e)?(n+=a[t],t++):e&&(n+=e)}return t<a.length&&(n+=a.substring(t)),n}function ge(e){ee.value=!0;const a=e.target,l=a.selectionStart||0,n=O.value,t=a.value,o=ue(t.replace(/\D/g,""));let s=l;if(o!==t){n.substring(0,l).replace(/\d/g,"").length;const e=n.substring(0,l).replace(/\D/g,"").length;let a=0;s=0;for(let l=0;l<o.length&&a<e;l++){const e=o[l];e&&/\d/.test(e)&&a++,s=l+1}}O.value=o,ce(),k(()=>{a.setSelectionRange(s,s)})}function re(){ee.value=!0,ce()}
1function ce(){if(N.required&&!K.value)return void T("validity",!1);if(!O.value)return void T("validity",!N.required);const e=O.value.replace(/\D/g,""),a=e.startsWith("0")&&e.length>1?e.substring(1):e;if(le.value){const{minLength:e,maxLength:l}=le.value;if(!(a.length>=e&&a.length<=l))return void T("validity",!1)}else if(a.length<6)return void T("validity",!1);T("validity",!0)}return n(async()=>{if(document.addEventListener("click",ie),window.addEventListener("resize",me),window.addEventListener("scroll",me,!0),O.value){const e=O.value.replace(/\D/g,"");O.value=ue(e)}N.modelValue?.phone?K.value||(K.value="+32"):(Z.value=!0,await async function(){try{const a=t(),l=`${a.public.apiBase}/geo/detect`,n="/api/geo/detect";let s=null;const m=!a.public.useBackend||a.public.apiBase?.includes("localhost");try{s=await $fetch(n)}catch(e){if(m)throw e;s=await $fetch(l)}let i=s?.countryCode?.toLowerCase()??void 0;if(i&&!s?.default||(i=await async function(){try{const e=await $fetch("/api/geo/detect",{method:"GET",credentials:"include",retry:0,timeout:3e3});if(e?.success&&e.countryCode)return e.countryCode.toLowerCase()}catch(e){o.debug("[PhoneInput] Client geo lookup (server) failed",e)}return null}()??void 0),i){const e=G.find(e=>e.code===i);e&&!N.modelValue?.phone&&(K.value=e.value,T("update:modelValue",{country:e.value,phone:O.value}))}else K.value||N.modelValue?.phone||(K.value="+32")}catch(e){o.debug("[PhoneInput] Country detection failed, using default"),K.value||N.modelValue?.phone||(K.value="+32")}}(),Z.value=!1)}),s(()=>{document.removeEventListener("click",ie),window.removeEventListener("resize",me),window.removeEventListener("scroll",me,!0)}),m(()=>N.modelValue,e=>{if(e&&(e.country&&e.country!==K.value&&(K.value=e.country),void 0!==e.phone)){const a=ue(e.phone.replace(/\D/g,""));a!==O.value&&(O.value=a)}},{deep:!0}),m(()=>[K.value,O.value],()=>{Z.value||(T("update:modelValue",{country:K.value,phone:O.value}),ee.value&&ce())}),(a,l)=>(f(),i("div",I,[u("div",{ref_key:"containerRef",ref:H,class:r(["flex gap-0 items-center w-full border bg-white border-gray-300 rounded-[6px] shadow-sm transition-all duration-200 h-[38px]",[{"border-red-300":e.error,"focus-within:ring-2 focus-within:ring-[#d0a444]/20 focus-within:border-[#d0a444]":!e.error},e.containerClass]])},[u("div",V,[u("button",{ref_key:"buttonRef",ref:Q,type:"button",onClick:d(se,["stop"]),class:r(["h-full px-[13px] py-[8px] flex items-center gap-1.5 sm:gap-2 hover:bg-gray-50 transition-colors border-r border-gray-300 rounded-l-[6px]",e.buttonClass])},[u("span",B,[Z.value||!le.value?(f(),i("span",P)):(f(),i("span",{key:1,class:r([`fi fi-${le.value.code}`,"inline-block w-5 h-4.5"])},null,2))]),u("span",z,[Z.value?(f(),i("span",R)):(f(),i("span",$,v(le.value?le.value.value:"+1"),1))]),g(q,{class:r(["w-2 h-2 text-slate-900 transition-transform rotate-180",{"rotate-0":J.value}])},null,8,["class"])],2),(f(),h(x,{to:"body"},[g(L,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:b(()=>[J.value?(f(),i("div",{key:0,ref_key:"dropdownRef",ref:W,style:w(oe.value),class:r(["absolute bg-white rounded-md shadow-lg border border-gray-200 max-h-60 overflow-y-auto phone-input-dropdown",e.highZIndex?"z-[10010]":"z-50"]),"data-dropdown-id":ae},[u("div",D,[c(u("input",{ref_key:"searchInputRef",ref:X,"onUpdate:modelValue":l[0]||(l[0]=e=>Y.value=e),type:"text",placeholder:"Rechercher un pays...",class:"w-full px-3 py-2 text-base border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-[#d0a444]/20 focus:border-[#d0a444]",onClick:l[1]||(l[1]=d(()=>{},["stop"])),onKeydown:l[2]||(l[2]=d(()=>{},["stop"]))},null,544),[[p,Y.value]])]),te.value.length>0?(f(),i("div",E,[(f(!0),i(C,null,S(te.value,e=>(f(),i("div",{key:e.value,onClick:d(a=>(e=>{if(K.value=e.value,Y.value="",J.value=!1,O.value){const e=O.value.replace(/\D/g,"");O.value=ue(e)}})(e),["stop"]),class:r(["px-3 py-2 hover:bg-gray-50 cursor-pointer flex items-center gap-3 text-base transition-colors",{"bg-[#fff9ec]":K.value===e.value}])},[u("span",{class:r([`fi fi-${e.code}`,"w-5 h-4.5 flex-shrink-0"])},null,2),u("span",A,v(e.label),1)],10,_))),128))])):(f(),i("div",M," Aucun pays trouvé "))],6)):y("",!0)]),_:1})]))]),c(u("input",{"onUpdate:modelValue":l[3]||(l[3]=e=>O.value=e),type:"tel",placeholder:ne.value,class:r(["flex-1 px-[13px] py-[8px] border-0 outline-none bg-transparent text-base leading-[20px]",e.inputClass]),onBlur:re,onInput:ge}
1,null,42,j),[[p,O.value]])],2),g(L,{"enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:b(()=>[e.error?(f(),i("span",U,v(e.error),1)):y("",!0)]),_:1})]))}}),G=Object.assign(F,{__name:"UiFormPhoneInput"});export{G as P}; 2//# sourceMappingURL=DFOjPsn8.js.map
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.