Socket
Socket
Sign inDemoInstall

satori

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satori - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

8

dist/esm/index.js

@@ -1,5 +0,5 @@

var xt=Object.defineProperty,St=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var rt=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var nt=(t,r,e)=>r in t?xt(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))Et.call(r,e)&&nt(t,e,r[e]);if(rt)for(var e of rt(r))Rt.call(r,e)&&nt(t,e,r[e]);return t},te=(t,r)=>St(t,_t(r));import*as Tt from"yoga-layout-prebuilt";var it=Tt;var ve;ve=it.default;function wt(t){ve=t}function Q(){return ve}import{LineBreaker as It}from"css-line-break";import{splitGraphemes as Lt}from"text-segmentation";function ke(t){let r=typeof t;return!(r==="number"||r==="bigint"||r==="string"||r==="boolean")}function ot(t){return/^class\s/.test(Function.prototype.toString.call(t))}function fe(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}function H(t,r,e){let o=r[t];return typeof o=="undefined"?e:o}var at=void 0,Ae=typeof Intl!="undefined"&&"Segmenter"in Intl&&process.env.NODE_ENV!=="test",Ct=Ae?new Intl.Segmenter(at,{granularity:"word"}):null,vt=Ae?new Intl.Segmenter(at,{granularity:"grapheme"}):null,de=[32,160,4961,65792,65793,4153,4241,10].map(t=>String.fromCodePoint(t)),kt=t=>{let r=It(t,{lineBreak:"strict",wordBreak:"normal"}),e=[],o;for(;!(o=r.next()).done;)if(o.value){let a=o.value.slice(),i="";for(let n=0;n<a.length;n++){let s=a[n];de.includes(s)?(i.length&&e.push(i),e.push(s),i=""):i+=s}i.length&&e.push(i)}return e};function ce(t,r){return Ae?r==="word"?[...Ct.segment(t)].map(e=>e.segment):[...vt.segment(t)].map(e=>e.segment):r==="word"?kt(t):Lt(t)}function y(t,r,e){let o="";for(let[a,i]of Object.entries(r))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return e?`<${t}${o}>${e}</${t}>`:`<${t}${o}/>`}var st={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 At=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Pe(t){let r={};for(let e in t)At.has(e)&&(r[e]=t[e]);return r}import{getPropertyName as Ft,getStylesForProperty as $t}from"css-to-react-native";import ut from"parse-css-dimension";import{parseElementStyle as Nt}from"css-background-parser";import Pt from"postcss-value-parser";import Wt from"parse-css-dimension";function Ot(t,r){try{let e=new Wt(t);switch(e.unit){case"px":return{absolute:e.value};case"em":return{absolute:e.value*r};case"rem":return{absolute:e.value*16};case"%":return{relative:e.value};default:return{}}}catch{return{}}}function We(t,r,e){switch(t){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=Ot(t,r);return o.absolute?{[e?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[e?"xRelative":"yRelative"]:o.relative}:{}}}function Oe(t,r){if(typeof t=="number")return{xAbsolute:t};let e;try{e=Pt(t).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return e.length===1?We(e[0],r,!0):e.length===2?((e[0]==="top"||e[0]==="bottom"||e[1]==="left"||e[1]==="right")&&e.reverse(),D(D({},We(e[0],r,!0)),We(e[1],r,!1))):{}}var Mt=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),Gt=new Set(["lineHeight"]),ft=[1,0,0,1,0,0];function Dt(t,r,e,o){return t==="border"&&!e.includes(r.borderColor)?r.borderColor=o:t==="textDecoration"&&!e.includes(r.textDecorationColor)&&(r.textDecorationColor=o),r}function lt(t,r){return typeof r=="number"?Mt.has(t)?Gt.has(t)?r:String(r):r+"px":r}function Fe(t,r,e,{percentage:o}={percentage:!1}){if(typeof t=="number")return t;try{let a=new ut(t);if(a.type==="length")switch(a.unit){case"em":return a.value*r;case"rem":return a.value*16;case"vw":return~~(a.value*e._viewportWidth/100);case"vh":return~~(a.value*e._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*r}catch{}}function Ee(t,r){let e={};for(let a in t){if(a.startsWith("_")){e[a]=t[a];continue}let i=Ft(a);Object.assign(e,i==="lineHeight"?{lineHeight:lt(i,t[a])}:Dt(i,$t(i,lt(i,t[a]),!0),t[a],t.color||r.color))}if(e.backgroundImage){let{backgrounds:a}=Nt(e);e.backgroundImage=a}let o=e.fontSize||r.fontSize;if(typeof o=="string")try{let a=new ut(o);switch(a.unit){case"em":o=a.value*r.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof e.fontSize!="undefined"&&(e.fontSize=o),e.transformOrigin&&(e.transformOrigin=Oe(e.transformOrigin,o));for(let a in e){let i=e[a];if(a==="lineHeight")typeof i=="string"&&(i=e[a]=Fe(i,o,r,{percentage:!0})/o);else if(typeof i=="string"){let n=Fe(i,o,r);typeof n!="undefined"&&(e[a]=n),i=e[a]}if(a==="opacity"&&(i=e[a]=i*r.opacity),a==="transform"){let n=[...ft],s=i;for(let f of s){let p=Object.keys(f)[0],g=f[p],u=typeof g=="string"?Fe(g,o,r):g,m=[...ft];switch(p){case"translateX":m[4]=u;break;case"translateY":m[5]=u;break;case"scale":m[0]=u,m[3]=u;break;case"scaleX":m[0]=u;break;case"scaleY":m[3]=u;break;case"rotate":let h=u*Math.PI/180,d=Math.cos(h),c=Math.sin(h);m[0]=d,m[1]=c,m[2]=-c,m[3]=d;break;case"skewX":m[2]=Math.tan(u*Math.PI/180);break;case"skewY":m[1]=Math.tan(u*Math.PI/180);break}n=fe(m,n)}e.transform=n}}return e}function $e(t,r,e,o,a){let i=Q(),n=D(D(D({},e),Ee(st[r],e)),Ee(o,e));if(r==="img"){let s=parseInt(a.width),p=parseInt(a.height)/s;n.width||(n.width=s),n.height||(n.height=p*n.width)}return t.setDisplay(H(n.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),t.setAlignContent(H(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)),t.setAlignItems(H(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)),t.setAlignSelf(H(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)),t.setJustifyContent(H(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)),t.setFlexDirection(H(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)),t.setFlexWrap(H(n.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof n.flexBasis!="undefined"&&t.setFlexBasis(n.flexBasis),t.setFlexGrow(typeof n.flexGrow=="undefined"?0:n.flexGrow),t.setFlexShrink(typeof n.flexShrink=="undefined"?0:n.flexShrink),typeof n.maxHeight!="undefined"&&t.setMaxHeight(n.maxHeight),typeof n.maxWidth!="undefined"&&t.setMaxWidth(n.maxWidth),typeof n.minHeight!="undefined"&&t.setMinHeight(n.minHeight),typeof n.minWidth!="undefined"&&t.setMinWidth(n.minWidth),t.setOverflow(H(n.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),t.setMargin(i.EDGE_TOP,n.marginTop||0),t.setMargin(i.EDGE_BOTTOM,n.marginBottom||0),t.setMargin(i.EDGE_LEFT,n.marginLeft||0),t.setMargin(i.EDGE_RIGHT,n.marginRight||0),t.setBorder(i.EDGE_TOP,n.borderWidth||0),t.setBorder(i.EDGE_BOTTOM,n.borderWidth||0),t.setBorder(i.EDGE_LEFT,n.borderWidth||0),t.setBorder(i.EDGE_RIGHT,n.borderWidth||0),t.setPadding(i.EDGE_TOP,n.paddingTop||0),t.setPadding(i.EDGE_BOTTOM,n.paddingBottom||0),t.setPadding(i.EDGE_LEFT,n.paddingLeft||0),t.setPadding(i.EDGE_RIGHT,n.paddingRight||0),t.setPositionType(H(n.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&t.setPosition(i.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&t.setPosition(i.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&t.setPosition(i.EDGE_LEFT,n.left),typeof n.right!="undefined"&&t.setPosition(i.EDGE_RIGHT,n.right),typeof n.height!="undefined"?t.setHeight(n.height):t.setHeightAuto(),typeof n.width!="undefined"?t.setWidth(n.width):t.setWidthAuto(),[n,Pe(n)]}function re({left:t,top:r,width:e,height:o},a,i,n){var f,p,g,u;let s;if(i)s=a;else{let m=(p=n==null?void 0:n.xAbsolute)!=null?p:((f=n==null?void 0:n.xRelative)!=null?f:50)*e/100,h=(u=n==null?void 0:n.yAbsolute)!=null?u:((g=n==null?void 0:n.yRelative)!=null?g:50)*o/100,d=t+m,c=r+h;s=fe([1,0,0,1,d,c],fe(a,[1,0,0,1,-d,-c])),a.__parent&&(s=fe(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(m=>m.toFixed(2)).join(",")})`}function dt({left:t,top:r,width:e,height:o,isInheritingTransform:a},i){let n="",s=1;return i.transform&&(n=re({left:t,top:r,width:e,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:n,opacity:s}}function Ne({id:t,content:r,filter:e,left:o,top:a,width:i,height:n,matrix:s,opacity:f,image:p,clipPathId:g,debug:u,shape:m,decorationShape:h},d){let c="";if(u&&(c=y("rect",{x:o,y:a,width:i,height:.5,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),p){let x={href:p,x:o,y:a,width:i,height:n,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0};return[(e?`${e}<g filter="url(#satori_s-${t})">`:"")+y("image",te(D({},x),{opacity:f!==1?f:void 0}))+(h||"")+(e?"</g>":"")+c,""]}let R={x:o,y:a,width:i,height:n,"font-weight":d.fontWeight,"font-style":d.fontStyle,"font-size":d.fontSize,"font-family":d.fontFamily,"letter-spacing":d.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0};return[(e?`${e}<g filter="url(#satori_s-${t})">`:"")+y("text",te(D({},R),{fill:d.color,opacity:f!==1?f:void 0}),r)+(h||"")+(e?"</g>":"")+c,m?y("text",R,r):""]}function ne({id:t,width:r,height:e},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+r,r),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+e,e);return`<defs><filter id="satori_s-${t}" x="${i/r*100}%" y="${s/e*100}%" width="${(n-i)/r*100}%" height="${(f-s)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function Me({width:t,left:r,top:e,ascender:o,clipPathId:a},i){let{textDecorationColor:n,textDecorationStyle:s,textDecorationLine:f,fontSize:p}=i;if(!f||f==="none")return"";let g=Math.max(1,p*.1),u=f==="line-through"?e+o*.75:f==="underline"?e+o*1.25:e,m=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:r,y1:u,x2:r+t,y2:u,stroke:n,"stroke-width":g,"stroke-dasharray":m,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var Ge=void 0;function*De(t,r){var Qe;let e=Q(),{parentStyle:o,inheritedStyle:a,parent:i,font:n,id:s,isInheritingTransform:f,debug:p,embedFont:g,graphemeImages:u}=r;o.textTransform==="uppercase"?t=t.toLocaleUpperCase(Ge):o.textTransform==="lowercase"?t=t.toLocaleLowerCase(Ge):o.textTransform==="capitalize"&&(t=ce(t,"word").map(_=>ce(_,"grapheme").map((E,N)=>N===0?E.toLocaleUpperCase(Ge):E).join("")).join(""));let m=H(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),h=ce(t,m),d=e.Node.create();d.setAlignItems(e.ALIGN_BASELINE),o.textAlign==="left"?d.setJustifyContent(e.JUSTIFY_FLEX_START):o.textAlign==="center"?d.setJustifyContent(e.JUSTIFY_CENTER):o.textAlign==="right"?d.setJustifyContent(e.JUSTIFY_FLEX_END):o.textAlign==="justify"&&d.setJustifyContent(e.JUSTIFY_SPACE_BETWEEN),i.insertChild(d,i.getChildCount());let{textAlign:c,textOverflow:R,whiteSpace:x,lineHeight:Y,_inheritedBackgroundClipTextPath:L}=o,O=n.getFont(o),F=o.fontSize,P=O.ascender/O.unitsPerEm*F,v=-(O.descender/O.unitsPerEm)*F,C=P+v,M=Y/1.2*F-C,W=C*Y/1.2,j=(o.fontSize-C)/2,G=[],U=[],S=[],$=new Map,z=_=>{if($.has(_))return $.get(_);let E=n.measure(O,_,o);return $.set(_,E),E},l=0,b="",T=0;for(let _ of h){let E=!1,N=u&&u[_];x==="pre"?E=_[0]===`
`:x!=="nowrap"&&(N||de.includes(_[0]))&&(E=!0),E?(x==="nowrap"?T+=z(b)+o.fontSize:(l=Math.max(l,z(b)),N&&(l=Math.max(l,o.fontSize))),b=""):(!de.includes(_[0])||!b)&&(b+=_===`
`?" ":_)}l=Math.max(l,z(b)+T);let X=i.getMinWidth(),ie=i.getMaxWidth(),gt=i.getWidth();isNaN(gt.value)&&(isNaN(X.value)||X.unit===1&&X.value>l)&&(isNaN(ie.value)||ie.unit===1&&(l=Math.min(l,ie.value)),i.setMinWidth(l)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let je=["pre-wrap","pre"].includes(x);d.setMeasureFunc(_=>{let E=0,N="",V=0,B=0,K=0,q=-1;G=[],U=[0];for(let Z=0;Z<h.length;Z++){let k=h[Z];if(!je&&de.includes(k[0]))N||(N=" "),V=z(N),S[Z]=null;else{let ae=je&&k===`
`,A=ae?0:u&&u[k]?o.fontSize:z(k);B||(N="",V=0);let J=V||",.!?:-@)>]}%#".indexOf(k[0])<0,se=!B||!!V;ae||Z&&J&&B+V+A>_&&x!=="nowrap"&&x!=="pre"?(G.push(B),E++,B=A,U.push(1),q=-1,ae||(K=Math.max(K,_))):(B+=V+A,se&&U[U.length-1]++),N="",V=0,se&&q++,K=Math.max(K,B),S[Z]={y:E*W-j,x:B-A,width:A,line:E,lineIndex:q}}}return B&&(E++,G.push(B)),{width:K,height:E*W}});let[ht,bt]=yield,we="",ge="",oe=a._inheritedClipPathId,{left:Ke,top:qe,width:le,height:Ie}=d.getComputedLayout(),Le=i.getComputedWidth()-i.getComputedPadding(e.EDGE_LEFT)-i.getComputedPadding(e.EDGE_RIGHT)-i.getComputedBorder(e.EDGE_LEFT)-i.getComputedBorder(e.EDGE_RIGHT),he=ht+Ke,be=bt+qe,{matrix:ee,opacity:ye}=dt({left:Ke,top:qe,width:le,height:Ie,isInheritingTransform:f},o),ue="";o.textShadowOffset&&(ue=ne({width:le,height:Ie,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let xe="",Se="",Ce=-1,Ze=R==="ellipsis"?z("\u2026"):0,yt=R==="ellipsis"?z(" "):0,_e={};for(let _=0;_<h.length;_++){if(!S[_])continue;let E=S[_],N=h[_],V=null,B=u?u[N]:null,K=E.y,q=E.x,Z=E.width,k=E.line;if(k===Ce)continue;let ae=!1;if(G.length>1){let A=le-G[k];if(c==="right"||c==="end")q+=A;else if(c==="center")q+=A/2;else if(c==="justify"&&k<G.length-1){let J=U[k];q+=(J>1?A/(J-1):0)*E.lineIndex,ae=!0}}if(_e[k]||(_e[k]=[q,ae?le:G[k]]),R==="ellipsis"&&G[k]>Le&&E.x+Z+Ze+yt>Le){let A=ce(N,"grapheme"),J="",se=0;for(let et of A){let tt=E.x+z(J+et);if(J&&tt+Ze>Le)break;J+=et,se=tt}N=J+"\u2026",Ce=k,_e[k][1]=se}if(B?K+=j:g?V=n.getSVG(O,N,te(D({},o),{left:he+q,top:be+K+P+M/2,letterSpacing:o.letterSpacing})):K+=P+M/2,o.textDecorationLine&&(k!==((Qe=S[_+1])==null?void 0:Qe.line)||Ce===k)){let A=_e[k];A&&!A[2]&&(xe+=Me({left:he+A[0],top:be+W*+k,width:A[1],ascender:P+M/2,clipPathId:oe},o),A[2]=1)}if(V)Se+=V+" ";else{let[A,J]=Ne({content:N,filter:ue,id:s,left:he+q,top:be+K,width:Z,height:W,matrix:ee,opacity:ye,image:B,clipPathId:oe,debug:p,shape:!!L,decorationShape:xe},o);we+=A,ge+=J,xe=""}}if(Se){let _="";p&&(_=y("rect",{x:he,y:be,width:le,height:Ie,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":oe?`url(#${oe})`:void 0}));let E=o.color!=="transparent"&&ye!==0?y("path",{fill:o.color,d:Se,transform:ee||void 0,opacity:ye!==1?ye:void 0,"clip-path":oe?`url(#${oe})`:void 0}):"";L&&(ge=y("path",{d:Se,transform:ee||void 0})),we+=(ue?`${ue}<g filter="url(#satori_s-${s})">`:"")+E+xe+(ue?"</g>":"")+_}return ge&&(o._inheritedBackgroundClipTextPath.value+=ge),we}import Bt from"parse-css-dimension";var Be=Be||{};Be.parse=function(){var t={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]+\.?))/},r="";function e(l){var b=new Error(r+": "+l);throw b.source=r,b}function o(){var l=a();return r.length>0&&e("Invalid input not EOF"),l}function a(){return L(i)}function i(){return n("linear-gradient",t.linearGradient,f)||n("repeating-linear-gradient",t.repeatingLinearGradient,f)||n("radial-gradient",t.radialGradient,u)||n("repeating-radial-gradient",t.repeatingRadialGradient,u)}function n(l,b,T){return s(b,function(X){var ie=T();return ie&&($(t.comma)||e("Missing comma before color stops")),{type:l,orientation:ie,colorStops:L(O)}})}function s(l,b){var T=$(l);if(T){$(t.startCall)||e("Missing (");var X=b(T);return $(t.endCall)||e("Missing )"),X}}function f(){return p()||g()}function p(){return S("directional",t.sideOrCorner,1)}function g(){return S("angular",t.angleValue,1)}function u(){var l,b=m(),T;return b&&(l=[],l.push(b),T=r,$(t.comma)&&(b=m(),b?l.push(b):r=T)),l}function m(){var l=h()||d();if(l)l.at=R();else{var b=c();if(b){l=b;var T=R();T&&(l.at=T)}else{var X=x();X&&(l={type:"default-radial",at:X})}}return l}function h(){var l=S("shape",/^(circle)/i,0);return l&&(l.style=U()||c()),l}function d(){var l=S("shape",/^(ellipse)/i,0);return l&&(l.style=j()||c()),l}function c(){return S("extent-keyword",t.extentKeywords,1)}function R(){if(S("position",/^at/,0)){var l=x();return l||e("Missing positioning value"),l}}function x(){var l=Y();if(l.x||l.y)return{type:"position",value:l}}function Y(){return{x:j(),y:j()}}function L(l){var b=l(),T=[];if(b)for(T.push(b);$(t.comma);)b=l(),b?T.push(b):e("One extra comma");return T}function O(){var l=F();return l||e("Expected color definition"),l.length=j(),l}function F(){return v()||M()||C()||P()}function P(){return S("literal",t.literalColor,0)}function v(){return S("hex",t.hexColor,1)}function C(){return s(t.rgbColor,function(){return{type:"rgb",value:L(W)}})}function M(){return s(t.rgbaColor,function(){return{type:"rgba",value:L(W)}})}function W(){return $(t.number)[1]}function j(){return S("%",t.percentageValue,1)||G()||U()}function G(){return S("position-keyword",t.positionKeywords,1)}function U(){return S("px",t.pixelValue,1)||S("em",t.emValue,1)}function S(l,b,T){var X=$(b);if(X)return{type:l,value:X[T]}}function $(l){var b,T;return T=/^[\n\r\t\s]+/.exec(r),T&&z(T[0].length),b=l.exec(r),b&&z(b[0].length),b}function z(l){r=r.substr(l)}return function(l){return r=l.toString(),o()}}();var Ye=Be;function Yt(t){return t.type==="literal"?t.value:t.type==="hex"?`#${t.value}`:t.type==="rgb"?`rgb(${t.value.join(",")})`:t.type==="rgba"?`rgba(${t.value.join(",")})`:"transparent"}function Xt(t,r){return typeof t=="string"&&t.endsWith("%")?r*parseFloat(t)/100:+t}function ct(t,{x:r,y:e,defaultX:o,defaultY:a}){return(t?t.split(" ").map(i=>{try{let n=new Bt(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)=>Xt(i,[r,e][n]))}function mt(t,r){let e=[];for(let n of r){let s=Yt(n);if(!e.length&&(e.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/t;e.push({offset:f,color:s})}e.length||e.push({offset:0,color:"transparent"});let o=e[e.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:e.push({offset:1,color:o.color}));let a=0,i=1;for(let n=0;n<e.length;n++)if(typeof e[n].offset=="undefined"){for(i<n&&(i=n);typeof e[i].offset=="undefined";)i++;e[n].offset=(e[i].offset-e[a].offset)/(i-a)*(n-a)+e[a].offset}else a=n;return e}function Xe({id:t,width:r,height:e},{image:o,size:a,position:i,repeat:n}){let s=n==="repeat-x"||n==="repeat",f=n==="repeat-y"||n==="repeat",p=ct(a,{x:r,y:e,defaultX:r,defaultY:e}),g=ct(i,{x:r,y:e,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let u=Ye.parse(o)[0],m,h,d,c;if(u.orientation.type==="directional")[m,h,d,c]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[u.orientation.value];else if(u.orientation.type==="angular"){let x=+u.orientation.value/180*Math.PI-Math.PI/2,Y=Math.cos(x),L=Math.sin(x);m=0,h=0,d=Y,c=L,d<0&&(m-=d,d=0),c<0&&(h-=c,c=0)}let R=mt(r,u.colorStops);return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${m}" y1="${h}" x2="${d}" y2="${c}">${R.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let u=Ye.parse(o)[0],m=u.orientation[0],[h,d]=p,c="circle",R=h/2,x=d/2;if(m.type==="shape"){if(c=m.value,m.at)if(m.at.type==="position")R=m.at.value.x.value,x=m.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+m.at.type)}else throw new Error("orientation.type not implemented: "+m.type);let Y=mt(r,u.colorStops),L=`satori_radial_${t}`,O=`satori_pattern_${t}`,F={},P=Math.max(Math.abs(h-R),Math.abs(R)),v=Math.max(Math.abs(d-x),Math.abs(x));if(c==="circle")F.r=Math.sqrt(P*P+v*v);else if(c==="ellipse"){let W=v!==0?P/v:1;F.ry=Math.sqrt(P*P+v*v*W*W)/W,F.rx=F.ry*W}let C=y("pattern",{id:O,x:g[0],y:g[1],width:s?h:"100%",height:f?d:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:L},Y.map(W=>y("stop",{offset:W.offset,"stop-color":W.color})).join(""))+y(c,te(D({cx:R,cy:x,width:h,height:d},F),{fill:`url(#${L})`})));return[O,C]}if(o.startsWith("url(")){let u=o.slice(4,-1);return[`satori_bi${t}`,y("pattern",{id:`satori_bi${t}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?p[0]:"100%",height:f?p[1]:"100%"},y("image",{x:0,y:0,width:p[0],height:p[1],href:u}))]}}function Re(t,r,e){return e<t+r&&(e/2<t&&e/2<r?t=r=e/2:e/2<t?t=e-r:e/2<r&&(r=e-t)),[t,r]}function me({left:t,top:r,width:e,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:n,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return i=Math.min(i||0,e,o),n=Math.min(n||0,e,o),s=Math.min(s||0,e,o),f=Math.min(f||0,e,o),!i&&!n&&!s&&!f?"":([i,n]=Re(i,n,e),[i,s]=Re(i,s,o),[n,f]=Re(n,f,o),[s,f]=Re(s,f,e),`M${t+i},${r} h${e-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-e} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function He({left:t,top:r,width:e,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:t,y:r,width:e,height:o,d:a})):y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("rect",{x:t,y:r,width:e,height:o}))}function Ue({id:t,left:r,top:e,width:o,height:a,isInheritingTransform:i,debug:n},s){if(s.display==="none")return"";let f="rect",p="transparent",g=0,u="",m="",h=[],d=1,c="";s.backgroundColor&&h.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,p=s.borderColor),s.opacity&&(d=+s.opacity),s.transform&&(u=re({left:r,top:e,width:o,height:a},s.transform,i,s.transformOrigin));let R="";if(s.backgroundImage){let v=s.backgroundImage.map((C,M)=>Xe({id:t+"_"+M,width:o,height:a},C)).filter(Boolean);for(let C of v)h.push(`url(#${C[0]})`),m+=C[1],C[2]&&(R+=C[2])}let x=me({left:r,top:e,width:o,height:a},s);x&&(f="path");let Y=He({left:r,top:e,width:o,height:a,path:x,id:t},s),L=s._inheritedClipPathId,O=ne({width:o,height:a,id:t},s);n&&(c=y("rect",{x:r,y:e,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:u||void 0,"clip-path":L?`url(#${L})`:void 0})),h.length||h.push("transparent");let{backgroundClip:F}=s,P=h.map((v,C)=>{if(v==="transparent"&&!(C===h.length-1&&g))return"";let M=C===h.length-1&&g&&F!=="text";return y(f,{x:r,y:e,width:o,height:a,fill:v,stroke:M?p:void 0,"stroke-width":M?g:void 0,d:x||void 0,transform:u||void 0,"clip-path":F==="text"?`url(#satori_bct-${t})`:L?`url(#${L})`:void 0})}).join("");return F==="text"&&g&&(P=y(f,{x:r,y:e,width:o,height:a,fill:"transparent",stroke:p,"stroke-width":g,d:x||void 0,transform:u||void 0,"clip-path":L?`url(#${L})`:void 0})+P),(m?`<defs>${m}</defs>`:"")+Y+(O?`${O}<g filter="url(#satori_s-${t})">`:"")+(d!==1?`<g opacity="${d}">`:"")+(R||P)+(d!==1?"</g>":"")+(O?"</g>":"")+c}function ze({id:t,left:r,top:e,width:o,height:a,src:i,debug:n,isInheritingTransform:s},f){if(f.display==="none")return"";let p="",g=1,u="",m=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=me({left:r,top:e,width:o,height:a},f),d=f._inheritedClipPathId;h&&(p=y("clipPath",{id:`satori_c-${t}`,"clip-path":d?`url(#${d})`:void 0},y("path",{x:r,y:e,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let c=ne({width:o,height:a,id:t},f);return f.transform&&(u=re({left:r,top:e,width:o,height:a},f.transform,s,f.transformOrigin)),c+(c?`<g filter="url(#satori_s-${t})">`:"")+p+y("image",{x:r,y:e,width:o,height:a,href:i,preserveAspectRatio:m,transform:u||void 0,"clip-path":p?`url(#satori_c-${t})`:d?`url(#${d})`:void 0})+(c?"</g>":"")}function*pe(t,r){let e=Q(),{id:o,inheritedStyle:a,parent:i,font:n,debug:s,embedFont:f=!0,graphemeImages:p}=r;if(t===null||typeof t=="undefined")return yield,"";if(!ke(t)||typeof t.type=="function"){let S;if(!ke(t))S=De(String(t),r);else{if(ot(t.type))throw new Error("Class component is not supported.");S=pe(t.type(t.props),r)}S.next();let $=yield;return S.next($).value}let{type:g,props:u}=t,{style:m,children:h}=u,d=e.Node.create();i.insertChild(d,i.getChildCount());let[c,R]=$e(d,g,a,m,u),x=c.transform===a.transform;if(x||(c.transform.__parent=a.transform),c.overflow==="hidden"&&(R._inheritedClipPathId=`satori_cp-${o}`),c.backgroundClip==="text"){let S={value:""};R._inheritedBackgroundClipTextPath=S,c._inheritedBackgroundClipTextPath=S}let Y=typeof h=="undefined"?[]:[].concat(h),L=[],O=0;for(let S of Y){let $=pe(S,{id:o+"-"+O++,parentStyle:c,inheritedStyle:R,isInheritingTransform:!0,parent:d,font:n,embedFont:f,debug:s,graphemeImages:p});$.next(),L.push($)}let[F,P]=yield;c.position==="absolute"&&d.calculateLayout();let{left:v,top:C,width:M,height:W}=d.getComputedLayout();v+=F,C+=P;let j="",G="",U="";g==="img"?G=ze({id:o,left:v,top:C,width:M,height:W,src:u.src,isInheritingTransform:x,debug:s},c):G=Ue({id:o,left:v,top:C,width:M,height:W,isInheritingTransform:x,debug:s},c);for(let S of L)j+=S.next([v,C]).value;return c._inheritedBackgroundClipTextPath&&(U+=y("clipPath",{id:`satori_bct-${o}`,"clip-path":c._inheritedClipPathId?`url(#${c._inheritedClipPathId})`:void 0},c._inheritedBackgroundClipTextPath.value)),U+G+j}import Ht from"@shuding/opentype.js";var Te=class{constructor(r){this.fonts=new Map;for(let e of r){let o=e.data,a=Ht.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0});this.defaultFont||(this.defaultFont=a),this.fonts.has(e.name)||this.fonts.set(e.name,[]),this.fonts.get(e.name).push([a,e.weight,e.style])}}get({name:r,weight:e,style:o}){if(!this.fonts.has(r))return this.defaultFont;e==="normal"&&(e=400),e==="bold"&&(e=700);let a=[...this.fonts.get(r)];return a.sort(([i,n,s],[f,p,g])=>{if(n!==p)return n?!p||n===e?-1:p===e?1:e===400&&n===500||e===500&&n===400?-1:e===400&&p===500||e===500&&p===400?1:e<400?n<e&&p<e?p-n:n<e?-1:p<e?1:n-p:e<n&&e<p?n-p:e<n?-1:e<p?1:p-n:1;if(s!==g){if(s===o)return-1;if(g===o)return 1}return-1}),a[0][0]}getFont({fontFamily:r,fontWeight:e=400,fontStyle:o="normal"}){return this.get({name:r,weight:e,style:o})}measure(r,e,{fontSize:o,letterSpacing:a=0}){return r.getAdvanceWidth(e,o,{letterSpacing:a/o})}getSVG(r,e,{fontSize:o,top:a,left:i,letterSpacing:n=0}){return r.getPath(e,i,a,o,{letterSpacing:n/o}).toPathData(1)}};function Ve({width:t,height:r,content:e}){return y("svg",{width:t,height:r,viewBox:`0 0 ${t} ${r}`,xmlns:"http://www.w3.org/2000/svg"},e)}var Je=new WeakMap;function pt(t,r){let e=Q();if(!e)throw new Error("Satori is not initialized.");let o;Je.has(r.fonts)?o=Je.get(r.fonts):Je.set(r.fonts,o=new Te(r.fonts));let a=e.Node.create();a.setWidth(r.width),a.setHeight(r.height),a.setFlexDirection(e.FLEX_DIRECTION_ROW),a.setFlexWrap(e.WRAP_WRAP),a.setAlignContent(e.ALIGN_AUTO),a.setAlignItems(e.ALIGN_FLEX_START),a.setJustifyContent(e.JUSTIFY_FLEX_START),a.setOverflow(e.OVERFLOW_HIDDEN);let i=pe(t,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:r.width,_viewportHeight:r.height},parent:a,font:o,embedFont:r.embedFont,debug:r.debug,graphemeImages:r.graphemeImages});i.next(),a.calculateLayout(r.width,r.height,e.DIRECTION_LTR);let n=i.next([0,0]).value;return a.freeRecursive(),Ve({width:r.width,height:r.height,content:n})}export{pt as default,wt as init};
var At=Object.defineProperty,kt=Object.defineProperties;var Ot=Object.getOwnPropertyDescriptors;var dt=Object.getOwnPropertySymbols;var $t=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable;var ct=(e,r,t)=>r in e?At(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,G=(e,r)=>{for(var t in r||(r={}))$t.call(r,t)&&ct(e,t,r[t]);if(dt)for(var t of dt(r))Ft.call(r,t)&&ct(e,t,r[t]);return e},se=(e,r)=>kt(e,Ot(r));import{guessLanguage as pr}from"guesslanguage";import*as Pt from"yoga-layout-prebuilt";var pt=Pt;var Pe;Pe=pt.default;function Wt(e){Pe=e}function te(){return Pe}import{LineBreaker as Nt}from"css-line-break";import{splitGraphemes as Mt}from"text-segmentation";function We(e){let r=typeof e;return!(r==="number"||r==="bigint"||r==="string"||r==="boolean")}function mt(e){return/^class\s/.test(Function.prototype.toString.call(e))}function ge(e,r){return[e[0]*r[0]+e[2]*r[1],e[1]*r[0]+e[3]*r[1],e[0]*r[2]+e[2]*r[3],e[1]*r[2]+e[3]*r[3],e[0]*r[4]+e[2]*r[5]+e[4],e[1]*r[4]+e[3]*r[5]+e[5]]}function q(e,r,t){let i=r[e];return typeof i=="undefined"?t:i}var gt=void 0,Ne=typeof Intl!="undefined"&&"Segmenter"in Intl&&process.env.NODE_ENV!=="test",Gt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Dt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,ye=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e)),Bt=e=>{let r=Nt(e,{lineBreak:"strict",wordBreak:"normal"}),t=[],i;for(;!(i=r.next()).done;)if(i.value){let a=i.value.slice(),n="";for(let o=0;o<a.length;o++){let s=a[o];ye.includes(s)?(n.length&&t.push(n),t.push(s),n=""):n+=s}n.length&&t.push(n)}return t};function le(e,r){return Ne?r==="word"?[...Gt.segment(e)].map(t=>t.segment):[...Dt.segment(e)].map(t=>t.segment):r==="word"?Bt(e):Mt(e)}function y(e,r,t){let i="";for(let[a,n]of Object.entries(r))typeof n!="undefined"&&(i+=` ${a}="${n}"`);return t?`<${e}${i}>${t}</${e}>`:`<${e}${i}/>`}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 Yt=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 r={};for(let t in e)Yt.has(t)&&(r[t]=e[t]);return r}import{getPropertyName as rr,getStylesForProperty as nr}from"css-to-react-native";import{parseElementStyle as ir}from"css-background-parser";var xe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Ht=xe((e,r)=>{r.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Xt=xe((e,r)=>{r.exports=["deg","grad","rad","turn"]}),Ut=xe((e,r)=>{r.exports=["dpi","dpcm","dppx"]}),zt=xe((e,r)=>{r.exports=["Hz","kHz"]}),Vt=xe((e,r)=>{r.exports=["s","ms"]}),jt=Ht(),bt=Xt(),yt=Ut(),xt=zt(),Et=Vt();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 r=Kt(e);if(!r){this.type="number",this.value=Ge(e);return}this.type=Qt(r),this.value=Ge(e.substr(0,e.length-r.length)),this.unit=r}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 r=e.match(/\./g);return r?r.length:0}function Ge(e){var r=parseFloat(e);if(isNaN(r))throw new Error("Invalid number: "+e);return r}var qt=[].concat(bt,xt,jt,yt,Et);function Kt(e){var r=e.match(/\D+$/),t=r&&r[0];if(t&&qt.indexOf(t)===-1)throw new Error("Invalid unit: "+t);return t}var Zt=Object.assign(Ce(bt,"angle"),Ce(xt,"frequency"),Ce(yt,"resolution"),Ce(Et,"time"));function Ce(e,r){return Object.fromEntries(e.map(t=>[t,r]))}function Qt(e){return Zt[e]||"length"}import er from"postcss-value-parser";function tr(e,r){try{let t=new fe(e);switch(t.unit){case"px":return{absolute:t.value};case"em":return{absolute:t.value*r};case"rem":return{absolute:t.value*16};case"%":return{relative:t.value};default:return{}}}catch{return{}}}function Be(e,r,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 i=tr(e,r);return i.absolute?{[t?"xAbsolute":"yAbsolute"]:i.absolute}:i.relative?{[t?"xRelative":"yRelative"]:i.relative}:{}}}function Ye(e,r){if(typeof e=="number")return{xAbsolute:e};let t;try{t=er(e).nodes.filter(i=>i.type==="word").map(i=>i.value)}catch{return{}}return t.length===1?Be(t[0],r,!0):t.length===2?((t[0]==="top"||t[0]==="bottom"||t[1]==="left"||t[1]==="right")&&t.reverse(),G(G({},Be(t[0],r,!0)),Be(t[1],r,!1))):{}}var or=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ar=new Set(["lineHeight"]),St=[1,0,0,1,0,0];function sr(e,r,t,i){return e==="border"&&!t.includes(r.borderColor)?r.borderColor=i:e==="textDecoration"&&!t.includes(r.textDecorationColor)&&(r.textDecorationColor=i),r}function _t(e,r){return typeof r=="number"?or.has(e)?ar.has(e)?r:String(r):r+"px":r}function lr(e,r){return e==="lineHeight"?{lineHeight:_t(e,r)}:e==="fontFamily"?{fontFamily:r.split(",").map(t=>t.trim().replace(/(^['"])|(['"]$)/g,"").toLocaleLowerCase())}:null}function He(e,r,t,{percentage:i}={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*r;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"&&i)return a.value/100*r}catch{}}function Ie(e,r){let t={};for(let a in e){if(a.startsWith("_")){t[a]=e[a];continue}let n=rr(a);Object.assign(t,lr(n,e[a])||sr(n,nr(n,_t(n,e[a]),!0),e[a],e.color||r.color))}if(t.backgroundImage){let{backgrounds:a}=ir(t);t.backgroundImage=a}let i=t.fontSize||r.fontSize;if(typeof i=="string")try{let a=new fe(i);switch(a.unit){case"em":i=a.value*r.fontSize;break;case"rem":i=a.value*16;break}}catch{i=16}typeof t.fontSize!="undefined"&&(t.fontSize=i),t.transformOrigin&&(t.transformOrigin=Ye(t.transformOrigin,i));for(let a in t){let n=t[a];if(a==="lineHeight")typeof n=="string"&&(n=t[a]=He(n,i,r,{percentage:!0})/i);else if(typeof n=="string"){let o=He(n,i,r);typeof o!="undefined"&&(t[a]=o),n=t[a]}if(a==="opacity"&&(n=t[a]=n*r.opacity),a==="transform"){let o=[...St],s=n;for(let f of s){let h=Object.keys(f)[0],g=f[h],p=typeof g=="string"?He(g,i,r):g,l=[...St];switch(h){case"translateX":l[4]=p;break;case"translateY":l[5]=p;break;case"scale":l[0]=p,l[3]=p;break;case"scaleX":l[0]=p;break;case"scaleY":l[3]=p;break;case"rotate":let c=p*Math.PI/180,u=Math.cos(c),d=Math.sin(c);l[0]=u,l[1]=d,l[2]=-d,l[3]=u;break;case"skewX":l[2]=Math.tan(p*Math.PI/180);break;case"skewY":l[1]=Math.tan(p*Math.PI/180);break}o=ge(l,o)}t.transform=o}}return t}function Xe(e,r,t,i,a){let n=te(),o=G(G(G({},t),Ie(ht[r],t)),Ie(i,t));if(r==="img"){let s=parseInt(a.width),h=parseInt(a.height)/s;o.width||(o.width=s),o.height||(o.height=h*o.width)}return e.setDisplay(q(o.display,{flex:n.DISPLAY_FLEX,none:n.DISPLAY_NONE},n.DISPLAY_FLEX)),e.setAlignContent(q(o.alignContent,{stretch:n.ALIGN_STRETCH,center:n.ALIGN_CENTER,"flex-start":n.ALIGN_FLEX_START,"flex-end":n.ALIGN_FLEX_END,"space-between":n.ALIGN_SPACE_BETWEEN,"space-around":n.ALIGN_SPACE_AROUND,baseline:n.ALIGN_BASELINE,normal:n.ALIGN_AUTO},n.ALIGN_AUTO)),e.setAlignItems(q(o.alignItems,{stretch:n.ALIGN_STRETCH,center:n.ALIGN_CENTER,"flex-start":n.ALIGN_FLEX_START,"flex-end":n.ALIGN_FLEX_END,baseline:n.ALIGN_BASELINE,normal:n.ALIGN_AUTO},n.ALIGN_FLEX_START)),e.setAlignSelf(q(o.alignSelf,{stretch:n.ALIGN_STRETCH,center:n.ALIGN_CENTER,"flex-start":n.ALIGN_FLEX_START,"flex-end":n.ALIGN_FLEX_END,baseline:n.ALIGN_BASELINE,normal:n.ALIGN_AUTO},n.ALIGN_AUTO)),e.setJustifyContent(q(o.justifyContent,{center:n.JUSTIFY_CENTER,"flex-start":n.JUSTIFY_FLEX_START,"flex-end":n.JUSTIFY_FLEX_END,"space-between":n.JUSTIFY_SPACE_BETWEEN,"space-around":n.JUSTIFY_SPACE_AROUND},n.JUSTIFY_FLEX_START)),e.setFlexDirection(q(o.flexDirection,{row:n.FLEX_DIRECTION_ROW,column:n.FLEX_DIRECTION_COLUMN,"row-reverse":n.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":n.FLEX_DIRECTION_COLUMN_REVERSE},n.FLEX_DIRECTION_ROW)),e.setFlexWrap(q(o.flexWrap,{wrap:n.WRAP_WRAP,nowrap:n.WRAP_NO_WRAP,"wrap-reverse":n.WRAP_WRAP_REVERSE},n.WRAP_WRAP)),typeof o.flexBasis!="undefined"&&e.setFlexBasis(o.flexBasis),e.setFlexGrow(typeof o.flexGrow=="undefined"?0:o.flexGrow),e.setFlexShrink(typeof o.flexShrink=="undefined"?0:o.flexShrink),typeof o.maxHeight!="undefined"&&e.setMaxHeight(o.maxHeight),typeof o.maxWidth!="undefined"&&e.setMaxWidth(o.maxWidth),typeof o.minHeight!="undefined"&&e.setMinHeight(o.minHeight),typeof o.minWidth!="undefined"&&e.setMinWidth(o.minWidth),e.setOverflow(q(o.overflow,{visible:n.OVERFLOW_VISIBLE,hidden:n.OVERFLOW_HIDDEN},n.OVERFLOW_VISIBLE)),e.setMargin(n.EDGE_TOP,o.marginTop||0),e.setMargin(n.EDGE_BOTTOM,o.marginBottom||0),e.setMargin(n.EDGE_LEFT,o.marginLeft||0),e.setMargin(n.EDGE_RIGHT,o.marginRight||0),e.setBorder(n.EDGE_TOP,o.borderWidth||0),e.setBorder(n.EDGE_BOTTOM,o.borderWidth||0),e.setBorder(n.EDGE_LEFT,o.borderWidth||0),e.setBorder(n.EDGE_RIGHT,o.borderWidth||0),e.setPadding(n.EDGE_TOP,o.paddingTop||0),e.setPadding(n.EDGE_BOTTOM,o.paddingBottom||0),e.setPadding(n.EDGE_LEFT,o.paddingLeft||0),e.setPadding(n.EDGE_RIGHT,o.paddingRight||0),e.setPositionType(q(o.position,{absolute:n.POSITION_TYPE_ABSOLUTE,relative:n.POSITION_TYPE_RELATIVE},n.POSITION_TYPE_RELATIVE)),typeof o.top!="undefined"&&e.setPosition(n.EDGE_TOP,o.top),typeof o.bottom!="undefined"&&e.setPosition(n.EDGE_BOTTOM,o.bottom),typeof o.left!="undefined"&&e.setPosition(n.EDGE_LEFT,o.left),typeof o.right!="undefined"&&e.setPosition(n.EDGE_RIGHT,o.right),typeof o.height!="undefined"?e.setHeight(o.height):e.setHeightAuto(),typeof o.width!="undefined"?e.setWidth(o.width):e.setWidthAuto(),[o,Me(o)]}function ue({left:e,top:r,width:t,height:i},a,n,o){var f,h,g,p;let s;if(n)s=a;else{let l=(h=o==null?void 0:o.xAbsolute)!=null?h:((f=o==null?void 0:o.xRelative)!=null?f:50)*t/100,c=(p=o==null?void 0:o.yAbsolute)!=null?p:((g=o==null?void 0:o.yRelative)!=null?g:50)*i/100,u=e+l,d=r+c;s=ge([1,0,0,1,u,d],ge(a,[1,0,0,1,-u,-d])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(l=>l.toFixed(2)).join(",")})`}function wt({left:e,top:r,width:t,height:i,isInheritingTransform:a},n){let o="",s=1;return n.transform&&(o=ue({left:e,top:r,width:t,height:i},n.transform,a,n.transformOrigin)),n.opacity&&(s=+n.opacity),{matrix:o,opacity:s}}function Ue({id:e,content:r,filter:t,left:i,top:a,width:n,height:o,matrix:s,opacity:f,image:h,clipPathId:g,debug:p,shape:l,decorationShape:c},u){let d="";if(p&&(d=y("rect",{x:i,y:a-o,width:n,height:o,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),h){let x={href:h,x:i,y:a,width:n,height:o,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:u.filter?`filter:${u.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+y("image",se(G({},x),{opacity:f!==1?f:void 0}))+(c||"")+(t?"</g>":"")+d,""]}let b={x:i,y:a,width:n,height:o,"font-weight":u.fontWeight,"font-style":u.fontStyle,"font-size":u.fontSize,"font-family":u.fontFamily,"letter-spacing":u.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:u.filter?`filter:${u.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+y("text",se(G({},b),{fill:u.color,opacity:f!==1?f:void 0}),r)+(c||"")+(t?"</g>":"")+d,l?y("text",b,r):""]}function de({id:e,width:r,height:t},i){if(!i.shadowColor||!i.shadowOffset||typeof i.shadowRadius=="undefined")return"";let a=i.shadowRadius*i.shadowRadius/4,n=Math.min(i.shadowOffset.width-a,0),o=Math.max(i.shadowOffset.width+a+r,r),s=Math.min(i.shadowOffset.height-a,0),f=Math.max(i.shadowOffset.height+a+t,t);return`<defs><filter id="satori_s-${e}" x="${n/r*100}%" y="${s/t*100}%" width="${(o-n)/r*100}%" height="${(f-s)/t*100}%"><feDropShadow dx="${i.shadowOffset.width}" dy="${i.shadowOffset.height}" stdDeviation="${i.shadowRadius/2}" flood-color="${i.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:r,top:t,ascender:i,clipPathId:a},n){let{textDecorationColor:o,textDecorationStyle:s,textDecorationLine:f,fontSize:h}=n;if(!f||f==="none")return"";let g=Math.max(1,h*.1),p=f==="line-through"?t+i*.5:f==="underline"?t+i*1.1:t,l=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:r,y1:p,x2:r+e,y2:p,stroke:o,"stroke-width":g,"stroke-dasharray":l,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var Ve=void 0;function*je(e,r){var lt;let t=te(),{parentStyle:i,inheritedStyle:a,parent:n,font:o,id:s,isInheritingTransform:f,debug:h,embedFont:g,graphemeImages:p,canLoadAdditionalAssets:l}=r;i.textTransform==="uppercase"?e=e.toLocaleUpperCase(Ve):i.textTransform==="lowercase"?e=e.toLocaleLowerCase(Ve):i.textTransform==="capitalize"&&(e=le(e,"word").map(C=>le(C,"grapheme").map((I,A)=>A===0?I.toLocaleUpperCase(Ve):I).join("")).join(""));let c=q(i.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),u=le(e,c),d=t.Node.create();d.setAlignItems(t.ALIGN_BASELINE),i.textAlign==="left"?d.setJustifyContent(t.JUSTIFY_FLEX_START):i.textAlign==="center"?d.setJustifyContent(t.JUSTIFY_CENTER):i.textAlign==="right"?d.setJustifyContent(t.JUSTIFY_FLEX_END):i.textAlign==="justify"&&d.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),n.insertChild(d,n.getChildCount());let{textAlign:b,textOverflow:x,whiteSpace:F,lineHeight:v,filter:N,_inheritedBackgroundClipTextPath:W}=i,M=i.fontSize,S=o.getEngine(M,v,i),H=l?u.filter(C=>!S.resolve(C)):[];yield H,H.length&&(S=o.getEngine(M,v,i));let _=[],T=[],X=[],K=[],Q=new Map,w=C=>{let I=0;for(let A of C){if(Q.has(A)){I+=Q.get(A);continue}let Y=S.measure(A,i);Q.set(A,Y),I+=Y}return I},$=0,R=[],m=0;for(let C of u){let I=!1,A=p&&p[C];F==="pre"?I=C[0]===`
`:F!=="nowrap"&&(A||ye.includes(C[0]))&&(I=!0),I?(F==="nowrap"?m+=w(R)+i.fontSize:($=Math.max($,w(R)),A&&($=Math.max($,i.fontSize))),R=[]):(!ye.includes(C[0])||!R.length)&&R.push(C===`
`?" ":C)}$=Math.max($,w(R)+m);let E=n.getMinWidth(),L=n.getMaxWidth(),Z=n.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(L.value)||L.unit===1&&($=Math.min($,L.value)),n.setMinWidth($)),typeof i.flexShrink=="undefined"&&n.setFlexShrink(1);let he=F==="pre-wrap"||F==="pre";d.setMeasureFunc(C=>{let I=0,A="",Y=0,U=0,z=0,V=-1,ie=0,P=0,oe=0;_=[],X=[0];for(let ne=0;ne<u.length;ne++){let D=u[ne];if(!he&&ye.includes(D[0]))A||(A=" "),Y=w([A]),K[ne]=null;else{let ae=he&&D===`
`,j=ae?0:p&&p[D]?i.fontSize:w([D]);U||(A="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||ne&&B&&U+Y+j>C&&F!=="nowrap"&&F!=="pre")_.push(U),T.push(oe),I++,ie+=P,U=j,P=j?S.glyphHeight(D):0,oe=j?S.baseline(D):0,X.push(1),V=-1,ae||(z=Math.max(z,C));else{U+=Y+j;let me=S.glyphHeight(D);me>P&&(P=me,oe=S.baseline(D)),J&&X[X.length-1]++}A="",Y=0,J&&V++,z=Math.max(z,U),K[ne]={y:ie,x:U-j,width:j,line:I,lineIndex:V}}}return U&&(I++,_.push(U),T.push(oe),ie+=P),{width:z,height:ie}});let[Lt,Ct]=yield,Oe="",_e="",re=a._inheritedClipPathId,{left:nt,top:it,width:we,height:ot}=d.getComputedLayout(),$e=n.getComputedWidth()-n.getComputedPadding(t.EDGE_LEFT)-n.getComputedPadding(t.EDGE_RIGHT)-n.getComputedBorder(t.EDGE_LEFT)-n.getComputedBorder(t.EDGE_RIGHT),ce=Lt+nt,pe=Ct+it,{matrix:ee,opacity:Re}=wt({left:nt,top:it,width:we,height:ot,isInheritingTransform:f},i),be="";i.textShadowOffset&&(be=de({width:we,height:ot,id:s},{shadowColor:i.textShadowColor,shadowOffset:i.textShadowOffset,shadowRadius:i.textShadowRadius}));let ve="",Te="",at="",Fe=-1,st=x==="ellipsis"?w(["\u2026"]):0,It=x==="ellipsis"?w([" "]):0,Le={};for(let C=0;C<u.length;C++){if(!K[C])continue;let I=K[C],A=u[C],Y=null,U=p?p[A]:null,z=I.y,V=I.x,ie=I.width,P=I.line;if(P===Fe)continue;let oe=!1;if(_.length>1){let B=we-_[P];if(b==="right"||b==="end")V+=B;else if(b==="center")V+=B/2;else if(b==="justify"&&P<_.length-1){let J=X[P];V+=(J>1?B/(J-1):0)*I.lineIndex,oe=!0}}if(Le[P]||(Le[P]=[V,oe?we:_[P]]),x==="ellipsis"&&_[P]>$e&&I.x+ie+st+It>$e){let B=le(A,"grapheme"),J="",me=0;for(let ft of B){let ut=I.x+w([J+ft]);if(J&&ut+st>$e)break;J+=ft,me=ut}A=J+"\u2026",Fe=P,Le[P][1]=me}let ne=T[P],D=S.baseline(A),ae=S.glyphHeight(A),j=ne-D;if(U?z+=0:g?(Y=S.getSVG(A,se(G({},i),{left:ce+V,top:pe+z+D+j,letterSpacing:i.letterSpacing})),h&&(at+=y("rect",{x:ce+V,y:pe+z+j,width:I.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0})+y("line",{x1:ce+V,x2:ce+V+I.width,y1:pe+z+j+D,y2:pe+z+j+D,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":re?`url(#${re})`:void 0}))):z+=D+j,i.textDecorationLine&&(P!==((lt=K[C+1])==null?void 0:lt.line)||Fe===P)){let B=Le[P];B&&!B[2]&&(ve+=ze({left:ce+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(A),clipPathId:re},i),B[2]=1)}if(Y!==null)Te+=Y+" ";else{let[B,J]=Ue({content:A,filter:be,id:s,left:ce+V,top:pe+z,width:ie,height:ae,matrix:ee,opacity:Re,image:U,clipPathId:re,debug:h,shape:!!W,decorationShape:ve},i);Oe+=B,_e+=J,ve=""}}if(Te){let C=i.color!=="transparent"&&Re!==0?y("path",{fill:i.color,d:Te,transform:ee||void 0,opacity:Re!==1?Re:void 0,"clip-path":re?`url(#${re})`:void 0,style:N?`filter:${N}`:void 0}):"";W&&(_e=y("path",{d:Te,transform:ee||void 0})),Oe+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+C+ve+(be?"</g>":"")+at}return _e&&(i._inheritedBackgroundClipTextPath.value+=_e),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]+\.?))/},r="";function t(m){var E=new Error(r+": "+m);throw E.source=r,E}function i(){var m=a();return r.length>0&&t("Invalid input not EOF"),m}function a(){return v(n)}function n(){return o("linear-gradient",e.linearGradient,f)||o("repeating-linear-gradient",e.repeatingLinearGradient,f)||o("radial-gradient",e.radialGradient,p)||o("repeating-radial-gradient",e.repeatingRadialGradient,p)}function o(m,E,L){return s(E,function(Z){var he=L();return he&&($(e.comma)||t("Missing comma before color stops")),{type:m,orientation:he,colorStops:v(N)}})}function s(m,E){var L=$(m);if(L){$(e.startCall)||t("Missing (");var Z=E(L);return $(e.endCall)||t("Missing )"),Z}}function f(){return h()||g()}function h(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function p(){var m,E=l(),L;return E&&(m=[],m.push(E),L=r,$(e.comma)&&(E=l(),E?m.push(E):r=L)),m}function l(){var m=c()||u();if(m)m.at=b();else{var E=d();if(E){m=E;var L=b();L&&(m.at=L)}else{var Z=x();Z&&(m={type:"default-radial",at:Z})}}return m}function c(){var m=w("shape",/^(circle)/i,0);return m&&(m.style=Q()||d()),m}function u(){var m=w("shape",/^(ellipse)/i,0);return m&&(m.style=X()||d()),m}function d(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("position",/^at/,0)){var m=x();return m||t("Missing positioning value"),m}}function x(){var m=F();if(m.x||m.y)return{type:"position",value:m}}function F(){return{x:X(),y:X()}}function v(m){var E=m(),L=[];if(E)for(L.push(E);$(e.comma);)E=m(),E?L.push(E):t("One extra comma");return L}function N(){var m=W();return m||t("Expected color definition"),m.length=X(),m}function W(){return S()||_()||H()||M()}function M(){return w("literal",e.literalColor,0)}function S(){return w("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:v(T)}})}function _(){return s(e.rgbaColor,function(){return{type:"rgba",value:v(T)}})}function T(){return $(e.number)[1]}function X(){return w("%",e.percentageValue,1)||K()||Q()}function K(){return w("position-keyword",e.positionKeywords,1)}function Q(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(m,E,L){var Z=$(E);if(Z)return{type:m,value:Z[L]}}function $(m){var E,L;return L=/^[\n\r\t\s]+/.exec(r),L&&R(L[0].length),E=m.exec(r),E&&R(E[0].length),E}function R(m){r=r.substr(m)}return function(m){return r=m.toString(),i()}}();var qe=Je;function fr(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 ur(e,r){return typeof e=="string"&&e.endsWith("%")?r*parseFloat(e)/100:+e}function Rt(e,{x:r,y:t,defaultX:i,defaultY:a}){return(e?e.split(" ").map(n=>{try{let o=new fe(n);return o.type==="length"||o.type==="number"?o.value:o.value+o.unit}catch{return null}}).filter(n=>n!==null):[i,a]).map((n,o)=>ur(n,[r,t][o]))}function vt(e,r){let t=[];for(let o of r){let s=fr(o);if(!t.length&&(t.push({offset:0,color:s}),typeof o.length=="undefined"||o.length.value==="0"))continue;let f=typeof o.length=="undefined"?void 0:o.length.type==="%"?o.length.value/100:o.length.value/e;t.push({offset:f,color:s})}t.length||t.push({offset:0,color:"transparent"});let i=t[t.length-1];i.offset!==1&&(typeof i.offset=="undefined"?i.offset=1:t.push({offset:1,color:i.color}));let a=0,n=1;for(let o=0;o<t.length;o++)if(typeof t[o].offset=="undefined"){for(n<o&&(n=o);typeof t[n].offset=="undefined";)n++;t[o].offset=(t[n].offset-t[a].offset)/(n-a)*(o-a)+t[a].offset}else a=o;return t}function Ke({id:e,width:r,height:t},{image:i,size:a,position:n,repeat:o}){o=o||"repeat";let s=o==="repeat-x"||o==="repeat",f=o==="repeat-y"||o==="repeat",h=Rt(a,{x:r,y:t,defaultX:r,defaultY:t}),g=Rt(n,{x:r,y:t,defaultX:0,defaultY:0});if(i.startsWith("linear-gradient(")){let p=qe.parse(i)[0],l,c,u,d;if(p.orientation.type==="directional")[l,c,u,d]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[p.orientation.value];else if(p.orientation.type==="angular"){let x=+p.orientation.value/180*Math.PI-Math.PI/2,F=Math.cos(x),v=Math.sin(x);l=0,c=0,u=F,d=v,u<0&&(l-=u,u=0),d<0&&(c-=d,d=0)}let b=vt(r,p.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${l}" y1="${c}" x2="${u}" y2="${d}">${b.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(i.startsWith("radial-gradient(")){let p=qe.parse(i)[0],l=p.orientation[0],[c,u]=h,d="circle",b=c/2,x=u/2;if(l.type==="shape"){if(d=l.value,l.at)if(l.at.type==="position")b=l.at.value.x.value,x=l.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+l.at.type)}else throw new Error("orientation.type not implemented: "+l.type);let F=vt(r,p.colorStops),v=`satori_radial_${e}`,N=`satori_pattern_${e}`,W={},M=Math.max(Math.abs(c-b),Math.abs(b)),S=Math.max(Math.abs(u-x),Math.abs(x));if(d==="circle")W.r=Math.sqrt(M*M+S*S);else if(d==="ellipse"){let T=S!==0?M/S:1;W.ry=Math.sqrt(M*M+S*S*T*T)/T,W.rx=W.ry*T}let H=y("pattern",{id:N,x:g[0],y:g[1],width:s?c:"100%",height:f?u:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:v},F.map(T=>y("stop",{offset:T.offset,"stop-color":T.color})).join(""))+y(d,se(G({cx:b,cy:x,width:c,height:u},W),{fill:`url(#${v})`})));return[N,H]}if(i.startsWith("url(")){let p=i.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?h[0]:"100%",height:f?h[1]:"100%"},y("image",{x:0,y:0,width:h[0],height:h[1],href:p}))]}}function Ae(e,r,t){return t<e+r&&(t/2<e&&t/2<r?e=r=t/2:t/2<e?e=t-r:t/2<r&&(r=t-e)),[e,r]}function Ee({left:e,top:r,width:t,height:i},a){let{borderTopLeftRadius:n,borderTopRightRadius:o,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return n=Math.min(n||0,t,i),o=Math.min(o||0,t,i),s=Math.min(s||0,t,i),f=Math.min(f||0,t,i),!n&&!o&&!s&&!f?"":([n,o]=Ae(n,o,t),[n,s]=Ae(n,s,i),[o,f]=Ae(o,f,i),[s,f]=Ae(s,f,t),`M${e+n},${r} h${t-n-o} a${o},${o} 0 0 1 ${o},${o} v${i-o-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-t} a${s},${s} 0 0 1 ${-s},${-s} v${s+n-i} a${n},${n} 0 0 1 ${n},${-n}`)}function Ze({left:e,top:r,width:t,height:i,path:a,id:n},o){return o.overflow!=="hidden"?"":a?y("clipPath",{id:`satori_cp-${n}`,"clip-path":o._inheritedClipPathId?`url(#${o._inheritedClipPathId})`:void 0},y("path",{x:e,y:r,width:t,height:i,d:a})):y("clipPath",{id:`satori_cp-${n}`,"clip-path":o._inheritedClipPathId?`url(#${o._inheritedClipPathId})`:void 0},y("rect",{x:e,y:r,width:t,height:i}))}function Qe({id:e,left:r,top:t,width:i,height:a,isInheritingTransform:n,debug:o},s){if(s.display==="none")return"";let f="rect",h="transparent",g=0,p="",l="",c=[],u=1,d="";s.backgroundColor&&c.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,h=s.borderColor),s.opacity&&(u=+s.opacity),s.transform&&(p=ue({left:r,top:t,width:i,height:a},s.transform,n,s.transformOrigin));let b="";if(s.backgroundImage){let H=s.backgroundImage.map((_,T)=>Ke({id:e+"_"+T,width:i,height:a},_)).filter(Boolean);for(let _ of H)c.push(`url(#${_[0]})`),l+=_[1],_[2]&&(b+=_[2])}let x=Ee({left:r,top:t,width:i,height:a},s);x&&(f="path");let F=Ze({left:r,top:t,width:i,height:a,path:x,id:e},s),v=s._inheritedClipPathId,N=de({width:i,height:a,id:e},s);o&&(d=y("rect",{x:r,y:t,width:i,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:p||void 0,"clip-path":v?`url(#${v})`:void 0})),c.length||c.push("transparent");let{backgroundClip:W,filter:M}=s,S=c.map((H,_)=>{if(H==="transparent"&&!(_===c.length-1&&g))return"";let T=_===c.length-1&&g&&W!=="text";return y(f,{x:r,y:t,width:i,height:a,fill:H,stroke:T?h:void 0,"stroke-width":T?g:void 0,d:x||void 0,transform:p||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:v?`url(#${v})`:void 0,style:M?`filter:${M}`:void 0})}).join("");return W==="text"&&g&&(S=y(f,{x:r,y:t,width:i,height:a,fill:"transparent",stroke:h,"stroke-width":g,d:x||void 0,transform:p||void 0,"clip-path":v?`url(#${v})`:void 0})+S),(l?`<defs>${l}</defs>`:"")+F+(N?`${N}<g filter="url(#satori_s-${e})">`:"")+(u!==1?`<g opacity="${u}">`:"")+(b||S)+(u!==1?"</g>":"")+(N?"</g>":"")+d}function et({id:e,left:r,top:t,width:i,height:a,src:n,debug:o,isInheritingTransform:s},f){if(f.display==="none")return"";let h="",g=1,p="",l=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",c=Ee({left:r,top:t,width:i,height:a},f),u=f._inheritedClipPathId;c&&(h=y("clipPath",{id:`satori_c-${e}`,"clip-path":u?`url(#${u})`:void 0},y("path",{x:r,y:t,width:i,height:a,d:c}))),f.opacity&&(g=+f.opacity);let d=de({width:i,height:a,id:e},f);return f.transform&&(p=ue({left:r,top:t,width:i,height:a},f.transform,s,f.transformOrigin)),d+(d?`<g filter="url(#satori_s-${e})">`:"")+h+y("image",{x:r,y:t,width:i,height:a,href:n,preserveAspectRatio:l,transform:p||void 0,"clip-path":h?`url(#satori_c-${e})`:u?`url(#${u})`:void 0})+(d?"</g>":"")}function*Se(e,r){let t=te(),{id:i,inheritedStyle:a,parent:n,font:o,debug:s,embedFont:f=!0,graphemeImages:h,canLoadAdditionalAssets:g}=r;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let R;if(!We(e))R=je(String(e),r),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=Se(e.type(e.props),r),yield R.next().value}R.next();let m=yield;return R.next(m).value}let{type:p,props:l}=e,{style:c,children:u}=l,d=t.Node.create();n.insertChild(d,n.getChildCount());let[b,x]=Xe(d,p,a,c,l),F=b.transform===a.transform;if(F||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(x._inheritedClipPathId=`satori_cp-${i}`),b.backgroundClip==="text"){let R={value:""};x._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let v=typeof u=="undefined"?[]:[].concat(u),N=[],W=0,M=[];for(let R of v){let m=Se(R,{id:i+"-"+W++,parentStyle:b,inheritedStyle:x,isInheritingTransform:!0,parent:d,font:o,embedFont:f,debug:s,graphemeImages:h,canLoadAdditionalAssets:g});M.push(...m.next().value),N.push(m)}yield M;for(let R of N)R.next();let[S,H]=yield;b.position==="absolute"&&d.calculateLayout();let{left:_,top:T,width:X,height:K}=d.getComputedLayout();_+=S,T+=H;let Q="",w="",$="";p==="img"?w=et({id:i,left:_,top:T,width:X,height:K,src:l.src,isInheritingTransform:F,debug:s},b):w=Qe({id:i,left:_,top:T,width:X,height:K,isInheritingTransform:F,debug:s},b);for(let R of N)Q+=R.next([_,T]).value;return b._inheritedBackgroundClipTextPath&&($+=y("clipPath",{id:`satori_bct-${i}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+w+Q}import dr from"@shuding/opentype.js";function cr(e,r,[t,i],[a,n]){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(i!==n){if(i===r)return-1;if(n===r)return 1}return-1}var ke=class{constructor(r){this.fonts=new Map;this.addFonts(r)}get({name:r,weight:t,style:i}){if(!this.fonts.has(r))return null;t==="normal"&&(t=400),t==="bold"&&(t=700);let a=[...this.fonts.get(r)],n=a[0];for(let o=1;o<a.length;o++){let[,s,f]=n,[,h,g]=a[o];cr(t,i,[s,f],[h,g])>0&&(n=a[o])}return n[0]}addFonts(r){for(let t of r){let i=t.data,a=dr.parse("buffer"in i?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i,{lowMemory:!0});this.defaultFont||(this.defaultFont=a);let n=t.name.toLowerCase();this.fonts.has(n)||this.fonts.set(n,[]),this.fonts.get(n).push([a,t.weight,t.style])}}getEngine(r=16,t=1.2,{fontFamily:i,fontWeight:a=400,fontStyle:n="normal"}){i=Array.isArray(i)?i:[i];let o=i.map(l=>this.get({name:l,weight:a,style:n})).filter(Boolean);for(let l of this.fonts.keys())i.includes(l)||o.push(this.get({name:l,weight:a,style:n}));let s=new Map,f=(l,c=!0)=>{let u=l.charCodeAt(0);if(s.has(u))return s.get(u);let d=o.find((b,x)=>!!b.charToGlyphIndex(l)||c&&x===o.length-1);return d&&s.set(u,d),d},h=(l,c=!1)=>{var d,b;return((c?(b=(d=l.tables)==null?void 0:d.os2)==null?void 0:b.sTypoAscender:0)||l.ascender)/l.unitsPerEm*r},g=(l,c=!1)=>{var d,b;return((c?(b=(d=l.tables)==null?void 0:d.os2)==null?void 0:b.sTypoDescender:0)||l.descender)/l.unitsPerEm*r},p={resolve:l=>f(l,!1),baseline:(l,c=typeof l=="undefined"?o[0]:f(l))=>{let u=h(c,!0),d=g(c,!0),b=u-d,x=p.glyphHeight(l,c),F=(x-b)/2,{yMax:v,yMin:N}=c.tables.head,W=v/(v-N);return F+W*x},glyphHeight:(l,c=typeof l=="undefined"?o[0]:f(l))=>(h(c)-g(c))*t/1.2,measure:(l,c)=>{let u=f(l);return this.measure(u,l,c)},getSVG:(l,c)=>{let u=f(l);return this.getSVG(u,l,c)}};return p}measure(r,t,{fontSize:i,letterSpacing:a=0}){return r.getAdvanceWidth(t,i,{letterSpacing:a/i})}getSVG(r,t,{fontSize:i,top:a,left:n,letterSpacing:o=0}){return r.getPath(t,n,a,i,{letterSpacing:o/i}).toPathData(1)}};function tt({width:e,height:r,content:t}){return y("svg",{width:e,height:r,viewBox:`0 0 ${e} ${r}`,xmlns:"http://www.w3.org/2000/svg"},t)}var rt=new WeakMap;async function Tt(e,r){let t=te();if(!t)throw new Error("Satori is not initialized.");let i;rt.has(r.fonts)?i=rt.get(r.fonts):rt.set(r.fonts,i=new ke(r.fonts));let a=t.Node.create();a.setWidth(r.width),a.setHeight(r.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 n=G({},r.graphemeImages),o=Se(e,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:r.width,_viewportHeight:r.height},parent:a,font:i,embedFont:r.embedFont,debug:r.debug,graphemeImages:n,canLoadAdditionalAssets:!!r.loadAdditionalAsset}),s=o.next().value;if(r.loadAdditionalAsset&&s.length){s=[...new Set(le(s.join(""),"grapheme"))];let h={};s.forEach(l=>pr.detect(l,c=>{h[c]=h[c]||[],c==="unknown"?h[c].push(l):h[c][0]=(h[c][0]||"")+l}));let g=[],p={};await Promise.all(Object.entries(h).flatMap(([l,c])=>c.map(u=>r.loadAdditionalAsset(l,u).then(d=>{typeof d=="string"?p[u]=d:d&&g.push(d)})))),i.addFonts(g),Object.assign(n,p)}o.next(),a.calculateLayout(r.width,r.height,t.DIRECTION_LTR);let f=o.next([0,0]).value;return a.freeRecursive(),tt({width:r.width,height:r.height,content:f})}export{Tt as default,Wt as init};
//# sourceMappingURL=index.js.map

@@ -1,5 +0,5 @@

var xt=Object.defineProperty,St=Object.defineProperties;var _t=Object.getOwnPropertyDescriptors;var rt=Object.getOwnPropertySymbols;var Et=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var nt=(t,r,e)=>r in t?xt(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,D=(t,r)=>{for(var e in r||(r={}))Et.call(r,e)&&nt(t,e,r[e]);if(rt)for(var e of rt(r))Rt.call(r,e)&&nt(t,e,r[e]);return t},te=(t,r)=>St(t,_t(r));var it={};var ve;ve=it.default;function Tt(t){ve=t}function Q(){return ve}import{LineBreaker as wt}from"css-line-break";import{splitGraphemes as It}from"text-segmentation";function ke(t){let r=typeof t;return!(r==="number"||r==="bigint"||r==="string"||r==="boolean")}function ot(t){return/^class\s/.test(Function.prototype.toString.call(t))}function fe(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}function H(t,r,e){let o=r[t];return typeof o=="undefined"?e:o}var at=void 0,Ae=typeof Intl!="undefined"&&"Segmenter"in Intl&&process.env.NODE_ENV!=="test",Lt=Ae?new Intl.Segmenter(at,{granularity:"word"}):null,Ct=Ae?new Intl.Segmenter(at,{granularity:"grapheme"}):null,de=[32,160,4961,65792,65793,4153,4241,10].map(t=>String.fromCodePoint(t)),vt=t=>{let r=wt(t,{lineBreak:"strict",wordBreak:"normal"}),e=[],o;for(;!(o=r.next()).done;)if(o.value){let a=o.value.slice(),i="";for(let n=0;n<a.length;n++){let s=a[n];de.includes(s)?(i.length&&e.push(i),e.push(s),i=""):i+=s}i.length&&e.push(i)}return e};function ce(t,r){return Ae?r==="word"?[...Lt.segment(t)].map(e=>e.segment):[...Ct.segment(t)].map(e=>e.segment):r==="word"?vt(t):It(t)}function y(t,r,e){let o="";for(let[a,i]of Object.entries(r))typeof i!="undefined"&&(o+=` ${a}="${i}"`);return e?`<${t}${o}>${e}</${t}>`:`<${t}${o}/>`}var st={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 kt=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","textAlign","textTransform","textShadowOffset","textShadowColor","textShadowRadius","textDecorationLine","textDecorationStyle","textDecorationColor","whiteSpace","transform","wordBreak","opacity","_viewportWidth","_viewportHeight","_inheritedClipPathId","_inheritedBackgroundClipTextPath"]);function Pe(t){let r={};for(let e in t)kt.has(e)&&(r[e]=t[e]);return r}import{getPropertyName as Ot,getStylesForProperty as Ft}from"css-to-react-native";import ut from"parse-css-dimension";import{parseElementStyle as $t}from"css-background-parser";import At from"postcss-value-parser";import Pt from"parse-css-dimension";function Wt(t,r){try{let e=new Pt(t);switch(e.unit){case"px":return{absolute:e.value};case"em":return{absolute:e.value*r};case"rem":return{absolute:e.value*16};case"%":return{relative:e.value};default:return{}}}catch{return{}}}function We(t,r,e){switch(t){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=Wt(t,r);return o.absolute?{[e?"xAbsolute":"yAbsolute"]:o.absolute}:o.relative?{[e?"xRelative":"yRelative"]:o.relative}:{}}}function Oe(t,r){if(typeof t=="number")return{xAbsolute:t};let e;try{e=At(t).nodes.filter(o=>o.type==="word").map(o=>o.value)}catch{return{}}return e.length===1?We(e[0],r,!0):e.length===2?((e[0]==="top"||e[0]==="bottom"||e[1]==="left"||e[1]==="right")&&e.reverse(),D(D({},We(e[0],r,!0)),We(e[1],r,!1))):{}}var Nt=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),Mt=new Set(["lineHeight"]),ft=[1,0,0,1,0,0];function Gt(t,r,e,o){return t==="border"&&!e.includes(r.borderColor)?r.borderColor=o:t==="textDecoration"&&!e.includes(r.textDecorationColor)&&(r.textDecorationColor=o),r}function lt(t,r){return typeof r=="number"?Nt.has(t)?Mt.has(t)?r:String(r):r+"px":r}function Fe(t,r,e,{percentage:o}={percentage:!1}){if(typeof t=="number")return t;try{let a=new ut(t);if(a.type==="length")switch(a.unit){case"em":return a.value*r;case"rem":return a.value*16;case"vw":return~~(a.value*e._viewportWidth/100);case"vh":return~~(a.value*e._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*r}catch{}}function Ee(t,r){let e={};for(let a in t){if(a.startsWith("_")){e[a]=t[a];continue}let i=Ot(a);Object.assign(e,i==="lineHeight"?{lineHeight:lt(i,t[a])}:Gt(i,Ft(i,lt(i,t[a]),!0),t[a],t.color||r.color))}if(e.backgroundImage){let{backgrounds:a}=$t(e);e.backgroundImage=a}let o=e.fontSize||r.fontSize;if(typeof o=="string")try{let a=new ut(o);switch(a.unit){case"em":o=a.value*r.fontSize;break;case"rem":o=a.value*16;break}}catch{o=16}typeof e.fontSize!="undefined"&&(e.fontSize=o),e.transformOrigin&&(e.transformOrigin=Oe(e.transformOrigin,o));for(let a in e){let i=e[a];if(a==="lineHeight")typeof i=="string"&&(i=e[a]=Fe(i,o,r,{percentage:!0})/o);else if(typeof i=="string"){let n=Fe(i,o,r);typeof n!="undefined"&&(e[a]=n),i=e[a]}if(a==="opacity"&&(i=e[a]=i*r.opacity),a==="transform"){let n=[...ft],s=i;for(let f of s){let p=Object.keys(f)[0],g=f[p],u=typeof g=="string"?Fe(g,o,r):g,m=[...ft];switch(p){case"translateX":m[4]=u;break;case"translateY":m[5]=u;break;case"scale":m[0]=u,m[3]=u;break;case"scaleX":m[0]=u;break;case"scaleY":m[3]=u;break;case"rotate":let h=u*Math.PI/180,d=Math.cos(h),c=Math.sin(h);m[0]=d,m[1]=c,m[2]=-c,m[3]=d;break;case"skewX":m[2]=Math.tan(u*Math.PI/180);break;case"skewY":m[1]=Math.tan(u*Math.PI/180);break}n=fe(m,n)}e.transform=n}}return e}function $e(t,r,e,o,a){let i=Q(),n=D(D(D({},e),Ee(st[r],e)),Ee(o,e));if(r==="img"){let s=parseInt(a.width),p=parseInt(a.height)/s;n.width||(n.width=s),n.height||(n.height=p*n.width)}return t.setDisplay(H(n.display,{flex:i.DISPLAY_FLEX,none:i.DISPLAY_NONE},i.DISPLAY_FLEX)),t.setAlignContent(H(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)),t.setAlignItems(H(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)),t.setAlignSelf(H(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)),t.setJustifyContent(H(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)),t.setFlexDirection(H(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)),t.setFlexWrap(H(n.flexWrap,{wrap:i.WRAP_WRAP,nowrap:i.WRAP_NO_WRAP,"wrap-reverse":i.WRAP_WRAP_REVERSE},i.WRAP_WRAP)),typeof n.flexBasis!="undefined"&&t.setFlexBasis(n.flexBasis),t.setFlexGrow(typeof n.flexGrow=="undefined"?0:n.flexGrow),t.setFlexShrink(typeof n.flexShrink=="undefined"?0:n.flexShrink),typeof n.maxHeight!="undefined"&&t.setMaxHeight(n.maxHeight),typeof n.maxWidth!="undefined"&&t.setMaxWidth(n.maxWidth),typeof n.minHeight!="undefined"&&t.setMinHeight(n.minHeight),typeof n.minWidth!="undefined"&&t.setMinWidth(n.minWidth),t.setOverflow(H(n.overflow,{visible:i.OVERFLOW_VISIBLE,hidden:i.OVERFLOW_HIDDEN},i.OVERFLOW_VISIBLE)),t.setMargin(i.EDGE_TOP,n.marginTop||0),t.setMargin(i.EDGE_BOTTOM,n.marginBottom||0),t.setMargin(i.EDGE_LEFT,n.marginLeft||0),t.setMargin(i.EDGE_RIGHT,n.marginRight||0),t.setBorder(i.EDGE_TOP,n.borderWidth||0),t.setBorder(i.EDGE_BOTTOM,n.borderWidth||0),t.setBorder(i.EDGE_LEFT,n.borderWidth||0),t.setBorder(i.EDGE_RIGHT,n.borderWidth||0),t.setPadding(i.EDGE_TOP,n.paddingTop||0),t.setPadding(i.EDGE_BOTTOM,n.paddingBottom||0),t.setPadding(i.EDGE_LEFT,n.paddingLeft||0),t.setPadding(i.EDGE_RIGHT,n.paddingRight||0),t.setPositionType(H(n.position,{absolute:i.POSITION_TYPE_ABSOLUTE,relative:i.POSITION_TYPE_RELATIVE},i.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&t.setPosition(i.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&t.setPosition(i.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&t.setPosition(i.EDGE_LEFT,n.left),typeof n.right!="undefined"&&t.setPosition(i.EDGE_RIGHT,n.right),typeof n.height!="undefined"?t.setHeight(n.height):t.setHeightAuto(),typeof n.width!="undefined"?t.setWidth(n.width):t.setWidthAuto(),[n,Pe(n)]}function re({left:t,top:r,width:e,height:o},a,i,n){var f,p,g,u;let s;if(i)s=a;else{let m=(p=n==null?void 0:n.xAbsolute)!=null?p:((f=n==null?void 0:n.xRelative)!=null?f:50)*e/100,h=(u=n==null?void 0:n.yAbsolute)!=null?u:((g=n==null?void 0:n.yRelative)!=null?g:50)*o/100,d=t+m,c=r+h;s=fe([1,0,0,1,d,c],fe(a,[1,0,0,1,-d,-c])),a.__parent&&(s=fe(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(m=>m.toFixed(2)).join(",")})`}function dt({left:t,top:r,width:e,height:o,isInheritingTransform:a},i){let n="",s=1;return i.transform&&(n=re({left:t,top:r,width:e,height:o},i.transform,a,i.transformOrigin)),i.opacity&&(s=+i.opacity),{matrix:n,opacity:s}}function Ne({id:t,content:r,filter:e,left:o,top:a,width:i,height:n,matrix:s,opacity:f,image:p,clipPathId:g,debug:u,shape:m,decorationShape:h},d){let c="";if(u&&(c=y("rect",{x:o,y:a,width:i,height:.5,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),p){let x={href:p,x:o,y:a,width:i,height:n,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0};return[(e?`${e}<g filter="url(#satori_s-${t})">`:"")+y("image",te(D({},x),{opacity:f!==1?f:void 0}))+(h||"")+(e?"</g>":"")+c,""]}let R={x:o,y:a,width:i,height:n,"font-weight":d.fontWeight,"font-style":d.fontStyle,"font-size":d.fontSize,"font-family":d.fontFamily,"letter-spacing":d.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0};return[(e?`${e}<g filter="url(#satori_s-${t})">`:"")+y("text",te(D({},R),{fill:d.color,opacity:f!==1?f:void 0}),r)+(h||"")+(e?"</g>":"")+c,m?y("text",R,r):""]}function ne({id:t,width:r,height:e},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+r,r),s=Math.min(o.shadowOffset.height-a,0),f=Math.max(o.shadowOffset.height+a+e,e);return`<defs><filter id="satori_s-${t}" x="${i/r*100}%" y="${s/e*100}%" width="${(n-i)/r*100}%" height="${(f-s)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius/2}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function Me({width:t,left:r,top:e,ascender:o,clipPathId:a},i){let{textDecorationColor:n,textDecorationStyle:s,textDecorationLine:f,fontSize:p}=i;if(!f||f==="none")return"";let g=Math.max(1,p*.1),u=f==="line-through"?e+o*.75:f==="underline"?e+o*1.25:e,m=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:r,y1:u,x2:r+t,y2:u,stroke:n,"stroke-width":g,"stroke-dasharray":m,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var Ge=void 0;function*De(t,r){var Qe;let e=Q(),{parentStyle:o,inheritedStyle:a,parent:i,font:n,id:s,isInheritingTransform:f,debug:p,embedFont:g,graphemeImages:u}=r;o.textTransform==="uppercase"?t=t.toLocaleUpperCase(Ge):o.textTransform==="lowercase"?t=t.toLocaleLowerCase(Ge):o.textTransform==="capitalize"&&(t=ce(t,"word").map(_=>ce(_,"grapheme").map((E,N)=>N===0?E.toLocaleUpperCase(Ge):E).join("")).join(""));let m=H(o.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),h=ce(t,m),d=e.Node.create();d.setAlignItems(e.ALIGN_BASELINE),o.textAlign==="left"?d.setJustifyContent(e.JUSTIFY_FLEX_START):o.textAlign==="center"?d.setJustifyContent(e.JUSTIFY_CENTER):o.textAlign==="right"?d.setJustifyContent(e.JUSTIFY_FLEX_END):o.textAlign==="justify"&&d.setJustifyContent(e.JUSTIFY_SPACE_BETWEEN),i.insertChild(d,i.getChildCount());let{textAlign:c,textOverflow:R,whiteSpace:x,lineHeight:Y,_inheritedBackgroundClipTextPath:L}=o,O=n.getFont(o),F=o.fontSize,P=O.ascender/O.unitsPerEm*F,v=-(O.descender/O.unitsPerEm)*F,C=P+v,M=Y/1.2*F-C,W=C*Y/1.2,j=(o.fontSize-C)/2,G=[],U=[],S=[],$=new Map,z=_=>{if($.has(_))return $.get(_);let E=n.measure(O,_,o);return $.set(_,E),E},l=0,b="",T=0;for(let _ of h){let E=!1,N=u&&u[_];x==="pre"?E=_[0]===`
`:x!=="nowrap"&&(N||de.includes(_[0]))&&(E=!0),E?(x==="nowrap"?T+=z(b)+o.fontSize:(l=Math.max(l,z(b)),N&&(l=Math.max(l,o.fontSize))),b=""):(!de.includes(_[0])||!b)&&(b+=_===`
`?" ":_)}l=Math.max(l,z(b)+T);let X=i.getMinWidth(),ie=i.getMaxWidth(),gt=i.getWidth();isNaN(gt.value)&&(isNaN(X.value)||X.unit===1&&X.value>l)&&(isNaN(ie.value)||ie.unit===1&&(l=Math.min(l,ie.value)),i.setMinWidth(l)),typeof o.flexShrink=="undefined"&&i.setFlexShrink(1);let je=["pre-wrap","pre"].includes(x);d.setMeasureFunc(_=>{let E=0,N="",V=0,B=0,K=0,q=-1;G=[],U=[0];for(let Z=0;Z<h.length;Z++){let k=h[Z];if(!je&&de.includes(k[0]))N||(N=" "),V=z(N),S[Z]=null;else{let ae=je&&k===`
`,A=ae?0:u&&u[k]?o.fontSize:z(k);B||(N="",V=0);let J=V||",.!?:-@)>]}%#".indexOf(k[0])<0,se=!B||!!V;ae||Z&&J&&B+V+A>_&&x!=="nowrap"&&x!=="pre"?(G.push(B),E++,B=A,U.push(1),q=-1,ae||(K=Math.max(K,_))):(B+=V+A,se&&U[U.length-1]++),N="",V=0,se&&q++,K=Math.max(K,B),S[Z]={y:E*W-j,x:B-A,width:A,line:E,lineIndex:q}}}return B&&(E++,G.push(B)),{width:K,height:E*W}});let[ht,bt]=yield,we="",ge="",oe=a._inheritedClipPathId,{left:Ke,top:qe,width:le,height:Ie}=d.getComputedLayout(),Le=i.getComputedWidth()-i.getComputedPadding(e.EDGE_LEFT)-i.getComputedPadding(e.EDGE_RIGHT)-i.getComputedBorder(e.EDGE_LEFT)-i.getComputedBorder(e.EDGE_RIGHT),he=ht+Ke,be=bt+qe,{matrix:ee,opacity:ye}=dt({left:Ke,top:qe,width:le,height:Ie,isInheritingTransform:f},o),ue="";o.textShadowOffset&&(ue=ne({width:le,height:Ie,id:s},{shadowColor:o.textShadowColor,shadowOffset:o.textShadowOffset,shadowRadius:o.textShadowRadius}));let xe="",Se="",Ce=-1,Ze=R==="ellipsis"?z("\u2026"):0,yt=R==="ellipsis"?z(" "):0,_e={};for(let _=0;_<h.length;_++){if(!S[_])continue;let E=S[_],N=h[_],V=null,B=u?u[N]:null,K=E.y,q=E.x,Z=E.width,k=E.line;if(k===Ce)continue;let ae=!1;if(G.length>1){let A=le-G[k];if(c==="right"||c==="end")q+=A;else if(c==="center")q+=A/2;else if(c==="justify"&&k<G.length-1){let J=U[k];q+=(J>1?A/(J-1):0)*E.lineIndex,ae=!0}}if(_e[k]||(_e[k]=[q,ae?le:G[k]]),R==="ellipsis"&&G[k]>Le&&E.x+Z+Ze+yt>Le){let A=ce(N,"grapheme"),J="",se=0;for(let et of A){let tt=E.x+z(J+et);if(J&&tt+Ze>Le)break;J+=et,se=tt}N=J+"\u2026",Ce=k,_e[k][1]=se}if(B?K+=j:g?V=n.getSVG(O,N,te(D({},o),{left:he+q,top:be+K+P+M/2,letterSpacing:o.letterSpacing})):K+=P+M/2,o.textDecorationLine&&(k!==((Qe=S[_+1])==null?void 0:Qe.line)||Ce===k)){let A=_e[k];A&&!A[2]&&(xe+=Me({left:he+A[0],top:be+W*+k,width:A[1],ascender:P+M/2,clipPathId:oe},o),A[2]=1)}if(V)Se+=V+" ";else{let[A,J]=Ne({content:N,filter:ue,id:s,left:he+q,top:be+K,width:Z,height:W,matrix:ee,opacity:ye,image:B,clipPathId:oe,debug:p,shape:!!L,decorationShape:xe},o);we+=A,ge+=J,xe=""}}if(Se){let _="";p&&(_=y("rect",{x:he,y:be,width:le,height:Ie,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":oe?`url(#${oe})`:void 0}));let E=o.color!=="transparent"&&ye!==0?y("path",{fill:o.color,d:Se,transform:ee||void 0,opacity:ye!==1?ye:void 0,"clip-path":oe?`url(#${oe})`:void 0}):"";L&&(ge=y("path",{d:Se,transform:ee||void 0})),we+=(ue?`${ue}<g filter="url(#satori_s-${s})">`:"")+E+xe+(ue?"</g>":"")+_}return ge&&(o._inheritedBackgroundClipTextPath.value+=ge),we}import Dt from"parse-css-dimension";var Be=Be||{};Be.parse=function(){var t={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]+\.?))/},r="";function e(l){var b=new Error(r+": "+l);throw b.source=r,b}function o(){var l=a();return r.length>0&&e("Invalid input not EOF"),l}function a(){return L(i)}function i(){return n("linear-gradient",t.linearGradient,f)||n("repeating-linear-gradient",t.repeatingLinearGradient,f)||n("radial-gradient",t.radialGradient,u)||n("repeating-radial-gradient",t.repeatingRadialGradient,u)}function n(l,b,T){return s(b,function(X){var ie=T();return ie&&($(t.comma)||e("Missing comma before color stops")),{type:l,orientation:ie,colorStops:L(O)}})}function s(l,b){var T=$(l);if(T){$(t.startCall)||e("Missing (");var X=b(T);return $(t.endCall)||e("Missing )"),X}}function f(){return p()||g()}function p(){return S("directional",t.sideOrCorner,1)}function g(){return S("angular",t.angleValue,1)}function u(){var l,b=m(),T;return b&&(l=[],l.push(b),T=r,$(t.comma)&&(b=m(),b?l.push(b):r=T)),l}function m(){var l=h()||d();if(l)l.at=R();else{var b=c();if(b){l=b;var T=R();T&&(l.at=T)}else{var X=x();X&&(l={type:"default-radial",at:X})}}return l}function h(){var l=S("shape",/^(circle)/i,0);return l&&(l.style=U()||c()),l}function d(){var l=S("shape",/^(ellipse)/i,0);return l&&(l.style=j()||c()),l}function c(){return S("extent-keyword",t.extentKeywords,1)}function R(){if(S("position",/^at/,0)){var l=x();return l||e("Missing positioning value"),l}}function x(){var l=Y();if(l.x||l.y)return{type:"position",value:l}}function Y(){return{x:j(),y:j()}}function L(l){var b=l(),T=[];if(b)for(T.push(b);$(t.comma);)b=l(),b?T.push(b):e("One extra comma");return T}function O(){var l=F();return l||e("Expected color definition"),l.length=j(),l}function F(){return v()||M()||C()||P()}function P(){return S("literal",t.literalColor,0)}function v(){return S("hex",t.hexColor,1)}function C(){return s(t.rgbColor,function(){return{type:"rgb",value:L(W)}})}function M(){return s(t.rgbaColor,function(){return{type:"rgba",value:L(W)}})}function W(){return $(t.number)[1]}function j(){return S("%",t.percentageValue,1)||G()||U()}function G(){return S("position-keyword",t.positionKeywords,1)}function U(){return S("px",t.pixelValue,1)||S("em",t.emValue,1)}function S(l,b,T){var X=$(b);if(X)return{type:l,value:X[T]}}function $(l){var b,T;return T=/^[\n\r\t\s]+/.exec(r),T&&z(T[0].length),b=l.exec(r),b&&z(b[0].length),b}function z(l){r=r.substr(l)}return function(l){return r=l.toString(),o()}}();var Ye=Be;function Bt(t){return t.type==="literal"?t.value:t.type==="hex"?`#${t.value}`:t.type==="rgb"?`rgb(${t.value.join(",")})`:t.type==="rgba"?`rgba(${t.value.join(",")})`:"transparent"}function Yt(t,r){return typeof t=="string"&&t.endsWith("%")?r*parseFloat(t)/100:+t}function ct(t,{x:r,y:e,defaultX:o,defaultY:a}){return(t?t.split(" ").map(i=>{try{let n=new Dt(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)=>Yt(i,[r,e][n]))}function mt(t,r){let e=[];for(let n of r){let s=Bt(n);if(!e.length&&(e.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/t;e.push({offset:f,color:s})}e.length||e.push({offset:0,color:"transparent"});let o=e[e.length-1];o.offset!==1&&(typeof o.offset=="undefined"?o.offset=1:e.push({offset:1,color:o.color}));let a=0,i=1;for(let n=0;n<e.length;n++)if(typeof e[n].offset=="undefined"){for(i<n&&(i=n);typeof e[i].offset=="undefined";)i++;e[n].offset=(e[i].offset-e[a].offset)/(i-a)*(n-a)+e[a].offset}else a=n;return e}function Xe({id:t,width:r,height:e},{image:o,size:a,position:i,repeat:n}){let s=n==="repeat-x"||n==="repeat",f=n==="repeat-y"||n==="repeat",p=ct(a,{x:r,y:e,defaultX:r,defaultY:e}),g=ct(i,{x:r,y:e,defaultX:0,defaultY:0});if(o.startsWith("linear-gradient(")){let u=Ye.parse(o)[0],m,h,d,c;if(u.orientation.type==="directional")[m,h,d,c]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[u.orientation.value];else if(u.orientation.type==="angular"){let x=+u.orientation.value/180*Math.PI-Math.PI/2,Y=Math.cos(x),L=Math.sin(x);m=0,h=0,d=Y,c=L,d<0&&(m-=d,d=0),c<0&&(h-=c,c=0)}let R=mt(r,u.colorStops);return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${m}" y1="${h}" x2="${d}" y2="${c}">${R.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(o.startsWith("radial-gradient(")){let u=Ye.parse(o)[0],m=u.orientation[0],[h,d]=p,c="circle",R=h/2,x=d/2;if(m.type==="shape"){if(c=m.value,m.at)if(m.at.type==="position")R=m.at.value.x.value,x=m.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+m.at.type)}else throw new Error("orientation.type not implemented: "+m.type);let Y=mt(r,u.colorStops),L=`satori_radial_${t}`,O=`satori_pattern_${t}`,F={},P=Math.max(Math.abs(h-R),Math.abs(R)),v=Math.max(Math.abs(d-x),Math.abs(x));if(c==="circle")F.r=Math.sqrt(P*P+v*v);else if(c==="ellipse"){let W=v!==0?P/v:1;F.ry=Math.sqrt(P*P+v*v*W*W)/W,F.rx=F.ry*W}let C=y("pattern",{id:O,x:g[0],y:g[1],width:s?h:"100%",height:f?d:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:L},Y.map(W=>y("stop",{offset:W.offset,"stop-color":W.color})).join(""))+y(c,te(D({cx:R,cy:x,width:h,height:d},F),{fill:`url(#${L})`})));return[O,C]}if(o.startsWith("url(")){let u=o.slice(4,-1);return[`satori_bi${t}`,y("pattern",{id:`satori_bi${t}`,patternContentUnits:"userSpaceOnUse",patternUnits:"userSpaceOnUse",x:g[0],y:g[1],width:s?p[0]:"100%",height:f?p[1]:"100%"},y("image",{x:0,y:0,width:p[0],height:p[1],href:u}))]}}function Re(t,r,e){return e<t+r&&(e/2<t&&e/2<r?t=r=e/2:e/2<t?t=e-r:e/2<r&&(r=e-t)),[t,r]}function me({left:t,top:r,width:e,height:o},a){let{borderTopLeftRadius:i,borderTopRightRadius:n,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return i=Math.min(i||0,e,o),n=Math.min(n||0,e,o),s=Math.min(s||0,e,o),f=Math.min(f||0,e,o),!i&&!n&&!s&&!f?"":([i,n]=Re(i,n,e),[i,s]=Re(i,s,o),[n,f]=Re(n,f,o),[s,f]=Re(s,f,e),`M${t+i},${r} h${e-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-e} a${s},${s} 0 0 1 ${-s},${-s} v${s+i-o} a${i},${i} 0 0 1 ${i},${-i}`)}function He({left:t,top:r,width:e,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:t,y:r,width:e,height:o,d:a})):y("clipPath",{id:`satori_cp-${i}`,"clip-path":n._inheritedClipPathId?`url(#${n._inheritedClipPathId})`:void 0},y("rect",{x:t,y:r,width:e,height:o}))}function Ue({id:t,left:r,top:e,width:o,height:a,isInheritingTransform:i,debug:n},s){if(s.display==="none")return"";let f="rect",p="transparent",g=0,u="",m="",h=[],d=1,c="";s.backgroundColor&&h.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,p=s.borderColor),s.opacity&&(d=+s.opacity),s.transform&&(u=re({left:r,top:e,width:o,height:a},s.transform,i,s.transformOrigin));let R="";if(s.backgroundImage){let v=s.backgroundImage.map((C,M)=>Xe({id:t+"_"+M,width:o,height:a},C)).filter(Boolean);for(let C of v)h.push(`url(#${C[0]})`),m+=C[1],C[2]&&(R+=C[2])}let x=me({left:r,top:e,width:o,height:a},s);x&&(f="path");let Y=He({left:r,top:e,width:o,height:a,path:x,id:t},s),L=s._inheritedClipPathId,O=ne({width:o,height:a,id:t},s);n&&(c=y("rect",{x:r,y:e,width:o,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:u||void 0,"clip-path":L?`url(#${L})`:void 0})),h.length||h.push("transparent");let{backgroundClip:F}=s,P=h.map((v,C)=>{if(v==="transparent"&&!(C===h.length-1&&g))return"";let M=C===h.length-1&&g&&F!=="text";return y(f,{x:r,y:e,width:o,height:a,fill:v,stroke:M?p:void 0,"stroke-width":M?g:void 0,d:x||void 0,transform:u||void 0,"clip-path":F==="text"?`url(#satori_bct-${t})`:L?`url(#${L})`:void 0})}).join("");return F==="text"&&g&&(P=y(f,{x:r,y:e,width:o,height:a,fill:"transparent",stroke:p,"stroke-width":g,d:x||void 0,transform:u||void 0,"clip-path":L?`url(#${L})`:void 0})+P),(m?`<defs>${m}</defs>`:"")+Y+(O?`${O}<g filter="url(#satori_s-${t})">`:"")+(d!==1?`<g opacity="${d}">`:"")+(R||P)+(d!==1?"</g>":"")+(O?"</g>":"")+c}function ze({id:t,left:r,top:e,width:o,height:a,src:i,debug:n,isInheritingTransform:s},f){if(f.display==="none")return"";let p="",g=1,u="",m=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",h=me({left:r,top:e,width:o,height:a},f),d=f._inheritedClipPathId;h&&(p=y("clipPath",{id:`satori_c-${t}`,"clip-path":d?`url(#${d})`:void 0},y("path",{x:r,y:e,width:o,height:a,d:h}))),f.opacity&&(g=+f.opacity);let c=ne({width:o,height:a,id:t},f);return f.transform&&(u=re({left:r,top:e,width:o,height:a},f.transform,s,f.transformOrigin)),c+(c?`<g filter="url(#satori_s-${t})">`:"")+p+y("image",{x:r,y:e,width:o,height:a,href:i,preserveAspectRatio:m,transform:u||void 0,"clip-path":p?`url(#satori_c-${t})`:d?`url(#${d})`:void 0})+(c?"</g>":"")}function*pe(t,r){let e=Q(),{id:o,inheritedStyle:a,parent:i,font:n,debug:s,embedFont:f=!0,graphemeImages:p}=r;if(t===null||typeof t=="undefined")return yield,"";if(!ke(t)||typeof t.type=="function"){let S;if(!ke(t))S=De(String(t),r);else{if(ot(t.type))throw new Error("Class component is not supported.");S=pe(t.type(t.props),r)}S.next();let $=yield;return S.next($).value}let{type:g,props:u}=t,{style:m,children:h}=u,d=e.Node.create();i.insertChild(d,i.getChildCount());let[c,R]=$e(d,g,a,m,u),x=c.transform===a.transform;if(x||(c.transform.__parent=a.transform),c.overflow==="hidden"&&(R._inheritedClipPathId=`satori_cp-${o}`),c.backgroundClip==="text"){let S={value:""};R._inheritedBackgroundClipTextPath=S,c._inheritedBackgroundClipTextPath=S}let Y=typeof h=="undefined"?[]:[].concat(h),L=[],O=0;for(let S of Y){let $=pe(S,{id:o+"-"+O++,parentStyle:c,inheritedStyle:R,isInheritingTransform:!0,parent:d,font:n,embedFont:f,debug:s,graphemeImages:p});$.next(),L.push($)}let[F,P]=yield;c.position==="absolute"&&d.calculateLayout();let{left:v,top:C,width:M,height:W}=d.getComputedLayout();v+=F,C+=P;let j="",G="",U="";g==="img"?G=ze({id:o,left:v,top:C,width:M,height:W,src:u.src,isInheritingTransform:x,debug:s},c):G=Ue({id:o,left:v,top:C,width:M,height:W,isInheritingTransform:x,debug:s},c);for(let S of L)j+=S.next([v,C]).value;return c._inheritedBackgroundClipTextPath&&(U+=y("clipPath",{id:`satori_bct-${o}`,"clip-path":c._inheritedClipPathId?`url(#${c._inheritedClipPathId})`:void 0},c._inheritedBackgroundClipTextPath.value)),U+G+j}import Xt from"@shuding/opentype.js";var Te=class{constructor(r){this.fonts=new Map;for(let e of r){let o=e.data,a=Xt.parse("buffer"in o?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o,{lowMemory:!0});this.defaultFont||(this.defaultFont=a),this.fonts.has(e.name)||this.fonts.set(e.name,[]),this.fonts.get(e.name).push([a,e.weight,e.style])}}get({name:r,weight:e,style:o}){if(!this.fonts.has(r))return this.defaultFont;e==="normal"&&(e=400),e==="bold"&&(e=700);let a=[...this.fonts.get(r)];return a.sort(([i,n,s],[f,p,g])=>{if(n!==p)return n?!p||n===e?-1:p===e?1:e===400&&n===500||e===500&&n===400?-1:e===400&&p===500||e===500&&p===400?1:e<400?n<e&&p<e?p-n:n<e?-1:p<e?1:n-p:e<n&&e<p?n-p:e<n?-1:e<p?1:p-n:1;if(s!==g){if(s===o)return-1;if(g===o)return 1}return-1}),a[0][0]}getFont({fontFamily:r,fontWeight:e=400,fontStyle:o="normal"}){return this.get({name:r,weight:e,style:o})}measure(r,e,{fontSize:o,letterSpacing:a=0}){return r.getAdvanceWidth(e,o,{letterSpacing:a/o})}getSVG(r,e,{fontSize:o,top:a,left:i,letterSpacing:n=0}){return r.getPath(e,i,a,o,{letterSpacing:n/o}).toPathData(1)}};function Ve({width:t,height:r,content:e}){return y("svg",{width:t,height:r,viewBox:`0 0 ${t} ${r}`,xmlns:"http://www.w3.org/2000/svg"},e)}var Je=new WeakMap;function pt(t,r){let e=Q();if(!e)throw new Error("Satori is not initialized.");let o;Je.has(r.fonts)?o=Je.get(r.fonts):Je.set(r.fonts,o=new Te(r.fonts));let a=e.Node.create();a.setWidth(r.width),a.setHeight(r.height),a.setFlexDirection(e.FLEX_DIRECTION_ROW),a.setFlexWrap(e.WRAP_WRAP),a.setAlignContent(e.ALIGN_AUTO),a.setAlignItems(e.ALIGN_FLEX_START),a.setJustifyContent(e.JUSTIFY_FLEX_START),a.setOverflow(e.OVERFLOW_HIDDEN);let i=pe(t,{id:"id",parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1,whiteSpace:"normal",_viewportWidth:r.width,_viewportHeight:r.height},parent:a,font:o,embedFont:r.embedFont,debug:r.debug,graphemeImages:r.graphemeImages});i.next(),a.calculateLayout(r.width,r.height,e.DIRECTION_LTR);let n=i.next([0,0]).value;return a.freeRecursive(),Ve({width:r.width,height:r.height,content:n})}export{pt as default,Tt as init};
var At=Object.defineProperty,kt=Object.defineProperties;var Ot=Object.getOwnPropertyDescriptors;var dt=Object.getOwnPropertySymbols;var $t=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable;var ct=(e,n,t)=>n in e?At(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,G=(e,n)=>{for(var t in n||(n={}))$t.call(n,t)&&ct(e,t,n[t]);if(dt)for(var t of dt(n))Ft.call(n,t)&&ct(e,t,n[t]);return e},se=(e,n)=>kt(e,Ot(n));import{guessLanguage as pn}from"guesslanguage";var pt={};var Pe;Pe=pt.default;function Pt(e){Pe=e}function te(){return Pe}import{LineBreaker as Wt}from"css-line-break";import{splitGraphemes as Nt}from"text-segmentation";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 q(e,n,t){let i=n[e];return typeof i=="undefined"?t:i}var gt=void 0,Ne=typeof Intl!="undefined"&&"Segmenter"in Intl&&process.env.NODE_ENV!=="test",Mt=Ne?new Intl.Segmenter(gt,{granularity:"word"}):null,Gt=Ne?new Intl.Segmenter(gt,{granularity:"grapheme"}):null,ye=[32,160,4961,65792,65793,4153,4241,10].map(e=>String.fromCodePoint(e)),Dt=e=>{let n=Wt(e,{lineBreak:"strict",wordBreak:"normal"}),t=[],i;for(;!(i=n.next()).done;)if(i.value){let a=i.value.slice(),r="";for(let o=0;o<a.length;o++){let s=a[o];ye.includes(s)?(r.length&&t.push(r),t.push(s),r=""):r+=s}r.length&&t.push(r)}return t};function le(e,n){return Ne?n==="word"?[...Mt.segment(e)].map(t=>t.segment):[...Gt.segment(e)].map(t=>t.segment):n==="word"?Dt(e):Nt(e)}function y(e,n,t){let i="";for(let[a,r]of Object.entries(n))typeof r!="undefined"&&(i+=` ${a}="${r}"`);return t?`<${e}${i}>${t}</${e}>`:`<${e}${i}/>`}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 xe=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Yt=xe((e,n)=>{n.exports=["em","ex","ch","rem","vh","vw","vmin","vmax","px","mm","cm","in","pt","pc","mozmm"]}),Ht=xe((e,n)=>{n.exports=["deg","grad","rad","turn"]}),Xt=xe((e,n)=>{n.exports=["dpi","dpcm","dppx"]}),Ut=xe((e,n)=>{n.exports=["Hz","kHz"]}),zt=xe((e,n)=>{n.exports=["s","ms"]}),Vt=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(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=qt(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 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 Jt=[].concat(bt,xt,Vt,yt,Et);function qt(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 Kt=Object.assign(Ce(bt,"angle"),Ce(xt,"frequency"),Ce(yt,"resolution"),Ce(Et,"time"));function Ce(e,n){return Object.fromEntries(e.map(t=>[t,n]))}function Zt(e){return Kt[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 i=en(e,n);return i.absolute?{[t?"xAbsolute":"yAbsolute"]:i.absolute}:i.relative?{[t?"xRelative":"yRelative"]:i.relative}:{}}}function Ye(e,n){if(typeof e=="number")return{xAbsolute:e};let t;try{t=Qt(e).nodes.filter(i=>i.type==="word").map(i=>i.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,i){return e==="border"&&!t.includes(n.borderColor)?n.borderColor=i:e==="textDecoration"&&!t.includes(n.textDecorationColor)&&(n.textDecorationColor=i),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:i}={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"&&i)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 r=tn(a);Object.assign(t,ln(r,e[a])||sn(r,nn(r,_t(r,e[a]),!0),e[a],e.color||n.color))}if(t.backgroundImage){let{backgrounds:a}=rn(t);t.backgroundImage=a}let i=t.fontSize||n.fontSize;if(typeof i=="string")try{let a=new fe(i);switch(a.unit){case"em":i=a.value*n.fontSize;break;case"rem":i=a.value*16;break}}catch{i=16}typeof t.fontSize!="undefined"&&(t.fontSize=i),t.transformOrigin&&(t.transformOrigin=Ye(t.transformOrigin,i));for(let a in t){let r=t[a];if(a==="lineHeight")typeof r=="string"&&(r=t[a]=He(r,i,n,{percentage:!0})/i);else if(typeof r=="string"){let o=He(r,i,n);typeof o!="undefined"&&(t[a]=o),r=t[a]}if(a==="opacity"&&(r=t[a]=r*n.opacity),a==="transform"){let o=[...St],s=r;for(let f of s){let h=Object.keys(f)[0],g=f[h],p=typeof g=="string"?He(g,i,n):g,l=[...St];switch(h){case"translateX":l[4]=p;break;case"translateY":l[5]=p;break;case"scale":l[0]=p,l[3]=p;break;case"scaleX":l[0]=p;break;case"scaleY":l[3]=p;break;case"rotate":let c=p*Math.PI/180,u=Math.cos(c),d=Math.sin(c);l[0]=u,l[1]=d,l[2]=-d,l[3]=u;break;case"skewX":l[2]=Math.tan(p*Math.PI/180);break;case"skewY":l[1]=Math.tan(p*Math.PI/180);break}o=ge(l,o)}t.transform=o}}return t}function Xe(e,n,t,i,a){let r=te(),o=G(G(G({},t),Ie(ht[n],t)),Ie(i,t));if(n==="img"){let s=parseInt(a.width),h=parseInt(a.height)/s;o.width||(o.width=s),o.height||(o.height=h*o.width)}return e.setDisplay(q(o.display,{flex:r.DISPLAY_FLEX,none:r.DISPLAY_NONE},r.DISPLAY_FLEX)),e.setAlignContent(q(o.alignContent,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,"space-between":r.ALIGN_SPACE_BETWEEN,"space-around":r.ALIGN_SPACE_AROUND,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_AUTO)),e.setAlignItems(q(o.alignItems,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_FLEX_START)),e.setAlignSelf(q(o.alignSelf,{stretch:r.ALIGN_STRETCH,center:r.ALIGN_CENTER,"flex-start":r.ALIGN_FLEX_START,"flex-end":r.ALIGN_FLEX_END,baseline:r.ALIGN_BASELINE,normal:r.ALIGN_AUTO},r.ALIGN_AUTO)),e.setJustifyContent(q(o.justifyContent,{center:r.JUSTIFY_CENTER,"flex-start":r.JUSTIFY_FLEX_START,"flex-end":r.JUSTIFY_FLEX_END,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND},r.JUSTIFY_FLEX_START)),e.setFlexDirection(q(o.flexDirection,{row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE},r.FLEX_DIRECTION_ROW)),e.setFlexWrap(q(o.flexWrap,{wrap:r.WRAP_WRAP,nowrap:r.WRAP_NO_WRAP,"wrap-reverse":r.WRAP_WRAP_REVERSE},r.WRAP_WRAP)),typeof o.flexBasis!="undefined"&&e.setFlexBasis(o.flexBasis),e.setFlexGrow(typeof o.flexGrow=="undefined"?0:o.flexGrow),e.setFlexShrink(typeof o.flexShrink=="undefined"?0:o.flexShrink),typeof o.maxHeight!="undefined"&&e.setMaxHeight(o.maxHeight),typeof o.maxWidth!="undefined"&&e.setMaxWidth(o.maxWidth),typeof o.minHeight!="undefined"&&e.setMinHeight(o.minHeight),typeof o.minWidth!="undefined"&&e.setMinWidth(o.minWidth),e.setOverflow(q(o.overflow,{visible:r.OVERFLOW_VISIBLE,hidden:r.OVERFLOW_HIDDEN},r.OVERFLOW_VISIBLE)),e.setMargin(r.EDGE_TOP,o.marginTop||0),e.setMargin(r.EDGE_BOTTOM,o.marginBottom||0),e.setMargin(r.EDGE_LEFT,o.marginLeft||0),e.setMargin(r.EDGE_RIGHT,o.marginRight||0),e.setBorder(r.EDGE_TOP,o.borderWidth||0),e.setBorder(r.EDGE_BOTTOM,o.borderWidth||0),e.setBorder(r.EDGE_LEFT,o.borderWidth||0),e.setBorder(r.EDGE_RIGHT,o.borderWidth||0),e.setPadding(r.EDGE_TOP,o.paddingTop||0),e.setPadding(r.EDGE_BOTTOM,o.paddingBottom||0),e.setPadding(r.EDGE_LEFT,o.paddingLeft||0),e.setPadding(r.EDGE_RIGHT,o.paddingRight||0),e.setPositionType(q(o.position,{absolute:r.POSITION_TYPE_ABSOLUTE,relative:r.POSITION_TYPE_RELATIVE},r.POSITION_TYPE_RELATIVE)),typeof o.top!="undefined"&&e.setPosition(r.EDGE_TOP,o.top),typeof o.bottom!="undefined"&&e.setPosition(r.EDGE_BOTTOM,o.bottom),typeof o.left!="undefined"&&e.setPosition(r.EDGE_LEFT,o.left),typeof o.right!="undefined"&&e.setPosition(r.EDGE_RIGHT,o.right),typeof o.height!="undefined"?e.setHeight(o.height):e.setHeightAuto(),typeof o.width!="undefined"?e.setWidth(o.width):e.setWidthAuto(),[o,Me(o)]}function ue({left:e,top:n,width:t,height:i},a,r,o){var f,h,g,p;let s;if(r)s=a;else{let l=(h=o==null?void 0:o.xAbsolute)!=null?h:((f=o==null?void 0:o.xRelative)!=null?f:50)*t/100,c=(p=o==null?void 0:o.yAbsolute)!=null?p:((g=o==null?void 0:o.yRelative)!=null?g:50)*i/100,u=e+l,d=n+c;s=ge([1,0,0,1,u,d],ge(a,[1,0,0,1,-u,-d])),a.__parent&&(s=ge(a.__parent,s)),a.splice(0,6,...s)}return`matrix(${s.map(l=>l.toFixed(2)).join(",")})`}function wt({left:e,top:n,width:t,height:i,isInheritingTransform:a},r){let o="",s=1;return r.transform&&(o=ue({left:e,top:n,width:t,height:i},r.transform,a,r.transformOrigin)),r.opacity&&(s=+r.opacity),{matrix:o,opacity:s}}function Ue({id:e,content:n,filter:t,left:i,top:a,width:r,height:o,matrix:s,opacity:f,image:h,clipPathId:g,debug:p,shape:l,decorationShape:c},u){let d="";if(p&&(d=y("rect",{x:i,y:a-o,width:r,height:o,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0})),h){let x={href:h,x:i,y:a,width:r,height:o,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:u.filter?`filter:${u.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+y("image",se(G({},x),{opacity:f!==1?f:void 0}))+(c||"")+(t?"</g>":"")+d,""]}let b={x:i,y:a,width:r,height:o,"font-weight":u.fontWeight,"font-style":u.fontStyle,"font-size":u.fontSize,"font-family":u.fontFamily,"letter-spacing":u.letterSpacing||void 0,transform:s||void 0,"clip-path":g?`url(#${g})`:void 0,style:u.filter?`filter:${u.filter}`:void 0};return[(t?`${t}<g filter="url(#satori_s-${e})">`:"")+y("text",se(G({},b),{fill:u.color,opacity:f!==1?f:void 0}),n)+(c||"")+(t?"</g>":"")+d,l?y("text",b,n):""]}function de({id:e,width:n,height:t},i){if(!i.shadowColor||!i.shadowOffset||typeof i.shadowRadius=="undefined")return"";let a=i.shadowRadius*i.shadowRadius/4,r=Math.min(i.shadowOffset.width-a,0),o=Math.max(i.shadowOffset.width+a+n,n),s=Math.min(i.shadowOffset.height-a,0),f=Math.max(i.shadowOffset.height+a+t,t);return`<defs><filter id="satori_s-${e}" x="${r/n*100}%" y="${s/t*100}%" width="${(o-r)/n*100}%" height="${(f-s)/t*100}%"><feDropShadow dx="${i.shadowOffset.width}" dy="${i.shadowOffset.height}" stdDeviation="${i.shadowRadius/2}" flood-color="${i.shadowColor}" flood-opacity="1"/></filter></defs>`}function ze({width:e,left:n,top:t,ascender:i,clipPathId:a},r){let{textDecorationColor:o,textDecorationStyle:s,textDecorationLine:f,fontSize:h}=r;if(!f||f==="none")return"";let g=Math.max(1,h*.1),p=f==="line-through"?t+i*.5:f==="underline"?t+i*1.1:t,l=s==="dashed"?`${g*1.2} ${g*2}`:s==="dotted"?`0 ${g*2}`:void 0;return y("line",{x1:n,y1:p,x2:n+e,y2:p,stroke:o,"stroke-width":g,"stroke-dasharray":l,"stroke-linecap":s==="dotted"?"round":"square","clip-path":a?`url(#${a})`:void 0})}var Ve=void 0;function*je(e,n){var lt;let t=te(),{parentStyle:i,inheritedStyle:a,parent:r,font:o,id:s,isInheritingTransform:f,debug:h,embedFont:g,graphemeImages:p,canLoadAdditionalAssets:l}=n;i.textTransform==="uppercase"?e=e.toLocaleUpperCase(Ve):i.textTransform==="lowercase"?e=e.toLocaleLowerCase(Ve):i.textTransform==="capitalize"&&(e=le(e,"word").map(C=>le(C,"grapheme").map((I,A)=>A===0?I.toLocaleUpperCase(Ve):I).join("")).join(""));let c=q(i.wordBreak,{normal:"word","break-all":"grapheme","break-word":"grapheme","keep-all":"word"},"word"),u=le(e,c),d=t.Node.create();d.setAlignItems(t.ALIGN_BASELINE),i.textAlign==="left"?d.setJustifyContent(t.JUSTIFY_FLEX_START):i.textAlign==="center"?d.setJustifyContent(t.JUSTIFY_CENTER):i.textAlign==="right"?d.setJustifyContent(t.JUSTIFY_FLEX_END):i.textAlign==="justify"&&d.setJustifyContent(t.JUSTIFY_SPACE_BETWEEN),r.insertChild(d,r.getChildCount());let{textAlign:b,textOverflow:x,whiteSpace:F,lineHeight:v,filter:N,_inheritedBackgroundClipTextPath:W}=i,M=i.fontSize,S=o.getEngine(M,v,i),H=l?u.filter(C=>!S.resolve(C)):[];yield H,H.length&&(S=o.getEngine(M,v,i));let _=[],T=[],X=[],K=[],Q=new Map,w=C=>{let I=0;for(let A of C){if(Q.has(A)){I+=Q.get(A);continue}let Y=S.measure(A,i);Q.set(A,Y),I+=Y}return I},$=0,R=[],m=0;for(let C of u){let I=!1,A=p&&p[C];F==="pre"?I=C[0]===`
`:F!=="nowrap"&&(A||ye.includes(C[0]))&&(I=!0),I?(F==="nowrap"?m+=w(R)+i.fontSize:($=Math.max($,w(R)),A&&($=Math.max($,i.fontSize))),R=[]):(!ye.includes(C[0])||!R.length)&&R.push(C===`
`?" ":C)}$=Math.max($,w(R)+m);let E=r.getMinWidth(),L=r.getMaxWidth(),Z=r.getWidth();isNaN(Z.value)&&(isNaN(E.value)||E.unit===1&&E.value>$)&&(isNaN(L.value)||L.unit===1&&($=Math.min($,L.value)),r.setMinWidth($)),typeof i.flexShrink=="undefined"&&r.setFlexShrink(1);let he=F==="pre-wrap"||F==="pre";d.setMeasureFunc(C=>{let I=0,A="",Y=0,U=0,z=0,V=-1,ie=0,P=0,oe=0;_=[],X=[0];for(let re=0;re<u.length;re++){let D=u[re];if(!he&&ye.includes(D[0]))A||(A=" "),Y=w([A]),K[re]=null;else{let ae=he&&D===`
`,j=ae?0:p&&p[D]?i.fontSize:w([D]);U||(A="",Y=0);let B=Y||",.!?:-@)>]}%#".indexOf(D[0])<0,J=!U||!!Y;if(ae||re&&B&&U+Y+j>C&&F!=="nowrap"&&F!=="pre")_.push(U),T.push(oe),I++,ie+=P,U=j,P=j?S.glyphHeight(D):0,oe=j?S.baseline(D):0,X.push(1),V=-1,ae||(z=Math.max(z,C));else{U+=Y+j;let me=S.glyphHeight(D);me>P&&(P=me,oe=S.baseline(D)),J&&X[X.length-1]++}A="",Y=0,J&&V++,z=Math.max(z,U),K[re]={y:ie,x:U-j,width:j,line:I,lineIndex:V}}}return U&&(I++,_.push(U),T.push(oe),ie+=P),{width:z,height:ie}});let[Lt,Ct]=yield,Oe="",_e="",ne=a._inheritedClipPathId,{left:rt,top:it,width:we,height:ot}=d.getComputedLayout(),$e=r.getComputedWidth()-r.getComputedPadding(t.EDGE_LEFT)-r.getComputedPadding(t.EDGE_RIGHT)-r.getComputedBorder(t.EDGE_LEFT)-r.getComputedBorder(t.EDGE_RIGHT),ce=Lt+rt,pe=Ct+it,{matrix:ee,opacity:Re}=wt({left:rt,top:it,width:we,height:ot,isInheritingTransform:f},i),be="";i.textShadowOffset&&(be=de({width:we,height:ot,id:s},{shadowColor:i.textShadowColor,shadowOffset:i.textShadowOffset,shadowRadius:i.textShadowRadius}));let ve="",Te="",at="",Fe=-1,st=x==="ellipsis"?w(["\u2026"]):0,It=x==="ellipsis"?w([" "]):0,Le={};for(let C=0;C<u.length;C++){if(!K[C])continue;let I=K[C],A=u[C],Y=null,U=p?p[A]:null,z=I.y,V=I.x,ie=I.width,P=I.line;if(P===Fe)continue;let oe=!1;if(_.length>1){let B=we-_[P];if(b==="right"||b==="end")V+=B;else if(b==="center")V+=B/2;else if(b==="justify"&&P<_.length-1){let J=X[P];V+=(J>1?B/(J-1):0)*I.lineIndex,oe=!0}}if(Le[P]||(Le[P]=[V,oe?we:_[P]]),x==="ellipsis"&&_[P]>$e&&I.x+ie+st+It>$e){let B=le(A,"grapheme"),J="",me=0;for(let ft of B){let ut=I.x+w([J+ft]);if(J&&ut+st>$e)break;J+=ft,me=ut}A=J+"\u2026",Fe=P,Le[P][1]=me}let re=T[P],D=S.baseline(A),ae=S.glyphHeight(A),j=re-D;if(U?z+=0:g?(Y=S.getSVG(A,se(G({},i),{left:ce+V,top:pe+z+D+j,letterSpacing:i.letterSpacing})),h&&(at+=y("rect",{x:ce+V,y:pe+z+j,width:I.width,height:ae,fill:"transparent",stroke:"#575eff","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0})+y("line",{x1:ce+V,x2:ce+V+I.width,y1:pe+z+j+D,y2:pe+z+j+D,stroke:"#14c000","stroke-width":1,transform:ee||void 0,"clip-path":ne?`url(#${ne})`:void 0}))):z+=D+j,i.textDecorationLine&&(P!==((lt=K[C+1])==null?void 0:lt.line)||Fe===P)){let B=Le[P];B&&!B[2]&&(ve+=ze({left:ce+B[0],top:pe+ae*+P,width:B[1],ascender:S.baseline(A),clipPathId:ne},i),B[2]=1)}if(Y!==null)Te+=Y+" ";else{let[B,J]=Ue({content:A,filter:be,id:s,left:ce+V,top:pe+z,width:ie,height:ae,matrix:ee,opacity:Re,image:U,clipPathId:ne,debug:h,shape:!!W,decorationShape:ve},i);Oe+=B,_e+=J,ve=""}}if(Te){let C=i.color!=="transparent"&&Re!==0?y("path",{fill:i.color,d:Te,transform:ee||void 0,opacity:Re!==1?Re:void 0,"clip-path":ne?`url(#${ne})`:void 0,style:N?`filter:${N}`:void 0}):"";W&&(_e=y("path",{d:Te,transform:ee||void 0})),Oe+=(be?`${be}<g filter="url(#satori_s-${s})">`:"")+C+ve+(be?"</g>":"")+at}return _e&&(i._inheritedBackgroundClipTextPath.value+=_e),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(m){var E=new Error(n+": "+m);throw E.source=n,E}function i(){var m=a();return n.length>0&&t("Invalid input not EOF"),m}function a(){return v(r)}function r(){return o("linear-gradient",e.linearGradient,f)||o("repeating-linear-gradient",e.repeatingLinearGradient,f)||o("radial-gradient",e.radialGradient,p)||o("repeating-radial-gradient",e.repeatingRadialGradient,p)}function o(m,E,L){return s(E,function(Z){var he=L();return he&&($(e.comma)||t("Missing comma before color stops")),{type:m,orientation:he,colorStops:v(N)}})}function s(m,E){var L=$(m);if(L){$(e.startCall)||t("Missing (");var Z=E(L);return $(e.endCall)||t("Missing )"),Z}}function f(){return h()||g()}function h(){return w("directional",e.sideOrCorner,1)}function g(){return w("angular",e.angleValue,1)}function p(){var m,E=l(),L;return E&&(m=[],m.push(E),L=n,$(e.comma)&&(E=l(),E?m.push(E):n=L)),m}function l(){var m=c()||u();if(m)m.at=b();else{var E=d();if(E){m=E;var L=b();L&&(m.at=L)}else{var Z=x();Z&&(m={type:"default-radial",at:Z})}}return m}function c(){var m=w("shape",/^(circle)/i,0);return m&&(m.style=Q()||d()),m}function u(){var m=w("shape",/^(ellipse)/i,0);return m&&(m.style=X()||d()),m}function d(){return w("extent-keyword",e.extentKeywords,1)}function b(){if(w("position",/^at/,0)){var m=x();return m||t("Missing positioning value"),m}}function x(){var m=F();if(m.x||m.y)return{type:"position",value:m}}function F(){return{x:X(),y:X()}}function v(m){var E=m(),L=[];if(E)for(L.push(E);$(e.comma);)E=m(),E?L.push(E):t("One extra comma");return L}function N(){var m=W();return m||t("Expected color definition"),m.length=X(),m}function W(){return S()||_()||H()||M()}function M(){return w("literal",e.literalColor,0)}function S(){return w("hex",e.hexColor,1)}function H(){return s(e.rgbColor,function(){return{type:"rgb",value:v(T)}})}function _(){return s(e.rgbaColor,function(){return{type:"rgba",value:v(T)}})}function T(){return $(e.number)[1]}function X(){return w("%",e.percentageValue,1)||K()||Q()}function K(){return w("position-keyword",e.positionKeywords,1)}function Q(){return w("px",e.pixelValue,1)||w("em",e.emValue,1)}function w(m,E,L){var Z=$(E);if(Z)return{type:m,value:Z[L]}}function $(m){var E,L;return L=/^[\n\r\t\s]+/.exec(n),L&&R(L[0].length),E=m.exec(n),E&&R(E[0].length),E}function R(m){n=n.substr(m)}return function(m){return n=m.toString(),i()}}();var qe=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 Rt(e,{x:n,y:t,defaultX:i,defaultY:a}){return(e?e.split(" ").map(r=>{try{let o=new fe(r);return o.type==="length"||o.type==="number"?o.value:o.value+o.unit}catch{return null}}).filter(r=>r!==null):[i,a]).map((r,o)=>un(r,[n,t][o]))}function vt(e,n){let t=[];for(let o of n){let s=fn(o);if(!t.length&&(t.push({offset:0,color:s}),typeof o.length=="undefined"||o.length.value==="0"))continue;let f=typeof o.length=="undefined"?void 0:o.length.type==="%"?o.length.value/100:o.length.value/e;t.push({offset:f,color:s})}t.length||t.push({offset:0,color:"transparent"});let i=t[t.length-1];i.offset!==1&&(typeof i.offset=="undefined"?i.offset=1:t.push({offset:1,color:i.color}));let a=0,r=1;for(let o=0;o<t.length;o++)if(typeof t[o].offset=="undefined"){for(r<o&&(r=o);typeof t[r].offset=="undefined";)r++;t[o].offset=(t[r].offset-t[a].offset)/(r-a)*(o-a)+t[a].offset}else a=o;return t}function Ke({id:e,width:n,height:t},{image:i,size:a,position:r,repeat:o}){o=o||"repeat";let s=o==="repeat-x"||o==="repeat",f=o==="repeat-y"||o==="repeat",h=Rt(a,{x:n,y:t,defaultX:n,defaultY:t}),g=Rt(r,{x:n,y:t,defaultX:0,defaultY:0});if(i.startsWith("linear-gradient(")){let p=qe.parse(i)[0],l,c,u,d;if(p.orientation.type==="directional")[l,c,u,d]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[p.orientation.value];else if(p.orientation.type==="angular"){let x=+p.orientation.value/180*Math.PI-Math.PI/2,F=Math.cos(x),v=Math.sin(x);l=0,c=0,u=F,d=v,u<0&&(l-=u,u=0),d<0&&(c-=d,d=0)}let b=vt(n,p.colorStops);return[`satori_bi${e}`,`<linearGradient id="satori_bi${e}" x1="${l}" y1="${c}" x2="${u}" y2="${d}">${b.map(x=>`<stop offset="${x.offset*100}%" stop-color="${x.color}"/>`).join("")}</linearGradient>`]}if(i.startsWith("radial-gradient(")){let p=qe.parse(i)[0],l=p.orientation[0],[c,u]=h,d="circle",b=c/2,x=u/2;if(l.type==="shape"){if(d=l.value,l.at)if(l.at.type==="position")b=l.at.value.x.value,x=l.at.value.y.value;else throw new Error("orientation.at.type not implemented: "+l.at.type)}else throw new Error("orientation.type not implemented: "+l.type);let F=vt(n,p.colorStops),v=`satori_radial_${e}`,N=`satori_pattern_${e}`,W={},M=Math.max(Math.abs(c-b),Math.abs(b)),S=Math.max(Math.abs(u-x),Math.abs(x));if(d==="circle")W.r=Math.sqrt(M*M+S*S);else if(d==="ellipse"){let T=S!==0?M/S:1;W.ry=Math.sqrt(M*M+S*S*T*T)/T,W.rx=W.ry*T}let H=y("pattern",{id:N,x:g[0],y:g[1],width:s?c:"100%",height:f?u:"100%",patternUnits:"userSpaceOnUse"},y("radialGradient",{id:v},F.map(T=>y("stop",{offset:T.offset,"stop-color":T.color})).join(""))+y(d,se(G({cx:b,cy:x,width:c,height:u},W),{fill:`url(#${v})`})));return[N,H]}if(i.startsWith("url(")){let p=i.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?h[0]:"100%",height:f?h[1]:"100%"},y("image",{x:0,y:0,width:h[0],height:h[1],href:p}))]}}function Ae(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 Ee({left:e,top:n,width:t,height:i},a){let{borderTopLeftRadius:r,borderTopRightRadius:o,borderBottomLeftRadius:s,borderBottomRightRadius:f}=a;return r=Math.min(r||0,t,i),o=Math.min(o||0,t,i),s=Math.min(s||0,t,i),f=Math.min(f||0,t,i),!r&&!o&&!s&&!f?"":([r,o]=Ae(r,o,t),[r,s]=Ae(r,s,i),[o,f]=Ae(o,f,i),[s,f]=Ae(s,f,t),`M${e+r},${n} h${t-r-o} a${o},${o} 0 0 1 ${o},${o} v${i-o-f} a${f},${f} 0 0 1 ${-f},${f} h${f+s-t} a${s},${s} 0 0 1 ${-s},${-s} v${s+r-i} a${r},${r} 0 0 1 ${r},${-r}`)}function Ze({left:e,top:n,width:t,height:i,path:a,id:r},o){return o.overflow!=="hidden"?"":a?y("clipPath",{id:`satori_cp-${r}`,"clip-path":o._inheritedClipPathId?`url(#${o._inheritedClipPathId})`:void 0},y("path",{x:e,y:n,width:t,height:i,d:a})):y("clipPath",{id:`satori_cp-${r}`,"clip-path":o._inheritedClipPathId?`url(#${o._inheritedClipPathId})`:void 0},y("rect",{x:e,y:n,width:t,height:i}))}function Qe({id:e,left:n,top:t,width:i,height:a,isInheritingTransform:r,debug:o},s){if(s.display==="none")return"";let f="rect",h="transparent",g=0,p="",l="",c=[],u=1,d="";s.backgroundColor&&c.push(s.backgroundColor),s.borderWidth&&(g=s.borderWidth,h=s.borderColor),s.opacity&&(u=+s.opacity),s.transform&&(p=ue({left:n,top:t,width:i,height:a},s.transform,r,s.transformOrigin));let b="";if(s.backgroundImage){let H=s.backgroundImage.map((_,T)=>Ke({id:e+"_"+T,width:i,height:a},_)).filter(Boolean);for(let _ of H)c.push(`url(#${_[0]})`),l+=_[1],_[2]&&(b+=_[2])}let x=Ee({left:n,top:t,width:i,height:a},s);x&&(f="path");let F=Ze({left:n,top:t,width:i,height:a,path:x,id:e},s),v=s._inheritedClipPathId,N=de({width:i,height:a,id:e},s);o&&(d=y("rect",{x:n,y:t,width:i,height:a,fill:"transparent",stroke:"#ff5757","stroke-width":1,transform:p||void 0,"clip-path":v?`url(#${v})`:void 0})),c.length||c.push("transparent");let{backgroundClip:W,filter:M}=s,S=c.map((H,_)=>{if(H==="transparent"&&!(_===c.length-1&&g))return"";let T=_===c.length-1&&g&&W!=="text";return y(f,{x:n,y:t,width:i,height:a,fill:H,stroke:T?h:void 0,"stroke-width":T?g:void 0,d:x||void 0,transform:p||void 0,"clip-path":W==="text"?`url(#satori_bct-${e})`:v?`url(#${v})`:void 0,style:M?`filter:${M}`:void 0})}).join("");return W==="text"&&g&&(S=y(f,{x:n,y:t,width:i,height:a,fill:"transparent",stroke:h,"stroke-width":g,d:x||void 0,transform:p||void 0,"clip-path":v?`url(#${v})`:void 0})+S),(l?`<defs>${l}</defs>`:"")+F+(N?`${N}<g filter="url(#satori_s-${e})">`:"")+(u!==1?`<g opacity="${u}">`:"")+(b||S)+(u!==1?"</g>":"")+(N?"</g>":"")+d}function et({id:e,left:n,top:t,width:i,height:a,src:r,debug:o,isInheritingTransform:s},f){if(f.display==="none")return"";let h="",g=1,p="",l=f.objectFit==="contain"?"xMidYMid":f.objectFit==="cover"?"xMidYMid slice":"none",c=Ee({left:n,top:t,width:i,height:a},f),u=f._inheritedClipPathId;c&&(h=y("clipPath",{id:`satori_c-${e}`,"clip-path":u?`url(#${u})`:void 0},y("path",{x:n,y:t,width:i,height:a,d:c}))),f.opacity&&(g=+f.opacity);let d=de({width:i,height:a,id:e},f);return f.transform&&(p=ue({left:n,top:t,width:i,height:a},f.transform,s,f.transformOrigin)),d+(d?`<g filter="url(#satori_s-${e})">`:"")+h+y("image",{x:n,y:t,width:i,height:a,href:r,preserveAspectRatio:l,transform:p||void 0,"clip-path":h?`url(#satori_c-${e})`:u?`url(#${u})`:void 0})+(d?"</g>":"")}function*Se(e,n){let t=te(),{id:i,inheritedStyle:a,parent:r,font:o,debug:s,embedFont:f=!0,graphemeImages:h,canLoadAdditionalAssets:g}=n;if(e===null||typeof e=="undefined")return yield,yield,"";if(!We(e)||typeof e.type=="function"){let R;if(!We(e))R=je(String(e),n),yield R.next().value;else{if(mt(e.type))throw new Error("Class component is not supported.");R=Se(e.type(e.props),n),yield R.next().value}R.next();let m=yield;return R.next(m).value}let{type:p,props:l}=e,{style:c,children:u}=l,d=t.Node.create();r.insertChild(d,r.getChildCount());let[b,x]=Xe(d,p,a,c,l),F=b.transform===a.transform;if(F||(b.transform.__parent=a.transform),b.overflow==="hidden"&&(x._inheritedClipPathId=`satori_cp-${i}`),b.backgroundClip==="text"){let R={value:""};x._inheritedBackgroundClipTextPath=R,b._inheritedBackgroundClipTextPath=R}let v=typeof u=="undefined"?[]:[].concat(u),N=[],W=0,M=[];for(let R of v){let m=Se(R,{id:i+"-"+W++,parentStyle:b,inheritedStyle:x,isInheritingTransform:!0,parent:d,font:o,embedFont:f,debug:s,graphemeImages:h,canLoadAdditionalAssets:g});M.push(...m.next().value),N.push(m)}yield M;for(let R of N)R.next();let[S,H]=yield;b.position==="absolute"&&d.calculateLayout();let{left:_,top:T,width:X,height:K}=d.getComputedLayout();_+=S,T+=H;let Q="",w="",$="";p==="img"?w=et({id:i,left:_,top:T,width:X,height:K,src:l.src,isInheritingTransform:F,debug:s},b):w=Qe({id:i,left:_,top:T,width:X,height:K,isInheritingTransform:F,debug:s},b);for(let R of N)Q+=R.next([_,T]).value;return b._inheritedBackgroundClipTextPath&&($+=y("clipPath",{id:`satori_bct-${i}`,"clip-path":b._inheritedClipPathId?`url(#${b._inheritedClipPathId})`:void 0},b._inheritedBackgroundClipTextPath.value)),$+w+Q}import dn from"@shuding/opentype.js";function cn(e,n,[t,i],[a,r]){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(i!==r){if(i===n)return-1;if(r===n)return 1}return-1}var ke=class{constructor(n){this.fonts=new Map;this.addFonts(n)}get({name:n,weight:t,style:i}){if(!this.fonts.has(n))return null;t==="normal"&&(t=400),t==="bold"&&(t=700);let a=[...this.fonts.get(n)],r=a[0];for(let o=1;o<a.length;o++){let[,s,f]=r,[,h,g]=a[o];cn(t,i,[s,f],[h,g])>0&&(r=a[o])}return r[0]}addFonts(n){for(let t of n){let i=t.data,a=dn.parse("buffer"in i?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i,{lowMemory:!0});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:i,fontWeight:a=400,fontStyle:r="normal"}){i=Array.isArray(i)?i:[i];let o=i.map(l=>this.get({name:l,weight:a,style:r})).filter(Boolean);for(let l of this.fonts.keys())i.includes(l)||o.push(this.get({name:l,weight:a,style:r}));let s=new Map,f=(l,c=!0)=>{let u=l.charCodeAt(0);if(s.has(u))return s.get(u);let d=o.find((b,x)=>!!b.charToGlyphIndex(l)||c&&x===o.length-1);return d&&s.set(u,d),d},h=(l,c=!1)=>{var d,b;return((c?(b=(d=l.tables)==null?void 0:d.os2)==null?void 0:b.sTypoAscender:0)||l.ascender)/l.unitsPerEm*n},g=(l,c=!1)=>{var d,b;return((c?(b=(d=l.tables)==null?void 0:d.os2)==null?void 0:b.sTypoDescender:0)||l.descender)/l.unitsPerEm*n},p={resolve:l=>f(l,!1),baseline:(l,c=typeof l=="undefined"?o[0]:f(l))=>{let u=h(c,!0),d=g(c,!0),b=u-d,x=p.glyphHeight(l,c),F=(x-b)/2,{yMax:v,yMin:N}=c.tables.head,W=v/(v-N);return F+W*x},glyphHeight:(l,c=typeof l=="undefined"?o[0]:f(l))=>(h(c)-g(c))*t/1.2,measure:(l,c)=>{let u=f(l);return this.measure(u,l,c)},getSVG:(l,c)=>{let u=f(l);return this.getSVG(u,l,c)}};return p}measure(n,t,{fontSize:i,letterSpacing:a=0}){return n.getAdvanceWidth(t,i,{letterSpacing:a/i})}getSVG(n,t,{fontSize:i,top:a,left:r,letterSpacing:o=0}){return n.getPath(t,r,a,i,{letterSpacing:o/i}).toPathData(1)}};function tt({width:e,height:n,content:t}){return y("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,xmlns:"http://www.w3.org/2000/svg"},t)}var nt=new WeakMap;async function Tt(e,n){let t=te();if(!t)throw new Error("Satori is not initialized.");let i;nt.has(n.fonts)?i=nt.get(n.fonts):nt.set(n.fonts,i=new ke(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 r=G({},n.graphemeImages),o=Se(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:i,embedFont:n.embedFont,debug:n.debug,graphemeImages:r,canLoadAdditionalAssets:!!n.loadAdditionalAsset}),s=o.next().value;if(n.loadAdditionalAsset&&s.length){s=[...new Set(le(s.join(""),"grapheme"))];let h={};s.forEach(l=>pn.detect(l,c=>{h[c]=h[c]||[],c==="unknown"?h[c].push(l):h[c][0]=(h[c][0]||"")+l}));let g=[],p={};await Promise.all(Object.entries(h).flatMap(([l,c])=>c.map(u=>n.loadAdditionalAsset(l,u).then(d=>{typeof d=="string"?p[u]=d:d&&g.push(d)})))),i.addFonts(g),Object.assign(r,p)}o.next(),a.calculateLayout(n.width,n.height,t.DIRECTION_LTR);let f=o.next([0,0]).value;return a.freeRecursive(),tt({width:n.width,height:n.height,content:f})}export{Tt as default,Pt as init};
//# sourceMappingURL=index.wasm.js.map

@@ -27,6 +27,7 @@ import { ReactNode } from 'react';

graphemeImages?: Record<string, string>;
loadAdditionalAsset?: (code: string, segment: string) => Promise<FontOptions | string | undefined>;
}
declare function satori(element: ReactNode, options: SatoriOptions): string;
declare function satori(element: ReactNode, options: SatoriOptions): Promise<string>;
export { SatoriOptions, satori as default, init };
{
"name": "satori",
"version": "0.0.18",
"version": "0.0.19",
"description": "Satori converts HTML JSX to SVG string.",

@@ -37,3 +37,2 @@ "module": "./dist/esm/index.js",

"author": "Shu Ding <g@shud.in>",
"license": "MIT",
"bugs": {

@@ -59,3 +58,3 @@ "url": "https://github.com/vercel/satori/issues"

"css-to-react-native": "^3.0.0",
"parse-css-dimension": "^1.1.0",
"guesslanguage": "^0.2.0",
"postcss-value-parser": "^4.2.0",

@@ -62,0 +61,0 @@ "text-segmentation": "^1.0.3",

@@ -12,3 +12,3 @@ <h1 align="center">

satori(
const svg = await satori(
<div style={{ color: 'black' }}>hello, world</div>,

@@ -59,3 +59,3 @@ {

```js
satori(
await satori(
{

@@ -87,3 +87,3 @@ type: 'div',

```jsx
satori(
await satori(
<img src="https://picsum.photos/200/300" width={200} height={300} />,

@@ -98,20 +98,2 @@ options

#### Emojis
To render custom images for specific graphemes, you can use `graphemeImages` option to map the grapheme to an image source:
```jsx
satori(
<div>Next.js is 🤯!</div>,
{
...,
graphemeImages: {
'🤯': 'https://twemoji.maxcdn.com/v/13.1.0/svg/1f92f.svg',
},
}
)
```
The image will be resized to the current font-size (both width and height), so it must be a square.
### CSS Properties

@@ -138,3 +120,3 @@

| `justify-content` | Supported |
| `font-family` | Support single value |
| `font-family` | Supported |
| `font-size` | Supported |

@@ -166,2 +148,3 @@ | `font-weight` | Supported |

| `background-repeat` | Supported |
| `filter` | Supported |

@@ -176,2 +159,47 @@ Note:

### Typography
Advanced typography features such as kerning, ligatures and other OpenType features are not currently supported.
RTL languages are not supported either.
#### Emojis
To render custom images for specific graphemes, you can use `graphemeImages` option to map the grapheme to an image source:
```jsx
await satori(
<div>Next.js is 🤯!</div>,
{
...,
graphemeImages: {
'🤯': 'https://twemoji.maxcdn.com/v/13.1.0/svg/1f92f.svg',
},
}
)
```
The image will be resized to the current font-size (both width and height), so it must be a square.
#### Dynamically Load Emojis and Fonts
Satori supports an option to dynamically load emoji images (grapheme pictures) and fonts when they're used but missing:
```jsx
await satori(
<div>👋 你好</div>,
{
// `code` will be the detected language code, or `unknwon` if not able to tell.
// `segment` will be the content to render.
loadAdditionalAsset: async (code: string, segment: string) => {
// if segment is an emoji
return `data:image/svg+xml;base64,...`
// if segment is normal text
return loadFontFromSystem(code)
}
}
)
```
## Contribute

@@ -178,0 +206,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc