svg-path-commander 1.0.2 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander v1.0.2 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v1.0.3 (http://thednp.github.io/svg-path-commander)
3
3
  * Copyright 2022 © thednp
4
4
  * Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
5
5
  */
@@ -1207,7 +1207,7 @@
1207
1207
  var segment = seg.seg;
1208
1208
  var data = seg.n;
1209
1209
  var prevSeg = i && path[i - 1];
1210
- var nextSeg = path[i + 1] && path[i + 1];
1210
+ var nextSeg = path[i + 1];
1211
1211
  var pathCommand = seg.c;
1212
1212
  var pLen = path.length;
1213
1213
  /** @type {number} */
@@ -1231,7 +1231,7 @@
1231
1231
  }
1232
1232
  break;
1233
1233
  case 'S':
1234
- if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'S'))) {
1234
+ if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'S')) {
1235
1235
  result = ['C', data[3], data[4], data[1], data[2], x, y];
1236
1236
  } else {
1237
1237
  result = [pathCommand, data[1], data[2], x, y];
@@ -1245,7 +1245,7 @@
1245
1245
  }
1246
1246
  break;
1247
1247
  case 'T':
1248
- if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'T'))) {
1248
+ if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'T')) {
1249
1249
  result = ['Q', data[1], data[2], x, y];
1250
1250
  } else {
1251
1251
  result = [pathCommand, x, y];
@@ -1964,7 +1964,7 @@
1964
1964
  m.m31 = 0; m.m32 = 0; m.m33 = 1; m.m34 = 0;
1965
1965
  m.m41 = 0; m.m42 = 0; m.m43 = 0; m.m44 = 1;
1966
1966
 
1967
- if (args && args.length) {
1967
+ if (args.length) {
1968
1968
  var ARGS = [16, 6].some(function (l) { return l === args.length; }) ? args : args[0];
1969
1969
 
1970
1970
  return m.setMatrixValue(ARGS);
@@ -2268,9 +2268,7 @@
2268
2268
  toArray: toArray,
2269
2269
  });
2270
2270
 
2271
- var version$1 = "1.0.2";
2272
-
2273
- // @ts-ignore
2271
+ var version$1 = "1.0.3";
2274
2272
 
2275
2273
  /**
2276
2274
  * A global namespace for library version.
@@ -2278,6 +2276,8 @@
2278
2276
  */
2279
2277
  var Version$1 = version$1;
2280
2278
 
2279
+ /** @typedef {import('../types/index')} */
2280
+
2281
2281
  Object.assign(CSSMatrix, { Version: Version$1 });
2282
2282
 
2283
2283
  /**
@@ -2926,10 +2926,9 @@
2926
2926
 
2927
2927
  var path = normalizePath(pathInput);
2928
2928
  var distanceIsNumber = typeof distance === 'number';
2929
- var isM = true;
2930
- /** @type {number[]} */
2929
+ var isM;
2931
2930
  var data = [];
2932
- var pathCommand = 'M';
2931
+ var pathCommand;
2933
2932
  var x = 0;
2934
2933
  var y = 0;
2935
2934
  var mx = 0;
@@ -3079,6 +3078,8 @@
3079
3078
  * @returns {SVGPathCommander} a new SVGPathCommander instance
3080
3079
  */
3081
3080
  var SVGPathCommander = function SVGPathCommander(pathValue, config) {
3081
+ var assign;
3082
+
3082
3083
  var instanceOptions = config || {};
3083
3084
 
3084
3085
  var undefPath = typeof pathValue === 'undefined';
@@ -3105,19 +3106,22 @@
3105
3106
  var cz = ref.cz;
3106
3107
 
3107
3108
  // set instance options.round
3108
- var round = defaultOptions.round;
3109
- var origin = defaultOptions.origin;
3110
3109
  var roundOption = instanceOptions.round;
3111
3110
  var originOption = instanceOptions.origin;
3111
+ var round;
3112
3112
 
3113
3113
  if (roundOption === 'auto') {
3114
3114
  var pathScale = (("" + (Math.floor(Math.max(width, height))))).length;
3115
3115
  round = pathScale >= 4 ? 0 : 4 - pathScale;
3116
3116
  } else if (Number.isInteger(roundOption) || roundOption === 'off') {
3117
3117
  round = roundOption;
3118
+ } else {
3119
+ ((assign = defaultOptions, round = assign.round));
3118
3120
  }
3119
3121
 
3120
3122
  // set instance options.origin
3123
+ // the SVGPathCommander class will always override the default origin
3124
+ var origin;
3121
3125
  if (Array.isArray(originOption) && originOption.length >= 2) {
3122
3126
  var ref$1 = originOption.map(Number);
3123
3127
  var originX = ref$1[0];
@@ -3131,10 +3135,9 @@
3131
3135
  origin = [cx, cy, cz];
3132
3136
  }
3133
3137
 
3134
- /**
3135
- * @type {number | 'off'}
3136
- */
3138
+ /** @type {number | 'off'} */
3137
3139
  this.round = round;
3140
+ /** @type {[number, number, number=]} */
3138
3141
  this.origin = origin;
3139
3142
 
3140
3143
  return this;
@@ -3498,7 +3501,7 @@
3498
3501
  // binary search for precise estimate
3499
3502
  precision /= 2;
3500
3503
  var before = { x: 0, y: 0 };
3501
- var after = before;
3504
+ var after;
3502
3505
  var beforeLength = 0;
3503
3506
  var afterLength = 0;
3504
3507
  var beforeDistance = 0;
@@ -3817,12 +3820,6 @@
3817
3820
  return [['M' ].concat( rotatedCurve[0].slice(0, 2)) ].concat( rotatedCurve.map(function (x) { return ['C' ].concat( x.slice(2)); }));
3818
3821
  }
3819
3822
 
3820
- /**
3821
- * Must have at least one import of the main namespace.
3822
- * @typedef {import('../../types/index')}
3823
- * @typedef {import('../types/index')}
3824
- */
3825
-
3826
3823
  /**
3827
3824
  * @interface
3828
3825
  */
@@ -3864,7 +3861,7 @@
3864
3861
  options: defaultOptions,
3865
3862
  };
3866
3863
 
3867
- var version = "1.0.2";
3864
+ var version = "1.0.3";
3868
3865
 
3869
3866
  /**
3870
3867
  * A global namespace for library version.
@@ -3872,6 +3869,8 @@
3872
3869
  */
3873
3870
  var Version = version;
3874
3871
 
3872
+ /** @typedef {import('../types/index')} */
3873
+
3875
3874
  // Export to global
3876
3875
  Object.assign(SVGPathCommander, Util, { Version: Version });
3877
3876
 
@@ -1,2 +1,2 @@
1
- // SVGPathCommander v1.0.2 | thednp © 2022 | MIT-License
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";var t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function r(t){for(var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;a.length>=e[n]&&(t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}var n="SVGPathCommander error";function a(t){var e=t.index,r=t.pathValue,a=r.charCodeAt(e);return 48===a?(t.param=0,void(t.index+=1)):49===a?(t.param=1,void(t.index+=1)):void(t.err=n+': invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e)}function i(t){return t>=48&&t<=57}function o(t){var e,r=t.max,a=t.pathValue,o=t.index,u=o,c=!1,s=!1,m=!1,f=!1;if(u>=r)t.err=n+": Invalid path value at index "+u+', "pathValue" is missing param';else if(43!==(e=a.charCodeAt(u))&&45!==e||(u+=1,e=a.charCodeAt(u)),i(e)||46===e){if(46!==e){if(c=48===e,u+=1,e=a.charCodeAt(u),c&&u<r&&e&&i(e))return void(t.err=n+": Invalid path value at index "+o+', "'+a[o]+'" illegal number');for(;u<r&&i(a.charCodeAt(u));)u+=1,s=!0;e=a.charCodeAt(u)}if(46===e){for(f=!0,u+=1;i(a.charCodeAt(u));)u+=1,m=!0;e=a.charCodeAt(u)}if(101===e||69===e){if(f&&!s&&!m)return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid float exponent');if(u+=1,43!==(e=a.charCodeAt(u))&&45!==e||(u+=1),!(u<r&&i(a.charCodeAt(u))))return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid integer exponent');for(;u<r&&i(a.charCodeAt(u));)u+=1}t.index=u,t.param=+t.pathValue.slice(o,u)}else t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" is not a number'}function u(t){for(var e,r=t.pathValue,n=t.max;t.index<n&&(10===(e=r.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function c(t){return t>=48&&t<=57||43===t||45===t||46===t}function s(t){var i=t.max,s=t.pathValue,m=t.index,f=s.charCodeAt(m),h=e[s[m].toLowerCase()];if(t.segmentStart=m,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(f))if(t.index+=1,u(t),t.data=[],h){for(;;){for(var l=h;l>0;l-=1){if(97!=(32|f)||3!==l&&4!==l?o(t):a(t),t.err.length)return;t.data.push(t.param),u(t),t.index<i&&44===s.charCodeAt(t.index)&&(t.index+=1,u(t))}if(t.index>=t.max)break;if(!c(s.charCodeAt(t.index)))break}r(t)}else r(t);else t.err=n+': Invalid path value "'+s[m]+'" is not a path command'}function m(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function f(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function l(t){if(h(t))return m(t);var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return e.err?e.err:e.segments}function p(t){return h(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function y(t){if(p(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toUpperCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"A":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":s=[c,o[0]+n];break;case"H":s=[c,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));s=[c].concat(m)}else s=[c].concat(o);var f=s.length;switch(c){case"Z":r=a,n=i;break;case"H":r=s[1];break;case"V":n=s[1];break;default:r=s[f-2],n=s[f-1],"M"===c&&(a=r,i=n)}return s}))}function v(t){return h(t)&&t.slice(1).every((function(t){var e=t[0];return e===e.toLowerCase()}))}function x(t){if(v(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"a":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]-r,o[6]-n];break;case"v":s=[c,o[0]-n];break;case"h":s=[c,o[0]-r];break;default:var m=o.map((function(t,e){return t-(e%2?n:r)}));s=[c].concat(m)}else"m"===u&&(a=o[0]+r,i=o[1]+n),s=[c].concat(o);var f=s.length;switch(c){case"z":r=a,n=i;break;case"h":r+=s[1];break;case"v":n+=s[1];break;default:r+=s[f-2],n+=s[f-1]}return s}))}function g(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}function d(t,e){var r=t[0],n=e.x1,a=e.y1,i=e.x2,o=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(r)||(e.qx=null,e.qy=null),"H"===r)c=["L",t[1],a];else if("V"===r)c=["L",n,t[1]];else if("S"===r){var s=2*n-i,m=2*a-o;e.x1=s,e.y1=m,c=["C",s,m].concat(u)}else if("T"===r){var f=2*n-e.qx,h=2*a-e.qy;e.qx=f,e.qy=h,c=["Q",f,h].concat(u)}else if("Q"===r){var l=u[0],p=u[1];e.qx=l,e.qy=p}return c}function M(t){return p(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}var b={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function w(t){if(M(t))return m(t);for(var e=y(t),r=Object.assign({},b),n=[],a=e.length,i="",o=0;o<a;o+=1){i=e[o][0],n[o]=i,e[o]=d(e[o],r);var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function N(t){var e=l(t),r=w(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),u=o[0],c=o[1],s=r[i].slice(-2),m=s[0],f=s[1];return a&&u===m&&c===f?e.slice(0,-1):e}function A(t){return M(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}function C(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function S(t,e,r,n,a,i,o,u,c,s){var m,f,h,l,p,y,v=t,x=e,g=r,d=n,M=u,b=c,w=120*Math.PI/180,N=Math.PI/180*(+a||0),A=[];if(s)h=(m=s)[0],l=m[1],p=m[2],y=m[3];else{v=(f=C(v,x,-N)).x,x=f.y;var k=(v-(M=(f=C(M,b,-N)).x))/2,P=(x-(b=f.y))/2,T=k*k/(g*g)+P*P/(d*d);T>1&&(g*=T=Math.sqrt(T),d*=T);var j=g*g,q=d*d,I=(i===o?-1:1)*Math.sqrt(Math.abs((j*q-j*P*P-q*k*k)/(j*P*P+q*k*k)));p=I*g*P/d+(v+M)/2,y=I*-d*k/g+(x+b)/2,h=(Math.asin((x-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),h=v<p?Math.PI-h:h,l=M<p?Math.PI-l:l,h<0&&(h=2*Math.PI+h),l<0&&(l=2*Math.PI+l),o&&h>l&&(h-=2*Math.PI),!o&&l>h&&(l-=2*Math.PI)}var O=l-h;if(Math.abs(O)>w){var V=l,L=M,E=b;l=h+w*(o&&l>h?1:-1),A=S(M=p+g*Math.cos(l),b=y+d*Math.sin(l),g,d,a,0,o,L,E,[l,V,p,y])}O=l-h;var z=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),F=Math.tan(O/4),H=4/3*g*F,X=4/3*d*F,Y=[v,x],B=[v+H*Z,x-X*z],R=[M+H*D,b-X*Q],G=[M,b];if(B[0]=2*Y[0]-B[0],B[1]=2*Y[1]-B[1],s)return B.concat(R,G,A);for(var J=[],U=0,K=(A=B.concat(R,G,A)).length;U<K;U+=1)J[U]=U%2?C(A[U-1],A[U],N).y:C(A[U],A[U+1],N).x;return J}function k(t,e,r,n,a,i){return[1/3*t+2/3*r,1/3*e+2/3*n,1/3*a+2/3*r,1/3*i+2/3*n,a,i]}function P(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function j(t,e,r,n,a){var i=T([t,e],[r,n]),o={x:0,y:0};if("number"==typeof a)if(0===a)o={x:t,y:e};else if(a>=i)o={x:r,y:n};else{var u=P([t,e],[r,n],a/i);o={x:u[0],y:u[1]}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function q(t,e,r,n){var a=.5,i=[t,e],o=[r,n],u=P(i,o,a),c=P(o,u,a),s=P(u,c,a),m=P(c,s,a),f=P(s,m,a),h=i.concat(u,s,f,[a]),l=j.apply(void 0,h).point,p=f.concat(m,c,o,[0]),y=j.apply(void 0,p).point;return[l.x,l.y,y.x,y.y,r,n]}function I(t,e){var r,n=t[0],a=t.slice(1).map(Number),i=a[0],o=a[1],u=e.x1,c=e.y1,s=e.x,m=e.y;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=i,e.y=o,t;case"A":return r=[u,c].concat(a),["C"].concat(S.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[u,c].concat(a),["C"].concat(k.apply(void 0,r));case"L":return["C"].concat(q(u,c,i,o));case"Z":return["C"].concat(q(u,c,s,m))}return t}function O(t){if(A(t))return m(t);for(var e=N(w(t)),r=Object.assign({},b),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=I(e[o],r),g(e,n,o),i=e.length;var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function V(e,r){var n=t.round;if("off"===r||"off"===n)return m(e);var a="number"==typeof(n=r>=0?r:n)&&n>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return n?Math.round(t*a)/a:Math.round(t)}));return[t[0]].concat(e)}))}function L(t,e){return V(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function E(t){var e=y(t),r="Z"===e.slice(-1)[0][0],n=w(e).map((function(t,r){var n=t.slice(-2).map(Number),a=n[0],i=n[1];return{seg:e[r],n:t,c:e[r][0],x:a,y:i}})).map((function(t,e,n){var a=t.seg,i=t.n,o=e&&n[e-1],u=n[e+1]&&n[e+1],c=t.c,s=n.length,m=e?n[e-1].x:n[s-1].x,f=e?n[e-1].y:n[s-1].y,h=[];switch(c){case"M":h=r?["Z"]:[c,m,f];break;case"A":h=[c].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=u&&"S"===u.c?["S",a[1],a[2],m,f]:[c,a[3],a[4],a[1],a[2],m,f];break;case"S":h=o&&"CS".includes(o.c)&&(!u||u&&"S"!==u.c)?["C",i[3],i[4],i[1],i[2],m,f]:[c,i[1],i[2],m,f];break;case"Q":h=u&&"T"===u.c?["T",m,f]:[c].concat(a.slice(1,-2),[m],[f]);break;case"T":h=o&&"QT".includes(o.c)&&(!u||u&&"T"!==u.c)?["Q",i[1],i[2],m,f]:[c,m,f];break;case"Z":h=["M",m,f];break;case"H":h=[c,m];break;case"V":h=[c,f];break;default:h=[c].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function z(t){var e,r=[],n=-1;return t.forEach((function(t){"M"===t[0]?(e=[t],n+=1):e=e.concat([t]),r[n]=e})),r}function Z(t,e,r,n){var a=t[0],i=function(t){return Math.round(t*Math.pow(10,4))/Math.pow(10,4)},o=t.slice(1).map((function(t){return+t})),u=e.slice(1).map((function(t){return+t})),c=r.x1,s=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=u.slice(-2),v=y[0],x=y[1];if("TQ".includes(a)||(r.qx=null,r.qy=null),["V","H","S","T","Z"].includes(a))p=[a].concat(o);else if("L"===a)i(h)===i(v)?p=["V",x]:i(l)===i(x)&&(p=["H",v]);else if("C"===a){var g=u[0],d=u[1];"CS".includes(n)&&(i(g)===i(2*c-m)&&i(d)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["S"].concat(u.slice(-4))),r.x1=g,r.y1=d}else if("Q"===a){var M=u[0],b=u[1];r.qx=M,r.qy=b,"QT".includes(n)&&(i(M)===i(2*c-m)&&i(b)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["T"].concat(u.slice(-2)))}return p}function Q(t,e){for(var r,n=y(t),a=w(n),i=Object.assign({},b),o=[],u=n.length,c="",s="",m=0,f=0,h=0,l=0,p=0;p<u;p+=1){c=n[p][0],o[p]=c,p&&(s=o[p-1]),n[p]=Z(n[p],a[p],i,s);var v=n[p],g=v.length;switch(i.x1=+v[g-2],i.y1=+v[g-1],i.x2=+v[g-4]||i.x1,i.y2=+v[g-3]||i.y1,c){case"Z":m=h,f=l;break;case"H":m=v[1];break;case"V":f=v[1];break;default:m=(r=v.slice(-2).map(Number))[0],f=r[1],"M"===c&&(h=m,l=f)}i.x=m,i.y=f}var d=V(n,e),M=V(x(n),e);return d.map((function(t,e){return e?t.join("").length<M[e].join("").length?t:M[e]:t}))}function D(t){var e=new $,r=Array.from(t);if(!r.every((function(t){return!Number.isNaN(t)})))throw TypeError('CSSMatrix: "'+t+'" must only have numbers.');if(16===r.length){var n=r[0],a=r[1],i=r[2],o=r[3],u=r[4],c=r[5],s=r[6],m=r[7],f=r[8],h=r[9],l=r[10],p=r[11],y=r[12],v=r[13],x=r[14],g=r[15];e.m11=n,e.a=n,e.m21=u,e.c=u,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=c,e.d=c,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=s,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=g}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var d=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=d,e.a=d,e.m12=M,e.b=M,e.m21=b,e.c=b,e.m22=w,e.d=w,e.m41=N,e.e=N,e.m42=A,e.f=A}return e}function F(t){var e=Object.keys(new $);if("object"==typeof t&&e.every((function(e){return e in t})))return D([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError('CSSMatrix: "'+JSON.stringify(t)+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function H(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new $,n='CSSMatrix: invalid transform string "'+t+'"';return e.split(")").filter((function(t){return t})).forEach((function(t){var e=t.split("("),a=e[0],i=e[1];if(!i)throw TypeError(n);var o=i.split(",").map((function(t){return t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)})),u=o[0],c=o[1],s=o[2],m=o[3],f=[u,c,s],h=[u,c,s,m];if("perspective"===a&&u&&[c,s].every((function(t){return void 0===t})))r.m34=-1/u;else if(a.includes("matrix")&&[6,16].includes(o.length)&&o.every((function(t){return!Number.isNaN(+t)}))){var l=o.map((function(t){return Math.abs(t)<1e-6?0:t}));r=r.multiply(D(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(u,c,s);else if("translate"===a&&u&&void 0===s)r=r.translate(u,c||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(u,c,s,m);else if("rotate"===a&&u&&[c,s].every((function(t){return void 0===t})))r=r.rotate(0,0,u);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(u,c,s);else if("scale"!==a||Number.isNaN(u)||1===u||void 0!==s)if("skew"===a&&(u||!Number.isNaN(u)&&c)&&void 0===s)r=r.skew(u,c||0);else{if(!(/[XYZ]/.test(a)&&u&&[c,s].every((function(t){return void 0===t}))&&["translate","rotate","scale","skew"].some((function(t){return a.includes(t)}))))throw TypeError(n);if(["skewX","skewY"].includes(a))r=r[a](u);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x="scale"===p?1:0,g=[0===v?u:x,1===v?u:x,2===v?u:x];r=r[p].apply(r,g)}}else{var d=Number.isNaN(+c)?u:c;r=r.scale(u,d,1)}})),r}function X(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function Y(t,e,r){var n=new $;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function B(t,e,r){var n=new $,a=Math.PI/180,i=t*a,o=e*a,u=r*a,c=Math.cos(i),s=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(u),l=-Math.sin(u),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=s*f*h+c*l;n.m21=v,n.c=v;var x=c*h-s*f*l;return n.m22=x,n.d=x,n.m23=-s*m,n.m31=s*l-c*f*h,n.m32=s*h+c*f*l,n.m33=c*m,n}function R(t,e,r,n){var a=new $,i=Math.sqrt(t*t+e*e+r*r);if(0===i)return a;var o=t/i,u=e/i,c=r/i,s=n*(Math.PI/360),m=Math.sin(s),f=Math.cos(s),h=m*m,l=o*o,p=u*u,y=c*c,v=1-2*(p+y)*h;a.m11=v,a.a=v;var x=2*(o*u*h+c*m*f);a.m12=x,a.b=x,a.m13=2*(o*c*h-u*m*f);var g=2*(u*o*h-c*m*f);a.m21=g,a.c=g;var d=1-2*(y+l)*h;return a.m22=d,a.d=d,a.m23=2*(u*c*h+o*m*f),a.m31=2*(c*o*h+u*m*f),a.m32=2*(c*u*h-o*m*f),a.m33=1-2*(l+p)*h,a}function G(t,e,r){var n=new $;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function J(t,e){var r=new $;if(t){var n=t*Math.PI/180,a=Math.tan(n);r.m21=a,r.c=a}if(e){var i=e*Math.PI/180,o=Math.tan(i);r.m12=o,r.b=o}return r}function U(t){return J(t,0)}function K(t){return J(0,t)}function W(t,e){return D([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}var $=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if(r.a=1,r.b=0,r.c=0,r.d=1,r.e=0,r.f=0,r.m11=1,r.m12=0,r.m13=0,r.m14=0,r.m21=0,r.m22=1,r.m23=0,r.m24=0,r.m31=0,r.m32=0,r.m33=1,r.m34=0,r.m41=0,r.m42=0,r.m43=0,r.m44=1,t&&t.length){var n=[16,6].some((function(e){return e===t.length}))?t:t[0];return r.setMatrixValue(n)}return r},_={isIdentity:{configurable:!0},is2D:{configurable:!0}};_.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44},_.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44},$.prototype.setMatrixValue=function(t){return"string"==typeof t&&t.length&&"none"!==t?H(t):[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?D(t):[$,DOMMatrix,Object].some((function(e){return t instanceof e}))?F(t):this},$.prototype.toFloat32Array=function(t){return Float32Array.from(X(this,t))},$.prototype.toFloat64Array=function(t){return Float64Array.from(X(this,t))},$.prototype.toString=function(){var t=this.is2D;return(t?"matrix":"matrix3d")+"("+this.toFloat64Array(t).join(", ")+")"},$.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},$.prototype.multiply=function(t){return W(this,t)},$.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===n&&(n=0),void 0===a&&(a=0),W(this,Y(t,n,a))},$.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),W(this,G(t,n,a))},$.prototype.rotate=function(t,e,r){var n=t,a=e||0,i=r||0;return"number"==typeof t&&void 0===e&&void 0===r&&(i=n,n=0,a=0),W(this,B(n,a,i))},$.prototype.rotateAxisAngle=function(t,e,r,n){if([t,e,r,n].some((function(t){return Number.isNaN(+t)})))throw new TypeError("CSSMatrix: expecting 4 values");return W(this,R(t,e,r,n))},$.prototype.skewX=function(t){return W(this,U(t))},$.prototype.skewY=function(t){return W(this,K(t))},$.prototype.skew=function(t,e){return W(this,J(t,e))},$.prototype.transformPoint=function(t){var e=this,r=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,n=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,a=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(r,n,a,i):{x:r,y:n,z:a,w:i}},Object.defineProperties($.prototype,_),Object.assign($,{Translate:Y,Rotate:B,RotateAxisAngle:R,Scale:G,SkewX:U,SkewY:K,Skew:J,Multiply:W,fromArray:D,fromMatrix:F,fromString:H,toArray:X});function tt(t,e,r){var n=r[0],a=r[1],i=r[2],o=function(t,e){var r,n=Y.apply(void 0,e);return r=e,n.m44=r[3],[(n=t.multiply(n)).m41,n.m42,n.m43,n.m44]}(t,e.concat([0],[1])),u=o[0],c=o[1]-a,s=o[2]-i;return[(u-n)*(Math.abs(i)/Math.abs(s)||1)+n,c*(Math.abs(i)/Math.abs(s)||1)+a]}function et(e,r){var n,a,i,o,u,c,s=0,f=0,h=y(e),l=r&&Object.keys(r);if(!r||!l.length)return m(h);var p=w(h);if(!r.origin){var v=t.origin;Object.assign(r,{origin:v})}var x=function(t){var e=new $,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,u=t.skew,c=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate.apply(e,i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(o||u||c)&&(e=e.translate(n,a),Array.isArray(o)&&o.every((function(t){return!Number.isNaN(+t)}))&&o.some((function(t){return 0!==t}))?e=e.rotate.apply(e,o):"number"!=typeof o||Number.isNaN(o)||(e=e.rotate(o)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 0!==t}))?(e=u[0]?e.skewX(u[0]):e,e=u[1]?e.skewY(u[1]):e):"number"!=typeof u||Number.isNaN(u)||(e=e.skewX(u)),Array.isArray(c)&&c.every((function(t){return!Number.isNaN(+t)}))&&c.some((function(t){return 1!==t}))?e=e.scale.apply(e,c):"number"!=typeof c||Number.isNaN(c)||(e=e.scale(c)),e=e.translate(-n,-a)),e}(r),d=r.origin,M=Object.assign({},b),N=[],A=0,C="",S=[],k=[];if(!x.isIdentity){for(n=0,i=h.length;n<i;n+=1){N=h[n],h[n]&&(C=N[0]),k[n]=C,"A"===C&&(N=I(p[n],M),h[n]=I(p[n],M),g(h,k,n),p[n]=I(p[n],M),g(p,k,n),i=Math.max(h.length,p.length)),A=(N=p[n]).length,M.x1=+N[A-2],M.y1=+N[A-1],M.x2=+N[A-4]||M.x1,M.y2=+N[A-3]||M.y1;var P={s:h[n],c:h[n][0],x:M.x1,y:M.y1};S=S.concat([P])}return S.map((function(t){var e,r;switch(C=t.c,N=t.s,C){case"L":case"H":case"V":return e=tt(x,[t.x,t.y],d),u=e[0],c=e[1],s!==u&&f!==c?N=["L",u,c]:f===c?N=["H",u]:s===u&&(N=["V",c]),s=u,f=c,N;default:for(a=1,o=N.length;a<o;a+=2)r=tt(x,[+N[a],+N[a+1]],d),s=r[0],f=r[1],N[a]=s,N[a+1]=f;return N}}))}return m(h)}function rt(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,u=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2)));return(r*i-n*a<0?-1:1)*Math.acos(o/u)}function nt(t,e,r,n,a,i,o,u,c,s){var m=Math.abs,f=Math.sin,h=Math.cos,l=Math.sqrt,p=Math.PI,y=m(r),v=m(n),x=(a%360+360)%360*(p/180);if(t===u&&e===c)return{x:t,y:e};if(0===y||0===v)return j(t,e,u,c,s).point;var g=(t-u)/2,d=(e-c)/2,M={x:h(x)*g+f(x)*d,y:-f(x)*g+h(x)*d},b=Math.pow(M.x,2)/Math.pow(y,2)+Math.pow(M.y,2)/Math.pow(v,2);b>1&&(y*=l(b),v*=l(b));var w=(Math.pow(y,2)*Math.pow(v,2)-Math.pow(y,2)*Math.pow(M.y,2)-Math.pow(v,2)*Math.pow(M.x,2))/(Math.pow(y,2)*Math.pow(M.y,2)+Math.pow(v,2)*Math.pow(M.x,2)),N=(i!==o?1:-1)*l(w=w<0?0:w),A=N*(y*M.y/v),C=N*(-v*M.x/y),S=h(x)*A-f(x)*C+(t+u)/2,k=f(x)*A+h(x)*C+(e+c)/2,P={x:(M.x-A)/y,y:(M.y-C)/v},T=rt({x:1,y:0},P),q=rt(P,{x:(-M.x-A)/y,y:(-M.y-C)/v});!o&&q>0?q-=2*p:o&&q<0&&(q+=2*p);var I=T+(q%=2*p)*s,O=y*h(I),V=v*f(I);return{x:h(x)*O-f(x)*V+S,y:f(x)*O+h(x)*V+k}}function at(t,e,r,n,a,i,o,u,c,s){var m,f="number"==typeof s,h=t,l=e,p=0,y=[h,l,p],v=[h,l],x={x:0,y:0},g=[{x:h,y:l}];f&&0===s&&(x={x:h,y:l});for(var d=0;d<=300;d+=1){if(h=(m=nt(t,e,r,n,a,i,o,u,c,d/300)).x,l=m.y,g=g.concat([{x:h,y:l}]),p+=T(v,[h,l]),v=[h,l],f&&p>s&&s>y[2]){var M=(p-s)/(p-y[2]);x={x:v[0]*(1-M)+y[0]*M,y:v[1]*(1-M)+y[1]*M}}y=[h,l,p]}return f&&s>=p&&(x={x:u,y:c}),{length:p,point:x,min:{x:Math.min.apply(Math,g.map((function(t){return t.x}))),y:Math.min.apply(Math,g.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,g.map((function(t){return t.x}))),y:Math.max.apply(Math,g.map((function(t){return t.y})))}}}function it(t,e,r,n,a,i,o,u,c){var s=1-c;return{x:Math.pow(s,3)*t+3*Math.pow(s,2)*c*r+3*s*Math.pow(c,2)*a+Math.pow(c,3)*o,y:Math.pow(s,3)*e+3*Math.pow(s,2)*c*n+3*s*Math.pow(c,2)*i+Math.pow(c,3)*u}}function ot(t,e,r,n,a,i,o,u,c){var s,m="number"==typeof c,f=t,h=e,l=0,p=[f,h,l],y=[f,h],v={x:0,y:0},x=[{x:f,y:h}];m&&0===c&&(v={x:f,y:h});for(var g=0;g<=300;g+=1){if(f=(s=it(t,e,r,n,a,i,o,u,g/300)).x,h=s.y,x=x.concat([{x:f,y:h}]),l+=T(y,[f,h]),y=[f,h],m&&l>c&&c>p[2]){var d=(l-c)/(l-p[2]);v={x:y[0]*(1-d)+p[0]*d,y:y[1]*(1-d)+p[1]*d}}p=[f,h,l]}return m&&c>=l&&(v={x:o,y:u}),{length:l,point:v,min:{x:Math.min.apply(Math,x.map((function(t){return t.x}))),y:Math.min.apply(Math,x.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,x.map((function(t){return t.x}))),y:Math.max.apply(Math,x.map((function(t){return t.y})))}}}function ut(t,e,r,n,a,i,o){var u=1-o;return{x:Math.pow(u,2)*t+2*u*o*r+Math.pow(o,2)*a,y:Math.pow(u,2)*e+2*u*o*n+Math.pow(o,2)*i}}function ct(t,e,r,n,a,i,o){var u,c="number"==typeof o,s=t,m=e,f=0,h=[s,m,f],l=[s,m],p={x:0,y:0},y=[{x:s,y:m}];c&&0===o&&(p={x:s,y:m});for(var v=0;v<=300;v+=1){if(s=(u=ut(t,e,r,n,a,i,v/300)).x,m=u.y,y=y.concat([{x:s,y:m}]),f+=T(l,[s,m]),l=[s,m],c&&f>o&&o>h[2]){var x=(f-o)/(f-h[2]);p={x:l[0]*(1-x)+h[0]*x,y:l[1]*(1-x)+h[1]*x}}h=[s,m,f]}return c&&o>=f&&(p={x:a,y:i}),{length:f,point:p,min:{x:Math.min.apply(Math,y.map((function(t){return t.x}))),y:Math.min.apply(Math,y.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,y.map((function(t){return t.x}))),y:Math.max.apply(Math,y.map((function(t){return t.y})))}}}function st(t,e){for(var r,n,a,i,o,u,c,s,m=w(t),f="number"==typeof e,h=!0,l=[],p="M",y=0,v=0,x=0,g=0,d=[],M=[],b=0,N={x:0,y:0},A=N,C=N,S=N,k=0,P=0,T=m.length;P<T;P+=1)l=(h="M"===(p=(s=m[P])[0]))?l:[y,v].concat(s.slice(1)),h?(A=N={x:x=(r=s)[1],y:g=r[2]},b=0,f&&e<.001&&(S=N)):"L"===p?(b=(n=j.apply(void 0,l.concat([(e||0)-k]))).length,N=n.min,A=n.max,C=n.point):"A"===p?(b=(a=at.apply(void 0,l.concat([(e||0)-k]))).length,N=a.min,A=a.max,C=a.point):"C"===p?(b=(i=ot.apply(void 0,l.concat([(e||0)-k]))).length,N=i.min,A=i.max,C=i.point):"Q"===p?(b=(o=ct.apply(void 0,l.concat([(e||0)-k]))).length,N=o.min,A=o.max,C=o.point):"Z"===p&&(l=[y,v,x,g],b=(u=j.apply(void 0,l.concat([(e||0)-k]))).length,N=u.min,A=u.max,C=u.point),f&&k<e&&k+b>=e&&(S=C),M=M.concat([A]),d=d.concat([N]),k+=b,y=(c="Z"!==p?s.slice(-2):[x,g])[0],v=c[1];return f&&e>=k&&(S={x:y,y:v}),{length:k,point:S,min:{x:Math.min.apply(Math,d.map((function(t){return t.x}))),y:Math.min.apply(Math,d.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,M.map((function(t){return t.x}))),y:Math.max.apply(Math,M.map((function(t){return t.y})))}}}function mt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=st(t),r=e.min,n=r.x,a=r.y,i=e.max,o=i.x,u=i.y,c=o-n,s=u-a;return{width:c,height:s,x:n,y:a,x2:o,y2:u,cx:n+c/2,cy:a+s/2,cz:Math.max(c,s)+Math.min(c,s)/2}}function ft(t){return st(t).length}function ht(t,e){return st(t,e).point}Object.assign($,{Version:"1.0.2"});var lt=function(e,r){var a=r||{},i=void 0===e;if(i||!e.length)throw TypeError(n+': "pathValue" is '+(i?"undefined":"empty"));var o=l(e);if("string"==typeof o)throw TypeError(o);this.segments=o;var u=this.getBBox(),c=u.width,s=u.height,m=u.cx,f=u.cy,h=u.cz,p=t.round,y=t.origin,v=a.round,x=a.origin;if("auto"===v){var g=(""+Math.floor(Math.max(c,s))).length;p=g>=4?0:4-g}else(Number.isInteger(v)||"off"===v)&&(p=v);if(Array.isArray(x)&&x.length>=2){var d=x.map(Number),M=d[0],b=d[1],w=d[2];y=[Number.isNaN(M)?m:M,Number.isNaN(b)?f:b,Number.isNaN(w)?h:w]}else y=[m,f,h];return this.round=p,this.origin=y,this};function pt(t,e,r,n,a,i,o,u){return 3*((u-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+u*(a+t/3)-o*(i+e/3))/20}function yt(t){var e=0,r=0,n=0;return O(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=pt.apply(void 0,[e,r].concat(t.slice(1))),i=t.slice(-2),e=i[0],r=i[1],n}})).reduce((function(t,e){return t+e}),0)}function vt(t,e){var r=l(t);if("string"==typeof r)throw TypeError(r);var n=[].concat(r),a=ft(n),i=n.length-1,o=0,u=0,c=r[0],s=c.slice(-2),m={x:s[0],y:s[1]};if(i<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:m,lengthAtSegment:o};if(e>=a)return u=a-(o=ft(n=r.slice(0,-1))),{segment:r[i],index:i,length:u,lengthAtSegment:o};for(var f=[];i>0;)c=n[i],u=a-(o=ft(n=n.slice(0,-1))),a=o,f.push({segment:c,index:i,length:u,lengthAtSegment:o}),i-=1;return f.find((function(t){return t.lengthAtSegment<=e}))}function xt(t,e){for(var r=l(t),n=w(r),a=ft(r),i=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},o=8,u={x:0,y:0},c=0,s=u,m=0,f=1/0,h=0;h<=a;h+=o)(c=i(u=ht(n,h)))<f&&(s=u,m=h,f=c);o/=2;for(var p={x:0,y:0},y=p,v=0,x=0,g=0,d=0;o>.5;)g=i(p=ht(n,v=m-o)),d=i(y=ht(n,x=m+o)),v>=0&&g<f?(s=p,m=v,f=g):x<=a&&d<f?(s=y,m=x,f=d):o/=2;var M=vt(r,m);return{closest:s,distance:Math.sqrt(f),segment:M}}function gt(t){if("string"!=typeof t)return!1;var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return!e.err.length&&"mM".includes(e.segments[0][0])}lt.prototype.getBBox=function(){return mt(this.segments)},lt.prototype.getTotalLength=function(){return ft(this.segments)},lt.prototype.getPointAtLength=function(t){return ht(this.segments,t)},lt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=y(t),this},lt.prototype.toRelative=function(){var t=this.segments;return this.segments=x(t),this},lt.prototype.toCurve=function(){var t=this.segments;return this.segments=O(t),this},lt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=z(e),n=r.length>1?r:0,a=n&&m(n).map((function(e,r){return t?r?E(e):l(e):E(e)})),i=[];return i=n?a.flat(1):t?e:E(e),this.segments=m(i),this},lt.prototype.normalize=function(){var t=this.segments;return this.segments=w(t),this},lt.prototype.optimize=function(){var t=this.segments;return this.segments=Q(t,this.round),this},lt.prototype.transform=function(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some((function(e){return e in t})))return this;var e={};Object.keys(t).forEach((function(r){e[r]=Array.isArray(t[r])?[].concat(t[r]):Number(t[r])}));var r=this.segments,n=this.origin,a=n[0],i=n[1],o=n[2],u=e.origin;if(Array.isArray(u)&&u.length>=2){var c=u.map(Number),s=c[0],m=c[1],f=c[2];e.origin=[Number.isNaN(s)?a:s,Number.isNaN(m)?i:m,f||o]}else e.origin=[a,i,o];return this.segments=et(r,e),this},lt.prototype.flipX=function(){return this.transform({rotate:[0,180,0]}),this},lt.prototype.flipY=function(){return this.transform({rotate:[180,0,0]}),this},lt.prototype.toString=function(){return L(this.segments,this.round)};var dt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};var Mt={CSSMatrix:$,parsePathString:l,isPathArray:h,isCurveArray:A,isAbsoluteArray:p,isRelativeArray:v,isNormalizedArray:M,isValidPath:gt,pathToAbsolute:y,pathToRelative:x,pathToCurve:O,pathToString:L,getDrawDirection:function(t){return yt(O(t))>=0},getPathArea:yt,getPathBBox:mt,pathLengthFactory:st,getTotalLength:ft,getPointAtLength:ht,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:vt,getSegmentAtLength:function(t,e){return vt(t,e).segment},isPointInStroke:function(t,e){var r=xt(t,e).distance;return Math.abs(r)<.001},clonePath:m,splitPath:z,fixPath:N,roundPath:V,optimizePath:Q,reverseCurve:function(t){var e=t.slice(1).map((function(e,r,n){return r?n[r-1].slice(-2).concat(e.slice(1)):t[0].slice(1).concat(e.slice(1))})).map((function(t){return t.map((function(e,r){return t[t.length-r-2*(1-r%2)]}))})).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map((function(t){return["C"].concat(t.slice(2))})))},reversePath:E,normalizePath:w,transformPath:et,shapeToPath:function(e,r){var a=Object.keys(dt),i=e.tagName;if(i&&!a.some((function(t){return i===t})))throw TypeError(n+': "'+i+'" is not SVGElement');var o=document.createElementNS("http://www.w3.org/2000/svg","path"),u=i||e.type,c={};c.type=u;var s,m=dt[u];i?(m.forEach((function(t){c[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;m.includes(e)||o.setAttribute(e,r)}))):(Object.assign(c,e),Object.keys(c).forEach((function(t){m.includes(t)||"type"===t||o.setAttribute(t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()})),c[t])})));var f,h,l,p,y=t.round;return"circle"===u?s=L((h=(f=c).cx,l=f.cy,p=f.r,[["M",h-p,l],["a",p,p,0,1,0,2*p,0],["a",p,p,0,1,0,-2*p,0]]),y):"ellipse"===u?s=L(function(t){var e=t.cx,r=t.cy,n=t.rx,a=t.ry;return[["M",e-n,r],["a",n,a,0,1,0,2*n,0],["a",n,a,0,1,0,-2*n,0]]}(c),y):["polyline","polygon"].includes(u)?s=L(function(t){for(var e=[],r=(t.points||"").trim().split(/[\s|,]/).map(Number),n=0;n<r.length;)e.push([n?"L":"M",r[n],r[n+1]]),n+=2;return"polygon"===t.type?e.concat([["z"]]):e}(c),y):"rect"===u?s=L(function(t){var e=+t.x||0,r=+t.y||0,n=+t.width,a=+t.height,i=+t.rx,o=+t.ry;return i||o?(i=i||o,o=o||i,2*i>n&&(i-=(2*i-n)/2),2*o>a&&(o-=(2*o-a)/2),[["M",e+i,r],["h",n-2*i],["s",i,0,i,o],["v",a-2*o],["s",0,o,-i,o],["h",2*i-n],["s",-i,0,-i,-o],["v",2*o-a],["s",0,-o,i,-o]]):[["M",e,r],["h",n],["v",a],["H",e],["Z"]]}(c),y):"line"===u?s=L(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(c),y):"glyph"===u&&(s=i?e.getAttribute("d"):e.d),!!gt(s)&&(o.setAttribute("d",s),r&&i&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(lt,Mt,{Version:"1.0.2"}),lt}));
1
+ // SVGPathCommander v1.0.3 | thednp © 2022 | MIT-License
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";var t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function r(t){for(var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;a.length>=e[n]&&(t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}var n="SVGPathCommander error";function a(t){var e=t.index,r=t.pathValue,a=r.charCodeAt(e);return 48===a?(t.param=0,void(t.index+=1)):49===a?(t.param=1,void(t.index+=1)):void(t.err=n+': invalid Arc flag "'+r[e]+'", expecting 0 or 1 at index '+e)}function i(t){return t>=48&&t<=57}function o(t){var e,r=t.max,a=t.pathValue,o=t.index,u=o,c=!1,s=!1,m=!1,f=!1;if(u>=r)t.err=n+": Invalid path value at index "+u+', "pathValue" is missing param';else if(43!==(e=a.charCodeAt(u))&&45!==e||(u+=1,e=a.charCodeAt(u)),i(e)||46===e){if(46!==e){if(c=48===e,u+=1,e=a.charCodeAt(u),c&&u<r&&e&&i(e))return void(t.err=n+": Invalid path value at index "+o+', "'+a[o]+'" illegal number');for(;u<r&&i(a.charCodeAt(u));)u+=1,s=!0;e=a.charCodeAt(u)}if(46===e){for(f=!0,u+=1;i(a.charCodeAt(u));)u+=1,m=!0;e=a.charCodeAt(u)}if(101===e||69===e){if(f&&!s&&!m)return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid float exponent');if(u+=1,43!==(e=a.charCodeAt(u))&&45!==e||(u+=1),!(u<r&&i(a.charCodeAt(u))))return void(t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" invalid integer exponent');for(;u<r&&i(a.charCodeAt(u));)u+=1}t.index=u,t.param=+t.pathValue.slice(o,u)}else t.err=n+": Invalid path value at index "+u+', "'+a[u]+'" is not a number'}function u(t){for(var e,r=t.pathValue,n=t.max;t.index<n&&(10===(e=r.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function c(t){return t>=48&&t<=57||43===t||45===t||46===t}function s(t){var i=t.max,s=t.pathValue,m=t.index,f=s.charCodeAt(m),h=e[s[m].toLowerCase()];if(t.segmentStart=m,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(f))if(t.index+=1,u(t),t.data=[],h){for(;;){for(var l=h;l>0;l-=1){if(97!=(32|f)||3!==l&&4!==l?o(t):a(t),t.err.length)return;t.data.push(t.param),u(t),t.index<i&&44===s.charCodeAt(t.index)&&(t.index+=1,u(t))}if(t.index>=t.max)break;if(!c(s.charCodeAt(t.index)))break}r(t)}else r(t);else t.err=n+': Invalid path value "'+s[m]+'" is not a path command'}function m(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function f(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function l(t){if(h(t))return m(t);var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return e.err?e.err:e.segments}function p(t){return h(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function y(t){if(p(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toUpperCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"A":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":s=[c,o[0]+n];break;case"H":s=[c,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));s=[c].concat(m)}else s=[c].concat(o);var f=s.length;switch(c){case"Z":r=a,n=i;break;case"H":r=s[1];break;case"V":n=s[1];break;default:r=s[f-2],n=s[f-1],"M"===c&&(a=r,i=n)}return s}))}function v(t){return h(t)&&t.slice(1).every((function(t){var e=t[0];return e===e.toLowerCase()}))}function x(t){if(v(t))return m(t);var e=l(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var s=[];if(u!==c)switch(c){case"a":s=[c,o[0],o[1],o[2],o[3],o[4],o[5]-r,o[6]-n];break;case"v":s=[c,o[0]-n];break;case"h":s=[c,o[0]-r];break;default:var m=o.map((function(t,e){return t-(e%2?n:r)}));s=[c].concat(m)}else"m"===u&&(a=o[0]+r,i=o[1]+n),s=[c].concat(o);var f=s.length;switch(c){case"z":r=a,n=i;break;case"h":r+=s[1];break;case"v":n+=s[1];break;default:r+=s[f-2],n+=s[f-1]}return s}))}function g(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}function d(t,e){var r=t[0],n=e.x1,a=e.y1,i=e.x2,o=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(r)||(e.qx=null,e.qy=null),"H"===r)c=["L",t[1],a];else if("V"===r)c=["L",n,t[1]];else if("S"===r){var s=2*n-i,m=2*a-o;e.x1=s,e.y1=m,c=["C",s,m].concat(u)}else if("T"===r){var f=2*n-e.qx,h=2*a-e.qy;e.qx=f,e.qy=h,c=["Q",f,h].concat(u)}else if("Q"===r){var l=u[0],p=u[1];e.qx=l,e.qy=p}return c}function M(t){return p(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}var b={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function w(t){if(M(t))return m(t);for(var e=y(t),r=Object.assign({},b),n=[],a=e.length,i="",o=0;o<a;o+=1){i=e[o][0],n[o]=i,e[o]=d(e[o],r);var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function N(t){var e=l(t),r=w(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),u=o[0],c=o[1],s=r[i].slice(-2),m=s[0],f=s[1];return a&&u===m&&c===f?e.slice(0,-1):e}function A(t){return M(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}function C(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function S(t,e,r,n,a,i,o,u,c,s){var m,f,h,l,p,y,v=t,x=e,g=r,d=n,M=u,b=c,w=120*Math.PI/180,N=Math.PI/180*(+a||0),A=[];if(s)h=(m=s)[0],l=m[1],p=m[2],y=m[3];else{v=(f=C(v,x,-N)).x,x=f.y;var k=(v-(M=(f=C(M,b,-N)).x))/2,P=(x-(b=f.y))/2,T=k*k/(g*g)+P*P/(d*d);T>1&&(g*=T=Math.sqrt(T),d*=T);var j=g*g,q=d*d,I=(i===o?-1:1)*Math.sqrt(Math.abs((j*q-j*P*P-q*k*k)/(j*P*P+q*k*k)));p=I*g*P/d+(v+M)/2,y=I*-d*k/g+(x+b)/2,h=(Math.asin((x-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/d)*Math.pow(10,9)>>0)/Math.pow(10,9),h=v<p?Math.PI-h:h,l=M<p?Math.PI-l:l,h<0&&(h=2*Math.PI+h),l<0&&(l=2*Math.PI+l),o&&h>l&&(h-=2*Math.PI),!o&&l>h&&(l-=2*Math.PI)}var O=l-h;if(Math.abs(O)>w){var V=l,L=M,E=b;l=h+w*(o&&l>h?1:-1),A=S(M=p+g*Math.cos(l),b=y+d*Math.sin(l),g,d,a,0,o,L,E,[l,V,p,y])}O=l-h;var z=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),F=Math.tan(O/4),H=4/3*g*F,X=4/3*d*F,Y=[v,x],B=[v+H*Z,x-X*z],R=[M+H*D,b-X*Q],G=[M,b];if(B[0]=2*Y[0]-B[0],B[1]=2*Y[1]-B[1],s)return B.concat(R,G,A);for(var J=[],U=0,K=(A=B.concat(R,G,A)).length;U<K;U+=1)J[U]=U%2?C(A[U-1],A[U],N).y:C(A[U],A[U+1],N).x;return J}function k(t,e,r,n,a,i){return[1/3*t+2/3*r,1/3*e+2/3*n,1/3*a+2/3*r,1/3*i+2/3*n,a,i]}function P(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function j(t,e,r,n,a){var i=T([t,e],[r,n]),o={x:0,y:0};if("number"==typeof a)if(0===a)o={x:t,y:e};else if(a>=i)o={x:r,y:n};else{var u=P([t,e],[r,n],a/i);o={x:u[0],y:u[1]}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function q(t,e,r,n){var a=.5,i=[t,e],o=[r,n],u=P(i,o,a),c=P(o,u,a),s=P(u,c,a),m=P(c,s,a),f=P(s,m,a),h=i.concat(u,s,f,[a]),l=j.apply(void 0,h).point,p=f.concat(m,c,o,[0]),y=j.apply(void 0,p).point;return[l.x,l.y,y.x,y.y,r,n]}function I(t,e){var r,n=t[0],a=t.slice(1).map(Number),i=a[0],o=a[1],u=e.x1,c=e.y1,s=e.x,m=e.y;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=i,e.y=o,t;case"A":return r=[u,c].concat(a),["C"].concat(S.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[u,c].concat(a),["C"].concat(k.apply(void 0,r));case"L":return["C"].concat(q(u,c,i,o));case"Z":return["C"].concat(q(u,c,s,m))}return t}function O(t){if(A(t))return m(t);for(var e=N(w(t)),r=Object.assign({},b),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=I(e[o],r),g(e,n,o),i=e.length;var u=e[o],c=u.length;r.x1=+u[c-2],r.y1=+u[c-1],r.x2=+u[c-4]||r.x1,r.y2=+u[c-3]||r.y1}return e}function V(e,r){var n=t.round;if("off"===r||"off"===n)return m(e);var a="number"==typeof(n=r>=0?r:n)&&n>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return n?Math.round(t*a)/a:Math.round(t)}));return[t[0]].concat(e)}))}function L(t,e){return V(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function E(t){var e=y(t),r="Z"===e.slice(-1)[0][0],n=w(e).map((function(t,r){var n=t.slice(-2).map(Number),a=n[0],i=n[1];return{seg:e[r],n:t,c:e[r][0],x:a,y:i}})).map((function(t,e,n){var a=t.seg,i=t.n,o=e&&n[e-1],u=n[e+1],c=t.c,s=n.length,m=e?n[e-1].x:n[s-1].x,f=e?n[e-1].y:n[s-1].y,h=[];switch(c){case"M":h=r?["Z"]:[c,m,f];break;case"A":h=[c].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=u&&"S"===u.c?["S",a[1],a[2],m,f]:[c,a[3],a[4],a[1],a[2],m,f];break;case"S":h=!o||!"CS".includes(o.c)||u&&"S"===u.c?[c,i[1],i[2],m,f]:["C",i[3],i[4],i[1],i[2],m,f];break;case"Q":h=u&&"T"===u.c?["T",m,f]:[c].concat(a.slice(1,-2),[m],[f]);break;case"T":h=!o||!"QT".includes(o.c)||u&&"T"===u.c?[c,m,f]:["Q",i[1],i[2],m,f];break;case"Z":h=["M",m,f];break;case"H":h=[c,m];break;case"V":h=[c,f];break;default:h=[c].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function z(t){var e,r=[],n=-1;return t.forEach((function(t){"M"===t[0]?(e=[t],n+=1):e=e.concat([t]),r[n]=e})),r}function Z(t,e,r,n){var a=t[0],i=function(t){return Math.round(t*Math.pow(10,4))/Math.pow(10,4)},o=t.slice(1).map((function(t){return+t})),u=e.slice(1).map((function(t){return+t})),c=r.x1,s=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=u.slice(-2),v=y[0],x=y[1];if("TQ".includes(a)||(r.qx=null,r.qy=null),["V","H","S","T","Z"].includes(a))p=[a].concat(o);else if("L"===a)i(h)===i(v)?p=["V",x]:i(l)===i(x)&&(p=["H",v]);else if("C"===a){var g=u[0],d=u[1];"CS".includes(n)&&(i(g)===i(2*c-m)&&i(d)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["S"].concat(u.slice(-4))),r.x1=g,r.y1=d}else if("Q"===a){var M=u[0],b=u[1];r.qx=M,r.qy=b,"QT".includes(n)&&(i(M)===i(2*c-m)&&i(b)===i(2*s-f)||i(c)===i(2*m-h)&&i(s)===i(2*f-l))&&(p=["T"].concat(u.slice(-2)))}return p}function Q(t,e){for(var r,n=y(t),a=w(n),i=Object.assign({},b),o=[],u=n.length,c="",s="",m=0,f=0,h=0,l=0,p=0;p<u;p+=1){c=n[p][0],o[p]=c,p&&(s=o[p-1]),n[p]=Z(n[p],a[p],i,s);var v=n[p],g=v.length;switch(i.x1=+v[g-2],i.y1=+v[g-1],i.x2=+v[g-4]||i.x1,i.y2=+v[g-3]||i.y1,c){case"Z":m=h,f=l;break;case"H":m=v[1];break;case"V":f=v[1];break;default:m=(r=v.slice(-2).map(Number))[0],f=r[1],"M"===c&&(h=m,l=f)}i.x=m,i.y=f}var d=V(n,e),M=V(x(n),e);return d.map((function(t,e){return e?t.join("").length<M[e].join("").length?t:M[e]:t}))}function D(t){var e=new $,r=Array.from(t);if(!r.every((function(t){return!Number.isNaN(t)})))throw TypeError('CSSMatrix: "'+t+'" must only have numbers.');if(16===r.length){var n=r[0],a=r[1],i=r[2],o=r[3],u=r[4],c=r[5],s=r[6],m=r[7],f=r[8],h=r[9],l=r[10],p=r[11],y=r[12],v=r[13],x=r[14],g=r[15];e.m11=n,e.a=n,e.m21=u,e.c=u,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=c,e.d=c,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=s,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=g}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var d=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=d,e.a=d,e.m12=M,e.b=M,e.m21=b,e.c=b,e.m22=w,e.d=w,e.m41=N,e.e=N,e.m42=A,e.f=A}return e}function F(t){var e=Object.keys(new $);if("object"==typeof t&&e.every((function(e){return e in t})))return D([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError('CSSMatrix: "'+JSON.stringify(t)+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function H(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new $,n='CSSMatrix: invalid transform string "'+t+'"';return e.split(")").filter((function(t){return t})).forEach((function(t){var e=t.split("("),a=e[0],i=e[1];if(!i)throw TypeError(n);var o=i.split(",").map((function(t){return t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)})),u=o[0],c=o[1],s=o[2],m=o[3],f=[u,c,s],h=[u,c,s,m];if("perspective"===a&&u&&[c,s].every((function(t){return void 0===t})))r.m34=-1/u;else if(a.includes("matrix")&&[6,16].includes(o.length)&&o.every((function(t){return!Number.isNaN(+t)}))){var l=o.map((function(t){return Math.abs(t)<1e-6?0:t}));r=r.multiply(D(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(u,c,s);else if("translate"===a&&u&&void 0===s)r=r.translate(u,c||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(u,c,s,m);else if("rotate"===a&&u&&[c,s].every((function(t){return void 0===t})))r=r.rotate(0,0,u);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(u,c,s);else if("scale"!==a||Number.isNaN(u)||1===u||void 0!==s)if("skew"===a&&(u||!Number.isNaN(u)&&c)&&void 0===s)r=r.skew(u,c||0);else{if(!(/[XYZ]/.test(a)&&u&&[c,s].every((function(t){return void 0===t}))&&["translate","rotate","scale","skew"].some((function(t){return a.includes(t)}))))throw TypeError(n);if(["skewX","skewY"].includes(a))r=r[a](u);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x="scale"===p?1:0,g=[0===v?u:x,1===v?u:x,2===v?u:x];r=r[p].apply(r,g)}}else{var d=Number.isNaN(+c)?u:c;r=r.scale(u,d,1)}})),r}function X(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function Y(t,e,r){var n=new $;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function B(t,e,r){var n=new $,a=Math.PI/180,i=t*a,o=e*a,u=r*a,c=Math.cos(i),s=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(u),l=-Math.sin(u),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=s*f*h+c*l;n.m21=v,n.c=v;var x=c*h-s*f*l;return n.m22=x,n.d=x,n.m23=-s*m,n.m31=s*l-c*f*h,n.m32=s*h+c*f*l,n.m33=c*m,n}function R(t,e,r,n){var a=new $,i=Math.sqrt(t*t+e*e+r*r);if(0===i)return a;var o=t/i,u=e/i,c=r/i,s=n*(Math.PI/360),m=Math.sin(s),f=Math.cos(s),h=m*m,l=o*o,p=u*u,y=c*c,v=1-2*(p+y)*h;a.m11=v,a.a=v;var x=2*(o*u*h+c*m*f);a.m12=x,a.b=x,a.m13=2*(o*c*h-u*m*f);var g=2*(u*o*h-c*m*f);a.m21=g,a.c=g;var d=1-2*(y+l)*h;return a.m22=d,a.d=d,a.m23=2*(u*c*h+o*m*f),a.m31=2*(c*o*h+u*m*f),a.m32=2*(c*u*h-o*m*f),a.m33=1-2*(l+p)*h,a}function G(t,e,r){var n=new $;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function J(t,e){var r=new $;if(t){var n=t*Math.PI/180,a=Math.tan(n);r.m21=a,r.c=a}if(e){var i=e*Math.PI/180,o=Math.tan(i);r.m12=o,r.b=o}return r}function U(t){return J(t,0)}function K(t){return J(0,t)}function W(t,e){return D([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}var $=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if(r.a=1,r.b=0,r.c=0,r.d=1,r.e=0,r.f=0,r.m11=1,r.m12=0,r.m13=0,r.m14=0,r.m21=0,r.m22=1,r.m23=0,r.m24=0,r.m31=0,r.m32=0,r.m33=1,r.m34=0,r.m41=0,r.m42=0,r.m43=0,r.m44=1,t.length){var n=[16,6].some((function(e){return e===t.length}))?t:t[0];return r.setMatrixValue(n)}return r},_={isIdentity:{configurable:!0},is2D:{configurable:!0}};_.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44},_.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44},$.prototype.setMatrixValue=function(t){return"string"==typeof t&&t.length&&"none"!==t?H(t):[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?D(t):[$,DOMMatrix,Object].some((function(e){return t instanceof e}))?F(t):this},$.prototype.toFloat32Array=function(t){return Float32Array.from(X(this,t))},$.prototype.toFloat64Array=function(t){return Float64Array.from(X(this,t))},$.prototype.toString=function(){var t=this.is2D;return(t?"matrix":"matrix3d")+"("+this.toFloat64Array(t).join(", ")+")"},$.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},$.prototype.multiply=function(t){return W(this,t)},$.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===n&&(n=0),void 0===a&&(a=0),W(this,Y(t,n,a))},$.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),W(this,G(t,n,a))},$.prototype.rotate=function(t,e,r){var n=t,a=e||0,i=r||0;return"number"==typeof t&&void 0===e&&void 0===r&&(i=n,n=0,a=0),W(this,B(n,a,i))},$.prototype.rotateAxisAngle=function(t,e,r,n){if([t,e,r,n].some((function(t){return Number.isNaN(+t)})))throw new TypeError("CSSMatrix: expecting 4 values");return W(this,R(t,e,r,n))},$.prototype.skewX=function(t){return W(this,U(t))},$.prototype.skewY=function(t){return W(this,K(t))},$.prototype.skew=function(t,e){return W(this,J(t,e))},$.prototype.transformPoint=function(t){var e=this,r=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,n=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,a=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(r,n,a,i):{x:r,y:n,z:a,w:i}},Object.defineProperties($.prototype,_),Object.assign($,{Translate:Y,Rotate:B,RotateAxisAngle:R,Scale:G,SkewX:U,SkewY:K,Skew:J,Multiply:W,fromArray:D,fromMatrix:F,fromString:H,toArray:X});function tt(t,e,r){var n=r[0],a=r[1],i=r[2],o=function(t,e){var r,n=Y.apply(void 0,e);return r=e,n.m44=r[3],[(n=t.multiply(n)).m41,n.m42,n.m43,n.m44]}(t,e.concat([0],[1])),u=o[0],c=o[1]-a,s=o[2]-i;return[(u-n)*(Math.abs(i)/Math.abs(s)||1)+n,c*(Math.abs(i)/Math.abs(s)||1)+a]}function et(e,r){var n,a,i,o,u,c,s=0,f=0,h=y(e),l=r&&Object.keys(r);if(!r||!l.length)return m(h);var p=w(h);if(!r.origin){var v=t.origin;Object.assign(r,{origin:v})}var x=function(t){var e=new $,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,u=t.skew,c=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate.apply(e,i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(o||u||c)&&(e=e.translate(n,a),Array.isArray(o)&&o.every((function(t){return!Number.isNaN(+t)}))&&o.some((function(t){return 0!==t}))?e=e.rotate.apply(e,o):"number"!=typeof o||Number.isNaN(o)||(e=e.rotate(o)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 0!==t}))?(e=u[0]?e.skewX(u[0]):e,e=u[1]?e.skewY(u[1]):e):"number"!=typeof u||Number.isNaN(u)||(e=e.skewX(u)),Array.isArray(c)&&c.every((function(t){return!Number.isNaN(+t)}))&&c.some((function(t){return 1!==t}))?e=e.scale.apply(e,c):"number"!=typeof c||Number.isNaN(c)||(e=e.scale(c)),e=e.translate(-n,-a)),e}(r),d=r.origin,M=Object.assign({},b),N=[],A=0,C="",S=[],k=[];if(!x.isIdentity){for(n=0,i=h.length;n<i;n+=1){N=h[n],h[n]&&(C=N[0]),k[n]=C,"A"===C&&(N=I(p[n],M),h[n]=I(p[n],M),g(h,k,n),p[n]=I(p[n],M),g(p,k,n),i=Math.max(h.length,p.length)),A=(N=p[n]).length,M.x1=+N[A-2],M.y1=+N[A-1],M.x2=+N[A-4]||M.x1,M.y2=+N[A-3]||M.y1;var P={s:h[n],c:h[n][0],x:M.x1,y:M.y1};S=S.concat([P])}return S.map((function(t){var e,r;switch(C=t.c,N=t.s,C){case"L":case"H":case"V":return e=tt(x,[t.x,t.y],d),u=e[0],c=e[1],s!==u&&f!==c?N=["L",u,c]:f===c?N=["H",u]:s===u&&(N=["V",c]),s=u,f=c,N;default:for(a=1,o=N.length;a<o;a+=2)r=tt(x,[+N[a],+N[a+1]],d),s=r[0],f=r[1],N[a]=s,N[a+1]=f;return N}}))}return m(h)}function rt(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,u=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2)));return(r*i-n*a<0?-1:1)*Math.acos(o/u)}function nt(t,e,r,n,a,i,o,u,c,s){var m=Math.abs,f=Math.sin,h=Math.cos,l=Math.sqrt,p=Math.PI,y=m(r),v=m(n),x=(a%360+360)%360*(p/180);if(t===u&&e===c)return{x:t,y:e};if(0===y||0===v)return j(t,e,u,c,s).point;var g=(t-u)/2,d=(e-c)/2,M={x:h(x)*g+f(x)*d,y:-f(x)*g+h(x)*d},b=Math.pow(M.x,2)/Math.pow(y,2)+Math.pow(M.y,2)/Math.pow(v,2);b>1&&(y*=l(b),v*=l(b));var w=(Math.pow(y,2)*Math.pow(v,2)-Math.pow(y,2)*Math.pow(M.y,2)-Math.pow(v,2)*Math.pow(M.x,2))/(Math.pow(y,2)*Math.pow(M.y,2)+Math.pow(v,2)*Math.pow(M.x,2)),N=(i!==o?1:-1)*l(w=w<0?0:w),A=N*(y*M.y/v),C=N*(-v*M.x/y),S=h(x)*A-f(x)*C+(t+u)/2,k=f(x)*A+h(x)*C+(e+c)/2,P={x:(M.x-A)/y,y:(M.y-C)/v},T=rt({x:1,y:0},P),q=rt(P,{x:(-M.x-A)/y,y:(-M.y-C)/v});!o&&q>0?q-=2*p:o&&q<0&&(q+=2*p);var I=T+(q%=2*p)*s,O=y*h(I),V=v*f(I);return{x:h(x)*O-f(x)*V+S,y:f(x)*O+h(x)*V+k}}function at(t,e,r,n,a,i,o,u,c,s){var m,f="number"==typeof s,h=t,l=e,p=0,y=[h,l,p],v=[h,l],x={x:0,y:0},g=[{x:h,y:l}];f&&0===s&&(x={x:h,y:l});for(var d=0;d<=300;d+=1){if(h=(m=nt(t,e,r,n,a,i,o,u,c,d/300)).x,l=m.y,g=g.concat([{x:h,y:l}]),p+=T(v,[h,l]),v=[h,l],f&&p>s&&s>y[2]){var M=(p-s)/(p-y[2]);x={x:v[0]*(1-M)+y[0]*M,y:v[1]*(1-M)+y[1]*M}}y=[h,l,p]}return f&&s>=p&&(x={x:u,y:c}),{length:p,point:x,min:{x:Math.min.apply(Math,g.map((function(t){return t.x}))),y:Math.min.apply(Math,g.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,g.map((function(t){return t.x}))),y:Math.max.apply(Math,g.map((function(t){return t.y})))}}}function it(t,e,r,n,a,i,o,u,c){var s=1-c;return{x:Math.pow(s,3)*t+3*Math.pow(s,2)*c*r+3*s*Math.pow(c,2)*a+Math.pow(c,3)*o,y:Math.pow(s,3)*e+3*Math.pow(s,2)*c*n+3*s*Math.pow(c,2)*i+Math.pow(c,3)*u}}function ot(t,e,r,n,a,i,o,u,c){var s,m="number"==typeof c,f=t,h=e,l=0,p=[f,h,l],y=[f,h],v={x:0,y:0},x=[{x:f,y:h}];m&&0===c&&(v={x:f,y:h});for(var g=0;g<=300;g+=1){if(f=(s=it(t,e,r,n,a,i,o,u,g/300)).x,h=s.y,x=x.concat([{x:f,y:h}]),l+=T(y,[f,h]),y=[f,h],m&&l>c&&c>p[2]){var d=(l-c)/(l-p[2]);v={x:y[0]*(1-d)+p[0]*d,y:y[1]*(1-d)+p[1]*d}}p=[f,h,l]}return m&&c>=l&&(v={x:o,y:u}),{length:l,point:v,min:{x:Math.min.apply(Math,x.map((function(t){return t.x}))),y:Math.min.apply(Math,x.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,x.map((function(t){return t.x}))),y:Math.max.apply(Math,x.map((function(t){return t.y})))}}}function ut(t,e,r,n,a,i,o){var u=1-o;return{x:Math.pow(u,2)*t+2*u*o*r+Math.pow(o,2)*a,y:Math.pow(u,2)*e+2*u*o*n+Math.pow(o,2)*i}}function ct(t,e,r,n,a,i,o){var u,c="number"==typeof o,s=t,m=e,f=0,h=[s,m,f],l=[s,m],p={x:0,y:0},y=[{x:s,y:m}];c&&0===o&&(p={x:s,y:m});for(var v=0;v<=300;v+=1){if(s=(u=ut(t,e,r,n,a,i,v/300)).x,m=u.y,y=y.concat([{x:s,y:m}]),f+=T(l,[s,m]),l=[s,m],c&&f>o&&o>h[2]){var x=(f-o)/(f-h[2]);p={x:l[0]*(1-x)+h[0]*x,y:l[1]*(1-x)+h[1]*x}}h=[s,m,f]}return c&&o>=f&&(p={x:a,y:i}),{length:f,point:p,min:{x:Math.min.apply(Math,y.map((function(t){return t.x}))),y:Math.min.apply(Math,y.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,y.map((function(t){return t.x}))),y:Math.max.apply(Math,y.map((function(t){return t.y})))}}}function st(t,e){for(var r,n,a,i,o,u,c,s,m,f,h=w(t),l="number"==typeof e,p=[],y=0,v=0,x=0,g=0,d=[],M=[],b=0,N={x:0,y:0},A=N,C=N,S=N,k=0,P=0,T=h.length;P<T;P+=1)p=(s="M"===(m=(f=h[P])[0]))?p:[y,v].concat(f.slice(1)),s?(A=N={x:x=(r=f)[1],y:g=r[2]},b=0,l&&e<.001&&(S=N)):"L"===m?(b=(n=j.apply(void 0,p.concat([(e||0)-k]))).length,N=n.min,A=n.max,C=n.point):"A"===m?(b=(a=at.apply(void 0,p.concat([(e||0)-k]))).length,N=a.min,A=a.max,C=a.point):"C"===m?(b=(i=ot.apply(void 0,p.concat([(e||0)-k]))).length,N=i.min,A=i.max,C=i.point):"Q"===m?(b=(o=ct.apply(void 0,p.concat([(e||0)-k]))).length,N=o.min,A=o.max,C=o.point):"Z"===m&&(p=[y,v,x,g],b=(u=j.apply(void 0,p.concat([(e||0)-k]))).length,N=u.min,A=u.max,C=u.point),l&&k<e&&k+b>=e&&(S=C),M=M.concat([A]),d=d.concat([N]),k+=b,y=(c="Z"!==m?f.slice(-2):[x,g])[0],v=c[1];return l&&e>=k&&(S={x:y,y:v}),{length:k,point:S,min:{x:Math.min.apply(Math,d.map((function(t){return t.x}))),y:Math.min.apply(Math,d.map((function(t){return t.y})))},max:{x:Math.max.apply(Math,M.map((function(t){return t.x}))),y:Math.max.apply(Math,M.map((function(t){return t.y})))}}}function mt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=st(t),r=e.min,n=r.x,a=r.y,i=e.max,o=i.x,u=i.y,c=o-n,s=u-a;return{width:c,height:s,x:n,y:a,x2:o,y2:u,cx:n+c/2,cy:a+s/2,cz:Math.max(c,s)+Math.min(c,s)/2}}function ft(t){return st(t).length}function ht(t,e){return st(t,e).point}Object.assign($,{Version:"1.0.3"});var lt=function(e,r){var a=r||{},i=void 0===e;if(i||!e.length)throw TypeError(n+': "pathValue" is '+(i?"undefined":"empty"));var o=l(e);if("string"==typeof o)throw TypeError(o);this.segments=o;var u,c,s=this.getBBox(),m=s.width,f=s.height,h=s.cx,p=s.cy,y=s.cz,v=a.round,x=a.origin;if("auto"===v){var g=(""+Math.floor(Math.max(m,f))).length;u=g>=4?0:4-g}else u=Number.isInteger(v)||"off"===v?v:t.round;if(Array.isArray(x)&&x.length>=2){var d=x.map(Number),M=d[0],b=d[1],w=d[2];c=[Number.isNaN(M)?h:M,Number.isNaN(b)?p:b,Number.isNaN(w)?y:w]}else c=[h,p,y];return this.round=u,this.origin=c,this};function pt(t,e,r,n,a,i,o,u){return 3*((u-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+u*(a+t/3)-o*(i+e/3))/20}function yt(t){var e=0,r=0,n=0;return O(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=pt.apply(void 0,[e,r].concat(t.slice(1))),i=t.slice(-2),e=i[0],r=i[1],n}})).reduce((function(t,e){return t+e}),0)}function vt(t,e){var r=l(t);if("string"==typeof r)throw TypeError(r);var n=[].concat(r),a=ft(n),i=n.length-1,o=0,u=0,c=r[0],s=c.slice(-2),m={x:s[0],y:s[1]};if(i<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:m,lengthAtSegment:o};if(e>=a)return u=a-(o=ft(n=r.slice(0,-1))),{segment:r[i],index:i,length:u,lengthAtSegment:o};for(var f=[];i>0;)c=n[i],u=a-(o=ft(n=n.slice(0,-1))),a=o,f.push({segment:c,index:i,length:u,lengthAtSegment:o}),i-=1;return f.find((function(t){return t.lengthAtSegment<=e}))}function xt(t,e){for(var r=l(t),n=w(r),a=ft(r),i=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},o=8,u={x:0,y:0},c=0,s=u,m=0,f=1/0,h=0;h<=a;h+=o)(c=i(u=ht(n,h)))<f&&(s=u,m=h,f=c);o/=2;for(var p,y={x:0,y:0},v=0,x=0,g=0,d=0;o>.5;)g=i(y=ht(n,v=m-o)),d=i(p=ht(n,x=m+o)),v>=0&&g<f?(s=y,m=v,f=g):x<=a&&d<f?(s=p,m=x,f=d):o/=2;var M=vt(r,m);return{closest:s,distance:Math.sqrt(f),segment:M}}function gt(t){if("string"!=typeof t)return!1;var e=new f(t);for(u(e);e.index<e.max&&!e.err.length;)s(e);return!e.err.length&&"mM".includes(e.segments[0][0])}lt.prototype.getBBox=function(){return mt(this.segments)},lt.prototype.getTotalLength=function(){return ft(this.segments)},lt.prototype.getPointAtLength=function(t){return ht(this.segments,t)},lt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=y(t),this},lt.prototype.toRelative=function(){var t=this.segments;return this.segments=x(t),this},lt.prototype.toCurve=function(){var t=this.segments;return this.segments=O(t),this},lt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=z(e),n=r.length>1?r:0,a=n&&m(n).map((function(e,r){return t?r?E(e):l(e):E(e)})),i=[];return i=n?a.flat(1):t?e:E(e),this.segments=m(i),this},lt.prototype.normalize=function(){var t=this.segments;return this.segments=w(t),this},lt.prototype.optimize=function(){var t=this.segments;return this.segments=Q(t,this.round),this},lt.prototype.transform=function(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some((function(e){return e in t})))return this;var e={};Object.keys(t).forEach((function(r){e[r]=Array.isArray(t[r])?[].concat(t[r]):Number(t[r])}));var r=this.segments,n=this.origin,a=n[0],i=n[1],o=n[2],u=e.origin;if(Array.isArray(u)&&u.length>=2){var c=u.map(Number),s=c[0],m=c[1],f=c[2];e.origin=[Number.isNaN(s)?a:s,Number.isNaN(m)?i:m,f||o]}else e.origin=[a,i,o];return this.segments=et(r,e),this},lt.prototype.flipX=function(){return this.transform({rotate:[0,180,0]}),this},lt.prototype.flipY=function(){return this.transform({rotate:[180,0,0]}),this},lt.prototype.toString=function(){return L(this.segments,this.round)};var dt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};var Mt={CSSMatrix:$,parsePathString:l,isPathArray:h,isCurveArray:A,isAbsoluteArray:p,isRelativeArray:v,isNormalizedArray:M,isValidPath:gt,pathToAbsolute:y,pathToRelative:x,pathToCurve:O,pathToString:L,getDrawDirection:function(t){return yt(O(t))>=0},getPathArea:yt,getPathBBox:mt,pathLengthFactory:st,getTotalLength:ft,getPointAtLength:ht,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:vt,getSegmentAtLength:function(t,e){return vt(t,e).segment},isPointInStroke:function(t,e){var r=xt(t,e).distance;return Math.abs(r)<.001},clonePath:m,splitPath:z,fixPath:N,roundPath:V,optimizePath:Q,reverseCurve:function(t){var e=t.slice(1).map((function(e,r,n){return r?n[r-1].slice(-2).concat(e.slice(1)):t[0].slice(1).concat(e.slice(1))})).map((function(t){return t.map((function(e,r){return t[t.length-r-2*(1-r%2)]}))})).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map((function(t){return["C"].concat(t.slice(2))})))},reversePath:E,normalizePath:w,transformPath:et,shapeToPath:function(e,r){var a=Object.keys(dt),i=e.tagName;if(i&&!a.some((function(t){return i===t})))throw TypeError(n+': "'+i+'" is not SVGElement');var o=document.createElementNS("http://www.w3.org/2000/svg","path"),u=i||e.type,c={};c.type=u;var s,m=dt[u];i?(m.forEach((function(t){c[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;m.includes(e)||o.setAttribute(e,r)}))):(Object.assign(c,e),Object.keys(c).forEach((function(t){m.includes(t)||"type"===t||o.setAttribute(t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()})),c[t])})));var f,h,l,p,y=t.round;return"circle"===u?s=L((h=(f=c).cx,l=f.cy,p=f.r,[["M",h-p,l],["a",p,p,0,1,0,2*p,0],["a",p,p,0,1,0,-2*p,0]]),y):"ellipse"===u?s=L(function(t){var e=t.cx,r=t.cy,n=t.rx,a=t.ry;return[["M",e-n,r],["a",n,a,0,1,0,2*n,0],["a",n,a,0,1,0,-2*n,0]]}(c),y):["polyline","polygon"].includes(u)?s=L(function(t){for(var e=[],r=(t.points||"").trim().split(/[\s|,]/).map(Number),n=0;n<r.length;)e.push([n?"L":"M",r[n],r[n+1]]),n+=2;return"polygon"===t.type?e.concat([["z"]]):e}(c),y):"rect"===u?s=L(function(t){var e=+t.x||0,r=+t.y||0,n=+t.width,a=+t.height,i=+t.rx,o=+t.ry;return i||o?(i=i||o,o=o||i,2*i>n&&(i-=(2*i-n)/2),2*o>a&&(o-=(2*o-a)/2),[["M",e+i,r],["h",n-2*i],["s",i,0,i,o],["v",a-2*o],["s",0,o,-i,o],["h",2*i-n],["s",-i,0,-i,-o],["v",2*o-a],["s",0,-o,i,-o]]):[["M",e,r],["h",n],["v",a],["H",e],["Z"]]}(c),y):"line"===u?s=L(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(c),y):"glyph"===u&&(s=i?e.getAttribute("d"):e.d),!!gt(s)&&(o.setAttribute("d",s),r&&i&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(lt,Mt,{Version:"1.0.3"}),lt}));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander v1.0.2 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v1.0.3 (http://thednp.github.io/svg-path-commander)
3
3
  * Copyright 2022 © thednp
4
4
  * Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
5
5
  */
@@ -1156,7 +1156,7 @@ function reversePath(pathInput) {
1156
1156
  const segment = seg.seg;
1157
1157
  const data = seg.n;
1158
1158
  const prevSeg = i && path[i - 1];
1159
- const nextSeg = path[i + 1] && path[i + 1];
1159
+ const nextSeg = path[i + 1];
1160
1160
  const pathCommand = seg.c;
1161
1161
  const pLen = path.length;
1162
1162
  /** @type {number} */
@@ -1180,7 +1180,7 @@ function reversePath(pathInput) {
1180
1180
  }
1181
1181
  break;
1182
1182
  case 'S':
1183
- if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'S'))) {
1183
+ if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'S')) {
1184
1184
  result = ['C', data[3], data[4], data[1], data[2], x, y];
1185
1185
  } else {
1186
1186
  result = [pathCommand, data[1], data[2], x, y];
@@ -1194,7 +1194,7 @@ function reversePath(pathInput) {
1194
1194
  }
1195
1195
  break;
1196
1196
  case 'T':
1197
- if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'T'))) {
1197
+ if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'T')) {
1198
1198
  result = ['Q', data[1], data[2], x, y];
1199
1199
  } else {
1200
1200
  result = [pathCommand, x, y];
@@ -1887,7 +1887,7 @@ class CSSMatrix {
1887
1887
  m.m31 = 0; m.m32 = 0; m.m33 = 1; m.m34 = 0;
1888
1888
  m.m41 = 0; m.m42 = 0; m.m43 = 0; m.m44 = 1;
1889
1889
 
1890
- if (args && args.length) {
1890
+ if (args.length) {
1891
1891
  const ARGS = [16, 6].some((l) => l === args.length) ? args : args[0];
1892
1892
 
1893
1893
  return m.setMatrixValue(ARGS);
@@ -2187,9 +2187,7 @@ Object.assign(CSSMatrix, {
2187
2187
  toArray,
2188
2188
  });
2189
2189
 
2190
- var version$1 = "1.0.2";
2191
-
2192
- // @ts-ignore
2190
+ var version$1 = "1.0.3";
2193
2191
 
2194
2192
  /**
2195
2193
  * A global namespace for library version.
@@ -2197,6 +2195,8 @@ var version$1 = "1.0.2";
2197
2195
  */
2198
2196
  const Version$1 = version$1;
2199
2197
 
2198
+ /** @typedef {import('../types/index')} */
2199
+
2200
2200
  Object.assign(CSSMatrix, { Version: Version$1 });
2201
2201
 
2202
2202
  /**
@@ -2822,10 +2822,9 @@ function segmentQuadFactory(x1, y1, qx, qy, x2, y2, distance) {
2822
2822
  function pathLengthFactory(pathInput, distance) {
2823
2823
  const path = normalizePath(pathInput);
2824
2824
  const distanceIsNumber = typeof distance === 'number';
2825
- let isM = true;
2826
- /** @type {number[]} */
2825
+ let isM;
2827
2826
  let data = [];
2828
- let pathCommand = 'M';
2827
+ let pathCommand;
2829
2828
  let x = 0;
2830
2829
  let y = 0;
2831
2830
  let mx = 0;
@@ -3011,17 +3010,21 @@ class SVGPathCommander {
3011
3010
  } = this.getBBox();
3012
3011
 
3013
3012
  // set instance options.round
3014
- let { round, origin } = defaultOptions;
3015
3013
  const { round: roundOption, origin: originOption } = instanceOptions;
3014
+ let round;
3016
3015
 
3017
3016
  if (roundOption === 'auto') {
3018
3017
  const pathScale = (`${Math.floor(Math.max(width, height))}`).length;
3019
3018
  round = pathScale >= 4 ? 0 : 4 - pathScale;
3020
3019
  } else if (Number.isInteger(roundOption) || roundOption === 'off') {
3021
3020
  round = roundOption;
3021
+ } else {
3022
+ ({ round } = defaultOptions);
3022
3023
  }
3023
3024
 
3024
3025
  // set instance options.origin
3026
+ // the SVGPathCommander class will always override the default origin
3027
+ let origin;
3025
3028
  if (Array.isArray(originOption) && originOption.length >= 2) {
3026
3029
  const [originX, originY, originZ] = originOption.map(Number);
3027
3030
  origin = [
@@ -3033,10 +3036,9 @@ class SVGPathCommander {
3033
3036
  origin = [cx, cy, cz];
3034
3037
  }
3035
3038
 
3036
- /**
3037
- * @type {number | 'off'}
3038
- */
3039
+ /** @type {number | 'off'} */
3039
3040
  this.round = round;
3041
+ /** @type {[number, number, number=]} */
3040
3042
  this.origin = origin;
3041
3043
 
3042
3044
  return this;
@@ -3381,7 +3383,7 @@ function getPropertiesAtPoint(pathInput, point) {
3381
3383
  // binary search for precise estimate
3382
3384
  precision /= 2;
3383
3385
  let before = { x: 0, y: 0 };
3384
- let after = before;
3386
+ let after;
3385
3387
  let beforeLength = 0;
3386
3388
  let afterLength = 0;
3387
3389
  let beforeDistance = 0;
@@ -3699,12 +3701,6 @@ function reverseCurve(path) {
3699
3701
  ...rotatedCurve.map((x) => ['C', ...x.slice(2)])];
3700
3702
  }
3701
3703
 
3702
- /**
3703
- * Must have at least one import of the main namespace.
3704
- * @typedef {import('../../types/index')}
3705
- * @typedef {import('../types/index')}
3706
- */
3707
-
3708
3704
  /**
3709
3705
  * @interface
3710
3706
  */
@@ -3746,7 +3742,7 @@ const Util = {
3746
3742
  options: defaultOptions,
3747
3743
  };
3748
3744
 
3749
- var version = "1.0.2";
3745
+ var version = "1.0.3";
3750
3746
 
3751
3747
  /**
3752
3748
  * A global namespace for library version.
@@ -3754,6 +3750,8 @@ var version = "1.0.2";
3754
3750
  */
3755
3751
  const Version = version;
3756
3752
 
3753
+ /** @typedef {import('../types/index')} */
3754
+
3757
3755
  // Export to global
3758
3756
  Object.assign(SVGPathCommander, Util, { Version });
3759
3757
 
@@ -1,2 +1,2 @@
1
- // SVGPathCommander v1.0.2 | thednp © 2022 | MIT-License
2
- const t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function n(t){const n=t.pathValue[t.segmentStart],r=n.toLowerCase(),{data:s}=t;for(;s.length>=e[r]&&(t.segments.push([n,...s.splice(0,e[r])]),e[r]););}const r="SVGPathCommander error";function s(t){const{index:e,pathValue:n}=t,s=n.charCodeAt(e);return 48===s?(t.param=0,void(t.index+=1)):49===s?(t.param=1,void(t.index+=1)):void(t.err=`${r}: invalid Arc flag "${n[e]}", expecting 0 or 1 at index ${e}`)}function i(t){return t>=48&&t<=57}function a(t){const{max:e,pathValue:n,index:s}=t;let a,o=s,m=!1,c=!1,u=!1,l=!1;if(o>=e)t.err=`${r}: Invalid path value at index ${o}, "pathValue" is missing param`;else if(a=n.charCodeAt(o),43!==a&&45!==a||(o+=1,a=n.charCodeAt(o)),i(a)||46===a){if(46!==a){if(m=48===a,o+=1,a=n.charCodeAt(o),m&&o<e&&a&&i(a))return void(t.err=`${r}: Invalid path value at index ${s}, "${n[s]}" illegal number`);for(;o<e&&i(n.charCodeAt(o));)o+=1,c=!0;a=n.charCodeAt(o)}if(46===a){for(l=!0,o+=1;i(n.charCodeAt(o));)o+=1,u=!0;a=n.charCodeAt(o)}if(101===a||69===a){if(l&&!c&&!u)return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid float exponent`);if(o+=1,a=n.charCodeAt(o),43!==a&&45!==a||(o+=1),!(o<e&&i(n.charCodeAt(o))))return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid integer exponent`);for(;o<e&&i(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(s,o)}else t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" is not a number`}function o(t){const{pathValue:e,max:n}=t;for(;t.index<n&&(10===(r=e.charCodeAt(t.index))||13===r||8232===r||8233===r||32===r||9===r||11===r||12===r||160===r||r>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(r));)t.index+=1;var r}function m(t){return t>=48&&t<=57||43===t||45===t||46===t}function c(t){const{max:i,pathValue:c,index:u}=t,l=c.charCodeAt(u),h=e[c[u].toLowerCase()];if(t.segmentStart=u,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(l))if(t.index+=1,o(t),t.data=[],h){for(;;){for(let e=h;e>0;e-=1){if(97!=(32|l)||3!==e&&4!==e?a(t):s(t),t.err.length)return;t.data.push(t.param),o(t),t.index<i&&44===c.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!m(c.charCodeAt(t.index)))break}n(t)}else n(t);else t.err=`${r}: Invalid path value "${c[u]}" is not a path command`}function u(t){return t.map(t=>Array.isArray(t)?[...t]:t)}function l(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every(t=>{const n=t[0].toLowerCase();return e[n]===t.length-1&&"achlmqstvz".includes(n)})}function f(t){if(h(t))return u(t);const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return e.err?e.err:e.segments}function y(t){return h(t)&&t.every(([t])=>t===t.toUpperCase())}function x(t){if(y(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toUpperCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"A":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]+n,e[6]+r];break;case"V":m=[o,e[0]+r];break;case"H":m=[o,e[0]+n];break;default:m=[o,...e.map((t,e)=>t+(e%2?r:n))]}else m=[o,...e];const c=m.length;switch(o){case"Z":n=s,r=i;break;case"H":[,n]=m;break;case"V":[,r]=m;break;default:n=m[c-2],r=m[c-1],"M"===o&&(s=n,i=r)}return m})}function g(t){return h(t)&&t.slice(1).every(([t])=>t===t.toLowerCase())}function p(t){if(g(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toLowerCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"a":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]-n,e[6]-r];break;case"v":m=[o,e[0]-r];break;case"h":m=[o,e[0]-n];break;default:m=[o,...e.map((t,e)=>t-(e%2?r:n))]}else"m"===a&&(s=e[0]+n,i=e[1]+r),m=[o,...e];const c=m.length;switch(o){case"z":n=s,r=i;break;case"h":n+=m[1];break;case"v":r+=m[1];break;default:n+=m[c-2],r+=m[c-1]}return m})}function d(t,e,n){if(t[n].length>7){t[n].shift();const r=t[n];let s=n;for(;r.length;)e[n]="A",t.splice(s+=1,0,["C",...r.splice(0,6)]);t.splice(n,1)}}function M(t,e){const[n]=t,{x1:r,y1:s,x2:i,y2:a}=e,o=t.slice(1).map(Number);let m=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)m=["L",t[1],s];else if("V"===n)m=["L",r,t[1]];else if("S"===n){const t=2*r-i,n=2*s-a;e.x1=t,e.y1=n,m=["C",t,n,...o]}else if("T"===n){const t=2*r-e.qx,n=2*s-e.qy;e.qx=t,e.qy=n,m=["Q",t,n,...o]}else if("Q"===n){const[t,n]=o;e.qx=t,e.qy=n}return m}function b(t){return y(t)&&t.every(([t])=>"ACLMQZ".includes(t))}const N={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function A(t){if(b(t))return u(t);const e=x(t),n={...N},r=[],s=e.length;let i="";for(let t=0;t<s;t+=1){[i]=e[t],r[t]=i,e[t]=M(e[t],n);const s=e[t],a=s.length;n.x1=+s[a-2],n.y1=+s[a-1],n.x2=+s[a-4]||n.x1,n.y2=+s[a-3]||n.y1}return e}function v(t){const e=f(t),n=A(e),{length:r}=e,s="Z"===n.slice(-1)[0][0],i=s?r-2:r-1,[a,o]=n[0].slice(1),[m,c]=n[i].slice(-2);return s&&a===m&&o===c?e.slice(0,-1):e}function w(t){return b(t)&&t.every(([t])=>"MC".includes(t))}function C(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function S(t,e,n,r,s,i,a,o,m,c){let u=t,l=e,h=n,f=r,y=o,x=m;const g=120*Math.PI/180,p=Math.PI/180*(+s||0);let d,M,b,N,A,v=[];if(c)[M,b,N,A]=c;else{d=C(u,l,-p),u=d.x,l=d.y,d=C(y,x,-p),y=d.x,x=d.y;const t=(u-y)/2,e=(l-x)/2;let n=t*t/(h*h)+e*e/(f*f);n>1&&(n=Math.sqrt(n),h*=n,f*=n);const r=h*h,s=f*f,o=(i===a?-1:1)*Math.sqrt(Math.abs((r*s-r*e*e-s*t*t)/(r*e*e+s*t*t)));N=o*h*e/f+(u+y)/2,A=o*-f*t/h+(l+x)/2,M=(Math.asin((l-A)/f)*10**9>>0)/10**9,b=(Math.asin((x-A)/f)*10**9>>0)/10**9,M=u<N?Math.PI-M:M,b=y<N?Math.PI-b:b,M<0&&(M=2*Math.PI+M),b<0&&(b=2*Math.PI+b),a&&M>b&&(M-=2*Math.PI),!a&&b>M&&(b-=2*Math.PI)}let w=b-M;if(Math.abs(w)>g){const t=b,e=y,n=x;b=M+g*(a&&b>M?1:-1),y=N+h*Math.cos(b),x=A+f*Math.sin(b),v=S(y,x,h,f,s,0,a,e,n,[b,t,N,A])}w=b-M;const k=Math.cos(M),P=Math.sin(M),T=Math.cos(b),$=Math.sin(b),q=Math.tan(w/4),I=4/3*h*q,V=4/3*f*q,L=[u,l],j=[u+I*P,l-V*k],O=[y+I*$,x-V*T],E=[y,x];if(j[0]=2*L[0]-j[0],j[1]=2*L[1]-j[1],c)return[...j,...O,...E,...v];v=[...j,...O,...E,...v];const z=[];for(let t=0,e=v.length;t<e;t+=1)z[t]=t%2?C(v[t-1],v[t],p).y:C(v[t],v[t+1],p).x;return z}function k(t,e,n,r,s,i){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*s+2/3*n,1/3*i+2/3*r,s,i]}function P(t,e,n){const[r,s]=t,[i,a]=e;return[r+(i-r)*n,s+(a-s)*n]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function $(t,e,n,r,s){const i=T([t,e],[n,r]);let a={x:0,y:0};if("number"==typeof s)if(0===s)a={x:t,y:e};else if(s>=i)a={x:n,y:r};else{const[o,m]=P([t,e],[n,r],s/i);a={x:o,y:m}}return{length:i,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function q(t,e,n,r){const s=.5,i=[t,e],a=[n,r],o=P(i,a,s),m=P(a,o,s),c=P(o,m,s),u=P(m,c,s),l=P(c,u,s),h=$(...[...i,...o,...c,...l,s]).point,f=$(...[...l,...u,...m,...a,0]).point;return[h.x,h.y,f.x,f.y,n,r]}function I(t,e){const[n]=t,r=t.slice(1).map(Number),[s,i]=r;let a;const{x1:o,y1:m,x:c,y:u}=e;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=s,e.y=i,t;case"A":return a=[o,m,...r],["C",...S(...a)];case"Q":return e.qx=s,e.qy=i,a=[o,m,...r],["C",...k(...a)];case"L":return["C",...q(o,m,s,i)];case"Z":return["C",...q(o,m,c,u)]}return t}function V(t){if(w(t))return u(t);const e=v(A(t)),n={...N},r=[];let s="",i=e.length;for(let t=0;t<i;t+=1){[s]=e[t],r[t]=s,e[t]=I(e[t],n),d(e,r,t),i=e.length;const a=e[t],o=a.length;n.x1=+a[o-2],n.y1=+a[o-1],n.x2=+a[o-4]||n.x1,n.y2=+a[o-3]||n.y1}return e}function L(e,n){let{round:r}=t;if("off"===n||"off"===r)return u(e);r=n>=0?n:r;const s="number"==typeof r&&r>=1?10**r:1;return e.map(t=>{const e=t.slice(1).map(Number).map(t=>r?Math.round(t*s)/s:Math.round(t));return[t[0],...e]})}function j(t,e){return L(t,e).map(t=>t[0]+t.slice(1).join(" ")).join("")}function O(t){const e=x(t),n="Z"===e.slice(-1)[0][0],r=A(e).map((t,n)=>{const[r,s]=t.slice(-2).map(Number);return{seg:e[n],n:t,c:e[n][0],x:r,y:s}}).map((t,e,r)=>{const s=t.seg,i=t.n,a=e&&r[e-1],o=r[e+1]&&r[e+1],m=t.c,c=r.length,u=e?r[e-1].x:r[c-1].x,l=e?r[e-1].y:r[c-1].y;let h=[];switch(m){case"M":h=n?["Z"]:[m,u,l];break;case"A":h=[m,...s.slice(1,-3),1===s[5]?0:1,u,l];break;case"C":h=o&&"S"===o.c?["S",s[1],s[2],u,l]:[m,s[3],s[4],s[1],s[2],u,l];break;case"S":h=a&&"CS".includes(a.c)&&(!o||o&&"S"!==o.c)?["C",i[3],i[4],i[1],i[2],u,l]:[m,i[1],i[2],u,l];break;case"Q":h=o&&"T"===o.c?["T",u,l]:[m,...s.slice(1,-2),u,l];break;case"T":h=a&&"QT".includes(a.c)&&(!o||o&&"T"!==o.c)?["Q",i[1],i[2],u,l]:[m,u,l];break;case"Z":h=["M",u,l];break;case"H":h=[m,u];break;case"V":h=[m,l];break;default:h=[m,...s.slice(1,-2),u,l]}return h});return n?r.reverse():[r[0],...r.slice(1).reverse()]}function E(t){const e=[];let n,r=-1;return t.forEach(t=>{"M"===t[0]?(n=[t],r+=1):n=[...n,t],e[r]=n}),e}function z(t,e,n,r){const[s]=t,i=t=>Math.round(1e4*t)/1e4,a=t.slice(1).map(t=>+t),o=e.slice(1).map(t=>+t),{x1:m,y1:c,x2:u,y2:l,x:h,y:f}=n;let y=t;const[x,g]=o.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))y=[s,...a];else if("L"===s)i(h)===i(x)?y=["V",g]:i(f)===i(g)&&(y=["H",x]);else if("C"===s){const[t,e]=o;"CS".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["S",...o.slice(-4)]),n.x1=t,n.y1=e}else if("Q"===s){const[t,e]=o;n.qx=t,n.qy=e,"QT".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["T",...o.slice(-2)])}return y}function Z(t,e){const n=x(t),r=A(n),s={...N},i=[],a=n.length;let o="",m="",c=0,u=0,l=0,h=0;for(let t=0;t<a;t+=1){[o]=n[t],i[t]=o,t&&(m=i[t-1]),n[t]=z(n[t],r[t],s,m);const e=n[t],a=e.length;switch(s.x1=+e[a-2],s.y1=+e[a-1],s.x2=+e[a-4]||s.x1,s.y2=+e[a-3]||s.y1,o){case"Z":c=l,u=h;break;case"H":[,c]=e;break;case"V":[,u]=e;break;default:[c,u]=e.slice(-2).map(Number),"M"===o&&(l=c,h=u)}s.x=c,s.y=u}const f=L(n,e),y=L(p(n),e);return f.map((t,e)=>e?t.join("").length<y[e].join("").length?t:y[e]:t)}function Q(t){const e=new W,n=Array.from(t);if(!n.every(t=>!Number.isNaN(t)))throw TypeError(`CSSMatrix: "${t}" must only have numbers.`);if(16===n.length){const[t,r,s,i,a,o,m,c,u,l,h,f,y,x,g,p]=n;e.m11=t,e.a=t,e.m21=a,e.c=a,e.m31=u,e.m41=y,e.e=y,e.m12=r,e.b=r,e.m22=o,e.d=o,e.m32=l,e.m42=x,e.f=x,e.m13=s,e.m23=m,e.m33=h,e.m43=g,e.m14=i,e.m24=c,e.m34=f,e.m44=p}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");{const[t,r,s,i,a,o]=n;e.m11=t,e.a=t,e.m12=r,e.b=r,e.m21=s,e.c=s,e.m22=i,e.d=i,e.m41=a,e.e=a,e.m42=o,e.f=o}}return e}function F(t){const e=Object.keys(new W);if("object"==typeof t&&e.every(e=>e in t))return Q([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(t)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)}function D(t){if("string"!=typeof t)throw TypeError(`CSSMatrix: "${t}" is not a string.`);const e=String(t).replace(/\s/g,"");let n=new W;const r=`CSSMatrix: invalid transform string "${t}"`;return e.split(")").filter(t=>t).forEach(t=>{const[e,s]=t.split("(");if(!s)throw TypeError(r);const i=s.split(",").map(t=>t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)),[a,o,m,c]=i,u=[a,o,m],l=[a,o,m,c];if("perspective"===e&&a&&[o,m].every(t=>void 0===t))n.m34=-1/a;else if(e.includes("matrix")&&[6,16].includes(i.length)&&i.every(t=>!Number.isNaN(+t))){const t=i.map(t=>Math.abs(t)<1e-6?0:t);n=n.multiply(Q(t))}else if("translate3d"===e&&u.every(t=>!Number.isNaN(+t)))n=n.translate(a,o,m);else if("translate"===e&&a&&void 0===m)n=n.translate(a,o||0,0);else if("rotate3d"===e&&l.every(t=>!Number.isNaN(+t))&&c)n=n.rotateAxisAngle(a,o,m,c);else if("rotate"===e&&a&&[o,m].every(t=>void 0===t))n=n.rotate(0,0,a);else if("scale3d"===e&&u.every(t=>!Number.isNaN(+t))&&u.some(t=>1!==t))n=n.scale(a,o,m);else if("scale"!==e||Number.isNaN(a)||1===a||void 0!==m)if("skew"===e&&(a||!Number.isNaN(a)&&o)&&void 0===m)n=n.skew(a,o||0);else{if(!(/[XYZ]/.test(e)&&a&&[o,m].every(t=>void 0===t)&&["translate","rotate","scale","skew"].some(t=>e.includes(t))))throw TypeError(r);if(["skewX","skewY"].includes(e))n=n[e](a);else{const t=e.replace(/[XYZ]/,""),r=e.replace(t,""),s=["X","Y","Z"].indexOf(r),i="scale"===t?1:0,o=[0===s?a:i,1===s?a:i,2===s?a:i];n=n[t](...o)}}else{const t=Number.isNaN(+o)?a:o;n=n.scale(a,t,1)}}),n}function H(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function X(t,e,n){const r=new W;return r.m41=t,r.e=t,r.m42=e,r.f=e,r.m43=n,r}function Y(t,e,n){const r=new W,s=Math.PI/180,i=t*s,a=e*s,o=n*s,m=Math.cos(i),c=-Math.sin(i),u=Math.cos(a),l=-Math.sin(a),h=Math.cos(o),f=-Math.sin(o),y=u*h,x=-u*f;r.m11=y,r.a=y,r.m12=x,r.b=x,r.m13=l;const g=c*l*h+m*f;r.m21=g,r.c=g;const p=m*h-c*l*f;return r.m22=p,r.d=p,r.m23=-c*u,r.m31=c*f-m*l*h,r.m32=c*h+m*l*f,r.m33=m*u,r}function B(t,e,n,r){const s=new W,i=Math.sqrt(t*t+e*e+n*n);if(0===i)return s;const a=t/i,o=e/i,m=n/i,c=r*(Math.PI/360),u=Math.sin(c),l=Math.cos(c),h=u*u,f=a*a,y=o*o,x=m*m,g=1-2*(y+x)*h;s.m11=g,s.a=g;const p=2*(a*o*h+m*u*l);s.m12=p,s.b=p,s.m13=2*(a*m*h-o*u*l);const d=2*(o*a*h-m*u*l);s.m21=d,s.c=d;const M=1-2*(x+f)*h;return s.m22=M,s.d=M,s.m23=2*(o*m*h+a*u*l),s.m31=2*(m*a*h+o*u*l),s.m32=2*(m*o*h-a*u*l),s.m33=1-2*(f+y)*h,s}function R(t,e,n){const r=new W;return r.m11=t,r.a=t,r.m22=e,r.d=e,r.m33=n,r}function J(t,e){const n=new W;if(t){const e=t*Math.PI/180,r=Math.tan(e);n.m21=r,n.c=r}if(e){const t=e*Math.PI/180,r=Math.tan(t);n.m12=r,n.b=r}return n}function G(t){return J(t,0)}function U(t){return J(0,t)}function K(t,e){return Q([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}class W{constructor(...t){const e=this;if(e.a=1,e.b=0,e.c=0,e.d=1,e.e=0,e.f=0,e.m11=1,e.m12=0,e.m13=0,e.m14=0,e.m21=0,e.m22=1,e.m23=0,e.m24=0,e.m31=0,e.m32=0,e.m33=1,e.m34=0,e.m41=0,e.m42=0,e.m43=0,e.m44=1,t&&t.length){const n=[16,6].some(e=>e===t.length)?t:t[0];return e.setMatrixValue(n)}return e}get isIdentity(){const t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44}get is2D(){const t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44}setMatrixValue(t){return"string"==typeof t&&t.length&&"none"!==t?D(t):[Array,Float64Array,Float32Array].some(e=>t instanceof e)?Q(t):[W,DOMMatrix,Object].some(e=>t instanceof e)?F(t):this}toFloat32Array(t){return Float32Array.from(H(this,t))}toFloat64Array(t){return Float64Array.from(H(this,t))}toString(){const{is2D:t}=this;return`${t?"matrix":"matrix3d"}(${this.toFloat64Array(t).join(", ")})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return K(this,t)}translate(t,e,n){let r=e,s=n;return void 0===r&&(r=0),void 0===s&&(s=0),K(this,X(t,r,s))}scale(t,e,n){let r=e,s=n;return void 0===r&&(r=t),void 0===s&&(s=1),K(this,R(t,r,s))}rotate(t,e,n){let r=t,s=e||0,i=n||0;return"number"==typeof t&&void 0===e&&void 0===n&&(i=r,r=0,s=0),K(this,Y(r,s,i))}rotateAxisAngle(t,e,n,r){if([t,e,n,r].some(t=>Number.isNaN(+t)))throw new TypeError("CSSMatrix: expecting 4 values");return K(this,B(t,e,n,r))}skewX(t){return K(this,G(t))}skewY(t){return K(this,U(t))}skew(t,e){return K(this,J(t,e))}transformPoint(t){const e=this,n=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,r=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,s=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}Object.assign(W,{Translate:X,Rotate:Y,RotateAxisAngle:B,Scale:R,SkewX:G,SkewY:U,Skew:J,Multiply:K,fromArray:Q,fromMatrix:F,fromString:D,toArray:H});function _(t,e,n){const[r,s,i]=n,[a,o,m]=function(t,e){let n=X(...e);return[,,,n.m44]=e,n=t.multiply(n),[n.m41,n.m42,n.m43,n.m44]}(t,[...e,0,1]),c=o-s,u=m-i;return[(a-r)*(Math.abs(i)/Math.abs(u)||1)+r,c*(Math.abs(i)/Math.abs(u)||1)+s]}function tt(e,n){let r,s,i,a,o,m,c=0,l=0;const h=x(e),f=n&&Object.keys(n);if(!n||!f.length)return u(h);const y=A(h);if(!n.origin){const{origin:e}=t;Object.assign(n,{origin:e})}const g=function(t){let e=new W;const{origin:n}=t,[r,s]=n,{translate:i}=t,{rotate:a}=t,{skew:o}=t,{scale:m}=t;return Array.isArray(i)&&i.every(t=>!Number.isNaN(+t))&&i.some(t=>0!==t)?e=e.translate(...i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(a||o||m)&&(e=e.translate(r,s),Array.isArray(a)&&a.every(t=>!Number.isNaN(+t))&&a.some(t=>0!==t)?e=e.rotate(...a):"number"!=typeof a||Number.isNaN(a)||(e=e.rotate(a)),Array.isArray(o)&&o.every(t=>!Number.isNaN(+t))&&o.some(t=>0!==t)?(e=o[0]?e.skewX(o[0]):e,e=o[1]?e.skewY(o[1]):e):"number"!=typeof o||Number.isNaN(o)||(e=e.skewX(o)),Array.isArray(m)&&m.every(t=>!Number.isNaN(+t))&&m.some(t=>1!==t)?e=e.scale(...m):"number"!=typeof m||Number.isNaN(m)||(e=e.scale(m)),e=e.translate(-r,-s)),e}(n),{origin:p}=n,M={...N};let b=[],v=0,w="",C=[];const S=[];if(!g.isIdentity){for(r=0,i=h.length;r<i;r+=1){b=h[r],h[r]&&([w]=b),S[r]=w,"A"===w&&(b=I(y[r],M),h[r]=I(y[r],M),d(h,S,r),y[r]=I(y[r],M),d(y,S,r),i=Math.max(h.length,y.length)),b=y[r],v=b.length,M.x1=+b[v-2],M.y1=+b[v-1],M.x2=+b[v-4]||M.x1,M.y2=+b[v-3]||M.y1;const t={s:h[r],c:h[r][0],x:M.x1,y:M.y1};C=[...C,t]}return C.map(t=>{switch(w=t.c,b=t.s,w){case"L":case"H":case"V":return[o,m]=_(g,[t.x,t.y],p),c!==o&&l!==m?b=["L",o,m]:l===m?b=["H",o]:c===o&&(b=["V",m]),c=o,l=m,b;default:for(s=1,a=b.length;s<a;s+=2)[c,l]=_(g,[+b[s],+b[s+1]],p),b[s]=c,b[s+1]=l;return b}})}return u(h)}function et(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,a=n*s+r*i,o=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(a/o)}function nt(t,e,n,r,s,i,a,o,m,c){const{abs:u,sin:l,cos:h,sqrt:f,PI:y}=Math;let x=u(n),g=u(r);const p=(s%360+360)%360*(y/180);if(t===o&&e===m)return{x:t,y:e};if(0===x||0===g)return $(t,e,o,m,c).point;const d=(t-o)/2,M=(e-m)/2,b=h(p)*d+l(p)*M,N=-l(p)*d+h(p)*M,A=b**2/x**2+N**2/g**2;A>1&&(x*=f(A),g*=f(A));let v=(x**2*g**2-x**2*N**2-g**2*b**2)/(x**2*N**2+g**2*b**2);v=v<0?0:v;const w=(i!==a?1:-1)*f(v),C=w*(x*N/g),S=w*(-g*b/x),k=h(p)*C-l(p)*S+(t+o)/2,P=l(p)*C+h(p)*S+(e+m)/2,T={x:(b-C)/x,y:(N-S)/g},q=et({x:1,y:0},T);let I=et(T,{x:(-b-C)/x,y:(-N-S)/g});!a&&I>0?I-=2*y:a&&I<0&&(I+=2*y),I%=2*y;const V=q+I*c,L=x*h(V),j=g*l(V);return{x:h(p)*L-l(p)*j+k,y:l(p)*L+h(p)*j+P}}function rt(t,e,n,r,s,i,a,o,m,c){const u="number"==typeof c;let l=t,h=e,f=0,y=[l,h,f],x=[l,h],g=0,p={x:0,y:0},d=[{x:l,y:h}];u&&0===c&&(p={x:l,y:h});for(let M=0;M<=300;M+=1){if(g=M/300,({x:l,y:h}=nt(t,e,n,r,s,i,a,o,m,g)),d=[...d,{x:l,y:h}],f+=T(x,[l,h]),x=[l,h],u&&f>c&&c>y[2]){const t=(f-c)/(f-y[2]);p={x:x[0]*(1-t)+y[0]*t,y:x[1]*(1-t)+y[1]*t}}y=[l,h,f]}return u&&c>=f&&(p={x:o,y:m}),{length:f,point:p,min:{x:Math.min(...d.map(t=>t.x)),y:Math.min(...d.map(t=>t.y))},max:{x:Math.max(...d.map(t=>t.x)),y:Math.max(...d.map(t=>t.y))}}}function st(t,e,n,r,s,i,a,o,m){const c=1-m;return{x:c**3*t+3*c**2*m*n+3*c*m**2*s+m**3*a,y:c**3*e+3*c**2*m*r+3*c*m**2*i+m**3*o}}function it(t,e,n,r,s,i,a,o,m){const c="number"==typeof m;let u=t,l=e,h=0,f=[u,l,h],y=[u,l],x=0,g={x:0,y:0},p=[{x:u,y:l}];c&&0===m&&(g={x:u,y:l});for(let d=0;d<=300;d+=1){if(x=d/300,({x:u,y:l}=st(t,e,n,r,s,i,a,o,x)),p=[...p,{x:u,y:l}],h+=T(y,[u,l]),y=[u,l],c&&h>m&&m>f[2]){const t=(h-m)/(h-f[2]);g={x:y[0]*(1-t)+f[0]*t,y:y[1]*(1-t)+f[1]*t}}f=[u,l,h]}return c&&m>=h&&(g={x:a,y:o}),{length:h,point:g,min:{x:Math.min(...p.map(t=>t.x)),y:Math.min(...p.map(t=>t.y))},max:{x:Math.max(...p.map(t=>t.x)),y:Math.max(...p.map(t=>t.y))}}}function at(t,e,n,r,s,i,a){const o=1-a;return{x:o**2*t+2*o*a*n+a**2*s,y:o**2*e+2*o*a*r+a**2*i}}function ot(t,e,n,r,s,i,a){const o="number"==typeof a;let m=t,c=e,u=0,l=[m,c,u],h=[m,c],f=0,y={x:0,y:0},x=[{x:m,y:c}];o&&0===a&&(y={x:m,y:c});for(let g=0;g<=300;g+=1){if(f=g/300,({x:m,y:c}=at(t,e,n,r,s,i,f)),x=[...x,{x:m,y:c}],u+=T(h,[m,c]),h=[m,c],o&&u>a&&a>l[2]){const t=(u-a)/(u-l[2]);y={x:h[0]*(1-t)+l[0]*t,y:h[1]*(1-t)+l[1]*t}}l=[m,c,u]}return o&&a>=u&&(y={x:s,y:i}),{length:u,point:y,min:{x:Math.min(...x.map(t=>t.x)),y:Math.min(...x.map(t=>t.y))},max:{x:Math.max(...x.map(t=>t.x)),y:Math.max(...x.map(t=>t.y))}}}function mt(t,e){const n=A(t),r="number"==typeof e;let s,i=!0,a=[],o="M",m=0,c=0,u=0,l=0,h=[],f=[],y=0,x={x:0,y:0},g=x,p=x,d=x,M=0;for(let t=0,b=n.length;t<b;t+=1)s=n[t],[o]=s,i="M"===o,a=i?a:[m,c,...s.slice(1)],i?([,u,l]=s,x={x:u,y:l},g=x,y=0,r&&e<.001&&(d=x)):"L"===o?({length:y,min:x,max:g,point:p}=$(...a,(e||0)-M)):"A"===o?({length:y,min:x,max:g,point:p}=rt(...a,(e||0)-M)):"C"===o?({length:y,min:x,max:g,point:p}=it(...a,(e||0)-M)):"Q"===o?({length:y,min:x,max:g,point:p}=ot(...a,(e||0)-M)):"Z"===o&&(a=[m,c,u,l],({length:y,min:x,max:g,point:p}=$(...a,(e||0)-M))),r&&M<e&&M+y>=e&&(d=p),f=[...f,g],h=[...h,x],M+=y,[m,c]="Z"!==o?s.slice(-2):[u,l];return r&&e>=M&&(d={x:m,y:c}),{length:M,point:d,min:{x:Math.min(...h.map(t=>t.x)),y:Math.min(...h.map(t=>t.y))},max:{x:Math.max(...f.map(t=>t.x)),y:Math.max(...f.map(t=>t.y))}}}function ct(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const{min:{x:e,y:n},max:{x:r,y:s}}=mt(t),i=r-e,a=s-n;return{width:i,height:a,x:e,y:n,x2:r,y2:s,cx:e+i/2,cy:n+a/2,cz:Math.max(i,a)+Math.min(i,a)/2}}function ut(t){return mt(t).length}function lt(t,e){return mt(t,e).point}Object.assign(W,{Version:"1.0.2"});class ht{constructor(e,n){const s=n||{},i=void 0===e;if(i||!e.length)throw TypeError(`${r}: "pathValue" is ${i?"undefined":"empty"}`);const a=f(e);if("string"==typeof a)throw TypeError(a);this.segments=a;const{width:o,height:m,cx:c,cy:u,cz:l}=this.getBBox();let{round:h,origin:y}=t;const{round:x,origin:g}=s;if("auto"===x){const t=(""+Math.floor(Math.max(o,m))).length;h=t>=4?0:4-t}else(Number.isInteger(x)||"off"===x)&&(h=x);if(Array.isArray(g)&&g.length>=2){const[t,e,n]=g.map(Number);y=[Number.isNaN(t)?c:t,Number.isNaN(e)?u:e,Number.isNaN(n)?l:n]}else y=[c,u,l];return this.round=h,this.origin=y,this}getBBox(){return ct(this.segments)}getTotalLength(){return ut(this.segments)}getPointAtLength(t){return lt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=x(t),this}toRelative(){const{segments:t}=this;return this.segments=p(t),this}toCurve(){const{segments:t}=this;return this.segments=V(t),this}reverse(t){this.toAbsolute();const{segments:e}=this,n=E(e),r=n.length>1?n:0,s=r&&u(r).map((e,n)=>t?n?O(e):f(e):O(e));let i=[];return i=r?s.flat(1):t?e:O(e),this.segments=u(i),this}normalize(){const{segments:t}=this;return this.segments=A(t),this}optimize(){const{segments:t}=this;return this.segments=Z(t,this.round),this}transform(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some(e=>e in t))return this;const e={};Object.keys(t).forEach(n=>{e[n]=Array.isArray(t[n])?[...t[n]]:Number(t[n])});const{segments:n}=this,[r,s,i]=this.origin,{origin:a}=e;if(Array.isArray(a)&&a.length>=2){const[t,n,o]=a.map(Number);e.origin=[Number.isNaN(t)?r:t,Number.isNaN(n)?s:n,o||i]}else e.origin=[r,s,i];return this.segments=tt(n,e),this}flipX(){return this.transform({rotate:[0,180,0]}),this}flipY(){return this.transform({rotate:[180,0,0]}),this}toString(){return j(this.segments,this.round)}}function ft(t){let e=0,n=0,r=0;return V(t).map(t=>{switch(t[0]){case"M":return[,e,n]=t,0;default:return r=function(t,e,n,r,s,i,a,o){return 3*((o-e)*(n+s)-(a-t)*(r+i)+r*(t-s)-n*(e-i)+o*(s+t/3)-a*(i+e/3))/20}(e,n,...t.slice(1)),[e,n]=t.slice(-2),r}}).reduce((t,e)=>t+e,0)}function yt(t,e){const n=f(t);if("string"==typeof n)throw TypeError(n);let r=[...n],s=ut(r),i=r.length-1,a=0,o=0,m=n[0];const[c,u]=m.slice(-2),l={x:c,y:u};if(i<=0||!e||!Number.isFinite(e))return{segment:m,index:0,length:o,point:l,lengthAtSegment:a};if(e>=s)return r=n.slice(0,-1),a=ut(r),o=s-a,{segment:n[i],index:i,length:o,lengthAtSegment:a};const h=[];for(;i>0;)m=r[i],r=r.slice(0,-1),a=ut(r),o=s-a,s=a,h.push({segment:m,index:i,length:o,lengthAtSegment:a}),i-=1;return h.find(({lengthAtSegment:t})=>t<=e)}function xt(t,e){const n=f(t),r=A(n),s=ut(n),i=t=>{const n=t.x-e.x,r=t.y-e.y;return n*n+r*r};let a=8,o={x:0,y:0},m=0,c=o,u=0,l=1/0;for(let t=0;t<=s;t+=a)o=lt(r,t),m=i(o),m<l&&(c=o,u=t,l=m);a/=2;let h={x:0,y:0},y=h,x=0,g=0,p=0,d=0;for(;a>.5;)x=u-a,h=lt(r,x),p=i(h),g=u+a,y=lt(r,g),d=i(y),x>=0&&p<l?(c=h,u=x,l=p):g<=s&&d<l?(c=y,u=g,l=d):a/=2;const M=yt(n,u);return{closest:c,distance:Math.sqrt(l),segment:M}}function gt(t){if("string"!=typeof t)return!1;const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return!e.err.length&&"mM".includes(e.segments[0][0])}const pt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};const dt={CSSMatrix:W,parsePathString:f,isPathArray:h,isCurveArray:w,isAbsoluteArray:y,isRelativeArray:g,isNormalizedArray:b,isValidPath:gt,pathToAbsolute:x,pathToRelative:p,pathToCurve:V,pathToString:j,getDrawDirection:function(t){return ft(V(t))>=0},getPathArea:ft,getPathBBox:ct,pathLengthFactory:mt,getTotalLength:ut,getPointAtLength:lt,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:yt,getSegmentAtLength:function(t,e){return yt(t,e).segment},isPointInStroke:function(t,e){const{distance:n}=xt(t,e);return Math.abs(n)<.001},clonePath:u,splitPath:E,fixPath:v,roundPath:L,optimizePath:Z,reverseCurve:function(t){const e=t.slice(1).map((e,n,r)=>n?[...r[n-1].slice(-2),...e.slice(1)]:[...t[0].slice(1),...e.slice(1)]).map(t=>t.map((e,n)=>t[t.length-n-2*(1-n%2)])).reverse();return[["M",...e[0].slice(0,2)],...e.map(t=>["C",...t.slice(2)])]},reversePath:O,normalizePath:A,transformPath:tt,shapeToPath:function(e,n){const s=Object.keys(pt),{tagName:i}=e;if(i&&!s.some(t=>i===t))throw TypeError(`${r}: "${i}" is not SVGElement`);const a=document.createElementNS("http://www.w3.org/2000/svg","path"),o=i||e.type,m={};m.type=o;const c=pt[o];let u;i?(c.forEach(t=>{m[t]=e.getAttribute(t)}),Object.values(e.attributes).forEach(({name:t,value:e})=>{c.includes(t)||a.setAttribute(t,e)})):(Object.assign(m,e),Object.keys(m).forEach(t=>{c.includes(t)||"type"===t||a.setAttribute(t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),m[t])}));const{round:l}=t;return"circle"===o?u=j(function(t){const{cx:e,cy:n,r:r}=t;return[["M",e-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]}(m),l):"ellipse"===o?u=j(function(t){const{cx:e,cy:n,rx:r,ry:s}=t;return[["M",e-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]}(m),l):["polyline","polygon"].includes(o)?u=j(function(t){const e=[],n=(t.points||"").trim().split(/[\s|,]/).map(Number);let r=0;for(;r<n.length;)e.push([r?"L":"M",n[r],n[r+1]]),r+=2;return"polygon"===t.type?[...e,["z"]]:e}(m),l):"rect"===o?u=j(function(t){const e=+t.x||0,n=+t.y||0,r=+t.width,s=+t.height;let i=+t.rx,a=+t.ry;return i||a?(i=i||a,a=a||i,2*i>r&&(i-=(2*i-r)/2),2*a>s&&(a-=(2*a-s)/2),[["M",e+i,n],["h",r-2*i],["s",i,0,i,a],["v",s-2*a],["s",0,a,-i,a],["h",2*i-r],["s",-i,0,-i,-a],["v",2*a-s],["s",0,-a,i,-a]]):[["M",e,n],["h",r],["v",s],["H",e],["Z"]]}(m),l):"line"===o?u=j(function(t){const{x1:e,y1:n,x2:r,y2:s}=t;return[["M",e,n],["L",r,s]]}(m),l):"glyph"===o&&(u=i?e.getAttribute("d"):e.d),!!gt(u)&&(a.setAttribute("d",u),n&&i&&(e.before(a,e),e.remove()),a)},options:t};Object.assign(ht,dt,{Version:"1.0.2"});export{ht as default};
1
+ // SVGPathCommander v1.0.3 | thednp © 2022 | MIT-License
2
+ const t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function n(t){const n=t.pathValue[t.segmentStart],r=n.toLowerCase(),{data:s}=t;for(;s.length>=e[r]&&(t.segments.push([n,...s.splice(0,e[r])]),e[r]););}const r="SVGPathCommander error";function s(t){const{index:e,pathValue:n}=t,s=n.charCodeAt(e);return 48===s?(t.param=0,void(t.index+=1)):49===s?(t.param=1,void(t.index+=1)):void(t.err=`${r}: invalid Arc flag "${n[e]}", expecting 0 or 1 at index ${e}`)}function i(t){return t>=48&&t<=57}function a(t){const{max:e,pathValue:n,index:s}=t;let a,o=s,m=!1,c=!1,u=!1,l=!1;if(o>=e)t.err=`${r}: Invalid path value at index ${o}, "pathValue" is missing param`;else if(a=n.charCodeAt(o),43!==a&&45!==a||(o+=1,a=n.charCodeAt(o)),i(a)||46===a){if(46!==a){if(m=48===a,o+=1,a=n.charCodeAt(o),m&&o<e&&a&&i(a))return void(t.err=`${r}: Invalid path value at index ${s}, "${n[s]}" illegal number`);for(;o<e&&i(n.charCodeAt(o));)o+=1,c=!0;a=n.charCodeAt(o)}if(46===a){for(l=!0,o+=1;i(n.charCodeAt(o));)o+=1,u=!0;a=n.charCodeAt(o)}if(101===a||69===a){if(l&&!c&&!u)return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid float exponent`);if(o+=1,a=n.charCodeAt(o),43!==a&&45!==a||(o+=1),!(o<e&&i(n.charCodeAt(o))))return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid integer exponent`);for(;o<e&&i(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(s,o)}else t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" is not a number`}function o(t){const{pathValue:e,max:n}=t;for(;t.index<n&&(10===(r=e.charCodeAt(t.index))||13===r||8232===r||8233===r||32===r||9===r||11===r||12===r||160===r||r>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(r));)t.index+=1;var r}function m(t){return t>=48&&t<=57||43===t||45===t||46===t}function c(t){const{max:i,pathValue:c,index:u}=t,l=c.charCodeAt(u),h=e[c[u].toLowerCase()];if(t.segmentStart=u,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(l))if(t.index+=1,o(t),t.data=[],h){for(;;){for(let e=h;e>0;e-=1){if(97!=(32|l)||3!==e&&4!==e?a(t):s(t),t.err.length)return;t.data.push(t.param),o(t),t.index<i&&44===c.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!m(c.charCodeAt(t.index)))break}n(t)}else n(t);else t.err=`${r}: Invalid path value "${c[u]}" is not a path command`}function u(t){return t.map(t=>Array.isArray(t)?[...t]:t)}function l(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every(t=>{const n=t[0].toLowerCase();return e[n]===t.length-1&&"achlmqstvz".includes(n)})}function f(t){if(h(t))return u(t);const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return e.err?e.err:e.segments}function y(t){return h(t)&&t.every(([t])=>t===t.toUpperCase())}function x(t){if(y(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toUpperCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"A":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]+n,e[6]+r];break;case"V":m=[o,e[0]+r];break;case"H":m=[o,e[0]+n];break;default:m=[o,...e.map((t,e)=>t+(e%2?r:n))]}else m=[o,...e];const c=m.length;switch(o){case"Z":n=s,r=i;break;case"H":[,n]=m;break;case"V":[,r]=m;break;default:n=m[c-2],r=m[c-1],"M"===o&&(s=n,i=r)}return m})}function g(t){return h(t)&&t.slice(1).every(([t])=>t===t.toLowerCase())}function p(t){if(g(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toLowerCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"a":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]-n,e[6]-r];break;case"v":m=[o,e[0]-r];break;case"h":m=[o,e[0]-n];break;default:m=[o,...e.map((t,e)=>t-(e%2?r:n))]}else"m"===a&&(s=e[0]+n,i=e[1]+r),m=[o,...e];const c=m.length;switch(o){case"z":n=s,r=i;break;case"h":n+=m[1];break;case"v":r+=m[1];break;default:n+=m[c-2],r+=m[c-1]}return m})}function d(t,e,n){if(t[n].length>7){t[n].shift();const r=t[n];let s=n;for(;r.length;)e[n]="A",t.splice(s+=1,0,["C",...r.splice(0,6)]);t.splice(n,1)}}function M(t,e){const[n]=t,{x1:r,y1:s,x2:i,y2:a}=e,o=t.slice(1).map(Number);let m=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)m=["L",t[1],s];else if("V"===n)m=["L",r,t[1]];else if("S"===n){const t=2*r-i,n=2*s-a;e.x1=t,e.y1=n,m=["C",t,n,...o]}else if("T"===n){const t=2*r-e.qx,n=2*s-e.qy;e.qx=t,e.qy=n,m=["Q",t,n,...o]}else if("Q"===n){const[t,n]=o;e.qx=t,e.qy=n}return m}function b(t){return y(t)&&t.every(([t])=>"ACLMQZ".includes(t))}const N={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function A(t){if(b(t))return u(t);const e=x(t),n={...N},r=[],s=e.length;let i="";for(let t=0;t<s;t+=1){[i]=e[t],r[t]=i,e[t]=M(e[t],n);const s=e[t],a=s.length;n.x1=+s[a-2],n.y1=+s[a-1],n.x2=+s[a-4]||n.x1,n.y2=+s[a-3]||n.y1}return e}function v(t){const e=f(t),n=A(e),{length:r}=e,s="Z"===n.slice(-1)[0][0],i=s?r-2:r-1,[a,o]=n[0].slice(1),[m,c]=n[i].slice(-2);return s&&a===m&&o===c?e.slice(0,-1):e}function w(t){return b(t)&&t.every(([t])=>"MC".includes(t))}function C(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function S(t,e,n,r,s,i,a,o,m,c){let u=t,l=e,h=n,f=r,y=o,x=m;const g=120*Math.PI/180,p=Math.PI/180*(+s||0);let d,M,b,N,A,v=[];if(c)[M,b,N,A]=c;else{d=C(u,l,-p),u=d.x,l=d.y,d=C(y,x,-p),y=d.x,x=d.y;const t=(u-y)/2,e=(l-x)/2;let n=t*t/(h*h)+e*e/(f*f);n>1&&(n=Math.sqrt(n),h*=n,f*=n);const r=h*h,s=f*f,o=(i===a?-1:1)*Math.sqrt(Math.abs((r*s-r*e*e-s*t*t)/(r*e*e+s*t*t)));N=o*h*e/f+(u+y)/2,A=o*-f*t/h+(l+x)/2,M=(Math.asin((l-A)/f)*10**9>>0)/10**9,b=(Math.asin((x-A)/f)*10**9>>0)/10**9,M=u<N?Math.PI-M:M,b=y<N?Math.PI-b:b,M<0&&(M=2*Math.PI+M),b<0&&(b=2*Math.PI+b),a&&M>b&&(M-=2*Math.PI),!a&&b>M&&(b-=2*Math.PI)}let w=b-M;if(Math.abs(w)>g){const t=b,e=y,n=x;b=M+g*(a&&b>M?1:-1),y=N+h*Math.cos(b),x=A+f*Math.sin(b),v=S(y,x,h,f,s,0,a,e,n,[b,t,N,A])}w=b-M;const k=Math.cos(M),P=Math.sin(M),T=Math.cos(b),$=Math.sin(b),q=Math.tan(w/4),I=4/3*h*q,V=4/3*f*q,L=[u,l],j=[u+I*P,l-V*k],O=[y+I*$,x-V*T],E=[y,x];if(j[0]=2*L[0]-j[0],j[1]=2*L[1]-j[1],c)return[...j,...O,...E,...v];v=[...j,...O,...E,...v];const z=[];for(let t=0,e=v.length;t<e;t+=1)z[t]=t%2?C(v[t-1],v[t],p).y:C(v[t],v[t+1],p).x;return z}function k(t,e,n,r,s,i){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*s+2/3*n,1/3*i+2/3*r,s,i]}function P(t,e,n){const[r,s]=t,[i,a]=e;return[r+(i-r)*n,s+(a-s)*n]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function $(t,e,n,r,s){const i=T([t,e],[n,r]);let a={x:0,y:0};if("number"==typeof s)if(0===s)a={x:t,y:e};else if(s>=i)a={x:n,y:r};else{const[o,m]=P([t,e],[n,r],s/i);a={x:o,y:m}}return{length:i,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function q(t,e,n,r){const s=.5,i=[t,e],a=[n,r],o=P(i,a,s),m=P(a,o,s),c=P(o,m,s),u=P(m,c,s),l=P(c,u,s),h=$(...[...i,...o,...c,...l,s]).point,f=$(...[...l,...u,...m,...a,0]).point;return[h.x,h.y,f.x,f.y,n,r]}function I(t,e){const[n]=t,r=t.slice(1).map(Number),[s,i]=r;let a;const{x1:o,y1:m,x:c,y:u}=e;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=s,e.y=i,t;case"A":return a=[o,m,...r],["C",...S(...a)];case"Q":return e.qx=s,e.qy=i,a=[o,m,...r],["C",...k(...a)];case"L":return["C",...q(o,m,s,i)];case"Z":return["C",...q(o,m,c,u)]}return t}function V(t){if(w(t))return u(t);const e=v(A(t)),n={...N},r=[];let s="",i=e.length;for(let t=0;t<i;t+=1){[s]=e[t],r[t]=s,e[t]=I(e[t],n),d(e,r,t),i=e.length;const a=e[t],o=a.length;n.x1=+a[o-2],n.y1=+a[o-1],n.x2=+a[o-4]||n.x1,n.y2=+a[o-3]||n.y1}return e}function L(e,n){let{round:r}=t;if("off"===n||"off"===r)return u(e);r=n>=0?n:r;const s="number"==typeof r&&r>=1?10**r:1;return e.map(t=>{const e=t.slice(1).map(Number).map(t=>r?Math.round(t*s)/s:Math.round(t));return[t[0],...e]})}function j(t,e){return L(t,e).map(t=>t[0]+t.slice(1).join(" ")).join("")}function O(t){const e=x(t),n="Z"===e.slice(-1)[0][0],r=A(e).map((t,n)=>{const[r,s]=t.slice(-2).map(Number);return{seg:e[n],n:t,c:e[n][0],x:r,y:s}}).map((t,e,r)=>{const s=t.seg,i=t.n,a=e&&r[e-1],o=r[e+1],m=t.c,c=r.length,u=e?r[e-1].x:r[c-1].x,l=e?r[e-1].y:r[c-1].y;let h=[];switch(m){case"M":h=n?["Z"]:[m,u,l];break;case"A":h=[m,...s.slice(1,-3),1===s[5]?0:1,u,l];break;case"C":h=o&&"S"===o.c?["S",s[1],s[2],u,l]:[m,s[3],s[4],s[1],s[2],u,l];break;case"S":h=!a||!"CS".includes(a.c)||o&&"S"===o.c?[m,i[1],i[2],u,l]:["C",i[3],i[4],i[1],i[2],u,l];break;case"Q":h=o&&"T"===o.c?["T",u,l]:[m,...s.slice(1,-2),u,l];break;case"T":h=!a||!"QT".includes(a.c)||o&&"T"===o.c?[m,u,l]:["Q",i[1],i[2],u,l];break;case"Z":h=["M",u,l];break;case"H":h=[m,u];break;case"V":h=[m,l];break;default:h=[m,...s.slice(1,-2),u,l]}return h});return n?r.reverse():[r[0],...r.slice(1).reverse()]}function E(t){const e=[];let n,r=-1;return t.forEach(t=>{"M"===t[0]?(n=[t],r+=1):n=[...n,t],e[r]=n}),e}function z(t,e,n,r){const[s]=t,i=t=>Math.round(1e4*t)/1e4,a=t.slice(1).map(t=>+t),o=e.slice(1).map(t=>+t),{x1:m,y1:c,x2:u,y2:l,x:h,y:f}=n;let y=t;const[x,g]=o.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))y=[s,...a];else if("L"===s)i(h)===i(x)?y=["V",g]:i(f)===i(g)&&(y=["H",x]);else if("C"===s){const[t,e]=o;"CS".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["S",...o.slice(-4)]),n.x1=t,n.y1=e}else if("Q"===s){const[t,e]=o;n.qx=t,n.qy=e,"QT".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["T",...o.slice(-2)])}return y}function Z(t,e){const n=x(t),r=A(n),s={...N},i=[],a=n.length;let o="",m="",c=0,u=0,l=0,h=0;for(let t=0;t<a;t+=1){[o]=n[t],i[t]=o,t&&(m=i[t-1]),n[t]=z(n[t],r[t],s,m);const e=n[t],a=e.length;switch(s.x1=+e[a-2],s.y1=+e[a-1],s.x2=+e[a-4]||s.x1,s.y2=+e[a-3]||s.y1,o){case"Z":c=l,u=h;break;case"H":[,c]=e;break;case"V":[,u]=e;break;default:[c,u]=e.slice(-2).map(Number),"M"===o&&(l=c,h=u)}s.x=c,s.y=u}const f=L(n,e),y=L(p(n),e);return f.map((t,e)=>e?t.join("").length<y[e].join("").length?t:y[e]:t)}function Q(t){const e=new W,n=Array.from(t);if(!n.every(t=>!Number.isNaN(t)))throw TypeError(`CSSMatrix: "${t}" must only have numbers.`);if(16===n.length){const[t,r,s,i,a,o,m,c,u,l,h,f,y,x,g,p]=n;e.m11=t,e.a=t,e.m21=a,e.c=a,e.m31=u,e.m41=y,e.e=y,e.m12=r,e.b=r,e.m22=o,e.d=o,e.m32=l,e.m42=x,e.f=x,e.m13=s,e.m23=m,e.m33=h,e.m43=g,e.m14=i,e.m24=c,e.m34=f,e.m44=p}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");{const[t,r,s,i,a,o]=n;e.m11=t,e.a=t,e.m12=r,e.b=r,e.m21=s,e.c=s,e.m22=i,e.d=i,e.m41=a,e.e=a,e.m42=o,e.f=o}}return e}function F(t){const e=Object.keys(new W);if("object"==typeof t&&e.every(e=>e in t))return Q([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(t)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)}function D(t){if("string"!=typeof t)throw TypeError(`CSSMatrix: "${t}" is not a string.`);const e=String(t).replace(/\s/g,"");let n=new W;const r=`CSSMatrix: invalid transform string "${t}"`;return e.split(")").filter(t=>t).forEach(t=>{const[e,s]=t.split("(");if(!s)throw TypeError(r);const i=s.split(",").map(t=>t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)),[a,o,m,c]=i,u=[a,o,m],l=[a,o,m,c];if("perspective"===e&&a&&[o,m].every(t=>void 0===t))n.m34=-1/a;else if(e.includes("matrix")&&[6,16].includes(i.length)&&i.every(t=>!Number.isNaN(+t))){const t=i.map(t=>Math.abs(t)<1e-6?0:t);n=n.multiply(Q(t))}else if("translate3d"===e&&u.every(t=>!Number.isNaN(+t)))n=n.translate(a,o,m);else if("translate"===e&&a&&void 0===m)n=n.translate(a,o||0,0);else if("rotate3d"===e&&l.every(t=>!Number.isNaN(+t))&&c)n=n.rotateAxisAngle(a,o,m,c);else if("rotate"===e&&a&&[o,m].every(t=>void 0===t))n=n.rotate(0,0,a);else if("scale3d"===e&&u.every(t=>!Number.isNaN(+t))&&u.some(t=>1!==t))n=n.scale(a,o,m);else if("scale"!==e||Number.isNaN(a)||1===a||void 0!==m)if("skew"===e&&(a||!Number.isNaN(a)&&o)&&void 0===m)n=n.skew(a,o||0);else{if(!(/[XYZ]/.test(e)&&a&&[o,m].every(t=>void 0===t)&&["translate","rotate","scale","skew"].some(t=>e.includes(t))))throw TypeError(r);if(["skewX","skewY"].includes(e))n=n[e](a);else{const t=e.replace(/[XYZ]/,""),r=e.replace(t,""),s=["X","Y","Z"].indexOf(r),i="scale"===t?1:0,o=[0===s?a:i,1===s?a:i,2===s?a:i];n=n[t](...o)}}else{const t=Number.isNaN(+o)?a:o;n=n.scale(a,t,1)}}),n}function H(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function X(t,e,n){const r=new W;return r.m41=t,r.e=t,r.m42=e,r.f=e,r.m43=n,r}function Y(t,e,n){const r=new W,s=Math.PI/180,i=t*s,a=e*s,o=n*s,m=Math.cos(i),c=-Math.sin(i),u=Math.cos(a),l=-Math.sin(a),h=Math.cos(o),f=-Math.sin(o),y=u*h,x=-u*f;r.m11=y,r.a=y,r.m12=x,r.b=x,r.m13=l;const g=c*l*h+m*f;r.m21=g,r.c=g;const p=m*h-c*l*f;return r.m22=p,r.d=p,r.m23=-c*u,r.m31=c*f-m*l*h,r.m32=c*h+m*l*f,r.m33=m*u,r}function B(t,e,n,r){const s=new W,i=Math.sqrt(t*t+e*e+n*n);if(0===i)return s;const a=t/i,o=e/i,m=n/i,c=r*(Math.PI/360),u=Math.sin(c),l=Math.cos(c),h=u*u,f=a*a,y=o*o,x=m*m,g=1-2*(y+x)*h;s.m11=g,s.a=g;const p=2*(a*o*h+m*u*l);s.m12=p,s.b=p,s.m13=2*(a*m*h-o*u*l);const d=2*(o*a*h-m*u*l);s.m21=d,s.c=d;const M=1-2*(x+f)*h;return s.m22=M,s.d=M,s.m23=2*(o*m*h+a*u*l),s.m31=2*(m*a*h+o*u*l),s.m32=2*(m*o*h-a*u*l),s.m33=1-2*(f+y)*h,s}function R(t,e,n){const r=new W;return r.m11=t,r.a=t,r.m22=e,r.d=e,r.m33=n,r}function J(t,e){const n=new W;if(t){const e=t*Math.PI/180,r=Math.tan(e);n.m21=r,n.c=r}if(e){const t=e*Math.PI/180,r=Math.tan(t);n.m12=r,n.b=r}return n}function G(t){return J(t,0)}function U(t){return J(0,t)}function K(t,e){return Q([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}class W{constructor(...t){const e=this;if(e.a=1,e.b=0,e.c=0,e.d=1,e.e=0,e.f=0,e.m11=1,e.m12=0,e.m13=0,e.m14=0,e.m21=0,e.m22=1,e.m23=0,e.m24=0,e.m31=0,e.m32=0,e.m33=1,e.m34=0,e.m41=0,e.m42=0,e.m43=0,e.m44=1,t.length){const n=[16,6].some(e=>e===t.length)?t:t[0];return e.setMatrixValue(n)}return e}get isIdentity(){const t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44}get is2D(){const t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44}setMatrixValue(t){return"string"==typeof t&&t.length&&"none"!==t?D(t):[Array,Float64Array,Float32Array].some(e=>t instanceof e)?Q(t):[W,DOMMatrix,Object].some(e=>t instanceof e)?F(t):this}toFloat32Array(t){return Float32Array.from(H(this,t))}toFloat64Array(t){return Float64Array.from(H(this,t))}toString(){const{is2D:t}=this;return`${t?"matrix":"matrix3d"}(${this.toFloat64Array(t).join(", ")})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return K(this,t)}translate(t,e,n){let r=e,s=n;return void 0===r&&(r=0),void 0===s&&(s=0),K(this,X(t,r,s))}scale(t,e,n){let r=e,s=n;return void 0===r&&(r=t),void 0===s&&(s=1),K(this,R(t,r,s))}rotate(t,e,n){let r=t,s=e||0,i=n||0;return"number"==typeof t&&void 0===e&&void 0===n&&(i=r,r=0,s=0),K(this,Y(r,s,i))}rotateAxisAngle(t,e,n,r){if([t,e,n,r].some(t=>Number.isNaN(+t)))throw new TypeError("CSSMatrix: expecting 4 values");return K(this,B(t,e,n,r))}skewX(t){return K(this,G(t))}skewY(t){return K(this,U(t))}skew(t,e){return K(this,J(t,e))}transformPoint(t){const e=this,n=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,r=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,s=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}Object.assign(W,{Translate:X,Rotate:Y,RotateAxisAngle:B,Scale:R,SkewX:G,SkewY:U,Skew:J,Multiply:K,fromArray:Q,fromMatrix:F,fromString:D,toArray:H});function _(t,e,n){const[r,s,i]=n,[a,o,m]=function(t,e){let n=X(...e);return[,,,n.m44]=e,n=t.multiply(n),[n.m41,n.m42,n.m43,n.m44]}(t,[...e,0,1]),c=o-s,u=m-i;return[(a-r)*(Math.abs(i)/Math.abs(u)||1)+r,c*(Math.abs(i)/Math.abs(u)||1)+s]}function tt(e,n){let r,s,i,a,o,m,c=0,l=0;const h=x(e),f=n&&Object.keys(n);if(!n||!f.length)return u(h);const y=A(h);if(!n.origin){const{origin:e}=t;Object.assign(n,{origin:e})}const g=function(t){let e=new W;const{origin:n}=t,[r,s]=n,{translate:i}=t,{rotate:a}=t,{skew:o}=t,{scale:m}=t;return Array.isArray(i)&&i.every(t=>!Number.isNaN(+t))&&i.some(t=>0!==t)?e=e.translate(...i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(a||o||m)&&(e=e.translate(r,s),Array.isArray(a)&&a.every(t=>!Number.isNaN(+t))&&a.some(t=>0!==t)?e=e.rotate(...a):"number"!=typeof a||Number.isNaN(a)||(e=e.rotate(a)),Array.isArray(o)&&o.every(t=>!Number.isNaN(+t))&&o.some(t=>0!==t)?(e=o[0]?e.skewX(o[0]):e,e=o[1]?e.skewY(o[1]):e):"number"!=typeof o||Number.isNaN(o)||(e=e.skewX(o)),Array.isArray(m)&&m.every(t=>!Number.isNaN(+t))&&m.some(t=>1!==t)?e=e.scale(...m):"number"!=typeof m||Number.isNaN(m)||(e=e.scale(m)),e=e.translate(-r,-s)),e}(n),{origin:p}=n,M={...N};let b=[],v=0,w="",C=[];const S=[];if(!g.isIdentity){for(r=0,i=h.length;r<i;r+=1){b=h[r],h[r]&&([w]=b),S[r]=w,"A"===w&&(b=I(y[r],M),h[r]=I(y[r],M),d(h,S,r),y[r]=I(y[r],M),d(y,S,r),i=Math.max(h.length,y.length)),b=y[r],v=b.length,M.x1=+b[v-2],M.y1=+b[v-1],M.x2=+b[v-4]||M.x1,M.y2=+b[v-3]||M.y1;const t={s:h[r],c:h[r][0],x:M.x1,y:M.y1};C=[...C,t]}return C.map(t=>{switch(w=t.c,b=t.s,w){case"L":case"H":case"V":return[o,m]=_(g,[t.x,t.y],p),c!==o&&l!==m?b=["L",o,m]:l===m?b=["H",o]:c===o&&(b=["V",m]),c=o,l=m,b;default:for(s=1,a=b.length;s<a;s+=2)[c,l]=_(g,[+b[s],+b[s+1]],p),b[s]=c,b[s+1]=l;return b}})}return u(h)}function et(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,a=n*s+r*i,o=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(a/o)}function nt(t,e,n,r,s,i,a,o,m,c){const{abs:u,sin:l,cos:h,sqrt:f,PI:y}=Math;let x=u(n),g=u(r);const p=(s%360+360)%360*(y/180);if(t===o&&e===m)return{x:t,y:e};if(0===x||0===g)return $(t,e,o,m,c).point;const d=(t-o)/2,M=(e-m)/2,b=h(p)*d+l(p)*M,N=-l(p)*d+h(p)*M,A=b**2/x**2+N**2/g**2;A>1&&(x*=f(A),g*=f(A));let v=(x**2*g**2-x**2*N**2-g**2*b**2)/(x**2*N**2+g**2*b**2);v=v<0?0:v;const w=(i!==a?1:-1)*f(v),C=w*(x*N/g),S=w*(-g*b/x),k=h(p)*C-l(p)*S+(t+o)/2,P=l(p)*C+h(p)*S+(e+m)/2,T={x:(b-C)/x,y:(N-S)/g},q=et({x:1,y:0},T);let I=et(T,{x:(-b-C)/x,y:(-N-S)/g});!a&&I>0?I-=2*y:a&&I<0&&(I+=2*y),I%=2*y;const V=q+I*c,L=x*h(V),j=g*l(V);return{x:h(p)*L-l(p)*j+k,y:l(p)*L+h(p)*j+P}}function rt(t,e,n,r,s,i,a,o,m,c){const u="number"==typeof c;let l=t,h=e,f=0,y=[l,h,f],x=[l,h],g=0,p={x:0,y:0},d=[{x:l,y:h}];u&&0===c&&(p={x:l,y:h});for(let M=0;M<=300;M+=1){if(g=M/300,({x:l,y:h}=nt(t,e,n,r,s,i,a,o,m,g)),d=[...d,{x:l,y:h}],f+=T(x,[l,h]),x=[l,h],u&&f>c&&c>y[2]){const t=(f-c)/(f-y[2]);p={x:x[0]*(1-t)+y[0]*t,y:x[1]*(1-t)+y[1]*t}}y=[l,h,f]}return u&&c>=f&&(p={x:o,y:m}),{length:f,point:p,min:{x:Math.min(...d.map(t=>t.x)),y:Math.min(...d.map(t=>t.y))},max:{x:Math.max(...d.map(t=>t.x)),y:Math.max(...d.map(t=>t.y))}}}function st(t,e,n,r,s,i,a,o,m){const c=1-m;return{x:c**3*t+3*c**2*m*n+3*c*m**2*s+m**3*a,y:c**3*e+3*c**2*m*r+3*c*m**2*i+m**3*o}}function it(t,e,n,r,s,i,a,o,m){const c="number"==typeof m;let u=t,l=e,h=0,f=[u,l,h],y=[u,l],x=0,g={x:0,y:0},p=[{x:u,y:l}];c&&0===m&&(g={x:u,y:l});for(let d=0;d<=300;d+=1){if(x=d/300,({x:u,y:l}=st(t,e,n,r,s,i,a,o,x)),p=[...p,{x:u,y:l}],h+=T(y,[u,l]),y=[u,l],c&&h>m&&m>f[2]){const t=(h-m)/(h-f[2]);g={x:y[0]*(1-t)+f[0]*t,y:y[1]*(1-t)+f[1]*t}}f=[u,l,h]}return c&&m>=h&&(g={x:a,y:o}),{length:h,point:g,min:{x:Math.min(...p.map(t=>t.x)),y:Math.min(...p.map(t=>t.y))},max:{x:Math.max(...p.map(t=>t.x)),y:Math.max(...p.map(t=>t.y))}}}function at(t,e,n,r,s,i,a){const o=1-a;return{x:o**2*t+2*o*a*n+a**2*s,y:o**2*e+2*o*a*r+a**2*i}}function ot(t,e,n,r,s,i,a){const o="number"==typeof a;let m=t,c=e,u=0,l=[m,c,u],h=[m,c],f=0,y={x:0,y:0},x=[{x:m,y:c}];o&&0===a&&(y={x:m,y:c});for(let g=0;g<=300;g+=1){if(f=g/300,({x:m,y:c}=at(t,e,n,r,s,i,f)),x=[...x,{x:m,y:c}],u+=T(h,[m,c]),h=[m,c],o&&u>a&&a>l[2]){const t=(u-a)/(u-l[2]);y={x:h[0]*(1-t)+l[0]*t,y:h[1]*(1-t)+l[1]*t}}l=[m,c,u]}return o&&a>=u&&(y={x:s,y:i}),{length:u,point:y,min:{x:Math.min(...x.map(t=>t.x)),y:Math.min(...x.map(t=>t.y))},max:{x:Math.max(...x.map(t=>t.x)),y:Math.max(...x.map(t=>t.y))}}}function mt(t,e){const n=A(t),r="number"==typeof e;let s,i,a,o=[],m=0,c=0,u=0,l=0,h=[],f=[],y=0,x={x:0,y:0},g=x,p=x,d=x,M=0;for(let t=0,b=n.length;t<b;t+=1)a=n[t],[i]=a,s="M"===i,o=s?o:[m,c,...a.slice(1)],s?([,u,l]=a,x={x:u,y:l},g=x,y=0,r&&e<.001&&(d=x)):"L"===i?({length:y,min:x,max:g,point:p}=$(...o,(e||0)-M)):"A"===i?({length:y,min:x,max:g,point:p}=rt(...o,(e||0)-M)):"C"===i?({length:y,min:x,max:g,point:p}=it(...o,(e||0)-M)):"Q"===i?({length:y,min:x,max:g,point:p}=ot(...o,(e||0)-M)):"Z"===i&&(o=[m,c,u,l],({length:y,min:x,max:g,point:p}=$(...o,(e||0)-M))),r&&M<e&&M+y>=e&&(d=p),f=[...f,g],h=[...h,x],M+=y,[m,c]="Z"!==i?a.slice(-2):[u,l];return r&&e>=M&&(d={x:m,y:c}),{length:M,point:d,min:{x:Math.min(...h.map(t=>t.x)),y:Math.min(...h.map(t=>t.y))},max:{x:Math.max(...f.map(t=>t.x)),y:Math.max(...f.map(t=>t.y))}}}function ct(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const{min:{x:e,y:n},max:{x:r,y:s}}=mt(t),i=r-e,a=s-n;return{width:i,height:a,x:e,y:n,x2:r,y2:s,cx:e+i/2,cy:n+a/2,cz:Math.max(i,a)+Math.min(i,a)/2}}function ut(t){return mt(t).length}function lt(t,e){return mt(t,e).point}Object.assign(W,{Version:"1.0.3"});class ht{constructor(e,n){const s=n||{},i=void 0===e;if(i||!e.length)throw TypeError(`${r}: "pathValue" is ${i?"undefined":"empty"}`);const a=f(e);if("string"==typeof a)throw TypeError(a);this.segments=a;const{width:o,height:m,cx:c,cy:u,cz:l}=this.getBBox(),{round:h,origin:y}=s;let x,g;if("auto"===h){const t=(""+Math.floor(Math.max(o,m))).length;x=t>=4?0:4-t}else Number.isInteger(h)||"off"===h?x=h:({round:x}=t);if(Array.isArray(y)&&y.length>=2){const[t,e,n]=y.map(Number);g=[Number.isNaN(t)?c:t,Number.isNaN(e)?u:e,Number.isNaN(n)?l:n]}else g=[c,u,l];return this.round=x,this.origin=g,this}getBBox(){return ct(this.segments)}getTotalLength(){return ut(this.segments)}getPointAtLength(t){return lt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=x(t),this}toRelative(){const{segments:t}=this;return this.segments=p(t),this}toCurve(){const{segments:t}=this;return this.segments=V(t),this}reverse(t){this.toAbsolute();const{segments:e}=this,n=E(e),r=n.length>1?n:0,s=r&&u(r).map((e,n)=>t?n?O(e):f(e):O(e));let i=[];return i=r?s.flat(1):t?e:O(e),this.segments=u(i),this}normalize(){const{segments:t}=this;return this.segments=A(t),this}optimize(){const{segments:t}=this;return this.segments=Z(t,this.round),this}transform(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some(e=>e in t))return this;const e={};Object.keys(t).forEach(n=>{e[n]=Array.isArray(t[n])?[...t[n]]:Number(t[n])});const{segments:n}=this,[r,s,i]=this.origin,{origin:a}=e;if(Array.isArray(a)&&a.length>=2){const[t,n,o]=a.map(Number);e.origin=[Number.isNaN(t)?r:t,Number.isNaN(n)?s:n,o||i]}else e.origin=[r,s,i];return this.segments=tt(n,e),this}flipX(){return this.transform({rotate:[0,180,0]}),this}flipY(){return this.transform({rotate:[180,0,0]}),this}toString(){return j(this.segments,this.round)}}function ft(t){let e=0,n=0,r=0;return V(t).map(t=>{switch(t[0]){case"M":return[,e,n]=t,0;default:return r=function(t,e,n,r,s,i,a,o){return 3*((o-e)*(n+s)-(a-t)*(r+i)+r*(t-s)-n*(e-i)+o*(s+t/3)-a*(i+e/3))/20}(e,n,...t.slice(1)),[e,n]=t.slice(-2),r}}).reduce((t,e)=>t+e,0)}function yt(t,e){const n=f(t);if("string"==typeof n)throw TypeError(n);let r=[...n],s=ut(r),i=r.length-1,a=0,o=0,m=n[0];const[c,u]=m.slice(-2),l={x:c,y:u};if(i<=0||!e||!Number.isFinite(e))return{segment:m,index:0,length:o,point:l,lengthAtSegment:a};if(e>=s)return r=n.slice(0,-1),a=ut(r),o=s-a,{segment:n[i],index:i,length:o,lengthAtSegment:a};const h=[];for(;i>0;)m=r[i],r=r.slice(0,-1),a=ut(r),o=s-a,s=a,h.push({segment:m,index:i,length:o,lengthAtSegment:a}),i-=1;return h.find(({lengthAtSegment:t})=>t<=e)}function xt(t,e){const n=f(t),r=A(n),s=ut(n),i=t=>{const n=t.x-e.x,r=t.y-e.y;return n*n+r*r};let a=8,o={x:0,y:0},m=0,c=o,u=0,l=1/0;for(let t=0;t<=s;t+=a)o=lt(r,t),m=i(o),m<l&&(c=o,u=t,l=m);a/=2;let h,y={x:0,y:0},x=0,g=0,p=0,d=0;for(;a>.5;)x=u-a,y=lt(r,x),p=i(y),g=u+a,h=lt(r,g),d=i(h),x>=0&&p<l?(c=y,u=x,l=p):g<=s&&d<l?(c=h,u=g,l=d):a/=2;const M=yt(n,u);return{closest:c,distance:Math.sqrt(l),segment:M}}function gt(t){if("string"!=typeof t)return!1;const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return!e.err.length&&"mM".includes(e.segments[0][0])}const pt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};const dt={CSSMatrix:W,parsePathString:f,isPathArray:h,isCurveArray:w,isAbsoluteArray:y,isRelativeArray:g,isNormalizedArray:b,isValidPath:gt,pathToAbsolute:x,pathToRelative:p,pathToCurve:V,pathToString:j,getDrawDirection:function(t){return ft(V(t))>=0},getPathArea:ft,getPathBBox:ct,pathLengthFactory:mt,getTotalLength:ut,getPointAtLength:lt,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:yt,getSegmentAtLength:function(t,e){return yt(t,e).segment},isPointInStroke:function(t,e){const{distance:n}=xt(t,e);return Math.abs(n)<.001},clonePath:u,splitPath:E,fixPath:v,roundPath:L,optimizePath:Z,reverseCurve:function(t){const e=t.slice(1).map((e,n,r)=>n?[...r[n-1].slice(-2),...e.slice(1)]:[...t[0].slice(1),...e.slice(1)]).map(t=>t.map((e,n)=>t[t.length-n-2*(1-n%2)])).reverse();return[["M",...e[0].slice(0,2)],...e.map(t=>["C",...t.slice(2)])]},reversePath:O,normalizePath:A,transformPath:tt,shapeToPath:function(e,n){const s=Object.keys(pt),{tagName:i}=e;if(i&&!s.some(t=>i===t))throw TypeError(`${r}: "${i}" is not SVGElement`);const a=document.createElementNS("http://www.w3.org/2000/svg","path"),o=i||e.type,m={};m.type=o;const c=pt[o];let u;i?(c.forEach(t=>{m[t]=e.getAttribute(t)}),Object.values(e.attributes).forEach(({name:t,value:e})=>{c.includes(t)||a.setAttribute(t,e)})):(Object.assign(m,e),Object.keys(m).forEach(t=>{c.includes(t)||"type"===t||a.setAttribute(t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),m[t])}));const{round:l}=t;return"circle"===o?u=j(function(t){const{cx:e,cy:n,r:r}=t;return[["M",e-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]}(m),l):"ellipse"===o?u=j(function(t){const{cx:e,cy:n,rx:r,ry:s}=t;return[["M",e-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]}(m),l):["polyline","polygon"].includes(o)?u=j(function(t){const e=[],n=(t.points||"").trim().split(/[\s|,]/).map(Number);let r=0;for(;r<n.length;)e.push([r?"L":"M",n[r],n[r+1]]),r+=2;return"polygon"===t.type?[...e,["z"]]:e}(m),l):"rect"===o?u=j(function(t){const e=+t.x||0,n=+t.y||0,r=+t.width,s=+t.height;let i=+t.rx,a=+t.ry;return i||a?(i=i||a,a=a||i,2*i>r&&(i-=(2*i-r)/2),2*a>s&&(a-=(2*a-s)/2),[["M",e+i,n],["h",r-2*i],["s",i,0,i,a],["v",s-2*a],["s",0,a,-i,a],["h",2*i-r],["s",-i,0,-i,-a],["v",2*a-s],["s",0,-a,i,-a]]):[["M",e,n],["h",r],["v",s],["H",e],["Z"]]}(m),l):"line"===o?u=j(function(t){const{x1:e,y1:n,x2:r,y2:s}=t;return[["M",e,n],["L",r,s]]}(m),l):"glyph"===o&&(u=i?e.getAttribute("d"):e.d),!!gt(u)&&(a.setAttribute("d",u),n&&i&&(e.before(a,e),e.remove()),a)},options:t};Object.assign(ht,dt,{Version:"1.0.3"});export{ht as default};
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander v1.0.2 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v1.0.3 (http://thednp.github.io/svg-path-commander)
3
3
  * Copyright 2022 © thednp
4
4
  * Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
5
5
  */
@@ -1162,7 +1162,7 @@
1162
1162
  const segment = seg.seg;
1163
1163
  const data = seg.n;
1164
1164
  const prevSeg = i && path[i - 1];
1165
- const nextSeg = path[i + 1] && path[i + 1];
1165
+ const nextSeg = path[i + 1];
1166
1166
  const pathCommand = seg.c;
1167
1167
  const pLen = path.length;
1168
1168
  /** @type {number} */
@@ -1186,7 +1186,7 @@
1186
1186
  }
1187
1187
  break;
1188
1188
  case 'S':
1189
- if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'S'))) {
1189
+ if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'S')) {
1190
1190
  result = ['C', data[3], data[4], data[1], data[2], x, y];
1191
1191
  } else {
1192
1192
  result = [pathCommand, data[1], data[2], x, y];
@@ -1200,7 +1200,7 @@
1200
1200
  }
1201
1201
  break;
1202
1202
  case 'T':
1203
- if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'T'))) {
1203
+ if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'T')) {
1204
1204
  result = ['Q', data[1], data[2], x, y];
1205
1205
  } else {
1206
1206
  result = [pathCommand, x, y];
@@ -1893,7 +1893,7 @@
1893
1893
  m.m31 = 0; m.m32 = 0; m.m33 = 1; m.m34 = 0;
1894
1894
  m.m41 = 0; m.m42 = 0; m.m43 = 0; m.m44 = 1;
1895
1895
 
1896
- if (args && args.length) {
1896
+ if (args.length) {
1897
1897
  const ARGS = [16, 6].some((l) => l === args.length) ? args : args[0];
1898
1898
 
1899
1899
  return m.setMatrixValue(ARGS);
@@ -2193,9 +2193,7 @@
2193
2193
  toArray,
2194
2194
  });
2195
2195
 
2196
- var version$1 = "1.0.2";
2197
-
2198
- // @ts-ignore
2196
+ var version$1 = "1.0.3";
2199
2197
 
2200
2198
  /**
2201
2199
  * A global namespace for library version.
@@ -2203,6 +2201,8 @@
2203
2201
  */
2204
2202
  const Version$1 = version$1;
2205
2203
 
2204
+ /** @typedef {import('../types/index')} */
2205
+
2206
2206
  Object.assign(CSSMatrix, { Version: Version$1 });
2207
2207
 
2208
2208
  /**
@@ -2828,10 +2828,9 @@
2828
2828
  function pathLengthFactory(pathInput, distance) {
2829
2829
  const path = normalizePath(pathInput);
2830
2830
  const distanceIsNumber = typeof distance === 'number';
2831
- let isM = true;
2832
- /** @type {number[]} */
2831
+ let isM;
2833
2832
  let data = [];
2834
- let pathCommand = 'M';
2833
+ let pathCommand;
2835
2834
  let x = 0;
2836
2835
  let y = 0;
2837
2836
  let mx = 0;
@@ -3017,17 +3016,21 @@
3017
3016
  } = this.getBBox();
3018
3017
 
3019
3018
  // set instance options.round
3020
- let { round, origin } = defaultOptions;
3021
3019
  const { round: roundOption, origin: originOption } = instanceOptions;
3020
+ let round;
3022
3021
 
3023
3022
  if (roundOption === 'auto') {
3024
3023
  const pathScale = (`${Math.floor(Math.max(width, height))}`).length;
3025
3024
  round = pathScale >= 4 ? 0 : 4 - pathScale;
3026
3025
  } else if (Number.isInteger(roundOption) || roundOption === 'off') {
3027
3026
  round = roundOption;
3027
+ } else {
3028
+ ({ round } = defaultOptions);
3028
3029
  }
3029
3030
 
3030
3031
  // set instance options.origin
3032
+ // the SVGPathCommander class will always override the default origin
3033
+ let origin;
3031
3034
  if (Array.isArray(originOption) && originOption.length >= 2) {
3032
3035
  const [originX, originY, originZ] = originOption.map(Number);
3033
3036
  origin = [
@@ -3039,10 +3042,9 @@
3039
3042
  origin = [cx, cy, cz];
3040
3043
  }
3041
3044
 
3042
- /**
3043
- * @type {number | 'off'}
3044
- */
3045
+ /** @type {number | 'off'} */
3045
3046
  this.round = round;
3047
+ /** @type {[number, number, number=]} */
3046
3048
  this.origin = origin;
3047
3049
 
3048
3050
  return this;
@@ -3387,7 +3389,7 @@
3387
3389
  // binary search for precise estimate
3388
3390
  precision /= 2;
3389
3391
  let before = { x: 0, y: 0 };
3390
- let after = before;
3392
+ let after;
3391
3393
  let beforeLength = 0;
3392
3394
  let afterLength = 0;
3393
3395
  let beforeDistance = 0;
@@ -3705,12 +3707,6 @@
3705
3707
  ...rotatedCurve.map((x) => ['C', ...x.slice(2)])];
3706
3708
  }
3707
3709
 
3708
- /**
3709
- * Must have at least one import of the main namespace.
3710
- * @typedef {import('../../types/index')}
3711
- * @typedef {import('../types/index')}
3712
- */
3713
-
3714
3710
  /**
3715
3711
  * @interface
3716
3712
  */
@@ -3752,7 +3748,7 @@
3752
3748
  options: defaultOptions,
3753
3749
  };
3754
3750
 
3755
- var version = "1.0.2";
3751
+ var version = "1.0.3";
3756
3752
 
3757
3753
  /**
3758
3754
  * A global namespace for library version.
@@ -3760,6 +3756,8 @@
3760
3756
  */
3761
3757
  const Version = version;
3762
3758
 
3759
+ /** @typedef {import('../types/index')} */
3760
+
3763
3761
  // Export to global
3764
3762
  Object.assign(SVGPathCommander, Util, { Version });
3765
3763
 
@@ -1,2 +1,2 @@
1
- // SVGPathCommander v1.0.2 | thednp © 2022 | MIT-License
2
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";const t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function n(t){const n=t.pathValue[t.segmentStart],r=n.toLowerCase(),{data:s}=t;for(;s.length>=e[r]&&(t.segments.push([n,...s.splice(0,e[r])]),e[r]););}const r="SVGPathCommander error";function s(t){const{index:e,pathValue:n}=t,s=n.charCodeAt(e);return 48===s?(t.param=0,void(t.index+=1)):49===s?(t.param=1,void(t.index+=1)):void(t.err=`${r}: invalid Arc flag "${n[e]}", expecting 0 or 1 at index ${e}`)}function i(t){return t>=48&&t<=57}function a(t){const{max:e,pathValue:n,index:s}=t;let a,o=s,m=!1,c=!1,u=!1,l=!1;if(o>=e)t.err=`${r}: Invalid path value at index ${o}, "pathValue" is missing param`;else if(a=n.charCodeAt(o),43!==a&&45!==a||(o+=1,a=n.charCodeAt(o)),i(a)||46===a){if(46!==a){if(m=48===a,o+=1,a=n.charCodeAt(o),m&&o<e&&a&&i(a))return void(t.err=`${r}: Invalid path value at index ${s}, "${n[s]}" illegal number`);for(;o<e&&i(n.charCodeAt(o));)o+=1,c=!0;a=n.charCodeAt(o)}if(46===a){for(l=!0,o+=1;i(n.charCodeAt(o));)o+=1,u=!0;a=n.charCodeAt(o)}if(101===a||69===a){if(l&&!c&&!u)return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid float exponent`);if(o+=1,a=n.charCodeAt(o),43!==a&&45!==a||(o+=1),!(o<e&&i(n.charCodeAt(o))))return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid integer exponent`);for(;o<e&&i(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(s,o)}else t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" is not a number`}function o(t){const{pathValue:e,max:n}=t;for(;t.index<n&&(10===(r=e.charCodeAt(t.index))||13===r||8232===r||8233===r||32===r||9===r||11===r||12===r||160===r||r>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(r));)t.index+=1;var r}function m(t){return t>=48&&t<=57||43===t||45===t||46===t}function c(t){const{max:i,pathValue:c,index:u}=t,l=c.charCodeAt(u),h=e[c[u].toLowerCase()];if(t.segmentStart=u,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(l))if(t.index+=1,o(t),t.data=[],h){for(;;){for(let e=h;e>0;e-=1){if(97!=(32|l)||3!==e&&4!==e?a(t):s(t),t.err.length)return;t.data.push(t.param),o(t),t.index<i&&44===c.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!m(c.charCodeAt(t.index)))break}n(t)}else n(t);else t.err=`${r}: Invalid path value "${c[u]}" is not a path command`}function u(t){return t.map(t=>Array.isArray(t)?[...t]:t)}function l(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every(t=>{const n=t[0].toLowerCase();return e[n]===t.length-1&&"achlmqstvz".includes(n)})}function f(t){if(h(t))return u(t);const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return e.err?e.err:e.segments}function y(t){return h(t)&&t.every(([t])=>t===t.toUpperCase())}function x(t){if(y(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toUpperCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"A":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]+n,e[6]+r];break;case"V":m=[o,e[0]+r];break;case"H":m=[o,e[0]+n];break;default:m=[o,...e.map((t,e)=>t+(e%2?r:n))]}else m=[o,...e];const c=m.length;switch(o){case"Z":n=s,r=i;break;case"H":[,n]=m;break;case"V":[,r]=m;break;default:n=m[c-2],r=m[c-1],"M"===o&&(s=n,i=r)}return m})}function p(t){return h(t)&&t.slice(1).every(([t])=>t===t.toLowerCase())}function g(t){if(p(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toLowerCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"a":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]-n,e[6]-r];break;case"v":m=[o,e[0]-r];break;case"h":m=[o,e[0]-n];break;default:m=[o,...e.map((t,e)=>t-(e%2?r:n))]}else"m"===a&&(s=e[0]+n,i=e[1]+r),m=[o,...e];const c=m.length;switch(o){case"z":n=s,r=i;break;case"h":n+=m[1];break;case"v":r+=m[1];break;default:n+=m[c-2],r+=m[c-1]}return m})}function d(t,e,n){if(t[n].length>7){t[n].shift();const r=t[n];let s=n;for(;r.length;)e[n]="A",t.splice(s+=1,0,["C",...r.splice(0,6)]);t.splice(n,1)}}function b(t,e){const[n]=t,{x1:r,y1:s,x2:i,y2:a}=e,o=t.slice(1).map(Number);let m=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)m=["L",t[1],s];else if("V"===n)m=["L",r,t[1]];else if("S"===n){const t=2*r-i,n=2*s-a;e.x1=t,e.y1=n,m=["C",t,n,...o]}else if("T"===n){const t=2*r-e.qx,n=2*s-e.qy;e.qx=t,e.qy=n,m=["Q",t,n,...o]}else if("Q"===n){const[t,n]=o;e.qx=t,e.qy=n}return m}function M(t){return y(t)&&t.every(([t])=>"ACLMQZ".includes(t))}const N={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function A(t){if(M(t))return u(t);const e=x(t),n={...N},r=[],s=e.length;let i="";for(let t=0;t<s;t+=1){[i]=e[t],r[t]=i,e[t]=b(e[t],n);const s=e[t],a=s.length;n.x1=+s[a-2],n.y1=+s[a-1],n.x2=+s[a-4]||n.x1,n.y2=+s[a-3]||n.y1}return e}function v(t){const e=f(t),n=A(e),{length:r}=e,s="Z"===n.slice(-1)[0][0],i=s?r-2:r-1,[a,o]=n[0].slice(1),[m,c]=n[i].slice(-2);return s&&a===m&&o===c?e.slice(0,-1):e}function w(t){return M(t)&&t.every(([t])=>"MC".includes(t))}function C(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function S(t,e,n,r,s,i,a,o,m,c){let u=t,l=e,h=n,f=r,y=o,x=m;const p=120*Math.PI/180,g=Math.PI/180*(+s||0);let d,b,M,N,A,v=[];if(c)[b,M,N,A]=c;else{d=C(u,l,-g),u=d.x,l=d.y,d=C(y,x,-g),y=d.x,x=d.y;const t=(u-y)/2,e=(l-x)/2;let n=t*t/(h*h)+e*e/(f*f);n>1&&(n=Math.sqrt(n),h*=n,f*=n);const r=h*h,s=f*f,o=(i===a?-1:1)*Math.sqrt(Math.abs((r*s-r*e*e-s*t*t)/(r*e*e+s*t*t)));N=o*h*e/f+(u+y)/2,A=o*-f*t/h+(l+x)/2,b=(Math.asin((l-A)/f)*10**9>>0)/10**9,M=(Math.asin((x-A)/f)*10**9>>0)/10**9,b=u<N?Math.PI-b:b,M=y<N?Math.PI-M:M,b<0&&(b=2*Math.PI+b),M<0&&(M=2*Math.PI+M),a&&b>M&&(b-=2*Math.PI),!a&&M>b&&(M-=2*Math.PI)}let w=M-b;if(Math.abs(w)>p){const t=M,e=y,n=x;M=b+p*(a&&M>b?1:-1),y=N+h*Math.cos(M),x=A+f*Math.sin(M),v=S(y,x,h,f,s,0,a,e,n,[M,t,N,A])}w=M-b;const k=Math.cos(b),P=Math.sin(b),T=Math.cos(M),$=Math.sin(M),q=Math.tan(w/4),I=4/3*h*q,V=4/3*f*q,L=[u,l],j=[u+I*P,l-V*k],O=[y+I*$,x-V*T],E=[y,x];if(j[0]=2*L[0]-j[0],j[1]=2*L[1]-j[1],c)return[...j,...O,...E,...v];v=[...j,...O,...E,...v];const z=[];for(let t=0,e=v.length;t<e;t+=1)z[t]=t%2?C(v[t-1],v[t],g).y:C(v[t],v[t+1],g).x;return z}function k(t,e,n,r,s,i){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*s+2/3*n,1/3*i+2/3*r,s,i]}function P(t,e,n){const[r,s]=t,[i,a]=e;return[r+(i-r)*n,s+(a-s)*n]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function $(t,e,n,r,s){const i=T([t,e],[n,r]);let a={x:0,y:0};if("number"==typeof s)if(0===s)a={x:t,y:e};else if(s>=i)a={x:n,y:r};else{const[o,m]=P([t,e],[n,r],s/i);a={x:o,y:m}}return{length:i,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function q(t,e,n,r){const s=.5,i=[t,e],a=[n,r],o=P(i,a,s),m=P(a,o,s),c=P(o,m,s),u=P(m,c,s),l=P(c,u,s),h=$(...[...i,...o,...c,...l,s]).point,f=$(...[...l,...u,...m,...a,0]).point;return[h.x,h.y,f.x,f.y,n,r]}function I(t,e){const[n]=t,r=t.slice(1).map(Number),[s,i]=r;let a;const{x1:o,y1:m,x:c,y:u}=e;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=s,e.y=i,t;case"A":return a=[o,m,...r],["C",...S(...a)];case"Q":return e.qx=s,e.qy=i,a=[o,m,...r],["C",...k(...a)];case"L":return["C",...q(o,m,s,i)];case"Z":return["C",...q(o,m,c,u)]}return t}function V(t){if(w(t))return u(t);const e=v(A(t)),n={...N},r=[];let s="",i=e.length;for(let t=0;t<i;t+=1){[s]=e[t],r[t]=s,e[t]=I(e[t],n),d(e,r,t),i=e.length;const a=e[t],o=a.length;n.x1=+a[o-2],n.y1=+a[o-1],n.x2=+a[o-4]||n.x1,n.y2=+a[o-3]||n.y1}return e}function L(e,n){let{round:r}=t;if("off"===n||"off"===r)return u(e);r=n>=0?n:r;const s="number"==typeof r&&r>=1?10**r:1;return e.map(t=>{const e=t.slice(1).map(Number).map(t=>r?Math.round(t*s)/s:Math.round(t));return[t[0],...e]})}function j(t,e){return L(t,e).map(t=>t[0]+t.slice(1).join(" ")).join("")}function O(t){const e=x(t),n="Z"===e.slice(-1)[0][0],r=A(e).map((t,n)=>{const[r,s]=t.slice(-2).map(Number);return{seg:e[n],n:t,c:e[n][0],x:r,y:s}}).map((t,e,r)=>{const s=t.seg,i=t.n,a=e&&r[e-1],o=r[e+1]&&r[e+1],m=t.c,c=r.length,u=e?r[e-1].x:r[c-1].x,l=e?r[e-1].y:r[c-1].y;let h=[];switch(m){case"M":h=n?["Z"]:[m,u,l];break;case"A":h=[m,...s.slice(1,-3),1===s[5]?0:1,u,l];break;case"C":h=o&&"S"===o.c?["S",s[1],s[2],u,l]:[m,s[3],s[4],s[1],s[2],u,l];break;case"S":h=a&&"CS".includes(a.c)&&(!o||o&&"S"!==o.c)?["C",i[3],i[4],i[1],i[2],u,l]:[m,i[1],i[2],u,l];break;case"Q":h=o&&"T"===o.c?["T",u,l]:[m,...s.slice(1,-2),u,l];break;case"T":h=a&&"QT".includes(a.c)&&(!o||o&&"T"!==o.c)?["Q",i[1],i[2],u,l]:[m,u,l];break;case"Z":h=["M",u,l];break;case"H":h=[m,u];break;case"V":h=[m,l];break;default:h=[m,...s.slice(1,-2),u,l]}return h});return n?r.reverse():[r[0],...r.slice(1).reverse()]}function E(t){const e=[];let n,r=-1;return t.forEach(t=>{"M"===t[0]?(n=[t],r+=1):n=[...n,t],e[r]=n}),e}function z(t,e,n,r){const[s]=t,i=t=>Math.round(1e4*t)/1e4,a=t.slice(1).map(t=>+t),o=e.slice(1).map(t=>+t),{x1:m,y1:c,x2:u,y2:l,x:h,y:f}=n;let y=t;const[x,p]=o.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))y=[s,...a];else if("L"===s)i(h)===i(x)?y=["V",p]:i(f)===i(p)&&(y=["H",x]);else if("C"===s){const[t,e]=o;"CS".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["S",...o.slice(-4)]),n.x1=t,n.y1=e}else if("Q"===s){const[t,e]=o;n.qx=t,n.qy=e,"QT".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["T",...o.slice(-2)])}return y}function Z(t,e){const n=x(t),r=A(n),s={...N},i=[],a=n.length;let o="",m="",c=0,u=0,l=0,h=0;for(let t=0;t<a;t+=1){[o]=n[t],i[t]=o,t&&(m=i[t-1]),n[t]=z(n[t],r[t],s,m);const e=n[t],a=e.length;switch(s.x1=+e[a-2],s.y1=+e[a-1],s.x2=+e[a-4]||s.x1,s.y2=+e[a-3]||s.y1,o){case"Z":c=l,u=h;break;case"H":[,c]=e;break;case"V":[,u]=e;break;default:[c,u]=e.slice(-2).map(Number),"M"===o&&(l=c,h=u)}s.x=c,s.y=u}const f=L(n,e),y=L(g(n),e);return f.map((t,e)=>e?t.join("").length<y[e].join("").length?t:y[e]:t)}function Q(t){const e=new W,n=Array.from(t);if(!n.every(t=>!Number.isNaN(t)))throw TypeError(`CSSMatrix: "${t}" must only have numbers.`);if(16===n.length){const[t,r,s,i,a,o,m,c,u,l,h,f,y,x,p,g]=n;e.m11=t,e.a=t,e.m21=a,e.c=a,e.m31=u,e.m41=y,e.e=y,e.m12=r,e.b=r,e.m22=o,e.d=o,e.m32=l,e.m42=x,e.f=x,e.m13=s,e.m23=m,e.m33=h,e.m43=p,e.m14=i,e.m24=c,e.m34=f,e.m44=g}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");{const[t,r,s,i,a,o]=n;e.m11=t,e.a=t,e.m12=r,e.b=r,e.m21=s,e.c=s,e.m22=i,e.d=i,e.m41=a,e.e=a,e.m42=o,e.f=o}}return e}function F(t){const e=Object.keys(new W);if("object"==typeof t&&e.every(e=>e in t))return Q([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(t)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)}function D(t){if("string"!=typeof t)throw TypeError(`CSSMatrix: "${t}" is not a string.`);const e=String(t).replace(/\s/g,"");let n=new W;const r=`CSSMatrix: invalid transform string "${t}"`;return e.split(")").filter(t=>t).forEach(t=>{const[e,s]=t.split("(");if(!s)throw TypeError(r);const i=s.split(",").map(t=>t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)),[a,o,m,c]=i,u=[a,o,m],l=[a,o,m,c];if("perspective"===e&&a&&[o,m].every(t=>void 0===t))n.m34=-1/a;else if(e.includes("matrix")&&[6,16].includes(i.length)&&i.every(t=>!Number.isNaN(+t))){const t=i.map(t=>Math.abs(t)<1e-6?0:t);n=n.multiply(Q(t))}else if("translate3d"===e&&u.every(t=>!Number.isNaN(+t)))n=n.translate(a,o,m);else if("translate"===e&&a&&void 0===m)n=n.translate(a,o||0,0);else if("rotate3d"===e&&l.every(t=>!Number.isNaN(+t))&&c)n=n.rotateAxisAngle(a,o,m,c);else if("rotate"===e&&a&&[o,m].every(t=>void 0===t))n=n.rotate(0,0,a);else if("scale3d"===e&&u.every(t=>!Number.isNaN(+t))&&u.some(t=>1!==t))n=n.scale(a,o,m);else if("scale"!==e||Number.isNaN(a)||1===a||void 0!==m)if("skew"===e&&(a||!Number.isNaN(a)&&o)&&void 0===m)n=n.skew(a,o||0);else{if(!(/[XYZ]/.test(e)&&a&&[o,m].every(t=>void 0===t)&&["translate","rotate","scale","skew"].some(t=>e.includes(t))))throw TypeError(r);if(["skewX","skewY"].includes(e))n=n[e](a);else{const t=e.replace(/[XYZ]/,""),r=e.replace(t,""),s=["X","Y","Z"].indexOf(r),i="scale"===t?1:0,o=[0===s?a:i,1===s?a:i,2===s?a:i];n=n[t](...o)}}else{const t=Number.isNaN(+o)?a:o;n=n.scale(a,t,1)}}),n}function H(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function X(t,e,n){const r=new W;return r.m41=t,r.e=t,r.m42=e,r.f=e,r.m43=n,r}function Y(t,e,n){const r=new W,s=Math.PI/180,i=t*s,a=e*s,o=n*s,m=Math.cos(i),c=-Math.sin(i),u=Math.cos(a),l=-Math.sin(a),h=Math.cos(o),f=-Math.sin(o),y=u*h,x=-u*f;r.m11=y,r.a=y,r.m12=x,r.b=x,r.m13=l;const p=c*l*h+m*f;r.m21=p,r.c=p;const g=m*h-c*l*f;return r.m22=g,r.d=g,r.m23=-c*u,r.m31=c*f-m*l*h,r.m32=c*h+m*l*f,r.m33=m*u,r}function B(t,e,n,r){const s=new W,i=Math.sqrt(t*t+e*e+n*n);if(0===i)return s;const a=t/i,o=e/i,m=n/i,c=r*(Math.PI/360),u=Math.sin(c),l=Math.cos(c),h=u*u,f=a*a,y=o*o,x=m*m,p=1-2*(y+x)*h;s.m11=p,s.a=p;const g=2*(a*o*h+m*u*l);s.m12=g,s.b=g,s.m13=2*(a*m*h-o*u*l);const d=2*(o*a*h-m*u*l);s.m21=d,s.c=d;const b=1-2*(x+f)*h;return s.m22=b,s.d=b,s.m23=2*(o*m*h+a*u*l),s.m31=2*(m*a*h+o*u*l),s.m32=2*(m*o*h-a*u*l),s.m33=1-2*(f+y)*h,s}function R(t,e,n){const r=new W;return r.m11=t,r.a=t,r.m22=e,r.d=e,r.m33=n,r}function G(t,e){const n=new W;if(t){const e=t*Math.PI/180,r=Math.tan(e);n.m21=r,n.c=r}if(e){const t=e*Math.PI/180,r=Math.tan(t);n.m12=r,n.b=r}return n}function J(t){return G(t,0)}function U(t){return G(0,t)}function K(t,e){return Q([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}class W{constructor(...t){const e=this;if(e.a=1,e.b=0,e.c=0,e.d=1,e.e=0,e.f=0,e.m11=1,e.m12=0,e.m13=0,e.m14=0,e.m21=0,e.m22=1,e.m23=0,e.m24=0,e.m31=0,e.m32=0,e.m33=1,e.m34=0,e.m41=0,e.m42=0,e.m43=0,e.m44=1,t&&t.length){const n=[16,6].some(e=>e===t.length)?t:t[0];return e.setMatrixValue(n)}return e}get isIdentity(){const t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44}get is2D(){const t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44}setMatrixValue(t){return"string"==typeof t&&t.length&&"none"!==t?D(t):[Array,Float64Array,Float32Array].some(e=>t instanceof e)?Q(t):[W,DOMMatrix,Object].some(e=>t instanceof e)?F(t):this}toFloat32Array(t){return Float32Array.from(H(this,t))}toFloat64Array(t){return Float64Array.from(H(this,t))}toString(){const{is2D:t}=this;return`${t?"matrix":"matrix3d"}(${this.toFloat64Array(t).join(", ")})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return K(this,t)}translate(t,e,n){let r=e,s=n;return void 0===r&&(r=0),void 0===s&&(s=0),K(this,X(t,r,s))}scale(t,e,n){let r=e,s=n;return void 0===r&&(r=t),void 0===s&&(s=1),K(this,R(t,r,s))}rotate(t,e,n){let r=t,s=e||0,i=n||0;return"number"==typeof t&&void 0===e&&void 0===n&&(i=r,r=0,s=0),K(this,Y(r,s,i))}rotateAxisAngle(t,e,n,r){if([t,e,n,r].some(t=>Number.isNaN(+t)))throw new TypeError("CSSMatrix: expecting 4 values");return K(this,B(t,e,n,r))}skewX(t){return K(this,J(t))}skewY(t){return K(this,U(t))}skew(t,e){return K(this,G(t,e))}transformPoint(t){const e=this,n=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,r=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,s=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}Object.assign(W,{Translate:X,Rotate:Y,RotateAxisAngle:B,Scale:R,SkewX:J,SkewY:U,Skew:G,Multiply:K,fromArray:Q,fromMatrix:F,fromString:D,toArray:H});function _(t,e,n){const[r,s,i]=n,[a,o,m]=function(t,e){let n=X(...e);return[,,,n.m44]=e,n=t.multiply(n),[n.m41,n.m42,n.m43,n.m44]}(t,[...e,0,1]),c=o-s,u=m-i;return[(a-r)*(Math.abs(i)/Math.abs(u)||1)+r,c*(Math.abs(i)/Math.abs(u)||1)+s]}function tt(e,n){let r,s,i,a,o,m,c=0,l=0;const h=x(e),f=n&&Object.keys(n);if(!n||!f.length)return u(h);const y=A(h);if(!n.origin){const{origin:e}=t;Object.assign(n,{origin:e})}const p=function(t){let e=new W;const{origin:n}=t,[r,s]=n,{translate:i}=t,{rotate:a}=t,{skew:o}=t,{scale:m}=t;return Array.isArray(i)&&i.every(t=>!Number.isNaN(+t))&&i.some(t=>0!==t)?e=e.translate(...i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(a||o||m)&&(e=e.translate(r,s),Array.isArray(a)&&a.every(t=>!Number.isNaN(+t))&&a.some(t=>0!==t)?e=e.rotate(...a):"number"!=typeof a||Number.isNaN(a)||(e=e.rotate(a)),Array.isArray(o)&&o.every(t=>!Number.isNaN(+t))&&o.some(t=>0!==t)?(e=o[0]?e.skewX(o[0]):e,e=o[1]?e.skewY(o[1]):e):"number"!=typeof o||Number.isNaN(o)||(e=e.skewX(o)),Array.isArray(m)&&m.every(t=>!Number.isNaN(+t))&&m.some(t=>1!==t)?e=e.scale(...m):"number"!=typeof m||Number.isNaN(m)||(e=e.scale(m)),e=e.translate(-r,-s)),e}(n),{origin:g}=n,b={...N};let M=[],v=0,w="",C=[];const S=[];if(!p.isIdentity){for(r=0,i=h.length;r<i;r+=1){M=h[r],h[r]&&([w]=M),S[r]=w,"A"===w&&(M=I(y[r],b),h[r]=I(y[r],b),d(h,S,r),y[r]=I(y[r],b),d(y,S,r),i=Math.max(h.length,y.length)),M=y[r],v=M.length,b.x1=+M[v-2],b.y1=+M[v-1],b.x2=+M[v-4]||b.x1,b.y2=+M[v-3]||b.y1;const t={s:h[r],c:h[r][0],x:b.x1,y:b.y1};C=[...C,t]}return C.map(t=>{switch(w=t.c,M=t.s,w){case"L":case"H":case"V":return[o,m]=_(p,[t.x,t.y],g),c!==o&&l!==m?M=["L",o,m]:l===m?M=["H",o]:c===o&&(M=["V",m]),c=o,l=m,M;default:for(s=1,a=M.length;s<a;s+=2)[c,l]=_(p,[+M[s],+M[s+1]],g),M[s]=c,M[s+1]=l;return M}})}return u(h)}function et(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,a=n*s+r*i,o=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(a/o)}function nt(t,e,n,r,s,i,a,o,m,c){const{abs:u,sin:l,cos:h,sqrt:f,PI:y}=Math;let x=u(n),p=u(r);const g=(s%360+360)%360*(y/180);if(t===o&&e===m)return{x:t,y:e};if(0===x||0===p)return $(t,e,o,m,c).point;const d=(t-o)/2,b=(e-m)/2,M=h(g)*d+l(g)*b,N=-l(g)*d+h(g)*b,A=M**2/x**2+N**2/p**2;A>1&&(x*=f(A),p*=f(A));let v=(x**2*p**2-x**2*N**2-p**2*M**2)/(x**2*N**2+p**2*M**2);v=v<0?0:v;const w=(i!==a?1:-1)*f(v),C=w*(x*N/p),S=w*(-p*M/x),k=h(g)*C-l(g)*S+(t+o)/2,P=l(g)*C+h(g)*S+(e+m)/2,T={x:(M-C)/x,y:(N-S)/p},q=et({x:1,y:0},T);let I=et(T,{x:(-M-C)/x,y:(-N-S)/p});!a&&I>0?I-=2*y:a&&I<0&&(I+=2*y),I%=2*y;const V=q+I*c,L=x*h(V),j=p*l(V);return{x:h(g)*L-l(g)*j+k,y:l(g)*L+h(g)*j+P}}function rt(t,e,n,r,s,i,a,o,m,c){const u="number"==typeof c;let l=t,h=e,f=0,y=[l,h,f],x=[l,h],p=0,g={x:0,y:0},d=[{x:l,y:h}];u&&0===c&&(g={x:l,y:h});for(let b=0;b<=300;b+=1){if(p=b/300,({x:l,y:h}=nt(t,e,n,r,s,i,a,o,m,p)),d=[...d,{x:l,y:h}],f+=T(x,[l,h]),x=[l,h],u&&f>c&&c>y[2]){const t=(f-c)/(f-y[2]);g={x:x[0]*(1-t)+y[0]*t,y:x[1]*(1-t)+y[1]*t}}y=[l,h,f]}return u&&c>=f&&(g={x:o,y:m}),{length:f,point:g,min:{x:Math.min(...d.map(t=>t.x)),y:Math.min(...d.map(t=>t.y))},max:{x:Math.max(...d.map(t=>t.x)),y:Math.max(...d.map(t=>t.y))}}}function st(t,e,n,r,s,i,a,o,m){const c=1-m;return{x:c**3*t+3*c**2*m*n+3*c*m**2*s+m**3*a,y:c**3*e+3*c**2*m*r+3*c*m**2*i+m**3*o}}function it(t,e,n,r,s,i,a,o,m){const c="number"==typeof m;let u=t,l=e,h=0,f=[u,l,h],y=[u,l],x=0,p={x:0,y:0},g=[{x:u,y:l}];c&&0===m&&(p={x:u,y:l});for(let d=0;d<=300;d+=1){if(x=d/300,({x:u,y:l}=st(t,e,n,r,s,i,a,o,x)),g=[...g,{x:u,y:l}],h+=T(y,[u,l]),y=[u,l],c&&h>m&&m>f[2]){const t=(h-m)/(h-f[2]);p={x:y[0]*(1-t)+f[0]*t,y:y[1]*(1-t)+f[1]*t}}f=[u,l,h]}return c&&m>=h&&(p={x:a,y:o}),{length:h,point:p,min:{x:Math.min(...g.map(t=>t.x)),y:Math.min(...g.map(t=>t.y))},max:{x:Math.max(...g.map(t=>t.x)),y:Math.max(...g.map(t=>t.y))}}}function at(t,e,n,r,s,i,a){const o=1-a;return{x:o**2*t+2*o*a*n+a**2*s,y:o**2*e+2*o*a*r+a**2*i}}function ot(t,e,n,r,s,i,a){const o="number"==typeof a;let m=t,c=e,u=0,l=[m,c,u],h=[m,c],f=0,y={x:0,y:0},x=[{x:m,y:c}];o&&0===a&&(y={x:m,y:c});for(let p=0;p<=300;p+=1){if(f=p/300,({x:m,y:c}=at(t,e,n,r,s,i,f)),x=[...x,{x:m,y:c}],u+=T(h,[m,c]),h=[m,c],o&&u>a&&a>l[2]){const t=(u-a)/(u-l[2]);y={x:h[0]*(1-t)+l[0]*t,y:h[1]*(1-t)+l[1]*t}}l=[m,c,u]}return o&&a>=u&&(y={x:s,y:i}),{length:u,point:y,min:{x:Math.min(...x.map(t=>t.x)),y:Math.min(...x.map(t=>t.y))},max:{x:Math.max(...x.map(t=>t.x)),y:Math.max(...x.map(t=>t.y))}}}function mt(t,e){const n=A(t),r="number"==typeof e;let s,i=!0,a=[],o="M",m=0,c=0,u=0,l=0,h=[],f=[],y=0,x={x:0,y:0},p=x,g=x,d=x,b=0;for(let t=0,M=n.length;t<M;t+=1)s=n[t],[o]=s,i="M"===o,a=i?a:[m,c,...s.slice(1)],i?([,u,l]=s,x={x:u,y:l},p=x,y=0,r&&e<.001&&(d=x)):"L"===o?({length:y,min:x,max:p,point:g}=$(...a,(e||0)-b)):"A"===o?({length:y,min:x,max:p,point:g}=rt(...a,(e||0)-b)):"C"===o?({length:y,min:x,max:p,point:g}=it(...a,(e||0)-b)):"Q"===o?({length:y,min:x,max:p,point:g}=ot(...a,(e||0)-b)):"Z"===o&&(a=[m,c,u,l],({length:y,min:x,max:p,point:g}=$(...a,(e||0)-b))),r&&b<e&&b+y>=e&&(d=g),f=[...f,p],h=[...h,x],b+=y,[m,c]="Z"!==o?s.slice(-2):[u,l];return r&&e>=b&&(d={x:m,y:c}),{length:b,point:d,min:{x:Math.min(...h.map(t=>t.x)),y:Math.min(...h.map(t=>t.y))},max:{x:Math.max(...f.map(t=>t.x)),y:Math.max(...f.map(t=>t.y))}}}function ct(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const{min:{x:e,y:n},max:{x:r,y:s}}=mt(t),i=r-e,a=s-n;return{width:i,height:a,x:e,y:n,x2:r,y2:s,cx:e+i/2,cy:n+a/2,cz:Math.max(i,a)+Math.min(i,a)/2}}function ut(t){return mt(t).length}function lt(t,e){return mt(t,e).point}Object.assign(W,{Version:"1.0.2"});class ht{constructor(e,n){const s=n||{},i=void 0===e;if(i||!e.length)throw TypeError(`${r}: "pathValue" is ${i?"undefined":"empty"}`);const a=f(e);if("string"==typeof a)throw TypeError(a);this.segments=a;const{width:o,height:m,cx:c,cy:u,cz:l}=this.getBBox();let{round:h,origin:y}=t;const{round:x,origin:p}=s;if("auto"===x){const t=(""+Math.floor(Math.max(o,m))).length;h=t>=4?0:4-t}else(Number.isInteger(x)||"off"===x)&&(h=x);if(Array.isArray(p)&&p.length>=2){const[t,e,n]=p.map(Number);y=[Number.isNaN(t)?c:t,Number.isNaN(e)?u:e,Number.isNaN(n)?l:n]}else y=[c,u,l];return this.round=h,this.origin=y,this}getBBox(){return ct(this.segments)}getTotalLength(){return ut(this.segments)}getPointAtLength(t){return lt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=x(t),this}toRelative(){const{segments:t}=this;return this.segments=g(t),this}toCurve(){const{segments:t}=this;return this.segments=V(t),this}reverse(t){this.toAbsolute();const{segments:e}=this,n=E(e),r=n.length>1?n:0,s=r&&u(r).map((e,n)=>t?n?O(e):f(e):O(e));let i=[];return i=r?s.flat(1):t?e:O(e),this.segments=u(i),this}normalize(){const{segments:t}=this;return this.segments=A(t),this}optimize(){const{segments:t}=this;return this.segments=Z(t,this.round),this}transform(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some(e=>e in t))return this;const e={};Object.keys(t).forEach(n=>{e[n]=Array.isArray(t[n])?[...t[n]]:Number(t[n])});const{segments:n}=this,[r,s,i]=this.origin,{origin:a}=e;if(Array.isArray(a)&&a.length>=2){const[t,n,o]=a.map(Number);e.origin=[Number.isNaN(t)?r:t,Number.isNaN(n)?s:n,o||i]}else e.origin=[r,s,i];return this.segments=tt(n,e),this}flipX(){return this.transform({rotate:[0,180,0]}),this}flipY(){return this.transform({rotate:[180,0,0]}),this}toString(){return j(this.segments,this.round)}}function ft(t){let e=0,n=0,r=0;return V(t).map(t=>{switch(t[0]){case"M":return[,e,n]=t,0;default:return r=function(t,e,n,r,s,i,a,o){return 3*((o-e)*(n+s)-(a-t)*(r+i)+r*(t-s)-n*(e-i)+o*(s+t/3)-a*(i+e/3))/20}(e,n,...t.slice(1)),[e,n]=t.slice(-2),r}}).reduce((t,e)=>t+e,0)}function yt(t,e){const n=f(t);if("string"==typeof n)throw TypeError(n);let r=[...n],s=ut(r),i=r.length-1,a=0,o=0,m=n[0];const[c,u]=m.slice(-2),l={x:c,y:u};if(i<=0||!e||!Number.isFinite(e))return{segment:m,index:0,length:o,point:l,lengthAtSegment:a};if(e>=s)return r=n.slice(0,-1),a=ut(r),o=s-a,{segment:n[i],index:i,length:o,lengthAtSegment:a};const h=[];for(;i>0;)m=r[i],r=r.slice(0,-1),a=ut(r),o=s-a,s=a,h.push({segment:m,index:i,length:o,lengthAtSegment:a}),i-=1;return h.find(({lengthAtSegment:t})=>t<=e)}function xt(t,e){const n=f(t),r=A(n),s=ut(n),i=t=>{const n=t.x-e.x,r=t.y-e.y;return n*n+r*r};let a=8,o={x:0,y:0},m=0,c=o,u=0,l=1/0;for(let t=0;t<=s;t+=a)o=lt(r,t),m=i(o),m<l&&(c=o,u=t,l=m);a/=2;let h={x:0,y:0},y=h,x=0,p=0,g=0,d=0;for(;a>.5;)x=u-a,h=lt(r,x),g=i(h),p=u+a,y=lt(r,p),d=i(y),x>=0&&g<l?(c=h,u=x,l=g):p<=s&&d<l?(c=y,u=p,l=d):a/=2;const b=yt(n,u);return{closest:c,distance:Math.sqrt(l),segment:b}}function pt(t){if("string"!=typeof t)return!1;const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return!e.err.length&&"mM".includes(e.segments[0][0])}const gt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};const dt={CSSMatrix:W,parsePathString:f,isPathArray:h,isCurveArray:w,isAbsoluteArray:y,isRelativeArray:p,isNormalizedArray:M,isValidPath:pt,pathToAbsolute:x,pathToRelative:g,pathToCurve:V,pathToString:j,getDrawDirection:function(t){return ft(V(t))>=0},getPathArea:ft,getPathBBox:ct,pathLengthFactory:mt,getTotalLength:ut,getPointAtLength:lt,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:yt,getSegmentAtLength:function(t,e){return yt(t,e).segment},isPointInStroke:function(t,e){const{distance:n}=xt(t,e);return Math.abs(n)<.001},clonePath:u,splitPath:E,fixPath:v,roundPath:L,optimizePath:Z,reverseCurve:function(t){const e=t.slice(1).map((e,n,r)=>n?[...r[n-1].slice(-2),...e.slice(1)]:[...t[0].slice(1),...e.slice(1)]).map(t=>t.map((e,n)=>t[t.length-n-2*(1-n%2)])).reverse();return[["M",...e[0].slice(0,2)],...e.map(t=>["C",...t.slice(2)])]},reversePath:O,normalizePath:A,transformPath:tt,shapeToPath:function(e,n){const s=Object.keys(gt),{tagName:i}=e;if(i&&!s.some(t=>i===t))throw TypeError(`${r}: "${i}" is not SVGElement`);const a=document.createElementNS("http://www.w3.org/2000/svg","path"),o=i||e.type,m={};m.type=o;const c=gt[o];let u;i?(c.forEach(t=>{m[t]=e.getAttribute(t)}),Object.values(e.attributes).forEach(({name:t,value:e})=>{c.includes(t)||a.setAttribute(t,e)})):(Object.assign(m,e),Object.keys(m).forEach(t=>{c.includes(t)||"type"===t||a.setAttribute(t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),m[t])}));const{round:l}=t;return"circle"===o?u=j(function(t){const{cx:e,cy:n,r:r}=t;return[["M",e-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]}(m),l):"ellipse"===o?u=j(function(t){const{cx:e,cy:n,rx:r,ry:s}=t;return[["M",e-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]}(m),l):["polyline","polygon"].includes(o)?u=j(function(t){const e=[],n=(t.points||"").trim().split(/[\s|,]/).map(Number);let r=0;for(;r<n.length;)e.push([r?"L":"M",n[r],n[r+1]]),r+=2;return"polygon"===t.type?[...e,["z"]]:e}(m),l):"rect"===o?u=j(function(t){const e=+t.x||0,n=+t.y||0,r=+t.width,s=+t.height;let i=+t.rx,a=+t.ry;return i||a?(i=i||a,a=a||i,2*i>r&&(i-=(2*i-r)/2),2*a>s&&(a-=(2*a-s)/2),[["M",e+i,n],["h",r-2*i],["s",i,0,i,a],["v",s-2*a],["s",0,a,-i,a],["h",2*i-r],["s",-i,0,-i,-a],["v",2*a-s],["s",0,-a,i,-a]]):[["M",e,n],["h",r],["v",s],["H",e],["Z"]]}(m),l):"line"===o?u=j(function(t){const{x1:e,y1:n,x2:r,y2:s}=t;return[["M",e,n],["L",r,s]]}(m),l):"glyph"===o&&(u=i?e.getAttribute("d"):e.d),!!pt(u)&&(a.setAttribute("d",u),n&&i&&(e.before(a,e),e.remove()),a)},options:t};return Object.assign(ht,dt,{Version:"1.0.2"}),ht}));
1
+ // SVGPathCommander v1.0.3 | thednp © 2022 | MIT-License
2
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";const t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function n(t){const n=t.pathValue[t.segmentStart],r=n.toLowerCase(),{data:s}=t;for(;s.length>=e[r]&&(t.segments.push([n,...s.splice(0,e[r])]),e[r]););}const r="SVGPathCommander error";function s(t){const{index:e,pathValue:n}=t,s=n.charCodeAt(e);return 48===s?(t.param=0,void(t.index+=1)):49===s?(t.param=1,void(t.index+=1)):void(t.err=`${r}: invalid Arc flag "${n[e]}", expecting 0 or 1 at index ${e}`)}function i(t){return t>=48&&t<=57}function a(t){const{max:e,pathValue:n,index:s}=t;let a,o=s,m=!1,c=!1,u=!1,l=!1;if(o>=e)t.err=`${r}: Invalid path value at index ${o}, "pathValue" is missing param`;else if(a=n.charCodeAt(o),43!==a&&45!==a||(o+=1,a=n.charCodeAt(o)),i(a)||46===a){if(46!==a){if(m=48===a,o+=1,a=n.charCodeAt(o),m&&o<e&&a&&i(a))return void(t.err=`${r}: Invalid path value at index ${s}, "${n[s]}" illegal number`);for(;o<e&&i(n.charCodeAt(o));)o+=1,c=!0;a=n.charCodeAt(o)}if(46===a){for(l=!0,o+=1;i(n.charCodeAt(o));)o+=1,u=!0;a=n.charCodeAt(o)}if(101===a||69===a){if(l&&!c&&!u)return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid float exponent`);if(o+=1,a=n.charCodeAt(o),43!==a&&45!==a||(o+=1),!(o<e&&i(n.charCodeAt(o))))return void(t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" invalid integer exponent`);for(;o<e&&i(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(s,o)}else t.err=`${r}: Invalid path value at index ${o}, "${n[o]}" is not a number`}function o(t){const{pathValue:e,max:n}=t;for(;t.index<n&&(10===(r=e.charCodeAt(t.index))||13===r||8232===r||8233===r||32===r||9===r||11===r||12===r||160===r||r>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(r));)t.index+=1;var r}function m(t){return t>=48&&t<=57||43===t||45===t||46===t}function c(t){const{max:i,pathValue:c,index:u}=t,l=c.charCodeAt(u),h=e[c[u].toLowerCase()];if(t.segmentStart=u,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(l))if(t.index+=1,o(t),t.data=[],h){for(;;){for(let e=h;e>0;e-=1){if(97!=(32|l)||3!==e&&4!==e?a(t):s(t),t.err.length)return;t.data.push(t.param),o(t),t.index<i&&44===c.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!m(c.charCodeAt(t.index)))break}n(t)}else n(t);else t.err=`${r}: Invalid path value "${c[u]}" is not a path command`}function u(t){return t.map(t=>Array.isArray(t)?[...t]:t)}function l(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function h(t){return Array.isArray(t)&&t.every(t=>{const n=t[0].toLowerCase();return e[n]===t.length-1&&"achlmqstvz".includes(n)})}function f(t){if(h(t))return u(t);const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return e.err?e.err:e.segments}function y(t){return h(t)&&t.every(([t])=>t===t.toUpperCase())}function x(t){if(y(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toUpperCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"A":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]+n,e[6]+r];break;case"V":m=[o,e[0]+r];break;case"H":m=[o,e[0]+n];break;default:m=[o,...e.map((t,e)=>t+(e%2?r:n))]}else m=[o,...e];const c=m.length;switch(o){case"Z":n=s,r=i;break;case"H":[,n]=m;break;case"V":[,r]=m;break;default:n=m[c-2],r=m[c-1],"M"===o&&(s=n,i=r)}return m})}function p(t){return h(t)&&t.slice(1).every(([t])=>t===t.toLowerCase())}function g(t){if(p(t))return u(t);const e=f(t);let n=0,r=0,s=0,i=0;return e.map(t=>{const e=t.slice(1).map(Number),[a]=t,o=a.toLowerCase();if("M"===a)return[n,r]=e,s=n,i=r,["M",n,r];let m=[];if(a!==o)switch(o){case"a":m=[o,e[0],e[1],e[2],e[3],e[4],e[5]-n,e[6]-r];break;case"v":m=[o,e[0]-r];break;case"h":m=[o,e[0]-n];break;default:m=[o,...e.map((t,e)=>t-(e%2?r:n))]}else"m"===a&&(s=e[0]+n,i=e[1]+r),m=[o,...e];const c=m.length;switch(o){case"z":n=s,r=i;break;case"h":n+=m[1];break;case"v":r+=m[1];break;default:n+=m[c-2],r+=m[c-1]}return m})}function d(t,e,n){if(t[n].length>7){t[n].shift();const r=t[n];let s=n;for(;r.length;)e[n]="A",t.splice(s+=1,0,["C",...r.splice(0,6)]);t.splice(n,1)}}function b(t,e){const[n]=t,{x1:r,y1:s,x2:i,y2:a}=e,o=t.slice(1).map(Number);let m=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)m=["L",t[1],s];else if("V"===n)m=["L",r,t[1]];else if("S"===n){const t=2*r-i,n=2*s-a;e.x1=t,e.y1=n,m=["C",t,n,...o]}else if("T"===n){const t=2*r-e.qx,n=2*s-e.qy;e.qx=t,e.qy=n,m=["Q",t,n,...o]}else if("Q"===n){const[t,n]=o;e.qx=t,e.qy=n}return m}function M(t){return y(t)&&t.every(([t])=>"ACLMQZ".includes(t))}const N={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function A(t){if(M(t))return u(t);const e=x(t),n={...N},r=[],s=e.length;let i="";for(let t=0;t<s;t+=1){[i]=e[t],r[t]=i,e[t]=b(e[t],n);const s=e[t],a=s.length;n.x1=+s[a-2],n.y1=+s[a-1],n.x2=+s[a-4]||n.x1,n.y2=+s[a-3]||n.y1}return e}function v(t){const e=f(t),n=A(e),{length:r}=e,s="Z"===n.slice(-1)[0][0],i=s?r-2:r-1,[a,o]=n[0].slice(1),[m,c]=n[i].slice(-2);return s&&a===m&&o===c?e.slice(0,-1):e}function w(t){return M(t)&&t.every(([t])=>"MC".includes(t))}function C(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function S(t,e,n,r,s,i,a,o,m,c){let u=t,l=e,h=n,f=r,y=o,x=m;const p=120*Math.PI/180,g=Math.PI/180*(+s||0);let d,b,M,N,A,v=[];if(c)[b,M,N,A]=c;else{d=C(u,l,-g),u=d.x,l=d.y,d=C(y,x,-g),y=d.x,x=d.y;const t=(u-y)/2,e=(l-x)/2;let n=t*t/(h*h)+e*e/(f*f);n>1&&(n=Math.sqrt(n),h*=n,f*=n);const r=h*h,s=f*f,o=(i===a?-1:1)*Math.sqrt(Math.abs((r*s-r*e*e-s*t*t)/(r*e*e+s*t*t)));N=o*h*e/f+(u+y)/2,A=o*-f*t/h+(l+x)/2,b=(Math.asin((l-A)/f)*10**9>>0)/10**9,M=(Math.asin((x-A)/f)*10**9>>0)/10**9,b=u<N?Math.PI-b:b,M=y<N?Math.PI-M:M,b<0&&(b=2*Math.PI+b),M<0&&(M=2*Math.PI+M),a&&b>M&&(b-=2*Math.PI),!a&&M>b&&(M-=2*Math.PI)}let w=M-b;if(Math.abs(w)>p){const t=M,e=y,n=x;M=b+p*(a&&M>b?1:-1),y=N+h*Math.cos(M),x=A+f*Math.sin(M),v=S(y,x,h,f,s,0,a,e,n,[M,t,N,A])}w=M-b;const k=Math.cos(b),P=Math.sin(b),T=Math.cos(M),$=Math.sin(M),q=Math.tan(w/4),I=4/3*h*q,V=4/3*f*q,L=[u,l],j=[u+I*P,l-V*k],O=[y+I*$,x-V*T],E=[y,x];if(j[0]=2*L[0]-j[0],j[1]=2*L[1]-j[1],c)return[...j,...O,...E,...v];v=[...j,...O,...E,...v];const z=[];for(let t=0,e=v.length;t<e;t+=1)z[t]=t%2?C(v[t-1],v[t],g).y:C(v[t],v[t+1],g).x;return z}function k(t,e,n,r,s,i){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*s+2/3*n,1/3*i+2/3*r,s,i]}function P(t,e,n){const[r,s]=t,[i,a]=e;return[r+(i-r)*n,s+(a-s)*n]}function T(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function $(t,e,n,r,s){const i=T([t,e],[n,r]);let a={x:0,y:0};if("number"==typeof s)if(0===s)a={x:t,y:e};else if(s>=i)a={x:n,y:r};else{const[o,m]=P([t,e],[n,r],s/i);a={x:o,y:m}}return{length:i,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function q(t,e,n,r){const s=.5,i=[t,e],a=[n,r],o=P(i,a,s),m=P(a,o,s),c=P(o,m,s),u=P(m,c,s),l=P(c,u,s),h=$(...[...i,...o,...c,...l,s]).point,f=$(...[...l,...u,...m,...a,0]).point;return[h.x,h.y,f.x,f.y,n,r]}function I(t,e){const[n]=t,r=t.slice(1).map(Number),[s,i]=r;let a;const{x1:o,y1:m,x:c,y:u}=e;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=s,e.y=i,t;case"A":return a=[o,m,...r],["C",...S(...a)];case"Q":return e.qx=s,e.qy=i,a=[o,m,...r],["C",...k(...a)];case"L":return["C",...q(o,m,s,i)];case"Z":return["C",...q(o,m,c,u)]}return t}function V(t){if(w(t))return u(t);const e=v(A(t)),n={...N},r=[];let s="",i=e.length;for(let t=0;t<i;t+=1){[s]=e[t],r[t]=s,e[t]=I(e[t],n),d(e,r,t),i=e.length;const a=e[t],o=a.length;n.x1=+a[o-2],n.y1=+a[o-1],n.x2=+a[o-4]||n.x1,n.y2=+a[o-3]||n.y1}return e}function L(e,n){let{round:r}=t;if("off"===n||"off"===r)return u(e);r=n>=0?n:r;const s="number"==typeof r&&r>=1?10**r:1;return e.map(t=>{const e=t.slice(1).map(Number).map(t=>r?Math.round(t*s)/s:Math.round(t));return[t[0],...e]})}function j(t,e){return L(t,e).map(t=>t[0]+t.slice(1).join(" ")).join("")}function O(t){const e=x(t),n="Z"===e.slice(-1)[0][0],r=A(e).map((t,n)=>{const[r,s]=t.slice(-2).map(Number);return{seg:e[n],n:t,c:e[n][0],x:r,y:s}}).map((t,e,r)=>{const s=t.seg,i=t.n,a=e&&r[e-1],o=r[e+1],m=t.c,c=r.length,u=e?r[e-1].x:r[c-1].x,l=e?r[e-1].y:r[c-1].y;let h=[];switch(m){case"M":h=n?["Z"]:[m,u,l];break;case"A":h=[m,...s.slice(1,-3),1===s[5]?0:1,u,l];break;case"C":h=o&&"S"===o.c?["S",s[1],s[2],u,l]:[m,s[3],s[4],s[1],s[2],u,l];break;case"S":h=!a||!"CS".includes(a.c)||o&&"S"===o.c?[m,i[1],i[2],u,l]:["C",i[3],i[4],i[1],i[2],u,l];break;case"Q":h=o&&"T"===o.c?["T",u,l]:[m,...s.slice(1,-2),u,l];break;case"T":h=!a||!"QT".includes(a.c)||o&&"T"===o.c?[m,u,l]:["Q",i[1],i[2],u,l];break;case"Z":h=["M",u,l];break;case"H":h=[m,u];break;case"V":h=[m,l];break;default:h=[m,...s.slice(1,-2),u,l]}return h});return n?r.reverse():[r[0],...r.slice(1).reverse()]}function E(t){const e=[];let n,r=-1;return t.forEach(t=>{"M"===t[0]?(n=[t],r+=1):n=[...n,t],e[r]=n}),e}function z(t,e,n,r){const[s]=t,i=t=>Math.round(1e4*t)/1e4,a=t.slice(1).map(t=>+t),o=e.slice(1).map(t=>+t),{x1:m,y1:c,x2:u,y2:l,x:h,y:f}=n;let y=t;const[x,p]=o.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))y=[s,...a];else if("L"===s)i(h)===i(x)?y=["V",p]:i(f)===i(p)&&(y=["H",x]);else if("C"===s){const[t,e]=o;"CS".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["S",...o.slice(-4)]),n.x1=t,n.y1=e}else if("Q"===s){const[t,e]=o;n.qx=t,n.qy=e,"QT".includes(r)&&(i(t)===i(2*m-u)&&i(e)===i(2*c-l)||i(m)===i(2*u-h)&&i(c)===i(2*l-f))&&(y=["T",...o.slice(-2)])}return y}function Z(t,e){const n=x(t),r=A(n),s={...N},i=[],a=n.length;let o="",m="",c=0,u=0,l=0,h=0;for(let t=0;t<a;t+=1){[o]=n[t],i[t]=o,t&&(m=i[t-1]),n[t]=z(n[t],r[t],s,m);const e=n[t],a=e.length;switch(s.x1=+e[a-2],s.y1=+e[a-1],s.x2=+e[a-4]||s.x1,s.y2=+e[a-3]||s.y1,o){case"Z":c=l,u=h;break;case"H":[,c]=e;break;case"V":[,u]=e;break;default:[c,u]=e.slice(-2).map(Number),"M"===o&&(l=c,h=u)}s.x=c,s.y=u}const f=L(n,e),y=L(g(n),e);return f.map((t,e)=>e?t.join("").length<y[e].join("").length?t:y[e]:t)}function Q(t){const e=new W,n=Array.from(t);if(!n.every(t=>!Number.isNaN(t)))throw TypeError(`CSSMatrix: "${t}" must only have numbers.`);if(16===n.length){const[t,r,s,i,a,o,m,c,u,l,h,f,y,x,p,g]=n;e.m11=t,e.a=t,e.m21=a,e.c=a,e.m31=u,e.m41=y,e.e=y,e.m12=r,e.b=r,e.m22=o,e.d=o,e.m32=l,e.m42=x,e.f=x,e.m13=s,e.m23=m,e.m33=h,e.m43=p,e.m14=i,e.m24=c,e.m34=f,e.m44=g}else{if(6!==n.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");{const[t,r,s,i,a,o]=n;e.m11=t,e.a=t,e.m12=r,e.b=r,e.m21=s,e.c=s,e.m22=i,e.d=i,e.m41=a,e.e=a,e.m42=o,e.f=o}}return e}function F(t){const e=Object.keys(new W);if("object"==typeof t&&e.every(e=>e in t))return Q([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(t)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)}function D(t){if("string"!=typeof t)throw TypeError(`CSSMatrix: "${t}" is not a string.`);const e=String(t).replace(/\s/g,"");let n=new W;const r=`CSSMatrix: invalid transform string "${t}"`;return e.split(")").filter(t=>t).forEach(t=>{const[e,s]=t.split("(");if(!s)throw TypeError(r);const i=s.split(",").map(t=>t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)),[a,o,m,c]=i,u=[a,o,m],l=[a,o,m,c];if("perspective"===e&&a&&[o,m].every(t=>void 0===t))n.m34=-1/a;else if(e.includes("matrix")&&[6,16].includes(i.length)&&i.every(t=>!Number.isNaN(+t))){const t=i.map(t=>Math.abs(t)<1e-6?0:t);n=n.multiply(Q(t))}else if("translate3d"===e&&u.every(t=>!Number.isNaN(+t)))n=n.translate(a,o,m);else if("translate"===e&&a&&void 0===m)n=n.translate(a,o||0,0);else if("rotate3d"===e&&l.every(t=>!Number.isNaN(+t))&&c)n=n.rotateAxisAngle(a,o,m,c);else if("rotate"===e&&a&&[o,m].every(t=>void 0===t))n=n.rotate(0,0,a);else if("scale3d"===e&&u.every(t=>!Number.isNaN(+t))&&u.some(t=>1!==t))n=n.scale(a,o,m);else if("scale"!==e||Number.isNaN(a)||1===a||void 0!==m)if("skew"===e&&(a||!Number.isNaN(a)&&o)&&void 0===m)n=n.skew(a,o||0);else{if(!(/[XYZ]/.test(e)&&a&&[o,m].every(t=>void 0===t)&&["translate","rotate","scale","skew"].some(t=>e.includes(t))))throw TypeError(r);if(["skewX","skewY"].includes(e))n=n[e](a);else{const t=e.replace(/[XYZ]/,""),r=e.replace(t,""),s=["X","Y","Z"].indexOf(r),i="scale"===t?1:0,o=[0===s?a:i,1===s?a:i,2===s?a:i];n=n[t](...o)}}else{const t=Number.isNaN(+o)?a:o;n=n.scale(a,t,1)}}),n}function H(t,e){return e?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]}function X(t,e,n){const r=new W;return r.m41=t,r.e=t,r.m42=e,r.f=e,r.m43=n,r}function Y(t,e,n){const r=new W,s=Math.PI/180,i=t*s,a=e*s,o=n*s,m=Math.cos(i),c=-Math.sin(i),u=Math.cos(a),l=-Math.sin(a),h=Math.cos(o),f=-Math.sin(o),y=u*h,x=-u*f;r.m11=y,r.a=y,r.m12=x,r.b=x,r.m13=l;const p=c*l*h+m*f;r.m21=p,r.c=p;const g=m*h-c*l*f;return r.m22=g,r.d=g,r.m23=-c*u,r.m31=c*f-m*l*h,r.m32=c*h+m*l*f,r.m33=m*u,r}function B(t,e,n,r){const s=new W,i=Math.sqrt(t*t+e*e+n*n);if(0===i)return s;const a=t/i,o=e/i,m=n/i,c=r*(Math.PI/360),u=Math.sin(c),l=Math.cos(c),h=u*u,f=a*a,y=o*o,x=m*m,p=1-2*(y+x)*h;s.m11=p,s.a=p;const g=2*(a*o*h+m*u*l);s.m12=g,s.b=g,s.m13=2*(a*m*h-o*u*l);const d=2*(o*a*h-m*u*l);s.m21=d,s.c=d;const b=1-2*(x+f)*h;return s.m22=b,s.d=b,s.m23=2*(o*m*h+a*u*l),s.m31=2*(m*a*h+o*u*l),s.m32=2*(m*o*h-a*u*l),s.m33=1-2*(f+y)*h,s}function R(t,e,n){const r=new W;return r.m11=t,r.a=t,r.m22=e,r.d=e,r.m33=n,r}function G(t,e){const n=new W;if(t){const e=t*Math.PI/180,r=Math.tan(e);n.m21=r,n.c=r}if(e){const t=e*Math.PI/180,r=Math.tan(t);n.m12=r,n.b=r}return n}function J(t){return G(t,0)}function U(t){return G(0,t)}function K(t,e){return Q([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}class W{constructor(...t){const e=this;if(e.a=1,e.b=0,e.c=0,e.d=1,e.e=0,e.f=0,e.m11=1,e.m12=0,e.m13=0,e.m14=0,e.m21=0,e.m22=1,e.m23=0,e.m24=0,e.m31=0,e.m32=0,e.m33=1,e.m34=0,e.m41=0,e.m42=0,e.m43=0,e.m44=1,t.length){const n=[16,6].some(e=>e===t.length)?t:t[0];return e.setMatrixValue(n)}return e}get isIdentity(){const t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44}get is2D(){const t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44}setMatrixValue(t){return"string"==typeof t&&t.length&&"none"!==t?D(t):[Array,Float64Array,Float32Array].some(e=>t instanceof e)?Q(t):[W,DOMMatrix,Object].some(e=>t instanceof e)?F(t):this}toFloat32Array(t){return Float32Array.from(H(this,t))}toFloat64Array(t){return Float64Array.from(H(this,t))}toString(){const{is2D:t}=this;return`${t?"matrix":"matrix3d"}(${this.toFloat64Array(t).join(", ")})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return K(this,t)}translate(t,e,n){let r=e,s=n;return void 0===r&&(r=0),void 0===s&&(s=0),K(this,X(t,r,s))}scale(t,e,n){let r=e,s=n;return void 0===r&&(r=t),void 0===s&&(s=1),K(this,R(t,r,s))}rotate(t,e,n){let r=t,s=e||0,i=n||0;return"number"==typeof t&&void 0===e&&void 0===n&&(i=r,r=0,s=0),K(this,Y(r,s,i))}rotateAxisAngle(t,e,n,r){if([t,e,n,r].some(t=>Number.isNaN(+t)))throw new TypeError("CSSMatrix: expecting 4 values");return K(this,B(t,e,n,r))}skewX(t){return K(this,J(t))}skewY(t){return K(this,U(t))}skew(t,e){return K(this,G(t,e))}transformPoint(t){const e=this,n=e.m11*t.x+e.m21*t.y+e.m31*t.z+e.m41*t.w,r=e.m12*t.x+e.m22*t.y+e.m32*t.z+e.m42*t.w,s=e.m13*t.x+e.m23*t.y+e.m33*t.z+e.m43*t.w,i=e.m14*t.x+e.m24*t.y+e.m34*t.z+e.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}Object.assign(W,{Translate:X,Rotate:Y,RotateAxisAngle:B,Scale:R,SkewX:J,SkewY:U,Skew:G,Multiply:K,fromArray:Q,fromMatrix:F,fromString:D,toArray:H});function _(t,e,n){const[r,s,i]=n,[a,o,m]=function(t,e){let n=X(...e);return[,,,n.m44]=e,n=t.multiply(n),[n.m41,n.m42,n.m43,n.m44]}(t,[...e,0,1]),c=o-s,u=m-i;return[(a-r)*(Math.abs(i)/Math.abs(u)||1)+r,c*(Math.abs(i)/Math.abs(u)||1)+s]}function tt(e,n){let r,s,i,a,o,m,c=0,l=0;const h=x(e),f=n&&Object.keys(n);if(!n||!f.length)return u(h);const y=A(h);if(!n.origin){const{origin:e}=t;Object.assign(n,{origin:e})}const p=function(t){let e=new W;const{origin:n}=t,[r,s]=n,{translate:i}=t,{rotate:a}=t,{skew:o}=t,{scale:m}=t;return Array.isArray(i)&&i.every(t=>!Number.isNaN(+t))&&i.some(t=>0!==t)?e=e.translate(...i):"number"!=typeof i||Number.isNaN(i)||(e=e.translate(i)),(a||o||m)&&(e=e.translate(r,s),Array.isArray(a)&&a.every(t=>!Number.isNaN(+t))&&a.some(t=>0!==t)?e=e.rotate(...a):"number"!=typeof a||Number.isNaN(a)||(e=e.rotate(a)),Array.isArray(o)&&o.every(t=>!Number.isNaN(+t))&&o.some(t=>0!==t)?(e=o[0]?e.skewX(o[0]):e,e=o[1]?e.skewY(o[1]):e):"number"!=typeof o||Number.isNaN(o)||(e=e.skewX(o)),Array.isArray(m)&&m.every(t=>!Number.isNaN(+t))&&m.some(t=>1!==t)?e=e.scale(...m):"number"!=typeof m||Number.isNaN(m)||(e=e.scale(m)),e=e.translate(-r,-s)),e}(n),{origin:g}=n,b={...N};let M=[],v=0,w="",C=[];const S=[];if(!p.isIdentity){for(r=0,i=h.length;r<i;r+=1){M=h[r],h[r]&&([w]=M),S[r]=w,"A"===w&&(M=I(y[r],b),h[r]=I(y[r],b),d(h,S,r),y[r]=I(y[r],b),d(y,S,r),i=Math.max(h.length,y.length)),M=y[r],v=M.length,b.x1=+M[v-2],b.y1=+M[v-1],b.x2=+M[v-4]||b.x1,b.y2=+M[v-3]||b.y1;const t={s:h[r],c:h[r][0],x:b.x1,y:b.y1};C=[...C,t]}return C.map(t=>{switch(w=t.c,M=t.s,w){case"L":case"H":case"V":return[o,m]=_(p,[t.x,t.y],g),c!==o&&l!==m?M=["L",o,m]:l===m?M=["H",o]:c===o&&(M=["V",m]),c=o,l=m,M;default:for(s=1,a=M.length;s<a;s+=2)[c,l]=_(p,[+M[s],+M[s+1]],g),M[s]=c,M[s+1]=l;return M}})}return u(h)}function et(t,e){const{x:n,y:r}=t,{x:s,y:i}=e,a=n*s+r*i,o=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(a/o)}function nt(t,e,n,r,s,i,a,o,m,c){const{abs:u,sin:l,cos:h,sqrt:f,PI:y}=Math;let x=u(n),p=u(r);const g=(s%360+360)%360*(y/180);if(t===o&&e===m)return{x:t,y:e};if(0===x||0===p)return $(t,e,o,m,c).point;const d=(t-o)/2,b=(e-m)/2,M=h(g)*d+l(g)*b,N=-l(g)*d+h(g)*b,A=M**2/x**2+N**2/p**2;A>1&&(x*=f(A),p*=f(A));let v=(x**2*p**2-x**2*N**2-p**2*M**2)/(x**2*N**2+p**2*M**2);v=v<0?0:v;const w=(i!==a?1:-1)*f(v),C=w*(x*N/p),S=w*(-p*M/x),k=h(g)*C-l(g)*S+(t+o)/2,P=l(g)*C+h(g)*S+(e+m)/2,T={x:(M-C)/x,y:(N-S)/p},q=et({x:1,y:0},T);let I=et(T,{x:(-M-C)/x,y:(-N-S)/p});!a&&I>0?I-=2*y:a&&I<0&&(I+=2*y),I%=2*y;const V=q+I*c,L=x*h(V),j=p*l(V);return{x:h(g)*L-l(g)*j+k,y:l(g)*L+h(g)*j+P}}function rt(t,e,n,r,s,i,a,o,m,c){const u="number"==typeof c;let l=t,h=e,f=0,y=[l,h,f],x=[l,h],p=0,g={x:0,y:0},d=[{x:l,y:h}];u&&0===c&&(g={x:l,y:h});for(let b=0;b<=300;b+=1){if(p=b/300,({x:l,y:h}=nt(t,e,n,r,s,i,a,o,m,p)),d=[...d,{x:l,y:h}],f+=T(x,[l,h]),x=[l,h],u&&f>c&&c>y[2]){const t=(f-c)/(f-y[2]);g={x:x[0]*(1-t)+y[0]*t,y:x[1]*(1-t)+y[1]*t}}y=[l,h,f]}return u&&c>=f&&(g={x:o,y:m}),{length:f,point:g,min:{x:Math.min(...d.map(t=>t.x)),y:Math.min(...d.map(t=>t.y))},max:{x:Math.max(...d.map(t=>t.x)),y:Math.max(...d.map(t=>t.y))}}}function st(t,e,n,r,s,i,a,o,m){const c=1-m;return{x:c**3*t+3*c**2*m*n+3*c*m**2*s+m**3*a,y:c**3*e+3*c**2*m*r+3*c*m**2*i+m**3*o}}function it(t,e,n,r,s,i,a,o,m){const c="number"==typeof m;let u=t,l=e,h=0,f=[u,l,h],y=[u,l],x=0,p={x:0,y:0},g=[{x:u,y:l}];c&&0===m&&(p={x:u,y:l});for(let d=0;d<=300;d+=1){if(x=d/300,({x:u,y:l}=st(t,e,n,r,s,i,a,o,x)),g=[...g,{x:u,y:l}],h+=T(y,[u,l]),y=[u,l],c&&h>m&&m>f[2]){const t=(h-m)/(h-f[2]);p={x:y[0]*(1-t)+f[0]*t,y:y[1]*(1-t)+f[1]*t}}f=[u,l,h]}return c&&m>=h&&(p={x:a,y:o}),{length:h,point:p,min:{x:Math.min(...g.map(t=>t.x)),y:Math.min(...g.map(t=>t.y))},max:{x:Math.max(...g.map(t=>t.x)),y:Math.max(...g.map(t=>t.y))}}}function at(t,e,n,r,s,i,a){const o=1-a;return{x:o**2*t+2*o*a*n+a**2*s,y:o**2*e+2*o*a*r+a**2*i}}function ot(t,e,n,r,s,i,a){const o="number"==typeof a;let m=t,c=e,u=0,l=[m,c,u],h=[m,c],f=0,y={x:0,y:0},x=[{x:m,y:c}];o&&0===a&&(y={x:m,y:c});for(let p=0;p<=300;p+=1){if(f=p/300,({x:m,y:c}=at(t,e,n,r,s,i,f)),x=[...x,{x:m,y:c}],u+=T(h,[m,c]),h=[m,c],o&&u>a&&a>l[2]){const t=(u-a)/(u-l[2]);y={x:h[0]*(1-t)+l[0]*t,y:h[1]*(1-t)+l[1]*t}}l=[m,c,u]}return o&&a>=u&&(y={x:s,y:i}),{length:u,point:y,min:{x:Math.min(...x.map(t=>t.x)),y:Math.min(...x.map(t=>t.y))},max:{x:Math.max(...x.map(t=>t.x)),y:Math.max(...x.map(t=>t.y))}}}function mt(t,e){const n=A(t),r="number"==typeof e;let s,i,a,o=[],m=0,c=0,u=0,l=0,h=[],f=[],y=0,x={x:0,y:0},p=x,g=x,d=x,b=0;for(let t=0,M=n.length;t<M;t+=1)a=n[t],[i]=a,s="M"===i,o=s?o:[m,c,...a.slice(1)],s?([,u,l]=a,x={x:u,y:l},p=x,y=0,r&&e<.001&&(d=x)):"L"===i?({length:y,min:x,max:p,point:g}=$(...o,(e||0)-b)):"A"===i?({length:y,min:x,max:p,point:g}=rt(...o,(e||0)-b)):"C"===i?({length:y,min:x,max:p,point:g}=it(...o,(e||0)-b)):"Q"===i?({length:y,min:x,max:p,point:g}=ot(...o,(e||0)-b)):"Z"===i&&(o=[m,c,u,l],({length:y,min:x,max:p,point:g}=$(...o,(e||0)-b))),r&&b<e&&b+y>=e&&(d=g),f=[...f,p],h=[...h,x],b+=y,[m,c]="Z"!==i?a.slice(-2):[u,l];return r&&e>=b&&(d={x:m,y:c}),{length:b,point:d,min:{x:Math.min(...h.map(t=>t.x)),y:Math.min(...h.map(t=>t.y))},max:{x:Math.max(...f.map(t=>t.x)),y:Math.max(...f.map(t=>t.y))}}}function ct(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const{min:{x:e,y:n},max:{x:r,y:s}}=mt(t),i=r-e,a=s-n;return{width:i,height:a,x:e,y:n,x2:r,y2:s,cx:e+i/2,cy:n+a/2,cz:Math.max(i,a)+Math.min(i,a)/2}}function ut(t){return mt(t).length}function lt(t,e){return mt(t,e).point}Object.assign(W,{Version:"1.0.3"});class ht{constructor(e,n){const s=n||{},i=void 0===e;if(i||!e.length)throw TypeError(`${r}: "pathValue" is ${i?"undefined":"empty"}`);const a=f(e);if("string"==typeof a)throw TypeError(a);this.segments=a;const{width:o,height:m,cx:c,cy:u,cz:l}=this.getBBox(),{round:h,origin:y}=s;let x,p;if("auto"===h){const t=(""+Math.floor(Math.max(o,m))).length;x=t>=4?0:4-t}else Number.isInteger(h)||"off"===h?x=h:({round:x}=t);if(Array.isArray(y)&&y.length>=2){const[t,e,n]=y.map(Number);p=[Number.isNaN(t)?c:t,Number.isNaN(e)?u:e,Number.isNaN(n)?l:n]}else p=[c,u,l];return this.round=x,this.origin=p,this}getBBox(){return ct(this.segments)}getTotalLength(){return ut(this.segments)}getPointAtLength(t){return lt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=x(t),this}toRelative(){const{segments:t}=this;return this.segments=g(t),this}toCurve(){const{segments:t}=this;return this.segments=V(t),this}reverse(t){this.toAbsolute();const{segments:e}=this,n=E(e),r=n.length>1?n:0,s=r&&u(r).map((e,n)=>t?n?O(e):f(e):O(e));let i=[];return i=r?s.flat(1):t?e:O(e),this.segments=u(i),this}normalize(){const{segments:t}=this;return this.segments=A(t),this}optimize(){const{segments:t}=this;return this.segments=Z(t,this.round),this}transform(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some(e=>e in t))return this;const e={};Object.keys(t).forEach(n=>{e[n]=Array.isArray(t[n])?[...t[n]]:Number(t[n])});const{segments:n}=this,[r,s,i]=this.origin,{origin:a}=e;if(Array.isArray(a)&&a.length>=2){const[t,n,o]=a.map(Number);e.origin=[Number.isNaN(t)?r:t,Number.isNaN(n)?s:n,o||i]}else e.origin=[r,s,i];return this.segments=tt(n,e),this}flipX(){return this.transform({rotate:[0,180,0]}),this}flipY(){return this.transform({rotate:[180,0,0]}),this}toString(){return j(this.segments,this.round)}}function ft(t){let e=0,n=0,r=0;return V(t).map(t=>{switch(t[0]){case"M":return[,e,n]=t,0;default:return r=function(t,e,n,r,s,i,a,o){return 3*((o-e)*(n+s)-(a-t)*(r+i)+r*(t-s)-n*(e-i)+o*(s+t/3)-a*(i+e/3))/20}(e,n,...t.slice(1)),[e,n]=t.slice(-2),r}}).reduce((t,e)=>t+e,0)}function yt(t,e){const n=f(t);if("string"==typeof n)throw TypeError(n);let r=[...n],s=ut(r),i=r.length-1,a=0,o=0,m=n[0];const[c,u]=m.slice(-2),l={x:c,y:u};if(i<=0||!e||!Number.isFinite(e))return{segment:m,index:0,length:o,point:l,lengthAtSegment:a};if(e>=s)return r=n.slice(0,-1),a=ut(r),o=s-a,{segment:n[i],index:i,length:o,lengthAtSegment:a};const h=[];for(;i>0;)m=r[i],r=r.slice(0,-1),a=ut(r),o=s-a,s=a,h.push({segment:m,index:i,length:o,lengthAtSegment:a}),i-=1;return h.find(({lengthAtSegment:t})=>t<=e)}function xt(t,e){const n=f(t),r=A(n),s=ut(n),i=t=>{const n=t.x-e.x,r=t.y-e.y;return n*n+r*r};let a=8,o={x:0,y:0},m=0,c=o,u=0,l=1/0;for(let t=0;t<=s;t+=a)o=lt(r,t),m=i(o),m<l&&(c=o,u=t,l=m);a/=2;let h,y={x:0,y:0},x=0,p=0,g=0,d=0;for(;a>.5;)x=u-a,y=lt(r,x),g=i(y),p=u+a,h=lt(r,p),d=i(h),x>=0&&g<l?(c=y,u=x,l=g):p<=s&&d<l?(c=h,u=p,l=d):a/=2;const b=yt(n,u);return{closest:c,distance:Math.sqrt(l),segment:b}}function pt(t){if("string"!=typeof t)return!1;const e=new l(t);for(o(e);e.index<e.max&&!e.err.length;)c(e);return!e.err.length&&"mM".includes(e.segments[0][0])}const gt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]};const dt={CSSMatrix:W,parsePathString:f,isPathArray:h,isCurveArray:w,isAbsoluteArray:y,isRelativeArray:p,isNormalizedArray:M,isValidPath:pt,pathToAbsolute:x,pathToRelative:g,pathToCurve:V,pathToString:j,getDrawDirection:function(t){return ft(V(t))>=0},getPathArea:ft,getPathBBox:ct,pathLengthFactory:mt,getTotalLength:ut,getPointAtLength:lt,getClosestPoint:function(t,e){return xt(t,e).closest},getSegmentOfPoint:function(t,e){return xt(t,e).segment},getPropertiesAtPoint:xt,getPropertiesAtLength:yt,getSegmentAtLength:function(t,e){return yt(t,e).segment},isPointInStroke:function(t,e){const{distance:n}=xt(t,e);return Math.abs(n)<.001},clonePath:u,splitPath:E,fixPath:v,roundPath:L,optimizePath:Z,reverseCurve:function(t){const e=t.slice(1).map((e,n,r)=>n?[...r[n-1].slice(-2),...e.slice(1)]:[...t[0].slice(1),...e.slice(1)]).map(t=>t.map((e,n)=>t[t.length-n-2*(1-n%2)])).reverse();return[["M",...e[0].slice(0,2)],...e.map(t=>["C",...t.slice(2)])]},reversePath:O,normalizePath:A,transformPath:tt,shapeToPath:function(e,n){const s=Object.keys(gt),{tagName:i}=e;if(i&&!s.some(t=>i===t))throw TypeError(`${r}: "${i}" is not SVGElement`);const a=document.createElementNS("http://www.w3.org/2000/svg","path"),o=i||e.type,m={};m.type=o;const c=gt[o];let u;i?(c.forEach(t=>{m[t]=e.getAttribute(t)}),Object.values(e.attributes).forEach(({name:t,value:e})=>{c.includes(t)||a.setAttribute(t,e)})):(Object.assign(m,e),Object.keys(m).forEach(t=>{c.includes(t)||"type"===t||a.setAttribute(t.replace(/[A-Z]/g,t=>"-"+t.toLowerCase()),m[t])}));const{round:l}=t;return"circle"===o?u=j(function(t){const{cx:e,cy:n,r:r}=t;return[["M",e-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]}(m),l):"ellipse"===o?u=j(function(t){const{cx:e,cy:n,rx:r,ry:s}=t;return[["M",e-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]}(m),l):["polyline","polygon"].includes(o)?u=j(function(t){const e=[],n=(t.points||"").trim().split(/[\s|,]/).map(Number);let r=0;for(;r<n.length;)e.push([r?"L":"M",n[r],n[r+1]]),r+=2;return"polygon"===t.type?[...e,["z"]]:e}(m),l):"rect"===o?u=j(function(t){const e=+t.x||0,n=+t.y||0,r=+t.width,s=+t.height;let i=+t.rx,a=+t.ry;return i||a?(i=i||a,a=a||i,2*i>r&&(i-=(2*i-r)/2),2*a>s&&(a-=(2*a-s)/2),[["M",e+i,n],["h",r-2*i],["s",i,0,i,a],["v",s-2*a],["s",0,a,-i,a],["h",2*i-r],["s",-i,0,-i,-a],["v",2*a-s],["s",0,-a,i,-a]]):[["M",e,n],["h",r],["v",s],["H",e],["Z"]]}(m),l):"line"===o?u=j(function(t){const{x1:e,y1:n,x2:r,y2:s}=t;return[["M",e,n],["L",r,s]]}(m),l):"glyph"===o&&(u=i?e.getAttribute("d"):e.d),!!pt(u)&&(a.setAttribute("d",u),n&&i&&(e.before(a,e),e.remove()),a)},options:t};return Object.assign(ht,dt,{Version:"1.0.3"}),ht}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-path-commander",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "ES6+ JavaScript tools for SVG processing and converting path data",
5
5
  "main": "dist/svg-path-commander.min.js",
6
6
  "module": "dist/svg-path-commander.esm.js",
@@ -58,7 +58,7 @@
58
58
  "@rollup/plugin-buble": "^0.21.3",
59
59
  "@rollup/plugin-json": "^4.1.0",
60
60
  "@rollup/plugin-node-resolve": "^7.1.3",
61
- "cypress": "^9.6.0",
61
+ "cypress": "^9.6.1",
62
62
  "esbuild": "^0.14.30",
63
63
  "eslint": "^7.22.0",
64
64
  "eslint-config-airbnb-base": "^14.2.1",
@@ -74,6 +74,6 @@
74
74
  "typescript": "^4.5.2"
75
75
  },
76
76
  "dependencies": {
77
- "dommatrix": "^1.0.2"
77
+ "dommatrix": "^1.0.3"
78
78
  }
79
79
  }
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ /** @typedef {import('../types/index')} */
2
+
1
3
  import SVGPathCommander from './svg-path-commander';
2
4
  import Util from './util/util';
3
5
  import Version from './version';
@@ -24,7 +24,7 @@ export default function reversePath(pathInput) {
24
24
  const segment = seg.seg;
25
25
  const data = seg.n;
26
26
  const prevSeg = i && path[i - 1];
27
- const nextSeg = path[i + 1] && path[i + 1];
27
+ const nextSeg = path[i + 1];
28
28
  const pathCommand = seg.c;
29
29
  const pLen = path.length;
30
30
  /** @type {number} */
@@ -48,7 +48,7 @@ export default function reversePath(pathInput) {
48
48
  }
49
49
  break;
50
50
  case 'S':
51
- if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'S'))) {
51
+ if ((prevSeg && 'CS'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'S')) {
52
52
  result = ['C', data[3], data[4], data[1], data[2], x, y];
53
53
  } else {
54
54
  result = [pathCommand, data[1], data[2], x, y];
@@ -62,7 +62,7 @@ export default function reversePath(pathInput) {
62
62
  }
63
63
  break;
64
64
  case 'T':
65
- if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || (nextSeg && nextSeg.c !== 'T'))) {
65
+ if ((prevSeg && 'QT'.includes(prevSeg.c)) && (!nextSeg || nextSeg.c !== 'T')) {
66
66
  result = ['Q', data[1], data[2], x, y];
67
67
  } else {
68
68
  result = [pathCommand, x, y];
@@ -60,17 +60,21 @@ class SVGPathCommander {
60
60
  } = this.getBBox();
61
61
 
62
62
  // set instance options.round
63
- let { round, origin } = defaultOptions;
64
63
  const { round: roundOption, origin: originOption } = instanceOptions;
64
+ let round;
65
65
 
66
66
  if (roundOption === 'auto') {
67
67
  const pathScale = (`${Math.floor(Math.max(width, height))}`).length;
68
68
  round = pathScale >= 4 ? 0 : 4 - pathScale;
69
69
  } else if (Number.isInteger(roundOption) || roundOption === 'off') {
70
70
  round = roundOption;
71
+ } else {
72
+ ({ round } = defaultOptions);
71
73
  }
72
74
 
73
75
  // set instance options.origin
76
+ // the SVGPathCommander class will always override the default origin
77
+ let origin;
74
78
  if (Array.isArray(originOption) && originOption.length >= 2) {
75
79
  const [originX, originY, originZ] = originOption.map(Number);
76
80
  origin = [
@@ -82,10 +86,9 @@ class SVGPathCommander {
82
86
  origin = [cx, cy, cz];
83
87
  }
84
88
 
85
- /**
86
- * @type {number | 'off'}
87
- */
89
+ /** @type {number | 'off'} */
88
90
  this.round = round;
91
+ /** @type {[number, number, number=]} */
89
92
  this.origin = origin;
90
93
 
91
94
  return this;
@@ -44,7 +44,7 @@ export default function getPropertiesAtPoint(pathInput, point) {
44
44
  // binary search for precise estimate
45
45
  precision /= 2;
46
46
  let before = { x: 0, y: 0 };
47
- let after = before;
47
+ let after;
48
48
  let beforeLength = 0;
49
49
  let afterLength = 0;
50
50
  let beforeDistance = 0;
@@ -17,10 +17,9 @@ import segmentQuadFactory from './segmentQuadFactory';
17
17
  export default function pathLengthFactory(pathInput, distance) {
18
18
  const path = normalizePath(pathInput);
19
19
  const distanceIsNumber = typeof distance === 'number';
20
- let isM = true;
21
- /** @type {number[]} */
20
+ let isM;
22
21
  let data = [];
23
- let pathCommand = 'M';
22
+ let pathCommand;
24
23
  let x = 0;
25
24
  let y = 0;
26
25
  let mx = 0;
package/src/util/util.js CHANGED
@@ -1,9 +1,3 @@
1
- /**
2
- * Must have at least one import of the main namespace.
3
- * @typedef {import('../../types/index')}
4
- * @typedef {import('../types/index')}
5
- */
6
-
7
1
  import CSSMatrix from 'dommatrix';
8
2
  import defaultOptions from '../options/options';
9
3
  import getPathBBox from './getPathBBox';