function X(a,e,s){if(a&&a.length){const[t,n]=e,o=Math.PI/180*s,r=Math.cos(o),h=Math.sin(o);for(const i of a){const[l,c]=i;i[0]=(l-t)*r-(c-n)*h+t,i[1]=(l-t)*h+(c-n)*r+n}}}function Ot(a,e){return a[0]===e[0]&&a[1]===e[1]}function Lt(a,e,s,t=1){const n=s,o=Math.max(e,.1),r=a[0]&&a[0][0]&&typeof a[0][0]=="number"?[a]:a,h=[0,0];if(n)for(const l of r)X(l,h,n);const i=(function(l,c,d){const p=[];for(const M of l){const m=[...M];Ot(m[0],m[m.length-1])||m.push([m[0][0],m[0][1]]),m.length>2&&p.push(m)}const u=[];c=Math.max(c,.1);const f=[];for(const M of p)for(let m=0;mM.yminm.ymin?1:M.xm.x?1:M.ymax===m.ymax?0:(M.ymax-m.ymax)/Math.abs(M.ymax-m.ymax))),!f.length)return u;let g=[],k=f[0].ymin,b=0;for(;g.length||f.length;){if(f.length){let M=-1;for(let m=0;mk);m++)M=m;f.splice(0,M+1).forEach((m=>{g.push({s:k,edge:m})}))}if(g=g.filter((M=>!(M.edge.ymax<=k))),g.sort(((M,m)=>M.edge.x===m.edge.x?0:(M.edge.x-m.edge.x)/Math.abs(M.edge.x-m.edge.x))),(d!==1||b%c==0)&&g.length>1)for(let M=0;M=g.length)break;const P=g[M].edge,x=g[m].edge;u.push([[Math.round(P.x),k],[Math.round(x.x),k]])}k+=d,g.forEach((M=>{M.edge.x=M.edge.x+d*M.edge.islope})),b++}return u})(r,o,t);if(n){for(const l of r)X(l,h,-n);(function(l,c,d){const p=[];l.forEach((u=>p.push(...u))),X(p,c,d)})(i,h,-n)}return i}function j(a,e){var s;const t=e.hachureAngle+90;let n=e.hachureGap;n<0&&(n=4*e.strokeWidth),n=Math.round(Math.max(n,.1));let o=1;return e.roughness>=1&&(((s=e.randomizer)===null||s===void 0?void 0:s.next())||Math.random())>.7&&(o=n),Lt(a,n,t,o||1)}class ht{constructor(e){this.helper=e}fillPolygons(e,s){return this._fillPolygons(e,s)}_fillPolygons(e,s){const t=j(e,s);return{type:"fillSketch",ops:this.renderLines(t,s)}}renderLines(e,s){const t=[];for(const n of e)t.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],s));return t}}function U(a){const e=a[0],s=a[1];return Math.sqrt(Math.pow(e[0]-s[0],2)+Math.pow(e[1]-s[1],2))}class Tt extends ht{fillPolygons(e,s){let t=s.hachureGap;t<0&&(t=4*s.strokeWidth),t=Math.max(t,.1);const n=j(e,Object.assign({},s,{hachureGap:t})),o=Math.PI/180*s.hachureAngle,r=[],h=.5*t*Math.cos(o),i=.5*t*Math.sin(o);for(const[l,c]of n)U([l,c])&&r.push([[l[0]-h,l[1]+i],[...c]],[[l[0]+h,l[1]-i],[...c]]);return{type:"fillSketch",ops:this.renderLines(r,s)}}}class Dt extends ht{fillPolygons(e,s){const t=this._fillPolygons(e,s),n=Object.assign({},s,{hachureAngle:s.hachureAngle+90}),o=this._fillPolygons(e,n);return t.ops=t.ops.concat(o.ops),t}}class At{constructor(e){this.helper=e}fillPolygons(e,s){const t=j(e,s=Object.assign({},s,{hachureAngle:0}));return this.dotsOnLines(t,s)}dotsOnLines(e,s){const t=[];let n=s.hachureGap;n<0&&(n=4*s.strokeWidth),n=Math.max(n,.1);let o=s.fillWeight;o<0&&(o=s.strokeWidth/2);const r=n/4;for(const h of e){const i=U(h),l=i/n,c=Math.ceil(l)-1,d=i-c*n,p=(h[0][0]+h[1][0])/2-n/4,u=Math.min(h[0][1],h[1][1]);for(let f=0;f{const h=U(r),i=Math.floor(h/(t+n)),l=(h+n-i*(t+n))/2;let c=r[0],d=r[1];c[0]>d[0]&&(c=r[1],d=r[0]);const p=Math.atan((d[1]-c[1])/(d[0]-c[0]));for(let u=0;u{const r=U(o),h=Math.round(r/(2*s));let i=o[0],l=o[1];i[0]>l[0]&&(i=o[1],l=o[0]);const c=Math.atan((l[1]-i[1])/(l[0]-i[0]));for(let d=0;dc%2?l+s:l+e));o.push({key:"C",data:i}),e=i[4],s=i[5];break}case"Q":o.push({key:"Q",data:[...h]}),e=h[2],s=h[3];break;case"q":{const i=h.map(((l,c)=>c%2?l+s:l+e));o.push({key:"Q",data:i}),e=i[2],s=i[3];break}case"A":o.push({key:"A",data:[...h]}),e=h[5],s=h[6];break;case"a":e+=h[5],s+=h[6],o.push({key:"A",data:[h[0],h[1],h[2],h[3],h[4],e,s]});break;case"H":o.push({key:"H",data:[...h]}),e=h[0];break;case"h":e+=h[0],o.push({key:"H",data:[e]});break;case"V":o.push({key:"V",data:[...h]}),s=h[0];break;case"v":s+=h[0],o.push({key:"V",data:[s]});break;case"S":o.push({key:"S",data:[...h]}),e=h[2],s=h[3];break;case"s":{const i=h.map(((l,c)=>c%2?l+s:l+e));o.push({key:"S",data:i}),e=i[2],s=i[3];break}case"T":o.push({key:"T",data:[...h]}),e=h[0],s=h[1];break;case"t":e+=h[0],s+=h[1],o.push({key:"T",data:[e,s]});break;case"Z":case"z":o.push({key:"Z",data:[]}),e=t,s=n}return o}function yt(a){const e=[];let s="",t=0,n=0,o=0,r=0,h=0,i=0;for(const{key:l,data:c}of a){switch(l){case"M":e.push({key:"M",data:[...c]}),[t,n]=c,[o,r]=c;break;case"C":e.push({key:"C",data:[...c]}),t=c[4],n=c[5],h=c[2],i=c[3];break;case"L":e.push({key:"L",data:[...c]}),[t,n]=c;break;case"H":t=c[0],e.push({key:"L",data:[t,n]});break;case"V":n=c[0],e.push({key:"L",data:[t,n]});break;case"S":{let d=0,p=0;s==="C"||s==="S"?(d=t+(t-h),p=n+(n-i)):(d=t,p=n),e.push({key:"C",data:[d,p,...c]}),h=c[0],i=c[1],t=c[2],n=c[3];break}case"T":{const[d,p]=c;let u=0,f=0;s==="Q"||s==="T"?(u=t+(t-h),f=n+(n-i)):(u=t,f=n);const g=t+2*(u-t)/3,k=n+2*(f-n)/3,b=d+2*(u-d)/3,M=p+2*(f-p)/3;e.push({key:"C",data:[g,k,b,M,d,p]}),h=u,i=f,t=d,n=p;break}case"Q":{const[d,p,u,f]=c,g=t+2*(d-t)/3,k=n+2*(p-n)/3,b=u+2*(d-u)/3,M=f+2*(p-f)/3;e.push({key:"C",data:[g,k,b,M,u,f]}),h=d,i=p,t=u,n=f;break}case"A":{const d=Math.abs(c[0]),p=Math.abs(c[1]),u=c[2],f=c[3],g=c[4],k=c[5],b=c[6];d===0||p===0?(e.push({key:"C",data:[t,n,k,b,k,b]}),t=k,n=b):(t!==k||n!==b)&&(mt(t,n,k,b,d,p,u,f,g).forEach((function(M){e.push({key:"C",data:M})})),t=k,n=b);break}case"Z":e.push({key:"Z",data:[]}),t=o,n=r}s=l}return e}function $(a,e,s){return[a*Math.cos(s)-e*Math.sin(s),a*Math.sin(s)+e*Math.cos(s)]}function mt(a,e,s,t,n,o,r,h,i,l){const c=(d=r,Math.PI*d/180);var d;let p=[],u=0,f=0,g=0,k=0;if(l)[u,f,g,k]=l;else{[a,e]=$(a,e,-c),[s,t]=$(s,t,-c);const T=(a-s)/2,v=(e-t)/2;let _=T*T/(n*n)+v*v/(o*o);_>1&&(_=Math.sqrt(_),n*=_,o*=_);const W=n*n,E=o*o,vt=W*E-W*v*v-E*T*T,St=W*v*v+E*T*T,ct=(h===i?-1:1)*Math.sqrt(Math.abs(vt/St));g=ct*n*v/o+(a+s)/2,k=ct*-o*T/n+(e+t)/2,u=Math.asin(parseFloat(((e-k)/o).toFixed(9))),f=Math.asin(parseFloat(((t-k)/o).toFixed(9))),af&&(u-=2*Math.PI),!i&&f>u&&(f-=2*Math.PI)}let b=f-u;if(Math.abs(b)>120*Math.PI/180){const T=f,v=s,_=t;f=i&&f>u?u+120*Math.PI/180*1:u+120*Math.PI/180*-1,p=mt(s=g+n*Math.cos(f),t=k+o*Math.sin(f),v,_,n,o,r,0,i,[f,T,g,k])}b=f-u;const M=Math.cos(u),m=Math.sin(u),P=Math.cos(f),x=Math.sin(f),w=Math.tan(b/4),L=4/3*n*w,A=4/3*o*w,q=[a,e],D=[a+L*m,e-A*M],C=[s+L*x,t-A*P],it=[s,t];if(D[0]=2*q[0]-D[0],D[1]=2*q[1]-D[1],l)return[D,C,it].concat(p);{p=[D,C,it].concat(p);const T=[];for(let v=0;v2){const n=[];for(let o=0;o2*Math.PI&&(u=0,f=2*Math.PI);const g=2*Math.PI/i.curveStepCount,k=Math.min(g/2,(f-u)/2),b=Mt(k,l,c,d,p,u,f,1,i);if(!i.disableMultiStroke){const M=Mt(k,l,c,d,p,u,f,1.5,i);b.push(...M)}return r&&(h?b.push(...I(l,c,l+d*Math.cos(u),c+p*Math.sin(u),i),...I(l,c,l+d*Math.cos(f),c+p*Math.sin(f),i)):b.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+d*Math.cos(u),c+p*Math.sin(u)]})),{type:"path",ops:b}}function ft(a,e){const s=yt(bt(rt(a))),t=[];let n=[0,0],o=[0,0];for(const{key:r,data:h}of s)switch(r){case"M":o=[h[0],h[1]],n=[h[0],h[1]];break;case"L":t.push(...I(o[0],o[1],h[0],h[1],e)),o=[h[0],h[1]];break;case"C":{const[i,l,c,d,p,u]=h;t.push(...Gt(i,l,c,d,p,u,o,e)),o=[p,u];break}case"Z":t.push(...I(o[0],o[1],n[0],n[1],e)),o=[n[0],n[1]]}return{type:"path",ops:t}}function et(a,e){const s=[];for(const t of a)if(t.length){const n=e.maxRandomnessOffset||0,o=t.length;if(o>2){s.push({op:"move",data:[t[0][0]+y(n,e),t[0][1]+y(n,e)]});for(let r=1;r500?.4:-.0016668*i+1.233334;let c=n.maxRandomnessOffset||0;c*c*100>h&&(c=i/10);const d=c/2,p=.2+.2*Pt(n);let u=n.bowing*n.maxRandomnessOffset*(t-e)/200,f=n.bowing*n.maxRandomnessOffset*(a-s)/200;u=y(u,n,l),f=y(f,n,l);const g=[],k=()=>y(d,n,l),b=()=>y(c,n,l),M=n.preserveVertices;return r?g.push({op:"move",data:[a+(M?0:k()),e+(M?0:k())]}):g.push({op:"move",data:[a+(M?0:y(c,n,l)),e+(M?0:y(c,n,l))]}),r?g.push({op:"bcurveTo",data:[u+a+(s-a)*p+k(),f+e+(t-e)*p+k(),u+a+2*(s-a)*p+k(),f+e+2*(t-e)*p+k(),s+(M?0:k()),t+(M?0:k())]}):g.push({op:"bcurveTo",data:[u+a+(s-a)*p+b(),f+e+(t-e)*p+b(),u+a+2*(s-a)*p+b(),f+e+2*(t-e)*p+b(),s+(M?0:b()),t+(M?0:b())]}),g}function V(a,e,s){if(!a.length)return[];const t=[];t.push([a[0][0]+y(e,s),a[0][1]+y(e,s)]),t.push([a[0][0]+y(e,s),a[0][1]+y(e,s)]);for(let n=1;n3){const o=[],r=1-s.curveTightness;n.push({op:"move",data:[a[1][0],a[1][1]]});for(let h=1;h+21&&n.push(h)):n.push(h),n.push(a[e+3])}else{const i=a[e+0],l=a[e+1],c=a[e+2],d=a[e+3],p=z(i,l,.5),u=z(l,c,.5),f=z(c,d,.5),g=z(p,u,.5),k=z(u,f,.5),b=z(g,k,.5);ot([i,p,g,b],0,s,n),ot([b,k,f,d],0,s,n)}var o,r;return n}function Rt(a,e){return J(a,0,a.length,e)}function J(a,e,s,t,n){const o=n||[],r=a[e],h=a[s-1];let i=0,l=1;for(let c=e+1;ci&&(i=d,l=c)}return Math.sqrt(i)>t?(J(a,e,l+1,t,o),J(a,l,s,t,o)):(o.length||o.push(r),o.push(h)),o}function st(a,e=.15,s){const t=[],n=(a.length-1)/3;for(let o=0;o0?J(t,0,t.length,s):t}const O="none";class K{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,s,t){return{shape:e,sets:s||[],options:t||this.defaultOptions}}line(e,s,t,n,o){const r=this._o(o);return this._d("line",[wt(e,s,t,n,r)],r)}rectangle(e,s,t,n,o){const r=this._o(o),h=[],i=Et(e,s,t,n,r);if(r.fill){const l=[[e,s],[e+t,s],[e+t,s+n],[e,s+n]];r.fillStyle==="solid"?h.push(et([l],r)):h.push(G([l],r))}return r.stroke!==O&&h.push(i),this._d("rectangle",h,r)}ellipse(e,s,t,n,o){const r=this._o(o),h=[],i=xt(t,n,r),l=nt(e,s,r,i);if(r.fill)if(r.fillStyle==="solid"){const c=nt(e,s,r,i).opset;c.type="fillPath",h.push(c)}else h.push(G([l.estimatedPoints],r));return r.stroke!==O&&h.push(l.opset),this._d("ellipse",h,r)}circle(e,s,t,n){const o=this.ellipse(e,s,t,t,n);return o.shape="circle",o}linearPath(e,s){const t=this._o(s);return this._d("linearPath",[Q(e,!1,t)],t)}arc(e,s,t,n,o,r,h=!1,i){const l=this._o(i),c=[],d=pt(e,s,t,n,o,r,h,!0,l);if(h&&l.fill)if(l.fillStyle==="solid"){const p=Object.assign({},l);p.disableMultiStroke=!0;const u=pt(e,s,t,n,o,r,!0,!1,p);u.type="fillPath",c.push(u)}else c.push((function(p,u,f,g,k,b,M){const m=p,P=u;let x=Math.abs(f/2),w=Math.abs(g/2);x+=y(.01*x,M),w+=y(.01*w,M);let L=k,A=b;for(;L<0;)L+=2*Math.PI,A+=2*Math.PI;A-L>2*Math.PI&&(L=0,A=2*Math.PI);const q=(A-L)/M.curveStepCount,D=[];for(let C=L;C<=A;C+=q)D.push([m+x*Math.cos(C),P+w*Math.sin(C)]);return D.push([m+x*Math.cos(A),P+w*Math.sin(A)]),D.push([m,P]),G([D],M)})(e,s,t,n,o,r,l));return l.stroke!==O&&c.push(d),this._d("arc",c,l)}curve(e,s){const t=this._o(s),n=[],o=ut(e,t);if(t.fill&&t.fill!==O)if(t.fillStyle==="solid"){const r=ut(e,Object.assign(Object.assign({},t),{disableMultiStroke:!0,roughness:t.roughness?t.roughness+t.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(r.ops)})}else{const r=[],h=e;if(h.length){const i=typeof h[0][0]=="number"?[h]:h;for(const l of i)l.length<3?r.push(...l):l.length===3?r.push(...st(kt([l[0],l[0],l[1],l[2]]),10,(1+t.roughness)/2)):r.push(...st(kt(l),10,(1+t.roughness)/2))}r.length&&n.push(G([r],t))}return t.stroke!==O&&n.push(o),this._d("curve",n,t)}polygon(e,s){const t=this._o(s),n=[],o=Q(e,!0,t);return t.fill&&(t.fillStyle==="solid"?n.push(et([e],t)):n.push(G([e],t))),t.stroke!==O&&n.push(o),this._d("polygon",n,t)}path(e,s){const t=this._o(s),n=[];if(!e)return this._d("path",n,t);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const o=t.fill&&t.fill!=="transparent"&&t.fill!==O,r=t.stroke!==O,h=!!(t.simplification&&t.simplification<1),i=(function(c,d,p){const u=yt(bt(rt(c))),f=[];let g=[],k=[0,0],b=[];const M=()=>{b.length>=4&&g.push(...st(b,d)),b=[]},m=()=>{M(),g.length&&(f.push(g),g=[])};for(const{key:x,data:w}of u)switch(x){case"M":m(),k=[w[0],w[1]],g.push(k);break;case"L":M(),g.push([w[0],w[1]]);break;case"C":if(!b.length){const L=g.length?g[g.length-1]:k;b.push([L[0],L[1]])}b.push([w[0],w[1]]),b.push([w[2],w[3]]),b.push([w[4],w[5]]);break;case"Z":M(),g.push([k[0],k[1]])}if(m(),!p)return f;const P=[];for(const x of f){const w=Rt(x,p);w.length&&P.push(w)}return P})(e,1,h?4-4*(t.simplification||1):(1+t.roughness)/2),l=ft(e,t);if(o)if(t.fillStyle==="solid")if(i.length===1){const c=ft(e,Object.assign(Object.assign({},t),{disableMultiStroke:!0,roughness:t.roughness?t.roughness+t.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else n.push(et(i,t));else n.push(G(i,t));return r&&(h?i.forEach((c=>{n.push(Q(c,!1,t))})):n.push(l)),this._d("path",n,t)}opsToPath(e,s){let t="";for(const n of e.ops){const o=typeof s=="number"&&s>=0?n.data.map((r=>+r.toFixed(s))):n.data;switch(n.op){case"move":t+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":t+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":t+=`L${o[0]} ${o[1]} `}}return t.trim()}toPaths(e){const s=e.sets||[],t=e.options||this.defaultOptions,n=[];for(const o of s){let r=null;switch(o.type){case"path":r={d:this.opsToPath(o),stroke:t.stroke,strokeWidth:t.strokeWidth,fill:O};break;case"fillPath":r={d:this.opsToPath(o),stroke:O,strokeWidth:0,fill:t.fill||O};break;case"fillSketch":r=this.fillSketch(o,t)}r&&n.push(r)}return n}fillSketch(e,s){let t=s.fillWeight;return t<0&&(t=s.strokeWidth/2),{d:this.opsToPath(e),stroke:s.fill||O,strokeWidth:t,fill:O}}_mergedShape(e){return e.filter(((s,t)=>t===0||s.op!=="move"))}}class jt{constructor(e,s){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new K(s)}draw(e){const s=e.sets||[],t=e.options||this.getDefaultOptions(),n=this.ctx,o=e.options.fixedDecimalPlaceDigits;for(const r of s)switch(r.type){case"path":n.save(),n.strokeStyle=t.stroke==="none"?"transparent":t.stroke,n.lineWidth=t.strokeWidth,t.strokeLineDash&&n.setLineDash(t.strokeLineDash),t.strokeLineDashOffset&&(n.lineDashOffset=t.strokeLineDashOffset),this._drawToContext(n,r,o),n.restore();break;case"fillPath":{n.save(),n.fillStyle=t.fill||"";const h=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,r,o,h),n.restore();break}case"fillSketch":this.fillSketch(n,r,t)}}fillSketch(e,s,t){let n=t.fillWeight;n<0&&(n=t.strokeWidth/2),e.save(),t.fillLineDash&&e.setLineDash(t.fillLineDash),t.fillLineDashOffset&&(e.lineDashOffset=t.fillLineDashOffset),e.strokeStyle=t.fill||"",e.lineWidth=n,this._drawToContext(e,s,t.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,s,t,n="nonzero"){e.beginPath();for(const o of s.ops){const r=typeof t=="number"&&t>=0?o.data.map((h=>+h.toFixed(t))):o.data;switch(o.op){case"move":e.moveTo(r[0],r[1]);break;case"bcurveTo":e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"lineTo":e.lineTo(r[0],r[1])}}s.type==="fillPath"?e.fill(n):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,s,t,n,o){const r=this.gen.line(e,s,t,n,o);return this.draw(r),r}rectangle(e,s,t,n,o){const r=this.gen.rectangle(e,s,t,n,o);return this.draw(r),r}ellipse(e,s,t,n,o){const r=this.gen.ellipse(e,s,t,n,o);return this.draw(r),r}circle(e,s,t,n){const o=this.gen.circle(e,s,t,n);return this.draw(o),o}linearPath(e,s){const t=this.gen.linearPath(e,s);return this.draw(t),t}polygon(e,s){const t=this.gen.polygon(e,s);return this.draw(t),t}arc(e,s,t,n,o,r,h=!1,i){const l=this.gen.arc(e,s,t,n,o,r,h,i);return this.draw(l),l}curve(e,s){const t=this.gen.curve(e,s);return this.draw(t),t}path(e,s){const t=this.gen.path(e,s);return this.draw(t),t}}const Z="http://www.w3.org/2000/svg";class qt{constructor(e,s){this.svg=e,this.gen=new K(s)}draw(e){const s=e.sets||[],t=e.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,o=n.createElementNS(Z,"g"),r=e.options.fixedDecimalPlaceDigits;for(const h of s){let i=null;switch(h.type){case"path":i=n.createElementNS(Z,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-width",t.strokeWidth+""),i.setAttribute("fill","none"),t.strokeLineDash&&i.setAttribute("stroke-dasharray",t.strokeLineDash.join(" ").trim()),t.strokeLineDashOffset&&i.setAttribute("stroke-dashoffset",`${t.strokeLineDashOffset}`);break;case"fillPath":i=n.createElementNS(Z,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke","none"),i.setAttribute("stroke-width","0"),i.setAttribute("fill",t.fill||""),e.shape!=="curve"&&e.shape!=="polygon"||i.setAttribute("fill-rule","evenodd");break;case"fillSketch":i=this.fillSketch(n,h,t)}i&&o.appendChild(i)}return o}fillSketch(e,s,t){let n=t.fillWeight;n<0&&(n=t.strokeWidth/2);const o=e.createElementNS(Z,"path");return o.setAttribute("d",this.opsToPath(s,t.fixedDecimalPlaceDigits)),o.setAttribute("stroke",t.fill||""),o.setAttribute("stroke-width",n+""),o.setAttribute("fill","none"),t.fillLineDash&&o.setAttribute("stroke-dasharray",t.fillLineDash.join(" ").trim()),t.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${t.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,s){return this.gen.opsToPath(e,s)}line(e,s,t,n,o){const r=this.gen.line(e,s,t,n,o);return this.draw(r)}rectangle(e,s,t,n,o){const r=this.gen.rectangle(e,s,t,n,o);return this.draw(r)}ellipse(e,s,t,n,o){const r=this.gen.ellipse(e,s,t,n,o);return this.draw(r)}circle(e,s,t,n){const o=this.gen.circle(e,s,t,n);return this.draw(o)}linearPath(e,s){const t=this.gen.linearPath(e,s);return this.draw(t)}polygon(e,s){const t=this.gen.polygon(e,s);return this.draw(t)}arc(e,s,t,n,o,r,h=!1,i){const l=this.gen.arc(e,s,t,n,o,r,h,i);return this.draw(l)}curve(e,s){const t=this.gen.curve(e,s);return this.draw(t)}path(e,s){const t=this.gen.path(e,s);return this.draw(t)}}var Ft={canvas:(a,e)=>new jt(a,e),svg:(a,e)=>new qt(a,e),generator:a=>new K(a),newSeed:()=>K.newSeed()};export{Ft as a};