Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf/renderer

Package Overview
Dependencies
Maintainers
2
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf/renderer - npm Package Compare versions

Comparing version 1.0.0-alpha.25 to 1.0.0

2

dist/react-pdf.cjs.min.js

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var _Promise=_interopDefault(require("babel-runtime/core-js/promise")),fs=_interopDefault(require("fs")),BlobStream=_interopDefault(require("blob-stream")),_Object$keys=_interopDefault(require("babel-runtime/core-js/object/keys")),ReactFiberReconciler=_interopDefault(require("react-reconciler")),emptyObject=_interopDefault(require("fbjs/lib/emptyObject")),PDFDocument=require("@react-pdf/pdfkit"),PDFDocument__default=_interopDefault(PDFDocument),wrapPages=_interopDefault(require("page-wrapping")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),isUrl=_interopDefault(require("is-url")),fontkit=_interopDefault(require("@react-pdf/fontkit")),fetch=_interopDefault(require("isomorphic-fetch")),_Array$from=_interopDefault(require("babel-runtime/core-js/array/from")),emojiRegex=_interopDefault(require("emoji-regex")),textkitCore=require("@react-pdf/textkit-core"),scriptItemizer=_interopDefault(require("@react-pdf/script-itemizer")),justificationEngine=_interopDefault(require("@textkit/justification-engine")),textDecorationEngine=_interopDefault(require("@textkit/text-decoration-engine")),lineFragmentGenerator=_interopDefault(require("@textkit/line-fragment-generator")),createLinebreaker=_interopDefault(require("@textkit/linebreaker")),english=_interopDefault(require("hyphenation.en-us")),Hypher=_interopDefault(require("hypher")),_JSON$stringify=_interopDefault(require("babel-runtime/core-js/json/stringify")),PNG=_interopDefault(require("@react-pdf/png-js")),_Object$assign=_interopDefault(require("babel-runtime/core-js/object/assign")),react=require("react"),warning=_interopDefault(require("fbjs/lib/warning")),toPairsIn=_interopDefault(require("lodash.topairsin")),isFunction=_interopDefault(require("lodash.isfunction")),upperFirst=_interopDefault(require("lodash.upperfirst")),Yoga=_interopDefault(require("yoga-layout-prebuilt")),pick=_interopDefault(require("lodash.pick")),merge=_interopDefault(require("lodash.merge")),matchMedia=_interopDefault(require("media-engine")),createPDFRenderer=_interopDefault(require("@textkit/pdf-renderer"));class Root{constructor(){this.isDirty=!1,this.document=null,this.instance=null}get name(){return"Root"}appendChild(t){this.document=t}markDirty(){this.isDirty=!0}async render(){this.instance=new PDFDocument__default({autoFirstPage:!1}),await this.document.render(),this.isDirty=!1}}var standardFonts=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"];const fetchFont=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>Buffer.from(t));let emojiSource,hyphenationCallback,fonts={};const register=(t,e)=>{let{family:r}=e,i=_objectWithoutProperties(e,["family"]);fonts[r]=_extends({src:t,loaded:!1,loading:!1,data:null},i)},registerHyphenationCallback=t=>{hyphenationCallback=t},registerEmojiSource=({url:t,format:e="png"})=>{emojiSource={url:t,format:e}},getRegisteredFonts=()=>_Object$keys(fonts),getFont=t=>fonts[t],getEmojiSource=()=>emojiSource,getHyphenationCallback=()=>hyphenationCallback,load=async function(t,e){const r=fonts[t];if(r&&!r.data&&!r.loading)if(r.loading=!0,isUrl(r.src)){const t=await fetchFont(r.src);r.data=fontkit.create(t)}else r.data=fontkit.openSync(r.src);if(r&&!r.loaded&&(r.loaded=!0,r.loading=!1,e.registerFont(t,r.data)),!r&&!standardFonts.includes(t))throw new Error(`Font family not registered: ${t}. Please register it calling Font.register() method.`)},reset=function(){for(const t in fonts)fonts.hasOwnProperty(t)&&(fonts[t].loaded=!1)},clear=function(){fonts={}};var Font={register:register,getEmojiSource:getEmojiSource,getRegisteredFonts:getRegisteredFonts,registerEmojiSource:registerEmojiSource,registerHyphenationCallback:registerHyphenationCallback,getHyphenationCallback:getHyphenationCallback,getFont:getFont,load:load,clear:clear,reset:reset};class StandardFont{constructor(t){this.name=t,this.src=PDFDocument.PDFFont.open(null,t),this.glyphs={}}layout(t){const[e,r]=this.src.encode(t);return{positions:r,stringIndices:r.map((t,e)=>e),glyphs:e.map((t,e)=>{const i=this.getGlyph(parseInt(t,16));return i.advanceWidth=r[e].advanceWidth,i})}}glyphForCodePoint(t){const e=this.getGlyph(t);return e.advanceWidth=400,e}getGlyph(t){return this.glyphs[t]||(this.glyphs[t]=this.src.font.characterToGlyph(t)),{id:t,_font:this.src,name:this.glyphs[t]}}hasGlyphForCodePoint(t){return".notdef"!==this.src.font.characterToGlyph(t)}get ascent(){return this.src.ascender}get descent(){return this.src.descender}get lineGap(){return this.src.lineGap}get unitsPerEm(){return 1e3}}var fontSubstitutionEngine=()=>({Run:t})=>(class{constructor(){this.fallbackFontInstance=null}get fallbackFont(){return this.fallbackFontInstance||(this.fallbackFontInstance=new StandardFont("Helvetica")),this.fallbackFontInstance}getRuns(e,r){const i=[];let o=null,n=0,s=0;for(const a of r){let r;if(r="string"==typeof a.attributes.font?new StandardFont(a.attributes.font):a.attributes.font,0===e.length){i.push(new t(0,0,{font:r}));break}for(const h of e.slice(a.start,a.end)){const e=h.codePointAt();let a=r;!r.hasGlyphForCodePoint(e)&&this.fallbackFont.hasGlyphForCodePoint(e)&&(a=this.fallbackFont),a!==o&&(o&&i.push(new t(n,s,{font:o})),o=a,n=s),s+=h.length}}return n<e.length&&i.push(new t(n,e.length,{font:o})),i}});class Node{constructor(t){this.prev=null,this.next=null,this.data=t}toString(){return this.data.toString()}}class LinkedList{constructor(){this.head=null,this.tail=null,this.listSize=0}isLinked(t){return!(t&&null===t.prev&&null===t.next&&this.tail!==t&&this.head!==t||this.isEmpty())}size(){return this.listSize}isEmpty(){return 0===this.listSize}first(){return this.head}last(){return this.last}toString(){return this.toArray().toString()}toArray(){let t=this.head;const e=[];for(;null!==t;)e.push(t),t=t.next;return e}forEach(t){let e=this.head;for(;null!==e;)t(e),e=e.next}contains(t){let e=this.head;if(!this.isLinked(t))return!1;for(;null!==e;){if(e===t)return!0;e=e.next}return!1}at(t){let e=this.head,r=0;if(t>=this.listLength||t<0)return null;for(;null!==e;){if(t===r)return e;e=e.next,r+=1}return null}insertAfter(t,e){return this.isLinked(t)?(e.prev=t,e.next=t.next,null===t.next?this.tail=e:t.next.prev=e,t.next=e,this.listSize+=1,this):this}insertBefore(t,e){return this.isLinked(t)?(e.prev=t.prev,e.next=t,null===t.prev?this.head=e:t.prev.next=e,t.prev=e,this.listSize+=1,this):this}push(t){return null===this.head?this.unshift(t):this.insertAfter(this.tail,t),this}unshift(t){return null===this.head?(this.head=t,this.tail=t,t.prev=null,t.next=null,this.listSize+=1):this.insertBefore(this.head,t),this}remove(t){return this.isLinked(t)?(null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this.listSize-=1,this):this}pop(){const t=this.tail;return this.tail.prev.next=null,this.tail=this.tail.prev,this.listSize-=1,t.prev=null,t.next=null,t}shift(){const t=this.head;return this.head.next.prev=null,this.head=this.head.next,this.listSize-=1,t.prev=null,t.next=null,t}}LinkedList.Node=Node;const linebreak=(t,e,r)=>{const i={demerits:{line:r&&r.demerits&&r.demerits.line||10,flagged:r&&r.demerits&&r.demerits.flagged||100,fitness:r&&r.demerits&&r.demerits.fitness||3e3},tolerance:r&&r.tolerance||3},o=new LinkedList,n={width:0,stretch:0,shrink:0},s=e,a=[];let h={data:{demerits:1/0}};function l(t,e,r,i,o,n,s){return{position:t,demerits:e,ratio:r,line:i,fitnessClass:o,totals:n||{width:0,stretch:0,shrink:0},previous:s}}function d(e,r,i,o){let a=n.width-i.totals.width,h=0,l=0;const d=o<s.length?s[o-1]:s[s.length-1];return"penalty"===t[r].type&&(a+=t[r].width),a<d?(h=n.stretch-i.totals.stretch)>0?(d-a)/h:linebreak.infinity:a>d?(l=n.shrink-i.totals.shrink)>0?(d-a)/l:linebreak.infinity:0}function c(e){const r={width:n.width,stretch:n.stretch,shrink:n.shrink};for(let i=e;i<t.length;i+=1)if("glue"===t[i].type)r.width+=t[i].width,r.stretch+=t[i].stretch,r.shrink+=t[i].shrink;else if("box"===t[i].type||"penalty"===t[i].type&&t[i].penalty===-linebreak.infinity&&i>e)break;return r}function u(t,e,r){let n,s,a,h,u,g=o.first(),p=null,f=0,m=0,y=[],b=0,E=0;for(;null!==g;){for(y=[{demerits:1/0},{demerits:1/0},{demerits:1/0},{demerits:1/0}];null!==g&&(p=g.next,b=g.data.line+1,((f=d(g.data.position,e,g.data,b))<-1||"penalty"===t.type&&t.penalty===-linebreak.infinity)&&o.remove(g),f>=-1&&f<=i.tolerance&&(n=100*Math.pow(Math.abs(f),3),m="penalty"===t.type&&t.penalty>=0?Math.pow(i.demerits.line+n,2)+Math.pow(t.penalty,2):"penalty"===t.type&&t.penalty!==-linebreak.infinity?Math.pow(i.demerits.line+n,2)-Math.pow(t.penalty,2):Math.pow(i.demerits.line+n,2),"penalty"===t.type&&"penalty"===r[g.data.position].type&&(m+=i.demerits.flagged*t.flagged*r[g.data.position].flagged),E=f<-.5?0:f<=.5?1:f<=1?2:3,Math.abs(E-g.data.fitnessClass)>1&&(m+=i.demerits.fitness),(m+=g.data.demerits)<y[E].demerits&&(y[E]={active:g,demerits:m,ratio:f})),!(null!==(g=p)&&g.data.line>=b)););for(s=c(e),a=0;a<y.length;a+=1)(h=y[a]).demerits<1/0&&(u=new LinkedList.Node(l(e,h.demerits,h.ratio,h.active.data.line+1,a,s,h.active)),null!==g?o.insertBefore(g,u):o.push(u))}}if(o.push(new LinkedList.Node(l(0,0,0,0,0,void 0,null))),t.forEach((t,e,r)=>{"box"===t.type?n.width+=t.width:"glue"===t.type?(e>0&&"box"===r[e-1].type&&u(t,e,r),n.width+=t.width,n.stretch+=t.stretch,n.shrink+=t.shrink):"penalty"===t.type&&t.penalty!==linebreak.infinity&&u(t,e,r)}),0!==o.size()){for(o.forEach(t=>{t.data.demerits<h.data.demerits&&(h=t)});null!==h;)a.push({position:h.data.position,ratio:h.data.ratio}),h=h.data.previous;return a.reverse()}return[]};linebreak.infinity=1e4,linebreak.glue=((t,e,r)=>({type:"glue",width:t,stretch:e,shrink:r})),linebreak.box=((t,e,r=!1)=>({type:"box",width:t,value:e,hyphenated:r})),linebreak.penalty=((t,e,r)=>({type:"penalty",width:t,penalty:e,flagged:r}));const SOFT_HYPHEN_HEX="­",NO_BREAK_SPACE_DECIMAL=160,getWords=t=>{const e=[],{start:r}=t;let i=0;for(const o of t){const{index:n}=o;if(160!==t.codePointAtGlyphIndex(n)&&t.isWhiteSpace(n-r)){const o=t.slice(i,n-r);o.length>0&&e.push(o),i=n-r+1}}if(i<t.end){const r=t.slice(i,t.end-t.start);e.push(r)}return e},h=new Hypher(english),hyphenateString=t=>t.includes("­")?t.split("­"):h.hyphenate(t),hyphenateWord=t=>{let e=0;return hyphenateString(t.string).map(r=>{const i=t.slice(e,e+r.length);return e+=r.length,i})},hyphenate=t=>t.map(t=>hyphenateWord(t)),formatter=(t,e,r,i)=>{const o=t(" "),n=t("-"),s=i||(e&&"justify"!==e?600:100),a=3,h=6,l=9;return e=>{const i=[],d=getWords(e),c=o*a/h,u=o*a/l;return(r||hyphenate)(d,e).forEach((e,r,a)=>{e.length>1?e.forEach((r,o,a)=>{const h=o===e.length-1;i.push(linebreak.box(t(r),r,!h)),o!==a.length-1&&i.push(linebreak.penalty(n,s,1))}):i.push(linebreak.box(t(e[0]),e[0])),r===a.length-1?(i.push(linebreak.glue(0,linebreak.infinity,0)),i.push(linebreak.penalty(0,-linebreak.infinity,1))):i.push(linebreak.glue(o,c,u))}),i}},HYPHEN=45,TOLERANCE_STEPS=5,TOLERANCE_LIMIT=40;var lineBreaker=({callback:t,penalty:e}={})=>r=>{const i=new(createLinebreaker()(r));return class{constructor(t){this.tolerance=t||4}suggestLineBreak(r,o,n){let s=this.tolerance;const a=this.measureWidth(r),h=formatter(a,n.align,t,e)(r);let l=[];for(;0===l.length&&s<40;)l=linebreak(h,[o],{tolerance:s}),s+=5;if(0===l.length){const t=i.suggestLineBreak(r,o,n);if(t)return t;const e=r.glyphIndexAtOffset(o)-1;return r.insertGlyph(e,45),{position:e+1}}if(!l[1])return{position:r.end};const d=this.findBreakNode(h,l[1].position),c=d.value.end-r.start;return d.hyphenated?(r.insertGlyph(c,45),{position:c+1}):{position:c+(r.isWhiteSpace(c)?1:0)}}measureWidth(t){const{font:e,fontSize:r}=t.glyphRuns[0].attributes;return t=>{if("string"==typeof t){const i=r/e.unitsPerEm;return e.layout(t).positions[0].xAdvance*i}return t.advanceWidth}}findBreakNode(t,e){let r=e-1;for(;!t[r].value;)r-=1;return t[r]}}};const shrinkWhitespaceFactor={before:-.5,after:-.5};class LayoutEngine$1 extends textkitCore.LayoutEngine{constructor({hyphenationCallback:t,hyphenationPenalty:e}){super({scriptItemizer:scriptItemizer(),decorationEngine:textDecorationEngine(),lineFragmentGenerator:lineFragmentGenerator(),fontSubstitutionEngine:fontSubstitutionEngine(),justificationEngine:justificationEngine({shrinkWhitespaceFactor:shrinkWhitespaceFactor}),lineBreaker:lineBreaker({callback:t,penalty:e})})}}const MARKERS=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];class JPEG{constructor(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");let e,r=2;for(;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)}}const createCache=({limit:t=100}={})=>{const e={},r=[];return{get:t=>e[t],set:(i,o)=>{r.push(i),r.length>t&&delete e[r.shift()],e[i]=o},length:()=>r.length}},imagesCache=createCache({limit:30}),isValidFormat=t=>{const e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e},isCompatibleBase64=t=>/data:image\/[a-zA-Z]*;base64,[^"]*/g.test(t);function getImage(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new JPEG(t);case"png":return new PNG(t);default:return null}}const resolveBase64Image=t=>{const e=/data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(t),r=e[1],i=e[2];if(!isValidFormat(r))throw new Error(`Base64 image invalid format: ${r}`);return new _Promise(t=>t(getImage(Buffer.from(i,"base64"),r)))},resolveLocalImage=t=>{if(t.data&&t.format)return new _Promise(e=>e(getImage(t.data,t.format)));throw new Error(`Invalid data given for local file: ${_JSON$stringify(t)}`)},resolveRemoteImage=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>"Buffer"===t.constructor.name?t:Buffer.from(t)).then(t=>{const 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];let i="";if(e)i="png";else{if(!r)throw new Error("Not valid image extension");i="jpg"}return getImage(t,i)}),resolveImage=(t,e=!0)=>{if(e&&imagesCache.get(t))return imagesCache.get(t);let r;return r=isCompatibleBase64(t)?resolveBase64Image(t):"object"==typeof t?resolveLocalImage(t):resolveRemoteImage(t),e&&imagesCache.set(t,r),r},emojis={},regex=emojiRegex(),reflect=t=>(...e)=>t(...e).then(t=>t,t=>t),fetchEmojiImage=reflect(resolveImage),getCodePoints=t=>_Array$from(t).map(t=>t.codePointAt(0).toString(16)).join("-"),buildEmojiUrl=t=>{const{url:e,format:r}=Font.getEmojiSource();return`${e}${getCodePoints(t)}.${r}`},fetchEmojis=t=>{const e=Font.getEmojiSource();if(!e||!e.url)return[];const r=[];let i;for(;i=regex.exec(t);){const t=i[0];if(!emojis[t]||emojis[t].loading){const e=buildEmojiUrl(t);emojis[t]={loading:!0},r.push(fetchEmojiImage(e).then(e=>{emojis[t].loading=!1,emojis[t].data=e.data}))}}return r},embedEmojis=t=>{const e=[];for(let r=0;r<t.length;r++){const i=t[r];let o,n=0;for(;o=regex.exec(i.string);){const t=o.index,r=o[0],s=i.attributes.fontSize,a=i.string.slice(n,t+o[0].length);emojis[r]&&emojis[r].data?e.push({string:a.replace(o,textkitCore.Attachment.CHARACTER),attributes:_extends({},i.attributes,{attachment:new textkitCore.Attachment(s,s,{yOffset:Math.floor(.1*s),image:emojis[r].data})})}):e.push({string:a.replace(o,String.fromCharCode(0)),attributes:i.attributes}),n=t+r.length}n<i.string.length&&e.push({string:i.string.slice(n),attributes:i.attributes})}return e};class Document$1{constructor(t,e){this.root=t,this.props=e,this.children=[]}get name(){return"Document"}appendChild(t){t.parent=this,this.children.push(t)}removeChild(t){const e=this.children.indexOf(t);t.parent=null,this.children.slice(e,1)}addMetaData(){const{title:t,author:e,subject:r,keywords:i,creator:o,producer:n}=this.props;t&&(this.root.instance.info.Title=t),e&&(this.root.instance.info.Author=e),r&&(this.root.instance.info.Subject=r),i&&(this.root.instance.info.Keywords=i),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=n||"react-pdf"}async loadFonts(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();r.style&&r.style.fontFamily&&t.push(Font.load(r.style.fontFamily,this.root.instance)),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadEmojis(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"string"==typeof r?t.push(...fetchEmojis(r)):"string"==typeof r.value?t.push(...fetchEmojis(r.value)):r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadImages(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"Image"===r.name&&t.push(r.fetch()),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadAssets(){await _Promise.all([this.loadFonts(),this.loadImages()])}applyProps(){this.children.forEach(t=>t.applyProps())}update(t){this.props=t}async wrapPages(){let t=1;const e=[];for(const r of this.children){const i=r.size.height-(r.style.paddingBottom||0);if(r.wrap){const o=await wrapPages(r,i,t);t+=o.length,e.push(...o)}else r.height=r.size.height,e.push(r)}return e}async renderPages(){const t=await this.wrapPages();for(let e=0;e<t.length;e++)t[e].renderDynamicNodes({pageNumber:e+1,totalPages:t.length},t=>"Text"===t.name),await t[e].render();return t}async render(){try{this.addMetaData(),this.applyProps(),await this.loadEmojis(),await this.loadAssets(),await this.renderPages(),this.root.instance.end(),Font.reset()}catch(t){throw t}}}Document$1.defaultProps={author:null,keywords:null,subject:null,title:null};const PERCENT=/^(\d+)?%$/g;class Node$1{constructor(){this.parent=null,this.children=[],this.computed=!1,this.layout=Yoga.Node.createDefault()}appendChild(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout))}removeAllChilds(){const t=[...this.children];for(let e=0;e<t.length;e++)t[e].remove()}remove(){this.parent.removeChild(this)}setDimension(t,e){const r=`set${upperFirst(t)}`,i=`${r}Percent`,o=PERCENT.exec(e);o?this.layout[i](parseInt(o[1],10)):this.layout[r](e)}setPosition(t,e){const r=PERCENT.exec(e);r?this.layout.setPositionPercent(t,parseInt(r[1],10)):this.layout.setPosition(t,e)}setPadding(t,e){const r=PERCENT.exec(e);r?this.layout.setPaddingPercent(t,parseInt(r[1],10)):this.layout.setPadding(t,e)}setMargin(t,e){const r=PERCENT.exec(e);r?this.layout.setMarginPercent(t,parseInt(r[1],10)):this.layout.setMargin(t,e)}setBorder(t,e){if(PERCENT.exec(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)}getAbsoluteLayout(){const 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}}copyStyle(t){this.layout.copyStyle(t.layout)}calculateLayout(){this.layout.calculateLayout(),this.computed=!0}isEmpty(){return 0===this.children.length}markDirty(){return this.layout.markDirty()}onAppendDynamically(){}get position(){return this.layout.getPositionType()===Yoga.POSITION_TYPE_ABSOLUTE?"absolute":"relative"}get top(){return this.layout.getComputedTop()||0}get left(){return this.layout.getComputedLeft()||0}get right(){return this.layout.getComputedRight()||0}get bottom(){return this.layout.getComputedBottom()||0}get width(){return this.layout.getComputedWidth()}get minWidth(){return this.layout.getMinWidth().value}get maxWidth(){return this.layout.getMaxWidth().value}get height(){return this.layout.getComputedHeight()}get minHeight(){return this.layout.getMinHeight().value}get maxHeight(){return this.layout.getMaxHeight().value}get paddingTop(){return this.layout.getComputedPadding(Yoga.EDGE_TOP)||0}get paddingRight(){return this.layout.getComputedPadding(Yoga.EDGE_RIGHT)||0}get paddingBottom(){return this.layout.getComputedPadding(Yoga.EDGE_BOTTOM)||0}get paddingLeft(){return this.layout.getComputedPadding(Yoga.EDGE_LEFT)||0}get marginTop(){return this.layout.getComputedMargin(Yoga.EDGE_TOP)||0}get marginRight(){return this.layout.getComputedMargin(Yoga.EDGE_RIGHT)||0}get marginBottom(){return this.layout.getComputedMargin(Yoga.EDGE_BOTTOM)||0}get marginLeft(){return this.layout.getComputedMargin(Yoga.EDGE_LEFT)||0}get borderTopWidth(){return this.layout.getComputedBorder(Yoga.EDGE_TOP)||0}get borderRightWidth(){return this.layout.getComputedBorder(Yoga.EDGE_RIGHT)||0}get borderBottomWidth(){return this.layout.getComputedBorder(Yoga.EDGE_BOTTOM)||0}get borderLeftWidth(){return this.layout.getComputedBorder(Yoga.EDGE_LEFT)||0}get padding(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}}get margin(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}}set position(t){this.layout.setPositionType("absolute"===t?Yoga.POSITION_TYPE_ABSOLUTE:Yoga.POSITION_TYPE_RELATIVE)}set top(t){this.setPosition(Yoga.EDGE_TOP,t)}set left(t){this.setPosition(Yoga.EDGE_LEFT,t)}set right(t){this.setPosition(Yoga.EDGE_RIGHT,t)}set bottom(t){this.setPosition(Yoga.EDGE_BOTTOM,t)}set width(t){this.setDimension("width",t)}set minWidth(t){this.setDimension("minWidth",t)}set maxWidth(t){this.setDimension("maxWidth",t)}set height(t){this.setDimension("height",t)}set minHeight(t){this.setDimension("minHeight",t)}set maxHeight(t){this.setDimension("maxHeight",t)}set paddingTop(t){this.setPadding(Yoga.EDGE_TOP,t)}set paddingRight(t){this.setPadding(Yoga.EDGE_RIGHT,t)}set paddingBottom(t){this.setPadding(Yoga.EDGE_BOTTOM,t)}set paddingLeft(t){this.setPadding(Yoga.EDGE_LEFT,t)}set marginTop(t){this.setMargin(Yoga.EDGE_TOP,t)}set marginRight(t){this.setMargin(Yoga.EDGE_RIGHT,t)}set marginBottom(t){this.setMargin(Yoga.EDGE_BOTTOM,t)}set marginLeft(t){this.setMargin(Yoga.EDGE_LEFT,t)}set padding(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}set margin(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}set borderTopWidth(t){this.setBorder(Yoga.EDGE_TOP,t)}set borderRightWidth(t){this.setBorder(Yoga.EDGE_RIGHT,t)}set borderBottomWidth(t){this.setBorder(Yoga.EDGE_BOTTOM,t)}set borderLeftWidth(t){this.setBorder(Yoga.EDGE_LEFT,t)}}const yogaValue=(t,e)=>{const r=t=>"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}},parseValue=t=>{const e=/^(\d*\.?\d+)(in|mm|cm|pt)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}},parseScalar=t=>{let e={};const r=parseValue(t);switch(r.unit){case"in":e=72*r.value;break;case"mm":e=r.value*(1/25.4)*72;break;case"cm":e=r.value*(1/2.54)*72;break;default:e=r.value}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}},expandStyles=t=>{if(!t)return t;const e=_Object$keys(t),r={};for(let i=0;i<e.length;i++){const o=e[i],n=t[o];switch(o){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[o]=yogaValue(o,n);break;case"textAlignVertical":r.verticalAlign="center"===n?"middle":n;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":{const t=styleShortHands[o];for(const e in t)hasOwnProperty.call(t,e)&&(r[e]=n)}break;default:r[o]=n}}return r},matchBorderShorthand=t=>t.match(/(\d+(px|in|mm|cm|pt)?)\s(\S+)\s(\S+)/),processBorders=(t,e)=>{const 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},transformStyles=t=>{const e=expandStyles(t),r=_Object$keys(e),i={};for(let t=0;t<r.length;t++){const o=r[t],n=e[o],s=o.match(/border/)&&"string"==typeof n?processBorders(o,n):n;i[o]=parseScalar(s)}return i},create=t=>t,flatten=t=>{return Array.isArray(t)||(t=[t]),t.reduce((t,e)=>(e&&_Object$keys(e).forEach(r=>{null!==e[r]&&void 0!==e[r]&&(t[r]=e[r])}),t),{})},resolveMediaQueries=(t,e)=>{return _Object$keys(t).reduce((r,i)=>/@media/.test(i)?_extends({},r,matchMedia({[i]:t[i]},e)):_extends({},r,{[i]:t[i]}),{})},resolve=(t,e)=>t?(t=flatten(t),t=resolveMediaQueries(t,e),t=transformStyles(t)):null,absoluteFillObject={position:"absolute",top:0,left:0,bottom:0,right:0};var StyleSheet={hairlineWidth:1,create:create,resolve:resolve,flatten:flatten,absoluteFillObject:absoluteFillObject};const Debug={debug(){const 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.root.instance.restore()},debugText(t,e){const r=Math.round(this.width+e.left+e.right),i=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(`${r} x ${i}`,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent(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(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(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()}},Borders={drawBorders(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),{borderTopWidth:o=0,borderRightWidth:n=0,borderBottomWidth:s=0,borderLeftWidth:a=0}=this,{borderTopLeftRadius:h=0,borderTopRightRadius:l=0,borderBottomRightRadius:d=0,borderBottomLeftRadius:c=0,borderTopColor:u="black",borderRightColor:g="black",borderBottomColor:p="black",borderLeftColor:f="black",borderTopStyle:m="solid",borderRightStyle:y="solid",borderBottomStyle:b="solid",borderLeftStyle:E="solid"}=this.getComputedStyles();this.root.instance.save(),this.drawHorizontalBorder([t+(h>0?o/2:0),e+o/2],[t+r-(l>0?o/2:0),e+o/2],h,l,o,u,m),this.drawVerticalBorder([t+r-n/2,e+(l>0?n/2:0)],[t+r-n/2,e+i-(d>0?n/2:0)],-l,-d,n,g,y),this.drawHorizontalBorder([t+r-(d>0?s/2:0),e+i-s/2],[t+(c>0?s/2:0),e+i-s/2],-d,-c,s,p,b),this.drawVerticalBorder([t+a/2,e+i-(c>0?a/2:0)],[t+a/2,e+(h>0?a/2:0)],c,h,a,f,E),this.root.instance.restore()},traceBorder(t,e){switch(t){case"dashed":this.root.instance.dash(2*e,{space:1.2*e}).stroke();break;case"dotted":this.root.instance.dash(e,{space:1.2*e}).stroke();break;default:this.root.instance.stroke()}},drawHorizontalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0],t[1]+r).quadraticCurveTo(t[0],t[1],t[0]+r,t[1]).lineTo(e[0]-i,e[1]).quadraticCurveTo(e[0],e[1],e[0],e[1]+i).strokeColor(n),this.traceBorder(s,o))},drawVerticalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0]+r,t[1]).quadraticCurveTo(t[0],t[1],t[0],t[1]-r).lineTo(e[0],e[1]+i).quadraticCurveTo(e[0],e[1],e[0]+i,e[1]).strokeColor(n),this.traceBorder(s,o))}},getRotation=t=>{const e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){const t=e[1];return"rad"===e[2]?180*t/Math.PI:t}return 0},getTranslateX=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null},applySingleTransformation=(t,e)=>{const{left:r,top:i,width:o,height:n}=t.getAbsoluteLayout(),s=[r+o/2,i+n/2];/rotate/g.test(e)?t.root.instance.rotate(getRotation(e),{origin:s}):/scaleX/g.test(e)?t.root.instance.scale(getScaleX(e),1,{origin:s}):/scaleY/g.test(e)?t.root.instance.scale(1,getScaleY(e),{origin:s}):/scale/g.test(e)?t.root.instance.scale(getScaleX(e),getScaleY(e),{origin:s}):/translateX/g.test(e)?t.root.instance.translate(getTranslateX(e),1,{origin:s}):/translateY/g.test(e)?t.root.instance.translate(1,getTranslateY(e),{origin:s}):/translate/g.test(e)?t.root.instance.translate(getTranslateX(e),getTranslateY(e),{origin:s}):/matrix/g.test(e)&&t.root.instance.transform(...getMatrix(e))},Transformations={applyTransformations(){let t;const e=/[a-zA-Z]+\([^)]+\)/g,r=this.style&&this.style.transform||"";for(;null!=(t=e.exec(r));)applySingleTransformation(this,t[0])}},inheritedProperties=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","textDecoration","lineHeight","textAlign","visibility","wordSpacing"];class Base extends Node$1{constructor(t,e){super(),this.root=t,this.props=merge({},this.constructor.defaultProps,Base.defaultProps,e),warning(!this.props.styles,'"styles" prop passed instead of "style" prop')}get page(){return this.parent.page}get wrap(){return this.props.wrap}get break(){return this.props.break}get fixed(){return this.props.fixed}get minPresenceAhead(){return this.props.minPresenceAhead}get absolute(){return"absolute"===this.props.style.position}set break(t){this.props.break=t}applyProps(){const{size:t,orientation:e}=this.page;this.style=StyleSheet.resolve(this.props.style,{width:t.width,height:t.height,orientation:e}),toPairsIn(this.style).map(([t,e])=>{this.applyStyle(t,e)}),this.children.forEach(t=>{t.applyProps&&t.applyProps()})}applyStyle(t,e){const 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)}}getComputedStyles(){let t=this.parent,e={};for(;t&&t.parent;)e=_extends({},t.parent.style,t.style,e),t=t.parent;return _extends({},pick(e,inheritedProperties),this.style)}drawBackgroundColor(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),o=this.getComputedStyles(),n=Math.max(o.borderTopLeftRadius,o.borderTopRightRadius,o.borderBottomRightRadius,o.borderBottomLeftRadius)||0;o.backgroundColor&&this.root.instance.fillColor(o.backgroundColor).roundedRect(t,e,r,i,n).fill()}clone(){const t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t}onNodeSplit(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}update(t){this.props=merge({},this.constructor.defaultProps,Base.defaultProps,t),this.root.markDirty()}async renderChildren(){const t=this.children.filter(t=>t.absolute),e=this.children.filter(t=>!t.absolute);for(let t=0;t<e.length;t++)await e[t].render();for(let e=0;e<t.length;e++)await t[e].render()}}Base.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0},minPresenceAhead:0},_Object$assign(Base.prototype,Debug),_Object$assign(Base.prototype,Borders),_Object$assign(Base.prototype,Transformations);class TextInstance{constructor(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}get name(){return"TextInstance"}remove(){this.parent.removeChild(this)}clone(){return new this.constructor(this.root,this.value)}update(t){this.value=t,this.parent.computed=!1,this.parent._container=null,this.root.markDirty()}}const 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=(t,e="portrait")=>{let r;if("string"==typeof t)r=PAGE_SIZES[t.toUpperCase()];else if(Array.isArray(t))r=t;else{if("object"!=typeof t||!t.width||!t.height)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]}},RULER_WIDTH=13,RULER_COLOR="white",RULER_FONT_SIZE=5,DEFAULT_RULER_STEPS=50,LINE_WIDTH=.5,LINE_COLOR="gray",GRID_COLOR="#ababab",range=(t,e)=>_Array$from({length:Math.ceil(t/e)},(t,r)=>r*e),matchPercentage=t=>{const e=t.match(/(\d+\.?\d*)%/);return e?100/parseFloat(e[1],10):null},Ruler={getRulerWidth:()=>13,hasHorizontalRuler(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps(){const t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.width-(this.hasVerticalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps(){const t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.height-(this.hasHorizontalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler(){const 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(){const t=this.hasVerticalRuler()?13:0;this.root.instance.rect(t,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");const e=range(this.width,this.getHorizontalSteps());e.map(e=>{this.root.instance.moveTo(t+e,0).lineTo(t+e,13).stroke("gray").fillColor("black").text(`${Math.round(e)}`,t+e+1,1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(t+e,13).lineTo(t+e,this.height).stroke("#ababab")})},drawVerticalRuler(){const t=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,t,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");const e=range(this.height,this.getVerticalSteps());e.map(e=>{this.root.instance.moveTo(0,t+e).lineTo(13,t+e).stroke("gray").fillColor("black").text(`${Math.round(e)}`,1,t+e+1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(13,t+e).lineTo(this.width,t+e).stroke("#ababab")})}};class Page$1 extends Base{constructor(t,e){super(t,e),this._size=null}get name(){return"Page"}get document(){return this.parent}get page(){return this}get orientation(){return this.props.orientation}get size(){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)}resetMargins(){(this.style.marginTop||this.style.marginBottom||this.style.marginLeft||this.style.marginRight)&&(warning(!1,"Margin values are not allowed on Page element. Use padding instead."),this.style.marginTop=0,this.style.marginBottom=0,this.style.marginLeft=0,this.style.marginRight=0)}applyProps(){this.top=0,this.left=0,this.style=StyleSheet.resolve(this.props.style),this.resetMargins(),this.layout.setWidth(this.size.width);const t=this.getRulerWidth(),{paddingTop:e=0,paddingLeft:r=0}=this.style;this.hasHorizontalRuler()&&(this.style.paddingTop=e+t),this.hasVerticalRuler()&&(this.style.paddingLeft=r+t),super.applyProps()}async addDynamicChild(t,e){if(!e)return;const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const i=r[e],{type:o,props:n}=i;if("string"==typeof i){const e=new TextInstance(this.root,i);t.appendChild(e)}else if(o!==react.Fragment){const e=createInstance(i,this.root);await e.onAppendDynamically(),t.appendChild(e),e.applyProps(),await this.addDynamicChild(e,n.children)}else await this.addDynamicChild(t,n.children)}}async renderDynamicNodes(t,e){const r=this.children.slice(0);for(;r.length>0;){const i=r.shift();if((!e||e(i))&&i.props.render){i.removeAllChilds();const e=i.props.render(t);await this.addDynamicChild(i,e),i.fixed||(i.props.render=null)}else i.children&&r.push(...i.children)}}async nodeWillWrap(t){await this.renderDynamicNodes(t),this.calculateLayout()}onNodeSplit(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()}update(t){}clone(){const t=super.clone();return t._size=this.size,t}async render(){const{instance:t}=this.root;this.height=this.size.height,this.calculateLayout(),t.addPage({size:[this.size.width,this.size.height],margin:0}),this.style.backgroundColor&&t.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,this.size.height).fill(),await this.renderChildren(),this.props.debug&&this.debug(),this.renderRuler()}}Page$1.defaultProps={size:"A4",orientation:"portrait",style:{},wrap:!0},_Object$assign(Page$1.prototype,Ruler);class View$1 extends Base{get name(){return"View"}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),await this.renderChildren(),this.props.debug&&this.debug(),this.root.instance.restore()}}View$1.defaultProps={style:{},wrap:!0};const PROTOCOL_REGEXP=/^(http|https|ftp|ftps|mailto)\:\/\//i,getURL=t=>{let e=t;return"string"!=typeof e||e.match(PROTOCOL_REGEXP)||(e=`http://${e}`),e},IGNORABLE_CODEPOINTS=[8232,8233],buildSubsetForFont=t=>IGNORABLE_CODEPOINTS.reduce((e,r)=>t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(r)?e:[...e,String.fromCharCode(r)],[]),ignoreChars=t=>t.map(t=>{const e=buildSubsetForFont(t.attributes.font),r=new RegExp(e.join("|"));return{string:t.string.replace(r,""),attributes:t.attributes}}),PREPROCESSORS=[ignoreChars,embedEmojis],transformText=(t,e)=>{switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return upperFirst(t);default:return t}},getFragments=t=>{let e=[];const{color:r="black",fontFamily:i="Helvetica",fontSize:o=18,textAlign:n="left",position:s,top:a,bottom:h,lineHeight:l,textDecoration:d,textDecorationColor:c,textDecorationStyle:u,textTransform:g,letterSpacing:p}=t.getComputedStyles();t.children.forEach(f=>{if(null!==f.value&&void 0!==f.value){const m=Font.getFont(i),y=m?m.data:i,b=transformText(f.value,g);e.push({string:b,attributes:{font:y,color:r,fontSize:o,align:n,link:t.src,characterSpacing:p,underlineStyle:u,underline:"underline"===d,underlineColor:c||r,lineHeight:l?l*o:null,yOffset:"relative"===s?-a||h||0:null}})}else f&&e.push(...getFragments(f))});for(const t of PREPROCESSORS)e=t(e);return e},getAttributedString=t=>textkitCore.AttributedString.fromFragments(getFragments(t)).trim(),INFINITY=999999,PDFRenderer$2=createPDFRenderer({Rect:textkitCore.Rect});class Text$1 extends Base{constructor(t,e){super(t,e),this.start=0,this.end=0,this.computed=!1,this._container=null,this._attributedString=null,this._layoutEngine=null,this.renderCallback=e.render,this.layout.setMeasureFunc(this.measureText.bind(this))}get name(){return"Text"}get src(){return getURL(this.props.src||this.props.href)}get attributedString(){return this._attributedString||(this._attributedString=getAttributedString(this)),this._attributedString}set attributedString(t){this._attributedString=t}get container(){const t=this._container.blocks.reduce((t,e)=>[...t,...e.lines],[]);return _extends({},this._container,{blocks:[{lines:t.splice(this.start,this.end)}]})}get lines(){return this.container?this.container.blocks.reduce((t,e)=>[...t,...e.lines],[]):[]}get linesHeight(){return this._container?this.lines.reduce((t,e)=>t+e.height,0):-1}get linesWidth(){return this._container?Math.max(...this.lines.map(t=>t.advanceWidth)):-1}get layoutEngine(){if(!this._layoutEngine){const{hyphenationPenalty:t}=this.props,e=Font.getHyphenationCallback();this._layoutEngine=new LayoutEngine$1({hyphenationCallback:e,hyphenationPenalty:t})}return this._layoutEngine}set layoutEngine(t){this._layoutEngine=t}appendChild(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this._attributedString=null,this.markDirty())}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this._attributedString=null,this.markDirty())}lineIndexAtHeight(t){let e=0;for(let r=0;r<this.lines.length;r++){const i=this.lines[r];if(e+i.height>t)return r;e+=i.height}return this.lines.length}heightAtLineIndex(t){let e=0;for(let r=0;r<t;r++){e+=this.lines[r].height}return e}layoutText(t,e){if(e=e||INFINITY,!this._container||this.props.render){const r=(new textkitCore.Path).rect(0,0,t,e),i=new textkitCore.Container(r),o=this.attributedString;this.layoutEngine.layout(o,[i]),this._container=i}const r=this._container.blocks.reduce((t,e)=>t+e.lines.length,0);this.computed=!0,this.end=r+1}measureText(t,e,r,i){return e===Yoga.MEASURE_MODE_EXACTLY?(this.layoutText(t),{height:this.style.flexGrow?NaN:this.linesHeight}):e===Yoga.MEASURE_MODE_AT_MOST||i===Yoga.MEASURE_MODE_AT_MOST?(this.layoutText(t,r),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}}getComputedStyles(){const t=super.getComputedStyles();return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(t.top=t.top||this.parent.style.top,t.bottom=t.bottom||this.parent.style.bottom,t.position=t.position||"relative"),this.src&&(t.color=t.color||"blue",t.textDecoration=t.textDecoration||"underline"),t}wrapHeight(t){const{orphans:e,widows:r}=this.props,i=this.lines.length,o=t-this.paddingTop,n=this.lineIndexAtHeight(o);return i<e?t:n<e||i<e+r?0:i===e+r?this.heightAtLineIndex(e-1):i-n<r?t-this.heightAtLineIndex(r-1):t}onNodeSplit(t,e){const r=this.wrapHeight(t),i=this.lineIndexAtHeight(r),o=this.lines[i-1];e.marginTop=0,e.paddingTop=0,e.start=i,e.attributedString=this.attributedString.slice(o?o.stringEnd:0,this.attributedString.length),this.height=r,this.marginBottom=0,this.paddingBottom=0,this.end=i}clone(){const t=super.clone();return t.layoutEngine=this.layoutEngine,this.props.render||this.props.fixed||(t._container=this._container),t}async render(){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);const t=this.padding,{top:e,left:r}=this.getAbsoluteLayout(),i=this.lines[0]?this.lines[0].rect.y:0;this.lines.forEach(o=>{o.rect.x+=r+t.left,o.rect.y+=e+t.top-i}),new PDFRenderer$2(this.root.instance,{outlineLines:!1}).render(this.container),this.props.debug&&this.debug(),this.root.instance.restore()}}Text$1.defaultProps={wrap:!0,widows:2,orphans:2};class Link$1 extends Base{get name(){return"Link"}get src(){return getURL(this.props.src||this.props.href)}async render(){const{top:t,left:e,width:r,height:i}=this.getAbsoluteLayout();this.root.instance.link(e,t,r,i,this.src),await this.renderChildren(),this.props.debug&&this.debug()}}class Note$1 extends Base{get name(){return"Note"}appendChild(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1))}applyProps(){super.applyProps(),this.height=0,this.width=0}async render(){const{top:t,left:e}=this.getAbsoluteLayout(),r=this.children[0]?this.children[0].value:"";this.root.instance.note(e,t,0,0,r)}}Note$1.defaultProps={};const SAFETY_HEIGHT=10;class Image$1 extends Base{constructor(t,e){super(t,e),this.image=null,this.layout.setMeasureFunc(this.measureImage.bind(this))}get name(){return"Image"}shouldGrow(){return!!this.getComputedStyles().flexGrow}measureImage(t,e,r,i){const o=this.margin,n=this.page.padding,s=this.page.size.height-n.top-n.bottom-o.top-o.bottom-SAFETY_HEIGHT;if(!this.image)return{width:0,height:0};if(e===Yoga.MEASURE_MODE_EXACTLY&&i===Yoga.MEASURE_MODE_UNDEFINED){const e=t/this.ratio;return{height:Math.min(s,e)}}if(i===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&&i===Yoga.MEASURE_MODE_AT_MOST){const e=t/this.ratio;return{height:Math.min(r,s,e)}}if(e===Yoga.MEASURE_MODE_AT_MOST&&i===Yoga.MEASURE_MODE_AT_MOST){const e=Math.min(this.image.width,t);return{width:e,height:e/this.ratio}}return{height:r,width:t}}get ratio(){return this.image.data?this.image.width/this.image.height:1}async fetch(){try{this.image=await resolveImage(this.props.src,this.props.cache)}catch(t){this.image={width:0,height:0},console.warn(t.message)}}clone(){const t=super.clone();return t.image=this.image,t}async onAppendDynamically(){await this.fetch()}async render(){const t=this.padding,{left:e,top:r}=this.getAbsoluteLayout();if(this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.image.data){const i=Math.min(this.height*this.ratio,this.width)-t.left-t.right,o=this.height-t.top-t.bottom,n=Math.max((this.width-i)/2,0);0!==i&&0!==o?this.root.instance.image(this.image.data,e+t.left+n,r+t.top,{width:i,height:o}):warning(!1,`Image with src '${this.props.src}' skipped due to invalid dimensions`)}this.props.debug&&this.debug(),this.root.instance.restore()}}Image$1.defaultProps={wrap:!1,cache:!0};const constructors={ROOT:Root,PAGE:Page$1,TEXT:Text$1,LINK:Link$1,VIEW:View$1,NOTE:Note$1,IMAGE:Image$1,DOCUMENT:Document$1,TEXT_INSTANCE:TextInstance};function createInstance(t,e){const{type:r,props:i={}}=t;if(constructors[r])return new constructors[r](e,i);throw new Error(`Invalid element of type ${r} passed to PDF renderer`)}const objectsEqual=(t,e)=>{const r=_Object$keys(t),i=_Object$keys(e);if(r.length!==i.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if("render"!==o){if("children"!==o&&t[o]!==e[o]){if("object"==typeof t[o]&&"object"==typeof e[o]&&objectsEqual(t[o],e[o]))continue;return!1}}else if(!t[o]!=!e[o])return!1}return!0},shouldReplaceLink=(t,e)=>"LINK"===t&&("string"==typeof e.children||Array.isArray(e.children)||e.render),PDFRenderer=ReactFiberReconciler({supportsMutation:!0,appendInitialChild(t,e){t.appendChild(e)},createInstance:(t,e,r)=>createInstance({type:shouldReplaceLink(t,e)?"TEXT":t,props:e},r),createTextInstance:(t,e)=>createInstance({type:"TEXT_INSTANCE",props:t},e),finalizeInitialChildren:(t,e,r)=>!1,getPublicInstance:t=>t,prepareForCommit(){},prepareUpdate:(t,e,r,i)=>!objectsEqual(r,i),resetAfterCommit(){},resetTextContent(t){},getRootHostContext:()=>emptyObject,getChildHostContext:()=>emptyObject,shouldSetTextContent:(t,e)=>!1,now:Date.now,useSyncScheduling:!0,appendChild(t,e){t.appendChild(e)},appendChildToContainer(t,e){t.appendChild(e)},removeChild(t,e){t.removeChild(e)},removeChildFromContainer(t,e){t.removeChild(e)},commitTextUpdate(t,e,r){t.update(r)},commitUpdate(t,e,r,i,o){t.update(o)}});var version="1.0.0-alpha.25";const View="VIEW",Text="TEXT",Link="LINK",Page="PAGE",Note="NOTE",Image="IMAGE",Document="DOCUMENT",pdf=t=>{const e=createInstance({type:"ROOT"}),r=PDFRenderer.createContainer(e);function i(t){PDFRenderer.updateContainer(t,r,null)}return t&&i(t),{isDirty:function(){return e.isDirty},updateContainer:i,toBuffer:function(){return e.document.props.onRender&&e.document.props.onRender(),e.render(),e.instance},toBlob:async function(){await e.render();const t=e.instance.pipe(BlobStream());return new _Promise((r,i)=>{t.on("finish",()=>{try{const o=t.toBlob("application/pdf");e.document.props.onRender&&e.document.props.onRender({blob:o}),r(o)}catch(t){i(t)}}),t.on("error",i)})},toString:function(){let t="";return e.render(),new _Promise((r,i)=>{try{e.instance.on("data",function(e){t+=e}),e.instance.on("end",function(){e.document.props.onRender&&e.document.props.onRender({string:t}),r(t)})}catch(t){i(t)}})}}},renderToStream=function(t){return pdf(t).toBuffer()},renderToFile=function(t,e,r){const i=renderToStream(t),o=fs.createWriteStream(e);return i.pipe(o),new _Promise((t,n)=>{o.on("finish",()=>{r&&r(i,e),t(i)}),o.on("error",n)})},throwEnvironmentError=t=>{throw new Error(`${t} is a web specific API. Or you're either using this component on Node, or your bundler is not loading react-pdf from the appropiate web build.`)},PDFViewer=()=>{throwEnvironmentError("PDFViewer")},PDFDownloadLink=()=>{throwEnvironmentError("PDFDownloadLink")},BlobProvider=()=>{throwEnvironmentError("BlobProvider")},render=renderToFile;var node={pdf:pdf,View:View,Text:Text,Link:Link,Page:Page,Font:Font,Note:Note,Image:Image,version:version,Document:Document,StyleSheet:StyleSheet,PDFRenderer:PDFRenderer,createInstance:createInstance,renderToStream:renderToStream,renderToFile:renderToFile,render:render};exports.renderToStream=renderToStream,exports.renderToFile=renderToFile,exports.PDFViewer=PDFViewer,exports.PDFDownloadLink=PDFDownloadLink,exports.BlobProvider=BlobProvider,exports.render=render,exports.default=node,exports.pdf=pdf,exports.View=View,exports.Text=Text,exports.Link=Link,exports.Page=Page,exports.Font=Font,exports.Note=Note,exports.Image=Image,exports.version=version,exports.Document=Document,exports.StyleSheet=StyleSheet,exports.PDFRenderer=PDFRenderer,exports.createInstance=createInstance;
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var _Promise=_interopDefault(require("babel-runtime/core-js/promise")),fs=_interopDefault(require("fs")),BlobStream=_interopDefault(require("blob-stream")),_Object$keys=_interopDefault(require("babel-runtime/core-js/object/keys")),ReactFiberReconciler=_interopDefault(require("react-reconciler")),emptyObject=_interopDefault(require("fbjs/lib/emptyObject")),PDFDocument=require("@react-pdf/pdfkit"),PDFDocument__default=_interopDefault(PDFDocument),wrapPages=_interopDefault(require("page-wrapping")),_extends=_interopDefault(require("babel-runtime/helpers/extends")),_objectWithoutProperties=_interopDefault(require("babel-runtime/helpers/objectWithoutProperties")),isUrl=_interopDefault(require("is-url")),fontkit=_interopDefault(require("@react-pdf/fontkit")),fetch=_interopDefault(require("isomorphic-fetch")),_Array$from=_interopDefault(require("babel-runtime/core-js/array/from")),emojiRegex=_interopDefault(require("emoji-regex")),textkitCore=require("@react-pdf/textkit-core"),scriptItemizer=_interopDefault(require("@react-pdf/script-itemizer")),justificationEngine=_interopDefault(require("@textkit/justification-engine")),textDecorationEngine=_interopDefault(require("@textkit/text-decoration-engine")),english=_interopDefault(require("hyphenation.en-us")),Hypher=_interopDefault(require("hypher")),_JSON$stringify=_interopDefault(require("babel-runtime/core-js/json/stringify")),PNG=_interopDefault(require("@react-pdf/png-js")),_Object$assign=_interopDefault(require("babel-runtime/core-js/object/assign")),react=require("react"),Yoga=_interopDefault(require("yoga-layout-prebuilt")),warning=_interopDefault(require("fbjs/lib/warning")),toPairsIn=_interopDefault(require("lodash.topairsin")),isFunction=_interopDefault(require("lodash.isfunction")),pick=_interopDefault(require("lodash.pick")),merge=_interopDefault(require("lodash.merge")),matchMedia=_interopDefault(require("media-engine")),createPDFRenderer=_interopDefault(require("@textkit/pdf-renderer"));class Root{constructor(){this.isDirty=!1,this.document=null,this.instance=null}get name(){return"Root"}appendChild(t){this.document=t}markDirty(){this.isDirty=!0}async render(){this.instance=new PDFDocument__default({autoFirstPage:!1}),await this.document.render(),this.isDirty=!1}}var standardFonts=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"];const fetchFont=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>Buffer.from(t));let emojiSource,hyphenationCallback,fonts={};const register=(t,e)=>{let{family:r}=e,i=_objectWithoutProperties(e,["family"]);fonts[r]=_extends({src:t,loaded:!1,loading:!1,data:null},i)},registerHyphenationCallback=t=>{hyphenationCallback=t},registerEmojiSource=({url:t,format:e="png"})=>{emojiSource={url:t,format:e}},getRegisteredFonts=()=>_Object$keys(fonts),getFont=t=>fonts[t],getEmojiSource=()=>emojiSource,getHyphenationCallback=()=>hyphenationCallback,load=async function(t,e){const r=fonts[t];if(r&&!r.data&&!r.loading)if(r.loading=!0,isUrl(r.src)){const t=await fetchFont(r.src);r.data=fontkit.create(t)}else r.data=fontkit.openSync(r.src);if(r&&!r.loaded&&(r.loaded=!0,r.loading=!1,e.registerFont(t,r.data)),!r&&!standardFonts.includes(t))throw new Error(`Font family not registered: ${t}. Please register it calling Font.register() method.`)},reset=function(){for(const t in fonts)fonts.hasOwnProperty(t)&&(fonts[t].loaded=!1)},clear=function(){fonts={}};var Font={register:register,getEmojiSource:getEmojiSource,getRegisteredFonts:getRegisteredFonts,registerEmojiSource:registerEmojiSource,registerHyphenationCallback:registerHyphenationCallback,getHyphenationCallback:getHyphenationCallback,getFont:getFont,load:load,clear:clear,reset:reset};class StandardFont{constructor(t){this.name=t,this.src=PDFDocument.PDFFont.open(null,t)}layout(t){const[e,r]=this.src.encode(t);return{positions:r,stringIndices:r.map((t,e)=>e),glyphs:e.map((t,e)=>{const i=this.getGlyph(parseInt(t,16));return i.advanceWidth=r[e].advanceWidth,i})}}glyphForCodePoint(t){const e=this.getGlyph(t);return e.advanceWidth=400,e}getGlyph(t){return{id:t,_font:this.src,codePoints:[t],isLigature:!1,name:this.src.font.characterToGlyph(t)}}hasGlyphForCodePoint(t){return".notdef"!==this.src.font.characterToGlyph(t)}get ascent(){return this.src.ascender}get descent(){return this.src.descender}get lineGap(){return this.src.lineGap}get unitsPerEm(){return 1e3}}var fontSubstitutionEngine=()=>({Run:t})=>(class{constructor(){this.fontCache={}}get fallbackFont(){return this.getOrCreateFont("Helvetica")}getOrCreateFont(t){if(this.fontCache[t])return this.fontCache[t];const e=new StandardFont(t);return this.fontCache[t]=e,e}shouldFallbackToFont(t,e){return!e.hasGlyphForCodePoint(t)&&this.fallbackFont.hasGlyphForCodePoint(t)}getRuns(e,r){const i=[];let o=null,n=0,s=0;for(const a of r){const r="string"==typeof a.attributes.font?this.getOrCreateFont(a.attributes.font):a.attributes.font;if(0===e.length){i.push(new t(0,0,{font:r}));break}for(const h of e.slice(a.start,a.end)){const e=h.codePointAt(),a=this.shouldFallbackToFont(e,r)?this.fallbackFont:r;a!==o&&(o&&i.push(new t(n,s,{font:o})),o=a,n=s),s+=h.length}}return n<e.length&&i.push(new t(n,e.length,{font:o})),i}});const SOFT_HYPHEN_HEX="­",hypher=new Hypher(english);var wordHyphenation=({hyphenationCallback:t})=>()=>(class{constructor(){this.cache={}}calculateParts(t){return t.includes("­")?t.split("­"):hypher.hyphenate(t)}hyphenateWord(e){if(this.cache[e])return this.cache[e];const r=t?t(e):this.calculateParts(e);return this.cache[e]=r,r}});class Node{constructor(t){this.prev=null,this.next=null,this.data=t}toString(){return this.data.toString()}}class LinkedList{constructor(){this.head=null,this.tail=null,this.listSize=0}isLinked(t){return!(t&&null===t.prev&&null===t.next&&this.tail!==t&&this.head!==t||this.isEmpty())}size(){return this.listSize}isEmpty(){return 0===this.listSize}first(){return this.head}last(){return this.last}toString(){return this.toArray().toString()}toArray(){let t=this.head;const e=[];for(;null!==t;)e.push(t),t=t.next;return e}forEach(t){let e=this.head;for(;null!==e;)t(e),e=e.next}contains(t){let e=this.head;if(!this.isLinked(t))return!1;for(;null!==e;){if(e===t)return!0;e=e.next}return!1}at(t){let e=this.head,r=0;if(t>=this.listLength||t<0)return null;for(;null!==e;){if(t===r)return e;e=e.next,r+=1}return null}insertAfter(t,e){return this.isLinked(t)?(e.prev=t,e.next=t.next,null===t.next?this.tail=e:t.next.prev=e,t.next=e,this.listSize+=1,this):this}insertBefore(t,e){return this.isLinked(t)?(e.prev=t.prev,e.next=t,null===t.prev?this.head=e:t.prev.next=e,t.prev=e,this.listSize+=1,this):this}push(t){return null===this.head?this.unshift(t):this.insertAfter(this.tail,t),this}unshift(t){return null===this.head?(this.head=t,this.tail=t,t.prev=null,t.next=null,this.listSize+=1):this.insertBefore(this.head,t),this}remove(t){return this.isLinked(t)?(null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this.listSize-=1,this):this}pop(){const t=this.tail;return this.tail.prev.next=null,this.tail=this.tail.prev,this.listSize-=1,t.prev=null,t.next=null,t}shift(){const t=this.head;return this.head.next.prev=null,this.head=this.head.next,this.listSize-=1,t.prev=null,t.next=null,t}}LinkedList.Node=Node;const linebreak=(t,e,r)=>{const i={demerits:{line:r&&r.demerits&&r.demerits.line||10,flagged:r&&r.demerits&&r.demerits.flagged||100,fitness:r&&r.demerits&&r.demerits.fitness||3e3},tolerance:r&&r.tolerance||3},o=new LinkedList,n={width:0,stretch:0,shrink:0},s=e,a=[];let h={data:{demerits:1/0}};function l(t,e,r,i,o,n,s){return{position:t,demerits:e,ratio:r,line:i,fitnessClass:o,totals:n||{width:0,stretch:0,shrink:0},previous:s}}function d(e,r,i,o){let a=n.width-i.totals.width,h=0,l=0;const d=o<s.length?s[o-1]:s[s.length-1];return"penalty"===t[r].type&&(a+=t[r].width),a<d?(h=n.stretch-i.totals.stretch)>0?(d-a)/h:linebreak.infinity:a>d?(l=n.shrink-i.totals.shrink)>0?(d-a)/l:linebreak.infinity:0}function c(e){const r={width:n.width,stretch:n.stretch,shrink:n.shrink};for(let i=e;i<t.length;i+=1)if("glue"===t[i].type)r.width+=t[i].width,r.stretch+=t[i].stretch,r.shrink+=t[i].shrink;else if("box"===t[i].type||"penalty"===t[i].type&&t[i].penalty===-linebreak.infinity&&i>e)break;return r}function u(t,e,r){let n,s,a,h,u,p=o.first(),g=null,f=0,m=0,y=[],b=0,E=0;for(;null!==p;){for(y=[{demerits:1/0},{demerits:1/0},{demerits:1/0},{demerits:1/0}];null!==p&&(g=p.next,b=p.data.line+1,((f=d(p.data.position,e,p.data,b))<-1||"penalty"===t.type&&t.penalty===-linebreak.infinity)&&o.remove(p),f>=-1&&f<=i.tolerance&&(n=100*Math.pow(Math.abs(f),3),m="penalty"===t.type&&t.penalty>=0?Math.pow(i.demerits.line+n,2)+Math.pow(t.penalty,2):"penalty"===t.type&&t.penalty!==-linebreak.infinity?Math.pow(i.demerits.line+n,2)-Math.pow(t.penalty,2):Math.pow(i.demerits.line+n,2),"penalty"===t.type&&"penalty"===r[p.data.position].type&&(m+=i.demerits.flagged*t.flagged*r[p.data.position].flagged),E=f<-.5?0:f<=.5?1:f<=1?2:3,Math.abs(E-p.data.fitnessClass)>1&&(m+=i.demerits.fitness),(m+=p.data.demerits)<y[E].demerits&&(y[E]={active:p,demerits:m,ratio:f})),!(null!==(p=g)&&p.data.line>=b)););for(s=c(e),a=0;a<y.length;a+=1)(h=y[a]).demerits<1/0&&(u=new LinkedList.Node(l(e,h.demerits,h.ratio,h.active.data.line+1,a,s,h.active)),null!==p?o.insertBefore(p,u):o.push(u))}}if(o.push(new LinkedList.Node(l(0,0,0,0,0,void 0,null))),t.forEach((t,e,r)=>{"box"===t.type?n.width+=t.width:"glue"===t.type?(e>0&&"box"===r[e-1].type&&u(t,e,r),n.width+=t.width,n.stretch+=t.stretch,n.shrink+=t.shrink):"penalty"===t.type&&t.penalty!==linebreak.infinity&&u(t,e,r)}),0!==o.size()){for(o.forEach(t=>{t.data.demerits<h.data.demerits&&(h=t)});null!==h;)a.push({position:h.data.position,ratio:h.data.ratio}),h=h.data.previous;return a.reverse()}return[]};linebreak.infinity=1e4,linebreak.glue=((t,e,r,i)=>({type:"glue",value:e,width:t,stretch:r,shrink:i})),linebreak.box=((t,e,r=!1)=>({type:"box",width:t,value:e,hyphenated:r})),linebreak.penalty=((t,e,r)=>({type:"penalty",width:t,penalty:e,flagged:r}));const INFINITY=1e4,getNextBreakpoint=(t,e,r)=>{let i=null,o=1/0;const n={width:0,stretch:0,shrink:0},s=e[Math.min(r,e.length-1)],a=t=>n.width<s?n.stretch-t.stretch>0?(s-n.width)/n.stretch:1e4:n.width>s?n.shrink-t.shrink>0?(s-n.width)/n.shrink:1e4:0;for(let e=0;e<t.length;e++){const r=t[e];if("box"===r.type?n.width+=r.width:"glue"===r.type&&(n.width+=r.width,n.stretch+=r.stretch,n.shrink+=r.shrink),n.width-n.shrink>s)break;if("penalty"===r.type||"glue"===r.type){const t=a(r),n="penalty"===r.type?r.penalty:0,s=100*Math.pow(Math.abs(t),3)+n;o>=s&&(i=e,o=s)}}return n.width-n.shrink>s?i:null},applyBestFit=(t,e)=>{let r=0,i=0,o=t;const n=[{position:0}];for(;o.length>0;){const t=getNextBreakpoint(o,e,i);t?(r+=t,n.push({position:r}),o=o.slice(t+1,o.length),r++,i++):o=[]}return n},HYPHEN=45,TOLERANCE_STEPS=5,TOLERANCE_LIMIT=50,opts={width:3,stretch:3,shrink:4};var lineBreaker=({penalty:t}={})=>()=>(class{constructor(t){this.tolerance=t||4}getNodes(e,r,{align:i}){let o=0;const n=t||("justify"===i?100:600),s=r.reduce((t,i,s)=>{const a=e.glyphIndexForStringIndex(o),h=e.glyphIndexForStringIndex(o+i.length),l=e.slice(a,h);if(""===l.string.trim()){const e=l.advanceWidth,r=e*opts.width/opts.stretch,i=e*opts.width/opts.shrink,n={value:l,start:o,end:o+l.end};t.push(linebreak.glue(e,n,r,i))}else{const e=" "!==r[s+1],i={value:l,start:o,end:o+l.end};t.push(linebreak.box(l.advanceWidth,i,e)),r[s+1]&&e&&t.push(linebreak.penalty(5,n,1))}return o+=i.length,t},[]);return s.push(linebreak.glue(0,null,linebreak.infinity,0)),s.push(linebreak.penalty(0,-linebreak.infinity,1)),s}breakLines(t,e,r){let i=0,o=null;const n=r.reduce((r,n)=>{const s=e[n.position],a=e[n.position-1];if(n.position===e.length-1)return r;let h;return"penalty"===s.type?(o=t.glyphIndexForStringIndex(a.value.end),(h=t.slice(i,o)).insertGlyph(h.length,45)):(o=t.glyphIndexForStringIndex(s.value.end),h=t.slice(i,o)),i=o,[...r,h]},[]),s=t.slice(i,t.length);return n.push(s),n}suggestLineBreak(t,e,r,i){const o=this.getNodes(t,e,i);let n=this.tolerance,s=linebreak(o,r,{tolerance:n});for(;0===s.length&&n<50;)s=linebreak(o,r,{tolerance:n+=5});return(0===s.length||1===s.length&&0===s[0].position)&&(s=applyBestFit(o,r)),this.breakLines(t,o,s.slice(1))}});const shrinkWhitespaceFactor={before:-.5,after:-.5};class LayoutEngine$1 extends textkitCore.LayoutEngine{constructor({hyphenationCallback:t,hyphenationPenalty:e}){super({scriptItemizer:scriptItemizer(),decorationEngine:textDecorationEngine(),fontSubstitutionEngine:fontSubstitutionEngine(),wordHyphenation:wordHyphenation({hyphenationCallback:t}),lineBreaker:lineBreaker({penalty:e}),justificationEngine:justificationEngine({shrinkWhitespaceFactor:shrinkWhitespaceFactor})})}}const MARKERS=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];class JPEG{constructor(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");let e,r=2;for(;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)}}const createCache=({limit:t=100}={})=>{const e={},r=[];return{get:t=>e[t],set:(i,o)=>{r.push(i),r.length>t&&delete e[r.shift()],e[i]=o},length:()=>r.length}},imagesCache=createCache({limit:30}),isValidFormat=t=>{const e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e},isCompatibleBase64=t=>/data:image\/[a-zA-Z]*;base64,[^"]*/g.test(t);function getImage(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new JPEG(t);case"png":return new PNG(t);default:return null}}const resolveBase64Image=t=>{const e=/data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(t),r=e[1],i=e[2];if(!isValidFormat(r))throw new Error(`Base64 image invalid format: ${r}`);return new _Promise(t=>t(getImage(Buffer.from(i,"base64"),r)))},resolveLocalImage=t=>{if(t.data&&t.format)return new _Promise(e=>e(getImage(t.data,t.format)));throw new Error(`Invalid data given for local file: ${_JSON$stringify(t)}`)},resolveRemoteImage=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>"Buffer"===t.constructor.name?t:Buffer.from(t)).then(t=>{const 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];let i="";if(e)i="png";else{if(!r)throw new Error("Not valid image extension");i="jpg"}return getImage(t,i)}),resolveImage=(t,e=!0)=>{if(e&&imagesCache.get(t))return imagesCache.get(t);let r;return r=isCompatibleBase64(t)?resolveBase64Image(t):"object"==typeof t?resolveLocalImage(t):resolveRemoteImage(t),e&&imagesCache.set(t,r),r},emojis={},regex=emojiRegex(),reflect=t=>(...e)=>t(...e).then(t=>t,t=>t),fetchEmojiImage=reflect(resolveImage),getCodePoints=t=>_Array$from(t).map(t=>t.codePointAt(0).toString(16)).join("-"),buildEmojiUrl=t=>{const{url:e,format:r}=Font.getEmojiSource();return`${e}${getCodePoints(t)}.${r}`},fetchEmojis=t=>{const e=Font.getEmojiSource();if(!e||!e.url)return[];const r=[];let i;for(;i=regex.exec(t);){const t=i[0];if(!emojis[t]||emojis[t].loading){const e=buildEmojiUrl(t);emojis[t]={loading:!0},r.push(fetchEmojiImage(e).then(e=>{emojis[t].loading=!1,emojis[t].data=e.data}))}}return r},embedEmojis=t=>{const e=[];for(let r=0;r<t.length;r++){const i=t[r];let o,n=0;for(;o=regex.exec(i.string);){const t=o.index,r=o[0],s=i.attributes.fontSize,a=i.string.slice(n,t+o[0].length);emojis[r]&&emojis[r].data?e.push({string:a.replace(o,textkitCore.Attachment.CHARACTER),attributes:_extends({},i.attributes,{attachment:new textkitCore.Attachment(s,s,{yOffset:Math.floor(.1*s),image:emojis[r].data})})}):e.push({string:a.replace(o,String.fromCharCode(0)),attributes:i.attributes}),n=t+r.length}n<i.string.length&&e.push({string:i.string.slice(n),attributes:i.attributes})}return e};class Document$1{constructor(t,e){this.root=t,this.props=e,this.children=[]}get name(){return"Document"}appendChild(t){t.parent=this,this.children.push(t)}removeChild(t){const e=this.children.indexOf(t);t.parent=null,this.children.slice(e,1)}addMetaData(){const{title:t,author:e,subject:r,keywords:i,creator:o,producer:n}=this.props;t&&(this.root.instance.info.Title=t),e&&(this.root.instance.info.Author=e),r&&(this.root.instance.info.Subject=r),i&&(this.root.instance.info.Keywords=i),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=n||"react-pdf"}async loadFonts(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();r.style&&r.style.fontFamily&&t.push(Font.load(r.style.fontFamily,this.root.instance)),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadEmojis(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"string"==typeof r?t.push(...fetchEmojis(r)):"string"==typeof r.value?t.push(...fetchEmojis(r.value)):r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadImages(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"Image"===r.name&&t.push(r.fetch()),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadAssets(){await _Promise.all([this.loadFonts(),this.loadImages()])}applyProps(){this.children.forEach(t=>t.applyProps())}update(t){this.props=t}async wrapPages(){let t=1;const e=[];for(const r of this.children){const i=r.size.height-(r.style.paddingBottom||0);if(r.wrap){const o=await wrapPages(r,i,t);t+=o.length,e.push(...o)}else r.height=r.size.height,e.push(r)}return e}async renderPages(){const t=await this.wrapPages();for(let e=0;e<t.length;e++)t[e].renderDynamicNodes({pageNumber:e+1,totalPages:t.length},t=>"Text"===t.name),await t[e].render();return t}async render(){try{this.addMetaData(),this.applyProps(),await this.loadEmojis(),await this.loadAssets(),await this.renderPages(),this.root.instance.end(),Font.reset()}catch(t){throw t}}}Document$1.defaultProps={author:null,keywords:null,subject:null,title:null};const upperFirst=t=>t.charAt(0).toUpperCase()+t.slice(1),matchPercent=t=>/(\d+\.?\d*)%/g.exec(t);class Node$1{constructor(){this.parent=null,this.children=[],this.computed=!1,this.layout=Yoga.Node.createDefault()}appendChild(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))}appendChildBefore(t,e){const r=this.children.indexOf(e);-1!==r&&t&&(t.parent=this,this.children.splice(r,0,t),this.layout.insertChild(t.layout,r))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout))}removeAllChilds(){const t=[...this.children];for(let e=0;e<t.length;e++)t[e].remove()}remove(){this.parent.removeChild(this)}setDimension(t,e){const r=`set${upperFirst(t)}`,i=`${r}Percent`,o=matchPercent(e);o?this.layout[i](parseFloat(o[1],10)):this.layout[r](e)}setPosition(t,e){const r=matchPercent(e);r?this.layout.setPositionPercent(t,parseFloat(r[1],10)):this.layout.setPosition(t,e)}setPadding(t,e){const r=matchPercent(e);r?this.layout.setPaddingPercent(t,parseFloat(r[1],10)):this.layout.setPadding(t,e)}setMargin(t,e){const r=matchPercent(e);r?this.layout.setMarginPercent(t,parseFloat(r[1],10)):this.layout.setMargin(t,e)}setBorder(t,e){if(matchPercent(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)}getAbsoluteLayout(){const 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}}copyStyle(t){this.layout.copyStyle(t.layout)}calculateLayout(){this.layout.calculateLayout(),this.computed=!0}isEmpty(){return 0===this.children.length}markDirty(){return this.layout.markDirty()}onAppendDynamically(){}get position(){return this.layout.getPositionType()===Yoga.POSITION_TYPE_ABSOLUTE?"absolute":"relative"}get top(){return this.layout.getComputedTop()||0}get left(){return this.layout.getComputedLeft()||0}get right(){return this.layout.getComputedRight()||0}get bottom(){return this.layout.getComputedBottom()||0}get width(){return this.layout.getComputedWidth()}get minWidth(){return this.layout.getMinWidth().value}get maxWidth(){return this.layout.getMaxWidth().value}get height(){return this.layout.getComputedHeight()}get minHeight(){return this.layout.getMinHeight().value}get maxHeight(){return this.layout.getMaxHeight().value}get paddingTop(){return this.layout.getComputedPadding(Yoga.EDGE_TOP)||0}get paddingRight(){return this.layout.getComputedPadding(Yoga.EDGE_RIGHT)||0}get paddingBottom(){return this.layout.getComputedPadding(Yoga.EDGE_BOTTOM)||0}get paddingLeft(){return this.layout.getComputedPadding(Yoga.EDGE_LEFT)||0}get marginTop(){return this.layout.getComputedMargin(Yoga.EDGE_TOP)||0}get marginRight(){return this.layout.getComputedMargin(Yoga.EDGE_RIGHT)||0}get marginBottom(){return this.layout.getComputedMargin(Yoga.EDGE_BOTTOM)||0}get marginLeft(){return this.layout.getComputedMargin(Yoga.EDGE_LEFT)||0}get borderTopWidth(){return this.layout.getComputedBorder(Yoga.EDGE_TOP)||0}get borderRightWidth(){return this.layout.getComputedBorder(Yoga.EDGE_RIGHT)||0}get borderBottomWidth(){return this.layout.getComputedBorder(Yoga.EDGE_BOTTOM)||0}get borderLeftWidth(){return this.layout.getComputedBorder(Yoga.EDGE_LEFT)||0}get padding(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}}get margin(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}}set position(t){this.layout.setPositionType("absolute"===t?Yoga.POSITION_TYPE_ABSOLUTE:Yoga.POSITION_TYPE_RELATIVE)}set top(t){this.setPosition(Yoga.EDGE_TOP,t)}set left(t){this.setPosition(Yoga.EDGE_LEFT,t)}set right(t){this.setPosition(Yoga.EDGE_RIGHT,t)}set bottom(t){this.setPosition(Yoga.EDGE_BOTTOM,t)}set width(t){this.setDimension("width",t)}set minWidth(t){this.setDimension("minWidth",t)}set maxWidth(t){this.setDimension("maxWidth",t)}set height(t){this.setDimension("height",t)}set minHeight(t){this.setDimension("minHeight",t)}set maxHeight(t){this.setDimension("maxHeight",t)}set paddingTop(t){this.setPadding(Yoga.EDGE_TOP,t)}set paddingRight(t){this.setPadding(Yoga.EDGE_RIGHT,t)}set paddingBottom(t){this.setPadding(Yoga.EDGE_BOTTOM,t)}set paddingLeft(t){this.setPadding(Yoga.EDGE_LEFT,t)}set marginTop(t){this.setMargin(Yoga.EDGE_TOP,t)}set marginRight(t){this.setMargin(Yoga.EDGE_RIGHT,t)}set marginBottom(t){this.setMargin(Yoga.EDGE_BOTTOM,t)}set marginLeft(t){this.setMargin(Yoga.EDGE_LEFT,t)}set padding(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}set margin(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}set borderTopWidth(t){this.setBorder(Yoga.EDGE_TOP,t)}set borderRightWidth(t){this.setBorder(Yoga.EDGE_RIGHT,t)}set borderBottomWidth(t){this.setBorder(Yoga.EDGE_BOTTOM,t)}set borderLeftWidth(t){this.setBorder(Yoga.EDGE_LEFT,t)}}const yogaValue=(t,e)=>{const r=t=>"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}},parseValue=t=>{const e=/^(\d*\.?\d+)(in|mm|cm|pt)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}},parseScalar=t=>{let e={};const r=parseValue(t);switch(r.unit){case"in":e=72*r.value;break;case"mm":e=r.value*(1/25.4)*72;break;case"cm":e=r.value*(1/2.54)*72;break;default:e=r.value}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}},expandStyles=t=>{if(!t)return t;const e=_Object$keys(t),r={};for(let i=0;i<e.length;i++){const o=e[i],n=t[o];switch(o){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[o]=yogaValue(o,n);break;case"textAlignVertical":r.verticalAlign="center"===n?"middle":n;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":{const t=styleShortHands[o];for(const e in t)hasOwnProperty.call(t,e)&&(r[e]=n)}break;default:r[o]=n}}return r},matchBorderShorthand=t=>t.match(/(\d+(px|in|mm|cm|pt)?)\s(\S+)\s(\S+)/),processBorders=(t,e)=>{const 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},transformStyles=t=>{const e=expandStyles(t),r=_Object$keys(e),i={};for(let t=0;t<r.length;t++){const o=r[t],n=e[o],s=o.match(/border/)&&"string"==typeof n?processBorders(o,n):n;i[o]=parseScalar(s)}return i},create=t=>t,flatten=t=>{return Array.isArray(t)||(t=[t]),t.reduce((t,e)=>(e&&_Object$keys(e).forEach(r=>{null!==e[r]&&void 0!==e[r]&&(t[r]=e[r])}),t),{})},resolveMediaQueries=(t,e)=>{return _Object$keys(t).reduce((r,i)=>/@media/.test(i)?_extends({},r,matchMedia({[i]:t[i]},e)):_extends({},r,{[i]:t[i]}),{})},resolve=(t,e)=>t?(t=flatten(t),t=resolveMediaQueries(t,e),t=transformStyles(t)):null,absoluteFillObject={position:"absolute",top:0,left:0,bottom:0,right:0};var StyleSheet={hairlineWidth:1,create:create,resolve:resolve,flatten:flatten,absoluteFillObject:absoluteFillObject};const Debug={debug(){const 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.root.instance.restore()},debugText(t,e){const r=Math.round(this.width+e.left+e.right),i=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(`${r} x ${i}`,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent(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(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(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()}},Borders={drawBorders(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),{borderTopWidth:o=0,borderRightWidth:n=0,borderBottomWidth:s=0,borderLeftWidth:a=0}=this,{borderTopLeftRadius:h=0,borderTopRightRadius:l=0,borderBottomRightRadius:d=0,borderBottomLeftRadius:c=0,borderTopColor:u="black",borderRightColor:p="black",borderBottomColor:g="black",borderLeftColor:f="black",borderTopStyle:m="solid",borderRightStyle:y="solid",borderBottomStyle:b="solid",borderLeftStyle:E="solid"}=this.getComputedStyles();this.root.instance.save(),this.drawHorizontalBorder([t+(h>0?o/2:0),e+o/2],[t+r-(l>0?o/2:0),e+o/2],h,l,o,u,m),this.drawVerticalBorder([t+r-n/2,e+(l>0?n/2:0)],[t+r-n/2,e+i-(d>0?n/2:0)],-l,-d,n,p,y),this.drawHorizontalBorder([t+r-(d>0?s/2:0),e+i-s/2],[t+(c>0?s/2:0),e+i-s/2],-d,-c,s,g,b),this.drawVerticalBorder([t+a/2,e+i-(c>0?a/2:0)],[t+a/2,e+(h>0?a/2:0)],c,h,a,f,E),this.root.instance.restore()},traceBorder(t,e){switch(t){case"dashed":this.root.instance.dash(2*e,{space:1.2*e}).stroke();break;case"dotted":this.root.instance.dash(e,{space:1.2*e}).stroke();break;default:this.root.instance.stroke()}},drawHorizontalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0],t[1]+r).quadraticCurveTo(t[0],t[1],t[0]+r,t[1]).lineTo(e[0]-i,e[1]).quadraticCurveTo(e[0],e[1],e[0],e[1]+i).strokeColor(n),this.traceBorder(s,o))},drawVerticalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0]+r,t[1]).quadraticCurveTo(t[0],t[1],t[0],t[1]-r).lineTo(e[0],e[1]+i).quadraticCurveTo(e[0],e[1],e[0]+i,e[1]).strokeColor(n),this.traceBorder(s,o))}},getRotation=t=>{const e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){const t=e[1];return"rad"===e[2]?180*t/Math.PI:t}return 0},getTranslateX=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null},applySingleTransformation=(t,e)=>{const{left:r,top:i,width:o,height:n}=t.getAbsoluteLayout(),s=[r+o/2,i+n/2];/rotate/g.test(e)?t.root.instance.rotate(getRotation(e),{origin:s}):/scaleX/g.test(e)?t.root.instance.scale(getScaleX(e),1,{origin:s}):/scaleY/g.test(e)?t.root.instance.scale(1,getScaleY(e),{origin:s}):/scale/g.test(e)?t.root.instance.scale(getScaleX(e),getScaleY(e),{origin:s}):/translateX/g.test(e)?t.root.instance.translate(getTranslateX(e),1,{origin:s}):/translateY/g.test(e)?t.root.instance.translate(1,getTranslateY(e),{origin:s}):/translate/g.test(e)?t.root.instance.translate(getTranslateX(e),getTranslateY(e),{origin:s}):/matrix/g.test(e)&&t.root.instance.transform(...getMatrix(e))},Transformations={applyTransformations(){let t;const e=/[a-zA-Z]+\([^)]+\)/g,r=this.style&&this.style.transform||"";for(;null!=(t=e.exec(r));)applySingleTransformation(this,t[0])}},inheritedProperties=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","textDecoration","lineHeight","textAlign","visibility","wordSpacing"];class Base extends Node$1{constructor(t,e){super(),this.root=t,this.props=merge({},this.constructor.defaultProps,Base.defaultProps,e),warning(!this.props.styles,'"styles" prop passed instead of "style" prop')}get page(){return this.parent.page}get wrap(){return this.props.wrap}get break(){return this.props.break}get fixed(){return this.props.fixed}get minPresenceAhead(){return this.props.minPresenceAhead}get absolute(){return"absolute"===this.props.style.position}set break(t){this.props.break=t}appendChild(t){super.appendChild(t),this.root.markDirty()}appendChildBefore(t,e){super.appendChildBefore(t,e),this.root.markDirty()}removeChild(t){super.removeChild(t),this.root.markDirty()}update(t){this.props=merge({},this.constructor.defaultProps,Base.defaultProps,t),this.root.markDirty()}applyProps(){const{size:t,orientation:e}=this.page;this.style=StyleSheet.resolve(this.props.style,{width:t.width,height:t.height,orientation:e}),toPairsIn(this.style).map(([t,e])=>{this.applyStyle(t,e)}),this.children.forEach(t=>{t.applyProps&&t.applyProps()})}applyStyle(t,e){const 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)}}getComputedStyles(){let t=this.parent,e={};for(;t&&t.parent;)e=_extends({},t.parent.style,t.style,e),t=t.parent;return _extends({},pick(e,inheritedProperties),this.style)}drawBackgroundColor(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),o=this.getComputedStyles(),n=Math.max(o.borderTopLeftRadius,o.borderTopRightRadius,o.borderBottomRightRadius,o.borderBottomLeftRadius)||0;o.backgroundColor&&this.root.instance.fillColor(o.backgroundColor).roundedRect(t,e,r,i,n).fill()}clone(){const t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t}onNodeSplit(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}async renderChildren(){const t=this.children.filter(t=>t.absolute),e=this.children.filter(t=>!t.absolute);for(let t=0;t<e.length;t++)await e[t].render();for(let e=0;e<t.length;e++)await t[e].render()}}Base.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0},minPresenceAhead:0},_Object$assign(Base.prototype,Debug),_Object$assign(Base.prototype,Borders),_Object$assign(Base.prototype,Transformations);class TextInstance{constructor(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}get name(){return"TextInstance"}remove(){this.parent.removeChild(this)}clone(){return new this.constructor(this.root,this.value)}update(t){this.value=t,this.parent.computed=!1,this.parent._container=null,this.root.markDirty()}}const 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=(t,e="portrait")=>{let r;if("string"==typeof t)r=PAGE_SIZES[t.toUpperCase()];else if(Array.isArray(t))r=t;else{if("object"!=typeof t||!t.width||!t.height)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]}},RULER_WIDTH=13,RULER_COLOR="white",RULER_FONT_SIZE=5,DEFAULT_RULER_STEPS=50,LINE_WIDTH=.5,LINE_COLOR="gray",GRID_COLOR="#ababab",range=(t,e)=>_Array$from({length:Math.ceil(t/e)},(t,r)=>r*e),matchPercentage=t=>{const e=t.match(/(\d+\.?\d*)%/);return e?100/parseFloat(e[1],10):null},Ruler={getRulerWidth:()=>13,hasHorizontalRuler(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps(){const t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.width-(this.hasVerticalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps(){const t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.height-(this.hasHorizontalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler(){const 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(){const t=this.hasVerticalRuler()?13:0;this.root.instance.rect(t,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");const e=range(this.width,this.getHorizontalSteps());e.map(e=>{this.root.instance.moveTo(t+e,0).lineTo(t+e,13).stroke("gray").fillColor("black").text(`${Math.round(e)}`,t+e+1,1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(t+e,13).lineTo(t+e,this.height).stroke("#ababab")})},drawVerticalRuler(){const t=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,t,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");const e=range(this.height,this.getVerticalSteps());e.map(e=>{this.root.instance.moveTo(0,t+e).lineTo(13,t+e).stroke("gray").fillColor("black").text(`${Math.round(e)}`,1,t+e+1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(13,t+e).lineTo(this.width,t+e).stroke("#ababab")})}};class Page$1 extends Base{constructor(t,e){super(t,e),this._size=null}get name(){return"Page"}get document(){return this.parent}get page(){return this}get orientation(){return this.props.orientation}get size(){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)}resetMargins(){(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)}applyProps(){super.applyProps(),this.top=0,this.left=0,this.width=this.size.width,this.resetMargins();const t=this.getRulerWidth();this.hasHorizontalRuler()&&(this.paddingTop=this.paddingTop+t),this.hasVerticalRuler()&&(this.paddingLeft=this.paddingLeft+t)}setPadding(t,e){const r=matchPercent(e),i=t===Yoga.EDGE_TOP||t===Yoga.EDGE_BOTTOM?this.size.height:this.size.width;if(r){const e=parseFloat(r[1],10)/100;this.layout.setPadding(t,i*e)}else this.layout.setPadding(t,e)}async addDynamicChild(t,e){if(!e)return;const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const i=r[e],{type:o,props:n}=i;if("string"==typeof i){const e=new TextInstance(this.root,i);t.appendChild(e)}else if(o!==react.Fragment){const e=createInstance(i,this.root);await e.onAppendDynamically(),t.appendChild(e),e.applyProps(),await this.addDynamicChild(e,n.children)}else await this.addDynamicChild(t,n.children)}}async renderDynamicNodes(t,e){const r=this.children.slice(0);for(;r.length>0;){const i=r.shift();if((!e||e(i))&&i.props.render){i.removeAllChilds();const e=i.props.render(t);await this.addDynamicChild(i,e),i.fixed||(i.props.render=null)}else i.children&&r.push(...i.children)}}async nodeWillWrap(t){await this.renderDynamicNodes(t),this.calculateLayout()}onNodeSplit(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()}update(t){}clone(){const t=super.clone();return t._size=this.size,t}async render(){const{instance:t}=this.root;this.height=this.size.height,this.calculateLayout(),t.addPage({size:[this.size.width,this.size.height],margin:0}),this.style.backgroundColor&&t.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,this.size.height).fill(),await this.renderChildren(),this.props.debug&&this.debug(),this.renderRuler()}}Page$1.defaultProps={size:"A4",orientation:"portrait",style:{},wrap:!0},_Object$assign(Page$1.prototype,Ruler);class View$1 extends Base{get name(){return"View"}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),await this.renderChildren(),this.props.debug&&this.debug(),this.root.instance.restore()}}View$1.defaultProps={style:{},wrap:!0};const PROTOCOL_REGEXP=/^(http|https|ftp|ftps|mailto)\:\/\//i,getURL=t=>{let e=t;return"string"!=typeof e||e.match(PROTOCOL_REGEXP)||(e=`http://${e}`),e},capitalize=t=>t.replace(/(^|\s)\S/g,t=>t.toUpperCase()),IGNORABLE_CODEPOINTS=[8232,8233],buildSubsetForFont=t=>IGNORABLE_CODEPOINTS.reduce((e,r)=>t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(r)?e:[...e,String.fromCharCode(r)],[]),ignoreChars=t=>t.map(t=>{const e=buildSubsetForFont(t.attributes.font),r=new RegExp(e.join("|"));return{string:t.string.replace(r,""),attributes:t.attributes}}),PREPROCESSORS=[ignoreChars,embedEmojis],transformText=(t,e)=>{switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return capitalize(t);default:return t}},getFragments=t=>{let e=[];const{color:r="black",fontFamily:i="Helvetica",fontSize:o=18,textAlign:n="left",position:s,top:a,bottom:h,lineHeight:l,textDecoration:d,textDecorationColor:c,textDecorationStyle:u,textTransform:p,letterSpacing:g}=t.getComputedStyles();t.children.forEach(f=>{if(null!==f.value&&void 0!==f.value){const m=Font.getFont(i),y=m?m.data:i,b=transformText(f.value,p);e.push({string:b,attributes:{font:y,color:r,fontSize:o,align:n,link:t.src,characterSpacing:g,underlineStyle:u,underline:"underline"===d,underlineColor:c||r,lineHeight:l?l*o:null,yOffset:"relative"===s?-a||h||0:null}})}else f&&e.push(...getFragments(f))});for(const t of PREPROCESSORS)e=t(e);return e},getAttributedString=t=>textkitCore.AttributedString.fromFragments(getFragments(t)).trim(),PDFRenderer$2=createPDFRenderer({Rect:textkitCore.Rect});class Text$1 extends Base{constructor(t,e){super(t,e),this.start=0,this.end=0,this.computed=!1,this._container=null,this._attributedString=null,this._layoutEngine=null,this.renderCallback=e.render,this.layout.setMeasureFunc(this.measureText.bind(this))}get name(){return"Text"}get src(){return getURL(this.props.src||this.props.href)}get attributedString(){return this._attributedString||(this._attributedString=getAttributedString(this)),this._attributedString}set attributedString(t){this._attributedString=t}get container(){const t=this._container.blocks.reduce((t,e)=>[...t,...e.lines],[]);return _extends({},this._container,{blocks:[{lines:t.splice(this.start,this.end)}]})}get lines(){return this.container?this.container.blocks.reduce((t,e)=>[...t,...e.lines],[]):[]}get linesHeight(){return this._container?this.lines.reduce((t,e)=>t+e.height,0):-1}get linesWidth(){return this._container?Math.max(...this.lines.map(t=>t.advanceWidth)):-1}get layoutEngine(){if(!this._layoutEngine){const{hyphenationPenalty:t}=this.props,e=Font.getHyphenationCallback();this._layoutEngine=new LayoutEngine$1({hyphenationCallback:e,hyphenationPenalty:t})}return this._layoutEngine}set layoutEngine(t){this._layoutEngine=t}appendChild(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this._attributedString=null,this.markDirty())}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this._attributedString=null,this.markDirty())}lineIndexAtHeight(t){let e=0;for(let r=0;r<this.lines.length;r++){const i=this.lines[r];if(e+i.height>t)return r;e+=i.height}return this.lines.length}heightAtLineIndex(t){let e=0;for(let r=0;r<t;r++){e+=this.lines[r].height}return e}layoutText(t,e){const r=e||this.page.size.height;if(!this._container||this.props.render){const e=(new textkitCore.Path).rect(0,0,t,r),i=new textkitCore.Container(e),o=this.attributedString;this.layoutEngine.layout(o,[i]),this._container=i}const i=this._container.blocks.reduce((t,e)=>t+e.lines.length,0);this.computed=!0,this.end=i+1}measureText(t,e,r,i){return e===Yoga.MEASURE_MODE_EXACTLY?(this.layoutText(t),{height:this.style.flexGrow?NaN:this.linesHeight}):e===Yoga.MEASURE_MODE_AT_MOST||i===Yoga.MEASURE_MODE_AT_MOST?(this.layoutText(t,r),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}}getComputedStyles(){const t=super.getComputedStyles();return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(t.top=t.top||this.parent.style.top,t.bottom=t.bottom||this.parent.style.bottom,t.position=t.position||"relative"),this.src&&(t.color=t.color||"blue",t.textDecoration=t.textDecoration||"underline"),t}wrapHeight(t){const{orphans:e,widows:r}=this.props,i=this.lines.length,o=t-this.paddingTop,n=this.lineIndexAtHeight(o);return i<e?t:n<e||i<e+r?0:i===e+r?this.heightAtLineIndex(e):i-n<r?t-this.heightAtLineIndex(r-1):t}onNodeSplit(t,e){const r=this.wrapHeight(t),i=this.lineIndexAtHeight(r);e.marginTop=0,e.paddingTop=0,e.start=i,e.attributedString=this.attributedString,this.height=r,this.marginBottom=0,this.paddingBottom=0,this.end=i}clone(){const t=super.clone();return t.layoutEngine=this.layoutEngine,this.props.render||this.props.fixed||(t._container=this._container),t}async render(){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);const t=this.padding,{top:e,left:r}=this.getAbsoluteLayout(),i=this.lines[0]?this.lines[0].rect.y:0;this.lines.forEach(o=>{o.rect.x+=r+t.left,o.rect.y+=e+t.top-i}),new PDFRenderer$2(this.root.instance,{outlineLines:!1}).render(this.container),this.props.debug&&this.debug(),this.root.instance.restore()}}Text$1.defaultProps={wrap:!0,widows:2,orphans:2};class Link$1 extends Base{get name(){return"Link"}get src(){return getURL(this.props.src||this.props.href)}async render(){const{top:t,left:e,width:r,height:i}=this.getAbsoluteLayout();this.root.instance.link(e,t,r,i,this.src),await this.renderChildren(),this.props.debug&&this.debug()}}class Note$1 extends Base{get name(){return"Note"}appendChild(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1))}applyProps(){super.applyProps(),this.height=0,this.width=0}async render(){const{top:t,left:e}=this.getAbsoluteLayout(),r=this.children[0]?this.children[0].value:"";this.root.instance.note(e,t,0,0,r)}}Note$1.defaultProps={};const SAFETY_HEIGHT=10;class Image$1 extends Base{constructor(t,e){super(t,e),this.image=null,this.layout.setMeasureFunc(this.measureImage.bind(this))}get name(){return"Image"}shouldGrow(){return!!this.getComputedStyles().flexGrow}measureImage(t,e,r,i){const o=this.margin,n=this.page.padding,s=this.page.size.height-n.top-n.bottom-o.top-o.bottom-SAFETY_HEIGHT;if(!this.image)return{width:0,height:0};if(e===Yoga.MEASURE_MODE_EXACTLY&&i===Yoga.MEASURE_MODE_UNDEFINED){const e=t/this.ratio;return{height:Math.min(s,e)}}if(i===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&&i===Yoga.MEASURE_MODE_AT_MOST){const e=t/this.ratio;return{height:Math.min(r,s,e)}}if(e===Yoga.MEASURE_MODE_AT_MOST&&i===Yoga.MEASURE_MODE_AT_MOST){const e=Math.min(this.image.width,t);return{width:e,height:e/this.ratio}}return{height:r,width:t}}get ratio(){return this.image.data?this.image.width/this.image.height:1}async fetch(){try{this.image=await resolveImage(this.props.src,this.props.cache)}catch(t){this.image={width:0,height:0},console.warn(t.message)}}clone(){const t=super.clone();return t.image=this.image,t}async onAppendDynamically(){await this.fetch()}async render(){const t=this.padding,{left:e,top:r}=this.getAbsoluteLayout();if(this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.image.data){const i=Math.min(this.height*this.ratio,this.width)-t.left-t.right,o=this.height-t.top-t.bottom,n=Math.max((this.width-i)/2,0);0!==i&&0!==o?this.root.instance.image(this.image.data,e+t.left+n,r+t.top,{width:i,height:o}):warning(!1,`Image with src '${this.props.src}' skipped due to invalid dimensions`)}this.props.debug&&this.debug(),this.root.instance.restore()}}Image$1.defaultProps={wrap:!1,cache:!0};const constructors={ROOT:Root,PAGE:Page$1,TEXT:Text$1,LINK:Link$1,VIEW:View$1,NOTE:Note$1,IMAGE:Image$1,DOCUMENT:Document$1,TEXT_INSTANCE:TextInstance};function createInstance(t,e){const{type:r,props:i={}}=t;if(constructors[r])return new constructors[r](e,i);throw new Error(`Invalid element of type ${r} passed to PDF renderer`)}const objectsEqual=(t,e)=>{const r=_Object$keys(t),i=_Object$keys(e);if(r.length!==i.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if("render"!==o){if("children"!==o&&t[o]!==e[o]){if("object"==typeof t[o]&&"object"==typeof e[o]&&objectsEqual(t[o],e[o]))continue;return!1}}else if(!t[o]!=!e[o])return!1}return!0},shouldReplaceLink=(t,e)=>"LINK"===t&&("string"==typeof e.children||Array.isArray(e.children)||e.render),PDFRenderer=ReactFiberReconciler({supportsMutation:!0,appendInitialChild(t,e){t.appendChild(e)},createInstance:(t,e,r)=>createInstance({type:shouldReplaceLink(t,e)?"TEXT":t,props:e},r),createTextInstance:(t,e)=>createInstance({type:"TEXT_INSTANCE",props:t},e),finalizeInitialChildren:(t,e,r)=>!1,getPublicInstance:t=>t,prepareForCommit(){},prepareUpdate:(t,e,r,i)=>!objectsEqual(r,i),resetAfterCommit(){},resetTextContent(t){},getRootHostContext:()=>emptyObject,getChildHostContext:()=>emptyObject,shouldSetTextContent:(t,e)=>!1,now:Date.now,useSyncScheduling:!0,appendChild(t,e){t.appendChild(e)},appendChildToContainer(t,e){t.appendChild(e)},insertBefore(t,e,r){t.appendChildBefore(e,r)},removeChild(t,e){t.removeChild(e)},removeChildFromContainer(t,e){t.removeChild(e)},commitTextUpdate(t,e,r){t.update(r)},commitUpdate(t,e,r,i,o){t.update(o)}});var version="1.0.0";const View="VIEW",Text="TEXT",Link="LINK",Page="PAGE",Note="NOTE",Image="IMAGE",Document="DOCUMENT",pdf=t=>{const e=createInstance({type:"ROOT"}),r=PDFRenderer.createContainer(e);function i(t){PDFRenderer.updateContainer(t,r,null)}return t&&i(t),{isDirty:function(){return e.isDirty},updateContainer:i,toBuffer:function(){return e.document.props.onRender&&e.document.props.onRender(),e.render(),e.instance},toBlob:async function(){await e.render();const t=e.instance.pipe(BlobStream());return new _Promise((r,i)=>{t.on("finish",()=>{try{const o=t.toBlob("application/pdf");e.document.props.onRender&&e.document.props.onRender({blob:o}),r(o)}catch(t){i(t)}}),t.on("error",i)})},toString:function(){let t="";return e.render(),new _Promise((r,i)=>{try{e.instance.on("data",function(e){t+=e}),e.instance.on("end",function(){e.document.props.onRender&&e.document.props.onRender({string:t}),r(t)})}catch(t){i(t)}})}}},renderToStream=function(t){return pdf(t).toBuffer()},renderToFile=function(t,e,r){const i=renderToStream(t),o=fs.createWriteStream(e);return i.pipe(o),new _Promise((t,n)=>{o.on("finish",()=>{r&&r(i,e),t(i)}),o.on("error",n)})},throwEnvironmentError=t=>{throw new Error(`${t} is a web specific API. Or you're either using this component on Node, or your bundler is not loading react-pdf from the appropiate web build.`)},PDFViewer=()=>{throwEnvironmentError("PDFViewer")},PDFDownloadLink=()=>{throwEnvironmentError("PDFDownloadLink")},BlobProvider=()=>{throwEnvironmentError("BlobProvider")},render=renderToFile;var node={pdf:pdf,View:View,Text:Text,Link:Link,Page:Page,Font:Font,Note:Note,Image:Image,version:version,Document:Document,StyleSheet:StyleSheet,PDFRenderer:PDFRenderer,createInstance:createInstance,renderToStream:renderToStream,renderToFile:renderToFile,render:render};exports.renderToStream=renderToStream,exports.renderToFile=renderToFile,exports.PDFViewer=PDFViewer,exports.PDFDownloadLink=PDFDownloadLink,exports.BlobProvider=BlobProvider,exports.render=render,exports.default=node,exports.pdf=pdf,exports.View=View,exports.Text=Text,exports.Link=Link,exports.Page=Page,exports.Font=Font,exports.Note=Note,exports.Image=Image,exports.version=version,exports.Document=Document,exports.StyleSheet=StyleSheet,exports.PDFRenderer=PDFRenderer,exports.createInstance=createInstance;
//# sourceMappingURL=react-pdf.cjs.min.js.map

@@ -1,2 +0,2 @@

import _Promise from"babel-runtime/core-js/promise";import fs from"fs";import BlobStream from"blob-stream";import _Object$keys from"babel-runtime/core-js/object/keys";import ReactFiberReconciler from"react-reconciler";import emptyObject from"fbjs/lib/emptyObject";import PDFDocument,{PDFFont}from"@react-pdf/pdfkit";import wrapPages from"page-wrapping";import _extends from"babel-runtime/helpers/extends";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import isUrl from"is-url";import fontkit from"@react-pdf/fontkit";import fetch from"isomorphic-fetch";import _Array$from from"babel-runtime/core-js/array/from";import emojiRegex from"emoji-regex";import{Attachment,AttributedString,Container,LayoutEngine,Path,Rect}from"@react-pdf/textkit-core";import scriptItemizer from"@react-pdf/script-itemizer";import justificationEngine from"@textkit/justification-engine";import textDecorationEngine from"@textkit/text-decoration-engine";import lineFragmentGenerator from"@textkit/line-fragment-generator";import createLinebreaker from"@textkit/linebreaker";import english from"hyphenation.en-us";import Hypher from"hypher";import _JSON$stringify from"babel-runtime/core-js/json/stringify";import PNG from"@react-pdf/png-js";import _Object$assign from"babel-runtime/core-js/object/assign";import{Fragment}from"react";import warning from"fbjs/lib/warning";import toPairsIn from"lodash.topairsin";import isFunction from"lodash.isfunction";import upperFirst from"lodash.upperfirst";import Yoga from"yoga-layout-prebuilt";import pick from"lodash.pick";import merge from"lodash.merge";import matchMedia from"media-engine";import createPDFRenderer from"@textkit/pdf-renderer";class Root{constructor(){this.isDirty=!1,this.document=null,this.instance=null}get name(){return"Root"}appendChild(t){this.document=t}markDirty(){this.isDirty=!0}async render(){this.instance=new PDFDocument({autoFirstPage:!1}),await this.document.render(),this.isDirty=!1}}var standardFonts=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"];const fetchFont=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>Buffer.from(t));let emojiSource,hyphenationCallback,fonts={};const register=(t,e)=>{let{family:r}=e,i=_objectWithoutProperties(e,["family"]);fonts[r]=_extends({src:t,loaded:!1,loading:!1,data:null},i)},registerHyphenationCallback=t=>{hyphenationCallback=t},registerEmojiSource=({url:t,format:e="png"})=>{emojiSource={url:t,format:e}},getRegisteredFonts=()=>_Object$keys(fonts),getFont=t=>fonts[t],getEmojiSource=()=>emojiSource,getHyphenationCallback=()=>hyphenationCallback,load=async function(t,e){const r=fonts[t];if(r&&!r.data&&!r.loading)if(r.loading=!0,isUrl(r.src)){const t=await fetchFont(r.src);r.data=fontkit.create(t)}else r.data=fontkit.openSync(r.src);if(r&&!r.loaded&&(r.loaded=!0,r.loading=!1,e.registerFont(t,r.data)),!r&&!standardFonts.includes(t))throw new Error(`Font family not registered: ${t}. Please register it calling Font.register() method.`)},reset=function(){for(const t in fonts)fonts.hasOwnProperty(t)&&(fonts[t].loaded=!1)},clear=function(){fonts={}};var Font={register:register,getEmojiSource:getEmojiSource,getRegisteredFonts:getRegisteredFonts,registerEmojiSource:registerEmojiSource,registerHyphenationCallback:registerHyphenationCallback,getHyphenationCallback:getHyphenationCallback,getFont:getFont,load:load,clear:clear,reset:reset};class StandardFont{constructor(t){this.name=t,this.src=PDFFont.open(null,t),this.glyphs={}}layout(t){const[e,r]=this.src.encode(t);return{positions:r,stringIndices:r.map((t,e)=>e),glyphs:e.map((t,e)=>{const i=this.getGlyph(parseInt(t,16));return i.advanceWidth=r[e].advanceWidth,i})}}glyphForCodePoint(t){const e=this.getGlyph(t);return e.advanceWidth=400,e}getGlyph(t){return this.glyphs[t]||(this.glyphs[t]=this.src.font.characterToGlyph(t)),{id:t,_font:this.src,name:this.glyphs[t]}}hasGlyphForCodePoint(t){return".notdef"!==this.src.font.characterToGlyph(t)}get ascent(){return this.src.ascender}get descent(){return this.src.descender}get lineGap(){return this.src.lineGap}get unitsPerEm(){return 1e3}}var fontSubstitutionEngine=()=>({Run:t})=>(class{constructor(){this.fallbackFontInstance=null}get fallbackFont(){return this.fallbackFontInstance||(this.fallbackFontInstance=new StandardFont("Helvetica")),this.fallbackFontInstance}getRuns(e,r){const i=[];let o=null,n=0,s=0;for(const a of r){let r;if(r="string"==typeof a.attributes.font?new StandardFont(a.attributes.font):a.attributes.font,0===e.length){i.push(new t(0,0,{font:r}));break}for(const h of e.slice(a.start,a.end)){const e=h.codePointAt();let a=r;!r.hasGlyphForCodePoint(e)&&this.fallbackFont.hasGlyphForCodePoint(e)&&(a=this.fallbackFont),a!==o&&(o&&i.push(new t(n,s,{font:o})),o=a,n=s),s+=h.length}}return n<e.length&&i.push(new t(n,e.length,{font:o})),i}});class Node{constructor(t){this.prev=null,this.next=null,this.data=t}toString(){return this.data.toString()}}class LinkedList{constructor(){this.head=null,this.tail=null,this.listSize=0}isLinked(t){return!(t&&null===t.prev&&null===t.next&&this.tail!==t&&this.head!==t||this.isEmpty())}size(){return this.listSize}isEmpty(){return 0===this.listSize}first(){return this.head}last(){return this.last}toString(){return this.toArray().toString()}toArray(){let t=this.head;const e=[];for(;null!==t;)e.push(t),t=t.next;return e}forEach(t){let e=this.head;for(;null!==e;)t(e),e=e.next}contains(t){let e=this.head;if(!this.isLinked(t))return!1;for(;null!==e;){if(e===t)return!0;e=e.next}return!1}at(t){let e=this.head,r=0;if(t>=this.listLength||t<0)return null;for(;null!==e;){if(t===r)return e;e=e.next,r+=1}return null}insertAfter(t,e){return this.isLinked(t)?(e.prev=t,e.next=t.next,null===t.next?this.tail=e:t.next.prev=e,t.next=e,this.listSize+=1,this):this}insertBefore(t,e){return this.isLinked(t)?(e.prev=t.prev,e.next=t,null===t.prev?this.head=e:t.prev.next=e,t.prev=e,this.listSize+=1,this):this}push(t){return null===this.head?this.unshift(t):this.insertAfter(this.tail,t),this}unshift(t){return null===this.head?(this.head=t,this.tail=t,t.prev=null,t.next=null,this.listSize+=1):this.insertBefore(this.head,t),this}remove(t){return this.isLinked(t)?(null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this.listSize-=1,this):this}pop(){const t=this.tail;return this.tail.prev.next=null,this.tail=this.tail.prev,this.listSize-=1,t.prev=null,t.next=null,t}shift(){const t=this.head;return this.head.next.prev=null,this.head=this.head.next,this.listSize-=1,t.prev=null,t.next=null,t}}LinkedList.Node=Node;const linebreak=(t,e,r)=>{const i={demerits:{line:r&&r.demerits&&r.demerits.line||10,flagged:r&&r.demerits&&r.demerits.flagged||100,fitness:r&&r.demerits&&r.demerits.fitness||3e3},tolerance:r&&r.tolerance||3},o=new LinkedList,n={width:0,stretch:0,shrink:0},s=e,a=[];let h={data:{demerits:1/0}};function l(t,e,r,i,o,n,s){return{position:t,demerits:e,ratio:r,line:i,fitnessClass:o,totals:n||{width:0,stretch:0,shrink:0},previous:s}}function d(e,r,i,o){let a=n.width-i.totals.width,h=0,l=0;const d=o<s.length?s[o-1]:s[s.length-1];return"penalty"===t[r].type&&(a+=t[r].width),a<d?(h=n.stretch-i.totals.stretch)>0?(d-a)/h:linebreak.infinity:a>d?(l=n.shrink-i.totals.shrink)>0?(d-a)/l:linebreak.infinity:0}function c(e){const r={width:n.width,stretch:n.stretch,shrink:n.shrink};for(let i=e;i<t.length;i+=1)if("glue"===t[i].type)r.width+=t[i].width,r.stretch+=t[i].stretch,r.shrink+=t[i].shrink;else if("box"===t[i].type||"penalty"===t[i].type&&t[i].penalty===-linebreak.infinity&&i>e)break;return r}function g(t,e,r){let n,s,a,h,g,p=o.first(),u=null,m=0,f=0,y=[],b=0,E=0;for(;null!==p;){for(y=[{demerits:1/0},{demerits:1/0},{demerits:1/0},{demerits:1/0}];null!==p&&(u=p.next,b=p.data.line+1,((m=d(p.data.position,e,p.data,b))<-1||"penalty"===t.type&&t.penalty===-linebreak.infinity)&&o.remove(p),m>=-1&&m<=i.tolerance&&(n=100*Math.pow(Math.abs(m),3),f="penalty"===t.type&&t.penalty>=0?Math.pow(i.demerits.line+n,2)+Math.pow(t.penalty,2):"penalty"===t.type&&t.penalty!==-linebreak.infinity?Math.pow(i.demerits.line+n,2)-Math.pow(t.penalty,2):Math.pow(i.demerits.line+n,2),"penalty"===t.type&&"penalty"===r[p.data.position].type&&(f+=i.demerits.flagged*t.flagged*r[p.data.position].flagged),E=m<-.5?0:m<=.5?1:m<=1?2:3,Math.abs(E-p.data.fitnessClass)>1&&(f+=i.demerits.fitness),(f+=p.data.demerits)<y[E].demerits&&(y[E]={active:p,demerits:f,ratio:m})),!(null!==(p=u)&&p.data.line>=b)););for(s=c(e),a=0;a<y.length;a+=1)(h=y[a]).demerits<1/0&&(g=new LinkedList.Node(l(e,h.demerits,h.ratio,h.active.data.line+1,a,s,h.active)),null!==p?o.insertBefore(p,g):o.push(g))}}if(o.push(new LinkedList.Node(l(0,0,0,0,0,void 0,null))),t.forEach((t,e,r)=>{"box"===t.type?n.width+=t.width:"glue"===t.type?(e>0&&"box"===r[e-1].type&&g(t,e,r),n.width+=t.width,n.stretch+=t.stretch,n.shrink+=t.shrink):"penalty"===t.type&&t.penalty!==linebreak.infinity&&g(t,e,r)}),0!==o.size()){for(o.forEach(t=>{t.data.demerits<h.data.demerits&&(h=t)});null!==h;)a.push({position:h.data.position,ratio:h.data.ratio}),h=h.data.previous;return a.reverse()}return[]};linebreak.infinity=1e4,linebreak.glue=((t,e,r)=>({type:"glue",width:t,stretch:e,shrink:r})),linebreak.box=((t,e,r=!1)=>({type:"box",width:t,value:e,hyphenated:r})),linebreak.penalty=((t,e,r)=>({type:"penalty",width:t,penalty:e,flagged:r}));const SOFT_HYPHEN_HEX="­",NO_BREAK_SPACE_DECIMAL=160,getWords=t=>{const e=[],{start:r}=t;let i=0;for(const o of t){const{index:n}=o;if(160!==t.codePointAtGlyphIndex(n)&&t.isWhiteSpace(n-r)){const o=t.slice(i,n-r);o.length>0&&e.push(o),i=n-r+1}}if(i<t.end){const r=t.slice(i,t.end-t.start);e.push(r)}return e},h=new Hypher(english),hyphenateString=t=>t.includes("­")?t.split("­"):h.hyphenate(t),hyphenateWord=t=>{let e=0;return hyphenateString(t.string).map(r=>{const i=t.slice(e,e+r.length);return e+=r.length,i})},hyphenate=t=>t.map(t=>hyphenateWord(t)),formatter=(t,e,r,i)=>{const o=t(" "),n=t("-"),s=i||(e&&"justify"!==e?600:100),a=3,h=6,l=9;return e=>{const i=[],d=getWords(e),c=o*a/h,g=o*a/l;return(r||hyphenate)(d,e).forEach((e,r,a)=>{e.length>1?e.forEach((r,o,a)=>{const h=o===e.length-1;i.push(linebreak.box(t(r),r,!h)),o!==a.length-1&&i.push(linebreak.penalty(n,s,1))}):i.push(linebreak.box(t(e[0]),e[0])),r===a.length-1?(i.push(linebreak.glue(0,linebreak.infinity,0)),i.push(linebreak.penalty(0,-linebreak.infinity,1))):i.push(linebreak.glue(o,c,g))}),i}},HYPHEN=45,TOLERANCE_STEPS=5,TOLERANCE_LIMIT=40;var lineBreaker=({callback:t,penalty:e}={})=>r=>{const i=new(createLinebreaker()(r));return class{constructor(t){this.tolerance=t||4}suggestLineBreak(r,o,n){let s=this.tolerance;const a=this.measureWidth(r),h=formatter(a,n.align,t,e)(r);let l=[];for(;0===l.length&&s<40;)l=linebreak(h,[o],{tolerance:s}),s+=5;if(0===l.length){const t=i.suggestLineBreak(r,o,n);if(t)return t;const e=r.glyphIndexAtOffset(o)-1;return r.insertGlyph(e,45),{position:e+1}}if(!l[1])return{position:r.end};const d=this.findBreakNode(h,l[1].position),c=d.value.end-r.start;return d.hyphenated?(r.insertGlyph(c,45),{position:c+1}):{position:c+(r.isWhiteSpace(c)?1:0)}}measureWidth(t){const{font:e,fontSize:r}=t.glyphRuns[0].attributes;return t=>{if("string"==typeof t){const i=r/e.unitsPerEm;return e.layout(t).positions[0].xAdvance*i}return t.advanceWidth}}findBreakNode(t,e){let r=e-1;for(;!t[r].value;)r-=1;return t[r]}}};const shrinkWhitespaceFactor={before:-.5,after:-.5};class LayoutEngine$1 extends LayoutEngine{constructor({hyphenationCallback:t,hyphenationPenalty:e}){super({scriptItemizer:scriptItemizer(),decorationEngine:textDecorationEngine(),lineFragmentGenerator:lineFragmentGenerator(),fontSubstitutionEngine:fontSubstitutionEngine(),justificationEngine:justificationEngine({shrinkWhitespaceFactor:shrinkWhitespaceFactor}),lineBreaker:lineBreaker({callback:t,penalty:e})})}}const MARKERS=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];class JPEG{constructor(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");let e,r=2;for(;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)}}const createCache=({limit:t=100}={})=>{const e={},r=[];return{get:t=>e[t],set:(i,o)=>{r.push(i),r.length>t&&delete e[r.shift()],e[i]=o},length:()=>r.length}},imagesCache=createCache({limit:30}),isValidFormat=t=>{const e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e},isCompatibleBase64=t=>/data:image\/[a-zA-Z]*;base64,[^"]*/g.test(t);function getImage(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new JPEG(t);case"png":return new PNG(t);default:return null}}const resolveBase64Image=t=>{const e=/data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(t),r=e[1],i=e[2];if(!isValidFormat(r))throw new Error(`Base64 image invalid format: ${r}`);return new _Promise(t=>t(getImage(Buffer.from(i,"base64"),r)))},resolveLocalImage=t=>{if(t.data&&t.format)return new _Promise(e=>e(getImage(t.data,t.format)));throw new Error(`Invalid data given for local file: ${_JSON$stringify(t)}`)},resolveRemoteImage=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>"Buffer"===t.constructor.name?t:Buffer.from(t)).then(t=>{const 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];let i="";if(e)i="png";else{if(!r)throw new Error("Not valid image extension");i="jpg"}return getImage(t,i)}),resolveImage=(t,e=!0)=>{if(e&&imagesCache.get(t))return imagesCache.get(t);let r;return r=isCompatibleBase64(t)?resolveBase64Image(t):"object"==typeof t?resolveLocalImage(t):resolveRemoteImage(t),e&&imagesCache.set(t,r),r},emojis={},regex=emojiRegex(),reflect=t=>(...e)=>t(...e).then(t=>t,t=>t),fetchEmojiImage=reflect(resolveImage),getCodePoints=t=>_Array$from(t).map(t=>t.codePointAt(0).toString(16)).join("-"),buildEmojiUrl=t=>{const{url:e,format:r}=Font.getEmojiSource();return`${e}${getCodePoints(t)}.${r}`},fetchEmojis=t=>{const e=Font.getEmojiSource();if(!e||!e.url)return[];const r=[];let i;for(;i=regex.exec(t);){const t=i[0];if(!emojis[t]||emojis[t].loading){const e=buildEmojiUrl(t);emojis[t]={loading:!0},r.push(fetchEmojiImage(e).then(e=>{emojis[t].loading=!1,emojis[t].data=e.data}))}}return r},embedEmojis=t=>{const e=[];for(let r=0;r<t.length;r++){const i=t[r];let o,n=0;for(;o=regex.exec(i.string);){const t=o.index,r=o[0],s=i.attributes.fontSize,a=i.string.slice(n,t+o[0].length);emojis[r]&&emojis[r].data?e.push({string:a.replace(o,Attachment.CHARACTER),attributes:_extends({},i.attributes,{attachment:new Attachment(s,s,{yOffset:Math.floor(.1*s),image:emojis[r].data})})}):e.push({string:a.replace(o,String.fromCharCode(0)),attributes:i.attributes}),n=t+r.length}n<i.string.length&&e.push({string:i.string.slice(n),attributes:i.attributes})}return e};class Document$1{constructor(t,e){this.root=t,this.props=e,this.children=[]}get name(){return"Document"}appendChild(t){t.parent=this,this.children.push(t)}removeChild(t){const e=this.children.indexOf(t);t.parent=null,this.children.slice(e,1)}addMetaData(){const{title:t,author:e,subject:r,keywords:i,creator:o,producer:n}=this.props;t&&(this.root.instance.info.Title=t),e&&(this.root.instance.info.Author=e),r&&(this.root.instance.info.Subject=r),i&&(this.root.instance.info.Keywords=i),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=n||"react-pdf"}async loadFonts(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();r.style&&r.style.fontFamily&&t.push(Font.load(r.style.fontFamily,this.root.instance)),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadEmojis(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"string"==typeof r?t.push(...fetchEmojis(r)):"string"==typeof r.value?t.push(...fetchEmojis(r.value)):r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadImages(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"Image"===r.name&&t.push(r.fetch()),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadAssets(){await _Promise.all([this.loadFonts(),this.loadImages()])}applyProps(){this.children.forEach(t=>t.applyProps())}update(t){this.props=t}async wrapPages(){let t=1;const e=[];for(const r of this.children){const i=r.size.height-(r.style.paddingBottom||0);if(r.wrap){const o=await wrapPages(r,i,t);t+=o.length,e.push(...o)}else r.height=r.size.height,e.push(r)}return e}async renderPages(){const t=await this.wrapPages();for(let e=0;e<t.length;e++)t[e].renderDynamicNodes({pageNumber:e+1,totalPages:t.length},t=>"Text"===t.name),await t[e].render();return t}async render(){try{this.addMetaData(),this.applyProps(),await this.loadEmojis(),await this.loadAssets(),await this.renderPages(),this.root.instance.end(),Font.reset()}catch(t){throw t}}}Document$1.defaultProps={author:null,keywords:null,subject:null,title:null};const PERCENT=/^(\d+)?%$/g;class Node$1{constructor(){this.parent=null,this.children=[],this.computed=!1,this.layout=Yoga.Node.createDefault()}appendChild(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout))}removeAllChilds(){const t=[...this.children];for(let e=0;e<t.length;e++)t[e].remove()}remove(){this.parent.removeChild(this)}setDimension(t,e){const r=`set${upperFirst(t)}`,i=`${r}Percent`,o=PERCENT.exec(e);o?this.layout[i](parseInt(o[1],10)):this.layout[r](e)}setPosition(t,e){const r=PERCENT.exec(e);r?this.layout.setPositionPercent(t,parseInt(r[1],10)):this.layout.setPosition(t,e)}setPadding(t,e){const r=PERCENT.exec(e);r?this.layout.setPaddingPercent(t,parseInt(r[1],10)):this.layout.setPadding(t,e)}setMargin(t,e){const r=PERCENT.exec(e);r?this.layout.setMarginPercent(t,parseInt(r[1],10)):this.layout.setMargin(t,e)}setBorder(t,e){if(PERCENT.exec(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)}getAbsoluteLayout(){const 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}}copyStyle(t){this.layout.copyStyle(t.layout)}calculateLayout(){this.layout.calculateLayout(),this.computed=!0}isEmpty(){return 0===this.children.length}markDirty(){return this.layout.markDirty()}onAppendDynamically(){}get position(){return this.layout.getPositionType()===Yoga.POSITION_TYPE_ABSOLUTE?"absolute":"relative"}get top(){return this.layout.getComputedTop()||0}get left(){return this.layout.getComputedLeft()||0}get right(){return this.layout.getComputedRight()||0}get bottom(){return this.layout.getComputedBottom()||0}get width(){return this.layout.getComputedWidth()}get minWidth(){return this.layout.getMinWidth().value}get maxWidth(){return this.layout.getMaxWidth().value}get height(){return this.layout.getComputedHeight()}get minHeight(){return this.layout.getMinHeight().value}get maxHeight(){return this.layout.getMaxHeight().value}get paddingTop(){return this.layout.getComputedPadding(Yoga.EDGE_TOP)||0}get paddingRight(){return this.layout.getComputedPadding(Yoga.EDGE_RIGHT)||0}get paddingBottom(){return this.layout.getComputedPadding(Yoga.EDGE_BOTTOM)||0}get paddingLeft(){return this.layout.getComputedPadding(Yoga.EDGE_LEFT)||0}get marginTop(){return this.layout.getComputedMargin(Yoga.EDGE_TOP)||0}get marginRight(){return this.layout.getComputedMargin(Yoga.EDGE_RIGHT)||0}get marginBottom(){return this.layout.getComputedMargin(Yoga.EDGE_BOTTOM)||0}get marginLeft(){return this.layout.getComputedMargin(Yoga.EDGE_LEFT)||0}get borderTopWidth(){return this.layout.getComputedBorder(Yoga.EDGE_TOP)||0}get borderRightWidth(){return this.layout.getComputedBorder(Yoga.EDGE_RIGHT)||0}get borderBottomWidth(){return this.layout.getComputedBorder(Yoga.EDGE_BOTTOM)||0}get borderLeftWidth(){return this.layout.getComputedBorder(Yoga.EDGE_LEFT)||0}get padding(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}}get margin(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}}set position(t){this.layout.setPositionType("absolute"===t?Yoga.POSITION_TYPE_ABSOLUTE:Yoga.POSITION_TYPE_RELATIVE)}set top(t){this.setPosition(Yoga.EDGE_TOP,t)}set left(t){this.setPosition(Yoga.EDGE_LEFT,t)}set right(t){this.setPosition(Yoga.EDGE_RIGHT,t)}set bottom(t){this.setPosition(Yoga.EDGE_BOTTOM,t)}set width(t){this.setDimension("width",t)}set minWidth(t){this.setDimension("minWidth",t)}set maxWidth(t){this.setDimension("maxWidth",t)}set height(t){this.setDimension("height",t)}set minHeight(t){this.setDimension("minHeight",t)}set maxHeight(t){this.setDimension("maxHeight",t)}set paddingTop(t){this.setPadding(Yoga.EDGE_TOP,t)}set paddingRight(t){this.setPadding(Yoga.EDGE_RIGHT,t)}set paddingBottom(t){this.setPadding(Yoga.EDGE_BOTTOM,t)}set paddingLeft(t){this.setPadding(Yoga.EDGE_LEFT,t)}set marginTop(t){this.setMargin(Yoga.EDGE_TOP,t)}set marginRight(t){this.setMargin(Yoga.EDGE_RIGHT,t)}set marginBottom(t){this.setMargin(Yoga.EDGE_BOTTOM,t)}set marginLeft(t){this.setMargin(Yoga.EDGE_LEFT,t)}set padding(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}set margin(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}set borderTopWidth(t){this.setBorder(Yoga.EDGE_TOP,t)}set borderRightWidth(t){this.setBorder(Yoga.EDGE_RIGHT,t)}set borderBottomWidth(t){this.setBorder(Yoga.EDGE_BOTTOM,t)}set borderLeftWidth(t){this.setBorder(Yoga.EDGE_LEFT,t)}}const yogaValue=(t,e)=>{const r=t=>"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}},parseValue=t=>{const e=/^(\d*\.?\d+)(in|mm|cm|pt)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}},parseScalar=t=>{let e={};const r=parseValue(t);switch(r.unit){case"in":e=72*r.value;break;case"mm":e=r.value*(1/25.4)*72;break;case"cm":e=r.value*(1/2.54)*72;break;default:e=r.value}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}},expandStyles=t=>{if(!t)return t;const e=_Object$keys(t),r={};for(let i=0;i<e.length;i++){const o=e[i],n=t[o];switch(o){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[o]=yogaValue(o,n);break;case"textAlignVertical":r.verticalAlign="center"===n?"middle":n;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":{const t=styleShortHands[o];for(const e in t)hasOwnProperty.call(t,e)&&(r[e]=n)}break;default:r[o]=n}}return r},matchBorderShorthand=t=>t.match(/(\d+(px|in|mm|cm|pt)?)\s(\S+)\s(\S+)/),processBorders=(t,e)=>{const 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},transformStyles=t=>{const e=expandStyles(t),r=_Object$keys(e),i={};for(let t=0;t<r.length;t++){const o=r[t],n=e[o],s=o.match(/border/)&&"string"==typeof n?processBorders(o,n):n;i[o]=parseScalar(s)}return i},create=t=>t,flatten=t=>{return Array.isArray(t)||(t=[t]),t.reduce((t,e)=>(e&&_Object$keys(e).forEach(r=>{null!==e[r]&&void 0!==e[r]&&(t[r]=e[r])}),t),{})},resolveMediaQueries=(t,e)=>{return _Object$keys(t).reduce((r,i)=>/@media/.test(i)?_extends({},r,matchMedia({[i]:t[i]},e)):_extends({},r,{[i]:t[i]}),{})},resolve=(t,e)=>t?(t=flatten(t),t=resolveMediaQueries(t,e),t=transformStyles(t)):null,absoluteFillObject={position:"absolute",top:0,left:0,bottom:0,right:0};var StyleSheet={hairlineWidth:1,create:create,resolve:resolve,flatten:flatten,absoluteFillObject:absoluteFillObject};const Debug={debug(){const 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.root.instance.restore()},debugText(t,e){const r=Math.round(this.width+e.left+e.right),i=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(`${r} x ${i}`,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent(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(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(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()}},Borders={drawBorders(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),{borderTopWidth:o=0,borderRightWidth:n=0,borderBottomWidth:s=0,borderLeftWidth:a=0}=this,{borderTopLeftRadius:h=0,borderTopRightRadius:l=0,borderBottomRightRadius:d=0,borderBottomLeftRadius:c=0,borderTopColor:g="black",borderRightColor:p="black",borderBottomColor:u="black",borderLeftColor:m="black",borderTopStyle:f="solid",borderRightStyle:y="solid",borderBottomStyle:b="solid",borderLeftStyle:E="solid"}=this.getComputedStyles();this.root.instance.save(),this.drawHorizontalBorder([t+(h>0?o/2:0),e+o/2],[t+r-(l>0?o/2:0),e+o/2],h,l,o,g,f),this.drawVerticalBorder([t+r-n/2,e+(l>0?n/2:0)],[t+r-n/2,e+i-(d>0?n/2:0)],-l,-d,n,p,y),this.drawHorizontalBorder([t+r-(d>0?s/2:0),e+i-s/2],[t+(c>0?s/2:0),e+i-s/2],-d,-c,s,u,b),this.drawVerticalBorder([t+a/2,e+i-(c>0?a/2:0)],[t+a/2,e+(h>0?a/2:0)],c,h,a,m,E),this.root.instance.restore()},traceBorder(t,e){switch(t){case"dashed":this.root.instance.dash(2*e,{space:1.2*e}).stroke();break;case"dotted":this.root.instance.dash(e,{space:1.2*e}).stroke();break;default:this.root.instance.stroke()}},drawHorizontalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0],t[1]+r).quadraticCurveTo(t[0],t[1],t[0]+r,t[1]).lineTo(e[0]-i,e[1]).quadraticCurveTo(e[0],e[1],e[0],e[1]+i).strokeColor(n),this.traceBorder(s,o))},drawVerticalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0]+r,t[1]).quadraticCurveTo(t[0],t[1],t[0],t[1]-r).lineTo(e[0],e[1]+i).quadraticCurveTo(e[0],e[1],e[0]+i,e[1]).strokeColor(n),this.traceBorder(s,o))}},getRotation=t=>{const e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){const t=e[1];return"rad"===e[2]?180*t/Math.PI:t}return 0},getTranslateX=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null},applySingleTransformation=(t,e)=>{const{left:r,top:i,width:o,height:n}=t.getAbsoluteLayout(),s=[r+o/2,i+n/2];/rotate/g.test(e)?t.root.instance.rotate(getRotation(e),{origin:s}):/scaleX/g.test(e)?t.root.instance.scale(getScaleX(e),1,{origin:s}):/scaleY/g.test(e)?t.root.instance.scale(1,getScaleY(e),{origin:s}):/scale/g.test(e)?t.root.instance.scale(getScaleX(e),getScaleY(e),{origin:s}):/translateX/g.test(e)?t.root.instance.translate(getTranslateX(e),1,{origin:s}):/translateY/g.test(e)?t.root.instance.translate(1,getTranslateY(e),{origin:s}):/translate/g.test(e)?t.root.instance.translate(getTranslateX(e),getTranslateY(e),{origin:s}):/matrix/g.test(e)&&t.root.instance.transform(...getMatrix(e))},Transformations={applyTransformations(){let t;const e=/[a-zA-Z]+\([^)]+\)/g,r=this.style&&this.style.transform||"";for(;null!=(t=e.exec(r));)applySingleTransformation(this,t[0])}},inheritedProperties=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","textDecoration","lineHeight","textAlign","visibility","wordSpacing"];class Base extends Node$1{constructor(t,e){super(),this.root=t,this.props=merge({},this.constructor.defaultProps,Base.defaultProps,e),warning(!this.props.styles,'"styles" prop passed instead of "style" prop')}get page(){return this.parent.page}get wrap(){return this.props.wrap}get break(){return this.props.break}get fixed(){return this.props.fixed}get minPresenceAhead(){return this.props.minPresenceAhead}get absolute(){return"absolute"===this.props.style.position}set break(t){this.props.break=t}applyProps(){const{size:t,orientation:e}=this.page;this.style=StyleSheet.resolve(this.props.style,{width:t.width,height:t.height,orientation:e}),toPairsIn(this.style).map(([t,e])=>{this.applyStyle(t,e)}),this.children.forEach(t=>{t.applyProps&&t.applyProps()})}applyStyle(t,e){const 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)}}getComputedStyles(){let t=this.parent,e={};for(;t&&t.parent;)e=_extends({},t.parent.style,t.style,e),t=t.parent;return _extends({},pick(e,inheritedProperties),this.style)}drawBackgroundColor(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),o=this.getComputedStyles(),n=Math.max(o.borderTopLeftRadius,o.borderTopRightRadius,o.borderBottomRightRadius,o.borderBottomLeftRadius)||0;o.backgroundColor&&this.root.instance.fillColor(o.backgroundColor).roundedRect(t,e,r,i,n).fill()}clone(){const t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t}onNodeSplit(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}update(t){this.props=merge({},this.constructor.defaultProps,Base.defaultProps,t),this.root.markDirty()}async renderChildren(){const t=this.children.filter(t=>t.absolute),e=this.children.filter(t=>!t.absolute);for(let t=0;t<e.length;t++)await e[t].render();for(let e=0;e<t.length;e++)await t[e].render()}}Base.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0},minPresenceAhead:0},_Object$assign(Base.prototype,Debug),_Object$assign(Base.prototype,Borders),_Object$assign(Base.prototype,Transformations);class TextInstance{constructor(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}get name(){return"TextInstance"}remove(){this.parent.removeChild(this)}clone(){return new this.constructor(this.root,this.value)}update(t){this.value=t,this.parent.computed=!1,this.parent._container=null,this.root.markDirty()}}const 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=(t,e="portrait")=>{let r;if("string"==typeof t)r=PAGE_SIZES[t.toUpperCase()];else if(Array.isArray(t))r=t;else{if("object"!=typeof t||!t.width||!t.height)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]}},RULER_WIDTH=13,RULER_COLOR="white",RULER_FONT_SIZE=5,DEFAULT_RULER_STEPS=50,LINE_WIDTH=.5,LINE_COLOR="gray",GRID_COLOR="#ababab",range=(t,e)=>_Array$from({length:Math.ceil(t/e)},(t,r)=>r*e),matchPercentage=t=>{const e=t.match(/(\d+\.?\d*)%/);return e?100/parseFloat(e[1],10):null},Ruler={getRulerWidth:()=>13,hasHorizontalRuler(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps(){const t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.width-(this.hasVerticalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps(){const t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.height-(this.hasHorizontalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler(){const 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(){const t=this.hasVerticalRuler()?13:0;this.root.instance.rect(t,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");const e=range(this.width,this.getHorizontalSteps());e.map(e=>{this.root.instance.moveTo(t+e,0).lineTo(t+e,13).stroke("gray").fillColor("black").text(`${Math.round(e)}`,t+e+1,1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(t+e,13).lineTo(t+e,this.height).stroke("#ababab")})},drawVerticalRuler(){const t=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,t,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");const e=range(this.height,this.getVerticalSteps());e.map(e=>{this.root.instance.moveTo(0,t+e).lineTo(13,t+e).stroke("gray").fillColor("black").text(`${Math.round(e)}`,1,t+e+1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(13,t+e).lineTo(this.width,t+e).stroke("#ababab")})}};class Page$1 extends Base{constructor(t,e){super(t,e),this._size=null}get name(){return"Page"}get document(){return this.parent}get page(){return this}get orientation(){return this.props.orientation}get size(){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)}resetMargins(){(this.style.marginTop||this.style.marginBottom||this.style.marginLeft||this.style.marginRight)&&(warning(!1,"Margin values are not allowed on Page element. Use padding instead."),this.style.marginTop=0,this.style.marginBottom=0,this.style.marginLeft=0,this.style.marginRight=0)}applyProps(){this.top=0,this.left=0,this.style=StyleSheet.resolve(this.props.style),this.resetMargins(),this.layout.setWidth(this.size.width);const t=this.getRulerWidth(),{paddingTop:e=0,paddingLeft:r=0}=this.style;this.hasHorizontalRuler()&&(this.style.paddingTop=e+t),this.hasVerticalRuler()&&(this.style.paddingLeft=r+t),super.applyProps()}async addDynamicChild(t,e){if(!e)return;const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const i=r[e],{type:o,props:n}=i;if("string"==typeof i){const e=new TextInstance(this.root,i);t.appendChild(e)}else if(o!==Fragment){const e=createInstance(i,this.root);await e.onAppendDynamically(),t.appendChild(e),e.applyProps(),await this.addDynamicChild(e,n.children)}else await this.addDynamicChild(t,n.children)}}async renderDynamicNodes(t,e){const r=this.children.slice(0);for(;r.length>0;){const i=r.shift();if((!e||e(i))&&i.props.render){i.removeAllChilds();const e=i.props.render(t);await this.addDynamicChild(i,e),i.fixed||(i.props.render=null)}else i.children&&r.push(...i.children)}}async nodeWillWrap(t){await this.renderDynamicNodes(t),this.calculateLayout()}onNodeSplit(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()}update(t){}clone(){const t=super.clone();return t._size=this.size,t}async render(){const{instance:t}=this.root;this.height=this.size.height,this.calculateLayout(),t.addPage({size:[this.size.width,this.size.height],margin:0}),this.style.backgroundColor&&t.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,this.size.height).fill(),await this.renderChildren(),this.props.debug&&this.debug(),this.renderRuler()}}Page$1.defaultProps={size:"A4",orientation:"portrait",style:{},wrap:!0},_Object$assign(Page$1.prototype,Ruler);class View$1 extends Base{get name(){return"View"}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),await this.renderChildren(),this.props.debug&&this.debug(),this.root.instance.restore()}}View$1.defaultProps={style:{},wrap:!0};const PROTOCOL_REGEXP=/^(http|https|ftp|ftps|mailto)\:\/\//i,getURL=t=>{let e=t;return"string"!=typeof e||e.match(PROTOCOL_REGEXP)||(e=`http://${e}`),e},IGNORABLE_CODEPOINTS=[8232,8233],buildSubsetForFont=t=>IGNORABLE_CODEPOINTS.reduce((e,r)=>t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(r)?e:[...e,String.fromCharCode(r)],[]),ignoreChars=t=>t.map(t=>{const e=buildSubsetForFont(t.attributes.font),r=new RegExp(e.join("|"));return{string:t.string.replace(r,""),attributes:t.attributes}}),PREPROCESSORS=[ignoreChars,embedEmojis],transformText=(t,e)=>{switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return upperFirst(t);default:return t}},getFragments=t=>{let e=[];const{color:r="black",fontFamily:i="Helvetica",fontSize:o=18,textAlign:n="left",position:s,top:a,bottom:h,lineHeight:l,textDecoration:d,textDecorationColor:c,textDecorationStyle:g,textTransform:p,letterSpacing:u}=t.getComputedStyles();t.children.forEach(m=>{if(null!==m.value&&void 0!==m.value){const f=Font.getFont(i),y=f?f.data:i,b=transformText(m.value,p);e.push({string:b,attributes:{font:y,color:r,fontSize:o,align:n,link:t.src,characterSpacing:u,underlineStyle:g,underline:"underline"===d,underlineColor:c||r,lineHeight:l?l*o:null,yOffset:"relative"===s?-a||h||0:null}})}else m&&e.push(...getFragments(m))});for(const t of PREPROCESSORS)e=t(e);return e},getAttributedString=t=>AttributedString.fromFragments(getFragments(t)).trim(),INFINITY=999999,PDFRenderer$2=createPDFRenderer({Rect:Rect});class Text$1 extends Base{constructor(t,e){super(t,e),this.start=0,this.end=0,this.computed=!1,this._container=null,this._attributedString=null,this._layoutEngine=null,this.renderCallback=e.render,this.layout.setMeasureFunc(this.measureText.bind(this))}get name(){return"Text"}get src(){return getURL(this.props.src||this.props.href)}get attributedString(){return this._attributedString||(this._attributedString=getAttributedString(this)),this._attributedString}set attributedString(t){this._attributedString=t}get container(){const t=this._container.blocks.reduce((t,e)=>[...t,...e.lines],[]);return _extends({},this._container,{blocks:[{lines:t.splice(this.start,this.end)}]})}get lines(){return this.container?this.container.blocks.reduce((t,e)=>[...t,...e.lines],[]):[]}get linesHeight(){return this._container?this.lines.reduce((t,e)=>t+e.height,0):-1}get linesWidth(){return this._container?Math.max(...this.lines.map(t=>t.advanceWidth)):-1}get layoutEngine(){if(!this._layoutEngine){const{hyphenationPenalty:t}=this.props,e=Font.getHyphenationCallback();this._layoutEngine=new LayoutEngine$1({hyphenationCallback:e,hyphenationPenalty:t})}return this._layoutEngine}set layoutEngine(t){this._layoutEngine=t}appendChild(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this._attributedString=null,this.markDirty())}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this._attributedString=null,this.markDirty())}lineIndexAtHeight(t){let e=0;for(let r=0;r<this.lines.length;r++){const i=this.lines[r];if(e+i.height>t)return r;e+=i.height}return this.lines.length}heightAtLineIndex(t){let e=0;for(let r=0;r<t;r++){e+=this.lines[r].height}return e}layoutText(t,e){if(e=e||INFINITY,!this._container||this.props.render){const r=(new Path).rect(0,0,t,e),i=new Container(r),o=this.attributedString;this.layoutEngine.layout(o,[i]),this._container=i}const r=this._container.blocks.reduce((t,e)=>t+e.lines.length,0);this.computed=!0,this.end=r+1}measureText(t,e,r,i){return e===Yoga.MEASURE_MODE_EXACTLY?(this.layoutText(t),{height:this.style.flexGrow?NaN:this.linesHeight}):e===Yoga.MEASURE_MODE_AT_MOST||i===Yoga.MEASURE_MODE_AT_MOST?(this.layoutText(t,r),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}}getComputedStyles(){const t=super.getComputedStyles();return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(t.top=t.top||this.parent.style.top,t.bottom=t.bottom||this.parent.style.bottom,t.position=t.position||"relative"),this.src&&(t.color=t.color||"blue",t.textDecoration=t.textDecoration||"underline"),t}wrapHeight(t){const{orphans:e,widows:r}=this.props,i=this.lines.length,o=t-this.paddingTop,n=this.lineIndexAtHeight(o);return i<e?t:n<e||i<e+r?0:i===e+r?this.heightAtLineIndex(e-1):i-n<r?t-this.heightAtLineIndex(r-1):t}onNodeSplit(t,e){const r=this.wrapHeight(t),i=this.lineIndexAtHeight(r),o=this.lines[i-1];e.marginTop=0,e.paddingTop=0,e.start=i,e.attributedString=this.attributedString.slice(o?o.stringEnd:0,this.attributedString.length),this.height=r,this.marginBottom=0,this.paddingBottom=0,this.end=i}clone(){const t=super.clone();return t.layoutEngine=this.layoutEngine,this.props.render||this.props.fixed||(t._container=this._container),t}async render(){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);const t=this.padding,{top:e,left:r}=this.getAbsoluteLayout(),i=this.lines[0]?this.lines[0].rect.y:0;this.lines.forEach(o=>{o.rect.x+=r+t.left,o.rect.y+=e+t.top-i}),new PDFRenderer$2(this.root.instance,{outlineLines:!1}).render(this.container),this.props.debug&&this.debug(),this.root.instance.restore()}}Text$1.defaultProps={wrap:!0,widows:2,orphans:2};class Link$1 extends Base{get name(){return"Link"}get src(){return getURL(this.props.src||this.props.href)}async render(){const{top:t,left:e,width:r,height:i}=this.getAbsoluteLayout();this.root.instance.link(e,t,r,i,this.src),await this.renderChildren(),this.props.debug&&this.debug()}}class Note$1 extends Base{get name(){return"Note"}appendChild(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1))}applyProps(){super.applyProps(),this.height=0,this.width=0}async render(){const{top:t,left:e}=this.getAbsoluteLayout(),r=this.children[0]?this.children[0].value:"";this.root.instance.note(e,t,0,0,r)}}Note$1.defaultProps={};const SAFETY_HEIGHT=10;class Image$1 extends Base{constructor(t,e){super(t,e),this.image=null,this.layout.setMeasureFunc(this.measureImage.bind(this))}get name(){return"Image"}shouldGrow(){return!!this.getComputedStyles().flexGrow}measureImage(t,e,r,i){const o=this.margin,n=this.page.padding,s=this.page.size.height-n.top-n.bottom-o.top-o.bottom-SAFETY_HEIGHT;if(!this.image)return{width:0,height:0};if(e===Yoga.MEASURE_MODE_EXACTLY&&i===Yoga.MEASURE_MODE_UNDEFINED){const e=t/this.ratio;return{height:Math.min(s,e)}}if(i===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&&i===Yoga.MEASURE_MODE_AT_MOST){const e=t/this.ratio;return{height:Math.min(r,s,e)}}if(e===Yoga.MEASURE_MODE_AT_MOST&&i===Yoga.MEASURE_MODE_AT_MOST){const e=Math.min(this.image.width,t);return{width:e,height:e/this.ratio}}return{height:r,width:t}}get ratio(){return this.image.data?this.image.width/this.image.height:1}async fetch(){try{this.image=await resolveImage(this.props.src,this.props.cache)}catch(t){this.image={width:0,height:0},console.warn(t.message)}}clone(){const t=super.clone();return t.image=this.image,t}async onAppendDynamically(){await this.fetch()}async render(){const t=this.padding,{left:e,top:r}=this.getAbsoluteLayout();if(this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.image.data){const i=Math.min(this.height*this.ratio,this.width)-t.left-t.right,o=this.height-t.top-t.bottom,n=Math.max((this.width-i)/2,0);0!==i&&0!==o?this.root.instance.image(this.image.data,e+t.left+n,r+t.top,{width:i,height:o}):warning(!1,`Image with src '${this.props.src}' skipped due to invalid dimensions`)}this.props.debug&&this.debug(),this.root.instance.restore()}}Image$1.defaultProps={wrap:!1,cache:!0};const constructors={ROOT:Root,PAGE:Page$1,TEXT:Text$1,LINK:Link$1,VIEW:View$1,NOTE:Note$1,IMAGE:Image$1,DOCUMENT:Document$1,TEXT_INSTANCE:TextInstance};function createInstance(t,e){const{type:r,props:i={}}=t;if(constructors[r])return new constructors[r](e,i);throw new Error(`Invalid element of type ${r} passed to PDF renderer`)}const objectsEqual=(t,e)=>{const r=_Object$keys(t),i=_Object$keys(e);if(r.length!==i.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if("render"!==o){if("children"!==o&&t[o]!==e[o]){if("object"==typeof t[o]&&"object"==typeof e[o]&&objectsEqual(t[o],e[o]))continue;return!1}}else if(!t[o]!=!e[o])return!1}return!0},shouldReplaceLink=(t,e)=>"LINK"===t&&("string"==typeof e.children||Array.isArray(e.children)||e.render),PDFRenderer=ReactFiberReconciler({supportsMutation:!0,appendInitialChild(t,e){t.appendChild(e)},createInstance:(t,e,r)=>createInstance({type:shouldReplaceLink(t,e)?"TEXT":t,props:e},r),createTextInstance:(t,e)=>createInstance({type:"TEXT_INSTANCE",props:t},e),finalizeInitialChildren:(t,e,r)=>!1,getPublicInstance:t=>t,prepareForCommit(){},prepareUpdate:(t,e,r,i)=>!objectsEqual(r,i),resetAfterCommit(){},resetTextContent(t){},getRootHostContext:()=>emptyObject,getChildHostContext:()=>emptyObject,shouldSetTextContent:(t,e)=>!1,now:Date.now,useSyncScheduling:!0,appendChild(t,e){t.appendChild(e)},appendChildToContainer(t,e){t.appendChild(e)},removeChild(t,e){t.removeChild(e)},removeChildFromContainer(t,e){t.removeChild(e)},commitTextUpdate(t,e,r){t.update(r)},commitUpdate(t,e,r,i,o){t.update(o)}});var version="1.0.0-alpha.25";const View="VIEW",Text="TEXT",Link="LINK",Page="PAGE",Note="NOTE",Image="IMAGE",Document="DOCUMENT",pdf=t=>{const e=createInstance({type:"ROOT"}),r=PDFRenderer.createContainer(e);function i(t){PDFRenderer.updateContainer(t,r,null)}return t&&i(t),{isDirty:function(){return e.isDirty},updateContainer:i,toBuffer:function(){return e.document.props.onRender&&e.document.props.onRender(),e.render(),e.instance},toBlob:async function(){await e.render();const t=e.instance.pipe(BlobStream());return new _Promise((r,i)=>{t.on("finish",()=>{try{const o=t.toBlob("application/pdf");e.document.props.onRender&&e.document.props.onRender({blob:o}),r(o)}catch(t){i(t)}}),t.on("error",i)})},toString:function(){let t="";return e.render(),new _Promise((r,i)=>{try{e.instance.on("data",function(e){t+=e}),e.instance.on("end",function(){e.document.props.onRender&&e.document.props.onRender({string:t}),r(t)})}catch(t){i(t)}})}}},renderToStream=function(t){return pdf(t).toBuffer()},renderToFile=function(t,e,r){const i=renderToStream(t),o=fs.createWriteStream(e);return i.pipe(o),new _Promise((t,n)=>{o.on("finish",()=>{r&&r(i,e),t(i)}),o.on("error",n)})},throwEnvironmentError=t=>{throw new Error(`${t} is a web specific API. Or you're either using this component on Node, or your bundler is not loading react-pdf from the appropiate web build.`)},PDFViewer=()=>{throwEnvironmentError("PDFViewer")},PDFDownloadLink=()=>{throwEnvironmentError("PDFDownloadLink")},BlobProvider=()=>{throwEnvironmentError("BlobProvider")},render=renderToFile;var node={pdf:pdf,View:View,Text:Text,Link:Link,Page:Page,Font:Font,Note:Note,Image:Image,version:version,Document:Document,StyleSheet:StyleSheet,PDFRenderer:PDFRenderer,createInstance:createInstance,renderToStream:renderToStream,renderToFile:renderToFile,render:renderToFile};export{renderToStream,renderToFile,PDFViewer,PDFDownloadLink,BlobProvider,render,pdf,View,Text,Link,Page,Font,Note,Image,version,Document,StyleSheet,PDFRenderer,createInstance};export default node;
import _Promise from"babel-runtime/core-js/promise";import fs from"fs";import BlobStream from"blob-stream";import _Object$keys from"babel-runtime/core-js/object/keys";import ReactFiberReconciler from"react-reconciler";import emptyObject from"fbjs/lib/emptyObject";import PDFDocument,{PDFFont}from"@react-pdf/pdfkit";import wrapPages from"page-wrapping";import _extends from"babel-runtime/helpers/extends";import _objectWithoutProperties from"babel-runtime/helpers/objectWithoutProperties";import isUrl from"is-url";import fontkit from"@react-pdf/fontkit";import fetch from"isomorphic-fetch";import _Array$from from"babel-runtime/core-js/array/from";import emojiRegex from"emoji-regex";import{Attachment,AttributedString,Container,LayoutEngine,Path,Rect}from"@react-pdf/textkit-core";import scriptItemizer from"@react-pdf/script-itemizer";import justificationEngine from"@textkit/justification-engine";import textDecorationEngine from"@textkit/text-decoration-engine";import english from"hyphenation.en-us";import Hypher from"hypher";import _JSON$stringify from"babel-runtime/core-js/json/stringify";import PNG from"@react-pdf/png-js";import _Object$assign from"babel-runtime/core-js/object/assign";import{Fragment}from"react";import Yoga from"yoga-layout-prebuilt";import warning from"fbjs/lib/warning";import toPairsIn from"lodash.topairsin";import isFunction from"lodash.isfunction";import pick from"lodash.pick";import merge from"lodash.merge";import matchMedia from"media-engine";import createPDFRenderer from"@textkit/pdf-renderer";class Root{constructor(){this.isDirty=!1,this.document=null,this.instance=null}get name(){return"Root"}appendChild(t){this.document=t}markDirty(){this.isDirty=!0}async render(){this.instance=new PDFDocument({autoFirstPage:!1}),await this.document.render(),this.isDirty=!1}}var standardFonts=["Courier","Courier-Bold","Courier-Oblique","Helvetica","Helvetica-Bold","Helvetica-Oblique","Times-Roman","Times-Bold","Times-Italic"];const fetchFont=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>Buffer.from(t));let emojiSource,hyphenationCallback,fonts={};const register=(t,e)=>{let{family:r}=e,i=_objectWithoutProperties(e,["family"]);fonts[r]=_extends({src:t,loaded:!1,loading:!1,data:null},i)},registerHyphenationCallback=t=>{hyphenationCallback=t},registerEmojiSource=({url:t,format:e="png"})=>{emojiSource={url:t,format:e}},getRegisteredFonts=()=>_Object$keys(fonts),getFont=t=>fonts[t],getEmojiSource=()=>emojiSource,getHyphenationCallback=()=>hyphenationCallback,load=async function(t,e){const r=fonts[t];if(r&&!r.data&&!r.loading)if(r.loading=!0,isUrl(r.src)){const t=await fetchFont(r.src);r.data=fontkit.create(t)}else r.data=fontkit.openSync(r.src);if(r&&!r.loaded&&(r.loaded=!0,r.loading=!1,e.registerFont(t,r.data)),!r&&!standardFonts.includes(t))throw new Error(`Font family not registered: ${t}. Please register it calling Font.register() method.`)},reset=function(){for(const t in fonts)fonts.hasOwnProperty(t)&&(fonts[t].loaded=!1)},clear=function(){fonts={}};var Font={register:register,getEmojiSource:getEmojiSource,getRegisteredFonts:getRegisteredFonts,registerEmojiSource:registerEmojiSource,registerHyphenationCallback:registerHyphenationCallback,getHyphenationCallback:getHyphenationCallback,getFont:getFont,load:load,clear:clear,reset:reset};class StandardFont{constructor(t){this.name=t,this.src=PDFFont.open(null,t)}layout(t){const[e,r]=this.src.encode(t);return{positions:r,stringIndices:r.map((t,e)=>e),glyphs:e.map((t,e)=>{const i=this.getGlyph(parseInt(t,16));return i.advanceWidth=r[e].advanceWidth,i})}}glyphForCodePoint(t){const e=this.getGlyph(t);return e.advanceWidth=400,e}getGlyph(t){return{id:t,_font:this.src,codePoints:[t],isLigature:!1,name:this.src.font.characterToGlyph(t)}}hasGlyphForCodePoint(t){return".notdef"!==this.src.font.characterToGlyph(t)}get ascent(){return this.src.ascender}get descent(){return this.src.descender}get lineGap(){return this.src.lineGap}get unitsPerEm(){return 1e3}}var fontSubstitutionEngine=()=>({Run:t})=>(class{constructor(){this.fontCache={}}get fallbackFont(){return this.getOrCreateFont("Helvetica")}getOrCreateFont(t){if(this.fontCache[t])return this.fontCache[t];const e=new StandardFont(t);return this.fontCache[t]=e,e}shouldFallbackToFont(t,e){return!e.hasGlyphForCodePoint(t)&&this.fallbackFont.hasGlyphForCodePoint(t)}getRuns(e,r){const i=[];let o=null,n=0,s=0;for(const a of r){const r="string"==typeof a.attributes.font?this.getOrCreateFont(a.attributes.font):a.attributes.font;if(0===e.length){i.push(new t(0,0,{font:r}));break}for(const h of e.slice(a.start,a.end)){const e=h.codePointAt(),a=this.shouldFallbackToFont(e,r)?this.fallbackFont:r;a!==o&&(o&&i.push(new t(n,s,{font:o})),o=a,n=s),s+=h.length}}return n<e.length&&i.push(new t(n,e.length,{font:o})),i}});const SOFT_HYPHEN_HEX="­",hypher=new Hypher(english);var wordHyphenation=({hyphenationCallback:t})=>()=>(class{constructor(){this.cache={}}calculateParts(t){return t.includes("­")?t.split("­"):hypher.hyphenate(t)}hyphenateWord(e){if(this.cache[e])return this.cache[e];const r=t?t(e):this.calculateParts(e);return this.cache[e]=r,r}});class Node{constructor(t){this.prev=null,this.next=null,this.data=t}toString(){return this.data.toString()}}class LinkedList{constructor(){this.head=null,this.tail=null,this.listSize=0}isLinked(t){return!(t&&null===t.prev&&null===t.next&&this.tail!==t&&this.head!==t||this.isEmpty())}size(){return this.listSize}isEmpty(){return 0===this.listSize}first(){return this.head}last(){return this.last}toString(){return this.toArray().toString()}toArray(){let t=this.head;const e=[];for(;null!==t;)e.push(t),t=t.next;return e}forEach(t){let e=this.head;for(;null!==e;)t(e),e=e.next}contains(t){let e=this.head;if(!this.isLinked(t))return!1;for(;null!==e;){if(e===t)return!0;e=e.next}return!1}at(t){let e=this.head,r=0;if(t>=this.listLength||t<0)return null;for(;null!==e;){if(t===r)return e;e=e.next,r+=1}return null}insertAfter(t,e){return this.isLinked(t)?(e.prev=t,e.next=t.next,null===t.next?this.tail=e:t.next.prev=e,t.next=e,this.listSize+=1,this):this}insertBefore(t,e){return this.isLinked(t)?(e.prev=t.prev,e.next=t,null===t.prev?this.head=e:t.prev.next=e,t.prev=e,this.listSize+=1,this):this}push(t){return null===this.head?this.unshift(t):this.insertAfter(this.tail,t),this}unshift(t){return null===this.head?(this.head=t,this.tail=t,t.prev=null,t.next=null,this.listSize+=1):this.insertBefore(this.head,t),this}remove(t){return this.isLinked(t)?(null===t.prev?this.head=t.next:t.prev.next=t.next,null===t.next?this.tail=t.prev:t.next.prev=t.prev,this.listSize-=1,this):this}pop(){const t=this.tail;return this.tail.prev.next=null,this.tail=this.tail.prev,this.listSize-=1,t.prev=null,t.next=null,t}shift(){const t=this.head;return this.head.next.prev=null,this.head=this.head.next,this.listSize-=1,t.prev=null,t.next=null,t}}LinkedList.Node=Node;const linebreak=(t,e,r)=>{const i={demerits:{line:r&&r.demerits&&r.demerits.line||10,flagged:r&&r.demerits&&r.demerits.flagged||100,fitness:r&&r.demerits&&r.demerits.fitness||3e3},tolerance:r&&r.tolerance||3},o=new LinkedList,n={width:0,stretch:0,shrink:0},s=e,a=[];let h={data:{demerits:1/0}};function l(t,e,r,i,o,n,s){return{position:t,demerits:e,ratio:r,line:i,fitnessClass:o,totals:n||{width:0,stretch:0,shrink:0},previous:s}}function d(e,r,i,o){let a=n.width-i.totals.width,h=0,l=0;const d=o<s.length?s[o-1]:s[s.length-1];return"penalty"===t[r].type&&(a+=t[r].width),a<d?(h=n.stretch-i.totals.stretch)>0?(d-a)/h:linebreak.infinity:a>d?(l=n.shrink-i.totals.shrink)>0?(d-a)/l:linebreak.infinity:0}function c(e){const r={width:n.width,stretch:n.stretch,shrink:n.shrink};for(let i=e;i<t.length;i+=1)if("glue"===t[i].type)r.width+=t[i].width,r.stretch+=t[i].stretch,r.shrink+=t[i].shrink;else if("box"===t[i].type||"penalty"===t[i].type&&t[i].penalty===-linebreak.infinity&&i>e)break;return r}function g(t,e,r){let n,s,a,h,g,p=o.first(),u=null,m=0,f=0,y=[],b=0,E=0;for(;null!==p;){for(y=[{demerits:1/0},{demerits:1/0},{demerits:1/0},{demerits:1/0}];null!==p&&(u=p.next,b=p.data.line+1,((m=d(p.data.position,e,p.data,b))<-1||"penalty"===t.type&&t.penalty===-linebreak.infinity)&&o.remove(p),m>=-1&&m<=i.tolerance&&(n=100*Math.pow(Math.abs(m),3),f="penalty"===t.type&&t.penalty>=0?Math.pow(i.demerits.line+n,2)+Math.pow(t.penalty,2):"penalty"===t.type&&t.penalty!==-linebreak.infinity?Math.pow(i.demerits.line+n,2)-Math.pow(t.penalty,2):Math.pow(i.demerits.line+n,2),"penalty"===t.type&&"penalty"===r[p.data.position].type&&(f+=i.demerits.flagged*t.flagged*r[p.data.position].flagged),E=m<-.5?0:m<=.5?1:m<=1?2:3,Math.abs(E-p.data.fitnessClass)>1&&(f+=i.demerits.fitness),(f+=p.data.demerits)<y[E].demerits&&(y[E]={active:p,demerits:f,ratio:m})),!(null!==(p=u)&&p.data.line>=b)););for(s=c(e),a=0;a<y.length;a+=1)(h=y[a]).demerits<1/0&&(g=new LinkedList.Node(l(e,h.demerits,h.ratio,h.active.data.line+1,a,s,h.active)),null!==p?o.insertBefore(p,g):o.push(g))}}if(o.push(new LinkedList.Node(l(0,0,0,0,0,void 0,null))),t.forEach((t,e,r)=>{"box"===t.type?n.width+=t.width:"glue"===t.type?(e>0&&"box"===r[e-1].type&&g(t,e,r),n.width+=t.width,n.stretch+=t.stretch,n.shrink+=t.shrink):"penalty"===t.type&&t.penalty!==linebreak.infinity&&g(t,e,r)}),0!==o.size()){for(o.forEach(t=>{t.data.demerits<h.data.demerits&&(h=t)});null!==h;)a.push({position:h.data.position,ratio:h.data.ratio}),h=h.data.previous;return a.reverse()}return[]};linebreak.infinity=1e4,linebreak.glue=((t,e,r,i)=>({type:"glue",value:e,width:t,stretch:r,shrink:i})),linebreak.box=((t,e,r=!1)=>({type:"box",width:t,value:e,hyphenated:r})),linebreak.penalty=((t,e,r)=>({type:"penalty",width:t,penalty:e,flagged:r}));const INFINITY=1e4,getNextBreakpoint=(t,e,r)=>{let i=null,o=1/0;const n={width:0,stretch:0,shrink:0},s=e[Math.min(r,e.length-1)],a=t=>n.width<s?n.stretch-t.stretch>0?(s-n.width)/n.stretch:1e4:n.width>s?n.shrink-t.shrink>0?(s-n.width)/n.shrink:1e4:0;for(let e=0;e<t.length;e++){const r=t[e];if("box"===r.type?n.width+=r.width:"glue"===r.type&&(n.width+=r.width,n.stretch+=r.stretch,n.shrink+=r.shrink),n.width-n.shrink>s)break;if("penalty"===r.type||"glue"===r.type){const t=a(r),n="penalty"===r.type?r.penalty:0,s=100*Math.pow(Math.abs(t),3)+n;o>=s&&(i=e,o=s)}}return n.width-n.shrink>s?i:null},applyBestFit=(t,e)=>{let r=0,i=0,o=t;const n=[{position:0}];for(;o.length>0;){const t=getNextBreakpoint(o,e,i);t?(r+=t,n.push({position:r}),o=o.slice(t+1,o.length),r++,i++):o=[]}return n},HYPHEN=45,TOLERANCE_STEPS=5,TOLERANCE_LIMIT=50,opts={width:3,stretch:3,shrink:4};var lineBreaker=({penalty:t}={})=>()=>(class{constructor(t){this.tolerance=t||4}getNodes(e,r,{align:i}){let o=0;const n=t||("justify"===i?100:600),s=r.reduce((t,i,s)=>{const a=e.glyphIndexForStringIndex(o),h=e.glyphIndexForStringIndex(o+i.length),l=e.slice(a,h);if(""===l.string.trim()){const e=l.advanceWidth,r=e*opts.width/opts.stretch,i=e*opts.width/opts.shrink,n={value:l,start:o,end:o+l.end};t.push(linebreak.glue(e,n,r,i))}else{const e=" "!==r[s+1],i={value:l,start:o,end:o+l.end};t.push(linebreak.box(l.advanceWidth,i,e)),r[s+1]&&e&&t.push(linebreak.penalty(5,n,1))}return o+=i.length,t},[]);return s.push(linebreak.glue(0,null,linebreak.infinity,0)),s.push(linebreak.penalty(0,-linebreak.infinity,1)),s}breakLines(t,e,r){let i=0,o=null;const n=r.reduce((r,n)=>{const s=e[n.position],a=e[n.position-1];if(n.position===e.length-1)return r;let h;return"penalty"===s.type?(o=t.glyphIndexForStringIndex(a.value.end),(h=t.slice(i,o)).insertGlyph(h.length,45)):(o=t.glyphIndexForStringIndex(s.value.end),h=t.slice(i,o)),i=o,[...r,h]},[]),s=t.slice(i,t.length);return n.push(s),n}suggestLineBreak(t,e,r,i){const o=this.getNodes(t,e,i);let n=this.tolerance,s=linebreak(o,r,{tolerance:n});for(;0===s.length&&n<50;)s=linebreak(o,r,{tolerance:n+=5});return(0===s.length||1===s.length&&0===s[0].position)&&(s=applyBestFit(o,r)),this.breakLines(t,o,s.slice(1))}});const shrinkWhitespaceFactor={before:-.5,after:-.5};class LayoutEngine$1 extends LayoutEngine{constructor({hyphenationCallback:t,hyphenationPenalty:e}){super({scriptItemizer:scriptItemizer(),decorationEngine:textDecorationEngine(),fontSubstitutionEngine:fontSubstitutionEngine(),wordHyphenation:wordHyphenation({hyphenationCallback:t}),lineBreaker:lineBreaker({penalty:e}),justificationEngine:justificationEngine({shrinkWhitespaceFactor:shrinkWhitespaceFactor})})}}const MARKERS=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];class JPEG{constructor(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");let e,r=2;for(;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)}}const createCache=({limit:t=100}={})=>{const e={},r=[];return{get:t=>e[t],set:(i,o)=>{r.push(i),r.length>t&&delete e[r.shift()],e[i]=o},length:()=>r.length}},imagesCache=createCache({limit:30}),isValidFormat=t=>{const e=t.toLowerCase();return"jpg"===e||"jpeg"===e||"png"===e},isCompatibleBase64=t=>/data:image\/[a-zA-Z]*;base64,[^"]*/g.test(t);function getImage(t,e){switch(e.toLowerCase()){case"jpg":case"jpeg":return new JPEG(t);case"png":return new PNG(t);default:return null}}const resolveBase64Image=t=>{const e=/data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(t),r=e[1],i=e[2];if(!isValidFormat(r))throw new Error(`Base64 image invalid format: ${r}`);return new _Promise(t=>t(getImage(Buffer.from(i,"base64"),r)))},resolveLocalImage=t=>{if(t.data&&t.format)return new _Promise(e=>e(getImage(t.data,t.format)));throw new Error(`Invalid data given for local file: ${_JSON$stringify(t)}`)},resolveRemoteImage=t=>fetch(t).then(t=>t.buffer?t.buffer():t.arrayBuffer()).then(t=>"Buffer"===t.constructor.name?t:Buffer.from(t)).then(t=>{const 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];let i="";if(e)i="png";else{if(!r)throw new Error("Not valid image extension");i="jpg"}return getImage(t,i)}),resolveImage=(t,e=!0)=>{if(e&&imagesCache.get(t))return imagesCache.get(t);let r;return r=isCompatibleBase64(t)?resolveBase64Image(t):"object"==typeof t?resolveLocalImage(t):resolveRemoteImage(t),e&&imagesCache.set(t,r),r},emojis={},regex=emojiRegex(),reflect=t=>(...e)=>t(...e).then(t=>t,t=>t),fetchEmojiImage=reflect(resolveImage),getCodePoints=t=>_Array$from(t).map(t=>t.codePointAt(0).toString(16)).join("-"),buildEmojiUrl=t=>{const{url:e,format:r}=Font.getEmojiSource();return`${e}${getCodePoints(t)}.${r}`},fetchEmojis=t=>{const e=Font.getEmojiSource();if(!e||!e.url)return[];const r=[];let i;for(;i=regex.exec(t);){const t=i[0];if(!emojis[t]||emojis[t].loading){const e=buildEmojiUrl(t);emojis[t]={loading:!0},r.push(fetchEmojiImage(e).then(e=>{emojis[t].loading=!1,emojis[t].data=e.data}))}}return r},embedEmojis=t=>{const e=[];for(let r=0;r<t.length;r++){const i=t[r];let o,n=0;for(;o=regex.exec(i.string);){const t=o.index,r=o[0],s=i.attributes.fontSize,a=i.string.slice(n,t+o[0].length);emojis[r]&&emojis[r].data?e.push({string:a.replace(o,Attachment.CHARACTER),attributes:_extends({},i.attributes,{attachment:new Attachment(s,s,{yOffset:Math.floor(.1*s),image:emojis[r].data})})}):e.push({string:a.replace(o,String.fromCharCode(0)),attributes:i.attributes}),n=t+r.length}n<i.string.length&&e.push({string:i.string.slice(n),attributes:i.attributes})}return e};class Document$1{constructor(t,e){this.root=t,this.props=e,this.children=[]}get name(){return"Document"}appendChild(t){t.parent=this,this.children.push(t)}removeChild(t){const e=this.children.indexOf(t);t.parent=null,this.children.slice(e,1)}addMetaData(){const{title:t,author:e,subject:r,keywords:i,creator:o,producer:n}=this.props;t&&(this.root.instance.info.Title=t),e&&(this.root.instance.info.Author=e),r&&(this.root.instance.info.Subject=r),i&&(this.root.instance.info.Keywords=i),this.root.instance.info.Creator=o||"react-pdf",this.root.instance.info.Producer=n||"react-pdf"}async loadFonts(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();r.style&&r.style.fontFamily&&t.push(Font.load(r.style.fontFamily,this.root.instance)),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadEmojis(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"string"==typeof r?t.push(...fetchEmojis(r)):"string"==typeof r.value?t.push(...fetchEmojis(r.value)):r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadImages(){const t=[],e=this.children.slice(0);for(;e.length>0;){const r=e.shift();"Image"===r.name&&t.push(r.fetch()),r.children&&r.children.forEach(t=>{e.push(t)})}await _Promise.all(t)}async loadAssets(){await _Promise.all([this.loadFonts(),this.loadImages()])}applyProps(){this.children.forEach(t=>t.applyProps())}update(t){this.props=t}async wrapPages(){let t=1;const e=[];for(const r of this.children){const i=r.size.height-(r.style.paddingBottom||0);if(r.wrap){const o=await wrapPages(r,i,t);t+=o.length,e.push(...o)}else r.height=r.size.height,e.push(r)}return e}async renderPages(){const t=await this.wrapPages();for(let e=0;e<t.length;e++)t[e].renderDynamicNodes({pageNumber:e+1,totalPages:t.length},t=>"Text"===t.name),await t[e].render();return t}async render(){try{this.addMetaData(),this.applyProps(),await this.loadEmojis(),await this.loadAssets(),await this.renderPages(),this.root.instance.end(),Font.reset()}catch(t){throw t}}}Document$1.defaultProps={author:null,keywords:null,subject:null,title:null};const upperFirst=t=>t.charAt(0).toUpperCase()+t.slice(1),matchPercent=t=>/(\d+\.?\d*)%/g.exec(t);class Node$1{constructor(){this.parent=null,this.children=[],this.computed=!1,this.layout=Yoga.Node.createDefault()}appendChild(t){t&&(t.parent=this,this.children.push(t),this.layout.insertChild(t.layout,this.layout.getChildCount()))}appendChildBefore(t,e){const r=this.children.indexOf(e);-1!==r&&t&&(t.parent=this,this.children.splice(r,0,t),this.layout.insertChild(t.layout,r))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.layout.removeChild(t.layout))}removeAllChilds(){const t=[...this.children];for(let e=0;e<t.length;e++)t[e].remove()}remove(){this.parent.removeChild(this)}setDimension(t,e){const r=`set${upperFirst(t)}`,i=`${r}Percent`,o=matchPercent(e);o?this.layout[i](parseFloat(o[1],10)):this.layout[r](e)}setPosition(t,e){const r=matchPercent(e);r?this.layout.setPositionPercent(t,parseFloat(r[1],10)):this.layout.setPosition(t,e)}setPadding(t,e){const r=matchPercent(e);r?this.layout.setPaddingPercent(t,parseFloat(r[1],10)):this.layout.setPadding(t,e)}setMargin(t,e){const r=matchPercent(e);r?this.layout.setMarginPercent(t,parseFloat(r[1],10)):this.layout.setMargin(t,e)}setBorder(t,e){if(matchPercent(e))throw new Error("Node: You cannot set percentage border widths");this.layout.setBorder(t,e)}getAbsoluteLayout(){const 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}}copyStyle(t){this.layout.copyStyle(t.layout)}calculateLayout(){this.layout.calculateLayout(),this.computed=!0}isEmpty(){return 0===this.children.length}markDirty(){return this.layout.markDirty()}onAppendDynamically(){}get position(){return this.layout.getPositionType()===Yoga.POSITION_TYPE_ABSOLUTE?"absolute":"relative"}get top(){return this.layout.getComputedTop()||0}get left(){return this.layout.getComputedLeft()||0}get right(){return this.layout.getComputedRight()||0}get bottom(){return this.layout.getComputedBottom()||0}get width(){return this.layout.getComputedWidth()}get minWidth(){return this.layout.getMinWidth().value}get maxWidth(){return this.layout.getMaxWidth().value}get height(){return this.layout.getComputedHeight()}get minHeight(){return this.layout.getMinHeight().value}get maxHeight(){return this.layout.getMaxHeight().value}get paddingTop(){return this.layout.getComputedPadding(Yoga.EDGE_TOP)||0}get paddingRight(){return this.layout.getComputedPadding(Yoga.EDGE_RIGHT)||0}get paddingBottom(){return this.layout.getComputedPadding(Yoga.EDGE_BOTTOM)||0}get paddingLeft(){return this.layout.getComputedPadding(Yoga.EDGE_LEFT)||0}get marginTop(){return this.layout.getComputedMargin(Yoga.EDGE_TOP)||0}get marginRight(){return this.layout.getComputedMargin(Yoga.EDGE_RIGHT)||0}get marginBottom(){return this.layout.getComputedMargin(Yoga.EDGE_BOTTOM)||0}get marginLeft(){return this.layout.getComputedMargin(Yoga.EDGE_LEFT)||0}get borderTopWidth(){return this.layout.getComputedBorder(Yoga.EDGE_TOP)||0}get borderRightWidth(){return this.layout.getComputedBorder(Yoga.EDGE_RIGHT)||0}get borderBottomWidth(){return this.layout.getComputedBorder(Yoga.EDGE_BOTTOM)||0}get borderLeftWidth(){return this.layout.getComputedBorder(Yoga.EDGE_LEFT)||0}get padding(){return{top:this.paddingTop,right:this.paddingRight,bottom:this.paddingBottom,left:this.paddingLeft}}get margin(){return{top:this.marginTop,right:this.marginRight,bottom:this.marginBottom,left:this.marginLeft}}set position(t){this.layout.setPositionType("absolute"===t?Yoga.POSITION_TYPE_ABSOLUTE:Yoga.POSITION_TYPE_RELATIVE)}set top(t){this.setPosition(Yoga.EDGE_TOP,t)}set left(t){this.setPosition(Yoga.EDGE_LEFT,t)}set right(t){this.setPosition(Yoga.EDGE_RIGHT,t)}set bottom(t){this.setPosition(Yoga.EDGE_BOTTOM,t)}set width(t){this.setDimension("width",t)}set minWidth(t){this.setDimension("minWidth",t)}set maxWidth(t){this.setDimension("maxWidth",t)}set height(t){this.setDimension("height",t)}set minHeight(t){this.setDimension("minHeight",t)}set maxHeight(t){this.setDimension("maxHeight",t)}set paddingTop(t){this.setPadding(Yoga.EDGE_TOP,t)}set paddingRight(t){this.setPadding(Yoga.EDGE_RIGHT,t)}set paddingBottom(t){this.setPadding(Yoga.EDGE_BOTTOM,t)}set paddingLeft(t){this.setPadding(Yoga.EDGE_LEFT,t)}set marginTop(t){this.setMargin(Yoga.EDGE_TOP,t)}set marginRight(t){this.setMargin(Yoga.EDGE_RIGHT,t)}set marginBottom(t){this.setMargin(Yoga.EDGE_BOTTOM,t)}set marginLeft(t){this.setMargin(Yoga.EDGE_LEFT,t)}set padding(t){this.paddingTop=t,this.paddingRight=t,this.paddingBottom=t,this.paddingLeft=t}set margin(t){this.marginTop=t,this.marginRight=t,this.marginBottom=t,this.marginLeft=t}set borderTopWidth(t){this.setBorder(Yoga.EDGE_TOP,t)}set borderRightWidth(t){this.setBorder(Yoga.EDGE_RIGHT,t)}set borderBottomWidth(t){this.setBorder(Yoga.EDGE_BOTTOM,t)}set borderLeftWidth(t){this.setBorder(Yoga.EDGE_LEFT,t)}}const yogaValue=(t,e)=>{const r=t=>"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}},parseValue=t=>{const e=/^(\d*\.?\d+)(in|mm|cm|pt)?$/g.exec(t);return e?{value:parseFloat(e[1],10),unit:e[2]||"pt"}:{value:t,unit:void 0}},parseScalar=t=>{let e={};const r=parseValue(t);switch(r.unit){case"in":e=72*r.value;break;case"mm":e=r.value*(1/25.4)*72;break;case"cm":e=r.value*(1/2.54)*72;break;default:e=r.value}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}},expandStyles=t=>{if(!t)return t;const e=_Object$keys(t),r={};for(let i=0;i<e.length;i++){const o=e[i],n=t[o];switch(o){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[o]=yogaValue(o,n);break;case"textAlignVertical":r.verticalAlign="center"===n?"middle":n;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":{const t=styleShortHands[o];for(const e in t)hasOwnProperty.call(t,e)&&(r[e]=n)}break;default:r[o]=n}}return r},matchBorderShorthand=t=>t.match(/(\d+(px|in|mm|cm|pt)?)\s(\S+)\s(\S+)/),processBorders=(t,e)=>{const 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},transformStyles=t=>{const e=expandStyles(t),r=_Object$keys(e),i={};for(let t=0;t<r.length;t++){const o=r[t],n=e[o],s=o.match(/border/)&&"string"==typeof n?processBorders(o,n):n;i[o]=parseScalar(s)}return i},create=t=>t,flatten=t=>{return Array.isArray(t)||(t=[t]),t.reduce((t,e)=>(e&&_Object$keys(e).forEach(r=>{null!==e[r]&&void 0!==e[r]&&(t[r]=e[r])}),t),{})},resolveMediaQueries=(t,e)=>{return _Object$keys(t).reduce((r,i)=>/@media/.test(i)?_extends({},r,matchMedia({[i]:t[i]},e)):_extends({},r,{[i]:t[i]}),{})},resolve=(t,e)=>t?(t=flatten(t),t=resolveMediaQueries(t,e),t=transformStyles(t)):null,absoluteFillObject={position:"absolute",top:0,left:0,bottom:0,right:0};var StyleSheet={hairlineWidth:1,create:create,resolve:resolve,flatten:flatten,absoluteFillObject:absoluteFillObject};const Debug={debug(){const 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.root.instance.restore()},debugText(t,e){const r=Math.round(this.width+e.left+e.right),i=Math.round(this.height+e.top+e.bottom);this.root.instance.fontSize(4).opacity(1).fillColor("black").text(`${r} x ${i}`,t.left-e.left,Math.max(t.top-e.top-4,1))},debugContent(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(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(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()}},Borders={drawBorders(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),{borderTopWidth:o=0,borderRightWidth:n=0,borderBottomWidth:s=0,borderLeftWidth:a=0}=this,{borderTopLeftRadius:h=0,borderTopRightRadius:l=0,borderBottomRightRadius:d=0,borderBottomLeftRadius:c=0,borderTopColor:g="black",borderRightColor:p="black",borderBottomColor:u="black",borderLeftColor:m="black",borderTopStyle:f="solid",borderRightStyle:y="solid",borderBottomStyle:b="solid",borderLeftStyle:E="solid"}=this.getComputedStyles();this.root.instance.save(),this.drawHorizontalBorder([t+(h>0?o/2:0),e+o/2],[t+r-(l>0?o/2:0),e+o/2],h,l,o,g,f),this.drawVerticalBorder([t+r-n/2,e+(l>0?n/2:0)],[t+r-n/2,e+i-(d>0?n/2:0)],-l,-d,n,p,y),this.drawHorizontalBorder([t+r-(d>0?s/2:0),e+i-s/2],[t+(c>0?s/2:0),e+i-s/2],-d,-c,s,u,b),this.drawVerticalBorder([t+a/2,e+i-(c>0?a/2:0)],[t+a/2,e+(h>0?a/2:0)],c,h,a,m,E),this.root.instance.restore()},traceBorder(t,e){switch(t){case"dashed":this.root.instance.dash(2*e,{space:1.2*e}).stroke();break;case"dotted":this.root.instance.dash(e,{space:1.2*e}).stroke();break;default:this.root.instance.stroke()}},drawHorizontalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0],t[1]+r).quadraticCurveTo(t[0],t[1],t[0]+r,t[1]).lineTo(e[0]-i,e[1]).quadraticCurveTo(e[0],e[1],e[0],e[1]+i).strokeColor(n),this.traceBorder(s,o))},drawVerticalBorder(t,e,r,i,o,n,s){o<=0||(this.root.instance.lineWidth(o).moveTo(t[0]+r,t[1]).quadraticCurveTo(t[0],t[1],t[0],t[1]-r).lineTo(e[0],e[1]+i).quadraticCurveTo(e[0],e[1],e[0]+i,e[1]).strokeColor(n),this.traceBorder(s,o))}},getRotation=t=>{const e=/rotate\((-?\d+.?\d+)(.+)\)/g.exec(t);if(e&&e[1]&&e[2]){const t=e[1];return"rad"===e[2]?180*t/Math.PI:t}return 0},getTranslateX=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const 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=t=>{const e=/matrix\(([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)\)/g.exec(t);return e?e.slice(1,7):null},applySingleTransformation=(t,e)=>{const{left:r,top:i,width:o,height:n}=t.getAbsoluteLayout(),s=[r+o/2,i+n/2];/rotate/g.test(e)?t.root.instance.rotate(getRotation(e),{origin:s}):/scaleX/g.test(e)?t.root.instance.scale(getScaleX(e),1,{origin:s}):/scaleY/g.test(e)?t.root.instance.scale(1,getScaleY(e),{origin:s}):/scale/g.test(e)?t.root.instance.scale(getScaleX(e),getScaleY(e),{origin:s}):/translateX/g.test(e)?t.root.instance.translate(getTranslateX(e),1,{origin:s}):/translateY/g.test(e)?t.root.instance.translate(1,getTranslateY(e),{origin:s}):/translate/g.test(e)?t.root.instance.translate(getTranslateX(e),getTranslateY(e),{origin:s}):/matrix/g.test(e)&&t.root.instance.transform(...getMatrix(e))},Transformations={applyTransformations(){let t;const e=/[a-zA-Z]+\([^)]+\)/g,r=this.style&&this.style.transform||"";for(;null!=(t=e.exec(r));)applySingleTransformation(this,t[0])}},inheritedProperties=["color","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","textDecoration","lineHeight","textAlign","visibility","wordSpacing"];class Base extends Node$1{constructor(t,e){super(),this.root=t,this.props=merge({},this.constructor.defaultProps,Base.defaultProps,e),warning(!this.props.styles,'"styles" prop passed instead of "style" prop')}get page(){return this.parent.page}get wrap(){return this.props.wrap}get break(){return this.props.break}get fixed(){return this.props.fixed}get minPresenceAhead(){return this.props.minPresenceAhead}get absolute(){return"absolute"===this.props.style.position}set break(t){this.props.break=t}appendChild(t){super.appendChild(t),this.root.markDirty()}appendChildBefore(t,e){super.appendChildBefore(t,e),this.root.markDirty()}removeChild(t){super.removeChild(t),this.root.markDirty()}update(t){this.props=merge({},this.constructor.defaultProps,Base.defaultProps,t),this.root.markDirty()}applyProps(){const{size:t,orientation:e}=this.page;this.style=StyleSheet.resolve(this.props.style,{width:t.width,height:t.height,orientation:e}),toPairsIn(this.style).map(([t,e])=>{this.applyStyle(t,e)}),this.children.forEach(t=>{t.applyProps&&t.applyProps()})}applyStyle(t,e){const 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)}}getComputedStyles(){let t=this.parent,e={};for(;t&&t.parent;)e=_extends({},t.parent.style,t.style,e),t=t.parent;return _extends({},pick(e,inheritedProperties),this.style)}drawBackgroundColor(){const{left:t,top:e,width:r,height:i}=this.getAbsoluteLayout(),o=this.getComputedStyles(),n=Math.max(o.borderTopLeftRadius,o.borderTopRightRadius,o.borderBottomRightRadius,o.borderBottomLeftRadius)||0;o.backgroundColor&&this.root.instance.fillColor(o.backgroundColor).roundedRect(t,e,r,i,n).fill()}clone(){const t=new this.constructor(this.root,this.props);return t.copyStyle(this),t.style=this.style,t}onNodeSplit(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}async renderChildren(){const t=this.children.filter(t=>t.absolute),e=this.children.filter(t=>!t.absolute);for(let t=0;t<e.length;t++)await e[t].render();for(let e=0;e<t.length;e++)await t[e].render()}}Base.defaultProps={style:{borderTopLeftRadius:0,borderTopRightRadius:0,borderBottomRightRadius:0,borderBottomLeftRadius:0},minPresenceAhead:0},_Object$assign(Base.prototype,Debug),_Object$assign(Base.prototype,Borders),_Object$assign(Base.prototype,Transformations);class TextInstance{constructor(t,e){this.root=t,this.value=e,this.parent=null,this.props={}}get name(){return"TextInstance"}remove(){this.parent.removeChild(this)}clone(){return new this.constructor(this.root,this.value)}update(t){this.value=t,this.parent.computed=!1,this.parent._container=null,this.root.markDirty()}}const 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=(t,e="portrait")=>{let r;if("string"==typeof t)r=PAGE_SIZES[t.toUpperCase()];else if(Array.isArray(t))r=t;else{if("object"!=typeof t||!t.width||!t.height)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]}},RULER_WIDTH=13,RULER_COLOR="white",RULER_FONT_SIZE=5,DEFAULT_RULER_STEPS=50,LINE_WIDTH=.5,LINE_COLOR="gray",GRID_COLOR="#ababab",range=(t,e)=>_Array$from({length:Math.ceil(t/e)},(t,r)=>r*e),matchPercentage=t=>{const e=t.match(/(\d+\.?\d*)%/);return e?100/parseFloat(e[1],10):null},Ruler={getRulerWidth:()=>13,hasHorizontalRuler(){return this.props.ruler||this.props.horizontalRuler},hasVerticalRuler(){return this.props.ruler||this.props.verticalRuler},getHorizontalSteps(){const t=this.props.horizontalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.width-(this.hasVerticalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},getVerticalSteps(){const t=this.props.verticalRulerSteps||this.props.rulerSteps||50;if("string"==typeof t){const e=matchPercentage(t);if(e){return(this.height-(this.hasHorizontalRuler()?13:0))/e}throw new Error("Page: Invalid horizontal steps value")}return t},renderRuler(){const 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(){const t=this.hasVerticalRuler()?13:0;this.root.instance.rect(t,0,this.width,13).fill("white").moveTo(this.hasVerticalRuler()?13:0,13).lineTo(this.width,13).stroke("gray");const e=range(this.width,this.getHorizontalSteps());e.map(e=>{this.root.instance.moveTo(t+e,0).lineTo(t+e,13).stroke("gray").fillColor("black").text(`${Math.round(e)}`,t+e+1,1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(t+e,13).lineTo(t+e,this.height).stroke("#ababab")})},drawVerticalRuler(){const t=this.hasHorizontalRuler()?13:0;this.root.instance.rect(0,t,13,this.height).fill("white").moveTo(13,this.hasHorizontalRuler()?13:0).lineTo(13,this.height).stroke("gray");const e=range(this.height,this.getVerticalSteps());e.map(e=>{this.root.instance.moveTo(0,t+e).lineTo(13,t+e).stroke("gray").fillColor("black").text(`${Math.round(e)}`,1,t+e+1)}),e.map(e=>{0!==e&&this.root.instance.moveTo(13,t+e).lineTo(this.width,t+e).stroke("#ababab")})}};class Page$1 extends Base{constructor(t,e){super(t,e),this._size=null}get name(){return"Page"}get document(){return this.parent}get page(){return this}get orientation(){return this.props.orientation}get size(){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)}resetMargins(){(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)}applyProps(){super.applyProps(),this.top=0,this.left=0,this.width=this.size.width,this.resetMargins();const t=this.getRulerWidth();this.hasHorizontalRuler()&&(this.paddingTop=this.paddingTop+t),this.hasVerticalRuler()&&(this.paddingLeft=this.paddingLeft+t)}setPadding(t,e){const r=matchPercent(e),i=t===Yoga.EDGE_TOP||t===Yoga.EDGE_BOTTOM?this.size.height:this.size.width;if(r){const e=parseFloat(r[1],10)/100;this.layout.setPadding(t,i*e)}else this.layout.setPadding(t,e)}async addDynamicChild(t,e){if(!e)return;const r=Array.isArray(e)?e:[e];for(let e=0;e<r.length;e++){const i=r[e],{type:o,props:n}=i;if("string"==typeof i){const e=new TextInstance(this.root,i);t.appendChild(e)}else if(o!==Fragment){const e=createInstance(i,this.root);await e.onAppendDynamically(),t.appendChild(e),e.applyProps(),await this.addDynamicChild(e,n.children)}else await this.addDynamicChild(t,n.children)}}async renderDynamicNodes(t,e){const r=this.children.slice(0);for(;r.length>0;){const i=r.shift();if((!e||e(i))&&i.props.render){i.removeAllChilds();const e=i.props.render(t);await this.addDynamicChild(i,e),i.fixed||(i.props.render=null)}else i.children&&r.push(...i.children)}}async nodeWillWrap(t){await this.renderDynamicNodes(t),this.calculateLayout()}onNodeSplit(t,e){e.marginTop=0,this.marginBottom=0,this.calculateLayout()}update(t){}clone(){const t=super.clone();return t._size=this.size,t}async render(){const{instance:t}=this.root;this.height=this.size.height,this.calculateLayout(),t.addPage({size:[this.size.width,this.size.height],margin:0}),this.style.backgroundColor&&t.fillColor(this.style.backgroundColor).rect(0,0,this.size.width,this.size.height).fill(),await this.renderChildren(),this.props.debug&&this.debug(),this.renderRuler()}}Page$1.defaultProps={size:"A4",orientation:"portrait",style:{},wrap:!0},_Object$assign(Page$1.prototype,Ruler);class View$1 extends Base{get name(){return"View"}async render(){this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),await this.renderChildren(),this.props.debug&&this.debug(),this.root.instance.restore()}}View$1.defaultProps={style:{},wrap:!0};const PROTOCOL_REGEXP=/^(http|https|ftp|ftps|mailto)\:\/\//i,getURL=t=>{let e=t;return"string"!=typeof e||e.match(PROTOCOL_REGEXP)||(e=`http://${e}`),e},capitalize=t=>t.replace(/(^|\s)\S/g,t=>t.toUpperCase()),IGNORABLE_CODEPOINTS=[8232,8233],buildSubsetForFont=t=>IGNORABLE_CODEPOINTS.reduce((e,r)=>t.hasGlyphForCodePoint&&t.hasGlyphForCodePoint(r)?e:[...e,String.fromCharCode(r)],[]),ignoreChars=t=>t.map(t=>{const e=buildSubsetForFont(t.attributes.font),r=new RegExp(e.join("|"));return{string:t.string.replace(r,""),attributes:t.attributes}}),PREPROCESSORS=[ignoreChars,embedEmojis],transformText=(t,e)=>{switch(e){case"uppercase":return t.toUpperCase();case"lowercase":return t.toLowerCase();case"capitalize":return capitalize(t);default:return t}},getFragments=t=>{let e=[];const{color:r="black",fontFamily:i="Helvetica",fontSize:o=18,textAlign:n="left",position:s,top:a,bottom:h,lineHeight:l,textDecoration:d,textDecorationColor:c,textDecorationStyle:g,textTransform:p,letterSpacing:u}=t.getComputedStyles();t.children.forEach(m=>{if(null!==m.value&&void 0!==m.value){const f=Font.getFont(i),y=f?f.data:i,b=transformText(m.value,p);e.push({string:b,attributes:{font:y,color:r,fontSize:o,align:n,link:t.src,characterSpacing:u,underlineStyle:g,underline:"underline"===d,underlineColor:c||r,lineHeight:l?l*o:null,yOffset:"relative"===s?-a||h||0:null}})}else m&&e.push(...getFragments(m))});for(const t of PREPROCESSORS)e=t(e);return e},getAttributedString=t=>AttributedString.fromFragments(getFragments(t)).trim(),PDFRenderer$2=createPDFRenderer({Rect:Rect});class Text$1 extends Base{constructor(t,e){super(t,e),this.start=0,this.end=0,this.computed=!1,this._container=null,this._attributedString=null,this._layoutEngine=null,this.renderCallback=e.render,this.layout.setMeasureFunc(this.measureText.bind(this))}get name(){return"Text"}get src(){return getURL(this.props.src||this.props.href)}get attributedString(){return this._attributedString||(this._attributedString=getAttributedString(this)),this._attributedString}set attributedString(t){this._attributedString=t}get container(){const t=this._container.blocks.reduce((t,e)=>[...t,...e.lines],[]);return _extends({},this._container,{blocks:[{lines:t.splice(this.start,this.end)}]})}get lines(){return this.container?this.container.blocks.reduce((t,e)=>[...t,...e.lines],[]):[]}get linesHeight(){return this._container?this.lines.reduce((t,e)=>t+e.height,0):-1}get linesWidth(){return this._container?Math.max(...this.lines.map(t=>t.advanceWidth)):-1}get layoutEngine(){if(!this._layoutEngine){const{hyphenationPenalty:t}=this.props,e=Font.getHyphenationCallback();this._layoutEngine=new LayoutEngine$1({hyphenationCallback:e,hyphenationPenalty:t})}return this._layoutEngine}set layoutEngine(t){this._layoutEngine=t}appendChild(t){t&&(t.parent=this,this.children.push(t),this.computed=!1,this._attributedString=null,this.markDirty())}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1),this.computed=!1,this._attributedString=null,this.markDirty())}lineIndexAtHeight(t){let e=0;for(let r=0;r<this.lines.length;r++){const i=this.lines[r];if(e+i.height>t)return r;e+=i.height}return this.lines.length}heightAtLineIndex(t){let e=0;for(let r=0;r<t;r++){e+=this.lines[r].height}return e}layoutText(t,e){const r=e||this.page.size.height;if(!this._container||this.props.render){const e=(new Path).rect(0,0,t,r),i=new Container(e),o=this.attributedString;this.layoutEngine.layout(o,[i]),this._container=i}const i=this._container.blocks.reduce((t,e)=>t+e.lines.length,0);this.computed=!0,this.end=i+1}measureText(t,e,r,i){return e===Yoga.MEASURE_MODE_EXACTLY?(this.layoutText(t),{height:this.style.flexGrow?NaN:this.linesHeight}):e===Yoga.MEASURE_MODE_AT_MOST||i===Yoga.MEASURE_MODE_AT_MOST?(this.layoutText(t,r),{height:this.linesHeight,width:Math.min(t,this.linesWidth)}):{}}getComputedStyles(){const t=super.getComputedStyles();return this.parent&&"Text"===this.parent.name&&"relative"===this.parent.style.position&&(t.top=t.top||this.parent.style.top,t.bottom=t.bottom||this.parent.style.bottom,t.position=t.position||"relative"),this.src&&(t.color=t.color||"blue",t.textDecoration=t.textDecoration||"underline"),t}wrapHeight(t){const{orphans:e,widows:r}=this.props,i=this.lines.length,o=t-this.paddingTop,n=this.lineIndexAtHeight(o);return i<e?t:n<e||i<e+r?0:i===e+r?this.heightAtLineIndex(e):i-n<r?t-this.heightAtLineIndex(r-1):t}onNodeSplit(t,e){const r=this.wrapHeight(t),i=this.lineIndexAtHeight(r);e.marginTop=0,e.paddingTop=0,e.start=i,e.attributedString=this.attributedString,this.height=r,this.marginBottom=0,this.paddingBottom=0,this.end=i}clone(){const t=super.clone();return t.layoutEngine=this.layoutEngine,this.props.render||this.props.fixed||(t._container=this._container),t}async render(){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);const t=this.padding,{top:e,left:r}=this.getAbsoluteLayout(),i=this.lines[0]?this.lines[0].rect.y:0;this.lines.forEach(o=>{o.rect.x+=r+t.left,o.rect.y+=e+t.top-i}),new PDFRenderer$2(this.root.instance,{outlineLines:!1}).render(this.container),this.props.debug&&this.debug(),this.root.instance.restore()}}Text$1.defaultProps={wrap:!0,widows:2,orphans:2};class Link$1 extends Base{get name(){return"Link"}get src(){return getURL(this.props.src||this.props.href)}async render(){const{top:t,left:e,width:r,height:i}=this.getAbsoluteLayout();this.root.instance.link(e,t,r,i,this.src),await this.renderChildren(),this.props.debug&&this.debug()}}class Note$1 extends Base{get name(){return"Note"}appendChild(t){if("TextInstance"!==t.name)throw new Error("Note only accepts string children");t&&(t.parent=this,this.children.push(t))}removeChild(t){const e=this.children.indexOf(t);-1!==e&&(t.parent=null,this.children.splice(e,1))}applyProps(){super.applyProps(),this.height=0,this.width=0}async render(){const{top:t,left:e}=this.getAbsoluteLayout(),r=this.children[0]?this.children[0].value:"";this.root.instance.note(e,t,0,0,r)}}Note$1.defaultProps={};const SAFETY_HEIGHT=10;class Image$1 extends Base{constructor(t,e){super(t,e),this.image=null,this.layout.setMeasureFunc(this.measureImage.bind(this))}get name(){return"Image"}shouldGrow(){return!!this.getComputedStyles().flexGrow}measureImage(t,e,r,i){const o=this.margin,n=this.page.padding,s=this.page.size.height-n.top-n.bottom-o.top-o.bottom-SAFETY_HEIGHT;if(!this.image)return{width:0,height:0};if(e===Yoga.MEASURE_MODE_EXACTLY&&i===Yoga.MEASURE_MODE_UNDEFINED){const e=t/this.ratio;return{height:Math.min(s,e)}}if(i===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&&i===Yoga.MEASURE_MODE_AT_MOST){const e=t/this.ratio;return{height:Math.min(r,s,e)}}if(e===Yoga.MEASURE_MODE_AT_MOST&&i===Yoga.MEASURE_MODE_AT_MOST){const e=Math.min(this.image.width,t);return{width:e,height:e/this.ratio}}return{height:r,width:t}}get ratio(){return this.image.data?this.image.width/this.image.height:1}async fetch(){try{this.image=await resolveImage(this.props.src,this.props.cache)}catch(t){this.image={width:0,height:0},console.warn(t.message)}}clone(){const t=super.clone();return t.image=this.image,t}async onAppendDynamically(){await this.fetch()}async render(){const t=this.padding,{left:e,top:r}=this.getAbsoluteLayout();if(this.root.instance.save(),this.applyTransformations(),this.drawBackgroundColor(),this.drawBorders(),this.image.data){const i=Math.min(this.height*this.ratio,this.width)-t.left-t.right,o=this.height-t.top-t.bottom,n=Math.max((this.width-i)/2,0);0!==i&&0!==o?this.root.instance.image(this.image.data,e+t.left+n,r+t.top,{width:i,height:o}):warning(!1,`Image with src '${this.props.src}' skipped due to invalid dimensions`)}this.props.debug&&this.debug(),this.root.instance.restore()}}Image$1.defaultProps={wrap:!1,cache:!0};const constructors={ROOT:Root,PAGE:Page$1,TEXT:Text$1,LINK:Link$1,VIEW:View$1,NOTE:Note$1,IMAGE:Image$1,DOCUMENT:Document$1,TEXT_INSTANCE:TextInstance};function createInstance(t,e){const{type:r,props:i={}}=t;if(constructors[r])return new constructors[r](e,i);throw new Error(`Invalid element of type ${r} passed to PDF renderer`)}const objectsEqual=(t,e)=>{const r=_Object$keys(t),i=_Object$keys(e);if(r.length!==i.length)return!1;for(let i=0;i<r.length;i++){const o=r[i];if("render"!==o){if("children"!==o&&t[o]!==e[o]){if("object"==typeof t[o]&&"object"==typeof e[o]&&objectsEqual(t[o],e[o]))continue;return!1}}else if(!t[o]!=!e[o])return!1}return!0},shouldReplaceLink=(t,e)=>"LINK"===t&&("string"==typeof e.children||Array.isArray(e.children)||e.render),PDFRenderer=ReactFiberReconciler({supportsMutation:!0,appendInitialChild(t,e){t.appendChild(e)},createInstance:(t,e,r)=>createInstance({type:shouldReplaceLink(t,e)?"TEXT":t,props:e},r),createTextInstance:(t,e)=>createInstance({type:"TEXT_INSTANCE",props:t},e),finalizeInitialChildren:(t,e,r)=>!1,getPublicInstance:t=>t,prepareForCommit(){},prepareUpdate:(t,e,r,i)=>!objectsEqual(r,i),resetAfterCommit(){},resetTextContent(t){},getRootHostContext:()=>emptyObject,getChildHostContext:()=>emptyObject,shouldSetTextContent:(t,e)=>!1,now:Date.now,useSyncScheduling:!0,appendChild(t,e){t.appendChild(e)},appendChildToContainer(t,e){t.appendChild(e)},insertBefore(t,e,r){t.appendChildBefore(e,r)},removeChild(t,e){t.removeChild(e)},removeChildFromContainer(t,e){t.removeChild(e)},commitTextUpdate(t,e,r){t.update(r)},commitUpdate(t,e,r,i,o){t.update(o)}});var version="1.0.0";const View="VIEW",Text="TEXT",Link="LINK",Page="PAGE",Note="NOTE",Image="IMAGE",Document="DOCUMENT",pdf=t=>{const e=createInstance({type:"ROOT"}),r=PDFRenderer.createContainer(e);function i(t){PDFRenderer.updateContainer(t,r,null)}return t&&i(t),{isDirty:function(){return e.isDirty},updateContainer:i,toBuffer:function(){return e.document.props.onRender&&e.document.props.onRender(),e.render(),e.instance},toBlob:async function(){await e.render();const t=e.instance.pipe(BlobStream());return new _Promise((r,i)=>{t.on("finish",()=>{try{const o=t.toBlob("application/pdf");e.document.props.onRender&&e.document.props.onRender({blob:o}),r(o)}catch(t){i(t)}}),t.on("error",i)})},toString:function(){let t="";return e.render(),new _Promise((r,i)=>{try{e.instance.on("data",function(e){t+=e}),e.instance.on("end",function(){e.document.props.onRender&&e.document.props.onRender({string:t}),r(t)})}catch(t){i(t)}})}}},renderToStream=function(t){return pdf(t).toBuffer()},renderToFile=function(t,e,r){const i=renderToStream(t),o=fs.createWriteStream(e);return i.pipe(o),new _Promise((t,n)=>{o.on("finish",()=>{r&&r(i,e),t(i)}),o.on("error",n)})},throwEnvironmentError=t=>{throw new Error(`${t} is a web specific API. Or you're either using this component on Node, or your bundler is not loading react-pdf from the appropiate web build.`)},PDFViewer=()=>{throwEnvironmentError("PDFViewer")},PDFDownloadLink=()=>{throwEnvironmentError("PDFDownloadLink")},BlobProvider=()=>{throwEnvironmentError("BlobProvider")},render=renderToFile;var node={pdf:pdf,View:View,Text:Text,Link:Link,Page:Page,Font:Font,Note:Note,Image:Image,version:version,Document:Document,StyleSheet:StyleSheet,PDFRenderer:PDFRenderer,createInstance:createInstance,renderToStream:renderToStream,renderToFile:renderToFile,render:renderToFile};export{renderToStream,renderToFile,PDFViewer,PDFDownloadLink,BlobProvider,render,pdf,View,Text,Link,Page,Font,Note,Image,version,Document,StyleSheet,PDFRenderer,createInstance};export default node;
//# sourceMappingURL=react-pdf.es.min.js.map
{
"name": "@react-pdf/renderer",
"version": "1.0.0-alpha.25",
"version": "1.0.0",
"license": "MIT",

@@ -25,10 +25,8 @@ "author": "Diego Muracciole <diegomuracciole@gmail.com>",

"dependencies": {
"@react-pdf/fontkit": "^1.11.0",
"@react-pdf/fontkit": "^1.13.0",
"@react-pdf/pdfkit": "^1.2.0",
"@react-pdf/png-js": "^1.0.0",
"@react-pdf/script-itemizer": "^0.1.12",
"@react-pdf/textkit-core": "^0.1.23",
"@react-pdf/script-itemizer": "^0.2.1",
"@react-pdf/textkit-core": "^0.2.0",
"@textkit/justification-engine": "^0.1.9",
"@textkit/line-fragment-generator": "^0.1.9",
"@textkit/linebreaker": "^0.1.9",
"@textkit/pdf-renderer": "^0.1.11",

@@ -50,3 +48,2 @@ "@textkit/text-decoration-engine": "^0.1.10",

"lodash.topairsin": "^4.3.0",
"lodash.upperfirst": "^4.3.1",
"media-engine": "^1.0.3",

@@ -53,0 +50,0 @@ "page-wrapping": "^1.1.0",

@@ -62,3 +62,3 @@ <p align="center">

### Render in DOM
### `Web.` Render in DOM
```jsx

@@ -71,3 +71,3 @@ import React from 'react';

### Save in a file
### `Node.` Save in a file
```jsx

@@ -80,3 +80,3 @@ import React from 'react';

### Render in mobile
### `Native.` Render in mobile
> Coming soon

@@ -83,0 +83,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc