import{i as s}from"./intl-tel-input-BeLUiGud.js";function l(){const t=document.querySelector('input[type="tel"]');t&&s(t,{utilsScript:"/assets/js/utils.js",separateDialCode:!0,preferredCountries:["tr","gb","us"],initialCountry:"tr",geoIpLookup:function(n){fetch("https://ipapi.co/json/").then(function(e){return e.json()}).then(function(e){n(e.country_code.toLowerCase())}).catch(function(){n("tr")})}})}function u(){const t=document.getElementById("country_id"),n=document.getElementById("city_id");!t||!n||t.addEventListener("change",function(){const e=this.value;n.innerHTML='<option value="">'+window.translations.fields.city_select+"</option>",e&&fetch(`/storeapi/store/cities/${e}`,{headers:{Authorization:"Bearer "+document.querySelector('meta[name="api-token"]').content}}).then(o=>o.json()).then(o=>{o.success&&o.cities.forEach(i=>{const c=document.createElement("option");c.value=i.id,c.textContent=i.name,n.appendChild(c)})}).catch(o=>{console.error("Şehirler yüklenirken bir hata oluştu:",o)})})}function d(){const t=document.getElementById("generatePassword"),n=document.getElementById("password");!t||!n||t.addEventListener("click",function(){const o="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+";let i="";for(let c=0;c<12;c++)i+=o.charAt(Math.floor(Math.random()*o.length));n.value=i})}function p(t){const n=document.getElementById(t);n&&n.addEventListener("submit",function(e){n.checkValidity()||(e.preventDefault(),e.stopPropagation()),n.classList.add("was-validated")})}function m(){const t=document.getElementById("isCompany"),n=document.querySelectorAll(".company-fields"),e=document.getElementById("company_name"),o=document.getElementById("company_type");if(!t)return;function i(){const c=t.checked;n.forEach(a=>{a!==e&&(a.style.display=c?"block":"none")}),e&&(e.required=c,e.readOnly=!c,c?o.value="company":(e.value="",o.value="individual"))}t.addEventListener("change",i),i()}function f(){const t=document.getElementById("late_fees"),n=document.querySelectorAll(".late-fee-fields");if(!t)return;e(t.checked),t.addEventListener("change",function(){e(this.checked)});function e(o){n.forEach(i=>{i.disabled=!o,o||(i.value="")})}}export{l as a,u as b,d as c,m as d,f as e,p as i};
