: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
throw new SyntaxError("Expected attribute value");
function parsePattern() {
first = match1(RE_TEXT_RUN);
if (source[cursor] === "{" || source[cursor] === "}") {
return parsePatternElements(first ? [first] : [], Infinity);
let indent = parseIndent();
return parsePatternElements([first, indent], indent.length);
indent.value = trim(indent.value, RE_LEADING_NEWLINES);
return parsePatternElements([indent], indent.length);
return trim(first, RE_TRAILING_SPACES);
function parsePatternElements(elements = [], commonIndent) {
elements.push(match1(RE_TEXT_RUN));
if (source[cursor] === "{") {
elements.push(parsePlaceable());
if (source[cursor] === "}") {
throw new SyntaxError("Unbalanced closing brace");
let indent = parseIndent();
commonIndent = Math.min(commonIndent, indent.length);
let lastIndex = elements.length - 1;
let lastElement = elements[lastIndex];
if (typeof lastElement === "string") {
elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);
for (let element of elements) {
if (element instanceof Indent) {
element = element.value.slice(0, element.value.length - commonIndent);
function parsePlaceable() {
consumeToken(TOKEN_BRACE_OPEN, SyntaxError);
let selector = parseInlineExpression();
if (consumeToken(TOKEN_BRACE_CLOSE)) {
if (consumeToken(TOKEN_ARROW)) {
let variants = parseVariants();
consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);
throw new SyntaxError("Unclosed placeable");
function parseInlineExpression() {
if (source[cursor] === "{") {
if (test(RE_REFERENCE)) {
let [, sigil, name, attr = null] = match(RE_REFERENCE);
if (consumeToken(TOKEN_PAREN_OPEN)) {
let args = parseArguments();
if (RE_FUNCTION_NAME.test(name)) {
throw new SyntaxError("Function names must be all upper-case");
function parseArguments() {
switch (source[cursor]) {
throw new SyntaxError("Unclosed argument list");
args.push(parseArgument());
consumeToken(TOKEN_COMMA);
function parseArgument() {
let expr = parseInlineExpression();
if (expr.type !== "mesg") {
if (consumeToken(TOKEN_COLON)) {
function parseVariants() {
while (test(RE_VARIANT_START)) {
let key = parseVariantKey();
let value = parsePattern();
throw new SyntaxError("Expected variant value");
if (star === undefined) {
throw new SyntaxError("Expected default variant");
function parseVariantKey() {
consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);
if (test(RE_NUMBER_LITERAL)) {
key = parseNumberLiteral();
value: match1(RE_IDENTIFIER)
consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);
function parseLiteral() {
if (test(RE_NUMBER_LITERAL)) {
return parseNumberLiteral();
if (source[cursor] === '"') {
return parseStringLiteral();
throw new SyntaxError("Invalid expression");
function parseNumberLiteral() {
let [, value, fraction = ""] = match(RE_NUMBER_LITERAL);
let precision = fraction.length;
value: parseFloat(value),
function parseStringLiteral() {
consumeChar('"', SyntaxError);
value += match1(RE_STRING_RUN);
if (source[cursor] === "\\") {
value += parseEscapeSequence();
throw new SyntaxError("Unclosed string literal");
function parseEscapeSequence() {
if (test(RE_STRING_ESCAPE)) {
return match1(RE_STRING_ESCAPE);
if (test(RE_UNICODE_ESCAPE)) {
let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);
let codepoint = parseInt(codepoint4 || codepoint6, 16);
return codepoint <= 0xd7ff || 0xe000 <= codepoint ? String.fromCodePoint(codepoint) : "�";
throw new SyntaxError("Unknown escape sequence");
consumeToken(TOKEN_BLANK);
switch (source[cursor]) {
return makeIndent(source.slice(start, cursor));
if (source[cursor - 1] === " ") {
return makeIndent(source.slice(start, cursor));
function trim(text, re) {
return text.replace(re, "");
function makeIndent(blank) {
let value = blank.replace(RE_BLANK_LINES, "\n");
let length = RE_INDENT.exec(blank)[1].length;
return new Indent(value, length);
constructor(value, length) {
;// CONCATENATED MODULE: ./node_modules/@fluent/bundle/esm/index.js
// EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.map.js
var esnext_iterator_map = __webpack_require__(1454);
;// CONCATENATED MODULE: ./node_modules/@fluent/dom/esm/overlay.js
const reOverlay = /<|&#?\w+;/;
const TEXT_LEVEL_ELEMENTS = {
"http://www.w3.org/1999/xhtml": ["em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "data", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "bdi", "bdo", "span", "br", "wbr"]
const LOCALIZABLE_ATTRIBUTES = {
"http://www.w3.org/1999/xhtml": {
global: ["title", "aria-label", "aria-valuetext"],
area: ["download", "alt"],
input: ["alt", "placeholder"],
textarea: ["placeholder"],
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul": {
global: ["accesskey", "aria-label", "aria-valuetext", "label", "title", "tooltiptext"],
textbox: ["placeholder", "value"]
function translateElement(element, translation) {
if (typeof value === "string") {
if (element.localName === "title" && element.namespaceURI === "http://www.w3.org/1999/xhtml") {
element.textContent = value;
} else if (!reOverlay.test(value)) {
element.textContent = value;
const templateElement = element.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "template");
templateElement.innerHTML = value;
overlayChildNodes(templateElement.content, element);
overlayAttributes(translation, element);
function overlayChildNodes(fromFragment, toElement) {
for (const childNode of fromFragment.childNodes) {
if (childNode.nodeType === childNode.TEXT_NODE) {
if (childNode.hasAttribute("data-l10n-name")) {
const sanitized = getNodeForNamedElement(toElement, childNode);
fromFragment.replaceChild(sanitized, childNode);
if (isElementAllowed(childNode)) {
const sanitized = createSanitizedElement(childNode);
fromFragment.replaceChild(sanitized, childNode);
console.warn(`An element of forbidden type "${childNode.localName}" was found in ` + "the translation. Only safe text-level elements and elements with " + "data-l10n-name are allowed.");
fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);
toElement.textContent = "";
toElement.appendChild(fromFragment);
function hasAttribute(attributes, name) {
for (let attr of attributes) {
if (attr.name === name) {
function overlayAttributes(fromElement, toElement) {
const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") ? toElement.getAttribute("data-l10n-attrs").split(",").map(i => i.trim()) : null;
for (const attr of Array.from(toElement.attributes)) {
if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && !hasAttribute(fromElement.attributes, attr.name)) {
toElement.removeAttribute(attr.name);
if (!fromElement.attributes) {
for (const attr of Array.from(fromElement.attributes)) {
if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && toElement.getAttribute(attr.name) !== attr.value) {
toElement.setAttribute(attr.name, attr.value);
function getNodeForNamedElement(sourceElement, translatedChild) {
const childName = translatedChild.getAttribute("data-l10n-name");
const sourceChild = sourceElement.querySelector(`[data-l10n-name="${childName}"]`);
console.warn(`An element named "${childName}" wasn't found in the source.`);
return createTextNodeFromTextContent(translatedChild);
if (sourceChild.localName !== translatedChild.localName) {
console.warn(`An element named "${childName}" was found in the translation ` + `but its type ${translatedChild.localName} didn't match the ` + `element found in the source (${sourceChild.localName}).`);
return createTextNodeFromTextContent(translatedChild);
sourceElement.removeChild(sourceChild);
const clone = sourceChild.cloneNode(false);
return shallowPopulateUsing(translatedChild, clone);
function createSanitizedElement(element) {
const clone = element.ownerDocument.createElement(element.localName);
return shallowPopulateUsing(element, clone);
function createTextNodeFromTextContent(element) {
return element.ownerDocument.createTextNode(element.textContent);
function isElementAllowed(element) {
const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];
return allowed && allowed.includes(element.localName);
function isAttrNameLocalizable(name, element, explicitlyAllowed = null) {
if (explicitlyAllowed && explicitlyAllowed.includes(name)) {
const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI];
const attrName = name.toLowerCase();
const elemName = element.localName;
if (allowed.global.includes(attrName)) {
if (!allowed[elemName]) {
if (allowed[elemName].includes(attrName)) {
if (element.namespaceURI === "http://www.w3.org/1999/xhtml" && elemName === "input" && attrName === "value") {
const type = element.type.toLowerCase();
if (type === "submit" || type === "button" || type === "reset") {
function shallowPopulateUsing(fromElement, toElement) {
toElement.textContent = fromElement.textContent;
overlayAttributes(fromElement, toElement);
// EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.filter.js
var esnext_iterator_filter = __webpack_require__(4520);
// EXTERNAL MODULE: ./node_modules/core-js/modules/esnext.iterator.for-each.js
var esnext_iterator_for_each = __webpack_require__(3949);
;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_iterable.js
class CachedIterable extends Array {
if (iterable instanceof this) {
return new this(iterable);
;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_sync_iterable.js
class CachedSyncIterable extends CachedIterable {
if (Symbol.iterator in Object(iterable)) {
this.iterator = iterable[Symbol.iterator]();
throw new TypeError("Argument must implement the iteration protocol.");
if (cached.length <= cur) {
cached.push(cached.iterator.next());
const last = this[this.length - 1];
this.push(this.iterator.next());
return this[this.length - 1];
;// CONCATENATED MODULE: ./node_modules/cached-iterable/src/cached_async_iterable.js
class CachedAsyncIterable extends CachedIterable {
if (Symbol.asyncIterator in Object(iterable)) {
this.iterator = iterable[Symbol.asyncIterator]();
} else if (Symbol.iterator in Object(iterable)) {
this.iterator = iterable[Symbol.iterator]();
throw new TypeError("Argument must implement the iteration protocol.");