"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    defaultCurrencyFormatter: ()=>defaultCurrencyFormatter,
    defaultNumberFormatter: ()=>defaultNumberFormatter,
    dispatchNumberFormatEvent: ()=>dispatchNumberFormatEvent
});
const event_utils_cjs_namespaceObject = require("../../../utils/event-utils.cjs");
const dispatchNumberFormatEvent = async (formatter, element)=>{
    const event = (0, event_utils_cjs_namespaceObject.buildCustomEvent)('atomic/numberFormat', formatter);
    const tagName = element.parentElement?.tagName.toLowerCase();
    if (tagName?.includes('atomic-')) await customElements.whenDefined(tagName);
    if (element.parentElement && 'updateComplete' in element.parentElement) await element.parentElement.updateComplete;
    else if ('componentOnReady' in element.parentElement) await element.parentElement.componentOnReady();
    const handled = !element.dispatchEvent(event);
    if (!handled) throw new Error('The Atomic number format component was not handled, as it is not a child of a compatible component');
};
const defaultNumberFormatter = (value, languages)=>value.toLocaleString(languages);
const defaultCurrencyFormatter = (currency)=>(value, languages)=>value.toLocaleString(languages, {
            style: 'currency',
            currency
        });
exports.defaultCurrencyFormatter = __webpack_exports__.defaultCurrencyFormatter;
exports.defaultNumberFormatter = __webpack_exports__.defaultNumberFormatter;
exports.dispatchNumberFormatEvent = __webpack_exports__.dispatchNumberFormatEvent;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "defaultCurrencyFormatter",
    "defaultNumberFormatter",
    "dispatchNumberFormatEvent"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
