@svgsketch/core 0.1.0

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.mjs ADDED
@@ -0,0 +1,14 @@
1
+ var dt=(S=>(S.LINEAR="linear",S.EASE="ease",S.EASE_IN="ease-in",S.EASE_OUT="ease-out",S.EASE_IN_OUT="ease-in-out",S.EASE_IN_QUAD="ease-in-quad",S.EASE_OUT_QUAD="ease-out-quad",S.EASE_IN_OUT_QUAD="ease-in-out-quad",S.EASE_IN_CUBIC="ease-in-cubic",S.EASE_OUT_CUBIC="ease-out-cubic",S.EASE_IN_OUT_CUBIC="ease-in-out-cubic",S.EASE_IN_QUART="ease-in-quart",S.EASE_OUT_QUART="ease-out-quart",S.EASE_IN_OUT_QUART="ease-in-out-quart",S.EASE_IN_SINE="ease-in-sine",S.EASE_OUT_SINE="ease-out-sine",S.EASE_IN_OUT_SINE="ease-in-out-sine",S.EASE_IN_BACK="ease-in-back",S.EASE_OUT_BACK="ease-out-back",S.EASE_IN_OUT_BACK="ease-in-out-back",S))(dt||{}),ue={linear:null,ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1],"ease-in-quad":[.55,.085,.68,.53],"ease-out-quad":[.25,.46,.45,.94],"ease-in-out-quad":[.455,.03,.515,.955],"ease-in-cubic":[.55,.055,.675,.19],"ease-out-cubic":[.215,.61,.355,1],"ease-in-out-cubic":[.645,.045,.355,1],"ease-in-quart":[.895,.03,.685,.22],"ease-out-quart":[.165,.84,.44,1],"ease-in-out-quart":[.77,0,.175,1],"ease-in-sine":[.47,0,.745,.715],"ease-out-sine":[.39,.575,.565,1],"ease-in-out-sine":[.445,.05,.55,.95],"ease-in-back":[.6,-.28,.735,.045],"ease-out-back":[.175,.885,.32,1.275],"ease-in-out-back":[.68,-.55,.265,1.55]};function hn(r){let e=ue[r];return e?`cubic-bezier(${e.join(", ")})`:"linear"}var dn=[{value:"click",label:"Click"},{value:"mouseenter",label:"Mouse Enter"},{value:"mouseleave",label:"Mouse Leave"},{value:"focus",label:"Focus"},{value:"blur",label:"Blur"},{value:"load",label:"Page Load"}];var pt=(l=>(l.LINEAR="linear",l.QUADRATIC="quadratic",l.CUBIC="cubic",l.CATMULL_ROM="catmull-rom",l.ARC="arc",l.BASIS="basis",l.MIXED="mixed",l))(pt||{}),Dt=(n=>(n.SMOOTH="smooth",n.CORNER="corner",n.SYMMETRIC="symmetric",n))(Dt||{});var A=1;function ce(r){let e=JSON.parse(JSON.stringify(r)),t=e.schemaVersion??1;if(t>=A)return e.schemaVersion=e.schemaVersion??A,e;for(;t<A;)console.warn(`[svgsketch/core] No migration path from schema version ${t}`),t=A,t++;return e.schemaVersion=A,e}var Bt=new Set(["circle","rectangle","square","ellipse","text","triangle","ngon","star","cross","ring","spiral","gear","arrow","line","spline","polyline","image"]);function q(r){let e=[],t=[];if(r==null||typeof r!="object")return e.push({path:"",message:"Snapshot must be a non-null object",severity:"error"}),{valid:!1,errors:e,warnings:t};let n=r;if(n.schemaVersion!==void 0&&(typeof n.schemaVersion!="number"||!Number.isInteger(n.schemaVersion)?e.push({path:"schemaVersion",message:"schemaVersion must be an integer",severity:"error"}):n.schemaVersion>A&&t.push({path:"schemaVersion",message:`schemaVersion ${n.schemaVersion} is newer than supported (${A})`,severity:"warning"})),!Array.isArray(n.shapes))e.push({path:"shapes",message:"shapes must be an array",severity:"error"});else{let s=new Set;n.shapes.forEach((a,o)=>{Lt(a,`shapes[${o}]`,e,t,s)})}if(!Array.isArray(n.viewboxes))e.push({path:"viewboxes",message:"viewboxes must be an array",severity:"error"});else{let s=new Set;n.viewboxes.forEach((a,o)=>{Nt(a,`viewboxes[${o}]`,e,t,s)})}return n.guides!==void 0&&(Array.isArray(n.guides)?n.guides.forEach((s,a)=>{Ut(s,`guides[${a}]`,e,t)}):e.push({path:"guides",message:"guides must be an array",severity:"error"})),n.groups!==void 0&&(Array.isArray(n.groups)?n.groups.forEach((s,a)=>{zt(s,`groups[${a}]`,e)}):e.push({path:"groups",message:"groups must be an array",severity:"error"})),n.clipMaskGroups!==void 0&&(Array.isArray(n.clipMaskGroups)?n.clipMaskGroups.forEach((s,a)=>{Wt(s,`clipMaskGroups[${a}]`,e)}):e.push({path:"clipMaskGroups",message:"clipMaskGroups must be an array",severity:"error"})),n.measurements!==void 0&&(Array.isArray(n.measurements)||e.push({path:"measurements",message:"measurements must be an array",severity:"error"})),{valid:e.length===0,errors:e,warnings:t}}function Lt(r,e,t,n,s){if(r===null||typeof r!="object"){t.push({path:e,message:"Shape must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Shape id must be a non-empty string",severity:"error"}):s.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate shape id: "${a.id}"`,severity:"error"}):s.add(a.id),typeof a.type!="string"?t.push({path:`${e}.type`,message:"Shape type must be a string",severity:"error"}):Bt.has(a.type)||n.push({path:`${e}.type`,message:`Unknown shape type: "${a.type}"`,severity:"warning"}),a.state===void 0||a.state===null||typeof a.state!="object"?t.push({path:`${e}.state`,message:"Shape state must be a non-null object",severity:"error"}):Vt(a.state,`${e}.state`,t,n)}function Vt(r,e,t,n){let s=["x","y","width","height","radius","rx","ry","rotation","fontSize"];for(let o of s)r[o]!==void 0&&(typeof r[o]!="number"||!isFinite(r[o]))&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});let a=["width","height","radius","fontSize"];for(let o of a){let l=r[o];typeof l=="number"&&l<=0&&n.push({path:`${e}.${o}`,message:`${o} should be positive (got ${l})`,severity:"warning"})}}function Nt(r,e,t,n,s){if(r===null||typeof r!="object"){t.push({path:e,message:"Viewbox must be a non-null object",severity:"error"});return}let a=r;typeof a.id!="string"||a.id.length===0?t.push({path:`${e}.id`,message:"Viewbox id must be a non-empty string",severity:"error"}):s.has(a.id)?t.push({path:`${e}.id`,message:`Duplicate viewbox id: "${a.id}"`,severity:"error"}):s.add(a.id);for(let o of["x","y","width","height"])(typeof a[o]!="number"||!isFinite(a[o]))&&t.push({path:`${e}.${o}`,message:`${o} must be a finite number`,severity:"error"});typeof a.width=="number"&&a.width<=0&&t.push({path:`${e}.width`,message:"Viewbox width must be positive",severity:"error"}),typeof a.height=="number"&&a.height<=0&&t.push({path:`${e}.height`,message:"Viewbox height must be positive",severity:"error"})}function Ut(r,e,t,n){if(r===null||typeof r!="object"){t.push({path:e,message:"Guide must be a non-null object",severity:"error"});return}let s=r;(typeof s.id!="string"||s.id.length===0)&&t.push({path:`${e}.id`,message:"Guide id must be a non-empty string",severity:"error"}),s.orientation!=="horizontal"&&s.orientation!=="vertical"&&t.push({path:`${e}.orientation`,message:'Guide orientation must be "horizontal" or "vertical"',severity:"error"}),(typeof s.position!="number"||!isFinite(s.position))&&t.push({path:`${e}.position`,message:"Guide position must be a finite number",severity:"error"})}function zt(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"Group must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"Group id must be a non-empty string",severity:"error"}),n.parentId!==null&&typeof n.parentId!="string"&&t.push({path:`${e}.parentId`,message:"Group parentId must be a string or null",severity:"error"})}function Wt(r,e,t){if(r===null||typeof r!="object"){t.push({path:e,message:"ClipMaskGroup must be a non-null object",severity:"error"});return}let n=r;(typeof n.id!="string"||n.id.length===0)&&t.push({path:`${e}.id`,message:"ClipMaskGroup id must be a non-empty string",severity:"error"}),n.type!=="clip"&&n.type!=="mask"&&t.push({path:`${e}.type`,message:'ClipMaskGroup type must be "clip" or "mask"',severity:"error"}),(typeof n.clipShapeId!="string"||n.clipShapeId.length===0)&&t.push({path:`${e}.clipShapeId`,message:"clipShapeId must be a non-empty string",severity:"error"}),Array.isArray(n.contentShapeIds)||t.push({path:`${e}.contentShapeIds`,message:"contentShapeIds must be an array",severity:"error"})}function $(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`id-${crypto.randomUUID()}`:`id-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function he(r={}){let e={schemaVersion:A,shapes:r.shapes?r.shapes.map(t=>({...t})):[],viewboxes:r.viewboxes?r.viewboxes.map(t=>({...t})):[]};return r.metadata&&(e.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{},...r.metadata}),e}function jt(r){let{type:e,id:t,...n}=r,s={};for(let[a,o]of Object.entries(n))o!==void 0&&(s[a]=o);return{id:t??$(),type:e,state:s}}function Z(r,e,t,n,s){return{id:s??$(),x:r,y:e,width:t,height:n}}var Ht=["schemaVersion","documentMetadata","templateVariables","viewboxes","guides","measurements","groups","clipMaskGroups","animationTimeline","shapes"];function de(r,e={}){let{indent:t=2,trailingNewline:n=!0,validate:s=!1}=e;if(s){let l=q(r);if(!l.valid){let u=l.errors.map(c=>` ${c.path}: ${c.message}`).join(`
2
+ `);throw new Error(`Invalid document:
3
+ ${u}`)}}let a={};for(let l of Ht){let u=r[l];if(u!==void 0)switch(l){case"shapes":a[l]=mt(u).map(Xt);break;case"viewboxes":case"guides":case"measurements":case"groups":case"clipMaskGroups":a[l]=mt(u).map(j);break;case"documentMetadata":a[l]=j(u);break;case"animationTimeline":a[l]=j(u);break;default:a[l]=u}}let o=JSON.stringify(a,null,t);return n?o+`
4
+ `:o}function pe(r,e={}){let{validate:t=!0,migrate:n=!0}=e,s;try{s=JSON.parse(r)}catch(o){throw new Error(`Failed to parse .svgs document: ${o.message}`)}if(s===null||typeof s!="object"||Array.isArray(s))throw new Error("Invalid .svgs document: root must be a JSON object");let a=s;if(n&&(a=ce(a)),t){let o=q(a);if(!o.valid){let l=o.errors.map(u=>` ${u.path}: ${u.message}`).join(`
5
+ `);throw new Error(`Invalid .svgs document:
6
+ ${l}`)}}return a}function mt(r){return[...r].sort((e,t)=>e.id.localeCompare(t.id))}function j(r){if(r==null)return r;if(Array.isArray(r))return r.map(j);if(typeof r!="object")return r;let e={},t=Object.keys(r).sort();for(let n of t)e[n]=j(r[n]);return e}function Xt(r){let e={};return e.id=r.id,e.type=r.type,e.state=j(r.state),e}var F=/\{\{\s*([\w.\-]+)\s*\}\}/g;function me(r,e){return r.replace(F,(t,n)=>{let s=e[n];return s!==void 0?String(s):t})}function fe(r,e={}){let t={};if(r.templateVariables)for(let s of r.templateVariables)s.defaultValue!==void 0&&s.defaultValue!==""&&(t[s.name]=s.defaultValue);if(Object.assign(t,e),Object.keys(t).length===0)return JSON.parse(JSON.stringify(r));let n=JSON.parse(JSON.stringify(r));for(let s of n.shapes)Q(s.state,t);if(n.documentMetadata){let s=n.documentMetadata;Q(s,t)}return n}function Q(r,e){for(let t of Object.keys(r)){let n=r[t];if(typeof n=="string"){if(F.lastIndex=0,F.test(n)){F.lastIndex=0;let s=me(n,e);if(Yt(n)){let a=Number(s);if(!isNaN(a)&&Zt(t)){r[t]=a;continue}}r[t]=s}}else if(Array.isArray(n))for(let s=0;s<n.length;s++)typeof n[s]=="string"?(F.lastIndex=0,F.test(n[s])&&(F.lastIndex=0,n[s]=me(n[s],e))):n[s]!==null&&typeof n[s]=="object"&&Q(n[s],e);else n!==null&&typeof n=="object"&&Q(n,e)}}function Yt(r){return/^\s*\{\{\s*[\w.\-]+\s*\}\}\s*$/.test(r)}var qt=new Set(["x","y","width","height","radius","rx","ry","cx","cy","x1","y1","x2","y2","fontSize","borderWidth","cornerRadius","opacity","fillOpacity","strokeOpacity","rotation","skewX","skewY","scaleX","scaleY","letterSpacing","wordSpacing","lineHeight","sides","arms","innerRadiusPercent","armWidthPercent","teeth","toothDepthPercent","holeRadiusPercent","turns","thicknessPercent","direction","headWidthPercent","headLengthPercent","shaftWidthPercent","shiftAngle","dashLength","gapLength","textPathStartOffset","imageOpacity"]);function Zt(r){return qt.has(r)}function ge(r){let e=r.templateVariables??[],t=new Set(e.map(a=>a.name)),n=new Set;for(let a of r.shapes)K(a.state,n);r.documentMetadata&&K(r.documentMetadata,n);let s=[...n].filter(a=>!t.has(a)).sort();return{defined:[...e],undeclared:s}}function K(r,e){for(let t of Object.values(r))if(typeof t=="string"){let n;for(F.lastIndex=0;(n=F.exec(t))!==null;)e.add(n[1])}else if(Array.isArray(t))for(let n of t)if(typeof n=="string"){let s;for(F.lastIndex=0;(s=F.exec(n))!==null;)e.add(s[1])}else n!==null&&typeof n=="object"&&K(n,e);else t!==null&&typeof t=="object"&&K(t,e)}function Qt(r){let e={};for(let t of r){let n=t.indexOf("=");if(n===-1)throw new Error(`Invalid variable format: "${t}". Expected "name=value".`);let s=t.slice(0,n).trim(),a=t.slice(n+1);if(!s)throw new Error(`Invalid variable format: "${t}". Variable name cannot be empty.`);e[s]=a}return e}function ee(r,e,t=-90){let n=[],s=t*Math.PI/180;for(let a=0;a<r;a++){let o=s+a*2*Math.PI/r;n.push({x:e*Math.cos(o),y:e*Math.sin(o)})}return n}function be(r,e,t,n=-90){let s=[],a=e*(t/100),o=n*Math.PI/180;for(let l=0;l<r*2;l++){let u=o+l*Math.PI/r,c=l%2===0?e:a;s.push({x:c*Math.cos(u),y:c*Math.sin(u)})}return s}function xe(r,e,t=0){let n=r*(e/100)/2,s=[{x:-n,y:-r},{x:n,y:-r},{x:n,y:-n},{x:r,y:-n},{x:r,y:n},{x:n,y:n},{x:n,y:r},{x:-n,y:r},{x:-n,y:n},{x:-r,y:n},{x:-r,y:-n},{x:-n,y:-n}];if(t===0)return s;let a=Math.cos(t*Math.PI/180),o=Math.sin(t*Math.PI/180);return s.map(l=>({x:l.x*a-l.y*o,y:l.x*o+l.y*a}))}function _e(r,e,t,n,s=-90){let o=r*2*(t/100),l=r*(e/100),u=l*(n/100),c=[{x:r,y:0},{x:r-o,y:-l/2},{x:r-o,y:-u/2},{x:-r,y:-u/2},{x:-r,y:u/2},{x:r-o,y:u/2},{x:r-o,y:l/2}];if(s===0)return c;let d=Math.cos(s*Math.PI/180),m=Math.sin(s*Math.PI/180);return c.map(h=>({x:h.x*d-h.y*m,y:h.x*m+h.y*d}))}function N(r,e=0,t=0){if(r.length<3)return"";if(e<=0)return r.map((a,o)=>(o===0?"M":"L")+`${a.x},${a.y}`).join(" ")+" Z";let n=Math.min(e,t*.4),s="";for(let a=0;a<r.length;a++){let o=r[(a-1+r.length)%r.length],l=r[a],u=r[(a+1)%r.length],c={x:o.x-l.x,y:o.y-l.y},d=Math.hypot(c.x,c.y);c.x/=d,c.y/=d;let m={x:u.x-l.x,y:u.y-l.y},h=Math.hypot(m.x,m.y);m.x/=h,m.y/=h;let f=Math.min(n,d/2),g=Math.min(n,h/2),y={x:l.x+c.x*f,y:l.y+c.y*f},b={x:l.x+m.x*g,y:l.y+m.y*g};s+=a===0?`M${y.x},${y.y}`:` L${y.x},${y.y}`,s+=` Q${l.x},${l.y} ${b.x},${b.y}`}return s+" Z"}function Se(r,e,t="evenodd"){let n=r*(e/100),s=t==="nonzero"?1:0;return`M ${r} 0 A ${r} ${r} 0 1 1 ${-r} 0 A ${r} ${r} 0 1 1 ${r} 0 Z M ${n} 0 A ${n} ${n} 0 1 ${s} ${-n} 0 A ${n} ${n} 0 1 ${s} ${n} 0 Z`}function ke(r,e,t,n=1,s=0){let a=r*(t/100),l=Math.round(e*36),u=e*2*Math.PI,c=(r-a/2)/u,d=s*Math.PI/180,m=[],h=[];for(let y=0;y<=l;y++){let b=y/l,k=b*u*n+d,_=c*(b*u)+a/2,x=a/2;m.push({x:(_+x*.3)*Math.cos(k),y:(_+x*.3)*Math.sin(k)}),h.push({x:Math.max(0,_-x*.3)*Math.cos(k),y:Math.max(0,_-x*.3)*Math.sin(k)})}let f=`M ${m[0].x} ${m[0].y}`;for(let y=1;y<m.length;y++)f+=` L ${m[y].x} ${m[y].y}`;let g=h[h.length-1];f+=` L ${g.x} ${g.y}`;for(let y=h.length-2;y>=0;y--)f+=` L ${h[y].x} ${h[y].y}`;return f+=" Z",f}function $t(r,e,t,n=0){let s=e*(t/100),a=e,o=e-s,l=2*Math.PI/r,u=l*.4,c=l*.1,d=n*Math.PI/180,m=[];for(let h=0;h<r;h++){let f=d+h*l;m.push({x:o*Math.cos(f),y:o*Math.sin(f)}),m.push({x:a*Math.cos(f+c),y:a*Math.sin(f+c)}),m.push({x:a*Math.cos(f+c+u),y:a*Math.sin(f+c+u)}),m.push({x:o*Math.cos(f+l-c),y:o*Math.sin(f+l-c)})}return m}function we(r,e,t,n=0,s=0,a="evenodd",o=0){let l=$t(r,e,t,o),u=Math.min(n,e*.1),c=N(l,u,e);if(s>0){let d=e*(s/100),m=a==="nonzero"?1:0;c+=` M ${d} 0 A ${d} ${d} 0 1 ${m} ${-d} 0 A ${d} ${d} 0 1 ${m} ${d} 0 Z`}return c}function Te(r,e,t,n,s,a="round",o="uniform",l){let u=Math.min(t,n)/2,c,d,m,h,f,g,y,b;if(o==="non-uniform"&&l?(c=Math.min(l.radiusTL??s,u),d=Math.min(l.radiusTR??s,u),m=Math.min(l.radiusBR??s,u),h=Math.min(l.radiusBL??s,u),f=l.shapeTL??a,g=l.shapeTR??a,y=l.shapeBR??a,b=l.shapeBL??a):(c=d=m=h=Math.min(s,u),f=g=y=b=a),!(a!=="round"||o==="non-uniform"||c>0&&f!=="round"||d>0&&g!=="round"||m>0&&y!=="round"||h>0&&b!=="round")&&c===d&&d===m&&m===h)return null;let _=`M${r+c},${e}`;return _+=` L${r+t-d},${e}`,_+=J(g,d,r+t,e,"tr"),_+=` L${r+t},${e+n-m}`,_+=J(y,m,r+t,e+n,"br"),_+=` L${r+h},${e+n}`,_+=J(b,h,r,e+n,"bl"),_+=` L${r},${e+c}`,_+=J(f,c,r,e,"tl"),_+=" Z",_}function J(r,e,t,n,s){if(e<=0)return"";switch(r){case"round":switch(s){case"tr":return` A${e},${e} 0 0 1 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 1 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 1 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 1 ${t+e},${n}`}break;case"scoop":switch(s){case"tr":return` A${e},${e} 0 0 0 ${t},${n+e}`;case"br":return` A${e},${e} 0 0 0 ${t-e},${n}`;case"bl":return` A${e},${e} 0 0 0 ${t},${n-e}`;case"tl":return` A${e},${e} 0 0 0 ${t+e},${n}`}break;case"bevel":switch(s){case"tr":return` L${t},${n+e}`;case"br":return` L${t-e},${n}`;case"bl":return` L${t},${n-e}`;case"tl":return` L${t+e},${n}`}break;case"notch":switch(s){case"tr":return` L${t-e},${n+e} L${t},${n+e}`;case"br":return` L${t-e},${n-e} L${t-e},${n}`;case"bl":return` L${t+e},${n-e} L${t},${n-e}`;case"tl":return` L${t+e},${n+e} L${t+e},${n}`}break}return""}function ve(r,e,t=!1,n=.5,s){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";switch(e){case"LINEAR":case"linear":return ft(r,t);case"QUADRATIC":case"quadratic":return Kt(r,t);case"CUBIC":case"cubic":return Jt(r,t);case"ARC":case"arc":return er(r,t,s);case"MIXED":case"mixed":return gt(r,t);case"CATMULL_ROM":case"catmull-rom":return tr(r,t,n);case"BASIS":case"basis":return rr(r,t);default:return r.some(a=>a.segmentType)?gt(r,t):ft(r,t)}}function ft(r,e){let t=`M ${r[0].x} ${r[0].y}`,n=0;for(let s=1;s<r.length;s++)r[s].isSubpathStart?(e&&s-n>2&&(t+=" Z"),t+=` M ${r[s].x} ${r[s].y}`,n=s):t+=` L ${r[s].x} ${r[s].y}`;return e&&r.length-n>2&&(t+=" Z"),t}function Kt(r,e){let t=`M ${r[0].x} ${r[0].y}`,n=0;for(let s=0;s<r.length-1;s++){let a=r[s],o=r[s+1];if(o.isSubpathStart){if(e&&s-n>=1){let u=r[n],c=a.handleOut??{x:(a.x+u.x)/2,y:(a.y+u.y)/2};t+=` Q ${c.x} ${c.y} ${u.x} ${u.y} Z`}t+=` M ${o.x} ${o.y}`,n=s+1;continue}let l=a.handleOut??{x:(a.x+o.x)/2,y:(a.y+o.y)/2};t+=` Q ${l.x} ${l.y} ${o.x} ${o.y}`}if(e&&r.length-n>1){let s=r[r.length-1],a=r[n],o=s.handleOut??{x:(s.x+a.x)/2,y:(s.y+a.y)/2};t+=` Q ${o.x} ${o.y} ${a.x} ${a.y} Z`}return t}function Jt(r,e){let t=`M ${r[0].x} ${r[0].y}`,n=0;for(let s=0;s<r.length-1;s++){let a=r[s],o=r[s+1];if(o.isSubpathStart){if(e&&s-n>=1){let c=r[n],d=a.handleOut??{x:a.x,y:a.y},m=c.handleIn??{x:c.x,y:c.y};t+=` C ${d.x} ${d.y} ${m.x} ${m.y} ${c.x} ${c.y} Z`}t+=` M ${o.x} ${o.y}`,n=s+1;continue}let l=a.handleOut??{x:a.x,y:a.y},u=o.handleIn??{x:o.x,y:o.y};t+=` C ${l.x} ${l.y} ${u.x} ${u.y} ${o.x} ${o.y}`}if(e&&r.length-n>1){let s=r[r.length-1],a=r[n],o=s.handleOut??{x:s.x,y:s.y},l=a.handleIn??{x:a.x,y:a.y};t+=` C ${o.x} ${o.y} ${l.x} ${l.y} ${a.x} ${a.y} Z`}return t}function er(r,e,t){let n=`M ${r[0].x} ${r[0].y}`,s=0,a={rx:50,ry:50,rotation:0,largeArc:!1,sweep:!0};for(let o=0;o<r.length-1;o++){let l=r[o+1];if(l.isSubpathStart){if(e&&o-s>=1){let c=r[s],d=t?.[o]??a;n+=` A ${d.rx} ${d.ry} ${d.rotation} ${d.largeArc?1:0} ${d.sweep?1:0} ${c.x} ${c.y} Z`}n+=` M ${l.x} ${l.y}`,s=o+1;continue}let u=t?.[o]??a;n+=` A ${u.rx} ${u.ry} ${u.rotation} ${u.largeArc?1:0} ${u.sweep?1:0} ${l.x} ${l.y}`}if(e&&r.length-s>1){let o=r[s],l=t?.[r.length-1]??a;n+=` A ${l.rx} ${l.ry} ${l.rotation} ${l.largeArc?1:0} ${l.sweep?1:0} ${o.x} ${o.y} Z`}return n}function gt(r,e){let t=`M ${r[0].x} ${r[0].y}`,n=0;for(let s=0;s<r.length-1;s++){let a=r[s],o=r[s+1];if(o.isSubpathStart){if(e&&s-n>=1){let l=r[n];t+=$e(a,l,l.segmentType),t+=" Z"}t+=` M ${o.x} ${o.y}`,n=s+1;continue}t+=$e(a,o,o.segmentType)}if(e&&r.length-n>1){let s=r[r.length-1],a=r[n];t+=$e(s,a,a.segmentType),t+=" Z"}return t}function $e(r,e,t){let n=(t??(r.handleOut||e.handleIn?"CUBIC":"LINEAR")).toUpperCase();if(n==="LINEAR")return` L ${e.x} ${e.y}`;if(n==="QUADRATIC"){let o=r.handleOut??{x:(r.x+e.x)/2,y:(r.y+e.y)/2};return` Q ${o.x} ${o.y} ${e.x} ${e.y}`}if(n==="ARC"){let o=e.arcParams;return o?` A ${o.rx} ${o.ry} ${o.rotation} ${o.largeArc?1:0} ${o.sweep?1:0} ${e.x} ${e.y}`:` L ${e.x} ${e.y}`}let s=r.handleOut??{x:r.x,y:r.y},a=e.handleIn??{x:e.x,y:e.y};return` C ${s.x} ${s.y} ${a.x} ${a.y} ${e.x} ${e.y}`}function tr(r,e,t){if(r.length<2)return r.length===1?`M ${r[0].x} ${r[0].y}`:"";let n=t,s=e?[r[r.length-1],...r,r[0],r[1]]:[r[0],...r,r[r.length-1]],a=`M ${r[0].x} ${r[0].y}`,o=e?r.length:r.length-1;for(let l=0;l<o;l++){let u=s[l],c=s[l+1],d=s[l+2],m=s[l+3],h=Math.hypot(d.x-c.x,d.y-c.y),f=Math.hypot(c.x-u.x,c.y-u.y),g=Math.hypot(m.x-d.x,m.y-d.y),y=Math.pow(f,n),b=Math.pow(h,n),k=Math.pow(g,n),_=Math.pow(f,2*n),x=Math.pow(h,2*n),S=Math.pow(g,2*n),T,R,P,v;f<1e-8?(T=c.x,R=c.y):(T=(_*d.x-x*u.x+(2*_+3*y*b+x)*c.x)/(3*y*(y+b)),R=(_*d.y-x*u.y+(2*_+3*y*b+x)*c.y)/(3*y*(y+b))),g<1e-8?(P=d.x,v=d.y):(P=(S*c.x-x*m.x+(2*S+3*k*b+x)*d.x)/(3*k*(k+b)),v=(S*c.y-x*m.y+(2*S+3*k*b+x)*d.y)/(3*k*(k+b))),a+=` C ${T} ${R} ${P} ${v} ${d.x} ${d.y}`}return e&&(a+=" Z"),a}function rr(r,e){let t=r.length;if(t<2)return t===1?`M ${r[0].x} ${r[0].y}`:"";if(t===2)return`M ${r[0].x} ${r[0].y} L ${r[1].x} ${r[1].y}`;if(e){let a=(r[0].x+4*r[1].x+r[2].x)/6,o=(r[0].y+4*r[1].y+r[2].y)/6,l=`M ${a} ${o}`;for(let u=0;u<t;u++){let c=r[(u+1)%t],d=r[(u+2)%t],m=r[(u+3)%t];l+=ye(c,d,m)}return l+=" Z",l}let n=r,s=`M ${n[0].x} ${n[0].y}`;s+=` L ${(5*n[0].x+n[1].x)/6} ${(5*n[0].y+n[1].y)/6}`;for(let a=0;a<=t-3;a++)s+=ye(n[a],n[a+1],n[a+2]);return s+=ye(n[t-2],n[t-1],n[t-1]),s+=` L ${n[t-1].x} ${n[t-1].y}`,s}function ye(r,e,t){return` C ${(2*r.x+e.x)/3} ${(2*r.y+e.y)/3} ${(r.x+2*e.x)/3} ${(r.y+2*e.y)/3} ${(r.x+4*e.x+t.x)/6} ${(r.y+4*e.y+t.y)/6}`}function X(r,e,t){let n=Number.isFinite(e)?Math.max(1,e):8,s=Number.isFinite(t)?Math.max(1,t):4;switch(r){case"dashed":case"dotted":case"custom":return`${n} ${s}`;default:return null}}function M(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function nr(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function te(r){let e=new Map,t=r.state,n=t;switch(r.type){case"circle":e.set("cx",String(t.x??0)),e.set("cy",String(t.y??0)),e.set("r",String(t.radius??50));break;case"ellipse":e.set("cx",String(t.cx??0)),e.set("cy",String(t.cy??0)),e.set("rx",String(t.rx??50)),e.set("ry",String(t.ry??30));break;case"rectangle":case"square":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),(t.cornerRadius??0)>0&&e.set("rx",String(t.cornerRadius));break;case"line":e.set("x1",String(t.x1??0)),e.set("y1",String(t.y1??0)),e.set("x2",String(t.x2??0)),e.set("y2",String(t.y2??0));break;case"text":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),t.fontSize&&e.set("font-size",String(t.fontSize)),t.fontFamily&&e.set("font-family",t.fontFamily),t.fontWeight&&e.set("font-weight",t.fontWeight),t.fontStyle&&e.set("font-style",t.fontStyle),t.textAnchor&&e.set("text-anchor",t.textAnchor),t.letterSpacing&&e.set("letter-spacing",String(t.letterSpacing));break;case"image":e.set("x",String(t.x??0)),e.set("y",String(t.y??0)),e.set("width",String(t.width??100)),e.set("height",String(t.height??100)),n.href&&e.set("href",String(n.href));break}let s=nr(n);s==="none"?e.set("fill","none"):s==="linear-gradient"||s==="radial-gradient"?e.set("fill",`url(#gradient-fill-${r.id})`):s==="pattern"?e.set("fill",`url(#pattern-fill-${r.id})`):e.set("fill",t.fillColor??"#000000");let a=t.opacity;a!==void 0&&a<1&&e.set("opacity",String(a));let o=t.fillOpacity;o!==void 0&&o<1&&e.set("fill-opacity",String(o)),t.fillRule&&t.fillRule!=="nonzero"&&e.set("fill-rule",t.fillRule);let l=n.strokeType??"solid";if(l==="none")e.set("stroke","none");else if(l==="linear-gradient"||l==="radial-gradient")e.set("stroke",`url(#gradient-stroke-${r.id})`);else{let x=t.borderColor??"none";x!=="none"&&e.set("stroke",x)}let u=t.borderWidth;u!=null&&u!==0&&e.set("stroke-width",String(u));let c=t.strokeOpacity;c!==void 0&&c<1&&e.set("stroke-opacity",String(c));let d=t.lineStyle??"solid",m=t.dashLength??8,h=t.gapLength??4,f=X(d,m,h);f&&(e.set("stroke-dasharray",f),d==="dotted"&&e.set("stroke-linecap","round"));let g=sr(n);g&&e.set("transform",g);let y=n.filters;y&&y.length>0&&e.set("filter",`url(#filter-${r.id})`);let b=n.startEndpoint,k=n.endEndpoint;b&&b!=="none"&&e.set("marker-start",`url(#line-marker-${b})`),k&&k!=="none"&&e.set("marker-end",`url(#line-marker-${k})`);let _=n.metadata;return _&&(_.role&&e.set("role",_.role),_.ariaLabel&&e.set("aria-label",_.ariaLabel)),e}function yt(r){switch(r.type){case"circle":return"circle";case"ellipse":return"ellipse";case"rectangle":case"square":return"rect";case"line":return"line";case"text":return"text";case"image":return"image";case"spline":case"polyline":case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":return"path";default:return"g"}}function sr(r){let e=r.rotation??0,t=r.skewX??0,n=r.skewY??0,s=r.scaleX??1,a=r.scaleY??1;if(e===0&&t===0&&n===0&&s===1&&a===1)return null;let o=r.customPivot;if(!o)return null;let l=[];return l.push(`translate(${o.x}, ${o.y})`),e!==0&&l.push(`rotate(${e})`),(s!==1||a!==1)&&l.push(`scale(${s}, ${a})`),t!==0&&l.push(`skewX(${t})`),n!==0&&l.push(`skewY(${n})`),l.push(`translate(${-o.x}, ${-o.y})`),l.join(" ")}function G(r,e){let t=r.viewboxes?.[0];return{width:e.width??t?.width??800,height:e.height??t?.height??600}}function i(r,e){return e==null||e===""?"":` ${r}="${M(String(e))}"`}function re(r){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return e?{r:parseInt(e[1],16)/255,g:parseInt(e[2],16)/255,b:parseInt(e[3],16)/255}:{r:0,g:0,b:0}}function ir(r,e,t){let{offsetX:n,offsetY:s,blurRadius:a,spread:o,color:l,opacity:u}=r,c="";if(o===0)c+=`<feDropShadow${i("in",e)}${i("dx",n)}${i("dy",s)}${i("stdDeviation",a/2)}${i("flood-color",l)}${i("flood-opacity",u)}${i("result",`${t}_shadow`)}/>`,c+=`<feMerge${i("result",t)}><feMergeNode${i("in",`${t}_shadow`)}/><feMergeNode${i("in",e)}/></feMerge>`;else{c+=`<feColorMatrix${i("in",e)}${i("type","matrix")}${i("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${i("result",`${t}_alpha`)}/>`;let d=o>0?"dilate":"erode",m=Math.abs(o);c+=`<feMorphology${i("in",`${t}_alpha`)}${i("operator",d)}${i("radius",m)}${i("result",`${t}_spread`)}/>`,c+=`<feGaussianBlur${i("in",`${t}_spread`)}${i("stdDeviation",a/2)}${i("result",`${t}_blur`)}/>`,c+=`<feOffset${i("in",`${t}_blur`)}${i("dx",n)}${i("dy",s)}${i("result",`${t}_offset`)}/>`,c+=`<feFlood${i("flood-color",l)}${i("flood-opacity",u)}${i("result",`${t}_color`)}/>`,c+=`<feComposite${i("in",`${t}_color`)}${i("in2",`${t}_offset`)}${i("operator","in")}${i("result",`${t}_shadow`)}/>`,c+=`<feMerge${i("result",t)}><feMergeNode${i("in",`${t}_shadow`)}/><feMergeNode${i("in",e)}/></feMerge>`}return c}function ar(r,e,t){let{offsetX:n,offsetY:s,blurRadius:a,choke:o,color:l,opacity:u}=r,c=a*(1-o/100),d="";return d+=`<feColorMatrix${i("in",e)}${i("type","matrix")}${i("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${i("result",`${t}_alpha`)}/>`,d+=`<feComponentTransfer${i("in",`${t}_alpha`)}${i("result",`${t}_inverted`)}><feFuncA${i("type","table")}${i("tableValues","1 0")}/></feComponentTransfer>`,d+=`<feGaussianBlur${i("in",`${t}_inverted`)}${i("stdDeviation",c/2)}${i("result",`${t}_blur`)}/>`,d+=`<feOffset${i("in",`${t}_blur`)}${i("dx",n)}${i("dy",s)}${i("result",`${t}_offset`)}/>`,d+=`<feFlood${i("flood-color",l)}${i("flood-opacity",u)}${i("result",`${t}_color`)}/>`,d+=`<feComposite${i("in",`${t}_color`)}${i("in2",`${t}_offset`)}${i("operator","in")}${i("result",`${t}_coloredShadow`)}/>`,d+=`<feComposite${i("in",`${t}_coloredShadow`)}${i("in2",`${t}_alpha`)}${i("operator","in")}${i("result",`${t}_innerShadow`)}/>`,d+=`<feComposite${i("in",`${t}_innerShadow`)}${i("in2",e)}${i("operator","over")}${i("result",t)}/>`,d}function or(r,e,t){let{blurX:n,blurY:s}=r;return n===0&&s===0?w(e,t):`<feGaussianBlur${i("in",e)}${i("stdDeviation",`${n/2} ${s/2}`)}${i("result",t)}/>`}function lr(r,e,t){let{distance:n,angle:s}=r;if(n===0)return w(e,t);let a=s*Math.PI/180,o=Math.abs(Math.cos(a)*n),l=Math.abs(Math.sin(a)*n);return`<feGaussianBlur${i("in",e)}${i("stdDeviation",`${o/2} ${l/2}`)}${i("result",t)}/>`}function bt(r,e,t){let{x:n,y:s,z:a,color:o,surfaceScale:l,diffuseConstant:u,specularConstant:c,specularExponent:d}=r,m="";return m+=`<feDiffuseLighting${i("in","SourceAlpha")}${i("surfaceScale",l)}${i("diffuseConstant",u)}${i("lighting-color",o)}${i("result",`${t}_diffuse`)}>`,m+=`<fePointLight${i("x",n)}${i("y",s)}${i("z",a)}/>`,m+="</feDiffuseLighting>",m+=`<feSpecularLighting${i("in","SourceAlpha")}${i("surfaceScale",l)}${i("specularConstant",c)}${i("specularExponent",d)}${i("lighting-color",o)}${i("result",`${t}_specular`)}>`,m+=`<fePointLight${i("x",n)}${i("y",s)}${i("z",a)}/>`,m+="</feSpecularLighting>",m+=`<feComposite${i("in",e)}${i("in2",`${t}_diffuse`)}${i("operator","arithmetic")}${i("k1",1)}${i("k2",0)}${i("k3",0)}${i("k4",0)}${i("result",`${t}_lit`)}/>`,m+=`<feComposite${i("in",`${t}_specular`)}${i("in2",`${t}_lit`)}${i("operator","arithmetic")}${i("k1",0)}${i("k2",1)}${i("k3",1)}${i("k4",0)}${i("result",t)}/>`,m}function xt(r,e,t){let{x:n,y:s,z:a,pointsAtX:o,pointsAtY:l,pointsAtZ:u,coneAngle:c,color:d,surfaceScale:m,specularConstant:h,specularExponent:f}=r,g="";return g+=`<feSpecularLighting${i("in","SourceAlpha")}${i("surfaceScale",m)}${i("specularConstant",h)}${i("specularExponent",f)}${i("lighting-color",d)}${i("result",`${t}_specular`)}>`,g+=`<feSpotLight${i("x",n)}${i("y",s)}${i("z",a)}${i("pointsAtX",o)}${i("pointsAtY",l)}${i("pointsAtZ",u)}${i("limitingConeAngle",c)}/>`,g+="</feSpecularLighting>",g+=`<feComposite${i("in",`${t}_specular`)}${i("in2","SourceAlpha")}${i("operator","in")}${i("result",`${t}_clipped`)}/>`,g+=`<feComposite${i("in",`${t}_clipped`)}${i("in2",e)}${i("operator","arithmetic")}${i("k1",0)}${i("k2",1)}${i("k3",1)}${i("k4",0)}${i("result",t)}/>`,g}function ur(r,e,t){let{width:n,color:s,opacity:a,position:o}=r,l="";if(o==="inside")l+=`<feMorphology${i("in","SourceAlpha")}${i("operator","erode")}${i("radius",n)}${i("result",`${t}_eroded`)}/>`,l+=`<feComposite${i("in","SourceAlpha")}${i("in2",`${t}_eroded`)}${i("operator","out")}${i("result",`${t}_outlineAlpha`)}/>`,l+=`<feFlood${i("flood-color",s)}${i("flood-opacity",a)}${i("result",`${t}_color`)}/>`,l+=`<feComposite${i("in",`${t}_color`)}${i("in2",`${t}_outlineAlpha`)}${i("operator","in")}${i("result",`${t}_outline`)}/>`,l+=`<feComposite${i("in",`${t}_outline`)}${i("in2",e)}${i("operator","over")}${i("result",t)}/>`;else{let u=o==="outside"?n:n/2;l+=`<feMorphology${i("in","SourceAlpha")}${i("operator","dilate")}${i("radius",u)}${i("result",`${t}_dilated`)}/>`,l+=`<feComposite${i("in",`${t}_dilated`)}${i("in2","SourceAlpha")}${i("operator","out")}${i("result",`${t}_outlineAlpha`)}/>`,l+=`<feFlood${i("flood-color",s)}${i("flood-opacity",a)}${i("result",`${t}_color`)}/>`,l+=`<feComposite${i("in",`${t}_color`)}${i("in2",`${t}_outlineAlpha`)}${i("operator","in")}${i("result",`${t}_outline`)}/>`,l+=`<feMerge${i("result",t)}><feMergeNode${i("in",`${t}_outline`)}/><feMergeNode${i("in",e)}/></feMerge>`}return l}function cr(r,e,t){let{amount:n}=r;if(n===0)return w(e,t);let s=1+4*n,a=-n,o=[0,a,0,a,s,a,0,a,0].join(" ");return`<feConvolveMatrix${i("in",e)}${i("order","3")}${i("kernelMatrix",o)}${i("divisor","1")}${i("bias","0")}${i("preserveAlpha","true")}${i("edgeMode","duplicate")}${i("result",t)}/>`}function hr(r,e,t){let{blockSize:n}=r;if(n<=1)return w(e,t);let s=n/2,a="";return a+=`<feMorphology${i("in",e)}${i("operator","erode")}${i("radius",s)}${i("result",`${t}_eroded`)}/>`,a+=`<feMorphology${i("in",`${t}_eroded`)}${i("operator","dilate")}${i("radius",s)}${i("result",t)}/>`,a}function dr(r,e,t){let{scale:n,frequency:s,octaves:a,warpType:o}=r;if(n===0)return w(e,t);let l="";return l+=`<feTurbulence${i("type",o)}${i("baseFrequency",s)}${i("numOctaves",a)}${i("seed",0)}${i("result",`${t}_turbulence`)}/>`,l+=`<feDisplacementMap${i("in",e)}${i("in2",`${t}_turbulence`)}${i("scale",n)}${i("xChannelSelector","R")}${i("yChannelSelector","G")}${i("result",t)}/>`,l}function pr(r,e,t){let{operator:n,radiusX:s,radiusY:a}=r;return s===0&&a===0?w(e,t):`<feMorphology${i("in",e)}${i("operator",n)}${i("radius",`${s} ${a}`)}${i("result",t)}/>`}function mr(r,e,t){let{levels:n}=r;if(n<2)return w(e,t);let s=[];for(let l=0;l<n;l++)s.push(l/(n-1));let a=s.join(" "),o=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return o+=`<feFuncR${i("type","discrete")}${i("tableValues",a)}/>`,o+=`<feFuncG${i("type","discrete")}${i("tableValues",a)}/>`,o+=`<feFuncB${i("type","discrete")}${i("tableValues",a)}/>`,o+="</feComponentTransfer>",o}function fr(r,e,t){let{levels:n,contrast:s}=r;if(n<2)return w(e,t);let a=[];for(let u=0;u<n;u++){let c=u/(n-1),d=c;s!==1&&(d=.5+(c-.5)*s,d=Math.max(0,Math.min(1,d))),a.push(d)}let o=a.join(" "),l=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return l+=`<feFuncR${i("type","table")}${i("tableValues",o)}/>`,l+=`<feFuncG${i("type","table")}${i("tableValues",o)}/>`,l+=`<feFuncB${i("type","table")}${i("tableValues",o)}/>`,l+="</feComponentTransfer>",l}function gr(r,e,t){let{radius:n}=r;if(n===0)return w(e,t);let s="";return s+=`<feGaussianBlur${i("in","SourceAlpha")}${i("stdDeviation",n)}${i("result",`${t}_blurredAlpha`)}/>`,s+=`<feComponentTransfer${i("in",`${t}_blurredAlpha`)}${i("result",`${t}_thresholdAlpha`)}><feFuncA${i("type","linear")}${i("slope",20)}${i("intercept",-9)}/></feComponentTransfer>`,s+=`<feComposite${i("in",e)}${i("in2",`${t}_thresholdAlpha`)}${i("operator","in")}${i("result",t)}/>`,s}function $r(r,e,t){let{amount:n}=r;if(n===0)return w(e,t);let s=1-n;return`<feColorMatrix${i("in",e)}${i("type","saturate")}${i("values",s)}${i("result",t)}/>`}function yr(r,e,t){let{red:n,green:s,blue:a}=r;if(n===1&&s===1&&a===1)return w(e,t);let o=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return o+=`<feFuncR${i("type","linear")}${i("slope",n)}${i("intercept",0)}/>`,o+=`<feFuncG${i("type","linear")}${i("slope",s)}${i("intercept",0)}/>`,o+=`<feFuncB${i("type","linear")}${i("slope",a)}${i("intercept",0)}/>`,o+="</feComponentTransfer>",o}function br(r,e,t){let{amount:n}=r;if(n===1)return w(e,t);let s=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return s+=`<feFuncR${i("type","linear")}${i("slope",n)}${i("intercept",0)}/>`,s+=`<feFuncG${i("type","linear")}${i("slope",n)}${i("intercept",0)}/>`,s+=`<feFuncB${i("type","linear")}${i("slope",n)}${i("intercept",0)}/>`,s+="</feComponentTransfer>",s}function xr(r,e,t){let{amount:n}=r;if(n===1)return w(e,t);let s=.5*(1-n),a=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return a+=`<feFuncR${i("type","linear")}${i("slope",n)}${i("intercept",s)}/>`,a+=`<feFuncG${i("type","linear")}${i("slope",n)}${i("intercept",s)}/>`,a+=`<feFuncB${i("type","linear")}${i("slope",n)}${i("intercept",s)}/>`,a+="</feComponentTransfer>",a}function _r(r,e,t){let{amount:n}=r;if(n===1)return w(e,t);let s=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return s+=`<feFuncA${i("type","linear")}${i("slope",n)}${i("intercept",0)}/>`,s+="</feComponentTransfer>",s}function Sr(r,e,t){let{amount:n}=r;if(n===0)return w(e,t);let s=n,a=1-n,o=`${s} ${a}`,l=`<feComponentTransfer${i("in",e)}${i("result",t)}>`;return l+=`<feFuncR${i("type","table")}${i("tableValues",o)}/>`,l+=`<feFuncG${i("type","table")}${i("tableValues",o)}/>`,l+=`<feFuncB${i("type","table")}${i("tableValues",o)}/>`,l+="</feComponentTransfer>",l}function kr(r,e,t){let{angle:n}=r;return n===0||n===360?w(e,t):`<feColorMatrix${i("in",e)}${i("type","hueRotate")}${i("values",n)}${i("result",t)}/>`}function wr(r,e,t){let{amount:n}=r;return n===1?w(e,t):`<feColorMatrix${i("in",e)}${i("type","saturate")}${i("values",n)}${i("result",t)}/>`}function Tr(r,e,t){let{threshold:n}=r,s="";if(s+=`<feColorMatrix${i("in",e)}${i("type","saturate")}${i("values",0)}${i("result",`${t}_gray`)}/>`,n===.5)s+=`<feComponentTransfer${i("in",`${t}_gray`)}${i("result",t)}>`,s+=`<feFuncR${i("type","discrete")}${i("tableValues","0 1")}/>`,s+=`<feFuncG${i("type","discrete")}${i("tableValues","0 1")}/>`,s+=`<feFuncB${i("type","discrete")}${i("tableValues","0 1")}/>`,s+="</feComponentTransfer>";else{let o=[];for(let u=0;u<256;u++)o.push(u/255<n?0:1);let l=o.join(" ");s+=`<feComponentTransfer${i("in",`${t}_gray`)}${i("result",t)}>`,s+=`<feFuncR${i("type","table")}${i("tableValues",l)}/>`,s+=`<feFuncG${i("type","table")}${i("tableValues",l)}/>`,s+=`<feFuncB${i("type","table")}${i("tableValues",l)}/>`,s+="</feComponentTransfer>"}return s}function vr(r,e,t){let{amount:n}=r;if(n===0)return w(e,t);let s=[.393,.769,.189,0,0],a=[.349,.686,.168,0,0],o=[.272,.534,.131,0,0],l=[1,0,0,0,0],u=[0,1,0,0,0],c=[0,0,1,0,0],d=(y,b)=>y.map((k,_)=>k*(1-n)+b[_]*n),m=d(l,s),h=d(u,a),f=d(c,o),g=[...m,...h,...f,0,0,0,1,0].join(" ");return`<feColorMatrix${i("in",e)}${i("type","matrix")}${i("values",g)}${i("result",t)}/>`}function Pr(r,e,t){let{shadowColor:n,highlightColor:s}=r,a=re(n),o=re(s),l="";return l+=`<feColorMatrix${i("in",e)}${i("type","saturate")}${i("values",0)}${i("result",`${t}_gray`)}/>`,l+=`<feComponentTransfer${i("in",`${t}_gray`)}${i("result",t)}>`,l+=`<feFuncR${i("type","table")}${i("tableValues",`${a.r} ${o.r}`)}/>`,l+=`<feFuncG${i("type","table")}${i("tableValues",`${a.g} ${o.g}`)}/>`,l+=`<feFuncB${i("type","table")}${i("tableValues",`${a.b} ${o.b}`)}/>`,l+="</feComponentTransfer>",l}function Mr(r,e,t){let{intensity:n}=r;if(n===0)return w(e,t);let s="";s+=`<feComponentTransfer${i("in",e)}${i("result",`${t}_invert`)}>`,s+=`<feFuncR${i("type","table")}${i("tableValues","1 0")}/>`,s+=`<feFuncG${i("type","table")}${i("tableValues","1 0")}/>`,s+=`<feFuncB${i("type","table")}${i("tableValues","1 0")}/>`,s+="</feComponentTransfer>",s+=`<feColorMatrix${i("in",`${t}_invert`)}${i("type","saturate")}${i("values",0)}${i("result",`${t}_gray`)}/>`;let a=[.1,.1,.1,0,0],o=[.3,.4,.3,0,0],l=[.5,.5,.8,0,0],u=[1,0,0,0,0],c=[0,1,0,0,0],d=[0,0,1,0,0],m=(b,k)=>b.map((_,x)=>_*(1-n)+k[x]*n),h=m(u,a),f=m(c,o),g=m(d,l),y=[...h,...f,...g,0,0,0,1,0].join(" ");return s+=`<feColorMatrix${i("in",`${t}_gray`)}${i("type","matrix")}${i("values",y)}${i("result",t)}/>`,s}function Cr(r,e,t){let{amount:n,scale:s}=r;if(n===0)return w(e,t);let a=1/s,o="";return o+=`<feTurbulence${i("type","fractalNoise")}${i("baseFrequency",a)}${i("numOctaves",3)}${i("seed",0)}${i("result",`${t}_noise`)}/>`,o+=`<feColorMatrix${i("in",`${t}_noise`)}${i("type","saturate")}${i("values",0)}${i("result",`${t}_noiseGray`)}/>`,o+=`<feBlend${i("in",e)}${i("in2",`${t}_noiseGray`)}${i("mode","overlay")}${i("result",`${t}_blended`)}/>`,o+=`<feComposite${i("in",`${t}_blended`)}${i("in2",e)}${i("operator","arithmetic")}${i("k1",0)}${i("k2",n)}${i("k3",1-n)}${i("k4",0)}${i("result",`${t}_amt`)}/>`,o+=`<feComposite${i("in",`${t}_amt`)}${i("in2",e)}${i("operator","in")}${i("result",t)}/>`,o}function Rr(r,e,t){let{strength:n,angle:s}=r;if(n===0)return w(e,t);let a=s*Math.PI/180,o=Math.cos(a),l=Math.sin(a),u=n,c=[-(u*(o+l)),-(u*l),u*(-o+l),-(u*o),1,u*o,u*(o-l),u*l,u*(o+l)].join(" ");return`<feConvolveMatrix${i("in",e)}${i("order","3 3")}${i("kernelMatrix",c)}${i("divisor",1)}${i("bias",.5)}${i("preserveAlpha","true")}${i("result",t)}/>`}function Ar(r,e,t){let{amount:n,size:s}=r;if(n===0)return w(e,t);let a=.5/s,o="";return o+=`<feTurbulence${i("type","fractalNoise")}${i("baseFrequency",`${a} ${a}`)}${i("numOctaves",5)}${i("seed",0)}${i("stitchTiles","stitch")}${i("result",`${t}_grain`)}/>`,o+=`<feColorMatrix${i("in",`${t}_grain`)}${i("type","saturate")}${i("values",0)}${i("result",`${t}_grainGray`)}/>`,o+=`<feBlend${i("in",e)}${i("in2",`${t}_grainGray`)}${i("mode","soft-light")}${i("result",`${t}_blended`)}/>`,o+=`<feComposite${i("in",`${t}_blended`)}${i("in2",e)}${i("operator","arithmetic")}${i("k1",0)}${i("k2",n)}${i("k3",1-n)}${i("k4",0)}${i("result",`${t}_amt`)}/>`,o+=`<feComposite${i("in",`${t}_amt`)}${i("in2",e)}${i("operator","in")}${i("result",t)}/>`,o}function Fr(r,e,t){let{wetness:n,turbulence:s}=r;if(n===0&&s===0)return w(e,t);let a="";return a+=`<feTurbulence${i("type","fractalNoise")}${i("baseFrequency",.02+s*.03)}${i("numOctaves",4)}${i("seed",42)}${i("result",`${t}_turb`)}/>`,a+=`<feDisplacementMap${i("in",e)}${i("in2",`${t}_turb`)}${i("scale",n*15)}${i("xChannelSelector","R")}${i("yChannelSelector","G")}${i("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${i("in",`${t}_disp`)}${i("stdDeviation",n*2)}${i("result",`${t}_blur`)}/>`,a+=`<feBlend${i("in",`${t}_blur`)}${i("in2",e)}${i("mode","multiply")}${i("result",t)}/>`,a}function Er(r,e,t){let{thickness:n,texture:s}=r;if(n===0&&s===0)return w(e,t);let a="";a+=`<feTurbulence${i("type","turbulence")}${i("baseFrequency",.03+s*.02)}${i("numOctaves",3)}${i("seed",1e3)}${i("result",`${t}_brush`)}/>`;let o=Math.max(3,8-Math.floor(n*5)),l=Array.from({length:o+1},(u,c)=>c/o).join(" ");a+=`<feComponentTransfer${i("in",e)}${i("result",`${t}_poster`)}>`;for(let u of["R","G","B"])a+=`<feFunc${u}${i("type","discrete")}${i("tableValues",l)}/>`;return a+="</feComponentTransfer>",a+=`<feDisplacementMap${i("in",`${t}_poster`)}${i("in2",`${t}_brush`)}${i("scale",s*4)}${i("xChannelSelector","R")}${i("yChannelSelector","G")}${i("result",`${t}_disp`)}/>`,a+=`<feMorphology${i("in",`${t}_disp`)}${i("operator","dilate")}${i("radius",n*.5)}${i("result",`${t}_thick`)}/>`,a+=`<feComposite${i("in",`${t}_thick`)}${i("in2",e)}${i("operator","in")}${i("result",t)}/>`,a}function Ir(r,e,t){let{spread:n,edges:s}=r;if(n===0&&s===0)return w(e,t);let a="";return a+=`<feTurbulence${i("type","fractalNoise")}${i("baseFrequency",.01+s*.02)}${i("numOctaves",5)}${i("seed",1100)}${i("result",`${t}_ink`)}/>`,a+=`<feMorphology${i("in",e)}${i("operator","dilate")}${i("radius",n*3)}${i("result",`${t}_dilate`)}/>`,a+=`<feDisplacementMap${i("in",`${t}_dilate`)}${i("in2",`${t}_ink`)}${i("scale",s*10)}${i("xChannelSelector","R")}${i("yChannelSelector","G")}${i("result",`${t}_disp`)}/>`,a+=`<feGaussianBlur${i("in",`${t}_disp`)}${i("stdDeviation",n*.5)}${i("result",t)}/>`,a}function Gr(r,e,t){let{wrinkles:n,shine:s}=r;if(n===0&&s===0)return w(e,t);let a="";return a+=`<feTurbulence${i("type","turbulence")}${i("baseFrequency",.02)}${i("numOctaves",4)}${i("seed",1200)}${i("result",`${t}_wrinkle`)}/>`,a+=`<feDisplacementMap${i("in",e)}${i("in2",`${t}_wrinkle`)}${i("scale",n*15)}${i("xChannelSelector","R")}${i("yChannelSelector","G")}${i("result",`${t}_disp`)}/>`,a+=`<feSpecularLighting${i("in",`${t}_wrinkle`)}${i("surfaceScale",n*2)}${i("specularConstant",s*1.5)}${i("specularExponent",20)}${i("result",`${t}_sheen`)}>`,a+=`<feDistantLight${i("azimuth",45)}${i("elevation",60)}/>`,a+="</feSpecularLighting>",a+=`<feBlend${i("in",`${t}_disp`)}${i("in2",`${t}_sheen`)}${i("mode","screen")}${i("result",`${t}_blend`)}/>`,a+=`<feComposite${i("in",`${t}_blend`)}${i("in2",e)}${i("operator","in")}${i("result",t)}/>`,a}function Or(r,e,t){let{density:n,size:s}=r;if(n===0)return w(e,t);let a="",o=1-n;a+=`<feTurbulence${i("type","turbulence")}${i("baseFrequency",.1/s)}${i("numOctaves",1)}${i("seed",1400)}${i("result",`${t}_hole`)}/>`,a+=`<feComponentTransfer${i("in",`${t}_hole`)}${i("result",`${t}_thresh`)}>`;for(let l of["R","G","B","A"])a+=`<feFunc${l}${i("type","linear")}${i("slope",10)}${i("intercept",-o*10+5)}/>`;a+="</feComponentTransfer>",a+=`<feComponentTransfer${i("in",`${t}_thresh`)}${i("result",`${t}_clamp`)}>`;for(let l of["R","G","B","A"])a+=`<feFunc${l}${i("type","table")}${i("tableValues","0 0 1 1")}/>`;return a+="</feComponentTransfer>",a+=`<feComposite${i("in",e)}${i("in2",`${t}_clamp`)}${i("operator","in")}${i("result",t)}/>`,a}function Dr(r,e,t){let{color:n,radius:s,intensity:a}=r;if(a===0||s===0)return w(e,t);let{r:o,g:l,b:u}=re(n),c="";return c+=`<feColorMatrix${i("in",e)}${i("type","matrix")}${i("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${i("result",`${t}_alpha`)}/>`,c+=`<feGaussianBlur${i("in",`${t}_alpha`)}${i("stdDeviation",s/2)}${i("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${i("in",`${t}_blur`)}${i("type","matrix")}${i("values",`0 0 0 0 ${o} 0 0 0 0 ${l} 0 0 0 0 ${u} 0 0 0 ${a} 0`)}${i("result",`${t}_color`)}/>`,c+=`<feMerge${i("result",t)}><feMergeNode${i("in",`${t}_color`)}/><feMergeNode${i("in",e)}/></feMerge>`,c}function Br(r,e,t){let{color:n,radius:s,intensity:a}=r;if(a===0||s===0)return w(e,t);let{r:o,g:l,b:u}=re(n),c="";return c+=`<feColorMatrix${i("in",e)}${i("type","matrix")}${i("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0")}${i("result",`${t}_alpha`)}/>`,c+=`<feMorphology${i("in",`${t}_alpha`)}${i("operator","erode")}${i("radius",s/4)}${i("result",`${t}_erode`)}/>`,c+=`<feComposite${i("in",`${t}_alpha`)}${i("in2",`${t}_erode`)}${i("operator","out")}${i("result",`${t}_edge`)}/>`,c+=`<feGaussianBlur${i("in",`${t}_edge`)}${i("stdDeviation",s/3)}${i("result",`${t}_blur`)}/>`,c+=`<feColorMatrix${i("in",`${t}_blur`)}${i("type","matrix")}${i("values",`0 0 0 0 ${o} 0 0 0 0 ${l} 0 0 0 0 ${u} 0 0 0 ${a*2} 0`)}${i("result",`${t}_color`)}/>`,c+=`<feComposite${i("in",`${t}_color`)}${i("in2",`${t}_alpha`)}${i("operator","in")}${i("result",`${t}_clipped`)}/>`,c+=`<feComposite${i("in",`${t}_clipped`)}${i("in2",e)}${i("operator","over")}${i("result",t)}/>`,c}function w(r,e){return`<feMerge${i("result",e)}><feMergeNode${i("in",r)}/></feMerge>`}function _t(r,e,t,n){switch(r.type){case"drop-shadow":return ir(r,e,t);case"inner-shadow":return ar(r,e,t);case"gaussian-blur":return or(r,e,t);case"motion-blur":return lr(r,e,t);case"point-light":{let s=r;return bt(n?{...s,x:s.x+n.x,y:s.y+n.y}:s,e,t)}case"spot-light":{let s=r;return xt(n?{...s,x:s.x+n.x,y:s.y+n.y,pointsAtX:s.pointsAtX+n.x,pointsAtY:s.pointsAtY+n.y}:s,e,t)}case"outline":return ur(r,e,t);case"sharpen":return cr(r,e,t);case"pixelate":return hr(r,e,t);case"warp":return dr(r,e,t);case"morphology":return pr(r,e,t);case"contouring-discrete":return mr(r,e,t);case"contouring-table":return fr(r,e,t);case"round-edges":return gr(r,e,t);case"grayscale":return $r(r,e,t);case"channel-painter":return yr(r,e,t);case"brightness":return br(r,e,t);case"contrast":return xr(r,e,t);case"opacity":return _r(r,e,t);case"invert":return Sr(r,e,t);case"hue-rotate":return kr(r,e,t);case"saturate":return wr(r,e,t);case"black-and-white":return Tr(r,e,t);case"sepia":return vr(r,e,t);case"duotone":return Pr(r,e,t);case"xray":return Mr(r,e,t);case"noise":return Cr(r,e,t);case"emboss":return Rr(r,e,t);case"film-grain":return Ar(r,e,t);case"watercolor":return Fr(r,e,t);case"gouache":return Er(r,e,t);case"ink-blot":return Ir(r,e,t);case"crumpled-plastic":return Gr(r,e,t);case"riddled":return Or(r,e,t);case"glow":return Dr(r,e,t);case"inner-glow":return Br(r,e,t);default:return w(e,t)}}function Lr(r,e){let t=e.filter(c=>c.enabled);if(t.length===0)return"";let n=t.some(c=>c.type==="gaussian-blur"&&c.quality==="high"||c.type==="motion-blur"&&c.quality==="high"),s=n?"500%":"300%",a=n?"-200%":"-100%",o="",l="SourceGraphic",u=0;for(let c of t){let d=`result${u++}`;o+=_t(c,l,d),l=d}return`<filter${i("id",r)}${i("x",a)}${i("y",a)}${i("width",s)}${i("height",s)}${i("filterUnits","objectBoundingBox")}${i("primitiveUnits","userSpaceOnUse")}>${o}</filter>`}function V(r){let e="";for(let t of r){let n=t.state.filters;if(!n||n.length===0)continue;let s=n.filter(o=>o.enabled);if(s.length===0)continue;let a=`filter-${t.id}`;e+=Lr(a,s)}return e}function Pe(r,e){return!e||e.length===0||e.filter(n=>n.enabled).length===0?"":` filter="url(#filter-${M(r)})"`}function ne(r,e,t,n){let s=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/10);switch(r){case"stripes":return[{tag:"rect",attrs:{width:n?.strokeWidth!=null?Math.max(.01,Math.min(1,n.strokeWidth))*e:e/2,height:e,fill:t}}];case"dots":{let a=n?.dotRadius!=null?Math.max(.05,Math.min(.45,n.dotRadius)):.25;return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e*a,fill:t}}]}case"grid":return[{tag:"path",attrs:{d:`M ${e} 0 L 0 0 0 ${e}`,fill:"none",stroke:t,"stroke-width":s}}];case"checkerboard":return[{tag:"rect",attrs:{width:e/2,height:e/2,fill:t}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e/2,height:e/2,fill:t}}];case"diagonal":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/5);return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0`,stroke:t,"stroke-width":a}}]}case"crosshatch":return[{tag:"path",attrs:{d:`M 0 ${e} L ${e} 0 M 0 0 L ${e} ${e}`,stroke:t,"stroke-width":s}}];case"zigzag":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*a;return[{tag:"path",attrs:{d:`M 0 ${o} L ${e/4} 0 L ${e/2} ${o} L ${e*3/4} 0 L ${e} ${o}`,fill:"none",stroke:t,"stroke-width":s}}]}case"waves":{let a=n?.amplitude!=null?Math.max(.05,Math.min(.5,n.amplitude)):.25,o=e*a,l=e/2;return[{tag:"path",attrs:{d:`M 0 ${l} Q ${e/4} ${l-o} ${e/2} ${l} T ${e} ${l}`,fill:"none",stroke:t,"stroke-width":s}}]}case"triangles":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${a} L 0 ${a} Z`,fill:"none",stroke:t,"stroke-width":s}}]}case"hexagons":{let a=e*.866;return[{tag:"path",attrs:{d:`M ${e*.25} 0 L ${e*.75} 0 L ${e} ${a*.5} L ${e*.75} ${a} L ${e*.25} ${a} L 0 ${a*.5} Z`,fill:"none",stroke:t,"stroke-width":s}}]}case"diamonds":return[{tag:"path",attrs:{d:`M ${e/2} 0 L ${e} ${e/2} L ${e/2} ${e} L 0 ${e/2} Z`,fill:"none",stroke:t,"stroke-width":s}}];case"circles":return[{tag:"circle",attrs:{cx:e/2,cy:e/2,r:e/3,fill:"none",stroke:t,"stroke-width":s}}];case"bricks":{let a=n?.strokeWidth!=null?Math.max(.5,e*n.strokeWidth):Math.max(1,e/15);return[{tag:"rect",attrs:{x:0,y:0,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:-e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}},{tag:"rect",attrs:{x:e/2,y:e/2,width:e,height:e/2,fill:"none",stroke:t,"stroke-width":a}}]}case"herringbone":return[{tag:"path",attrs:{d:`M 0 0 L ${e/2} ${e/2} L 0 ${e} M ${e/2} ${e/2} L ${e} 0 M ${e/2} ${e/2} L ${e} ${e}`,fill:"none",stroke:t,"stroke-width":s}}];default:return[]}}function Vr(r){let e=Object.entries(r.attrs).map(([t,n])=>` ${t}="${n}"`).join("");return`<${r.tag}${e}/>`}function Me(r,e,t,n,s){let a=10*e,o="";o+=`<rect width="${a}" height="${a}" fill="${n}"/>`;let l=ne(r,a,t,s);for(let u of l)o+=Vr(u);return{svgContent:o,width:a,height:a}}var Ce="0 0 10 10",Re=6,Ae=6;function Fe(){return[{id:"line-marker-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-open-arrow",refX:10,refY:5,element:{tag:"path",attrs:{d:"M 0 0 L 10 5 L 0 10",fill:"none",stroke:"context-stroke","stroke-width":1.5,"stroke-linejoin":"round","stroke-linecap":"round"}}},{id:"line-marker-circle",refX:5,refY:5,element:{tag:"circle",attrs:{cx:5,cy:5,r:3.2,fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-diamond",refX:5,refY:5,element:{tag:"path",attrs:{d:"M 5 0 L 10 5 L 5 10 L 0 5 Z",fill:"context-stroke",stroke:"context-stroke"}}},{id:"line-marker-square",refX:5,refY:5,element:{tag:"rect",attrs:{x:1.5,y:1.5,width:7,height:7,fill:"context-stroke",stroke:"context-stroke"}}}]}function p(r,e){return e==null||e===""?"":` ${r}="${M(String(e))}"`}function U(r,e){let t=r.rotation??0,n=r.skewX??0,s=r.skewY??0,a=r.scaleX??1,o=r.scaleY??1;if(t===0&&n===0&&s===0&&a===1&&o===1)return null;let l=r.customPivot??e;if(!l)return null;let u=[];return u.push(`translate(${l.x}, ${l.y})`),t!==0&&u.push(`rotate(${t})`),(a!==1||o!==1)&&u.push(`scale(${a}, ${o})`),n!==0&&u.push(`skewX(${n})`),s!==0&&u.push(`skewY(${s})`),u.push(`translate(${-l.x}, ${-l.y})`),u.join(" ")}function Nr(r,e,t){let n=r.rotation??0,s=r.skewX??0,a=r.skewY??0,o=r.scaleX??1,l=r.scaleY??1,u=r.customPivot??{x:e,y:t},c=[];return(n!==0||s!==0||a!==0||o!==1||l!==1)&&(c.push(`translate(${u.x}, ${u.y})`),n!==0&&c.push(`rotate(${n})`),(o!==1||l!==1)&&c.push(`scale(${o}, ${l})`),s!==0&&c.push(`skewX(${s})`),a!==0&&c.push(`skewY(${a})`),c.push(`translate(${-u.x}, ${-u.y})`)),c.push(`translate(${e}, ${t})`),c.join(" ")}function Ur(r){if(typeof r=="string"){let n=r.trim();return n.length>0?n:void 0}if(!r||typeof r!="object")return;let e=r,t=[];return e.underline&&t.push("underline"),e.strikethrough&&t.push("line-through"),e.overline&&t.push("overline"),t.length>0?t.join(" "):void 0}function zr(r){if(typeof r.strokeDasharray=="string")return r.strokeDasharray;let e=r.lineStyle??"solid",t=r.dashLength??8,n=r.gapLength??4;return X(e,t,n)}function wt(r){let e=r.fillType;return e||(r.fillGradient?r.fillGradient.r!==void 0?"radial-gradient":"linear-gradient":r.linearGradient?"linear-gradient":r.radialGradient?"radial-gradient":"solid")}function Wr(r){return r.fillGradient??r.linearGradient??r.radialGradient??void 0}function O(r,e){let t=p("data-shape-id",e),n=wt(r);n==="none"?t+=p("fill","none"):n==="linear-gradient"||n==="radial-gradient"?t+=p("fill",`url(#gradient-fill-${e})`):n==="pattern"?t+=p("fill",`url(#pattern-fill-${e})`):t+=p("fill",r.fillColor??"#000000");let s=r.opacity;s!==void 0&&s<1&&(t+=p("opacity",s));let a=r.fillOpacity;a!==void 0&&a<1&&(t+=p("fill-opacity",a));let o=r.fillRule;o&&o!=="nonzero"&&(t+=p("fill-rule",o));let l=r.strokeType??"solid";l==="none"?t+=p("stroke","none"):l==="linear-gradient"||l==="radial-gradient"?t+=p("stroke",`url(#gradient-stroke-${e})`):t+=p("stroke",r.borderColor??"none");let u=r.borderWidth;u!=null&&(t+=p("stroke-width",u));let c=r.strokeOpacity;c!==void 0&&c<1&&(t+=p("stroke-opacity",c));let d=zr(r);d&&(t+=p("stroke-dasharray",d),!r.strokeDasharray&&r.lineStyle==="dotted"&&(t+=p("stroke-linecap","round")));let m=r.dashOffset;m!==void 0&&m!==0&&(t+=p("stroke-dashoffset",m)),t+=Pe(e,r.filters);let h=r.metadata;return h&&(h.role&&(t+=p("role",h.role)),h.ariaLabel&&(t+=p("aria-label",h.ariaLabel))),t}function jr(r){let e=r.metadata;if(!e)return"";let t="";return e.title&&(t+=`<title>${M(e.title)}</title>`),e.description&&(t+=`<desc>${M(e.description)}</desc>`),t}function Hr(r,e){let t=jr(e);if(!t)return r;let n=r.lastIndexOf("/>");if(n===-1){let o=r.indexOf(">");return o===-1?r:r.slice(0,o+1)+t+r.slice(o+1)}let s=r.match(/^<(\w+)/),a=s?s[1]:"g";return r.slice(0,n)+">"+t+`</${a}>`}function Ee(r){let e="",t=r.startEndpoint,n=r.endEndpoint;return t&&t!=="none"&&(e+=p("marker-start",`url(#line-marker-${t})`)),n&&n!=="none"&&(e+=p("marker-end",`url(#line-marker-${n})`)),e}function Tt(r){let e=r.state,t=e.x??0,n=e.y??0,s=e.radius??50,a=U(e,{x:t,y:n});return`<circle${p("cx",t)}${p("cy",n)}${p("r",s)}${O(e,r.id)}${a?p("transform",a):""}/>`}function vt(r){let e=r.state,t=e.cx??0,n=e.cy??0,s=e.rx??50,a=e.ry??30,o=U(e,{x:t,y:n});return`<ellipse${p("cx",t)}${p("cy",n)}${p("rx",s)}${p("ry",a)}${O(e,r.id)}${o?p("transform",o):""}/>`}function Pt(r){let e=r.state,t=e,n=e.x??0,s=e.y??0,a=e.width??100,o=e.height??100,l=e.cornerRadius??0,u=t.cornerShape??"round",c=t.cornerMode??"uniform",d={x:n+a/2,y:s+o/2},m=U(e,d);if(u!=="round"||c==="non-uniform"){let h=Te(n,s,a,o,l,u,c,c==="non-uniform"?{radiusTL:t.cornerRadiusTL,radiusTR:t.cornerRadiusTR,radiusBR:t.cornerRadiusBR,radiusBL:t.cornerRadiusBL,shapeTL:t.cornerShapeTL,shapeTR:t.cornerShapeTR,shapeBR:t.cornerShapeBR,shapeBL:t.cornerShapeBL}:void 0);if(h)return`<path${p("d",h)}${O(e,r.id)}${m?p("transform",m):""}/>`}return`<rect${p("x",n)}${p("y",s)}${p("width",a)}${p("height",o)}${l>0?p("rx",l):""}${O(e,r.id)}${m?p("transform",m):""}/>`}function Mt(r){let e=r.state,t=e.x1??0,n=e.y1??0,s=e.x2??100,a=e.y2??100,o={x:(t+s)/2,y:(n+a)/2},l=U(e,o);return`<line${p("x1",t)}${p("y1",n)}${p("x2",s)}${p("y2",a)}${O(e,r.id)}${Ee(e)}${l?p("transform",l):""}/>`}function Ct(r){let e=r.state,t=e.x??0,n=e.y??0,s=e.text??"",a=e.fontSize??16,o=e.fontFamily??"sans-serif",l=e.fontWeight??"normal",u=e.fontStyle??"normal",c=e.textAnchor??"start",d=Ur(e.textDecoration),m=e.letterSpacing,f=U(e,{x:t,y:n}),g=p("x",t)+p("y",n);g+=p("font-size",a),g+=p("font-family",o),l!=="normal"&&(g+=p("font-weight",l)),u!=="normal"&&(g+=p("font-style",u)),c!=="start"&&(g+=p("text-anchor",c)),d&&(g+=p("text-decoration",d)),m&&(g+=p("letter-spacing",m));let y=e.textDirection;y&&y!=="ltr"&&(g+=p("direction",y));let b=e.unicodeBidi;b&&b!=="normal"&&(g+=p("unicode-bidi",b));let k=e.fontVariationSettings;if(k&&Object.keys(k).length>0){let x=Object.entries(k).map(([S,T])=>`'${S}' ${T}`).join(", ");g+=p("style",`font-variation-settings: ${x}`)}if(g+=O(e,r.id),f&&(g+=p("transform",f)),e.isTextPath&&e.textPathPoints){let x=e.textPathPoints,S=e.textPathStartOffset??0,T=e.textPathSide,R=`text-path-${r.id}`,P="";if(x.length>=2)if(T==="right"){let v=x[x.length-1];P=`M ${v.x} ${v.y}`;for(let B=x.length-1;B>0;B--){let L=x[B],I=x[B-1],H=L.handleIn??L,ht=I.handleOut??I;P+=` C ${H.x} ${H.y}, ${ht.x} ${ht.y}, ${I.x} ${I.y}`}}else{P=`M ${x[0].x} ${x[0].y}`;for(let v=0;v<x.length-1;v++){let B=x[v],L=x[v+1],I=B.handleOut??B,H=L.handleIn??L;P+=` C ${I.x} ${I.y}, ${H.x} ${H.y}, ${L.x} ${L.y}`}}return`<defs><path id="${M(R)}"${p("d",P)} fill="none"/></defs><text${g}><textPath href="#${M(R)}"${p("startOffset",`${S}%`)}>${M(s)}</textPath></text>`}if(e.charOffsets&&Array.isArray(e.charOffsets)&&e.charOffsets.length>0){let x=Array.from(s),S=0,T=0,R="";for(let P=0;P<x.length;P++){let v=e.charOffsets[P]??{x:0,y:0,rotate:0},B=v.x-S,L=v.y-T,I=p("dx",B)+p("dy",L);v.rotate!==0&&(I+=p("rotate",v.rotate)),R+=`<tspan${I}>${M(x[P])}</tspan>`,S=v.x,T=v.y}return`<text${g}>${R}</text>`}return`<text${g}>${M(s)}</text>`}function Rt(r){let e=r.state,t=e.splinePoints??[],n=e.splineCurveType??"CUBIC",s=e.splineClosed??!1,a=e.splineTension??.5,o=e.splineArcParams,l=ve(t,n,s,a,o),u=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,c=u?U(e,u):null;return`<path${p("d",l)}${O(e,r.id)}${Ee(e)}${c?p("transform",c):""}/>`}function At(r){let e=r.state,t=e.polylinePoints??[],n=e.polylineClosed??!1,s=t.map(u=>`${u.x},${u.y}`).join(" "),a=t.length>0?e.customPivot??{x:t[0].x,y:t[0].y}:void 0,o=a?U(e,a):null;return`<${n?"polygon":"polyline"}${p("points",s)}${O(e,r.id)}${Ee(e)}${o?p("transform",o):""}/>`}function Ft(r){let e=r.state,t=e.x??0,n=e.y??0,s=e.width??100,a=e.height??100,o=e.href??"",l=e.imageOpacity,u=e.preserveAspectRatio?"xMidYMid meet":"none",c={x:t+s/2,y:n+a/2},d=U(e,c);return`<image${p("x",t)}${p("y",n)}${p("width",s)}${p("height",a)}${p("href",o)}${p("preserveAspectRatio",u)}${l!==void 0&&l<1?p("opacity",l):""}${O(e,r.id)}${d?p("transform",d):""}/>`}function Et(r){let e=r.state,t=e.cx??0,n=e.cy??0,s=e.radius??50,a=e.cornerRadius??0,o=e.shiftAngle??-90,l=e.fillRule??"nonzero",u=Nr(e,t,n),c="";switch(r.type){case"triangle":c=N(ee(3,s,o),a,s);break;case"ngon":{let m=e.sides??6;c=N(ee(m,s,o),a,s);break}case"star":{let m=e.arms??5,h=e.innerRadiusPercent??50;c=N(be(m,s,h,o),a,s);break}case"cross":{let m=e.armWidthPercent??40;c=N(xe(s,m,o),a,s);break}case"ring":{let m=e.innerRadiusPercent??50;c=Se(s,m,l);break}case"spiral":{let m=e.turns??3,h=e.thicknessPercent??20,f=e.direction??1;c=ke(s,m,h,f,o);break}case"gear":{let m=e.teeth??8,h=e.toothDepthPercent??30,f=e.holeRadiusPercent??0;c=we(m,s,h,a,f,l,o);break}case"arrow":{let m=e.headWidthPercent??100,h=e.headLengthPercent??30,f=e.shaftWidthPercent??40;c=N(_e(s,m,h,f,o),a,s);break}default:return`<!-- unsupported polygon shape: ${M(r.type)} -->`}let d="";return(r.type==="ring"||r.type==="gear")&&(d=p("fill-rule",l)),`<path${p("d",c)}${d}${O(e,r.id)}${p("transform",u)}/>`}function E(r){let e;switch(r.type){case"circle":e=Tt(r);break;case"ellipse":e=vt(r);break;case"rectangle":case"square":e=Pt(r);break;case"line":e=Mt(r);break;case"text":e=Ct(r);break;case"spline":e=Rt(r);break;case"polyline":e=At(r);break;case"image":e=Ft(r);break;case"triangle":case"ngon":case"star":case"cross":case"ring":case"spiral":case"gear":case"arrow":e=Et(r);break;default:return`<!-- unsupported shape type: ${M(r.type)} -->`}return Hr(e,r.state)}function z(r){let e="";for(let t of r){let n=t.state,s=wt(n),a=Wr(n),o=n.strokeType??"solid";s==="linear-gradient"&&a&&(e+=St(`gradient-fill-${t.id}`,a)),s==="radial-gradient"&&a&&(e+=kt(`gradient-fill-${t.id}`,a)),s==="pattern"&&a&&(e+=Xr(`pattern-fill-${t.id}`,a)),o==="linear-gradient"&&n.strokeGradient&&(e+=St(`gradient-stroke-${t.id}`,n.strokeGradient)),o==="radial-gradient"&&n.strokeGradient&&(e+=kt(`gradient-stroke-${t.id}`,n.strokeGradient))}return e}function St(r,e){let t=(e.stops??[]).map(n=>{let s=`<stop${p("offset",`${n.offset*100}%`)}${p("stop-color",n.color)}`;return n.opacity!==void 0&&n.opacity<1&&(s+=p("stop-opacity",n.opacity)),s+="/>",s}).join("");return`<linearGradient${p("id",r)}${p("x1",`${e.x1*100}%`)}${p("y1",`${e.y1*100}%`)}${p("x2",`${e.x2*100}%`)}${p("y2",`${e.y2*100}%`)}${e.spreadMethod?p("spreadMethod",e.spreadMethod):""}>${t}</linearGradient>`}function kt(r,e){let t=(e.stops??[]).map(o=>{let l=`<stop${p("offset",`${o.offset*100}%`)}${p("stop-color",o.color)}`;return o.opacity!==void 0&&o.opacity<1&&(l+=p("stop-opacity",o.opacity)),l+="/>",l}).join(""),n="",s=e.ry!==void 0&&e.ry!==e.r,a=!!e.rotation;if(s||a){let o=e.cx??.5,l=e.cy??.5,u=[];u.push(`translate(${o}, ${l})`),a&&u.push(`rotate(${e.rotation})`),s&&e.ry!==0&&u.push(`scale(1, ${e.ry/e.r})`),u.push(`translate(-${o}, -${l})`),n=p("gradientTransform",u.join(" "))}return`<radialGradient${p("id",r)}${p("cx",`${e.cx*100}%`)}${p("cy",`${e.cy*100}%`)}${p("fx",`${e.fx*100}%`)}${p("fy",`${e.fy*100}%`)}${p("r",`${e.r*100}%`)}${e.spreadMethod?p("spreadMethod",e.spreadMethod):""}${n}>${t}</radialGradient>`}function Xr(r,e){if(e.svgContent!=null){let l=e.width??10,u=e.height??10,c=e.patternUnits??"userSpaceOnUse",d=e.patternContentUnits,m=e.patternTransform,h=e.viewBox,f=e.preserveAspectRatio,g=e.x??0,y=e.y??0,b=`<pattern${p("id",r)}`;return b+=p("patternUnits",c),d&&(b+=p("patternContentUnits",d)),g&&(b+=p("x",g)),y&&(b+=p("y",y)),b+=p("width",l),b+=p("height",u),h&&(b+=p("viewBox",h)),f&&(b+=p("preserveAspectRatio",f)),m&&(b+=p("patternTransform",m)),b+=`>${e.svgContent}</pattern>`,b}let t=10*(e.scale??1),n=e.rotation??0,s=e.color||"#000000",a=e.backgroundColor||"#ffffff",o="";return o+=`<rect${p("width",t)}${p("height",t)}${p("fill",a)}/>`,o+=Yr(e.patternType,t,s),`<pattern${p("id",r)}${p("patternUnits","userSpaceOnUse")}${p("width",t)}${p("height",t)}${n?p("patternTransform",`rotate(${n})`):""}>${o}</pattern>`}function Yr(r,e,t){return ne(r,e,t).map(s=>{let a=Object.entries(s.attrs).map(([o,l])=>p(o,l)).join("");return`<${s.tag}${a}/>`}).join("")}function W(r){let e=new Set;for(let s of r){let a=s.state,o=a.startEndpoint,l=a.endEndpoint;o&&o!=="none"&&e.add(o),l&&l!=="none"&&e.add(l)}if(e.size===0)return"";let t=Fe(),n="";for(let s of t){let a=s.id.replace("line-marker-","");if(!e.has(a))continue;let o=s.element,l=Object.entries(o.attrs).map(([c,d])=>p(c,d)).join(""),u=o.tag==="circle"||o.tag==="rect"?`<${o.tag}${l}/>`:`<${o.tag}${l}/>`;n+=`<marker${p("id",s.id)}${p("viewBox",Ce)}${p("refX",s.refX)}${p("refY",s.refY)}${p("markerWidth",6)}${p("markerHeight",6)}${p("orient","auto-start-reverse")}>${u}</marker>`}return n}var qr={x:"x",y:"y",cx:"cx",cy:"cy",x1:"x1",y1:"y1",x2:"x2",y2:"y2",posX:"x",posY:"y",radius:"r",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",opacity:"opacity",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",borderWidth:"stroke-width",cornerRadius:"rx",fontSize:"font-size"},Zr=new Set(["rotation","skewX","skewY"]);function Qr(r){let t=ue[r];return t?t.join(" "):"0 0 1 1"}function se(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ie(r){return r.cycleDuration!==void 0&&r.cycleDuration>0?r.cycleDuration:r.keyframes.length===0?0:r.keyframes[r.keyframes.length-1].time}function Ge(r,e){let t=r.keyframes;if(t.length===0)return{values:[],keyTimes:[],keySplines:[]};let n=t.map(o=>String(o.value)),s=t.map(o=>e>0?(o.time/e).toFixed(4):"0"),a=[];for(let o=1;o<t.length;o++)a.push(Qr(t[o].easing));return{values:n,keyTimes:s,keySplines:a}}function Oe(r){let e=r.beginTrigger;if(!e)return"0s";switch(e.type){case"time":return`${e.value}s`;case"event":return e.value;default:return"0s"}}function De(r){return r.cycleInfinite?"indefinite":r.cycleRepeats&&r.cycleRepeats>1?String(r.cycleRepeats):null}function Kr(r){let e=qr[r.property];if(!e)return"";let t=Ie(r);if(t<=0)return"";let{values:n,keyTimes:s,keySplines:a}=Ge(r,t);if(n.length<2)return"";let o=`<animate attributeName="${se(e)}"`;o+=` values="${se(n.join(";"))}"`,o+=` keyTimes="${s.join(";")}"`,a.length>0&&a.some(u=>u!=="0 0 1 1")&&(o+=' calcMode="spline"',o+=` keySplines="${a.join(";")}"`),o+=` dur="${t}s"`,o+=` begin="${Oe(r)}"`;let l=De(r);return l&&(o+=` repeatCount="${l}"`),o+=' fill="freeze"',o+="/>",o}function Jr(r){let e;switch(r.property){case"rotation":e="rotate";break;case"skewX":e="skewX";break;case"skewY":e="skewY";break;default:return""}let t=Ie(r);if(t<=0)return"";let{values:n,keyTimes:s,keySplines:a}=Ge(r,t);if(n.length<2)return"";let o=e==="rotate"&&r.transformOrigin?n.map(c=>`${c} ${r.transformOrigin.x} ${r.transformOrigin.y}`):n,l='<animateTransform attributeName="transform"';l+=` type="${e}"`,l+=` values="${se(o.join(";"))}"`,l+=` keyTimes="${s.join(";")}"`,a.length>0&&a.some(c=>c!=="0 0 1 1")&&(l+=' calcMode="spline"',l+=` keySplines="${a.join(";")}"`),l+=` dur="${t}s"`,l+=` begin="${Oe(r)}"`;let u=De(r);return u&&(l+=` repeatCount="${u}"`),l+=` additive="${r.additive??"sum"}"`,l+=' fill="freeze"',l+="/>",l}function en(r){if(!r.motionPath)return"";let e=Ie(r);if(e<=0)return"";let{keyTimes:t,keySplines:n}=Ge(r,e),s=r.keyframes.map(u=>{let c=typeof u.value=="number"?u.value:parseFloat(u.value);return Math.max(0,Math.min(1,c))}),a="<animateMotion";a+=` path="${se(r.motionPath)}"`,a+=` keyTimes="${t.join(";")}"`,a+=` keyPoints="${s.join(";")}"`,n.length>0&&n.some(u=>u!=="0 0 1 1")&&(a+=' calcMode="spline"',a+=` keySplines="${n.join(";")}"`),a+=` dur="${e}s"`,a+=` begin="${Oe(r)}"`;let o=De(r);o&&(a+=` repeatCount="${o}"`),a+=' fill="freeze"';let l=r.motionRotate??"auto";return a+=` rotate="${l}"`,a+="/>",a}function Be(r){let e=new Map;for(let t of r.tracks){if(!t.enabled||t.keyframes.length<2)continue;let n=[...t.keyframes].sort((o,l)=>o.time-l.time),s={...t,locked:t.locked??!1,keyframes:n.map(o=>({time:o.time,value:o.value,easing:o.easing}))},a="";if(t.property==="pathMotion"&&t.motionPath?a=en(s):Zr.has(t.property)?a=Jr(s):a=Kr(s),a){let o=e.get(t.shapeId)??[];o.push(a),e.set(t.shapeId,o)}}return e}function Y(r,e={}){let{xmlDeclaration:t=!0,backgroundColor:n,indent:s=!0,className:a}=e,o=r.viewboxes?.[0],l=e.width??o?.width??800,u=e.height??o?.height??600,c=e.viewBox??`0 0 ${l} ${u}`,d=s?`
7
+ `:"",m=s?" ":"",h=r.shapes??[],f=z(h),g=W(h),y=V(h),b=f.length>0||g.length>0||y.length>0,k="";b&&(k=`${d}${m}<defs>${d}`,f.length>0&&(k+=`${m}${m}${f}${d}`),g.length>0&&(k+=`${m}${m}${g}${d}`),y.length>0&&(k+=`${m}${m}${y}${d}`),k+=`${m}</defs>`);let _="";n&&(_=`${d}${m}<rect width="${l}" height="${u}" fill="${n}"/>`);let x=r.animationTimeline?Be(r.animationTimeline):null,S=h.map(R=>{let P=E(R),v=x?.get(R.id);return v&&v.length>0&&(P=tn(P,v,m)),`${m}${P}`}).join(d),T="";return t&&(T+=`<?xml version="1.0" encoding="UTF-8"?>${d}`),T+='<svg xmlns="http://www.w3.org/2000/svg"',T+=` width="${l}" height="${u}"`,T+=` viewBox="${c}"`,a&&(T+=` class="${a}"`),T+=">",T+=k,T+=_,h.length>0&&(T+=`${d}${S}`),T+=`${d}</svg>${d}`,T}function tn(r,e,t){let n=e.join(""),s=r.lastIndexOf("/>");if(s!==-1){let o=r.match(/^<(\w+)/),l=o?o[1]:"g";return r.slice(0,s)+">"+n+`</${l}>`}let a=r.match(/<\/(\w+)>$/);if(a){let o=r.lastIndexOf(`</${a[1]}>`);return r.slice(0,o)+n+r.slice(o)}return r+n}function Le(r,e){let t=G(r,e);return Y(r,{width:t.width,height:t.height,xmlDeclaration:e.xmlDeclaration??!1,indent:!0})}function rn(r){return r==="class"?"className":r==="for"?"htmlFor":r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function ie(r){return r.replace(/\s([a-z][a-z-]*?)=/g,(e,t)=>t.startsWith("data-")||t.startsWith("aria-")?e:` ${rn(t)}=`)}function Ve(r,e){let t=e.componentName??"SvgComponent",n=G(r,e),s=e.indent??" ",a=r.shapes??[],o=e.typescript??!1,l=z(a),u=W(a),c=V(a),d=l.length>0||u.length>0||c.length>0,m=a.map(f=>{let g=E(f);return`${s}${s}${s}${ie(g)}`}),h=[];h.push("import React from 'react';"),h.push(""),o?(h.push(`interface ${t}Props {`),h.push(`${s}className?: string;`),h.push(`${s}style?: React.CSSProperties;`),h.push("}"),h.push(""),h.push(`const ${t}: React.FC<${t}Props> = ({ className, style }) => {`)):h.push(`const ${t} = ({ className, style }) => {`),h.push(`${s}return (`),h.push(`${s}${s}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" className={className} style={style}>`),d&&(h.push(`${s}${s}${s}<defs>`),l.length>0&&h.push(`${s}${s}${s}${s}${ie(l)}`),u.length>0&&h.push(`${s}${s}${s}${s}${ie(u)}`),c.length>0&&h.push(`${s}${s}${s}${s}${ie(c)}`),h.push(`${s}${s}${s}</defs>`));for(let f of m)h.push(f);return h.push(`${s}${s}</svg>`),h.push(`${s});`),h.push("};"),h.push(""),h.push(`export default ${t};`),h.push(""),h.join(`
8
+ `)}function Ne(r,e){let t=e.componentName??"SvgComponent",n=G(r,e),s=e.indent??" ",a=r.shapes??[],o=e.typescript??!1,l=z(a),u=W(a),c=V(a),d=l.length>0||u.length>0||c.length>0,m=a.map(f=>`${s}${s}${E(f)}`),h=[];h.push("<template>"),h.push(`${s}<svg xmlns="http://www.w3.org/2000/svg" width="${n.width}" height="${n.height}" viewBox="0 0 ${n.width} ${n.height}" :class="className" :style="style">`),d&&(h.push(`${s}${s}<defs>`),l.length>0&&h.push(`${s}${s}${s}${l}`),u.length>0&&h.push(`${s}${s}${s}${u}`),c.length>0&&h.push(`${s}${s}${s}${c}`),h.push(`${s}${s}</defs>`));for(let f of m)h.push(f);return h.push(`${s}</svg>`),h.push("</template>"),h.push(""),o?h.push('<script setup lang="ts">'):h.push("<script setup>"),h.push(`// ${t}`),o?(h.push("defineProps<{"),h.push(`${s}className?: string;`),h.push(`${s}style?: Record<string, string>;`),h.push("}>();")):(h.push("defineProps({"),h.push(`${s}className: { type: String, default: '' },`),h.push(`${s}style: { type: Object, default: () => ({}) },`),h.push("});")),h.push("</script>"),h.push(""),h.join(`
9
+ `)}var nn=new Set(["circle","ellipse","rectangle","square","line","text","image"]);function It(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function Gt(r){return r.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function sn(r){if(!nn.has(r.type))return!0;let e=r.state.metadata;return!!(e?.title||e?.description||r.type==="text"&&r.state.isTextPath)}function Ue(r,e){let t=e.componentName??"createSvg",n=G(r,e),s=e.indent??" ",a=r.shapes??[],o=e.typescript??!1,l=[];l.push("import * as d3 from 'd3';"),l.push(""),o?l.push(`export function ${t}(container: string | HTMLElement): d3.Selection<SVGSVGElement, unknown, HTMLElement, unknown> {`):l.push(`export function ${t}(container) {`),l.push(`${s}const svg = d3.select(container)`),l.push(`${s}${s}.append('svg')`),l.push(`${s}${s}.attr('xmlns', 'http://www.w3.org/2000/svg')`),l.push(`${s}${s}.attr('width', ${n.width})`),l.push(`${s}${s}.attr('height', ${n.height})`),l.push(`${s}${s}.attr('viewBox', '0 0 ${n.width} ${n.height}');`),l.push("");let u=z(a),c=W(a),d=V(a),m=`${u}${c}${d}`;m.length>0&&(l.push(`${s}svg.append('defs').html(\`${Gt(m)}\`);`),l.push(""));for(let h=0;h<a.length;h++){let f=a[h];if(l.push(`${s}// ${f.type}${f.state.metadata?.name?` \u2014 ${f.state.metadata.name}`:""}`),sn(f)){l.push(`${s}svg.append('g').html(\`${Gt(E(f))}\`);`),l.push("");continue}let g=yt(f),y=te(f),b=`shape${h+1}`;l.push(`${s}const ${b} = svg.append('${g}')`);for(let[k,_]of y)l.push(`${s}${s}.attr('${k}', '${It(_)}')`);f.type==="text"&&f.state.text&&l.push(`${s}${s}.text('${It(f.state.text)}')`),l[l.length-1]=l[l.length-1]+";",l.push("")}return l.push(`${s}return svg;`),l.push("}"),l.push(""),l.join(`
10
+ `)}function Ot(r,e){let t=r.state.metadata?.name;return t?t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""):`${r.type}-${e+1}`}var an=new Set(["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linecap","opacity","transform","filter"]);function ze(r,e){let t=G(r,e),n=e.indent??" ",s=r.shapes??[],a=[];for(let u=0;u<s.length;u++){let c=s[u],d=Ot(c,u),m=te(c),h=[];for(let[f,g]of m)an.has(f)&&h.push(`${n}${f}: ${g};`);h.length>0&&a.push(`.${d} {
11
+ ${h.join(`
12
+ `)}
13
+ }`)}let o=[];for(let u=0;u<s.length;u++){let c=s[u],d=Ot(c,u),m=E(c),h=m.indexOf(" ");h!==-1&&(m=m.slice(0,h)+` class="${d}"`+m.slice(h)),o.push(`${n}${m}`)}let l=[];l.push("<style>");for(let u of a)l.push(u);l.push("</style>"),l.push(""),l.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${t.width}" height="${t.height}" viewBox="0 0 ${t.width} ${t.height}">`);for(let u of o)l.push(u);return l.push("</svg>"),l.push(""),l.join(`
14
+ `)}function We(r,e){let t=on(r,e),n={...e};switch(n.format){case"svg":return Le(t,n);case"react":return Ve(t,n);case"vue":return Ne(t,n);case"d3":return Ue(t,n);case"css":return ze(t,n);default:throw new Error(`Unsupported code format: ${n.format}`)}}function on(r,e){return Array.isArray(r)?{shapes:r,viewboxes:[{id:"default",x:0,y:0,width:e.width??800,height:e.height??600}]}:r}var je=class r{constructor(e={}){let{width:t=800,height:n=600,viewboxId:s}=e,a=Z(0,0,t,n,s);this._snapshot=he({viewboxes:[a]})}static fromSnapshot(e){let t=new r;return t._snapshot=JSON.parse(JSON.stringify(e)),t}static fromJSON(e,t){let n=pe(e,t),s=new r;return s._snapshot=n,s}add(e){let t="build"in e&&typeof e.build=="function"?e.build():e;return this._snapshot.shapes.push(t),this}addAll(...e){for(let t of e)this.add(t);return this}remove(e){let t=this._snapshot.shapes.length;return this._snapshot.shapes=this._snapshot.shapes.filter(n=>n.id!==e),this._snapshot.shapes.length<t}get shapes(){return this._snapshot.shapes}findShape(e){return this._snapshot.shapes.find(t=>t.id===e)}size(e,t){return this._snapshot.viewboxes.length>0?(this._snapshot.viewboxes[0].width=e,this._snapshot.viewboxes[0].height=t):this._snapshot.viewboxes=[Z(0,0,e,t)],this}get width(){return this._snapshot.viewboxes[0]?.width??800}get height(){return this._snapshot.viewboxes[0]?.height??600}title(e){return this._ensureMetadata(),this._snapshot.documentMetadata.title=e,this}description(e){return this._ensureMetadata(),this._snapshot.documentMetadata.description=e,this}author(e){return this._ensureMetadata(),this._snapshot.documentMetadata.author=e,this}keywords(...e){return this._ensureMetadata(),this._snapshot.documentMetadata.keywords=e,this}license(e,t){return this._ensureMetadata(),this._snapshot.documentMetadata.license=e,t!==void 0&&(this._snapshot.documentMetadata.licenseUrl=t),this}language(e){return this._ensureMetadata(),this._snapshot.documentMetadata.language=e,this}customMetadata(e){return this._ensureMetadata(),this._snapshot.documentMetadata.customMetadata={...this._snapshot.documentMetadata.customMetadata,...e},this}get meta(){return this._snapshot.documentMetadata}defineSymbol(e,t,n){this._snapshot.symbols||(this._snapshot.symbols=[]);let s=$(),a=t.map(l=>"build"in l&&typeof l.build=="function"?l.build():l),o={id:s,name:e,viewBox:n?.viewBox??"0 0 100 100",shapes:a};return n?.groups&&(o.groups=n.groups),n?.thumbnail&&(o.thumbnail=n.thumbnail),this._snapshot.symbols.push(o),s}placeSymbolInstance(e,t,n,s,a){let o={id:$(),type:"symbol-instance",state:{symbolId:e,x:t,y:n,width:s??100,height:a??100}};return this._snapshot.shapes.push(o),this}removeSymbol(e){if(!this._snapshot.symbols)return!1;let t=this._snapshot.symbols.length;return this._snapshot.symbols=this._snapshot.symbols.filter(n=>n.id!==e),this._snapshot.symbols.length<t}get symbols(){return this._snapshot.symbols??[]}addClipGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let s=$(),a={id:s,type:"clip",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.clipPathUnits&&(a.clipPathUnits=n.clipPathUnits),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),s}addMaskGroup(e,t,n){this._snapshot.clipMaskGroups||(this._snapshot.clipMaskGroups=[]);let s=$(),a={id:s,type:"mask",clipShapeIds:e,contentShapeIds:t,parentId:null};return n?.maskUnits&&(a.maskUnits=n.maskUnits),n?.maskContentUnits&&(a.maskContentUnits=n.maskContentUnits),n?.maskBounds&&(a.maskBounds=n.maskBounds),n?.maskType&&(a.maskType=n.maskType),n?.rawDefinition&&(a.rawDefinition=n.rawDefinition),this._snapshot.clipMaskGroups.push(a),s}removeClipMaskGroup(e){if(!this._snapshot.clipMaskGroups)return!1;let t=this._snapshot.clipMaskGroups.length;return this._snapshot.clipMaskGroups=this._snapshot.clipMaskGroups.filter(n=>n.id!==e),this._snapshot.clipMaskGroups.length<t}addGuide(e,t,n){this._snapshot.guides||(this._snapshot.guides=[]);let s=$(),a={id:s,orientation:e,position:t,controlPointOffset:0};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.guides.push(a),s}removeGuide(e){if(!this._snapshot.guides)return!1;let t=this._snapshot.guides.length;return this._snapshot.guides=this._snapshot.guides.filter(n=>n.id!==e),this._snapshot.guides.length<t}clearGuides(){return this._snapshot.guides=[],this}get guides(){return this._snapshot.guides??[]}addMeasurement(e,t,n){this._snapshot.measurements||(this._snapshot.measurements=[]);let s=$(),a={id:s,type:e,points:t,visible:n?.visible??!0,snapDivisions:n?.snapDivisions??1};return n?.color&&(a.color=n.color),n?.opacity!==void 0&&(a.opacity=n.opacity),this._snapshot.measurements.push(a),s}removeMeasurement(e){if(!this._snapshot.measurements)return!1;let t=this._snapshot.measurements.length;return this._snapshot.measurements=this._snapshot.measurements.filter(n=>n.id!==e),this._snapshot.measurements.length<t}get measurements(){return this._snapshot.measurements??[]}addCustomPattern(e,t,n,s){this._snapshot.customPatterns||(this._snapshot.customPatterns=[]);let a=$();return this._snapshot.customPatterns.push({id:a,name:e,svgContent:t,width:n,height:s}),a}removeCustomPattern(e){if(!this._snapshot.customPatterns)return!1;let t=this._snapshot.customPatterns.length;return this._snapshot.customPatterns=this._snapshot.customPatterns.filter(n=>n.id!==e),this._snapshot.customPatterns.length<t}get customPatterns(){return this._snapshot.customPatterns??[]}addGroup(e,t){this._snapshot.groups||(this._snapshot.groups=[]);let n=e??$();return this._snapshot.groups.push({id:n,parentId:t??null}),n}removeGroup(e){if(!this._snapshot.groups)return!1;let t=this._snapshot.groups.length;this._snapshot.groups=this._snapshot.groups.filter(n=>n.id!==e);for(let n of this._snapshot.shapes)n.state.groupId===e&&delete n.state.groupId;return this._snapshot.groups.length<t}moveToGroup(e,t){let n=this._snapshot.shapes.find(s=>s.id===e);return n&&(n.state.groupId=t),this}removeFromGroup(e){let t=this._snapshot.shapes.find(n=>n.id===e);return t&&delete t.state.groupId,this}bringToFront(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.push(n)}return this}sendToBack(e){let t=this._snapshot.shapes.findIndex(n=>n.id===e);if(t>=0){let[n]=this._snapshot.shapes.splice(t,1);this._snapshot.shapes.unshift(n)}return this}reorder(e,t){let n=this._snapshot.shapes.findIndex(s=>s.id===e);if(n>=0){let[s]=this._snapshot.shapes.splice(n,1),a=Math.max(0,Math.min(t,this._snapshot.shapes.length));this._snapshot.shapes.splice(a,0,s)}return this}defineVariable(e,t,n,s){this._snapshot.templateVariables||(this._snapshot.templateVariables=[]);let a=this._snapshot.templateVariables.find(o=>o.name===e);if(a)a.type=t,a.defaultValue=n,s?.label!==void 0&&(a.label=s.label),s?.description!==void 0&&(a.description=s.description);else{let o={name:e,type:t,defaultValue:n};s?.label!==void 0&&(o.label=s.label),s?.description!==void 0&&(o.description=s.description),this._snapshot.templateVariables.push(o)}return this}removeVariable(e){return this._snapshot.templateVariables&&(this._snapshot.templateVariables=this._snapshot.templateVariables.filter(t=>t.name!==e)),this}get variables(){return this._snapshot.templateVariables??[]}inspectVariables(){return ge(this._snapshot)}setTimeline(e){return"build"in e&&typeof e.build=="function"?this._snapshot.animationTimeline=e.build():this._snapshot.animationTimeline=e,this}clearTimeline(){return delete this._snapshot.animationTimeline,this}get timeline(){return this._snapshot.animationTimeline}toSVG(e){let{variables:t,...n}=e??{},s=fe(this._snapshot,t);return Y(s,n)}toJSON(e){return de(this._snapshot,e)}toSnapshot(){return JSON.parse(JSON.stringify(this._snapshot))}toCode(e,t){return We(this._snapshot,{...t,format:e})}_ensureMetadata(){this._snapshot.documentMetadata||(this._snapshot.documentMetadata={title:"",description:"",author:"",keywords:[],license:"",licenseUrl:"",language:"en",customMetadata:{}})}};var He=class{constructor(e,t){this._track={id:$(),shapeId:e,property:t,keyframes:[],enabled:!0,locked:!1}}id(e){return this._track.id=e,this}keyframe(e,t,n="linear"){return this._track.keyframes.push({time:e,value:t,easing:n}),this}keyframes(...e){return this._track.keyframes.push(...e),this}disabled(){return this._track.enabled=!1,this}locked(){return this._track.locked=!0,this}motionPath(e){return this._track.motionPath=e,this}beginTrigger(e,t){return this._track.beginTrigger={type:e,value:t},this}endTrigger(e,t){return this._track.endTrigger={type:e,value:t},this}cycleDuration(e){return this._track.cycleDuration=e,this}cycleRepeats(e){return this._track.cycleRepeats=e,this}infinite(){return this._track.cycleInfinite=!0,this}cycle(e){return this._track.cycleBehavior=e,this}transformOrigin(e,t){return this._track.transformOrigin={x:e,y:t},this}motionRotate(e){return this._track.motionRotate=e,this}additive(e){return this._track.additive=e,this}build(){let e=[...this._track.keyframes].sort((t,n)=>t.time-n.time);return{...this._track,keyframes:e}}},Xe=class{constructor(e){this._loop=!1;this._playbackSpeed=1;this._tracks=[];this._duration=e}loop(e=!0){return this._loop=e,this}speed(e){return this._playbackSpeed=e,this}duration(e){return this._duration=e,this}addTrack(e){return this._tracks.push(e),this}addTracks(...e){return this._tracks.push(...e),this}buildTimeline(){return{duration:this._duration,loop:this._loop,playbackSpeed:this._playbackSpeed,tracks:this._tracks.map(e=>e.build())}}build(){let e=this.buildTimeline();return{duration:e.duration,loop:e.loop,playbackSpeed:e.playbackSpeed,tracks:e.tracks.map(t=>({id:t.id,shapeId:t.shapeId,property:t.property,enabled:t.enabled,locked:t.locked||void 0,motionPath:t.motionPath,beginTrigger:t.beginTrigger,endTrigger:t.endTrigger,cycleDuration:t.cycleDuration,cycleRepeats:t.cycleRepeats,cycleInfinite:t.cycleInfinite,cycleBehavior:t.cycleBehavior,transformOrigin:t.transformOrigin,motionRotate:t.motionRotate,additive:t.additive,keyframes:t.keyframes.map(n=>({time:n.time,value:n.value,easing:n.easing}))}))}}};var C=class{constructor(e,t){this._state={};this._type=e,this._id=t??$()}id(e){return this._id=e,this}locked(e=!0){return this._state.locked=e,this}visible(e=!0){return this._state.visible=e,this}fill(e,t){return this._state.fillColor=e,this._state.fillType="solid",t!==void 0&&(this._state.fillOpacity=t),this}noFill(){return this._state.fillType="none",this}fillGradient(e){let t="build"in e?e.build():e;return this._state.fillType=t.type,this._state.fillGradient=t,this}fillPattern(e){let t="build"in e?e.build():e;return this._state.fillType="pattern",this._state.fillGradient=t,this}fillOpacity(e){return this._state.fillOpacity=e,this}fillRule(e){return this._state.fillRule=e,this}stroke(e,t){return this._state.borderColor=e,t!==void 0&&(this._state.borderWidth=t),this}noStroke(){return this._state.borderColor="none",this._state.borderWidth=0,this}strokeWidth(e){return this._state.borderWidth=e,this}strokeOpacity(e){return this._state.strokeOpacity=e,this}strokeGradient(e){let t="build"in e?e.build():e;return this._state.strokeType=t.type,this._state.strokeGradient=t,this}strokePattern(e){let t="build"in e?e.build():e;return this._state.strokeType="pattern",this._state.strokeGradient=t,this}strokeLinejoin(e){return this._state.strokeLinejoin=e,this}strokeLinecap(e){return this._state.strokeLinecap=e,this}strokeMiterlimit(e){return this._state.strokeMiterlimit=e,this}dashOffset(e){return this._state.dashOffset=e,this}strokeDasharray(e){return this._state.strokeDasharray=e,this}dash(e,t,n){return this._state.lineStyle=e,e==="custom"&&(t!==void 0&&(this._state.dashLength=t),n!==void 0&&(this._state.gapLength=n)),this}opacity(e){return this._state.opacity=e,this}rotate(e){return this._state.rotation=e,this}skew(e,t){return this._state.skewX=e,this._state.skewY=t,this}scale(e,t){return this._state.scaleX=e,this._state.scaleY=t??e,this}pivot(e,t){return this._state.customPivot={x:e,y:t},this}filter(...e){let t=this._state.filters??[];return this._state.filters=[...t,...e],this}dropShadow(e={}){let t={id:`drop-shadow-${$()}`,type:"drop-shadow",enabled:!0,offsetX:e.offsetX??4,offsetY:e.offsetY??4,blurRadius:e.blurRadius??8,spread:e.spread??0,color:e.color??"#000000",opacity:e.opacity??.3};return this.filter(t)}innerShadow(e={}){let t={id:`inner-shadow-${$()}`,type:"inner-shadow",enabled:!0,offsetX:e.offsetX??2,offsetY:e.offsetY??2,blurRadius:e.blurRadius??4,choke:e.choke??0,color:e.color??"#000000",opacity:e.opacity??.5};return this.filter(t)}blur(e,t,n){let s=e??4,a=t??s,o={id:`gaussian-blur-${$()}`,type:"gaussian-blur",enabled:!0,blurX:s,blurY:a,linked:s===a,quality:n?.quality??"normal"};return this.filter(o)}glow(e={}){let t={id:`glow-${$()}`,type:"glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}innerGlow(e={}){let t={id:`inner-glow-${$()}`,type:"inner-glow",enabled:!0,color:e.color??"#ffffff",radius:e.radius??10,intensity:e.intensity??.8};return this.filter(t)}grayscale(e=1){let t={id:`grayscale-${$()}`,type:"grayscale",enabled:!0,amount:e};return this.filter(t)}sepia(e=1){let t={id:`sepia-${$()}`,type:"sepia",enabled:!0,amount:e};return this.filter(t)}outline(e={}){return this.filter({id:`outline-${$()}`,type:"outline",enabled:!0,width:e.width??3,color:e.color??"#000000",opacity:e.opacity??1,position:e.position??"outside"})}motionBlur(e={}){let t={id:`motion-blur-${$()}`,type:"motion-blur",enabled:!0,distance:e.distance??10,angle:e.angle??0,quality:e.quality??"normal"};return this.filter(t)}pointLight(e={}){let t={id:`point-light-${$()}`,type:"point-light",enabled:!0,x:e.x??100,y:e.y??100,z:e.z??200,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,diffuseConstant:e.diffuseConstant??1,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}spotLight(e={}){let t={id:`spot-light-${$()}`,type:"spot-light",enabled:!0,x:e.x??100,y:e.y??0,z:e.z??200,pointsAtX:e.pointsAtX??100,pointsAtY:e.pointsAtY??100,pointsAtZ:e.pointsAtZ??0,coneAngle:e.coneAngle??30,color:e.color??"#ffffff",surfaceScale:e.surfaceScale??5,specularConstant:e.specularConstant??1,specularExponent:e.specularExponent??20};return this.filter(t)}sharpen(e=1){let t={id:`sharpen-${$()}`,type:"sharpen",enabled:!0,amount:e};return this.filter(t)}pixelate(e=8){let t={id:`pixelate-${$()}`,type:"pixelate",enabled:!0,blockSize:e};return this.filter(t)}warp(e={}){let t={id:`warp-${$()}`,type:"warp",enabled:!0,scale:e.scale??10,frequency:e.frequency??.02,octaves:e.octaves??1,warpType:e.warpType??"turbulence"};return this.filter(t)}morphology(e={}){let t=e.radiusX??2,n=e.radiusY??t,s={id:`morphology-${$()}`,type:"morphology",enabled:!0,operator:e.operator??"dilate",radiusX:t,radiusY:n,linked:e.linked??t===n};return this.filter(s)}contouring(e={}){if((e.mode??"discrete")==="table"){let s={id:`contouring-table-${$()}`,type:"contouring-table",enabled:!0,levels:e.levels??4,contrast:e.contrast??1};return this.filter(s)}let n={id:`contouring-discrete-${$()}`,type:"contouring-discrete",enabled:!0,levels:e.levels??4};return this.filter(n)}roundEdges(e=4){let t={id:`round-edges-${$()}`,type:"round-edges",enabled:!0,radius:e};return this.filter(t)}channelPainter(e={}){let t={id:`channel-painter-${$()}`,type:"channel-painter",enabled:!0,red:e.red??1,green:e.green??1,blue:e.blue??1};return this.filter(t)}brightness(e=1){let t={id:`brightness-${$()}`,type:"brightness",enabled:!0,amount:e};return this.filter(t)}contrast(e=1){let t={id:`contrast-${$()}`,type:"contrast",enabled:!0,amount:e};return this.filter(t)}filterOpacity(e=1){let t={id:`opacity-${$()}`,type:"opacity",enabled:!0,amount:e};return this.filter(t)}invert(e=1){let t={id:`invert-${$()}`,type:"invert",enabled:!0,amount:e};return this.filter(t)}hueRotate(e=0){let t={id:`hue-rotate-${$()}`,type:"hue-rotate",enabled:!0,angle:e};return this.filter(t)}saturate(e=1){let t={id:`saturate-${$()}`,type:"saturate",enabled:!0,amount:e};return this.filter(t)}blackAndWhite(e=.5){let t={id:`black-and-white-${$()}`,type:"black-and-white",enabled:!0,threshold:e};return this.filter(t)}duotone(e={}){let t={id:`duotone-${$()}`,type:"duotone",enabled:!0,shadowColor:e.shadowColor??"#000000",highlightColor:e.highlightColor??"#ffffff"};return this.filter(t)}xray(e=1){let t={id:`xray-${$()}`,type:"xray",enabled:!0,intensity:e};return this.filter(t)}noise(e={}){let t={id:`noise-${$()}`,type:"noise",enabled:!0,amount:e.amount??.3,scale:e.scale??1};return this.filter(t)}emboss(e={}){let t={id:`emboss-${$()}`,type:"emboss",enabled:!0,strength:e.strength??1,angle:e.angle??135};return this.filter(t)}filmGrain(e={}){let t={id:`film-grain-${$()}`,type:"film-grain",enabled:!0,amount:e.amount??.3,size:e.size??1};return this.filter(t)}watercolor(e={}){let t={id:`watercolor-${$()}`,type:"watercolor",enabled:!0,wetness:e.wetness??.5,turbulence:e.turbulence??.5};return this.filter(t)}gouache(e={}){let t={id:`gouache-${$()}`,type:"gouache",enabled:!0,thickness:e.thickness??.5,texture:e.texture??.5};return this.filter(t)}inkBlot(e={}){let t={id:`ink-blot-${$()}`,type:"ink-blot",enabled:!0,spread:e.spread??.5,edges:e.edges??.5};return this.filter(t)}crumpledPlastic(e={}){let t={id:`crumpled-plastic-${$()}`,type:"crumpled-plastic",enabled:!0,wrinkles:e.wrinkles??.5,shine:e.shine??.5};return this.filter(t)}riddled(e={}){let t={id:`riddled-${$()}`,type:"riddled",enabled:!0,density:e.density??.5,size:e.size??1};return this.filter(t)}cssClipPath(e){return this._state.cssClipPath=e,this}cssMaskProperties(e){return this._state.cssMaskProperties=e,this}metadata(e){return this._state.metadata={...this._state.metadata,...e},this}group(e){return this._state.groupId=e,this}build(){return{id:this._id,type:this._type,state:{...this._state}}}},Ye=class extends C{constructor(e,t,n){if(n<0)throw new RangeError("Circle radius must be non-negative");super("circle"),this._state.x=e,this._state.y=t,this._state.radius=n}position(e,t){return this._state.x=e,this._state.y=t,this}radius(e){return this._state.radius=e,this}},qe=class extends C{constructor(e,t,n,s){if(n<0||s<0)throw new RangeError("Ellipse radii must be non-negative");super("ellipse"),this._state.cx=e,this._state.cy=t,this._state.rx=n,this._state.ry=s}position(e,t){return this._state.cx=e,this._state.cy=t,this}radii(e,t){return this._state.rx=e,this._state.ry=t,this}},Ze=class extends C{constructor(e,t,n,s){if(n<0||s<0)throw new RangeError("Rectangle dimensions must be non-negative");super("rectangle"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=s}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}cornerRadius(e){return this._state.cornerRadius=e,this}},Qe=class extends C{constructor(e,t,n){if(n<0)throw new RangeError("Square size must be non-negative");super("square"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=n}position(e,t){return this._state.x=e,this._state.y=t,this}size(e){return this._state.width=e,this._state.height=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},Ke=class extends C{constructor(e,t,n,s){super("line"),this._state.x1=e,this._state.y1=t,this._state.x2=n,this._state.y2=s}from(e,t){return this._state.x1=e,this._state.y1=t,this}to(e,t){return this._state.x2=e,this._state.y2=t,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},Je=class extends C{constructor(e,t,n){super("text"),this._state.x=e,this._state.y=t,this._state.text=n}position(e,t){return this._state.x=e,this._state.y=t,this}content(e){return this._state.text=e,this}fontSize(e){return this._state.fontSize=e,this}fontFamily(e){return this._state.fontFamily=e,this}fontWeight(e){return this._state.fontWeight=e,this}fontStyle(e){return this._state.fontStyle=e,this}anchor(e){return this._state.textAnchor=e,this}letterSpacing(e){return this._state.letterSpacing=e,this}lineHeight(e){return this._state.lineHeight=e,this}decoration(e){return this._state.textDecoration=e,this}transform(e){return this._state.textTransform=e,this}textPath(e,t=0){return this._state.isTextPath=!0,this._state.textPathPoints=e,this._state.textPathStartOffset=t,this}textPathOffset(e){return this._state.textPathStartOffset=e,this}textPathSide(e){return this._state.textPathSide=e,this}direction(e){return this._state.textDirection=e,this}unicodeBidi(e){return this._state.unicodeBidi=e,this}dominantBaseline(e){return this._state.dominantBaseline=e,this}writingMode(e){return this._state.writingMode=e,this}wordSpacing(e){return this._state.wordSpacing=e,this}baselineShift(e){return this._state.baselineShift=e,this}inlineSize(e){return this._state.inlineSize=e,this}overflowWrap(e){return this._state.overflowWrap=e,this}whiteSpace(e){return this._state.whiteSpace=e,this}fontVariationSettings(e){return this._state.fontVariationSettings=e,this}charOffsets(e){return this._state.charOffsets=e,this}shapeInsideRef(e){return this._state.shapeInsideRef=e,this}shapePadding(e){return this._state.shapePadding=e,this}richTextData(e){return this._state.richTextData=e,this}},D=class extends C{constructor(e,t,n,s){super(e),this._state.cx=t,this._state.cy=n,this._state.radius=s}position(e,t){return this._state.cx=e,this._state.cy=t,this}radius(e){return this._state.radius=e,this}shiftAngle(e){return this._state.shiftAngle=e,this}cornerRadius(e){return this._state.cornerRadius=e,this}},et=class extends D{constructor(e,t,n){super("triangle",e,t,n)}},tt=class extends D{constructor(e,t,n,s=5){super("ngon",e,t,n),this._state.sides=s}sides(e){return this._state.sides=e,this}},rt=class extends D{constructor(e,t,n){super("star",e,t,n),this._state.arms=5,this._state.innerRadiusPercent=40}arms(e){return this._state.arms=e,this}innerRadius(e){return this._state.innerRadiusPercent=e,this}},nt=class extends D{constructor(e,t,n){super("cross",e,t,n),this._state.armWidthPercent=35}armWidth(e){return this._state.armWidthPercent=e,this}},st=class extends D{constructor(e,t,n){super("ring",e,t,n),this._state.innerRadiusPercent=60}innerRadius(e){return this._state.innerRadiusPercent=e,this}},it=class extends D{constructor(e,t,n){super("spiral",e,t,n),this._state.turns=3,this._state.thicknessPercent=15,this._state.direction=1}turns(e){return this._state.turns=e,this}thickness(e){return this._state.thicknessPercent=e,this}direction(e){return this._state.direction=e,this}},at=class extends D{constructor(e,t,n){super("gear",e,t,n),this._state.teeth=8,this._state.toothDepthPercent=25}teeth(e){return this._state.teeth=e,this}toothDepth(e){return this._state.toothDepthPercent=e,this}holeRadius(e){return this._state.holeRadiusPercent=e,this}},ot=class extends D{constructor(e,t,n){super("arrow",e,t,n),this._state.headWidthPercent=100,this._state.headLengthPercent=35,this._state.shaftWidthPercent=35}headWidth(e){return this._state.headWidthPercent=e,this}headLength(e){return this._state.headLengthPercent=e,this}shaftWidth(e){return this._state.shaftWidthPercent=e,this}},lt=class extends C{constructor(e=[]){super("spline"),this._state.splinePoints=[...e],this._state.splineCurveType="cubic",this._state.splineClosed=!1}points(e){return this._state.splinePoints=[...e],this}addPoint(e,t){let n=this._state.splinePoints??[];return n.push({x:e,y:t}),this._state.splinePoints=n,this}curveType(e){return this._state.splineCurveType=e,this}closed(e=!0){return this._state.splineClosed=e,this}tension(e){return this._state.splineTension=e,this}arcParams(e){return this._state.splineArcParams=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},ut=class extends C{constructor(e=[]){super("polyline"),this._state.polylinePoints=[...e],this._state.polylineClosed=!1}points(e){return this._state.polylinePoints=[...e],this}addPoint(e,t){let n=this._state.polylinePoints??[];return n.push({x:e,y:t}),this._state.polylinePoints=n,this}closed(e=!0){return this._state.polylineClosed=e,this}markerStart(e){return this._state.startEndpoint=e,this}markerEnd(e){return this._state.endEndpoint=e,this}markers(e,t){return this._state.startEndpoint=e,this._state.endEndpoint=t,this}},ct=class extends C{constructor(e,t,n,s,a){super("image"),this._state.x=e,this._state.y=t,this._state.width=n,this._state.height=s,this._state.href=a}position(e,t){return this._state.x=e,this._state.y=t,this}size(e,t){return this._state.width=e,this._state.height=t,this}src(e){return this._state.href=e,this}preserveAspectRatio(e){return this._state.preserveAspectRatio=e,this}};var ae=class{constructor(e=0,t=0,n=1,s=0){this._stops=[];this._spreadMethod="pad";this._opacity=1;this._x1=e,this._y1=t,this._x2=n,this._y2=s,this._id=$()}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}direction(e,t,n,s){return this._x1=e,this._y1=t,this._x2=n,this._y2=s,this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"linear-gradient",id:this._id,x1:this._x1,y1:this._y1,x2:this._x2,y2:this._y2,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},oe=class{constructor(){this._cx=.5;this._cy=.5;this._fx=.5;this._fy=.5;this._r=.5;this._ry=.5;this._rotation=0;this._stops=[];this._spreadMethod="pad";this._opacity=1;this._id=$()}center(e,t){return this._cx=e,this._cy=t,this}focus(e,t){return this._fx=e,this._fy=t,this}radius(e,t){return this._r=e,this._ry=t??e,this}rotation(e){return this._rotation=e,this}stop(e,t,n=1){return this._stops.push({offset:e,color:t,opacity:n}),this}spread(e){return this._spreadMethod=e,this}opacity(e){return this._opacity=e,this}build(){return{type:"radial-gradient",id:this._id,cx:this._cx,cy:this._cy,fx:this._fx,fy:this._fy,r:this._r,ry:this._ry,rotation:this._rotation,stops:[...this._stops],spreadMethod:this._spreadMethod,opacity:this._opacity}}},le=class{constructor(e="stripes",t="#000000",n="#ffffff"){this._scale=1;this._rotation=0;this._opacity=1;this._patternType=e,this._color=t,this._backgroundColor=n,this._id=$()}scale(e){return this._scale=e,this}rotation(e){return this._rotation=e,this}opacity(e){return this._opacity=e,this}params(e){return this._patternParams=e,this}svgContent(e){return this._svgContent=e,this}size(e,t){return this._width=e,this._height=t,this}patternUnits(e){return this._patternUnits=e,this}patternContentUnits(e){return this._patternContentUnits=e,this}patternTransform(e){return this._patternTransform=e,this}viewBox(e){return this._viewBox=e,this}preserveAspectRatio(e){return this._preserveAspectRatio=e,this}position(e,t){return this._x=e,this._y=t,this}customPatternId(e){return this._customPatternId=e,this}build(){let e,t,n;if(this._svgContent!==void 0)e=this._svgContent,t=this._width??10,n=this._height??10;else{let a=Me(this._patternType,this._scale,this._color,this._backgroundColor,this._patternParams);e=a.svgContent,t=this._width??a.width,n=this._height??a.height}let s={type:"pattern",id:this._id,patternType:this._svgContent!==void 0?"custom":this._patternType,color:this._color,backgroundColor:this._backgroundColor,scale:this._scale,rotation:this._rotation,opacity:this._opacity,svgContent:e,width:t,height:n,patternUnits:this._patternUnits??"userSpaceOnUse",patternParams:this._patternParams,patternTransform:this._patternTransform??(this._rotation?`rotate(${this._rotation})`:void 0)};return this._patternContentUnits&&(s.patternContentUnits=this._patternContentUnits),this._viewBox&&(s.viewBox=this._viewBox),this._preserveAspectRatio&&(s.preserveAspectRatio=this._preserveAspectRatio),this._x!==void 0&&(s.x=this._x),this._y!==void 0&&(s.y=this._y),this._customPatternId&&(s.customPatternId=this._customPatternId),s}};function ln(r=0,e=0,t=1,n=0){return new ae(r,e,t,n)}function un(){return new oe}function cn(r="stripes",e="#000000",t="#ffffff"){return new le(r,e,t)}export{ot as Arrow,A as CURRENT_SCHEMA_VERSION,Ye as Circle,nt as Cross,je as Document,ue as EASING_CURVES,dn as EVENT_TRIGGER_OPTIONS,dt as EasingType,qe as Ellipse,at as Gear,ct as ImageShape,Ke as Line,ae as LinearGradientBuilder,Ae as MARKER_HEIGHT,Ce as MARKER_VIEWBOX,Re as MARKER_WIDTH,tt as NGon,le as PatternBuilder,ut as Polyline,oe as RadialGradientBuilder,Ze as Rectangle,st as Ring,C as ShapeBuilder,it as Spiral,lt as Spline,pt as SplineCurveType,Dt as SplinePointType,Qe as Square,rt as Star,Je as Text,Xe as Timeline,He as Track,et as Triangle,_e as computeArrowVertices,xe as computeCrossVertices,X as computeDashArray,we as computeGearPath,$t as computeGearVertices,ee as computePolygonVertices,Te as computeRectanglePath,Se as computeRingPath,ke as computeSpiralPath,ve as computeSplinePath,be as computeStarVertices,he as createDocument,jt as createShape,Z as createViewbox,M as escXml,ge as extractVariables,Pe as filterAttr,We as generateCode,ze as generateCssCode,Ue as generateD3Code,$ as generateId,Me as generatePatternSvgContent,Ve as generateReactCode,Le as generateSvgCode,Ne as generateVueCode,hn as getEasingCubicBezier,Fe as getMarkerDescriptors,ne as getPatternElements,ln as linearGradient,ce as migrateSnapshot,pe as parseDocument,Qt as parseVariableArgs,cn as pattern,un as radialGradient,Be as renderAnimationElements,Tt as renderCircle,vt as renderEllipse,V as renderFilterDefs,_t as renderFilterPrimitivesForType,Ft as renderImage,Mt as renderLine,Et as renderPolygonShape,At as renderPolyline,Pt as renderRectangle,E as renderShape,Rt as renderSpline,Ct as renderText,Y as renderToSvg,de as stringifyDocument,me as substituteString,fe as substituteVariables,q as validateSnapshot,N as verticesToPath};
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@svgsketch/core",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "description": "Core types, document format, and rendering engine for SVGSketch",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "require": "./dist/index.js",
13
+ "import": "./dist/index.mjs",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "license": "MIT",
18
+ "homepage": "https://docs.svgsketch.com",
19
+ "keywords": [
20
+ "svg",
21
+ "editor",
22
+ "document-format",
23
+ "sdk"
24
+ ],
25
+ "files": [
26
+ "dist",
27
+ "README.md"
28
+ ],
29
+ "scripts": {
30
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean --minify",
31
+ "check": "tsc --noEmit",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "prepare": "npm run build",
35
+ "prepack": "npm run build",
36
+ "generate-examples": "tsx examples/generate-examples.ts"
37
+ },
38
+ "devDependencies": {
39
+ "tsup": "^8.5.0",
40
+ "typescript": "^5.9.3",
41
+ "vitest": "^4.0.18"
42
+ }
43
+ }