UNPKG

svg-kit

Version:

A SVG toolkit, with its own Vector Graphics structure, multiple renderers (svg text, DOM svg, canvas), and featuring Flowing Text.

1 lines 676 kB
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.svgKit=e()}})(function(){var i,e,t;return function(){function h(a,s,o){function l(r,e){if(!s[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(u)return u(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return l(t||e)},i,i.exports,h,a,s,o)}return s[r].exports}for(var u="function"==typeof require&&require,e=0;e<o.length;e++)l(o[e]);return l}return h}()({1:[function(e,t,r){"use strict";function n(e=0,t=0,r=e,n=t){this.xmin=0;this.ymin=0;this.xmax=0;this.ymax=0;if(e&&typeof e==="object"){this.set(e)}else if(e===null){this.xmin=Infinity;this.xmax=-Infinity;this.ymin=Infinity;this.ymax=-Infinity}else{this.xmin=e;this.ymin=t;this.xmax=r;this.ymax=n}}t.exports=n;n.prototype.set=function(e){if(e instanceof n){this.xmin=e.xmin;this.ymin=e.ymin;this.xmax=e.xmax;this.ymax=e.ymax;return}if(e.xmin!==undefined){this.xmin=e.xmin}if(e.ymin!==undefined){this.ymin=e.ymin}if(e.xmax!==undefined){this.xmax=e.xmax}if(e.ymax!==undefined){this.ymax=e.ymax}if(e.x!==undefined){this.x=e.x}if(e.y!==undefined){this.y=e.y}if(e.width!==undefined){this.width=e.width}if(e.height!==undefined){this.height=e.height}};n.prototype.setMinMax=function(e=0,t=0,r=e,n=t){this.xmin=e;this.ymin=t;this.xmax=r;this.ymax=n};n.prototype.nullify=function(){this.xmin=Infinity;this.xmax=-Infinity;this.ymin=Infinity;this.ymax=-Infinity};n.prototype.isNull=function(){return this.xmin===Infinity&&this.xmax===-Infinity&&this.ymin===Infinity&&this.ymax===-Infinity};n.prototype.isZero=function(){return this.xmin>=this.xmax||this.ymin>=this.ymax};Object.defineProperties(n.prototype,{x:{get:function(){return this.xmin},set:function(e){var t=this.xmax-this.xmin;this.xmin=e;this.xmax=this.xmin+t}},y:{get:function(){return this.ymin},set:function(e){var t=this.ymax-this.ymin;this.ymin=e;this.ymax=this.ymin+t}},width:{get:function(){return this.xmax-this.xmin},set:function(e){this.xmax=this.xmin+e}},height:{get:function(){return this.ymax-this.ymin},set:function(e){this.ymax=this.ymin+e}}});n.prototype.export=function(){return{xmin:this.xmin,ymin:this.ymin,xmax:this.xmax,ymax:this.ymax}};n.prototype.dup=n.prototype.clone=function(){return new n(this.xmin,this.ymin,this.xmax,this.ymax)};n.prototype.round=function(e){this.xmin=Math.floor(this.xmin);this.ymin=Math.floor(this.ymin);this.xmax=Math.ceil(this.xmax);this.ymax=Math.ceil(this.ymax);return this};n.prototype.merge=function(e){this.xmin=Math.min(this.xmin,e.xmin);this.ymin=Math.min(this.ymin,e.ymin);this.xmax=Math.max(this.xmax,e.xmax);this.ymax=Math.max(this.ymax,e.ymax);return this};n.prototype.mergeArray=function(t){for(let e of t){this.xmin=Math.min(this.xmin,e.xmin);this.ymin=Math.min(this.ymin,e.ymin);this.xmax=Math.max(this.xmax,e.xmax);this.ymax=Math.max(this.ymax,e.ymax)}return this};n.prototype.ensurePoint=function(e){this.xmin=Math.min(this.xmin,e.x);this.ymin=Math.min(this.ymin,e.y);this.xmax=Math.max(this.xmax,e.x);this.ymax=Math.max(this.ymax,e.y);return this};n.prototype.ensurePointArray=function(t){for(let e of t){this.xmin=Math.min(this.xmin,e.x);this.ymin=Math.min(this.ymin,e.y);this.xmax=Math.max(this.xmax,e.x);this.ymax=Math.max(this.ymax,e.y)}return this};n.prototype.isEqualTo=function(e){return e.xmin===this.xmin&&e.xmax===this.xmax&&e.ymin===this.ymin&&e.ymax===this.ymax};n.prototype.isEqualToObject=function(e){if(e.width!==undefined){return e.x===this.xmin&&e.width===this.width&&e.y===this.ymin&&e.height===this.height}if(e.xmin!==undefined){return e.xmin===this.xmin&&e.xmax===this.xmax&&e.ymin===this.ymin&&e.ymax===this.ymax}return false};n.prototype.isInside=function(e){return e.x>=this.xmin&&e.x<=this.xmax&&e.y>=this.ymin&&e.y<=this.ymax};n.prototype.enlarge=function(e){e=+e||0;if(e<0){return this.shrink(-e)}this.xmin-=e;this.xmax+=e;this.ymin-=e;this.ymax+=e;return this};n.prototype.shrink=function(e,t=0){e=+e||0;if(e<0){return this.enlarge(-e)}var r=this.xmax-this.xmin,n=this.ymax-this.ymin;if(r<2*e){this.xmin+=r/2-t/2;this.xmax-=r/2-t/2}else{this.xmin+=e;this.xmax-=e}if(n<2*e){this.ymin+=n/2-t/2;this.ymax-=n/2-t/2}else{this.ymin+=e;this.ymax-=e}return this}},{}],2:[function(e,t,r){"use strict";const a=e("./Polygon.js");const n=e("./BoundingBox.js");function i(e){this.points=[];this.sides=[];this.boundingBox=new n(null);this.badConvexPolygon=false;if(e){this.set(e)}}t.exports=i;i.prototype=Object.create(a.prototype);i.prototype.constructor=i;i.prototype.__prototypeUID__="svg-kit/ConvexPolygon";i.prototype.__prototypeVersion__=e("../package.json").version;i.prototype.set=function(e){a.prototype.set.call(this,e)};i.prototype.setPoints=function(e){a.prototype.setPoints.call(this,e)};i.prototype.isInside=function(t){if(!this.sides.length){return false}return this.totalAngle>0?this.sides.every(e=>a.testSideLineEquation(e,t)>=0):this.sides.every(e=>a.testSideLineEquation(e,t)<=0)};i.prototype.checkConvex=function(){this.badConvexPolygon=false;if(!this.sides.length){return true}for(let i=0;i<this.sides.length;i++){let n=this.sides[i];for(let r=i+2;r<this.points.length;r++){if(r===i||r===(i+1)%this.sides.length){continue}let e=this.points[r];let t=this.totalAngle>0?a.testSideLineEquation(n,e)>0:a.testSideLineEquation(n,e)<0;if(!t){console.warn("Bad convex polygon, probably not simple/convex");this.badConvexPolygon=true;return false}}}return true}},{"../package.json":110,"./BoundingBox.js":1,"./Polygon.js":14}],3:[function(e,t,r){"use strict";const n=e("./BoundingBox.js");function i(e,t){this.availableStatus=new Set;this.status="base";this.everyTick=1;this.tick=0;this.area=null;this.boundingBox=new n(e.boundingBox);this.statusData={};this.morph=null;this.toEmit=[];this.noRedraw=t.noRedraw||false;this.outdated=false;this.backgroundImageData=null;this.useEntityBackgroundImageData=true;Object.defineProperties(this,{entity:{value:e}});this.set(t);this.outdated=false;if(this.useEntityBackgroundImageData&&!this.noRedraw){this.entity.needFullDraw=true;if(this.entity.root){this.entity.root.needFullDraw=true}}}t.exports=i;i.prototype.__prototypeUID__="svg-kit/DynamicArea";i.prototype.__prototypeVersion__=e("../package.json").version;i.prototype.set=function(t){if(t.everyTick){this.everyTick=+t.everyTick||1}if(t.statusData&&typeof t.statusData==="object"){for(let e in t.statusData){this.setStatusMorph(e,t.statusData[e])}}if(t.status){this.setStatus(t.status)}if(t.boundingBox&&typeof t.boundingBox==="object"){this.boundingBox.set(t.boundingBox);if(this.useEntityBackgroundImageData&&!this.boundingBox.isEqualTo(this.entity.boundingBox)){this.useEntityBackgroundImageData=false}}};i.prototype.setStatusMorph=function(e,t){if(!this.availableStatus.has(e)){this.availableStatus.add(e)}if(t.frames){t.modulo=t.frames.reduce((e,t)=>e+(t.ticks||1),0)}this.statusData[e]=t;if(!this.noRedraw){this.outdated=true}};i.prototype.setStatus=function(e){if(e&&e!==this.status&&this.availableStatus.has(e)){this.status=e;this.updateMorph();let t=this.statusData[this.status];if(t.emit){let e={name:t.emit.name,data:Object.assign({},t.emit.data)};e.data.boundingBox=this.boundingBox.export();e.data.entityUid=this.entity._id;this.toEmit.push(e)}}};i.prototype.setTick=function(e){e=Math.floor(e/this.everyTick);if(e===this.tick){return}this.tick=e;this.updateMorph()};i.prototype.updateMorph=function(){var r=this.statusData[this.status];if(!r){return}var n=null;if(r.morph){n=r.morph}else if(r.frames){let t=this.tick%r.modulo;for(let e of r.frames){if(t<e.ticks){n=e.morph;break}t-=e.ticks}}else if(r.eachFrame){n=r.eachFrame(this)}else{return}if(n===true){if(!this.noRedraw){this.outdated=true}return}if(!n||n===this.morph){return}this.morph=n;this.entity.set(this.morph);if(!this.noRedraw){this.outdated=true}};i.prototype.getEmittableEvent=function(r){for(let e in this.statusData){let t=this.statusData[e];if(t.emit?.name===r){let e=Object.assign({},t.emit.data);e.boundingBox=this.boundingBox.export();e.entityUid=this.entity._id;return e}}return null};i.prototype.save=function(e){if(this.noRedraw){return}if(this.useEntityBackgroundImageData){if(this.entity.backgroundImageUsed){return}this.entity.backgroundImageData=e.getImageData(this.boundingBox.x,this.boundingBox.y,this.boundingBox.width,this.boundingBox.height);this.entity.backgroundImageUsed=true}else{this.backgroundImageData=e.getImageData(this.boundingBox.x,this.boundingBox.y,this.boundingBox.width,this.boundingBox.height)}};i.prototype.restore=function(e){if(this.noRedraw){return}if(this.useEntityBackgroundImageData){if(this.entity.backgroundImageUsed){return}if(!this.entity.backgroundImageData){}e.putImageData(this.entity.backgroundImageData,this.boundingBox.x,this.boundingBox.y);this.entity.backgroundImageUsed=true}else{e.putImageData(this.backgroundImageData,this.boundingBox.x,this.boundingBox.y)}}},{"../package.json":110,"./BoundingBox.js":1}],4:[function(e,t,r){"use strict";const a=e("./canvas-utilities.js");const n=e("nextgen-events/lib/LeanEvents.js");const i=e("seventh");function s(e,t,r){this.ctx=e;this.vg=t;this.tickTime=r||100;this.tick=0;this.timer=null;this.running=false;this.canvasListeners=[];this.babylonControl=null;this.babylonControlListeners=[];this.toEmit=[];this.redraw=i.debounceUpdate({delay:this.tickTime/2},async()=>{await this.vg.redrawCanvas(this.ctx);this.emit("redraw")})}t.exports=s;s.prototype=Object.create(n.prototype);s.prototype.constructor=s;s.prototype.__prototypeUID__="svg-kit/DynamicManager";s.prototype.__prototypeVersion__=e("../package.json").version;s.prototype.destroy=function(){this.reset()};s.prototype.reset=function(){if(this.timer){clearInterval(this.timer);this.timer=null}this.clearCanvasEventListener();this.clearBabylonControlEventListener();this.babylonControl=null;this.running=false};s.prototype.emitPendingEvents=function(){for(let e of this.toEmit){this.emit(e.name,e.data)}this.toEmit.length=0};s.prototype.onTick=function(){this.tick++;let t=false;for(let e of this.vg.dynamicAreaIterator()){e.setTick(this.tick);if(e.outdated){t=true}}if(t){this.redraw()}};s.prototype.onPointerMove=function(e,r){let n=false;let i=a.canvasToContextCoords(this.ctx,e);for(let t of this.vg.dynamicAreaIterator()){if(t.boundingBox.isInside(i)){if(t.status!=="press"){t.setStatus("hover")}}else{t.setStatus("base")}if(t.outdated){n=true}if(t.toEmit){for(let e of t.toEmit){this.convertEventCoords(e.data,r);this.toEmit.push(e)}t.toEmit.length=0}}if(n){this.redraw()}if(this.toEmit.length){this.emitPendingEvents()}};s.prototype.onPointerPress=function(e,r){let n=false;let i=a.canvasToContextCoords(this.ctx,e);for(let t of this.vg.dynamicAreaIterator()){if(t.boundingBox.isInside(i)){t.setStatus("press")}else{t.setStatus("base")}if(t.outdated){n=true}if(t.toEmit){for(let e of t.toEmit){this.convertEventCoords(e.data,r);this.toEmit.push(e)}t.toEmit.length=0}}if(n){this.redraw()}if(this.toEmit.length){this.emitPendingEvents()}};s.prototype.onPointerRelease=function(e,r){let n=false;let i=a.canvasToContextCoords(this.ctx,e);for(let t of this.vg.dynamicAreaIterator()){if(t.boundingBox.isInside(i)){t.setStatus("release")}else{t.setStatus("base")}if(t.outdated){n=true}if(t.toEmit){for(let e of t.toEmit){this.convertEventCoords(e.data,r);this.toEmit.push(e)}t.toEmit.length=0}}if(n){this.redraw()}if(this.toEmit.length){this.emitPendingEvents()}};s.prototype.convertEventCoords=function(e,t){let r=a.contextToCanvasCoords(this.ctx,{x:e.boundingBox.xmin,y:e.boundingBox.ymin}),n=a.contextToCanvasCoords(this.ctx,{x:e.boundingBox.xmax,y:e.boundingBox.ymax});r=t(r);n=t(n);e.foreignBoundingBox={xmin:r.x,ymin:r.y,xmax:n.x,ymax:n.y}};s.prototype.getAllEmittableEvents=function(r,n=null){var i=[];for(let t of this.vg.dynamicAreaIterator()){let e=t.getEmittableEvent(r);if(e){if(n){this.convertEventCoords(e,n)}i.push(e)}}return i};s.prototype.manageBrowserCanvas=function(){if(this.running){throw new Error("Manager is already running!")}this.running=true;if(this.timer){clearInterval(this.timer);this.timer=null}this.timer=setInterval(()=>this.onTick(),this.tickTime);const t=e=>a.screenToCanvasCoords(this.ctx.canvas,{x:e.clientX,y:e.clientY});const r=e=>a.canvasToScreenCoords(this.ctx.canvas,e);this.addCanvasEventListener("mousemove",e=>this.onPointerMove(t(e),r));this.addCanvasEventListener("mousedown",e=>this.onPointerPress(t(e),r));this.addCanvasEventListener("mouseup",e=>this.onPointerRelease(t(e),r))};s.prototype.addCanvasEventListener=function(e,t){this.canvasListeners.push([e,t]);this.ctx.canvas.addEventListener(e,t)};s.prototype.clearCanvasEventListener=function(){for(let[e,t]of this.canvasListeners){this.ctx.canvas.removeEventListener(e,t)}this.canvasListeners.length=0};s.prototype.getAllBrowserEmittableEvents=function(e){return this.getAllEmittableEvents(e,e=>a.canvasToScreenCoords(this.ctx.canvas,e))};s.prototype.manageBabylonControl=function(e){if(this.running){throw new Error("Manager is already running!")}this.running=true;if(!e){throw new Error("No Babylon Control was provided")}this.babylonControl=e;if(this.timer){clearInterval(this.timer);this.timer=null}this.timer=setInterval(()=>this.onTick(),this.tickTime);const t=e=>{return{x:e.x-this.babylonControl._currentMeasure.left,y:e.y-this.babylonControl._currentMeasure.top}};const r=e=>{return{x:e.x+this.babylonControl._currentMeasure.left,y:e.y+this.babylonControl._currentMeasure.top}};this.addBabylonControlEventListener("onPointerMoveObservable",e=>this.onPointerMove(t(e),r));this.addBabylonControlEventListener("onPointerDownObservable",e=>this.onPointerPress(t(e),r));this.addBabylonControlEventListener("onPointerUpObservable",e=>this.onPointerRelease(t(e),r));this.addBabylonControlEventListener("onPointerOutObservable",e=>this.onPointerMove({x:-1,y:-1},r))};s.prototype.addBabylonControlEventListener=function(e,t){this.babylonControlListeners.push([e,t]);this.babylonControl[e].add(t)};s.prototype.clearBabylonControlEventListener=function(){for(let[e,t]of this.babylonControlListeners){this.babylonControl[e].removeCallback(t)}this.babylonControlListeners.length=0};s.prototype.getAllBabylonControlEmittableEvents=function(e){return this.getAllEmittableEvents(e,e=>{return{x:e.x+this.babylonControl._currentMeasure.left,y:e.y+this.babylonControl._currentMeasure.top}})}},{"../package.json":110,"./canvas-utilities.js":40,"nextgen-events/lib/LeanEvents.js":82,seventh:98}],5:[function(e,t,r){"use strict";function n(e,t){this.value=0;this.unit="";this.set(e,t)}t.exports=n;const i={"":"",px:"",em:"em",rel:"em","%":{value:e=>e*.01,unit:"em"}};const a={"":e=>e,em:(e,t)=>e*t};const s=/^([0-9]+(?:\.[0-9]+)?) *([a-z%]+)?$/;n.prototype.set=function(t,r=""){if(t&&typeof t==="object"){r=t.unit;t=t.value}if(typeof t==="string"){let e=t.match(s);if(!e){return false}t=parseFloat(e[1]);r=e[2]||""}r=i[r];if(r===undefined){return false}if(typeof r==="object"){t=r.value(t);r=r.unit}this.value=t;this.unit=r;return true};n.prototype.get=function(e,t,...r){if(e instanceof n){e=e.get(t,...r)}return a[this.unit](this.value,e)};n.chainedGet=function(...e){e=e.filter(e=>e instanceof n||typeof e==="number");if(!e.length){return}if(typeof e[0]==="number"){return e[0]}var t=e.shift();return t.get(...e)};n.isEqual=function(e,t){if(!e&&!t){return true}if(!e||!t){return false}return e.value===t.value&&e.unit===t.unit}},{}],6:[function(e,t,r){"use strict";const s=e("../BoundingBox.js");function n(e,t,r,n,i,a){this.startPoint=e;this.radius=t;this.xAxisRotate=r;this.largeArcFlag=n;this.sweepFlag=i;this.endPoint=a;this.boundingBox=new s(null);this.length=this.getLength(true)}t.exports=n;n.prototype.getLength=function(e){if(e){this.boundingBox.nullify()}const t=this.approximateArcLengthOfCurve(300,e=>this.pointOnEllipticalArc(this.startPoint,this.radius,this.xAxisRotate,this.largeArcFlag,this.sweepFlag,this.endPoint,e),e?this.boundingBox:null);return t.arcLength};n.prototype.getPointAtLength=function(e){if(e===0){return{x:this.startPoint.x,y:this.startPoint.y}}if(e===this.length){return{x:this.endPoint.x,y:this.endPoint.y}}const t=this.pointOnEllipticalArc(this.startPoint,this.radius,this.xAxisRotate,this.largeArcFlag,this.sweepFlag,this.endPoint,e/this.length);return{x:t.x,y:t.y}};n.prototype.getTangentAtLength=function(e){const t=.001*(Math.min(this.radius.x,this.radius.y)||this.length);const r=this.getPointAtLength(e-t);const n=this.getPointAtLength(e+t);const i=n.x-r.x;const a=n.y-r.y;const s=Math.sqrt(i*i+a*a);return{x:i/s,y:a/s,angle:Math.atan2(a,i)}};n.prototype.getPropertiesAtLength=function(e){const t=this.getPointAtLength(e);const r=this.getTangentAtLength(e);return{x:t.x,y:t.y,dx:r.x,dy:r.y,angle:r.angle}};n.pointOnEllipticalArc=n.prototype.pointOnEllipticalArc=function(e,t,r,n,i,a,s){let o=Math.abs(t.x),l=Math.abs(t.y),u=L(P(r,360));if(e.x===a.x&&e.y===a.y){return{x:e.x,y:e.y,ellipticalArcAngle:0}}if(o===0||l===0){return{x:0,y:0,ellipticalArcAngle:0}}const h=(e.x-a.x)/2;const c=(e.y-a.y)/2;const f={x:Math.cos(u)*h+Math.sin(u)*c,y:-Math.sin(u)*h+Math.cos(u)*c};const p=Math.pow(f.x,2)/Math.pow(o,2)+Math.pow(f.y,2)/Math.pow(l,2);if(p>1){o=Math.sqrt(p)*o;l=Math.sqrt(p)*l}const d=Math.pow(o,2)*Math.pow(l,2)-Math.pow(o,2)*Math.pow(f.y,2)-Math.pow(l,2)*Math.pow(f.x,2);const g=Math.pow(o,2)*Math.pow(f.y,2)+Math.pow(l,2)*Math.pow(f.x,2);let m=d/g;m=m<0?0:m;const y=(n!==i?1:-1)*Math.sqrt(m);const v={x:y*(o*f.y/l),y:y*(-(l*f.x)/o)};const b={x:Math.cos(u)*v.x-Math.sin(u)*v.y+(e.x+a.x)/2,y:Math.sin(u)*v.x+Math.cos(u)*v.y+(e.y+a.y)/2};const x={x:(f.x-v.x)/o,y:(f.y-v.y)/l};const w=O({x:1,y:0},x);const k={x:(-f.x-v.x)/o,y:(-f.y-v.y)/l};let S=O(x,k);if(!i&&S>0){S-=2*Math.PI}else if(i&&S<0){S+=2*Math.PI}S%=2*Math.PI;const C=w+S*s;const T=o*Math.cos(C);const E=l*Math.sin(C);const A={x:Math.cos(u)*T-Math.sin(u)*E+b.x,y:Math.sin(u)*T+Math.cos(u)*E+b.y,ellipticalArcStartAngle:w,ellipticalArcEndAngle:w+S,ellipticalArcAngle:C,ellipticalArcCenter:b,resultantRx:o,resultantRy:l};return A};n.approximateArcLengthOfCurve=n.prototype.approximateArcLengthOfCurve=function(t,r,n=null){t=t?t:500;let i=0;const a=[];const s=[];let o,l=r(0);if(n){n.ensurePoint(l)}for(let e=0;e<t;e++){const u=c(e*(1/t),0,1);o=r(u);if(n){n.ensurePoint(o)}i+=h(l,o);s.push([l,o]);a.push({t:u,arcLength:i});l=o}o=r(1);if(n){n.ensurePoint(o)}s.push([l,o]);i+=h(l,o);a.push({t:1,arcLength:i});return{arcLength:i,arcLengthMap:a,approximationLines:s}};const P=(e,t)=>{return(e%t+t)%t};const L=e=>{return e*(Math.PI/180)};const h=(e,t)=>{return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};const c=(e,t,r)=>{return Math.min(Math.max(e,t),r)};const O=(e,t)=>{const r=e.x*t.x+e.y*t.y;const n=Math.sqrt((Math.pow(e.x,2)+Math.pow(e.y,2))*(Math.pow(t.x,2)+Math.pow(t.y,2)));const i=e.x*t.y-e.y*t.x<0?-1:1;const a=i*Math.acos(r/n);return a}},{"../BoundingBox.js":1}],7:[function(e,t,r){"use strict";function n(...e){this.xs=e.map(e=>e.x);this.ys=e.map(e=>e.y);this.length=this.getLength(this.xs,this.ys,1);this.boundingBox=this.getBoundingBox(this.xs,this.ys)}t.exports=n;n.prototype.getPointAtLength=function(e){if(e===0){return{x:this.startPoint.x,y:this.startPoint.y}}if(e===this.length){return{x:this.endPoint.x,y:this.endPoint.y}}const t=this.getT(this.xs,this.ys,e);return this.getPoint(this.xs,this.ys,t)};n.prototype.getTangentAtLength=function(e){const t=this.getT(this.xs,this.ys,e);const r=this.getDerivative(this.xs,this.ys,t);const n=Math.sqrt(r.x*r.x+r.y*r.y);let i;if(n>0){i={x:r.x/n,y:r.y/n}}else{i={x:0,y:0}}i.angle=Math.atan2(i.y,i.x);return i};n.prototype.getPropertiesAtLength=function(e){const t=this.getT(this.xs,this.ys,e);let r,n;if(e===0){r={x:this.startPoint.x,y:this.startPoint.y}}else if(e===this.length){r={x:this.endPoint.x,y:this.endPoint.y}}else{r=this.getPoint(this.xs,this.ys,t)}const i=this.getDerivative(this.xs,this.ys,t);const a=Math.sqrt(i.x*i.x+i.y*i.y);if(a>0){n={x:i.x/a,y:i.y/a}}else{n={x:0,y:0}}return{x:r.x,y:r.y,dx:n.x,dy:n.y,angle:Math.atan2(n.y,n.x)}};n.prototype.getT=function(e,t,r){let n=1;let i=r/this.length;let a=(r-this.getLength(e,t,i))/this.length;let s=0;while(n>.001){const o=this.getLength(e,t,i+a);const l=Math.abs(r-o)/this.length;if(l<n){n=l;i+=a}else{const u=this.getLength(e,t,i-a);const h=Math.abs(r-u)/this.length;if(h<n){n=h;i-=a}else{a/=2}}s++;if(s>500){break}}return i}},{}],8:[function(e,t,r){"use strict";const i=e("./Bezier.js");const a=e("./QuadraticBezier.js");const s=e("../BoundingBox.js");const{tValues:o,cValues:l,binomialCoefficients:u}=e("./bezier-values.json");function n(e,t,r,n){this.startPoint=e;this.startControl=t;this.endControl=r;this.endPoint=n;i.call(this,e,t,r,n)}t.exports=n;n.prototype=Object.create(i.prototype);n.prototype.constructor=n;function h(e,t){const r=1-t;return r*r*r*e[0]+3*r*r*t*e[1]+3*r*t*t*e[2]+t*t*t*e[3]}n.getPoint=n.prototype.getPoint=(e,t,r)=>{return{x:h(e,r),y:h(t,r)}};n.getDerivative=n.prototype.getDerivative=(e,t,r)=>{const n=a.getPoint([3*(e[1]-e[0]),3*(e[2]-e[1]),3*(e[3]-e[2])],[3*(t[1]-t[0]),3*(t[2]-t[1]),3*(t[3]-t[2])],r);return n};n.getLength=n.prototype.getLength=(t,r,e=1)=>{let n;let i;let a;const s=20;n=e/2;i=0;for(let e=0;e<s;e++){a=n*o[s][e]+n;i+=l[s][e]*c(t,r,a)}return n*i};function c(e,t,r){const n=f(1,r,e);const i=f(1,r,t);const a=n*n+i*i;return Math.sqrt(a)}function f(e,t,r){const n=r.length-1;let i;let a;if(n===0){return 0}if(e===0){a=0;for(let e=0;e<=n;e++){a+=u[n][e]*Math.pow(1-t,n-e)*Math.pow(t,e)*r[e]}return a}i=new Array(n);for(let e=0;e<n;e++){i[e]=n*(r[e+1]-r[e])}return f(e-1,t,i)}n.getBoundingBox=n.prototype.getBoundingBox=function(t,r){let n=[],i=[t[0],t[3]],a=[r[0],r[3]];p(t,n);p(r,n);for(let e of n){i.push(h(t,e));a.push(h(r,e))}return new s(Math.min(...i),Math.min(...a),Math.max(...i),Math.max(...a))};function p(e,t){let r=6*e[0]-12*e[1]+6*e[2],n=-3*e[0]+9*e[1]-9*e[2]+3*e[3],i=3*e[1]-3*e[0];if(Math.abs(n)<1e-12){if(Math.abs(r)<1e-12){return}let e=-i/r;if(0<e&&e<1){t.push(e)}return}let a=r*r-4*i*n;if(a<0){if(Math.abs(a)<1e-12){let e=-r/(2*n);if(0<e&&e<1){t.push(e)}}return}let s=Math.sqrt(a);let o=(-r+s)/(2*n);if(0<o&&o<1){t.push(o)}let l=(-r-s)/(2*n);if(0<l&&l<1){t.push(l)}}},{"../BoundingBox.js":1,"./Bezier.js":7,"./QuadraticBezier.js":12,"./bezier-values.json":13}],9:[function(e,t,r){"use strict";const n=e("../BoundingBox.js");function i(e,t){this.startPoint=e;this.endPoint=t;this.length=this.getLength();this.boundingBox=new n(null);this.boundingBox.ensurePoint(e);this.boundingBox.ensurePoint(t)}t.exports=i;i.prototype.getLength=function(e=1){let t=this.endPoint.x-this.startPoint.x,r=this.endPoint.y-this.startPoint.y;return e*Math.sqrt(t*t+r*r)};i.prototype.getPointAtLength=function(e){if(e===0){return{x:this.startPoint.x,y:this.startPoint.y}}if(e===this.length){return{x:this.endPoint.x,y:this.endPoint.y}}let t=this.endPoint.x-this.startPoint.x,r=this.endPoint.y-this.startPoint.y,n=e/this.length||0;return{x:this.startPoint.x+n*t,y:this.startPoint.y+n*r}};i.prototype.getTangentAtLength=function(){let e=this.endPoint.x-this.startPoint.x,t=this.endPoint.y-this.startPoint.y;return{x:e/this.length||0,y:t/this.length||0,angle:Math.atan2(t,e)}};i.prototype.getPropertiesAtLength=function(e){var t=this.getPointAtLength(e);var r=this.getTangentAtLength();return{x:t.x,y:t.y,dx:r.x,dy:r.y,angle:r.angle}}},{"../BoundingBox.js":1}],10:[function(e,t,r){"use strict";function n(e){this.endPoint=e;this.length=0}t.exports=n;n.prototype.getLength=function(){return 0};n.prototype.getPointAtLength=function(){return{x:this.endPoint.x,y:this.endPoint.y}};n.prototype.getTangentAtLength=function(){return{x:0,y:0,angle:0}};n.prototype.getPropertiesAtLength=function(){return{x:this.endPoint.x,y:this.endPoint.y,dx:0,dy:0,angle:0}}},{}],11:[function(e,t,r){"use strict";const s=e("./Move.js");const c=e("./Line.js");const o=e("./CubicBezier.js");const l=e("./QuadraticBezier.js");const a=e("./Arc.js");const n=e("../BoundingBox.js");const p=e=>e*Math.PI/180;const i=e=>e*180/Math.PI;const u=e=>Math.round(e*180/Math.PI);function h(e,t=false){this.commands=[];this.invertY=t;this.computeCurvesBuild=null;this.curves=[];this.totalLength=0;this.polygonHull=null;this.polylineHull=null;this.boundingBox=new n(null);if(e){this.set(e)}}t.exports=h;h.prototype.__prototypeUID__="svg-kit/Path";h.prototype.__prototypeVersion__=e("../../package.json").version;const f=e("../Polygon.js");const d=e("../Polyline.js");h.prototype.set=function(t){if(!Array.isArray(t)){return}this.boundingBox.nullify();this.polygonHull=this.polylineHull=null;for(let e of t){if(h.commands[e.type].add){h.commands[e.type].add(this.commands,e)}}};h.prototype.export=function(e={}){if(this.commands.length){e.commands=this.commands.map(e=>Object.assign({},e))}return e};h.prototype.setInvertY=function(e){e=!!e;if(this.invertY===e){return}this.invertY=e;this.clearComputed();this.computeCurves()};h.prototype.clearComputed=function(){this.computeCurvesBuild=null;this.curves.length=0;this.totalLength=0;this.polygonHull=this.polylineHull=null;this.boundingBox.nullify()};h.prototype.toD=function(){return h.commandsToD(this.commands,this.invertY)};h.parse=function(){};h.commandsToD=(e,t=false)=>{var r={invertY:t,d:"",pu:false,cx:0,cy:0,ca:t?-Math.PI/2:Math.PI/2};e.forEach((e,t)=>{if(!h.commands[e.type].toD){return}if(t){r.d+=" "}h.commands[e.type].toD(e,r)});return r.d};h.prototype.computeCurves=function(){if(this.computeCurvesBuild&&this.computeCurvesBuild.next>=this.commands.length){return}if(!this.computeCurvesBuild){this.computeCurvesBuild={next:0,invertY:this.invertY,lastCurve:null,openPoint:{x:0,y:0},pu:false,ca:this.invertY?-Math.PI/2:Math.PI/2}}for(;this.computeCurvesBuild.next<this.commands.length;this.computeCurvesBuild.next++){let t=this.commands[this.computeCurvesBuild.next];if(h.commands[t.type].toCurve){let e=h.commands[t.type].toCurve(t,this.computeCurvesBuild);if(e){if(e instanceof s){this.computeCurvesBuild.openPoint={x:e.endPoint.x,y:e.endPoint.y}}else{this.totalLength+=e.length;this.boundingBox.merge(e.boundingBox)}this.computeCurvesBuild.lastCurve=e;this.curves.push(e)}}}};h.prototype.getLength=function(){this.computeCurves();return this.totalLength};h.prototype.getPointAtLength=function(e,t=false){this.computeCurves();if(e<0){e=0}else if(e>this.totalLength){e=this.totalLength}var r=null,n=e;for(let e of this.curves){if(e){if(!(e instanceof s)){if(n<=e.length){return t?e.getPropertiesAtLength(n):e.getPointAtLength(n)}n-=e.length}r=e}}if(!r){return t?{x:0,y:0,dx:0,dy:0}:{x:0,y:0}}if(r instanceof s){return t?{x:r.endPoint.x,y:r.endPoint.y,dx:0,dy:0}:{x:r.endPoint.x,y:r.endPoint.y}}return t?r.getPropertiesAtLength(r.length):r.getPointAtLength(r.length)};const g=(e,t)=>e.x===t.x&&e.y===t.y;h.prototype.groupCurvesByShape=function(t=false,r=false){var n=[],i=[],a;for(let e of this.curves){if(e instanceof s){if(n.length){a=g(n[0].startPoint,n[n.length-1].endPoint);if(a?!r:!t){i.push(n)}n=[]}}else{n.push(e)}}a=g(n[0].startPoint,n[n.length-1].endPoint);if(n.length&&(a?!r:!t)){i.push(n)}return i};h.prototype.getPoints=function(e={}){var r=e.step||1,n=!!e.forceKeyPoints,t=e.angleThresholdDeg!==undefined?p(+e.angleThresholdDeg||0):+e.angleThreshold||0,i=!!t,a=[];this.computeCurves();var s=0,o=0;for(let t of this.groupCurvesByShape(e.noOpenShape,e.noClosedShape)){let e=this.getPointsOfShape(t,r,n,s,o,i);a.push(e.points);s=e.endingLength;o=e.lengthRemainder}if(t){for(let e of a){this.simplifyShape(e,t)}}console.warn("getPoints():",a.flat());return e.groupShape?a:a.flat()};h.prototype.getPointsOfShape=function(e,s,t,r,n,o){var l=[],u=null,h=r,i=n;for(let a of e){let e=a.getPropertiesAtLength(0);if(!u){e.atLength=h;e.startShape=true;if(t){e.keyPoint=true}l.push(e);u=e}else{u.nextAngle=e.angle}if(t){let t,r=s,n=Math.round(a.length/s)||1,i=a.length/n;if(!o||!(a instanceof c)){for(let e=1;e<n;e++,r+=i){t=a.getPropertiesAtLength(r);t.atLength=h+r;l.push(t);u=t}}t=a.getPropertiesAtLength(a.length);t.atLength=h+a.length;t.keyPoint=true;l.push(t);u=t;h+=a.length}else{let t,r=s-i;for(;r<=a.length;r+=s){let e=a.getPropertiesAtLength(r);e.atLength=h+r;t=r;l.push(e);u=e}h+=a.length;i=a.length-t}}u.endShape=true;return{points:l,endingLength:h,lengthRemainder:i}};function m(e,t,r,n){let i,a=e[t],s=e[r],o=e[n],l=Math.atan2(s.x-a.x,s.y-a.y),u=Math.atan2(o.x-s.x,o.y-s.y);i=Math.abs((l-u)%(2*Math.PI));i=i<=Math.PI?i:2*Math.PI-i;return i}h.prototype.simplifyShape=function(n,i){var a=true;while(a){a=false;for(let r=1;r<=n.length-2;r++){if(!n[r].keyPoint){let e=m(n,r-1,r,r+1);if(e<i){let e=r>=2?m(n,r-2,r-1,r+1):0;let t=r<=n.length-3?m(n,r-1,r+1,r+2):0;if(e<=i&&t<=i){n.splice(r,1);a=true}}}}}};const y=p(15);h.prototype.toPolygon=function(e={}){var t=this.getPoints({step:e.step||10,forceKeyPoints:true,angleThreshold:(e.angleThresholdDeg?p(+e.angleThresholdDeg||0):+e.angleThreshold||0)||y,noOpenShape:true,groupShape:true});return t.map(e=>new f({points:e}))};h.prototype.toPolyline=function(e={}){var t=this.getPoints({step:e.step||10,forceKeyPoints:true,angleThreshold:(e.angleThresholdDeg?p(+e.angleThresholdDeg||0):+e.angleThreshold||0)||y,noClosedShape:true,groupShape:true});return t.map(e=>new d({points:e}))};h.prototype.computeHull=function(){if(!this.polygonHull||!this.polylineHull){this.polygonHull=this.toPolygon();this.polylineHull=this.toPolyline()}};h.prototype.isInside=function(t){if(!this.boundingBox.isInside(t)){return false}if(!this.polygonHull){this.computeHull()}return this.polygonHull.some(e=>e.isInside(t))};const v={x:0,y:0};h.commands={};h.commands.close={add:e=>e.push({type:"close"}),toD:(e,t)=>t.d+="z",toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;return new c({x:r.x,y:r.y},{x:t.openPoint.x,y:t.openPoint.y})}};h.commands.move={add:(e,t)=>e.push({type:"move",rel:true,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.y:e.y;if(e.rel){t.d+="m "+e.x+" "+r;t.cx+=e.x;t.cy+=r}else{t.d+="M "+e.x+" "+r;t.cx=e.x;t.cy=r}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0,i=0;if(e.rel){n=r.x;i=r.y}return new s({x:n+e.x,y:i+e.y})}};h.commands.moveTo={add:(e,t)=>e.push({type:"move",x:t.x||0,y:t.y||0})};h.commands.line={add:(e,t)=>e.push({type:"line",rel:true,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.y:e.y;if(e.rel){t.d+="l "+e.x+" "+r;t.cx+=e.x;t.cy+=r}else{t.d+="L "+e.x+" "+r;t.cx=e.x;t.cy=r}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0,i=0;if(e.rel){n=r.x;i=r.y}return new c({x:r.x,y:r.y},{x:n+e.x,y:i+e.y})}};h.commands.lineTo={add:(e,t)=>e.push({type:"line",x:t.x||0,y:t.y||0})};h.commands.hLine={add:(e,t)=>e.push({type:"hLine",rel:true,x:typeof t==="number"?t||0:t.x||0}),toD:(e,t)=>{if(e.rel){t.d+="h "+e.x;t.cx+=e.x}else{t.d+="H "+e.x;t.cx=e.x}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0;if(e.rel){n=r.x}return new c({x:r.x,y:r.y},{x:n+e.x,y:r.y})}};h.commands.hLineTo={add:(e,t)=>e.push({type:"hLine",x:typeof t==="number"?t||0:t.x||0})};h.commands.vLine={add:(e,t)=>e.push({type:"vLine",rel:true,y:typeof t==="number"?t||0:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.y:e.y;if(e.rel){t.d+="v "+r;t.cy+=r}else{t.d+="V "+r;t.cy=r}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0;if(e.rel){n=r.y}return new c({x:r.x,y:r.y},{x:r.x,y:n+e.y})}};h.commands.vLineTo={add:(e,t)=>e.push({type:"vLine",y:typeof t==="number"?t||0:t.y||0})};h.commands.curve={add:(e,t)=>e.push({type:"curve",rel:true,cx1:t.cx1||0,cy1:t.cy1||0,cx2:t.cx2||0,cy2:t.cy2||0,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.cy1:e.cy1,n=t.invertY?-e.cy2:e.cy2,i=t.invertY?-e.y:e.y;if(e.rel){t.d+="c "+e.cx1+" "+r+" "+e.cx2+" "+n+" "+e.x+" "+i;t.cx+=e.x;t.cy+=i}else{t.d+="C "+e.cx1+" "+r+" "+e.cx2+" "+n+" "+e.x+" "+i;t.cx=e.x;t.cy=i}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0,i=0;if(e.rel){n=r.x;i=r.y}return new o({x:r.x,y:r.y},{x:n+e.cx1,y:i+e.cy1},{x:n+e.cx2,y:i+e.cy2},{x:n+e.x,y:i+e.y})}};h.commands.curveTo={add:(e,t)=>e.push({type:"curve",cx1:t.cx1||0,cy1:t.cy1||0,cx2:t.cx2||0,cy2:t.cy2||0,x:t.x||0,y:t.y||0})};h.commands.smoothCurve={add:(e,t)=>e.push({type:"smoothCurve",rel:true,cx:t.cx||t.cx2||0,cy:t.cy||t.cy2||0,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.cy:e.cy,n=t.invertY?-e.y:e.y;if(e.rel){t.d+="s "+e.cx+" "+r+" "+e.x+" "+n;t.cx+=e.x;t.cy+=n}else{t.d+="S "+e.cx+" "+r+" "+e.x+" "+n;t.cx=e.x;t.cy=n}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=t.lastCurve&&t.lastCurve instanceof o?t.lastCurve.endControl:r;let i=0,a=0;if(e.rel){i=r.x;a=r.y}return new o({x:r.x,y:r.y},{x:2*r.x-n.x,y:2*r.y-n.y},{x:i+e.cx,y:a+e.cy},{x:i+e.x,y:a+e.y})}};h.commands.smoothCurveTo={add:(e,t)=>e.push({type:"smoothCurve",cx:t.cx||t.cx2||0,cy:t.cy||t.cy2||0,x:t.x||0,y:t.y||0})};h.commands.qCurve={add:(e,t)=>e.push({type:"qCurve",rel:true,cx:t.cx||t.cx1||0,cy:t.cy||t.cy1||0,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.cy:e.cy,n=t.invertY?-e.y:e.y;if(e.rel){t.d+="q "+e.cx+" "+r+" "+e.x+" "+n;t.cx+=e.x;t.cy+=n}else{t.d+="Q "+e.cx+" "+r+" "+e.x+" "+n;t.cx=e.x;t.cy=n}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0,i=0;if(e.rel){n=r.x;i=r.y}return new l({x:r.x,y:r.y},{x:n+e.cx,y:i+e.cy},{x:n+e.x,y:i+e.y})}};h.commands.qCurveTo={add:(e,t)=>e.push({type:"qCurve",cx:t.cx||t.cx1||0,cy:t.cy||t.cy1||0,x:t.x||0,y:t.y||0})};h.commands.smoothQCurve={add:(e,t)=>e.push({type:"smoothQCurve",rel:true,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.y:e.y;if(e.rel){t.d+="t "+e.x+" "+r;t.cx+=e.x;t.cy+=r}else{t.d+="T "+e.x+" "+r;t.cx=e.x;t.cy=r}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=t.lastCurve&&t.lastCurve instanceof l?t.lastCurve.control:r;let i=0,a=0;if(e.rel){i=r.x;a=r.y}return new l({x:r.x,y:r.y},{x:2*r.x-n.x,y:2*r.y-n.y},{x:i+e.x,y:a+e.y})}};h.commands.smoothQCurveTo={add:(e,t)=>e.push({type:"smoothQCurve",x:t.x||0,y:t.y||0})};h.commands.arc={add:(e,t)=>e.push({type:"arc",rel:true,rx:t.rx||0,ry:t.ry||0,ra:t.ra||t.a||0,la:t.largeArc!==undefined?!!t.largeArc:t.longArc!==undefined?!!t.longArc:t.la!==undefined?!!t.la:false,pr:t.positiveRotation!==undefined?!!t.positiveRotation:t.sweep!==undefined?!!t.sweep:t.pr!==undefined?!!t.pr:true,x:t.x||0,y:t.y||0}),toD:(e,t)=>{let r=t.invertY?-e.ra:e.ra,n=t.invertY?!e.pr:e.pr,i=t.invertY?-e.y:e.y;if(e.rel){t.d+="a "+e.rx+" "+e.ry+" "+r+" "+ +e.la+" "+ +n+" "+e.x+" "+i;t.cx+=e.x;t.cy+=i}else{t.d+="A "+e.rx+" "+e.ry+" "+r+" "+ +e.la+" "+ +n+" "+e.x+" "+i;t.cx=e.x;t.cy=i}},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=0,i=0;if(e.rel){n=r.x;i=r.y}return new a({x:r.x,y:r.y},{x:e.rx,y:e.ry},e.ra,e.la,e.pr,{x:n+e.x,y:i+e.y})}};h.commands.arcTo={add:(e,t)=>e.push({type:"arc",rx:t.rx||0,ry:t.ry||0,ra:t.ra||t.a||0,la:t.largeArc!==undefined?!!t.largeArc:t.longArc!==undefined?!!t.longArc:t.la!==undefined?!!t.la:false,pr:t.positiveRotation!==undefined?!!t.positiveRotation:t.sweep!==undefined?!!t.sweep:t.pr!==undefined?!!t.pr:true,x:t.x||0,y:t.y||0})};h.commands.negativeArc={add:(e,t)=>e.push({type:"arc",rel:true,rx:t.rx||0,ry:t.ry||0,ra:-(t.ra||t.a||0),la:t.largeArc!==undefined?!!t.largeArc:t.longArc!==undefined?!!t.longArc:t.la!==undefined?!!t.la:false,pr:!(t.positiveRotation!==undefined?!!t.positiveRotation:t.sweep!==undefined?!!t.sweep:t.pr!==undefined?!!t.pr:true),x:t.x||0,y:t.y||0})};h.commands.negativeArcTo={add:(e,t)=>e.push({type:"arc",rx:t.rx||0,ry:t.ry||0,ra:-(t.ra||t.a||0),la:t.largeArc!==undefined?!!t.largeArc:t.longArc!==undefined?!!t.longArc:t.la!==undefined?!!t.la:false,pr:!(t.positiveRotation!==undefined?!!t.positiveRotation:t.sweep!==undefined?!!t.sweep:t.pr!==undefined?!!t.pr:true),x:t.x||0,y:t.y||0})};h.commands.pen={add:(e,t)=>e.push({type:"pen",u:!!t.up}),toD:(e,t)=>{t.pu=e.u},toCurve:(e,t)=>{t.pu=e.u}};h.commands.penUp={add:e=>e.push({type:"pen",u:true})};h.commands.penDown={add:e=>e.push({type:"pen",u:false})};h.commands.forward={add:(e,t)=>e.push({type:"forward",l:typeof t==="number"?t:t.length||t.l||0}),toD:(e,t)=>{let r=e.l*Math.cos(t.ca),n=e.l*Math.sin(t.ca);if(t.pu){t.d+="m "+r+" "+n}else{t.d+="l "+r+" "+n}t.cx+=r;t.cy+=n},toCurve:(e,t)=>{let r=t.lastCurve?t.lastCurve.endPoint:v;let n=e.l*Math.cos(t.ca),i=e.l*Math.sin(t.ca);if(t.pu){return new s({x:r.x+n,y:r.y+i})}return new c({x:r.x,y:r.y},{x:r.x+n,y:r.y+i})}};h.commands.backward={add:(e,t)=>e.push({type:"forward",l:-(typeof t==="number"?t:t.length||t.l||0)})};h.commands.turn={add:(e,t)=>e.push({type:"turn",rel:true,a:typeof t==="number"?t:t.angle||t.a||0}),toD:(e,t)=>{let r=t.invertY?-e.a:e.a;if(e.rel){t.ca+=p(r)}else{t.ca=p(r)}},toCurve:(e,t)=>{let r=t.invertY?-e.a:e.a;if(e.rel){t.ca+=p(r)}else{t.ca=p(r)}}};h.commands.turnTo={add:(e,t)=>e.push({type:"turn",a:typeof t==="number"?t:t.angle||t.a||0})};h.commands.negativeTurn={add:(e,t)=>e.push({type:"turn",rel:true,a:-(typeof t==="number"?t:t.angle||t.a||0)})};h.commands.negativeTurnTo={add:(e,t)=>e.push({type:"turn",a:90-(typeof t==="number"?t:t.angle||t.a||0)})};h.commands.forwardTurn={add:(e,t)=>e.push({type:"forwardTurn",l:t.length||t.l||0,a:t.angle||t.a||0}),toD:(e,t)=>{let r=t.invertY?-e.a:e.a;let n=p(r),i=n>=0?1:-1,a=Math.abs(n),s=e.l/a,o=s*Math.cos(a),l=s*Math.sin(a),u=Math.sqrt((s-o)**2+l**2),h=Math.atan2(s-o,l);let c=u*Math.cos(t.ca+i*h),f=u*Math.sin(t.ca+i*h);if(t.pu){t.d+="m "+c+" "+f}else{t.d+="a "+s+" "+s+" 0 "+(a>Math.PI?1:0)+" "+(n>=0?1:0)+" "+c+" "+f}t.cx+=c;t.cy+=f;t.ca+=n}};h.commands.forwardNegativeTurn={add:(e,t)=>e.push({type:"forwardTurn",l:t.length||t.l||0,a:-(t.angle||t.a||0)})};for(let t in h.commands){if(h.commands[t].add){h.prototype[t]=function(e){h.commands[t].add(this.commands,e);this.computeCurves();return this}}}h.linePointsToD=(e,t=false)=>{let r=t?-1:1,n="M";e.forEach(e=>{n+=" "+e.x+","+e.y*r});return n};h.polygonPointsToD=(e,t=false)=>h.linePointsToD(e,t)+" z"},{"../../package.json":110,"../BoundingBox.js":1,"../Polygon.js":14,"../Polyline.js":15,"./Arc.js":6,"./CubicBezier.js":8,"./Line.js":9,"./Move.js":10,"./QuadraticBezier.js":12}],12:[function(e,t,r){"use strict";const n=e("./Bezier.js");const i=e("../BoundingBox.js");function a(e,t,r){this.startPoint=e;this.control=t;this.endPoint=r;n.call(this,e,t,r)}t.exports=a;a.prototype=Object.create(n.prototype);a.prototype.constructor=a;function s(e,t){const r=1-t;return r*r*e[0]+2*r*t*e[1]+t*t*e[2]}a.getPoint=a.prototype.getPoint=(e,t,r)=>{return{x:s(e,r),y:s(t,r)}};a.getDerivative=a.prototype.getDerivative=(e,t,r)=>{return{x:(1-r)*2*(e[1]-e[0])+r*2*(e[2]-e[1]),y:(1-r)*2*(t[1]-t[0])+r*2*(t[2]-t[1])}};a.getLength=a.prototype.getLength=(e,t,r=1)=>{const n=e[0]-2*e[1]+e[2];const i=t[0]-2*t[1]+t[2];const a=2*e[1]-2*e[0];const s=2*t[1]-2*t[0];const o=4*(n*n+i*i);const l=4*(n*a+i*s);const u=a*a+s*s;if(o===0){return r*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2))}const h=l/(2*o);const c=u/o;const f=r+h;const p=c-h*h;const d=f*f+p>0?Math.sqrt(f*f+p):0;const g=h*h+p>0?Math.sqrt(h*h+p):0;const m=h+Math.sqrt(h*h+p)!==0&&(f+d)/(h+g)!==0?p*Math.log(Math.abs((f+d)/(h+g))):0;return Math.sqrt(o)/2*(f*d-h*g+m)};a.getBoundingBox=a.prototype.getBoundingBox=function(e,t){var r=[e[0],e[2]],n=[t[0],t[2]];o(e,r);o(t,n);return new i(Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n))};function o(e,t){let r=e[0]-2*e[1]+e[2],n=-2*e[0]+2*e[1],i=e[0];if(Math.abs(r)>1e-12){let e=-n/(2*r);if(0<e&&e<1){t.push(r*e*e+n*e+i)}}}},{"../BoundingBox.js":1,"./Bezier.js":7}],13:[function(e,t,r){t.exports={tValues:[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],cValues:[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.03098800