text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("SVGCurves",[],e):"object"==typeof exports?exports.SVGCurves=e():t.SVGCurves=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){t.exports=i(1)},function(t,e,i){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){return(t%e+e)%e}function h(t,e,i){return Math.min(Math.max(t,e),i)}function a(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function u(t,e){var i=t.x*e.x+t.y*e.y,n=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(i/n)}Object.defineProperty(e,"__esModule",{value:!0}),e.QuadricBezier=e.CubicBezier=e.Arc=void 0;var p=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(n)},c=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),f=i(2),l=2*Math.PI,y=Math.PI/180,v=function(){function t(e){s(this,t),this.path=[],this.linear=!0,this.step=.01,this.resolution=500,this.segmentLength=.1,Object.assign(this,e||{}),this.arcLength=null,this.arcLengthMap=null}return c(t,[{key:"_clearPath",value:function(){this.path=[]}},{key:"getPath",value:function(){return this.path}},{key:"getPointAtT",value:function(t){return new f.Point(0,0)}},{key:"_addPoint",value:function(t){this.path.push(t.x,t.y)}},{key:"_postTrace",value:function(){}},{key:"_approximateLength",value:function(){var t=0,e=[],i=this.getPointAtT(0),n=void 0,r=void 0,s=void 0;for(n=0;n<this.resolution;n++)r=h(n*(1/this.resolution),0,1),s=this.getPointAtT(r),t+=a(i,s),e.push({t:r,arcLength:t}),i=s;s=this.getPointAtT(1),t+=a(i,s),e.push({t:1,arcLength:t}),Object.assign(this,{arcLength:t,arcLengthMap:e})}},{key:"getPointAtU",value:function(t){t=h(t,0,1);var e=t*this.arcLength,i=0,n=0,r=0;return this.arcLengthMap.every(function(t){var s=t.t,o=t.arcLength;if(o>=e){var h=o-e,a=e-n,u=a/(h+a)||0;return i=r+(s-r)*u,!1}return n=o,r=s,!0}),this.getPointAtT(i)}},{key:"trace",value:function(t){Object.assign(this,t||{});var e="getPointAtT",i=this.step;if(this.linear){this._approximateLength();var n=Math.round(this.arcLength/this.segmentLength);e="getPointAtU",i=1/n}this._clearPath();for(var r=0;r<=1;r+=i)this._addPoint(this[e](r));return this._postTrace(),this.getPath()}}]),t}(),x=function(t){function e(){return s(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,t),c(e,[{key:"init",value:function(t){if(Object.assign(this,t||{}),this.radians=o(this.angle,360)*y,this.p1.x===this.p2.x&&this.p1.y===this.p2.y)return this.path;if(this.rx=Math.abs(this.rx),this.ry=Math.abs(this.ry),0===this.rx||0===this.ry)return this.__addPoint(this.p1),this.__addPoint(this.p2),this.path;var e=(this.p1.x-this.p2.x)/2,i=(this.p1.y-this.p2.y)/2,n={x:Math.cos(this.radians)*e+Math.sin(this.radians)*i,y:-Math.sin(this.radians)*e+Math.cos(this.radians)*i},r=Math.pow(n.x,2)/Math.pow(this.rx,2)+Math.pow(n.y,2)/Math.pow(this.ry,2);r>1&&(this.rx=Math.sqrt(r)*this.rx,this.ry=Math.sqrt(r)*this.ry);var s=Math.pow(this.rx,2)*Math.pow(this.ry,2)-Math.pow(this.rx,2)*Math.pow(n.y,2)-Math.pow(this.ry,2)*Math.pow(n.x,2),h=Math.pow(this.rx,2)*Math.pow(n.y,2)+Math.pow(this.ry,2)*Math.pow(n.x,2),a=s/h;a=a<0?0:a;var p=(this.large!==this.sweep?1:-1)*Math.sqrt(a),c={x:p*(this.rx*n.y/this.ry),y:p*(-(this.ry*n.x)/this.rx)};this.center={x:Math.cos(this.radians)*c.x-Math.sin(this.radians)*c.y+(this.p1.x+this.p2.x)/2,y:Math.sin(this.radians)*c.x+Math.cos(this.radians)*c.y+(this.p1.y+this.p2.y)/2};var f={x:(n.x-c.x)/this.rx,y:(n.y-c.y)/this.ry},v={x:(-n.x-c.x)/this.rx,y:(-n.y-c.y)/this.ry};this.startAngle=u({x:1,y:0},f),this.sweepAngle=u(f,v),!this.sweep&&this.sweepAngle>0?this.sweepAngle-=l:this.sweep&&this.sweepAngle<0&&(this.sweepAngle+=l),this.sweepAngle%=l}},{key:"trace",value:function(t){return this.init(t),p(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"trace",this).call(this)}},{key:"getPointAtT",value:function(t){var e=this.startAngle+this.sweepAngle*t,i=this.rx*Math.cos(e),n=this.ry*Math.sin(e);return new f.Point(Math.cos(this.radians)*i-Math.sin(this.radians)*n+this.center.x,Math.sin(this.radians)*i+Math.cos(this.radians)*n+this.center.y)}},{key:"_postTrace",value:function(){this._addPoint(this.p2)}}]),e}(v),d=function(t){function e(){return s(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,t),c(e,[{key:"_B1",value:function(t){return t*t*t}},{key:"_B2",value:function(t){return 3*t*t*(1-t)}},{key:"_B3",value:function(t){return 3*t*(1-t)*(1-t)}},{key:"_B4",value:function(t){return(1-t)*(1-t)*(1-t)}},{key:"_C1",value:function(t,e,i,n,r){return t*this._B1(r)+e*this._B2(r)+i*this._B3(r)+n*this._B4(r)}},{key:"getPointAtT",value:function(t){return new f.Point(this._C1(this.p1.x,this.p2.x,this.p3.x,this.p4.x,t),this._C1(this.p1.y,this.p2.y,this.p3.y,this.p4.y,t))}},{key:"_addPoint",value:function(t){this.path.unshift(t.x,t.y)}}]),e}(v),g=function(t){function e(){return s(this,e),n(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,t),c(e,[{key:"_B1",value:function(t){return t*t}},{key:"_B2",value:function(t){return 2*t*(1-t)}},{key:"_B3",value:function(t){return(1-t)*(1-t)}},{key:"_C1",value:function(t,e,i,n){return t*this._B1(n)+e*this._B2(n)+i*this._B3(n)}},{key:"getPointAtT",value:function(t){return new f.Point(this._C1(this.p1.x,this.p2.x,this.p3.x,t),this._C1(this.p1.y,this.p2.y,this.p3.y,t))}},{key:"_addPoint",value:function(t){this.path.unshift(t.x,t.y)}}]),e}(v);e.Arc=x,e.CubicBezier=d,e.QuadricBezier=g},function(t,e,i){!function(e,i){t.exports=i()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){t.exports=i(1)},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e,n){if(i(this,t),this.x=parseFloat(e),this.y=parseFloat(n),isNaN(this.x)||isNaN(this.y))throw console.error("new Point(",e,n,")"),new Error("Invalid input: x and y params must be float.")}return n(t,[{key:"isEqual",value:function(t){return this.x===t.x&&this.y===t.y}}]),t}(),s=function(){function t(){i(this,t),this.points=[],this.length=0}return n(t,[{key:"getPoints",value:function(){return this.points}},{key:"getFlattenPoints",value:function(){var t=[];return this.points.forEach(function(e){return t.push(e.x,e.y)}),t}},{key:"getClipperPoints",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=[];return this.points.forEach(function(i){return e.push({X:parseInt(i.x*t),Y:parseInt(i.y*t)})}),e}},{key:"fromClipperPoints",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.points=[],t.forEach(function(t){return e.addPoint(parseFloat(t.X*i),parseFloat(t.Y*i))}),this}},{key:"getPoint",value:function(t){return this.points[t<0?this.length+t:t]||null}},{key:"addPoint",value:function(t,e){this.points.push(new r(t,e)),this.length=this.points.length}},{key:"addPoints",value:function(t){for(var e=0,i=t.length;e<i;e+=2)this.addPoint(t[e],t[e+1])}},{key:"isClosed",value:function(){var t=this.getPoint(0);return t&&t.isEqual(this.getPoint(-1))}},{key:"close",value:function(){if(!this.isClosed()&&this.length>2){var t=this.getPoint(0);return this.addPoint(t.x,t.y),!0}return!1}},{key:"transform",value:function(t){this.points=this.points.map(function(e){return new r(t[0]*e.x+t[2]*e.y+t[4],t[1]*e.x+t[3]*e.y+t[5])})}}]),t}();e.Path=s,e.Point=r,e.default=s}])})}])});
  //# sourceMappingURL=lw.svg-curves.js.map