(function(){var t,e;e="undefined"!=typeof global&&null!==global?global:window,t="undefined"!=typeof global&&null!==global?"node":"browser",e.XmlUtil=e.XmlUtil=function(){function t(){}return t.prototype.getListXmlElements=function(t,e,n){var a,r,i,s,l,o,c,h,u,p;for(null==e&&(e=0),null==n&&(n=t.length-1),h=DocUtils.preg_match_all("<(/?[^/> ]+)([^>]*)>",t.substr(e,n)),o=[],a=u=0,p=h.length;u
0&&(l=o[o.length-1],i=l.tag.substr(1,l.tag.length-2),r=c[1].substr(1),i===r&&(s=!0)),s?o.pop():o.push({tag:"<"+c[1]+">",offset:c.offset})):"/"===c[2][c[2].length-1]||o.push({tag:"<"+c[1]+">",offset:c.offset});return o},t.prototype.getListDifferenceXmlElements=function(t,e,n){var a;for(null==e&&(e=0),null==n&&(n=t.length-1),a=this.getListXmlElements(t,e,n);;){if(a.length<=1)break;if(a[0].tag.substr(2)!==a[a.length-1].tag.substr(1))break;a.pop(),a.shift()}return a},t}()}).call(this),function(){var t,e,n;n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",n.TemplaterState=t=function(){function t(){}return t.prototype.moveCharacters=function(t,e,n){var a,r,i,s;if("number"!=typeof e)return this.moveCharacters(t,e.length,n);if("number"!=typeof n)return this.moveCharacters(t,e,n.length);for(s=[],a=r=t,i=this.matches.length;t<=i?r<=i:r>=i;a=t<=i?++r:--r)s.push(this.charactersAdded[a]+=e-n);return s},t.prototype.calcStartTag=function(t){return this.calcPosition(t.start)},t.prototype.calcXmlTagPosition=function(t){return this.matches[t].offset+this.charactersAdded[t]},t.prototype.calcEndTag=function(t){return this.calcPosition(t.end)+1},t.prototype.calcPosition=function(t){return this.matches[t.numXmlTag].offset+this.matches[t.numXmlTag][1].length+this.charactersAdded[t.numXmlTag]+t.numCharacter},t.prototype.findOuterTagsContent=function(t){var e,n;return n=this.calcStartTag(this.loopOpen),e=this.calcEndTag(this.loopClose),{content:t.substr(n,e-n),start:n,end:e}},t.prototype.findInnerTagsContent=function(t){var e,n;return n=this.calcEndTag(this.loopOpen),e=this.calcStartTag(this.loopClose),{content:t.substr(n,e-n),start:n,end:e}},t.prototype.initialize=function(){return this.inForLoop=!1,this.loopIsInverted=!1,this.inTag=!1,this.inDashLoop=!1,this.rawXmlTag=!1,this.textInsideTag=""},t.prototype.startTag=function(t){if(this.inTag===!0)throw new Error("Tag already open with text: "+this.textInsideTag);return this.inTag=!0,this.rawXmlTag=!1,this.textInsideTag="",this.tagStart=this.currentStep},t.prototype.loopType=function(){return this.inDashLoop?"dash":this.inForLoop?"for":this.rawXmlTag?"xml":"simple"},t.prototype.isLoopClosingTag=function(){return"/"===this.textInsideTag[0]&&"/"+this.loopOpen.tag===this.textInsideTag},t.prototype.endTag=function(){var t;if(this.inTag===!1)throw new Error("Tag already closed");if(this.inTag=!1,this.tagEnd=this.currentStep,"@"===this.textInsideTag[0]&&"simple"===this.loopType()&&(this.rawXmlTag=!0,this.tag=this.textInsideTag.substr(1)),"#"===this.textInsideTag[0]&&"simple"===this.loopType()&&(this.inForLoop=!0,this.loopOpen={start:this.tagStart,end:this.tagEnd,tag:this.textInsideTag.substr(1)}),"^"===this.textInsideTag[0]&&"simple"===this.loopType()&&(this.inForLoop=!0,this.loopIsInverted=!0,this.loopOpen={start:this.tagStart,end:this.tagEnd,tag:this.textInsideTag.substr(1)}),"-"===this.textInsideTag[0]&&"simple"===this.loopType()&&(this.inDashLoop=!0,t=/^-([a-zA-Z_:]+) ([a-zA-Z_:]+)$/,this.loopOpen={start:this.tagStart,end:this.tagEnd,tag:this.textInsideTag.replace(t,"$2"),element:this.textInsideTag.replace(t,"$1")}),"/"===this.textInsideTag[0])return this.loopClose={start:this.tagStart,end:this.tagEnd}},t}()}.call(this),function(){var t,e,n=[].slice;e="undefined"!=typeof global&&null!==global?global:window,t="undefined"!=typeof global&&null!==global?"node":"browser",e.DocUtils={},e.docX=[],e.docXData=[],DocUtils.escapeRegExp=function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},DocUtils.charMap={"&":"&","'":"'","<":"<",">":">"},DocUtils.wordToUtf8=function(t){var e,n,a;a=DocUtils.charMap;for(e in a)n=a[e],t=t.replace(new RegExp(DocUtils.escapeRegExp(n),"g"),e);return t},DocUtils.utf8ToWord=function(t){var e,n,a;a=DocUtils.charMap;for(n in a)e=a[n],t=t.replace(new RegExp(DocUtils.escapeRegExp(n),"g"),e);return t},DocUtils.defaultParser=function(t){return{get:function(e){return e[t]}}},DocUtils.nl2br=function(t,e){return(t+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1
$2")},DocUtils.loadDoc=function(n,a){var r,i,s,l,o,c,h,u,p,g,m,d,f,T,x,w,b;if(null==a&&(a={}),d=null!=a.docx&&!a.docx,i=null!=a.async&&a.async,g=null!=a.intelligentTagging&&a.intelligentTagging,l=null!=a.callback?a.callback:null,s="",null==n)throw new Error("path not defined");if(n.indexOf("/")!==-1?(x=n,u=x):(u=n,""===s&&null!=DocUtils.pathConfig&&(s="browser"===t?DocUtils.pathConfig.browser:DocUtils.pathConfig.node),x=s+n),m=function(t){return e.docXData[u]=t,d===!1?(e.docX[u]=new DocxGen(t,{},{intelligentTagging:g}),e.docX[u]):(null!=l&&l(e.docXData[u]),i===!1?e.docXData[u]:void 0)},"browser"===t)b=new XMLHttpRequest,b.open("GET",x,i),b.overrideMimeType&&b.overrideMimeType("text/plain; charset=x-user-defined"),b.onreadystatechange=function(t){if(4===this.readyState){if(200===this.status)return m(this.response);if(null!=l)return l(!0)}},b.send();else if(p=new RegExp("(https?)","i"),p.test(n)){switch(w=url.parse(n),a={hostname:w.hostname,path:w.path,method:"GET",rejectUnauthorized:!1},h=function(t){throw new Error("Error on HTTPS Call")},T=function(t){var e;return t.setEncoding("binary"),e="",t.on("data",function(t){return e+=t}),t.on("end",function(){return m(e)})},w.protocol){case"https:":f=https.request(a,T).on("error",h);break;case"http:":f=http.request(a,T).on("error",h)}f.end()}else if(i===!0)fs.readFile(x,"binary",function(t,e){if(t){if(null!=l)return l(!0)}else if(m(e),null!=l)return l(e)});else try{if(o=fs.readFileSync(x,"binary"),r=m(o),null==l)return r;l(o)}catch(t){c=t,null!=l&&l()}return u},DocUtils.tags={start:"{",end:"}"},DocUtils.clone=function(t){var e,n,a;if(null==t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return e="",null!=t.global&&(e+="g"),null!=t.ignoreCase&&(e+="i"),null!=t.multiline&&(e+="m"),null!=t.sticky&&(e+="y"),new RegExp(t.source,e);a=new t.constructor;for(n in t)a[n]=DocUtils.clone(t[n]);return a},DocUtils.xml2Str=function(t){var e,n,a;if(void 0===t)throw new Error("xmlNode undefined!");try{"undefined"!=typeof global&&null!==global?(e=new XMLSerializer,n=e.serializeToString(t)):n=(new XMLSerializer).serializeToString(t)}catch(e){a=e,n=t.xml}return n=n.replace(/\x20xmlns=""/g,"")},DocUtils.Str2xml=function(t){var n,a;return e.DOMParser?(n=new DOMParser,a=n.parseFromString(t,"text/xml")):(a=new ActiveXObject("Microsoft.XMLDOM"),a.async=!1,a.loadXML(t)),a},DocUtils.replaceFirstFrom=function(t,e,n,a){return t.substr(0,a)+t.substr(a).replace(e,n)},DocUtils.encode_utf8=function(t){return unescape(encodeURIComponent(t))},DocUtils.convert_spaces=function(t){return t.replace(new RegExp(String.fromCharCode(160),"g")," ")},DocUtils.decode_utf8=function(t){var e;try{if(void 0===t)return;return decodeURIComponent(escape(DocUtils.convert_spaces(t)))}catch(n){throw e=n,console.log(t),console.log("could not decode"),new Error("end")}},DocUtils.base64encode=function(t){return btoa(unescape(encodeURIComponent(t)))},DocUtils.preg_match_all=function(t,e){var a,r;return"object"!=typeof t&&(t=new RegExp(t,"g")),a=[],r=function(){var t,e,r,i,s;return t=arguments[0],r=4<=arguments.length?n.call(arguments,1,s=arguments.length-2):(s=1,[]),e=arguments[s++],i=arguments[s++],r.unshift(t),r.offset=e,a.push(r)},e.replace(t,r),a},DocUtils.sizeOfObject=function(t){var e,n,a;a=0,n=0;for(e in t)a++;return a},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)}}.call(this),function(){var t,e,n,a=[].indexOf||function(t){for(var e=0,n=this.length;e=0&&n.push({path:r,files:this.zip.files[r]});return n},t.prototype.setImage=function(t,e,n){return null==n&&(n={}),this.zip.remove(t),this.zip.file(t,e,n)},t.prototype.loadImageRels=function(){var t,e,n;return e=DocUtils.decode_utf8(this.zip.files["word/_rels/document.xml.rels"].asText()),this.xmlDoc=DocUtils.Str2xml(e),t=function(){var t,e,a,r;for(a=this.xmlDoc.getElementsByTagName("Relationship"),r=[],t=0,e=a.length;t0&&this.load(t)}var n,a;return a=["word/document.xml","word/footer1.xml","word/footer2.xml","word/footer3.xml","word/header1.xml","word/header2.xml","word/header3.xml"],n=function(t,e){var n;return n=JSZip.base64.decode("iVBORw0KGgoAAAANSUhEUgAAABcAAAAXCAIAAABvSEP3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACXSURBVDhPtY7BDYAwDAMZhCf7b8YMxeCoatOQJhWc/KGxT2zlCyaWcz8Y+X7Bs1TFVJSwIHIYyFkQufWIRVX9cNJyW1QpEo4rixaEe7JuQagAUctb7ZFYFh5MVJPBe84CVBnB42//YsZRgKjFDBVg3cI9WbRwXLktQJX8cNIiFhM1ZuTWk7PIYSBhkVcLzwIiCjCxhCjlAkBqYnqFoQQ2AAAAAElFTkSuQmCC"),e(n)},t.prototype.setOptions=function(t){if(this.options=t,null!=this.options&&(this.intelligentTagging=null==this.options.intelligentTagging||this.options.intelligentTagging,this.qrCode=null!=this.options.qrCode&&this.options.qrCode,null!=this.options.parser))return this.parser=t.parser},t.prototype.loadFromFile=function(t,e){var n;return null==e&&(e={}),this.setOptions(e),n={success:function(t){return this.successFun=t},successFun:function(){}},null==e.docx&&(e.docx=!1),null==e.async&&(e.async=!1),null==e.callback&&(e.callback=function(t){return function(e){return t.load(e),n.successFun(t)}}(this)),DocUtils.loadDoc(t,e),e.async===!1?this:n},t.prototype.qrCodeCallBack=function(t,e){var n;return null==e&&(e=!0),e===!0?this.qrCodeWaitingFor.push(t):e===!1&&(n=this.qrCodeWaitingFor.indexOf(t),this.qrCodeWaitingFor.splice(n,1)),this.testReady()},t.prototype.testReady=function(){if(0===this.qrCodeWaitingFor.length&&this.filesProcessed===a.length)return this.ready=!0,this.finishedCallback()},t.prototype.getImageList=function(){return this.imgManager.getImageList()},t.prototype.setImage=function(t,e,n){return null==n&&(n={}),null==n.binary&&(n.binary=!0),this.imgManager.setImage(t,e,n)},t.prototype.load=function(t){return this.loadedContent=t,this.zip=new JSZip(t),this.imgManager=new ImgManager(this.zip).loadImageRels(),this},t.prototype.applyTags=function(t,e){var n,r,i,s,l,o;for(this.Tags=null!=t?t:this.Tags,null==e&&(e=null),i=0,l=a.length;i]*>.*?/g,this.xmlTemplater.content),this},t.prototype.replaceImages=function(){var t,e,n,a,r;for(this.qr=[],this.xmlTemplater.numQrCode+=this.imgMatches.length,r=this.imgMatches,e=n=0,a=r.length;n'+t[0]+""),"browser"===e&&(u=p.getElementsByTagNameNS("*","blip")[0]),"node"===e&&(u=p.getElementsByTagName("a:blip")[0]),void 0===u)throw new Error("tagRiD undefined !");if(o=u.getAttribute("r:embed"),l=this.xmlTemplater.DocxGen.imgManager.getImageByRid(o),"browser"===e&&(h=p.getElementsByTagNameNS("*","docPr")[0]),"node"===e&&(h=p.getElementsByTagName("wp:docPr")[0]),void 0===h)throw new Error("tag undefined");if("Copie_"!==h.getAttribute("name").substr(0,6)){if(r=("Copie_"+this.xmlTemplater.imageId+".png").replace(/\x20/,""),this.xmlTemplater.DocxGen.qrCodeNumCallBack++,this.xmlTemplater.DocxGen.qrCodeCallBack(this.xmlTemplater.DocxGen.qrCodeNumCallBack,!0),s=this.xmlTemplater.DocxGen.imgManager.addImageRels(r,""),this.xmlTemplater.imageId++,this.xmlTemplater.DocxGen.setImage("word/media/"+r,l.data),h.setAttribute("name",""+r),u.setAttribute("r:embed","rId"+s),"browser"===e&&(a=p.getElementsByTagNameNS("*","drawing")[0]),"node"===e&&(a=p.getElementsByTagName("w:drawing")[0]),void 0===a)throw new Error("imageTag undefined");return c=DocUtils.xml2Str(a),this.xmlTemplater.content=this.xmlTemplater.content.replace(t[0],c),"browser"===e?(this.qr[n]=new DocxQrCode(l.asBinary(),this.xmlTemplater,r,this.xmlTemplater.DocxGen.qrCodeNumCallBack),this.qr[n].decode(this.imageSetter)):/\.png$/.test(l.name)?function(t){return function(e){var a,r,i,s,o;return a=JSZip.base64.encode(l.asBinary()),r=new Buffer(a,"base64"),o=new PNG(r),s=function(a){var r,i;o.decoded=a;try{return t.qr[n]=new DocxQrCode(o,t.xmlTemplater,e,t.xmlTemplater.DocxGen.qrCodeNumCallBack),t.qr[n].decode(t.imageSetter)}catch(n){return r=n,i={xmlTemplater:t.xmlTemplater,imgName:e,data:l.asBinary()},t.imageSetter(i)}},i=o.decode(s)}}(this)(r):(i={xmlTemplater:this.xmlTemplater,imgName:r,data:l.asBinary()},this.imageSetter(i))}},t}(),n.ImgReplacer=t}.call(this),function(){var t,e,n;n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",t=t=function(){function t(t,n,a,r,i){if(this.xmlTemplater=n,this.imgName=null!=a?a:"",this.num=r,this.callback=i,this.callbacked=!1,this.data=t,void 0===this.data)throw new Error("data of qrcode can't be undefined");"browser"===e&&(this.base64Data=JSZip.base64.encode(this.data)),this.ready=!1,this.result=null}return t.prototype.decode=function(t){var n;return this.callback=t,n=this,this.qr=new QrCode,this.qr.callback=function(){var t;return n.ready=!0,n.result=this.result,t=new n.xmlTemplater.currentClass(this.result,n.xmlTemplater.toJson()),t.applyTags(),n.result=t.content,n.searchImage()},"browser"===e?this.qr.decode("data:image/png;base64,"+this.base64Data):this.qr.decode(this.data,this.data.decoded)},t.prototype.searchImage=function(){var t,e;return"gen:"===this.result.substr(0,4)?(t=function(t){return function(e){return t.data=e,t.callback(t,t.imgName,t.num)}}(this),this.xmlTemplater.DocxGen.localImageCreator(this.result,t)):null!==this.result&&void 0!==this.result&&"error decoding QR Code"!==this.result.substr(0,22)?(e=function(t){return function(e){return t.data=e,t.callback(t,t.imgName,t.num)}}(this),DocUtils.loadDoc(this.result,{docx:!1,callback:e,async:!1})):this.callback(this,this.imgName,this.num)},t}(),n.DocxQrCode=t}.call(this),function(){var t,e,n;n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",n.XmlTemplater=t=function(){function t(t,e){null==t&&(t=""),null==e&&(e={}),this.tagXml="",this.currentClass=n.XmlTemplater,this.fromJson(e),this.templaterState=new TemplaterState,this.currentScope=this.Tags}return t.prototype.load=function(t){var e;return this.content=t,e=new XmlMatcher(this.content).parse(this.tagXml),this.templaterState.matches=e.matches,this.templaterState.charactersAdded=e.charactersAdded},t.prototype.fromJson=function(t){return null==t&&(t={}),this.Tags=null!=t.Tags?t.Tags:{},this.DocxGen=null!=t.DocxGen?t.DocxGen:null,this.intelligentTagging=null!=t.intelligentTagging&&t.intelligentTagging,this.scopePath=null!=t.scopePath?t.scopePath:[],this.usedTags=null!=t.usedTags?t.usedTags:{},this.imageId=null!=t.imageId?t.imageId:0,this.parser=null!=t.parser?t.parser:n.DocUtils.defaultParser,this.scopeManager=new ScopeManager(this.Tags,this.scopePath,this.usedTags,this.Tags,this.parser)},t.prototype.toJson=function(){return{Tags:DocUtils.clone(this.scopeManager.tags),DocxGen:this.DocxGen,intelligentTagging:DocUtils.clone(this.intelligentTagging),scopePath:DocUtils.clone(this.scopeManager.scopePath),usedTags:this.scopeManager.usedTags,localImageCreator:this.localImageCreator,imageId:this.imageId,parser:this.parser}},t.prototype.calcIntellegentlyDashElement=function(){return!1},t.prototype.getFullText=function(t){var e,n,a;return this.tagXml=null!=t?t:this.tagXml,n=new XmlMatcher(this.content).parse(this.tagXml),a=function(){var t,a,r,i;for(r=n.matches,i=[],t=0,a=r.length;t'+n:this.templaterState.matches[a][1]+n,r===!0?i:i+(""+this.tagXml+">"))},t.prototype.replaceXmlTag=function(t,e){var n,a,r,i,s,l,o;if(o=e.xmlTagNumber,n=e.insideValue,s=null==e.spacePreserve||e.spacePreserve,r=null!=e.noStartTag&&e.noStartTag,a=null!=e.noEndTag&&e.noEndTag,i=this.xmlToBeReplaced(r,s,n,o,a),this.templaterState.matches[o][2]=n,l=this.templaterState.calcXmlTagPosition(o),this.templaterState.moveCharacters(o+1,i,this.templaterState.matches[o][0]),t.indexOf(this.templaterState.matches[o][0])===-1)throw new Error("content "+this.templaterState.matches[o][0]+" not found in content");return t=DocUtils.replaceFirstFrom(t,this.templaterState.matches[o][0],i,l),this.templaterState.matches[o][0]=i,t},t.prototype.replaceTagByValue=function(t,e){var n,a,r,i,s,l,o,c,h,u;if(null==e&&(e=this.content),this.templaterState.matches[this.templaterState.tagEnd.numXmlTag][2].indexOf(DocUtils.tags.end)===-1)throw new Error("no closing tag at @templaterState.tagEnd.numXmlTag "+this.templaterState.matches[this.templaterState.tagEnd.numXmlTag][2]);if(this.templaterState.matches[this.templaterState.tagStart.numXmlTag][2].indexOf(DocUtils.tags.start)===-1)throw new Error("no opening tag at @templaterState.tagStart.numXmlTag "+this.templaterState.matches[this.templaterState.tagStart.numXmlTag][2]);if(l=DocUtils.tags.start,n=DocUtils.tags.end,this.templaterState.tagEnd.numXmlTag===this.templaterState.tagStart.numXmlTag)r={xmlTagNumber:this.templaterState.tagStart.numXmlTag,insideValue:this.templaterState.matches[this.templaterState.tagStart.numXmlTag][2].replace(""+l+this.templaterState.textInsideTag+n,t),noStartTag:null!=this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first||null!=this.templaterState.matches[this.templaterState.tagStart.numXmlTag].last},e=this.replaceXmlTag(e,r);else if(this.templaterState.tagEnd.numXmlTag>this.templaterState.tagStart.numXmlTag){for(s=new RegExp("^([^"+l+"]*)"+l+".*$"),o=this.templaterState.matches[this.templaterState.tagStart.numXmlTag][2].match(s),r={xmlTagNumber:this.templaterState.tagStart.numXmlTag},null==this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first&&null==this.templaterState.matches[this.templaterState.tagStart.numXmlTag].last?r.insideValue=o[1]+t:(r.insideValue=t,r.noStartTag=null!=this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first),e=this.replaceXmlTag(e,r),r={insideValue:"",spacePreserve:!1},a=c=h=this.templaterState.tagStart.numXmlTag+1,u=this.templaterState.tagEnd.numXmlTag;h<=u?cu;a=h<=u?++c:--c)r.xmlTagNumber=a,e=this.replaceXmlTag(e,r);i=new RegExp("^[^"+n+"]*"+n+"(.*)$"),r={insideValue:this.templaterState.matches[this.templaterState.tagEnd.numXmlTag][2].replace(i,"$1"),spacePreserve:!0,xmlTagNumber:a,noEndTag:null!=this.templaterState.matches[this.templaterState.tagStart.numXmlTag].last||null!=this.templaterState.matches[this.templaterState.tagStart.numXmlTag].first},e=this.replaceXmlTag(e,r)}return e},t.prototype.replaceLoopTag=function(){var t;return"dash"===this.templaterState.loopType()?this.dashLoop(this.templaterState.loopOpen.element):this.intelligentTagging===!0&&(t=this.calcIntellegentlyDashElement(),t!==!1)?this.dashLoop(t,!0):this.forLoop()},t.prototype.calcSubXmlTemplater=function(t,e){var n,a,r;return n=this.toJson(),null!=e&&null!=e.Tags&&(n.Tags=e.Tags,n.scopePath=n.scopePath.concat(this.templaterState.loopOpen.tag)),a=new this.currentClass(t,n),r=a.applyTags(),this.imageId=a.imageId,r},t.prototype.getOuterXml=function(t,e,n,a){var r,i;if(r=t.indexOf(""+a+">",n),r===-1)throw new Error("can't find endTag "+r);if(r+=(""+a+">").length,i=Math.max(t.lastIndexOf("<"+a+">",e),t.lastIndexOf("<"+a+" ",e)),i===-1)throw new Error("can't find startTag");return{text:t.substr(i,r-i),startTag:i,endTag:r}},t.prototype.forLoop=function(t,e){var n,a;return null==t&&(t=this.templaterState.findInnerTagsContent(this.content).content),null==e&&(e=this.templaterState.findOuterTagsContent(this.content).content),a=this.templaterState.loopOpen.tag,n="",this.scopeManager.loopOver(a,function(e){return function(a){var r;return r=e.calcSubXmlTemplater(t,{Tags:a}),n+=r.content}}(this),this.templaterState.loopIsInverted),null==this.scopeManager.get(a)&&this.calcSubXmlTemplater(t,{Tags:{}}),this.content=this.content.replace(e,n),this.calcSubXmlTemplater(this.content)},t}()}.call(this),function(){var t,e,n,a={}.hasOwnProperty,r=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",n.DocXTemplater=t=function(t){function e(t,a){if(null==t&&(t=""),null==a&&(a={}),e.__super__.constructor.call(this,"",a),this.currentClass=n.DocXTemplater,this.tagXml="w:t","string"!=typeof t)throw new Error("content must be string!");this.load(t)}var a;return r(e,t),a=new XmlUtil,e.prototype.calcIntellegentlyDashElement=function(){var t,n,r,i,s,l,o,c;for(c=this.templaterState.findOuterTagsContent(this.content),t=c.content,i=c.start,n=c.end,r=a.getListXmlElements(this.content,i,n-i),l=0,o=r.length;l"===s.tag)return"w:tr";return e.__super__.calcIntellegentlyDashElement.call(this)},e}(XmlTemplater)}.call(this),function(){var t,e,n,a=[].slice;n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",n.XmlMatcher=t=function(){function t(t){this.content=t}return t.prototype.parse=function(t){var e;return this.tagXml=t,this.matches=DocUtils.preg_match_all("(<"+this.tagXml+"[^>]*>)([^<>]*)"+this.tagXml+">",this.content),this.charactersAdded=function(){var t,n,a;for(a=[],e=t=0,n=this.matches.length;0<=n?tn;e=0<=n?++t:--t)a.push(0);return a}.call(this),this.handleRecursiveCase(),this},t.prototype.handleRecursiveCase=function(){var t,e,n;return n=function(t){return function(){var e,n,r,i,s;return e=arguments[0],r=4<=arguments.length?a.call(arguments,1,s=arguments.length-2):(s=1,[]),n=arguments[s++],i=arguments[s++],
r.unshift(e),r.offset=n,r.first=!0,t.matches.unshift(r),t.charactersAdded.unshift(0)}}(this),this.content.replace(/^()([^<]+)/,n),e=function(t){return function(){var e,n,r,i,s;return e=arguments[0],r=4<=arguments.length?a.call(arguments,1,s=arguments.length-2):(s=1,[]),n=arguments[s++],i=arguments[s++],r.unshift(e),r.offset=n,r.last=!0,t.matches.push(r),t.charactersAdded.push(0)}}(this),t="(<"+this.tagXml+"[^>]*>)([^>]+)$",this.content.replace(new RegExp(t),e),this},t}()}.call(this),function(){var t,e,n;n="undefined"!=typeof global&&null!==global?global:window,e="undefined"!=typeof global&&null!==global?"node":"browser",n.ScopeManager=t=function(){function t(t,e,n,a,r){this.tags=t,this.scopePath=e,this.usedTags=n,this.currentScope=a,this.parser=r}return t.prototype.loopOver=function(t,e,n){var a,r,i,s,l;if(null==n&&(n=!1),n){if(!this.getValue(t))return e(this.currentScope);if("string"===this.getTypeOf(t))return;return void("object"===this.getTypeOf(t)&&this.getValue(t).length<1&&e(this.currentScope))}if(null!=this.getValue(t)){if("object"===this.getTypeOf(t))for(l=this.getValue(t),a=i=0,s=l.length;i",this.end),this.end===-1)throw new Error("can't find endTag "+this.end);if(this.end+=(""+t+">").length,this.start=Math.max(this.fullText.lastIndexOf("<"+t+">",this.start),this.fullText.lastIndexOf("<"+t+" ",this.start)),this.start===-1)throw new Error("can't find startTag");return this.refreshText()},t.prototype.replace=function(t){return this.fullText=this.fullText.substr(0,this.start)+t+this.fullText.substr(this.end),this.end=this.start+t.length,this.refreshText()},t}()}.call(this);