/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
import"./p-Bf4Ol6Qt.js";import{e as o,g as e,f as c,l as s}from"./p-BDhR4pDq.js";const t="0.2.4",l={"-":["locales/"],errors:["locales/errors/"],forms:["locales/forms/","locales/forms/contactUs/","locales/forms/demo/","locales/forms/testDriveDemo/","locales/forms/vehicleQuotation/"],"forms.contactUs":["locales/forms/contactUs/"],"forms.demo":["locales/forms/demo/"],"forms.testDriveDemo":["locales/forms/testDriveDemo/"],"forms.vehicleQuotation":["locales/forms/vehicleQuotation/"],general:["locales/general/"],generalTicketTypes:["locales/generalTicketTypes/"],"partLookup.deadStock":["locales/partLookup/deadStock/"],partLookup:["locales/partLookup/deadStock/","locales/partLookup/distributor/","locales/partLookup/manufacturer/"],"partLookup.distributor":["locales/partLookup/distributor/"],"partLookup.manufacturer":["locales/partLookup/manufacturer/"],"vehicleLookup.accessories":["locales/vehicleLookup/accessories/"],vehicleLookup:["locales/vehicleLookup/accessories/","locales/vehicleLookup/claimableItems/","locales/vehicleLookup/paintThickness/","locales/vehicleLookup/saleInformation/","locales/vehicleLookup/serviceHistory/","locales/vehicleLookup/specification/","locales/vehicleLookup/warranty/"],"vehicleLookup.claimableItems":["locales/vehicleLookup/claimableItems/"],"vehicleLookup.paintThickness":["locales/vehicleLookup/paintThickness/"],"vehicleLookup.serviceHistory":["locales/vehicleLookup/serviceHistory/"],"vehicleLookup.saleInformation":["locales/vehicleLookup/saleInformation/"],"vehicleLookup.specification":["locales/vehicleLookup/specification/"],"vehicleLookup.warranty":["locales/vehicleLookup/warranty/"],"forms*":["locales/forms/"]},a={};async function r(c){const[s,t]=await Promise.all([n(c,"errors",o),n(c,"-",e)]);return Object.assign({errors:s},t)}async function i(s){const[t,l,a]=await Promise.all([n(s,"errors",o),n(s,"-",e),n(s,"forms*",c)]);return Object.assign(Object.assign(Object.assign({},l),a),t)}async function n(o,e,c){const t=s[o]||s.en,a=l[e];if(!a||!a.length)throw new Error(`Locale file not found for component: ${e}`);if(1===a.length){const o=a[0]+t,e=await f(o);try{c.validateSync(e,{strict:!0,abortEarly:!1})}catch(e){console.error(`Failed to parse locale file: ${o}`),console.error(e)}return e}{const o=a.map((o=>f(o+t))),s=await Promise.all(o),l={};u(e,c.getDefault(),l,t);try{c.validateSync(l,{strict:!0,abortEarly:!1})}catch(o){console.error(`Failed to parse locale file component: ${e}`),console.error(o)}return s}}function p(o){return"object"==typeof o&&null!==o&&!Array.isArray(o)}function u(o,e,c,s){let t=!1;Object.entries(e).forEach((([e,r])=>{if("string"!=typeof r||t){if(p(r)){const t=o+"."+e;if(Object.entries(r).some((([o,e])=>p(e))))c[e]={},u(t,r,c[e],s);else if(l[t]&&l[t].length){const o=l[t][0]+s;a[o]&&(c[e]=a[o])}}}else{if(l[o]){const e=l[o][0]+s;a[e]&&Object.assign(c,a[e])}t=!0}}))}async function f(o){if(a[o])return await a[o];try{const e=fetch(`https://cdn.jsdelivr.net/npm/adp-web-components@${t}/dist/${o}`).then((e=>(e.ok||delete a[o],e.json())));a[o]=e;const c=await e;return a[o]=c,c}catch(e){return delete a[o],{}}}export{n as a,i as b,r as g,t as v}