New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

easy-template-x

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-template-x - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

6

CHANGELOG.md
# Change Log
## [0.5.2 - 2019-09-11](https://github.com/alonrbar/easy-template-x/tree/v0.5.2)
### Fixed
- "Binary type 'Buffer' is not supported." on Node 12.
## [0.5.1 - 2019-06-05](https://github.com/alonrbar/easy-template-x/tree/v0.5.1)

@@ -4,0 +10,0 @@

4

dist/easy-template-x.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("easy-template-x",[],t):"object"==typeof exports?exports["easy-template-x"]=t():e["easy-template-x"]=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=50)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlNode=t.TEXT_NODE_NAME=t.XmlNodeType=void 0;var n=r(1),i=r(2);let o;t.XmlNodeType=o,function(e){e.Text="Text",e.General="General"}(o||(t.XmlNodeType=o={}));t.TEXT_NODE_NAME="#text";const s={createTextNode:e=>({nodeType:o.Text,nodeName:"#text",textContent:e}),createGeneralNode:e=>({nodeType:o.General,nodeName:e}),encodeValue(e){if(null===e||void 0===e)throw new n.MissingArgumentError("str");if("string"!=typeof e)throw new TypeError(`Expected a string, got '${e.constructor.name}'.`);return e.replace(/[<>&'"]/g,e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})},serialize(e){if(this.isTextNode(e))return this.encodeValue(e.textContent||"");let t="";e.attributes&&e.attributes.length&&(t=" "+e.attributes.map(e=>`${e.name}="${e.value}"`).join(" "));const r=(e.childNodes||[]).length>0,n=r?"":"/",i=`<${e.nodeName}${t}${n}>`;let o;if(r){o=i+e.childNodes.map(e=>this.serialize(e)).join("")+`</${e.nodeName}>`}else o=i;return o},fromDomNode(e){let t;if(e.nodeType===e.TEXT_NODE)t=this.createTextNode(e.textContent);else if(t=this.createGeneralNode(e.nodeName),e.nodeType===e.ELEMENT_NODE){const r=e.attributes;if(r){t.attributes=[];for(let e=0;e<r.length;e++){const n=r.item(e);t.attributes.push({name:n.name,value:n.value})}}}if(e.childNodes){let r;t.childNodes=[];for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes.item(n),o=this.fromDomNode(i);t.childNodes.push(o),o.parentNode=t,r&&(r.nextSibling=o),r=o}}return t},isTextNode(e){if(e.nodeType===o.Text||"#text"===e.nodeName){if(e.nodeType!==o.Text||"#text"!==e.nodeName)throw new Error(`Invalid text node. Type: '${e.nodeType}', Name: '${e.nodeName}'.`);return!0}return!1},cloneNode(e,t){if(!e)throw new n.MissingArgumentError("node");if(t){const t=function e(t){const r={};r.nodeType=t.nodeType;r.nodeName=t.nodeName;if(s.isTextNode(t))r.textContent=t.textContent;else{const e=t.attributes;e&&(r.attributes=e.map(e=>({name:e.name,value:e.value})))}if(t.childNodes){let n;r.childNodes=[];for(const i of t.childNodes){const t=e(i);r.childNodes.push(t),t.parentNode=r,n&&(n.nextSibling=t),n=t}}return r}(e);return t.parentNode=null,t}{const t=Object.assign({},e);return t.parentNode=null,t.childNodes=e.childNodes?[]:null,t.nextSibling=null,t}},insertBefore(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r)},insertAfter(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r+1)},insertChild(e,t,r){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),r===e.childNodes.length)return void s.appendChild(e,t);if(r>e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);t.parentNode=e;const i=e.childNodes[r];if(t.nextSibling=i,r>0){e.childNodes[r-1].nextSibling=t}e.childNodes.splice(r,0,t)},appendChild(e,t){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),e.childNodes.length){e.childNodes[e.childNodes.length-1].nextSibling=t}t.nextSibling=null,t.parentNode=e,e.childNodes.push(t)},remove(e){if(!e)throw new n.MissingArgumentError("node");if(!e.parentNode)throw new Error("Node has no parent");a(e.parentNode,e)},removeChild:a,lastTextChild(e){if(s.isTextNode(e))return e;if(e.childNodes){const t=e.childNodes.filter(e=>s.isTextNode(e));if(t.length){const e=(0,i.last)(t);return e.textContent||(e.textContent=""),e}}const t={nodeType:o.Text,nodeName:"#text",textContent:""};return s.appendChild(e,t),t},removeSiblings(e,t){if(e===t)return[];const r=[];let n;for(e=e.nextSibling;e!==t;){const t=e;e=e.nextSibling,s.remove(t),r.push(t),n&&(n.nextSibling=t),n=t}return r},splitByChild(e,t,r){const n=function(e,t){const r=[];let n=t;for(;n!==e;){const e=n.parentNode;if(!e)throw new Error("Argument descendant is not a descendant of root");const t=e.childNodes.indexOf(n);r.push(t),n=e}return r.reverse()}(e,t),i=s.cloneNode(e,!1),o=n[0]+1;for(;o<e.childNodes.length;){const t=e.childNodes[o];s.remove(t),s.appendChild(i,t)}return e.parentNode&&s.insertAfter(i,e),r&&e.childNodes.length&&s.removeChild(e,e.childNodes.length-1),[e,i]},findParent(e,t){if(!e)return null;for(;e.parentNode;){if(t(e))return e;e=e.parentNode}return null},findParentByName:(e,t)=>s.findParent(e,e=>e.nodeName===t),findChildByName:(e,t)=>e?(e.childNodes||[]).find(e=>e.nodeName===t):null,siblingsInRange(e,t){if(!e)throw new n.MissingArgumentError("firstNode");if(!t)throw new n.MissingArgumentError("lastNode");const r=[];let i=e;for(;i&&i!==t;)r.push(i),i=i.nextSibling;if(!i)throw new Error("Nodes are not siblings.");return r.push(t),r}};function a(e,t){if(!e)throw new n.MissingArgumentError("parent");if(null===t||void 0===t)throw new n.MissingArgumentError("childOrIndex");if(!e.childNodes||!e.childNodes.length)throw new Error("Parent node has node children");let r;if("number"==typeof t)r=t;else if(-1===(r=e.childNodes.indexOf(t)))throw new Error("Specified child node is not a child of the specified parent");if(r>=e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);const i=e.childNodes[r];if(r>0){e.childNodes[r-1].nextSibling=i.nextSibling}return i.parentNode=null,i.nextSibling=null,e.childNodes.splice(r,1)[0]}t.XmlNode=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(45);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(44);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(43);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(42);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(41);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(40);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(39);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(38);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var d=r(37);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(14);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(30);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(48);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(47);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(29);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(6);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(27);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(26);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(25);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatePlugin=void 0;t.TemplatePlugin=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}simpleTagReplacements(e,t,r){}containerTagReplacements(e,t,r){}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocxParser=void 0;var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class o{contentFilePaths(e){return["word/document.xml","word/document2.xml"]}mainFilePath(e){return e.files["word/document.xml"]?"word/document.xml":e.files["word/document2.xml"]?"word/document2.xml":void 0}splitTextNode(e,t,r){let i,o;const s=this.containingTextNode(e),a=n.XmlNode.cloneNode(s,!0);if(r)n.XmlNode.insertBefore(a,s),i=n.XmlNode.lastTextChild(a),o=e;else{const t=s.parentNode.childNodes.indexOf(s);n.XmlNode.insertChild(s.parentNode,a,t+1),i=e,o=n.XmlNode.lastTextChild(a)}const u=i.textContent,l=o.textContent;return i.textContent=u.substring(0,t),o.textContent=l.substring(t),r?i:o}joinTextNodesRange(e,t){const r=this.containingRunNode(e),i=this.containingRunNode(t),s=r.parentNode;if(i.parentNode!==s)throw new Error("Can not join text nodes from separate paragraphs.");const a=this.containingTextNode(e),u=this.containingTextNode(t),l=[];let c=r;for(;c;){let e;for(e=c===r?a:this.firstTextNodeChild(c);e;){if(e.nodeName!==o.TEXT_NODE)continue;const t=n.XmlNode.lastTextChild(e);l.push(t.textContent);const r=e;e=e===u?null:e.nextSibling,r!==a&&n.XmlNode.remove(r)}const t=c;c=c===i?null:c.nextSibling,t.childNodes&&t.childNodes.length||n.XmlNode.remove(t)}n.XmlNode.lastTextChild(a).textContent=l.join("")}joinParagraphs(e,t){if(e===t)return;let r=0;for(;t.childNodes&&r<t.childNodes.length;){const i=t.childNodes[r];i.nodeName===o.RUN_NODE?(n.XmlNode.removeChild(t,r),n.XmlNode.appendChild(e,i)):r++}}isTableCellNode(e){return e.nodeName===o.TABLE_CELL_NODE}isParagraphNode(e){return e.nodeName===o.PARAGRAPH_NODE}isListParagraph(e){const t=this.paragraphPropertiesNode(e);return!!n.XmlNode.findChildByName(t,o.NUMBER_PROPERTIES_NODE)}paragraphPropertiesNode(e){if(!this.isParagraphNode(e))throw new Error(`Expected paragraph node but received a '${e.nodeName}' node.`);return n.XmlNode.findChildByName(e,o.PARAGRAPH_PROPERTIES_NODE)}firstTextNodeChild(e){if(!e)return null;if(e.nodeName!==o.RUN_NODE)return null;if(!e.childNodes)return null;for(const t of e.childNodes)if(t.nodeName===o.TEXT_NODE)return t;return null}containingTextNode(e){if(!e)return null;if(!n.XmlNode.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");return n.XmlNode.findParentByName(e,o.TEXT_NODE)}containingRunNode(e){return n.XmlNode.findParentByName(e,o.RUN_NODE)}containingParagraphNode(e){return n.XmlNode.findParentByName(e,o.PARAGRAPH_NODE)}containingTableRowNode(e){return n.XmlNode.findParentByName(e,o.TABLE_ROW_NODE)}}t.DocxParser=o,i(o,"PARAGRAPH_NODE","w:p"),i(o,"PARAGRAPH_PROPERTIES_NODE","w:pPr"),i(o,"RUN_NODE","w:r"),i(o,"TEXT_NODE","w:t"),i(o,"TABLE_ROW_NODE","w:tr"),i(o,"TABLE_CELL_NODE","w:tc"),i(o,"NUMBER_PROPERTIES_NODE","w:numPr")},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i;Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=t.TagDisposition=void 0,t.TagDisposition=i,function(e){e.Open="Open",e.Close="Close",e.SelfClosed="SelfClosed"}(i||(t.TagDisposition=i={}));t.Tag=class{constructor(e){n(this,"name",void 0),n(this,"type",void 0),n(this,"rawText",void 0),n(this,"disposition",void 0),n(this,"xmlTextNode",void 0),Object.assign(this,e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlParser=void 0;var n=r(15),i=r(1),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{parse(e){const t=this.domParse(e);return o.XmlNode.fromDomNode(t.documentElement)}domParse(e){if(null===e||void 0===e)throw new i.MissingArgumentError("str");return a.parser.parseFromString(e,"text/xml")}serialize(e){return a.xmlHeader+o.XmlNode.serialize(e)}}t.XmlParser=a,s(a,"xmlHeader",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),s(a,"parser",new n.DOMParser)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandlerOptions=void 0;var n=r(9),i=r(13);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandlerOptions=class{constructor(e){if(o(this,"plugins",(0,i.createDefaultPlugins)()),o(this,"delimiters",new n.Delimiters),o(this,"maxXmlDepth",20),Object.assign(this,e),e&&(this.delimiters=new n.Delimiters(e.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Delimiters=void 0;var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Delimiters=class{constructor(e){if(i(this,"start","{"),i(this,"end","}"),e&&(e.start&&(this.start=n.XmlNode.encodeValue(e.start)),e.end&&(this.end=n.XmlNode.encodeValue(e.end))),!this.start||!this.end)throw new Error("Both delimiters must be specified.");if(this.start===this.end)throw new Error("Start and end delimiters can not be the same.");if(this.start.length>1||this.end.length>1)throw new Error(`Only single character delimiters supported (start: '${this.start}', end: '${this.end}').`)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextPlugin=void 0;var n=r(3),i=r(5),o=r(0),s=r(4);t.TextPlugin=class extends s.TemplatePlugin{constructor(...e){var t,r,i;super(...e),t=this,r="prefixes",i=[{prefix:"",tagType:"text",tagDisposition:n.TagDisposition.SelfClosed}],r in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}simpleTagReplacements(e,t){const r=t.getScopeData(),n=(null===r||void 0===r?"":r.toString()).split("\n");n.length<2?this.replaceSingleLine(e.xmlTextNode,n.length?n[0]:""):this.replaceMultiLine(e.xmlTextNode,n)}replaceSingleLine(e,t){e.textContent=t;const r=this.utilities.docxParser.containingTextNode(e);r.attributes||(r.attributes=[]),r.attributes.find(e=>"xml:space"===e.name)||r.attributes.push(this.getSpacePreserveAttribute())}replaceMultiLine(e,t){const r=this.utilities.docxParser.containingRunNode(e);e.textContent=t[0];for(let e=1;e<t.length;e++){const n=this.getLineBreak();o.XmlNode.appendChild(r,n);const i=this.createWordTextNode(t[e]);o.XmlNode.appendChild(r,i)}}getSpacePreserveAttribute(){return{name:"xml:space",value:"preserve"}}getLineBreak(){return{nodeType:o.XmlNodeType.General,nodeName:"w:br"}}createWordTextNode(e){const t=o.XmlNode.createGeneralNode(i.DocxParser.TEXT_NODE);return t.attributes=[this.getSpacePreserveAttribute()],t.childNodes=[o.XmlNode.createTextNode(e)],t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawXmlPlugin=void 0;var n=r(3),i=r(0),o=r(4);t.RawXmlPlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,i;super(...e),t=this,r="prefixes",i=[{prefix:"@",tagType:"rawXml",tagDisposition:n.TagDisposition.SelfClosed}],r in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}simpleTagReplacements(e,t){const r=this.utilities.docxParser.containingTextNode(e.xmlTextNode),n=t.getScopeData();if("string"==typeof n){const e=this.utilities.xmlParser.parse(n);i.XmlNode.insertBefore(e,r)}i.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopPlugin=void 0;var n=r(3),i=r(2),o=r(0),s=r(23),a=r(4);function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.LoopPlugin=class extends a.TemplatePlugin{constructor(...e){super(...e),u(this,"prefixes",[{prefix:"#",tagType:"loop",tagDisposition:n.TagDisposition.Open},{prefix:"/",tagType:"loop",tagDisposition:n.TagDisposition.Close}]),u(this,"loopStrategies",[new s.LoopTableStrategy,new s.LoopListStrategy,new s.LoopParagraphStrategy])}setUtilities(e){this.utilities=e,this.loopStrategies.forEach(t=>t.setUtilities(e))}containerTagReplacements(e,t,r){let n=t.getScopeData();n&&Array.isArray(n)&&n.length||(n=[]);const o=e[0],s=(0,i.last)(e),a=this.loopStrategies.find(e=>e.isApplicable(o,s));if(!a)throw new Error(`No loop strategy found for tag '${o.rawText}'.`);const{firstNode:u,nodesToRepeat:l,lastNode:c}=a.splitBefore(o,s),f=this.repeat(l,n.length),d=this.compile(f,t,r);a.mergeBack(d,u,c)}repeat(e,t){if(!e.length||!t)return[];const r=[];for(let n=0;n<t;n++){const t=e.map(e=>o.XmlNode.cloneNode(e,!0));r.push(t)}return r}compile(e,t,r){const n=[];for(let i=0;i<e.length;i++){const s=e[i],a=o.XmlNode.createGeneralNode("dummyRootNode");s.forEach(e=>o.XmlNode.appendChild(a,e)),t.path.push(i),this.utilities.compiler.compile(a,t,r),t.path.pop();const u=[];for(;a.childNodes&&a.childNodes.length;){const e=o.XmlNode.removeChild(a,0);u.push(e)}n.push(u)}return n}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(24);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(12);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(11);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(4);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(10);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})})},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.Binary=void 0;var n=r(1);const i={toJsZipOutputType(t){if(!t)throw new n.MissingArgumentError("binary");if("undefined"!=typeof Blob&&t instanceof Blob)return"blob";if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return"arraybuffer";if(void 0!==e&&t instanceof e)return"nodebuffer";throw new Error(`Binary type '${t.constructor.name}' is not supported.`)}};t.Binary=i}).call(this,r(35).Buffer)},function(e,t){e.exports=require("xmldom")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTypeHelper=t.FileType=void 0;var n=r(1);let i;t.FileType=i,function(e){e.Docx="docx",e.Pptx="pptx",e.Odt="odt"}(i||(t.FileType=i={}));class o{static getFileType(e){if(o.isDocx(e))return i.Docx;if(o.isPptx(e))return i.Pptx;if(o.isOdt(e))return i.Odt;throw new n.UnidentifiedFileTypeError}static isDocx(e){return!(!e.files["word/document.xml"]&&!e.files["word/document2.xml"])}static isPptx(e){return!!e.files["ppt/presentation.xml"]}static isOdt(e){return!!e.files.mimetype}}t.FileTypeHelper=o},function(e,t){e.exports=require("jszip")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandler=void 0;var n=r(17),i=r(3),o=r(5),s=r(1),a=r(16),u=r(8),l=r(2),c=r(0),f=r(7);function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandler=class{constructor(e){d(this,"docxParser",new o.DocxParser),d(this,"xmlParser",new f.XmlParser),d(this,"compiler",void 0),d(this,"options",void 0),this.options=new u.TemplateHandlerOptions(e);const t=new i.DelimiterSearcher;t.startDelimiter=this.options.delimiters.start,t.endDelimiter=this.options.delimiters.end,t.maxXmlDepth=this.options.maxXmlDepth;const r=this.options.plugins.map(e=>e.prefixes).reduce((e,t)=>e.concat(t),[]),n=new i.TagParser(r,this.docxParser);n.startDelimiter=this.options.delimiters.start,n.endDelimiter=this.options.delimiters.end,this.compiler=new i.TemplateCompiler(t,n,this.options.plugins),this.options.plugins.forEach(e=>{e.setUtilities({xmlParser:this.xmlParser,docxParser:this.docxParser,compiler:this.compiler})})}async process(e,t){const r=await this.loadDocx(e),n=await this.parseContentDocuments(r),o=new i.ScopeData(t),s={zipFile:r,currentFilePath:null};for(const e of Object.keys(n))s.currentFilePath=e,this.compiler.compile(n[e],o,s);for(const e of Object.keys(n)){const t=n[e],i=this.xmlParser.serialize(t);r.file(e,i,{createFolders:!0})}const a=l.Binary.toJsZipOutputType(e);return r.generateAsync({type:a})}async parseTags(e){const t=await this.loadDocx(e),r=await this.parseContentDocuments(t),n=[];for(const e of Object.keys(r)){const t=this.compiler.parseTags(r[e]);(0,l.pushMany)(n,t)}return n}async getText(e){return(await this.getDomRoot(e)).textContent}async getXml(e){const t=await this.getDomRoot(e);return c.XmlNode.fromDomNode(t)}async loadDocx(e){let t;try{t=await n.loadAsync(e)}catch(e){throw new s.MalformedFileError("docx")}const r=a.FileTypeHelper.getFileType(t);if(r!==a.FileType.Docx)throw new s.UnsupportedFileTypeError(r);return t}async parseContentDocuments(e){const t=this.docxParser.contentFilePaths(e).filter(t=>e.files[t]),r={};for(const n of t){const t=await e.files[n].async("text");r[n]=this.xmlParser.parse(t)}return r}async getDomRoot(e){const t=await this.loadDocx(e),r=this.docxParser.mainFilePath(t),n=await t.files[r].async("text");return this.xmlParser.domParse(n).documentElement}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopTableStrategy=void 0;var n=r(0);t.LoopTableStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return!!r.parentNode&&this.utilities.docxParser.isTableCellNode(r.parentNode)}splitBefore(e,t){const r=this.utilities.docxParser.containingTableRowNode(e.xmlTextNode),i=this.utilities.docxParser.containingTableRowNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopParagraphStrategy=void 0;var n=r(0);t.LoopParagraphStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){return!0}splitBefore(e,t){let r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode);const o=r===i,s=r.parentNode,a=s.childNodes.indexOf(r),u=o?a:s.childNodes.indexOf(i);let l=n.XmlNode.splitByChild(r,e.xmlTextNode,!0);r=l[0];const c=l[1];o&&(i=c);const f=(l=n.XmlNode.splitByChild(i,t.xmlTextNode,!0))[0];let d;if(i=l[1],n.XmlNode.removeChild(s,a+1),o||n.XmlNode.removeChild(s,u),c.parentNode=null,f.parentNode=null,o)this.utilities.docxParser.joinParagraphs(c,f),d=[c];else{const e=n.XmlNode.removeSiblings(r,i);d=[c].concat(e).concat(f)}return{firstNode:r,nodesToRepeat:d,lastNode:i}}mergeBack(e,t,r){let i=t;for(const t of e){this.utilities.docxParser.joinParagraphs(i,t[0]);for(let e=1;e<t.length;e++)n.XmlNode.insertBefore(t[e],r),i=t[e]}this.utilities.docxParser.joinParagraphs(i,r),n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopListStrategy=void 0;var n=r(0);t.LoopListStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return this.utilities.docxParser.isListParagraph(r)}splitBefore(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(22);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(21);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(20);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(19);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefaultPlugins=function(){return[new n.LoopPlugin,new i.RawXmlPlugin,new o.TextPlugin]};var n=r(12),i=r(11),o=r(10)},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateCompiler=void 0;var n=r(1),i=r(6);t.TemplateCompiler=class{constructor(e,t,r){this.delimiterSearcher=e,this.tagParser=t,this.plugins=r}compile(e,t,r){const n=this.parseTags(e);this.doTagReplacements(n,t,r)}parseTags(e){const t=this.delimiterSearcher.findDelimiters(e);return this.tagParser.parse(t)}doTagReplacements(e,t,r){for(let n=0;n<e.length;n++){const o=e[n];if(t.path.push(o.name),o.disposition===i.TagDisposition.SelfClosed){for(const e of this.plugins)if(e.prefixes.some(e=>e.tagType===o.type)){e.simpleTagReplacements(o,t,r);break}}else if(o.disposition===i.TagDisposition.Open){const i=this.findCloseTagIndex(n,o,e),s=e.slice(n,i+1);n=i;for(const e of this.plugins)if(e.prefixes.some(e=>e.tagType===o.type)){e.containerTagReplacements(s,t,r);break}}t.path.pop()}}findCloseTagIndex(e,t,r){let o=e;for(;o<r.length;o++){const e=r[o];if(e.name===t.name&&e.type===t.type&&e.disposition===i.TagDisposition.Close)break}if(o===r.length)throw new n.UnclosedTagError(t.name);return o}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagParser=void 0;var n=r(1),i=r(6);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TagParser=class{constructor(e,t){if(this.tagPrefixes=e,this.docParser=t,o(this,"startDelimiter","{"),o(this,"endDelimiter","}"),!e||!e.length)throw new n.MissingArgumentError("tagPrefixes");if(!t)throw new n.MissingArgumentError("docParser")}parse(e){const t=[];let r,o,s,a;for(const u of e){if(!r&&!u.isOpen){const e=u.xmlTextNode.textContent;throw new n.MissingStartDelimiterError(e)}if(r&&u.isOpen){const e=o.xmlTextNode.textContent;throw new n.MissingCloseDelimiterError(e)}!r&&u.isOpen&&(r=new i.Tag,o=u),r&&!u.isOpen&&(s===o.xmlTextNode&&(o.index-=a),s===u.xmlTextNode&&(u.index-=a),s=u.xmlTextNode,a=this.normalizeTagNodes(o,u),r.xmlTextNode=o.xmlTextNode,this.processTag(r),t.push(r),r=null,o=null)}return t}normalizeTagNodes(e,t){let r=0,n=e.xmlTextNode,i=t.xmlTextNode;const o=n===i;return e.index>0&&(r+=e.index,this.docParser.splitTextNode(n,e.index,!0)),t.index<i.textContent.length-1&&(r+=t.index+1,i=this.docParser.splitTextNode(i,t.index+1,!0),o&&(n=i)),o||(this.docParser.joinTextNodesRange(n,i),i=n),e.xmlTextNode=n,t.xmlTextNode=i,r}processTag(e){e.rawText=e.xmlTextNode.textContent;for(const t of this.tagPrefixes){const r=`^[${this.startDelimiter}](\\s*?)${t.prefix}(.*?)[${this.endDelimiter}]`,n=new RegExp(r,"gmi").exec(e.rawText);if(n&&n.length){e.name=n[2],e.type=t.tagType,e.disposition=t.tagDisposition;break}}if(!e.name)throw new n.UnknownPrefixError(e.rawText)}}},function(e,t){e.exports=require("lodash.get")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScopeData=void 0;var n=r(2);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(28);t.ScopeData=class{constructor(e){i(this,"path",[]),i(this,"allData",void 0),this.allData=e}getScopeData(){const e=(0,n.last)(this.path);let t,r=this.path.slice();for(;void 0===t&&r.length;){const n=r.slice(0,r.length-1);t=o(this.allData,n.concat(e)),r=n}return t}}},function(e,t,r){"use strict"},function(e,t){e.exports=require("isarray")},function(e,t){e.exports=require("ieee754")},function(e,t){e.exports=require("base64-js")},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";(function(e){
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("easy-template-x",[],t):"object"==typeof exports?exports["easy-template-x"]=t():e["easy-template-x"]=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlNode=t.TEXT_NODE_NAME=t.XmlNodeType=void 0;var n=r(1),i=r(3);let o;t.XmlNodeType=o,function(e){e.Text="Text",e.General="General"}(o||(t.XmlNodeType=o={}));t.TEXT_NODE_NAME="#text";const s={createTextNode:e=>({nodeType:o.Text,nodeName:"#text",textContent:e}),createGeneralNode:e=>({nodeType:o.General,nodeName:e}),encodeValue(e){if(null===e||void 0===e)throw new n.MissingArgumentError("str");if("string"!=typeof e)throw new TypeError(`Expected a string, got '${e.constructor.name}'.`);return e.replace(/[<>&'"]/g,e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}return""})},serialize(e){if(this.isTextNode(e))return this.encodeValue(e.textContent||"");let t="";e.attributes&&e.attributes.length&&(t=" "+e.attributes.map(e=>`${e.name}="${e.value}"`).join(" "));const r=(e.childNodes||[]).length>0,n=r?"":"/",i=`<${e.nodeName}${t}${n}>`;let o;if(r){o=i+e.childNodes.map(e=>this.serialize(e)).join("")+`</${e.nodeName}>`}else o=i;return o},fromDomNode(e){let t;if(e.nodeType===e.TEXT_NODE)t=this.createTextNode(e.textContent);else if(t=this.createGeneralNode(e.nodeName),e.nodeType===e.ELEMENT_NODE){const r=e.attributes;if(r){t.attributes=[];for(let e=0;e<r.length;e++){const n=r.item(e);t.attributes.push({name:n.name,value:n.value})}}}if(e.childNodes){let r;t.childNodes=[];for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes.item(n),o=this.fromDomNode(i);t.childNodes.push(o),o.parentNode=t,r&&(r.nextSibling=o),r=o}}return t},isTextNode(e){if(e.nodeType===o.Text||"#text"===e.nodeName){if(e.nodeType!==o.Text||"#text"!==e.nodeName)throw new Error(`Invalid text node. Type: '${e.nodeType}', Name: '${e.nodeName}'.`);return!0}return!1},cloneNode(e,t){if(!e)throw new n.MissingArgumentError("node");if(t){const t=function e(t){const r={};r.nodeType=t.nodeType;r.nodeName=t.nodeName;if(s.isTextNode(t))r.textContent=t.textContent;else{const e=t.attributes;e&&(r.attributes=e.map(e=>({name:e.name,value:e.value})))}if(t.childNodes){let n;r.childNodes=[];for(const i of t.childNodes){const t=e(i);r.childNodes.push(t),t.parentNode=r,n&&(n.nextSibling=t),n=t}}return r}(e);return t.parentNode=null,t}{const t=Object.assign({},e);return t.parentNode=null,t.childNodes=e.childNodes?[]:null,t.nextSibling=null,t}},insertBefore(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r)},insertAfter(e,t){if(!e)throw new n.MissingArgumentError("newNode");if(!t)throw new n.MissingArgumentError("referenceNode");if(!t.parentNode)throw new Error("'referenceNode' has no parent");const r=t.parentNode.childNodes.indexOf(t);s.insertChild(t.parentNode,e,r+1)},insertChild(e,t,r){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),r===e.childNodes.length)return void s.appendChild(e,t);if(r>e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);t.parentNode=e;const i=e.childNodes[r];if(t.nextSibling=i,r>0){e.childNodes[r-1].nextSibling=t}e.childNodes.splice(r,0,t)},appendChild(e,t){if(!e)throw new n.MissingArgumentError("parent");if(s.isTextNode(e))throw new Error("Appending children to text nodes is forbidden");if(!t)throw new n.MissingArgumentError("child");if(e.childNodes||(e.childNodes=[]),e.childNodes.length){e.childNodes[e.childNodes.length-1].nextSibling=t}t.nextSibling=null,t.parentNode=e,e.childNodes.push(t)},remove(e){if(!e)throw new n.MissingArgumentError("node");if(!e.parentNode)throw new Error("Node has no parent");a(e.parentNode,e)},removeChild:a,lastTextChild(e){if(s.isTextNode(e))return e;if(e.childNodes){const t=e.childNodes.filter(e=>s.isTextNode(e));if(t.length){const e=(0,i.last)(t);return e.textContent||(e.textContent=""),e}}const t={nodeType:o.Text,nodeName:"#text",textContent:""};return s.appendChild(e,t),t},removeSiblings(e,t){if(e===t)return[];const r=[];let n;for(e=e.nextSibling;e!==t;){const t=e;e=e.nextSibling,s.remove(t),r.push(t),n&&(n.nextSibling=t),n=t}return r},splitByChild(e,t,r){const n=function(e,t){const r=[];let n=t;for(;n!==e;){const e=n.parentNode;if(!e)throw new Error("Argument descendant is not a descendant of root");const t=e.childNodes.indexOf(n);r.push(t),n=e}return r.reverse()}(e,t),i=s.cloneNode(e,!1),o=n[0]+1;for(;o<e.childNodes.length;){const t=e.childNodes[o];s.remove(t),s.appendChild(i,t)}return e.parentNode&&s.insertAfter(i,e),r&&e.childNodes.length&&s.removeChild(e,e.childNodes.length-1),[e,i]},findParent(e,t){if(!e)return null;for(;e.parentNode;){if(t(e))return e;e=e.parentNode}return null},findParentByName:(e,t)=>s.findParent(e,e=>e.nodeName===t),findChildByName:(e,t)=>e?(e.childNodes||[]).find(e=>e.nodeName===t):null,siblingsInRange(e,t){if(!e)throw new n.MissingArgumentError("firstNode");if(!t)throw new n.MissingArgumentError("lastNode");const r=[];let i=e;for(;i&&i!==t;)r.push(i),i=i.nextSibling;if(!i)throw new Error("Nodes are not siblings.");return r.push(t),r}};function a(e,t){if(!e)throw new n.MissingArgumentError("parent");if(null===t||void 0===t)throw new n.MissingArgumentError("childOrIndex");if(!e.childNodes||!e.childNodes.length)throw new Error("Parent node has node children");let r;if("number"==typeof t)r=t;else if(-1===(r=e.childNodes.indexOf(t)))throw new Error("Specified child node is not a child of the specified parent");if(r>=e.childNodes.length)throw new RangeError(`Child index ${r} is out of range. Parent has only ${e.childNodes.length} child nodes.`);const i=e.childNodes[r];if(r>0){e.childNodes[r-1].nextSibling=i.nextSibling}return i.parentNode=null,i.nextSibling=null,e.childNodes.splice(r,1)[0]}t.XmlNode=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(19);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(20);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(21);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(22);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(23);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(24);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(25);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(26);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(27);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var d=r(28);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(18);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(36);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(5);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(38);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(39);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(40);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(29);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(7);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(35);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplatePlugin=void 0;t.TemplatePlugin=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}simpleTagReplacements(e,t,r){}containerTagReplacements(e,t,r){}}},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let i;Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=t.TagDisposition=void 0,t.TagDisposition=i,function(e){e.Open="Open",e.Close="Close",e.SelfClosed="SelfClosed"}(i||(t.TagDisposition=i={}));t.Tag=class{constructor(e){n(this,"name",void 0),n(this,"type",void 0),n(this,"rawText",void 0),n(this,"disposition",void 0),n(this,"xmlTextNode",void 0),Object.assign(this,e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DocxParser=void 0;var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class o{contentFilePaths(e){return["word/document.xml","word/document2.xml"]}mainFilePath(e){return e.files["word/document.xml"]?"word/document.xml":e.files["word/document2.xml"]?"word/document2.xml":void 0}splitTextNode(e,t,r){let i,o;const s=this.containingTextNode(e),a=n.XmlNode.cloneNode(s,!0);if(r)n.XmlNode.insertBefore(a,s),i=n.XmlNode.lastTextChild(a),o=e;else{const t=s.parentNode.childNodes.indexOf(s);n.XmlNode.insertChild(s.parentNode,a,t+1),i=e,o=n.XmlNode.lastTextChild(a)}const u=i.textContent,l=o.textContent;return i.textContent=u.substring(0,t),o.textContent=l.substring(t),r?i:o}joinTextNodesRange(e,t){const r=this.containingRunNode(e),i=this.containingRunNode(t),s=r.parentNode;if(i.parentNode!==s)throw new Error("Can not join text nodes from separate paragraphs.");const a=this.containingTextNode(e),u=this.containingTextNode(t),l=[];let c=r;for(;c;){let e;for(e=c===r?a:this.firstTextNodeChild(c);e;){if(e.nodeName!==o.TEXT_NODE)continue;const t=n.XmlNode.lastTextChild(e);l.push(t.textContent);const r=e;e=e===u?null:e.nextSibling,r!==a&&n.XmlNode.remove(r)}const t=c;c=c===i?null:c.nextSibling,t.childNodes&&t.childNodes.length||n.XmlNode.remove(t)}n.XmlNode.lastTextChild(a).textContent=l.join("")}joinParagraphs(e,t){if(e===t)return;let r=0;for(;t.childNodes&&r<t.childNodes.length;){const i=t.childNodes[r];i.nodeName===o.RUN_NODE?(n.XmlNode.removeChild(t,r),n.XmlNode.appendChild(e,i)):r++}}isTableCellNode(e){return e.nodeName===o.TABLE_CELL_NODE}isParagraphNode(e){return e.nodeName===o.PARAGRAPH_NODE}isListParagraph(e){const t=this.paragraphPropertiesNode(e);return!!n.XmlNode.findChildByName(t,o.NUMBER_PROPERTIES_NODE)}paragraphPropertiesNode(e){if(!this.isParagraphNode(e))throw new Error(`Expected paragraph node but received a '${e.nodeName}' node.`);return n.XmlNode.findChildByName(e,o.PARAGRAPH_PROPERTIES_NODE)}firstTextNodeChild(e){if(!e)return null;if(e.nodeName!==o.RUN_NODE)return null;if(!e.childNodes)return null;for(const t of e.childNodes)if(t.nodeName===o.TEXT_NODE)return t;return null}containingTextNode(e){if(!e)return null;if(!n.XmlNode.isTextNode(e))throw new Error("'Invalid argument node. Expected a XmlTextNode.");return n.XmlNode.findParentByName(e,o.TEXT_NODE)}containingRunNode(e){return n.XmlNode.findParentByName(e,o.RUN_NODE)}containingParagraphNode(e){return n.XmlNode.findParentByName(e,o.PARAGRAPH_NODE)}containingTableRowNode(e){return n.XmlNode.findParentByName(e,o.TABLE_ROW_NODE)}}t.DocxParser=o,i(o,"PARAGRAPH_NODE","w:p"),i(o,"PARAGRAPH_PROPERTIES_NODE","w:pPr"),i(o,"RUN_NODE","w:r"),i(o,"TEXT_NODE","w:t"),i(o,"TABLE_ROW_NODE","w:tr"),i(o,"TABLE_CELL_NODE","w:tc"),i(o,"NUMBER_PROPERTIES_NODE","w:numPr")},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.Binary=void 0;var n=r(1);const i={toJsZipOutputType(t){if(!t)throw new n.MissingArgumentError("binary");if("undefined"!=typeof Blob&&t instanceof Blob)return"blob";if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return"arraybuffer";if(void 0!==e&&t instanceof e)return"nodebuffer";if("undefined"!=typeof Uint8Array&&t instanceof Uint8Array)return"nodebuffer";throw new Error(`Binary type '${t.constructor.name}' is not supported.`)}};t.Binary=i}).call(this,r(30).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(41);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(9);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(10);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(4);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(11);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopPlugin=void 0;var n=r(2),i=r(3),o=r(0),s=r(42),a=r(4);function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.LoopPlugin=class extends a.TemplatePlugin{constructor(...e){super(...e),u(this,"prefixes",[{prefix:"#",tagType:"loop",tagDisposition:n.TagDisposition.Open},{prefix:"/",tagType:"loop",tagDisposition:n.TagDisposition.Close}]),u(this,"loopStrategies",[new s.LoopTableStrategy,new s.LoopListStrategy,new s.LoopParagraphStrategy])}setUtilities(e){this.utilities=e,this.loopStrategies.forEach(t=>t.setUtilities(e))}containerTagReplacements(e,t,r){let n=t.getScopeData();n&&Array.isArray(n)&&n.length||(n=[]);const o=e[0],s=(0,i.last)(e),a=this.loopStrategies.find(e=>e.isApplicable(o,s));if(!a)throw new Error(`No loop strategy found for tag '${o.rawText}'.`);const{firstNode:u,nodesToRepeat:l,lastNode:c}=a.splitBefore(o,s),f=this.repeat(l,n.length),d=this.compile(f,t,r);a.mergeBack(d,u,c)}repeat(e,t){if(!e.length||!t)return[];const r=[];for(let n=0;n<t;n++){const t=e.map(e=>o.XmlNode.cloneNode(e,!0));r.push(t)}return r}compile(e,t,r){const n=[];for(let i=0;i<e.length;i++){const s=e[i],a=o.XmlNode.createGeneralNode("dummyRootNode");s.forEach(e=>o.XmlNode.appendChild(a,e)),t.path.push(i),this.utilities.compiler.compile(a,t,r),t.path.pop();const u=[];for(;a.childNodes&&a.childNodes.length;){const e=o.XmlNode.removeChild(a,0);u.push(e)}n.push(u)}return n}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawXmlPlugin=void 0;var n=r(2),i=r(0),o=r(4);t.RawXmlPlugin=class extends o.TemplatePlugin{constructor(...e){var t,r,i;super(...e),t=this,r="prefixes",i=[{prefix:"@",tagType:"rawXml",tagDisposition:n.TagDisposition.SelfClosed}],r in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}simpleTagReplacements(e,t){const r=this.utilities.docxParser.containingTextNode(e.xmlTextNode),n=t.getScopeData();if("string"==typeof n){const e=this.utilities.xmlParser.parse(n);i.XmlNode.insertBefore(e,r)}i.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TextPlugin=void 0;var n=r(2),i=r(6),o=r(0),s=r(4);t.TextPlugin=class extends s.TemplatePlugin{constructor(...e){var t,r,i;super(...e),t=this,r="prefixes",i=[{prefix:"",tagType:"text",tagDisposition:n.TagDisposition.SelfClosed}],r in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}simpleTagReplacements(e,t){const r=t.getScopeData(),n=(null===r||void 0===r?"":r.toString()).split("\n");n.length<2?this.replaceSingleLine(e.xmlTextNode,n.length?n[0]:""):this.replaceMultiLine(e.xmlTextNode,n)}replaceSingleLine(e,t){e.textContent=t;const r=this.utilities.docxParser.containingTextNode(e);r.attributes||(r.attributes=[]),r.attributes.find(e=>"xml:space"===e.name)||r.attributes.push(this.getSpacePreserveAttribute())}replaceMultiLine(e,t){const r=this.utilities.docxParser.containingRunNode(e);e.textContent=t[0];for(let e=1;e<t.length;e++){const n=this.getLineBreak();o.XmlNode.appendChild(r,n);const i=this.createWordTextNode(t[e]);o.XmlNode.appendChild(r,i)}}getSpacePreserveAttribute(){return{name:"xml:space",value:"preserve"}}getLineBreak(){return{nodeType:o.XmlNodeType.General,nodeName:"w:br"}}createWordTextNode(e){const t=o.XmlNode.createGeneralNode(i.DocxParser.TEXT_NODE);return t.attributes=[this.getSpacePreserveAttribute()],t.childNodes=[o.XmlNode.createTextNode(e)],t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Delimiters=void 0;var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.Delimiters=class{constructor(e){if(i(this,"start","{"),i(this,"end","}"),e&&(e.start&&(this.start=n.XmlNode.encodeValue(e.start)),e.end&&(this.end=n.XmlNode.encodeValue(e.end))),!this.start||!this.end)throw new Error("Both delimiters must be specified.");if(this.start===this.end)throw new Error("Start and end delimiters can not be the same.");if(this.start.length>1||this.end.length>1)throw new Error(`Only single character delimiters supported (start: '${this.start}', end: '${this.end}').`)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandlerOptions=void 0;var n=r(12),i=r(8);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandlerOptions=class{constructor(e){if(o(this,"plugins",(0,i.createDefaultPlugins)()),o(this,"delimiters",new n.Delimiters),o(this,"maxXmlDepth",20),Object.assign(this,e),e&&(this.delimiters=new n.Delimiters(e.delimiters)),!this.plugins.length)throw new Error("Plugins list can not be empty")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlParser=void 0;var n=r(50),i=r(1),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class a{parse(e){const t=this.domParse(e);return o.XmlNode.fromDomNode(t.documentElement)}domParse(e){if(null===e||void 0===e)throw new i.MissingArgumentError("str");return a.parser.parseFromString(e,"text/xml")}serialize(e){return a.xmlHeader+o.XmlNode.serialize(e)}}t.XmlParser=a,s(a,"xmlHeader",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),s(a,"parser",new n.DOMParser)},function(e,t,r){e.exports=r(16)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(1);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(8);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(12);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(6);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(47);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(13);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(7);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(0);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var d=r(14);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})})},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterMark=void 0;t.DelimiterMark=class{constructor(e){n(this,"xmlTextNode",void 0),n(this,"index",void 0),n(this,"isOpen",void 0),Object.assign(this,e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterSearcher=void 0;var n=r(1),i=r(3),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.DelimiterSearcher=class{constructor(){s(this,"maxXmlDepth",20),s(this,"startDelimiter","{"),s(this,"endDelimiter","}")}findDelimiters(e){const t=[];return this.findRecurse(e,t,0),t}findRecurse(e,t,r){if(r>this.maxXmlDepth)throw new n.MaxXmlDepthError(this.maxXmlDepth);if(!e)return;if(o.XmlNode.isTextNode(e)){const r=this.findInNode(e);return void(r.length&&(0,i.pushMany)(t,r))}const s=e.childNodes?e.childNodes.length:0;for(let n=0;n<s;n++){const i=e.childNodes[n];this.findRecurse(i,t,r+1)}}findInNode(e){if(!e.textContent)return[];const t=[];for(let r=0;r<e.textContent.length;r++)e.textContent[r]===this.startDelimiter?t.push({index:r,isOpen:!0,xmlTextNode:e}):e.textContent[r]===this.endDelimiter&&t.push({index:r,isOpen:!1,xmlTextNode:e});return t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MalformedFileError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Malformed file detected. Make sure the file is a valid ${e} file.`),i=void 0,(r="expectedFileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.expectedFileType=e,Object.setPrototypeOf(this,n.prototype)}}t.MalformedFileError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxXmlDepthError=void 0;class n extends Error{constructor(e){var t,r,i;super(`XML maximum depth reached (max depth: ${e}).`),i=void 0,(r="maxDepth")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.maxDepth=e,Object.setPrototypeOf(this,n.prototype)}}t.MaxXmlDepthError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingArgumentError=void 0;class n extends Error{constructor(e){super(`Argument '${e}' is missing.`),Object.setPrototypeOf(this,n.prototype)}}t.MissingArgumentError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingCloseDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Close delimiter is missing from '${e}'.`),i=void 0,(r="openDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.openDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingCloseDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingStartDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Open delimiter is missing from '${e}'.`),i=void 0,(r="closeDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.closeDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingStartDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnclosedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is never closed.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnclosedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnidentifiedFileTypeError=void 0;class n extends Error{constructor(){super("The filetype for this file could not be identified, is this file corrupted?"),Object.setPrototypeOf(this,n.prototype)}}t.UnidentifiedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownPrefixError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' does not match any of the known prefixes.`),i=void 0,(r="tagRawText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagRawText=e,Object.setPrototypeOf(this,n.prototype)}}t.UnknownPrefixError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnopenedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is closed but was never opened.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnopenedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedFileTypeError=void 0;class n extends Error{constructor(e){super(`Filetype "${e}" is not supported.`),Object.setPrototypeOf(this,n.prototype)}}t.UnsupportedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pushMany=function(e,t){Array.prototype.push.apply(e,t)},t.last=function(e){return e.length?e[e.length-1]:void 0}},function(e,t,r){"use strict";(function(e){
/*!

@@ -8,2 +8,2 @@ * The buffer module from node.js, for the browser.

*/
var n=r(33),i=r(32),o=r(31);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return l(this,e,t,r)}function l(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|h(t.length);return 0===(e=a(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(c(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function d(e,t){var r=t.length<0?0:0|h(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return I(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(n)return I(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(l(e,o+d)!==l(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function v(e,t,r,n){return F(I(t,e.length-r),e,r,n)}function x(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function N(e,t,r,n){return x(e,t,r,n)}function w(e,t,r,n){return F(Y(t),e,r,n)}function P(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,l=e[i],c=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&l)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=_));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return l(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return c(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?E(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),f=0;f<a;++f)if(l[f]!==c[f]){o=l[f],s=c[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return x(this,e,t,r);case"latin1":case"binary":return N(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=L(e[o]);return i}function M(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function S(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function B(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function C(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function X(e,t,r,n,o){return o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return o||C(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return X(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return X(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:I(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function I(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(34))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pushMany=function(e,t){Array.prototype.push.apply(e,t)},t.last=function(e){return e.length?e[e.length-1]:void 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnsupportedFileTypeError=void 0;class n extends Error{constructor(e){super(`Filetype "${e}" is not supported.`),Object.setPrototypeOf(this,n.prototype)}}t.UnsupportedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnopenedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is closed but was never opened.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnopenedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnknownPrefixError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' does not match any of the known prefixes.`),i=void 0,(r="tagRawText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagRawText=e,Object.setPrototypeOf(this,n.prototype)}}t.UnknownPrefixError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnidentifiedFileTypeError=void 0;class n extends Error{constructor(){super("The filetype for this file could not be identified, is this file corrupted?"),Object.setPrototypeOf(this,n.prototype)}}t.UnidentifiedFileTypeError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnclosedTagError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Tag '${e}' is never closed.`),i=void 0,(r="tagName")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.tagName=e,Object.setPrototypeOf(this,n.prototype)}}t.UnclosedTagError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingStartDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Open delimiter is missing from '${e}'.`),i=void 0,(r="closeDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.closeDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingStartDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingCloseDelimiterError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Close delimiter is missing from '${e}'.`),i=void 0,(r="openDelimiterText")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.openDelimiterText=e,Object.setPrototypeOf(this,n.prototype)}}t.MissingCloseDelimiterError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingArgumentError=void 0;class n extends Error{constructor(e){super(`Argument '${e}' is missing.`),Object.setPrototypeOf(this,n.prototype)}}t.MissingArgumentError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MaxXmlDepthError=void 0;class n extends Error{constructor(e){var t,r,i;super(`XML maximum depth reached (max depth: ${e}).`),i=void 0,(r="maxDepth")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.maxDepth=e,Object.setPrototypeOf(this,n.prototype)}}t.MaxXmlDepthError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MalformedFileError=void 0;class n extends Error{constructor(e){var t,r,i;super(`Malformed file detected. Make sure the file is a valid ${e} file.`),i=void 0,(r="expectedFileType")in(t=this)?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.expectedFileType=e,Object.setPrototypeOf(this,n.prototype)}}t.MalformedFileError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterSearcher=void 0;var n=r(1),i=r(2),o=r(0);function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.DelimiterSearcher=class{constructor(){s(this,"maxXmlDepth",20),s(this,"startDelimiter","{"),s(this,"endDelimiter","}")}findDelimiters(e){const t=[];return this.findRecurse(e,t,0),t}findRecurse(e,t,r){if(r>this.maxXmlDepth)throw new n.MaxXmlDepthError(this.maxXmlDepth);if(!e)return;if(o.XmlNode.isTextNode(e)){const r=this.findInNode(e);return void(r.length&&(0,i.pushMany)(t,r))}const s=e.childNodes?e.childNodes.length:0;for(let n=0;n<s;n++){const i=e.childNodes[n];this.findRecurse(i,t,r+1)}}findInNode(e){if(!e.textContent)return[];const t=[];for(let r=0;r<e.textContent.length;r++)e.textContent[r]===this.startDelimiter?t.push({index:r,isOpen:!0,xmlTextNode:e}):e.textContent[r]===this.endDelimiter&&t.push({index:r,isOpen:!1,xmlTextNode:e});return t}}},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.DelimiterMark=void 0;t.DelimiterMark=class{constructor(e){n(this,"xmlTextNode",void 0),n(this,"index",void 0),n(this,"isOpen",void 0),Object.assign(this,e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(1);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(13);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(9);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var a=r(5);Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var u=r(18);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=r(8);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=r(14);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(0);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var d=r(7);Object.keys(d).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})})},function(e,t,r){e.exports=r(49)}])});
var n=r(32),i=r(33),o=r(34);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return l(this,e,t,r)}function l(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=d(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|h(t.length);return 0===(e=a(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(c(t),e=a(e,t<0?0:0|h(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function d(e,t){var r=t.length<0?0:0|h(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function h(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return I(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(n)return I(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var f=!0,d=0;d<u;d++)if(l(e,o+d)!==l(t,d)){f=!1;break}if(f)return o}return-1}function b(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function x(e,t,r,n){return F(I(t,e.length-r),e,r,n)}function v(e,t,r,n){return F(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function N(e,t,r,n){return v(e,t,r,n)}function w(e,t,r,n){return F(Y(t),e,r,n)}function P(e,t,r,n){return F(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,l=e[i],c=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=r)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&l)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=f}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=_));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return l(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return c(t),t<=0?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?E(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return j(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,s=r-t,a=Math.min(o,s),l=this.slice(n,i),c=e.slice(t,r),f=0;f<a;++f)if(l[f]!==c[f]){o=l[f],s=c[f];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return N(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=L(e[o]);return i}function M(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function S(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function B(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function C(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function X(e,t,r,n,o){return o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return o||C(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if(e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||A(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||A(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||A(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||A(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||A(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||A(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);D(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):S(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):S(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return X(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return X(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=u.isBuffer(e)?e:I(new u(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function L(e){return e<16?"0"+e.toString(16):e.toString(16)}function I(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function F(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(31))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=require("base64-js")},function(e,t){e.exports=require("ieee754")},function(e,t){e.exports=require("isarray")},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScopeData=void 0;var n=r(3);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(37);t.ScopeData=class{constructor(e){i(this,"path",[]),i(this,"allData",void 0),this.allData=e}getScopeData(){const e=(0,n.last)(this.path);let t,r=this.path.slice();for(;void 0===t&&r.length;){const n=r.slice(0,r.length-1);t=o(this.allData,n.concat(e)),r=n}return t}}},function(e,t){e.exports=require("lodash.get")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagParser=void 0;var n=r(1),i=r(5);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TagParser=class{constructor(e,t){if(this.tagPrefixes=e,this.docParser=t,o(this,"startDelimiter","{"),o(this,"endDelimiter","}"),!e||!e.length)throw new n.MissingArgumentError("tagPrefixes");if(!t)throw new n.MissingArgumentError("docParser")}parse(e){const t=[];let r,o,s,a;for(const u of e){if(!r&&!u.isOpen){const e=u.xmlTextNode.textContent;throw new n.MissingStartDelimiterError(e)}if(r&&u.isOpen){const e=o.xmlTextNode.textContent;throw new n.MissingCloseDelimiterError(e)}!r&&u.isOpen&&(r=new i.Tag,o=u),r&&!u.isOpen&&(s===o.xmlTextNode&&(o.index-=a),s===u.xmlTextNode&&(u.index-=a),s=u.xmlTextNode,a=this.normalizeTagNodes(o,u),r.xmlTextNode=o.xmlTextNode,this.processTag(r),t.push(r),r=null,o=null)}return t}normalizeTagNodes(e,t){let r=0,n=e.xmlTextNode,i=t.xmlTextNode;const o=n===i;return e.index>0&&(r+=e.index,this.docParser.splitTextNode(n,e.index,!0)),t.index<i.textContent.length-1&&(r+=t.index+1,i=this.docParser.splitTextNode(i,t.index+1,!0),o&&(n=i)),o||(this.docParser.joinTextNodesRange(n,i),i=n),e.xmlTextNode=n,t.xmlTextNode=i,r}processTag(e){e.rawText=e.xmlTextNode.textContent;for(const t of this.tagPrefixes){const r=`^[${this.startDelimiter}](\\s*?)${t.prefix}(.*?)[${this.endDelimiter}]`,n=new RegExp(r,"gmi").exec(e.rawText);if(n&&n.length){e.name=n[2],e.type=t.tagType,e.disposition=t.tagDisposition;break}}if(!e.name)throw new n.UnknownPrefixError(e.rawText)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateCompiler=void 0;var n=r(1),i=r(5);t.TemplateCompiler=class{constructor(e,t,r){this.delimiterSearcher=e,this.tagParser=t,this.plugins=r}compile(e,t,r){const n=this.parseTags(e);this.doTagReplacements(n,t,r)}parseTags(e){const t=this.delimiterSearcher.findDelimiters(e);return this.tagParser.parse(t)}doTagReplacements(e,t,r){for(let n=0;n<e.length;n++){const o=e[n];if(t.path.push(o.name),o.disposition===i.TagDisposition.SelfClosed){for(const e of this.plugins)if(e.prefixes.some(e=>e.tagType===o.type)){e.simpleTagReplacements(o,t,r);break}}else if(o.disposition===i.TagDisposition.Open){const i=this.findCloseTagIndex(n,o,e),s=e.slice(n,i+1);n=i;for(const e of this.plugins)if(e.prefixes.some(e=>e.tagType===o.type)){e.containerTagReplacements(s,t,r);break}}t.path.pop()}}findCloseTagIndex(e,t,r){let o=e;for(;o<r.length;o++){const e=r[o];if(e.name===t.name&&e.type===t.type&&e.disposition===i.TagDisposition.Close)break}if(o===r.length)throw new n.UnclosedTagError(t.name);return o}}},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createDefaultPlugins=function(){return[new n.LoopPlugin,new i.RawXmlPlugin,new o.TextPlugin]};var n=r(9),i=r(10),o=r(11)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(43);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var i=r(44);Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=r(45);Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var s=r(46);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})})},function(e,t,r){"use strict"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopListStrategy=void 0;var n=r(0);t.LoopListStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return this.utilities.docxParser.isListParagraph(r)}splitBefore(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopParagraphStrategy=void 0;var n=r(0);t.LoopParagraphStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){return!0}splitBefore(e,t){let r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode),i=this.utilities.docxParser.containingParagraphNode(t.xmlTextNode);const o=r===i,s=r.parentNode,a=s.childNodes.indexOf(r),u=o?a:s.childNodes.indexOf(i);let l=n.XmlNode.splitByChild(r,e.xmlTextNode,!0);r=l[0];const c=l[1];o&&(i=c);const f=(l=n.XmlNode.splitByChild(i,t.xmlTextNode,!0))[0];let d;if(i=l[1],n.XmlNode.removeChild(s,a+1),o||n.XmlNode.removeChild(s,u),c.parentNode=null,f.parentNode=null,o)this.utilities.docxParser.joinParagraphs(c,f),d=[c];else{const e=n.XmlNode.removeSiblings(r,i);d=[c].concat(e).concat(f)}return{firstNode:r,nodesToRepeat:d,lastNode:i}}mergeBack(e,t,r){let i=t;for(const t of e){this.utilities.docxParser.joinParagraphs(i,t[0]);for(let e=1;e<t.length;e++)n.XmlNode.insertBefore(t[e],r),i=t[e]}this.utilities.docxParser.joinParagraphs(i,r),n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoopTableStrategy=void 0;var n=r(0);t.LoopTableStrategy=class{constructor(){var e,t,r;r=void 0,(t="utilities")in(e=this)?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}setUtilities(e){this.utilities=e}isApplicable(e,t){const r=this.utilities.docxParser.containingParagraphNode(e.xmlTextNode);return!!r.parentNode&&this.utilities.docxParser.isTableCellNode(r.parentNode)}splitBefore(e,t){const r=this.utilities.docxParser.containingTableRowNode(e.xmlTextNode),i=this.utilities.docxParser.containingTableRowNode(t.xmlTextNode),o=n.XmlNode.siblingsInRange(r,i);return n.XmlNode.remove(e.xmlTextNode),n.XmlNode.remove(t.xmlTextNode),{firstNode:r,nodesToRepeat:o,lastNode:i}}mergeBack(e,t,r){for(const t of e)for(const e of t)n.XmlNode.insertBefore(e,r);n.XmlNode.remove(t),t!==r&&n.XmlNode.remove(r)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TemplateHandler=void 0;var n=r(48),i=r(2),o=r(6),s=r(1),a=r(49),u=r(13),l=r(3),c=r(0),f=r(14);function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}t.TemplateHandler=class{constructor(e){d(this,"docxParser",new o.DocxParser),d(this,"xmlParser",new f.XmlParser),d(this,"compiler",void 0),d(this,"options",void 0),this.options=new u.TemplateHandlerOptions(e);const t=new i.DelimiterSearcher;t.startDelimiter=this.options.delimiters.start,t.endDelimiter=this.options.delimiters.end,t.maxXmlDepth=this.options.maxXmlDepth;const r=this.options.plugins.map(e=>e.prefixes).reduce((e,t)=>e.concat(t),[]),n=new i.TagParser(r,this.docxParser);n.startDelimiter=this.options.delimiters.start,n.endDelimiter=this.options.delimiters.end,this.compiler=new i.TemplateCompiler(t,n,this.options.plugins),this.options.plugins.forEach(e=>{e.setUtilities({xmlParser:this.xmlParser,docxParser:this.docxParser,compiler:this.compiler})})}async process(e,t){const r=await this.loadDocx(e),n=await this.parseContentDocuments(r),o=new i.ScopeData(t),s={zipFile:r,currentFilePath:null};for(const e of Object.keys(n))s.currentFilePath=e,this.compiler.compile(n[e],o,s);for(const e of Object.keys(n)){const t=n[e],i=this.xmlParser.serialize(t);r.file(e,i,{createFolders:!0})}const a=l.Binary.toJsZipOutputType(e);return r.generateAsync({type:a})}async parseTags(e){const t=await this.loadDocx(e),r=await this.parseContentDocuments(t),n=[];for(const e of Object.keys(r)){const t=this.compiler.parseTags(r[e]);(0,l.pushMany)(n,t)}return n}async getText(e){return(await this.getDomRoot(e)).textContent}async getXml(e){const t=await this.getDomRoot(e);return c.XmlNode.fromDomNode(t)}async loadDocx(e){let t;try{t=await n.loadAsync(e)}catch(e){throw new s.MalformedFileError("docx")}const r=a.FileTypeHelper.getFileType(t);if(r!==a.FileType.Docx)throw new s.UnsupportedFileTypeError(r);return t}async parseContentDocuments(e){const t=this.docxParser.contentFilePaths(e).filter(t=>e.files[t]),r={};for(const n of t){const t=await e.files[n].async("text");r[n]=this.xmlParser.parse(t)}return r}async getDomRoot(e){const t=await this.loadDocx(e),r=this.docxParser.mainFilePath(t),n=await t.files[r].async("text");return this.xmlParser.domParse(n).documentElement}}},function(e,t){e.exports=require("jszip")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileTypeHelper=t.FileType=void 0;var n=r(1);let i;t.FileType=i,function(e){e.Docx="docx",e.Pptx="pptx",e.Odt="odt"}(i||(t.FileType=i={}));class o{static getFileType(e){if(o.isDocx(e))return i.Docx;if(o.isPptx(e))return i.Pptx;if(o.isOdt(e))return i.Odt;throw new n.UnidentifiedFileTypeError}static isDocx(e){return!(!e.files["word/document.xml"]&&!e.files["word/document2.xml"])}static isPptx(e){return!!e.files["ppt/presentation.xml"]}static isOdt(e){return!!e.files.mimetype}}t.FileTypeHelper=o},function(e,t){e.exports=require("xmldom")}])});
{
"name": "easy-template-x",
"version": "0.5.1",
"version": "0.5.2",
"description": "Generate docx documents from templates, in Node or in the browser.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -9,3 +9,2 @@ # easy-template-x

[![dependencies](https://david-dm.org/alonrbar/easy-template-x.svg)](https://github.com/alonrbar/easy-template-x)
[![dependencies](https://david-dm.org/alonrbar/easy-template-x/dev-status.svg)](https://github.com/alonrbar/easy-template-x)

@@ -12,0 +11,0 @@ - [Prior art and motivation](#prior-art-and-motivation)

@@ -19,4 +19,19 @@ import * as JSZip from 'jszip';

//
// HACK: Fixes https://github.com/alonrbar/easy-template-x/issues/5
//
// The issue happens due to some library on the way (maybe babel?)
// replacing Node's Buffer with this implementation:
// https://www.npmjs.com/package/buffer
// The custom implementation actually uses an Uint8Array and therefor
// fails all the above `if` clauses.
//
// I'm assuming we'll be able to remove this if we create an esnext, non-compiled
// version with rollup or something of that sort.
//
if (typeof Uint8Array !== 'undefined' && binary instanceof Uint8Array)
return 'nodebuffer';
throw new Error(`Binary type '${(binary as any).constructor.name}' is not supported.`);
}
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc