ngx-i18nsupport-lib
Version:
A Typescript library to work with Angular generated i18n files (xliff, xmb)
1 lines • 795 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["ngx-i18nsupport-lib"]=t():e["ngx-i18nsupport-lib"]=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=41)}([function(e,t,n){(function(e,r){var i=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(s(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,o=r.length,a=String(e).replace(i,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n<o;u=r[++n])m(u)||!E(u)?a+=" "+u:a+=" "+s(u);return a},t.deprecate=function(n,i){if(y(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(!0===r.noDeprecation)return n;var o=!1;return function(){if(!o){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),o=!0}return n.apply(this,arguments)}};var o,a={};function s(e,n){var r={seen:[],stylize:l};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(n)?r.showHidden=n:n&&t._extend(r,n),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function l(e,t){return e}function c(e,n,r){if(e.customInspect&&n&&b(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return _(i)||(i=c(e,i,r)),i}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(_(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(d(t))return e.stylize(""+t,"number");if(g(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,n);if(o)return o;var a=Object.keys(n),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),N(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return p(n);if(0===a.length){if(b(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(T(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(v(n))return e.stylize(Date.prototype.toString.call(n),"date");if(N(n))return p(n)}var l,E="",w=!1,A=["{","}"];(h(n)&&(w=!0,A=["[","]"]),b(n))&&(E=" [Function"+(n.name?": "+n.name:"")+"]");return T(n)&&(E=" "+RegExp.prototype.toString.call(n)),v(n)&&(E=" "+Date.prototype.toUTCString.call(n)),N(n)&&(E=" "+p(n)),0!==a.length||w&&0!=n.length?r<0?T(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),l=w?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)C(t,String(a))?o.push(f(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(f(e,t,n,r,i,!0))}),o}(e,n,r,s,a):a.map(function(t){return f(e,n,r,s,t,w)}),e.seen.pop(),function(e,t,n){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,E,A)):A[0]+E+A[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),C(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=m(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),y(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function h(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function d(e){return"number"==typeof e}function _(e){return"string"==typeof e}function y(e){return void 0===e}function T(e){return E(e)&&"[object RegExp]"===w(e)}function E(e){return"object"==typeof e&&null!==e}function v(e){return E(e)&&"[object Date]"===w(e)}function N(e){return E(e)&&("[object Error]"===w(e)||e instanceof Error)}function b(e){return"function"==typeof e}function w(e){return Object.prototype.toString.call(e)}function A(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(y(o)&&(o=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!a[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var n=r.pid;a[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else a[e]=function(){};return a[e]},t.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=g,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=d,t.isString=_,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=y,t.isRegExp=T,t.isObject=E,t.isDate=v,t.isError=N,t.isFunction=b,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(36);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(":"),[e.getDate(),M[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(35),t._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,n(38),n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.TEXT=0]="TEXT",e[e.PLACEHOLDER=1]="PLACEHOLDER",e[e.START_TAG=2]="START_TAG",e[e.END_TAG=3]="END_TAG",e[e.EMPTY_TAG=4]="EMPTY_TAG",e[e.ICU_MESSAGE=5]="ICU_MESSAGE",e[e.ICU_MESSAGE_REF=6]="ICU_MESSAGE_REF"}(t.ParsedMessagePartType||(t.ParsedMessagePartType={}));var r=function(){return function(e){this.type=e}}();t.ParsedMessagePart=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=function(){function e(){}return e.getFirstElementByTagName=function(e,t){var n=e.getElementsByTagName(t);return n&&n.length>0?n.item(0):null},e.getElementByTagNameAndId=function(e,t,n){var r=e.getElementsByTagName(t);if(r&&r.length>0)for(var i=0;i<r.length;i++){var o=r.item(i);if(o.getAttribute("id")===n)return o}return null},e.getElementFollowingSibling=function(e){if(!e)return null;for(var t=e.nextSibling;t;){if(t.nodeType===t.ELEMENT_NODE)return t;t=t.nextSibling}return null},e.getElementPrecedingSibling=function(e){if(!e)return null;for(var t=e.previousSibling;t;){if(t.nodeType===t.ELEMENT_NODE)return t;t=t.previousSibling}return null},e.getXMLContent=function(e){if(!e)return null;var t=(new r.XMLSerializer).serializeToString(e),n=e.nodeName,i=new RegExp("<"+n+"[^>]*>","g");t=t.replace(i,"");var o=new RegExp("</"+n+">","g");return t=t.replace(o,"")},e.getPCDATA=function(e){if(!e)return null;for(var t="",n=e.childNodes,r=0;r<n.length;r++){var i=n.item(r);i.nodeType!==i.TEXT_NODE&&i.nodeType!==i.CDATA_SECTION_NODE||(t+=i.nodeValue)}return 0===t.length?null:t},e.replaceContentWithXMLContent=function(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(var n=(new r.DOMParser).parseFromString("<fragment>"+t+"</fragment>","application/xml").getElementsByTagName("fragment").item(0).childNodes,i=0;i<n.length;i++){var o=n.item(i);e.appendChild(e.ownerDocument.importNode(o,!0))}},e.getPreviousElementSibling=function(e){for(var t=e.previousSibling;null!==t;){if(t.nodeType===t.ELEMENT_NODE)return t;t=t.previousSibling}return null},e.createFollowingSibling=function(t,n){var r=n.ownerDocument.createElement(t);return e.insertAfter(r,n)},e.insertAfter=function(e,t){return null!==t.nextSibling?t.parentNode.insertBefore(e,t.nextSibling):t.parentNode.appendChild(e),e},e.insertBefore=function(e,t){return t.parentNode.insertBefore(e,t),e},e}();t.DOMUtilities=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(40);t.TranslationMessagesFileFactory=r.TranslationMessagesFileFactory,function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(7))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(0),o=n(9),a=n(32),s=function(){function e(){this.transUnits=null,this._warnings=[]}return e.prototype.parseContent=function(e,t,n,r){this._filename=t,this._encoding=n,this._parsedDocument=(new o.DOMParser).parseFromString(e,"text/xml"),this._fileEndsWithEOL=e.endsWith("\n")},e.prototype.lazyInitializeTransUnits=function(){i.isNullOrUndefined(this.transUnits)&&(this.initializeTransUnits(),this.countNumbers())},e.prototype.countNumbers=function(){var e=this;this._numberOfTransUnitsWithMissingId=0,this._numberOfUntranslatedTransUnits=0,this._numberOfReviewedTransUnits=0,this.forEachTransUnit(function(t){(i.isNullOrUndefined(t.id)||""===t.id)&&e._numberOfTransUnitsWithMissingId++;var n=t.targetState();(i.isNullOrUndefined(n)||n===r.STATE_NEW)&&e._numberOfUntranslatedTransUnits++,n===r.STATE_TRANSLATED&&e._numberOfReviewedTransUnits++})},e.prototype.warnings=function(){return this.lazyInitializeTransUnits(),this._warnings},e.prototype.numberOfTransUnits=function(){return this.lazyInitializeTransUnits(),this.transUnits.length},e.prototype.numberOfUntranslatedTransUnits=function(){return this.lazyInitializeTransUnits(),this._numberOfUntranslatedTransUnits},e.prototype.numberOfReviewedTransUnits=function(){return this.lazyInitializeTransUnits(),this._numberOfReviewedTransUnits},e.prototype.numberOfTransUnitsWithMissingId=function(){return this.lazyInitializeTransUnits(),this._numberOfTransUnitsWithMissingId},e.prototype.forEachTransUnit=function(e){this.lazyInitializeTransUnits(),this.transUnits.forEach(function(t){return e(t)})},e.prototype.transUnitWithId=function(e){return this.lazyInitializeTransUnits(),this.transUnits.find(function(t){return t.id===e})},e.prototype.setNewTransUnitTargetPraefix=function(e){this.targetPraefix=e},e.prototype.getNewTransUnitTargetPraefix=function(){return i.isNullOrUndefined(this.targetPraefix)?"":this.targetPraefix},e.prototype.setNewTransUnitTargetSuffix=function(e){this.targetSuffix=e},e.prototype.getNewTransUnitTargetSuffix=function(){return i.isNullOrUndefined(this.targetSuffix)?"":this.targetSuffix},e.prototype.removeTransUnitWithId=function(e){var t=this._parsedDocument.getElementById(e);t&&(t.parentNode.removeChild(t),this.lazyInitializeTransUnits(),this.transUnits=this.transUnits.filter(function(t){return t.id!==e}),this.countNumbers())},e.prototype.filename=function(){return this._filename},e.prototype.encoding=function(){return this._encoding},e.prototype.editedContent=function(e){var t={};!0===e&&(t.beautify=!0,t.indentString=" ",t.mixedContentElements=this.elementsWithMixedContent());var n=(new a.XmlSerializer).serializeToString(this._parsedDocument,t);return this._fileEndsWithEOL?n+"\n":n},e}();t.AbstractTranslationMessagesFile=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(4),o=n(0),a=function(){function e(e,t,n){this._element=e,this._id=t,this._translationMessagesFile=n}return Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),e.prototype.translationMessagesFile=function(){return this._translationMessagesFile},e.prototype.supportsSetSourceContent=function(){return!0},e.prototype.sourceContentNormalized=function(){return o.isNullOrUndefined(this._sourceContentNormalized)&&(this._sourceContentNormalized=this.createSourceContentNormalized()),this._sourceContentNormalized},e.prototype.targetState=function(){var e=this.nativeTargetState();return this.mapNativeStateToState(e)},e.prototype.setTargetState=function(e){this.setNativeTargetState(this.mapStateToNativeState(e)),this.translationMessagesFile()instanceof i.AbstractTranslationMessagesFile&&this.translationMessagesFile().countNumbers()},e.prototype.supportsSetSourceReferences=function(){return!0},e.prototype.supportsSetDescriptionAndMeaning=function(){return!0},e.prototype.asXmlElement=function(){return this._element},e.prototype.translate=function(e){var t;t=o.isString(e)?e:e.asNativeString(),this.translateNative(t),this.setTargetState(r.STATE_TRANSLATED)},e.prototype.isICUMessage=function(e){return this.messageParser().isICUMessageStart(e)},e}();t.AbstractTransUnit=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={A:"LINK",B:"BOLD_TEXT",BR:"LINE_BREAK",EM:"EMPHASISED_TEXT",H1:"HEADING_LEVEL1",H2:"HEADING_LEVEL2",H3:"HEADING_LEVEL3",H4:"HEADING_LEVEL4",H5:"HEADING_LEVEL5",H6:"HEADING_LEVEL6",HR:"HORIZONTAL_RULE",I:"ITALIC_TEXT",LI:"LIST_ITEM",LINK:"MEDIA_LINK",OL:"ORDERED_LIST",P:"PARAGRAPH",Q:"QUOTATION",S:"STRIKETHROUGH_TEXT",SMALL:"SMALL_TEXT",SUB:"SUBSTRIPT",SUP:"SUPERSCRIPT",TBODY:"TABLE_BODY",TD:"TABLE_CELL",TFOOT:"TABLE_FOOTER",TH:"TABLE_HEADER_CELL",THEAD:"TABLE_HEADER",TR:"TABLE_ROW",TT:"MONOSPACED_TEXT",U:"UNDERLINED_TEXT",UL:"UNORDERED_LIST"},i=["BR","HR","IMG","AREA","LINK","WBR"],o=function(){function e(){}return e.prototype.getStartTagPlaceholderName=function(e,t){var n=e.toUpperCase();return"START_"+(r[n]||"TAG_"+n)+this.counterString(t)},e.prototype.getCloseTagPlaceholderName=function(e){var t=e.toUpperCase();return"CLOSE_"+(r[t]||"TAG_"+t)},e.prototype.getEmptyTagPlaceholderName=function(e,t){var n=e.toUpperCase();return(r[n]||"TAG_"+n)+this.counterString(t)},e.prototype.getCtypeForTag=function(e){switch(e.toLowerCase()){case"br":return"lb";case"img":return"image";default:return"x-"+e}},e.prototype.getTagnameFromStartTagPlaceholderName=function(e){if(e.startsWith("START_TAG_"))return this.stripCounter(e.substring("START_TAG_".length)).toLowerCase();if(e.startsWith("START_")){var t=this.stripCounter(e.substring("START_".length)),n=Object.keys(r).find(function(e){return r[e]===t});return n?n.toLowerCase():null}return null},e.prototype.getTagnameFromCloseTagPlaceholderName=function(e){if(e.startsWith("CLOSE_TAG_"))return this.stripCounter(e.substring("CLOSE_TAG_".length)).toLowerCase();if(e.startsWith("CLOSE_")){var t=this.stripCounter(e.substring("CLOSE_".length)),n=Object.keys(r).find(function(e){return r[e]===t});return n?n.toLowerCase():null}return null},e.prototype.isEmptyTagPlaceholderName=function(e){var t,n=this.stripCounter(e);return!!((t=n.startsWith("TAG_")?n.substring(4).toUpperCase():Object.keys(r).find(function(e){return r[e]===n}))&&i.indexOf(t)>=0)},e.prototype.getTagnameFromEmptyTagPlaceholderName=function(e){var t,n=this.stripCounter(e);return(t=n.startsWith("TAG_")?n.substring(4).toUpperCase():Object.keys(r).find(function(e){return r[e]===n}))&&i.indexOf(t)>=0?t.toLowerCase():null},e.prototype.stripCounter=function(e){if(e){var t=/(.*)_[0-9]+$/;if(e.match(t))return e.replace(t,"$1")}return e},e.prototype.counterString=function(e){return 0===e?"":"_"+e.toString(10)},e}();t.TagMapping=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FORMAT_XLIFF12="xlf",t.FORMAT_XLIFF20="xlf2",t.FORMAT_XMB="xmb",t.FORMAT_XTB="xtb",t.FILETYPE_XLIFF12="XLIFF 1.2",t.FILETYPE_XLIFF20="XLIFF 2.0",t.FILETYPE_XMB="XMB",t.FILETYPE_XTB="XTB",t.STATE_NEW="new",t.STATE_TRANSLATED="translated",t.STATE_FINAL="final",t.NORMALIZATION_FORMAT_DEFAULT="default",t.NORMALIZATION_FORMAT_NGXTRANSLATE="ngxtranslate"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(30),i=n(21),o=n(9),a=n(0),s=n(2),u=n(14),l=function(){function e(){}return e.prototype.createNormalizedMessageFromXML=function(e,t){var n=new r.ParsedMessage(this,t);return e&&(n.setXmlRepresentation(e),this.addPartsOfNodeToMessage(e,n,!1)),n},e.prototype.createNormalizedMessageFromXMLString=function(e,t){var n=(new o.DOMParser).parseFromString("<dummy>"+e+"</dummy>","text/xml").childNodes.item(0);return this.createNormalizedMessageFromXML(n,t)},e.prototype.addPartsOfNodeToMessage=function(e,t,n){var r=!0;if(n){if(e.nodeType===e.TEXT_NODE)return void t.addText(e.textContent);e.nodeType===e.ELEMENT_NODE&&(r=this.processStartElement(e,t))}if(r){var i=this.getICUMessageText(e),o=!a.isNullOrUndefined(i);if(o)try{t.addICUMessage(i)}catch(e){console.log("non ICU message: ",i,e),o=!1}if(!o)for(var s=e.childNodes,u=0;u<s.length;u++)this.addPartsOfNodeToMessage(s.item(u),t,!0)}e.nodeType===e.ELEMENT_NODE&&this.processEndElement(e,t)},e.prototype.getICUMessageText=function(e){var t=e.childNodes;if(0===t.length)return null;var n=t.item(0);return n.nodeType===n.TEXT_NODE&&this.isICUMessageStart(n.textContent)?s.DOMUtilities.getXMLContent(e):null},e.prototype.isICUMessageStart=function(e){return u.ParsedMessagePartICUMessage.looksLikeICUMessage(e)},e.prototype.parseNormalizedString=function(e,t){var n,o=new r.ParsedMessage(this,t),s=[];try{n=(new i.ParsedMesageTokenizer).tokenize(e)}catch(t){throw new Error(a.format('unexpected error while parsing message: "%s" (parsed "%")',t.message,e))}if(n.forEach(function(n){var r=null;switch(n.type){case i.TEXT:o.addText(n.value.text);break;case i.START_TAG:o.addStartTag(n.value.name,n.value.idcounter),s.push(n.value.name);break;case i.END_TAG:if(o.addEndTag(n.value.name),0===s.length||s[s.length-1]!==n.value.name)throw new Error(a.format('unexpected close tag "%s" (parsed "%s")',n.value.name,e));s.pop();break;case i.EMPTY_TAG:o.addEmptyTag(n.value.name,n.value.idcounter);break;case i.PLACEHOLDER:r=t?t.getPlaceholderDisp(n.value.idcounter):null,o.addPlaceholder(n.value.idcounter,r);break;case i.ICU_MESSAGE_REF:r=t?t.getICUMessageRefDisp(n.value.idcounter):null,o.addICUMessageRef(n.value.idcounter,r);break;case i.ICU_MESSAGE:throw new Error(a.format('<ICUMessage/> not allowed here, use parseICUMessage instead (parsed "%")',e))}}),s.length>0)throw new Error(a.format('missing close tag "%s" (parsed "%s")',s[s.length-1],e));return o.setXmlRepresentation(this.createXmlRepresentation(o)),o},e.prototype.parseICUMessage=function(e,t){var n=new r.ParsedMessage(this,t);return n.addICUMessage(e),n},e.prototype.parseIdCountFromName=function(e){var t=/.*_([0-9]*)/.exec(e);if(a.isNullOrUndefined(t)||""===t[1])return 0;var n=t[1];return parseInt(n,10)},e.prototype.createXmlRepresentation=function(e){var t=(new o.DOMParser).parseFromString("<dummy/>","text/xml").getElementsByTagName("dummy").item(0);return this.addXmlRepresentationToRoot(e,t),t},e.prototype.createXmlRepresentationOfTextPart=function(e,t){return t.ownerDocument.createTextNode(e.asDisplayString())},e}();t.AbstractMessageParser=l},function(e,t,n){function r(e){this.options=e||{locator:{}}}function i(){this.cdata=!1}function o(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function a(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function s(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function u(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new l,o=n.domBuilder||new i,s=n.errorHandler,u=n.locator,c=n.xmlns||{},p={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return u&&o.setDocumentLocator(u),r.errorHandler=function(e,t,n){if(!e){if(t instanceof i)return t;e=t}var r={},o=e instanceof Function;function s(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+a(n))}||function(){}}return n=n||{},s("warning"),s("error"),s("fatalError"),r}(s,o,u),r.domBuilder=n.domBuilder||o,/\/x?html?$/.test(t)&&(p.nbsp=" ",p.copy="©",c[""]="http://www.w3.org/1999/xhtml"),c.xml=c.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,c,p):r.errorHandler.error("invalid doc source"),o.doc},i.prototype={startDocument:function(){this.doc=(new c).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),s=r.length;u(this,a),this.currentElement=a,this.locator&&o(this.locator,a);for(var l=0;l<s;l++){e=r.getURI(l);var c=r.getValue(l),p=(n=r.getQName(l),i.createAttributeNS(e,n));this.locator&&o(r.getLocator(l),p),p.value=p.nodeValue=c,a.setAttributeNode(p)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName;this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&o(this.locator,n),u(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=s.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&o(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=s.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&o(this.locator,r),u(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(e,t,n);this.locator&&o(this.locator,i),u(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,a(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,a(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,a(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){i.prototype[e]=function(){return null}});var l=n(34).XMLReader,c=t.DOMImplementation=n(15).DOMImplementation;t.XMLSerializer=n(15).XMLSerializer,t.DOMParser=r},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),a=n(0),s=n(2),u=n(4),l=n(12),c=n(19);t.XTB_DOCTYPE="<!DOCTYPE translationbundle [\n <!ELEMENT translationbundle (translation)*>\n <!ATTLIST translationbundle lang CDATA #REQUIRED>\n <!ELEMENT translation (#PCDATA|ph)*>\n <!ATTLIST translation id CDATA #REQUIRED>\n <!ELEMENT ph EMPTY>\n <!ATTLIST ph name CDATA #REQUIRED>\n]>";var p=function(e){function t(t,n,r,i){var o=e.call(this)||this;return o._warnings=[],o._numberOfTransUnitsWithMissingId=0,o.initializeFromContent(t,n,r,i),o}return i(t,e),t.prototype.initializeFromContent=function(e,t,n,r){if(this.parseContent(e,t,n),1!==this._parsedDocument.getElementsByTagName("translationbundle").length)throw new Error(a.format('File "%s" seems to be no xtb file (should contain a translationbundle element)',t));if(r)try{this._masterFile=new l.XmbFile(r.xmlContent,r.path,r.encoding);var i=this._masterFile.numberOfTransUnits(),o=this.numberOfTransUnits();i!==o&&this._warnings.push(a.format("%s trans units found in master, but this file has %s. Check if it is the correct master",i,o))}catch(e){throw new Error(a.format('File "%s" seems to be no xmb file. An xtb file needs xmb as master file.',r.path))}return this},t.prototype.initializeTransUnits=function(){this.transUnits=[];for(var e=this._parsedDocument.getElementsByTagName("translation"),t=0;t<e.length;t++){var n=e.item(t),r=n.getAttribute("id");r||this._warnings.push(a.format('oops, msg without "id" found in master, please check file %s',this._filename));var i=null;this._masterFile&&(i=this._masterFile.transUnitWithId(r)),this.transUnits.push(new c.XtbTransUnit(n,r,this,i))}},t.prototype.i18nFormat=function(){return o.FORMAT_XTB},t.prototype.fileType=function(){return o.FILETYPE_XTB},t.prototype.elementsWithMixedContent=function(){return["translation"]},t.prototype.sourceLanguage=function(){return this._masterFile?this._masterFile.sourceLanguage():null},t.prototype.setSourceLanguage=function(e){},t.prototype.targetLanguage=function(){var e=s.DOMUtilities.getFirstElementByTagName(this._parsedDocument,"translationbundle");return e?e.getAttribute("lang"):null},t.prototype.setTargetLanguage=function(e){var t=s.DOMUtilities.getFirstElementByTagName(this._parsedDocument,"translationbundle");t&&t.setAttribute("lang",e)},t.prototype.importNewTransUnit=function(e,t,n,r){if(this.transUnitWithId(e.id))throw new Error(a.format("tu with id %s already exists in file, cannot import it",e.id));var i=e.cloneWithSourceAsTarget(t,n,this),o=s.DOMUtilities.getFirstElementByTagName(this._parsedDocument,"translationbundle");if(!o)throw new Error(a.format('File "%s" seems to be no xtb file (should contain a translationbundle element)',this._filename));var u=o.ownerDocument.createElement("translation");u.setAttribute("id",e.id);var l=n||t?e.sourceContent():"";e.isICUMessage(l)||(l=this.getNewTransUnitTargetPraefix()+l+this.getNewTransUnitTargetSuffix()),s.DOMUtilities.replaceContentWithXMLContent(u,l);var p=new c.XtbTransUnit(u,e.id,this,i),f=!1,h=!1;r&&(this.transUnitWithId(r.id)&&(h=!0));if(void 0===r||r&&!h)o.appendChild(p.asXmlElement()),f=!0;else if(null===r){var g=s.DOMUtilities.getFirstElementByTagName(this._parsedDocument,"translation");g?(s.DOMUtilities.insertBefore(p.asXmlElement(),g),f=!0):(o.appendChild(p.asXmlElement()),f=!0)}else{var m=s.DOMUtilities.getElementByTagNameAndId(this._parsedDocument,"translation",r.id);m&&(s.DOMUtilities.insertAfter(p.asXmlElement(),m),f=!0)}return f?(this.lazyInitializeTransUnits(),this.transUnits.push(p),this.countNumbers(),p):null},t.prototype.createTranslationFileForLang=function(e,t,n,r){throw new Error(a.format('File "%s", xtb files are not translatable, they are already translations',t))},t}(u.AbstractTranslationMessagesFile);t.XtbFile=p},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(8),a=n(2),s=n(6),u=n(1),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.processStartElement=function(e,t){var n=e.tagName;if("ph"===n){var r=e.getAttribute("name");if(!r)return!0;if(r.startsWith("INTERPOLATION")){var i=this.parsePlaceholderIndexFromName(r);return t.addPlaceholder(i,null),!1}if(r.startsWith("START_")){var o=this.parseTagnameFromPhElement(e),a=this.parseIdCountFromName(r);return o&&t.addStartTag(o,a),!1}if(r.startsWith("CLOSE_"))return(o=this.parseTagnameFromPhElement(e))&&t.addEndTag(o),!1;if((new s.TagMapping).isEmptyTagPlaceholderName(r)){var u=(new s.TagMapping).getTagnameFromEmptyTagPlaceholderName(r);a=this.parseIdCountFromName(r);return t.addEmptyTag(u,a),!1}if(r.startsWith("ICU")){i=this.parseICUMessageIndexFromName(r);return t.addICUMessageRef(i,null),!1}}else if("source"===n)return!1;return!0},t.prototype.getICUMessageText=function(e){var t=e.childNodes;if(0===t.length)return null;var n,r=null;for(n=0;n<t.length;n++){var i=t.item(n);if(i.nodeType!==i.ELEMENT_NODE||"source"!==i.tagName){r=i;break}}if(r&&r.nodeType===r.TEXT_NODE){if(this.isICUMessageStart(r.textContent)){var o=a.DOMUtilities.getXMLContent(e);if(n>0){var s=new RegExp("<source[^>]*>.*</source>","g");return o.replace(s,"")}return o}return null}return null},t.prototype.processEndElement=function(e,t){},t.prototype.parsePlaceholderIndexFromName=function(e){var t="";return t="INTERPOLATION"===e?"0":e.substring("INTERPOLATION_".length),Number.parseInt(t)},t.prototype.parseICUMessageIndexFromName=function(e){var t="";return t="ICU"===e?"0":e.substring("ICU_".length),Number.parseInt(t)},t.prototype.parseTagnameFromPhElement=function(e){var t=a.DOMUtilities.getFirstElementByTagName(e,"ex");if(t){var n=a.DOMUtilities.getPCDATA(t);return n&&n.startsWith("<")&&n.endsWith(">")?"/"===n.charAt(1)?n.substring(2,n.length-1):n.substring(1,n.length-1):null}return null},t.prototype.addXmlRepresentationToRoot=function(e,t){var n=this;e.parts().forEach(function(e){var r=n.createXmlRepresentationOfPart(e,t);r&&t.appendChild(r)})},t.prototype.createXmlRepresentationOfPart=function(e,t){switch(e.type){case u.ParsedMessagePartType.TEXT:return this.createXmlRepresentationOfTextPart(e,t);case u.ParsedMessagePartType.START_TAG:return this.createXmlRepresentationOfStartTagPart(e,t);case u.ParsedMessagePartType.END_TAG:return this.createXmlRepresentationOfEndTagPart(e,t);case u.ParsedMessagePartType.EMPTY_TAG:return this.createXmlRepresentationOfEmptyTagPart(e,t);case u.ParsedMessagePartType.PLACEHOLDER:return this.createXmlRepresentationOfPlaceholderPart(e,t);case u.ParsedMessagePartType.ICU_MESSAGE_REF:return this.createXmlRepresentationOfICUMessageRefPart(e,t)}},t.prototype.createXmlRepresentationOfStartTagPart=function(e,t){var n=t.ownerDocument.createElement("ph"),r=(new s.TagMapping).getStartTagPlaceholderName(e.tagName(),e.idCounter());n.setAttribute("name",r);var i=t.ownerDocument.createElement("ex");return i.appendChild(t.ownerDocument.createTextNode("<"+e.tagName()+">")),n.appendChild(i),n},t.prototype.createXmlRepresentationOfEndTagPart=function(e,t){var n=t.ownerDocument.createElement("ph"),r=(new s.TagMapping).getCloseTagPlaceholderName(e.tagName());n.setAttribute("name",r);var i=t.ownerDocument.createElement("ex");return i.appendChild(t.ownerDocument.createTextNode("</"+e.tagName()+">")),n.appendChild(i),n},t.prototype.createXmlRepresentationOfEmptyTagPart=function(e,t){var n=t.ownerDocument.createElement("ph"),r=(new s.TagMapping).getEmptyTagPlaceholderName(e.tagName(),e.idCounter());n.setAttribute("name",r);var i=t.ownerDocument.createElement("ex");return i.appendChild(t.ownerDocument.createTextNode("<"+e.tagName()+">")),n.appendChild(i),n},t.prototype.createXmlRepresentationOfPlaceholderPart=function(e,t){var n=t.ownerDocument.createElement("ph"),r="INTERPOLATION";e.index()>0&&(r="INTERPOLATION_"+e.index().toString(10)),n.setAttribute("name",r);var i=t.ownerDocument.createElement("ex");return i.appendChild(t.ownerDocument.createTextNode(r)),n.appendChild(i),n},t.prototype.createXmlRepresentationOfICUMessageRefPart=function(e,t){var n=t.ownerDocument.createElement("ph"),r="ICU";e.index()>0&&(r="ICU_"+e.index().toString(10)),n.setAttribute("name",r);var i=t.ownerDocument.createElement("ex");return i.appendChild(t.ownerDocument.createTextNode(r)),n.appendChild(i),n},t}(o.AbstractMessageParser);t.XmbMessageParser=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),a=n(0),s=n(20),u=n(4),l=n(10),c=function(e){function t(t,n,r){var i=e.call(this)||this;return i._warnings=[],i._numberOfTransUnitsWithMissingId=0,i.initializeFromContent(t,n,r),i}return i(t,e),t.prototype.initializeFromContent=function(e,t,n){if(this.parseContent(e,t,n),1!==this._parsedDocument.getElementsByTagName("messagebundle").length)throw new Error(a.format('File "%s" seems to be no xmb file (should contain a messagebundle element)',t));return this},t.prototype.initializeTransUnits=function(){this.transUnits=[];for(var e=this._parsedDocument.getElementsByTagName("msg"),t=0;t<e.length;t++){var n=e.item(t),r=n.getAttribute("id");r||this._warnings.push(a.format('oops, msg without "id" found in master, please check file %s',this._filename)),this.transUnits.push(new s.XmbTransUnit(n,r,this))}},t.prototype.i18nFormat=function(){return o.FORMAT_XMB},t.prototype.fileType=function(){return o.FILETYPE_XMB},t.prototype.elementsWithMixedContent=function(){return["message"]},t.prototype.guessLanguageFromFilename=function(){if(this._filename){var e=this._filename.split(".");if(e.length>2&&"xmb"===e[e.length-1].toLowerCase())return e[e.length-2]}return null},t.prototype.sourceLanguage=function(){return this.guessLanguageFromFilename()},t.prototype.setSourceLanguage=function(e){},t.prototype.targetLanguage=function(){return this.guessLanguageFromFilename()},t.prototype.setTargetLanguage=function(e){},t.prototype.importNewTransUnit=function(e,t,n,r){throw Error("xmb file cannot be used to store translations, use xtb file")},t.prototype.createTranslationFileForLang=function(e,t,n,r){var i='<?xml version="1.0" encoding="UTF-8"?>\n'+l.XTB_DOCTYPE+"\n<translationbundle>\n</translationbundle>\n",o=new l.XtbFile(i,t,this.encoding(),{xmlContent:this.editedContent(),path:this.filename(),encoding:this.encoding()});return o.setNewTransUnitTargetPraefix(this.targetPraefix),o.setNewTransUnitTargetSuffix(this.targetSuffix),o.setTargetLanguage(e),o.setNewTransUnitTargetPraefix(this.getNewTransUnitTargetPraefix()),o.setNewTransUnitTargetSuffix(this.getNewTransUnitTargetSuffix()),this.forEachTransUnit(function(e){o.importNewTransUnit(e,n,r)}),o},t}(u.AbstractTranslationMessagesFile);t.XmbFile=c},function(e,t,n){var r;e.exports=function e(t,n,i){function o(s,u){if(!n[s]){if(!t[s]){var l="function"==typeof r&&r;if(!u&&l)return r(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return o(n||e)},p,p.exports,e,t,n,i)}return n[s].exports}for(var a="function"==typeof r&&r,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(e,t){var n=e.length,r=t-20;r<0&&(r=0);var i=t+20;i>n&&(i=n);var o=function(e){return e.charCodeAt(0).toString(16).toUpperCase()},a=function(e,t,n){return e.substr(t,n).replace(/\\/g,"\\\\").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+o(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+o(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+o(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+o(e)})};return{prologTrunc:r>0,prologText:a(e,r,t-r),tokenText:a(e,t,1),epilogText:a(e,t+1,i-(t+1)),epilogTrunc:i<n}},s=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;o(this,e),this.type=t,this.value=n,this.text=r,this.pos=i,this.line=a,this.column=s}return i(e,[{key:"toString",value:function(){return"<type: "+this.type+", value: "+JSON.stringify(this.value)+", text: "+JSON.stringify(this.text)+", pos: "+this.pos+", line: "+this.line+", column: "+this.column+">"}},{key:"isA",value:function(e,t){return e===this.type&&(2!==arguments.length||t===this.value)}}]),e}(),u=function(e){function t(e,n,r,i,a){o(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return s.name="ParsingError",s.message=e,s.pos=n,s.line=r,s.column=i,s.input=a,s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Error),i(t,[{key:"toString",value:function(){for(var e=a(this.input,this.pos),t="line "+this.line+" (column "+this.column+"): ",n="",r=0;r<t.length+e.prologText.length;r++)n+=" ";return"Parsing Error: "+this.message+"\n"+t+e.prologText+e.tokenText+e.epilogText+"\n"+n+"^"}}]),t}(),l=function(){function e(t){o(this,e),this._tokenizr=t,this._data={},this._repeat=!1,this._reject=!1,this._ignore=!1,this._match=null}return i(e,[{key:"data",value:function(e,t){var n=this._data[e];return 2===arguments.length&&(this._data[e]=t),n}},{key:"info",value:function(){return{line:this._tokenizr._line,column:this._tokenizr._column,pos:this._tokenizr._pos,len:this._match[0].length}}},{key:"push",value:function(){var e;return(e=this._tokenizr).push.apply(e,arguments),this}},{key:"pop",value:function(){var e;return(e=this._tokenizr).pop.apply(e,arguments)}},{key:"state",value:function(){var e,t;return arguments.length>0?((t=this._tokenizr).state.apply(t,arguments),this):(e=this._tokenizr).state.apply(e,arguments)}},{key:"tag",value:function(){var e;return(e=this._tokenizr).tag.apply(e,arguments),this}},{key:"tagged",value:function(){var e;return(e=this._tokenizr).tagged.apply(e,arguments)}},{key:"untag",value:function(){var e;return(e=this._tokenizr).untag.apply(e,arguments),this}},{key:"repeat",value:function(){return this._tokenizr._log(" REPEAT"),this._repeat=!0,this}},{key:"reject",value:function(){return this._tokenizr._log(" REJECT"),this._reject=!0,this}},{key:"ignore",value:function(){return this._tokenizr._log(" IGNORE"),this._ignore=!0,this}},{key:"accept",value:function(e,t){return arguments.length<2&&(t=this._match[0]),this._tokenizr._log(" ACCEPT: type: "+e+", value: "+JSON.stringify(t)+" ("+(void 0===t?"undefined":r(t))+'), text: "'+this._match[0]+'"'),this._tokenizr._pending.push(new s(e,t,this._match[0],this._tokenizr._pos,this._tokenizr._line,this._tokenizr._column)),this}},{key:"stop",value:function(){return this._tokenizr._stopped=!0,this}}]),e}(),c=function(){function e(){o(this,e),this._before=null,this._after=null,this._finish=null,this._rules=[],this._debug=!1,this.reset()}return i(e,[{key:"reset",value:function(){return this._input="",this._len=0,this._eof=!1,this._pos=0,this._line=1,this._column=1,this._state=["default"],this._tag={},this._transaction=[],this._pending=[],this._stopped=!1,this._ctx=new l(this),this}},{key:"error",value:function(e){return new u(e,this._pos,this._line,this._column,this._input)}},{key:"debug",value:function(e){return this._debug=e,this}},{key:"_log",value:function(e){this._debug&&console.log("tokenizr: "+e)}},{key:"input",value:function(e){if("string"!=typeof e)throw new Error('parameter "input" not a String');return this.reset(),this._input=e,this._len=e.length,this}},{key:"push",value:function(e){if(1!==arguments.length)throw new Error("invalid number of arguments");if("string"!=typeof e)throw new Error('parameter "state" not a String');return this._log(" STATE (PUSH): old: <"+this._state[this._state.length-1]+">, new: <"+e+">"),this._state.push(e),this}},{key:"pop",value:function(){if(0!==arguments.length)throw new Error("invalid number of arguments");if(this._state.length<2)throw new Error("no more custom states to pop");return this._log(" STATE (POP): old: <"+this._state[this._state.length-1]+">, new: <"+this._state[this._state.length-2]+">"),this._state.pop()}},{key:"state",value:function(e){if(1===arguments.length){if("string"!=typeof e)throw new Error('parameter "state" not a String');return this._log(" STATE (SET): old: <"+this._state[this._state.length-1]+">, new: <"+e+">"),this._state[this._state.length-1]=e,this}if(0===arguments.length)return this._state[this._state.length-1];throw new Error("invalid number of arguments")}},{key:"tag",value:function(e){if(1!==arguments.length)throw new Error("invalid number of arguments");if("string"!=typeof e)throw new Error('parameter "tag" not a String');return this._log(" TAG (ADD): "+e),this._tag[e]=!0,this}},{key:"tagged",value:function(e){if(1!==arguments.length)throw new Error("invalid number of arguments");if("string"!=typeof e)throw new Error('parameter "tag" not a String');return!0===this._tag[e]}},{key:"untag",value:function(e){if(1!==arguments.length)throw new Error("invalid number of arguments");if("string"!=typeof e)throw new Error('parameter "tag" not a String');return this._log(" TAG (DEL): "+e),delete this._tag[e],this}},{key:"before",value:function(e){return this._before=e,this}},{key:"after",value:function(e){return this._after=e,this}},{key:"finish",value:function(e){return this._finish=e,this}},{key:"rule",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unknown";if(2===arguments.length&&"function"==typeof t){var o=[e,t];t=o[0],n=o[1],e="*"}else if(3===arguments.length&&"function"==typeof t){var a=[e,t,n];t=a[0],n=a[1],i=a[2],e="*"}if("string"!=typeof e)throw new Error('parameter "state" not a String');if(!("object"===(void 0===t?"undefined":r(t))&&t instanceof RegExp))throw new Error('parameter "pattern" not a RegExp');if("function"!=typeof n)throw new Error('parameter "action" not a Function');if("string"!=typeof i)throw new Error('parameter "name" not a String');e=e.split(/\s*,\s*/g).map(function(e){var t=e.split(/\s+/g),n=t.filter(function(e){return null===e.match(/^#/)}),r=t.filter(function(e){return null!==e.match(/^#/)}).map(function(e){return e.replace(/^#/,"")});if(1!==n.length)throw new Error("exactly one state required");return{state:n[0],tags:r}});var s="g";return t.multiline&&(s+="m"),t.ignoreCase&&(s+="i"),t=new RegExp(t.source,s),this._log("rule: configure rule (state: "+e+", pattern: "+t.source+")"),this._rules.push({state:e,pattern:t,action:n,name:i}),this}},{key:"_progress",value:function(e,t){for(var n=this._line,r=this._column,i=this._input,o=e;o<t;o++){var a=i.charAt(o);"\r"===a?this._column=1:"\n"===a?(this._line++,this._column=1):"\t"===a?this._column+=8-this._column%8:this._column++}this._log(" PROGRESS: characters: "+(t-e)+", from: <line "+n+", column "+r+">, to: <line "+this._line+", column "+this._column+">")}},{key:"_tokenize",value:function(){var e=this,t=function(){e._eof||(null!==e._finish&&e._finish.call(e._ctx,e._ctx),e._eof=!0,e._pending.push(new s("EOF","","",e._pos,e._line,e._column)))};if(!(this._stopped||this._pos>=this._len)){for(var n=!0;n;){if(n=!1,this._debug){var r=a(this._input,this._pos),i=Object.keys(this._tag).map(function(e){return"#"+e}).join(" ");this._log("INPUT: state: <"+this._state[this._state.length-1]+">, tags: <"+i+">, text: "+(r.prologTrunc?"...":'"')+r.prologText+"<"+r.tokenText+">"+r.epilogText+(r.epilogTrunc?"...":'"')+", at: <line "+this._line+", column "+this._column+">")}for(var o=0;o<this._rules.length;o++){if(this._debug){var u=this._rules[o].state.map(function(e){var t=e.state;return e.tags.length>0&&(t+=" "+e.tags.map(function(e){return"#"+e}).join(" ")),t}).join(", ");this._log(" RULE: state(s): <"+u+">, pattern: "+this._rules[o].pattern.source)}var l=!1,c=this._rules[o].state.map(function(e){return e.state}),p=c.indexOf("*");if(p<0&&(p=c.indexOf(this._state[this._state.length-1])),p>=0){l=!0;var f=this._rules[o].state[p].tags;(f=f.filter(function(t){return!e._tag[t]})).length>0&&(l=!1)}if(l){this._rules[o].pattern.lastIndex=this._pos;var h=this._rules[o].pattern.exec(this._input);if(this._rules[o].pattern.lastIndex=this._pos,null!==(h=this._rules[o].pattern.exec(this._input))&&h.index===this._pos){if(this._debug&&this._log(" MATCHED: "+JSON.stringify(h)),this._ctx._match=h,this._ctx._repeat=!1,this._ctx._reject=!1,this._ctx._ignore=!1,null!==this._before&&this._before.call(this._ctx,this._ctx,h,this._rules[o]),this._rules[o].action.call(this._ctx,this._ctx,h),null!==this._after&&this._after.call(this._ctx,this._ctx,h,this._rules[o]),this._ctx._reject)continue;if(this._ctx._repeat){n=!0;break}if(this._ctx._ignore){if(this._progress(this._pos,this._rules[o].pattern.lastIndex),this._pos=this._rules[o].pattern.lastIndex,this._pos>=this._len)return void t();n=!0;break}if(this._pending.length>0)return this._progress(this._pos,this._rules[o].pattern.lastIndex),this._pos=this._rules[o].pattern.lastIndex,void(this._pos>=this._len&&t());throw new Error('action of pattern "'+this._rules[o].pattern.source+'" neither rejected nor accepted any token(s)')}}}}throw this.error("token not recognized")}t()}},{key:"token",value:function(){if(0===this._pending.length&&this._tokenize(),this._pending.length>0){var e=this._pending.shift();return this._transaction.length>0&&this._transaction[0].push(e),this._log("TOKEN: "+e.toString()),e}return null}},{key:"tokens",value:function(){for(var e=[],t=void 0;null!==(t=this.token());)e.push(t);return e}},{key:"peek",value:function(e){void 0===e&&(e=0);for(var t=0;t<this._pending.length+e;t++)this._tokenize();if(e>=this._pending.length)throw new Error("not enough tokens available for peek operation");return this._log("PEEK: "+this._pending[e].toString()),this._pending[e]}},{key:"skip",value:function(e){void 0===e&&(e=1);for(var t=0;t<this._pending.length+e;t++)this._tokenize();if(e>this._pending.length)throw new Error("not enough tokens available for skip operation");for(;e-- >0;)this.token();return this}},{key:"consume",value:function(e,t){for(var n=this,i=0;i<this._pending.length+1;i++)this._tokenize();if(0===this._pending.length)throw new Error("not enough tokens available for consume operation");var o=this.token();this._log("CONSUME: "+o.toString());var a=function(){throw new u("expected: <type: "+e+", value: "+JSON.stringify(t)+" ("+(void 0===t?"undefined":r(t))+")>, found: <type: "+o.type+", value: "+JSON.stringify(o.value)+" ("+r(o.value)+")>",o.pos,o.line,o.column,n._input)};return 2!==arguments.length||o.isA(e,t)?o.isA(e)||a():a(JSON.stringify(t),void 0===t||r(t)),o}},{key:"begin",value:function(){return this._log("BEGIN: level "+this._transaction.length),this._transaction.unshift([]),this}},{key:"depth",value:function(){if(0===this._transaction.length)throw new Error("cannot determine depth -- no active transaction");return this._transaction[0].length}},{key:"commit",value:function(){if(0===this._transaction.length)throw new Error("cannot commit transaction -- no active transaction");return this._transaction.shift(),this._log("COMMIT: level "+this._transaction.length),this}},{key:"rollback",value:function(){if(0===this._transaction.length)throw new Error("cannot rollback transaction -- no active transaction");return this._pending=this._transaction[0].concat(this._pending),this._transaction.shift(),this._log("ROLLBACK: level "+this._transaction.length),this}},{key:"alternatives",value:function(){for(var e=null,t=[],n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=0;o<r.length;o++)try{this.begin(),e=r[o].call(this),this.commit();break}catch(e){this._log("EXCEPTION: "+e.toString()),t.push({ex:e,depth:this.depth()}),this.rollback();continue}if(null===e&&t.length>0)throw(t=t.sort(function(e,t){return e.depth-t.depth}))[0].ex;return e}}]),e}();c.Token=s,c.ParsingError=u,c.ActionContext=l,t.exports=c},{}]},{},[1])(1)},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=n(25),s=n(24),u=n(0),l=function(e){function t(t,n){var r=e.call(this,o.ParsedMessagePartType.ICU_MESSAGE)||this;return r._parser=n,t&&r.parseICUMessage(t),r}return i(t,e),t.looksLikeICUMessage=function(e){return new t(null,null).looksLikeICUMessage(e)},t.prototype.asDisplayString=function(e){return"<ICU-Message/>"},t.prototype.getICUMessage=function(){return this._message},t.prototype.parseICUMessage=function(e){this._messageText=e,this._tokenizer=new a.ICUMessageTokenizer,this._tokenizer.input(e),this.expectNext(a.CURLY_BRACE_OPEN),this.expectNext(a.TEXT),this.expectNext(a.COMMA);var t=this._tokenizer.next();for(t.type===a.PLURAL?this._message=new s.ICUMessage(this._parser,!0):t.type===a.SELECT&&(this._message=new s.ICUMessage(this._parser,!1)),this.expectNext(a.COMMA),t=this._tokenizer.peek();t.type!==a.CURLY_BR