Comparing version 0.0.3 to 0.0.4
@@ -1,1 +0,1 @@ | ||
var at=Object.defineProperty,st=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var K=(t,n,e)=>n in t?at(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,I=(t,n)=>{for(var e in n||(n={}))ut.call(n,e)&&K(t,e,n[e]);if(q)for(var e of q(n))lt.call(n,e)&&K(t,e,n[e]);return t},Q=(t,n)=>st(t,ft(n));import v from"yoga-layout-prebuilt";import _t from"yoga-layout-prebuilt";function D(t){let n=typeof t;return!(n==="number"||n==="bigint"||n==="string"||n==="boolean")}function Z(t){return/^class\s/.test(Function.prototype.toString.call(t))}function L(t,n){return[t[0]*n[0]+t[2]*n[1],t[1]*n[0]+t[3]*n[1],t[0]*n[2]+t[2]*n[3],t[1]*n[2]+t[3]*n[3],t[0]*n[4]+t[2]*n[5]+t[4],t[1]*n[4]+t[3]*n[5]+t[5]]}import a from"yoga-layout-prebuilt";var tt={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 ct=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","textAlign","textTransform","whiteSpace","letterSpacing","transform","opacity"]);function M(t){let n={};for(let e in t)ct.has(e)&&(n[e]=t[e]);return n}import mt,{getPropertyName as pt}from"css-to-react-native";import nt from"parse-css-dimension";import{parseElementStyle as dt}from"css-background-parser";var gt=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),et=[1,0,0,1,0,0];function ht(t,n){return typeof n=="number"?gt.has(t)?String(n):n+"px":n}function rt(t,n){if(typeof t=="number")return t;try{let e=new nt(t);if(e.type==="length")switch(e.unit){case"em":return e.value*n;case"rem":return e.value*16;default:return e.value}else if(e.type==="angle")switch(e.unit){case"deg":return e.value;case"rad":return e.value*180/Math.PI;default:return e.value}}catch{}}function G(t,n){let e=[];for(let r in t){let i=pt(r);e.push([i,ht(i,t[r])])}let o=mt(e);if(o.backgroundImage){let{backgrounds:r}=dt(o);o.backgroundImage=r}let s=o.fontSize||n.fontSize;if(typeof s=="string")try{let r=new nt(s);switch(r.unit){case"em":s=r.value*n.fontSize;break;case"rem":s=r.value*16;break}}catch{s=16}o.fontSize=s;for(let r in o){let i=o[r];if(typeof i=="string"){let f=rt(i,s);typeof f!="undefined"&&(o[r]=f),i=o[r]}if(r==="opacity"&&(i=o[r]=i*n.opacity),r==="transform"){let f=[...et],c=i;for(let l of c){let d=Object.keys(l)[0],p=l[d],m=typeof p=="string"?rt(p,s):p,u=[...et];switch(d){case"translateX":u[4]=m;break;case"translateY":u[5]=m;break;case"scaleX":u[0]=m;break;case"scaleY":u[3]=m;break;case"rotate":let g=m*Math.PI/180,h=Math.cos(g),E=Math.sin(g);u[0]=h,u[1]=E,u[2]=-E,u[3]=h;break;case"skewX":u[2]=Math.tan(m*Math.PI/180);break;case"skewY":u[1]=Math.tan(m*Math.PI/180);break}f=L(f,u)}o.transform=f}}return o}function x(t,n,e){let o=n[t];return typeof o=="undefined"?e:o}function w(t,n,e,o,s){let r=I(I(I({},e),G(tt[n],e)),G(o,e));if(n==="img"){let i=parseInt(s.width),c=parseInt(s.height)/i;r.width||(r.width=i),r.height||(r.height=c*r.width)}return t.setDisplay(x(r.display,{flex:a.DISPLAY_FLEX,none:a.DISPLAY_NONE},a.DISPLAY_FLEX)),t.setAlignContent(x(r.alignContent,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,"space-between":a.ALIGN_SPACE_BETWEEN,"space-around":a.ALIGN_SPACE_AROUND,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_AUTO)),t.setAlignItems(x(r.alignItems,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_FLEX_START)),t.setAlignSelf(x(r.alignSelf,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_AUTO)),t.setJustifyContent(x(r.justifyContent,{center:a.JUSTIFY_CENTER,"flex-start":a.JUSTIFY_FLEX_START,"flex-end":a.JUSTIFY_FLEX_END,"space-between":a.JUSTIFY_SPACE_BETWEEN,"space-around":a.JUSTIFY_SPACE_AROUND},a.JUSTIFY_FLEX_START)),typeof r.flexBasis!="undefined"?t.setFlexBasis(r.flexBasis):r.display==="block"&&(typeof r.width=="undefined"||r.width==="auto")&&(typeof r.maxWidth=="undefined"||r.maxWidth==="auto")&&t.setFlexBasisPercent(100),t.setFlexDirection(x(r.flexDirection,{row:a.FLEX_DIRECTION_ROW,column:a.FLEX_DIRECTION_COLUMN,"row-reverse":a.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":a.FLEX_DIRECTION_COLUMN_REVERSE},a.FLEX_DIRECTION_ROW)),t.setFlexGrow(r.flexGrow||0),t.setFlexShrink(r.flexShrink||1),t.setFlexWrap(x(r.flexWrap,{wrap:a.WRAP_WRAP,nowrap:a.WRAP_NO_WRAP,"wrap-reverse":a.WRAP_WRAP_REVERSE},a.WRAP_WRAP)),typeof r.maxHeight!="undefined"&&t.setMaxHeight(r.maxHeight),typeof r.maxWidth!="undefined"&&t.setMaxWidth(r.maxWidth),typeof r.minHeight!="undefined"&&t.setMinHeight(r.minHeight),typeof r.minWidth!="undefined"&&t.setMinWidth(r.minWidth),t.setOverflow(x(r.overflow,{visible:a.OVERFLOW_VISIBLE,hidden:a.OVERFLOW_HIDDEN},a.OVERFLOW_VISIBLE)),t.setMargin(a.EDGE_TOP,r.marginTop||0),t.setMargin(a.EDGE_BOTTOM,r.marginBottom||0),t.setMargin(a.EDGE_LEFT,r.marginLeft||0),t.setMargin(a.EDGE_RIGHT,r.marginRight||0),t.setBorder(a.EDGE_TOP,r.borderWidth||0),t.setBorder(a.EDGE_BOTTOM,r.borderWidth||0),t.setBorder(a.EDGE_LEFT,r.borderWidth||0),t.setBorder(a.EDGE_RIGHT,r.borderWidth||0),t.setPadding(a.EDGE_TOP,r.paddingTop||0),t.setPadding(a.EDGE_BOTTOM,r.paddingBottom||0),t.setPadding(a.EDGE_LEFT,r.paddingLeft||0),t.setPadding(a.EDGE_RIGHT,r.paddingRight||0),t.setPositionType((r.position,a.POSITION_TYPE_ABSOLUTE,a.POSITION_TYPE_RELATIVE,a.POSITION_TYPE_RELATIVE)),typeof r.top!="undefined"&&t.setPosition(a.EDGE_TOP,r.top),typeof r.bottom!="undefined"&&t.setPosition(a.EDGE_BOTTOM,r.bottom),typeof r.left!="undefined"&&t.setPosition(a.EDGE_LEFT,r.left),typeof r.right!="undefined"&&t.setPosition(a.EDGE_RIGHT,r.right),typeof r.height!="undefined"?t.setHeight(r.height):t.setHeightAuto(),typeof r.width!="undefined"?t.setWidth(r.width):t.setWidthAuto(),[r,M(r)]}import T from"yoga-layout-prebuilt";import{LineBreaker as bt}from"css-line-break";function N({left:t,top:n,width:e,height:o},s,r){let i;if(r)i=s;else{let f=t+e/2,c=n+o/2;i=L([1,0,0,1,f,c],L(s,[1,0,0,1,-f,-c])),s.__parent&&(i=L(s.__parent,i)),s.splice(0,6,...i)}return`matrix(${i.join(",")})`}function Y({left:t,top:n,width:e,height:o,content:s,isInheritingTransform:r,path:i},f){let c="",l=1;return f.transform&&(c=N({left:t,top:n,width:e,height:o},f.transform,r)),f.opacity&&(l=+f.opacity),`<path x="${t}" y="${n+o}" width="${e}" height="${o}" fill="${f.color}" ${c?`transform="${c}"`:""} ${l!==1?`opacity="${l}"`:""} d="${i}"></path>`}function*X(t,n){let{parentStyle:e,parent:o,font:s,id:r,isInheritingTransform:i}=n,f=bt(t,{lineBreak:"strict",wordBreak:"normal"}),c=[];for(let u;!(u=f.next()).done;)c.push(u.value.slice());let l=[];o.setAlignItems(T.ALIGN_BASELINE),e.textAlign==="left"?o.setJustifyContent(T.JUSTIFY_FLEX_START):e.textAlign==="center"?o.setJustifyContent(T.JUSTIFY_CENTER):e.textAlign==="right"?o.setJustifyContent(T.JUSTIFY_FLEX_END):e.textAlign==="justify"&&o.setJustifyContent(T.JUSTIFY_SPACE_BETWEEN);for(let u of c){let g=T.Node.create();o.insertChild(g,o.getChildCount());let h=s.measure(u,e),E=(e.letterSpacing||0)*u.length;g.setWidth(h.width+E),g.setHeight(h.ascent*1.2),g.setMargin(T.EDGE_BOTTOM,h.descent*1.2),l.push([g,u])}let[d,p]=yield,m="";for(let u=0;u<l.length;u++){let[g,h]=l[u];e.position==="absolute"&&g.calculateLayout();let{left:E,top:_,width:A,height:S}=g.getComputedLayout();E+=d,_+=p;let $=s.getSVG(h,Q(I({},e),{top:_,left:E,letterSpacing:e.letterSpacing}));m+=Y({id:r,left:E,top:_,width:A,height:S,content:c[u],isInheritingTransform:i,path:$},e)}return m}import yt from"gradient-parser";function Et(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 H({id:t,width:n},{image:e}){if(e.startsWith("linear-gradient(")){let o=yt.parse(e)[0],s,r,i,f;if(o.orientation.type==="directional")[s,r,i,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[o.orientation.value];else if(o.orientation.type==="angular"){let u=+o.orientation.value/180*Math.PI-Math.PI/2,g=Math.cos(u),h=Math.sin(u);s=0,r=0,i=g,f=h,i<0&&(s-=i,i=0),f<0&&(r-=f,f=0)}let c=n,l=[];for(let u of o.colorStops){let g=Et(u);if(!l.length&&(l.push({offset:0,color:g}),typeof u.length=="undefined"||u.length.value==="0"))continue;let h=typeof u.length=="undefined"?void 0:u.length.type==="%"?u.length.value/100:u.length.value/c;l.push({offset:h,color:g})}l.length||l.push({offset:0,color:"transparent"});let d=l[l.length-1];d.offset!==1&&(typeof d.offset=="undefined"?d.offset=1:l.push({offset:1,color:d.color}));let p=0,m=1;for(let u=0;u<l.length;u++)if(typeof l[u].offset=="undefined"){for(m<u&&(m=u);typeof l[m].offset=="undefined";)m++;l[u].offset=(l[m].offset-l[p].offset)/(m-p)*(u-p)+l[p].offset}else p=u;return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${s}" y1="${r}" x2="${i}" y2="${f}">${l.map(u=>`<stop offset="${u.offset*100}%" stop-color="${u.color}"/>`).join("")}</linearGradient>`]}if(e.startsWith("url(")){let o=e.slice(4,-1);return[`satori_bi${t}`,`<pattern id="satori_bi${t}" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${o}" x="0" y="0" width="1" height="1"/></pattern>`]}}function P(t,n,e){return e<t+n&&(e/2<t&&e/2<n?t=n=e/2:e/2<t?t=e-n:e/2<n&&(n=e-t)),[t,n]}function F({left:t,top:n,width:e,height:o},s){let{borderTopLeftRadius:r,borderTopRightRadius:i,borderBottomLeftRadius:f,borderBottomRightRadius:c}=s;return r=Math.min(r||0,e,o),i=Math.min(i||0,e,o),f=Math.min(f||0,e,o),c=Math.min(c||0,e,o),!r&&!i&&!f&&!c?"":([r,i]=P(r,i,e),[r,f]=P(r,f,o),[i,c]=P(i,c,o),[f,c]=P(f,c,e),`M${t+r},${n} h${e-r-i} a${i},${i} 0 0 1 ${i},${i} v${o-i-c} a${c},${c} 0 0 1 ${-c},${c} h${c+f-e} a${f},${f} 0 0 1 ${-f},${-f} v${f+r-o} a${r},${r} 0 0 1 ${r},${-r}`)}function W({id:t,width:n,height:e},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let s=Math.min(o.shadowOffset.width-o.shadowRadius*2,0),r=Math.max(o.shadowOffset.width+o.shadowRadius*2+n,n),i=Math.min(o.shadowOffset.height-o.shadowRadius*2,0),f=Math.max(o.shadowOffset.height+o.shadowRadius*2+e,e);return`<defs><filter id="satori_s-${t}" x="${s/n*100}%" y="${i/e*100}%" width="${(r-s)/n*100}%" height="${(f-i)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function U({id:t,left:n,top:e,width:o,height:s,isInheritingTransform:r},i){if(i.display==="none")return"";let f="rect",c="transparent",l=0,d="",p="",m=[],u=1;if(i.backgroundColor&&m.push(i.backgroundColor),i.borderWidth&&(l=i.borderWidth,c=i.borderColor),i.opacity&&(u=+i.opacity),i.transform&&(d=N({left:n,top:e,width:o,height:s},i.transform,r)),i.backgroundImage){let E=i.backgroundImage.map((_,A)=>H({id:t+"_"+A,width:o,height:s},_)).filter(Boolean);for(let _ of E)p+=_[1],m.push(`url(#${_[0]})`)}let g=F({left:n,top:e,width:o,height:s},i);g&&(f="path");let h=W({width:o,height:s,id:t},i);return m.length||m.push("transparent"),`${p?`<defs>${p}</defs>`:""}${h?`${h}<g filter="url(#satori_s-${t})">`:""}${u!==1?`<g opacity="${u}">`:""}${m.map((E,_)=>E==="transparent"&&!(_===m.length-1&&l)?"":`<${f} x="${n}" y="${e}" width="${o}" height="${s}" fill="${E}" ${_===m.length-1&&l?`stroke="${c}" stroke-width="${l}"`:""} ${g?`d="${g}"`:""} ${d?`transform="${d}"`:""}></${f}>`).join("")}${u!==1?"</g>":""}${h?"</g>":""}`}function z({id:t,left:n,top:e,width:o,height:s,src:r},i){if(i.display==="none")return"";let f="",c=1,l=i.objectFit==="contain"?"xMidYMid":i.objectFit==="cover"?"xMidYMid slice":"none",d=F({left:n,top:e,width:o,height:s},i);d&&(f=`<clipPath id="satori_c-${t}"><path x="${n}" y="${e}" width="${o}" height="${s}" d="${d}"></path></clipPath>`),i.opacity&&(c=+i.opacity);let p=W({width:o,height:s,id:t},i);return`${p}${p?`<g filter="url(#satori_s-${t})">`:""}${f}<image href="${r}" x="${n}" y="${e}" width="${o}" height="${s}" preserveAspectRatio="${l}" ${f?`clip-path="url(#satori_c-${t})"`:""} ${c!==1?`opacity="${c}"`:""}></image>${p?"</g>":""}`}function*O(t,n){let{id:e,inheritedStyle:o,parent:s,font:r}=n;if(t===null||typeof t=="undefined")return yield,"";if(!D(t)||typeof t.type=="function"){let R;if(!D(t))R=X(String(t),n);else{if(Z(t.type))throw new Error("Class component is not supported.");R=O(t.type(t.props),n)}R.next();let C=yield;return R.next(C).value}let{type:i,props:f}=t,{style:c,children:l}=f,d=_t.Node.create();s.insertChild(d,s.getChildCount());let[p,m]=w(d,i,o,c,f),u=p.transform===o.transform;u||(p.transform.__parent=o.transform);let g=typeof l=="undefined"?[]:[].concat(l),h=[],E=0;for(let R of g){let C=O(R,{id:e*g.length+ ++E,parentStyle:p,inheritedStyle:m,isInheritingTransform:!0,parent:d,font:r});C.next(),h.push(C)}let[_,A]=yield;p.position==="absolute"&&d.calculateLayout();let{left:S,top:$,width:V,height:j}=d.getComputedLayout();S+=_,$+=A;let k="";i==="img"?k=z({id:e,left:S,top:$,width:V,height:j,src:f.src,isInheritingTransform:u},p):k=U({id:e,left:S,top:$,width:V,height:j,isInheritingTransform:u},p);for(let R of h)k+=R.next([S,$]).value;return k}import ot from"opentype.js";var B=class{constructor(n){this.fonts=new Map;for(let e of n){let o=e.data,s="buffer"in o?ot.parse(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):ot.parse(o);this.defaultFont||(this.defaultFont=s),this.fonts.has(e.name)||this.fonts.set(e.name,[]),this.fonts.get(e.name).push([s,e.weight,e.style])}}get({name:n,weight:e,style:o}){if(!this.fonts.has(n))return this.defaultFont;e==="normal"&&(e=400),e==="bold"&&(e=700);let s=[...this.fonts.get(n)];return s.sort(([r,i,f],[c,l,d])=>{if(i!==l)return i?!l||i===e?-1:l===e?1:e===400&&i===500||e===500&&i===400?-1:e===400&&l===500||e===500&&l===400?1:e<400?i<e&&l<e?l-i:i<e?-1:l<e?1:i-l:e<i&&e<l?i-l:e<i?-1:e<l?1:l-i:1;if(f!==d){if(f===o)return-1;if(d===o)return 1}return-1}),s[0][0]}measure(n,{fontFamily:e,fontSize:o,fontWeight:s=400,fontStyle:r="normal"}){let i=this.get({name:e,weight:s,style:r});return{width:i.getAdvanceWidth(n,o),ascent:i.ascender/i.unitsPerEm*o,descent:-(i.descender/i.unitsPerEm)*o}}getSVG(n,{fontFamily:e,fontSize:o,fontWeight:s=400,fontStyle:r="normal",top:i,left:f,letterSpacing:c=0}){return this.get({name:e,weight:s,style:r}).getPath(n,i,f,o,{letterSpacing:c}).toPathData(4)}};function J({width:t,height:n,content:e},o){return`<svg width="${t}" height="${n}" viewBox="0 0 ${t} ${n}" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}function it(t,n){let e=new B(n.fonts),o=v.Node.create();o.setWidth(n.width),o.setHeight(n.height),o.setFlexDirection(v.FLEX_DIRECTION_ROW),o.setFlexWrap(v.WRAP_WRAP);let s=O(t,{id:1,parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1},parent:o,font:e});s.next(),o.calculateLayout(n.width,n.height,v.DIRECTION_LTR);let r=s.next([0,0]).value;return J({width:n.width,height:n.height,content:r})}export{it as default}; | ||
var at=Object.defineProperty,st=Object.defineProperties;var ft=Object.getOwnPropertyDescriptors;var q=Object.getOwnPropertySymbols;var ut=Object.prototype.hasOwnProperty,lt=Object.prototype.propertyIsEnumerable;var K=(t,n,e)=>n in t?at(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,I=(t,n)=>{for(var e in n||(n={}))ut.call(n,e)&&K(t,e,n[e]);if(q)for(var e of q(n))lt.call(n,e)&&K(t,e,n[e]);return t},Q=(t,n)=>st(t,ft(n));import v from"yoga-layout-prebuilt";import _t from"yoga-layout-prebuilt";function D(t){let n=typeof t;return!(n==="number"||n==="bigint"||n==="string"||n==="boolean")}function Z(t){return/^class\s/.test(Function.prototype.toString.call(t))}function L(t,n){return[t[0]*n[0]+t[2]*n[1],t[1]*n[0]+t[3]*n[1],t[0]*n[2]+t[2]*n[3],t[1]*n[2]+t[3]*n[3],t[0]*n[4]+t[2]*n[5]+t[4],t[1]*n[4]+t[3]*n[5]+t[5]]}import a from"yoga-layout-prebuilt";var tt={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 ct=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","textAlign","textTransform","whiteSpace","letterSpacing","transform","opacity"]);function M(t){let n={};for(let e in t)ct.has(e)&&(n[e]=t[e]);return n}import mt,{getPropertyName as pt}from"css-to-react-native";import nt from"parse-css-dimension";import{parseElementStyle as dt}from"css-background-parser";var gt=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),et=[1,0,0,1,0,0];function ht(t,n){return typeof n=="number"?gt.has(t)?String(n):n+"px":n}function rt(t,n){if(typeof t=="number")return t;try{let e=new nt(t);if(e.type==="length")switch(e.unit){case"em":return e.value*n;case"rem":return e.value*16;default:return e.value}else if(e.type==="angle")switch(e.unit){case"deg":return e.value;case"rad":return e.value*180/Math.PI;default:return e.value}}catch{}}function G(t,n){let e=[];for(let r in t){let i=pt(r);e.push([i,ht(i,t[r])])}let o=mt(e);if(o.backgroundImage){let{backgrounds:r}=dt(o);o.backgroundImage=r}let s=o.fontSize||n.fontSize;if(typeof s=="string")try{let r=new nt(s);switch(r.unit){case"em":s=r.value*n.fontSize;break;case"rem":s=r.value*16;break}}catch{s=16}o.fontSize=s;for(let r in o){let i=o[r];if(typeof i=="string"){let f=rt(i,s);typeof f!="undefined"&&(o[r]=f),i=o[r]}if(r==="opacity"&&(i=o[r]=i*n.opacity),r==="transform"){let f=[...et],c=i;for(let l of c){let d=Object.keys(l)[0],p=l[d],m=typeof p=="string"?rt(p,s):p,u=[...et];switch(d){case"translateX":u[4]=m;break;case"translateY":u[5]=m;break;case"scaleX":u[0]=m;break;case"scaleY":u[3]=m;break;case"rotate":let g=m*Math.PI/180,h=Math.cos(g),E=Math.sin(g);u[0]=h,u[1]=E,u[2]=-E,u[3]=h;break;case"skewX":u[2]=Math.tan(m*Math.PI/180);break;case"skewY":u[1]=Math.tan(m*Math.PI/180);break}f=L(f,u)}o.transform=f}}return o}function x(t,n,e){let o=n[t];return typeof o=="undefined"?e:o}function w(t,n,e,o,s){let r=I(I(I({},e),G(tt[n],e)),G(o,e));if(n==="img"){let i=parseInt(s.width),c=parseInt(s.height)/i;r.width||(r.width=i),r.height||(r.height=c*r.width)}return t.setDisplay(x(r.display,{flex:a.DISPLAY_FLEX,none:a.DISPLAY_NONE},a.DISPLAY_FLEX)),t.setAlignContent(x(r.alignContent,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,"space-between":a.ALIGN_SPACE_BETWEEN,"space-around":a.ALIGN_SPACE_AROUND,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_AUTO)),t.setAlignItems(x(r.alignItems,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_FLEX_START)),t.setAlignSelf(x(r.alignSelf,{stretch:a.ALIGN_STRETCH,center:a.ALIGN_CENTER,"flex-start":a.ALIGN_FLEX_START,"flex-end":a.ALIGN_FLEX_END,baseline:a.ALIGN_BASELINE,normal:a.ALIGN_AUTO},a.ALIGN_AUTO)),t.setJustifyContent(x(r.justifyContent,{center:a.JUSTIFY_CENTER,"flex-start":a.JUSTIFY_FLEX_START,"flex-end":a.JUSTIFY_FLEX_END,"space-between":a.JUSTIFY_SPACE_BETWEEN,"space-around":a.JUSTIFY_SPACE_AROUND},a.JUSTIFY_FLEX_START)),typeof r.flexBasis!="undefined"?t.setFlexBasis(r.flexBasis):r.display==="block"&&(typeof r.width=="undefined"||r.width==="auto")&&(typeof r.maxWidth=="undefined"||r.maxWidth==="auto")&&t.setFlexBasisPercent(100),t.setFlexDirection(x(r.flexDirection,{row:a.FLEX_DIRECTION_ROW,column:a.FLEX_DIRECTION_COLUMN,"row-reverse":a.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":a.FLEX_DIRECTION_COLUMN_REVERSE},a.FLEX_DIRECTION_ROW)),t.setFlexGrow(r.flexGrow||0),t.setFlexShrink(r.flexShrink||1),t.setFlexWrap(x(r.flexWrap,{wrap:a.WRAP_WRAP,nowrap:a.WRAP_NO_WRAP,"wrap-reverse":a.WRAP_WRAP_REVERSE},a.WRAP_WRAP)),typeof r.maxHeight!="undefined"&&t.setMaxHeight(r.maxHeight),typeof r.maxWidth!="undefined"&&t.setMaxWidth(r.maxWidth),typeof r.minHeight!="undefined"&&t.setMinHeight(r.minHeight),typeof r.minWidth!="undefined"&&t.setMinWidth(r.minWidth),t.setOverflow(x(r.overflow,{visible:a.OVERFLOW_VISIBLE,hidden:a.OVERFLOW_HIDDEN},a.OVERFLOW_VISIBLE)),t.setMargin(a.EDGE_TOP,r.marginTop||0),t.setMargin(a.EDGE_BOTTOM,r.marginBottom||0),t.setMargin(a.EDGE_LEFT,r.marginLeft||0),t.setMargin(a.EDGE_RIGHT,r.marginRight||0),t.setBorder(a.EDGE_TOP,r.borderWidth||0),t.setBorder(a.EDGE_BOTTOM,r.borderWidth||0),t.setBorder(a.EDGE_LEFT,r.borderWidth||0),t.setBorder(a.EDGE_RIGHT,r.borderWidth||0),t.setPadding(a.EDGE_TOP,r.paddingTop||0),t.setPadding(a.EDGE_BOTTOM,r.paddingBottom||0),t.setPadding(a.EDGE_LEFT,r.paddingLeft||0),t.setPadding(a.EDGE_RIGHT,r.paddingRight||0),t.setPositionType((r.position,a.POSITION_TYPE_ABSOLUTE,a.POSITION_TYPE_RELATIVE,a.POSITION_TYPE_RELATIVE)),typeof r.top!="undefined"&&t.setPosition(a.EDGE_TOP,r.top),typeof r.bottom!="undefined"&&t.setPosition(a.EDGE_BOTTOM,r.bottom),typeof r.left!="undefined"&&t.setPosition(a.EDGE_LEFT,r.left),typeof r.right!="undefined"&&t.setPosition(a.EDGE_RIGHT,r.right),typeof r.height!="undefined"?t.setHeight(r.height):t.setHeightAuto(),typeof r.width!="undefined"?t.setWidth(r.width):t.setWidthAuto(),[r,M(r)]}import T from"yoga-layout-prebuilt";import{LineBreaker as bt}from"css-line-break";function N({left:t,top:n,width:e,height:o},s,r){let i;if(r)i=s;else{let f=t+e/2,c=n+o/2;i=L([1,0,0,1,f,c],L(s,[1,0,0,1,-f,-c])),s.__parent&&(i=L(s.__parent,i)),s.splice(0,6,...i)}return`matrix(${i.join(",")})`}function Y({left:t,top:n,width:e,height:o,isInheritingTransform:s,path:r},i){let f="",c=1;return i.transform&&(f=N({left:t,top:n,width:e,height:o},i.transform,s)),i.opacity&&(c=+i.opacity),`<path x="${t}" y="${n}" width="${e}" height="${o}" fill="${i.color}" ${f?`transform="${f}"`:""} ${c!==1?`opacity="${c}"`:""} d="${r}"></path>`}function*X(t,n){let{parentStyle:e,parent:o,font:s,id:r,isInheritingTransform:i}=n,f=bt(t,{lineBreak:"strict",wordBreak:"normal"}),c=[];for(let u;!(u=f.next()).done;)c.push(u.value.slice());let l=[];o.setAlignItems(T.ALIGN_BASELINE),e.textAlign==="left"?o.setJustifyContent(T.JUSTIFY_FLEX_START):e.textAlign==="center"?o.setJustifyContent(T.JUSTIFY_CENTER):e.textAlign==="right"?o.setJustifyContent(T.JUSTIFY_FLEX_END):e.textAlign==="justify"&&o.setJustifyContent(T.JUSTIFY_SPACE_BETWEEN);for(let u of c){let g=T.Node.create();o.insertChild(g,o.getChildCount());let h=s.measure(u,e),E=(e.letterSpacing||0)*u.length;g.setWidth(h.width+E),g.setHeight(h.ascent*1.2),g.setMargin(T.EDGE_BOTTOM,h.descent*1.2),l.push(g)}let[d,p]=yield,m="";for(let u=0;u<l.length;u++){let g=l[u],h=c[u];e.position==="absolute"&&g.calculateLayout();let{left:E,top:_,width:A,height:S}=g.getComputedLayout();E+=d,_+=p;let $=s.getSVG(h,Q(I({},e),{top:_,left:E,letterSpacing:e.letterSpacing}));m+=Y({id:r,left:E,top:_,width:A,height:S,isInheritingTransform:i,path:$},e)}return m}import yt from"gradient-parser";function Et(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 H({id:t,width:n},{image:e}){if(e.startsWith("linear-gradient(")){let o=yt.parse(e)[0],s,r,i,f;if(o.orientation.type==="directional")[s,r,i,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[o.orientation.value];else if(o.orientation.type==="angular"){let u=+o.orientation.value/180*Math.PI-Math.PI/2,g=Math.cos(u),h=Math.sin(u);s=0,r=0,i=g,f=h,i<0&&(s-=i,i=0),f<0&&(r-=f,f=0)}let c=n,l=[];for(let u of o.colorStops){let g=Et(u);if(!l.length&&(l.push({offset:0,color:g}),typeof u.length=="undefined"||u.length.value==="0"))continue;let h=typeof u.length=="undefined"?void 0:u.length.type==="%"?u.length.value/100:u.length.value/c;l.push({offset:h,color:g})}l.length||l.push({offset:0,color:"transparent"});let d=l[l.length-1];d.offset!==1&&(typeof d.offset=="undefined"?d.offset=1:l.push({offset:1,color:d.color}));let p=0,m=1;for(let u=0;u<l.length;u++)if(typeof l[u].offset=="undefined"){for(m<u&&(m=u);typeof l[m].offset=="undefined";)m++;l[u].offset=(l[m].offset-l[p].offset)/(m-p)*(u-p)+l[p].offset}else p=u;return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${s}" y1="${r}" x2="${i}" y2="${f}">${l.map(u=>`<stop offset="${u.offset*100}%" stop-color="${u.color}"/>`).join("")}</linearGradient>`]}if(e.startsWith("url(")){let o=e.slice(4,-1);return[`satori_bi${t}`,`<pattern id="satori_bi${t}" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${o}" x="0" y="0" width="1" height="1"/></pattern>`]}}function P(t,n,e){return e<t+n&&(e/2<t&&e/2<n?t=n=e/2:e/2<t?t=e-n:e/2<n&&(n=e-t)),[t,n]}function F({left:t,top:n,width:e,height:o},s){let{borderTopLeftRadius:r,borderTopRightRadius:i,borderBottomLeftRadius:f,borderBottomRightRadius:c}=s;return r=Math.min(r||0,e,o),i=Math.min(i||0,e,o),f=Math.min(f||0,e,o),c=Math.min(c||0,e,o),!r&&!i&&!f&&!c?"":([r,i]=P(r,i,e),[r,f]=P(r,f,o),[i,c]=P(i,c,o),[f,c]=P(f,c,e),`M${t+r},${n} h${e-r-i} a${i},${i} 0 0 1 ${i},${i} v${o-i-c} a${c},${c} 0 0 1 ${-c},${c} h${c+f-e} a${f},${f} 0 0 1 ${-f},${-f} v${f+r-o} a${r},${r} 0 0 1 ${r},${-r}`)}function W({id:t,width:n,height:e},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let s=Math.min(o.shadowOffset.width-o.shadowRadius*2,0),r=Math.max(o.shadowOffset.width+o.shadowRadius*2+n,n),i=Math.min(o.shadowOffset.height-o.shadowRadius*2,0),f=Math.max(o.shadowOffset.height+o.shadowRadius*2+e,e);return`<defs><filter id="satori_s-${t}" x="${s/n*100}%" y="${i/e*100}%" width="${(r-s)/n*100}%" height="${(f-i)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function U({id:t,left:n,top:e,width:o,height:s,isInheritingTransform:r},i){if(i.display==="none")return"";let f="rect",c="transparent",l=0,d="",p="",m=[],u=1;if(i.backgroundColor&&m.push(i.backgroundColor),i.borderWidth&&(l=i.borderWidth,c=i.borderColor),i.opacity&&(u=+i.opacity),i.transform&&(d=N({left:n,top:e,width:o,height:s},i.transform,r)),i.backgroundImage){let E=i.backgroundImage.map((_,A)=>H({id:t+"_"+A,width:o,height:s},_)).filter(Boolean);for(let _ of E)p+=_[1],m.push(`url(#${_[0]})`)}let g=F({left:n,top:e,width:o,height:s},i);g&&(f="path");let h=W({width:o,height:s,id:t},i);return m.length||m.push("transparent"),`${p?`<defs>${p}</defs>`:""}${h?`${h}<g filter="url(#satori_s-${t})">`:""}${u!==1?`<g opacity="${u}">`:""}${m.map((E,_)=>E==="transparent"&&!(_===m.length-1&&l)?"":`<${f} x="${n}" y="${e}" width="${o}" height="${s}" fill="${E}" ${_===m.length-1&&l?`stroke="${c}" stroke-width="${l}"`:""} ${g?`d="${g}"`:""} ${d?`transform="${d}"`:""}></${f}>`).join("")}${u!==1?"</g>":""}${h?"</g>":""}`}function z({id:t,left:n,top:e,width:o,height:s,src:r},i){if(i.display==="none")return"";let f="",c=1,l=i.objectFit==="contain"?"xMidYMid":i.objectFit==="cover"?"xMidYMid slice":"none",d=F({left:n,top:e,width:o,height:s},i);d&&(f=`<clipPath id="satori_c-${t}"><path x="${n}" y="${e}" width="${o}" height="${s}" d="${d}"></path></clipPath>`),i.opacity&&(c=+i.opacity);let p=W({width:o,height:s,id:t},i);return`${p}${p?`<g filter="url(#satori_s-${t})">`:""}${f}<image href="${r}" x="${n}" y="${e}" width="${o}" height="${s}" preserveAspectRatio="${l}" ${f?`clip-path="url(#satori_c-${t})"`:""} ${c!==1?`opacity="${c}"`:""}></image>${p?"</g>":""}`}function*O(t,n){let{id:e,inheritedStyle:o,parent:s,font:r}=n;if(t===null||typeof t=="undefined")return yield,"";if(!D(t)||typeof t.type=="function"){let R;if(!D(t))R=X(String(t),n);else{if(Z(t.type))throw new Error("Class component is not supported.");R=O(t.type(t.props),n)}R.next();let C=yield;return R.next(C).value}let{type:i,props:f}=t,{style:c,children:l}=f,d=_t.Node.create();s.insertChild(d,s.getChildCount());let[p,m]=w(d,i,o,c,f),u=p.transform===o.transform;u||(p.transform.__parent=o.transform);let g=typeof l=="undefined"?[]:[].concat(l),h=[],E=0;for(let R of g){let C=O(R,{id:e*g.length+ ++E,parentStyle:p,inheritedStyle:m,isInheritingTransform:!0,parent:d,font:r});C.next(),h.push(C)}let[_,A]=yield;p.position==="absolute"&&d.calculateLayout();let{left:S,top:$,width:V,height:j}=d.getComputedLayout();S+=_,$+=A;let k="";i==="img"?k=z({id:e,left:S,top:$,width:V,height:j,src:f.src,isInheritingTransform:u},p):k=U({id:e,left:S,top:$,width:V,height:j,isInheritingTransform:u},p);for(let R of h)k+=R.next([S,$]).value;return k}import ot from"opentype.js";var B=class{constructor(n){this.fonts=new Map;for(let e of n){let o=e.data,s="buffer"in o?ot.parse(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):ot.parse(o);this.defaultFont||(this.defaultFont=s),this.fonts.has(e.name)||this.fonts.set(e.name,[]),this.fonts.get(e.name).push([s,e.weight,e.style])}}get({name:n,weight:e,style:o}){if(!this.fonts.has(n))return this.defaultFont;e==="normal"&&(e=400),e==="bold"&&(e=700);let s=[...this.fonts.get(n)];return s.sort(([r,i,f],[c,l,d])=>{if(i!==l)return i?!l||i===e?-1:l===e?1:e===400&&i===500||e===500&&i===400?-1:e===400&&l===500||e===500&&l===400?1:e<400?i<e&&l<e?l-i:i<e?-1:l<e?1:i-l:e<i&&e<l?i-l:e<i?-1:e<l?1:l-i:1;if(f!==d){if(f===o)return-1;if(d===o)return 1}return-1}),s[0][0]}measure(n,{fontFamily:e,fontSize:o,fontWeight:s=400,fontStyle:r="normal"}){let i=this.get({name:e,weight:s,style:r});return{width:i.getAdvanceWidth(n,o),ascent:i.ascender/i.unitsPerEm*o,descent:-(i.descender/i.unitsPerEm)*o}}getSVG(n,{fontFamily:e,fontSize:o,fontWeight:s=400,fontStyle:r="normal",top:i,left:f,letterSpacing:c=0}){return this.get({name:e,weight:s,style:r}).getPath(n,i,f,o,{letterSpacing:c/o}).toPathData(4)}};function J({width:t,height:n,content:e},o){return`<svg width="${t}" height="${n}" viewBox="0 0 ${t} ${n}" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}function it(t,n){let e=new B(n.fonts),o=v.Node.create();o.setWidth(n.width),o.setHeight(n.height),o.setFlexDirection(v.FLEX_DIRECTION_ROW),o.setFlexWrap(v.WRAP_WRAP);let s=O(t,{id:1,parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1},parent:o,font:e});s.next(),o.calculateLayout(n.width,n.height,v.DIRECTION_LTR);let r=s.next([0,0]).value;return J({width:n.width,height:n.height,content:r})}export{it as default}; |
@@ -1,1 +0,1 @@ | ||
var gt=Object.create;var N=Object.defineProperty,ht=Object.defineProperties,bt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyDescriptors,Et=Object.getOwnPropertyNames,et=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var rt=(t,r,e)=>r in t?N(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,I=(t,r)=>{for(var e in r||(r={}))nt.call(r,e)&&rt(t,e,r[e]);if(et)for(var e of et(r))Rt.call(r,e)&&rt(t,e,r[e]);return t},ot=(t,r)=>ht(t,yt(r)),it=t=>N(t,"__esModule",{value:!0});var xt=(t,r)=>{for(var e in r)N(t,e,{get:r[e],enumerable:!0})},at=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Et(r))!nt.call(t,a)&&(e||a!=="default")&&N(t,a,{get:()=>r[a],enumerable:!(o=bt(r,a))||o.enumerable});return t},R=(t,r)=>at(it(N(t!=null?gt(_t(t)):{},"default",!r&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Tt=(t=>(r,e)=>t&&t.get(r)||(e=at(it({}),r,1),t&&t.set(r,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var At={};xt(At,{default:()=>Q});var C=R(require("yoga-layout-prebuilt"));var dt=R(require("yoga-layout-prebuilt"));function w(t){let r=typeof t;return!(r==="number"||r==="bigint"||r==="string"||r==="boolean")}function st(t){return/^class\s/.test(Function.prototype.toString.call(t))}function L(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]]}var s=R(require("yoga-layout-prebuilt"));var ft={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 St=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","textAlign","textTransform","whiteSpace","letterSpacing","transform","opacity"]);function Y(t){let r={};for(let e in t)St.has(e)&&(r[e]=t[e]);return r}var B=R(require("css-to-react-native")),X=R(require("parse-css-dimension")),ct=require("css-background-parser");var $t=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ut=[1,0,0,1,0,0];function It(t,r){return typeof r=="number"?$t.has(t)?String(r):r+"px":r}function lt(t,r){if(typeof t=="number")return t;try{let e=new X.default(t);if(e.type==="length")switch(e.unit){case"em":return e.value*r;case"rem":return e.value*16;default:return e.value}else if(e.type==="angle")switch(e.unit){case"deg":return e.value;case"rad":return e.value*180/Math.PI;default:return e.value}}catch{}}function v(t,r){let e=[];for(let n in t){let i=(0,B.getPropertyName)(n);e.push([i,It(i,t[n])])}let o=(0,B.default)(e);if(o.backgroundImage){let{backgrounds:n}=(0,ct.parseElementStyle)(o);o.backgroundImage=n}let a=o.fontSize||r.fontSize;if(typeof a=="string")try{let n=new X.default(a);switch(n.unit){case"em":a=n.value*r.fontSize;break;case"rem":a=n.value*16;break}}catch{a=16}o.fontSize=a;for(let n in o){let i=o[n];if(typeof i=="string"){let f=lt(i,a);typeof f!="undefined"&&(o[n]=f),i=o[n]}if(n==="opacity"&&(i=o[n]=i*r.opacity),n==="transform"){let f=[...ut],c=i;for(let l of c){let d=Object.keys(l)[0],p=l[d],m=typeof p=="string"?lt(p,a):p,u=[...ut];switch(d){case"translateX":u[4]=m;break;case"translateY":u[5]=m;break;case"scaleX":u[0]=m;break;case"scaleY":u[3]=m;break;case"rotate":let g=m*Math.PI/180,h=Math.cos(g),y=Math.sin(g);u[0]=h,u[1]=y,u[2]=-y,u[3]=h;break;case"skewX":u[2]=Math.tan(m*Math.PI/180);break;case"skewY":u[1]=Math.tan(m*Math.PI/180);break}f=L(f,u)}o.transform=f}}return o}function x(t,r,e){let o=r[t];return typeof o=="undefined"?e:o}function H(t,r,e,o,a){let n=I(I(I({},e),v(ft[r],e)),v(o,e));if(r==="img"){let i=parseInt(a.width),c=parseInt(a.height)/i;n.width||(n.width=i),n.height||(n.height=c*n.width)}return t.setDisplay(x(n.display,{flex:s.default.DISPLAY_FLEX,none:s.default.DISPLAY_NONE},s.default.DISPLAY_FLEX)),t.setAlignContent(x(n.alignContent,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,"space-between":s.default.ALIGN_SPACE_BETWEEN,"space-around":s.default.ALIGN_SPACE_AROUND,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_AUTO)),t.setAlignItems(x(n.alignItems,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_FLEX_START)),t.setAlignSelf(x(n.alignSelf,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_AUTO)),t.setJustifyContent(x(n.justifyContent,{center:s.default.JUSTIFY_CENTER,"flex-start":s.default.JUSTIFY_FLEX_START,"flex-end":s.default.JUSTIFY_FLEX_END,"space-between":s.default.JUSTIFY_SPACE_BETWEEN,"space-around":s.default.JUSTIFY_SPACE_AROUND},s.default.JUSTIFY_FLEX_START)),typeof n.flexBasis!="undefined"?t.setFlexBasis(n.flexBasis):n.display==="block"&&(typeof n.width=="undefined"||n.width==="auto")&&(typeof n.maxWidth=="undefined"||n.maxWidth==="auto")&&t.setFlexBasisPercent(100),t.setFlexDirection(x(n.flexDirection,{row:s.default.FLEX_DIRECTION_ROW,column:s.default.FLEX_DIRECTION_COLUMN,"row-reverse":s.default.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.default.FLEX_DIRECTION_COLUMN_REVERSE},s.default.FLEX_DIRECTION_ROW)),t.setFlexGrow(n.flexGrow||0),t.setFlexShrink(n.flexShrink||1),t.setFlexWrap(x(n.flexWrap,{wrap:s.default.WRAP_WRAP,nowrap:s.default.WRAP_NO_WRAP,"wrap-reverse":s.default.WRAP_WRAP_REVERSE},s.default.WRAP_WRAP)),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(x(n.overflow,{visible:s.default.OVERFLOW_VISIBLE,hidden:s.default.OVERFLOW_HIDDEN},s.default.OVERFLOW_VISIBLE)),t.setMargin(s.default.EDGE_TOP,n.marginTop||0),t.setMargin(s.default.EDGE_BOTTOM,n.marginBottom||0),t.setMargin(s.default.EDGE_LEFT,n.marginLeft||0),t.setMargin(s.default.EDGE_RIGHT,n.marginRight||0),t.setBorder(s.default.EDGE_TOP,n.borderWidth||0),t.setBorder(s.default.EDGE_BOTTOM,n.borderWidth||0),t.setBorder(s.default.EDGE_LEFT,n.borderWidth||0),t.setBorder(s.default.EDGE_RIGHT,n.borderWidth||0),t.setPadding(s.default.EDGE_TOP,n.paddingTop||0),t.setPadding(s.default.EDGE_BOTTOM,n.paddingBottom||0),t.setPadding(s.default.EDGE_LEFT,n.paddingLeft||0),t.setPadding(s.default.EDGE_RIGHT,n.paddingRight||0),t.setPositionType((n.position,s.default.POSITION_TYPE_ABSOLUTE,s.default.POSITION_TYPE_RELATIVE,s.default.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&t.setPosition(s.default.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&t.setPosition(s.default.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&t.setPosition(s.default.EDGE_LEFT,n.left),typeof n.right!="undefined"&&t.setPosition(s.default.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,Y(n)]}var T=R(require("yoga-layout-prebuilt")),mt=require("css-line-break");function F({left:t,top:r,width:e,height:o},a,n){let i;if(n)i=a;else{let f=t+e/2,c=r+o/2;i=L([1,0,0,1,f,c],L(a,[1,0,0,1,-f,-c])),a.__parent&&(i=L(a.__parent,i)),a.splice(0,6,...i)}return`matrix(${i.join(",")})`}function U({left:t,top:r,width:e,height:o,content:a,isInheritingTransform:n,path:i},f){let c="",l=1;return f.transform&&(c=F({left:t,top:r,width:e,height:o},f.transform,n)),f.opacity&&(l=+f.opacity),`<path x="${t}" y="${r+o}" width="${e}" height="${o}" fill="${f.color}" ${c?`transform="${c}"`:""} ${l!==1?`opacity="${l}"`:""} d="${i}"></path>`}function*z(t,r){let{parentStyle:e,parent:o,font:a,id:n,isInheritingTransform:i}=r,f=(0,mt.LineBreaker)(t,{lineBreak:"strict",wordBreak:"normal"}),c=[];for(let u;!(u=f.next()).done;)c.push(u.value.slice());let l=[];o.setAlignItems(T.default.ALIGN_BASELINE),e.textAlign==="left"?o.setJustifyContent(T.default.JUSTIFY_FLEX_START):e.textAlign==="center"?o.setJustifyContent(T.default.JUSTIFY_CENTER):e.textAlign==="right"?o.setJustifyContent(T.default.JUSTIFY_FLEX_END):e.textAlign==="justify"&&o.setJustifyContent(T.default.JUSTIFY_SPACE_BETWEEN);for(let u of c){let g=T.default.Node.create();o.insertChild(g,o.getChildCount());let h=a.measure(u,e),y=(e.letterSpacing||0)*u.length;g.setWidth(h.width+y),g.setHeight(h.ascent*1.2),g.setMargin(T.default.EDGE_BOTTOM,h.descent*1.2),l.push([g,u])}let[d,p]=yield,m="";for(let u=0;u<l.length;u++){let[g,h]=l[u];e.position==="absolute"&&g.calculateLayout();let{left:y,top:E,width:A,height:S}=g.getComputedLayout();y+=d,E+=p;let $=a.getSVG(h,ot(I({},e),{top:E,left:y,letterSpacing:e.letterSpacing}));m+=U({id:n,left:y,top:E,width:A,height:S,content:c[u],isInheritingTransform:i,path:$},e)}return m}var pt=R(require("gradient-parser"));function Lt(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 J({id:t,width:r},{image:e}){if(e.startsWith("linear-gradient(")){let o=pt.default.parse(e)[0],a,n,i,f;if(o.orientation.type==="directional")[a,n,i,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[o.orientation.value];else if(o.orientation.type==="angular"){let u=+o.orientation.value/180*Math.PI-Math.PI/2,g=Math.cos(u),h=Math.sin(u);a=0,n=0,i=g,f=h,i<0&&(a-=i,i=0),f<0&&(n-=f,f=0)}let c=r,l=[];for(let u of o.colorStops){let g=Lt(u);if(!l.length&&(l.push({offset:0,color:g}),typeof u.length=="undefined"||u.length.value==="0"))continue;let h=typeof u.length=="undefined"?void 0:u.length.type==="%"?u.length.value/100:u.length.value/c;l.push({offset:h,color:g})}l.length||l.push({offset:0,color:"transparent"});let d=l[l.length-1];d.offset!==1&&(typeof d.offset=="undefined"?d.offset=1:l.push({offset:1,color:d.color}));let p=0,m=1;for(let u=0;u<l.length;u++)if(typeof l[u].offset=="undefined"){for(m<u&&(m=u);typeof l[m].offset=="undefined";)m++;l[u].offset=(l[m].offset-l[p].offset)/(m-p)*(u-p)+l[p].offset}else p=u;return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${a}" y1="${n}" x2="${i}" y2="${f}">${l.map(u=>`<stop offset="${u.offset*100}%" stop-color="${u.color}"/>`).join("")}</linearGradient>`]}if(e.startsWith("url(")){let o=e.slice(4,-1);return[`satori_bi${t}`,`<pattern id="satori_bi${t}" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${o}" x="0" y="0" width="1" height="1"/></pattern>`]}}function D(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 W({left:t,top:r,width:e,height:o},a){let{borderTopLeftRadius:n,borderTopRightRadius:i,borderBottomLeftRadius:f,borderBottomRightRadius:c}=a;return n=Math.min(n||0,e,o),i=Math.min(i||0,e,o),f=Math.min(f||0,e,o),c=Math.min(c||0,e,o),!n&&!i&&!f&&!c?"":([n,i]=D(n,i,e),[n,f]=D(n,f,o),[i,c]=D(i,c,o),[f,c]=D(f,c,e),`M${t+n},${r} h${e-n-i} a${i},${i} 0 0 1 ${i},${i} v${o-i-c} a${c},${c} 0 0 1 ${-c},${c} h${c+f-e} a${f},${f} 0 0 1 ${-f},${-f} v${f+n-o} a${n},${n} 0 0 1 ${n},${-n}`)}function O({id:t,width:r,height:e},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=Math.min(o.shadowOffset.width-o.shadowRadius*2,0),n=Math.max(o.shadowOffset.width+o.shadowRadius*2+r,r),i=Math.min(o.shadowOffset.height-o.shadowRadius*2,0),f=Math.max(o.shadowOffset.height+o.shadowRadius*2+e,e);return`<defs><filter id="satori_s-${t}" x="${a/r*100}%" y="${i/e*100}%" width="${(n-a)/r*100}%" height="${(f-i)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function V({id:t,left:r,top:e,width:o,height:a,isInheritingTransform:n},i){if(i.display==="none")return"";let f="rect",c="transparent",l=0,d="",p="",m=[],u=1;if(i.backgroundColor&&m.push(i.backgroundColor),i.borderWidth&&(l=i.borderWidth,c=i.borderColor),i.opacity&&(u=+i.opacity),i.transform&&(d=F({left:r,top:e,width:o,height:a},i.transform,n)),i.backgroundImage){let y=i.backgroundImage.map((E,A)=>J({id:t+"_"+A,width:o,height:a},E)).filter(Boolean);for(let E of y)p+=E[1],m.push(`url(#${E[0]})`)}let g=W({left:r,top:e,width:o,height:a},i);g&&(f="path");let h=O({width:o,height:a,id:t},i);return m.length||m.push("transparent"),`${p?`<defs>${p}</defs>`:""}${h?`${h}<g filter="url(#satori_s-${t})">`:""}${u!==1?`<g opacity="${u}">`:""}${m.map((y,E)=>y==="transparent"&&!(E===m.length-1&&l)?"":`<${f} x="${r}" y="${e}" width="${o}" height="${a}" fill="${y}" ${E===m.length-1&&l?`stroke="${c}" stroke-width="${l}"`:""} ${g?`d="${g}"`:""} ${d?`transform="${d}"`:""}></${f}>`).join("")}${u!==1?"</g>":""}${h?"</g>":""}`}function j({id:t,left:r,top:e,width:o,height:a,src:n},i){if(i.display==="none")return"";let f="",c=1,l=i.objectFit==="contain"?"xMidYMid":i.objectFit==="cover"?"xMidYMid slice":"none",d=W({left:r,top:e,width:o,height:a},i);d&&(f=`<clipPath id="satori_c-${t}"><path x="${r}" y="${e}" width="${o}" height="${a}" d="${d}"></path></clipPath>`),i.opacity&&(c=+i.opacity);let p=O({width:o,height:a,id:t},i);return`${p}${p?`<g filter="url(#satori_s-${t})">`:""}${f}<image href="${n}" x="${r}" y="${e}" width="${o}" height="${a}" preserveAspectRatio="${l}" ${f?`clip-path="url(#satori_c-${t})"`:""} ${c!==1?`opacity="${c}"`:""}></image>${p?"</g>":""}`}function*k(t,r){let{id:e,inheritedStyle:o,parent:a,font:n}=r;if(t===null||typeof t=="undefined")return yield,"";if(!w(t)||typeof t.type=="function"){let _;if(!w(t))_=z(String(t),r);else{if(st(t.type))throw new Error("Class component is not supported.");_=k(t.type(t.props),r)}_.next();let P=yield;return _.next(P).value}let{type:i,props:f}=t,{style:c,children:l}=f,d=dt.default.Node.create();a.insertChild(d,a.getChildCount());let[p,m]=H(d,i,o,c,f),u=p.transform===o.transform;u||(p.transform.__parent=o.transform);let g=typeof l=="undefined"?[]:[].concat(l),h=[],y=0;for(let _ of g){let P=k(_,{id:e*g.length+ ++y,parentStyle:p,inheritedStyle:m,isInheritingTransform:!0,parent:d,font:n});P.next(),h.push(P)}let[E,A]=yield;p.position==="absolute"&&d.calculateLayout();let{left:S,top:$,width:Z,height:tt}=d.getComputedLayout();S+=E,$+=A;let G="";i==="img"?G=j({id:e,left:S,top:$,width:Z,height:tt,src:f.src,isInheritingTransform:u},p):G=V({id:e,left:S,top:$,width:Z,height:tt,isInheritingTransform:u},p);for(let _ of h)G+=_.next([S,$]).value;return G}var q=R(require("opentype.js")),M=class{constructor(r){this.fonts=new Map;for(let e of r){let o=e.data,a="buffer"in o?q.default.parse(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):q.default.parse(o);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(([n,i,f],[c,l,d])=>{if(i!==l)return i?!l||i===e?-1:l===e?1:e===400&&i===500||e===500&&i===400?-1:e===400&&l===500||e===500&&l===400?1:e<400?i<e&&l<e?l-i:i<e?-1:l<e?1:i-l:e<i&&e<l?i-l:e<i?-1:e<l?1:l-i:1;if(f!==d){if(f===o)return-1;if(d===o)return 1}return-1}),a[0][0]}measure(r,{fontFamily:e,fontSize:o,fontWeight:a=400,fontStyle:n="normal"}){let i=this.get({name:e,weight:a,style:n});return{width:i.getAdvanceWidth(r,o),ascent:i.ascender/i.unitsPerEm*o,descent:-(i.descender/i.unitsPerEm)*o}}getSVG(r,{fontFamily:e,fontSize:o,fontWeight:a=400,fontStyle:n="normal",top:i,left:f,letterSpacing:c=0}){return this.get({name:e,weight:a,style:n}).getPath(r,i,f,o,{letterSpacing:c}).toPathData(4)}};function K({width:t,height:r,content:e},o){return`<svg width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}function Q(t,r){let e=new M(r.fonts),o=C.default.Node.create();o.setWidth(r.width),o.setHeight(r.height),o.setFlexDirection(C.default.FLEX_DIRECTION_ROW),o.setFlexWrap(C.default.WRAP_WRAP);let a=k(t,{id:1,parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1},parent:o,font:e});a.next(),o.calculateLayout(r.width,r.height,C.default.DIRECTION_LTR);let n=a.next([0,0]).value;return K({width:r.width,height:r.height,content:n})}module.exports=Tt(At);0&&(module.exports={}); | ||
var gt=Object.create;var N=Object.defineProperty,ht=Object.defineProperties,bt=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyDescriptors,Et=Object.getOwnPropertyNames,et=Object.getOwnPropertySymbols,_t=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var rt=(t,r,e)=>r in t?N(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e,I=(t,r)=>{for(var e in r||(r={}))nt.call(r,e)&&rt(t,e,r[e]);if(et)for(var e of et(r))Rt.call(r,e)&&rt(t,e,r[e]);return t},ot=(t,r)=>ht(t,yt(r)),it=t=>N(t,"__esModule",{value:!0});var xt=(t,r)=>{for(var e in r)N(t,e,{get:r[e],enumerable:!0})},at=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Et(r))!nt.call(t,a)&&(e||a!=="default")&&N(t,a,{get:()=>r[a],enumerable:!(o=bt(r,a))||o.enumerable});return t},R=(t,r)=>at(it(N(t!=null?gt(_t(t)):{},"default",!r&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Tt=(t=>(r,e)=>t&&t.get(r)||(e=at(it({}),r,1),t&&t.set(r,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var At={};xt(At,{default:()=>Q});var C=R(require("yoga-layout-prebuilt"));var dt=R(require("yoga-layout-prebuilt"));function w(t){let r=typeof t;return!(r==="number"||r==="bigint"||r==="string"||r==="boolean")}function st(t){return/^class\s/.test(Function.prototype.toString.call(t))}function L(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]]}var s=R(require("yoga-layout-prebuilt"));var ft={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 St=new Set(["color","font","fontFamily","fontSize","fontStyle","fontWeight","lineHeight","textAlign","textTransform","whiteSpace","letterSpacing","transform","opacity"]);function Y(t){let r={};for(let e in t)St.has(e)&&(r[e]=t[e]);return r}var B=R(require("css-to-react-native")),X=R(require("parse-css-dimension")),ct=require("css-background-parser");var $t=new Set(["flex","flexGrow","flexShrink","flexBasis","fontWeight","lineHeight","opacity","scale","scaleX","scaleY"]),ut=[1,0,0,1,0,0];function It(t,r){return typeof r=="number"?$t.has(t)?String(r):r+"px":r}function lt(t,r){if(typeof t=="number")return t;try{let e=new X.default(t);if(e.type==="length")switch(e.unit){case"em":return e.value*r;case"rem":return e.value*16;default:return e.value}else if(e.type==="angle")switch(e.unit){case"deg":return e.value;case"rad":return e.value*180/Math.PI;default:return e.value}}catch{}}function v(t,r){let e=[];for(let n in t){let i=(0,B.getPropertyName)(n);e.push([i,It(i,t[n])])}let o=(0,B.default)(e);if(o.backgroundImage){let{backgrounds:n}=(0,ct.parseElementStyle)(o);o.backgroundImage=n}let a=o.fontSize||r.fontSize;if(typeof a=="string")try{let n=new X.default(a);switch(n.unit){case"em":a=n.value*r.fontSize;break;case"rem":a=n.value*16;break}}catch{a=16}o.fontSize=a;for(let n in o){let i=o[n];if(typeof i=="string"){let f=lt(i,a);typeof f!="undefined"&&(o[n]=f),i=o[n]}if(n==="opacity"&&(i=o[n]=i*r.opacity),n==="transform"){let f=[...ut],c=i;for(let l of c){let d=Object.keys(l)[0],p=l[d],m=typeof p=="string"?lt(p,a):p,u=[...ut];switch(d){case"translateX":u[4]=m;break;case"translateY":u[5]=m;break;case"scaleX":u[0]=m;break;case"scaleY":u[3]=m;break;case"rotate":let g=m*Math.PI/180,h=Math.cos(g),y=Math.sin(g);u[0]=h,u[1]=y,u[2]=-y,u[3]=h;break;case"skewX":u[2]=Math.tan(m*Math.PI/180);break;case"skewY":u[1]=Math.tan(m*Math.PI/180);break}f=L(f,u)}o.transform=f}}return o}function x(t,r,e){let o=r[t];return typeof o=="undefined"?e:o}function H(t,r,e,o,a){let n=I(I(I({},e),v(ft[r],e)),v(o,e));if(r==="img"){let i=parseInt(a.width),c=parseInt(a.height)/i;n.width||(n.width=i),n.height||(n.height=c*n.width)}return t.setDisplay(x(n.display,{flex:s.default.DISPLAY_FLEX,none:s.default.DISPLAY_NONE},s.default.DISPLAY_FLEX)),t.setAlignContent(x(n.alignContent,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,"space-between":s.default.ALIGN_SPACE_BETWEEN,"space-around":s.default.ALIGN_SPACE_AROUND,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_AUTO)),t.setAlignItems(x(n.alignItems,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_FLEX_START)),t.setAlignSelf(x(n.alignSelf,{stretch:s.default.ALIGN_STRETCH,center:s.default.ALIGN_CENTER,"flex-start":s.default.ALIGN_FLEX_START,"flex-end":s.default.ALIGN_FLEX_END,baseline:s.default.ALIGN_BASELINE,normal:s.default.ALIGN_AUTO},s.default.ALIGN_AUTO)),t.setJustifyContent(x(n.justifyContent,{center:s.default.JUSTIFY_CENTER,"flex-start":s.default.JUSTIFY_FLEX_START,"flex-end":s.default.JUSTIFY_FLEX_END,"space-between":s.default.JUSTIFY_SPACE_BETWEEN,"space-around":s.default.JUSTIFY_SPACE_AROUND},s.default.JUSTIFY_FLEX_START)),typeof n.flexBasis!="undefined"?t.setFlexBasis(n.flexBasis):n.display==="block"&&(typeof n.width=="undefined"||n.width==="auto")&&(typeof n.maxWidth=="undefined"||n.maxWidth==="auto")&&t.setFlexBasisPercent(100),t.setFlexDirection(x(n.flexDirection,{row:s.default.FLEX_DIRECTION_ROW,column:s.default.FLEX_DIRECTION_COLUMN,"row-reverse":s.default.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.default.FLEX_DIRECTION_COLUMN_REVERSE},s.default.FLEX_DIRECTION_ROW)),t.setFlexGrow(n.flexGrow||0),t.setFlexShrink(n.flexShrink||1),t.setFlexWrap(x(n.flexWrap,{wrap:s.default.WRAP_WRAP,nowrap:s.default.WRAP_NO_WRAP,"wrap-reverse":s.default.WRAP_WRAP_REVERSE},s.default.WRAP_WRAP)),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(x(n.overflow,{visible:s.default.OVERFLOW_VISIBLE,hidden:s.default.OVERFLOW_HIDDEN},s.default.OVERFLOW_VISIBLE)),t.setMargin(s.default.EDGE_TOP,n.marginTop||0),t.setMargin(s.default.EDGE_BOTTOM,n.marginBottom||0),t.setMargin(s.default.EDGE_LEFT,n.marginLeft||0),t.setMargin(s.default.EDGE_RIGHT,n.marginRight||0),t.setBorder(s.default.EDGE_TOP,n.borderWidth||0),t.setBorder(s.default.EDGE_BOTTOM,n.borderWidth||0),t.setBorder(s.default.EDGE_LEFT,n.borderWidth||0),t.setBorder(s.default.EDGE_RIGHT,n.borderWidth||0),t.setPadding(s.default.EDGE_TOP,n.paddingTop||0),t.setPadding(s.default.EDGE_BOTTOM,n.paddingBottom||0),t.setPadding(s.default.EDGE_LEFT,n.paddingLeft||0),t.setPadding(s.default.EDGE_RIGHT,n.paddingRight||0),t.setPositionType((n.position,s.default.POSITION_TYPE_ABSOLUTE,s.default.POSITION_TYPE_RELATIVE,s.default.POSITION_TYPE_RELATIVE)),typeof n.top!="undefined"&&t.setPosition(s.default.EDGE_TOP,n.top),typeof n.bottom!="undefined"&&t.setPosition(s.default.EDGE_BOTTOM,n.bottom),typeof n.left!="undefined"&&t.setPosition(s.default.EDGE_LEFT,n.left),typeof n.right!="undefined"&&t.setPosition(s.default.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,Y(n)]}var T=R(require("yoga-layout-prebuilt")),mt=require("css-line-break");function F({left:t,top:r,width:e,height:o},a,n){let i;if(n)i=a;else{let f=t+e/2,c=r+o/2;i=L([1,0,0,1,f,c],L(a,[1,0,0,1,-f,-c])),a.__parent&&(i=L(a.__parent,i)),a.splice(0,6,...i)}return`matrix(${i.join(",")})`}function U({left:t,top:r,width:e,height:o,isInheritingTransform:a,path:n},i){let f="",c=1;return i.transform&&(f=F({left:t,top:r,width:e,height:o},i.transform,a)),i.opacity&&(c=+i.opacity),`<path x="${t}" y="${r}" width="${e}" height="${o}" fill="${i.color}" ${f?`transform="${f}"`:""} ${c!==1?`opacity="${c}"`:""} d="${n}"></path>`}function*z(t,r){let{parentStyle:e,parent:o,font:a,id:n,isInheritingTransform:i}=r,f=(0,mt.LineBreaker)(t,{lineBreak:"strict",wordBreak:"normal"}),c=[];for(let u;!(u=f.next()).done;)c.push(u.value.slice());let l=[];o.setAlignItems(T.default.ALIGN_BASELINE),e.textAlign==="left"?o.setJustifyContent(T.default.JUSTIFY_FLEX_START):e.textAlign==="center"?o.setJustifyContent(T.default.JUSTIFY_CENTER):e.textAlign==="right"?o.setJustifyContent(T.default.JUSTIFY_FLEX_END):e.textAlign==="justify"&&o.setJustifyContent(T.default.JUSTIFY_SPACE_BETWEEN);for(let u of c){let g=T.default.Node.create();o.insertChild(g,o.getChildCount());let h=a.measure(u,e),y=(e.letterSpacing||0)*u.length;g.setWidth(h.width+y),g.setHeight(h.ascent*1.2),g.setMargin(T.default.EDGE_BOTTOM,h.descent*1.2),l.push(g)}let[d,p]=yield,m="";for(let u=0;u<l.length;u++){let g=l[u],h=c[u];e.position==="absolute"&&g.calculateLayout();let{left:y,top:E,width:A,height:S}=g.getComputedLayout();y+=d,E+=p;let $=a.getSVG(h,ot(I({},e),{top:E,left:y,letterSpacing:e.letterSpacing}));m+=U({id:n,left:y,top:E,width:A,height:S,isInheritingTransform:i,path:$},e)}return m}var pt=R(require("gradient-parser"));function Lt(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 J({id:t,width:r},{image:e}){if(e.startsWith("linear-gradient(")){let o=pt.default.parse(e)[0],a,n,i,f;if(o.orientation.type==="directional")[a,n,i,f]={top:[0,1,0,0],bottom:[0,0,0,1],left:[1,0,0,0],right:[0,0,1,0]}[o.orientation.value];else if(o.orientation.type==="angular"){let u=+o.orientation.value/180*Math.PI-Math.PI/2,g=Math.cos(u),h=Math.sin(u);a=0,n=0,i=g,f=h,i<0&&(a-=i,i=0),f<0&&(n-=f,f=0)}let c=r,l=[];for(let u of o.colorStops){let g=Lt(u);if(!l.length&&(l.push({offset:0,color:g}),typeof u.length=="undefined"||u.length.value==="0"))continue;let h=typeof u.length=="undefined"?void 0:u.length.type==="%"?u.length.value/100:u.length.value/c;l.push({offset:h,color:g})}l.length||l.push({offset:0,color:"transparent"});let d=l[l.length-1];d.offset!==1&&(typeof d.offset=="undefined"?d.offset=1:l.push({offset:1,color:d.color}));let p=0,m=1;for(let u=0;u<l.length;u++)if(typeof l[u].offset=="undefined"){for(m<u&&(m=u);typeof l[m].offset=="undefined";)m++;l[u].offset=(l[m].offset-l[p].offset)/(m-p)*(u-p)+l[p].offset}else p=u;return[`satori_bi${t}`,`<linearGradient id="satori_bi${t}" x1="${a}" y1="${n}" x2="${i}" y2="${f}">${l.map(u=>`<stop offset="${u.offset*100}%" stop-color="${u.color}"/>`).join("")}</linearGradient>`]}if(e.startsWith("url(")){let o=e.slice(4,-1);return[`satori_bi${t}`,`<pattern id="satori_bi${t}" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${o}" x="0" y="0" width="1" height="1"/></pattern>`]}}function D(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 W({left:t,top:r,width:e,height:o},a){let{borderTopLeftRadius:n,borderTopRightRadius:i,borderBottomLeftRadius:f,borderBottomRightRadius:c}=a;return n=Math.min(n||0,e,o),i=Math.min(i||0,e,o),f=Math.min(f||0,e,o),c=Math.min(c||0,e,o),!n&&!i&&!f&&!c?"":([n,i]=D(n,i,e),[n,f]=D(n,f,o),[i,c]=D(i,c,o),[f,c]=D(f,c,e),`M${t+n},${r} h${e-n-i} a${i},${i} 0 0 1 ${i},${i} v${o-i-c} a${c},${c} 0 0 1 ${-c},${c} h${c+f-e} a${f},${f} 0 0 1 ${-f},${-f} v${f+n-o} a${n},${n} 0 0 1 ${n},${-n}`)}function O({id:t,width:r,height:e},o){if(!o.shadowColor||!o.shadowOffset||typeof o.shadowRadius=="undefined")return"";let a=Math.min(o.shadowOffset.width-o.shadowRadius*2,0),n=Math.max(o.shadowOffset.width+o.shadowRadius*2+r,r),i=Math.min(o.shadowOffset.height-o.shadowRadius*2,0),f=Math.max(o.shadowOffset.height+o.shadowRadius*2+e,e);return`<defs><filter id="satori_s-${t}" x="${a/r*100}%" y="${i/e*100}%" width="${(n-a)/r*100}%" height="${(f-i)/e*100}%"><feDropShadow dx="${o.shadowOffset.width}" dy="${o.shadowOffset.height}" stdDeviation="${o.shadowRadius}" flood-color="${o.shadowColor}" flood-opacity="1"/></filter></defs>`}function V({id:t,left:r,top:e,width:o,height:a,isInheritingTransform:n},i){if(i.display==="none")return"";let f="rect",c="transparent",l=0,d="",p="",m=[],u=1;if(i.backgroundColor&&m.push(i.backgroundColor),i.borderWidth&&(l=i.borderWidth,c=i.borderColor),i.opacity&&(u=+i.opacity),i.transform&&(d=F({left:r,top:e,width:o,height:a},i.transform,n)),i.backgroundImage){let y=i.backgroundImage.map((E,A)=>J({id:t+"_"+A,width:o,height:a},E)).filter(Boolean);for(let E of y)p+=E[1],m.push(`url(#${E[0]})`)}let g=W({left:r,top:e,width:o,height:a},i);g&&(f="path");let h=O({width:o,height:a,id:t},i);return m.length||m.push("transparent"),`${p?`<defs>${p}</defs>`:""}${h?`${h}<g filter="url(#satori_s-${t})">`:""}${u!==1?`<g opacity="${u}">`:""}${m.map((y,E)=>y==="transparent"&&!(E===m.length-1&&l)?"":`<${f} x="${r}" y="${e}" width="${o}" height="${a}" fill="${y}" ${E===m.length-1&&l?`stroke="${c}" stroke-width="${l}"`:""} ${g?`d="${g}"`:""} ${d?`transform="${d}"`:""}></${f}>`).join("")}${u!==1?"</g>":""}${h?"</g>":""}`}function j({id:t,left:r,top:e,width:o,height:a,src:n},i){if(i.display==="none")return"";let f="",c=1,l=i.objectFit==="contain"?"xMidYMid":i.objectFit==="cover"?"xMidYMid slice":"none",d=W({left:r,top:e,width:o,height:a},i);d&&(f=`<clipPath id="satori_c-${t}"><path x="${r}" y="${e}" width="${o}" height="${a}" d="${d}"></path></clipPath>`),i.opacity&&(c=+i.opacity);let p=O({width:o,height:a,id:t},i);return`${p}${p?`<g filter="url(#satori_s-${t})">`:""}${f}<image href="${n}" x="${r}" y="${e}" width="${o}" height="${a}" preserveAspectRatio="${l}" ${f?`clip-path="url(#satori_c-${t})"`:""} ${c!==1?`opacity="${c}"`:""}></image>${p?"</g>":""}`}function*k(t,r){let{id:e,inheritedStyle:o,parent:a,font:n}=r;if(t===null||typeof t=="undefined")return yield,"";if(!w(t)||typeof t.type=="function"){let _;if(!w(t))_=z(String(t),r);else{if(st(t.type))throw new Error("Class component is not supported.");_=k(t.type(t.props),r)}_.next();let P=yield;return _.next(P).value}let{type:i,props:f}=t,{style:c,children:l}=f,d=dt.default.Node.create();a.insertChild(d,a.getChildCount());let[p,m]=H(d,i,o,c,f),u=p.transform===o.transform;u||(p.transform.__parent=o.transform);let g=typeof l=="undefined"?[]:[].concat(l),h=[],y=0;for(let _ of g){let P=k(_,{id:e*g.length+ ++y,parentStyle:p,inheritedStyle:m,isInheritingTransform:!0,parent:d,font:n});P.next(),h.push(P)}let[E,A]=yield;p.position==="absolute"&&d.calculateLayout();let{left:S,top:$,width:Z,height:tt}=d.getComputedLayout();S+=E,$+=A;let G="";i==="img"?G=j({id:e,left:S,top:$,width:Z,height:tt,src:f.src,isInheritingTransform:u},p):G=V({id:e,left:S,top:$,width:Z,height:tt,isInheritingTransform:u},p);for(let _ of h)G+=_.next([S,$]).value;return G}var q=R(require("opentype.js")),M=class{constructor(r){this.fonts=new Map;for(let e of r){let o=e.data,a="buffer"in o?q.default.parse(o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)):q.default.parse(o);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(([n,i,f],[c,l,d])=>{if(i!==l)return i?!l||i===e?-1:l===e?1:e===400&&i===500||e===500&&i===400?-1:e===400&&l===500||e===500&&l===400?1:e<400?i<e&&l<e?l-i:i<e?-1:l<e?1:i-l:e<i&&e<l?i-l:e<i?-1:e<l?1:l-i:1;if(f!==d){if(f===o)return-1;if(d===o)return 1}return-1}),a[0][0]}measure(r,{fontFamily:e,fontSize:o,fontWeight:a=400,fontStyle:n="normal"}){let i=this.get({name:e,weight:a,style:n});return{width:i.getAdvanceWidth(r,o),ascent:i.ascender/i.unitsPerEm*o,descent:-(i.descender/i.unitsPerEm)*o}}getSVG(r,{fontFamily:e,fontSize:o,fontWeight:a=400,fontStyle:n="normal",top:i,left:f,letterSpacing:c=0}){return this.get({name:e,weight:a,style:n}).getPath(r,i,f,o,{letterSpacing:c/o}).toPathData(4)}};function K({width:t,height:r,content:e},o){return`<svg width="${t}" height="${r}" viewBox="0 0 ${t} ${r}" xmlns="http://www.w3.org/2000/svg">${e}</svg>`}function Q(t,r){let e=new M(r.fonts),o=C.default.Node.create();o.setWidth(r.width),o.setHeight(r.height),o.setFlexDirection(C.default.FLEX_DIRECTION_ROW),o.setFlexWrap(C.default.WRAP_WRAP);let a=k(t,{id:1,parentStyle:{},inheritedStyle:{fontSize:16,fontWeight:"normal",fontFamily:"serif",fontStyle:"normal",lineHeight:1.2,color:"black",opacity:1},parent:o,font:e});a.next(),o.calculateLayout(r.width,r.height,C.default.DIRECTION_LTR);let n=a.next([0,0]).value;return K({width:r.width,height:r.height,content:n})}module.exports=Tt(At);0&&(module.exports={}); |
{ | ||
"name": "satori", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A lightweight library to convert HTML JSX to SVG string.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
39294