UNPKG

@tomei/finance

Version:

NestJS package for finance module

1 lines 226 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.jspdf=e()}(this,function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},e=function(e){var n="1.3",r={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};function i(t){var n={};this.subscribe=function(t,e,r){if("function"!=typeof e)return!1;n.hasOwnProperty(t)||(n[t]={});var i=Math.random().toString(35);return n[t][i]=[e,!!r],i},this.unsubscribe=function(t){for(var e in n)if(n[e][t])return delete n[e][t],!0;return!1},this.publish=function(r){if(n.hasOwnProperty(r)){var i=Array.prototype.slice.call(arguments,1),o=[];for(var s in n[r]){var a=n[r][s];try{a[0].apply(t,i)}catch(t){e.console&&console.error("jsPDF PubSub Error",t.message,t)}a[1]&&o.push(s)}o.length&&o.forEach(this.unsubscribe)}}}function o(s,a,c,l){var u={};"object"===(void 0===s?"undefined":t(s))&&(s=(u=s).orientation,a=u.unit||a,c=u.format||c,l=u.compress||u.compressPdf||l),a=a||"mm",c=c||"a4",s=(""+(s||"P")).toLowerCase();(""+c).toLowerCase();var h,f,d,p,g,m,w,y,v,b,x=!!l&&"function"==typeof Uint8Array,k=u.textColor||"0 g",_=u.drawColor||"0 G",C=u.fontSize||16,S=u.lineHeight||1.15,T=u.lineWidth||.200025,I=2,P=!1,E=[],O={},F={},R=0,B=[],D=[],j=[],N=[],z=[],L=0,M=0,U=0,H={title:"",subject:"",author:"",keywords:"",creator:""},W={},X=new i(W),V=function(t){return t.toFixed(2)},Y=function(t){return t.toFixed(3)},G=function(t){return("0"+parseInt(t)).slice(-2)},J=function(t){P?B[p].push(t):(U+=t.length+1,N.push(t))},Q=function(){return E[++I]=U,J(I+" 0 obj"),I},K=function(t){J("stream"),J(t),J("endstream")},$=function(){for(var t in J("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),J("/Font <<"),O)O.hasOwnProperty(t)&&J("/"+t+" "+O[t].objectNumber+" 0 R");J(">>"),J("/XObject <<"),X.publish("putXobjectDict"),J(">>")},Z=function(){!function(){for(var t in O)O.hasOwnProperty(t)&&((e=O[t]).objectNumber=Q(),J("<</BaseFont/"+e.PostScriptName+"/Type/Font"),"string"==typeof e.encoding&&J("/Encoding/"+e.encoding),J("/Subtype/Type1>>"),J("endobj"));var e}(),X.publish("putResources"),E[2]=U,J("2 0 obj"),J("<<"),$(),J(">>"),J("endobj"),X.publish("postPutResources")},tt=function(t,e,n){F.hasOwnProperty(e)||(F[e]={}),F[e][n]=t},et=function(t,e,n,r){var i="F"+(Object.keys(O).length+1).toString(10),o=O[i]={id:i,PostScriptName:t,fontName:e,fontStyle:n,encoding:r,metadata:{}};return tt(i,e,n),X.publish("addFont",o),i},nt=function(t,e){return function(t,e){var n,r,i,o,s,a,c,l,u;if(i=(e=e||{}).sourceEncoding||"Unicode",s=e.outputEncoding,(e.autoencode||s)&&O[h].metadata&&O[h].metadata[i]&&O[h].metadata[i].encoding&&(o=O[h].metadata[i].encoding,!s&&O[h].encoding&&(s=O[h].encoding),!s&&o.codePages&&(s=o.codePages[0]),"string"==typeof s&&(s=o[s]),s)){for(c=!1,a=[],n=0,r=t.length;n<r;n++)(l=s[t.charCodeAt(n)])?a.push(String.fromCharCode(l)):a.push(t[n]),a[n].charCodeAt(0)>>8&&(c=!0);t=a.join("")}for(n=t.length;void 0===c&&0!==n;)t.charCodeAt(n-1)>>8&&(c=!0),n--;if(!c)return t;for(a=e.noBOM?[]:[254,255],n=0,r=t.length;n<r;n++){if((u=(l=t.charCodeAt(n))>>8)>>8)throw new Error("Character at position "+n+" of string '"+t+"' exceeds 16bits. Cannot be encoded into Utm_2 BE");a.push(u),a.push(l-(u<<8))}return String.fromCharCode.apply(void 0,a)}(t,e).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},rt=function(){(function(t,e){var n="string"==typeof e&&e.toLowerCase();if("string"==typeof t){var i=t.toLowerCase();r.hasOwnProperty(i)&&(t=r[i][0]/f,e=r[i][1]/f)}if(Array.isArray(t)&&(e=t[1],t=t[0]),n){switch(n.substr(0,1)){case"l":e>t&&(n="s");break;case"p":t>e&&(n="s")}"s"===n&&(d=t,t=e,e=d)}P=!0,B[++R]=[],j[R]={width:Number(t)||g,height:Number(e)||m},D[R]={},it(R)}).apply(this,arguments),J(V(T*f)+" w"),J(_),0!==L&&J(L+" J"),0!==M&&J(M+" j"),X.publish("addPage",{pageNumber:R})},it=function(t){t>0&&t<=R&&(p=t,g=j[t].width,m=j[t].height)},ot=function(t,e){var n;switch(t=void 0!==t?t:O[h].fontName,e=void 0!==e?e:O[h].fontStyle,void 0!==t&&(t=t.toLowerCase()),t){case"sans-serif":case"verdana":case"arial":case"helvetica":t="helvetica";break;case"fixed":case"monospace":case"terminal":case"courier":t="courier";break;case"serif":case"cursive":case"fantasy":default:t="times"}try{n=F[t][e]}catch(t){}return n||null==(n=F.times[e])&&(n=F.times.normal),n},st=function(){P=!1,I=2,U=0,N=[],E=[],z=[],X.publish("buildDocument"),J("%PDF-"+n),function(){var t,n,r,i,s,a,c,l,u,h=[];for(c=e.adler32cs||o.adler32cs,x&&void 0===c&&(x=!1),t=1;t<=R;t++){if(h.push(Q()),l=(g=j[t].width)*f,u=(m=j[t].height)*f,J("<</Type /Page"),J("/Parent 1 0 R"),J("/Resources 2 0 R"),J("/MediaBox [0 0 "+V(l)+" "+V(u)+"]"),X.publish("putPage",{pageNumber:t,page:B[t]}),J("/Contents "+(I+1)+" 0 R"),J(">>"),J("endobj"),n=B[t].join("\n"),Q(),x){for(r=[],i=n.length;i--;)r[i]=n.charCodeAt(i);a=c.from(n),(s=new q(6)).append(new Uint8Array(r)),n=s.flush(),(r=new Uint8Array(n.length+6)).set(new Uint8Array([120,156])),r.set(n,2),r.set(new Uint8Array([255&a,a>>8&255,a>>16&255,a>>24&255]),n.length+2),n=String.fromCharCode.apply(null,r),J("<</Length "+n.length+" /Filter [/FlateDecode]>>")}else J("<</Length "+n.length+">>");K(n),J("endobj")}E[1]=U,J("1 0 obj"),J("<</Type /Pages");var d="/Kids [";for(i=0;i<R;i++)d+=h[i]+" 0 R ";J(d+"]"),J("/Count "+R),J(">>"),J("endobj"),X.publish("postPutPages")}(),function(){X.publish("putAdditionalObjects");for(var t=0;t<z.length;t++){var e=z[t];E[e.objId]=U,J(e.objId+" 0 obj"),J(e.content),J("endobj")}I+=z.length,X.publish("postPutAdditionalObjects")}(),Z(),Q(),J("<<"),function(){for(var t in J("/Producer (jsPDF "+o.version+")"),H)H.hasOwnProperty(t)&&H[t]&&J("/"+t.substr(0,1).toUpperCase()+t.substr(1)+" ("+nt(H[t])+")");var e=new Date,n=e.getTimezoneOffset(),r=n<0?"+":"-",i=Math.floor(Math.abs(n/60)),s=Math.abs(n%60),a=[r,G(i),"'",G(s),"'"].join("");J(["/CreationDate (D:",e.getFullYear(),G(e.getMonth()+1),G(e.getDate()),G(e.getHours()),G(e.getMinutes()),G(e.getSeconds()),a,")"].join(""))}(),J(">>"),J("endobj"),Q(),J("<<"),function(){switch(J("/Type /Catalog"),J("/Pages 1 0 R"),y||(y="fullwidth"),y){case"fullwidth":J("/OpenAction [3 0 R /FitH null]");break;case"fullheight":J("/OpenAction [3 0 R /FitV null]");break;case"fullpage":J("/OpenAction [3 0 R /Fit]");break;case"original":J("/OpenAction [3 0 R /XYZ null null 1]");break;default:var t=""+y;"%"===t.substr(t.length-1)&&(y=parseInt(y)/100),"number"==typeof y&&J("/OpenAction [3 0 R /XYZ null null "+V(y)+"]")}switch(v||(v="continuous"),v){case"continuous":J("/PageLayout /OneColumn");break;case"single":J("/PageLayout /SinglePage");break;case"two":case"twoleft":J("/PageLayout /TwoColumnLeft");break;case"tworight":J("/PageLayout /TwoColumnRight")}w&&J("/PageMode /"+w),X.publish("putCatalog")}(),J(">>"),J("endobj");var t,r=U,i="0000000000";for(J("xref"),J("0 "+(I+1)),J(i+" 65535 f "),t=1;t<=I;t++){var s=E[t];J("function"==typeof s?(i+E[t]()).slice(-10)+" 00000 n ":(i+E[t]).slice(-10)+" 00000 n ")}return J("trailer"),J("<<"),J("/Size "+(I+1)),J("/Root "+I+" 0 R"),J("/Info "+(I-1)+" 0 R"),J(">>"),J("startxref"),J(""+r),J("%%EOF"),P=!0,N.join("\n")},at=function(t){var e="S";return"F"===t?e="f":"FD"===t||"DF"===t?e="B":"f"!==t&&"f*"!==t&&"B"!==t&&"B*"!==t||(e=t),e},ct=function(){for(var t=st(),e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n);e--;)r[e]=t.charCodeAt(e);return n},lt=function(){return new Blob([ct()],{type:"application/pdf"})},ut=((b=function(t,n){var r="dataur"===(""+t).substr(0,6)?"data:application/pdf;base64,"+btoa(st()):0;switch(t){case void 0:return st();case"save":if(navigator.getUserMedia&&(void 0===e.URL||void 0===e.URL.createObjectURL))return W.output("dataurlnewwindow");A(lt(),n),"function"==typeof A.unload&&e.setTimeout&&setTimeout(A.unload,911);break;case"arraybuffer":return ct();case"blob":return lt();case"bloburi":case"bloburl":return e.URL&&e.URL.createObjectURL(lt())||void 0;case"datauristring":case"dataurlstring":return r;case"dataurlnewwindow":var i=e.open(r);if(i||"undefined"==typeof safari)return i;case"datauri":case"dataurl":return e.document.location.href=r;default:throw new Error('Output type "'+t+'" is not supported.')}}).foo=function(){try{return b.apply(this,arguments)}catch(r){var t=r.stack||"";~t.indexOf(" at ")&&(t=t.split(" at ")[1]);var n="Error in function "+t.split("\n")[0].split("<")[0]+": "+r.message;if(!e.console)throw new Error(n);e.console.error(n,r),e.alert&&alert(n)}},b.foo.bar=b,b.foo);switch(a){case"pt":f=1;break;case"mm":f=72/25.4000508;break;case"cm":f=72/2.54000508;break;case"in":f=72;break;case"px":f=96/72;break;case"pc":case"em":f=12;break;case"ex":f=6;break;default:throw"Invalid unit: "+a}for(var ht in W.internal={pdfEscape:nt,getStyle:at,getFont:function(){return O[ot.apply(W,arguments)]},getFontSize:function(){return C},getLineHeight:function(){return C*S},write:function(t){J(1===arguments.length?t:Array.prototype.join.call(arguments," "))},getCoordinateString:function(t){return V(t*f)},getVerticalCoordinateString:function(t){return V((m-t)*f)},collections:{},newObject:Q,newAdditionalObject:function(){var t=2*B.length+1,e={objId:t+=z.length,content:""};return z.push(e),e},newObjectDeferred:function(){return E[++I]=function(){return U},I},newObjectDeferredBegin:function(t){E[t]=U},putStream:K,events:X,scaleFactor:f,pageSize:{get width(){return g},get height(){return m}},output:function(t,e){return ut(t,e)},getNumberOfPages:function(){return B.length-1},pages:B,out:J,f2:V,getPageInfo:function(t){return{objId:2*(t-1)+3,pageNumber:t,pageContext:D[t]}},getCurrentPageInfo:function(){return{objId:2*(p-1)+3,pageNumber:p,pageContext:D[p]}},getPDFVersion:function(){return n}},W.addPage=function(){return rt.apply(this,arguments),this},W.setPage=function(){return it.apply(this,arguments),this},W.insertPage=function(t){return this.addPage(),this.movePage(p,t),this},W.movePage=function(t,e){if(t>e){for(var n=B[t],r=j[t],i=D[t],o=t;o>e;o--)B[o]=B[o-1],j[o]=j[o-1],D[o]=D[o-1];B[e]=n,j[e]=r,D[e]=i,this.setPage(e)}else if(t<e){for(n=B[t],r=j[t],i=D[t],o=t;o<e;o++)B[o]=B[o+1],j[o]=j[o+1],D[o]=D[o+1];B[e]=n,j[e]=r,D[e]=i,this.setPage(e)}return this},W.deletePage=function(){return function(t){t>0&&t<=R&&(B.splice(t,1),j.splice(t,1),p>--R&&(p=R),this.setPage(p))}.apply(this,arguments),this},W.setDisplayMode=function(t,e,n){return y=t,v=e,w=n,this},W.text=function(t,e,n,r,i,o){function s(t){return t=t.split("\t").join(Array(u.TabLen||9).join(" ")),nt(t,r)}"number"==typeof t&&(d=n,n=e,e=t,t=d),"string"==typeof t&&(t=t.match(/[\n\r]/)?t.split(/\r\n|\r|\n/g):[t]),"string"==typeof i&&(o=i,i=null),"string"==typeof r&&(o=r,r=null),"number"==typeof r&&(i=r,r=null);var a="",c="Td";if(i){i*=Math.PI/180;var l=Math.cos(i),p=Math.sin(i);a=[V(l),V(p),V(-1*p),V(l),""].join(" "),c="Tm"}"noBOM"in(r=r||{})||(r.noBOM=!0),"autoencode"in r||(r.autoencode=!0);var g,w="",y=this.internal.getCurrentPageInfo().pageContext;if(!0===r.stroke?!0!==y.lastTextWasStroke&&(w="1 Tr\n",y.lastTextWasStroke=!0):(y.lastTextWasStroke&&(w="0 Tr\n"),y.lastTextWasStroke=!1),void 0===this._runningPageHeight&&(this._runningPageHeight=0),"string"==typeof t)t=s(t);else{if("[object Array]"!==Object.prototype.toString.call(t))throw new Error('Type of text must be string or Array. "'+t+'" is not recognized.');for(var v=t.concat(),b=[],x=v.length;x--;)b.push(s(v.shift()));var _=Math.ceil((m-n-this._runningPageHeight)*f/(C*S));if(0<=_&&b.length,o){var A,q,T,I=C*S,P=t.map(function(t){return this.getStringUnitWidth(t)*C/f},this);if(T=Math.max.apply(Math,P),"center"===o)A=e-T/2,e-=P[0]/2;else{if("right"!==o)throw new Error('Unrecognized alignment option, use "center" or "right".');A=e-T,e-=P[0]}q=e,t=b[0];var E=1;for(x=b.length;E<x;E++){var O=T-P[E];"center"===o&&(O/=2),t+=") Tj\n"+(A-q+O)+" -"+I+" Td ("+b[E],q=A+O}}else t=b.join(") Tj\nT* (")}return g=V((m-n)*f),J("BT\n/"+h+" "+C+" Tf\n"+C*S+" TL\n"+w+k+"\n"+a+V(e*f)+" "+g+" "+c+"\n("+t+") Tj\nET"),this},W.lstext=function(t,e,n,r){for(var i=0,o=t.length;i<o;i++,e+=r)this.text(t[i],e,n)},W.line=function(t,e,n,r){return this.lines([[n-t,r-e]],t,e)},W.clip=function(){J("W"),J("S")},W.clip_fixed=function(t){J("evenodd"===t?"W*":"W"),J("n")},W.lines=function(t,e,n,r,i,o){var s,a,c,l,u,h,p,g,w,y,v;for("number"==typeof t&&(d=n,n=e,e=t,t=d),r=r||[1,1],J(Y(e*f)+" "+Y((m-n)*f)+" m "),s=r[0],a=r[1],l=t.length,y=e,v=n,c=0;c<l;c++)2===(u=t[c]).length?(y=u[0]*s+y,v=u[1]*a+v,J(Y(y*f)+" "+Y((m-v)*f)+" l")):(h=u[0]*s+y,p=u[1]*a+v,g=u[2]*s+y,w=u[3]*a+v,y=u[4]*s+y,v=u[5]*a+v,J(Y(h*f)+" "+Y((m-p)*f)+" "+Y(g*f)+" "+Y((m-w)*f)+" "+Y(y*f)+" "+Y((m-v)*f)+" c"));return o&&J(" h"),null!==i&&J(at(i)),this},W.rect=function(t,e,n,r,i){at(i);return J([V(t*f),V((m-e)*f),V(n*f),V(-r*f),"re"].join(" ")),null!==i&&J(at(i)),this},W.triangle=function(t,e,n,r,i,o,s){return this.lines([[n-t,r-e],[i-n,o-r],[t-i,e-o]],t,e,[1,1],s,!0),this},W.roundedRect=function(t,e,n,r,i,o,s){var a=4/3*(Math.SQRT2-1);return this.lines([[n-2*i,0],[i*a,0,i,o-o*a,i,o],[0,r-2*o],[0,o*a,-i*a,o,-i,o],[2*i-n,0],[-i*a,0,-i,-o*a,-i,-o],[0,2*o-r],[0,-o*a,i*a,-o,i,-o]],t+i,e,[1,1],s),this},W.ellipse=function(t,e,n,r,i){var o=4/3*(Math.SQRT2-1)*n,s=4/3*(Math.SQRT2-1)*r;return J([V((t+n)*f),V((m-e)*f),"m",V((t+n)*f),V((m-(e-s))*f),V((t+o)*f),V((m-(e-r))*f),V(t*f),V((m-(e-r))*f),"c"].join(" ")),J([V((t-o)*f),V((m-(e-r))*f),V((t-n)*f),V((m-(e-s))*f),V((t-n)*f),V((m-e)*f),"c"].join(" ")),J([V((t-n)*f),V((m-(e+s))*f),V((t-o)*f),V((m-(e+r))*f),V(t*f),V((m-(e+r))*f),"c"].join(" ")),J([V((t+o)*f),V((m-(e+r))*f),V((t+n)*f),V((m-(e+s))*f),V((t+n)*f),V((m-e)*f),"c"].join(" ")),null!==i&&J(at(i)),this},W.circle=function(t,e,n,r){return this.ellipse(t,e,n,n,r)},W.setProperties=function(t){for(var e in H)H.hasOwnProperty(e)&&t[e]&&(H[e]=t[e]);return this},W.setFontSize=function(t){return C=t,this},W.setFont=function(t,e){return h=ot(t,e),this},W.setFontStyle=W.setFontType=function(t){return h=ot(void 0,t),this},W.getFontList=function(){var t,e,n,r={};for(t in F)if(F.hasOwnProperty(t))for(e in r[t]=n=[],F[t])F[t].hasOwnProperty(e)&&n.push(e);return r},W.addFont=function(t,e,n){et(t,e,n,"StandardEncoding")},W.setLineWidth=function(t){return J((t*f).toFixed(2)+" w"),this},W.setDrawColor=function(t,e,n,r){var i;return i=void 0===e||void 0===r&&t===e===n?"string"==typeof t?t+" G":V(t/255)+" G":void 0===r?"string"==typeof t?[t,e,n,"RG"].join(" "):[V(t/255),V(e/255),V(n/255),"RG"].join(" "):"string"==typeof t?[t,e,n,r,"K"].join(" "):[V(t),V(e),V(n),V(r),"K"].join(" "),J(i),this},W.setFillColor=function(e,n,r,i){var o;return void 0===n||void 0===i&&e===n===r?o="string"==typeof e?e+" g":V(e/255)+" g":void 0===i||"object"===(void 0===i?"undefined":t(i))?(o="string"==typeof e?[e,n,r,"rg"].join(" "):[V(e/255),V(n/255),V(r/255),"rg"].join(" "),i&&0===i.a&&(o=["255","255","255","rg"].join(" "))):o="string"==typeof e?[e,n,r,i,"k"].join(" "):[V(e),V(n),V(r),V(i),"k"].join(" "),J(o),this},W.setTextColor=function(t,e,n){if("string"==typeof t&&/^#[0-9A-Fa-f]{6}$/.test(t)){var r=parseInt(t.substr(1),16);t=r>>16&255,e=r>>8&255,n=255&r}return k=0===t&&0===e&&0===n||void 0===e?Y(t/255)+" g":[Y(t/255),Y(e/255),Y(n/255),"rg"].join(" "),this},W.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2},W.setLineCap=function(t){var e=this.CapJoinStyles[t];if(void 0===e)throw new Error("Line cap style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return L=e,J(e+" J"),this},W.setLineJoin=function(t){var e=this.CapJoinStyles[t];if(void 0===e)throw new Error("Line join style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return M=e,J(e+" j"),this},W.output=ut,W.save=function(t){W.output("save",t)},o.API)o.API.hasOwnProperty(ht)&&("events"===ht&&o.API.events.length?function(t,e){var n,r,i;for(i=e.length-1;-1!==i;i--)n=e[i][0],r=e[i][1],t.subscribe.apply(t,[n].concat("function"==typeof r?[r]:r))}(X,o.API.events):W[ht]=o.API[ht]);return function(){for(var t=[["Helvetica","helvetica","normal"],["Helvetica-Bold","helvetica","bold"],["Helvetica-Oblique","helvetica","italic"],["Helvetica-BoldOblique","helvetica","bolditalic"],["Courier","courier","normal"],["Courier-Bold","courier","bold"],["Courier-Oblique","courier","italic"],["Courier-BoldOblique","courier","bolditalic"],["Times-Roman","times","normal"],["Times-Bold","times","bold"],["Times-Italic","times","italic"],["Times-BoldItalic","times","bolditalic"],["ZapfDingbats","zapfdingbats"]],e=0,n=t.length;e<n;e++){var r=et(t[e][0],t[e][1],t[e][2],"StandardEncoding"),i=t[e][0].split("-");tt(r,i[0],i[1]||"")}X.publish("addFonts",{fonts:O,dictionary:F})}(),h="F1",rt(c,s),X.publish("initialized"),W}return o.API={events:[]},o.version="1.3.2 2016-09-30T20:33:17.116Z:jameshall","function"==typeof define&&define.amd?define("jsPDF",function(){return o}):"undefined"!=typeof module&&module.exports?module.exports=o:e.jsPDF=o,o}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||void 0);window.tmp=e,(window.AcroForm=function(t){var n=window.AcroForm;n.scale=function(t){return t*(r.internal.scaleFactor/1)},n.antiScale=function(t){return 1/r.internal.scaleFactor*t};var r={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null};e.API.acroformPlugin=r;var i=function(){for(var t in this.acroformPlugin.acroFormDictionaryRoot.Fields){var e=this.acroformPlugin.acroFormDictionaryRoot.Fields[t];e.hasAnnotation&&o.call(this,e)}},o=function(t){var n={type:"reference",object:t};e.API.annotationPlugin.annotations[this.internal.getPageInfo(t.page).pageNumber].push(n)},s=function(t){this.acroformPlugin.printedOut&&(this.acroformPlugin.printedOut=!1,this.acroformPlugin.acroFormDictionaryRoot=null),this.acroformPlugin.acroFormDictionaryRoot||function(){if(this.acroformPlugin.acroFormDictionaryRoot)throw new Error("Exception while creating AcroformDictionary");this.acroformPlugin.acroFormDictionaryRoot=new n.AcroFormDictionary,this.acroformPlugin.internal=this.internal,this.acroformPlugin.acroFormDictionaryRoot._eventID=this.internal.events.subscribe("postPutResources",c),this.internal.events.subscribe("buildDocument",i),this.internal.events.subscribe("putCatalog",a),this.internal.events.subscribe("postPutPages",l)}.call(this),this.acroformPlugin.acroFormDictionaryRoot.Fields.push(t)},a=function(){void 0!==this.acroformPlugin.acroFormDictionaryRoot?this.internal.write("/AcroForm "+this.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R"):console.log("Root missing...")},c=function(){this.internal.events.unsubscribe(this.acroformPlugin.acroFormDictionaryRoot._eventID),delete this.acroformPlugin.acroFormDictionaryRoot._eventID,this.acroformPlugin.printedOut=!0},l=function(t){var e=!t;t||(this.internal.newObjectDeferredBegin(this.acroformPlugin.acroFormDictionaryRoot.objId),this.internal.out(this.acroformPlugin.acroFormDictionaryRoot.getString()));t=t||this.acroformPlugin.acroFormDictionaryRoot.Kids;for(var r in t){var i=t[r],o=i.Rect;i.Rect&&(i.Rect=n.internal.calculateCoordinates.call(this,i.Rect)),this.internal.newObjectDeferredBegin(i.objId);var s="";if(s+=i.objId+" 0 obj\n",s+="<<\n"+i.getContent(),i.Rect=o,i.hasAppearanceStream&&!i.appearanceStreamContent){var a=n.internal.calculateAppearanceStream.call(this,i);s+="/AP << /N "+a+" >>\n",this.acroformPlugin.xForms.push(a)}if(i.appearanceStreamContent){for(var c in s+="/AP << ",i.appearanceStreamContent){var l=i.appearanceStreamContent[c];if(s+="/"+c+" ",s+="<< ",Object.keys(l).length>=1||Array.isArray(l))for(var r in l){var h;"function"==typeof(h=l[r])&&(h=h.call(this,i)),s+="/"+r+" "+h+" ",this.acroformPlugin.xForms.indexOf(h)>=0||this.acroformPlugin.xForms.push(h)}else"function"==typeof(h=l)&&(h=h.call(this,i)),s+="/"+r+" "+h+" \n",this.acroformPlugin.xForms.indexOf(h)>=0||this.acroformPlugin.xForms.push(h);s+=" >>\n"}s+=">>\n"}s+=">>\nendobj\n",this.internal.out(s)}e&&u.call(this,this.acroformPlugin.xForms)},u=function(t){for(var e in t){var n=e,r=t[e];this.internal.newObjectDeferredBegin(r&&r.objId);var i="";i+=r?r.getString():"",this.internal.out(i),delete t[n]}};t.addField=function(t){return t instanceof n.TextField?f.call(this,t):t instanceof n.ChoiceField?d.call(this,t):t instanceof n.Button?h.call(this,t):t instanceof n.ChildClass?s.call(this,t):t&&s.call(this,t),t.page=this.acroformPlugin.internal.getCurrentPageInfo().pageNumber,this};var h=function(t){(t=t||new n.Field).FT="/Btn";var e=t.Ff||0;t.pushbutton&&(e=n.internal.setBitPosition(e,17),delete t.pushbutton),t.radio&&(e=n.internal.setBitPosition(e,16),delete t.radio),t.noToggleToOff&&(e=n.internal.setBitPosition(e,15)),t.Ff=e,s.call(this,t)},f=function(t){(t=t||new n.Field).FT="/Tx";var e=t.Ff||0;t.multiline&&(e|=4096),t.password&&(e|=8192),t.fileSelect&&(e|=1<<20),t.doNotSpellCheck&&(e|=1<<22),t.doNotScroll&&(e|=1<<23),t.Ff=t.Ff||e,s.call(this,t)},d=function(t){var e=t||new n.Field;e.FT="/Ch";var r=e.Ff||0;e.combo&&(r=n.internal.setBitPosition(r,18),delete e.combo),e.edit&&(r=n.internal.setBitPosition(r,19),delete e.edit),e.sort&&(r=n.internal.setBitPosition(r,20),delete e.sort),e.multiSelect&&this.internal.getPDFVersion()>=1.4&&(r=n.internal.setBitPosition(r,22),delete e.multiSelect),e.doNotSpellCheck&&this.internal.getPDFVersion()>=1.4&&(r=n.internal.setBitPosition(r,23),delete e.doNotSpellCheck),e.Ff=r,s.call(this,e)}})(e.API);var n,i,o,s,a,c,l,u,h,f,d,p,m,w,y,v,x,k,_,C=window.AcroForm;C.internal={},C.createFormXObject=function(t){var e=new C.FormXObject,n=C.Appearance.internal.getHeight(t)||0,r=C.Appearance.internal.getWidth(t)||0;return e.BBox=[0,0,r,n],e},C.Appearance={CheckBox:{createAppearanceStream:function(){return{N:{On:C.Appearance.CheckBox.YesNormal},D:{On:C.Appearance.CheckBox.YesPushDown,Off:C.Appearance.CheckBox.OffPushDown}}},createMK:function(){return"<< /CA (3)>>"},YesPushDown:function(t){var e=C.createFormXObject(t),n="";t.Q=1;var r=C.internal.calculateX(t,"3","ZapfDingbats",50);return n+="0.749023 g\n 0 0 "+C.Appearance.internal.getWidth(t)+" "+C.Appearance.internal.getHeight(t)+" re\n f\n BMC\n q\n 0 0 1 rg\n /F13 "+r.fontSize+" Tf 0 g\n BT\n",n+=r.text,n+="ET\n Q\n EMC\n",e.stream=n,e},YesNormal:function(t){var e=C.createFormXObject(t),n="";t.Q=1;var r=C.internal.calculateX(t,"3","ZapfDingbats",.9*C.Appearance.internal.getHeight(t));return n+="1 g\n0 0 "+C.Appearance.internal.getWidth(t)+" "+C.Appearance.internal.getHeight(t)+" re\nf\nq\n0 0 1 rg\n0 0 "+(C.Appearance.internal.getWidth(t)-1)+" "+(C.Appearance.internal.getHeight(t)-1)+" re\nW\nn\n0 g\nBT\n/F13 "+r.fontSize+" Tf 0 g\n",n+=r.text,n+="ET\n Q\n",e.stream=n,e},OffPushDown:function(t){var e=C.createFormXObject(t),n="";return n+="0.749023 g\n 0 0 "+C.Appearance.internal.getWidth(t)+" "+C.Appearance.internal.getHeight(t)+" re\n f\n",e.stream=n,e}},RadioButton:{Circle:{createAppearanceStream:function(t){var e={D:{Off:C.Appearance.RadioButton.Circle.OffPushDown},N:{}};return e.N[t]=C.Appearance.RadioButton.Circle.YesNormal,e.D[t]=C.Appearance.RadioButton.Circle.YesPushDown,e},createMK:function(){return"<< /CA (l)>>"},YesNormal:function(t){var e=C.createFormXObject(t),n="",r=C.Appearance.internal.getWidth(t)<=C.Appearance.internal.getHeight(t)?C.Appearance.internal.getWidth(t)/4:C.Appearance.internal.getHeight(t)/4;r*=.9;var i=C.Appearance.internal.Bezier_C;return n+="q\n1 0 0 1 "+C.Appearance.internal.getWidth(t)/2+" "+C.Appearance.internal.getHeight(t)/2+" cm\n"+r+" 0 m\n"+r+" "+r*i+" "+r*i+" "+r+" 0 "+r+" c\n-"+r*i+" "+r+" -"+r+" "+r*i+" -"+r+" 0 c\n-"+r+" -"+r*i+" -"+r*i+" -"+r+" 0 -"+r+" c\n"+r*i+" -"+r+" "+r+" -"+r*i+" "+r+" 0 c\nf\nQ\n",e.stream=n,e},YesPushDown:function(t){var e=C.createFormXObject(t),n="",r=C.Appearance.internal.getWidth(t)<=C.Appearance.internal.getHeight(t)?C.Appearance.internal.getWidth(t)/4:C.Appearance.internal.getHeight(t)/4,i=2*(r*=.9),o=i*C.Appearance.internal.Bezier_C,s=r*C.Appearance.internal.Bezier_C;return n+="0.749023 g\n q\n 1 0 0 1 "+C.Appearance.internal.getWidth(t)/2+" "+C.Appearance.internal.getHeight(t)/2+" cm\n"+i+" 0 m\n"+i+" "+o+" "+o+" "+i+" 0 "+i+" c\n-"+o+" "+i+" -"+i+" "+o+" -"+i+" 0 c\n-"+i+" -"+o+" -"+o+" -"+i+" 0 -"+i+" c\n"+o+" -"+i+" "+i+" -"+o+" "+i+" 0 c\n f\n Q\n 0 g\n q\n 1 0 0 1 "+C.Appearance.internal.getWidth(t)/2+" "+C.Appearance.internal.getHeight(t)/2+" cm\n"+r+" 0 m\n"+r+" "+s+" "+s+" "+r+" 0 "+r+" c\n-"+s+" "+r+" -"+r+" "+s+" -"+r+" 0 c\n-"+r+" -"+s+" -"+s+" -"+r+" 0 -"+r+" c\n"+s+" -"+r+" "+r+" -"+s+" "+r+" 0 c\n f\n Q\n",e.stream=n,e},OffPushDown:function(t){var e=C.createFormXObject(t),n="",r=C.Appearance.internal.getWidth(t)<=C.Appearance.internal.getHeight(t)?C.Appearance.internal.getWidth(t)/4:C.Appearance.internal.getHeight(t)/4,i=2*(r*=.9),o=i*C.Appearance.internal.Bezier_C;return n+="0.749023 g\n q\n 1 0 0 1 "+C.Appearance.internal.getWidth(t)/2+" "+C.Appearance.internal.getHeight(t)/2+" cm\n"+i+" 0 m\n"+i+" "+o+" "+o+" "+i+" 0 "+i+" c\n-"+o+" "+i+" -"+i+" "+o+" -"+i+" 0 c\n-"+i+" -"+o+" -"+o+" -"+i+" 0 -"+i+" c\n"+o+" -"+i+" "+i+" -"+o+" "+i+" 0 c\n f\n Q\n",e.stream=n,e}},Cross:{createAppearanceStream:function(t){var e={D:{Off:C.Appearance.RadioButton.Cross.OffPushDown},N:{}};return e.N[t]=C.Appearance.RadioButton.Cross.YesNormal,e.D[t]=C.Appearance.RadioButton.Cross.YesPushDown,e},createMK:function(){return"<< /CA (8)>>"},YesNormal:function(t){var e=C.createFormXObject(t),n="",r=C.Appearance.internal.calculateCross(t);return n+="q\n 1 1 "+(C.Appearance.internal.getWidth(t)-2)+" "+(C.Appearance.internal.getHeight(t)-2)+" re\n W\n n\n "+r.x1.x+" "+r.x1.y+" m\n "+r.x2.x+" "+r.x2.y+" l\n "+r.x4.x+" "+r.x4.y+" m\n "+r.x3.x+" "+r.x3.y+" l\n s\n Q\n",e.stream=n,e},YesPushDown:function(t){var e=C.createFormXObject(t),n=C.Appearance.internal.calculateCross(t),r="";return r+="0.749023 g\n 0 0 "+C.Appearance.internal.getWidth(t)+" "+C.Appearance.internal.getHeight(t)+" re\n f\n q\n 1 1 "+(C.Appearance.internal.getWidth(t)-2)+" "+(C.Appearance.internal.getHeight(t)-2)+" re\n W\n n\n "+n.x1.x+" "+n.x1.y+" m\n "+n.x2.x+" "+n.x2.y+" l\n "+n.x4.x+" "+n.x4.y+" m\n "+n.x3.x+" "+n.x3.y+" l\n s\n Q\n",e.stream=r,e},OffPushDown:function(t){var e=C.createFormXObject(t),n="";return n+="0.749023 g\n 0 0 "+C.Appearance.internal.getWidth(t)+" "+C.Appearance.internal.getHeight(t)+" re\n f\n",e.stream=n,e}}},createDefaultAppearanceStream:function(t){return"/Helv 0 Tf 0 g","/Helv 0 Tf 0 g"}},C.Appearance.internal={Bezier_C:.551915024494,calculateCross:function(t){var e,n,r=C.Appearance.internal.getWidth(t),i=C.Appearance.internal.getHeight(t),o=(e=r)>(n=i)?n:e;return{x1:{x:(r-o)/2,y:(i-o)/2+o},x2:{x:(r-o)/2+o,y:(i-o)/2},x3:{x:(r-o)/2,y:(i-o)/2},x4:{x:(r-o)/2+o,y:(i-o)/2+o}}}},C.Appearance.internal.getWidth=function(t){return t.Rect[2]},C.Appearance.internal.getHeight=function(t){return t.Rect[3]},C.internal.inherit=function(t,e){Object.create;t.prototype=Object.create(e.prototype),t.prototype.constructor=t},C.internal.arrayToPdfArray=function(t){if(Array.isArray(t)){var e=" [";for(var n in t){e+=t[n].toString(),e+=n<t.length-1?" ":""}return e+="]"}},C.internal.toPdfString=function(t){return 0!==(t=t||"").indexOf("(")&&(t="("+t),")"!=t.substring(t.length-1)&&(t+="("),t},C.PDFObject=function(){var t;Object.defineProperty(this,"objId",{get:function(){return t||(this.internal?t=this.internal.newObjectDeferred():e.API.acroformPlugin.internal&&(t=e.API.acroformPlugin.internal.newObjectDeferred())),t||console.log("Couldn't create Object ID"),t},configurable:!1})},C.PDFObject.prototype.toString=function(){return this.objId+" 0 R"},C.PDFObject.prototype.getString=function(){var t=this.objId+" 0 obj\n<<";return t+=this.getContent()+">>\n",this.stream&&(t+="stream\n",t+=this.stream,t+="endstream\n"),t+="endobj\n"},C.PDFObject.prototype.getContent=function(){var t="";return t+=function(t){var e="",n=Object.keys(t).filter(function(t){return"content"!=t&&"appearanceStreamContent"!=t&&"_"!=t.substring(0,1)});for(var r in n){var i=n[r],o=t[i];o&&(Array.isArray(o)?e+="/"+i+" "+C.internal.arrayToPdfArray(o)+"\n":o instanceof C.PDFObject?e+="/"+i+" "+o.objId+" 0 R\n":e+="/"+i+" "+o+"\n")}return e}(this)},C.FormXObject=function(){var t;C.PDFObject.call(this),this.Type="/XObject",this.Subtype="/Form",this.FormType=1,this.BBox,this.Matrix,this.Resources="2 0 R",this.PieceInfo,Object.defineProperty(this,"Length",{enumerable:!0,get:function(){return void 0!==t?t.length:0}}),Object.defineProperty(this,"stream",{enumerable:!1,set:function(e){t=e},get:function(){return t||null}})},C.internal.inherit(C.FormXObject,C.PDFObject),C.AcroFormDictionary=function(){C.PDFObject.call(this);var t=[];Object.defineProperty(this,"Kids",{enumerable:!1,configurable:!0,get:function(){return t.length>0?t:void 0}}),Object.defineProperty(this,"Fields",{enumerable:!0,configurable:!0,get:function(){return t}}),this.DA},C.internal.inherit(C.AcroFormDictionary,C.PDFObject),C.Field=function(){var t;C.PDFObject.call(this),Object.defineProperty(this,"Rect",{enumerable:!0,configurable:!1,get:function(){if(t)return t},set:function(e){t=e}});var e,n,r,i="";Object.defineProperty(this,"FT",{enumerable:!0,set:function(t){i=t},get:function(){return i}}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!1,set:function(t){e=t},get:function(){if(!e||e.length<1){if(this instanceof C.ChildClass)return;return"(FieldObject"+C.Field.FieldNum+++")"}return"("==e.substring(0,1)&&e.substring(e.length-1)?e:"("+e+")"}}),Object.defineProperty(this,"DA",{enumerable:!0,get:function(){if(n)return"("+n+")"},set:function(t){n=t}}),Object.defineProperty(this,"DV",{enumerable:!0,configurable:!0,get:function(){if(r)return r},set:function(t){r=t}}),Object.defineProperty(this,"Type",{enumerable:!0,get:function(){return this.hasAnnotation?"/Annot":null}}),Object.defineProperty(this,"Subtype",{enumerable:!0,get:function(){return this.hasAnnotation?"/Widget":null}}),this.BG,Object.defineProperty(this,"hasAnnotation",{enumerable:!1,get:function(){return!!(this.Rect||this.BC||this.BG)}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(this,"page",{enumerable:!1,configurable:!0,writable:!0})},C.Field.FieldNum=0,C.internal.inherit(C.Field,C.PDFObject),C.ChoiceField=function(){C.Field.call(this),this.FT="/Ch",this.Opt=[],this.V="()",this.TI=0,this.combo=!1,Object.defineProperty(this,"edit",{enumerable:!0,set:function(t){1==t?(this._edit=!0,this.combo=!0):this._edit=!1},get:function(){return!!this._edit&&this._edit},configurable:!1}),this.hasAppearanceStream=!0,Object.defineProperty(this,"V",{get:function(){C.internal.toPdfString()}})},C.internal.inherit(C.ChoiceField,C.Field),window.ChoiceField=C.ChoiceField,C.ListBox=function(){C.ChoiceField.call(this)},C.internal.inherit(C.ListBox,C.ChoiceField),window.ListBox=C.ListBox,C.ComboBox=function(){C.ListBox.call(this),this.combo=!0},C.internal.inherit(C.ComboBox,C.ListBox),window.ComboBox=C.ComboBox,C.EditBox=function(){C.ComboBox.call(this),this.edit=!0},C.internal.inherit(C.EditBox,C.ComboBox),window.EditBox=C.EditBox,C.Button=function(){C.Field.call(this),this.FT="/Btn"},C.internal.inherit(C.Button,C.Field),window.Button=C.Button,C.PushButton=function(){C.Button.call(this),this.pushbutton=!0},C.internal.inherit(C.PushButton,C.Button),window.PushButton=C.PushButton,C.RadioButton=function(){C.Button.call(this),this.radio=!0;var t,e=[];Object.defineProperty(this,"Kids",{enumerable:!0,get:function(){if(e.length>0)return e}}),Object.defineProperty(this,"__Kids",{get:function(){return e}}),Object.defineProperty(this,"noToggleToOff",{enumerable:!1,get:function(){return t},set:function(e){t=e}})},C.internal.inherit(C.RadioButton,C.Button),window.RadioButton=C.RadioButton,C.ChildClass=function(t,e){C.Field.call(this),this.Parent=t,this._AppearanceType=C.Appearance.RadioButton.Circle,this.appearanceStreamContent=this._AppearanceType.createAppearanceStream(e),this.F=C.internal.setBitPosition(this.F,3,1),this.MK=this._AppearanceType.createMK(),this.AS="/Off",this._Name=e},C.internal.inherit(C.ChildClass,C.Field),C.RadioButton.prototype.setAppearance=function(t){if("createAppearanceStream"in t&&"createMK"in t)for(var e in this.__Kids){var n=this.__Kids[e];n.appearanceStreamContent=t.createAppearanceStream(n._Name),n.MK=t.createMK()}else console.log("Couldn't assign Appearance to RadioButton. Appearance was Invalid!")},C.RadioButton.prototype.createOption=function(t){this.__Kids.length;var n=new C.ChildClass(this,t);return this.__Kids.push(n),e.API.addField(n),n},C.CheckBox=function(){Button.call(this),this.appearanceStreamContent=C.Appearance.CheckBox.createAppearanceStream(),this.MK=C.Appearance.CheckBox.createMK(),this.AS="/On",this.V="/On"},C.internal.inherit(C.CheckBox,C.Button),window.CheckBox=C.CheckBox,C.TextField=function(){var t,e;C.Field.call(this),this.DA=C.Appearance.createDefaultAppearanceStream(),this.F=4,Object.defineProperty(this,"V",{get:function(){return t?"("+t+")":t},enumerable:!0,set:function(e){t=e}}),Object.defineProperty(this,"DV",{get:function(){return e?"("+e+")":e},enumerable:!0,set:function(t){e=t}});var n=!1;Object.defineProperty(this,"multiline",{enumerable:!1,get:function(){return n},set:function(t){n=t}});var r=!1;Object.defineProperty(this,"MaxLen",{enumerable:!0,get:function(){return r},set:function(t){r=t}}),Object.defineProperty(this,"hasAppearanceStream",{enumerable:!1,get:function(){return this.V||this.DV}})},C.internal.inherit(C.TextField,C.Field),window.TextField=C.TextField,C.PasswordField=function(){TextField.call(this),Object.defineProperty(this,"password",{value:!0,enumerable:!1,configurable:!1,writable:!1})},C.internal.inherit(C.PasswordField,C.TextField),window.PasswordField=C.PasswordField,C.internal.calculateFontSpace=function(t,e,n){n=n||"helvetica";var r=C.internal.calculateFontSpace.canvas||(C.internal.calculateFontSpace.canvas=document.createElement("canvas"));(s=r.getContext("2d")).save();var i=e+" "+n;s.font=i;var o=s.measureText(t);s.fontcolor="black";var s=r.getContext("2d");o.height=1.5*s.measureText("3").width,s.restore();o.width;return o},C.internal.calculateX=function(t,e,n,r){r=r||12,n=n||"helvetica";var i={text:"",fontSize:""},o=(e=")"==(e="("==e.substr(0,1)?e.substr(1):e).substr(e.length-1)?e.substr(0,e.length-1):e).split(" "),s=r,a=C.Appearance.internal.getHeight(t)||0;a=a<0?-a:a;var c=C.Appearance.internal.getWidth(t)||0;c=c<0?-c:c;var l=function(t,e,r){if(t+1<o.length){var i=e+" "+o[t+1];return C.internal.calculateFontSpace(i,r+"px",n).width<=c-4}return!1};s++;t:for(;;){e="";s--;var u=C.internal.calculateFontSpace("3",s+"px",n).height,h=t.multiline?a-s:(a-u)/2,f=-2,d=h+=2,p=0,g=0,m=0;if(0==s){s=12,e="(...) Tj\n",e+="% Width of Text: "+C.internal.calculateFontSpace(e,"1px").width+", FieldWidth:"+c+"\n";break}m=C.internal.calculateFontSpace(o[0]+" ",s+"px",n).width;var w="",y=0;for(var v in o){w=" "==(w+=o[v]+" ").substr(w.length-1)?w.substr(0,w.length-1):w;var b=parseInt(v);m=C.internal.calculateFontSpace(w+" ",s+"px",n).width;var x=l(b,w,s),k=v>=o.length-1;if(!x||k){if(x||k){if(k)g=b;else if(t.multiline&&(u+2)*(y+2)+2>a)continue t}else{if(!t.multiline)continue t;if((u+2)*(y+2)+2>a)continue t;g=b}for(var _="",A=p;A<=g;A++)_+=o[A]+" ";switch(_=" "==_.substr(_.length-1)?_.substr(0,_.length-1):_,m=C.internal.calculateFontSpace(_,s+"px",n).width,t.Q){case 2:f=c-m-2;break;case 1:f=(c-m)/2;break;case 0:default:f=2}e+=f+" "+d+" Td\n",e+="("+_+") Tj\n",e+=-f+" 0 Td\n",d=-(s+2),f,m=0,p=g+1,y++,w=""}else w+=" "}break}return i.text=e,i.fontSize=s,i},C.internal.calculateAppearanceStream=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e="",n=t.V||t.DV,r=C.internal.calculateX(t,n);e+="/Tx BMC\nq\n/F1 "+r.fontSize+" Tf\n1 0 0 1 0 0 Tm\n",e+="BT\n",e+=r.text,e+="ET\n",e+="Q\nEMC\n";var i=new C.createFormXObject(t);i.stream=e;return i}},C.internal.calculateCoordinates=function(t,e,n,r){var i={};if(this.internal){var o=function(t){return t*this.internal.scaleFactor};Array.isArray(t)?(t[0]=C.scale(t[0]),t[1]=C.scale(t[1]),t[2]=C.scale(t[2]),t[3]=C.scale(t[3]),i.lowerLeft_X=t[0]||0,i.lowerLeft_Y=o.call(this,this.internal.pageSize.height)-t[3]-t[1]||0,i.upperRight_X=t[0]+t[2]||0,i.upperRight_Y=o.call(this,this.internal.pageSize.height)-t[1]||0):(t=C.scale(t),e=C.scale(e),n=C.scale(n),r=C.scale(r),i.lowerLeft_X=t||0,i.lowerLeft_Y=this.internal.pageSize.height-e||0,i.upperRight_X=t+n||0,i.upperRight_Y=this.internal.pageSize.height-e+r||0)}else Array.isArray(t)?(i.lowerLeft_X=t[0]||0,i.lowerLeft_Y=t[1]||0,i.upperRight_X=t[0]+t[2]||0,i.upperRight_Y=t[1]+t[3]||0):(i.lowerLeft_X=t||0,i.lowerLeft_Y=e||0,i.upperRight_X=t+n||0,i.upperRight_Y=e+r||0);return[i.lowerLeft_X,i.lowerLeft_Y,i.upperRight_X,i.upperRight_Y]},C.internal.calculateColor=function(t,e,n){var r=new Array(3);return r.r=0|t,r.g=0|e,r.b=0|n,r},C.internal.getBitPosition=function(t,e){var n=1;return(t=t||0)|(n<<=e-1)},C.internal.setBitPosition=function(t,e,n){t=t||0;var r=1;if(r<<=e-1,1==(n=n||1))t=t|r;else t=t&~r;return t},e.API.addHTML=function(t,e,n,r,i){if("undefined"==typeof html2canvas&&"undefined"==typeof rasterizeHTML)throw new Error("You need either https://github.com/niklasvh/html2canvas or https://github.com/cburgmer/rasterizeHTML.js");"number"!=typeof e&&(r=e,i=n),"function"==typeof r&&(i=r,r=null);var o=this.internal,s=o.scaleFactor,a=o.pageSize.width,c=o.pageSize.height;if((r=r||{}).onrendered=function(t){e=parseInt(e)||0,n=parseInt(n)||0;var o=r.dim||{},l=o.h||0,u=o.w||Math.min(a,t.width/s)-e,h="JPEG";if(r.format&&(h=r.format),t.height>c&&r.pagesplit){var f=function(){for(var r=0;;){var o=document.createElement("canvas");o.width=Math.min(a*s,t.width),o.height=Math.min(c*s,t.height-r),o.getContext("2d").drawImage(t,0,r,t.width,o.height,0,0,o.width,o.height);var l=[o,e,r?0:n,o.width/s,o.height/s,h,null,"SLOW"];if(this.addImage.apply(this,l),(r+=o.height)>=t.height)break;this.addPage()}i(u,r,null,l)}.bind(this);if("CANVAS"===t.nodeName){var d=new Image;d.onload=f,d.src=t.toDataURL("image/png"),t=d}else f()}else{var p=Math.random().toString(35),g=[t,e,n,u,l,h,p,"SLOW"];this.addImage.apply(this,g),i(u,l,p,g)}}.bind(this),"undefined"!=typeof html2canvas&&!r.rstz)return html2canvas(t,r);if("undefined"!=typeof rasterizeHTML){var l="drawDocument";return"string"==typeof t&&(l=/^http/.test(t)?"drawURL":"drawHTML"),r.width=r.width||a*s,rasterizeHTML[l](t,void 0,r).then(function(t){r.onrendered(t.image)},function(t){i(null,t)})}return null},function(e){var n=["jpeg","jpg","png"],r=function t(e){var n=this.internal.newObject(),r=this.internal.write,i=this.internal.putStream;if(e.n=n,r("<</Type /XObject"),r("/Subtype /Image"),r("/Width "+e.w),r("/Height "+e.h),e.cs===this.color_spaces.INDEXED?r("/ColorSpace [/Indexed /DeviceRGB "+(e.pal.length/3-1)+" "+("smask"in e?n+2:n+1)+" 0 R]"):(r("/ColorSpace /"+e.cs),e.cs===this.color_spaces.DEVICE_CMYK&&r("/Decode [1 0 1 0 1 0 1 0]")),r("/BitsPerComponent "+e.bpc),"f"in e&&r("/Filter /"+e.f),"dp"in e&&r("/DecodeParms <<"+e.dp+">>"),"trns"in e&&e.trns.constructor==Array){for(var o="",s=0,a=e.trns.length;s<a;s++)o+=e.trns[s]+" "+e.trns[s]+" ";r("/Mask ["+o+"]")}if("smask"in e&&r("/SMask "+(n+1)+" 0 R"),r("/Length "+e.data.length+">>"),i(e.data),r("endobj"),"smask"in e){var c="/Predictor "+e.p+" /Colors 1 /BitsPerComponent "+e.bpc+" /Columns "+e.w,l={w:e.w,h:e.h,cs:"DeviceGray",bpc:e.bpc,dp:c,data:e.smask};"f"in e&&(l.f=e.f),t.call(this,l)}e.cs===this.color_spaces.INDEXED&&(this.internal.newObject(),r("<< /Length "+e.pal.length+">>"),i(this.arrayBufferToBinaryString(new Uint8Array(e.pal))),r("endobj"))},i=function(){var t=this.internal.collections.addImage_images;for(var e in t)r.call(this,t[e])},o=function(){var t,e=this.internal.collections.addImage_images,n=this.internal.write;for(var r in e)n("/I"+(t=e[r]).i,t.n,"0","R")},s=function(e){return"object"===(void 0===e?"undefined":t(e))&&1===e.nodeType},a=function(t,e){var n;if(e)for(var r in e)if(t===e[r].alias){n=e[r];break}return n};e.color_spaces={DEVICE_RGB:"DeviceRGB",DEVICE_GRAY:"DeviceGray",DEVICE_CMYK:"DeviceCMYK",CAL_GREY:"CalGray",CAL_RGB:"CalRGB",LAB:"Lab",ICC_BASED:"ICCBased",INDEXED:"Indexed",PATTERN:"Pattern",SEPARATION:"Separation",DEVICE_N:"DeviceN"},e.decode={DCT_DECODE:"DCTDecode",FLATE_DECODE:"FlateDecode",LZW_DECODE:"LZWDecode",JPX_DECODE:"JPXDecode",JBIG2_DECODE:"JBIG2Decode",ASCII85_DECODE:"ASCII85Decode",ASCII_HEX_DECODE:"ASCIIHexDecode",RUN_LENGTH_DECODE:"RunLengthDecode",CCITT_FAX_DECODE:"CCITTFaxDecode"},e.image_compression={NONE:"NONE",FAST:"FAST",MEDIUM:"MEDIUM",SLOW:"SLOW"},e.sHashCode=function(t){return Array.prototype.reduce&&t.split("").reduce(function(t,e){return(t=(t<<5)-t+e.charCodeAt(0))&t},0)},e.isString=function(t){return"string"==typeof t},e.extractInfoFromBase64DataURI=function(t){return/^data:([\w]+?\/([\w]+?));base64,(.+?)$/g.exec(t)},e.supportsArrayBuffer=function(){return"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array},e.isArrayBuffer=function(t){return!!this.supportsArrayBuffer()&&t instanceof ArrayBuffer},e.isArrayBufferView=function(t){return!!this.supportsArrayBuffer()&&("undefined"!=typeof Uint32Array&&(t instanceof Int8Array||t instanceof Uint8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array))},e.binaryStringToUint8Array=function(t){for(var e=t.length,n=new Uint8Array(e),r=0;r<e;r++)n[r]=t.charCodeAt(r);return n},e.arrayBufferToBinaryString=function(t){this.isArrayBuffer(t)&&(t=new Uint8Array(t));for(var e="",n=t.byteLength,r=0;r<n;r++)e+=String.fromCharCode(t[r]);return e},e.arrayBufferToBase64=function(t){for(var e,n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(t),o=i.byteLength,s=o%3,a=o-s,c=0;c<a;c+=3)n+=r[(16515072&(e=i[c]<<16|i[c+1]<<8|i[c+2]))>>18]+r[(258048&e)>>12]+r[(4032&e)>>6]+r[63&e];return 1==s?n+=r[(252&(e=i[a]))>>2]+r[(3&e)<<4]+"==":2==s&&(n+=r[(64512&(e=i[a]<<8|i[a+1]))>>10]+r[(1008&e)>>4]+r[(15&e)<<2]+"="),n},e.createImageInfo=function(t,e,n,r,i,o,s,a,c,l,u,h,f){var d={alias:a,w:e,h:n,cs:r,bpc:i,i:s,data:t};return o&&(d.f=o),c&&(d.dp=c),l&&(d.trns=l),u&&(d.pal=u),h&&(d.smask=h),f&&(d.p=f),d},e.addImage=function(r,c,l,u,h,f,d,p,g){if("string"!=typeof c){var m=f;f=h,h=u,u=l,l=c,c=m}if("object"===(void 0===r?"undefined":t(r))&&!s(r)&&"imageData"in r){var w=r;r=w.imageData,c=w.format||c,l=w.x||l||0,u=w.y||u||0,h=w.w||h,f=w.h||f,d=w.alias||d,p=w.compression||p,g=w.rotation||w.angle||g}if(isNaN(l)||isNaN(u))throw console.error("jsPDF.addImage: Invalid coordinates",arguments),new Error("Invalid coordinates passed to jsPDF.addImage");var y,v,b,x,k=function(){var t=this.internal.collections.addImage_images;return t||(this.internal.collections.addImage_images=t={},this.internal.events.subscribe("putResources",i),this.internal.events.subscribe("putXobjectDict",o)),t}.call(this);if(!(y=a(r,k))&&(s(r)&&(r=function(e,n,r){if("IMG"===e.nodeName&&e.hasAttribute("src")){var i=""+e.getAttribute("src");if(!r&&0===i.indexOf("data:image/"))return i;!n&&/\.png(?:[?#].*)?$/i.test(i)&&(n="png")}if("CANVAS"===e.nodeName)var o=e;else{(o=document.createElement("canvas")).width=e.clientWidth||e.width,o.height=e.clientHeight||e.height;var s=o.getContext("2d");if(!s)throw"addImage requires canvas to be supported by browser.";if(r){var a,c,l,u,h,f,d,p,g=Math.PI/180;"object"===(void 0===r?"undefined":t(r))&&(a=r.x,c=r.y,l=r.bg,r=r.angle),p=r*g,u=Math.abs(Math.cos(p)),h=Math.abs(Math.sin(p)),f=o.width,d=o.height,o.width=d*h+f*u,o.height=d*u+f*h,isNaN(a)&&(a=o.width/2),isNaN(c)&&(c=o.height/2),s.clearRect(0,0,o.width,o.height),s.fillStyle=l||"white",s.fillRect(0,0,o.width,o.height),s.save(),s.translate(a,c),s.rotate(p),s.drawImage(e,-f/2,-d/2),s.rotate(-p),s.translate(-a,-c),s.restore()}else s.drawImage(e,0,0,o.width,o.height)}return o.toDataURL("png"==(""+n).toLowerCase()?"image/png":"image/jpeg")}(r,c,g)),null==d&&(d="string"==typeof(x=r)&&e.sHashCode(x)),!(y=a(d,k)))){if(this.isString(r)){var _=this.extractInfoFromBase64DataURI(r);_?(c=_[2],r=atob(_[3])):137===r.charCodeAt(0)&&80===r.charCodeAt(1)&&78===r.charCodeAt(2)&&71===r.charCodeAt(3)&&(c="png")}if(c=(c||"JPEG").toLowerCase(),b=c,-1===n.indexOf(b))throw new Error("addImage currently only supports formats "+n+", not '"+c+"'");if(function(t){return"function"!=typeof e["process"+t.toUpperCase()]}(c))throw new Error("please ensure that the plugin for '"+c+"' support is added");if(this.supportsArrayBuffer()&&(r instanceof Uint8Array||(v=r,r=this.binaryStringToUint8Array(r))),!(y=this["process"+c.toUpperCase()](r,function(t){var e=0;return t&&(e=Object.keys?Object.keys(t).length:function(t){var e=0;for(var n in t)t.hasOwnProperty(n)&&e++;return e}(t)),e}(k),d,function(t){return t&&"string"==typeof t&&(t=t.toUpperCase()),t in e.image_compression?t:e.image_compression.NONE}(p),v)))throw new Error("An unkwown error occurred whilst processing the image")}return function(t,e,n,r,i,o,s){var a=function(t,e,n){return t||e||(t=-96,e=-96),t<0&&(t=-1*n.w*72/t/this.internal.scaleFactor),e<0&&(e=-1*n.h*72/e/this.internal.scaleFactor),0===t&&(t=e*n.w/n.h),0===e&&(e=t*n.h/n.w),[t,e]}.call(this,n,r,i),c=this.internal.getCoordinateString,l=this.internal.getVerticalCoordinateString;n=a[0],r=a[1],s[o]=i,this.internal.write("q",c(n),"0 0",c(r),c(t),l(e+r),"cm /I"+i.i,"Do Q")}.call(this,l,u,h,f,y,y.i,k),this};var c=function(t,e){return t.subarray(e,e+5)};e.processJPEG=function(t,e,n,r,i){var o,s=this.color_spaces.DEVICE_RGB,a=this.decode.DCT_DECODE;return this.isString(t)?(o=function(t){var e;if(255===!t.charCodeAt(0)||216===!t.charCodeAt(1)||255===!t.charCodeAt(2)||224===!t.charCodeAt(3)||!t.charCodeAt(6)==="J".charCodeAt(0)||!t.charCodeAt(7)==="F".charCodeAt(0)||!t.charCodeAt(8)==="I".charCodeAt(0)||!t.charCodeAt(9)==="F".charCodeAt(0)||0===!t.charCodeAt(10))throw new Error("getJpegSize requires a binary string jpeg file");for(var n=256*t.charCodeAt(4)+t.charCodeAt(5),r=4,i=t.length;r<i;){if(r+=n,255!==t.charCodeAt(r))throw new Error("getJpegSize could not find the size of the image");if(192===t.charCodeAt(r+1)||193===t.charCodeAt(r+1)||194===t.charCodeAt(r+1)||195===t.charCodeAt(r+1)||196===t.charCodeAt(r+1)||197===t.charCodeAt(r+1)||198===t.charCodeAt(r+1)||199===t.charCodeAt(r+1))return e=256*t.charCodeAt(r+5)+t.charCodeAt(r+6),[256*t.charCodeAt(r+7)+t.charCodeAt(r+8),e,t.charCodeAt(r+9)];r+=2,n=256*t.charCodeAt(r)+t.charCodeAt(r+1)}}(t),this.createImageInfo(t,o[0],o[1],1==o[3]?this.color_spaces.DEVICE_GRAY:s,8,a,e,n)):(this.isArrayBuffer(t)&&(t=new Uint8Array(t)),this.isArrayBufferView(t)?(o=function(t){if(65496!=(t[0]<<8|t[1]))throw new Error("Supplied data is not a JPEG");for(var e,n=t.length,r=(t[4]<<8)+t[5],i=4;i<n;){if(r=((e=c(t,i+=r))[2]<<8)+e[3],(192===e[1]||194===e[1])&&255===e[0]&&r>7)return{width:((e=c(t,i+5))[2]<<8)+e[3],height:(e[0]<<8)+e[1],numcomponents:e[4]};i+=2}throw new Error("getJpegSizeFromBytes could not find the size of the image")}(t),t=i||this.arrayBufferToBinaryString(t),this.createImageInfo(t,o.width,o.height,1==o.numcomponents?this.color_spaces.DEVICE_GRAY:s,8,a,e,n)):null)},e.processJPG=function(){return this.processJPEG.apply(this,arguments)}}(e.API),function(t){var n={annotations:[],f2:function(t){return t.toFixed(2)},notEmpty:function(t){if(void 0!==t&&""!=t)return!0}};e.API.annotationPlugin=n,e.API.events.push(["addPage",function(t){this.annotationPlugin.annotations[t.pageNumber]=[]}]),t.events.push(["putPage",function(t){for(var e=this.annotationPlugin.annotations[t.pageNumber],r=!1,i=0;i<e.length&&!r;i++){switch((l=e[i]).type){case"link":if(n.notEmpty(l.options.url)||n.notEmpty(l.options.pageNumber)){r=!0;break}case"reference":case"text":case"freetext":r=!0}}if(0!=r){this.internal.write("/Annots [");var o=this.annotationPlugin.f2,s=this.internal.scaleFactor,a=this.internal.pageSize.height,c=this.internal.getPageInfo(t.pageNumber);for(i=0;i<e.length;i++){var l;switch((l=e[i]).type){case"reference":this.internal.write(" "+l.object.objId+" 0 R ");break;case"text":var u=this.internal.newAdditionalObject(),h=this.internal.newAdditionalObject(),f=l.title||"Note";w="<</Type /Annot /Subtype /Text "+(p="/Rect ["+o(l.bounds.x*s)+" "+o(a-(l.bounds.y+l.bounds.h)*s)+" "+o((l.bounds.x+l.bounds.w)*s)+" "+o((a-l.bounds.y)*s)+"] ")+"/Contents ("+l.contents+")",w+=" /Popup "+h.objId+" 0 R",w+=" /P "+c.objId+" 0 R",w+=" /T ("+f+") >>",u.content=w;var d=u.objId+" 0 R";w="<</Type /Annot /Subtype /Popup "+(p="/Rect ["+o((l.bounds.x+30)*s)+" "+o(a-(l.bounds.y+l.bounds.h)*s)+" "+o((l.bounds.x+l.bounds.w+30)*s)+" "+o((a-l.bounds.y)*s)+"] ")+" /Parent "+d,l.open&&(w+=" /Open true"),w+=" >>",h.