Comparing version 0.0.25 to 0.0.26
@@ -1,5 +0,5 @@ | ||
var Ot=Object.defineProperty,Ft=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var dt=(e,n,t)=>n in e?Ot(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,G=(e,n)=>{for(var t in n||(n={}))Pt.call(n,t)&&dt(e,t,n[t]);if(ct)for(var t of ct(n))Wt.call(n,t)&&dt(e,t,n[t]);return e},se=(e,n)=>Ft(e,$t(n));import*as Nt from"yoga-layout-prebuilt";var pt=Nt;var Pe;Pe=pt.default;function Mt(e){Pe=e}function te(){return Pe}function We(e){let n=typeof e;return!(n==="number"||n==="bigint"||n==="string"||n==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}function K(e,n,t){let o=n[e];return typeof o=="undefined"?t:o}var gt=void 0,Ne=typeof Intl!="undefined"&&"Segmenter"in Intl;if(!Ne)throw new Error("Intl.Segmenter does not exist, please use import a polyfill.");var Gt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Dt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,Ce=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e));function le(e,n){return n==="word"?[...Gt.segment(e)].map(t=>t.segment):[...Dt.segment(e)].map(t=>t.segment)}function x(e,n,t){let o="";for(let[a,i]of Object.entries(n))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return t?`<${e}${o}>${t}</${e}>`:`<${e}${o}/>`}var ht={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var Bt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Me(e){let n={};for(let t in e)Bt.has(t)&&(n[t]=e[t]);return n}import{getPropertyName as tn,getStylesForProperty as nn}from"css-to-react-native";import{parseElementStyle as rn}from"css-background-parser";var ye=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Yt=ye((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Ht=ye((e,n)=>{n.exports=["deg","grad","rad","turn"]}),Xt=ye((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),Ut=ye((e,n)=>{n.exports=["Hz","kHz"]}),zt=ye((e,n)=>{n.exports=["s","ms"]}),jt=Yt(),bt=Ht(),yt=Xt(),xt=Ut(),Et=zt();function De(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(Vt(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ge(e),this.unit="%";return}var n=Kt(e);if(!n){this.type="number",this.value=Ge(e);return}this.type=Zt(n),this.value=Ge(e.substr(0,e.length-n.length)),this.unit=n}De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+(this.unit||"")};function fe(e){return new De(e)}function Vt(e){var n=e.match(/\./g);return n?n.length:0}function Ge(e){var n=parseFloat(e);if(isNaN(n))throw new Error("Invalid number: "+e);return n}var Jt=[].concat(bt,xt,jt,yt,Et);function Kt(e){var n=e.match(/\D+$/),t=n&&n[0];if(t&&Jt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var qt=Object.assign(Le(bt,"angle"),Le(xt,"frequency"),Le(yt,"resolution"),Le(Et,"time"));function Le(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function Zt(e){return qt[e]||"length"}import Qt from"postcss-value-parser";function en(e,n){try{let t=new fe(e);switch(t.unit){case"px":return{absolute:t.value};case"em":return{absolute:t.value*n};case"rem":return{absolute:t.value*16};case"%":return{relative:t.value};default:return{}}}catch{return{}}}function Be(e,n,t){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let o=en(e,n);return o.absolute?{[t?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[t?"xRelative":"yRelative"]:o.relative}:{}}}function Ye(e,n){if(typeof e=="number")return{xAbsolute:e};let t;try{t=Qt(e).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return t.length===1?Be(t[0],n,!0):t.length===2?((t[0]==="top"||t[0]==="bottom"||t[1]==="left"||t[1]==="right")&&t.reverse(),G(G({},Be(t[0],n,!0)),Be(t[1],n,!1))):{}}var on=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),an=new Set(["lineHeight"]),St=[1,0,0,1,0,0];function sn(e,n,t,o){return e==="border"&&!t.includes(n.borderColor)?n.borderColor=o:e==="textDecoration"&&!t.includes(n.textDecorationColor)&&(n.textDecorationColor=o),n}function _t(e,n){return typeof n=="number"?on.has(e)?an.has(e)?n:String(n):n+"px":n}function ln(e,n){return e==="lineHeight"?{lineHeight:_t(e,n)}:e==="fontFamily"?{fontFamily:n.split(",").map(t=>t.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,n,t,{percentage:o}={percentage:!1}){if(typeof e=="number")return e;try{let a=new fe(e);if(a.type==="length")switch(a.unit){case"em":return a.value*n;case"rem":return a.value*16;case"vw":return~~(a.value*t._viewportWidth/100);case"vh":return~~(a.value*t._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&o)return a.value/100*n}catch{}}function Ie(e,n){let t={};for(let a in e){if(a.startsWith("_")){t[a]=e[a];continue}let i=tn(a);Object.assign(t,ln(i,e[a])||sn(i,nn(i,_t(i,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=rn(t);t.backgroundImage=a}let o=t.fontSize||n.fontSize;if(typeof o=="string")try{let a=new fe(o);switch(a.unit){case"em":o=a.value*n.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof t.fontSize!="undefined"&&(t.fontSize=o),t.transformOrigin&&(t.transformOrigin=Ye(t.transformOrigin,o));for(let a in t){let i=t[a];if(a==="lineHeight")typeof i=="string"&&(i=t[a]=He(i,o,n,{percentage:!0})/o);else if(typeof i=="string"){let r=He(i,o,n);typeof r!="undefined"&&(t[a]=r),i=t[a]}if(a==="opacity"&&(i=t[a]=i*n.opacity),a==="transform"){let r=[...St],s=i;for(let f of s){let m=Object.keys(f)[0],g=f[m],c=typeof g=="string"?He(g,o,n):g,d=[...St];switch(m){case"translateX":d[4]=c;break;case"translateY":d[5]=c;break;case"scale":d[0]=c,d[3]=c;break;case"scaleX":d[0]=c;break;case"scaleY":d[3]=c;break;case"rotate":let h=c*Math.PI/180,l=Math.cos(h),u=Math.sin(h);d[0]=l,d[1]=u,d[2]=-u,d[3]=l;break;case"skewX":d[2]=Math.tan(c*Math.PI/180);break;case"skewY":d[1]=Math.tan(c*Math.PI/180);break}r=ge(d,r)}t.transform=r}}return t}function Xe(e,n,t,o,a){let i=te(),r=G(G(G({},t),Ie(ht[n],t)),Ie(o,t));if(n==="img"){let s=parseInt(a.width),m=parseInt(a.height)/s;r.width||(r.width=s),r.height||(r.height=m*r.width)}return e.setDisplay(K(r.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),e.setAlignContent(K(r.alignContent,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,"space-between":i.ALIGN_SPACE_BETWEEN,"space-around":i.ALIGN_SPACE_AROUND,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setAlignItems(K(r.alignItems,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_FLEX_START)),e.setAlignSelf(K(r.alignSelf,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setJustifyContent(K(r.justifyContent,{center:i.JUSTIFY_CENTER,"flex-start":i.JUSTIFY_FLEX_START,"flex-end":i.JUSTIFY_FLEX_END,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND},i.JUSTIFY_FLEX_START)),e.setFlexDirection(K(r.flexDirection,{row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE},i.FLEX_DIRECTION_ROW)),e.setFlexWrap(K(r.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof r.flexBasis!="undefined"&&e.setFlexBasis(r.flexBasis),e.setFlexGrow(typeof r.flexGrow=="undefined"?0:r.flexGrow),e.setFlexShrink(typeof r.flexShrink=="undefined"?0:r.flexShrink),typeof r.maxHeight!="undefined"&&e.setMaxHeight(r.maxHeight),typeof r.maxWidth!="undefined"&&e.setMaxWidth(r.maxWidth),typeof r.minHeight!="undefined"&&e.setMinHeight(r.minHeight),typeof r.minWidth!="undefined"&&e.setMinWidth(r.minWidth),e.setOverflow(K(r.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),e.setMargin(i.EDGE_TOP,r.marginTop||0),e.setMargin(i.EDGE_BOTTOM,r.marginBottom||0),e.setMargin(i.EDGE_LEFT,r.marginLeft||0),e.setMargin(i.EDGE_RIGHT,r.marginRight||0),e.setBorder(i.EDGE_TOP,r.borderWidth||0),e.setBorder(i.EDGE_BOTTOM,r.borderWidth||0),e.setBorder(i.EDGE_LEFT,r.borderWidth||0),e.setBorder(i.EDGE_RIGHT,r.borderWidth||0),e.setPadding(i.EDGE_TOP,r.paddingTop||0),e.setPadding(i.EDGE_BOTTOM,r.paddingBottom||0),e.setPadding(i.EDGE_LEFT,r.paddingLeft||0),e.setPadding(i.EDGE_RIGHT,r.paddingRight||0),e.setPositionType(K(r.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof r.top!="undefined"&&e.setPosition(i.EDGE_TOP,r.top),typeof r.bottom!="undefined"&&e.setPosition(i.EDGE_BOTTOM,r.bottom),typeof r.left!="undefined"&&e.setPosition(i.EDGE_LEFT,r.left),typeof r.right!="undefined"&&e.setPosition(i.EDGE_RIGHT,r.right),typeof r.height!="undefined"?e.setHeight(r.height):e.setHeightAuto(),typeof r.width!="undefined"?e.setWidth(r.width):e.setWidthAuto(),[r,Me(r)]}function ue({left:e,top:n,width:t,height:o},a,i,r){var f,m,g,c;let s;if(i)s=a;else{let d=(m=r==null?void 0:r.xAbsolute)!=null?m:((f=r==null?void 0:r.xRelative)!=null?f:50)*t/100,h=(c=r==null?void 0:r.yAbsolute)!=null?c:((g=r==null?void 0:r.yRelative)!=null?g:50)*o/100,l=e+d,u=n+h;s=ge([1,0,0,1,l,u],ge(a,[1,0,0,1,-l,-u])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(d=>d.toFixed(2)).join(",")})`}function Tt({left:e,top:n,width:t,height:o,isInheritingTransform:a},i){let r="",s=1;return i.transform&&(r=ue({left:e,top:n,width:t,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:r,opacity:s}}function Ue({id:e,content:n,filter:t,left:o,top:a,width:i,height:r,matrix:s,opacity:f,image:m,clipPathId:g,debug:c,shape:d,decorationShape:h},l){let u="";if(c&&(u=x("rect",{x:o,y:a-r,width:i,height:r,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),m){let y={href:m,x:o,y:a,width:i,height:r,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("image",se(G({},y),{opacity:f!==1?f:void 0}))+(h||"")+(t?"</g>":"")+u,""]}let b={x:o,y:a,width:i,height:r,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("text",se(G({},b),{fill:l.color,opacity:f!==1?f:void 0}),n)+(h||"")+(t?"</g>":"")+u,d?x("text",b,n):""]}function ce({id:e,width:n,height:t},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=o.shadowRadius*o.shadowRadius/4,i=Math.min(o.shadowOffset.width-a,0),r=Math.max(o.shadowOffset.width+a+n,n),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+t,t);return`<defs><filter id="satori_s-${e}" x="${i/n*100}%" y="${s/t*100}%" width="${(r-i)/n*100}%" height="${(f-s)/t*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:n,top:t,ascender:o,clipPathId:a},i){let{textDecorationColor:r,textDecorationStyle:s,textDecorationLine:f,fontSize:m}=i;if(!f||f==="none")return"";let g=Math.max(1,m*.1),c=f==="line-through"?t+o*.5:f==="underline"?t+o*1.1:t,d=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return x("line",{x1:n,y1:c,x2:n+e,y2:c,stroke:r,"stroke-width":g,"stroke-dasharray":d,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var je=void 0;function*Ve(e,n){var lt;let t=te(),{parentStyle:o,inheritedStyle:a,parent:i,font:r,id:s,isInheritingTransform:f,debug:m,embedFont:g,graphemeImages:c,canLoadAdditionalAssets:d}=n;o.textTransform==="uppercase"?e=e.toLocaleUpperCase(je):o.textTransform==="lowercase"?e=e.toLocaleLowerCase(je):o.textTransform==="capitalize"&&(e=le(e,"word").map(C=>le(C,"grapheme").map((O,F)=>F===0?O.toLocaleUpperCase(je):O).join("")).join(""));let h=K(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),u=t.Node.create();u.setAlignItems(t.ALIGN_BASELINE),o.textAlign==="left"?u.setJustifyContent(t.JUSTIFY_FLEX_START):o.textAlign==="center"?u.setJustifyContent(t.JUSTIFY_CENTER):o.textAlign==="right"?u.setJustifyContent(t.JUSTIFY_FLEX_END):o.textAlign==="justify"&&u.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),i.insertChild(u,i.getChildCount());let{textAlign:b,textOverflow:y,whiteSpace:S,lineHeight:_,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,T=r.getEngine(N,_,o),H=d?l.filter(C=>!T.check(C)):[];yield H,H.length&&(T=r.getEngine(N,_,o));let w=[],k=[],X=[],q=[],Q=new Map,R=C=>{let O=0;for(let F of C){if(Q.has(F)){O+=Q.get(F);continue}let Y=T.measure(F,o);Q.set(F,Y),O+=Y}return O},$=0,v=[],p=0;for(let C of l){let O=!1,F=c&&c[C];S==="pre"?O=C[0]===` | ||
`:S!=="nowrap"&&(F||Ce.includes(C[0]))&&(O=!0),O?(S==="nowrap"?p+=R(v)+o.fontSize:($=Math.max($,R(v)),F&&($=Math.max($,o.fontSize))),v=[]):(!Ce.includes(C[0])||!v.length)&&v.push(C===` | ||
`?" ":C)}$=Math.max($,R(v)+p);let E=i.getMinWidth(),A=i.getMaxWidth(),Z=i.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(A.value)||A.unit===1&&($=Math.min($,A.value)),i.setMinWidth($)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let he=S==="pre-wrap"||S==="pre";u.setMeasureFunc(C=>{let O=0,F="",Y=0,U=0,z=0,j=-1,ie=0,P=0,oe=0;w=[],X=[0];for(let re=0;re<l.length;re++){let D=l[re];if(!he&&Ce.includes(D[0]))F||(F=" "),Y=R([F]),q[re]=null;else{let ae=he&&D===` | ||
`,V=ae?0:c&&c[D]?o.fontSize:R([D]);U||(F="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+V>C&&S!=="nowrap"&&S!=="pre")w.push(U),k.push(oe),O++,ie+=P,U=V,P=V?T.height(D):0,oe=V?T.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,C));else{U+=Y+V;let me=T.height(D);me>P&&(P=me,oe=T.baseline(D)),J&&X[X.length-1]++}F="",Y=0,J&&j++,z=Math.max(z,U),q[re]={y:ie,x:U-V,width:V,line:O,lineIndex:j}}}return U&&(O++,w.push(U),k.push(oe),ie+=P),{width:z,height:ie}});let[It,kt]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:_e,height:ot}=u.getComputedLayout(),Fe=i.getComputedWidth()-i.getComputedPadding(t.EDGE_LEFT)-i.getComputedPadding(t.EDGE_RIGHT)-i.getComputedBorder(t.EDGE_LEFT)-i.getComputedBorder(t.EDGE_RIGHT),de=It+rt,pe=kt+it,{matrix:ee,opacity:Te}=Tt({left:rt,top:it,width:_e,height:ot,isInheritingTransform:f},o),we="";o.textShadowOffset&&(we=ce({width:_e,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let be="",Re="",at="",$e=-1,st=y==="ellipsis"?R(["\u2026"]):0,At=y==="ellipsis"?R([" "]):0,ve={};for(let C=0;C<l.length;C++){if(!q[C])continue;let O=q[C],F=l[C],Y=null,U=c?c[F]:null,z=O.y,j=O.x,ie=O.width,P=O.line;if(P===$e)continue;let oe=!1;if(w.length>1){let B=_e-w[P];if(b==="right"||b==="end")j+=B;else if(b==="center")j+=B/2;else if(b==="justify"&&P<w.length-1){let J=X[P];j+=(J>1?B/(J-1):0)*O.lineIndex,oe=!0}}if(ve[P]||(ve[P]=[j,oe?_e:w[P]]),y==="ellipsis"&&w[P]>Fe&&O.x+ie+st+At>Fe){let B=le(F,"grapheme"),J="",me=0;for(let ft of B){let ut=O.x+R([J+ft]);if(J&&ut+st>Fe)break;J+=ft,me=ut}F=J+"\u2026",$e=P,ve[P][1]=me}let re=k[P],D=T.baseline(F),ae=T.height(F),V=re-D;if(U?z+=0:g?(Y=T.getSVG(F,se(G({},o),{left:de+j,top:pe+z+D+V,letterSpacing:o.letterSpacing})),m&&(at+=x("rect",{x:de+j,y:pe+z+V,width:O.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0})+x("line",{x1:de+j,x2:de+j+O.width,y1:pe+z+V+D,y2:pe+z+V+D,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0}))):z+=D+V,o.textDecorationLine&&(P!==((lt=q[C+1])==null?void 0:lt.line)||$e===P)){let B=ve[P];B&&!B[2]&&(be+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:T.baseline(F),clipPathId:ne},o),B[2]=1)}if(Y!==null)Re+=Y+" ";else{let[B,J]=Ue({content:F,filter:we,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:Te,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:be},o);Oe+=B,Se+=J,be=""}}if(Re){let C=o.color!=="transparent"&&Te!==0?x("path",{fill:o.color,d:Re,transform:ee||void 0,opacity:Te!==1?Te:void 0,"clip-path":ne?`url(#${ne})`:void 0,style:M?`filter:${M}`:void 0}):"";W&&(Se=x("path",{d:Re,transform:ee||void 0})),Oe+=(we?we+x("g",{filter:`url(#satori_s-${s})`},C+be):C+be)+at}return Se&&(o._inheritedBackgroundClipTextPath.value+=Se),Oe}var Je=Je||{};Je.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},n="";function t(p){var E=new Error(n+": "+p);throw E.source=n,E}function o(){var p=a();return n.length>0&&t("Invalid input not EOF"),p}function a(){return _(i)}function i(){return r("linear-gradient",e.linearGradient,f)||r("repeating-linear-gradient",e.repeatingLinearGradient,f)||r("radial-gradient",e.radialGradient,c)||r("repeating-radial-gradient",e.repeatingRadialGradient,c)}function r(p,E,A){return s(E,function(Z){var he=A();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:_(M)}})}function s(p,E){var A=$(p);if(A){$(e.startCall)||t("Missing (");var Z=E(A);return $(e.endCall)||t("Missing )"),Z}}function f(){return m()||g()}function m(){return R("directional",e.sideOrCorner,1)}function g(){return R("angular",e.angleValue,1)}function c(){var p,E=d(),A;return E&&(p=[],p.push(E),A=n,$(e.comma)&&(E=d(),E?p.push(E):n=A)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var A=b();A&&(p.at=A)}else{var Z=y();Z&&(p={type:"default-radial",at:Z})}}return p}function h(){var p=R("shape",/^(circle)/i,0);return p&&(p.style=Q()||u()),p}function l(){var p=R("shape",/^(ellipse)/i,0);return p&&(p.style=X()||u()),p}function u(){return R("extent-keyword",e.extentKeywords,1)}function b(){if(R("position",/^at/,0)){var p=y();return p||t("Missing positioning value"),p}}function y(){var p=S();if(p.x||p.y)return{type:"position",value:p}}function S(){return{x:X(),y:X()}}function _(p){var E=p(),A=[];if(E)for(A.push(E);$(e.comma);)E=p(),E?A.push(E):t("One extra comma");return A}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return T()||w()||H()||N()}function N(){return R("literal",e.literalColor,0)}function T(){return R("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:_(k)}})}function w(){return s(e.rgbaColor,function(){return{type:"rgba",value:_(k)}})}function k(){return $(e.number)[1]}function X(){return R("%",e.percentageValue,1)||q()||Q()}function q(){return R("position-keyword",e.positionKeywords,1)}function Q(){return R("px",e.pixelValue,1)||R("em",e.emValue,1)}function R(p,E,A){var Z=$(E);if(Z)return{type:p,value:Z[A]}}function $(p){var E,A;return A=/^[\n\r\t\s]+/.exec(n),A&&v(A[0].length),E=p.exec(n),E&&v(E[0].length),E}function v(p){n=n.substr(p)}return function(p){return n=p.toString(),o()}}();var Ke=Je;function fn(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function un(e,n){return typeof e=="string"&&e.endsWith("%")?n*parseFloat(e)/100:+e}function wt(e,{x:n,y:t,defaultX:o,defaultY:a}){return(e?e.split(" ").map(i=>{try{let r=new fe(i);return r.type==="length"||r.type==="number"?r.value:r.value+r.unit}catch{return null}}).filter(i=>i!==null):[o,a]).map((i,r)=>un(i,[n,t][r]))}function Rt(e,n){let t=[];for(let r of n){let s=fn(r);if(!t.length&&(t.push({offset:0,color:s}),typeof r.length=="undefined"||r.length.value==="0"))continue;let f=typeof r.length=="undefined"?void 0:r.length.type==="%"?r.length.value/100:r.length.value/e;t.push({offset:f,color:s})}t.length||t.push({offset:0,color:"transparent"});let o=t[t.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:t.push({offset:1,color:o.color}));let a=0,i=1;for(let r=0;r<t.length;r++)if(typeof t[r].offset=="undefined"){for(i<r&&(i=r);typeof t[i].offset=="undefined";)i++;t[r].offset=(t[i].offset-t[a].offset)/(i-a)*(r-a)+t[a].offset}else a=r;return t}function qe({id:e,width:n,height:t},{image:o,size:a,position:i,repeat:r}){r=r||"repeat";let s=r==="repeat-x"||r==="repeat",f=r==="repeat-y"||r==="repeat",m=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(i,{x:n,y:t,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let c=Ke.parse(o)[0],d,h,l,u;if(c.orientation.type==="directional")[d,h,l,u]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[c.orientation.value];else if(c.orientation.type==="angular"){let y=+c.orientation.value/180*Math.PI-Math.PI/2,S=Math.cos(y),_=Math.sin(y);d=0,h=0,l=S,u=_,l<0&&(d-=l,l=0),u<0&&(h-=u,u=0)}let b=Rt(n,c.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${d}" y1="${h}" x2="${l}" y2="${u}">${b.map(y=>`<stop offset="${y.offset*100}%" stop-color="${y.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let c=Ke.parse(o)[0],d=c.orientation[0],[h,l]=m,u="circle",b=h/2,y=l/2;if(d.type==="shape"){if(u=d.value,d.at)if(d.at.type==="position")b=d.at.value.x.value,y=d.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+d.at.type)}else throw new Error("orientation.type not implemented: "+d.type);let S=Rt(n,c.colorStops),_=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),T=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+T*T);else if(u==="ellipse"){let k=T!==0?N/T:1;W.ry=Math.sqrt(N*N+T*T*k*k)/k,W.rx=W.ry*k}let H=x("pattern",{id:M,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},x("radialGradient",{id:_},S.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${_})`})));return[M,H]}if(o.startsWith("url(")){let c=o.slice(4,-1);return[`satori_bi${e}`,x("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?m[0]:"100%",height:f?m[1]:"100%"},x("image",{x:0,y:0,width:m[0],height:m[1],href:c}))]}}function ke(e,n,t){return t<e+n&&(t/2<e&&t/2<n?e=n=t/2:t/2<e?e=t-n:t/2<n&&(n=t-e)),[e,n]}function xe({left:e,top:n,width:t,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:r,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return i=Math.min(i||0,t,o),r=Math.min(r||0,t,o),s=Math.min(s||0,t,o),f=Math.min(f||0,t,o),!i&&!r&&!s&&!f?"":([i,r]=ke(i,r,t),[i,s]=ke(i,s,o),[r,f]=ke(r,f,o),[s,f]=ke(s,f,t),`M${e+i},${n} h${t-i-r} a${r},${r} 0 0 1 ${r},${r} v${o-r-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-t} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function Ze({left:e,top:n,width:t,height:o,path:a,id:i},r){return r.overflow!=="hidden"?"":a?x("clipPath",{id:`satori_cp-${i}`,"clip-path":r._inheritedClipPathId?`url(#${r._inheritedClipPathId})`:void 0},x("path",{x:e,y:n,width:t,height:o,d:a})):x("clipPath",{id:`satori_cp-${i}`,"clip-path":r._inheritedClipPathId?`url(#${r._inheritedClipPathId})`:void 0},x("rect",{x:e,y:n,width:t,height:o}))}function Qe({id:e,left:n,top:t,width:o,height:a,isInheritingTransform:i,debug:r},s){if(s.display==="none")return"";let f="rect",m="transparent",g=0,c="",d="",h=[],l=1,u="";s.backgroundColor&&h.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,m=s.borderColor),s.opacity&&(l=+s.opacity),s.transform&&(c=ue({left:n,top:t,width:o,height:a},s.transform,i,s.transformOrigin));let b="";if(s.backgroundImage){let H=s.backgroundImage.map((w,k)=>qe({id:e+"_"+k,width:o,height:a},w)).filter(Boolean);for(let w of H)h.push(`url(#${w[0]})`),d+=w[1],w[2]&&(b+=w[2])}let y=xe({left:n,top:t,width:o,height:a},s);y&&(f="path");let S=Ze({left:n,top:t,width:o,height:a,path:y,id:e},s),_=s._inheritedClipPathId,M=ce({width:o,height:a,id:e},s);r&&(u=x("rect",{x:n,y:t,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:c||void 0,"clip-path":_?`url(#${_})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,T=h.map((H,w)=>{if(H==="transparent"&&!(w===h.length-1&&g))return"";let k=w===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:H,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:_?`url(#${_})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(T=x(f,{x:n,y:t,width:o,height:a,fill:"transparent",stroke:m,"stroke-width":g,d:y||void 0,transform:c||void 0,"clip-path":_?`url(#${_})`:void 0})+T),(d?`<defs>${d}</defs>`:"")+S+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||T)+(l!==1?"</g>":"")+(M?"</g>":"")+u}function et({id:e,left:n,top:t,width:o,height:a,src:i,debug:r,isInheritingTransform:s},f){if(f.display==="none")return"";let m="",g=1,c="",d=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=xe({left:n,top:t,width:o,height:a},f),l=f._inheritedClipPathId;h&&(m=x("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},x("path",{x:n,y:t,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let u=ce({width:o,height:a,id:e},f);return f.transform&&(c=ue({left:n,top:t,width:o,height:a},f.transform,s,f.transformOrigin)),u+(u?`<g filter="url(#satori_s-${e})">`:"")+m+x("image",{x:n,y:t,width:o,height:a,href:i,preserveAspectRatio:d,transform:c||void 0,"clip-path":m?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(u?"</g>":"")}function*Ee(e,n){let t=te(),{id:o,inheritedStyle:a,parent:i,font:r,debug:s,embedFont:f=!0,graphemeImages:m,canLoadAdditionalAssets:g}=n;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let v;if(!We(e))v=Ve(String(e),n),yield v.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");v=Ee(e.type(e.props),n),yield v.next().value}v.next();let p=yield;return v.next(p).value}let{type:c,props:d}=e,{style:h,children:l}=d,u=t.Node.create();i.insertChild(u,i.getChildCount());let[b,y]=Xe(u,c,a,h,d),S=b.transform===a.transform;if(S||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(y._inheritedClipPathId=`satori_cp-${o}`),b.backgroundClip==="text"){let v={value:""};y._inheritedBackgroundClipTextPath=v,b._inheritedBackgroundClipTextPath=v}let _=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let v of _){let p=Ee(v,{id:o+"-"+W++,parentStyle:b,inheritedStyle:y,isInheritingTransform:!0,parent:u,font:r,embedFont:f,debug:s,graphemeImages:m,canLoadAdditionalAssets:g});g?N.push(...p.next().value||[]):p.next(),M.push(p)}yield N;for(let v of M)v.next();let[T,H]=yield;b.position==="absolute"&&u.calculateLayout();let{left:w,top:k,width:X,height:q}=u.getComputedLayout();w+=T,k+=H;let Q="",R="",$="";c==="img"?R=et({id:o,left:w,top:k,width:X,height:q,src:d.src,isInheritingTransform:S,debug:s},b):R=Qe({id:o,left:w,top:k,width:X,height:q,isInheritingTransform:S,debug:s},b);for(let v of M)Q+=v.next([w,k]).value;return b._inheritedBackgroundClipTextPath&&($+=x("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+R+Q}import cn from"@shuding/opentype.js";function dn(e,n,[t,o],[a,i]){if(t!==a)return t?!a||t===e?-1:a===e?1:e===400&&t===500||e===500&&t===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?t<e&&a<e?a-t:t<e?-1:a<e?1:t-a:e<t&&e<a?t-a:e<t?-1:e<a?1:a-t:1;if(o!==i){if(o===n)return-1;if(i===n)return 1}return-1}var Ae=class{constructor(n){this.fonts=new Map;this.addFonts(n)}get({name:n,weight:t,style:o}){if(!this.fonts.has(n))return null;t==="normal"&&(t=400),t==="bold"&&(t=700);let a=[...this.fonts.get(n)],i=a[0];for(let r=1;r<a.length;r++){let[,s,f]=i,[,m,g]=a[r];dn(t,o,[s,f],[m,g])>0&&(i=a[r])}return i[0]}addFonts(n){for(let t of n){let o=t.data,a=cn.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0}),i=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let f=i.call(a,s);return f===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),f},this.defaultFont||(this.defaultFont=a);let r=t.name.toLowerCase();this.fonts.has(r)||this.fonts.set(r,[]),this.fonts.get(r).push([a,t.weight,t.style])}}getEngine(n=16,t=1.2,{fontFamily:o,fontWeight:a=400,fontStyle:i="normal"}){o=Array.isArray(o)?o:[o];let r=o.map(l=>this.get({name:l,weight:a,style:i})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)o.includes(l)||r.push(this.get({name:l,weight:a,style:i}));let f=new Map,m=(l,u=!0)=>{let b=l.charCodeAt(0);if(f.has(b))return f.get(b);let y=r.find((S,_)=>!!S.charToGlyphIndex(l)||u&&_===r.length-1);return y&&f.set(b,y),y},g=(l,u=!1)=>{var y,S;return((u?(S=(y=l.tables)==null?void 0:y.os2)==null?void 0:S.sTypoAscender:0)||l.ascender)/l.unitsPerEm*n},c=(l,u=!1)=>{var y,S;return((u?(S=(y=l.tables)==null?void 0:y.os2)==null?void 0:S.sTypoDescender:0)||l.descender)/l.unitsPerEm*n},d=l=>m(l,!1),h={check:l=>{let u=d(l);return u?(u._trackBrokenChars=[],u.stringToGlyphs(l),u._trackBrokenChars.length?(u._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,u=typeof l=="undefined"?r[0]:m(l))=>{let b=g(u,!0),y=c(u,!0),S=h.height(l,u),{yMax:_,yMin:M}=u.tables.head,W=b-y,N=(_/(_-M)-1)*W;return S*((1.2/t+1)/2)+N},height:(l,u=typeof l=="undefined"?r[0]:m(l))=>(g(u)-c(u))*(t/1.2),measure:(l,u)=>this.measure(m,l,u),getSVG:(l,u)=>this.getSVG(m,l,u)};return h}patchFontFallbackResolver(n,t){let o=[];n._trackBrokenChars=o;let a=n.stringToGlyphs;return n.stringToGlyphs=(i,...r)=>{let s=a.call(n,i,...r);for(let f=0;f<s.length;f++)if(s[f].unicode===void 0){let m=o.shift(),g=t(m);g!==n&&(s[f]=g.charToGlyph(m))}return s},()=>{n.stringToGlyphs=a,n._trackBrokenChars=void 0}}measure(n,t,{fontSize:o,letterSpacing:a=0}){let i=n(t),r=this.patchFontFallbackResolver(i,n);try{return i.getAdvanceWidth(t,o,{letterSpacing:a/o})}finally{r()}}getSVG(n,t,{fontSize:o,top:a,left:i,letterSpacing:r=0}){let s=n(t),f=this.patchFontFallbackResolver(s,n);try{return s.getPath(t,i,a,o,{letterSpacing:r/o}).toPathData(1)}finally{f()}}};function tt({width:e,height:n,content:t}){return x("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,xmlns:"http://www.w3.org/2000/svg"},t)}var vt={emoji:/\p{Emoji_Presentation}/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Ct(e){for(let n in vt)if(vt[n].test(e))return n;return"unknown"}var nt=new WeakMap;async function Lt(e,n){let t=te();if(!t)throw new Error("Satori is not initialized.");let o;nt.has(n.fonts)?o=nt.get(n.fonts):nt.set(n.fonts,o=new Ae(n.fonts));let a=t.Node.create();a.setWidth(n.width),a.setHeight(n.height),a.setFlexDirection(t.FLEX_DIRECTION_ROW),a.setFlexWrap(t.WRAP_WRAP),a.setAlignContent(t.ALIGN_AUTO),a.setAlignItems(t.ALIGN_FLEX_START),a.setJustifyContent(t.JUSTIFY_FLEX_START),a.setOverflow(t.OVERFLOW_HIDDEN);let i=G({},n.graphemeImages),r=Ee(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:n.width,_viewportHeight:n.height},parent:a,font:o,embedFont:n.embedFont,debug:n.debug,graphemeImages:i,canLoadAdditionalAssets:!!n.loadAdditionalAsset}),s=r.next().value;if(n.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let m={};s.forEach(d=>{let h=Ct(d);m[h]=m[h]||[],h==="emoji"?m[h].push(d):m[h][0]=(m[h][0]||"")+d});let g=[],c={};await Promise.all(Object.entries(m).flatMap(([d,h])=>h.map(l=>n.loadAdditionalAsset(d,l).then(u=>{typeof u=="string"?c[l]=u:u&&g.push(u)})))),o.addFonts(g),Object.assign(i,c)}r.next(),a.calculateLayout(n.width,n.height,t.DIRECTION_LTR);let f=r.next([0,0]).value;return a.freeRecursive(),tt({width:n.width,height:n.height,content:f})}export{Lt as default,Mt as init}; | ||
var Ft=Object.defineProperty,Ot=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var dt=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))Pt.call(t,r)&&dt(e,r,t[r]);if(ct)for(var r of ct(t))Wt.call(t,r)&&dt(e,r,t[r]);return e},se=(e,t)=>Ot(e,$t(t));import*as Mt from"yoga-layout-prebuilt";var pt=Mt;var Pe;Pe=pt.default;function Nt(e){Pe=e}function te(){return Pe}function We(e){let t=typeof e;return!(t==="number"||t==="bigint"||t==="string"||t==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Z(e,t,r){let o=t[e];return typeof o=="undefined"?r:o}var gt=void 0,Me=typeof Intl!="undefined"&&"Segmenter"in Intl;if(!Me)throw new Error("Intl.Segmenter does not exist, please use import a polyfill.");var Gt=Me?new Intl.Segmenter(gt,{granularity:"word"}):null,Dt=Me?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,Ce=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e));function le(e,t){return t==="word"?[...Gt.segment(e)].map(r=>r.segment):[...Dt.segment(e)].map(r=>r.segment)}function y(e,t,r){let o="";for(let[a,i]of Object.entries(t))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return r?`<${e}${o}>${r}</${e}>`:`<${e}${o}/>`}var ht={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var Bt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Ne(e){let t={};for(let r in e)Bt.has(r)&&(t[r]=e[r]);return t}import{getPropertyName as tr,getStylesForProperty as rr}from"css-to-react-native";import{parseElementStyle as nr}from"css-background-parser";var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=ye((e,t)=>{t.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Ht=ye((e,t)=>{t.exports=["deg","grad","rad","turn"]}),Xt=ye((e,t)=>{t.exports=["dpi","dpcm","dppx"]}),Ut=ye((e,t)=>{t.exports=["Hz","kHz"]}),zt=ye((e,t)=>{t.exports=["s","ms"]}),jt=Yt(),bt=Ht(),yt=Xt(),xt=Ut(),Et=zt();function De(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(Vt(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ge(e),this.unit="%";return}var t=Kt(e);if(!t){this.type="number",this.value=Ge(e);return}this.type=Zt(t),this.value=Ge(e.substr(0,e.length-t.length)),this.unit=t}De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+(this.unit||"")};function fe(e){return new De(e)}function Vt(e){var t=e.match(/\./g);return t?t.length:0}function Ge(e){var t=parseFloat(e);if(isNaN(t))throw new Error("Invalid number: "+e);return t}var Jt=[].concat(bt,xt,jt,yt,Et);function Kt(e){var t=e.match(/\D+$/),r=t&&t[0];if(r&&Jt.indexOf(r)===-1)throw new Error("Invalid unit: "+r);return r}var qt=Object.assign(Ie(bt,"angle"),Ie(xt,"frequency"),Ie(yt,"resolution"),Ie(Et,"time"));function Ie(e,t){return Object.fromEntries(e.map(r=>[r,t]))}function Zt(e){return qt[e]||"length"}import Qt from"postcss-value-parser";function er(e,t){try{let r=new fe(e);switch(r.unit){case"px":return{absolute:r.value};case"em":return{absolute:r.value*t};case"rem":return{absolute:r.value*16};case"%":return{relative:r.value};default:return{}}}catch{return{}}}function Be(e,t,r){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let o=er(e,t);return o.absolute?{[r?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[r?"xRelative":"yRelative"]:o.relative}:{}}}function Ye(e,t){if(typeof e=="number")return{xAbsolute:e};let r;try{r=Qt(e).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return r.length===1?Be(r[0],t,!0):r.length===2?((r[0]==="top"||r[0]==="bottom"||r[1]==="left"||r[1]==="right")&&r.reverse(),D(D({},Be(r[0],t,!0)),Be(r[1],t,!1))):{}}var ir=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),or=new Set(["lineHeight"]),St=[1,0,0,1,0,0];function ar(e,t,r,o){return e==="border"&&!r.includes(t.borderColor)?t.borderColor=o:e==="borderColor"?t.borderColor=t.borderTopColor:e==="textDecoration"&&!r.includes(t.textDecorationColor)&&(t.textDecorationColor=o),t}function _t(e,t){return typeof t=="number"?ir.has(e)?or.has(e)?t:String(t):t+"px":t}function sr(e,t){return e==="lineHeight"?{lineHeight:_t(e,t)}:e==="fontFamily"?{fontFamily:t.split(",").map(r=>r.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,t,r,{percentage:o}={percentage:!1}){if(typeof e=="number")return e;try{let a=new fe(e);if(a.type==="length")switch(a.unit){case"em":return a.value*t;case"rem":return a.value*16;case"vw":return~~(a.value*r._viewportWidth/100);case"vh":return~~(a.value*r._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&o)return a.value/100*t}catch{}}function Le(e,t){let r={};for(let a in e){if(a.startsWith("_")){r[a]=e[a];continue}let i=tr(a);Object.assign(r,sr(i,e[a])||ar(i,rr(i,_t(i,e[a]),!0),e[a],e.color||t.color))}if(r.backgroundImage){let{backgrounds:a}=nr(r);r.backgroundImage=a}let o=r.fontSize||t.fontSize;if(typeof o=="string")try{let a=new fe(o);switch(a.unit){case"em":o=a.value*t.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof r.fontSize!="undefined"&&(r.fontSize=o),r.transformOrigin&&(r.transformOrigin=Ye(r.transformOrigin,o));for(let a in r){let i=r[a];if(a==="lineHeight")typeof i=="string"&&(i=r[a]=He(i,o,t,{percentage:!0})/o);else if(typeof i=="string"){let n=He(i,o,t);typeof n!="undefined"&&(r[a]=n),i=r[a]}if(a==="opacity"&&(i=r[a]=i*t.opacity),a==="transform"){let n=[...St],s=i;for(let f of s){let m=Object.keys(f)[0],g=f[m],d=typeof g=="string"?He(g,o,t):g,c=[...St];switch(m){case"translateX":c[4]=d;break;case"translateY":c[5]=d;break;case"scale":c[0]=d,c[3]=d;break;case"scaleX":c[0]=d;break;case"scaleY":c[3]=d;break;case"rotate":let h=d*Math.PI/180,l=Math.cos(h),u=Math.sin(h);c[0]=l,c[1]=u,c[2]=-u,c[3]=l;break;case"skewX":c[2]=Math.tan(d*Math.PI/180);break;case"skewY":c[1]=Math.tan(d*Math.PI/180);break}n=ge(c,n)}r.transform=n}}return r}function Xe(e,t,r,o,a){let i=te(),n=D(D(D({},r),Le(ht[t],r)),Le(o,r));if(t==="img"){let s=parseInt(a.width),m=parseInt(a.height)/s;n.width||(n.width=s),n.height||(n.height=m*n.width)}return e.setDisplay(Z(n.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),e.setAlignContent(Z(n.alignContent,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,"space-between":i.ALIGN_SPACE_BETWEEN,"space-around":i.ALIGN_SPACE_AROUND,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setAlignItems(Z(n.alignItems,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_FLEX_START)),e.setAlignSelf(Z(n.alignSelf,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setJustifyContent(Z(n.justifyContent,{center:i.JUSTIFY_CENTER,"flex-start":i.JUSTIFY_FLEX_START,"flex-end":i.JUSTIFY_FLEX_END,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND},i.JUSTIFY_FLEX_START)),e.setFlexDirection(Z(n.flexDirection,{row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE},i.FLEX_DIRECTION_ROW)),e.setFlexWrap(Z(n.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof n.flexBasis!="undefined"&&e.setFlexBasis(n.flexBasis),e.setFlexGrow(typeof n.flexGrow=="undefined"?0:n.flexGrow),e.setFlexShrink(typeof n.flexShrink=="undefined"?0:n.flexShrink),typeof n.maxHeight!="undefined"&&e.setMaxHeight(n.maxHeight),typeof n.maxWidth!="undefined"&&e.setMaxWidth(n.maxWidth),typeof n.minHeight!="undefined"&&e.setMinHeight(n.minHeight),typeof n.minWidth!="undefined"&&e.setMinWidth(n.minWidth),e.setOverflow(Z(n.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),e.setMargin(i.EDGE_TOP,n.marginTop||0),e.setMargin(i.EDGE_BOTTOM,n.marginBottom||0),e.setMargin(i.EDGE_LEFT,n.marginLeft||0),e.setMargin(i.EDGE_RIGHT,n.marginRight||0),e.setBorder(i.EDGE_TOP,n.borderWidth||0),e.setBorder(i.EDGE_BOTTOM,n.borderWidth||0),e.setBorder(i.EDGE_LEFT,n.borderWidth||0),e.setBorder(i.EDGE_RIGHT,n.borderWidth||0),e.setPadding(i.EDGE_TOP,n.paddingTop||0),e.setPadding(i.EDGE_BOTTOM,n.paddingBottom||0),e.setPadding(i.EDGE_LEFT,n.paddingLeft||0),e.setPadding(i.EDGE_RIGHT,n.paddingRight||0),e.setPositionType(Z(n.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&e.setPosition(i.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&e.setPosition(i.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&e.setPosition(i.EDGE_LEFT,n.left),typeof n.right!="undefined"&&e.setPosition(i.EDGE_RIGHT,n.right),typeof n.height!="undefined"?e.setHeight(n.height):e.setHeightAuto(),typeof n.width!="undefined"?e.setWidth(n.width):e.setWidthAuto(),[n,Ne(n)]}function ue({left:e,top:t,width:r,height:o},a,i,n){var f,m,g,d;let s;if(i)s=a;else{let c=(m=n==null?void 0:n.xAbsolute)!=null?m:((f=n==null?void 0:n.xRelative)!=null?f:50)*r/100,h=(d=n==null?void 0:n.yAbsolute)!=null?d:((g=n==null?void 0:n.yRelative)!=null?g:50)*o/100,l=e+c,u=t+h;s=ge([1,0,0,1,l,u],ge(a,[1,0,0,1,-l,-u])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(c=>c.toFixed(2)).join(",")})`}function Tt({left:e,top:t,width:r,height:o,isInheritingTransform:a},i){let n="",s=1;return i.transform&&(n=ue({left:e,top:t,width:r,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:n,opacity:s}}function Ue({id:e,content:t,filter:r,left:o,top:a,width:i,height:n,matrix:s,opacity:f,image:m,clipPathId:g,debug:d,shape:c,decorationShape:h},l){let u="";if(d&&(u=y("rect",{x:o,y:a-n,width:i,height:n,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),m){let x={href:m,x:o,y:a,width:i,height:n,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(r?`${r}<g filter="url(#satori_s-${e})">`:"")+y("image",se(D({},x),{opacity:f!==1?f:void 0}))+(h||"")+(r?"</g>":"")+u,""]}let b={x:o,y:a,width:i,height:n,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(r?`${r}<g filter="url(#satori_s-${e})">`:"")+y("text",se(D({},b),{fill:l.color,opacity:f!==1?f:void 0}),t)+(h||"")+(r?"</g>":"")+u,c?y("text",b,t):""]}function ce({id:e,width:t,height:r},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=o.shadowRadius*o.shadowRadius/4,i=Math.min(o.shadowOffset.width-a,0),n=Math.max(o.shadowOffset.width+a+t,t),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+r,r);return`<defs><filter id="satori_s-${e}" x="${i/t*100}%" y="${s/r*100}%" width="${(n-i)/t*100}%" height="${(f-s)/r*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:t,top:r,ascender:o,clipPathId:a},i){let{textDecorationColor:n,textDecorationStyle:s,textDecorationLine:f,fontSize:m}=i;if(!f||f==="none")return"";let g=Math.max(1,m*.1),d=f==="line-through"?r+o*.5:f==="underline"?r+o*1.1:r,c=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:t,y1:d,x2:t+e,y2:d,stroke:n,"stroke-width":g,"stroke-dasharray":c,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var je=void 0;function*Ve(e,t){var lt;let r=te(),{parentStyle:o,inheritedStyle:a,parent:i,font:n,id:s,isInheritingTransform:f,debug:m,embedFont:g,graphemeImages:d,canLoadAdditionalAssets:c}=t;o.textTransform==="uppercase"?e=e.toLocaleUpperCase(je):o.textTransform==="lowercase"?e=e.toLocaleLowerCase(je):o.textTransform==="capitalize"&&(e=le(e,"word").map(v=>le(v,"grapheme").map((k,A)=>A===0?k.toLocaleUpperCase(je):k).join("")).join(""));let h=Z(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),u=r.Node.create();u.setAlignItems(r.ALIGN_BASELINE),o.textAlign==="left"?u.setJustifyContent(r.JUSTIFY_FLEX_START):o.textAlign==="center"?u.setJustifyContent(r.JUSTIFY_CENTER):o.textAlign==="right"?u.setJustifyContent(r.JUSTIFY_FLEX_END):o.textAlign==="justify"&&u.setJustifyContent(r.JUSTIFY_SPACE_BETWEEN),i.insertChild(u,i.getChildCount());let{textAlign:b,textOverflow:x,whiteSpace:E,lineHeight:O,filter:W,_inheritedBackgroundClipTextPath:G}=o,M=o.fontSize,T=n.getEngine(M,O,o),K=c?l.filter(v=>!T.check(v)):[];yield K,K.length&&(T=n.getEngine(M,O,o));let $=[],_=[],N=[],H=[],U=new Map,w=v=>{let k=0;for(let A of v){if(U.has(A)){k+=U.get(A);continue}let X=T.measure(A,o);U.set(A,X),k+=X}return k},F=0,R=[],p=0;for(let v of l){let k=!1,A=d&&d[v];E==="pre"?k=v[0]===` | ||
`:E!=="nowrap"&&(A||Ce.includes(v[0]))&&(k=!0),k?(E==="nowrap"?p+=w(R)+o.fontSize:(F=Math.max(F,w(R)),A&&(F=Math.max(F,o.fontSize))),R=[]):(!Ce.includes(v[0])||!R.length)&&R.push(v===` | ||
`?" ":v)}F=Math.max(F,w(R)+p);let S=i.getMinWidth(),L=i.getMaxWidth(),Q=i.getWidth();isNaN(Q.value)&&(isNaN(S.value)||S.unit===1&&S.value>F)&&(isNaN(L.value)||L.unit===1&&(F=Math.min(F,L.value)),i.setMinWidth(F)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let he=E==="pre-wrap"||E==="pre";u.setMeasureFunc(v=>{let k=0,A="",X=0,z=0,j=0,V=-1,ie=0,P=0,oe=0;$=[],N=[0];for(let ne=0;ne<l.length;ne++){let B=l[ne];if(!he&&Ce.includes(B[0]))A||(A=" "),X=w([A]),H[ne]=null;else{let ae=he&&B===` | ||
`,J=ae?0:d&&d[B]?o.fontSize:w([B]);z||(A="",X=0);let Y=X||",.!?:-@)>]}%#".indexOf(B[0])<0,q=!z||!!X;if(ae||ne&&Y&&z+X+J>v&&E!=="nowrap"&&E!=="pre")$.push(z),_.push(oe),k++,ie+=P,z=J,P=J?T.height(B):0,oe=J?T.baseline(B):0,N.push(1),V=-1,ae||(j=Math.max(j,v));else{z+=X+J;let me=T.height(B);me>P&&(P=me,oe=T.baseline(B)),q&&N[N.length-1]++}A="",X=0,q&&V++,j=Math.max(j,z),H[ne]={y:ie,x:z-J,width:J,line:k,lineIndex:V}}}return z&&(k++,$.push(z),_.push(oe),ie+=P),{width:j,height:ie}});let[Lt,kt]=yield,Fe="",Se="",re=a._inheritedClipPathId,{left:nt,top:it,width:_e,height:ot}=u.getComputedLayout(),Oe=i.getComputedWidth()-i.getComputedPadding(r.EDGE_LEFT)-i.getComputedPadding(r.EDGE_RIGHT)-i.getComputedBorder(r.EDGE_LEFT)-i.getComputedBorder(r.EDGE_RIGHT),de=Lt+nt,pe=kt+it,{matrix:ee,opacity:Te}=Tt({left:nt,top:it,width:_e,height:ot,isInheritingTransform:f},o),we="";o.textShadowOffset&&(we=ce({width:_e,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let be="",Re="",at="",$e=-1,st=x==="ellipsis"?w(["\u2026"]):0,At=x==="ellipsis"?w([" "]):0,ve={};for(let v=0;v<l.length;v++){if(!H[v])continue;let k=H[v],A=l[v],X=null,z=d?d[A]:null,j=k.y,V=k.x,ie=k.width,P=k.line;if(P===$e)continue;let oe=!1;if($.length>1){let Y=_e-$[P];if(b==="right"||b==="end")V+=Y;else if(b==="center")V+=Y/2;else if(b==="justify"&&P<$.length-1){let q=N[P];V+=(q>1?Y/(q-1):0)*k.lineIndex,oe=!0}}if(ve[P]||(ve[P]=[V,oe?_e:$[P]]),x==="ellipsis"&&$[P]>Oe&&k.x+ie+st+At>Oe){let Y=le(A,"grapheme"),q="",me=0;for(let ft of Y){let ut=k.x+w([q+ft]);if(q&&ut+st>Oe)break;q+=ft,me=ut}A=q+"\u2026",$e=P,ve[P][1]=me}let ne=_[P],B=T.baseline(A),ae=T.height(A),J=ne-B;if(z?j+=0:g?(X=T.getSVG(A,se(D({},o),{left:de+V,top:pe+j+B+J,letterSpacing:o.letterSpacing})),m&&(at+=y("rect",{x:de+V,y:pe+j+J,width:k.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0})+y("line",{x1:de+V,x2:de+V+k.width,y1:pe+j+J+B,y2:pe+j+J+B,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0}))):j+=B+J,o.textDecorationLine&&(P!==((lt=H[v+1])==null?void 0:lt.line)||$e===P)){let Y=ve[P];Y&&!Y[2]&&(be+=ze({left:de+Y[0],top:pe+ae*+P,width:Y[1],ascender:T.baseline(A),clipPathId:re},o),Y[2]=1)}if(X!==null)Re+=X+" ";else{let[Y,q]=Ue({content:A,filter:we,id:s,left:de+V,top:pe+j,width:ie,height:ae,matrix:ee,opacity:Te,image:z,clipPathId:re,debug:m,shape:!!G,decorationShape:be},o);Fe+=Y,Se+=q,be=""}}if(Re){let v=o.color!=="transparent"&&Te!==0?y("path",{fill:o.color,d:Re,transform:ee||void 0,opacity:Te!==1?Te:void 0,"clip-path":re?`url(#${re})`:void 0,style:W?`filter:${W}`:void 0}):"";G&&(Se=y("path",{d:Re,transform:ee||void 0})),Fe+=(we?we+y("g",{filter:`url(#satori_s-${s})`},v+be):v+be)+at}return Se&&(o._inheritedBackgroundClipTextPath.value+=Se),Fe}var Je=Je||{};Je.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function r(p){var S=new Error(t+": "+p);throw S.source=t,S}function o(){var p=a();return t.length>0&&r("Invalid input not EOF"),p}function a(){return O(i)}function i(){return n("linear-gradient",e.linearGradient,f)||n("repeating-linear-gradient",e.repeatingLinearGradient,f)||n("radial-gradient",e.radialGradient,d)||n("repeating-radial-gradient",e.repeatingRadialGradient,d)}function n(p,S,L){return s(S,function(Q){var he=L();return he&&(F(e.comma)||r("Missing comma before color stops")),{type:p,orientation:he,colorStops:O(W)}})}function s(p,S){var L=F(p);if(L){F(e.startCall)||r("Missing (");var Q=S(L);return F(e.endCall)||r("Missing )"),Q}}function f(){return m()||g()}function m(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function d(){var p,S=c(),L;return S&&(p=[],p.push(S),L=t,F(e.comma)&&(S=c(),S?p.push(S):t=L)),p}function c(){var p=h()||l();if(p)p.at=b();else{var S=u();if(S){p=S;var L=b();L&&(p.at=L)}else{var Q=x();Q&&(p={type:"default-radial",at:Q})}}return p}function h(){var p=w("shape",/^(circle)/i,0);return p&&(p.style=U()||u()),p}function l(){var p=w("shape",/^(ellipse)/i,0);return p&&(p.style=N()||u()),p}function u(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("position",/^at/,0)){var p=x();return p||r("Missing positioning value"),p}}function x(){var p=E();if(p.x||p.y)return{type:"position",value:p}}function E(){return{x:N(),y:N()}}function O(p){var S=p(),L=[];if(S)for(L.push(S);F(e.comma);)S=p(),S?L.push(S):r("One extra comma");return L}function W(){var p=G();return p||r("Expected color definition"),p.length=N(),p}function G(){return T()||$()||K()||M()}function M(){return w("literal",e.literalColor,0)}function T(){return w("hex",e.hexColor,1)}function K(){return s(e.rgbColor,function(){return{type:"rgb",value:O(_)}})}function $(){return s(e.rgbaColor,function(){return{type:"rgba",value:O(_)}})}function _(){return F(e.number)[1]}function N(){return w("%",e.percentageValue,1)||H()||U()}function H(){return w("position-keyword",e.positionKeywords,1)}function U(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(p,S,L){var Q=F(S);if(Q)return{type:p,value:Q[L]}}function F(p){var S,L;return L=/^[\n\r\t\s]+/.exec(t),L&&R(L[0].length),S=p.exec(t),S&&R(S[0].length),S}function R(p){t=t.substr(p)}return function(p){return t=p.toString(),o()}}();var Ke=Je;function lr(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function fr(e,t){return typeof e=="string"&&e.endsWith("%")?t*parseFloat(e)/100:+e}function wt(e,{x:t,y:r,defaultX:o,defaultY:a}){return(e?e.split(" ").map(i=>{try{let n=new fe(i);return n.type==="length"||n.type==="number"?n.value:n.value+n.unit}catch{return null}}).filter(i=>i!==null):[o,a]).map((i,n)=>fr(i,[t,r][n]))}function Rt(e,t){let r=[];for(let n of t){let s=lr(n);if(!r.length&&(r.push({offset:0,color:s}),typeof n.length=="undefined"||n.length.value==="0"))continue;let f=typeof n.length=="undefined"?void 0:n.length.type==="%"?n.length.value/100:n.length.value/e;r.push({offset:f,color:s})}r.length||r.push({offset:0,color:"transparent"});let o=r[r.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:r.push({offset:1,color:o.color}));let a=0,i=1;for(let n=0;n<r.length;n++)if(typeof r[n].offset=="undefined"){for(i<n&&(i=n);typeof r[i].offset=="undefined";)i++;r[n].offset=(r[i].offset-r[a].offset)/(i-a)*(n-a)+r[a].offset}else a=n;return r}function qe({id:e,width:t,height:r},{image:o,size:a,position:i,repeat:n}){n=n||"repeat";let s=n==="repeat-x"||n==="repeat",f=n==="repeat-y"||n==="repeat",m=wt(a,{x:t,y:r,defaultX:t,defaultY:r}),g=wt(i,{x:t,y:r,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let d=Ke.parse(o)[0],c,h,l,u;if(d.orientation.type==="directional")[c,h,l,u]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[d.orientation.value];else if(d.orientation.type==="angular"){let x=+d.orientation.value/180*Math.PI-Math.PI/2,E=Math.cos(x),O=Math.sin(x);c=0,h=0,l=E,u=O,l<0&&(c-=l,l=0),u<0&&(h-=u,u=0)}let b=Rt(t,d.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${c}" y1="${h}" x2="${l}" y2="${u}">${b.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let d=Ke.parse(o)[0],c=d.orientation[0],[h,l]=m,u="circle",b=h/2,x=l/2;if(c.type==="shape"){if(u=c.value,c.at)if(c.at.type==="position")b=c.at.value.x.value,x=c.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+c.at.type)}else throw new Error("orientation.type not implemented: "+c.type);let E=Rt(t,d.colorStops),O=`satori_radial_${e}`,W=`satori_pattern_${e}`,G={},M=Math.max(Math.abs(h-b),Math.abs(b)),T=Math.max(Math.abs(l-x),Math.abs(x));if(u==="circle")G.r=Math.sqrt(M*M+T*T);else if(u==="ellipse"){let _=T!==0?M/T:1;G.ry=Math.sqrt(M*M+T*T*_*_)/_,G.rx=G.ry*_}let K=y("pattern",{id:W,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:O},E.map(_=>y("stop",{offset:_.offset,"stop-color":_.color})).join(""))+y(u,se(D({cx:b,cy:x,width:h,height:l},G),{fill:`url(#${O})`})));return[W,K]}if(o.startsWith("url(")){let d=o.slice(4,-1);return[`satori_bi${e}`,y("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?m[0]:"100%",height:f?m[1]:"100%"},y("image",{x:0,y:0,width:m[0],height:m[1],href:d}))]}}function ke(e,t,r){return r<e+t&&(r/2<e&&r/2<t?e=t=r/2:r/2<e?e=r-t:r/2<t&&(t=r-e)),[e,t]}function xe({left:e,top:t,width:r,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:n,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return i=Math.min(i||0,r,o),n=Math.min(n||0,r,o),s=Math.min(s||0,r,o),f=Math.min(f||0,r,o),!i&&!n&&!s&&!f?"":([i,n]=ke(i,n,r),[i,s]=ke(i,s,o),[n,f]=ke(n,f,o),[s,f]=ke(s,f,r),`M${e+i},${t} h${r-i-n} a${n},${n} 0 0 1 ${n},${n} v${o-n-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-r} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function Ze({left:e,top:t,width:r,height:o,path:a,id:i},n){return n.overflow!=="hidden"?"":a?y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("path",{x:e,y:t,width:r,height:o,d:a})):y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("rect",{x:e,y:t,width:r,height:o}))}function Qe({id:e,left:t,top:r,width:o,height:a,isInheritingTransform:i,debug:n},s){if(s.display==="none")return"";let f="rect",m="transparent",g="",d=0,c="",h="",l=[],u=1,b="";s.backgroundColor&&l.push(s.backgroundColor),s.borderWidth&&(d=s.borderWidth,m=s.borderColor,s.borderStyle==="dashed"&&(g=d*2+" "+d)),s.opacity&&(u=+s.opacity),s.transform&&(c=ue({left:t,top:r,width:o,height:a},s.transform,i,s.transformOrigin));let x="";if(s.backgroundImage){let $=s.backgroundImage.map((_,N)=>qe({id:e+"_"+N,width:o,height:a},_)).filter(Boolean);for(let _ of $)l.push(`url(#${_[0]})`),h+=_[1],_[2]&&(x+=_[2])}let E=xe({left:t,top:r,width:o,height:a},s);E&&(f="path");let O=Ze({left:t,top:r,width:o,height:a,path:E,id:e},s),W=s._inheritedClipPathId,G=ce({width:o,height:a,id:e},s);n&&(b=y("rect",{x:t,y:r,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,"stroke-dasharray":g||void 0,transform:c||void 0,"clip-path":W?`url(#${W})`:void 0})),l.length||l.push("transparent");let{backgroundClip:M,filter:T}=s,K=l.map(($,_)=>{if($==="transparent"&&!(_===l.length-1&&d))return"";let N=!!d,H=_===l.length-1&&N&&M!=="text",U=M==="text"?`url(#satori_bct-${e})`:W?`url(#${W})`:void 0;return H&&(h+=y("clipPath",{id:`satori_bc-${e}`,"clip-path":U},y(f,{x:t,y:r,width:o,height:a,d:E||void 0})),U=`url(#satori_bc-${e})`),y(f,{x:t,y:r,width:o,height:a,fill:$,stroke:H||N?m:void 0,"stroke-width":H?d*2:N?1:void 0,"stroke-dasharray":g||void 0,d:E||void 0,transform:c||void 0,"clip-path":U,style:T?`filter:${T}`:void 0})}).join("");return M==="text"&&d&&(K=y(f,{x:t,y:r,width:o,height:a,fill:"transparent",stroke:m,"stroke-width":d*2,"stroke-dasharray":g||void 0,d:E||void 0,transform:c||void 0,"clip-path":W?`url(#${W})`:void 0})+K),(h?`<defs>${h}</defs>`:"")+O+(G?`${G}<g filter="url(#satori_s-${e})">`:"")+(u!==1?`<g opacity="${u}">`:"")+(x||K)+(u!==1?"</g>":"")+(G?"</g>":"")+b}function et({id:e,left:t,top:r,width:o,height:a,src:i,debug:n,isInheritingTransform:s},f){if(f.display==="none")return"";let m="",g=1,d="",c=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=xe({left:t,top:r,width:o,height:a},f),l=f._inheritedClipPathId;h&&(m=y("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},y("path",{x:t,y:r,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let u=ce({width:o,height:a,id:e},f);return f.transform&&(d=ue({left:t,top:r,width:o,height:a},f.transform,s,f.transformOrigin)),u+(u?`<g filter="url(#satori_s-${e})">`:"")+m+y("image",{x:t,y:r,width:o,height:a,href:i,preserveAspectRatio:c,transform:d||void 0,"clip-path":m?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(u?"</g>":"")}function*Ee(e,t){let r=te(),{id:o,inheritedStyle:a,parent:i,font:n,debug:s,embedFont:f=!0,graphemeImages:m,canLoadAdditionalAssets:g}=t;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let R;if(!We(e))R=Ve(String(e),t),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=Ee(e.type(e.props),t),yield R.next().value}R.next();let p=yield;return R.next(p).value}let{type:d,props:c}=e,{style:h,children:l}=c,u=r.Node.create();i.insertChild(u,i.getChildCount());let[b,x]=Xe(u,d,a,h,c),E=b.transform===a.transform;if(E||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(x._inheritedClipPathId=`satori_cp-${o}`),b.backgroundClip==="text"){let R={value:""};x._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let O=typeof l=="undefined"?[]:[].concat(l),W=[],G=0,M=[];for(let R of O){let p=Ee(R,{id:o+"-"+G++,parentStyle:b,inheritedStyle:x,isInheritingTransform:!0,parent:u,font:n,embedFont:f,debug:s,graphemeImages:m,canLoadAdditionalAssets:g});g?M.push(...p.next().value||[]):p.next(),W.push(p)}yield M;for(let R of W)R.next();let[T,K]=yield,{left:$,top:_,width:N,height:H}=u.getComputedLayout();$+=T,_+=K;let U="",w="",F="";d==="img"?w=et({id:o,left:$,top:_,width:N,height:H,src:c.src,isInheritingTransform:E,debug:s},b):w=Qe({id:o,left:$,top:_,width:N,height:H,isInheritingTransform:E,debug:s},b);for(let R of W)U+=R.next([$,_]).value;return b._inheritedBackgroundClipTextPath&&(F+=y("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),F+w+U}import ur from"@shuding/opentype.js";function cr(e,t,[r,o],[a,i]){if(r!==a)return r?!a||r===e?-1:a===e?1:e===400&&r===500||e===500&&r===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?r<e&&a<e?a-r:r<e?-1:a<e?1:r-a:e<r&&e<a?r-a:e<r?-1:e<a?1:a-r:1;if(o!==i){if(o===t)return-1;if(i===t)return 1}return-1}var Ae=class{constructor(t){this.fonts=new Map;this.addFonts(t)}get({name:t,weight:r,style:o}){if(!this.fonts.has(t))return null;r==="normal"&&(r=400),r==="bold"&&(r=700);let a=[...this.fonts.get(t)],i=a[0];for(let n=1;n<a.length;n++){let[,s,f]=i,[,m,g]=a[n];cr(r,o,[s,f],[m,g])>0&&(i=a[n])}return i[0]}addFonts(t){for(let r of t){let o=r.data,a=ur.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0}),i=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let f=i.call(a,s);return f===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),f},this.defaultFont||(this.defaultFont=a);let n=r.name.toLowerCase();this.fonts.has(n)||this.fonts.set(n,[]),this.fonts.get(n).push([a,r.weight,r.style])}}getEngine(t=16,r=1.2,{fontFamily:o,fontWeight:a=400,fontStyle:i="normal"}){o=Array.isArray(o)?o:[o];let n=o.map(l=>this.get({name:l,weight:a,style:i})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)o.includes(l)||n.push(this.get({name:l,weight:a,style:i}));let f=new Map,m=(l,u=!0)=>{let b=l.charCodeAt(0);if(f.has(b))return f.get(b);let x=n.find((E,O)=>!!E.charToGlyphIndex(l)||u&&O===n.length-1);return x&&f.set(b,x),x},g=(l,u=!1)=>{var x,E;return((u?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoAscender:0)||l.ascender)/l.unitsPerEm*t},d=(l,u=!1)=>{var x,E;return((u?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoDescender:0)||l.descender)/l.unitsPerEm*t},c=l=>m(l,!1),h={check:l=>{let u=c(l);return u?(u._trackBrokenChars=[],u.stringToGlyphs(l),u._trackBrokenChars.length?(u._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,u=typeof l=="undefined"?n[0]:m(l))=>{let b=g(u,!0),x=d(u,!0),E=h.height(l,u),{yMax:O,yMin:W}=u.tables.head,G=b-x,M=(O/(O-W)-1)*G;return E*((1.2/r+1)/2)+M},height:(l,u=typeof l=="undefined"?n[0]:m(l))=>(g(u)-d(u))*(r/1.2),measure:(l,u)=>this.measure(m,l,u),getSVG:(l,u)=>this.getSVG(m,l,u)};return h}patchFontFallbackResolver(t,r){let o=[];t._trackBrokenChars=o;let a=t.stringToGlyphs;return t.stringToGlyphs=(i,...n)=>{let s=a.call(t,i,...n);for(let f=0;f<s.length;f++)if(s[f].unicode===void 0){let m=o.shift(),g=r(m);g!==t&&(s[f]=g.charToGlyph(m))}return s},()=>{t.stringToGlyphs=a,t._trackBrokenChars=void 0}}measure(t,r,{fontSize:o,letterSpacing:a=0}){let i=t(r),n=this.patchFontFallbackResolver(i,t);try{return i.getAdvanceWidth(r,o,{letterSpacing:a/o})}finally{n()}}getSVG(t,r,{fontSize:o,top:a,left:i,letterSpacing:n=0}){let s=t(r),f=this.patchFontFallbackResolver(s,t);try{return s.getPath(r,i,a,o,{letterSpacing:n/o}).toPathData(1)}finally{f()}}};function tt({width:e,height:t,content:r}){return y("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,xmlns:"http://www.w3.org/2000/svg"},r)}var vt={emoji:/\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Ct(e){for(let t in vt)if(vt[t].test(e))return t;return"unknown"}var rt=new WeakMap;async function It(e,t){let r=te();if(!r)throw new Error("Satori is not initialized.");let o;rt.has(t.fonts)?o=rt.get(t.fonts):rt.set(t.fonts,o=new Ae(t.fonts));let a=r.Node.create();a.setWidth(t.width),a.setHeight(t.height),a.setFlexDirection(r.FLEX_DIRECTION_ROW),a.setFlexWrap(r.WRAP_WRAP),a.setAlignContent(r.ALIGN_AUTO),a.setAlignItems(r.ALIGN_FLEX_START),a.setJustifyContent(r.JUSTIFY_FLEX_START),a.setOverflow(r.OVERFLOW_HIDDEN);let i=D({},t.graphemeImages),n=Ee(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:t.width,_viewportHeight:t.height},parent:a,font:o,embedFont:t.embedFont,debug:t.debug,graphemeImages:i,canLoadAdditionalAssets:!!t.loadAdditionalAsset}),s=n.next().value;if(t.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let m={};s.forEach(c=>{let h=Ct(c);m[h]=m[h]||[],h==="emoji"?m[h].push(c):m[h][0]=(m[h][0]||"")+c});let g=[],d={};await Promise.all(Object.entries(m).flatMap(([c,h])=>h.map(l=>t.loadAdditionalAsset(c,l).then(u=>{typeof u=="string"?d[l]=u:u&&g.push(u)})))),o.addFonts(g),Object.assign(i,d)}n.next(),a.calculateLayout(t.width,t.height,r.DIRECTION_LTR);let f=n.next([0,0]).value;return a.freeRecursive(),tt({width:t.width,height:t.height,content:f})}export{It as default,Nt as init}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,5 @@ | ||
var Ot=Object.defineProperty,Ft=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var dt=(e,n,t)=>n in e?Ot(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,G=(e,n)=>{for(var t in n||(n={}))Pt.call(n,t)&&dt(e,t,n[t]);if(ct)for(var t of ct(n))Wt.call(n,t)&&dt(e,t,n[t]);return e},se=(e,n)=>Ft(e,$t(n));var pt={};var Pe;Pe=pt.default;function Nt(e){Pe=e}function te(){return Pe}function We(e){let n=typeof e;return!(n==="number"||n==="bigint"||n==="string"||n==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,n){return[e[0]*n[0]+e[2]*n[1],e[1]*n[0]+e[3]*n[1],e[0]*n[2]+e[2]*n[3],e[1]*n[2]+e[3]*n[3],e[0]*n[4]+e[2]*n[5]+e[4],e[1]*n[4]+e[3]*n[5]+e[5]]}function K(e,n,t){let o=n[e];return typeof o=="undefined"?t:o}var gt=void 0,Ne=typeof Intl!="undefined"&&"Segmenter"in Intl;if(!Ne)throw new Error("Intl.Segmenter does not exist, please use import a polyfill.");var Mt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Gt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,Ce=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e));function le(e,n){return n==="word"?[...Mt.segment(e)].map(t=>t.segment):[...Gt.segment(e)].map(t=>t.segment)}function x(e,n,t){let o="";for(let[a,i]of Object.entries(n))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return t?`<${e}${o}>${t}</${e}>`:`<${e}${o}/>`}var ht={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var Dt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Me(e){let n={};for(let t in e)Dt.has(t)&&(n[t]=e[t]);return n}import{getPropertyName as en,getStylesForProperty as tn}from"css-to-react-native";import{parseElementStyle as nn}from"css-background-parser";var ye=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Bt=ye((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Yt=ye((e,n)=>{n.exports=["deg","grad","rad","turn"]}),Ht=ye((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),Xt=ye((e,n)=>{n.exports=["Hz","kHz"]}),Ut=ye((e,n)=>{n.exports=["s","ms"]}),zt=Bt(),bt=Yt(),yt=Ht(),xt=Xt(),Et=Ut();function De(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(jt(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ge(e),this.unit="%";return}var n=Jt(e);if(!n){this.type="number",this.value=Ge(e);return}this.type=qt(n),this.value=Ge(e.substr(0,e.length-n.length)),this.unit=n}De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+(this.unit||"")};function fe(e){return new De(e)}function jt(e){var n=e.match(/\./g);return n?n.length:0}function Ge(e){var n=parseFloat(e);if(isNaN(n))throw new Error("Invalid number: "+e);return n}var Vt=[].concat(bt,xt,zt,yt,Et);function Jt(e){var n=e.match(/\D+$/),t=n&&n[0];if(t&&Vt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var Kt=Object.assign(Le(bt,"angle"),Le(xt,"frequency"),Le(yt,"resolution"),Le(Et,"time"));function Le(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function qt(e){return Kt[e]||"length"}import Zt from"postcss-value-parser";function Qt(e,n){try{let t=new fe(e);switch(t.unit){case"px":return{absolute:t.value};case"em":return{absolute:t.value*n};case"rem":return{absolute:t.value*16};case"%":return{relative:t.value};default:return{}}}catch{return{}}}function Be(e,n,t){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let o=Qt(e,n);return o.absolute?{[t?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[t?"xRelative":"yRelative"]:o.relative}:{}}}function Ye(e,n){if(typeof e=="number")return{xAbsolute:e};let t;try{t=Zt(e).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return t.length===1?Be(t[0],n,!0):t.length===2?((t[0]==="top"||t[0]==="bottom"||t[1]==="left"||t[1]==="right")&&t.reverse(),G(G({},Be(t[0],n,!0)),Be(t[1],n,!1))):{}}var rn=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),on=new Set(["lineHeight"]),St=[1,0,0,1,0,0];function an(e,n,t,o){return e==="border"&&!t.includes(n.borderColor)?n.borderColor=o:e==="textDecoration"&&!t.includes(n.textDecorationColor)&&(n.textDecorationColor=o),n}function _t(e,n){return typeof n=="number"?rn.has(e)?on.has(e)?n:String(n):n+"px":n}function sn(e,n){return e==="lineHeight"?{lineHeight:_t(e,n)}:e==="fontFamily"?{fontFamily:n.split(",").map(t=>t.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,n,t,{percentage:o}={percentage:!1}){if(typeof e=="number")return e;try{let a=new fe(e);if(a.type==="length")switch(a.unit){case"em":return a.value*n;case"rem":return a.value*16;case"vw":return~~(a.value*t._viewportWidth/100);case"vh":return~~(a.value*t._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&o)return a.value/100*n}catch{}}function Ie(e,n){let t={};for(let a in e){if(a.startsWith("_")){t[a]=e[a];continue}let i=en(a);Object.assign(t,sn(i,e[a])||an(i,tn(i,_t(i,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=nn(t);t.backgroundImage=a}let o=t.fontSize||n.fontSize;if(typeof o=="string")try{let a=new fe(o);switch(a.unit){case"em":o=a.value*n.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof t.fontSize!="undefined"&&(t.fontSize=o),t.transformOrigin&&(t.transformOrigin=Ye(t.transformOrigin,o));for(let a in t){let i=t[a];if(a==="lineHeight")typeof i=="string"&&(i=t[a]=He(i,o,n,{percentage:!0})/o);else if(typeof i=="string"){let r=He(i,o,n);typeof r!="undefined"&&(t[a]=r),i=t[a]}if(a==="opacity"&&(i=t[a]=i*n.opacity),a==="transform"){let r=[...St],s=i;for(let f of s){let m=Object.keys(f)[0],g=f[m],c=typeof g=="string"?He(g,o,n):g,d=[...St];switch(m){case"translateX":d[4]=c;break;case"translateY":d[5]=c;break;case"scale":d[0]=c,d[3]=c;break;case"scaleX":d[0]=c;break;case"scaleY":d[3]=c;break;case"rotate":let h=c*Math.PI/180,l=Math.cos(h),u=Math.sin(h);d[0]=l,d[1]=u,d[2]=-u,d[3]=l;break;case"skewX":d[2]=Math.tan(c*Math.PI/180);break;case"skewY":d[1]=Math.tan(c*Math.PI/180);break}r=ge(d,r)}t.transform=r}}return t}function Xe(e,n,t,o,a){let i=te(),r=G(G(G({},t),Ie(ht[n],t)),Ie(o,t));if(n==="img"){let s=parseInt(a.width),m=parseInt(a.height)/s;r.width||(r.width=s),r.height||(r.height=m*r.width)}return e.setDisplay(K(r.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),e.setAlignContent(K(r.alignContent,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,"space-between":i.ALIGN_SPACE_BETWEEN,"space-around":i.ALIGN_SPACE_AROUND,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setAlignItems(K(r.alignItems,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_FLEX_START)),e.setAlignSelf(K(r.alignSelf,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setJustifyContent(K(r.justifyContent,{center:i.JUSTIFY_CENTER,"flex-start":i.JUSTIFY_FLEX_START,"flex-end":i.JUSTIFY_FLEX_END,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND},i.JUSTIFY_FLEX_START)),e.setFlexDirection(K(r.flexDirection,{row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE},i.FLEX_DIRECTION_ROW)),e.setFlexWrap(K(r.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof r.flexBasis!="undefined"&&e.setFlexBasis(r.flexBasis),e.setFlexGrow(typeof r.flexGrow=="undefined"?0:r.flexGrow),e.setFlexShrink(typeof r.flexShrink=="undefined"?0:r.flexShrink),typeof r.maxHeight!="undefined"&&e.setMaxHeight(r.maxHeight),typeof r.maxWidth!="undefined"&&e.setMaxWidth(r.maxWidth),typeof r.minHeight!="undefined"&&e.setMinHeight(r.minHeight),typeof r.minWidth!="undefined"&&e.setMinWidth(r.minWidth),e.setOverflow(K(r.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),e.setMargin(i.EDGE_TOP,r.marginTop||0),e.setMargin(i.EDGE_BOTTOM,r.marginBottom||0),e.setMargin(i.EDGE_LEFT,r.marginLeft||0),e.setMargin(i.EDGE_RIGHT,r.marginRight||0),e.setBorder(i.EDGE_TOP,r.borderWidth||0),e.setBorder(i.EDGE_BOTTOM,r.borderWidth||0),e.setBorder(i.EDGE_LEFT,r.borderWidth||0),e.setBorder(i.EDGE_RIGHT,r.borderWidth||0),e.setPadding(i.EDGE_TOP,r.paddingTop||0),e.setPadding(i.EDGE_BOTTOM,r.paddingBottom||0),e.setPadding(i.EDGE_LEFT,r.paddingLeft||0),e.setPadding(i.EDGE_RIGHT,r.paddingRight||0),e.setPositionType(K(r.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof r.top!="undefined"&&e.setPosition(i.EDGE_TOP,r.top),typeof r.bottom!="undefined"&&e.setPosition(i.EDGE_BOTTOM,r.bottom),typeof r.left!="undefined"&&e.setPosition(i.EDGE_LEFT,r.left),typeof r.right!="undefined"&&e.setPosition(i.EDGE_RIGHT,r.right),typeof r.height!="undefined"?e.setHeight(r.height):e.setHeightAuto(),typeof r.width!="undefined"?e.setWidth(r.width):e.setWidthAuto(),[r,Me(r)]}function ue({left:e,top:n,width:t,height:o},a,i,r){var f,m,g,c;let s;if(i)s=a;else{let d=(m=r==null?void 0:r.xAbsolute)!=null?m:((f=r==null?void 0:r.xRelative)!=null?f:50)*t/100,h=(c=r==null?void 0:r.yAbsolute)!=null?c:((g=r==null?void 0:r.yRelative)!=null?g:50)*o/100,l=e+d,u=n+h;s=ge([1,0,0,1,l,u],ge(a,[1,0,0,1,-l,-u])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(d=>d.toFixed(2)).join(",")})`}function Tt({left:e,top:n,width:t,height:o,isInheritingTransform:a},i){let r="",s=1;return i.transform&&(r=ue({left:e,top:n,width:t,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:r,opacity:s}}function Ue({id:e,content:n,filter:t,left:o,top:a,width:i,height:r,matrix:s,opacity:f,image:m,clipPathId:g,debug:c,shape:d,decorationShape:h},l){let u="";if(c&&(u=x("rect",{x:o,y:a-r,width:i,height:r,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),m){let y={href:m,x:o,y:a,width:i,height:r,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("image",se(G({},y),{opacity:f!==1?f:void 0}))+(h||"")+(t?"</g>":"")+u,""]}let b={x:o,y:a,width:i,height:r,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+x("text",se(G({},b),{fill:l.color,opacity:f!==1?f:void 0}),n)+(h||"")+(t?"</g>":"")+u,d?x("text",b,n):""]}function ce({id:e,width:n,height:t},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=o.shadowRadius*o.shadowRadius/4,i=Math.min(o.shadowOffset.width-a,0),r=Math.max(o.shadowOffset.width+a+n,n),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+t,t);return`<defs><filter id="satori_s-${e}" x="${i/n*100}%" y="${s/t*100}%" width="${(r-i)/n*100}%" height="${(f-s)/t*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:n,top:t,ascender:o,clipPathId:a},i){let{textDecorationColor:r,textDecorationStyle:s,textDecorationLine:f,fontSize:m}=i;if(!f||f==="none")return"";let g=Math.max(1,m*.1),c=f==="line-through"?t+o*.5:f==="underline"?t+o*1.1:t,d=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return x("line",{x1:n,y1:c,x2:n+e,y2:c,stroke:r,"stroke-width":g,"stroke-dasharray":d,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var je=void 0;function*Ve(e,n){var lt;let t=te(),{parentStyle:o,inheritedStyle:a,parent:i,font:r,id:s,isInheritingTransform:f,debug:m,embedFont:g,graphemeImages:c,canLoadAdditionalAssets:d}=n;o.textTransform==="uppercase"?e=e.toLocaleUpperCase(je):o.textTransform==="lowercase"?e=e.toLocaleLowerCase(je):o.textTransform==="capitalize"&&(e=le(e,"word").map(C=>le(C,"grapheme").map((O,F)=>F===0?O.toLocaleUpperCase(je):O).join("")).join(""));let h=K(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),u=t.Node.create();u.setAlignItems(t.ALIGN_BASELINE),o.textAlign==="left"?u.setJustifyContent(t.JUSTIFY_FLEX_START):o.textAlign==="center"?u.setJustifyContent(t.JUSTIFY_CENTER):o.textAlign==="right"?u.setJustifyContent(t.JUSTIFY_FLEX_END):o.textAlign==="justify"&&u.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),i.insertChild(u,i.getChildCount());let{textAlign:b,textOverflow:y,whiteSpace:S,lineHeight:_,filter:M,_inheritedBackgroundClipTextPath:W}=o,N=o.fontSize,T=r.getEngine(N,_,o),H=d?l.filter(C=>!T.check(C)):[];yield H,H.length&&(T=r.getEngine(N,_,o));let w=[],k=[],X=[],q=[],Q=new Map,R=C=>{let O=0;for(let F of C){if(Q.has(F)){O+=Q.get(F);continue}let Y=T.measure(F,o);Q.set(F,Y),O+=Y}return O},$=0,v=[],p=0;for(let C of l){let O=!1,F=c&&c[C];S==="pre"?O=C[0]===` | ||
`:S!=="nowrap"&&(F||Ce.includes(C[0]))&&(O=!0),O?(S==="nowrap"?p+=R(v)+o.fontSize:($=Math.max($,R(v)),F&&($=Math.max($,o.fontSize))),v=[]):(!Ce.includes(C[0])||!v.length)&&v.push(C===` | ||
`?" ":C)}$=Math.max($,R(v)+p);let E=i.getMinWidth(),A=i.getMaxWidth(),Z=i.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(A.value)||A.unit===1&&($=Math.min($,A.value)),i.setMinWidth($)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let he=S==="pre-wrap"||S==="pre";u.setMeasureFunc(C=>{let O=0,F="",Y=0,U=0,z=0,j=-1,ie=0,P=0,oe=0;w=[],X=[0];for(let re=0;re<l.length;re++){let D=l[re];if(!he&&Ce.includes(D[0]))F||(F=" "),Y=R([F]),q[re]=null;else{let ae=he&&D===` | ||
`,V=ae?0:c&&c[D]?o.fontSize:R([D]);U||(F="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+V>C&&S!=="nowrap"&&S!=="pre")w.push(U),k.push(oe),O++,ie+=P,U=V,P=V?T.height(D):0,oe=V?T.baseline(D):0,X.push(1),j=-1,ae||(z=Math.max(z,C));else{U+=Y+V;let me=T.height(D);me>P&&(P=me,oe=T.baseline(D)),J&&X[X.length-1]++}F="",Y=0,J&&j++,z=Math.max(z,U),q[re]={y:ie,x:U-V,width:V,line:O,lineIndex:j}}}return U&&(O++,w.push(U),k.push(oe),ie+=P),{width:z,height:ie}});let[It,kt]=yield,Oe="",Se="",ne=a._inheritedClipPathId,{left:rt,top:it,width:_e,height:ot}=u.getComputedLayout(),Fe=i.getComputedWidth()-i.getComputedPadding(t.EDGE_LEFT)-i.getComputedPadding(t.EDGE_RIGHT)-i.getComputedBorder(t.EDGE_LEFT)-i.getComputedBorder(t.EDGE_RIGHT),de=It+rt,pe=kt+it,{matrix:ee,opacity:Te}=Tt({left:rt,top:it,width:_e,height:ot,isInheritingTransform:f},o),we="";o.textShadowOffset&&(we=ce({width:_e,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let be="",Re="",at="",$e=-1,st=y==="ellipsis"?R(["\u2026"]):0,At=y==="ellipsis"?R([" "]):0,ve={};for(let C=0;C<l.length;C++){if(!q[C])continue;let O=q[C],F=l[C],Y=null,U=c?c[F]:null,z=O.y,j=O.x,ie=O.width,P=O.line;if(P===$e)continue;let oe=!1;if(w.length>1){let B=_e-w[P];if(b==="right"||b==="end")j+=B;else if(b==="center")j+=B/2;else if(b==="justify"&&P<w.length-1){let J=X[P];j+=(J>1?B/(J-1):0)*O.lineIndex,oe=!0}}if(ve[P]||(ve[P]=[j,oe?_e:w[P]]),y==="ellipsis"&&w[P]>Fe&&O.x+ie+st+At>Fe){let B=le(F,"grapheme"),J="",me=0;for(let ft of B){let ut=O.x+R([J+ft]);if(J&&ut+st>Fe)break;J+=ft,me=ut}F=J+"\u2026",$e=P,ve[P][1]=me}let re=k[P],D=T.baseline(F),ae=T.height(F),V=re-D;if(U?z+=0:g?(Y=T.getSVG(F,se(G({},o),{left:de+j,top:pe+z+D+V,letterSpacing:o.letterSpacing})),m&&(at+=x("rect",{x:de+j,y:pe+z+V,width:O.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0})+x("line",{x1:de+j,x2:de+j+O.width,y1:pe+z+V+D,y2:pe+z+V+D,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0}))):z+=D+V,o.textDecorationLine&&(P!==((lt=q[C+1])==null?void 0:lt.line)||$e===P)){let B=ve[P];B&&!B[2]&&(be+=ze({left:de+B[0],top:pe+ae*+P,width:B[1],ascender:T.baseline(F),clipPathId:ne},o),B[2]=1)}if(Y!==null)Re+=Y+" ";else{let[B,J]=Ue({content:F,filter:we,id:s,left:de+j,top:pe+z,width:ie,height:ae,matrix:ee,opacity:Te,image:U,clipPathId:ne,debug:m,shape:!!W,decorationShape:be},o);Oe+=B,Se+=J,be=""}}if(Re){let C=o.color!=="transparent"&&Te!==0?x("path",{fill:o.color,d:Re,transform:ee||void 0,opacity:Te!==1?Te:void 0,"clip-path":ne?`url(#${ne})`:void 0,style:M?`filter:${M}`:void 0}):"";W&&(Se=x("path",{d:Re,transform:ee||void 0})),Oe+=(we?we+x("g",{filter:`url(#satori_s-${s})`},C+be):C+be)+at}return Se&&(o._inheritedBackgroundClipTextPath.value+=Se),Oe}var Je=Je||{};Je.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},n="";function t(p){var E=new Error(n+": "+p);throw E.source=n,E}function o(){var p=a();return n.length>0&&t("Invalid input not EOF"),p}function a(){return _(i)}function i(){return r("linear-gradient",e.linearGradient,f)||r("repeating-linear-gradient",e.repeatingLinearGradient,f)||r("radial-gradient",e.radialGradient,c)||r("repeating-radial-gradient",e.repeatingRadialGradient,c)}function r(p,E,A){return s(E,function(Z){var he=A();return he&&($(e.comma)||t("Missing comma before color stops")),{type:p,orientation:he,colorStops:_(M)}})}function s(p,E){var A=$(p);if(A){$(e.startCall)||t("Missing (");var Z=E(A);return $(e.endCall)||t("Missing )"),Z}}function f(){return m()||g()}function m(){return R("directional",e.sideOrCorner,1)}function g(){return R("angular",e.angleValue,1)}function c(){var p,E=d(),A;return E&&(p=[],p.push(E),A=n,$(e.comma)&&(E=d(),E?p.push(E):n=A)),p}function d(){var p=h()||l();if(p)p.at=b();else{var E=u();if(E){p=E;var A=b();A&&(p.at=A)}else{var Z=y();Z&&(p={type:"default-radial",at:Z})}}return p}function h(){var p=R("shape",/^(circle)/i,0);return p&&(p.style=Q()||u()),p}function l(){var p=R("shape",/^(ellipse)/i,0);return p&&(p.style=X()||u()),p}function u(){return R("extent-keyword",e.extentKeywords,1)}function b(){if(R("position",/^at/,0)){var p=y();return p||t("Missing positioning value"),p}}function y(){var p=S();if(p.x||p.y)return{type:"position",value:p}}function S(){return{x:X(),y:X()}}function _(p){var E=p(),A=[];if(E)for(A.push(E);$(e.comma);)E=p(),E?A.push(E):t("One extra comma");return A}function M(){var p=W();return p||t("Expected color definition"),p.length=X(),p}function W(){return T()||w()||H()||N()}function N(){return R("literal",e.literalColor,0)}function T(){return R("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:_(k)}})}function w(){return s(e.rgbaColor,function(){return{type:"rgba",value:_(k)}})}function k(){return $(e.number)[1]}function X(){return R("%",e.percentageValue,1)||q()||Q()}function q(){return R("position-keyword",e.positionKeywords,1)}function Q(){return R("px",e.pixelValue,1)||R("em",e.emValue,1)}function R(p,E,A){var Z=$(E);if(Z)return{type:p,value:Z[A]}}function $(p){var E,A;return A=/^[\n\r\t\s]+/.exec(n),A&&v(A[0].length),E=p.exec(n),E&&v(E[0].length),E}function v(p){n=n.substr(p)}return function(p){return n=p.toString(),o()}}();var Ke=Je;function ln(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function fn(e,n){return typeof e=="string"&&e.endsWith("%")?n*parseFloat(e)/100:+e}function wt(e,{x:n,y:t,defaultX:o,defaultY:a}){return(e?e.split(" ").map(i=>{try{let r=new fe(i);return r.type==="length"||r.type==="number"?r.value:r.value+r.unit}catch{return null}}).filter(i=>i!==null):[o,a]).map((i,r)=>fn(i,[n,t][r]))}function Rt(e,n){let t=[];for(let r of n){let s=ln(r);if(!t.length&&(t.push({offset:0,color:s}),typeof r.length=="undefined"||r.length.value==="0"))continue;let f=typeof r.length=="undefined"?void 0:r.length.type==="%"?r.length.value/100:r.length.value/e;t.push({offset:f,color:s})}t.length||t.push({offset:0,color:"transparent"});let o=t[t.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:t.push({offset:1,color:o.color}));let a=0,i=1;for(let r=0;r<t.length;r++)if(typeof t[r].offset=="undefined"){for(i<r&&(i=r);typeof t[i].offset=="undefined";)i++;t[r].offset=(t[i].offset-t[a].offset)/(i-a)*(r-a)+t[a].offset}else a=r;return t}function qe({id:e,width:n,height:t},{image:o,size:a,position:i,repeat:r}){r=r||"repeat";let s=r==="repeat-x"||r==="repeat",f=r==="repeat-y"||r==="repeat",m=wt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=wt(i,{x:n,y:t,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let c=Ke.parse(o)[0],d,h,l,u;if(c.orientation.type==="directional")[d,h,l,u]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[c.orientation.value];else if(c.orientation.type==="angular"){let y=+c.orientation.value/180*Math.PI-Math.PI/2,S=Math.cos(y),_=Math.sin(y);d=0,h=0,l=S,u=_,l<0&&(d-=l,l=0),u<0&&(h-=u,u=0)}let b=Rt(n,c.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${d}" y1="${h}" x2="${l}" y2="${u}">${b.map(y=>`<stop offset="${y.offset*100}%" stop-color="${y.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let c=Ke.parse(o)[0],d=c.orientation[0],[h,l]=m,u="circle",b=h/2,y=l/2;if(d.type==="shape"){if(u=d.value,d.at)if(d.at.type==="position")b=d.at.value.x.value,y=d.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+d.at.type)}else throw new Error("orientation.type not implemented: "+d.type);let S=Rt(n,c.colorStops),_=`satori_radial_${e}`,M=`satori_pattern_${e}`,W={},N=Math.max(Math.abs(h-b),Math.abs(b)),T=Math.max(Math.abs(l-y),Math.abs(y));if(u==="circle")W.r=Math.sqrt(N*N+T*T);else if(u==="ellipse"){let k=T!==0?N/T:1;W.ry=Math.sqrt(N*N+T*T*k*k)/k,W.rx=W.ry*k}let H=x("pattern",{id:M,x:g[0],y:g[1],width:s?h:"100%",height:f?l:"100%",patternUnits:"userSpaceOnUse"},x("radialGradient",{id:_},S.map(k=>x("stop",{offset:k.offset,"stop-color":k.color})).join(""))+x(u,se(G({cx:b,cy:y,width:h,height:l},W),{fill:`url(#${_})`})));return[M,H]}if(o.startsWith("url(")){let c=o.slice(4,-1);return[`satori_bi${e}`,x("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?m[0]:"100%",height:f?m[1]:"100%"},x("image",{x:0,y:0,width:m[0],height:m[1],href:c}))]}}function ke(e,n,t){return t<e+n&&(t/2<e&&t/2<n?e=n=t/2:t/2<e?e=t-n:t/2<n&&(n=t-e)),[e,n]}function xe({left:e,top:n,width:t,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:r,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return i=Math.min(i||0,t,o),r=Math.min(r||0,t,o),s=Math.min(s||0,t,o),f=Math.min(f||0,t,o),!i&&!r&&!s&&!f?"":([i,r]=ke(i,r,t),[i,s]=ke(i,s,o),[r,f]=ke(r,f,o),[s,f]=ke(s,f,t),`M${e+i},${n} h${t-i-r} a${r},${r} 0 0 1 ${r},${r} v${o-r-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-t} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function Ze({left:e,top:n,width:t,height:o,path:a,id:i},r){return r.overflow!=="hidden"?"":a?x("clipPath",{id:`satori_cp-${i}`,"clip-path":r._inheritedClipPathId?`url(#${r._inheritedClipPathId})`:void 0},x("path",{x:e,y:n,width:t,height:o,d:a})):x("clipPath",{id:`satori_cp-${i}`,"clip-path":r._inheritedClipPathId?`url(#${r._inheritedClipPathId})`:void 0},x("rect",{x:e,y:n,width:t,height:o}))}function Qe({id:e,left:n,top:t,width:o,height:a,isInheritingTransform:i,debug:r},s){if(s.display==="none")return"";let f="rect",m="transparent",g=0,c="",d="",h=[],l=1,u="";s.backgroundColor&&h.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,m=s.borderColor),s.opacity&&(l=+s.opacity),s.transform&&(c=ue({left:n,top:t,width:o,height:a},s.transform,i,s.transformOrigin));let b="";if(s.backgroundImage){let H=s.backgroundImage.map((w,k)=>qe({id:e+"_"+k,width:o,height:a},w)).filter(Boolean);for(let w of H)h.push(`url(#${w[0]})`),d+=w[1],w[2]&&(b+=w[2])}let y=xe({left:n,top:t,width:o,height:a},s);y&&(f="path");let S=Ze({left:n,top:t,width:o,height:a,path:y,id:e},s),_=s._inheritedClipPathId,M=ce({width:o,height:a,id:e},s);r&&(u=x("rect",{x:n,y:t,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:c||void 0,"clip-path":_?`url(#${_})`:void 0})),h.length||h.push("transparent");let{backgroundClip:W,filter:N}=s,T=h.map((H,w)=>{if(H==="transparent"&&!(w===h.length-1&&g))return"";let k=w===h.length-1&&g&&W!=="text";return x(f,{x:n,y:t,width:o,height:a,fill:H,stroke:k?m:void 0,"stroke-width":k?g:void 0,d:y||void 0,transform:c||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:_?`url(#${_})`:void 0,style:N?`filter:${N}`:void 0})}).join("");return W==="text"&&g&&(T=x(f,{x:n,y:t,width:o,height:a,fill:"transparent",stroke:m,"stroke-width":g,d:y||void 0,transform:c||void 0,"clip-path":_?`url(#${_})`:void 0})+T),(d?`<defs>${d}</defs>`:"")+S+(M?`${M}<g filter="url(#satori_s-${e})">`:"")+(l!==1?`<g opacity="${l}">`:"")+(b||T)+(l!==1?"</g>":"")+(M?"</g>":"")+u}function et({id:e,left:n,top:t,width:o,height:a,src:i,debug:r,isInheritingTransform:s},f){if(f.display==="none")return"";let m="",g=1,c="",d=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=xe({left:n,top:t,width:o,height:a},f),l=f._inheritedClipPathId;h&&(m=x("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},x("path",{x:n,y:t,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let u=ce({width:o,height:a,id:e},f);return f.transform&&(c=ue({left:n,top:t,width:o,height:a},f.transform,s,f.transformOrigin)),u+(u?`<g filter="url(#satori_s-${e})">`:"")+m+x("image",{x:n,y:t,width:o,height:a,href:i,preserveAspectRatio:d,transform:c||void 0,"clip-path":m?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(u?"</g>":"")}function*Ee(e,n){let t=te(),{id:o,inheritedStyle:a,parent:i,font:r,debug:s,embedFont:f=!0,graphemeImages:m,canLoadAdditionalAssets:g}=n;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let v;if(!We(e))v=Ve(String(e),n),yield v.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");v=Ee(e.type(e.props),n),yield v.next().value}v.next();let p=yield;return v.next(p).value}let{type:c,props:d}=e,{style:h,children:l}=d,u=t.Node.create();i.insertChild(u,i.getChildCount());let[b,y]=Xe(u,c,a,h,d),S=b.transform===a.transform;if(S||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(y._inheritedClipPathId=`satori_cp-${o}`),b.backgroundClip==="text"){let v={value:""};y._inheritedBackgroundClipTextPath=v,b._inheritedBackgroundClipTextPath=v}let _=typeof l=="undefined"?[]:[].concat(l),M=[],W=0,N=[];for(let v of _){let p=Ee(v,{id:o+"-"+W++,parentStyle:b,inheritedStyle:y,isInheritingTransform:!0,parent:u,font:r,embedFont:f,debug:s,graphemeImages:m,canLoadAdditionalAssets:g});g?N.push(...p.next().value||[]):p.next(),M.push(p)}yield N;for(let v of M)v.next();let[T,H]=yield;b.position==="absolute"&&u.calculateLayout();let{left:w,top:k,width:X,height:q}=u.getComputedLayout();w+=T,k+=H;let Q="",R="",$="";c==="img"?R=et({id:o,left:w,top:k,width:X,height:q,src:d.src,isInheritingTransform:S,debug:s},b):R=Qe({id:o,left:w,top:k,width:X,height:q,isInheritingTransform:S,debug:s},b);for(let v of M)Q+=v.next([w,k]).value;return b._inheritedBackgroundClipTextPath&&($+=x("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+R+Q}import un from"@shuding/opentype.js";function cn(e,n,[t,o],[a,i]){if(t!==a)return t?!a||t===e?-1:a===e?1:e===400&&t===500||e===500&&t===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?t<e&&a<e?a-t:t<e?-1:a<e?1:t-a:e<t&&e<a?t-a:e<t?-1:e<a?1:a-t:1;if(o!==i){if(o===n)return-1;if(i===n)return 1}return-1}var Ae=class{constructor(n){this.fonts=new Map;this.addFonts(n)}get({name:n,weight:t,style:o}){if(!this.fonts.has(n))return null;t==="normal"&&(t=400),t==="bold"&&(t=700);let a=[...this.fonts.get(n)],i=a[0];for(let r=1;r<a.length;r++){let[,s,f]=i,[,m,g]=a[r];cn(t,o,[s,f],[m,g])>0&&(i=a[r])}return i[0]}addFonts(n){for(let t of n){let o=t.data,a=un.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0}),i=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let f=i.call(a,s);return f===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),f},this.defaultFont||(this.defaultFont=a);let r=t.name.toLowerCase();this.fonts.has(r)||this.fonts.set(r,[]),this.fonts.get(r).push([a,t.weight,t.style])}}getEngine(n=16,t=1.2,{fontFamily:o,fontWeight:a=400,fontStyle:i="normal"}){o=Array.isArray(o)?o:[o];let r=o.map(l=>this.get({name:l,weight:a,style:i})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)o.includes(l)||r.push(this.get({name:l,weight:a,style:i}));let f=new Map,m=(l,u=!0)=>{let b=l.charCodeAt(0);if(f.has(b))return f.get(b);let y=r.find((S,_)=>!!S.charToGlyphIndex(l)||u&&_===r.length-1);return y&&f.set(b,y),y},g=(l,u=!1)=>{var y,S;return((u?(S=(y=l.tables)==null?void 0:y.os2)==null?void 0:S.sTypoAscender:0)||l.ascender)/l.unitsPerEm*n},c=(l,u=!1)=>{var y,S;return((u?(S=(y=l.tables)==null?void 0:y.os2)==null?void 0:S.sTypoDescender:0)||l.descender)/l.unitsPerEm*n},d=l=>m(l,!1),h={check:l=>{let u=d(l);return u?(u._trackBrokenChars=[],u.stringToGlyphs(l),u._trackBrokenChars.length?(u._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,u=typeof l=="undefined"?r[0]:m(l))=>{let b=g(u,!0),y=c(u,!0),S=h.height(l,u),{yMax:_,yMin:M}=u.tables.head,W=b-y,N=(_/(_-M)-1)*W;return S*((1.2/t+1)/2)+N},height:(l,u=typeof l=="undefined"?r[0]:m(l))=>(g(u)-c(u))*(t/1.2),measure:(l,u)=>this.measure(m,l,u),getSVG:(l,u)=>this.getSVG(m,l,u)};return h}patchFontFallbackResolver(n,t){let o=[];n._trackBrokenChars=o;let a=n.stringToGlyphs;return n.stringToGlyphs=(i,...r)=>{let s=a.call(n,i,...r);for(let f=0;f<s.length;f++)if(s[f].unicode===void 0){let m=o.shift(),g=t(m);g!==n&&(s[f]=g.charToGlyph(m))}return s},()=>{n.stringToGlyphs=a,n._trackBrokenChars=void 0}}measure(n,t,{fontSize:o,letterSpacing:a=0}){let i=n(t),r=this.patchFontFallbackResolver(i,n);try{return i.getAdvanceWidth(t,o,{letterSpacing:a/o})}finally{r()}}getSVG(n,t,{fontSize:o,top:a,left:i,letterSpacing:r=0}){let s=n(t),f=this.patchFontFallbackResolver(s,n);try{return s.getPath(t,i,a,o,{letterSpacing:r/o}).toPathData(1)}finally{f()}}};function tt({width:e,height:n,content:t}){return x("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,xmlns:"http://www.w3.org/2000/svg"},t)}var vt={emoji:/\p{Emoji_Presentation}/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Ct(e){for(let n in vt)if(vt[n].test(e))return n;return"unknown"}var nt=new WeakMap;async function Lt(e,n){let t=te();if(!t)throw new Error("Satori is not initialized.");let o;nt.has(n.fonts)?o=nt.get(n.fonts):nt.set(n.fonts,o=new Ae(n.fonts));let a=t.Node.create();a.setWidth(n.width),a.setHeight(n.height),a.setFlexDirection(t.FLEX_DIRECTION_ROW),a.setFlexWrap(t.WRAP_WRAP),a.setAlignContent(t.ALIGN_AUTO),a.setAlignItems(t.ALIGN_FLEX_START),a.setJustifyContent(t.JUSTIFY_FLEX_START),a.setOverflow(t.OVERFLOW_HIDDEN);let i=G({},n.graphemeImages),r=Ee(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:n.width,_viewportHeight:n.height},parent:a,font:o,embedFont:n.embedFont,debug:n.debug,graphemeImages:i,canLoadAdditionalAssets:!!n.loadAdditionalAsset}),s=r.next().value;if(n.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let m={};s.forEach(d=>{let h=Ct(d);m[h]=m[h]||[],h==="emoji"?m[h].push(d):m[h][0]=(m[h][0]||"")+d});let g=[],c={};await Promise.all(Object.entries(m).flatMap(([d,h])=>h.map(l=>n.loadAdditionalAsset(d,l).then(u=>{typeof u=="string"?c[l]=u:u&&g.push(u)})))),o.addFonts(g),Object.assign(i,c)}r.next(),a.calculateLayout(n.width,n.height,t.DIRECTION_LTR);let f=r.next([0,0]).value;return a.freeRecursive(),tt({width:n.width,height:n.height,content:f})}export{Lt as default,Nt as init}; | ||
var Ft=Object.defineProperty,Ot=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var ct=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var dt=(e,t,r)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,D=(e,t)=>{for(var r in t||(t={}))Pt.call(t,r)&&dt(e,r,t[r]);if(ct)for(var r of ct(t))Wt.call(t,r)&&dt(e,r,t[r]);return e},se=(e,t)=>Ot(e,$t(t));var pt={};var Pe;Pe=pt.default;function Mt(e){Pe=e}function te(){return Pe}function We(e){let t=typeof e;return!(t==="number"||t==="bigint"||t==="string"||t==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function Z(e,t,r){let o=t[e];return typeof o=="undefined"?r:o}var gt=void 0,Me=typeof Intl!="undefined"&&"Segmenter"in Intl;if(!Me)throw new Error("Intl.Segmenter does not exist, please use import a polyfill.");var Nt=Me?new Intl.Segmenter(gt,{granularity:"word"}):null,Gt=Me?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,Ce=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e));function le(e,t){return t==="word"?[...Nt.segment(e)].map(r=>r.segment):[...Gt.segment(e)].map(r=>r.segment)}function y(e,t,r){let o="";for(let[a,i]of Object.entries(t))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return r?`<${e}${o}>${r}</${e}>`:`<${e}${o}/>`}var ht={p:{display:"block",marginTop:"1em",marginBottom:"1em"},div:{display:"block"},blockquote:{display:"block",marginTop:"1em",marginBottom:"1em",marginLeft:40,marginRight:40},center:{display:"block",textAlign:"center"},hr:{display:"block",marginTop:"0.5em",marginBottom:"0.5em",marginLeft:"auto",marginRight:"auto",borderWidth:1,borderStyle:"inset"},h1:{display:"block",fontSize:"2em",marginTop:"0.67em",marginBottom:"0.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h2:{display:"block",fontSize:"1.5em",marginTop:"0.83em",marginBottom:"0.83em",marginLeft:0,marginRight:0,fontWeight:"bold"},h3:{display:"block",fontSize:"1.17em",marginTop:"1em",marginBottom:"1em",marginLeft:0,marginRight:0,fontWeight:"bold"},h4:{display:"block",marginTop:"1.33em",marginBottom:"1.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},h5:{display:"block",fontSize:"0.83em",marginTop:"1.67em",marginBottom:"1.67em",marginLeft:0,marginRight:0,fontWeight:"bold"},h6:{display:"block",fontSize:"0.67em",marginTop:"2.33em",marginBottom:"2.33em",marginLeft:0,marginRight:0,fontWeight:"bold"},u:{textDecoration:"underline"},strong:{fontWeight:"bold"},b:{fontWeight:"bold"},i:{fontStyle:"italic"},em:{fontStyle:"italic"},code:{fontFamily:"monospace"},kbd:{fontFamily:"monospace"},pre:{display:"block",fontFamily:"monospace",whiteSpace:"pre",marginTop:"1em",marginBottom:"1em"},mark:{backgroundColor:"yellow",color:"black"},big:{fontSize:"larger"},small:{fontSize:"smaller"},s:{textDecoration:"line-through"}};var Dt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","filter","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Ne(e){let t={};for(let r in e)Dt.has(r)&&(t[r]=e[r]);return t}import{getPropertyName as er,getStylesForProperty as tr}from"css-to-react-native";import{parseElementStyle as rr}from"css-background-parser";var ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bt=ye((e,t)=>{t.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Yt=ye((e,t)=>{t.exports=["deg","grad","rad","turn"]}),Ht=ye((e,t)=>{t.exports=["dpi","dpcm","dppx"]}),Xt=ye((e,t)=>{t.exports=["Hz","kHz"]}),Ut=ye((e,t)=>{t.exports=["s","ms"]}),zt=Bt(),bt=Yt(),yt=Ht(),xt=Xt(),Et=Ut();function De(e){if(/\.\D?$/.test(e))throw new Error("The dot should be followed by a number");if(/^[+-]{2}/.test(e))throw new Error("Only one leading +/- is allowed");if(jt(e)>1)throw new Error("Only one dot is allowed");if(/%$/.test(e)){this.type="percentage",this.value=Ge(e),this.unit="%";return}var t=Jt(e);if(!t){this.type="number",this.value=Ge(e);return}this.type=qt(t),this.value=Ge(e.substr(0,e.length-t.length)),this.unit=t}De.prototype.valueOf=function(){return this.value};De.prototype.toString=function(){return this.value+(this.unit||"")};function ue(e){return new De(e)}function jt(e){var t=e.match(/\./g);return t?t.length:0}function Ge(e){var t=parseFloat(e);if(isNaN(t))throw new Error("Invalid number: "+e);return t}var Vt=[].concat(bt,xt,zt,yt,Et);function Jt(e){var t=e.match(/\D+$/),r=t&&t[0];if(r&&Vt.indexOf(r)===-1)throw new Error("Invalid unit: "+r);return r}var Kt=Object.assign(Ie(bt,"angle"),Ie(xt,"frequency"),Ie(yt,"resolution"),Ie(Et,"time"));function Ie(e,t){return Object.fromEntries(e.map(r=>[r,t]))}function qt(e){return Kt[e]||"length"}import Zt from"postcss-value-parser";function Qt(e,t){try{let r=new ue(e);switch(r.unit){case"px":return{absolute:r.value};case"em":return{absolute:r.value*t};case"rem":return{absolute:r.value*16};case"%":return{relative:r.value};default:return{}}}catch{return{}}}function Be(e,t,r){switch(e){case"top":return{yRelative:0};case"left":return{xRelative:0};case"right":return{xRelative:100};case"bottom":return{yRelative:100};case"center":return{};default:let o=Qt(e,t);return o.absolute?{[r?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[r?"xRelative":"yRelative"]:o.relative}:{}}}function Ye(e,t){if(typeof e=="number")return{xAbsolute:e};let r;try{r=Zt(e).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return r.length===1?Be(r[0],t,!0):r.length===2?((r[0]==="top"||r[0]==="bottom"||r[1]==="left"||r[1]==="right")&&r.reverse(),D(D({},Be(r[0],t,!0)),Be(r[1],t,!1))):{}}var nr=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ir=new Set(["lineHeight"]),St=[1,0,0,1,0,0];function or(e,t,r,o){return e==="border"&&!r.includes(t.borderColor)?t.borderColor=o:e==="borderColor"?t.borderColor=t.borderTopColor:e==="textDecoration"&&!r.includes(t.textDecorationColor)&&(t.textDecorationColor=o),t}function _t(e,t){return typeof t=="number"?nr.has(e)?ir.has(e)?t:String(t):t+"px":t}function ar(e,t){return e==="lineHeight"?{lineHeight:_t(e,t)}:e==="fontFamily"?{fontFamily:t.split(",").map(r=>r.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,t,r,{percentage:o}={percentage:!1}){if(typeof e=="number")return e;try{let a=new ue(e);if(a.type==="length")switch(a.unit){case"em":return a.value*t;case"rem":return a.value*16;case"vw":return~~(a.value*r._viewportWidth/100);case"vh":return~~(a.value*r._viewportHeight/100);default:return a.value}else if(a.type==="angle")switch(a.unit){case"deg":return a.value;case"rad":return a.value*180/Math.PI;default:return a.value}else if(a.type==="percentage"&&o)return a.value/100*t}catch{}}function Le(e,t){let r={};for(let a in e){if(a.startsWith("_")){r[a]=e[a];continue}let i=er(a);Object.assign(r,ar(i,e[a])||or(i,tr(i,_t(i,e[a]),!0),e[a],e.color||t.color))}if(r.backgroundImage){let{backgrounds:a}=rr(r);r.backgroundImage=a}let o=r.fontSize||t.fontSize;if(typeof o=="string")try{let a=new ue(o);switch(a.unit){case"em":o=a.value*t.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof r.fontSize!="undefined"&&(r.fontSize=o),r.transformOrigin&&(r.transformOrigin=Ye(r.transformOrigin,o));for(let a in r){let i=r[a];if(a==="lineHeight")typeof i=="string"&&(i=r[a]=He(i,o,t,{percentage:!0})/o);else if(typeof i=="string"){let n=He(i,o,t);typeof n!="undefined"&&(r[a]=n),i=r[a]}if(a==="opacity"&&(i=r[a]=i*t.opacity),a==="transform"){let n=[...St],s=i;for(let u of s){let m=Object.keys(u)[0],g=u[m],d=typeof g=="string"?He(g,o,t):g,c=[...St];switch(m){case"translateX":c[4]=d;break;case"translateY":c[5]=d;break;case"scale":c[0]=d,c[3]=d;break;case"scaleX":c[0]=d;break;case"scaleY":c[3]=d;break;case"rotate":let h=d*Math.PI/180,l=Math.cos(h),f=Math.sin(h);c[0]=l,c[1]=f,c[2]=-f,c[3]=l;break;case"skewX":c[2]=Math.tan(d*Math.PI/180);break;case"skewY":c[1]=Math.tan(d*Math.PI/180);break}n=ge(c,n)}r.transform=n}}return r}function Xe(e,t,r,o,a){let i=te(),n=D(D(D({},r),Le(ht[t],r)),Le(o,r));if(t==="img"){let s=parseInt(a.width),m=parseInt(a.height)/s;n.width||(n.width=s),n.height||(n.height=m*n.width)}return e.setDisplay(Z(n.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),e.setAlignContent(Z(n.alignContent,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,"space-between":i.ALIGN_SPACE_BETWEEN,"space-around":i.ALIGN_SPACE_AROUND,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setAlignItems(Z(n.alignItems,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_FLEX_START)),e.setAlignSelf(Z(n.alignSelf,{stretch:i.ALIGN_STRETCH,center:i.ALIGN_CENTER,"flex-start":i.ALIGN_FLEX_START,"flex-end":i.ALIGN_FLEX_END,baseline:i.ALIGN_BASELINE,normal:i.ALIGN_AUTO},i.ALIGN_AUTO)),e.setJustifyContent(Z(n.justifyContent,{center:i.JUSTIFY_CENTER,"flex-start":i.JUSTIFY_FLEX_START,"flex-end":i.JUSTIFY_FLEX_END,"space-between":i.JUSTIFY_SPACE_BETWEEN,"space-around":i.JUSTIFY_SPACE_AROUND},i.JUSTIFY_FLEX_START)),e.setFlexDirection(Z(n.flexDirection,{row:i.FLEX_DIRECTION_ROW,column:i.FLEX_DIRECTION_COLUMN,"row-reverse":i.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":i.FLEX_DIRECTION_COLUMN_REVERSE},i.FLEX_DIRECTION_ROW)),e.setFlexWrap(Z(n.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof n.flexBasis!="undefined"&&e.setFlexBasis(n.flexBasis),e.setFlexGrow(typeof n.flexGrow=="undefined"?0:n.flexGrow),e.setFlexShrink(typeof n.flexShrink=="undefined"?0:n.flexShrink),typeof n.maxHeight!="undefined"&&e.setMaxHeight(n.maxHeight),typeof n.maxWidth!="undefined"&&e.setMaxWidth(n.maxWidth),typeof n.minHeight!="undefined"&&e.setMinHeight(n.minHeight),typeof n.minWidth!="undefined"&&e.setMinWidth(n.minWidth),e.setOverflow(Z(n.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),e.setMargin(i.EDGE_TOP,n.marginTop||0),e.setMargin(i.EDGE_BOTTOM,n.marginBottom||0),e.setMargin(i.EDGE_LEFT,n.marginLeft||0),e.setMargin(i.EDGE_RIGHT,n.marginRight||0),e.setBorder(i.EDGE_TOP,n.borderWidth||0),e.setBorder(i.EDGE_BOTTOM,n.borderWidth||0),e.setBorder(i.EDGE_LEFT,n.borderWidth||0),e.setBorder(i.EDGE_RIGHT,n.borderWidth||0),e.setPadding(i.EDGE_TOP,n.paddingTop||0),e.setPadding(i.EDGE_BOTTOM,n.paddingBottom||0),e.setPadding(i.EDGE_LEFT,n.paddingLeft||0),e.setPadding(i.EDGE_RIGHT,n.paddingRight||0),e.setPositionType(Z(n.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&e.setPosition(i.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&e.setPosition(i.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&e.setPosition(i.EDGE_LEFT,n.left),typeof n.right!="undefined"&&e.setPosition(i.EDGE_RIGHT,n.right),typeof n.height!="undefined"?e.setHeight(n.height):e.setHeightAuto(),typeof n.width!="undefined"?e.setWidth(n.width):e.setWidthAuto(),[n,Ne(n)]}function fe({left:e,top:t,width:r,height:o},a,i,n){var u,m,g,d;let s;if(i)s=a;else{let c=(m=n==null?void 0:n.xAbsolute)!=null?m:((u=n==null?void 0:n.xRelative)!=null?u:50)*r/100,h=(d=n==null?void 0:n.yAbsolute)!=null?d:((g=n==null?void 0:n.yRelative)!=null?g:50)*o/100,l=e+c,f=t+h;s=ge([1,0,0,1,l,f],ge(a,[1,0,0,1,-l,-f])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(c=>c.toFixed(2)).join(",")})`}function Tt({left:e,top:t,width:r,height:o,isInheritingTransform:a},i){let n="",s=1;return i.transform&&(n=fe({left:e,top:t,width:r,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:n,opacity:s}}function Ue({id:e,content:t,filter:r,left:o,top:a,width:i,height:n,matrix:s,opacity:u,image:m,clipPathId:g,debug:d,shape:c,decorationShape:h},l){let f="";if(d&&(f=y("rect",{x:o,y:a-n,width:i,height:n,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),m){let x={href:m,x:o,y:a,width:i,height:n,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(r?`${r}<g filter="url(#satori_s-${e})">`:"")+y("image",se(D({},x),{opacity:u!==1?u:void 0}))+(h||"")+(r?"</g>":"")+f,""]}let b={x:o,y:a,width:i,height:n,"font-weight":l.fontWeight,"font-style":l.fontStyle,"font-size":l.fontSize,"font-family":l.fontFamily,"letter-spacing":l.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:l.filter?`filter:${l.filter}`:void 0};return[(r?`${r}<g filter="url(#satori_s-${e})">`:"")+y("text",se(D({},b),{fill:l.color,opacity:u!==1?u:void 0}),t)+(h||"")+(r?"</g>":"")+f,c?y("text",b,t):""]}function ce({id:e,width:t,height:r},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=o.shadowRadius*o.shadowRadius/4,i=Math.min(o.shadowOffset.width-a,0),n=Math.max(o.shadowOffset.width+a+t,t),s=Math.min(o.shadowOffset.height-a,0),u=Math.max(o.shadowOffset.height+a+r,r);return`<defs><filter id="satori_s-${e}" x="${i/t*100}%" y="${s/r*100}%" width="${(n-i)/t*100}%" height="${(u-s)/r*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:t,top:r,ascender:o,clipPathId:a},i){let{textDecorationColor:n,textDecorationStyle:s,textDecorationLine:u,fontSize:m}=i;if(!u||u==="none")return"";let g=Math.max(1,m*.1),d=u==="line-through"?r+o*.5:u==="underline"?r+o*1.1:r,c=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:t,y1:d,x2:t+e,y2:d,stroke:n,"stroke-width":g,"stroke-dasharray":c,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var je=void 0;function*Ve(e,t){var lt;let r=te(),{parentStyle:o,inheritedStyle:a,parent:i,font:n,id:s,isInheritingTransform:u,debug:m,embedFont:g,graphemeImages:d,canLoadAdditionalAssets:c}=t;o.textTransform==="uppercase"?e=e.toLocaleUpperCase(je):o.textTransform==="lowercase"?e=e.toLocaleLowerCase(je):o.textTransform==="capitalize"&&(e=le(e,"word").map(v=>le(v,"grapheme").map((k,A)=>A===0?k.toLocaleUpperCase(je):k).join("")).join(""));let h=Z(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),l=le(e,h),f=r.Node.create();f.setAlignItems(r.ALIGN_BASELINE),o.textAlign==="left"?f.setJustifyContent(r.JUSTIFY_FLEX_START):o.textAlign==="center"?f.setJustifyContent(r.JUSTIFY_CENTER):o.textAlign==="right"?f.setJustifyContent(r.JUSTIFY_FLEX_END):o.textAlign==="justify"&&f.setJustifyContent(r.JUSTIFY_SPACE_BETWEEN),i.insertChild(f,i.getChildCount());let{textAlign:b,textOverflow:x,whiteSpace:E,lineHeight:O,filter:W,_inheritedBackgroundClipTextPath:G}=o,M=o.fontSize,T=n.getEngine(M,O,o),K=c?l.filter(v=>!T.check(v)):[];yield K,K.length&&(T=n.getEngine(M,O,o));let $=[],_=[],N=[],H=[],U=new Map,w=v=>{let k=0;for(let A of v){if(U.has(A)){k+=U.get(A);continue}let X=T.measure(A,o);U.set(A,X),k+=X}return k},F=0,R=[],p=0;for(let v of l){let k=!1,A=d&&d[v];E==="pre"?k=v[0]===` | ||
`:E!=="nowrap"&&(A||Ce.includes(v[0]))&&(k=!0),k?(E==="nowrap"?p+=w(R)+o.fontSize:(F=Math.max(F,w(R)),A&&(F=Math.max(F,o.fontSize))),R=[]):(!Ce.includes(v[0])||!R.length)&&R.push(v===` | ||
`?" ":v)}F=Math.max(F,w(R)+p);let S=i.getMinWidth(),L=i.getMaxWidth(),Q=i.getWidth();isNaN(Q.value)&&(isNaN(S.value)||S.unit===1&&S.value>F)&&(isNaN(L.value)||L.unit===1&&(F=Math.min(F,L.value)),i.setMinWidth(F)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let he=E==="pre-wrap"||E==="pre";f.setMeasureFunc(v=>{let k=0,A="",X=0,z=0,j=0,V=-1,ie=0,P=0,oe=0;$=[],N=[0];for(let ne=0;ne<l.length;ne++){let B=l[ne];if(!he&&Ce.includes(B[0]))A||(A=" "),X=w([A]),H[ne]=null;else{let ae=he&&B===` | ||
`,J=ae?0:d&&d[B]?o.fontSize:w([B]);z||(A="",X=0);let Y=X||",.!?:-@)>]}%#".indexOf(B[0])<0,q=!z||!!X;if(ae||ne&&Y&&z+X+J>v&&E!=="nowrap"&&E!=="pre")$.push(z),_.push(oe),k++,ie+=P,z=J,P=J?T.height(B):0,oe=J?T.baseline(B):0,N.push(1),V=-1,ae||(j=Math.max(j,v));else{z+=X+J;let me=T.height(B);me>P&&(P=me,oe=T.baseline(B)),q&&N[N.length-1]++}A="",X=0,q&&V++,j=Math.max(j,z),H[ne]={y:ie,x:z-J,width:J,line:k,lineIndex:V}}}return z&&(k++,$.push(z),_.push(oe),ie+=P),{width:j,height:ie}});let[Lt,kt]=yield,Fe="",Se="",re=a._inheritedClipPathId,{left:nt,top:it,width:_e,height:ot}=f.getComputedLayout(),Oe=i.getComputedWidth()-i.getComputedPadding(r.EDGE_LEFT)-i.getComputedPadding(r.EDGE_RIGHT)-i.getComputedBorder(r.EDGE_LEFT)-i.getComputedBorder(r.EDGE_RIGHT),de=Lt+nt,pe=kt+it,{matrix:ee,opacity:Te}=Tt({left:nt,top:it,width:_e,height:ot,isInheritingTransform:u},o),we="";o.textShadowOffset&&(we=ce({width:_e,height:ot,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let be="",Re="",at="",$e=-1,st=x==="ellipsis"?w(["\u2026"]):0,At=x==="ellipsis"?w([" "]):0,ve={};for(let v=0;v<l.length;v++){if(!H[v])continue;let k=H[v],A=l[v],X=null,z=d?d[A]:null,j=k.y,V=k.x,ie=k.width,P=k.line;if(P===$e)continue;let oe=!1;if($.length>1){let Y=_e-$[P];if(b==="right"||b==="end")V+=Y;else if(b==="center")V+=Y/2;else if(b==="justify"&&P<$.length-1){let q=N[P];V+=(q>1?Y/(q-1):0)*k.lineIndex,oe=!0}}if(ve[P]||(ve[P]=[V,oe?_e:$[P]]),x==="ellipsis"&&$[P]>Oe&&k.x+ie+st+At>Oe){let Y=le(A,"grapheme"),q="",me=0;for(let ut of Y){let ft=k.x+w([q+ut]);if(q&&ft+st>Oe)break;q+=ut,me=ft}A=q+"\u2026",$e=P,ve[P][1]=me}let ne=_[P],B=T.baseline(A),ae=T.height(A),J=ne-B;if(z?j+=0:g?(X=T.getSVG(A,se(D({},o),{left:de+V,top:pe+j+B+J,letterSpacing:o.letterSpacing})),m&&(at+=y("rect",{x:de+V,y:pe+j+J,width:k.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0})+y("line",{x1:de+V,x2:de+V+k.width,y1:pe+j+J+B,y2:pe+j+J+B,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0}))):j+=B+J,o.textDecorationLine&&(P!==((lt=H[v+1])==null?void 0:lt.line)||$e===P)){let Y=ve[P];Y&&!Y[2]&&(be+=ze({left:de+Y[0],top:pe+ae*+P,width:Y[1],ascender:T.baseline(A),clipPathId:re},o),Y[2]=1)}if(X!==null)Re+=X+" ";else{let[Y,q]=Ue({content:A,filter:we,id:s,left:de+V,top:pe+j,width:ie,height:ae,matrix:ee,opacity:Te,image:z,clipPathId:re,debug:m,shape:!!G,decorationShape:be},o);Fe+=Y,Se+=q,be=""}}if(Re){let v=o.color!=="transparent"&&Te!==0?y("path",{fill:o.color,d:Re,transform:ee||void 0,opacity:Te!==1?Te:void 0,"clip-path":re?`url(#${re})`:void 0,style:W?`filter:${W}`:void 0}):"";G&&(Se=y("path",{d:Re,transform:ee||void 0})),Fe+=(we?we+y("g",{filter:`url(#satori_s-${s})`},v+be):v+be)+at}return Se&&(o._inheritedBackgroundClipTextPath.value+=Se),Fe}var Je=Je||{};Je.parse=function(){var e={linearGradient:/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,repeatingLinearGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,radialGradient:/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,repeatingRadialGradient:/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function r(p){var S=new Error(t+": "+p);throw S.source=t,S}function o(){var p=a();return t.length>0&&r("Invalid input not EOF"),p}function a(){return O(i)}function i(){return n("linear-gradient",e.linearGradient,u)||n("repeating-linear-gradient",e.repeatingLinearGradient,u)||n("radial-gradient",e.radialGradient,d)||n("repeating-radial-gradient",e.repeatingRadialGradient,d)}function n(p,S,L){return s(S,function(Q){var he=L();return he&&(F(e.comma)||r("Missing comma before color stops")),{type:p,orientation:he,colorStops:O(W)}})}function s(p,S){var L=F(p);if(L){F(e.startCall)||r("Missing (");var Q=S(L);return F(e.endCall)||r("Missing )"),Q}}function u(){return m()||g()}function m(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function d(){var p,S=c(),L;return S&&(p=[],p.push(S),L=t,F(e.comma)&&(S=c(),S?p.push(S):t=L)),p}function c(){var p=h()||l();if(p)p.at=b();else{var S=f();if(S){p=S;var L=b();L&&(p.at=L)}else{var Q=x();Q&&(p={type:"default-radial",at:Q})}}return p}function h(){var p=w("shape",/^(circle)/i,0);return p&&(p.style=U()||f()),p}function l(){var p=w("shape",/^(ellipse)/i,0);return p&&(p.style=N()||f()),p}function f(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("position",/^at/,0)){var p=x();return p||r("Missing positioning value"),p}}function x(){var p=E();if(p.x||p.y)return{type:"position",value:p}}function E(){return{x:N(),y:N()}}function O(p){var S=p(),L=[];if(S)for(L.push(S);F(e.comma);)S=p(),S?L.push(S):r("One extra comma");return L}function W(){var p=G();return p||r("Expected color definition"),p.length=N(),p}function G(){return T()||$()||K()||M()}function M(){return w("literal",e.literalColor,0)}function T(){return w("hex",e.hexColor,1)}function K(){return s(e.rgbColor,function(){return{type:"rgb",value:O(_)}})}function $(){return s(e.rgbaColor,function(){return{type:"rgba",value:O(_)}})}function _(){return F(e.number)[1]}function N(){return w("%",e.percentageValue,1)||H()||U()}function H(){return w("position-keyword",e.positionKeywords,1)}function U(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(p,S,L){var Q=F(S);if(Q)return{type:p,value:Q[L]}}function F(p){var S,L;return L=/^[\n\r\t\s]+/.exec(t),L&&R(L[0].length),S=p.exec(t),S&&R(S[0].length),S}function R(p){t=t.substr(p)}return function(p){return t=p.toString(),o()}}();var Ke=Je;function sr(e){return e.type==="literal"?e.value:e.type==="hex"?`#${e.value}`:e.type==="rgb"?`rgb(${e.value.join(",")})`:e.type==="rgba"?`rgba(${e.value.join(",")})`:"transparent"}function lr(e,t){return typeof e=="string"&&e.endsWith("%")?t*parseFloat(e)/100:+e}function wt(e,{x:t,y:r,defaultX:o,defaultY:a}){return(e?e.split(" ").map(i=>{try{let n=new ue(i);return n.type==="length"||n.type==="number"?n.value:n.value+n.unit}catch{return null}}).filter(i=>i!==null):[o,a]).map((i,n)=>lr(i,[t,r][n]))}function Rt(e,t){let r=[];for(let n of t){let s=sr(n);if(!r.length&&(r.push({offset:0,color:s}),typeof n.length=="undefined"||n.length.value==="0"))continue;let u=typeof n.length=="undefined"?void 0:n.length.type==="%"?n.length.value/100:n.length.value/e;r.push({offset:u,color:s})}r.length||r.push({offset:0,color:"transparent"});let o=r[r.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:r.push({offset:1,color:o.color}));let a=0,i=1;for(let n=0;n<r.length;n++)if(typeof r[n].offset=="undefined"){for(i<n&&(i=n);typeof r[i].offset=="undefined";)i++;r[n].offset=(r[i].offset-r[a].offset)/(i-a)*(n-a)+r[a].offset}else a=n;return r}function qe({id:e,width:t,height:r},{image:o,size:a,position:i,repeat:n}){n=n||"repeat";let s=n==="repeat-x"||n==="repeat",u=n==="repeat-y"||n==="repeat",m=wt(a,{x:t,y:r,defaultX:t,defaultY:r}),g=wt(i,{x:t,y:r,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let d=Ke.parse(o)[0],c,h,l,f;if(d.orientation.type==="directional")[c,h,l,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[d.orientation.value];else if(d.orientation.type==="angular"){let x=+d.orientation.value/180*Math.PI-Math.PI/2,E=Math.cos(x),O=Math.sin(x);c=0,h=0,l=E,f=O,l<0&&(c-=l,l=0),f<0&&(h-=f,f=0)}let b=Rt(t,d.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${c}" y1="${h}" x2="${l}" y2="${f}">${b.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let d=Ke.parse(o)[0],c=d.orientation[0],[h,l]=m,f="circle",b=h/2,x=l/2;if(c.type==="shape"){if(f=c.value,c.at)if(c.at.type==="position")b=c.at.value.x.value,x=c.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+c.at.type)}else throw new Error("orientation.type not implemented: "+c.type);let E=Rt(t,d.colorStops),O=`satori_radial_${e}`,W=`satori_pattern_${e}`,G={},M=Math.max(Math.abs(h-b),Math.abs(b)),T=Math.max(Math.abs(l-x),Math.abs(x));if(f==="circle")G.r=Math.sqrt(M*M+T*T);else if(f==="ellipse"){let _=T!==0?M/T:1;G.ry=Math.sqrt(M*M+T*T*_*_)/_,G.rx=G.ry*_}let K=y("pattern",{id:W,x:g[0],y:g[1],width:s?h:"100%",height:u?l:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:O},E.map(_=>y("stop",{offset:_.offset,"stop-color":_.color})).join(""))+y(f,se(D({cx:b,cy:x,width:h,height:l},G),{fill:`url(#${O})`})));return[W,K]}if(o.startsWith("url(")){let d=o.slice(4,-1);return[`satori_bi${e}`,y("pattern",{id:`satori_bi${e}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?m[0]:"100%",height:u?m[1]:"100%"},y("image",{x:0,y:0,width:m[0],height:m[1],href:d}))]}}function ke(e,t,r){return r<e+t&&(r/2<e&&r/2<t?e=t=r/2:r/2<e?e=r-t:r/2<t&&(t=r-e)),[e,t]}function xe({left:e,top:t,width:r,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:n,borderBottomLeftRadius:s,borderBottomRightRadius:u}=a;return i=Math.min(i||0,r,o),n=Math.min(n||0,r,o),s=Math.min(s||0,r,o),u=Math.min(u||0,r,o),!i&&!n&&!s&&!u?"":([i,n]=ke(i,n,r),[i,s]=ke(i,s,o),[n,u]=ke(n,u,o),[s,u]=ke(s,u,r),`M${e+i},${t} h${r-i-n} a${n},${n} 0 0 1 ${n},${n} v${o-n-u} a${u},${u} 0 0 1 ${-u},${u} h${u+s-r} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function Ze({left:e,top:t,width:r,height:o,path:a,id:i},n){return n.overflow!=="hidden"?"":a?y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("path",{x:e,y:t,width:r,height:o,d:a})):y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("rect",{x:e,y:t,width:r,height:o}))}function Qe({id:e,left:t,top:r,width:o,height:a,isInheritingTransform:i,debug:n},s){if(s.display==="none")return"";let u="rect",m="transparent",g="",d=0,c="",h="",l=[],f=1,b="";s.backgroundColor&&l.push(s.backgroundColor),s.borderWidth&&(d=s.borderWidth,m=s.borderColor,s.borderStyle==="dashed"&&(g=d*2+" "+d)),s.opacity&&(f=+s.opacity),s.transform&&(c=fe({left:t,top:r,width:o,height:a},s.transform,i,s.transformOrigin));let x="";if(s.backgroundImage){let $=s.backgroundImage.map((_,N)=>qe({id:e+"_"+N,width:o,height:a},_)).filter(Boolean);for(let _ of $)l.push(`url(#${_[0]})`),h+=_[1],_[2]&&(x+=_[2])}let E=xe({left:t,top:r,width:o,height:a},s);E&&(u="path");let O=Ze({left:t,top:r,width:o,height:a,path:E,id:e},s),W=s._inheritedClipPathId,G=ce({width:o,height:a,id:e},s);n&&(b=y("rect",{x:t,y:r,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,"stroke-dasharray":g||void 0,transform:c||void 0,"clip-path":W?`url(#${W})`:void 0})),l.length||l.push("transparent");let{backgroundClip:M,filter:T}=s,K=l.map(($,_)=>{if($==="transparent"&&!(_===l.length-1&&d))return"";let N=!!d,H=_===l.length-1&&N&&M!=="text",U=M==="text"?`url(#satori_bct-${e})`:W?`url(#${W})`:void 0;return H&&(h+=y("clipPath",{id:`satori_bc-${e}`,"clip-path":U},y(u,{x:t,y:r,width:o,height:a,d:E||void 0})),U=`url(#satori_bc-${e})`),y(u,{x:t,y:r,width:o,height:a,fill:$,stroke:H||N?m:void 0,"stroke-width":H?d*2:N?1:void 0,"stroke-dasharray":g||void 0,d:E||void 0,transform:c||void 0,"clip-path":U,style:T?`filter:${T}`:void 0})}).join("");return M==="text"&&d&&(K=y(u,{x:t,y:r,width:o,height:a,fill:"transparent",stroke:m,"stroke-width":d*2,"stroke-dasharray":g||void 0,d:E||void 0,transform:c||void 0,"clip-path":W?`url(#${W})`:void 0})+K),(h?`<defs>${h}</defs>`:"")+O+(G?`${G}<g filter="url(#satori_s-${e})">`:"")+(f!==1?`<g opacity="${f}">`:"")+(x||K)+(f!==1?"</g>":"")+(G?"</g>":"")+b}function et({id:e,left:t,top:r,width:o,height:a,src:i,debug:n,isInheritingTransform:s},u){if(u.display==="none")return"";let m="",g=1,d="",c=u.objectFit==="contain"?"xMidYMid":u.objectFit==="cover"?"xMidYMid slice":"none",h=xe({left:t,top:r,width:o,height:a},u),l=u._inheritedClipPathId;h&&(m=y("clipPath",{id:`satori_c-${e}`,"clip-path":l?`url(#${l})`:void 0},y("path",{x:t,y:r,width:o,height:a,d:h}))),u.opacity&&(g=+u.opacity);let f=ce({width:o,height:a,id:e},u);return u.transform&&(d=fe({left:t,top:r,width:o,height:a},u.transform,s,u.transformOrigin)),f+(f?`<g filter="url(#satori_s-${e})">`:"")+m+y("image",{x:t,y:r,width:o,height:a,href:i,preserveAspectRatio:c,transform:d||void 0,"clip-path":m?`url(#satori_c-${e})`:l?`url(#${l})`:void 0})+(f?"</g>":"")}function*Ee(e,t){let r=te(),{id:o,inheritedStyle:a,parent:i,font:n,debug:s,embedFont:u=!0,graphemeImages:m,canLoadAdditionalAssets:g}=t;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let R;if(!We(e))R=Ve(String(e),t),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=Ee(e.type(e.props),t),yield R.next().value}R.next();let p=yield;return R.next(p).value}let{type:d,props:c}=e,{style:h,children:l}=c,f=r.Node.create();i.insertChild(f,i.getChildCount());let[b,x]=Xe(f,d,a,h,c),E=b.transform===a.transform;if(E||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(x._inheritedClipPathId=`satori_cp-${o}`),b.backgroundClip==="text"){let R={value:""};x._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let O=typeof l=="undefined"?[]:[].concat(l),W=[],G=0,M=[];for(let R of O){let p=Ee(R,{id:o+"-"+G++,parentStyle:b,inheritedStyle:x,isInheritingTransform:!0,parent:f,font:n,embedFont:u,debug:s,graphemeImages:m,canLoadAdditionalAssets:g});g?M.push(...p.next().value||[]):p.next(),W.push(p)}yield M;for(let R of W)R.next();let[T,K]=yield,{left:$,top:_,width:N,height:H}=f.getComputedLayout();$+=T,_+=K;let U="",w="",F="";d==="img"?w=et({id:o,left:$,top:_,width:N,height:H,src:c.src,isInheritingTransform:E,debug:s},b):w=Qe({id:o,left:$,top:_,width:N,height:H,isInheritingTransform:E,debug:s},b);for(let R of W)U+=R.next([$,_]).value;return b._inheritedBackgroundClipTextPath&&(F+=y("clipPath",{id:`satori_bct-${o}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),F+w+U}import ur from"@shuding/opentype.js";function fr(e,t,[r,o],[a,i]){if(r!==a)return r?!a||r===e?-1:a===e?1:e===400&&r===500||e===500&&r===400?-1:e===400&&a===500||e===500&&a===400?1:e<400?r<e&&a<e?a-r:r<e?-1:a<e?1:r-a:e<r&&e<a?r-a:e<r?-1:e<a?1:a-r:1;if(o!==i){if(o===t)return-1;if(i===t)return 1}return-1}var Ae=class{constructor(t){this.fonts=new Map;this.addFonts(t)}get({name:t,weight:r,style:o}){if(!this.fonts.has(t))return null;r==="normal"&&(r=400),r==="bold"&&(r=700);let a=[...this.fonts.get(t)],i=a[0];for(let n=1;n<a.length;n++){let[,s,u]=i,[,m,g]=a[n];fr(r,o,[s,u],[m,g])>0&&(i=a[n])}return i[0]}addFonts(t){for(let r of t){let o=r.data,a=ur.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0}),i=a.charToGlyphIndex;a.charToGlyphIndex=s=>{let u=i.call(a,s);return u===0&&a._trackBrokenChars&&a._trackBrokenChars.push(s),u},this.defaultFont||(this.defaultFont=a);let n=r.name.toLowerCase();this.fonts.has(n)||this.fonts.set(n,[]),this.fonts.get(n).push([a,r.weight,r.style])}}getEngine(t=16,r=1.2,{fontFamily:o,fontWeight:a=400,fontStyle:i="normal"}){o=Array.isArray(o)?o:[o];let n=o.map(l=>this.get({name:l,weight:a,style:i})).filter(Boolean),s=Array.from(this.fonts.keys());for(let l of s)o.includes(l)||n.push(this.get({name:l,weight:a,style:i}));let u=new Map,m=(l,f=!0)=>{let b=l.charCodeAt(0);if(u.has(b))return u.get(b);let x=n.find((E,O)=>!!E.charToGlyphIndex(l)||f&&O===n.length-1);return x&&u.set(b,x),x},g=(l,f=!1)=>{var x,E;return((f?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoAscender:0)||l.ascender)/l.unitsPerEm*t},d=(l,f=!1)=>{var x,E;return((f?(E=(x=l.tables)==null?void 0:x.os2)==null?void 0:E.sTypoDescender:0)||l.descender)/l.unitsPerEm*t},c=l=>m(l,!1),h={check:l=>{let f=c(l);return f?(f._trackBrokenChars=[],f.stringToGlyphs(l),f._trackBrokenChars.length?(f._trackBrokenChars=void 0,!1):!0):!1},baseline:(l,f=typeof l=="undefined"?n[0]:m(l))=>{let b=g(f,!0),x=d(f,!0),E=h.height(l,f),{yMax:O,yMin:W}=f.tables.head,G=b-x,M=(O/(O-W)-1)*G;return E*((1.2/r+1)/2)+M},height:(l,f=typeof l=="undefined"?n[0]:m(l))=>(g(f)-d(f))*(r/1.2),measure:(l,f)=>this.measure(m,l,f),getSVG:(l,f)=>this.getSVG(m,l,f)};return h}patchFontFallbackResolver(t,r){let o=[];t._trackBrokenChars=o;let a=t.stringToGlyphs;return t.stringToGlyphs=(i,...n)=>{let s=a.call(t,i,...n);for(let u=0;u<s.length;u++)if(s[u].unicode===void 0){let m=o.shift(),g=r(m);g!==t&&(s[u]=g.charToGlyph(m))}return s},()=>{t.stringToGlyphs=a,t._trackBrokenChars=void 0}}measure(t,r,{fontSize:o,letterSpacing:a=0}){let i=t(r),n=this.patchFontFallbackResolver(i,t);try{return i.getAdvanceWidth(r,o,{letterSpacing:a/o})}finally{n()}}getSVG(t,r,{fontSize:o,top:a,left:i,letterSpacing:n=0}){let s=t(r),u=this.patchFontFallbackResolver(s,t);try{return s.getPath(r,i,a,o,{letterSpacing:n/o}).toPathData(1)}finally{u()}}};function tt({width:e,height:t,content:r}){return y("svg",{width:e,height:t,viewBox:`0 0 ${e} ${t}`,xmlns:"http://www.w3.org/2000/svg"},r)}var vt={emoji:/\p{RI}\p{RI}|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?(\u{200D}\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?)+|\p{EPres}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})?|\p{Emoji}(\p{EMod}+|\u{FE0F}\u{20E3}?|[\u{E0020}-\u{E007E}]+\u{E007F})/u,ja:/\p{scx=Hira}|\p{scx=Kana}|[,;:]/u,ko:/\p{scx=Hangul}/u,zh:/\p{scx=Han}/u,th:/\p{scx=Thai}/u,ar:/\p{scx=Arabic}/u,ta:/\p{scx=Tamil}/u,ml:/\p{scx=Malayalam}/u,he:/\p{scx=Hebrew}/u,te:/\p{scx=Telugu}/u,devanagari:/\p{scx=Devanagari}/u};function Ct(e){for(let t in vt)if(vt[t].test(e))return t;return"unknown"}var rt=new WeakMap;async function It(e,t){let r=te();if(!r)throw new Error("Satori is not initialized.");let o;rt.has(t.fonts)?o=rt.get(t.fonts):rt.set(t.fonts,o=new Ae(t.fonts));let a=r.Node.create();a.setWidth(t.width),a.setHeight(t.height),a.setFlexDirection(r.FLEX_DIRECTION_ROW),a.setFlexWrap(r.WRAP_WRAP),a.setAlignContent(r.ALIGN_AUTO),a.setAlignItems(r.ALIGN_FLEX_START),a.setJustifyContent(r.JUSTIFY_FLEX_START),a.setOverflow(r.OVERFLOW_HIDDEN);let i=D({},t.graphemeImages),n=Ee(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:t.width,_viewportHeight:t.height},parent:a,font:o,embedFont:t.embedFont,debug:t.debug,graphemeImages:i,canLoadAdditionalAssets:!!t.loadAdditionalAsset}),s=n.next().value;if(t.loadAdditionalAsset&&s.length){s=Array.from(new Set(le(s.join(""),"grapheme")));let m={};s.forEach(c=>{let h=Ct(c);m[h]=m[h]||[],h==="emoji"?m[h].push(c):m[h][0]=(m[h][0]||"")+c});let g=[],d={};await Promise.all(Object.entries(m).flatMap(([c,h])=>h.map(l=>t.loadAdditionalAsset(c,l).then(f=>{typeof f=="string"?d[l]=f:f&&g.push(f)})))),o.addFonts(g),Object.assign(i,d)}n.next(),a.calculateLayout(t.width,t.height,r.DIRECTION_LTR);let u=n.next([0,0]).value;return a.freeRecursive(),tt({width:t.width,height:t.height,content:u})}export{It as default,Mt as init}; | ||
//# sourceMappingURL=index.wasm.js.map |
{ | ||
"name": "satori", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Satori converts HTML JSX to SVG string.", | ||
@@ -58,3 +58,6 @@ "module": "./dist/esm/index.js", | ||
"yoga-layout-prebuilt": "^1.10.0" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
} | ||
} |
184
README.md
@@ -100,50 +100,140 @@ <h1 align="center"> | ||
| Property | Supported Values | | ||
| --- | --- | | ||
| `display` | `none`, `flex` | | ||
| `position` | `relative`, `absolute` | | ||
| `margin`, `padding` | Supported | | ||
| `top`, `right`, `bottom`, `left` | Supported | | ||
| `width`, `height` | Supported | | ||
| `max-width`, `max-height` | Supported | | ||
| `min-width`, `min-height` | Supported | | ||
| `border` | Supported | | ||
| `flex-direction` | Supported | | ||
| `flex-wrap` | Supported | | ||
| `flex-grow` | Supported | | ||
| `flex-shrink` | Supported | | ||
| `flex-basis` | Supported except for `auto` | | ||
| `align-items` | Supported | | ||
| `align-content` | Supported | | ||
| `align-self` | Supported | | ||
| `justify-content` | Supported | | ||
| `font-family` | Supported | | ||
| `font-size` | Supported | | ||
| `font-weight` | Supported | | ||
| `font-style` | Supported | | ||
| `text-align` | Supported | | ||
| `letter-spacing` | Supported | | ||
| `box-shadow` | All supported except `spread-radius` and `inset` (works like `drop-shadow`) | | ||
| `border-radius` | Supported | | ||
| `overflow` | `visible`, `hidden` | | ||
| `color` | Supported | | ||
| `transform` | Support absolute values | | ||
| `transform-origin` | Support one-value and two-value syntax (both relative and absolute values) | | ||
| `object-fit` | `contain`, `cover`, `none` | | ||
| `opacity` | Supported | | ||
| `background-color` | Supported | | ||
| `background-image` | Support `linear-gradient`, `radial-gradient`, `url` | | ||
| `word-break` | Supported | | ||
| `text-shadow` | Supported | | ||
| `text-transform` | Support `lowercase`, `uppercase`, `capitalize` | | ||
| `background-position` | Supported | | ||
| `background-size` | Support two-value size string such as `10px 20%` | | ||
| `white-space` | Support `normal`, `pre`, `pre-wrap` and `nowrap` | | ||
| `text-overflow` | Support `clip` and `ellipsis` | | ||
| `text-decoration` | Support line types `underline` and `line-through`, and styles `dotted`, `dashed`, `solid` | | ||
| `line-height` | Supported | | ||
| `background-clip` | Support `border-box` and `text` | | ||
| `background-repeat` | Supported | | ||
| `filter` | Supported | | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Property</th> | ||
<th>Property Expanded</th> | ||
<th>Supported Values</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td colspan="2"><code>display</code></td> | ||
<td><code>none</code> and <code>flex</code>, default to <code>flex</code></td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>position</code></td> | ||
<td><code>relative</code> and <code>absolute</code>, default to <code>relative</code></td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>color</code></td> | ||
<td>Supported</td> | ||
</tr> | ||
<tr><td rowspan="5"><code>margin</code></td></tr> | ||
<tr><td><code>marginTop</code></td><td>Supported</td></tr> | ||
<tr><td><code>marginRight</code></td><td>Supported</td></tr> | ||
<tr><td><code>marginBottom</code></td><td>Supported</td></tr> | ||
<tr><td><code>marginLeft</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="5">Position</td></tr> | ||
<tr><td><code>top</code></td><td>Supported</td></tr> | ||
<tr><td><code>right</code></td><td>Supported</td></tr> | ||
<tr><td><code>bottom</code></td><td>Supported</td></tr> | ||
<tr><td><code>left</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="3">Size</td></tr> | ||
<tr><td><code>width</code></td><td>Supported</td></tr> | ||
<tr><td><code>height</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="5">Min & max size</td></tr> | ||
<tr><td><code>min-width</code></td><td>Supported</td></tr> | ||
<tr><td><code>min-height</code></td><td>Supported</td></tr> | ||
<tr><td><code>max-width</code></td><td>Supported</td></tr> | ||
<tr><td><code>max-height</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="5"><code>border</code></td></tr> | ||
<tr><td><code>borderWidth</code></td><td>Supported</td></tr> | ||
<tr><td><code>borderStyle</code></td><td><code>solid</code> and <code>dashed</code>, default to <code>solid</code></td></tr> | ||
<tr><td><code>borderColor</code></td><td>Supported</td></tr> | ||
<tr><td> | ||
Shorthand</td><td>Supported, i.e. <code>1px solid gray</code><br/> | ||
Note that it isn't supported to set border width/style/color for individual directions. | ||
</td></tr> | ||
<tr><td rowspan="6"><code>borderRadius</code></td></tr> | ||
<tr><td><code>borderTopLeftRadius</code></td><td>Supported</td></tr> | ||
<tr><td><code>borderTopRightRadius</code></td><td>Supported</td></tr> | ||
<tr><td><code>borderBottomLeftRadius</code></td><td>Supported</td></tr> | ||
<tr><td><code>borderBottomRightRadius</code></td><td>Supported</td></tr> | ||
<tr><td>Shorthand</td><td>Supported, i.e. <code>5px</code></td></tr> | ||
<tr><td rowspan="10">Flex</td></tr> | ||
<tr><td><code>flexDirection</code></td><td><code>column</code>, <code>row</code>, <code>row-reverse</code>, <code>column-reverse</code>, default to <code>row</code></td></tr> | ||
<tr><td><code>flexWrap</code></td><td><code>wrap</code>, <code>nowrap</code>, <code>wrap-reverse</code>, default to <code>wrap</code></td></tr> | ||
<tr><td><code>flexGrow</code></td><td>Supported</td></tr> | ||
<tr><td><code>flexShrink</code></td><td>Supported</td></tr> | ||
<tr><td><code>flexBasis</code></td><td>Supported except for <code>auto</code></td></tr> | ||
<tr><td><code>alignItems</code></td><td>Supported</td></tr> | ||
<tr><td><code>alignContent</code></td><td>Supported</td></tr> | ||
<tr><td><code>alignSelf</code></td><td>Supported</td></tr> | ||
<tr><td><code>justifyContent</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="5">Font</td></tr> | ||
<tr><td><code>fontFamily</code></td><td>Supported</td></tr> | ||
<tr><td><code>fontSize</code></td><td>Supported</td></tr> | ||
<tr><td><code>fontWeight</code></td><td>Supported</td></tr> | ||
<tr><td><code>fontStyle</code></td><td>Supported</td></tr> | ||
<tr><td rowspan="10">Text</td></tr> | ||
<tr><td><code>textAlign</code></td><td><code>start</code>, <code>end</code>, <code>left</code>, <code>right</code>, <code>center</code>, <code>justify</code>, default to <code>start</code></td></tr> | ||
<tr><td><code>textTransform</code></td><td><code>none</code>, <code>lowercase</code>, <code>uppercase</code>, <code>capitalize</code>, defaults to <code>none</code></td></tr> | ||
<tr><td><code>textOverflow</code></td><td><code>clip</code>, <code>ellipsis</code>, defaults to <code>clip</code></td></tr> | ||
<tr><td><code>textDecoration</code></td><td>Support line types <code>underline</code> and <code>line-through</code>, and styles <code>dotted</code>, <code>dashed</code>, <code>solid</code></td></tr> | ||
<tr><td><code>textShadow</code></td><td>Support single shadow</td></tr> | ||
<tr><td><code>lineHeight</code></td><td>Supported</td></tr> | ||
<tr><td><code>letterSpacing</code></td><td>Supported</td></tr> | ||
<tr><td><code>whiteSpace</code></td><td><code>normal</code>, <code>pre</code>, <code>pre-wrap</code>, <code>nowrap</code>, defaults to <code>normal</code></td></tr> | ||
<tr><td><code>wordBreak</code></td><td><code>normal</code>, <code>break-all</code>, <code>break-word</code>, <code>keep-all</code>, defaults to <code>normal</code></td></tr> | ||
<tr><td rowspan="7">Background</td></tr> | ||
<tr><td><code>backgroundColor</code></td><td>Supported, single value</td></tr> | ||
<tr><td><code>backgroundImage</code></td><td><code>linear-gradient</code>, <code>radial-gradient</code>, <code>url</code>, single value</td></tr> | ||
<tr><td><code>backgroundPosition</code></td><td>Support single value</td></tr> | ||
<tr><td><code>backgroundSize</code></td><td>Support two-value size i.e. `10px 20%`</td></tr> | ||
<tr><td><code>backgroundClip</code></td><td><code>border-box</code>, <code>text</code></td></tr> | ||
<tr><td><code>backgroundRepeat</code></td><td><code>repeat</code>, <code>repeat-x</code>, <code>repeat-y</code>, <code>no-repeat</code>, defaults to <code>repeat</code></td></tr> | ||
<tr><td rowspan="5"><code>transform</code></td></tr> | ||
<tr><td>Translate (<code>translate</code>, <code>translateX</code>, <code>translateY</code>)</td><td>Support absolute values only</td></tr> | ||
<tr><td>Rotate</td><td>Supported</td></tr> | ||
<tr><td>Scale (<code>scale</code>, <code>scaleX</code>, <code>scaleY</code>)</td><td>Supported</td></tr> | ||
<tr><td>Skew (<code>skew</code>, <code>skewX</code>, <code>skewY</code>)</td><td>Supported</td></tr> | ||
<tr> | ||
<td colspan="2"><code>transformOrigin</code></td> | ||
<td>Support one-value and two-value syntax (both relative and absolute values)</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>objectFit</code></td> | ||
<td><code>contain</code>, <code>cover</code>, <code>none</code>, default to <code>node</code></td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>opacity</code></td> | ||
<td>Supported</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>boxShadow</code></td> | ||
<td>Supported except spread radius and inset shadow.<br/>Note: this property works similar to <code>drop-shadow</code> in CSS.</td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>overflow</code></td> | ||
<td><code>visible</code> and <code>hidden</code>, default to <code>visible</code></td> | ||
</tr> | ||
<tr> | ||
<td colspan="2"><code>filter</code></td> | ||
<td>Supported</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
Note: | ||
@@ -150,0 +240,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
366005
304
373