docxtemplater
Version:
Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js, the Browser and the command line
1 lines • 86.4 kB
JavaScript
!function(){var e={673:function(e){e.exports={XMLSerializer:window.XMLSerializer,DOMParser:window.DOMParser,XMLDocument:window.XMLDocument}},891:function(e){e.exports=function(e,t,r){for(var n={},o=0,i=e.length;o<i;o++){var a=e[o],s=a.getAttribute("ContentType"),u=a.getAttribute("PartName").substr(1);n[u]=s}for(var l=function(){var e=t[c],o=e.getAttribute("ContentType"),i=e.getAttribute("Extension");r.file(/./).map((function(e){var t=e.name;t.slice(t.length-i.length)!==i||n[t]||"[Content_Types].xml"===t||(n[t]=o)}))},c=0,p=t.length;c<p;c++)l();return n}},356:function(e){e.exports={settingsContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",coreContentType:"application/vnd.openxmlformats-package.core-properties+xml",appContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml",customContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml"}},207:function(e,t,r){function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var o=r(673),i=o.DOMParser,a=o.XMLSerializer,s=r(946).throwXmlTagNotFound,u=r(320),l=u.last,c=u.first,p={},f=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"]],h=f.map((function(e){var t,r,o=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1];return{rstart:new RegExp(a,"g"),rend:new RegExp(i,"g"),start:a,end:i}})),d=new RegExp(String.fromCharCode(160),"g");function y(e,t){return e==="</"+t+">"}function v(e,t){return 0===e.indexOf("<"+t)&&-1!==[">"," ","/"].indexOf(e[t.length+1])}function m(e,t,r){"string"==typeof t&&(t=[t]);for(var n=1,o=r,i=e.length;o<i;o++)for(var a=e[o],s=0,u=t.length;s<u;s++){var l=t[s];if(y(a.value,l)&&n--,v(a.value,l)&&n++,0===n)return o}return null}function g(e,t,r){"string"==typeof t&&(t=[t]);for(var n=1,o=r;o>=0;o--)for(var i=e[o],a=0,s=t.length;a<s;a++){var u=t[a];if(v(i.value,u)&&n--,y(i.value,u)&&n++,0===n)return o}return null}function b(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&"start"===o}function w(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&"end"===o}var x=/[\x00-\x08\x0B\x0C\x0E-\x1F]/;e.exports={endsWith:function(e,t){return-1!==e.indexOf(t,e.length-t.length)},startsWith:function(e,t){return e.substring(0,t.length)===t},isContent:function(e){var t=e.type,r=e.position;return"placeholder"===t||"content"===t&&"insidetag"===r},isParagraphStart:function(e){return b("w:p",e)||b("a:p",e)},isParagraphEnd:function(e){return w("w:p",e)||w("a:p",e)},isTagStart:function(e,t){var r=t.type,n=t.tag,o=t.position;return"tag"===r&&n===e&&("start"===o||"selfclosing"===o)},isTagEnd:w,isTextStart:function(e){var t=e.type,r=e.position,n=e.text;return"tag"===t&&"start"===r&&n},isTextEnd:function(e){var t=e.type,r=e.position,n=e.text;return"tag"===t&&"end"===r&&n},isStarting:v,isEnding:y,isModule:function(e,t){var r=e.module,n=e.type;return t instanceof Array||(t=[t]),"placeholder"===n&&-1!==t.indexOf(r)},uniq:function(e){for(var t={},r=[],n=0,o=e.length;n<o;++n)t[e[n]]||(t[e[n]]=!0,r.push(e[n]));return r},getDuplicates:function(e){for(var t=[],r={},n=[],o=0,i=e.length;o<i;++o)r[e[o]]?t.push(e[o]):(r[e[o]]=!0,n.push(e[o]));return t},chunkBy:function(e,t){return e.reduce((function(e,r){var n=l(e),o=t(r);return"start"===o?e.push([r]):"end"===o?(n.push(r),e.push([])):n.push(r),e}),[[]]).filter((function(e){return e.length>0}))},last:l,first:c,xml2str:function(e){return(new a).serializeToString(e).replace(/xmlns(:[a-z0-9]+)?="" ?/g,"")},str2xml:function(e){return 65279===e.charCodeAt(0)&&(e=e.substr(1)),(new i).parseFromString(e,"text/xml")},getRightOrNull:m,getRight:function(e,t,r){var n=m(e,t,r);if(null!==n)return n;s({position:"right",element:t,parsed:e,index:r})},getLeftOrNull:g,getLeft:function(e,t,r){var n=g(e,t,r);if(null!==n)return n;s({position:"left",element:t,parsed:e,index:r})},pregMatchAll:function(e,t){for(var r,n=[];null!=(r=e.exec(t));)n.push({array:r,offset:r.index});return n},convertSpaces:function(e){return e.replace(d," ")},charMapRegexes:h,hasCorruptCharacters:function(e){return x.test(e)},defaults:{errorLogging:"json",paragraphLoop:!1,nullGetter:function(e){return e.module?"":"undefined"},xmlFileNames:["[Content_Types].xml"],parser:function(e){return{get:function(t){return"."===e?t:t?t[e]:t}}},linebreaks:!1,fileTypeConfig:null,delimiters:{start:"{",end:"}"},syntax:{changeDelimiterPrefix:"="}},wordToUtf8:function(e){for(var t,r=h.length-1;r>=0;r--)t=h[r],e=e.replace(t.rstart,t.end);return e},utf8ToWord:function(e){var t;e=e.toString();for(var r=0,n=h.length;r<n;r++)t=h[r],e=e.replace(t.rend,t.start);return e},concatArrays:function(e){for(var t=[],r=0;r<e.length;r++)for(var n=e[r],o=0,i=n.length;o<i;o++)t.push(n[o]);return t},invertMap:function(e){return Object.keys(e).reduce((function(t,r){var n=e[r];return t[n]=t[n]||[],t[n].push(r),t}),{})},charMap:f,getSingleAttribute:function(e,t){var r=e.indexOf(" ".concat(t,'="'));if(-1===r)return null;var n=e.substr(r).search(/["']/)+r,o=e.substr(n+1).search(/["']/)+n;return e.substr(n+1,o-n)},setSingleAttribute:function(e,t,r){var n;if(p[t]?n=p[t]:(n=new RegExp("(<.* ".concat(t,'=")([^"]*)(".*)$')),p[t]=n),n.test(e))return e.replace(n,"$1".concat(r,"$3"));var o=e.lastIndexOf("/>");return-1===o&&(o=e.lastIndexOf(">")),e.substr(0,o)+" ".concat(t,'="').concat(r,'"')+e.substr(o)},isWhiteSpace:function(e){return/^[ \n\r\t]+$/.test(e)},stableSort:function(e,t){return e.map((function(e,t){return{item:e,index:t}})).sort((function(e,r){return t(e.item,r.item)||e.index-r.index})).map((function(e){return e.item}))}}},807:function(e,t,r){var n=["modules"];function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function u(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var l=r(207);l.traits=r(536),l.moduleWrapper=r(899);var c=r(779),p=r(263),f=r(438),h=r(946),d=h.throwMultiError,y=h.throwResolveBeforeCompile,v=h.throwRenderInvalidTemplate,m=h.throwRenderTwice,g=h.XTInternalError,b=h.throwFileTypeNotIdentified,w=h.throwFileTypeNotHandled,x=h.throwApiVersionError,T=r(460),P=r(891),O=l.defaults,S=l.str2xml,E=l.xml2str,j=l.moduleWrapper,k=l.concatArrays,C=l.uniq,I=l.getDuplicates,A=l.stableSort,M=[3,41,0];function L(e){e.modules=e.modules.filter((function(t){if(!t.supportedFileTypes)return!0;if(!Array.isArray(t.supportedFileTypes))throw new Error("The supportedFileTypes field of the module must be an array");var r=t.supportedFileTypes.includes(e.fileType);return r||t.on("detached"),r}))}function _(e){var t=e.compiled;e.errors=k(Object.keys(t).map((function(e){return t[e].allErrors}))),0!==e.errors.length&&(e.options.errorLogging&&T(e.errors,e.options.errorLogging),d(e.errors))}var R=function(){function e(t){var r=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.modules,a=void 0===i?[]:i,s=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(o,n);if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.targets=[],this.rendered=!1,this.scopeManagers={},this.compiled={},this.modules=[f()],this.setOptions(s),arguments.length>0){if(!t||!t.files||"function"!=typeof t.file)throw new Error("The first argument of docxtemplater's constructor must be a valid zip file (jszip v2 or pizzip v3)");if(!Array.isArray(a))throw new Error("The modules argument of docxtemplater's constructor must be an array");a.forEach((function(e){r.attachModule(e)})),this.loadZip(t),this.compile(),this.v4Constructor=!0}}return t=e,r=[{key:"verifyApiVersion",value:function(e){return 3!==(e=e.split(".").map((function(e){return parseInt(e,10)}))).length&&x("neededVersion is not a valid version",{neededVersion:e,explanation:"the neededVersion must be an array of length 3"}),e[0]!==M[0]&&x("The major api version do not match, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:M,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(M.join("."))}),e[1]>M[1]&&x("The minor api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:M,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(M.join("."))}),e[1]===M[1]&&e[2]>M[2]&&x("The patch api version is not uptodate, you probably have to update docxtemplater with npm install --save docxtemplater",{neededVersion:e,currentModuleApiVersion:M,explanation:"moduleAPIVersionMismatch : needed=".concat(e.join("."),", current=").concat(M.join("."))}),!0}},{key:"setModules",value:function(e){this.modules.forEach((function(t){t.set(e)}))}},{key:"sendEvent",value:function(e){this.modules.forEach((function(t){t.on(e)}))}},{key:"attachModule",value:function(e){if(this.v4Constructor)throw new g("attachModule() should not be called manually when using the v4 constructor");var t=a(e);if("function"===t)throw new g("Cannot attach a class/function as a module. Most probably you forgot to instantiate the module by using `new` on the module.");if(!e||"object"!==t)throw new g("Cannot attachModule with a falsy value");if(e.requiredAPIVersion&&this.verifyApiVersion(e.requiredAPIVersion),!0===e.attached){if("function"!=typeof e.clone)throw new Error('Cannot attach a module that was already attached : "'.concat(e.name,'". The most likely cause is that you are instantiating the module at the root level, and using it for multiple instances of Docxtemplater'));e=e.clone()}e.attached=!0;var r=j(e);return this.modules.push(r),r.on("attached"),this.fileType&&L(this),this}},{key:"setOptions",value:function(e){var t=this;if(this.v4Constructor)throw new Error("setOptions() should not be called manually when using the v4 constructor");if(!e)throw new Error("setOptions should be called with an object as first parameter");return this.options={},Object.keys(O).forEach((function(r){var n=O[r];t.options[r]=null!=e[r]?e[r]:t[r]||n,t[r]=t.options[r]})),this.delimiters.start=l.utf8ToWord(this.delimiters.start),this.delimiters.end=l.utf8ToWord(this.delimiters.end),this}},{key:"loadZip",value:function(e){if(this.v4Constructor)throw new Error("loadZip() should not be called manually when using the v4 constructor");if(e.loadAsync)throw new g("Docxtemplater doesn't handle JSZip version >=3, please use pizzip");return this.zip=e,this.updateFileTypeConfig(),this.modules=k([this.fileTypeConfig.baseModules.map((function(e){return e()})),this.modules]),L(this),this}},{key:"precompileFile",value:function(e){var t=this.createTemplateClass(e);t.preparse(),this.compiled[e]=t}},{key:"compileFile",value:function(e){this.compiled[e].parse()}},{key:"getScopeManager",value:function(e,t,r){return this.scopeManagers[e]||(this.scopeManagers[e]=c({tags:r,parser:this.parser,cachedParsers:t.cachedParsers})),this.scopeManagers[e]}},{key:"resolveData",value:function(e){var t=this,r=[];return Object.keys(this.compiled).length||y(),Promise.resolve(e).then((function(e){return t.setData(e),t.setModules({data:t.data,Lexer:p}),t.mapper=t.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{}),Promise.all(Object.keys(t.mapper).map((function(e){var n=t.mapper[e],o=n.from,i=n.data;return Promise.resolve(i).then((function(n){var i=t.compiled[o];return i.filePath=e,i.scopeManager=t.getScopeManager(e,i,n),i.resolveTags(n).then((function(e){return i.scopeManager.finishedResolving=!0,e}),(function(e){Array.prototype.push.apply(r,e)}))}))}))).then((function(e){return 0!==r.length&&(t.options.errorLogging&&T(r,t.options.errorLogging),d(r)),k(e)}))}))}},{key:"reorderModules",value:function(){this.modules=A(this.modules,(function(e,t){return(t.priority||0)-(e.priority||0)}))}},{key:"throwIfDuplicateModules",value:function(){var e=I(this.modules.map((function(e){return e.name})));if(e.length>0)throw new g('Detected duplicate module "'.concat(e[0],'"'))}},{key:"compile",value:function(){var e=this;return this.updateFileTypeConfig(),this.throwIfDuplicateModules(),this.reorderModules(),Object.keys(this.compiled).length||(this.options=this.modules.reduce((function(t,r){return r.optionsTransformer(t,e)}),this.options),this.options.xmlFileNames=C(this.options.xmlFileNames),this.xmlDocuments=this.options.xmlFileNames.reduce((function(t,r){var n=e.zip.files[r].asText();return t[r]=S(n),t}),{}),this.setModules({zip:this.zip,xmlDocuments:this.xmlDocuments}),this.getTemplatedFiles(),this.templatedFiles.forEach((function(t){null!=e.zip.files[t]&&e.precompileFile(t)})),this.templatedFiles.forEach((function(t){null!=e.zip.files[t]&&e.compileFile(t)})),this.setModules({compiled:this.compiled}),_(this)),this}},{key:"getRelsTypes",value:function(){for(var e=this.zip.files["_rels/.rels"],t=e?S(e.asText()):null,r=t?t.getElementsByTagName("Relationship"):[],n={},o=0,i=r.length;o<i;o++){var a=r[o];n[a.getAttribute("Target")]=a.getAttribute("Type")}return n}},{key:"getContentTypes",value:function(){var e=this.zip.files["[Content_Types].xml"],t=e?S(e.asText()):null;return{overrides:t?t.getElementsByTagName("Override"):null,defaults:t?t.getElementsByTagName("Default"):null,contentTypes:e,contentTypeXml:t}}},{key:"updateFileTypeConfig",value:function(){var t,r=this;this.zip.files.mimetype&&(t="odt"),this.relsTypes=this.getRelsTypes();var n=this.getContentTypes(),o=n.overrides,i=n.defaults,a=n.contentTypes,s=n.contentTypeXml;return s&&(this.filesContentTypes=P(o,i,this.zip),this.invertedContentTypes=l.invertMap(this.filesContentTypes),this.setModules({contentTypes:this.contentTypes,invertedContentTypes:this.invertedContentTypes})),this.modules.forEach((function(e){t=e.getFileType({zip:r.zip,contentTypes:a,contentTypeXml:s,overrides:o,defaults:i,doc:r})||t})),"odt"===t&&w(t),t||b(this.zip),this.fileType=t,L(this),this.fileTypeConfig=this.options.fileTypeConfig||this.fileTypeConfig||e.FileTypeConfig[this.fileType](),this}},{key:"renderAsync",value:function(e){var t=this;return this.resolveData(e).then((function(){return t.render()}))}},{key:"render",value:function(e){var t=this;this.rendered&&m(),this.rendered=!0,this.compile(),this.errors.length>0&&v(),e&&this.setData(e),this.setModules({data:this.data,Lexer:p}),this.mapper=this.mapper||this.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{});var r=[];return Object.keys(this.mapper).forEach((function(e){var n=t.mapper[e],o=n.from,i=n.data,a=t.compiled[o];a.scopeManager=t.getScopeManager(e,a,i),a.render(e),r.push([e,a.content,a]),delete a.content})),r.forEach((function(e){var r=o(e,3),n=r[1],i=r[2];t.modules.forEach((function(t){if(t.preZip){var r=t.preZip(n,i);"string"==typeof r&&(e[1]=r)}}))})),r.forEach((function(e){var r=o(e,2),n=r[0],i=r[1];t.zip.file(n,i,{createFolders:!0})})),_(this),this.sendEvent("syncing-zip"),this.syncZip(),this.sendEvent("synced-zip"),this}},{key:"syncZip",value:function(){var e=this;Object.keys(this.xmlDocuments).forEach((function(t){e.zip.remove(t);var r=E(e.xmlDocuments[t]);return e.zip.file(t,r,{createFolders:!0})}))}},{key:"setData",value:function(e){return this.data=e,this}},{key:"getZip",value:function(){return this.zip}},{key:"createTemplateClass",value:function(e){var t=this.zip.files[e].asText();return this.createTemplateClassFromContent(t,e)}},{key:"createTemplateClassFromContent",value:function(t,r){var n=this,o={filePath:r,contentType:this.filesContentTypes[r],relsType:this.relsTypes[r]};return Object.keys(O).concat(["filesContentTypes","fileTypeConfig","fileType","modules"]).forEach((function(e){o[e]=n[e]})),new e.XmlTemplater(t,o)}},{key:"getFullText",value:function(e){return this.createTemplateClass(e||this.fileTypeConfig.textPath(this)).getFullText()}},{key:"getTemplatedFiles",value:function(){var e=this;return this.templatedFiles=this.fileTypeConfig.getTemplatedFiles(this.zip),this.targets.forEach((function(t){e.templatedFiles.push(t)})),this.templatedFiles=C(this.templatedFiles),this.templatedFiles}}],r&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();R.DocUtils=l,R.Errors=r(946),R.XmlTemplater=r(245),R.FileTypeConfig=r(271),R.XmlMatcher=r(367),e.exports=R,e.exports.default=R},460:function(e){function t(e,t){return t instanceof Error?Object.getOwnPropertyNames(t).concat("stack").reduce((function(e,r){return e[r]=t[r],"stack"===r&&(e[r]=t[r].toString()),e}),{}):t}e.exports=function(e,r){if(console.log(JSON.stringify({error:e},t,"json"===r?2:null)),e.properties&&e.properties.errors instanceof Array){var n=e.properties.errors.map((function(e){return e.properties.explanation})).join("\n");console.log("errorMessages",n)}}},946:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(320),s=a.last,u=a.first;function l(e){this.name="GenericError",this.message=e,this.stack=new Error(e).stack}function c(e){this.name="TemplateError",this.message=e,this.stack=new Error(e).stack}function p(e){this.name="RenderingError",this.message=e,this.stack=new Error(e).stack}function f(e){this.name="ScopeParserError",this.message=e,this.stack=new Error(e).stack}function h(e){this.name="InternalError",this.properties={explanation:"InternalError"},this.message=e,this.stack=new Error(e).stack}function d(e){this.name="APIVersionError",this.properties={explanation:"APIVersionError"},this.message=e,this.stack=new Error(e).stack}l.prototype=Error.prototype,c.prototype=new l,p.prototype=new l,f.prototype=new l,h.prototype=new l,d.prototype=new l,e.exports={XTError:l,XTTemplateError:c,XTInternalError:h,XTScopeParserError:f,XTAPIVersionError:d,RenderingError:p,XTRenderingError:p,getClosingTagNotMatchOpeningTag:function(e){var t=e.tags,r=new c("Closing tag does not match opening tag");return r.properties={id:"closing_tag_does_not_match_opening_tag",explanation:'The tag "'.concat(t[0].value,'" is closed by the tag "').concat(t[1].value,'"'),openingtag:u(t).value,offset:[u(t).offset,s(t).offset],closingtag:s(t).value},r},getLoopPositionProducesInvalidXMLError:function(e){var t=e.tag,r=e.offset,n=new c('The position of the loop tags "'.concat(t,'" would produce invalid XML'));return n.properties={xtag:t,id:"loop_position_invalid",explanation:'The tags "'.concat(t,'" are misplaced in the document, for example one of them is in a table and the other one outside the table'),offset:r},n},getScopeCompilationError:function(e){var t=e.tag,r=e.rootError,n=e.offset,o=new f("Scope parser compilation failed");return o.properties={id:"scopeparser_compilation_failed",offset:n,xtag:t,explanation:'The scope parser for the tag "'.concat(t,'" failed to compile'),rootError:r},o},getScopeParserExecutionError:function(e){var t=e.tag,r=e.scope,n=e.error,o=e.offset,i=new f("Scope parser execution failed");return i.properties={id:"scopeparser_execution_failed",explanation:"The scope parser for the tag ".concat(t," failed to execute"),scope:r,offset:o,xtag:t,rootError:n},i},getUnclosedTagException:function(e){var t=new c("Unclosed tag");return t.properties={xtag:u(e.xtag.split(" ")).substr(1),id:"unclosed_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" is unclosed')},t},getUnopenedTagException:function(e){var t=new c("Unopened tag");return t.properties={xtag:s(e.xtag.split(" ")),id:"unopened_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" is unopened')},t},getUnmatchedLoopException:function(e){var t=e.location,r=e.offset,n=e.square,o="start"===t?"unclosed":"unopened",i=new c("".concat("start"===t?"Unclosed":"Unopened"," loop")),a=e.value;return i.properties={id:"".concat(o,"_loop"),explanation:'The loop with tag "'.concat(a,'" is ').concat(o),xtag:a,offset:r},n&&(i.properties.square=n),i},getDuplicateCloseTagException:function(e){var t=new c("Duplicate close tag, expected one close tag");return t.properties={xtag:u(e.xtag.split(" ")),id:"duplicate_close_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag ending with "'.concat(e.xtag.substr(0,10),'" has duplicate close tags')},t},getDuplicateOpenTagException:function(e){var t=new c("Duplicate open tag, expected one open tag");return t.properties={xtag:u(e.xtag.split(" ")),id:"duplicate_open_tag",context:e.xtag,offset:e.offset,lIndex:e.lIndex,explanation:'The tag beginning with "'.concat(e.xtag.substr(0,10),'" has duplicate open tags')},t},getCorruptCharactersException:function(e){var t=e.tag,r=e.value,n=e.offset,o=new p("There are some XML corrupt characters");return o.properties={id:"invalid_xml_characters",xtag:t,value:r,offset:n,explanation:"There are some corrupt characters for the field ".concat(t)},o},getInvalidRawXMLValueException:function(e){var t=e.tag,r=e.value,n=e.offset,o=new p("Non string values are not allowed for rawXML tags");return o.properties={id:"invalid_raw_xml_value",xtag:t,value:r,offset:n,explanation:"The value of the raw tag : '".concat(t,"' is not a string")},o},getUnbalancedLoopException:function(e,t){var r=new c("Unbalanced loop tag"),n=t[0].part.value,o=t[1].part.value,i=e[0].part.value,a=e[1].part.value;return r.properties={id:"unbalanced_loop_tags",explanation:"Unbalanced loop tags {#".concat(n,"}{/").concat(o,"}{#").concat(i,"}{/").concat(a,"}"),offset:[t[0].part.offset,e[1].part.offset],lastPair:{left:t[0].part.value,right:t[1].part.value},pair:{left:e[0].part.value,right:e[1].part.value}},r},throwApiVersionError:function(e,t){var r=new d(e);throw r.properties=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:"api_version_error"},t),r},throwFileTypeNotHandled:function(e){var t=new h('The filetype "'.concat(e,'" is not handled by docxtemplater'));throw t.properties={id:"filetype_not_handled",explanation:'The file you are trying to generate is of type "'.concat(e,'", but only docx and pptx formats are handled'),fileType:e},t},throwFileTypeNotIdentified:function(e){var t,r=Object.keys(e.files).slice(0,10);t=0===r.length?"Empty zip file":"Zip file contains : ".concat(r.join(","));var n=new h("The filetype for this file could not be identified, is this file corrupted ? ".concat(t));throw n.properties={id:"filetype_not_identified",explanation:"The filetype for this file could not be identified, is this file corrupted ? ".concat(t)},n},throwMalformedXml:function(){var e=new h("Malformed xml");throw e.properties={explanation:"The template contains malformed xml",id:"malformed_xml"},e},throwMultiError:function(e){var t=new c("Multi error");throw t.properties={errors:e,id:"multi_error",explanation:"The template has multiple errors"},t},throwExpandNotFound:function(e){var t=e.part,r=t.value,n=t.offset,o=e.id,i=void 0===o?"raw_tag_outerxml_invalid":o,a=e.message,s=void 0===a?"Raw tag not in paragraph":a,u=e.part,l=e.explanation,p=void 0===l?'The tag "'.concat(r,'" is not inside a paragraph'):l;"function"==typeof p&&(p=p(u));var f=new c(s);throw f.properties={id:i,explanation:p,rootError:e.rootError,xtag:r,offset:n,postparsed:e.postparsed,expandTo:e.expandTo,index:e.index},f},throwRawTagShouldBeOnlyTextInParagraph:function(e){var t=new c("Raw tag should be the only text in paragraph"),r=e.part.value;throw t.properties={id:"raw_xml_tag_should_be_only_text_in_paragraph",explanation:'The raw tag "'.concat(r,'" should be the only text in this paragraph. This means that this tag should not be surrounded by any text or spaces.'),xtag:r,offset:e.part.offset,paragraphParts:e.paragraphParts},t},throwUnimplementedTagType:function(e,t){var r='Unimplemented tag type "'.concat(e.type,'"');e.module&&(r+=' "'.concat(e.module,'"'));var n=new c(r);throw n.properties={part:e,index:t,id:"unimplemented_tag_type"},n},throwXmlTagNotFound:function(e){var t=new c('No tag "'.concat(e.element,'" was found at the ').concat(e.position)),r=e.parsed[e.index];throw t.properties={id:"no_xml_tag_found_at_".concat(e.position),explanation:'No tag "'.concat(e.element,'" was found at the ').concat(e.position),offset:r.offset,part:r,parsed:e.parsed,index:e.index,element:e.element},t},throwXmlInvalid:function(e,t){var r=new c("An XML file has invalid xml");throw r.properties={id:"file_has_invalid_xml",content:e,offset:t,explanation:"The docx contains invalid XML, it is most likely corrupt"},r},throwResolveBeforeCompile:function(){var e=new h("You must run `.compile()` before running `.resolveData()`");throw e.properties={id:"resolve_before_compile",explanation:"You must run `.compile()` before running `.resolveData()`"},e},throwRenderInvalidTemplate:function(){var e=new h("You should not call .render on a document that had compilation errors");throw e.properties={id:"render_on_invalid_template",explanation:"You should not call .render on a document that had compilation errors"},e},throwRenderTwice:function(){var e=new h("You should not call .render twice on the same docxtemplater instance");throw e.properties={id:"render_twice",explanation:"You should not call .render twice on the same docxtemplater instance"},e}}},271:function(e,t,r){var n=r(885),o=r(522),i=r(60),a=r(201),s=r(307);e.exports={docx:function(){return{getTemplatedFiles:function(){return[]},textPath:function(e){return e.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","cp:contentStatus","w:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["w:proofState","w:tc","w:tr","w:tbl","w:body","w:document","w:p","w:r","w:br","w:rPr","w:pPr","w:spacing","w:sdtContent","w:sdt","w:drawing","w:sectPr","w:type","w:headerReference","w:footerReference","w:bookmarkStart","w:bookmarkEnd","w:commentRangeStart","w:commentRangeEnd","w:commentReference"],droppedTagsInsidePlaceholder:["w:p","w:br","w:bookmarkStart","w:bookmarkEnd"],expandTags:[{contains:"w:tc",expand:"w:tr"}],onParagraphLoop:[{contains:"w:p",expand:"w:p",onlyTextInTag:!0}],tagRawXml:"w:p",baseModules:[n,o,a,i,s],tagShouldContain:[{tag:"w:sdtContent",shouldContain:["w:p","w:r","w:commentRangeStart","w:sdt"],value:"<w:p></w:p>"},{tag:"w:tc",shouldContain:["w:p"],value:"<w:p></w:p>"},{tag:"w:tr",shouldContain:["w:tc"],drop:!0},{tag:"w:tbl",shouldContain:["w:tr"],drop:!0}]}},pptx:function(){return{getTemplatedFiles:function(){return[]},textPath:function(e){return e.textTarget},tagsXmlTextArray:["Company","HyperlinkBase","Manager","cp:category","cp:keywords","dc:creator","dc:description","dc:subject","dc:title","a:t","m:t","vt:lpstr","vt:lpwstr"],tagsXmlLexedArray:["p:sp","a:tc","a:tr","a:tbl","a:graphicData","a:p","a:r","a:rPr","p:txBody","a:txBody","a:off","a:ext","p:graphicFrame","p:xfrm","a16:rowId","a:endParaRPr"],droppedTagsInsidePlaceholder:["a:p","a:endParaRPr"],expandTags:[{contains:"a:tc",expand:"a:tr"}],onParagraphLoop:[{contains:"a:p",expand:"a:p",onlyTextInTag:!0}],tagRawXml:"p:sp",baseModules:[n,a,i,s],tagShouldContain:[{tag:"a:tbl",shouldContain:["a:tr"],dropParent:"p:graphicFrame"},{tag:"p:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"},{tag:"a:txBody",shouldContain:["a:p"],value:"<a:p></a:p>"}]}}}},322:function(e){var t=["application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","application/vnd.ms-word.document.macroEnabled.main+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml","application/vnd.ms-word.template.macroEnabledTemplate.main+xml"],r={main:t,docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"].concat(t,["application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"]),pptx:["application/vnd.openxmlformats-officedocument.presentationml.slide+xml","application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml","application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml","application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"]};e.exports=r},830:function(e){e.exports=function(e,t){if(null==e.lIndex)return null;var r=t.scopeManager.scopePathItem;return e.parentPart&&(r=r.slice(0,r.length-1)),t.filePath+"@"+e.lIndex.toString()+"-"+r.join("-")}},208:function(e,t,r){var n=r(207),o=n.startsWith,i=n.endsWith,a=n.isStarting,s=n.isEnding,u=n.isWhiteSpace,l=r(322);e.exports=function(e,t){var r=t.fileTypeConfig.tagShouldContain||[],n="",c=-1;-1!==l.docx.indexOf(t.contentType)&&(e=function(e){for(var t="",r=0,n=e.length;r<n;r++){var a=e[r];u(a)||(i(t,"</w:tbl>")&&(o(a,"<w:p")||o(a,"<w:tbl")||o(a,"<w:sectPr")||(a="<w:p/>".concat(a))),t=a,e[r]=a)}return e}(e));for(var p=-1,f=0,h=r.length;f<h;f++)for(var d=r[f],y=d.tag,v=d.shouldContain,m=d.value,g=d.drop,b=d.dropParent,w=0,x=e.length;w<x;w++){var T=e[w];if(c===f){if(s(T,y))if(c=-1,b){for(var P=-1,O=p;O>0;O--)if(a(e[O],b)){P=O;break}for(var S=P;S<=e.length;S++){if(s(e[S],b)){e[S]="";break}e[S]=""}}else{for(var E=p;E<=w;E++)e[E]="";g||(e[w]=n+m+T)}n+=T;for(var j=0,k=v.length;j<k;j++){var C=v[j];if(a(T,C)){c=-1;break}}}-1===c&&a(T,y)&&-1===T.substr(1).indexOf("<")&&("/"===T[T.length-2]?e[w]="":(p=w,c=f,n=T))}return e}},263:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l=r(946),c=l.getUnclosedTagException,p=l.getUnopenedTagException,f=l.getDuplicateOpenTagException,h=l.getDuplicateCloseTagException,d=l.throwMalformedXml,y=l.throwXmlInvalid,v=l.XTTemplateError,m=r(207),g=m.isTextStart,b=m.isTextEnd,w=m.wordToUtf8,x=0,T=1,P=2,O=3;function S(e,t){return e[0]<=t.offset&&t.offset<e[1]}function E(e){var t="",r=1,n=e.indexOf(" ");return"/"===e[e.length-2]?(t="selfclosing",-1===n&&(n=e.length-2)):"/"===e[1]?(r=2,t="end",-1===n&&(n=e.length-1)):(t="start",-1===n&&(n=e.length-1)),{tag:e.slice(r,n),position:t}}function j(e,t){return-1===e&&-1===t?x:e===t?T:-1===e||-1===t?t<e?P:O:e<t?P:O}function k(e){var t=e.split(" ");if(2!==t.length){var r=new v("New Delimiters cannot be parsed");throw r.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},r}var n=o(t,2),i=n[0],a=n[1];if(0===i.length||0===a.length){var s=new v("New Delimiters cannot be parsed");throw s.properties={id:"change_delimiters_invalid",explanation:"Cannot parser delimiters"},s}return[i,a]}function C(e,t,r){var n=e.map((function(e){return e.value})).join(""),i=function(e,t,r){for(var n=[],i=t.start,a=t.end,s=-1,u=!1;;){var l=e.indexOf(i,s+1),c=e.indexOf(a,s+1),p=null,f=void 0,h=j(l,c);switch(h===T&&(h=u?O:P),h){case x:return n;case O:u=!1,s=c,p="end",f=a.length;break;case P:u=!0,s=l,p="start",f=i.length}if(r.changeDelimiterPrefix&&h===P&&e[s+i.length]===r.changeDelimiterPrefix){n.push({offset:l,position:"start",length:i.length,changedelimiter:!0});var d=e.indexOf(r.changeDelimiterPrefix,s+i.length+1),y=e.indexOf(a,d+1);n.push({offset:y,position:"end",length:a.length,changedelimiter:!0});var v=o(k(e.substr(s+i.length+1,d-s-i.length-1)),2);i=v[0],a=v[1],s=y}else n.push({offset:s,position:p,length:f})}}(n,t,r),a=0,u=e.map((function(e){return{offset:(a+=e.value.length)-e.value.length,lIndex:e.lIndex}})),l=function(e,t,r){var n,o=[],i=!1,a={offset:0},u=e.reduce((function(e,u){var l=u.position,d=u.offset,y=a.offset,v=a.length;if(n=t.substr(y,d-y),i&&"start"===l){if(y+v===d&&(n=t.substr(y,d-y+v+4),!r.allowUnclosedTag))return o.push(f({xtag:n,offset:y})),a=u,e.push(s(s({},u),{},{error:!0})),e;if(!r.allowUnclosedTag)return o.push(c({xtag:w(n),offset:y})),a=u,e.push(s(s({},u),{},{error:!0})),e;e.pop()}return i||"end"!==l?(i="start"===l,a=u,e.push(u),e):r.allowUnopenedTag?e:y+v===d?(n=t.substr(y-4,d-y+v+4),o.push(h({xtag:n,offset:y})),a=u,e.push(s(s({},u),{},{error:!0})),e):(o.push(p({xtag:n,offset:d})),a=u,e.push(s(s({},u),{},{error:!0})),e)}),[]);if(i){var l=a.offset;n=t.substr(l,t.length-l),r.allowUnclosedTag?u.pop():o.push(c({xtag:w(n),offset:l}))}return{delimiterWithErrors:u,errors:o}}(i,n,r),d=l.delimiterWithErrors,y=l.errors,v=0,m=0,g=u.map((function(t,r){for(var n=t.offset,o=[n,n+e[r].value.length],i=e[r].value,a=[];m<d.length&&S(o,d[m]);)a.push(d[m]),m++;var s=[],u=0;v>0&&(u=v,v=0),a.forEach((function(e){var t=i.substr(u,e.offset-n-u);if(e.changedelimiter)"start"===e.position?t.length>0&&s.push({type:"content",value:t}):u=e.offset-n+e.length;else{t.length>0&&(s.push({type:"content",value:t}),u+=t.length);var r={type:"delimiter",position:e.position,offset:u+n};s.push(r),u=e.offset-n+e.length}})),v=u-i.length;var l=i.substr(u);return l.length>0&&s.push({type:"content",value:l}),s}),this);return{parsed:g,errors:y}}function I(e){return"content"===e.type&&"insidetag"===e.position}e.exports={parseDelimiters:C,parse:function(e,t,r,n){!function(e,t){var r=!1;e.forEach((function(e){r=function(e,t){return g(e)?(t&&d(),!0):b(e)?(t||d(),!1):t}(e,r),"content"===e.type&&(e.position=r?"insidetag":"outsidetag"),"text"!==t&&I(e)&&(e.value=e.value.replace(/>/g,">"))}))}(e,n);var o=C(e.filter(I),t,r),i=o.parsed,a=o.errors,s=[],u=0,l=0;return e.forEach((function(e){I(e)?(Array.prototype.push.apply(s,i[u].map((function(e){return"content"===e.type&&(e.position="insidetag"),e.lIndex=l++,e}))),u++):(e.lIndex=l++,s.push(e))})),{errors:a,lexed:s}},xmlparse:function(e,t){var r=function(e,t,r){for(var n=0,o=e.length,i={},a=0,s=t.length;a<s;a++)i[t[a]]=!0;for(var u=0,l=r.length;u<l;u++)i[r[u]]=!1;for(var c=[];n<o&&-1!==(n=e.indexOf("<",n));){var p=n,f=e.indexOf("<",n+1);(-1===(n=e.indexOf(">",n))||-1!==f&&n>f)&&y(e,p);var h=e.slice(p,n+1),d=E(h),v=d.tag,m=d.position,g=i[v];null!=g&&c.push({type:"tag",position:m,text:g,offset:p,value:h,tag:v})}return c}(e,t.text,t.other),n=0,o=r.reduce((function(t,r){var o=e.substr(n,r.offset-n);return o.length>0&&t.push({type:"content",value:o}),n=r.offset+r.value.length,delete r.offset,t.push(r),t}),[]),i=e.substr(n);return i.length>0&&o.push({type:"content",value:i}),o}}},798:function(e){function t(e,t){for(var r=-1,n=0,o=e.length;n<o;n++)t[n]>=e[n].length||(-1===r||e[n][t[n]].offset<e[r][t[r]].offset)&&(r=n);return r}e.exports=function(e){var r=e.reduce((function(e,t){return e+t.length}),0);e=e.filter((function(e){return e.length>0}));for(var n=new Array(r),o=e.map((function(){return 0})),i=0;i<r;i++){var a=t(e,o);n[i]=e[a][o[a]],o[a]++}return n}},899:function(e,t,r){var n=r(946).XTInternalError;function o(){}function i(e){return e}e.exports=function(e){var t={set:o,matchers:function(){return[]},parse:o,render:o,getTraits:o,getFileType:o,nullGetter:o,optionsTransformer:i,postrender:i,errorsTransformer:i,getRenderedMap:i,preparse:i,postparse:i,on:o,resolve:o,preResolve:o};if(Object.keys(t).every((function(t){return!e[t]}))){var r=new n("This module cannot be wrapped, because it doesn't define any of the necessary functions");throw r.properties={id:"module_cannot_be_wrapped",explanation:"This module cannot be wrapped, because it doesn't define any of the necessary functions"},r}return Object.keys(t).forEach((function(r){e[r]=e[r]||t[r]})),e}},438:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(899),s=r(322),u=r(356),l=[u.settingsContentType,u.coreContentType,u.appContentType,u.customContentType],c=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="Common"},(t=[{key:"getFileType",value:function(e){var t=e.doc,r=t.invertedContentTypes;if(r){for(var n=0,o=l.length;n<o;n++){var i=l[n];r[i]&&Array.prototype.push.apply(t.targets,r[i])}for(var a,u=["docx","pptx"],c=0,p=u.length;c<p;c++){for(var f=s[u[c]],h=0,d=f.length;h<d;h++){var y=f[h];if(r[y])for(var v=0,m=r[y].length;v<m;v++){var g=r[y][v];t.relsTypes[g]&&-1===["http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument","http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"].indexOf(t.relsTypes[g])||(a=u[c],-1===s.main.indexOf(y)&&y!==s.pptx[0]||t.textTarget||(t.textTarget=g),t.targets.push(g))}}if(a)return a}return a}}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new c)}},201:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var a=r(798),s=r(207),u=s.getLeft,l=s.getRight,c=r(899),p=r(536).getExpandToDefault,f=r(946),h=f.getUnmatchedLoopException,d=f.getClosingTagNotMatchOpeningTag,y=f.getUnbalancedLoopException;function v(e){switch(e.location){case"start":return 1;case"end":return-1}}function m(e,t){return null!=e&&null!=t&&("start"===e.part.location&&"end"===t.part.location&&e.part.value===t.part.value||""===t.part.value)}function g(e){for(var t=0,r=[];t<e.length;){var n=e[t].part;if("end"===n.location){if(0===t)return e.splice(0,1),r.push(h(n)),{traits:e,errors:r};var o=t,i=t-1,a=1;if(m(e[i],e[o]))return e.splice(o,1),e.splice(i,1),{errors:r,traits:e};for(;a<50;){var s=e[i-a],u=e[o+a];if(m(s,e[o]))return e.splice(o,1),e.splice(i-a,1),{errors:r,traits:e};if(m(e[i],u))return e.splice(o+a,1),e.splice(i,1),{errors:r,traits:e};a++}return r.push(d({tags:[e[i].part,e[o].part]})),e.splice(o,1),e.splice(i,1),{traits:e,errors:r}}t++}return e.forEach((function(e){var t=e.part;r.push(h(t))})),{traits:[],errors:r}}var b=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="ExpandPairTrait"},t=[{key:"optionsTransformer",value:function(e,t){return this.expandTags=t.fileTypeConfig.expandTags.concat(t.options.paragraphLoop?t.fileTypeConfig.onParagraphLoop:[]),e}},{key:"postparse",value:function(e,t){var r=this,n=t.getTraits,o=t.postparse,i=t.fileType,s=n("expandPair",e);s=s.map((function(e){return e||[]}));var c=function(e){for(var t={},r=[],n=[],o=[],i=0;i<e.length;i++)o.push(e[i]);for(;o.length>0;){var a=g(o);r=r.concat(a.errors),o=a.traits}if(r.length>0)return{pairs:n,errors:r};for(var s=0,u=0;u<e.length;u++){var l=e[u],c=v(l.part);if(s+=c,1===c)t[s]=l;else{var p=t[s+1];0===s&&(n=n.concat([[p,l]]))}s=s>=0?s:0}return{pairs:n,errors:r}}(s=a(s)),f=c.pairs,h=c.errors,d=0,m=null,b=f.map((function(t){var n,o,a=t[0].part.expandTo;if("auto"===a&&"text"!==i){var s=p(e,t,r.expandTags);s.error&&h.push(s.error),a=s.value}if(!a||"text"===i){var c=t[0].offset,f=t[1].offset;return c<d&&h.push(y(t,m)),m=t,d=f,[c,f]}try{n=u(e,a,t[0].offset)}catch(e){h.push(e)}try{o=l(e,a,t[1].offset)}catch(e){h.push(e)}return n<d&&h.push(y(t,m)),d=o,m=t,[n,o]}));if(h.length>0)return{postparsed:e,errors:h};var w,x=0;return{postparsed:e.reduce((function(t,r,n){var i=x<f.length&&b[x][0]<=n&&n<=b[x][1],a=f[x],s=b[x];if(!i)return t.push(r),t;if(s[0]===n&&(w=[]),a[0].offset!==n&&a[1].offset!==n&&w.push(r),s[1]===n){var u=e[a[0].offset];u.subparsed=o(w,{basePart:u}),u.endLindex=a[1].part.lIndex,delete u.location,delete u.expandTo,t.push(u),x++}return t}),[]),errors:h}}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return c(new b)}},885:function(e,t,r){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}var p=r(207),f=p.chunkBy,h=p.last,d=p.isParagraphStart,y=p.isModule,v=p.isParagraphEnd,m=p.isContent,g=p.startsWith,b=p.isTagEnd,w=p.isTagStart,x=p.getSingleAttribute,T=p.setSingleAttribute,P=r(322),O=r(899),S="loop";function E(e){var t=function(e){for(var t=0,r=e.length;t<r;t++)if("content"!==e[t].type)return e[t];return null}(e.subparsed);return null!=t&&"w:t"!==t.tag}function j(e){return e.hasPageBreak&&E(e)?'<w:p><w:r><w:br w:type="page"/></w:r></w:p>':""}function k(e){return e.some((function(e){return m(e)}))?0:e.length}function C(e){var t=e.parts.length-1;"</w:p>"===e.parts[t]?e.parts.splice(t,0,'<w:r><w:br w:type="page"/></w:r>'):e.parts.push('<w:p><w:r><w:br w:type="page"/></w:r></w:p>')}function I(e){return e.some((function(e){return"w:br"===e.tag&&-1!==e.value.indexOf('w:type="page"')}))}function A(e){return e.some((function(e){return"w:drawing"===e.tag}))}var M=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="LoopModule",this.inXfrm=!1,this.totalSectPr=0,this.prefix={start:"#",end:"/",dash:/^-([^\s]+)\s(.+)/,inverted:"^"}},t=[{key:"optionsTransformer",value:function(e,t){return this.docxtemplater=t,e}},{key:"preparse",value:function(e,t){var r,n,o=t.contentType;-1!==P.main.indexOf(o)&&(this.sects=(r=!1,n=[],e.forEach((function(e){w("w:sectPr",e)&&(n.push([]),r=!0),r&&n[n.length-1].push(e),b("w:sectPr",e)&&(r=!1)})),n))}},{key:"matchers",value:function(){var e=S;return[[this.prefix.start,e,{expandTo:"auto",location:"start",inverted:!1}],[this.prefix.inverted,e,{expandTo:"auto",location:"start",inverted:!0}],[this.prefix.end,e,{location:"end"}],[this.prefix.dash,e,function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||s(e,t)||function(){throw new TypeError("Invalid att