text: "use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var _inheritsLoose=_interopDefault(require("@babel/runtime/helpers/inheritsLoose")),_objectWithoutPropertiesLoose=_interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")),_extends=_interopDefault(require("@babel/runtime/helpers/extends")),React=require("react"),React__default=_interopDefault(React),_regeneratorRuntime=_interopDefault(require("@babel/runtime/regenerator")),_asyncToGenerator=_interopDefault(require("@babel/runtime/helpers/asyncToGenerator")),BlobStream=_interopDefault(require("blob-stream")),ReactFiberReconciler=_interopDefault(require("react-reconciler")),scheduler=require("scheduler"),_createClass=_interopDefault(require("@babel/runtime/helpers/createClass")),PDFDocument=require("@react-pdf/pdfkit"),PDFDocument__default=_interopDefault(PDFDocument),Yoga=_interopDefault(require("yoga-layout-prebuilt")),ramda=require("ramda"),matchMedia=_interopDefault(require("media-engine")),_assertThisInitialized=_interopDefault(require("@babel/runtime/helpers/assertThisInitialized")),PDFRenderer$1=_interopDefault(require("@react-pdf/textkit/renderers/pdf")),AttributedString=_interopDefault(require("@react-pdf/textkit/attributedString"));require("is-url");var fontkit=_interopDefault(require("@react-pdf/fontkit")),fetch=_interopDefault(require("cross-fetch")),layoutEngine=_interopDefault(require("@react-pdf/textkit/layout")),linebreaker=_interopDefault(require("@react-pdf/textkit/engines/linebreaker")),justification=_interopDefault(require("@react-pdf/textkit/engines/justification")),textDecoration=_interopDefault(require("@react-pdf/textkit/engines/textDecoration")),scriptItemizer=_interopDefault(require("@react-pdf/textkit/engines/scriptItemizer")),wordHyphenation=_interopDefault(require("@react-pdf/textkit/engines/wordHyphenation")),emojiRegex=_interopDefault(require("emoji-regex")),PNG=_interopDefault(require("@react-pdf/png-js")),_wrapPages=_interopDefault(require("page-wrapping"));function printWarning(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 __DEV__="production"!==process.env.NODE_ENV,warning=__DEV__?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];printWarning.apply(void 0,[e].concat(n))}}:function(){},Root=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=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.instance=new PDFDocument__default({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)}}(),_createClass(t,[{key:"name",get:function(){return"Root"}}]),t}(),upperFirst=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},isPercent=function(t){return/((-)?\d+\.?\d*)%/g.exec(t)},matchPercent=function(t){var e=isPercent(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},YOGA_CONFIG=Yoga.Config.create();YOGA_CONFIG.setPointScaleFactor(0);var Node=function(){function t(){this.parent=null,this.children=[],this.computed=!1,this.layout=Yoga.Node.createWithConfig(YOGA_CONFIG)}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"+upperFirst(t),n=r+"Percent",i=matchPercent(e);i?this.layout[n](i.value):this.layout[r](e)},e.setPosition=function(t,e){var r=matchPercent(e);r?this.layout.setPositionPercent(t,r.value):this.layout.setPosition(t,e)},e.setPadding=function(t,e){var r=matchPercent(e);r?this.layout.setPaddingPercent(t,r.value):this.layout.setPadding(t,e)},e.setMargin=function(t,e){var r=matchPercent(e);r?this.layout.setMarginPercent(t,r.value):this.layout.setMargin(t,e)},e.setBorder=function(t,e){if(matchPercent(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(),Yoga.Node.destroy(this.layout)},_createClass(t,[{key:"position",get:function(){return this.layout.getPositionType()===Yoga.POSITION_TYPE_ABSOLUTE?"absolute":"relative"},set:function(t){this.layout.setPositionType("absolute"===t?Yoga.POSITION_TYPE_ABSOLUTE:Yoga.POSITION_TYPE_RELATIVE)}},{key:"top",get:function(){return this.layout.getComputedTop()||0},set:function(t){this.setPosition(Yoga.EDGE_TOP,t)}},{key:"left",get:function(){return this.layout.getComputedLeft()||0},set:function(t){this.setPosition(Yoga.EDGE_LEFT,t)}},{key:"right",get:function(){return this.layout.getComputedRight()||0},set:function(t){this.setPosition(Yoga.EDGE_RIGHT,t)}},{key:"bottom",get:function(){return this.layout.getComputedBottom()||0},set:function(t){this.setPosition(Yoga.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(Yoga.EDGE_TOP)||0},set:function(t){this.setPadding(Yoga.EDGE_TOP,t)}},{key:"paddingRight",get:function(){return this.layout.getComputedPadding(Yoga.EDGE_RIGHT)||0},set:function(t){this.setPadding(Yoga.EDGE_RIGHT,t)}},{key:"paddingBottom",get:function(){return this.layout.getComputedPadding(Yoga.EDGE_BOTTOM)||0},set:function(t){this.setPadding(Yoga.EDGE_BOTTOM,t)}},{key:"paddingLeft",get:function(){return this.layout.getComputedPadding(Yoga.EDGE_LEFT)||0},set:function(t){this.setPadding(Yoga.EDGE_LEFT,t)}},{key:"marginTop",get:function(){return this.layout.getComputedMargin(Yoga.EDGE_TOP)||0},set:function(t){this.setMargin(Yoga.EDGE_TOP,t)}},{key:"marginRight",get:function(){return this.layout.getComputedMargin(Yoga.EDGE_RIGHT)||0},set:function(t){this.setMargin(Yoga.EDGE_RIGHT,t)}},{key:"marginBottom",get:function(){return this.layout.getComputedMargin(Yoga.EDGE_BOTTOM)||0},set:function(t){this.setMargin(Yoga.EDGE_BOTTOM,t)}},{key:"marginLeft",get:function(){return this.layout.getComputedMargin(Yoga.EDGE_LEFT)||0},set:function(t){this.setMargin(Yoga.EDGE_LEFT,t)}},{key:"borderTopWidth",get:function(){return this.layout.getComputedBorder(Yoga.EDGE_TOP)||0},set:function(t){this.setBorder(Yoga.EDGE_TOP,t)}},{key:"borderRightWidth",get:function(){return this.layout.getComputedBorder(Yoga.EDGE_RIGHT)||0},set:function(t){this.setBorder(Yoga.EDGE_RIGHT,t)}},{key:"borderBottomWidth",get:function(){return this.layout.getComputedBorder(Yoga.EDGE_BOTTOM)||0},set:function(t){this.setBorder(Yoga.EDGE_BOTTOM,t)}},{key:"borderLeftWidth",get:function(){return this.layout.getComputedBorder(Yoga.EDGE_LEFT)||0},set:function(t){this.setBorder(Yoga.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}(),yogaValue=function(t,e){var r=function(t){return"alignItems"===t||"alignContent"===t||"alignSelf"===t};switch(e){case"auto":if("alignSelf"===t)return Yoga.ALIGN_AUTO;break;case"flex":return Yoga.DISPLAY_FLEX;case"none":return Yoga.DISPLAY_NONE;case"row":return Yoga.FLEX_DIRECTION_ROW;case"row-reverse":return Yoga.FLEX_DIRECTION_ROW_REVERSE;case"column":return Yoga.FLEX_DIRECTION_COLUMN;case"column-reverse":return Yoga.FLEX_DIRECTION_COLUMN_REVERSE;case"stretch":return Yoga.ALIGN_STRETCH;case"baseline":return Yoga.ALIGN_BASELINE;case"space-around":if("justifyContent"===t)return Yoga.JUSTIFY_SPACE_AROUND;if(r(t))return Yoga.ALIGN_SPACE_AROUND;break;case"space-between":if("justifyContent"===t)return Yoga.JUSTIFY_SPACE_BETWEEN;if(r(t))return Yoga.ALIGN_SPACE_BETWEEN;break;case"around":return Yoga.JUSTIFY_SPACE_AROUND;case"between":return Yoga.JUSTIFY_SPACE_BETWEEN;case"wrap":return Yoga.WRAP_WRAP;case"wrap-reverse":return Yoga.WRAP_WRAP_REVERSE;case"nowrap":return Yoga.WRAP_NO_WRAP;case"flex-start":if("justifyContent"===t)return Yoga.JUSTIFY_FLEX_START;if(r(t))return Yoga.ALIGN_FLEX_START;break;case"flex-end":if("justifyContent"===t)return Yoga.JUSTIFY_FLEX_END;if(r(t))return Yoga.ALIGN_FLEX_END;break;case"center":if("justifyContent"===t)return Yoga.JUSTIFY_CENTER;if(r(t))return Yoga.ALIGN_CENTER;break;default:return e}},DPI=72,parseValue=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}},parseScalar=function(t,e){var r=parseValue(t);switch(r.unit){case"in":return r.value*DPI;case"mm":return r.value*(1/25.4)*DPI;case"cm":return r.value*(1/2.54)*DPI;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}},isBorderStyle=function(t,e){return t.match(/^border/)&&"string"==typeof e},matchBorderShorthand=function(t){return t.match(/(\d+(px|in|mm|cm|pt|vw|vh)?)\s(\S+)\s(\S+)/)},processBorders=function(t,e){var r=matchBorderShorthand(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},isBoxModelStyle=function(t,e){return t.match(/^(margin)|(padding)/)&&"string"==typeof e},matchBoxModel=function(t){return t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g)},processBoxModel=function(t,e){var r=matchBoxModel(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},FONT_WEIGHTS={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},isFontWeightStyle=function(t){return t.match(/^fontWeight/)},processFontWeight=function(t){return t?"number"==typeof t?t:FONT_WEIGHTS[t.toLowerCase()]:FONT_WEIGHTS.normal},isObjectPositionStyle=function(t,e){return t.match(/^objectPosition/)&&"string"==typeof e},matchObjectPosition=function(t){return t.match(/\d+(px|in|mm|cm|pt|%|vw|vh)?/g)},processObjectPosition=function(t,e){var r=matchObjectPosition(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},isTransformOriginStyle=function(t,e){return t.match(/^transformOrigin/)&&"string"==typeof e},matchTransformOrigin=function(t){return t.match(/(-?\d+(px|in|mm|cm|pt|%|vw|vh)?)|top|right|bottom|left|center/g)},transformOffsetKeywords=function(t){switch(t){case"top":case"left":return"0%";case"right":case"bottom":return"100%";case"center":return"50%";default:return t}},processTransformOrigin=function(t,e){var r=matchTransformOrigin(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 transformOffsetKeywords(n)}return e},hasOwnProperty=Object.prototype.hasOwnProperty,styleShorthands={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}},expandStyles=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]=yogaValue(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=styleShorthands[i];for(var s in a)hasOwnProperty.call(a,s)&&(r[s]=o);break;default:r[i]=o}}return r},transformStyles=function(t,e){for(var r=expandStyles(t),n=Object.keys(r),i={},o=0;o<n.length;o++){var a=n[o],s=r[a],u=void 0;u=isBorderStyle(a,s)?processBorders(a,s):isBoxModelStyle(a,s)?processBoxModel(a,s):isObjectPositionStyle(a,s)?processObjectPosition(a,s):isTransformOriginStyle(a,s)?processTransformOrigin(a,s):isFontWeightStyle(a)?processFontWeight(s):s,i[a]=parseScalar(u,e)}return i},create=function(t){return t},flatten=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},{})},resolveMediaQueries=function(t,e){return Object.keys(t).reduce(function(r,n){var i,o;return/@media/.test(n)?_extends({},r,{},matchMedia(((o={})[n]=t[n],o),e)):_extends({},r,((i={})[n]=t[n],i))},{})},resolve=function(t,e){return t?(t=flatten(t),t=resolveMediaQueries(t,e),t=transformStyles(t,e)):null},absoluteFillObject={position:"absolute",top:0,left:0,bottom:0,right:0},StyleSheet={hairlineWidth:1,create:create,resolve:resolve,flatten:flatten,absoluteFillObject:absoluteFillObject},Debug={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()}},KAPPA=(Math.sqrt(2)-1)/3*4;function drawBorders(){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,c=void 0===u?0:u,h=a.borderTopRightRadius,l=void 0===h?0:h,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,R=void 0===T?"black":T,_=a.borderLeftStyle,E=void 0===_?"solid":_,P=a.borderRightColor,C=void 0===P?"black":P,w=a.borderRightStyle,x=void 0===w?"solid":w,S=a.borderBottomColor,k=void 0===S?"black":S,A=a.borderBottomStyle,D={borderTopColor:y,borderTopWidth:r,borderTopStyle:b,borderLeftColor:R,borderLeftWidth:n,borderLeftStyle:E,borderRightColor:C,borderRightWidth:i,borderRightStyle:x,borderBottomColor:k,borderBottomWidth:o,borderBottomStyle:void 0===A?"solid":A,borderTopLeftRadius:c,borderTopRightRadius:l,borderBottomLeftRadius:f,borderBottomRightRadius:g},L=e.width,O=e.height,I=Math.min(l,.5*L,.5*O),B=Math.min(c,.5*L,.5*O),F=Math.min(g,.5*L,.5*O),M=Math.min(f,.5*L,.5*O);t.save(),t.strokeOpacity(s),r&&(t.save(),clipBorderTop(t,e,D,I,B),fillBorderTop(t,e,D,I,B),t.restore()),i&&(t.save(),clipBorderRight(t,e,D,I,F),fillBorderRight(t,e,D,I,F),t.restore()),o&&(t.save(),clipBorderBottom(t,e,D,M,F),fillBorderBottom(t,e,D,M,F),t.restore()),n&&(t.save(),clipBorderLeft(t,e,D,M,B),fillBorderLeft(t,e,D,M,B),t.restore()),t.restore()}var clipBorderTop=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderTopWidth,h=r.borderRightWidth,l=r.borderLeftWidth;t.moveTo(a+i,o),t.lineTo(a+s-n,o);var d=n*(1-KAPPA);t.bezierCurveTo(a+s-d,o,a+s,o+d,a+s,o+n);var f=o+Math.max(c,n);t.lineTo(a+s,f),t.lineTo(a+s-h,f);var p=Math.max(n-h,0),g=Math.max(n-c,0),m=p*(1-KAPPA),y=g*(1-KAPPA);t.bezierCurveTo(a+s-h,o+c+y,a+s-h-m,o+c,a+s-h-p,o+c),t.lineTo(a+Math.max(i,l),o+c);var v=Math.max(i-l,0),b=Math.max(i-c,0),T=v*(1-KAPPA),R=b*(1-KAPPA),_=o+Math.max(c,i);t.bezierCurveTo(a+l+T,o+c,a+l,o+c+R,a+l,_),t.lineTo(a,_),t.lineTo(a,o+i);var E=i*(1-KAPPA);if(t.bezierCurveTo(a,o+E,a+E,o,a+i,o),t.closePath(),t.clip(),h){var P=-c/h;t.moveTo(a+s/2,P*(-s/2)+o),t.lineTo(a+s,o),t.lineTo(a,o),t.lineTo(a,o+u),t.closePath(),t.clip()}if(l){var C=-c/l;t.moveTo(a+s/2,C*(-s/2)+o),t.lineTo(a,o),t.lineTo(a+s,o),t.lineTo(a+s,o+u),t.closePath(),t.clip()}},fillBorderTop=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=r.borderTopColor,c=r.borderTopWidth,h=r.borderTopStyle,l=r.borderRightWidth,d=r.borderLeftWidth,f=i*(1-KAPPA),p=n*(1-KAPPA);t.moveTo(a,o+Math.max(i,c)),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,c,d)),"dashed"===h?t.dash(2*c,{space:1.2*c}):"dotted"===h&&t.dash(c,{space:1.2*c}),t.stroke(),t.undash()},clipBorderRight=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderTopWidth,h=r.borderRightWidth,l=r.borderBottomWidth;t.moveTo(a+s,o+n),t.lineTo(a+s,o+u-i);var d=i*(1-KAPPA);t.bezierCurveTo(a+s,o+u-d,a+s-d,o+u,a+s-i,o+u);var f=a+s-Math.max(h,i);t.lineTo(f,o+u),t.lineTo(f,o+u-l);var p=Math.max(i-h,0),g=Math.max(i-l,0),m=p*(1-KAPPA),y=g*(1-KAPPA);t.bezierCurveTo(a+s-h-m,o+u-l,a+s-h,o+u-l-y,a+s-h,o+u-Math.max(i,l)),t.lineTo(a+s-h,o+Math.max(n,c));var v=Math.max(n-h,0),b=Math.max(n-c,0),T=v*(1-KAPPA),R=b*(1-KAPPA),_=a+s-Math.max(n,h);t.bezierCurveTo(a+s-h,o+c+R,a+s-h-T,o+c,_,o+c),t.lineTo(_,o),t.lineTo(a+s-n,o);var E=n*(1-KAPPA);if(t.bezierCurveTo(a+s-E,o,a+s,o+E,a+s,o+n),t.closePath(),t.clip(),c){var P=-c/h;t.moveTo(a+s/2,P*(-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 C=l/h;t.moveTo(a+s/2,C*(-s/2)+o+u),t.lineTo(a+s,o+u),t.lineTo(a+s,o),t.lineTo(a,o),t.closePath(),t.clip()}},fillBorderRight=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderRightColor,h=r.borderRightStyle,l=r.borderRightWidth,d=r.borderTopWidth,f=r.borderBottomWidth,p=i*(1-KAPPA),g=n*(1-KAPPA);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(c),t.lineWidth(2*Math.max(l,d,f)),"dashed"===h?t.dash(2*l,{space:1.2*l}):"dotted"===h&&t.dash(l,{space:1.2*l}),t.stroke(),t.undash()},clipBorderBottom=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderBottomWidth,h=r.borderRightWidth,l=r.borderLeftWidth;t.moveTo(a+s-i,o+u),t.lineTo(a+n,o+u);var d=n*(1-KAPPA);t.bezierCurveTo(a+d,o+u,a,o+u-d,a,o+u-n);var f=o+u-Math.max(c,n);t.lineTo(a,f),t.lineTo(a+l,f);var p=Math.max(n-l,0),g=Math.max(n-c,0),m=p*(1-KAPPA),y=g*(1-KAPPA);t.bezierCurveTo(a+l,o+u-c-y,a+l+m,o+u-c,a+l+p,o+u-c),t.lineTo(a+s-Math.max(i,h),o+u-c);var v=Math.max(i-h,0),b=Math.max(i-c,0),T=v*(1-KAPPA),R=b*(1-KAPPA),_=o+u-Math.max(c,i);t.bezierCurveTo(a+s-h-T,o+u-c,a+s-h,o+u-c-R,a+s-h,_),t.lineTo(a+s,_),t.lineTo(a+s,o+u-i);var E=i*(1-KAPPA);if(t.bezierCurveTo(a+s,o+u-E,a+s-E,o+u,a+s-i,o+u),t.closePath(),t.clip(),h){var P=c/h;t.moveTo(a+s/2,P*(-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 C=-c/l;t.moveTo(a+s/2,C*(s/2)+o+u),t.lineTo(a,o+u),t.lineTo(a+s,o+u),t.lineTo(a+s,o),t.closePath(),t.clip()}},fillBorderBottom=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderBottomColor,h=r.borderBottomStyle,l=r.borderBottomWidth,d=r.borderRightWidth,f=r.borderLeftWidth,p=n*(1-KAPPA),g=i*(1-KAPPA);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(c),t.lineWidth(2*Math.max(l,d,f)),"dashed"===h?t.dash(2*l,{space:1.2*l}):"dotted"===h&&t.dash(l,{space:1.2*l}),t.stroke(),t.undash()},clipBorderLeft=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.width,u=e.height,c=r.borderTopWidth,h=r.borderLeftWidth,l=r.borderBottomWidth;t.moveTo(a,o+u-n),t.lineTo(a,o+i);var d=i*(1-KAPPA);t.bezierCurveTo(a,o+d,a+d,o,a+i,o);var f=a+Math.max(h,i);t.lineTo(f,o),t.lineTo(f,o+c);var p=Math.max(i-h,0),g=Math.max(i-c,0),m=p*(1-KAPPA),y=g*(1-KAPPA);t.bezierCurveTo(a+h+m,o+c,a+h,o+c+y,a+h,o+Math.max(i,c)),t.lineTo(a+h,o+u-Math.max(n,l));var v=Math.max(n-h,0),b=Math.max(n-l,0),T=v*(1-KAPPA),R=b*(1-KAPPA),_=a+Math.max(n,h);t.bezierCurveTo(a+h,o+u-l-R,a+h+T,o+u-l,_,o+u-l),t.lineTo(_,o+u),t.lineTo(a+n,o+u);var E=n*(1-KAPPA);if(t.bezierCurveTo(a+E,o+u,a,o+u-E,a,o+u-n),t.closePath(),t.clip(),l){var P=-l/h;t.moveTo(a+s/2,P*(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 C=-c/h;t.moveTo(a+s/2,C*(-s/2)+o),t.lineTo(a,o),t.lineTo(a,o+u),t.lineTo(a+s,o+u),t.closePath(),t.clip()}},fillBorderLeft=function(t,e,r,n,i){var o=e.top,a=e.left,s=e.height,u=r.borderLeftColor,c=r.borderLeftStyle,h=r.borderLeftWidth,l=r.borderTopWidth,d=r.borderBottomWidth,f=n*(1-KAPPA),p=i*(1-KAPPA);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(h,l,d)),"dashed"===c?t.dash(2*h,{space:1.2*h}):"dotted"===c&&t.dash(h,{space:1.2*h}),t.stroke(),t.undash()},Borders={drawBorders:drawBorders},KAPPA$1=(Math.sqrt(2)-1)/3*4,Clipping={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,c=void 0===u?0:u,h=o.borderBottomRightRadius,l=void 0===h?0:h,d=o.borderBottomLeftRadius,f=void 0===d?0:d,p=Math.min(c,.5*n,.5*i),g=p*(1-KAPPA$1);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-KAPPA$1);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-KAPPA$1);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),R=T*(1-KAPPA$1);this.root.instance.lineTo(r,e+T),this.root.instance.bezierCurveTo(r,e+R,r+R,e,r+T,e),this.root.instance.closePath(),this.root.instance.clip()}},getRotation=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},getTranslateX=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},getTranslateY=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},getScaleX=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},getScaleY=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},getMatrix=function(t){var e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null},applySingleTransformation=function(t,e,r){if(/rotate/g.test(e))t.root.instance.rotate(getRotation(e),{origin:r});else if(/scaleX/g.test(e))t.root.instance.scale(getScaleX(e),1,{origin:r});else if(/scaleY/g.test(e))t.root.instance.scale(1,getScaleY(e),{origin:r});else if(/scale/g.test(e))t.root.instance.scale(getScaleX(e),getScaleY(e),{origin:r});else if(/translateX/g.test(e))t.root.instance.translate(getTranslateX(e),1,{origin:r});else if(/translateY/g.test(e))t.root.instance.translate(1,getTranslateY(e),{origin:r});else if(/translate/g.test(e))t.root.instance.translate(getTranslateX(e),getTranslateY(e),{origin:r});else if(/matrix/g.test(e)){var n;(n=t.root.instance).transform.apply(n,getMatrix(e))}},Transformations={applyTransformations:function(){for(var t,e=/[a-zA-Z]+\([^)]+\)/g,r=this.origin,n=this.style&&this.style.transform||"";null!=(t=e.exec(n));)applySingleTransformation(this,t[0],r)}},merge=function(t,e){return ramda.isNil(e)?t:e},deepMerge=function(t){return t.reduce(function(t,e){return ramda.mergeDeepWith(merge,t,e)},{})},isFunction=ramda.compose(ramda.equals("Function"),ramda.type),inheritedProperties=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","opacity","textDecoration","lineHeight","textAlign","visibility","wordSpacing"],Base=function(t){function e(r,n){var i;return(i=t.call(this)||this).root=r,i.style={},i.props=deepMerge([i.constructor.defaultProps,e.defaultProps,n]),warning(!i.props.styles,'"styles" prop passed instead of "style" prop'),i}_inheritsLoose(e,t);var r=e.prototype;return r.appendChild=function(e){t.prototype.appendChild.call(this,e),this.root.markDirty()},r.appendChildBefore=function(e,r){t.prototype.appendChildBefore.call(this,e,r),this.root.markDirty()},r.removeChild=function(e){t.prototype.removeChild.call(this,e),this.root.markDirty()},r.update=function(t){this.props=deepMerge([this.constructor.defaultProps,e.defaultProps,t]),this.root.markDirty()},r.applyProps=function(){var t=this;this.style=this.resolveStyles(),ramda.toPairsIn(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()})},r.resolveStyles=function(){var t=this.page,e=t.size,r={orientation:t.orientation,isAutoHeight:t.isAutoHeight,width:e.width,height:e.height},n=StyleSheet.resolve(this.props.style,r),i=this.parent?ramda.pick(inheritedProperties,this.parent.style):{};return _extends({},i,{},n)},r.applyStyle=function(t,e){if(void 0!==e){var r="set"+upperFirst(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:isFunction(this.layout[r])&&this.layout[r](e)}}},r.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()})}},r.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())},r.clone=function(){var t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t},r.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},r.renderChildren=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e;return _regeneratorRuntime.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)}}(),_createClass(e,[{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=matchPercent(e),c=matchPercent(r);return[i+(u?a*u.percent:e),o+(c?s*c.percent:r)]}}]),e}(Node);Base.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,transformOriginX:"50%",transformOriginY:"50%"},minPresenceAhead:0},Object.assign(Base.prototype,Debug),Object.assign(Base.prototype,Borders),Object.assign(Base.prototype,Clipping),Object.assign(Base.prototype,Transformations);var RULER_WIDTH=13,RULER_COLOR="white",RULER_FONT_SIZE=5,DEFAULT_RULER_STEPS=50,LINE_WIDTH=.5,LINE_COLOR="gray",GRID_COLOR="#ababab",range=function(t,e){return Array.from({length:Math.ceil(t/e)},function(t,r){return r*e})},matchPercentage=function(t){var e=matchPercent(t);return e?100/e.value:null},Ruler={getRulerWidth:function(){return RULER_WIDTH},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||DEFAULT_RULER_STEPS;if("string"==typeof t){var e=matchPercentage(t);if(e)return(this.width-(this.hasVerticalRuler()?RULER_WIDTH:0))/e;throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps:function(){var t=this.props.verticalRulerSteps||this.props.rulerSteps||DEFAULT_RULER_STEPS;if("string"==typeof t){var e=matchPercentage(t);if(e)return(this.height-(this.hasHorizontalRuler()?RULER_WIDTH: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(LINE_WIDTH).fontSize(RULER_FONT_SIZE).opacity(1),t&&this.drawHorizontalRuler(),e&&this.drawVerticalRuler(),t&&e&&this.root.instance.rect(0,0,RULER_WIDTH-LINE_WIDTH,RULER_WIDTH-LINE_WIDTH).fill(RULER_COLOR),this.root.instance.restore())},drawHorizontalRuler:function(){var t=this,e=this.hasVerticalRuler()?RULER_WIDTH:0;this.root.instance.rect(e,0,this.width,RULER_WIDTH).fill(RULER_COLOR).moveTo(this.hasVerticalRuler()?RULER_WIDTH:0,RULER_WIDTH).lineTo(this.width,RULER_WIDTH).stroke(LINE_COLOR);var r=range(this.width,this.getHorizontalSteps());r.map(function(r){t.root.instance.moveTo(e+r,0).lineTo(e+r,RULER_WIDTH).stroke(LINE_COLOR).fillColor("black").text(""+Math.round(r),e+r+1,1)}),r.map(function(r){0!==r&&t.root.instance.moveTo(e+r,RULER_WIDTH).lineTo(e+r,t.height).stroke(GRID_COLOR)})},drawVerticalRuler:function(){var t=this,e=this.hasHorizontalRuler()?RULER_WIDTH:0;this.root.instance.rect(0,e,RULER_WIDTH,this.height).fill(RULER_COLOR).moveTo(RULER_WIDTH,this.hasHorizontalRuler()?RULER_WIDTH:0).lineTo(RULER_WIDTH,this.height).stroke(LINE_COLOR);var r=range(this.height,this.getVerticalSteps());r.map(function(r){t.root.instance.moveTo(0,e+r).lineTo(RULER_WIDTH,e+r).stroke(LINE_COLOR).fillColor("black").text(""+Math.round(r),1,e+r+1)}),r.map(function(r){0!==r&&t.root.instance.moveTo(RULER_WIDTH,e+r).lineTo(t.width,e+r).stroke(GRID_COLOR)})}},TextInstance=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()},_createClass(t,[{key:"name",get:function(){return"TextInstance"}}]),t}(),PAGE_SIZES={"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]},getPageSize=function(t,e){var r;if(void 0===e&&(e="portrait"),"string"==typeof t)r=PAGE_SIZES[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]}},PROTOCOL_REGEXP=/^([a-z]+\:(\/\/)?)/i,DEST_REGEXP=/^#.+/,getURL=function(t){return t?isSrcId(t)?t:"string"!=typeof t||t.match(PROTOCOL_REGEXP)?t:"http://"+t:""},isSrcId=function(t){return t.match(DEST_REGEXP)},setLink=function(t){if(t.src){var e=t.getAbsoluteLayout(),r=e.top,n=e.left,i=e.width,o=e.height,a=isSrcId(t.src)?"goTo":"link",s=isSrcId(t.src)?t.src.slice(1):t.src;t.root.instance[a](n,r,i,o,s)}},setDestination=function(t){if(t.props.id){var e=t.getAbsoluteLayout().top;t.root.instance.addNamedDestination(t.props.id,"XYZ",null,e,null)}},Page=function(t){function e(e,r){var n;return(n=t.call(this,e,r)||this)._size=null,n}_inheritsLoose(e,t);var r=e.prototype;return r.resetMargins=function(){(this.marginTop||this.marginBottom||this.marginLeft||this.marginRight)&&(warning(!1,"Margin values are not allowed on Page element. Use padding instead."),this.marginTop=0,this.marginBottom=0,this.marginLeft=0,this.marginRight=0)},r.applyProps=function(){t.prototype.applyProps.call(this),this.top=0,this.left=0,this.width=this.size.width,this.resetMargins();var e=this.getRulerWidth();this.hasHorizontalRuler()&&(this.paddingTop=this.paddingTop+e),this.hasVerticalRuler()&&(this.paddingLeft=this.paddingLeft+e)},r.setPadding=function(t,e){var r=t===Yoga.EDGE_TOP||t===Yoga.EDGE_BOTTOM?this.size.height:this.size.width,n=matchPercent(e);n?this.layout.setPadding(t,r*n.percent):this.layout.setPadding(t,e)},r.addDynamicChild=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i,o,a,s,u,c;return _regeneratorRuntime.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],i=0;case 4:if(!(i<n.length)){t.next=27;break}if(o=n[i],a=o.type,s=o.props,"string"!=typeof o){t.next=12;break}u=new TextInstance(this.root,o),e.appendChild(u),t.next=24;break;case 12:if(a===React.Fragment){t.next=22;break}return c=createInstance(o,this.root),t.next=16,c.onAppendDynamically();case 16:return e.appendChild(c),c.applyProps(),t.next=20,this.addDynamicChild(c,s.children);case 20:t.next=24;break;case 22:return t.next=24,this.addDynamicChild(e,s.children);case 24:i++,t.next=4;break;case 27:case"end":return t.stop()}},t,this)}));return function(e,r){return t.apply(this,arguments)}}(),r.renderDynamicNodes=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i,o;return _regeneratorRuntime.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(),o=i.props.render(e),t.next=9,this.addDynamicChild(i,o);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)}}(),r.nodeWillWrap=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e){return _regeneratorRuntime.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)}}(),r.onNodeSplit=function(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()},r.clone=function(){var e=t.prototype.clone.call(this);return e._size=this.size,e},r.update=function(e){t.prototype.update.call(this,e),this._size=null},r.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r;return _regeneratorRuntime.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}),setDestination(this),this.style.backgroundColor&&e.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,r).fill(),t.next=9,this.renderChildren();case 9:this.props.debug&&this.debug(),this.renderRuler();case 11:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{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=getPageSize(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}}]),e}(Base);Page.defaultProps={size:"A4",wrap:!0,orientation:"portrait"},Object.assign(Page.prototype,Ruler);var View=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e.prototype.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),t.next=6,this.renderChildren();case 6:setDestination(this),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)}}(),_createClass(e,[{key:"name",get:function(){return"View"}}]),e}(Base);View.defaultProps={wrap:!0};var emojiSource,hyphenationCallback,fetchFont=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(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)}}(),FontSource=function(){function t(t,e,r,n,i){this.src=t,this.fontFamily=e,this.fontStyle=r||"normal",this.fontWeight=processFontWeight(n)||400,this.data=null,this.loading=!1,this.options=i}return t.prototype.load=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n,i,o,a,s=this;return _regeneratorRuntime.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,o=void 0===i?"GET":i,t.next=5,fetchFont(this.src,{method:o,body:n,headers:r});case 5:a=t.sent,this.data=fontkit.create(a),t.next=12;break;case 9:return t.next=11,new Promise(function(t,e){return fontkit.open(s.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}(),Font=function(){function t(t){this.family=t,this.sources=[]}t.create=function(e){return new t(e)};var e=t.prototype;return e.register=function(t){var e=t.src,r=t.fontWeight,n=t.fontStyle,i=_objectWithoutPropertiesLoose(t,["src","fontWeight","fontStyle"]);this.sources.push(new FontSource(e,this.fontFamily,n,r,i))},e.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}),c=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]||c[0]}var h=a.filter(function(t){return t.fontWeight<n}),l=a.filter(function(t){return t.fontWeight>n});if(n<400&&(e=h[h.length-1]||l[0]),n>500&&(e=l[0]||h[h.length-1]),!e)throw new Error("Could not resolve font for "+this.fontFamily+", fontWeight "+n);return e},t}(),registerEmojiSource=function(t){var e=t.url,r=t.format;emojiSource={url:e,format:void 0===r?"png":r}},getEmojiSource=function(){return emojiSource},emoji={registerEmojiSource:registerEmojiSource,getEmojiSource:getEmojiSource},standardFonts=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"],registerHyphenationCallback=function(t){hyphenationCallback=t},getHyphenationCallback=function(){return hyphenationCallback},hyphenation={registerHyphenationCallback:registerHyphenationCallback,getHyphenationCallback:getHyphenationCallback},fonts={},register=function(t,e){"object"==typeof t?e=t:(warning(!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 r=e.family;if(fonts[r]||(fonts[r]=Font.create(r)),e.fonts)for(var n=0;n<e.fonts.length;n++)fonts[r].register(_extends({family:r},e.fonts[n]));else fonts[r].register(e)},getRegisteredFonts=function(){return fonts},getRegisteredFontFamilies=function(){return Object.keys(fonts)},getFont=function(t){var e=t.fontFamily;if(standardFonts.includes(e))return null;if(!fonts[e])throw new Error("Font family not registered: "+e+". Please register it calling Font.register() method.");return fonts[e].resolve(t)},load=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.fontFamily,!standardFonts.includes(n)){t.next=4;break}return t.abrupt("return");case 4:if((i=getFont(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)}}(),reset=function(){for(var t in fonts)fonts.hasOwnProperty(t)&&(fonts[t].data=null)},clear=function(){fonts={}},Font$1=_extends({register:register,getRegisteredFonts:getRegisteredFonts,getRegisteredFontFamilies:getRegisteredFontFamilies,getFont:getFont,load:load,clear:clear,reset:reset},emoji,{},hyphenation),StandardFont=function(){function t(t){this.name=t,this.src=PDFDocument.PDFFont.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)},_createClass(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}(),fontCache={},IGNORED_CODE_POINTS=[173],getFontSize=ramda.pathOr(12,["attributes","fontSize"]),getFallbackFont=function(){return getOrCreateFont("Helvetica")},getOrCreateFont=function(t){if(fontCache[t])return fontCache[t];var e=new StandardFont(t);return fontCache[t]=e,e},shouldFallbackToFont=function(t,e){return!IGNORED_CODE_POINTS.includes(t)&&!e.hasGlyphForCodePoint(t)&&getFallbackFont().hasGlyphForCodePoint(t)},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),c=0;for(s=u?s:s[Symbol.iterator]();;){var h;if(u){if(c>=s.length)break;h=s[c++]}else{if((c=s.next()).done)break;h=c.value}var l=h,d=getFontSize(l),f="string"==typeof l.attributes.font?getOrCreateFont(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=shouldFallbackToFont(b,f)?getFallbackFont():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 R=getFontSize(ramda.last(r));a.push({start:i,end:e.length,attributes:{font:n,scale:n?R/n.unitsPerEm:0}})}return{string:e,runs:a}}},engines={linebreaker:linebreaker,justification:justification,textDecoration:textDecoration,scriptItemizer:scriptItemizer,wordHyphenation:wordHyphenation,fontSubstitution:fontSubstitution},engine=layoutEngine(engines);PNG.isValid=function(t){try{return!!new PNG(t)}catch(t){return!1}};var MARKERS=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],JPEG=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,!MARKERS.includes(e));)r+=t.readUInt16BE(r);if(!MARKERS.includes(e))throw new Error("Invalid JPEG.");r+=3,this.height=t.readUInt16BE(r),r+=2,this.width=t.readUInt16BE(r)};JPEG.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,!MARKERS.includes(e));)r+=t.readUInt16BE(r);return!!MARKERS.includes(e)};var createCache=function(t){var e=(void 0===t?{}:t).limit,r=void 0===e?100:e,n={},i=[];return{get:function(t){return n[t]},set:function(t,e){i.push(t),i.length>r&&delete n[i.shift()],n[t]=e},reset:function(){n={},i=[]},length:function(){return i.length}}},IMAGE_CACHE=createCache({limit:30}),fetchRemoteFile=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(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)}}(),isValidFormat=function(t){var e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e},guessFormat=function(t){var e;return JPEG.isValid(t)?e="jpg":PNG.isValid(t)&&(e="png"),e},isCompatibleBase64=function(t){var e=t.uri;return/^data:image\/[a-zA-Z]*;base64,[^"]*/g.test(e)};function getImage(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new JPEG(t);case"png":return new PNG(t);default:return null}}var resolveBase64Image=function(t){var e=t.uri,r=/^data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(e),n=r[1],i=r[2];if(!isValidFormat(n))throw new Error("Base64 image invalid format: "+n);return new Promise(function(t){return t(getImage(Buffer.from(i,"base64"),n))})},resolveImageFromData=function(t){if(t.data&&t.format)return new Promise(function(e){return e(getImage(t.data,t.format))});throw new Error("Invalid data given for local file: "+JSON.stringify(t))},resolveBufferImage=function(t){var e=guessFormat(t);if(e)return new Promise(function(r){return r(getImage(t,e))})},getImageFormat=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},resolveImageFromUrl=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(e,r){var n,i,o,a,s,u,c;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:n=e.uri,i=e.body,o=e.headers,a=e.method,s=void 0===a?"GET":a,t.next=7;break;case 4:t.t0=t.sent,t.next=10;break;case 7:return t.next=9,fetchRemoteFile(n,{body:i,headers:o,method:s});case 9:t.t0=t.sent;case 10:return u=t.t0,c=getImageFormat(u),t.abrupt("return",getImage(u,c));case 13:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),resolveImage=function(t,e){var r,n=void 0===e?{}:e,i=n.cache,o=void 0===i||i,a=_objectWithoutPropertiesLoose(n,["cache"]),s=t.data?t.data.toString():t.uri;if(o&&IMAGE_CACHE.get(s))return IMAGE_CACHE.get(s);if(!(r=isCompatibleBase64(t)?resolveBase64Image(t):Buffer.isBuffer(t)?resolveBufferImage(t):"object"==typeof t&&t.data?resolveImageFromData(t):resolveImageFromUrl(t,a)))throw new Error("Cannot resolve image");return o&&IMAGE_CACHE.set(s,r),r},emojis={},regex=emojiRegex(),reflect=function(t){return function(){return t.apply(void 0,arguments).then(function(t){return t},function(t){return t})}},makeFetchEmojiImage=function(){return reflect(resolveImage)},_removeNoColor=function(t){return"️"!==t},getCodePoints=function(t){return Array.from(t).filter(_removeNoColor).map(function(t){return t.codePointAt(0).toString(16)}).join("-")},buildEmojiUrl=function(t){var e=Font$1.getEmojiSource(),r=e.url,n=e.format;return""+r+getCodePoints(t)+"."+n},fetchEmojis=function(t){var e=Font$1.getEmojiSource();if(!e||!e.url)return[];for(var r,n=[],i=function(){var t=r[0];if(!emojis[t]||emojis[t].loading){var e=buildEmojiUrl(t);emojis[t]={loading:!0};var i=makeFetchEmojiImage();n.push(i({uri:e}).then(function(e){emojis[t].loading=!1,emojis[t].data=e.data}))}};r=regex.exec(t);)i();return n},embedEmojis=function(t){for(var e=[],r=0;r<t.length;r++){for(var n=t[r],i=void 0,o=0;i=regex.exec(n.string);){var a=i.index,s=i[0],u=n.attributes.fontSize,c=n.string.slice(o,a+i[0].length);emojis[s]&&emojis[s].data?e.push({string:c.replace(i,String.fromCharCode(65532)),attributes:_extends({},n.attributes,{attachment:{width:u,height:u,yOffset:Math.floor(.1*u),image:emojis[s].data}})}):e.push({string:c.replace(i,String.fromCharCode(0)),attributes:n.attributes}),o=a+s.length}o<n.string.length&&e.push({string:n.string.slice(o),attributes:n.attributes})}return e},IGNORABLE_CODEPOINTS=[8232,8233],buildSubsetForFont=function(t){return IGNORABLE_CODEPOINTS.reduce(function(e,r){return t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(r)?e:[].concat(e,[String.fromCharCode(r)])},[])},ignoreChars=function(t){return t.map(function(t){var e=buildSubsetForFont(t.attributes.font),r=new RegExp(e.join("|"));return{string:t.string.replace(r,""),attributes:t.attributes}})},PREPROCESSORS=[ignoreChars,embedEmojis],capitalize=function(t){return t.replace(/(^|\s)\S/g,function(t){return t.toUpperCase()})},isImage=ramda.propEq("name","Image"),isTextInstance=ramda.compose(ramda.complement(ramda.isNil),ramda.prop("value")),transformText=function(t,e){switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return capitalize(t);default:return t}},getFragments=function t(e){if(!e)return[{string:""}];var r=[],n=e.style,i=n.color,o=void 0===i?"black":i,a=n.backgroundColor,s=n.fontFamily,u=void 0===s?"Helvetica":s,c=n.fontWeight,h=n.fontStyle,l=n.fontSize,d=void 0===l?18:l,f=n.textAlign,p=void 0===f?"left":f,g=n.lineHeight,m=n.textDecoration,y=n.textDecorationColor,v=n.textDecorationStyle,b=n.textTransform,T=n.letterSpacing,R=n.textIndent,_=n.opacity,E=Font$1.getFont({fontFamily:u,fontWeight:c,fontStyle:h}),P={font:E?E.data:u,color:o,opacity:_,fontSize:d,backgroundColor:a,align:p,indent:R,link:e.src,characterSpacing:T,underlineStyle:v,underline:"underline"===m,underlineColor:y||o,strike:"line-through"===m,strikeStyle:v,strikeColor:y||o,lineHeight:g?g*d:null};e.children.forEach(function(e){if(isImage(e))r.push({string:String.fromCharCode(65532),attributes:_extends({},P,{attachment:{width:e.style.width||d,height:e.style.height||d,image:e.image.data}})});else if(isTextInstance(e))r.push({string:transformText(e.value,b),attributes:P});else{var n;if(e)(n=r).push.apply(n,t(e))}});var C=PREPROCESSORS,w=Array.isArray(C),x=0;for(C=w?C:C[Symbol.iterator]();;){var S;if(w){if(x>=C.length)break;S=C[x++]}else{if((x=C.next()).done)break;S=x.value}r=S(r)}return r},getAttributedString=function(t){return AttributedString.fromFragments(getFragments(t))},Text=function(t){function e(e,r){var n;return(n=t.call(this,e,r)||this).start=0,n.end=0,n.blocks=null,n.computed=!1,n.attributedString=null,n.layoutOptions={hyphenationPenalty:r.hyphenationPenalty,hyphenationCallback:Font$1.getHyphenationCallback(),shrinkWhitespaceFactor:{before:-.5,after:-.5}},n.layout.setMeasureFunc(n.measureText.bind(_assertThisInitialized(n))),n}_inheritsLoose(e,t);var r=e.prototype;return r.appendChild=function(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this.attributedString=null,this.markDirty())},r.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this.attributedString=null,this.markDirty(),t.cleanup())},r.lineIndexAtHeight=function(t){for(var e=0,r=0;r<this.lines.length;r++){var n=this.lines[r];if(e+n.box.height>t)return r;e+=n.box.height}return this.lines.length},r.heightAtLineIndex=function(t){for(var e=0,r=0;r<t;r++){e+=this.lines[r].box.height}return e},r.layoutText=function(t,e){if(this.attributedString=getAttributedString(this),!this.blocks||this.props.render){var r={x:0,y:0,width:t,height:e||1/0,maxLines:this.style.maxLines,truncateMode:this.style.textOverflow};this.blocks=engine(this.attributedString,r,this.layoutOptions)}var n=this.blocks.reduce(function(t,e){return t+e.length},0);this.end=n+1,this.computed=!0},r.measureText=function(t,e,r,n){return e===Yoga.MEASURE_MODE_EXACTLY?(this.layoutText(t,r),{height:this.linesHeight}):e===Yoga.MEASURE_MODE_AT_MOST?(this.layoutText(t,r),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}},r.resolveStyles=function(){var e=t.prototype.resolveStyles.call(this);return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(e.top=e.top||this.parent.style.top,e.bottom=e.bottom||this.parent.style.bottom,e.position=e.position||"relative"),this.src&&(e.color=e.color||"blue",e.textDecoration=e.textDecoration||"underline"),e},r.wrapHeight=function(t){var e=this.props,r=e.orphans,n=e.widows,i=this.lines.length,o=t-this.paddingTop,a=this.lineIndexAtHeight(o);return i<r?t:a<r||i<r+n?0:i===r+n?this.heightAtLineIndex(r):i-a<n?t-this.heightAtLineIndex(n-1):t},r.onNodeSplit=function(t,e){var r=this.wrapHeight(t),n=this.lineIndexAtHeight(r);e.marginTop=0,e.paddingTop=0,e.start=n,e.attributedString=this.attributedString,this.height=r,this.marginBottom=0,this.paddingBottom=0,this.end=n},r.clone=function(){var e=t.prototype.clone.call(this);return e.layoutEngine=this.layoutEngine,this.blocks&&!this.props.render&&(e.blocks=[].concat(this.blocks)),e},r.renderText=function(){var t=this.getAbsoluteLayout(),e=t.top,r=t.left,n=this.lines[0]?this.lines[0].box.y:0;this.root.instance.save(),this.root.instance.translate(r+this.padding.left,e+this.padding.top-n),PDFRenderer$1.render(this.root.instance,[this.lines]),setLink(this),setDestination(this),this.root.instance.restore()},r.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.computed||this.layoutText(this.width-this.padding.left-this.padding.right,this.height-this.padding.top-this.padding.bottom),this.renderText(),this.props.debug&&this.debug(),this.root.instance.restore();case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{key:"name",get:function(){return"Text"}},{key:"src",get:function(){return getURL(this.props.src||this.props.href)}},{key:"lines",get:function(){return this.blocks?this.blocks.reduce(function(t,e){return[].concat(t,e)},[]).splice(this.start,this.end):[]}},{key:"linesHeight",get:function(){return this.blocks?this.lines.reduce(function(t,e){return t+e.box.height},0):-1}},{key:"linesWidth",get:function(){return this.blocks?Math.max.apply(Math,this.lines.map(function(t){return AttributedString.advanceWidth(t)})):-1}}]),e}(Base);Text.defaultProps={wrap:!0,widows:2,orphans:2};var Link=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e.prototype.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return setLink(this),t.next=3,this.renderChildren();case 3:this.props.debug&&this.debug();case 4:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{key:"name",get:function(){return"Link"}},{key:"src",get:function(){return getURL(this.props.src||this.props.href)}}]),e}(Base),Note=function(t){function e(){return t.apply(this,arguments)||this}_inheritsLoose(e,t);var r=e.prototype;return r.appendChild=function(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))},r.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1)),t.cleanup()},r.applyProps=function(){t.prototype.applyProps.call(this),this.height=0,this.width=0},r.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n,i;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=this.getAbsoluteLayout(),r=e.top,n=e.left,i=this.children[0]?this.children[0].value:"",this.root.instance.note(n,r,0,0,i);case 3:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{key:"name",get:function(){return"Note"}}]),e}(Base);Note.defaultProps={};var isNumeric=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},applyContainObjectFit=function(t,e,r,n,i,o){var a=t/e,s=r/n,u=matchPercent(i),c=matchPercent(o),h=u?u.percent:.5,l=c?c.percent:.5;if(a>s){var d=e,f=d*s,p=isNumeric(o)?o:0;return{width:f,height:d,xOffset:isNumeric(i)?i:(t-f)*h,yOffset:p}}var g=t,m=g/s,y=isNumeric(i)?i:0;return{width:g,height:m,yOffset:isNumeric(o)?o:(e-m)*l,xOffset:y}},applyNoneObjectFit=function(t,e,r,n,i,o){var a=r,s=n,u=matchPercent(i),c=matchPercent(o),h=u?u.percent:.5,l=c?c.percent:.5;return{width:a,height:s,xOffset:isNumeric(i)?i:(t-a)*h,yOffset:isNumeric(o)?o:(e-s)*l}},applyCoverObjectFit=function(t,e,r,n,i,o){var a=r/n,s=t/e,u=matchPercent(i),c=matchPercent(o),h=u?u.percent:.5,l=c?c.percent:.5;if(s>a){var d=t,f=d/a,p=isNumeric(i)?i:0;return{width:d,height:f,yOffset:isNumeric(o)?o:(e-f)*l,xOffset:p}}var g=e*a;return{width:g,height:e,xOffset:isNumeric(i)?i:(t-g)*h,yOffset:isNumeric(o)?o:0}},applyScaleDownObjectFit=function(t,e,r,n,i,o){var a=applyContainObjectFit(t,e,r,n,i,o),s=applyNoneObjectFit(t,e,r,n,i,o);return a.width<s.width?a:s},applyFillObjectFit=function(t,e,r,n){return{width:t,height:e,xOffset:matchPercent(r)?0:r||0,yOffset:matchPercent(n)?0:n||0}},resolveObjectFit=function(t,e,r,n,i,o,a){switch(void 0===t&&(t="fill"),t){case"contain":return applyContainObjectFit(e,r,n,i,o,a);case"cover":return applyCoverObjectFit(e,r,n,i,o,a);case"none":return applyNoneObjectFit(e,r,n,i,o,a);case"scale-down":return applyScaleDownObjectFit(e,r,n,i,o,a);default:return applyFillObjectFit(e,r,o,a)}},SAFETY_HEIGHT=10,Image=function(t){function e(e,r){var n;return(n=t.call(this,e,r)||this).image=null,n.layout.setMeasureFunc(n.measureImage.bind(_assertThisInitialized(n))),n}_inheritsLoose(e,t);var r=e.prototype;return r.shouldGrow=function(){return!!this.style.flexGrow},r.measureImage=function(t,e,r,n){var i=this.margin,o=this.page.padding,a=this.page.isAutoHeight?1/0:this.page.size.height-o.top-o.bottom-i.top-i.bottom-SAFETY_HEIGHT;if(!this.image)return{width:0,height:0};if(e===Yoga.MEASURE_MODE_EXACTLY&&n===Yoga.MEASURE_MODE_UNDEFINED){var s=t/this.ratio;return{height:Math.min(a,s)}}if(n===Yoga.MEASURE_MODE_EXACTLY&&(e===Yoga.MEASURE_MODE_AT_MOST||e===Yoga.MEASURE_MODE_UNDEFINED))return{width:Math.min(r*this.ratio,t)};if(e===Yoga.MEASURE_MODE_EXACTLY&&n===Yoga.MEASURE_MODE_AT_MOST){var u=t/this.ratio;return{height:Math.min(r,a,u)}}return e===Yoga.MEASURE_MODE_AT_MOST&&n===Yoga.MEASURE_MODE_AT_MOST?this.ratio>1?{width:t,height:Math.min(t/this.ratio,r)}:{width:Math.min(r*this.ratio,t),height:r}:{height:r,width:t}},r.fetch=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n,i;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=this.props,r=e.cache,n=e.safePath,i=e.allowDangerousPaths,this.src){t.next=4;break}return warning(!1,'Image should receive either a "src" or "source" prop'),t.abrupt("return");case 4:return t.prev=4,t.next=7,resolveImage(this.src,{cache:r,safePath:n,allowDangerousPaths:i});case 7:this.image=t.sent,t.next=14;break;case 10:t.prev=10,t.t0=t.catch(4),this.image={width:0,height:0},console.warn(t.t0.message);case 14:case"end":return t.stop()}},t,this,[[4,10]])}));return function(){return t.apply(this,arguments)}}(),r.clone=function(){var e=t.prototype.clone.call(this);return e.image=this.image,e},r.onAppendDynamically=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.fetch();case 2:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),r.renderImage=function(){var t=this.padding,e=this.getAbsoluteLayout(),r=e.left,n=e.top,i=this.style,o=i.opacity,a=i.objectPositionX,s=i.objectPositionY;if(this.root.instance.save(),this.clip(),this.image.data){var u=resolveObjectFit(this.style.objectFit,this.width-t.left-t.right,this.height-t.top-t.bottom,this.image.width,this.image.height,a,s),c=u.width,h=u.height,l=u.xOffset,d=u.yOffset;0!==c&&0!==h?this.root.instance.fillOpacity(o).image(this.image.data,r+t.left+l,n+t.top+d,{width:c,height:h}):warning(!1,"Image with src '"+this.props.src+"' skipped due to invalid dimensions")}this.root.instance.restore()},r.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:setDestination(this),this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.renderImage(),this.drawBorders(),this.props.debug&&this.debug(),this.root.instance.restore();case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{key:"name",get:function(){return"Image"}},{key:"ratio",get:function(){return this.image.data?this.image.width/this.image.height:1}},{key:"src",get:function(){var t=this.props.src||this.props.source;return"string"==typeof t?{uri:t}:t}}]),e}(Base);Image.defaultProps={wrap:!1,cache:!0,style:{}};var Document=function(){function t(t,e){this.root=t,this.style={},this.props=e,this.children=[],this.subpages=[]}var e=t.prototype;return e.appendChild=function(t){t.parent=this,this.children.push(t)},e.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1)),t.cleanup()},e.addMetaData=function(){var t=this.props,e=t.title,r=t.author,n=t.subject,i=t.keywords,o=t.creator,a=t.producer;e&&(this.root.instance.info.Title=e),r&&(this.root.instance.info.Author=r),n&&(this.root.instance.info.Subject=n),i&&(this.root.instance.info.Keywords=i),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=a||"react-pdf"},e.loadFonts=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(e=[],r=this.children.slice(0);r.length>0;)(n=r.shift()).style&&n.style.fontFamily&&e.push(Font$1.load(n.style,this.root.instance)),n.children&&n.children.forEach(function(t){r.push(t)});return t.next=5,Promise.all(e);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.loadEmojis=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(e=[],r=this.children.slice(0);r.length>0;)"string"==typeof(n=r.shift())?e.push.apply(e,fetchEmojis(n)):"string"==typeof n.value?e.push.apply(e,fetchEmojis(n.value)):n.children&&n.children.forEach(function(t){r.push(t)});return t.next=5,Promise.all(e);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.loadImages=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:for(e=[],r=this.children.slice(0);r.length>0;)"Image"===(n=r.shift()).name&&e.push(n.fetch()),n.children&&n.children.forEach(function(t){r.push(t)});return t.next=5,Promise.all(e);case 5:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.loadAssets=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([this.loadFonts(),this.loadImages(),this.loadEmojis()]);case 2:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.applyProps=function(){this.children.forEach(function(t){return t.applyProps()})},e.update=function(t){this.props=t},e.cleanup=function(){this.subpages.forEach(function(t){return t.cleanup()})},e.finish=function(){this.children.forEach(function(t){return t.cleanup()})},e.getLayoutData=function(){return{type:this.name,children:this.subpages.map(function(t){return t.getLayoutData()})}},e.wrapPages=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n,i,o,a,s,u,c;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=1,r=[],n=this.children,i=Array.isArray(n),o=0,n=i?n:n[Symbol.iterator]();case 3:if(!i){t.next=9;break}if(!(o>=n.length)){t.next=6;break}return t.abrupt("break",26);case 6:a=n[o++],t.next=13;break;case 9:if(!(o=n.next()).done){t.next=12;break}return t.abrupt("break",26);case 12:a=o.value;case 13:if(!(s=a).wrap){t.next=23;break}return u=s.isAutoHeight?1/0:s.size.height-(s.style.paddingBottom||0),t.next=18,_wrapPages(s,u,e);case 18:c=t.sent,e+=c.length,r.push.apply(r,c),t.next=24;break;case 23:r.push(s);case 24:t.next=3;break;case 26:return t.abrupt("return",r);case 27:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.renderPages=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.wrapPages();case 2:this.subpages=t.sent,e=0;case 4:if(!(e<this.subpages.length)){t.next=11;break}return this.subpages[e].renderDynamicNodes({pageNumber:e+1,totalPages:this.subpages.length},function(t){return"Text"===t.name}),t.next=8,this.subpages[e].render();case 8:e++,t.next=4;break;case 11:return t.abrupt("return",this.subpages);case 12:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),e.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.addMetaData(),this.applyProps(),t.next=5,this.loadAssets();case 5:return t.next=7,this.renderPages();case 7:this.root.instance.end(),Font$1.reset(),t.next=14;break;case 11:throw t.prev=11,t.t0=t.catch(0),t.t0;case 14:case"end":return t.stop()}},t,this,[[0,11]])}));return function(){return t.apply(this,arguments)}}(),_createClass(t,[{key:"name",get:function(){return"Document"}}]),t}();Document.defaultProps={author:null,keywords:null,subject:null,title:null};var availableMethods=["dash","clip","save","path","fill","font","text","rect","scale","moveTo","lineTo","stroke","rotate","circle","lineCap","opacity","ellipse","polygon","restore","lineJoin","fontSize","fillColor","lineWidth","translate","miterLimit","strokeColor","fillOpacity","roundedRect","strokeOpacity","bezierCurveTo","quadraticCurveTo","linearGradient","radialGradient"],painter=function(t){var e=availableMethods.reduce(function(r,n){var i;return _extends({},r,((i={})[n]=function(){return t[n].apply(t,arguments),e},i))},{});return e},Canvas=function(t){function e(){return t.apply(this,arguments)||this}return _inheritsLoose(e,t),e.prototype.render=function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var e,r,n,i,o,a,s;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:e=this.getAbsoluteLayout(),r=e.left,n=e.top,i=e.width,o=e.height,a=i-this.paddingLeft-this.paddingRight,s=o-this.paddingTop-this.paddingBottom,warning(a&&s,"Canvas element has null width or height. Please provide valid values via the `style` prop in order to correctly render it."),this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.clip(),this.root.instance.translate(r+this.paddingLeft,n+this.paddingTop),this.props.paint&&this.props.paint(painter(this.root.instance),a,s),this.root.instance.restore(),this.props.debug&&this.debug();case 13:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}(),_createClass(e,[{key:"name",get:function(){return"Canvas"}}]),e}(Base);Canvas.defaultProps={style:{},wrap:!1};var constructors={ROOT:Root,PAGE:Page,TEXT:Text,LINK:Link,VIEW:View,NOTE:Note,IMAGE:Image,CANVAS:Canvas,DOCUMENT:Document,TEXT_INSTANCE:TextInstance};function createInstance(t,e){var r=t.type,n=t.props,i=void 0===n?{}:n;if(constructors[r])return new constructors[r](e,i);throw new Error("Invalid element of type "+r+" passed to PDF renderer")}var propsEqual=function t(e,r){var n=Object.keys(e),i=Object.keys(r);if(n.length!==i.length)return!1;for(var o=0;o<n.length;o++){var a=n[o];if("render"!==a){if("children"!==a&&e[a]!==r[a]){if("object"==typeof e[a]&&"object"==typeof r[a]&&t(e[a],r[a]))continue;return!1}if("children"===a&&("string"==typeof e[a]||"string"==typeof r[a]))return e[a]===r[a]}else if(!e[a]!=!r[a])return!1}return!0},emptyObject={},shouldReplaceLink=function(t,e){return"LINK"===t&&("string"==typeof e.children||"number"==typeof e.children||Array.isArray(e.children)||e.render)},PDFRenderer=ReactFiberReconciler({schedulePassiveEffects:scheduler.unstable_scheduleCallback,cancelPassiveEffects:scheduler.unstable_cancelCallback,supportsMutation:!0,appendInitialChild:function(t,e){t.appendChild(e)},createInstance:function(t,e,r){return createInstance({type:shouldReplaceLink(t,e)?"TEXT":t,props:e},r)},createTextInstance:function(t,e){return createInstance({type:"TEXT_INSTANCE",props:t},e)},finalizeInitialChildren:function(t,e,r){return!1},getPublicInstance:function(t){return t},prepareForCommit:function(){},prepareUpdate:function(t,e,r,n){return!propsEqual(r,n)},resetAfterCommit:function(){},resetTextContent:function(t){},getRootHostContext:function(){return emptyObject},getChildHostContext:function(){return emptyObject},shouldSetTextContent:function(t,e){return!1},now:Date.now,useSyncScheduling:!0,appendChild:function(t,e){t.appendChild(e)},appendChildToContainer:function(t,e){t.appendChild(e)},insertBefore:function(t,e,r){t.appendChildBefore(e,r)},removeChild:function(t,e){t.removeChild(e)},removeChildFromContainer:function(t,e){t.removeChild(e)},commitTextUpdate:function(t,e,r){t.update(r)},commitUpdate:function(t,e,r,n,i){t.update(i)}}),version="1.6.8",View$1="VIEW",Text$1="TEXT",Link$1="LINK",Page$1="PAGE",Note$1="NOTE",Image$1="IMAGE",Document$1="DOCUMENT",Canvas$1="CANVAS",pdf=function(t){var e=createInstance({type:"ROOT"}),r=PDFRenderer.createContainer(e);function n(t){if(void 0===t&&(t={}),e.document.props.onRender){var r=e.document.getLayoutData();e.document.props.onRender(_extends({},t,{layoutData:r}))}}function i(t){PDFRenderer.updateContainer(t,r,null)}function o(){return(o=_asyncToGenerator(_regeneratorRuntime.mark(function t(){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.render();case 2:return r=e.instance.pipe(BlobStream()),t.abrupt("return",new Promise(function(t,e){r.on("finish",function(){try{var i=r.toBlob("application/pdf");n({blob:i}),t(i)}catch(t){e(t)}}),r.on("error",e)}));case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}function a(){return(a=_asyncToGenerator(_regeneratorRuntime.mark(function t(){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.render();case 2:return n(),t.abrupt("return",e.instance);case 4:case"end":return t.stop()}},t)}))).apply(this,arguments)}return t&&i(t),{isDirty:function(){return e.isDirty},container:e,updateContainer:i,toBuffer:function(){return a.apply(this,arguments)},toBlob:function(){return o.apply(this,arguments)},toString:function(){var t="";return e.render(),new Promise(function(r,i){try{e.instance.on("data",function(e){t+=e}),e.instance.on("end",function(){n({string:t}),r(t)})}catch(t){i(t)}})}}},flatStyles=function(t){return t.reduce(function(t,e){return _extends({},t,{},e)},{})},Document$2=function(t){var e=t.children,r=_objectWithoutPropertiesLoose(t,["children"]);return React__default.createElement(Document$1,r,e)},InternalBlobProvider=function(t){function e(e){var r;return(r=t.call(this,e)||this).state={blob:null,url:null,loading:!0,error:null},r.instance=pdf(),r}_inheritsLoose(e,t);var r=e.prototype;return r.componentDidMount=function(){this.renderDocument(),this.onDocumentUpdate()},r.componentDidUpdate=function(){this.renderDocument(),this.instance.isDirty()&&!this.state.error&&this.onDocumentUpdate()},r.renderDocument=function(){this.instance.updateContainer(this.props.document)},r.onDocumentUpdate=function(){var t=this,e=this.state.url;this.instance.toBlob().then(function(r){t.setState({blob:r,url:URL.createObjectURL(r),loading:!1},function(){return URL.revokeObjectURL(e)})}).catch(function(e){throw t.setState({error:e}),console.error(e),e})},r.render=function(){return this.props.children(this.state)},e}(React__default.PureComponent),BlobProvider=function(t){var e=t.document,r=t.children;return e?React__default.createElement(InternalBlobProvider,{document:e},r):(warning(!1,"You should pass a valid document to BlobProvider"),null)},PDFViewer=function(t){var e=t.className,r=t.style,n=t.children,i=t.innerRef,o=_objectWithoutPropertiesLoose(t,["className","style","children","innerRef"]);return React__default.createElement(InternalBlobProvider,{document:n},function(t){var n=t.url;return React__default.createElement("iframe",_extends({className:e,ref:i,src:n,style:Array.isArray(r)?flatStyles(r):r},o))})},PDFDownloadLink=function(t){var e=t.document,r=t.className,n=t.style,i=t.children,o=t.fileName,a=void 0===o?"document.pdf":o;if(!e)return warning(!1,"You should pass a valid document to PDFDownloadLink"),null;return React__default.createElement(InternalBlobProvider,{document:e},function(t){return React__default.createElement("a",{className:r,download:a,href:t.url,onClick:(e=t.blob,function(){window.navigator.msSaveBlob&&window.navigator.msSaveBlob(e,a)}),style:Array.isArray(n)?flatStyles(n):n},"function"==typeof i?i(t):i);var e})},dom={pdf:pdf,View:View$1,Text:Text$1,Link:Link$1,Page:Page$1,Font:Font$1,Note:Note$1,Image:Image$1,Canvas:Canvas$1,version:version,Document:Document$2,PDFViewer:PDFViewer,StyleSheet:StyleSheet,PDFRenderer:PDFRenderer,BlobProvider:BlobProvider,createInstance:createInstance,PDFDownloadLink:PDFDownloadLink};exports.BlobProvider=BlobProvider,exports.Canvas=Canvas$1,exports.Document=Document$2,exports.Font=Font$1,exports.Image=Image$1,exports.Link=Link$1,exports.Note=Note$1,exports.PDFDownloadLink=PDFDownloadLink,exports.PDFRenderer=PDFRenderer,exports.PDFViewer=PDFViewer,exports.Page=Page$1,exports.StyleSheet=StyleSheet,exports.Text=Text$1,exports.View=View$1,exports.createInstance=createInstance,exports.default=dom,exports.pdf=pdf,exports.version=version;
  //# sourceMappingURL=react-pdf.browser.cjs.min.js.map
  