modern-idoc 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -891,11 +891,17 @@ function getDefaultShadowStyle() {
891
891
 
892
892
  function normalizeShape(shape) {
893
893
  if (typeof shape === "string") {
894
- return {
895
- paths: [
896
- { data: shape }
897
- ]
898
- };
894
+ if (shape.startsWith("<svg")) {
895
+ return {
896
+ svg: shape
897
+ };
898
+ } else {
899
+ return {
900
+ paths: [
901
+ { data: shape }
902
+ ]
903
+ };
904
+ }
899
905
  } else if (Array.isArray(shape)) {
900
906
  return {
901
907
  paths: shape.map((data) => {
package/dist/index.d.cts CHANGED
@@ -456,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
456
  interface NormalizedShape {
457
457
  preset?: string;
458
458
  viewBox?: number[];
459
+ svg?: string;
459
460
  paths?: ShapePath[];
460
461
  }
461
462
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
package/dist/index.d.mts CHANGED
@@ -456,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
456
  interface NormalizedShape {
457
457
  preset?: string;
458
458
  viewBox?: number[];
459
+ svg?: string;
459
460
  paths?: ShapePath[];
460
461
  }
461
462
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
package/dist/index.d.ts CHANGED
@@ -456,6 +456,7 @@ interface ShapePath extends Partial<ShapePathStyle> {
456
456
  interface NormalizedShape {
457
457
  preset?: string;
458
458
  viewBox?: number[];
459
+ svg?: string;
459
460
  paths?: ShapePath[];
460
461
  }
461
462
  type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(o,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(o=typeof globalThis<"u"?globalThis:o||self,k(o.modernIdoc={}))})(this,function(o){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Yt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},J=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Q=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},j=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Ut=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Z=function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a}},tt=function(t){var e=t.h,r=t.s,n=t.v,a=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),F=n*(1-(1-e+l)*r),O=l%6;return{r:255*[n,d,c,c,F,n][O],g:255*[F,n,n,d,c,c][O],b:255*[c,c,F,n,n,d][O],a}},et=function(t){return{h:J(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},rt=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},nt=function(t){return tt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},D=function(t){return{h:(e=Z(t)).h,s:(a=(200-(r=e.s))*(n=e.v)/100)>0&&a<200?r*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:e.a};var e,r,n,a},qt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,it={string:[[function(t){var e=Ut.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Qt.exec(t)||Zt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Q({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=qt.exec(t)||Jt.exec(t);if(!e)return null;var r,n,a=et({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Yt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return nt(a)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=a===void 0?1:a;return S(e)&&S(r)&&S(n)?Q({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=et({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return nt(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:J(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return tt(c)},"hsv"]]},ot=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},te=function(t){return typeof t=="string"?ot(t.trim(),it.string):typeof t=="object"&&t!==null?ot(t,it.object):[null,void 0]},P=function(t,e){var r=D(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},W=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},at=function(t,e){var r=D(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},ut=function(){function t(e){this.parsed=te(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(W(this.rgba),2)},t.prototype.isDark=function(){return W(this.rgba)<.5},t.prototype.isLight=function(){return W(this.rgba)>=.5},t.prototype.toHex=function(){return e=j(this.rgba),r=e.r,n=e.g,a=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(a)+c;var e,r,n,a,l,c},t.prototype.toRgb=function(){return j(this.rgba)},t.prototype.toRgbString=function(){return e=j(this.rgba),r=e.r,n=e.g,a=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+a+", "+l+")":"rgb("+r+", "+n+", "+a+")";var e,r,n,a,l},t.prototype.toHsl=function(){return rt(D(this.rgba))},t.prototype.toHslString=function(){return e=rt(D(this.rgba)),r=e.h,n=e.s,a=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+a+"%, "+l+")":"hsl("+r+", "+n+"%, "+a+"%)";var e,r,n,a,l},t.prototype.toHsv=function(){return e=Z(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(P(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(P(this.rgba,-e))},t.prototype.grayscale=function(){return y(P(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(at(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(at(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=D(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof ut?t:new ut(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const a=t[n];a!=null&&(e?r[n]=w(a,e):r[n]=a)}return r}function M(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function ee(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const G="#000000FF";function lt(t){return M(t).isValid()}function v(t,e=!1){const r=M(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),G}const{r:n,g:a,b:l,a:c}=ee(r.rgba);return`#${V(n)}${V(a)}${V(l)}${V(C(c*255))}`}var T=T||{};T.parse=function(){const 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:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=a();return e.length>0&&r("Invalid input not EOF"),i}function a(){return x(l)}function l(){return c("linear-gradient",t.linearGradient,F)||c("repeating-linear-gradient",t.repeatingLinearGradient,F)||c("radial-gradient",t.radialGradient,Bt)||c("repeating-radial-gradient",t.repeatingRadialGradient,Bt)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:x(ce)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function F(){const i=O();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:ae()}function O(){return p("directional",t.sideOrCorner,1)}function ae(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function Bt(){let i,u=Kt(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Kt(),u?i.push(u):e=s)),i}function Kt(){let i=ue()||le();if(i)i.at=Y();else{const u=X();if(u){i=u;const s=Y();s&&(i.at=s)}else{const s=Y();if(s)i={type:"default-radial",at:s};else{const m=U();m&&(i={type:"default-radial",at:m})}}}return i}function ue(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Xt()||X()),i}function le(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=U()||H()||X()),i}function X(){return p("extent-keyword",t.extentKeywords,1)}function Y(){if(p("position",/^at/,0)){const i=U();return i||r("Missing positioning value"),i}}function U(){const i=se();if(i.x||i.y)return{type:"position",value:i}}function se(){return{x:H(),y:H()}}function x(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function ce(){const i=fe();return i||r("Expected color definition"),i.length=H(),i}function fe(){return ge()||be()||pe()||ve()||he()||me()||de()}function de(){return p("literal",t.literalColor,0)}function ge(){return p("hex",t.hexColor,1)}function he(){return d(t.rgbColor,()=>({type:"rgb",value:x(L)}))}function ve(){return d(t.rgbaColor,()=>({type:"rgba",value:x(L)}))}function me(){return d(t.varColor,()=>({type:"var",value:ye()}))}function pe(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function be(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function ye(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function H(){return p("%",t.percentageValue,1)||Se()||Ce()||Xt()}function Se(){return p("position-keyword",t.positionKeywords,1)}function Ce(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return q(u-1),{type:"calc",value:s}})}function Xt(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&q(s[0].length),u=i.exec(e),u&&q(u[0].length),u}function q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const st=T.parse.bind(T);var A=A||{};A.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),a=t.visit(e.style);return a&&(r+=" "+a),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,a=t.visit(r.length);return a&&(n+=" "+a),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(a,l){r+=t.visit(a),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const re=A.stringify.bind(A);function ct(t){const e=t.length-1;return t.map((r,n)=>{var d;const a=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0)});break;case"rgba":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0),a:Number(a[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(`#${r.value}`);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function ft(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:ct(t.colorStops)}}function dt(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:ct(t.colorStops)}}function I(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function gt(t){return st(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return ft(e);case"repeating-linear-gradient":return{...ft(e),repeat:!0};case"radial-gradient":return dt(e);case"repeating-radial-gradient":return{...dt(e),repeat:!0};default:return}}).filter(Boolean)}function ht(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function vt(t){let e;typeof t=="string"?e={image:t}:e=t;const{type:r,...n}=gt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}return{}}function mt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function pt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function bt(t){return!f(t.color)}function yt(t){return typeof t=="string"?lt(t):bt(t)}function St(t){return!f(t.image)&&I(t.image)}function Ct(t){return typeof t=="string"?I(t):St(t)}function wt(t){return!f(t.image)&&!I(t.image)}function zt(t){return typeof t=="string"?!I(t):wt(t)}function kt(t){return!f(t.preset)}function _t(t){return typeof t=="string"?!1:kt(t)}function _(t){if(yt(t))return ht(t);if(Ct(t))return vt(t);if(zt(t))return mt(t);if(_t(t))return pt(t);throw new Error("Unknown fill property object")}function Nt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function R(){return{color:G,offsetX:0,offsetY:0,blurRadius:1}}function $(t){return{...R(),...w({...t,color:f(t.color)?G:v(t.color)})}}function Ft(){return{...R(),scaleX:1,scaleY:1}}function Dt(t){return{...Ft(),...$(t)}}function ne(t){return t}function Gt(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:Dt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:$(t.innerShadow)})}function It(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function Ot(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function Lt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?G:v(t.color)}}function Et(){return{boxShadow:"none"}}function Vt(t){return typeof t=="string"?{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Tt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function At(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function xt(){return{...Tt(),...At(),...Et(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Ht(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function jt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function Pt(){return{...Ht(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Wt(){return{...jt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Mt(){return{...Wt(),...Pt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function ie(){return{...xt(),...Mt()}}function B(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Rt(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:B(t.content)}:{content:B(t)}}function $t(t){return typeof t=="string"?{src:t}:t}function K(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Rt(t.text),background:f(t.background)?void 0:Nt(t.background),shape:f(t.shape)?void 0:Vt(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:Ot(t.outline),foreground:f(t.foreground)?void 0:It(t.foreground),shadow:f(t.shadow)?void 0:Lt(t.shadow),video:f(t.video)?void 0:$t(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:Gt(t.effect),children:(e=t.children)==null?void 0:e.map(r=>K(r))})}function oe(t){return K(t)}o.clearUndef=w,o.defaultColor=G,o.getDefaultElementStyle=xt,o.getDefaultHighlightStyle=Ht,o.getDefaultInnerShadow=R,o.getDefaultLayoutStyle=Tt,o.getDefaultListStyleStyle=jt,o.getDefaultOuterShadow=Ft,o.getDefaultShadowStyle=Et,o.getDefaultStyle=ie,o.getDefaultTextInlineStyle=Pt,o.getDefaultTextLineStyle=Wt,o.getDefaultTextStyle=Mt,o.getDefaultTransformStyle=At,o.isColor=lt,o.isColorFill=yt,o.isColorFillObject=bt,o.isGradient=I,o.isGradientFill=Ct,o.isGradientFillObject=St,o.isImageFill=zt,o.isImageFillObject=wt,o.isNone=f,o.isPresetFill=_t,o.isPresetFillObject=kt,o.normalizeAudio=k,o.normalizeBackground=Nt,o.normalizeColor=v,o.normalizeColorFill=ht,o.normalizeDocument=oe,o.normalizeEffect=Gt,o.normalizeElement=K,o.normalizeFill=_,o.normalizeForeground=It,o.normalizeGradient=gt,o.normalizeGradientFill=vt,o.normalizeImageFill=mt,o.normalizeInnerShadow=$,o.normalizeOuterShadow=Dt,o.normalizeOutline=Ot,o.normalizePresetFill=pt,o.normalizeShadow=Lt,o.normalizeShape=Vt,o.normalizeSoftEdge=ne,o.normalizeStyle=N,o.normalizeText=Rt,o.normalizeTextContent=B,o.normalizeVideo=$t,o.parseColor=M,o.parseGradient=st,o.round=C,o.stringifyGradient=re,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(o=typeof globalThis<"u"?globalThis:o||self,k(o.modernIdoc={}))})(this,function(o){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Yt={grad:.9,turn:360,rad:360/(2*Math.PI)},S=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},h=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},J=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Q=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},W=function(t){return{r:h(t.r),g:h(t.g),b:h(t.b),a:h(t.a,3)}},Ut=/^#([0-9a-f]{3,8})$/i,E=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Z=function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=Math.max(e,r,n),c=l-Math.min(e,r,n),d=c?l===e?(r-n)/c:l===r?2+(n-e)/c:4+(e-r)/c:0;return{h:60*(d<0?d+6:d),s:l?c/l*100:0,v:l/255*100,a}},tt=function(t){var e=t.h,r=t.s,n=t.v,a=t.a;e=e/360*6,r/=100,n/=100;var l=Math.floor(e),c=n*(1-r),d=n*(1-(e-l)*r),F=n*(1-(1-e+l)*r),O=l%6;return{r:255*[n,d,c,c,F,n][O],g:255*[F,n,n,d,c,c][O],b:255*[c,c,F,n,n,d][O],a}},et=function(t){return{h:J(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},rt=function(t){return{h:h(t.h),s:h(t.s),l:h(t.l),a:h(t.a,3)}},nt=function(t){return tt((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},D=function(t){return{h:(e=Z(t)).h,s:(a=(200-(r=e.s))*(n=e.v)/100)>0&&a<200?r*n/100/(a<=100?a:200-a)*100:0,l:a/2,a:e.a};var e,r,n,a},qt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,it={string:[[function(t){var e=Ut.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?h(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?h(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Qt.exec(t)||Zt.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Q({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=qt.exec(t)||Jt.exec(t);if(!e)return null;var r,n,a=et({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Yt[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return nt(a)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,a=t.a,l=a===void 0?1:a;return S(e)&&S(r)&&S(n)?Q({r:Number(e),g:Number(r),b:Number(n),a:Number(l)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=et({h:Number(e),s:Number(r),l:Number(n),a:Number(l)});return nt(c)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,a=t.a,l=a===void 0?1:a;if(!S(e)||!S(r)||!S(n))return null;var c=function(d){return{h:J(d.h),s:b(d.s,0,100),v:b(d.v,0,100),a:b(d.a)}}({h:Number(e),s:Number(r),v:Number(n),a:Number(l)});return tt(c)},"hsv"]]},ot=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},te=function(t){return typeof t=="string"?ot(t.trim(),it.string):typeof t=="object"&&t!==null?ot(t,it.object):[null,void 0]},j=function(t,e){var r=D(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},P=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},at=function(t,e){var r=D(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},ut=function(){function t(e){this.parsed=te(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return h(P(this.rgba),2)},t.prototype.isDark=function(){return P(this.rgba)<.5},t.prototype.isLight=function(){return P(this.rgba)>=.5},t.prototype.toHex=function(){return e=W(this.rgba),r=e.r,n=e.g,a=e.b,c=(l=e.a)<1?E(h(255*l)):"","#"+E(r)+E(n)+E(a)+c;var e,r,n,a,l,c},t.prototype.toRgb=function(){return W(this.rgba)},t.prototype.toRgbString=function(){return e=W(this.rgba),r=e.r,n=e.g,a=e.b,(l=e.a)<1?"rgba("+r+", "+n+", "+a+", "+l+")":"rgb("+r+", "+n+", "+a+")";var e,r,n,a,l},t.prototype.toHsl=function(){return rt(D(this.rgba))},t.prototype.toHslString=function(){return e=rt(D(this.rgba)),r=e.h,n=e.s,a=e.l,(l=e.a)<1?"hsla("+r+", "+n+"%, "+a+"%, "+l+")":"hsl("+r+", "+n+"%, "+a+"%)";var e,r,n,a,l},t.prototype.toHsv=function(){return e=Z(this.rgba),{h:h(e.h),s:h(e.s),v:h(e.v),a:h(e.a,3)};var e},t.prototype.invert=function(){return y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),y(j(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),y(j(this.rgba,-e))},t.prototype.grayscale=function(){return y(j(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),y(at(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),y(at(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?y({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):h(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=D(this.rgba);return typeof e=="number"?y({h:e,s:r.s,l:r.l,a:r.a}):h(r.h)},t.prototype.isEqual=function(e){return this.toHex()===y(e).toHex()},t}(),y=function(t){return t instanceof ut?t:new ut(t)};function f(t){return t==null||t==="none"}function C(t,e=0,r=10**e){return Math.round(r*t)/r+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>w(n,e)):t;const r={};for(const n in t){const a=t[n];a!=null&&(e?r[n]=w(a,e):r[n]=a)}return r}function M(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,y(e)}function ee(t){return{r:C(t.r),g:C(t.g),b:C(t.b),a:C(t.a,3)}}function V(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const G="#000000FF";function lt(t){return M(t).isValid()}function v(t,e=!1){const r=M(t);if(!r.isValid()){if(typeof t=="string")return t;const d=`Failed to normalizeColor ${t}`;if(e)throw new Error(d);return console.warn(d),G}const{r:n,g:a,b:l,a:c}=ee(r.rgba);return`#${V(n)}${V(a)}${V(l)}${V(C(c*255))}`}var T=T||{};T.parse=function(){const 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:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function r(i){const u=new Error(`${e}: ${i}`);throw u.source=e,u}function n(){const i=a();return e.length>0&&r("Invalid input not EOF"),i}function a(){return x(l)}function l(){return c("linear-gradient",t.linearGradient,F)||c("repeating-linear-gradient",t.repeatingLinearGradient,F)||c("radial-gradient",t.radialGradient,Bt)||c("repeating-radial-gradient",t.repeatingRadialGradient,Bt)}function c(i,u,s){return d(u,m=>{const z=s();return z&&(g(t.comma)||r("Missing comma before color stops")),{type:i,orientation:z,colorStops:x(ce)}})}function d(i,u){const s=g(i);if(s){g(t.startCall)||r("Missing (");const m=u(s);return g(t.endCall)||r("Missing )"),m}}function F(){const i=O();if(i)return i;const u=p("position-keyword",t.positionKeywords,1);return u?{type:"directional",value:u.value}:ae()}function O(){return p("directional",t.sideOrCorner,1)}function ae(){return p("angular",t.angleValue,1)||p("angular",t.radianValue,1)}function Bt(){let i,u=Kt(),s;return u&&(i=[],i.push(u),s=e,g(t.comma)&&(u=Kt(),u?i.push(u):e=s)),i}function Kt(){let i=ue()||le();if(i)i.at=Y();else{const u=X();if(u){i=u;const s=Y();s&&(i.at=s)}else{const s=Y();if(s)i={type:"default-radial",at:s};else{const m=U();m&&(i={type:"default-radial",at:m})}}}return i}function ue(){const i=p("shape",/^(circle)/i,0);return i&&(i.style=Xt()||X()),i}function le(){const i=p("shape",/^(ellipse)/i,0);return i&&(i.style=U()||H()||X()),i}function X(){return p("extent-keyword",t.extentKeywords,1)}function Y(){if(p("position",/^at/,0)){const i=U();return i||r("Missing positioning value"),i}}function U(){const i=se();if(i.x||i.y)return{type:"position",value:i}}function se(){return{x:H(),y:H()}}function x(i){let u=i();const s=[];if(u)for(s.push(u);g(t.comma);)u=i(),u?s.push(u):r("One extra comma");return s}function ce(){const i=fe();return i||r("Expected color definition"),i.length=H(),i}function fe(){return ge()||be()||pe()||ve()||he()||me()||de()}function de(){return p("literal",t.literalColor,0)}function ge(){return p("hex",t.hexColor,1)}function he(){return d(t.rgbColor,()=>({type:"rgb",value:x(L)}))}function ve(){return d(t.rgbaColor,()=>({type:"rgba",value:x(L)}))}function me(){return d(t.varColor,()=>({type:"var",value:ye()}))}function pe(){return d(t.hslColor,()=>{g(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const u=L();g(t.comma);let s=g(t.percentageValue);const m=s?s[1]:null;g(t.comma),s=g(t.percentageValue);const z=s?s[1]:null;return(!m||!z)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[u,m,z]}})}function be(){return d(t.hslaColor,()=>{const i=L();g(t.comma);let u=g(t.percentageValue);const s=u?u[1]:null;g(t.comma),u=g(t.percentageValue);const m=u?u[1]:null;g(t.comma);const z=L();return(!s||!m)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[i,s,m,z]}})}function ye(){return g(t.variableName)[1]}function L(){return g(t.number)[1]}function H(){return p("%",t.percentageValue,1)||Se()||Ce()||Xt()}function Se(){return p("position-keyword",t.positionKeywords,1)}function Ce(){return d(t.calcValue,()=>{let i=1,u=0;for(;i>0&&u<e.length;){const m=e.charAt(u);m==="("?i++:m===")"&&i--,u++}i>0&&r("Missing closing parenthesis in calc() expression");const s=e.substring(0,u-1);return q(u-1),{type:"calc",value:s}})}function Xt(){return p("px",t.pixelValue,1)||p("em",t.emValue,1)}function p(i,u,s){const m=g(u);if(m)return{type:i,value:m[s]}}function g(i){let u,s;return s=/^\s+/.exec(e),s&&q(s[0].length),u=i.exec(e),u&&q(u[0].length),u}function q(i){e=e.substr(i)}return function(i){return e=i.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}}();const st=T.parse.bind(T);var A=A||{};A.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),a=t.visit(e.style);return a&&(r+=" "+a),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,r){var n=e,a=t.visit(r.length);return a&&(n+=" "+a),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(a,l){r+=t.visit(a),l<n-1&&(r+=", ")}),r},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const re=A.stringify.bind(A);function ct(t){const e=t.length-1;return t.map((r,n)=>{var d;const a=r.value;let l=C(n/e,3),c="#00000000";switch(r.type){case"rgb":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0)});break;case"rgba":c=v({r:Number(a[0]??0),g:Number(a[1]??0),b:Number(a[2]??0),a:Number(a[3]??0)});break;case"literal":c=v(r.value);break;case"hex":c=v(`#${r.value}`);break}switch((d=r.length)==null?void 0:d.type){case"%":l=Number(r.length.value)/100;break}return{offset:l,color:c}})}function ft(t){var r;let e=0;switch((r=t.orientation)==null?void 0:r.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:ct(t.colorStops)}}function dt(t){var e;return(e=t.orientation)==null||e.map(r=>{switch(r==null?void 0:r.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:ct(t.colorStops)}}function I(t){return t.startsWith("linear-gradient")||t.startsWith("radial-gradient")}function gt(t){return st(t).map(e=>{switch(e==null?void 0:e.type){case"linear-gradient":return ft(e);case"repeating-linear-gradient":return{...ft(e),repeat:!0};case"radial-gradient":return dt(e);case"repeating-radial-gradient":return{...dt(e),repeat:!0};default:return}}).filter(Boolean)}function ht(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:v(e.color)}}function vt(t){let e;typeof t=="string"?e={image:t}:e=t;const{type:r,...n}=gt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}return{}}function mt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function pt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:f(e.foregroundColor)?void 0:v(e.foregroundColor),backgroundColor:f(e.backgroundColor)?void 0:v(e.backgroundColor)}}function bt(t){return!f(t.color)}function yt(t){return typeof t=="string"?lt(t):bt(t)}function St(t){return!f(t.image)&&I(t.image)}function Ct(t){return typeof t=="string"?I(t):St(t)}function wt(t){return!f(t.image)&&!I(t.image)}function zt(t){return typeof t=="string"?!I(t):wt(t)}function kt(t){return!f(t.preset)}function _t(t){return typeof t=="string"?!1:kt(t)}function _(t){if(yt(t))return ht(t);if(Ct(t))return vt(t);if(zt(t))return mt(t);if(_t(t))return pt(t);throw new Error("Unknown fill property object")}function Nt(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function R(){return{color:G,offsetX:0,offsetY:0,blurRadius:1}}function $(t){return{...R(),...w({...t,color:f(t.color)?G:v(t.color)})}}function Ft(){return{...R(),scaleX:1,scaleY:1}}function Dt(t){return{...Ft(),...$(t)}}function ne(t){return t}function Gt(t){return w({...t,softEdge:f(t.softEdge)?void 0:t.softEdge,outerShadow:f(t.outerShadow)?void 0:Dt(t.outerShadow),innerShadow:f(t.innerShadow)?void 0:$(t.innerShadow)})}function It(t){return typeof t=="string"?{..._(t),fillWithShape:!1}:{..._(t),fillWithShape:!!t.fillWithShape}}function Ot(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?void 0:v(t.color)}}function Lt(t){return typeof t=="string"?{color:v(t)}:{...t,color:f(t.color)?G:v(t.color)}}function Et(){return{boxShadow:"none"}}function Vt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Tt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function At(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function xt(){return{...Tt(),...At(),...Et(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function Ht(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function Wt(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function jt(){return{...Ht(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function Pt(){return{...Wt(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Mt(){return{...Pt(),...jt(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function N(t){return w({...t,color:f(t.color)?void 0:v(t.color),backgroundColor:f(t.backgroundColor)?void 0:v(t.backgroundColor),borderColor:f(t.borderColor)?void 0:v(t.borderColor),outlineColor:f(t.outlineColor)?void 0:v(t.outlineColor),shadowColor:f(t.shadowColor)?void 0:v(t.shadowColor)})}function ie(){return{...xt(),...Mt()}}function B(t=""){return(Array.isArray(t)?t:[t]).map(r=>typeof r=="string"?{fragments:[{content:r}]}:"content"in r?{fragments:[N(r)]}:"fragments"in r?{...N(r),fragments:r.fragments.map(n=>N(n))}:Array.isArray(r)?{fragments:r.map(n=>typeof n=="string"?{content:n}:N(n))}:{fragments:[]})}function Rt(t){return typeof t=="string"?{content:[{fragments:[{content:t}]}]}:"content"in t?{...t,content:B(t.content)}:{content:B(t)}}function $t(t){return typeof t=="string"?{src:t}:t}function K(t){var e;return w({...t,style:f(t.style)?void 0:N(t.style),text:f(t.text)?void 0:Rt(t.text),background:f(t.background)?void 0:Nt(t.background),shape:f(t.shape)?void 0:Vt(t.shape),fill:f(t.fill)?void 0:_(t.fill),outline:f(t.outline)?void 0:Ot(t.outline),foreground:f(t.foreground)?void 0:It(t.foreground),shadow:f(t.shadow)?void 0:Lt(t.shadow),video:f(t.video)?void 0:$t(t.video),audio:f(t.audio)?void 0:k(t.audio),effect:f(t.effect)?void 0:Gt(t.effect),children:(e=t.children)==null?void 0:e.map(r=>K(r))})}function oe(t){return K(t)}o.clearUndef=w,o.defaultColor=G,o.getDefaultElementStyle=xt,o.getDefaultHighlightStyle=Ht,o.getDefaultInnerShadow=R,o.getDefaultLayoutStyle=Tt,o.getDefaultListStyleStyle=Wt,o.getDefaultOuterShadow=Ft,o.getDefaultShadowStyle=Et,o.getDefaultStyle=ie,o.getDefaultTextInlineStyle=jt,o.getDefaultTextLineStyle=Pt,o.getDefaultTextStyle=Mt,o.getDefaultTransformStyle=At,o.isColor=lt,o.isColorFill=yt,o.isColorFillObject=bt,o.isGradient=I,o.isGradientFill=Ct,o.isGradientFillObject=St,o.isImageFill=zt,o.isImageFillObject=wt,o.isNone=f,o.isPresetFill=_t,o.isPresetFillObject=kt,o.normalizeAudio=k,o.normalizeBackground=Nt,o.normalizeColor=v,o.normalizeColorFill=ht,o.normalizeDocument=oe,o.normalizeEffect=Gt,o.normalizeElement=K,o.normalizeFill=_,o.normalizeForeground=It,o.normalizeGradient=gt,o.normalizeGradientFill=vt,o.normalizeImageFill=mt,o.normalizeInnerShadow=$,o.normalizeOuterShadow=Dt,o.normalizeOutline=Ot,o.normalizePresetFill=pt,o.normalizeShadow=Lt,o.normalizeShape=Vt,o.normalizeSoftEdge=ne,o.normalizeStyle=N,o.normalizeText=Rt,o.normalizeTextContent=B,o.normalizeVideo=$t,o.parseColor=M,o.parseGradient=st,o.round=C,o.stringifyGradient=re,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/dist/index.mjs CHANGED
@@ -889,11 +889,17 @@ function getDefaultShadowStyle() {
889
889
 
890
890
  function normalizeShape(shape) {
891
891
  if (typeof shape === "string") {
892
- return {
893
- paths: [
894
- { data: shape }
895
- ]
896
- };
892
+ if (shape.startsWith("<svg")) {
893
+ return {
894
+ svg: shape
895
+ };
896
+ } else {
897
+ return {
898
+ paths: [
899
+ { data: shape }
900
+ ]
901
+ };
902
+ }
897
903
  } else if (Array.isArray(shape)) {
898
904
  return {
899
905
  paths: shape.map((data) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.6.5",
4
+ "version": "0.6.6",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",