svg-path-simplify 0.2.7 → 0.3.0
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.
- package/README.md +50 -5
- package/dist/svg-path-simplify.esm.js +2 -4
- package/dist/svg-path-simplify.esm.min.js +4 -4
- package/dist/svg-path-simplify.js +2 -4
- package/dist/svg-path-simplify.min.js +1 -1
- package/dist/svg-path-simplify.pathdata.esm.js +5094 -0
- package/dist/svg-path-simplify.pathdata.esm.min.js +9 -0
- package/dist/svg-path-simplify.worker.js +1 -36
- package/package.json +1 -1
- package/src/index-pathdata.js +6 -0
- package/src/pathData_simplify_cubic_extrapolate.js +3 -2
- package/src/pathSimplify-only-pathdata.js +274 -0
- package/dist/svg-path-simplify.min.js.gz +0 -0
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Unlike most existing approaches (e.g in graphic applications), it checks where s
|
|
|
32
32
|
* adaptive coordinate rounding: small or large details can be auto-detected to find a suitable floating point accuracy without guessing the decimal value (3 decimals may not be the silver bullet=)
|
|
33
33
|
* split segments at extremes – only useful for manual editing
|
|
34
34
|
* optimize either path data strings or SVG markup code
|
|
35
|
+
* create curves from polylines (curve-fitting)
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
## TOC
|
|
@@ -41,13 +42,15 @@ Unlike most existing approaches (e.g in graphic applications), it checks where s
|
|
|
41
42
|
- [ESM version](#esm-version)
|
|
42
43
|
+ [node.js](#nodejs)
|
|
43
44
|
- [Example 2: Apply options](#example-2-apply-options)
|
|
44
|
-
+ [
|
|
45
|
+
+ [Web worker](#web-worker)
|
|
46
|
+
* [API](#api)
|
|
45
47
|
+ [Simplification parameters](#simplification-parameters)
|
|
46
48
|
+ [Advanced simplifications](#advanced-simplifications)
|
|
47
49
|
+ [Output options](#output-options)
|
|
48
50
|
+ [SVG scaling](#svg-scaling)
|
|
49
51
|
+ [SVG output optimizations](#svg-output-optimizations)
|
|
50
52
|
+ [SVG input normalization](#svg-input-normalization)
|
|
53
|
+
* [Lite version](#lite-version–only-path-data)
|
|
51
54
|
* [Demos](#demos)
|
|
52
55
|
+ [Web app](#web-app)
|
|
53
56
|
+ [Demo files](#demo-files)
|
|
@@ -117,7 +120,7 @@ npm install svg-path-simplify
|
|
|
117
120
|
|
|
118
121
|
To simplify entire SVG documents in node.js we need to emulate the browsers DOM methods `DOMParser` and `XMLSerializer`. I opted for [linkedom](https://github.com/WebReflection/linkedom). Just make sure to import the `svg-path-simplify/node` module. It will load linkedom's methods `DOMParser` and add a polyfill for `XMLSerializer`
|
|
119
122
|
|
|
120
|
-
```
|
|
123
|
+
```js
|
|
121
124
|
/**
|
|
122
125
|
* load node polyfills for DOM parsing
|
|
123
126
|
* loads linkedom npm module for DOM parsing and emulation
|
|
@@ -131,10 +134,22 @@ let pathDataString = `M 57.13 15.5c 13.28 0 24.53 8.67 28.42 20.65c 0.94 2.91 1
|
|
|
131
134
|
let pathDataOpt = svgPathSimplify(pathDataString);
|
|
132
135
|
```
|
|
133
136
|
|
|
137
|
+
### Web worker
|
|
138
|
+
Similar to node.js usage we need [linkedom](https://github.com/WebReflection/linkedom) to polyfill missing DOMParser functionality in a headless environment.
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
import './svg-path-simplify.worker.polyfills.js';
|
|
142
|
+
import { svgPathSimplify } from './svg-path-simplify.esm.js';
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Import the polyfill module from the dist folder. It imports the worker version of linkedom.
|
|
146
|
+
See [svg-path-simplify.worker.js](https://github.com/herrstrietzel/svg-path-simplify/blob/main/dist/svg-path-simplify.worker.js).
|
|
147
|
+
|
|
148
|
+
|
|
134
149
|
#### Example 2: Apply options
|
|
135
150
|
The following example would return a detailed object containing the stringified "normalized" pathdata (all absolute and "longhand" command notation).
|
|
136
151
|
|
|
137
|
-
```
|
|
152
|
+
```js
|
|
138
153
|
let options = {
|
|
139
154
|
extrapolateDominant: false,
|
|
140
155
|
decimals: 3,
|
|
@@ -200,9 +215,9 @@ Z
|
|
|
200
215
|
|
|
201
216
|
|
|
202
217
|
|
|
203
|
-
|
|
218
|
+
## API
|
|
204
219
|
|
|
205
|
-
```
|
|
220
|
+
```js
|
|
206
221
|
let options = {}
|
|
207
222
|
let output = svgPathSimplify(input, options);
|
|
208
223
|
```
|
|
@@ -290,6 +305,36 @@ Scaling only indirectly affects file size analogous to rounding. Use it only for
|
|
|
290
305
|
| stylesToAttributes | consolidates styles and set them to attributes. Also removes invalid attributes (e.g `font-family` for paths) | Boolean | false |
|
|
291
306
|
|
|
292
307
|
|
|
308
|
+
## Lite version – only path data
|
|
309
|
+
Since the library aims at a complete toolset it might be an overkill for your needs.
|
|
310
|
+
For this use case you can opt for the lighter pathdata only version »svg-path-simplify.pathdata.esm.min«. Minified filesize is ~41 KB / 17 KB gzipped (compared to the full library with ~72/27 KB)
|
|
311
|
+
|
|
312
|
+
The API is compatible but simply missing some options such as:
|
|
313
|
+
* polygon smoothing/curve fitting
|
|
314
|
+
* svg processing - only path data is allowed
|
|
315
|
+
* no scaling
|
|
316
|
+
* no path direction fixes
|
|
317
|
+
|
|
318
|
+
```js
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
import { simplifyPathData } from '../dist/svg-path-simplify.pathdata.esm.js'
|
|
322
|
+
|
|
323
|
+
let pathDataString =
|
|
324
|
+
`
|
|
325
|
+
M 57.13 15.5
|
|
326
|
+
c 13.28 0 24.53 8.67 28.42 20.65
|
|
327
|
+
c 0.94 2.91 1.45 6.01 1.45 9.23
|
|
328
|
+
`
|
|
329
|
+
// try to simplify
|
|
330
|
+
let pathDataOpt = simplifyPathData(pathDataString);
|
|
331
|
+
|
|
332
|
+
/*
|
|
333
|
+
or with options let pathDataOpt = simplifyPathData(pathDataString, options);
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
|
|
293
338
|
|
|
294
339
|
|
|
295
340
|
## Demos
|
|
@@ -2034,8 +2034,6 @@ function getCombinedByDominant(com1, com2, maxDist = 0, tolerance = 1, debug = f
|
|
|
2034
2034
|
return commands;
|
|
2035
2035
|
}
|
|
2036
2036
|
|
|
2037
|
-
if (debug) renderPoint(markers, ptM, 'purple');
|
|
2038
|
-
|
|
2039
2037
|
result.cp1 = cp1_2;
|
|
2040
2038
|
result.cp2 = cp2_2;
|
|
2041
2039
|
|
|
@@ -2098,8 +2096,8 @@ function getCombinedByDominant(com1, com2, maxDist = 0, tolerance = 1, debug = f
|
|
|
2098
2096
|
result.error = areaDiff * 5 * tolerance;
|
|
2099
2097
|
|
|
2100
2098
|
if (debug) {
|
|
2101
|
-
|
|
2102
|
-
|
|
2099
|
+
pathDataToD(pathDataN);
|
|
2100
|
+
|
|
2103
2101
|
}
|
|
2104
2102
|
|
|
2105
2103
|
// success!!!
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function e(e,t,a="red",l="1%",n="1",r="",s=!0,i="",o=""){Array.isArray(t)&&(t={x:t[0],y:t[1]});let u=`<circle class="${o}" opacity="${n}" id="${i}" cx="${t.x}" cy="${t.y}" r="${l}" fill="${a}">\n <title>${r}</title></circle>`;if(!s)return u;e.insertAdjacentHTML("beforeend",u)}function t(e,t="",a="green",l="1%",n="1",r=!0){let s=`<path d="${t}" fill="none" stroke="${a}" stroke-width="${l}" stroke-opacity="${n}" /> `;if(!r)return s;e.insertAdjacentHTML("beforeend",s)}const{abs:a,acos:l,asin:n,atan:r,atan2:s,ceil:i,cos:o,exp:u,floor:p,log:h,hypot:y,max:c,min:x,pow:f,random:g,round:m,sin:d,sqrt:v,tan:M,PI:b}=Math,{abs:A,acos:w,asin:C,atan:k,atan2:L,ceil:P,cos:E,exp:S,floor:T,log:I,max:D,min:F,pow:$,random:z,round:q,sin:j,sqrt:Q,tan:B,PI:N}=Math;function G(e,t,a=!1){let l=L(t.y-e.y,t.x-e.x);return a&&l<0&&(l+=2*Math.PI),l}function U(e,t,a,l=!1){let n=Math.atan2(t.y-e.y,t.x-e.x),r=Math.atan2(a.y-e.y,a.x-e.x),s=r-n;s=(e=>{let t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<=-Math.PI&&(t+=2*Math.PI),t})(s),l&&(s=2*Math.PI-Math.abs(s));let i=180/Math.PI;return{startAngle:n,endAngle:r,deltaAngle:s,startAngleDeg:n*i,endAngleDeg:r*i,deltaAngleDeg:s*i}}function O(e=null,t=null,a=null,l=null,n=!0,r=!1,s=!1){let i,o,u,p,h,y={};if(!(e&&t&&a&&l))return s&&console.warn("points missing"),!1;try{if(i=(l.y-a.y)*(t.x-e.x)-(l.x-a.x)*(t.y-e.y),0===i)return!1}catch{return s&&console.warn("!catch",e,t,"p3:",a,"p4:",l),!1}o=e.y-a.y,u=e.x-a.x,p=(l.x-a.x)*o-(l.y-a.y)*u,h=(t.x-e.x)*o-(t.y-e.y)*u,o=p/i,u=h/i,y={x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)};let c=!1;return o>0&&o<1&&u>0&&u<1&&(c=!0),!n&&r&&(o>0&&u<0||o<0&&u>0)?(c=!1,!1):!(n&&!c)&&y}function Z(e,t,a,l=!1){const n=(e,t,a)=>e>=t&&e<=a||e<=t&&e>=a;let r=!1;if((!l||!a.bottom)&&(a.left>e.x||a.top>e.y||a.bottom<e.y||a.right<e.x))return!1;let s=t.length;for(let a=s-1,l=0;l<s;a=l,l++){const s=t[a],i=t[l];if(e.x==s.x&&e.y==s.y||e.x==i.x&&e.y==i.y)return!0;if(s.y==i.y&&e.y==s.y&&n(e.x,s.x,i.x))return!0;if(n(e.y,s.y,i.y)){if(e.y==s.y&&i.y>=s.y||e.y==i.y&&s.y>=i.y)continue;const t=(s.x-e.x)*(i.y-e.y)-(i.x-e.x)*(s.y-e.y);if(0==t)return!0;s.y<i.y==t>0&&(r=!r)}}return!!r}function H(e,t,a,l=!1){let n={x:(t.x-e.x)*a+e.x,y:(t.y-e.y)*a+e.y};return l&&(n.angle=G(e,t),n.angle<0&&(n.angle+=2*N)),n}function R(e,t=.5,a=!1,l=!1,n=!1){let r;return Array.isArray(e[0])&&(e=e.map(e=>({x:e[0],y:e[1]})),n=!0),r=e.length>2?((e,t,a=!1)=>{let n=4===e.length,r=e[0],s=e[1],i=n?e[2]:e[1],o=e[e.length-1],u={x:0,y:0};if(a||l){let e,a,p,h,y,c=r.x===s.x&&r.y===s.y,x=o.x===i.x&&o.y===i.y;0!==t||c?1!==t||x?(c&&(t+=1e-7),x&&(t-=1e-7),e=H(r,s,t),n?(a=H(s,i,t),p=H(i,o,t),h=H(e,a,t),y=H(a,p,t),u=H(h,y,t),u.angle=G(h,y),l&&(u.cpts=[a,p,h,y])):(a=H(r,s,t),p=H(s,o,t),u=H(a,p,t),u.angle=G(a,p),l&&(u.cpts=[a,p]))):(u.x=o.x,u.y=o.y,u.angle=G(i,o)):(u.x=r.x,u.y=r.y,u.angle=G(r,s))}else{let e=1-t;u=n?{x:e**3*r.x+3*e**2*t*s.x+3*e*t**2*i.x+t**3*o.x,y:e**3*r.y+3*e**2*t*s.y+3*e*t**2*i.y+t**3*o.y}:{x:e*e*r.x+2*e*t*s.x+t**2*o.x,y:e*e*r.y+2*e*t*s.y+t**2*o.y}}return u})(e,t,a):H(e[0],e[1],t,a),a&&r.angle<0&&(r.angle+=2*N),n?[r.x,r.y]:r}function W(e){let t=[],a={x:e[0].values[0],y:e[0].values[1]};return e.forEach(e=>{let{type:l,values:n}=e;if(n.length){let e=n.length>1?{x:n[n.length-2],y:n[n.length-1]}:"V"===l?{x:a.x,y:n[0]}:{x:n[0],y:a.y};t.push(e),a=e}}),t}function V(e,t,a,l,n,r,s,i,o){const u=(e,t,a,l)=>L(l-t,a-e);let p={cx:0,cy:0,rx:a=A(a),ry:l=A(l),startAngle:0,endAngle:0,deltaAngle:0,clockwise:s,xAxisRotation:n,largeArc:r,sweep:s};if(0==a||0==l)throw Error("rx and ry can not be 0");if(a===l){let a=Math.abs(i-e),l=Math.abs(o-t),n=a,r=Math.min(e,i),u=Math.min(t,o),h=.5*Math.PI;if(0===a&&l||0===l&&a)return n=0===a&&l?l/2:a/2,p.rx=n,p.ry=n,0===a&&l?(p.cx=e,p.cy=u+l/2,p.startAngle=t>o?h:-h,p.endAngle=t>o?-h:h,p.deltaAngle=s?Math.PI:-Math.PI):0===l&&a&&(p.cx=r+a/2,p.cy=t,p.startAngle=e>i?Math.PI:0,p.endAngle=e>i?-Math.PI:Math.PI,p.deltaAngle=s?Math.PI:-Math.PI),p}let h,y,c=a===l?0:n*N/180,x=c?Math.sin(c):0,f=c?Math.cos(c):1,g=(e-i)/2,m=(t-o)/2,d=(e+i)/2,v=(t+o)/2,M=c?f*g+x*m:g,b=c?f*m-x*g:m,w=M*M/(a*a)+b*b/(l*l);w>1&&(a*=Math.sqrt(w),l*=Math.sqrt(w),p.rx=a,p.ry=l);let C=a*l,k=a*b,P=l*M,E=k**2+P**2;if(!E)throw Error("start point can not be same as end point");let S=Math.sqrt(Math.abs((C*C-E)/E));r==s&&(S=-S);let T=S*k/l,I=-S*P/a;h=c?f*T-x*I+d:d+T,y=c?x*T+f*I+v:v+I,p.cy=y,p.cx=h;let D=u(h,y,e,t),F=u(h,y,i,o);!s&&F>D&&(F-=2*Math.PI),s&&D>F&&(F=F<=0?F+2*Math.PI:F);let $=F-D;return p.startAngle=D,p.endAngle=F,p.deltaAngle=$,p}function J(e,t,a,l=0,n=!1){return l?(l=n?l/180*Math.PI:l,{x:t+(e.x-t)*Math.cos(l)-(e.y-a)*Math.sin(l),y:a+(e.x-t)*Math.sin(l)+(e.y-a)*Math.cos(l)}):e}function X(e,t,a,l,n,r=0,s=!0,i=!1){if(n=i?n*N/180:n,r=i?r*N/180:r,r=a!==l&&r!==2*N?r:0,s&&a!==l){let e=k(B(n=r?n-r:n)*(a/l));n=E(n)<0?e+N:e}let o=e+a*E(n),u=t+l*j(n),p={x:o,y:u};return r&&(p.x=e+(o-e)*E(r)-(u-t)*j(r),p.y=t+(o-e)*j(r)+(u-t)*E(r)),p}function Y(e,t,a){if(t===a||e%N*.5==0)return e;let l=k(B(e)*(t/a));return l=E(e)<0?l+N:l,l}function _(e=null,t=[]){e||(e=t[0],t=t.slice(1,t.length));let a=t.length,l=t[a-1],n=t[0],r=3===a?t[1]:n,s=Math.min(e.y,l.y),i=Math.min(e.x,l.x),o=Math.max(e.x,l.x),u=Math.max(e.y,l.y);return!(n.y>=s&&n.y<=u&&r.y>=s&&r.y<=u&&n.x>=i&&n.x<=o&&r.x>=i&&r.x<=o)}function K(e,{addExtremes:t=!0,addSemiExtremes:a=!1}={}){let l=4===e.length?function(e,t,a,l,{addExtremes:n=!0,addSemiExtremes:r=!1}={}){const s=e=>{const t=Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};r&&(e=s(e),t=s(t),a=s(a),l=s(l));let[i,o,u,p,h,y,c,x]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],f=Math.min(e.y,l.y),g=Math.min(e.x,l.x),m=Math.max(e.x,l.x),d=Math.max(e.y,l.y);if(t.y>=f&&t.y<=d&&a.y>=f&&a.y<=d&&t.x>=g&&t.x<=m&&a.x>=g&&a.x<=m)return[];let v,M,b,A,w,C,k,L,P=[];for(let e=0;e<2;++e)if(0==e?(M=6*i-12*u+6*h,v=-3*i+9*u-9*h+3*c,b=3*u-3*i):(M=6*o-12*p+6*y,v=-3*o+9*p-9*y+3*x,b=3*p-3*o),Math.abs(v)<1e-8){if(Math.abs(M)<1e-8)continue;A=-b/M,0<A&&A<1&&P.push(A)}else k=M*M-4*b*v,k<0?Math.abs(k)<1e-8&&(A=-M/(2*v),0<A&&A<1&&P.push(A)):(L=Math.sqrt(k),w=(-M+L)/(2*v),0<w&&w<1&&P.push(w),C=(-M-L)/(2*v),0<C&&C<1&&P.push(C));let E=P.length;for(;E--;)A=P[E];return P}(e[0],e[1],e[2],e[3],{addExtremes:t,addSemiExtremes:a}):function(e,t,a,{addExtremes:l=!0,addSemiExtremes:n=!1}={}){const r=e=>{const t=-Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};n&&(e=r(e),t=r(t),a=r(a));let s,i,o,u=Math.min(e.y,a.y),p=Math.min(e.x,a.x),h=Math.max(e.x,a.x),y=Math.max(e.y,a.y);if(t.y>=u&&t.y<=y&&t.x>=p&&t.x<=h)return[];let[c,x,f,g,m,d]=[e.x,e.y,t.x,t.y,a.x,a.y],v=[];for(let e=0;e<2;++e)s=0==e?c-2*f+m:x-2*g+d,i=0==e?-2*c+2*f:-2*x+2*g,Math.abs(s)>1e-12&&(o=-i/(2*s),o>0&&o<1&&v.push(o));return v}(e[0],e[1],e[2],{addExtremes:t,addSemiExtremes:a});return l}function ee(e,t){const a=(e,t,a,l,n,r)=>{var s=Math.cos(r),i=Math.sin(r),o=l*Math.cos(e),u=n*Math.sin(e);return{x:t+s*o-i*u,y:a+i*o+s*u}};let l,n,r,s,i,o=V(e.x,e.y,t[0],t[1],t[2],t[3],t[4],t[5],t[6]),{rx:u,ry:p,cx:h,cy:y,endAngle:c,deltaAngle:x}=o,f=t[2],g={x:t[5],y:t[6]},m=[g],d=f*Math.PI/180,v=Math.tan(d);i=Math.atan2(-p*v,u);let M=i,b=i+Math.PI,A=Math.atan2(p,u*v),w=A+Math.PI,C=[e.x,g.x],k=[e.y,g.y],L=Math.min(...C),P=Math.max(...C),E=Math.min(...k),S=Math.max(...k),T=a(c-.001*x,h,y,u,p,d),I=a(c-.999*x,h,y,u,p,d);return(T.x>P||I.x>P)&&(l=a(M,h,y,u,p,d),m.push(l)),(T.x<L||I.x<L)&&(n=a(b,h,y,u,p,d),m.push(n)),(T.y<E||I.y<E)&&(s=a(w,h,y,u,p,d),m.push(s)),(T.y>S||I.y>S)&&(r=a(A,h,y,u,p,d),m.push(r)),m}function te(e=[],t=[]){let a=e.length,l=4===a;t.length||(t=[0]);let n=t.length,r=[];for(let s=0;s<n;s++){let n=t[s],i=n?[]:e.slice(0);if(n)for(let t=0;t<a;t++){let a=e[t];i.push(J(a,0,0,n))}let o=l?ae(...i):le(...i);r.push(...o)}return r=[...new Set(r)].sort(),r}function ae(e,t,a,l){if(!_(e,[t,a,l]))return[];let n,r,s,i,o,u,p,h,[y,c,x,f,g,m,d,v]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],M=[],b=1e-8;for(let e=0;e<2;++e)if(0==e?(r=6*y-12*x+6*g,n=-3*y+9*x-9*g+3*d,s=3*x-3*y):(r=6*c-12*f+6*m,n=-3*c+9*f-9*m+3*v,s=3*f-3*c),Math.abs(n)<b){if(Math.abs(r)<b)continue;i=-s/r,i>0&&i<1&&M.push(i)}else p=r*r-4*s*n,p<0?Math.abs(p)<b&&(i=-r/(2*n),i>0&&i<1&&M.push(i)):(h=Math.sqrt(p),o=(-r+h)/(2*n),o>0&&o<1&&M.push(o),u=(-r-h)/(2*n),u>0&&u<1&&M.push(u));let A=M.length;for(;A--;)i=M[A];return[...new Set(M)].sort()}function le(e,t,a){if(!_(e,[t,a]))return[];let l,n,r,[s,i,o,u,p,h]=[e.x,e.y,t.x,t.y,a.x,a.y],y=[];for(let e=0;e<2;++e)l=0==e?s-2*o+p:i-2*u+h,n=0==e?-2*s+2*o:-2*i+2*u,Math.abs(l)>1e-12&&(r=-n/(2*l),r>0&&r<1&&y.push(r));return[...new Set(y)].sort()}function ne(e,t=.001){let a=Math.PI/2,l=a/2;return!(Math.abs(e/a-Math.round(e/a))<t)&&Math.abs(e/l-Math.round(e/l))<t}function re(e,t,a=!1){let l=a?t[0]-e[0]:t.x-e.x,n=a?t[1]-e[1]:t.y-e.y;return Q(l*l+n*n)}function se(e,t){let a=t.x-e.x,l=t.y-e.y;return a*a+l*l}function ie(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function oe(e,t){return.5*(Math.abs(t.x-e.x)+Math.abs(t.y-e.y))}function ue(e,t=48){if(!Array.isArray(e)||e.length<=t)return e;let a=e.length,l=a/t,n=[];for(let a=0;a<t;a++)n.push(e[Math.floor(a*l)]);let r=n.length;return n[r-1]!==e[a-1]&&(n[r-1]=e[a-1]),n}function pe(e){let t=[],a=[e[0]],l=e.length;for(let n=1;n<l;n++){let l=e[n];"M"!==l.type&&"m"!==l.type||(t.push(a),a=[]),a.push(l)}return a.length&&t.push(a),t}function he(e,t){let a,l,n,r,s,i,o=[],u=[],p=e[0],h=e[1],y=e[e.length-2],c=e[e.length-1];return 4===e.length?(a=R([p,h],t),l=R([h,y],t),n=R([y,c],t),r=R([a,l],t),s=R([l,n],t),i=R([r,s],t),o.push({x:p.x,y:p.y},{x:a.x,y:a.y},{x:r.x,y:r.y},{x:i.x,y:i.y}),u.push({x:i.x,y:i.y},{x:s.x,y:s.y},{x:n.x,y:n.y},{x:c.x,y:c.y})):3===e.length?(l=R([p,h],t),n=R([h,c],t),i=R([l,n],t),o.push({x:p.x,y:p.y},{x:l.x,y:l.y},{x:i.x,y:i.y}),u.push({x:i.x,y:i.y},{x:n.x,y:n.y},{x:c.x,y:c.y})):2===e.length&&(l=R([p,c],t),o.push({x:p.x,y:p.y},{x:l.x,y:l.y}),u.push({x:l.x,y:l.y},{x:c.x,y:c.y})),[o,u]}function ye(e,t,{tMin:a=0,tMax:l=1,addExtremes:n=!0,addSemiExtremes:r=!1}={}){let s=[],i=6===t.length?"C":"Q",o={x:t[0],y:t[1]},u="C"===i?{x:t[2],y:t[3]}:o,p={x:t[4],y:t[5]},h=0;let y="C"===i?[e,o,u,p]:[e,o,p],c=n?K(y,{addExtremes:n,addSemiExtremes:!1}):[],x=r?K(y,{addExtremes:n,addSemiExtremes:r}):[],f=Array.from(new Set([...c,...x])).sort();if(f=f.filter(e=>e>0&&e<1),f.length){let a=function(e,t,a,l=!0){let n=[];if(!a.length)return!1;let r,s,i,o=t.length,u={x:t[o-2],y:t[o-1]};2===t.length?i=[e,u]:4===t.length?(r={x:t[0],y:t[1]},i=[e,r,u]):6===t.length&&(r={x:t[0],y:t[1]},s={x:t[2],y:t[3]},i=[e,r,s,u]);if(a.length)if(1===a.length){let e=he(i,a[0]),t=e[0],l=e[1];n.push(t,l)}else{let e=a[0],t=he(i,e),l=t[0];n.push(l),i=t[1];for(let t=1;t<a.length;t++){e=a[t-1];let l=he(i,(a[t]-e)/(1-e));n.push(l[0]),t===a.length-1&&n.push(l[l.length-1]),i=l[1]}}if(l){let e,t,a=[];return n.forEach(l=>{e={type:"",values:[]},l.shift(),t=l.map(e=>Object.values(e)).flat(),e.values=t,3===l.length?e.type="C":2===l.length?e.type="Q":1===l.length&&(e.type="L"),a.push(e)}),a}return n}(e,t,f);s.push(...a),h+=a.length}else s.push({type:i,values:t});return{pathData:s,count:h}}function ce(e,{tMin:t=0,tMax:a=1,addExtremes:l=!0,addSemiExtremes:n=!1}={}){let r=[e[0]],s={x:e[0].values[0],y:e[0].values[1]},i={x:e[0].values[0],y:e[0].values[1]},o=e.length;for(let u=1;o&&u<o;u++){let o=e[u],{type:p,values:h}=o,y=h.slice(-2);if(y[0],y[1],"C"!==p&&"Q"!==p)r.push(o);else if((l||n)&&("C"===p||"Q"===p)){let e=ye(s,h,{tMin:t,tMax:a,addExtremes:l,addSemiExtremes:n}).pathData;r.push(...e)}s={x:y[0],y:y[1]},"z"===p.toLowerCase()?s=i:"M"===p&&(i={x:y[0],y:y[1]})}return r}function xe(e,t=-1){let a=e.map(e=>e.x),l=e.map(e=>e.y),n=Math.min(...a),r=Math.max(...a),s=Math.min(...l),i=Math.max(...l),o={x:n,left:n,right:r,y:s,top:s,bottom:i,width:r-n,height:i-s};if(t>-1)for(let e in o)o[e]=+o[e].toFixed(t);return o}function fe(e){let t=[];return e.forEach(e=>{let a=function(e){let t=function(e){let t=[];for(let a=0;a<e.length;a++){let l=e[a],n=a>0?e[a-1]:e[a],{type:r,values:s}=l,i={x:n.values[n.values.length-2],y:n.values[n.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",u=s.length?{x:s[0],y:s[1]}:"";switch(r){case"A":if("function"!=typeof arcToBezier){let e=re(i,o)/2,a=H(i,o,.5),l=X(a.x,a.y,e,e,0),n=X(a.x,a.y,e,e,Math.PI);t.push(l,n,o);break}arcToBezier(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},n={x:a[2],y:a[3]},r={x:a[4],y:a[5]};t.push(l,n,r)});break;case"C":let e={x:s[2],y:s[3]};t.push(u,e);break;case"Q":t.push(u)}"z"!==r.toLowerCase()&&t.push(o)}return t}(e),a=xe(t);return a}(e);t.push(a)}),t}function ge(e,t){let[a,l,n,r,s,i]=[e.x,e.y,e.width,e.height,e.x+e.width,e.y+e.height],[o,u,p,h,y,c]=[t.x,t.y,t.width,t.height,t.x+t.width,t.y+t.height],x=!1;return n*r!=p*h&&n*r>p*h&&a<o&&s>y&&l<u&&i>c&&(x=!0),x}function me(e,t=9){let a=0,l=[],n=pe(e),r=n.length>1,s=[];if(r){let e=fe(n);e.forEach(function(t,a){for(let a=0;a<e.length;a++){let l=e[a];if(t!=l){ge(t,l)&&s.push(a)}}})}return n.forEach((e,t)=>{l=[];let n=0,r=0,i=1,o=[];e.forEach(function(t,a){let[r,s]=[t.type,t.values],i=s.length;if(s.length){let u=(a>0?e[a-1]:e[0]).values,p=u.length,h={x:u[p-2],y:u[p-1]},y={x:s[i-2],y:s[i-1]};if("C"===r||"Q"===r){let e={x:s[0],y:s[1]};o="C"===r?[h,e,{x:s[2],y:s[3]},y]:[h,e,y];let t=Math.abs(function(e,t=!1){let a,[l,n,r,s]=[e[0],e[1],e[2],e[e.length-1]];if(e.length<3)return 0;3===e.length&&(n={x:1*e[0].x/3+2*e[1].x/3,y:1*e[0].y/3+2*e[1].y/3},r={x:1*e[2].x/3+2*e[1].x/3,y:1*e[2].y/3+2*e[1].y/3});return a=3*(l.x*(-2*n.y-r.y+3*s.y)+n.x*(2*l.y-r.y-s.y)+r.x*(l.y+n.y-2*s.y)+s.x*(-3*l.y+n.y+2*r.y))/20,t?Math.abs(a):a}(o));n+=t,l.push(h,y)}else if("A"===r){let e=V(h.x,h.y,t.values[0],t.values[1],t.values[2],t.values[3],t.values[4],y.x,y.y),{cx:a,cy:r,rx:s,ry:i,startAngle:o,endAngle:u,deltaAngle:p}=e,c=Math.abs(function(e,t,a,l){const n=Math.PI*e*t;let r=(l-a+2*Math.PI)%(2*Math.PI);if(e===t)return n*(r/(2*Math.PI));const s=a=>Math.atan2(e*Math.sin(a),t*Math.cos(a));return a=s(a),l=s(l),r=(l-a+2*Math.PI)%(2*Math.PI),n*(r/(2*Math.PI))}(s,i,o,u));c-=Math.abs(de([h,{x:a,y:r},y])),l.push(h,y),n+=c}else l.push(h,y)}});let u=de(l);-1!==s.indexOf(t)&&(i=-1),r=u<0&&n<0?(Math.abs(n)-Math.abs(u))*i:(Math.abs(n)+Math.abs(u))*i,a+=r}),a}function de(e,t=!1){let a=0,l=e.length;for(let t=0;l&&t<l;t++){a+=e[t].x*e[t===e.length-1?0:t+1].y*.5-e[t===e.length-1?0:t+1].x*e[t].y*.5}return t&&(a=Math.abs(a)),a}function ve(e,t=0){t=parseFloat(t);let a=e.length,l=t>1,n=!l&&!t,r="",s=l?"\n":n?"":" ",i=n?"":" ";r=`${e[0].type}${i}${e[0].values.join(" ")}${s}`;for(let t=1;t<a;t++){let a=e[t-1],l=e[t],{type:o,values:u}=l;if(!n||"A"!==o&&"a"!==o||(u=[u[0],u[1],u[2],`${u[3]}${u[4]}${u[5]}`,u[6]]),o=n&&a.type===l.type&&"m"!==l.type.toLowerCase()||n&&"M"===a.type&&"L"===l.type?" ":l.type,n){let e="",t=!1;for(let a=0,l=u.length;a<l;a++){let l=u[a],n=l.toString(),r=n.includes(".")&&Math.abs(l)<1;r&&t&&(n=n.replace(/^0\./,".")),!(a>0)||t&&r||(e+=" "),e+=n,t=r}r+=`${o}${i}${e}${s}`}else r+=`${o}${i}${u.join(" ")}${s}`}return n&&(r=r.replace(/ 0\./g," .").replace(/ -/g,"-").replace(/-0\./g,"-.").replace(/Z/g,"z")),r}function Me(a,l,n=0,r=1,s=!1){const i=(e,t,a,l,n)=>{let r=1-n;return{x:3*r*r*(t.x-e.x)+6*r*n*(a.x-t.x)+3*n*n*(l.x-a.x),y:3*r*r*(t.y-e.y)+6*r*n*(a.y-t.y)+3*n*n*(l.y-a.y)}};let o=[a,l],u=oe(a.p0,a.p)>oe(l.p0,l.p),p=JSON.parse(JSON.stringify(a)),h=JSON.parse(JSON.stringify(l)),y=O(p.p0,p.cp1,h.p,h.cp2,!1);if(!y)return o;if(u){let e={p0:{x:a.p.x,y:a.p.y},cp1:{x:a.cp2.x,y:a.cp2.y},cp2:{x:a.cp1.x,y:a.cp1.y},p:{x:a.p0.x,y:a.p0.y}};a={p0:{x:l.p.x,y:l.p.y},cp1:{x:l.cp2.x,y:l.cp2.y},cp2:{x:l.cp1.x,y:l.cp1.y},p:{x:l.p0.x,y:l.p0.y}},l=e}let c=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),x=(e,t)=>({x:e.x*t,y:e.y*t}),f=(e,t)=>e.x*t.x+e.y*t.y,g=l.p0,m=i(l.p0,l.cp1,l.cp2,l.p,0),d=f(c(a.p0,g),m)/f(m,m),v=R([l.p0,l.cp1,l.cp2,l.p],d),M=i(l.p0,l.cp1,l.cp2,l.p,d);d-=f(c(v,a.p0),M)/f(M,M);let b=R([l.p0,l.cp1,l.cp2,l.p],d),A=l.p,w=i(l.p0,l.cp1,l.cp2,l.p,d),C=i(l.p0,l.cp1,l.cp2,l.p,1),k=1-d,L=(P=b,E=x(w,k/3),{x:P.x+E.x,y:P.y+E.y});var P,E;let S=c(A,x(C,k/3)),T={p0:b,cp1:L,cp2:S,p:A,t0:d};u&&(T={p0:A,cp1:S,cp2:L,p:b,t0:d});let I=.5*(1-d),D=R([T.p0,T.cp1,T.cp2,T.p],I,!1,!0),F=D.cpts[2],$=O(D,F,T.p0,y,!1),z=O(D,F,T.p,y,!1),q=H(T.p0,$,1.333),j=H(T.p,z,1.333);if(O(p.p0,q,h.p,j,!0))return o;s&&e(markers,D,"purple"),T.cp1=q,T.cp2=j;let Q=oe(p.p0,T.p0)+oe(h.p,T.p);if(T.p0=p.p0,T.p=h.p,T.extreme=h.extreme,T.corner=h.corner,T.dimA=h.dimA,T.directionChange=h.directionChange,T.type="C",T.values=[T.cp1.x,T.cp1.y,T.cp2.x,T.cp2.y,T.p.x,T.p.y],Q<n){let e=u?1+d:Math.abs(d),l=1+Math.abs(d);if(e=u?1+d:Math.abs(d)/l,oe(R([T.p0,T.cp1,T.cp2,T.p],e),a.p)>n*r)return o;let i=me([{type:"M",values:[p.p0.x,p.p0.y]},{type:"C",values:[p.cp1.x,p.cp1.y,p.cp2.x,p.cp2.y,p.p.x,p.p.y]},{type:"C",values:[h.cp1.x,h.cp1.y,h.cp2.x,h.cp2.y,h.p.x,h.p.y]}]),y=[{type:"M",values:[T.p0.x,T.p0.y]},{type:"C",values:[T.cp1.x,T.cp1.y,T.cp2.x,T.cp2.y,T.p.x,T.p.y]}],c=me(y),x=Math.abs(c/i-1);if(T.error=5*x*r,s){let e=ve(y);t(markers,e,"orange")}x<.05*r&&(o=[T])}return o}function be(e,{keepExtremes:t=!0,keepInflections:a=!0,keepCorners:l=!0,extrapolateDominant:n=!0,tolerance:r=1}={}){let s=[e[0]],i=e.length;for(let n=2;i&&n<=i;n++){let o=e[n-1],u=n<i?e[n]:null,p=u?.type||null,{type:h,values:y,p0:c,p:x,cp1:f=null,cp2:g=null,extreme:m=!1,directionChange:d=!1,corner:v=!1,dimA:M=0}=o;if("C"===h&&"C"===p)if(l&&v||t&&m)s.push(o);else{let p=Ae(o,u,{tolerance:r}),h=0;
|
|
1
|
+
function e(e,t,a="red",l="1%",n="1",r="",s=!0,i="",o=""){Array.isArray(t)&&(t={x:t[0],y:t[1]});let u=`<circle class="${o}" opacity="${n}" id="${i}" cx="${t.x}" cy="${t.y}" r="${l}" fill="${a}">\n <title>${r}</title></circle>`;if(!s)return u;e.insertAdjacentHTML("beforeend",u)}function t(e,t="",a="green",l="1%",n="1",r=!0){let s=`<path d="${t}" fill="none" stroke="${a}" stroke-width="${l}" stroke-opacity="${n}" /> `;if(!r)return s;e.insertAdjacentHTML("beforeend",s)}const{abs:a,acos:l,asin:n,atan:r,atan2:s,ceil:i,cos:o,exp:u,floor:p,log:h,hypot:y,max:c,min:x,pow:f,random:g,round:d,sin:m,sqrt:v,tan:M,PI:b}=Math,{abs:A,acos:w,asin:C,atan:k,atan2:L,ceil:P,cos:E,exp:S,floor:T,log:I,max:D,min:F,pow:$,random:z,round:q,sin:j,sqrt:Q,tan:B,PI:N}=Math;function G(e,t,a=!1){let l=L(t.y-e.y,t.x-e.x);return a&&l<0&&(l+=2*Math.PI),l}function U(e,t,a,l=!1){let n=Math.atan2(t.y-e.y,t.x-e.x),r=Math.atan2(a.y-e.y,a.x-e.x),s=r-n;s=(e=>{let t=e%(2*Math.PI);return t>Math.PI?t-=2*Math.PI:t<=-Math.PI&&(t+=2*Math.PI),t})(s),l&&(s=2*Math.PI-Math.abs(s));let i=180/Math.PI;return{startAngle:n,endAngle:r,deltaAngle:s,startAngleDeg:n*i,endAngleDeg:r*i,deltaAngleDeg:s*i}}function O(e=null,t=null,a=null,l=null,n=!0,r=!1,s=!1){let i,o,u,p,h,y={};if(!(e&&t&&a&&l))return s&&console.warn("points missing"),!1;try{if(i=(l.y-a.y)*(t.x-e.x)-(l.x-a.x)*(t.y-e.y),0===i)return!1}catch{return s&&console.warn("!catch",e,t,"p3:",a,"p4:",l),!1}o=e.y-a.y,u=e.x-a.x,p=(l.x-a.x)*o-(l.y-a.y)*u,h=(t.x-e.x)*o-(t.y-e.y)*u,o=p/i,u=h/i,y={x:e.x+o*(t.x-e.x),y:e.y+o*(t.y-e.y)};let c=!1;return o>0&&o<1&&u>0&&u<1&&(c=!0),!n&&r&&(o>0&&u<0||o<0&&u>0)?(c=!1,!1):!(n&&!c)&&y}function Z(e,t,a,l=!1){const n=(e,t,a)=>e>=t&&e<=a||e<=t&&e>=a;let r=!1;if((!l||!a.bottom)&&(a.left>e.x||a.top>e.y||a.bottom<e.y||a.right<e.x))return!1;let s=t.length;for(let a=s-1,l=0;l<s;a=l,l++){const s=t[a],i=t[l];if(e.x==s.x&&e.y==s.y||e.x==i.x&&e.y==i.y)return!0;if(s.y==i.y&&e.y==s.y&&n(e.x,s.x,i.x))return!0;if(n(e.y,s.y,i.y)){if(e.y==s.y&&i.y>=s.y||e.y==i.y&&s.y>=i.y)continue;const t=(s.x-e.x)*(i.y-e.y)-(i.x-e.x)*(s.y-e.y);if(0==t)return!0;s.y<i.y==t>0&&(r=!r)}}return!!r}function H(e,t,a,l=!1){let n={x:(t.x-e.x)*a+e.x,y:(t.y-e.y)*a+e.y};return l&&(n.angle=G(e,t),n.angle<0&&(n.angle+=2*N)),n}function R(e,t=.5,a=!1,l=!1,n=!1){let r;return Array.isArray(e[0])&&(e=e.map(e=>({x:e[0],y:e[1]})),n=!0),r=e.length>2?((e,t,a=!1)=>{let n=4===e.length,r=e[0],s=e[1],i=n?e[2]:e[1],o=e[e.length-1],u={x:0,y:0};if(a||l){let e,a,p,h,y,c=r.x===s.x&&r.y===s.y,x=o.x===i.x&&o.y===i.y;0!==t||c?1!==t||x?(c&&(t+=1e-7),x&&(t-=1e-7),e=H(r,s,t),n?(a=H(s,i,t),p=H(i,o,t),h=H(e,a,t),y=H(a,p,t),u=H(h,y,t),u.angle=G(h,y),l&&(u.cpts=[a,p,h,y])):(a=H(r,s,t),p=H(s,o,t),u=H(a,p,t),u.angle=G(a,p),l&&(u.cpts=[a,p]))):(u.x=o.x,u.y=o.y,u.angle=G(i,o)):(u.x=r.x,u.y=r.y,u.angle=G(r,s))}else{let e=1-t;u=n?{x:e**3*r.x+3*e**2*t*s.x+3*e*t**2*i.x+t**3*o.x,y:e**3*r.y+3*e**2*t*s.y+3*e*t**2*i.y+t**3*o.y}:{x:e*e*r.x+2*e*t*s.x+t**2*o.x,y:e*e*r.y+2*e*t*s.y+t**2*o.y}}return u})(e,t,a):H(e[0],e[1],t,a),a&&r.angle<0&&(r.angle+=2*N),n?[r.x,r.y]:r}function W(e){let t=[],a={x:e[0].values[0],y:e[0].values[1]};return e.forEach(e=>{let{type:l,values:n}=e;if(n.length){let e=n.length>1?{x:n[n.length-2],y:n[n.length-1]}:"V"===l?{x:a.x,y:n[0]}:{x:n[0],y:a.y};t.push(e),a=e}}),t}function V(e,t,a,l,n,r,s,i,o){const u=(e,t,a,l)=>L(l-t,a-e);let p={cx:0,cy:0,rx:a=A(a),ry:l=A(l),startAngle:0,endAngle:0,deltaAngle:0,clockwise:s,xAxisRotation:n,largeArc:r,sweep:s};if(0==a||0==l)throw Error("rx and ry can not be 0");if(a===l){let a=Math.abs(i-e),l=Math.abs(o-t),n=a,r=Math.min(e,i),u=Math.min(t,o),h=.5*Math.PI;if(0===a&&l||0===l&&a)return n=0===a&&l?l/2:a/2,p.rx=n,p.ry=n,0===a&&l?(p.cx=e,p.cy=u+l/2,p.startAngle=t>o?h:-h,p.endAngle=t>o?-h:h,p.deltaAngle=s?Math.PI:-Math.PI):0===l&&a&&(p.cx=r+a/2,p.cy=t,p.startAngle=e>i?Math.PI:0,p.endAngle=e>i?-Math.PI:Math.PI,p.deltaAngle=s?Math.PI:-Math.PI),p}let h,y,c=a===l?0:n*N/180,x=c?Math.sin(c):0,f=c?Math.cos(c):1,g=(e-i)/2,d=(t-o)/2,m=(e+i)/2,v=(t+o)/2,M=c?f*g+x*d:g,b=c?f*d-x*g:d,w=M*M/(a*a)+b*b/(l*l);w>1&&(a*=Math.sqrt(w),l*=Math.sqrt(w),p.rx=a,p.ry=l);let C=a*l,k=a*b,P=l*M,E=k**2+P**2;if(!E)throw Error("start point can not be same as end point");let S=Math.sqrt(Math.abs((C*C-E)/E));r==s&&(S=-S);let T=S*k/l,I=-S*P/a;h=c?f*T-x*I+m:m+T,y=c?x*T+f*I+v:v+I,p.cy=y,p.cx=h;let D=u(h,y,e,t),F=u(h,y,i,o);!s&&F>D&&(F-=2*Math.PI),s&&D>F&&(F=F<=0?F+2*Math.PI:F);let $=F-D;return p.startAngle=D,p.endAngle=F,p.deltaAngle=$,p}function J(e,t,a,l=0,n=!1){return l?(l=n?l/180*Math.PI:l,{x:t+(e.x-t)*Math.cos(l)-(e.y-a)*Math.sin(l),y:a+(e.x-t)*Math.sin(l)+(e.y-a)*Math.cos(l)}):e}function X(e,t,a,l,n,r=0,s=!0,i=!1){if(n=i?n*N/180:n,r=i?r*N/180:r,r=a!==l&&r!==2*N?r:0,s&&a!==l){let e=k(B(n=r?n-r:n)*(a/l));n=E(n)<0?e+N:e}let o=e+a*E(n),u=t+l*j(n),p={x:o,y:u};return r&&(p.x=e+(o-e)*E(r)-(u-t)*j(r),p.y=t+(o-e)*j(r)+(u-t)*E(r)),p}function Y(e,t,a){if(t===a||e%N*.5==0)return e;let l=k(B(e)*(t/a));return l=E(e)<0?l+N:l,l}function _(e=null,t=[]){e||(e=t[0],t=t.slice(1,t.length));let a=t.length,l=t[a-1],n=t[0],r=3===a?t[1]:n,s=Math.min(e.y,l.y),i=Math.min(e.x,l.x),o=Math.max(e.x,l.x),u=Math.max(e.y,l.y);return!(n.y>=s&&n.y<=u&&r.y>=s&&r.y<=u&&n.x>=i&&n.x<=o&&r.x>=i&&r.x<=o)}function K(e,{addExtremes:t=!0,addSemiExtremes:a=!1}={}){let l=4===e.length?function(e,t,a,l,{addExtremes:n=!0,addSemiExtremes:r=!1}={}){const s=e=>{const t=Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};r&&(e=s(e),t=s(t),a=s(a),l=s(l));let[i,o,u,p,h,y,c,x]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],f=Math.min(e.y,l.y),g=Math.min(e.x,l.x),d=Math.max(e.x,l.x),m=Math.max(e.y,l.y);if(t.y>=f&&t.y<=m&&a.y>=f&&a.y<=m&&t.x>=g&&t.x<=d&&a.x>=g&&a.x<=d)return[];let v,M,b,A,w,C,k,L,P=[];for(let e=0;e<2;++e)if(0==e?(M=6*i-12*u+6*h,v=-3*i+9*u-9*h+3*c,b=3*u-3*i):(M=6*o-12*p+6*y,v=-3*o+9*p-9*y+3*x,b=3*p-3*o),Math.abs(v)<1e-8){if(Math.abs(M)<1e-8)continue;A=-b/M,0<A&&A<1&&P.push(A)}else k=M*M-4*b*v,k<0?Math.abs(k)<1e-8&&(A=-M/(2*v),0<A&&A<1&&P.push(A)):(L=Math.sqrt(k),w=(-M+L)/(2*v),0<w&&w<1&&P.push(w),C=(-M-L)/(2*v),0<C&&C<1&&P.push(C));let E=P.length;for(;E--;)A=P[E];return P}(e[0],e[1],e[2],e[3],{addExtremes:t,addSemiExtremes:a}):function(e,t,a,{addExtremes:l=!0,addSemiExtremes:n=!1}={}){const r=e=>{const t=-Math.PI/4,a=Math.cos(t),l=Math.sin(t);return{x:e.x*a-e.y*l,y:e.x*l+e.y*a}};n&&(e=r(e),t=r(t),a=r(a));let s,i,o,u=Math.min(e.y,a.y),p=Math.min(e.x,a.x),h=Math.max(e.x,a.x),y=Math.max(e.y,a.y);if(t.y>=u&&t.y<=y&&t.x>=p&&t.x<=h)return[];let[c,x,f,g,d,m]=[e.x,e.y,t.x,t.y,a.x,a.y],v=[];for(let e=0;e<2;++e)s=0==e?c-2*f+d:x-2*g+m,i=0==e?-2*c+2*f:-2*x+2*g,Math.abs(s)>1e-12&&(o=-i/(2*s),o>0&&o<1&&v.push(o));return v}(e[0],e[1],e[2],{addExtremes:t,addSemiExtremes:a});return l}function ee(e,t){const a=(e,t,a,l,n,r)=>{var s=Math.cos(r),i=Math.sin(r),o=l*Math.cos(e),u=n*Math.sin(e);return{x:t+s*o-i*u,y:a+i*o+s*u}};let l,n,r,s,i,o=V(e.x,e.y,t[0],t[1],t[2],t[3],t[4],t[5],t[6]),{rx:u,ry:p,cx:h,cy:y,endAngle:c,deltaAngle:x}=o,f=t[2],g={x:t[5],y:t[6]},d=[g],m=f*Math.PI/180,v=Math.tan(m);i=Math.atan2(-p*v,u);let M=i,b=i+Math.PI,A=Math.atan2(p,u*v),w=A+Math.PI,C=[e.x,g.x],k=[e.y,g.y],L=Math.min(...C),P=Math.max(...C),E=Math.min(...k),S=Math.max(...k),T=a(c-.001*x,h,y,u,p,m),I=a(c-.999*x,h,y,u,p,m);return(T.x>P||I.x>P)&&(l=a(M,h,y,u,p,m),d.push(l)),(T.x<L||I.x<L)&&(n=a(b,h,y,u,p,m),d.push(n)),(T.y<E||I.y<E)&&(s=a(w,h,y,u,p,m),d.push(s)),(T.y>S||I.y>S)&&(r=a(A,h,y,u,p,m),d.push(r)),d}function te(e=[],t=[]){let a=e.length,l=4===a;t.length||(t=[0]);let n=t.length,r=[];for(let s=0;s<n;s++){let n=t[s],i=n?[]:e.slice(0);if(n)for(let t=0;t<a;t++){let a=e[t];i.push(J(a,0,0,n))}let o=l?ae(...i):le(...i);r.push(...o)}return r=[...new Set(r)].sort(),r}function ae(e,t,a,l){if(!_(e,[t,a,l]))return[];let n,r,s,i,o,u,p,h,[y,c,x,f,g,d,m,v]=[e.x,e.y,t.x,t.y,a.x,a.y,l.x,l.y],M=[],b=1e-8;for(let e=0;e<2;++e)if(0==e?(r=6*y-12*x+6*g,n=-3*y+9*x-9*g+3*m,s=3*x-3*y):(r=6*c-12*f+6*d,n=-3*c+9*f-9*d+3*v,s=3*f-3*c),Math.abs(n)<b){if(Math.abs(r)<b)continue;i=-s/r,i>0&&i<1&&M.push(i)}else p=r*r-4*s*n,p<0?Math.abs(p)<b&&(i=-r/(2*n),i>0&&i<1&&M.push(i)):(h=Math.sqrt(p),o=(-r+h)/(2*n),o>0&&o<1&&M.push(o),u=(-r-h)/(2*n),u>0&&u<1&&M.push(u));let A=M.length;for(;A--;)i=M[A];return[...new Set(M)].sort()}function le(e,t,a){if(!_(e,[t,a]))return[];let l,n,r,[s,i,o,u,p,h]=[e.x,e.y,t.x,t.y,a.x,a.y],y=[];for(let e=0;e<2;++e)l=0==e?s-2*o+p:i-2*u+h,n=0==e?-2*s+2*o:-2*i+2*u,Math.abs(l)>1e-12&&(r=-n/(2*l),r>0&&r<1&&y.push(r));return[...new Set(y)].sort()}function ne(e,t=.001){let a=Math.PI/2,l=a/2;return!(Math.abs(e/a-Math.round(e/a))<t)&&Math.abs(e/l-Math.round(e/l))<t}function re(e,t,a=!1){let l=a?t[0]-e[0]:t.x-e.x,n=a?t[1]-e[1]:t.y-e.y;return Q(l*l+n*n)}function se(e,t){let a=t.x-e.x,l=t.y-e.y;return a*a+l*l}function ie(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function oe(e,t){return.5*(Math.abs(t.x-e.x)+Math.abs(t.y-e.y))}function ue(e,t=48){if(!Array.isArray(e)||e.length<=t)return e;let a=e.length,l=a/t,n=[];for(let a=0;a<t;a++)n.push(e[Math.floor(a*l)]);let r=n.length;return n[r-1]!==e[a-1]&&(n[r-1]=e[a-1]),n}function pe(e){let t=[],a=[e[0]],l=e.length;for(let n=1;n<l;n++){let l=e[n];"M"!==l.type&&"m"!==l.type||(t.push(a),a=[]),a.push(l)}return a.length&&t.push(a),t}function he(e,t){let a,l,n,r,s,i,o=[],u=[],p=e[0],h=e[1],y=e[e.length-2],c=e[e.length-1];return 4===e.length?(a=R([p,h],t),l=R([h,y],t),n=R([y,c],t),r=R([a,l],t),s=R([l,n],t),i=R([r,s],t),o.push({x:p.x,y:p.y},{x:a.x,y:a.y},{x:r.x,y:r.y},{x:i.x,y:i.y}),u.push({x:i.x,y:i.y},{x:s.x,y:s.y},{x:n.x,y:n.y},{x:c.x,y:c.y})):3===e.length?(l=R([p,h],t),n=R([h,c],t),i=R([l,n],t),o.push({x:p.x,y:p.y},{x:l.x,y:l.y},{x:i.x,y:i.y}),u.push({x:i.x,y:i.y},{x:n.x,y:n.y},{x:c.x,y:c.y})):2===e.length&&(l=R([p,c],t),o.push({x:p.x,y:p.y},{x:l.x,y:l.y}),u.push({x:l.x,y:l.y},{x:c.x,y:c.y})),[o,u]}function ye(e,t,{tMin:a=0,tMax:l=1,addExtremes:n=!0,addSemiExtremes:r=!1}={}){let s=[],i=6===t.length?"C":"Q",o={x:t[0],y:t[1]},u="C"===i?{x:t[2],y:t[3]}:o,p={x:t[4],y:t[5]},h=0;let y="C"===i?[e,o,u,p]:[e,o,p],c=n?K(y,{addExtremes:n,addSemiExtremes:!1}):[],x=r?K(y,{addExtremes:n,addSemiExtremes:r}):[],f=Array.from(new Set([...c,...x])).sort();if(f=f.filter(e=>e>0&&e<1),f.length){let a=function(e,t,a,l=!0){let n=[];if(!a.length)return!1;let r,s,i,o=t.length,u={x:t[o-2],y:t[o-1]};2===t.length?i=[e,u]:4===t.length?(r={x:t[0],y:t[1]},i=[e,r,u]):6===t.length&&(r={x:t[0],y:t[1]},s={x:t[2],y:t[3]},i=[e,r,s,u]);if(a.length)if(1===a.length){let e=he(i,a[0]),t=e[0],l=e[1];n.push(t,l)}else{let e=a[0],t=he(i,e),l=t[0];n.push(l),i=t[1];for(let t=1;t<a.length;t++){e=a[t-1];let l=he(i,(a[t]-e)/(1-e));n.push(l[0]),t===a.length-1&&n.push(l[l.length-1]),i=l[1]}}if(l){let e,t,a=[];return n.forEach(l=>{e={type:"",values:[]},l.shift(),t=l.map(e=>Object.values(e)).flat(),e.values=t,3===l.length?e.type="C":2===l.length?e.type="Q":1===l.length&&(e.type="L"),a.push(e)}),a}return n}(e,t,f);s.push(...a),h+=a.length}else s.push({type:i,values:t});return{pathData:s,count:h}}function ce(e,{tMin:t=0,tMax:a=1,addExtremes:l=!0,addSemiExtremes:n=!1}={}){let r=[e[0]],s={x:e[0].values[0],y:e[0].values[1]},i={x:e[0].values[0],y:e[0].values[1]},o=e.length;for(let u=1;o&&u<o;u++){let o=e[u],{type:p,values:h}=o,y=h.slice(-2);if(y[0],y[1],"C"!==p&&"Q"!==p)r.push(o);else if((l||n)&&("C"===p||"Q"===p)){let e=ye(s,h,{tMin:t,tMax:a,addExtremes:l,addSemiExtremes:n}).pathData;r.push(...e)}s={x:y[0],y:y[1]},"z"===p.toLowerCase()?s=i:"M"===p&&(i={x:y[0],y:y[1]})}return r}function xe(e,t=-1){let a=e.map(e=>e.x),l=e.map(e=>e.y),n=Math.min(...a),r=Math.max(...a),s=Math.min(...l),i=Math.max(...l),o={x:n,left:n,right:r,y:s,top:s,bottom:i,width:r-n,height:i-s};if(t>-1)for(let e in o)o[e]=+o[e].toFixed(t);return o}function fe(e){let t=[];return e.forEach(e=>{let a=function(e){let t=function(e){let t=[];for(let a=0;a<e.length;a++){let l=e[a],n=a>0?e[a-1]:e[a],{type:r,values:s}=l,i={x:n.values[n.values.length-2],y:n.values[n.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",u=s.length?{x:s[0],y:s[1]}:"";switch(r){case"A":if("function"!=typeof arcToBezier){let e=re(i,o)/2,a=H(i,o,.5),l=X(a.x,a.y,e,e,0),n=X(a.x,a.y,e,e,Math.PI);t.push(l,n,o);break}arcToBezier(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},n={x:a[2],y:a[3]},r={x:a[4],y:a[5]};t.push(l,n,r)});break;case"C":let e={x:s[2],y:s[3]};t.push(u,e);break;case"Q":t.push(u)}"z"!==r.toLowerCase()&&t.push(o)}return t}(e),a=xe(t);return a}(e);t.push(a)}),t}function ge(e,t){let[a,l,n,r,s,i]=[e.x,e.y,e.width,e.height,e.x+e.width,e.y+e.height],[o,u,p,h,y,c]=[t.x,t.y,t.width,t.height,t.x+t.width,t.y+t.height],x=!1;return n*r!=p*h&&n*r>p*h&&a<o&&s>y&&l<u&&i>c&&(x=!0),x}function de(e,t=9){let a=0,l=[],n=pe(e),r=n.length>1,s=[];if(r){let e=fe(n);e.forEach(function(t,a){for(let a=0;a<e.length;a++){let l=e[a];if(t!=l){ge(t,l)&&s.push(a)}}})}return n.forEach((e,t)=>{l=[];let n=0,r=0,i=1,o=[];e.forEach(function(t,a){let[r,s]=[t.type,t.values],i=s.length;if(s.length){let u=(a>0?e[a-1]:e[0]).values,p=u.length,h={x:u[p-2],y:u[p-1]},y={x:s[i-2],y:s[i-1]};if("C"===r||"Q"===r){let e={x:s[0],y:s[1]};o="C"===r?[h,e,{x:s[2],y:s[3]},y]:[h,e,y];let t=Math.abs(function(e,t=!1){let a,[l,n,r,s]=[e[0],e[1],e[2],e[e.length-1]];if(e.length<3)return 0;3===e.length&&(n={x:1*e[0].x/3+2*e[1].x/3,y:1*e[0].y/3+2*e[1].y/3},r={x:1*e[2].x/3+2*e[1].x/3,y:1*e[2].y/3+2*e[1].y/3});return a=3*(l.x*(-2*n.y-r.y+3*s.y)+n.x*(2*l.y-r.y-s.y)+r.x*(l.y+n.y-2*s.y)+s.x*(-3*l.y+n.y+2*r.y))/20,t?Math.abs(a):a}(o));n+=t,l.push(h,y)}else if("A"===r){let e=V(h.x,h.y,t.values[0],t.values[1],t.values[2],t.values[3],t.values[4],y.x,y.y),{cx:a,cy:r,rx:s,ry:i,startAngle:o,endAngle:u,deltaAngle:p}=e,c=Math.abs(function(e,t,a,l){const n=Math.PI*e*t;let r=(l-a+2*Math.PI)%(2*Math.PI);if(e===t)return n*(r/(2*Math.PI));const s=a=>Math.atan2(e*Math.sin(a),t*Math.cos(a));return a=s(a),l=s(l),r=(l-a+2*Math.PI)%(2*Math.PI),n*(r/(2*Math.PI))}(s,i,o,u));c-=Math.abs(me([h,{x:a,y:r},y])),l.push(h,y),n+=c}else l.push(h,y)}});let u=me(l);-1!==s.indexOf(t)&&(i=-1),r=u<0&&n<0?(Math.abs(n)-Math.abs(u))*i:(Math.abs(n)+Math.abs(u))*i,a+=r}),a}function me(e,t=!1){let a=0,l=e.length;for(let t=0;l&&t<l;t++){a+=e[t].x*e[t===e.length-1?0:t+1].y*.5-e[t===e.length-1?0:t+1].x*e[t].y*.5}return t&&(a=Math.abs(a)),a}function ve(e,t=0){t=parseFloat(t);let a=e.length,l=t>1,n=!l&&!t,r="",s=l?"\n":n?"":" ",i=n?"":" ";r=`${e[0].type}${i}${e[0].values.join(" ")}${s}`;for(let t=1;t<a;t++){let a=e[t-1],l=e[t],{type:o,values:u}=l;if(!n||"A"!==o&&"a"!==o||(u=[u[0],u[1],u[2],`${u[3]}${u[4]}${u[5]}`,u[6]]),o=n&&a.type===l.type&&"m"!==l.type.toLowerCase()||n&&"M"===a.type&&"L"===l.type?" ":l.type,n){let e="",t=!1;for(let a=0,l=u.length;a<l;a++){let l=u[a],n=l.toString(),r=n.includes(".")&&Math.abs(l)<1;r&&t&&(n=n.replace(/^0\./,".")),!(a>0)||t&&r||(e+=" "),e+=n,t=r}r+=`${o}${i}${e}${s}`}else r+=`${o}${i}${u.join(" ")}${s}`}return n&&(r=r.replace(/ 0\./g," .").replace(/ -/g,"-").replace(/-0\./g,"-.").replace(/Z/g,"z")),r}function Me(e,t,a=0,l=1,n=!1){const r=(e,t,a,l,n)=>{let r=1-n;return{x:3*r*r*(t.x-e.x)+6*r*n*(a.x-t.x)+3*n*n*(l.x-a.x),y:3*r*r*(t.y-e.y)+6*r*n*(a.y-t.y)+3*n*n*(l.y-a.y)}};let s=[e,t],i=oe(e.p0,e.p)>oe(t.p0,t.p),o=JSON.parse(JSON.stringify(e)),u=JSON.parse(JSON.stringify(t)),p=O(o.p0,o.cp1,u.p,u.cp2,!1);if(!p)return s;if(i){let a={p0:{x:e.p.x,y:e.p.y},cp1:{x:e.cp2.x,y:e.cp2.y},cp2:{x:e.cp1.x,y:e.cp1.y},p:{x:e.p0.x,y:e.p0.y}};e={p0:{x:t.p.x,y:t.p.y},cp1:{x:t.cp2.x,y:t.cp2.y},cp2:{x:t.cp1.x,y:t.cp1.y},p:{x:t.p0.x,y:t.p0.y}},t=a}let h=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),y=(e,t)=>({x:e.x*t,y:e.y*t}),c=(e,t)=>e.x*t.x+e.y*t.y,x=t.p0,f=r(t.p0,t.cp1,t.cp2,t.p,0),g=c(h(e.p0,x),f)/c(f,f),d=R([t.p0,t.cp1,t.cp2,t.p],g),m=r(t.p0,t.cp1,t.cp2,t.p,g);g-=c(h(d,e.p0),m)/c(m,m);let v=R([t.p0,t.cp1,t.cp2,t.p],g),M=t.p,b=r(t.p0,t.cp1,t.cp2,t.p,g),A=r(t.p0,t.cp1,t.cp2,t.p,1),w=1-g,C=(k=v,L=y(b,w/3),{x:k.x+L.x,y:k.y+L.y});var k,L;let P=h(M,y(A,w/3)),E={p0:v,cp1:C,cp2:P,p:M,t0:g};i&&(E={p0:M,cp1:P,cp2:C,p:v,t0:g});let S=.5*(1-g),T=R([E.p0,E.cp1,E.cp2,E.p],S,!1,!0),I=T.cpts[2],D=O(T,I,E.p0,p,!1),F=O(T,I,E.p,p,!1),$=H(E.p0,D,1.333),z=H(E.p,F,1.333);if(O(o.p0,$,u.p,z,!0))return s;E.cp1=$,E.cp2=z;let q=oe(o.p0,E.p0)+oe(u.p,E.p);if(E.p0=o.p0,E.p=u.p,E.extreme=u.extreme,E.corner=u.corner,E.dimA=u.dimA,E.directionChange=u.directionChange,E.type="C",E.values=[E.cp1.x,E.cp1.y,E.cp2.x,E.cp2.y,E.p.x,E.p.y],q<a){let t=i?1+g:Math.abs(g),r=1+Math.abs(g);if(t=i?1+g:Math.abs(g)/r,oe(R([E.p0,E.cp1,E.cp2,E.p],t),e.p)>a*l)return s;let p=de([{type:"M",values:[o.p0.x,o.p0.y]},{type:"C",values:[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y]},{type:"C",values:[u.cp1.x,u.cp1.y,u.cp2.x,u.cp2.y,u.p.x,u.p.y]}]),h=[{type:"M",values:[E.p0.x,E.p0.y]},{type:"C",values:[E.cp1.x,E.cp1.y,E.cp2.x,E.cp2.y,E.p.x,E.p.y]}],y=de(h),c=Math.abs(y/p-1);E.error=5*c*l,n&&ve(h),c<.05*l&&(s=[E])}return s}function be(e,{keepExtremes:t=!0,keepInflections:a=!0,keepCorners:l=!0,extrapolateDominant:n=!0,tolerance:r=1}={}){let s=[e[0]],i=e.length;for(let n=2;i&&n<=i;n++){let o=e[n-1],u=n<i?e[n]:null,p=u?.type||null,{type:h,values:y,p0:c,p:x,cp1:f=null,cp2:g=null,extreme:d=!1,directionChange:m=!1,corner:v=!1,dimA:M=0}=o;if("C"===h&&"C"===p)if(l&&v||t&&d)s.push(o);else{let p=Ae(o,u,{tolerance:r}),h=0;
|
|
2
2
|
//!count simplification success or failure - just for debugging
|
|
3
3
|
if(1===p.length){o=p[0];let u=1;h+=o.error;
|
|
4
4
|
//!log.push(`success1: ${i} and ${i + 1}`)
|
|
5
5
|
for(let s=n+1;h<r&&s<i;s++){let n=e[s];if("C"!==n.type||a&&o.directionChange||l&&o.corner||t&&o.extreme)break;let i=Ae(o,n,{tolerance:r});if(i.length>1)break;h+=.5*i[0].error,u++,
|
|
6
6
|
//!log.push(`success2: ${i} and ${n}`)
|
|
7
|
-
o=i[0]}s.push(o),n<i&&(n+=u)}else s.push(o)}else s.push(o)}return s}function Ae(e,t,{tolerance:a=1}={}){let l=[e,t],n=function(e,t){let a=ie(e.cp2,e.p);if(0===a)return 0;let l=ie(e.p,t.cp1);if(0===l)return 0;let n=ie(e.cp2,t.cp1);return a/n}(e,t);if(!n)return l;let r=ie(e.p0,e.p),s=ie(t.p0,t.p),i=.08*Math.max(0,Math.min(r,s))*a,o=function(e,t,a=0){let{p0:l,cp1:n}=e,{p:r,cp2:s}=t;return n={x:(n.x-(1-a)*l.x)/a,y:(n.y-(1-a)*l.y)/a},s={x:(s.x-a*r.x)/(1-a),y:(s.y-a*r.y)/(1-a)},{p0:l,cp1:n,cp2:s,p:r}}(e,t,n),u=R([o.p0,o.cp1,o.cp2,o.p],n),p=ie(e.p,u),h=0,y=0,c=!1,x=p;if(p<i){let a=.5*(1+n);if(h=ie(R([t.p0,t.cp1,t.cp2,t.p],.5),R([o.p0,o.cp1,o.cp2,o.p],a)),x+=h,h<i){let t=.5*n;y=ie(R([e.p0,e.cp1,e.cp2,e.p],.5),R([o.p0,o.cp1,o.cp2,o.p],t)),x+=y,x<i&&(c=!0)}}return c&&(o.p0=e.p0,o.p=t.p,o.dimA=ie(o.p0,o.p),o.type="C",o.extreme=t.extreme,o.directionChange=t.directionChange,o.corner=t.corner,o.values=[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y],o.error=x/i,l=[o]),l}function we(e,{tolerance:t=1,debug:a=!1}={}){let l=!1,n={flat:!0,steepness:0},r=e[0],s=e[e.length-1],i=new Set([...e.map(e=>+e.x.toFixed(8))]),o=new Set([...e.map(e=>+e.y.toFixed(8))]);if(1===i.size||1===o.size)return!a||n;let u=se(r,s),p=u/1e3*t,h=
|
|
7
|
+
o=i[0]}s.push(o),n<i&&(n+=u)}else s.push(o)}else s.push(o)}return s}function Ae(e,t,{tolerance:a=1}={}){let l=[e,t],n=function(e,t){let a=ie(e.cp2,e.p);if(0===a)return 0;let l=ie(e.p,t.cp1);if(0===l)return 0;let n=ie(e.cp2,t.cp1);return a/n}(e,t);if(!n)return l;let r=ie(e.p0,e.p),s=ie(t.p0,t.p),i=.08*Math.max(0,Math.min(r,s))*a,o=function(e,t,a=0){let{p0:l,cp1:n}=e,{p:r,cp2:s}=t;return n={x:(n.x-(1-a)*l.x)/a,y:(n.y-(1-a)*l.y)/a},s={x:(s.x-a*r.x)/(1-a),y:(s.y-a*r.y)/(1-a)},{p0:l,cp1:n,cp2:s,p:r}}(e,t,n),u=R([o.p0,o.cp1,o.cp2,o.p],n),p=ie(e.p,u),h=0,y=0,c=!1,x=p;if(p<i){let a=.5*(1+n);if(h=ie(R([t.p0,t.cp1,t.cp2,t.p],.5),R([o.p0,o.cp1,o.cp2,o.p],a)),x+=h,h<i){let t=.5*n;y=ie(R([e.p0,e.cp1,e.cp2,e.p],.5),R([o.p0,o.cp1,o.cp2,o.p],t)),x+=y,x<i&&(c=!0)}}return c&&(o.p0=e.p0,o.p=t.p,o.dimA=ie(o.p0,o.p),o.type="C",o.extreme=t.extreme,o.directionChange=t.directionChange,o.corner=t.corner,o.values=[o.cp1.x,o.cp1.y,o.cp2.x,o.cp2.y,o.p.x,o.p.y],o.error=x/i,l=[o]),l}function we(e,{tolerance:t=1,debug:a=!1}={}){let l=!1,n={flat:!0,steepness:0},r=e[0],s=e[e.length-1],i=new Set([...e.map(e=>+e.x.toFixed(8))]),o=new Set([...e.map(e=>+e.y.toFixed(8))]);if(1===i.size||1===o.size)return!a||n;let u=se(r,s),p=u/1e3*t,h=me(e,!0);return h<p&&(l=!0),a&&(n.flat=l,n.steepness=h/u*10),a?n:l}function Ce(e){let t=[];for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:n,values:r,p0:s=null,p:i=null,dimA:o=0}=l;r.length&&i&&s&&(o=o||ie(s,i),o&&t.push(o))}let a=t.sort(),l=Math.ceil(a.length/8);a=a.slice(0,l);let n=a.reduce((e,t)=>e+t,0)/l,r=n>112.5?0:Math.floor(75/n).toString().length;return Math.min(Math.max(0,r),8)}function ke(e=0,t=3){if(!t)return Math.round(e);let a=10**t;return Math.round(e*a)/a}function Le(e,t=-1){if(t<0)return e;let a=e.length;for(let l=0;l<a;l++){let a=e[l].values,n=a.length;if(n)for(let r=0;r<n;r++)e[l].values[r]=ke(a[r],t)}return e}function Pe(t=[],{detectExtremes:a=!0,detectCorners:l=!0,detectDirection:n=!0,detectSemiExtremes:r=!1,debug:s=!1,addSquareLength:i=!0,addArea:o=!0}={}){t=function(e,{addSquareLength:t=!0,addArea:a=!1,addArcParams:l=!1,addAverageDim:n=!0}={}){let r=e[0],s={x:r.values[0],y:r.values[1]},i=s,o=s;r.p0=i,r.p=o,r.idx=0,r.dimA=0;let u=e.length,p=[r];for(let l=1;l<u;l++){let n,r,u=e[l],{type:h,values:y}=u,c=y.length;if(o=c?{x:y[c-2],y:y[c-1]}:s,u.p0=i,u.p=o,u.dimA=ie(i,o),"M"===h&&(s=o),"Q"===h||"C"===h)n={x:y[0],y:y[1]},r="C"===h?{x:y[2],y:y[3]}:null,u.cp1=n,r&&(u.cp2=r);else if("A"===h){let{rx:e,ry:t,cx:a,cy:l,startAngle:n,endAngle:r,deltaAngle:s}=V(i.x,i.y,...y);u.cx=a,u.cy=l,u.rx=e,u.ry=t,u.xAxisRotation=y[2]/180*Math.PI,u.largeArc=y[3],u.sweep=y[4],u.startAngle=n,u.endAngle=r,u.deltaAngle=s}if("Z"===h&&s.x!==o.x&&s.y!==o.y&&(u.closePath=!0),t&&(u.squareDist=se(i,o)),a){let e=0;"C"===h&&(e=me([i,n,r,o],!1)),"Q"===h&&(e=me([i,n,o],!1)),u.cptArea=e}u.idx=l,i=o,p.push(u)}return p}(t,{addSquareLength:i,addArea:o});let u=[],p=xe(W(t)),{left:h,right:y,top:c,bottom:x,width:f,height:g}=p;t[0].corner=!1,t[0].extreme=!1,t[0].semiExtreme=!1,t[0].directionChange=!1,t[0].closePath=!1;let d=[t[0]],m=t.length;for(let a=2;m&&a<=m;a++){let l=t[a-1],{type:n,values:i,p0:o,p:u,cp1:p=null,cp2:f=null,squareDist:g=0,cptArea:m=0,dimA:v=0}=l,M=t[a]||null;l.corner=!1,l.extreme=!1,l.semiExtreme=!1,l.directionChange=!1,l.closePath=!1;let b="C"===n||"Q"===n?"C"===n?[o,p,f,u]:[o,p,u]:[o,u],A=.1*v,w=.01*A,C="Q"===n||"C"===n,k=M&&("Q"===M.type||"C"===M.type),L=!1;
|
|
8
8
|
//!isFlat &&
|
|
9
|
-
if(C){let e="C"===n?Math.abs(l.cp2.x-l.p.x):Math.abs(l.cp1.x-l.p.x),t="C"===n?Math.abs(l.cp2.y-l.p.y):Math.abs(l.cp1.y-l.p.y);if(((0===t||t<w)&&e>0||(0===e||e<w)&&t>0)&&(L=!0),u.x!==h&&u.y!==c&&u.x!==y&&u.y!==x||(L=!0),!L){if(_(null,b)){let e=te(b);e.length&&e[0]>.2&&(L=!0)}}}if(L&&(l.extreme=!0),C&&k){if(r&&!l.extreme){let e=Math.abs(u.x-f.x),t=Math.abs(u.y-f.y),a=!1;if(e&&t&&e>A||t>A){let e=G(f,u),t=G(u,M.cp1);a=ne(Math.abs(e+t)/2)}a&&(l.semiExtreme=!0)}if((l.cptArea<0&&M.cptArea>0||l.cptArea>0&&M.cptArea<0)&&(l.directionChange=!0),!l.extreme){let e=f||p,t=M.cp1,a=de([e,u,t],!1),n=.01*se(e,t),r=Math.abs(a)<n,s=a<0&&l.cptArea>0||a>0&&l.cptArea<0;!r&&s&&(l.corner=!0)}}s&&(l.directionChange&&e(markers,l.p,"orange","1.5%","0.5"),l.corner&&e(markers,l.p,"magenta","1.5%","0.5"),l.extreme&&e(markers,l.p,"cyan","1%","0.5")),m.push(l)}return u={pathData:m,bb:p,dimA:(f+g)/2},u}function Ee(e={},t={},a={},l={},n=1){let r=H(e,t,1.5),s=H(l,a,1.5),i=.01*ie(e,l)*n,o=ie(r,s),u=null,p={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]};return o<i&&(u=O(e,t,l,a,!1),u&&(p.type="Q",p.values=[u.x,u.y,l.x,l.y],p.p0=e,p.cp1=u,p.cp2=null,p.p=l)),p}function Se(e,{toShorthands:t=!0,toLonghands:a=!1,toRelative:l=!0,toAbsolute:n=!1,decimals:r=3,arcToCubic:s=!1,quadraticToCubic:i=!1,hasRelatives:o=!0,hasShorthands:u=!0,hasQuadratics:p=!0,hasArcs:h=!0,testTypes:y=!1}={}){if(y){let t=Array.from(new Set(e.map(e=>e.type))).join("");/[lcqamts]/gi.test(t),p=/[qt]/gi.test(t),h=/[a]/gi.test(t),u=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return l=!n&&l,t=!a&&t,p&&i&&(e=Ie(e)),h&&s&&(e=Te(e)),t&&(e=function(e,t=-1,a=!1){let l;if(a){let t=e.map(e=>e.type).join("");l=/[astvqmhlc]/g.test(t)}e=a&&l?Fe(e):e;let n=e.length,r=new Array(n),s=e[0];r[0]=s;let i={x:e[0].values[0],y:e[0].values[1]},o=i;for(let t=1;t<n;t++){let a=e[t];s=a;let{type:l,values:n}=a,u=n.length,p=[n[u-2],n[u-1]],h=e[t-1];o={x:p[0],y:p[1]};let y=Math.abs(o.x-i.x),c=Math.abs(o.y-i.y),x=.01*ie(i,o),f=!1,g=!1,m=!1;if("C"===l&&"C"===h.type||"Q"===l&&"Q"===h.type){let e="C"===h.type?{x:h.values[2],y:h.values[3]}:{x:h.values[0],y:h.values[1]},t={x:n[0],y:n[1]},a=i.x-e.x,l=i.y-e.y;x=.025*ie(e,t),f=ie({x:e.x+2*a,y:e.y+2*l},t)<x}else"L"===l&&(g=0===c||c<x,m=0===y||y<x,f=m||g);switch(l){case"L":g&&(s={type:"H",values:[n[0]]}),m&&(s={type:"V",values:[n[1]]});break;case"Q":f&&(s={type:"T",values:[o.x,o.y]});break;case"C":f&&(s={type:"S",values:[n[2],n[3],o.x,o.y]});break;default:s={type:l,values:n}}i=o,r[t]=s}return r}(e)),u&&a&&(e=ze(e)),n&&(e=$e(e)),r>-1&&l&&(e=Le(e,r)),l&&(e=function(e,t=-1){return Fe(e,!0,t)}(e)),r>-1&&(e=Le(e,r)),e}function Te(e,{arcAccuracy:t=1}={}){let a=[e[0]];for(let l=1,n=e.length;l<n;l++){let n=e[l],r=e[l-1].values,s=r.length,i={x:r[s-2],y:r[s-1]};if("A"===n.type){je(i,n.values,t).forEach(e=>{a.push(e)})}else a.push(n)}return a}function Ie(e){let t=[e[0]];for(let a=1,l=e.length;a<l;a++){let l=e[a],n=e[a-1].values,r=n.length,s={x:n[r-2],y:n[r-1]};"Q"===l.type?t.push(De(s,l.values)):t.push(l)}return t}function De(e,t){Array.isArray(e)&&(e={x:e[0],y:e[1]});let a={x:e.x+2/3*(t[0]-e.x),y:e.y+2/3*(t[1]-e.y)},l={x:t[2]+2/3*(t[0]-t[2]),y:t[3]+2/3*(t[1]-t[3])};return{type:"C",values:[a.x,a.y,l.x,l.y,t[2],t[3]]}}function Fe(e,t=!1,a=-1){a>=0&&(e[0].values=e[0].values.map(e=>+e.toFixed(a)));let l=e.length,n=e[0].values,r=n[0],s=n[1],i=r,o=s;for(let n=1;n<l;n++){let l=e[n],{type:u,values:p}=l,h=p.length,y=u.toLowerCase(),c=u.toUpperCase(),x=t?y:c;if(u!==x)switch(l.type=x,y){case"a":p[5]=t?p[5]-r:p[5]+r,p[6]=t?p[6]-s:p[6]+s;break;case"v":p[0]=t?p[0]-s:p[0]+s;break;case"h":p[0]=t?p[0]-r:p[0]+r;break;case"m":t?(p[0]-=r,p[1]-=s):(p[0]+=r,p[1]+=s),i=t?p[0]+r:p[0],o=t?p[1]+s:p[1];break;default:if(p.length)for(let e=0;e<p.length;e++)p[e]=t?p[e]-(e%2?s:r):p[e]+(e%2?s:r)}switch(y){case"z":r=i,s=o;break;case"h":r=t?r+p[0]:p[0];break;case"v":s=t?s+p[0]:p[0];break;case"m":i=p[h-2]+(t?r:0),o=p[h-1]+(t?s:0);default:r=p[h-2]+(t?r:0),s=p[h-1]+(t?s:0)}a>=0&&(l.values=l.values.map(e=>+e.toFixed(a)))}return e}function $e(e,t=-1){return Fe(e,!1,t)}function ze(e,t=-1,a=!0){let l=!1;if(a){let t=e.map(e=>e.type).join(""),a=/[hstv]/gi.test(t);if(l=/[astvqmhlc]/g.test(t),!a)return e}let n=[],r={type:"M",values:(e=a&&l?$e(e,t):e)[0].values};n.push(r);for(let a=1,l=e.length;a<l;a++){let l,s,i,o,u,p,h,y,c=e[a],{type:x,values:f}=c,g=f.length,m=r.values,d=m.length,[v,M]=[f[g-2],f[g-1]],[b,A]=[m[d-2],m[d-1]];switch(x){case"H":r={type:"L",values:[f[0],A]};break;case"V":r={type:"L",values:[b,f[0]]};break;case"T":[l,s]=[m[0],m[1]],[b,A]=[m[d-2],m[d-1]],i=b+(b-l),o=A+(A-s),r={type:"Q",values:[i,o,v,M]};break;case"S":[l,s]=[m[0],m[1]],[b,A]=[m[d-2],m[d-1]],[h,y]=d>2&&"A"!==r.type?[m[2],m[3]]:[b,A],i=2*b-h,o=2*A-y,u=f[0],p=f[1],r={type:"C",values:[i,o,u,p,v,M]};break;default:r={type:x,values:f}}t>-1&&(r.values=r.values.map(e=>+e.toFixed(t))),n.push(r)}return n}function qe({p0:e={x:0,y:0},p:t={x:0,y:0},centroid:a={x:0,y:0},rx:l=0,ry:n=0,xAxisRotation:r=0,radToDegree:s=!1,startAngle:i=null,endAngle:o=null,deltaAngle:u=null}={}){if(!l||!n)return[];let p=[];const h=1.5707963267948966;let y=s?r:r*Math.PI/180,c=Math.cos(y),x=Math.sin(y);null!==i&&null!==o&&null!==u||({startAngle:i,endAngle:o,deltaAngle:u}=U(a,e,t));let f=l!==n?Y(i,l,n):i,g=l!==n?Y(u,l,n):u,m=Math.max(1,Math.ceil(Math.abs(g)/h)),d=g/m;for(let e=0;e<m;e++){const e=Math.abs(d)===h?.551785*Math.sign(d):4/3*Math.tan(d/4);let t=Math.cos(f),r=Math.sin(f),s=Math.cos(f+d),i=Math.sin(f+d),o=[];[{x:t-r*e,y:r+t*e},{x:s+i*e,y:i-s*e},{x:s,y:i}].forEach(e=>{let t=e.x*l,r=e.y*n;o.push(c*t-x*r+a.x,x*t+c*r+a.y)}),p.push({type:"C",values:o,cp1:{x:o[0],y:o[1]},cp2:{x:o[2],y:o[3]},p:{x:o[4],y:o[5]}}),f+=d}return p}function je(e,t,a=1){const l=2*Math.PI;let[n,r,s,i,o,u,p]=t;if(0===n||0===r)return[];let h=s?s*l/360:0,y=h?Math.sin(h):0,c=h?Math.cos(h):1,x=c*(e.x-u)/2+y*(e.y-p)/2,f=-y*(e.x-u)/2+c*(e.y-p)/2;if(0===x&&0===f)return[];n=Math.abs(n),r=Math.abs(r);let g=x*x/(n*n)+f*f/(r*r);if(g>1){let e=Math.sqrt(g);n*=e,r*=e}let m=n*n,d=n===r?m:r*r,v=x*x,M=f*f,b=m*d-m*M-d*v;b<=0?b=0:(b/=m*M+d*v,b=Math.sqrt(b)*(i===o?-1:1));let A=b?b*n/r*f:0,w=b?b*-r/n*x:0,C=c*A-y*w+(e.x+u)/2,k=y*A+c*w+(e.y+p)/2,L=(x-A)/n,P=(f-w)/r,E=(-x-A)/n,S=(-f-w)/r;const T=(e,t,a,l)=>{let n=+(e*a+t*l).toFixed(9);return 1===n||-1===n?1===n?0:Math.PI:(n=n>1?1:n<-1?-1:n,(e*l-t*a<0?-1:1)*Math.acos(n))};let I=T(1,0,L,P),D=T(L,P,E,S);0===o&&D>0?D-=2*Math.PI:1===o&&D<0&&(D+=2*Math.PI);let F=(+(Math.abs(D)/(l/4)).toFixed(0)||1)*a;D/=F;let $=[];const z=1.5707963267948966,q=.551785;let j=D===z?q:D===-z?-q:4/3*Math.tan(D/4),Q=D?Math.cos(D):1,B=D?Math.sin(D):0;const N=(e,t,a,l,n)=>{let r=e!=t?Math.cos(e):l,s=e!=t?Math.sin(e):n,i=Math.cos(e+t),o=Math.sin(e+t);return[{x:r-s*a,y:s+r*a},{x:i+o*a,y:o-i*a},{x:i,y:o}]};for(let e=0;e<F;e++){let e={type:"C",values:[]};N(I,D,j,Q,B).forEach(t=>{let a=t.x*n,l=t.y*r;e.values.push(c*a-y*l+C,y*a+c*l+k)}),$.push(e),I+=D}return $}function Qe(e,{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:n=!1,arcAccuracy:r=4}={}){let s=Array.isArray(e),i=s&&"object"==typeof e[0]&&"function"==typeof e[0].constructor,o=s?e:Ze(e),{hasRelatives:u=!0,hasShorthands:p=!0,hasQuadratics:h=!0,hasArcs:y=!0}=o,c=i?o:o.pathData;return c=function(e=[],{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:n=!1,arcAccuracy:r=2,hasRelatives:s=!0,hasShorthands:i=!0,hasQuadratics:o=!0,hasArcs:u=!0,testTypes:p=!1}={}){if(p){let t=Array.from(new Set(e.map(e=>e.type))).join("");s=/[lcqamts]/gi.test(t),o=/[qt]/gi.test(t),u=/[a]/gi.test(t),i=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return(o&&l||u&&n)&&(a=!0,t=!0),s&&t&&(e=Fe(e,!1)),i&&a&&(e=ze(e,-1,!1)),u&&n&&(e=Te(e,r)),o&&l&&(e=Ie(e)),e}(c,{toAbsolute:t,toLonghands:a,quadraticToCubic:l,arcToCubic:n,arcAccuracy:r,hasRelatives:u,hasShorthands:p,hasQuadratics:h,hasArcs:y}),c}const Be=new Set([77,109,65,97,67,99,76,108,81,113,83,115,84,116,72,104,86,118,90,122]),Ne=new Uint8Array(128);Ne[77]=2,Ne[109]=2,Ne[65]=7,Ne[97]=7,Ne[67]=6,Ne[99]=6,Ne[76]=2,Ne[108]=2,Ne[81]=4,Ne[113]=4,Ne[83]=4,Ne[115]=4,Ne[84]=2,Ne[116]=2,Ne[72]=1,Ne[104]=1,Ne[86]=1,Ne[118]=1,Ne[90]=0,Ne[122]=0;const Ge=new Set([5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279]),Ue=e=>32===e||44===e||10===e||13===e||8232===e||8233===e||9===e||11===e||12===e||160===e||e>=5760&&Ge.has(e),Oe=(e="",t=0)=>{let a=e.length;return 3===t&&2===a?(e=[+e[0],+e[1]],t++):4===t&&a>1?(e=[+e[0],+e.substring(1)],t++):3===t&&a>=3?(e=[+e[0],+e[1],+e.substring(2)],t+=2):e=[+e],{val:e,valueIndex:t}};function Ze(e,t=!0,a=0){e=e.trim(),a&&console.log("!!!limit",a);let l={pathData:[],hasRelatives:!1,hasShorthands:!1,hasArcs:!1,hasQuadratics:!1,isPolygon:!1,log:[]};if(""===e)return l;let n,r=0,s=e.length,i="",o=-1,u="",p=!1,h=0,y=0,c=0,x=!1,f=new Set([]);const g=()=>{x&&("M"===i?i="L":"m"===i&&(i="l"),l.pathData.push({type:i,values:[]}),o++,y=0,x=!1)},m=(e=!1)=>{(e?h>0:""!==u)&&(t&&-1===o&&(n="Pathdata must start with M command",l.log.push(n),i="M",l.pathData.push({type:i,values:[]}),c=2,y=0,o++),"A"===i||"a"===i?(({val:u,valueIndex:y}=Oe(u,y)),l.pathData[o].values.push(...u)):(t&&u[1]&&"."!==u[1]&&"0"===u[0]&&(n=`${o}. command: Leading zeros not valid: ${u}`,l.log.push(n)),l.pathData[o].values.push(+u)),y++,u="",h=0,x=y>=c)},d=()=>{if(o>0){let e=l.pathData[o].values.length;if(e&&e<c||e&&e>c||("z"===i||"Z"===i)&&e>0){n=`${o}. command of type "${i}": ${c-e} values too few - ${c} expected`,l.log[l.log.length-1]!==n&&l.log.push(n)}}};let v=!1,M=!1,b=!1,A="";for(;r<s;){A=e.charCodeAt(r);let a=A>47&&A<58;if(a||(v=101===A||69===A,M=45===A||43===A,b=46===A),a||M||b||v){if(p||45!==A&&46!==A)g();else{let e=46===A;m(e),g(),e&&h++}u+=e[r],p=v,r++}else if((A<48||A>5759)&&Ue(A))m(),r++;else{if(A>64){if(!Be.has(A)){n=`${o}. command "${e[r]}" is not a valid type`,l.log.push(n),r++;continue}""!==u&&(l.pathData[o].values.push(+u),y++,u=""),t&&d(),i=e[r],c=Ne[A];let a="M"===i||"m"===i,s=o>0&&("z"===l.pathData[o].type||"Z"===l.pathData[o].type);f.add(i),s&&!a&&(l.pathData.push({type:"m",values:[0,0]}),o++),l.pathData.push({type:i,values:[]}),o++,h=0,y=0,x=!1,r++;continue}a||(n=`${o}. ${e[r]} is not a valid separarator or token`,l.log.push(n),u=""),r++}}m(),t&&d(),t&&l.log.length&&(n="Invalid path data:\n"+l.log.join("\n"),"log"===t?console.log(n):console.warn(n)),l.pathData[0].type="M";let w=Array.from(f).join("");return l.hasRelatives=/[lcqamtsvh]/g.test(w),l.hasShorthands=/[vhst]/gi.test(w),l.hasArcs=/[a]/gi.test(w),l.hasQuadratics=/[qt]/gi.test(w),l.isPolygon=!/[cqats]/gi.test(w),l}function He(e){if("path"===e.nodeName.toLowerCase())return e;let t=function(e,t=!1){let a,l,n,r,s,i,o,u,p,h,y,c,x,f,g,m,d=[],v=e.nodeName.toLowerCase();const M=(e,t=9)=>{const a="svg"!==e.nodeName?e.closest("svg"):e,l=e=>{if(null===e)return 0;let a=96,l=e.match(/([a-z]+)/gi);l=l?l[0]:"";let n,r=parseFloat(e);if(!l)return r;switch(l){case"in":n=a;break;case"pt":n=1/72*96;break;case"cm":n=1/2.54*96;break;case"mm":n=1/2.54*96/10;break;case"em":case"rem":n=16;break;default:n=1}return+(r*n).toFixed(t)};let n=a.getAttribute("width");n=n?l(n):300;let r=a.getAttribute("height");r=n?l(r):150;let s=a.getAttribute("viewBox");s=s?s.replace(/,/g," ").split(" ").filter(Boolean).map(e=>+e):[];let i=s.length?s[2]:n,o=s.length?s[3]:r,u=i/100,p=o/100,h=Math.sqrt((Math.pow(u,2)+Math.pow(p,2))/2),y=["x","width","x1","x2","rx","cx","r"],c=["y","height","y1","y2","ry","cy"];e.getAttributeNames().forEach(t=>{let a=e.getAttribute(t),n=a;if(y.includes(t)||c.includes(t)){let r=y.includes(t)?u:p;r="r"===t&&i!=o?h:r;let s=a.match(/([a-z|%]+)/gi);s=s?s[0]:"",n=a.includes("%")?parseFloat(a)*r:l(a),e.setAttribute(t,+n)}})};M(e);const b=t=>(a={},t.forEach(t=>{a[t]=+e.getAttribute(t)}),a);switch(v){case"path":n=e.getAttribute("d"),d=Qe(n);break;case"rect":l=["x","y","width","height","rx","ry"],({x:r,y:s,width:i,height:o,rx:p,ry:h}=b(l)),p||h?(p=p||h,h=h||p,p>i/2&&(p=i/2),h>o/2&&(h=o/2),d=[{type:"M",values:[r+p,s]},{type:"L",values:[r+i-p,s]},{type:"A",values:[p,h,0,0,1,r+i,s+h]},{type:"L",values:[r+i,s+o-h]},{type:"A",values:[p,h,0,0,1,r+i-p,s+o]},{type:"L",values:[r+p,s+o]},{type:"A",values:[p,h,0,0,1,r,s+o-h]},{type:"L",values:[r,s+h]},{type:"A",values:[p,h,0,0,1,r+p,s]},{type:"Z",values:[]}]):d=[{type:"M",values:[r,s]},{type:"L",values:[r+i,s]},{type:"L",values:[r+i,s+o]},{type:"L",values:[r,s+o]},{type:"Z",values:[]}];break;case"circle":case"ellipse":l=["cx","cy","rx","ry","r"],({cx:y,cy:c,r:u,rx:p,ry:h}=b(l));let t="circle"===v;t?(p=u,h=u):(p=p||u,h=h||u);let a=t&&u>=1?1:p,M=t&&u>=1?1:p;d=[{type:"M",values:[y+p,c]},{type:"A",values:[a,M,0,1,1,y-p,c]},{type:"A",values:[a,M,0,1,1,y+p,c]}];break;case"line":l=["x1","y1","x2","y2"],({x1:x,y1:g,x2:f,y2:m}=b(l)),d=[{type:"M",values:[x,g]},{type:"L",values:[f,m]}];break;case"polygon":case"polyline":let A=e.getAttribute("points").replaceAll(","," ").split(" ").filter(Boolean);for(let e=0;e<A.length;e+=2)d.push({type:0===e?"M":"L",values:[+A[e],+A[e+1]]});"polygon"===v&&d.push({type:"Z",values:[]})}return t?function(e){return e.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ")}(d):d}(e),a=t.map(e=>`${e.type} ${e.values} `).join(" "),l=[...e.attributes].map(e=>e.name),n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",a);let r=["x","y","x1","y1","x2","y2","cx","cy","dx","dy","r","rx","ry","width","height","points"];return l.forEach(t=>{if(!r.includes(t)){let a=e.getAttribute(t);n.setAttribute(t,a)}}),n}function Re(e,{tolerance:t=1,flatBezierToLinetos:a=!0}={}){let l=[e[0]],n={x:e[0].values[0],y:e[0].values[1]},r=n,s=n;e[e.length-1].type.toLowerCase();for(let i=1,o=e.length;i<o;i++){let u=e[i],p=e[i+1]||e[o-1],h="z"===p.type.toLowerCase()?n:{x:p.values[p.values.length-2],y:p.values[p.values.length-1]},{type:y,values:c}=u,x=c.slice(-2);s="Z"!==y?{x:x[0],y:x[1]}:n;let f=h?de([r,s,h],!0):1/0,g=se(r,h),m=f<(g?g/333*t:0),d=!1;if(a||"C"!==y||(m=!1),a&&("C"===y||"Q"===y)){d=we([r,..."C"===y?[{x:c[0],y:c[1]},{x:c[2],y:c[3]}]:"Q"===y?[{x:c[0],y:c[1]}]:[],s],{tolerance:t}),d&&i<o-1&&(y="L",u.type="L",u.values=x)}m&&i<o-1&&"A"!==p.type&&("L"===y||a&&d)||(r=s,"M"===y&&(n=s),l.push(u))}return l}function We(e){let t=[];for(let a=0,l=e.length;a<l;a++){let l=e[a];if(!l)continue;let{type:n=null,values:r=[]}=l,s=e[a+1]?e[a+1]:null;"M"!==n&&"m"!==n||s&&(!s||"Z"!==s.type&&"z"!==s.type)?t.push(l):s&&a++}return t}function Ve(e){let t={x:e[0].values[0],y:e[0].values[1]},a=t,l=[e[0]];for(let n=1,r=e.length;n<r;n++){let r=e[n],s=e[n-1],i=e[n+1]||null,{type:o,values:u}=r,p="m"===s.type.toLowerCase()&&!i,h=u.length;if(a={x:u[h-2],y:u[h-1]},p||"L"!==o||a.x!==t.x||a.y!==t.y){if(!p&&("l"===o||"v"===o||"h"===o)){if("l"===o?"00"===u.join(""):0===u[0])continue}l.push(r),t=a}}return l}function Je(e){let t=e.length;if(!("z"===e[t-1].type.toLowerCase()))return e;let a=0,l=[];for(let a=0;a<t;a++){let t=e[a],{type:n,values:r}=t,s=r.length;if(s){let e={type:n,x:r[s-2],y:r[s-1],index:0};e.index=a,l.push(e)}}return l=l.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),a=l[0].index,a?Ye(e,a):e}function Xe(e,{removeFinalLineto:t=!0,autoClose:a=!0}={}){let l=[],n=e.length,r={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},s="z"===e[n-1].type.toLowerCase(),i=e.filter(e=>"L"===e.type),o=e[s?n-2:n-1],u=o.type,p=o.values.slice(-2).map(e=>+e.toFixed(8)),h=p[0]===r.x&&p[1]===r.y;!s&&a&&h&&(e.push({type:"Z",values:[]}),s=!0,n++);let y="L"!==e[1].type&&(!h||"L"===o.type);if(y=!1,!s)return e;let c=0;{let t=[];for(let a=0;a<n;a++){let l=e[a],{type:n,values:r}=l;if(r.length){let l=r.slice(-2),s=e[a-1]&&"L"===e[a-1].type,i=e[a+1]&&"L"===e[a+1].type,o=e[a-1]?e[a-1].type.toUpperCase():null,u=e[a+1]?e[a+1].type.toUpperCase():null,p={type:n,x:l[0],y:l[1],dist:0,index:0,prevL:s,nextL:i,prevCom:o,nextCom:u};p.index=a,t.push(p)}}if(i.length){let e=t.filter(e=>"L"!==e.type&&"M"!==e.type&&e.prevCom&&"L"===e.prevCom||"M"===e.prevCom&&"L"===u).sort((e,t)=>e.y-t.y||e.x-t.x)[0];c=e?e.index-1:0}else t=t.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),c=t[0].index;e=c?Ye(e,c):e}return r={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},n=e.length,o=e[n-2],u=o.type,p=o.values.slice(-2).map(e=>+e.toFixed(8)),h="L"===u&&p[0]===r.x&&p[1]===r.y,t&&h&&e.splice(n-2,1),l.push(...e),l}function Ye(e,t){let a=0,l="z"===e[e.length-1].type.toLowerCase();if(!l||t<1||e.length<3)return e;let n=l?1:0;!function(e){let t=e.length,a="z"===e[t-1].type.toLowerCase(),l=e[0],[n,r]=[l.values[0],l.values[1]].map(e=>+e.toFixed(8)),s=a?e[t-2]:e[t-1],i=s.values.length,[o,u]=[s.values[i-2],s.values[i-1]].map(e=>+e.toFixed(8));!a||n==o&&r==u||(e.pop(),e.push({type:"L",values:[n,r]},{type:"Z",values:[]}))}(e),a=t+1<e.length-1?t+1:e.length-1-n;let r,s,i=e.slice(a),o=e.slice(0,a);return o.shift(),r=o[o.length-1].values||[],s=[r[r.length-2],r[r.length-1]],n&&(i.pop(),o.push({type:"Z",values:[]})),e=[{type:"M",values:s},...i,...o]}function _e(e,{arcToCubic:t=!1,quadraticToCubic:a=!1,toClockwise:l=!1,returnD:n=!1}={}){const r=(e,t)=>{let a=[],l=[];if("A"!==e){for(let e=0;e<t.length;e+=2)a.push([t[e],t[e+1]]);l=a.pop(),a.reverse()}else{let e=0==t[4]?1:0;a=[t[0],t[1],t[2],t[3],e],l=[t[5],t[6]]}return{controlPoints:a,endPoints:l}};let s=[],i="z"===e[e.length-1].type.toLowerCase();i&&(e=(e=>{let t="z"===e[e.length-1].type.toLowerCase(),a=e[0],[l,n]=[a.values[0],a.values[1]],r=t?e[e.length-2]:e[e.length-1],[s,i]=[r.values[r.values.length-2],r.values[r.values.length-1]];return!t||l==s&&n==i||(e.pop(),e.push({type:"L",values:[l,n]},{type:"Z",values:[]})),e})(e),e.pop());let o=e[e.length-1].values,u=o.length,p=i?e[0]:{type:"M",values:[o[u-2],o[u-1]]};s.push(p),e.reverse();for(let t=1;t<e.length;t++){let a=e[t],l=a.type,n=a.values,i=e[t-1],o=i.type,u=[];u=[r(o,i.values).controlPoints,r(l,n).endPoints].flat(),s.push({type:o,values:u.flat()})}return i&&s.push({type:"z",values:[]}),s}function Ke(e=[],t=.666){let a=e.length;for(let l=1;l<a;l++){let a=e[l],n=e[l-1],{type:r,values:s}=a;e[l+1]&&e[l+1];let i=!1;if("C"===r){let a={x:s[0],y:s[1]},r={x:s[2],y:s[3]},o=n.values.slice(-2),u={x:o[0],y:o[1]},p={x:s[4],y:s[5]},h=ie(u,p),y=ie(u,a),c=ie(p,r),x=ie(a,r),f=O(u,a,p,r,!1),g=f?O(u,a,p,r,!0):null;if(f&&!g){O(p,H(p,r,3),u,a,!0)&&(i=!0)}y/h<.3&&c/h>.4&&(a=R([u,a],1+t/2),r=R([p,r],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y),(g||f&&x<h/5)&&(i=!0),i&&(a=R([u,f],t),r=R([p,f],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y)}}return e}function et(e,t,a=!0,l=!0){if(!Array.isArray(e)||void 0!==e[0].x){if(void 0===e[0].x)throw Error("Not a valid point array");e=(e=>Array.from(e).map(e=>[e.x,e.y]))(e)}if(1===(e=e.filter(function(t,a){return 0===a||!t.every((t,l)=>t===e[a-1][l])})).length)return[];if(2===e.length)return[{type:"L",values:[e[0][0],e[0][1]]},{type:"L",values:[e[1][0],e[1][1]]}];let n,r,s=e.length,i=st(e[1],e[0]),o=st(e[s-2],e[s-1]),u=(e=>{let t=[];return e.forEach(e=>{let a=e[1],l=e[2],n=e[3],r={type:"C",values:[a[0],a[1],l[0],l[1],n[0],n[1]]};t.push(r)}),t})(at(e,i,o,t));if(a){let t=u.length,a=u[0],i=u[t-1],o={x:e[0][0],y:e[0][1]},p={x:e[1][0],y:e[1][1]},h=e[2]?{x:e[2][0],y:e[2][1]}:null;h&&(n={x:a.values[0],y:a.values[1]},n=tt(n,o,p,h),a.values[0]=n.x,a.values[1]=n.y);let y={x:e[s-1][0],y:e[s-1][1]},c={x:e[s-2][0],y:e[s-2][1]},x=e[s-3]?{x:e[s-3][0],y:e[s-3][1]}:null;x&&(r={x:i.values[2],y:i.values[3]},r=tt(r,y,c,x),i.values[2]=r.x,i.values[3]=r.y),l&&(u=function(e=[],t=.666){let a=e.length;for(let l=0;l<a;l++){let a=e[l],n=e[l-1]||null,{type:r,values:s}=a;e[l+1]&&e[l+1];let i=!1;if("C"===r){let a={x:s[0],y:s[1]},r={x:s[2],y:s[3]},o=n.values.slice(-2),u={x:o[0],y:o[1]},p={x:s[4],y:s[5]},h=ie(u,p);ie(u,a),ie(p,r);let y=ie(a,r),c=O(u,a,p,r,!1);c&&(c&&O(u,a,p,r,!0)||y<h/5)&&(i=!0),i&&(a=R([u,c],t),r=R([p,c],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y)}}return e}([{type:"M",values:[e[0][0],e[0][1]]},...u]),u.shift())}return u}function tt(e,t,a,l){let n=G(t,a),r=G(t,l)-n;return e=J(e,t.x,t.y,-r)}let at=(e,t,a,l)=>{let n;if(2===e.length){let l=.333*re(e[0],e[1],!0);return n=[e[0],ot(e[0],ut(t,l)),ot(e[1],ut(a,l)),e[1]],[n]}let r=function(e){let t=[],a=e.length,l=e[0],n=e[1],r=0,s=0;for(let i=0;i<a;i++)n=e[i],r=s+re(n,l,!0),t.push(r),s=r,l=n;return t=t.map(function(e){return e/s}),t}(e),s=lt(e,r,r,t,a);n=s[0];let i=s[1],o=s[2];if(0===i||i<l)return[n];if(i<l*l){let s=r,u=i,p=o;for(let h=0;h<20;h++){s=nt(n,e,s);let h=lt(e,r,s,t,a);if(n=h[0],i=h[1],o=h[2],i<l)return[n];if(o===p){let e=i/u;if(e>.9999&&e<1.0001)break}u=i,p=o}}let u=[],p=it(e[o-1],e[o+1]);if(p.every(function(e){return 0===e})){p=it(e[o-1],e[o]);let t=[-p[1],p[0]];p[0]=t[0],p[1]=t[1]}let h=function(e){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]);return 0===t?[0,0]:[e[0]/t,e[1]/t]}(p),y=ut(h,-1);return u=u.concat(at(e.slice(0,o+1),t,h,l)),u=u.concat(at(e.slice(o),y,a,l)),u};const lt=(e,t,a,l,n)=>{let r,s,i;r=((e,t,a,l)=>{let n,r,s,i,o=e[0],u=e[e.length-1],p=[o,null,null,u],h=function(e){let t=[];for(;e--;)t.push([0,0]);return t}(t.length),y=t.length;for(let e=0;e<y;e++)s=t[e],i=1-s,n=h[e],n[0]=ut(a,3*s*(i*i)),n[1]=ut(l,3*i*(s*s));let c=[[0,0],[0,0]],x=[0,0],f=e.length;for(let a=0;a<f;a++)s=t[a],n=h[a],c[0][0]+=pt(n[0],n[0]),c[0][1]+=pt(n[0],n[1]),c[1][0]+=pt(n[0],n[1]),c[1][1]+=pt(n[1],n[1]),r=it(e[a],R([o,o,u,u],s)),x[0]+=pt(n[0],r),x[1]+=pt(n[1],r);let g=c[0][0]*c[1][1]-c[1][0]*c[0][1],m=c[0][0]*x[1]-c[1][0]*x[0],d=x[0]*c[1][1]-x[1]*c[0][1],v=0===g?0:d/g,M=0===g?0:m/g,b=re(o,u,!0),A=1e-6*b;return v<A||M<A?(p[1]=ot(o,ut(a,.333*b)),p[2]=ot(u,ut(l,.333*b))):(p[1]=ot(o,ut(a,v)),p[2]=ot(u,ut(l,M))),p})(e,a,l,n);let o=function(e,t,a){let l,n,r,s,i,o,u;n=0,r=Math.floor(.5*e.length);let p=function(e,t){let a,l=[0],n=e[0],r=0;for(let s=1;s<=t;s++)a=R(e,s/t),r+=re(a,n,!0),l.push(r),n=a;return l=l.map(function(e){return e/r}),l}(t,10),h=e.length;for(i=0;i<h;i++)o=e[i],u=rt(a[i],p,10),s=it(R(t,u),o),l=s[0]*s[0]+s[1]*s[1],l>n&&(n=l,r=i);return[n,r]}(e,r,t);return s=o[0],i=o[1],[r,s,i]};function nt(e,t,a){return a.map((a,l)=>function(e,t,a){let l=R(e,a),n=l[0]-t[0],r=l[1]-t[1],s=ht(e,a),i=n*s[0]+r*s[1],o=s[0]*s[0]+s[1]*s[1],u=ht(e,a,!0),p=2*(n*u[0]+r*u[1]),h=o+p;if(Math.abs(h)<1e-10)return a;return a-i/h}(e,t[l],a))}function rt(e,t,a){if(e<0)return 0;if(e>1)return 1;let l,n,r,s,i;for(let o=1;o<=a;o++)if(e<=t[o]){s=(o-1)/a,r=o/a,n=t[o-1],l=t[o],i=(e-n)/(l-n)*(r-s)+s;break}return i}function st(e,t){let a=e[0]-t[0],l=e[1]-t[1],n=Math.sqrt(a*a+l*l);return 0===n?[0,0]:[a/n,l/n]}function it(e,t){return[e[0]-t[0],e[1]-t[1]]}function ot(e,t){return[e[0]+t[0],e[1]+t[1]]}function ut(e,t){return[e[0]*t,e[1]*t]}function pt(e,t){return e[0]*t[0]+e[1]*t[1]}function ht(e,t,a=!1){let l,n,r=e[0],s=e[1],i=e[2],o=e[3],u=t,p=1-u,h=p*p,y=u*u;return a?(l=6*p*(i[0]-2*s[0]+r[0])+6*u*(o[0]-2*i[0]+s[0]),n=6*p*(i[1]-2*s[1]+r[1])+6*u*(o[1]-2*i[1]+s[1])):(l=3*h*(s[0]-r[0])+6*p*u*(i[0]-s[0])+3*y*(o[0]-i[0]),n=3*h*(s[1]-r[1])+6*p*u*(i[1]-s[1])+3*y*(o[1]-i[1])),[l,n]}function yt(e,{debug:t=!1,width:a=0,height:l=0,denoise:n=.9,keepCorners:r=!0,keepExtremes:s=!0,keepInflections:i=!1,manhattan:o=!1,absolute:u=!1,closed:p=!0,tolerance:h=1}={}){let y=s||r?function(e,{x:t=0,y:a=0,width:l=0,height:n=0,debug:r=!1}={}){let s=e.length,i=xe(e);l&&n||({x:t,y:a,width:l,height:n}=i);let o=.01*(l+n);for(let t=0;t<s;t++){let a=t>0?e[t-1]:e[s-1],l=e[t],n=de([a,l,t<s-1?e[t+1]:e[s-1]],!1);l.area=n,l.dist=ie(a,l)}for(let t=0;t<s;t++){t>1?e[t-2]:e[s-1];let a=t>0?e[t-1]:e[s-1],l=e[t],n=t<s-1?e[t+1]:e[s-1],r=xe([a,n]);se(a,n);let u=Math.abs(a.area),p=Math.abs(l.area),h=Math.abs(n.area),y=!1,c=!l.area||p<o,{left:x,right:f,top:g,bottom:m}=r,d=l.x<=x||l.x>=f||l.y<=g||l.y>=m,v=l.x===i.left||l.x===i.right||l.y===i.top||l.y===i.bottom;ie(l,a);let M=l.y===a.y&&l.x!==a.x,b=l.x===a.x&&l.y!==a.y;
|
|
9
|
+
if(C){let e="C"===n?Math.abs(l.cp2.x-l.p.x):Math.abs(l.cp1.x-l.p.x),t="C"===n?Math.abs(l.cp2.y-l.p.y):Math.abs(l.cp1.y-l.p.y);if(((0===t||t<w)&&e>0||(0===e||e<w)&&t>0)&&(L=!0),u.x!==h&&u.y!==c&&u.x!==y&&u.y!==x||(L=!0),!L){if(_(null,b)){let e=te(b);e.length&&e[0]>.2&&(L=!0)}}}if(L&&(l.extreme=!0),C&&k){if(r&&!l.extreme){let e=Math.abs(u.x-f.x),t=Math.abs(u.y-f.y),a=!1;if(e&&t&&e>A||t>A){let e=G(f,u),t=G(u,M.cp1);a=ne(Math.abs(e+t)/2)}a&&(l.semiExtreme=!0)}if((l.cptArea<0&&M.cptArea>0||l.cptArea>0&&M.cptArea<0)&&(l.directionChange=!0),!l.extreme){let e=f||p,t=M.cp1,a=me([e,u,t],!1),n=.01*se(e,t),r=Math.abs(a)<n,s=a<0&&l.cptArea>0||a>0&&l.cptArea<0;!r&&s&&(l.corner=!0)}}s&&(l.directionChange&&e(markers,l.p,"orange","1.5%","0.5"),l.corner&&e(markers,l.p,"magenta","1.5%","0.5"),l.extreme&&e(markers,l.p,"cyan","1%","0.5")),d.push(l)}return u={pathData:d,bb:p,dimA:(f+g)/2},u}function Ee(e={},t={},a={},l={},n=1){let r=H(e,t,1.5),s=H(l,a,1.5),i=.01*ie(e,l)*n,o=ie(r,s),u=null,p={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]};return o<i&&(u=O(e,t,l,a,!1),u&&(p.type="Q",p.values=[u.x,u.y,l.x,l.y],p.p0=e,p.cp1=u,p.cp2=null,p.p=l)),p}function Se(e,{toShorthands:t=!0,toLonghands:a=!1,toRelative:l=!0,toAbsolute:n=!1,decimals:r=3,arcToCubic:s=!1,quadraticToCubic:i=!1,hasRelatives:o=!0,hasShorthands:u=!0,hasQuadratics:p=!0,hasArcs:h=!0,testTypes:y=!1}={}){if(y){let t=Array.from(new Set(e.map(e=>e.type))).join("");/[lcqamts]/gi.test(t),p=/[qt]/gi.test(t),h=/[a]/gi.test(t),u=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return l=!n&&l,t=!a&&t,p&&i&&(e=Ie(e)),h&&s&&(e=Te(e)),t&&(e=function(e,t=-1,a=!1){let l;if(a){let t=e.map(e=>e.type).join("");l=/[astvqmhlc]/g.test(t)}e=a&&l?Fe(e):e;let n=e.length,r=new Array(n),s=e[0];r[0]=s;let i={x:e[0].values[0],y:e[0].values[1]},o=i;for(let t=1;t<n;t++){let a=e[t];s=a;let{type:l,values:n}=a,u=n.length,p=[n[u-2],n[u-1]],h=e[t-1];o={x:p[0],y:p[1]};let y=Math.abs(o.x-i.x),c=Math.abs(o.y-i.y),x=.01*ie(i,o),f=!1,g=!1,d=!1;if("C"===l&&"C"===h.type||"Q"===l&&"Q"===h.type){let e="C"===h.type?{x:h.values[2],y:h.values[3]}:{x:h.values[0],y:h.values[1]},t={x:n[0],y:n[1]},a=i.x-e.x,l=i.y-e.y;x=.025*ie(e,t),f=ie({x:e.x+2*a,y:e.y+2*l},t)<x}else"L"===l&&(g=0===c||c<x,d=0===y||y<x,f=d||g);switch(l){case"L":g&&(s={type:"H",values:[n[0]]}),d&&(s={type:"V",values:[n[1]]});break;case"Q":f&&(s={type:"T",values:[o.x,o.y]});break;case"C":f&&(s={type:"S",values:[n[2],n[3],o.x,o.y]});break;default:s={type:l,values:n}}i=o,r[t]=s}return r}(e)),u&&a&&(e=ze(e)),n&&(e=$e(e)),r>-1&&l&&(e=Le(e,r)),l&&(e=function(e,t=-1){return Fe(e,!0,t)}(e)),r>-1&&(e=Le(e,r)),e}function Te(e,{arcAccuracy:t=1}={}){let a=[e[0]];for(let l=1,n=e.length;l<n;l++){let n=e[l],r=e[l-1].values,s=r.length,i={x:r[s-2],y:r[s-1]};if("A"===n.type){je(i,n.values,t).forEach(e=>{a.push(e)})}else a.push(n)}return a}function Ie(e){let t=[e[0]];for(let a=1,l=e.length;a<l;a++){let l=e[a],n=e[a-1].values,r=n.length,s={x:n[r-2],y:n[r-1]};"Q"===l.type?t.push(De(s,l.values)):t.push(l)}return t}function De(e,t){Array.isArray(e)&&(e={x:e[0],y:e[1]});let a={x:e.x+2/3*(t[0]-e.x),y:e.y+2/3*(t[1]-e.y)},l={x:t[2]+2/3*(t[0]-t[2]),y:t[3]+2/3*(t[1]-t[3])};return{type:"C",values:[a.x,a.y,l.x,l.y,t[2],t[3]]}}function Fe(e,t=!1,a=-1){a>=0&&(e[0].values=e[0].values.map(e=>+e.toFixed(a)));let l=e.length,n=e[0].values,r=n[0],s=n[1],i=r,o=s;for(let n=1;n<l;n++){let l=e[n],{type:u,values:p}=l,h=p.length,y=u.toLowerCase(),c=u.toUpperCase(),x=t?y:c;if(u!==x)switch(l.type=x,y){case"a":p[5]=t?p[5]-r:p[5]+r,p[6]=t?p[6]-s:p[6]+s;break;case"v":p[0]=t?p[0]-s:p[0]+s;break;case"h":p[0]=t?p[0]-r:p[0]+r;break;case"m":t?(p[0]-=r,p[1]-=s):(p[0]+=r,p[1]+=s),i=t?p[0]+r:p[0],o=t?p[1]+s:p[1];break;default:if(p.length)for(let e=0;e<p.length;e++)p[e]=t?p[e]-(e%2?s:r):p[e]+(e%2?s:r)}switch(y){case"z":r=i,s=o;break;case"h":r=t?r+p[0]:p[0];break;case"v":s=t?s+p[0]:p[0];break;case"m":i=p[h-2]+(t?r:0),o=p[h-1]+(t?s:0);default:r=p[h-2]+(t?r:0),s=p[h-1]+(t?s:0)}a>=0&&(l.values=l.values.map(e=>+e.toFixed(a)))}return e}function $e(e,t=-1){return Fe(e,!1,t)}function ze(e,t=-1,a=!0){let l=!1;if(a){let t=e.map(e=>e.type).join(""),a=/[hstv]/gi.test(t);if(l=/[astvqmhlc]/g.test(t),!a)return e}let n=[],r={type:"M",values:(e=a&&l?$e(e,t):e)[0].values};n.push(r);for(let a=1,l=e.length;a<l;a++){let l,s,i,o,u,p,h,y,c=e[a],{type:x,values:f}=c,g=f.length,d=r.values,m=d.length,[v,M]=[f[g-2],f[g-1]],[b,A]=[d[m-2],d[m-1]];switch(x){case"H":r={type:"L",values:[f[0],A]};break;case"V":r={type:"L",values:[b,f[0]]};break;case"T":[l,s]=[d[0],d[1]],[b,A]=[d[m-2],d[m-1]],i=b+(b-l),o=A+(A-s),r={type:"Q",values:[i,o,v,M]};break;case"S":[l,s]=[d[0],d[1]],[b,A]=[d[m-2],d[m-1]],[h,y]=m>2&&"A"!==r.type?[d[2],d[3]]:[b,A],i=2*b-h,o=2*A-y,u=f[0],p=f[1],r={type:"C",values:[i,o,u,p,v,M]};break;default:r={type:x,values:f}}t>-1&&(r.values=r.values.map(e=>+e.toFixed(t))),n.push(r)}return n}function qe({p0:e={x:0,y:0},p:t={x:0,y:0},centroid:a={x:0,y:0},rx:l=0,ry:n=0,xAxisRotation:r=0,radToDegree:s=!1,startAngle:i=null,endAngle:o=null,deltaAngle:u=null}={}){if(!l||!n)return[];let p=[];const h=1.5707963267948966;let y=s?r:r*Math.PI/180,c=Math.cos(y),x=Math.sin(y);null!==i&&null!==o&&null!==u||({startAngle:i,endAngle:o,deltaAngle:u}=U(a,e,t));let f=l!==n?Y(i,l,n):i,g=l!==n?Y(u,l,n):u,d=Math.max(1,Math.ceil(Math.abs(g)/h)),m=g/d;for(let e=0;e<d;e++){const e=Math.abs(m)===h?.551785*Math.sign(m):4/3*Math.tan(m/4);let t=Math.cos(f),r=Math.sin(f),s=Math.cos(f+m),i=Math.sin(f+m),o=[];[{x:t-r*e,y:r+t*e},{x:s+i*e,y:i-s*e},{x:s,y:i}].forEach(e=>{let t=e.x*l,r=e.y*n;o.push(c*t-x*r+a.x,x*t+c*r+a.y)}),p.push({type:"C",values:o,cp1:{x:o[0],y:o[1]},cp2:{x:o[2],y:o[3]},p:{x:o[4],y:o[5]}}),f+=m}return p}function je(e,t,a=1){const l=2*Math.PI;let[n,r,s,i,o,u,p]=t;if(0===n||0===r)return[];let h=s?s*l/360:0,y=h?Math.sin(h):0,c=h?Math.cos(h):1,x=c*(e.x-u)/2+y*(e.y-p)/2,f=-y*(e.x-u)/2+c*(e.y-p)/2;if(0===x&&0===f)return[];n=Math.abs(n),r=Math.abs(r);let g=x*x/(n*n)+f*f/(r*r);if(g>1){let e=Math.sqrt(g);n*=e,r*=e}let d=n*n,m=n===r?d:r*r,v=x*x,M=f*f,b=d*m-d*M-m*v;b<=0?b=0:(b/=d*M+m*v,b=Math.sqrt(b)*(i===o?-1:1));let A=b?b*n/r*f:0,w=b?b*-r/n*x:0,C=c*A-y*w+(e.x+u)/2,k=y*A+c*w+(e.y+p)/2,L=(x-A)/n,P=(f-w)/r,E=(-x-A)/n,S=(-f-w)/r;const T=(e,t,a,l)=>{let n=+(e*a+t*l).toFixed(9);return 1===n||-1===n?1===n?0:Math.PI:(n=n>1?1:n<-1?-1:n,(e*l-t*a<0?-1:1)*Math.acos(n))};let I=T(1,0,L,P),D=T(L,P,E,S);0===o&&D>0?D-=2*Math.PI:1===o&&D<0&&(D+=2*Math.PI);let F=(+(Math.abs(D)/(l/4)).toFixed(0)||1)*a;D/=F;let $=[];const z=1.5707963267948966,q=.551785;let j=D===z?q:D===-z?-q:4/3*Math.tan(D/4),Q=D?Math.cos(D):1,B=D?Math.sin(D):0;const N=(e,t,a,l,n)=>{let r=e!=t?Math.cos(e):l,s=e!=t?Math.sin(e):n,i=Math.cos(e+t),o=Math.sin(e+t);return[{x:r-s*a,y:s+r*a},{x:i+o*a,y:o-i*a},{x:i,y:o}]};for(let e=0;e<F;e++){let e={type:"C",values:[]};N(I,D,j,Q,B).forEach(t=>{let a=t.x*n,l=t.y*r;e.values.push(c*a-y*l+C,y*a+c*l+k)}),$.push(e),I+=D}return $}function Qe(e,{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:n=!1,arcAccuracy:r=4}={}){let s=Array.isArray(e),i=s&&"object"==typeof e[0]&&"function"==typeof e[0].constructor,o=s?e:Ze(e),{hasRelatives:u=!0,hasShorthands:p=!0,hasQuadratics:h=!0,hasArcs:y=!0}=o,c=i?o:o.pathData;return c=function(e=[],{toAbsolute:t=!0,toLonghands:a=!0,quadraticToCubic:l=!1,arcToCubic:n=!1,arcAccuracy:r=2,hasRelatives:s=!0,hasShorthands:i=!0,hasQuadratics:o=!0,hasArcs:u=!0,testTypes:p=!1}={}){if(p){let t=Array.from(new Set(e.map(e=>e.type))).join("");s=/[lcqamts]/gi.test(t),o=/[qt]/gi.test(t),u=/[a]/gi.test(t),i=/[vhst]/gi.test(t),isPoly=/[mlz]/gi.test(t)}return(o&&l||u&&n)&&(a=!0,t=!0),s&&t&&(e=Fe(e,!1)),i&&a&&(e=ze(e,-1,!1)),u&&n&&(e=Te(e,r)),o&&l&&(e=Ie(e)),e}(c,{toAbsolute:t,toLonghands:a,quadraticToCubic:l,arcToCubic:n,arcAccuracy:r,hasRelatives:u,hasShorthands:p,hasQuadratics:h,hasArcs:y}),c}const Be=new Set([77,109,65,97,67,99,76,108,81,113,83,115,84,116,72,104,86,118,90,122]),Ne=new Uint8Array(128);Ne[77]=2,Ne[109]=2,Ne[65]=7,Ne[97]=7,Ne[67]=6,Ne[99]=6,Ne[76]=2,Ne[108]=2,Ne[81]=4,Ne[113]=4,Ne[83]=4,Ne[115]=4,Ne[84]=2,Ne[116]=2,Ne[72]=1,Ne[104]=1,Ne[86]=1,Ne[118]=1,Ne[90]=0,Ne[122]=0;const Ge=new Set([5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279]),Ue=e=>32===e||44===e||10===e||13===e||8232===e||8233===e||9===e||11===e||12===e||160===e||e>=5760&&Ge.has(e),Oe=(e="",t=0)=>{let a=e.length;return 3===t&&2===a?(e=[+e[0],+e[1]],t++):4===t&&a>1?(e=[+e[0],+e.substring(1)],t++):3===t&&a>=3?(e=[+e[0],+e[1],+e.substring(2)],t+=2):e=[+e],{val:e,valueIndex:t}};function Ze(e,t=!0,a=0){e=e.trim(),a&&console.log("!!!limit",a);let l={pathData:[],hasRelatives:!1,hasShorthands:!1,hasArcs:!1,hasQuadratics:!1,isPolygon:!1,log:[]};if(""===e)return l;let n,r=0,s=e.length,i="",o=-1,u="",p=!1,h=0,y=0,c=0,x=!1,f=new Set([]);const g=()=>{x&&("M"===i?i="L":"m"===i&&(i="l"),l.pathData.push({type:i,values:[]}),o++,y=0,x=!1)},d=(e=!1)=>{(e?h>0:""!==u)&&(t&&-1===o&&(n="Pathdata must start with M command",l.log.push(n),i="M",l.pathData.push({type:i,values:[]}),c=2,y=0,o++),"A"===i||"a"===i?(({val:u,valueIndex:y}=Oe(u,y)),l.pathData[o].values.push(...u)):(t&&u[1]&&"."!==u[1]&&"0"===u[0]&&(n=`${o}. command: Leading zeros not valid: ${u}`,l.log.push(n)),l.pathData[o].values.push(+u)),y++,u="",h=0,x=y>=c)},m=()=>{if(o>0){let e=l.pathData[o].values.length;if(e&&e<c||e&&e>c||("z"===i||"Z"===i)&&e>0){n=`${o}. command of type "${i}": ${c-e} values too few - ${c} expected`,l.log[l.log.length-1]!==n&&l.log.push(n)}}};let v=!1,M=!1,b=!1,A="";for(;r<s;){A=e.charCodeAt(r);let a=A>47&&A<58;if(a||(v=101===A||69===A,M=45===A||43===A,b=46===A),a||M||b||v){if(p||45!==A&&46!==A)g();else{let e=46===A;d(e),g(),e&&h++}u+=e[r],p=v,r++}else if((A<48||A>5759)&&Ue(A))d(),r++;else{if(A>64){if(!Be.has(A)){n=`${o}. command "${e[r]}" is not a valid type`,l.log.push(n),r++;continue}""!==u&&(l.pathData[o].values.push(+u),y++,u=""),t&&m(),i=e[r],c=Ne[A];let a="M"===i||"m"===i,s=o>0&&("z"===l.pathData[o].type||"Z"===l.pathData[o].type);f.add(i),s&&!a&&(l.pathData.push({type:"m",values:[0,0]}),o++),l.pathData.push({type:i,values:[]}),o++,h=0,y=0,x=!1,r++;continue}a||(n=`${o}. ${e[r]} is not a valid separarator or token`,l.log.push(n),u=""),r++}}d(),t&&m(),t&&l.log.length&&(n="Invalid path data:\n"+l.log.join("\n"),"log"===t?console.log(n):console.warn(n)),l.pathData[0].type="M";let w=Array.from(f).join("");return l.hasRelatives=/[lcqamtsvh]/g.test(w),l.hasShorthands=/[vhst]/gi.test(w),l.hasArcs=/[a]/gi.test(w),l.hasQuadratics=/[qt]/gi.test(w),l.isPolygon=!/[cqats]/gi.test(w),l}function He(e){if("path"===e.nodeName.toLowerCase())return e;let t=function(e,t=!1){let a,l,n,r,s,i,o,u,p,h,y,c,x,f,g,d,m=[],v=e.nodeName.toLowerCase();const M=(e,t=9)=>{const a="svg"!==e.nodeName?e.closest("svg"):e,l=e=>{if(null===e)return 0;let a=96,l=e.match(/([a-z]+)/gi);l=l?l[0]:"";let n,r=parseFloat(e);if(!l)return r;switch(l){case"in":n=a;break;case"pt":n=1/72*96;break;case"cm":n=1/2.54*96;break;case"mm":n=1/2.54*96/10;break;case"em":case"rem":n=16;break;default:n=1}return+(r*n).toFixed(t)};let n=a.getAttribute("width");n=n?l(n):300;let r=a.getAttribute("height");r=n?l(r):150;let s=a.getAttribute("viewBox");s=s?s.replace(/,/g," ").split(" ").filter(Boolean).map(e=>+e):[];let i=s.length?s[2]:n,o=s.length?s[3]:r,u=i/100,p=o/100,h=Math.sqrt((Math.pow(u,2)+Math.pow(p,2))/2),y=["x","width","x1","x2","rx","cx","r"],c=["y","height","y1","y2","ry","cy"];e.getAttributeNames().forEach(t=>{let a=e.getAttribute(t),n=a;if(y.includes(t)||c.includes(t)){let r=y.includes(t)?u:p;r="r"===t&&i!=o?h:r;let s=a.match(/([a-z|%]+)/gi);s=s?s[0]:"",n=a.includes("%")?parseFloat(a)*r:l(a),e.setAttribute(t,+n)}})};M(e);const b=t=>(a={},t.forEach(t=>{a[t]=+e.getAttribute(t)}),a);switch(v){case"path":n=e.getAttribute("d"),m=Qe(n);break;case"rect":l=["x","y","width","height","rx","ry"],({x:r,y:s,width:i,height:o,rx:p,ry:h}=b(l)),p||h?(p=p||h,h=h||p,p>i/2&&(p=i/2),h>o/2&&(h=o/2),m=[{type:"M",values:[r+p,s]},{type:"L",values:[r+i-p,s]},{type:"A",values:[p,h,0,0,1,r+i,s+h]},{type:"L",values:[r+i,s+o-h]},{type:"A",values:[p,h,0,0,1,r+i-p,s+o]},{type:"L",values:[r+p,s+o]},{type:"A",values:[p,h,0,0,1,r,s+o-h]},{type:"L",values:[r,s+h]},{type:"A",values:[p,h,0,0,1,r+p,s]},{type:"Z",values:[]}]):m=[{type:"M",values:[r,s]},{type:"L",values:[r+i,s]},{type:"L",values:[r+i,s+o]},{type:"L",values:[r,s+o]},{type:"Z",values:[]}];break;case"circle":case"ellipse":l=["cx","cy","rx","ry","r"],({cx:y,cy:c,r:u,rx:p,ry:h}=b(l));let t="circle"===v;t?(p=u,h=u):(p=p||u,h=h||u);let a=t&&u>=1?1:p,M=t&&u>=1?1:p;m=[{type:"M",values:[y+p,c]},{type:"A",values:[a,M,0,1,1,y-p,c]},{type:"A",values:[a,M,0,1,1,y+p,c]}];break;case"line":l=["x1","y1","x2","y2"],({x1:x,y1:g,x2:f,y2:d}=b(l)),m=[{type:"M",values:[x,g]},{type:"L",values:[f,d]}];break;case"polygon":case"polyline":let A=e.getAttribute("points").replaceAll(","," ").split(" ").filter(Boolean);for(let e=0;e<A.length;e+=2)m.push({type:0===e?"M":"L",values:[+A[e],+A[e+1]]});"polygon"===v&&m.push({type:"Z",values:[]})}return t?function(e){return e.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ")}(m):m}(e),a=t.map(e=>`${e.type} ${e.values} `).join(" "),l=[...e.attributes].map(e=>e.name),n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",a);let r=["x","y","x1","y1","x2","y2","cx","cy","dx","dy","r","rx","ry","width","height","points"];return l.forEach(t=>{if(!r.includes(t)){let a=e.getAttribute(t);n.setAttribute(t,a)}}),n}function Re(e,{tolerance:t=1,flatBezierToLinetos:a=!0}={}){let l=[e[0]],n={x:e[0].values[0],y:e[0].values[1]},r=n,s=n;e[e.length-1].type.toLowerCase();for(let i=1,o=e.length;i<o;i++){let u=e[i],p=e[i+1]||e[o-1],h="z"===p.type.toLowerCase()?n:{x:p.values[p.values.length-2],y:p.values[p.values.length-1]},{type:y,values:c}=u,x=c.slice(-2);s="Z"!==y?{x:x[0],y:x[1]}:n;let f=h?me([r,s,h],!0):1/0,g=se(r,h),d=f<(g?g/333*t:0),m=!1;if(a||"C"!==y||(d=!1),a&&("C"===y||"Q"===y)){m=we([r,..."C"===y?[{x:c[0],y:c[1]},{x:c[2],y:c[3]}]:"Q"===y?[{x:c[0],y:c[1]}]:[],s],{tolerance:t}),m&&i<o-1&&(y="L",u.type="L",u.values=x)}d&&i<o-1&&"A"!==p.type&&("L"===y||a&&m)||(r=s,"M"===y&&(n=s),l.push(u))}return l}function We(e){let t=[];for(let a=0,l=e.length;a<l;a++){let l=e[a];if(!l)continue;let{type:n=null,values:r=[]}=l,s=e[a+1]?e[a+1]:null;"M"!==n&&"m"!==n||s&&(!s||"Z"!==s.type&&"z"!==s.type)?t.push(l):s&&a++}return t}function Ve(e){let t={x:e[0].values[0],y:e[0].values[1]},a=t,l=[e[0]];for(let n=1,r=e.length;n<r;n++){let r=e[n],s=e[n-1],i=e[n+1]||null,{type:o,values:u}=r,p="m"===s.type.toLowerCase()&&!i,h=u.length;if(a={x:u[h-2],y:u[h-1]},p||"L"!==o||a.x!==t.x||a.y!==t.y){if(!p&&("l"===o||"v"===o||"h"===o)){if("l"===o?"00"===u.join(""):0===u[0])continue}l.push(r),t=a}}return l}function Je(e){let t=e.length;if(!("z"===e[t-1].type.toLowerCase()))return e;let a=0,l=[];for(let a=0;a<t;a++){let t=e[a],{type:n,values:r}=t,s=r.length;if(s){let e={type:n,x:r[s-2],y:r[s-1],index:0};e.index=a,l.push(e)}}return l=l.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),a=l[0].index,a?Ye(e,a):e}function Xe(e,{removeFinalLineto:t=!0,autoClose:a=!0}={}){let l=[],n=e.length,r={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},s="z"===e[n-1].type.toLowerCase(),i=e.filter(e=>"L"===e.type),o=e[s?n-2:n-1],u=o.type,p=o.values.slice(-2).map(e=>+e.toFixed(8)),h=p[0]===r.x&&p[1]===r.y;!s&&a&&h&&(e.push({type:"Z",values:[]}),s=!0,n++);let y="L"!==e[1].type&&(!h||"L"===o.type);if(y=!1,!s)return e;let c=0;{let t=[];for(let a=0;a<n;a++){let l=e[a],{type:n,values:r}=l;if(r.length){let l=r.slice(-2),s=e[a-1]&&"L"===e[a-1].type,i=e[a+1]&&"L"===e[a+1].type,o=e[a-1]?e[a-1].type.toUpperCase():null,u=e[a+1]?e[a+1].type.toUpperCase():null,p={type:n,x:l[0],y:l[1],dist:0,index:0,prevL:s,nextL:i,prevCom:o,nextCom:u};p.index=a,t.push(p)}}if(i.length){let e=t.filter(e=>"L"!==e.type&&"M"!==e.type&&e.prevCom&&"L"===e.prevCom||"M"===e.prevCom&&"L"===u).sort((e,t)=>e.y-t.y||e.x-t.x)[0];c=e?e.index-1:0}else t=t.sort((e,t)=>+e.y.toFixed(8)-+t.y.toFixed(8)||e.x-t.x),c=t[0].index;e=c?Ye(e,c):e}return r={x:+e[0].values[0].toFixed(8),y:+e[0].values[1].toFixed(8)},n=e.length,o=e[n-2],u=o.type,p=o.values.slice(-2).map(e=>+e.toFixed(8)),h="L"===u&&p[0]===r.x&&p[1]===r.y,t&&h&&e.splice(n-2,1),l.push(...e),l}function Ye(e,t){let a=0,l="z"===e[e.length-1].type.toLowerCase();if(!l||t<1||e.length<3)return e;let n=l?1:0;!function(e){let t=e.length,a="z"===e[t-1].type.toLowerCase(),l=e[0],[n,r]=[l.values[0],l.values[1]].map(e=>+e.toFixed(8)),s=a?e[t-2]:e[t-1],i=s.values.length,[o,u]=[s.values[i-2],s.values[i-1]].map(e=>+e.toFixed(8));!a||n==o&&r==u||(e.pop(),e.push({type:"L",values:[n,r]},{type:"Z",values:[]}))}(e),a=t+1<e.length-1?t+1:e.length-1-n;let r,s,i=e.slice(a),o=e.slice(0,a);return o.shift(),r=o[o.length-1].values||[],s=[r[r.length-2],r[r.length-1]],n&&(i.pop(),o.push({type:"Z",values:[]})),e=[{type:"M",values:s},...i,...o]}function _e(e,{arcToCubic:t=!1,quadraticToCubic:a=!1,toClockwise:l=!1,returnD:n=!1}={}){const r=(e,t)=>{let a=[],l=[];if("A"!==e){for(let e=0;e<t.length;e+=2)a.push([t[e],t[e+1]]);l=a.pop(),a.reverse()}else{let e=0==t[4]?1:0;a=[t[0],t[1],t[2],t[3],e],l=[t[5],t[6]]}return{controlPoints:a,endPoints:l}};let s=[],i="z"===e[e.length-1].type.toLowerCase();i&&(e=(e=>{let t="z"===e[e.length-1].type.toLowerCase(),a=e[0],[l,n]=[a.values[0],a.values[1]],r=t?e[e.length-2]:e[e.length-1],[s,i]=[r.values[r.values.length-2],r.values[r.values.length-1]];return!t||l==s&&n==i||(e.pop(),e.push({type:"L",values:[l,n]},{type:"Z",values:[]})),e})(e),e.pop());let o=e[e.length-1].values,u=o.length,p=i?e[0]:{type:"M",values:[o[u-2],o[u-1]]};s.push(p),e.reverse();for(let t=1;t<e.length;t++){let a=e[t],l=a.type,n=a.values,i=e[t-1],o=i.type,u=[];u=[r(o,i.values).controlPoints,r(l,n).endPoints].flat(),s.push({type:o,values:u.flat()})}return i&&s.push({type:"z",values:[]}),s}function Ke(e=[],t=.666){let a=e.length;for(let l=1;l<a;l++){let a=e[l],n=e[l-1],{type:r,values:s}=a;e[l+1]&&e[l+1];let i=!1;if("C"===r){let a={x:s[0],y:s[1]},r={x:s[2],y:s[3]},o=n.values.slice(-2),u={x:o[0],y:o[1]},p={x:s[4],y:s[5]},h=ie(u,p),y=ie(u,a),c=ie(p,r),x=ie(a,r),f=O(u,a,p,r,!1),g=f?O(u,a,p,r,!0):null;if(f&&!g){O(p,H(p,r,3),u,a,!0)&&(i=!0)}y/h<.3&&c/h>.4&&(a=R([u,a],1+t/2),r=R([p,r],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y),(g||f&&x<h/5)&&(i=!0),i&&(a=R([u,f],t),r=R([p,f],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y)}}return e}function et(e,t,a=!0,l=!0){if(!Array.isArray(e)||void 0!==e[0].x){if(void 0===e[0].x)throw Error("Not a valid point array");e=(e=>Array.from(e).map(e=>[e.x,e.y]))(e)}if(1===(e=e.filter(function(t,a){return 0===a||!t.every((t,l)=>t===e[a-1][l])})).length)return[];if(2===e.length)return[{type:"L",values:[e[0][0],e[0][1]]},{type:"L",values:[e[1][0],e[1][1]]}];let n,r,s=e.length,i=st(e[1],e[0]),o=st(e[s-2],e[s-1]),u=(e=>{let t=[];return e.forEach(e=>{let a=e[1],l=e[2],n=e[3],r={type:"C",values:[a[0],a[1],l[0],l[1],n[0],n[1]]};t.push(r)}),t})(at(e,i,o,t));if(a){let t=u.length,a=u[0],i=u[t-1],o={x:e[0][0],y:e[0][1]},p={x:e[1][0],y:e[1][1]},h=e[2]?{x:e[2][0],y:e[2][1]}:null;h&&(n={x:a.values[0],y:a.values[1]},n=tt(n,o,p,h),a.values[0]=n.x,a.values[1]=n.y);let y={x:e[s-1][0],y:e[s-1][1]},c={x:e[s-2][0],y:e[s-2][1]},x=e[s-3]?{x:e[s-3][0],y:e[s-3][1]}:null;x&&(r={x:i.values[2],y:i.values[3]},r=tt(r,y,c,x),i.values[2]=r.x,i.values[3]=r.y),l&&(u=function(e=[],t=.666){let a=e.length;for(let l=0;l<a;l++){let a=e[l],n=e[l-1]||null,{type:r,values:s}=a;e[l+1]&&e[l+1];let i=!1;if("C"===r){let a={x:s[0],y:s[1]},r={x:s[2],y:s[3]},o=n.values.slice(-2),u={x:o[0],y:o[1]},p={x:s[4],y:s[5]},h=ie(u,p);ie(u,a),ie(p,r);let y=ie(a,r),c=O(u,a,p,r,!1);c&&(c&&O(u,a,p,r,!0)||y<h/5)&&(i=!0),i&&(a=R([u,c],t),r=R([p,c],t),e[l].values[0]=a.x,e[l].values[1]=a.y,e[l].values[2]=r.x,e[l].values[3]=r.y)}}return e}([{type:"M",values:[e[0][0],e[0][1]]},...u]),u.shift())}return u}function tt(e,t,a,l){let n=G(t,a),r=G(t,l)-n;return e=J(e,t.x,t.y,-r)}let at=(e,t,a,l)=>{let n;if(2===e.length){let l=.333*re(e[0],e[1],!0);return n=[e[0],ot(e[0],ut(t,l)),ot(e[1],ut(a,l)),e[1]],[n]}let r=function(e){let t=[],a=e.length,l=e[0],n=e[1],r=0,s=0;for(let i=0;i<a;i++)n=e[i],r=s+re(n,l,!0),t.push(r),s=r,l=n;return t=t.map(function(e){return e/s}),t}(e),s=lt(e,r,r,t,a);n=s[0];let i=s[1],o=s[2];if(0===i||i<l)return[n];if(i<l*l){let s=r,u=i,p=o;for(let h=0;h<20;h++){s=nt(n,e,s);let h=lt(e,r,s,t,a);if(n=h[0],i=h[1],o=h[2],i<l)return[n];if(o===p){let e=i/u;if(e>.9999&&e<1.0001)break}u=i,p=o}}let u=[],p=it(e[o-1],e[o+1]);if(p.every(function(e){return 0===e})){p=it(e[o-1],e[o]);let t=[-p[1],p[0]];p[0]=t[0],p[1]=t[1]}let h=function(e){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]);return 0===t?[0,0]:[e[0]/t,e[1]/t]}(p),y=ut(h,-1);return u=u.concat(at(e.slice(0,o+1),t,h,l)),u=u.concat(at(e.slice(o),y,a,l)),u};const lt=(e,t,a,l,n)=>{let r,s,i;r=((e,t,a,l)=>{let n,r,s,i,o=e[0],u=e[e.length-1],p=[o,null,null,u],h=function(e){let t=[];for(;e--;)t.push([0,0]);return t}(t.length),y=t.length;for(let e=0;e<y;e++)s=t[e],i=1-s,n=h[e],n[0]=ut(a,3*s*(i*i)),n[1]=ut(l,3*i*(s*s));let c=[[0,0],[0,0]],x=[0,0],f=e.length;for(let a=0;a<f;a++)s=t[a],n=h[a],c[0][0]+=pt(n[0],n[0]),c[0][1]+=pt(n[0],n[1]),c[1][0]+=pt(n[0],n[1]),c[1][1]+=pt(n[1],n[1]),r=it(e[a],R([o,o,u,u],s)),x[0]+=pt(n[0],r),x[1]+=pt(n[1],r);let g=c[0][0]*c[1][1]-c[1][0]*c[0][1],d=c[0][0]*x[1]-c[1][0]*x[0],m=x[0]*c[1][1]-x[1]*c[0][1],v=0===g?0:m/g,M=0===g?0:d/g,b=re(o,u,!0),A=1e-6*b;return v<A||M<A?(p[1]=ot(o,ut(a,.333*b)),p[2]=ot(u,ut(l,.333*b))):(p[1]=ot(o,ut(a,v)),p[2]=ot(u,ut(l,M))),p})(e,a,l,n);let o=function(e,t,a){let l,n,r,s,i,o,u;n=0,r=Math.floor(.5*e.length);let p=function(e,t){let a,l=[0],n=e[0],r=0;for(let s=1;s<=t;s++)a=R(e,s/t),r+=re(a,n,!0),l.push(r),n=a;return l=l.map(function(e){return e/r}),l}(t,10),h=e.length;for(i=0;i<h;i++)o=e[i],u=rt(a[i],p,10),s=it(R(t,u),o),l=s[0]*s[0]+s[1]*s[1],l>n&&(n=l,r=i);return[n,r]}(e,r,t);return s=o[0],i=o[1],[r,s,i]};function nt(e,t,a){return a.map((a,l)=>function(e,t,a){let l=R(e,a),n=l[0]-t[0],r=l[1]-t[1],s=ht(e,a),i=n*s[0]+r*s[1],o=s[0]*s[0]+s[1]*s[1],u=ht(e,a,!0),p=2*(n*u[0]+r*u[1]),h=o+p;if(Math.abs(h)<1e-10)return a;return a-i/h}(e,t[l],a))}function rt(e,t,a){if(e<0)return 0;if(e>1)return 1;let l,n,r,s,i;for(let o=1;o<=a;o++)if(e<=t[o]){s=(o-1)/a,r=o/a,n=t[o-1],l=t[o],i=(e-n)/(l-n)*(r-s)+s;break}return i}function st(e,t){let a=e[0]-t[0],l=e[1]-t[1],n=Math.sqrt(a*a+l*l);return 0===n?[0,0]:[a/n,l/n]}function it(e,t){return[e[0]-t[0],e[1]-t[1]]}function ot(e,t){return[e[0]+t[0],e[1]+t[1]]}function ut(e,t){return[e[0]*t,e[1]*t]}function pt(e,t){return e[0]*t[0]+e[1]*t[1]}function ht(e,t,a=!1){let l,n,r=e[0],s=e[1],i=e[2],o=e[3],u=t,p=1-u,h=p*p,y=u*u;return a?(l=6*p*(i[0]-2*s[0]+r[0])+6*u*(o[0]-2*i[0]+s[0]),n=6*p*(i[1]-2*s[1]+r[1])+6*u*(o[1]-2*i[1]+s[1])):(l=3*h*(s[0]-r[0])+6*p*u*(i[0]-s[0])+3*y*(o[0]-i[0]),n=3*h*(s[1]-r[1])+6*p*u*(i[1]-s[1])+3*y*(o[1]-i[1])),[l,n]}function yt(e,{debug:t=!1,width:a=0,height:l=0,denoise:n=.9,keepCorners:r=!0,keepExtremes:s=!0,keepInflections:i=!1,manhattan:o=!1,absolute:u=!1,closed:p=!0,tolerance:h=1}={}){let y=s||r?function(e,{x:t=0,y:a=0,width:l=0,height:n=0,debug:r=!1}={}){let s=e.length,i=xe(e);l&&n||({x:t,y:a,width:l,height:n}=i);let o=.01*(l+n);for(let t=0;t<s;t++){let a=t>0?e[t-1]:e[s-1],l=e[t],n=me([a,l,t<s-1?e[t+1]:e[s-1]],!1);l.area=n,l.dist=ie(a,l)}for(let t=0;t<s;t++){t>1?e[t-2]:e[s-1];let a=t>0?e[t-1]:e[s-1],l=e[t],n=t<s-1?e[t+1]:e[s-1],r=xe([a,n]);se(a,n);let u=Math.abs(a.area),p=Math.abs(l.area),h=Math.abs(n.area),y=!1,c=!l.area||p<o,{left:x,right:f,top:g,bottom:d}=r,m=l.x<=x||l.x>=f||l.y<=g||l.y>=d,v=l.x===i.left||l.x===i.right||l.y===i.top||l.y===i.bottom;ie(l,a);let M=l.y===a.y&&l.x!==a.x,b=l.x===a.x&&l.y!==a.y;
|
|
10
10
|
//!isCloseExtreme &&
|
|
11
|
-
(M||b)&&(v=!0);let A=a.area<0&&l.area>0||a.area>0&&l.area<0,w=A&&!c;if(y=w,d&&!a.isDirChange&&(v=!0),b&&a.isHorizontal&&(a.isCorner=!0,a.isExtreme=!1,v=!1),w&&(a.isDirChange||a.isExtreme)&&(w=!1,l.isDirChange=!1),a.isExtreme&&p>h&&!w&&l.isHorizontal,v||A||p>u){let e=U(l,n,a),{deltaAngleDeg:t}=e;t=Math.abs(t),y=!(t<3||t>160)}l.isCorner=y,l.isExtreme=v,l.isHorizontal=M,l.isVertical=b,l.isDirChange=w}let u=[],p=[];for(let t=0;t<e.length;t++){let a=e[t],l=e[t+1]||null,n=e[t+2]||null,r=[];if(l&&l.isExtreme&&a.isExtreme&&!a.isCorner){let e=l.dist<2*o&&!l.isCorner,s=n&&n.isExtreme&&n.dist<2*o&&!n.isCorner;if(e&&!s?r.push(a,l):s&&r.push(a,l,n),r.length){let e=r.reduce((e,t)=>e+t.x,0)/r.length,l=r.reduce((e,t)=>e+t.y,0)/r.length;a.x=e,a.y=l,t+=r.length-1}}(a.isExtreme||a.isCorner||a.isDirChange)&&p.push(u.length),u.push(a)}let h=u.length,y=u[0],c=u[h-1],x=ie(y,c)<2*o;return y.isExtreme&&c.isExtreme&&x&&(c.x=y.x,c.y=y.y),u}(e,{debug:!1}):e,c=s||r?function(e,{closed:t=!0,keepCorners:a=!0,keepExtremes:l=!0,keepInflections:n=!1}={}){let r=[],s=[e[0]],i=e.length;for(let t=1;t<i;t++){t>0?e[t-1]:e[i-1];let n=e[t],o=t<i-1?e[t+1]:e[i-1];s.push(n),t>0&&(l&&o.isExtreme||a&&o.isCorner)&&(r.push(s),s=[])}return!r.length&&e.length>1&&(r=[e]),r}(y,{keepCorners:r,keepExtremes:s,keepInflections:i}):[y],x=a&&l?(a+l)/2*.004*h:2.5;x=2;let f=function(e=[],{closed:t=!0,tolerance:a=1}={}){let l=e.length,n=[{type:"M",values:[e[0][0].x,e[0][0].y]}];for(let t=0;t<l;t++){let l=e[t],r=e[t+1]?e[t+1]:null,s=[],i=l.length;l[l.length-1],r&&l.push(r[0]),i<2||2===i&&l[1].isExtreme?(l[l.length-1],s=l.map(e=>({type:"L",values:[e.x,e.y]}))):s=et(l,a),n.push(...s)}t&&n.push({type:"Z",values:[]});return function(e){let t=e.length;for(let a=1;a<t;a++){let t=e[a],l=e[a+1]||null,{type:n,values:r}=t;if("C"===n&&l&&"C"===l.type){let n=l.values;r[0],r[1];let s={x:r[2],y:r[3]},i={x:r[4],y:r[5]},o={x:n[0],y:n[1]};n[2],n[3];let u,p,h=Math.abs(s.x-i.x),y=Math.abs(s.y-i.y),c=Math.abs(o.x-i.x),x=Math.abs(o.y-i.y),f=.02*ie(o,s),g=y<f&&h>f,m=x<f&&c>f,d=h<f&&y>f,v=c<f&&x>f;(g||d)&&(u=g?{x:t.values[2],y:i.y}:d?{x:i.x,y:t.values[3]}:{x:t.values[2],y:t.values[3]},t.values[2]=u.x,t.values[3]=u.y),(m||v)&&(p=m?{x:l.values[0],y:i.y}:v?{x:i.x,y:l.values[1]}:{x:l.values[0],y:l.values[1]},e[a+1].values[0]=p.x,e[a+1].values[1]=p.y)}}}(n),n}(c,{closed:p,tolerance:2});return f}function ct(e,{threshold:t=null,tolerance:a=1}={}){if(!t){let a=function(e){let t=1/0,a=-1/0,l=1/0,n=-1/0;const r=e=>{e.x<t&&(t=e.x),e.x>a&&(a=e.x),e.y<l&&(l=e.y),e.y>n&&(n=e.y)};for(let t=0;t<e.length;t++){let a=e[t],{type:l,values:n}=a,s=n.length,i=(e[t-1]?e[t-1]:e[t]).values,o=i.length;if(s){let e={x:i[o-2],y:i[o-1]},t={x:n[s-2],y:n[s-1]};if(r(t),"C"===l||"Q"===l){let a={x:n[0],y:n[1]},s="C"===l?{x:n[2],y:n[3]}:a,i="C"===l?[e,a,s,t]:[e,a,t];K(i).forEach(e=>{let t=R(i,e);r(t)})}else"A"===l&&ee(e,n).forEach(e=>{r(e)})}}return{x:t,y:l,width:a-t,height:n-l}}(e);t=.05*(a.width+a.height)}let l=e.length;for(let n=0;n<l;n++){let l=e[n],{type:r,values:s,extreme:i,corner:o=!1,dimA:u,p0:p,p:h}=l,y=e[n+1]?e[n+1]:null,c=e[n+2]?e[n+2]:null,x=(y?ie(h,y.p):1/0)<t,f=(c?ie(c.p,y.p):1/0)<1*t;if(y&&c&&"C"===r&&"C"===y.type&&i&&c.extreme&&(f||x)){let l=Me(y,c,t,a,!1);if(1===l.length){l=l[0],e[n+1]=null,e[n+2].values=[l.cp1.x,l.cp1.y,l.cp2.x,l.cp2.y,l.p.x,l.p.y],e[n+2].cp1=l.cp1,e[n+2].cp2=l.cp2,e[n+2].p0=l.p0,e[n+2].p=l.p,e[n+2].extreme=l.extreme,n++;continue}}if(y&&"C"===r&&"C"===y.type&&i&&x){let e=de([l.p0,l.p,y.p]),t=de([l.p0,l.cp1,l.cp2,l.p]);if(e<0&&t>0||e>0&&t<0)continue}}l=(e=e.filter(Boolean)).length;let n="z"===e[l-1].type.toLowerCase()?l-2:l-1,r=e[n],s=e[n-1]||null,i={x:e[0].values[0],y:e[0].values[1]},o=r.values.slice(-2),u=+o[0].toFixed(8)===+i.x.toFixed(8)&&+o[1].toFixed(8)===+i.y.toFixed(8),p="C"===e[1].type&&e[1].extreme?e[1]:null,h=ie(r.p0,r.p)<t;if(s&&"C"===s.type&&h&&u&&p){let l=Me(s,r,t,a,!1);1===l.length&&(e[n-1]=l[0],e[n]=null,e=e.filter(Boolean))}return e}function xt({transforms:e=[],transformOrigin:t={x:0,y:0}}={}){let a=function(e=[],t={x:0,y:0}){const a=(e,t)=>({a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}),l=(e,t)=>({a:1,b:0,c:0,d:1,e:e,f:t}),n=(e,t)=>({a:e,b:0,c:0,d:t,e:0,f:0}),r=(e,t)=>{const a=e=>e*Math.PI/180;let[l,n]=e.map(e=>a(e)),r={};if("rot"===t){let e=Math.cos(l),t=Math.sin(l);r={a:e,b:t,c:-t,d:e,e:0,f:0}}else if("skew"===t){let e=Math.tan(l);r={a:1,b:Math.tan(n),c:e,d:1,e:0,f:0}}return r};let s={a:1,b:0,c:0,d:1,e:0,f:0};0===t.x&&0===t.y||(s=a(s,l(t.x,t.y)));const i={translate:[0,0],scale:[1,1],skew:[0,0],rotate:[0],matrix:[1,0,0,1,0,0]};for(const t of e){const e=Object.keys(t)[0],o=t[e]||i[e];let[u,p=i[e][1]]=o;switch("rotate"===e&&3===o.length&&(u=o[2]),e){case"matrix":let t=["a","b","c","d","e","f"];s=a(s,Object.fromEntries(t.map((e,t)=>[e,o[t]])));break;case"translate":(u||p)&&(s=a(s,l(u,p)));break;case"skew":(u||p)&&(s=a(s,r([u,p],"skew")));break;case"rotate":u&&(s=a(s,r([u],"rot")));break;case"scale":1===u&&1===p||(s=a(s,n(u,p)));break;default:throw new Error(`Unknown transformation type: ${e}`)}}0===t.x&&0===t.y||(s=a(s,l(-t.x,-t.y)));return s}(e,t);return a}const ft=["path","polygon","polyline","line","rect","circle","ellipse"],gt=["textPath","text","tspan"],mt={atts:{id:"*",class:"*",viewBox:["symbol","svg"],preserveAspectRatio:["symbol","svg"],width:["svg","rect","use","image"],height:["svg","rect","use","image"],d:["path"],points:["polygon","polyline"],x:["image","rect","text","textPath","tspan","use","mask"],y:["image","rect","text","textPath","tspan","use","mask"],x1:["line","linearGradient"],x2:["line","linearGradient"],y1:["line","linearGradient"],y2:["line","linearGradient"],r:["circle","radialGradient"],rx:["rect","ellipse"],ry:["rect","ellipse"],cx:["circle","ellipse","radialGradient"],cy:["circle","ellipse","radialGradient"],refX:["symbol","markers"],refY:["symbol","markers"],transform:["svg","g","use",...ft,...gt],"transform-origin":["svg","g","use",...ft,...gt],fill:["svg","g","use",...ft,...gt,"animate","animateMotion"],"fill-opacity":["svg","g","use",...ft,...gt],"fill-rule":["svg","g","path","polygon","text","textPath"],opacity:["svg","g","use",...ft,...gt],stroke:["svg","g","use",...ft,...gt],"stroke-width":["svg","g","use",...ft,...gt,"mask"],"stroke-opacity":["svg","g","use",...ft,...gt,"mask"],"stroke-miterlimit":["svg","g","use",...ft,...gt,"mask"],"stroke-linejoin":["svg","g","use",...ft,...gt,"mask"],"stroke-linecap":["svg","g","use",...ft,...gt,"mask"],"stroke-dashoffset":["svg","g","use",...ft,...gt,"mask"],"stroke-dasharray":["svg","g","use",...ft,...gt,"mask"],"clip-path":["svg","g","use",...ft,...gt],"clip-rule":["path","polygon"],clipPathUnits:["clipPath"],mask:["svg","g","use",...ft,...gt],maskContentUnits:["mask"],maskUnits:["mask"],"font-family":["svg","g",...gt],"font-size":["svg","g",...gt],"font-style":["svg","g",...gt],"font-weight":["svg","g",...gt],"font-stretch":["svg","g",...gt],"dominant-baseline":[...gt],lengthAdjust:[...gt],"text-anchor":["text"],textLength:["text","textPath","tspan"],dx:["text","tspan"],dy:["text","tspan"],method:["textPath"],spacing:["textPath"],startOffset:["textPath"],rotate:["text","tspan","animateMotion"],side:["textPath"],"white-space":["svg","g",...gt],color:["svg","g",...gt],playbackorder:["svg"],timelinebegin:["svg"],dur:["animate","animateTransform","animateMotion"],end:["animate","animateTransform","animateMotion"],from:["animate","animateTransform","animateMotion"],to:["animate","animateTransform","animateMotion"],type:["animateTransform"],values:["animate","animateTransform","animateMotion"],accumulate:["animate","animateTransform","animateMotion"],additive:["animate","animateTransform","animateMotion"],attributeName:["animate","animateTransform"],begin:["animate","animateTransform","animateMotion"],by:["animate","animateTransform","animateMotion"],calcMode:["animate","animateTransform","animateMotion"],keyPoints:["animateMotion"],keySplines:["animate","animateTransform","animateMotion"],keyTimes:["animate","animateTransform","animateMotion"],max:["animate","animateTransform","animateMotion"],min:["animate","animateTransform","animateMotion"],origin:["animateMotion"],repeatCount:["animate","animateTransform","animateMotion"],repeatDur:["animate","animateTransform","animateMotion"],restart:["animate","animateTransform","animateMotion"],gradientUnits:["linearGradient","radialGradient"],gradientTransform:["linearGradient","radialGradient"],fr:["radialGradient"],fx:["radialGradient"],fy:["radialGradient"],offset:["stop"],"stop-color":["stop"],"stop-opacity":["stop"],spreadMethod:["linearGradient","radialGradient"],href:["pattern","textPath","linearGradient","radialGradient","use","animate","animateTransform","animateMotion","image"],pathLength:[...ft]},defaults:{transform:["none","matrix(1, 0, 0, 1, 0, 0)"],"transform-origin":["0px, 0px","0 0"],rx:["0","0px"],ry:["0","0px"],x:["0","0px"],y:["0","0px"],fill:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],color:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],stroke:["none"],"stroke-width":["1","1px"],opacity:["1"],"fill-opacity":["1"],"stroke-opacity":["1"],"stroke-linecap":["butt"],"stroke-miterlimit":["4"],"stroke-linejoin":["miter"],"stroke-dasharray":["none"],"stroke-dashoffset":["0","0px","none"],pathLength:["none"],"font-family":["serif"],"font-weight":["normal","400"],"font-stretch":["normal"],"font-width":["normal"],"letter-spacing":["auto","normal","0"],lengthAdjust:["spacing"],"text-anchor":["start"],"dominant-baseline":["auto"],spacing:["auto"],"white-space":["normal"],"stop-opacity":["1"],gradientUnits:["objectBoundingBox"],patternUnits:["objectBoundingBox"],"clip-path":["none"],"clip-rule":["nonzero"],"fill-rule":["nonzero"],clipPathUnits:["userSpaceOnUse"],mask:["none"],maskUnits:["objectBoundingBox"]}};function dt(e,{removeNameSpaced:t=!0,decimals:a=-1}={}){let l=e.nodeName.toLowerCase(),n=function(e){let t={},a=[...e.attributes].map(e=>e.name),l=a.length;if(!l)return t;for(let n=0;n<l;n++){let l=a[n],r=e.getAttribute(l);t[l]=r}return t}(e),r=function(e){let t=e.getAttribute("style"),a=t?function(e=""){let t={};if(!e)return t;let a=e.split(";").filter(Boolean).map(e=>e.trim()),l=a.length;if(!l)return t;for(let e=0;l&&e<l;e++){let l=a[e],[n,r]=l.split(":").filter(Boolean);t[n]=r}return t}(t):{};return a}(e),s={...n,...r},i={},o=r.transform;if(o){let e=xt(function(e,t={x:0,y:0}){let a,l={transforms:[],transformOrigin:t},n=/(\w+)\(([^)]+)\)/g;function r(e){if("string"==typeof e){if(e.includes("rad"))return parseFloat(e)*(180/Math.PI);if(e.includes("turn"))return 360*parseFloat(e)}return parseFloat(e)}for(;null!==(a=n.exec(e));){let e=a[1],t=a[2].split(/,\s*/).map(e=>r(e));switch(e){case"translate":l.transforms.push({translate:[t[0]||0,t[1]||0]});break;case"translateX":l.transforms.push({translate:[t[0]||0,0,0]});break;case"translateY":l.transforms.push({translate:[0,t[0]||0,0]});break;case"scale":l.transforms.push({scale:[t[0]||0,t[1]||0]});break;case"skew":l.transforms.push({skew:[t[0]||0,t[1]||0]});break;case"skewX":l.transforms.push({skew:[t[0]||0,0]});break;case"skewY":l.transforms.push({skew:[0,t[0]||0]});break;case"rotate":l.transforms.push({rotate:[0,0,t[0]||0]});break;case"matrix":l.transforms.push({matrix:t})}}return e.split(/;\s*/).forEach(e=>{let[t,a]=e.split(":").map(e=>e.trim());if("transform-origin"===t||"perspective-origin"===t){let[e,n]=a.split(/\s+/).map(parseFloat);"transform-origin"===t&&(l.transformOrigin={x:e||0,y:n||0})}}),l}(`${o}`));s.transform=`matrix(${Object.values(e).join(",")})`}let u=["inline-size"],p=[];for(let a in s){let n=s[a];n&&a.startsWith("--")||u.includes(a)||!t&&a.startsWith("-")?p.push(`${a}:${n}`):(n&&mt.atts[a]&&("*"===mt.atts[a]||mt.atts[a].includes(l)||!t&&a.includes(":"))&&(i[a]=n),e.removeAttribute(a))}for(let t in i){let a=i[t];e.setAttribute(t,a)}return p.length&&e.setAttribute("style",p.join(";")),i}function vt(e,{returnDom:t=!1,removeHidden:a=!0,removeUnused:l=!0,stylesToAttributes:n=!0,removePrologue:r=!0,removeIds:s=!1,removeClassNames:i=!1,removeDimensions:o=!1,fixHref:u=!0,mergePaths:p=!1,cleanupSVGAtts:h=!0,removeNameSpaced:y=!0,attributesToGroup:c=!0,shapesToPaths:x=!1,decimals:f=-1,excludedEls:g=[]}={}){c=!!h,u&&(e=e.replaceAll("xlink:href=","href="));let m=(new DOMParser).parseFromString(e,"text/html").querySelector("svg");if(h){!function(e,t=["viewBox","xmlns","width","height","id","class"]){[...e.attributes].map(e=>e.name).forEach(a=>{t.includes(a)||e.removeAttribute(a)})}(m,["viewBox","xmlns","width","height","id","class","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin"])}let d=["metadata","script",...g],v=m.querySelectorAll("*"),M=[],b=["polygon","polyline","line","rect","circle","ellipse"];for(let e=0;e<v.length;e++){let t=v[e],l=t.nodeName.toLowerCase();if(x&&"path"!==l&&b.includes(l)){let e=He(t);t.replaceWith(e),l="path",t=e}let r=t.getAttribute("style")||"",s=!!r&&r.trim().includes("display:none"),i=t.getAttribute("display")&&"none"===t.getAttribute("display")||s;if(l.includes(":")||d.includes(l)||a&&i)t.remove();else if(n||c||p){let a=dt(t,{removeNameSpaced:y,decimals:f});"path"===l&&M.push({el:t,name:l,idx:e,propsFiltered:a})}}if((c||p)&&function(e=[],t=!0){let a,l=[[e[0]]],n=0,r="",s=e.length,i=e.filter(e=>e.propstr);if(!i.length&&t){let t=e[0];a=t.el;let l=t.propsFiltered.d;for(let t=1;t<s;t++){let a=e[t],n=a.el,r=a.propsFiltered.d;l+=r.startsWith("M")?r:Ze(r).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),n.remove()}return void a.setAttribute("d",l)}for(let t=0;t<s;t++){let a=e[t],i=a.propsFiltered,o=[];for(let e in i)"d"!==e&&"id"!==e&&o.push(`${e}:${i[e]}`);o=o.join("_"),a.propstr=o,s>1&&o===r?l[n].push(a):s>1&&l[n].length&&(l.push([]),n++),r=o}for(let e=0;e<l.length;e++){let n=l[e];if(n.length>1){let e=n[0].el,l=n[0].propsFiltered,r=e.parentNode.closest("g")?e.parentNode.closest("g"):null;r||(r=document.createElementNS("http://www.w3.org/2000/svg","g"),e.parentNode.insertBefore(r,e),n.forEach(e=>{r.append(e.el)}));let s=[...r.children];for(let e in l){if("d"!==e&&"id"!==e){let t=l[e];r.setAttribute(e,t),s.forEach(a=>{a.getAttribute(e)===t&&a.removeAttribute(e)})}if(t){n=n.filter(Boolean);let e=n.length;if(1===e)return n[0].el;a=n[0].el;let t=n[0].propsFiltered.d;for(let a=1;a<e;a++){let e=n[a],l=e.el,r=e.propsFiltered.d;t+=r.startsWith("M")?r:Ze(r).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),l.remove()}a.setAttribute("d",t)}}}}}(M,p),o&&(m.removeAttribute("width"),m.removeAttribute("height")),i||s){let e=i?"class":"id",t=`[${e}]`,a=m.querySelectorAll(t);m.removeAttribute(e),a.forEach(t=>{t.removeAttribute(e)})}return t?m:Mt(m)}function Mt(e,t=!1){let a=(new XMLSerializer).serializeToString(e);return t&&(a=a.replaceAll('xmlns="http://www.w3.org/2000/svg"',"")),a=a.replace(/\t/g,"").replace(/[\n\r|]/g,"\n").replace(/\n\s*\n/g,"\n").replace(/ +/g," ").replace(/> </g,"><").trim(),a}function bt(e,{threshold:t=0,tolerance:a=1}={}){let l=e.length,n=[e[0]],r="z"===e[l-1].type.toLowerCase(),s=!!r&&(e[l-1].p.x===e[0].p0.x&&e[l-1].p.y===e[0].p0.y),i=r?2:1,o=e[l-i],u="L"===o.type,p="C"===o.type,h="L"===e[1].type,y="C"===e[1].type,c=r&&y&&(u||s);c&&(e[l-1].values=e[0].values,e[l-1].type="L",u=!0);for(let t=1;t<l;t++){let s=e[t],{type:o}=s,x=e[t+1]?e[t+1]:null;if("L"===o&&x&&"C"===x.type||"C"===o&&x&&"L"===x.type){let c="L"===o?s:null,f=null,g=[],m=0;if(1===t&&y&&u&&(g=[e[1]],c=e[l-1],f=x),!c){n.push(s);continue}r&&p&&h&&t===l-i-1&&(f=e[1],g=[e[l-i]]);for(let a=t+1;a<l;a++){let t=e[a]?e[a]:null,l=e[a-1];if("C"===l.type&&g.push(l),"L"===t.type&&"C"===l.type){f=t;break}m++}if(f){let e=ie(c.p0,c.p),l=ie(f.p0,f.p);g.length;let r=ie(c.p,f.p0),i=de([c.p0,c.p,f.p0,f.p],!1),o=de([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],!1),u=i<0&&o>0||i>0&&o<0,p=.5*r*a,h=p<e&&p<l;if(g.length&&!u&&h){let e=Math.abs(o)<=.005*se(g[0].p0,g[0].p),a=e?null:O(c.p0,c.p,f.p0,f.p,!1);if(!e&&a){let e=.75*ie(R([c.p,a,f.p0],.5),1===g.length?R([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],.5):g[0].p);if(p&&e>p&&e>.3*r){n.push(s);continue}{let e={type:"Q",values:[a.x,a.y,f.p0.x,f.p0.y]};e.p0=c.p,e.cp1=a,e.p=f.p0,n.push(c,e),t+=m;continue}}}}}c&&t===l-1&&"L"===o||n.push(s)}return(c||r&&"Z"!==n[n.length-1].type)&&n.push({type:"Z",values:[]}),n}function At(e){if(e.length<3)return!1;let t=e[0],a=e[Math.floor(e.length/2)],l=e[e.length-1],n=t.x,r=t.y,s=a.x,i=a.y,o=l.x,u=l.y,p=n-s,h=r-i,y=n-o,c=r-u,x=(n*n-s*s+(r*r-i*i))/2,f=(n*n-o*o+(r*r-u*u))/2,g=p*c-h*y;if(Math.abs(g)<1e-10)return console.warn("Points are collinear or numerically unstable"),!1;let m={x:(c*x-h*f)/g,y:(-y*x+p*f)/g},d=re(m,t),v=U(m,t,l),{deltaAngle:M,startAngle:b,endAngle:A}=v;return{centroid:m,r:d,startAngle:b,endAngle:A,deltaAngle:M}}function wt(e,{threshold:a=0,tolerance:l=1,toCubic:n=!1,debug:r=!1}={}){let s=e.length,i=[e[0]],o=[];for(let a=1;a<s;a++){let l=e[a],{type:s}=l,u=e[a-1],p=e[a+1]?e[a+1]:null,h=e[a+2]?e[a+2]:null,y=e[a+3]?e[a+3]:null,c=null;"C"===l.type||"Q"===l.type?c=l:!p||"C"!==p.type&&"Q"!==p.type||(c=p);let x,f,g,m,d,v=c?"C"===c.type?[c.p0,c.cp1,c.cp2,c.p]:[c.p0,c.cp1,c.p]:[],M=0,b=0,A=!1,w=!1,C=[];if("L"===u.type&&"L"===s&&c&&"L"===h.type&&y&&("L"===y.type||"Z"===y.type)?(x=[l.p0,l.p],f=[h.p0,h.p],g=l.p0,m=h.p,M=de(v,!1),b=de([...x,...f],!1),A=M<0&&b>0||M>0&&b<0,A||(d=R(v,.5),C=[g,d,m],w=!0)):"C"!==s&&"Q"!==s||"L"!==u.type||"C"!==p.type&&"Q"!==p.type||"L"!==h.type||(w=!0,x=[u.p0,u.p],f=[h.p0,h.p],g=u.p,m=h.p0,d=c.p,C=[g,c.p,m]),w){let e=At(C);if(e){let s,{centroid:u,r:p,deltaAngle:h,startAngle:y,endAngle:c}=e,x=0,f=h>0?1:0,v=Math.abs(h)>Math.PI?1:0;if(oe(J(g,u.x,u.y,.5*h),d)<.05*oe(g,m)){if(s=qe({p0:g,p:m,centroid:u,rx:p,ry:p,xAxisRotation:x,sweep:f,largeArc:v,deltaAngle:h,startAngle:y,endAngle:c}),1===s.length){let e=Ee(g,s[0].cp1,s[0].cp2,m);"Q"===e.type&&(n=!0),l=e}if(s.length>1&&(n=!1),n||(l.type="A",l.values=[p,p,x,v,f,m.x,m.y]),l.p0=g,l.p=m,l.extreme=!1,l.corner=!1,r){o=n?[{type:"M",values:[g.x,g.y]},...s]:[{type:"M",values:[g.x,g.y]},{type:"A",values:[p,p,x,v,f,m.x,m.y]}];let e=ve(o);t(markers,e,"orange","0.5%","0.5")}i.push(l),a++;continue}}}i.push(l)}return i}function Ct(e=[],{threshold:t=0}={}){let a=e.length,l="z"===e[a-1].type.toLowerCase(),n=l?a-2:a-1,r=e[n],s=r.values.slice(-2),i={x:e[0].values[0],y:e[0].values[1]},o=oe(i,{x:s[0],y:s[1]});if(o&&o<t){let a=e[n].values.length;e[n].values[a-2]=i.x,e[n].values[a-1]=i.y;let l=e[1];if("C"===l.type&&"C"===r.type){let a=Math.abs(l.values[0]-r.values[2]),s=Math.abs(l.values[1]-r.values[3]),o=Math.abs(e[1].values[0]-l.values[0]),u=Math.abs(e[1].values[1]-l.values[1]),p=Math.abs(e[1].values[0]-r.values[2]),h=Math.abs(e[1].values[1]-r.values[3]),y=u<t&&h<t&&a;a&&a<t&&(o<t&&p<t&&s)&&(e[1].values[0]=i.x,e[n].values[2]=i.x),s&&s<t&&y&&(e[1].values[1]=i.y,e[n].values[3]=i.y)}}return e}function kt(e,t=1){let a=[];for(let l=0,n=e.length;l<n;l++){let n=e[l],{type:r,values:s}=n,i={type:r,values:[]};switch(r.toLowerCase()){case"h":case"v":i.values=[s[0]*t];break;case"a":i.values=[s[0]*t,s[1]*t,s[2],s[3],s[4],s[5]*t,s[6]*t];break;default:s.length&&(i.values=s.map((e,a)=>e*t))}a.push(i)}return a}function Lt(e,t=1){for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:n,values:r,p0:s,cp1:i=null,cp2:o=null,p:u=null}=l;if("C"===n){let n=Ee(s,i,o,u,t);"Q"===n.type&&(n.extreme=l.extreme,n.corner=l.corner,n.dimA=l.dimA,n.squareDist=l.squareDist,e[a]=n)}}return e}function Pt(e,{areaThreshold:t=2.5}={}){for(let a=0,l=e.length;a<l;a++){let l=e[a],n=e[a+1]||null,{type:r,values:s,p0:i,cp1:o=null,cp2:u=null,p:p=null}=l;if("C"===r&&n&&"C"===n.type){let l=Et(i,o,u,p,t),r=Et(n.p0,n.cp1,n.cp2,n.p,t);if(l.isArc&&r.isArc){let t=.01*ie(i,n.p),s=Math.abs(n.p.x-i.x),o=Math.abs(n.p.y-i.y),u=o<t&&s>t,h=s<t&&o>t,{rx:y,ry:c}=l,x=de([i,p,n.p])<0?0:1;if(h||u){y=Math.min(y,r.rx),c=Math.min(c,r.ry),e[a]=null,e[a+1].type="A",e[a+1].values=[y,c,0,0,x,n.p.x,n.p.y];continue}}}}return e=e.filter(Boolean)}function Et(e,t,a,l,n=7.5){let r,s={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]},i=0,o=!1,u=G(e,t,!0),p=G(l,a,!0),h=180*Math.abs(u-p)/Math.PI,y=0,c=0;if(Math.abs(h%180-90)<3){r=O(e,J(t,e.x,e.y,-.5*Math.PI),l,J(a,l.x,l.y,.5*Math.PI),!1);let u=O(e,t,l,a,!1);if(u){let r=re(e,u),p=re(l,u),h=+Math.max(r,p).toFixed(8),x=+Math.min(r,p).toFixed(8);y=x,c=h;let f=de([e,t,a,l])<0?0:1,g=Math.abs(l.x-e.x)>Math.abs(l.y-e.y);100/y*Math.abs(y-c)<5&&(y=h,c=y),g&&(y=h,c=x);let m=me([{type:"M",values:[e.x,e.y]},{type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]}]),d={type:"A",values:[y,c,0,0,f,l.x,l.y]};i=Math.PI*(y*c)/4,i-=Math.abs(de([e,l,u])),function(e,t){let a=Math.abs(e-t);return Math.abs(100-100/e*(e+a))}(m,i)<n&&(o=!0,s=d)}}return{com:s,isArc:o,area:i,rx:y,ry:c,centroid:r}}function St(e,{angles:t=[],split:a=0,getPathData:l=!0,width:n=0,height:r=0}={}){let s=e.length,i={x:e[0].values[0],y:e[0].values[1]},o=i,u=[],p=[o],h=0;if(a=a||1,n&&r)h=.025*(n+r)/a;else{h=e.map(e=>e.dimA||0).filter(Boolean).sort()[0]}for(let t=1;t<s;t++){let l=e[t],n=e[t+1]||null,{type:r,values:s}=l,u=s.length,y=u?{x:s[u-2],y:s[u-1]}:i;if("C"===r||"Q"===r){let e={x:s[0],y:s[1]},t="C"===r?{x:s[2],y:s[3]}:e,n="C"===r?[o,e,t,y]:[o,e,y],i=l.dimA;a=Math.ceil(i/h);let u=[];for(let e=1;e<a;e++)u.push(1/a*e);u.forEach(e=>{let t=R(n,e);p.push(t)})}"M"===r&&(i=y),y.area=l.cptArea||0,y.isExtreme=l.extreme||!1,y.isCorner=l.corner||!1,y.isDirChange=l.directionChange||!1,p.push(y),l.extreme||l.corner||n&&n.type,o=y}return p=function(e,{quality:t=.9,width:a=0,height:l=0,absolute:n=!1,manhattan:r=!1,exclude:s=[]}={}){"string"==typeof t&&(n=!0,t=parseFloat(t));if(e.length<4||(!n&&t)>=1)return e;let i=t;if(!n){if(i=1-t,!a&&!l){let t=ue(e,12);({width:a,height:l}=xe(t))}i=r?.05*(a+l)*(1-t):(i*((a+l)/2/25))**2}let o,u=e[0],p=[u],h=e.length,y=s.length,c=0;for(let t=1;t<h;t++)o=e[t],c=r?ie(u,o):se(u,o),!(c<i)||y&&s.includes(t)?(p.push(o),u=o):u=o;return u.x!==o.x&&u.y!==o.y&&p.push(o),p}(p,{quality:.5,width:n,height:r}),u=function(e,t=!0){let a=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))];return t&&a.push({type:"Z",values:[]}),a}(p),l?u:p}function Tt(e){for(let t=1,a=e.length;t<a;t++){let a=e[t],{type:l,values:n,p0:r,cp1:s=null,cp2:i=null,p:o=null}=a;if("L"===l){let a=H(r,o,.333),l=H(o,r,.333);e[t].type="C",e[t].values=[a.x,a.y,l.x,l.y,o.x,o.y],e[t].cp1=a,e[t].cp2=l}}return e}function It(e=[],t=!1){let a=[];e.forEach((e,t)=>{let l=function(e=[]){let t=[];for(let a=0;a<e.length;a++){let l=e[a],n=a>0?e[a-1]:e[a],{type:r,values:s}=l,i={x:n.values[n.values.length-2],y:n.values[n.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",u=s.length?{x:s[0],y:s[1]}:"";switch(r){case"A":je(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},n={x:a[2],y:a[3]},r={x:a[4],y:a[5]};t.push(l,n,r)});break;case"C":let e={x:s[2],y:s[3]};t.push(u,e);break;case"Q":t.push(u)}"z"!==r.toLowerCase()&&t.push(o)}return t}(e.pathData),n=de(l)>=0;a.push({pts:l,bb:xe(l),cw:n,index:t,inter:0,includes:[],includedIn:[]})});let l=a.length;for(let e=0;e<l;e++){let t=a[e],n=t.bb;for(let r=0;r<l;r++){let l=a[r],s=l.bb;e===r||l.includes.includes(e)||Z({x:s.left+s.width/2,y:s.top+s.height/2},t.pts,n)&&(a[r].inter+=1,l.includedIn.push(e),t.includes.push(r))}}for(let n=0;n<l;n++){let l=a[n],{cw:r,includedIn:s,includes:i}=l;(!s.length&&r&&!t||!s.length&&!r&&t)&&(e[n].pathData=_e(e[n].pathData),a[n].cw=!a[n].cw,r=a[n].cw);for(let t=0;t<i.length;t++){let l=i[t];a[l].cw===r&&(e[l].pathData=_e(e[l].pathData),a[l].cw=!a[l].cw)}}return e}function Dt(e="",{getObject:t=!1,toAbsolute:a=!0,toRelative:l=!0,toShorthands:n=!0,quadraticToCubic:r=!0,arcToCubic:s=!1,cubicToArc:i=!1,simplifyBezier:o=!0,optimizeOrder:u=!0,autoClose:p=!0,removeZeroLength:h=!0,refineClosing:y=!0,removeColinear:c=!0,flatBezierToLinetos:x=!0,revertToQuadratics:f=!0,refineExtremes:g=!0,simplifyCorners:m=!1,removeDimensions:d=!1,removeIds:v=!1,removeClassNames:M=!1,omitNamespace:b=!1,fixDirections:A=!1,keepExtremes:w=!0,keepCorners:C=!0,extrapolateDominant:k=!0,keepInflections:L=!1,addExtremes:P=!1,addSemiExtremes:E=!1,smoothPoly:S=!1,harmonizeCpts:T=!1,toPolygon:I=!1,removeOrphanSubpaths:D=!1,simplifyRound:F=!1,scale:$=1,scaleTo:z=0,crop:q=!1,alignToOrigin:j=!1,decimals:Q=3,autoAccuracy:B=!0,minifyD:N=0,tolerance:G=1,reversePath:U=!1,cleanupSVGAtts:O=!0,removePrologue:Z=!0,stylesToAttributes:H=!0,fixHref:R=!0,removeNameSpaced:V=!0,attributesToGroup:J=!1,mergePaths:X=!1,removeHidden:Y=!0,removeUnused:_=!0,shapesToPaths:K=!1,lineToCubic:ee=!1,tMin:te=0,tMax:ae=1}={}){G=Math.max(.1,G),$=Math.max(.001,$);let le=function(e){let t="string";if(Array.isArray(e))return e[0]?.type&&e[0]?.values?"pathData":"array";if("string"==typeof e){let a=(e=e.trim()).includes("<svg")&&e.includes("</svg"),l=e.startsWith("M")||e.startsWith("m"),n=!isNaN(e.substring(0,1))&&!isNaN(e.substring(e.length-1,e.length));if(a)t="svgMarkup";else if(l)t="pathDataString";else if(n)t="polyString";else{let a=/^(file:|https?:\/\/|\/|\.\/|\.\.\/)/.test(e),l=e.startsWith("data:image");t=a||l?"url":"string"}return t}return t=typeof e,(e.constructor.name||t).toLowerCase()}(e),ne="",re=0,se=0,ie=0,oe={},ue="",he="svgMarkup"===le?1:0,ye=[];re=e.length;let fe={x:0,y:0,width:0,height:0},ge={x:0,y:0,width:0,height:0},me=[],de=[];if(he){if(ne=vt(e,{removeIds:v,removeClassNames:M,removeDimensions:d,cleanupSVGAtts:O,returnDom:!0,removeHidden:Y,removeUnused:_,removeNameSpaced:V,stylesToAttributes:H,removePrologue:Z,fixHref:R,mergePaths:X,shapesToPaths:K}),K){ne.querySelectorAll("polygon, polyline, line, rect, circle, ellipse").forEach(e=>{let t=He(e);e.replaceWith(t)})}ne.querySelectorAll("path").forEach(e=>{ye.push({d:e.getAttribute("d"),el:e})}),fe=function(e=null,t=-1){const a=e=>e&&isNaN(e)?e.match(/[^\d|.]+/g)[0]:"";if(!e)return!1;let l=e.hasAttribute("width"),n=e.hasAttribute("height"),r=e.hasAttribute("viewBox"),s=l?e.getAttribute("width"):0,i=n?e.getAttribute("height"):0,o=!!l&&a(s),u=!!n&&a(s),p=s?s.includes("%")?0:parseFloat(s):300,h=i?i.includes("%")?0:parseFloat(i):150,y=r?e.getAttribute("viewBox").split(/,| /).filter(Boolean).map(Number):[0,0,p,h];return t>-1&&([p,h]=[p,h].map(e=>+e.toFixed(t)),y=y.map(e=>+e.toFixed(t))),{x:y[0],y:y[1],width:y[2],height:y[3],w:p,h:h,hasViewBox:r,hasWidth:l,hasHeight:n,widthUnit:o,heightUnit:u}}(ne,Q)}else{if("pathDataString"===le)ue=e;else if("polyString"===le)ue="M"+e;else if("pathData"===le){ue=e,re=ue.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ").length}ye.push({d:ue,el:null})}let Me={toRelative:l,toShorthands:n,decimals:Q},Ae=[];for(let e=0,t=ye.length;t&&e<t;e++){let t=ye[e],{d:l,el:n}=t,d=Qe(l,{quadraticToCubic:r,toAbsolute:a,arcToCubic:s}),v=S||I?xe(W(d)):null;if(1!==$||z){if(z)if(fe.width&&!q)$=z/fe.width;else{let e=d.map(e=>({type:e.type,values:e.values}));e=Se(e,{arcToCubic:!0}),e=ce(e);let t=xe(W(e));me.push(t.x,t.x+t.width),de.push(t.y,t.y+t.height);let a=z/t.width;$=a}d=kt(d,$)}let M=d.length;D&&(d=We(d));let b=pe(d),O=b.length,Z=[];for(let e=0;e<O;e++){let t=b[e];if(I){o=!1,S=!1,T=!1,t=Re(t);let e=Pe(t),{bb:a,pathData:l}=e;t=l,t=St(t,{angles:[],split:1,width:v.width,height:v.height,getPathData:!0})}if(S){let e=Array.from(new Set(t.map(e=>e.type))).join(""),a=!/[acqts]/gi.test(e),l=/[z]/gi.test(e);if(a){t=Ve(t),t=yt(W(t),{denoise:.8,tolerance:G,width:v.width,height:v.height,manhattan:!1,absolute:!1,keepCorners:C,keepExtremes:w,keepInflections:L,closed:l})}}T&&(t=Ke(t)),(c||h)&&(t=Ve(t)),u&&(t=Je(t)),c&&(t=Re(t,{tolerance:G,flatBezierToLinetos:!1})),(P||E)&&(t=ce(t,{tMin:te,tMax:ae,addExtremes:P,addSemiExtremes:E,angles:[30]})),U&&(t=_e(t));let a=Pe(t,{detectSemiExtremes:E}),{pathData:l,bb:n,dimA:r}=a;if(me.push(n.x,n.x+n.width),de.push(n.y,n.y+n.height),y&&(l=Ct(l,{threshold:.001*r})),l=o?be(l,{simplifyBezier:o,keepInflections:L,keepExtremes:w,keepCorners:C,extrapolateDominant:k,revertToQuadratics:f,tolerance:G}):l,g){l=ct(l,{threshold:.05*(n.width+n.height),tolerance:G})}if(i&&(l=Pt(l,{areaThreshold:2.5})),c&&x&&(l=Re(l,{tolerance:G,flatBezierToLinetos:x})),m){l=bt(l,{threshold:.1*(n.width+n.height),tolerance:G})}F&&(l=wt(l)),f&&(l=Lt(l,G)),ee&&(l=Tt(l)),u&&(l=Xe(l,{autoClose:p})),Z.push({pathData:l,bb:n})}let H=Math.min(...me),R=Math.min(...de);ge={x:H,y:R,width:Math.max(...me)-H,height:Math.max(...de)-R};let V=ge.height>ge.width;if(u&&(Z=V?Z.sort((e,t)=>e.bb.y-t.bb.y||e.bb.x-t.bb.x):Z.sort((e,t)=>e.bb.x-t.bb.x||e.bb.y-t.bb.y)),A&&(Z=It(Z)),d=[],Z.forEach(e=>{d.push(...e.pathData)}),B&&(Q=Ce(d),Me.decimals=Q),X=!1,n&&X)Ae.push(...d);else{d=Se(d,Me),d=Ve(d),j&&(console.log(ge),d[0].values[0]=(d[0].values[0]-ge.x).toFixed(Q),d[0].values[1]=(d[0].values[1]-ge.y).toFixed(Q),ge.x=0,ge.y=0);let e=d.length,a=ve(d,N);se=a.length,ie=+(100/re*se).toFixed(2),t.d=a,t.report={original:M,new:e,saved:M-e,compression:ie,decimals:Q},n&&n.setAttribute("d",a)}}if(he){if(Ae.length){let e=Se(Ae,Me);e=Ve(e);let t=ve(e,N);ye[0].el.setAttribute("d",t);for(let e=1;e<ye.length;e++){let t=ye[e].el;t&&t.remove()}!function(e){e.querySelectorAll("g, defs").forEach(e=>{e.children.length||e.remove()})}(ne)}if($){let{x:e,y:t,width:a,height:l,w:n,h:r,hasViewBox:s,hasWidth:i,hasHeight:o,widthUnit:u,heightUnit:p}=fe;q&&(e=ge.x,t=ge.y,a=ge.width,l=ge.height,n=a,r=l),s&&ne.setAttribute("viewBox",[e,t,a,l].map(e=>+(e*$).toFixed(Q)).join(" ")),i&&ne.setAttribute("width",+(n*$).toFixed(Q)+u),o&&ne.setAttribute("height",+(r*$).toFixed(Q)+p)}if(A){ne.querySelectorAll("path[fill-rule], path[clip-rule]").forEach(e=>{e.removeAttribute("fill-rule"),e.removeAttribute("clip-rule")})}ne=Mt(ne,b),se=ne.length,ie=+(100/re*se).toFixed(2),re=+(re/1024).toFixed(3),se=+(se/1024).toFixed(3),oe={svgSize:re,svgSizeOpt:se,compression:ie,decimals:Q}}else({d:ue,report:oe}=ye[0]);return t?{svg:ne,d:ue,report:oe,inputType:le,mode:he}:ue||ne}"undefined"!=typeof window&&(window.svgPathSimplify=Dt);export{b as PI,a as abs,l as acos,n as asin,r as atan,s as atan2,i as ceil,o as cos,u as exp,p as floor,y as hypot,h as log,c as max,x as min,f as pow,g as random,m as round,d as sin,v as sqrt,Dt as svgPathSimplify,M as tan};
|
|
11
|
+
(M||b)&&(v=!0);let A=a.area<0&&l.area>0||a.area>0&&l.area<0,w=A&&!c;if(y=w,m&&!a.isDirChange&&(v=!0),b&&a.isHorizontal&&(a.isCorner=!0,a.isExtreme=!1,v=!1),w&&(a.isDirChange||a.isExtreme)&&(w=!1,l.isDirChange=!1),a.isExtreme&&p>h&&!w&&l.isHorizontal,v||A||p>u){let e=U(l,n,a),{deltaAngleDeg:t}=e;t=Math.abs(t),y=!(t<3||t>160)}l.isCorner=y,l.isExtreme=v,l.isHorizontal=M,l.isVertical=b,l.isDirChange=w}let u=[],p=[];for(let t=0;t<e.length;t++){let a=e[t],l=e[t+1]||null,n=e[t+2]||null,r=[];if(l&&l.isExtreme&&a.isExtreme&&!a.isCorner){let e=l.dist<2*o&&!l.isCorner,s=n&&n.isExtreme&&n.dist<2*o&&!n.isCorner;if(e&&!s?r.push(a,l):s&&r.push(a,l,n),r.length){let e=r.reduce((e,t)=>e+t.x,0)/r.length,l=r.reduce((e,t)=>e+t.y,0)/r.length;a.x=e,a.y=l,t+=r.length-1}}(a.isExtreme||a.isCorner||a.isDirChange)&&p.push(u.length),u.push(a)}let h=u.length,y=u[0],c=u[h-1],x=ie(y,c)<2*o;return y.isExtreme&&c.isExtreme&&x&&(c.x=y.x,c.y=y.y),u}(e,{debug:!1}):e,c=s||r?function(e,{closed:t=!0,keepCorners:a=!0,keepExtremes:l=!0,keepInflections:n=!1}={}){let r=[],s=[e[0]],i=e.length;for(let t=1;t<i;t++){t>0?e[t-1]:e[i-1];let n=e[t],o=t<i-1?e[t+1]:e[i-1];s.push(n),t>0&&(l&&o.isExtreme||a&&o.isCorner)&&(r.push(s),s=[])}return!r.length&&e.length>1&&(r=[e]),r}(y,{keepCorners:r,keepExtremes:s,keepInflections:i}):[y],x=a&&l?(a+l)/2*.004*h:2.5;x=2;let f=function(e=[],{closed:t=!0,tolerance:a=1}={}){let l=e.length,n=[{type:"M",values:[e[0][0].x,e[0][0].y]}];for(let t=0;t<l;t++){let l=e[t],r=e[t+1]?e[t+1]:null,s=[],i=l.length;l[l.length-1],r&&l.push(r[0]),i<2||2===i&&l[1].isExtreme?(l[l.length-1],s=l.map(e=>({type:"L",values:[e.x,e.y]}))):s=et(l,a),n.push(...s)}t&&n.push({type:"Z",values:[]});return function(e){let t=e.length;for(let a=1;a<t;a++){let t=e[a],l=e[a+1]||null,{type:n,values:r}=t;if("C"===n&&l&&"C"===l.type){let n=l.values;r[0],r[1];let s={x:r[2],y:r[3]},i={x:r[4],y:r[5]},o={x:n[0],y:n[1]};n[2],n[3];let u,p,h=Math.abs(s.x-i.x),y=Math.abs(s.y-i.y),c=Math.abs(o.x-i.x),x=Math.abs(o.y-i.y),f=.02*ie(o,s),g=y<f&&h>f,d=x<f&&c>f,m=h<f&&y>f,v=c<f&&x>f;(g||m)&&(u=g?{x:t.values[2],y:i.y}:m?{x:i.x,y:t.values[3]}:{x:t.values[2],y:t.values[3]},t.values[2]=u.x,t.values[3]=u.y),(d||v)&&(p=d?{x:l.values[0],y:i.y}:v?{x:i.x,y:l.values[1]}:{x:l.values[0],y:l.values[1]},e[a+1].values[0]=p.x,e[a+1].values[1]=p.y)}}}(n),n}(c,{closed:p,tolerance:2});return f}function ct(e,{threshold:t=null,tolerance:a=1}={}){if(!t){let a=function(e){let t=1/0,a=-1/0,l=1/0,n=-1/0;const r=e=>{e.x<t&&(t=e.x),e.x>a&&(a=e.x),e.y<l&&(l=e.y),e.y>n&&(n=e.y)};for(let t=0;t<e.length;t++){let a=e[t],{type:l,values:n}=a,s=n.length,i=(e[t-1]?e[t-1]:e[t]).values,o=i.length;if(s){let e={x:i[o-2],y:i[o-1]},t={x:n[s-2],y:n[s-1]};if(r(t),"C"===l||"Q"===l){let a={x:n[0],y:n[1]},s="C"===l?{x:n[2],y:n[3]}:a,i="C"===l?[e,a,s,t]:[e,a,t];K(i).forEach(e=>{let t=R(i,e);r(t)})}else"A"===l&&ee(e,n).forEach(e=>{r(e)})}}return{x:t,y:l,width:a-t,height:n-l}}(e);t=.05*(a.width+a.height)}let l=e.length;for(let n=0;n<l;n++){let l=e[n],{type:r,values:s,extreme:i,corner:o=!1,dimA:u,p0:p,p:h}=l,y=e[n+1]?e[n+1]:null,c=e[n+2]?e[n+2]:null,x=(y?ie(h,y.p):1/0)<t,f=(c?ie(c.p,y.p):1/0)<1*t;if(y&&c&&"C"===r&&"C"===y.type&&i&&c.extreme&&(f||x)){let l=Me(y,c,t,a,!1);if(1===l.length){l=l[0],e[n+1]=null,e[n+2].values=[l.cp1.x,l.cp1.y,l.cp2.x,l.cp2.y,l.p.x,l.p.y],e[n+2].cp1=l.cp1,e[n+2].cp2=l.cp2,e[n+2].p0=l.p0,e[n+2].p=l.p,e[n+2].extreme=l.extreme,n++;continue}}if(y&&"C"===r&&"C"===y.type&&i&&x){let e=me([l.p0,l.p,y.p]),t=me([l.p0,l.cp1,l.cp2,l.p]);if(e<0&&t>0||e>0&&t<0)continue}}l=(e=e.filter(Boolean)).length;let n="z"===e[l-1].type.toLowerCase()?l-2:l-1,r=e[n],s=e[n-1]||null,i={x:e[0].values[0],y:e[0].values[1]},o=r.values.slice(-2),u=+o[0].toFixed(8)===+i.x.toFixed(8)&&+o[1].toFixed(8)===+i.y.toFixed(8),p="C"===e[1].type&&e[1].extreme?e[1]:null,h=ie(r.p0,r.p)<t;if(s&&"C"===s.type&&h&&u&&p){let l=Me(s,r,t,a,!1);1===l.length&&(e[n-1]=l[0],e[n]=null,e=e.filter(Boolean))}return e}function xt({transforms:e=[],transformOrigin:t={x:0,y:0}}={}){let a=function(e=[],t={x:0,y:0}){const a=(e,t)=>({a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d,e:e.a*t.e+e.c*t.f+e.e,f:e.b*t.e+e.d*t.f+e.f}),l=(e,t)=>({a:1,b:0,c:0,d:1,e:e,f:t}),n=(e,t)=>({a:e,b:0,c:0,d:t,e:0,f:0}),r=(e,t)=>{const a=e=>e*Math.PI/180;let[l,n]=e.map(e=>a(e)),r={};if("rot"===t){let e=Math.cos(l),t=Math.sin(l);r={a:e,b:t,c:-t,d:e,e:0,f:0}}else if("skew"===t){let e=Math.tan(l);r={a:1,b:Math.tan(n),c:e,d:1,e:0,f:0}}return r};let s={a:1,b:0,c:0,d:1,e:0,f:0};0===t.x&&0===t.y||(s=a(s,l(t.x,t.y)));const i={translate:[0,0],scale:[1,1],skew:[0,0],rotate:[0],matrix:[1,0,0,1,0,0]};for(const t of e){const e=Object.keys(t)[0],o=t[e]||i[e];let[u,p=i[e][1]]=o;switch("rotate"===e&&3===o.length&&(u=o[2]),e){case"matrix":let t=["a","b","c","d","e","f"];s=a(s,Object.fromEntries(t.map((e,t)=>[e,o[t]])));break;case"translate":(u||p)&&(s=a(s,l(u,p)));break;case"skew":(u||p)&&(s=a(s,r([u,p],"skew")));break;case"rotate":u&&(s=a(s,r([u],"rot")));break;case"scale":1===u&&1===p||(s=a(s,n(u,p)));break;default:throw new Error(`Unknown transformation type: ${e}`)}}0===t.x&&0===t.y||(s=a(s,l(-t.x,-t.y)));return s}(e,t);return a}const ft=["path","polygon","polyline","line","rect","circle","ellipse"],gt=["textPath","text","tspan"],dt={atts:{id:"*",class:"*",viewBox:["symbol","svg"],preserveAspectRatio:["symbol","svg"],width:["svg","rect","use","image"],height:["svg","rect","use","image"],d:["path"],points:["polygon","polyline"],x:["image","rect","text","textPath","tspan","use","mask"],y:["image","rect","text","textPath","tspan","use","mask"],x1:["line","linearGradient"],x2:["line","linearGradient"],y1:["line","linearGradient"],y2:["line","linearGradient"],r:["circle","radialGradient"],rx:["rect","ellipse"],ry:["rect","ellipse"],cx:["circle","ellipse","radialGradient"],cy:["circle","ellipse","radialGradient"],refX:["symbol","markers"],refY:["symbol","markers"],transform:["svg","g","use",...ft,...gt],"transform-origin":["svg","g","use",...ft,...gt],fill:["svg","g","use",...ft,...gt,"animate","animateMotion"],"fill-opacity":["svg","g","use",...ft,...gt],"fill-rule":["svg","g","path","polygon","text","textPath"],opacity:["svg","g","use",...ft,...gt],stroke:["svg","g","use",...ft,...gt],"stroke-width":["svg","g","use",...ft,...gt,"mask"],"stroke-opacity":["svg","g","use",...ft,...gt,"mask"],"stroke-miterlimit":["svg","g","use",...ft,...gt,"mask"],"stroke-linejoin":["svg","g","use",...ft,...gt,"mask"],"stroke-linecap":["svg","g","use",...ft,...gt,"mask"],"stroke-dashoffset":["svg","g","use",...ft,...gt,"mask"],"stroke-dasharray":["svg","g","use",...ft,...gt,"mask"],"clip-path":["svg","g","use",...ft,...gt],"clip-rule":["path","polygon"],clipPathUnits:["clipPath"],mask:["svg","g","use",...ft,...gt],maskContentUnits:["mask"],maskUnits:["mask"],"font-family":["svg","g",...gt],"font-size":["svg","g",...gt],"font-style":["svg","g",...gt],"font-weight":["svg","g",...gt],"font-stretch":["svg","g",...gt],"dominant-baseline":[...gt],lengthAdjust:[...gt],"text-anchor":["text"],textLength:["text","textPath","tspan"],dx:["text","tspan"],dy:["text","tspan"],method:["textPath"],spacing:["textPath"],startOffset:["textPath"],rotate:["text","tspan","animateMotion"],side:["textPath"],"white-space":["svg","g",...gt],color:["svg","g",...gt],playbackorder:["svg"],timelinebegin:["svg"],dur:["animate","animateTransform","animateMotion"],end:["animate","animateTransform","animateMotion"],from:["animate","animateTransform","animateMotion"],to:["animate","animateTransform","animateMotion"],type:["animateTransform"],values:["animate","animateTransform","animateMotion"],accumulate:["animate","animateTransform","animateMotion"],additive:["animate","animateTransform","animateMotion"],attributeName:["animate","animateTransform"],begin:["animate","animateTransform","animateMotion"],by:["animate","animateTransform","animateMotion"],calcMode:["animate","animateTransform","animateMotion"],keyPoints:["animateMotion"],keySplines:["animate","animateTransform","animateMotion"],keyTimes:["animate","animateTransform","animateMotion"],max:["animate","animateTransform","animateMotion"],min:["animate","animateTransform","animateMotion"],origin:["animateMotion"],repeatCount:["animate","animateTransform","animateMotion"],repeatDur:["animate","animateTransform","animateMotion"],restart:["animate","animateTransform","animateMotion"],gradientUnits:["linearGradient","radialGradient"],gradientTransform:["linearGradient","radialGradient"],fr:["radialGradient"],fx:["radialGradient"],fy:["radialGradient"],offset:["stop"],"stop-color":["stop"],"stop-opacity":["stop"],spreadMethod:["linearGradient","radialGradient"],href:["pattern","textPath","linearGradient","radialGradient","use","animate","animateTransform","animateMotion","image"],pathLength:[...ft]},defaults:{transform:["none","matrix(1, 0, 0, 1, 0, 0)"],"transform-origin":["0px, 0px","0 0"],rx:["0","0px"],ry:["0","0px"],x:["0","0px"],y:["0","0px"],fill:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],color:["black","rgb(0, 0, 0)","rgba(0, 0, 0, 0)","#000","#000000"],stroke:["none"],"stroke-width":["1","1px"],opacity:["1"],"fill-opacity":["1"],"stroke-opacity":["1"],"stroke-linecap":["butt"],"stroke-miterlimit":["4"],"stroke-linejoin":["miter"],"stroke-dasharray":["none"],"stroke-dashoffset":["0","0px","none"],pathLength:["none"],"font-family":["serif"],"font-weight":["normal","400"],"font-stretch":["normal"],"font-width":["normal"],"letter-spacing":["auto","normal","0"],lengthAdjust:["spacing"],"text-anchor":["start"],"dominant-baseline":["auto"],spacing:["auto"],"white-space":["normal"],"stop-opacity":["1"],gradientUnits:["objectBoundingBox"],patternUnits:["objectBoundingBox"],"clip-path":["none"],"clip-rule":["nonzero"],"fill-rule":["nonzero"],clipPathUnits:["userSpaceOnUse"],mask:["none"],maskUnits:["objectBoundingBox"]}};function mt(e,{removeNameSpaced:t=!0,decimals:a=-1}={}){let l=e.nodeName.toLowerCase(),n=function(e){let t={},a=[...e.attributes].map(e=>e.name),l=a.length;if(!l)return t;for(let n=0;n<l;n++){let l=a[n],r=e.getAttribute(l);t[l]=r}return t}(e),r=function(e){let t=e.getAttribute("style"),a=t?function(e=""){let t={};if(!e)return t;let a=e.split(";").filter(Boolean).map(e=>e.trim()),l=a.length;if(!l)return t;for(let e=0;l&&e<l;e++){let l=a[e],[n,r]=l.split(":").filter(Boolean);t[n]=r}return t}(t):{};return a}(e),s={...n,...r},i={},o=r.transform;if(o){let e=xt(function(e,t={x:0,y:0}){let a,l={transforms:[],transformOrigin:t},n=/(\w+)\(([^)]+)\)/g;function r(e){if("string"==typeof e){if(e.includes("rad"))return parseFloat(e)*(180/Math.PI);if(e.includes("turn"))return 360*parseFloat(e)}return parseFloat(e)}for(;null!==(a=n.exec(e));){let e=a[1],t=a[2].split(/,\s*/).map(e=>r(e));switch(e){case"translate":l.transforms.push({translate:[t[0]||0,t[1]||0]});break;case"translateX":l.transforms.push({translate:[t[0]||0,0,0]});break;case"translateY":l.transforms.push({translate:[0,t[0]||0,0]});break;case"scale":l.transforms.push({scale:[t[0]||0,t[1]||0]});break;case"skew":l.transforms.push({skew:[t[0]||0,t[1]||0]});break;case"skewX":l.transforms.push({skew:[t[0]||0,0]});break;case"skewY":l.transforms.push({skew:[0,t[0]||0]});break;case"rotate":l.transforms.push({rotate:[0,0,t[0]||0]});break;case"matrix":l.transforms.push({matrix:t})}}return e.split(/;\s*/).forEach(e=>{let[t,a]=e.split(":").map(e=>e.trim());if("transform-origin"===t||"perspective-origin"===t){let[e,n]=a.split(/\s+/).map(parseFloat);"transform-origin"===t&&(l.transformOrigin={x:e||0,y:n||0})}}),l}(`${o}`));s.transform=`matrix(${Object.values(e).join(",")})`}let u=["inline-size"],p=[];for(let a in s){let n=s[a];n&&a.startsWith("--")||u.includes(a)||!t&&a.startsWith("-")?p.push(`${a}:${n}`):(n&&dt.atts[a]&&("*"===dt.atts[a]||dt.atts[a].includes(l)||!t&&a.includes(":"))&&(i[a]=n),e.removeAttribute(a))}for(let t in i){let a=i[t];e.setAttribute(t,a)}return p.length&&e.setAttribute("style",p.join(";")),i}function vt(e,{returnDom:t=!1,removeHidden:a=!0,removeUnused:l=!0,stylesToAttributes:n=!0,removePrologue:r=!0,removeIds:s=!1,removeClassNames:i=!1,removeDimensions:o=!1,fixHref:u=!0,mergePaths:p=!1,cleanupSVGAtts:h=!0,removeNameSpaced:y=!0,attributesToGroup:c=!0,shapesToPaths:x=!1,decimals:f=-1,excludedEls:g=[]}={}){c=!!h,u&&(e=e.replaceAll("xlink:href=","href="));let d=(new DOMParser).parseFromString(e,"text/html").querySelector("svg");if(h){!function(e,t=["viewBox","xmlns","width","height","id","class"]){[...e.attributes].map(e=>e.name).forEach(a=>{t.includes(a)||e.removeAttribute(a)})}(d,["viewBox","xmlns","width","height","id","class","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin"])}let m=["metadata","script",...g],v=d.querySelectorAll("*"),M=[],b=["polygon","polyline","line","rect","circle","ellipse"];for(let e=0;e<v.length;e++){let t=v[e],l=t.nodeName.toLowerCase();if(x&&"path"!==l&&b.includes(l)){let e=He(t);t.replaceWith(e),l="path",t=e}let r=t.getAttribute("style")||"",s=!!r&&r.trim().includes("display:none"),i=t.getAttribute("display")&&"none"===t.getAttribute("display")||s;if(l.includes(":")||m.includes(l)||a&&i)t.remove();else if(n||c||p){let a=mt(t,{removeNameSpaced:y,decimals:f});"path"===l&&M.push({el:t,name:l,idx:e,propsFiltered:a})}}if((c||p)&&function(e=[],t=!0){let a,l=[[e[0]]],n=0,r="",s=e.length,i=e.filter(e=>e.propstr);if(!i.length&&t){let t=e[0];a=t.el;let l=t.propsFiltered.d;for(let t=1;t<s;t++){let a=e[t],n=a.el,r=a.propsFiltered.d;l+=r.startsWith("M")?r:Ze(r).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),n.remove()}return void a.setAttribute("d",l)}for(let t=0;t<s;t++){let a=e[t],i=a.propsFiltered,o=[];for(let e in i)"d"!==e&&"id"!==e&&o.push(`${e}:${i[e]}`);o=o.join("_"),a.propstr=o,s>1&&o===r?l[n].push(a):s>1&&l[n].length&&(l.push([]),n++),r=o}for(let e=0;e<l.length;e++){let n=l[e];if(n.length>1){let e=n[0].el,l=n[0].propsFiltered,r=e.parentNode.closest("g")?e.parentNode.closest("g"):null;r||(r=document.createElementNS("http://www.w3.org/2000/svg","g"),e.parentNode.insertBefore(r,e),n.forEach(e=>{r.append(e.el)}));let s=[...r.children];for(let e in l){if("d"!==e&&"id"!==e){let t=l[e];r.setAttribute(e,t),s.forEach(a=>{a.getAttribute(e)===t&&a.removeAttribute(e)})}if(t){n=n.filter(Boolean);let e=n.length;if(1===e)return n[0].el;a=n[0].el;let t=n[0].propsFiltered.d;for(let a=1;a<e;a++){let e=n[a],l=e.el,r=e.propsFiltered.d;t+=r.startsWith("M")?r:Ze(r).pathData.map(e=>`${e.type} ${e.values.join(" ")}`).join(" "),l.remove()}a.setAttribute("d",t)}}}}}(M,p),o&&(d.removeAttribute("width"),d.removeAttribute("height")),i||s){let e=i?"class":"id",t=`[${e}]`,a=d.querySelectorAll(t);d.removeAttribute(e),a.forEach(t=>{t.removeAttribute(e)})}return t?d:Mt(d)}function Mt(e,t=!1){let a=(new XMLSerializer).serializeToString(e);return t&&(a=a.replaceAll('xmlns="http://www.w3.org/2000/svg"',"")),a=a.replace(/\t/g,"").replace(/[\n\r|]/g,"\n").replace(/\n\s*\n/g,"\n").replace(/ +/g," ").replace(/> </g,"><").trim(),a}function bt(e,{threshold:t=0,tolerance:a=1}={}){let l=e.length,n=[e[0]],r="z"===e[l-1].type.toLowerCase(),s=!!r&&(e[l-1].p.x===e[0].p0.x&&e[l-1].p.y===e[0].p0.y),i=r?2:1,o=e[l-i],u="L"===o.type,p="C"===o.type,h="L"===e[1].type,y="C"===e[1].type,c=r&&y&&(u||s);c&&(e[l-1].values=e[0].values,e[l-1].type="L",u=!0);for(let t=1;t<l;t++){let s=e[t],{type:o}=s,x=e[t+1]?e[t+1]:null;if("L"===o&&x&&"C"===x.type||"C"===o&&x&&"L"===x.type){let c="L"===o?s:null,f=null,g=[],d=0;if(1===t&&y&&u&&(g=[e[1]],c=e[l-1],f=x),!c){n.push(s);continue}r&&p&&h&&t===l-i-1&&(f=e[1],g=[e[l-i]]);for(let a=t+1;a<l;a++){let t=e[a]?e[a]:null,l=e[a-1];if("C"===l.type&&g.push(l),"L"===t.type&&"C"===l.type){f=t;break}d++}if(f){let e=ie(c.p0,c.p),l=ie(f.p0,f.p);g.length;let r=ie(c.p,f.p0),i=me([c.p0,c.p,f.p0,f.p],!1),o=me([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],!1),u=i<0&&o>0||i>0&&o<0,p=.5*r*a,h=p<e&&p<l;if(g.length&&!u&&h){let e=Math.abs(o)<=.005*se(g[0].p0,g[0].p),a=e?null:O(c.p0,c.p,f.p0,f.p,!1);if(!e&&a){let e=.75*ie(R([c.p,a,f.p0],.5),1===g.length?R([g[0].p0,g[0].cp1,g[0].cp2,g[0].p],.5):g[0].p);if(p&&e>p&&e>.3*r){n.push(s);continue}{let e={type:"Q",values:[a.x,a.y,f.p0.x,f.p0.y]};e.p0=c.p,e.cp1=a,e.p=f.p0,n.push(c,e),t+=d;continue}}}}}c&&t===l-1&&"L"===o||n.push(s)}return(c||r&&"Z"!==n[n.length-1].type)&&n.push({type:"Z",values:[]}),n}function At(e){if(e.length<3)return!1;let t=e[0],a=e[Math.floor(e.length/2)],l=e[e.length-1],n=t.x,r=t.y,s=a.x,i=a.y,o=l.x,u=l.y,p=n-s,h=r-i,y=n-o,c=r-u,x=(n*n-s*s+(r*r-i*i))/2,f=(n*n-o*o+(r*r-u*u))/2,g=p*c-h*y;if(Math.abs(g)<1e-10)return console.warn("Points are collinear or numerically unstable"),!1;let d={x:(c*x-h*f)/g,y:(-y*x+p*f)/g},m=re(d,t),v=U(d,t,l),{deltaAngle:M,startAngle:b,endAngle:A}=v;return{centroid:d,r:m,startAngle:b,endAngle:A,deltaAngle:M}}function wt(e,{threshold:a=0,tolerance:l=1,toCubic:n=!1,debug:r=!1}={}){let s=e.length,i=[e[0]],o=[];for(let a=1;a<s;a++){let l=e[a],{type:s}=l,u=e[a-1],p=e[a+1]?e[a+1]:null,h=e[a+2]?e[a+2]:null,y=e[a+3]?e[a+3]:null,c=null;"C"===l.type||"Q"===l.type?c=l:!p||"C"!==p.type&&"Q"!==p.type||(c=p);let x,f,g,d,m,v=c?"C"===c.type?[c.p0,c.cp1,c.cp2,c.p]:[c.p0,c.cp1,c.p]:[],M=0,b=0,A=!1,w=!1,C=[];if("L"===u.type&&"L"===s&&c&&"L"===h.type&&y&&("L"===y.type||"Z"===y.type)?(x=[l.p0,l.p],f=[h.p0,h.p],g=l.p0,d=h.p,M=me(v,!1),b=me([...x,...f],!1),A=M<0&&b>0||M>0&&b<0,A||(m=R(v,.5),C=[g,m,d],w=!0)):"C"!==s&&"Q"!==s||"L"!==u.type||"C"!==p.type&&"Q"!==p.type||"L"!==h.type||(w=!0,x=[u.p0,u.p],f=[h.p0,h.p],g=u.p,d=h.p0,m=c.p,C=[g,c.p,d]),w){let e=At(C);if(e){let s,{centroid:u,r:p,deltaAngle:h,startAngle:y,endAngle:c}=e,x=0,f=h>0?1:0,v=Math.abs(h)>Math.PI?1:0;if(oe(J(g,u.x,u.y,.5*h),m)<.05*oe(g,d)){if(s=qe({p0:g,p:d,centroid:u,rx:p,ry:p,xAxisRotation:x,sweep:f,largeArc:v,deltaAngle:h,startAngle:y,endAngle:c}),1===s.length){let e=Ee(g,s[0].cp1,s[0].cp2,d);"Q"===e.type&&(n=!0),l=e}if(s.length>1&&(n=!1),n||(l.type="A",l.values=[p,p,x,v,f,d.x,d.y]),l.p0=g,l.p=d,l.extreme=!1,l.corner=!1,r){o=n?[{type:"M",values:[g.x,g.y]},...s]:[{type:"M",values:[g.x,g.y]},{type:"A",values:[p,p,x,v,f,d.x,d.y]}];let e=ve(o);t(markers,e,"orange","0.5%","0.5")}i.push(l),a++;continue}}}i.push(l)}return i}function Ct(e=[],{threshold:t=0}={}){let a=e.length,l="z"===e[a-1].type.toLowerCase(),n=l?a-2:a-1,r=e[n],s=r.values.slice(-2),i={x:e[0].values[0],y:e[0].values[1]},o=oe(i,{x:s[0],y:s[1]});if(o&&o<t){let a=e[n].values.length;e[n].values[a-2]=i.x,e[n].values[a-1]=i.y;let l=e[1];if("C"===l.type&&"C"===r.type){let a=Math.abs(l.values[0]-r.values[2]),s=Math.abs(l.values[1]-r.values[3]),o=Math.abs(e[1].values[0]-l.values[0]),u=Math.abs(e[1].values[1]-l.values[1]),p=Math.abs(e[1].values[0]-r.values[2]),h=Math.abs(e[1].values[1]-r.values[3]),y=u<t&&h<t&&a;a&&a<t&&(o<t&&p<t&&s)&&(e[1].values[0]=i.x,e[n].values[2]=i.x),s&&s<t&&y&&(e[1].values[1]=i.y,e[n].values[3]=i.y)}}return e}function kt(e,t=1){let a=[];for(let l=0,n=e.length;l<n;l++){let n=e[l],{type:r,values:s}=n,i={type:r,values:[]};switch(r.toLowerCase()){case"h":case"v":i.values=[s[0]*t];break;case"a":i.values=[s[0]*t,s[1]*t,s[2],s[3],s[4],s[5]*t,s[6]*t];break;default:s.length&&(i.values=s.map((e,a)=>e*t))}a.push(i)}return a}function Lt(e,t=1){for(let a=1,l=e.length;a<l;a++){let l=e[a],{type:n,values:r,p0:s,cp1:i=null,cp2:o=null,p:u=null}=l;if("C"===n){let n=Ee(s,i,o,u,t);"Q"===n.type&&(n.extreme=l.extreme,n.corner=l.corner,n.dimA=l.dimA,n.squareDist=l.squareDist,e[a]=n)}}return e}function Pt(e,{areaThreshold:t=2.5}={}){for(let a=0,l=e.length;a<l;a++){let l=e[a],n=e[a+1]||null,{type:r,values:s,p0:i,cp1:o=null,cp2:u=null,p:p=null}=l;if("C"===r&&n&&"C"===n.type){let l=Et(i,o,u,p,t),r=Et(n.p0,n.cp1,n.cp2,n.p,t);if(l.isArc&&r.isArc){let t=.01*ie(i,n.p),s=Math.abs(n.p.x-i.x),o=Math.abs(n.p.y-i.y),u=o<t&&s>t,h=s<t&&o>t,{rx:y,ry:c}=l,x=me([i,p,n.p])<0?0:1;if(h||u){y=Math.min(y,r.rx),c=Math.min(c,r.ry),e[a]=null,e[a+1].type="A",e[a+1].values=[y,c,0,0,x,n.p.x,n.p.y];continue}}}}return e=e.filter(Boolean)}function Et(e,t,a,l,n=7.5){let r,s={type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]},i=0,o=!1,u=G(e,t,!0),p=G(l,a,!0),h=180*Math.abs(u-p)/Math.PI,y=0,c=0;if(Math.abs(h%180-90)<3){r=O(e,J(t,e.x,e.y,-.5*Math.PI),l,J(a,l.x,l.y,.5*Math.PI),!1);let u=O(e,t,l,a,!1);if(u){let r=re(e,u),p=re(l,u),h=+Math.max(r,p).toFixed(8),x=+Math.min(r,p).toFixed(8);y=x,c=h;let f=me([e,t,a,l])<0?0:1,g=Math.abs(l.x-e.x)>Math.abs(l.y-e.y);100/y*Math.abs(y-c)<5&&(y=h,c=y),g&&(y=h,c=x);let d=de([{type:"M",values:[e.x,e.y]},{type:"C",values:[t.x,t.y,a.x,a.y,l.x,l.y]}]),m={type:"A",values:[y,c,0,0,f,l.x,l.y]};i=Math.PI*(y*c)/4,i-=Math.abs(me([e,l,u])),function(e,t){let a=Math.abs(e-t);return Math.abs(100-100/e*(e+a))}(d,i)<n&&(o=!0,s=m)}}return{com:s,isArc:o,area:i,rx:y,ry:c,centroid:r}}function St(e,{angles:t=[],split:a=0,getPathData:l=!0,width:n=0,height:r=0}={}){let s=e.length,i={x:e[0].values[0],y:e[0].values[1]},o=i,u=[],p=[o],h=0;if(a=a||1,n&&r)h=.025*(n+r)/a;else{h=e.map(e=>e.dimA||0).filter(Boolean).sort()[0]}for(let t=1;t<s;t++){let l=e[t],n=e[t+1]||null,{type:r,values:s}=l,u=s.length,y=u?{x:s[u-2],y:s[u-1]}:i;if("C"===r||"Q"===r){let e={x:s[0],y:s[1]},t="C"===r?{x:s[2],y:s[3]}:e,n="C"===r?[o,e,t,y]:[o,e,y],i=l.dimA;a=Math.ceil(i/h);let u=[];for(let e=1;e<a;e++)u.push(1/a*e);u.forEach(e=>{let t=R(n,e);p.push(t)})}"M"===r&&(i=y),y.area=l.cptArea||0,y.isExtreme=l.extreme||!1,y.isCorner=l.corner||!1,y.isDirChange=l.directionChange||!1,p.push(y),l.extreme||l.corner||n&&n.type,o=y}return p=function(e,{quality:t=.9,width:a=0,height:l=0,absolute:n=!1,manhattan:r=!1,exclude:s=[]}={}){"string"==typeof t&&(n=!0,t=parseFloat(t));if(e.length<4||(!n&&t)>=1)return e;let i=t;if(!n){if(i=1-t,!a&&!l){let t=ue(e,12);({width:a,height:l}=xe(t))}i=r?.05*(a+l)*(1-t):(i*((a+l)/2/25))**2}let o,u=e[0],p=[u],h=e.length,y=s.length,c=0;for(let t=1;t<h;t++)o=e[t],c=r?ie(u,o):se(u,o),!(c<i)||y&&s.includes(t)?(p.push(o),u=o):u=o;return u.x!==o.x&&u.y!==o.y&&p.push(o),p}(p,{quality:.5,width:n,height:r}),u=function(e,t=!0){let a=[{type:"M",values:[e[0].x,e[0].y]},...e.slice(1).map(e=>({type:"L",values:[e.x,e.y]}))];return t&&a.push({type:"Z",values:[]}),a}(p),l?u:p}function Tt(e){for(let t=1,a=e.length;t<a;t++){let a=e[t],{type:l,values:n,p0:r,cp1:s=null,cp2:i=null,p:o=null}=a;if("L"===l){let a=H(r,o,.333),l=H(o,r,.333);e[t].type="C",e[t].values=[a.x,a.y,l.x,l.y,o.x,o.y],e[t].cp1=a,e[t].cp2=l}}return e}function It(e=[],t=!1){let a=[];e.forEach((e,t)=>{let l=function(e=[]){let t=[];for(let a=0;a<e.length;a++){let l=e[a],n=a>0?e[a-1]:e[a],{type:r,values:s}=l,i={x:n.values[n.values.length-2],y:n.values[n.values.length-1]},o=s.length?{x:s[s.length-2],y:s[s.length-1]}:"",u=s.length?{x:s[0],y:s[1]}:"";switch(r){case"A":je(i,s).forEach(e=>{let a=e.values,l={x:a[0],y:a[1]},n={x:a[2],y:a[3]},r={x:a[4],y:a[5]};t.push(l,n,r)});break;case"C":let e={x:s[2],y:s[3]};t.push(u,e);break;case"Q":t.push(u)}"z"!==r.toLowerCase()&&t.push(o)}return t}(e.pathData),n=me(l)>=0;a.push({pts:l,bb:xe(l),cw:n,index:t,inter:0,includes:[],includedIn:[]})});let l=a.length;for(let e=0;e<l;e++){let t=a[e],n=t.bb;for(let r=0;r<l;r++){let l=a[r],s=l.bb;e===r||l.includes.includes(e)||Z({x:s.left+s.width/2,y:s.top+s.height/2},t.pts,n)&&(a[r].inter+=1,l.includedIn.push(e),t.includes.push(r))}}for(let n=0;n<l;n++){let l=a[n],{cw:r,includedIn:s,includes:i}=l;(!s.length&&r&&!t||!s.length&&!r&&t)&&(e[n].pathData=_e(e[n].pathData),a[n].cw=!a[n].cw,r=a[n].cw);for(let t=0;t<i.length;t++){let l=i[t];a[l].cw===r&&(e[l].pathData=_e(e[l].pathData),a[l].cw=!a[l].cw)}}return e}function Dt(e="",{getObject:t=!1,toAbsolute:a=!0,toRelative:l=!0,toShorthands:n=!0,quadraticToCubic:r=!0,arcToCubic:s=!1,cubicToArc:i=!1,simplifyBezier:o=!0,optimizeOrder:u=!0,autoClose:p=!0,removeZeroLength:h=!0,refineClosing:y=!0,removeColinear:c=!0,flatBezierToLinetos:x=!0,revertToQuadratics:f=!0,refineExtremes:g=!0,simplifyCorners:d=!1,removeDimensions:m=!1,removeIds:v=!1,removeClassNames:M=!1,omitNamespace:b=!1,fixDirections:A=!1,keepExtremes:w=!0,keepCorners:C=!0,extrapolateDominant:k=!0,keepInflections:L=!1,addExtremes:P=!1,addSemiExtremes:E=!1,smoothPoly:S=!1,harmonizeCpts:T=!1,toPolygon:I=!1,removeOrphanSubpaths:D=!1,simplifyRound:F=!1,scale:$=1,scaleTo:z=0,crop:q=!1,alignToOrigin:j=!1,decimals:Q=3,autoAccuracy:B=!0,minifyD:N=0,tolerance:G=1,reversePath:U=!1,cleanupSVGAtts:O=!0,removePrologue:Z=!0,stylesToAttributes:H=!0,fixHref:R=!0,removeNameSpaced:V=!0,attributesToGroup:J=!1,mergePaths:X=!1,removeHidden:Y=!0,removeUnused:_=!0,shapesToPaths:K=!1,lineToCubic:ee=!1,tMin:te=0,tMax:ae=1}={}){G=Math.max(.1,G),$=Math.max(.001,$);let le=function(e){let t="string";if(Array.isArray(e))return e[0]?.type&&e[0]?.values?"pathData":"array";if("string"==typeof e){let a=(e=e.trim()).includes("<svg")&&e.includes("</svg"),l=e.startsWith("M")||e.startsWith("m"),n=!isNaN(e.substring(0,1))&&!isNaN(e.substring(e.length-1,e.length));if(a)t="svgMarkup";else if(l)t="pathDataString";else if(n)t="polyString";else{let a=/^(file:|https?:\/\/|\/|\.\/|\.\.\/)/.test(e),l=e.startsWith("data:image");t=a||l?"url":"string"}return t}return t=typeof e,(e.constructor.name||t).toLowerCase()}(e),ne="",re=0,se=0,ie=0,oe={},ue="",he="svgMarkup"===le?1:0,ye=[];re=e.length;let fe={x:0,y:0,width:0,height:0},ge={x:0,y:0,width:0,height:0},de=[],me=[];if(he){if(ne=vt(e,{removeIds:v,removeClassNames:M,removeDimensions:m,cleanupSVGAtts:O,returnDom:!0,removeHidden:Y,removeUnused:_,removeNameSpaced:V,stylesToAttributes:H,removePrologue:Z,fixHref:R,mergePaths:X,shapesToPaths:K}),K){ne.querySelectorAll("polygon, polyline, line, rect, circle, ellipse").forEach(e=>{let t=He(e);e.replaceWith(t)})}ne.querySelectorAll("path").forEach(e=>{ye.push({d:e.getAttribute("d"),el:e})}),fe=function(e=null,t=-1){const a=e=>e&&isNaN(e)?e.match(/[^\d|.]+/g)[0]:"";if(!e)return!1;let l=e.hasAttribute("width"),n=e.hasAttribute("height"),r=e.hasAttribute("viewBox"),s=l?e.getAttribute("width"):0,i=n?e.getAttribute("height"):0,o=!!l&&a(s),u=!!n&&a(s),p=s?s.includes("%")?0:parseFloat(s):300,h=i?i.includes("%")?0:parseFloat(i):150,y=r?e.getAttribute("viewBox").split(/,| /).filter(Boolean).map(Number):[0,0,p,h];return t>-1&&([p,h]=[p,h].map(e=>+e.toFixed(t)),y=y.map(e=>+e.toFixed(t))),{x:y[0],y:y[1],width:y[2],height:y[3],w:p,h:h,hasViewBox:r,hasWidth:l,hasHeight:n,widthUnit:o,heightUnit:u}}(ne,Q)}else{if("pathDataString"===le)ue=e;else if("polyString"===le)ue="M"+e;else if("pathData"===le){ue=e,re=ue.map(e=>`${e.type} ${e.values.join(" ")}`).join(" ").length}ye.push({d:ue,el:null})}let Me={toRelative:l,toShorthands:n,decimals:Q},Ae=[];for(let e=0,t=ye.length;t&&e<t;e++){let t=ye[e],{d:l,el:n}=t,m=Qe(l,{quadraticToCubic:r,toAbsolute:a,arcToCubic:s}),v=S||I?xe(W(m)):null;if(1!==$||z){if(z)if(fe.width&&!q)$=z/fe.width;else{let e=m.map(e=>({type:e.type,values:e.values}));e=Se(e,{arcToCubic:!0}),e=ce(e);let t=xe(W(e));de.push(t.x,t.x+t.width),me.push(t.y,t.y+t.height);let a=z/t.width;$=a}m=kt(m,$)}let M=m.length;D&&(m=We(m));let b=pe(m),O=b.length,Z=[];for(let e=0;e<O;e++){let t=b[e];if(I){o=!1,S=!1,T=!1,t=Re(t);let e=Pe(t),{bb:a,pathData:l}=e;t=l,t=St(t,{angles:[],split:1,width:v.width,height:v.height,getPathData:!0})}if(S){let e=Array.from(new Set(t.map(e=>e.type))).join(""),a=!/[acqts]/gi.test(e),l=/[z]/gi.test(e);if(a){t=Ve(t),t=yt(W(t),{denoise:.8,tolerance:G,width:v.width,height:v.height,manhattan:!1,absolute:!1,keepCorners:C,keepExtremes:w,keepInflections:L,closed:l})}}T&&(t=Ke(t)),(c||h)&&(t=Ve(t)),u&&(t=Je(t)),c&&(t=Re(t,{tolerance:G,flatBezierToLinetos:!1})),(P||E)&&(t=ce(t,{tMin:te,tMax:ae,addExtremes:P,addSemiExtremes:E,angles:[30]})),U&&(t=_e(t));let a=Pe(t,{detectSemiExtremes:E}),{pathData:l,bb:n,dimA:r}=a;if(de.push(n.x,n.x+n.width),me.push(n.y,n.y+n.height),y&&(l=Ct(l,{threshold:.001*r})),l=o?be(l,{simplifyBezier:o,keepInflections:L,keepExtremes:w,keepCorners:C,extrapolateDominant:k,revertToQuadratics:f,tolerance:G}):l,g){l=ct(l,{threshold:.05*(n.width+n.height),tolerance:G})}if(i&&(l=Pt(l,{areaThreshold:2.5})),c&&x&&(l=Re(l,{tolerance:G,flatBezierToLinetos:x})),d){l=bt(l,{threshold:.1*(n.width+n.height),tolerance:G})}F&&(l=wt(l)),f&&(l=Lt(l,G)),ee&&(l=Tt(l)),u&&(l=Xe(l,{autoClose:p})),Z.push({pathData:l,bb:n})}let H=Math.min(...de),R=Math.min(...me);ge={x:H,y:R,width:Math.max(...de)-H,height:Math.max(...me)-R};let V=ge.height>ge.width;if(u&&(Z=V?Z.sort((e,t)=>e.bb.y-t.bb.y||e.bb.x-t.bb.x):Z.sort((e,t)=>e.bb.x-t.bb.x||e.bb.y-t.bb.y)),A&&(Z=It(Z)),m=[],Z.forEach(e=>{m.push(...e.pathData)}),B&&(Q=Ce(m),Me.decimals=Q),X=!1,n&&X)Ae.push(...m);else{m=Se(m,Me),m=Ve(m),j&&(console.log(ge),m[0].values[0]=(m[0].values[0]-ge.x).toFixed(Q),m[0].values[1]=(m[0].values[1]-ge.y).toFixed(Q),ge.x=0,ge.y=0);let e=m.length,a=ve(m,N);se=a.length,ie=+(100/re*se).toFixed(2),t.d=a,t.report={original:M,new:e,saved:M-e,compression:ie,decimals:Q},n&&n.setAttribute("d",a)}}if(he){if(Ae.length){let e=Se(Ae,Me);e=Ve(e);let t=ve(e,N);ye[0].el.setAttribute("d",t);for(let e=1;e<ye.length;e++){let t=ye[e].el;t&&t.remove()}!function(e){e.querySelectorAll("g, defs").forEach(e=>{e.children.length||e.remove()})}(ne)}if($){let{x:e,y:t,width:a,height:l,w:n,h:r,hasViewBox:s,hasWidth:i,hasHeight:o,widthUnit:u,heightUnit:p}=fe;q&&(e=ge.x,t=ge.y,a=ge.width,l=ge.height,n=a,r=l),s&&ne.setAttribute("viewBox",[e,t,a,l].map(e=>+(e*$).toFixed(Q)).join(" ")),i&&ne.setAttribute("width",+(n*$).toFixed(Q)+u),o&&ne.setAttribute("height",+(r*$).toFixed(Q)+p)}if(A){ne.querySelectorAll("path[fill-rule], path[clip-rule]").forEach(e=>{e.removeAttribute("fill-rule"),e.removeAttribute("clip-rule")})}ne=Mt(ne,b),se=ne.length,ie=+(100/re*se).toFixed(2),re=+(re/1024).toFixed(3),se=+(se/1024).toFixed(3),oe={svgSize:re,svgSizeOpt:se,compression:ie,decimals:Q}}else({d:ue,report:oe}=ye[0]);return t?{svg:ne,d:ue,report:oe,inputType:le,mode:he}:ue||ne}"undefined"!=typeof window&&(window.svgPathSimplify=Dt);export{b as PI,a as abs,l as acos,n as asin,r as atan,s as atan2,i as ceil,o as cos,u as exp,p as floor,y as hypot,h as log,c as max,x as min,f as pow,g as random,d as round,m as sin,v as sqrt,Dt as svgPathSimplify,M as tan};
|
|
@@ -2037,8 +2037,6 @@
|
|
|
2037
2037
|
return commands;
|
|
2038
2038
|
}
|
|
2039
2039
|
|
|
2040
|
-
if (debug) renderPoint(markers, ptM, 'purple');
|
|
2041
|
-
|
|
2042
2040
|
result.cp1 = cp1_2;
|
|
2043
2041
|
result.cp2 = cp2_2;
|
|
2044
2042
|
|
|
@@ -2101,8 +2099,8 @@
|
|
|
2101
2099
|
result.error = areaDiff * 5 * tolerance;
|
|
2102
2100
|
|
|
2103
2101
|
if (debug) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2102
|
+
pathDataToD(pathDataN);
|
|
2103
|
+
|
|
2106
2104
|
}
|
|
2107
2105
|
|
|
2108
2106
|
// success!!!
|