!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;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);r",">"],['"',"""],["'","'"]],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=Object.prototype.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===""}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=0;o--)for(var i=e[o],a=0,s=t.length;a0}))},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:{}},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");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){return o="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},o(e)}function i(e,t){for(var r=0;r1&&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,n,o={},i=Object.keys(e);for(n=0;n=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.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),!Array.isArray(a))throw new Error("The modules argument of docxtemplater's constructor must be an array");if(this.targets=[],this.rendered=!1,this.scopeManagers={},this.compiled={},this.modules=[v()],this.setOptions(s),a.forEach((function(e){r.attachModule(e)})),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)");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&&I("neededVersion is not a valid version",{neededVersion:e,explanation:"the neededVersion must be an array of length 3"}),e[0]!==M[0]&&I("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]&&I("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]&&I("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 E("attachModule() should not be called manually when using the v4 constructor");var t=o(e);if("function"===t)throw new E("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 E("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=x(e);return this.modules.push(r),r.on("attached"),this.fileType&&A(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(g).forEach((function(r){var n=g[r];t.options[r]=null!=e[r]?e[r]:t[r]||n,t[r]=t.options[r]})),this.delimiters.start=s.utf8ToWord(this.delimiters.start),this.delimiters.end=s.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 E("Docxtemplater doesn't handle JSZip version >=3, please use pizzip");return this.zip=e,this.updateFileTypeConfig(),this.modules=T([this.fileTypeConfig.baseModules.map((function(e){return e()})),this.modules]),A(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]=u({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||p(),Promise.resolve(e).then((function(e){return t.setData(e),t.setModules({data:t.data,Lexer:m}),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&&d(r,t.options.errorLogging),c(r)),T(e)}))}))}},{key:"reorderModules",value:function(){this.modules=S(this.modules,(function(e,t){return(t.priority||0)-(e.priority||0)}))}},{key:"throwIfDuplicateModules",value:function(){var e=O(this.modules.map((function(e){return e.name})));if(e.length>0)throw new E('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=P(this.options.xmlFileNames),this.xmlDocuments=this.options.xmlFileNames.reduce((function(t,r){var n=e.zip.files[r].asText();return t[r]=b(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?b(e.asText()):null,r=t?t.getElementsByTagName("Relationship"):[],n={},o=0,i=r.length;o0&&f(),e&&this.setData(e),this.setModules({data:this.data,Lexer:m}),this.mapper=this.mapper||this.modules.reduce((function(e,t){return t.getRenderedMap(e)}),{}),Object.keys(this.mapper).forEach((function(e){var r=t.mapper[e],n=r.from,o=r.data,i=t.compiled[n];i.scopeManager=t.getScopeManager(e,i,o),i.render(e),t.zip.file(e,i.content,{createFolders:!0})})),_(this),this.sendEvent("syncing-zip"),this.syncZip(),this}},{key:"syncZip",value:function(){var e=this;Object.keys(this.xmlDocuments).forEach((function(t){e.zip.remove(t);var r=w(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(g).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=P(this.templatedFiles),this.templatedFiles}}],r&&i(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function _(e){var t=e.compiled;e.errors=T(Object.keys(t).map((function(e){return t[e].allErrors}))),0!==e.errors.length&&(e.options.errorLogging&&d(e.errors,e.options.errorLogging),c(e.errors))}L.DocUtils=s,L.Errors=r(946),L.XmlTemplater=r(245),L.FileTypeConfig=r(271),L.XmlMatcher=r(367),e.exports=L,e.exports.default=L},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}var i=r(320),a=i.last,s=i.first;function u(e){this.name="GenericError",this.message=e,this.stack=new Error(e).stack}function l(e){this.name="TemplateError",this.message=e,this.stack=new Error(e).stack}function c(e){this.name="RenderingError",this.message=e,this.stack=new Error(e).stack}function p(e){this.name="ScopeParserError",this.message=e,this.stack=new Error(e).stack}function f(e){this.name="InternalError",this.properties={explanation:"InternalError"},this.message=e,this.stack=new Error(e).stack}function h(e){this.name="APIVersionError",this.properties={explanation:"APIVersionError"},this.message=e,this.stack=new Error(e).stack}u.prototype=Error.prototype,l.prototype=new u,c.prototype=new u,p.prototype=new u,f.prototype=new u,h.prototype=new u,e.exports={XTError:u,XTTemplateError:l,XTInternalError:f,XTScopeParserError:p,XTAPIVersionError:h,RenderingError:c,XTRenderingError:c,getClosingTagNotMatchOpeningTag:function(e){var t=e.tags,r=new l("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:s(t).value,offset:[s(t).offset,a(t).offset],closingtag:a(t).value},r},getLoopPositionProducesInvalidXMLError:function(e){var t=e.tag,r=e.offset,n=new l('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 p("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 p("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 l("Unclosed tag");return t.properties={xtag:s(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 l("Unopened tag");return t.properties={xtag:a(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 l("".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 l("Duplicate close tag, expected one close tag");return t.properties={xtag:s(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 l("Duplicate open tag, expected one open tag");return t.properties={xtag:s(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 c("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 c("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 l("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 h(e);throw r.properties=function(e){for(var t=1;t"},{tag:"w:sdtContent",shouldContain:["w:p","w:r","w:commentRangeStart","w:sdt"],value:""}]}},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:""},{tag:"a:txBody",shouldContain:["a:p"],value:""}]}}}},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")&&(o(a,"".concat(a))),t=a,e[r]=a)}return e}(e));for(var p=-1,f=0,h=e.length;f0;S--)if(a(e[S],T)){P=S;break}for(var j=f;je.length)&&(t=e.length);for(var r=0,n=new Array(t);r0&&(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 C(e){return"content"===e.type&&"insidetag"===e.position}e.exports={parseDelimiters:k,parse:function(e,t,r,n){!function(e,t){var r=!1;e.forEach((function(e){r=function(e,t){return m(e)?(t&&h(),!0):g(e)?(t||h(),!1):t}(e,r),"content"===e.type&&(e.position=r?"insidetag":"outsidetag"),"text"!==t&&C(e)&&(e.value=e.value.replace(/>/g,">"))}))}(e,n);var o=k(e.filter(C),t,r),i=o.parsed,a=o.errors,s=[],u=0,l=0;return e.forEach((function(e){C(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",n))||-1!==f&&n>f)&&d(e,p);var h=e.slice(p,n+1),y=S(h),v=y.tag,m=y.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=e[n].length||(-1===r||e[n][t[n]].offset0}));for(var n=new Array(r),o=e.map((function(){return 0})),i=0;i0;){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=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 c0)return{postparsed:e,errors:h};var w,x=0;return{postparsed:e.reduce((function(t,r,n){var i=xe.length)&&(t=e.length);for(var r=0,n=new Array(t);r':""}function E(e){return e.some((function(e){return v(e)}))?0:e.length}function k(e){var t=e.parts.length-1;""===e.parts[t]?e.parts.splice(t,0,''):e.parts.push('')}function C(e){return e.some((function(e){return"w:br"===e.tag&&-1!==e.value.indexOf('w:type="page"')}))}function I(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!==T.main.indexOf(o)&&(this.sects=(r=!1,n=[],e.forEach((function(e){b("w:sectPr",e)&&(n.push([]),r=!0),r&&n[n.length-1].push(e),g("w:sectPr",e)&&(r=!1)})),n))}},{key:"matchers",value:function(){var e=O;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,r,n=(r=3,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)||a(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.")}());return{location:"start",inverted:!1,expandTo:n[1],value:n[2]}}]]}},{key:"getTraits",value:function(e,t){if("expandPair"===e)return t.reduce((function(e,t,r){return d(t,O)&&null==t.subparsed&&e.push({part:t,offset:r}),e}),[])}},{key:"postparse",value:function(e,t){var r=t.basePart;if(r&&"docx"===this.docxtemplater.fileType&&e.length>0){r.sectPrCount=function(e){var t=!1,r=0;return e.forEach((function(e){b("w:sectPr",e)&&(t=!0),t&&("w:headerReference"!==e.tag&&"w:footerReference"!==e.tag||(r++,t=!1)),g("w:sectPr",e)&&(t=!1)})),r}(e),this.totalSectPr+=r.sectPrCount;var n=this.sects;n.some((function(t,o){return r.lIndex=0;n--){var o=e[n];if(g("w:sectPr",o)&&(r=!0),b("w:sectPr",o)&&(t.unshift(o.value),r=!1),r&&t.unshift(o.value),h(o)){if(t.length>0)return t.join("");break}}return""}(e)}if(!r||"auto"!==r.expandTo||r.module!==O||!function(e){return e.length&&h(e[0])&&y(f(e))}(e))return e;r.paragraphLoop=!0;var o=0,i=p(e,(function(e){return h(e)&&1==++o?"start":y(e)&&0==--o?"end":null})),a=i[0],s=f(i),u=E(a),l=E(s);return r.hasPageBreakBeginning=C(a),r.hasPageBreak=C(s),I(a)&&(u=0),I(s)&&(l=0),e.slice(u,e.length-l)}},{key:"resolve",value:function(e,t){if(!d(e,O))return null;var r=t.scopeManager,n=r.getValueAsync(e.value,{part:e}),o=[];function u(n,a,s){var u=r.createSubScopeManager(n,e.value,a,e,s);o.push(t.resolve(i(i({},t),{},{compiled:e.subparsed,tags:{},scopeManager:u})))}var l=[];return n.then((function(t){return new Promise((function(e){t instanceof Array?Promise.all(t).then(e):e(t)})).then((function(t){return r.loopOverValue(t,u,e.inverted),Promise.all(o).then((function(e){return e.map((function(e){var t,r=e.resolved,n=e.errors;return l.push.apply(l,function(e){if(Array.isArray(e))return s(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r}))})).then((function(e){if(l.length>0)throw l;return e}))}))}))}},{key:"render",value:function(e,t){if("p:xfrm"===e.tag&&(this.inXfrm="start"===e.position),"a:ext"===e.tag&&this.inXfrm)return this.lastExt=e,e;if(!d(e,O))return null;var r=[],n=[],o=0,a=this,s=e.subparsed[0],u=0;"a:tr"===(null==s?void 0:s.tag)&&(u=+w(s.value,"h")),o-=u;var l=0,c=S(e);if(!1===t.scopeManager.loopOver(e.value,(function(s,p,f){o+=u;var h=t.scopeManager.createSubScopeManager(s,e.value,p,e,f);e.subparsed.forEach((function(e){if(b("a16:rowId",e)){var t=+w(e.value,"val")+l;l=1,e.value=x(e.value,"val",t)}}));var d,y,v,g=t.render(i(i({},t),{},{compiled:e.subparsed,tags:{},scopeManager:h}));e.hasPageBreak&&p===f-1&&c&&k(g),h.scopePathItem.some((function(e){return 0!==e}))?(1===e.sectPrCount&&(g.parts=g.parts.filter((function(e){return!m(e,"')),e.push(t),e}),[])))):e.addNextPage&&(g.parts=function(e,t){return["".concat(t.map((function(e){return e.value})).join(""),"")].concat(e)}(g.parts,a.sects[e.addNextPage.index])),e.addNextPage&&k(g),e.hasPageBreakBeginning&&c&&function(e){e.parts.unshift('')}(g);for(var T=0,P=g.parts.length;T".concat(e.lastParagrapSectPr,"")}:{value:"".concat(e.lastParagrapSectPr,"")}:{value:j(e)||"",errors:n};if(0!==o){var p=+w(this.lastExt.value,"cy");this.lastExt.value=x(this.lastExt.value,"cy",p+o)}return{value:t.joinUncorrupt(r,i(i({},t),{},{basePart:e})),errors:n}}}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return P(new M)}},60: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":"",o=e.split("\n"),i=this.recordedRun.join("");return o.map((function(e){return l(e)})).reduce((function(e,a,s){return e.push(a),s").concat(n,"<").concat(r,":r>").concat(i,"<").concat(r,":t").concat("docx"===t.fileType?' xml:space="preserve"':"",">")),e}),[])}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new g)}},522: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"===e[t+1].value||-1!==r.indexOf('xml:space="preserve"')?r:r.substr(0,r.length-1)+' xml:space="preserve">'}var h=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="SpacePreserveModule"},(t=[{key:"postparse",value:function(e,t){var r=[],n=!1,o=0,i=0,a=e.reduce((function(e,a){return function(e){return u(e)&&"w:t"===e.tag}(a)&&(n=!0,i=r.length),n?(r.push(a),function(e,t){return e&&e.basePart&&t.length>1}(t,r)&&(o=t.basePart.endLindex,r[0].value=f(r,0)),function(e,t){return"placeholder"===e.type&&t.length>1}(a,r)&&(r[i].value=f(r,i),o=a.endLindex),l(a)&&a.lIndex>o&&(0!==o&&(r[i].value=f(r,i)),Array.prototype.push.apply(e,r),r=[],n=!1,o=0,i=0),e):(e.push(a),e)}),[]);return Array.prototype.push.apply(a,r),a}},{key:"postrender",value:function(e){for(var t="",r=0,n=0,o=e.length;n')&&p(a,"")&&(e[r]=t.substr(0,t.length-26)+"",a=a.substr(6)),t=a,r=i,e[n]=a)}return e}}])&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();e.exports=function(){return a(new h)}},690: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;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r0){var y=null;return d.forEach((function(e){e.priority=e.priority||-e.value.length,(!y||e.priority>y.priority)&&(y=e)})),y.offset=o,delete y.priority,y.endLindex=l,y.lIndex=l,y.raw=e,y.onMatch&&y.onMatch(y),delete y.onMatch,delete y.prefix,y}for(var v=0,m=n.length;v>>6,s[o++]=128|63&t):t<65536?(s[o++]=224|t>>>12,s[o++]=128|t>>>6&63,s[o++]=128|63&t):(s[o++]=240|t>>>18,s[o++]=128|t>>>12&63,s[o++]=128|t>>>6&63,s[o++]=128|63&t);return s}e.exports=function(e,r){for(var n=0,o=r.modules.length;n65536){var h=t(s);i+=h.length,l.push(h),s=""}s+=f,u+=f.length,delete a[c]}var d=t(s);i+=d.length,l.push(d);var y=new Uint8Array(i),v=0;return l.forEach((function(e){for(var t=0;te.length)&&(t=e.length);for(var r=0,n=new Array(t);r>>0,o=0;o0?c.call(this,e,t,r-1):n}function p(e,t,r){var n,o=this,i=this.scopeList[r];return n=this.cachedParsers&&t.part?this.cachedParsers[t.part.lIndex]?this.cachedParsers[t.part.lIndex]:this.cachedParsers[t.part.lIndex]=this.parser(e,{tag:t.part,scopePath:this.scopePath}):this.parser(e,{tag:t.part,scopePath:this.scopePath}),Promise.resolve().then((function(){return n.get(i,o.getContext(t,r))})).catch((function(r){throw a({tag:e,scope:i,error:r,offset:t.part.offset})})).then((function(n){return null==n&&r>0?p.call(o,e,t,r-1):n}))}var f=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.root=t.root||this,this.resolveOffset=t.resolveOffset||0,this.scopePath=t.scopePath,this.scopePathItem=t.scopePathItem,this.scopePathLength=t.scopePathLength,this.scopeList=t.scopeList,this.scopeType="",this.scopeTypes=t.scopeTypes,this.scopeLindex=t.scopeLindex,this.parser=t.parser,this.resolved=t.resolved,this.cachedParsers=t.cachedParsers}return t=e,(r=[{key:"loopOver",value:function(e,t,r,n){return this.loopOverValue(this.getValue(e,n),t,r)}},{key:"functorIfInverted",value:function(e,t,r,n,o){return e&&t(r,n,o),e}},{key:"isValueFalsy",value:function(e,t){return null==e||!e||"[object Array]"===t&&0===e.length}},{key:"loopOverValue",value:function(e,t,r){this.root.finishedResolving&&(r=!1);var n=Object.prototype.toString.call(e);if(this.isValueFalsy(e,n))return this.scopeType=!1,this.functorIfInverted(r,t,s(this.scopeList),0,1);if("[object Array]"===n){this.scopeType="array";for(var o=0;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?n[u-1].right:0),!(s.left]*>)([^<>]*))|(<(?:").concat(o,")[^>]*/>)"),"g");return r.matches=n(i,r.content),r}},245: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;r0?(this.allErrors=n,this.errorChecker(n),this):(this.content=h(o,t),this.setModules({inspect:{filePath:this.filePath,content:this.content}}),this)}}],t&&o(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()}},t={},r=function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}(807);window.docxtemplater=r}();