@knoopx/react-pdf
Version:
<p align="center"> <img src="https://user-images.githubusercontent.com/5600341/27505816-c8bc37aa-587f-11e7-9a86-08a2d081a8b9.png" height="280px"> <p align="center">React renderer for creating PDF files on the browser and server<p> <p align="center">
1 lines • 71.4 kB
JavaScript
import t from"@babel/runtime/helpers/inheritsLoose";import e from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import r from"@babel/runtime/helpers/extends";import n,{Fragment as i}from"react";import o from"@babel/runtime/regenerator";import a from"@babel/runtime/helpers/asyncToGenerator";import s from"blob-stream";import u from"react-reconciler";import h from"@babel/runtime/helpers/createClass";import c,{PDFFont as l}from"@react-pdf/pdfkit";import d from"yoga-layout-prebuilt";import{mergeDeepWith as f,isNil as p,compose as g,equals as m,type as y,toPairsIn as v,pick as b,pathOr as T,last as w,propEq as x,complement as C,prop as E}from"ramda";import k from"media-engine";import R from"@babel/runtime/helpers/assertThisInitialized";import S from"@react-pdf/textkit/renderers/pdf";import P from"@react-pdf/textkit/attributedString";import"is-url";import A from"@react-pdf/fontkit";import L from"cross-fetch";import B from"@react-pdf/textkit/layout";import O from"@react-pdf/textkit/engines/linebreaker";import D from"@react-pdf/textkit/engines/justification";import M from"@react-pdf/textkit/engines/textDecoration";import _ from"@react-pdf/textkit/engines/scriptItemizer";import W from"@react-pdf/textkit/engines/wordHyphenation";import I from"emoji-regex";import z from"@react-pdf/png-js";import N from"page-wrapping";function F(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=0,o="Warning: "+t.replace(/%s/g,function(){return r[i++]});"undefined"!=typeof console&&console.error(o);try{throw new Error(o)}catch(t){}}var G="production"!==process.env.NODE_ENV?function(t,e){if(void 0===e)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(!t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];F.apply(void 0,[e].concat(n))}}:function(){},H=function(){function t(){this.isDirty=!1,this.document=null,this.instance=null}var e=t.prototype;return e.appendChild=function(t){this.document=t},e.removeChild=function(){this.document.cleanup(),this.document=null},e.markDirty=function(){this.isDirty=!0},e.cleanup=function(){this.document.cleanup()},e.finish=function(){this.document.finish()},e.render=function(){var t=a(o.mark(function t(){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.instance=new c({autoFirstPage:!1}),t.next=3,this.document.render();case 3:this.cleanup(),this.isDirty=!1;case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),h(t,[{key:"name",get:function(){return"Root"}}]),t}(),j=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},U=function(t){var e=function(t){return/((-)?\d+\.?\d*)%/g.exec(t)}(t);if(e){var r=parseFloat(e[1],10),n=r/100;return{value:r,percent:n,absValue:Math.abs(r),absPercent:Math.abs(n)}}return null},V=function(){function t(){this.parent=null,this.children=[],this.computed=!1,this.layout=d.Node.createDefault()}var e=t.prototype;return e.appendChild=function(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))},e.appendChildBefore=function(t,e){var r=this.children.indexOf(e);-1!==r&&t&&(t.parent=this,this.children.splice(r,0,t),this.layout.insertChild(t.layout,r))},e.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout)),t.cleanup()},e.removeAllChilds=function(){for(var t=[].concat(this.children),e=0;e<t.length;e++)t[e].remove()},e.remove=function(){this.parent.removeChild(this)},e.setDimension=function(t,e){var r="set"+j(t),n=r+"Percent",i=U(e);i?this.layout[n](i.value):this.layout[r](e)},e.setPosition=function(t,e){var r=U(e);r?this.layout.setPositionPercent(t,r.value):this.layout.setPosition(t,e)},e.setPadding=function(t,e){var r=U(e);r?this.layout.setPaddingPercent(t,r.value):this.layout.setPadding(t,e)},e.setMargin=function(t,e){var r=U(e);r?this.layout.setMarginPercent(t,r.value):this.layout.setMargin(t,e)},e.setBorder=function(t,e){if(U(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)},e.getAbsoluteLayout=function(){var t=this.parent,e=t&&t.getAbsoluteLayout?t.getAbsoluteLayout():{left:0,top:0};return{left:this.left+e.left,top:this.top+e.top,height:this.height,width:this.width}},e.copyStyle=function(t){this.layout.copyStyle(t.layout)},e.calculateLayout=function(){this.layout.calculateLayout(),this.computed=!0},e.isEmpty=function(){return 0===this.children.length},e.markDirty=function(){return this.layout.markDirty()},e.onAppendDynamically=function(){},e.cleanup=function(){this.children.forEach(function(t){return t.cleanup()}),this.layout.unsetMeasureFunc(),d.Node.destroy(this.layout)},h(t,[{key:"position",get:function(){return this.layout.getPositionType()===d.POSITION_TYPE_ABSOLUTE?"absolute":"relative"},set:function(t){this.layout.setPositionType("absolute"===t?d.POSITION_TYPE_ABSOLUTE:d.POSITION_TYPE_RELATIVE)}},{key:"top",get:function(){return this.layout.getComputedTop()||0},set:function(t){this.setPosition(d.EDGE_TOP,t)}},{key:"left",get:function(){return this.layout.getComputedLeft()||0},set:function(t){this.setPosition(d.EDGE_LEFT,t)}},{key:"right",get:function(){return this.layout.getComputedRight()||0},set:function(t){this.setPosition(d.EDGE_RIGHT,t)}},{key:"bottom",get:function(){return this.layout.getComputedBottom()||0},set:function(t){this.setPosition(d.EDGE_BOTTOM,t)}},{key:"width",get:function(){return this.layout.getComputedWidth()},set:function(t){this.setDimension("width",t)}},{key:"minWidth",get:function(){return this.layout.getMinWidth().value},set:function(t){this.setDimension("minWidth",t)}},{key:"maxWidth",get:function(){return this.layout.getMaxWidth().value},set:function(t){this.setDimension("maxWidth",t)}},{key:"height",get:function(){return this.layout.getComputedHeight()},set:function(t){this.setDimension("height",t)}},{key:"minHeight",get:function(){return this.layout.getMinHeight().value},set:function(t){this.setDimension("minHeight",t)}},{key:"maxHeight",get:function(){return this.layout.getMaxHeight().value},set:function(t){this.setDimension("maxHeight",t)}},{key:"paddingTop",get:function(){return this.layout.getComputedPadding(d.EDGE_TOP)||0},set:function(t){this.setPadding(d.EDGE_TOP,t)}},{key:"paddingRight",get:function(){return this.layout.getComputedPadding(d.EDGE_RIGHT)||0},set:function(t){this.setPadding(d.EDGE_RIGHT,t)}},{key:"paddingBottom",get:function(){return this.layout.getComputedPadding(d.EDGE_BOTTOM)||0},set:function(t){this.setPadding(d.EDGE_BOTTOM,t)}},{key:"paddingLeft",get:function(){return this.layout.getComputedPadding(d.EDGE_LEFT)||0},set:function(t){this.setPadding(d.EDGE_LEFT,t)}},{key:"marginTop",get:function(){return this.layout.getComputedMargin(d.EDGE_TOP)||0},set:function(t){this.setMargin(d.EDGE_TOP,t)}},{key:"marginRight",get:function(){return this.layout.getComputedMargin(d.EDGE_RIGHT)||0},set:function(t){this.setMargin(d.EDGE_RIGHT,t)}},{key:"marginBottom",get:function(){return this.layout.getComputedMargin(d.EDGE_BOTTOM)||0},set:function(t){this.setMargin(d.EDGE_BOTTOM,t)}},{key:"marginLeft",get:function(){return this.layout.getComputedMargin(d.EDGE_LEFT)||0},set:function(t){this.setMargin(d.EDGE_LEFT,t)}},{key:"borderTopWidth",get:function(){return this.layout.getComputedBorder(d.EDGE_TOP)||0},set:function(t){this.setBorder(d.EDGE_TOP,t)}},{key:"borderRightWidth",get:function(){return this.layout.getComputedBorder(d.EDGE_RIGHT)||0},set:function(t){this.setBorder(d.EDGE_RIGHT,t)}},{key:"borderBottomWidth",get:function(){return this.layout.getComputedBorder(d.EDGE_BOTTOM)||0},set:function(t){this.setBorder(d.EDGE_BOTTOM,t)}},{key:"borderLeftWidth",get:function(){return this.layout.getComputedBorder(d.EDGE_LEFT)||0},set:function(t){this.setBorder(d.EDGE_LEFT,t)}},{key:"padding",get:function(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}},set:function(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}},{key:"margin",get:function(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}},set:function(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}}]),t}(),X=function(t,e){var r=function(t){return"alignItems"===t||"alignContent"===t||"alignSelf"===t};switch(e){case"auto":if("alignSelf"===t)return d.ALIGN_AUTO;break;case"flex":return d.DISPLAY_FLEX;case"none":return d.DISPLAY_NONE;case"row":return d.FLEX_DIRECTION_ROW;case"row-reverse":return d.FLEX_DIRECTION_ROW_REVERSE;case"column":return d.FLEX_DIRECTION_COLUMN;case"column-reverse":return d.FLEX_DIRECTION_COLUMN_REVERSE;case"stretch":return d.ALIGN_STRETCH;case"baseline":return d.ALIGN_BASELINE;case"space-around":if("justifyContent"===t)return d.JUSTIFY_SPACE_AROUND;if(r(t))return d.ALIGN_SPACE_AROUND;break;case"space-between":if("justifyContent"===t)return d.JUSTIFY_SPACE_BETWEEN;if(r(t))return d.ALIGN_SPACE_BETWEEN;break;case"around":return d.JUSTIFY_SPACE_AROUND;case"between":return d.JUSTIFY_SPACE_BETWEEN;case"wrap":return d.WRAP_WRAP;case"wrap-reverse":return d.WRAP_WRAP_REVERSE;case"nowrap":return d.WRAP_NO_WRAP;case"flex-start":if("justifyContent"===t)return d.JUSTIFY_FLEX_START;if(r(t))return d.ALIGN_FLEX_START;break;case"flex-end":if("justifyContent"===t)return d.JUSTIFY_FLEX_END;if(r(t))return d.ALIGN_FLEX_END;break;case"center":if("justifyContent"===t)return d.JUSTIFY_CENTER;if(r(t))return d.ALIGN_CENTER;break;default:return e}},Y=function(t,e){var r=function(t){var e=/^(-?\d*\.?\d+)(in|mm|cm|pt|vh|vw)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}}(t);switch(r.unit){case"in":return 72*r.value;case"mm":return r.value*(1/25.4)*72;case"cm":return r.value*(1/2.54)*72;case"vh":if(e.isAutoHeight)throw new Error("vh unit not supported in auto-height pages. Please specify page height if you want to use vh.");return r.value*(e.height/100);case"vw":return r.value*(e.width/100);default:return r.value}},J=function(t,e){return t.match(/^border/)&&"string"==typeof e},q=function(t,e){var r=function(t){return t.match(/(\d+(px|in|mm|cm|pt|vw|vh)?)\s(\S+)\s(\S+)/)}(e);if(r){if(t.match(/.Color/))return r[4];if(t.match(/.Style/))return r[3];if(t.match(/.Width/))return r[1];throw new Error("StyleSheet: Invalid '"+e+"' for '"+t+"'")}return e},K=function(t,e){return t.match(/^(margin)|(padding)/)&&"string"==typeof e},Z=function(t,e){var r=function(t){return t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g)}(e);if(r){if(t.match(/.Top/))return r[0];if(t.match(/.Right/))return r[1]||r[0];if(t.match(/.Bottom/))return r[2]||r[0];if(t.match(/.Left/))return r[3]||r[1]||r[0];throw new Error("StyleSheet: Invalid '"+e+"' for '"+t+"'")}return e},$={thin:100,hairline:100,ultralight:200,extralight:200,light:300,normal:400,medium:500,semibold:600,demibold:600,bold:700,ultrabold:800,extrabold:800,heavy:900,black:900},Q=function(t){return t.match(/^fontWeight/)},tt=function(t){return t?"number"==typeof t?t:$[t.toLowerCase()]:$.normal},et=function(t,e){return t.match(/^objectPosition/)&&"string"==typeof e},rt=function(t,e){var r=function(t){return t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g)}(e);if(r){if(t.match(/.X/))return r[0];if(t.match(/.Y/))return r[1];throw new Error("StyleSheet: Invalid '"+e+"' for '"+t+"'")}return e},nt=function(t,e){return t.match(/^transformOrigin/)&&"string"==typeof e},it=function(t,e){var r=function(t){return t.match(/(-?\d+(px|in|mm|cm|pt|%|vw|vh)?)|top|right|bottom|left|center/g)}(e);if(r){var n;if(t.match(/.X/))n=r[0];else{if(!t.match(/.Y/))throw new Error("StyleSheet: Invalid '"+e+"' for '"+t+"'");n=r[1]||r[0]}return function(t){switch(t){case"top":case"left":return"0%";case"right":case"bottom":return"100%";case"center":return"50%";default:return t}}(n)}return e},ot=Object.prototype.hasOwnProperty,at={margin:{marginTop:!0,marginRight:!0,marginBottom:!0,marginLeft:!0},marginHorizontal:{marginLeft:!0,marginRight:!0},marginVertical:{marginTop:!0,marginBottom:!0},padding:{paddingTop:!0,paddingRight:!0,paddingBottom:!0,paddingLeft:!0},paddingHorizontal:{paddingLeft:!0,paddingRight:!0},paddingVertical:{paddingTop:!0,paddingBottom:!0},border:{borderTopColor:!0,borderTopStyle:!0,borderTopWidth:!0,borderRightColor:!0,borderRightStyle:!0,borderRightWidth:!0,borderBottomColor:!0,borderBottomStyle:!0,borderBottomWidth:!0,borderLeftColor:!0,borderLeftStyle:!0,borderLeftWidth:!0},borderTop:{borderTopColor:!0,borderTopStyle:!0,borderTopWidth:!0},borderRight:{borderRightColor:!0,borderRightStyle:!0,borderRightWidth:!0},borderBottom:{borderBottomColor:!0,borderBottomStyle:!0,borderBottomWidth:!0},borderLeft:{borderLeftColor:!0,borderLeftStyle:!0,borderLeftWidth:!0},borderColor:{borderTopColor:!0,borderRightColor:!0,borderBottomColor:!0,borderLeftColor:!0},borderRadius:{borderTopLeftRadius:!0,borderTopRightRadius:!0,borderBottomRightRadius:!0,borderBottomLeftRadius:!0},borderStyle:{borderTopStyle:!0,borderRightStyle:!0,borderBottomStyle:!0,borderLeftStyle:!0},borderWidth:{borderTopWidth:!0,borderRightWidth:!0,borderBottomWidth:!0,borderLeftWidth:!0},objectPosition:{objectPositionX:!0,objectPositionY:!0},transformOrigin:{transformOriginX:!0,transformOriginY:!0}},st=function(t,e){for(var r=function(t){if(!t)return t;for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var i=e[n],o=t[i];switch(i){case"display":case"flex":case"flexDirection":case"flexWrap":case"flexFlow":case"flexGrow":case"flexShrink":case"flexBasis":case"justifyContent":case"alignSelf":case"alignItems":case"alignContent":case"order":r[i]=X(i,o);break;case"textAlignVertical":r.verticalAlign="center"===o?"middle":o;break;case"margin":case"marginHorizontal":case"marginVertical":case"padding":case"paddingHorizontal":case"paddingVertical":case"border":case"borderTop":case"borderRight":case"borderBottom":case"borderLeft":case"borderColor":case"borderRadius":case"borderStyle":case"borderWidth":case"objectPosition":case"transformOrigin":var a=at[i];for(var s in a)ot.call(a,s)&&(r[s]=o);break;default:r[i]=o}}return r}(t),n=Object.keys(r),i={},o=0;o<n.length;o++){var a=n[o],s=r[a],u=void 0;u=J(a,s)?q(a,s):K(a,s)?Z(a,s):et(a,s)?rt(a,s):nt(a,s)?it(a,s):Q(a)?tt(s):s,i[a]=Y(u,e)}return i},ut=function t(e){return Array.isArray(e)||(e=[e]),e.reduce(function(e,r){if(r){var n=Array.isArray(r)?t(r):r;Object.keys(n).forEach(function(t){null!==n[t]&&void 0!==n[t]&&(e[t]=n[t])})}return e},{})},ht={hairlineWidth:1,create:function(t){return t},resolve:function(t,e){return t?(t=function(t,e){return Object.keys(t).reduce(function(n,i){var o,a;return/@media/.test(i)?r({},n,{},k(((a={})[i]=t[i],a),e)):r({},n,((o={})[i]=t[i],o))},{})}(t=ut(t),e),t=st(t,e)):null},flatten:ut,absoluteFillObject:{position:"absolute",top:0,left:0,bottom:0,right:0}},ct={debug:function(){var t=this.getAbsoluteLayout(),e=this.padding,r=this.margin;this.root.instance.save(),this.debugContent(t,r,e),this.debugPadding(t,r,e),this.debugMargin(t,r),this.debugText(t,r),this.debugOrigin(),this.root.instance.restore()},debugOrigin:function(){if(this.style.transform){var t=this.origin;this.root.instance.circle(t[0],t[1],3).fill("red").circle(t[0],t[1],5).stroke("red")}},debugText:function(t,e){var r=Math.round(this.width+e.left+e.right),n=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(r+" x "+n,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent:function(t,e,r){this.root.instance.fillColor("#a1c6e7").opacity(.5).rect(t.left+r.left,t.top+r.top,t.width-r.left-r.right,t.height-r.top-r.bottom).fill()},debugPadding:function(t,e,r){this.root.instance.fillColor("#c4deb9").opacity(.5),this.root.instance.rect(t.left+r.left,t.top,t.width-r.right-r.left,r.top).fill(),this.root.instance.rect(t.left,t.top,r.left,t.height).fill(),this.root.instance.rect(t.left+t.width-r.right,t.top,r.right,t.height).fill(),this.root.instance.rect(t.left+r.left,t.top+t.height-r.bottom,t.width-r.right-r.left,r.bottom).fill()},debugMargin:function(t,e){this.root.instance.fillColor("#f8cca1").opacity(.5),this.root.instance.rect(t.left,t.top-e.top,t.width,e.top).fill(),this.root.instance.rect(t.left-e.left,t.top-e.top,e.left,t.height+e.top+e.bottom).fill(),this.root.instance.rect(t.left+t.width,t.top-e.top,e.right,t.height+e.top+e.bottom).fill(),this.root.instance.rect(t.left,t.top+t.height,t.width,e.bottom).fill()}},lt=(Math.sqrt(2)-1)/3*4;var dt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderTopWidth,c=r.borderRightWidth,l=r.borderLeftWidth;t.moveTo(a+i,o),t.lineTo(a+s-n,o);var d=n*(1-lt);t.bezierCurveTo(a+s-d,o,a+s,o+d,a+s,o+n);var f=o+Math.max(h,n);t.lineTo(a+s,f),t.lineTo(a+s-c,f);var p=Math.max(n-c,0),g=Math.max(n-h,0),m=p*(1-lt),y=g*(1-lt);t.bezierCurveTo(a+s-c,o+h+y,a+s-c-m,o+h,a+s-c-p,o+h),t.lineTo(a+Math.max(i,l),o+h);var v=Math.max(i-l,0),b=Math.max(i-h,0),T=v*(1-lt),w=b*(1-lt),x=o+Math.max(h,i);t.bezierCurveTo(a+l+T,o+h,a+l,o+h+w,a+l,x),t.lineTo(a,x),t.lineTo(a,o+i);var C=i*(1-lt);if(t.bezierCurveTo(a,o+C,a+C,o,a+i,o),t.closePath(),t.clip(),c){var E=-h/c;t.moveTo(a+s/2,E*(-s/2)+o),t.lineTo(a+s,o),t.lineTo(a,o),t.lineTo(a,o+u),t.closePath(),t.clip()}if(l){var k=-h/l;t.moveTo(a+s/2,k*(-s/2)+o),t.lineTo(a,o),t.lineTo(a+s,o),t.lineTo(a+s,o+u),t.closePath(),t.clip()}},ft=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=r.borderTopColor,h=r.borderTopWidth,c=r.borderTopStyle,l=r.borderRightWidth,d=r.borderLeftWidth,f=i*(1-lt),p=n*(1-lt);t.moveTo(a,o+Math.max(i,h)),t.bezierCurveTo(a,o+f,a+f,o,a+i,o),t.lineTo(a+s-n,o),t.bezierCurveTo(a+s-p,o,a+s,o+p,a+s,o+n),t.strokeColor(u),t.lineWidth(2*Math.max(l,h,d)),"dashed"===c?t.dash(2*h,{space:1.2*h}):"dotted"===c&&t.dash(h,{space:1.2*h}),t.stroke(),t.undash()},pt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderTopWidth,c=r.borderRightWidth,l=r.borderBottomWidth;t.moveTo(a+s,o+n),t.lineTo(a+s,o+u-i);var d=i*(1-lt);t.bezierCurveTo(a+s,o+u-d,a+s-d,o+u,a+s-i,o+u);var f=a+s-Math.max(c,i);t.lineTo(f,o+u),t.lineTo(f,o+u-l);var p=Math.max(i-c,0),g=Math.max(i-l,0),m=p*(1-lt),y=g*(1-lt);t.bezierCurveTo(a+s-c-m,o+u-l,a+s-c,o+u-l-y,a+s-c,o+u-Math.max(i,l)),t.lineTo(a+s-c,o+Math.max(n,h));var v=Math.max(n-c,0),b=Math.max(n-h,0),T=v*(1-lt),w=b*(1-lt),x=a+s-Math.max(n,c);t.bezierCurveTo(a+s-c,o+h+w,a+s-c-T,o+h,x,o+h),t.lineTo(x,o),t.lineTo(a+s-n,o);var C=n*(1-lt);if(t.bezierCurveTo(a+s-C,o,a+s,o+C,a+s,o+n),t.closePath(),t.clip(),h){var E=-h/c;t.moveTo(a+s/2,E*(-s/2)+o),t.lineTo(a+s,o),t.lineTo(a+s,o+u),t.lineTo(a,o+u),t.closePath(),t.clip()}if(l){var k=l/c;t.moveTo(a+s/2,k*(-s/2)+o+u),t.lineTo(a+s,o+u),t.lineTo(a+s,o),t.lineTo(a,o),t.closePath(),t.clip()}},gt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderRightColor,c=r.borderRightStyle,l=r.borderRightWidth,d=r.borderTopWidth,f=r.borderBottomWidth,p=i*(1-lt),g=n*(1-lt);t.moveTo(a+s-n,o),t.bezierCurveTo(a+s-g,o,a+s,o+g,a+s,o+n),t.lineTo(a+s,o+u-i),t.bezierCurveTo(a+s,o+u-p,a+s-p,o+u,a+s-i,o+u),t.strokeColor(h),t.lineWidth(2*Math.max(l,d,f)),"dashed"===c?t.dash(2*l,{space:1.2*l}):"dotted"===c&&t.dash(l,{space:1.2*l}),t.stroke(),t.undash()},mt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderBottomWidth,c=r.borderRightWidth,l=r.borderLeftWidth;t.moveTo(a+s-i,o+u),t.lineTo(a+n,o+u);var d=n*(1-lt);t.bezierCurveTo(a+d,o+u,a,o+u-d,a,o+u-n);var f=o+u-Math.max(h,n);t.lineTo(a,f),t.lineTo(a+l,f);var p=Math.max(n-l,0),g=Math.max(n-h,0),m=p*(1-lt),y=g*(1-lt);t.bezierCurveTo(a+l,o+u-h-y,a+l+m,o+u-h,a+l+p,o+u-h),t.lineTo(a+s-Math.max(i,c),o+u-h);var v=Math.max(i-c,0),b=Math.max(i-h,0),T=v*(1-lt),w=b*(1-lt),x=o+u-Math.max(h,i);t.bezierCurveTo(a+s-c-T,o+u-h,a+s-c,o+u-h-w,a+s-c,x),t.lineTo(a+s,x),t.lineTo(a+s,o+u-i);var C=i*(1-lt);if(t.bezierCurveTo(a+s,o+u-C,a+s-C,o+u,a+s-i,o+u),t.closePath(),t.clip(),c){var E=h/c;t.moveTo(a+s/2,E*(-s/2)+o+u),t.lineTo(a+s,o+u),t.lineTo(a,o+u),t.lineTo(a,o),t.closePath(),t.clip()}if(l){var k=-h/l;t.moveTo(a+s/2,k*(s/2)+o+u),t.lineTo(a,o+u),t.lineTo(a+s,o+u),t.lineTo(a+s,o),t.closePath(),t.clip()}},yt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderBottomColor,c=r.borderBottomStyle,l=r.borderBottomWidth,d=r.borderRightWidth,f=r.borderLeftWidth,p=n*(1-lt),g=i*(1-lt);t.moveTo(a+s,o+u-i),t.bezierCurveTo(a+s,o+u-g,a+s-g,o+u,a+s-i,o+u),t.lineTo(a+n,o+u),t.bezierCurveTo(a+p,o+u,a,o+u-p,a,o+u-n),t.strokeColor(h),t.lineWidth(2*Math.max(l,d,f)),"dashed"===c?t.dash(2*l,{space:1.2*l}):"dotted"===c&&t.dash(l,{space:1.2*l}),t.stroke(),t.undash()},vt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,h=r.borderTopWidth,c=r.borderLeftWidth,l=r.borderBottomWidth;t.moveTo(a,o+u-n),t.lineTo(a,o+i);var d=i*(1-lt);t.bezierCurveTo(a,o+d,a+d,o,a+i,o);var f=a+Math.max(c,i);t.lineTo(f,o),t.lineTo(f,o+h);var p=Math.max(i-c,0),g=Math.max(i-h,0),m=p*(1-lt),y=g*(1-lt);t.bezierCurveTo(a+c+m,o+h,a+c,o+h+y,a+c,o+Math.max(i,h)),t.lineTo(a+c,o+u-Math.max(n,l));var v=Math.max(n-c,0),b=Math.max(n-l,0),T=v*(1-lt),w=b*(1-lt),x=a+Math.max(n,c);t.bezierCurveTo(a+c,o+u-l-w,a+c+T,o+u-l,x,o+u-l),t.lineTo(x,o+u),t.lineTo(a+n,o+u);var C=n*(1-lt);if(t.bezierCurveTo(a+C,o+u,a,o+u-C,a,o+u-n),t.closePath(),t.clip(),l){var E=-l/c;t.moveTo(a+s/2,E*(s/2)+o+u),t.lineTo(a,o+u),t.lineTo(a,o),t.lineTo(a+s,o),t.closePath(),t.clip()}if(l){var k=-h/c;t.moveTo(a+s/2,k*(-s/2)+o),t.lineTo(a,o),t.lineTo(a,o+u),t.lineTo(a+s,o+u),t.closePath(),t.clip()}},bt=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.height,u=r.borderLeftColor,h=r.borderLeftStyle,c=r.borderLeftWidth,l=r.borderTopWidth,d=r.borderBottomWidth,f=n*(1-lt),p=i*(1-lt);t.moveTo(a+n,o+s),t.bezierCurveTo(a+f,o+s,a,o+s-f,a,o+s-n),t.lineTo(a,o+i),t.bezierCurveTo(a,o+p,a+p,o,a+i,o),t.strokeColor(u),t.lineWidth(2*Math.max(c,l,d)),"dashed"===h?t.dash(2*c,{space:1.2*c}):"dotted"===h&&t.dash(c,{space:1.2*c}),t.stroke(),t.undash()},Tt={drawBorders:function(){var t=this.root.instance,e=this.getAbsoluteLayout(),r=this.borderTopWidth,n=this.borderLeftWidth,i=this.borderRightWidth,o=this.borderBottomWidth,a=this.style,s=a.opacity,u=a.borderTopLeftRadius,h=void 0===u?0:u,c=a.borderTopRightRadius,l=void 0===c?0:c,d=a.borderBottomLeftRadius,f=void 0===d?0:d,p=a.borderBottomRightRadius,g=void 0===p?0:p,m=a.borderTopColor,y=void 0===m?"black":m,v=a.borderTopStyle,b=void 0===v?"solid":v,T=a.borderLeftColor,w=void 0===T?"black":T,x=a.borderLeftStyle,C=void 0===x?"solid":x,E=a.borderRightColor,k=void 0===E?"black":E,R=a.borderRightStyle,S=void 0===R?"solid":R,P=a.borderBottomColor,A=void 0===P?"black":P,L=a.borderBottomStyle,B={borderTopColor:y,borderTopWidth:r,borderTopStyle:b,borderLeftColor:w,borderLeftWidth:n,borderLeftStyle:C,borderRightColor:k,borderRightWidth:i,borderRightStyle:S,borderBottomColor:A,borderBottomWidth:o,borderBottomStyle:void 0===L?"solid":L,borderTopLeftRadius:h,borderTopRightRadius:l,borderBottomLeftRadius:f,borderBottomRightRadius:g},O=e.width,D=e.height,M=Math.min(l,.5*O,.5*D),_=Math.min(h,.5*O,.5*D),W=Math.min(g,.5*O,.5*D),I=Math.min(f,.5*O,.5*D);t.save(),t.strokeOpacity(s),r&&(t.save(),dt(t,e,B,M,_),ft(t,e,B,M,_),t.restore()),i&&(t.save(),pt(t,e,B,M,W),gt(t,e,B,M,W),t.restore()),o&&(t.save(),mt(t,e,B,I,W),yt(t,e,B,I,W),t.restore()),n&&(t.save(),vt(t,e,B,I,_),bt(t,e,B,I,_),t.restore()),t.restore()}},wt=(Math.sqrt(2)-1)/3*4,xt={clip:function(){var t=this.getAbsoluteLayout(),e=t.top,r=t.left,n=t.width,i=t.height,o=this.style,a=o.borderTopLeftRadius,s=void 0===a?0:a,u=o.borderTopRightRadius,h=void 0===u?0:u,c=o.borderBottomRightRadius,l=void 0===c?0:c,d=o.borderBottomLeftRadius,f=void 0===d?0:d,p=Math.min(h,.5*n,.5*i),g=p*(1-wt);this.root.instance.moveTo(r+p,e),this.root.instance.lineTo(r+n-p,e),this.root.instance.bezierCurveTo(r+n-g,e,r+n,e+g,r+n,e+p);var m=Math.min(l,.5*n,.5*i),y=m*(1-wt);this.root.instance.lineTo(r+n,e+i-m),this.root.instance.bezierCurveTo(r+n,e+i-y,r+n-y,e+i,r+n-m,e+i);var v=Math.min(f,.5*n,.5*i),b=v*(1-wt);this.root.instance.lineTo(r+v,e+i),this.root.instance.bezierCurveTo(r+b,e+i,r,e+i-b,r,e+i-v);var T=Math.min(s,.5*n,.5*i),w=T*(1-wt);this.root.instance.lineTo(r,e+T),this.root.instance.bezierCurveTo(r,e+w,r+w,e,r+T,e),this.root.instance.closePath(),this.root.instance.clip()}},Ct=function(t){var e=/translateX\((-?\d+\.?d*)\)/g.exec(t),r=/translate\((-?\d+\.?d*).*,\s*(-?\d+\.?d*).*\)/g.exec(t);return e&&e[1]?e[1]:r&&r[1]?r[1]:0},Et=function(t){var e=/translateY\((-?\d+\.?\d*)\)/g.exec(t),r=/translate\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:r&&r[2]?r[2]:0},kt=function(t){var e=/scaleX\((-?\d+\.?\d*)\)/g.exec(t),r=/scale\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:r&&r[1]?r[1]:1},Rt=function(t){var e=/scaleY\((-?\d+\.?\d*)\)/g.exec(t),r=/scale\((-?\d+\.?\d*).*,\s*(-?\d+\.?\d*).*\)/g.exec(t);return e&&e[1]?e[1]:r&&r[2]?r[2]:1},St=function(t,e,r){if(/rotate/g.test(e))t.root.instance.rotate(function(t){var e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){var r=e[1];return"rad"===e[2]?180*r/Math.PI:r}return 0}(e),{origin:r});else if(/scaleX/g.test(e))t.root.instance.scale(kt(e),1,{origin:r});else if(/scaleY/g.test(e))t.root.instance.scale(1,Rt(e),{origin:r});else if(/scale/g.test(e))t.root.instance.scale(kt(e),Rt(e),{origin:r});else if(/translateX/g.test(e))t.root.instance.translate(Ct(e),1,{origin:r});else if(/translateY/g.test(e))t.root.instance.translate(1,Et(e),{origin:r});else if(/translate/g.test(e))t.root.instance.translate(Ct(e),Et(e),{origin:r});else if(/matrix/g.test(e)){var n;(n=t.root.instance).transform.apply(n,function(t){var e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null}(e))}},Pt={applyTransformations:function(){for(var t,e=/[a-zA-Z]+\([^)]+\)/g,r=this.origin,n=this.style&&this.style.transform||"";null!=(t=e.exec(n));)St(this,t[0],r)}},At=function(t,e){return p(e)?t:e},Lt=function(t){return t.reduce(function(t,e){return f(At,t,e)},{})},Bt=g(m("Function"),y),Ot=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","opacity","textDecoration","lineHeight","textAlign","visibility","wordSpacing"],Dt=function(e){function n(t,r){var i;return(i=e.call(this)||this).root=t,i.style={},i.props=Lt([i.constructor.defaultProps,n.defaultProps,r]),G(!i.props.styles,'"styles" prop passed instead of "style" prop'),i}t(n,e);var i=n.prototype;return i.appendChild=function(t){e.prototype.appendChild.call(this,t),this.root.markDirty()},i.appendChildBefore=function(t,r){e.prototype.appendChildBefore.call(this,t,r),this.root.markDirty()},i.removeChild=function(t){e.prototype.removeChild.call(this,t),this.root.markDirty()},i.update=function(t){this.props=Lt([this.constructor.defaultProps,n.defaultProps,t]),this.root.markDirty()},i.applyProps=function(){var t=this;this.style=this.resolveStyles(),v(this.style).map(function(e){var r=e[0],n=e[1];t.applyStyle(r,n)}),this.children.forEach(function(t){t.applyProps&&t.applyProps()})},i.resolveStyles=function(){var t=this.page,e=t.size,n={orientation:t.orientation,isAutoHeight:t.isAutoHeight,width:e.width,height:e.height},i=ht.resolve(this.props.style,n),o=this.parent?b(Ot,this.parent.style):{};return r({},o,{},i)},i.applyStyle=function(t,e){if(void 0!==e){var r="set"+j(t);switch(t){case"marginTop":case"marginRight":case"marginBottom":case"marginLeft":case"paddingTop":case"paddingRight":case"paddingBottom":case"paddingLeft":case"borderTopWidth":case"borderRightWidth":case"borderBottomWidth":case"borderLeftWidth":case"position":case"top":case"right":case"bottom":case"left":case"width":case"height":case"minHeight":case"maxHeight":case"minWidth":case"maxWidth":this[t]=e;break;default:Bt(this.layout[r])&&this.layout[r](e)}}},i.getLayoutData=function(){var t=this.getAbsoluteLayout();return{type:this.name,top:t.top,left:t.left,width:t.width,style:this.style,height:t.height,children:this.children.map(function(t){return t.getLayoutData()})}},i.drawBackgroundColor=function(){var t=this.style,e=t.backgroundColor,r=t.opacity,n=void 0===r?1:r,i=this.getAbsoluteLayout(),o=i.left,a=i.top,s=i.width,u=i.height;e&&(this.root.instance.save(),this.clip(),this.root.instance.fillOpacity(n).fillColor(e).rect(o,a,s,u).fill().restore())},i.clone=function(){var t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t},i.onNodeSplit=function(t,e){this.calculateLayout(),e.marginTop=0,e.paddingTop=0,e.style.height&&(e.height=this.height-t),this.height=t,this.marginBottom=0,this.paddingBottom=0},i.renderChildren=function(){var t=a(o.mark(function t(){var e;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=0;case 1:if(!(e<this.children.length)){t.next=7;break}return t.next=4,this.children[e].render();case 4:e++,t.next=1;break;case 7:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),h(n,[{key:"page",get:function(){return this.parent.page}},{key:"wrap",get:function(){return this.props.wrap}},{key:"break",get:function(){return this.props.break},set:function(t){this.props.break=t}},{key:"fixed",get:function(){return this.props.fixed}},{key:"minPresenceAhead",get:function(){return this.props.minPresenceAhead}},{key:"absolute",get:function(){return"absolute"===this.props.style.position}},{key:"origin",get:function(){var t=this.style,e=t.transformOriginX,r=t.transformOriginY,n=this.getAbsoluteLayout(),i=n.left,o=n.top,a=n.width,s=n.height,u=U(e),h=U(r);return[i+(u?a*u.percent:e),o+(h?s*h.percent:r)]}}]),n}(V);Dt.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,transformOriginX:"50%",transformOriginY:"50%"},minPresenceAhead:0},Object.assign(Dt.prototype,ct),Object.assign(Dt.prototype,Tt),Object.assign(Dt.prototype,xt),Object.assign(Dt.prototype,Pt);var Mt=function(t,e){return Array.from({length:Math.ceil(t/e)},function(t,r){return r*e})},_t=function(t){var e=U(t);return e?100/e.value:null},Wt={getRulerWidth:function(){return 13},hasHorizontalRuler:function(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler:function(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps:function(){var t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){var e=_t(t);if(e)return(this.width-(this.hasVerticalRuler()?13:0))/e;throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps:function(){var t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){var e=_t(t);if(e)return(this.height-(this.hasHorizontalRuler()?13:0))/e;throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler:function(){var t=this.hasHorizontalRuler(),e=this.hasVerticalRuler();(t||e)&&(this.root.instance.save().lineWidth(.5).fontSize(5).opacity(1),t&&this.drawHorizontalRuler(),e&&this.drawVerticalRuler(),t&&e&&this.root.instance.rect(0,0,12.5,12.5).fill("white"),this.root.instance.restore())},drawHorizontalRuler:function(){var t=this,e=this.hasVerticalRuler()?13:0;this.root.instance.rect(e,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");var r=Mt(this.width,this.getHorizontalSteps());r.map(function(r){t.root.instance.moveTo(e+r,0).lineTo(e+r,13).stroke("gray").fillColor("black").text(""+Math.round(r),e+r+1,1)}),r.map(function(r){0!==r&&t.root.instance.moveTo(e+r,13).lineTo(e+r,t.height).stroke("#ababab")})},drawVerticalRuler:function(){var t=this,e=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,e,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");var r=Mt(this.height,this.getVerticalSteps());r.map(function(r){t.root.instance.moveTo(0,e+r).lineTo(13,e+r).stroke("gray").fillColor("black").text(""+Math.round(r),1,e+r+1)}),r.map(function(r){0!==r&&t.root.instance.moveTo(13,e+r).lineTo(t.width,e+r).stroke("#ababab")})}},It=function(){function t(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}var e=t.prototype;return e.getLayoutData=function(){return this.value},e.remove=function(){this.parent.removeChild(this)},e.clone=function(){return new this.constructor(this.root,this.value)},e.cleanup=function(){},e.update=function(t){this.value=t,this.parent.computed=!1,this.parent.container=null,this.root.markDirty()},h(t,[{key:"name",get:function(){return"TextInstance"}}]),t}(),zt={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],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],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],EXECUTIVE:[521.86,756],FOLIO:[612,936],LEGAL:[612,1008],LETTER:[612,792],TABLOID:[792,1224]},Nt=function(e){function r(t,r){var n;return(n=e.call(this,t,r)||this)._size=null,n}t(r,e);var n=r.prototype;return n.resetMargins=function(){(this.marginTop||this.marginBottom||this.marginLeft||this.marginRight)&&(G(!1,"Margin values are not allowed on Page element. Use padding instead."),this.marginTop=0,this.marginBottom=0,this.marginLeft=0,this.marginRight=0)},n.applyProps=function(){e.prototype.applyProps.call(this),this.top=0,this.left=0,this.width=this.size.width,this.resetMargins();var t=this.getRulerWidth();this.hasHorizontalRuler()&&(this.paddingTop=this.paddingTop+t),this.hasVerticalRuler()&&(this.paddingLeft=this.paddingLeft+t)},n.setPadding=function(t,e){var r=t===d.EDGE_TOP||t===d.EDGE_BOTTOM?this.size.height:this.size.width,n=U(e);n?this.layout.setPadding(t,r*n.percent):this.layout.setPadding(t,e)},n.addDynamicChild=function(){var t=a(o.mark(function t(e,r){var n,a,s,u,h,c,l;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r){t.next=2;break}return t.abrupt("return");case 2:n=Array.isArray(r)?r:[r],a=0;case 4:if(!(a<n.length)){t.next=27;break}if(s=n[a],u=s.type,h=s.props,"string"!=typeof s){t.next=12;break}c=new It(this.root,s),e.appendChild(c),t.next=24;break;case 12:if(u===i){t.next=22;break}return l=Ye(s,this.root),t.next=16,l.onAppendDynamically();case 16:return e.appendChild(l),l.applyProps(),t.next=20,this.addDynamicChild(l,h.children);case 20:t.next=24;break;case 22:return t.next=24,this.addDynamicChild(e,h.children);case 24:a++,t.next=4;break;case 27:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}(),n.renderDynamicNodes=function(){var t=a(o.mark(function t(e,r){var n,i,a;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=this.children.slice(0);case 1:if(!(n.length>0)){t.next=14;break}if(i=n.shift(),!(!r||r(i))||!i.props.render){t.next=11;break}return i.removeAllChilds(),a=i.props.render(e),t.next=9,this.addDynamicChild(i,a);case 9:return i.fixed||(i.props.render=null),t.abrupt("continue",1);case 11:i.children&&n.push.apply(n,i.children),t.next=1;break;case 14:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}(),n.nodeWillWrap=function(){var t=a(o.mark(function t(e){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.renderDynamicNodes(e);case 2:this.calculateLayout();case 3:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}(),n.onNodeSplit=function(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()},n.clone=function(){var t=e.prototype.clone.call(this);return t._size=this.size,t},n.update=function(t){e.prototype.update.call(this,t),this._size=null},n.render=function(){var t=a(o.mark(function t(){var e,r;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.root.instance,this.isAutoHeight||(this.height=this.size.height),this.calculateLayout(),r=this.isAutoHeight?this.height:this.size.height,e.addPage({size:[this.size.width,r],margin:0}),this.style.backgroundColor&&e.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,r).fill(),t.next=8,this.renderChildren();case 8:this.props.debug&&this.debug(),this.renderRuler();case 10:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),h(r,[{key:"name",get:function(){return"Page"}},{key:"document",get:function(){return this.parent}},{key:"page",get:function(){return this}},{key:"orientation",get:function(){return this.props.orientation}},{key:"size",get:function(){return this._size?this._size:(this._size=function(t,e){var r;if(void 0===e&&(e="portrait"),"string"==typeof t)r=zt[t.toUpperCase()];else if(Array.isArray(t))r=t;else if("number"==typeof t)r=[t];else{if("object"!=typeof t||!t.width)throw new Error("Invalid Page size: "+t);r=[t.width,t.height]}return"portrait"===e?{width:r[0],height:r[1]}:{width:r[1],height:r[0]}}(this.props.size,this.orientation),this.hasHorizontalRuler()&&(this._size.width+=this.getRulerWidth()),this.hasVerticalRuler()&&(this._size.height+=this.getRulerWidth()),this._size)}},{key:"isAutoHeight",get:function(){return void 0===this.size.height}}]),r}(Dt);Nt.defaultProps={size:"A4",wrap:!0,orientation:"portrait"},Object.assign(Nt.prototype,Wt);var Ft=function(e){function r(){return e.apply(this,arguments)||this}return t(r,e),r.prototype.render=function(){var t=a(o.mark(function t(){return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.props.onRender&&this.props.onRender(this),t.next=7,this.renderChildren();case 7:this.props.debug&&this.debug(),this.root.instance.restore();case 9:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),h(r,[{key:"name",get:function(){return"View"}}]),r}(Dt);Ft.defaultProps={wrap:!0};var Gt,Ht,jt=function(){var t=a(o.mark(function t(e,r){var n,i;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,L(e,r);case 2:return n=t.sent,t.next=5,n.buffer?n.buffer():n.arrayBuffer();case 5:return i=t.sent,t.abrupt("return","Buffer"===i.constructor.name?i:Buffer.from(i));case 7:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),Ut=function(){function t(t,e,r,n,i){this.src=t,this.fontFamily=e,this.fontStyle=r||"normal",this.fontWeight=tt(n)||400,this.data=null,this.loading=!1,this.options=i}return t.prototype.load=function(){var t=a(o.mark(function t(){var e,r,n,i,a,s,u=this;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading=!0,e=this.options,r=e.headers,n=e.body,i=e.method,a=void 0===i?"GET":i,t.next=5,jt(this.src,{method:a,body:n,headers:r});case 5:s=t.sent,this.data=A.create(s),t.next=12;break;case 9:return t.next=11,new Promise(function(t,e){return A.open(u.src,function(r,n){return r?e(r):t(n)})});case 11:this.data=t.sent;case 12:this.loading=!1;case 13:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),t}(),Vt=function(){function t(t){this.family=t,this.sources=[]}t.create=function(e){return new t(e)};var r=t.prototype;return r.register=function(t){var r=t.src,n=t.fontWeight,i=t.fontStyle,o=e(t,["src","fontWeight","fontStyle"]);this.sources.push(new Ut(r,this.fontFamily,i,n,o))},r.resolve=function(t){var e,r=t.fontWeight,n=void 0===r?400:r,i=t.fontStyle,o=void 0===i?"normal":i,a=this.sources.filter(function(t){return t.fontStyle===o}),s=a.find(function(t){return t.fontWeight===n});if(s)return s;if(n>=400&&n<=500){var u=a.filter(function(t){return t.fontWeight<=n}),h=a.filter(function(t){return t.fontWeight>500});e=a.filter(function(t){return t.fontWeight>=n&&t.fontWeight<500})[0]||u[u.length-1]||h[0]}var c=a.filter(function(t){return t.fontWeight<n}),l=a.filter(function(t){return t.fontWeight>n});if(n<400&&(e=c[c.length-1]||l[0]),n>500&&(e=l[0]||c[c.length-1]),!e)throw new Error("Could not resolve font for "+this.fontFamily+", fontWeight "+n);return e},t}(),Xt={registerEmojiSource:function(t){var e=t.url,r=t.format;Gt={url:e,format:void 0===r?"png":r}},getEmojiSource:function(){return Gt}},Yt=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"],Jt={registerHyphenationCallback:function(t){Ht=t},getHyphenationCallback:function(){return Ht}},qt={},Kt=function(t){var e=t.fontFamily;if(Yt.includes(e))return null;if(!qt[e])throw new Error("Font family not registered: "+e+". Please register it calling Font.register() method.");return qt[e].resolve(t)},Zt=function(){var t=a(o.mark(function t(e,r){var n,i;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.fontFamily,!Yt.includes(n)){t.next=4;break}return t.abrupt("return");case 4:if((i=Kt(e)).data||i.loading){t.next=8;break}return t.next=8,i.load();case 8:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),$t=r({register:function(t,e){"object"==typeof t?e=t:(G(!1,"Font.register will not longer accept the font source as first argument. Please move it into the data object. For more info refer to https://react-pdf.org/fonts"),e.src=t);var n=e.family;if(qt[n]||(qt[n]=Vt.create(n)),e.fonts)for(var i=0;i<e.fonts.length;i++)qt[n].register(r({family:n},e.fonts[i]));else qt[n].register(e)},getRegisteredFonts:function(){return qt},getRegisteredFontFamilies:function(){return Object.keys(qt)},getFont:Kt,load:Zt,clear:function(){qt={}},reset:function(){for(var t in qt)qt.hasOwnProperty(t)&&(qt[t].data=null)}},Xt,{},Jt),Qt=function(){function t(t){this.name=t,this.src=l.open(null,t)}var e=t.prototype;return e.layout=function(t){var e=this,r=this.src.encode(t),n=r[0],i=r[1];return{positions:i,stringIndices:i.map(function(t,e){return e}),glyphs:n.map(function(t,r){var n=e.getGlyph(parseInt(t,16));return n.advanceWidth=i[r].advanceWidth,n})}},e.glyphForCodePoint=function(t){var e=this.getGlyph(t);return e.advanceWidth=400,e},e.getGlyph=function(t){return{id:t,_font:this.src,codePoints:[t],isLigature:!1,name:this.src.font.characterToGlyph(t)}},e.hasGlyphForCodePoint=function(t){return".notdef"!==this.src.font.characterToGlyph(t)},h(t,[{key:"ascent",get:function(){return 900}},{key:"descent",get:function(){switch(this.name){case"Times-Roman":case"Times-Bold":case"Times-Italic":return-220;case"Courier":case"Courier-Bold":case"Courier-Oblique":return-230;default:return-200}}},{key:"lineGap",get:function(){return 0}},{key:"unitsPerEm",get:function(){return 1e3}}]),t}(),te={},ee=[173],re=T(12,["attributes","fontSize"]),ne=function(){return ie("Helvetica")},ie=function(t){if(te[t])return te[t];var e=new Qt(t);return te[t]=e,e},oe=function(t,e){return!ee.includes(t)&&!e.hasGlyphForCodePoint(t)&&ne().hasGlyphForCodePoint(t)},ae=B({linebreaker:O,justification:D,textDecoration:M,scriptItemizer:_,wordHyphenation:W,fontSubstitution:function(){return function(t){var e=t.string,r=t.runs,n=null,i=0,o=0,a=[],s=r,u=Array.isArray(s),h=0;for(s=u?s:s[Symbol.iterator]();;){var c;if(u){if(h>=s.length)break;c=s[h++]}else{if((h=s.next()).done)break;c=h.value}var l=c,d=re(l),f="string"==typeof l.attributes.font?ie(l.attributes.font):l.attributes.font;if(0===e.length){a.push({start:0,end:0,attributes:{font:f}});break}var p=e.slice(l.start,l.end),g=Array.isArray(p),m=0;for(p=g?p:p[Symbol.iterator]();;){var y;if(g){if(m>=p.length)break;y=p[m++]}else{if((m=p.next()).done)break;y=m.value}var v=y,b=v.codePointAt(),T=oe(b,f)?ne():f;T!==n&&(n&&a.push({start:i,end:o,attributes:{font:n,scale:n?d/n.unitsPerEm:0}}),n=T,i=o),o+=v.length}}if(i<e.length){var x=re(w(r));a.push({start:i,end:e.length,attributes:{font:n,scale:n?x/n.unitsPerEm:0}})}return{string:e,runs:a}}}}),se=/^([a-z]+\:(\/\/)?)/i,ue=function(t){return t?"string"!=typeof t||t.match(se)?t:"http://"+t:""};z.isValid=function(t){try{return!!new z(t)}catch(t){return!1}};var he=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],ce=function(t){if(this.data=null,this.width=null,this.height=null,this.data=t,65496!==t.readUInt16BE(0))throw new Error("SOI not found in JPEG");for(var e,r=2;r<t.length&&(e=t.readUInt16BE(r),r+=2,!he.includes(e));)r+=t.readUInt16BE(r);if(!he.includes(e))throw new Error("Invalid JPEG.");r+=3,this.height=t.readUInt16BE(r),r+=2,this.width=t.readUInt16BE(r)};ce.isValid=function(t){if(!t||!Buffer.isBuffer(t)||65496!==t.readUInt16BE(0))return!1;for(var e,r=2;r<t.length&&(e=t.readUInt16BE(r),r+=2,!he.includes(e));)r+=t.readUInt16BE(r);return!!he.includes(e)};var le,de,fe,pe,ge,me=(de=(void 0===(le={limit:30})?{}:le).limit,fe=void 0===de?100:de,pe={},ge=[],{get:function(t){return pe[t]},set:function(t,e){ge.push(t),ge.length>fe&&delete pe[ge.shift()],pe[t]=e},reset:function(){pe={},ge=[]},length:function(){return ge.length}}),ye=function(){var t=a(o.mark(function t(e,r){var n,i;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,L(e,r);case 2:return n=t.sent,t.next=5,n.buffer?n.buffer():n.arrayBuffer();case 5:return i=t.sent,t.abrupt("return","Buffer"===i.constructor.name?i:Buffer.from(i));case 7:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}();function ve(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new ce(t);case"png":return new z(t);default:return null}}var be=function(t){var e=function(t){var e;return ce.isValid(t)?e="jpg":z.isValid(t)&&(e="png"),e}(t);if(e)return new Promise(function(r){return r(ve(t,e))})},Te=function(t){var e=137===t[0]&&80===t[1]&&78===t[2]&&71===t[3]&&13===t[4]&&10===t[5]&&26===t[6]&&10===t[7],r=255===t[0]&&216===t[1]&&255===t[2],n="";if(e)n="png";else{if(!r)throw new Error("Not valid image extension");n="jpg"}return n},we=function(){var t=a(o.mark(function t(e,r){var n,i,a,s,u,h,c;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=e.uri,i=e.body,a=e.headers,s=e.method,u=void 0===s?"GET":s,t.next=7;break;case 4:t.t0=t.sent,t.next=10;break;case 7:return t.next=9,ye(n,{body:i,headers:a,method:u});case 9:t.t0=t.sent;case 10:return h=t.t0,c=Te(h),t.abrupt("return",ve(h,c));case 13:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),xe=function(t,r){var n,i,o=void 0===r?{}:r,a=o.cache,s=void 0===a||a,u=e(o,["cache"]),h=t.data?t.data.toString():t.uri;if(s&&me.get(h))return me.get(h);if(i=t.uri,!(n=/^data:image\/[a-zA-Z]*;base64,[^"]*/g.test(i)?function(t){var e=t.uri,r=/^data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(e),n=r[1],i=r[2];if(!function(t){var e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e}(n))throw new Error("Base64 image invalid format: "+n);return new Promise(function(t){return t(ve(Buffer.from(i,"base64"),n))})}(t):Buffer.isBuffer(t)?be(t):"object"==typeof t&&t.data?function(t){if(t.data&&t.format)return new Promise(function(e){return e(ve(t.data,t.format))});throw new Error("Invalid data given for local file: "+JSON.stringify(t))}(t):we(t,u)))throw new Error("Cannot resolve image");return s&&me.set(h,n),n},Ce={},Ee=I(),ke=function(t){return"️"!==t},Re=function(t){var e,r=$t.getEmojiSource(),n=r.url,i=r.format;return""+n+(e=t,Array.from(e).filter(ke).map(function(t){return t.codePointAt(0).toString(16)}).join("-"))+"."+i},Se=function(t){var e=$t.getEmojiSource();if(!e||!e.url)return[];for(var r,n=[],i=function(){var t,e=r[0];if(!Ce[e]||Ce[e].loading){var i=Re(e);Ce[e]={loading:!0};var o=(t=xe,function(){return t.apply(void 0,arguments).then(function(t){return t},function(t){return t})});n.push(o({uri:i}).then(function(t){Ce[e].loading=!1,Ce[e].data=t.data}))}};r=Ee.exec(t);)i();return n},Pe=[8232,8233],Ae=[function(t){return t.map(function(t){var e,r=(e=t.attributes.font,Pe.reduce(function(t,r){return e.hasGlyphForCodePoint&&e.hasGlyphForCodePoint(r)?t:[].concat(t,[String.fromCharCode(r)])},[])),n=new RegExp(r.join("|"));return{string:t.string.replace(n,""),attributes:t.attributes}})},function(t){for(var e=[],n=0;n<t.length;n++){for(var i=t[n],o=void 0,a=0;o=Ee.exec(i.string);){var s=o.index,u=o[0],h=i.attributes.fontSize,c=i.string.slice(a,s+o[0].length);Ce[u]&&Ce[u].data?e.push({string:c.replace(o,String.fromCharCode(65532)),attributes:r({},i.attributes,{attachment:{width:h,height:h,yOffset:Math.floor(.1*h),image:Ce[u].data}})}):e.push({string:c.replace(o,String.fromCharCode(0)),attributes:i.attributes}),a=s+u.length}a<i.string.length&&e.push({string:i.string.slice(a),attributes:i.attributes})}return e}],Le=x("name","Image"),Be=g(C(p),E("value")),Oe=function(t,e){switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return t.replace(/(^|\s)\S/g,function(t){return t.toUpperCase()});default:return t}},De=function(t){return P.fromFragments(function t(e){if(!e)return[{string:""}];var n=[],i=e.style,o=i.color,a=void 0===o?"black":o,s=i.backgroundColor,u=i.fontFamily,h=void 0===u?"Helvetica":u,c=i.fontWeight,l=i.fontStyle,d=i.fontSize,f=void 0===d?18:d,p=i.textAlign,g=void 0===p?"left":p,m=i.lineHeight,y=i.textDecoration,v=i.textDecorationColor,b=i.textDecorationStyle,T=i.textTransform,w=i.letterSpacing,x=i.textIndent,C=i.opacity,E=$t.getFont({fontFamily:h,fontWeight:c,fontStyle:l}),k={font:E?E.data:h,color:a,opacity:C,fontSize:f,backgroundColor:s,align:g,indent:x,link:e.src,characterSpacing:w,underlineStyle:b,underline:"underline"===y,underlineColor:v||a,strike:"line-through"===y,strikeStyle:b,strikeColor:v||a,lineHeight:m?m*f:null};e.children.forEach(function(e){if(Le(e))n.push({string:String.fromCharCode(65532),attributes:r({},k,{attachment:{width:e.style.width||f,height:e.style.height||f,image:e.image.data}})});else if(Be(e))n.push({st