locize
Version:
This package adds the incontext editor to your i18next setup.
817 lines (787 loc) • 165 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.locize = {}));
})(this, (function (exports) { 'use strict';
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
var isBrowser = typeof window !== 'undefined';
var INVISIBLE_CHARACTERS = isBrowser ? ["\u200C", "\u200D"] : ["\u200B", "\u200C"];
var INVISIBLE_REGEX = RegExp("([".concat(INVISIBLE_CHARACTERS.join(''), "]{9})+"), 'gu');
var TEMPLATE_MINIMUM_LENGTH = '{"k":"a"}'.length;
var invisibleStartMarker = 'subliminal:start';
var toBytes = function toBytes(text) {
return Array.from(new TextEncoder().encode(text));
};
var fromBytes = function fromBytes(bytes) {
return new TextDecoder().decode(new Uint8Array(bytes));
};
var padToWholeBytes = function padToWholeBytes(binary) {
var needsToAdd = 8 - binary.length;
return '0'.repeat(needsToAdd) + binary;
};
var encodeMessage = function encodeMessage(text) {
var bytes = toBytes(text).map(Number);
var binary = bytes.map(function (byte) {
return padToWholeBytes(byte.toString(2)) + '0';
}).join('');
var result = Array.from(binary).map(function (b) {
return INVISIBLE_CHARACTERS[Number(b)];
}).join('');
return result;
};
var encodedInvisibleStartMarker = encodeMessage(invisibleStartMarker) ;
var decodeMessage = function decodeMessage(message) {
var binary = Array.from(message).map(function (character) {
return INVISIBLE_CHARACTERS.indexOf(character);
}).map(String).join('');
var textBytes = binary.match(/(.{9})/g);
var codes = Uint8Array.from((textBytes === null || textBytes === void 0 ? void 0 : textBytes.map(function (byte) {
return parseInt(byte.slice(0, 8), 2);
})) || []);
return fromBytes(codes);
};
var decodeFromText = function decodeFromText(text) {
var _text$match;
var invisibleMessages = (_text$match = text.match(INVISIBLE_REGEX)) === null || _text$match === void 0 ? void 0 : _text$match.filter(function (m) {
return m.length > TEMPLATE_MINIMUM_LENGTH - 1;
});
if (!invisibleMessages || invisibleMessages.length === 0) return;
return decodeMessage(invisibleMessages[invisibleMessages.length - 1]);
};
var removeInvisibles = function removeInvisibles(text) {
return text.replace(INVISIBLE_REGEX, '');
};
var encodeValue = function encodeValue(data) {
if (Object.keys(data).length === 0) return data;
var value = {
k: data.key,
n: data.ns,
l: data.lng,
s: data.source
};
return JSON.stringify(value);
};
var decodeValue = function decodeValue(value) {
if (!value || typeof value !== 'string' || value.indexOf('{') !== 0) return;
try {
var parsed = JSON.parse(value || '{}');
return {
key: parsed.k,
ns: parsed.n,
lng: parsed.l,
source: parsed.s
};
} catch (e) {
return undefined;
}
};
function wrap(text) {
var invisibleMeta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var encodedValue = encodeValue(invisibleMeta);
var invisibleMark = encodeMessage(encodedValue);
return typeof text === 'string' && text ? encodedInvisibleStartMarker + text + invisibleMark : text;
}
function unwrap(text) {
var encodedValue = decodeFromText(text);
var decodedVal = decodeValue(encodedValue);
var result = removeInvisibles(text);
return {
text: result,
invisibleMeta: decodedVal
};
}
function containsHiddenMeta(text) {
if (!text || text.length < 27) return false;
if (!INVISIBLE_REGEX.test(text)) return false;
var lastByte = text.substring(text.length - 9);
var lastChar = decodeMessage(lastByte);
return lastChar === '}';
}
function containsHiddenStartMarker(text) {
return text.startsWith(encodedInvisibleStartMarker);
}
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var postProcessorName = 'subliminal';
var SubliminalPostProcessor = {
name: postProcessorName,
type: 'postProcessor',
options: {},
setOptions: function setOptions(options) {
this.options = _objectSpread$7(_objectSpread$7({}, options), this.options);
},
process: function process(value, keyIn, options, translator) {
var opt = this.options = _objectSpread$7(_objectSpread$7({}, options), this.options);
var key, ns, lng, source;
if (options.i18nResolved) {
key = options.i18nResolved.exactUsedKey;
ns = options.i18nResolved.usedNS;
lng = options.i18nResolved.usedLng;
if (options.i18nResolved.res === undefined) {
if (key !== value) {
source = 'default';
} else {
source = 'key';
}
} else {
source = 'translation';
}
} else {
var _ref, _opt$keySeparator, _translator$options, _ref2, _namespaces$, _translator$options2;
var keySeparator = (_ref = (_opt$keySeparator = opt.keySeparator) !== null && _opt$keySeparator !== void 0 ? _opt$keySeparator : translator === null || translator === void 0 || (_translator$options = translator.options) === null || _translator$options === void 0 ? void 0 : _translator$options.keySeparator) !== null && _ref !== void 0 ? _ref : '.';
var _translator$extractFr = translator.extractFromKey(keyIn.join(keySeparator), options),
extractedKey = _translator$extractFr.key,
namespaces = _translator$extractFr.namespaces;
key = extractedKey;
ns = (_ref2 = (_namespaces$ = namespaces === null || namespaces === void 0 ? void 0 : namespaces[0]) !== null && _namespaces$ !== void 0 ? _namespaces$ : opt.ns) !== null && _ref2 !== void 0 ? _ref2 : translator === null || translator === void 0 || (_translator$options2 = translator.options) === null || _translator$options2 === void 0 ? void 0 : _translator$options2.defaultNS;
lng = options.lng || this.language;
if (key === value) {
source = 'key';
} else {
source = 'translation';
}
}
return wrap(value, {
key: key,
ns: ns,
lng: lng,
source: source
});
},
overloadTranslationOptionHandler: function overloadTranslationOptionHandler() {
return {
postProcess: postProcessorName,
postProcessPassResolved: true
};
}
};
var validAttributes = ['placeholder', 'title', 'alt'];
var ignoreElements = ['SCRIPT'];
var colors = {
highlight: '#1976d2',
warning: '#e67a00',
gray: '#ccc'
};
var getIframeUrl = function getIframeUrl() {
var _prc$env;
var p;
if (typeof process !== 'undefined') p = process;
if (!p && typeof window !== 'undefined') p = window.process;
var prc = p || {};
var env = ((_prc$env = prc.env) === null || _prc$env === void 0 ? void 0 : _prc$env.locizeIncontext) || 'production';
return env === 'development' ? 'http://localhost:3003/' : env === 'staging' ? 'https://incontext-dev.locize.app' : 'https://incontext.locize.app';
};
var sheet = function () {
if (typeof document === 'undefined') return;
var style = document.createElement('style');
document.head.appendChild(style);
return style.sheet;
}();
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var data$1 = {};
function clean$1() {
Object.values(data$1).forEach(function (item) {
if (!document.body.contains(item.node)) {
resetHighlight(item.id, item.node);
delete data$1[item.id];
}
});
}
function save$1(id, type, node, txt) {
if (!id || !type || !node) return;
if (!data$1[id]) {
data$1[id] = {
id: id,
node: node
};
}
data$1[id].keys = _objectSpread$6(_objectSpread$6({}, data$1[id].keys), {}, _defineProperty({}, "".concat(type), {
value: txt,
eleUniqueID: id,
textType: type
}));
}
function remove(id, node) {
resetHighlight(id, node);
delete data$1[id];
}
function removeKey(id, key, node) {
var item = get$1(id);
if (!item) return;
delete item.keys["".concat(key)];
if (!Object.keys(item.keys).length) remove(id, node);
}
function get$1(id) {
return data$1[id];
}
var uninstrumentedStore = {
save: save$1,
remove: remove,
removeKey: removeKey,
clean: clean$1,
get: get$1,
data: data$1
};
function _arrayWithHoles(r) {
if (Array.isArray(r)) return r;
}
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e,
n,
i,
u,
a = [],
f = !0,
o = !1;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = !1;
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
} catch (r) {
o = !0, n = r;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a;
}
}
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this;
var args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
function getAttribute(el, name) {
return el && el.getAttribute && el.getAttribute(name);
}
function getElementI18nKey(el) {
var key = getAttribute(el, 'data-i18n');
if (key) return key;
if (el.nodeType === window.Node.TEXT_NODE && el.parentElement) {
return getElementI18nKey(el.parentElement);
}
return undefined;
}
function parseAttrFromKey(key) {
var attr = 'text';
if (key.indexOf('[') === 0) {
var parts = key.split(']');
key = parts[1];
attr = parts[0].substr(1, parts[0].length - 1);
}
var newKey = key.indexOf(';') === key.length - 1 ? key.substr(0, key.length - 2) : key;
return [newKey, attr];
}
function getI18nMetaFromNode(el) {
var hasNamespacePrependToKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var key = getElementI18nKey(el);
var ns = getElementNamespace(el);
var allKeys = {};
if (key && key.indexOf(';') >= 0) {
var keys = key.split(';');
for (var ix = 0, lix = keys.length; ix < lix; ix++) {
if (keys[ix] != '') {
var _parseAttrFromKey = parseAttrFromKey(keys[ix]),
_parseAttrFromKey2 = _slicedToArray(_parseAttrFromKey, 2),
usedKey = _parseAttrFromKey2[0],
attr = _parseAttrFromKey2[1];
allKeys[attr] = usedKey;
}
}
} else if (key) {
var _parseAttrFromKey3 = parseAttrFromKey(key),
_parseAttrFromKey4 = _slicedToArray(_parseAttrFromKey3, 2),
_usedKey = _parseAttrFromKey4[0],
_attr = _parseAttrFromKey4[1];
allKeys[_attr] = _usedKey;
}
if (Object.keys(allKeys).length < 1) return null;
var res = Object.keys(allKeys).reduce(function (mem, attr) {
var key = allKeys[attr];
var usedNS = ns;
var usedKey = key;
if (hasNamespacePrependToKey && key.indexOf(':') > -1) {
var parts = key.split(':');
usedKey = parts[1];
usedNS = parts[0];
}
mem[attr] = {
key: usedKey,
ns: usedNS
};
return mem;
}, {});
return res;
}
function getElementNamespace(el) {
var found;
var find = function find(ele) {
var opts = getAttribute(ele, 'i18next-options');
if (!opts) opts = getAttribute(ele, 'data-i18next-options');
if (!opts) opts = getAttribute(ele, 'i18n-options');
if (!opts) opts = getAttribute(ele, 'data-i18n-options');
if (opts) {
var jsonData = {};
try {
jsonData = JSON.parse(opts);
} catch (e) {}
if (jsonData.ns) found = jsonData.ns;
}
if (!found) found = getAttribute(ele, 'i18next-ns');
if (!found) found = getAttribute(ele, 'data-i18next-ns');
if (!found) found = getAttribute(ele, 'i18n-ns');
if (!found) found = getAttribute(ele, 'data-i18n-ns');
if (!found && ele.parentElement) find(ele.parentElement);
};
find(el);
return found;
}
function getQsParameterByName(name, url) {
if (typeof window === 'undefined') return null;
if (!url) url = window.location.href.toLowerCase();
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
var _isInIframe = typeof window !== 'undefined';
try {
_isInIframe = self !== top;
} catch (e) {}
var isInIframe = _isInIframe;
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var legacyEventMapping = {
committed: 'commitKeys'
};
function getMappedLegacyEvent(msg) {
if (legacyEventMapping[msg]) return legacyEventMapping[msg];
return msg;
}
function addLocizeSavedHandler(handler) {
api.locizeSavedHandler = handler;
}
function setEditorLng(lng) {
api.sendCurrentTargetLanguage(lng);
}
var pendingMsgs = [];
var allowedActionsBeforeInit = ['locizeIsEnabled', 'requestInitialize'];
function sendMessage(action, payload) {
if (!api.source) {
var _document$getElementB;
api.source = (_document$getElementB = document.getElementById('i18next-editor-iframe')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.contentWindow;
}
if (!api.origin) api.origin = getIframeUrl();
if (!api.source || !api.source.postMessage || !api.initialized && allowedActionsBeforeInit.indexOf(action) < 0) {
pendingMsgs.push({
action: action,
payload: payload
});
return;
}
if (api.legacy) {
api.source.postMessage(_objectSpread$5({
message: action
}, payload), api.origin);
} else {
api.source.postMessage({
sender: 'i18next-editor',
senderAPIVersion: 'v2',
action: action,
message: action,
payload: payload
}, api.origin);
}
var todo = pendingMsgs;
pendingMsgs = [];
todo.forEach(function (_ref) {
var action = _ref.action,
payload = _ref.payload;
sendMessage(action, payload);
});
}
var sendCurrentParsedContentDebounced = function sendCurrentParsedContentDebounced() {
sendMessage('sendCurrentParsedContent', {
content: Object.values(store.data).map(function (item) {
return {
id: item.id,
keys: item.keys
};
}),
uninstrumented: Object.values(uninstrumentedStore.data).map(function (item) {
return {
id: item.id,
keys: item.keys
};
})
});
};
var handlers = {};
var repeat = 5;
var api = {
init: function init(implementation, clickHandler) {
api.i18n = implementation;
api.clickHandler = clickHandler;
},
requestInitialize: function requestInitialize(payload) {
sendMessage('requestInitialize', payload);
if (api.initInterval) return;
api.initInterval = setInterval(function () {
repeat = repeat - 1;
api.requestInitialize(payload);
if (repeat < 0 && api.initInterval) {
clearInterval(api.initInterval);
delete api.initInterval;
}
}, 2000);
},
selectKey: function selectKey(meta) {
sendMessage('selectKey', meta);
},
confirmResourceBundle: function confirmResourceBundle(payload) {
sendMessage('confirmResourceBundle', payload);
},
sendCurrentParsedContent: debounce(sendCurrentParsedContentDebounced, 500),
sendCurrentTargetLanguage: function sendCurrentTargetLanguage(lng) {
sendMessage('sendCurrentTargetLanguage', {
targetLng: lng || api.i18n && api.i18n.getLng && api.i18n.getLng()
});
},
sendHrefchanged: function sendHrefchanged(href) {
sendMessage('hrefChanged', {
href: href
});
},
addHandler: function addHandler(action, fc) {
if (!handlers[action]) handlers[action] = [];
handlers[action].push(fc);
},
sendLocizeIsEnabled: function sendLocizeIsEnabled(payload) {
sendMessage('locizeIsEnabled', _objectSpread$5(_objectSpread$5({}, payload), {}, {
enabled: true
}));
},
onAddedKey: function onAddedKey(lng, ns, key, value) {
var msg = {
lng: lng,
ns: ns,
key: key,
value: value
};
sendMessage('added', msg);
}
};
if (typeof window !== 'undefined') {
window.addEventListener('message', function (e) {
var _e$data = e.data,
sender = _e$data.sender,
action = _e$data.action,
message = _e$data.message,
payload = _e$data.payload;
if (message) {
var usedEventName = getMappedLegacyEvent(message);
if (handlers[usedEventName]) {
handlers[usedEventName].forEach(function (fc) {
fc(payload, e);
});
}
} else if (sender === 'i18next-editor-frame' && handlers[action]) {
handlers[action].forEach(function (fc) {
fc(payload, e);
});
}
});
}
function setValueOnNode(meta, value) {
var item = store.get(meta.eleUniqueID);
if (!item || !item.keys[meta.textType]) return;
var txtWithHiddenMeta = item.subliminal ? wrap(value, item.subliminal) : value;
if (meta.textType === 'text') {
item.node.textContent = txtWithHiddenMeta;
} else if (meta.textType.indexOf('attr:') === 0) {
var attr = meta.textType.replace('attr:', '');
item.node.setAttribute(attr, txtWithHiddenMeta);
} else if (meta.textType === 'html') {
var id = "".concat(meta.textType, "-").concat(meta.children);
if (!item.originalChildNodes) {
var clones = [];
item.node.childNodes.forEach(function (c) {
clones.push(c);
});
item.originalChildNodes = clones;
}
if (item.children[id].length === item.node.childNodes.length) {
item.node.innerHTML = txtWithHiddenMeta;
} else {
var children = item.children[id];
var first = children[0].child;
var dummy = document.createElement('div');
dummy.innerHTML = txtWithHiddenMeta;
var nodes = [];
dummy.childNodes.forEach(function (c) {
nodes.push(c);
});
nodes.forEach(function (c) {
try {
item.node.insertBefore(c, first);
} catch (error) {
item.node.appendChild(c);
}
});
children.forEach(function (replaceable) {
if (item.node.contains(replaceable.child)) {
item.node.removeChild(replaceable.child);
}
});
}
}
}
function handler$8(payload) {
var meta = payload.meta,
value = payload.value;
if (meta && value !== undefined) {
setValueOnNode(meta, value);
}
}
api.addHandler('editKey', handler$8);
function handler$7(payload) {
var meta = payload.meta,
value = payload.value,
lng = payload.lng;
if (meta && value !== undefined) {
setValueOnNode(meta, value);
var usedLng = lng || api.i18n.getLng();
api.i18n.setResource(usedLng, meta.ns, meta.key, value);
api.i18n.triggerRerender();
}
}
api.addHandler('commitKey', handler$7);
function _arrayWithoutHoles(r) {
if (Array.isArray(r)) return _arrayLikeToArray(r);
}
function _iterableToArray(r) {
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function handler$6(payload) {
var updated = payload.updated;
updated.forEach(function (item) {
var lng = item.lng,
ns = item.ns,
key = item.key,
data = item.data,
metas = item.metas,
meta = item.meta;
if (meta && data.value) setValueOnNode(meta, data.value);
if (metas) {
Object.values(metas).forEach(function (metaItem) {
setValueOnNode(metaItem, data.value);
});
}
api.i18n.setResource(lng, ns, key, data.value);
if (metas) {
Object.values(metas).forEach(function (m) {
var sItem = store.get(m.eleUniqueID);
recalcSelectedHighlight(sItem, sItem.node, sItem.keys);
});
}
});
Object.values(store.data).forEach(function (item) {
if (item.originalChildNodes) {
var _item$node;
(_item$node = item.node).replaceChildren.apply(_item$node, _toConsumableArray(item.originalChildNodes));
}
});
api.i18n.triggerRerender();
if (api.locizeSavedHandler) api.locizeSavedHandler(payload);
if (window.locizeSavedHandler) window.locizeSavedHandler(payload);
}
api.addHandler('commitKeys', handler$6);
function handler$5(payload) {
api.initialized = true;
clearInterval(api.initInterval);
delete api.initInterval;
api.sendCurrentParsedContent();
api.sendCurrentTargetLanguage();
}
api.addHandler('confirmInitialized', handler$5);
function isInViewport(el) {
var rect = el.getBoundingClientRect();
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
var windowWidth = window.innerWidth || document.documentElement.clientWidth;
var vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;
var horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;
return vertInView && horInView;
}
function mouseDistanceFromElement(mouseEvent, element) {
var $n = element,
mX = mouseEvent.pageX,
mY = mouseEvent.pageY,
from = {
x: mX,
y: mY
},
off = $n.getBoundingClientRect(),
ny1 = off.top + document.documentElement.scrollTop,
ny2 = ny1 + $n.offsetHeight,
nx1 = off.left + document.documentElement.scrollLeft,
nx2 = nx1 + $n.offsetWidth,
maxX1 = Math.max(mX, nx1),
minX2 = Math.min(mX, nx2),
maxY1 = Math.max(mY, ny1),
minY2 = Math.min(mY, ny2),
intersectX = minX2 >= maxX1,
intersectY = minY2 >= maxY1,
to = {
x: intersectX ? mX : nx2 < mX ? nx2 : nx1,
y: intersectY ? mY : ny2 < mY ? ny2 : ny1
},
distX = to.x - from.x,
distY = to.y - from.y,
hypot = Math.pow(Math.pow(distX, 2) + Math.pow(distY, 2), 1 / 2);
return Math.floor(hypot);
}
function getOptimizedBoundingRectEle(node) {
var refEle = node;
if (node.childNodes.length === 1) {
var childNode = node.childNodes[0];
if (childNode && childNode.nodeName === '#text') {
var range = document.createRange();
range.selectNode(childNode);
var rect = range.getBoundingClientRect();
refEle = {
getBoundingClientRect: function getBoundingClientRect() {
return rect;
}
};
}
}
return refEle;
}
var debouncedUpdateDistance = debounce(function (e, observer) {
Object.values(store.data).forEach(function (item) {
if (!isInViewport(item.node)) return;
var distance = mouseDistanceFromElement(e, item.node);
if (distance < 5) {
highlight(item, item.node, item.keys);
} else if (distance > 5) {
var boxDistance = item.ribbonBox ? mouseDistanceFromElement(e, item.ribbonBox) : 1000;
if (boxDistance > 10) resetHighlight(item, item.node, item.keys);
}
});
Object.values(uninstrumentedStore.data).forEach(function (item) {
if (!isInViewport(item.node)) return;
var distance = mouseDistanceFromElement(e, item.node);
if (distance < 10) {
highlightUninstrumented(item, item.node, item.keys);
} else if (distance > 10) {
resetHighlight(item, item.node, item.keys);
}
});
}, 50);
var currentFC;
function startMouseTracking(observer) {
currentFC = function handle(e) {
debouncedUpdateDistance(e, observer);
};
document.addEventListener('mousemove', currentFC);
}
function stopMouseTracking() {
document.removeEventListener('mousemove', currentFC);
}
var iconEdit = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFFFFF"><g></g><g><g><g><path d="M3,21l3.75,0L17.81,9.94l-3.75-3.75L3,17.25L3,21z M5,18.08l9.06-9.06l0.92,0.92L5.92,19L5,19L5,18.08z"/></g><g><path d="M18.37,3.29c-0.39-0.39-1.02-0.39-1.41,0l-1.83,1.83l3.75,3.75l1.83-1.83c0.39-0.39,0.39-1.02,0-1.41L18.37,3.29z"/></g></g></g></svg>';
var i18nextIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 210 304\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"#fff\" fill-rule=\"evenodd\">\n <g stroke=\"none\" class=\"B\">\n <path d=\"M 142 31.5 v 57.2 l 64.3 165.1 s 19.6 40.3 -36.5 50.1 h -128 s -52.3 -5.5 -39.8 -46.9 L 69.5 88.7 V 31.5 z\" fill=\"#009688\"/>\n <path d=\"M 143.3 24.8 H 66.2 c -6.2 0 -11.3 -5.6 -11.3 -12.4 S 60 0 66.2 0 h 77.1 c 6.3 0 11.3 5.6 11.3 12.4 s -5.1 12.4 -11.3 12.4 z\" class=\"C\" fill=\"#004d40\"/>\n <path d=\"M 123 124.9 c 8.3 0 15 8.1 15 18.1 c 0 10 -6.8 18.1 -15 18.1 c -8.3 0 -15 -8.1 -15 -18.1 c 0 -10 6.7 -18.1 15 -18.1 z m -58.8 31.7 c 0 -8.5 5.6 -15.3 12.7 -15.3 s 12.7 6.8 12.7 15.3 s -5.6 15.3 -12.7 15.3 s -12.7 -6.8 -12.7 -15.3 z\" fill=\"white\"/>\n <path d=\"M 147.7 84.9 V 57.7 s 34.5 -7.6 51.7 32.5 c 0 0 -26.9 19.6 -51.7 -5.3 z m -84.5 0 V 57.7 s -34.5 -7.6 -51.7 32.5 c 0 0 26.8 19.6 51.7 -5.3 z\" class=\"C\" fill=\"#004d40\"/>\n <path d=\"M 168.4 197.5 c -56.1 -17.4 -103.3 -8.1 -126.3 -1 l -23.2 56 c -10.5 33.4 33.2 37.8 33.2 37.8 h 106.9 c 46.9 -7.9 30.5 -40.4 30.5 -40.4 z\" fill=\"white\"/>\n <path d=\"M 87.6 218.3 c 0 6 -8.1 10.9 -18.1 10.9 s -18.1 -4.9 -18.1 -10.9 c 0 -6.1 8.1 -10.9 18.1 -10.9 s 18.1 4.9 18.1 10.9 z m 64.4 0 c 0 6 -8.1 10.9 -18.1 10.9 c -10 0 -18.1 -4.9 -18.1 -10.9 c 0 -6.1 8.1 -10.9 18.1 -10.9 c 10 0 18.1 4.9 18.1 10.9 z\" class=\"C\" fill=\"#004d40\"/>\n </g>\n</svg>\n";
var locizeIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 194.667 196\" height=\"196\" width=\"194.667\" xml:space=\"preserve\">\n <defs>\n <clipPath id=\"a\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M5.5 74.048C5.5 36.98 35.551 6.93 72.619 6.93c37.069 0 67.119 30.05 67.119 67.118 0 37.07-30.05 67.12-67.119 67.12-37.068 0-67.119-30.05-67.119-67.12\"/>\n </clipPath>\n <clipPath id=\"b\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M0 147h146V0H0Z\"/>\n </clipPath>\n <clipPath id=\"c\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M88.756 55.055h50.982l4.512 88.195-64 1.25z\"/>\n </clipPath>\n </defs>\n <g clip-path=\"url(#a)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.766-5.554 1.148-8.427 0-11.107-1.149-2.681-2.49-7.469-1.341-10.724 1.149-3.255 2.872-10.34 4.404-10.533 1.532-.19-1.148 7.66.383 5.171 1.533-2.49 1.533-6.193 4.214-8.746 2.68-2.553 6.319-2.17 9.192-4.658 2.872-2.49 5.744-6.129 8.425-5.746 0 0-.192-1.914-1.532-5.17-1.34-3.255-1.532-7.084.192-9.383 1.723-2.298 3.446-5.746 4.979-7.469 1.532-1.723 2.681-10.915 2.297-15.51-.382-4.596 1.724-14.937 6.511-17.236 4.787-2.298 0 1.15-.957 4.022-.958 2.872.739 9.575 3.052 10.533 2.309.958 4.416 4.787 6.139 7.469 1.724 2.68 6.128 3.83 7.469 7.084 1.341 3.255.766 7.085 1.532 8.809.766 1.724 2.873 5.554-1.724 7.852-4.595 2.298-6.51 1.148-6.702 3.255-.192 2.107-1.341 4.404-4.595 5.361-3.256.959-6.129 2.816-9.768 3.227-3.638.412-4.404-2.461-6.319-.928-1.914 1.531-3.446 3.064-4.213 4.978-.765 1.915-3.064.766-2.871 1.915.19 1.15 3.254 4.404-.193 3.255-3.446-1.148-6.51-.765-6.319 2.298.193 3.064 4.405 4.214 6.129 4.597 1.722.383 3.063-1.723 5.17-3.065 2.106-1.34.191 1.915 1.34 4.214 1.149 2.298 5.554 2.106 6.128 5.361.575 3.255-.191 5.937 3.256 6.32 3.446.383 7.084-.191 7.468 1.533.382 1.722-4.022-.576-4.213 1.531-.192 2.106 3.829 4.978 4.978 2.872 1.149-2.106 4.022-2.298 4.405-1.531.383.765 0 2.105-1.341 5.361-1.34 3.256-2.681 2.298-3.829 5.936-1.149 3.639-3.064-.191-4.979 1.724s-4.213 5.937-4.597 2.489c-.382-3.446-.382-5.361-2.105-8.042-1.724-2.682-2.489-.575-4.022 1.149-1.532 1.723-4.979 3.447-3.83 4.978C23.362 4.979 24.511 9 26.234 7.85c1.724-1.149 4.405-1.149 4.022.767-.383 1.914 0 2.681.766 3.638.766.958 3.447 2.682 3.447-.766 0-3.447-.384-4.405 2.298-4.788 2.681-.383 5.744-.574 5.554 1.149-.193 1.724.766 1.341 0 4.214-.767 2.873-3.065 3.063-5.554 4.405-2.489 1.34-3.83 3.446-5.936 2.68s-2.299-1.531-2.49-3.638c-.192-2.107-1.341-2.873-2.107-1.915-.765.957.192 4.022-2.68 2.106-2.873-1.914-4.021-5.171-5.553-2.872-1.533 2.297 2.297 6.319-1.724 4.595-4.022-1.723-6.895-3.637-4.788-4.404 2.107-.766 4.214-2.107 2.107-2.873-2.107-.765-6.32.575-7.852-.957C4.212 7.66 0 0 0 0\" transform=\"translate(13.926 109.38)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.766-5.554 1.148-8.427 0-11.107-1.149-2.681-2.49-7.469-1.341-10.724 1.149-3.255 2.872-10.34 4.404-10.533 1.532-.19-1.148 7.66.383 5.171 1.533-2.49 1.533-6.193 4.214-8.746 2.68-2.553 6.319-2.17 9.192-4.658 2.872-2.49 5.744-6.129 8.425-5.746 0 0-.192-1.914-1.532-5.17-1.34-3.255-1.532-7.084.192-9.383 1.723-2.298 3.446-5.746 4.979-7.469 1.532-1.723 2.681-10.915 2.297-15.51-.382-4.596 1.724-14.937 6.511-17.236 4.787-2.298 0 1.15-.957 4.022-.958 2.872.739 9.575 3.052 10.533 2.309.958 4.416 4.787 6.139 7.469 1.724 2.68 6.128 3.83 7.469 7.084 1.341 3.255.766 7.085 1.532 8.809.766 1.724 2.873 5.554-1.724 7.852-4.595 2.298-6.51 1.148-6.702 3.255-.192 2.107-1.341 4.404-4.595 5.361-3.256.959-6.129 2.816-9.768 3.227-3.638.412-4.404-2.461-6.319-.928-1.914 1.531-3.446 3.064-4.213 4.978-.765 1.915-3.064.766-2.871 1.915.19 1.15 3.254 4.404-.193 3.255-3.446-1.148-6.51-.765-6.319 2.298.193 3.064 4.405 4.214 6.129 4.597 1.722.383 3.063-1.723 5.17-3.065 2.106-1.34.191 1.915 1.34 4.214 1.149 2.298 5.554 2.106 6.128 5.361.575 3.255-.191 5.937 3.256 6.32 3.446.383 7.084-.191 7.468 1.533.382 1.722-4.022-.576-4.213 1.531-.192 2.106 3.829 4.978 4.978 2.872 1.149-2.106 4.022-2.298 4.405-1.531.383.765 0 2.105-1.341 5.361-1.34 3.256-2.681 2.298-3.829 5.936-1.149 3.639-3.064-.191-4.979 1.724s-4.213 5.937-4.597 2.489c-.382-3.446-.382-5.361-2.105-8.042-1.724-2.682-2.489-.575-4.022 1.149-1.532 1.723-4.979 3.447-3.83 4.978C23.362 4.979 24.511 9 26.234 7.85c1.724-1.149 4.405-1.149 4.022.767-.383 1.914 0 2.681.766 3.638.766.958 3.447 2.682 3.447-.766 0-3.447-.384-4.405 2.298-4.788 2.681-.383 5.744-.574 5.554 1.149-.193 1.724.766 1.341 0 4.214-.767 2.873-3.065 3.063-5.554 4.405-2.489 1.34-3.83 3.446-5.936 2.68s-2.299-1.531-2.49-3.638c-.192-2.107-1.341-2.873-2.107-1.915-.765.957.192 4.022-2.68 2.106-2.873-1.914-4.021-5.171-5.553-2.872-1.533 2.297 2.297 6.319-1.724 4.595-4.022-1.723-6.895-3.637-4.788-4.404 2.107-.766 4.214-2.107 2.107-2.873-2.107-.765-6.32.575-7.852-.957C4.212 7.66 0 0 0 0Z\" transform=\"translate(13.926 109.38)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.01-2.141.575-3.829 2.49-1.915C4.405 0 5.553 2.298 6.895 1.341c1.34-.958 3.638-.703 4.594-.639.959.064 1.15 2.937 3.831 2.554s1.724.574 4.596 2.107c2.873 1.532 9.001 4.212 2.681 3.446-6.32-.766-6.703.958-11.108-1.914-4.403-2.873-5.36-2.873-6.509-3.639-1.149-.766-2.49 2.298-4.022 0C-.575.958.011 2.182 0 0\" transform=\"translate(36.522 130.061)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.01-2.141.575-3.829 2.49-1.915C4.405 0 5.553 2.298 6.895 1.341c1.34-.958 3.638-.703 4.594-.639.959.064 1.15 2.937 3.831 2.554s1.724.574 4.596 2.107c2.873 1.532 9.001 4.212 2.681 3.446-6.32-.766-6.703.958-11.108-1.914-4.403-2.873-5.36-2.873-6.509-3.639-1.149-.766-2.49 2.298-4.022 0C-.575.958.011 2.182 0 0Z\" transform=\"translate(36.522 130.061)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-2.263-1.956-5.744-4.788-3.064-4.788 2.681 0 3.983 1.404 5.439-.447 1.456-1.85.88-4.723.88-6.063 0-1.341-.766-4.406 1.15-8.235 1.915-3.829 2.106-6.319 4.022-3.829 1.914 2.488 6.51 7.276 8.808 7.658 2.298.384 4.597 1.342 5.746 3.257 1.148 1.915 0 3.773 1.914 5.141 1.914 1.369 1.531 3.093 2.107 5.199C27.575 0 32.747 0 30.448 1.148c-2.297 1.15-6.51 1.916-11.49 1.341C13.979 1.915 4.213 3.638 0 0\" transform=\"translate(59.502 135.998)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-2.263-1.956-5.744-4.788-3.064-4.788 2.681 0 3.983 1.404 5.439-.447 1.456-1.85.88-4.723.88-6.063 0-1.341-.766-4.406 1.15-8.235 1.915-3.829 2.106-6.319 4.022-3.829 1.914 2.488 6.51 7.276 8.808 7.658 2.298.384 4.597 1.342 5.746 3.257 1.148 1.915 0 3.773 1.914 5.141 1.914 1.369 1.531 3.093 2.107 5.199C27.575 0 32.747 0 30.448 1.148c-2.297 1.15-6.51 1.916-11.49 1.341C13.979 1.915 4.213 3.638 0 0Z\" transform=\"translate(59.502 135.998)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.218-1.986-.575-2.107.766-2.49 1.34-.383-.575-2.68.957-2.872 1.532-.193 4.979-1.15 5.936 0 .959 1.148-1.531.7-3.255 1.977C2.682-2.107.865 1.41 0 0\" transform=\"translate(38.438 76.826)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.218-1.986-.575-2.107.766-2.49 1.34-.383-.575-2.68.957-2.872 1.532-.193 4.979-1.15 5.936 0 .959 1.148-1.531.7-3.255 1.977C2.682-2.107.865 1.41 0 0Z\" transform=\"translate(38.438 76.826)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-2.063-1.033-1.148-2.682-3.064-3.831-1.915-1.148-1.149-1.531-1.723-4.213-.575-2.68.191-4.212 1.532-2.106S2.298 1.148 0 0\" transform=\"translate(131.121 45.612)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-2.063-1.033-1.148-2.682-3.064-3.831-1.915-1.148-1.149-1.531-1.723-4.213-.575-2.68.191-4.212 1.532-2.106S2.298 1.148 0 0Z\" transform=\"translate(131.121 45.612)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.575-.575-1.532 2.681-2.106 4.213-.575 1.532-.561 4.195 1.056 5.675C.964 11.734 0 7.469 0 5.17 0 2.873.574.575 0 0m-6.704 5.936c-1.341.766-3.828 0-6.892-.957-3.065-.958-.613 2.131.766 4.213 1.233 1.861.574-.574 3.256-.766 2.68-.192 4.213-3.256 2.87-2.49m-4.402-6.511c-.192-1.531.574-4.021-3.639-3.064-4.213.958-4.213 3.256-5.936 1.533-1.723-1.724-3.83-3.255-6.32-.575C-29.49 0-29.107.766-30.447.958c-.955.135-4.138.846-6.792.074.206.123.426.285.663.5 1.915 1.723 1.532 2.298 3.638 4.213 2.108 1.916 3.639 3.638 5.171 1.916 1.532-1.725 4.788-2.108 3.639-4.023-1.149-1.914-.383-3.063.958-1.914 1.339 1.149 3.255 1.914 1.915 3.446-1.342 1.532-2.682 5.554-.766 2.873 1.915-2.681 2.489-4.022 3.637-5.553C-17.234.958-16.085 0-15.702.958c.383.957-.192 3.063.383 3.446.574.383 0-3.255 1.723-3.446 1.723-.192 2.681 0 2.49-1.533M9.192-8.81c-.574 3.257-4.787 32.747-4.787 32.747s-11.299 7.277-13.213 5.746c-1.916-1.533-5.171-1.302-4.788.21s2.872 1.128-1.341 4.002c-4.212 2.873-4.978 5.362-8.233 1.724-3.257-3.639-4.022-6.703-5.937-7.661-1.915-.957-3.447-4.021-1.34-4.787 2.106-.765 2.298 0 4.02-1.531 1.725-1.533 4.023-1.149 4.406-.193.383.959.766 4.022.957 5.171.192 1.149 2.138 4.979 1.93 1.915-.207-3.064 2.665-3.064.75-5.17-1.914-2.106-.765-3.831-4.595-4.214-3.831-.382-4.022 1.915-6.128.766-2.107-1.148-1.915-1.915-2.681-3.063-.766-1.149-4.788-3.447-4.788-3.447s-3.255 1.149-1.724-.958c1.533-2.106 2.873-4.595 1.533-4.786-1.341-.192-4.98 1.914-4.98-.384s-.573-4.787.959-5.362c1.081-.405 1.783-1.284 2.775-1.161-.769-.332-1.468-.813-2.009-1.52-1.491-1.947-.575-5.362-3.639-6.511-3.063-1.15-3.063-2.489-3.639-4.979-.573-2.489 0-8.808.766-9.383.765-.574 2.107-5.362 5.363-4.978 3.256.383 6.702.53 7.851-.023 1.149-.551 3.063 1.171 3.638-3.233.575-4.404 1.915-4.979 2.681-7.277.766-2.297-.383-7.086 0-9.958s3.064-7.852 3.064-10.341c0-2.489 2.873-3.638 4.405-2.681 1.532.958 4.787 2.873 6.127 5.937 1.342 3.063 1.342 4.595 3.447 8.617 2.106 4.021 1.533 6.894 2.489 9.958.958 3.064 3.262 5.171 6.419 8.617 3.156 3.446 2.588 5.362 0 5.171-2.588-.191-4.314 2.297-5.654 5.361-1.338 3.065-2.87 10.724-1.721 8.235 1.149-2.491 3.446-9.384 5.744-10.533 2.298-1.149 6.512 1.953 7.469 3.083.957 1.131.574 4.385-1.916 5.726C.383-8.617 1.915-7.469 4.405-9c2.489-1.532 5.362-3.064 4.787.19\" transform=\"translate(132.845 86.592)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.575-.575-1.532 2.681-2.106 4.213-.575 1.532-.561 4.195 1.056 5.675C.964 11.734 0 7.469 0 5.17 0 2.873.574.575 0 0Zm-6.704 5.936c-1.341.766-3.828 0-6.892-.957-3.065-.958-.613 2.131.766 4.213 1.233 1.861.574-.574 3.256-.766 2.68-.192 4.213-3.256 2.87-2.49zm-4.402-6.511c-.192-1.531.574-4.021-3.639-3.064-4.213.958-4.213 3.256-5.936 1.533-1.723-1.724-3.83-3.255-6.32-.575C-29.49 0-29.107.766-30.447.958c-.955.135-4.138.846-6.792.074.206.123.426.285.663.5 1.915 1.723 1.532 2.298 3.638 4.213 2.108 1.916 3.639 3.638 5.171 1.916 1.532-1.725 4.788-2.108 3.639-4.023-1.149-1.914-.383-3.063.958-1.914 1.339 1.149 3.255 1.914 1.915 3.446-1.342 1.532-2.682 5.554-.766 2.873 1.915-2.681 2.489-4.022 3.637-5.553C-17.234.958-16.085 0-15.702.958c.383.957-.192 3.063.383 3.446.574.383 0-3.255 1.723-3.446 1.723-.192 2.681 0 2.49-1.533zM9.192-8.81c-.574 3.257-4.787 32.747-4.787 32.747s-11.299 7.277-13.213 5.746c-1.916-1.533-5.171-1.302-4.788.21s2.872 1.128-1.341 4.002c-4.212 2.873-4.978 5.362-8.233 1.724-3.257-3.639-4.022-6.703-5.937-7.661-1.915-.957-3.447-4.021-1.34-4.787 2.106-.765 2.298 0 4.02-1.531 1.725-1.533 4.023-1.149 4.406-.193.383.959.766 4.022.957 5.171.192 1.149 2.138 4.979 1.93 1.915-.207-3.064 2.665-3.064.75-5.17-1.914-2.106-.765-3.831-4.595-4.214-3.831-.382-4.022 1.915-6.128.766-2.107-1.148-1.915-1.915-2.681-3.063-.766-1.149-4.788-3.447-4.788-3.447s-3.255 1.149-1.724-.958c1.533-2.106 2.873-4.595 1.533-4.786-1.341-.192-4.98 1.914-4.98-.384s-.573-4.787.959-5.362c1.081-.405 1.783-1.284 2.775-1.161-.769-.332-1.468-.813-2.009-1.52-1.491-1.947-.575-5.362-3.639-6.511-3.063-1.15-3.063-2.489-3.639-4.979-.573-2.489 0-8.808.766-9.383.765-.574 2.107-5.362 5.363-4.978 3.256.383 6.702.53 7.851-.023 1.149-.551 3.063 1.171 3.638-3.233.575-4.404 1.915-4.979 2.681-7.277.766-2.297-.383-7.086 0-9.958s3.064-7.852 3.064-10.341c0-2.489 2.873-3.638 4.405-2.681 1.532.958 4.787 2.873 6.127 5.937 1.342 3.063 1.342 4.595 3.447 8.617 2.106 4.021 1.533 6.894 2.489 9.958.958 3.064 3.262 5.171 6.419 8.617 3.156 3.446 2.588 5.362 0 5.171-2.588-.191-4.314 2.297-5.654 5.361-1.338 3.065-2.87 10.724-1.721 8.235 1.149-2.491 3.446-9.384 5.744-10.533 2.298-1.149 6.512 1.953 7.469 3.083.957 1.131.574 4.385-1.916 5.726C.383-8.617 1.915-7.469 4.405-9c2.489-1.532 5.362-3.064 4.787.19z\" transform=\"translate(132.845 86.592)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.173-.353-2.106-2.681-1.532-3.831.576-1.148-.574.576-2.106-.382-1.533-.957-3.808-3.639-1.713-3.829 2.096-.193 1.713 1.531 3.628.765 1.915-.765 4.021-.575 4.021 1.34C2.298-4.021 1.915.574 0 0\" transform=\"translate(95.886 109.955)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.173-.353-2.106-2.681-1.532-3.831.576-1.148-.574.576-2.106-.382-1.533-.957-3.808-3.639-1.713-3.829 2.096-.193 1.713 1.531 3.628.765 1.915-.765 4.021-.575 4.021 1.34C2.298-4.021 1.915.574 0 0Z\" transform=\"translate(95.886 109.955)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.154-.165-1.533-3.064.957-3.447 2.49-.383 6.947.575 5.293 2.107C4.596.191 2.682.383 0 0\" transform=\"translate(83.44 118.763)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.154-.165-1.533-3.064.957-3.447 2.49-.383 6.947.575 5.293 2.107C4.596.191 2.682.383 0 0Z\" transform=\"translate(83.44 118.763)\"/>\n </g>\n <g clip-path=\"url(#b)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c0-37.068-30.05-67.119-67.119-67.119S-134.238-37.068-134.238 0c0 37.069 30.05 67.119 67.119 67.119S0 37.069 0 0Z\" transform=\"translate(139.738 74.049)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c0-36.731-29.777-66.509-66.509-66.509S-133.019-36.731-133.019 0c0 36.733 29.778 66.51 66.51 66.51C-29.777 66.51 0 36.733 0 0Z\" transform=\"translate(139.438 73.186)\"/>\n </g>\n <g clip-path=\"url(#c)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0m12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754\" transform=\"translate(119.64 109.307)\"/>\n <path style=\"fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0m12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754\" transform=\"translate(119.64 109.307)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0Zm12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754z\" transform=\"translate(119.64 109.307)\"/>\n </g>\n</svg>\n";
var minimizeIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M6 19h12v2H6v-2z"/></svg>';
var editIconUrl = URL.createObjectURL(new Blob([iconEdit], {
type: 'image/svg+xml'
}));
URL.createObjectURL(new Blob([i18nextIcon], {
type: 'image/svg+xml'
}));
var minimizeIconUrl = URL.createObjectURL(new Blob([minimizeIcon], {
type: 'image/svg+xml'
}));
var locizeIconUrl = URL.createObjectURL(new Blob([locizeIcon], {
type: 'image/svg+xml'
}));
function EditIcon() {
var image = document.createElement('img');
image.setAttribute('data-i18next-editor-element', 'true');
image.src = editIconUrl;
image.style.width = '15px';
return image;
}
if (sheet) {
sheet.insertRule("@keyframes i18next-editor-animate-top { \n from {\n top: calc(100vh + 600px); \n left: calc(100vw + 300px);\n opacity: 0;\n }\n to {\n top: var(--i18next-editor-popup-position-top);\n left: var(--i18next-editor-popup-position-left);\n opacity: 1;\n }\n