import{line as e,rectangle as t,ellipse as o,polygon as n,doubleLineFillOps as r,generateEllipseParams as s}from"../../roughjs/bin/renderer.js";import{ZigZagFiller as i}from"../../roughjs/bin/fillers/zigzag-filler.js";const a={randOffset:(e,t)=>e,randOffsetWithRange:(e,t,o)=>(e+t)/2,ellipse:(e,t,n,r,s)=>o(e,t,n,r,s),doubleLineOps:(e,t,o,n,s)=>r(e,t,o,n,s)};function options(e){return{maxRandomnessOffset:2,roughness:1,bowing:.85,stroke:"#000",strokeWidth:1.5,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:3.5,hachureAngle:-41,hachureGap:5,dashOffset:-1,dashGap:-1,zigzagOffset:0,combineNestedSvgPaths:!1,disableMultiStroke:!1,disableMultiStrokeFill:!1,seed:e}}function opsToPath(e,t){let o="";for(const n of e.ops){const e=n.data;switch(n.op){case"move":if(t&&o)break;o+=`M${e[0]} ${e[1]} `;break;case"bcurveTo":o+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case"lineTo":o+=`L${e[0]} ${e[1]} `}}return o.trim()}export function svgNode(e,t){const o=document.createElementNS("http://www.w3.org/2000/svg",e);if(t)for(const e in t)o.setAttributeNS(null,e,t[e]);return o}function createPathNode(e,t,o=!1){const n=svgNode("path",{d:opsToPath(e,o)});return t&&t.appendChild(n),n}export function rectangle(e,o,n,r,s,i){return createPathNode(t(o+2,n+2,r-4,s-4,options(i)),e)}export function line(t,o,n,r,s,i){return createPathNode(e(o,n,r,s,options(i)),t)}export function polygon(e,t,o){return createPathNode(n(t,options(o)),e,!0)}export function ellipse(e,t,n,r,s,i){return r=Math.max(r>10?r-4:r-1,1),s=Math.max(s>10?s-4:s-1,1),createPathNode(o(t,n,r,s,options(i)),e)}export function hachureFill(e,t){return createPathNode(new i(a).fillPolygon(e,options(t)),null)}export function hachureEllipseFill(e,t,o,n,r){const i=options(r),a=s(o,n,i),l=[];let c=0;for(;c<=2*Math.PI;)l.push([e+a.rx*Math.cos(c),t+a.ry*Math.sin(c)]),c+=a.increment;return hachureFill(l,r)}