"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__, {
    localizedString: ()=>localizedString
});
const external_lit_namespaceObject = require("lit");
const directive_js_namespaceObject = require("lit/directive.js");
class LocalizedStringDirective extends directive_js_namespaceObject.Directive {
    render(props) {
        const { i18n, key, params, count } = props;
        const getPlaceholderForParamKey = (paramKey)=>`${this.delimitingCharacter}${this.placeholderPrefixCharacter}${paramKey}${this.delimitingCharacter}`;
        const getParamFromPlaceholder = (placeholder)=>params[placeholder.slice(1)];
        const placeholdersMap = Object.fromEntries(Object.keys(params).map((paramKey)=>[
                paramKey,
                getPlaceholderForParamKey(paramKey)
            ]));
        const localizedStringWithPlaceholders = i18n.t(key, {
            interpolation: {
                escapeValue: false
            },
            count: count,
            ...placeholdersMap
        });
        return (0, external_lit_namespaceObject.html)`${localizedStringWithPlaceholders.split(this.delimitingCharacter).map((text)=>text.startsWith(this.placeholderPrefixCharacter) ? getParamFromPlaceholder(text) : text)}`;
    }
    constructor(partInfo){
        super(partInfo), this.delimitingCharacter = '\u001d', this.placeholderPrefixCharacter = '\u001a';
        if (partInfo.type !== directive_js_namespaceObject.PartType.CHILD) throw new Error('localizedString can only be used in child bindings');
    }
}
const localizedString = (0, directive_js_namespaceObject.directive)(LocalizedStringDirective);
exports.localizedString = __webpack_exports__.localizedString;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "localizedString"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
