@emasoft/svg-matrix 1.1.0 → 1.2.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/bin/svg-matrix.js +7 -6
- package/bin/svgm.js +109 -40
- package/dist/svg-matrix.min.js +7 -7
- package/dist/svg-toolbox.min.js +148 -228
- package/dist/svgm.min.js +152 -232
- package/dist/version.json +5 -5
- package/package.json +1 -1
- package/scripts/postinstall.js +72 -41
- package/scripts/test-postinstall.js +18 -16
- package/scripts/version-sync.js +78 -60
- package/src/animation-optimization.js +190 -98
- package/src/animation-references.js +11 -3
- package/src/arc-length.js +23 -20
- package/src/bezier-analysis.js +9 -13
- package/src/bezier-intersections.js +18 -4
- package/src/browser-verify.js +35 -8
- package/src/clip-path-resolver.js +285 -114
- package/src/convert-path-data.js +20 -8
- package/src/css-specificity.js +33 -9
- package/src/douglas-peucker.js +272 -141
- package/src/geometry-to-path.js +79 -22
- package/src/gjk-collision.js +287 -126
- package/src/index.js +56 -21
- package/src/inkscape-support.js +122 -101
- package/src/logger.js +43 -27
- package/src/marker-resolver.js +201 -121
- package/src/mask-resolver.js +231 -98
- package/src/matrix.js +9 -5
- package/src/mesh-gradient.js +22 -14
- package/src/off-canvas-detection.js +53 -17
- package/src/path-optimization.js +356 -171
- package/src/path-simplification.js +671 -256
- package/src/pattern-resolver.js +1 -3
- package/src/polygon-clip.js +396 -78
- package/src/svg-boolean-ops.js +90 -23
- package/src/svg-collections.js +1546 -667
- package/src/svg-flatten.js +152 -38
- package/src/svg-matrix-lib.js +2 -2
- package/src/svg-parser.js +5 -1
- package/src/svg-rendering-context.js +3 -1
- package/src/svg-toolbox-lib.js +2 -2
- package/src/svg-toolbox.js +99 -457
- package/src/svg-validation-data.js +513 -345
- package/src/svg2-polyfills.js +156 -93
- package/src/svgm-lib.js +8 -4
- package/src/transform-optimization.js +168 -51
- package/src/transforms2d.js +73 -40
- package/src/transforms3d.js +34 -27
- package/src/use-symbol-resolver.js +175 -76
- package/src/vector.js +80 -44
- package/src/vendor/inkscape-hatch-polyfill.js +143 -108
- package/src/vendor/inkscape-hatch-polyfill.min.js +291 -1
- package/src/vendor/inkscape-mesh-polyfill.js +953 -766
- package/src/vendor/inkscape-mesh-polyfill.min.js +896 -1
- package/src/verification.js +3 -4
package/dist/svg-toolbox.min.js
CHANGED
|
@@ -1,206 +1,126 @@
|
|
|
1
|
-
var
|
|
2
|
-
* decimal.js v10.6.0
|
|
3
|
-
* An arbitrary-precision Decimal type for JavaScript.
|
|
4
|
-
* https://github.com/MikeMcl/decimal.js
|
|
5
|
-
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
6
|
-
* MIT Licence
|
|
7
|
-
*/var o5=9000000000000000,W4=1e9,v2="0123456789abcdef",z5="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",q5="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",B2={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o5,maxE:o5,crypto:!1},L9,N4,f3=!0,l2="[DecimalError] ",_4=l2+"Invalid argument: ",O9=l2+"Precision limit exceeded",k9=l2+"crypto unavailable",Y9="[object Decimal]",q3=Math.floor,_3=Math.pow,Ea=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ba=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Pa=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,M9=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,D4=1e7,T3=7,Ta=9007199254740991,Aa=z5.length-1,X2=q5.length-1,r3={toStringTag:Y9};r3.absoluteValue=r3.abs=function(){var t=new this.constructor(this);if(t.s<0)t.s=1;return h3(t)};r3.ceil=function(){return h3(new this.constructor(this),this.e+1,2)};r3.clampedTo=r3.clamp=function(t,a){var r,e=this,o=e.constructor;if(t=new o(t),a=new o(a),!t.s||!a.s)return new o(NaN);if(t.gt(a))throw Error(_4+a);return r=e.cmp(t),r<0?t:e.cmp(a)>0?a:new o(e)};r3.comparedTo=r3.cmp=function(t){var a,r,e,o,n=this,i=n.d,l=(t=new n.constructor(t)).d,d=n.s,p=t.s;if(!i||!l)return!d||!p?NaN:d!==p?d:i===l?0:!i^d<0?1:-1;if(!i[0]||!l[0])return i[0]?d:l[0]?-p:0;if(d!==p)return d;if(n.e!==t.e)return n.e>t.e^d<0?1:-1;e=i.length,o=l.length;for(a=0,r=e<o?e:o;a<r;++a)if(i[a]!==l[a])return i[a]>l[a]^d<0?1:-1;return e===o?0:e>o^d<0?1:-1};r3.cosine=r3.cos=function(){var t,a,r=this,e=r.constructor;if(!r.d)return new e(NaN);if(!r.d[0])return new e(1);return t=e.precision,a=e.rounding,e.precision=t+Math.max(r.e,r.sd())+T3,e.rounding=1,r=Ca(e,j9(e,r)),e.precision=t,e.rounding=a,h3(N4==2||N4==3?r.neg():r,t,a,!0)};r3.cubeRoot=r3.cbrt=function(){var t,a,r,e,o,n,i,l,d,p,g=this,c=g.constructor;if(!g.isFinite()||g.isZero())return new c(g);if(f3=!1,n=g.s*_3(g.s*g,0.3333333333333333),!n||Math.abs(n)==1/0){if(r=W3(g.d),t=g.e,n=(t-r.length+1)%3)r+=n==1||n==-2?"0":"00";if(n=_3(r,0.3333333333333333),t=q3((t+1)/3)-(t%3==(t<0?-1:2)),n==1/0)r="5e"+t;else r=n.toExponential(),r=r.slice(0,r.indexOf("e")+1)+t;e=new c(r),e.s=g.s}else e=new c(n.toString());i=(t=c.precision)+3;for(;;)if(l=e,d=l.times(l).times(l),p=d.plus(g),e=O3(p.plus(g).times(l),p.plus(d),i+2,1),W3(l.d).slice(0,i)===(r=W3(e.d)).slice(0,i))if(r=r.slice(i-3,i+1),r=="9999"||!o&&r=="4999"){if(!o){if(h3(l,t+1,0),l.times(l).times(l).eq(g)){e=l;break}}i+=4,o=1}else{if(!+r||!+r.slice(1)&&r.charAt(0)=="5")h3(e,t+1,1),a=!e.times(e).times(e).eq(g);break}return f3=!0,h3(e,t,c.rounding,a)};r3.decimalPlaces=r3.dp=function(){var t,a=this.d,r=NaN;if(a){if(t=a.length-1,r=(t-q3(this.e/T3))*T3,t=a[t],t)for(;t%10==0;t/=10)r--;if(r<0)r=0}return r};r3.dividedBy=r3.div=function(t){return O3(this,new this.constructor(t))};r3.dividedToIntegerBy=r3.divToInt=function(t){var a=this,r=a.constructor;return h3(O3(a,new r(t),0,1,1),r.precision,r.rounding)};r3.equals=r3.eq=function(t){return this.cmp(t)===0};r3.floor=function(){return h3(new this.constructor(this),this.e+1,3)};r3.greaterThan=r3.gt=function(t){return this.cmp(t)>0};r3.greaterThanOrEqualTo=r3.gte=function(t){var a=this.cmp(t);return a==1||a===0};r3.hyperbolicCosine=r3.cosh=function(){var t,a,r,e,o,n=this,i=n.constructor,l=new i(1);if(!n.isFinite())return new i(n.s?1/0:NaN);if(n.isZero())return l;if(r=i.precision,e=i.rounding,i.precision=r+Math.max(n.e,n.sd())+4,i.rounding=1,o=n.d.length,o<32)t=Math.ceil(o/3),a=(1/d2(4,t)).toString();else t=16,a="2.3283064365386962890625e-10";n=l5(i,1,n.times(a),new i(1),!0);var d,p=t,g=new i(8);for(;p--;)d=n.times(n),n=l.minus(d.times(g.minus(d.times(g))));return h3(n,i.precision=r,i.rounding=e,!0)};r3.hyperbolicSine=r3.sinh=function(){var t,a,r,e,o=this,n=o.constructor;if(!o.isFinite()||o.isZero())return new n(o);if(a=n.precision,r=n.rounding,n.precision=a+Math.max(o.e,o.sd())+4,n.rounding=1,e=o.d.length,e<3)o=l5(n,2,o,o,!0);else{t=1.4*Math.sqrt(e),t=t>16?16:t|0,o=o.times(1/d2(5,t)),o=l5(n,2,o,o,!0);var i,l=new n(5),d=new n(16),p=new n(20);for(;t--;)i=o.times(o),o=o.times(l.plus(i.times(d.times(i).plus(p))))}return n.precision=a,n.rounding=r,h3(o,a,r,!0)};r3.hyperbolicTangent=r3.tanh=function(){var t,a,r=this,e=r.constructor;if(!r.isFinite())return new e(r.s);if(r.isZero())return new e(r);return t=e.precision,a=e.rounding,e.precision=t+7,e.rounding=1,O3(r.sinh(),r.cosh(),e.precision=t,e.rounding=a)};r3.inverseCosine=r3.acos=function(){var t=this,a=t.constructor,r=t.abs().cmp(1),e=a.precision,o=a.rounding;if(r!==-1)return r===0?t.isNeg()?T4(a,e,o):new a(0):new a(NaN);if(t.isZero())return T4(a,e+4,o).times(0.5);return a.precision=e+6,a.rounding=1,t=new a(1).minus(t).div(t.plus(1)).sqrt().atan(),a.precision=e,a.rounding=o,t.times(2)};r3.inverseHyperbolicCosine=r3.acosh=function(){var t,a,r=this,e=r.constructor;if(r.lte(1))return new e(r.eq(1)?0:NaN);if(!r.isFinite())return new e(r);return t=e.precision,a=e.rounding,e.precision=t+Math.max(Math.abs(r.e),r.sd())+4,e.rounding=1,f3=!1,r=r.times(r).minus(1).sqrt().plus(r),f3=!0,e.precision=t,e.rounding=a,r.ln()};r3.inverseHyperbolicSine=r3.asinh=function(){var t,a,r=this,e=r.constructor;if(!r.isFinite()||r.isZero())return new e(r);return t=e.precision,a=e.rounding,e.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,e.rounding=1,f3=!1,r=r.times(r).plus(1).sqrt().plus(r),f3=!0,e.precision=t,e.rounding=a,r.ln()};r3.inverseHyperbolicTangent=r3.atanh=function(){var t,a,r,e,o=this,n=o.constructor;if(!o.isFinite())return new n(NaN);if(o.e>=0)return new n(o.abs().eq(1)?o.s/0:o.isZero()?o:NaN);if(t=n.precision,a=n.rounding,e=o.sd(),Math.max(e,t)<2*-o.e-1)return h3(new n(o),t,a,!0);return n.precision=r=e-o.e,o=O3(o.plus(1),new n(1).minus(o),r+t,1),n.precision=t+4,n.rounding=1,o=o.ln(),n.precision=t,n.rounding=a,o.times(0.5)};r3.inverseSine=r3.asin=function(){var t,a,r,e,o=this,n=o.constructor;if(o.isZero())return new n(o);if(a=o.abs().cmp(1),r=n.precision,e=n.rounding,a!==-1){if(a===0)return t=T4(n,r+4,e).times(0.5),t.s=o.s,t;return new n(NaN)}return n.precision=r+6,n.rounding=1,o=o.div(new n(1).minus(o.times(o)).sqrt().plus(1)).atan(),n.precision=r,n.rounding=e,o.times(2)};r3.inverseTangent=r3.atan=function(){var t,a,r,e,o,n,i,l,d,p=this,g=p.constructor,c=g.precision,m=g.rounding;if(!p.isFinite()){if(!p.s)return new g(NaN);if(c+4<=X2)return i=T4(g,c+4,m).times(0.5),i.s=p.s,i}else if(p.isZero())return new g(p);else if(p.abs().eq(1)&&c+4<=X2)return i=T4(g,c+4,m).times(0.25),i.s=p.s,i;g.precision=l=c+10,g.rounding=1,r=Math.min(28,l/T3+2|0);for(t=r;t;--t)p=p.div(p.times(p).plus(1).sqrt().plus(1));f3=!1,a=Math.ceil(l/T3),e=1,d=p.times(p),i=new g(p),o=p;for(;t!==-1;)if(o=o.times(d),n=i.minus(o.div(e+=2)),o=o.times(d),i=n.plus(o.div(e+=2)),i.d[a]!==void 0)for(t=a;i.d[t]===n.d[t]&&t--;);if(r)i=i.times(2<<r-1);return f3=!0,h3(i,g.precision=c,g.rounding=m,!0)};r3.isFinite=function(){return!!this.d};r3.isInteger=r3.isInt=function(){return!!this.d&&q3(this.e/T3)>this.d.length-2};r3.isNaN=function(){return!this.s};r3.isNegative=r3.isNeg=function(){return this.s<0};r3.isPositive=r3.isPos=function(){return this.s>0};r3.isZero=function(){return!!this.d&&this.d[0]===0};r3.lessThan=r3.lt=function(t){return this.cmp(t)<0};r3.lessThanOrEqualTo=r3.lte=function(t){return this.cmp(t)<1};r3.logarithm=r3.log=function(t){var a,r,e,o,n,i,l,d,p=this,g=p.constructor,c=g.precision,m=g.rounding,y=5;if(t==null)t=new g(10),a=!0;else{if(t=new g(t),r=t.d,t.s<0||!r||!r[0]||t.eq(1))return new g(NaN);a=t.eq(10)}if(r=p.d,p.s<0||!r||!r[0]||p.eq(1))return new g(r&&!r[0]?-1/0:p.s!=1?NaN:r?0:1/0);if(a)if(r.length>1)n=!0;else{for(o=r[0];o%10===0;)o/=10;n=o!==1}if(f3=!1,l=c+y,i=U4(p,l),e=a?Q5(g,l+10):U4(t,l),d=O3(i,e,l,1),C5(d.d,o=c,m))do if(l+=10,i=U4(p,l),e=a?Q5(g,l+10):U4(t,l),d=O3(i,e,l,1),!n){if(+W3(d.d).slice(o+1,o+15)+1==100000000000000)d=h3(d,c+1,0);break}while(C5(d.d,o+=10,m));return f3=!0,h3(d,c,m)};r3.minus=r3.sub=function(t){var a,r,e,o,n,i,l,d,p,g,c,m,y=this,h=y.constructor;if(t=new h(t),!y.d||!t.d){if(!y.s||!t.s)t=new h(NaN);else if(y.d)t.s=-t.s;else t=new h(t.d||y.s!==t.s?y:NaN);return t}if(y.s!=t.s)return t.s=-t.s,y.plus(t);if(p=y.d,m=t.d,l=h.precision,d=h.rounding,!p[0]||!m[0]){if(m[0])t.s=-t.s;else if(p[0])t=new h(y);else return new h(d===3?-0:0);return f3?h3(t,l,d):t}if(r=q3(t.e/T3),g=q3(y.e/T3),p=p.slice(),n=g-r,n){if(c=n<0,c)a=p,n=-n,i=m.length;else a=m,r=g,i=p.length;if(e=Math.max(Math.ceil(l/T3),i)+2,n>e)n=e,a.length=1;a.reverse();for(e=n;e--;)a.push(0);a.reverse()}else{if(e=p.length,i=m.length,c=e<i,c)i=e;for(e=0;e<i;e++)if(p[e]!=m[e]){c=p[e]<m[e];break}n=0}if(c)a=p,p=m,m=a,t.s=-t.s;i=p.length;for(e=m.length-i;e>0;--e)p[i++]=0;for(e=m.length;e>n;){if(p[--e]<m[e]){for(o=e;o&&p[--o]===0;)p[o]=D4-1;--p[o],p[e]+=D4}p[e]-=m[e]}for(;p[--i]===0;)p.pop();for(;p[0]===0;p.shift())--r;if(!p[0])return new h(d===3?-0:0);return t.d=p,t.e=p2(p,r),f3?h3(t,l,d):t};r3.modulo=r3.mod=function(t){var a,r=this,e=r.constructor;if(t=new e(t),!r.d||!t.s||t.d&&!t.d[0])return new e(NaN);if(!t.d||r.d&&!r.d[0])return h3(new e(r),e.precision,e.rounding);if(f3=!1,e.modulo==9)a=O3(r,t.abs(),0,3,1),a.s*=t.s;else a=O3(r,t,0,e.modulo,1);return a=a.times(t),f3=!0,r.minus(a)};r3.naturalExponential=r3.exp=function(){return L2(this)};r3.naturalLogarithm=r3.ln=function(){return U4(this)};r3.negated=r3.neg=function(){var t=new this.constructor(this);return t.s=-t.s,h3(t)};r3.plus=r3.add=function(t){var a,r,e,o,n,i,l,d,p,g,c=this,m=c.constructor;if(t=new m(t),!c.d||!t.d){if(!c.s||!t.s)t=new m(NaN);else if(!c.d)t=new m(t.d||c.s===t.s?c:NaN);return t}if(c.s!=t.s)return t.s=-t.s,c.minus(t);if(p=c.d,g=t.d,l=m.precision,d=m.rounding,!p[0]||!g[0]){if(!g[0])t=new m(c);return f3?h3(t,l,d):t}if(n=q3(c.e/T3),e=q3(t.e/T3),p=p.slice(),o=n-e,o){if(o<0)r=p,o=-o,i=g.length;else r=g,e=n,i=p.length;if(n=Math.ceil(l/T3),i=n>i?n+1:i+1,o>i)o=i,r.length=1;r.reverse();for(;o--;)r.push(0);r.reverse()}if(i=p.length,o=g.length,i-o<0)o=i,r=g,g=p,p=r;for(a=0;o;)a=(p[--o]=p[o]+g[o]+a)/D4|0,p[o]%=D4;if(a)p.unshift(a),++e;for(i=p.length;p[--i]==0;)p.pop();return t.d=p,t.e=p2(p,e),f3?h3(t,l,d):t};r3.precision=r3.sd=function(t){var a,r=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(_4+t);if(r.d){if(a=V9(r.d),t&&r.e+1>a)a=r.e+1}else a=NaN;return a};r3.round=function(){var t=this,a=t.constructor;return h3(new a(t),t.e+1,a.rounding)};r3.sine=r3.sin=function(){var t,a,r=this,e=r.constructor;if(!r.isFinite())return new e(NaN);if(r.isZero())return new e(r);return t=e.precision,a=e.rounding,e.precision=t+Math.max(r.e,r.sd())+T3,e.rounding=1,r=ua(e,j9(e,r)),e.precision=t,e.rounding=a,h3(N4>2?r.neg():r,t,a,!0)};r3.squareRoot=r3.sqrt=function(){var t,a,r,e,o,n,i=this,l=i.d,d=i.e,p=i.s,g=i.constructor;if(p!==1||!l||!l[0])return new g(!p||p<0&&(!l||l[0])?NaN:l?i:1/0);if(f3=!1,p=Math.sqrt(+i),p==0||p==1/0){if(a=W3(l),(a.length+d)%2==0)a+="0";if(p=Math.sqrt(a),d=q3((d+1)/2)-(d<0||d%2),p==1/0)a="5e"+d;else a=p.toExponential(),a=a.slice(0,a.indexOf("e")+1)+d;e=new g(a)}else e=new g(p.toString());r=(d=g.precision)+3;for(;;)if(n=e,e=n.plus(O3(i,n,r+2,1)).times(0.5),W3(n.d).slice(0,r)===(a=W3(e.d)).slice(0,r))if(a=a.slice(r-3,r+1),a=="9999"||!o&&a=="4999"){if(!o){if(h3(n,d+1,0),n.times(n).eq(i)){e=n;break}}r+=4,o=1}else{if(!+a||!+a.slice(1)&&a.charAt(0)=="5")h3(e,d+1,1),t=!e.times(e).eq(i);break}return f3=!0,h3(e,d,g.rounding,t)};r3.tangent=r3.tan=function(){var t,a,r=this,e=r.constructor;if(!r.isFinite())return new e(NaN);if(r.isZero())return new e(r);return t=e.precision,a=e.rounding,e.precision=t+10,e.rounding=1,r=r.sin(),r.s=1,r=O3(r,new e(1).minus(r.times(r)).sqrt(),t+10,0),e.precision=t,e.rounding=a,h3(N4==2||N4==4?r.neg():r,t,a,!0)};r3.times=r3.mul=function(t){var a,r,e,o,n,i,l,d,p,g=this,c=g.constructor,m=g.d,y=(t=new c(t)).d;if(t.s*=g.s,!m||!m[0]||!y||!y[0])return new c(!t.s||m&&!m[0]&&!y||y&&!y[0]&&!m?NaN:!m||!y?t.s/0:t.s*0);if(r=q3(g.e/T3)+q3(t.e/T3),d=m.length,p=y.length,d<p)n=m,m=y,y=n,i=d,d=p,p=i;n=[],i=d+p;for(e=i;e--;)n.push(0);for(e=p;--e>=0;){a=0;for(o=d+e;o>e;)l=n[o]+y[e]*m[o-e-1]+a,n[o--]=l%D4|0,a=l/D4|0;n[o]=(n[o]+a)%D4|0}for(;!n[--i];)n.pop();if(a)++r;else n.shift();return t.d=n,t.e=p2(n,r),f3?h3(t,c.precision,c.rounding):t};r3.toBinary=function(t,a){return Q2(this,2,t,a)};r3.toDecimalPlaces=r3.toDP=function(t,a){var r=this,e=r.constructor;if(r=new e(r),t===void 0)return r;if($3(t,0,W4),a===void 0)a=e.rounding;else $3(a,0,8);return h3(r,t+r.e+1,a)};r3.toExponential=function(t,a){var r,e=this,o=e.constructor;if(t===void 0)r=C4(e,!0);else{if($3(t,0,W4),a===void 0)a=o.rounding;else $3(a,0,8);e=h3(new o(e),t+1,a),r=C4(e,!0,t+1)}return e.isNeg()&&!e.isZero()?"-"+r:r};r3.toFixed=function(t,a){var r,e,o=this,n=o.constructor;if(t===void 0)r=C4(o);else{if($3(t,0,W4),a===void 0)a=n.rounding;else $3(a,0,8);e=h3(new n(o),t+o.e+1,a),r=C4(e,!1,t+e.e+1)}return o.isNeg()&&!o.isZero()?"-"+r:r};r3.toFraction=function(t){var a,r,e,o,n,i,l,d,p,g,c,m,y=this,h=y.d,s=y.constructor;if(!h)return new s(y);if(p=r=new s(1),e=d=new s(0),a=new s(e),n=a.e=V9(h)-y.e-1,i=n%T3,a.d[0]=_3(10,i<0?T3+i:i),t==null)t=n>0?a:p;else{if(l=new s(t),!l.isInt()||l.lt(p))throw Error(_4+l);t=l.gt(a)?n>0?a:p:l}f3=!1,l=new s(W3(h)),g=s.precision,s.precision=n=h.length*T3*2;for(;;){if(c=O3(l,a,0,1,1),o=r.plus(c.times(e)),o.cmp(t)==1)break;r=e,e=o,o=p,p=d.plus(c.times(o)),d=o,o=a,a=l.minus(c.times(o)),l=o}return o=O3(t.minus(r),e,0,1,1),d=d.plus(o.times(p)),r=r.plus(o.times(e)),d.s=p.s=y.s,m=O3(p,e,n,1).minus(y).abs().cmp(O3(d,r,n,1).minus(y).abs())<1?[p,e]:[d,r],s.precision=g,f3=!0,m};r3.toHexadecimal=r3.toHex=function(t,a){return Q2(this,16,t,a)};r3.toNearest=function(t,a){var r=this,e=r.constructor;if(r=new e(r),t==null){if(!r.d)return r;t=new e(1),a=e.rounding}else{if(t=new e(t),a===void 0)a=e.rounding;else $3(a,0,8);if(!r.d)return t.s?r:t;if(!t.d){if(t.s)t.s=r.s;return t}}if(t.d[0])f3=!1,r=O3(r,t,0,a,1).times(t),f3=!0,h3(r);else t.s=r.s,r=t;return r};r3.toNumber=function(){return+this};r3.toOctal=function(t,a){return Q2(this,8,t,a)};r3.toPower=r3.pow=function(t){var a,r,e,o,n,i,l=this,d=l.constructor,p=+(t=new d(t));if(!l.d||!t.d||!l.d[0]||!t.d[0])return new d(_3(+l,p));if(l=new d(l),l.eq(1))return l;if(e=d.precision,n=d.rounding,t.eq(1))return h3(l,e,n);if(a=q3(t.e/T3),a>=t.d.length-1&&(r=p<0?-p:p)<=Ta)return o=U9(d,l,r,e),t.s<0?new d(1).div(o):h3(o,e,n);if(i=l.s,i<0){if(a<t.d.length-1)return new d(NaN);if((t.d[a]&1)==0)i=1;if(l.e==0&&l.d[0]==1&&l.d.length==1)return l.s=i,l}if(r=_3(+l,p),a=r==0||!isFinite(r)?q3(p*(Math.log("0."+W3(l.d))/Math.LN10+l.e+1)):new d(r+"").e,a>d.maxE+1||a<d.minE-1)return new d(a>0?i/0:0);if(f3=!1,d.rounding=l.s=1,r=Math.min(12,(a+"").length),o=L2(t.times(U4(l,e+r)),e),o.d){if(o=h3(o,e+5,1),C5(o.d,e,n)){if(a=e+10,o=h3(L2(t.times(U4(l,a+r)),a),a+5,1),+W3(o.d).slice(e+1,e+15)+1==100000000000000)o=h3(o,e+1,0)}}return o.s=i,f3=!0,d.rounding=n,h3(o,e,n)};r3.toPrecision=function(t,a){var r,e=this,o=e.constructor;if(t===void 0)r=C4(e,e.e<=o.toExpNeg||e.e>=o.toExpPos);else{if($3(t,1,W4),a===void 0)a=o.rounding;else $3(a,0,8);e=h3(new o(e),t,a),r=C4(e,t<=e.e||e.e<=o.toExpNeg,t)}return e.isNeg()&&!e.isZero()?"-"+r:r};r3.toSignificantDigits=r3.toSD=function(t,a){var r=this,e=r.constructor;if(t===void 0)t=e.precision,a=e.rounding;else if($3(t,1,W4),a===void 0)a=e.rounding;else $3(a,0,8);return h3(new e(r),t,a)};r3.toString=function(){var t=this,a=t.constructor,r=C4(t,t.e<=a.toExpNeg||t.e>=a.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r};r3.truncated=r3.trunc=function(){return h3(new this.constructor(this),this.e+1,1)};r3.valueOf=r3.toJSON=function(){var t=this,a=t.constructor,r=C4(t,t.e<=a.toExpNeg||t.e>=a.toExpPos);return t.isNeg()?"-"+r:r};function W3(t){var a,r,e,o=t.length-1,n="",i=t[0];if(o>0){n+=i;for(a=1;a<o;a++){if(e=t[a]+"",r=T3-e.length,r)n+=M4(r);n+=e}if(i=t[a],e=i+"",r=T3-e.length,r)n+=M4(r)}else if(i===0)return"0";for(;i%10===0;)i/=10;return n+i}function $3(t,a,r){if(t!==~~t||t<a||t>r)throw Error(_4+t)}function C5(t,a,r,e){var o,n,i,l;for(n=t[0];n>=10;n/=10)--a;if(--a<0)a+=T3,o=0;else o=Math.ceil((a+1)/T3),a%=T3;if(n=_3(10,T3-a),l=t[o]%n|0,e==null)if(a<3){if(a==0)l=l/100|0;else if(a==1)l=l/10|0;i=r<4&&l==99999||r>3&&l==49999||l==50000||l==0}else i=(r<4&&l+1==n||r>3&&l+1==n/2)&&(t[o+1]/n/100|0)==_3(10,a-2)-1||(l==n/2||l==0)&&(t[o+1]/n/100|0)==0;else if(a<4){if(a==0)l=l/1000|0;else if(a==1)l=l/100|0;else if(a==2)l=l/10|0;i=(e||r<4)&&l==9999||!e&&r>3&&l==4999}else i=((e||r<4)&&l+1==n||!e&&r>3&&l+1==n/2)&&(t[o+1]/n/1000|0)==_3(10,a-3)-1;return i}function Y5(t,a,r){var e,o=[0],n,i=0,l=t.length;for(;i<l;){for(n=o.length;n--;)o[n]*=a;o[0]+=v2.indexOf(t.charAt(i++));for(e=0;e<o.length;e++)if(o[e]>r-1){if(o[e+1]===void 0)o[e+1]=0;o[e+1]+=o[e]/r|0,o[e]%=r}}return o.reverse()}function Ca(t,a){var r,e,o;if(a.isZero())return a;if(e=a.d.length,e<32)r=Math.ceil(e/3),o=(1/d2(4,r)).toString();else r=16,o="2.3283064365386962890625e-10";t.precision+=r,a=l5(t,1,a.times(o),new t(1));for(var n=r;n--;){var i=a.times(a);a=i.times(i).minus(i).times(8).plus(1)}return t.precision-=r,a}var O3=function(){function t(e,o,n){var i,l=0,d=e.length;for(e=e.slice();d--;)i=e[d]*o+l,e[d]=i%n|0,l=i/n|0;if(l)e.unshift(l);return e}function a(e,o,n,i){var l,d;if(n!=i)d=n>i?1:-1;else for(l=d=0;l<n;l++)if(e[l]!=o[l]){d=e[l]>o[l]?1:-1;break}return d}function r(e,o,n,i){var l=0;for(;n--;)e[n]-=l,l=e[n]<o[n]?1:0,e[n]=l*i+e[n]-o[n];for(;!e[0]&&e.length>1;)e.shift()}return function(e,o,n,i,l,d){var p,g,c,m,y,h,s,x,D,S,P,T,f,X,B,L,R,N,u,O,Y=e.constructor,j=e.s==o.s?1:-1,_=e.d,A=o.d;if(!_||!_[0]||!A||!A[0])return new Y(!e.s||!o.s||(_?A&&_[0]==A[0]:!A)?NaN:_&&_[0]==0||!A?j*0:j/0);if(d)y=1,g=e.e-o.e;else d=D4,y=T3,g=q3(e.e/y)-q3(o.e/y);u=A.length,R=_.length,D=new Y(j),S=D.d=[];for(c=0;A[c]==(_[c]||0);c++);if(A[c]>(_[c]||0))g--;if(n==null)X=n=Y.precision,i=Y.rounding;else if(l)X=n+(e.e-o.e)+1;else X=n;if(X<0)S.push(1),h=!0;else{if(X=X/y+2|0,c=0,u==1){m=0,A=A[0],X++;for(;(c<R||m)&&X--;c++)B=m*d+(_[c]||0),S[c]=B/A|0,m=B%A|0;h=m||c<R}else{if(m=d/(A[0]+1)|0,m>1)A=t(A,m,d),_=t(_,m,d),u=A.length,R=_.length;L=u,P=_.slice(0,u),T=P.length;for(;T<u;)P[T++]=0;if(O=A.slice(),O.unshift(0),N=A[0],A[1]>=d/2)++N;do{if(m=0,p=a(A,P,u,T),p<0){if(f=P[0],u!=T)f=f*d+(P[1]||0);if(m=f/N|0,m>1){if(m>=d)m=d-1;if(s=t(A,m,d),x=s.length,T=P.length,p=a(s,P,x,T),p==1)m--,r(s,u<x?O:A,x,d)}else{if(m==0)p=m=1;s=A.slice()}if(x=s.length,x<T)s.unshift(0);if(r(P,s,T,d),p==-1){if(T=P.length,p=a(A,P,u,T),p<1)m++,r(P,u<T?O:A,T,d)}T=P.length}else if(p===0)m++,P=[0];if(S[c++]=m,p&&P[0])P[T++]=_[L]||0;else P=[_[L]],T=1}while((L++<R||P[0]!==void 0)&&X--);h=P[0]!==void 0}if(!S[0])S.shift()}if(y==1)D.e=g,L9=h;else{for(c=1,m=S[0];m>=10;m/=10)c++;D.e=c+g*y-1,h3(D,l?n+D.e+1:n,i,h)}return D}}();function h3(t,a,r,e){var o,n,i,l,d,p,g,c,m,y=t.constructor;t:if(a!=null){if(c=t.d,!c)return t;for(o=1,l=c[0];l>=10;l/=10)o++;if(n=a-o,n<0)n+=T3,i=a,g=c[m=0],d=g/_3(10,o-i-1)%10|0;else if(m=Math.ceil((n+1)/T3),l=c.length,m>=l)if(e){for(;l++<=m;)c.push(0);g=d=0,o=1,n%=T3,i=n-T3+1}else break t;else{g=l=c[m];for(o=1;l>=10;l/=10)o++;n%=T3,i=n-T3+o,d=i<0?0:g/_3(10,o-i-1)%10|0}if(e=e||a<0||c[m+1]!==void 0||(i<0?g:g%_3(10,o-i-1)),p=r<4?(d||e)&&(r==0||r==(t.s<0?3:2)):d>5||d==5&&(r==4||e||r==6&&(n>0?i>0?g/_3(10,o-i):0:c[m-1])%10&1||r==(t.s<0?8:7)),a<1||!c[0]){if(c.length=0,p)a-=t.e+1,c[0]=_3(10,(T3-a%T3)%T3),t.e=-a||0;else c[0]=t.e=0;return t}if(n==0)c.length=m,l=1,m--;else c.length=m+1,l=_3(10,T3-n),c[m]=i>0?(g/_3(10,o-i)%_3(10,i)|0)*l:0;if(p)for(;;)if(m==0){for(n=1,i=c[0];i>=10;i/=10)n++;i=c[0]+=l;for(l=1;i>=10;i/=10)l++;if(n!=l){if(t.e++,c[0]==D4)c[0]=1}break}else{if(c[m]+=l,c[m]!=D4)break;c[m--]=0,l=1}for(n=c.length;c[--n]===0;)c.pop()}if(f3){if(t.e>y.maxE)t.d=null,t.e=NaN;else if(t.e<y.minE)t.e=0,t.d=[0]}return t}function C4(t,a,r){if(!t.isFinite())return F9(t);var e,o=t.e,n=W3(t.d),i=n.length;if(a){if(r&&(e=r-i)>0)n=n.charAt(0)+"."+n.slice(1)+M4(e);else if(i>1)n=n.charAt(0)+"."+n.slice(1);n=n+(t.e<0?"e":"e+")+t.e}else if(o<0){if(n="0."+M4(-o-1)+n,r&&(e=r-i)>0)n+=M4(e)}else if(o>=i){if(n+=M4(o+1-i),r&&(e=r-o-1)>0)n=n+"."+M4(e)}else{if((e=o+1)<i)n=n.slice(0,e)+"."+n.slice(e);if(r&&(e=r-i)>0){if(o+1===i)n+=".";n+=M4(e)}}return n}function p2(t,a){var r=t[0];for(a*=T3;r>=10;r/=10)a++;return a}function Q5(t,a,r){if(a>Aa){if(f3=!0,r)t.precision=r;throw Error(O9)}return h3(new t(z5),a,1,!0)}function T4(t,a,r){if(a>X2)throw Error(O9);return h3(new t(q5),a,r,!0)}function V9(t){var a=t.length-1,r=a*T3+1;if(a=t[a],a){for(;a%10==0;a/=10)r--;for(a=t[0];a>=10;a/=10)r++}return r}function M4(t){var a="";for(;t--;)a+="0";return a}function U9(t,a,r,e){var o,n=new t(1),i=Math.ceil(e/T3+4);f3=!1;for(;;){if(r%2){if(n=n.times(a),N0(n.d,i))o=!0}if(r=q3(r/2),r===0){if(r=n.d.length-1,o&&n.d[r]===0)++n.d[r];break}a=a.times(a),N0(a.d,i)}return f3=!0,n}function R0(t){return t.d[t.d.length-1]&1}function _9(t,a,r){var e,o,n=new t(a[0]),i=0;for(;++i<a.length;){if(o=new t(a[i]),!o.s){n=o;break}if(e=n.cmp(o),e===r||e===0&&n.s===r)n=o}return n}function L2(t,a){var r,e,o,n,i,l,d,p=0,g=0,c=0,m=t.constructor,y=m.rounding,h=m.precision;if(!t.d||!t.d[0]||t.e>17)return new m(t.d?!t.d[0]?1:t.s<0?0:1/0:t.s?t.s<0?0:t:NaN);if(a==null)f3=!1,d=h;else d=a;l=new m(0.03125);while(t.e>-2)t=t.times(l),c+=5;e=Math.log(_3(2,c))/Math.LN10*2+5|0,d+=e,r=n=i=new m(1),m.precision=d;for(;;){if(n=h3(n.times(t),d,1),r=r.times(++g),l=i.plus(O3(n,r,d,1)),W3(l.d).slice(0,d)===W3(i.d).slice(0,d)){o=c;while(o--)i=h3(i.times(i),d,1);if(a==null)if(p<3&&C5(i.d,d-e,y,p))m.precision=d+=10,r=n=l=new m(1),g=0,p++;else return h3(i,m.precision=h,y,f3=!0);else return m.precision=h,i}i=l}}function U4(t,a){var r,e,o,n,i,l,d,p,g,c,m,y=1,h=10,s=t,x=s.d,D=s.constructor,S=D.rounding,P=D.precision;if(s.s<0||!x||!x[0]||!s.e&&x[0]==1&&x.length==1)return new D(x&&!x[0]?-1/0:s.s!=1?NaN:x?0:s);if(a==null)f3=!1,g=P;else g=a;if(D.precision=g+=h,r=W3(x),e=r.charAt(0),Math.abs(n=s.e)<1500000000000000){while(e<7&&e!=1||e==1&&r.charAt(1)>3)s=s.times(t),r=W3(s.d),e=r.charAt(0),y++;if(n=s.e,e>1)s=new D("0."+r),n++;else s=new D(e+"."+r.slice(1))}else return p=Q5(D,g+2,P).times(n+""),s=U4(new D(e+"."+r.slice(1)),g-h).plus(p),D.precision=P,a==null?h3(s,P,S,f3=!0):s;c=s,d=i=s=O3(s.minus(1),s.plus(1),g,1),m=h3(s.times(s),g,1),o=3;for(;;){if(i=h3(i.times(m),g,1),p=d.plus(O3(i,new D(o),g,1)),W3(p.d).slice(0,g)===W3(d.d).slice(0,g)){if(d=d.times(2),n!==0)d=d.plus(Q5(D,g+2,P).times(n+""));if(d=O3(d,new D(y),g,1),a==null)if(C5(d.d,g-h,S,l))D.precision=g+=h,p=i=s=O3(c.minus(1),c.plus(1),g,1),m=h3(s.times(s),g,1),o=l=1;else return h3(d,D.precision=P,S,f3=!0);else return D.precision=P,d}d=p,o+=2}}function F9(t){return String(t.s*t.s/0)}function M5(t,a){var r,e,o;if((r=a.indexOf("."))>-1)a=a.replace(".","");if((e=a.search(/e/i))>0){if(r<0)r=e;r+=+a.slice(e+1),a=a.substring(0,e)}else if(r<0)r=a.length;for(e=0;a.charCodeAt(e)===48;e++);for(o=a.length;a.charCodeAt(o-1)===48;--o);if(a=a.slice(e,o),a){if(o-=e,t.e=r=r-e-1,t.d=[],e=(r+1)%T3,r<0)e+=T3;if(e<o){if(e)t.d.push(+a.slice(0,e));for(o-=T3;e<o;)t.d.push(+a.slice(e,e+=T3));a=a.slice(e),e=T3-a.length}else e-=o;for(;e--;)a+="0";if(t.d.push(+a),f3){if(t.e>t.constructor.maxE)t.d=null,t.e=NaN;else if(t.e<t.constructor.minE)t.e=0,t.d=[0]}}else t.e=0,t.d=[0];return t}function fa(t,a){var r,e,o,n,i,l,d,p,g;if(a.indexOf("_")>-1){if(a=a.replace(/(\d)_(?=\d)/g,"$1"),M9.test(a))return M5(t,a)}else if(a==="Infinity"||a==="NaN"){if(!+a)t.s=NaN;return t.e=NaN,t.d=null,t}if(ba.test(a))r=16,a=a.toLowerCase();else if(Ea.test(a))r=2;else if(Pa.test(a))r=8;else throw Error(_4+a);if(n=a.search(/p/i),n>0)d=+a.slice(n+1),a=a.substring(2,n);else a=a.slice(2);if(n=a.indexOf("."),i=n>=0,e=t.constructor,i)a=a.replace(".",""),l=a.length,n=l-n,o=U9(e,new e(r),n,n*2);p=Y5(a,r,D4),g=p.length-1;for(n=g;p[n]===0;--n)p.pop();if(n<0)return new e(t.s*0);if(t.e=p2(p,g),t.d=p,f3=!1,i)t=O3(t,o,l*4);if(d)t=t.times(Math.abs(d)<54?_3(2,d):N5.pow(2,d));return f3=!0,t}function ua(t,a){var r,e=a.d.length;if(e<3)return a.isZero()?a:l5(t,2,a,a);r=1.4*Math.sqrt(e),r=r>16?16:r|0,a=a.times(1/d2(5,r)),a=l5(t,2,a,a);var o,n=new t(5),i=new t(16),l=new t(20);for(;r--;)o=a.times(a),a=a.times(n.plus(o.times(i.times(o).minus(l))));return a}function l5(t,a,r,e,o){var n,i,l,d,p=1,g=t.precision,c=Math.ceil(g/T3);f3=!1,d=r.times(r),l=new t(e);for(;;){if(i=O3(l.times(d),new t(a++*a++),g,1),l=o?e.plus(i):e.minus(i),e=O3(i.times(d),new t(a++*a++),g,1),i=l.plus(e),i.d[c]!==void 0){for(n=c;i.d[n]===l.d[n]&&n--;);if(n==-1)break}n=l,l=e,e=i,i=n,p++}return f3=!0,i.d.length=c+1,i}function d2(t,a){var r=t;while(--a)r*=t;return r}function j9(t,a){var r,e=a.s<0,o=T4(t,t.precision,1),n=o.times(0.5);if(a=a.abs(),a.lte(n))return N4=e?4:1,a;if(r=a.divToInt(o),r.isZero())N4=e?3:2;else{if(a=a.minus(r.times(o)),a.lte(n))return N4=R0(r)?e?2:3:e?4:1,a;N4=R0(r)?e?1:4:e?3:2}return a.minus(o).abs()}function Q2(t,a,r,e){var o,n,i,l,d,p,g,c,m,y=t.constructor,h=r!==void 0;if(h)if($3(r,1,W4),e===void 0)e=y.rounding;else $3(e,0,8);else r=y.precision,e=y.rounding;if(!t.isFinite())g=F9(t);else{if(g=C4(t),i=g.indexOf("."),h){if(o=2,a==16)r=r*4-3;else if(a==8)r=r*3-2}else o=a;if(i>=0)g=g.replace(".",""),m=new y(1),m.e=g.length-i,m.d=Y5(C4(m),10,o),m.e=m.d.length;c=Y5(g,10,o),n=d=c.length;for(;c[--d]==0;)c.pop();if(!c[0])g=h?"0p+0":"0";else{if(i<0)n--;else t=new y(t),t.d=c,t.e=n,t=O3(t,m,r,e,0,o),c=t.d,n=t.e,p=L9;if(i=c[r],l=o/2,p=p||c[r+1]!==void 0,p=e<4?(i!==void 0||p)&&(e===0||e===(t.s<0?3:2)):i>l||i===l&&(e===4||p||e===6&&c[r-1]&1||e===(t.s<0?8:7)),c.length=r,p){for(;++c[--r]>o-1;)if(c[r]=0,!r)++n,c.unshift(1)}for(d=c.length;!c[d-1];--d);for(i=0,g="";i<d;i++)g+=v2.charAt(c[i]);if(h){if(d>1)if(a==16||a==8){i=a==16?4:3;for(--d;d%i;d++)g+="0";c=Y5(g,o,a);for(d=c.length;!c[d-1];--d);for(i=1,g="1.";i<d;i++)g+=v2.charAt(c[i])}else g=g.charAt(0)+"."+g.slice(1);g=g+(n<0?"p":"p+")+n}else if(n<0){for(;++n;)g="0"+g;g="0."+g}else if(++n>d)for(n-=d;n--;)g+="0";else if(n<d)g=g.slice(0,n)+"."+g.slice(n)}g=(a==16?"0x":a==2?"0b":a==8?"0o":"")+g}return t.s<0?"-"+g:g}function N0(t,a){if(t.length>a)return t.length=a,!0}function Ia(t){return new this(t).abs()}function Ra(t){return new this(t).acos()}function Na(t){return new this(t).acosh()}function wa(t,a){return new this(t).plus(a)}function va(t){return new this(t).asin()}function Ba(t){return new this(t).asinh()}function Xa(t){return new this(t).atan()}function La(t){return new this(t).atanh()}function Oa(t,a){t=new this(t),a=new this(a);var r,e=this.precision,o=this.rounding,n=e+4;if(!t.s||!a.s)r=new this(NaN);else if(!t.d&&!a.d)r=T4(this,n,1).times(a.s>0?0.25:0.75),r.s=t.s;else if(!a.d||t.isZero())r=a.s<0?T4(this,e,o):new this(0),r.s=t.s;else if(!t.d||a.isZero())r=T4(this,n,1).times(0.5),r.s=t.s;else if(a.s<0)this.precision=n,this.rounding=1,r=this.atan(O3(t,a,n,1)),a=T4(this,n,1),this.precision=e,this.rounding=o,r=t.s<0?r.minus(a):r.plus(a);else r=this.atan(O3(t,a,n,1));return r}function ka(t){return new this(t).cbrt()}function Ya(t){return h3(t=new this(t),t.e+1,2)}function Ma(t,a,r){return new this(t).clamp(a,r)}function Va(t){if(!t||typeof t!=="object")throw Error(l2+"Object expected");var a,r,e,o=t.defaults===!0,n=["precision",1,W4,"rounding",0,8,"toExpNeg",-o5,0,"toExpPos",0,o5,"maxE",0,o5,"minE",-o5,0,"modulo",0,9];for(a=0;a<n.length;a+=3){if(r=n[a],o)this[r]=B2[r];if((e=t[r])!==void 0)if(q3(e)===e&&e>=n[a+1]&&e<=n[a+2])this[r]=e;else throw Error(_4+r+": "+e)}if(r="crypto",o)this[r]=B2[r];if((e=t[r])!==void 0)if(e===!0||e===!1||e===0||e===1)if(e)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(k9);else this[r]=!1;else throw Error(_4+r+": "+e);return this}function Ua(t){return new this(t).cos()}function _a(t){return new this(t).cosh()}function W9(t){var a,r,e;function o(n){var i,l,d,p=this;if(!(p instanceof o))return new o(n);if(p.constructor=o,w0(n)){if(p.s=n.s,f3)if(!n.d||n.e>o.maxE)p.e=NaN,p.d=null;else if(n.e<o.minE)p.e=0,p.d=[0];else p.e=n.e,p.d=n.d.slice();else p.e=n.e,p.d=n.d?n.d.slice():n.d;return}if(d=typeof n,d==="number"){if(n===0){p.s=1/n<0?-1:1,p.e=0,p.d=[0];return}if(n<0)n=-n,p.s=-1;else p.s=1;if(n===~~n&&n<1e7){for(i=0,l=n;l>=10;l/=10)i++;if(f3)if(i>o.maxE)p.e=NaN,p.d=null;else if(i<o.minE)p.e=0,p.d=[0];else p.e=i,p.d=[n];else p.e=i,p.d=[n];return}if(n*0!==0){if(!n)p.s=NaN;p.e=NaN,p.d=null;return}return M5(p,n.toString())}if(d==="string"){if((l=n.charCodeAt(0))===45)n=n.slice(1),p.s=-1;else{if(l===43)n=n.slice(1);p.s=1}return M9.test(n)?M5(p,n):fa(p,n)}if(d==="bigint"){if(n<0)n=-n,p.s=-1;else p.s=1;return M5(p,n.toString())}throw Error(_4+n)}if(o.prototype=r3,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=Va,o.clone=W9,o.isDecimal=w0,o.abs=Ia,o.acos=Ra,o.acosh=Na,o.add=wa,o.asin=va,o.asinh=Ba,o.atan=Xa,o.atanh=La,o.atan2=Oa,o.cbrt=ka,o.ceil=Ya,o.clamp=Ma,o.cos=Ua,o.cosh=_a,o.div=Fa,o.exp=ja,o.floor=Wa,o.hypot=Ga,o.ln=za,o.log=qa,o.log10=Ha,o.log2=Qa,o.max=Ka,o.min=Za,o.mod=Ja,o.mul=$a,o.pow=te,o.random=ae,o.round=ee,o.sign=re,o.sin=oe,o.sinh=ne,o.sqrt=ie,o.sub=le,o.sum=pe,o.tan=de,o.tanh=ge,o.trunc=ce,t===void 0)t={};if(t){if(t.defaults!==!0){e=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];for(a=0;a<e.length;)if(!t.hasOwnProperty(r=e[a++]))t[r]=this[r]}}return o.config(t),o}function Fa(t,a){return new this(t).div(a)}function ja(t){return new this(t).exp()}function Wa(t){return h3(t=new this(t),t.e+1,3)}function Ga(){var t,a,r=new this(0);f3=!1;for(t=0;t<arguments.length;)if(a=new this(arguments[t++]),!a.d){if(a.s)return f3=!0,new this(1/0);r=a}else if(r.d)r=r.plus(a.times(a));return f3=!0,r.sqrt()}function w0(t){return t instanceof N5||t&&t.toStringTag===Y9||!1}function za(t){return new this(t).ln()}function qa(t,a){return new this(t).log(a)}function Qa(t){return new this(t).log(2)}function Ha(t){return new this(t).log(10)}function Ka(){return _9(this,arguments,-1)}function Za(){return _9(this,arguments,1)}function Ja(t,a){return new this(t).mod(a)}function $a(t,a){return new this(t).mul(a)}function te(t,a){return new this(t).pow(a)}function ae(t){var a,r,e,o,n=0,i=new this(1),l=[];if(t===void 0)t=this.precision;else $3(t,1,W4);if(e=Math.ceil(t/T3),!this.crypto)for(;n<e;)l[n++]=Math.random()*1e7|0;else if(crypto.getRandomValues){a=crypto.getRandomValues(new Uint32Array(e));for(;n<e;)if(o=a[n],o>=4290000000)a[n]=crypto.getRandomValues(new Uint32Array(1))[0];else l[n++]=o%1e7}else if(crypto.randomBytes){a=crypto.randomBytes(e*=4);for(;n<e;)if(o=a[n]+(a[n+1]<<8)+(a[n+2]<<16)+((a[n+3]&127)<<24),o>=2140000000)crypto.randomBytes(4).copy(a,n);else l.push(o%1e7),n+=4;n=e/4}else throw Error(k9);if(e=l[--n],t%=T3,e&&t)o=_3(10,T3-t),l[n]=(e/o|0)*o;for(;l[n]===0;n--)l.pop();if(n<0)r=0,l=[0];else{r=-1;for(;l[0]===0;r-=T3)l.shift();for(e=1,o=l[0];o>=10;o/=10)e++;if(e<T3)r-=T3-e}return i.e=r,i.d=l,i}function ee(t){return h3(t=new this(t),t.e+1,this.rounding)}function re(t){return t=new this(t),t.d?t.d[0]?t.s:0*t.s:t.s||NaN}function oe(t){return new this(t).sin()}function ne(t){return new this(t).sinh()}function ie(t){return new this(t).sqrt()}function le(t,a){return new this(t).sub(a)}function pe(){var t=0,a=arguments,r=new this(a[t]);f3=!1;for(;r.s&&++t<a.length;)r=r.plus(a[t]);return f3=!0,h3(r,this.precision,this.rounding)}function de(t){return new this(t).tan()}function ge(t){return new this(t).tanh()}function ce(t){return h3(t=new this(t),t.e+1,1)}r3[Symbol.for("nodejs.util.inspect.custom")]=r3.toString;r3[Symbol.toStringTag]="Decimal";var N5=r3.constructor=W9(B2);z5=new N5(z5);q5=new N5(q5);var E=N5;E.set({precision:80});var jn=new E("1e-40"),Wn=new E("1e-10"),A2=(t)=>{if(t===null||t===void 0)throw Error(`Cannot convert ${t===null?"null":"undefined"} to Decimal`);if(t instanceof E)return t;try{return new E(t)}catch(a){throw Error(`Invalid numeric value: ${a.message}`)}};class k3{constructor(t){if(!Array.isArray(t))throw Error("Vector requires array");if(t.length===0)throw Error("Vector requires at least one component");try{this.data=t.map((a,r)=>{if(a===null||a===void 0)throw Error(`Vector component at index ${r} is ${a===null?"null":"undefined"}`);return A2(a)})}catch(a){throw Error(`Vector constructor failed: ${a.message}`)}this.length=this.data.length}static from(t){if(t===null||t===void 0)throw Error(`Vector.from: argument is ${t===null?"null":"undefined"}`);return new k3(t)}clone(){return new k3(this.data.map((t)=>new E(t)))}toArray(){return this.data.slice()}toNumberArray(){return this.data.map((t)=>t.toNumber())}toStringArray(){return this.data.map((t)=>t.toString())}add(t){if(!t||!(t instanceof k3))throw Error("add: argument must be a Vector");if(this.length!==t.length)throw Error(`add: dimension mismatch (${this.length} vs ${t.length})`);return new k3(this.data.map((a,r)=>a.plus(t.data[r])))}sub(t){if(!t||!(t instanceof k3))throw Error("sub: argument must be a Vector");if(this.length!==t.length)throw Error(`sub: dimension mismatch (${this.length} vs ${t.length})`);return new k3(this.data.map((a,r)=>a.minus(t.data[r])))}scale(t){if(t===null||t===void 0)throw Error(`scale: scalar is ${t===null?"null":"undefined"}`);let a;try{a=A2(t)}catch(r){throw Error(`scale: invalid scalar - ${r.message}`)}return new k3(this.data.map((r)=>r.mul(a)))}negate(){return new k3(this.data.map((t)=>t.negated()))}dot(t){if(!t||!(t instanceof k3))throw Error("dot: argument must be a Vector");if(this.length!==t.length)throw Error(`dot: dimension mismatch (${this.length} vs ${t.length})`);return this.data.reduce((a,r,e)=>a.plus(r.mul(t.data[e])),new E(0))}outer(t){if(!t||!(t instanceof k3))throw Error("outer: argument must be a Vector");if(this.length===0||t.length===0)throw Error("outer: cannot compute outer product with empty vector");let a=this.length,r=t.length;return Array.from({length:a},(e,o)=>Array.from({length:r},(n,i)=>this.data[o].mul(t.data[i])))}cross(t){if(!t||!(t instanceof k3))throw Error("cross: argument must be a Vector");if(this.length!==3||t.length!==3)throw Error(`cross: requires 3D vectors (got ${this.length}D and ${t.length}D)`);let[a,r,e]=this.data,[o,n,i]=t.data;return new k3([r.mul(i).minus(e.mul(n)),e.mul(o).minus(a.mul(i)),a.mul(n).minus(r.mul(o))])}norm(){let t=new E(0);for(let a of this.data)t=t.plus(a.mul(a));return t.sqrt()}normalize(){let t=this.norm();if(t.isZero())throw Error("Cannot normalize zero vector");return this.scale(new E(1).div(t))}angleBetween(t){if(!t||!(t instanceof k3))throw Error("angleBetween: argument must be a Vector");if(this.length!==t.length)throw Error(`angleBetween: dimension mismatch (${this.length} vs ${t.length})`);let a=this.dot(t),r=this.norm(),e=t.norm();if(r.isZero()||e.isZero())throw Error("angleBetween: angle with zero vector is undefined");let o=a.div(r.mul(e)).toNumber(),n=Math.min(1,Math.max(-1,o));return new E(Math.acos(n))}projectOnto(t){if(!t||!(t instanceof k3))throw Error("projectOnto: argument must be a Vector");if(this.length!==t.length)throw Error(`projectOnto: dimension mismatch (${this.length} vs ${t.length})`);let a=t.dot(t);if(a.isZero())throw Error("projectOnto: cannot project onto zero vector");let r=this.dot(t).div(a);return t.scale(r)}orthogonal(){if(this.norm().isZero())throw Error("orthogonal: cannot find orthogonal vector to zero vector");if(this.length===2)return new k3([this.data[1].negated(),this.data[0]]);for(let t=0;t<this.length;t++){let a=Array.from({length:this.length},(n,i)=>new E(i===t?1:0)),r=new k3(a),e=r.projectOnto(this),o=r.sub(e);if(!o.norm().isZero())return o.normalize()}throw Error("orthogonal: unable to find orthogonal vector (degenerate case)")}isOrthogonalTo(t){if(!t||!(t instanceof k3))throw Error("isOrthogonalTo: argument must be a Vector");if(this.length!==t.length)throw Error(`isOrthogonalTo: dimension mismatch (${this.length} vs ${t.length})`);return this.dot(t).isZero()}distance(t){if(!t||!(t instanceof k3))throw Error("distance: argument must be a Vector");if(this.length!==t.length)throw Error(`distance: dimension mismatch (${this.length} vs ${t.length})`);return this.sub(t).norm()}equals(t,a=0){if(!(t instanceof k3))return!1;if(t.length!==this.length)return!1;if(a===null)throw Error("equals: tolerance cannot be null");let r;try{if(r=A2(a),r.isNaN())throw Error("equals: tolerance cannot be NaN");if(r.isNegative())throw Error("equals: tolerance must be non-negative")}catch(e){throw Error(`equals: invalid tolerance - ${e.message}`)}for(let e=0;e<this.length;e++)if(this.data[e].minus(t.data[e]).abs().greaterThan(r))return!1;return!0}}var r5=(t)=>{if(t==null)throw Error("Cannot convert null or undefined to Decimal");return t instanceof E?t:new E(t)};class P3{constructor(t){if(!Array.isArray(t)||t.length===0)throw Error("Matrix requires non-empty 2D array");if(!Array.isArray(t[0])||t[0].length===0)throw Error("Matrix rows must be non-empty arrays");let a=t[0].length;for(let r of t)if(!Array.isArray(r)||r.length!==a)throw Error("All rows must have same length");this.data=t.map((r)=>r.map((e)=>r5(e))),this.rows=t.length,this.cols=a}static from(t){return new P3(t)}static zeros(t,a){if(!Number.isInteger(t)||t<=0)throw Error("rows must be a positive integer");if(!Number.isInteger(a)||a<=0)throw Error("cols must be a positive integer");let r=Array.from({length:t},()=>Array.from({length:a},()=>new E(0)));return new P3(r)}static identity(t){if(!Number.isInteger(t)||t<=0)throw Error("size must be a positive integer");let a=Array.from({length:t},(r,e)=>Array.from({length:t},(o,n)=>e===n?new E(1):new E(0)));return new P3(a)}clone(){return new P3(this.data.map((t)=>t.map((a)=>new E(a))))}toArrayOfStrings(){return this.data.map((t)=>t.map((a)=>a.toString()))}toNumberArray(){return this.data.map((t)=>t.map((a)=>a.toNumber()))}isSquare(){return this.rows===this.cols}applyToVector(t){let a;if(t instanceof k3)a=t;else if(Array.isArray(t))a=k3.from(t);else throw Error("applyToVector expects Vector or array");if(this.cols!==a.length)throw Error("shape mismatch: matrix cols must equal vector length");let r=[];for(let e=0;e<this.rows;e++){let o=new E(0);for(let n=0;n<this.cols;n++)o=o.plus(this.data[e][n].mul(a.data[n]));r.push(o)}return new k3(r)}add(t){if(t instanceof P3){if(this.rows!==t.rows||this.cols!==t.cols)throw Error("shape mismatch: matrices must have same dimensions");return new P3(this.data.map((a,r)=>a.map((e,o)=>e.plus(t.data[r][o]))))}else{let a=r5(t);return new P3(this.data.map((r)=>r.map((e)=>e.plus(a))))}}sub(t){if(t instanceof P3){if(this.rows!==t.rows||this.cols!==t.cols)throw Error("shape mismatch: matrices must have same dimensions");return new P3(this.data.map((a,r)=>a.map((e,o)=>e.minus(t.data[r][o]))))}else{let a=r5(t);return new P3(this.data.map((r)=>r.map((e)=>e.minus(a))))}}mul(t){if(t instanceof P3){if(this.cols!==t.rows)throw Error("shape mismatch: A.cols must equal B.rows for matrix multiplication");let a=Array.from({length:this.rows},()=>Array.from({length:t.cols},()=>new E(0)));for(let r=0;r<this.rows;r++)for(let e=0;e<this.cols;e++){let o=this.data[r][e];if(o.isZero())continue;for(let n=0;n<t.cols;n++)a[r][n]=a[r][n].plus(o.mul(t.data[e][n]))}return new P3(a)}else{let a=r5(t);return new P3(this.data.map((r)=>r.map((e)=>e.mul(a))))}}div(t){let a=r5(t);if(a.isZero())throw Error("Cannot divide by zero");return new P3(this.data.map((r)=>r.map((e)=>e.div(a))))}negate(){return new P3(this.data.map((t)=>t.map((a)=>a.negated())))}transpose(){let t=Array.from({length:this.cols},(a,r)=>Array.from({length:this.rows},(e,o)=>new E(this.data[o][r])));return new P3(t)}trace(){if(!this.isSquare())throw Error("Trace only defined for square matrices");let t=new E(0);for(let a=0;a<this.rows;a++)t=t.plus(this.data[a][a]);return t}equals(t,a=0){if(!(t instanceof P3))return!1;if(this.rows!==t.rows||this.cols!==t.cols)return!1;let r=r5(a);if(r.isNegative()||!r.isFinite())throw Error("tolerance must be non-negative and finite");for(let e=0;e<this.rows;e++)for(let o=0;o<this.cols;o++)if(this.data[e][o].minus(t.data[e][o]).abs().greaterThan(r))return!1;return!0}lu(){if(!this.isSquare())throw Error("LU decomposition requires square matrix");let t=this.rows,a=this.data.map((i)=>i.map((l)=>new E(l))),r=Array.from({length:t},(i,l)=>l),e=Array.from({length:t},()=>Array.from({length:t},()=>new E(0)));for(let i=0;i<t;i++)e[i][i]=new E(1);for(let i=0;i<t;i++){let l=i,d=a[i][i].abs();for(let p=i+1;p<t;p++){let g=a[p][i].abs();if(g.greaterThan(d))d=g,l=p}if(a[l][i].isZero())throw Error("Singular matrix: LU decomposition failed");if(l!==i){let p=a[i];a[i]=a[l],a[l]=p;let g=r[i];r[i]=r[l],r[l]=g;for(let c=0;c<i;c++){let m=e[i][c];e[i][c]=e[l][c],e[l][c]=m}}for(let p=i+1;p<t;p++){let g=a[p][i].div(a[i][i]);e[p][i]=g;for(let c=i;c<t;c++)a[p][c]=a[p][c].minus(g.mul(a[i][c]))}}let o=Array.from({length:t},(i,l)=>Array.from({length:t},(d,p)=>p<l?new E(0):a[l][p])),n=P3.zeros(t,t);for(let i=0;i<t;i++)n.data[i][r[i]]=new E(1);return{L:new P3(e),U:new P3(o),P:n}}determinant(){if(!this.isSquare())throw Error("Determinant only defined for square matrices");let t=this.rows,{L:a,U:r,P:e}=this.lu(),o=new E(1);for(let l=0;l<t;l++)o=o.mul(r.data[l][l]);let n=[];for(let l=0;l<t;l++)for(let d=0;d<t;d++)if(e.data[l][d].equals(1))n.push(d);let i=0;for(let l=0;l<n.length;l++)for(let d=l+1;d<n.length;d++)if(n[l]>n[d])i++;if(i%2===1)o=o.negated();return o}inverse(){if(!this.isSquare())throw Error("Inverse only defined for square matrices");let t=this.rows,a=Array.from({length:t},(e,o)=>Array.from({length:2*t},(n,i)=>i<t?new E(this.data[o][i]):i-t===o?new E(1):new E(0)));for(let e=0;e<t;e++){let o=e,n=a[e][e].abs();for(let l=e+1;l<t;l++){let d=a[l][e].abs();if(d.greaterThan(n))n=d,o=l}if(a[o][e].isZero())throw Error("Singular matrix: inverse does not exist");if(o!==e){let l=a[e];a[e]=a[o],a[o]=l}let i=a[e][e];for(let l=0;l<2*t;l++)a[e][l]=a[e][l].div(i);for(let l=0;l<t;l++){if(l===e)continue;let d=a[l][e];if(d.isZero())continue;for(let p=0;p<2*t;p++)a[l][p]=a[l][p].minus(d.mul(a[e][p]))}}let r=a.map((e)=>e.slice(t));return new P3(r)}solve(t){let a;if(t instanceof k3)a=t;else if(Array.isArray(t))a=k3.from(t);else throw Error("b must be Vector or array");if(!this.isSquare())throw Error("solve() only implemented for square matrices");let r=this.rows;if(a.length!==r)throw Error("dimension mismatch: b length must equal matrix rows");let e=Array.from({length:r},(n,i)=>Array.from({length:r+1},(l,d)=>new E(d<r?this.data[i][d]:a.data[i])));for(let n=0;n<r;n++){let i=n,l=e[n][n].abs();for(let d=n+1;d<r;d++){let p=e[d][n].abs();if(p.greaterThan(l))l=p,i=d}if(e[i][n].isZero())throw Error("Singular matrix: no unique solution");if(i!==n){let d=e[n];e[n]=e[i],e[i]=d}for(let d=n+1;d<r;d++){let p=e[d][n].div(e[n][n]);if(p.isZero())continue;for(let g=n;g<r+1;g++)e[d][g]=e[d][g].minus(p.mul(e[n][g]))}}let o=Array.from({length:r},()=>new E(0));for(let n=r-1;n>=0;n--){if(e[n][n].isZero())throw Error("Zero diagonal element in back substitution: system is singular");let i=new E(0);for(let l=n+1;l<r;l++)i=i.plus(e[n][l].mul(o[l]));o[n]=e[n][r].minus(i).div(e[n][n])}return new k3(o)}qr(){let t=this.rows,a=this.cols,r=this.data.map((n)=>n.map((i)=>new E(i))),e=P3.identity(t).data;for(let n=0;n<Math.min(t,a);n++){let i=[];for(let c=n;c<t;c++)i.push(r[c][n]);let l=new E(0);for(let c of i)l=l.plus(c.mul(c));if(l=l.sqrt(),l.isZero())continue;let d=i[0].isNegative()?new E(-1):new E(1),p=i.slice();p[0]=p[0].plus(d.mul(l));let g=new E(0);for(let c of p)g=g.plus(c.mul(c));if(g=g.sqrt(),g.isZero())continue;for(let c=0;c<p.length;c++)p[c]=p[c].div(g);for(let c=n;c<a;c++){let m=new E(0);for(let y=0;y<p.length;y++)m=m.plus(p[y].mul(r[n+y][c]));for(let y=0;y<p.length;y++)r[n+y][c]=r[n+y][c].minus(new E(2).mul(p[y]).mul(m))}for(let c=0;c<t;c++){let m=new E(0);for(let y=0;y<p.length;y++)m=m.plus(p[y].mul(e[n+y][c]));for(let y=0;y<p.length;y++)e[n+y][c]=e[n+y][c].minus(new E(2).mul(p[y]).mul(m))}}let o=Array.from({length:t},(n,i)=>Array.from({length:a},(l,d)=>i<=d?r[i][d]:new E(0)));return{Q:new P3(e).transpose(),R:new P3(o)}}exp(t={}){let a=this.rows;if(!this.isSquare())throw Error("Matrix exponential requires square matrix");let r=P3.identity(a),e=t.maxIter||120;if(!Number.isInteger(e)||e<=0)throw Error("maxIter must be a positive integer");let o=new E(t.tolerance||"1e-40");if(o.isNegative()||o.isZero()||!o.isFinite())throw Error("tolerance must be positive and finite");let n=((g)=>{let c=new E(0);for(let m=0;m<g.rows;m++){let y=new E(0);for(let h=0;h<g.cols;h++)y=y.plus(g.data[m][h].abs());if(y.greaterThan(c))c=y}return c})(this),i=0;if(n.greaterThan(new E(1))){let g=n.toNumber();if(!isFinite(g))throw Error("Matrix norm too large for exponential computation");if(i=Math.max(0,Math.ceil(Math.log2(g))),i>50)throw Error(`Matrix norm too large: requires ${i} scaling steps (max 50 allowed)`)}let l=this;if(i>0)l=this.mul(new E(1).div(new E(2).pow(i)));let d=r.clone(),p=r.clone();for(let g=1;g<e;g++){d=d.mul(l).mul(new E(1).div(g)),p=p.add(d);let c=new E(0);for(let m=0;m<d.rows;m++)for(let y=0;y<d.cols;y++)c=c.plus(d.data[m][y].abs());if(c.lessThan(o))break}for(let g=0;g<i;g++)p=p.mul(p);return p}}E.set({precision:80});var Y3=(t)=>t instanceof E?t:new E(t),me=new E("1e-40"),ye=new E("1e-30");function se(t,a){if(t==null)throw TypeError("translationMatrix: tx parameter is required");if(a==null)throw TypeError("translationMatrix: ty parameter is required");return P3.from([[1,0,Y3(t)],[0,1,Y3(a)],[0,0,1]])}function xe(t){if(t==null)throw TypeError("rotationMatrix: angle parameter is required");let a=Y3(t),r=E.cos(a),e=E.sin(a);return P3.from([[r,e.neg(),0],[e,r,0],[0,0,1]])}function De(t,a){if(t==null)throw TypeError("scaleMatrix: sx parameter is required");if(a==null)throw TypeError("scaleMatrix: sy parameter is required");return P3.from([[Y3(t),0,0],[0,Y3(a),0],[0,0,1]])}function he(t){if(t==null)throw TypeError("skewXMatrix: angle parameter is required");let a=E.tan(Y3(t));return P3.from([[1,a,0],[0,1,0],[0,0,1]])}function Se(t){if(t==null)throw TypeError("skewYMatrix: angle parameter is required");let a=E.tan(Y3(t));return P3.from([[1,0,0],[a,1,0],[0,0,1]])}function Ee(t){if(!t)throw TypeError("extractLinearPart: matrix parameter is required");if(!t.data)throw TypeError("extractLinearPart: matrix must have data property");if(t.rows<2||t.cols<2)throw RangeError("extractLinearPart: matrix must be at least 2x2");let a=t.data;return{a:a[0][0],b:a[1][0],c:a[0][1],d:a[1][1]}}function be(t){if(!t)throw TypeError("extractTranslation: matrix parameter is required");if(!t.data)throw TypeError("extractTranslation: matrix must have data property");if(t.rows<2||t.cols<3)throw RangeError("extractTranslation: matrix must be at least 2x3");let a=t.data;return{tx:a[0][2],ty:a[1][2]}}function Pe(t){if(!t)throw TypeError("decomposeMatrix: matrix parameter is required");let{a,b:r,c:e,d:o}=Ee(t),{tx:n,ty:i}=be(t),l=a.mul(o).minus(r.mul(e)),d=a.mul(a).plus(r.mul(r)).sqrt();if(d.abs().lessThan(me))return{translateX:n,translateY:i,rotation:Y3(0),scaleX:Y3(0),scaleY:Y3(0),skewX:Y3(0),skewY:Y3(0),verified:!1,maxError:Y3("Infinity"),singular:!0};let p=l.div(d);if(p.abs().greaterThan(new E("1e40")))return{translateX:n,translateY:i,rotation:Y3(0),scaleX:Y3(0),scaleY:Y3(0),skewX:Y3(0),skewY:Y3(0),verified:!1,maxError:Y3("Infinity"),singular:!0};if(l.lessThan(0))d=d.neg(),p=p.neg();let g=E.atan2(r,a),c=E.cos(g),m=E.sin(g),y=a.mul(c).plus(r.mul(m)),h=e.mul(c).plus(o.mul(m)),s,x=new E("1e-30");if(y.abs().greaterThan(x)){let f=h.div(y);if(f.abs().greaterThan(new E("1e10")))s=Y3(0);else s=E.atan(f)}else s=Y3(0);let D=Y3(0),S=Te({translateX:n,translateY:i,rotation:g,scaleX:d,scaleY:p,skewX:s,skewY:Y3(0)}),P=Ae(t,S),T=P.lessThan(ye);return{translateX:n,translateY:i,rotation:g,scaleX:d,scaleY:p,skewX:s,skewY:D,verified:T,maxError:P}}function Te(t){if(!t)throw TypeError("composeTransform: components parameter is required");if(t.translateX==null)throw TypeError("composeTransform: components.translateX is required");if(t.translateY==null)throw TypeError("composeTransform: components.translateY is required");if(t.rotation==null)throw TypeError("composeTransform: components.rotation is required");if(t.scaleX==null)throw TypeError("composeTransform: components.scaleX is required");if(t.scaleY==null)throw TypeError("composeTransform: components.scaleY is required");if(t.skewX==null)throw TypeError("composeTransform: components.skewX is required");let{translateX:a,translateY:r,rotation:e,scaleX:o,scaleY:n,skewX:i,skewY:l=0}=t,d=se(a,r),p=xe(e),g=he(i),c=Se(l),m=De(o,n);return d.mul(p).mul(c).mul(g).mul(m)}function Ae(t,a){if(!t)throw TypeError("matrixMaxDifference: m1 parameter is required");if(!a)throw TypeError("matrixMaxDifference: m2 parameter is required");if(!t.data)throw TypeError("matrixMaxDifference: m1 must have data property");if(!a.data)throw TypeError("matrixMaxDifference: m2 must have data property");if(t.rows!==a.rows||t.cols!==a.cols)throw RangeError(`matrixMaxDifference: matrices must have same dimensions (${t.rows}x${t.cols} vs ${a.rows}x${a.cols})`);let r=Y3(0);for(let e=0;e<t.rows;e++)for(let o=0;o<t.cols;o++){let n=t.data[e][o].minus(a.data[e][o]).abs();if(n.greaterThan(r))r=n}return r}E.set({precision:80});var p4=(t)=>t instanceof E?t:new E(t),M3=new E("1e-40"),v0=100;function w4(t,a){if(t==null)throw TypeError("point: x coordinate cannot be null or undefined");if(a==null)throw TypeError("point: y coordinate cannot be null or undefined");return{x:p4(t),y:p4(a)}}function Ce(t,a){if(!t||t.x==null||t.y==null)throw TypeError("vectorAdd: first vector must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("vectorAdd: second vector must have x and y properties");return{x:t.x.plus(a.x),y:t.y.plus(a.y)}}function U3(t,a){if(!t||t.x==null||t.y==null)throw TypeError("vectorSub: first vector must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("vectorSub: second vector must have x and y properties");return{x:t.x.minus(a.x),y:t.y.minus(a.y)}}function f5(t){if(!t||t.x==null||t.y==null)throw TypeError("vectorNeg: vector must have x and y properties");return{x:t.x.neg(),y:t.y.neg()}}function O2(t,a){if(!t||t.x==null||t.y==null)throw TypeError("vectorScale: vector must have x and y properties");if(a==null)throw TypeError("vectorScale: scale factor cannot be null or undefined");let r=p4(a);return{x:t.x.mul(r),y:t.y.mul(r)}}function J3(t,a){if(!t||t.x==null||t.y==null)throw TypeError("dot: first vector must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("dot: second vector must have x and y properties");return t.x.mul(a.x).plus(t.y.mul(a.y))}function b5(t,a){if(!t||t.x==null||t.y==null)throw TypeError("cross: first vector must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("cross: second vector must have x and y properties");return t.x.mul(a.y).minus(t.y.mul(a.x))}function n4(t){if(!t||t.x==null||t.y==null)throw TypeError("magnitudeSquared: vector must have x and y properties");return t.x.mul(t.x).plus(t.y.mul(t.y))}function K4(t){if(!t||t.x==null||t.y==null)throw TypeError("magnitude: vector must have x and y properties");return n4(t).sqrt()}function fe(t){if(!t||t.x==null||t.y==null)throw TypeError("normalize: vector must have x and y properties");let a=K4(t);if(a.lessThan(M3))return{x:p4(0),y:p4(0)};return{x:t.x.div(a),y:t.y.div(a)}}function Y4(t,a,r){if(!t||t.x==null||t.y==null)throw TypeError("tripleProduct: first vector must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("tripleProduct: second vector must have x and y properties");if(!r||r.x==null||r.y==null)throw TypeError("tripleProduct: third vector must have x and y properties");let e=J3(t,r),o=J3(a,r);return U3(O2(a,e),O2(t,o))}function B0(t,a){if(!Array.isArray(t))throw TypeError("supportPoint: polygon must be an array");if(!a||a.x==null||a.y==null)throw TypeError("supportPoint: direction must have x and y properties");if(t.length===0)throw TypeError("supportPoint: polygon cannot be empty");if(!t[0]||t[0].x==null||t[0].y==null)throw TypeError("supportPoint: polygon[0] must have x and y properties");let r=J3(t[0],a),e=t[0];for(let o=1;o<t.length;o++){if(!t[o]||t[o].x==null||t[o].y==null)throw TypeError(`supportPoint: polygon[${o}] must have x and y properties`);let n=J3(t[o],a);if(n.greaterThan(r))r=n,e=t[o]}return e}function X0(t,a,r){if(!Array.isArray(t))throw TypeError("minkowskiSupport: polygonA must be an array");if(!Array.isArray(a))throw TypeError("minkowskiSupport: polygonB must be an array");if(!r||r.x==null||r.y==null)throw TypeError("minkowskiSupport: direction must have x and y properties");let e=B0(t,r),o=B0(a,f5(r));return U3(e,o)}function ue(t,a){if(!Array.isArray(t))throw TypeError("processLineSimplex: simplex must be an array");if(t.length!==2)throw TypeError("processLineSimplex: simplex must have exactly 2 points");if(!a||a.x==null||a.y==null)throw TypeError("processLineSimplex: direction must have x and y properties");if(!t[0]||t[0].x==null||t[0].y==null)throw TypeError("processLineSimplex: simplex[0] must have x and y properties");if(!t[1]||t[1].x==null||t[1].y==null)throw TypeError("processLineSimplex: simplex[1] must have x and y properties");let r=t[0],e=t[1],o=U3(e,r),n=f5(r),i=n4(o);if(i.lessThan(M3)){if(n4(r).lessThan(M3))return{contains:!0,newDirection:a};return{contains:!1,newDirection:n}}let l=Y4(o,n,o);if(n4(l).lessThan(M3)){let d=J3(o,n);if(d.greaterThanOrEqualTo(0)&&d.lessThanOrEqualTo(i))return{contains:!0,newDirection:a};return{contains:!1,newDirection:n}}return{contains:!1,newDirection:l}}function Ie(t,a){if(!Array.isArray(t))throw TypeError("processTriangleSimplex: simplex must be an array");if(t.length!==3)throw TypeError("processTriangleSimplex: simplex must have exactly 3 points");if(!a||a.x==null||a.y==null)throw TypeError("processTriangleSimplex: direction must have x and y properties");if(!t[0]||t[0].x==null||t[0].y==null)throw TypeError("processTriangleSimplex: simplex[0] must have x and y properties");if(!t[1]||t[1].x==null||t[1].y==null)throw TypeError("processTriangleSimplex: simplex[1] must have x and y properties");if(!t[2]||t[2].x==null||t[2].y==null)throw TypeError("processTriangleSimplex: simplex[2] must have x and y properties");let r=t[0],e=t[1],o=t[2],n=U3(e,r),i=U3(o,r),l=f5(r),d=n4(n),p=n4(i);if(d.lessThan(M3))return{contains:!1,newDirection:Y4(i,l,i),newSimplex:[r,o]};if(p.lessThan(M3))return{contains:!1,newDirection:Y4(n,l,n),newSimplex:[r,e]};let g=Y4(i,n,n),c=Y4(n,i,i);if(n4(g).lessThan(M3)&&n4(c).lessThan(M3)){let m=U3(o,e),y=n4(m);if(y.greaterThan(d)&&y.greaterThan(p))return{contains:!1,newDirection:Y4(m,f5(e),m),newSimplex:[e,o]};else if(d.greaterThan(p))return{contains:!1,newDirection:Y4(n,l,n),newSimplex:[r,e]};else return{contains:!1,newDirection:Y4(i,l,i),newSimplex:[r,o]}}if(J3(g,l).greaterThan(M3))return{contains:!1,newDirection:g,newSimplex:[r,e]};if(J3(c,l).greaterThan(M3))return{contains:!1,newDirection:c,newSimplex:[r,o]};return{contains:!0,newDirection:a,newSimplex:t}}function G9(t,a){if(!Array.isArray(t))throw TypeError("gjkIntersects: polygonA must be an array");if(!Array.isArray(a))throw TypeError("gjkIntersects: polygonB must be an array");if(t.length===0||a.length===0)return{intersects:!1,iterations:0,simplex:[],verified:!0};if(t.length===1&&a.length===1){if(!t[0]||t[0].x==null||t[0].y==null)throw TypeError("gjkIntersects: polygonA[0] must have x and y properties");if(!a[0]||a[0].x==null||a[0].y==null)throw TypeError("gjkIntersects: polygonB[0] must have x and y properties");return{intersects:K4(U3(t[0],a[0])).lessThan(M3),iterations:1,simplex:[],verified:!0}}let r=U3(H5(a),H5(t));if(n4(r).lessThan(M3))r=w4(1,0);let e=[X0(t,a,r)];if(r=f5(e[0]),n4(e[0]).lessThan(M3))return{intersects:!0,iterations:1,simplex:e,verified:C2(t,a)};for(let o=0;o<v0;o++){let n=X0(t,a,r);if(J3(n,r).lessThanOrEqualTo(p4(0)))return{intersects:!1,iterations:o+1,simplex:e,verified:!0};if(e.unshift(n),e.length===2){let i=ue(e,r);if(i.contains)return{intersects:!0,iterations:o+1,simplex:e,verified:C2(t,a)};r=i.newDirection}else if(e.length===3){let i=Ie(e,r);if(i.contains)return{intersects:!0,iterations:o+1,simplex:i.newSimplex,verified:C2(t,a)};e=i.newSimplex,r=i.newDirection}if(n4(r).lessThan(M3))return{intersects:!1,iterations:o+1,simplex:e,verified:!1};r=fe(r)}return{intersects:!1,iterations:v0,simplex:e,verified:!1}}function H5(t){if(!Array.isArray(t))throw TypeError("centroid: polygon must be an array");if(t.length===0)throw TypeError("centroid: polygon cannot be empty");let a=p4(0),r=p4(0);for(let o=0;o<t.length;o++){if(!t[o]||t[o].x==null||t[o].y==null)throw TypeError(`centroid: polygon[${o}] must have x and y properties`);a=a.plus(t[o].x),r=r.plus(t[o].y)}let e=p4(t.length);return{x:a.div(e),y:r.div(e)}}function L0(t,a){if(!t||t.x==null||t.y==null)throw TypeError("pointInConvexPolygon: point must have x and y properties");if(!Array.isArray(a))throw TypeError("pointInConvexPolygon: polygon must be an array");if(a.length<3)return!1;let r=null;for(let e=0;e<a.length;e++){let o=a[e],n=a[(e+1)%a.length];if(!o||o.x==null||o.y==null)throw TypeError(`pointInConvexPolygon: polygon[${e}] must have x and y properties`);if(!n||n.x==null||n.y==null)throw TypeError(`pointInConvexPolygon: polygon[${(e+1)%a.length}] must have x and y properties`);let i=U3(n,o),l=U3(t,o),d=b5(i,l);if(d.abs().lessThan(M3))continue;let p=d.greaterThan(0);if(r===null)r=p;else if(r!==p)return!1}return!0}function C2(t,a){if(!Array.isArray(t))throw TypeError("verifyIntersection: polygonA must be an array");if(!Array.isArray(a))throw TypeError("verifyIntersection: polygonB must be an array");for(let r=0;r<t.length;r++){if(!t[r]||t[r].x==null||t[r].y==null)throw TypeError(`verifyIntersection: polygonA[${r}] must have x and y properties`);if(L0(t[r],a))return!0}for(let r=0;r<a.length;r++){if(!a[r]||a[r].x==null||a[r].y==null)throw TypeError(`verifyIntersection: polygonB[${r}] must have x and y properties`);if(L0(a[r],t))return!0}for(let r=0;r<t.length;r++){let e=t[r],o=t[(r+1)%t.length];if(!e||e.x==null||e.y==null)throw TypeError(`verifyIntersection: polygonA[${r}] must have x and y properties`);if(!o||o.x==null||o.y==null)throw TypeError(`verifyIntersection: polygonA[${(r+1)%t.length}] must have x and y properties`);for(let n=0;n<a.length;n++){let i=a[n],l=a[(n+1)%a.length];if(!i||i.x==null||i.y==null)throw TypeError(`verifyIntersection: polygonB[${n}] must have x and y properties`);if(!l||l.x==null||l.y==null)throw TypeError(`verifyIntersection: polygonB[${(n+1)%a.length}] must have x and y properties`);if(Re(e,o,i,l))return!0}}return!1}function Re(t,a,r,e){if(!t||t.x==null||t.y==null)throw TypeError("segmentsIntersect: a1 must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("segmentsIntersect: a2 must have x and y properties");if(!r||r.x==null||r.y==null)throw TypeError("segmentsIntersect: b1 must have x and y properties");if(!e||e.x==null||e.y==null)throw TypeError("segmentsIntersect: b2 must have x and y properties");let o=U3(a,t),n=U3(e,r),i=b5(o,n);if(i.abs().lessThan(M3)){let g=U3(r,t);if(b5(o,g).abs().lessThan(M3)){let c=J3(o,o);if(c.lessThan(M3)){let x=J3(n,n);if(x.lessThan(M3))return K4(g).lessThan(M3);let D=J3(g,n).div(x);return D.greaterThanOrEqualTo(0)&&D.lessThanOrEqualTo(1)}let m=J3(g,o).div(c),y=U3(e,t),h=J3(y,o).div(c),s=E.min(m,h);return E.max(m,h).greaterThanOrEqualTo(0)&&s.lessThanOrEqualTo(1)}return!1}let l=U3(r,t),d=b5(l,n).div(i),p=b5(l,o).div(i);return d.greaterThanOrEqualTo(0)&&d.lessThanOrEqualTo(1)&&p.greaterThanOrEqualTo(0)&&p.lessThanOrEqualTo(1)}function Ne(t,a){if(!Array.isArray(t))throw TypeError("gjkDistance: polygonA must be an array");if(!Array.isArray(a))throw TypeError("gjkDistance: polygonB must be an array");if(t.length===0)throw TypeError("gjkDistance: polygonA cannot be empty");if(a.length===0)throw TypeError("gjkDistance: polygonB cannot be empty");if(G9(t,a).intersects)return{distance:p4(0),closestA:H5(t),closestB:H5(a),verified:!0};if(!t[0]||t[0].x==null||t[0].y==null)throw TypeError("gjkDistance: polygonA[0] must have x and y properties");if(!a[0]||a[0].x==null||a[0].y==null)throw TypeError("gjkDistance: polygonB[0] must have x and y properties");let r=p4(1/0),e=t[0],o=a[0];for(let i=0;i<t.length;i++){if(!t[i]||t[i].x==null||t[i].y==null)throw TypeError(`gjkDistance: polygonA[${i}] must have x and y properties`);for(let l=0;l<a.length;l++){if(!a[l]||a[l].x==null||a[l].y==null)throw TypeError(`gjkDistance: polygonB[${l}] must have x and y properties`);let d=K4(U3(t[i],a[l]));if(d.lessThan(r))r=d,e=t[i],o=a[l]}}for(let i=0;i<t.length;i++){if(!t[i]||t[i].x==null||t[i].y==null)throw TypeError(`gjkDistance: polygonA[${i}] must have x and y properties`);for(let l=0;l<a.length;l++){let d=a[l],p=a[(l+1)%a.length];if(!d||d.x==null||d.y==null)throw TypeError(`gjkDistance: polygonB[${l}] must have x and y properties`);if(!p||p.x==null||p.y==null)throw TypeError(`gjkDistance: polygonB[${(l+1)%a.length}] must have x and y properties`);let g=O0(t[i],d,p),c=K4(U3(t[i],g));if(c.lessThan(r))r=c,e=t[i],o=g}}for(let i=0;i<a.length;i++){if(!a[i]||a[i].x==null||a[i].y==null)throw TypeError(`gjkDistance: polygonB[${i}] must have x and y properties`);for(let l=0;l<t.length;l++){let d=t[l],p=t[(l+1)%t.length];if(!d||d.x==null||d.y==null)throw TypeError(`gjkDistance: polygonA[${l}] must have x and y properties`);if(!p||p.x==null||p.y==null)throw TypeError(`gjkDistance: polygonA[${(l+1)%t.length}] must have x and y properties`);let g=O0(a[i],d,p),c=K4(U3(a[i],g));if(c.lessThan(r))r=c,e=g,o=a[i]}}let n=K4(U3(e,o)).minus(r).abs().lessThan(M3);return{distance:r,closestA:e,closestB:o,verified:n}}function O0(t,a,r){if(!t||t.x==null||t.y==null)throw TypeError("closestPointOnSegment: pt must have x and y properties");if(!a||a.x==null||a.y==null)throw TypeError("closestPointOnSegment: a must have x and y properties");if(!r||r.x==null||r.y==null)throw TypeError("closestPointOnSegment: b must have x and y properties");let e=U3(r,a),o=U3(t,a),n=n4(e);if(n.lessThan(M3))return a;let i=J3(o,e).div(n);return i=E.max(p4(0),E.min(p4(1),i)),Ce(a,O2(e,i))}function z9(t,a){if(!Array.isArray(t))throw TypeError("polygonsOverlap: polygonA must be an array");if(!Array.isArray(a))throw TypeError("polygonsOverlap: polygonB must be an array");let r=t.map((n,i)=>{if(!n||n.x==null||n.y==null)throw TypeError(`polygonsOverlap: polygonA[${i}] must have x and y properties`);return w4(n.x,n.y)}),e=a.map((n,i)=>{if(!n||n.x==null||n.y==null)throw TypeError(`polygonsOverlap: polygonB[${i}] must have x and y properties`);return w4(n.x,n.y)}),o=G9(r,e);return{overlaps:o.intersects,verified:o.verified}}function we(t,a){if(!Array.isArray(t))throw TypeError("polygonsDistance: polygonA must be an array");if(!Array.isArray(a))throw TypeError("polygonsDistance: polygonB must be an array");let r=t.map((n,i)=>{if(!n||n.x==null||n.y==null)throw TypeError(`polygonsDistance: polygonA[${i}] must have x and y properties`);return w4(n.x,n.y)}),e=a.map((n,i)=>{if(!n||n.x==null||n.y==null)throw TypeError(`polygonsDistance: polygonB[${i}] must have x and y properties`);return w4(n.x,n.y)}),o=Ne(r,e);return{distance:o.distance,closestA:o.closestA,closestB:o.closestB,verified:o.verified}}E.set({precision:80});var Gn=new E("1e-40"),zn=new E("1e-10");E.set({precision:80});var qn=new E("1e-40"),Qn=new E("1e-30");E.set({precision:80});var p3=(t)=>t instanceof E?t:new E(t),Hn=new E("1e-40"),ve=new E("1e-10");function Be(t){if(typeof t!=="string")throw Error("ViewBox must be a string");let a=t.trim().split(/[\s,]+/).filter((r)=>r.length>0);if(a.length!==4)throw Error(`Invalid viewBox format: expected 4 values, got ${a.length}`);try{let r=p3(a[0]),e=p3(a[1]),o=p3(a[2]),n=p3(a[3]);if(o.lessThanOrEqualTo(0)||n.lessThanOrEqualTo(0))throw Error("ViewBox width and height must be positive");let i=`${r.toString()} ${e.toString()} ${o.toString()} ${n.toString()}`,l=a.join(" ");return{x:r,y:e,width:o,height:n,verified:i===l}}catch(r){throw Error(`Invalid viewBox values: ${r.message}`)}}function Xe(t,a,r,e){if(t==null||a==null||r==null||e==null)throw Error("createBBox: all parameters (minX, minY, maxX, maxY) must be provided");let o=p3(t),n=p3(a),i=p3(r),l=p3(e);if(i.lessThan(o))throw Error(`createBBox: maxX (${i}) must be >= minX (${o})`);if(l.lessThan(n))throw Error(`createBBox: maxY (${l}) must be >= minY (${n})`);return{minX:o,minY:n,maxX:i,maxY:l,width:i.minus(o),height:l.minus(n)}}function k0(t,a,r,e,o,n,i,l,d=20){if(t==null||a==null||r==null||e==null||o==null||n==null||i==null||l==null)throw Error("sampleCubicBezier: all coordinate parameters must be provided");if(d==null||d<=0)throw Error("sampleCubicBezier: samples must be a positive number");let p=[];for(let g=0;g<=d;g++){let c=p3(g).div(d),m=p3(1).minus(c),y=c.mul(c),h=y.mul(c),s=m.mul(m),x=s.mul(m),D=x.mul(t).plus(p3(3).mul(s).mul(c).mul(r)).plus(p3(3).mul(m).mul(y).mul(o)).plus(h.mul(i)),S=x.mul(a).plus(p3(3).mul(s).mul(c).mul(e)).plus(p3(3).mul(m).mul(y).mul(n)).plus(h.mul(l));p.push({x:D,y:S})}return p}function Y0(t,a,r,e,o,n,i=20){if(t==null||a==null||r==null||e==null||o==null||n==null)throw Error("sampleQuadraticBezier: all coordinate parameters must be provided");if(i==null||i<=0)throw Error("sampleQuadraticBezier: samples must be a positive number");let l=[];for(let d=0;d<=i;d++){let p=p3(d).div(i),g=p3(1).minus(p),c=g.mul(g),m=p.mul(p),y=c.mul(t).plus(p3(2).mul(g).mul(p).mul(r)).plus(m.mul(o)),h=c.mul(a).plus(p3(2).mul(g).mul(p).mul(e)).plus(m.mul(n));l.push({x:y,y:h})}return l}function Le(t,a,r=ve){if(!t||typeof t!=="object"||t.x==null||t.y==null)throw Error("pointInBBox: pt must be an object with x and y properties");if(!a||typeof a!=="object")throw Error("pointInBBox: bbox must be a bounding box object");if(a.minX==null||a.minY==null||a.maxX==null||a.maxY==null)throw Error("pointInBBox: bbox must have minX, minY, maxX, maxY properties");return t.x.greaterThanOrEqualTo(a.minX.minus(r))&&t.x.lessThanOrEqualTo(a.maxX.plus(r))&&t.y.greaterThanOrEqualTo(a.minY.minus(r))&&t.y.lessThanOrEqualTo(a.maxY.plus(r))}function Oe(t){if(!t||t.length===0)throw Error("pathBoundingBox: path commands array is empty");let a=p3(1/0),r=p3(1/0),e=p3(-1/0),o=p3(-1/0),n=p3(0),i=p3(0),l=p3(0),d=p3(0),p=p3(0),g=p3(0),c=null,m=[];for(let s of t){if(!s||typeof s!=="object"||!s.type||typeof s.type!=="string")throw Error("pathBoundingBox: each command must be an object with a string type property");let x=s.type.toUpperCase(),D=s.type===s.type.toLowerCase();switch(x){case"M":{if(s.x==null||s.y==null)throw Error("pathBoundingBox: M command requires x and y properties");let S=D?n.plus(p3(s.x)):p3(s.x),P=D?i.plus(p3(s.y)):p3(s.y);n=S,i=P,l=n,d=i,a=E.min(a,n),r=E.min(r,i),e=E.max(e,n),o=E.max(o,i),m.push({x:n,y:i}),p=n,g=i,c="M"}break;case"L":{if(s.x==null||s.y==null)throw Error("pathBoundingBox: L command requires x and y properties");let S=D?n.plus(p3(s.x)):p3(s.x),P=D?i.plus(p3(s.y)):p3(s.y);a=E.min(a,S),r=E.min(r,P),e=E.max(e,S),o=E.max(o,P),m.push({x:S,y:P}),n=S,i=P,p=n,g=i,c="L"}break;case"H":{if(s.x==null)throw Error("pathBoundingBox: H command requires x property");let S=D?n.plus(p3(s.x)):p3(s.x);a=E.min(a,S),e=E.max(e,S),m.push({x:S,y:i}),n=S,p=n,g=i,c="H"}break;case"V":{if(s.y==null)throw Error("pathBoundingBox: V command requires y property");let S=D?i.plus(p3(s.y)):p3(s.y);r=E.min(r,S),o=E.max(o,S),m.push({x:n,y:S}),i=S,p=n,g=i,c="V"}break;case"C":{if(s.x1==null||s.y1==null||s.x2==null||s.y2==null||s.x==null||s.y==null)throw Error("pathBoundingBox: C command requires x1, y1, x2, y2, x, y properties");let S=D?n.plus(p3(s.x1)):p3(s.x1),P=D?i.plus(p3(s.y1)):p3(s.y1),T=D?n.plus(p3(s.x2)):p3(s.x2),f=D?i.plus(p3(s.y2)):p3(s.y2),X=D?n.plus(p3(s.x)):p3(s.x),B=D?i.plus(p3(s.y)):p3(s.y),L=k0(n,i,S,P,T,f,X,B,20);for(let R of L)a=E.min(a,R.x),r=E.min(r,R.y),e=E.max(e,R.x),o=E.max(o,R.y),m.push(R);p=T,g=f,n=X,i=B,c="C"}break;case"S":{if(s.x2==null||s.y2==null||s.x==null||s.y==null)throw Error("pathBoundingBox: S command requires x2, y2, x, y properties");let S=D?n.plus(p3(s.x2)):p3(s.x2),P=D?i.plus(p3(s.y2)):p3(s.y2),T=D?n.plus(p3(s.x)):p3(s.x),f=D?i.plus(p3(s.y)):p3(s.y),X,B;if(c==="C"||c==="S")X=n.mul(2).minus(p),B=i.mul(2).minus(g);else X=n,B=i;let L=k0(n,i,X,B,S,P,T,f,20);for(let R of L)a=E.min(a,R.x),r=E.min(r,R.y),e=E.max(e,R.x),o=E.max(o,R.y),m.push(R);p=S,g=P,n=T,i=f,c="S"}break;case"Q":{if(s.x1==null||s.y1==null||s.x==null||s.y==null)throw Error("pathBoundingBox: Q command requires x1, y1, x, y properties");let S=D?n.plus(p3(s.x1)):p3(s.x1),P=D?i.plus(p3(s.y1)):p3(s.y1),T=D?n.plus(p3(s.x)):p3(s.x),f=D?i.plus(p3(s.y)):p3(s.y),X=Y0(n,i,S,P,T,f,20);for(let B of X)a=E.min(a,B.x),r=E.min(r,B.y),e=E.max(e,B.x),o=E.max(o,B.y),m.push(B);p=S,g=P,n=T,i=f,c="Q"}break;case"T":{if(s.x==null||s.y==null)throw Error("pathBoundingBox: T command requires x and y properties");let S=D?n.plus(p3(s.x)):p3(s.x),P=D?i.plus(p3(s.y)):p3(s.y),T,f;if(c==="Q"||c==="T")T=n.mul(2).minus(p),f=i.mul(2).minus(g);else T=n,f=i;let X=Y0(n,i,T,f,S,P,20);for(let B of X)a=E.min(a,B.x),r=E.min(r,B.y),e=E.max(e,B.x),o=E.max(o,B.y),m.push(B);p=T,g=f,n=S,i=P,c="T"}break;case"A":{if(s.x==null||s.y==null||s.rx==null||s.ry==null)throw Error("pathBoundingBox: A command requires x, y, rx, ry properties");let S=D?n.plus(p3(s.x)):p3(s.x),P=D?i.plus(p3(s.y)):p3(s.y),T=p3(s.rx).abs(),f=p3(s.ry).abs();if(T.isZero()||f.isZero())a=E.min(a,n,S),r=E.min(r,i,P),e=E.max(e,n,S),o=E.max(o,i,P),m.push({x:n,y:i},{x:S,y:P});else{a=E.min(a,n,S),r=E.min(r,i,P),e=E.max(e,n,S),o=E.max(o,i,P);let X=n.plus(S).div(2),B=i.plus(P).div(2);a=E.min(a,X.minus(T)),r=E.min(r,B.minus(f)),e=E.max(e,X.plus(T)),o=E.max(o,B.plus(f));let L=20;for(let R=0;R<=L;R++){let N=p3(R).div(L),u=n.plus(S.minus(n).mul(N)),O=i.plus(P.minus(i).mul(N));m.push({x:u,y:O})}}n=S,i=P,p=n,g=i,c="A"}break;case"Z":n=l,i=d,p=n,g=i,c="Z";break;default:throw Error(`pathBoundingBox: unknown path command type: ${x}`)}}if(!a.isFinite()||!r.isFinite()||!e.isFinite()||!o.isFinite())throw Error("Invalid bounding box: no valid coordinates found");let y=Xe(a,r,e,o),h=!0;for(let s of m)if(!Le(s,y)){h=!1;break}return{...y,verified:h}}function M0(t){if(!t||typeof t!=="object")throw Error("bboxToPolygon: bbox must be a bounding box object");if(t.minX==null||t.minY==null||t.maxX==null||t.maxY==null)throw Error("bboxToPolygon: bbox must have minX, minY, maxX, maxY properties");return[w4(t.minX,t.minY),w4(t.maxX,t.minY),w4(t.maxX,t.maxY),w4(t.minX,t.maxY)]}function ke(t,a){if(!a||typeof a!=="object")throw Error("bboxIntersectsViewBox: viewBox must be an object");if(a.x==null||a.y==null||a.width==null||a.height==null)throw Error("bboxIntersectsViewBox: viewBox must have x, y, width, height properties");let r=M0(t),e=M0({minX:a.x,minY:a.y,maxX:a.x.plus(a.width),maxY:a.y.plus(a.height)}),o=z9(r,e);return{intersects:o.overlaps,verified:o.verified}}var H3={ID:"id",CLASS:"class",ATTRIBUTE:"attr",PSEUDO_CLASS:"pseudo-class",PSEUDO_ELEMENT:"pseudo-element",TYPE:"type",UNIVERSAL:"universal"};function Ye(t){if(typeof t!=="string"||!t.trim())throw Error("Selector must be a non-empty string");let a=t.trim(),r=[],e=Me(a);for(let o of e){if(!o.trim())continue;let n=Ve(o.trim());r.push(...n)}return r}function Me(t){if(typeof t!=="string")throw Error("Selector must be a string");let a=[],r="",e=0,o=0,n=!1,i=null;for(let d=0;d<t.length;d++){let p=t[d],g=d>0?t[d-1]:null;if((p==='"'||p==="'")&&g!=="\\"){if(!n)n=!0,i=p;else if(p===i)n=!1,i=null}if(!n){if(p==="["&&g!=="\\")e++;else if(p==="]"&&g!=="\\"){if(e--,e<0)throw Error(`Unbalanced brackets at position ${d}`)}else if(p==="("&&g!=="\\")o++;else if(p===")"&&g!=="\\"){if(o--,o<0)throw Error(`Unbalanced parentheses at position ${d}`)}}if(!n&&e===0&&o===0){if(p===">"||p==="+"||p==="~"){let c=r.trim();if(c)a.push(c);r="";continue}else if(p===" "){let c=r.trim();if(c){a.push(c),r="";continue}else continue}}r+=p}if(n)throw Error("Unclosed quote in selector");if(e!==0)throw Error("Unclosed brackets in selector");if(o!==0)throw Error("Unclosed parentheses in selector");let l=r.trim();if(l)a.push(l);return a}function Ve(t){if(typeof t!=="string")throw Error("Selector must be a string");let a=[],r=0;while(r<t.length){let e=t[r];if(e==="#"){let o=t.slice(r).match(/^#([a-zA-Z_-][\w-]*)/);if(!o)throw Error(`Invalid ID selector at position ${r}`);a.push({type:H3.ID,value:o[1]}),r+=o[0].length}else if(e==="."){let o=t.slice(r).match(/^\.([a-zA-Z_-][\w-]*)/);if(!o)throw Error(`Invalid class selector at position ${r}`);a.push({type:H3.CLASS,value:o[1]}),r+=o[0].length}else if(e==="["){let o=Ue(t,r);if(o===-1)throw Error(`Unclosed attribute selector at position ${r}`);let n=t.slice(r+1,o);a.push({type:H3.ATTRIBUTE,value:n}),r=o+1}else if(e===":")if(r+1<t.length&&t[r+1]===":"){let o=t.slice(r).match(/^::([\w-]+)/);if(!o)throw Error(`Invalid pseudo-element at position ${r}`);a.push({type:H3.PSEUDO_ELEMENT,value:o[1]}),r+=o[0].length}else{let o=t.slice(r).match(/^:([\w-]+)/);if(!o)throw Error(`Invalid pseudo-class at position ${r}`);let n=o[1];if(r+=o[0].length,r<t.length&&t[r]==="("){let l=_e(t,r);if(l===-1)throw Error(`Unclosed pseudo-class function at position ${r}`);n+=t.slice(r,l+1),r=l+1}let i=["before","after","first-line","first-letter"].includes(n);a.push({type:i?H3.PSEUDO_ELEMENT:H3.PSEUDO_CLASS,value:n})}else if(e==="*"){let o=r+1;if(o<t.length&&t[o]==="|"){if(o++,o<t.length&&t[o]==="*")o++}a.push({type:H3.UNIVERSAL,value:"*"}),r=o}else if(/[a-zA-Z]/.test(e)){let o=t.slice(r).match(/^([a-zA-Z][\w-]*)/);if(!o)throw Error(`Invalid type selector at position ${r}`);let n=o[1],i=r+o[0].length;if(i<t.length&&t[i]==="|"){i++;let l=t.slice(i).match(/^([a-zA-Z*][\w-]*)/);if(l)n=l[1],i+=l[0].length}a.push({type:H3.TYPE,value:n}),r=i}else if(e===">"||e==="+"||e==="~"||e===" ")r++;else throw Error(`Unexpected character '${e}' at position ${r}`)}return a}function Ue(t,a){if(typeof t!=="string")throw Error("str must be a string");if(typeof a!=="number"||a<0||a>=t.length)throw Error("startIdx must be a valid index within the string");let r=0,e=!1,o=null;for(let n=a;n<t.length;n++){let i=t[n],l=n>0?t[n-1]:null;if((i==='"'||i==="'")&&l!=="\\"){if(!e)e=!0,o=i;else if(i===o)e=!1,o=null}if(!e){if(i==="["&&l!=="\\")r++;if(i==="]"&&l!=="\\"){if(r--,r===0)return n}}}return-1}function _e(t,a){if(typeof t!=="string")throw Error("str must be a string");if(typeof a!=="number"||a<0||a>=t.length)throw Error("startIdx must be a valid index within the string");let r=0,e=!1,o=null;for(let n=a;n<t.length;n++){let i=t[n],l=n>0?t[n-1]:null;if((i==='"'||i==="'")&&l!=="\\"){if(!e)e=!0,o=i;else if(i===o)e=!1,o=null}if(!e){if(i==="("&&l!=="\\")r++;if(i===")"&&l!=="\\"){if(r--,r===0)return n}}}return-1}function k2(t){let a=typeof t==="string"?Ye(t):t;if(!Array.isArray(a))throw Error("Selector must be a string or an array of components");let r=0,e=0,o=0;for(let n of a){if(!n||typeof n.type!=="string")throw Error("Invalid component: must have a 'type' property");switch(n.type){case H3.ID:r++;break;case H3.CLASS:case H3.ATTRIBUTE:e++;break;case H3.PSEUDO_CLASS:{let i=n.value;if(i.startsWith("where(")&&i.endsWith(")"))break;if((i.startsWith("not(")||i.startsWith("is(")||i.startsWith("has("))&&i.endsWith(")")){let l=i.match(/^(\w+)\(/)[1],d=i.slice(l.length+1,-1);if(d.trim()){let p=Fe(d),g=[0,0,0];for(let c of p)if(c.trim()){let m=k2(c.trim());if(Y2(m,g)>0)g=m}r+=g[0],e+=g[1],o+=g[2]}break}if((i.startsWith("nth-child(")||i.startsWith("nth-last-child("))&&i.endsWith(")")){let l=i.match(/^([\w-]+)\(/)[1],d=i.slice(l.length+1,-1).match(/\s+of\s+(.+)$/);if(d){let p=d[1].trim(),g=k2(p);r+=g[0],e+=g[1],o+=g[2]}e++;break}e++;break}case H3.TYPE:case H3.PSEUDO_ELEMENT:o++;break;case H3.UNIVERSAL:break;default:break}}return[r,e,o]}function Fe(t){if(typeof t!=="string")throw Error("selectorList must be a string");let a=[],r="",e=0,o=0,n=!1,i=null;for(let l=0;l<t.length;l++){let d=t[l],p=l>0?t[l-1]:null;if((d==='"'||d==="'")&&p!=="\\"){if(!n)n=!0,i=d;else if(d===i)n=!1,i=null}if(!n){if(d==="(")e++;if(d===")")e--;if(d==="[")o++;if(d==="]")o--;if(d===","&&e===0&&o===0){a.push(r),r="";continue}}r+=d}if(r)a.push(r);return a}function Y2(t,a){if(!Array.isArray(t)||t.length!==3)throw Error("spec1 must be an array of 3 numbers");if(!Array.isArray(a)||a.length!==3)throw Error("spec2 must be an array of 3 numbers");for(let r=0;r<3;r++){if(typeof t[r]!=="number"||!Number.isFinite(t[r])||t[r]<0)throw Error(`spec1[${r}] must be a non-negative finite number`);if(typeof a[r]!=="number"||!Number.isFinite(a[r])||a[r]<0)throw Error(`spec2[${r}] must be a non-negative finite number`)}for(let r=0;r<3;r++){if(t[r]<a[r])return-1;if(t[r]>a[r])return 1}return 0}var X3=(t)=>t instanceof E?t:new E(t);function H2(){let t=new E(2),a=new E(3);return new E(4).mul(t.sqrt().minus(1)).div(a)}function je(t){if(t==null)throw Error("getKappaForArc: thetaRadians parameter is required");let a=X3(t);if(!a.isFinite())throw Error("getKappaForArc: thetaRadians must be finite");if(a.isZero()||a.isNegative())throw Error("getKappaForArc: thetaRadians must be positive");let r=new E(4),e=new E(3);return r.div(e).mul(E.tan(a.div(r)))}function We(t,a,r,e=8,o=6){if(t==null||a==null||r==null)throw Error("circleToPathDataHP: cx, cy, and r parameters are required");let n=X3(r);if(!n.isFinite()||n.isNegative())throw Error("circleToPathDataHP: radius must be finite and non-negative");if(n.isZero())return"";if(!Number.isFinite(e)||e<=0)throw Error("circleToPathDataHP: arcs must be a positive number");if(!Number.isFinite(o)||o<0)throw Error("circleToPathDataHP: precision must be non-negative");return q9(t,a,r,r,e,o)}function q9(t,a,r,e,o=8,n=6){if(t==null||a==null||r==null||e==null)throw Error("ellipseToPathDataHP: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(o)||o<=0)throw Error("ellipseToPathDataHP: arcs must be a positive number");if(!Number.isFinite(n)||n<0)throw Error("ellipseToPathDataHP: precision must be non-negative");let i=o;if(i%4!==0)i=Math.ceil(i/4)*4;let l=X3(t),d=X3(a),p=X3(r),g=X3(e);if(!p.isFinite()||p.isNegative())throw Error("ellipseToPathDataHP: rx must be finite and non-negative");if(!g.isFinite()||g.isNegative())throw Error("ellipseToPathDataHP: ry must be finite and non-negative");if(p.isZero()||g.isZero())return"";let c=(s)=>a5(s,n),m=E.acos(-1).mul(2).div(i),y=je(m),h=[];for(let s=0;s<i;s++){let x=m.mul(s),D=m.mul(s+1),S=E.cos(x),P=E.sin(x),T=E.cos(D),f=E.sin(D),X=l.plus(p.mul(S)),B=d.plus(g.mul(P)),L=l.plus(p.mul(T)),R=d.plus(g.mul(f)),N=P.neg(),u=S,O=f.neg(),Y=T,j=X.plus(y.mul(p).mul(N)),_=B.plus(y.mul(g).mul(u)),A=L.minus(y.mul(p).mul(O)),W=R.minus(y.mul(g).mul(Y));if(s===0)h.push(`M${c(X)} ${c(B)}`);h.push(`C${c(j)} ${c(_)} ${c(A)} ${c(W)} ${c(L)} ${c(R)}`)}return h.push("Z"),h.join(" ")}function a5(t,a=6){if(t==null)throw Error("formatNumber: value parameter is required");if(!Number.isFinite(a)||a<0)throw Error("formatNumber: precision must be non-negative");let r=X3(t);if(!r.isFinite())throw Error("formatNumber: value must be finite");let e=r.toFixed(a);if(e.includes("."))e=e.replace(/\.?0+$/,"");return e}function Q9(t,a,r,e=6){if(t==null||a==null||r==null)throw Error("circleToPathData: cx, cy, and r parameters are required");if(!Number.isFinite(e)||e<0)throw Error("circleToPathData: precision must be non-negative");let o=X3(t),n=X3(a),i=X3(r);if(!i.isFinite()||i.isNegative())throw Error("circleToPathData: radius must be finite and non-negative");if(i.isZero())return"";let l=H2().mul(i),d=o.plus(i),p=n,g=d,c=p.minus(l),m=o.plus(l),y=n.minus(i),h=o,s=n.minus(i),x=o.minus(l),D=s,S=o.minus(i),P=n.minus(l),T=o.minus(i),f=n,X=T,B=n.plus(l),L=o.minus(l),R=n.plus(i),N=o,u=n.plus(i),O=o.plus(l),Y=u,j=d,_=n.plus(l),A=(W)=>a5(W,e);return`M${A(d)} ${A(p)}C${A(g)} ${A(c)} ${A(m)} ${A(y)} ${A(h)} ${A(s)}C${A(x)} ${A(D)} ${A(S)} ${A(P)} ${A(T)} ${A(f)}C${A(X)} ${A(B)} ${A(L)} ${A(R)} ${A(N)} ${A(u)}C${A(O)} ${A(Y)} ${A(j)} ${A(_)} ${A(d)} ${A(p)}Z`}function H9(t,a,r,e,o=6){if(t==null||a==null||r==null||e==null)throw Error("ellipseToPathData: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(o)||o<0)throw Error("ellipseToPathData: precision must be non-negative");let n=X3(t),i=X3(a),l=X3(r),d=X3(e);if(!l.isFinite()||l.isNegative())throw Error("ellipseToPathData: rx must be finite and non-negative");if(!d.isFinite()||d.isNegative())throw Error("ellipseToPathData: ry must be finite and non-negative");if(l.isZero()||d.isZero())return"";let p=H2(),g=p.mul(l),c=p.mul(d),m=n.plus(l),y=i,h=m,s=y.minus(c),x=n.plus(g),D=i.minus(d),S=n,P=i.minus(d),T=n.minus(g),f=P,X=n.minus(l),B=i.minus(c),L=n.minus(l),R=i,N=L,u=i.plus(c),O=n.minus(g),Y=i.plus(d),j=n,_=i.plus(d),A=n.plus(g),W=_,C=m,z=i.plus(c),o3=(K)=>a5(K,o);return`M${o3(m)} ${o3(y)}C${o3(h)} ${o3(s)} ${o3(x)} ${o3(D)} ${o3(S)} ${o3(P)}C${o3(T)} ${o3(f)} ${o3(X)} ${o3(B)} ${o3(L)} ${o3(R)}C${o3(N)} ${o3(u)} ${o3(O)} ${o3(Y)} ${o3(j)} ${o3(_)}C${o3(A)} ${o3(W)} ${o3(C)} ${o3(z)} ${o3(m)} ${o3(y)}Z`}function K9(t,a,r,e,o=0,n=null,i=!1,l=6){if(t==null||a==null||r==null||e==null)throw Error("rectToPathData: x, y, width, and height parameters are required");if(!Number.isFinite(l)||l<0)throw Error("rectToPathData: precision must be non-negative");let d=X3(t),p=X3(a),g=X3(r),c=X3(e);if(!d.isFinite())throw Error("rectToPathData: x must be finite");if(!p.isFinite())throw Error("rectToPathData: y must be finite");if(!g.isFinite()||g.isNegative())throw Error("rectToPathData: width must be finite and non-negative");if(!c.isFinite()||c.isNegative())throw Error("rectToPathData: height must be finite and non-negative");if(g.isZero()||c.isZero())return"";let m=X3(o||0),y=n!==null?X3(n):m;if(!m.isFinite()||m.isNegative())throw Error("rectToPathData: rx must be finite and non-negative");if(!y.isFinite()||y.isNegative())throw Error("rectToPathData: ry must be finite and non-negative");let h=g.div(2),s=c.div(2);if(m.gt(h))m=h;if(y.gt(s))y=s;let x=(O)=>a5(O,l);if(m.isZero()||y.isZero()){let O=d.plus(g),Y=p.plus(c);return`M${x(d)} ${x(p)}H${x(O)}V${x(Y)}H${x(d)}Z`}let D=d,S=d.plus(g),P=p,T=p.plus(c),f=D.plus(m),X=S.minus(m),B=P.plus(y),L=T.minus(y);if(i)return`M${x(f)} ${x(P)}L${x(X)} ${x(P)}A${x(m)} ${x(y)} 0 0 1 ${x(S)} ${x(B)}L${x(S)} ${x(L)}A${x(m)} ${x(y)} 0 0 1 ${x(X)} ${x(T)}L${x(f)} ${x(T)}A${x(m)} ${x(y)} 0 0 1 ${x(D)} ${x(L)}L${x(D)} ${x(B)}A${x(m)} ${x(y)} 0 0 1 ${x(f)} ${x(P)}Z`;let R=H2(),N=R.mul(m),u=R.mul(y);return`M${x(f)} ${x(P)}L${x(X)} ${x(P)}C${x(X.plus(N))} ${x(P)} ${x(S)} ${x(B.minus(u))} ${x(S)} ${x(B)}L${x(S)} ${x(L)}C${x(S)} ${x(L.plus(u))} ${x(X.plus(N))} ${x(T)} ${x(X)} ${x(T)}L${x(f)} ${x(T)}C${x(f.minus(N))} ${x(T)} ${x(D)} ${x(L.plus(u))} ${x(D)} ${x(L)}L${x(D)} ${x(B)}C${x(D)} ${x(B.minus(u))} ${x(f.minus(N))} ${x(P)} ${x(f)} ${x(P)}Z`}function Z9(t,a,r,e,o=6){if(t==null||a==null||r==null||e==null)throw Error("lineToPathData: x1, y1, x2, and y2 parameters are required");if(!Number.isFinite(o)||o<0)throw Error("lineToPathData: precision must be non-negative");let n=X3(t),i=X3(a),l=X3(r),d=X3(e);if(!n.isFinite()||!i.isFinite()||!l.isFinite()||!d.isFinite())throw Error("lineToPathData: all coordinates must be finite");let p=(g)=>a5(g,o);return`M${p(n)} ${p(i)}L${p(l)} ${p(d)}`}function Ge(t){if(t==null)return[];if(Array.isArray(t))try{return t.map(([n,i])=>[X3(n),X3(i)])}catch(n){return[]}let a=t;if(typeof a==="object"&&a.baseVal!==void 0)a=a.baseVal;if(typeof a!=="string")if(typeof a.toString==="function")a=a.toString();else return[];let r=[],e=a.split(/[\s,]+/).filter((n)=>n.length>0);for(let n of e)try{r.push(X3(n))}catch(i){continue}let o=[];for(let n=0;n<r.length;n+=2)if(n+1<r.length)o.push([r[n],r[n+1]]);return o}function K2(t,a=6){if(!Number.isFinite(a)||a<0)throw Error("polylineToPathData: precision must be non-negative");let r=Ge(t);if(r.length===0)return"";let e=(l)=>a5(l,a),[o,n]=r[0],i=`M${e(o)} ${e(n)}`;for(let l=1;l<r.length;l++){let[d,p]=r[l];i+=`L${e(d)} ${e(p)}`}return i}function J9(t,a=6){if(!Number.isFinite(a)||a<0)throw Error("polygonToPathData: precision must be non-negative");let r=K2(t,a);return r?r+" Z":""}var ze={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function g2(t){if(t==null)throw Error("parsePathData: pathData parameter is required");if(typeof t!=="string")throw Error("parsePathData: pathData must be a string");let a=[],r=/([MmLlHhVvCcSsQqTtAaZz])\s*([^MmLlHhVvCcSsQqTtAaZz]*)/g,e;while((e=r.exec(t))!==null){let o=e[1],n=e[2].trim(),i=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,l=[];if(n.length>0)for(let p of n.matchAll(i))try{l.push(X3(p[0]))}catch(g){continue}let d=ze[o];if(d===0||l.length===0)a.push({command:o,args:[]});else for(let p=0;p<l.length;p+=d){let g=l.slice(p,p+d);if(g.length===d){let c=o;if(p>0&&(o==="M"||o==="m"))c=o==="M"?"L":"l";a.push({command:c,args:g})}}}return a}function $9(t,a=6){if(t==null)throw Error("pathArrayToString: commands parameter is required");if(!Array.isArray(t))throw Error("pathArrayToString: commands must be an array");if(!Number.isFinite(a)||a<0)throw Error("pathArrayToString: precision must be non-negative");return t.map((r)=>{if(!r||typeof r.command!=="string"||!Array.isArray(r.args))throw Error("pathArrayToString: each command must have 'command' (string) and 'args' (array) properties");let{command:e,args:o}=r,n=o.map((i)=>a5(i,a)).join(" ");return n.length>0?`${e} ${n}`:e}).join(" ")}function qe(t){if(t==null)throw Error("pathToAbsolute: pathData parameter is required");let a=g2(t),r=[],e=new E(0),o=new E(0),n=new E(0),i=new E(0),l=new E(0),d=new E(0),p="";for(let{command:g,args:c}of a){let m=g===g.toLowerCase(),y=g.toUpperCase();if(y==="M"){if(c.length<2)continue;let h=m?e.plus(c[0]):c[0],s=m?o.plus(c[1]):c[1];e=h,o=s,n=h,i=s,r.push({command:"M",args:[h,s]}),p="M"}else if(y==="L"){if(c.length<2)continue;let h=m?e.plus(c[0]):c[0],s=m?o.plus(c[1]):c[1];e=h,o=s,r.push({command:"L",args:[h,s]}),p="L"}else if(y==="H"){if(c.length<1)continue;let h=m?e.plus(c[0]):c[0];e=h,r.push({command:"L",args:[h,o]}),p="H"}else if(y==="V"){if(c.length<1)continue;let h=m?o.plus(c[0]):c[0];o=h,r.push({command:"L",args:[e,h]}),p="V"}else if(y==="C"){if(c.length<6)continue;let h=m?e.plus(c[0]):c[0],s=m?o.plus(c[1]):c[1],x=m?e.plus(c[2]):c[2],D=m?o.plus(c[3]):c[3],S=m?e.plus(c[4]):c[4],P=m?o.plus(c[5]):c[5];l=x,d=D,e=S,o=P,r.push({command:"C",args:[h,s,x,D,S,P]}),p="C"}else if(y==="S"){if(c.length<4)continue;let h,s;if(p==="C"||p==="S")h=e.mul(2).minus(l),s=o.mul(2).minus(d);else h=e,s=o;let x=m?e.plus(c[0]):c[0],D=m?o.plus(c[1]):c[1],S=m?e.plus(c[2]):c[2],P=m?o.plus(c[3]):c[3];l=x,d=D,e=S,o=P,r.push({command:"C",args:[h,s,x,D,S,P]}),p="S"}else if(y==="Q"){if(c.length<4)continue;let h=m?e.plus(c[0]):c[0],s=m?o.plus(c[1]):c[1],x=m?e.plus(c[2]):c[2],D=m?o.plus(c[3]):c[3];l=h,d=s,e=x,o=D,r.push({command:"Q",args:[h,s,x,D]}),p="Q"}else if(y==="T"){if(c.length<2)continue;let h,s;if(p==="Q"||p==="T")h=e.mul(2).minus(l),s=o.mul(2).minus(d);else h=e,s=o;let x=m?e.plus(c[0]):c[0],D=m?o.plus(c[1]):c[1];l=h,d=s,e=x,o=D,r.push({command:"Q",args:[h,s,x,D]}),p="T"}else if(y==="A"){if(c.length<7)continue;let h=m?e.plus(c[5]):c[5],s=m?o.plus(c[6]):c[6];e=h,o=s,r.push({command:"A",args:[c[0],c[1],c[2],c[3],c[4],h,s]}),p="A"}else if(y==="Z")e=n,o=i,r.push({command:"Z",args:[]}),p="Z";else r.push({command:g,args:c}),p=g}return $9(r)}function Qe(t,a=6){if(t==null)throw Error("convertElementToPath: element parameter is required");if(!Number.isFinite(a)||a<0)throw Error("convertElementToPath: precision must be non-negative");let r=(o,n=0)=>{let i=t.getAttribute?t.getAttribute(o):t[o];return He(i!==void 0&&i!==null?i:n)},e=(t.tagName||t.type||"").toLowerCase();if(e==="circle")return Q9(r("cx",0),r("cy",0),r("r",0),a);else if(e==="ellipse")return H9(r("cx",0),r("cy",0),r("rx",0),r("ry",0),a);else if(e==="rect")return K9(r("x",0),r("y",0),r("width",0),r("height",0),r("rx",0),r("ry",null),!1,a);else if(e==="line")return Z9(r("x1",0),r("y1",0),r("x2",0),r("y2",0),a);else if(e==="polyline")return K2(r("points",""),a);else if(e==="polygon")return J9(r("points",""),a);return null}function He(t){if(t==null)return 0;if(typeof t==="string"){let r=parseFloat(t);return isNaN(r)?0:r}if(typeof t==="number")return isNaN(t)?0:t;if(t instanceof E)return t.toNumber();let a=Number(t);return isNaN(a)?0:a}var h4=(t)=>{if(t instanceof E){if(!t.isFinite())throw Error(`Value must be finite (got ${t.toString()})`);return t}try{let a=new E(t);if(!a.isFinite())throw Error(`Value must be finite (got ${t})`);return a}catch(a){throw Error(`Invalid numeric value: "${t}" (${a.message})`)}};function y4(t,a){if(t===void 0||t===null)throw Error(`${a} is required`);if(typeof t!=="number"&&typeof t!=="string"&&!(t instanceof E))throw Error(`${a} must be a number, string, or Decimal`);if(typeof t==="number"&&!isFinite(t))throw Error(`${a} must be a finite number (got ${t})`);if(t instanceof E&&!t.isFinite())throw Error(`${a} must be a finite Decimal (got ${t.toString()})`)}function s4(t,a){return y4(t,"tx"),y4(a,"ty"),P3.from([[new E(1),new E(0),h4(t)],[new E(0),new E(1),h4(a)],[new E(0),new E(0),new E(1)]])}function p5(t,a=null){if(y4(t,"sx"),a!==null)y4(a,"sy");let r=a===null?t:a,e=h4(t),o=h4(r);if(e.isZero()||o.isZero())throw Error("Scale factors cannot be zero (creates singular matrix)");return P3.from([[e,new E(0),new E(0)],[new E(0),o,new E(0)],[new E(0),new E(0),new E(1)]])}function K5(t){y4(t,"theta");let a=h4(t).toNumber(),r=Math.PI,e=a-2*r*Math.floor((a+r)/(2*r));if(!isFinite(e))throw Error(`Angle normalization failed for theta=${t} (too large or invalid)`);let o=new E(Math.cos(e)),n=new E(Math.sin(e));if(!o.isFinite()||!n.isFinite())throw Error(`Trigonometric computation failed for theta=${t} (produced non-finite values)`);return P3.from([[o,n.negated(),new E(0)],[n,o,new E(0)],[new E(0),new E(0),new E(1)]])}function Ke(t,a,r){y4(t,"theta"),y4(a,"px"),y4(r,"py");let e=h4(a),o=h4(r);return s4(e,o).mul(K5(t)).mul(s4(e.negated(),o.negated()))}function V0(t,a){y4(t,"ax"),y4(a,"ay");let r=h4(t),e=h4(a);if(new E(1).minus(r.mul(e)).lessThanOrEqualTo(0))throw Error(`Skew parameters create singular or orientation-inverting matrix (ax*ay = ${r.mul(e).toString()}, must be < 1)`);return P3.from([[new E(1),r,new E(0)],[e,new E(1),new E(0)],[new E(0),new E(0),new E(1)]])}function l4(t,a,r){if(!t||typeof t.mul!=="function")throw Error("applyTransform: first argument must be a Matrix");if(!t.data||!Array.isArray(t.data)||t.data.length!==3||!t.data[0]||t.data[0].length!==3||!t.data[1]||t.data[1].length!==3||!t.data[2]||t.data[2].length!==3)throw Error("applyTransform: matrix must be 3x3");y4(a,"x"),y4(r,"y");let e=P3.from([[h4(a)],[h4(r)],[new E(1)]]),o=t.mul(e);if(!o||!o.data||!Array.isArray(o.data)||o.data.length!==3||!o.data[0]||!o.data[0][0]||!o.data[1]||!o.data[1][0]||!o.data[2]||!o.data[2][0])throw Error("applyTransform: matrix multiplication produced invalid result");let n=o.data[0][0],i=o.data[1][0],l=o.data[2][0];if(l.isZero())throw Error("applyTransform: perspective division by zero (invalid transformation matrix)");return[n.div(l),i.div(l)]}E.set({precision:80});function Ze(t,a,r){return t6(t,a,r,r)}function t6(t,a,r,e){let o=(T)=>new E(T),n=o(t),i=o(a),l=o(r),d=o(e);if(!l.isFinite()||!d.isFinite()||!n.isFinite()||!i.isFinite())throw Error("Ellipse parameters must be finite");if(l.eq(0)||d.eq(0))return console.warn("Degenerate ellipse with zero radius, returning empty path"),"";if(l.lt(0)||d.lt(0))throw Error("Ellipse radii must be non-negative");let p=o("0.5522847498307936"),g=l.mul(p),c=d.mul(p),m=n.plus(l),y=i,h=n,s=i.minus(d),x=n.minus(l),D=i,S=n,P=i.plus(d);return[`M ${m.toFixed(6)} ${y.toFixed(6)}`,`C ${m.toFixed(6)} ${y.minus(c).toFixed(6)} ${h.plus(g).toFixed(6)} ${s.toFixed(6)} ${h.toFixed(6)} ${s.toFixed(6)}`,`C ${h.minus(g).toFixed(6)} ${s.toFixed(6)} ${x.toFixed(6)} ${D.minus(c).toFixed(6)} ${x.toFixed(6)} ${D.toFixed(6)}`,`C ${x.toFixed(6)} ${D.plus(c).toFixed(6)} ${S.minus(g).toFixed(6)} ${P.toFixed(6)} ${S.toFixed(6)} ${P.toFixed(6)}`,`C ${S.plus(g).toFixed(6)} ${P.toFixed(6)} ${m.toFixed(6)} ${y.plus(c).toFixed(6)} ${m.toFixed(6)} ${y.toFixed(6)}`,"Z"].join(" ")}function Je(t,a,r,e,o=0,n=null){let i=(s)=>new E(s),l=i(t),d=i(a),p=i(r),g=i(e);if(p.lte(0)||g.lte(0))throw Error("Rectangle dimensions must be positive");if(!p.isFinite()||!g.isFinite()||!l.isFinite()||!d.isFinite())throw Error("Rectangle parameters must be finite");let c=i(o),m=n!==null?i(n):c;if(c.lt(0)||m.lt(0))throw Error("Rectangle corner radii must be non-negative");let y=p.div(2),h=g.div(2);if(c.gt(y))c=y;if(m.gt(h))m=h;if(!(c.gt(0)||m.gt(0)))return[`M ${l.toFixed(6)} ${d.toFixed(6)}`,`L ${l.plus(p).toFixed(6)} ${d.toFixed(6)}`,`L ${l.plus(p).toFixed(6)} ${d.plus(g).toFixed(6)}`,`L ${l.toFixed(6)} ${d.plus(g).toFixed(6)}`,"Z"].join(" ");return[`M ${l.plus(c).toFixed(6)} ${d.toFixed(6)}`,`L ${l.plus(p).minus(c).toFixed(6)} ${d.toFixed(6)}`,`A ${c.toFixed(6)} ${m.toFixed(6)} 0 0 1 ${l.plus(p).toFixed(6)} ${d.plus(m).toFixed(6)}`,`L ${l.plus(p).toFixed(6)} ${d.plus(g).minus(m).toFixed(6)}`,`A ${c.toFixed(6)} ${m.toFixed(6)} 0 0 1 ${l.plus(p).minus(c).toFixed(6)} ${d.plus(g).toFixed(6)}`,`L ${l.plus(c).toFixed(6)} ${d.plus(g).toFixed(6)}`,`A ${c.toFixed(6)} ${m.toFixed(6)} 0 0 1 ${l.toFixed(6)} ${d.plus(g).minus(m).toFixed(6)}`,`L ${l.toFixed(6)} ${d.plus(m).toFixed(6)}`,`A ${c.toFixed(6)} ${m.toFixed(6)} 0 0 1 ${l.plus(c).toFixed(6)} ${d.toFixed(6)}`].join(" ")}function $e(t,a,r,e){let o=(p)=>new E(p),n=o(t),i=o(a),l=o(r),d=o(e);if(!n.isFinite()||!i.isFinite()||!l.isFinite()||!d.isFinite())throw Error("lineToPath: all parameters must be finite");return`M ${n.toFixed(6)} ${i.toFixed(6)} L ${l.toFixed(6)} ${d.toFixed(6)}`}function tr(t){let a=a6(t);if(a.length===0)return"";let r=`M ${a[0][0]} ${a[0][1]}`;for(let e=1;e<a.length;e++)r+=` L ${a[e][0]} ${a[e][1]}`;return r+" Z"}function ar(t){let a=a6(t);if(a.length===0)return"";let r=`M ${a[0][0]} ${a[0][1]}`;for(let e=1;e<a.length;e++)r+=` L ${a[e][0]} ${a[e][1]}`;return r}function a6(t){if(!t)return[];let a;try{if(Array.isArray(t))a=t.flat().map((e)=>new E(e).toFixed(6));else if(typeof t==="string")a=t.trim().split(/[\s,]+/).filter((e)=>e.length>0).map((e)=>new E(e).toFixed(6));else return console.warn("parsePointPairs: invalid input type"),[]}catch(e){return console.warn(`parsePointPairs: parse error - ${e.message}`),[]}if(a.length%2!==0)console.warn("parsePointPairs: odd number of coordinates, ignoring last value"),a=a.slice(0,-1);let r=[];for(let e=0;e+1<a.length;e+=2)r.push([a[e],a[e+1]]);return r}function er(t,a,r,e,o,n,i,l){let d=(i3)=>new E(i3),p=d("1e-16");if(!l||!l.data||!Array.isArray(l.data)||l.data.length<3)throw Error("transformArc: invalid matrix");let g=d(t),c=d(a);if(g.lte(0)||c.lte(0))return console.warn("transformArc: radii must be positive, returning degenerate arc"),{rx:0,ry:0,xAxisRotation:0,largeArcFlag:e,sweepFlag:o,x:d(n).toNumber(),y:d(i).toNumber()};let m=e;if(typeof m!=="number"||m!==0&&m!==1)console.warn(`transformArc: largeArcFlag must be 0 or 1, got ${e}`),m=m?1:0;let y=o;if(typeof y!=="number"||y!==0&&y!==1)console.warn(`transformArc: sweepFlag must be 0 or 1, got ${o}`),y=y?1:0;let h=l.data[0][0],s=l.data[1][0],x=l.data[0][1],D=l.data[1][1],S=l.data[0][2],P=l.data[1][2],T=d(n),f=d(i),X=h.mul(T).plus(x.mul(f)).plus(S),B=s.mul(T).plus(D.mul(f)).plus(P),L=d(r).mul(d(Math.PI)).div(180),R=E.sin(L),N=E.cos(L),u=h.mul(g).mul(N).plus(x.mul(g).mul(R)),O=s.mul(g).mul(N).plus(D.mul(g).mul(R)),Y=h.mul(c.neg()).mul(R).plus(x.mul(c).mul(N)),j=s.mul(c.neg()).mul(R).plus(D.mul(c).mul(N)),_=u.mul(u).plus(Y.mul(Y)),A=O.mul(O).plus(j.mul(j)),W=u.mul(O).plus(Y.mul(j)).mul(2),C=_.minus(A),z,o3,K;if(W.abs().lt(p))z=d(0),o3=_,K=A;else if(C.abs().lt(p))o3=_.plus(W.mul("0.5")),K=_.minus(W.mul("0.5")),z=d(Math.PI).div(4);else{let i3=d(1).plus(W.mul(W).div(C.mul(C))).sqrt();o3=_.plus(A).plus(i3.mul(C)).div(2),K=_.plus(A).minus(i3.mul(C)).div(2),z=E.atan(W.div(C)).div(2)}if(o3.lt(0))o3=d(0);if(K.lt(0))K=d(0);let $=o3.sqrt(),w=K.sqrt();if(C.lte(0)){let i3=$;$=w,w=i3}if(w.gt($)){let i3=$;$=w,w=i3,z=z.plus(d(Math.PI).div(2))}let F=h.mul(D).minus(s.mul(x)),a3=y;if(F.lt(0))a3=y?0:1;let e3=z.mul(180).div(d(Math.PI));while(e3.lt(0))e3=e3.plus(180);while(e3.gte(180))e3=e3.minus(180);return{rx:$.toNumber(),ry:w.toNumber(),xAxisRotation:e3.toNumber(),largeArcFlag:m,sweepFlag:a3,x:X.toNumber(),y:B.toNumber()}}function rr(t,a){if(!t||typeof t!=="string")return console.warn("parseTransformFunction: invalid function name"),P3.identity(3);if(!a||!Array.isArray(a))return console.warn("parseTransformFunction: invalid arguments array"),P3.identity(3);let r=(e)=>new E(e);switch(t.toLowerCase()){case"translate":{let e=a[0]!==void 0?a[0]:0,o=a[1]!==void 0?a[1]:0;return s4(e,o)}case"scale":{let e=a[0]!==void 0?a[0]:1,o=a[1]!==void 0?a[1]:e;return p5(e,o)}case"rotate":{let e=a[0]!==void 0?a[0]:0,o=r(e).mul(r(Math.PI)).div(180);if(a.length>=3){if(a[1]===void 0||a[2]===void 0||!isFinite(a[1])||!isFinite(a[2]))return console.warn("parseTransformFunction: rotate(angle, cx, cy) has invalid cx or cy, using origin rotation"),K5(o);let n=a[1],i=a[2];return Ke(o,n,i)}return K5(o)}case"skewx":{let e=a[0]!==void 0?a[0]:0,o=r(e).mul(r(Math.PI)).div(180),n=E.tan(o);return V0(n,0)}case"skewy":{let e=a[0]!==void 0?a[0]:0,o=r(e).mul(r(Math.PI)).div(180),n=E.tan(o);return V0(0,n)}case"matrix":{if(a.length<6)return console.warn(`parseTransformFunction: matrix() requires 6 arguments, got ${a.length}`),P3.identity(3);let[e,o,n,i,l,d]=a.slice(0,6).map((p)=>r(p!==void 0?p:0));return P3.from([[e,n,l],[o,i,d],[r(0),r(0),r(1)]])}default:return console.warn(`Unknown transform function: ${t}`),P3.identity(3)}}function B4(t){if(!t||t.trim()==="")return P3.identity(3);let a=/(\w+)\s*\(([^)]*)\)/g,r,e=P3.identity(3);while((r=a.exec(t))!==null){let o=r[1],n=r[2].split(/[\s,]+/).filter((l)=>l.length>0).map((l)=>{let d=parseFloat(l);if(isNaN(d))return console.warn(`parseTransformAttribute: invalid numeric argument "${l}" in ${o}(), using 0`),0;return d}),i=rr(o,n);e=e.mul(i)}return e}function g4(t,a,r){if(!t||!t.data||!Array.isArray(t.data))throw Error("applyToPoint: invalid CTM matrix");let e=(i)=>new E(i);try{let i=e(a),l=e(r);if(!i.isFinite()||!l.isFinite())throw Error("applyToPoint: coordinates must be finite")}catch(i){throw Error(`applyToPoint: invalid coordinates - ${i.message}`)}let[o,n]=l4(t,a,r);return{x:o,y:n}}function or(t,a=6){if(!t||!t.data||!Array.isArray(t.data)||t.data.length<3||!Array.isArray(t.data[0])||!Array.isArray(t.data[1])||t.data[0].length<3||t.data[1].length<3)throw Error("toSVGMatrix: invalid CTM matrix structure");let r=a;if(typeof r!=="number"||r<0||r>20)console.warn("toSVGMatrix: invalid precision, using default 6"),r=6;try{let e=t.data[0][0].toFixed(r),o=t.data[1][0].toFixed(r),n=t.data[0][1].toFixed(r),i=t.data[1][1].toFixed(r),l=t.data[0][2].toFixed(r),d=t.data[1][2].toFixed(r);return`matrix(${e}, ${o}, ${n}, ${i}, ${l}, ${d})`}catch(e){throw Error(`toSVGMatrix: invalid matrix elements - ${e.message}`)}}function Z5(t,a,r={}){if(!t||typeof t!=="string")return console.warn("transformPathData: invalid pathData (must be string)"),"";if(!a||!a.data)return console.warn("transformPathData: invalid CTM matrix"),t;let{toAbsolute:e=!0,precision:o=6}=r,n=o;if(typeof n!=="number"||n<0||n>20||!isFinite(n))console.warn("transformPathData: invalid precision, using default 6"),n=6;let i=(y)=>new E(y),l=nr(t);if(l.length===0)return"";let d=[],p=i(0),g=i(0),c=i(0),m=i(0);for(let{cmd:y,args:h}of l){let s=y===y.toLowerCase();switch(y.toUpperCase()){case"M":{let x=[];if(h.length%2!==0)console.warn(`transformPathData: M command has ${h.length} args, expected multiple of 2`);for(let D=0;D+1<h.length;D+=2){let S=i(h[D]),P=i(h[D+1]);if(s)S=S.plus(p),P=P.plus(g);let T=g4(a,S,P);if(x.push(T.x.toFixed(n),T.y.toFixed(n)),p=S,g=P,D===0)c=S,m=P}d.push((e?"M":y)+" "+x.join(" "));break}case"L":{let x=[];if(h.length%2!==0)console.warn(`transformPathData: L command has ${h.length} args, expected multiple of 2`);for(let D=0;D+1<h.length;D+=2){let S=i(h[D]),P=i(h[D+1]);if(s)S=S.plus(p),P=P.plus(g);let T=g4(a,S,P);x.push(T.x.toFixed(n),T.y.toFixed(n)),p=S,g=P}d.push((e?"L":y)+" "+x.join(" "));break}case"H":{if(h.length<1){console.warn("transformPathData: H command requires at least 1 argument");break}for(let x=0;x<h.length;x++){let D=i(h[x]);if(s)D=D.plus(p);let S=g4(a,D,g);d.push("L "+S.x.toFixed(n)+" "+S.y.toFixed(n)),p=D}break}case"V":{if(h.length<1){console.warn("transformPathData: V command requires at least 1 argument");break}for(let x=0;x<h.length;x++){let D=p,S=i(h[x]);if(s)S=S.plus(g);let P=g4(a,D,S);d.push("L "+P.x.toFixed(n)+" "+P.y.toFixed(n)),g=S}break}case"C":{let x=[];if(h.length%6!==0)console.warn(`transformPathData: C command has ${h.length} args, expected multiple of 6`);for(let D=0;D+5<h.length;D+=6){let S=i(h[D]),P=i(h[D+1]),T=i(h[D+2]),f=i(h[D+3]),X=i(h[D+4]),B=i(h[D+5]);if(s)S=S.plus(p),P=P.plus(g),T=T.plus(p),f=f.plus(g),X=X.plus(p),B=B.plus(g);let L=g4(a,S,P),R=g4(a,T,f),N=g4(a,X,B);x.push(L.x.toFixed(n),L.y.toFixed(n),R.x.toFixed(n),R.y.toFixed(n),N.x.toFixed(n),N.y.toFixed(n)),p=X,g=B}d.push((e?"C":y)+" "+x.join(" "));break}case"S":{let x=[];if(h.length%4!==0)console.warn(`transformPathData: S command has ${h.length} args, expected multiple of 4`);for(let D=0;D+3<h.length;D+=4){let S=i(h[D]),P=i(h[D+1]),T=i(h[D+2]),f=i(h[D+3]);if(s)S=S.plus(p),P=P.plus(g),T=T.plus(p),f=f.plus(g);let X=g4(a,S,P),B=g4(a,T,f);x.push(X.x.toFixed(n),X.y.toFixed(n),B.x.toFixed(n),B.y.toFixed(n)),p=T,g=f}d.push((e?"S":y)+" "+x.join(" "));break}case"Q":{let x=[];if(h.length%4!==0)console.warn(`transformPathData: Q command has ${h.length} args, expected multiple of 4`);for(let D=0;D+3<h.length;D+=4){let S=i(h[D]),P=i(h[D+1]),T=i(h[D+2]),f=i(h[D+3]);if(s)S=S.plus(p),P=P.plus(g),T=T.plus(p),f=f.plus(g);let X=g4(a,S,P),B=g4(a,T,f);x.push(X.x.toFixed(n),X.y.toFixed(n),B.x.toFixed(n),B.y.toFixed(n)),p=T,g=f}d.push((e?"Q":y)+" "+x.join(" "));break}case"T":{let x=[];if(h.length%2!==0)console.warn(`transformPathData: T command has ${h.length} args, expected multiple of 2`);for(let D=0;D+1<h.length;D+=2){let S=i(h[D]),P=i(h[D+1]);if(s)S=S.plus(p),P=P.plus(g);let T=g4(a,S,P);x.push(T.x.toFixed(n),T.y.toFixed(n)),p=S,g=P}d.push((e?"T":y)+" "+x.join(" "));break}case"A":{let x=[];if(h.length%7!==0)console.warn(`transformPathData: Arc command has ${h.length} args, expected multiple of 7`);for(let D=0;D+6<h.length;D+=7){let S=h[D],P=h[D+1],T=h[D+2],f=h[D+3],X=h[D+4],B=i(h[D+5]),L=i(h[D+6]);if(s)B=B.plus(p),L=L.plus(g);let R=er(S,P,T,f,X,B.toNumber(),L.toNumber(),a);x.push(R.rx.toFixed(n),R.ry.toFixed(n),R.xAxisRotation.toFixed(n),R.largeArcFlag,R.sweepFlag,R.x.toFixed(n),R.y.toFixed(n)),p=B,g=L}d.push((e?"A":y)+" "+x.join(" "));break}case"Z":{d.push("Z"),p=c,g=m;break}default:d.push(y+" "+h.join(" "))}}return d.join(" ")}function nr(t){if(!t||typeof t!=="string")return[];let a=[],r=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,e;while((e=r.exec(t))!==null){let o=e[1],n=e[2].trim(),i=n.length>0?n.split(/[\s,]+/).filter((l)=>l.length>0).map((l)=>{let d=parseFloat(l);if(isNaN(d))return console.warn(`parsePathCommands: invalid number '${l}'`),0;return d}):[];a.push({cmd:o,args:i})}return a}var Z2={};z2(Z2,{sign:()=>J2,segmentIntersection:()=>c2,reversePolygon:()=>e0,polygonUnion:()=>y2,polygonIntersection:()=>J5,polygonDifference:()=>n6,polygonArea:()=>u5,pointsEqual:()=>F4,pointOnSegment:()=>$2,pointInPolygon:()=>x4,point:()=>v3,lineSegmentIntersection:()=>r6,isCounterClockwise:()=>a0,isConvex:()=>o0,ensureCCW:()=>m2,dot:()=>e6,default:()=>gr,cross:()=>X4,convexHull:()=>r0,clipPolygonSH:()=>t0,boundingBox:()=>j4,bboxIntersects:()=>w5});E.set({precision:80});var c4=(t)=>t instanceof E?t:new E(t),i4=new E("1e-40");function v3(t,a){if(t===null||t===void 0)throw Error("point: x coordinate is required");if(a===null||a===void 0)throw Error("point: y coordinate is required");return{x:c4(t),y:c4(a)}}function F4(t,a,r=i4){if(!t||typeof t!=="object"||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("pointsEqual: p1 must be a point with x and y properties");if(!a||typeof a!=="object"||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("pointsEqual: p2 must be a point with x and y properties");if(!r||typeof r.abs!=="function")throw Error("pointsEqual: tolerance must be a Decimal instance");return t.x.minus(a.x).abs().lt(r)&&t.y.minus(a.y).abs().lt(r)}function X4(t,a,r){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("cross: origin point o must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("cross: point a must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("cross: point b must have x and y properties");let e=a.x.minus(t.x),o=a.y.minus(t.y),n=r.x.minus(t.x),i=r.y.minus(t.y);return e.mul(i).minus(o.mul(n))}function e6(t,a,r){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("dot: origin point o must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("dot: point a must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("dot: point b must have x and y properties");let e=a.x.minus(t.x),o=a.y.minus(t.y),n=r.x.minus(t.x),i=r.y.minus(t.y);return e.mul(n).plus(o.mul(i))}function J2(t){if(t===null||t===void 0||typeof t.abs!=="function")throw Error("sign: val must be a Decimal instance");if(t.abs().lt(i4))return 0;return t.lt(0)?-1:1}function c2(t,a,r,e){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("segmentIntersection: point a must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("segmentIntersection: point b must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("segmentIntersection: point c must have x and y properties");if(!e||e.x===null||e.x===void 0||e.y===null||e.y===void 0)throw Error("segmentIntersection: point d must have x and y properties");let o=a.x.minus(t.x),n=a.y.minus(t.y),i=e.x.minus(r.x),l=e.y.minus(r.y),d=o.mul(l).minus(n.mul(i));if(d.abs().lt(i4))return null;let p=r.x.minus(t.x),g=r.y.minus(t.y),c=p.mul(l).minus(g.mul(i)).div(d),m=p.mul(n).minus(g.mul(o)).div(d),y=c4(0),h=c4(1);if(c.gte(y)&&c.lte(h)&&m.gte(y)&&m.lte(h))return{x:t.x.plus(o.mul(c)),y:t.y.plus(n.mul(c)),t:c,s:m};return null}function r6(t,a,r,e){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("lineSegmentIntersection: lineA must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("lineSegmentIntersection: lineB must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("lineSegmentIntersection: segA must have x and y properties");if(!e||e.x===null||e.x===void 0||e.y===null||e.y===void 0)throw Error("lineSegmentIntersection: segB must have x and y properties");let o=a.x.minus(t.x),n=a.y.minus(t.y),i=e.x.minus(r.x),l=e.y.minus(r.y),d=o.mul(l).minus(n.mul(i));if(d.abs().lt(i4))return null;let p=r.x.minus(t.x),g=r.y.minus(t.y),c=p.mul(n).minus(g.mul(o)).div(d);if(c.gte(0)&&c.lte(1))return{x:r.x.plus(i.mul(c)),y:r.y.plus(l.mul(c)),s:c};return null}function x4(t,a){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("pointInPolygon: pt must have x and y properties");if(!Array.isArray(a))throw Error("pointInPolygon: polygon must be an array");let r=a.length;if(r<3)return-1;for(let o=0;o<r;o++)if(!a[o]||a[o].x===null||a[o].x===void 0||a[o].y===null||a[o].y===void 0)throw Error(`pointInPolygon: polygon[${o}] must have x and y properties`);let e=0;for(let o=0;o<r;o++){let n=a[o],i=a[(o+1)%r];if($2(t,n,i))return 0;if(n.y.lte(t.y)){if(i.y.gt(t.y)){if(X4(n,i,t).gt(0))e++}}else if(i.y.lte(t.y)){if(X4(n,i,t).lt(0))e--}}return e!==0?1:-1}function $2(t,a,r){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("pointOnSegment: pt must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("pointOnSegment: segment point a must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("pointOnSegment: segment point b must have x and y properties");if(X4(a,r,t).abs().gt(i4))return!1;let e=E.min(a.x,r.x),o=E.max(a.x,r.x),n=E.min(a.y,r.y),i=E.max(a.y,r.y);return t.x.gte(e.minus(i4))&&t.x.lte(o.plus(i4))&&t.y.gte(n.minus(i4))&&t.y.lte(i.plus(i4))}function t0(t,a){if(!Array.isArray(t))throw Error("clipPolygonSH: subject must be an array");if(!Array.isArray(a))throw Error("clipPolygonSH: clip must be an array");if(t.length<3||a.length<3)return[];for(let o=0;o<t.length;o++)if(!t[o]||t[o].x===null||t[o].x===void 0||t[o].y===null||t[o].y===void 0)throw Error(`clipPolygonSH: subject[${o}] must have x and y properties`);for(let o=0;o<a.length;o++)if(!a[o]||a[o].x===null||a[o].x===void 0||a[o].y===null||a[o].y===void 0)throw Error(`clipPolygonSH: clip[${o}] must have x and y properties`);let r=t.map((o)=>v3(o.x,o.y)),e=a.map((o)=>v3(o.x,o.y));e=m2(e);for(let o=0;o<e.length;o++){if(r.length===0)return[];let n=e[o],i=e[(o+1)%e.length],l=r;r=[];for(let d=0;d<l.length;d++){let p=l[d],g=l[(d+l.length-1)%l.length],c=U0(p,n,i),m=U0(g,n,i);if(c){if(!m){let y=_0(g,p,n,i);if(y)r.push(y)}r.push(p)}else if(m){let y=_0(g,p,n,i);if(y)r.push(y)}}}return r}function U0(t,a,r){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("isInsideEdge: pt must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("isInsideEdge: edgeStart must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("isInsideEdge: edgeEnd must have x and y properties");return X4(a,r,t).gte(0)}function _0(t,a,r,e){if(!t||t.x===null||t.x===void 0||t.y===null||t.y===void 0)throw Error("lineIntersection: point a must have x and y properties");if(!a||a.x===null||a.x===void 0||a.y===null||a.y===void 0)throw Error("lineIntersection: point b must have x and y properties");if(!r||r.x===null||r.x===void 0||r.y===null||r.y===void 0)throw Error("lineIntersection: point c must have x and y properties");if(!e||e.x===null||e.x===void 0||e.y===null||e.y===void 0)throw Error("lineIntersection: point d must have x and y properties");let o=a.x.minus(t.x),n=a.y.minus(t.y),i=e.x.minus(r.x),l=e.y.minus(r.y),d=o.mul(l).minus(n.mul(i));if(d.abs().lt(i4))return null;let p=r.x.minus(t.x),g=r.y.minus(t.y),c=p.mul(l).minus(g.mul(i)).div(d);return{x:t.x.plus(o.mul(c)),y:t.y.plus(n.mul(c))}}function u5(t){if(!Array.isArray(t))throw Error("polygonArea: polygon must be an array");let a=t.length;if(a<3)return c4(0);for(let e=0;e<a;e++)if(!t[e]||t[e].x===null||t[e].x===void 0||t[e].y===null||t[e].y===void 0)throw Error(`polygonArea: polygon[${e}] must have x and y properties`);let r=c4(0);for(let e=0;e<a;e++){let o=t[e],n=t[(e+1)%a];r=r.plus(o.x.mul(n.y).minus(n.x.mul(o.y)))}return r.div(2)}function a0(t){if(!Array.isArray(t))throw Error("isCounterClockwise: polygon must be an array");return u5(t).gt(0)}function e0(t){if(!Array.isArray(t))throw Error("reversePolygon: polygon must be an array");return[...t].reverse()}function m2(t){if(!Array.isArray(t))throw Error("ensureCCW: polygon must be an array");if(!a0(t))return e0(t);return t}function r0(t){if(!Array.isArray(t))throw Error("convexHull: points must be an array");if(t.length<3){for(let i=0;i<t.length;i++)if(!t[i]||t[i].x===null||t[i].x===void 0||t[i].y===null||t[i].y===void 0)throw Error(`convexHull: points[${i}] must have x and y properties`);return t.map((i)=>v3(i.x,i.y))}for(let i=0;i<t.length;i++)if(!t[i]||t[i].x===null||t[i].x===void 0||t[i].y===null||t[i].y===void 0)throw Error(`convexHull: points[${i}] must have x and y properties`);let a=t.map((i)=>v3(i.x,i.y)),r=0;for(let i=1;i<a.length;i++)if(a[i].y.lt(a[r].y)||a[i].y.eq(a[r].y)&&a[i].x.lt(a[r].x))r=i;[a[0],a[r]]=[a[r],a[0]];let e=a[0],o=a.slice(1).sort((i,l)=>{let d=X4(e,i,l);if(d.abs().lt(i4)){let p=i.x.minus(e.x).pow(2).plus(i.y.minus(e.y).pow(2)),g=l.x.minus(e.x).pow(2).plus(l.y.minus(e.y).pow(2)),c=p.minus(g);if(c.abs().lt(i4))return 0;return c.lt(0)?-1:1}return-J2(d)}),n=[e];for(let i of o){while(n.length>1&&X4(n[n.length-2],n[n.length-1],i).lte(0))n.pop();n.push(i)}return n}function j4(t){if(!Array.isArray(t))throw Error("boundingBox: polygon must be an array");if(t.length===0)return null;if(!t[0]||t[0].x===null||t[0].x===void 0||t[0].y===null||t[0].y===void 0)throw Error("boundingBox: polygon[0] must have x and y properties");let a=c4(t[0].x),r=c4(t[0].y),e=c4(t[0].x),o=c4(t[0].y);for(let n=0;n<t.length;n++){let i=t[n];if(!i||i.x===null||i.x===void 0||i.y===null||i.y===void 0)throw Error(`boundingBox: polygon[${n}] must have x and y properties`);let l=c4(i.x),d=c4(i.y);if(l.lt(a))a=l;if(d.lt(r))r=d;if(l.gt(e))e=l;if(d.gt(o))o=d}return{minX:a,minY:r,maxX:e,maxY:o}}function w5(t,a){if(!t||!a)return!1;if(t.minX===null||t.minX===void 0||t.minY===null||t.minY===void 0||t.maxX===null||t.maxX===void 0||t.maxY===null||t.maxY===void 0)throw Error("bboxIntersects: bb1 must have minX, minY, maxX, maxY properties");if(a.minX===null||a.minX===void 0||a.minY===null||a.minY===void 0||a.maxX===null||a.maxX===void 0||a.maxY===null||a.maxY===void 0)throw Error("bboxIntersects: bb2 must have minX, minY, maxX, maxY properties");return!(t.maxX.lt(a.minX)||a.maxX.lt(t.minX)||t.maxY.lt(a.minY)||a.maxY.lt(t.minY))}function J5(t,a){if(!Array.isArray(t))throw Error("polygonIntersection: subject must be an array");if(!Array.isArray(a))throw Error("polygonIntersection: clip must be an array");for(let i=0;i<t.length;i++)if(!t[i]||t[i].x===null||t[i].x===void 0||t[i].y===null||t[i].y===void 0)throw Error(`polygonIntersection: subject[${i}] must have x and y properties`);for(let i=0;i<a.length;i++)if(!a[i]||a[i].x===null||a[i].x===void 0||a[i].y===null||a[i].y===void 0)throw Error(`polygonIntersection: clip[${i}] must have x and y properties`);let r=t.map((i)=>v3(i.x,i.y)),e=a.map((i)=>v3(i.x,i.y)),o=j4(r),n=j4(e);if(!w5(o,n))return[];if(o0(e)){let i=t0(r,m2(e));return i.length>=3?[i]:[]}return ir(r,e)}function o0(t){if(!Array.isArray(t))throw Error("isConvex: polygon must be an array");let a=t.length;if(a<3)return!1;for(let e=0;e<a;e++)if(!t[e]||t[e].x===null||t[e].x===void 0||t[e].y===null||t[e].y===void 0)throw Error(`isConvex: polygon[${e}] must have x and y properties`);let r=0;for(let e=0;e<a;e++){let o=t[e],n=t[(e+1)%a],i=t[(e+2)%a],l=X4(o,n,i),d=l.gt(0)?1:l.lt(0)?-1:0;if(d!==0){if(r===0)r=d;else if(r!==d)return!1}}return!0}function ir(t,a){if(!Array.isArray(t)||!Array.isArray(a))throw Error("generalPolygonIntersection: both arguments must be arrays");let r=[];for(let d=0;d<t.length;d++){let p=t[d],g=t[(d+1)%t.length];for(let c=0;c<a.length;c++){let m=a[c],y=a[(c+1)%a.length],h=c2(p,g,m,y);if(h)r.push(v3(h.x,h.y))}}let e=t.filter((d)=>x4(d,a)>=0),o=a.filter((d)=>x4(d,t)>=0),n=[...r,...e,...o];if(n.length<3)return[];let i=lr(n);if(i.length<3)return[];let l=r0(i);return l.length>=3?[l]:[]}function lr(t){if(!Array.isArray(t))throw Error("removeDuplicatePoints: points must be an array");let a=[];for(let r of t){let e=!1;for(let o of a)if(F4(r,o)){e=!0;break}if(!e)a.push(r)}return a}function y2(t,a){if(!Array.isArray(t))throw Error("polygonUnion: polygon1 must be an array");if(!Array.isArray(a))throw Error("polygonUnion: polygon2 must be an array");for(let i=0;i<t.length;i++)if(!t[i]||t[i].x===null||t[i].x===void 0||t[i].y===null||t[i].y===void 0)throw Error(`polygonUnion: polygon1[${i}] must have x and y properties`);for(let i=0;i<a.length;i++)if(!a[i]||a[i].x===null||a[i].x===void 0||a[i].y===null||a[i].y===void 0)throw Error(`polygonUnion: polygon2[${i}] must have x and y properties`);let r=t.map((i)=>v3(i.x,i.y)),e=a.map((i)=>v3(i.x,i.y)),o=j4(r),n=j4(e);if(!w5(o,n))return[r,e];return pr(r,e)}function pr(t,a){if(!Array.isArray(t)||!Array.isArray(a))throw Error("traceBoundaryUnion: both arguments must be arrays");let r=o6(t,a);if(r.length===0){let s=x4(t[0],a),x=x4(a[0],t);if(s>0)return[a];else if(x>0)return[t];else return[t,a]}let e=$5(t,r.map((s)=>({edgeIndex:s.edge1,t:s.t1,point:s.point,intersectionId:s.id}))),o=$5(a,r.map((s)=>({edgeIndex:s.edge2,t:s.t2,point:s.point,intersectionId:s.id}))),n=new Map;for(let s=0;s<e.length;s++)if(e[s].intersectionId!==void 0){if(!n.has(e[s].intersectionId))n.set(e[s].intersectionId,{});n.get(e[s].intersectionId).idx1=s}for(let s=0;s<o.length;s++)if(o[s].intersectionId!==void 0){if(!n.has(o[s].intersectionId))n.set(o[s].intersectionId,{});n.get(o[s].intersectionId).idx2=s}let i=1,l=-1;for(let s=0;s<e.length;s++){let x=e[s];if(x.intersectionId===void 0&&x4(x,a)<0){l=s;break}}if(l===-1){i=2;for(let s=0;s<o.length;s++){let x=o[s];if(x.intersectionId===void 0&&x4(x,t)<0){l=s;break}}}if(l===-1){let s=u5(t).abs(),x=u5(a).abs();return s.gt(x)?[t]:[a]}let d=[],p=i===1,g=l,c=new Set,m=(e.length+o.length)*3,y=0,h=`${i}-${l}`;while(y<m){y++;let s=p?e:o,x=p?o:e,D=s[g];if(d.length===0||!F4(d[d.length-1],D))d.push(v3(D.x,D.y));let S=(g+1)%s.length,P=s[S];if(P.intersectionId!==void 0&&!c.has(P.intersectionId)){d.push(v3(P.x,P.y)),c.add(P.intersectionId);let T=n.get(P.intersectionId),f=p?T.idx2:T.idx1;p=!p,g=(f+1)%x.length}else g=S;if(`${p?1:2}-${g}`===h)break}if(d.length>1&&F4(d[0],d[d.length-1]))d.pop();return d.length>=3?[d]:[]}function o6(t,a){if(!Array.isArray(t)||!Array.isArray(a))throw Error("findAllIntersections: both arguments must be arrays");let r=[],e=0;for(let o=0;o<t.length;o++){let n=t[o],i=t[(o+1)%t.length];for(let l=0;l<a.length;l++){let d=a[l],p=a[(l+1)%a.length],g=c2(n,i,d,p);if(g)r.push({id:e++,point:v3(g.x,g.y),edge1:o,edge2:l,t1:g.t,t2:g.s})}}return r}function $5(t,a){if(!Array.isArray(t))throw Error("augmentPolygon: polygon must be an array");if(!Array.isArray(a))throw Error("augmentPolygon: insertions must be an array");let r=new Map;for(let o of a){if(!r.has(o.edgeIndex))r.set(o.edgeIndex,[]);r.get(o.edgeIndex).push(o)}for(let o of r.values())o.sort((n,i)=>n.t.minus(i.t).toNumber());let e=[];for(let o=0;o<t.length;o++)if(e.push({...t[o]}),r.has(o))for(let n of r.get(o))e.push({x:n.point.x,y:n.point.y,intersectionId:n.intersectionId});return e}function n6(t,a){if(!Array.isArray(t))throw Error("polygonDifference: polygon1 must be an array");if(!Array.isArray(a))throw Error("polygonDifference: polygon2 must be an array");for(let i=0;i<t.length;i++)if(!t[i]||t[i].x===null||t[i].x===void 0||t[i].y===null||t[i].y===void 0)throw Error(`polygonDifference: polygon1[${i}] must have x and y properties`);for(let i=0;i<a.length;i++)if(!a[i]||a[i].x===null||a[i].x===void 0||a[i].y===null||a[i].y===void 0)throw Error(`polygonDifference: polygon2[${i}] must have x and y properties`);let r=t.map((i)=>v3(i.x,i.y)),e=a.map((i)=>v3(i.x,i.y)),o=j4(r),n=j4(e);if(!w5(o,n))return[r];return dr(r,e)}function dr(t,a){if(!Array.isArray(t)||!Array.isArray(a))throw Error("traceBoundaryDifference: both arguments must be arrays");let r=o6(t,a);if(r.length===0)if(x4(t[0],a)>0)return[];else return[t];let e=$5(t,r.map((y)=>({edgeIndex:y.edge1,t:y.t1,point:y.point,intersectionId:y.id}))),o=$5(a,r.map((y)=>({edgeIndex:y.edge2,t:y.t2,point:y.point,intersectionId:y.id}))),n=new Map;for(let y=0;y<e.length;y++)if(e[y].intersectionId!==void 0){if(!n.has(e[y].intersectionId))n.set(e[y].intersectionId,{});n.get(e[y].intersectionId).idx1=y}for(let y=0;y<o.length;y++)if(o[y].intersectionId!==void 0){if(!n.has(o[y].intersectionId))n.set(o[y].intersectionId,{});n.get(o[y].intersectionId).idx2=y}let i=-1;for(let y=0;y<e.length;y++){let h=e[y];if(h.intersectionId===void 0&&x4(h,a)<0){i=y;break}}if(i===-1)return[];let l=[],d=!0,p=i,g=new Set,c=(e.length+o.length)*3,m=0;while(m<c){m++;let y=(d?e:o)[p];if(l.length===0||!F4(l[l.length-1],y))l.push(v3(y.x,y.y));let h=`${d?1:2}-${p}`;if(g.has(h))break;if(g.add(h),d){let s=(p+1)%e.length,x=e[s];if(x.intersectionId!==void 0){let D=e[(s+1)%e.length];if(x4(D,a)>0){let S=n.get(x.intersectionId);l.push(v3(x.x,x.y)),d=!1,p=(S.idx2-1+o.length)%o.length}else p=s}else p=s}else{let s=(p-1+o.length)%o.length,x=o[s];if(x.intersectionId!==void 0){let D=n.get(x.intersectionId);l.push(v3(x.x,x.y)),d=!0,p=(D.idx1+1)%e.length}else p=s}if(d&&p===i)break}if(l.length>1&&F4(l[0],l[l.length-1]))l.pop();return l.length>=3?[l]:[]}var gr={point:v3,pointsEqual:F4,cross:X4,dot:e6,sign:J2,segmentIntersection:c2,lineSegmentIntersection:r6,pointInPolygon:x4,pointOnSegment:$2,clipPolygonSH:t0,polygonArea:u5,isCounterClockwise:a0,reversePolygon:e0,ensureCCW:m2,isConvex:o0,convexHull:r0,boundingBox:j4,bboxIntersects:w5,polygonIntersection:J5,polygonUnion:y2,polygonDifference:n6,EPSILON:i4};E.set({precision:80});var V5=(t)=>t instanceof E?t:new E(t),R4=new E("1e-40"),{point:O4,pointsEqual:Kn,cross:M2,polygonArea:Zn,polygonIntersection:Jn,polygonUnion:$n,polygonDifference:ti,isCounterClockwise:ai,ensureCCW:ei,segmentIntersection:ri}=Z2,P5={NONZERO:"nonzero",EVENODD:"evenodd"};function F0(t,a,r=P5.NONZERO){if(!t||typeof t!=="object")throw Error("pointInPolygonWithRule: pt must be an object with x, y properties");if(t.x===void 0||t.x===null||t.y===void 0||t.y===null)throw Error("pointInPolygonWithRule: pt must have x and y properties");if(!Array.isArray(a))throw Error("pointInPolygonWithRule: polygon must be an array");let e=a.length;if(e<3)return-1;let o=0;for(let n=0;n<e;n++){let i=a[n],l=a[(n+1)%e];if(cr(t,i,l))return 0;if(i.y.lte(t.y)){if(l.y.gt(t.y)){if(M2(i,l,t).gt(0))o++}}else if(l.y.lte(t.y)){if(M2(i,l,t).lt(0))o--}}if(r===P5.EVENODD)return Math.abs(o)%2===1?1:-1;else return o!==0?1:-1}function cr(t,a,r){if(!t||!a||!r)throw Error("pointOnSegment: pt, a, and b must be defined");if(t.x===void 0||t.x===null||t.y===void 0||t.y===null||a.x===void 0||a.x===null||a.y===void 0||a.y===null||r.x===void 0||r.x===null||r.y===void 0||r.y===null)throw Error("pointOnSegment: all points must have x and y properties");if(M2(a,r,t).abs().gt(R4))return!1;let e=E.min(a.x,r.x),o=E.max(a.x,r.x),n=E.min(a.y,r.y),i=E.max(a.y,r.y);return t.x.gte(e.minus(R4))&&t.x.lte(o.plus(R4))&&t.y.gte(n.minus(R4))&&t.y.lte(i.plus(R4))}function mr(t,a,r={}){if(!Array.isArray(t))throw Error("offsetPolygon: polygon must be an array");if(a===void 0||a===null)throw Error("offsetPolygon: distance must be defined");if(!r||typeof r!=="object")throw Error("offsetPolygon: options must be an object");let e=V5(a);if(e.lte(0))throw Error("offsetPolygon: distance must be positive");let o=r.linejoin||"miter",n=V5(r.miterLimit||4);if(t.length<3)return{outer:[],inner:[]};let i=t.length,l=[],d=[];for(let p=0;p<i;p++){let g=t[(p-1+i)%i],c=t[p],m=t[(p+1)%i],y=c.x.minus(g.x),h=c.y.minus(g.y),s=m.x.minus(c.x),x=m.y.minus(c.y),D=y.pow(2).plus(h.pow(2)).sqrt(),S=s.pow(2).plus(x.pow(2)).sqrt();if(D.lt(R4)||S.lt(R4))continue;let P=h.div(D),T=y.neg().div(D),f=x.div(S),X=s.neg().div(S),B=P.plus(f).div(2),L=T.plus(X).div(2),R=B.pow(2).plus(L.pow(2)).sqrt();if(R.lt(R4))B=P,L=T;else B=B.div(R),L=L.div(R);let N=P.times(f).plus(T.times(X)),u=V5(1).minus(N).div(2).sqrt(),O=e;if(u.gt(R4)){let Y=e.div(u);if(o==="miter"&&Y.lte(e.times(n)))O=Y;else if(o==="bevel"||Y.gt(e.times(n))){let j=O4(c.x.plus(P.times(e)),c.y.plus(T.times(e))),_=O4(c.x.plus(f.times(e)),c.y.plus(X.times(e)));l.push(j,_);let A=O4(c.x.minus(P.times(e)),c.y.minus(T.times(e))),W=O4(c.x.minus(f.times(e)),c.y.minus(X.times(e)));d.push(A,W);continue}else if(o==="round"){let j=Math.atan2(T.toNumber(),P.toNumber()),_=Math.atan2(X.toNumber(),f.toNumber())-j;if(_<-Math.PI)_+=2*Math.PI;if(_>Math.PI)_-=2*Math.PI;let A=Math.max(2,Math.ceil(Math.abs(_)/(Math.PI/8)));for(let W=0;W<=A;W++){let C=j+_*(W/A);l.push(O4(c.x.plus(e.times(Math.cos(C))),c.y.plus(e.times(Math.sin(C))))),d.push(O4(c.x.minus(e.times(Math.cos(C))),c.y.minus(e.times(Math.sin(C)))))}continue}}l.push(O4(c.x.plus(B.times(O)),c.y.plus(L.times(O)))),d.push(O4(c.x.minus(B.times(O)),c.y.minus(L.times(O))))}return{outer:l,inner:d.reverse()}}function j0(t,a){if(!Array.isArray(t))throw Error("strokeToFilledPolygon: polygon must be an array");if(!a||typeof a!=="object")throw Error("strokeToFilledPolygon: strokeProps must be an object");if(a.width===void 0||a.width===null)throw Error("strokeToFilledPolygon: strokeProps must have width property");let r=V5(a.width).div(2);if(r.lte(0))throw Error("strokeToFilledPolygon: width must be positive");return mr(t,r,a).outer}E.set({precision:80});var P4=(t)=>t instanceof E?t:new E(t),yr={fill:"black","fill-rule":"nonzero","fill-opacity":1,stroke:"none","stroke-width":1,"stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":4,"stroke-dasharray":"none","stroke-dashoffset":0,"stroke-opacity":1,"marker-start":"none","marker-mid":"none","marker-end":"none","paint-order":"normal","clip-path":"none","clip-rule":"nonzero",mask:"none","mask-type":"luminance",opacity:1,transform:"none","vector-effect":"none",filter:"none"};class n0{constructor(t,a={},r=null){if(!t)throw Error("SVGRenderingContext: element parameter is required");if(a!==null&&typeof a!=="object")throw Error("SVGRenderingContext: inherited must be an object or null");this.element=t,this.defsMap=r||new Map,this.properties=this._extractProperties(t,a||{}),this.dashArray=this._parseDashArray(this.properties["stroke-dasharray"]),this.dashOffset=P4(this.properties["stroke-dashoffset"]||0),this.markers={start:this._parseMarkerRef(this.properties["marker-start"]),mid:this._parseMarkerRef(this.properties["marker-mid"]),end:this._parseMarkerRef(this.properties["marker-end"])},this.hasFill=this.properties.fill!=="none"&&this.properties["fill-opacity"]>0,this.hasStroke=this.properties.stroke!=="none"&&P4(this.properties["stroke-width"]).gt(0)&&this.properties["stroke-opacity"]>0,this.hasMarkers=this.markers.start||this.markers.mid||this.markers.end}_extractProperties(t,a){if(a!==null&&typeof a!=="object")throw Error("_extractProperties: inherited must be an object or null");let r={...yr,...a||{}};if(t&&t.getAttributeNames)for(let o of t.getAttributeNames()){let n=t.getAttribute(o);if(n!==null&&n!==void 0)r[o]=n}if(r.style){let o=this._parseStyleAttribute(r.style);Object.assign(r,o)}let e=["stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity"];for(let o of e)if(typeof r[o]==="string"){let n=parseFloat(r[o]);if(!isNaN(n))r[o]=n}return r}_parseStyleAttribute(t){let a={};if(!t)return a;let r=t.split(";");for(let e of r){if(!e.includes(":"))continue;let[o,n]=e.split(":").map((i)=>i.trim());if(o&&n)a[o]=n}return a}_parseDashArray(t){if(!t||t==="none")return null;let a=t.toString().split(/[\s,]+/).filter((e)=>e),r=[];for(let e of a){let o=parseFloat(e);if(isNaN(o)||!isFinite(o))throw Error(`_parseDashArray: invalid dash value '${e}'`);if(o<0)throw Error(`_parseDashArray: dash values must be non-negative, got ${o}`);r.push(P4(o))}if(r.length===0)return null;if(r.length%2===1)return[...r,...r];return r}_parseMarkerRef(t){if(!t||t==="none")return null;let a=t.match(/url\(#?([^)]+)\)/);return a?a[1]:null}get fillRule(){return this.properties["fill-rule"]||"nonzero"}get clipRule(){return this.properties["clip-rule"]||"nonzero"}get strokeWidth(){return P4(this.properties["stroke-width"]||0)}get strokeLinecap(){return this.properties["stroke-linecap"]||"butt"}get strokeLinejoin(){return this.properties["stroke-linejoin"]||"miter"}get strokeMiterlimit(){return P4(this.properties["stroke-miterlimit"]||4)}getStrokeExtent(){if(!this.hasStroke)return P4(0);let t=this.strokeWidth.div(2),a=t;if(this.strokeLinejoin==="miter")a=t.times(this.strokeMiterlimit);if(this.strokeLinecap==="square"){let r=t.times(2);if(r.gt(a))a=r}return a}expandBBoxForStroke(t){if(!t||typeof t!=="object")throw Error("expandBBoxForStroke: bbox must be an object");if(!("x"in t)||!("y"in t)||!("width"in t)||!("height"in t))throw Error("expandBBoxForStroke: bbox must have x, y, width, height properties");if(typeof t.x.minus!=="function"||typeof t.y.minus!=="function"||typeof t.width.plus!=="function"||typeof t.height.plus!=="function")throw Error("expandBBoxForStroke: bbox properties must be Decimal instances");if(!this.hasStroke)return t;let a=this.getStrokeExtent();return{x:t.x.minus(a),y:t.y.minus(a),width:t.width.plus(a.times(2)),height:t.height.plus(a.times(2))}}expandBBoxForMarkers(t,a=null){if(!t||typeof t!=="object")throw Error("expandBBoxForMarkers: bbox must be an object");if(!("x"in t)||!("y"in t)||!("width"in t)||!("height"in t))throw Error("expandBBoxForMarkers: bbox must have x, y, width, height properties");if(typeof t.x.minus!=="function"||typeof t.y.minus!=="function"||typeof t.width.plus!=="function"||typeof t.height.plus!=="function")throw Error("expandBBoxForMarkers: bbox properties must be Decimal instances");if(!this.hasMarkers)return t;let r=P4(0);if(a){if(typeof a!=="object")throw Error("expandBBoxForMarkers: markerSizes must be an object");let o=[a.start,a.mid,a.end].filter((n)=>n!==null&&n!==void 0).map((n)=>{let i=typeof n==="number"?n:parseFloat(n);if(isNaN(i)||!isFinite(i))throw Error(`expandBBoxForMarkers: invalid marker size '${n}'`);return P4(i)});if(o.length>0)r=E.max(...o)}else r=this.strokeWidth.times(3);if(r.lte(0))return t;let e=r.div(2);return{x:t.x.minus(e),y:t.y.minus(e),width:t.width.plus(e.times(2)),height:t.height.plus(e.times(2))}}expandBBoxForFilter(t,a=null){if(!t||typeof t!=="object")throw Error("expandBBoxForFilter: bbox must be an object");if(!("x"in t)||!("y"in t)||!("width"in t)||!("height"in t))throw Error("expandBBoxForFilter: bbox must have x, y, width, height properties");if(typeof t.x.minus!=="function"||typeof t.y.minus!=="function"||typeof t.width.times!=="function"||typeof t.height.times!=="function")throw Error("expandBBoxForFilter: bbox properties must be Decimal instances");let r=this.properties.filter;if(!r||r==="none")return t;let e=t.width.times("0.1"),o=t.height.times("0.1");if(a){if(typeof a!=="object")throw Error("expandBBoxForFilter: filterDef must be an object");if(a.x!==void 0){let n=parseFloat(a.x);if(isNaN(n)||!isFinite(n))throw Error(`expandBBoxForFilter: invalid filterDef.x value '${a.x}'`);e=P4(n).abs()}if(a.y!==void 0){let n=parseFloat(a.y);if(isNaN(n)||!isFinite(n))throw Error(`expandBBoxForFilter: invalid filterDef.y value '${a.y}'`);o=P4(n).abs()}}return{x:t.x.minus(e),y:t.y.minus(o),width:t.width.plus(e.times(2)),height:t.height.plus(o.times(2))}}getRenderedBBox(t,a={}){if(!t||typeof t!=="object")throw Error("getRenderedBBox: geometryBBox must be an object");if(!("x"in t)||!("y"in t)||!("width"in t)||!("height"in t))throw Error("getRenderedBBox: geometryBBox must have x, y, width, height properties");if(typeof t.x.minus!=="function"||typeof t.y.minus!=="function")throw Error("getRenderedBBox: geometryBBox properties must be Decimal instances");if(a!==null&&typeof a!=="object")throw Error("getRenderedBBox: options must be an object or null");let r={...t};return r=this.expandBBoxForStroke(r),r=this.expandBBoxForMarkers(r,a.markerSizes),r=this.expandBBoxForFilter(r,a.filterDef),r}getFilledArea(t){if(!Array.isArray(t))throw Error("getFilledArea: polygon must be an array");if(t.length===0)throw Error("getFilledArea: polygon must not be empty");let a=[];if(this.hasFill)a.push({polygon:t,fillRule:this.fillRule,type:"fill"});if(this.hasStroke){let r=j0(t,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(r&&r.length>0)a.push({polygon:r,fillRule:"nonzero",type:"stroke"})}return a}isPointInRenderedArea(t,a){if(!t||typeof t!=="object")throw Error("isPointInRenderedArea: point must be an object");if(t.x===void 0||t.y===void 0)throw Error("isPointInRenderedArea: point must have x and y properties");if(!Array.isArray(a))throw Error("isPointInRenderedArea: polygon must be an array");if(a.length===0)throw Error("isPointInRenderedArea: polygon must not be empty");if(this.hasFill){let r=this.fillRule==="evenodd"?P5.EVENODD:P5.NONZERO;if(F0(t,a,r)>=0)return!0}if(this.hasStroke){let r=j0(a,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(r&&r.length>0){if(F0(t,r,P5.NONZERO)>=0)return!0}}return!1}canMergeWith(t){if(!(t instanceof n0))throw Error("canMergeWith: other must be an instance of SVGRenderingContext");if(this.fillRule!==t.fillRule)return{canMerge:!1,reason:"Different fill-rule"};if(this.hasStroke||t.hasStroke){if(this.hasStroke!==t.hasStroke)return{canMerge:!1,reason:"Different stroke presence"};if(!this.strokeWidth.eq(t.strokeWidth))return{canMerge:!1,reason:"Different stroke-width"};if(this.strokeLinecap!==t.strokeLinecap)return{canMerge:!1,reason:"Different stroke-linecap"};if(this.strokeLinejoin!==t.strokeLinejoin)return{canMerge:!1,reason:"Different stroke-linejoin"}}if(this.hasMarkers||t.hasMarkers)return{canMerge:!1,reason:"Has markers"};if(this.properties["clip-path"]!=="none"||t.properties["clip-path"]!=="none")return{canMerge:!1,reason:"Has clip-path"};if(this.properties.mask!=="none"||t.properties.mask!=="none")return{canMerge:!1,reason:"Has mask"};if(this.properties.filter!=="none"||t.properties.filter!=="none")return{canMerge:!1,reason:"Has filter"};return{canMerge:!0,reason:null}}toSummary(){return{hasFill:this.hasFill,hasStroke:this.hasStroke,hasMarkers:this.hasMarkers,fillRule:this.fillRule,strokeWidth:this.hasStroke?this.strokeWidth.toNumber():0,strokeExtent:this.getStrokeExtent().toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,clipPath:this.properties["clip-path"],filter:this.properties.filter}}}function t2(t,a={},r=null){if(!t)throw Error("createRenderingContext: element parameter is required");return new n0(t,a,r)}function a2(t){if(!t)throw Error("getInheritedProperties: element parameter is required");let a={},r=["fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","marker-start","marker-mid","marker-end","clip-rule","opacity","font-family","font-size","font-style","font-weight"];if(!t.parentNode)return a;let e=t.parentNode;while(e&&e.tagName){for(let o of r)if(a[o]===void 0){let n=e.getAttribute?e.getAttribute(o):null;if(n!==null&&n!==void 0)a[o]=n}e=e.parentNode}return a}E.set({precision:80});function i6(t,a){if(!t||!a)throw Error("setOwnerDocument: element and document are required");if(!t.children||!Array.isArray(t.children))throw Error("setOwnerDocument: element must have a children array");t.ownerDocument=a;for(let r of t.children)if(r instanceof I3)i6(r,a)}function F3(t){if(typeof t!=="string")throw Error("parseSVG: input must be a string");if(t.trim().length===0)throw Error("parseSVG: input cannot be empty");let a=t.trim(),r=p6(a,0);if(!r.element)throw Error("Failed to parse SVG: no root element found");let e=new l6(r.element);return i6(r.element,e),r.element}class l6{constructor(t=null){this.documentElement=t}createElement(t){if(!t||typeof t!=="string")throw Error("createElement: tagName must be a non-empty string");let a=new I3(t);return a.ownerDocument=this,a}createElementNS(t,a){if(t!==null&&t!==void 0&&typeof t!=="string")throw Error("createElementNS: namespace must be a string");return this.createElement(a)}}class I3{constructor(t,a={},r=[],e=""){if(!t||typeof t!=="string")throw Error("SVGElement: tagName must be a non-empty string");if(a!==null&&typeof a!=="object")throw Error("SVGElement: attributes must be an object");if(!Array.isArray(r))throw Error("SVGElement: children must be an array");if(typeof e!=="string")throw Error("SVGElement: textContent must be a string");this.tagName=t,this.nodeName=t.toUpperCase(),this._attributes={...a},this.children=r,this.childNodes=r,this.textContent=e,this.parentNode=null,this.ownerDocument=null;for(let o of r)if(o instanceof I3)o.parentNode=this}getAttribute(t){if(typeof t!=="string")throw Error("getAttribute: name must be a string");return this._attributes[t]??null}setAttribute(t,a){if(typeof t!=="string")throw Error("setAttribute: name must be a string");if(a!==null&&a!==void 0)this._attributes[t]=String(a);else this._attributes[t]=""}hasAttribute(t){if(typeof t!=="string")throw Error("hasAttribute: name must be a string");return t in this._attributes}removeAttribute(t){if(typeof t!=="string")throw Error("removeAttribute: name must be a string");delete this._attributes[t]}getAttributeNames(){return Object.keys(this._attributes)}getElementsByTagName(t){if(typeof t!=="string")throw Error("getElementsByTagName: tagName must be a string");if(t.length===0)return[];let a=t.toLowerCase(),r=[],e=(o)=>{for(let n of o.children)if(n instanceof I3){if(n.tagName.toLowerCase()===a||a==="*")r.push(n);e(n)}};return e(this),r}getElementById(t){if(typeof t!=="string")throw Error("getElementById: id must be a string");if(t.length===0)return null;let a=(r)=>{if(r.getAttribute("id")===t)return r;for(let e of r.children)if(e instanceof I3){let o=a(e);if(o)return o}return null};return a(this)}querySelector(t){if(typeof t!=="string")throw Error("querySelector: selector must be a string");return this.querySelectorAll(t)[0]||null}querySelectorAll(t){if(typeof t!=="string")throw Error("querySelectorAll: selector must be a string");let a=[],r=W0(t),e=(o)=>{for(let n of o.children)if(n instanceof I3){if(G0(n,r))a.push(n);e(n)}};return e(this),a}matches(t){if(typeof t!=="string")throw Error("matches: selector must be a string");let a=W0(t);return G0(this,a)}cloneNode(t=!0){if(typeof t!=="boolean")throw Error("cloneNode: deep must be a boolean");let a=t?this.children.map((e)=>e instanceof I3?e.cloneNode(!0):e):[],r=new I3(this.tagName,{...this._attributes},a,this.textContent);if(this.ownerDocument){let e=(o,n)=>{o.ownerDocument=n;for(let i of o.children)if(i instanceof I3)e(i,n)};e(r,this.ownerDocument)}return r}appendChild(t){if(t===null||t===void 0)throw Error("appendChild: child cannot be null or undefined");if(t instanceof I3&&t.parentNode)t.parentNode.removeChild(t);if(t instanceof I3)t.parentNode=this;return this.children.push(t),this.childNodes=this.children,t}removeChild(t){if(t===null||t===void 0)throw Error("removeChild: child cannot be null or undefined");let a=this.children.indexOf(t);if(a>=0){if(this.children.splice(a,1),this.childNodes=this.children,t instanceof I3)t.parentNode=null}return t}insertBefore(t,a){if(t===null||t===void 0)throw Error("insertBefore: newChild cannot be null or undefined");if(a===null||a===void 0)throw Error("insertBefore: refChild cannot be null or undefined");if(t instanceof I3&&t.parentNode)t.parentNode.removeChild(t);let r=this.children.indexOf(a);if(r>=0){if(t instanceof I3)t.parentNode=this;this.children.splice(r,0,t),this.childNodes=this.children}else this.appendChild(t);return t}replaceChild(t,a){if(t===null||t===void 0)throw Error("replaceChild: newChild cannot be null or undefined");if(a===null||a===void 0)throw Error("replaceChild: oldChild cannot be null or undefined");if(t instanceof I3&&t.parentNode)t.parentNode.removeChild(t);let r=this.children.indexOf(a);if(r>=0){if(a instanceof I3)a.parentNode=null;if(t instanceof I3)t.parentNode=this;this.children[r]=t,this.childNodes=this.children}return a}get style(){let t=this.getAttribute("style")||"",a={};if(t.length===0)return a;return t.split(";").forEach((r)=>{let e=r.indexOf(":");if(e>0){let o=r.slice(0,e).trim(),n=r.slice(e+1).trim();if(o&&n)a[o]=n}}),a}get firstChild(){return this.children[0]||null}get lastChild(){return this.children[this.children.length-1]||null}get nextSibling(){if(!this.parentNode)return null;let t=this.parentNode.children,a=t.indexOf(this);return t[a+1]||null}get previousSibling(){if(!this.parentNode)return null;let t=this.parentNode.children,a=t.indexOf(this);return a>0?t[a-1]:null}serialize(t=0,a=!1){if(typeof t!=="number"||!Number.isFinite(t)||t<0)throw Error("serialize: indent must be a non-negative finite number");if(typeof a!=="boolean")throw Error("serialize: minify must be a boolean");let r=a?"":" ".repeat(t),e=this._attributes["data-cdata-pending"]==="true",o=Object.entries(this._attributes).filter(([p])=>p!=="data-cdata-pending").map(([p,g])=>`${p}="${sr(g)}"`).join(" "),n=o?" "+o:"";if(this.children.length===0&&!this.textContent)return`${r}<${this.tagName}${n}/>`;let i=a?"":`
|
|
8
|
-
`,
|
|
1
|
+
var cK=Object.create;var{getPrototypeOf:lK,defineProperty:E6,getOwnPropertyNames:Y8,getOwnPropertyDescriptor:nK}=Object,X8=Object.prototype.hasOwnProperty;var Z6=($,J,Z)=>{Z=$!=null?cK(lK($)):{};let K=J||!$||!$.__esModule?E6(Z,"default",{value:$,enumerable:!0}):Z;for(let Q of Y8($))if(!X8.call(K,Q))E6(K,Q,{get:()=>$[Q],enumerable:!0});return K},O8=new WeakMap,sK=($)=>{var J=O8.get($),Z;if(J)return J;if(J=E6({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")Y8($).map((K)=>!X8.call(J,K)&&E6(J,K,{get:()=>$[K],enumerable:!(Z=nK($,K))||Z.enumerable}));return O8.set($,J),J};var x$=($,J)=>{for(var Z in J)E6($,Z,{get:J[Z],enumerable:!0,configurable:!0,set:(K)=>J[Z]=()=>K})};var oK=($,J)=>()=>($&&(J=$($=0)),J);var f7=(($)=>typeof require!=="undefined"?require:typeof Proxy!=="undefined"?new Proxy($,{get:(J,Z)=>(typeof require!=="undefined"?require:J)[Z]}):$)(function($){if(typeof require!=="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+$+'" is not supported')});var I6={};x$(I6,{win32:()=>i9,toNamespacedPath:()=>_z,sep:()=>Xz,resolve:()=>qz,relative:()=>Fz,posix:()=>$6,parse:()=>Yz,normalize:()=>Wz,join:()=>Gz,isAbsolute:()=>jz,format:()=>Oz,extname:()=>Mz,dirname:()=>Uz,delimiter:()=>kz,default:()=>zz,basename:()=>Vz});var rH,Y5,aH,tH,eH,$z,Jz=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports),Kz=($,J,Z,K)=>{if(J&&typeof J=="object"||typeof J=="function")for(let Q of tH(J))!$z.call($,Q)&&Q!==Z&&Y5($,Q,{get:()=>J[Q],enumerable:!(K=aH(J,Q))||K.enumerable});return $},Zz=($,J,Z)=>(Z=$!=null?rH(eH($)):{},Kz(J||!$||!$.__esModule?Y5(Z,"default",{value:$,enumerable:!0}):Z,$)),Qz,X5,m0,Hz,O5=function($){return $},k5=function(){throw new Error("Not implemented")},$6,i9,zz,qz,Wz,jz,Gz,Fz,_z,Uz,Vz,Mz,Oz,Yz,Xz,kz;var C6=oK(()=>{rH=Object.create,Y5=Object.defineProperty,aH=Object.getOwnPropertyDescriptor,tH=Object.getOwnPropertyNames,eH=Object.getPrototypeOf,$z=Object.prototype.hasOwnProperty,Qz=Jz(($,J)=>{function Z(z){if(typeof z!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(z))}function K(z,q){for(var W="",j=0,G=-1,F=0,_,U=0;U<=z.length;++U){if(U<z.length)_=z.charCodeAt(U);else{if(_===47)break;_=47}if(_===47){if(!(G===U-1||F===1))if(G!==U-1&&F===2){if(W.length<2||j!==2||W.charCodeAt(W.length-1)!==46||W.charCodeAt(W.length-2)!==46){if(W.length>2){var O=W.lastIndexOf("/");if(O!==W.length-1){O===-1?(W="",j=0):(W=W.slice(0,O),j=W.length-1-W.lastIndexOf("/")),G=U,F=0;continue}}else if(W.length===2||W.length===1){W="",j=0,G=U,F=0;continue}}q&&(W.length>0?W+="/..":W="..",j=2)}else W.length>0?W+="/"+z.slice(G+1,U):W=z.slice(G+1,U),j=U-G-1;G=U,F=0}else _===46&&F!==-1?++F:F=-1}return W}function Q(z,q){var W=q.dir||q.root,j=q.base||(q.name||"")+(q.ext||"");return W?W===q.root?W+j:W+z+j:j}var H={resolve:function(){for(var z="",q=!1,W,j=arguments.length-1;j>=-1&&!q;j--){var G;j>=0?G=arguments[j]:(W===void 0&&(W=process.cwd()),G=W),Z(G),G.length!==0&&(z=G+"/"+z,q=G.charCodeAt(0)===47)}return z=K(z,!q),q?z.length>0?"/"+z:"/":z.length>0?z:"."},normalize:function(z){if(Z(z),z.length===0)return".";var q=z.charCodeAt(0)===47,W=z.charCodeAt(z.length-1)===47;return z=K(z,!q),z.length===0&&!q&&(z="."),z.length>0&&W&&(z+="/"),q?"/"+z:z},isAbsolute:function(z){return Z(z),z.length>0&&z.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var z,q=0;q<arguments.length;++q){var W=arguments[q];Z(W),W.length>0&&(z===void 0?z=W:z+="/"+W)}return z===void 0?".":H.normalize(z)},relative:function(z,q){if(Z(z),Z(q),z===q||(z=H.resolve(z),q=H.resolve(q),z===q))return"";for(var W=1;W<z.length&&z.charCodeAt(W)===47;++W);for(var j=z.length,G=j-W,F=1;F<q.length&&q.charCodeAt(F)===47;++F);for(var _=q.length,U=_-F,O=G<U?G:U,V=-1,M=0;M<=O;++M){if(M===O){if(U>O){if(q.charCodeAt(F+M)===47)return q.slice(F+M+1);if(M===0)return q.slice(F+M)}else G>O&&(z.charCodeAt(W+M)===47?V=M:M===0&&(V=0));break}var Y=z.charCodeAt(W+M),X=q.charCodeAt(F+M);if(Y!==X)break;Y===47&&(V=M)}var w="";for(M=W+V+1;M<=j;++M)(M===j||z.charCodeAt(M)===47)&&(w.length===0?w+="..":w+="/..");return w.length>0?w+q.slice(F+V):(F+=V,q.charCodeAt(F)===47&&++F,q.slice(F))},_makeLong:function(z){return z},dirname:function(z){if(Z(z),z.length===0)return".";for(var q=z.charCodeAt(0),W=q===47,j=-1,G=!0,F=z.length-1;F>=1;--F)if(q=z.charCodeAt(F),q===47){if(!G){j=F;break}}else G=!1;return j===-1?W?"/":".":W&&j===1?"//":z.slice(0,j)},basename:function(z,q){if(q!==void 0&&typeof q!="string")throw new TypeError('"ext" argument must be a string');Z(z);var W=0,j=-1,G=!0,F;if(q!==void 0&&q.length>0&&q.length<=z.length){if(q.length===z.length&&q===z)return"";var _=q.length-1,U=-1;for(F=z.length-1;F>=0;--F){var O=z.charCodeAt(F);if(O===47){if(!G){W=F+1;break}}else U===-1&&(G=!1,U=F+1),_>=0&&(O===q.charCodeAt(_)?--_===-1&&(j=F):(_=-1,j=U))}return W===j?j=U:j===-1&&(j=z.length),z.slice(W,j)}else{for(F=z.length-1;F>=0;--F)if(z.charCodeAt(F)===47){if(!G){W=F+1;break}}else j===-1&&(G=!1,j=F+1);return j===-1?"":z.slice(W,j)}},extname:function(z){Z(z);for(var q=-1,W=0,j=-1,G=!0,F=0,_=z.length-1;_>=0;--_){var U=z.charCodeAt(_);if(U===47){if(!G){W=_+1;break}continue}j===-1&&(G=!1,j=_+1),U===46?q===-1?q=_:F!==1&&(F=1):q!==-1&&(F=-1)}return q===-1||j===-1||F===0||F===1&&q===j-1&&q===W+1?"":z.slice(q,j)},format:function(z){if(z===null||typeof z!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof z);return Q("/",z)},parse:function(z){Z(z);var q={root:"",dir:"",base:"",ext:"",name:""};if(z.length===0)return q;var W=z.charCodeAt(0),j=W===47,G;j?(q.root="/",G=1):G=0;for(var F=-1,_=0,U=-1,O=!0,V=z.length-1,M=0;V>=G;--V){if(W=z.charCodeAt(V),W===47){if(!O){_=V+1;break}continue}U===-1&&(O=!1,U=V+1),W===46?F===-1?F=V:M!==1&&(M=1):F!==-1&&(M=-1)}return F===-1||U===-1||M===0||M===1&&F===U-1&&F===_+1?U!==-1&&(_===0&&j?q.base=q.name=z.slice(1,U):q.base=q.name=z.slice(_,U)):(_===0&&j?(q.name=z.slice(1,F),q.base=z.slice(1,U)):(q.name=z.slice(_,F),q.base=z.slice(_,U)),q.ext=z.slice(F,U)),_>0?q.dir=z.slice(0,_-1):j&&(q.dir="/"),q},sep:"/",delimiter:":",win32:null,posix:null};H.posix=H,J.exports=H}),X5=Zz(Qz()),m0=X5,Hz=X5;m0.parse??=k5;Hz.parse??=k5;$6={resolve:m0.resolve.bind(m0),normalize:m0.normalize.bind(m0),isAbsolute:m0.isAbsolute.bind(m0),join:m0.join.bind(m0),relative:m0.relative.bind(m0),toNamespacedPath:O5,dirname:m0.dirname.bind(m0),basename:m0.basename.bind(m0),extname:m0.extname.bind(m0),format:m0.format.bind(m0),parse:m0.parse.bind(m0),sep:"/",delimiter:":",win32:void 0,posix:void 0,_makeLong:O5},i9={sep:"\\",delimiter:";",win32:void 0,...$6,posix:$6};$6.win32=i9.win32=i9;$6.posix=$6;zz=$6,{resolve:qz,normalize:Wz,isAbsolute:jz,join:Gz,relative:Fz,toNamespacedPath:_z,dirname:Uz,basename:Vz,extname:Mz,format:Oz,parse:Yz,sep:Xz,delimiter:kz}=$6});var F8={};x$(F8,{validateXML:()=>EK,validateSVGAsync:()=>nz,validateSVG:()=>TK,straightCurves:()=>m9,sortDefsChildren:()=>QK,sortAttrs:()=>ZK,simplifyPaths:()=>uK,simplifyPath:()=>DK,saveOutput:()=>b5,reusePaths:()=>HK,removeXlink:()=>WK,removeXMLProcInst:()=>x5,removeXMLNS:()=>l5,removeViewBox:()=>c5,removeUselessDefs:()=>y5,removeUselessCommands:()=>c9,removeUnknownsAndDefaults:()=>D5,removeTitle:()=>m5,removeStyleElement:()=>qK,removeScriptElement:()=>s5,removeRasterImages:()=>n5,removeOffCanvasPath:()=>zK,removeNonInheritableGroupAttrs:()=>h5,removeMetadata:()=>h$,removeLeadingZero:()=>D9,removeHiddenElements:()=>S$,removeEmptyText:()=>u5,removeEmptyContainers:()=>v$,removeEmptyAttrs:()=>p5,removeElementsByAttr:()=>MK,removeEditorsNSData:()=>Q8,removeDoctype:()=>g5,removeDimensions:()=>_K,removeDesc:()=>d5,removeComments:()=>D$,removeAttrs:()=>VK,removeAttributesBySelector:()=>UK,printHierarchicalMatrix:()=>gz,presetNone:()=>W8,presetDefault:()=>q8,prefixIds:()=>FK,optimizePaths:()=>yK,optimizeAnimationTiming:()=>hK,optimize:()=>YK,negativeExtraSpace:()=>h9,moveGroupAttrsToElems:()=>$K,moveElemsAttrsToGroup:()=>JK,minifyStyles:()=>z8,mergePaths:()=>e5,measureDistance:()=>AK,loadInput:()=>a6,lineShorthands:()=>g9,inlineStyles:()=>KK,imageToPath:()=>CK,generateOutput:()=>t6,generateFullCompatibilityMatrix:()=>uz,generateFlexibleSVGTable:()=>bK,generateCompatibilityMatrixSVG:()=>xz,generateCompatibilityMatrixFlexible:()=>mz,formatPrecision:()=>T5,floatPrecision:()=>p9,flattenUseElements:()=>IK,flattenPatterns:()=>BK,flattenMasks:()=>LK,flattenGradients:()=>wK,flattenFilters:()=>NK,flattenClipPaths:()=>kK,flattenAll:()=>vK,fixInvalidSVG:()=>fK,exportEmbeddedResources:()=>mK,escapeXml:()=>Pz,embedExternalDependencies:()=>G8,detectOutputTarget:()=>K8,detectInputType:()=>r6,detectCollisions:()=>PK,default:()=>Wq,decomposeTransform:()=>gK,createOperation:()=>G0,createConfig:()=>XK,convertTransform:()=>r5,convertToZ:()=>x9,convertToRelative:()=>y9,convertToAbsolute:()=>u9,convertStyleToAttrs:()=>H8,convertShapesToPath:()=>o5,convertQuadraticToSmooth:()=>n9,convertPathData:()=>i5,convertEllipseToCircle:()=>a5,convertCubicToSmooth:()=>s9,convertCubicToQuadratic:()=>l9,convertColors:()=>y$,collapseRepeated:()=>d9,collapseGroups:()=>t5,cleanupNumericValues:()=>f$,cleanupListOfValues:()=>f5,cleanupIds:()=>Z8,cleanupEnableBackground:()=>v5,cleanupAttributes:()=>S5,arcShorthands:()=>o9,applyPreset:()=>OK,analyzeCompatibilityMatrix:()=>yz,analyzeCompatibility:()=>fz,addClassesToSVGElement:()=>GK,addAttributesToSVGElement:()=>jK,ValidationSeverity:()=>A0,PRECISION_LEVELS:()=>E5,OutputTarget:()=>F7,OutputFormat:()=>_7,MAX_PRECISION:()=>i6,InputType:()=>D0,DEFAULT_PRECISION:()=>E$});/*!
|
|
2
|
+
* decimal.js v10.6.0
|
|
3
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
4
|
+
* https://github.com/MikeMcl/decimal.js
|
|
5
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
6
|
+
* MIT Licence
|
|
7
|
+
*/var U6=9000000000000000,n7=1e9,m$="0123456789abcdef",K$="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Z$="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",d$={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-U6,maxE:U6,crypto:!1},R8,S7,P0=!0,H$="[DecimalError] ",l7=H$+"Invalid argument: ",B8=H$+"Precision limit exceeded",N8=H$+"crypto unavailable",I8="[object Decimal]",a0=Math.floor,p0=Math.pow,iK=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,rK=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,aK=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,C8=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,k7=1e7,w0=7,tK=9007199254740991,eK=K$.length-1,p$=Z$.length-1,Z0={toStringTag:I8};Z0.absoluteValue=Z0.abs=function(){var $=new this.constructor(this);if($.s<0)$.s=1;return Y0($)};Z0.ceil=function(){return Y0(new this.constructor(this),this.e+1,2)};Z0.clampedTo=Z0.clamp=function($,J){var Z,K=this,Q=K.constructor;if($=new Q($),J=new Q(J),!$.s||!J.s)return new Q(NaN);if($.gt(J))throw Error(l7+J);return Z=K.cmp($),Z<0?$:K.cmp(J)>0?J:new Q(K)};Z0.comparedTo=Z0.cmp=function($){var J,Z,K,Q,H=this,z=H.d,q=($=new H.constructor($)).d,W=H.s,j=$.s;if(!z||!q)return!W||!j?NaN:W!==j?W:z===q?0:!z^W<0?1:-1;if(!z[0]||!q[0])return z[0]?W:q[0]?-j:0;if(W!==j)return W;if(H.e!==$.e)return H.e>$.e^W<0?1:-1;K=z.length,Q=q.length;for(J=0,Z=K<Q?K:Q;J<Z;++J)if(z[J]!==q[J])return z[J]>q[J]^W<0?1:-1;return K===Q?0:K>Q^W<0?1:-1};Z0.cosine=Z0.cos=function(){var $,J,Z=this,K=Z.constructor;if(!Z.d)return new K(NaN);if(!Z.d[0])return new K(1);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Z.e,Z.sd())+w0,K.rounding=1,Z=$Z(K,b8(K,Z)),K.precision=$,K.rounding=J,Y0(S7==2||S7==3?Z.neg():Z,$,J,!0)};Z0.cubeRoot=Z0.cbrt=function(){var $,J,Z,K,Q,H,z,q,W,j,G=this,F=G.constructor;if(!G.isFinite()||G.isZero())return new F(G);if(P0=!1,H=G.s*p0(G.s*G,0.3333333333333333),!H||Math.abs(H)==1/0){if(Z=o0(G.d),$=G.e,H=($-Z.length+1)%3)Z+=H==1||H==-2?"0":"00";if(H=p0(Z,0.3333333333333333),$=a0(($+1)/3)-($%3==($<0?-1:2)),H==1/0)Z="5e"+$;else Z=H.toExponential(),Z=Z.slice(0,Z.indexOf("e")+1)+$;K=new F(Z),K.s=G.s}else K=new F(H.toString());z=($=F.precision)+3;for(;;)if(q=K,W=q.times(q).times(q),j=W.plus(G),K=v0(j.plus(G).times(q),j.plus(W),z+2,1),o0(q.d).slice(0,z)===(Z=o0(K.d)).slice(0,z))if(Z=Z.slice(z-3,z+1),Z=="9999"||!Q&&Z=="4999"){if(!Q){if(Y0(q,$+1,0),q.times(q).times(q).eq(G)){K=q;break}}z+=4,Q=1}else{if(!+Z||!+Z.slice(1)&&Z.charAt(0)=="5")Y0(K,$+1,1),J=!K.times(K).times(K).eq(G);break}return P0=!0,Y0(K,$,F.rounding,J)};Z0.decimalPlaces=Z0.dp=function(){var $,J=this.d,Z=NaN;if(J){if($=J.length-1,Z=($-a0(this.e/w0))*w0,$=J[$],$)for(;$%10==0;$/=10)Z--;if(Z<0)Z=0}return Z};Z0.dividedBy=Z0.div=function($){return v0(this,new this.constructor($))};Z0.dividedToIntegerBy=Z0.divToInt=function($){var J=this,Z=J.constructor;return Y0(v0(J,new Z($),0,1,1),Z.precision,Z.rounding)};Z0.equals=Z0.eq=function($){return this.cmp($)===0};Z0.floor=function(){return Y0(new this.constructor(this),this.e+1,3)};Z0.greaterThan=Z0.gt=function($){return this.cmp($)>0};Z0.greaterThanOrEqualTo=Z0.gte=function($){var J=this.cmp($);return J==1||J===0};Z0.hyperbolicCosine=Z0.cosh=function(){var $,J,Z,K,Q,H=this,z=H.constructor,q=new z(1);if(!H.isFinite())return new z(H.s?1/0:NaN);if(H.isZero())return q;if(Z=z.precision,K=z.rounding,z.precision=Z+Math.max(H.e,H.sd())+4,z.rounding=1,Q=H.d.length,Q<32)$=Math.ceil(Q/3),J=(1/q$(4,$)).toString();else $=16,J="2.3283064365386962890625e-10";H=V6(z,1,H.times(J),new z(1),!0);var W,j=$,G=new z(8);for(;j--;)W=H.times(H),H=q.minus(W.times(G.minus(W.times(G))));return Y0(H,z.precision=Z,z.rounding=K,!0)};Z0.hyperbolicSine=Z0.sinh=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(!Q.isFinite()||Q.isZero())return new H(Q);if(J=H.precision,Z=H.rounding,H.precision=J+Math.max(Q.e,Q.sd())+4,H.rounding=1,K=Q.d.length,K<3)Q=V6(H,2,Q,Q,!0);else{$=1.4*Math.sqrt(K),$=$>16?16:$|0,Q=Q.times(1/q$(5,$)),Q=V6(H,2,Q,Q,!0);var z,q=new H(5),W=new H(16),j=new H(20);for(;$--;)z=Q.times(Q),Q=Q.times(q.plus(z.times(W.times(z).plus(j))))}return H.precision=J,H.rounding=Z,Y0(Q,J,Z,!0)};Z0.hyperbolicTangent=Z0.tanh=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(Z.s);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+7,K.rounding=1,v0(Z.sinh(),Z.cosh(),K.precision=$,K.rounding=J)};Z0.inverseCosine=Z0.acos=function(){var $=this,J=$.constructor,Z=$.abs().cmp(1),K=J.precision,Q=J.rounding;if(Z!==-1)return Z===0?$.isNeg()?I7(J,K,Q):new J(0):new J(NaN);if($.isZero())return I7(J,K+4,Q).times(0.5);return J.precision=K+6,J.rounding=1,$=new J(1).minus($).div($.plus(1)).sqrt().atan(),J.precision=K,J.rounding=Q,$.times(2)};Z0.inverseHyperbolicCosine=Z0.acosh=function(){var $,J,Z=this,K=Z.constructor;if(Z.lte(1))return new K(Z.eq(1)?0:NaN);if(!Z.isFinite())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Math.abs(Z.e),Z.sd())+4,K.rounding=1,P0=!1,Z=Z.times(Z).minus(1).sqrt().plus(Z),P0=!0,K.precision=$,K.rounding=J,Z.ln()};Z0.inverseHyperbolicSine=Z0.asinh=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite()||Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+2*Math.max(Math.abs(Z.e),Z.sd())+6,K.rounding=1,P0=!1,Z=Z.times(Z).plus(1).sqrt().plus(Z),P0=!0,K.precision=$,K.rounding=J,Z.ln()};Z0.inverseHyperbolicTangent=Z0.atanh=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(!Q.isFinite())return new H(NaN);if(Q.e>=0)return new H(Q.abs().eq(1)?Q.s/0:Q.isZero()?Q:NaN);if($=H.precision,J=H.rounding,K=Q.sd(),Math.max(K,$)<2*-Q.e-1)return Y0(new H(Q),$,J,!0);return H.precision=Z=K-Q.e,Q=v0(Q.plus(1),new H(1).minus(Q),Z+$,1),H.precision=$+4,H.rounding=1,Q=Q.ln(),H.precision=$,H.rounding=J,Q.times(0.5)};Z0.inverseSine=Z0.asin=function(){var $,J,Z,K,Q=this,H=Q.constructor;if(Q.isZero())return new H(Q);if(J=Q.abs().cmp(1),Z=H.precision,K=H.rounding,J!==-1){if(J===0)return $=I7(H,Z+4,K).times(0.5),$.s=Q.s,$;return new H(NaN)}return H.precision=Z+6,H.rounding=1,Q=Q.div(new H(1).minus(Q.times(Q)).sqrt().plus(1)).atan(),H.precision=Z,H.rounding=K,Q.times(2)};Z0.inverseTangent=Z0.atan=function(){var $,J,Z,K,Q,H,z,q,W,j=this,G=j.constructor,F=G.precision,_=G.rounding;if(!j.isFinite()){if(!j.s)return new G(NaN);if(F+4<=p$)return z=I7(G,F+4,_).times(0.5),z.s=j.s,z}else if(j.isZero())return new G(j);else if(j.abs().eq(1)&&F+4<=p$)return z=I7(G,F+4,_).times(0.25),z.s=j.s,z;G.precision=q=F+10,G.rounding=1,Z=Math.min(28,q/w0+2|0);for($=Z;$;--$)j=j.div(j.times(j).plus(1).sqrt().plus(1));P0=!1,J=Math.ceil(q/w0),K=1,W=j.times(j),z=new G(j),Q=j;for(;$!==-1;)if(Q=Q.times(W),H=z.minus(Q.div(K+=2)),Q=Q.times(W),z=H.plus(Q.div(K+=2)),z.d[J]!==void 0)for($=J;z.d[$]===H.d[$]&&$--;);if(Z)z=z.times(2<<Z-1);return P0=!0,Y0(z,G.precision=F,G.rounding=_,!0)};Z0.isFinite=function(){return!!this.d};Z0.isInteger=Z0.isInt=function(){return!!this.d&&a0(this.e/w0)>this.d.length-2};Z0.isNaN=function(){return!this.s};Z0.isNegative=Z0.isNeg=function(){return this.s<0};Z0.isPositive=Z0.isPos=function(){return this.s>0};Z0.isZero=function(){return!!this.d&&this.d[0]===0};Z0.lessThan=Z0.lt=function($){return this.cmp($)<0};Z0.lessThanOrEqualTo=Z0.lte=function($){return this.cmp($)<1};Z0.logarithm=Z0.log=function($){var J,Z,K,Q,H,z,q,W,j=this,G=j.constructor,F=G.precision,_=G.rounding,U=5;if($==null)$=new G(10),J=!0;else{if($=new G($),Z=$.d,$.s<0||!Z||!Z[0]||$.eq(1))return new G(NaN);J=$.eq(10)}if(Z=j.d,j.s<0||!Z||!Z[0]||j.eq(1))return new G(Z&&!Z[0]?-1/0:j.s!=1?NaN:Z?0:1/0);if(J)if(Z.length>1)H=!0;else{for(Q=Z[0];Q%10===0;)Q/=10;H=Q!==1}if(P0=!1,q=F+U,z=c7(j,q),K=J?Q$(G,q+10):c7($,q),W=v0(z,K,q,1),T6(W.d,Q=F,_))do if(q+=10,z=c7(j,q),K=J?Q$(G,q+10):c7($,q),W=v0(z,K,q,1),!H){if(+o0(W.d).slice(Q+1,Q+15)+1==100000000000000)W=Y0(W,F+1,0);break}while(T6(W.d,Q+=10,_));return P0=!0,Y0(W,F,_)};Z0.minus=Z0.sub=function($){var J,Z,K,Q,H,z,q,W,j,G,F,_,U=this,O=U.constructor;if($=new O($),!U.d||!$.d){if(!U.s||!$.s)$=new O(NaN);else if(U.d)$.s=-$.s;else $=new O($.d||U.s!==$.s?U:NaN);return $}if(U.s!=$.s)return $.s=-$.s,U.plus($);if(j=U.d,_=$.d,q=O.precision,W=O.rounding,!j[0]||!_[0]){if(_[0])$.s=-$.s;else if(j[0])$=new O(U);else return new O(W===3?-0:0);return P0?Y0($,q,W):$}if(Z=a0($.e/w0),G=a0(U.e/w0),j=j.slice(),H=G-Z,H){if(F=H<0,F)J=j,H=-H,z=_.length;else J=_,Z=G,z=j.length;if(K=Math.max(Math.ceil(q/w0),z)+2,H>K)H=K,J.length=1;J.reverse();for(K=H;K--;)J.push(0);J.reverse()}else{if(K=j.length,z=_.length,F=K<z,F)z=K;for(K=0;K<z;K++)if(j[K]!=_[K]){F=j[K]<_[K];break}H=0}if(F)J=j,j=_,_=J,$.s=-$.s;z=j.length;for(K=_.length-z;K>0;--K)j[z++]=0;for(K=_.length;K>H;){if(j[--K]<_[K]){for(Q=K;Q&&j[--Q]===0;)j[Q]=k7-1;--j[Q],j[K]+=k7}j[K]-=_[K]}for(;j[--z]===0;)j.pop();for(;j[0]===0;j.shift())--Z;if(!j[0])return new O(W===3?-0:0);return $.d=j,$.e=z$(j,Z),P0?Y0($,q,W):$};Z0.modulo=Z0.mod=function($){var J,Z=this,K=Z.constructor;if($=new K($),!Z.d||!$.s||$.d&&!$.d[0])return new K(NaN);if(!$.d||Z.d&&!Z.d[0])return Y0(new K(Z),K.precision,K.rounding);if(P0=!1,K.modulo==9)J=v0(Z,$.abs(),0,3,1),J.s*=$.s;else J=v0(Z,$,0,K.modulo,1);return J=J.times($),P0=!0,Z.minus(J)};Z0.naturalExponential=Z0.exp=function(){return c$(this)};Z0.naturalLogarithm=Z0.ln=function(){return c7(this)};Z0.negated=Z0.neg=function(){var $=new this.constructor(this);return $.s=-$.s,Y0($)};Z0.plus=Z0.add=function($){var J,Z,K,Q,H,z,q,W,j,G,F=this,_=F.constructor;if($=new _($),!F.d||!$.d){if(!F.s||!$.s)$=new _(NaN);else if(!F.d)$=new _($.d||F.s===$.s?F:NaN);return $}if(F.s!=$.s)return $.s=-$.s,F.minus($);if(j=F.d,G=$.d,q=_.precision,W=_.rounding,!j[0]||!G[0]){if(!G[0])$=new _(F);return P0?Y0($,q,W):$}if(H=a0(F.e/w0),K=a0($.e/w0),j=j.slice(),Q=H-K,Q){if(Q<0)Z=j,Q=-Q,z=G.length;else Z=G,K=H,z=j.length;if(H=Math.ceil(q/w0),z=H>z?H+1:z+1,Q>z)Q=z,Z.length=1;Z.reverse();for(;Q--;)Z.push(0);Z.reverse()}if(z=j.length,Q=G.length,z-Q<0)Q=z,Z=G,G=j,j=Z;for(J=0;Q;)J=(j[--Q]=j[Q]+G[Q]+J)/k7|0,j[Q]%=k7;if(J)j.unshift(J),++K;for(z=j.length;j[--z]==0;)j.pop();return $.d=j,$.e=z$(j,K),P0?Y0($,q,W):$};Z0.precision=Z0.sd=function($){var J,Z=this;if($!==void 0&&$!==!!$&&$!==1&&$!==0)throw Error(l7+$);if(Z.d){if(J=P8(Z.d),$&&Z.e+1>J)J=Z.e+1}else J=NaN;return J};Z0.round=function(){var $=this,J=$.constructor;return Y0(new J($),$.e+1,J.rounding)};Z0.sine=Z0.sin=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(NaN);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+Math.max(Z.e,Z.sd())+w0,K.rounding=1,Z=KZ(K,b8(K,Z)),K.precision=$,K.rounding=J,Y0(S7>2?Z.neg():Z,$,J,!0)};Z0.squareRoot=Z0.sqrt=function(){var $,J,Z,K,Q,H,z=this,q=z.d,W=z.e,j=z.s,G=z.constructor;if(j!==1||!q||!q[0])return new G(!j||j<0&&(!q||q[0])?NaN:q?z:1/0);if(P0=!1,j=Math.sqrt(+z),j==0||j==1/0){if(J=o0(q),(J.length+W)%2==0)J+="0";if(j=Math.sqrt(J),W=a0((W+1)/2)-(W<0||W%2),j==1/0)J="5e"+W;else J=j.toExponential(),J=J.slice(0,J.indexOf("e")+1)+W;K=new G(J)}else K=new G(j.toString());Z=(W=G.precision)+3;for(;;)if(H=K,K=H.plus(v0(z,H,Z+2,1)).times(0.5),o0(H.d).slice(0,Z)===(J=o0(K.d)).slice(0,Z))if(J=J.slice(Z-3,Z+1),J=="9999"||!Q&&J=="4999"){if(!Q){if(Y0(H,W+1,0),H.times(H).eq(z)){K=H;break}}Z+=4,Q=1}else{if(!+J||!+J.slice(1)&&J.charAt(0)=="5")Y0(K,W+1,1),$=!K.times(K).eq(z);break}return P0=!0,Y0(K,W,G.rounding,$)};Z0.tangent=Z0.tan=function(){var $,J,Z=this,K=Z.constructor;if(!Z.isFinite())return new K(NaN);if(Z.isZero())return new K(Z);return $=K.precision,J=K.rounding,K.precision=$+10,K.rounding=1,Z=Z.sin(),Z.s=1,Z=v0(Z,new K(1).minus(Z.times(Z)).sqrt(),$+10,0),K.precision=$,K.rounding=J,Y0(S7==2||S7==4?Z.neg():Z,$,J,!0)};Z0.times=Z0.mul=function($){var J,Z,K,Q,H,z,q,W,j,G=this,F=G.constructor,_=G.d,U=($=new F($)).d;if($.s*=G.s,!_||!_[0]||!U||!U[0])return new F(!$.s||_&&!_[0]&&!U||U&&!U[0]&&!_?NaN:!_||!U?$.s/0:$.s*0);if(Z=a0(G.e/w0)+a0($.e/w0),W=_.length,j=U.length,W<j)H=_,_=U,U=H,z=W,W=j,j=z;H=[],z=W+j;for(K=z;K--;)H.push(0);for(K=j;--K>=0;){J=0;for(Q=W+K;Q>K;)q=H[Q]+U[K]*_[Q-K-1]+J,H[Q--]=q%k7|0,J=q/k7|0;H[Q]=(H[Q]+J)%k7|0}for(;!H[--z];)H.pop();if(J)++Z;else H.shift();return $.d=H,$.e=z$(H,Z),P0?Y0($,F.precision,F.rounding):$};Z0.toBinary=function($,J){return l$(this,2,$,J)};Z0.toDecimalPlaces=Z0.toDP=function($,J){var Z=this,K=Z.constructor;if(Z=new K(Z),$===void 0)return Z;if($7($,0,n7),J===void 0)J=K.rounding;else $7(J,0,8);return Y0(Z,$+Z.e+1,J)};Z0.toExponential=function($,J){var Z,K=this,Q=K.constructor;if($===void 0)Z=C7(K,!0);else{if($7($,0,n7),J===void 0)J=Q.rounding;else $7(J,0,8);K=Y0(new Q(K),$+1,J),Z=C7(K,!0,$+1)}return K.isNeg()&&!K.isZero()?"-"+Z:Z};Z0.toFixed=function($,J){var Z,K,Q=this,H=Q.constructor;if($===void 0)Z=C7(Q);else{if($7($,0,n7),J===void 0)J=H.rounding;else $7(J,0,8);K=Y0(new H(Q),$+Q.e+1,J),Z=C7(K,!1,$+K.e+1)}return Q.isNeg()&&!Q.isZero()?"-"+Z:Z};Z0.toFraction=function($){var J,Z,K,Q,H,z,q,W,j,G,F,_,U=this,O=U.d,V=U.constructor;if(!O)return new V(U);if(j=Z=new V(1),K=W=new V(0),J=new V(K),H=J.e=P8(O)-U.e-1,z=H%w0,J.d[0]=p0(10,z<0?w0+z:z),$==null)$=H>0?J:j;else{if(q=new V($),!q.isInt()||q.lt(j))throw Error(l7+q);$=q.gt(J)?H>0?J:j:q}P0=!1,q=new V(o0(O)),G=V.precision,V.precision=H=O.length*w0*2;for(;;){if(F=v0(q,J,0,1,1),Q=Z.plus(F.times(K)),Q.cmp($)==1)break;Z=K,K=Q,Q=j,j=W.plus(F.times(Q)),W=Q,Q=J,J=q.minus(F.times(Q)),q=Q}return Q=v0($.minus(Z),K,0,1,1),W=W.plus(Q.times(j)),Z=Z.plus(Q.times(K)),W.s=j.s=U.s,_=v0(j,K,H,1).minus(U).abs().cmp(v0(W,Z,H,1).minus(U).abs())<1?[j,K]:[W,Z],V.precision=G,P0=!0,_};Z0.toHexadecimal=Z0.toHex=function($,J){return l$(this,16,$,J)};Z0.toNearest=function($,J){var Z=this,K=Z.constructor;if(Z=new K(Z),$==null){if(!Z.d)return Z;$=new K(1),J=K.rounding}else{if($=new K($),J===void 0)J=K.rounding;else $7(J,0,8);if(!Z.d)return $.s?Z:$;if(!$.d){if($.s)$.s=Z.s;return $}}if($.d[0])P0=!1,Z=v0(Z,$,0,J,1).times($),P0=!0,Y0(Z);else $.s=Z.s,Z=$;return Z};Z0.toNumber=function(){return+this};Z0.toOctal=function($,J){return l$(this,8,$,J)};Z0.toPower=Z0.pow=function($){var J,Z,K,Q,H,z,q=this,W=q.constructor,j=+($=new W($));if(!q.d||!$.d||!q.d[0]||!$.d[0])return new W(p0(+q,j));if(q=new W(q),q.eq(1))return q;if(K=W.precision,H=W.rounding,$.eq(1))return Y0(q,K,H);if(J=a0($.e/w0),J>=$.d.length-1&&(Z=j<0?-j:j)<=tK)return Q=A8(W,q,Z,K),$.s<0?new W(1).div(Q):Y0(Q,K,H);if(z=q.s,z<0){if(J<$.d.length-1)return new W(NaN);if(($.d[J]&1)==0)z=1;if(q.e==0&&q.d[0]==1&&q.d.length==1)return q.s=z,q}if(Z=p0(+q,j),J=Z==0||!isFinite(Z)?a0(j*(Math.log("0."+o0(q.d))/Math.LN10+q.e+1)):new W(Z+"").e,J>W.maxE+1||J<W.minE-1)return new W(J>0?z/0:0);if(P0=!1,W.rounding=q.s=1,Z=Math.min(12,(J+"").length),Q=c$($.times(c7(q,K+Z)),K),Q.d){if(Q=Y0(Q,K+5,1),T6(Q.d,K,H)){if(J=K+10,Q=Y0(c$($.times(c7(q,J+Z)),J),J+5,1),+o0(Q.d).slice(K+1,K+15)+1==100000000000000)Q=Y0(Q,K+1,0)}}return Q.s=z,P0=!0,W.rounding=H,Y0(Q,K,H)};Z0.toPrecision=function($,J){var Z,K=this,Q=K.constructor;if($===void 0)Z=C7(K,K.e<=Q.toExpNeg||K.e>=Q.toExpPos);else{if($7($,1,n7),J===void 0)J=Q.rounding;else $7(J,0,8);K=Y0(new Q(K),$,J),Z=C7(K,$<=K.e||K.e<=Q.toExpNeg,$)}return K.isNeg()&&!K.isZero()?"-"+Z:Z};Z0.toSignificantDigits=Z0.toSD=function($,J){var Z=this,K=Z.constructor;if($===void 0)$=K.precision,J=K.rounding;else if($7($,1,n7),J===void 0)J=K.rounding;else $7(J,0,8);return Y0(new K(Z),$,J)};Z0.toString=function(){var $=this,J=$.constructor,Z=C7($,$.e<=J.toExpNeg||$.e>=J.toExpPos);return $.isNeg()&&!$.isZero()?"-"+Z:Z};Z0.truncated=Z0.trunc=function(){return Y0(new this.constructor(this),this.e+1,1)};Z0.valueOf=Z0.toJSON=function(){var $=this,J=$.constructor,Z=C7($,$.e<=J.toExpNeg||$.e>=J.toExpPos);return $.isNeg()?"-"+Z:Z};function o0($){var J,Z,K,Q=$.length-1,H="",z=$[0];if(Q>0){H+=z;for(J=1;J<Q;J++){if(K=$[J]+"",Z=w0-K.length,Z)H+=p7(Z);H+=K}if(z=$[J],K=z+"",Z=w0-K.length,Z)H+=p7(Z)}else if(z===0)return"0";for(;z%10===0;)z/=10;return H+z}function $7($,J,Z){if($!==~~$||$<J||$>Z)throw Error(l7+$)}function T6($,J,Z,K){var Q,H,z,q;for(H=$[0];H>=10;H/=10)--J;if(--J<0)J+=w0,Q=0;else Q=Math.ceil((J+1)/w0),J%=w0;if(H=p0(10,w0-J),q=$[Q]%H|0,K==null)if(J<3){if(J==0)q=q/100|0;else if(J==1)q=q/10|0;z=Z<4&&q==99999||Z>3&&q==49999||q==50000||q==0}else z=(Z<4&&q+1==H||Z>3&&q+1==H/2)&&($[Q+1]/H/100|0)==p0(10,J-2)-1||(q==H/2||q==0)&&($[Q+1]/H/100|0)==0;else if(J<4){if(J==0)q=q/1000|0;else if(J==1)q=q/100|0;else if(J==2)q=q/10|0;z=(K||Z<4)&&q==9999||!K&&Z>3&&q==4999}else z=((K||Z<4)&&q+1==H||!K&&Z>3&&q+1==H/2)&&($[Q+1]/H/1000|0)==p0(10,J-3)-1;return z}function $$($,J,Z){var K,Q=[0],H,z=0,q=$.length;for(;z<q;){for(H=Q.length;H--;)Q[H]*=J;Q[0]+=m$.indexOf($.charAt(z++));for(K=0;K<Q.length;K++)if(Q[K]>Z-1){if(Q[K+1]===void 0)Q[K+1]=0;Q[K+1]+=Q[K]/Z|0,Q[K]%=Z}}return Q.reverse()}function $Z($,J){var Z,K,Q;if(J.isZero())return J;if(K=J.d.length,K<32)Z=Math.ceil(K/3),Q=(1/q$(4,Z)).toString();else Z=16,Q="2.3283064365386962890625e-10";$.precision+=Z,J=V6($,1,J.times(Q),new $(1));for(var H=Z;H--;){var z=J.times(J);J=z.times(z).minus(z).times(8).plus(1)}return $.precision-=Z,J}var v0=function(){function $(K,Q,H){var z,q=0,W=K.length;for(K=K.slice();W--;)z=K[W]*Q+q,K[W]=z%H|0,q=z/H|0;if(q)K.unshift(q);return K}function J(K,Q,H,z){var q,W;if(H!=z)W=H>z?1:-1;else for(q=W=0;q<H;q++)if(K[q]!=Q[q]){W=K[q]>Q[q]?1:-1;break}return W}function Z(K,Q,H,z){var q=0;for(;H--;)K[H]-=q,q=K[H]<Q[H]?1:0,K[H]=q*z+K[H]-Q[H];for(;!K[0]&&K.length>1;)K.shift()}return function(K,Q,H,z,q,W){var j,G,F,_,U,O,V,M,Y,X,w,R,I,f,u,m,S,x,h,E,d=K.constructor,c=K.s==Q.s?1:-1,p=K.d,N=Q.d;if(!p||!p[0]||!N||!N[0])return new d(!K.s||!Q.s||(p?N&&p[0]==N[0]:!N)?NaN:p&&p[0]==0||!N?c*0:c/0);if(W)U=1,G=K.e-Q.e;else W=k7,U=w0,G=a0(K.e/U)-a0(Q.e/U);h=N.length,S=p.length,Y=new d(c),X=Y.d=[];for(F=0;N[F]==(p[F]||0);F++);if(N[F]>(p[F]||0))G--;if(H==null)f=H=d.precision,z=d.rounding;else if(q)f=H+(K.e-Q.e)+1;else f=H;if(f<0)X.push(1),O=!0;else{if(f=f/U+2|0,F=0,h==1){_=0,N=N[0],f++;for(;(F<S||_)&&f--;F++)u=_*W+(p[F]||0),X[F]=u/N|0,_=u%N|0;O=_||F<S}else{if(_=W/(N[0]+1)|0,_>1)N=$(N,_,W),p=$(p,_,W),h=N.length,S=p.length;m=h,w=p.slice(0,h),R=w.length;for(;R<h;)w[R++]=0;if(E=N.slice(),E.unshift(0),x=N[0],N[1]>=W/2)++x;do{if(_=0,j=J(N,w,h,R),j<0){if(I=w[0],h!=R)I=I*W+(w[1]||0);if(_=I/x|0,_>1){if(_>=W)_=W-1;if(V=$(N,_,W),M=V.length,R=w.length,j=J(V,w,M,R),j==1)_--,Z(V,h<M?E:N,M,W)}else{if(_==0)j=_=1;V=N.slice()}if(M=V.length,M<R)V.unshift(0);if(Z(w,V,R,W),j==-1){if(R=w.length,j=J(N,w,h,R),j<1)_++,Z(w,h<R?E:N,R,W)}R=w.length}else if(j===0)_++,w=[0];if(X[F++]=_,j&&w[0])w[R++]=p[m]||0;else w=[p[m]],R=1}while((m++<S||w[0]!==void 0)&&f--);O=w[0]!==void 0}if(!X[0])X.shift()}if(U==1)Y.e=G,R8=O;else{for(F=1,_=X[0];_>=10;_/=10)F++;Y.e=F+G*U-1,Y0(Y,q?H+Y.e+1:H,z,O)}return Y}}();function Y0($,J,Z,K){var Q,H,z,q,W,j,G,F,_,U=$.constructor;$:if(J!=null){if(F=$.d,!F)return $;for(Q=1,q=F[0];q>=10;q/=10)Q++;if(H=J-Q,H<0)H+=w0,z=J,G=F[_=0],W=G/p0(10,Q-z-1)%10|0;else if(_=Math.ceil((H+1)/w0),q=F.length,_>=q)if(K){for(;q++<=_;)F.push(0);G=W=0,Q=1,H%=w0,z=H-w0+1}else break $;else{G=q=F[_];for(Q=1;q>=10;q/=10)Q++;H%=w0,z=H-w0+Q,W=z<0?0:G/p0(10,Q-z-1)%10|0}if(K=K||J<0||F[_+1]!==void 0||(z<0?G:G%p0(10,Q-z-1)),j=Z<4?(W||K)&&(Z==0||Z==($.s<0?3:2)):W>5||W==5&&(Z==4||K||Z==6&&(H>0?z>0?G/p0(10,Q-z):0:F[_-1])%10&1||Z==($.s<0?8:7)),J<1||!F[0]){if(F.length=0,j)J-=$.e+1,F[0]=p0(10,(w0-J%w0)%w0),$.e=-J||0;else F[0]=$.e=0;return $}if(H==0)F.length=_,q=1,_--;else F.length=_+1,q=p0(10,w0-H),F[_]=z>0?(G/p0(10,Q-z)%p0(10,z)|0)*q:0;if(j)for(;;)if(_==0){for(H=1,z=F[0];z>=10;z/=10)H++;z=F[0]+=q;for(q=1;z>=10;z/=10)q++;if(H!=q){if($.e++,F[0]==k7)F[0]=1}break}else{if(F[_]+=q,F[_]!=k7)break;F[_--]=0,q=1}for(H=F.length;F[--H]===0;)F.pop()}if(P0){if($.e>U.maxE)$.d=null,$.e=NaN;else if($.e<U.minE)$.e=0,$.d=[0]}return $}function C7($,J,Z){if(!$.isFinite())return T8($);var K,Q=$.e,H=o0($.d),z=H.length;if(J){if(Z&&(K=Z-z)>0)H=H.charAt(0)+"."+H.slice(1)+p7(K);else if(z>1)H=H.charAt(0)+"."+H.slice(1);H=H+($.e<0?"e":"e+")+$.e}else if(Q<0){if(H="0."+p7(-Q-1)+H,Z&&(K=Z-z)>0)H+=p7(K)}else if(Q>=z){if(H+=p7(Q+1-z),Z&&(K=Z-Q-1)>0)H=H+"."+p7(K)}else{if((K=Q+1)<z)H=H.slice(0,K)+"."+H.slice(K);if(Z&&(K=Z-z)>0){if(Q+1===z)H+=".";H+=p7(K)}}return H}function z$($,J){var Z=$[0];for(J*=w0;Z>=10;Z/=10)J++;return J}function Q$($,J,Z){if(J>eK){if(P0=!0,Z)$.precision=Z;throw Error(B8)}return Y0(new $(K$),J,1,!0)}function I7($,J,Z){if(J>p$)throw Error(B8);return Y0(new $(Z$),J,Z,!0)}function P8($){var J=$.length-1,Z=J*w0+1;if(J=$[J],J){for(;J%10==0;J/=10)Z--;for(J=$[0];J>=10;J/=10)Z++}return Z}function p7($){var J="";for(;$--;)J+="0";return J}function A8($,J,Z,K){var Q,H=new $(1),z=Math.ceil(K/w0+4);P0=!1;for(;;){if(Z%2){if(H=H.times(J),L8(H.d,z))Q=!0}if(Z=a0(Z/2),Z===0){if(Z=H.d.length-1,Q&&H.d[Z]===0)++H.d[Z];break}J=J.times(J),L8(J.d,z)}return P0=!0,H}function k8($){return $.d[$.d.length-1]&1}function E8($,J,Z){var K,Q,H=new $(J[0]),z=0;for(;++z<J.length;){if(Q=new $(J[z]),!Q.s){H=Q;break}if(K=H.cmp(Q),K===Z||K===0&&H.s===Z)H=Q}return H}function c$($,J){var Z,K,Q,H,z,q,W,j=0,G=0,F=0,_=$.constructor,U=_.rounding,O=_.precision;if(!$.d||!$.d[0]||$.e>17)return new _($.d?!$.d[0]?1:$.s<0?0:1/0:$.s?$.s<0?0:$:NaN);if(J==null)P0=!1,W=O;else W=J;q=new _(0.03125);while($.e>-2)$=$.times(q),F+=5;K=Math.log(p0(2,F))/Math.LN10*2+5|0,W+=K,Z=H=z=new _(1),_.precision=W;for(;;){if(H=Y0(H.times($),W,1),Z=Z.times(++G),q=z.plus(v0(H,Z,W,1)),o0(q.d).slice(0,W)===o0(z.d).slice(0,W)){Q=F;while(Q--)z=Y0(z.times(z),W,1);if(J==null)if(j<3&&T6(z.d,W-K,U,j))_.precision=W+=10,Z=H=q=new _(1),G=0,j++;else return Y0(z,_.precision=O,U,P0=!0);else return _.precision=O,z}z=q}}function c7($,J){var Z,K,Q,H,z,q,W,j,G,F,_,U=1,O=10,V=$,M=V.d,Y=V.constructor,X=Y.rounding,w=Y.precision;if(V.s<0||!M||!M[0]||!V.e&&M[0]==1&&M.length==1)return new Y(M&&!M[0]?-1/0:V.s!=1?NaN:M?0:V);if(J==null)P0=!1,G=w;else G=J;if(Y.precision=G+=O,Z=o0(M),K=Z.charAt(0),Math.abs(H=V.e)<1500000000000000){while(K<7&&K!=1||K==1&&Z.charAt(1)>3)V=V.times($),Z=o0(V.d),K=Z.charAt(0),U++;if(H=V.e,K>1)V=new Y("0."+Z),H++;else V=new Y(K+"."+Z.slice(1))}else return j=Q$(Y,G+2,w).times(H+""),V=c7(new Y(K+"."+Z.slice(1)),G-O).plus(j),Y.precision=w,J==null?Y0(V,w,X,P0=!0):V;F=V,W=z=V=v0(V.minus(1),V.plus(1),G,1),_=Y0(V.times(V),G,1),Q=3;for(;;){if(z=Y0(z.times(_),G,1),j=W.plus(v0(z,new Y(Q),G,1)),o0(j.d).slice(0,G)===o0(W.d).slice(0,G)){if(W=W.times(2),H!==0)W=W.plus(Q$(Y,G+2,w).times(H+""));if(W=v0(W,new Y(U),G,1),J==null)if(T6(W.d,G-O,X,q))Y.precision=G+=O,j=z=V=v0(F.minus(1),F.plus(1),G,1),_=Y0(V.times(V),G,1),Q=q=1;else return Y0(W,Y.precision=w,X,P0=!0);else return Y.precision=w,W}W=j,Q+=2}}function T8($){return String($.s*$.s/0)}function J$($,J){var Z,K,Q;if((Z=J.indexOf("."))>-1)J=J.replace(".","");if((K=J.search(/e/i))>0){if(Z<0)Z=K;Z+=+J.slice(K+1),J=J.substring(0,K)}else if(Z<0)Z=J.length;for(K=0;J.charCodeAt(K)===48;K++);for(Q=J.length;J.charCodeAt(Q-1)===48;--Q);if(J=J.slice(K,Q),J){if(Q-=K,$.e=Z=Z-K-1,$.d=[],K=(Z+1)%w0,Z<0)K+=w0;if(K<Q){if(K)$.d.push(+J.slice(0,K));for(Q-=w0;K<Q;)$.d.push(+J.slice(K,K+=w0));J=J.slice(K),K=w0-J.length}else K-=Q;for(;K--;)J+="0";if($.d.push(+J),P0){if($.e>$.constructor.maxE)$.d=null,$.e=NaN;else if($.e<$.constructor.minE)$.e=0,$.d=[0]}}else $.e=0,$.d=[0];return $}function JZ($,J){var Z,K,Q,H,z,q,W,j,G;if(J.indexOf("_")>-1){if(J=J.replace(/(\d)_(?=\d)/g,"$1"),C8.test(J))return J$($,J)}else if(J==="Infinity"||J==="NaN"){if(!+J)$.s=NaN;return $.e=NaN,$.d=null,$}if(rK.test(J))Z=16,J=J.toLowerCase();else if(iK.test(J))Z=2;else if(aK.test(J))Z=8;else throw Error(l7+J);if(H=J.search(/p/i),H>0)W=+J.slice(H+1),J=J.substring(2,H);else J=J.slice(2);if(H=J.indexOf("."),z=H>=0,K=$.constructor,z)J=J.replace(".",""),q=J.length,H=q-H,Q=A8(K,new K(Z),H,H*2);j=$$(J,Z,k7),G=j.length-1;for(H=G;j[H]===0;--H)j.pop();if(H<0)return new K($.s*0);if($.e=z$(j,G),$.d=j,P0=!1,z)$=v0($,Q,q*4);if(W)$=$.times(Math.abs(W)<54?p0(2,W):b6.pow(2,W));return P0=!0,$}function KZ($,J){var Z,K=J.d.length;if(K<3)return J.isZero()?J:V6($,2,J,J);Z=1.4*Math.sqrt(K),Z=Z>16?16:Z|0,J=J.times(1/q$(5,Z)),J=V6($,2,J,J);var Q,H=new $(5),z=new $(16),q=new $(20);for(;Z--;)Q=J.times(J),J=J.times(H.plus(Q.times(z.times(Q).minus(q))));return J}function V6($,J,Z,K,Q){var H,z,q,W,j=1,G=$.precision,F=Math.ceil(G/w0);P0=!1,W=Z.times(Z),q=new $(K);for(;;){if(z=v0(q.times(W),new $(J++*J++),G,1),q=Q?K.plus(z):K.minus(z),K=v0(z.times(W),new $(J++*J++),G,1),z=q.plus(K),z.d[F]!==void 0){for(H=F;z.d[H]===q.d[H]&&H--;);if(H==-1)break}H=q,q=K,K=z,z=H,j++}return P0=!0,z.d.length=F+1,z}function q$($,J){var Z=$;while(--J)Z*=$;return Z}function b8($,J){var Z,K=J.s<0,Q=I7($,$.precision,1),H=Q.times(0.5);if(J=J.abs(),J.lte(H))return S7=K?4:1,J;if(Z=J.divToInt(Q),Z.isZero())S7=K?3:2;else{if(J=J.minus(Z.times(Q)),J.lte(H))return S7=k8(Z)?K?2:3:K?4:1,J;S7=k8(Z)?K?1:4:K?3:2}return J.minus(Q).abs()}function l$($,J,Z,K){var Q,H,z,q,W,j,G,F,_,U=$.constructor,O=Z!==void 0;if(O)if($7(Z,1,n7),K===void 0)K=U.rounding;else $7(K,0,8);else Z=U.precision,K=U.rounding;if(!$.isFinite())G=T8($);else{if(G=C7($),z=G.indexOf("."),O){if(Q=2,J==16)Z=Z*4-3;else if(J==8)Z=Z*3-2}else Q=J;if(z>=0)G=G.replace(".",""),_=new U(1),_.e=G.length-z,_.d=$$(C7(_),10,Q),_.e=_.d.length;F=$$(G,10,Q),H=W=F.length;for(;F[--W]==0;)F.pop();if(!F[0])G=O?"0p+0":"0";else{if(z<0)H--;else $=new U($),$.d=F,$.e=H,$=v0($,_,Z,K,0,Q),F=$.d,H=$.e,j=R8;if(z=F[Z],q=Q/2,j=j||F[Z+1]!==void 0,j=K<4?(z!==void 0||j)&&(K===0||K===($.s<0?3:2)):z>q||z===q&&(K===4||j||K===6&&F[Z-1]&1||K===($.s<0?8:7)),F.length=Z,j){for(;++F[--Z]>Q-1;)if(F[Z]=0,!Z)++H,F.unshift(1)}for(W=F.length;!F[W-1];--W);for(z=0,G="";z<W;z++)G+=m$.charAt(F[z]);if(O){if(W>1)if(J==16||J==8){z=J==16?4:3;for(--W;W%z;W++)G+="0";F=$$(G,Q,J);for(W=F.length;!F[W-1];--W);for(z=1,G="1.";z<W;z++)G+=m$.charAt(F[z])}else G=G.charAt(0)+"."+G.slice(1);G=G+(H<0?"p":"p+")+H}else if(H<0){for(;++H;)G="0"+G;G="0."+G}else if(++H>W)for(H-=W;H--;)G+="0";else if(H<W)G=G.slice(0,H)+"."+G.slice(H)}G=(J==16?"0x":J==2?"0b":J==8?"0o":"")+G}return $.s<0?"-"+G:G}function L8($,J){if($.length>J)return $.length=J,!0}function ZZ($){return new this($).abs()}function QZ($){return new this($).acos()}function HZ($){return new this($).acosh()}function zZ($,J){return new this($).plus(J)}function qZ($){return new this($).asin()}function WZ($){return new this($).asinh()}function jZ($){return new this($).atan()}function GZ($){return new this($).atanh()}function FZ($,J){$=new this($),J=new this(J);var Z,K=this.precision,Q=this.rounding,H=K+4;if(!$.s||!J.s)Z=new this(NaN);else if(!$.d&&!J.d)Z=I7(this,H,1).times(J.s>0?0.25:0.75),Z.s=$.s;else if(!J.d||$.isZero())Z=J.s<0?I7(this,K,Q):new this(0),Z.s=$.s;else if(!$.d||J.isZero())Z=I7(this,H,1).times(0.5),Z.s=$.s;else if(J.s<0)this.precision=H,this.rounding=1,Z=this.atan(v0($,J,H,1)),J=I7(this,H,1),this.precision=K,this.rounding=Q,Z=$.s<0?Z.minus(J):Z.plus(J);else Z=this.atan(v0($,J,H,1));return Z}function _Z($){return new this($).cbrt()}function UZ($){return Y0($=new this($),$.e+1,2)}function VZ($,J,Z){return new this($).clamp(J,Z)}function MZ($){if(!$||typeof $!=="object")throw Error(H$+"Object expected");var J,Z,K,Q=$.defaults===!0,H=["precision",1,n7,"rounding",0,8,"toExpNeg",-U6,0,"toExpPos",0,U6,"maxE",0,U6,"minE",-U6,0,"modulo",0,9];for(J=0;J<H.length;J+=3){if(Z=H[J],Q)this[Z]=d$[Z];if((K=$[Z])!==void 0)if(a0(K)===K&&K>=H[J+1]&&K<=H[J+2])this[Z]=K;else throw Error(l7+Z+": "+K)}if(Z="crypto",Q)this[Z]=d$[Z];if((K=$[Z])!==void 0)if(K===!0||K===!1||K===0||K===1)if(K)if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[Z]=!0;else throw Error(N8);else this[Z]=!1;else throw Error(l7+Z+": "+K);return this}function OZ($){return new this($).cos()}function YZ($){return new this($).cosh()}function f8($){var J,Z,K;function Q(H){var z,q,W,j=this;if(!(j instanceof Q))return new Q(H);if(j.constructor=Q,w8(H)){if(j.s=H.s,P0)if(!H.d||H.e>Q.maxE)j.e=NaN,j.d=null;else if(H.e<Q.minE)j.e=0,j.d=[0];else j.e=H.e,j.d=H.d.slice();else j.e=H.e,j.d=H.d?H.d.slice():H.d;return}if(W=typeof H,W==="number"){if(H===0){j.s=1/H<0?-1:1,j.e=0,j.d=[0];return}if(H<0)H=-H,j.s=-1;else j.s=1;if(H===~~H&&H<1e7){for(z=0,q=H;q>=10;q/=10)z++;if(P0)if(z>Q.maxE)j.e=NaN,j.d=null;else if(z<Q.minE)j.e=0,j.d=[0];else j.e=z,j.d=[H];else j.e=z,j.d=[H];return}if(H*0!==0){if(!H)j.s=NaN;j.e=NaN,j.d=null;return}return J$(j,H.toString())}if(W==="string"){if((q=H.charCodeAt(0))===45)H=H.slice(1),j.s=-1;else{if(q===43)H=H.slice(1);j.s=1}return C8.test(H)?J$(j,H):JZ(j,H)}if(W==="bigint"){if(H<0)H=-H,j.s=-1;else j.s=1;return J$(j,H.toString())}throw Error(l7+H)}if(Q.prototype=Z0,Q.ROUND_UP=0,Q.ROUND_DOWN=1,Q.ROUND_CEIL=2,Q.ROUND_FLOOR=3,Q.ROUND_HALF_UP=4,Q.ROUND_HALF_DOWN=5,Q.ROUND_HALF_EVEN=6,Q.ROUND_HALF_CEIL=7,Q.ROUND_HALF_FLOOR=8,Q.EUCLID=9,Q.config=Q.set=MZ,Q.clone=f8,Q.isDecimal=w8,Q.abs=ZZ,Q.acos=QZ,Q.acosh=HZ,Q.add=zZ,Q.asin=qZ,Q.asinh=WZ,Q.atan=jZ,Q.atanh=GZ,Q.atan2=FZ,Q.cbrt=_Z,Q.ceil=UZ,Q.clamp=VZ,Q.cos=OZ,Q.cosh=YZ,Q.div=XZ,Q.exp=kZ,Q.floor=LZ,Q.hypot=wZ,Q.ln=RZ,Q.log=BZ,Q.log10=IZ,Q.log2=NZ,Q.max=CZ,Q.min=PZ,Q.mod=AZ,Q.mul=EZ,Q.pow=TZ,Q.random=bZ,Q.round=fZ,Q.sign=SZ,Q.sin=vZ,Q.sinh=DZ,Q.sqrt=hZ,Q.sub=yZ,Q.sum=uZ,Q.tan=gZ,Q.tanh=xZ,Q.trunc=mZ,$===void 0)$={};if($){if($.defaults!==!0){K=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];for(J=0;J<K.length;)if(!$.hasOwnProperty(Z=K[J++]))$[Z]=this[Z]}}return Q.config($),Q}function XZ($,J){return new this($).div(J)}function kZ($){return new this($).exp()}function LZ($){return Y0($=new this($),$.e+1,3)}function wZ(){var $,J,Z=new this(0);P0=!1;for($=0;$<arguments.length;)if(J=new this(arguments[$++]),!J.d){if(J.s)return P0=!0,new this(1/0);Z=J}else if(Z.d)Z=Z.plus(J.times(J));return P0=!0,Z.sqrt()}function w8($){return $ instanceof b6||$&&$.toStringTag===I8||!1}function RZ($){return new this($).ln()}function BZ($,J){return new this($).log(J)}function NZ($){return new this($).log(2)}function IZ($){return new this($).log(10)}function CZ(){return E8(this,arguments,-1)}function PZ(){return E8(this,arguments,1)}function AZ($,J){return new this($).mod(J)}function EZ($,J){return new this($).mul(J)}function TZ($,J){return new this($).pow(J)}function bZ($){var J,Z,K,Q,H=0,z=new this(1),q=[];if($===void 0)$=this.precision;else $7($,1,n7);if(K=Math.ceil($/w0),!this.crypto)for(;H<K;)q[H++]=Math.random()*1e7|0;else if(crypto.getRandomValues){J=crypto.getRandomValues(new Uint32Array(K));for(;H<K;)if(Q=J[H],Q>=4290000000)J[H]=crypto.getRandomValues(new Uint32Array(1))[0];else q[H++]=Q%1e7}else if(crypto.randomBytes){J=crypto.randomBytes(K*=4);for(;H<K;)if(Q=J[H]+(J[H+1]<<8)+(J[H+2]<<16)+((J[H+3]&127)<<24),Q>=2140000000)crypto.randomBytes(4).copy(J,H);else q.push(Q%1e7),H+=4;H=K/4}else throw Error(N8);if(K=q[--H],$%=w0,K&&$)Q=p0(10,w0-$),q[H]=(K/Q|0)*Q;for(;q[H]===0;H--)q.pop();if(H<0)Z=0,q=[0];else{Z=-1;for(;q[0]===0;Z-=w0)q.shift();for(K=1,Q=q[0];Q>=10;Q/=10)K++;if(K<w0)Z-=w0-K}return z.e=Z,z.d=q,z}function fZ($){return Y0($=new this($),$.e+1,this.rounding)}function SZ($){return $=new this($),$.d?$.d[0]?$.s:0*$.s:$.s||NaN}function vZ($){return new this($).sin()}function DZ($){return new this($).sinh()}function hZ($){return new this($).sqrt()}function yZ($,J){return new this($).sub(J)}function uZ(){var $=0,J=arguments,Z=new this(J[$]);P0=!1;for(;Z.s&&++$<J.length;)Z=Z.plus(J[$]);return P0=!0,Y0(Z,this.precision,this.rounding)}function gZ($){return new this($).tan()}function xZ($){return new this($).tanh()}function mZ($){return Y0($=new this($),$.e+1,1)}Z0[Symbol.for("nodejs.util.inspect.custom")]=Z0.toString;Z0[Symbol.toStringTag]="Decimal";var b6=Z0.constructor=f8(d$);K$=new b6(K$);Z$=new b6(Z$);var k=b6;k.set({precision:80});var Uq=new k("1e-40"),Vq=new k("1e-10");var n$=($)=>{if($===null||$===void 0)throw new Error(`Cannot convert ${$===null?"null":"undefined"} to Decimal`);if($ instanceof k)return $;try{return new k($)}catch(J){throw new Error(`Invalid numeric value: ${J.message}`)}};class f0{constructor($){if(!Array.isArray($))throw new Error("Vector requires array");if($.length===0)throw new Error("Vector requires at least one component");try{this.data=$.map((J,Z)=>{if(J===null||J===void 0)throw new Error(`Vector component at index ${Z} is ${J===null?"null":"undefined"}`);return n$(J)})}catch(J){throw new Error(`Vector constructor failed: ${J.message}`)}this.length=this.data.length}static from($){if($===null||$===void 0)throw new Error(`Vector.from: argument is ${$===null?"null":"undefined"}`);return new f0($)}clone(){return new f0(this.data.map(($)=>new k($)))}toArray(){return this.data.slice()}toNumberArray(){return this.data.map(($)=>$.toNumber())}toStringArray(){return this.data.map(($)=>$.toString())}add($){if(!$||!($ instanceof f0))throw new Error("add: argument must be a Vector");if(this.length!==$.length)throw new Error(`add: dimension mismatch (${this.length} vs ${$.length})`);return new f0(this.data.map((J,Z)=>J.plus($.data[Z])))}sub($){if(!$||!($ instanceof f0))throw new Error("sub: argument must be a Vector");if(this.length!==$.length)throw new Error(`sub: dimension mismatch (${this.length} vs ${$.length})`);return new f0(this.data.map((J,Z)=>J.minus($.data[Z])))}scale($){if($===null||$===void 0)throw new Error(`scale: scalar is ${$===null?"null":"undefined"}`);let J;try{J=n$($)}catch(Z){throw new Error(`scale: invalid scalar - ${Z.message}`)}return new f0(this.data.map((Z)=>Z.mul(J)))}negate(){return new f0(this.data.map(($)=>$.negated()))}dot($){if(!$||!($ instanceof f0))throw new Error("dot: argument must be a Vector");if(this.length!==$.length)throw new Error(`dot: dimension mismatch (${this.length} vs ${$.length})`);return this.data.reduce((J,Z,K)=>J.plus(Z.mul($.data[K])),new k(0))}outer($){if(!$||!($ instanceof f0))throw new Error("outer: argument must be a Vector");if(this.length===0||$.length===0)throw new Error("outer: cannot compute outer product with empty vector");let J=this.length,Z=$.length;return Array.from({length:J},(Q,H)=>Array.from({length:Z},(z,q)=>this.data[H].mul($.data[q])))}cross($){if(!$||!($ instanceof f0))throw new Error("cross: argument must be a Vector");if(this.length!==3||$.length!==3)throw new Error(`cross: requires 3D vectors (got ${this.length}D and ${$.length}D)`);let[J,Z,K]=this.data,[Q,H,z]=$.data;return new f0([Z.mul(z).minus(K.mul(H)),K.mul(Q).minus(J.mul(z)),J.mul(H).minus(Z.mul(Q))])}norm(){let $=new k(0);for(let J of this.data)$=$.plus(J.mul(J));return $.sqrt()}normalize(){let $=this.norm();if($.isZero())throw new Error("Cannot normalize zero vector");return this.scale(new k(1).div($))}angleBetween($){if(!$||!($ instanceof f0))throw new Error("angleBetween: argument must be a Vector");if(this.length!==$.length)throw new Error(`angleBetween: dimension mismatch (${this.length} vs ${$.length})`);let J=this.dot($),Z=this.norm(),K=$.norm();if(Z.isZero()||K.isZero())throw new Error("angleBetween: angle with zero vector is undefined");let H=J.div(Z.mul(K)).toNumber(),z=Math.min(1,Math.max(-1,H));return new k(Math.acos(z))}projectOnto($){if(!$||!($ instanceof f0))throw new Error("projectOnto: argument must be a Vector");if(this.length!==$.length)throw new Error(`projectOnto: dimension mismatch (${this.length} vs ${$.length})`);let J=$.dot($);if(J.isZero())throw new Error("projectOnto: cannot project onto zero vector");let Z=this.dot($).div(J);return $.scale(Z)}orthogonal(){if(this.norm().isZero())throw new Error("orthogonal: cannot find orthogonal vector to zero vector");if(this.length===2)return new f0([this.data[1].negated(),this.data[0]]);for(let J=0;J<this.length;J++){let Z=Array.from({length:this.length},(q,W)=>new k(W===J?1:0)),K=new f0(Z),Q=K.projectOnto(this),H=K.sub(Q);if(!H.norm().isZero())return H.normalize()}throw new Error("orthogonal: unable to find orthogonal vector (degenerate case)")}isOrthogonalTo($){if(!$||!($ instanceof f0))throw new Error("isOrthogonalTo: argument must be a Vector");if(this.length!==$.length)throw new Error(`isOrthogonalTo: dimension mismatch (${this.length} vs ${$.length})`);return this.dot($).isZero()}distance($){if(!$||!($ instanceof f0))throw new Error("distance: argument must be a Vector");if(this.length!==$.length)throw new Error(`distance: dimension mismatch (${this.length} vs ${$.length})`);return this.sub($).norm()}equals($,J=0){if(!($ instanceof f0))return!1;if($.length!==this.length)return!1;if(J===null)throw new Error("equals: tolerance cannot be null");let Z;try{if(Z=n$(J),Z.isNaN())throw new Error("equals: tolerance cannot be NaN");if(Z.isNegative())throw new Error("equals: tolerance must be non-negative")}catch(K){throw new Error(`equals: invalid tolerance - ${K.message}`)}for(let K=0;K<this.length;K++)if(this.data[K].minus($.data[K]).abs().greaterThan(Z))return!1;return!0}}var M6=($)=>{if($==null)throw new Error("Cannot convert null or undefined to Decimal");return $ instanceof k?$:new k($)};class _0{constructor($){if(!Array.isArray($)||$.length===0)throw new Error("Matrix requires non-empty 2D array");if(!Array.isArray($[0])||$[0].length===0)throw new Error("Matrix rows must be non-empty arrays");let J=$[0].length;for(let Z of $)if(!Array.isArray(Z)||Z.length!==J)throw new Error("All rows must have same length");this.data=$.map((Z)=>Z.map((K)=>M6(K))),this.rows=$.length,this.cols=J}static from($){return new _0($)}static zeros($,J){if(!Number.isInteger($)||$<=0)throw new Error("rows must be a positive integer");if(!Number.isInteger(J)||J<=0)throw new Error("cols must be a positive integer");let Z=Array.from({length:$},()=>Array.from({length:J},()=>new k(0)));return new _0(Z)}static identity($){if(!Number.isInteger($)||$<=0)throw new Error("size must be a positive integer");let J=Array.from({length:$},(Z,K)=>Array.from({length:$},(Q,H)=>K===H?new k(1):new k(0)));return new _0(J)}clone(){return new _0(this.data.map(($)=>$.map((J)=>new k(J))))}toArrayOfStrings(){return this.data.map(($)=>$.map((J)=>J.toString()))}toNumberArray(){return this.data.map(($)=>$.map((J)=>J.toNumber()))}isSquare(){return this.rows===this.cols}applyToVector($){let J;if($ instanceof f0)J=$;else if(Array.isArray($))J=f0.from($);else throw new Error("applyToVector expects Vector or array");if(this.cols!==J.length)throw new Error("shape mismatch: matrix cols must equal vector length");let Z=[];for(let K=0;K<this.rows;K++){let Q=new k(0);for(let H=0;H<this.cols;H++)Q=Q.plus(this.data[K][H].mul(J.data[H]));Z.push(Q)}return new f0(Z)}add($){if($ instanceof _0){if(this.rows!==$.rows||this.cols!==$.cols)throw new Error("shape mismatch: matrices must have same dimensions");return new _0(this.data.map((J,Z)=>J.map((K,Q)=>K.plus($.data[Z][Q]))))}else{let J=M6($);return new _0(this.data.map((Z)=>Z.map((K)=>K.plus(J))))}}sub($){if($ instanceof _0){if(this.rows!==$.rows||this.cols!==$.cols)throw new Error("shape mismatch: matrices must have same dimensions");return new _0(this.data.map((J,Z)=>J.map((K,Q)=>K.minus($.data[Z][Q]))))}else{let J=M6($);return new _0(this.data.map((Z)=>Z.map((K)=>K.minus(J))))}}mul($){if($ instanceof _0){if(this.cols!==$.rows)throw new Error("shape mismatch: A.cols must equal B.rows for matrix multiplication");let J=Array.from({length:this.rows},()=>Array.from({length:$.cols},()=>new k(0)));for(let Z=0;Z<this.rows;Z++)for(let K=0;K<this.cols;K++){let Q=this.data[Z][K];if(Q.isZero())continue;for(let H=0;H<$.cols;H++)J[Z][H]=J[Z][H].plus(Q.mul($.data[K][H]))}return new _0(J)}else{let J=M6($);return new _0(this.data.map((Z)=>Z.map((K)=>K.mul(J))))}}div($){let J=M6($);if(J.isZero())throw new Error("Cannot divide by zero");return new _0(this.data.map((Z)=>Z.map((K)=>K.div(J))))}negate(){return new _0(this.data.map(($)=>$.map((J)=>J.negated())))}transpose(){let $=Array.from({length:this.cols},(J,Z)=>Array.from({length:this.rows},(K,Q)=>new k(this.data[Q][Z])));return new _0($)}trace(){if(!this.isSquare())throw new Error("Trace only defined for square matrices");let $=new k(0);for(let J=0;J<this.rows;J++)$=$.plus(this.data[J][J]);return $}equals($,J=0){if(!($ instanceof _0))return!1;if(this.rows!==$.rows||this.cols!==$.cols)return!1;let Z=M6(J);if(Z.isNegative()||!Z.isFinite())throw new Error("tolerance must be non-negative and finite");for(let K=0;K<this.rows;K++)for(let Q=0;Q<this.cols;Q++)if(this.data[K][Q].minus($.data[K][Q]).abs().greaterThan(Z))return!1;return!0}lu(){if(!this.isSquare())throw new Error("LU decomposition requires square matrix");let $=this.rows,J=this.data.map((z)=>z.map((q)=>new k(q))),Z=Array.from({length:$},(z,q)=>q),K=Array.from({length:$},()=>Array.from({length:$},()=>new k(0)));for(let z=0;z<$;z++)K[z][z]=new k(1);for(let z=0;z<$;z++){let q=z,W=J[z][z].abs();for(let j=z+1;j<$;j++){let G=J[j][z].abs();if(G.greaterThan(W))W=G,q=j}if(J[q][z].isZero())throw new Error("Singular matrix: LU decomposition failed");if(q!==z){let j=J[z];J[z]=J[q],J[q]=j;let G=Z[z];Z[z]=Z[q],Z[q]=G;for(let F=0;F<z;F++){let _=K[z][F];K[z][F]=K[q][F],K[q][F]=_}}for(let j=z+1;j<$;j++){let G=J[j][z].div(J[z][z]);K[j][z]=G;for(let F=z;F<$;F++)J[j][F]=J[j][F].minus(G.mul(J[z][F]))}}let Q=Array.from({length:$},(z,q)=>Array.from({length:$},(W,j)=>j<q?new k(0):J[q][j])),H=_0.zeros($,$);for(let z=0;z<$;z++)H.data[z][Z[z]]=new k(1);return{L:new _0(K),U:new _0(Q),P:H}}determinant(){if(!this.isSquare())throw new Error("Determinant only defined for square matrices");let $=this.rows,{L:J,U:Z,P:K}=this.lu(),Q=new k(1);for(let q=0;q<$;q++)Q=Q.mul(Z.data[q][q]);let H=[];for(let q=0;q<$;q++)for(let W=0;W<$;W++)if(K.data[q][W].equals(1))H.push(W);let z=0;for(let q=0;q<H.length;q++)for(let W=q+1;W<H.length;W++)if(H[q]>H[W])z++;if(z%2===1)Q=Q.negated();return Q}inverse(){if(!this.isSquare())throw new Error("Inverse only defined for square matrices");let $=this.rows,J=Array.from({length:$},(K,Q)=>Array.from({length:2*$},(H,z)=>z<$?new k(this.data[Q][z]):z-$===Q?new k(1):new k(0)));for(let K=0;K<$;K++){let Q=K,H=J[K][K].abs();for(let q=K+1;q<$;q++){let W=J[q][K].abs();if(W.greaterThan(H))H=W,Q=q}if(J[Q][K].isZero())throw new Error("Singular matrix: inverse does not exist");if(Q!==K){let q=J[K];J[K]=J[Q],J[Q]=q}let z=J[K][K];for(let q=0;q<2*$;q++)J[K][q]=J[K][q].div(z);for(let q=0;q<$;q++){if(q===K)continue;let W=J[q][K];if(W.isZero())continue;for(let j=0;j<2*$;j++)J[q][j]=J[q][j].minus(W.mul(J[K][j]))}}let Z=J.map((K)=>K.slice($));return new _0(Z)}solve($){let J;if($ instanceof f0)J=$;else if(Array.isArray($))J=f0.from($);else throw new Error("b must be Vector or array");if(!this.isSquare())throw new Error("solve() only implemented for square matrices");let Z=this.rows;if(J.length!==Z)throw new Error("dimension mismatch: b length must equal matrix rows");let K=Array.from({length:Z},(H,z)=>Array.from({length:Z+1},(q,W)=>new k(W<Z?this.data[z][W]:J.data[z])));for(let H=0;H<Z;H++){let z=H,q=K[H][H].abs();for(let W=H+1;W<Z;W++){let j=K[W][H].abs();if(j.greaterThan(q))q=j,z=W}if(K[z][H].isZero())throw new Error("Singular matrix: no unique solution");if(z!==H){let W=K[H];K[H]=K[z],K[z]=W}for(let W=H+1;W<Z;W++){let j=K[W][H].div(K[H][H]);if(j.isZero())continue;for(let G=H;G<Z+1;G++)K[W][G]=K[W][G].minus(j.mul(K[H][G]))}}let Q=Array.from({length:Z},()=>new k(0));for(let H=Z-1;H>=0;H--){if(K[H][H].isZero())throw new Error("Zero diagonal element in back substitution: system is singular");let z=new k(0);for(let q=H+1;q<Z;q++)z=z.plus(K[H][q].mul(Q[q]));Q[H]=K[H][Z].minus(z).div(K[H][H])}return new f0(Q)}qr(){let $=this.rows,J=this.cols,Z=this.data.map((H)=>H.map((z)=>new k(z))),K=_0.identity($).data;for(let H=0;H<Math.min($,J);H++){let z=[];for(let F=H;F<$;F++)z.push(Z[F][H]);let q=new k(0);for(let F of z)q=q.plus(F.mul(F));if(q=q.sqrt(),q.isZero())continue;let W=z[0].isNegative()?new k(-1):new k(1),j=z.slice();j[0]=j[0].plus(W.mul(q));let G=new k(0);for(let F of j)G=G.plus(F.mul(F));if(G=G.sqrt(),G.isZero())continue;for(let F=0;F<j.length;F++)j[F]=j[F].div(G);for(let F=H;F<J;F++){let _=new k(0);for(let U=0;U<j.length;U++)_=_.plus(j[U].mul(Z[H+U][F]));for(let U=0;U<j.length;U++)Z[H+U][F]=Z[H+U][F].minus(new k(2).mul(j[U]).mul(_))}for(let F=0;F<$;F++){let _=new k(0);for(let U=0;U<j.length;U++)_=_.plus(j[U].mul(K[H+U][F]));for(let U=0;U<j.length;U++)K[H+U][F]=K[H+U][F].minus(new k(2).mul(j[U]).mul(_))}}let Q=Array.from({length:$},(H,z)=>Array.from({length:J},(q,W)=>z<=W?Z[z][W]:new k(0)));return{Q:new _0(K).transpose(),R:new _0(Q)}}exp($={}){let J=this.rows;if(!this.isSquare())throw new Error("Matrix exponential requires square matrix");let Z=_0.identity(J),K=$.maxIter||120;if(!Number.isInteger(K)||K<=0)throw new Error("maxIter must be a positive integer");let Q=new k($.tolerance||"1e-40");if(Q.isNegative()||Q.isZero()||!Q.isFinite())throw new Error("tolerance must be positive and finite");let z=((F)=>{let _=new k(0);for(let U=0;U<F.rows;U++){let O=new k(0);for(let V=0;V<F.cols;V++)O=O.plus(F.data[U][V].abs());if(O.greaterThan(_))_=O}return _})(this),q=0;if(z.greaterThan(new k(1))){let F=z.toNumber();if(!isFinite(F))throw new Error("Matrix norm too large for exponential computation");if(q=Math.max(0,Math.ceil(Math.log2(F))),q>50)throw new Error(`Matrix norm too large: requires ${q} scaling steps (max 50 allowed)`)}let W=this;if(q>0)W=this.mul(new k(1).div(new k(2).pow(q)));let j=Z.clone(),G=Z.clone();for(let F=1;F<K;F++){j=j.mul(W).mul(new k(1).div(F)),G=G.add(j);let _=new k(0);for(let U=0;U<j.rows;U++)for(let O=0;O<j.cols;O++)_=_.plus(j.data[U][O].abs());if(_.lessThan(Q))break}for(let F=0;F<q;F++)G=G.mul(G);return G}}k.set({precision:80});var y0=($)=>$ instanceof k?$:new k($),pZ=new k("1e-40"),cZ=new k("1e-30");function lZ($,J){if($==null)throw new TypeError("translationMatrix: tx parameter is required");if(J==null)throw new TypeError("translationMatrix: ty parameter is required");return _0.from([[1,0,y0($)],[0,1,y0(J)],[0,0,1]])}function nZ($){if($==null)throw new TypeError("rotationMatrix: angle parameter is required");let J=y0($),Z=k.cos(J),K=k.sin(J);return _0.from([[Z,K.neg(),0],[K,Z,0],[0,0,1]])}function sZ($,J){if($==null)throw new TypeError("scaleMatrix: sx parameter is required");if(J==null)throw new TypeError("scaleMatrix: sy parameter is required");return _0.from([[y0($),0,0],[0,y0(J),0],[0,0,1]])}function oZ($){if($==null)throw new TypeError("skewXMatrix: angle parameter is required");let J=k.tan(y0($));return _0.from([[1,J,0],[0,1,0],[0,0,1]])}function iZ($){if($==null)throw new TypeError("skewYMatrix: angle parameter is required");let J=k.tan(y0($));return _0.from([[1,0,0],[J,1,0],[0,0,1]])}function rZ($){if(!$)throw new TypeError("extractLinearPart: matrix parameter is required");if(!$.data)throw new TypeError("extractLinearPart: matrix must have data property");if($.rows<2||$.cols<2)throw new RangeError("extractLinearPart: matrix must be at least 2x2");let J=$.data;return{a:J[0][0],b:J[1][0],c:J[0][1],d:J[1][1]}}function aZ($){if(!$)throw new TypeError("extractTranslation: matrix parameter is required");if(!$.data)throw new TypeError("extractTranslation: matrix must have data property");if($.rows<2||$.cols<3)throw new RangeError("extractTranslation: matrix must be at least 2x3");let J=$.data;return{tx:J[0][2],ty:J[1][2]}}function S8($){if(!$)throw new TypeError("decomposeMatrix: matrix parameter is required");let{a:J,b:Z,c:K,d:Q}=rZ($),{tx:H,ty:z}=aZ($),q=J.mul(Q).minus(Z.mul(K)),W=J.mul(J).plus(Z.mul(Z)).sqrt();if(W.abs().lessThan(pZ))return{translateX:H,translateY:z,rotation:y0(0),scaleX:y0(0),scaleY:y0(0),skewX:y0(0),skewY:y0(0),verified:!1,maxError:y0("Infinity"),singular:!0};let j=q.div(W);if(j.abs().greaterThan(new k("1e40")))return{translateX:H,translateY:z,rotation:y0(0),scaleX:y0(0),scaleY:y0(0),skewX:y0(0),skewY:y0(0),verified:!1,maxError:y0("Infinity"),singular:!0};if(q.lessThan(0))W=W.neg(),j=j.neg();let G=k.atan2(Z,J),F=k.cos(G),_=k.sin(G),U=J.mul(F).plus(Z.mul(_)),O=K.mul(F).plus(Q.mul(_)),V,M=new k("1e-30");if(U.abs().greaterThan(M)){let I=O.div(U);if(I.abs().greaterThan(new k("1e10")))V=y0(0);else V=k.atan(I)}else V=y0(0);let Y=y0(0),X=tZ({translateX:H,translateY:z,rotation:G,scaleX:W,scaleY:j,skewX:V,skewY:y0(0)}),w=eZ($,X),R=w.lessThan(cZ);return{translateX:H,translateY:z,rotation:G,scaleX:W,scaleY:j,skewX:V,skewY:Y,verified:R,maxError:w}}function tZ($){if(!$)throw new TypeError("composeTransform: components parameter is required");if($.translateX==null)throw new TypeError("composeTransform: components.translateX is required");if($.translateY==null)throw new TypeError("composeTransform: components.translateY is required");if($.rotation==null)throw new TypeError("composeTransform: components.rotation is required");if($.scaleX==null)throw new TypeError("composeTransform: components.scaleX is required");if($.scaleY==null)throw new TypeError("composeTransform: components.scaleY is required");if($.skewX==null)throw new TypeError("composeTransform: components.skewX is required");let{translateX:J,translateY:Z,rotation:K,scaleX:Q,scaleY:H,skewX:z,skewY:q=0}=$,W=lZ(J,Z),j=nZ(K),G=oZ(z),F=iZ(q),_=sZ(Q,H);return W.mul(j).mul(F).mul(G).mul(_)}function eZ($,J){if(!$)throw new TypeError("matrixMaxDifference: m1 parameter is required");if(!J)throw new TypeError("matrixMaxDifference: m2 parameter is required");if(!$.data)throw new TypeError("matrixMaxDifference: m1 must have data property");if(!J.data)throw new TypeError("matrixMaxDifference: m2 must have data property");if($.rows!==J.rows||$.cols!==J.cols)throw new RangeError(`matrixMaxDifference: matrices must have same dimensions (${$.rows}x${$.cols} vs ${J.rows}x${J.cols})`);let Z=y0(0);for(let K=0;K<$.rows;K++)for(let Q=0;Q<$.cols;Q++){let H=$.data[K][Q].minus(J.data[K][Q]).abs();if(H.greaterThan(Z))Z=H}return Z}k.set({precision:80});var W7=($)=>$ instanceof k?$:new k($),g0=new k("1e-40"),v8=100;function P7($,J){if($==null)throw new TypeError("point: x coordinate cannot be null or undefined");if(J==null)throw new TypeError("point: y coordinate cannot be null or undefined");return{x:W7($),y:W7(J)}}function JQ($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorAdd: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("vectorAdd: second vector must have x and y properties");return{x:$.x.plus(J.x),y:$.y.plus(J.y)}}function x0($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorSub: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("vectorSub: second vector must have x and y properties");return{x:$.x.minus(J.x),y:$.y.minus(J.y)}}function S6($){if(!$||$.x==null||$.y==null)throw new TypeError("vectorNeg: vector must have x and y properties");return{x:$.x.neg(),y:$.y.neg()}}function o$($,J){if(!$||$.x==null||$.y==null)throw new TypeError("vectorScale: vector must have x and y properties");if(J==null)throw new TypeError("vectorScale: scale factor cannot be null or undefined");let Z=W7(J);return{x:$.x.mul(Z),y:$.y.mul(Z)}}function J7($,J){if(!$||$.x==null||$.y==null)throw new TypeError("dot: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("dot: second vector must have x and y properties");return $.x.mul(J.x).plus($.y.mul(J.y))}function f6($,J){if(!$||$.x==null||$.y==null)throw new TypeError("cross: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("cross: second vector must have x and y properties");return $.x.mul(J.y).minus($.y.mul(J.x))}function q7($){if(!$||$.x==null||$.y==null)throw new TypeError("magnitudeSquared: vector must have x and y properties");return $.x.mul($.x).plus($.y.mul($.y))}function Q6($){if(!$||$.x==null||$.y==null)throw new TypeError("magnitude: vector must have x and y properties");return q7($).sqrt()}function KQ($){if(!$||$.x==null||$.y==null)throw new TypeError("normalize: vector must have x and y properties");let J=Q6($);if(J.lessThan(g0))return{x:W7(0),y:W7(0)};return{x:$.x.div(J),y:$.y.div(J)}}function s7($,J,Z){if(!$||$.x==null||$.y==null)throw new TypeError("tripleProduct: first vector must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("tripleProduct: second vector must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("tripleProduct: third vector must have x and y properties");let K=J7($,Z),Q=J7(J,Z);return x0(o$(J,K),o$($,Q))}function D8($,J){if(!Array.isArray($))throw new TypeError("supportPoint: polygon must be an array");if(!J||J.x==null||J.y==null)throw new TypeError("supportPoint: direction must have x and y properties");if($.length===0)throw new TypeError("supportPoint: polygon cannot be empty");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("supportPoint: polygon[0] must have x and y properties");let Z=J7($[0],J),K=$[0];for(let Q=1;Q<$.length;Q++){if(!$[Q]||$[Q].x==null||$[Q].y==null)throw new TypeError(`supportPoint: polygon[${Q}] must have x and y properties`);let H=J7($[Q],J);if(H.greaterThan(Z))Z=H,K=$[Q]}return K}function h8($,J,Z){if(!Array.isArray($))throw new TypeError("minkowskiSupport: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("minkowskiSupport: polygonB must be an array");if(!Z||Z.x==null||Z.y==null)throw new TypeError("minkowskiSupport: direction must have x and y properties");let K=D8($,Z),Q=D8(J,S6(Z));return x0(K,Q)}function ZQ($,J){if(!Array.isArray($))throw new TypeError("processLineSimplex: simplex must be an array");if($.length!==2)throw new TypeError("processLineSimplex: simplex must have exactly 2 points");if(!J||J.x==null||J.y==null)throw new TypeError("processLineSimplex: direction must have x and y properties");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("processLineSimplex: simplex[0] must have x and y properties");if(!$[1]||$[1].x==null||$[1].y==null)throw new TypeError("processLineSimplex: simplex[1] must have x and y properties");let Z=$[0],K=$[1],Q=x0(K,Z),H=S6(Z),z=q7(Q);if(z.lessThan(g0)){if(q7(Z).lessThan(g0))return{contains:!0,newDirection:J};return{contains:!1,newDirection:H}}let q=s7(Q,H,Q);if(q7(q).lessThan(g0)){let W=J7(Q,H);if(W.greaterThanOrEqualTo(0)&&W.lessThanOrEqualTo(z))return{contains:!0,newDirection:J};return{contains:!1,newDirection:H}}return{contains:!1,newDirection:q}}function QQ($,J){if(!Array.isArray($))throw new TypeError("processTriangleSimplex: simplex must be an array");if($.length!==3)throw new TypeError("processTriangleSimplex: simplex must have exactly 3 points");if(!J||J.x==null||J.y==null)throw new TypeError("processTriangleSimplex: direction must have x and y properties");if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("processTriangleSimplex: simplex[0] must have x and y properties");if(!$[1]||$[1].x==null||$[1].y==null)throw new TypeError("processTriangleSimplex: simplex[1] must have x and y properties");if(!$[2]||$[2].x==null||$[2].y==null)throw new TypeError("processTriangleSimplex: simplex[2] must have x and y properties");let Z=$[0],K=$[1],Q=$[2],H=x0(K,Z),z=x0(Q,Z),q=S6(Z),W=q7(H),j=q7(z);if(W.lessThan(g0))return{contains:!1,newDirection:s7(z,q,z),newSimplex:[Z,Q]};if(j.lessThan(g0))return{contains:!1,newDirection:s7(H,q,H),newSimplex:[Z,K]};let G=s7(z,H,H),F=s7(H,z,z);if(q7(G).lessThan(g0)&&q7(F).lessThan(g0)){let _=x0(Q,K),U=q7(_);if(U.greaterThan(W)&&U.greaterThan(j))return{contains:!1,newDirection:s7(_,S6(K),_),newSimplex:[K,Q]};else if(W.greaterThan(j))return{contains:!1,newDirection:s7(H,q,H),newSimplex:[Z,K]};else return{contains:!1,newDirection:s7(z,q,z),newSimplex:[Z,Q]}}if(J7(G,q).greaterThan(g0))return{contains:!1,newDirection:G,newSimplex:[Z,K]};if(J7(F,q).greaterThan(g0))return{contains:!1,newDirection:F,newSimplex:[Z,Q]};return{contains:!0,newDirection:J,newSimplex:$}}function g8($,J){if(!Array.isArray($))throw new TypeError("gjkIntersects: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("gjkIntersects: polygonB must be an array");if($.length===0||J.length===0)return{intersects:!1,iterations:0,simplex:[],verified:!0};if($.length===1&&J.length===1){if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("gjkIntersects: polygonA[0] must have x and y properties");if(!J[0]||J[0].x==null||J[0].y==null)throw new TypeError("gjkIntersects: polygonB[0] must have x and y properties");return{intersects:Q6(x0($[0],J[0])).lessThan(g0),iterations:1,simplex:[],verified:!0}}let Z=x0(W$(J),W$($));if(q7(Z).lessThan(g0))Z=P7(1,0);let K=[h8($,J,Z)];if(Z=S6(K[0]),q7(K[0]).lessThan(g0))return{intersects:!0,iterations:1,simplex:K,verified:s$($,J)};for(let Q=0;Q<v8;Q++){let H=h8($,J,Z);if(J7(H,Z).lessThanOrEqualTo(W7(0)))return{intersects:!1,iterations:Q+1,simplex:K,verified:!0};if(K.unshift(H),K.length===2){let z=ZQ(K,Z);if(z.contains)return{intersects:!0,iterations:Q+1,simplex:K,verified:s$($,J)};Z=z.newDirection}else if(K.length===3){let z=QQ(K,Z);if(z.contains)return{intersects:!0,iterations:Q+1,simplex:z.newSimplex,verified:s$($,J)};K=z.newSimplex,Z=z.newDirection}if(q7(Z).lessThan(g0))return{intersects:!1,iterations:Q+1,simplex:K,verified:!1};Z=KQ(Z)}return{intersects:!1,iterations:v8,simplex:K,verified:!1}}function W$($){if(!Array.isArray($))throw new TypeError("centroid: polygon must be an array");if($.length===0)throw new TypeError("centroid: polygon cannot be empty");let J=W7(0),Z=W7(0);for(let Q=0;Q<$.length;Q++){if(!$[Q]||$[Q].x==null||$[Q].y==null)throw new TypeError(`centroid: polygon[${Q}] must have x and y properties`);J=J.plus($[Q].x),Z=Z.plus($[Q].y)}let K=W7($.length);return{x:J.div(K),y:Z.div(K)}}function y8($,J){if(!$||$.x==null||$.y==null)throw new TypeError("pointInConvexPolygon: point must have x and y properties");if(!Array.isArray(J))throw new TypeError("pointInConvexPolygon: polygon must be an array");if(J.length<3)return!1;let Z=null;for(let K=0;K<J.length;K++){let Q=J[K],H=J[(K+1)%J.length];if(!Q||Q.x==null||Q.y==null)throw new TypeError(`pointInConvexPolygon: polygon[${K}] must have x and y properties`);if(!H||H.x==null||H.y==null)throw new TypeError(`pointInConvexPolygon: polygon[${(K+1)%J.length}] must have x and y properties`);let z=x0(H,Q),q=x0($,Q),W=f6(z,q);if(W.abs().lessThan(g0))continue;let j=W.greaterThan(0);if(Z===null)Z=j;else if(Z!==j)return!1}return!0}function s$($,J){if(!Array.isArray($))throw new TypeError("verifyIntersection: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("verifyIntersection: polygonB must be an array");for(let Z=0;Z<$.length;Z++){if(!$[Z]||$[Z].x==null||$[Z].y==null)throw new TypeError(`verifyIntersection: polygonA[${Z}] must have x and y properties`);if(y8($[Z],J))return!0}for(let Z=0;Z<J.length;Z++){if(!J[Z]||J[Z].x==null||J[Z].y==null)throw new TypeError(`verifyIntersection: polygonB[${Z}] must have x and y properties`);if(y8(J[Z],$))return!0}for(let Z=0;Z<$.length;Z++){let K=$[Z],Q=$[(Z+1)%$.length];if(!K||K.x==null||K.y==null)throw new TypeError(`verifyIntersection: polygonA[${Z}] must have x and y properties`);if(!Q||Q.x==null||Q.y==null)throw new TypeError(`verifyIntersection: polygonA[${(Z+1)%$.length}] must have x and y properties`);for(let H=0;H<J.length;H++){let z=J[H],q=J[(H+1)%J.length];if(!z||z.x==null||z.y==null)throw new TypeError(`verifyIntersection: polygonB[${H}] must have x and y properties`);if(!q||q.x==null||q.y==null)throw new TypeError(`verifyIntersection: polygonB[${(H+1)%J.length}] must have x and y properties`);if(HQ(K,Q,z,q))return!0}}return!1}function HQ($,J,Z,K){if(!$||$.x==null||$.y==null)throw new TypeError("segmentsIntersect: a1 must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("segmentsIntersect: a2 must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("segmentsIntersect: b1 must have x and y properties");if(!K||K.x==null||K.y==null)throw new TypeError("segmentsIntersect: b2 must have x and y properties");let Q=x0(J,$),H=x0(K,Z),z=f6(Q,H);if(z.abs().lessThan(g0)){let G=x0(Z,$);if(f6(Q,G).abs().lessThan(g0)){let F=J7(Q,Q);if(F.lessThan(g0)){let Y=J7(H,H);if(Y.lessThan(g0))return Q6(G).lessThan(g0);let X=J7(G,H).div(Y);return X.greaterThanOrEqualTo(0)&&X.lessThanOrEqualTo(1)}let _=J7(G,Q).div(F),U=x0(K,$),O=J7(U,Q).div(F),V=k.min(_,O);return k.max(_,O).greaterThanOrEqualTo(0)&&V.lessThanOrEqualTo(1)}return!1}let q=x0(Z,$),W=f6(q,H).div(z),j=f6(q,Q).div(z);return W.greaterThanOrEqualTo(0)&&W.lessThanOrEqualTo(1)&&j.greaterThanOrEqualTo(0)&&j.lessThanOrEqualTo(1)}function zQ($,J){if(!Array.isArray($))throw new TypeError("gjkDistance: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("gjkDistance: polygonB must be an array");if($.length===0)throw new TypeError("gjkDistance: polygonA cannot be empty");if(J.length===0)throw new TypeError("gjkDistance: polygonB cannot be empty");if(g8($,J).intersects)return{distance:W7(0),closestA:W$($),closestB:W$(J),verified:!0};if(!$[0]||$[0].x==null||$[0].y==null)throw new TypeError("gjkDistance: polygonA[0] must have x and y properties");if(!J[0]||J[0].x==null||J[0].y==null)throw new TypeError("gjkDistance: polygonB[0] must have x and y properties");let K=W7(1/0),Q=$[0],H=J[0];for(let W=0;W<$.length;W++){if(!$[W]||$[W].x==null||$[W].y==null)throw new TypeError(`gjkDistance: polygonA[${W}] must have x and y properties`);for(let j=0;j<J.length;j++){if(!J[j]||J[j].x==null||J[j].y==null)throw new TypeError(`gjkDistance: polygonB[${j}] must have x and y properties`);let G=Q6(x0($[W],J[j]));if(G.lessThan(K))K=G,Q=$[W],H=J[j]}}for(let W=0;W<$.length;W++){if(!$[W]||$[W].x==null||$[W].y==null)throw new TypeError(`gjkDistance: polygonA[${W}] must have x and y properties`);for(let j=0;j<J.length;j++){let G=J[j],F=J[(j+1)%J.length];if(!G||G.x==null||G.y==null)throw new TypeError(`gjkDistance: polygonB[${j}] must have x and y properties`);if(!F||F.x==null||F.y==null)throw new TypeError(`gjkDistance: polygonB[${(j+1)%J.length}] must have x and y properties`);let _=u8($[W],G,F),U=Q6(x0($[W],_));if(U.lessThan(K))K=U,Q=$[W],H=_}}for(let W=0;W<J.length;W++){if(!J[W]||J[W].x==null||J[W].y==null)throw new TypeError(`gjkDistance: polygonB[${W}] must have x and y properties`);for(let j=0;j<$.length;j++){let G=$[j],F=$[(j+1)%$.length];if(!G||G.x==null||G.y==null)throw new TypeError(`gjkDistance: polygonA[${j}] must have x and y properties`);if(!F||F.x==null||F.y==null)throw new TypeError(`gjkDistance: polygonA[${(j+1)%$.length}] must have x and y properties`);let _=u8(J[W],G,F),U=Q6(x0(J[W],_));if(U.lessThan(K))K=U,Q=_,H=J[W]}}let q=Q6(x0(Q,H)).minus(K).abs().lessThan(g0);return{distance:K,closestA:Q,closestB:H,verified:q}}function u8($,J,Z){if(!$||$.x==null||$.y==null)throw new TypeError("closestPointOnSegment: pt must have x and y properties");if(!J||J.x==null||J.y==null)throw new TypeError("closestPointOnSegment: a must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new TypeError("closestPointOnSegment: b must have x and y properties");let K=x0(Z,J),Q=x0($,J),H=q7(K);if(H.lessThan(g0))return J;let z=J7(Q,K).div(H);return z=k.max(W7(0),k.min(W7(1),z)),JQ(J,o$(K,z))}function j$($,J){if(!Array.isArray($))throw new TypeError("polygonsOverlap: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("polygonsOverlap: polygonB must be an array");let Z=$.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsOverlap: polygonA[${z}] must have x and y properties`);return P7(H.x,H.y)}),K=J.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsOverlap: polygonB[${z}] must have x and y properties`);return P7(H.x,H.y)}),Q=g8(Z,K);return{overlaps:Q.intersects,verified:Q.verified}}function x8($,J){if(!Array.isArray($))throw new TypeError("polygonsDistance: polygonA must be an array");if(!Array.isArray(J))throw new TypeError("polygonsDistance: polygonB must be an array");let Z=$.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsDistance: polygonA[${z}] must have x and y properties`);return P7(H.x,H.y)}),K=J.map((H,z)=>{if(!H||H.x==null||H.y==null)throw new TypeError(`polygonsDistance: polygonB[${z}] must have x and y properties`);return P7(H.x,H.y)}),Q=zQ(Z,K);return{distance:Q.distance,closestA:Q.closestA,closestB:Q.closestB,verified:Q.verified}}k.set({precision:80});var Nq=new k("1e-40"),Iq=new k("1e-10");k.set({precision:80});var Aq=new k("1e-40"),Eq=new k("1e-30");k.set({precision:80});var W0=($)=>$ instanceof k?$:new k($),fq=new k("1e-40"),GQ=new k("1e-10");function c8($){if(typeof $!=="string")throw new Error("ViewBox must be a string");let J=$.trim().split(/[\s,]+/).filter((Z)=>Z.length>0);if(J.length!==4)throw new Error(`Invalid viewBox format: expected 4 values, got ${J.length}`);try{let Z=W0(J[0]),K=W0(J[1]),Q=W0(J[2]),H=W0(J[3]);if(Q.lessThanOrEqualTo(0)||H.lessThanOrEqualTo(0))throw new Error("ViewBox width and height must be positive");let z=`${Z.toString()} ${K.toString()} ${Q.toString()} ${H.toString()}`,q=J.join(" ");return{x:Z,y:K,width:Q,height:H,verified:z===q}}catch(Z){throw new Error(`Invalid viewBox values: ${Z.message}`)}}function FQ($,J,Z,K){if($==null||J==null||Z==null||K==null)throw new Error("createBBox: all parameters (minX, minY, maxX, maxY) must be provided");let Q=W0($),H=W0(J),z=W0(Z),q=W0(K);if(z.lessThan(Q))throw new Error(`createBBox: maxX (${z}) must be >= minX (${Q})`);if(q.lessThan(H))throw new Error(`createBBox: maxY (${q}) must be >= minY (${H})`);return{minX:Q,minY:H,maxX:z,maxY:q,width:z.minus(Q),height:q.minus(H)}}function m8($,J,Z,K,Q,H,z,q,W=20){if($==null||J==null||Z==null||K==null||Q==null||H==null||z==null||q==null)throw new Error("sampleCubicBezier: all coordinate parameters must be provided");if(W==null||W<=0)throw new Error("sampleCubicBezier: samples must be a positive number");let j=[];for(let G=0;G<=W;G++){let F=W0(G).div(W),_=W0(1).minus(F),U=F.mul(F),O=U.mul(F),V=_.mul(_),M=V.mul(_),Y=M.mul($).plus(W0(3).mul(V).mul(F).mul(Z)).plus(W0(3).mul(_).mul(U).mul(Q)).plus(O.mul(z)),X=M.mul(J).plus(W0(3).mul(V).mul(F).mul(K)).plus(W0(3).mul(_).mul(U).mul(H)).plus(O.mul(q));j.push({x:Y,y:X})}return j}function d8($,J,Z,K,Q,H,z=20){if($==null||J==null||Z==null||K==null||Q==null||H==null)throw new Error("sampleQuadraticBezier: all coordinate parameters must be provided");if(z==null||z<=0)throw new Error("sampleQuadraticBezier: samples must be a positive number");let q=[];for(let W=0;W<=z;W++){let j=W0(W).div(z),G=W0(1).minus(j),F=G.mul(G),_=j.mul(j),U=F.mul($).plus(W0(2).mul(G).mul(j).mul(Z)).plus(_.mul(Q)),O=F.mul(J).plus(W0(2).mul(G).mul(j).mul(K)).plus(_.mul(H));q.push({x:U,y:O})}return q}function _Q($,J,Z=GQ){if(!$||typeof $!=="object"||$.x==null||$.y==null)throw new Error("pointInBBox: pt must be an object with x and y properties");if(!J||typeof J!=="object")throw new Error("pointInBBox: bbox must be a bounding box object");if(J.minX==null||J.minY==null||J.maxX==null||J.maxY==null)throw new Error("pointInBBox: bbox must have minX, minY, maxX, maxY properties");return $.x.greaterThanOrEqualTo(J.minX.minus(Z))&&$.x.lessThanOrEqualTo(J.maxX.plus(Z))&&$.y.greaterThanOrEqualTo(J.minY.minus(Z))&&$.y.lessThanOrEqualTo(J.maxY.plus(Z))}function l8($){if(!$||$.length===0)throw new Error("pathBoundingBox: path commands array is empty");let J=W0(1/0),Z=W0(1/0),K=W0(-1/0),Q=W0(-1/0),H=W0(0),z=W0(0),q=W0(0),W=W0(0),j=W0(0),G=W0(0),F=null,_=[];for(let V of $){if(!V||typeof V!=="object"||!V.type||typeof V.type!=="string")throw new Error("pathBoundingBox: each command must be an object with a string type property");let M=V.type.toUpperCase(),Y=V.type===V.type.toLowerCase();switch(M){case"M":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: M command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y);H=X,z=w,q=H,W=z,J=k.min(J,H),Z=k.min(Z,z),K=k.max(K,H),Q=k.max(Q,z),_.push({x:H,y:z}),j=H,G=z,F="M"}break;case"L":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: L command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y);J=k.min(J,X),Z=k.min(Z,w),K=k.max(K,X),Q=k.max(Q,w),_.push({x:X,y:w}),H=X,z=w,j=H,G=z,F="L"}break;case"H":{if(V.x==null)throw new Error("pathBoundingBox: H command requires x property");let X=Y?H.plus(W0(V.x)):W0(V.x);J=k.min(J,X),K=k.max(K,X),_.push({x:X,y:z}),H=X,j=H,G=z,F="H"}break;case"V":{if(V.y==null)throw new Error("pathBoundingBox: V command requires y property");let X=Y?z.plus(W0(V.y)):W0(V.y);Z=k.min(Z,X),Q=k.max(Q,X),_.push({x:H,y:X}),z=X,j=H,G=z,F="V"}break;case"C":{if(V.x1==null||V.y1==null||V.x2==null||V.y2==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: C command requires x1, y1, x2, y2, x, y properties");let X=Y?H.plus(W0(V.x1)):W0(V.x1),w=Y?z.plus(W0(V.y1)):W0(V.y1),R=Y?H.plus(W0(V.x2)):W0(V.x2),I=Y?z.plus(W0(V.y2)):W0(V.y2),f=Y?H.plus(W0(V.x)):W0(V.x),u=Y?z.plus(W0(V.y)):W0(V.y),m=m8(H,z,X,w,R,I,f,u,20);for(let S of m)J=k.min(J,S.x),Z=k.min(Z,S.y),K=k.max(K,S.x),Q=k.max(Q,S.y),_.push(S);j=R,G=I,H=f,z=u,F="C"}break;case"S":{if(V.x2==null||V.y2==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: S command requires x2, y2, x, y properties");let X=Y?H.plus(W0(V.x2)):W0(V.x2),w=Y?z.plus(W0(V.y2)):W0(V.y2),R=Y?H.plus(W0(V.x)):W0(V.x),I=Y?z.plus(W0(V.y)):W0(V.y),f,u;if(F==="C"||F==="S")f=H.mul(2).minus(j),u=z.mul(2).minus(G);else f=H,u=z;let m=m8(H,z,f,u,X,w,R,I,20);for(let S of m)J=k.min(J,S.x),Z=k.min(Z,S.y),K=k.max(K,S.x),Q=k.max(Q,S.y),_.push(S);j=X,G=w,H=R,z=I,F="S"}break;case"Q":{if(V.x1==null||V.y1==null||V.x==null||V.y==null)throw new Error("pathBoundingBox: Q command requires x1, y1, x, y properties");let X=Y?H.plus(W0(V.x1)):W0(V.x1),w=Y?z.plus(W0(V.y1)):W0(V.y1),R=Y?H.plus(W0(V.x)):W0(V.x),I=Y?z.plus(W0(V.y)):W0(V.y),f=d8(H,z,X,w,R,I,20);for(let u of f)J=k.min(J,u.x),Z=k.min(Z,u.y),K=k.max(K,u.x),Q=k.max(Q,u.y),_.push(u);j=X,G=w,H=R,z=I,F="Q"}break;case"T":{if(V.x==null||V.y==null)throw new Error("pathBoundingBox: T command requires x and y properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y),R,I;if(F==="Q"||F==="T")R=H.mul(2).minus(j),I=z.mul(2).minus(G);else R=H,I=z;let f=d8(H,z,R,I,X,w,20);for(let u of f)J=k.min(J,u.x),Z=k.min(Z,u.y),K=k.max(K,u.x),Q=k.max(Q,u.y),_.push(u);j=R,G=I,H=X,z=w,F="T"}break;case"A":{if(V.x==null||V.y==null||V.rx==null||V.ry==null)throw new Error("pathBoundingBox: A command requires x, y, rx, ry properties");let X=Y?H.plus(W0(V.x)):W0(V.x),w=Y?z.plus(W0(V.y)):W0(V.y),R=W0(V.rx).abs(),I=W0(V.ry).abs();if(R.isZero()||I.isZero())J=k.min(J,H,X),Z=k.min(Z,z,w),K=k.max(K,H,X),Q=k.max(Q,z,w),_.push({x:H,y:z},{x:X,y:w});else{J=k.min(J,H,X),Z=k.min(Z,z,w),K=k.max(K,H,X),Q=k.max(Q,z,w);let f=H.plus(X).div(2),u=z.plus(w).div(2);J=k.min(J,f.minus(R)),Z=k.min(Z,u.minus(I)),K=k.max(K,f.plus(R)),Q=k.max(Q,u.plus(I));let m=20;for(let S=0;S<=m;S++){let x=W0(S).div(m),h=H.plus(X.minus(H).mul(x)),E=z.plus(w.minus(z).mul(x));_.push({x:h,y:E})}}H=X,z=w,j=H,G=z,F="A"}break;case"Z":H=q,z=W,j=H,G=z,F="Z";break;default:throw new Error(`pathBoundingBox: unknown path command type: ${M}`)}}if(!J.isFinite()||!Z.isFinite()||!K.isFinite()||!Q.isFinite())throw new Error("Invalid bounding box: no valid coordinates found");let U=FQ(J,Z,K,Q),O=!0;for(let V of _)if(!_Q(V,U)){O=!1;break}return{...U,verified:O}}function p8($){if(!$||typeof $!=="object")throw new Error("bboxToPolygon: bbox must be a bounding box object");if($.minX==null||$.minY==null||$.maxX==null||$.maxY==null)throw new Error("bboxToPolygon: bbox must have minX, minY, maxX, maxY properties");return[P7($.minX,$.minY),P7($.maxX,$.minY),P7($.maxX,$.maxY),P7($.minX,$.maxY)]}function n8($,J){if(!J||typeof J!=="object")throw new Error("bboxIntersectsViewBox: viewBox must be an object");if(J.x==null||J.y==null||J.width==null||J.height==null)throw new Error("bboxIntersectsViewBox: viewBox must have x, y, width, height properties");let Z=p8($),K=p8({minX:J.x,minY:J.y,maxX:J.x.plus(J.width),maxY:J.y.plus(J.height)}),Q=j$(Z,K);return{intersects:Q.overlaps,verified:Q.verified}}var e0={ID:"id",CLASS:"class",ATTRIBUTE:"attr",PSEUDO_CLASS:"pseudo-class",PSEUDO_ELEMENT:"pseudo-element",TYPE:"type",UNIVERSAL:"universal"};function VQ($){if(typeof $!=="string"||!$.trim())throw new Error("Selector must be a non-empty string");let J=$.trim(),Z=[],K=MQ(J);for(let Q of K){if(!Q.trim())continue;let H=OQ(Q.trim());Z.push(...H)}return Z}function MQ($){if(typeof $!=="string")throw new Error("Selector must be a string");let J=[],Z="",K=0,Q=0,H=!1,z=null;for(let W=0;W<$.length;W++){let j=$[W],G=W>0?$[W-1]:null;if((j==='"'||j==="'")&&G!=="\\"){if(!H)H=!0,z=j;else if(j===z)H=!1,z=null}if(!H){if(j==="["&&G!=="\\")K++;else if(j==="]"&&G!=="\\"){if(K--,K<0)throw new Error(`Unbalanced brackets at position ${W}`)}else if(j==="("&&G!=="\\")Q++;else if(j===")"&&G!=="\\"){if(Q--,Q<0)throw new Error(`Unbalanced parentheses at position ${W}`)}}if(!H&&K===0&&Q===0){if(j===">"||j==="+"||j==="~"){let F=Z.trim();if(F)J.push(F);Z="";continue}else if(j===" "){let F=Z.trim();if(F){J.push(F),Z="";continue}else continue}}Z+=j}if(H)throw new Error("Unclosed quote in selector");if(K!==0)throw new Error("Unclosed brackets in selector");if(Q!==0)throw new Error("Unclosed parentheses in selector");let q=Z.trim();if(q)J.push(q);return J}function OQ($){if(typeof $!=="string")throw new Error("Selector must be a string");let J=[],Z=0;while(Z<$.length){let K=$[Z];if(K==="#"){let Q=$.slice(Z).match(/^#([a-zA-Z_-][\w-]*)/);if(!Q)throw new Error(`Invalid ID selector at position ${Z}`);J.push({type:e0.ID,value:Q[1]}),Z+=Q[0].length}else if(K==="."){let Q=$.slice(Z).match(/^\.([a-zA-Z_-][\w-]*)/);if(!Q)throw new Error(`Invalid class selector at position ${Z}`);J.push({type:e0.CLASS,value:Q[1]}),Z+=Q[0].length}else if(K==="["){let Q=YQ($,Z);if(Q===-1)throw new Error(`Unclosed attribute selector at position ${Z}`);let H=$.slice(Z+1,Q);J.push({type:e0.ATTRIBUTE,value:H}),Z=Q+1}else if(K===":")if(Z+1<$.length&&$[Z+1]===":"){let Q=$.slice(Z).match(/^::([\w-]+)/);if(!Q)throw new Error(`Invalid pseudo-element at position ${Z}`);J.push({type:e0.PSEUDO_ELEMENT,value:Q[1]}),Z+=Q[0].length}else{let Q=$.slice(Z).match(/^:([\w-]+)/);if(!Q)throw new Error(`Invalid pseudo-class at position ${Z}`);let H=Q[1];if(Z+=Q[0].length,Z<$.length&&$[Z]==="("){let W=XQ($,Z);if(W===-1)throw new Error(`Unclosed pseudo-class function at position ${Z}`);H+=$.slice(Z,W+1),Z=W+1}let q=["before","after","first-line","first-letter"].includes(H);J.push({type:q?e0.PSEUDO_ELEMENT:e0.PSEUDO_CLASS,value:H})}else if(K==="*"){let Q=Z+1;if(Q<$.length&&$[Q]==="|"){if(Q++,Q<$.length&&$[Q]==="*")Q++}J.push({type:e0.UNIVERSAL,value:"*"}),Z=Q}else if(/[a-zA-Z]/.test(K)){let Q=$.slice(Z).match(/^([a-zA-Z][\w-]*)/);if(!Q)throw new Error(`Invalid type selector at position ${Z}`);let H=Q[1],z=Z+Q[0].length;if(z<$.length&&$[z]==="|"){z++;let q=$.slice(z).match(/^([a-zA-Z*][\w-]*)/);if(q)H=q[1],z+=q[0].length}J.push({type:e0.TYPE,value:H}),Z=z}else if(K===">"||K==="+"||K==="~"||K===" ")Z++;else throw new Error(`Unexpected character '${K}' at position ${Z}`)}return J}function YQ($,J){if(typeof $!=="string")throw new Error("str must be a string");if(typeof J!=="number"||J<0||J>=$.length)throw new Error("startIdx must be a valid index within the string");let Z=0,K=!1,Q=null;for(let H=J;H<$.length;H++){let z=$[H],q=H>0?$[H-1]:null;if((z==='"'||z==="'")&&q!=="\\"){if(!K)K=!0,Q=z;else if(z===Q)K=!1,Q=null}if(!K){if(z==="["&&q!=="\\")Z++;if(z==="]"&&q!=="\\"){if(Z--,Z===0)return H}}}return-1}function XQ($,J){if(typeof $!=="string")throw new Error("str must be a string");if(typeof J!=="number"||J<0||J>=$.length)throw new Error("startIdx must be a valid index within the string");let Z=0,K=!1,Q=null;for(let H=J;H<$.length;H++){let z=$[H],q=H>0?$[H-1]:null;if((z==='"'||z==="'")&&q!=="\\"){if(!K)K=!0,Q=z;else if(z===Q)K=!1,Q=null}if(!K){if(z==="("&&q!=="\\")Z++;if(z===")"&&q!=="\\"){if(Z--,Z===0)return H}}}return-1}function G$($){let J=typeof $==="string"?VQ($):$;if(!Array.isArray(J))throw new Error("Selector must be a string or an array of components");let Z=0,K=0,Q=0;for(let H of J){if(!H||typeof H.type!=="string")throw new Error("Invalid component: must have a 'type' property");switch(H.type){case e0.ID:Z++;break;case e0.CLASS:case e0.ATTRIBUTE:K++;break;case e0.PSEUDO_CLASS:{let z=H.value;if(z.startsWith("where(")&&z.endsWith(")"))break;if((z.startsWith("not(")||z.startsWith("is(")||z.startsWith("has("))&&z.endsWith(")")){let q=z.match(/^(\w+)\(/)[1],W=z.slice(q.length+1,-1);if(W.trim()){let j=kQ(W),G=[0,0,0];for(let F of j)if(F.trim()){let _=G$(F.trim());if(F$(_,G)>0)G=_}Z+=G[0],K+=G[1],Q+=G[2]}break}if((z.startsWith("nth-child(")||z.startsWith("nth-last-child("))&&z.endsWith(")")){let q=z.match(/^([\w-]+)\(/)[1],j=z.slice(q.length+1,-1).match(/\s+of\s+(.+)$/);if(j){let G=j[1].trim(),F=G$(G);Z+=F[0],K+=F[1],Q+=F[2]}K++;break}K++;break}case e0.TYPE:case e0.PSEUDO_ELEMENT:Q++;break;case e0.UNIVERSAL:break;default:break}}return[Z,K,Q]}function kQ($){if(typeof $!=="string")throw new Error("selectorList must be a string");let J=[],Z="",K=0,Q=0,H=!1,z=null;for(let q=0;q<$.length;q++){let W=$[q],j=q>0?$[q-1]:null;if((W==='"'||W==="'")&&j!=="\\"){if(!H)H=!0,z=W;else if(W===z)H=!1,z=null}if(!H){if(W==="(")K++;if(W===")")K--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&K===0&&Q===0){J.push(Z),Z="";continue}}Z+=W}if(Z)J.push(Z);return J}function F$($,J){if(!Array.isArray($)||$.length!==3)throw new Error("spec1 must be an array of 3 numbers");if(!Array.isArray(J)||J.length!==3)throw new Error("spec2 must be an array of 3 numbers");for(let Z=0;Z<3;Z++){if(typeof $[Z]!=="number"||!Number.isFinite($[Z])||$[Z]<0)throw new Error(`spec1[${Z}] must be a non-negative finite number`);if(typeof J[Z]!=="number"||!Number.isFinite(J[Z])||J[Z]<0)throw new Error(`spec2[${Z}] must be a non-negative finite number`)}for(let Z=0;Z<3;Z++){if($[Z]<J[Z])return-1;if($[Z]>J[Z])return 1}return 0}var S0=($)=>$ instanceof k?$:new k($);function i$(){let $=new k(2),J=new k(3);return new k(4).mul($.sqrt().minus(1)).div(J)}function wQ($){if($==null)throw new Error("getKappaForArc: thetaRadians parameter is required");let J=S0($);if(!J.isFinite())throw new Error("getKappaForArc: thetaRadians must be finite");if(J.isZero()||J.isNegative())throw new Error("getKappaForArc: thetaRadians must be positive");let Z=new k(4),K=new k(3);return Z.div(K).mul(k.tan(J.div(Z)))}function s8($,J,Z,K=8,Q=6){if($==null||J==null||Z==null)throw new Error("circleToPathDataHP: cx, cy, and r parameters are required");let H=S0(Z);if(!H.isFinite()||H.isNegative())throw new Error("circleToPathDataHP: radius must be finite and non-negative");if(H.isZero())return"";if(!Number.isFinite(K)||K<=0)throw new Error("circleToPathDataHP: arcs must be a positive number");if(!Number.isFinite(Q)||Q<0)throw new Error("circleToPathDataHP: precision must be non-negative");return r$($,J,Z,Z,K,Q)}function r$($,J,Z,K,Q=8,H=6){if($==null||J==null||Z==null||K==null)throw new Error("ellipseToPathDataHP: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(Q)||Q<=0)throw new Error("ellipseToPathDataHP: arcs must be a positive number");if(!Number.isFinite(H)||H<0)throw new Error("ellipseToPathDataHP: precision must be non-negative");let z=Q;if(z%4!==0)z=Math.ceil(z/4)*4;let q=S0($),W=S0(J),j=S0(Z),G=S0(K);if(!j.isFinite()||j.isNegative())throw new Error("ellipseToPathDataHP: rx must be finite and non-negative");if(!G.isFinite()||G.isNegative())throw new Error("ellipseToPathDataHP: ry must be finite and non-negative");if(j.isZero()||G.isZero())return"";let F=(Y)=>H6(Y,H),O=k.acos(-1).mul(2).div(z),V=wQ(O),M=[];for(let Y=0;Y<z;Y++){let X=O.mul(Y),w=O.mul(Y+1),R=k.cos(X),I=k.sin(X),f=k.cos(w),u=k.sin(w),m=q.plus(j.mul(R)),S=W.plus(G.mul(I)),x=q.plus(j.mul(f)),h=W.plus(G.mul(u)),E=I.neg(),d=R,c=u.neg(),p=f,N=m.plus(V.mul(j).mul(E)),y=S.plus(V.mul(G).mul(d)),B=x.minus(V.mul(j).mul(c)),e=h.minus(V.mul(G).mul(p));if(Y===0)M.push(`M${F(m)} ${F(S)}`);M.push(`C${F(N)} ${F(y)} ${F(B)} ${F(e)} ${F(x)} ${F(h)}`)}return M.push("Z"),M.join(" ")}function H6($,J=6){if($==null)throw new Error("formatNumber: value parameter is required");if(!Number.isFinite(J)||J<0)throw new Error("formatNumber: precision must be non-negative");let Z=S0($);if(!Z.isFinite())throw new Error("formatNumber: value must be finite");let K=Z.toFixed(J);if(K.includes("."))K=K.replace(/\.?0+$/,"");return K}function a$($,J,Z,K=6){if($==null||J==null||Z==null)throw new Error("circleToPathData: cx, cy, and r parameters are required");if(!Number.isFinite(K)||K<0)throw new Error("circleToPathData: precision must be non-negative");let Q=S0($),H=S0(J),z=S0(Z);if(!z.isFinite()||z.isNegative())throw new Error("circleToPathData: radius must be finite and non-negative");if(z.isZero())return"";let q=i$().mul(z),W=Q.plus(z),j=H,G=W,F=j.minus(q),_=Q.plus(q),U=H.minus(z),O=Q,V=H.minus(z),M=Q.minus(q),Y=V,X=Q.minus(z),w=H.minus(q),R=Q.minus(z),I=H,f=R,u=H.plus(q),m=Q.minus(q),S=H.plus(z),x=Q,h=H.plus(z),E=Q.plus(q),d=h,c=W,p=H.plus(q),N=(y)=>H6(y,K);return`M${N(W)} ${N(j)}C${N(G)} ${N(F)} ${N(_)} ${N(U)} ${N(O)} ${N(V)}C${N(M)} ${N(Y)} ${N(X)} ${N(w)} ${N(R)} ${N(I)}C${N(f)} ${N(u)} ${N(m)} ${N(S)} ${N(x)} ${N(h)}C${N(E)} ${N(d)} ${N(c)} ${N(p)} ${N(W)} ${N(j)}Z`}function t$($,J,Z,K,Q=6){if($==null||J==null||Z==null||K==null)throw new Error("ellipseToPathData: cx, cy, rx, and ry parameters are required");if(!Number.isFinite(Q)||Q<0)throw new Error("ellipseToPathData: precision must be non-negative");let H=S0($),z=S0(J),q=S0(Z),W=S0(K);if(!q.isFinite()||q.isNegative())throw new Error("ellipseToPathData: rx must be finite and non-negative");if(!W.isFinite()||W.isNegative())throw new Error("ellipseToPathData: ry must be finite and non-negative");if(q.isZero()||W.isZero())return"";let j=i$(),G=j.mul(q),F=j.mul(W),_=H.plus(q),U=z,O=_,V=U.minus(F),M=H.plus(G),Y=z.minus(W),X=H,w=z.minus(W),R=H.minus(G),I=w,f=H.minus(q),u=z.minus(F),m=H.minus(q),S=z,x=m,h=z.plus(F),E=H.minus(G),d=z.plus(W),c=H,p=z.plus(W),N=H.plus(G),y=p,B=_,e=z.plus(F),r=(s)=>H6(s,Q);return`M${r(_)} ${r(U)}C${r(O)} ${r(V)} ${r(M)} ${r(Y)} ${r(X)} ${r(w)}C${r(R)} ${r(I)} ${r(f)} ${r(u)} ${r(m)} ${r(S)}C${r(x)} ${r(h)} ${r(E)} ${r(d)} ${r(c)} ${r(p)}C${r(N)} ${r(y)} ${r(B)} ${r(e)} ${r(_)} ${r(U)}Z`}function e$($,J,Z,K,Q=0,H=null,z=!1,q=6){if($==null||J==null||Z==null||K==null)throw new Error("rectToPathData: x, y, width, and height parameters are required");if(!Number.isFinite(q)||q<0)throw new Error("rectToPathData: precision must be non-negative");let W=S0($),j=S0(J),G=S0(Z),F=S0(K);if(!W.isFinite())throw new Error("rectToPathData: x must be finite");if(!j.isFinite())throw new Error("rectToPathData: y must be finite");if(!G.isFinite()||G.isNegative())throw new Error("rectToPathData: width must be finite and non-negative");if(!F.isFinite()||F.isNegative())throw new Error("rectToPathData: height must be finite and non-negative");if(G.isZero()||F.isZero())return"";let _=S0(Q||0),U=H!==null?S0(H):_;if(!_.isFinite()||_.isNegative())throw new Error("rectToPathData: rx must be finite and non-negative");if(!U.isFinite()||U.isNegative())throw new Error("rectToPathData: ry must be finite and non-negative");let O=G.div(2),V=F.div(2);if(_.gt(O))_=O;if(U.gt(V))U=V;let M=(E)=>H6(E,q);if(_.isZero()||U.isZero()){let E=W.plus(G),d=j.plus(F);return`M${M(W)} ${M(j)}H${M(E)}V${M(d)}H${M(W)}Z`}let Y=W,X=W.plus(G),w=j,R=j.plus(F),I=Y.plus(_),f=X.minus(_),u=w.plus(U),m=R.minus(U);if(z)return`M${M(I)} ${M(w)}L${M(f)} ${M(w)}A${M(_)} ${M(U)} 0 0 1 ${M(X)} ${M(u)}L${M(X)} ${M(m)}A${M(_)} ${M(U)} 0 0 1 ${M(f)} ${M(R)}L${M(I)} ${M(R)}A${M(_)} ${M(U)} 0 0 1 ${M(Y)} ${M(m)}L${M(Y)} ${M(u)}A${M(_)} ${M(U)} 0 0 1 ${M(I)} ${M(w)}Z`;let S=i$(),x=S.mul(_),h=S.mul(U);return`M${M(I)} ${M(w)}L${M(f)} ${M(w)}C${M(f.plus(x))} ${M(w)} ${M(X)} ${M(u.minus(h))} ${M(X)} ${M(u)}L${M(X)} ${M(m)}C${M(X)} ${M(m.plus(h))} ${M(f.plus(x))} ${M(R)} ${M(f)} ${M(R)}L${M(I)} ${M(R)}C${M(I.minus(x))} ${M(R)} ${M(Y)} ${M(m.plus(h))} ${M(Y)} ${M(m)}L${M(Y)} ${M(u)}C${M(Y)} ${M(u.minus(h))} ${M(I.minus(x))} ${M(w)} ${M(I)} ${M(w)}Z`}function $9($,J,Z,K,Q=6){if($==null||J==null||Z==null||K==null)throw new Error("lineToPathData: x1, y1, x2, and y2 parameters are required");if(!Number.isFinite(Q)||Q<0)throw new Error("lineToPathData: precision must be non-negative");let H=S0($),z=S0(J),q=S0(Z),W=S0(K);if(!H.isFinite()||!z.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("lineToPathData: all coordinates must be finite");let j=(G)=>H6(G,Q);return`M${j(H)} ${j(z)}L${j(q)} ${j(W)}`}function RQ($){if($==null)return[];if(Array.isArray($))try{return $.map(([H,z])=>[S0(H),S0(z)])}catch(H){return[]}let J=$;if(typeof J==="object"&&J.baseVal!==void 0)J=J.baseVal;if(typeof J!=="string")if(typeof J.toString==="function")J=J.toString();else return[];let Z=[],K=J.split(/[\s,]+/).filter((H)=>H.length>0);for(let H of K)try{Z.push(S0(H))}catch(z){continue}let Q=[];for(let H=0;H<Z.length;H+=2)if(H+1<Z.length)Q.push([Z[H],Z[H+1]]);return Q}function _$($,J=6){if(!Number.isFinite(J)||J<0)throw new Error("polylineToPathData: precision must be non-negative");let Z=RQ($);if(Z.length===0)return"";let K=(q)=>H6(q,J),[Q,H]=Z[0],z=`M${K(Q)} ${K(H)}`;for(let q=1;q<Z.length;q++){let[W,j]=Z[q];z+=`L${K(W)} ${K(j)}`}return z}function J9($,J=6){if(!Number.isFinite(J)||J<0)throw new Error("polygonToPathData: precision must be non-negative");let Z=_$($,J);return Z?Z+" Z":""}var BQ={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function v6($){if($==null)throw new Error("parsePathData: pathData parameter is required");if(typeof $!=="string")throw new Error("parsePathData: pathData must be a string");let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])\s*([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,q=[];if(H.length>0)for(let j of H.matchAll(z))try{q.push(S0(j[0]))}catch(G){continue}let W=BQ[Q];if(W===0||q.length===0)J.push({command:Q,args:[]});else for(let j=0;j<q.length;j+=W){let G=q.slice(j,j+W);if(G.length===W){let F=Q;if(j>0&&(Q==="M"||Q==="m"))F=Q==="M"?"L":"l";J.push({command:F,args:G})}}}return J}function K9($,J=6){if($==null)throw new Error("pathArrayToString: commands parameter is required");if(!Array.isArray($))throw new Error("pathArrayToString: commands must be an array");if(!Number.isFinite(J)||J<0)throw new Error("pathArrayToString: precision must be non-negative");return $.map((Z)=>{if(!Z||typeof Z.command!=="string"||!Array.isArray(Z.args))throw new Error("pathArrayToString: each command must have 'command' (string) and 'args' (array) properties");let{command:K,args:Q}=Z,H=Q.map((z)=>H6(z,J)).join(" ");return H.length>0?`${K} ${H}`:K}).join(" ")}function o8($){if($==null)throw new Error("pathToAbsolute: pathData parameter is required");let J=v6($),Z=[],K=new k(0),Q=new k(0),H=new k(0),z=new k(0),q=new k(0),W=new k(0),j="";for(let{command:G,args:F}of J){let _=G===G.toLowerCase(),U=G.toUpperCase();if(U==="M"){if(F.length<2)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1];K=O,Q=V,H=O,z=V,Z.push({command:"M",args:[O,V]}),j="M"}else if(U==="L"){if(F.length<2)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1];K=O,Q=V,Z.push({command:"L",args:[O,V]}),j="L"}else if(U==="H"){if(F.length<1)continue;let O=_?K.plus(F[0]):F[0];K=O,Z.push({command:"L",args:[O,Q]}),j="H"}else if(U==="V"){if(F.length<1)continue;let O=_?Q.plus(F[0]):F[0];Q=O,Z.push({command:"L",args:[K,O]}),j="V"}else if(U==="C"){if(F.length<6)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1],M=_?K.plus(F[2]):F[2],Y=_?Q.plus(F[3]):F[3],X=_?K.plus(F[4]):F[4],w=_?Q.plus(F[5]):F[5];q=M,W=Y,K=X,Q=w,Z.push({command:"C",args:[O,V,M,Y,X,w]}),j="C"}else if(U==="S"){if(F.length<4)continue;let O,V;if(j==="C"||j==="S")O=K.mul(2).minus(q),V=Q.mul(2).minus(W);else O=K,V=Q;let M=_?K.plus(F[0]):F[0],Y=_?Q.plus(F[1]):F[1],X=_?K.plus(F[2]):F[2],w=_?Q.plus(F[3]):F[3];q=M,W=Y,K=X,Q=w,Z.push({command:"C",args:[O,V,M,Y,X,w]}),j="S"}else if(U==="Q"){if(F.length<4)continue;let O=_?K.plus(F[0]):F[0],V=_?Q.plus(F[1]):F[1],M=_?K.plus(F[2]):F[2],Y=_?Q.plus(F[3]):F[3];q=O,W=V,K=M,Q=Y,Z.push({command:"Q",args:[O,V,M,Y]}),j="Q"}else if(U==="T"){if(F.length<2)continue;let O,V;if(j==="Q"||j==="T")O=K.mul(2).minus(q),V=Q.mul(2).minus(W);else O=K,V=Q;let M=_?K.plus(F[0]):F[0],Y=_?Q.plus(F[1]):F[1];q=O,W=V,K=M,Q=Y,Z.push({command:"Q",args:[O,V,M,Y]}),j="T"}else if(U==="A"){if(F.length<7)continue;let O=_?K.plus(F[5]):F[5],V=_?Q.plus(F[6]):F[6];K=O,Q=V,Z.push({command:"A",args:[F[0],F[1],F[2],F[3],F[4],O,V]}),j="A"}else if(U==="Z")K=H,Q=z,Z.push({command:"Z",args:[]}),j="Z";else Z.push({command:G,args:F}),j=G}return K9(Z)}function i8($,J=6){if($==null)throw new Error("convertElementToPath: element parameter is required");if(!Number.isFinite(J)||J<0)throw new Error("convertElementToPath: precision must be non-negative");let Z=(Q,H=0)=>{let z=$.getAttribute?$.getAttribute(Q):$[Q];return NQ(z!==void 0&&z!==null?z:H)},K=($.tagName||$.type||"").toLowerCase();if(K==="circle")return a$(Z("cx",0),Z("cy",0),Z("r",0),J);else if(K==="ellipse")return t$(Z("cx",0),Z("cy",0),Z("rx",0),Z("ry",0),J);else if(K==="rect")return e$(Z("x",0),Z("y",0),Z("width",0),Z("height",0),Z("rx",0),Z("ry",null),!1,J);else if(K==="line")return $9(Z("x1",0),Z("y1",0),Z("x2",0),Z("y2",0),J);else if(K==="polyline")return _$(Z("points",""),J);else if(K==="polygon")return J9(Z("points",""),J);return null}function NQ($){if($==null)return 0;if(typeof $==="string"){let Z=parseFloat($);return isNaN(Z)?0:Z}if(typeof $==="number")return isNaN($)?0:$;if($ instanceof k)return $.toNumber();let J=Number($);return isNaN(J)?0:J}var L7=($)=>{if($ instanceof k){if(!$.isFinite())throw new Error(`Value must be finite (got ${$.toString()})`);return $}try{let J=new k($);if(!J.isFinite())throw new Error(`Value must be finite (got ${$})`);return J}catch(J){throw new Error(`Invalid numeric value: "${$}" (${J.message})`)}};function V7($,J){if($===void 0||$===null)throw new Error(`${J} is required`);if(typeof $!=="number"&&typeof $!=="string"&&!($ instanceof k))throw new Error(`${J} must be a number, string, or Decimal`);if(typeof $==="number"&&!isFinite($))throw new Error(`${J} must be a finite number (got ${$})`);if($ instanceof k&&!$.isFinite())throw new Error(`${J} must be a finite Decimal (got ${$.toString()})`)}function i0($,J){return V7($,"tx"),V7(J,"ty"),_0.from([[new k(1),new k(0),L7($)],[new k(0),new k(1),L7(J)],[new k(0),new k(0),new k(1)]])}function w7($,J=null){if(V7($,"sx"),J!==null)V7(J,"sy");let Z=J===null?$:J,K=L7($),Q=L7(Z);if(K.isZero()||Q.isZero())throw new Error("Scale factors cannot be zero (creates singular matrix)");return _0.from([[K,new k(0),new k(0)],[new k(0),Q,new k(0)],[new k(0),new k(0),new k(1)]])}function O6($){V7($,"theta");let Z=L7($).toNumber(),K=Math.PI,Q=Z-2*K*Math.floor((Z+K)/(2*K));if(!isFinite(Q))throw new Error(`Angle normalization failed for theta=${$} (too large or invalid)`);let H=new k(Math.cos(Q)),z=new k(Math.sin(Q));if(!H.isFinite()||!z.isFinite())throw new Error(`Trigonometric computation failed for theta=${$} (produced non-finite values)`);return _0.from([[H,z.negated(),new k(0)],[z,H,new k(0)],[new k(0),new k(0),new k(1)]])}function a8($,J,Z){V7($,"theta"),V7(J,"px"),V7(Z,"py");let K=L7(J),Q=L7(Z);return i0(K,Q).mul(O6($)).mul(i0(K.negated(),Q.negated()))}function Z9($,J){V7($,"ax"),V7(J,"ay");let Z=L7($),K=L7(J);if(new k(1).minus(Z.mul(K)).lessThanOrEqualTo(0))throw new Error(`Skew parameters create singular or orientation-inverting matrix (ax*ay = ${Z.mul(K).toString()}, must be < 1)`);return _0.from([[new k(1),Z,new k(0)],[K,new k(1),new k(0)],[new k(0),new k(0),new k(1)]])}function c0($,J,Z){if(!$||typeof $.mul!=="function")throw new Error("applyTransform: first argument must be a Matrix");if(!$.data||!Array.isArray($.data)||$.data.length!==3||!$.data[0]||$.data[0].length!==3||!$.data[1]||$.data[1].length!==3||!$.data[2]||$.data[2].length!==3)throw new Error("applyTransform: matrix must be 3x3");V7(J,"x"),V7(Z,"y");let K=_0.from([[L7(J)],[L7(Z)],[new k(1)]]),Q=$.mul(K);if(!Q||!Q.data||!Array.isArray(Q.data)||Q.data.length!==3||!Q.data[0]||!Q.data[0][0]||!Q.data[1]||!Q.data[1][0]||!Q.data[2]||!Q.data[2][0])throw new Error("applyTransform: matrix multiplication produced invalid result");let H=Q.data[0][0],z=Q.data[1][0],q=Q.data[2][0];if(q.isZero())throw new Error("applyTransform: perspective division by zero (invalid transformation matrix)");return[H.div(q),z.div(q)]}k.set({precision:80});function t8($,J,Z){return Q9($,J,Z,Z)}function Q9($,J,Z,K){let Q=(R)=>new k(R),H=Q($),z=Q(J),q=Q(Z),W=Q(K);if(!q.isFinite()||!W.isFinite()||!H.isFinite()||!z.isFinite())throw new Error("Ellipse parameters must be finite");if(q.eq(0)||W.eq(0))return console.warn("Degenerate ellipse with zero radius, returning empty path"),"";if(q.lt(0)||W.lt(0))throw new Error("Ellipse radii must be non-negative");let j=Q("0.5522847498307936"),G=q.mul(j),F=W.mul(j),_=H.plus(q),U=z,O=H,V=z.minus(W),M=H.minus(q),Y=z,X=H,w=z.plus(W);return[`M ${_.toFixed(6)} ${U.toFixed(6)}`,`C ${_.toFixed(6)} ${U.minus(F).toFixed(6)} ${O.plus(G).toFixed(6)} ${V.toFixed(6)} ${O.toFixed(6)} ${V.toFixed(6)}`,`C ${O.minus(G).toFixed(6)} ${V.toFixed(6)} ${M.toFixed(6)} ${Y.minus(F).toFixed(6)} ${M.toFixed(6)} ${Y.toFixed(6)}`,`C ${M.toFixed(6)} ${Y.plus(F).toFixed(6)} ${X.minus(G).toFixed(6)} ${w.toFixed(6)} ${X.toFixed(6)} ${w.toFixed(6)}`,`C ${X.plus(G).toFixed(6)} ${w.toFixed(6)} ${_.toFixed(6)} ${U.plus(F).toFixed(6)} ${_.toFixed(6)} ${U.toFixed(6)}`,"Z"].join(" ")}function e8($,J,Z,K,Q=0,H=null){let z=(M)=>new k(M),q=z($),W=z(J),j=z(Z),G=z(K);if(j.lte(0)||G.lte(0))throw new Error("Rectangle dimensions must be positive");if(!j.isFinite()||!G.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("Rectangle parameters must be finite");let F=z(Q),_=H!==null?z(H):F;if(F.lt(0)||_.lt(0))throw new Error("Rectangle corner radii must be non-negative");let U=j.div(2),O=G.div(2);if(F.gt(U))F=U;if(_.gt(O))_=O;if(!(F.gt(0)||_.gt(0)))return[`M ${q.toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.plus(G).toFixed(6)}`,`L ${q.toFixed(6)} ${W.plus(G).toFixed(6)}`,"Z"].join(" ");return[`M ${q.plus(F).toFixed(6)} ${W.toFixed(6)}`,`L ${q.plus(j).minus(F).toFixed(6)} ${W.toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(j).toFixed(6)} ${W.plus(_).toFixed(6)}`,`L ${q.plus(j).toFixed(6)} ${W.plus(G).minus(_).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(j).minus(F).toFixed(6)} ${W.plus(G).toFixed(6)}`,`L ${q.plus(F).toFixed(6)} ${W.plus(G).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.toFixed(6)} ${W.plus(G).minus(_).toFixed(6)}`,`L ${q.toFixed(6)} ${W.plus(_).toFixed(6)}`,`A ${F.toFixed(6)} ${_.toFixed(6)} 0 0 1 ${q.plus(F).toFixed(6)} ${W.toFixed(6)}`].join(" ")}function $J($,J,Z,K){let Q=(j)=>new k(j),H=Q($),z=Q(J),q=Q(Z),W=Q(K);if(!H.isFinite()||!z.isFinite()||!q.isFinite()||!W.isFinite())throw new Error("lineToPath: all parameters must be finite");return`M ${H.toFixed(6)} ${z.toFixed(6)} L ${q.toFixed(6)} ${W.toFixed(6)}`}function JJ($){let J=ZJ($);if(J.length===0)return"";let Z=`M ${J[0][0]} ${J[0][1]}`;for(let K=1;K<J.length;K++)Z+=` L ${J[K][0]} ${J[K][1]}`;return Z+" Z"}function KJ($){let J=ZJ($);if(J.length===0)return"";let Z=`M ${J[0][0]} ${J[0][1]}`;for(let K=1;K<J.length;K++)Z+=` L ${J[K][0]} ${J[K][1]}`;return Z}function ZJ($){if(!$)return[];let J;try{if(Array.isArray($))J=$.flat().map((K)=>new k(K).toFixed(6));else if(typeof $==="string")J=$.trim().split(/[\s,]+/).filter((K)=>K.length>0).map((K)=>new k(K).toFixed(6));else return console.warn("parsePointPairs: invalid input type"),[]}catch(K){return console.warn(`parsePointPairs: parse error - ${K.message}`),[]}if(J.length%2!==0)console.warn("parsePointPairs: odd number of coordinates, ignoring last value"),J=J.slice(0,-1);let Z=[];for(let K=0;K+1<J.length;K+=2)Z.push([J[K],J[K+1]]);return Z}function IQ($,J,Z,K,Q,H,z,q){let W=(Q0)=>new k(Q0),j=W("1e-16");if(!q||!q.data||!Array.isArray(q.data)||q.data.length<3)throw new Error("transformArc: invalid matrix");let G=W($),F=W(J);if(G.lte(0)||F.lte(0))return console.warn("transformArc: radii must be positive, returning degenerate arc"),{rx:0,ry:0,xAxisRotation:0,largeArcFlag:K,sweepFlag:Q,x:W(H).toNumber(),y:W(z).toNumber()};let _=K;if(typeof _!=="number"||_!==0&&_!==1)console.warn(`transformArc: largeArcFlag must be 0 or 1, got ${K}`),_=_?1:0;let U=Q;if(typeof U!=="number"||U!==0&&U!==1)console.warn(`transformArc: sweepFlag must be 0 or 1, got ${Q}`),U=U?1:0;let O=q.data[0][0],V=q.data[1][0],M=q.data[0][1],Y=q.data[1][1],X=q.data[0][2],w=q.data[1][2],R=W(H),I=W(z),f=O.mul(R).plus(M.mul(I)).plus(X),u=V.mul(R).plus(Y.mul(I)).plus(w),m=W(Z).mul(W(Math.PI)).div(180),S=k.sin(m),x=k.cos(m),h=O.mul(G).mul(x).plus(M.mul(G).mul(S)),E=V.mul(G).mul(x).plus(Y.mul(G).mul(S)),d=O.mul(F.neg()).mul(S).plus(M.mul(F).mul(x)),c=V.mul(F.neg()).mul(S).plus(Y.mul(F).mul(x)),p=h.mul(h).plus(d.mul(d)),N=E.mul(E).plus(c.mul(c)),y=h.mul(E).plus(d.mul(c)).mul(2),B=p.minus(N),e,r,s;if(y.abs().lt(j))e=W(0),r=p,s=N;else if(B.abs().lt(j))r=p.plus(y.mul("0.5")),s=p.minus(y.mul("0.5")),e=W(Math.PI).div(4);else{let Q0=W(1).plus(y.mul(y).div(B.mul(B))).sqrt();r=p.plus(N).plus(Q0.mul(B)).div(2),s=p.plus(N).minus(Q0.mul(B)).div(2),e=k.atan(y.div(B)).div(2)}if(r.lt(0))r=W(0);if(s.lt(0))s=W(0);let z0=r.sqrt(),T=s.sqrt();if(B.lte(0)){let Q0=z0;z0=T,T=Q0}if(T.gt(z0)){let Q0=z0;z0=T,T=Q0,e=e.plus(W(Math.PI).div(2))}let P=O.mul(Y).minus(V.mul(M)),t=U;if(P.lt(0))t=U?0:1;let $0=e.mul(180).div(W(Math.PI));while($0.lt(0))$0=$0.plus(180);while($0.gte(180))$0=$0.minus(180);return{rx:z0.toNumber(),ry:T.toNumber(),xAxisRotation:$0.toNumber(),largeArcFlag:_,sweepFlag:t,x:f.toNumber(),y:u.toNumber()}}function CQ($,J){if(!$||typeof $!=="string")return console.warn("parseTransformFunction: invalid function name"),_0.identity(3);if(!J||!Array.isArray(J))return console.warn("parseTransformFunction: invalid arguments array"),_0.identity(3);let Z=(K)=>new k(K);switch($.toLowerCase()){case"translate":{let K=J[0]!==void 0?J[0]:0,Q=J[1]!==void 0?J[1]:0;return i0(K,Q)}case"scale":{let K=J[0]!==void 0?J[0]:1,Q=J[1]!==void 0?J[1]:K;return w7(K,Q)}case"rotate":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180);if(J.length>=3){if(J[1]===void 0||J[2]===void 0||!isFinite(J[1])||!isFinite(J[2]))return console.warn("parseTransformFunction: rotate(angle, cx, cy) has invalid cx or cy, using origin rotation"),O6(Q);let H=J[1],z=J[2];return a8(Q,H,z)}return O6(Q)}case"skewx":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180),H=k.tan(Q);return Z9(H,0)}case"skewy":{let K=J[0]!==void 0?J[0]:0,Q=Z(K).mul(Z(Math.PI)).div(180),H=k.tan(Q);return Z9(0,H)}case"matrix":{if(J.length<6)return console.warn(`parseTransformFunction: matrix() requires 6 arguments, got ${J.length}`),_0.identity(3);let[K,Q,H,z,q,W]=J.slice(0,6).map((j)=>Z(j!==void 0?j:0));return _0.from([[K,H,q],[Q,z,W],[Z(0),Z(0),Z(1)]])}default:return console.warn(`Unknown transform function: ${$}`),_0.identity(3)}}function j7($){if(!$||$.trim()==="")return _0.identity(3);let J=/(\w+)\s*\(([^)]*)\)/g,Z,K=_0.identity(3);while((Z=J.exec($))!==null){let Q=Z[1],z=Z[2].split(/[\s,]+/).filter((W)=>W.length>0).map((W)=>{let j=parseFloat(W);if(isNaN(j))return console.warn(`parseTransformAttribute: invalid numeric argument "${W}" in ${Q}(), using 0`),0;return j}),q=CQ(Q,z);K=K.mul(q)}return K}function M7($,J,Z){if(!$||!$.data||!Array.isArray($.data))throw new Error("applyToPoint: invalid CTM matrix");let K=(z)=>new k(z);try{let z=K(J),q=K(Z);if(!z.isFinite()||!q.isFinite())throw new Error("applyToPoint: coordinates must be finite")}catch(z){throw new Error(`applyToPoint: invalid coordinates - ${z.message}`)}let[Q,H]=c0($,J,Z);return{x:Q,y:H}}function QJ($,J=6){if(!$||!$.data||!Array.isArray($.data)||$.data.length<3||!Array.isArray($.data[0])||!Array.isArray($.data[1])||$.data[0].length<3||$.data[1].length<3)throw new Error("toSVGMatrix: invalid CTM matrix structure");let Z=J;if(typeof Z!=="number"||Z<0||Z>20)console.warn("toSVGMatrix: invalid precision, using default 6"),Z=6;try{let K=$.data[0][0].toFixed(Z),Q=$.data[1][0].toFixed(Z),H=$.data[0][1].toFixed(Z),z=$.data[1][1].toFixed(Z),q=$.data[0][2].toFixed(Z),W=$.data[1][2].toFixed(Z);return`matrix(${K}, ${Q}, ${H}, ${z}, ${q}, ${W})`}catch(K){throw new Error(`toSVGMatrix: invalid matrix elements - ${K.message}`)}}function Y6($,J,Z={}){if(!$||typeof $!=="string")return console.warn("transformPathData: invalid pathData (must be string)"),"";if(!J||!J.data)return console.warn("transformPathData: invalid CTM matrix"),$;let{toAbsolute:K=!0,precision:Q=6}=Z,H=Q;if(typeof H!=="number"||H<0||H>20||!isFinite(H))console.warn("transformPathData: invalid precision, using default 6"),H=6;let z=(U)=>new k(U),q=PQ($);if(q.length===0)return"";let W=[],j=z(0),G=z(0),F=z(0),_=z(0);for(let{cmd:U,args:O}of q){let V=U===U.toLowerCase();switch(U.toUpperCase()){case"M":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: M command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);if(Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R,X===0)F=w,_=R}W.push((K?"M":U)+" "+Y.join(" "));break}case"L":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: L command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R}W.push((K?"L":U)+" "+Y.join(" "));break}case"H":{if(O.length<1){console.warn("transformPathData: H command requires at least 1 argument");break}for(let Y=0;Y<O.length;Y++){let X=z(O[Y]);if(V)X=X.plus(j);let R=M7(J,X,G);W.push("L "+R.x.toFixed(H)+" "+R.y.toFixed(H)),j=X}break}case"V":{if(O.length<1){console.warn("transformPathData: V command requires at least 1 argument");break}for(let Y=0;Y<O.length;Y++){let X=j,w=z(O[Y]);if(V)w=w.plus(G);let R=M7(J,X,w);W.push("L "+R.x.toFixed(H)+" "+R.y.toFixed(H)),G=w}break}case"C":{let Y=[];if(O.length%6!==0)console.warn(`transformPathData: C command has ${O.length} args, expected multiple of 6`);for(let X=0;X+5<O.length;X+=6){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]),u=z(O[X+4]),m=z(O[X+5]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G),u=u.plus(j),m=m.plus(G);let S=M7(J,w,R),x=M7(J,I,f),h=M7(J,u,m);Y.push(S.x.toFixed(H),S.y.toFixed(H),x.x.toFixed(H),x.y.toFixed(H),h.x.toFixed(H),h.y.toFixed(H)),j=u,G=m}W.push((K?"C":U)+" "+Y.join(" "));break}case"S":{let Y=[];if(O.length%4!==0)console.warn(`transformPathData: S command has ${O.length} args, expected multiple of 4`);for(let X=0;X+3<O.length;X+=4){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G);let u=M7(J,w,R),m=M7(J,I,f);Y.push(u.x.toFixed(H),u.y.toFixed(H),m.x.toFixed(H),m.y.toFixed(H)),j=I,G=f}W.push((K?"S":U)+" "+Y.join(" "));break}case"Q":{let Y=[];if(O.length%4!==0)console.warn(`transformPathData: Q command has ${O.length} args, expected multiple of 4`);for(let X=0;X+3<O.length;X+=4){let w=z(O[X]),R=z(O[X+1]),I=z(O[X+2]),f=z(O[X+3]);if(V)w=w.plus(j),R=R.plus(G),I=I.plus(j),f=f.plus(G);let u=M7(J,w,R),m=M7(J,I,f);Y.push(u.x.toFixed(H),u.y.toFixed(H),m.x.toFixed(H),m.y.toFixed(H)),j=I,G=f}W.push((K?"Q":U)+" "+Y.join(" "));break}case"T":{let Y=[];if(O.length%2!==0)console.warn(`transformPathData: T command has ${O.length} args, expected multiple of 2`);for(let X=0;X+1<O.length;X+=2){let w=z(O[X]),R=z(O[X+1]);if(V)w=w.plus(j),R=R.plus(G);let I=M7(J,w,R);Y.push(I.x.toFixed(H),I.y.toFixed(H)),j=w,G=R}W.push((K?"T":U)+" "+Y.join(" "));break}case"A":{let Y=[];if(O.length%7!==0)console.warn(`transformPathData: Arc command has ${O.length} args, expected multiple of 7`);for(let X=0;X+6<O.length;X+=7){let w=O[X],R=O[X+1],I=O[X+2],f=O[X+3],u=O[X+4],m=z(O[X+5]),S=z(O[X+6]);if(V)m=m.plus(j),S=S.plus(G);let x=IQ(w,R,I,f,u,m.toNumber(),S.toNumber(),J);Y.push(x.rx.toFixed(H),x.ry.toFixed(H),x.xAxisRotation.toFixed(H),x.largeArcFlag,x.sweepFlag,x.x.toFixed(H),x.y.toFixed(H)),j=m,G=S}W.push((K?"A":U)+" "+Y.join(" "));break}case"Z":{W.push("Z"),j=F,G=_;break}default:W.push(U+" "+O.join(" "))}}return W.join(" ")}function PQ($){if(!$||typeof $!=="string")return[];let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=H.length>0?H.split(/[\s,]+/).filter((q)=>q.length>0).map((q)=>{let W=parseFloat(q);if(isNaN(W))return console.warn(`parsePathCommands: invalid number '${q}'`),0;return W}):[];J.push({cmd:Q,args:z})}return J}var B7={};x$(B7,{sign:()=>H9,segmentIntersection:()=>V$,reversePolygon:()=>j9,polygonUnion:()=>z6,polygonIntersection:()=>A7,polygonDifference:()=>FJ,polygonArea:()=>D6,pointsEqual:()=>D7,pointOnSegment:()=>z9,pointInPolygon:()=>R7,point:()=>b0,lineSegmentIntersection:()=>jJ,isCounterClockwise:()=>W9,isConvex:()=>F9,ensureCCW:()=>M$,dot:()=>WJ,default:()=>fQ,cross:()=>h7,convexHull:()=>G9,clipPolygonSH:()=>q9,boundingBox:()=>y7,bboxIntersects:()=>h6});k.set({precision:80});var O7=($)=>$ instanceof k?$:new k($),G7=new k("1e-40");function b0($,J){if($===null||$===void 0)throw new Error("point: x coordinate is required");if(J===null||J===void 0)throw new Error("point: y coordinate is required");return{x:O7($),y:O7(J)}}function D7($,J,Z=G7){if(!$||typeof $!=="object"||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointsEqual: p1 must be a point with x and y properties");if(!J||typeof J!=="object"||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("pointsEqual: p2 must be a point with x and y properties");if(!Z||typeof Z.abs!=="function")throw new Error("pointsEqual: tolerance must be a Decimal instance");return $.x.minus(J.x).abs().lt(Z)&&$.y.minus(J.y).abs().lt(Z)}function h7($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("cross: origin point o must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("cross: point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("cross: point b must have x and y properties");let K=J.x.minus($.x),Q=J.y.minus($.y),H=Z.x.minus($.x),z=Z.y.minus($.y);return K.mul(z).minus(Q.mul(H))}function WJ($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("dot: origin point o must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("dot: point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("dot: point b must have x and y properties");let K=J.x.minus($.x),Q=J.y.minus($.y),H=Z.x.minus($.x),z=Z.y.minus($.y);return K.mul(H).plus(Q.mul(z))}function H9($){if($===null||$===void 0||typeof $.abs!=="function")throw new Error("sign: val must be a Decimal instance");if($.abs().lt(G7))return 0;return $.lt(0)?-1:1}function V$($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("segmentIntersection: point a must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("segmentIntersection: point b must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("segmentIntersection: point c must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("segmentIntersection: point d must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(G7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(q).minus(G.mul(z)).div(W),_=j.mul(H).minus(G.mul(Q)).div(W),U=O7(0),O=O7(1);if(F.gte(U)&&F.lte(O)&&_.gte(U)&&_.lte(O))return{x:$.x.plus(Q.mul(F)),y:$.y.plus(H.mul(F)),t:F,s:_};return null}function jJ($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("lineSegmentIntersection: lineA must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("lineSegmentIntersection: lineB must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("lineSegmentIntersection: segA must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("lineSegmentIntersection: segB must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(G7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(H).minus(G.mul(Q)).div(W);if(F.gte(0)&&F.lte(1))return{x:Z.x.plus(z.mul(F)),y:Z.y.plus(q.mul(F)),s:F};return null}function R7($,J){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointInPolygon: pt must have x and y properties");if(!Array.isArray(J))throw new Error("pointInPolygon: polygon must be an array");let Z=J.length;if(Z<3)return-1;for(let Q=0;Q<Z;Q++)if(!J[Q]||J[Q].x===null||J[Q].x===void 0||J[Q].y===null||J[Q].y===void 0)throw new Error(`pointInPolygon: polygon[${Q}] must have x and y properties`);let K=0;for(let Q=0;Q<Z;Q++){let H=J[Q],z=J[(Q+1)%Z];if(z9($,H,z))return 0;if(H.y.lte($.y)){if(z.y.gt($.y)){if(h7(H,z,$).gt(0))K++}}else if(z.y.lte($.y)){if(h7(H,z,$).lt(0))K--}}return K!==0?1:-1}function z9($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("pointOnSegment: pt must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("pointOnSegment: segment point a must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("pointOnSegment: segment point b must have x and y properties");if(h7(J,Z,$).abs().gt(G7))return!1;let Q=k.min(J.x,Z.x),H=k.max(J.x,Z.x),z=k.min(J.y,Z.y),q=k.max(J.y,Z.y);return $.x.gte(Q.minus(G7))&&$.x.lte(H.plus(G7))&&$.y.gte(z.minus(G7))&&$.y.lte(q.plus(G7))}function q9($,J){if(!Array.isArray($))throw new Error("clipPolygonSH: subject must be an array");if(!Array.isArray(J))throw new Error("clipPolygonSH: clip must be an array");if($.length<3||J.length<3)return[];for(let Q=0;Q<$.length;Q++)if(!$[Q]||$[Q].x===null||$[Q].x===void 0||$[Q].y===null||$[Q].y===void 0)throw new Error(`clipPolygonSH: subject[${Q}] must have x and y properties`);for(let Q=0;Q<J.length;Q++)if(!J[Q]||J[Q].x===null||J[Q].x===void 0||J[Q].y===null||J[Q].y===void 0)throw new Error(`clipPolygonSH: clip[${Q}] must have x and y properties`);let Z=$.map((Q)=>b0(Q.x,Q.y)),K=J.map((Q)=>b0(Q.x,Q.y));K=M$(K);for(let Q=0;Q<K.length;Q++){if(Z.length===0)return[];let H=K[Q],z=K[(Q+1)%K.length],q=Z;Z=[];for(let W=0;W<q.length;W++){let j=q[W],G=q[(W+q.length-1)%q.length],F=zJ(j,H,z),_=zJ(G,H,z);if(F){if(!_){let U=qJ(G,j,H,z);if(U)Z.push(U)}Z.push(j)}else if(_){let U=qJ(G,j,H,z);if(U)Z.push(U)}}}return Z}function zJ($,J,Z){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("isInsideEdge: pt must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("isInsideEdge: edgeStart must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("isInsideEdge: edgeEnd must have x and y properties");return h7(J,Z,$).gte(0)}function qJ($,J,Z,K){if(!$||$.x===null||$.x===void 0||$.y===null||$.y===void 0)throw new Error("lineIntersection: point a must have x and y properties");if(!J||J.x===null||J.x===void 0||J.y===null||J.y===void 0)throw new Error("lineIntersection: point b must have x and y properties");if(!Z||Z.x===null||Z.x===void 0||Z.y===null||Z.y===void 0)throw new Error("lineIntersection: point c must have x and y properties");if(!K||K.x===null||K.x===void 0||K.y===null||K.y===void 0)throw new Error("lineIntersection: point d must have x and y properties");let Q=J.x.minus($.x),H=J.y.minus($.y),z=K.x.minus(Z.x),q=K.y.minus(Z.y),W=Q.mul(q).minus(H.mul(z));if(W.abs().lt(G7))return null;let j=Z.x.minus($.x),G=Z.y.minus($.y),F=j.mul(q).minus(G.mul(z)).div(W);return{x:$.x.plus(Q.mul(F)),y:$.y.plus(H.mul(F))}}function D6($){if(!Array.isArray($))throw new Error("polygonArea: polygon must be an array");let J=$.length;if(J<3)return O7(0);for(let K=0;K<J;K++)if(!$[K]||$[K].x===null||$[K].x===void 0||$[K].y===null||$[K].y===void 0)throw new Error(`polygonArea: polygon[${K}] must have x and y properties`);let Z=O7(0);for(let K=0;K<J;K++){let Q=$[K],H=$[(K+1)%J];Z=Z.plus(Q.x.mul(H.y).minus(H.x.mul(Q.y)))}return Z.div(2)}function W9($){if(!Array.isArray($))throw new Error("isCounterClockwise: polygon must be an array");return D6($).gt(0)}function j9($){if(!Array.isArray($))throw new Error("reversePolygon: polygon must be an array");return[...$].reverse()}function M$($){if(!Array.isArray($))throw new Error("ensureCCW: polygon must be an array");if(!W9($))return j9($);return $}function G9($){if(!Array.isArray($))throw new Error("convexHull: points must be an array");if($.length<3){for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`convexHull: points[${z}] must have x and y properties`);return $.map((z)=>b0(z.x,z.y))}for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`convexHull: points[${z}] must have x and y properties`);let J=$.map((z)=>b0(z.x,z.y)),Z=0;for(let z=1;z<J.length;z++)if(J[z].y.lt(J[Z].y)||J[z].y.eq(J[Z].y)&&J[z].x.lt(J[Z].x))Z=z;[J[0],J[Z]]=[J[Z],J[0]];let K=J[0],Q=J.slice(1).sort((z,q)=>{let W=h7(K,z,q);if(W.abs().lt(G7)){let G=z.x.minus(K.x).pow(2).plus(z.y.minus(K.y).pow(2)),F=q.x.minus(K.x).pow(2).plus(q.y.minus(K.y).pow(2)),_=G.minus(F);if(_.abs().lt(G7))return 0;return _.lt(0)?-1:1}return-H9(W)}),H=[K];for(let z of Q){while(H.length>1&&h7(H[H.length-2],H[H.length-1],z).lte(0))H.pop();H.push(z)}return H}function y7($){if(!Array.isArray($))throw new Error("boundingBox: polygon must be an array");if($.length===0)return null;if(!$[0]||$[0].x===null||$[0].x===void 0||$[0].y===null||$[0].y===void 0)throw new Error("boundingBox: polygon[0] must have x and y properties");let J=O7($[0].x),Z=O7($[0].y),K=O7($[0].x),Q=O7($[0].y);for(let H=0;H<$.length;H++){let z=$[H];if(!z||z.x===null||z.x===void 0||z.y===null||z.y===void 0)throw new Error(`boundingBox: polygon[${H}] must have x and y properties`);let q=O7(z.x),W=O7(z.y);if(q.lt(J))J=q;if(W.lt(Z))Z=W;if(q.gt(K))K=q;if(W.gt(Q))Q=W}return{minX:J,minY:Z,maxX:K,maxY:Q}}function h6($,J){if(!$||!J)return!1;if($.minX===null||$.minX===void 0||$.minY===null||$.minY===void 0||$.maxX===null||$.maxX===void 0||$.maxY===null||$.maxY===void 0)throw new Error("bboxIntersects: bb1 must have minX, minY, maxX, maxY properties");if(J.minX===null||J.minX===void 0||J.minY===null||J.minY===void 0||J.maxX===null||J.maxX===void 0||J.maxY===null||J.maxY===void 0)throw new Error("bboxIntersects: bb2 must have minX, minY, maxX, maxY properties");return!($.maxX.lt(J.minX)||J.maxX.lt($.minX)||$.maxY.lt(J.minY)||J.maxY.lt($.minY))}function A7($,J){if(!Array.isArray($))throw new Error("polygonIntersection: subject must be an array");if(!Array.isArray(J))throw new Error("polygonIntersection: clip must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonIntersection: subject[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonIntersection: clip[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=y7(Z),H=y7(K);if(!h6(Q,H))return[];if(F9(K)){let z=q9(Z,M$(K));return z.length>=3?[z]:[]}return AQ(Z,K)}function F9($){if(!Array.isArray($))throw new Error("isConvex: polygon must be an array");let J=$.length;if(J<3)return!1;for(let K=0;K<J;K++)if(!$[K]||$[K].x===null||$[K].x===void 0||$[K].y===null||$[K].y===void 0)throw new Error(`isConvex: polygon[${K}] must have x and y properties`);let Z=0;for(let K=0;K<J;K++){let Q=$[K],H=$[(K+1)%J],z=$[(K+2)%J],q=h7(Q,H,z),W=q.gt(0)?1:q.lt(0)?-1:0;if(W!==0){if(Z===0)Z=W;else if(Z!==W)return!1}}return!0}function AQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("generalPolygonIntersection: both arguments must be arrays");let Z=[];for(let W=0;W<$.length;W++){let j=$[W],G=$[(W+1)%$.length];for(let F=0;F<J.length;F++){let _=J[F],U=J[(F+1)%J.length],O=V$(j,G,_,U);if(O)Z.push(b0(O.x,O.y))}}let K=$.filter((W)=>R7(W,J)>=0),Q=J.filter((W)=>R7(W,$)>=0),H=[...Z,...K,...Q];if(H.length<3)return[];let z=EQ(H);if(z.length<3)return[];let q=G9(z);return q.length>=3?[q]:[]}function EQ($){if(!Array.isArray($))throw new Error("removeDuplicatePoints: points must be an array");let J=[];for(let Z of $){let K=!1;for(let Q of J)if(D7(Z,Q)){K=!0;break}if(!K)J.push(Z)}return J}function z6($,J){if(!Array.isArray($))throw new Error("polygonUnion: polygon1 must be an array");if(!Array.isArray(J))throw new Error("polygonUnion: polygon2 must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonUnion: polygon1[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonUnion: polygon2[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=y7(Z),H=y7(K);if(!h6(Q,H))return[Z,K];return TQ(Z,K)}function TQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("traceBoundaryUnion: both arguments must be arrays");let Z=GJ($,J);if(Z.length===0){let V=R7($[0],J),M=R7(J[0],$);if(V>0)return[J];else if(M>0)return[$];else return[$,J]}let K=U$($,Z.map((V)=>({edgeIndex:V.edge1,t:V.t1,point:V.point,intersectionId:V.id}))),Q=U$(J,Z.map((V)=>({edgeIndex:V.edge2,t:V.t2,point:V.point,intersectionId:V.id}))),H=new Map;for(let V=0;V<K.length;V++)if(K[V].intersectionId!==void 0){if(!H.has(K[V].intersectionId))H.set(K[V].intersectionId,{});H.get(K[V].intersectionId).idx1=V}for(let V=0;V<Q.length;V++)if(Q[V].intersectionId!==void 0){if(!H.has(Q[V].intersectionId))H.set(Q[V].intersectionId,{});H.get(Q[V].intersectionId).idx2=V}let z=1,q=-1;for(let V=0;V<K.length;V++){let M=K[V];if(M.intersectionId===void 0&&R7(M,J)<0){q=V;break}}if(q===-1){z=2;for(let V=0;V<Q.length;V++){let M=Q[V];if(M.intersectionId===void 0&&R7(M,$)<0){q=V;break}}}if(q===-1){let V=D6($).abs(),M=D6(J).abs();return V.gt(M)?[$]:[J]}let W=[],j=z===1,G=q,F=new Set,_=(K.length+Q.length)*3,U=0,O=`${z}-${q}`;while(U<_){U++;let V=j?K:Q,M=j?Q:K,Y=V[G];if(W.length===0||!D7(W[W.length-1],Y))W.push(b0(Y.x,Y.y));let X=(G+1)%V.length,w=V[X];if(w.intersectionId!==void 0&&!F.has(w.intersectionId)){W.push(b0(w.x,w.y)),F.add(w.intersectionId);let I=H.get(w.intersectionId),f=j?I.idx2:I.idx1;j=!j,G=(f+1)%M.length}else G=X;if(`${j?1:2}-${G}`===O)break}if(W.length>1&&D7(W[0],W[W.length-1]))W.pop();return W.length>=3?[W]:[]}function GJ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("findAllIntersections: both arguments must be arrays");let Z=[],K=0;for(let Q=0;Q<$.length;Q++){let H=$[Q],z=$[(Q+1)%$.length];for(let q=0;q<J.length;q++){let W=J[q],j=J[(q+1)%J.length],G=V$(H,z,W,j);if(G)Z.push({id:K++,point:b0(G.x,G.y),edge1:Q,edge2:q,t1:G.t,t2:G.s})}}return Z}function U$($,J){if(!Array.isArray($))throw new Error("augmentPolygon: polygon must be an array");if(!Array.isArray(J))throw new Error("augmentPolygon: insertions must be an array");let Z=new Map;for(let Q of J){if(!Z.has(Q.edgeIndex))Z.set(Q.edgeIndex,[]);Z.get(Q.edgeIndex).push(Q)}for(let Q of Z.values())Q.sort((H,z)=>H.t.minus(z.t).toNumber());let K=[];for(let Q=0;Q<$.length;Q++)if(K.push({...$[Q]}),Z.has(Q))for(let H of Z.get(Q))K.push({x:H.point.x,y:H.point.y,intersectionId:H.intersectionId});return K}function FJ($,J){if(!Array.isArray($))throw new Error("polygonDifference: polygon1 must be an array");if(!Array.isArray(J))throw new Error("polygonDifference: polygon2 must be an array");for(let z=0;z<$.length;z++)if(!$[z]||$[z].x===null||$[z].x===void 0||$[z].y===null||$[z].y===void 0)throw new Error(`polygonDifference: polygon1[${z}] must have x and y properties`);for(let z=0;z<J.length;z++)if(!J[z]||J[z].x===null||J[z].x===void 0||J[z].y===null||J[z].y===void 0)throw new Error(`polygonDifference: polygon2[${z}] must have x and y properties`);let Z=$.map((z)=>b0(z.x,z.y)),K=J.map((z)=>b0(z.x,z.y)),Q=y7(Z),H=y7(K);if(!h6(Q,H))return[Z];return bQ(Z,K)}function bQ($,J){if(!Array.isArray($)||!Array.isArray(J))throw new Error("traceBoundaryDifference: both arguments must be arrays");let Z=GJ($,J);if(Z.length===0)if(R7($[0],J)>0)return[];else return[$];let K=U$($,Z.map((U)=>({edgeIndex:U.edge1,t:U.t1,point:U.point,intersectionId:U.id}))),Q=U$(J,Z.map((U)=>({edgeIndex:U.edge2,t:U.t2,point:U.point,intersectionId:U.id}))),H=new Map;for(let U=0;U<K.length;U++)if(K[U].intersectionId!==void 0){if(!H.has(K[U].intersectionId))H.set(K[U].intersectionId,{});H.get(K[U].intersectionId).idx1=U}for(let U=0;U<Q.length;U++)if(Q[U].intersectionId!==void 0){if(!H.has(Q[U].intersectionId))H.set(Q[U].intersectionId,{});H.get(Q[U].intersectionId).idx2=U}let z=-1;for(let U=0;U<K.length;U++){let O=K[U];if(O.intersectionId===void 0&&R7(O,J)<0){z=U;break}}if(z===-1)return[];let q=[],W=!0,j=z,G=new Set,F=(K.length+Q.length)*3,_=0;while(_<F){_++;let O=(W?K:Q)[j];if(q.length===0||!D7(q[q.length-1],O))q.push(b0(O.x,O.y));let V=`${W?1:2}-${j}`;if(G.has(V))break;if(G.add(V),W){let M=(j+1)%K.length,Y=K[M];if(Y.intersectionId!==void 0){let X=K[(M+1)%K.length];if(R7(X,J)>0){let R=H.get(Y.intersectionId);q.push(b0(Y.x,Y.y)),W=!1,j=(R.idx2-1+Q.length)%Q.length}else j=M}else j=M}else{let M=(j-1+Q.length)%Q.length,Y=Q[M];if(Y.intersectionId!==void 0){let X=H.get(Y.intersectionId);q.push(b0(Y.x,Y.y)),W=!0,j=(X.idx1+1)%K.length}else j=M}if(W&&j===z)break}if(q.length>1&&D7(q[0],q[q.length-1]))q.pop();return q.length>=3?[q]:[]}var fQ={point:b0,pointsEqual:D7,cross:h7,dot:WJ,sign:H9,segmentIntersection:V$,lineSegmentIntersection:jJ,pointInPolygon:R7,pointOnSegment:z9,clipPolygonSH:q9,polygonArea:D6,isCounterClockwise:W9,reversePolygon:j9,ensureCCW:M$,isConvex:F9,convexHull:G9,boundingBox:y7,bboxIntersects:h6,polygonIntersection:A7,polygonUnion:z6,polygonDifference:FJ,EPSILON:G7};k.set({precision:80});var O$=($)=>$ instanceof k?$:new k($),u7=new k("1e-40"),{point:o7,pointsEqual:mq,cross:_9,polygonArea:dq,polygonIntersection:pq,polygonUnion:cq,polygonDifference:lq,isCounterClockwise:nq,ensureCCW:sq,segmentIntersection:oq}=B7,i7={NONZERO:"nonzero",EVENODD:"evenodd"};function Y$($,J,Z=i7.NONZERO){if(!$||typeof $!=="object")throw new Error("pointInPolygonWithRule: pt must be an object with x, y properties");if($.x===void 0||$.x===null||$.y===void 0||$.y===null)throw new Error("pointInPolygonWithRule: pt must have x and y properties");if(!Array.isArray(J))throw new Error("pointInPolygonWithRule: polygon must be an array");let K=J.length;if(K<3)return-1;let Q=0;for(let H=0;H<K;H++){let z=J[H],q=J[(H+1)%K];if(SQ($,z,q))return 0;if(z.y.lte($.y)){if(q.y.gt($.y)){if(_9(z,q,$).gt(0))Q++}}else if(q.y.lte($.y)){if(_9(z,q,$).lt(0))Q--}}if(Z===i7.EVENODD)return Math.abs(Q)%2===1?1:-1;else return Q!==0?1:-1}function SQ($,J,Z){if(!$||!J||!Z)throw new Error("pointOnSegment: pt, a, and b must be defined");if($.x===void 0||$.x===null||$.y===void 0||$.y===null||J.x===void 0||J.x===null||J.y===void 0||J.y===null||Z.x===void 0||Z.x===null||Z.y===void 0||Z.y===null)throw new Error("pointOnSegment: all points must have x and y properties");if(_9(J,Z,$).abs().gt(u7))return!1;let Q=k.min(J.x,Z.x),H=k.max(J.x,Z.x),z=k.min(J.y,Z.y),q=k.max(J.y,Z.y);return $.x.gte(Q.minus(u7))&&$.x.lte(H.plus(u7))&&$.y.gte(z.minus(u7))&&$.y.lte(q.plus(u7))}function _J($,J,Z={}){if(!Array.isArray($))throw new Error("offsetPolygon: polygon must be an array");if(J===void 0||J===null)throw new Error("offsetPolygon: distance must be defined");if(!Z||typeof Z!=="object")throw new Error("offsetPolygon: options must be an object");let K=O$(J);if(K.lte(0))throw new Error("offsetPolygon: distance must be positive");let Q=Z.linejoin||"miter",H=O$(Z.miterLimit||4);if($.length<3)return{outer:[],inner:[]};let z=$.length,q=[],W=[];for(let j=0;j<z;j++){let G=$[(j-1+z)%z],F=$[j],_=$[(j+1)%z],U=F.x.minus(G.x),O=F.y.minus(G.y),V=_.x.minus(F.x),M=_.y.minus(F.y),Y=U.pow(2).plus(O.pow(2)).sqrt(),X=V.pow(2).plus(M.pow(2)).sqrt();if(Y.lt(u7)||X.lt(u7))continue;let w=O.div(Y),R=U.neg().div(Y),I=M.div(X),f=V.neg().div(X),u=w.plus(I).div(2),m=R.plus(f).div(2),S=u.pow(2).plus(m.pow(2)).sqrt();if(S.lt(u7))u=w,m=R;else u=u.div(S),m=m.div(S);let x=w.times(I).plus(R.times(f)),h=O$(1).minus(x).div(2).sqrt(),E=K;if(h.gt(u7)){let d=K.div(h);if(Q==="miter"&&d.lte(K.times(H)))E=d;else if(Q==="bevel"||d.gt(K.times(H))){let c=o7(F.x.plus(w.times(K)),F.y.plus(R.times(K))),p=o7(F.x.plus(I.times(K)),F.y.plus(f.times(K)));q.push(c,p);let N=o7(F.x.minus(w.times(K)),F.y.minus(R.times(K))),y=o7(F.x.minus(I.times(K)),F.y.minus(f.times(K)));W.push(N,y);continue}else if(Q==="round"){let c=Math.atan2(R.toNumber(),w.toNumber()),N=Math.atan2(f.toNumber(),I.toNumber())-c;if(N<-Math.PI)N+=2*Math.PI;if(N>Math.PI)N-=2*Math.PI;let y=Math.max(2,Math.ceil(Math.abs(N)/(Math.PI/8)));for(let B=0;B<=y;B++){let e=c+N*(B/y);q.push(o7(F.x.plus(K.times(Math.cos(e))),F.y.plus(K.times(Math.sin(e))))),W.push(o7(F.x.minus(K.times(Math.cos(e))),F.y.minus(K.times(Math.sin(e)))))}continue}}q.push(o7(F.x.plus(u.times(E)),F.y.plus(m.times(E)))),W.push(o7(F.x.minus(u.times(E)),F.y.minus(m.times(E))))}return{outer:q,inner:W.reverse()}}function U9($,J){if(!Array.isArray($))throw new Error("strokeToFilledPolygon: polygon must be an array");if(!J||typeof J!=="object")throw new Error("strokeToFilledPolygon: strokeProps must be an object");if(J.width===void 0||J.width===null)throw new Error("strokeToFilledPolygon: strokeProps must have width property");let Z=O$(J.width).div(2);if(Z.lte(0))throw new Error("strokeToFilledPolygon: width must be positive");return _J($,Z,J).outer}k.set({precision:80});var E7=($)=>$ instanceof k?$:new k($),vQ={fill:"black","fill-rule":"nonzero","fill-opacity":1,stroke:"none","stroke-width":1,"stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":4,"stroke-dasharray":"none","stroke-dashoffset":0,"stroke-opacity":1,"marker-start":"none","marker-mid":"none","marker-end":"none","paint-order":"normal","clip-path":"none","clip-rule":"nonzero",mask:"none","mask-type":"luminance",opacity:1,transform:"none","vector-effect":"none",filter:"none"};class X${constructor($,J={},Z=null){if(!$)throw new Error("SVGRenderingContext: element parameter is required");if(J!==null&&typeof J!=="object")throw new Error("SVGRenderingContext: inherited must be an object or null");this.element=$,this.defsMap=Z||new Map,this.properties=this._extractProperties($,J||{}),this.dashArray=this._parseDashArray(this.properties["stroke-dasharray"]),this.dashOffset=E7(this.properties["stroke-dashoffset"]||0),this.markers={start:this._parseMarkerRef(this.properties["marker-start"]),mid:this._parseMarkerRef(this.properties["marker-mid"]),end:this._parseMarkerRef(this.properties["marker-end"])},this.hasFill=this.properties.fill!=="none"&&this.properties["fill-opacity"]>0,this.hasStroke=this.properties.stroke!=="none"&&E7(this.properties["stroke-width"]).gt(0)&&this.properties["stroke-opacity"]>0,this.hasMarkers=this.markers.start||this.markers.mid||this.markers.end}_extractProperties($,J){if(J!==null&&typeof J!=="object")throw new Error("_extractProperties: inherited must be an object or null");let Z={...vQ,...J||{}};if($&&$.getAttributeNames)for(let Q of $.getAttributeNames()){let H=$.getAttribute(Q);if(H!==null&&H!==void 0)Z[Q]=H}if(Z.style){let Q=this._parseStyleAttribute(Z.style);Object.assign(Z,Q)}let K=["stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity"];for(let Q of K)if(typeof Z[Q]==="string"){let H=parseFloat(Z[Q]);if(!isNaN(H))Z[Q]=H}return Z}_parseStyleAttribute($){let J={};if(!$)return J;let Z=$.split(";");for(let K of Z){if(!K.includes(":"))continue;let[Q,H]=K.split(":").map((z)=>z.trim());if(Q&&H)J[Q]=H}return J}_parseDashArray($){if(!$||$==="none")return null;let J=$.toString().split(/[\s,]+/).filter((K)=>K),Z=[];for(let K of J){let Q=parseFloat(K);if(isNaN(Q)||!isFinite(Q))throw new Error(`_parseDashArray: invalid dash value '${K}'`);if(Q<0)throw new Error(`_parseDashArray: dash values must be non-negative, got ${Q}`);Z.push(E7(Q))}if(Z.length===0)return null;if(Z.length%2===1)return[...Z,...Z];return Z}_parseMarkerRef($){if(!$||$==="none")return null;let J=$.match(/url\(#?([^)]+)\)/);return J?J[1]:null}get fillRule(){return this.properties["fill-rule"]||"nonzero"}get clipRule(){return this.properties["clip-rule"]||"nonzero"}get strokeWidth(){return E7(this.properties["stroke-width"]||0)}get strokeLinecap(){return this.properties["stroke-linecap"]||"butt"}get strokeLinejoin(){return this.properties["stroke-linejoin"]||"miter"}get strokeMiterlimit(){return E7(this.properties["stroke-miterlimit"]||4)}getStrokeExtent(){if(!this.hasStroke)return E7(0);let $=this.strokeWidth.div(2),J=$;if(this.strokeLinejoin==="miter")J=$.times(this.strokeMiterlimit);if(this.strokeLinecap==="square"){let Z=$.times(2);if(Z.gt(J))J=Z}return J}expandBBoxForStroke($){if(!$||typeof $!=="object")throw new Error("expandBBoxForStroke: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForStroke: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.plus!=="function"||typeof $.height.plus!=="function")throw new Error("expandBBoxForStroke: bbox properties must be Decimal instances");if(!this.hasStroke)return $;let J=this.getStrokeExtent();return{x:$.x.minus(J),y:$.y.minus(J),width:$.width.plus(J.times(2)),height:$.height.plus(J.times(2))}}expandBBoxForMarkers($,J=null){if(!$||typeof $!=="object")throw new Error("expandBBoxForMarkers: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForMarkers: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.plus!=="function"||typeof $.height.plus!=="function")throw new Error("expandBBoxForMarkers: bbox properties must be Decimal instances");if(!this.hasMarkers)return $;let Z=E7(0);if(J){if(typeof J!=="object")throw new Error("expandBBoxForMarkers: markerSizes must be an object");let Q=[J.start,J.mid,J.end].filter((H)=>H!==null&&H!==void 0).map((H)=>{let z=typeof H==="number"?H:parseFloat(H);if(isNaN(z)||!isFinite(z))throw new Error(`expandBBoxForMarkers: invalid marker size '${H}'`);return E7(z)});if(Q.length>0)Z=k.max(...Q)}else Z=this.strokeWidth.times(3);if(Z.lte(0))return $;let K=Z.div(2);return{x:$.x.minus(K),y:$.y.minus(K),width:$.width.plus(K.times(2)),height:$.height.plus(K.times(2))}}expandBBoxForFilter($,J=null){if(!$||typeof $!=="object")throw new Error("expandBBoxForFilter: bbox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("expandBBoxForFilter: bbox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function"||typeof $.width.times!=="function"||typeof $.height.times!=="function")throw new Error("expandBBoxForFilter: bbox properties must be Decimal instances");let Z=this.properties.filter;if(!Z||Z==="none")return $;let K=$.width.times("0.1"),Q=$.height.times("0.1");if(J){if(typeof J!=="object")throw new Error("expandBBoxForFilter: filterDef must be an object");if(J.x!==void 0){let H=parseFloat(J.x);if(isNaN(H)||!isFinite(H))throw new Error(`expandBBoxForFilter: invalid filterDef.x value '${J.x}'`);K=E7(H).abs()}if(J.y!==void 0){let H=parseFloat(J.y);if(isNaN(H)||!isFinite(H))throw new Error(`expandBBoxForFilter: invalid filterDef.y value '${J.y}'`);Q=E7(H).abs()}}return{x:$.x.minus(K),y:$.y.minus(Q),width:$.width.plus(K.times(2)),height:$.height.plus(Q.times(2))}}getRenderedBBox($,J={}){if(!$||typeof $!=="object")throw new Error("getRenderedBBox: geometryBBox must be an object");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("getRenderedBBox: geometryBBox must have x, y, width, height properties");if(typeof $.x.minus!=="function"||typeof $.y.minus!=="function")throw new Error("getRenderedBBox: geometryBBox properties must be Decimal instances");if(J!==null&&typeof J!=="object")throw new Error("getRenderedBBox: options must be an object or null");let Z={...$};return Z=this.expandBBoxForStroke(Z),Z=this.expandBBoxForMarkers(Z,J.markerSizes),Z=this.expandBBoxForFilter(Z,J.filterDef),Z}getFilledArea($){if(!Array.isArray($))throw new Error("getFilledArea: polygon must be an array");if($.length===0)throw new Error("getFilledArea: polygon must not be empty");let J=[];if(this.hasFill)J.push({polygon:$,fillRule:this.fillRule,type:"fill"});if(this.hasStroke){let Z=U9($,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(Z&&Z.length>0)J.push({polygon:Z,fillRule:"nonzero",type:"stroke"})}return J}isPointInRenderedArea($,J){if(!$||typeof $!=="object")throw new Error("isPointInRenderedArea: point must be an object");if($.x===void 0||$.y===void 0)throw new Error("isPointInRenderedArea: point must have x and y properties");if(!Array.isArray(J))throw new Error("isPointInRenderedArea: polygon must be an array");if(J.length===0)throw new Error("isPointInRenderedArea: polygon must not be empty");if(this.hasFill){let Z=this.fillRule==="evenodd"?i7.EVENODD:i7.NONZERO;if(Y$($,J,Z)>=0)return!0}if(this.hasStroke){let Z=U9(J,{width:this.strokeWidth.toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,miterlimit:this.strokeMiterlimit.toNumber()});if(Z&&Z.length>0){if(Y$($,Z,i7.NONZERO)>=0)return!0}}return!1}canMergeWith($){if(!($ instanceof X$))throw new Error("canMergeWith: other must be an instance of SVGRenderingContext");if(this.fillRule!==$.fillRule)return{canMerge:!1,reason:"Different fill-rule"};if(this.hasStroke||$.hasStroke){if(this.hasStroke!==$.hasStroke)return{canMerge:!1,reason:"Different stroke presence"};if(!this.strokeWidth.eq($.strokeWidth))return{canMerge:!1,reason:"Different stroke-width"};if(this.strokeLinecap!==$.strokeLinecap)return{canMerge:!1,reason:"Different stroke-linecap"};if(this.strokeLinejoin!==$.strokeLinejoin)return{canMerge:!1,reason:"Different stroke-linejoin"}}if(this.hasMarkers||$.hasMarkers)return{canMerge:!1,reason:"Has markers"};if(this.properties["clip-path"]!=="none"||$.properties["clip-path"]!=="none")return{canMerge:!1,reason:"Has clip-path"};if(this.properties.mask!=="none"||$.properties.mask!=="none")return{canMerge:!1,reason:"Has mask"};if(this.properties.filter!=="none"||$.properties.filter!=="none")return{canMerge:!1,reason:"Has filter"};return{canMerge:!0,reason:null}}toSummary(){return{hasFill:this.hasFill,hasStroke:this.hasStroke,hasMarkers:this.hasMarkers,fillRule:this.fillRule,strokeWidth:this.hasStroke?this.strokeWidth.toNumber():0,strokeExtent:this.getStrokeExtent().toNumber(),linecap:this.strokeLinecap,linejoin:this.strokeLinejoin,clipPath:this.properties["clip-path"],filter:this.properties.filter}}}function y6($,J={},Z=null){if(!$)throw new Error("createRenderingContext: element parameter is required");return new X$($,J,Z)}function u6($){if(!$)throw new Error("getInheritedProperties: element parameter is required");let J={},Z=["fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","marker-start","marker-mid","marker-end","clip-rule","opacity","font-family","font-size","font-style","font-weight"];if(!$.parentNode)return J;let K=$.parentNode;while(K&&K.tagName){for(let Q of Z)if(J[Q]===void 0){let H=K.getAttribute?K.getAttribute(Q):null;if(H!==null&&H!==void 0)J[Q]=H}K=K.parentNode}return J}k.set({precision:80});function OJ($,J){if(!$||!J)throw new Error("setOwnerDocument: element and document are required");if(!$.children||!Array.isArray($.children))throw new Error("setOwnerDocument: element must have a children array");$.ownerDocument=J;for(let Z of $.children)if(Z instanceof B0)OJ(Z,J)}function d0($){if(typeof $!=="string")throw new Error("parseSVG: input must be a string");if($.trim().length===0)throw new Error("parseSVG: input cannot be empty");let J=$.trim(),Z=XJ(J,0);if(!Z.element)throw new Error("Failed to parse SVG: no root element found");let K=new YJ(Z.element);return OJ(Z.element,K),Z.element}class YJ{constructor($=null){this.documentElement=$}createElement($){if(!$||typeof $!=="string")throw new Error("createElement: tagName must be a non-empty string");let J=new B0($);return J.ownerDocument=this,J}createElementNS($,J){if($!==null&&$!==void 0&&typeof $!=="string")throw new Error("createElementNS: namespace must be a string");return this.createElement(J)}}class B0{constructor($,J={},Z=[],K=""){if(!$||typeof $!=="string")throw new Error("SVGElement: tagName must be a non-empty string");if(J!==null&&typeof J!=="object")throw new Error("SVGElement: attributes must be an object");if(!Array.isArray(Z))throw new Error("SVGElement: children must be an array");if(typeof K!=="string")throw new Error("SVGElement: textContent must be a string");this.tagName=$,this.nodeName=$.toUpperCase(),this._attributes={...J},this.children=Z,this.childNodes=Z,this.textContent=K,this.parentNode=null,this.ownerDocument=null;for(let Q of Z)if(Q instanceof B0)Q.parentNode=this}getAttribute($){if(typeof $!=="string")throw new Error("getAttribute: name must be a string");return this._attributes[$]??null}setAttribute($,J){if(typeof $!=="string")throw new Error("setAttribute: name must be a string");if(J!==null&&J!==void 0)this._attributes[$]=String(J);else this._attributes[$]=""}hasAttribute($){if(typeof $!=="string")throw new Error("hasAttribute: name must be a string");return $ in this._attributes}removeAttribute($){if(typeof $!=="string")throw new Error("removeAttribute: name must be a string");delete this._attributes[$]}getAttributeNames(){return Object.keys(this._attributes)}getElementsByTagName($){if(typeof $!=="string")throw new Error("getElementsByTagName: tagName must be a string");if($.length===0)return[];let J=$.toLowerCase(),Z=[],K=(Q)=>{for(let H of Q.children)if(H instanceof B0){if(H.tagName.toLowerCase()===J||J==="*")Z.push(H);K(H)}};return K(this),Z}getElementById($){if(typeof $!=="string")throw new Error("getElementById: id must be a string");if($.length===0)return null;let J=(Z)=>{if(Z.getAttribute("id")===$)return Z;for(let K of Z.children)if(K instanceof B0){let Q=J(K);if(Q)return Q}return null};return J(this)}querySelector($){if(typeof $!=="string")throw new Error("querySelector: selector must be a string");return this.querySelectorAll($)[0]||null}querySelectorAll($){if(typeof $!=="string")throw new Error("querySelectorAll: selector must be a string");let J=[],Z=UJ($),K=(Q)=>{for(let H of Q.children)if(H instanceof B0){if(VJ(H,Z))J.push(H);K(H)}};return K(this),J}matches($){if(typeof $!=="string")throw new Error("matches: selector must be a string");let J=UJ($);return VJ(this,J)}cloneNode($=!0){if(typeof $!=="boolean")throw new Error("cloneNode: deep must be a boolean");let J=$?this.children.map((K)=>K instanceof B0?K.cloneNode(!0):K):[],Z=new B0(this.tagName,{...this._attributes},J,this.textContent);if(this.ownerDocument){let K=(Q,H)=>{Q.ownerDocument=H;for(let z of Q.children)if(z instanceof B0)K(z,H)};K(Z,this.ownerDocument)}return Z}appendChild($){if($===null||$===void 0)throw new Error("appendChild: child cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);if($ instanceof B0)$.parentNode=this;return this.children.push($),this.childNodes=this.children,$}removeChild($){if($===null||$===void 0)throw new Error("removeChild: child cannot be null or undefined");let J=this.children.indexOf($);if(J>=0){if(this.children.splice(J,1),this.childNodes=this.children,$ instanceof B0)$.parentNode=null}return $}insertBefore($,J){if($===null||$===void 0)throw new Error("insertBefore: newChild cannot be null or undefined");if(J===null||J===void 0)throw new Error("insertBefore: refChild cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);let Z=this.children.indexOf(J);if(Z>=0){if($ instanceof B0)$.parentNode=this;this.children.splice(Z,0,$),this.childNodes=this.children}else this.appendChild($);return $}replaceChild($,J){if($===null||$===void 0)throw new Error("replaceChild: newChild cannot be null or undefined");if(J===null||J===void 0)throw new Error("replaceChild: oldChild cannot be null or undefined");if($ instanceof B0&&$.parentNode)$.parentNode.removeChild($);let Z=this.children.indexOf(J);if(Z>=0){if(J instanceof B0)J.parentNode=null;if($ instanceof B0)$.parentNode=this;this.children[Z]=$,this.childNodes=this.children}return J}get style(){let $=this.getAttribute("style")||"",J={};if($.length===0)return J;return $.split(";").forEach((Z)=>{let K=Z.indexOf(":");if(K>0){let Q=Z.slice(0,K).trim(),H=Z.slice(K+1).trim();if(Q&&H)J[Q]=H}}),J}get firstChild(){return this.children[0]||null}get lastChild(){return this.children[this.children.length-1]||null}get nextSibling(){if(!this.parentNode)return null;let $=this.parentNode.children,J=$.indexOf(this);return $[J+1]||null}get previousSibling(){if(!this.parentNode)return null;let $=this.parentNode.children,J=$.indexOf(this);return J>0?$[J-1]:null}serialize($=0,J=!1){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new Error("serialize: indent must be a non-negative finite number");if(typeof J!=="boolean")throw new Error("serialize: minify must be a boolean");let Z=J?"":" ".repeat($),K=this._attributes["data-cdata-pending"]==="true",Q=Object.entries(this._attributes).filter(([j])=>j!=="data-cdata-pending").map(([j,G])=>`${j}="${DQ(G)}"`).join(" "),H=Q?" "+Q:"";if(this.children.length===0&&!this.textContent)return`${Z}<${this.tagName}${H}/>`;let z=J?"":`
|
|
8
|
+
`,q=this.children.map((j)=>j instanceof B0?j.serialize($+1,J):k$(j)).join(z),W="";if(this.textContent&&this.children.length>0)if(K)W=`<![CDATA[
|
|
9
9
|
${this.textContent}
|
|
10
|
-
]]>`+
|
|
10
|
+
]]>`+z+q;else W=k$(this.textContent)+z+q;else if(this.textContent)if(K)W=`<![CDATA[
|
|
11
11
|
${this.textContent}
|
|
12
|
-
]]>`;else
|
|
13
|
-
`)}}function
|
|
14
|
-
`)
|
|
12
|
+
]]>`;else W=k$(this.textContent);else W=q;if(this.children.length===0)return`${Z}<${this.tagName}${H}>${W}</${this.tagName}>`;return`${Z}<${this.tagName}${H}>${z}${W}${z}${Z}</${this.tagName}>`}get outerHTML(){return this.serialize(0)}get innerHTML(){return this.children.map(($)=>$ instanceof B0?$.serialize(0):k$($)).join(`
|
|
13
|
+
`)}}function XJ($,J,Z=!1){if(typeof $!=="string")throw new Error("parseElement: str must be a string");if(typeof J!=="number"||!Number.isFinite(J)||J<0)throw new Error("parseElement: pos must be a non-negative finite number");if($.length===0)return{element:null,endPos:0};if(J>=$.length)return{element:null,endPos:J};let K=J;while(K<$.length){let O=$.slice(K).match(/^(\s+)/);if(O){K+=O[1].length;continue}if($.slice(K,K+4)==="<!--"){let V=$.indexOf("-->",K+4);if(V===-1)break;K=V+3;continue}if($.slice(K,K+9)==="<![CDATA["){let V=$.indexOf("]]>",K+9);if(V===-1)break;K=V+3;continue}if($.slice(K,K+2)==="<?"){let V=$.indexOf("?>",K+2);if(V===-1)break;K=V+2;continue}if($.slice(K,K+9).toUpperCase()==="<!DOCTYPE"){let V=0,M=K+9;while(M<$.length){if($[M]==="[")V++;else if($[M]==="]")V--;else if($[M]===">"&&V===0){K=M+1;break}M++}if(M>=$.length)break;continue}break}if(K>=$.length||$[K]!=="<")return{element:null,endPos:K};let Q=$.slice(K).match(/^<([a-zA-Z][a-zA-Z0-9_:-]*)/);if(!Q)return{element:null,endPos:K};let H=Q[1];K+=Q[0].length;let z={};while(K<$.length){let O=$.slice(K).match(/^(\s+)/);if(O)K+=O[1].length;if($[K]===">"){K++;break}if($.slice(K,K+2)==="/>")return K+=2,{element:new B0(H,z,[]),endPos:K};let V=$.slice(K).match(/^([a-zA-Z][a-zA-Z0-9_:-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/);if(V){let M=V[1],Y=V[2]!==void 0?V[2]:V[3];z[M]=hQ(Y),K+=V[0].length}else{let M=$.slice(K).match(/^([a-zA-Z][a-zA-Z0-9_:-]*)/);if(M)z[M[1]]="",K+=M[0].length;else K++}}let q=[],W="",j=`</${H}>`;while(K<$.length){if($.slice(K,K+j.length).toLowerCase()===j.toLowerCase()){K+=j.length;break}if($[K]==="<"&&$[K+1]!=="/"){if($.slice(K,K+9)==="<![CDATA["){let Y=$.indexOf("]]>",K+9);if(Y!==-1){W+=$.slice(K+9,Y),K=Y+3;continue}}if($.slice(K,K+4)==="<!--"){let Y=$.indexOf("-->",K+4);if(Y!==-1){K=Y+3;continue}}let O=z["xml:space"],M=XJ($,K,O==="preserve"?!0:O==="default"?!1:Z);if(M.element)q.push(M.element),K=M.endPos;else K++}else if($[K]==="<"&&$[K+1]==="/"){let O=$.slice(K).match(/^<\/([a-zA-Z][a-zA-Z0-9_:-]*)>/);if(O&&O[1].toLowerCase()===H.toLowerCase()){K+=O[0].length;break}K++}else{let O=$.indexOf("<",K);if(O===-1)W+=$.slice(K),K=$.length;else W+=$.slice(K,O),K=O}}let G=new B0(H,z,q,""),F=z["xml:space"],U=(F==="preserve"?!0:F==="default"?!1:Z)?MJ(W):MJ(W.trim());return G.textContent=U,{element:G,endPos:K}}function UJ($){if(typeof $!=="string")throw new Error("parseSelector: selector must be a string");let J=$.trim();if(J.length===0)throw new Error("parseSelector: selector cannot be empty");let Z=[],K=J.split(/\s*,\s*/);for(let Q of K){let H={tag:null,id:null,classes:[],attrs:[]},z=Q,q=z.match(/^([a-zA-Z][a-zA-Z0-9_-]*)/);if(q)H.tag=q[1].toLowerCase(),z=z.slice(q[0].length);let W=z.match(/#([a-zA-Z][a-zA-Z0-9_-]*)/);if(W)H.id=W[1],z=z.replace(W[0],"");let j=z.matchAll(/\.([a-zA-Z][a-zA-Z0-9_-]*)/g);for(let F of j)H.classes.push(F[1]);let G=z.matchAll(/\[([a-zA-Z][a-zA-Z0-9_:-]*)(?:=["']?([^"'\]]+)["']?)?\]/g);for(let F of G)H.attrs.push({name:F[1],value:F[2]});Z.push(H)}return Z}function VJ($,J){if(!($ instanceof B0))throw new Error("matchesAllSelectors: el must be an SVGElement");if(!Array.isArray(J))throw new Error("matchesAllSelectors: matchers must be an array");return J.some((Z)=>{if(Z.tag&&$.tagName.toLowerCase()!==Z.tag)return!1;if(Z.id&&$.getAttribute("id")!==Z.id)return!1;let K=($.getAttribute("class")||"").split(/\s+/).filter((Q)=>Q.length>0);for(let Q of Z.classes)if(!K.includes(Q))return!1;for(let Q of Z.attrs){if(!$.hasAttribute(Q.name))return!1;if(Q.value!==void 0&&$.getAttribute(Q.name)!==Q.value)return!1}return!0})}function k$($){if($===void 0||$===null)return"";if(typeof $!=="string")return String($);return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function DQ($){if($===null||$===void 0)return"";if(typeof $!=="string")return String($);return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hQ($){if(!$)return $;return $.replace(/&#[xX]([0-9A-Fa-f]+);/g,(J,Z)=>{let K=parseInt(Z,16);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/&#(\d+);/g,(J,Z)=>{let K=parseInt(Z,10);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function MJ($){if(!$)return $;return $.replace(/&#[xX]([0-9A-Fa-f]+);/g,(J,Z)=>{let K=parseInt(Z,16);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/&#(\d+);/g,(J,Z)=>{let K=parseInt(Z,10);if(!Number.isFinite(K))return"�";if(K===0||K>=1&&K<=8||K>=11&&K<=12||K>=14&&K<=31||K===65534||K===65535||K>1114111||K>=55296&&K<=57343)return"�";return String.fromCodePoint(K)}).replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function r7($){if(!$)throw new Error("buildDefsMap: svgRoot cannot be null or undefined");if(!($ instanceof B0))throw new Error("buildDefsMap: svgRoot must be an SVGElement");let J=new Map,Z=(K)=>{let Q=K.getAttribute("id");if(Q)J.set(Q,K);for(let H of K.children)if(H instanceof B0)Z(H)};return Z($),J}function g7($,J){if(!$)throw new Error("findElementsWithAttribute: root cannot be null or undefined");if(!($ instanceof B0))throw new Error("findElementsWithAttribute: root must be an SVGElement");if(typeof J!=="string")throw new Error("findElementsWithAttribute: attrName must be a string");let Z=[],K=(Q)=>{if(Q.hasAttribute(J))Z.push(Q);for(let H of Q.children)if(H instanceof B0)K(H)};return K($),Z}function a7($){if(!$||typeof $!=="string")return null;let J=$.trim();if(J.length===0)return null;let Z=J.match(/url\(\s*["']?#?([^"')]+)["']?\s*\)/i);return Z?Z[1]:null}function N7($,J={}){if(!$)throw new Error("serializeSVG: document is required");if(typeof $.serialize!=="function"){if(typeof $==="string")return $;throw new Error(`serializeSVG: expected SVGElement with serialize method, got ${$?.constructor?.name||typeof $}`)}let Z=J.minify||!1;return'<?xml version="1.0" encoding="UTF-8"?>'+(Z?"":`
|
|
14
|
+
`)+$.serialize(0,Z)}var{appendFileSync:yQ}=(()=>({}));var uQ=100,gQ=5000,g6={SILENT:0,ERROR:1,WARN:2,INFO:3,DEBUG:4},L$={level:g6.WARN,logToFile:null,timestamps:!1,_buffer:[],_flushTimer:null,_safeStringify($){if($===null)return"null";if($===void 0)return"undefined";if($ instanceof Error)return $.stack||`${$.name}: ${$.message}`;if(typeof $!=="object")return String($);try{let J=new WeakSet;return JSON.stringify($,(Z,K)=>{if(typeof K==="object"&&K!==null){if(J.has(K))return"[Circular]";J.add(K)}return K})}catch{return String($)}},_format($,J){if(typeof $!=="string"||!$)throw new Error("Logger._format: level must be a non-empty string");let Z=this._safeStringify(J);if(this.timestamps)return`[${new Date().toISOString()}] [${$}] ${Z}`;return`[${$}] ${Z}`},_bufferWrite($){if(!this.logToFile)return;if(this._buffer.push($),this._buffer.length>=uQ)this.flush();if(!this._flushTimer)this._flushTimer=setInterval(()=>this.flush(),gQ),this._flushTimer.unref()},flush(){if(!this.logToFile||this._buffer.length===0)return;try{let $=this._buffer.join(`
|
|
15
15
|
`)+`
|
|
16
|
-
`;Dr(this.logToFile,t),this._buffer=[]}catch{this._buffer=[]}},error(t,...a){if(this.level<h5.ERROR)return;let r=this._format("ERROR",t),e=a.length?" "+a.map((o)=>this._safeStringify(o)).join(" "):"";console.error(r,...a),this._bufferWrite(r+e),this.flush()},warn(t,...a){if(this.level<h5.WARN)return;let r=this._format("WARN",t),e=a.length?" "+a.map((o)=>this._safeStringify(o)).join(" "):"";console.warn(r,...a),this._bufferWrite(r+e)},info(t,...a){if(this.level<h5.INFO)return;let r=this._format("INFO",t),e=a.length?" "+a.map((o)=>this._safeStringify(o)).join(" "):"";console.log(r,...a),this._bufferWrite(r+e)},debug(t,...a){if(this.level<h5.DEBUG)return;let r=this._format("DEBUG",t),e=a.length?" "+a.map((o)=>this._safeStringify(o)).join(" "):"";console.log(r,...a),this._bufferWrite(r+e)},shutdown(){if(this._flushTimer)clearInterval(this._flushTimer),this._flushTimer=null;this.flush()}},Er=B4;E.set({precision:80});var m3=(t)=>t instanceof E?t:new E(t),d6=20;function t5(t,a=d6){if(typeof t!=="string")throw Error("pathToPolygon: pathData must be a string");if(typeof a!=="number"||a<=0||!Number.isFinite(a))throw Error(`pathToPolygon: samplesPerCurve must be a positive finite number, got ${a}`);let r=[],e=m3(0),o=m3(0),n=m3(0),i=m3(0),l=br(t);if(!Array.isArray(l))throw Error("pathToPolygon: parsePathCommands must return an array");for(let d of l){let{type:p,args:g}=d;if(!Array.isArray(g))throw Error(`pathToPolygon: command args must be an array for command ${p}`);switch(p){case"M":if(g.length<2)throw Error(`pathToPolygon: M command requires 2 arguments, got ${g.length}`);e=m3(g[0]),o=m3(g[1]),n=e,i=o,r.push(v3(e,o));break;case"m":if(g.length<2)throw Error(`pathToPolygon: m command requires 2 arguments, got ${g.length}`);e=e.plus(g[0]),o=o.plus(g[1]),n=e,i=o,r.push(v3(e,o));break;case"L":if(g.length<2)throw Error(`pathToPolygon: L command requires 2 arguments, got ${g.length}`);e=m3(g[0]),o=m3(g[1]),r.push(v3(e,o));break;case"l":if(g.length<2)throw Error(`pathToPolygon: l command requires 2 arguments, got ${g.length}`);e=e.plus(g[0]),o=o.plus(g[1]),r.push(v3(e,o));break;case"H":if(g.length<1)throw Error(`pathToPolygon: H command requires 1 argument, got ${g.length}`);e=m3(g[0]),r.push(v3(e,o));break;case"h":if(g.length<1)throw Error(`pathToPolygon: h command requires 1 argument, got ${g.length}`);e=e.plus(g[0]),r.push(v3(e,o));break;case"V":if(g.length<1)throw Error(`pathToPolygon: V command requires 1 argument, got ${g.length}`);o=m3(g[0]),r.push(v3(e,o));break;case"v":if(g.length<1)throw Error(`pathToPolygon: v command requires 1 argument, got ${g.length}`);o=o.plus(g[0]),r.push(v3(e,o));break;case"C":if(g.length<6)throw Error(`pathToPolygon: C command requires 6 arguments, got ${g.length}`);Q0(r,e,o,m3(g[0]),m3(g[1]),m3(g[2]),m3(g[3]),m3(g[4]),m3(g[5]),a),e=m3(g[4]),o=m3(g[5]);break;case"c":if(g.length<6)throw Error(`pathToPolygon: c command requires 6 arguments, got ${g.length}`);Q0(r,e,o,e.plus(g[0]),o.plus(g[1]),e.plus(g[2]),o.plus(g[3]),e.plus(g[4]),o.plus(g[5]),a),e=e.plus(g[4]),o=o.plus(g[5]);break;case"Q":if(g.length<4)throw Error(`pathToPolygon: Q command requires 4 arguments, got ${g.length}`);H0(r,e,o,m3(g[0]),m3(g[1]),m3(g[2]),m3(g[3]),a),e=m3(g[2]),o=m3(g[3]);break;case"q":if(g.length<4)throw Error(`pathToPolygon: q command requires 4 arguments, got ${g.length}`);H0(r,e,o,e.plus(g[0]),o.plus(g[1]),e.plus(g[2]),o.plus(g[3]),a),e=e.plus(g[2]),o=o.plus(g[3]);break;case"A":if(g.length<7)throw Error(`pathToPolygon: A command requires 7 arguments, got ${g.length}`);K0(r,e,o,m3(g[0]),m3(g[1]),m3(g[2]),g[3],g[4],m3(g[5]),m3(g[6]),a),e=m3(g[5]),o=m3(g[6]);break;case"a":if(g.length<7)throw Error(`pathToPolygon: a command requires 7 arguments, got ${g.length}`);K0(r,e,o,m3(g[0]),m3(g[1]),m3(g[2]),g[3],g[4],e.plus(g[5]),o.plus(g[6]),a),e=e.plus(g[5]),o=o.plus(g[6]);break;case"Z":case"z":e=n,o=i;break;default:break}}return Pr(r)}function br(t){if(typeof t!=="string")throw Error(`parsePathCommands: pathData must be a string, got ${typeof t}`);let a=[],r=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,e;while((e=r.exec(t))!==null){let o=e[1],n=e[2].trim(),i=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,l=n.length>0?Array.from(n.matchAll(i),(d)=>Number(d[0])):[];a.push({type:o,args:l})}return a}function Q0(t,a,r,e,o,n,i,l,d,p){if(!Array.isArray(t))throw Error("sampleCubicBezier: points must be an array");if(typeof p!=="number"||p<=0||!Number.isFinite(p))throw Error(`sampleCubicBezier: samples must be a positive finite number, got ${p}`);if(!(a instanceof E)||!(r instanceof E)||!(e instanceof E)||!(o instanceof E)||!(n instanceof E)||!(i instanceof E)||!(l instanceof E)||!(d instanceof E))throw Error("sampleCubicBezier: all coordinate parameters must be Decimal instances");for(let g=1;g<=p;g++){let c=m3(g).div(p),m=m3(1).minus(c),y=m.mul(m),h=y.mul(m),s=c.mul(c),x=s.mul(c),D=h.mul(a).plus(m3(3).mul(y).mul(c).mul(e)).plus(m3(3).mul(m).mul(s).mul(n)).plus(x.mul(l)),S=h.mul(r).plus(m3(3).mul(y).mul(c).mul(o)).plus(m3(3).mul(m).mul(s).mul(i)).plus(x.mul(d));t.push(v3(D,S))}}function H0(t,a,r,e,o,n,i,l){if(!Array.isArray(t))throw Error("sampleQuadraticBezier: points must be an array");if(typeof l!=="number"||l<=0||!Number.isFinite(l))throw Error(`sampleQuadraticBezier: samples must be a positive finite number, got ${l}`);if(!(a instanceof E)||!(r instanceof E)||!(e instanceof E)||!(o instanceof E)||!(n instanceof E)||!(i instanceof E))throw Error("sampleQuadraticBezier: all coordinate parameters must be Decimal instances");for(let d=1;d<=l;d++){let p=m3(d).div(l),g=m3(1).minus(p),c=g.mul(g),m=p.mul(p),y=c.mul(a).plus(m3(2).mul(g).mul(p).mul(e)).plus(m.mul(n)),h=c.mul(r).plus(m3(2).mul(g).mul(p).mul(o)).plus(m.mul(i));t.push(v3(y,h))}}function K0(t,a,r,e,o,n,i,l,d,p,g){if(!Array.isArray(t))throw Error("sampleArc: points must be an array");if(typeof g!=="number"||g<=0||!Number.isFinite(g))throw Error(`sampleArc: samples must be a positive finite number, got ${g}`);if(!(a instanceof E)||!(r instanceof E)||!(e instanceof E)||!(o instanceof E)||!(n instanceof E)||!(d instanceof E)||!(p instanceof E))throw Error("sampleArc: all coordinate and angle parameters must be Decimal instances");if(typeof i!=="number"||i!==0&&i!==1)throw Error(`sampleArc: largeArc must be 0 or 1, got ${i}`);if(typeof l!=="number"||l!==0&&l!==1)throw Error(`sampleArc: sweep must be 0 or 1, got ${l}`);if(e.eq(0)||o.eq(0)){t.push(v3(d,p));return}let c=e.abs(),m=o.abs(),y=n.mul(Math.PI).div(180),h=y.cos(),s=y.sin(),x=a.minus(d).div(2),D=r.minus(p).div(2),S=h.mul(x).plus(s.mul(D)),P=h.mul(D).minus(s.mul(x)),T=c.mul(c),f=m.mul(m),X=S.mul(S),B=P.mul(P),L=X.div(T).plus(B.div(f));if(L.gt(1)){let e3=L.sqrt();c=c.mul(e3),m=m.mul(e3),T=c.mul(c),f=m.mul(m)}let R=T.mul(f).minus(T.mul(B)).minus(f.mul(X));if(R=R.div(T.mul(B).plus(f.mul(X))),R.lt(0))R=m3(0);if(R=R.sqrt(),i===l)R=R.neg();let N=R.mul(e).mul(P).div(o),u=R.neg().mul(o).mul(S).div(e),O=a.plus(d).div(2),Y=r.plus(p).div(2),j=h.mul(N).minus(s.mul(u)).plus(O),_=s.mul(N).plus(h.mul(u)).plus(Y),A=S.minus(N).div(e),W=P.minus(u).div(o),C=S.neg().minus(N).div(e),z=P.neg().minus(u).div(o),o3=A.mul(A).plus(W.mul(W)).sqrt();if(o3.eq(0)){q0.warn("sampleArc: degenerate arc - center coincides with start point, treating as line to end"),t.push(v3(d,p));return}let K=E.acos(A.div(o3));if(W.lt(0))K=K.neg();let $=o3.mul(C.mul(C).plus(z.mul(z)).sqrt());if($.eq(0)){q0.warn("sampleArc: degenerate arc - zero length, treating as single point"),t.push(v3(d,p));return}let w=E.acos(A.mul(C).plus(W.mul(z)).div($));if(A.mul(z).minus(W.mul(C)).lt(0))w=w.neg();let F=m3(Math.PI),a3=F.mul(2);if(l&&w.lt(0))w=w.plus(a3);else if(!l&&w.gt(0))w=w.minus(a3);for(let e3=1;e3<=g;e3++){let i3=m3(e3).div(g),y3=K.plus(w.mul(i3)),u3=y3.cos(),Q=y3.sin(),J=h.mul(e.mul(u3)).minus(s.mul(o.mul(Q))).plus(j),g3=s.mul(e.mul(u3)).plus(h.mul(o.mul(Q))).plus(_);t.push(v3(J,g3))}}function Pr(t){if(!Array.isArray(t))throw Error("removeDuplicateConsecutive: points must be an array");if(t.length<2)return t;let a=[t[0]];for(let r=1;r<t.length;r++)if(!F4(t[r],a[a.length-1]))a.push(t[r]);return a}function i0(t,a=null,r=d6,e=4){if(!t||typeof t!=="object")throw Error("shapeToPolygon: element must be an object");if(!t.type||typeof t.type!=="string")throw Error("shapeToPolygon: element.type must be a string");if(typeof r!=="number"||r<=0||!Number.isFinite(r))throw Error(`shapeToPolygon: samples must be a positive finite number, got ${r}`);if(typeof e!=="number"||e<=0||!Number.isFinite(e))throw Error(`shapeToPolygon: bezierArcs must be a positive finite number, got ${e}`);if(a!==null&&!(a instanceof P3))throw Error("shapeToPolygon: ctm must be null or a Matrix instance");let o;switch(t.type){case"circle":if(e>4)o=We(t.cx||0,t.cy||0,t.r||0,e,10);else o=Ze(m3(t.cx||0),m3(t.cy||0),m3(t.r||0));break;case"ellipse":if(e>4)o=q9(t.cx||0,t.cy||0,t.rx||0,t.ry||0,e,10);else o=t6(m3(t.cx||0),m3(t.cy||0),m3(t.rx||0),m3(t.ry||0));break;case"rect":o=Je(m3(t.x||0),m3(t.y||0),m3(t.width||0),m3(t.height||0),m3(t.rx||0),t.ry!==void 0?m3(t.ry):null);break;case"line":o=$e(m3(t.x1||0),m3(t.y1||0),m3(t.x2||0),m3(t.y2||0));break;case"polygon":o=tr(t.points||"");break;case"polyline":o=ar(t.points||"");break;case"path":o=t.d||"";break;default:return[]}if(t.transform){let n=Er(t.transform);if(!(n instanceof P3))throw Error(`shapeToPolygon: parseTransform must return a Matrix, got ${typeof n}`);o=Z5(o,n)}if(a)o=Z5(o,a);return t5(o,r)}function g6(t,a=6){if(!Array.isArray(t))throw Error("polygonToPathData: polygon must be an array");if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error(`polygonToPathData: precision must be a non-negative finite number, got ${a}`);if(t.length<2)return"";let r=(o)=>(o instanceof E?o:m3(o)).toFixed(a).replace(/\.?0+$/,""),e=`M ${r(t[0].x)} ${r(t[0].y)}`;for(let o=1;o<t.length;o++)e+=` L ${r(t[o].x)} ${r(t[o].y)}`;return e+" Z"}E.set({precision:80});E.set({precision:80});var Z0=(t)=>t instanceof E?t:new E(t),J0=-0.1,$0=-0.1,t9=1.2,a9=1.2,U5={LUMINANCE:"luminance",ALPHA:"alpha"};function Tr(t){if(!t)throw Error("parseMaskElement: maskElement is required");if(!t.getAttribute)throw Error("parseMaskElement: maskElement must be a DOM element");let a={id:t.getAttribute("id")||"",maskUnits:t.getAttribute("maskUnits")||"objectBoundingBox",maskContentUnits:t.getAttribute("maskContentUnits")||"userSpaceOnUse",maskType:t.getAttribute("mask-type")||t.style?.maskType||"luminance",x:t.getAttribute("x"),y:t.getAttribute("y"),width:t.getAttribute("width"),height:t.getAttribute("height"),transform:t.getAttribute("transform")||null,children:[]},r=(e,o)=>{let n=parseFloat(e);return isNaN(n)?o:n};if(a.maskUnits==="objectBoundingBox")a.x=a.x!==null?r(a.x,J0):J0,a.y=a.y!==null?r(a.y,$0):$0,a.width=a.width!==null?r(a.width,t9):t9,a.height=a.height!==null?r(a.height,a9):a9;else a.x=a.x!==null?r(a.x,null):null,a.y=a.y!==null?r(a.y,null):null,a.width=a.width!==null?r(a.width,null):null,a.height=a.height!==null?r(a.height,null):null;if(!t.children)return a;for(let e of t.children){if(!e.tagName)continue;let o=e.tagName.toLowerCase(),n={type:o,fill:e.getAttribute("fill")||e.style?.fill||"black",fillOpacity:r(e.getAttribute("fill-opacity")||e.style?.fillOpacity||"1",1),opacity:r(e.getAttribute("opacity")||e.style?.opacity||"1",1),transform:e.getAttribute("transform")||null};switch(o){case"rect":n.x=r(e.getAttribute("x")||"0",0),n.y=r(e.getAttribute("y")||"0",0),n.width=r(e.getAttribute("width")||"0",0),n.height=r(e.getAttribute("height")||"0",0),n.rx=r(e.getAttribute("rx")||"0",0),n.ry=r(e.getAttribute("ry")||"0",0);break;case"circle":n.cx=r(e.getAttribute("cx")||"0",0),n.cy=r(e.getAttribute("cy")||"0",0),n.r=r(e.getAttribute("r")||"0",0);break;case"ellipse":n.cx=r(e.getAttribute("cx")||"0",0),n.cy=r(e.getAttribute("cy")||"0",0),n.rx=r(e.getAttribute("rx")||"0",0),n.ry=r(e.getAttribute("ry")||"0",0);break;case"path":n.d=e.getAttribute("d")||"";break;case"polygon":n.points=e.getAttribute("points")||"";break;case"polyline":n.points=e.getAttribute("points")||"";break;case"g":if(n.children=[],e.children){for(let i of e.children)if(i.tagName)n.children.push({type:i.tagName.toLowerCase(),fill:i.getAttribute("fill")||"inherit"})}break;default:break}a.children.push(n)}return a}function Ar(t,a,r,e=20){if(!t)throw Error("maskChildToPolygon: child is required");if(!a)throw Error("maskChildToPolygon: targetBBox is required");if(!r)throw Error("maskChildToPolygon: contentUnits is required");if(typeof e!=="number"||e<=0)throw Error("maskChildToPolygon: samples must be a positive number");if(typeof a.x!=="number"||typeof a.y!=="number"||typeof a.width!=="number"||typeof a.height!=="number")throw Error("maskChildToPolygon: targetBBox must have numeric x, y, width, height properties");if(a.width<0||a.height<0)throw Error("maskChildToPolygon: targetBBox width and height cannot be negative");let o={type:t.type,...t,transform:t.transform},n=i0(o,null,e);if(!Array.isArray(n))return[];if(r==="objectBoundingBox"&&n.length>0){if(a.width===0||a.height===0)return[];n=n.map((i)=>({x:Z0(a.x).plus(i.x.mul(a.width)),y:Z0(a.y).plus(i.y.mul(a.height))}))}return n}function Cr(t){if(!t||t==="none"||t==="transparent")return 0;if(typeof t!=="string")return 0;let a=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(a){let n=parseInt(a[1],10),i=parseInt(a[2],10),l=parseInt(a[3],10);if(isNaN(n)||isNaN(i)||isNaN(l))return 0;let d=Math.max(0,Math.min(255,n))/255,p=Math.max(0,Math.min(255,i))/255,g=Math.max(0,Math.min(255,l))/255,c=0.2126*d+0.7152*p+0.0722*g;return isNaN(c)?0:c}let r=t.match(/^#([0-9a-f]{3,6})$/i);if(r){let n=r[1];if(n.length===3)n=n[0]+n[0]+n[1]+n[1]+n[2]+n[2];let i=parseInt(n.slice(0,2),16),l=parseInt(n.slice(2,4),16),d=parseInt(n.slice(4,6),16);if(isNaN(i)||isNaN(l)||isNaN(d))return 0;let p=0.2126*(i/255)+0.7152*(l/255)+0.0722*(d/255);return isNaN(p)?0:p}let e={white:1,black:0,red:0.2126,green:0.7152,blue:0.0722,yellow:0.9278,cyan:0.7874,magenta:0.2848,gray:0.5,grey:0.5},o=t.toLowerCase();if(e[o]!==void 0)return e[o];return 0}function fr(t,a){if(!t)throw Error("getMaskChildOpacity: child is required");if(!a)throw Error("getMaskChildOpacity: maskType is required");if(a!==U5.LUMINANCE&&a!==U5.ALPHA)throw Error('getMaskChildOpacity: maskType must be "luminance" or "alpha"');let r=typeof t.fillOpacity==="number"&&!isNaN(t.fillOpacity)?t.fillOpacity:1,e=typeof t.opacity==="number"&&!isNaN(t.opacity)?t.opacity:1,o=r*e;if(a===U5.ALPHA)return o;let n=Cr(t.fill),i=o*n;return isNaN(i)?0:i}function ur(t,a,r={}){if(!t)throw Error("resolveMask: maskData is required");if(!a)throw Error("resolveMask: targetBBox is required");if(!Array.isArray(t.children))throw Error("resolveMask: maskData.children must be an array");let{samples:e=20}=r;if(typeof e!=="number"||e<=0)throw Error("resolveMask: samples must be a positive number");let o=t.maskType||U5.LUMINANCE,n=[];for(let i of t.children){if(!i)continue;let l=Ar(i,a,t.maskContentUnits,e);if(l.length>=3){let d=fr(i,o);n.push({polygon:l,opacity:d})}}return n}function Ir(t,a,r=0.5,e={}){if(!t)throw Error("maskToClipPath: maskData is required");if(!a)throw Error("maskToClipPath: targetBBox is required");if(typeof r!=="number"||r<0||r>1)throw Error("maskToClipPath: opacityThreshold must be a number between 0 and 1");let o=ur(t,a,e),n=[];for(let{polygon:i,opacity:l}of o)if(l>=r&&i&&i.length>=3)if(n.length===0)n=i;else{let d=y2(n,i);if(d.length>0&&d[0].length>=3)n=d[0]}return n}function Rr(t,a,r={}){if(!t)throw Error("maskToPathData: maskData is required");if(!a)throw Error("maskToPathData: targetBBox is required");let e=Ir(t,a,0.5,r);if(e.length<3)return"";let o="",n=0;for(let i=0;i<e.length;i++){let l=e[i];if(!l||l.x===void 0||l.y===void 0)continue;let d=Number(l.x),p=Number(l.y);if(isNaN(d)||isNaN(p)||!isFinite(d)||!isFinite(p))continue;let g=d.toFixed(6),c=p.toFixed(6);o+=n===0?`M ${g} ${c}`:` L ${g} ${c}`,n++}if(n>=3)o+=" Z";else return"";return o}E.set({precision:80});function Nr(t){if(!t)throw Error("parseUseElement: useElement is required");let a=t.getAttribute("href")||t.getAttribute("xlink:href")||"",r=a.startsWith("#")?a.slice(1):a;if(!r)throw Error("parseUseElement: href attribute must reference a valid element id (found empty reference)");let e=parseFloat(t.getAttribute("x")||"0"),o=parseFloat(t.getAttribute("y")||"0");if(isNaN(e)||isNaN(o)||!isFinite(e)||!isFinite(o))throw Error("parseUseElement: x and y attributes must be valid finite numbers");let n=null,i=null;if(t.getAttribute("width")){if(n=parseFloat(t.getAttribute("width")),isNaN(n)||!isFinite(n)||n<=0)throw Error("parseUseElement: width attribute must be a valid positive finite number")}if(t.getAttribute("height")){if(i=parseFloat(t.getAttribute("height")),isNaN(i)||!isFinite(i)||i<=0)throw Error("parseUseElement: height attribute must be a valid positive finite number")}return{href:r,x:e,y:o,width:n,height:i,transform:t.getAttribute("transform")||null,style:c6(t)}}function wr(t){if(!t)throw Error("parseSymbolElement: symbolElement is required");let a=parseFloat(t.getAttribute("refX")||"0"),r=parseFloat(t.getAttribute("refY")||"0");if(isNaN(a)||isNaN(r)||!isFinite(a)||!isFinite(r))throw Error("parseSymbolElement: refX and refY must be valid finite numbers");let e={id:t.getAttribute("id")||"",viewBox:t.getAttribute("viewBox")||null,preserveAspectRatio:t.getAttribute("preserveAspectRatio")||"xMidYMid meet",children:[],refX:a,refY:r};if(e.viewBox){let o=e.viewBox.trim().split(/[\s,]+/).map(Number);if(o.length===4&&o.every((n)=>!isNaN(n)&&isFinite(n)))e.viewBoxParsed={x:o[0],y:o[1],width:o[2],height:o[3]}}for(let o of t.children)e.children.push(l0(o));return e}function l0(t){if(!t||!t.tagName)throw Error("parseChildElement: element with tagName is required");let a=t.tagName.toLowerCase(),r={type:a,id:t.getAttribute("id")||null,transform:t.getAttribute("transform")||null,style:c6(t)},e=(o,n="0")=>{let i=parseFloat(t.getAttribute(o)||n);if(isNaN(i)||!isFinite(i))throw Error(`parseChildElement: ${o} must be a valid finite number in ${a} element`);return i};switch(a){case"rect":r.x=e("x"),r.y=e("y"),r.width=e("width"),r.height=e("height"),r.rx=e("rx"),r.ry=e("ry");break;case"circle":r.cx=e("cx"),r.cy=e("cy"),r.r=e("r");break;case"ellipse":r.cx=e("cx"),r.cy=e("cy"),r.rx=e("rx"),r.ry=e("ry");break;case"path":r.d=t.getAttribute("d")||"";break;case"polygon":r.points=t.getAttribute("points")||"";break;case"polyline":r.points=t.getAttribute("points")||"";break;case"line":r.x1=e("x1"),r.y1=e("y1"),r.x2=e("x2"),r.y2=e("y2");break;case"g":r.children=[];for(let o of t.children)r.children.push(l0(o));break;case"use":r.href=(t.getAttribute("href")||t.getAttribute("xlink:href")||"").replace("#",""),r.x=e("x"),r.y=e("y"),r.width=t.getAttribute("width")?e("width"):null,r.height=t.getAttribute("height")?e("height"):null;break;default:break}return r}function c6(t){if(!t)throw Error("extractStyleAttributes: element is required");return{fill:t.getAttribute("fill"),stroke:t.getAttribute("stroke"),strokeWidth:t.getAttribute("stroke-width"),opacity:t.getAttribute("opacity"),fillOpacity:t.getAttribute("fill-opacity"),strokeOpacity:t.getAttribute("stroke-opacity"),visibility:t.getAttribute("visibility"),display:t.getAttribute("display")}}function vr(t,a,r,e="xMidYMid meet"){if(!t||!a||!r)return P3.identity(3);if(!isFinite(a)||!isFinite(r)||a<=0||r<=0)return P3.identity(3);let{width:o,height:n,x:i,y:l}=t;if(!isFinite(o)||!isFinite(n)||!isFinite(i)||!isFinite(l)||o<=0||n<=0)return P3.identity(3);let d=e.trim().split(/\s+/),p=d[0]||"xMidYMid",g=d[1]||"meet";if(p==="none"){let S=a/o,P=r/n;return s4(-i*S,-l*P).mul(p5(S,P))}let c=a/o,m=r/n,y;if(g==="slice")y=Math.max(c,m);else y=Math.min(c,m);let h=-i*y,s=-l*y,x=o*y,D=n*y;if(p.includes("xMid"))h+=(a-x)/2;else if(p.includes("xMax"))h+=a-x;if(p.includes("YMid"))s+=(r-D)/2;else if(p.includes("YMax"))s+=r-D;return s4(h,s).mul(p5(y,y))}function m6(t,a,r={}){if(!t||!t.href)throw Error("resolveUse: useData with href property is required");if(!a)throw Error("resolveUse: defs map is required");if(typeof t.x!=="number"||isNaN(t.x)||!isFinite(t.x))throw Error("resolveUse: useData.x must be a valid finite number");if(typeof t.y!=="number"||isNaN(t.y)||!isFinite(t.y))throw Error("resolveUse: useData.y must be a valid finite number");if(t.width!==null&&(typeof t.width!=="number"||isNaN(t.width)||!isFinite(t.width)||t.width<=0))throw Error("resolveUse: useData.width must be null or a positive finite number");if(t.height!==null&&(typeof t.height!=="number"||isNaN(t.height)||!isFinite(t.height)||t.height<=0))throw Error("resolveUse: useData.height must be null or a positive finite number");if(t.style!==null&&t.style!==void 0){if(typeof t.style!=="object"||Array.isArray(t.style))throw Error("resolveUse: useData.style must be null, undefined, or a valid non-array object")}if(t.transform!==null&&t.transform!==void 0&&typeof t.transform!=="string")throw Error("resolveUse: useData.transform must be null, undefined, or a string");if(r&&typeof r!=="object")throw Error("resolveUse: options must be an object or undefined");let{maxDepth:e=10,_visited:o=new Set}=r;if(typeof e!=="number"||e<=0||!isFinite(e))throw Error("resolveUse: maxDepth must be a positive finite number");if(o.has(t.href))return console.warn(`resolveUse: circular reference detected for '#${t.href}', skipping to prevent infinite loop`),null;let n=a[t.href];if(!n)return console.warn(`resolveUse: target element '#${t.href}' not found in defs map`),null;o.add(t.href);let i=s4(t.x,t.y);if(t.transform){let p=B4(t.transform);i=i.mul(p)}if(n.type==="symbol"&&n.viewBoxParsed){if(typeof n.viewBoxParsed.x!=="number"||typeof n.viewBoxParsed.y!=="number"||typeof n.viewBoxParsed.width!=="number"||typeof n.viewBoxParsed.height!=="number"||!isFinite(n.viewBoxParsed.x)||!isFinite(n.viewBoxParsed.y)||!isFinite(n.viewBoxParsed.width)||!isFinite(n.viewBoxParsed.height)||n.viewBoxParsed.width<=0||n.viewBoxParsed.height<=0)throw Error("resolveUse: target.viewBoxParsed must have finite x, y and positive finite width, height");let p=t.width!==null?t.width:n.viewBoxParsed.width,g=t.height!==null?t.height:n.viewBoxParsed.height;i=vr(n.viewBoxParsed,p,g,n.preserveAspectRatio||"xMidYMid meet").mul(i)}let l=[],d=n.children&&Array.isArray(n.children)&&n.children.length>0?n.children:[n];for(let p of d)if(p.type==="use"){if(e<=1){console.warn(`resolveUse: maximum nesting depth reached for use element '#${p.href}', skipping nested resolution`);continue}let g=m6(p,a,{maxDepth:e-1,_visited:o});if(g)l.push(g)}else l.push({element:p,transform:P3.identity(3)});return o.delete(t.href),{element:n,transform:i,children:l,inheritedStyle:t.style}}function y6(t,a=20){let r=[];if(!t)return r;if(typeof a!=="number"||a<=0||!isFinite(a))throw Error("flattenResolvedUse: samples must be a positive finite number");if(!t.children||!t.transform)return r;for(let e of t.children){if(!e||!e.transform)continue;let o=t.transform.mul(e.transform),n=e.element;if(e.children){let i=y6(e,a);for(let l of i)l.polygon=l.polygon.map((d)=>{let[p,g]=l4(t.transform,d.x,d.y);return{x:p,y:g}}),r.push(l)}else{let i=Br(n,o,a);if(i.length>=3)r.push({polygon:i,style:Xr(t.inheritedStyle,n.style)})}}return r}function Br(t,a,r=20){if(!t)throw Error("elementToPolygon: element is required");if(typeof r!=="number"||r<=0||!isFinite(r))throw Error("elementToPolygon: samples must be a positive finite number");let e=i0(t,null,r);if(a&&e.length>0)e=e.map((o)=>{let[n,i]=l4(a,o.x,o.y);return{x:n,y:i}});return e}function Xr(t,a){if(!a||typeof a!=="object"||Array.isArray(a))throw Error("mergeStyles: element must be a valid non-array object");let r={...a};if(t!==null&&t!==void 0){if(typeof t!=="object"||Array.isArray(t))throw Error("mergeStyles: inherited must be null, undefined, or a valid non-array object")}for(let[e,o]of Object.entries(t||{}))if(o!==null&&(r[e]===null||r[e]===void 0))r[e]=o;return r}function Lr(t,a=20){if(typeof a!=="number"||a<=0||!isFinite(a))throw Error("resolvedUseToPathData: samples must be a positive finite number");let r=y6(t,a),e=[];for(let{polygon:o}of r)if(o.length>=3){let n="";for(let i=0;i<o.length;i++){let l=o[i],d=Number(l.x),p=Number(l.y);if(isNaN(d)||isNaN(p))continue;n+=i===0?`M ${d.toFixed(6)} ${p.toFixed(6)}`:` L ${d.toFixed(6)} ${p.toFixed(6)}`}n+=" Z",e.push(n)}return e.join(" ")}E.set({precision:80});var Z3=(t)=>t instanceof E?t:new E(t);function Or(t){if(!t)throw Error("parsePatternElement: patternElement is required");if(typeof t.getAttribute!=="function")throw Error("parsePatternElement: patternElement must be a DOM element with getAttribute method");let a={id:t.getAttribute("id")||"",patternUnits:t.getAttribute("patternUnits")||"objectBoundingBox",patternContentUnits:t.getAttribute("patternContentUnits")||"userSpaceOnUse",patternTransform:t.getAttribute("patternTransform")||null,x:t.getAttribute("x"),y:t.getAttribute("y"),width:t.getAttribute("width"),height:t.getAttribute("height"),viewBox:t.getAttribute("viewBox")||null,preserveAspectRatio:t.getAttribute("preserveAspectRatio")||"xMidYMid meet",href:t.getAttribute("href")||t.getAttribute("xlink:href")||null,children:[]},r=(e,o)=>{if(e===null||e===void 0)return o;let n=parseFloat(e);return isNaN(n)?o:n};if(a.x=r(a.x,0),a.y=r(a.y,0),a.width=r(a.width,0),a.height=r(a.height,0),a.viewBox){let e=a.viewBox.trim().split(/[\s,]+/).map(Number);if(e.length===4&&e.every((o)=>!isNaN(o)&&isFinite(o)))a.viewBoxParsed={x:e[0],y:e[1],width:e[2],height:e[3]}}if(t.children&&typeof t.children[Symbol.iterator]==="function")for(let e of t.children){if(!e||typeof e.getAttribute!=="function")continue;let o=e.tagName?e.tagName.toLowerCase():"";if(!o)continue;let n={type:o,fill:e.getAttribute("fill")||"black",stroke:e.getAttribute("stroke")||"none",strokeWidth:r(e.getAttribute("stroke-width"),1),opacity:r(e.getAttribute("opacity"),1),transform:e.getAttribute("transform")||null};switch(o){case"rect":n.x=r(e.getAttribute("x"),0),n.y=r(e.getAttribute("y"),0),n.width=r(e.getAttribute("width"),0),n.height=r(e.getAttribute("height"),0),n.rx=r(e.getAttribute("rx"),0),n.ry=r(e.getAttribute("ry"),0);break;case"circle":n.cx=r(e.getAttribute("cx"),0),n.cy=r(e.getAttribute("cy"),0),n.r=r(e.getAttribute("r"),0);break;case"ellipse":n.cx=r(e.getAttribute("cx"),0),n.cy=r(e.getAttribute("cy"),0),n.rx=r(e.getAttribute("rx"),0),n.ry=r(e.getAttribute("ry"),0);break;case"path":n.d=e.getAttribute("d")||"";break;case"polygon":n.points=e.getAttribute("points")||"";break;case"polyline":n.points=e.getAttribute("points")||"";break;case"line":n.x1=r(e.getAttribute("x1"),0),n.y1=r(e.getAttribute("y1"),0),n.x2=r(e.getAttribute("x2"),0),n.y2=r(e.getAttribute("y2"),0);break;case"use":n.href=e.getAttribute("href")||e.getAttribute("xlink:href")||"",n.x=r(e.getAttribute("x"),0),n.y=r(e.getAttribute("y"),0);break;case"g":if(n.children=[],e.children&&typeof e.children[Symbol.iterator]==="function"){for(let i of e.children)if(i&&i.tagName&&typeof i.getAttribute==="function")n.children.push({type:i.tagName.toLowerCase(),fill:i.getAttribute("fill")||"inherit"})}break;default:break}a.children.push(n)}return a}function kr(t,a){if(!t)throw Error("getPatternTile: patternData is required");if(!a)throw Error("getPatternTile: targetBBox is required");if(typeof a.x!=="number"||typeof a.y!=="number"||typeof a.width!=="number"||typeof a.height!=="number")throw Error("getPatternTile: targetBBox must have numeric x, y, width, and height properties");if(typeof t.x!=="number"||typeof t.y!=="number"||typeof t.width!=="number"||typeof t.height!=="number")throw Error("getPatternTile: patternData must have numeric x, y, width, and height properties");if(t.patternUnits==="objectBoundingBox")return{x:Z3(a.x).plus(Z3(t.x).mul(a.width)),y:Z3(a.y).plus(Z3(t.y).mul(a.height)),width:Z3(t.width).mul(a.width),height:Z3(t.height).mul(a.height)};return{x:Z3(t.x),y:Z3(t.y),width:Z3(t.width),height:Z3(t.height)}}function Yr(t,a,r){if(!t)throw Error("getPatternContentTransform: patternData is required");if(!a)throw Error("getPatternContentTransform: tile is required");if(!r)throw Error("getPatternContentTransform: targetBBox is required");if(!a.width||!a.height)throw Error("getPatternContentTransform: tile must have width and height properties");if(typeof r.x!=="number"||typeof r.y!=="number"||typeof r.width!=="number"||typeof r.height!=="number")throw Error("getPatternContentTransform: targetBBox must have numeric x, y, width, and height properties");let e=P3.identity(3);if(t.viewBoxParsed){let o=t.viewBoxParsed;if(typeof o.x!=="number"||typeof o.y!=="number"||typeof o.width!=="number"||typeof o.height!=="number")throw Error("getPatternContentTransform: viewBoxParsed must have numeric x, y, width, and height properties");let n=Number(a.width),i=Number(a.height);if(n===0||i===0)throw Error("getPatternContentTransform: tile width and height must be non-zero when viewBox is present");if(o.width===0||o.height===0)throw Error("getPatternContentTransform: viewBox width and height must be non-zero");let l=n/o.width,d=i/o.height,p=Math.min(l,d);if(!isFinite(p))throw Error("getPatternContentTransform: computed scale is not finite");let g=(n-o.width*p)/2,c=(i-o.height*p)/2;e=e.mul(s4(g-o.x*p,c-o.y*p)),e=e.mul(p5(p,p))}if(t.patternContentUnits==="objectBoundingBox"){if(r.width===0||r.height===0)throw Error("getPatternContentTransform: targetBBox width and height must be non-zero when patternContentUnits is objectBoundingBox");e=e.mul(s4(r.x,r.y)),e=e.mul(p5(r.width,r.height))}return e}function Mr(t,a=null,r=20){if(!t)throw Error("patternChildToPolygon: child is required");if(!t.type)throw Error("patternChildToPolygon: child must have a type property");if(typeof r!=="number"||r<=0||!isFinite(r))throw Error("patternChildToPolygon: samples must be a positive finite number");let e={type:t.type,...t,transform:t.transform},o=i0(e,null,r);if(!Array.isArray(o))return[];if(a&&o.length>0)o=o.map((n)=>{if(!n||typeof n.x!=="number"||typeof n.y!=="number")throw Error("patternChildToPolygon: invalid polygon point - must have numeric x and y properties");let[i,l]=l4(a,n.x,n.y);return{x:i,y:l}});return o}function Vr(t,a){if(!t)throw Error("getTilePositions: tile is required");if(!a)throw Error("getTilePositions: coverBBox is required");if(!("x"in t)||!("y"in t)||!("width"in t)||!("height"in t))throw Error("getTilePositions: tile must have x, y, width, and height properties");if(typeof a.x!=="number"||typeof a.y!=="number"||typeof a.width!=="number"||typeof a.height!=="number")throw Error("getTilePositions: coverBBox must have numeric x, y, width, and height properties");let r=[],e=Number(t.x),o=Number(t.y),n=Number(t.width),i=Number(t.height);if(!isFinite(e)||!isFinite(o)||!isFinite(n)||!isFinite(i))throw Error("getTilePositions: tile dimensions must be finite numbers");if(n<=0||i<=0)return r;let l=Math.floor((a.x-e)/n),d=Math.ceil((a.x+a.width-e)/n),p=Math.floor((a.y-o)/i),g=Math.ceil((a.y+a.height-o)/i);if(!isFinite(l)||!isFinite(d)||!isFinite(p)||!isFinite(g))throw Error("getTilePositions: computed tile indices are not finite");for(let c=l;c<d;c++)for(let m=p;m<g;m++)r.push({x:Z3(e).plus(Z3(n).mul(c)),y:Z3(o).plus(Z3(i).mul(m))});return r}function Ur(t,a,r={}){if(!t)throw Error("resolvePattern: patternData is required");if(!a)throw Error("resolvePattern: targetBBox is required");if(!Array.isArray(t.children))throw Error("resolvePattern: patternData.children must be an array");let{samples:e=20,maxTiles:o=1000}=r,n=[],i=kr(t,a);if(Number(i.width)<=0||Number(i.height)<=0)return n;let l=Yr(t,i,a),d=jr(t.patternTransform),p=Vr(i,a).slice(0,o);for(let g of p){let c=s4(g.x,g.y);for(let m of t.children){let y=d.mul(c.mul(l)),h=Mr(m,y,e);if(h.length>=3)n.push({polygon:h,fill:m.fill,stroke:m.stroke,strokeWidth:m.strokeWidth,opacity:m.opacity})}}return n}function _r(t,a,r={}){if(!t)throw Error("patternToClipPath: patternData is required");if(!a)throw Error("patternToClipPath: targetBBox is required");let e=Ur(t,a,r),o=[];for(let{polygon:n,opacity:i}of e)if(i>0&&n.length>=3)if(o.length===0)o=n;else{let l=y2(o,n);if(Array.isArray(l)&&l.length>0&&Array.isArray(l[0])&&l[0].length>=3)o=l[0]}return o}function Fr(t,a,r={}){if(!t)throw Error("patternToPathData: patternData is required");if(!a)throw Error("patternToPathData: targetBBox is required");let e=_r(t,a,r);if(!Array.isArray(e))return"";if(e.length<3)return"";let o="";for(let n=0;n<e.length;n++){let i=e[n];if(!i||typeof i.x!=="number"||typeof i.y!=="number")throw Error("patternToPathData: invalid polygon point - must have numeric x and y properties");if(!isFinite(i.x)||!isFinite(i.y))throw Error("patternToPathData: polygon point coordinates must be finite numbers");let l=Number(i.x).toFixed(6),d=Number(i.y).toFixed(6);o+=n===0?`M ${l} ${d}`:` L ${l} ${d}`}return o+=" Z",o}function jr(t){if(!t)return P3.identity(3);return(void 0)(t)}E.set({precision:80});function f2(t,a,r,e=1,o=!1){if(!t)throw Error("getMarkerTransform: markerDef is required");if(!a||typeof a.x!=="number"||typeof a.y!=="number")throw Error("getMarkerTransform: position must be an object with x and y numeric properties");if(typeof r!=="number"||isNaN(r)||!isFinite(r))throw Error("getMarkerTransform: tangentAngle must be a valid finite number");if(typeof e!=="number"||isNaN(e)||e<=0)throw Error("getMarkerTransform: strokeWidth must be a positive number");let{markerWidth:n,markerHeight:i,refX:l,refY:d,orient:p,markerUnits:g,viewBox:c}=t;if(typeof n!=="number"||n<=0)throw Error("getMarkerTransform: markerDef.markerWidth must be a positive number");if(typeof i!=="number"||i<=0)throw Error("getMarkerTransform: markerDef.markerHeight must be a positive number");if(typeof l!=="number"||!isFinite(l))throw Error("getMarkerTransform: markerDef.refX must be a finite number");if(typeof d!=="number"||!isFinite(d))throw Error("getMarkerTransform: markerDef.refY must be a finite number");let m=P3.identity(3),y=s4(a.x,a.y);m=m.mul(y);let h=0;if(p==="auto")h=r;else if(p==="auto-start-reverse")h=o?r+Math.PI:r;else if(typeof p==="number")h=p*(Math.PI/180);if(h!==0){let S=K5(h);m=m.mul(S)}let s=1,x=1;if(g==="strokeWidth")s=e,x=e;if(c){let{width:S,height:P}=c;if(S>0&&P>0&&isFinite(S)&&isFinite(P)){let T=n/S,f=i/P;if(isFinite(T)&&isFinite(f)){let X=Math.min(T,f);s*=X,x*=X;let B=s4(-c.x,-c.y);m=m.mul(B)}}}if(s!==1||x!==1){let S=p5(s,x);m=m.mul(S)}let D=s4(-l,-d);return m=m.mul(D),m}function Wr(t){if(typeof t!=="string")throw Error("getPathVertices: pathData must be a string");let a=[],r=0,e=0,o=0,n=0,i=s6(t);for(let l=0;l<i.length;l++){let d=i[l],p=r,g=e;switch(d.type){case"M":if(r=d.x,e=d.y,o=r,n=e,a.length>0){let c=a[a.length-1],m=Math.atan2(e-g,r-p);c.tangentOut=m}a.push({x:r,y:e,tangentIn:0,tangentOut:0,index:a.length});break;case"L":{r=d.x,e=d.y;let c=r-p,m=e-g,y=c===0&&m===0?a.length>0?a[a.length-1].tangentOut:0:Math.atan2(m,c);if(a.length>0)a[a.length-1].tangentOut=y;a.push({x:r,y:e,tangentIn:y,tangentOut:y,index:a.length});break}case"C":{r=d.x,e=d.y;let c=d.x1-p,m=d.y1-g,y=c===0&&m===0?Math.atan2(d.y2-g,d.x2-p):Math.atan2(m,c),h=r-d.x2,s=e-d.y2,x=h===0&&s===0?Math.atan2(e-d.y1,r-d.x1):Math.atan2(s,h);if(a.length>0)a[a.length-1].tangentOut=y;a.push({x:r,y:e,tangentIn:x,tangentOut:x,index:a.length});break}case"Q":{r=d.x,e=d.y;let c=d.x1-p,m=d.y1-g,y=c===0&&m===0?Math.atan2(e-g,r-p):Math.atan2(m,c),h=r-d.x1,s=e-d.y1,x=h===0&&s===0?Math.atan2(e-g,r-p):Math.atan2(s,h);if(a.length>0)a[a.length-1].tangentOut=y;a.push({x:r,y:e,tangentIn:x,tangentOut:x,index:a.length});break}case"A":{r=d.x,e=d.y;let c=r-p,m=e-g,y=c===0&&m===0?a.length>0?a[a.length-1].tangentOut:0:Math.atan2(m,c);if(a.length>0)a[a.length-1].tangentOut=y;a.push({x:r,y:e,tangentIn:y,tangentOut:y,index:a.length});break}case"Z":{r=o,e=n;let c=r-p,m=e-g,y=c===0&&m===0?a.length>0?a[a.length-1].tangentOut:0:Math.atan2(m,c);if(a.length>0)a[a.length-1].tangentOut=y;if(a.length>0)a[0].tangentIn=y;break}default:break}}return a}function s6(t){if(typeof t!=="string")throw Error("parsePathCommands: pathData must be a string");let a=[];if(t.trim()==="")return a;let r=t.replace(/([MmLlHhVvCcSsQqTtAaZz])/g," $1 ").trim(),e=/[MmLlHhVvCcSsQqTtAaZz]/,o=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,n=[],i=0;while(i<r.length){while(i<r.length&&/[\s,]/.test(r[i]))i++;if(i>=r.length)break;if(e.test(r[i]))n.push(r[i]),i++;else{o.lastIndex=i;let c=o.exec(r);if(c&&c.index===i)n.push(c[0]),i=o.lastIndex;else i++}}let l=0,d=0,p=0,g=(c,m)=>{if(c>=n.length)throw Error(`parsePathCommands: missing ${m} parameter at token ${c}`);let y=parseFloat(n[c]);if(isNaN(y)||!isFinite(y))throw Error(`parsePathCommands: invalid ${m} value "${n[c]}" at token ${c}`);return y};while(l<n.length){let c=n[l];switch(c.toUpperCase()){case"M":{let m=g(l+1,"M.x"),y=g(l+2,"M.y");a.push({type:"M",x:c==="M"?m:d+m,y:c==="M"?y:p+y}),d=a[a.length-1].x,p=a[a.length-1].y,l+=3;break}case"L":{let m=g(l+1,"L.x"),y=g(l+2,"L.y");a.push({type:"L",x:c==="L"?m:d+m,y:c==="L"?y:p+y}),d=a[a.length-1].x,p=a[a.length-1].y,l+=3;break}case"H":{let m=g(l+1,"H.x");a.push({type:"L",x:c==="H"?m:d+m,y:p}),d=a[a.length-1].x,l+=2;break}case"V":{let m=g(l+1,"V.y");a.push({type:"L",x:d,y:c==="V"?m:p+m}),p=a[a.length-1].y,l+=2;break}case"C":{let m=g(l+1,"C.x1"),y=g(l+2,"C.y1"),h=g(l+3,"C.x2"),s=g(l+4,"C.y2"),x=g(l+5,"C.x"),D=g(l+6,"C.y");a.push({type:"C",x1:c==="C"?m:d+m,y1:c==="C"?y:p+y,x2:c==="C"?h:d+h,y2:c==="C"?s:p+s,x:c==="C"?x:d+x,y:c==="C"?D:p+D}),d=a[a.length-1].x,p=a[a.length-1].y,l+=7;break}case"Q":{let m=g(l+1,"Q.x1"),y=g(l+2,"Q.y1"),h=g(l+3,"Q.x"),s=g(l+4,"Q.y");a.push({type:"Q",x1:c==="Q"?m:d+m,y1:c==="Q"?y:p+y,x:c==="Q"?h:d+h,y:c==="Q"?s:p+s}),d=a[a.length-1].x,p=a[a.length-1].y,l+=5;break}case"A":{let m=g(l+1,"A.rx"),y=g(l+2,"A.ry"),h=g(l+3,"A.rotation");if(l+4>=n.length||l+5>=n.length)throw Error("parsePathCommands: missing arc flag parameters");let s=parseInt(n[l+4],10),x=parseInt(n[l+5],10);if(isNaN(s)||isNaN(x))throw Error("parsePathCommands: invalid arc flag values");let D=g(l+6,"A.x"),S=g(l+7,"A.y");a.push({type:"A",rx:m,ry:y,xAxisRotation:h,largeArcFlag:s,sweepFlag:x,x:c==="A"?D:d+D,y:c==="A"?S:p+S}),d=a[a.length-1].x,p=a[a.length-1].y,l+=8;break}case"Z":a.push({type:"Z"}),l+=1;break;default:l+=1}}return a}function Gr(t,a){if(!t)throw Error("resolveMarkers: pathElement is required");if(!a||typeof a!=="object")throw Error("resolveMarkers: defsMap must be an object");let r=[],e=t.getAttribute("marker-start"),o=t.getAttribute("marker-mid"),n=t.getAttribute("marker-end"),i=t.getAttribute("stroke-width")||"1",l=parseFloat(i);if(isNaN(l)||l<=0)throw Error("resolveMarkers: stroke-width must be a positive number");let d=t.getAttribute("d")||"",p=Wr(d);if(p.length===0)return r;let g=(c)=>{if(!c)return null;let m=c.match(/url\(#([^)]+)\)/);return m?m[1]:null};if(e){let c=g(e),m=c?a[c]:null;if(m&&p.length>0){let y=p[0],h=p.length>1?y.tangentOut:y.tangentIn;r.push({markerDef:m,position:{x:y.x,y:y.y},transform:f2(m,{x:y.x,y:y.y},h,l,!0),type:"start",vertex:y})}}if(o&&p.length>2){let c=g(o),m=c?a[c]:null;if(m)for(let y=1;y<p.length-1;y++){let h=p[y],s=h.tangentIn,x=h.tangentOut-s;while(x>Math.PI)x-=2*Math.PI;while(x<-Math.PI)x+=2*Math.PI;let D=s+x/2;r.push({markerDef:m,position:{x:h.x,y:h.y},transform:f2(m,{x:h.x,y:h.y},D,l,!1),type:"mid",vertex:h})}}if(n){let c=g(n),m=c?a[c]:null;if(m&&p.length>0){let y=p[p.length-1],h=y.tangentIn;r.push({markerDef:m,position:{x:y.x,y:y.y},transform:f2(m,{x:y.x,y:y.y},h,l,!1),type:"end",vertex:y})}}return r}function zr(t,a={}){if(!t)throw Error("markerToPolygons: markerInstance is required");if(!t.markerDef)throw Error("markerToPolygons: markerInstance.markerDef is required");if(!t.transform)throw Error("markerToPolygons: markerInstance.transform is required");let{precision:r=2,curveSegments:e=10}=a;if(typeof r!=="number"||r<0)throw Error("markerToPolygons: precision must be a non-negative number");if(typeof e!=="number"||e<=0)throw Error("markerToPolygons: curveSegments must be a positive number");let o=[],{markerDef:n,transform:i}=t;if(!Array.isArray(n.children))throw Error("markerToPolygons: markerDef.children must be an array");for(let l of n.children){let d=[];switch(l.type){case"path":d=qr(l.d,e);break;case"rect":d=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}];break;case"circle":d=Qr(l.cx,l.cy,l.r,e*4);break;case"ellipse":d=Hr(l.cx,l.cy,l.rx,l.ry,e*4);break;case"line":d=[{x:l.x1,y:l.y1},{x:l.x2,y:l.y2}];break;case"polygon":case"polyline":d=Kr(l.points);break;default:break}if(d.length>0){let p=d.map((g)=>{let c=l4(i,g.x,g.y);return{x:parseFloat(c[0].toFixed(r)),y:parseFloat(c[1].toFixed(r))}});o.push(p)}}return o}function qr(t,a=10){if(typeof t!=="string")throw Error("pathToPoints: pathData must be a string");if(typeof a!=="number"||a<=0)throw Error("pathToPoints: segments must be a positive number");let r=[],e=s6(t),o=0,n=0;for(let i of e)switch(i.type){case"M":o=i.x,n=i.y,r.push({x:o,y:n});break;case"L":o=i.x,n=i.y,r.push({x:o,y:n});break;case"C":for(let l=1;l<=a;l++){let d=l/a,p=1-d,g=p*p*p*o+3*p*p*d*i.x1+3*p*d*d*i.x2+d*d*d*i.x,c=p*p*p*n+3*p*p*d*i.y1+3*p*d*d*i.y2+d*d*d*i.y;r.push({x:g,y:c})}o=i.x,n=i.y;break;case"Q":for(let l=1;l<=a;l++){let d=l/a,p=1-d,g=p*p*o+2*p*d*i.x1+d*d*i.x,c=p*p*n+2*p*d*i.y1+d*d*i.y;r.push({x:g,y:c})}o=i.x,n=i.y;break;case"A":o=i.x,n=i.y,r.push({x:o,y:n});break;default:break}return r}function Qr(t,a,r,e=32){if(typeof t!=="number"||!isFinite(t))throw Error("circleToPoints: cx must be a finite number");if(typeof a!=="number"||!isFinite(a))throw Error("circleToPoints: cy must be a finite number");if(typeof r!=="number"||!isFinite(r)||r<0)throw Error("circleToPoints: r must be a non-negative finite number");if(typeof e!=="number"||e<=0)throw Error("circleToPoints: segments must be a positive number");let o=[];for(let n=0;n<e;n++){let i=n/e*2*Math.PI;o.push({x:t+r*Math.cos(i),y:a+r*Math.sin(i)})}return o}function Hr(t,a,r,e,o=32){if(typeof t!=="number"||!isFinite(t))throw Error("ellipseToPoints: cx must be a finite number");if(typeof a!=="number"||!isFinite(a))throw Error("ellipseToPoints: cy must be a finite number");if(typeof r!=="number"||!isFinite(r)||r<0)throw Error("ellipseToPoints: rx must be a non-negative finite number");if(typeof e!=="number"||!isFinite(e)||e<0)throw Error("ellipseToPoints: ry must be a non-negative finite number");if(typeof o!=="number"||o<=0)throw Error("ellipseToPoints: segments must be a positive number");let n=[];for(let i=0;i<o;i++){let l=i/o*2*Math.PI;n.push({x:t+r*Math.cos(l),y:a+e*Math.sin(l)})}return n}function Kr(t){if(typeof t!=="string")throw Error("parsePoints: pointsStr must be a string");let a=[],r=t.trim().split(/[\s,]+/).map(Number).filter((e)=>!isNaN(e)&&isFinite(e));if(r.length%2!==0)throw Error("parsePoints: pointsStr must contain an even number of valid coordinates");for(let e=0;e<r.length;e+=2)a.push({x:r[e],y:r[e+1]});return a}function Zr(t,a=2){if(!Array.isArray(t))throw Error("markersToPathData: markerInstances must be an array");if(typeof a!=="number"||a<0)throw Error("markersToPathData: precision must be a non-negative number");let r=[];for(let e of t){let o=zr(e,{precision:a});for(let n of o){if(n.length===0)continue;let i=n[0];r.push(`M ${i.x.toFixed(a)} ${i.y.toFixed(a)}`);for(let l=1;l<n.length;l++){let d=n[l];r.push(`L ${d.x.toFixed(a)} ${d.y.toFixed(a)}`)}r.push("Z")}}return r.join(" ")}E.set({precision:80});var S3=(t)=>t instanceof E?t:new E(t),j3=new E(0),c5=new E(1);function s5(){let t=E.precision;if(t<20)throw Error(`Decimal precision (${t}) is too low for verification. Minimum required: 20`);let a=Math.max(1,t-10);return new E(10).pow(-a)}function Jr(t,a,r){let e=s5();if(!t)return{valid:!1,error:new E(1/0),tolerance:e,message:"Matrix parameter is null or undefined"};if(a==null||r==null)return{valid:!1,error:new E(1/0),tolerance:e,message:"Coordinates x or y are null or undefined"};let o=S3(a),n=S3(r);try{let[i,l]=l4(t,o,n),d=t.inverse();if(!d)return{valid:!1,error:new E(1/0),tolerance:e,message:"Matrix is not invertible (determinant = 0)",details:{determinant:t.determinant()}};let[p,g]=l4(d,i,l),c=o.minus(p).abs(),m=n.minus(g).abs(),y=E.max(c,m),h=y.lessThan(e);return{valid:h,error:y,tolerance:e,message:h?`Round-trip verified: error ${y.toExponential()} < tolerance ${e.toExponential()}`:`Round-trip FAILED: error ${y.toExponential()} >= tolerance ${e.toExponential()}`,details:{original:{x:o.toString(),y:n.toString()},transformed:{x:i.toString(),y:l.toString()},recovered:{x:p.toString(),y:g.toString()},errorX:c.toExponential(),errorY:m.toExponential()}}}catch(i){return{valid:!1,error:new E(1/0),tolerance:e,message:`Verification error: ${i.message}`}}}function x6(t){let a=s5();if(!t)return{valid:!1,error:new E(1/0),tolerance:a,message:"Matrix parameter is null or undefined"};try{let r=t.inverse();if(!r)return{valid:!1,error:new E(1/0),tolerance:a,message:"Matrix is singular (not invertible)",details:{determinant:t.determinant().toString()}};let e=t.mul(r),o=t.rows,n=j3,i=[];for(let d=0;d<o;d++)for(let p=0;p<o;p++){let g=d===p?c5:j3,c=e.data[d][p],m=c.minus(g).abs();if(m.greaterThan(n))n=m;if(m.greaterThanOrEqualTo(a))i.push({row:d,col:p,expected:g.toString(),actual:c.toString(),error:m.toExponential()})}let l=n.lessThan(a);return{valid:l,error:n,tolerance:a,message:l?`Matrix inversion verified: max error ${n.toExponential()} < tolerance`:`Matrix inversion FAILED: max error ${n.toExponential()} at ${i.length} positions`,details:{matrixSize:`${o}x${o}`,maxError:n.toExponential(),failedElements:i.slice(0,5)}}}catch(r){return{valid:!1,error:new E(1/0),tolerance:a,message:`Verification error: ${r.message}`}}}function e9(t,a,r=null){let e=s5(),o=r||new E("1e-6");if(!t||!Array.isArray(t))return{valid:!1,error:j3,tolerance:e,message:"Inner polygon parameter is null, undefined, or not an array"};if(!a||!Array.isArray(a))return{valid:!1,error:j3,tolerance:e,message:"Outer polygon parameter is null, undefined, or not an array"};if(t.length<3||a.length<3)return{valid:!1,error:j3,tolerance:e,message:"Polygons must have at least 3 vertices"};try{let n=!0,i=[],l=j3;for(let d=0;d<t.length;d++){let p=t[d];if(!eo(p,a)){let g=$r(p,a);if(g.greaterThan(l))l=g;if(g.greaterThan(o))n=!1,i.push({index:d,x:p.x.toString(),y:p.y.toString(),distanceOutside:g.toExponential()})}}return{valid:n,error:l,tolerance:o,message:n?`All inner polygon points are inside or within tolerance (max outside: ${l.toExponential()})`:`${i.length} points exceed tolerance distance outside outer polygon`,details:{innerVertices:t.length,outerVertices:a.length,maxOutsideDistance:l.toExponential(),outsidePoints:i.slice(0,5)}}}catch(n){return{valid:!1,error:new E(1/0),tolerance:e,message:`Verification error: ${n.message}`}}}function $r(t,a){if(!t||t.x==null||t.y==null)throw Error("Invalid point parameter: must have x and y properties");if(!a||!Array.isArray(a)||a.length===0)throw Error("Invalid polygon parameter: must be non-empty array of points");let r=new E(1/0),e=S3(t.x),o=S3(t.y);for(let n=0;n<a.length;n++){let i=(n+1)%a.length,l=a[n],d=a[i],p=S3(l.x),g=S3(l.y),c=S3(d.x),m=S3(d.y),y=c.minus(p),h=m.minus(g),s=y.times(y).plus(h.times(h)),x;if(s.isZero())x=D6(t,l);else{let D=E.max(j3,E.min(c5,e.minus(p).times(y).plus(o.minus(g).times(h)).div(s))),S=p.plus(D.times(y)),P=g.plus(D.times(h));x=e.minus(S).pow(2).plus(o.minus(P).pow(2)).sqrt()}if(x.lessThan(r))r=x}return r}function to(t,a,r){let e=s5();if(!t||!Array.isArray(t))return{valid:!1,error:j3,tolerance:e,message:"Poly1 parameter must be an array"};if(!a||!Array.isArray(a))return{valid:!1,error:j3,tolerance:e,message:"Poly2 parameter must be an array"};if(!r||!Array.isArray(r))return{valid:!1,error:j3,tolerance:e,message:"Intersection parameter must be an array"};if(r.length<3)return{valid:!0,error:j3,tolerance:e,message:"Intersection is empty or degenerate (valid result)",details:{intersectionVertices:r.length}};try{let o=e9(r,t),n=e9(r,a),i=T5(t),l=T5(a),d=T5(r),p=E.min(i,l),g=d.lessThanOrEqualTo(p.times(c5.plus(e))),c=o.valid&&n.valid&&g;return{valid:c,error:c?j3:c5,tolerance:e,message:c?"Intersection verified: contained in both polygons, area valid":`Intersection FAILED: ${!o.valid?"not in poly1, ":""}${!n.valid?"not in poly2, ":""}${!g?"area too large":""}`,details:{containedInPoly1:o.valid,containedInPoly2:n.valid,area1:i.toString(),area2:l.toString(),intersectionArea:d.toString(),areaValid:g}}}catch(o){return{valid:!1,error:new E(1/0),tolerance:e,message:`Verification error: ${o.message}`}}}function ao(t,a,r){let e=s5();if(!t||typeof t!=="object")return{valid:!1,error:new E(1/0),tolerance:e,message:"Original gradient parameter must be an object"};if(!a||typeof a!=="object")return{valid:!1,error:new E(1/0),tolerance:e,message:"Baked gradient parameter must be an object"};if(!r)return{valid:!1,error:new E(1/0),tolerance:e,message:"Matrix parameter is null or undefined"};try{let[o,n]=l4(r,S3(t.x1||0),S3(t.y1||0)),[i,l]=l4(r,S3(t.x2||1),S3(t.y2||0)),d=S3(a.x1).minus(o).abs(),p=S3(a.y1).minus(n).abs(),g=S3(a.x2).minus(i).abs(),c=S3(a.y2).minus(l).abs(),m=E.max(d,p,g,c),y=m.lessThan(e);return{valid:y,error:m,tolerance:e,message:y?`Linear gradient transform verified: max error ${m.toExponential()}`:`Linear gradient transform FAILED: max error ${m.toExponential()}`,details:{expected:{x1:o.toString(),y1:n.toString(),x2:i.toString(),y2:l.toString()},actual:a}}}catch(o){return{valid:!1,error:new E(1/0),tolerance:e,message:`Verification error: ${o.message}`}}}function T5(t){if(!t||!Array.isArray(t))throw Error("Invalid polygon parameter: must be an array");if(t.length<3)return j3;let a=j3,r=t.length;for(let e=0;e<r;e++){let o=(e+1)%r,n=S3(t[e].x),i=S3(t[e].y),l=S3(t[o].x),d=S3(t[o].y);a=a.plus(n.times(d).minus(l.times(i)))}return a.abs().div(2)}function eo(t,a){if(!t||t.x==null||t.y==null)throw Error("Invalid point parameter: must have x and y properties");if(!a||!Array.isArray(a)||a.length===0)throw Error("Invalid polygon parameter: must be non-empty array of points");let r=S3(t.x),e=S3(t.y),o=a.length,n=!1;for(let i=0,l=o-1;i<o;l=i++){let d=S3(a[i].x),p=S3(a[i].y),g=S3(a[l].x),c=S3(a[l].y);if(ro(t,a[i],a[l]))return!0;if(p.greaterThan(e)!==c.greaterThan(e)&&r.lessThan(g.minus(d).times(e.minus(p)).div(c.minus(p)).plus(d)))n=!n}return n}function ro(t,a,r){if(!t||t.x==null||t.y==null)throw Error("Invalid point parameter: must have x and y properties");if(!a||a.x==null||a.y==null)throw Error("Invalid segStart parameter: must have x and y properties");if(!r||r.x==null||r.y==null)throw Error("Invalid segEnd parameter: must have x and y properties");let e=s5(),o=S3(t.x),n=S3(t.y),i=S3(a.x),l=S3(a.y),d=S3(r.x),p=S3(r.y),g=E.min(i,d).minus(e),c=E.max(i,d).plus(e),m=E.min(l,p).minus(e),y=E.max(l,p).plus(e);if(o.lessThan(g)||o.greaterThan(c)||n.lessThan(m)||n.greaterThan(y))return!1;let h=d.minus(i).times(n.minus(l)).minus(p.minus(l).times(o.minus(i))).abs(),s=D6(a,r);return h.div(s.plus(e)).lessThan(e)}function D6(t,a){if(!t||t.x==null||t.y==null)throw Error("Invalid p1 parameter: must have x and y properties");if(!a||a.x==null||a.y==null)throw Error("Invalid p2 parameter: must have x and y properties");let r=S3(a.x).minus(S3(t.x)),e=S3(a.y).minus(S3(t.y));return r.times(r).plus(e.times(e)).sqrt()}function oo(t,a){if(!t||t.length<3||!a||a.length<3)return[];let r=[];for(let e=0;e<a.length;e++){let o=a[e],n=a[(e+1)%a.length],i=[];for(let l=0;l<t.length;l++){let d=t[l],p=t[(l+1)%t.length],g=!r9(d,o,n),c=!r9(p,o,n);if(g){if(i.push(d),!c)i.push(o9(d,p,o,n))}else if(c)i.push(o9(d,p,o,n))}if(i.length>=3)r.push(i)}return r}function no(t,a,r=[],e="1e-10"){let o=e instanceof E?e:new E(e),n=r||[];if(!t||!Array.isArray(t))return{valid:!1,error:new E(1/0),tolerance:o,message:"Original polygon parameter must be an array"};if(!a||!Array.isArray(a))return{valid:!1,error:new E(1/0),tolerance:o,message:"Clipped polygon parameter must be an array"};try{let i=T5(t),l=a.length>=3?T5(a):j3,d=i.minus(l),p=l.lessThanOrEqualTo(i.times(c5.plus(o))),g=d.greaterThanOrEqualTo(j3.minus(o.times(i))),c=i.isZero()?c5:l.div(i),m=j3,y=p&&g;return{valid:y,error:m,tolerance:o,message:y?`ClipPath E2E verified: area conserved (clipped ${c.times(100).toFixed(2)}% of original)`:"ClipPath E2E FAILED: invalid intersection (clipped > original or negative outside)",details:{originalArea:i.toString(),clippedArea:l.toString(),outsideArea:d.toString(),areaRatio:c.toFixed(6),fragmentCount:n.length,clippedValid:p,outsideValid:g}}}catch(i){return{valid:!1,error:new E(1/0),tolerance:o,message:`E2E verification error: ${i.message}`}}}function r9(t,a,r){if(!t||t.x==null||t.y==null)throw Error("Invalid point parameter: must have x and y properties");if(!a||a.x==null||a.y==null)throw Error("Invalid edgeStart parameter: must have x and y properties");if(!r||r.x==null||r.y==null)throw Error("Invalid edgeEnd parameter: must have x and y properties");let e=S3(t.x).toNumber(),o=S3(t.y).toNumber(),n=S3(a.x).toNumber(),i=S3(a.y).toNumber(),l=S3(r.x).toNumber(),d=S3(r.y).toNumber();return(l-n)*(o-i)-(d-i)*(e-n)>=0}function o9(t,a,r,e){if(!t||t.x==null||t.y==null)throw Error("Invalid p1 parameter: must have x and y properties");if(!a||a.x==null||a.y==null)throw Error("Invalid p2 parameter: must have x and y properties");if(!r||r.x==null||r.y==null)throw Error("Invalid p3 parameter: must have x and y properties");if(!e||e.x==null||e.y==null)throw Error("Invalid p4 parameter: must have x and y properties");let o=S3(t.x).toNumber(),n=S3(t.y).toNumber(),i=S3(a.x).toNumber(),l=S3(a.y).toNumber(),d=S3(r.x).toNumber(),p=S3(r.y).toNumber(),g=S3(e.x).toNumber(),c=S3(e.y).toNumber(),m=(o-i)*(p-c)-(n-l)*(d-g);if(Math.abs(m)<0.0000000001)return{x:S3((o+i)/2),y:S3((n+l)/2)};let y=((o-d)*(p-c)-(n-p)*(d-g))/m;return{x:S3(o+y*(i-o)),y:S3(n+y*(l-n))}}var io=["animate","animateTransform","animateMotion","animateColor","set"],n9=["href","xlink:href"],i9=["fill","stroke","clip-path","mask","filter","marker-start","marker-mid","marker-end","cursor","color-profile"],lo=["begin","end"],po=["values","from","to","by"];function V2(t){if(!t||typeof t!=="string")return null;let a=t.match(/url\(\s*["']?#([^"')\s]+)\s*["']?\s*\)/);return a&&a[1]?a[1]:null}function l9(t){if(!t||typeof t!=="string")return null;if(t.startsWith("#")){let a=t.substring(1);return a&&!a.startsWith("#")?a:null}return null}function go(t){if(!t||typeof t!=="string")return[];let a=[],r=t.split(";");for(let e of r){let o=e.trim();if(o.startsWith("#")){let i=o.substring(1);if(i)a.push(i)}let n=V2(o);if(n)a.push(n)}return a}function co(t){if(!t||typeof t!=="string")return[];let a=[],r=t.split(";");for(let e of r){let o=e.trim().match(/^([a-zA-Z_][a-zA-Z0-9_-]*)\.(begin|end|click|mousedown|mouseup|mouseover|mouseout|mousemove|mouseenter|mouseleave|focusin|focusout|activate|repeat)(?:[+-]\d+(?:\.\d+)?[a-z]*)?/);if(o)a.push(o[1])}return a}function p0(t){if(!t||typeof t!=="string")return[];let a=[],r=/url\(\s*["']?#([^"')]+)["']?\s*\)/g,e;while((e=r.exec(t))!==null)if(e[1])a.push(e[1]);return a}function mo(t){if(!t||typeof t!=="string")return[];let a=[],r=/getElementById\(\s*["']([^"']+)["']\s*\)/g,e;while((e=r.exec(t))!==null)if(e[1])a.push(e[1]);let o=/querySelector(?:All)?\(\s*["']#([^"'#\s]+)["']\s*\)/g;while((e=o.exec(t))!==null)if(e[1])a.push(e[1]);return a}function yo(t){if(!t||typeof t!=="object"||!(t instanceof I3))throw TypeError("collectElementReferences: el must be a valid SVGElement");if(typeof t.getAttributeNames!=="function")throw TypeError("collectElementReferences: el must have getAttributeNames method");let a={static:new Set,animation:new Set,css:new Set,js:new Set},r=t.tagName?.toLowerCase()||"",e=io.includes(r),o=t.getAttributeNames();if(!Array.isArray(o))throw TypeError("collectElementReferences: getAttributeNames must return an array");for(let n of o){let i=t.getAttribute(n);if(!i)continue;if(n9.includes(n)){let l=l9(i);if(l)if(e)a.animation.add(l);else a.static.add(l)}if(i9.includes(n)||n==="style"){let l=V2(i);if(l)a.static.add(l);if(n==="style")p0(i).forEach((d)=>a.css.add(d))}if(lo.includes(n))co(i).forEach((l)=>a.animation.add(l));if(po.includes(n))go(i).forEach((l)=>a.animation.add(l));if(!i9.includes(n)&&i.includes("url(")){let l=V2(i);if(l)a.static.add(l)}}if(r==="animatemotion"){if(typeof t.getElementsByTagName!=="function")throw TypeError("collectElementReferences: el must have getElementsByTagName method");let n=t.getElementsByTagName("mpath");if(!n||typeof n[Symbol.iterator]!=="function")throw TypeError("collectElementReferences: getElementsByTagName must return an iterable");for(let i of n){if(!i||typeof i.getAttribute!=="function")continue;for(let l of n9){let d=i.getAttribute(l),p=l9(d);if(p)a.animation.add(p)}}}return a}function so(t){if(!t||typeof t!=="object"||!(t instanceof I3))throw TypeError("collectAllReferences: root must be a valid SVGElement");let a={all:new Set,static:new Set,animation:new Set,css:new Set,js:new Set,details:new Map},r={animation:4,js:3,css:2,static:1},e=(n,i,l)=>{if(a.all.add(n),a[i].add(n),!a.details.has(n))a.details.set(n,{sources:[],type:i});else{let d=a.details.get(n);if(r[i]>r[d.type])d.type=i}a.details.get(n).sources.push(l)},o=(n,i="")=>{let l=n.tagName?.toLowerCase()||"",d=i?`${i}>${l}`:l,p=n.getAttribute("id"),g=p?`${l}#${p}`:d,c=yo(n);if(c.static.forEach((m)=>e(m,"static",g)),c.animation.forEach((m)=>e(m,"animation",g)),c.css.forEach((m)=>e(m,"css",g)),c.js.forEach((m)=>e(m,"js",g)),l==="style"){let m=n.textContent||"";p0(m).forEach((y)=>e(y,"css","<style>"))}if(l==="script"){let m=n.textContent||"";mo(m).forEach((y)=>e(y,"js","<script>"))}if(n.children&&typeof n.children[Symbol.iterator]==="function"){for(let m of n.children)if(m instanceof I3)o(m,d)}};return o(t),a}E.set({precision:80});var m4=(t)=>t instanceof E?t:new E(t),xo={precision:6,curveSegments:20,clipSegments:64,bezierArcs:8,resolveUse:!0,resolveMarkers:!0,resolvePatterns:!0,resolveMasks:!0,resolveClipPaths:!0,flattenTransforms:!0,bakeGradients:!0,removeUnusedDefs:!0,preserveIds:!1,svg2Polyfills:!1,e2eTolerance:"1e-10"};function v5(t,a={}){if(t===null||t===void 0)throw Error("flattenSVG: svgString parameter is required");if(typeof t!=="string")throw Error(`flattenSVG: svgString must be a string, got ${typeof t}`);if(t.trim().length===0)throw Error("flattenSVG: svgString cannot be empty");let r={...xo,...a},e={useResolved:0,markersResolved:0,patternsResolved:0,masksResolved:0,clipPathsApplied:0,transformsFlattened:0,gradientsProcessed:0,defsRemoved:0,errors:[],verifications:{transforms:[],matrices:[],polygons:[],gradients:[],e2e:[],passed:0,failed:0,allPassed:!0},clipOutsideFragments:[]};try{let o=F3(t);if(o.tagName.toLowerCase()!=="svg")throw Error("Root element must be <svg>");let n=d5(o),i=r.removeUnusedDefs?Co(o):null;if(r.resolveUse){let l=Do(o,n,r);e.useResolved=l.count,e.errors.push(...l.errors),n=d5(o)}if(r.resolveMarkers){let l=ho(o,n,r);e.markersResolved=l.count,e.errors.push(...l.errors)}if(r.resolvePatterns){let l=So(o,n,r);e.patternsResolved=l.count,e.errors.push(...l.errors)}if(r.resolveMasks){let l=Eo(o,n,r);e.masksResolved=l.count,e.errors.push(...l.errors)}if(r.resolveClipPaths){let l=bo(o,n,r,e);e.clipPathsApplied=l.count,e.errors.push(...l.errors)}if(r.flattenTransforms){let l=Po(o,r,e);e.transformsFlattened=l.count,e.errors.push(...l.errors)}if(r.bakeGradients){let l=Ao(o,r,e);e.gradientsProcessed=l.count,e.errors.push(...l.errors)}if(r.removeUnusedDefs&&i){let l=fo(o,i);e.defsRemoved=l.count}return{svg:L4(o),stats:e}}catch(o){return e.errors.push(`Pipeline error: ${o.message}`),{svg:t,stats:e}}}var h6=new Set(["animate","animatetransform","animatemotion","animatecolor","set"]),S6=new Set(["foreignobject","audio","video","iframe","script","style",...h6]);function U2(t){if(!t)return!1;let a=t.tagName?.toLowerCase();if(S6.has(a))return!0;for(let r of t.children||[])if(r&&r.tagName&&U2(r))return!0;return!1}function Do(t,a,r){if(!t||!t.getElementsByTagName)throw Error("resolveAllUseElements: invalid root element");if(!a||!(a instanceof Map))throw Error("resolveAllUseElements: defsMap must be a Map");if(!r||typeof r!=="object")throw Error("resolveAllUseElements: opts must be an object");let e=[],o=0,n=t.getElementsByTagName("use"),i={};for(let[l,d]of a.entries())if(d.tagName.toLowerCase()==="symbol")i[l]=wr(d),i[l].type="symbol";else i[l]=l0(d);for(let l of[...n])try{let d=l.getAttribute("href")||l.getAttribute("xlink:href");if(!d)continue;let p=d.replace(/^#/,""),g=a.get(p);if(!g){e.push(`use: referenced element #${p} not found`);continue}let c=U2(g),m=U2(l);if(c||m){let x=g.cloneNode(!0),D=parseFloat(l.getAttribute("x")||"0"),S=parseFloat(l.getAttribute("y")||"0");if(isNaN(D)||isNaN(S)){e.push(`use: invalid x/y coordinates for element #${p}`);continue}let P=l.getAttribute("transform")||"",T="";if(P)T=P;if(D!==0||S!==0){let B=`translate(${D}, ${S})`;T=T?`${T} ${B}`:B}let f=new I3("g",{});if(T)f.setAttribute("transform",T);let X=I5(l);for(let[B,L]of Object.entries(X))if(L&&!f.hasAttribute(B))f.setAttribute(B,L);if(g.tagName.toLowerCase()==="symbol"){for(let B of x.children||[])if(B&&B.tagName)f.appendChild(B.cloneNode(!0))}else x.removeAttribute("id"),f.appendChild(x);for(let B of l.children||[])if(B&&B.tagName){let L=B.tagName.toLowerCase();if(h6.has(L))f.appendChild(B.cloneNode(!0))}if(l.parentNode)l.parentNode.replaceChild(f,l),o++;continue}let y=Nr(l),h=m6(y,i,{samples:r.curveSegments});if(!h){e.push(`use: failed to resolve #${p}`);continue}let s=Lr(h,r.curveSegments);if(s){let x=new I3("path",{d:s,...I5(l)});if(h.style){for(let[D,S]of Object.entries(h.style))if(S&&!x.hasAttribute(D))x.setAttribute(D,S)}if(l.parentNode)l.parentNode.replaceChild(x,l),o++}}catch(d){e.push(`use: ${d.message}`)}return{count:o,errors:e}}function ho(t,a,r){if(!t||!t.getElementsByTagName)throw Error("resolveAllMarkers: invalid root element");if(!a||!(a instanceof Map))throw Error("resolveAllMarkers: defsMap must be a Map");if(!r||typeof r!=="object")throw Error("resolveAllMarkers: opts must be an object");let e=[],o=0,n=["marker-start","marker-mid","marker-end","marker"];for(let i of n){let l=$4(t,i);for(let d of l){if(d.tagName!=="path"&&d.tagName!=="line"&&d.tagName!=="polyline"&&d.tagName!=="polygon")continue;try{let p=Gr(d,Object.fromEntries(a));if(!p||p.length===0)continue;let g=Zr(p,r.precision);if(g){let c=new I3("path",{d:g,fill:d.getAttribute("stroke")||"currentColor"});if(d.parentNode){let m=d.nextSibling;if(m)d.parentNode.insertBefore(c,m);else d.parentNode.appendChild(c);o++}}for(let c of n)d.removeAttribute(c)}catch(p){e.push(`marker: ${p.message}`)}}}return{count:o,errors:e}}function So(t,a,r){if(!t||!t.getElementsByTagName)throw Error("resolveAllPatterns: invalid root element");if(!a||!(a instanceof Map))throw Error("resolveAllPatterns: defsMap must be a Map");if(!r||typeof r!=="object")throw Error("resolveAllPatterns: opts must be an object");let e=[],o=0,n=$4(t,"fill");for(let i of n){let l=i.getAttribute("fill");if(!l||!l.includes("url("))continue;let d=g5(l);if(!d)continue;let p=a.get(d);if(!p||p.tagName.toLowerCase()!=="pattern")continue;try{let g=p.getAttribute("patternUnits")||"objectBoundingBox",c=p.getAttribute("patternContentUnits")||"userSpaceOnUse",m=p.getAttribute("patternTransform");if(g!=="objectBoundingBox")e.push(`pattern ${d}: non-default patternUnits="${g}" may cause rendering issues`);if(c!=="userSpaceOnUse")e.push(`pattern ${d}: non-default patternContentUnits="${c}" may cause rendering issues`);if(m)e.push(`pattern ${d}: patternTransform present - complex transformation may cause rendering issues`);let y=E6(i);if(!y)continue;let h=Or(p),s=Fr(h,y,{samples:r.curveSegments});if(s){let x=new I3("g",{}),D=new I3("path",{d:s,fill:"#000"});if(x.appendChild(D),i.setAttribute("fill","none"),i.setAttribute("stroke",i.getAttribute("stroke")||"none"),i.parentNode)i.parentNode.insertBefore(x,i),o++}}catch(g){e.push(`pattern: ${g.message}`)}}return{count:o,errors:e}}function Eo(t,a,r){if(!t||!t.getElementsByTagName)throw Error("resolveAllMasks: invalid root element");if(!a||!(a instanceof Map))throw Error("resolveAllMasks: defsMap must be a Map");if(!r||typeof r!=="object")throw Error("resolveAllMasks: opts must be an object");let e=[],o=0,n=$4(t,"mask");for(let i of n){let l=i.getAttribute("mask");if(!l||!l.includes("url("))continue;let d=g5(l);if(!d)continue;let p=a.get(d);if(!p||p.tagName.toLowerCase()!=="mask")continue;try{let g=p.getAttribute("maskUnits")||"objectBoundingBox",c=p.getAttribute("maskContentUnits")||"userSpaceOnUse";if(g!=="objectBoundingBox")e.push(`mask ${d}: non-default maskUnits="${g}" may cause rendering issues`);if(c!=="userSpaceOnUse")e.push(`mask ${d}: non-default maskContentUnits="${c}" may cause rendering issues`);let m=E6(i);if(!m)continue;let y=Tr(p),h=Rr(y,m,{samples:r.curveSegments,opacityThreshold:0.5});if(h){let s=m5(i,r.precision);if(s){let x=t5(s,r.curveSegments),D=t5(h,r.curveSegments),S=b6(x,D);if(S&&S.length>2){let P=g6(S,r.precision);i.setAttribute("d",P),i.removeAttribute("mask"),o++}}}}catch(g){e.push(`mask: ${g.message}`)}}return{count:o,errors:e}}function bo(t,a,r,e){if(!t||!t.getElementsByTagName)throw Error("applyAllClipPaths: invalid root element");if(!a||!(a instanceof Map))throw Error("applyAllClipPaths: defsMap must be a Map");if(!r||typeof r!=="object")throw Error("applyAllClipPaths: opts must be an object");if(!e||typeof e!=="object")throw Error("applyAllClipPaths: stats must be an object");let o=[],n=0;if(!e.verifications.e2e)e.verifications.e2e=[];if(!e.clipOutsideFragments)e.clipOutsideFragments=[];let i=$4(t,"clip-path");for(let l of i){let d=l.getAttribute("clip-path");if(!d||!d.includes("url("))continue;let p=g5(d);if(!p)continue;let g=a.get(p),c=g?g.tagName.toLowerCase():"";if(!g||c!=="clippath")continue;try{if((g.getAttribute("clipPathUnits")||"userSpaceOnUse")==="objectBoundingBox")o.push(`clipPath ${p}: objectBoundingBox units require bbox-relative coordinate transformation`);let m=m5(l,r.precision);if(!m)continue;let y="";if(g.children&&g.children.length>0){for(let T of g.children)if(T&&T.tagName){let f=m5(T,r.precision);if(f)y+=(y?" ":"")+f}}if(!y)continue;let h=r.clipSegments||64,s=t5(m,h),x=t5(y,h),D=b6(s,x),S=s.map((T)=>({x:T.x instanceof E?T.x:m4(T.x),y:T.y instanceof E?T.y:m4(T.y)})),P=x.map((T)=>({x:T.x instanceof E?T.x:m4(T.x),y:T.y instanceof E?T.y:m4(T.y)}));if(D&&D.length>2){let T=D.map((R)=>({x:R.x instanceof E?R.x:m4(R.x),y:R.y instanceof E?R.y:m4(R.y)})),f=to(S,P,T);if(e.verifications.polygons.push({element:l.tagName,clipPathId:p,...f}),f.valid)e.verifications.passed++;else e.verifications.failed++,e.verifications.allPassed=!1;let X=oo(S,P);e.clipOutsideFragments.push({elementId:l.getAttribute("id")||`clip-${n}`,clipPathId:p,fragments:X,visible:!1});let B=r.e2eTolerance||"1e-10",L=no(S,T,X,B);if(e.verifications.e2e.push({element:l.tagName,clipPathId:p,type:"clip-area-conservation",...L}),L.valid)e.verifications.passed++;else e.verifications.failed++,e.verifications.allPassed=!1}if(D&&D.length>2){let T=g6(D,r.precision),f=l;if(l.tagName==="path")l.setAttribute("d",T);else{let X=new I3("path",{d:T,...I5(l)});if(l.parentNode)l.parentNode.replaceChild(X,l),f=X}f.removeAttribute("clip-path"),n++}}catch(m){o.push(`clipPath: ${m.message}`)}}return{count:n,errors:o}}function Po(t,a,r){if(!t||!t.getElementsByTagName)throw Error("flattenAllTransforms: invalid root element");if(!a||typeof a!=="object")throw Error("flattenAllTransforms: opts must be an object");if(!r||typeof r!=="object")throw Error("flattenAllTransforms: stats must be an object");let e=[],o=0,n=$4(t,"transform");for(let i of n){let l=i.getAttribute("transform");if(!l)continue;try{let d=B4(l),p=x6(d);if(r.verifications.matrices.push({element:i.tagName,transform:l,...p}),p.valid)r.verifications.passed++;else r.verifications.failed++,r.verifications.allPassed=!1;let g=m5(i,a.precision);if(!g){if(i.tagName==="g")To(i,d,a,r),i.removeAttribute("transform"),o++;continue}let c=[],m=t5(g,4);if(m&&m.length>0)c=m.slice(0,4).map((s)=>({x:s.x instanceof E?s.x:m4(s.x),y:s.y instanceof E?s.y:m4(s.y)}));let y=Z5(g,d,{precision:a.precision});for(let s=0;s<c.length;s++){let x=c[s],D=Jr(d,x.x,x.y);if(r.verifications.transforms.push({element:i.tagName,pointIndex:s,...D}),D.valid)r.verifications.passed++;else r.verifications.failed++,r.verifications.allPassed=!1}let h=i;if(i.tagName==="path")i.setAttribute("d",y);else{let s=new I3("path",{d:y,...I5(i)});for(let x of uo(i.tagName))s.removeAttribute(x);if(i.parentNode)i.parentNode.replaceChild(s,i),h=s}h.removeAttribute("transform"),o++}catch(d){e.push(`transform: ${d.message}`)}}return{count:o,errors:e}}function To(t,a,r,e){if(!t||!t.children)throw Error("propagateTransformToChildren: invalid group element");if(!a||!a.data)throw Error("propagateTransformToChildren: invalid matrix");if(!r||typeof r!=="object")throw Error("propagateTransformToChildren: opts must be an object");if(!e||typeof e!=="object")throw Error("propagateTransformToChildren: stats must be an object");for(let o of[...t.children]){if(!(o&&o.tagName))continue;if(o.tagName==="g"){let n=o.getAttribute("transform");if(n){let i=B4(n),l=a.mul(i);o.setAttribute("transform",p9(l))}else o.setAttribute("transform",p9(a))}else{let n=m5(o,r.precision);if(n){let i=o.getAttribute("transform"),l=a;if(i){let c=B4(i);l=a.mul(c)}let d=x6(l);if(e.verifications.matrices.push({element:o.tagName,context:"group-propagation",...d}),d.valid)e.verifications.passed++;else e.verifications.failed++,e.verifications.allPassed=!1;let p=Z5(n,l,{precision:r.precision}),g=o;if(o.tagName==="path")o.setAttribute("d",p);else{let c=new I3("path",{d:p,...I5(o)});t.replaceChild(c,o),g=c}g.removeAttribute("transform")}}}}function Ao(t,a,r){if(!t||!t.getElementsByTagName)throw Error("bakeAllGradientTransforms: invalid root element");if(!a||typeof a!=="object")throw Error("bakeAllGradientTransforms: opts must be an object");if(!r||typeof r!=="object")throw Error("bakeAllGradientTransforms: stats must be an object");let e=[],o=0,n=t.getElementsByTagName("linearGradient");for(let l of n){let d=l.getAttribute("gradientTransform");if(!d)continue;try{let p=B4(d),g=parseFloat(l.getAttribute("x1")||"0"),c=parseFloat(l.getAttribute("y1")||"0"),m=parseFloat(l.getAttribute("x2")||"1"),y=parseFloat(l.getAttribute("y2")||"0");if(isNaN(g)||isNaN(c)||isNaN(m)||isNaN(y)){e.push(`linearGradient: invalid coordinate values for gradient ${l.getAttribute("id")||"unknown"}`);continue}let[h,s]=l4(p,g,c),[x,D]=l4(p,m,y),S=ao({x1:g,y1:c,x2:m,y2:y},{x1:h.toNumber(),y1:s.toNumber(),x2:x.toNumber(),y2:D.toNumber()},p);if(r.verifications.gradients.push({gradientId:l.getAttribute("id")||"unknown",type:"linear",...S}),S.valid)r.verifications.passed++;else r.verifications.failed++,r.verifications.allPassed=!1;l.setAttribute("x1",h.toFixed(a.precision)),l.setAttribute("y1",s.toFixed(a.precision)),l.setAttribute("x2",x.toFixed(a.precision)),l.setAttribute("y2",D.toFixed(a.precision)),l.removeAttribute("gradientTransform"),o++}catch(p){e.push(`linearGradient: ${p.message}`)}}let i=t.getElementsByTagName("radialGradient");for(let l of i){let d=l.getAttribute("gradientTransform");if(!d)continue;try{let p=B4(d),g=parseFloat(l.getAttribute("cx")||"0.5"),c=parseFloat(l.getAttribute("cy")||"0.5"),m=parseFloat(l.getAttribute("fx")||g.toString()),y=parseFloat(l.getAttribute("fy")||c.toString()),h=parseFloat(l.getAttribute("r")||"0.5");if(isNaN(g)||isNaN(c)||isNaN(m)||isNaN(y)||isNaN(h)){e.push(`radialGradient: invalid coordinate/radius values for gradient ${l.getAttribute("id")||"unknown"}`);continue}if(h<=0){e.push(`radialGradient: radius must be positive for gradient ${l.getAttribute("id")||"unknown"}`);continue}let[s,x]=l4(p,g,c),[D,S]=l4(p,m,y),P=p.data[0][0].toNumber()*p.data[1][1].toNumber();if(Math.abs(P)<0.0000000001){e.push("radialGradient: matrix determinant too close to zero (degenerate transform)");continue}let T=Math.sqrt(Math.abs(P)),f=h*T;l.setAttribute("cx",s.toFixed(a.precision)),l.setAttribute("cy",x.toFixed(a.precision)),l.setAttribute("fx",D.toFixed(a.precision)),l.setAttribute("fy",S.toFixed(a.precision)),l.setAttribute("r",f.toFixed(a.precision)),l.removeAttribute("gradientTransform"),o++}catch(p){e.push(`radialGradient: ${p.message}`)}}return{count:o,errors:e}}function Co(t){if(!t||!t.getElementsByTagName)throw Error("collectAllReferences: invalid root element");let a=new Set,r=(e)=>{if(!e||!e.getAttributeNames)return;if(e.tagName&&e.tagName.toLowerCase()==="style"){let o=e.textContent||"";if(o)p0(o).forEach((n)=>a.add(n))}for(let o of e.getAttributeNames()){let n=e.getAttribute(o);if(!n)continue;if(n.includes("url(")){let i=g5(n);if(i)a.add(i)}if(o==="href"||o==="xlink:href"){let i=n.replace(/^#/,"");if(i&&i!==n)a.add(i)}}for(let o of e.children)if(o&&o.tagName)r(o)};return r(t),a}function fo(t,a){if(!t||!t.getElementsByTagName)throw Error("removeUnusedDefinitions: invalid root element");if(!a||!(a instanceof Set))throw Error("removeUnusedDefinitions: referencedIds must be a Set");let r=0;function e(n){if(!n||!n.getAttribute)return!1;let i=n.getAttribute("id");if(i&&a.has(i))return!0;for(let l of n.children||[])if(l&&l.tagName&&e(l))return!0;return!1}let o=t.getElementsByTagName("defs");for(let n of o)for(let i of[...n.children])if(i&&i.tagName){let l=i.tagName.toLowerCase();if(S6.has(l))continue;if(!e(i))n.removeChild(i),r++}return{count:r}}function m5(t,a){if(!t||!t.tagName)return null;if(typeof a!=="number"||isNaN(a)||a<0)throw Error(`getElementPathData: precision must be a non-negative number, got ${a}`);let r=t.tagName.toLowerCase();if(r==="path")return t.getAttribute("d");let e=(o,n=0)=>{let i=t.getAttribute(o);if(i===null)return n;let l=parseFloat(i);if(isNaN(l))throw Error(`getElementPathData: invalid numeric value "${i}" for attribute "${o}"`);return l};switch(r){case"rect":{let o=t.getAttribute("ry")!==null?e("ry"):null;return K9(e("x"),e("y"),e("width"),e("height"),e("rx"),o,!1,a)}case"circle":return Q9(e("cx"),e("cy"),e("r"),a);case"ellipse":return H9(e("cx"),e("cy"),e("rx"),e("ry"),a);case"line":return Z9(e("x1"),e("y1"),e("x2"),e("y2"),a);case"polyline":return K2(t.getAttribute("points")||"",a);case"polygon":return J9(t.getAttribute("points")||"",a);default:return null}}function E6(t){if(!t||!t.tagName)return null;let a=m5(t,6);if(!a)return null;try{let r=t5(a,10);if(!r||r.length===0)return null;let e=1/0,o=1/0,n=-1/0,i=-1/0;for(let l of r){if(!l||l.x===void 0&&l.y===void 0)continue;let d=l.x instanceof E?l.x.toNumber():typeof l.x==="number"?l.x:0,p=l.y instanceof E?l.y.toNumber():typeof l.y==="number"?l.y:0;if(isNaN(d)||isNaN(p))continue;if(d<e)e=d;if(p<o)o=p;if(d>n)n=d;if(p>i)i=p}if(e===1/0||n===-1/0||o===1/0||i===-1/0)return null;return{x:e,y:o,width:n-e,height:i-o}}catch{return null}}function I5(t){if(!t||!t.getAttribute)return{};let a=["stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","vector-effect","fill","fill-opacity","fill-rule","clip-path","mask","filter","opacity","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display","color","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","word-spacing","text-decoration","shape-rendering","text-rendering","image-rendering","color-rendering","paint-order","pointer-events","cursor","class","style","id"],r={};for(let e of a){let o=t.getAttribute(e);if(o!==null)r[e]=o}return r}function uo(t){if(!t||typeof t!=="string")return[];return{rect:["x","y","width","height","rx","ry"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],polyline:["points"],polygon:["points"],image:["x","y","width","height","href","xlink:href","preserveAspectRatio"]}[t.toLowerCase()]||[]}function p9(t){if(!t||!t.data||!Array.isArray(t.data))throw Error("matrixToTransform: invalid matrix");if(!t.data[0]||!t.data[1]||!t.data[0][0]||!t.data[0][1]||!t.data[0][2]||!t.data[1][0]||!t.data[1][1]||!t.data[1][2])throw Error("matrixToTransform: matrix is missing required elements");let a=t.data[0][0].toNumber(),r=t.data[1][0].toNumber(),e=t.data[0][1].toNumber(),o=t.data[1][1].toNumber(),n=t.data[0][2].toNumber(),i=t.data[1][2].toNumber();if(!isFinite(a)||!isFinite(r)||!isFinite(e)||!isFinite(o)||!isFinite(n)||!isFinite(i))throw Error("matrixToTransform: matrix contains non-finite values");return`matrix(${a} ${r} ${e} ${o} ${n} ${i})`}function b6(t,a){if(!t||t.length<3||!a||a.length<3)return t;if(Z2&&J5)try{return J5(t,a)}catch(e){}let r=[...t];for(let e=0;e<a.length;e++){if(r.length===0)break;let o=r;r=[];let n=a[e],i=a[(e+1)%a.length];for(let l=0;l<o.length;l++){let d=o[l],p=o[(l+1)%o.length],g=d9(d,n,i),c=d9(p,n,i);if(g){if(r.push(d),!c)r.push(g9(d,p,n,i))}else if(c)r.push(g9(d,p,n,i))}}return r}function d9(t,a,r){if(!t||t.x===void 0&&t.y===void 0)throw Error("isInsideEdge: invalid point");if(!a||a.x===void 0&&a.y===void 0)throw Error("isInsideEdge: invalid edgeStart");if(!r||r.x===void 0&&r.y===void 0)throw Error("isInsideEdge: invalid edgeEnd");let e=t.x instanceof E?t.x.toNumber():t.x||0,o=t.y instanceof E?t.y.toNumber():t.y||0,n=a.x instanceof E?a.x.toNumber():a.x||0,i=a.y instanceof E?a.y.toNumber():a.y||0,l=r.x instanceof E?r.x.toNumber():r.x||0,d=r.y instanceof E?r.y.toNumber():r.y||0;return(l-n)*(o-i)-(d-i)*(e-n)>=0}function g9(t,a,r,e){if(!t||t.x===void 0&&t.y===void 0)throw Error("lineIntersect: invalid p1");if(!a||a.x===void 0&&a.y===void 0)throw Error("lineIntersect: invalid p2");if(!r||r.x===void 0&&r.y===void 0)throw Error("lineIntersect: invalid p3");if(!e||e.x===void 0&&e.y===void 0)throw Error("lineIntersect: invalid p4");let o=t.x instanceof E?t.x.toNumber():t.x||0,n=t.y instanceof E?t.y.toNumber():t.y||0,i=a.x instanceof E?a.x.toNumber():a.x||0,l=a.y instanceof E?a.y.toNumber():a.y||0,d=r.x instanceof E?r.x.toNumber():r.x||0,p=r.y instanceof E?r.y.toNumber():r.y||0,g=e.x instanceof E?e.x.toNumber():e.x||0,c=e.y instanceof E?e.y.toNumber():e.y||0,m=(o-i)*(p-c)-(n-l)*(d-g);if(Math.abs(m)<0.0000000001)return{x:m4((o+i)/2),y:m4((n+l)/2)};let y=((o-d)*(p-c)-(n-p)*(d-g))/m;return{x:m4(o+y*(i-o)),y:m4(n+y*(l-n))}}var y5=new Set(["clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","dominant-baseline","fill","fill-opacity","fill-rule","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","letter-spacing","marker","marker-end","marker-mid","marker-start","paint-order","pointer-events","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-rendering","visibility","word-spacing","writing-mode"]),_5={animation:new Set(["animate","animateColor","animatecolor","animateMotion","animatemotion","animateTransform","animatetransform","set"]),descriptive:new Set(["desc","metadata","title"]),shape:new Set(["circle","ellipse","line","path","polygon","polyline","rect"]),structural:new Set(["defs","g","svg","symbol","use"]),paintServer:new Set(["hatch","linearGradient","lineargradient","meshGradient","meshgradient","pattern","radialGradient","radialgradient","solidColor","solidcolor"]),nonRendering:new Set(["clipPath","clippath","filter","linearGradient","lineargradient","marker","mask","pattern","radialGradient","radialgradient","solidColor","solidcolor","symbol"]),container:new Set(["a","defs","g","marker","mask","pattern","svg","switch","symbol"]),textContent:new Set(["altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","text","textPath","tref","tspan"]),filterPrimitive:new Set(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),lightSource:new Set(["feDistantLight","fePointLight","feSpotLight"])},e2={svg:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),g:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),defs:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view","meshgradient","meshGradient","hatch","solidcolor","solidColor"]),symbol:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),marker:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),clipPath:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","text","title","use"]),mask:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),pattern:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),a:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),switch:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","cursor","desc","ellipse","foreignObject","g","image","line","metadata","path","polygon","polyline","rect","set","svg","switch","text","title","use","view"]),text:new Set(["a","altGlyph","animate","animateColor","animateMotion","animateTransform","desc","metadata","set","textPath","title","tref","tspan"]),textPath:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),tspan:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),linearGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),radialGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),meshgradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshGradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshrow:new Set(["meshpatch"]),meshpatch:new Set(["stop"]),hatch:new Set(["animate","animateTransform","desc","hatchpath","hatchPath","metadata","script","set","style","title"]),hatchpath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),hatchPath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),filter:new Set(["animate","animateTransform","desc","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","metadata","set","title"]),feBlend:new Set(["animate","set"]),feColorMatrix:new Set(["animate","set"]),feComponentTransfer:new Set(["feFuncA","feFuncB","feFuncG","feFuncR"]),feComposite:new Set(["animate","set"]),feConvolveMatrix:new Set(["animate","set"]),feDiffuseLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feDisplacementMap:new Set(["animate","set"]),feDropShadow:new Set(["animate","set"]),feFlood:new Set(["animate","set"]),feFuncA:new Set(["animate","set"]),feFuncB:new Set(["animate","set"]),feFuncG:new Set(["animate","set"]),feFuncR:new Set(["animate","set"]),feGaussianBlur:new Set(["animate","set"]),feImage:new Set(["animate","set"]),feMerge:new Set(["feMergeNode"]),feMergeNode:new Set(["animate","set"]),feMorphology:new Set(["animate","set"]),feOffset:new Set(["animate","set"]),feSpecularLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feTile:new Set(["animate","set"]),feTurbulence:new Set(["animate","set"]),animate:new Set(["desc","metadata","title"]),animateColor:new Set(["desc","metadata","title"]),animateMotion:new Set(["desc","metadata","mpath","title"]),animateTransform:new Set(["desc","metadata","title"]),set:new Set(["desc","metadata","title"]),circle:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),ellipse:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),line:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),path:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polygon:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polyline:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),rect:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),image:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),use:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),title:new Set([]),desc:new Set([]),metadata:new Set([]),feDistantLight:new Set(["animate","set"]),fePointLight:new Set(["animate","set"]),feSpotLight:new Set(["animate","set"]),stop:new Set(["animate","set"]),solidColor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),solidcolor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),tref:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyph:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyphDef:new Set(["altGlyphItem"]),altGlyphItem:new Set(["glyphRef","altGlyphItem"]),glyph:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","title","use"]),glyphRef:new Set([]),foreignObject:new Set([]),style:new Set([]),script:new Set([]),view:new Set(["desc","metadata","title"]),mpath:new Set(["desc","metadata","title"])},Io={userAction:new Set([":hover",":active",":focus",":focus-within",":focus-visible"]),treeStructural:new Set([":root",":empty",":first-child",":last-child",":only-child",":first-of-type",":last-of-type",":only-of-type",":nth-child",":nth-last-child",":nth-of-type",":nth-last-of-type"]),link:new Set([":link",":visited",":any-link",":local-link",":target"]),input:new Set([":enabled",":disabled",":read-only",":read-write",":placeholder-shown",":default",":checked",":indeterminate",":valid",":invalid",":in-range",":out-of-range",":required",":optional"]),linguistic:new Set([":lang",":dir"]),functional:new Set([":not",":is",":where",":has"]),preventInlining:new Set([":hover",":active",":focus",":focus-within",":focus-visible",":visited",":target",":lang",":dir",":not",":is",":where",":has"])};E.set({precision:20,rounding:E.ROUND_HALF_UP});var P6={linear:[0,0,1,1],ease:[0.25,0.1,0.25,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]};function s2(t,a=3){if(t===null||t===void 0)throw Error("formatSplineValue: value parameter is required");if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("formatSplineValue: precision must be a non-negative finite number");let r=typeof t==="number"?t:parseFloat(t);if(!Number.isFinite(r))throw Error(`formatSplineValue: value must be a finite number, got ${t}`);let e=new E(t).toDecimalPlaces(a).toString();if(e.includes("."))e=e.replace(/\.?0+$/,"");if(e.startsWith("0."))e=e.substring(1);else if(e.startsWith("-0."))e="-"+e.substring(2);if(e===""||e==="."||e==="-0")e="0";return e}function d0(t){if(!t||typeof t!=="string")return[];return t.split(";").map((a)=>a.trim()).filter((a)=>a).map((a)=>{let r=a.split(/[\s,]+/).map((e)=>parseFloat(e)).filter((e)=>Number.isFinite(e));if(r.length!==4)throw Error(`parseKeySplines: invalid spline "${a}", expected 4 values, got ${r.length}`);return r})}function T6(t,a=3){if(!Array.isArray(t))throw Error("serializeKeySplines: splines must be an array");if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("serializeKeySplines: precision must be a non-negative finite number");return t.map((r,e)=>{if(!Array.isArray(r))throw Error(`serializeKeySplines: spline at index ${e} must be an array`);if(r.length!==4)throw Error(`serializeKeySplines: spline at index ${e} must have exactly 4 values, got ${r.length}`);return r.map((o)=>s2(o,a)).join(" ")}).join("; ")}function g0(t,a=0.001){if(!Array.isArray(t)||t.length!==4)return!1;if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("isLinearSpline: tolerance must be a non-negative finite number");let[r,e,o,n]=t;if(!Number.isFinite(r)||!Number.isFinite(e)||!Number.isFinite(o)||!Number.isFinite(n))return!1;return Math.abs(r)<a&&Math.abs(e)<a&&Math.abs(o-1)<a&&Math.abs(n-1)<a}function Ro(t){let a=d0(t);if(a.length===0)return!1;return a.every((r)=>g0(r))}function A6(t,a=0.01){if(!Array.isArray(t)||t.length!==4)return null;if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("identifyStandardEasing: tolerance must be a non-negative finite number");if(!t.every((r)=>Number.isFinite(r)))return null;for(let[r,e]of Object.entries(P6))if(t.every((o,n)=>Math.abs(o-e[n])<a))return r;return null}function C6(t,a={}){let r=a.precision??3,e=a.removeLinear!==!1,o=d0(t);if(o.length===0)return{value:null,allLinear:!1,standardEasings:[]};let n=o.every((l)=>g0(l)),i=o.map((l)=>A6(l)).filter(Boolean);if(n&&e)return{value:null,allLinear:!0,standardEasings:i};return{value:T6(o,r),allLinear:n,standardEasings:i}}function No(t){if(!t||typeof t!=="string")return[];return t.split(";").map((a)=>parseFloat(a.trim())).filter((a)=>Number.isFinite(a))}function wo(t,a=3){if(!Array.isArray(t))throw Error("serializeKeyTimes: times must be an array");if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("serializeKeyTimes: precision must be a non-negative finite number");if(t.length===0)return"";return t.map((r)=>s2(r,a)).join("; ")}function f6(t,a=3){if(t===null||t===void 0)throw Error("optimizeKeyTimes: keyTimes parameter is required");if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("optimizeKeyTimes: precision must be a non-negative finite number");let r=No(t);if(r.length===0)return t;return wo(r,a)}function _2(t,a=3){if(!t||typeof t!=="string")return t;if(typeof a!=="number"||a<0||!Number.isFinite(a))throw Error("optimizeAnimationValues: precision must be a non-negative finite number");let r=t.split(";");if(r.length===0)return t;return r.map((e)=>{let o=e.trim();if(o.startsWith("#")||o.includes("url("))return o;return o.split(/[\s,]+/).filter((n)=>n).map((n)=>{let i=parseFloat(n);if(!Number.isFinite(i))return n;return s2(i,a)}).join(" ")}).join("; ")}function vo(t,a={}){if(!t||typeof t!=="object")throw Error("optimizeElementTiming: el parameter must be a valid element");if(typeof t.getAttribute!=="function"||typeof t.setAttribute!=="function"||typeof t.removeAttribute!=="function")throw Error("optimizeElementTiming: el parameter must have getAttribute, setAttribute, and removeAttribute methods");let r=a.precision??3,e=a.removeLinearSplines!==!1,o=a.optimizeValues!==!1;if(typeof r!=="number"||r<0||!Number.isFinite(r))throw Error("optimizeElementTiming: options.precision must be a non-negative finite number");let n=[],i=!1,l=t.getAttribute("keySplines");if(l){let p=C6(l,{precision:r,removeLinear:e});if(p.allLinear&&e){if(t.getAttribute("calcMode")==="spline")t.setAttribute("calcMode","linear"),t.removeAttribute("keySplines"),n.push('Converted linear splines to calcMode="linear"'),i=!0}else if(p.value&&p.value!==l)t.setAttribute("keySplines",p.value),n.push(`keySplines: "${l}" -> "${p.value}"`),i=!0}let d=t.getAttribute("keyTimes");if(d){let p=f6(d,r);if(p!==d)t.setAttribute("keyTimes",p),n.push(`keyTimes: "${d}" -> "${p}"`),i=!0}if(o){let p=t.getAttribute("values");if(p){let g=_2(p,r);if(g!==p)t.setAttribute("values",g),n.push(`values: "${p}" -> "${g}"`),i=!0}}for(let p of["from","to","by"]){let g=t.getAttribute(p);if(g){let c=_2(g,r);if(c!==g)t.setAttribute(p,c),n.push(`${p}: "${g}" -> "${c}"`),i=!0}}return{modified:i,changes:n}}var Bo=["animate","animatetransform","animatemotion","animatecolor","set"];function Xo(t,a={}){if(!t||typeof t!=="object")throw Error("optimizeDocumentAnimationTiming: root parameter must be a valid element");let r=0,e=0,o=[],n=(i)=>{if(!i||typeof i!=="object")return;let l=i.tagName?.toLowerCase();if(!l)return;if(Bo.includes(l)){let p=vo(i,a);if(p.modified)r++,e+=p.changes.length,o.push({element:l,id:i.getAttribute("id")||null,changes:p.changes})}let d=i.children||[];for(let p of d)n(p)};return n(t),{elementsModified:r,totalChanges:e,details:o}}E.set({precision:80});var c0={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function Lo(t){if(typeof t!=="string")throw TypeError(`parseArcArgs: argsStr must be a string, got ${typeof t}`);let a=[],r=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,e=0,o=0;while(e<t.length){while(e<t.length&&/[\s,]/.test(t[e]))e++;if(e>=t.length)break;let n=o%7;if(n===3||n===4)if(t[e]==="0"||t[e]==="1")a.push(t[e]==="1"?1:0),e++,o++;else return null;else{r.lastIndex=e;let i=r.exec(t);if(i&&i.index===e)a.push(parseFloat(i[0])),e=r.lastIndex,o++;else e++}}return a}function G3(t){if(!t||typeof t!=="string")return[];let a=[],r=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,e;while((e=r.exec(t))!==null){let o=e[1],n=e[2].trim();if(o==="Z"||o==="z"){a.push({command:"Z",args:[]});let d=n.match(/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g);if(d&&d.length>=2){a.push({command:"M",args:[parseFloat(d[0]),parseFloat(d[1])]});for(let p=2;p+1<d.length;p+=2)a.push({command:"L",args:[parseFloat(d[p]),parseFloat(d[p+1])]})}continue}let i;if(o==="A"||o==="a"){if(i=Lo(n),i===null){console.warn(`Invalid arc command with malformed flags - skipping: ${o}${n}`);continue}for(let d=0;d<i.length;d+=7)if(d+6<i.length)i[d]=Math.abs(i[d]),i[d+1]=Math.abs(i[d+1])}else{let d=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;i=[];let p;while((p=d.exec(n))!==null)i.push(parseFloat(p[0]))}let l=c0[o];if(l===void 0){console.warn(`Unknown SVG path command '${o}' - skipping`);continue}if(l===0||i.length===0)a.push({command:o,args:[]});else for(let d=0;d<i.length;d+=l){let p=i.slice(d,d+l);if(p.length===l){let g=d>0&&(o==="M"||o==="m")?o==="M"?"L":"l":o;a.push({command:g,args:p})}else if(p.length>0)console.warn(`Incomplete ${o} command: expected ${l} args, got ${p.length} - remaining args dropped`)}}return a}function V4(t,a=3){if(typeof t!=="number")throw TypeError(`formatNumber: num must be a number, got ${typeof t}`);if(typeof a!=="number"||!Number.isInteger(a)||a<0)throw TypeError(`formatNumber: precision must be a non-negative integer, got ${a}`);if(!isFinite(t))return"0";if(t===0)return"0";let r=Math.pow(10,a),e=(Math.round(t*r)/r).toFixed(a);if(e.includes("."))e=e.replace(/\.?0+$/,"");if(e.startsWith("0."))e=e.substring(1);else if(e.startsWith("-0."))e="-"+e.substring(2);if(e===""||e==="."||e==="-.")e="0";return e}function S4(t,a,r){if(!t||typeof t!=="object")throw TypeError(`toAbsolute: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`toAbsolute: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("toAbsolute: cmd.args must be an array");if(typeof a!=="number"||!isFinite(a))throw TypeError(`toAbsolute: cx must be a finite number, got ${a}`);if(typeof r!=="number"||!isFinite(r))throw TypeError(`toAbsolute: cy must be a finite number, got ${r}`);let{command:e,args:o}=t;if(e===e.toUpperCase()){if(c0[e]===void 0)throw TypeError(`toAbsolute: unknown command '${e}'`);return t}let n=e.toUpperCase(),i=[...o];switch(e){case"m":case"l":case"t":if(i.length<2)throw RangeError(`toAbsolute: command ${e} requires at least 2 args, got ${i.length}`);i[0]+=a,i[1]+=r;break;case"h":if(i.length<1)throw RangeError(`toAbsolute: command ${e} requires at least 1 arg, got ${i.length}`);i[0]+=a;break;case"v":if(i.length<1)throw RangeError(`toAbsolute: command ${e} requires at least 1 arg, got ${i.length}`);i[0]+=r;break;case"c":if(i.length<6)throw RangeError(`toAbsolute: command ${e} requires at least 6 args, got ${i.length}`);i[0]+=a,i[1]+=r,i[2]+=a,i[3]+=r,i[4]+=a,i[5]+=r;break;case"s":case"q":if(i.length<4)throw RangeError(`toAbsolute: command ${e} requires at least 4 args, got ${i.length}`);i[0]+=a,i[1]+=r,i[2]+=a,i[3]+=r;break;case"a":if(i.length<7)throw RangeError(`toAbsolute: command ${e} requires at least 7 args, got ${i.length}`);i[5]+=a,i[6]+=r;break;default:throw TypeError(`toAbsolute: unsupported command '${e}' for conversion`)}return{command:n,args:i}}function u6(t,a,r){if(!t||typeof t!=="object")throw TypeError(`toRelative: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`toRelative: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("toRelative: cmd.args must be an array");if(typeof a!=="number"||!isFinite(a))throw TypeError(`toRelative: cx must be a finite number, got ${a}`);if(typeof r!=="number"||!isFinite(r))throw TypeError(`toRelative: cy must be a finite number, got ${r}`);let{command:e,args:o}=t;if(e===e.toLowerCase()&&e!=="z"){if(c0[e]===void 0)throw TypeError(`toRelative: unknown command '${e}'`);return t}if(e==="Z"||e==="z")return{command:"z",args:[]};let n=e.toLowerCase(),i=[...o];switch(e){case"M":case"L":case"T":if(i.length<2)throw RangeError(`toRelative: command ${e} requires at least 2 args, got ${i.length}`);i[0]-=a,i[1]-=r;break;case"H":if(i.length<1)throw RangeError(`toRelative: command ${e} requires at least 1 arg, got ${i.length}`);i[0]-=a;break;case"V":if(i.length<1)throw RangeError(`toRelative: command ${e} requires at least 1 arg, got ${i.length}`);i[0]-=r;break;case"C":if(i.length<6)throw RangeError(`toRelative: command ${e} requires at least 6 args, got ${i.length}`);i[0]-=a,i[1]-=r,i[2]-=a,i[3]-=r,i[4]-=a,i[5]-=r;break;case"S":case"Q":if(i.length<4)throw RangeError(`toRelative: command ${e} requires at least 4 args, got ${i.length}`);i[0]-=a,i[1]-=r,i[2]-=a,i[3]-=r;break;case"A":if(i.length<7)throw RangeError(`toRelative: command ${e} requires at least 7 args, got ${i.length}`);i[5]-=a,i[6]-=r;break;default:throw TypeError(`toRelative: unsupported command '${e}' for conversion`)}return{command:n,args:i}}function Oo(t,a,r,e=0.000001){if(!t||typeof t!=="object")throw TypeError(`lineToHV: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`lineToHV: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("lineToHV: cmd.args must be an array");if(typeof a!=="number"||!isFinite(a))throw TypeError(`lineToHV: cx must be a finite number, got ${a}`);if(typeof r!=="number"||!isFinite(r))throw TypeError(`lineToHV: cy must be a finite number, got ${r}`);if(typeof e!=="number"||!isFinite(e)||e<0)throw TypeError(`lineToHV: tolerance must be a non-negative finite number, got ${e}`);let{command:o,args:n}=t;if(o!=="L"&&o!=="l")return null;if(n.length<2)throw RangeError(`lineToHV: command ${o} requires at least 2 args, got ${n.length}`);let i=o==="L",l=i?n[0]:a+n[0],d=i?n[1]:r+n[1];if(Math.abs(d-r)<e)return i?{command:"H",args:[l]}:{command:"h",args:[l-a]};if(Math.abs(l-a)<e)return i?{command:"V",args:[d]}:{command:"v",args:[d-r]};return null}function ko(t,a,r,e,o,n=0.000001){if(!t||typeof t!=="object")throw TypeError(`lineToZ: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`lineToZ: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("lineToZ: cmd.args must be an array");if(typeof a!=="number"||!isFinite(a))throw TypeError(`lineToZ: cx must be a finite number, got ${a}`);if(typeof r!=="number"||!isFinite(r))throw TypeError(`lineToZ: cy must be a finite number, got ${r}`);if(typeof e!=="number"||!isFinite(e))throw TypeError(`lineToZ: startX must be a finite number, got ${e}`);if(typeof o!=="number"||!isFinite(o))throw TypeError(`lineToZ: startY must be a finite number, got ${o}`);if(typeof n!=="number"||!isFinite(n)||n<0)throw TypeError(`lineToZ: tolerance must be a non-negative finite number, got ${n}`);let{command:i,args:l}=t;if(i!=="L"&&i!=="l")return!1;if(l.length<2)throw RangeError(`lineToZ: command ${i} requires at least 2 args, got ${l.length}`);let d=i==="L",p=d?l[0]:a+l[0],g=d?l[1]:r+l[1];return Math.abs(p-e)<n&&Math.abs(g-o)<n}function Yo(t,a,r,e,o,n,i,l,d=0.5){let p={x0:t,y0:a,cp1x:r,cp1y:e,cp2x:o,cp2y:n,x3:i,y3:l,tolerance:d};for(let[h,s]of Object.entries(p))if(typeof s!=="number"||!isFinite(s))throw TypeError(`isCurveStraight: ${h} must be a finite number, got ${s}`);if(d<0)throw TypeError(`isCurveStraight: tolerance must be non-negative, got ${d}`);let g=(i-t)**2+(l-a)**2;if(g<0.0000000001){let h=Math.sqrt((r-t)**2+(e-a)**2),s=Math.sqrt((o-t)**2+(n-a)**2);return Math.max(h,s)<d}let c=Math.sqrt(g),m=Math.abs((l-a)*r-(i-t)*e+i*a-l*t)/c,y=Math.abs((l-a)*o-(i-t)*n+i*a-l*t)/c;return Math.max(m,y)<d}function Mo(t,a,r,e=0.5){if(!t||typeof t!=="object")throw TypeError(`straightCurveToLine: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`straightCurveToLine: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("straightCurveToLine: cmd.args must be an array");if(typeof a!=="number"||!isFinite(a))throw TypeError(`straightCurveToLine: cx must be a finite number, got ${a}`);if(typeof r!=="number"||!isFinite(r))throw TypeError(`straightCurveToLine: cy must be a finite number, got ${r}`);if(typeof e!=="number"||!isFinite(e)||e<0)throw TypeError(`straightCurveToLine: tolerance must be a non-negative finite number, got ${e}`);let{command:o,args:n}=t;if(o!=="C"&&o!=="c")return null;if(n.length<6)throw RangeError(`straightCurveToLine: command ${o} requires at least 6 args, got ${n.length}`);let i=o==="C",l=i?n[0]:a+n[0],d=i?n[1]:r+n[1],p=i?n[2]:a+n[2],g=i?n[3]:r+n[3],c=i?n[4]:a+n[4],m=i?n[5]:r+n[5];if(Yo(a,r,l,d,p,g,c,m,e))return i?{command:"L",args:[c,m]}:{command:"l",args:[c-a,m-r]};return null}function F2(t,a,r=3,e=!1){if(!t||typeof t!=="object")throw TypeError(`serializeCommand: cmd must be an object, got ${typeof t}`);if(typeof t.command!=="string")throw TypeError(`serializeCommand: cmd.command must be a string, got ${typeof t.command}`);if(!Array.isArray(t.args))throw TypeError("serializeCommand: cmd.args must be an array");if(a!==null&&typeof a!=="string")throw TypeError(`serializeCommand: prevCommand must be a string or null, got ${typeof a}`);if(typeof r!=="number"||!Number.isInteger(r)||r<0)throw TypeError(`serializeCommand: precision must be a non-negative integer, got ${r}`);if(typeof e!=="boolean")throw TypeError(`serializeCommand: prevLastArgHadDecimal must be a boolean, got ${typeof e}`);let{command:o,args:n}=t;if(o==="Z"||o==="z")return{str:"z",lastArgHadDecimal:!1};if(o==="A"||o==="a"){if(n.length<7)throw RangeError(`serializeCommand: arc command requires at least 7 args, got ${n.length}`);if(n.length>7)console.warn(`serializeCommand: arc command has ${n.length} args (expected 7) - only first 7 will be used`);let g=[V4(n[0],r),V4(n[1],r),V4(n[2],r),n[3]?"1":"0",n[4]?"1":"0",V4(n[5],r),V4(n[6],r)].join(" ");return{str:o+g,lastArgHadDecimal:g.includes(".")}}if(n.length===0)throw RangeError(`serializeCommand: command ${o} has empty args array (only Z/z should have no args)`);let i=n.map((g)=>V4(g,r)),l="";for(let g=0;g<i.length;g++){let c=i[g];if(g===0)l=c;else{let m=i[g-1].includes(".");if(c.startsWith("-"))l+=c;else if(c.startsWith(".")&&m)l+=c;else l+=" "+c}}let d=(i[i.length-1]||"").includes("."),p=o;if(a==="M"&&o==="L")p="";else if(a==="m"&&o==="l")p="";else if(a===o&&o!=="A"&&o!=="a")p="";if(p)return{str:p+l,lastArgHadDecimal:d};else{let g=i[0]||"";if(g.startsWith("-"))return{str:l,lastArgHadDecimal:d};else if(g.startsWith(".")&&e)return{str:l,lastArgHadDecimal:d};else return{str:" "+l,lastArgHadDecimal:d}}}function z3(t,a=3){if(!Array.isArray(t))throw TypeError(`serializePath: commands must be an array, got ${typeof t}`);if(typeof a!=="number"||!Number.isInteger(a)||a<0)throw TypeError(`serializePath: precision must be a non-negative integer, got ${a}`);if(t.length===0)return"";let r="",e=null,o=!1;for(let n of t){let{str:i,lastArgHadDecimal:l}=F2(n,e,a,o);r+=i,e=n.command,o=l}return r}function I6(t,a={}){if(typeof t!=="string")throw TypeError(`convertPathData: d must be a string, got ${typeof t}`);if(typeof a!=="object"||a===null||Array.isArray(a))throw TypeError(`convertPathData: options must be an object, got ${typeof a}`);let{floatPrecision:r=3,straightCurves:e=!0,lineShorthands:o=!0,convertToZ:n=!0,utilizeAbsolute:i=!0,straightTolerance:l=0.5}=a;if(typeof r!=="number"||!Number.isInteger(r)||r<0)throw TypeError(`convertPathData: floatPrecision must be a non-negative integer, got ${r}`);if(typeof e!=="boolean")throw TypeError(`convertPathData: straightCurves must be a boolean, got ${typeof e}`);if(typeof o!=="boolean")throw TypeError(`convertPathData: lineShorthands must be a boolean, got ${typeof o}`);if(typeof n!=="boolean")throw TypeError(`convertPathData: convertToZ must be a boolean, got ${typeof n}`);if(typeof i!=="boolean")throw TypeError(`convertPathData: utilizeAbsolute must be a boolean, got ${typeof i}`);if(typeof l!=="number"||!isFinite(l)||l<0)throw TypeError(`convertPathData: straightTolerance must be a non-negative finite number, got ${l}`);let d=t.length,p=G3(t);if(p.length===0)return{d:t,originalLength:d,optimizedLength:d,savings:0};let g=0,c=0,m=0,y=0,h=[];for(let x=0;x<p.length;x++){let D=p[x];if(D.command==="A"||D.command==="a"){if(D.args.length<7)console.warn(`Arc command has insufficient args (${D.args.length} < 7) - skipping optimization`);else if(D.args[0]===0||D.args[1]===0){let P=D.command==="A",T=D.args[5],f=D.args[6];D=P?{command:"L",args:[T,f]}:{command:"l",args:[T,f]}}}if(e&&(D.command==="C"||D.command==="c")){let P=Mo(D,g,c,l);if(P)D=P}if(o&&(D.command==="L"||D.command==="l")){let P=Oo(D,g,c);if(P)D=P}if(n&&(D.command==="L"||D.command==="l")){if(ko(D,g,c,m,y))D={command:"z",args:[]}}if(i&&D.command!=="Z"&&D.command!=="z"){let P=S4(D,g,c),T=u6(D,g,c),f=F2(P,null,r);D=F2(T,null,r).str.length<f.str.length?T:P}h.push(D);let S=S4(D,g,c);switch(S.command){case"M":if(S.args.length>=2)g=S.args[0],c=S.args[1],m=g,y=c;break;case"L":case"T":if(S.args.length>=2)g=S.args[0],c=S.args[1];break;case"H":if(S.args.length>=1)g=S.args[0];break;case"V":if(S.args.length>=1)c=S.args[0];break;case"C":if(S.args.length>=6)g=S.args[4],c=S.args[5];break;case"S":case"Q":if(S.args.length>=4)g=S.args[2],c=S.args[3];break;case"A":if(S.args.length>=7)g=S.args[5],c=S.args[6];break;case"Z":g=m,c=y;break;default:break}}let s=z3(h,r);return{d:s,originalLength:d,optimizedLength:s.length,savings:d-s.length}}function Vo(t,a={}){if(!t||typeof t!=="object")throw TypeError(`optimizeDocumentPaths: root must be a DOM element object, got ${typeof t}`);if(typeof a!=="object"||a===null||Array.isArray(a))throw TypeError(`optimizeDocumentPaths: options must be an object, got ${typeof a}`);let r=0,e=0,o=[],n=(i)=>{if(!i||typeof i!=="object")return;if(i.tagName?.toLowerCase()==="path"){let l=i.getAttribute("d");if(l){let d=I6(l,a);if(d.savings>0)i.setAttribute("d",d.d),r++,e+=d.savings,o.push({id:i.getAttribute("id")||null,originalLength:d.originalLength,optimizedLength:d.optimizedLength,savings:d.savings})}}for(let l of i.children||[])n(l)};return n(t),{pathsOptimized:r,totalSavings:e,details:o}}function R6(t,a,r){if(!t||typeof t.x!=="number"||typeof t.y!=="number")throw TypeError("perpendicularDistance: point must be an object with numeric x and y properties");if(!a||typeof a.x!=="number"||typeof a.y!=="number")throw TypeError("perpendicularDistance: lineStart must be an object with numeric x and y properties");if(!r||typeof r.x!=="number"||typeof r.y!=="number")throw TypeError("perpendicularDistance: lineEnd must be an object with numeric x and y properties");if(!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(r.x)||!Number.isFinite(r.y))throw RangeError("perpendicularDistance: all coordinates must be finite numbers");let e=r.x-a.x,o=r.y-a.y,n=e*e+o*o;if(n<0.0000000001){let d=t.x-a.x,p=t.y-a.y;return Math.sqrt(d*d+p*p)}let i=Math.abs(o*t.x-e*t.y+r.x*a.y-r.y*a.x),l=Math.sqrt(n);return i/l}function r2(t,a){if(!Array.isArray(t))throw TypeError("douglasPeucker: points must be an array");if(t.length===0)throw RangeError("douglasPeucker: points array cannot be empty");for(let i=0;i<t.length;i++){let l=t[i];if(!l||typeof l!=="object")throw TypeError(`douglasPeucker: point at index ${i} must be an object`);if(typeof l.x!=="number"||!Number.isFinite(l.x))throw TypeError(`douglasPeucker: point at index ${i} must have a finite numeric x property`);if(typeof l.y!=="number"||!Number.isFinite(l.y))throw TypeError(`douglasPeucker: point at index ${i} must have a finite numeric y property`)}if(typeof a!=="number"||!Number.isFinite(a))throw TypeError("douglasPeucker: tolerance must be a finite number");if(a<0)throw RangeError("douglasPeucker: tolerance cannot be negative");if(a>0&&a<0.0000000001)throw RangeError("douglasPeucker: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(t.length<=2)return t;if(t.length>1e4)return Uo(t,a);let r=0,e=0,o=t[0],n=t[t.length-1];for(let i=1;i<t.length-1;i++){let l=R6(t[i],o,n);if(l>r)r=l,e=i}if(r>a){let i=r2(t.slice(0,e+1),a),l=r2(t.slice(e),a);return i.slice(0,-1).concat(l)}else return[o,n]}function Uo(t,a){if(t.length<=2)return t;let r=Array(t.length).fill(!1);r[0]=!0,r[t.length-1]=!0;let e=[[0,t.length-1]];while(e.length>0){let[o,n]=e.pop();if(n-o<=1)continue;let i=0,l=o,d=t[o],p=t[n];for(let g=o+1;g<n;g++){let c=R6(t[g],d,p);if(c>i)i=c,l=g}if(i>a)r[l]=!0,e.push([o,l]),e.push([l,n])}return t.filter((o,n)=>r[n])}function N6(t,a){if(!Array.isArray(t))throw TypeError("visvalingamWhyatt: points must be an array");if(t.length===0)throw RangeError("visvalingamWhyatt: points array cannot be empty");for(let l=0;l<t.length;l++){let d=t[l];if(!d||typeof d!=="object")throw TypeError(`visvalingamWhyatt: point at index ${l} must be an object`);if(typeof d.x!=="number"||!Number.isFinite(d.x))throw TypeError(`visvalingamWhyatt: point at index ${l} must have a finite numeric x property`);if(typeof d.y!=="number"||!Number.isFinite(d.y))throw TypeError(`visvalingamWhyatt: point at index ${l} must have a finite numeric y property`)}if(typeof a!=="number"||!Number.isFinite(a))throw TypeError("visvalingamWhyatt: minArea must be a finite number");if(a<0)throw RangeError("visvalingamWhyatt: minArea cannot be negative");if(t.length<=2)return t;let r=(l,d,p)=>{return Math.abs((d.x-l.x)*(p.y-l.y)-(p.x-l.x)*(d.y-l.y))/2},e=t.map((l,d)=>({...l,index:d})),o=Array(e.length).fill(1/0);for(let l=1;l<e.length-1;l++)o[l]=r(e[l-1],e[l],e[l+1]);let n=Array(e.length).fill(!0),i=e.length;while(i>2){let l=1/0,d=-1;for(let c=1;c<e.length-1;c++)if(n[c]&&o[c]<l)l=o[c],d=c;if(l>=a||d===-1)break;n[d]=!1,i--;let p=d-1;while(p>=0&&!n[p])p--;let g=d+1;while(g<e.length&&!n[g])g++;if(p>0){let c=p-1;while(c>=0&&!n[c])c--;if(c>=0&&g<e.length)o[p]=r(e[c],e[p],e[g])}if(g<e.length-1){let c=g+1;while(c<e.length&&!n[c])c++;if(c<e.length&&p>=0)o[g]=r(e[p],e[g],e[c])}}return e.filter((l,d)=>n[d])}function w6(t,a,r="douglas-peucker"){if(!Array.isArray(t))throw TypeError("simplifyPolyline: points must be an array");if(t.length===0)throw RangeError("simplifyPolyline: points array cannot be empty");if(typeof a!=="number"||!Number.isFinite(a))throw TypeError("simplifyPolyline: tolerance must be a finite number");if(a<0)throw RangeError("simplifyPolyline: tolerance cannot be negative");if(a>0&&a<0.0000000001)throw RangeError("simplifyPolyline: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(typeof r!=="string")throw TypeError("simplifyPolyline: algorithm must be a string");let e=["douglas-peucker","visvalingam"];if(!e.includes(r))throw RangeError(`simplifyPolyline: algorithm must be one of: ${e.join(", ")}`);if(r==="visvalingam")return N6(t,a*a);return r2(t,a)}function _o(t){if(!Array.isArray(t))throw TypeError("extractPolylinePoints: commands must be an array");let a=[],r=0,e=0,o=0,n=0;for(let i of t){if(!i||typeof i!=="object")throw TypeError("extractPolylinePoints: each command must be an object");if(typeof i.command!=="string")throw TypeError('extractPolylinePoints: each command must have a string "command" property');if(!Array.isArray(i.args))throw TypeError('extractPolylinePoints: each command must have an "args" array');let{command:l,args:d}=i,p=(c)=>{if(d.length<c)throw RangeError(`extractPolylinePoints: command "${l}" requires at least ${c} arguments, got ${d.length}`)},g=(c)=>{if(typeof d[c]!=="number"||!Number.isFinite(d[c]))throw TypeError(`extractPolylinePoints: command "${l}" argument at index ${c} must be a finite number, got ${d[c]}`)};switch(l){case"M":p(2),g(0),g(1),r=d[0],e=d[1],o=r,n=e,a.push({x:r,y:e});break;case"m":p(2),g(0),g(1),r+=d[0],e+=d[1],o=r,n=e,a.push({x:r,y:e});break;case"L":p(2),g(0),g(1),r=d[0],e=d[1],a.push({x:r,y:e});break;case"l":p(2),g(0),g(1),r+=d[0],e+=d[1],a.push({x:r,y:e});break;case"H":p(1),g(0),r=d[0],a.push({x:r,y:e});break;case"h":p(1),g(0),r+=d[0],a.push({x:r,y:e});break;case"V":p(1),g(0),e=d[0],a.push({x:r,y:e});break;case"v":p(1),g(0),e+=d[0],a.push({x:r,y:e});break;case"Z":case"z":if(r!==o||e!==n)a.push({x:o,y:n});r=o,e=n;break;case"C":p(6),g(4),g(5),r=d[4],e=d[5];break;case"c":p(6),g(4),g(5),r+=d[4],e+=d[5];break;case"S":case"Q":p(4),g(2),g(3),r=d[2],e=d[3];break;case"s":case"q":p(4),g(2),g(3),r+=d[2],e+=d[3];break;case"T":p(2),g(0),g(1),r=d[0],e=d[1];break;case"t":p(2),g(0),g(1),r+=d[0],e+=d[1];break;case"A":p(7),g(5),g(6),r=d[5],e=d[6];break;case"a":p(7),g(5),g(6),r+=d[5],e+=d[6];break;default:break}}return a}function Fo(t,a=!1){if(!Array.isArray(t))throw TypeError("rebuildPathFromPoints: points must be an array");if(t.length===0)return[];if(typeof a!=="boolean")throw TypeError("rebuildPathFromPoints: closed must be a boolean");for(let e=0;e<t.length;e++){let o=t[e];if(!o||typeof o!=="object")throw TypeError(`rebuildPathFromPoints: point at index ${e} must be an object`);if(typeof o.x!=="number"||!Number.isFinite(o.x))throw TypeError(`rebuildPathFromPoints: point at index ${e} must have a finite numeric x property`);if(typeof o.y!=="number"||!Number.isFinite(o.y))throw TypeError(`rebuildPathFromPoints: point at index ${e} must have a finite numeric y property`)}let r=[];r.push({command:"M",args:[t[0].x,t[0].y]});for(let e=1;e<t.length;e++)r.push({command:"L",args:[t[e].x,t[e].y]});if(a)r.push({command:"Z",args:[]});return r}function v6(t){if(!Array.isArray(t))throw TypeError("isPurePolyline: commands must be an array");let a=new Set(["M","m","L","l","H","h","V","v","Z","z"]);return t.every((r)=>{if(!r||typeof r!=="object"||typeof r.command!=="string")return!1;return a.has(r.command)})}function B6(t,a,r="douglas-peucker"){if(!Array.isArray(t))throw TypeError("simplifyPath: commands must be an array");if(typeof a!=="number"||!Number.isFinite(a))throw TypeError("simplifyPath: tolerance must be a finite number");if(a<0)throw RangeError("simplifyPath: tolerance cannot be negative");if(a>0&&a<0.0000000001)throw RangeError("simplifyPath: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(!v6(t)||t.length<3)return{commands:t,simplified:!1,originalPoints:0,simplifiedPoints:0};let e=_o(t),o=e.length;if(o<3)return{commands:t,simplified:!1,originalPoints:o,simplifiedPoints:o};let n=t[t.length-1].command.toLowerCase()==="z";if(n&&e.length>1){let d=e[0],p=e[e.length-1];if(Math.abs(p.x-d.x)<0.0000000001&&Math.abs(p.y-d.y)<0.0000000001)e=e.slice(0,-1)}let i=w6(e,a,r),l=i.length;if(l>=o)return{commands:t,simplified:!1,originalPoints:o,simplifiedPoints:o};return{commands:Fo(i,n),simplified:!0,originalPoints:o,simplifiedPoints:l}}function t4(t){if(typeof t!=="string")throw TypeError("Path d must be a string")}function a4(t){if(typeof t!=="number"||!Number.isFinite(t)||t<0)throw TypeError(`Precision must be a finite non-negative number, got ${t}`)}function G4(t){if(typeof t!=="number"||!Number.isFinite(t)||t<0)throw TypeError(`Tolerance must be a finite non-negative number, got ${t}`)}function e4(t,a=0){if(!t||typeof t!=="object")throw TypeError("Command must be an object");if(typeof t.command!=="string")throw TypeError("Command must have a string 'command' property");if(!Array.isArray(t.args))throw TypeError("Command must have an array 'args' property");if(t.args.length<a)throw TypeError(`Command ${t.command} requires at least ${a} args, got ${t.args.length}`);for(let r=0;r<t.args.length;r++)if(typeof t.args[r]!=="number"||!Number.isFinite(t.args[r]))throw TypeError(`Command ${t.command} arg[${r}] must be a finite number, got ${t.args[r]}`)}function X6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;r.forEach((o)=>e4(o));let e=r.map((o)=>({command:o.command,args:o.args.map((n)=>{let i=V4(n,a),l=parseFloat(i);if(!Number.isFinite(l))throw Error(`Invalid numeric value encountered: ${i}`);return l})}));return z3(e,a)}function L6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;return r.forEach((e)=>e4(e)),z3(r,a)}function O6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;r.forEach((d)=>e4(d));let e=0,o=0,n=0,i=0,l=[];for(let d of r){let p=u6(d,e,o);l.push(p);let g=S4(d,e,o);switch(g.command){case"M":e=g.args[0],o=g.args[1],n=e,i=o;break;case"L":case"T":e=g.args[0],o=g.args[1];break;case"H":e=g.args[0];break;case"V":o=g.args[0];break;case"C":e=g.args[4],o=g.args[5];break;case"S":case"Q":e=g.args[2],o=g.args[3];break;case"A":e=g.args[5],o=g.args[6];break;case"Z":e=n,o=i;break;default:break}}return z3(l,a)}function k6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;r.forEach((d)=>e4(d));let e=0,o=0,n=0,i=0,l=[];for(let d of r){let p=S4(d,e,o);switch(l.push(p),p.command){case"M":e=p.args[0],o=p.args[1],n=e,i=o;break;case"L":case"T":e=p.args[0],o=p.args[1];break;case"H":e=p.args[0];break;case"V":o=p.args[0];break;case"C":e=p.args[4],o=p.args[5];break;case"S":case"Q":e=p.args[2],o=p.args[3];break;case"A":e=p.args[5],o=p.args[6];break;case"Z":e=n,o=i;break;default:break}}return z3(l,a)}function Y6(t,a=0.000001,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((p)=>e4(p));let o=0,n=0,i=0,l=0,d=[];for(let p of e){let g=p;if(p.command==="L"||p.command==="l"){let m=p.command==="L",y=m?p.args[0]:o+p.args[0],h=m?p.args[1]:n+p.args[1];if(Math.abs(h-n)<a)g=m?{command:"H",args:[y]}:{command:"h",args:[y-o]};else if(Math.abs(y-o)<a)g=m?{command:"V",args:[h]}:{command:"v",args:[h-n]}}d.push(g);let c=S4(g,o,n);switch(c.command){case"M":o=c.args[0],n=c.args[1],i=o,l=n;break;case"L":case"T":o=c.args[0],n=c.args[1];break;case"H":o=c.args[0];break;case"V":n=c.args[0];break;case"C":o=c.args[4],n=c.args[5];break;case"S":case"Q":o=c.args[2],n=c.args[3];break;case"A":o=c.args[5],n=c.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(d,r)}function M6(t,a=0.000001,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((p)=>e4(p));let o=0,n=0,i=0,l=0,d=[];for(let p=0;p<e.length;p++){let g=e[p],c=g;if(g.command==="L"||g.command==="l"){let y=g.command==="L",h=y?g.args[0]:o+g.args[0],s=y?g.args[1]:n+g.args[1];if((p===e.length-1||e[p+1].command==="M"||e[p+1].command==="m")&&Math.abs(h-i)<a&&Math.abs(s-l)<a)c={command:"z",args:[]}}d.push(c);let m=S4(c,o,n);switch(m.command){case"M":o=m.args[0],n=m.args[1],i=o,l=n;break;case"L":case"T":o=m.args[0],n=m.args[1];break;case"H":o=m.args[0];break;case"V":n=m.args[0];break;case"C":o=m.args[4],n=m.args[5];break;case"S":case"Q":o=m.args[2],n=m.args[3];break;case"A":o=m.args[5],n=m.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(d,r)}function x5(...t){for(let a=0;a<t.length;a++)if(typeof t[a]!=="number"||!Number.isFinite(t[a]))throw TypeError(`Coordinate at position ${a} must be a finite number, got ${t[a]}`)}function V6(t){if(typeof t!=="number"||!Number.isFinite(t))throw TypeError(`Parameter t must be a finite number, got ${t}`);if(t<0||t>1)throw RangeError(`Parameter t must be in range [0, 1], got ${t}`)}function F5(t,a,r,e,o,n,i,l,d){V6(t),x5(a,r,e,o,n,i,l,d);let p=1-t,g=p*p,c=g*p,m=t*t,y=m*t;return{x:c*a+3*g*t*e+3*p*m*n+y*l,y:c*r+3*g*t*o+3*p*m*i+y*d}}function u2(t,a,r,e,o,n){x5(t,a,r,e,o,n);let i=o-r,l=n-e,d=i*i+l*l;if(d<0.0000000001)return Math.sqrt((t-r)**2+(a-e)**2);let p=Math.max(0,Math.min(1,((t-r)*i+(a-e)*l)/d)),g=r+p*i,c=e+p*l;return Math.sqrt((t-g)**2+(a-c)**2)}function jo(t,a,r,e,o,n,i,l){x5(t,a,r,e,o,n,i,l);let d=0,p=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9];for(let g of p){let c=F5(g,t,a,r,e,o,n,i,l),m=u2(c.x,c.y,t,a,i,l);if(m>d)d=m}for(let g=0;g<p.length-1;g++){let c=(p[g]+p[g+1])/2,m=F5(c,t,a,r,e,o,n,i,l),y=u2(m.x,m.y,t,a,i,l);if(y>d)d=y}for(let g of[0.05,0.95]){let c=F5(g,t,a,r,e,o,n,i,l),m=u2(c.x,c.y,t,a,i,l);if(m>d)d=m}return d}function Wo(t,a,r,e,o,n,i,l,d){return jo(t,a,r,e,o,n,i,l)<=d}function U6(t,a=0.5,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((p)=>e4(p));let o=0,n=0,i=0,l=0,d=[];for(let p of e){let g=p;if(p.command==="C"||p.command==="c"){let m=p.command==="C",y=m?p.args[0]:o+p.args[0],h=m?p.args[1]:n+p.args[1],s=m?p.args[2]:o+p.args[2],x=m?p.args[3]:n+p.args[3],D=m?p.args[4]:o+p.args[4],S=m?p.args[5]:n+p.args[5];if(Wo(o,n,y,h,s,x,D,S,a))g=m?{command:"L",args:[D,S]}:{command:"l",args:[D-o,S-n]}}d.push(g);let c=S4(g,o,n);switch(c.command){case"M":o=c.args[0],n=c.args[1],i=o,l=n;break;case"L":case"T":o=c.args[0],n=c.args[1];break;case"H":o=c.args[0];break;case"V":n=c.args[0];break;case"C":o=c.args[4],n=c.args[5];break;case"S":case"Q":o=c.args[2],n=c.args[3];break;case"A":o=c.args[5],n=c.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(d,r)}function _6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;return r.forEach((e)=>e4(e)),z3(r,a)}function F6(t,a=3){if(t4(t),a4(a),a>15)throw RangeError(`Precision ${a} is too large (max 15)`);let r=G3(t);if(r.length===0)return t;r.forEach((n)=>e4(n));let e=Math.pow(10,a),o=r.map((n)=>({command:n.command,args:n.args.map((i)=>Math.round(i*e)/e)}));return z3(o,a)}function j6(t,a=0.000001,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((p)=>e4(p));let o=0,n=0,i=0,l=0,d=[];for(let p of e){let g=S4(p,o,n),c=!0;switch(g.command){case"L":case"T":if(Math.abs(g.args[0]-o)<a&&Math.abs(g.args[1]-n)<a)c=!1;break;case"H":if(Math.abs(g.args[0]-o)<a)c=!1;break;case"V":if(Math.abs(g.args[0]-n)<a)c=!1;break;case"C":if(Math.abs(g.args[4]-o)<a&&Math.abs(g.args[5]-n)<a&&Math.abs(g.args[0]-o)<a&&Math.abs(g.args[1]-n)<a&&Math.abs(g.args[2]-o)<a&&Math.abs(g.args[3]-n)<a)c=!1;break;case"S":if(Math.abs(g.args[2]-o)<a&&Math.abs(g.args[3]-n)<a&&Math.abs(g.args[0]-o)<a&&Math.abs(g.args[1]-n)<a)c=!1;break;case"Q":if(Math.abs(g.args[2]-o)<a&&Math.abs(g.args[3]-n)<a&&Math.abs(g.args[0]-o)<a&&Math.abs(g.args[1]-n)<a)c=!1;break;case"A":if(Math.abs(g.args[5]-o)<a&&Math.abs(g.args[6]-n)<a||Math.abs(g.args[0])<a||Math.abs(g.args[1])<a)c=!1;break;default:break}if(c)switch(d.push(p),g.command){case"M":o=g.args[0],n=g.args[1],i=o,l=n;break;case"L":case"T":o=g.args[0],n=g.args[1];break;case"H":o=g.args[0];break;case"V":n=g.args[0];break;case"C":o=g.args[4],n=g.args[5];break;case"S":case"Q":o=g.args[2],n=g.args[3];break;case"A":o=g.args[5],n=g.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(d,r)}function Go(t,a,r,e,o,n,i){V6(t),x5(a,r,e,o,n,i);let l=1-t,d=l*l,p=t*t;return{x:d*a+2*l*t*e+p*n,y:d*r+2*l*t*o+p*i}}function zo(t,a,r,e,o,n,i,l,d,p){x5(t,a,r,e,o,n,i,l,d,p);let g=0,c=[0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95];for(let m of c){let y=F5(m,t,a,r,e,o,n,i,l),h=Go(m,t,a,d,p,i,l),s=Math.sqrt((y.x-h.x)**2+(y.y-h.y)**2);if(s>g)g=s}return g}function qo(t,a,r,e,o,n,i,l,d){x5(t,a,r,e,o,n,i,l),G4(d);let p=(3*(r+o)-t-i)/4,g=(3*(e+n)-a-l)/4;if(zo(t,a,r,e,o,n,i,l,p,g)<=d)return{cpx:p,cpy:g};return null}function W6(t,a=0.5,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((p)=>e4(p));let o=0,n=0,i=0,l=0,d=[];for(let p of e){let g=p;if(p.command==="C"||p.command==="c"){let m=p.command==="C",y=m?p.args[0]:o+p.args[0],h=m?p.args[1]:n+p.args[1],s=m?p.args[2]:o+p.args[2],x=m?p.args[3]:n+p.args[3],D=m?p.args[4]:o+p.args[4],S=m?p.args[5]:n+p.args[5],P=qo(o,n,y,h,s,x,D,S,a);if(P)g=m?{command:"Q",args:[P.cpx,P.cpy,D,S]}:{command:"q",args:[P.cpx-o,P.cpy-n,D-o,S-n]}}d.push(g);let c=S4(g,o,n);switch(c.command){case"M":o=c.args[0],n=c.args[1],i=o,l=n;break;case"L":case"T":o=c.args[0],n=c.args[1];break;case"H":o=c.args[0];break;case"V":n=c.args[0];break;case"C":o=c.args[4],n=c.args[5];break;case"S":case"Q":o=c.args[2],n=c.args[3];break;case"A":o=c.args[5],n=c.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(d,r)}function G6(t,a=0.000001,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((c)=>e4(c));let o=0,n=0,i=0,l=0,d=null,p=null,g=[];for(let c of e){let m=c,y=S4(c,o,n);if(y.command==="Q"&&d!==null){let h=2*o-d,s=2*n-p;if(Math.abs(y.args[0]-h)<a&&Math.abs(y.args[1]-s)<a)m=c.command==="Q"?{command:"T",args:[y.args[2],y.args[3]]}:{command:"t",args:[y.args[2]-o,y.args[3]-n]}}if(g.push(m),y.command==="Q")d=y.args[0],p=y.args[1];else if(y.command==="T")if(d!==null)d=2*o-d,p=2*n-p;else d=o,p=n;else d=null,p=null;switch(y.command){case"M":o=y.args[0],n=y.args[1],i=o,l=n;break;case"L":case"T":o=y.args[0],n=y.args[1];break;case"H":o=y.args[0];break;case"V":n=y.args[0];break;case"C":o=y.args[4],n=y.args[5];break;case"S":case"Q":o=y.args[2],n=y.args[3];break;case"A":o=y.args[5],n=y.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(g,r)}function z6(t,a=0.000001,r=3){t4(t),G4(a),a4(r);let e=G3(t);if(e.length===0)return t;e.forEach((c)=>e4(c));let o=0,n=0,i=0,l=0,d=null,p=null,g=[];for(let c of e){let m=c,y=S4(c,o,n);if(y.command==="C"&&d!==null){let h=2*o-d,s=2*n-p;if(Math.abs(y.args[0]-h)<a&&Math.abs(y.args[1]-s)<a)m=c.command==="C"?{command:"S",args:[y.args[2],y.args[3],y.args[4],y.args[5]]}:{command:"s",args:[y.args[2]-o,y.args[3]-n,y.args[4]-o,y.args[5]-n]}}if(g.push(m),y.command==="C")d=y.args[2],p=y.args[3];else if(y.command==="S")d=y.args[0],p=y.args[1];else d=null,p=null;switch(y.command){case"M":o=y.args[0],n=y.args[1],i=o,l=n;break;case"L":case"T":o=y.args[0],n=y.args[1];break;case"H":o=y.args[0];break;case"V":n=y.args[0];break;case"C":o=y.args[4],n=y.args[5];break;case"S":case"Q":o=y.args[2],n=y.args[3];break;case"A":o=y.args[5],n=y.args[6];break;case"Z":o=i,n=l;break;default:break}}return z3(g,r)}function q6(t,a=3){t4(t),a4(a);let r=G3(t);if(r.length===0)return t;r.forEach((o)=>e4(o));let e=r.map((o)=>{if(o.command==="A"||o.command==="a"){let n=[...o.args];if(n.length!==7)throw Error(`Arc command requires 7 arguments, got ${n.length}`);if(n[2]=(n[2]%360+360)%360,Math.abs(n[0]-n[1])<0.000001)n[2]=0;return n[3]=n[3]?1:0,n[4]=n[4]?1:0,{command:o.command,args:n}}return o});return z3(e,a)}var Z4=new Set(["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]),j2=new Set([...Z4].map((t)=>t.toLowerCase())),J4=new Set(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clip-path","clip-rule","clipPathUnits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentScriptType","contentStyleType","cursor","cx","cy","d","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","externalResourcesRequired","fill","fill-opacity","fill-rule","filter","filterRes","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","horiz-adv-x","horiz-origin-x","horiz-origin-y","href","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","onabort","onactivate","onbegin","onclick","onend","onerror","onfocusin","onfocusout","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onrepeat","onresize","onscroll","onunload","onzoom","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","title","to","transform","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","viewTarget","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:id","xml:lang","xml:space","xmlns","xmlns:xlink","y","y1","y2","yChannelSelector","z","zoomAndPan","line-height","marker"]),W2=new Set([...J4].map((t)=>t.toLowerCase())),Qo=new Set(["mesh","meshgradient","meshpatch","meshrow","solidcolor","hatch","hatchpath","discard","unknown","canvas","video","audio","iframe","source","track"]),Ho=new Set(["href","tabindex","lang","transform-origin","vector-effect","paint-order","pathLength","fr","side","crossorigin","role","aria-label","aria-labelledby","aria-describedby","aria-hidden","aria-controls","aria-expanded","aria-haspopup","aria-live","aria-atomic","aria-relevant","aria-busy","aria-owns"]),Ko=(t)=>{if(!t||typeof t!=="string")return!1;return Qo.has(t.toLowerCase())},Zo=(t)=>{if(!t||typeof t!=="string")return!1;let a=t.toLowerCase();return Ho.has(a)||a.startsWith("aria-")||a.startsWith("data-")},c9=new Set(["foreignobject","script","style","title","desc","metadata"]),j5=new Map,Jo=(t,a)=>{if(typeof t!=="string"||typeof a!=="string")throw Error("Both parameters must be strings");let r=`${t}|${a}`;if(j5.has(r))return j5.get(r);if(t.length===0)return a.length;if(a.length===0)return t.length;let e=[];for(let n=0;n<=a.length;n++)e[n]=[n];for(let n=0;n<=t.length;n++)e[0][n]=n;for(let n=1;n<=a.length;n++)for(let i=1;i<=t.length;i++){let l=t[i-1]===a[n-1]?0:1;e[n][i]=Math.min(e[n-1][i]+1,e[n][i-1]+1,e[n-1][i-1]+l)}let o=e[a.length][t.length];return j5.set(r,o),o},$o=()=>j5.clear(),n5=(t,a,r=2)=>{if(!t||typeof t!=="string")return null;if(!a||!(a instanceof Set)||a.size===0)return null;let e=typeof r!=="number"||r<0?2:r,o=t.toLowerCase(),n=null,i=e+1;for(let l of a){let d=Jo(o,l.toLowerCase());if(d>0&&d<i)i=d,n=l}return n};function v4(t){if(!t||typeof t!=="string")return!1;return/(%|em|rem|px|pt|cm|mm|in|pc|ex|ch|vw|vh|vmin|vmax|Q)$/i.test(t.trim())}function tn(t,a,r=100){let e=new Set,o=t,n=0;while(o!==null&&o!==void 0&&n<r){if(e.has(o))return!0;e.add(o),o=a(o),n++}return n>=r}function m9(t){if(!t||typeof t!=="string")return t||"";return t.replace(/<(script|style)([^>]*)\sdata-cdata-pending="true"([^>]*)>([\s\S]*?)<\/\1>/gi,(a,r,e,o,n)=>{let i=n.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),l=(e+o).replace(/\s*data-cdata-pending="true"\s*/g," ").trim(),d=l?" "+l:"";return`<${r}${d}><![CDATA[
|
|
17
|
-
${
|
|
18
|
-
]]></${r}>`})}var W5=/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g,R5=80,o2=6,Q6={BROWSER_MIN:2,BROWSER_TYPICAL:6,FLOAT32:7,FLOAT64:15,GEOGRAPHIC:8,SCIENTIFIC:20,MAX:80};E.set({precision:R5,rounding:E.ROUND_HALF_UP});var m0=(t)=>t instanceof E?t:new E(t);function Z(t){return t!==null&&typeof t==="object"&&typeof t.tagName==="string"&&typeof t.getAttribute==="function"&&typeof t.setAttribute==="function"}function H6(t,a=o2){if(t===null||t===void 0)return"0";let r=a;if(typeof a!=="number"||isNaN(a)||a<0)r=o2;if(r>R5)r=R5;let e=m0(t).toFixed(r);if(e.includes("."))return e.replace(/\.?0+$/,"");return e}function an(t){if(t===null||t===void 0)return"";return String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var L3={SVG_STRING:"string",DOM_ELEMENT:"dom",FILE_PATH:"file",URL:"url",XML_DOCUMENT:"xml",CSS_SELECTOR:"selector",OBJECT_ELEMENT:"object",EMBED_ELEMENT:"embed",IFRAME_ELEMENT:"iframe"},d4={SVG_STRING:"string",DOM_ELEMENT:"dom",XML_DOCUMENT:"xml"},o4={STRING:"string",FILE:"file",DOM_REPLACE:"dom_replace",DOM_UPDATE:"dom_update",DOWNLOAD:"download"};function y0(t){if(t===null||t===void 0)return o4.STRING;if(typeof t==="object"&&t.nodeType)return o4.DOM_UPDATE;if(typeof t==="string"){let a=t.trim();if(typeof document<"u"&&(a.startsWith("#")||a.startsWith(".")||a.startsWith("[")))return o4.DOM_REPLACE;if(a.includes("/")||a.includes("\\")||/\.\w+$/.test(a))return o4.FILE;if(a.toLowerCase()==="download")return o4.DOWNLOAD}return o4.STRING}async function K6(t,a=null,r={}){let e=y0(a),o;if(typeof t==="string")o=t;else o=L5(t,d4.SVG_STRING,r);switch(e){case o4.STRING:return o;case o4.FILE:{if(typeof process<"u"&&process.versions?.node){let n=await import("fs"),i=(await Promise.resolve().then(()=>(A5(),i5))).dirname(a);if(i&&i!=="."&&!n.existsSync(i))n.mkdirSync(i,{recursive:!0});n.writeFileSync(a,o,"utf8");return}throw Error("File saving requires Node.js environment")}case o4.DOM_REPLACE:{if(typeof document>"u")throw Error("DOM operations require browser environment");let n=document.querySelector(a);if(!n)throw Error(`No element found for selector: ${a}`);n.innerHTML=o;return}case o4.DOM_UPDATE:{if(typeof document>"u")throw Error("DOM operations require browser environment");if(a.tagName?.toLowerCase()==="svg"){let n=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;while(a.attributes.length>0)a.removeAttribute(a.attributes[0].name);for(let i of n.attributes)a.setAttribute(i.name,i.value);a.innerHTML=n.innerHTML}else a.innerHTML=o;return}case o4.DOWNLOAD:{if(typeof document>"u"||typeof Blob>"u")throw Error("Download requires browser environment");let n=new Blob([o],{type:"image/svg+xml"}),i=URL.createObjectURL(n),l=document.createElement("a");l.href=i,l.download=r.filename||"output.svg",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(i);return}default:return o}}function B5(t){if(t===null||t===void 0)throw Error("Input cannot be null or undefined");if(typeof t==="string"){let a=t.trim();if(a.startsWith("<"))return L3.SVG_STRING;else if(t.startsWith("http://")||t.startsWith("https://"))return L3.URL;else if(typeof document<"u"&&(a.startsWith("#")||a.startsWith(".")||a.startsWith("[")))return L3.CSS_SELECTOR;else return L3.FILE_PATH}if(typeof HTMLObjectElement<"u"&&t instanceof HTMLObjectElement)return L3.OBJECT_ELEMENT;if(typeof HTMLEmbedElement<"u"&&t instanceof HTMLEmbedElement)return L3.EMBED_ELEMENT;if(typeof HTMLIFrameElement<"u"&&t instanceof HTMLIFrameElement)return L3.IFRAME_ELEMENT;if(Z(t))return L3.DOM_ELEMENT;if(t&&t.nodeType===9)return L3.XML_DOCUMENT;return L3.SVG_STRING}async function X5(t,a){switch(a){case L3.SVG_STRING:return F3(t);case L3.DOM_ELEMENT:if(t&&typeof t.serialize==="function")return t;if(typeof XMLSerializer<"u"){let r=new XMLSerializer().serializeToString(t);return F3(r)}return t;case L3.XML_DOCUMENT:{let r=t.documentElement||t;if(r&&typeof r.serialize==="function")return r;if(typeof XMLSerializer<"u"){let e=new XMLSerializer().serializeToString(r);return F3(e)}return r}case L3.FILE_PATH:{let r=(()=>({})).readFileSync(t,"utf8");return F3(r)}if(typeof process<"u"&&process.versions?.node){let{readFileSync:r}=await import("fs"),e=r(t,"utf8");return F3(e)}throw Error("File loading requires Node.js environment");case L3.URL:if(typeof fetch<"u"){let r=await(await fetch(t)).text();return F3(r)}throw Error("URL loading requires fetch API");case L3.CSS_SELECTOR:if(typeof document<"u"){let r=document.querySelector(t);if(!r)throw Error(`No element found for selector: ${t}`);if(r.tagName.toLowerCase()==="svg")return F3(new XMLSerializer().serializeToString(r));let e=r.querySelector("svg");if(e)return F3(new XMLSerializer().serializeToString(e));throw Error(`Element "${t}" is not an SVG and contains no SVG`)}throw Error("CSS selector requires browser environment");case L3.OBJECT_ELEMENT:try{if(t.contentDocument&&t.contentDocument.documentElement){let r=t.contentDocument.documentElement;if(r.tagName.toLowerCase()==="svg")return F3(new XMLSerializer().serializeToString(r))}}catch(r){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${r.message}`);throw Error("HTMLObjectElement: SVG content not accessible (cross-origin or security error)")}throw Error("HTMLObjectElement: SVG content not accessible (not loaded or cross-origin)");case L3.EMBED_ELEMENT:if(typeof t.getSVGDocument==="function"){let r=t.getSVGDocument();if(r&&r.documentElement)return F3(new XMLSerializer().serializeToString(r.documentElement))}throw Error("HTMLEmbedElement: SVG content not accessible");case L3.IFRAME_ELEMENT:try{let r=t.contentDocument;if(r&&r.documentElement){let e=r.documentElement;if(e.tagName.toLowerCase()==="svg")return F3(new XMLSerializer().serializeToString(e))}}catch(r){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${r.message}`);throw Error("HTMLIFrameElement: SVG content not accessible (cross-origin)")}throw Error("HTMLIFrameElement: No SVG content found");default:throw Error(`Unknown input type: ${a}`)}}function L5(t,a,r={}){switch(a){case d4.SVG_STRING:{let e=L4(t,{minify:r.minify!==!1});return m9(e)}case d4.DOM_ELEMENT:return t;case d4.XML_DOCUMENT:return t;default:{let e=L4(t,{minify:r.minify!==!1});return m9(e)}}}function d3(t){return async function(a,r={}){let e=B5(a),o=await X5(a,e),n=r.outputFormat||(e===L3.DOM_ELEMENT?d4.DOM_ELEMENT:d4.SVG_STRING),i=await t(o,r);return L5(i,n,r)}}var s0=d3((t,a={})=>{let r=a.minify!==!1,e=a.remove!==!1,o=a.force||!1,n=a.preserve||[],i=a.preservePrefixes||[];if(!o){let f=t.querySelectorAll("script").length>0,X=Array.from(t.querySelectorAll("style")).some((B)=>B.textContent&&B.textContent.trim().length>0);if(f||X)return t}let l=(f)=>{if(n.includes(f))return!0;if(i.some((X)=>f.startsWith(X)))return!0;return!1},d=(f)=>{try{return decodeURI(f)}catch(X){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${X.message}`);return f}},p=so(t),g=new Set;for(let f of p.all)g.add(f),g.add(d(f));let c=new Map,m=(f)=>{let X=f.getAttribute("id");if(X){if(!c.has(X))c.set(X,f)}for(let B of f.children)if(Z(B))m(B)};m(t);let y=new Set,h=new Set,s=(f)=>{let X=f.getAttribute("id");if(X){if(y.has(X))h.add(X);y.add(X)}for(let B of f.children)if(Z(B))s(B)};s(t);let x=new Set,D=new Map,S=0,P=()=>{let f;do f=`a${S++}`;while(g.has(f)&&!c.has(f));return f},T=(f)=>{let X=f.getAttribute("id");if(X){if(h.has(X)){if(x.has(X)){f.removeAttribute("id");return}x.add(X)}let B=d(X),L=g.has(X)||g.has(B);if(l(X));else if(!L&&e)f.removeAttribute("id");else if(r&&L){let R=P();if(D.set(X,R),B!==X)D.set(B,R);f.setAttribute("id",R)}}for(let B of f.children)if(Z(B))T(B)};if(T(t),r){let f=(L)=>{let R=(N)=>N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(let N of L.getAttributeNames()){let u=L.getAttribute(N);if(u&&u.includes("url(#")){for(let[O,Y]of D){let j=R(O);u=u.replace(new RegExp(`url\\(#${j}\\)`,"g"),`url(#${Y})`);let _=R(encodeURI(O));u=u.replace(new RegExp(`url\\(#${_}\\)`,"g"),`url(#${Y})`)}L.setAttribute(N,u)}if((N==="href"||N==="xlink:href")&&u?.startsWith("#")){let O=u.substring(1),Y=d(O);if(D.has(O))L.setAttribute(N,`#${D.get(O)}`);else if(D.has(Y))L.setAttribute(N,`#${D.get(Y)}`)}if((N==="begin"||N==="end")&&u){for(let[O,Y]of D){let j=R(O);u=u.replace(new RegExp(`^${j}\\.`,"g"),`${Y}.`),u=u.replace(new RegExp(`;${j}\\.`,"g"),`;${Y}.`)}L.setAttribute(N,u)}if((N==="values"||N==="from"||N==="to"||N==="by")&&u){for(let[O,Y]of D){let j=R(O);u=u.replace(new RegExp(`#${j}([;\\s]|$)`,"g"),`#${Y}$1`)}L.setAttribute(N,u)}}for(let N of L.children)if(Z(N))f(N)};f(t);let X=(L)=>L.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=t.getElementsByTagName("style");for(let L of B){let R=L.textContent;if(!R)continue;for(let[N,u]of D){let O=X(N);R=R.replace(new RegExp(`#${O}([^\\w-]|$)`,"g"),`#${u}$1`),R=R.replace(new RegExp(`url\\(#${O}\\)`,"g"),`url(#${u})`)}L.textContent=R}}return t}),x2=d3((t,a={})=>{let r=a.precision||6,e=(n)=>{let i=parseFloat(n);if(isNaN(i))return n;let l=m0(i).toDecimalPlaces(r).toString();if(l.includes("."))l=l.replace(/0+$/,""),l=l.replace(/\.$/,"");return l},o=(n)=>{for(let i of n.getAttributeNames()){let l=n.getAttribute(i);if(i.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|stroke-width|font-size)$/)){if(v4(l))continue;n.setAttribute(i,e(l))}if(i==="d"&&l){let d=l.replace(W5,(p)=>e(p));n.setAttribute("d",d)}if(i==="transform"&&l){let d=l.replace(W5,(p)=>e(p));n.setAttribute("transform",d)}if(i==="points"&&l){let d=l.replace(W5,(p)=>e(p));n.setAttribute("points",d)}}for(let i of n.children)if(Z(i))o(i)};return o(t),t}),Z6=d3((t,a={})=>{let r=a.precision||6,e=(n)=>{let i=parseFloat(n);if(isNaN(i))return n;let l=m0(i).toDecimalPlaces(r).toString();if(l.includes("."))l=l.replace(/0+$/,""),l=l.replace(/\.$/,"");return l},o=(n)=>{for(let i of["points"]){let l=n.getAttribute(i);if(l){let d=l.replace(W5,e);n.setAttribute(i,d)}}for(let i of n.children)if(Z(i))o(i)};return o(t),t}),J6=d3((t,a={})=>{let r=["data-name","data-id","class"],e=["xmlns:serif"],o=(n)=>{for(let i of r)if(n.hasAttribute(i))n.removeAttribute(i);if(!a.preserveVendor){for(let i of e)if(n.hasAttribute(i))n.removeAttribute(i)}for(let i of n.children)if(Z(i))o(i)};return o(t),t}),$6=d3((t,a={})=>{let r=(e)=>{if(e.hasAttribute("enable-background"))e.removeAttribute("enable-background");for(let o of e.children)if(Z(o))r(o)};return r(t),t}),tt=d3((t,a={})=>{let r=Array.from(t.querySelectorAll("style")).some((D)=>{let S=D.textContent||"";return S.includes("@media")||S.includes(":hover")||S.includes(":focus")||S.includes(":active")||S.includes(":visited")||S.includes(":first-child")||S.includes(":last-child")||S.includes(":nth-child")||S.includes(":not(")}),e=t.querySelectorAll("script").length>0,o=new Set,n=t.outerHTML||"",i=n.matchAll(/url\(#([^)]+)\)/g);for(let D of i)o.add(D[1]);let l=n.matchAll(/xlink:href="#([^"]+)"/g);for(let D of l)o.add(D[1]);let d=n.matchAll(/\shref="#([^"]+)"/g);for(let D of d)o.add(D[1]);let p={clippath:"clipPath",textpath:"textPath",lineargradient:"linearGradient",radialgradient:"radialGradient",meshgradient:"meshGradient",hatchpath:"hatchPath",solidcolor:"solidColor",foreignobject:"foreignObject",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",animatemotion:"animateMotion",animatetransform:"animateTransform"},g=(D)=>p[D]||D,c=["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","tref","textPath","textpath","defs","clipPath","clippath","mask","pattern","linearGradient","lineargradient","radialGradient","radialgradient","meshGradient","meshgradient","meshrow","meshpatch","hatch","hatchpath","hatchPath","solidcolor","solidColor","stop","image","use","symbol","marker","title","desc","metadata","foreignObject","foreignobject","switch","a","filter","feBlend","feblend","feColorMatrix","fecolormatrix","feComponentTransfer","fecomponenttransfer","feComposite","fecomposite","feConvolveMatrix","feconvolvematrix","feDiffuseLighting","fediffuselighting","feDisplacementMap","fedisplacementmap","feDistantLight","fedistantlight","feDropShadow","fedropshadow","feFlood","feflood","feFuncA","fefunca","feFuncB","fefuncb","feFuncG","fefuncg","feFuncR","fefuncr","feGaussianBlur","fegaussianblur","feImage","feimage","feMerge","femerge","feMergeNode","femergenode","feMorphology","femorphology","feOffset","feoffset","fePointLight","fepointlight","feSpecularLighting","fespecularlighting","feSpotLight","fespotlight","feTile","fetile","feTurbulence","feturbulence","animate","animateMotion","animatemotion","animateTransform","animatetransform","set","mpath","view","cursor","style","script","font","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","glyph","missing-glyph","hkern","vkern"],m={fill:"#000","fill-opacity":"1","fill-rule":"nonzero",stroke:"none","stroke-width":"1","stroke-opacity":"1","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-dashoffset":"0",opacity:"1",visibility:"visible",display:"inline",clip:"auto","clip-path":"none","clip-rule":"nonzero",mask:"none","marker-start":"none","marker-mid":"none","marker-end":"none","stop-color":"#000","stop-opacity":"1","flood-color":"#000","flood-opacity":"1","lighting-color":"#fff","color-interpolation":"sRGB","color-interpolation-filters":"linearRGB","color-rendering":"auto","shape-rendering":"auto","text-rendering":"auto","image-rendering":"auto","paint-order":"normal","vector-effect":"none","text-anchor":"start","text-overflow":"clip","text-decoration":"none","dominant-baseline":"auto","alignment-baseline":"baseline","baseline-shift":"baseline","writing-mode":"lr-tb",direction:"ltr","unicode-bidi":"normal","letter-spacing":"normal","word-spacing":"normal","font-style":"normal","font-variant":"normal","font-weight":"normal","font-stretch":"normal","font-size":"medium","font-size-adjust":"none"},y={circle:{cx:"0",cy:"0"},ellipse:{cx:"0",cy:"0"},line:{x1:"0",y1:"0",x2:"0",y2:"0"},rect:{x:"0",y:"0",rx:"0",ry:"0"},image:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},svg:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},symbol:{preserveAspectRatio:"xMidYMid meet"},marker:{markerUnits:"strokeWidth",refX:"0",refY:"0",markerWidth:"3",markerHeight:"3"},linearGradient:{x1:"0",y1:"0",x2:"100%",y2:"0",spreadMethod:"pad"},radialGradient:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%",spreadMethod:"pad"},pattern:{x:"0",y:"0",patternUnits:"objectBoundingBox",patternContentUnits:"userSpaceOnUse"},clipPath:{clipPathUnits:"userSpaceOnUse"},mask:{maskUnits:"objectBoundingBox",maskContentUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},filter:{primitiveUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},feBlend:{mode:"normal"},feColorMatrix:{type:"matrix"},feComposite:{operator:"over",k1:"0",k2:"0",k3:"0",k4:"0"},feTurbulence:{baseFrequency:"0",numOctaves:"1",seed:"0",stitchTiles:"noStitch",type:"turbulence"},feDisplacementMap:{scale:"0",xChannelSelector:"A",yChannelSelector:"A"},feDistantLight:{azimuth:"0",elevation:"0"},fePointLight:{x:"0",y:"0",z:"0"},a:{target:"_self"},textPath:{startOffset:"0"}},h=(D)=>{if(D.startsWith("data-"))return!0;if(D.startsWith("aria-"))return!0;if(D==="role")return!0;if(D==="xmlns")return!0;if(D.includes(":")&&!D.startsWith("xml:")&&!D.startsWith("xlink:"))return!0;return!1},s=(D,S)=>{let P=D.parentNode;while(P&&Z(P)){let T=P.getAttribute(S);if(T!==null)return T;P=P.parentNode}return null},x=(D,S={})=>{if(D.tagName==="foreignObject")return;if(D.tagName.includes(":"))return;if(!D.getAttribute("id")){for(let[B,L]of Object.entries(m))if(!h(B)&&D.getAttribute(B)===L)D.removeAttribute(B);let X=y[D.tagName.toLowerCase()]||{};for(let[B,L]of Object.entries(X))if(!h(B)&&D.getAttribute(B)===L)D.removeAttribute(B);if(!r){for(let B of D.getAttributeNames())if(y5.has(B)&&!h(B)){let L=D.getAttribute(B),R=s(D,B);if(R!==null&&L===R)D.removeAttribute(B)}}}let P={...S};for(let X of y5){let B=D.getAttribute(X);if(B!==null)P[X]=B}let T=D.tagName.toLowerCase(),f=e2[T]||e2[g(T)];for(let X of[...D.children])if(Z(X)){if(X.tagName.includes(":"))continue;let B=X.tagName.toLowerCase(),L=X.getAttribute("id"),R=e&&L,N=(u)=>{let O=u.getAttribute("id");if(O&&o.has(O))return!0;for(let Y of u.children||[])if(Z(Y)&&N(Y))return!0;return!1};if(!c.includes(B)){if(!N(X)&&!R){D.removeChild(X);continue}}if(f&&!f.has(B)&&!f.has(g(B))){if(!N(X)&&!R){D.removeChild(X);continue}}x(X,P)}};return x(t,{}),t}),at=d3((t,a={})=>{let r=["x","y","width","height","viewBox"],e=(o)=>{if(o.tagName==="g"){for(let n of r)if(o.hasAttribute(n))o.removeAttribute(n)}for(let n of o.children)if(Z(n))e(n)};return e(t),t}),et=d3((t,a={})=>{let r=t.getElementsByTagName("defs");for(let e of[...r])if(e.children.length===0){if(e.parentNode)e.parentNode.removeChild(e)}return t}),D2=d3((t,a={})=>{let r=a.force||!1,e=t.querySelectorAll("script").length>0,o=new Set,n=(g)=>{for(let c of g.getAttributeNames()){let m=g.getAttribute(c);if(m&&m.includes("url(#")){let y=m.matchAll(/url\(#([^)]+)\)/g);for(let h of y)o.add(h[1])}if((c==="href"||c==="xlink:href")&&m&&m.startsWith("#"))o.add(m.substring(1))}for(let c of g.children)if(Z(c))n(c)};n(t);let i=(g)=>{let c=g.getAttribute("href")||g.getAttribute("xlink:href");if(c&&c.startsWith("#"))return!0;for(let m of g.getAttributeNames?g.getAttributeNames():[]){let y=g.getAttribute(m);if(y&&y.includes("url(#"))return!0}return!1},l=(g)=>{for(let c of g.children){if(!Z(c))continue;let m=c.tagName?.toLowerCase();if(_5.animation.has(m))return!0;if(l(c))return!0}return!1},d=(g)=>{let c=g.getAttribute("id");if(c&&(o.has(c)||e))return!0;for(let m of g.children){if(!Z(m))continue;if(d(m))return!0}return!1},p=(g,c=!1)=>{let m=g.tagName.toLowerCase(),y=c||m==="defs",h=g.getAttribute("display"),s=g.getAttribute("visibility"),x=parseFloat(g.getAttribute("opacity")||"1");if(h==="none"||s==="hidden"||x===0){if(!r&&d(g));else if(!r&&m==="marker");else if(!r&&(g.getAttribute("marker-start")||g.getAttribute("marker-mid")||g.getAttribute("marker-end")));else if(!r&&y&&_5.nonRendering.has(m));else if(!r&&_5.animation.has(m));else if(!r&&l(g));else if(!r&&m==="use");else if(!r&&i(g));else if(g.parentNode){g.parentNode.removeChild(g);return}}for(let D of[...g.children])if(Z(D))p(D,y)};return p(t),t}),rt=d3((t,a={})=>{let r=t.getElementsByTagName("text"),e=(i)=>{let l=i.textContent||"";if(i.children)for(let d of i.children)l+=e(d);return l},o=(i,l)=>{if(!l||l.length===0)return!1;return(i.getAttributeNames?i.getAttributeNames():[]).some((d)=>l.some((p)=>d.startsWith(p+":")))},n=a.preserveNamespaces||[];for(let i of[...r]){let l=e(i),d=!l||l.trim()==="",p=o(i,n);if(d&&!p){if(i.parentNode)i.parentNode.removeChild(i)}}return t}),h2=d3((t,a={})=>{let r=["g","defs","symbol","marker","clipPath","clippath","mask","pattern"],e=t.querySelectorAll("script").length>0,o=new Set,n=(l)=>{for(let d of l.getAttributeNames?l.getAttributeNames():[]){let p=l.getAttribute(d);if(p&&p.includes("url(#")){let g=p.matchAll(/url\(#([^)]+)\)/g);for(let c of g)o.add(c[1])}if((d==="href"||d==="xlink:href")&&p&&p.startsWith("#"))o.add(p.substring(1))}for(let d of l.children||[])if(Z(d))n(d)};n(t);let i=(l)=>{for(let g of[...l.children])if(Z(g))i(g);let d=l.tagName?.toLowerCase();if(!r.includes(l.tagName)&&!r.includes(d))return;if(l.getAttribute("href")||l.getAttribute("xlink:href"))return;let p=l.getAttribute("id");if(p&&(o.has(p)||e))return;if(l.children.length===0){if(l.parentNode)l.parentNode.removeChild(l)}};return i(t),t}),ot=d3((t,a={})=>{return t}),nt=d3((t,a={})=>{return t}),S2=d3((t,a={})=>{return t}),E2=d3((t,a={})=>{if(a.preserveVendor)return t;let r=t.getElementsByTagName("metadata");for(let e of[...r])if(e.parentNode)e.parentNode.removeChild(e);return t}),it=d3((t,a={})=>{let r=t.getElementsByTagName("title");for(let e of[...r])if(e.parentNode)e.parentNode.removeChild(e);return t}),lt=d3((t,a={})=>{let r=t.getElementsByTagName("desc");for(let e of[...r])if(e.parentNode)e.parentNode.removeChild(e);return t}),x0=d3((t,a={})=>{if(a.preserveVendor===!0)return t;let r=a.preserveNamespaces||[],e=new Set(r);if(e.has("sodipodi"))e.add("inkscape");if(e.has("inkscape"))e.add("sodipodi");let o=["inkscape","sodipodi","illustrator","sketch","ai","serif","vectornator","figma"].filter((p)=>!e.has(p));if(o.length===0)return t;let n=(p)=>{for(let g of[...p.children])if(Z(g)){let c=g.tagName.indexOf(":");if(c>0){let m=g.tagName.substring(0,c);if(o.includes(m)){p.removeChild(g);continue}}n(g)}};n(t);let i=(p)=>{for(let g of[...p.getAttributeNames()]){if(g.startsWith("xmlns:"))continue;let c=g.indexOf(":");if(c>0){let m=g.substring(0,c);if(o.includes(m))p.removeAttribute(g)}}for(let g of p.children)if(Z(g))i(g)};i(t);let l=new Set,d=(p)=>{for(let c of p.getAttributeNames()){if(c.startsWith("xmlns:"))continue;let m=c.indexOf(":");if(m>0){let y=c.substring(0,m);l.add(y)}}let g=p.tagName.indexOf(":");if(g>0)l.add(p.tagName.substring(0,g));for(let c of p.children)if(Z(c))d(c)};d(t);for(let p of o){let g=`xmlns:${p}`;if(t.hasAttribute(g)&&!l.has(p))t.removeAttribute(g)}return t}),pt=d3((t,a={})=>{let r=(e)=>{for(let o of[...e.getAttributeNames()]){let n=e.getAttribute(o);if(n===""||n===null)e.removeAttribute(o)}for(let o of e.children)if(Z(o))r(o)};return r(t),t}),dt=d3((t,a={})=>{let r=t.getAttribute("width"),e=t.getAttribute("height"),o=t.getAttribute("viewBox");if(v4(r)||v4(e))return t;if(r&&e&&o){let n=o.split(/[\s,]+/).map(parseFloat),i=parseFloat(r),l=parseFloat(e);if(isNaN(i)||isNaN(l)||n.some((p)=>isNaN(p)))return t;let d=0.000001;if(n.length===4&&Math.abs(n[0])<d&&Math.abs(n[1])<d&&Math.abs(n[2]-i)<d&&Math.abs(n[3]-l)<d)t.removeAttribute("viewBox")}return t}),gt=d3((t,a={})=>{let r=a.preserveSvgNamespace!==!1,e=a.removeXlinkNamespace!==!1;if(a.preserveVendor){if(!r)t.removeAttribute("xmlns");return t}if(!r)t.removeAttribute("xmlns");if(e){let o=!1,n=(i)=>{for(let l of i.getAttributeNames())if(l.startsWith("xlink:")){o=!0;return}for(let l of i.children){if(Z(l))n(l);if(o)return}};if(n(t),!o)t.removeAttribute("xmlns:xlink")}return t.removeAttribute("xmlns:svg"),t}),ct=d3((t,a={})=>{let r=t.querySelectorAll("script").length>0,e=new Set,o=(i)=>{for(let l of i.getAttributeNames()){let d=i.getAttribute(l);if(d&&d.includes("url(#")){let p=d.matchAll(/url\(#([^)]+)\)/g);for(let g of p)e.add(g[1])}if((l==="href"||l==="xlink:href")&&d&&d.startsWith("#"))e.add(d.substring(1))}for(let l of i.children)if(Z(l))o(l)};o(t);let n=t.getElementsByTagName("image");for(let i of[...n]){let l=i.getAttribute("id");if(l&&(e.has(l)||r))continue;if(i.parentNode)i.parentNode.removeChild(i)}return t}),mt=d3((t,a={})=>{let r=new Set,e=(n)=>{for(let i of n.getAttributeNames()){let l=n.getAttribute(i);if(l&&l.includes("url(#")){let d=l.matchAll(/url\(#([^)]+)\)/g);for(let p of d)r.add(p[1])}if((i==="href"||i==="xlink:href")&&l&&l.startsWith("#"))r.add(l.substring(1))}for(let i of n.children)if(Z(i))e(i)};e(t);let o=t.getElementsByTagName("script");for(let n of[...o]){let i=n.getAttribute("id");if(!i||!r.has(i)){if(n.parentNode)n.parentNode.removeChild(n)}}return t}),yt=d3((t,a={})=>{let r=a.precision||6,e=a.convertRoundedRects||!1,o=["rect","circle","ellipse","line","polyline","polygon"],n=(i)=>{if(o.includes(i.tagName)){if(i.tagName==="rect"){let d=parseFloat(i.getAttribute("x")||"0"),p=parseFloat(i.getAttribute("y")||"0"),g=parseFloat(i.getAttribute("width")||"0"),c=parseFloat(i.getAttribute("height")||"0");if(isNaN(d)||isNaN(p)||isNaN(g)||isNaN(c)){for(let m of[...i.children])if(Z(m))n(m);return}}if(i.tagName==="rect"&&!e){let d=parseFloat(i.getAttribute("rx")||"0"),p=parseFloat(i.getAttribute("ry")||"0");if(isNaN(d)||isNaN(p)||d>0||p>0){for(let g of[...i.children])if(Z(g))n(g);return}}if(i.tagName==="polyline"||i.tagName==="polygon"){if((i.getAttribute("points")||"").trim().split(/[\s,]+/).length<4){for(let d of[...i.children])if(Z(d))n(d);return}}let l=Qe(i,r);if(l){let d=new I3("path",{d:l});for(let p of i.getAttributeNames())if(!p.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|points)$/)){let g=i.getAttribute(p);if(g!==null)d.setAttribute(p,g)}for(let p of[...i.children])d.appendChild(p);if(i.parentNode)i.parentNode.replaceChild(d,i)}}for(let l of[...i.children])if(Z(l))n(l)};return n(t),t}),st=d3((t,a={})=>{let r=a.precision||6,e=a.force||!1,o=new Set,n=(l)=>{for(let d of["href","xlink:href"]){let p=l.getAttribute(d);if(p&&p.startsWith("#"))o.add(p.substring(1))}for(let d of l.children)if(Z(d))n(d)};n(t);let i=t.getElementsByTagName("path");for(let l of i){let d=l.getAttribute("d");if(!d)continue;let p=l.getAttribute("id");if(!e&&p&&o.has(p))continue;if(!e&&l.getAttribute("style"))continue;let g=l.getAttribute("stroke-linecap"),c=g&&g!=="butt";if((d.match(/[MmLlHhVvCcSsQqTtAaZz]/g)||[]).length<=1)continue;if(!e&&l.getAttribute("marker-mid"))continue;let m=qe(d);l.setAttribute("d",m)}return t}),xt=d3((t,a={})=>{let r=a.precision||6,e=a.force||!1,o=(n)=>{let i=n.getAttribute("transform");if(i){let l=B4(i),d=or(l,r);if(!e&&d.length>=i.length);else if(!e&&n.getAttribute("stroke")&&n.getAttribute("stroke")!=="none"){let p=l.data[0][0].toNumber(),g=l.data[0][1].toNumber(),c=l.data[1][0].toNumber(),m=l.data[1][1].toNumber(),y=p*m-g*c,h=Math.abs(p-m)<0.000001&&Math.abs(g+c)<0.000001,s=0.0000000001;if(!h&&Math.abs(y)>0.0000000001);else n.setAttribute("transform",d)}else n.setAttribute("transform",d)}for(let l of n.children)if(Z(l))o(l)};return o(t),t}),b2=d3((t,a={})=>{let r=["fill","stroke","stop-color","flood-color","lighting-color"],e=(n)=>{if(!n||typeof n!=="string")return n;let i={white:"#fff",black:"#000",red:"#f00",green:"#0f0",blue:"#00f",yellow:"#ff0",cyan:"#0ff",magenta:"#f0f"};if(i[n.toLowerCase()])return i[n.toLowerCase()];let l=n.match(/^#([0-9a-f]{6})$/i);if(l){let d=l[1];if(d[0]===d[1]&&d[2]===d[3]&&d[4]===d[5])return`#${d[0]}${d[2]}${d[4]}`}return n},o=(n)=>{for(let i of r){let l=n.getAttribute(i);if(l)n.setAttribute(i,e(l))}for(let i of n.children)if(Z(i))o(i)};return o(t),t}),D0=d3((t,a={})=>{let r=a.preserveVendor||!1,e=new Set(["alignment-baseline","baseline-shift","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","display","dominant-baseline","enable-background","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","kerning","letter-spacing","lighting-color","marker","marker-end","marker-mid","marker-start","mask","opacity","overflow","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","transform","transform-origin","unicode-bidi","vector-effect","visibility","word-spacing","writing-mode"]),o=(n)=>{let i=n.getAttribute("style");if(i){let l=i.split(";").map((p)=>p.trim()).filter((p)=>p),d=[];for(let p of l){let g=p.indexOf(":");if(g===-1)continue;let c=p.substring(0,g).trim(),m=p.substring(g+1).trim();if(c&&m){if(!c.startsWith("-")&&e.has(c))n.setAttribute(c,m);else if(r&&c.startsWith("-"))d.push(p)}}if(d.length>0)n.setAttribute("style",d.join("; "));else n.removeAttribute("style")}for(let l of n.children)if(Z(l))o(l)};return o(t),t}),Dt=d3((t,a={})=>{let r=t.getElementsByTagName("ellipse");for(let e of[...r]){let o=parseFloat(e.getAttribute("rx")||"0"),n=parseFloat(e.getAttribute("ry")||"0");if(isNaN(o)||isNaN(n))continue;if(Math.abs(o-n)<0.001){let i=new I3("circle",{});for(let l of e.getAttributeNames()){let d=e.getAttribute(l);if(l==="rx"||l==="ry")i.setAttribute("r",d);else i.setAttribute(l,d)}for(let l of[...e.children])i.appendChild(l);if(e.parentNode)e.parentNode.replaceChild(i,e)}}return t}),ht=d3((t,a={})=>{let r=a.force||!1,e=(o,n=!1,i=!1)=>{let l=o.tagName.toLowerCase(),d=i||l==="switch";for(let p of[...o.children])if(Z(p))e(p,!1,d);if(l!=="g")return;if(!r&&(n||d))return;if(!r&&o.getAttribute("filter"))return;if(o.children.length===1){let p=o.children[0];if(!Z(p))return;if(!r&&p.getAttribute("id"))return;let g=Array.from(o.children).some((y)=>Z(y)&&_5.animation.has(y.tagName.toLowerCase()));if(!r&&g)return;let c=o.getAttributeNames(),m=c.some((y)=>{if(y5.has(y))return!1;return p.hasAttribute(y)});if(!r&&m)return;if(c.length===0){if(o.parentNode)o.parentNode.replaceChild(p,o)}else{let y=!0;for(let h of c){if(!y5.has(h)&&h!=="class"&&h!=="style"){y=!1;break}if(p.hasAttribute(h)){y=!1;break}}if(y&&o.parentNode){for(let h of c){let s=o.getAttribute(h);if(s!==null)p.setAttribute(h,s)}o.parentNode.replaceChild(p,o)}}}};return e(t,!0),t}),St=d3((t,a={})=>{let r=a.force||!1,e=(n)=>n&&n.includes("url("),o=(n)=>{let i=[...n.children].filter((l)=>Z(l)&&l.tagName==="path");for(let l=0;l<i.length-1;l++){let d=i[l],p=i[l+1];if(!r&&(d.children.length>0||p.children.length>0))continue;let g=["marker-start","marker-mid","marker-end"].some((y)=>d.getAttribute(y)||p.getAttribute(y));if(!r&&g)continue;if(!r&&(d.getAttribute("clip-path")||d.getAttribute("mask")||p.getAttribute("clip-path")||p.getAttribute("mask")))continue;if(!r){let y=d.getAttribute("fill"),h=d.getAttribute("stroke"),s=p.getAttribute("fill"),x=p.getAttribute("stroke");if(e(y)||e(h)||e(s)||e(x))continue}if(!r){let y=d.getAttribute("fill-rule")||"nonzero",h=p.getAttribute("fill-rule")||"nonzero";if(y!==h)continue}if(!r&&(d.getAttribute("filter")||p.getAttribute("filter")))continue;let c=d.getAttributeNames().filter((y)=>y!=="d").sort(),m=p.getAttributeNames().filter((y)=>y!=="d").sort();if(JSON.stringify(c)===JSON.stringify(m)){let y=!0;for(let h of c)if(d.getAttribute(h)!==p.getAttribute(h)){y=!1;break}if(y){let h=d.getAttribute("d"),s=p.getAttribute("d");if(d.setAttribute("d",`${h} ${s}`),p.parentNode)p.parentNode.removeChild(p);i.splice(l+1,1),l--}}}for(let l of n.children)if(Z(l))o(l)};return o(t),t}),Et=d3((t,a={})=>{let r=(e)=>{if(e.tagName==="g")for(let o of[...e.getAttributeNames()]){if(!y5.has(o))continue;let n=e.getAttribute(o);if(n){for(let i of e.children)if(Z(i)&&!i.hasAttribute(o))i.setAttribute(o,n);e.removeAttribute(o)}}for(let o of e.children)if(Z(o))r(o)};return r(t),t}),bt=d3((t,a={})=>{let r=(e)=>{if(e.tagName==="g"&&e.children.length>1)for(let o of y5){let n=null,i=!0;for(let l of e.children){if(!Z(l))continue;let d=l.getAttribute(o);if(!d){i=!1;break}if(n===null)n=d;else if(n!==d){i=!1;break}}if(i&&n){e.setAttribute(o,n);for(let l of e.children)if(Z(l))l.removeAttribute(o)}}for(let o of e.children)if(Z(o))r(o)};return r(t),t}),h0=d3((t,a={})=>{if(t.getElementsByTagName("script").length>0&&!a.force)return t;let r=t.getElementsByTagName("style");for(let e of r){let o=e.textContent;if(!o||!o.trim())continue;let n=o.includes("<![CDATA[")||o.includes("]]>"),i="",l="";if(n){let d=o.match(/^(\s*<!\[CDATA\[\s*)/),p=o.match(/(\s*\]\]>\s*)$/);if(d)i="<![CDATA[",o=o.replace(/^\s*<!\[CDATA\[\s*/,"");if(p)l="]]>",o=o.replace(/\s*\]\]>\s*$/,"")}if(o=o.replace(/\/\*[\s\S]*?\*\//g,""),o=o.replace(/\s+/g," "),o=o.replace(/\s*([{}:;,])\s*/g,"$1"),o=o.trim(),i||l)o=i+o+l;e.textContent=o}return t}),Pt=d3((t,a={})=>{let r=a.onlyMatchedOnce!==!1,e=a.removeStyleElement!==!1,o=t.getElementsByTagName("style"),n=[];for(let i of o){let l=i.getAttribute("type");if(l&&l!=="text/css")continue;let d=i.textContent;if(!d||!d.trim())continue;if(d.includes("@media")||d.includes("@keyframes")||d.includes("@supports")||d.includes("@font-face"))continue;let p=d.match(/([^{]+)\{([^}]+)\}/g)||[],g=[];for(let y of p){let h=y.match(/([^{]+)\{([^}]+)\}/);if(!h)continue;let s=h[1].trim(),x=h[2].trim(),D=!1;for(let P of Io.preventInlining)if(s.includes(P)){D=!0;break}if(D){n.push(y);continue}let S;try{S=k2(s)}catch(P){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${P.message}`);n.push(y);continue}g.push({selector:s,declarations:x,specificity:S,originalRule:y})}g.sort((y,h)=>Y2(y.specificity,h.specificity));let c=new WeakMap,m=new Set;for(let{selector:y,declarations:h,specificity:s,originalRule:x}of g)try{let D=t.querySelectorAll(y);if(r&&y.startsWith("#")&&D.length>1){n.push(x);continue}for(let S of D){let P=S,T=!1;while(P){if(P.tagName==="foreignObject"){T=!0;break}P=P.parentNode}if(T)continue;if(!c.has(S))c.set(S,new Map),m.add(S);let f=c.get(S),X=S.getAttribute("style")||"";if(X&&f.size===0){let L=X.split(";");for(let R of L){let N=R.indexOf(":");if(N>0){let u=R.substring(0,N).trim(),O=R.substring(N+1).trim(),Y=O.includes("!important");if(Y)O=O.replace(/\s*!important\s*/g,"").trim();f.set(u,{specificity:[1,0,0,0],isImportant:Y,value:O})}}}let B=h.split(";");for(let L of B){let R=L.indexOf(":");if(R<=0)continue;let N=L.substring(0,R).trim(),u=L.substring(R+1).trim(),O=u.includes("!important");if(O)u=u.replace(/\s*!important\s*/g,"").trim();let Y=f.get(N);if(Y){let j=Y2(s,Y.specificity);if(j<0){if(O&&!Y.isImportant)f.set(N,{specificity:s,isImportant:O,value:u})}else if(j===0){if(O||!Y.isImportant)f.set(N,{specificity:s,isImportant:O,value:u})}else if(!Y.isImportant||O)f.set(N,{specificity:s,isImportant:O,value:u})}else f.set(N,{specificity:s,isImportant:O,value:u})}}}catch(D){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${D.message}`);n.push(x)}for(let y of m){let h=c.get(y),s=[];for(let[x,{value:D,isImportant:S}]of h)if(S)s.push(`${x}: ${D} !important`);else s.push(`${x}: ${D}`);y.setAttribute("style",s.join("; "))}if(e&&i.parentNode)if(n.length>0)i.textContent=n.join(`
|
|
19
|
-
`);else i.parentNode.removeChild(i)}return t}),Tt=d3((t,a={})=>{let r=(e)=>{let o=e.getAttributeNames().sort(),n=o.map((i)=>[i,e.getAttribute(i)]);for(let i of o)e.removeAttribute(i);for(let[i,l]of n)e.setAttribute(i,l);for(let i of e.children)if(Z(i))r(i)};return r(t),t}),At=d3((t,a={})=>{let r=t.getElementsByTagName("defs");for(let e of r){let o=[...e.children].filter((n)=>Z(n));o.sort((n,i)=>n.tagName.localeCompare(i.tagName));for(let n of[...e.children])e.removeChild(n);for(let n of o)e.appendChild(n)}return t}),Ct=d3((t,a={})=>{let r=a.threshold||2,e=t.getElementsByTagName("path"),o=new Map;for(let l of e){let d=l.getAttribute("d");if(d){if(!o.has(d))o.set(d,[]);o.get(d).push(l)}}let n=t.querySelector("defs");if(!n)if(n=new I3("defs",{}),t.firstChild)t.insertBefore(n,t.firstChild);else t.appendChild(n);let i=0;for(let[l,d]of o)if(d.length>=r){let p=`path${i++}`,g=new I3("path",{id:p,d:l});n.appendChild(g);for(let c of d){let m=new I3("use",{href:`#${p}`});for(let y of c.getAttributeNames())if(y!=="d"){let h=c.getAttribute(y);if(h!==null)m.setAttribute(y,h)}for(let y of[...c.children])m.appendChild(y);if(c.parentNode)c.parentNode.replaceChild(m,c)}}return t}),ft=d3((t,a={})=>{let r=t.getAttribute("viewBox");if(!r)return t;let e=Be(r);if(!e)return t;let o=d5(t),n=t.getElementsByTagName("path");for(let i of[...n]){let l=i.getAttribute("d");if(!l)continue;try{let d=g2(l),p=Oe(d);if(!p)continue;let g=a2(i),c=t2(i,g,o).getRenderedBBox(p),m={x:c.x,y:c.y,width:c.width,height:c.height};if(!ke(m,e)){if(i.parentNode)i.parentNode.removeChild(i)}}catch(d){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${d.message}`)}}return t}),ut=d3((t,a={})=>{let r=t.getElementsByTagName("style");for(let e of[...r])if(e.parentNode)e.parentNode.removeChild(e);return t}),It=d3((t,a={})=>{let r={new:"_blank",replace:"_self"},e=!1,o=(n)=>{for(let i of[...n.getAttributeNames()])if(i.startsWith("xlink:")){let l=i.substring(6),d=n.getAttribute(i);if(l==="href")e=!0;else if(l==="show"){if(!n.hasAttribute("target")){let p=r[d];if(p)n.setAttribute("target",p)}n.removeAttribute(i)}else if(l==="title"){if(!(n.querySelector&&n.querySelector("title"))&&d){let p=new I3("title",{},[],d);if(typeof n.insertBefore==="function"&&n.firstChild)n.insertBefore(p,n.firstChild);else if(typeof n.appendChild==="function")n.appendChild(p);else if(n.children&&Array.isArray(n.children))n.children.unshift(p),p.parentNode=n}n.removeAttribute(i)}else if(["actuate","type","role","arcrole"].includes(l))n.removeAttribute(i);else e=!0}for(let i of n.children)if(Z(i))o(i)};if(o(t),!e)t.removeAttribute("xmlns:xlink");return t}),Rt=d3((t,a={})=>{let r=a.attributes||{};for(let[e,o]of Object.entries(r))t.setAttribute(e,o);return t}),Nt=d3((t,a={})=>{let r=a.classes||[],e=t.getAttribute("class")||"",o=e?`${e} ${r.join(" ")}`:r.join(" ");return t.setAttribute("class",o.trim()),t}),wt=d3((t,a={})=>{let r=a.prefix||"svg",e=new Map,o=new Map,n=(p)=>p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=(p)=>{let g=p.getAttribute("id");if(g){let c=`${r}${g}`;e.set(g,c),p.setAttribute("id",c)}for(let c of p.children)if(Z(c))i(c)};if(i(t),a.prefixClassNames!==!1){let p=(c)=>{let m=c.getAttribute("class");if(m){for(let y of m.split(/\s+/))if(y&&!o.has(y))o.set(y,`${r}${y}`)}for(let y of c.children)if(Z(y))p(y)};p(t);let g=(c)=>{let m=c.getAttribute("class");if(m){let y=m.split(/\s+/).map((h)=>o.get(h)||h).join(" ");c.setAttribute("class",y)}for(let y of c.children)if(Z(y))g(y)};g(t)}let l=t.getElementsByTagName("style");for(let p of l){let g=p.textContent;if(!g)continue;for(let[c,m]of e){let y=n(c);g=g.replace(new RegExp(`#${y}([^\\w-]|$)`,"g"),`#${m}$1`),g=g.replace(new RegExp(`url\\(#${y}\\)`,"g"),`url(#${m})`)}if(a.prefixClassNames!==!1)for(let[c,m]of o){let y=n(c);g=g.replace(new RegExp(`\\.${y}([^\\w-]|$)`,"g"),`.${m}$1`)}p.textContent=g}let d=(p)=>{for(let g of p.getAttributeNames()){let c=p.getAttribute(g);if(c&&c.includes("url(#")){for(let[m,y]of e){let h=n(m);c=c.replace(new RegExp(`url\\(#${h}\\)`,"g"),`url(#${y})`)}p.setAttribute(g,c)}if((g==="href"||g==="xlink:href")&&c?.startsWith("#")){let m=c.substring(1);if(e.has(m))p.setAttribute(g,`#${e.get(m)}`)}if(g==="begin"||g==="end"){for(let[m,y]of e){let h=n(m);c=c.replace(new RegExp(`(^|;|\\s)${h}\\.`,"g"),`$1${y}.`)}p.setAttribute(g,c)}if(g==="values"||g==="from"||g==="to"||g==="by"){for(let[m,y]of e){let h=n(m);c=c.replace(new RegExp(`#${h}([;\\s]|$)`,"g"),`#${y}$1`)}p.setAttribute(g,c)}}for(let g of p.children)if(Z(g))d(g)};return d(t),t}),vt=d3((t,a={})=>{return t.removeAttribute("width"),t.removeAttribute("height"),t}),Bt=d3((t,a={})=>{let r=a.selector||"*",e=a.attributes||[];try{let o=t.querySelectorAll(r);for(let n of o)for(let i of e)if(n.hasAttribute(i))n.removeAttribute(i)}catch(o){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${o.message}`)}return t}),Xt=d3((t,a={})=>{let r=a.pattern?new RegExp(a.pattern):null,e=a.attrs||[],o=(n)=>{for(let i of[...n.getAttributeNames()])if(e.includes(i)||r&&r.test(i))n.removeAttribute(i);for(let i of n.children)if(Z(i))o(i)};return o(t),t}),Lt=d3((t,a={})=>{let{name:r,value:e}=a;if(!r)return t;let o=(n)=>{for(let i of[...n.children]){if(!Z(i))continue;let l=i.getAttribute(r);if(e===void 0){if(l!==null){n.removeChild(i);continue}}else if(l===e){n.removeChild(i);continue}o(i)}};return o(t),t}),S0=d3(async(t,a={})=>{let r={...a,outputFormat:d4.DOM_ELEMENT},e=t;return e=await E2(e,r),e=await S2(e,r),e=await h2(e,r),e=await D2(e,r),e=await x2(e,r),e=await b2(e,r),e=await D0(e,r),e=await x0(e,r),e=await s0(e,r),e=await h0(e,r),e}),E0=d3((t,a={})=>{return t}),Ot=d3(async(t,a={})=>{let r=a.preset||"default",e={...a,outputFormat:d4.DOM_ELEMENT};switch(r){case"default":return await S0(t,e);case"none":return await E0(t,e);default:return t}}),kt=d3(async(t,a={})=>{let r=a.config||{},e={...a,outputFormat:d4.DOM_ELEMENT},o=t;if(r.removeMetadata!==!1)o=await E2(o,e);if(r.removeComments!==!1)o=await S2(o,e);if(r.cleanupNumericValues!==!1)o=await x2(o,e);if(r.convertColors!==!1)o=await b2(o,e);if(r.removeHiddenElements!==!1)o=await D2(o,e);if(r.removeEmptyContainers!==!1)o=await h2(o,e);return o});function Yt(t={}){return{precision:t.precision||6,removeMetadata:t.removeMetadata!==!1,removeComments:t.removeComments!==!1,cleanupNumericValues:t.cleanupNumericValues!==!1,convertColors:t.convertColors!==!1,removeHiddenElements:t.removeHiddenElements!==!1,removeEmptyContainers:t.removeEmptyContainers!==!1,...t}}var Mt=d3(async(t,a={})=>{let r=L4(t,{minify:a.minify!==!1}),e=await v5(r,{...a,resolveClipPaths:!0,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return F3(e.svg)}),Vt=d3(async(t,a={})=>{let r=L4(t,{minify:a.minify!==!1}),e=await v5(r,{...a,resolveMasks:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,flattenTransforms:!1,removeUnusedDefs:!1});return F3(e.svg)}),Ut=d3((t,a={})=>{let r=d5(t),e=(p)=>{let g=r.get(p);if(!g)return null;let c=g.getAttribute("href")||g.getAttribute("xlink:href");return c?.startsWith("#")?c.substring(1):null},o=(p,g)=>{let c=p.getAttribute("gradientUnits")||"objectBoundingBox",m=p.getAttribute("gradientTransform");if(tn(g,e)){if(a.verbose)console.warn(`Circular gradient reference detected: #${g}`);return!1}if(c==="userSpaceOnUse")return!1;if(m)return!1;return!0},n=$4(t,"fill");for(let p of n){let g=p.getAttribute("fill");if(g&&g.includes("url(")){let c=g5(g);if(c&&r.has(c)){let m=r.get(c),y=m.tagName.toLowerCase();if(y==="lineargradient"||y==="radialgradient"){if(!o(m,c)){if(a.verbose)console.warn(`Skipping gradient flatten for ${c}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let h=y9(m,a.position||0.5);p.setAttribute("fill",h)}}else p.setAttribute("fill",a.fallbackColor||"#808080")}}let i=$4(t,"stroke");for(let p of i){let g=p.getAttribute("stroke");if(g&&g.includes("url(")){let c=g5(g);if(c&&r.has(c)){let m=r.get(c),y=m.tagName.toLowerCase();if(y==="lineargradient"||y==="radialgradient"){if(!o(m,c)){if(a.verbose)console.warn(`Skipping gradient flatten for ${c}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let h=y9(m,a.position||0.5);p.setAttribute("stroke",h)}}else p.setAttribute("stroke",a.fallbackColor||"#808080")}}let l=[...t.querySelectorAll("linearGradient, radialGradient")],d=(p)=>p.replace(/["\\]/g,"\\$&");for(let p of l){let g=p.getAttribute("id"),c=g?d(g):"";if(!(g&&([...t.querySelectorAll(`[fill*="url(#${c})"]`)].length>0||[...t.querySelectorAll(`[stroke*="url(#${c})"]`)].length>0))&&p.parentNode)p.parentNode.removeChild(p)}return t});function y9(t,a=0.5){let r=[...t.children].filter((l)=>l.tagName&&l.tagName.toLowerCase()==="stop");if(r.length===0)return"#808080";if(r.length===1)return s9(r[0]);let e=r.map((l)=>{let d=l.getAttribute("offset")||"0";if(d.endsWith("%"))d=parseFloat(d)/100;else d=parseFloat(d);return d=isNaN(d)?0:Math.max(0,Math.min(1,d)),{offset:d,color:s9(l),opacity:en(l)}});e.sort((l,d)=>l.offset-d.offset);let o=null,n=null;for(let l=0;l<e.length;l++){let d=e[l];if(d.offset<=a)o=d;if(d.offset>=a&&!n){n=d;break}}if(!o)return e[0].color;if(!n)return e[e.length-1].color;if(o.offset===n.offset)return o.color;let i=(a-o.offset)/(n.offset-o.offset);return on(o.color,n.color,i)}function s9(t){let a=t.getAttribute("stop-color");if(!a){let r=t.getAttribute("style");if(r){let e=r.match(/stop-color\s*:\s*([^;]+)/i);if(e)a=e[1].trim()}}if(!a)a="#000000";return rn(a)}function en(t){let a=t.getAttribute("stop-opacity");if(!a){let e=t.getAttribute("style");if(e){let o=e.match(/stop-opacity\s*:\s*([^;]+)/i);if(o)a=o[1].trim()}}let r=a?parseFloat(a):1;return isNaN(r)?1:r}function rn(t){if(!t||typeof t!=="string")return"#000000";let a=t.trim().toLowerCase();if(a.startsWith("#")){if(a.length===4)return"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3];return a}if(a.startsWith("rgb(")){let e=a.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(e){let o=parseInt(e[1],10),n=parseInt(e[2],10),i=parseInt(e[3],10);return _t(o,n,i)}}let r={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",fuchsia:"#ff00ff",purple:"#800080"};if(r[a])return r[a];return"#000000"}function on(t,a,r){let e=(y)=>{let h=y.replace("#","");if(h.length===3)h=h[0]+h[0]+h[1]+h[1]+h[2]+h[2];let s=parseInt(h.slice(0,2),16),x=parseInt(h.slice(2,4),16),D=parseInt(h.slice(4,6),16);if(isNaN(s)||isNaN(x)||isNaN(D))return[0,0,0];return[s,x,D]},[o,n,i]=e(t),[l,d,p]=e(a),g=Math.round(o+(l-o)*r),c=Math.round(n+(d-n)*r),m=Math.round(i+(p-i)*r);return _t(g,c,m)}function _t(t,a,r){let e=(o)=>{return Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")};return"#"+e(t)+e(a)+e(r)}var Ft=d3(async(t,a={})=>{let r=L4(t,{minify:a.minify!==!1}),e=await v5(r,{...a,resolvePatterns:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return F3(e.svg)}),jt=d3((t,a={})=>{let r=(o)=>{if(o.hasAttribute("filter"))o.removeAttribute("filter");for(let n of o.children)if(Z(n))r(n)};r(t);let e=t.getElementsByTagName("filter");for(let o of[...e])if(o.parentNode)o.parentNode.removeChild(o);return t}),Wt=d3(async(t,a={})=>{let r=L4(t,{minify:a.minify!==!1}),e=await v5(r,{...a,resolveUse:!0,resolveClipPaths:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return F3(e.svg)}),Gt=d3((t,a={})=>{let r=t.getElementsByTagName("image");for(let e of[...r])e.setAttribute("data-trace-needed","true");return t}),zt=d3((t,a={})=>{let{samples:r=10,includeStroke:e=!0,includeFillOnly:o=!1}=a,n=[...t.getElementsByTagName("path"),...t.getElementsByTagName("rect"),...t.getElementsByTagName("circle"),...t.getElementsByTagName("ellipse")],i=d5(t),l=[];for(let d=0;d<n.length;d++)for(let p=d+1;p<n.length;p++){let g=n[d],c=n[p],m=n2(g,r),y=n2(c,r);if(!m||!y)continue;let h=a2(g),s=a2(c),x=t2(g,h,i),D=t2(c,s,i);if(e&&!o){if(x.hasStroke){let S=x.getStrokeExtent().toNumber();m=x9(m,S)}if(D.hasStroke){let S=D.getStrokeExtent().toNumber();y=x9(y,S)}}if(z9(m,y).overlaps)l.push({shape1:g.tagName,shape2:c.tagName,id1:g.getAttribute("id"),id2:c.getAttribute("id"),stroke1:x.hasStroke?x.strokeWidth.toNumber():0,stroke2:D.hasStroke?D.strokeWidth.toNumber():0,fillRule1:x.fillRule,fillRule2:D.fillRule})}if(l.length>0)t.setAttribute("data-collisions",JSON.stringify(l));return t});function x9(t,a){if(a<=0||!t||t.length===0)return t;let r=0,e=0;for(let o of t)r+=o.x,e+=o.y;return r/=t.length,e/=t.length,t.map((o)=>{let n=o.x-r,i=o.y-e,l=Math.sqrt(n*n+i*i);if(l<0.0001)return o;let d=(l+a)/l;return{x:r+n*d,y:e+i*d}})}var qt=d3((t,a={})=>{let{id1:r,id2:e}=a;if(!r||!e)return t;let o=t.getElementById(r),n=t.getElementById(e);if(!o||!n)return t;let i=n2(o,a.samples||10),l=n2(n,a.samples||10);if(i&&l){let d=we(i,l);t.setAttribute("data-distance",d.distance.toString())}return t}),Qt=d3((t,a={})=>{let r=[],e=[],o=new Set,n=new Set,i=(d)=>{if(d.tagName.includes(":")){let p=d.tagName.split(":")[0];o.add(p)}for(let p of d.getAttributeNames()){let g=d.getAttribute(p);if(p==="xmlns")n.add("");else if(p.startsWith("xmlns:")){let c=p.substring(6);n.add(c)}if(p.includes(":")&&!p.startsWith("xmlns:")){let c=p.split(":")[0];o.add(c)}if(g&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(g))r.push(`Invalid XML characters in attribute '${p}' of <${d.tagName}>`)}if(d.textContent&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(d.textContent))r.push(`Invalid XML characters in text content of <${d.tagName}>`);for(let p of d.children)if(Z(p))i(p)};i(t);for(let d of o)if(d&&!n.has(d))r.push(`Unbound namespace prefix: '${d}' - SVGO would produce invalid XML here`);let l={valid:r.length===0,errors:r,warnings:e,namespacesUsed:[...o],namespacesDeclared:[...n]};return t.setAttribute("data-xml-validation",JSON.stringify(l)),t}),Ht=d3((t,a={})=>{let r=[],e=[],o=a.version||"1.1";if(t.tagName!=="svg")r.push("Root element must be <svg>");let n=t.getAttribute("xmlns");if(!n)e.push("Missing xmlns attribute (required for standalone SVG)");else if(n!=="http://www.w3.org/2000/svg")r.push(`Invalid SVG namespace: expected 'http://www.w3.org/2000/svg', got '${n}'`);let i=t.getAttribute("viewBox");if(i){let c=i.split(/[\s,]+/);if(c.length!==4)r.push(`Invalid viewBox: expected 4 values, got ${c.length}`);else if(c.some((m)=>isNaN(parseFloat(m))))r.push("Invalid viewBox: contains non-numeric values");else{let[m,y,h,s]=c.map(parseFloat);if(h<0||s<0)r.push("Invalid viewBox: width and height must be non-negative")}}let l={meshGradients:[],hatches:[],solidColors:[],needsPolyfills:!1},d={meshGradient:"meshgradient",meshRow:"meshrow",meshPatch:"meshpatch",hatchPath:"hatchpath",solidColor:"solidcolor"},p=(c,m=0)=>{if(!c||!c.tagName){e.push(`Element at depth ${m} has no tagName property`);return}let y=c.tagName.toLowerCase(),h=c.tagName;if(d[h])r.push(`Invalid SVG 2.0 element: <${h}> must be lowercase <${d[h]}> per SVG 2.0 specification`);if(y==="meshgradient"){let s=c.getAttribute("id");if(l.meshGradients.push(s||null),l.needsPolyfills=!0,!s)e.push("<meshgradient> element without 'id' attribute may be difficult to reference")}if(y==="hatch"){let s=c.getAttribute("id");if(l.hatches.push(s||null),l.needsPolyfills=!0,!s)e.push("<hatch> element without 'id' attribute may be difficult to reference")}if(y==="solidcolor"){let s=c.getAttribute("id");if(l.solidColors.push(s||null),l.needsPolyfills=!0,!s)e.push("<solidcolor> element without 'id' attribute may be difficult to reference")}if(y==="path"){let s=c.getAttribute("d");if(!s||!s.trim())r.push("<path> element missing required 'd' attribute");else{let x=s.match(/[MmLlHhVvCcSsQqTtAaZz]/g);if(!x||x.length===0)r.push("<path> 'd' attribute contains no valid commands");let D=s.trim()[0];if(D!=="M"&&D!=="m")r.push("<path> 'd' must start with M or m command")}}if(y==="rect"){let s=c.getAttribute("width"),x=c.getAttribute("height");if(s!==null&&!v4(s)&&parseFloat(s)<0)r.push("<rect> width must be non-negative");if(x!==null&&!v4(x)&&parseFloat(x)<0)r.push("<rect> height must be non-negative")}if(y==="circle"){let s=c.getAttribute("r");if(s!==null&&parseFloat(s)<0)r.push("<circle> r must be non-negative")}if(y==="ellipse"){let s=c.getAttribute("rx"),x=c.getAttribute("ry");if(s!==null&&parseFloat(s)<0)r.push("<ellipse> rx must be non-negative");if(x!==null&&parseFloat(x)<0)r.push("<ellipse> ry must be non-negative")}if(y==="use"){let s=c.getAttribute("href")||c.getAttribute("xlink:href");if(s&&s.startsWith("#")){let x=s.substring(1);if(!t.getElementById(x))e.push(`<use> references non-existent ID: '${x}'`)}}for(let s of["fill","stroke","clip-path","mask","filter"]){let x=c.getAttribute(s);if(x&&x.startsWith("url(#")){let D=x.match(/url\(#([^)]+)\)/);if(D){let S=D[1];if(!t.getElementById(S))e.push(`<${c.tagName}> ${s} references non-existent ID: '${S}'`)}}}if(e2[y]){let s=e2[y];for(let x of c.children)if(Z(x)){let D=x.tagName.toLowerCase();if(!s.has(D))e.push(`<${D}> is not a standard child of <${y}>`)}}for(let s of c.children)if(Z(s))p(s,m+1)};if(p(t),l.needsPolyfills){let c=[];if(l.meshGradients.length>0)c.push(`meshgradient (${l.meshGradients.length} found)`);if(l.hatches.length>0)c.push(`hatch (${l.hatches.length} found)`);if(l.solidColors.length>0)c.push(`solidcolor (${l.solidColors.length} found)`);e.push(`SVG contains SVG 2.0 features that require polyfills for browser compatibility: ${c.join(", ")}. Use --svg2-polyfills option to inject runtime polyfills.`)}let g={valid:r.length===0,svgVersion:o,errors:r,warnings:e,elementsChecked:Jt(t),svg2Features:l};if(t.setAttribute("data-svg-validation",JSON.stringify(g)),r.length>0)t.setAttribute("data-validation-errors",JSON.stringify(r));else t.setAttribute("data-validation-status","valid");return t}),nn=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout","keydown","keyup","keypress","activate","load","unload","abort","error","resize","scroll","beginEvent","endEvent","repeatEvent","touchstart","touchend","touchmove","touchcancel","wheel","auxclick","input","beforeinput","select","compositionstart","compositionupdate","compositionend"]),ln=d3((t,a={})=>{let r=a.verbose||!1,e=a.printTables!==!1,o={valid:!0,timestamp:new Date().toISOString(),media:{hasAudio:!1,hasVideo:!1,audioElements:[],videoElements:[],foreignObjectWithMedia:[],mediaEmbedMethod:null},smil:{hasAnimations:!1,animationCount:0,animationElements:{animate:0,animateTransform:0,animateMotion:0,animateColor:0,set:0},hasInteractiveAnimations:!1,eventTriggers:[],timingTriggers:[]},compatibility:{worksInAllBrowsers:!0,issues:[],recommendations:[]},errors:[],warnings:[],info:[]},n=(s)=>{let x=[],D=s.toLowerCase(),S=(P)=>{if(P.tagName&&P.tagName.toLowerCase()===D)x.push(P);for(let T of P.children||[])if(T&&T.tagName)S(T)};return S(t),x},i=(s,x=[])=>{if(s.tagName)x.push(s);for(let D of s.children||[])if(D&&D.tagName)i(D,x);return x},l=n("audio");if(l.length>0)o.media.hasAudio=!0,o.media.audioElements=l.map((s)=>({id:s.getAttribute("id"),src:s.getAttribute("src"),hasSource:n("source").filter((x)=>x.parentNode===s).length>0}));let d=n("video");if(d.length>0)o.media.hasVideo=!0,o.media.videoElements=d.map((s)=>({id:s.getAttribute("id"),src:s.getAttribute("src")}));let p=n("foreignObject");for(let s of p){let x=s.children||[],D=!1,S=[],P=(T)=>{let f=T.tagName?.toLowerCase();if(f==="audio"||f==="video")D=!0,S.push({type:f,id:T.getAttribute("id"),src:T.getAttribute("src")});for(let X of T.children||[])if(X&&X.tagName)P(X)};for(let T of x)if(T&&T.tagName)P(T);if(D)o.media.hasAudio=!0,o.media.foreignObjectWithMedia.push({id:s.getAttribute("id"),media:S}),o.media.mediaEmbedMethod="foreignObject"}let g=i(t);for(let s of g)for(let x of["src","href","xlink:href"]){let D=s.getAttribute(x);if(D&&D.startsWith("data:audio/"))o.media.hasAudio=!0,o.media.mediaEmbedMethod="data-uri";if(D&&D.startsWith("data:video/"))o.media.hasVideo=!0,o.media.mediaEmbedMethod="data-uri"}let c=["animate","animateTransform","animateMotion","animateColor","set"];for(let s of c){let x=n(s),D=x.length;o.smil.animationElements[s==="animateTransform"?"animateTransform":s==="animateMotion"?"animateMotion":s==="animateColor"?"animateColor":s]=D,o.smil.animationCount+=D;for(let S of x){let P=S.getAttribute("begin")||"",T=S.getAttribute("end")||"",f=(L,R)=>{let N=L.split(";").map((u)=>u.trim()).filter(Boolean);for(let u of N){let O=u.match(/^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\.)?([a-zA-Z]+)(\s*[+-]\s*[\d.]+[smh]?)?$/);if(O){let[,Y,j,_]=O;if(nn.has(j))o.smil.hasInteractiveAnimations=!0,o.smil.eventTriggers.push({animationElement:s,animationId:S.getAttribute("id"),attribute:R,event:j,targetId:Y||null,offset:_?.trim()||null,parentId:S.parentNode?.getAttribute?.("id")})}else if(/^[\d.]+[smh]?$/.test(u)||u==="indefinite")o.smil.timingTriggers.push({animationElement:s,value:u});else if(/\.(begin|end)/.test(u))o.smil.timingTriggers.push({animationElement:s,value:u,type:"syncbase"})}};if(P)f(P,"begin");if(T)f(T,"end");let X=S.getAttribute("onbegin"),B=S.getAttribute("onend");if(X||B){if(o.smil.hasInteractiveAnimations=!0,X?.includes("play()")||B?.includes("play()"))o.info.push(`Animation uses JavaScript to trigger audio playback via ${X?"onbegin":"onend"} handler`)}}}if(o.smil.hasAnimations=o.smil.animationCount>0,o.media.hasAudio)o.compatibility.worksInAllBrowsers=!1,o.warnings.push("SVG contains embedded audio. Browser autoplay policies will block playback in most scenarios."),o.compatibility.issues.push({type:"AUDIO_AUTOPLAY_BLOCKED",severity:"HIGH",description:"Embedded audio in SVG is blocked by Chrome/Firefox/Safari autoplay policies",affectedBrowsers:["Chrome","Firefox","Safari","Edge"]}),o.compatibility.recommendations.push("To enable audio playback, embed the SVG in an HTML page that extracts audio dynamically after user interaction","Use JavaScript to extract audio data URI from foreignObject and create Audio element on click","Consider using Web Audio API for more control over audio playback");if(o.media.hasVideo)o.compatibility.worksInAllBrowsers=!1,o.warnings.push("SVG contains embedded video. This has limited browser support and autoplay restrictions.");if(o.smil.hasAnimations)o.info.push(`SVG contains ${o.smil.animationCount} SMIL animation elements`),o.compatibility.issues.push({type:"SMIL_IE_UNSUPPORTED",severity:"LOW",description:"SMIL animations are not supported in IE11",affectedBrowsers:["IE (no support)"]});if(o.smil.hasInteractiveAnimations){let s=[...new Set(o.smil.eventTriggers.map((x)=>x.event))];if(o.info.push(`SVG contains interactive SMIL animations triggered by: ${s.join(", ")}`),s.includes("click")||s.includes("mouseover"))o.compatibility.recommendations.push("Interactive animations (click/hover) work in most browsers but require the SVG to be inline or loaded as <object>/<embed>","Using <img> tag to display SVG will disable all interactivity and animations")}let m={Chrome:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Autoplay blocked without user gesture"},Firefox:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"MEI (Media Engagement Index) affects autoplay"},Safari:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Strict autoplay policy"},Edge:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Chromium-based, same as Chrome"},"IE 11":{smil:"No support",audio:"No support",interactive:"No support",notes:"Use CSS animations or JavaScript"}},y=[{scenario:"Standalone SVG",protocol:"file://",example:"file:///path/to/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"Standalone SVG",protocol:"http://",example:"http://localhost/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"SVG in HTML via <img>",protocol:"any",example:'<img src="sample.svg">',smilWorks:!1,audioWorks:!1,interactiveWorks:!1,notes:"All scripting and interactivity disabled"},{scenario:"SVG in HTML via <object>",protocol:"any",example:'<object data="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"SVG in HTML via <embed>",protocol:"any",example:'<embed src="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"Inline SVG in HTML",protocol:"any",example:"<svg>...</svg> in HTML",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full features, audio needs user gesture"},{scenario:"HTML extracts audio on click",protocol:"file://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"},{scenario:"HTML extracts audio on click",protocol:"http://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"}],h=[{trigger:'begin="click"',description:"Animation starts on click (on animation target)",syntax:'<animate begin="click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Target element must be clickable (not in <defs>)"},{trigger:'begin="elementId.click"',description:"Animation starts when another element is clicked",syntax:'<animate begin="button.click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Referenced element must exist with matching id"},{trigger:'begin="mouseover"',description:"Animation starts on mouse hover",syntax:'<animate begin="mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Often paired with mouseout for hover effects"},{trigger:'begin="elementId.mouseover"',description:"Animation starts when hovering another element",syntax:'<animate begin="trigger.mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Useful for triggering animations on related elements"},{trigger:'begin="mouseout"',description:"Animation starts when mouse leaves",syntax:'<animate begin="mouseout" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Use with mouseover for complete hover cycle"},{trigger:'begin="focus"',description:"Animation starts when element receives focus",syntax:'<animate begin="focus" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Works with focusable elements (links, inputs)"},{trigger:'begin="accessKey(s)"',description:"Animation starts on keyboard shortcut",syntax:'<animate begin="accessKey(s)" .../>',browserSupport:"Limited",notes:"Press Alt+S (Windows) or Ctrl+Opt+S (Mac)"}];if(o.tables={browserSupport:m,usageScenarios:y,smilEventScenarios:h},e&&(o.media.hasAudio||o.media.hasVideo||o.smil.hasInteractiveAnimations)){if(console.log(`
|
|
16
|
+
`;yQ(this.logToFile,$),this._buffer=[]}catch{this._buffer=[]}},error($,...J){if(this.level<g6.ERROR)return;let Z=this._format("ERROR",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.error(Z,...J),this._bufferWrite(Z+K),this.flush()},warn($,...J){if(this.level<g6.WARN)return;let Z=this._format("WARN",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.warn(Z,...J),this._bufferWrite(Z+K)},info($,...J){if(this.level<g6.INFO)return;let Z=this._format("INFO",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.log(Z,...J),this._bufferWrite(Z+K)},debug($,...J){if(this.level<g6.DEBUG)return;let Z=this._format("DEBUG",$),K=J.length?" "+J.map((Q)=>this._safeStringify(Q)).join(" "):"";console.log(Z,...J),this._bufferWrite(Z+K)},shutdown(){if(this._flushTimer)clearInterval(this._flushTimer),this._flushTimer=null;this.flush()}};var xQ=j7;k.set({precision:80});var U0=($)=>$ instanceof k?$:new k($),RJ=20;function t7($,J=RJ){if(typeof $!=="string")throw new Error("pathToPolygon: pathData must be a string");if(typeof J!=="number"||J<=0||!Number.isFinite(J))throw new Error(`pathToPolygon: samplesPerCurve must be a positive finite number, got ${J}`);let Z=[],K=U0(0),Q=U0(0),H=U0(0),z=U0(0),q=mQ($);if(!Array.isArray(q))throw new Error("pathToPolygon: parsePathCommands must return an array");for(let W of q){let{type:j,args:G}=W;if(!Array.isArray(G))throw new Error(`pathToPolygon: command args must be an array for command ${j}`);switch(j){case"M":if(G.length<2)throw new Error(`pathToPolygon: M command requires 2 arguments, got ${G.length}`);K=U0(G[0]),Q=U0(G[1]),H=K,z=Q,Z.push(b0(K,Q));break;case"m":if(G.length<2)throw new Error(`pathToPolygon: m command requires 2 arguments, got ${G.length}`);K=K.plus(G[0]),Q=Q.plus(G[1]),H=K,z=Q,Z.push(b0(K,Q));break;case"L":if(G.length<2)throw new Error(`pathToPolygon: L command requires 2 arguments, got ${G.length}`);K=U0(G[0]),Q=U0(G[1]),Z.push(b0(K,Q));break;case"l":if(G.length<2)throw new Error(`pathToPolygon: l command requires 2 arguments, got ${G.length}`);K=K.plus(G[0]),Q=Q.plus(G[1]),Z.push(b0(K,Q));break;case"H":if(G.length<1)throw new Error(`pathToPolygon: H command requires 1 argument, got ${G.length}`);K=U0(G[0]),Z.push(b0(K,Q));break;case"h":if(G.length<1)throw new Error(`pathToPolygon: h command requires 1 argument, got ${G.length}`);K=K.plus(G[0]),Z.push(b0(K,Q));break;case"V":if(G.length<1)throw new Error(`pathToPolygon: V command requires 1 argument, got ${G.length}`);Q=U0(G[0]),Z.push(b0(K,Q));break;case"v":if(G.length<1)throw new Error(`pathToPolygon: v command requires 1 argument, got ${G.length}`);Q=Q.plus(G[0]),Z.push(b0(K,Q));break;case"C":if(G.length<6)throw new Error(`pathToPolygon: C command requires 6 arguments, got ${G.length}`);kJ(Z,K,Q,U0(G[0]),U0(G[1]),U0(G[2]),U0(G[3]),U0(G[4]),U0(G[5]),J),K=U0(G[4]),Q=U0(G[5]);break;case"c":if(G.length<6)throw new Error(`pathToPolygon: c command requires 6 arguments, got ${G.length}`);kJ(Z,K,Q,K.plus(G[0]),Q.plus(G[1]),K.plus(G[2]),Q.plus(G[3]),K.plus(G[4]),Q.plus(G[5]),J),K=K.plus(G[4]),Q=Q.plus(G[5]);break;case"Q":if(G.length<4)throw new Error(`pathToPolygon: Q command requires 4 arguments, got ${G.length}`);LJ(Z,K,Q,U0(G[0]),U0(G[1]),U0(G[2]),U0(G[3]),J),K=U0(G[2]),Q=U0(G[3]);break;case"q":if(G.length<4)throw new Error(`pathToPolygon: q command requires 4 arguments, got ${G.length}`);LJ(Z,K,Q,K.plus(G[0]),Q.plus(G[1]),K.plus(G[2]),Q.plus(G[3]),J),K=K.plus(G[2]),Q=Q.plus(G[3]);break;case"A":if(G.length<7)throw new Error(`pathToPolygon: A command requires 7 arguments, got ${G.length}`);wJ(Z,K,Q,U0(G[0]),U0(G[1]),U0(G[2]),G[3],G[4],U0(G[5]),U0(G[6]),J),K=U0(G[5]),Q=U0(G[6]);break;case"a":if(G.length<7)throw new Error(`pathToPolygon: a command requires 7 arguments, got ${G.length}`);wJ(Z,K,Q,U0(G[0]),U0(G[1]),U0(G[2]),G[3],G[4],K.plus(G[5]),Q.plus(G[6]),J),K=K.plus(G[5]),Q=Q.plus(G[6]);break;case"Z":case"z":K=H,Q=z;break;default:break}}return dQ(Z)}function mQ($){if(typeof $!=="string")throw new Error(`parsePathCommands: pathData must be a string, got ${typeof $}`);let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim(),z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,q=H.length>0?Array.from(H.matchAll(z),(W)=>Number(W[0])):[];J.push({type:Q,args:q})}return J}function kJ($,J,Z,K,Q,H,z,q,W,j){if(!Array.isArray($))throw new Error("sampleCubicBezier: points must be an array");if(typeof j!=="number"||j<=0||!Number.isFinite(j))throw new Error(`sampleCubicBezier: samples must be a positive finite number, got ${j}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(z instanceof k)||!(q instanceof k)||!(W instanceof k))throw new Error("sampleCubicBezier: all coordinate parameters must be Decimal instances");for(let G=1;G<=j;G++){let F=U0(G).div(j),_=U0(1).minus(F),U=_.mul(_),O=U.mul(_),V=F.mul(F),M=V.mul(F),Y=O.mul(J).plus(U0(3).mul(U).mul(F).mul(K)).plus(U0(3).mul(_).mul(V).mul(H)).plus(M.mul(q)),X=O.mul(Z).plus(U0(3).mul(U).mul(F).mul(Q)).plus(U0(3).mul(_).mul(V).mul(z)).plus(M.mul(W));$.push(b0(Y,X))}}function LJ($,J,Z,K,Q,H,z,q){if(!Array.isArray($))throw new Error("sampleQuadraticBezier: points must be an array");if(typeof q!=="number"||q<=0||!Number.isFinite(q))throw new Error(`sampleQuadraticBezier: samples must be a positive finite number, got ${q}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(z instanceof k))throw new Error("sampleQuadraticBezier: all coordinate parameters must be Decimal instances");for(let W=1;W<=q;W++){let j=U0(W).div(q),G=U0(1).minus(j),F=G.mul(G),_=j.mul(j),U=F.mul(J).plus(U0(2).mul(G).mul(j).mul(K)).plus(_.mul(H)),O=F.mul(Z).plus(U0(2).mul(G).mul(j).mul(Q)).plus(_.mul(z));$.push(b0(U,O))}}function wJ($,J,Z,K,Q,H,z,q,W,j,G){if(!Array.isArray($))throw new Error("sampleArc: points must be an array");if(typeof G!=="number"||G<=0||!Number.isFinite(G))throw new Error(`sampleArc: samples must be a positive finite number, got ${G}`);if(!(J instanceof k)||!(Z instanceof k)||!(K instanceof k)||!(Q instanceof k)||!(H instanceof k)||!(W instanceof k)||!(j instanceof k))throw new Error("sampleArc: all coordinate and angle parameters must be Decimal instances");if(typeof z!=="number"||z!==0&&z!==1)throw new Error(`sampleArc: largeArc must be 0 or 1, got ${z}`);if(typeof q!=="number"||q!==0&&q!==1)throw new Error(`sampleArc: sweep must be 0 or 1, got ${q}`);if(K.eq(0)||Q.eq(0)){$.push(b0(W,j));return}let F=K.abs(),_=Q.abs(),U=H.mul(Math.PI).div(180),O=U.cos(),V=U.sin(),M=J.minus(W).div(2),Y=Z.minus(j).div(2),X=O.mul(M).plus(V.mul(Y)),w=O.mul(Y).minus(V.mul(M)),R=F.mul(F),I=_.mul(_),f=X.mul(X),u=w.mul(w),m=f.div(R).plus(u.div(I));if(m.gt(1)){let $0=m.sqrt();F=F.mul($0),_=_.mul($0),R=F.mul(F),I=_.mul(_)}let S=R.mul(I).minus(R.mul(u)).minus(I.mul(f));if(S=S.div(R.mul(u).plus(I.mul(f))),S.lt(0))S=U0(0);if(S=S.sqrt(),z===q)S=S.neg();let x=S.mul(K).mul(w).div(Q),h=S.neg().mul(Q).mul(X).div(K),E=J.plus(W).div(2),d=Z.plus(j).div(2),c=O.mul(x).minus(V.mul(h)).plus(E),p=V.mul(x).plus(O.mul(h)).plus(d),N=X.minus(x).div(K),y=w.minus(h).div(Q),B=X.neg().minus(x).div(K),e=w.neg().minus(h).div(Q),r=N.mul(N).plus(y.mul(y)).sqrt();if(r.eq(0)){L$.warn("sampleArc: degenerate arc - center coincides with start point, treating as line to end"),$.push(b0(W,j));return}let s=k.acos(N.div(r));if(y.lt(0))s=s.neg();let z0=r.mul(B.mul(B).plus(e.mul(e)).sqrt());if(z0.eq(0)){L$.warn("sampleArc: degenerate arc - zero length, treating as single point"),$.push(b0(W,j));return}let T=k.acos(N.mul(B).plus(y.mul(e)).div(z0));if(N.mul(e).minus(y.mul(B)).lt(0))T=T.neg();let P=U0(Math.PI),t=P.mul(2);if(q&&T.lt(0))T=T.plus(t);else if(!q&&T.gt(0))T=T.minus(t);for(let $0=1;$0<=G;$0++){let Q0=U0($0).div(G),V0=s.plus(T.mul(Q0)),N0=V0.cos(),h0=V0.sin(),o=O.mul(K.mul(N0)).minus(V.mul(Q.mul(h0))).plus(c),J0=V.mul(K.mul(N0)).plus(O.mul(Q.mul(h0))).plus(p);$.push(b0(o,J0))}}function dQ($){if(!Array.isArray($))throw new Error("removeDuplicateConsecutive: points must be an array");if($.length<2)return $;let J=[$[0]];for(let Z=1;Z<$.length;Z++)if(!D7($[Z],J[J.length-1]))J.push($[Z]);return J}function X6($,J=null,Z=RJ,K=4){if(!$||typeof $!=="object")throw new Error("shapeToPolygon: element must be an object");if(!$.type||typeof $.type!=="string")throw new Error("shapeToPolygon: element.type must be a string");if(typeof Z!=="number"||Z<=0||!Number.isFinite(Z))throw new Error(`shapeToPolygon: samples must be a positive finite number, got ${Z}`);if(typeof K!=="number"||K<=0||!Number.isFinite(K))throw new Error(`shapeToPolygon: bezierArcs must be a positive finite number, got ${K}`);if(J!==null&&!(J instanceof _0))throw new Error("shapeToPolygon: ctm must be null or a Matrix instance");let Q;switch($.type){case"circle":if(K>4)Q=s8($.cx||0,$.cy||0,$.r||0,K,10);else Q=t8(U0($.cx||0),U0($.cy||0),U0($.r||0));break;case"ellipse":if(K>4)Q=r$($.cx||0,$.cy||0,$.rx||0,$.ry||0,K,10);else Q=Q9(U0($.cx||0),U0($.cy||0),U0($.rx||0),U0($.ry||0));break;case"rect":Q=e8(U0($.x||0),U0($.y||0),U0($.width||0),U0($.height||0),U0($.rx||0),$.ry!==void 0?U0($.ry):null);break;case"line":Q=$J(U0($.x1||0),U0($.y1||0),U0($.x2||0),U0($.y2||0));break;case"polygon":Q=JJ($.points||"");break;case"polyline":Q=KJ($.points||"");break;case"path":Q=$.d||"";break;default:return[]}if($.transform){let H=xQ($.transform);if(!(H instanceof _0))throw new Error(`shapeToPolygon: parseTransform must return a Matrix, got ${typeof H}`);Q=Y6(Q,H)}if(J)Q=Y6(Q,J);return t7(Q,Z)}function V9($,J=6){if(!Array.isArray($))throw new Error("polygonToPathData: polygon must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error(`polygonToPathData: precision must be a non-negative finite number, got ${J}`);if($.length<2)return"";let Z=(Q)=>(Q instanceof k?Q:U0(Q)).toFixed(J).replace(/\.?0+$/,""),K=`M ${Z($[0].x)} ${Z($[0].y)}`;for(let Q=1;Q<$.length;Q++)K+=` L ${Z($[Q].x)} ${Z($[Q].y)}`;return K+" Z"}k.set({precision:80});k.set({precision:80});var BJ=($)=>$ instanceof k?$:new k($),NJ=-0.1,IJ=-0.1,CJ=1.2,PJ=1.2,w$={LUMINANCE:"luminance",ALPHA:"alpha"};function AJ($){if(!$)throw new Error("parseMaskElement: maskElement is required");if(!$.getAttribute)throw new Error("parseMaskElement: maskElement must be a DOM element");let J={id:$.getAttribute("id")||"",maskUnits:$.getAttribute("maskUnits")||"objectBoundingBox",maskContentUnits:$.getAttribute("maskContentUnits")||"userSpaceOnUse",maskType:$.getAttribute("mask-type")||$.style?.maskType||"luminance",x:$.getAttribute("x"),y:$.getAttribute("y"),width:$.getAttribute("width"),height:$.getAttribute("height"),transform:$.getAttribute("transform")||null,children:[]},Z=(K,Q)=>{let H=parseFloat(K);return isNaN(H)?Q:H};if(J.maskUnits==="objectBoundingBox")J.x=J.x!==null?Z(J.x,NJ):NJ,J.y=J.y!==null?Z(J.y,IJ):IJ,J.width=J.width!==null?Z(J.width,CJ):CJ,J.height=J.height!==null?Z(J.height,PJ):PJ;else J.x=J.x!==null?Z(J.x,null):null,J.y=J.y!==null?Z(J.y,null):null,J.width=J.width!==null?Z(J.width,null):null,J.height=J.height!==null?Z(J.height,null):null;if(!$.children)return J;for(let K of $.children){if(!K.tagName)continue;let Q=K.tagName.toLowerCase(),H={type:Q,fill:K.getAttribute("fill")||K.style?.fill||"black",fillOpacity:Z(K.getAttribute("fill-opacity")||K.style?.fillOpacity||"1",1),opacity:Z(K.getAttribute("opacity")||K.style?.opacity||"1",1),transform:K.getAttribute("transform")||null};switch(Q){case"rect":H.x=Z(K.getAttribute("x")||"0",0),H.y=Z(K.getAttribute("y")||"0",0),H.width=Z(K.getAttribute("width")||"0",0),H.height=Z(K.getAttribute("height")||"0",0),H.rx=Z(K.getAttribute("rx")||"0",0),H.ry=Z(K.getAttribute("ry")||"0",0);break;case"circle":H.cx=Z(K.getAttribute("cx")||"0",0),H.cy=Z(K.getAttribute("cy")||"0",0),H.r=Z(K.getAttribute("r")||"0",0);break;case"ellipse":H.cx=Z(K.getAttribute("cx")||"0",0),H.cy=Z(K.getAttribute("cy")||"0",0),H.rx=Z(K.getAttribute("rx")||"0",0),H.ry=Z(K.getAttribute("ry")||"0",0);break;case"path":H.d=K.getAttribute("d")||"";break;case"polygon":H.points=K.getAttribute("points")||"";break;case"polyline":H.points=K.getAttribute("points")||"";break;case"g":if(H.children=[],K.children){for(let z of K.children)if(z.tagName)H.children.push({type:z.tagName.toLowerCase(),fill:z.getAttribute("fill")||"inherit"})}break;default:break}J.children.push(H)}return J}function pQ($,J,Z,K=20){if(!$)throw new Error("maskChildToPolygon: child is required");if(!J)throw new Error("maskChildToPolygon: targetBBox is required");if(!Z)throw new Error("maskChildToPolygon: contentUnits is required");if(typeof K!=="number"||K<=0)throw new Error("maskChildToPolygon: samples must be a positive number");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("maskChildToPolygon: targetBBox must have numeric x, y, width, height properties");if(J.width<0||J.height<0)throw new Error("maskChildToPolygon: targetBBox width and height cannot be negative");let Q={type:$.type,...$,transform:$.transform},H=X6(Q,null,K);if(!Array.isArray(H))return[];if(Z==="objectBoundingBox"&&H.length>0){if(J.width===0||J.height===0)return[];H=H.map((z)=>({x:BJ(J.x).plus(z.x.mul(J.width)),y:BJ(J.y).plus(z.y.mul(J.height))}))}return H}function cQ($){if(!$||$==="none"||$==="transparent")return 0;if(typeof $!=="string")return 0;let J=$.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(J){let H=parseInt(J[1],10),z=parseInt(J[2],10),q=parseInt(J[3],10);if(isNaN(H)||isNaN(z)||isNaN(q))return 0;let W=Math.max(0,Math.min(255,H))/255,j=Math.max(0,Math.min(255,z))/255,G=Math.max(0,Math.min(255,q))/255,F=0.2126*W+0.7152*j+0.0722*G;return isNaN(F)?0:F}let Z=$.match(/^#([0-9a-f]{3,6})$/i);if(Z){let H=Z[1];if(H.length===3)H=H[0]+H[0]+H[1]+H[1]+H[2]+H[2];let z=parseInt(H.slice(0,2),16),q=parseInt(H.slice(2,4),16),W=parseInt(H.slice(4,6),16);if(isNaN(z)||isNaN(q)||isNaN(W))return 0;let j=0.2126*(z/255)+0.7152*(q/255)+0.0722*(W/255);return isNaN(j)?0:j}let K={white:1,black:0,red:0.2126,green:0.7152,blue:0.0722,yellow:0.9278,cyan:0.7874,magenta:0.2848,gray:0.5,grey:0.5},Q=$.toLowerCase();if(K[Q]!==void 0)return K[Q];return 0}function lQ($,J){if(!$)throw new Error("getMaskChildOpacity: child is required");if(!J)throw new Error("getMaskChildOpacity: maskType is required");if(J!==w$.LUMINANCE&&J!==w$.ALPHA)throw new Error('getMaskChildOpacity: maskType must be "luminance" or "alpha"');let Z=typeof $.fillOpacity==="number"&&!isNaN($.fillOpacity)?$.fillOpacity:1,K=typeof $.opacity==="number"&&!isNaN($.opacity)?$.opacity:1,Q=Z*K;if(J===w$.ALPHA)return Q;let H=cQ($.fill),z=Q*H;return isNaN(z)?0:z}function nQ($,J,Z={}){if(!$)throw new Error("resolveMask: maskData is required");if(!J)throw new Error("resolveMask: targetBBox is required");if(!Array.isArray($.children))throw new Error("resolveMask: maskData.children must be an array");let{samples:K=20}=Z;if(typeof K!=="number"||K<=0)throw new Error("resolveMask: samples must be a positive number");let Q=$.maskType||w$.LUMINANCE,H=[];for(let z of $.children){if(!z)continue;let q=pQ(z,J,$.maskContentUnits,K);if(q.length>=3){let W=lQ(z,Q);H.push({polygon:q,opacity:W})}}return H}function sQ($,J,Z=0.5,K={}){if(!$)throw new Error("maskToClipPath: maskData is required");if(!J)throw new Error("maskToClipPath: targetBBox is required");if(typeof Z!=="number"||Z<0||Z>1)throw new Error("maskToClipPath: opacityThreshold must be a number between 0 and 1");let Q=nQ($,J,K),H=[];for(let{polygon:z,opacity:q}of Q)if(q>=Z&&z&&z.length>=3)if(H.length===0)H=z;else{let W=z6(H,z);if(W.length>0&&W[0].length>=3)H=W[0]}return H}function EJ($,J,Z={}){if(!$)throw new Error("maskToPathData: maskData is required");if(!J)throw new Error("maskToPathData: targetBBox is required");let K=sQ($,J,0.5,Z);if(K.length<3)return"";let Q="",H=0;for(let z=0;z<K.length;z++){let q=K[z];if(!q||q.x===void 0||q.y===void 0)continue;let W=Number(q.x),j=Number(q.y);if(isNaN(W)||isNaN(j)||!isFinite(W)||!isFinite(j))continue;let G=W.toFixed(6),F=j.toFixed(6);Q+=H===0?`M ${G} ${F}`:` L ${G} ${F}`,H++}if(H>=3)Q+=" Z";else return"";return Q}k.set({precision:80});function TJ($){if(!$)throw new Error("parseUseElement: useElement is required");let J=$.getAttribute("href")||$.getAttribute("xlink:href")||"",Z=J.startsWith("#")?J.slice(1):J;if(!Z)throw new Error("parseUseElement: href attribute must reference a valid element id (found empty reference)");let K=parseFloat($.getAttribute("x")||"0"),Q=parseFloat($.getAttribute("y")||"0");if(isNaN(K)||isNaN(Q)||!isFinite(K)||!isFinite(Q))throw new Error("parseUseElement: x and y attributes must be valid finite numbers");let H=null,z=null;if($.getAttribute("width")){if(H=parseFloat($.getAttribute("width")),isNaN(H)||!isFinite(H)||H<=0)throw new Error("parseUseElement: width attribute must be a valid positive finite number")}if($.getAttribute("height")){if(z=parseFloat($.getAttribute("height")),isNaN(z)||!isFinite(z)||z<=0)throw new Error("parseUseElement: height attribute must be a valid positive finite number")}return{href:Z,x:K,y:Q,width:H,height:z,transform:$.getAttribute("transform")||null,style:fJ($)}}function bJ($){if(!$)throw new Error("parseSymbolElement: symbolElement is required");let J=parseFloat($.getAttribute("refX")||"0"),Z=parseFloat($.getAttribute("refY")||"0");if(isNaN(J)||isNaN(Z)||!isFinite(J)||!isFinite(Z))throw new Error("parseSymbolElement: refX and refY must be valid finite numbers");let K={id:$.getAttribute("id")||"",viewBox:$.getAttribute("viewBox")||null,preserveAspectRatio:$.getAttribute("preserveAspectRatio")||"xMidYMid meet",children:[],refX:J,refY:Z};if(K.viewBox){let Q=K.viewBox.trim().split(/[\s,]+/).map(Number);if(Q.length===4&&Q.every((H)=>!isNaN(H)&&isFinite(H)))K.viewBoxParsed={x:Q[0],y:Q[1],width:Q[2],height:Q[3]}}for(let Q of $.children)K.children.push(R$(Q));return K}function R$($){if(!$||!$.tagName)throw new Error("parseChildElement: element with tagName is required");let J=$.tagName.toLowerCase(),Z={type:J,id:$.getAttribute("id")||null,transform:$.getAttribute("transform")||null,style:fJ($)},K=(Q,H="0")=>{let z=parseFloat($.getAttribute(Q)||H);if(isNaN(z)||!isFinite(z))throw new Error(`parseChildElement: ${Q} must be a valid finite number in ${J} element`);return z};switch(J){case"rect":Z.x=K("x"),Z.y=K("y"),Z.width=K("width"),Z.height=K("height"),Z.rx=K("rx"),Z.ry=K("ry");break;case"circle":Z.cx=K("cx"),Z.cy=K("cy"),Z.r=K("r");break;case"ellipse":Z.cx=K("cx"),Z.cy=K("cy"),Z.rx=K("rx"),Z.ry=K("ry");break;case"path":Z.d=$.getAttribute("d")||"";break;case"polygon":Z.points=$.getAttribute("points")||"";break;case"polyline":Z.points=$.getAttribute("points")||"";break;case"line":Z.x1=K("x1"),Z.y1=K("y1"),Z.x2=K("x2"),Z.y2=K("y2");break;case"g":Z.children=[];for(let Q of $.children)Z.children.push(R$(Q));break;case"use":Z.href=($.getAttribute("href")||$.getAttribute("xlink:href")||"").replace("#",""),Z.x=K("x"),Z.y=K("y"),Z.width=$.getAttribute("width")?K("width"):null,Z.height=$.getAttribute("height")?K("height"):null;break;default:break}return Z}function fJ($){if(!$)throw new Error("extractStyleAttributes: element is required");return{fill:$.getAttribute("fill"),stroke:$.getAttribute("stroke"),strokeWidth:$.getAttribute("stroke-width"),opacity:$.getAttribute("opacity"),fillOpacity:$.getAttribute("fill-opacity"),strokeOpacity:$.getAttribute("stroke-opacity"),visibility:$.getAttribute("visibility"),display:$.getAttribute("display")}}function iQ($,J,Z,K="xMidYMid meet"){if(!$||!J||!Z)return _0.identity(3);if(!isFinite(J)||!isFinite(Z)||J<=0||Z<=0)return _0.identity(3);let{width:Q,height:H,x:z,y:q}=$;if(!isFinite(Q)||!isFinite(H)||!isFinite(z)||!isFinite(q)||Q<=0||H<=0)return _0.identity(3);let W=K.trim().split(/\s+/),j=W[0]||"xMidYMid",G=W[1]||"meet";if(j==="none"){let X=J/Q,w=Z/H;return i0(-z*X,-q*w).mul(w7(X,w))}let F=J/Q,_=Z/H,U;if(G==="slice")U=Math.max(F,_);else U=Math.min(F,_);let O=-z*U,V=-q*U,M=Q*U,Y=H*U;if(j.includes("xMid"))O+=(J-M)/2;else if(j.includes("xMax"))O+=J-M;if(j.includes("YMid"))V+=(Z-Y)/2;else if(j.includes("YMax"))V+=Z-Y;return i0(O,V).mul(w7(U,U))}function O9($,J,Z={}){if(!$||!$.href)throw new Error("resolveUse: useData with href property is required");if(!J)throw new Error("resolveUse: defs map is required");if(typeof $.x!=="number"||isNaN($.x)||!isFinite($.x))throw new Error("resolveUse: useData.x must be a valid finite number");if(typeof $.y!=="number"||isNaN($.y)||!isFinite($.y))throw new Error("resolveUse: useData.y must be a valid finite number");if($.width!==null&&(typeof $.width!=="number"||isNaN($.width)||!isFinite($.width)||$.width<=0))throw new Error("resolveUse: useData.width must be null or a positive finite number");if($.height!==null&&(typeof $.height!=="number"||isNaN($.height)||!isFinite($.height)||$.height<=0))throw new Error("resolveUse: useData.height must be null or a positive finite number");if($.style!==null&&$.style!==void 0){if(typeof $.style!=="object"||Array.isArray($.style))throw new Error("resolveUse: useData.style must be null, undefined, or a valid non-array object")}if($.transform!==null&&$.transform!==void 0&&typeof $.transform!=="string")throw new Error("resolveUse: useData.transform must be null, undefined, or a string");if(Z&&typeof Z!=="object")throw new Error("resolveUse: options must be an object or undefined");let{maxDepth:K=10,_visited:Q=new Set}=Z;if(typeof K!=="number"||K<=0||!isFinite(K))throw new Error("resolveUse: maxDepth must be a positive finite number");if(Q.has($.href))return console.warn(`resolveUse: circular reference detected for '#${$.href}', skipping to prevent infinite loop`),null;let H=J[$.href];if(!H)return console.warn(`resolveUse: target element '#${$.href}' not found in defs map`),null;Q.add($.href);let z=i0($.x,$.y);if($.transform){let j=j7($.transform);z=z.mul(j)}if(H.type==="symbol"&&H.viewBoxParsed){if(typeof H.viewBoxParsed.x!=="number"||typeof H.viewBoxParsed.y!=="number"||typeof H.viewBoxParsed.width!=="number"||typeof H.viewBoxParsed.height!=="number"||!isFinite(H.viewBoxParsed.x)||!isFinite(H.viewBoxParsed.y)||!isFinite(H.viewBoxParsed.width)||!isFinite(H.viewBoxParsed.height)||H.viewBoxParsed.width<=0||H.viewBoxParsed.height<=0)throw new Error("resolveUse: target.viewBoxParsed must have finite x, y and positive finite width, height");let j=$.width!==null?$.width:H.viewBoxParsed.width,G=$.height!==null?$.height:H.viewBoxParsed.height;z=iQ(H.viewBoxParsed,j,G,H.preserveAspectRatio||"xMidYMid meet").mul(z)}let q=[],W=H.children&&Array.isArray(H.children)&&H.children.length>0?H.children:[H];for(let j of W)if(j.type==="use"){if(K<=1){console.warn(`resolveUse: maximum nesting depth reached for use element '#${j.href}', skipping nested resolution`);continue}let G=O9(j,J,{maxDepth:K-1,_visited:Q});if(G)q.push(G)}else q.push({element:j,transform:_0.identity(3)});return Q.delete($.href),{element:H,transform:z,children:q,inheritedStyle:$.style}}function SJ($,J=20){let Z=[];if(!$)return Z;if(typeof J!=="number"||J<=0||!isFinite(J))throw new Error("flattenResolvedUse: samples must be a positive finite number");if(!$.children||!$.transform)return Z;for(let K of $.children){if(!K||!K.transform)continue;let Q=$.transform.mul(K.transform),H=K.element;if(K.children){let z=SJ(K,J);for(let q of z)q.polygon=q.polygon.map((W)=>{let[j,G]=c0($.transform,W.x,W.y);return{x:j,y:G}}),Z.push(q)}else{let z=rQ(H,Q,J);if(z.length>=3)Z.push({polygon:z,style:aQ($.inheritedStyle,H.style)})}}return Z}function rQ($,J,Z=20){if(!$)throw new Error("elementToPolygon: element is required");if(typeof Z!=="number"||Z<=0||!isFinite(Z))throw new Error("elementToPolygon: samples must be a positive finite number");let K=X6($,null,Z);if(J&&K.length>0)K=K.map((Q)=>{let[H,z]=c0(J,Q.x,Q.y);return{x:H,y:z}});return K}function aQ($,J){if(!J||typeof J!=="object"||Array.isArray(J))throw new Error("mergeStyles: element must be a valid non-array object");let Z={...J};if($!==null&&$!==void 0){if(typeof $!=="object"||Array.isArray($))throw new Error("mergeStyles: inherited must be null, undefined, or a valid non-array object")}for(let[K,Q]of Object.entries($||{}))if(Q!==null&&(Z[K]===null||Z[K]===void 0))Z[K]=Q;return Z}function vJ($,J=20){if(typeof J!=="number"||J<=0||!isFinite(J))throw new Error("resolvedUseToPathData: samples must be a positive finite number");let Z=SJ($,J),K=[];for(let{polygon:Q}of Z)if(Q.length>=3){let H="";for(let z=0;z<Q.length;z++){let q=Q[z],W=Number(q.x),j=Number(q.y);if(isNaN(W)||isNaN(j))continue;H+=z===0?`M ${W.toFixed(6)} ${j.toFixed(6)}`:` L ${W.toFixed(6)} ${j.toFixed(6)}`}H+=" Z",K.push(H)}return K.join(" ")}k.set({precision:80});var K7=($)=>$ instanceof k?$:new k($);function DJ($){if(!$)throw new Error("parsePatternElement: patternElement is required");if(typeof $.getAttribute!=="function")throw new Error("parsePatternElement: patternElement must be a DOM element with getAttribute method");let J={id:$.getAttribute("id")||"",patternUnits:$.getAttribute("patternUnits")||"objectBoundingBox",patternContentUnits:$.getAttribute("patternContentUnits")||"userSpaceOnUse",patternTransform:$.getAttribute("patternTransform")||null,x:$.getAttribute("x"),y:$.getAttribute("y"),width:$.getAttribute("width"),height:$.getAttribute("height"),viewBox:$.getAttribute("viewBox")||null,preserveAspectRatio:$.getAttribute("preserveAspectRatio")||"xMidYMid meet",href:$.getAttribute("href")||$.getAttribute("xlink:href")||null,children:[]},Z=(K,Q)=>{if(K===null||K===void 0)return Q;let H=parseFloat(K);return isNaN(H)?Q:H};if(J.x=Z(J.x,0),J.y=Z(J.y,0),J.width=Z(J.width,0),J.height=Z(J.height,0),J.viewBox){let K=J.viewBox.trim().split(/[\s,]+/).map(Number);if(K.length===4&&K.every((Q)=>!isNaN(Q)&&isFinite(Q)))J.viewBoxParsed={x:K[0],y:K[1],width:K[2],height:K[3]}}if($.children&&typeof $.children[Symbol.iterator]==="function")for(let K of $.children){if(!K||typeof K.getAttribute!=="function")continue;let Q=K.tagName?K.tagName.toLowerCase():"";if(!Q)continue;let H={type:Q,fill:K.getAttribute("fill")||"black",stroke:K.getAttribute("stroke")||"none",strokeWidth:Z(K.getAttribute("stroke-width"),1),opacity:Z(K.getAttribute("opacity"),1),transform:K.getAttribute("transform")||null};switch(Q){case"rect":H.x=Z(K.getAttribute("x"),0),H.y=Z(K.getAttribute("y"),0),H.width=Z(K.getAttribute("width"),0),H.height=Z(K.getAttribute("height"),0),H.rx=Z(K.getAttribute("rx"),0),H.ry=Z(K.getAttribute("ry"),0);break;case"circle":H.cx=Z(K.getAttribute("cx"),0),H.cy=Z(K.getAttribute("cy"),0),H.r=Z(K.getAttribute("r"),0);break;case"ellipse":H.cx=Z(K.getAttribute("cx"),0),H.cy=Z(K.getAttribute("cy"),0),H.rx=Z(K.getAttribute("rx"),0),H.ry=Z(K.getAttribute("ry"),0);break;case"path":H.d=K.getAttribute("d")||"";break;case"polygon":H.points=K.getAttribute("points")||"";break;case"polyline":H.points=K.getAttribute("points")||"";break;case"line":H.x1=Z(K.getAttribute("x1"),0),H.y1=Z(K.getAttribute("y1"),0),H.x2=Z(K.getAttribute("x2"),0),H.y2=Z(K.getAttribute("y2"),0);break;case"use":H.href=K.getAttribute("href")||K.getAttribute("xlink:href")||"",H.x=Z(K.getAttribute("x"),0),H.y=Z(K.getAttribute("y"),0);break;case"g":if(H.children=[],K.children&&typeof K.children[Symbol.iterator]==="function"){for(let z of K.children)if(z&&z.tagName&&typeof z.getAttribute==="function")H.children.push({type:z.tagName.toLowerCase(),fill:z.getAttribute("fill")||"inherit"})}break;default:break}J.children.push(H)}return J}function eQ($,J){if(!$)throw new Error("getPatternTile: patternData is required");if(!J)throw new Error("getPatternTile: targetBBox is required");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("getPatternTile: targetBBox must have numeric x, y, width, and height properties");if(typeof $.x!=="number"||typeof $.y!=="number"||typeof $.width!=="number"||typeof $.height!=="number")throw new Error("getPatternTile: patternData must have numeric x, y, width, and height properties");if($.patternUnits==="objectBoundingBox")return{x:K7(J.x).plus(K7($.x).mul(J.width)),y:K7(J.y).plus(K7($.y).mul(J.height)),width:K7($.width).mul(J.width),height:K7($.height).mul(J.height)};return{x:K7($.x),y:K7($.y),width:K7($.width),height:K7($.height)}}function $H($,J,Z){if(!$)throw new Error("getPatternContentTransform: patternData is required");if(!J)throw new Error("getPatternContentTransform: tile is required");if(!Z)throw new Error("getPatternContentTransform: targetBBox is required");if(!J.width||!J.height)throw new Error("getPatternContentTransform: tile must have width and height properties");if(typeof Z.x!=="number"||typeof Z.y!=="number"||typeof Z.width!=="number"||typeof Z.height!=="number")throw new Error("getPatternContentTransform: targetBBox must have numeric x, y, width, and height properties");let K=_0.identity(3);if($.viewBoxParsed){let Q=$.viewBoxParsed;if(typeof Q.x!=="number"||typeof Q.y!=="number"||typeof Q.width!=="number"||typeof Q.height!=="number")throw new Error("getPatternContentTransform: viewBoxParsed must have numeric x, y, width, and height properties");let H=Number(J.width),z=Number(J.height);if(H===0||z===0)throw new Error("getPatternContentTransform: tile width and height must be non-zero when viewBox is present");if(Q.width===0||Q.height===0)throw new Error("getPatternContentTransform: viewBox width and height must be non-zero");let q=H/Q.width,W=z/Q.height,j=Math.min(q,W);if(!isFinite(j))throw new Error("getPatternContentTransform: computed scale is not finite");let G=(H-Q.width*j)/2,F=(z-Q.height*j)/2;K=K.mul(i0(G-Q.x*j,F-Q.y*j)),K=K.mul(w7(j,j))}if($.patternContentUnits==="objectBoundingBox"){if(Z.width===0||Z.height===0)throw new Error("getPatternContentTransform: targetBBox width and height must be non-zero when patternContentUnits is objectBoundingBox");K=K.mul(i0(Z.x,Z.y)),K=K.mul(w7(Z.width,Z.height))}return K}function JH($,J=null,Z=20){if(!$)throw new Error("patternChildToPolygon: child is required");if(!$.type)throw new Error("patternChildToPolygon: child must have a type property");if(typeof Z!=="number"||Z<=0||!isFinite(Z))throw new Error("patternChildToPolygon: samples must be a positive finite number");let K={type:$.type,...$,transform:$.transform},Q=X6(K,null,Z);if(!Array.isArray(Q))return[];if(J&&Q.length>0)Q=Q.map((H)=>{if(!H||typeof H.x!=="number"||typeof H.y!=="number")throw new Error("patternChildToPolygon: invalid polygon point - must have numeric x and y properties");let[z,q]=c0(J,H.x,H.y);return{x:z,y:q}});return Q}function KH($,J){if(!$)throw new Error("getTilePositions: tile is required");if(!J)throw new Error("getTilePositions: coverBBox is required");if(!("x"in $)||!("y"in $)||!("width"in $)||!("height"in $))throw new Error("getTilePositions: tile must have x, y, width, and height properties");if(typeof J.x!=="number"||typeof J.y!=="number"||typeof J.width!=="number"||typeof J.height!=="number")throw new Error("getTilePositions: coverBBox must have numeric x, y, width, and height properties");let Z=[],K=Number($.x),Q=Number($.y),H=Number($.width),z=Number($.height);if(!isFinite(K)||!isFinite(Q)||!isFinite(H)||!isFinite(z))throw new Error("getTilePositions: tile dimensions must be finite numbers");if(H<=0||z<=0)return Z;let q=Math.floor((J.x-K)/H),W=Math.ceil((J.x+J.width-K)/H),j=Math.floor((J.y-Q)/z),G=Math.ceil((J.y+J.height-Q)/z);if(!isFinite(q)||!isFinite(W)||!isFinite(j)||!isFinite(G))throw new Error("getTilePositions: computed tile indices are not finite");for(let F=q;F<W;F++)for(let _=j;_<G;_++)Z.push({x:K7(K).plus(K7(H).mul(F)),y:K7(Q).plus(K7(z).mul(_))});return Z}function ZH($,J,Z={}){if(!$)throw new Error("resolvePattern: patternData is required");if(!J)throw new Error("resolvePattern: targetBBox is required");if(!Array.isArray($.children))throw new Error("resolvePattern: patternData.children must be an array");let{samples:K=20,maxTiles:Q=1000}=Z,H=[],z=eQ($,J);if(Number(z.width)<=0||Number(z.height)<=0)return H;let q=$H($,z,J),W=HH($.patternTransform),G=KH(z,J).slice(0,Q);for(let F of G){let _=i0(F.x,F.y);for(let U of $.children){let O=W.mul(_.mul(q)),V=JH(U,O,K);if(V.length>=3)H.push({polygon:V,fill:U.fill,stroke:U.stroke,strokeWidth:U.strokeWidth,opacity:U.opacity})}}return H}function QH($,J,Z={}){if(!$)throw new Error("patternToClipPath: patternData is required");if(!J)throw new Error("patternToClipPath: targetBBox is required");let K=ZH($,J,Z),Q=[];for(let{polygon:H,opacity:z}of K)if(z>0&&H.length>=3)if(Q.length===0)Q=H;else{let q=z6(Q,H);if(Array.isArray(q)&&q.length>0&&Array.isArray(q[0])&&q[0].length>=3)Q=q[0]}return Q}function hJ($,J,Z={}){if(!$)throw new Error("patternToPathData: patternData is required");if(!J)throw new Error("patternToPathData: targetBBox is required");let K=QH($,J,Z);if(!Array.isArray(K))return"";if(K.length<3)return"";let Q="";for(let H=0;H<K.length;H++){let z=K[H];if(!z||typeof z.x!=="number"||typeof z.y!=="number")throw new Error("patternToPathData: invalid polygon point - must have numeric x and y properties");if(!isFinite(z.x)||!isFinite(z.y))throw new Error("patternToPathData: polygon point coordinates must be finite numbers");let q=Number(z.x).toFixed(6),W=Number(z.y).toFixed(6);Q+=H===0?`M ${q} ${W}`:` L ${q} ${W}`}return Q+=" Z",Q}function HH($){if(!$)return _0.identity(3);return(void 0)($)}k.set({precision:80});function Y9($,J,Z,K=1,Q=!1){if(!$)throw new Error("getMarkerTransform: markerDef is required");if(!J||typeof J.x!=="number"||typeof J.y!=="number")throw new Error("getMarkerTransform: position must be an object with x and y numeric properties");if(typeof Z!=="number"||isNaN(Z)||!isFinite(Z))throw new Error("getMarkerTransform: tangentAngle must be a valid finite number");if(typeof K!=="number"||isNaN(K)||K<=0)throw new Error("getMarkerTransform: strokeWidth must be a positive number");let{markerWidth:H,markerHeight:z,refX:q,refY:W,orient:j,markerUnits:G,viewBox:F}=$;if(typeof H!=="number"||H<=0)throw new Error("getMarkerTransform: markerDef.markerWidth must be a positive number");if(typeof z!=="number"||z<=0)throw new Error("getMarkerTransform: markerDef.markerHeight must be a positive number");if(typeof q!=="number"||!isFinite(q))throw new Error("getMarkerTransform: markerDef.refX must be a finite number");if(typeof W!=="number"||!isFinite(W))throw new Error("getMarkerTransform: markerDef.refY must be a finite number");let _=_0.identity(3),U=i0(J.x,J.y);_=_.mul(U);let O=0;if(j==="auto")O=Z;else if(j==="auto-start-reverse")O=Q?Z+Math.PI:Z;else if(typeof j==="number")O=j*(Math.PI/180);if(O!==0){let X=O6(O);_=_.mul(X)}let V=1,M=1;if(G==="strokeWidth")V=K,M=K;if(F){let{width:X,height:w}=F;if(X>0&&w>0&&isFinite(X)&&isFinite(w)){let R=H/X,I=z/w;if(isFinite(R)&&isFinite(I)){let f=Math.min(R,I);V*=f,M*=f;let u=i0(-F.x,-F.y);_=_.mul(u)}}}if(V!==1||M!==1){let X=w7(V,M);_=_.mul(X)}let Y=i0(-q,-W);return _=_.mul(Y),_}function qH($){if(typeof $!=="string")throw new Error("getPathVertices: pathData must be a string");let J=[],Z=0,K=0,Q=0,H=0,z=yJ($);for(let q=0;q<z.length;q++){let W=z[q],j=Z,G=K;switch(W.type){case"M":if(Z=W.x,K=W.y,Q=Z,H=K,J.length>0){let F=J[J.length-1],_=Math.atan2(K-G,Z-j);F.tangentOut=_}J.push({x:Z,y:K,tangentIn:0,tangentOut:0,index:J.length});break;case"L":{Z=W.x,K=W.y;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:U,tangentOut:U,index:J.length});break}case"C":{Z=W.x,K=W.y;let F=W.x1-j,_=W.y1-G,U=F===0&&_===0?Math.atan2(W.y2-G,W.x2-j):Math.atan2(_,F),O=Z-W.x2,V=K-W.y2,M=O===0&&V===0?Math.atan2(K-W.y1,Z-W.x1):Math.atan2(V,O);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:M,tangentOut:M,index:J.length});break}case"Q":{Z=W.x,K=W.y;let F=W.x1-j,_=W.y1-G,U=F===0&&_===0?Math.atan2(K-G,Z-j):Math.atan2(_,F),O=Z-W.x1,V=K-W.y1,M=O===0&&V===0?Math.atan2(K-G,Z-j):Math.atan2(V,O);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:M,tangentOut:M,index:J.length});break}case"A":{Z=W.x,K=W.y;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;J.push({x:Z,y:K,tangentIn:U,tangentOut:U,index:J.length});break}case"Z":{Z=Q,K=H;let F=Z-j,_=K-G,U=F===0&&_===0?J.length>0?J[J.length-1].tangentOut:0:Math.atan2(_,F);if(J.length>0)J[J.length-1].tangentOut=U;if(J.length>0)J[0].tangentIn=U;break}default:break}}return J}function yJ($){if(typeof $!=="string")throw new Error("parsePathCommands: pathData must be a string");let J=[];if($.trim()==="")return J;let Z=$.replace(/([MmLlHhVvCcSsQqTtAaZz])/g," $1 ").trim(),K=/[MmLlHhVvCcSsQqTtAaZz]/,Q=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,H=[],z=0;while(z<Z.length){while(z<Z.length&&/[\s,]/.test(Z[z]))z++;if(z>=Z.length)break;if(K.test(Z[z]))H.push(Z[z]),z++;else{Q.lastIndex=z;let F=Q.exec(Z);if(F&&F.index===z)H.push(F[0]),z=Q.lastIndex;else z++}}let q=0,W=0,j=0,G=(F,_)=>{if(F>=H.length)throw new Error(`parsePathCommands: missing ${_} parameter at token ${F}`);let U=parseFloat(H[F]);if(isNaN(U)||!isFinite(U))throw new Error(`parsePathCommands: invalid ${_} value "${H[F]}" at token ${F}`);return U};while(q<H.length){let F=H[q];switch(F.toUpperCase()){case"M":{let _=G(q+1,"M.x"),U=G(q+2,"M.y");J.push({type:"M",x:F==="M"?_:W+_,y:F==="M"?U:j+U}),W=J[J.length-1].x,j=J[J.length-1].y,q+=3;break}case"L":{let _=G(q+1,"L.x"),U=G(q+2,"L.y");J.push({type:"L",x:F==="L"?_:W+_,y:F==="L"?U:j+U}),W=J[J.length-1].x,j=J[J.length-1].y,q+=3;break}case"H":{let _=G(q+1,"H.x");J.push({type:"L",x:F==="H"?_:W+_,y:j}),W=J[J.length-1].x,q+=2;break}case"V":{let _=G(q+1,"V.y");J.push({type:"L",x:W,y:F==="V"?_:j+_}),j=J[J.length-1].y,q+=2;break}case"C":{let _=G(q+1,"C.x1"),U=G(q+2,"C.y1"),O=G(q+3,"C.x2"),V=G(q+4,"C.y2"),M=G(q+5,"C.x"),Y=G(q+6,"C.y");J.push({type:"C",x1:F==="C"?_:W+_,y1:F==="C"?U:j+U,x2:F==="C"?O:W+O,y2:F==="C"?V:j+V,x:F==="C"?M:W+M,y:F==="C"?Y:j+Y}),W=J[J.length-1].x,j=J[J.length-1].y,q+=7;break}case"Q":{let _=G(q+1,"Q.x1"),U=G(q+2,"Q.y1"),O=G(q+3,"Q.x"),V=G(q+4,"Q.y");J.push({type:"Q",x1:F==="Q"?_:W+_,y1:F==="Q"?U:j+U,x:F==="Q"?O:W+O,y:F==="Q"?V:j+V}),W=J[J.length-1].x,j=J[J.length-1].y,q+=5;break}case"A":{let _=G(q+1,"A.rx"),U=G(q+2,"A.ry"),O=G(q+3,"A.rotation");if(q+4>=H.length||q+5>=H.length)throw new Error("parsePathCommands: missing arc flag parameters");let V=parseInt(H[q+4],10),M=parseInt(H[q+5],10);if(isNaN(V)||isNaN(M))throw new Error("parsePathCommands: invalid arc flag values");let Y=G(q+6,"A.x"),X=G(q+7,"A.y");J.push({type:"A",rx:_,ry:U,xAxisRotation:O,largeArcFlag:V,sweepFlag:M,x:F==="A"?Y:W+Y,y:F==="A"?X:j+X}),W=J[J.length-1].x,j=J[J.length-1].y,q+=8;break}case"Z":J.push({type:"Z"}),q+=1;break;default:q+=1}}return J}function uJ($,J){if(!$)throw new Error("resolveMarkers: pathElement is required");if(!J||typeof J!=="object")throw new Error("resolveMarkers: defsMap must be an object");let Z=[],K=$.getAttribute("marker-start"),Q=$.getAttribute("marker-mid"),H=$.getAttribute("marker-end"),z=$.getAttribute("stroke-width")||"1",q=parseFloat(z);if(isNaN(q)||q<=0)throw new Error("resolveMarkers: stroke-width must be a positive number");let W=$.getAttribute("d")||"",j=qH(W);if(j.length===0)return Z;let G=(F)=>{if(!F)return null;let _=F.match(/url\(#([^)]+)\)/);return _?_[1]:null};if(K){let F=G(K),_=F?J[F]:null;if(_&&j.length>0){let U=j[0],O=j.length>1?U.tangentOut:U.tangentIn;Z.push({markerDef:_,position:{x:U.x,y:U.y},transform:Y9(_,{x:U.x,y:U.y},O,q,!0),type:"start",vertex:U})}}if(Q&&j.length>2){let F=G(Q),_=F?J[F]:null;if(_)for(let U=1;U<j.length-1;U++){let O=j[U],V=O.tangentIn,Y=O.tangentOut-V;while(Y>Math.PI)Y-=2*Math.PI;while(Y<-Math.PI)Y+=2*Math.PI;let X=V+Y/2;Z.push({markerDef:_,position:{x:O.x,y:O.y},transform:Y9(_,{x:O.x,y:O.y},X,q,!1),type:"mid",vertex:O})}}if(H){let F=G(H),_=F?J[F]:null;if(_&&j.length>0){let U=j[j.length-1],O=U.tangentIn;Z.push({markerDef:_,position:{x:U.x,y:U.y},transform:Y9(_,{x:U.x,y:U.y},O,q,!1),type:"end",vertex:U})}}return Z}function WH($,J={}){if(!$)throw new Error("markerToPolygons: markerInstance is required");if(!$.markerDef)throw new Error("markerToPolygons: markerInstance.markerDef is required");if(!$.transform)throw new Error("markerToPolygons: markerInstance.transform is required");let{precision:Z=2,curveSegments:K=10}=J;if(typeof Z!=="number"||Z<0)throw new Error("markerToPolygons: precision must be a non-negative number");if(typeof K!=="number"||K<=0)throw new Error("markerToPolygons: curveSegments must be a positive number");let Q=[],{markerDef:H,transform:z}=$;if(!Array.isArray(H.children))throw new Error("markerToPolygons: markerDef.children must be an array");for(let q of H.children){let W=[];switch(q.type){case"path":W=jH(q.d,K);break;case"rect":W=[{x:q.x,y:q.y},{x:q.x+q.width,y:q.y},{x:q.x+q.width,y:q.y+q.height},{x:q.x,y:q.y+q.height}];break;case"circle":W=GH(q.cx,q.cy,q.r,K*4);break;case"ellipse":W=FH(q.cx,q.cy,q.rx,q.ry,K*4);break;case"line":W=[{x:q.x1,y:q.y1},{x:q.x2,y:q.y2}];break;case"polygon":case"polyline":W=_H(q.points);break;default:break}if(W.length>0){let j=W.map((G)=>{let F=c0(z,G.x,G.y);return{x:parseFloat(F[0].toFixed(Z)),y:parseFloat(F[1].toFixed(Z))}});Q.push(j)}}return Q}function jH($,J=10){if(typeof $!=="string")throw new Error("pathToPoints: pathData must be a string");if(typeof J!=="number"||J<=0)throw new Error("pathToPoints: segments must be a positive number");let Z=[],K=yJ($),Q=0,H=0;for(let z of K)switch(z.type){case"M":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;case"L":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;case"C":for(let q=1;q<=J;q++){let W=q/J,j=1-W,G=j*j*j*Q+3*j*j*W*z.x1+3*j*W*W*z.x2+W*W*W*z.x,F=j*j*j*H+3*j*j*W*z.y1+3*j*W*W*z.y2+W*W*W*z.y;Z.push({x:G,y:F})}Q=z.x,H=z.y;break;case"Q":for(let q=1;q<=J;q++){let W=q/J,j=1-W,G=j*j*Q+2*j*W*z.x1+W*W*z.x,F=j*j*H+2*j*W*z.y1+W*W*z.y;Z.push({x:G,y:F})}Q=z.x,H=z.y;break;case"A":Q=z.x,H=z.y,Z.push({x:Q,y:H});break;default:break}return Z}function GH($,J,Z,K=32){if(typeof $!=="number"||!isFinite($))throw new Error("circleToPoints: cx must be a finite number");if(typeof J!=="number"||!isFinite(J))throw new Error("circleToPoints: cy must be a finite number");if(typeof Z!=="number"||!isFinite(Z)||Z<0)throw new Error("circleToPoints: r must be a non-negative finite number");if(typeof K!=="number"||K<=0)throw new Error("circleToPoints: segments must be a positive number");let Q=[];for(let H=0;H<K;H++){let z=H/K*2*Math.PI;Q.push({x:$+Z*Math.cos(z),y:J+Z*Math.sin(z)})}return Q}function FH($,J,Z,K,Q=32){if(typeof $!=="number"||!isFinite($))throw new Error("ellipseToPoints: cx must be a finite number");if(typeof J!=="number"||!isFinite(J))throw new Error("ellipseToPoints: cy must be a finite number");if(typeof Z!=="number"||!isFinite(Z)||Z<0)throw new Error("ellipseToPoints: rx must be a non-negative finite number");if(typeof K!=="number"||!isFinite(K)||K<0)throw new Error("ellipseToPoints: ry must be a non-negative finite number");if(typeof Q!=="number"||Q<=0)throw new Error("ellipseToPoints: segments must be a positive number");let H=[];for(let z=0;z<Q;z++){let q=z/Q*2*Math.PI;H.push({x:$+Z*Math.cos(q),y:J+K*Math.sin(q)})}return H}function _H($){if(typeof $!=="string")throw new Error("parsePoints: pointsStr must be a string");let J=[],Z=$.trim().split(/[\s,]+/).map(Number).filter((K)=>!isNaN(K)&&isFinite(K));if(Z.length%2!==0)throw new Error("parsePoints: pointsStr must contain an even number of valid coordinates");for(let K=0;K<Z.length;K+=2)J.push({x:Z[K],y:Z[K+1]});return J}function gJ($,J=2){if(!Array.isArray($))throw new Error("markersToPathData: markerInstances must be an array");if(typeof J!=="number"||J<0)throw new Error("markersToPathData: precision must be a non-negative number");let Z=[];for(let K of $){let Q=WH(K,{precision:J});for(let H of Q){if(H.length===0)continue;let z=H[0];Z.push(`M ${z.x.toFixed(J)} ${z.y.toFixed(J)}`);for(let q=1;q<H.length;q++){let W=H[q];Z.push(`L ${W.x.toFixed(J)} ${W.y.toFixed(J)}`)}Z.push("Z")}}return Z.join(" ")}k.set({precision:80});var k0=($)=>$ instanceof k?$:new k($),r0=new k(0),L6=new k(1);function w6(){let $=k.precision;if($<20)throw new Error(`Decimal precision (${$}) is too low for verification. Minimum required: 20`);let J=Math.max(1,$-10);return new k(10).pow(-J)}function pJ($,J,Z){let K=w6();if(!$)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix parameter is null or undefined"};if(J==null||Z==null)return{valid:!1,error:new k(1/0),tolerance:K,message:"Coordinates x or y are null or undefined"};let Q=k0(J),H=k0(Z);try{let[z,q]=c0($,Q,H),W=$.inverse();if(!W)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix is not invertible (determinant = 0)",details:{determinant:$.determinant()}};let[j,G]=c0(W,z,q),F=Q.minus(j).abs(),_=H.minus(G).abs(),U=k.max(F,_),O=U.lessThan(K);return{valid:O,error:U,tolerance:K,message:O?`Round-trip verified: error ${U.toExponential()} < tolerance ${K.toExponential()}`:`Round-trip FAILED: error ${U.toExponential()} >= tolerance ${K.toExponential()}`,details:{original:{x:Q.toString(),y:H.toString()},transformed:{x:z.toString(),y:q.toString()},recovered:{x:j.toString(),y:G.toString()},errorX:F.toExponential(),errorY:_.toExponential()}}}catch(z){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${z.message}`}}}function X9($){let J=w6();if(!$)return{valid:!1,error:new k(1/0),tolerance:J,message:"Matrix parameter is null or undefined"};try{let Z=$.inverse();if(!Z)return{valid:!1,error:new k(1/0),tolerance:J,message:"Matrix is singular (not invertible)",details:{determinant:$.determinant().toString()}};let K=$.mul(Z),Q=$.rows,H=r0,z=[];for(let W=0;W<Q;W++)for(let j=0;j<Q;j++){let G=W===j?L6:r0,F=K.data[W][j],_=F.minus(G).abs();if(_.greaterThan(H))H=_;if(_.greaterThanOrEqualTo(J))z.push({row:W,col:j,expected:G.toString(),actual:F.toString(),error:_.toExponential()})}let q=H.lessThan(J);return{valid:q,error:H,tolerance:J,message:q?`Matrix inversion verified: max error ${H.toExponential()} < tolerance`:`Matrix inversion FAILED: max error ${H.toExponential()} at ${z.length} positions`,details:{matrixSize:`${Q}x${Q}`,maxError:H.toExponential(),failedElements:z.slice(0,5)}}}catch(Z){return{valid:!1,error:new k(1/0),tolerance:J,message:`Verification error: ${Z.message}`}}}function xJ($,J,Z=null){let K=w6(),Q=Z||new k("1e-6");if(!$||!Array.isArray($))return{valid:!1,error:r0,tolerance:K,message:"Inner polygon parameter is null, undefined, or not an array"};if(!J||!Array.isArray(J))return{valid:!1,error:r0,tolerance:K,message:"Outer polygon parameter is null, undefined, or not an array"};if($.length<3||J.length<3)return{valid:!1,error:r0,tolerance:K,message:"Polygons must have at least 3 vertices"};try{let H=!0,z=[],q=r0;for(let W=0;W<$.length;W++){let j=$[W];if(!MH(j,J)){let G=VH(j,J);if(G.greaterThan(q))q=G;if(G.greaterThan(Q))H=!1,z.push({index:W,x:j.x.toString(),y:j.y.toString(),distanceOutside:G.toExponential()})}}return{valid:H,error:q,tolerance:Q,message:H?`All inner polygon points are inside or within tolerance (max outside: ${q.toExponential()})`:`${z.length} points exceed tolerance distance outside outer polygon`,details:{innerVertices:$.length,outerVertices:J.length,maxOutsideDistance:q.toExponential(),outsidePoints:z.slice(0,5)}}}catch(H){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${H.message}`}}}function VH($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||!Array.isArray(J)||J.length===0)throw new Error("Invalid polygon parameter: must be non-empty array of points");let Z=new k(1/0),K=k0($.x),Q=k0($.y);for(let H=0;H<J.length;H++){let z=(H+1)%J.length,q=J[H],W=J[z],j=k0(q.x),G=k0(q.y),F=k0(W.x),_=k0(W.y),U=F.minus(j),O=_.minus(G),V=U.times(U).plus(O.times(O)),M;if(V.isZero())M=nJ($,q);else{let Y=k.max(r0,k.min(L6,K.minus(j).times(U).plus(Q.minus(G).times(O)).div(V))),X=j.plus(Y.times(U)),w=G.plus(Y.times(O));M=K.minus(X).pow(2).plus(Q.minus(w).pow(2)).sqrt()}if(M.lessThan(Z))Z=M}return Z}function cJ($,J,Z){let K=w6();if(!$||!Array.isArray($))return{valid:!1,error:r0,tolerance:K,message:"Poly1 parameter must be an array"};if(!J||!Array.isArray(J))return{valid:!1,error:r0,tolerance:K,message:"Poly2 parameter must be an array"};if(!Z||!Array.isArray(Z))return{valid:!1,error:r0,tolerance:K,message:"Intersection parameter must be an array"};if(Z.length<3)return{valid:!0,error:r0,tolerance:K,message:"Intersection is empty or degenerate (valid result)",details:{intersectionVertices:Z.length}};try{let Q=xJ(Z,$),H=xJ(Z,J),z=x6($),q=x6(J),W=x6(Z),j=k.min(z,q),G=W.lessThanOrEqualTo(j.times(L6.plus(K))),F=Q.valid&&H.valid&&G;return{valid:F,error:F?r0:L6,tolerance:K,message:F?"Intersection verified: contained in both polygons, area valid":`Intersection FAILED: ${!Q.valid?"not in poly1, ":""}${!H.valid?"not in poly2, ":""}${!G?"area too large":""}`,details:{containedInPoly1:Q.valid,containedInPoly2:H.valid,area1:z.toString(),area2:q.toString(),intersectionArea:W.toString(),areaValid:G}}}catch(Q){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${Q.message}`}}}function lJ($,J,Z){let K=w6();if(!$||typeof $!=="object")return{valid:!1,error:new k(1/0),tolerance:K,message:"Original gradient parameter must be an object"};if(!J||typeof J!=="object")return{valid:!1,error:new k(1/0),tolerance:K,message:"Baked gradient parameter must be an object"};if(!Z)return{valid:!1,error:new k(1/0),tolerance:K,message:"Matrix parameter is null or undefined"};try{let[Q,H]=c0(Z,k0($.x1||0),k0($.y1||0)),[z,q]=c0(Z,k0($.x2||1),k0($.y2||0)),W=k0(J.x1).minus(Q).abs(),j=k0(J.y1).minus(H).abs(),G=k0(J.x2).minus(z).abs(),F=k0(J.y2).minus(q).abs(),_=k.max(W,j,G,F),U=_.lessThan(K);return{valid:U,error:_,tolerance:K,message:U?`Linear gradient transform verified: max error ${_.toExponential()}`:`Linear gradient transform FAILED: max error ${_.toExponential()}`,details:{expected:{x1:Q.toString(),y1:H.toString(),x2:z.toString(),y2:q.toString()},actual:J}}}catch(Q){return{valid:!1,error:new k(1/0),tolerance:K,message:`Verification error: ${Q.message}`}}}function x6($){if(!$||!Array.isArray($))throw new Error("Invalid polygon parameter: must be an array");if($.length<3)return r0;let J=r0,Z=$.length;for(let K=0;K<Z;K++){let Q=(K+1)%Z,H=k0($[K].x),z=k0($[K].y),q=k0($[Q].x),W=k0($[Q].y);J=J.plus(H.times(W).minus(q.times(z)))}return J.abs().div(2)}function MH($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||!Array.isArray(J)||J.length===0)throw new Error("Invalid polygon parameter: must be non-empty array of points");let Z=k0($.x),K=k0($.y),Q=J.length,H=!1;for(let z=0,q=Q-1;z<Q;q=z++){let W=k0(J[z].x),j=k0(J[z].y),G=k0(J[q].x),F=k0(J[q].y);if(OH($,J[z],J[q]))return!0;if(j.greaterThan(K)!==F.greaterThan(K)&&Z.lessThan(G.minus(W).times(K.minus(j)).div(F.minus(j)).plus(W)))H=!H}return H}function OH($,J,Z){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid segStart parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid segEnd parameter: must have x and y properties");let K=w6(),Q=k0($.x),H=k0($.y),z=k0(J.x),q=k0(J.y),W=k0(Z.x),j=k0(Z.y),G=k.min(z,W).minus(K),F=k.max(z,W).plus(K),_=k.min(q,j).minus(K),U=k.max(q,j).plus(K);if(Q.lessThan(G)||Q.greaterThan(F)||H.lessThan(_)||H.greaterThan(U))return!1;let O=W.minus(z).times(H.minus(q)).minus(j.minus(q).times(Q.minus(z))).abs(),V=nJ(J,Z);return O.div(V.plus(K)).lessThan(K)}function nJ($,J){if(!$||$.x==null||$.y==null)throw new Error("Invalid p1 parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid p2 parameter: must have x and y properties");let Z=k0(J.x).minus(k0($.x)),K=k0(J.y).minus(k0($.y));return Z.times(Z).plus(K.times(K)).sqrt()}function sJ($,J){if(!$||$.length<3||!J||J.length<3)return[];let Z=[];for(let K=0;K<J.length;K++){let Q=J[K],H=J[(K+1)%J.length],z=[];for(let q=0;q<$.length;q++){let W=$[q],j=$[(q+1)%$.length],G=!mJ(W,Q,H),F=!mJ(j,Q,H);if(G){if(z.push(W),!F)z.push(dJ(W,j,Q,H))}else if(F)z.push(dJ(W,j,Q,H))}if(z.length>=3)Z.push(z)}return Z}function oJ($,J,Z=[],K="1e-10"){let Q=K instanceof k?K:new k(K),H=Z||[];if(!$||!Array.isArray($))return{valid:!1,error:new k(1/0),tolerance:Q,message:"Original polygon parameter must be an array"};if(!J||!Array.isArray(J))return{valid:!1,error:new k(1/0),tolerance:Q,message:"Clipped polygon parameter must be an array"};try{let z=x6($),q=J.length>=3?x6(J):r0,W=z.minus(q),j=q.lessThanOrEqualTo(z.times(L6.plus(Q))),G=W.greaterThanOrEqualTo(r0.minus(Q.times(z))),F=z.isZero()?L6:q.div(z),_=r0,U=j&&G;return{valid:U,error:_,tolerance:Q,message:U?`ClipPath E2E verified: area conserved (clipped ${F.times(100).toFixed(2)}% of original)`:"ClipPath E2E FAILED: invalid intersection (clipped > original or negative outside)",details:{originalArea:z.toString(),clippedArea:q.toString(),outsideArea:W.toString(),areaRatio:F.toFixed(6),fragmentCount:H.length,clippedValid:j,outsideValid:G}}}catch(z){return{valid:!1,error:new k(1/0),tolerance:Q,message:`E2E verification error: ${z.message}`}}}function mJ($,J,Z){if(!$||$.x==null||$.y==null)throw new Error("Invalid point parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid edgeStart parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid edgeEnd parameter: must have x and y properties");let K=k0($.x).toNumber(),Q=k0($.y).toNumber(),H=k0(J.x).toNumber(),z=k0(J.y).toNumber(),q=k0(Z.x).toNumber(),W=k0(Z.y).toNumber();return(q-H)*(Q-z)-(W-z)*(K-H)>=0}function dJ($,J,Z,K){if(!$||$.x==null||$.y==null)throw new Error("Invalid p1 parameter: must have x and y properties");if(!J||J.x==null||J.y==null)throw new Error("Invalid p2 parameter: must have x and y properties");if(!Z||Z.x==null||Z.y==null)throw new Error("Invalid p3 parameter: must have x and y properties");if(!K||K.x==null||K.y==null)throw new Error("Invalid p4 parameter: must have x and y properties");let Q=k0($.x).toNumber(),H=k0($.y).toNumber(),z=k0(J.x).toNumber(),q=k0(J.y).toNumber(),W=k0(Z.x).toNumber(),j=k0(Z.y).toNumber(),G=k0(K.x).toNumber(),F=k0(K.y).toNumber(),_=(Q-z)*(j-F)-(H-q)*(W-G);if(Math.abs(_)<0.0000000001)return{x:k0((Q+z)/2),y:k0((H+q)/2)};let U=((Q-W)*(j-F)-(H-j)*(W-G))/_;return{x:k0(Q+U*(z-Q)),y:k0(H+U*(q-H))}}var tJ=["animate","animateTransform","animateMotion","animateColor","set"],iJ=["href","xlink:href"],rJ=["fill","stroke","clip-path","mask","filter","marker-start","marker-mid","marker-end","cursor","color-profile"],XH=["begin","end"],kH=["values","from","to","by"];function k9($){if(!$||typeof $!=="string")return null;let J=$.match(/url\(\s*["']?#([^"')\s]+)\s*["']?\s*\)/);return J&&J[1]?J[1]:null}function aJ($){if(!$||typeof $!=="string")return null;if($.startsWith("#")){let J=$.substring(1);return J&&!J.startsWith("#")?J:null}return null}function eJ($){if(!$||typeof $!=="string")return[];let J=[],Z=$.split(";");for(let K of Z){let Q=K.trim();if(Q.startsWith("#")){let z=Q.substring(1);if(z)J.push(z)}let H=k9(Q);if(H)J.push(H)}return J}function $5($){if(!$||typeof $!=="string")return[];let J=[],Z=$.split(";");for(let K of Z){let H=K.trim().match(/^([a-zA-Z_][a-zA-Z0-9_-]*)\.(begin|end|click|mousedown|mouseup|mouseover|mouseout|mousemove|mouseenter|mouseleave|focusin|focusout|activate|repeat)(?:[+-]\d+(?:\.\d+)?[a-z]*)?/);if(H)J.push(H[1])}return J}function m6($){if(!$||typeof $!=="string")return[];let J=[],Z=/url\(\s*["']?#([^"')]+)["']?\s*\)/g,K;while((K=Z.exec($))!==null)if(K[1])J.push(K[1]);return J}function J5($){if(!$||typeof $!=="string")return[];let J=[],Z=/getElementById\(\s*["']([^"']+)["']\s*\)/g,K;while((K=Z.exec($))!==null)if(K[1])J.push(K[1]);let Q=/querySelector(?:All)?\(\s*["']#([^"'#\s]+)["']\s*\)/g;while((K=Q.exec($))!==null)if(K[1])J.push(K[1]);return J}function LH($){if(!$||typeof $!=="object"||!($ instanceof B0))throw new TypeError("collectElementReferences: el must be a valid SVGElement");if(typeof $.getAttributeNames!=="function")throw new TypeError("collectElementReferences: el must have getAttributeNames method");let J={static:new Set,animation:new Set,css:new Set,js:new Set},Z=$.tagName?.toLowerCase()||"",K=tJ.includes(Z),Q=$.getAttributeNames();if(!Array.isArray(Q))throw new TypeError("collectElementReferences: getAttributeNames must return an array");for(let H of Q){let z=$.getAttribute(H);if(!z)continue;if(iJ.includes(H)){let q=aJ(z);if(q)if(K)J.animation.add(q);else J.static.add(q)}if(rJ.includes(H)||H==="style"){let q=k9(z);if(q)J.static.add(q);if(H==="style")m6(z).forEach((W)=>J.css.add(W))}if(XH.includes(H))$5(z).forEach((q)=>J.animation.add(q));if(kH.includes(H))eJ(z).forEach((q)=>J.animation.add(q));if(!rJ.includes(H)&&z.includes("url(")){let q=k9(z);if(q)J.static.add(q)}}if(Z==="animatemotion"){if(typeof $.getElementsByTagName!=="function")throw new TypeError("collectElementReferences: el must have getElementsByTagName method");let H=$.getElementsByTagName("mpath");if(!H||typeof H[Symbol.iterator]!=="function")throw new TypeError("collectElementReferences: getElementsByTagName must return an iterable");for(let z of H){if(!z||typeof z.getAttribute!=="function")continue;for(let q of iJ){let W=z.getAttribute(q),j=aJ(W);if(j)J.animation.add(j)}}}return J}function K5($){if(!$||typeof $!=="object"||!($ instanceof B0))throw new TypeError("collectAllReferences: root must be a valid SVGElement");let J={all:new Set,static:new Set,animation:new Set,css:new Set,js:new Set,details:new Map},Z={animation:4,js:3,css:2,static:1},K=(H,z,q)=>{if(J.all.add(H),J[z].add(H),!J.details.has(H))J.details.set(H,{sources:[],type:z});else{let W=J.details.get(H);if(Z[z]>Z[W.type])W.type=z}J.details.get(H).sources.push(q)},Q=(H,z="")=>{let q=H.tagName?.toLowerCase()||"",W=z?`${z}>${q}`:q,j=H.getAttribute("id"),G=j?`${q}#${j}`:W,F=LH(H);if(F.static.forEach((_)=>K(_,"static",G)),F.animation.forEach((_)=>K(_,"animation",G)),F.css.forEach((_)=>K(_,"css",G)),F.js.forEach((_)=>K(_,"js",G)),q==="style"){let _=H.textContent||"";m6(_).forEach((U)=>K(U,"css","<style>"))}if(q==="script"){let _=H.textContent||"";J5(_).forEach((U)=>K(U,"js","<script>"))}if(H.children&&typeof H.children[Symbol.iterator]==="function"){for(let _ of H.children)if(_ instanceof B0)Q(_,W)}};return Q($),J}k.set({precision:80});var Y7=($)=>$ instanceof k?$:new k($),wH={precision:6,curveSegments:20,clipSegments:64,bezierArcs:8,resolveUse:!0,resolveMarkers:!0,resolvePatterns:!0,resolveMasks:!0,resolveClipPaths:!0,flattenTransforms:!0,bakeGradients:!0,removeUnusedDefs:!0,preserveIds:!1,svg2Polyfills:!1,e2eTolerance:"1e-10"};function B6($,J={}){if($===null||$===void 0)throw new Error("flattenSVG: svgString parameter is required");if(typeof $!=="string")throw new Error(`flattenSVG: svgString must be a string, got ${typeof $}`);if($.trim().length===0)throw new Error("flattenSVG: svgString cannot be empty");let Z={...wH,...J},K={useResolved:0,markersResolved:0,patternsResolved:0,masksResolved:0,clipPathsApplied:0,transformsFlattened:0,gradientsProcessed:0,defsRemoved:0,errors:[],verifications:{transforms:[],matrices:[],polygons:[],gradients:[],e2e:[],passed:0,failed:0,allPassed:!0},clipOutsideFragments:[]};try{let Q=d0($);if(Q.tagName.toLowerCase()!=="svg")throw new Error("Root element must be <svg>");let H=r7(Q),z=Z.removeUnusedDefs?TH(Q):null;if(Z.resolveUse){let W=RH(Q,H,Z);K.useResolved=W.count,K.errors.push(...W.errors),H=r7(Q)}if(Z.resolveMarkers){let W=BH(Q,H,Z);K.markersResolved=W.count,K.errors.push(...W.errors)}if(Z.resolvePatterns){let W=NH(Q,H,Z);K.patternsResolved=W.count,K.errors.push(...W.errors)}if(Z.resolveMasks){let W=IH(Q,H,Z);K.masksResolved=W.count,K.errors.push(...W.errors)}if(Z.resolveClipPaths){let W=CH(Q,H,Z,K);K.clipPathsApplied=W.count,K.errors.push(...W.errors)}if(Z.flattenTransforms){let W=PH(Q,Z,K);K.transformsFlattened=W.count,K.errors.push(...W.errors)}if(Z.bakeGradients){let W=EH(Q,Z,K);K.gradientsProcessed=W.count,K.errors.push(...W.errors)}if(Z.removeUnusedDefs&&z){let W=bH(Q,z);K.defsRemoved=W.count}return{svg:N7(Q),stats:K}}catch(Q){return K.errors.push(`Pipeline error: ${Q.message}`),{svg:$,stats:K}}}var z5=new Set(["animate","animatetransform","animatemotion","animatecolor","set"]),q5=new Set(["foreignobject","audio","video","iframe","script","style",...z5]);function L9($){if(!$)return!1;let J=$.tagName?.toLowerCase();if(q5.has(J))return!0;for(let Z of $.children||[])if(Z&&Z.tagName&&L9(Z))return!0;return!1}function RH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllUseElements: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllUseElements: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllUseElements: opts must be an object");let K=[],Q=0,H=$.getElementsByTagName("use"),z={};for(let[q,W]of J.entries())if(W.tagName.toLowerCase()==="symbol")z[q]=bJ(W),z[q].type="symbol";else z[q]=R$(W);for(let q of[...H])try{let W=q.getAttribute("href")||q.getAttribute("xlink:href");if(!W)continue;let j=W.replace(/^#/,""),G=J.get(j);if(!G){K.push(`use: referenced element #${j} not found`);continue}let F=L9(G),_=L9(q);if(F||_){let M=G.cloneNode(!0),Y=parseFloat(q.getAttribute("x")||"0"),X=parseFloat(q.getAttribute("y")||"0");if(isNaN(Y)||isNaN(X)){K.push(`use: invalid x/y coordinates for element #${j}`);continue}let w=q.getAttribute("transform")||"",R="";if(w)R=w;if(Y!==0||X!==0){let m=`translate(${Y}, ${X})`;R=R?`${R} ${m}`:m}let I=new B0("g",{});if(R)I.setAttribute("transform",R);let f=d6(q);for(let[m,S]of Object.entries(f))if(S&&!I.hasAttribute(m))I.setAttribute(m,S);if(G.tagName.toLowerCase()==="symbol"){for(let m of M.children||[])if(m&&m.tagName)I.appendChild(m.cloneNode(!0))}else M.removeAttribute("id"),I.appendChild(M);for(let m of q.children||[])if(m&&m.tagName){let S=m.tagName.toLowerCase();if(z5.has(S))I.appendChild(m.cloneNode(!0))}if(q.parentNode)q.parentNode.replaceChild(I,q),Q++;continue}let U=TJ(q),O=O9(U,z,{samples:Z.curveSegments});if(!O){K.push(`use: failed to resolve #${j}`);continue}let V=vJ(O,Z.curveSegments);if(V){let M=new B0("path",{d:V,...d6(q)});if(O.style){for(let[Y,X]of Object.entries(O.style))if(X&&!M.hasAttribute(Y))M.setAttribute(Y,X)}if(q.parentNode)q.parentNode.replaceChild(M,q),Q++}}catch(W){K.push(`use: ${W.message}`)}return{count:Q,errors:K}}function BH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllMarkers: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllMarkers: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllMarkers: opts must be an object");let K=[],Q=0,H=["marker-start","marker-mid","marker-end","marker"];for(let z of H){let q=g7($,z);for(let W of q){if(W.tagName!=="path"&&W.tagName!=="line"&&W.tagName!=="polyline"&&W.tagName!=="polygon")continue;try{let j=uJ(W,Object.fromEntries(J));if(!j||j.length===0)continue;let G=gJ(j,Z.precision);if(G){let F=new B0("path",{d:G,fill:W.getAttribute("stroke")||"currentColor"});if(W.parentNode){let _=W.nextSibling;if(_)W.parentNode.insertBefore(F,_);else W.parentNode.appendChild(F);Q++}}for(let F of H)W.removeAttribute(F)}catch(j){K.push(`marker: ${j.message}`)}}}return{count:Q,errors:K}}function NH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllPatterns: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllPatterns: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllPatterns: opts must be an object");let K=[],Q=0,H=g7($,"fill");for(let z of H){let q=z.getAttribute("fill");if(!q||!q.includes("url("))continue;let W=a7(q);if(!W)continue;let j=J.get(W);if(!j||j.tagName.toLowerCase()!=="pattern")continue;try{let G=j.getAttribute("patternUnits")||"objectBoundingBox",F=j.getAttribute("patternContentUnits")||"userSpaceOnUse",_=j.getAttribute("patternTransform");if(G!=="objectBoundingBox")K.push(`pattern ${W}: non-default patternUnits="${G}" may cause rendering issues`);if(F!=="userSpaceOnUse")K.push(`pattern ${W}: non-default patternContentUnits="${F}" may cause rendering issues`);if(_)K.push(`pattern ${W}: patternTransform present - complex transformation may cause rendering issues`);let U=W5(z);if(!U)continue;let O=DJ(j),V=hJ(O,U,{samples:Z.curveSegments});if(V){let M=new B0("g",{}),Y=new B0("path",{d:V,fill:"#000"});if(M.appendChild(Y),z.setAttribute("fill","none"),z.setAttribute("stroke",z.getAttribute("stroke")||"none"),z.parentNode)z.parentNode.insertBefore(M,z),Q++}}catch(G){K.push(`pattern: ${G.message}`)}}return{count:Q,errors:K}}function IH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("resolveAllMasks: invalid root element");if(!J||!(J instanceof Map))throw new Error("resolveAllMasks: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("resolveAllMasks: opts must be an object");let K=[],Q=0,H=g7($,"mask");for(let z of H){let q=z.getAttribute("mask");if(!q||!q.includes("url("))continue;let W=a7(q);if(!W)continue;let j=J.get(W);if(!j||j.tagName.toLowerCase()!=="mask")continue;try{let G=j.getAttribute("maskUnits")||"objectBoundingBox",F=j.getAttribute("maskContentUnits")||"userSpaceOnUse";if(G!=="objectBoundingBox")K.push(`mask ${W}: non-default maskUnits="${G}" may cause rendering issues`);if(F!=="userSpaceOnUse")K.push(`mask ${W}: non-default maskContentUnits="${F}" may cause rendering issues`);let _=W5(z);if(!_)continue;let U=AJ(j),O=EJ(U,_,{samples:Z.curveSegments,opacityThreshold:0.5});if(O){let V=R6(z,Z.precision);if(V){let M=t7(V,Z.curveSegments),Y=t7(O,Z.curveSegments),X=j5(M,Y);if(X&&X.length>2){let w=V9(X,Z.precision);z.setAttribute("d",w),z.removeAttribute("mask"),Q++}}}}catch(G){K.push(`mask: ${G.message}`)}}return{count:Q,errors:K}}function CH($,J,Z,K){if(!$||!$.getElementsByTagName)throw new Error("applyAllClipPaths: invalid root element");if(!J||!(J instanceof Map))throw new Error("applyAllClipPaths: defsMap must be a Map");if(!Z||typeof Z!=="object")throw new Error("applyAllClipPaths: opts must be an object");if(!K||typeof K!=="object")throw new Error("applyAllClipPaths: stats must be an object");let Q=[],H=0;if(!K.verifications.e2e)K.verifications.e2e=[];if(!K.clipOutsideFragments)K.clipOutsideFragments=[];let z=g7($,"clip-path");for(let q of z){let W=q.getAttribute("clip-path");if(!W||!W.includes("url("))continue;let j=a7(W);if(!j)continue;let G=J.get(j),F=G?G.tagName.toLowerCase():"";if(!G||F!=="clippath")continue;try{if((G.getAttribute("clipPathUnits")||"userSpaceOnUse")==="objectBoundingBox")Q.push(`clipPath ${j}: objectBoundingBox units require bbox-relative coordinate transformation`);let U=R6(q,Z.precision);if(!U)continue;let O="";if(G.children&&G.children.length>0){for(let I of G.children)if(I&&I.tagName){let f=R6(I,Z.precision);if(f)O+=(O?" ":"")+f}}if(!O)continue;let V=Z.clipSegments||64,M=t7(U,V),Y=t7(O,V),X=j5(M,Y),w=M.map((I)=>({x:I.x instanceof k?I.x:Y7(I.x),y:I.y instanceof k?I.y:Y7(I.y)})),R=Y.map((I)=>({x:I.x instanceof k?I.x:Y7(I.x),y:I.y instanceof k?I.y:Y7(I.y)}));if(X&&X.length>2){let I=X.map((x)=>({x:x.x instanceof k?x.x:Y7(x.x),y:x.y instanceof k?x.y:Y7(x.y)})),f=cJ(w,R,I);if(K.verifications.polygons.push({element:q.tagName,clipPathId:j,...f}),f.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1;let u=sJ(w,R);K.clipOutsideFragments.push({elementId:q.getAttribute("id")||`clip-${H}`,clipPathId:j,fragments:u,visible:!1});let m=Z.e2eTolerance||"1e-10",S=oJ(w,I,u,m);if(K.verifications.e2e.push({element:q.tagName,clipPathId:j,type:"clip-area-conservation",...S}),S.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1}if(X&&X.length>2){let I=V9(X,Z.precision),f=q;if(q.tagName==="path")q.setAttribute("d",I);else{let u=new B0("path",{d:I,...d6(q)});if(q.parentNode)q.parentNode.replaceChild(u,q),f=u}f.removeAttribute("clip-path"),H++}}catch(_){Q.push(`clipPath: ${_.message}`)}}return{count:H,errors:Q}}function PH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("flattenAllTransforms: invalid root element");if(!J||typeof J!=="object")throw new Error("flattenAllTransforms: opts must be an object");if(!Z||typeof Z!=="object")throw new Error("flattenAllTransforms: stats must be an object");let K=[],Q=0,H=g7($,"transform");for(let z of H){let q=z.getAttribute("transform");if(!q)continue;try{let W=j7(q),j=X9(W);if(Z.verifications.matrices.push({element:z.tagName,transform:q,...j}),j.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1;let G=R6(z,J.precision);if(!G){if(z.tagName==="g")AH(z,W,J,Z),z.removeAttribute("transform"),Q++;continue}let F=[],_=t7(G,4);if(_&&_.length>0)F=_.slice(0,4).map((V)=>({x:V.x instanceof k?V.x:Y7(V.x),y:V.y instanceof k?V.y:Y7(V.y)}));let U=Y6(G,W,{precision:J.precision});for(let V=0;V<F.length;V++){let M=F[V],Y=pJ(W,M.x,M.y);if(Z.verifications.transforms.push({element:z.tagName,pointIndex:V,...Y}),Y.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1}let O=z;if(z.tagName==="path")z.setAttribute("d",U);else{let V=new B0("path",{d:U,...d6(z)});for(let M of fH(z.tagName))V.removeAttribute(M);if(z.parentNode)z.parentNode.replaceChild(V,z),O=V}O.removeAttribute("transform"),Q++}catch(W){K.push(`transform: ${W.message}`)}}return{count:Q,errors:K}}function AH($,J,Z,K){if(!$||!$.children)throw new Error("propagateTransformToChildren: invalid group element");if(!J||!J.data)throw new Error("propagateTransformToChildren: invalid matrix");if(!Z||typeof Z!=="object")throw new Error("propagateTransformToChildren: opts must be an object");if(!K||typeof K!=="object")throw new Error("propagateTransformToChildren: stats must be an object");for(let Q of[...$.children]){if(!(Q&&Q.tagName))continue;if(Q.tagName==="g"){let H=Q.getAttribute("transform");if(H){let z=j7(H),q=J.mul(z);Q.setAttribute("transform",Z5(q))}else Q.setAttribute("transform",Z5(J))}else{let H=R6(Q,Z.precision);if(H){let z=Q.getAttribute("transform"),q=J;if(z){let F=j7(z);q=J.mul(F)}let W=X9(q);if(K.verifications.matrices.push({element:Q.tagName,context:"group-propagation",...W}),W.valid)K.verifications.passed++;else K.verifications.failed++,K.verifications.allPassed=!1;let j=Y6(H,q,{precision:Z.precision}),G=Q;if(Q.tagName==="path")Q.setAttribute("d",j);else{let F=new B0("path",{d:j,...d6(Q)});$.replaceChild(F,Q),G=F}G.removeAttribute("transform")}}}}function EH($,J,Z){if(!$||!$.getElementsByTagName)throw new Error("bakeAllGradientTransforms: invalid root element");if(!J||typeof J!=="object")throw new Error("bakeAllGradientTransforms: opts must be an object");if(!Z||typeof Z!=="object")throw new Error("bakeAllGradientTransforms: stats must be an object");let K=[],Q=0,H=$.getElementsByTagName("linearGradient");for(let q of H){let W=q.getAttribute("gradientTransform");if(!W)continue;try{let j=j7(W),G=parseFloat(q.getAttribute("x1")||"0"),F=parseFloat(q.getAttribute("y1")||"0"),_=parseFloat(q.getAttribute("x2")||"1"),U=parseFloat(q.getAttribute("y2")||"0");if(isNaN(G)||isNaN(F)||isNaN(_)||isNaN(U)){K.push(`linearGradient: invalid coordinate values for gradient ${q.getAttribute("id")||"unknown"}`);continue}let[O,V]=c0(j,G,F),[M,Y]=c0(j,_,U),X=lJ({x1:G,y1:F,x2:_,y2:U},{x1:O.toNumber(),y1:V.toNumber(),x2:M.toNumber(),y2:Y.toNumber()},j);if(Z.verifications.gradients.push({gradientId:q.getAttribute("id")||"unknown",type:"linear",...X}),X.valid)Z.verifications.passed++;else Z.verifications.failed++,Z.verifications.allPassed=!1;q.setAttribute("x1",O.toFixed(J.precision)),q.setAttribute("y1",V.toFixed(J.precision)),q.setAttribute("x2",M.toFixed(J.precision)),q.setAttribute("y2",Y.toFixed(J.precision)),q.removeAttribute("gradientTransform"),Q++}catch(j){K.push(`linearGradient: ${j.message}`)}}let z=$.getElementsByTagName("radialGradient");for(let q of z){let W=q.getAttribute("gradientTransform");if(!W)continue;try{let j=j7(W),G=parseFloat(q.getAttribute("cx")||"0.5"),F=parseFloat(q.getAttribute("cy")||"0.5"),_=parseFloat(q.getAttribute("fx")||G.toString()),U=parseFloat(q.getAttribute("fy")||F.toString()),O=parseFloat(q.getAttribute("r")||"0.5");if(isNaN(G)||isNaN(F)||isNaN(_)||isNaN(U)||isNaN(O)){K.push(`radialGradient: invalid coordinate/radius values for gradient ${q.getAttribute("id")||"unknown"}`);continue}if(O<=0){K.push(`radialGradient: radius must be positive for gradient ${q.getAttribute("id")||"unknown"}`);continue}let[V,M]=c0(j,G,F),[Y,X]=c0(j,_,U),w=j.data[0][0].toNumber()*j.data[1][1].toNumber();if(Math.abs(w)<0.0000000001){K.push("radialGradient: matrix determinant too close to zero (degenerate transform)");continue}let R=Math.sqrt(Math.abs(w)),I=O*R;q.setAttribute("cx",V.toFixed(J.precision)),q.setAttribute("cy",M.toFixed(J.precision)),q.setAttribute("fx",Y.toFixed(J.precision)),q.setAttribute("fy",X.toFixed(J.precision)),q.setAttribute("r",I.toFixed(J.precision)),q.removeAttribute("gradientTransform"),Q++}catch(j){K.push(`radialGradient: ${j.message}`)}}return{count:Q,errors:K}}function TH($){if(!$||!$.getElementsByTagName)throw new Error("collectAllReferences: invalid root element");let J=new Set,Z=(K)=>{if(!K||!K.getAttributeNames)return;if(K.tagName&&K.tagName.toLowerCase()==="style"){let Q=K.textContent||"";if(Q)m6(Q).forEach((z)=>J.add(z))}for(let Q of K.getAttributeNames()){let H=K.getAttribute(Q);if(!H)continue;if(H.includes("url(")){let z=a7(H);if(z)J.add(z)}if(Q==="href"||Q==="xlink:href"){let z=H.replace(/^#/,"");if(z&&z!==H)J.add(z)}}for(let Q of K.children)if(Q&&Q.tagName)Z(Q)};return Z($),J}function bH($,J){if(!$||!$.getElementsByTagName)throw new Error("removeUnusedDefinitions: invalid root element");if(!J||!(J instanceof Set))throw new Error("removeUnusedDefinitions: referencedIds must be a Set");let Z=0;function K(H){if(!H||!H.getAttribute)return!1;let z=H.getAttribute("id");if(z&&J.has(z))return!0;for(let q of H.children||[])if(q&&q.tagName&&K(q))return!0;return!1}let Q=$.getElementsByTagName("defs");for(let H of Q)for(let z of[...H.children])if(z&&z.tagName){let q=z.tagName.toLowerCase();if(q5.has(q))continue;if(!K(z))H.removeChild(z),Z++}return{count:Z}}function R6($,J){if(!$||!$.tagName)return null;if(typeof J!=="number"||isNaN(J)||J<0)throw new Error(`getElementPathData: precision must be a non-negative number, got ${J}`);let Z=$.tagName.toLowerCase();if(Z==="path")return $.getAttribute("d");let K=(Q,H=0)=>{let z=$.getAttribute(Q);if(z===null)return H;let q=parseFloat(z);if(isNaN(q))throw new Error(`getElementPathData: invalid numeric value "${z}" for attribute "${Q}"`);return q};switch(Z){case"rect":{let H=$.getAttribute("ry")!==null?K("ry"):null;return e$(K("x"),K("y"),K("width"),K("height"),K("rx"),H,!1,J)}case"circle":return a$(K("cx"),K("cy"),K("r"),J);case"ellipse":return t$(K("cx"),K("cy"),K("rx"),K("ry"),J);case"line":return $9(K("x1"),K("y1"),K("x2"),K("y2"),J);case"polyline":return _$($.getAttribute("points")||"",J);case"polygon":return J9($.getAttribute("points")||"",J);default:return null}}function W5($){if(!$||!$.tagName)return null;let J=R6($,6);if(!J)return null;try{let Z=t7(J,10);if(!Z||Z.length===0)return null;let K=1/0,Q=1/0,H=-1/0,z=-1/0;for(let q of Z){if(!q||q.x===void 0&&q.y===void 0)continue;let W=q.x instanceof k?q.x.toNumber():typeof q.x==="number"?q.x:0,j=q.y instanceof k?q.y.toNumber():typeof q.y==="number"?q.y:0;if(isNaN(W)||isNaN(j))continue;if(W<K)K=W;if(j<Q)Q=j;if(W>H)H=W;if(j>z)z=j}if(K===1/0||H===-1/0||Q===1/0||z===-1/0)return null;return{x:K,y:Q,width:H-K,height:z-Q}}catch{return null}}function d6($){if(!$||!$.getAttribute)return{};let J=["stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","stroke-opacity","vector-effect","fill","fill-opacity","fill-rule","clip-path","mask","filter","opacity","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display","color","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","word-spacing","text-decoration","shape-rendering","text-rendering","image-rendering","color-rendering","paint-order","pointer-events","cursor","class","style","id"],Z={};for(let K of J){let Q=$.getAttribute(K);if(Q!==null)Z[K]=Q}return Z}function fH($){if(!$||typeof $!=="string")return[];return{rect:["x","y","width","height","rx","ry"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],polyline:["points"],polygon:["points"],image:["x","y","width","height","href","xlink:href","preserveAspectRatio"]}[$.toLowerCase()]||[]}function Z5($){if(!$||!$.data||!Array.isArray($.data))throw new Error("matrixToTransform: invalid matrix");if(!$.data[0]||!$.data[1]||!$.data[0][0]||!$.data[0][1]||!$.data[0][2]||!$.data[1][0]||!$.data[1][1]||!$.data[1][2])throw new Error("matrixToTransform: matrix is missing required elements");let J=$.data[0][0].toNumber(),Z=$.data[1][0].toNumber(),K=$.data[0][1].toNumber(),Q=$.data[1][1].toNumber(),H=$.data[0][2].toNumber(),z=$.data[1][2].toNumber();if(!isFinite(J)||!isFinite(Z)||!isFinite(K)||!isFinite(Q)||!isFinite(H)||!isFinite(z))throw new Error("matrixToTransform: matrix contains non-finite values");return`matrix(${J} ${Z} ${K} ${Q} ${H} ${z})`}function j5($,J){if(!$||$.length<3||!J||J.length<3)return $;if(B7&&A7)try{return A7($,J)}catch(K){}let Z=[...$];for(let K=0;K<J.length;K++){if(Z.length===0)break;let Q=Z;Z=[];let H=J[K],z=J[(K+1)%J.length];for(let q=0;q<Q.length;q++){let W=Q[q],j=Q[(q+1)%Q.length],G=Q5(W,H,z),F=Q5(j,H,z);if(G){if(Z.push(W),!F)Z.push(H5(W,j,H,z))}else if(F)Z.push(H5(W,j,H,z))}}return Z}function Q5($,J,Z){if(!$||$.x===void 0&&$.y===void 0)throw new Error("isInsideEdge: invalid point");if(!J||J.x===void 0&&J.y===void 0)throw new Error("isInsideEdge: invalid edgeStart");if(!Z||Z.x===void 0&&Z.y===void 0)throw new Error("isInsideEdge: invalid edgeEnd");let K=$.x instanceof k?$.x.toNumber():$.x||0,Q=$.y instanceof k?$.y.toNumber():$.y||0,H=J.x instanceof k?J.x.toNumber():J.x||0,z=J.y instanceof k?J.y.toNumber():J.y||0,q=Z.x instanceof k?Z.x.toNumber():Z.x||0,W=Z.y instanceof k?Z.y.toNumber():Z.y||0;return(q-H)*(Q-z)-(W-z)*(K-H)>=0}function H5($,J,Z,K){if(!$||$.x===void 0&&$.y===void 0)throw new Error("lineIntersect: invalid p1");if(!J||J.x===void 0&&J.y===void 0)throw new Error("lineIntersect: invalid p2");if(!Z||Z.x===void 0&&Z.y===void 0)throw new Error("lineIntersect: invalid p3");if(!K||K.x===void 0&&K.y===void 0)throw new Error("lineIntersect: invalid p4");let Q=$.x instanceof k?$.x.toNumber():$.x||0,H=$.y instanceof k?$.y.toNumber():$.y||0,z=J.x instanceof k?J.x.toNumber():J.x||0,q=J.y instanceof k?J.y.toNumber():J.y||0,W=Z.x instanceof k?Z.x.toNumber():Z.x||0,j=Z.y instanceof k?Z.y.toNumber():Z.y||0,G=K.x instanceof k?K.x.toNumber():K.x||0,F=K.y instanceof k?K.y.toNumber():K.y||0,_=(Q-z)*(j-F)-(H-q)*(W-G);if(Math.abs(_)<0.0000000001)return{x:Y7((Q+z)/2),y:Y7((H+q)/2)};let U=((Q-W)*(j-F)-(H-j)*(W-G))/_;return{x:Y7(Q+U*(z-Q)),y:Y7(H+U*(q-H))}}var q6=new Set(["clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","dominant-baseline","fill","fill-opacity","fill-rule","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","letter-spacing","marker","marker-end","marker-mid","marker-start","paint-order","pointer-events","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-rendering","visibility","word-spacing","writing-mode"]);var p6={animation:new Set(["animate","animateColor","animatecolor","animateMotion","animatemotion","animateTransform","animatetransform","set"]),descriptive:new Set(["desc","metadata","title"]),shape:new Set(["circle","ellipse","line","path","polygon","polyline","rect"]),structural:new Set(["defs","g","svg","symbol","use"]),paintServer:new Set(["hatch","linearGradient","lineargradient","meshGradient","meshgradient","pattern","radialGradient","radialgradient","solidColor","solidcolor"]),nonRendering:new Set(["clipPath","clippath","filter","linearGradient","lineargradient","marker","mask","pattern","radialGradient","radialgradient","solidColor","solidcolor","symbol"]),container:new Set(["a","defs","g","marker","mask","pattern","svg","switch","symbol"]),textContent:new Set(["altGlyph","altGlyphDef","altGlyphItem","glyph","glyphRef","text","textPath","tref","tspan"]),filterPrimitive:new Set(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence"]),lightSource:new Set(["feDistantLight","fePointLight","feSpotLight"])};var c6={svg:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),g:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),defs:new Set(["a","altGlyphDef","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view","meshgradient","meshGradient","hatch","solidcolor","solidColor"]),symbol:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),marker:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),clipPath:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","text","title","use"]),mask:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),pattern:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),a:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","clipPath","cursor","defs","desc","ellipse","filter","font","font-face","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","script","set","style","svg","switch","symbol","text","title","use","view"]),switch:new Set(["a","animate","animateColor","animateMotion","animateTransform","circle","cursor","desc","ellipse","foreignObject","g","image","line","metadata","path","polygon","polyline","rect","set","svg","switch","text","title","use","view"]),text:new Set(["a","altGlyph","animate","animateColor","animateMotion","animateTransform","desc","metadata","set","textPath","title","tref","tspan"]),textPath:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),tspan:new Set(["a","altGlyph","animate","animateColor","desc","metadata","set","title","tref","tspan"]),linearGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),radialGradient:new Set(["animate","animateTransform","desc","metadata","set","stop","title"]),meshgradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshGradient:new Set(["animate","animateTransform","desc","metadata","meshrow","set","title"]),meshrow:new Set(["meshpatch"]),meshpatch:new Set(["stop"]),hatch:new Set(["animate","animateTransform","desc","hatchpath","hatchPath","metadata","script","set","style","title"]),hatchpath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),hatchPath:new Set(["animate","animateTransform","desc","metadata","script","set","title"]),filter:new Set(["animate","animateTransform","desc","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","metadata","set","title"]),feBlend:new Set(["animate","set"]),feColorMatrix:new Set(["animate","set"]),feComponentTransfer:new Set(["feFuncA","feFuncB","feFuncG","feFuncR"]),feComposite:new Set(["animate","set"]),feConvolveMatrix:new Set(["animate","set"]),feDiffuseLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feDisplacementMap:new Set(["animate","set"]),feDropShadow:new Set(["animate","set"]),feFlood:new Set(["animate","set"]),feFuncA:new Set(["animate","set"]),feFuncB:new Set(["animate","set"]),feFuncG:new Set(["animate","set"]),feFuncR:new Set(["animate","set"]),feGaussianBlur:new Set(["animate","set"]),feImage:new Set(["animate","set"]),feMerge:new Set(["feMergeNode"]),feMergeNode:new Set(["animate","set"]),feMorphology:new Set(["animate","set"]),feOffset:new Set(["animate","set"]),feSpecularLighting:new Set(["animate","feDistantLight","fePointLight","feSpotLight","set"]),feTile:new Set(["animate","set"]),feTurbulence:new Set(["animate","set"]),animate:new Set(["desc","metadata","title"]),animateColor:new Set(["desc","metadata","title"]),animateMotion:new Set(["desc","metadata","mpath","title"]),animateTransform:new Set(["desc","metadata","title"]),set:new Set(["desc","metadata","title"]),circle:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),ellipse:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),line:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),path:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polygon:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),polyline:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),rect:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),image:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),use:new Set(["animate","animateColor","animateMotion","animateTransform","desc","metadata","set","title"]),title:new Set([]),desc:new Set([]),metadata:new Set([]),feDistantLight:new Set(["animate","set"]),fePointLight:new Set(["animate","set"]),feSpotLight:new Set(["animate","set"]),stop:new Set(["animate","set"]),solidColor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),solidcolor:new Set(["animate","animateColor","animateTransform","desc","metadata","set","title"]),tref:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyph:new Set(["animate","animateColor","desc","metadata","set","title"]),altGlyphDef:new Set(["altGlyphItem"]),altGlyphItem:new Set(["glyphRef","altGlyphItem"]),glyph:new Set(["animate","animateColor","animateMotion","animateTransform","circle","desc","ellipse","line","metadata","path","polygon","polyline","rect","set","title","use"]),glyphRef:new Set([]),foreignObject:new Set([]),style:new Set([]),script:new Set([]),view:new Set(["desc","metadata","title"]),mpath:new Set(["desc","metadata","title"])},G5={userAction:new Set([":hover",":active",":focus",":focus-within",":focus-visible"]),treeStructural:new Set([":root",":empty",":first-child",":last-child",":only-child",":first-of-type",":last-of-type",":only-of-type",":nth-child",":nth-last-child",":nth-of-type",":nth-last-of-type"]),link:new Set([":link",":visited",":any-link",":local-link",":target"]),input:new Set([":enabled",":disabled",":read-only",":read-write",":placeholder-shown",":default",":checked",":indeterminate",":valid",":invalid",":in-range",":out-of-range",":required",":optional"]),linguistic:new Set([":lang",":dir"]),functional:new Set([":not",":is",":where",":has"]),preventInlining:new Set([":hover",":active",":focus",":focus-within",":focus-visible",":visited",":target",":lang",":dir",":not",":is",":where",":has"])};k.set({precision:20,rounding:k.ROUND_HALF_UP});var w9={linear:[0,0,1,1],ease:[0.25,0.1,0.25,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]};function l6($,J=3){if($===null||$===void 0)throw new Error("formatSplineValue: value parameter is required");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("formatSplineValue: precision must be a non-negative finite number");let Z=typeof $==="number"?$:parseFloat($);if(!Number.isFinite(Z))throw new Error(`formatSplineValue: value must be a finite number, got ${$}`);let H=new k($).toDecimalPlaces(J).toString();if(H.includes("."))H=H.replace(/\.?0+$/,"");if(H.startsWith("0."))H=H.substring(1);else if(H.startsWith("-0."))H="-"+H.substring(2);if(H===""||H==="."||H==="-0")H="0";return H}function N$($){if(!$||typeof $!=="string")return[];return $.split(";").map((Z)=>Z.trim()).filter((Z)=>Z).map((Z)=>{let K=Z.split(/[\s,]+/).map((Q)=>parseFloat(Q)).filter((Q)=>Number.isFinite(Q));if(K.length!==4)throw new Error(`parseKeySplines: invalid spline "${Z}", expected 4 values, got ${K.length}`);return K})}function R9($,J=3){if(!Array.isArray($))throw new Error("serializeKeySplines: splines must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("serializeKeySplines: precision must be a non-negative finite number");return $.map((Z,K)=>{if(!Array.isArray(Z))throw new Error(`serializeKeySplines: spline at index ${K} must be an array`);if(Z.length!==4)throw new Error(`serializeKeySplines: spline at index ${K} must have exactly 4 values, got ${Z.length}`);return Z.map((Q)=>l6(Q,J)).join(" ")}).join("; ")}function I$($,J=0.001){if(!Array.isArray($)||$.length!==4)return!1;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("isLinearSpline: tolerance must be a non-negative finite number");let[Z,K,Q,H]=$;if(!Number.isFinite(Z)||!Number.isFinite(K)||!Number.isFinite(Q)||!Number.isFinite(H))return!1;return Math.abs(Z)<J&&Math.abs(K)<J&&Math.abs(Q-1)<J&&Math.abs(H-1)<J}function F5($){let J=N$($);if(J.length===0)return!1;return J.every((Z)=>I$(Z))}function B9($,J=0.01){if(!Array.isArray($)||$.length!==4)return null;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("identifyStandardEasing: tolerance must be a non-negative finite number");if(!$.every((Z)=>Number.isFinite(Z)))return null;for(let[Z,K]of Object.entries(w9))if($.every((H,z)=>Math.abs(H-K[z])<J))return Z;return null}function N9($,J={}){let Z=J.precision??3,K=J.removeLinear!==!1,Q=N$($);if(Q.length===0)return{value:null,allLinear:!1,standardEasings:[]};let H=Q.every((W)=>I$(W)),z=Q.map((W)=>B9(W)).filter(Boolean);if(H&&K)return{value:null,allLinear:!0,standardEasings:z};return{value:R9(Q,Z),allLinear:H,standardEasings:z}}function SH($){if(!$||typeof $!=="string")return[];return $.split(";").map((J)=>parseFloat(J.trim())).filter((J)=>Number.isFinite(J))}function vH($,J=3){if(!Array.isArray($))throw new Error("serializeKeyTimes: times must be an array");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("serializeKeyTimes: precision must be a non-negative finite number");if($.length===0)return"";return $.map((Z)=>l6(Z,J)).join("; ")}function I9($,J=3){if($===null||$===void 0)throw new Error("optimizeKeyTimes: keyTimes parameter is required");if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("optimizeKeyTimes: precision must be a non-negative finite number");let Z=SH($);if(Z.length===0)return $;return vH(Z,J)}function B$($,J=3){if(!$||typeof $!=="string")return $;if(typeof J!=="number"||J<0||!Number.isFinite(J))throw new Error("optimizeAnimationValues: precision must be a non-negative finite number");let Z=$.split(";");if(Z.length===0)return $;return Z.map((Q)=>{let H=Q.trim();if(H.startsWith("#")||H.includes("url("))return H;return H.split(/[\s,]+/).filter((W)=>W).map((W)=>{let j=parseFloat(W);if(!Number.isFinite(j))return W;return l6(j,J)}).join(" ")}).join("; ")}function DH($,J={}){if(!$||typeof $!=="object")throw new Error("optimizeElementTiming: el parameter must be a valid element");if(typeof $.getAttribute!=="function"||typeof $.setAttribute!=="function"||typeof $.removeAttribute!=="function")throw new Error("optimizeElementTiming: el parameter must have getAttribute, setAttribute, and removeAttribute methods");let Z=J.precision??3,K=J.removeLinearSplines!==!1,Q=J.optimizeValues!==!1;if(typeof Z!=="number"||Z<0||!Number.isFinite(Z))throw new Error("optimizeElementTiming: options.precision must be a non-negative finite number");let H=[],z=!1,q=$.getAttribute("keySplines");if(q){let j=N9(q,{precision:Z,removeLinear:K});if(j.allLinear&&K){if($.getAttribute("calcMode")==="spline")$.setAttribute("calcMode","linear"),$.removeAttribute("keySplines"),H.push('Converted linear splines to calcMode="linear"'),z=!0}else if(j.value&&j.value!==q)$.setAttribute("keySplines",j.value),H.push(`keySplines: "${q}" -> "${j.value}"`),z=!0}let W=$.getAttribute("keyTimes");if(W){let j=I9(W,Z);if(j!==W)$.setAttribute("keyTimes",j),H.push(`keyTimes: "${W}" -> "${j}"`),z=!0}if(Q){let j=$.getAttribute("values");if(j){let G=B$(j,Z);if(G!==j)$.setAttribute("values",G),H.push(`values: "${j}" -> "${G}"`),z=!0}}for(let j of["from","to","by"]){let G=$.getAttribute(j);if(G){let F=B$(G,Z);if(F!==G)$.setAttribute(j,F),H.push(`${j}: "${G}" -> "${F}"`),z=!0}}return{modified:z,changes:H}}var hH=["animate","animatetransform","animatemotion","animatecolor","set"];function _5($,J={}){if(!$||typeof $!=="object")throw new Error("optimizeDocumentAnimationTiming: root parameter must be a valid element");let Z=0,K=0,Q=[],H=(z)=>{if(!z||typeof z!=="object")return;let q=z.tagName?.toLowerCase();if(!q)return;if(hH.includes(q)){let j=DH(z,J);if(j.modified)Z++,K+=j.changes.length,Q.push({element:q,id:z.getAttribute("id")||null,changes:j.changes})}let W=z.children||[];for(let j of W)H(j)};return H($),{elementsModified:Z,totalChanges:K,details:Q}}k.set({precision:80});var P9={M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0};function yH($){if(typeof $!=="string")throw new TypeError(`parseArcArgs: argsStr must be a string, got ${typeof $}`);let J=[],Z=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g,K=0,Q=0;while(K<$.length){while(K<$.length&&/[\s,]/.test($[K]))K++;if(K>=$.length)break;let H=Q%7;if(H===3||H===4)if($[K]==="0"||$[K]==="1")J.push($[K]==="1"?1:0),K++,Q++;else return null;else{Z.lastIndex=K;let z=Z.exec($);if(z&&z.index===K)J.push(parseFloat(z[0])),K=Z.lastIndex,Q++;else K++}}return J}function l0($){if(!$||typeof $!=="string")return[];let J=[],Z=/([MmLlHhVvCcSsQqTtAaZz])([^MmLlHhVvCcSsQqTtAaZz]*)/g,K;while((K=Z.exec($))!==null){let Q=K[1],H=K[2].trim();if(Q==="Z"||Q==="z"){J.push({command:"Z",args:[]});let W=H.match(/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g);if(W&&W.length>=2){J.push({command:"M",args:[parseFloat(W[0]),parseFloat(W[1])]});for(let j=2;j+1<W.length;j+=2)J.push({command:"L",args:[parseFloat(W[j]),parseFloat(W[j+1])]})}continue}let z;if(Q==="A"||Q==="a"){if(z=yH(H),z===null){console.warn(`Invalid arc command with malformed flags - skipping: ${Q}${H}`);continue}for(let W=0;W<z.length;W+=7)if(W+6<z.length)z[W]=Math.abs(z[W]),z[W+1]=Math.abs(z[W+1])}else{let W=/-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;z=[];let j;while((j=W.exec(H))!==null)z.push(parseFloat(j[0]))}let q=P9[Q];if(q===void 0){console.warn(`Unknown SVG path command '${Q}' - skipping`);continue}if(q===0||z.length===0)J.push({command:Q,args:[]});else for(let W=0;W<z.length;W+=q){let j=z.slice(W,W+q);if(j.length===q){let G=W>0&&(Q==="M"||Q==="m")?Q==="M"?"L":"l":Q;J.push({command:G,args:j})}else if(j.length>0)console.warn(`Incomplete ${Q} command: expected ${q} args, got ${j.length} - remaining args dropped`)}}return J}function T7($,J=3){if(typeof $!=="number")throw new TypeError(`formatNumber: num must be a number, got ${typeof $}`);if(typeof J!=="number"||!Number.isInteger(J)||J<0)throw new TypeError(`formatNumber: precision must be a non-negative integer, got ${J}`);if(!isFinite($))return"0";if($===0)return"0";let Z=Math.pow(10,J),Q=(Math.round($*Z)/Z).toFixed(J);if(Q.includes("."))Q=Q.replace(/\.?0+$/,"");if(Q.startsWith("0."))Q=Q.substring(1);else if(Q.startsWith("-0."))Q="-"+Q.substring(2);if(Q===""||Q==="."||Q==="-.")Q="0";return Q}function X7($,J,Z){if(!$||typeof $!=="object")throw new TypeError(`toAbsolute: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`toAbsolute: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("toAbsolute: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`toAbsolute: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`toAbsolute: cy must be a finite number, got ${Z}`);let{command:K,args:Q}=$;if(K===K.toUpperCase()){if(P9[K]===void 0)throw new TypeError(`toAbsolute: unknown command '${K}'`);return $}let H=K.toUpperCase(),z=[...Q];switch(K){case"m":case"l":case"t":if(z.length<2)throw new RangeError(`toAbsolute: command ${K} requires at least 2 args, got ${z.length}`);z[0]+=J,z[1]+=Z;break;case"h":if(z.length<1)throw new RangeError(`toAbsolute: command ${K} requires at least 1 arg, got ${z.length}`);z[0]+=J;break;case"v":if(z.length<1)throw new RangeError(`toAbsolute: command ${K} requires at least 1 arg, got ${z.length}`);z[0]+=Z;break;case"c":if(z.length<6)throw new RangeError(`toAbsolute: command ${K} requires at least 6 args, got ${z.length}`);z[0]+=J,z[1]+=Z,z[2]+=J,z[3]+=Z,z[4]+=J,z[5]+=Z;break;case"s":case"q":if(z.length<4)throw new RangeError(`toAbsolute: command ${K} requires at least 4 args, got ${z.length}`);z[0]+=J,z[1]+=Z,z[2]+=J,z[3]+=Z;break;case"a":if(z.length<7)throw new RangeError(`toAbsolute: command ${K} requires at least 7 args, got ${z.length}`);z[5]+=J,z[6]+=Z;break;default:throw new TypeError(`toAbsolute: unsupported command '${K}' for conversion`)}return{command:H,args:z}}function A9($,J,Z){if(!$||typeof $!=="object")throw new TypeError(`toRelative: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`toRelative: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("toRelative: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`toRelative: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`toRelative: cy must be a finite number, got ${Z}`);let{command:K,args:Q}=$;if(K===K.toLowerCase()&&K!=="z"){if(P9[K]===void 0)throw new TypeError(`toRelative: unknown command '${K}'`);return $}if(K==="Z"||K==="z")return{command:"z",args:[]};let H=K.toLowerCase(),z=[...Q];switch(K){case"M":case"L":case"T":if(z.length<2)throw new RangeError(`toRelative: command ${K} requires at least 2 args, got ${z.length}`);z[0]-=J,z[1]-=Z;break;case"H":if(z.length<1)throw new RangeError(`toRelative: command ${K} requires at least 1 arg, got ${z.length}`);z[0]-=J;break;case"V":if(z.length<1)throw new RangeError(`toRelative: command ${K} requires at least 1 arg, got ${z.length}`);z[0]-=Z;break;case"C":if(z.length<6)throw new RangeError(`toRelative: command ${K} requires at least 6 args, got ${z.length}`);z[0]-=J,z[1]-=Z,z[2]-=J,z[3]-=Z,z[4]-=J,z[5]-=Z;break;case"S":case"Q":if(z.length<4)throw new RangeError(`toRelative: command ${K} requires at least 4 args, got ${z.length}`);z[0]-=J,z[1]-=Z,z[2]-=J,z[3]-=Z;break;case"A":if(z.length<7)throw new RangeError(`toRelative: command ${K} requires at least 7 args, got ${z.length}`);z[5]-=J,z[6]-=Z;break;default:throw new TypeError(`toRelative: unsupported command '${K}' for conversion`)}return{command:H,args:z}}function uH($,J,Z,K=0.000001){if(!$||typeof $!=="object")throw new TypeError(`lineToHV: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`lineToHV: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("lineToHV: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`lineToHV: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`lineToHV: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K)||K<0)throw new TypeError(`lineToHV: tolerance must be a non-negative finite number, got ${K}`);let{command:Q,args:H}=$;if(Q!=="L"&&Q!=="l")return null;if(H.length<2)throw new RangeError(`lineToHV: command ${Q} requires at least 2 args, got ${H.length}`);let z=Q==="L",q=z?H[0]:J+H[0],W=z?H[1]:Z+H[1];if(Math.abs(W-Z)<K)return z?{command:"H",args:[q]}:{command:"h",args:[q-J]};if(Math.abs(q-J)<K)return z?{command:"V",args:[W]}:{command:"v",args:[W-Z]};return null}function gH($,J,Z,K,Q,H=0.000001){if(!$||typeof $!=="object")throw new TypeError(`lineToZ: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`lineToZ: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("lineToZ: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`lineToZ: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`lineToZ: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K))throw new TypeError(`lineToZ: startX must be a finite number, got ${K}`);if(typeof Q!=="number"||!isFinite(Q))throw new TypeError(`lineToZ: startY must be a finite number, got ${Q}`);if(typeof H!=="number"||!isFinite(H)||H<0)throw new TypeError(`lineToZ: tolerance must be a non-negative finite number, got ${H}`);let{command:z,args:q}=$;if(z!=="L"&&z!=="l")return!1;if(q.length<2)throw new RangeError(`lineToZ: command ${z} requires at least 2 args, got ${q.length}`);let W=z==="L",j=W?q[0]:J+q[0],G=W?q[1]:Z+q[1];return Math.abs(j-K)<H&&Math.abs(G-Q)<H}function xH($,J,Z,K,Q,H,z,q,W=0.5){let j={x0:$,y0:J,cp1x:Z,cp1y:K,cp2x:Q,cp2y:H,x3:z,y3:q,tolerance:W};for(let[O,V]of Object.entries(j))if(typeof V!=="number"||!isFinite(V))throw new TypeError(`isCurveStraight: ${O} must be a finite number, got ${V}`);if(W<0)throw new TypeError(`isCurveStraight: tolerance must be non-negative, got ${W}`);let G=(z-$)**2+(q-J)**2;if(G<0.0000000001){let O=Math.sqrt((Z-$)**2+(K-J)**2),V=Math.sqrt((Q-$)**2+(H-J)**2);return Math.max(O,V)<W}let F=Math.sqrt(G),_=Math.abs((q-J)*Z-(z-$)*K+z*J-q*$)/F,U=Math.abs((q-J)*Q-(z-$)*H+z*J-q*$)/F;return Math.max(_,U)<W}function mH($,J,Z,K=0.5){if(!$||typeof $!=="object")throw new TypeError(`straightCurveToLine: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`straightCurveToLine: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("straightCurveToLine: cmd.args must be an array");if(typeof J!=="number"||!isFinite(J))throw new TypeError(`straightCurveToLine: cx must be a finite number, got ${J}`);if(typeof Z!=="number"||!isFinite(Z))throw new TypeError(`straightCurveToLine: cy must be a finite number, got ${Z}`);if(typeof K!=="number"||!isFinite(K)||K<0)throw new TypeError(`straightCurveToLine: tolerance must be a non-negative finite number, got ${K}`);let{command:Q,args:H}=$;if(Q!=="C"&&Q!=="c")return null;if(H.length<6)throw new RangeError(`straightCurveToLine: command ${Q} requires at least 6 args, got ${H.length}`);let z=Q==="C",q=z?H[0]:J+H[0],W=z?H[1]:Z+H[1],j=z?H[2]:J+H[2],G=z?H[3]:Z+H[3],F=z?H[4]:J+H[4],_=z?H[5]:Z+H[5];if(xH(J,Z,q,W,j,G,F,_,K))return z?{command:"L",args:[F,_]}:{command:"l",args:[F-J,_-Z]};return null}function C9($,J,Z=3,K=!1){if(!$||typeof $!=="object")throw new TypeError(`serializeCommand: cmd must be an object, got ${typeof $}`);if(typeof $.command!=="string")throw new TypeError(`serializeCommand: cmd.command must be a string, got ${typeof $.command}`);if(!Array.isArray($.args))throw new TypeError("serializeCommand: cmd.args must be an array");if(J!==null&&typeof J!=="string")throw new TypeError(`serializeCommand: prevCommand must be a string or null, got ${typeof J}`);if(typeof Z!=="number"||!Number.isInteger(Z)||Z<0)throw new TypeError(`serializeCommand: precision must be a non-negative integer, got ${Z}`);if(typeof K!=="boolean")throw new TypeError(`serializeCommand: prevLastArgHadDecimal must be a boolean, got ${typeof K}`);let{command:Q,args:H}=$;if(Q==="Z"||Q==="z")return{str:"z",lastArgHadDecimal:!1};if(Q==="A"||Q==="a"){if(H.length<7)throw new RangeError(`serializeCommand: arc command requires at least 7 args, got ${H.length}`);if(H.length>7)console.warn(`serializeCommand: arc command has ${H.length} args (expected 7) - only first 7 will be used`);let F=[T7(H[0],Z),T7(H[1],Z),T7(H[2],Z),H[3]?"1":"0",H[4]?"1":"0",T7(H[5],Z),T7(H[6],Z)].join(" ");return{str:Q+F,lastArgHadDecimal:F.includes(".")}}if(H.length===0)throw new RangeError(`serializeCommand: command ${Q} has empty args array (only Z/z should have no args)`);let z=H.map((F)=>T7(F,Z)),q="";for(let F=0;F<z.length;F++){let _=z[F];if(F===0)q=_;else{let O=z[F-1].includes(".");if(_.startsWith("-"))q+=_;else if(_.startsWith(".")&&O)q+=_;else q+=" "+_}}let j=(z[z.length-1]||"").includes("."),G=Q;if(J==="M"&&Q==="L")G="";else if(J==="m"&&Q==="l")G="";else if(J===Q&&Q!=="A"&&Q!=="a")G="";if(G)return{str:G+q,lastArgHadDecimal:j};else{let F=z[0]||"";if(F.startsWith("-"))return{str:q,lastArgHadDecimal:j};else if(F.startsWith(".")&&K)return{str:q,lastArgHadDecimal:j};else return{str:" "+q,lastArgHadDecimal:j}}}function n0($,J=3){if(!Array.isArray($))throw new TypeError(`serializePath: commands must be an array, got ${typeof $}`);if(typeof J!=="number"||!Number.isInteger(J)||J<0)throw new TypeError(`serializePath: precision must be a non-negative integer, got ${J}`);if($.length===0)return"";let Z="",K=null,Q=!1;for(let H of $){let{str:z,lastArgHadDecimal:q}=C9(H,K,J,Q);Z+=z,K=H.command,Q=q}return Z}function E9($,J={}){if(typeof $!=="string")throw new TypeError(`convertPathData: d must be a string, got ${typeof $}`);if(typeof J!=="object"||J===null||Array.isArray(J))throw new TypeError(`convertPathData: options must be an object, got ${typeof J}`);let{floatPrecision:Z=3,straightCurves:K=!0,lineShorthands:Q=!0,convertToZ:H=!0,utilizeAbsolute:z=!0,straightTolerance:q=0.5}=J;if(typeof Z!=="number"||!Number.isInteger(Z)||Z<0)throw new TypeError(`convertPathData: floatPrecision must be a non-negative integer, got ${Z}`);if(typeof K!=="boolean")throw new TypeError(`convertPathData: straightCurves must be a boolean, got ${typeof K}`);if(typeof Q!=="boolean")throw new TypeError(`convertPathData: lineShorthands must be a boolean, got ${typeof Q}`);if(typeof H!=="boolean")throw new TypeError(`convertPathData: convertToZ must be a boolean, got ${typeof H}`);if(typeof z!=="boolean")throw new TypeError(`convertPathData: utilizeAbsolute must be a boolean, got ${typeof z}`);if(typeof q!=="number"||!isFinite(q)||q<0)throw new TypeError(`convertPathData: straightTolerance must be a non-negative finite number, got ${q}`);let W=$.length,j=l0($);if(j.length===0)return{d:$,originalLength:W,optimizedLength:W,savings:0};let G=0,F=0,_=0,U=0,O=[];for(let M=0;M<j.length;M++){let Y=j[M];if(Y.command==="A"||Y.command==="a"){if(Y.args.length<7)console.warn(`Arc command has insufficient args (${Y.args.length} < 7) - skipping optimization`);else if(Y.args[0]===0||Y.args[1]===0){let w=Y.command==="A",R=Y.args[5],I=Y.args[6];Y=w?{command:"L",args:[R,I]}:{command:"l",args:[R,I]}}}if(K&&(Y.command==="C"||Y.command==="c")){let w=mH(Y,G,F,q);if(w)Y=w}if(Q&&(Y.command==="L"||Y.command==="l")){let w=uH(Y,G,F);if(w)Y=w}if(H&&(Y.command==="L"||Y.command==="l")){if(gH(Y,G,F,_,U))Y={command:"z",args:[]}}if(z&&Y.command!=="Z"&&Y.command!=="z"){let w=X7(Y,G,F),R=A9(Y,G,F),I=C9(w,null,Z);Y=C9(R,null,Z).str.length<I.str.length?R:w}O.push(Y);let X=X7(Y,G,F);switch(X.command){case"M":if(X.args.length>=2)G=X.args[0],F=X.args[1],_=G,U=F;break;case"L":case"T":if(X.args.length>=2)G=X.args[0],F=X.args[1];break;case"H":if(X.args.length>=1)G=X.args[0];break;case"V":if(X.args.length>=1)F=X.args[0];break;case"C":if(X.args.length>=6)G=X.args[4],F=X.args[5];break;case"S":case"Q":if(X.args.length>=4)G=X.args[2],F=X.args[3];break;case"A":if(X.args.length>=7)G=X.args[5],F=X.args[6];break;case"Z":G=_,F=U;break;default:break}}let V=n0(O,Z);return{d:V,originalLength:W,optimizedLength:V.length,savings:W-V.length}}function U5($,J={}){if(!$||typeof $!=="object")throw new TypeError(`optimizeDocumentPaths: root must be a DOM element object, got ${typeof $}`);if(typeof J!=="object"||J===null||Array.isArray(J))throw new TypeError(`optimizeDocumentPaths: options must be an object, got ${typeof J}`);let Z=0,K=0,Q=[],H=(z)=>{if(!z||typeof z!=="object")return;if(z.tagName?.toLowerCase()==="path"){let W=z.getAttribute("d");if(W){let j=E9(W,J);if(j.savings>0)z.setAttribute("d",j.d),Z++,K+=j.savings,Q.push({id:z.getAttribute("id")||null,originalLength:j.originalLength,optimizedLength:j.optimizedLength,savings:j.savings})}}for(let W of z.children||[])H(W)};return H($),{pathsOptimized:Z,totalSavings:K,details:Q}}function V5($,J,Z){if(!$||typeof $.x!=="number"||typeof $.y!=="number")throw new TypeError("perpendicularDistance: point must be an object with numeric x and y properties");if(!J||typeof J.x!=="number"||typeof J.y!=="number")throw new TypeError("perpendicularDistance: lineStart must be an object with numeric x and y properties");if(!Z||typeof Z.x!=="number"||typeof Z.y!=="number")throw new TypeError("perpendicularDistance: lineEnd must be an object with numeric x and y properties");if(!Number.isFinite($.x)||!Number.isFinite($.y)||!Number.isFinite(J.x)||!Number.isFinite(J.y)||!Number.isFinite(Z.x)||!Number.isFinite(Z.y))throw new RangeError("perpendicularDistance: all coordinates must be finite numbers");let K=Z.x-J.x,Q=Z.y-J.y,H=K*K+Q*Q;if(H<0.0000000001){let W=$.x-J.x,j=$.y-J.y;return Math.sqrt(W*W+j*j)}let z=Math.abs(Q*$.x-K*$.y+Z.x*J.y-Z.y*J.x),q=Math.sqrt(H);return z/q}function n6($,J){if(!Array.isArray($))throw new TypeError("douglasPeucker: points must be an array");if($.length===0)throw new RangeError("douglasPeucker: points array cannot be empty");for(let z=0;z<$.length;z++){let q=$[z];if(!q||typeof q!=="object")throw new TypeError(`douglasPeucker: point at index ${z} must be an object`);if(typeof q.x!=="number"||!Number.isFinite(q.x))throw new TypeError(`douglasPeucker: point at index ${z} must have a finite numeric x property`);if(typeof q.y!=="number"||!Number.isFinite(q.y))throw new TypeError(`douglasPeucker: point at index ${z} must have a finite numeric y property`)}if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("douglasPeucker: tolerance must be a finite number");if(J<0)throw new RangeError("douglasPeucker: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("douglasPeucker: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if($.length<=2)return $;if($.length>1e4)return dH($,J);let Z=0,K=0,Q=$[0],H=$[$.length-1];for(let z=1;z<$.length-1;z++){let q=V5($[z],Q,H);if(q>Z)Z=q,K=z}if(Z>J){let z=n6($.slice(0,K+1),J),q=n6($.slice(K),J);return z.slice(0,-1).concat(q)}else return[Q,H]}function dH($,J){if($.length<=2)return $;let Z=new Array($.length).fill(!1);Z[0]=!0,Z[$.length-1]=!0;let K=[[0,$.length-1]];while(K.length>0){let[Q,H]=K.pop();if(H-Q<=1)continue;let z=0,q=Q,W=$[Q],j=$[H];for(let G=Q+1;G<H;G++){let F=V5($[G],W,j);if(F>z)z=F,q=G}if(z>J)Z[q]=!0,K.push([Q,q]),K.push([q,H])}return $.filter((Q,H)=>Z[H])}function T9($,J){if(!Array.isArray($))throw new TypeError("visvalingamWhyatt: points must be an array");if($.length===0)throw new RangeError("visvalingamWhyatt: points array cannot be empty");for(let q=0;q<$.length;q++){let W=$[q];if(!W||typeof W!=="object")throw new TypeError(`visvalingamWhyatt: point at index ${q} must be an object`);if(typeof W.x!=="number"||!Number.isFinite(W.x))throw new TypeError(`visvalingamWhyatt: point at index ${q} must have a finite numeric x property`);if(typeof W.y!=="number"||!Number.isFinite(W.y))throw new TypeError(`visvalingamWhyatt: point at index ${q} must have a finite numeric y property`)}if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("visvalingamWhyatt: minArea must be a finite number");if(J<0)throw new RangeError("visvalingamWhyatt: minArea cannot be negative");if($.length<=2)return $;let Z=(q,W,j)=>{return Math.abs((W.x-q.x)*(j.y-q.y)-(j.x-q.x)*(W.y-q.y))/2},K=$.map((q,W)=>({...q,index:W})),Q=new Array(K.length).fill(1/0);for(let q=1;q<K.length-1;q++)Q[q]=Z(K[q-1],K[q],K[q+1]);let H=new Array(K.length).fill(!0),z=K.length;while(z>2){let q=1/0,W=-1;for(let F=1;F<K.length-1;F++)if(H[F]&&Q[F]<q)q=Q[F],W=F;if(q>=J||W===-1)break;H[W]=!1,z--;let j=W-1;while(j>=0&&!H[j])j--;let G=W+1;while(G<K.length&&!H[G])G++;if(j>0){let F=j-1;while(F>=0&&!H[F])F--;if(F>=0&&G<K.length)Q[j]=Z(K[F],K[j],K[G])}if(G<K.length-1){let F=G+1;while(F<K.length&&!H[F])F++;if(F<K.length&&j>=0)Q[G]=Z(K[j],K[G],K[F])}}return K.filter((q,W)=>H[W])}function b9($,J,Z="douglas-peucker"){if(!Array.isArray($))throw new TypeError("simplifyPolyline: points must be an array");if($.length===0)throw new RangeError("simplifyPolyline: points array cannot be empty");if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("simplifyPolyline: tolerance must be a finite number");if(J<0)throw new RangeError("simplifyPolyline: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("simplifyPolyline: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(typeof Z!=="string")throw new TypeError("simplifyPolyline: algorithm must be a string");let K=["douglas-peucker","visvalingam"];if(!K.includes(Z))throw new RangeError(`simplifyPolyline: algorithm must be one of: ${K.join(", ")}`);if(Z==="visvalingam")return T9($,J*J);return n6($,J)}function pH($){if(!Array.isArray($))throw new TypeError("extractPolylinePoints: commands must be an array");let J=[],Z=0,K=0,Q=0,H=0;for(let z of $){if(!z||typeof z!=="object")throw new TypeError("extractPolylinePoints: each command must be an object");if(typeof z.command!=="string")throw new TypeError('extractPolylinePoints: each command must have a string "command" property');if(!Array.isArray(z.args))throw new TypeError('extractPolylinePoints: each command must have an "args" array');let{command:q,args:W}=z,j=(F)=>{if(W.length<F)throw new RangeError(`extractPolylinePoints: command "${q}" requires at least ${F} arguments, got ${W.length}`)},G=(F)=>{if(typeof W[F]!=="number"||!Number.isFinite(W[F]))throw new TypeError(`extractPolylinePoints: command "${q}" argument at index ${F} must be a finite number, got ${W[F]}`)};switch(q){case"M":j(2),G(0),G(1),Z=W[0],K=W[1],Q=Z,H=K,J.push({x:Z,y:K});break;case"m":j(2),G(0),G(1),Z+=W[0],K+=W[1],Q=Z,H=K,J.push({x:Z,y:K});break;case"L":j(2),G(0),G(1),Z=W[0],K=W[1],J.push({x:Z,y:K});break;case"l":j(2),G(0),G(1),Z+=W[0],K+=W[1],J.push({x:Z,y:K});break;case"H":j(1),G(0),Z=W[0],J.push({x:Z,y:K});break;case"h":j(1),G(0),Z+=W[0],J.push({x:Z,y:K});break;case"V":j(1),G(0),K=W[0],J.push({x:Z,y:K});break;case"v":j(1),G(0),K+=W[0],J.push({x:Z,y:K});break;case"Z":case"z":if(Z!==Q||K!==H)J.push({x:Q,y:H});Z=Q,K=H;break;case"C":j(6),G(4),G(5),Z=W[4],K=W[5];break;case"c":j(6),G(4),G(5),Z+=W[4],K+=W[5];break;case"S":case"Q":j(4),G(2),G(3),Z=W[2],K=W[3];break;case"s":case"q":j(4),G(2),G(3),Z+=W[2],K+=W[3];break;case"T":j(2),G(0),G(1),Z=W[0],K=W[1];break;case"t":j(2),G(0),G(1),Z+=W[0],K+=W[1];break;case"A":j(7),G(5),G(6),Z=W[5],K=W[6];break;case"a":j(7),G(5),G(6),Z+=W[5],K+=W[6];break;default:break}}return J}function cH($,J=!1){if(!Array.isArray($))throw new TypeError("rebuildPathFromPoints: points must be an array");if($.length===0)return[];if(typeof J!=="boolean")throw new TypeError("rebuildPathFromPoints: closed must be a boolean");for(let K=0;K<$.length;K++){let Q=$[K];if(!Q||typeof Q!=="object")throw new TypeError(`rebuildPathFromPoints: point at index ${K} must be an object`);if(typeof Q.x!=="number"||!Number.isFinite(Q.x))throw new TypeError(`rebuildPathFromPoints: point at index ${K} must have a finite numeric x property`);if(typeof Q.y!=="number"||!Number.isFinite(Q.y))throw new TypeError(`rebuildPathFromPoints: point at index ${K} must have a finite numeric y property`)}let Z=[];Z.push({command:"M",args:[$[0].x,$[0].y]});for(let K=1;K<$.length;K++)Z.push({command:"L",args:[$[K].x,$[K].y]});if(J)Z.push({command:"Z",args:[]});return Z}function f9($){if(!Array.isArray($))throw new TypeError("isPurePolyline: commands must be an array");let J=new Set(["M","m","L","l","H","h","V","v","Z","z"]);return $.every((Z)=>{if(!Z||typeof Z!=="object"||typeof Z.command!=="string")return!1;return J.has(Z.command)})}function S9($,J,Z="douglas-peucker"){if(!Array.isArray($))throw new TypeError("simplifyPath: commands must be an array");if(typeof J!=="number"||!Number.isFinite(J))throw new TypeError("simplifyPath: tolerance must be a finite number");if(J<0)throw new RangeError("simplifyPath: tolerance cannot be negative");if(J>0&&J<0.0000000001)throw new RangeError("simplifyPath: tolerance must be either 0 or >= 1e-10 to avoid numerical precision issues");if(!f9($)||$.length<3)return{commands:$,simplified:!1,originalPoints:0,simplifiedPoints:0};let K=pH($),Q=K.length;if(Q<3)return{commands:$,simplified:!1,originalPoints:Q,simplifiedPoints:Q};let H=$[$.length-1].command.toLowerCase()==="z";if(H&&K.length>1){let j=K[0],G=K[K.length-1];if(Math.abs(G.x-j.x)<0.0000000001&&Math.abs(G.y-j.y)<0.0000000001)K=K.slice(0,-1)}let z=b9(K,J,Z),q=z.length;if(q>=Q)return{commands:$,simplified:!1,originalPoints:Q,simplifiedPoints:Q};return{commands:cH(z,H),simplified:!0,originalPoints:Q,simplifiedPoints:q}}function Z7($){if(typeof $!=="string")throw new TypeError("Path d must be a string")}function Q7($){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new TypeError(`Precision must be a finite non-negative number, got ${$}`)}function e7($){if(typeof $!=="number"||!Number.isFinite($)||$<0)throw new TypeError(`Tolerance must be a finite non-negative number, got ${$}`)}function H7($,J=0){if(!$||typeof $!=="object")throw new TypeError("Command must be an object");if(typeof $.command!=="string")throw new TypeError("Command must have a string 'command' property");if(!Array.isArray($.args))throw new TypeError("Command must have an array 'args' property");if($.args.length<J)throw new TypeError(`Command ${$.command} requires at least ${J} args, got ${$.args.length}`);for(let Z=0;Z<$.args.length;Z++)if(typeof $.args[Z]!=="number"||!Number.isFinite($.args[Z]))throw new TypeError(`Command ${$.command} arg[${Z}] must be a finite number, got ${$.args[Z]}`)}function D9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((Q)=>H7(Q));let K=Z.map((Q)=>({command:Q.command,args:Q.args.map((H)=>{let z=T7(H,J),q=parseFloat(z);if(!Number.isFinite(q))throw new Error(`Invalid numeric value encountered: ${z}`);return q})}));return n0(K,J)}function h9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;return Z.forEach((K)=>H7(K)),n0(Z,J)}function y9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((W)=>H7(W));let K=0,Q=0,H=0,z=0,q=[];for(let W of Z){let j=A9(W,K,Q);q.push(j);let G=X7(W,K,Q);switch(G.command){case"M":K=G.args[0],Q=G.args[1],H=K,z=Q;break;case"L":case"T":K=G.args[0],Q=G.args[1];break;case"H":K=G.args[0];break;case"V":Q=G.args[0];break;case"C":K=G.args[4],Q=G.args[5];break;case"S":case"Q":K=G.args[2],Q=G.args[3];break;case"A":K=G.args[5],Q=G.args[6];break;case"Z":K=H,Q=z;break;default:break}}return n0(q,J)}function u9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((W)=>H7(W));let K=0,Q=0,H=0,z=0,q=[];for(let W of Z){let j=X7(W,K,Q);switch(q.push(j),j.command){case"M":K=j.args[0],Q=j.args[1],H=K,z=Q;break;case"L":case"T":K=j.args[0],Q=j.args[1];break;case"H":K=j.args[0];break;case"V":Q=j.args[0];break;case"C":K=j.args[4],Q=j.args[5];break;case"S":case"Q":K=j.args[2],Q=j.args[3];break;case"A":K=j.args[5],Q=j.args[6];break;case"Z":K=H,Q=z;break;default:break}}return n0(q,J)}function g9($,J=0.000001,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="L"||j.command==="l"){let _=j.command==="L",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1];if(Math.abs(O-H)<J)G=_?{command:"H",args:[U]}:{command:"h",args:[U-Q]};else if(Math.abs(U-Q)<J)G=_?{command:"V",args:[O]}:{command:"v",args:[O-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function x9($,J=0.000001,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j=0;j<K.length;j++){let G=K[j],F=G;if(G.command==="L"||G.command==="l"){let U=G.command==="L",O=U?G.args[0]:Q+G.args[0],V=U?G.args[1]:H+G.args[1];if((j===K.length-1||K[j+1].command==="M"||K[j+1].command==="m")&&Math.abs(O-z)<J&&Math.abs(V-q)<J)F={command:"z",args:[]}}W.push(F);let _=X7(F,Q,H);switch(_.command){case"M":Q=_.args[0],H=_.args[1],z=Q,q=H;break;case"L":case"T":Q=_.args[0],H=_.args[1];break;case"H":Q=_.args[0];break;case"V":H=_.args[0];break;case"C":Q=_.args[4],H=_.args[5];break;case"S":case"Q":Q=_.args[2],H=_.args[3];break;case"A":Q=_.args[5],H=_.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function N6(...$){for(let J=0;J<$.length;J++)if(typeof $[J]!=="number"||!Number.isFinite($[J]))throw new TypeError(`Coordinate at position ${J} must be a finite number, got ${$[J]}`)}function M5($){if(typeof $!=="number"||!Number.isFinite($))throw new TypeError(`Parameter t must be a finite number, got ${$}`);if($<0||$>1)throw new RangeError(`Parameter t must be in range [0, 1], got ${$}`)}function C$($,J,Z,K,Q,H,z,q,W){M5($),N6(J,Z,K,Q,H,z,q,W);let j=1-$,G=j*j,F=G*j,_=$*$,U=_*$;return{x:F*J+3*G*$*K+3*j*_*H+U*q,y:F*Z+3*G*$*Q+3*j*_*z+U*W}}function v9($,J,Z,K,Q,H){N6($,J,Z,K,Q,H);let z=Q-Z,q=H-K,W=z*z+q*q;if(W<0.0000000001)return Math.sqrt(($-Z)**2+(J-K)**2);let j=Math.max(0,Math.min(1,(($-Z)*z+(J-K)*q)/W)),G=Z+j*z,F=K+j*q;return Math.sqrt(($-G)**2+(J-F)**2)}function lH($,J,Z,K,Q,H,z,q){N6($,J,Z,K,Q,H,z,q);let W=0,j=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9];for(let G of j){let F=C$(G,$,J,Z,K,Q,H,z,q),_=v9(F.x,F.y,$,J,z,q);if(_>W)W=_}for(let G=0;G<j.length-1;G++){let F=(j[G]+j[G+1])/2,_=C$(F,$,J,Z,K,Q,H,z,q),U=v9(_.x,_.y,$,J,z,q);if(U>W)W=U}for(let G of[0.05,0.95]){let F=C$(G,$,J,Z,K,Q,H,z,q),_=v9(F.x,F.y,$,J,z,q);if(_>W)W=_}return W}function nH($,J,Z,K,Q,H,z,q,W){return lH($,J,Z,K,Q,H,z,q)<=W}function m9($,J=0.5,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="C"||j.command==="c"){let _=j.command==="C",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1],V=_?j.args[2]:Q+j.args[2],M=_?j.args[3]:H+j.args[3],Y=_?j.args[4]:Q+j.args[4],X=_?j.args[5]:H+j.args[5];if(nH(Q,H,U,O,V,M,Y,X,J))G=_?{command:"L",args:[Y,X]}:{command:"l",args:[Y-Q,X-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function d9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;return Z.forEach((K)=>H7(K)),n0(Z,J)}function p9($,J=3){if(Z7($),Q7(J),J>15)throw new RangeError(`Precision ${J} is too large (max 15)`);let Z=l0($);if(Z.length===0)return $;Z.forEach((H)=>H7(H));let K=Math.pow(10,J),Q=Z.map((H)=>({command:H.command,args:H.args.map((z)=>Math.round(z*K)/K)}));return n0(Q,J)}function c9($,J=0.000001,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=X7(j,Q,H),F=!0;switch(G.command){case"L":case"T":if(Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"H":if(Math.abs(G.args[0]-Q)<J)F=!1;break;case"V":if(Math.abs(G.args[0]-H)<J)F=!1;break;case"C":if(Math.abs(G.args[4]-Q)<J&&Math.abs(G.args[5]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J&&Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J)F=!1;break;case"S":if(Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"Q":if(Math.abs(G.args[2]-Q)<J&&Math.abs(G.args[3]-H)<J&&Math.abs(G.args[0]-Q)<J&&Math.abs(G.args[1]-H)<J)F=!1;break;case"A":if(Math.abs(G.args[5]-Q)<J&&Math.abs(G.args[6]-H)<J||Math.abs(G.args[0])<J||Math.abs(G.args[1])<J)F=!1;break;default:break}if(F)switch(W.push(j),G.command){case"M":Q=G.args[0],H=G.args[1],z=Q,q=H;break;case"L":case"T":Q=G.args[0],H=G.args[1];break;case"H":Q=G.args[0];break;case"V":H=G.args[0];break;case"C":Q=G.args[4],H=G.args[5];break;case"S":case"Q":Q=G.args[2],H=G.args[3];break;case"A":Q=G.args[5],H=G.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function sH($,J,Z,K,Q,H,z){M5($),N6(J,Z,K,Q,H,z);let q=1-$,W=q*q,j=$*$;return{x:W*J+2*q*$*K+j*H,y:W*Z+2*q*$*Q+j*z}}function oH($,J,Z,K,Q,H,z,q,W,j){N6($,J,Z,K,Q,H,z,q,W,j);let G=0,F=[0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.55,0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.95];for(let _ of F){let U=C$(_,$,J,Z,K,Q,H,z,q),O=sH(_,$,J,W,j,z,q),V=Math.sqrt((U.x-O.x)**2+(U.y-O.y)**2);if(V>G)G=V}return G}function iH($,J,Z,K,Q,H,z,q,W){N6($,J,Z,K,Q,H,z,q),e7(W);let j=(3*(Z+Q)-$-z)/4,G=(3*(K+H)-J-q)/4;if(oH($,J,Z,K,Q,H,z,q,j,G)<=W)return{cpx:j,cpy:G};return null}function l9($,J=0.5,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((j)=>H7(j));let Q=0,H=0,z=0,q=0,W=[];for(let j of K){let G=j;if(j.command==="C"||j.command==="c"){let _=j.command==="C",U=_?j.args[0]:Q+j.args[0],O=_?j.args[1]:H+j.args[1],V=_?j.args[2]:Q+j.args[2],M=_?j.args[3]:H+j.args[3],Y=_?j.args[4]:Q+j.args[4],X=_?j.args[5]:H+j.args[5],w=iH(Q,H,U,O,V,M,Y,X,J);if(w)G=_?{command:"Q",args:[w.cpx,w.cpy,Y,X]}:{command:"q",args:[w.cpx-Q,w.cpy-H,Y-Q,X-H]}}W.push(G);let F=X7(G,Q,H);switch(F.command){case"M":Q=F.args[0],H=F.args[1],z=Q,q=H;break;case"L":case"T":Q=F.args[0],H=F.args[1];break;case"H":Q=F.args[0];break;case"V":H=F.args[0];break;case"C":Q=F.args[4],H=F.args[5];break;case"S":case"Q":Q=F.args[2],H=F.args[3];break;case"A":Q=F.args[5],H=F.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(W,Z)}function n9($,J=0.000001,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((F)=>H7(F));let Q=0,H=0,z=0,q=0,W=null,j=null,G=[];for(let F of K){let _=F,U=X7(F,Q,H);if(U.command==="Q"&&W!==null){let O=2*Q-W,V=2*H-j;if(Math.abs(U.args[0]-O)<J&&Math.abs(U.args[1]-V)<J)_=F.command==="Q"?{command:"T",args:[U.args[2],U.args[3]]}:{command:"t",args:[U.args[2]-Q,U.args[3]-H]}}if(G.push(_),U.command==="Q")W=U.args[0],j=U.args[1];else if(U.command==="T")if(W!==null)W=2*Q-W,j=2*H-j;else W=Q,j=H;else W=null,j=null;switch(U.command){case"M":Q=U.args[0],H=U.args[1],z=Q,q=H;break;case"L":case"T":Q=U.args[0],H=U.args[1];break;case"H":Q=U.args[0];break;case"V":H=U.args[0];break;case"C":Q=U.args[4],H=U.args[5];break;case"S":case"Q":Q=U.args[2],H=U.args[3];break;case"A":Q=U.args[5],H=U.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(G,Z)}function s9($,J=0.000001,Z=3){Z7($),e7(J),Q7(Z);let K=l0($);if(K.length===0)return $;K.forEach((F)=>H7(F));let Q=0,H=0,z=0,q=0,W=null,j=null,G=[];for(let F of K){let _=F,U=X7(F,Q,H);if(U.command==="C"&&W!==null){let O=2*Q-W,V=2*H-j;if(Math.abs(U.args[0]-O)<J&&Math.abs(U.args[1]-V)<J)_=F.command==="C"?{command:"S",args:[U.args[2],U.args[3],U.args[4],U.args[5]]}:{command:"s",args:[U.args[2]-Q,U.args[3]-H,U.args[4]-Q,U.args[5]-H]}}if(G.push(_),U.command==="C")W=U.args[2],j=U.args[3];else if(U.command==="S")W=U.args[0],j=U.args[1];else W=null,j=null;switch(U.command){case"M":Q=U.args[0],H=U.args[1],z=Q,q=H;break;case"L":case"T":Q=U.args[0],H=U.args[1];break;case"H":Q=U.args[0];break;case"V":H=U.args[0];break;case"C":Q=U.args[4],H=U.args[5];break;case"S":case"Q":Q=U.args[2],H=U.args[3];break;case"A":Q=U.args[5],H=U.args[6];break;case"Z":Q=z,H=q;break;default:break}}return n0(G,Z)}function o9($,J=3){Z7($),Q7(J);let Z=l0($);if(Z.length===0)return $;Z.forEach((Q)=>H7(Q));let K=Z.map((Q)=>{if(Q.command==="A"||Q.command==="a"){let H=[...Q.args];if(H.length!==7)throw new Error(`Arc command requires 7 arguments, got ${H.length}`);if(H[2]=(H[2]%360+360)%360,Math.abs(H[0]-H[1])<0.000001)H[2]=0;return H[3]=H[3]?1:0,H[4]=H[4]?1:0,{command:Q.command,args:H}}return Q});return n0(K,J)}var G6=new Set(["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"]),t9=new Set([...G6].map(($)=>$.toLowerCase())),F6=new Set(["accent-height","accumulate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","ascent","attributeName","attributeType","azimuth","baseFrequency","baseline-shift","baseProfile","bbox","begin","bias","by","calcMode","cap-height","class","clip","clip-path","clip-rule","clipPathUnits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentScriptType","contentStyleType","cursor","cx","cy","d","descent","diffuseConstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgeMode","elevation","enable-background","end","exponent","externalResourcesRequired","fill","fill-opacity","fill-rule","filter","filterRes","filterUnits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphRef","gradientTransform","gradientUnits","hanging","height","horiz-adv-x","horiz-origin-x","horiz-origin-y","href","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lang","lengthAdjust","letter-spacing","lighting-color","limitingConeAngle","local","marker-end","marker-mid","marker-start","markerHeight","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","max","media","method","min","mode","name","numOctaves","offset","onabort","onactivate","onbegin","onclick","onend","onerror","onfocusin","onfocusout","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onrepeat","onresize","onscroll","onunload","onzoom","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","path","pathLength","patternContentUnits","patternTransform","patternUnits","pointer-events","points","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","rendering-intent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","scale","seed","shape-rendering","slope","spacing","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfaceScale","systemLanguage","tableValues","target","targetX","targetY","text-anchor","text-decoration","text-rendering","textLength","title","to","transform","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewBox","viewTarget","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xChannelSelector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:id","xml:lang","xml:space","xmlns","xmlns:xlink","y","y1","y2","yChannelSelector","z","zoomAndPan","line-height","marker"]),e9=new Set([...F6].map(($)=>$.toLowerCase())),Lz=new Set(["mesh","meshgradient","meshpatch","meshrow","solidcolor","hatch","hatchpath","discard","unknown","canvas","video","audio","iframe","source","track"]),wz=new Set(["href","tabindex","lang","transform-origin","vector-effect","paint-order","pathLength","fr","side","crossorigin","role","aria-label","aria-labelledby","aria-describedby","aria-hidden","aria-controls","aria-expanded","aria-haspopup","aria-live","aria-atomic","aria-relevant","aria-busy","aria-owns"]),Rz=($)=>{if(!$||typeof $!=="string")return!1;return Lz.has($.toLowerCase())},Bz=($)=>{if(!$||typeof $!=="string")return!1;let J=$.toLowerCase();return wz.has(J)||J.startsWith("aria-")||J.startsWith("data-")},L5=new Set(["foreignobject","script","style","title","desc","metadata"]),P$=new Map,Nz=($,J)=>{if(typeof $!=="string"||typeof J!=="string")throw new Error("Both parameters must be strings");let Z=`${$}|${J}`;if(P$.has(Z))return P$.get(Z);if($.length===0)return J.length;if(J.length===0)return $.length;let K=[];for(let H=0;H<=J.length;H++)K[H]=[H];for(let H=0;H<=$.length;H++)K[0][H]=H;for(let H=1;H<=J.length;H++)for(let z=1;z<=$.length;z++){let q=$[z-1]===J[H-1]?0:1;K[H][z]=Math.min(K[H-1][z]+1,K[H][z-1]+1,K[H-1][z-1]+q)}let Q=K[J.length][$.length];return P$.set(Z,Q),Q},Iz=()=>P$.clear(),P6=($,J,Z=2)=>{if(!$||typeof $!=="string")return null;if(!J||!(J instanceof Set)||J.size===0)return null;let K=typeof Z!=="number"||Z<0?2:Z,Q=$.toLowerCase(),H=null,z=K+1;for(let q of J){let W=Nz(Q,q.toLowerCase());if(W>0&&W<z)z=W,H=q}return H};function d7($){if(!$||typeof $!=="string")return!1;return/(%|em|rem|px|pt|cm|mm|in|pc|ex|ch|vw|vh|vmin|vmax|Q)$/i.test($.trim())}function Cz($,J,Z=100){let K=new Set,Q=$,H=0;while(Q!==null&&Q!==void 0&&H<Z){if(K.has(Q))return!0;K.add(Q),Q=J(Q),H++}return H>=Z}function w5($){if(!$||typeof $!=="string")return $||"";return $.replace(/<(script|style)([^>]*)\sdata-cdata-pending="true"([^>]*)>([\s\S]*?)<\/\1>/gi,(J,Z,K,Q,H)=>{let z=H.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),q=(K+Q).replace(/\s*data-cdata-pending="true"\s*/g," ").trim(),W=q?" "+q:"";return`<${Z}${W}><![CDATA[
|
|
17
|
+
${z}
|
|
18
|
+
]]></${Z}>`})}var A$=/-?\d*\.?\d+(?:[eE][+-]?\d+)?/g,i6=80,E$=6,E5={BROWSER_MIN:2,BROWSER_TYPICAL:6,FLOAT32:7,FLOAT64:15,GEOGRAPHIC:8,SCIENTIFIC:20,MAX:80};k.set({precision:i6,rounding:k.ROUND_HALF_UP});var J8=($)=>$ instanceof k?$:new k($);function a($){return $!==null&&typeof $==="object"&&typeof $.tagName==="string"&&typeof $.getAttribute==="function"&&typeof $.setAttribute==="function"}function T5($,J=E$){if($===null||$===void 0)return"0";let Z=J;if(typeof J!=="number"||isNaN(J)||J<0)Z=E$;if(Z>i6)Z=i6;let Q=J8($).toFixed(Z);if(Q.includes("."))return Q.replace(/\.?0+$/,"");return Q}function Pz($){if($===null||$===void 0)return"";return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var D0={SVG_STRING:"string",DOM_ELEMENT:"dom",FILE_PATH:"file",URL:"url",XML_DOCUMENT:"xml",CSS_SELECTOR:"selector",OBJECT_ELEMENT:"object",EMBED_ELEMENT:"embed",IFRAME_ELEMENT:"iframe"},_7={SVG_STRING:"string",DOM_ELEMENT:"dom",XML_DOCUMENT:"xml"},F7={STRING:"string",FILE:"file",DOM_REPLACE:"dom_replace",DOM_UPDATE:"dom_update",DOWNLOAD:"download"};function K8($){if($===null||$===void 0)return F7.STRING;if(typeof $==="object"&&$.nodeType)return F7.DOM_UPDATE;if(typeof $==="string"){let J=$.trim();if(typeof document!=="undefined"&&(J.startsWith("#")||J.startsWith(".")||J.startsWith("[")))return F7.DOM_REPLACE;if(J.includes("/")||J.includes("\\")||/\.\w+$/.test(J))return F7.FILE;if(J.toLowerCase()==="download")return F7.DOWNLOAD}return F7.STRING}async function b5($,J=null,Z={}){let K=K8(J),Q;if(typeof $==="string")Q=$;else Q=t6($,_7.SVG_STRING,Z);switch(K){case F7.STRING:return Q;case F7.FILE:{if(typeof process!=="undefined"&&process.versions?.node){let H=await import("fs"),q=(await Promise.resolve().then(() => (C6(),I6))).dirname(J);if(q&&q!=="."&&!H.existsSync(q))H.mkdirSync(q,{recursive:!0});H.writeFileSync(J,Q,"utf8");return}throw new Error("File saving requires Node.js environment")}case F7.DOM_REPLACE:{if(typeof document==="undefined")throw new Error("DOM operations require browser environment");let H=document.querySelector(J);if(!H)throw new Error(`No element found for selector: ${J}`);H.innerHTML=Q;return}case F7.DOM_UPDATE:{if(typeof document==="undefined")throw new Error("DOM operations require browser environment");if(J.tagName?.toLowerCase()==="svg"){let q=new DOMParser().parseFromString(Q,"image/svg+xml").documentElement;while(J.attributes.length>0)J.removeAttribute(J.attributes[0].name);for(let W of q.attributes)J.setAttribute(W.name,W.value);J.innerHTML=q.innerHTML}else J.innerHTML=Q;return}case F7.DOWNLOAD:{if(typeof document==="undefined"||typeof Blob==="undefined")throw new Error("Download requires browser environment");let H=new Blob([Q],{type:"image/svg+xml"}),z=URL.createObjectURL(H),q=document.createElement("a");q.href=z,q.download=Z.filename||"output.svg",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(z);return}default:return Q}}function r6($){if($===null||$===void 0)throw new Error("Input cannot be null or undefined");if(typeof $==="string"){let J=$.trim();if(J.startsWith("<"))return D0.SVG_STRING;else if($.startsWith("http://")||$.startsWith("https://"))return D0.URL;else if(typeof document!=="undefined"&&(J.startsWith("#")||J.startsWith(".")||J.startsWith("[")))return D0.CSS_SELECTOR;else return D0.FILE_PATH}if(typeof HTMLObjectElement!=="undefined"&&$ instanceof HTMLObjectElement)return D0.OBJECT_ELEMENT;if(typeof HTMLEmbedElement!=="undefined"&&$ instanceof HTMLEmbedElement)return D0.EMBED_ELEMENT;if(typeof HTMLIFrameElement!=="undefined"&&$ instanceof HTMLIFrameElement)return D0.IFRAME_ELEMENT;if(a($))return D0.DOM_ELEMENT;if($&&$.nodeType===9)return D0.XML_DOCUMENT;return D0.SVG_STRING}async function a6($,J){switch(J){case D0.SVG_STRING:return d0($);case D0.DOM_ELEMENT:if($&&typeof $.serialize==="function")return $;if(typeof XMLSerializer!=="undefined"){let K=new XMLSerializer().serializeToString($);return d0(K)}return $;case D0.XML_DOCUMENT:{let Z=$.documentElement||$;if(Z&&typeof Z.serialize==="function")return Z;if(typeof XMLSerializer!=="undefined"){let Q=new XMLSerializer().serializeToString(Z);return d0(Q)}return Z}case D0.FILE_PATH:{let K=(()=>({})).readFileSync($,"utf8");return d0(K)}if(typeof process!=="undefined"&&process.versions?.node){let{readFileSync:Z}=await import("fs"),K=Z($,"utf8");return d0(K)}throw new Error("File loading requires Node.js environment");case D0.URL:if(typeof fetch!=="undefined"){let K=await(await fetch($)).text();return d0(K)}throw new Error("URL loading requires fetch API");case D0.CSS_SELECTOR:if(typeof document!=="undefined"){let Z=document.querySelector($);if(!Z)throw new Error(`No element found for selector: ${$}`);if(Z.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(Z));let K=Z.querySelector("svg");if(K)return d0(new XMLSerializer().serializeToString(K));throw new Error(`Element "${$}" is not an SVG and contains no SVG`)}throw new Error("CSS selector requires browser environment");case D0.OBJECT_ELEMENT:try{if($.contentDocument&&$.contentDocument.documentElement){let Z=$.contentDocument.documentElement;if(Z.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(Z))}}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);throw new Error("HTMLObjectElement: SVG content not accessible (cross-origin or security error)")}throw new Error("HTMLObjectElement: SVG content not accessible (not loaded or cross-origin)");case D0.EMBED_ELEMENT:if(typeof $.getSVGDocument==="function"){let Z=$.getSVGDocument();if(Z&&Z.documentElement)return d0(new XMLSerializer().serializeToString(Z.documentElement))}throw new Error("HTMLEmbedElement: SVG content not accessible");case D0.IFRAME_ELEMENT:try{let Z=$.contentDocument;if(Z&&Z.documentElement){let K=Z.documentElement;if(K.tagName.toLowerCase()==="svg")return d0(new XMLSerializer().serializeToString(K))}}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);throw new Error("HTMLIFrameElement: SVG content not accessible (cross-origin)")}throw new Error("HTMLIFrameElement: No SVG content found");default:throw new Error(`Unknown input type: ${J}`)}}function t6($,J,Z={}){switch(J){case _7.SVG_STRING:{let K=N7($,{minify:Z.minify!==!1});return w5(K)}case _7.DOM_ELEMENT:return $;case _7.XML_DOCUMENT:return $;default:{let K=N7($,{minify:Z.minify!==!1});return w5(K)}}}function G0($){return async function(J,Z={}){let K=r6(J),Q=await a6(J,K),H=Z.outputFormat||(K===D0.DOM_ELEMENT?_7.DOM_ELEMENT:_7.SVG_STRING),z=await $(Q,Z);return t6(z,H,Z)}}var Z8=G0(($,J={})=>{let Z=J.minify!==!1,K=J.remove!==!1,Q=J.force||!1,H=J.preserve||[],z=J.preservePrefixes||[];if(!Q){let I=$.querySelectorAll("script").length>0,f=Array.from($.querySelectorAll("style")).some((u)=>u.textContent&&u.textContent.trim().length>0);if(I||f)return $}let q=(I)=>{if(H.includes(I))return!0;if(z.some((f)=>I.startsWith(f)))return!0;return!1},W=(I)=>{try{return decodeURI(I)}catch(f){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${f.message}`);return I}},j=K5($),G=new Set;for(let I of j.all)G.add(I),G.add(W(I));let F=new Map,_=(I)=>{let f=I.getAttribute("id");if(f){if(!F.has(f))F.set(f,I)}for(let u of I.children)if(a(u))_(u)};_($);let U=new Set,O=new Set,V=(I)=>{let f=I.getAttribute("id");if(f){if(U.has(f))O.add(f);U.add(f)}for(let u of I.children)if(a(u))V(u)};V($);let M=new Set,Y=new Map,X=0,w=()=>{let I;do I=`a${X++}`;while(G.has(I)&&!F.has(I));return I},R=(I)=>{let f=I.getAttribute("id");if(f){if(O.has(f)){if(M.has(f)){I.removeAttribute("id");return}M.add(f)}let u=W(f),m=G.has(f)||G.has(u);if(q(f));else if(!m&&K)I.removeAttribute("id");else if(Z&&m){let S=w();if(Y.set(f,S),u!==f)Y.set(u,S);I.setAttribute("id",S)}}for(let u of I.children)if(a(u))R(u)};if(R($),Z){let I=(m)=>{let S=(x)=>x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(let x of m.getAttributeNames()){let h=m.getAttribute(x);if(h&&h.includes("url(#")){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`url\\(#${c}\\)`,"g"),`url(#${d})`);let p=S(encodeURI(E));h=h.replace(new RegExp(`url\\(#${p}\\)`,"g"),`url(#${d})`)}m.setAttribute(x,h)}if((x==="href"||x==="xlink:href")&&h?.startsWith("#")){let E=h.substring(1),d=W(E);if(Y.has(E))m.setAttribute(x,`#${Y.get(E)}`);else if(Y.has(d))m.setAttribute(x,`#${Y.get(d)}`)}if((x==="begin"||x==="end")&&h){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`^${c}\\.`,"g"),`${d}.`),h=h.replace(new RegExp(`;${c}\\.`,"g"),`;${d}.`)}m.setAttribute(x,h)}if((x==="values"||x==="from"||x==="to"||x==="by")&&h){for(let[E,d]of Y){let c=S(E);h=h.replace(new RegExp(`#${c}([;\\s]|$)`,"g"),`#${d}$1`)}m.setAttribute(x,h)}}for(let x of m.children)if(a(x))I(x)};I($);let f=(m)=>m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=$.getElementsByTagName("style");for(let m of u){let S=m.textContent;if(!S)continue;for(let[x,h]of Y){let E=f(x);S=S.replace(new RegExp(`#${E}([^\\w-]|$)`,"g"),`#${h}$1`),S=S.replace(new RegExp(`url\\(#${E}\\)`,"g"),`url(#${h})`)}m.textContent=S}}return $}),f$=G0(($,J={})=>{let Z=J.precision||6,K=(H)=>{let z=parseFloat(H);if(isNaN(z))return H;let j=J8(z).toDecimalPlaces(Z).toString();if(j.includes("."))j=j.replace(/0+$/,""),j=j.replace(/\.$/,"");return j},Q=(H)=>{for(let z of H.getAttributeNames()){let q=H.getAttribute(z);if(z.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|stroke-width|font-size)$/)){if(d7(q))continue;H.setAttribute(z,K(q))}if(z==="d"&&q){let W=q.replace(A$,(j)=>K(j));H.setAttribute("d",W)}if(z==="transform"&&q){let W=q.replace(A$,(j)=>K(j));H.setAttribute("transform",W)}if(z==="points"&&q){let W=q.replace(A$,(j)=>K(j));H.setAttribute("points",W)}}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),f5=G0(($,J={})=>{let Z=J.precision||6,K=(H)=>{let z=parseFloat(H);if(isNaN(z))return H;let W=J8(z).toDecimalPlaces(Z).toString();if(W.includes("."))W=W.replace(/0+$/,""),W=W.replace(/\.$/,"");return W},Q=(H)=>{for(let z of["points"]){let q=H.getAttribute(z);if(q){let W=q.replace(A$,K);H.setAttribute(z,W)}}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),S5=G0(($,J={})=>{let Z=["data-name","data-id","class"],K=["xmlns:serif"],Q=(H)=>{for(let z of Z)if(H.hasAttribute(z))H.removeAttribute(z);if(!J.preserveVendor){for(let z of K)if(H.hasAttribute(z))H.removeAttribute(z)}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),v5=G0(($,J={})=>{let Z=(K)=>{if(K.hasAttribute("enable-background"))K.removeAttribute("enable-background");for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),D5=G0(($,J={})=>{let Z=Array.from($.querySelectorAll("style")).some((Y)=>{let X=Y.textContent||"";return X.includes("@media")||X.includes(":hover")||X.includes(":focus")||X.includes(":active")||X.includes(":visited")||X.includes(":first-child")||X.includes(":last-child")||X.includes(":nth-child")||X.includes(":not(")}),K=$.querySelectorAll("script").length>0,Q=new Set,H=$.outerHTML||"",z=H.matchAll(/url\(#([^)]+)\)/g);for(let Y of z)Q.add(Y[1]);let q=H.matchAll(/xlink:href="#([^"]+)"/g);for(let Y of q)Q.add(Y[1]);let W=H.matchAll(/\shref="#([^"]+)"/g);for(let Y of W)Q.add(Y[1]);let j={clippath:"clipPath",textpath:"textPath",lineargradient:"linearGradient",radialgradient:"radialGradient",meshgradient:"meshGradient",hatchpath:"hatchPath",solidcolor:"solidColor",foreignobject:"foreignObject",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",animatemotion:"animateMotion",animatetransform:"animateTransform"},G=(Y)=>j[Y]||Y,F=["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","tref","textPath","textpath","defs","clipPath","clippath","mask","pattern","linearGradient","lineargradient","radialGradient","radialgradient","meshGradient","meshgradient","meshrow","meshpatch","hatch","hatchpath","hatchPath","solidcolor","solidColor","stop","image","use","symbol","marker","title","desc","metadata","foreignObject","foreignobject","switch","a","filter","feBlend","feblend","feColorMatrix","fecolormatrix","feComponentTransfer","fecomponenttransfer","feComposite","fecomposite","feConvolveMatrix","feconvolvematrix","feDiffuseLighting","fediffuselighting","feDisplacementMap","fedisplacementmap","feDistantLight","fedistantlight","feDropShadow","fedropshadow","feFlood","feflood","feFuncA","fefunca","feFuncB","fefuncb","feFuncG","fefuncg","feFuncR","fefuncr","feGaussianBlur","fegaussianblur","feImage","feimage","feMerge","femerge","feMergeNode","femergenode","feMorphology","femorphology","feOffset","feoffset","fePointLight","fepointlight","feSpecularLighting","fespecularlighting","feSpotLight","fespotlight","feTile","fetile","feTurbulence","feturbulence","animate","animateMotion","animatemotion","animateTransform","animatetransform","set","mpath","view","cursor","style","script","font","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","glyph","missing-glyph","hkern","vkern"],_={fill:"#000","fill-opacity":"1","fill-rule":"nonzero",stroke:"none","stroke-width":"1","stroke-opacity":"1","stroke-linecap":"butt","stroke-linejoin":"miter","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-dashoffset":"0",opacity:"1",visibility:"visible",display:"inline",clip:"auto","clip-path":"none","clip-rule":"nonzero",mask:"none","marker-start":"none","marker-mid":"none","marker-end":"none","stop-color":"#000","stop-opacity":"1","flood-color":"#000","flood-opacity":"1","lighting-color":"#fff","color-interpolation":"sRGB","color-interpolation-filters":"linearRGB","color-rendering":"auto","shape-rendering":"auto","text-rendering":"auto","image-rendering":"auto","paint-order":"normal","vector-effect":"none","text-anchor":"start","text-overflow":"clip","text-decoration":"none","dominant-baseline":"auto","alignment-baseline":"baseline","baseline-shift":"baseline","writing-mode":"lr-tb",direction:"ltr","unicode-bidi":"normal","letter-spacing":"normal","word-spacing":"normal","font-style":"normal","font-variant":"normal","font-weight":"normal","font-stretch":"normal","font-size":"medium","font-size-adjust":"none"},U={circle:{cx:"0",cy:"0"},ellipse:{cx:"0",cy:"0"},line:{x1:"0",y1:"0",x2:"0",y2:"0"},rect:{x:"0",y:"0",rx:"0",ry:"0"},image:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},svg:{x:"0",y:"0",preserveAspectRatio:"xMidYMid meet"},symbol:{preserveAspectRatio:"xMidYMid meet"},marker:{markerUnits:"strokeWidth",refX:"0",refY:"0",markerWidth:"3",markerHeight:"3"},linearGradient:{x1:"0",y1:"0",x2:"100%",y2:"0",spreadMethod:"pad"},radialGradient:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%",spreadMethod:"pad"},pattern:{x:"0",y:"0",patternUnits:"objectBoundingBox",patternContentUnits:"userSpaceOnUse"},clipPath:{clipPathUnits:"userSpaceOnUse"},mask:{maskUnits:"objectBoundingBox",maskContentUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},filter:{primitiveUnits:"userSpaceOnUse",x:"-10%",y:"-10%",width:"120%",height:"120%"},feBlend:{mode:"normal"},feColorMatrix:{type:"matrix"},feComposite:{operator:"over",k1:"0",k2:"0",k3:"0",k4:"0"},feTurbulence:{baseFrequency:"0",numOctaves:"1",seed:"0",stitchTiles:"noStitch",type:"turbulence"},feDisplacementMap:{scale:"0",xChannelSelector:"A",yChannelSelector:"A"},feDistantLight:{azimuth:"0",elevation:"0"},fePointLight:{x:"0",y:"0",z:"0"},a:{target:"_self"},textPath:{startOffset:"0"}},O=(Y)=>{if(Y.startsWith("data-"))return!0;if(Y.startsWith("aria-"))return!0;if(Y==="role")return!0;if(Y==="xmlns")return!0;if(Y.includes(":")&&!Y.startsWith("xml:")&&!Y.startsWith("xlink:"))return!0;return!1},V=(Y,X)=>{let w=Y.parentNode;while(w&&a(w)){let R=w.getAttribute(X);if(R!==null)return R;w=w.parentNode}return null},M=(Y,X={})=>{if(Y.tagName==="foreignObject")return;if(Y.tagName.includes(":"))return;if(!Y.getAttribute("id")){for(let[u,m]of Object.entries(_))if(!O(u)&&Y.getAttribute(u)===m)Y.removeAttribute(u);let f=U[Y.tagName.toLowerCase()]||{};for(let[u,m]of Object.entries(f))if(!O(u)&&Y.getAttribute(u)===m)Y.removeAttribute(u);if(!Z){for(let u of Y.getAttributeNames())if(q6.has(u)&&!O(u)){let m=Y.getAttribute(u),S=V(Y,u);if(S!==null&&m===S)Y.removeAttribute(u)}}}let w={...X};for(let f of q6){let u=Y.getAttribute(f);if(u!==null)w[f]=u}let R=Y.tagName.toLowerCase(),I=c6[R]||c6[G(R)];for(let f of[...Y.children])if(a(f)){if(f.tagName.includes(":"))continue;let u=f.tagName.toLowerCase(),m=f.getAttribute("id"),S=K&&m,x=(h)=>{let E=h.getAttribute("id");if(E&&Q.has(E))return!0;for(let d of h.children||[])if(a(d)&&x(d))return!0;return!1};if(!F.includes(u)){if(!x(f)&&!S){Y.removeChild(f);continue}}if(I&&!I.has(u)&&!I.has(G(u))){if(!x(f)&&!S){Y.removeChild(f);continue}}M(f,w)}};return M($,{}),$}),h5=G0(($,J={})=>{let Z=["x","y","width","height","viewBox"],K=(Q)=>{if(Q.tagName==="g"){for(let H of Z)if(Q.hasAttribute(H))Q.removeAttribute(H)}for(let H of Q.children)if(a(H))K(H)};return K($),$}),y5=G0(($,J={})=>{let Z=$.getElementsByTagName("defs");for(let K of[...Z])if(K.children.length===0){if(K.parentNode)K.parentNode.removeChild(K)}return $}),S$=G0(($,J={})=>{let Z=J.force||!1,K=$.querySelectorAll("script").length>0,Q=new Set,H=(G)=>{for(let F of G.getAttributeNames()){let _=G.getAttribute(F);if(_&&_.includes("url(#")){let U=_.matchAll(/url\(#([^)]+)\)/g);for(let O of U)Q.add(O[1])}if((F==="href"||F==="xlink:href")&&_&&_.startsWith("#"))Q.add(_.substring(1))}for(let F of G.children)if(a(F))H(F)};H($);let z=(G)=>{let F=G.getAttribute("href")||G.getAttribute("xlink:href");if(F&&F.startsWith("#"))return!0;for(let _ of G.getAttributeNames?G.getAttributeNames():[]){let U=G.getAttribute(_);if(U&&U.includes("url(#"))return!0}return!1},q=(G)=>{for(let F of G.children){if(!a(F))continue;let _=F.tagName?.toLowerCase();if(p6.animation.has(_))return!0;if(q(F))return!0}return!1},W=(G)=>{let F=G.getAttribute("id");if(F&&(Q.has(F)||K))return!0;for(let _ of G.children){if(!a(_))continue;if(W(_))return!0}return!1},j=(G,F=!1)=>{let _=G.tagName.toLowerCase(),U=F||_==="defs",O=G.getAttribute("display"),V=G.getAttribute("visibility"),M=parseFloat(G.getAttribute("opacity")||"1");if(O==="none"||V==="hidden"||M===0){if(!Z&&W(G));else if(!Z&&_==="marker");else if(!Z&&(G.getAttribute("marker-start")||G.getAttribute("marker-mid")||G.getAttribute("marker-end")));else if(!Z&&U&&p6.nonRendering.has(_));else if(!Z&&p6.animation.has(_));else if(!Z&&q(G));else if(!Z&&_==="use");else if(!Z&&z(G));else if(G.parentNode){G.parentNode.removeChild(G);return}}for(let X of[...G.children])if(a(X))j(X,U)};return j($),$}),u5=G0(($,J={})=>{let Z=$.getElementsByTagName("text"),K=(z)=>{let q=z.textContent||"";if(z.children)for(let W of z.children)q+=K(W);return q},Q=(z,q)=>{if(!q||q.length===0)return!1;return(z.getAttributeNames?z.getAttributeNames():[]).some((j)=>q.some((G)=>j.startsWith(G+":")))},H=J.preserveNamespaces||[];for(let z of[...Z]){let q=K(z),W=!q||q.trim()==="",j=Q(z,H);if(W&&!j){if(z.parentNode)z.parentNode.removeChild(z)}}return $}),v$=G0(($,J={})=>{let Z=["g","defs","symbol","marker","clipPath","clippath","mask","pattern"],K=$.querySelectorAll("script").length>0,Q=new Set,H=(q)=>{for(let W of q.getAttributeNames?q.getAttributeNames():[]){let j=q.getAttribute(W);if(j&&j.includes("url(#")){let G=j.matchAll(/url\(#([^)]+)\)/g);for(let F of G)Q.add(F[1])}if((W==="href"||W==="xlink:href")&&j&&j.startsWith("#"))Q.add(j.substring(1))}for(let W of q.children||[])if(a(W))H(W)};H($);let z=(q)=>{for(let G of[...q.children])if(a(G))z(G);let W=q.tagName?.toLowerCase();if(!Z.includes(q.tagName)&&!Z.includes(W))return;if(q.getAttribute("href")||q.getAttribute("xlink:href"))return;let j=q.getAttribute("id");if(j&&(Q.has(j)||K))return;if(q.children.length===0){if(q.parentNode)q.parentNode.removeChild(q)}};return z($),$}),g5=G0(($,J={})=>{return $}),x5=G0(($,J={})=>{return $}),D$=G0(($,J={})=>{return $}),h$=G0(($,J={})=>{if(J.preserveVendor)return $;let Z=$.getElementsByTagName("metadata");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),m5=G0(($,J={})=>{let Z=$.getElementsByTagName("title");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),d5=G0(($,J={})=>{let Z=$.getElementsByTagName("desc");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),Q8=G0(($,J={})=>{if(J.preserveVendor===!0)return $;let Z=J.preserveNamespaces||[],K=new Set(Z);if(K.has("sodipodi"))K.add("inkscape");if(K.has("inkscape"))K.add("sodipodi");let Q=["inkscape","sodipodi","illustrator","sketch","ai","serif","vectornator","figma"].filter((j)=>!K.has(j));if(Q.length===0)return $;let H=(j)=>{for(let G of[...j.children])if(a(G)){let F=G.tagName.indexOf(":");if(F>0){let _=G.tagName.substring(0,F);if(Q.includes(_)){j.removeChild(G);continue}}H(G)}};H($);let z=(j)=>{for(let G of[...j.getAttributeNames()]){if(G.startsWith("xmlns:"))continue;let F=G.indexOf(":");if(F>0){let _=G.substring(0,F);if(Q.includes(_))j.removeAttribute(G)}}for(let G of j.children)if(a(G))z(G)};z($);let q=new Set,W=(j)=>{for(let F of j.getAttributeNames()){if(F.startsWith("xmlns:"))continue;let _=F.indexOf(":");if(_>0){let U=F.substring(0,_);q.add(U)}}let G=j.tagName.indexOf(":");if(G>0)q.add(j.tagName.substring(0,G));for(let F of j.children)if(a(F))W(F)};W($);for(let j of Q){let G=`xmlns:${j}`;if($.hasAttribute(G)&&!q.has(j))$.removeAttribute(G)}return $}),p5=G0(($,J={})=>{let Z=(K)=>{for(let Q of[...K.getAttributeNames()]){let H=K.getAttribute(Q);if(H===""||H===null)K.removeAttribute(Q)}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),c5=G0(($,J={})=>{let Z=$.getAttribute("width"),K=$.getAttribute("height"),Q=$.getAttribute("viewBox");if(d7(Z)||d7(K))return $;if(Z&&K&&Q){let H=Q.split(/[\s,]+/).map(parseFloat),z=parseFloat(Z),q=parseFloat(K);if(isNaN(z)||isNaN(q)||H.some((j)=>isNaN(j)))return $;let W=0.000001;if(H.length===4&&Math.abs(H[0])<W&&Math.abs(H[1])<W&&Math.abs(H[2]-z)<W&&Math.abs(H[3]-q)<W)$.removeAttribute("viewBox")}return $}),l5=G0(($,J={})=>{let Z=J.preserveSvgNamespace!==!1,K=J.removeXlinkNamespace!==!1;if(J.preserveVendor){if(!Z)$.removeAttribute("xmlns");return $}if(!Z)$.removeAttribute("xmlns");if(K){let Q=!1,H=(z)=>{for(let q of z.getAttributeNames())if(q.startsWith("xlink:")){Q=!0;return}for(let q of z.children){if(a(q))H(q);if(Q)return}};if(H($),!Q)$.removeAttribute("xmlns:xlink")}return $.removeAttribute("xmlns:svg"),$}),n5=G0(($,J={})=>{let Z=$.querySelectorAll("script").length>0,K=new Set,Q=(z)=>{for(let q of z.getAttributeNames()){let W=z.getAttribute(q);if(W&&W.includes("url(#")){let j=W.matchAll(/url\(#([^)]+)\)/g);for(let G of j)K.add(G[1])}if((q==="href"||q==="xlink:href")&&W&&W.startsWith("#"))K.add(W.substring(1))}for(let q of z.children)if(a(q))Q(q)};Q($);let H=$.getElementsByTagName("image");for(let z of[...H]){let q=z.getAttribute("id");if(q&&(K.has(q)||Z))continue;if(z.parentNode)z.parentNode.removeChild(z)}return $}),s5=G0(($,J={})=>{let Z=new Set,K=(H)=>{for(let z of H.getAttributeNames()){let q=H.getAttribute(z);if(q&&q.includes("url(#")){let W=q.matchAll(/url\(#([^)]+)\)/g);for(let j of W)Z.add(j[1])}if((z==="href"||z==="xlink:href")&&q&&q.startsWith("#"))Z.add(q.substring(1))}for(let z of H.children)if(a(z))K(z)};K($);let Q=$.getElementsByTagName("script");for(let H of[...Q]){let z=H.getAttribute("id");if(!z||!Z.has(z)){if(H.parentNode)H.parentNode.removeChild(H)}}return $}),o5=G0(($,J={})=>{let Z=J.precision||6,K=J.convertRoundedRects||!1,Q=["rect","circle","ellipse","line","polyline","polygon"],H=(z)=>{if(Q.includes(z.tagName)){if(z.tagName==="rect"){let W=parseFloat(z.getAttribute("x")||"0"),j=parseFloat(z.getAttribute("y")||"0"),G=parseFloat(z.getAttribute("width")||"0"),F=parseFloat(z.getAttribute("height")||"0");if(isNaN(W)||isNaN(j)||isNaN(G)||isNaN(F)){for(let _ of[...z.children])if(a(_))H(_);return}}if(z.tagName==="rect"&&!K){let W=parseFloat(z.getAttribute("rx")||"0"),j=parseFloat(z.getAttribute("ry")||"0");if(isNaN(W)||isNaN(j)||W>0||j>0){for(let G of[...z.children])if(a(G))H(G);return}}if(z.tagName==="polyline"||z.tagName==="polygon"){if((z.getAttribute("points")||"").trim().split(/[\s,]+/).length<4){for(let G of[...z.children])if(a(G))H(G);return}}let q=i8(z,Z);if(q){let W=new B0("path",{d:q});for(let j of z.getAttributeNames())if(!j.match(/^(x|y|cx|cy|r|rx|ry|width|height|x1|y1|x2|y2|points)$/)){let G=z.getAttribute(j);if(G!==null)W.setAttribute(j,G)}for(let j of[...z.children])W.appendChild(j);if(z.parentNode)z.parentNode.replaceChild(W,z)}}for(let q of[...z.children])if(a(q))H(q)};return H($),$}),i5=G0(($,J={})=>{let Z=J.precision||6,K=J.force||!1,Q=new Set,H=(q)=>{for(let W of["href","xlink:href"]){let j=q.getAttribute(W);if(j&&j.startsWith("#"))Q.add(j.substring(1))}for(let W of q.children)if(a(W))H(W)};H($);let z=$.getElementsByTagName("path");for(let q of z){let W=q.getAttribute("d");if(!W)continue;let j=q.getAttribute("id");if(!K&&j&&Q.has(j))continue;if(!K&&q.getAttribute("style"))continue;let G=q.getAttribute("stroke-linecap"),F=G&&G!=="butt";if((W.match(/[MmLlHhVvCcSsQqTtAaZz]/g)||[]).length<=1)continue;if(!K&&q.getAttribute("marker-mid"))continue;let U=o8(W);q.setAttribute("d",U)}return $}),r5=G0(($,J={})=>{let Z=J.precision||6,K=J.force||!1,Q=(H)=>{let z=H.getAttribute("transform");if(z){let q=j7(z),W=QJ(q,Z);if(!K&&W.length>=z.length);else if(!K&&H.getAttribute("stroke")&&H.getAttribute("stroke")!=="none"){let j=q.data[0][0].toNumber(),G=q.data[0][1].toNumber(),F=q.data[1][0].toNumber(),_=q.data[1][1].toNumber(),U=j*_-G*F,O=Math.abs(j-_)<0.000001&&Math.abs(G+F)<0.000001,V=0.0000000001;if(!O&&Math.abs(U)>0.0000000001);else H.setAttribute("transform",W)}else H.setAttribute("transform",W)}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),y$=G0(($,J={})=>{let Z=["fill","stroke","stop-color","flood-color","lighting-color"],K=(H)=>{if(!H||typeof H!=="string")return H;let z={white:"#fff",black:"#000",red:"#f00",green:"#0f0",blue:"#00f",yellow:"#ff0",cyan:"#0ff",magenta:"#f0f"};if(z[H.toLowerCase()])return z[H.toLowerCase()];let q=H.match(/^#([0-9a-f]{6})$/i);if(q){let W=q[1];if(W[0]===W[1]&&W[2]===W[3]&&W[4]===W[5])return`#${W[0]}${W[2]}${W[4]}`}return H},Q=(H)=>{for(let z of Z){let q=H.getAttribute(z);if(q)H.setAttribute(z,K(q))}for(let z of H.children)if(a(z))Q(z)};return Q($),$}),H8=G0(($,J={})=>{let Z=J.preserveVendor||!1,K=new Set(["alignment-baseline","baseline-shift","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cursor","direction","display","dominant-baseline","enable-background","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-orientation-horizontal","glyph-orientation-vertical","image-rendering","kerning","letter-spacing","lighting-color","marker","marker-end","marker-mid","marker-start","mask","opacity","overflow","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","transform","transform-origin","unicode-bidi","vector-effect","visibility","word-spacing","writing-mode"]),Q=(H)=>{let z=H.getAttribute("style");if(z){let q=z.split(";").map((j)=>j.trim()).filter((j)=>j),W=[];for(let j of q){let G=j.indexOf(":");if(G===-1)continue;let F=j.substring(0,G).trim(),_=j.substring(G+1).trim();if(F&&_){if(!F.startsWith("-")&&K.has(F))H.setAttribute(F,_);else if(Z&&F.startsWith("-"))W.push(j)}}if(W.length>0)H.setAttribute("style",W.join("; "));else H.removeAttribute("style")}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),a5=G0(($,J={})=>{let Z=$.getElementsByTagName("ellipse");for(let K of[...Z]){let Q=parseFloat(K.getAttribute("rx")||"0"),H=parseFloat(K.getAttribute("ry")||"0");if(isNaN(Q)||isNaN(H))continue;if(Math.abs(Q-H)<0.001){let z=new B0("circle",{});for(let q of K.getAttributeNames()){let W=K.getAttribute(q);if(q==="rx"||q==="ry")z.setAttribute("r",W);else z.setAttribute(q,W)}for(let q of[...K.children])z.appendChild(q);if(K.parentNode)K.parentNode.replaceChild(z,K)}}return $}),t5=G0(($,J={})=>{let Z=J.force||!1,K=(Q,H=!1,z=!1)=>{let q=Q.tagName.toLowerCase(),W=z||q==="switch";for(let j of[...Q.children])if(a(j))K(j,!1,W);if(q!=="g")return;if(!Z&&(H||W))return;if(!Z&&Q.getAttribute("filter"))return;if(Q.children.length===1){let j=Q.children[0];if(!a(j))return;if(!Z&&j.getAttribute("id"))return;let G=Array.from(Q.children).some((U)=>a(U)&&p6.animation.has(U.tagName.toLowerCase()));if(!Z&&G)return;let F=Q.getAttributeNames(),_=F.some((U)=>{if(q6.has(U))return!1;return j.hasAttribute(U)});if(!Z&&_)return;if(F.length===0){if(Q.parentNode)Q.parentNode.replaceChild(j,Q)}else{let U=!0;for(let O of F){if(!q6.has(O)&&O!=="class"&&O!=="style"){U=!1;break}if(j.hasAttribute(O)){U=!1;break}}if(U&&Q.parentNode){for(let O of F){let V=Q.getAttribute(O);if(V!==null)j.setAttribute(O,V)}Q.parentNode.replaceChild(j,Q)}}}};return K($,!0),$}),e5=G0(($,J={})=>{let Z=J.force||!1,K=(H)=>H&&H.includes("url("),Q=(H)=>{let z=[...H.children].filter((q)=>a(q)&&q.tagName==="path");for(let q=0;q<z.length-1;q++){let W=z[q],j=z[q+1];if(!Z&&(W.children.length>0||j.children.length>0))continue;let F=["marker-start","marker-mid","marker-end"].some((O)=>W.getAttribute(O)||j.getAttribute(O));if(!Z&&F)continue;if(!Z&&(W.getAttribute("clip-path")||W.getAttribute("mask")||j.getAttribute("clip-path")||j.getAttribute("mask")))continue;if(!Z){let O=W.getAttribute("fill"),V=W.getAttribute("stroke"),M=j.getAttribute("fill"),Y=j.getAttribute("stroke");if(K(O)||K(V)||K(M)||K(Y))continue}if(!Z){let O=W.getAttribute("fill-rule")||"nonzero",V=j.getAttribute("fill-rule")||"nonzero";if(O!==V)continue}if(!Z&&(W.getAttribute("filter")||j.getAttribute("filter")))continue;let _=W.getAttributeNames().filter((O)=>O!=="d").sort(),U=j.getAttributeNames().filter((O)=>O!=="d").sort();if(JSON.stringify(_)===JSON.stringify(U)){let O=!0;for(let V of _)if(W.getAttribute(V)!==j.getAttribute(V)){O=!1;break}if(O){let V=W.getAttribute("d"),M=j.getAttribute("d");if(W.setAttribute("d",`${V} ${M}`),j.parentNode)j.parentNode.removeChild(j);z.splice(q+1,1),q--}}}for(let q of H.children)if(a(q))Q(q)};return Q($),$}),$K=G0(($,J={})=>{let Z=(K)=>{if(K.tagName==="g")for(let Q of[...K.getAttributeNames()]){if(!q6.has(Q))continue;let H=K.getAttribute(Q);if(H){for(let z of K.children)if(a(z)&&!z.hasAttribute(Q))z.setAttribute(Q,H);K.removeAttribute(Q)}}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),JK=G0(($,J={})=>{let Z=(K)=>{if(K.tagName==="g"&&K.children.length>1)for(let Q of q6){let H=null,z=!0;for(let q of K.children){if(!a(q))continue;let W=q.getAttribute(Q);if(!W){z=!1;break}if(H===null)H=W;else if(H!==W){z=!1;break}}if(z&&H){K.setAttribute(Q,H);for(let q of K.children)if(a(q))q.removeAttribute(Q)}}for(let Q of K.children)if(a(Q))Z(Q)};return Z($),$}),z8=G0(($,J={})=>{if($.getElementsByTagName("script").length>0&&!J.force)return $;let K=$.getElementsByTagName("style");for(let Q of K){let H=Q.textContent;if(!H||!H.trim())continue;let z=H.includes("<![CDATA[")||H.includes("]]>"),q="",W="";if(z){let j=H.match(/^(\s*<!\[CDATA\[\s*)/),G=H.match(/(\s*\]\]>\s*)$/);if(j)q="<![CDATA[",H=H.replace(/^\s*<!\[CDATA\[\s*/,"");if(G)W="]]>",H=H.replace(/\s*\]\]>\s*$/,"")}if(H=H.replace(/\/\*[\s\S]*?\*\//g,""),H=H.replace(/\s+/g," "),H=H.replace(/\s*([{}:;,])\s*/g,"$1"),H=H.trim(),q||W)H=q+H+W;Q.textContent=H}return $}),KK=G0(($,J={})=>{let Z=J.onlyMatchedOnce!==!1,K=J.removeStyleElement!==!1,Q=$.getElementsByTagName("style"),H=[];for(let z of Q){let q=z.getAttribute("type");if(q&&q!=="text/css")continue;let W=z.textContent;if(!W||!W.trim())continue;if(W.includes("@media")||W.includes("@keyframes")||W.includes("@supports")||W.includes("@font-face"))continue;let j=W.match(/([^{]+)\{([^}]+)\}/g)||[],G=[];for(let U of j){let O=U.match(/([^{]+)\{([^}]+)\}/);if(!O)continue;let V=O[1].trim(),M=O[2].trim(),Y=!1;for(let w of G5.preventInlining)if(V.includes(w)){Y=!0;break}if(Y){H.push(U);continue}let X;try{X=G$(V)}catch(w){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${w.message}`);H.push(U);continue}G.push({selector:V,declarations:M,specificity:X,originalRule:U})}G.sort((U,O)=>F$(U.specificity,O.specificity));let F=new WeakMap,_=new Set;for(let{selector:U,declarations:O,specificity:V,originalRule:M}of G)try{let Y=$.querySelectorAll(U);if(Z&&U.startsWith("#")&&Y.length>1){H.push(M);continue}for(let X of Y){let w=X,R=!1;while(w){if(w.tagName==="foreignObject"){R=!0;break}w=w.parentNode}if(R)continue;if(!F.has(X))F.set(X,new Map),_.add(X);let I=F.get(X),f=X.getAttribute("style")||"";if(f&&I.size===0){let m=f.split(";");for(let S of m){let x=S.indexOf(":");if(x>0){let h=S.substring(0,x).trim(),E=S.substring(x+1).trim(),d=E.includes("!important");if(d)E=E.replace(/\s*!important\s*/g,"").trim();I.set(h,{specificity:[1,0,0,0],isImportant:d,value:E})}}}let u=O.split(";");for(let m of u){let S=m.indexOf(":");if(S<=0)continue;let x=m.substring(0,S).trim(),h=m.substring(S+1).trim(),E=h.includes("!important");if(E)h=h.replace(/\s*!important\s*/g,"").trim();let d=I.get(x);if(d){let c=F$(V,d.specificity);if(c<0){if(E&&!d.isImportant)I.set(x,{specificity:V,isImportant:E,value:h})}else if(c===0){if(E||!d.isImportant)I.set(x,{specificity:V,isImportant:E,value:h})}else if(!d.isImportant||E)I.set(x,{specificity:V,isImportant:E,value:h})}else I.set(x,{specificity:V,isImportant:E,value:h})}}}catch(Y){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Y.message}`);H.push(M)}for(let U of _){let O=F.get(U),V=[];for(let[M,{value:Y,isImportant:X}]of O)if(X)V.push(`${M}: ${Y} !important`);else V.push(`${M}: ${Y}`);U.setAttribute("style",V.join("; "))}if(K&&z.parentNode)if(H.length>0)z.textContent=H.join(`
|
|
19
|
+
`);else z.parentNode.removeChild(z)}return $}),ZK=G0(($,J={})=>{let Z=(K)=>{let Q=K.getAttributeNames().sort(),H=Q.map((z)=>[z,K.getAttribute(z)]);for(let z of Q)K.removeAttribute(z);for(let[z,q]of H)K.setAttribute(z,q);for(let z of K.children)if(a(z))Z(z)};return Z($),$}),QK=G0(($,J={})=>{let Z=$.getElementsByTagName("defs");for(let K of Z){let Q=[...K.children].filter((H)=>a(H));Q.sort((H,z)=>H.tagName.localeCompare(z.tagName));for(let H of[...K.children])K.removeChild(H);for(let H of Q)K.appendChild(H)}return $}),HK=G0(($,J={})=>{let Z=J.threshold||2,K=$.getElementsByTagName("path"),Q=new Map;for(let q of K){let W=q.getAttribute("d");if(W){if(!Q.has(W))Q.set(W,[]);Q.get(W).push(q)}}let H=$.querySelector("defs");if(!H)if(H=new B0("defs",{}),$.firstChild)$.insertBefore(H,$.firstChild);else $.appendChild(H);let z=0;for(let[q,W]of Q)if(W.length>=Z){let j=`path${z++}`,G=new B0("path",{id:j,d:q});H.appendChild(G);for(let F of W){let _=new B0("use",{href:`#${j}`});for(let U of F.getAttributeNames())if(U!=="d"){let O=F.getAttribute(U);if(O!==null)_.setAttribute(U,O)}for(let U of[...F.children])_.appendChild(U);if(F.parentNode)F.parentNode.replaceChild(_,F)}}return $}),zK=G0(($,J={})=>{let Z=$.getAttribute("viewBox");if(!Z)return $;let K=c8(Z);if(!K)return $;let Q=r7($),H=$.getElementsByTagName("path");for(let z of[...H]){let q=z.getAttribute("d");if(!q)continue;try{let W=v6(q),j=l8(W);if(!j)continue;let G=u6(z),_=y6(z,G,Q).getRenderedBBox(j),U={x:_.x,y:_.y,width:_.width,height:_.height};if(!n8(U,K)){if(z.parentNode)z.parentNode.removeChild(z)}}catch(W){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${W.message}`)}}return $}),qK=G0(($,J={})=>{let Z=$.getElementsByTagName("style");for(let K of[...Z])if(K.parentNode)K.parentNode.removeChild(K);return $}),WK=G0(($,J={})=>{let Z={new:"_blank",replace:"_self"},K=!1,Q=(H)=>{for(let z of[...H.getAttributeNames()])if(z.startsWith("xlink:")){let q=z.substring(6),W=H.getAttribute(z);if(q==="href")K=!0;else if(q==="show"){if(!H.hasAttribute("target")){let j=Z[W];if(j)H.setAttribute("target",j)}H.removeAttribute(z)}else if(q==="title"){if(!(H.querySelector&&H.querySelector("title"))&&W){let G=new B0("title",{},[],W);if(typeof H.insertBefore==="function"&&H.firstChild)H.insertBefore(G,H.firstChild);else if(typeof H.appendChild==="function")H.appendChild(G);else if(H.children&&Array.isArray(H.children))H.children.unshift(G),G.parentNode=H}H.removeAttribute(z)}else if(["actuate","type","role","arcrole"].includes(q))H.removeAttribute(z);else K=!0}for(let z of H.children)if(a(z))Q(z)};if(Q($),!K)$.removeAttribute("xmlns:xlink");return $}),jK=G0(($,J={})=>{let Z=J.attributes||{};for(let[K,Q]of Object.entries(Z))$.setAttribute(K,Q);return $}),GK=G0(($,J={})=>{let Z=J.classes||[],K=$.getAttribute("class")||"",Q=K?`${K} ${Z.join(" ")}`:Z.join(" ");return $.setAttribute("class",Q.trim()),$}),FK=G0(($,J={})=>{let Z=J.prefix||"svg",K=new Map,Q=new Map,H=(j)=>j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=(j)=>{let G=j.getAttribute("id");if(G){let F=`${Z}${G}`;K.set(G,F),j.setAttribute("id",F)}for(let F of j.children)if(a(F))z(F)};if(z($),J.prefixClassNames!==!1){let j=(F)=>{let _=F.getAttribute("class");if(_){for(let U of _.split(/\s+/))if(U&&!Q.has(U))Q.set(U,`${Z}${U}`)}for(let U of F.children)if(a(U))j(U)};j($);let G=(F)=>{let _=F.getAttribute("class");if(_){let U=_.split(/\s+/).map((O)=>Q.get(O)||O).join(" ");F.setAttribute("class",U)}for(let U of F.children)if(a(U))G(U)};G($)}let q=$.getElementsByTagName("style");for(let j of q){let G=j.textContent;if(!G)continue;for(let[F,_]of K){let U=H(F);G=G.replace(new RegExp(`#${U}([^\\w-]|$)`,"g"),`#${_}$1`),G=G.replace(new RegExp(`url\\(#${U}\\)`,"g"),`url(#${_})`)}if(J.prefixClassNames!==!1)for(let[F,_]of Q){let U=H(F);G=G.replace(new RegExp(`\\.${U}([^\\w-]|$)`,"g"),`.${_}$1`)}j.textContent=G}let W=(j)=>{for(let G of j.getAttributeNames()){let F=j.getAttribute(G);if(F&&F.includes("url(#")){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`url\\(#${O}\\)`,"g"),`url(#${U})`)}j.setAttribute(G,F)}if((G==="href"||G==="xlink:href")&&F?.startsWith("#")){let _=F.substring(1);if(K.has(_))j.setAttribute(G,`#${K.get(_)}`)}if(G==="begin"||G==="end"){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`(^|;|\\s)${O}\\.`,"g"),`$1${U}.`)}j.setAttribute(G,F)}if(G==="values"||G==="from"||G==="to"||G==="by"){for(let[_,U]of K){let O=H(_);F=F.replace(new RegExp(`#${O}([;\\s]|$)`,"g"),`#${U}$1`)}j.setAttribute(G,F)}}for(let G of j.children)if(a(G))W(G)};return W($),$}),_K=G0(($,J={})=>{return $.removeAttribute("width"),$.removeAttribute("height"),$}),UK=G0(($,J={})=>{let Z=J.selector||"*",K=J.attributes||[];try{let Q=$.querySelectorAll(Z);for(let H of Q)for(let z of K)if(H.hasAttribute(z))H.removeAttribute(z)}catch(Q){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Q.message}`)}return $}),VK=G0(($,J={})=>{let Z=J.pattern?new RegExp(J.pattern):null,K=J.attrs||[],Q=(H)=>{for(let z of[...H.getAttributeNames()])if(K.includes(z)||Z&&Z.test(z))H.removeAttribute(z);for(let z of H.children)if(a(z))Q(z)};return Q($),$}),MK=G0(($,J={})=>{let{name:Z,value:K}=J;if(!Z)return $;let Q=(H)=>{for(let z of[...H.children]){if(!a(z))continue;let q=z.getAttribute(Z);if(K===void 0){if(q!==null){H.removeChild(z);continue}}else if(q===K){H.removeChild(z);continue}Q(z)}};return Q($),$}),q8=G0(async($,J={})=>{let Z={...J,outputFormat:_7.DOM_ELEMENT},K=$;return K=await h$(K,Z),K=await D$(K,Z),K=await v$(K,Z),K=await S$(K,Z),K=await f$(K,Z),K=await y$(K,Z),K=await H8(K,Z),K=await Q8(K,Z),K=await Z8(K,Z),K=await z8(K,Z),K}),W8=G0(($,J={})=>{return $}),OK=G0(async($,J={})=>{let Z=J.preset||"default",K={...J,outputFormat:_7.DOM_ELEMENT};switch(Z){case"default":return await q8($,K);case"none":return await W8($,K);default:return $}}),YK=G0(async($,J={})=>{let Z=J.config||{},K={...J,outputFormat:_7.DOM_ELEMENT},Q=$;if(Z.removeMetadata!==!1)Q=await h$(Q,K);if(Z.removeComments!==!1)Q=await D$(Q,K);if(Z.cleanupNumericValues!==!1)Q=await f$(Q,K);if(Z.convertColors!==!1)Q=await y$(Q,K);if(Z.removeHiddenElements!==!1)Q=await S$(Q,K);if(Z.removeEmptyContainers!==!1)Q=await v$(Q,K);return Q});function XK($={}){return{precision:$.precision||6,removeMetadata:$.removeMetadata!==!1,removeComments:$.removeComments!==!1,cleanupNumericValues:$.cleanupNumericValues!==!1,convertColors:$.convertColors!==!1,removeHiddenElements:$.removeHiddenElements!==!1,removeEmptyContainers:$.removeEmptyContainers!==!1,...$}}var kK=G0(async($,J={})=>{let Z=N7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveClipPaths:!0,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),LK=G0(async($,J={})=>{let Z=N7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveMasks:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolvePatterns:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),wK=G0(($,J={})=>{let Z=r7($),K=(j)=>{let G=Z.get(j);if(!G)return null;let F=G.getAttribute("href")||G.getAttribute("xlink:href");return F?.startsWith("#")?F.substring(1):null},Q=(j,G)=>{let F=j.getAttribute("gradientUnits")||"objectBoundingBox",_=j.getAttribute("gradientTransform");if(Cz(G,K)){if(J.verbose)console.warn(`Circular gradient reference detected: #${G}`);return!1}if(F==="userSpaceOnUse")return!1;if(_)return!1;return!0},H=g7($,"fill");for(let j of H){let G=j.getAttribute("fill");if(G&&G.includes("url(")){let F=a7(G);if(F&&Z.has(F)){let _=Z.get(F),U=_.tagName.toLowerCase();if(U==="lineargradient"||U==="radialgradient"){if(!Q(_,F)){if(J.verbose)console.warn(`Skipping gradient flatten for ${F}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let O=R5(_,J.position||0.5);j.setAttribute("fill",O)}}else j.setAttribute("fill",J.fallbackColor||"#808080")}}let z=g7($,"stroke");for(let j of z){let G=j.getAttribute("stroke");if(G&&G.includes("url(")){let F=a7(G);if(F&&Z.has(F)){let _=Z.get(F),U=_.tagName.toLowerCase();if(U==="lineargradient"||U==="radialgradient"){if(!Q(_,F)){if(J.verbose)console.warn(`Skipping gradient flatten for ${F}: userSpaceOnUse or gradientTransform requires coordinate transformation`);continue}let O=R5(_,J.position||0.5);j.setAttribute("stroke",O)}}else j.setAttribute("stroke",J.fallbackColor||"#808080")}}let q=[...$.querySelectorAll("linearGradient, radialGradient")],W=(j)=>j.replace(/["\\]/g,"\\$&");for(let j of q){let G=j.getAttribute("id"),F=G?W(G):"";if(!(G&&([...$.querySelectorAll(`[fill*="url(#${F})"]`)].length>0||[...$.querySelectorAll(`[stroke*="url(#${F})"]`)].length>0))&&j.parentNode)j.parentNode.removeChild(j)}return $});function R5($,J=0.5){let Z=[...$.children].filter((q)=>q.tagName&&q.tagName.toLowerCase()==="stop");if(Z.length===0)return"#808080";if(Z.length===1)return B5(Z[0]);let K=Z.map((q)=>{let W=q.getAttribute("offset")||"0";if(W.endsWith("%"))W=parseFloat(W)/100;else W=parseFloat(W);return W=isNaN(W)?0:Math.max(0,Math.min(1,W)),{offset:W,color:B5(q),opacity:Az(q)}});K.sort((q,W)=>q.offset-W.offset);let Q=null,H=null;for(let q=0;q<K.length;q++){let W=K[q];if(W.offset<=J)Q=W;if(W.offset>=J&&!H){H=W;break}}if(!Q)return K[0].color;if(!H)return K[K.length-1].color;if(Q.offset===H.offset)return Q.color;let z=(J-Q.offset)/(H.offset-Q.offset);return Tz(Q.color,H.color,z)}function B5($){let J=$.getAttribute("stop-color");if(!J){let Z=$.getAttribute("style");if(Z){let K=Z.match(/stop-color\s*:\s*([^;]+)/i);if(K)J=K[1].trim()}}if(!J)J="#000000";return Ez(J)}function Az($){let J=$.getAttribute("stop-opacity");if(!J){let K=$.getAttribute("style");if(K){let Q=K.match(/stop-opacity\s*:\s*([^;]+)/i);if(Q)J=Q[1].trim()}}let Z=J?parseFloat(J):1;return isNaN(Z)?1:Z}function Ez($){if(!$||typeof $!=="string")return"#000000";let J=$.trim().toLowerCase();if(J.startsWith("#")){if(J.length===4)return"#"+J[1]+J[1]+J[2]+J[2]+J[3]+J[3];return J}if(J.startsWith("rgb(")){let K=J.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);if(K){let Q=parseInt(K[1],10),H=parseInt(K[2],10),z=parseInt(K[3],10);return RK(Q,H,z)}}let Z={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",fuchsia:"#ff00ff",purple:"#800080"};if(Z[J])return Z[J];return"#000000"}function Tz($,J,Z){let K=(U)=>{let O=U.replace("#","");if(O.length===3)O=O[0]+O[0]+O[1]+O[1]+O[2]+O[2];let V=parseInt(O.slice(0,2),16),M=parseInt(O.slice(2,4),16),Y=parseInt(O.slice(4,6),16);if(isNaN(V)||isNaN(M)||isNaN(Y))return[0,0,0];return[V,M,Y]},[Q,H,z]=K($),[q,W,j]=K(J),G=Math.round(Q+(q-Q)*Z),F=Math.round(H+(W-H)*Z),_=Math.round(z+(j-z)*Z);return RK(G,F,_)}function RK($,J,Z){let K=(Q)=>{return Math.max(0,Math.min(255,Math.round(Q))).toString(16).padStart(2,"0")};return"#"+K($)+K(J)+K(Z)}var BK=G0(async($,J={})=>{let Z=N7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolvePatterns:!0,resolveClipPaths:!1,resolveUse:!1,resolveMarkers:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),NK=G0(($,J={})=>{let Z=(Q)=>{if(Q.hasAttribute("filter"))Q.removeAttribute("filter");for(let H of Q.children)if(a(H))Z(H)};Z($);let K=$.getElementsByTagName("filter");for(let Q of[...K])if(Q.parentNode)Q.parentNode.removeChild(Q);return $}),IK=G0(async($,J={})=>{let Z=N7($,{minify:J.minify!==!1}),K=await B6(Z,{...J,resolveUse:!0,resolveClipPaths:!1,resolveMarkers:!1,resolvePatterns:!1,resolveMasks:!1,flattenTransforms:!1,removeUnusedDefs:!1});return d0(K.svg)}),CK=G0(($,J={})=>{let Z=$.getElementsByTagName("image");for(let K of[...Z])K.setAttribute("data-trace-needed","true");return $}),PK=G0(($,J={})=>{let{samples:Z=10,includeStroke:K=!0,includeFillOnly:Q=!1}=J,H=[...$.getElementsByTagName("path"),...$.getElementsByTagName("rect"),...$.getElementsByTagName("circle"),...$.getElementsByTagName("ellipse")],z=r7($),q=[];for(let W=0;W<H.length;W++)for(let j=W+1;j<H.length;j++){let G=H[W],F=H[j],_=T$(G,Z),U=T$(F,Z);if(!_||!U)continue;let O=u6(G),V=u6(F),M=y6(G,O,z),Y=y6(F,V,z);if(K&&!Q){if(M.hasStroke){let w=M.getStrokeExtent().toNumber();_=N5(_,w)}if(Y.hasStroke){let w=Y.getStrokeExtent().toNumber();U=N5(U,w)}}if(j$(_,U).overlaps)q.push({shape1:G.tagName,shape2:F.tagName,id1:G.getAttribute("id"),id2:F.getAttribute("id"),stroke1:M.hasStroke?M.strokeWidth.toNumber():0,stroke2:Y.hasStroke?Y.strokeWidth.toNumber():0,fillRule1:M.fillRule,fillRule2:Y.fillRule})}if(q.length>0)$.setAttribute("data-collisions",JSON.stringify(q));return $});function N5($,J){if(J<=0||!$||$.length===0)return $;let Z=0,K=0;for(let Q of $)Z+=Q.x,K+=Q.y;return Z/=$.length,K/=$.length,$.map((Q)=>{let H=Q.x-Z,z=Q.y-K,q=Math.sqrt(H*H+z*z);if(q<0.0001)return Q;let W=(q+J)/q;return{x:Z+H*W,y:K+z*W}})}var AK=G0(($,J={})=>{let{id1:Z,id2:K}=J;if(!Z||!K)return $;let Q=$.getElementById(Z),H=$.getElementById(K);if(!Q||!H)return $;let z=T$(Q,J.samples||10),q=T$(H,J.samples||10);if(z&&q){let W=x8(z,q);$.setAttribute("data-distance",W.distance.toString())}return $}),EK=G0(($,J={})=>{let Z=[],K=[],Q=new Set,H=new Set,z=(W)=>{if(W.tagName.includes(":")){let j=W.tagName.split(":")[0];Q.add(j)}for(let j of W.getAttributeNames()){let G=W.getAttribute(j);if(j==="xmlns")H.add("");else if(j.startsWith("xmlns:")){let F=j.substring(6);H.add(F)}if(j.includes(":")&&!j.startsWith("xmlns:")){let F=j.split(":")[0];Q.add(F)}if(G&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(G))Z.push(`Invalid XML characters in attribute '${j}' of <${W.tagName}>`)}if(W.textContent&&/[\x00-\x08\x0B\x0C\x0E-\x1F]/.test(W.textContent))Z.push(`Invalid XML characters in text content of <${W.tagName}>`);for(let j of W.children)if(a(j))z(j)};z($);for(let W of Q)if(W&&!H.has(W))Z.push(`Unbound namespace prefix: '${W}' - SVGO would produce invalid XML here`);let q={valid:Z.length===0,errors:Z,warnings:K,namespacesUsed:[...Q],namespacesDeclared:[...H]};return $.setAttribute("data-xml-validation",JSON.stringify(q)),$}),TK=G0(($,J={})=>{let Z=[],K=[],Q=J.version||"1.1";if($.tagName!=="svg")Z.push("Root element must be <svg>");let H=$.getAttribute("xmlns");if(!H)K.push("Missing xmlns attribute (required for standalone SVG)");else if(H!=="http://www.w3.org/2000/svg")Z.push(`Invalid SVG namespace: expected 'http://www.w3.org/2000/svg', got '${H}'`);let z=$.getAttribute("viewBox");if(z){let F=z.split(/[\s,]+/);if(F.length!==4)Z.push(`Invalid viewBox: expected 4 values, got ${F.length}`);else if(F.some((_)=>isNaN(parseFloat(_))))Z.push("Invalid viewBox: contains non-numeric values");else{let[_,U,O,V]=F.map(parseFloat);if(O<0||V<0)Z.push("Invalid viewBox: width and height must be non-negative")}}let q={meshGradients:[],hatches:[],solidColors:[],needsPolyfills:!1},W={meshGradient:"meshgradient",meshRow:"meshrow",meshPatch:"meshpatch",hatchPath:"hatchpath",solidColor:"solidcolor"},j=(F,_=0)=>{if(!F||!F.tagName){K.push(`Element at depth ${_} has no tagName property`);return}let U=F.tagName.toLowerCase(),O=F.tagName;if(W[O])Z.push(`Invalid SVG 2.0 element: <${O}> must be lowercase <${W[O]}> per SVG 2.0 specification`);if(U==="meshgradient"){let V=F.getAttribute("id");if(q.meshGradients.push(V||null),q.needsPolyfills=!0,!V)K.push("<meshgradient> element without 'id' attribute may be difficult to reference")}if(U==="hatch"){let V=F.getAttribute("id");if(q.hatches.push(V||null),q.needsPolyfills=!0,!V)K.push("<hatch> element without 'id' attribute may be difficult to reference")}if(U==="solidcolor"){let V=F.getAttribute("id");if(q.solidColors.push(V||null),q.needsPolyfills=!0,!V)K.push("<solidcolor> element without 'id' attribute may be difficult to reference")}if(U==="path"){let V=F.getAttribute("d");if(!V||!V.trim())Z.push("<path> element missing required 'd' attribute");else{let M=V.match(/[MmLlHhVvCcSsQqTtAaZz]/g);if(!M||M.length===0)Z.push("<path> 'd' attribute contains no valid commands");let Y=V.trim()[0];if(Y!=="M"&&Y!=="m")Z.push("<path> 'd' must start with M or m command")}}if(U==="rect"){let V=F.getAttribute("width"),M=F.getAttribute("height");if(V!==null&&!d7(V)&&parseFloat(V)<0)Z.push("<rect> width must be non-negative");if(M!==null&&!d7(M)&&parseFloat(M)<0)Z.push("<rect> height must be non-negative")}if(U==="circle"){let V=F.getAttribute("r");if(V!==null&&parseFloat(V)<0)Z.push("<circle> r must be non-negative")}if(U==="ellipse"){let V=F.getAttribute("rx"),M=F.getAttribute("ry");if(V!==null&&parseFloat(V)<0)Z.push("<ellipse> rx must be non-negative");if(M!==null&&parseFloat(M)<0)Z.push("<ellipse> ry must be non-negative")}if(U==="use"){let V=F.getAttribute("href")||F.getAttribute("xlink:href");if(V&&V.startsWith("#")){let M=V.substring(1);if(!$.getElementById(M))K.push(`<use> references non-existent ID: '${M}'`)}}for(let V of["fill","stroke","clip-path","mask","filter"]){let M=F.getAttribute(V);if(M&&M.startsWith("url(#")){let Y=M.match(/url\(#([^)]+)\)/);if(Y){let X=Y[1];if(!$.getElementById(X))K.push(`<${F.tagName}> ${V} references non-existent ID: '${X}'`)}}}if(c6[U]){let V=c6[U];for(let M of F.children)if(a(M)){let Y=M.tagName.toLowerCase();if(!V.has(Y))K.push(`<${Y}> is not a standard child of <${U}>`)}}for(let V of F.children)if(a(V))j(V,_+1)};if(j($),q.needsPolyfills){let F=[];if(q.meshGradients.length>0)F.push(`meshgradient (${q.meshGradients.length} found)`);if(q.hatches.length>0)F.push(`hatch (${q.hatches.length} found)`);if(q.solidColors.length>0)F.push(`solidcolor (${q.solidColors.length} found)`);K.push(`SVG contains SVG 2.0 features that require polyfills for browser compatibility: ${F.join(", ")}. Use --svg2-polyfills option to inject runtime polyfills.`)}let G={valid:Z.length===0,svgVersion:Q,errors:Z,warnings:K,elementsChecked:SK($),svg2Features:q};if($.setAttribute("data-svg-validation",JSON.stringify(G)),Z.length>0)$.setAttribute("data-validation-errors",JSON.stringify(Z));else $.setAttribute("data-validation-status","valid");return $}),bz=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout","keydown","keyup","keypress","activate","load","unload","abort","error","resize","scroll","beginEvent","endEvent","repeatEvent","touchstart","touchend","touchmove","touchcancel","wheel","auxclick","input","beforeinput","select","compositionstart","compositionupdate","compositionend"]),fz=G0(($,J={})=>{let Z=J.verbose||!1,K=J.printTables!==!1,Q={valid:!0,timestamp:new Date().toISOString(),media:{hasAudio:!1,hasVideo:!1,audioElements:[],videoElements:[],foreignObjectWithMedia:[],mediaEmbedMethod:null},smil:{hasAnimations:!1,animationCount:0,animationElements:{animate:0,animateTransform:0,animateMotion:0,animateColor:0,set:0},hasInteractiveAnimations:!1,eventTriggers:[],timingTriggers:[]},compatibility:{worksInAllBrowsers:!0,issues:[],recommendations:[]},errors:[],warnings:[],info:[]},H=(V)=>{let M=[],Y=V.toLowerCase(),X=(w)=>{if(w.tagName&&w.tagName.toLowerCase()===Y)M.push(w);for(let R of w.children||[])if(R&&R.tagName)X(R)};return X($),M},z=(V,M=[])=>{if(V.tagName)M.push(V);for(let Y of V.children||[])if(Y&&Y.tagName)z(Y,M);return M},q=H("audio");if(q.length>0)Q.media.hasAudio=!0,Q.media.audioElements=q.map((V)=>({id:V.getAttribute("id"),src:V.getAttribute("src"),hasSource:H("source").filter((M)=>M.parentNode===V).length>0}));let W=H("video");if(W.length>0)Q.media.hasVideo=!0,Q.media.videoElements=W.map((V)=>({id:V.getAttribute("id"),src:V.getAttribute("src")}));let j=H("foreignObject");for(let V of j){let M=V.children||[],Y=!1,X=[],w=(R)=>{let I=R.tagName?.toLowerCase();if(I==="audio"||I==="video")Y=!0,X.push({type:I,id:R.getAttribute("id"),src:R.getAttribute("src")});for(let f of R.children||[])if(f&&f.tagName)w(f)};for(let R of M)if(R&&R.tagName)w(R);if(Y)Q.media.hasAudio=!0,Q.media.foreignObjectWithMedia.push({id:V.getAttribute("id"),media:X}),Q.media.mediaEmbedMethod="foreignObject"}let G=z($);for(let V of G)for(let M of["src","href","xlink:href"]){let Y=V.getAttribute(M);if(Y&&Y.startsWith("data:audio/"))Q.media.hasAudio=!0,Q.media.mediaEmbedMethod="data-uri";if(Y&&Y.startsWith("data:video/"))Q.media.hasVideo=!0,Q.media.mediaEmbedMethod="data-uri"}let F=["animate","animateTransform","animateMotion","animateColor","set"];for(let V of F){let M=H(V),Y=M.length;Q.smil.animationElements[V==="animateTransform"?"animateTransform":V==="animateMotion"?"animateMotion":V==="animateColor"?"animateColor":V]=Y,Q.smil.animationCount+=Y;for(let X of M){let w=X.getAttribute("begin")||"",R=X.getAttribute("end")||"",I=(m,S)=>{let x=m.split(";").map((h)=>h.trim()).filter(Boolean);for(let h of x){let E=h.match(/^(?:([a-zA-Z_][a-zA-Z0-9_-]*)\.)?([a-zA-Z]+)(\s*[+-]\s*[\d.]+[smh]?)?$/);if(E){let[,d,c,p]=E;if(bz.has(c))Q.smil.hasInteractiveAnimations=!0,Q.smil.eventTriggers.push({animationElement:V,animationId:X.getAttribute("id"),attribute:S,event:c,targetId:d||null,offset:p?.trim()||null,parentId:X.parentNode?.getAttribute?.("id")})}else if(/^[\d.]+[smh]?$/.test(h)||h==="indefinite")Q.smil.timingTriggers.push({animationElement:V,value:h});else if(/\.(begin|end)/.test(h))Q.smil.timingTriggers.push({animationElement:V,value:h,type:"syncbase"})}};if(w)I(w,"begin");if(R)I(R,"end");let f=X.getAttribute("onbegin"),u=X.getAttribute("onend");if(f||u){if(Q.smil.hasInteractiveAnimations=!0,f?.includes("play()")||u?.includes("play()"))Q.info.push(`Animation uses JavaScript to trigger audio playback via ${f?"onbegin":"onend"} handler`)}}}if(Q.smil.hasAnimations=Q.smil.animationCount>0,Q.media.hasAudio)Q.compatibility.worksInAllBrowsers=!1,Q.warnings.push("SVG contains embedded audio. Browser autoplay policies will block playback in most scenarios."),Q.compatibility.issues.push({type:"AUDIO_AUTOPLAY_BLOCKED",severity:"HIGH",description:"Embedded audio in SVG is blocked by Chrome/Firefox/Safari autoplay policies",affectedBrowsers:["Chrome","Firefox","Safari","Edge"]}),Q.compatibility.recommendations.push("To enable audio playback, embed the SVG in an HTML page that extracts audio dynamically after user interaction","Use JavaScript to extract audio data URI from foreignObject and create Audio element on click","Consider using Web Audio API for more control over audio playback");if(Q.media.hasVideo)Q.compatibility.worksInAllBrowsers=!1,Q.warnings.push("SVG contains embedded video. This has limited browser support and autoplay restrictions.");if(Q.smil.hasAnimations)Q.info.push(`SVG contains ${Q.smil.animationCount} SMIL animation elements`),Q.compatibility.issues.push({type:"SMIL_IE_UNSUPPORTED",severity:"LOW",description:"SMIL animations are not supported in IE11",affectedBrowsers:["IE (no support)"]});if(Q.smil.hasInteractiveAnimations){let V=[...new Set(Q.smil.eventTriggers.map((M)=>M.event))];if(Q.info.push(`SVG contains interactive SMIL animations triggered by: ${V.join(", ")}`),V.includes("click")||V.includes("mouseover"))Q.compatibility.recommendations.push("Interactive animations (click/hover) work in most browsers but require the SVG to be inline or loaded as <object>/<embed>","Using <img> tag to display SVG will disable all interactivity and animations")}let _={Chrome:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Autoplay blocked without user gesture"},Firefox:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"MEI (Media Engagement Index) affects autoplay"},Safari:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Strict autoplay policy"},Edge:{smil:"Full support",audio:"Blocked (autoplay policy)",interactive:"Full support",notes:"Chromium-based, same as Chrome"},"IE 11":{smil:"No support",audio:"No support",interactive:"No support",notes:"Use CSS animations or JavaScript"}},U=[{scenario:"Standalone SVG",protocol:"file://",example:"file:///path/to/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"Standalone SVG",protocol:"http://",example:"http://localhost/sample.svg",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"SMIL works, audio blocked by autoplay policy"},{scenario:"SVG in HTML via <img>",protocol:"any",example:'<img src="sample.svg">',smilWorks:!1,audioWorks:!1,interactiveWorks:!1,notes:"All scripting and interactivity disabled"},{scenario:"SVG in HTML via <object>",protocol:"any",example:'<object data="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"SVG in HTML via <embed>",protocol:"any",example:'<embed src="sample.svg">',smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full SVG features, audio still blocked"},{scenario:"Inline SVG in HTML",protocol:"any",example:"<svg>...</svg> in HTML",smilWorks:!0,audioWorks:!1,interactiveWorks:!0,notes:"Full features, audio needs user gesture"},{scenario:"HTML extracts audio on click",protocol:"file://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"},{scenario:"HTML extracts audio on click",protocol:"http://",example:"JS extracts data-uri, plays on click",smilWorks:!0,audioWorks:!0,interactiveWorks:!0,notes:"WORKS - user gesture enables audio"}],O=[{trigger:'begin="click"',description:"Animation starts on click (on animation target)",syntax:'<animate begin="click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Target element must be clickable (not in <defs>)"},{trigger:'begin="elementId.click"',description:"Animation starts when another element is clicked",syntax:'<animate begin="button.click" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Referenced element must exist with matching id"},{trigger:'begin="mouseover"',description:"Animation starts on mouse hover",syntax:'<animate begin="mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Often paired with mouseout for hover effects"},{trigger:'begin="elementId.mouseover"',description:"Animation starts when hovering another element",syntax:'<animate begin="trigger.mouseover" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Useful for triggering animations on related elements"},{trigger:'begin="mouseout"',description:"Animation starts when mouse leaves",syntax:'<animate begin="mouseout" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Use with mouseover for complete hover cycle"},{trigger:'begin="focus"',description:"Animation starts when element receives focus",syntax:'<animate begin="focus" .../>',browserSupport:"Chrome, Firefox, Safari, Edge",notes:"Works with focusable elements (links, inputs)"},{trigger:'begin="accessKey(s)"',description:"Animation starts on keyboard shortcut",syntax:'<animate begin="accessKey(s)" .../>',browserSupport:"Limited",notes:"Press Alt+S (Windows) or Ctrl+Opt+S (Mac)"}];if(Q.tables={browserSupport:_,usageScenarios:U,smilEventScenarios:O},K&&(Q.media.hasAudio||Q.media.hasVideo||Q.smil.hasInteractiveAnimations)){if(console.log(`
|
|
20
20
|
`+"=".repeat(80)),console.log("SVG COMPATIBILITY ANALYSIS REPORT"),console.log("=".repeat(80)),console.log(`
|
|
21
|
-
--- SUMMARY ---`),console.log(`SMIL Animations: ${
|
|
21
|
+
--- SUMMARY ---`),console.log(`SMIL Animations: ${Q.smil.animationCount} (${Q.smil.hasInteractiveAnimations?"includes interactive":"time-based only"})`),console.log(`Audio Elements: ${Q.media.hasAudio?"YES":"NO"}`),console.log(`Video Elements: ${Q.media.hasVideo?"YES":"NO"}`),Q.media.hasAudio)console.log(`
|
|
22
22
|
--- AUDIO PLAYBACK WARNING ---`),console.log("This SVG contains embedded audio which will be BLOCKED by browser autoplay policies."),console.log("Audio will NOT play automatically in any browser without user interaction.");console.log(`
|
|
23
|
-
--- BROWSER SUPPORT ---`),console.log("┌─────────────┬────────────────────┬──────────────────────────┬─────────────┐"),console.log("│ Browser │ SMIL Animations │ Audio Autoplay │ Interactive │"),console.log("├─────────────┼────────────────────┼──────────────────────────┼─────────────┤");for(let[
|
|
24
|
-
--- USAGE SCENARIOS ---`),console.log("┌────────────────────────────────┬───────────┬───────┬───────┬─────────────┐"),console.log("│ Scenario │ Protocol │ SMIL │ Audio │ Interactive │"),console.log("├────────────────────────────────┼───────────┼───────┼───────┼─────────────┤");for(let
|
|
25
|
-
--- SMIL INTERACTIVE EVENT TRIGGERS ---`),console.log("┌───────────────────────────────┬────────────────────────────────────────────┐"),console.log("│ Trigger Syntax │ Description │"),console.log("├───────────────────────────────┼────────────────────────────────────────────┤");for(let
|
|
26
|
-
--- DETECTED INTERACTIVE TRIGGERS IN THIS SVG ---`);for(let
|
|
27
|
-
--- RECOMMENDATIONS ---`);for(let
|
|
23
|
+
--- BROWSER SUPPORT ---`),console.log("┌─────────────┬────────────────────┬──────────────────────────┬─────────────┐"),console.log("│ Browser │ SMIL Animations │ Audio Autoplay │ Interactive │"),console.log("├─────────────┼────────────────────┼──────────────────────────┼─────────────┤");for(let[V,M]of Object.entries(_)){let Y=V.padEnd(11),X=M.smil.padEnd(18),w=M.audio.padEnd(24),R=M.interactive.padEnd(11);console.log(`│ ${Y} │ ${X} │ ${w} │ ${R} │`)}console.log("└─────────────┴────────────────────┴──────────────────────────┴─────────────┘"),console.log(`
|
|
24
|
+
--- USAGE SCENARIOS ---`),console.log("┌────────────────────────────────┬───────────┬───────┬───────┬─────────────┐"),console.log("│ Scenario │ Protocol │ SMIL │ Audio │ Interactive │"),console.log("├────────────────────────────────┼───────────┼───────┼───────┼─────────────┤");for(let V of U){let M=V.scenario.substring(0,30).padEnd(30),Y=V.protocol.padEnd(9),X=(V.smilWorks?"✅":"❌").padEnd(5),w=(V.audioWorks?"✅":"❌").padEnd(5),R=(V.interactiveWorks?"✅":"❌").padEnd(11);console.log(`│ ${M} │ ${Y} │ ${X} │ ${w} │ ${R} │`)}if(console.log("└────────────────────────────────┴───────────┴───────┴───────┴─────────────┘"),Q.smil.hasInteractiveAnimations){console.log(`
|
|
25
|
+
--- SMIL INTERACTIVE EVENT TRIGGERS ---`),console.log("┌───────────────────────────────┬────────────────────────────────────────────┐"),console.log("│ Trigger Syntax │ Description │"),console.log("├───────────────────────────────┼────────────────────────────────────────────┤");for(let V of O){let M=V.trigger.padEnd(29),Y=V.description.substring(0,42).padEnd(42);console.log(`│ ${M} │ ${Y} │`)}if(console.log("└───────────────────────────────┴────────────────────────────────────────────┘"),Q.smil.eventTriggers.length>0){console.log(`
|
|
26
|
+
--- DETECTED INTERACTIVE TRIGGERS IN THIS SVG ---`);for(let V of Q.smil.eventTriggers){let M=V.targetId?`${V.targetId}.${V.event}`:V.event;console.log(` - <${V.animationElement}> triggered by: ${M}${V.offset?` ${V.offset}`:""}`)}}}if(Q.compatibility.recommendations.length>0){console.log(`
|
|
27
|
+
--- RECOMMENDATIONS ---`);for(let V of Q.compatibility.recommendations)console.log(` • ${V}`)}console.log(`
|
|
28
28
|
`+"=".repeat(80)+`
|
|
29
|
-
`)}return o.valid=o.errors.length===0,t.setAttribute("data-compatibility-report",JSON.stringify({hasAudio:o.media.hasAudio,hasVideo:o.media.hasVideo,smilCount:o.smil.animationCount,hasInteractive:o.smil.hasInteractiveAnimations,issues:o.compatibility.issues.length})),t._compatibilityReport=o,t}),S5={RENDER_VECTORS:{cat:"display",name:"Vector paths/shapes",critical:!0},RENDER_TEXT:{cat:"display",name:"Text rendering",critical:!0},RENDER_GRADIENTS:{cat:"display",name:"Gradients (linear/radial)",critical:!1},RENDER_PATTERNS:{cat:"display",name:"Pattern fills",critical:!1},RENDER_OPACITY:{cat:"display",name:"Opacity/transparency",critical:!1},RENDER_BLENDMODES:{cat:"display",name:"Blend modes",critical:!1},RENDER_TRANSFORMS:{cat:"display",name:"Transforms",critical:!0},FONTS_EMBEDDED:{cat:"fonts",name:"Embedded fonts (data-uri)",critical:!1},FONTS_SYSTEM:{cat:"fonts",name:"System fonts",critical:!1},FONTS_WEB_SAME:{cat:"fonts",name:"Web fonts (same-origin)",critical:!1},FONTS_WEB_CROSS:{cat:"fonts",name:"Web fonts (cross-origin)",critical:!1},IMAGES_EMBEDDED:{cat:"images",name:"Embedded images (data-uri)",critical:!1},IMAGES_LOCAL:{cat:"images",name:"Local images",critical:!1},IMAGES_REMOTE_SAME:{cat:"images",name:"Remote images (same-origin)",critical:!1},IMAGES_REMOTE_CROSS:{cat:"images",name:"Remote images (cross-origin)",critical:!1},FILTERS_BASIC:{cat:"effects",name:"Basic filters (blur, shadow)",critical:!1},FILTERS_COMPLEX:{cat:"effects",name:"Complex filters (lighting, turbulence)",critical:!1},MASKS:{cat:"effects",name:"Mask elements",critical:!1},CLIP_PATHS:{cat:"effects",name:"Clip paths",critical:!1},SMIL_TIMED:{cat:"animation",name:"SMIL time-based animation",critical:!1},SMIL_CLICK:{cat:"animation",name:"SMIL click-triggered",critical:!1},SMIL_HOVER:{cat:"animation",name:"SMIL mouseover-triggered",critical:!1},SMIL_FOCUS:{cat:"animation",name:"SMIL focus-triggered",critical:!1},SMIL_ACCESSKEY:{cat:"animation",name:"SMIL accessKey-triggered",critical:!1},SMIL_SYNCBASE:{cat:"animation",name:"SMIL syncbase (anim.begin)",critical:!1},CSS_KEYFRAMES:{cat:"animation",name:"CSS @keyframes animation",critical:!1},CSS_TRANSITIONS:{cat:"animation",name:"CSS transitions",critical:!1},CSS_HOVER:{cat:"animation",name:"CSS :hover effects",critical:!1},SCRIPT_INLINE:{cat:"scripting",name:"Inline <script>",critical:!1},SCRIPT_EXTERNAL:{cat:"scripting",name:'External <script src="">',critical:!1},SCRIPT_MODULE:{cat:"scripting",name:"ES modules in SVG",critical:!1},EVENT_ONCLICK:{cat:"events",name:"onclick handler",critical:!1},EVENT_ONDBLCLICK:{cat:"events",name:"ondblclick handler",critical:!1},EVENT_ONMOUSEDOWN:{cat:"events",name:"onmousedown handler",critical:!1},EVENT_ONMOUSEUP:{cat:"events",name:"onmouseup handler",critical:!1},EVENT_ONMOUSEOVER:{cat:"events",name:"onmouseover handler",critical:!1},EVENT_ONMOUSEOUT:{cat:"events",name:"onmouseout handler",critical:!1},EVENT_ONMOUSEMOVE:{cat:"events",name:"onmousemove handler",critical:!1},EVENT_ONFOCUS:{cat:"events",name:"onfocus handler",critical:!1},EVENT_ONBLUR:{cat:"events",name:"onblur handler",critical:!1},EVENT_ONLOAD:{cat:"events",name:"onload handler",critical:!1},EVENT_ONERROR:{cat:"events",name:"onerror handler",critical:!1},EVENT_ONSCROLL:{cat:"events",name:"onscroll handler",critical:!1},EVENT_ONWHEEL:{cat:"events",name:"onwheel handler",critical:!1},EVENT_ONTOUCH:{cat:"events",name:"touch events",critical:!1},EVENT_ONKEYBOARD:{cat:"events",name:"keyboard events",critical:!1},LINK_INTERNAL:{cat:"links",name:"Internal anchor links",critical:!1},LINK_EXTERNAL:{cat:"links",name:"External hyperlinks",critical:!1},LINK_TARGET:{cat:"links",name:"Link target attribute",critical:!1},LINK_DOWNLOAD:{cat:"links",name:"Download attribute",critical:!1},FOREIGNOBJECT_BASIC:{cat:"html",name:"foreignObject rendering",critical:!1},FOREIGNOBJECT_HTML:{cat:"html",name:"HTML in foreignObject",critical:!1},FOREIGNOBJECT_FORM:{cat:"html",name:"Forms in foreignObject",critical:!1},FOREIGNOBJECT_INPUT:{cat:"html",name:"Input elements in foreignObject",critical:!1},FOREIGNOBJECT_CANVAS:{cat:"html",name:"Canvas in foreignObject",critical:!1},FOREIGNOBJECT_VIDEO:{cat:"html",name:"Video in foreignObject",critical:!1},FOREIGNOBJECT_IFRAME:{cat:"html",name:"iframe in foreignObject",critical:!1},AUDIO_EMBEDDED:{cat:"media",name:"Embedded audio (data-uri)",critical:!1},AUDIO_LOCAL:{cat:"media",name:"Local audio files",critical:!1},AUDIO_REMOTE:{cat:"media",name:"Remote audio files",critical:!1},AUDIO_AUTOPLAY:{cat:"media",name:"Audio autoplay",critical:!1},AUDIO_CONTROLS:{cat:"media",name:"Audio controls visible",critical:!1},VIDEO_EMBEDDED:{cat:"media",name:"Embedded video (data-uri)",critical:!1},VIDEO_LOCAL:{cat:"media",name:"Local video files",critical:!1},VIDEO_REMOTE:{cat:"media",name:"Remote video files",critical:!1},VIDEO_AUTOPLAY:{cat:"media",name:"Video autoplay",critical:!1},USE_INTERNAL:{cat:"sprites",name:"Internal <use> references",critical:!1},USE_EXTERNAL_SAME:{cat:"sprites",name:"External <use> (same-origin)",critical:!1},USE_EXTERNAL_CROSS:{cat:"sprites",name:"External <use> (cross-origin)",critical:!1},USE_SHADOW_DOM:{cat:"sprites",name:"Shadow DOM styling of <use>",critical:!1},MAP_BASIC:{cat:"maps",name:"SVG as image map",critical:!1},MAP_COORDS:{cat:"maps",name:"Clickable regions",critical:!1},A11Y_ARIA:{cat:"accessibility",name:"ARIA attributes",critical:!1},A11Y_ROLE:{cat:"accessibility",name:"Role attributes",critical:!1},A11Y_TITLE:{cat:"accessibility",name:"Title/desc for screen readers",critical:!1},A11Y_TABINDEX:{cat:"accessibility",name:"Tab navigation",critical:!1},META_DATA_ATTRS:{cat:"metadata",name:"data-* attributes",critical:!1},META_CLASS:{cat:"metadata",name:"class attribute styling",critical:!1},META_ID:{cat:"metadata",name:"id references",critical:!0},EXT_CSS_LINK:{cat:"external",name:"External CSS via <?xml-stylesheet?>",critical:!1},EXT_CSS_IMPORT:{cat:"external",name:"@import in <style>",critical:!1},EXT_XLINK:{cat:"external",name:"xlink:href references",critical:!1}},pn={STANDALONE_BROWSER:{id:"standalone-browser",name:"Standalone (Browser)",type:"browser"},HTML_PAGE:{id:"html-page",name:"HTML Page",type:"browser"},ELECTRON:{id:"electron",name:"Electron App",type:"browser"},WEBVIEW_IOS:{id:"webview-ios",name:"iOS WKWebView",type:"mobile"},WEBVIEW_ANDROID:{id:"webview-android",name:"Android WebView",type:"mobile"},CAIRO:{id:"cairo",name:"Cairo/librsvg",type:"renderer"},INKSCAPE:{id:"inkscape",name:"Inkscape",type:"renderer"},IMAGEMAGICK:{id:"imagemagick",name:"ImageMagick",type:"renderer"},BATIK:{id:"batik",name:"Apache Batik",type:"renderer"},RESVG:{id:"resvg",name:"resvg",type:"renderer"},QT_SVG:{id:"qt-svg",name:"Qt SVG",type:"renderer"},SKIA:{id:"skia",name:"Skia (Chrome/Flutter)",type:"renderer"}},dn={FILE:{id:"file",name:"file://",protocol:"file"},HTTP:{id:"http",name:"http://",protocol:"http"},HTTPS:{id:"https",name:"https://",protocol:"https"},DATA_URI:{id:"data-uri",name:"data: URI",protocol:"data"},BLOB_URL:{id:"blob-url",name:"blob: URL",protocol:"blob"}},gn={INLINE:{id:"inline",name:"Inline in HTML",location:"inline"},BASE64:{id:"base64",name:"Base64 encoded",location:"embedded"},LOCAL_SAME:{id:"local-same",name:"Local (same dir)",location:"local"},LOCAL_ABS:{id:"local-abs",name:"Local (absolute)",location:"local"},REMOTE_SAME:{id:"remote-same",name:"Remote (same-origin)",location:"remote"},REMOTE_CROSS:{id:"remote-cross",name:"Remote (cross-origin)",location:"cross"},REMOTE_CORS:{id:"remote-cors",name:"Remote (cross+CORS)",location:"cors"}},D9={DIRECT:{id:"direct",name:"Direct SVG file",html:!1},IMG:{id:"img",name:'<img src="">',html:!0},PICTURE:{id:"picture",name:"<picture><source>",html:!0},OBJECT:{id:"object",name:'<object data="">',html:!0},EMBED:{id:"embed",name:'<embed src="">',html:!0},IFRAME:{id:"iframe",name:'<iframe src="">',html:!0},INLINE_SVG:{id:"inline-svg",name:"<svg>...</svg>",html:!0},CSS_BG:{id:"css-bg",name:"CSS background-image",html:!0},CSS_MASK:{id:"css-mask",name:"CSS mask-image",html:!0},CSS_CONTENT:{id:"css-content",name:"CSS content: url()",html:!0},CSS_LIST:{id:"css-list",name:"CSS list-style-image",html:!0},CSS_BORDER:{id:"css-border",name:"CSS border-image",html:!0},CANVAS_DRAW:{id:"canvas-draw",name:"canvas.drawImage()",html:!0},SCRIPT_INNER:{id:"script-inner",name:"innerHTML assignment",html:!0},SCRIPT_DOM:{id:"script-dom",name:"DOM createElement",html:!0},SCRIPT_FETCH:{id:"script-fetch",name:"fetch + parse",html:!0}},cn={NA:{id:"n/a",name:"N/A (not script)",script:!1},INLINE_SCRIPT:{id:"inline-script",name:"Inline <script>",script:!0},SAME_ORIGIN:{id:"same-origin",name:"Same-origin script",script:!0},CROSS_CORS:{id:"cross-cors",name:"Cross-origin (CORS)",script:!0},CROSS_NO_CORS:{id:"cross-no-cors",name:"Cross-origin (no CORS)",script:!0}},h9={CHROME:{id:"chrome",name:"Chrome",engine:"blink"},FIREFOX:{id:"firefox",name:"Firefox",engine:"gecko"},SAFARI:{id:"safari",name:"Safari",engine:"webkit"},EDGE:{id:"edge",name:"Edge",engine:"blink"},IE11:{id:"ie11",name:"IE 11",engine:"trident"},SAFARI_IOS:{id:"safari-ios",name:"Safari iOS",engine:"webkit"},CHROME_ANDROID:{id:"chrome-android",name:"Chrome Android",engine:"blink"},SAMSUNG:{id:"samsung",name:"Samsung Internet",engine:"blink"}},b={WORKS:"✅",PARTIAL:"⚠️",BLOCKED:"❌",DEPENDS:"❓",NA:"➖"},I2={RENDER_VECTORS:{default:b.WORKS,exceptions:{}},RENDER_TEXT:{default:b.WORKS,exceptions:{"renderer:imagemagick":{status:b.PARTIAL,note:"Font substitution may occur"},"renderer:batik":{status:b.PARTIAL,note:"Limited font support"}}},RENDER_GRADIENTS:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.PARTIAL,note:"Some gradient types unsupported"}}},RENDER_PATTERNS:{default:b.WORKS,exceptions:{"renderer:resvg":{status:b.PARTIAL,note:"Limited pattern support"}}},RENDER_OPACITY:{default:b.WORKS,exceptions:{}},RENDER_BLENDMODES:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No blend mode support"},"renderer:cairo":{status:b.PARTIAL,note:"Limited blend modes"}}},FONTS_EMBEDDED:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No embedded fonts in img context",browsers:"all"},"syntax:css-bg":{status:b.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"syntax:css-mask":{status:b.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"renderer:imagemagick":{status:b.BLOCKED,note:"Cannot process embedded fonts"}}},FONTS_SYSTEM:{default:b.WORKS,exceptions:{}},FONTS_WEB_SAME:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources in img"},"syntax:css-bg":{status:b.BLOCKED,note:"No external resources in CSS bg"},"load:file":{status:b.PARTIAL,note:"May fail due to local file restrictions"},"renderer:*":{status:b.BLOCKED,note:"Renderers cannot fetch web fonts"}}},FONTS_WEB_CROSS:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources"},"syntax:css-*":{status:b.BLOCKED,note:"No external resources in CSS"},"storage:remote-cors":{status:b.WORKS,note:"Works with CORS headers"},"renderer:*":{status:b.BLOCKED,note:"Renderers cannot fetch fonts"}}},IMAGES_EMBEDDED:{default:b.WORKS,exceptions:{}},IMAGES_LOCAL:{default:b.WORKS,exceptions:{"load:http":{status:b.BLOCKED,note:"Cannot load file:// from http://"},"load:https":{status:b.BLOCKED,note:"Cannot load file:// from https://"},"syntax:img":{status:b.BLOCKED,note:"No external resources in img"}}},IMAGES_REMOTE_SAME:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources in img"},"load:file":{status:b.BLOCKED,note:"Cannot fetch http from file://"}}},IMAGES_REMOTE_CROSS:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources in img"},"storage:remote-cors":{status:b.WORKS,note:"Works with CORS"},"load:file":{status:b.BLOCKED,note:"CORS not applicable"}}},FILTERS_BASIC:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.PARTIAL,note:"Limited filter support"}}},FILTERS_COMPLEX:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"Complex filters unsupported"},"renderer:resvg":{status:b.PARTIAL,note:"Some filters unsupported"},"renderer:qt-svg":{status:b.PARTIAL,note:"Limited filter primitives"}}},MASKS:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"SVG masks not supported"}}},CLIP_PATHS:{default:b.WORKS,exceptions:{}},SMIL_TIMED:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"syntax:img":{status:b.PARTIAL,note:"May animate, no interaction",browsers:["chrome","firefox"]},"syntax:css-bg":{status:b.PARTIAL,note:"May animate, varies by browser"},"renderer:*":{status:b.BLOCKED,note:"Static render, no animation"}}},SMIL_CLICK:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"syntax:img":{status:b.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:b.BLOCKED,note:"No interaction in CSS context"},"syntax:canvas-draw":{status:b.BLOCKED,note:"Rasterized, no interaction"},"renderer:*":{status:b.BLOCKED,note:"No interaction in renderers"}}},SMIL_HOVER:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"syntax:img":{status:b.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:b.BLOCKED,note:"No interaction in CSS context"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},SMIL_FOCUS:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"syntax:img":{status:b.BLOCKED,note:"No interaction"},"syntax:css-*":{status:b.BLOCKED,note:"No interaction"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},SMIL_ACCESSKEY:{default:b.PARTIAL,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"browser:chrome":{status:b.PARTIAL,note:"Limited accessKey support"},"syntax:img":{status:b.BLOCKED,note:"No keyboard in img context"},"syntax:css-*":{status:b.BLOCKED,note:"No keyboard in CSS context"},"renderer:*":{status:b.BLOCKED,note:"No keyboard"}}},SMIL_SYNCBASE:{default:b.WORKS,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No SMIL support"},"syntax:img":{status:b.PARTIAL,note:"Sync works if animation plays"},"renderer:*":{status:b.BLOCKED,note:"No animation"}}},CSS_KEYFRAMES:{default:b.WORKS,exceptions:{"syntax:img":{status:b.WORKS,note:"CSS animations work in img"},"syntax:css-bg":{status:b.WORKS,note:"CSS animations work"},"renderer:*":{status:b.BLOCKED,note:"Static render"}}},CSS_TRANSITIONS:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No interaction for transitions"},"syntax:css-bg":{status:b.BLOCKED,note:"No interaction"},"renderer:*":{status:b.BLOCKED,note:"Static render"}}},CSS_HOVER:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No :hover in img context"},"syntax:css-*":{status:b.BLOCKED,note:"No :hover in CSS context"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},SCRIPT_INLINE:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"Scripts disabled for security"},"syntax:css-*":{status:b.BLOCKED,note:"Scripts disabled in CSS context"},"syntax:canvas-draw":{status:b.BLOCKED,note:"Rasterized, no scripts"},"renderer:*":{status:b.BLOCKED,note:"No script execution"},"display:html-page+syntax:inline-svg":{status:b.WORKS,note:"Runs in page context"},"display:html-page+syntax:object":{status:b.WORKS,note:"Isolated context"},"display:html-page+syntax:embed":{status:b.WORKS,note:"Isolated context"}}},SCRIPT_EXTERNAL:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources"},"syntax:css-*":{status:b.BLOCKED,note:"No external resources"},"load:file":{status:b.PARTIAL,note:"May be blocked by local file restrictions"},"storage:remote-cross":{status:b.BLOCKED,note:"CORS required"},"storage:remote-cors":{status:b.WORKS,note:"Works with CORS"},"renderer:*":{status:b.BLOCKED,note:"No scripts"}}},SCRIPT_MODULE:{default:b.PARTIAL,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No ES modules"},"browser:safari":{status:b.PARTIAL,note:"Limited module support in SVG"},"syntax:img":{status:b.BLOCKED,note:"No scripts"},"syntax:css-*":{status:b.BLOCKED,note:"No scripts"},"renderer:*":{status:b.BLOCKED,note:"No scripts"}}},EVENT_ONCLICK:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events in img context"},"syntax:css-*":{status:b.BLOCKED,note:"No events in CSS context"},"syntax:canvas-draw":{status:b.BLOCKED,note:"Rasterized"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONDBLCLICK:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONMOUSEDOWN:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONMOUSEUP:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOVER:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOUT:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONMOUSEMOVE:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONFOCUS:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:b.BLOCKED,note:"No focus"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONBLUR:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONLOAD:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No scripts/events"},"syntax:css-*":{status:b.BLOCKED,note:"No scripts"},"renderer:*":{status:b.BLOCKED,note:"No scripts"}}},EVENT_ONERROR:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No scripts"},"syntax:css-*":{status:b.BLOCKED,note:"No scripts"},"renderer:*":{status:b.BLOCKED,note:"No scripts"}}},EVENT_ONSCROLL:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No scroll in img"},"syntax:css-*":{status:b.BLOCKED,note:"No scroll"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONWHEEL:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONTOUCH:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No touch events"},"syntax:css-*":{status:b.BLOCKED,note:"No touch"},"display:*-browser":{status:b.NA,note:"No touch on desktop"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},EVENT_ONKEYBOARD:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No keyboard"},"syntax:css-*":{status:b.BLOCKED,note:"No keyboard"},"renderer:*":{status:b.BLOCKED,note:"No events"}}},LINK_INTERNAL:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No links in img"},"syntax:css-*":{status:b.BLOCKED,note:"No links in CSS"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},LINK_EXTERNAL:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No links in img"},"syntax:css-*":{status:b.BLOCKED,note:"No links"},"syntax:object":{status:b.WORKS,note:"Opens in object frame"},"renderer:*":{status:b.BLOCKED,note:"No links"}}},LINK_TARGET:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No links"},"syntax:css-*":{status:b.BLOCKED,note:"No links"},"syntax:object":{status:b.PARTIAL,note:"May not break out of frame"},"renderer:*":{status:b.BLOCKED,note:"No links"}}},LINK_DOWNLOAD:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No links"},"browser:safari":{status:b.PARTIAL,note:"Limited download attr support"},"renderer:*":{status:b.BLOCKED,note:"No links"}}},FOREIGNOBJECT_BASIC:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"foreignObject disabled in img"},"syntax:css-*":{status:b.BLOCKED,note:"foreignObject disabled in CSS"},"syntax:canvas-draw":{status:b.BLOCKED,note:"Security: tainted canvas"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject support"},"renderer:cairo":{status:b.BLOCKED,note:"No foreignObject"},"renderer:resvg":{status:b.BLOCKED,note:"No foreignObject"},"renderer:imagemagick":{status:b.BLOCKED,note:"No foreignObject"}}},FOREIGNOBJECT_HTML:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No HTML rendering"}}},FOREIGNOBJECT_FORM:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"syntax:object":{status:b.PARTIAL,note:"Form submission may be restricted"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No forms"}}},FOREIGNOBJECT_INPUT:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No inputs"}}},FOREIGNOBJECT_CANVAS:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No canvas"}}},FOREIGNOBJECT_VIDEO:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No video"}}},FOREIGNOBJECT_IFRAME:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject"},"syntax:object":{status:b.PARTIAL,note:"Nested contexts may fail"},"browser:ie11":{status:b.BLOCKED,note:"No foreignObject"},"renderer:*":{status:b.BLOCKED,note:"No iframes"}}},AUDIO_EMBEDDED:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg+processing:*-script":{status:b.WORKS,note:"Play on user gesture via JS"},"syntax:script-*":{status:b.WORKS,note:"JS can play on user gesture"}},note:"All browsers block autoplay without user gesture"},AUDIO_LOCAL:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:b.PARTIAL,note:"Needs user gesture"},"load:file":{status:b.PARTIAL,note:"May work locally with gesture"}}},AUDIO_REMOTE:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:b.PARTIAL,note:"Needs user gesture + CORS"},"storage:remote-cors":{status:b.PARTIAL,note:"Needs user gesture"}}},AUDIO_AUTOPLAY:{default:b.BLOCKED,exceptions:{},note:"Autoplay blocked by ALL modern browsers"},AUDIO_CONTROLS:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No foreignObject/audio"},"syntax:css-*":{status:b.BLOCKED,note:"No foreignObject/audio"},"syntax:object":{status:b.PARTIAL,note:"May render controls"}}},VIDEO_EMBEDDED:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:b.PARTIAL,note:"Needs user gesture"},"syntax:script-*":{status:b.WORKS,note:"JS can play on gesture"}}},VIDEO_LOCAL:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:b.PARTIAL,note:"Needs user gesture"}}},VIDEO_REMOTE:{default:b.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:b.PARTIAL,note:"Needs gesture + CORS"}}},VIDEO_AUTOPLAY:{default:b.BLOCKED,exceptions:{"browser:*":{status:b.PARTIAL,note:"May work muted"}},note:"Autoplay only works muted in most browsers"},USE_INTERNAL:{default:b.WORKS,exceptions:{"syntax:img":{status:b.WORKS,note:"Internal refs work"},"syntax:css-*":{status:b.WORKS,note:"Internal refs work"}}},USE_EXTERNAL_SAME:{default:b.PARTIAL,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external refs"},"syntax:css-*":{status:b.BLOCKED,note:"No external refs"},"browser:chrome":{status:b.BLOCKED,note:"External use blocked since Chrome 50"},"browser:firefox":{status:b.BLOCKED,note:"Blocked for security"},"browser:safari":{status:b.PARTIAL,note:"May work same-origin"}},note:"Most browsers block external <use> for security"},USE_EXTERNAL_CROSS:{default:b.BLOCKED,exceptions:{},note:"Cross-origin external <use> blocked by all browsers"},USE_SHADOW_DOM:{default:b.PARTIAL,exceptions:{"browser:ie11":{status:b.BLOCKED,note:"No shadow DOM"},"syntax:img":{status:b.BLOCKED,note:"No styling access"}},note:"Styling shadow DOM from <use> is limited"},MAP_BASIC:{default:b.NA,exceptions:{"syntax:inline-svg":{status:b.WORKS,note:"Can use SVG elements as map"}},note:"Traditional image maps not applicable, use SVG events"},MAP_COORDS:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No events for clickable regions"},"syntax:css-*":{status:b.BLOCKED,note:"No events"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},A11Y_ARIA:{default:b.WORKS,exceptions:{"syntax:img":{status:b.PARTIAL,note:"Only alt text accessible"},"syntax:css-*":{status:b.BLOCKED,note:"No a11y in CSS images"},"renderer:*":{status:b.BLOCKED,note:"No a11y tree"}}},A11Y_ROLE:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"Use alt attribute instead"},"syntax:css-*":{status:b.BLOCKED,note:"No a11y"},"renderer:*":{status:b.BLOCKED,note:"No a11y"}}},A11Y_TITLE:{default:b.WORKS,exceptions:{"syntax:img":{status:b.PARTIAL,note:"May not be read by screen readers"},"syntax:css-*":{status:b.BLOCKED,note:"Not accessible"}}},A11Y_TABINDEX:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:b.BLOCKED,note:"No focus"},"renderer:*":{status:b.BLOCKED,note:"No interaction"}}},META_DATA_ATTRS:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"Not accessible from outside"},"syntax:css-*":{status:b.BLOCKED,note:"Not accessible"}}},META_CLASS:{default:b.WORKS,exceptions:{}},META_ID:{default:b.WORKS,exceptions:{"syntax:img":{status:b.PARTIAL,note:"IDs isolated"}}},EXT_CSS_LINK:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external resources"},"syntax:css-*":{status:b.BLOCKED,note:"No external resources"},"load:file":{status:b.PARTIAL,note:"Local file restrictions"},"renderer:*":{status:b.BLOCKED,note:"No external fetch"}}},EXT_CSS_IMPORT:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No @import"},"syntax:css-*":{status:b.BLOCKED,note:"No @import"},"load:file":{status:b.PARTIAL,note:"May be blocked"},"renderer:*":{status:b.BLOCKED,note:"No external fetch"}}},EXT_XLINK:{default:b.WORKS,exceptions:{"syntax:img":{status:b.BLOCKED,note:"No external xlink"},"syntax:css-*":{status:b.BLOCKED,note:"No external xlink"},"storage:remote-cross":{status:b.BLOCKED,note:"CORS required"}}}},D3={JAVASCRIPT:"javascript",EVENT_HANDLERS:"event_handlers",SMIL_ANIMATIONS:"smil_animations",SMIL_INTERACTIVE:"smil_interactive",CSS_ANIMATIONS:"css_animations",AUDIO:"audio",VIDEO:"video",EXTERNAL_IMAGES:"external_images",EXTERNAL_CSS:"external_css",EXTERNAL_FONTS:"external_fonts",EXTERNAL_SCRIPTS:"external_scripts",EXTERNAL_USE:"external_use",FOREIGN_OBJECT:"foreign_object",IFRAME:"iframe",FILTERS:"filters",MASKS:"masks",CLIP_PATHS:"clip_paths",HYPERLINKS:"hyperlinks",ANCHORS:"anchors"},mn=d3((t,a={})=>{let r=a.verbose||!1,e=a.printTables!==!1,o=a.includeMetaAnalysis!==!1,n=(w)=>{let F=[],a3=w.toLowerCase(),e3=(i3)=>{if(i3.tagName&&i3.tagName.toLowerCase()===a3)F.push(i3);for(let y3 of i3.children||[])if(y3&&y3.tagName)e3(y3)};return e3(t),F},i=(w,F=[])=>{if(w.tagName)F.push(w);for(let a3 of w.children||[])if(a3&&a3.tagName)i(a3,F);return F},l=(w,...F)=>{for(let a3 of F)if(w.getAttribute(a3))return!0;return!1},d={detected:new Set,details:{}},p=i(t),g=n("script");if(g.length>0){if(d.detected.add(D3.JAVASCRIPT),d.details.javascript={count:g.length,hasExternalSrc:g.some((w)=>w.getAttribute("src")||w.getAttribute("href")||w.getAttribute("xlink:href")),types:g.map((w)=>w.getAttribute("type")||"text/javascript")},d.details.javascript.hasExternalSrc)d.detected.add(D3.EXTERNAL_SCRIPTS)}let c=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onload","onerror","onscroll","onwheel","ontouchstart","ontouchend","ontouchmove","onbegin","onend","onrepeat"],m=[];for(let w of p){let F=c.filter((a3)=>w.getAttribute(a3));if(F.length>0)m.push({tag:w.tagName,handlers:F})}if(m.length>0)d.detected.add(D3.EVENT_HANDLERS),d.details.eventHandlers={count:m.length,types:[...new Set(m.flatMap((w)=>w.handlers))],elements:m.slice(0,10)};let y=["animate","animatetransform","animatemotion","animatecolor","set"],h=[],s=[];for(let w of y){let F=n(w);h.push(...F);for(let a3 of F){let e3=a3.getAttribute("begin")||"",i3=a3.getAttribute("end")||"",y3=["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout"];for(let u3 of y3)if(e3.includes(u3)||i3.includes(u3))s.push({element:a3.tagName,event:u3,begin:e3,end:i3});if(e3.includes("accessKey(")||i3.includes("accessKey("))s.push({element:a3.tagName,event:"accessKey",begin:e3,end:i3})}}if(h.length>0){if(d.detected.add(D3.SMIL_ANIMATIONS),d.details.smilAnimations={count:h.length,breakdown:{animate:n("animate").length,animateTransform:n("animatetransform").length,animateMotion:n("animatemotion").length,animateColor:n("animatecolor").length,set:n("set").length}},s.length>0)d.detected.add(D3.SMIL_INTERACTIVE),d.details.smilInteractive={count:s.length,triggers:[...new Set(s.map((w)=>w.event))],elements:s.slice(0,10)}}let x=n("style"),D=!1;for(let w of x){let F=w.textContent||"";if(F.includes("@keyframes")||F.includes("animation:")||F.includes("animation-name")||F.includes("transition:")||F.includes("transition-property")){D=!0;break}}for(let w of p){let F=w.getAttribute("style")||"";if(F.includes("animation")||F.includes("transition")){D=!0;break}}if(D)d.detected.add(D3.CSS_ANIMATIONS),d.details.cssAnimations={detected:!0};let S=n("audio"),P=n("video"),T=n("foreignobject");for(let w of T){let F=[],a3=[],e3=(i3)=>{let y3=i3.tagName?.toLowerCase();if(y3==="audio")F.push(i3);if(y3==="video")a3.push(i3);for(let u3 of i3.children||[])if(u3&&u3.tagName)e3(u3)};for(let i3 of w.children||[])if(i3&&i3.tagName)e3(i3);S.push(...F),P.push(...a3)}if(S.length>0)d.detected.add(D3.AUDIO),d.details.audio={count:S.length,hasAutoplay:S.some((w)=>w.hasAttribute("autoplay")),sources:S.map((w)=>({id:w.getAttribute("id"),src:w.getAttribute("src"),isDataUri:(w.getAttribute("src")||"").startsWith("data:"),isExternal:(w.getAttribute("src")||"").startsWith("http")}))};if(P.length>0)d.detected.add(D3.VIDEO),d.details.video={count:P.length,hasAutoplay:P.some((w)=>w.hasAttribute("autoplay"))};let f=n("image"),X=[],B=[];for(let w of f){let F=w.getAttribute("href")||w.getAttribute("xlink:href")||"";if(F.startsWith("http://")||F.startsWith("https://")||F.startsWith("//"))X.push({href:F,element:"image"});else if(F.startsWith("data:"))B.push({type:"data-uri",element:"image"});else if(F&&!F.startsWith("#"))X.push({href:F,element:"image",type:"local"})}if(X.length>0)d.detected.add(D3.EXTERNAL_IMAGES),d.details.externalImages={count:X.length,urls:X.slice(0,5)};let L=n("use"),R=[];for(let w of L){let F=w.getAttribute("href")||w.getAttribute("xlink:href")||"";if(F&&!F.startsWith("#"))R.push({href:F})}if(R.length>0)d.detected.add(D3.EXTERNAL_USE),d.details.externalUse={count:R.length,refs:R.slice(0,5)};let N=!1;for(let w of x){let F=w.textContent||"";if(F.includes("@font-face")&&F.includes("url(")){let a3=F.match(/url\(['"]?(https?:\/\/[^'")\s]+)['"]?\)/);if(a3){N=!0,d.detected.add(D3.EXTERNAL_FONTS),d.details.externalFonts={detected:!0,sample:a3[1]};break}}}if(T.length>0){if(d.detected.add(D3.FOREIGN_OBJECT),d.details.foreignObject={count:T.length,hasIframe:T.some((w)=>{let F=!1,a3=(e3)=>{if(e3.tagName?.toLowerCase()==="iframe")F=!0;for(let i3 of e3.children||[])if(i3&&i3.tagName)a3(i3)};return a3(w),F})},d.details.foreignObject.hasIframe)d.detected.add(D3.IFRAME)}let u=n("filter"),O=n("mask"),Y=n("clippath");if(u.length>0)d.detected.add(D3.FILTERS),d.details.filters={count:u.length};if(O.length>0)d.detected.add(D3.MASKS),d.details.masks={count:O.length};if(Y.length>0)d.detected.add(D3.CLIP_PATHS),d.details.clipPaths={count:Y.length};let j=n("a");if(j.length>0)d.detected.add(D3.HYPERLINKS),d.details.hyperlinks={count:j.length,hasExternal:j.some((w)=>{return(w.getAttribute("href")||w.getAttribute("xlink:href")||"").startsWith("http")})};let _={STANDALONE:"standalone",HTML:"html",CUSTOM_RENDERER:"custom"},A={FILE:"file://",HTTP:"http://"},W={INLINE_BASE64:"inline",LOCAL_PATH:"local",REMOTE_URL:"remote"},C={NONE:"none",IMG:"img",OBJECT:"object",EMBED:"embed",INLINE:"inline",CSS:"css",SCRIPT:"script"},z={INLINE_CODE:"inline",LOCAL_SERVER:"local",REMOTE_CDN:"remote"},o3={[D3.JAVASCRIPT]:{[C.NONE]:{file:"✅",http:"✅",note:"Full JS execution"},[C.IMG]:{file:"❌",http:"❌",note:"All scripting disabled for security"},[C.OBJECT]:{file:"✅",http:"✅",note:"Isolated JS context"},[C.EMBED]:{file:"✅",http:"✅",note:"Isolated JS context"},[C.INLINE]:{file:"✅",http:"✅",note:"Same JS context as parent page"},[C.CSS]:{file:"❌",http:"❌",note:"CSS image context - no scripts"},[C.SCRIPT]:{file:"✅",http:"✅",note:"JS-generated = full control"}},[D3.EVENT_HANDLERS]:{[C.NONE]:{file:"✅",http:"✅",note:"Full event handling"},[C.IMG]:{file:"❌",http:"❌",note:"No events in img context"},[C.OBJECT]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[C.EMBED]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[C.INLINE]:{file:"✅",http:"✅",note:"Full event handling"},[C.CSS]:{file:"❌",http:"❌",note:"No events in CSS context"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Full event handling"}},[D3.SMIL_ANIMATIONS]:{[C.NONE]:{file:"✅",http:"✅",note:"Full SMIL support"},[C.IMG]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[C.OBJECT]:{file:"✅",http:"✅",note:"Full SMIL support"},[C.EMBED]:{file:"✅",http:"✅",note:"Full SMIL support"},[C.INLINE]:{file:"✅",http:"✅",note:"Full SMIL support"},[C.CSS]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Full SMIL support"}},[D3.SMIL_INTERACTIVE]:{[C.NONE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[C.IMG]:{file:"❌",http:"❌",note:"No interaction in img context"},[C.OBJECT]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[C.EMBED]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[C.INLINE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[C.CSS]:{file:"❌",http:"❌",note:"No interaction in CSS context"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Full interactive SMIL"}},[D3.CSS_ANIMATIONS]:{[C.NONE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[C.IMG]:{file:"✅",http:"✅",note:"CSS animations work in img"},[C.OBJECT]:{file:"✅",http:"✅",note:"Full CSS animation support"},[C.EMBED]:{file:"✅",http:"✅",note:"Full CSS animation support"},[C.INLINE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[C.CSS]:{file:"✅",http:"✅",note:"CSS animations work"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Full CSS animation support"}},[D3.AUDIO]:{[C.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[C.IMG]:{file:"❌",http:"❌",note:"No audio in img context"},[C.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[C.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[C.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[C.CSS]:{file:"❌",http:"❌",note:"No audio in CSS context"},[C.SCRIPT]:{file:"✅",http:"✅",note:"JS can play audio on user gesture"}},[D3.VIDEO]:{[C.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[C.IMG]:{file:"❌",http:"❌",note:"No video in img context"},[C.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[C.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[C.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[C.CSS]:{file:"❌",http:"❌",note:"No video in CSS context"},[C.SCRIPT]:{file:"✅",http:"✅",note:"JS can play video on user gesture"}},[D3.EXTERNAL_IMAGES]:{[C.NONE]:{file:"⚠️",http:"✅",note:"file:// may have CORS issues"},[C.IMG]:{file:"❌",http:"⚠️",note:"Blocked or CORS restricted"},[C.OBJECT]:{file:"⚠️",http:"✅",note:"CORS applies"},[C.EMBED]:{file:"⚠️",http:"✅",note:"CORS applies"},[C.INLINE]:{file:"⚠️",http:"✅",note:"CORS applies"},[C.CSS]:{file:"❌",http:"⚠️",note:"Restricted for security"},[C.SCRIPT]:{file:"⚠️",http:"✅",note:"CORS applies"}},[D3.EXTERNAL_CSS]:{[C.NONE]:{file:"✅",http:"✅",note:"External CSS loaded"},[C.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[C.OBJECT]:{file:"✅",http:"✅",note:"External CSS works"},[C.EMBED]:{file:"✅",http:"✅",note:"External CSS works"},[C.INLINE]:{file:"✅",http:"✅",note:"External CSS works"},[C.CSS]:{file:"❌",http:"❌",note:"No external resources"},[C.SCRIPT]:{file:"✅",http:"✅",note:"External CSS works"}},[D3.EXTERNAL_FONTS]:{[C.NONE]:{file:"✅",http:"✅",note:"External fonts loaded"},[C.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[C.OBJECT]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[C.EMBED]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[C.INLINE]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[C.CSS]:{file:"❌",http:"⚠️",note:"Limited, varies by browser"},[C.SCRIPT]:{file:"✅",http:"✅",note:"External fonts work"}},[D3.EXTERNAL_USE]:{[C.NONE]:{file:"❌",http:"⚠️",note:"Most browsers block external use"},[C.IMG]:{file:"❌",http:"❌",note:"No external use in img"},[C.OBJECT]:{file:"❌",http:"⚠️",note:"Most browsers block"},[C.EMBED]:{file:"❌",http:"⚠️",note:"Most browsers block"},[C.INLINE]:{file:"❌",http:"⚠️",note:"Most browsers block"},[C.CSS]:{file:"❌",http:"❌",note:"No external use"},[C.SCRIPT]:{file:"❌",http:"⚠️",note:"Most browsers block"}},[D3.FOREIGN_OBJECT]:{[C.NONE]:{file:"✅",http:"✅",note:"Full foreignObject support"},[C.IMG]:{file:"❌",http:"❌",note:"foreignObject disabled in img"},[C.OBJECT]:{file:"✅",http:"✅",note:"foreignObject works"},[C.EMBED]:{file:"✅",http:"✅",note:"foreignObject works"},[C.INLINE]:{file:"✅",http:"✅",note:"foreignObject works"},[C.CSS]:{file:"❌",http:"❌",note:"foreignObject disabled"},[C.SCRIPT]:{file:"✅",http:"✅",note:"foreignObject works"}},[D3.HYPERLINKS]:{[C.NONE]:{file:"✅",http:"✅",note:"Links work"},[C.IMG]:{file:"❌",http:"❌",note:"No links in img context"},[C.OBJECT]:{file:"✅",http:"✅",note:"Links work (in iframe-like context)"},[C.EMBED]:{file:"✅",http:"✅",note:"Links work"},[C.INLINE]:{file:"✅",http:"✅",note:"Links work normally"},[C.CSS]:{file:"❌",http:"❌",note:"No links in CSS context"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Links work"}},[D3.FILTERS]:{[C.NONE]:{file:"✅",http:"✅",note:"Full filter support"},[C.IMG]:{file:"✅",http:"✅",note:"Filters work"},[C.OBJECT]:{file:"✅",http:"✅",note:"Filters work"},[C.EMBED]:{file:"✅",http:"✅",note:"Filters work"},[C.INLINE]:{file:"✅",http:"✅",note:"Filters work"},[C.CSS]:{file:"✅",http:"✅",note:"Filters work"},[C.SCRIPT]:{file:"✅",http:"✅",note:"Filters work"}}},K={"GitHub README.md":{syntax:"IMG (implicit)",restrictions:["No JavaScript","No SMIL","No external resources","No foreignObject","No links"],worksFor:["Static SVG","CSS animations (some)","Embedded images (data-uri)"],note:"GitHub sanitizes SVG heavily - only safe static content"},"GitHub Flavored Markdown (GFM)":{syntax:"IMG",restrictions:["Same as GitHub README"],worksFor:["Static SVG only"],note:"GFM renders SVG as images"},"GitLab README.md":{syntax:"IMG (implicit)",restrictions:["Similar to GitHub but slightly more permissive"],worksFor:["Static SVG","Some CSS animations"],note:"GitLab also sanitizes SVG"},"Wikipedia/MediaWiki":{syntax:"IMG (sanitized)",restrictions:["Heavy sanitization","No scripts","No external resources","No animations"],worksFor:["Static vector graphics only"],note:"MediaWiki converts SVG to PNG for display"},"EPUB 3.x":{syntax:"IMG or INLINE",restrictions:["No external resources","Limited JavaScript","No autoplay"],worksFor:["Static SVG","CSS animations","SMIL (in some readers)"],note:"Support varies by e-reader - Apple Books better than Kindle"},"Email (HTML email)":{syntax:"IMG (base64)",restrictions:["Heavily filtered","No scripts","No external resources","No animations"],worksFor:["Static embedded SVG only","Many clients block SVG entirely"],note:"Most email clients block or rasterize SVG"},"Slack/Discord":{syntax:"IMG (auto-converted)",restrictions:["Converted to raster","No interactivity"],worksFor:["Static preview only"],note:"SVG files are typically converted to PNG previews"},"Twitter/X":{syntax:"N/A",restrictions:["SVG not supported as media"],worksFor:["Nothing - upload as PNG"],note:"Twitter does not support SVG uploads"},Notion:{syntax:"EMBED/IMG",restrictions:["Limited - treated as image"],worksFor:["Static SVG"],note:"Notion embeds SVG as images"},Obsidian:{syntax:"INLINE or IMG",restrictions:["Depends on mode and plugins"],worksFor:["Static SVG","Some CSS animations"],note:"Obsidian has good local SVG support"},"Bear Notes":{syntax:"IMG",restrictions:["Image context only"],worksFor:["Static SVG"],note:"Bear treats SVG as images"},"Markdown-it":{syntax:"IMG (default)",restrictions:["Default IMG behavior","Can be configured for INLINE"],worksFor:["Depends on configuration"],note:"Parser library - output depends on implementation"},MDX:{syntax:"INLINE (JSX)",restrictions:["Full React component - depends on framework"],worksFor:["Full SVG when used as component"],note:"MDX can import SVG as React components"},"iOS Safari":{syntax:"ALL",restrictions:["Stricter autoplay policies"],worksFor:["All standard SVG features except auto-audio"],note:"Good SVG support, strict media policies"},"Android WebView":{syntax:"ALL",restrictions:["Varies by Android version"],worksFor:["Most SVG features"],note:"WebView behavior varies significantly"},"Cairo/librsvg":{syntax:"CUSTOM_RENDERER",restrictions:["Limited JS","Limited SMIL","No foreignObject"],worksFor:["Static SVG","Basic filters","CSS styling"],note:"Server-side rendering library - no dynamic features"},Inkscape:{syntax:"CUSTOM_RENDERER",restrictions:["May not run JS","SMIL playback varies"],worksFor:["All static SVG","Partial animation preview"],note:"Full SVG editor with preview capabilities"},ImageMagick:{syntax:"CUSTOM_RENDERER",restrictions:["Rasterizes immediately","No animations","No JS"],worksFor:["Static rasterization only"],note:"Converts SVG to raster - no dynamic features"}},$={timestamp:new Date().toISOString(),features:d,interactivityLevel:"static",bySyntax:{},specialCases:{},recommendations:[],warnings:[]};if(d.detected.has(D3.JAVASCRIPT)||d.detected.has(D3.EVENT_HANDLERS))$.interactivityLevel="scripted";else if(d.detected.has(D3.SMIL_INTERACTIVE))$.interactivityLevel="interactive";else if(d.detected.has(D3.SMIL_ANIMATIONS)||d.detected.has(D3.CSS_ANIMATIONS))$.interactivityLevel="animated";for(let w of Object.values(C)){$.bySyntax[w]={file:{works:[],partial:[],blocked:[]},http:{works:[],partial:[],blocked:[]}};for(let F of d.detected){let a3=o3[F];if(a3&&a3[w]){let{file:e3,http:i3,note:y3}=a3[w];if(e3==="✅")$.bySyntax[w].file.works.push({feature:F,note:y3});else if(e3==="⚠️")$.bySyntax[w].file.partial.push({feature:F,note:y3});else $.bySyntax[w].file.blocked.push({feature:F,note:y3});if(i3==="✅")$.bySyntax[w].http.works.push({feature:F,note:y3});else if(i3==="⚠️")$.bySyntax[w].http.partial.push({feature:F,note:y3});else $.bySyntax[w].http.blocked.push({feature:F,note:y3})}}}for(let[w,F]of Object.entries(K)){let a3=[],e3=[];for(let i3 of d.detected){let y3={[D3.JAVASCRIPT]:"JavaScript",[D3.EVENT_HANDLERS]:"Event handlers",[D3.SMIL_ANIMATIONS]:"SMIL",[D3.SMIL_INTERACTIVE]:"Interactive SMIL",[D3.CSS_ANIMATIONS]:"CSS animations",[D3.AUDIO]:"Audio",[D3.VIDEO]:"Video",[D3.EXTERNAL_IMAGES]:"External images",[D3.EXTERNAL_USE]:"External use",[D3.FOREIGN_OBJECT]:"foreignObject",[D3.HYPERLINKS]:"Links"}[i3]||i3;if(F.restrictions.some((u3)=>u3.toLowerCase().includes(y3.toLowerCase())||u3.toLowerCase().includes("no "+y3.toLowerCase())))a3.push(y3);else if(F.worksFor.some((u3)=>u3.toLowerCase().includes(y3.toLowerCase())))e3.push(y3)}$.specialCases[w]={syntax:F.syntax,blockedFeatures:a3,workingFeatures:e3,note:F.note,overallCompat:a3.length===0?"✅ Compatible":a3.length<d.detected.size/2?"⚠️ Partial":"❌ Not compatible"}}if(d.detected.has(D3.AUDIO))$.recommendations.push({issue:"Audio playback blocked",solution:"Use SCRIPT syntax with user gesture: embed SVG inline, extract audio data-uri via JavaScript, play on click",example:`document.querySelector('svg').addEventListener('click', () => {
|
|
29
|
+
`)}return Q.valid=Q.errors.length===0,$.setAttribute("data-compatibility-report",JSON.stringify({hasAudio:Q.media.hasAudio,hasVideo:Q.media.hasVideo,smilCount:Q.smil.animationCount,hasInteractive:Q.smil.hasInteractiveAnimations,issues:Q.compatibility.issues.length})),$._compatibilityReport=Q,$}),s6={RENDER_VECTORS:{cat:"display",name:"Vector paths/shapes",critical:!0},RENDER_TEXT:{cat:"display",name:"Text rendering",critical:!0},RENDER_GRADIENTS:{cat:"display",name:"Gradients (linear/radial)",critical:!1},RENDER_PATTERNS:{cat:"display",name:"Pattern fills",critical:!1},RENDER_OPACITY:{cat:"display",name:"Opacity/transparency",critical:!1},RENDER_BLENDMODES:{cat:"display",name:"Blend modes",critical:!1},RENDER_TRANSFORMS:{cat:"display",name:"Transforms",critical:!0},FONTS_EMBEDDED:{cat:"fonts",name:"Embedded fonts (data-uri)",critical:!1},FONTS_SYSTEM:{cat:"fonts",name:"System fonts",critical:!1},FONTS_WEB_SAME:{cat:"fonts",name:"Web fonts (same-origin)",critical:!1},FONTS_WEB_CROSS:{cat:"fonts",name:"Web fonts (cross-origin)",critical:!1},IMAGES_EMBEDDED:{cat:"images",name:"Embedded images (data-uri)",critical:!1},IMAGES_LOCAL:{cat:"images",name:"Local images",critical:!1},IMAGES_REMOTE_SAME:{cat:"images",name:"Remote images (same-origin)",critical:!1},IMAGES_REMOTE_CROSS:{cat:"images",name:"Remote images (cross-origin)",critical:!1},FILTERS_BASIC:{cat:"effects",name:"Basic filters (blur, shadow)",critical:!1},FILTERS_COMPLEX:{cat:"effects",name:"Complex filters (lighting, turbulence)",critical:!1},MASKS:{cat:"effects",name:"Mask elements",critical:!1},CLIP_PATHS:{cat:"effects",name:"Clip paths",critical:!1},SMIL_TIMED:{cat:"animation",name:"SMIL time-based animation",critical:!1},SMIL_CLICK:{cat:"animation",name:"SMIL click-triggered",critical:!1},SMIL_HOVER:{cat:"animation",name:"SMIL mouseover-triggered",critical:!1},SMIL_FOCUS:{cat:"animation",name:"SMIL focus-triggered",critical:!1},SMIL_ACCESSKEY:{cat:"animation",name:"SMIL accessKey-triggered",critical:!1},SMIL_SYNCBASE:{cat:"animation",name:"SMIL syncbase (anim.begin)",critical:!1},CSS_KEYFRAMES:{cat:"animation",name:"CSS @keyframes animation",critical:!1},CSS_TRANSITIONS:{cat:"animation",name:"CSS transitions",critical:!1},CSS_HOVER:{cat:"animation",name:"CSS :hover effects",critical:!1},SCRIPT_INLINE:{cat:"scripting",name:"Inline <script>",critical:!1},SCRIPT_EXTERNAL:{cat:"scripting",name:'External <script src="">',critical:!1},SCRIPT_MODULE:{cat:"scripting",name:"ES modules in SVG",critical:!1},EVENT_ONCLICK:{cat:"events",name:"onclick handler",critical:!1},EVENT_ONDBLCLICK:{cat:"events",name:"ondblclick handler",critical:!1},EVENT_ONMOUSEDOWN:{cat:"events",name:"onmousedown handler",critical:!1},EVENT_ONMOUSEUP:{cat:"events",name:"onmouseup handler",critical:!1},EVENT_ONMOUSEOVER:{cat:"events",name:"onmouseover handler",critical:!1},EVENT_ONMOUSEOUT:{cat:"events",name:"onmouseout handler",critical:!1},EVENT_ONMOUSEMOVE:{cat:"events",name:"onmousemove handler",critical:!1},EVENT_ONFOCUS:{cat:"events",name:"onfocus handler",critical:!1},EVENT_ONBLUR:{cat:"events",name:"onblur handler",critical:!1},EVENT_ONLOAD:{cat:"events",name:"onload handler",critical:!1},EVENT_ONERROR:{cat:"events",name:"onerror handler",critical:!1},EVENT_ONSCROLL:{cat:"events",name:"onscroll handler",critical:!1},EVENT_ONWHEEL:{cat:"events",name:"onwheel handler",critical:!1},EVENT_ONTOUCH:{cat:"events",name:"touch events",critical:!1},EVENT_ONKEYBOARD:{cat:"events",name:"keyboard events",critical:!1},LINK_INTERNAL:{cat:"links",name:"Internal anchor links",critical:!1},LINK_EXTERNAL:{cat:"links",name:"External hyperlinks",critical:!1},LINK_TARGET:{cat:"links",name:"Link target attribute",critical:!1},LINK_DOWNLOAD:{cat:"links",name:"Download attribute",critical:!1},FOREIGNOBJECT_BASIC:{cat:"html",name:"foreignObject rendering",critical:!1},FOREIGNOBJECT_HTML:{cat:"html",name:"HTML in foreignObject",critical:!1},FOREIGNOBJECT_FORM:{cat:"html",name:"Forms in foreignObject",critical:!1},FOREIGNOBJECT_INPUT:{cat:"html",name:"Input elements in foreignObject",critical:!1},FOREIGNOBJECT_CANVAS:{cat:"html",name:"Canvas in foreignObject",critical:!1},FOREIGNOBJECT_VIDEO:{cat:"html",name:"Video in foreignObject",critical:!1},FOREIGNOBJECT_IFRAME:{cat:"html",name:"iframe in foreignObject",critical:!1},AUDIO_EMBEDDED:{cat:"media",name:"Embedded audio (data-uri)",critical:!1},AUDIO_LOCAL:{cat:"media",name:"Local audio files",critical:!1},AUDIO_REMOTE:{cat:"media",name:"Remote audio files",critical:!1},AUDIO_AUTOPLAY:{cat:"media",name:"Audio autoplay",critical:!1},AUDIO_CONTROLS:{cat:"media",name:"Audio controls visible",critical:!1},VIDEO_EMBEDDED:{cat:"media",name:"Embedded video (data-uri)",critical:!1},VIDEO_LOCAL:{cat:"media",name:"Local video files",critical:!1},VIDEO_REMOTE:{cat:"media",name:"Remote video files",critical:!1},VIDEO_AUTOPLAY:{cat:"media",name:"Video autoplay",critical:!1},USE_INTERNAL:{cat:"sprites",name:"Internal <use> references",critical:!1},USE_EXTERNAL_SAME:{cat:"sprites",name:"External <use> (same-origin)",critical:!1},USE_EXTERNAL_CROSS:{cat:"sprites",name:"External <use> (cross-origin)",critical:!1},USE_SHADOW_DOM:{cat:"sprites",name:"Shadow DOM styling of <use>",critical:!1},MAP_BASIC:{cat:"maps",name:"SVG as image map",critical:!1},MAP_COORDS:{cat:"maps",name:"Clickable regions",critical:!1},A11Y_ARIA:{cat:"accessibility",name:"ARIA attributes",critical:!1},A11Y_ROLE:{cat:"accessibility",name:"Role attributes",critical:!1},A11Y_TITLE:{cat:"accessibility",name:"Title/desc for screen readers",critical:!1},A11Y_TABINDEX:{cat:"accessibility",name:"Tab navigation",critical:!1},META_DATA_ATTRS:{cat:"metadata",name:"data-* attributes",critical:!1},META_CLASS:{cat:"metadata",name:"class attribute styling",critical:!1},META_ID:{cat:"metadata",name:"id references",critical:!0},EXT_CSS_LINK:{cat:"external",name:"External CSS via <?xml-stylesheet?>",critical:!1},EXT_CSS_IMPORT:{cat:"external",name:"@import in <style>",critical:!1},EXT_XLINK:{cat:"external",name:"xlink:href references",critical:!1}},Sz={STANDALONE_BROWSER:{id:"standalone-browser",name:"Standalone (Browser)",type:"browser"},HTML_PAGE:{id:"html-page",name:"HTML Page",type:"browser"},ELECTRON:{id:"electron",name:"Electron App",type:"browser"},WEBVIEW_IOS:{id:"webview-ios",name:"iOS WKWebView",type:"mobile"},WEBVIEW_ANDROID:{id:"webview-android",name:"Android WebView",type:"mobile"},CAIRO:{id:"cairo",name:"Cairo/librsvg",type:"renderer"},INKSCAPE:{id:"inkscape",name:"Inkscape",type:"renderer"},IMAGEMAGICK:{id:"imagemagick",name:"ImageMagick",type:"renderer"},BATIK:{id:"batik",name:"Apache Batik",type:"renderer"},RESVG:{id:"resvg",name:"resvg",type:"renderer"},QT_SVG:{id:"qt-svg",name:"Qt SVG",type:"renderer"},SKIA:{id:"skia",name:"Skia (Chrome/Flutter)",type:"renderer"}},vz={FILE:{id:"file",name:"file://",protocol:"file"},HTTP:{id:"http",name:"http://",protocol:"http"},HTTPS:{id:"https",name:"https://",protocol:"https"},DATA_URI:{id:"data-uri",name:"data: URI",protocol:"data"},BLOB_URL:{id:"blob-url",name:"blob: URL",protocol:"blob"}},Dz={INLINE:{id:"inline",name:"Inline in HTML",location:"inline"},BASE64:{id:"base64",name:"Base64 encoded",location:"embedded"},LOCAL_SAME:{id:"local-same",name:"Local (same dir)",location:"local"},LOCAL_ABS:{id:"local-abs",name:"Local (absolute)",location:"local"},REMOTE_SAME:{id:"remote-same",name:"Remote (same-origin)",location:"remote"},REMOTE_CROSS:{id:"remote-cross",name:"Remote (cross-origin)",location:"cross"},REMOTE_CORS:{id:"remote-cors",name:"Remote (cross+CORS)",location:"cors"}},I5={DIRECT:{id:"direct",name:"Direct SVG file",html:!1},IMG:{id:"img",name:'<img src="">',html:!0},PICTURE:{id:"picture",name:"<picture><source>",html:!0},OBJECT:{id:"object",name:'<object data="">',html:!0},EMBED:{id:"embed",name:'<embed src="">',html:!0},IFRAME:{id:"iframe",name:'<iframe src="">',html:!0},INLINE_SVG:{id:"inline-svg",name:"<svg>...</svg>",html:!0},CSS_BG:{id:"css-bg",name:"CSS background-image",html:!0},CSS_MASK:{id:"css-mask",name:"CSS mask-image",html:!0},CSS_CONTENT:{id:"css-content",name:"CSS content: url()",html:!0},CSS_LIST:{id:"css-list",name:"CSS list-style-image",html:!0},CSS_BORDER:{id:"css-border",name:"CSS border-image",html:!0},CANVAS_DRAW:{id:"canvas-draw",name:"canvas.drawImage()",html:!0},SCRIPT_INNER:{id:"script-inner",name:"innerHTML assignment",html:!0},SCRIPT_DOM:{id:"script-dom",name:"DOM createElement",html:!0},SCRIPT_FETCH:{id:"script-fetch",name:"fetch + parse",html:!0}},hz={NA:{id:"n/a",name:"N/A (not script)",script:!1},INLINE_SCRIPT:{id:"inline-script",name:"Inline <script>",script:!0},SAME_ORIGIN:{id:"same-origin",name:"Same-origin script",script:!0},CROSS_CORS:{id:"cross-cors",name:"Cross-origin (CORS)",script:!0},CROSS_NO_CORS:{id:"cross-no-cors",name:"Cross-origin (no CORS)",script:!0}},C5={CHROME:{id:"chrome",name:"Chrome",engine:"blink"},FIREFOX:{id:"firefox",name:"Firefox",engine:"gecko"},SAFARI:{id:"safari",name:"Safari",engine:"webkit"},EDGE:{id:"edge",name:"Edge",engine:"blink"},IE11:{id:"ie11",name:"IE 11",engine:"trident"},SAFARI_IOS:{id:"safari-ios",name:"Safari iOS",engine:"webkit"},CHROME_ANDROID:{id:"chrome-android",name:"Chrome Android",engine:"blink"},SAMSUNG:{id:"samsung",name:"Samsung Internet",engine:"blink"}},L={WORKS:"✅",PARTIAL:"⚠️",BLOCKED:"❌",DEPENDS:"❓",NA:"➖"},r9={RENDER_VECTORS:{default:L.WORKS,exceptions:{}},RENDER_TEXT:{default:L.WORKS,exceptions:{"renderer:imagemagick":{status:L.PARTIAL,note:"Font substitution may occur"},"renderer:batik":{status:L.PARTIAL,note:"Limited font support"}}},RENDER_GRADIENTS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.PARTIAL,note:"Some gradient types unsupported"}}},RENDER_PATTERNS:{default:L.WORKS,exceptions:{"renderer:resvg":{status:L.PARTIAL,note:"Limited pattern support"}}},RENDER_OPACITY:{default:L.WORKS,exceptions:{}},RENDER_BLENDMODES:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No blend mode support"},"renderer:cairo":{status:L.PARTIAL,note:"Limited blend modes"}}},FONTS_EMBEDDED:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No embedded fonts in img context",browsers:"all"},"syntax:css-bg":{status:L.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"syntax:css-mask":{status:L.BLOCKED,note:"No embedded fonts in CSS context",browsers:"all"},"renderer:imagemagick":{status:L.BLOCKED,note:"Cannot process embedded fonts"}}},FONTS_SYSTEM:{default:L.WORKS,exceptions:{}},FONTS_WEB_SAME:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"syntax:css-bg":{status:L.BLOCKED,note:"No external resources in CSS bg"},"load:file":{status:L.PARTIAL,note:"May fail due to local file restrictions"},"renderer:*":{status:L.BLOCKED,note:"Renderers cannot fetch web fonts"}}},FONTS_WEB_CROSS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources in CSS"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS headers"},"renderer:*":{status:L.BLOCKED,note:"Renderers cannot fetch fonts"}}},IMAGES_EMBEDDED:{default:L.WORKS,exceptions:{}},IMAGES_LOCAL:{default:L.WORKS,exceptions:{"load:http":{status:L.BLOCKED,note:"Cannot load file:// from http://"},"load:https":{status:L.BLOCKED,note:"Cannot load file:// from https://"},"syntax:img":{status:L.BLOCKED,note:"No external resources in img"}}},IMAGES_REMOTE_SAME:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"load:file":{status:L.BLOCKED,note:"Cannot fetch http from file://"}}},IMAGES_REMOTE_CROSS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources in img"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS"},"load:file":{status:L.BLOCKED,note:"CORS not applicable"}}},FILTERS_BASIC:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.PARTIAL,note:"Limited filter support"}}},FILTERS_COMPLEX:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"Complex filters unsupported"},"renderer:resvg":{status:L.PARTIAL,note:"Some filters unsupported"},"renderer:qt-svg":{status:L.PARTIAL,note:"Limited filter primitives"}}},MASKS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"SVG masks not supported"}}},CLIP_PATHS:{default:L.WORKS,exceptions:{}},SMIL_TIMED:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.PARTIAL,note:"May animate, no interaction",browsers:["chrome","firefox"]},"syntax:css-bg":{status:L.PARTIAL,note:"May animate, varies by browser"},"renderer:*":{status:L.BLOCKED,note:"Static render, no animation"}}},SMIL_CLICK:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized, no interaction"},"renderer:*":{status:L.BLOCKED,note:"No interaction in renderers"}}},SMIL_HOVER:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SMIL_FOCUS:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.BLOCKED,note:"No interaction"},"syntax:css-*":{status:L.BLOCKED,note:"No interaction"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SMIL_ACCESSKEY:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"browser:chrome":{status:L.PARTIAL,note:"Limited accessKey support"},"syntax:img":{status:L.BLOCKED,note:"No keyboard in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No keyboard in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No keyboard"}}},SMIL_SYNCBASE:{default:L.WORKS,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No SMIL support"},"syntax:img":{status:L.PARTIAL,note:"Sync works if animation plays"},"renderer:*":{status:L.BLOCKED,note:"No animation"}}},CSS_KEYFRAMES:{default:L.WORKS,exceptions:{"syntax:img":{status:L.WORKS,note:"CSS animations work in img"},"syntax:css-bg":{status:L.WORKS,note:"CSS animations work"},"renderer:*":{status:L.BLOCKED,note:"Static render"}}},CSS_TRANSITIONS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No interaction for transitions"},"syntax:css-bg":{status:L.BLOCKED,note:"No interaction"},"renderer:*":{status:L.BLOCKED,note:"Static render"}}},CSS_HOVER:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No :hover in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No :hover in CSS context"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},SCRIPT_INLINE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Scripts disabled for security"},"syntax:css-*":{status:L.BLOCKED,note:"Scripts disabled in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized, no scripts"},"renderer:*":{status:L.BLOCKED,note:"No script execution"},"display:html-page+syntax:inline-svg":{status:L.WORKS,note:"Runs in page context"},"display:html-page+syntax:object":{status:L.WORKS,note:"Isolated context"},"display:html-page+syntax:embed":{status:L.WORKS,note:"Isolated context"}}},SCRIPT_EXTERNAL:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources"},"load:file":{status:L.PARTIAL,note:"May be blocked by local file restrictions"},"storage:remote-cross":{status:L.BLOCKED,note:"CORS required"},"storage:remote-cors":{status:L.WORKS,note:"Works with CORS"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},SCRIPT_MODULE:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No ES modules"},"browser:safari":{status:L.PARTIAL,note:"Limited module support in SVG"},"syntax:img":{status:L.BLOCKED,note:"No scripts"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONCLICK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events in img context"},"syntax:css-*":{status:L.BLOCKED,note:"No events in CSS context"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Rasterized"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONDBLCLICK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEDOWN:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEUP:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOVER:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEOUT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONMOUSEMOVE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONFOCUS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:L.BLOCKED,note:"No focus"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONBLUR:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONLOAD:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scripts/events"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONERROR:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scripts"},"syntax:css-*":{status:L.BLOCKED,note:"No scripts"},"renderer:*":{status:L.BLOCKED,note:"No scripts"}}},EVENT_ONSCROLL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No scroll in img"},"syntax:css-*":{status:L.BLOCKED,note:"No scroll"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONWHEEL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONTOUCH:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No touch events"},"syntax:css-*":{status:L.BLOCKED,note:"No touch"},"display:*-browser":{status:L.NA,note:"No touch on desktop"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},EVENT_ONKEYBOARD:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No keyboard"},"syntax:css-*":{status:L.BLOCKED,note:"No keyboard"},"renderer:*":{status:L.BLOCKED,note:"No events"}}},LINK_INTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links in img"},"syntax:css-*":{status:L.BLOCKED,note:"No links in CSS"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},LINK_EXTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links in img"},"syntax:css-*":{status:L.BLOCKED,note:"No links"},"syntax:object":{status:L.WORKS,note:"Opens in object frame"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},LINK_TARGET:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links"},"syntax:css-*":{status:L.BLOCKED,note:"No links"},"syntax:object":{status:L.PARTIAL,note:"May not break out of frame"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},LINK_DOWNLOAD:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No links"},"browser:safari":{status:L.PARTIAL,note:"Limited download attr support"},"renderer:*":{status:L.BLOCKED,note:"No links"}}},FOREIGNOBJECT_BASIC:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"foreignObject disabled in img"},"syntax:css-*":{status:L.BLOCKED,note:"foreignObject disabled in CSS"},"syntax:canvas-draw":{status:L.BLOCKED,note:"Security: tainted canvas"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject support"},"renderer:cairo":{status:L.BLOCKED,note:"No foreignObject"},"renderer:resvg":{status:L.BLOCKED,note:"No foreignObject"},"renderer:imagemagick":{status:L.BLOCKED,note:"No foreignObject"}}},FOREIGNOBJECT_HTML:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No HTML rendering"}}},FOREIGNOBJECT_FORM:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"syntax:object":{status:L.PARTIAL,note:"Form submission may be restricted"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No forms"}}},FOREIGNOBJECT_INPUT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No inputs"}}},FOREIGNOBJECT_CANVAS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No canvas"}}},FOREIGNOBJECT_VIDEO:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No video"}}},FOREIGNOBJECT_IFRAME:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject"},"syntax:object":{status:L.PARTIAL,note:"Nested contexts may fail"},"browser:ie11":{status:L.BLOCKED,note:"No foreignObject"},"renderer:*":{status:L.BLOCKED,note:"No iframes"}}},AUDIO_EMBEDDED:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg+processing:*-script":{status:L.WORKS,note:"Play on user gesture via JS"},"syntax:script-*":{status:L.WORKS,note:"JS can play on user gesture"}},note:"All browsers block autoplay without user gesture"},AUDIO_LOCAL:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"},"load:file":{status:L.PARTIAL,note:"May work locally with gesture"}}},AUDIO_REMOTE:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture + CORS"},"storage:remote-cors":{status:L.PARTIAL,note:"Needs user gesture"}}},AUDIO_AUTOPLAY:{default:L.BLOCKED,exceptions:{},note:"Autoplay blocked by ALL modern browsers"},AUDIO_CONTROLS:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No foreignObject/audio"},"syntax:css-*":{status:L.BLOCKED,note:"No foreignObject/audio"},"syntax:object":{status:L.PARTIAL,note:"May render controls"}}},VIDEO_EMBEDDED:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"},"syntax:script-*":{status:L.WORKS,note:"JS can play on gesture"}}},VIDEO_LOCAL:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs user gesture"}}},VIDEO_REMOTE:{default:L.BLOCKED,exceptions:{"display:html-page+syntax:inline-svg":{status:L.PARTIAL,note:"Needs gesture + CORS"}}},VIDEO_AUTOPLAY:{default:L.BLOCKED,exceptions:{"browser:*":{status:L.PARTIAL,note:"May work muted"}},note:"Autoplay only works muted in most browsers"},USE_INTERNAL:{default:L.WORKS,exceptions:{"syntax:img":{status:L.WORKS,note:"Internal refs work"},"syntax:css-*":{status:L.WORKS,note:"Internal refs work"}}},USE_EXTERNAL_SAME:{default:L.PARTIAL,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external refs"},"syntax:css-*":{status:L.BLOCKED,note:"No external refs"},"browser:chrome":{status:L.BLOCKED,note:"External use blocked since Chrome 50"},"browser:firefox":{status:L.BLOCKED,note:"Blocked for security"},"browser:safari":{status:L.PARTIAL,note:"May work same-origin"}},note:"Most browsers block external <use> for security"},USE_EXTERNAL_CROSS:{default:L.BLOCKED,exceptions:{},note:"Cross-origin external <use> blocked by all browsers"},USE_SHADOW_DOM:{default:L.PARTIAL,exceptions:{"browser:ie11":{status:L.BLOCKED,note:"No shadow DOM"},"syntax:img":{status:L.BLOCKED,note:"No styling access"}},note:"Styling shadow DOM from <use> is limited"},MAP_BASIC:{default:L.NA,exceptions:{"syntax:inline-svg":{status:L.WORKS,note:"Can use SVG elements as map"}},note:"Traditional image maps not applicable, use SVG events"},MAP_COORDS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No events for clickable regions"},"syntax:css-*":{status:L.BLOCKED,note:"No events"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},A11Y_ARIA:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"Only alt text accessible"},"syntax:css-*":{status:L.BLOCKED,note:"No a11y in CSS images"},"renderer:*":{status:L.BLOCKED,note:"No a11y tree"}}},A11Y_ROLE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Use alt attribute instead"},"syntax:css-*":{status:L.BLOCKED,note:"No a11y"},"renderer:*":{status:L.BLOCKED,note:"No a11y"}}},A11Y_TITLE:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"May not be read by screen readers"},"syntax:css-*":{status:L.BLOCKED,note:"Not accessible"}}},A11Y_TABINDEX:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No focus in img"},"syntax:css-*":{status:L.BLOCKED,note:"No focus"},"renderer:*":{status:L.BLOCKED,note:"No interaction"}}},META_DATA_ATTRS:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"Not accessible from outside"},"syntax:css-*":{status:L.BLOCKED,note:"Not accessible"}}},META_CLASS:{default:L.WORKS,exceptions:{}},META_ID:{default:L.WORKS,exceptions:{"syntax:img":{status:L.PARTIAL,note:"IDs isolated"}}},EXT_CSS_LINK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external resources"},"syntax:css-*":{status:L.BLOCKED,note:"No external resources"},"load:file":{status:L.PARTIAL,note:"Local file restrictions"},"renderer:*":{status:L.BLOCKED,note:"No external fetch"}}},EXT_CSS_IMPORT:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No @import"},"syntax:css-*":{status:L.BLOCKED,note:"No @import"},"load:file":{status:L.PARTIAL,note:"May be blocked"},"renderer:*":{status:L.BLOCKED,note:"No external fetch"}}},EXT_XLINK:{default:L.WORKS,exceptions:{"syntax:img":{status:L.BLOCKED,note:"No external xlink"},"syntax:css-*":{status:L.BLOCKED,note:"No external xlink"},"storage:remote-cross":{status:L.BLOCKED,note:"CORS required"}}}},X0={JAVASCRIPT:"javascript",EVENT_HANDLERS:"event_handlers",SMIL_ANIMATIONS:"smil_animations",SMIL_INTERACTIVE:"smil_interactive",CSS_ANIMATIONS:"css_animations",AUDIO:"audio",VIDEO:"video",EXTERNAL_IMAGES:"external_images",EXTERNAL_CSS:"external_css",EXTERNAL_FONTS:"external_fonts",EXTERNAL_SCRIPTS:"external_scripts",EXTERNAL_USE:"external_use",FOREIGN_OBJECT:"foreign_object",IFRAME:"iframe",FILTERS:"filters",MASKS:"masks",CLIP_PATHS:"clip_paths",HYPERLINKS:"hyperlinks",ANCHORS:"anchors"},yz=G0(($,J={})=>{let Z=J.verbose||!1,K=J.printTables!==!1,Q=J.includeMetaAnalysis!==!1,H=(T)=>{let P=[],t=T.toLowerCase(),$0=(Q0)=>{if(Q0.tagName&&Q0.tagName.toLowerCase()===t)P.push(Q0);for(let V0 of Q0.children||[])if(V0&&V0.tagName)$0(V0)};return $0($),P},z=(T,P=[])=>{if(T.tagName)P.push(T);for(let t of T.children||[])if(t&&t.tagName)z(t,P);return P},q=(T,...P)=>{for(let t of P)if(T.getAttribute(t))return!0;return!1},W={detected:new Set,details:{}},j=z($),G=H("script");if(G.length>0){if(W.detected.add(X0.JAVASCRIPT),W.details.javascript={count:G.length,hasExternalSrc:G.some((T)=>T.getAttribute("src")||T.getAttribute("href")||T.getAttribute("xlink:href")),types:G.map((T)=>T.getAttribute("type")||"text/javascript")},W.details.javascript.hasExternalSrc)W.detected.add(X0.EXTERNAL_SCRIPTS)}let F=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onload","onerror","onscroll","onwheel","ontouchstart","ontouchend","ontouchmove","onbegin","onend","onrepeat"],_=[];for(let T of j){let P=F.filter((t)=>T.getAttribute(t));if(P.length>0)_.push({tag:T.tagName,handlers:P})}if(_.length>0)W.detected.add(X0.EVENT_HANDLERS),W.details.eventHandlers={count:_.length,types:[...new Set(_.flatMap((T)=>T.handlers))],elements:_.slice(0,10)};let U=["animate","animatetransform","animatemotion","animatecolor","set"],O=[],V=[];for(let T of U){let P=H(T);O.push(...P);for(let t of P){let $0=t.getAttribute("begin")||"",Q0=t.getAttribute("end")||"",V0=["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","focusin","focusout"];for(let N0 of V0)if($0.includes(N0)||Q0.includes(N0))V.push({element:t.tagName,event:N0,begin:$0,end:Q0});if($0.includes("accessKey(")||Q0.includes("accessKey("))V.push({element:t.tagName,event:"accessKey",begin:$0,end:Q0})}}if(O.length>0){if(W.detected.add(X0.SMIL_ANIMATIONS),W.details.smilAnimations={count:O.length,breakdown:{animate:H("animate").length,animateTransform:H("animatetransform").length,animateMotion:H("animatemotion").length,animateColor:H("animatecolor").length,set:H("set").length}},V.length>0)W.detected.add(X0.SMIL_INTERACTIVE),W.details.smilInteractive={count:V.length,triggers:[...new Set(V.map((T)=>T.event))],elements:V.slice(0,10)}}let M=H("style"),Y=!1;for(let T of M){let P=T.textContent||"";if(P.includes("@keyframes")||P.includes("animation:")||P.includes("animation-name")||P.includes("transition:")||P.includes("transition-property")){Y=!0;break}}for(let T of j){let P=T.getAttribute("style")||"";if(P.includes("animation")||P.includes("transition")){Y=!0;break}}if(Y)W.detected.add(X0.CSS_ANIMATIONS),W.details.cssAnimations={detected:!0};let X=H("audio"),w=H("video"),R=H("foreignobject");for(let T of R){let P=[],t=[],$0=(Q0)=>{let V0=Q0.tagName?.toLowerCase();if(V0==="audio")P.push(Q0);if(V0==="video")t.push(Q0);for(let N0 of Q0.children||[])if(N0&&N0.tagName)$0(N0)};for(let Q0 of T.children||[])if(Q0&&Q0.tagName)$0(Q0);X.push(...P),w.push(...t)}if(X.length>0)W.detected.add(X0.AUDIO),W.details.audio={count:X.length,hasAutoplay:X.some((T)=>T.hasAttribute("autoplay")),sources:X.map((T)=>({id:T.getAttribute("id"),src:T.getAttribute("src"),isDataUri:(T.getAttribute("src")||"").startsWith("data:"),isExternal:(T.getAttribute("src")||"").startsWith("http")}))};if(w.length>0)W.detected.add(X0.VIDEO),W.details.video={count:w.length,hasAutoplay:w.some((T)=>T.hasAttribute("autoplay"))};let I=H("image"),f=[],u=[];for(let T of I){let P=T.getAttribute("href")||T.getAttribute("xlink:href")||"";if(P.startsWith("http://")||P.startsWith("https://")||P.startsWith("//"))f.push({href:P,element:"image"});else if(P.startsWith("data:"))u.push({type:"data-uri",element:"image"});else if(P&&!P.startsWith("#"))f.push({href:P,element:"image",type:"local"})}if(f.length>0)W.detected.add(X0.EXTERNAL_IMAGES),W.details.externalImages={count:f.length,urls:f.slice(0,5)};let m=H("use"),S=[];for(let T of m){let P=T.getAttribute("href")||T.getAttribute("xlink:href")||"";if(P&&!P.startsWith("#"))S.push({href:P})}if(S.length>0)W.detected.add(X0.EXTERNAL_USE),W.details.externalUse={count:S.length,refs:S.slice(0,5)};let x=!1;for(let T of M){let P=T.textContent||"";if(P.includes("@font-face")&&P.includes("url(")){let t=P.match(/url\(['"]?(https?:\/\/[^'")\s]+)['"]?\)/);if(t){x=!0,W.detected.add(X0.EXTERNAL_FONTS),W.details.externalFonts={detected:!0,sample:t[1]};break}}}if(R.length>0){if(W.detected.add(X0.FOREIGN_OBJECT),W.details.foreignObject={count:R.length,hasIframe:R.some((T)=>{let P=!1,t=($0)=>{if($0.tagName?.toLowerCase()==="iframe")P=!0;for(let Q0 of $0.children||[])if(Q0&&Q0.tagName)t(Q0)};return t(T),P})},W.details.foreignObject.hasIframe)W.detected.add(X0.IFRAME)}let h=H("filter"),E=H("mask"),d=H("clippath");if(h.length>0)W.detected.add(X0.FILTERS),W.details.filters={count:h.length};if(E.length>0)W.detected.add(X0.MASKS),W.details.masks={count:E.length};if(d.length>0)W.detected.add(X0.CLIP_PATHS),W.details.clipPaths={count:d.length};let c=H("a");if(c.length>0)W.detected.add(X0.HYPERLINKS),W.details.hyperlinks={count:c.length,hasExternal:c.some((T)=>{return(T.getAttribute("href")||T.getAttribute("xlink:href")||"").startsWith("http")})};let p={STANDALONE:"standalone",HTML:"html",CUSTOM_RENDERER:"custom"},N={FILE:"file://",HTTP:"http://"},y={INLINE_BASE64:"inline",LOCAL_PATH:"local",REMOTE_URL:"remote"},B={NONE:"none",IMG:"img",OBJECT:"object",EMBED:"embed",INLINE:"inline",CSS:"css",SCRIPT:"script"},e={INLINE_CODE:"inline",LOCAL_SERVER:"local",REMOTE_CDN:"remote"},r={[X0.JAVASCRIPT]:{[B.NONE]:{file:"✅",http:"✅",note:"Full JS execution"},[B.IMG]:{file:"❌",http:"❌",note:"All scripting disabled for security"},[B.OBJECT]:{file:"✅",http:"✅",note:"Isolated JS context"},[B.EMBED]:{file:"✅",http:"✅",note:"Isolated JS context"},[B.INLINE]:{file:"✅",http:"✅",note:"Same JS context as parent page"},[B.CSS]:{file:"❌",http:"❌",note:"CSS image context - no scripts"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS-generated = full control"}},[X0.EVENT_HANDLERS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full event handling"},[B.IMG]:{file:"❌",http:"❌",note:"No events in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[B.EMBED]:{file:"✅",http:"✅",note:"Events work, isolated from parent"},[B.INLINE]:{file:"✅",http:"✅",note:"Full event handling"},[B.CSS]:{file:"❌",http:"❌",note:"No events in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full event handling"}},[X0.SMIL_ANIMATIONS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.IMG]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[B.OBJECT]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.EMBED]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.INLINE]:{file:"✅",http:"✅",note:"Full SMIL support"},[B.CSS]:{file:"⚠️",http:"⚠️",note:"Time-based only, varies by browser"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full SMIL support"}},[X0.SMIL_INTERACTIVE]:{[B.NONE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[B.IMG]:{file:"❌",http:"❌",note:"No interaction in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[B.EMBED]:{file:"✅",http:"✅",note:"Interactive SMIL works"},[B.INLINE]:{file:"✅",http:"✅",note:"Full interactive SMIL"},[B.CSS]:{file:"❌",http:"❌",note:"No interaction in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full interactive SMIL"}},[X0.CSS_ANIMATIONS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.IMG]:{file:"✅",http:"✅",note:"CSS animations work in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.EMBED]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.INLINE]:{file:"✅",http:"✅",note:"Full CSS animation support"},[B.CSS]:{file:"✅",http:"✅",note:"CSS animations work"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Full CSS animation support"}},[X0.AUDIO]:{[B.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[B.IMG]:{file:"❌",http:"❌",note:"No audio in img context"},[B.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[B.CSS]:{file:"❌",http:"❌",note:"No audio in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS can play audio on user gesture"}},[X0.VIDEO]:{[B.NONE]:{file:"❌",http:"❌",note:"Autoplay blocked, needs user gesture"},[B.IMG]:{file:"❌",http:"❌",note:"No video in img context"},[B.OBJECT]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.EMBED]:{file:"❌",http:"❌",note:"Autoplay blocked"},[B.INLINE]:{file:"⚠️",http:"⚠️",note:"Needs JS + user gesture to play"},[B.CSS]:{file:"❌",http:"❌",note:"No video in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"JS can play video on user gesture"}},[X0.EXTERNAL_IMAGES]:{[B.NONE]:{file:"⚠️",http:"✅",note:"file:// may have CORS issues"},[B.IMG]:{file:"❌",http:"⚠️",note:"Blocked or CORS restricted"},[B.OBJECT]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.EMBED]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.INLINE]:{file:"⚠️",http:"✅",note:"CORS applies"},[B.CSS]:{file:"❌",http:"⚠️",note:"Restricted for security"},[B.SCRIPT]:{file:"⚠️",http:"✅",note:"CORS applies"}},[X0.EXTERNAL_CSS]:{[B.NONE]:{file:"✅",http:"✅",note:"External CSS loaded"},[B.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"External CSS works"},[B.EMBED]:{file:"✅",http:"✅",note:"External CSS works"},[B.INLINE]:{file:"✅",http:"✅",note:"External CSS works"},[B.CSS]:{file:"❌",http:"❌",note:"No external resources"},[B.SCRIPT]:{file:"✅",http:"✅",note:"External CSS works"}},[X0.EXTERNAL_FONTS]:{[B.NONE]:{file:"✅",http:"✅",note:"External fonts loaded"},[B.IMG]:{file:"❌",http:"❌",note:"No external resources in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.EMBED]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.INLINE]:{file:"✅",http:"✅",note:"External fonts work (CORS)"},[B.CSS]:{file:"❌",http:"⚠️",note:"Limited, varies by browser"},[B.SCRIPT]:{file:"✅",http:"✅",note:"External fonts work"}},[X0.EXTERNAL_USE]:{[B.NONE]:{file:"❌",http:"⚠️",note:"Most browsers block external use"},[B.IMG]:{file:"❌",http:"❌",note:"No external use in img"},[B.OBJECT]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.EMBED]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.INLINE]:{file:"❌",http:"⚠️",note:"Most browsers block"},[B.CSS]:{file:"❌",http:"❌",note:"No external use"},[B.SCRIPT]:{file:"❌",http:"⚠️",note:"Most browsers block"}},[X0.FOREIGN_OBJECT]:{[B.NONE]:{file:"✅",http:"✅",note:"Full foreignObject support"},[B.IMG]:{file:"❌",http:"❌",note:"foreignObject disabled in img"},[B.OBJECT]:{file:"✅",http:"✅",note:"foreignObject works"},[B.EMBED]:{file:"✅",http:"✅",note:"foreignObject works"},[B.INLINE]:{file:"✅",http:"✅",note:"foreignObject works"},[B.CSS]:{file:"❌",http:"❌",note:"foreignObject disabled"},[B.SCRIPT]:{file:"✅",http:"✅",note:"foreignObject works"}},[X0.HYPERLINKS]:{[B.NONE]:{file:"✅",http:"✅",note:"Links work"},[B.IMG]:{file:"❌",http:"❌",note:"No links in img context"},[B.OBJECT]:{file:"✅",http:"✅",note:"Links work (in iframe-like context)"},[B.EMBED]:{file:"✅",http:"✅",note:"Links work"},[B.INLINE]:{file:"✅",http:"✅",note:"Links work normally"},[B.CSS]:{file:"❌",http:"❌",note:"No links in CSS context"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Links work"}},[X0.FILTERS]:{[B.NONE]:{file:"✅",http:"✅",note:"Full filter support"},[B.IMG]:{file:"✅",http:"✅",note:"Filters work"},[B.OBJECT]:{file:"✅",http:"✅",note:"Filters work"},[B.EMBED]:{file:"✅",http:"✅",note:"Filters work"},[B.INLINE]:{file:"✅",http:"✅",note:"Filters work"},[B.CSS]:{file:"✅",http:"✅",note:"Filters work"},[B.SCRIPT]:{file:"✅",http:"✅",note:"Filters work"}}},s={"GitHub README.md":{syntax:"IMG (implicit)",restrictions:["No JavaScript","No SMIL","No external resources","No foreignObject","No links"],worksFor:["Static SVG","CSS animations (some)","Embedded images (data-uri)"],note:"GitHub sanitizes SVG heavily - only safe static content"},"GitHub Flavored Markdown (GFM)":{syntax:"IMG",restrictions:["Same as GitHub README"],worksFor:["Static SVG only"],note:"GFM renders SVG as images"},"GitLab README.md":{syntax:"IMG (implicit)",restrictions:["Similar to GitHub but slightly more permissive"],worksFor:["Static SVG","Some CSS animations"],note:"GitLab also sanitizes SVG"},"Wikipedia/MediaWiki":{syntax:"IMG (sanitized)",restrictions:["Heavy sanitization","No scripts","No external resources","No animations"],worksFor:["Static vector graphics only"],note:"MediaWiki converts SVG to PNG for display"},"EPUB 3.x":{syntax:"IMG or INLINE",restrictions:["No external resources","Limited JavaScript","No autoplay"],worksFor:["Static SVG","CSS animations","SMIL (in some readers)"],note:"Support varies by e-reader - Apple Books better than Kindle"},"Email (HTML email)":{syntax:"IMG (base64)",restrictions:["Heavily filtered","No scripts","No external resources","No animations"],worksFor:["Static embedded SVG only","Many clients block SVG entirely"],note:"Most email clients block or rasterize SVG"},"Slack/Discord":{syntax:"IMG (auto-converted)",restrictions:["Converted to raster","No interactivity"],worksFor:["Static preview only"],note:"SVG files are typically converted to PNG previews"},"Twitter/X":{syntax:"N/A",restrictions:["SVG not supported as media"],worksFor:["Nothing - upload as PNG"],note:"Twitter does not support SVG uploads"},Notion:{syntax:"EMBED/IMG",restrictions:["Limited - treated as image"],worksFor:["Static SVG"],note:"Notion embeds SVG as images"},Obsidian:{syntax:"INLINE or IMG",restrictions:["Depends on mode and plugins"],worksFor:["Static SVG","Some CSS animations"],note:"Obsidian has good local SVG support"},"Bear Notes":{syntax:"IMG",restrictions:["Image context only"],worksFor:["Static SVG"],note:"Bear treats SVG as images"},"Markdown-it":{syntax:"IMG (default)",restrictions:["Default IMG behavior","Can be configured for INLINE"],worksFor:["Depends on configuration"],note:"Parser library - output depends on implementation"},MDX:{syntax:"INLINE (JSX)",restrictions:["Full React component - depends on framework"],worksFor:["Full SVG when used as component"],note:"MDX can import SVG as React components"},"iOS Safari":{syntax:"ALL",restrictions:["Stricter autoplay policies"],worksFor:["All standard SVG features except auto-audio"],note:"Good SVG support, strict media policies"},"Android WebView":{syntax:"ALL",restrictions:["Varies by Android version"],worksFor:["Most SVG features"],note:"WebView behavior varies significantly"},"Cairo/librsvg":{syntax:"CUSTOM_RENDERER",restrictions:["Limited JS","Limited SMIL","No foreignObject"],worksFor:["Static SVG","Basic filters","CSS styling"],note:"Server-side rendering library - no dynamic features"},Inkscape:{syntax:"CUSTOM_RENDERER",restrictions:["May not run JS","SMIL playback varies"],worksFor:["All static SVG","Partial animation preview"],note:"Full SVG editor with preview capabilities"},ImageMagick:{syntax:"CUSTOM_RENDERER",restrictions:["Rasterizes immediately","No animations","No JS"],worksFor:["Static rasterization only"],note:"Converts SVG to raster - no dynamic features"}},z0={timestamp:new Date().toISOString(),features:W,interactivityLevel:"static",bySyntax:{},specialCases:{},recommendations:[],warnings:[]};if(W.detected.has(X0.JAVASCRIPT)||W.detected.has(X0.EVENT_HANDLERS))z0.interactivityLevel="scripted";else if(W.detected.has(X0.SMIL_INTERACTIVE))z0.interactivityLevel="interactive";else if(W.detected.has(X0.SMIL_ANIMATIONS)||W.detected.has(X0.CSS_ANIMATIONS))z0.interactivityLevel="animated";for(let T of Object.values(B)){z0.bySyntax[T]={file:{works:[],partial:[],blocked:[]},http:{works:[],partial:[],blocked:[]}};for(let P of W.detected){let t=r[P];if(t&&t[T]){let{file:$0,http:Q0,note:V0}=t[T];if($0==="✅")z0.bySyntax[T].file.works.push({feature:P,note:V0});else if($0==="⚠️")z0.bySyntax[T].file.partial.push({feature:P,note:V0});else z0.bySyntax[T].file.blocked.push({feature:P,note:V0});if(Q0==="✅")z0.bySyntax[T].http.works.push({feature:P,note:V0});else if(Q0==="⚠️")z0.bySyntax[T].http.partial.push({feature:P,note:V0});else z0.bySyntax[T].http.blocked.push({feature:P,note:V0})}}}for(let[T,P]of Object.entries(s)){let t=[],$0=[];for(let Q0 of W.detected){let N0={[X0.JAVASCRIPT]:"JavaScript",[X0.EVENT_HANDLERS]:"Event handlers",[X0.SMIL_ANIMATIONS]:"SMIL",[X0.SMIL_INTERACTIVE]:"Interactive SMIL",[X0.CSS_ANIMATIONS]:"CSS animations",[X0.AUDIO]:"Audio",[X0.VIDEO]:"Video",[X0.EXTERNAL_IMAGES]:"External images",[X0.EXTERNAL_USE]:"External use",[X0.FOREIGN_OBJECT]:"foreignObject",[X0.HYPERLINKS]:"Links"}[Q0]||Q0;if(P.restrictions.some((o)=>o.toLowerCase().includes(N0.toLowerCase())||o.toLowerCase().includes("no "+N0.toLowerCase())))t.push(N0);else if(P.worksFor.some((J0)=>J0.toLowerCase().includes(N0.toLowerCase())))$0.push(N0)}z0.specialCases[T]={syntax:P.syntax,blockedFeatures:t,workingFeatures:$0,note:P.note,overallCompat:t.length===0?"✅ Compatible":t.length<W.detected.size/2?"⚠️ Partial":"❌ Not compatible"}}if(W.detected.has(X0.AUDIO))z0.recommendations.push({issue:"Audio playback blocked",solution:"Use SCRIPT syntax with user gesture: embed SVG inline, extract audio data-uri via JavaScript, play on click",example:`document.querySelector('svg').addEventListener('click', () => {
|
|
30
30
|
const audio = new Audio(svgAudioDataUri);
|
|
31
31
|
audio.play();
|
|
32
|
-
});`});if(
|
|
32
|
+
});`});if(W.detected.has(X0.SMIL_INTERACTIVE))z0.recommendations.push({issue:"Interactive SMIL animations",solution:"Use OBJECT, EMBED, or INLINE syntax - avoid IMG and CSS background",example:'<object data="animation.svg" type="image/svg+xml"></object>'});if(W.detected.has(X0.JAVASCRIPT))z0.recommendations.push({issue:"JavaScript in SVG",solution:"Use INLINE syntax for same-page JS context, or OBJECT/EMBED for isolated context",example:"<svg><!-- your SVG with scripts --></svg>"});if(W.detected.has(X0.EXTERNAL_IMAGES)||W.detected.has(X0.EXTERNAL_FONTS)||W.detected.has(X0.EXTERNAL_USE))z0.recommendations.push({issue:"External resources",solution:"Embed resources as data-URIs for maximum compatibility, or ensure CORS headers are set",example:"Use svg-toolbox embedExternalDependencies() to inline all resources"});if(z0.interactivityLevel==="scripted")z0.warnings.push("SVG contains JavaScript - will not work in IMG, CSS, or most markdown contexts");if(W.detected.has(X0.FOREIGN_OBJECT))z0.warnings.push("SVG contains foreignObject - disabled in IMG and CSS contexts");if(W.detected.has(X0.EXTERNAL_USE))z0.warnings.push("External <use> references are blocked by most modern browsers");if(K){console.log(`
|
|
33
33
|
`+"═".repeat(100)),console.log("SVG COMPREHENSIVE COMPATIBILITY MATRIX ANALYSIS"),console.log("═".repeat(100)),console.log(`
|
|
34
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ DETECTED SVG FEATURES"+" ".repeat(76)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log(`│ Interactivity Level: ${
|
|
35
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ 5-AXIS COMPATIBILITY MATRIX"+" ".repeat(70)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ SYNTAX TAG │ PROTOCOL │ WORKS │ PARTIAL │ BLOCKED │"),console.log("├────────────────────┼───────────┼────────────────────────────┼──────────────────┼────────────┤");for(let[
|
|
36
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ RECOMMENDED EMBEDDING METHODS FOR THIS SVG"+" ".repeat(54)+"│"),console.log("├"+"─".repeat(98)+"┤");let
|
|
37
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ SPECIAL ENVIRONMENT COMPATIBILITY"+" ".repeat(63)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ ENVIRONMENT │ COMPAT │ BLOCKED FEATURES"+" ".repeat(43)+"│"),console.log("├───────────────────────────┼────────┼"+"─".repeat(61)+"┤");let
|
|
38
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ ⚠️ WARNINGS"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let
|
|
39
|
-
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDCA1 RECOMMENDATIONS"+" ".repeat(79)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let
|
|
34
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ DETECTED SVG FEATURES"+" ".repeat(76)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log(`│ Interactivity Level: ${z0.interactivityLevel.toUpperCase().padEnd(75)} │`),console.log("│"+" ".repeat(98)+"│");for(let Q0 of W.detected){let V0=W.details[Q0.replace("_","")]||W.details[Q0]||{},N0=Q0;if(V0.count!==void 0)N0+=` (${V0.count})`;console.log(`│ • ${N0.padEnd(92)} │`)}console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
35
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ 5-AXIS COMPATIBILITY MATRIX"+" ".repeat(70)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ SYNTAX TAG │ PROTOCOL │ WORKS │ PARTIAL │ BLOCKED │"),console.log("├────────────────────┼───────────┼────────────────────────────┼──────────────────┼────────────┤");for(let[Q0,V0]of Object.entries(z0.bySyntax)){let N0={none:"Direct SVG file",img:'<img src="">',object:'<object data="">',embed:'<embed src="">',inline:"<svg>...</svg>",css:"CSS background",script:"JS-generated"}[Q0]||Q0;for(let h0 of["file","http"]){let o=V0[h0],J0=o.works.length>0?o.works.length+" features":"-",F0=o.partial.length>0?o.partial.length+" features":"-",O0=o.blocked.length>0?o.blocked.length+" features":"-";console.log(`│ ${N0.padEnd(18)} │ ${(h0+"://").padEnd(9)} │ ${J0.padEnd(26)} │ ${F0.padEnd(16)} │ ${O0.padEnd(10)} │`)}}console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
36
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ RECOMMENDED EMBEDDING METHODS FOR THIS SVG"+" ".repeat(54)+"│"),console.log("├"+"─".repeat(98)+"┤");let T="inline",P=0;for(let[Q0,V0]of Object.entries(z0.bySyntax)){let N0=V0.http.works.length*3+V0.http.partial.length-V0.http.blocked.length*2;if(N0>P)P=N0,T=Q0}let t={none:"Open SVG file directly in browser",img:'<img src="your-file.svg" alt="description">',object:'<object data="your-file.svg" type="image/svg+xml"></object>',embed:'<embed src="your-file.svg" type="image/svg+xml">',inline:"Copy <svg>...</svg> content directly into HTML",css:'.element { background-image: url("your-file.svg"); }',script:'const svgEl = document.createElementNS("http://www.w3.org/2000/svg", "svg"); ...'};if(console.log(`│ BEST: ${T.toUpperCase().padEnd(91)} │`),console.log(`│ ${t[T].substring(0,96).padEnd(96)} │`),console.log("│"+" ".repeat(98)+"│"),z0.interactivityLevel!=="static")console.log("│ AVOID: IMG and CSS background (no interactivity)"+" ".repeat(49)+"│");console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
37
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ SPECIAL ENVIRONMENT COMPATIBILITY"+" ".repeat(63)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ ENVIRONMENT │ COMPAT │ BLOCKED FEATURES"+" ".repeat(43)+"│"),console.log("├───────────────────────────┼────────┼"+"─".repeat(61)+"┤");let $0=["GitHub README.md","EPUB 3.x","Email (HTML email)","Wikipedia/MediaWiki","MDX","Cairo/librsvg","iOS Safari"];for(let Q0 of $0){let V0=z0.specialCases[Q0];if(V0){let N0=V0.overallCompat.substring(0,6).padEnd(6),h0=V0.blockedFeatures.slice(0,3).join(", ").substring(0,58).padEnd(58);console.log(`│ ${Q0.substring(0,25).padEnd(25)} │ ${N0} │ ${h0} │`)}}if(console.log("└"+"─".repeat(98)+"┘"),z0.warnings.length>0){console.log(`
|
|
38
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ ⚠️ WARNINGS"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let Q0 of z0.warnings)console.log(`│ • ${Q0.substring(0,94).padEnd(94)} │`);console.log("└"+"─".repeat(98)+"┘")}if(z0.recommendations.length>0){console.log(`
|
|
39
|
+
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDCA1 RECOMMENDATIONS"+" ".repeat(79)+"│"),console.log("├"+"─".repeat(98)+"┤");for(let Q0 of z0.recommendations)console.log(`│ Issue: ${Q0.issue.substring(0,89).padEnd(89)} │`),console.log(`│ Solution: ${Q0.solution.substring(0,86).padEnd(86)} │`),console.log("│"+" ".repeat(98)+"│");console.log("└"+"─".repeat(98)+"┘")}if(W.detected.has(X0.AUDIO))console.log(`
|
|
40
40
|
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDD0A AUDIO PLAYBACK TRUTH TABLE"+" ".repeat(67)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ METHOD │ FILE:// │ HTTP:// │ USER GESTURE NEEDED │ RESULT │"),console.log("├─────────────────────────────────────┼─────────┼─────────┼─────────────────────┼──────────────┤"),console.log("│ SVG direct (autoplay) │ ❌ │ ❌ │ Yes but no trigger │ BLOCKED │"),console.log("│ SVG in <img> │ ❌ │ ❌ │ N/A │ NO AUDIO │"),console.log("│ SVG in <object> │ ❌ │ ❌ │ Yes but isolated │ BLOCKED │"),console.log("│ SVG inline + SMIL onbegin │ ⚠️ │ ⚠️ │ SMIL click trigger │ MAYBE │"),console.log("│ SVG inline + JS on click │ ✅ │ ✅ │ Yes - click event │ WORKS │"),console.log("│ HTML extracts audio, plays on click │ ✅ │ ✅ │ Yes - click event │ RECOMMENDED │"),console.log("└"+"─".repeat(98)+"┘"),console.log(`
|
|
41
41
|
┌`+"─".repeat(98)+"┐"),console.log("│ \uD83D\uDCDD AUDIO SOLUTION CODE EXAMPLE"+" ".repeat(66)+"│"),console.log("├"+"─".repeat(98)+"┤"),console.log("│ // In your HTML page: │"),console.log('│ <button id="play">Click to Play SVG Audio</button> │'),console.log('│ <object id="svg" data="your-audio.svg" type="image/svg+xml"></object> │'),console.log("│ │"),console.log("│ <script> │"),console.log('│ document.getElementById("play").addEventListener("click", () => { │'),console.log('│ const svgDoc = document.getElementById("svg").contentDocument; │'),console.log('│ const audioSrc = svgDoc.querySelector("source")?.getAttribute("src"); │'),console.log("│ if (audioSrc) new Audio(audioSrc).play(); │"),console.log("│ }); │"),console.log("│ </script> │"),console.log("└"+"─".repeat(98)+"┘");console.log(`
|
|
42
42
|
`+"═".repeat(100)+`
|
|
43
|
-
`)}return
|
|
43
|
+
`)}return $._compatibilityMatrix=z0,$}),uz=G0(($,J={})=>{let Z=J.printFullMatrix||!1,K=J.groupBySyntax!==!1,Q=J.showOnlyIssues!==!1,H=J.browserDetails!==!1,z=J.filterCapabilities||null,q=(o)=>{let J0=[],F0=o.toLowerCase(),O0=(R0)=>{if(R0.tagName&&R0.tagName.toLowerCase()===F0)J0.push(R0);for(let I0 of R0.children||[])if(I0&&I0.tagName)O0(I0)};return O0($),J0},W=(o,J0=[])=>{if(o.tagName)J0.push(o);for(let F0 of o.children||[])if(F0&&F0.tagName)W(F0,J0);return J0},j=new Set,G={},F=W($);if(F.length>1)j.add("RENDER_VECTORS"),j.add("RENDER_TRANSFORMS");let U=q("text").concat(q("tspan"));if(U.length>0)j.add("RENDER_TEXT"),G.RENDER_TEXT={count:U.length};let O=q("linearGradient"),V=q("radialGradient");if(O.length>0||V.length>0)j.add("RENDER_GRADIENTS"),G.RENDER_GRADIENTS={linear:O.length,radial:V.length};let M=q("pattern");if(M.length>0)j.add("RENDER_PATTERNS"),G.RENDER_PATTERNS={count:M.length};for(let o of F)if(o.getAttribute("opacity")||o.getAttribute("fill-opacity")||o.getAttribute("stroke-opacity")||(o.getAttribute("style")||"").includes("opacity")){j.add("RENDER_OPACITY");break}for(let o of F)if((o.getAttribute("style")||"").includes("mix-blend-mode")||o.getAttribute("mix-blend-mode")){j.add("RENDER_BLENDMODES");break}let Y=q("style");for(let o of Y){let J0=o.textContent||"";if(J0.includes("@font-face")){if(J0.includes("data:"))j.add("FONTS_EMBEDDED");else if(J0.includes("url(")&&J0.match(/url\s*\(\s*['"]?https?:/))j.add("FONTS_WEB_CROSS");else if(J0.includes("url("))j.add("FONTS_WEB_SAME")}}if(U.length>0)j.add("FONTS_SYSTEM");let X=q("image");for(let o of X){let J0=o.getAttribute("href")||o.getAttribute("xlink:href")||"";if(J0.startsWith("data:"))j.add("IMAGES_EMBEDDED");else if(J0.startsWith("http://")||J0.startsWith("https://")){let F0=!0;try{let O0=new URL(J0),R0=new URL($.documentURI||$.baseURI||"");F0=O0.origin!==R0.origin}catch(O0){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${O0.message}`);F0=!0}j.add(F0?"IMAGES_REMOTE_CROSS":"IMAGES_REMOTE_SAME")}else if(J0&&!J0.startsWith("#"))j.add("IMAGES_LOCAL")}G.IMAGES={count:X.length};let w=q("filter");if(w.length>0){j.add("FILTERS_BASIC");for(let o of w){let J0=o.outerHTML||"";if(J0.includes("feTurbulence")||J0.includes("feLighting")||J0.includes("feConvolveMatrix")||J0.includes("feDisplacementMap")){j.add("FILTERS_COMPLEX");break}}G.FILTERS={count:w.length}}let R=q("mask");if(R.length>0)j.add("MASKS"),G.MASKS={count:R.length};let I=q("clippath");if(I.length>0)j.add("CLIP_PATHS"),G.CLIP_PATHS={count:I.length};let f=["animate","animatetransform","animatemotion","animatecolor","set"],u=0,m={timed:0,click:0,hover:0,focus:0,accesskey:0,syncbase:0};for(let o of f){let J0=q(o);u+=J0.length;for(let F0 of J0){let O0=(F0.getAttribute("begin")||"").toLowerCase(),R0=(F0.getAttribute("end")||"").toLowerCase(),I0=O0+" "+R0;if(I0.includes("click")||I0.includes("dblclick"))m.click++,j.add("SMIL_CLICK");if(I0.includes("mouseover")||I0.includes("mouseout")||I0.includes("mouseenter")||I0.includes("mouseleave"))m.hover++,j.add("SMIL_HOVER");if(I0.includes("focus")||I0.includes("blur"))m.focus++,j.add("SMIL_FOCUS");if(I0.includes("accesskey("))m.accesskey++,j.add("SMIL_ACCESSKEY");if(I0.match(/\w+\.(begin|end)/))m.syncbase++,j.add("SMIL_SYNCBASE");if(!I0.includes("click")&&!I0.includes("mouse")&&!I0.includes("focus")&&!I0.includes("accesskey"))m.timed++}}if(u>0)j.add("SMIL_TIMED"),G.SMIL={count:u,triggers:m};let S=!1,x=!1,h=!1;for(let o of Y){let J0=o.textContent||"";if(J0.includes("@keyframes"))S=!0;if(J0.includes("transition:")||J0.includes("transition-property"))x=!0;if(J0.includes(":hover"))h=!0}if(S)j.add("CSS_KEYFRAMES");if(x)j.add("CSS_TRANSITIONS");if(h)j.add("CSS_HOVER");let E=q("script");if(E.length>0){for(let o of E){let J0=o.getAttribute("src")||o.getAttribute("href")||o.getAttribute("xlink:href"),F0=o.getAttribute("type")||"";if(J0)j.add("SCRIPT_EXTERNAL");else j.add("SCRIPT_INLINE");if(F0==="module")j.add("SCRIPT_MODULE")}G.SCRIPTS={count:E.length}}let d=["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","onfocus","onblur","onkeydown","onkeyup","onkeypress","onload","onerror","onscroll","onwheel","ontouchstart","ontouchend","ontouchmove"],c={onclick:"EVENT_ONCLICK",ondblclick:"EVENT_ONDBLCLICK",onmousedown:"EVENT_ONMOUSEDOWN",onmouseup:"EVENT_ONMOUSEUP",onmouseover:"EVENT_ONMOUSEOVER",onmouseout:"EVENT_ONMOUSEOUT",onmousemove:"EVENT_ONMOUSEMOVE",onfocus:"EVENT_ONFOCUS",onblur:"EVENT_ONBLUR",onload:"EVENT_ONLOAD",onerror:"EVENT_ONERROR",onscroll:"EVENT_ONSCROLL",onwheel:"EVENT_ONWHEEL",ontouchstart:"EVENT_ONTOUCH",ontouchend:"EVENT_ONTOUCH",ontouchmove:"EVENT_ONTOUCH",onkeydown:"EVENT_ONKEYBOARD",onkeyup:"EVENT_ONKEYBOARD",onkeypress:"EVENT_ONKEYBOARD"};for(let o of F)for(let J0 of d)if(o.getAttribute(J0)){let F0=c[J0];if(F0)j.add(F0)}let p=q("a");if(p.length>0){for(let o of p){if((o.getAttribute("href")||o.getAttribute("xlink:href")||"").startsWith("#"))j.add("LINK_INTERNAL");else j.add("LINK_EXTERNAL");if(o.getAttribute("target"))j.add("LINK_TARGET");if(o.getAttribute("download"))j.add("LINK_DOWNLOAD")}G.LINKS={count:p.length}}let N=q("foreignobject");if(N.length>0){j.add("FOREIGNOBJECT_BASIC"),j.add("FOREIGNOBJECT_HTML");for(let o of N){let J0=(F0)=>{let O0=F0.tagName?.toLowerCase();if(O0==="form")j.add("FOREIGNOBJECT_FORM");if(O0==="input"||O0==="textarea"||O0==="select")j.add("FOREIGNOBJECT_INPUT");if(O0==="canvas")j.add("FOREIGNOBJECT_CANVAS");if(O0==="video")j.add("FOREIGNOBJECT_VIDEO");if(O0==="iframe")j.add("FOREIGNOBJECT_IFRAME");for(let R0 of F0.children||[])if(R0&&R0.tagName)J0(R0)};J0(o)}G.FOREIGNOBJECT={count:N.length}}let y=q("audio"),B=q("video");for(let o of N){let J0=(F0)=>{let O0=F0.tagName?.toLowerCase();if(O0==="audio")y.push(F0);if(O0==="video")B.push(F0);for(let R0 of F0.children||[])if(R0&&R0.tagName)J0(R0)};J0(o)}if(y.length>0){for(let o of y){let J0=o.getAttribute("src")||"",F0=q("source").filter((R0)=>R0.parentNode===o),O0=J0||(F0.length>0?F0[0].getAttribute("src"):"");if(O0?.startsWith("data:"))j.add("AUDIO_EMBEDDED");else if(O0?.startsWith("http"))j.add("AUDIO_REMOTE");else if(O0)j.add("AUDIO_LOCAL");if(o.hasAttribute("autoplay"))j.add("AUDIO_AUTOPLAY");if(o.hasAttribute("controls"))j.add("AUDIO_CONTROLS")}G.AUDIO={count:y.length}}if(B.length>0){for(let o of B){let J0=o.getAttribute("src")||"";if(J0.startsWith("data:"))j.add("VIDEO_EMBEDDED");else if(J0.startsWith("http"))j.add("VIDEO_REMOTE");else if(J0)j.add("VIDEO_LOCAL");if(o.hasAttribute("autoplay"))j.add("VIDEO_AUTOPLAY")}G.VIDEO={count:B.length}}let e=q("use");if(e.length>0){for(let o of e){let J0=o.getAttribute("href")||o.getAttribute("xlink:href")||"";if(J0.startsWith("#"))j.add("USE_INTERNAL");else if(J0.startsWith("http"))j.add("USE_EXTERNAL_CROSS");else if(J0)j.add("USE_EXTERNAL_SAME")}j.add("USE_SHADOW_DOM"),G.USE={count:e.length}}for(let o of F){for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("aria-")){j.add("A11Y_ARIA");break}if(o.getAttribute("role"))j.add("A11Y_ROLE");if(o.getAttribute("tabindex"))j.add("A11Y_TABINDEX")}if(q("title").length>0||q("desc").length>0)j.add("A11Y_TITLE");for(let o of F){for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("data-")){j.add("META_DATA_ATTRS");break}if(o.getAttribute("class"))j.add("META_CLASS");if(o.getAttribute("id"))j.add("META_ID")}for(let o of Y)if((o.textContent||"").includes("@import"))j.add("EXT_CSS_IMPORT");for(let o of F)for(let J0 of o.getAttributeNames?.()||[])if(J0.startsWith("xlink:")){j.add("EXT_XLINK");break}let r={timestamp:new Date().toISOString(),detectedCapabilities:[...j],capabilityDetails:G,totalCombinations:0,combinationsWithIssues:0,cells:[]},s=(o,J0,F0,O0,R0,I0)=>{let b=r9[o];if(!b)return{status:L.DEPENDS,note:"No compatibility data",browsers:[]};let C=b.default,l="",g=[];for(let[n,j0]of Object.entries(b.exceptions||{})){let L0=!1;if(n.startsWith("syntax:")){let C0=n.substring(7);if(C0==="*"||C0===R0.id||C0.includes("*")&&R0.id.startsWith(C0.replace("*","")))L0=!0}else if(n.startsWith("load:")){if(n.substring(5)===F0.id)L0=!0}else if(n.startsWith("storage:")){if(n.substring(8)===O0.id)L0=!0}else if(n.startsWith("display:")){if(n.substring(8)===J0.id)L0=!0}else if(n.startsWith("renderer:")){let C0=n.substring(9);if(C0==="*"&&J0.type==="renderer")L0=!0;if(C0===J0.id)L0=!0}else if(n.startsWith("browser:")){let C0=n.substring(8);if(C0==="*")for(let E0 of Object.values(C5))g.push({browser:E0.name,status:j0.status,note:j0.note});else{let E0=Object.values(C5).find((U7)=>U7.id===C0);if(E0)g.push({browser:E0.name,status:j0.status,note:j0.note})}}if(L0)C=j0.status,l=j0.note||""}return{status:C,note:l,browserIssues:g}},z0=Object.values(Sz),T=Object.values(vz),P=Object.values(Dz),t=Object.values(I5),$0=Object.values(hz);for(let o of z0)for(let J0 of T)for(let F0 of P)for(let O0 of t)for(let R0 of $0){if(r.totalCombinations++,R0.script&&!["script-inner","script-dom","script-fetch"].includes(O0.id))continue;if(o.type==="renderer"&&O0.html)continue;let I0=[],b={};for(let C of j){if(z){let n=s6[C];if(n&&!z.includes(n.cat))continue}let l=s(C,o,J0,F0,O0,R0),g=s6[C]||{name:C,cat:"unknown"};if(b[C]={name:g.name,category:g.cat,status:l.status,note:l.note,browserIssues:l.browserIssues},l.status!==L.WORKS&&l.status!==L.NA)I0.push({capability:C,name:g.name,category:g.cat,status:l.status,note:l.note,browserIssues:l.browserIssues})}if(I0.length>0||!Q){let C={combination:{display:o.name,displayId:o.id,displayType:o.type,load:J0.name,loadId:J0.id,storage:F0.name,storageId:F0.id,syntax:O0.name,syntaxId:O0.id,processing:R0.name,processingId:R0.id},issueCount:I0.length,issues:I0,allCapabilities:b};if(r.cells.push(C),I0.length>0)r.combinationsWithIssues++}}console.log(`
|
|
44
44
|
`+"═".repeat(120)),console.log("╔"+"═".repeat(118)+"╗"),console.log("║"+" FULL COMBINATORIAL SVG COMPATIBILITY MATRIX ".padStart(82).padEnd(118)+"║"),console.log("║"+" ALL AXIS COMBINATIONS × ALL CAPABILITIES × ALL BROWSERS ".padStart(88).padEnd(118)+"║"),console.log("╚"+"═".repeat(118)+"╝"),console.log(`
|
|
45
|
-
┌`+"─".repeat(118)+"┐"),console.log("│ SUMMARY STATISTICS"+" ".repeat(99)+"│"),console.log("├"+"─".repeat(118)+"┤"),console.log(`│ Total axis combinations evaluated: ${
|
|
46
|
-
┌`+"─".repeat(118)+"┐"),console.log("│ DETECTED SVG CAPABILITIES"+" ".repeat(92)+"│"),console.log("├"+"─".repeat(118)+"┤");let
|
|
47
|
-
╔`+"═".repeat(118)+"╗"),console.log("║ FULL COMPATIBILITY MATRIX BY EMBEDDING METHOD"+" ".repeat(71)+"║"),console.log("╚"+"═".repeat(118)+"╝");let
|
|
48
|
-
┌`+"─".repeat(118)+"┐"),console.log(`│ SYNTAX: ${
|
|
49
|
-
╔`+"═".repeat(118)+"╗"),console.log("║ DETAILED ISSUE BREAKDOWN BY CAPABILITY"+" ".repeat(78)+"║"),console.log("╚"+"═".repeat(118)+"╝");for(let
|
|
50
|
-
┌`+"─".repeat(118)+"┐"),console.log(`│ ${
|
|
45
|
+
┌`+"─".repeat(118)+"┐"),console.log("│ SUMMARY STATISTICS"+" ".repeat(99)+"│"),console.log("├"+"─".repeat(118)+"┤"),console.log(`│ Total axis combinations evaluated: ${r.totalCombinations.toString().padEnd(80)} │`),console.log(`│ Combinations with issues: ${r.combinationsWithIssues.toString().padEnd(89)} │`),console.log(`│ Detected capabilities in SVG: ${r.detectedCapabilities.length.toString().padEnd(85)} │`),console.log("└"+"─".repeat(118)+"┘"),console.log(`
|
|
46
|
+
┌`+"─".repeat(118)+"┐"),console.log("│ DETECTED SVG CAPABILITIES"+" ".repeat(92)+"│"),console.log("├"+"─".repeat(118)+"┤");let Q0={};for(let o of j){let J0=s6[o]||{cat:"unknown",name:o};if(!Q0[J0.cat])Q0[J0.cat]=[];Q0[J0.cat].push({key:o,name:J0.name})}for(let[o,J0]of Object.entries(Q0)){let F0=o.toUpperCase();console.log(`│ ${F0}:`.padEnd(119)+"│");for(let O0 of J0){let R0=G[O0.key.split("_")[0]]||{},I0=` • ${O0.name}`;if(R0.count!==void 0)I0+=` (${R0.count})`;console.log(`│ ${I0}`.padEnd(119)+"│")}}if(console.log("└"+"─".repeat(118)+"┘"),K){console.log(`
|
|
47
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ FULL COMPATIBILITY MATRIX BY EMBEDDING METHOD"+" ".repeat(71)+"║"),console.log("╚"+"═".repeat(118)+"╝");let o={};for(let J0 of r.cells){let F0=J0.combination.syntaxId;if(!o[F0])o[F0]=[];o[F0].push(J0)}for(let[J0,F0]of Object.entries(o)){let O0=Object.values(I5).find((b)=>b.id===J0),R0=O0?O0.name:J0;console.log(`
|
|
48
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ SYNTAX: ${R0}`.padEnd(119)+"│"),console.log("├"+"─".repeat(30)+"┬"+"─".repeat(20)+"┬"+"─".repeat(25)+"┬"+"─".repeat(40)+"┤"),console.log("│ CONTEXT COMBINATION │ ISSUES │ BLOCKED CAPABILITIES │ BROWSER-SPECIFIC NOTES │"),console.log("├"+"─".repeat(30)+"┼"+"─".repeat(20)+"┼"+"─".repeat(25)+"┼"+"─".repeat(40)+"┤"),F0.sort((b,C)=>C.issueCount-b.issueCount);let I0=Z?F0:F0.slice(0,20);for(let b of I0){let C=`${(b.combination.displayId||"").substring(0,8)}/${b.combination.loadId}/${(b.combination.storageId||"").substring(0,8)}`,l=b.issueCount.toString(),g=b.issues.filter((j0)=>j0.status===L.BLOCKED).map((j0)=>(j0.name||"").substring(0,15)).slice(0,2).join(", "),n=b.issues.flatMap((j0)=>j0.browserIssues||[]).slice(0,2).map((j0)=>`${j0.browser}: ${j0.note?.substring(0,15)||""}`).join("; ");console.log(`│ ${C.padEnd(28)} │ ${l.padEnd(18)} │ ${(g||"-").substring(0,23).padEnd(23)} │ ${(n||"-").substring(0,38).padEnd(38)} │`)}if(!Z&&F0.length>20)console.log(`│ ... and ${F0.length-20} more combinations`.padEnd(119)+"│");console.log("└"+"─".repeat(30)+"┴"+"─".repeat(20)+"┴"+"─".repeat(25)+"┴"+"─".repeat(40)+"┘")}}console.log(`
|
|
49
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ DETAILED ISSUE BREAKDOWN BY CAPABILITY"+" ".repeat(78)+"║"),console.log("╚"+"═".repeat(118)+"╝");for(let o of j){let J0=s6[o]||{name:o,cat:"unknown"},F0=r9[o];if(console.log(`
|
|
50
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ ${J0.name} (${J0.cat})`.padEnd(119)+"│"),console.log("├"+"─".repeat(118)+"┤"),!F0)console.log("│ No compatibility data available".padEnd(119)+"│");else if(console.log(`│ Default status: ${F0.default}`.padEnd(119)+"│"),Object.keys(F0.exceptions||{}).length>0){console.log("│ Exceptions:".padEnd(119)+"│");for(let[O0,R0]of Object.entries(F0.exceptions)){let I0=` ${O0}: ${R0.status} - ${R0.note||"No details"}`;console.log(`│ ${I0.substring(0,116)}`.padEnd(119)+"│")}}console.log("└"+"─".repeat(118)+"┘")}if(H){console.log(`
|
|
51
51
|
╔`+"═".repeat(118)+"╗"),console.log("║ BROWSER-SPECIFIC COMPATIBILITY QUICK REFERENCE"+" ".repeat(70)+"║"),console.log("╚"+"═".repeat(118)+"╝"),console.log(`
|
|
52
|
-
┌`+"─".repeat(14)+"┬"+"─".repeat(103)+"┐"),console.log("│ BROWSER │ KNOWN LIMITATIONS FOR DETECTED CAPABILITIES"+" ".repeat(58)+"│"),console.log("├"+"─".repeat(14)+"┼"+"─".repeat(103)+"┤");let
|
|
53
|
-
╔`+"═".repeat(118)+"╗"),console.log("║ RECOMMENDATIONS FOR MAXIMUM COMPATIBILITY"+" ".repeat(75)+"║"),console.log("╚"+"═".repeat(118)+"╝");let
|
|
54
|
-
<!-- Isolated: --> <object data="app.svg"></object>`});if([...
|
|
55
|
-
┌`+"─".repeat(118)+"┐"),console.log(`│ ${
|
|
56
|
-
`).slice(0,3))console.log(`│ ${
|
|
57
|
-
╔`+"═".repeat(118)+"╗"),console.log("║ OVERALL COMPATIBILITY ASSESSMENT"+" ".repeat(84)+"║"),console.log("╚"+"═".repeat(118)+"╝");let
|
|
58
|
-
┌`+"─".repeat(25)+"┬"+"─".repeat(10)+"┬"+"─".repeat(81)+"┐"),console.log("│ EMBEDDING METHOD │ SCORE │ ISSUES"+" ".repeat(74)+"│"),console.log("├"+"─".repeat(25)+"┼"+"─".repeat(10)+"┼"+"─".repeat(81)+"┤");for(let[
|
|
59
|
-
⚠️ No embedding methods available for recommendation.`);else{let
|
|
60
|
-
★ RECOMMENDED: Use "${
|
|
52
|
+
┌`+"─".repeat(14)+"┬"+"─".repeat(103)+"┐"),console.log("│ BROWSER │ KNOWN LIMITATIONS FOR DETECTED CAPABILITIES"+" ".repeat(58)+"│"),console.log("├"+"─".repeat(14)+"┼"+"─".repeat(103)+"┤");let o={Chrome:["Full SMIL support","Autoplay policy","External use blocked"],Firefox:["Good SMIL support","Autoplay policy","External use blocked"],Safari:["Full SMIL support","Strict autoplay","WebKit-specific filters"],"Safari iOS":["Full SMIL","VERY strict autoplay","Touch events only"],Edge:["Same as Chrome (Blink)","Autoplay policy","External use blocked"],"IE 11":["NO SMIL","NO blend modes","Limited filters","NO foreignObject scripting"],"Android WebView":["Varies by version","Autoplay restrictions","Limited CSS animations"]};for(let[J0,F0]of Object.entries(o)){let O0=F0.filter((R0)=>{let I0=R0.toLowerCase();if(I0.includes("smil")&&[...j].some((b)=>b.startsWith("SMIL_")))return!0;if(I0.includes("autoplay")&&j.has("AUDIO_AUTOPLAY"))return!0;if(I0.includes("blend")&&j.has("RENDER_BLENDMODES"))return!0;if(I0.includes("filter")&&(j.has("FILTERS_BASIC")||j.has("FILTERS_COMPLEX")))return!0;if(I0.includes("foreign")&&[...j].some((b)=>b.startsWith("FOREIGNOBJECT_")))return!0;if(I0.includes("external use")&&(j.has("USE_EXTERNAL_SAME")||j.has("USE_EXTERNAL_CROSS")))return!0;return!1});if(O0.length>0){let R0=O0.slice(0,3).join(", ");console.log(`│ ${J0.padEnd(12)} │ ${R0.substring(0,101).padEnd(101)} │`)}}console.log("└"+"─".repeat(14)+"┴"+"─".repeat(103)+"┘")}console.log(`
|
|
53
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ RECOMMENDATIONS FOR MAXIMUM COMPATIBILITY"+" ".repeat(75)+"║"),console.log("╚"+"═".repeat(118)+"╝");let V0=[];if(j.has("AUDIO_AUTOPLAY")||j.has("AUDIO_EMBEDDED")||j.has("AUDIO_LOCAL")||j.has("AUDIO_REMOTE"))V0.push({feature:"Audio Playback",issue:"Browser autoplay policies block automatic audio",bestSyntax:"INLINE-SVG with JavaScript",workaround:"Extract audio data-URI, create Audio object, play on user click gesture",code:"document.querySelector('svg').addEventListener('click', () => new Audio(dataUri).play());"});if(j.has("SMIL_CLICK")||j.has("SMIL_HOVER")||j.has("SMIL_FOCUS")||j.has("SMIL_ACCESSKEY"))V0.push({feature:"Interactive SMIL Animation",issue:"Blocked in <img>, CSS backgrounds, and most renderers",bestSyntax:"<object>, <embed>, <iframe>, or inline <svg>",workaround:"Avoid <img> and CSS embedding for interactive SVGs",code:'<object data="animation.svg" type="image/svg+xml" width="800" height="600"></object>'});if(j.has("SCRIPT_INLINE")||j.has("SCRIPT_EXTERNAL"))V0.push({feature:"JavaScript Execution",issue:"Completely blocked in <img>, CSS contexts, email, most social platforms",bestSyntax:"Inline <svg> or <object>/<embed>/<iframe>",workaround:"For widest compatibility, convert JS interactions to SMIL or CSS",code:`<!-- Inline: --> <div><svg>...</svg></div>
|
|
54
|
+
<!-- Isolated: --> <object data="app.svg"></object>`});if([...j].some((o)=>o.startsWith("FOREIGNOBJECT_")))V0.push({feature:"foreignObject / HTML Content",issue:"Completely ignored in <img>, CSS contexts, most renderers (Cairo, ImageMagick)",bestSyntax:"Inline <svg> or <object>/<embed>",workaround:"For rasterization, use browser screenshot or Puppeteer instead of ImageMagick",code:'<object data="with-html.svg" type="image/svg+xml"></object>'});if(j.has("IMAGES_REMOTE_CROSS")||j.has("FONTS_WEB_CROSS")||j.has("USE_EXTERNAL_CROSS")||j.has("AUDIO_REMOTE"))V0.push({feature:"Cross-Origin Resources",issue:"Blocked without CORS headers, completely blocked in <img> context",bestSyntax:"Any syntax with proper CORS, or embed resources as data-URIs",workaround:"Use embedExternalDependencies() to inline all external resources",code:"await embedExternalDependencies(doc, { embedImages: true, embedFonts: true, embedAudio: true });"});for(let o of V0){console.log(`
|
|
55
|
+
┌`+"─".repeat(118)+"┐"),console.log(`│ ${o.feature}`.padEnd(119)+"│"),console.log("├"+"─".repeat(118)+"┤"),console.log(`│ Issue: ${o.issue}`.substring(0,119).padEnd(119)+"│"),console.log(`│ Best syntax: ${o.bestSyntax}`.substring(0,119).padEnd(119)+"│"),console.log(`│ Workaround: ${o.workaround}`.substring(0,119).padEnd(119)+"│"),console.log("│ Code:".padEnd(119)+"│");for(let J0 of(o.code||"").split(`
|
|
56
|
+
`).slice(0,3))console.log(`│ ${J0}`.substring(0,119).padEnd(119)+"│");console.log("└"+"─".repeat(118)+"┘")}console.log(`
|
|
57
|
+
╔`+"═".repeat(118)+"╗"),console.log("║ OVERALL COMPATIBILITY ASSESSMENT"+" ".repeat(84)+"║"),console.log("╚"+"═".repeat(118)+"╝");let N0={};for(let o of t){let J0=100,F0=[];for(let O0 of j){let R0=s6[O0]||{name:O0,critical:!1},I0=r9[O0];if(I0){for(let[b,C]of Object.entries(I0.exceptions||{}))if(b.startsWith("syntax:")){let l=b.substring(7);if(l===o.id||l==="*"||l.includes("*")&&o.id.startsWith(l.replace("*",""))){let g=R0.critical?30:10;J0-=g,F0.push({cap:R0.name,penalty:g,status:C.status})}}}}N0[o.id]={name:o.name,score:Math.max(0,J0),deductions:F0}}let h0=Object.entries(N0).sort((o,J0)=>J0[1].score-o[1].score);console.log(`
|
|
58
|
+
┌`+"─".repeat(25)+"┬"+"─".repeat(10)+"┬"+"─".repeat(81)+"┐"),console.log("│ EMBEDDING METHOD │ SCORE │ ISSUES"+" ".repeat(74)+"│"),console.log("├"+"─".repeat(25)+"┼"+"─".repeat(10)+"┼"+"─".repeat(81)+"┤");for(let[o,J0]of h0){let F0=J0.score===100?"100% ✅":J0.score>=70?`${J0.score}% ⚠️`:`${J0.score}% ❌`,O0=J0.deductions.slice(0,3).map((R0)=>R0.cap).join(", ")||"None";console.log(`│ ${J0.name.padEnd(23)} │ ${F0.padEnd(8)} │ ${O0.substring(0,79).padEnd(79)} │`)}if(console.log("└"+"─".repeat(25)+"┴"+"─".repeat(10)+"┴"+"─".repeat(81)+"┘"),h0.length===0)console.log(`
|
|
59
|
+
⚠️ No embedding methods available for recommendation.`);else{let o=h0[0];if(console.log(`
|
|
60
|
+
★ RECOMMENDED: Use "${o[1].name}" for this SVG (score: ${o[1].score}%)`),o[1].score<100)console.log(`
|
|
61
61
|
⚠️ No embedding method achieves 100% compatibility for this SVG.`),console.log(" Consider using embedExternalDependencies() to maximize portability.")}return console.log(`
|
|
62
62
|
`+"═".repeat(120)+`
|
|
63
|
-
`)
|
|
64
|
-
`),console.log("╔"+"═".repeat(160)+"╗"),console.log("║"+" HIERARCHICAL SVG COMPATIBILITY MATRIX - DETAILED ".padStart(105).padEnd(160)+"║"),console.log("║"+` ${
|
|
65
|
-
`);let
|
|
66
|
-
┌`+"─".repeat(120)+"┐"),console.log("│ LEGEND - HOW TO READ CELL CONTENT"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(120)+"┤"),console.log("│ Each cell shows 2 lines:"+" ".repeat(95)+"│"),console.log("│ Line 1: Browser status (C=Chrome F=Firefox S=Safari E=Edge I=IE11 i=iOS A=Android)"+" ".repeat(34)+"│"),console.log("│ Line 2: Functionality issues (codes below)"+" ".repeat(74)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ Status symbols: ✓ = works ⚠ = warning/partial ✗ = blocked/broken"+" ".repeat(49)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ ✅ ALL OK = No issues in this combination"+" ".repeat(78)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ FUNCTIONALITY CODES:"+" ".repeat(99)+"│");let
|
|
67
|
-
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 2: INTERNAL SVG RESOURCES COMPATIBILITY ".padStart(84).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let
|
|
68
|
-
┌`+"─".repeat(30)+"┬"+"─".repeat(
|
|
69
|
-
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 3: BROWSER-SPECIFIC ISSUES FOR DETECTED CAPABILITIES ".padStart(90).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let
|
|
70
|
-
┌`+"─".repeat(20)+"┬"+"─".repeat(99)+"┐"),console.log("│ CAPABILITY"+" ".repeat(9)+"│ BROWSER ISSUES"+" ".repeat(84)+"│"),console.log("├"+"─".repeat(20)+"┼"+"─".repeat(99)+"┤");let
|
|
63
|
+
`),$._fullCompatibilityMatrix=r,$});function gz($,J={}){let Z=J.compact!==!1,K=J.showAllCells||!1,Q=[{id:"direct",label:"DIRECT",desc:"SVG file"},{id:"img",label:"IMG",desc:"<img>"},{id:"object",label:"OBJECT",desc:"<object>"},{id:"embed",label:"EMBED",desc:"<embed>"},{id:"inline",label:"INLINE",desc:"<svg>"},{id:"css",label:"CSS",desc:"bg-image"}],H=[{id:"embedded",label:"EMB",desc:"data-uri/inline"},{id:"local",label:"LOC",desc:"local path"},{id:"remote",label:"REM",desc:"http(s) URL"}],z=[{id:"browser",label:"BROWSER",desc:"Desktop browsers"},{id:"mobile",label:"MOBILE",desc:"Mobile WebView"},{id:"renderer",label:"RENDER",desc:"Server-side"}],q=[{id:"file",label:"file://",desc:"Local filesystem"},{id:"http",label:"http(s)://",desc:"Web server"},{id:"data",label:"data:",desc:"Data URI"}],W=[{id:"script",label:"+JS",desc:"With JavaScript"},{id:"noscript",label:"-JS",desc:"No JavaScript"}],j=[{id:"chrome",code:"C",name:"Chrome"},{id:"firefox",code:"F",name:"Firefox"},{id:"safari",code:"S",name:"Safari"},{id:"edge",code:"E",name:"Edge"},{id:"ie11",code:"I",name:"IE11"},{id:"ios",code:"i",name:"iOS Safari"},{id:"android",code:"A",name:"Android"}],G={display:{icon:"D",emoji:"\uD83D\uDCD0",name:"Basic rendering"},animation:{icon:"A",emoji:"\uD83C\uDFAC",name:"SMIL/CSS animation"},scripting:{icon:"J",emoji:"\uD83D\uDCDC",name:"JavaScript"},events:{icon:"E",emoji:"\uD83D\uDDB1️",name:"Event handlers"},media:{icon:"M",emoji:"\uD83D\uDD0A",name:"Audio/Video"},html:{icon:"H",emoji:"\uD83D\uDCC4",name:"foreignObject"},images:{icon:"I",emoji:"\uD83D\uDDBC️",name:"External images"},fonts:{icon:"T",emoji:"\uD83D\uDD24",name:"External fonts"},sprites:{icon:"U",emoji:"\uD83C\uDFAF",name:"use elements"},links:{icon:"L",emoji:"\uD83D\uDD17",name:"Hyperlinks"}},F=Q.length*H.length,_=z.length*q.length*W.length,U=Z?18:28,O=25,V=Z?2:3;console.log(`
|
|
64
|
+
`),console.log("╔"+"═".repeat(160)+"╗"),console.log("║"+" HIERARCHICAL SVG COMPATIBILITY MATRIX - DETAILED ".padStart(105).padEnd(160)+"║"),console.log("║"+` ${F} columns × ${_} rows = ${F*_} cells `.padStart(105).padEnd(160)+"║"),console.log("║"+" Each cell shows: [Browser status] / [Functionality issues] ".padStart(105).padEnd(160)+"║"),console.log("╚"+"═".repeat(160)+"╝"),console.log(`
|
|
65
|
+
`);let M=H.length*U,Y=26+Q.length*(M+1),X="".padEnd(25)+"│";for(let N of Q){let y=`${N.label} (${N.desc})`;X+=y.padStart(Math.floor(M/2)+Math.floor(y.length/2)).padEnd(M)+"│"}console.log("┌"+"─".repeat(25)+"┬"+Q.map(()=>"─".repeat(M)).join("┬")+"┐"),console.log("│"+"SYNTAX →".padEnd(25)+X.substring(26));let w="".padEnd(25)+"│";for(let N of Q){for(let y of H){let B=`${y.label}`;w+=B.padStart(Math.floor(U/2)+Math.floor(B.length/2)).padEnd(U)}w+="│"}console.log("│"+"STORAGE →".padEnd(25)+w.substring(26));let R="".padEnd(25)+"│";for(let N of Q){for(let y of H)R+="Brws|Func".padStart(Math.floor(U/2)+5).padEnd(U);R+="│"}console.log("│"+"".padEnd(25)+R.substring(26)),console.log("├"+"─".repeat(25)+"┼"+Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┼")+"┤");let I=(N,y,B,e,r)=>{let s={browserStatus:{},funcStatus:{},overallStatus:"ok",issueCount:0,browserCount:0};for(let t of j){s.browserStatus[t.id]={};for(let[$0]of Object.entries(G))s.browserStatus[t.id][$0]="ok"}for(let[t]of Object.entries(G))s.funcStatus[t]="ok";if(e==="img"||e==="css"){let t=["animation","scripting","events","html","media","links"];for(let $0 of t){s.funcStatus[$0]="block";for(let Q0 of j)s.browserStatus[Q0.id][$0]="block"}if(B==="remote"){s.funcStatus.images="block",s.funcStatus.fonts="block";for(let $0 of j)s.browserStatus[$0.id].images="block",s.browserStatus[$0.id].fonts="block"}}if(N==="renderer"){let t=["animation","scripting","events","media"];for(let $0 of t){s.funcStatus[$0]="block";for(let Q0 of j)s.browserStatus[Q0.id][$0]="block"}s.funcStatus.html="block";for(let $0 of j)s.browserStatus[$0.id].html="block"}if(r==="noscript"){s.funcStatus.scripting="block",s.funcStatus.events="warn";for(let t of j)s.browserStatus[t.id].scripting="block",s.browserStatus[t.id].events="warn"}if(s.browserStatus.ie11.animation="block",s.browserStatus.ie11.html="block",s.browserStatus.ie11.sprites="warn",$.detectedCapabilities?.some((t)=>t.startsWith("AUDIO_")||t.startsWith("VIDEO_"))){for(let t of j)if(s.browserStatus[t.id].media!=="block")s.browserStatus[t.id].media="warn";s.browserStatus.ios.media="block",s.funcStatus.media="warn"}if(B==="remote"){s.funcStatus.images=s.funcStatus.images==="block"?"block":"warn",s.funcStatus.fonts=s.funcStatus.fonts==="block"?"block":"warn",s.funcStatus.sprites=s.funcStatus.sprites==="block"?"block":"warn";for(let t of j){if(s.browserStatus[t.id].images!=="block")s.browserStatus[t.id].images="warn";if(s.browserStatus[t.id].fonts!=="block")s.browserStatus[t.id].fonts="warn"}}if(y==="file"){if(B==="remote")s.funcStatus.images="warn",s.funcStatus.fonts="warn",s.funcStatus.links="warn"}if(y==="data"){if(B==="remote"||B==="local")s.funcStatus.images="warn",s.funcStatus.fonts="warn"}let z0=!1,T=!1,P=new Set;for(let[t,$0]of Object.entries(s.funcStatus))if($0==="block")z0=!0,s.issueCount++;else if($0==="warn")T=!0,s.issueCount++;for(let t of j)for(let[$0,Q0]of Object.entries(s.browserStatus[t.id]))if(Q0!=="ok")P.add(t.id);return s.browserCount=P.size,s.overallStatus=z0?"block":T?"warn":"ok",s},f=(N,y)=>{let B=[],e={ok:"✓",warn:"⚠",block:"✗"};if(N.overallStatus==="ok")return B.push("✅ ALL OK".padStart(Math.floor(y/2)+5).padEnd(y)),B.push("".padEnd(y)),B;let r="";for(let z0 of j){let T="ok";for(let[P,t]of Object.entries(N.browserStatus[z0.id]))if(t==="block"){T="block";break}else if(t==="warn"&&T!=="block")T="warn";r+=`${z0.code}${e[T]}`}B.push(r.padStart(Math.floor(y/2)+Math.floor(r.length/2)).padEnd(y));let s="";for(let[z0,T]of Object.entries(G)){let P=N.funcStatus[z0];if(P!=="ok")s+=`${T.icon}${e[P]}`}if(s==="")s="(ok)";return B.push(s.padStart(Math.floor(y/2)+Math.floor(s.length/2)).padEnd(y)),B},u=(N,y)=>{let B={ok:"✓",warn:"⚠",block:"✗"};if(N.overallStatus==="ok")return"✅".padStart(Math.floor(y/2)+1).padEnd(y);let e=N.overallStatus==="block"?"❌":"⚠️",r=`${N.browserCount}B`,s=`${N.issueCount}F`,z0=`${e}${r}${s}`;return z0.padStart(Math.floor(y/2)+Math.floor(z0.length/2)).padEnd(y)};for(let N of z){let y=Q.map(()=>H.map(()=>" ".repeat(U)).join(" ")).join("│");console.log("│ "+(N.label+":").padEnd(23)+"│"+y+"│");for(let B of q){for(let e of W){let r=[];for(let $0 of Q)for(let Q0 of H){let V0=I(N.id,B.id,Q0.id,$0.id,e.id);r.push(V0)}let s=r.map(($0)=>f($0,U)),T="│"+` ${B.label} ${e.label}`.padEnd(25)+"│",P=0;for(let $0=0;$0<Q.length;$0++){for(let Q0=0;Q0<H.length;Q0++)T+=s[P][0],P++;T+="│"}console.log(T.substring(0,T.length-1));let t="│"+"".padEnd(25)+"│";P=0;for(let $0=0;$0<Q.length;$0++){for(let Q0=0;Q0<H.length;Q0++)t+=s[P][1],P++;t+="│"}if(console.log(t.substring(0,t.length-1)),e!==W[W.length-1]){let $0=Q.map(()=>H.map(()=>"·".repeat(U)).join("·")).join("│");console.log("│"+"·".repeat(25)+"│"+$0+"│")}}if(B!==q[q.length-1]){let e=Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┼");console.log("├"+"─".repeat(25)+"┼"+e+"┤")}}if(N!==z[z.length-1]){let B=Q.map(()=>H.map(()=>"═".repeat(U)).join("═")).join("╪");console.log("╞"+"═".repeat(25)+"╪"+B+"╡")}}console.log("└"+"─".repeat(25)+"┴"+Q.map(()=>H.map(()=>"─".repeat(U)).join("─")).join("┴")+"┘"),console.log(`
|
|
66
|
+
┌`+"─".repeat(120)+"┐"),console.log("│ LEGEND - HOW TO READ CELL CONTENT"+" ".repeat(85)+"│"),console.log("├"+"─".repeat(120)+"┤"),console.log("│ Each cell shows 2 lines:"+" ".repeat(95)+"│"),console.log("│ Line 1: Browser status (C=Chrome F=Firefox S=Safari E=Edge I=IE11 i=iOS A=Android)"+" ".repeat(34)+"│"),console.log("│ Line 2: Functionality issues (codes below)"+" ".repeat(74)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ Status symbols: ✓ = works ⚠ = warning/partial ✗ = blocked/broken"+" ".repeat(49)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ ✅ ALL OK = No issues in this combination"+" ".repeat(78)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ FUNCTIONALITY CODES:"+" ".repeat(99)+"│");let m="│ ";for(let[N,y]of Object.entries(G))m+=`${y.icon}=${N} `;console.log(m.padEnd(121)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ FULL FUNCTIONALITY NAMES:"+" ".repeat(94)+"│");let S="│ ";for(let[N,y]of Object.entries(G))S+=`${y.icon}=${y.name} `;if(S.length>120)console.log(S.substring(0,121)+"│"),S="│ "+S.substring(121);console.log(S.padEnd(121)+"│"),console.log("│"+" ".repeat(120)+"│"),console.log("│ EXAMPLES:"+" ".repeat(110)+"│"),console.log('│ "C✓F✓S✓E⚠I✗i✗A✓" = Chrome/Firefox/Safari/Android OK, Edge warning, IE11/iOS blocked'+" ".repeat(30)+"│"),console.log('│ "A✗J✗M⚠H✗" = Animation blocked, Scripting blocked, Media warning, HTML blocked'+" ".repeat(37)+"│"),console.log("└"+"─".repeat(120)+"┘"),console.log(`
|
|
67
|
+
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 2: INTERNAL SVG RESOURCES COMPATIBILITY ".padStart(84).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let x=[{id:"images_embedded",label:"Embedded Images (data-uri)",icon:"\uD83D\uDDBC️"},{id:"images_local",label:"Local Images (path)",icon:"\uD83D\uDCC1"},{id:"images_remote",label:"Remote Images (URL)",icon:"\uD83C\uDF10"},{id:"fonts_embedded",label:"Embedded Fonts (data-uri)",icon:"\uD83D\uDD24"},{id:"fonts_local",label:"Local Fonts (path)",icon:"\uD83D\uDCC1"},{id:"fonts_remote",label:"Remote Fonts (URL)",icon:"\uD83C\uDF10"},{id:"css_inline",label:"Inline <style>",icon:"\uD83C\uDFA8"},{id:"css_external",label:"External CSS",icon:"\uD83D\uDCC4"},{id:"scripts_inline",label:"Inline <script>",icon:"\uD83D\uDCDC"},{id:"scripts_external",label:"External Scripts",icon:"\uD83D\uDCE6"},{id:"audio_embedded",label:"Embedded Audio",icon:"\uD83D\uDD0A"},{id:"audio_external",label:"External Audio",icon:"\uD83C\uDFB5"}],h=14,E="".padEnd(30)+"│";for(let N of Q)E+=N.label.padStart(h-1).padEnd(h);E+="│",console.log(`
|
|
68
|
+
┌`+"─".repeat(30)+"┬"+"─".repeat(Q.length*h)+"┐"),console.log("│"+"RESOURCE TYPE".padEnd(30)+E.substring(31)),console.log("├"+"─".repeat(30)+"┼"+"─".repeat(Q.length*h)+"┤");let d=(N,y)=>{if(y==="img"||y==="css"){if(N.includes("external")||N.includes("remote")||N.includes("scripts")||N.includes("audio"))return"❌";if(N.includes("local")&&!N.includes("embedded"))return"⚠️"}if(y==="object"||y==="embed"){if(N.includes("remote")&&!N.includes("embedded"))return"⚠️"}if(N.includes("embedded")||N.includes("inline"))return"✅";if(N.includes("local"))return"⚠️";if(N.includes("remote")||N.includes("external"))return"⚠️";return"✅"};for(let N of x){let y=`│ ${N.icon} ${N.label}`.padEnd(31)+"│";for(let B of Q){let e=d(N.id,B.id);y+=e.padStart(h-1).padEnd(h)}y+="│",console.log(y)}console.log("└"+"─".repeat(30)+"┴"+"─".repeat(Q.length*h)+"┘"),console.log(`
|
|
69
|
+
`),console.log("╔"+"═".repeat(120)+"╗"),console.log("║"+" TABLE 3: BROWSER-SPECIFIC ISSUES FOR DETECTED CAPABILITIES ".padStart(90).padEnd(120)+"║"),console.log("╚"+"═".repeat(120)+"╝");let c={};for(let N of $.detectedCapabilities||[]){let y={RENDER_:"display",FONTS_:"fonts",IMAGES_:"images",FILTERS_:"effects",MASKS:"effects",CLIP_:"effects",SMIL_:"animation",CSS_:"animation",SCRIPT_:"scripting",EVENT_:"events",LINK_:"links",FOREIGNOBJECT_:"html",AUDIO_:"media",VIDEO_:"media",USE_:"sprites",A11Y_:"accessibility",META_:"metadata"};for(let[B,e]of Object.entries(y))if(N.startsWith(B)||N===B.replace("_","")){if(!c[e])c[e]=[];c[e].push(N);break}}console.log(`
|
|
70
|
+
┌`+"─".repeat(20)+"┬"+"─".repeat(99)+"┐"),console.log("│ CAPABILITY"+" ".repeat(9)+"│ BROWSER ISSUES"+" ".repeat(84)+"│"),console.log("├"+"─".repeat(20)+"┼"+"─".repeat(99)+"┤");let p={animation:{Chrome:"Full SMIL support",IE11:"NO SMIL SUPPORT",Safari:"Full support"},media:{ALL:"Autoplay blocked - needs user gesture",iOS:"VERY strict autoplay policy"},html:{IE11:"No scripting in foreignObject",Cairo:"Not rendered",ImageMagick:"Not rendered"},scripting:{IE11:"Limited ES6 support"},effects:{IE11:"Limited filter support, no blend modes"}};for(let[N,y]of Object.entries(c)){let B=p[N]||{},e=Object.entries(B).map(([r,s])=>`${r}: ${s}`).join("; ")||"No known issues";console.log(`│ ${N.toUpperCase().padEnd(18)} │ ${e.substring(0,97).padEnd(97)} │`)}return console.log("└"+"─".repeat(20)+"┴"+"─".repeat(99)+"┘"),console.log(`
|
|
71
71
|
`+"═".repeat(140)+`
|
|
72
|
-
`)
|
|
73
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
74
|
-
viewBox="0 0 ${D} ${S}" preserveAspectRatio="xMinYMin meet" height="${S}" width="100%">
|
|
72
|
+
`),$}function xz($,J={}){let Z=J.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",K=(e)=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Q=[{id:"standalone",name:"Standalone SVG",desc:"Open .svg directly",color:"#1565C0",parent:null},{id:"img",name:"<img>",desc:"Image element",color:"#1976D2",parent:"html"},{id:"object",name:"<object>",desc:"Object element",color:"#1E88E5",parent:"html"},{id:"embed",name:"<embed>",desc:"Embed element",color:"#2196F3",parent:"html"},{id:"inline",name:"Inline <svg>",desc:"SVG in HTML",color:"#42A5F5",parent:"html"},{id:"css",name:"CSS background",desc:"background-image",color:"#64B5F6",parent:"html"}],H=[{id:"desktop",name:"Desktop Browser",color:"#E3F2FD",type:"desktop"},{id:"mobile",name:"Mobile Browser",color:"#E8F5E9",type:"mobile"}],z=[{id:"nodejs",name:"Node.js (JSDOM)",color:"#FFF3E0",issues:["No rendering","No animations","No interaction"]},{id:"imagemagick",name:"ImageMagick",color:"#EFEBE9",issues:["No animations","No scripts","No foreignObject","No web fonts"]},{id:"inkscape",name:"Inkscape CLI",color:"#F3E5F5",issues:["No animations","No scripts"]},{id:"librsvg",name:"librsvg",color:"#E0F2F1",issues:["No animations","No scripts","Limited filters"]},{id:"cairo",name:"Cairo",color:"#FBE9E7",issues:["No animations","No scripts","No filters","No foreignObject"]},{id:"batik",name:"Apache Batik",color:"#F3E5F5",issues:["No CSS animations","Limited SMIL","No web fonts"]}],q=[{id:"file",name:"file://",color:"#BBDEFB"},{id:"http",name:"http(s)://",color:"#C8E6C9"}],W=[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}],j=(e,r,s,z0)=>{let T=[],P=(t)=>T.push({text:t});if(z0==="img"||z0==="css")return P("No scripts"),P("No events"),P("No audio/video"),P("No links"),P("No foreignObject"),P("No external resources"),T;if(s==="nojs")P("No scripts"),P("No event handlers");if(r==="file")P("No remote fonts (Chrome, Safari)"),P("No remote images (Chrome)"),P("No fetch/XHR to remote URLs");if(z0==="object"||z0==="embed"){if(P("No event bubbling to parent"),r==="http")P("No cross-origin script access")}if(e==="desktop"){if(P("No SMIL (IE11 only)"),P("No CSS variables (IE11 only)"),s==="js")P("Audio: blocked until user click/tap event"),P("Audio: once blocked, won't auto-retry")}if(e==="mobile")P("No hover/mouseover events"),P("Audio: blocked until user tap event"),P("Audio: once blocked, won't auto-retry"),P("Video autoplay blocked");return T},G=0;for(let e of H)for(let r of q)for(let s of W)for(let z0 of Q){let T=j(e.id,r.id,s.id,z0.id).length;if(T>G)G=T}let F=130,_=80,U=90,O=F+_+U,V=60,M=220,Y=13,X=Math.max(80,(G+1)*Y+25),w=Q.length,R=H.length*q.length*W.length,I=O+w*M,u=V+R*X+40,m=30,S=40+z.length*m,x=u+S+30,h=1020,E=I+50,d=55+x+h+50,c=`<?xml version="1.0" encoding="UTF-8"?>
|
|
73
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${E} ${d}" preserveAspectRatio="xMinYMin meet" height="${d}" width="100%">
|
|
75
74
|
<title>SVG Compatibility Matrix</title>
|
|
76
|
-
<desc>Browser and functionality compatibility for different SVG embedding methods</desc>
|
|
77
75
|
|
|
78
76
|
<defs>
|
|
79
77
|
<style>
|
|
80
|
-
.title { font: bold
|
|
81
|
-
.subtitle { font: 12px ${
|
|
82
|
-
.col-header { font: bold
|
|
83
|
-
.col-
|
|
84
|
-
.row-
|
|
85
|
-
.row-
|
|
86
|
-
.cell-text { font: 8px ${o}; fill: #333; }
|
|
87
|
-
.cell-ok { fill: #E8F5E9; }
|
|
88
|
-
.cell-warn { fill: #FFF3E0; }
|
|
89
|
-
.cell-block { fill: #FFEBEE; }
|
|
90
|
-
.legend-text { font: 10px ${o}; fill: #333; }
|
|
91
|
-
.grid-line { stroke: #DDD; stroke-width: 1; }
|
|
92
|
-
.grid-line-bold { stroke: #999; stroke-width: 2; }
|
|
93
|
-
${n?`
|
|
94
|
-
.cell-group:hover rect { stroke: #333; stroke-width: 2; }
|
|
95
|
-
.tooltip { pointer-events: none; opacity: 0; transition: opacity 0.2s; }
|
|
96
|
-
.cell-group:hover .tooltip { opacity: 1; }
|
|
97
|
-
`:""}
|
|
98
|
-
</style>
|
|
99
|
-
</defs>
|
|
100
|
-
|
|
101
|
-
<!-- Title -->
|
|
102
|
-
<text x="${D/2}" y="25" text-anchor="middle" class="title">SVG Compatibility Matrix</text>
|
|
103
|
-
<text x="${D/2}" y="42" text-anchor="middle" class="subtitle">
|
|
104
|
-
${s} columns × ${x} rows = ${s*x} combinations
|
|
105
|
-
</text>
|
|
106
|
-
|
|
107
|
-
<g transform="translate(20, 55)">
|
|
108
|
-
`,X=140;for(let u of i){let O=l.length*r;f+=` <rect x="${X}" y="0" width="${O}" height="25" fill="#E3F2FD" stroke="#90CAF9"/>
|
|
109
|
-
<text x="${X+O/2}" y="17" text-anchor="middle" class="col-header">${u.label}</text>
|
|
110
|
-
`;for(let Y=0;Y<l.length;Y++){let j=l[Y],_=X+Y*r;f+=` <rect x="${_}" y="25" width="${r}" height="20" fill="#F5F5F5" stroke="#DDD"/>
|
|
111
|
-
<text x="${_+r/2}" y="39" text-anchor="middle" class="col-subheader">${j.label}</text>
|
|
112
|
-
`}X+=O}let B=45;for(let u of d){let O=p.length*g.length*e;f+=` <rect x="0" y="${B}" width="50" height="${O}" fill="#E8EAF6" stroke="#9FA8DA"/>
|
|
113
|
-
<text x="25" y="${B+O/2}" text-anchor="middle" dominant-baseline="middle" class="row-header" transform="rotate(-90, 25, ${B+O/2})">${u.label}</text>
|
|
114
|
-
`;for(let Y of p)for(let j of g){f+=` <rect x="50" y="${B}" width="90" height="${e}" fill="#FAFAFA" stroke="#EEE"/>
|
|
115
|
-
<text x="55" y="${B+e/2-6}" class="row-subheader">${Y.label}</text>
|
|
116
|
-
<text x="55" y="${B+e/2+8}" class="row-subheader">${j.label}</text>
|
|
117
|
-
`,X=140;for(let _ of i)for(let A of l){let W=T(u.id,Y.id,A.id,_.id,j.id),C=`cell-${W.overallStatus}`,z="";for(let K of c){let $="ok";for(let F of m){let a3=W.browserStatus[K.id][F.id];if(a3==="block"){$="block";break}else if(a3==="warn"&&$!=="block")$="warn"}let w=$==="ok"?"✓":$==="warn"?"⚠":"✗";z+=`${K.code}${w}`}let o3="";for(let K of m){let $=W.funcStatus[K.id];if($!=="ok")o3+=`${K.code}${$==="warn"?"⚠":"✗"}`}if(!o3)o3="OK";if(f+=` <g class="cell-group">
|
|
118
|
-
<rect x="${X}" y="${B}" width="${r}" height="${e}" class="${C}" stroke="#DDD"/>
|
|
119
|
-
<text x="${X+r/2}" y="${B+15}" text-anchor="middle" class="cell-text">${z.substring(0,10)}</text>
|
|
120
|
-
<text x="${X+r/2}" y="${B+28}" text-anchor="middle" class="cell-text">${z.substring(10)}</text>
|
|
121
|
-
<text x="${X+r/2}" y="${B+40}" text-anchor="middle" class="cell-text" fill="${P[W.overallStatus]}">${o3.substring(0,8)}</text>
|
|
122
|
-
`,n)f+=` <g class="tooltip" transform="translate(${X+r/2}, ${B-5})">
|
|
123
|
-
<rect x="-60" y="-45" width="120" height="40" fill="#333" rx="4"/>
|
|
124
|
-
<text x="0" y="-30" text-anchor="middle" fill="#FFF" font-size="9">${_.label}/${A.label}</text>
|
|
125
|
-
<text x="0" y="-17" text-anchor="middle" fill="#FFF" font-size="8">${u.label} ${Y.label} ${j.label}</text>
|
|
126
|
-
</g>
|
|
127
|
-
`;f+=` </g>
|
|
128
|
-
`,X+=r}B+=e}}let L=80+x*e+20;f+=`
|
|
129
|
-
<!-- Legend -->
|
|
130
|
-
<g transform="translate(0, ${L})">
|
|
131
|
-
<text x="10" y="15" class="col-header">LEGEND</text>
|
|
132
|
-
|
|
133
|
-
<!-- Status colors -->
|
|
134
|
-
<rect x="10" y="25" width="20" height="15" class="cell-ok" stroke="#4CAF50"/>
|
|
135
|
-
<text x="35" y="37" class="legend-text">OK - All features work</text>
|
|
136
|
-
|
|
137
|
-
<rect x="160" y="25" width="20" height="15" class="cell-warn" stroke="#FF9800"/>
|
|
138
|
-
<text x="185" y="37" class="legend-text">Warning - Partial support</text>
|
|
139
|
-
|
|
140
|
-
<rect x="340" y="25" width="20" height="15" class="cell-block" stroke="#F44336"/>
|
|
141
|
-
<text x="365" y="37" class="legend-text">Blocked - Not supported</text>
|
|
142
|
-
|
|
143
|
-
<!-- Browser codes -->
|
|
144
|
-
<text x="10" y="60" class="col-header">BROWSERS:</text>
|
|
145
|
-
`;let R=90;for(let u of c)f+=` <text x="${R}" y="60" class="legend-text"><tspan fill="${u.color}" font-weight="bold">${u.code}</tspan>=${u.name}</text>
|
|
146
|
-
`,R+=85;f+=`
|
|
147
|
-
<!-- Functionality codes -->
|
|
148
|
-
<text x="10" y="80" class="col-header">FUNCTIONS:</text>
|
|
149
|
-
`,R=90;let N=0;for(let u of m){if(R>600)R=90,N++;f+=` <text x="${R}" y="${80+N*18}" class="legend-text"><tspan fill="${u.color}" font-weight="bold">${u.code}</tspan>=${u.name}</text>
|
|
150
|
-
`,R+=100}return f+=` </g>
|
|
151
|
-
</g>
|
|
152
|
-
</svg>`,f}function Dn(t,a={}){let r=a.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e=(C)=>String(C).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),o=[{id:"standalone",name:"Standalone SVG",desc:"Open .svg directly",color:"#1565C0",parent:null},{id:"img",name:"<img>",desc:"Image element",color:"#1976D2",parent:"html"},{id:"object",name:"<object>",desc:"Object element",color:"#1E88E5",parent:"html"},{id:"embed",name:"<embed>",desc:"Embed element",color:"#2196F3",parent:"html"},{id:"inline",name:"Inline <svg>",desc:"SVG in HTML",color:"#42A5F5",parent:"html"},{id:"css",name:"CSS background",desc:"background-image",color:"#64B5F6",parent:"html"}],n=[{id:"desktop",name:"Desktop Browser",color:"#E3F2FD",type:"desktop"},{id:"mobile",name:"Mobile Browser",color:"#E8F5E9",type:"mobile"}],i=[{id:"nodejs",name:"Node.js (JSDOM)",color:"#FFF3E0",issues:["No rendering","No animations","No interaction"]},{id:"imagemagick",name:"ImageMagick",color:"#EFEBE9",issues:["No animations","No scripts","No foreignObject","No web fonts"]},{id:"inkscape",name:"Inkscape CLI",color:"#F3E5F5",issues:["No animations","No scripts"]},{id:"librsvg",name:"librsvg",color:"#E0F2F1",issues:["No animations","No scripts","Limited filters"]},{id:"cairo",name:"Cairo",color:"#FBE9E7",issues:["No animations","No scripts","No filters","No foreignObject"]},{id:"batik",name:"Apache Batik",color:"#F3E5F5",issues:["No CSS animations","Limited SMIL","No web fonts"]}],l=[{id:"file",name:"file://",color:"#BBDEFB"},{id:"http",name:"http(s)://",color:"#C8E6C9"}],d=[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}],p=(C,z,o3,K)=>{let $=[],w=(F)=>$.push({text:F});if(K==="img"||K==="css")return w("No scripts"),w("No events"),w("No audio/video"),w("No links"),w("No foreignObject"),w("No external resources"),$;if(o3==="nojs")w("No scripts"),w("No event handlers");if(z==="file")w("No remote fonts (Chrome, Safari)"),w("No remote images (Chrome)"),w("No fetch/XHR to remote URLs");if(K==="object"||K==="embed"){if(w("No event bubbling to parent"),z==="http")w("No cross-origin script access")}if(C==="desktop"){if(w("No SMIL (IE11 only)"),w("No CSS variables (IE11 only)"),o3==="js")w("Audio: blocked until user click/tap event"),w("Audio: once blocked, won't auto-retry")}if(C==="mobile")w("No hover/mouseover events"),w("Audio: blocked until user tap event"),w("Audio: once blocked, won't auto-retry"),w("Video autoplay blocked");return $},g=0;for(let C of n)for(let z of l)for(let o3 of d)for(let K of o){let $=p(C.id,z.id,o3.id,K.id).length;if($>g)g=$}let c=130,m=80,y=90,h=c+m+y,s=60,x=220,D=13,S=Math.max(80,(g+1)*D+25),P=o.length,T=n.length*l.length*d.length,f=h+P*x,X=s+T*S+40,B=30,L=40+i.length*B,R=X+L+30,N=1020,u=f+50,O=55+R+N+50,Y=`<?xml version="1.0" encoding="UTF-8"?>
|
|
153
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${O}" preserveAspectRatio="xMinYMin meet" height="${O}" width="100%">
|
|
154
|
-
<title>SVG Compatibility Matrix</title>
|
|
155
|
-
|
|
156
|
-
<defs>
|
|
157
|
-
<style>
|
|
158
|
-
.title { font: bold 20px ${r}; fill: #1a1a1a; }
|
|
159
|
-
.subtitle { font: 12px ${r}; fill: #666; }
|
|
160
|
-
.col-header { font: bold 12px ${r}; fill: #FFF; }
|
|
161
|
-
.col-desc { font: 10px ${r}; fill: rgba(255,255,255,0.85); }
|
|
162
|
-
.row-label { font: 11px ${r}; fill: #333; }
|
|
163
|
-
.row-label-bold { font: bold 11px ${r}; fill: #1a1a1a; }
|
|
78
|
+
.title { font: bold 20px ${Z}; fill: #1a1a1a; }
|
|
79
|
+
.subtitle { font: 12px ${Z}; fill: #666; }
|
|
80
|
+
.col-header { font: bold 12px ${Z}; fill: #FFF; }
|
|
81
|
+
.col-desc { font: 10px ${Z}; fill: rgba(255,255,255,0.85); }
|
|
82
|
+
.row-label { font: 11px ${Z}; fill: #333; }
|
|
83
|
+
.row-label-bold { font: bold 11px ${Z}; fill: #1a1a1a; }
|
|
164
84
|
.cell-ok { fill: #C8E6C9; }
|
|
165
85
|
.cell-warn { fill: #FFF9C4; }
|
|
166
86
|
.cell-bad { fill: #FFCDD2; }
|
|
167
|
-
.ok-text { font: bold 13px ${
|
|
168
|
-
.problem-text { font: 10px ${
|
|
169
|
-
.legend-title { font: bold 11px ${
|
|
170
|
-
.legend-text { font: 10px ${
|
|
87
|
+
.ok-text { font: bold 13px ${Z}; fill: #2E7D32; }
|
|
88
|
+
.problem-text { font: 10px ${Z}; fill: #333; }
|
|
89
|
+
.legend-title { font: bold 11px ${Z}; fill: #333; }
|
|
90
|
+
.legend-text { font: 10px ${Z}; fill: #444; }
|
|
171
91
|
</style>
|
|
172
92
|
</defs>
|
|
173
93
|
|
|
174
|
-
<text x="${
|
|
175
|
-
<text x="${
|
|
94
|
+
<text x="${E/2}" y="24" text-anchor="middle" class="title">SVG Compatibility Matrix</text>
|
|
95
|
+
<text x="${E/2}" y="42" text-anchor="middle" class="subtitle">What problems will your SVG have in each configuration?</text>
|
|
176
96
|
|
|
177
97
|
<g transform="translate(25, 55)">
|
|
178
|
-
`,
|
|
179
|
-
<text x="${
|
|
180
|
-
<text x="${
|
|
181
|
-
`,
|
|
182
|
-
<text x="${
|
|
183
|
-
`;for(let
|
|
184
|
-
<text x="${
|
|
185
|
-
<text x="${
|
|
186
|
-
`,
|
|
187
|
-
<text x="${
|
|
188
|
-
`;for(let
|
|
189
|
-
<text x="${
|
|
190
|
-
`;for(let
|
|
191
|
-
<text x="${
|
|
192
|
-
`,
|
|
193
|
-
`,
|
|
194
|
-
<text x="${
|
|
195
|
-
`;else{let
|
|
196
|
-
`,
|
|
197
|
-
`}
|
|
198
|
-
<text x="0" y="${
|
|
199
|
-
`;let
|
|
200
|
-
<text x="10" y="${
|
|
201
|
-
`;let
|
|
202
|
-
`,
|
|
203
|
-
<g transform="translate(0, ${
|
|
98
|
+
`,p=O;c+=` <rect x="${p}" y="0" width="${M}" height="${V}" fill="${Q[0].color}" stroke="#1565C0"/>
|
|
99
|
+
<text x="${p+M/2}" y="25" text-anchor="middle" class="col-header">${K(Q[0].name)}</text>
|
|
100
|
+
<text x="${p+M/2}" y="42" text-anchor="middle" class="col-desc">${K(Q[0].desc)}</text>
|
|
101
|
+
`,p+=M;let N=(Q.length-1)*M;c+=` <rect x="${p}" y="0" width="${N}" height="25" fill="#0D47A1"/>
|
|
102
|
+
<text x="${p+N/2}" y="17" text-anchor="middle" class="col-header">In HTML Page</text>
|
|
103
|
+
`;for(let e=1;e<Q.length;e++){let r=Q[e];c+=` <rect x="${p}" y="25" width="${M}" height="${V-25}" fill="${r.color}" stroke="#1976D2"/>
|
|
104
|
+
<text x="${p+M/2}" y="42" text-anchor="middle" class="col-header">${K(r.name)}</text>
|
|
105
|
+
<text x="${p+M/2}" y="55" text-anchor="middle" class="col-desc">${K(r.desc)}</text>
|
|
106
|
+
`,p+=M}let y=V;for(let e of H){let r=q.length*W.length*X;c+=` <rect x="0" y="${y}" width="${F}" height="${r}" fill="${e.color}" stroke="#999"/>
|
|
107
|
+
<text x="${F/2}" y="${y+r/2+4}" text-anchor="middle" class="row-label-bold">${K(e.name)}</text>
|
|
108
|
+
`;for(let s of q){let z0=W.length*X;c+=` <rect x="${F}" y="${y}" width="${_}" height="${z0}" fill="${s.color}" stroke="#CCC"/>
|
|
109
|
+
<text x="${F+_/2}" y="${y+z0/2+4}" text-anchor="middle" class="row-label">${K(s.name)}</text>
|
|
110
|
+
`;for(let T of W){c+=` <rect x="${F+_}" y="${y}" width="${U}" height="${X}" fill="${T.color}" stroke="#DDD"/>
|
|
111
|
+
<text x="${F+_+U/2}" y="${y+X/2+4}" text-anchor="middle" class="row-label">${K(T.name)}</text>
|
|
112
|
+
`,p=O;for(let P of Q){let t=j(e.id,s.id,T.id,P.id),$0="cell-ok";if(t.length>=4)$0="cell-bad";else if(t.length>0)$0="cell-warn";if(c+=` <rect x="${p}" y="${y}" width="${M}" height="${X}" class="${$0}" stroke="#DDD"/>
|
|
113
|
+
`,t.length===0)c+=` <text x="${p+M/2}" y="${y+X/2-5}" text-anchor="middle" class="ok-text">No issues</text>
|
|
114
|
+
<text x="${p+M/2}" y="${y+X/2+12}" text-anchor="middle" class="problem-text" style="fill:#388E3C">Everything works</text>
|
|
115
|
+
`;else{let Q0=y+16;for(let V0 of t){let N0=`• ${V0.text||"Unknown issue"}`;c+=` <text x="${p+8}" y="${Q0}" class="problem-text">${K(N0)}</text>
|
|
116
|
+
`,Q0+=Y}}p+=M}y+=X}}c+=` <line x1="0" y1="${y}" x2="${I}" y2="${y}" stroke="#999" stroke-width="2"/>
|
|
117
|
+
`}c+=`
|
|
118
|
+
<text x="0" y="${u}" class="legend-title">SERVER-SIDE SVG RENDERERS (no HTML embedding)</text>
|
|
119
|
+
`;let B=u+20;for(let e of z){c+=` <rect x="0" y="${B}" width="150" height="${m-4}" fill="${e.color}" stroke="#999"/>
|
|
120
|
+
<text x="10" y="${B+18}" class="row-label-bold">${K(e.name)}</text>
|
|
121
|
+
`;let r=e.issues.join(" • ");c+=` <text x="160" y="${B+18}" class="problem-text">${K(r)}</text>
|
|
122
|
+
`,B+=m}return c+=`
|
|
123
|
+
<g transform="translate(0, ${x})">
|
|
204
124
|
<text x="0" y="0" class="legend-title">LEGEND</text>
|
|
205
125
|
|
|
206
126
|
<rect x="0" y="15" width="18" height="14" class="cell-ok" stroke="#4CAF50"/>
|
|
@@ -288,59 +208,59 @@ ${i}
|
|
|
288
208
|
<text x="0" y="995" class="legend-text">4. All animations and audio are synchronized because they share the same trigger event</text>
|
|
289
209
|
</g>
|
|
290
210
|
</g>
|
|
291
|
-
</svg>`,
|
|
292
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${
|
|
293
|
-
<title>${
|
|
211
|
+
</svg>`,c}function bK($){let{title:J="Data Table",subtitle:Z="",columns:K=[],rowLevels:Q=[],rowData:H=[],getCellContent:z=()=>({lines:[],status:"ok"}),legend:q=null,additionalSections:W=[],options:j={}}=$,G={fontFamily:j.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",minCellWidth:j.minCellWidth||150,maxCellWidth:j.maxCellWidth||300,minCellHeight:j.minCellHeight||60,cellPaddingX:j.cellPaddingX||8,cellPaddingY:j.cellPaddingY||12,titleFontSize:j.titleFontSize||20,subtitleFontSize:j.subtitleFontSize||12,headerFontSize:j.headerFontSize||12,cellFontSize:j.cellFontSize||10,lineHeight:j.lineHeight||13,titleColor:j.titleColor||"#1a1a1a",subtitleColor:j.subtitleColor||"#666",borderColor:j.borderColor||"#DDD",okColor:j.okColor||"#C8E6C9",warnColor:j.warnColor||"#FFF9C4",badColor:j.badColor||"#FFCDD2",okTextColor:j.okTextColor||"#2E7D32",colHeaderHeight:j.colHeaderHeight||60,marginTop:j.marginTop||55,marginLeft:j.marginLeft||25,marginRight:j.marginRight||25,marginBottom:j.marginBottom||50,sectionSpacing:j.sectionSpacing||40,groupHeaderHeight:j.groupHeaderHeight||25,groupHeaderColor:j.groupHeaderColor||"#0D47A1"},F=(T)=>String(T).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),_=(T,P=0,t=[])=>{let $0=[];for(let Q0 of T){let V0=[...t,{level:P,...Q0}];if(Q0.children&&Q0.children.length>0&&P<Q.length-1)$0.push(..._(Q0.children,P+1,V0));else $0.push(V0)}return $0},U=_(H[0]||[]),O=U.length,V=Q.length,M=Q.map((T,P)=>{if(T.width)return T.width;let t=T.name.length,$0=(Q0,V0)=>{for(let N0 of Q0){if(V0===P)t=Math.max(t,(N0.name||"").length);if(N0.children)$0(N0.children,V0+1)}};return $0(H[0]||[],0),Math.max(60,t*7+20)}),Y=M.reduce((T,P)=>T+P,0),X=0,w=0;for(let T of U)for(let P of K){let $0=z(T,P.id).lines||[];X=Math.max(X,$0.length);for(let Q0 of $0)w=Math.max(w,Q0.length)}let R=Math.min(G.maxCellWidth,Math.max(G.minCellWidth,w*6+G.cellPaddingX*2)),I=Math.max(G.minCellHeight,(X+1)*G.lineHeight+G.cellPaddingY*2),f=[],u=null;for(let T=0;T<K.length;T++){let P=K[T];if(P.group)if(!u||u.name!==P.group)u={name:P.group,startIndex:T,count:1,color:P.groupColor||G.groupHeaderColor},f.push(u);else u.count++;else u=null}let m=f.length>0,S=m?G.colHeaderHeight+G.groupHeaderHeight:G.colHeaderHeight,x=Y+K.length*R,h=S+O*I,E=0;for(let T of W)E+=G.sectionSpacing+(T.height||100);let d=q?j.legendHeight||200:0,c=x+G.marginLeft+G.marginRight,p=G.marginTop+h+E+(q?G.sectionSpacing+d:0)+G.marginBottom,N=`<?xml version="1.0" encoding="UTF-8"?>
|
|
212
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c} ${p}" preserveAspectRatio="xMinYMin meet" height="${p}" width="100%">
|
|
213
|
+
<title>${F(J)}</title>
|
|
294
214
|
|
|
295
215
|
<defs>
|
|
296
216
|
<style>
|
|
297
|
-
.title { font: bold ${
|
|
298
|
-
.subtitle { font: ${
|
|
299
|
-
.col-header { font: bold ${
|
|
300
|
-
.col-desc { font: ${
|
|
301
|
-
.row-label { font: ${
|
|
302
|
-
.row-label-bold { font: bold ${
|
|
303
|
-
.cell-ok { fill: ${
|
|
304
|
-
.cell-warn { fill: ${
|
|
305
|
-
.cell-bad { fill: ${
|
|
306
|
-
.ok-text { font: bold ${
|
|
307
|
-
.cell-text { font: ${
|
|
308
|
-
.section-title { font: bold ${
|
|
309
|
-
.legend-text { font: ${
|
|
217
|
+
.title { font: bold ${G.titleFontSize}px ${G.fontFamily}; fill: ${G.titleColor}; }
|
|
218
|
+
.subtitle { font: ${G.subtitleFontSize}px ${G.fontFamily}; fill: ${G.subtitleColor}; }
|
|
219
|
+
.col-header { font: bold ${G.headerFontSize}px ${G.fontFamily}; fill: #FFF; }
|
|
220
|
+
.col-desc { font: ${G.cellFontSize}px ${G.fontFamily}; fill: rgba(255,255,255,0.85); }
|
|
221
|
+
.row-label { font: ${G.headerFontSize-1}px ${G.fontFamily}; fill: #333; }
|
|
222
|
+
.row-label-bold { font: bold ${G.headerFontSize-1}px ${G.fontFamily}; fill: #1a1a1a; }
|
|
223
|
+
.cell-ok { fill: ${G.okColor}; }
|
|
224
|
+
.cell-warn { fill: ${G.warnColor}; }
|
|
225
|
+
.cell-bad { fill: ${G.badColor}; }
|
|
226
|
+
.ok-text { font: bold ${G.lineHeight}px ${G.fontFamily}; fill: ${G.okTextColor}; }
|
|
227
|
+
.cell-text { font: ${G.cellFontSize}px ${G.fontFamily}; fill: #333; }
|
|
228
|
+
.section-title { font: bold ${G.headerFontSize}px ${G.fontFamily}; fill: #333; }
|
|
229
|
+
.legend-text { font: ${G.cellFontSize}px ${G.fontFamily}; fill: #444; }
|
|
310
230
|
</style>
|
|
311
231
|
</defs>
|
|
312
232
|
|
|
313
|
-
<text x="${
|
|
314
|
-
${
|
|
315
|
-
|
|
316
|
-
<g transform="translate(${
|
|
317
|
-
`,
|
|
318
|
-
<text x="${
|
|
319
|
-
`}}let
|
|
320
|
-
<text x="${
|
|
321
|
-
`,
|
|
322
|
-
`}let
|
|
323
|
-
<text x="${
|
|
324
|
-
`,
|
|
325
|
-
`,
|
|
326
|
-
`;else{let
|
|
327
|
-
`,
|
|
328
|
-
`}}let
|
|
329
|
-
<text x="0" y="${
|
|
330
|
-
|
|
331
|
-
${
|
|
233
|
+
<text x="${c/2}" y="24" text-anchor="middle" class="title">${F(J)}</text>
|
|
234
|
+
${Z?`<text x="${c/2}" y="42" text-anchor="middle" class="subtitle">${F(Z)}</text>`:""}
|
|
235
|
+
|
|
236
|
+
<g transform="translate(${G.marginLeft}, ${G.marginTop})">
|
|
237
|
+
`,y=Y;if(m){let T=0;for(let P=0;P<K.length&&!K[P].group;P++)T++;for(let P of f){let t=Y+P.startIndex*R,$0=P.count*R;N+=` <rect x="${t}" y="0" width="${$0}" height="${G.groupHeaderHeight}" fill="${P.color}"/>
|
|
238
|
+
<text x="${t+$0/2}" y="${G.groupHeaderHeight-8}" text-anchor="middle" class="col-header">${F(P.name)}</text>
|
|
239
|
+
`}}let B=m?G.groupHeaderHeight:0,e=m?G.colHeaderHeight:S;for(let T=0;T<K.length;T++){let P=K[T],t=Y+T*R,$0=P.group?B:0,Q0=P.group?e:S;if(N+=` <rect x="${t}" y="${$0}" width="${R}" height="${Q0}" fill="${P.color}" stroke="${G.borderColor}"/>
|
|
240
|
+
<text x="${t+R/2}" y="${$0+Q0/2-5}" text-anchor="middle" class="col-header">${F(P.name)}</text>
|
|
241
|
+
`,P.desc)N+=` <text x="${t+R/2}" y="${$0+Q0/2+10}" text-anchor="middle" class="col-desc">${F(P.desc)}</text>
|
|
242
|
+
`}let r=new Map,s=S;for(let T=0;T<U.length;T++){let P=U[T],t=0;for(let $0=0;$0<V;$0++){let Q0=P.find((N0)=>N0.level===$0);if(!Q0){t+=M[$0];continue}let V0=`${$0}-${Q0.id}`;if(!r.has(V0)){let N0=1;for(let o=T+1;o<U.length;o++){let J0=U[o].find((F0)=>F0.level===$0);if(J0&&J0.id===Q0.id)N0++;else break}let h0=N0*I;N+=` <rect x="${t}" y="${s}" width="${M[$0]}" height="${h0}" fill="${Q0.color||"#F5F5F5"}" stroke="${G.borderColor}"/>
|
|
243
|
+
<text x="${t+M[$0]/2}" y="${s+h0/2+4}" text-anchor="middle" class="${$0===0?"row-label-bold":"row-label"}">${F(Q0.name)}</text>
|
|
244
|
+
`,r.set(V0,{y:s,height:h0})}t+=M[$0]}for(let $0=0;$0<K.length;$0++){let Q0=K[$0],V0=Y+$0*R,N0=z(P,Q0.id),h0=N0.lines||[],o=N0.status||"ok";if(N+=` <rect x="${V0}" y="${s}" width="${R}" height="${I}" class="${o==="bad"?"cell-bad":o==="warn"?"cell-warn":"cell-ok"}" stroke="${G.borderColor}"/>
|
|
245
|
+
`,h0.length===0)N+=` <text x="${V0+R/2}" y="${s+I/2}" text-anchor="middle" class="ok-text">No issues</text>
|
|
246
|
+
`;else{let F0=s+G.cellPaddingY+G.lineHeight;for(let O0 of h0)N+=` <text x="${V0+G.cellPaddingX}" y="${F0}" class="cell-text">${F("• "+O0)}</text>
|
|
247
|
+
`,F0+=G.lineHeight}}if(s+=I,T<U.length-1){let $0=P[0]?.id,Q0=U[T+1][0]?.id;if($0!==Q0)N+=` <line x1="0" y1="${s}" x2="${x}" y2="${s}" stroke="#999" stroke-width="2"/>
|
|
248
|
+
`}}let z0=h+G.sectionSpacing;for(let T of W){if(T.title)N+=`
|
|
249
|
+
<text x="0" y="${z0}" class="section-title">${F(T.title)}</text>
|
|
250
|
+
`,z0+=20;if(T.content)N+=` <g transform="translate(0, ${z0})">
|
|
251
|
+
${T.content}
|
|
332
252
|
</g>
|
|
333
|
-
`;if(
|
|
334
|
-
`;if(
|
|
335
|
-
`}
|
|
336
|
-
<g transform="translate(0, ${
|
|
337
|
-
${
|
|
253
|
+
`;if(T.items)for(let P of T.items){if(P.rect)N+=` <rect x="${P.rect.x}" y="${z0+P.rect.y}" width="${P.rect.width}" height="${P.rect.height}" fill="${P.rect.fill||"#EEE"}" stroke="${P.rect.stroke||"#999"}"/>
|
|
254
|
+
`;if(P.text)N+=` <text x="${P.text.x}" y="${z0+P.text.y}" class="${P.text.class||"legend-text"}">${F(P.text.content)}</text>
|
|
255
|
+
`}z0+=T.height||100}if(q)N+=`
|
|
256
|
+
<g transform="translate(0, ${z0})">
|
|
257
|
+
${q}
|
|
338
258
|
</g>
|
|
339
|
-
`;return
|
|
340
|
-
</svg>`,
|
|
341
|
-
<text x="10" y="${
|
|
342
|
-
<text x="160" y="${
|
|
343
|
-
`,
|
|
259
|
+
`;return N+=` </g>
|
|
260
|
+
</svg>`,N}function mz($={}){let J=$.fontFamily||"system-ui, -apple-system, BlinkMacSystemFont, sans-serif",Z=[{id:"standalone",name:"Standalone SVG",desc:"Open .svg directly",color:"#1565C0"},{id:"img",name:"<img>",desc:"Image element",color:"#1976D2",group:"In HTML Page",groupColor:"#0D47A1"},{id:"object",name:"<object>",desc:"Object element",color:"#1E88E5",group:"In HTML Page"},{id:"embed",name:"<embed>",desc:"Embed element",color:"#2196F3",group:"In HTML Page"},{id:"inline",name:"Inline <svg>",desc:"SVG in HTML",color:"#42A5F5",group:"In HTML Page"},{id:"css",name:"CSS background",desc:"background-image",color:"#64B5F6",group:"In HTML Page"}],K=[{id:"environment",name:"Environment",width:130},{id:"protocol",name:"Protocol",width:80},{id:"script",name:"JavaScript",width:90}],Q=[[{id:"desktop",name:"Desktop Browser",color:"#E3F2FD",children:[{id:"file",name:"file://",color:"#BBDEFB",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]},{id:"http",name:"http(s)://",color:"#C8E6C9",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]}]},{id:"mobile",name:"Mobile Browser",color:"#E8F5E9",children:[{id:"file",name:"file://",color:"#BBDEFB",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]},{id:"http",name:"http(s)://",color:"#C8E6C9",children:[{id:"js",name:"JS enabled",color:"#DCEDC8"},{id:"nojs",name:"JS disabled",color:"#FFCDD2"}]}]}]],H=$.getCellContent||((G,F)=>{return{lines:[],status:"ok"}}),z=[{name:"Node.js (JSDOM)",color:"#FFF3E0",issues:["No rendering","No animations","No interaction"]},{name:"ImageMagick",color:"#EFEBE9",issues:["No animations","No scripts","No foreignObject","No web fonts"]},{name:"Inkscape CLI",color:"#F3E5F5",issues:["No animations","No scripts"]},{name:"librsvg",color:"#E0F2F1",issues:["No animations","No scripts","Limited filters"]},{name:"Cairo",color:"#FBE9E7",issues:["No animations","No scripts","No filters","No foreignObject"]},{name:"Apache Batik",color:"#F3E5F5",issues:["No CSS animations","Limited SMIL","No web fonts"]}],q="",W=0;for(let G of z)q+=`<rect x="0" y="${W}" width="150" height="26" fill="${G.color}" stroke="#999"/>
|
|
261
|
+
<text x="10" y="${W+18}" class="row-label-bold">${G.name}</text>
|
|
262
|
+
<text x="160" y="${W+18}" class="cell-text">${G.issues.join(" • ")}</text>
|
|
263
|
+
`,W+=30;let j=`
|
|
344
264
|
<text x="0" y="0" class="section-title">LEGEND</text>
|
|
345
265
|
|
|
346
266
|
<rect x="0" y="15" width="18" height="14" class="cell-ok" stroke="#4CAF50"/>
|
|
@@ -426,15 +346,15 @@ ${i}
|
|
|
426
346
|
<text x="0" y="963" class="legend-text">2. Set ALL animations AND audio to begin="mySvg.click"</text>
|
|
427
347
|
<text x="0" y="979" class="legend-text">3. User clicks anywhere on SVG → user activation satisfied → audio plays → animations start</text>
|
|
428
348
|
<text x="0" y="995" class="legend-text">4. All animations and audio are synchronized because they share the same trigger event</text>
|
|
429
|
-
`;return Kt({title:"SVG Compatibility Matrix",subtitle:"What problems will your SVG have in each configuration?",columns:r,rowLevels:e,rowData:o,getCellContent:n,additionalSections:[{title:"SERVER-SIDE SVG RENDERERS (no HTML embedding)",content:l,height:i.length*30+20}],legend:p,options:{fontFamily:a,minCellWidth:220,legendHeight:1020,...t}})}var Zt=d3((t,a={})=>{let r=a.fixInvalidGroupAttrs!==!1,e=a.fixMissingNamespaces!==!1,o=a.fixBrokenRefs!==!1,n=a.fixAnimationTiming!==!1,i=a.verbose||!1,l=[],d=new Set,p=(k)=>{let I=k.getAttribute("id");if(I)d.add(I);for(let G of k.children)if(Z(G))p(G)};p(t);let g=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],c=new Set(["svg","rect","image","foreignObject","use","symbol","pattern","mask","filter","clipPath"]),m=(k)=>{let I=k.tagName.toLowerCase();if(I==="g"&&r){for(let G of g)if(k.hasAttribute(G)){let U=k.getAttribute(G);k.removeAttribute(G),l.push({type:"invalid_attr_removed",element:I,attr:G,value:U,reason:`SVG 1.1: <g> elements do not support '${G}' attribute`})}}for(let G of k.children)if(Z(G))m(G)},y=()=>{if(!e)return;let k=!1,I=(G)=>{for(let U of G.getAttributeNames())if(U.startsWith("xlink:")){k=!0;return}for(let U of G.children){if(Z(U))I(U);if(k)return}};if(I(t),k&&!t.hasAttribute("xmlns:xlink"))t.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),l.push({type:"namespace_added",namespace:"xmlns:xlink",value:"http://www.w3.org/1999/xlink",reason:"SVG 1.1: xmlns:xlink required when xlink:* attributes are present"})},h=(k)=>{let I=[k,k.replace(/^FRAME(\d+)$/,"FRAME0$1"),k.replace(/^FRAME0(\d+)$/,"FRAME00$1"),k.replace(/^FRAME00(\d+)$/,"FRAME000$1"),k.replace(/^FRAME0+(\d+)$/,"FRAME$1"),k.replace(/^FRAME(\d)$/,"FRAME0000$1"),k.replace(/^FRAME(\d{2})$/,"FRAME000$1"),k.replace(/^FRAME(\d{3})$/,"FRAME00$1"),k.replace(/^FRAME(\d{4})$/,"FRAME0$1")];for(let q of I)if(d.has(q)&&q!==k)return q;let G=null,U=1/0;for(let q of d)if(q.toLowerCase().includes(k.toLowerCase())||k.toLowerCase().includes(q.toLowerCase())){let c3=Math.abs(q.length-k.length);if(c3<U&&c3<=2)U=c3,G=q}return G},s=(k)=>{if(!o)return;for(let I of["href","xlink:href"]){let G=k.getAttribute(I);if(G&&G.startsWith("#")){let U=G.substring(1);if(!d.has(U)){let q=h(U);if(q)k.setAttribute(I,`#${q}`),l.push({type:"ref_fixed",element:k.tagName.toLowerCase(),attr:I,oldValue:G,newValue:`#${q}`,reason:`ID '${U}' not found, fixed to similar ID '${q}'`})}}}if(k.tagName.toLowerCase()==="animate"){let I=k.getAttribute("attributeName");if(I==="href"||I==="xlink:href"){let G=k.getAttribute("values");if(G){let U=G.split(";"),q=!1,c3=U.map((b3)=>{let N3=b3.trim();if(N3.startsWith("#")){let R3=N3.substring(1);if(!d.has(R3)){let E4=h(R3);if(E4)return q=!0,`#${E4}`}}return N3});if(q){let b3=c3.join(";");k.setAttribute("values",b3),l.push({type:"animate_values_fixed",oldValue:G,newValue:b3,reason:"Fixed broken ID references in animate values"})}}}}for(let I of["fill","stroke","clip-path","mask","filter"]){let G=k.getAttribute(I);if(G&&G.startsWith("url(#")){let U=G.match(/url\(#([^)]+)\)/);if(U){let q=U[1];if(!d.has(q)){let c3=h(q);if(c3)k.setAttribute(I,`url(#${c3})`),l.push({type:"url_ref_fixed",element:k.tagName.toLowerCase(),attr:I,oldValue:G,newValue:`url(#${c3})`,reason:`ID '${q}' not found, fixed to similar ID '${c3}'`})}}}}for(let I of k.children)if(Z(I))s(I)},x=(k)=>{if(!n)return;let I=["animate","animateTransform","animateMotion","animateColor","set"],G=k.tagName.toLowerCase();if(I.includes(G)){let U=k.getAttribute("dur"),q=k.getAttribute("repeatCount");if(U==="0"||U==="0s"){if(!k.getAttribute("keyTimes"))l.push({type:"timing_warning",element:G,attr:"dur",value:U,reason:'dur="0" may cause animation to not play'})}let c3=k.getAttribute("begin");if(c3){let b3=c3;if(c3==="0")b3="0s",k.setAttribute("begin",b3),l.push({type:"timing_normalized",element:G,attr:"begin",oldValue:c3,newValue:b3,reason:"Normalized begin value to include time unit"})}}for(let U of k.children)if(Z(U))x(U)},D=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),S=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),P=(k)=>{let I=k.tagName.toLowerCase();if(D.has(I)){let G=[];for(let U of Array.from(k.children))if(Z(U)&&S.has(U.tagName.toLowerCase()))G.push(U);if(G.length>0){let U=k.getAttribute("id");if(!U)U=`_fix_${I}_${Math.random().toString(36).substring(2,8)}`,k.setAttribute("id",U),l.push({type:"id_generated",element:I,id:U,reason:"Generated ID for animation targeting after moving animate element"});for(let q of G){if(k.removeChild(q),!q.hasAttribute("href")&&!q.hasAttribute("xlink:href"))q.setAttribute("href",`#${U}`);let c3=k.parentNode;if(c3){let b3=k.nextSibling;if(b3)c3.insertBefore(q,b3);else c3.appendChild(q)}l.push({type:"animation_moved_from_empty_element",element:q.tagName.toLowerCase(),parentElement:I,targetId:U,reason:`SVG 1.1: <${I}> has EMPTY content model and cannot have children. Animation moved outside and targets element via href="#${U}".`})}}}for(let G of Array.from(k.children))if(Z(G))P(G)},T=/^([+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?)(EM|EX|PX|IN|CM|MM|PT|PC|DEG|GRAD|RAD|S|MS|HZ|KHZ|%)$/i,f=new Set(["x","y","width","height","rx","ry","cx","cy","r","fx","fy","x1","y1","x2","y2","dx","dy","textLength","startOffset","stroke-width","stroke-dashoffset","font-size","baseline-shift","kerning","letter-spacing","word-spacing","markerWidth","markerHeight","refX","refY","stdDeviation","radius"]),X=(k)=>{for(let I of k.getAttributeNames()){if(!f.has(I)&&!I.includes("-"))continue;let G=k.getAttribute(I);if(!G)continue;let U=G.match(T);if(U){let[,q,c3]=U,b3=c3.toLowerCase();if(c3!==b3){let N3=q+b3;k.setAttribute(I,N3),l.push({type:"unit_normalized",element:k.tagName.toLowerCase(),attr:I,oldValue:G,newValue:N3,reason:"SVG 1.1: Unit identifiers in attributes must be lowercase"})}}}for(let I of k.children)if(Z(I))X(I)},B=/[\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/g,L=new Set(["points","viewBox","preserveAspectRatio","transform","d","values","keyTimes","keySplines","keyPoints","rotate","stroke-dasharray","baseFrequency","kernelMatrix","tableValues","filterRes","stdDeviation","radius","origin"]),R=(k)=>{for(let I of k.getAttributeNames()){if(!L.has(I)&&I!=="style")continue;let G=k.getAttribute(I);if(!G)continue;if(B.test(G)){let U=G.replace(B," ");k.setAttribute(I,U),l.push({type:"whitespace_normalized",element:k.tagName.toLowerCase(),attr:I,reason:"SVG 1.1: Replaced invalid Unicode whitespace with standard space (0x20)"})}}for(let I of k.children)if(Z(I))R(I)},N=(k)=>{for(let I of k.getAttributeNames()){let G=k.getAttribute(I);if(!G)continue;let U=G,q=!1;if(/\d\.$/.test(U)||/\d\.(?=[,\s;)])/.test(U))U=U.replace(/(\d)\.(?=$|[,\s;)])/g,"$1"),q=!0;if(U=U.replace(/(^|[,\s;(])\.(\d)/g,"$10.$2"),U=U.replace(/(^|[,\s;(])-\.(\d)/g,"$1-0.$2"),U!==G)q=!0;if(/\.\.+/.test(U))U=U.replace(/\.\.+/g,"."),q=!0;if(q)k.setAttribute(I,U),l.push({type:"number_format_fixed",element:k.tagName.toLowerCase(),attr:I,oldValue:G,newValue:U,reason:"SVG 1.1: Fixed invalid number format"})}for(let I of k.children)if(Z(I))N(I)},u=340000000000000000000000000000000000000,O=-340000000000000000000000000000000000000,Y=/[+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?/g,j=(k)=>{for(let I of k.getAttributeNames()){let G=k.getAttribute(I);if(!G)continue;if(I==="id"||I==="class"||I.startsWith("xmlns")||I==="href"||I==="xlink:href"||I==="style")continue;let U=G.match(Y);if(!U)continue;for(let q of U){let c3=parseFloat(q);if(!isFinite(c3))l.push({type:"invalid_number_detected",element:k.tagName.toLowerCase(),attr:I,value:q,reason:"SVG 1.1: Invalid number (Infinity or NaN)"});else if(c3>u||c3<O)l.push({type:"out_of_range_detected",element:k.tagName.toLowerCase(),attr:I,value:q,reason:"SVG 1.1: Number exceeds single-precision float range"})}}for(let I of k.children)if(Z(I))j(I)},_=(k)=>{let I=k.tagName,G=I.toLowerCase();if(I.includes(":")||Z4.has(I)||j2.has(G));else{let U=n5(I,Z4);if(U)l.push({type:"mistyped_element_detected",element:I,suggestion:U,reason:`Unknown element <${I}> - did you mean <${U}>?`});else l.push({type:"unknown_element_detected",element:I,reason:`Unknown element <${I}> - not in SVG 1.1 spec`})}for(let U of k.children)if(Z(U))_(U)},A=(k)=>{for(let I of k.getAttributeNames()){if(I.startsWith("xmlns")||I.startsWith("data-"))continue;let G=I.toLowerCase();if(J4.has(I)||W2.has(G))continue;if(I.startsWith("-webkit-")||I.startsWith("-moz-")||I.startsWith("-ms-")||I.startsWith("-o-"))continue;if(I.includes(":")&&!I.startsWith("xlink:")&&!I.startsWith("xml:"))continue;let U=n5(I,J4);if(U)l.push({type:"mistyped_attribute_detected",element:k.tagName.toLowerCase(),attr:I,suggestion:U,reason:`Unknown attribute '${I}' on <${k.tagName.toLowerCase()}> - did you mean '${U}'?`})}for(let I of k.children)if(Z(I))A(I)},W={a:["href"],animate:["attributeName"],animateColor:["attributeName"],animateTransform:["attributeName"],circle:["r"],"color-profile":["name"],cursor:["href"],ellipse:["rx","ry"],feBlend:["in2"],feComposite:["in2"],feConvolveMatrix:["kernelMatrix"],feDisplacementMap:["in2"],feFuncA:["type"],feFuncB:["type"],feFuncG:["type"],feFuncR:["type"],feImage:["href"],font:["horiz-adv-x"],"font-face-uri":["href"],foreignObject:["width","height"],hkern:["k"],image:["href","width","height"],mpath:["href"],path:["d"],polygon:["points"],polyline:["points"],rect:["width","height"],script:["type"],set:["attributeName"],stop:["offset"],style:["type"],textPath:["href"],tref:["href"],use:["href"],vkern:["k"]},C=["href","xlink:href"],z=(k)=>{let I=k.tagName.toLowerCase(),G=W[I];if(G){for(let U of G)if(U==="href"){if(!C.some((q)=>k.hasAttribute(q)))l.push({type:"missing_required_attribute",element:I,attr:U,reason:`Element <${I}> is missing required attribute '${U}' (or 'xlink:href')`})}else if(!k.hasAttribute(U))l.push({type:"missing_required_attribute",element:I,attr:U,reason:`Element <${I}> is missing required attribute '${U}'`})}for(let U of k.children)if(Z(U))z(U)},o3={circle:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),ellipse:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),line:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),path:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polygon:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polyline:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),rect:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),use:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),image:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),animate:new Set(["desc","title","metadata"]),animatecolor:new Set(["desc","title","metadata"]),animatemotion:new Set(["desc","title","metadata","mpath"]),animatetransform:new Set(["desc","title","metadata"]),set:new Set(["desc","title","metadata"]),lineargradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),radialgradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),filter:new Set(["desc","title","metadata","animate","set","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","feflood","fegaussianblur","feimage","femerge","femorphology","feoffset","fespecularlighting","fetile","feturbulence"]),stop:new Set(["animate","animatecolor","set"])},K=(k)=>{let I=k.tagName.toLowerCase(),G=o3[I];if(G){for(let U of k.children)if(Z(U)){let q=U.tagName.toLowerCase();if(!q.includes(":")&&!G.has(q))l.push({type:"invalid_child_element",parent:I,child:q,reason:`Element <${q}> is not a valid child of <${I}> per SVG 1.1 DTD`})}}for(let U of k.children)if(Z(U))K(U)},$={"alignment-baseline":["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"],"clip-rule":["nonzero","evenodd","inherit"],"color-interpolation":["auto","sRGB","linearRGB","inherit"],"color-interpolation-filters":["auto","sRGB","linearRGB","inherit"],"color-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],direction:["ltr","rtl","inherit"],display:["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"],"dominant-baseline":["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"],"fill-rule":["nonzero","evenodd","inherit"],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded","inherit"],"font-style":["normal","italic","oblique","inherit"],"font-variant":["normal","small-caps","inherit"],"font-weight":["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","inherit"],"image-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],overflow:["visible","hidden","scroll","auto","inherit"],"pointer-events":["visiblePainted","visibleFill","visibleStroke","visible","painted","fill","stroke","all","none","inherit"],"shape-rendering":["auto","optimizeSpeed","crispEdges","geometricPrecision","inherit"],"stroke-linecap":["butt","round","square","inherit"],"stroke-linejoin":["miter","round","bevel","inherit"],"text-anchor":["start","middle","end","inherit"],"text-rendering":["auto","optimizeSpeed","optimizeLegibility","geometricPrecision","inherit"],"unicode-bidi":["normal","embed","bidi-override","inherit"],visibility:["visible","hidden","collapse","inherit"],"writing-mode":["lr-tb","rl-tb","tb-rl","lr","rl","tb","inherit"],"xml:space":["default","preserve"],additive:["replace","sum"],accumulate:["none","sum"],calcMode:["discrete","linear","paced","spline"],fill:["freeze","remove"],restart:["always","whenNotActive","never"],attributeType:["CSS","XML","auto"],edgeMode:["duplicate","wrap","none"],operator:["over","in","out","atop","xor","arithmetic","erode","dilate"],mode:["normal","multiply","screen","darken","lighten"],type:["translate","scale","rotate","skewX","skewY","matrix","saturate","hueRotate","luminanceToAlpha","identity","table","discrete","linear","gamma","fractalNoise","turbulence"],spreadMethod:["pad","reflect","repeat"],gradientUnits:["userSpaceOnUse","objectBoundingBox"],patternUnits:["userSpaceOnUse","objectBoundingBox"],patternContentUnits:["userSpaceOnUse","objectBoundingBox"],clipPathUnits:["userSpaceOnUse","objectBoundingBox"],maskUnits:["userSpaceOnUse","objectBoundingBox"],maskContentUnits:["userSpaceOnUse","objectBoundingBox"],filterUnits:["userSpaceOnUse","objectBoundingBox"],primitiveUnits:["userSpaceOnUse","objectBoundingBox"],markerUnits:["strokeWidth","userSpaceOnUse"],method:["align","stretch"],spacing:["auto","exact"],lengthAdjust:["spacing","spacingAndGlyphs"],preserveAspectRatio:["none","xMinYMin","xMidYMin","xMaxYMin","xMinYMid","xMidYMid","xMaxYMid","xMinYMax","xMidYMax","xMaxYMax"],zoomAndPan:["disable","magnify"],externalResourcesRequired:["true","false"]},w=new Set(["preserveAspectRatio"]),F=(k)=>{let I=k.tagName.toLowerCase();for(let G of k.getAttributeNames()){let U=$[G];if(U){let q=k.getAttribute(G);if(w.has(G)&&q)q=q.split(/\s+/)[0];if(G==="fill"&&!["animate","animatecolor","animatemotion","animatetransform","set"].includes(I))continue;if(!U.includes(q)&&q!=="inherit")l.push({type:"invalid_enum_value",element:I,attr:G,value:q,validValues:U.slice(0,5).join(", ")+(U.length>5?"...":""),reason:`Invalid value '${q}' for attribute '${G}' - must be one of: ${U.slice(0,5).join(", ")}${U.length>5?"...":""}`})}}for(let G of k.children)if(Z(G))F(G)},a3={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},"font-size":{min:0,type:"length"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"},width:{min:0,type:"length"},height:{min:0,type:"length"},stdDeviation:{min:0,type:"number"},scale:{type:"number"},baseFrequency:{min:0,type:"number"},numOctaves:{min:1,type:"integer"},seed:{min:0,type:"number"},repeatCount:{min:0,type:"number"}},e3=(k)=>{let I=k.tagName.toLowerCase();for(let G of k.getAttributeNames()){let U=a3[G];if(U){let q=k.getAttribute(G);if(q==="inherit"||q==="none"||q==="indefinite"||q==="auto")continue;let c3=q.match(/^([+-]?\d*\.?\d+)/);if(c3){let b3=parseFloat(c3[1]);if(isNaN(b3))l.push({type:"invalid_numeric_value",element:I,attr:G,value:q,reason:`Invalid numeric value '${q}' for attribute '${G}'`});else{if(U.min!==void 0&&b3<U.min)l.push({type:"numeric_out_of_range",element:I,attr:G,value:q,constraint:`min: ${U.min}`,reason:`Value '${q}' for '${G}' is below minimum (${U.min})`});if(U.max!==void 0&&b3>U.max)l.push({type:"numeric_out_of_range",element:I,attr:G,value:q,constraint:`max: ${U.max}`,reason:`Value '${q}' for '${G}' exceeds maximum (${U.max})`});if(U.type==="integer"&&!Number.isInteger(b3))l.push({type:"invalid_numeric_value",element:I,attr:G,value:q,reason:`Attribute '${G}' requires an integer value, got '${q}'`})}}}}for(let G of k.children)if(Z(G))e3(G)},i3=(k)=>{let I=new Map,G=(U)=>{let q=U.getAttribute("id");if(q){if(!I.has(q))I.set(q,[]);I.get(q).push(U.tagName.toLowerCase())}for(let c3 of U.children)if(Z(c3))G(c3)};G(k);for(let[U,q]of I)if(q.length>1)l.push({type:"duplicate_id",id:U,count:q.length,elements:q.join(", "),reason:`Duplicate ID '${U}' found on ${q.length} elements: ${q.join(", ")}`})},y3=(k)=>{let I=new Set,G=(b3)=>{let N3=b3.getAttribute("id");if(N3)I.add(N3);for(let R3 of b3.children)if(Z(R3))G(R3)};G(k);let U=/url\(\s*['"]?#([^'")]+)['"]?\s*\)/g,q=/^#(.+)$/,c3=(b3)=>{let N3=b3.tagName.toLowerCase();for(let R3 of b3.getAttributeNames()){let E4=b3.getAttribute(R3),D5;U.lastIndex=0;while((D5=U.exec(E4))!==null){let f4=D5[1];if(!I.has(f4))l.push({type:"broken_reference",element:N3,attr:R3,refId:f4,reason:`Broken reference: url(#${f4}) points to non-existent ID`})}if(R3==="href"||R3==="xlink:href"){let f4=E4.match(q);if(f4){let e5=f4[1];if(!I.has(e5))l.push({type:"broken_reference",element:N3,attr:R3,refId:e5,reason:`Broken reference: ${R3}="#${e5}" points to non-existent ID`})}}}for(let R3 of b3.children)if(Z(R3))c3(R3)};c3(t)},u3=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),Q=new Set(["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"]),J=(k)=>{let I=k.toLowerCase().trim();if(I==="none"||I==="inherit"||I==="currentcolor")return!0;if(u3.has(I))return!0;if(I.startsWith("url("))return!0;if(/^#[0-9a-f]{3}$/.test(I)||/^#[0-9a-f]{6}$/.test(I))return!0;if(/^rgb\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)$/.test(I))return!0;if(/^rgba\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*[\d.]+%?\s*\)$/.test(I))return!0;return!1},g3=(k)=>{let I=k.tagName.toLowerCase();for(let G of k.getAttributeNames())if(Q.has(G)){let U=k.getAttribute(G);if(!J(U))l.push({type:"invalid_color",element:I,attr:G,value:U,reason:`Invalid color value '${U}' for attribute '${G}'`})}for(let G of k.children)if(Z(G))g3(G)},x3=(k)=>{let I=k.tagName.toLowerCase();if(["svg","symbol","marker","pattern","view"].includes(I)){let q=k.getAttribute("viewBox");if(q){let c3=q.trim().split(/[\s,]+/);if(c3.length!==4)l.push({type:"malformed_viewbox",element:I,value:q,reason:`viewBox must have exactly 4 values (min-x, min-y, width, height), got ${c3.length}`});else{for(let R3=0;R3<c3.length;R3++)if(!/^[+-]?\d*\.?\d+([Ee][+-]?\d+)?$/.test(c3[R3])){l.push({type:"malformed_viewbox",element:I,value:q,reason:`viewBox contains invalid number '${c3[R3]}' at position ${R3+1}`});break}let b3=parseFloat(c3[2]),N3=parseFloat(c3[3]);if(isNaN(b3)||isNaN(N3)||b3<0||N3<0)l.push({type:"invalid_viewbox_dimensions",element:I,value:q,reason:`viewBox width and height must be valid non-negative numbers, got ${b3}x${N3}`})}}}let G=k.getAttribute("preserveAspectRatio");if(G){if(!/^(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)(\s+(meet|slice))?$/.test(G.trim()))l.push({type:"malformed_preserveaspectratio",element:I,value:G,reason:`Invalid preserveAspectRatio format '${G}'`})}if(["polygon","polyline"].includes(I)){let q=k.getAttribute("points");if(q){let c3=q.trim().split(/[\s,]+/);if(c3.length>0&&c3.length%2!==0)l.push({type:"malformed_points",element:I,value:q.slice(0,50)+(q.length>50?"...":""),reason:`points attribute must have even number of values (x,y pairs), got ${c3.length}`})}}let U=k.getAttribute("transform");if(U){if(!/^(\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20})+$/.test(U.trim())){if(!/^[\s\w(),.\-+]+$/.test(U))l.push({type:"malformed_transform",element:I,value:U.slice(0,50)+(U.length>50?"...":""),reason:"Potentially malformed transform attribute"})}}for(let q of k.children)if(Z(q))x3(q)},E3=(k)=>{let I=k.tagName,G=I.toLowerCase();if(I.includes(":")||Z4.has(I)||j2.has(G)){for(let q of Array.from(k.children))if(Z(q))E3(q);return}let U=n5(I,Z4);if(U){let q=k.ownerDocument.createElement(U);for(let c3 of k.getAttributeNames())q.setAttribute(c3,k.getAttribute(c3));while(k.firstChild)q.appendChild(k.firstChild);if(k.parentNode)k.parentNode.replaceChild(q,k);l.push({type:"element_typo_fixed",oldName:I,newName:U,reason:`Fixed element typo: <${I}> -> <${U}>`});for(let c3 of Array.from(q.children))if(Z(c3))E3(c3)}else for(let q of Array.from(k.children))if(Z(q))E3(q)},A3=(k)=>{for(let I of Array.from(k.getAttributeNames())){if(I.startsWith("xmlns")||I.startsWith("data-"))continue;if(I.startsWith("-webkit-")||I.startsWith("-moz-"))continue;if(I.includes(":")&&!I.startsWith("xlink:")&&!I.startsWith("xml:"))continue;if(J4.has(I)||W2.has(I.toLowerCase()))continue;let G=n5(I,J4);if(G){let U=k.getAttribute(I);k.removeAttribute(I),k.setAttribute(G,U),l.push({type:"attr_typo_fixed",element:k.tagName.toLowerCase(),oldAttr:I,newAttr:G,reason:`Fixed attribute typo: '${I}' -> '${G}'`})}}for(let I of k.children)if(Z(I))A3(I)},B3=(k)=>{let I=new Map,G=new Set,U=(b3)=>{let N3=b3.getAttribute("id");if(N3)I.set(N3,(I.get(N3)||0)+1),G.add(N3);for(let R3 of b3.children)if(Z(R3))U(R3)};U(k);let q=new Set,c3=(b3)=>{let N3=b3.getAttribute("id");if(N3)if(q.has(N3)){let R3=N3,E4=2;while(G.has(R3)||q.has(R3))R3=`${N3}_${E4++}`;b3.setAttribute("id",R3),G.add(R3),q.add(R3),l.push({type:"duplicate_id_renamed",oldId:N3,newId:R3,element:b3.tagName.toLowerCase(),reason:`Renamed duplicate ID: '${N3}' -> '${R3}'`})}else q.add(N3);for(let R3 of b3.children)if(Z(R3))c3(R3)};c3(k)};if(m(t),y(),s(t),x(t),P(t),X(t),R(t),N(t),E3(t),A3(t),B3(t),j(t),z(t),K(t),F(t),e3(t),y3(t),g3(t),x3(t),t.setAttribute("data-fixes-applied",String(l.length)),i&&l.length>0)t.setAttribute("data-fix-report",JSON.stringify(l));return t}),C3={ERROR:"error",WARNING:"warning"},Sn={broken_reference:C3.ERROR,broken_url_reference:C3.ERROR,duplicate_id:C3.ERROR,missing_required_attribute:C3.ERROR,invalid_child_element:C3.ERROR,animation_in_empty_element:C3.ERROR,malformed_viewbox:C3.ERROR,malformed_points:C3.ERROR,malformed_transform:C3.ERROR,invalid_enum_value:C3.ERROR,invalid_numeric_constraint:C3.ERROR,invalid_attr_on_element:C3.WARNING,missing_namespace:C3.WARNING,invalid_timing:C3.WARNING,uppercase_unit:C3.WARNING,invalid_whitespace:C3.WARNING,invalid_number:C3.WARNING,mistyped_element_detected:C3.WARNING,unknown_element_detected:C3.WARNING,mistyped_attribute_detected:C3.WARNING,unknown_attribute_detected:C3.WARNING,invalid_color:C3.WARNING,circular_reference:C3.WARNING,deep_nesting:C3.WARNING,empty_defs:C3.WARNING,gradient_stop_order:C3.WARNING,path_complexity:C3.WARNING,external_resource:C3.WARNING,script_content:C3.WARNING,event_handler:C3.WARNING,missing_title:C3.WARNING,missing_desc:C3.WARNING,invalid_aria:C3.WARNING,missing_lang:C3.WARNING},En=new Set(["onabort","onactivate","onbegin","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onend","onended","onerror","onfocus","onfocusin","onfocusout","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onrepeat","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onunload","onvolumechange","onwaiting","onwheel"]),bn=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"]),S9=new Set(["img","graphics-document","graphics-object","graphics-symbol","group","list","listitem","none","presentation","application"]);function Pn(t){let a={elements:new Map,lines:[]},r=0;a.lines.push(0);for(let D=0;D<t.length;D++)if(t[D]===`
|
|
430
|
-
`)
|
|
431
|
-
`):null,g=Pn(l),c,m=[],y=(M)=>{let v=M.match(/line\s*:?\s*(\d+)/i)||M.match(/:(\d+):/);return v?parseInt(v[1],10):1},h=(M)=>{let v=M.match(/column\s*:?\s*(\d+)/i)||M.match(/:\d+:(\d+)/);return v?parseInt(v[1],10):1},s=(M)=>{let v=M,H=[],V="_VALID_ENTITY_",t3=/&(amp|lt|gt|quot|apos|#\d{1,7}|#x[\da-fA-F]{1,6});/g,l3=v.replace(t3,V+"$1;").replace(/&/g,"&").replace(new RegExp(V,"g"),"&");if(l3!==v)v=l3,H.push("Escaped unencoded ampersands");let n3=v.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"");if(n3!==v)v=n3,H.push("Removed invalid control characters");if(v.charCodeAt(0)===65279)v=v.slice(1),H.push("Removed UTF-8 BOM");let s3=v.replace(/="([^"]*)<([^"]*)"(?!\s*>)/g,(w3,V3,K3)=>{if(!K3.includes(">"))return`="${V3}<${K3}"`;return w3});if(s3!==v)v=s3,H.push("Escaped < in attribute values");return{fixed:v,appliedFixes:H}};try{c=await X5(t,d)}catch(M){let v=M.message||String(M),H=y(v),V=h(v),{fixed:t3,appliedFixes:l3}=s(l);if(l3.length>0&&t3!==l)try{let{JSDOM:n3}=await import("jsdom");c=new n3(t3,{contentType:"image/svg+xml"}).window.document.documentElement,m.push({type:"parse_recovery",severity:C3.WARNING,reason:`Recovered from parse error. Applied fixes: ${l3.join("; ")}`,line:H,column:V}),m.push({type:"original_parse_error",severity:C3.ERROR,reason:`Original parse error: ${v}`,line:H,column:V})}catch(n3){return{issues:[{type:"parse_error",severity:C3.ERROR,reason:`Failed to parse SVG: ${v}`,line:H,column:V},{type:"recovery_failed",severity:C3.WARNING,reason:`Recovery attempted (${l3.join("; ")}) but still failed: ${n3.message}`,line:H,column:V}],isValid:!1,hasErrors:!0,hasWarnings:!0,errorCount:1,warningCount:1,summary:{parse_error:1,recovery_failed:1}}}else return{issues:[{type:"parse_error",severity:C3.ERROR,reason:`Failed to parse SVG: ${v}`,line:H,column:V}],isValid:!1,hasErrors:!0,hasWarnings:!1,errorCount:1,warningCount:0,summary:{parse_error:1}}}let x=[];if(m.length>0)x.push(...m);let D=new Map,S=(M)=>{let v=M.toLowerCase(),H=D.get(v)||0;return D.set(v,H+1),H},P=()=>{D.clear()},T=(M,v,H=null,V=null)=>{let t3;if(H)t3=g.getAttributePosition(v,H,V||0);else t3=g.getElementPosition(v,V||0);let l3=Sn[M.type]||C3.WARNING,n3={...M,severity:l3,line:t3.line,column:t3.column};if(n&&p&&t3.line>0&&t3.line<=p.length)n3.sourceLine=p[t3.line-1];return n3},f=new Set,X=(M)=>{if(!M)return;let v=M.getAttribute("id");if(v)f.add(v);for(let H of M.children)if(Z(H))X(H)};X(c);let B=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],L=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);if(v==="g"){for(let V of B)if(M.hasAttribute(V))x.push(T({type:"invalid_attr_on_element",element:v,attr:V,value:M.getAttribute(V),reason:`SVG 1.1: <g> elements do not support '${V}' attribute`},v,V,H))}for(let V of M.children)if(Z(V))L(V)},R=()=>{let M=!1,v=null,H=null,V=(t3)=>{for(let l3 of t3.getAttributeNames())if(l3.startsWith("xlink:")){M=!0,v=t3.tagName.toLowerCase(),H=l3;return}for(let l3 of t3.children){if(Z(l3))V(l3);if(M)return}};if(V(c),M&&!c.hasAttribute("xmlns:xlink")){let t3=g.getAttributePosition(v,H,0);x.push({type:"missing_namespace",namespace:"xmlns:xlink",reason:"Document uses xlink:* attributes but missing xmlns:xlink namespace declaration",line:t3.line,column:t3.column})}},N=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of["xlink:href","href"]){let t3=M.getAttribute(V);if(t3&&t3.startsWith("#")){let l3=t3.slice(1);if(l3&&!f.has(l3))x.push(T({type:"broken_reference",element:v,attr:V,referencedId:l3,reason:`Reference to non-existent ID '${l3}'`},v,V,H))}}for(let V of M.children)if(Z(V))N(V)},u=["begin","end","dur","repeatDur","min","max"],O=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),Y=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);if(O.has(v))for(let V of u){let t3=M.getAttribute(V);if(t3){let l3=t3.trim();if(l3!==t3)x.push(T({type:"invalid_timing",element:v,attr:V,value:t3,reason:"Timing value has leading/trailing whitespace"},v,V,H));if(/[;,]/.test(l3)&&!/^[\d\w\s.;,+-]+$/.test(l3))x.push(T({type:"invalid_timing",element:v,attr:V,value:t3,reason:"Timing value may contain invalid characters"},v,V,H))}}for(let V of M.children)if(Z(V))Y(V)},j=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),_=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);if(j.has(v)){for(let V of M.children)if(Z(V)){let t3=V.tagName.toLowerCase();if(O.has(t3))x.push(T({type:"animation_in_empty_element",element:v,child:t3,reason:`Animation element <${t3}> inside <${v}> which has EMPTY content model per SVG 1.1 DTD`},v,null,H))}}for(let V of M.children)if(Z(V))_(V)},A=/(\d+\.?\d*)(PX|EM|EX|PT|PC|CM|MM|IN|%)/gi,W=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","font-size","letter-spacing","word-spacing","stroke-dashoffset"],C=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of W){let t3=M.getAttribute(V);if(t3){let l3=t3.match(A);if(l3)for(let n3 of l3){let s3=n3.replace(/[\d.]+/,"");if(s3!==s3.toLowerCase())x.push(T({type:"uppercase_unit",element:v,attr:V,value:t3,reason:`Unit '${s3}' should be lowercase '${s3.toLowerCase()}'`},v,V,H))}}}for(let V of M.children)if(Z(V))C(V)},z=["points","viewBox","d","values","keyTimes","keySplines","rotate"],o3=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of z){let t3=M.getAttribute(V);if(t3){if(/[\t\n\r]/.test(t3)||/ +/.test(t3))x.push(T({type:"invalid_whitespace",element:v,attr:V,reason:"List attribute contains tabs, newlines, or multiple consecutive spaces"},v,V,H))}}for(let V of M.children)if(Z(V))o3(V)},K=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity","font-size"],$=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of K){let t3=M.getAttribute(V);if(t3){let l3=t3.trim();if(/^0\d/.test(l3.replace(/[a-z%]+$/i,"")))x.push(T({type:"invalid_number",element:v,attr:V,value:t3,reason:"Number has unnecessary leading zeros"},v,V,H));if(/\.$/.test(l3.replace(/[a-z%]+$/i,"")))x.push(T({type:"invalid_number",element:v,attr:V,value:t3,reason:"Number has trailing decimal point"},v,V,H))}}for(let V of M.children)if(Z(V))$(V)},w=(M,v=!1)=>{let H=M.tagName,V=H.toLowerCase(),t3=S(V),l3=H.includes(":"),n3=v||c9.has(V)||l3;if(!n3){if(!Z4.has(H)&&!j2.has(V)){if(!Ko(V)){let s3=n5(H,Z4);if(s3)x.push(T({type:"mistyped_element_detected",element:H,suggestion:s3,reason:`Unknown element <${H}> - did you mean <${s3}>?`},V,null,t3));else x.push(T({type:"unknown_element_detected",element:H,reason:`Unknown element <${H}> - not in SVG 1.1 spec`},V,null,t3))}}}for(let s3 of M.children)if(Z(s3))w(s3,n3)},F=(M,v=!1)=>{let H=M.tagName.toLowerCase(),V=S(H),t3=M.tagName.includes(":"),l3=v||c9.has(H)||t3;if(!l3)for(let n3 of M.getAttributeNames()){if(n3.startsWith("data-")||n3.startsWith("aria-"))continue;if(n3==="xmlns"||n3.startsWith("xmlns:"))continue;if(n3.includes(":")&&!n3.startsWith("xlink:")&&!n3.startsWith("xml:"))continue;if(Zo(n3))continue;if(!J4.has(n3)&&!W2.has(n3.toLowerCase())){let s3=n5(n3,J4);if(s3)x.push(T({type:"mistyped_attribute_detected",element:H,attr:n3,suggestion:s3,reason:`Unknown attribute '${n3}' - did you mean '${s3}'?`},H,n3,V));else x.push(T({type:"unknown_attribute_detected",element:H,attr:n3,reason:`Unknown attribute '${n3}' on <${H}> - not in SVG 1.1 spec`},H,n3,V))}}for(let n3 of M.children)if(Z(n3))F(n3,l3)},a3={use:["xlink:href","href"],image:["xlink:href","href"],feImage:["xlink:href","href"],textPath:["xlink:href","href"],mpath:["xlink:href","href"],animate:["attributeName"],animateTransform:["attributeName","type"],animateMotion:[],animateColor:["attributeName"],set:["attributeName"],feBlend:["in2"],feComposite:["in2"],feDisplacementMap:["in2","scale"],feMorphology:["operator"],feTurbulence:["type"],feConvolveMatrix:["kernelMatrix"],feFuncR:["type"],feFuncG:["type"],feFuncB:["type"],feFuncA:["type"],linearGradient:[],radialGradient:[],stop:["offset"]},e3=(M)=>{let v=M.tagName.toLowerCase(),H=S(v),V=a3[v];if(V&&V.length>0){if(V.includes("xlink:href")&&V.includes("href")){if(!M.hasAttribute("xlink:href")&&!M.hasAttribute("href"))x.push(T({type:"missing_required_attribute",element:v,attrs:["href","xlink:href"],reason:`<${v}> requires 'href' or 'xlink:href' attribute`},v,null,H))}else for(let t3 of V)if(!M.hasAttribute(t3))x.push(T({type:"missing_required_attribute",element:v,attr:t3,reason:`<${v}> requires '${t3}' attribute per SVG 1.1 DTD`},v,t3,H))}for(let t3 of M.children)if(Z(t3))e3(t3)},i3={linearGradient:new Set(["stop","animate","animateTransform","set"]),radialGradient:new Set(["stop","animate","animateTransform","set"]),stop:new Set(["animate","set"]),clipPath:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","animate","animateTransform","set","desc","title"]),mask:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","g","defs","image","switch","a","animate","animateTransform","set","desc","title"])},y3=(M)=>{let v=M.tagName.toLowerCase(),H=S(v),V=i3[v];if(V){for(let t3 of M.children)if(Z(t3)){let l3=t3.tagName.toLowerCase();if(!l3.includes(":")&&!V.has(l3))x.push(T({type:"invalid_child_element",element:v,child:l3,reason:`<${l3}> is not a valid child of <${v}> per SVG 1.1 DTD`},v,null,H))}}for(let t3 of M.children)if(Z(t3))y3(t3)},u3={spreadMethod:new Set(["pad","reflect","repeat"]),gradientUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),clipPathUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),filterUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),primitiveUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),markerUnits:new Set(["strokeWidth","userSpaceOnUse"]),"fill-rule":new Set(["nonzero","evenodd","inherit"]),"clip-rule":new Set(["nonzero","evenodd","inherit"]),"stroke-linecap":new Set(["butt","round","square","inherit"]),"stroke-linejoin":new Set(["miter","round","bevel","inherit"]),"text-anchor":new Set(["start","middle","end","inherit"]),"dominant-baseline":new Set(["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"]),"alignment-baseline":new Set(["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]),visibility:new Set(["visible","hidden","collapse","inherit"]),display:new Set(["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"]),overflow:new Set(["visible","hidden","scroll","auto","inherit"])},Q=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let[V,t3]of Object.entries(u3)){let l3=M.getAttribute(V);if(l3&&!t3.has(l3))x.push(T({type:"invalid_enum_value",element:v,attr:V,value:l3,validValues:[...t3],reason:`Invalid value '${l3}' for '${V}'. Valid values: ${[...t3].join(", ")}`},v,V,H))}for(let V of M.children)if(Z(V))Q(V)},J={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"}},g3=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let[V,t3]of Object.entries(J)){let l3=M.getAttribute(V);if(l3){let n3=parseFloat(l3);if(!isNaN(n3)){if(t3.min!==void 0&&n3<t3.min)x.push(T({type:"invalid_numeric_constraint",element:v,attr:V,value:l3,reason:`Value ${n3} is below minimum ${t3.min}`},v,V,H));if(t3.max!==void 0&&n3>t3.max)x.push(T({type:"invalid_numeric_constraint",element:v,attr:V,value:l3,reason:`Value ${n3} is above maximum ${t3.max}`},v,V,H))}}}for(let V of M.children)if(Z(V))g3(V)},x3=(M)=>{let v=new Map,H=new Map,V=(t3)=>{let l3=t3.tagName.toLowerCase(),n3=S(l3),s3=t3.getAttribute("id");if(s3){if(!v.has(s3))v.set(s3,[]),H.set(s3,{tagName:l3,occIdx:n3});v.get(s3).push(l3)}for(let w3 of t3.children)if(Z(w3))V(w3)};V(M);for(let[t3,l3]of v)if(l3.length>1){let n3=H.get(t3);x.push(T({type:"duplicate_id",id:t3,elements:l3,count:l3.length,reason:`ID '${t3}' is used ${l3.length} times (on ${l3.join(", ")})`},n3.tagName,"id",n3.occIdx))}},E3=/url\(#([^)]+)\)/g,A3=["fill","stroke","clip-path","mask","filter","color-profile","marker","marker-start","marker-mid","marker-end"],B3=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of A3){let t3=M.getAttribute(V);if(t3){let l3;E3.lastIndex=0;while((l3=E3.exec(t3))!==null){let n3=l3[1];if(!f.has(n3))x.push(T({type:"broken_url_reference",element:v,attr:V,referencedId:n3,reason:`url(#${n3}) references non-existent ID`},v,V,H))}}}for(let V of M.children)if(Z(V))B3(V)},k=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","currentcolor","inherit","none","transparent"]),I=["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"],G=(M)=>{let v=M.toLowerCase().trim();if(k.has(v))return!0;if(/^#[0-9a-f]{3}$/i.test(v))return!0;if(/^#[0-9a-f]{4}$/i.test(v))return!0;if(/^#[0-9a-f]{6}$/i.test(v))return!0;if(/^#[0-9a-f]{8}$/i.test(v))return!0;if(/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+\s*)?\)$/i.test(v))return!0;if(/^rgba?\(\s*\d+%\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+%?\s*)?\)$/i.test(v))return!0;if(/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+\s*)?\)$/i.test(v))return!0;if(/^url\(#[^)]+\)$/i.test(v))return!0;return!1},U=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of I){let t3=M.getAttribute(V);if(t3&&!G(t3))x.push(T({type:"invalid_color",element:v,attr:V,value:t3,reason:`Invalid color value '${t3}'`},v,V,H))}for(let V of M.children)if(Z(V))U(V)},q=(M)=>{let v=M.tagName.toLowerCase(),H=S(v),V=M.getAttribute("viewBox");if(V){let n3=V.trim().split(/[\s,]+/);if(n3.length!==4||!n3.every((s3)=>!isNaN(parseFloat(s3))))x.push(T({type:"malformed_viewbox",element:v,value:V,reason:"viewBox must be exactly 4 numbers (min-x, min-y, width, height)"},v,"viewBox",H))}let t3=M.getAttribute("points");if(t3){let n3=t3.trim().split(/[\s,]+/).filter((s3)=>s3);if(n3.length%2!==0||!n3.every((s3)=>!isNaN(parseFloat(s3))))x.push(T({type:"malformed_points",element:v,value:t3.length>50?t3.substring(0,50)+"...":t3,reason:"points must be pairs of numbers"},v,"points",H))}let l3=M.getAttribute("transform");if(l3){let n3=/^\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20},?\s{0,20}/,s3=l3.trim();while(s3.length>0){let w3=s3.match(n3);if(w3&&w3[0].length>0)s3=s3.substring(w3[0].length);else if(!w3){x.push(T({type:"malformed_transform",element:v,value:l3.length>50?l3.substring(0,50)+"...":l3,reason:`Invalid transform syntax near '${s3.substring(0,20)}'`},v,"transform",H));break}else s3=s3.substring(1)}}if(v==="path"){let n3=M.getAttribute("d");if(n3){let s3=n3.trim();if(s3.length>0){if(!/^[Mm]/.test(s3))x.push(T({type:"malformed_path_data",element:"path",value:n3.length>50?n3.substring(0,50)+"...":n3,reason:"Path data must start with M or m command"},"path","d",H));let w3=s3.replace(/[MmZzLlHhVvCcSsQqTtAa\d\s,.\-+eE]/g,"");if(w3.length>0)x.push(T({type:"malformed_path_data",element:"path",value:n3.length>50?n3.substring(0,50)+"...":n3,reason:`Path data contains invalid characters: '${w3.substring(0,10)}'`},"path","d",H))}}}for(let n3 of M.children)if(Z(n3))q(n3)},c3=()=>{let M=new Map,v=(n3)=>{let s3=n3.getAttribute("id");if(s3)M.set(s3,n3);for(let w3 of n3.children)if(Z(w3))v(w3)};v(c);let H=["href","xlink:href","mask","clip-path","filter","fill","stroke"],V=(n3)=>{if(!n3)return null;let s3=n3.match(/url\(#([^)]+)\)/);if(s3)return s3[1];let w3=n3.match(/^#(.+)$/);if(w3)return w3[1];return null},t3=(n3,s3=new Set)=>{if(s3.has(n3))return!0;let w3=M.get(n3);if(!w3)return!1;s3.add(n3);let V3=(r4)=>{for(let Q3 of H){let f0=V(r4.getAttribute(Q3));if(f0&&t3(f0,s3))return!0}for(let Q3 of r4.children)if(Z(Q3)&&V3(Q3))return!0;return!1},K3=V3(w3);return s3.delete(n3),K3},l3=["clipPath","mask","filter","symbol","pattern","marker"];for(let[n3,s3]of M){let w3=s3.tagName.toLowerCase();if(l3.includes(w3)){if(t3(n3)){P();let V3=S(w3);x.push(T({type:"circular_reference",element:w3,attr:"id",value:n3,reason:`Circular reference detected: '${n3}' directly or indirectly references itself`},w3,"id",V3))}}}},b3=50,N3=(M,v=0)=>{if(v>b3){let H=M.tagName.toLowerCase(),V=S(H);x.push(T({type:"deep_nesting",element:H,value:String(v),reason:`Element nesting depth (${v}) exceeds ${b3} levels`},H,null,V));return}for(let H of M.children)if(Z(H))N3(H,v+1)},R3=(M)=>{let v=M.tagName.toLowerCase();if(v==="defs"){let H=!1;for(let V of M.childNodes)if(Z(V)){H=!0;break}if(!H){let V=S(v);x.push(T({type:"empty_defs",element:v,reason:"Empty <defs> element (can be removed)"},v,null,V))}}for(let H of M.children)if(Z(H))R3(H)},E4=(M)=>{let v=M.tagName.toLowerCase();if(v==="lineargradient"||v==="radialgradient"){let H=Array.from(M.children).filter((V)=>Z(V)&&V.tagName.toLowerCase()==="stop");if(H.length>=2){let V=-1;for(let t3 of H){let l3=t3.getAttribute("offset")||"0",n3=parseFloat(l3);if(l3.includes("%"))n3=n3/100;if(!isNaN(n3)&&n3<V){let s3=S(v);x.push(T({type:"gradient_stop_order",element:v,reason:`Gradient stops not in ascending offset order (${V} followed by ${n3})`},v,null,s3));break}if(!isNaN(n3))V=n3}}}for(let H of M.children)if(Z(H))E4(H)},D5=1e4,f4=(M)=>{let v=M.tagName.toLowerCase();if(v==="path"){let H=M.getAttribute("d");if(H){let V=H.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g);if(V&&V.length>D5){let t3=S(v);x.push(T({type:"path_complexity",element:v,attr:"d",value:`${V.length} coordinates`,reason:`Path has ${V.length} coordinates (>${D5}), may cause slow rendering`},v,"d",t3))}}}for(let H of M.children)if(Z(H))f4(H)},e5=(M)=>{let v=M.tagName.toLowerCase(),H=S(v),V=["href","xlink:href"];for(let t3 of V){let l3=M.getAttribute(t3);if(l3&&(l3.startsWith("http://")||l3.startsWith("https://")||l3.startsWith("//")))x.push(T({type:"external_resource",element:v,attr:t3,value:l3.length>60?l3.substring(0,60)+"...":l3,reason:"External resource reference detected (potential security/CORS issue)"},v,t3,H))}if(v==="style"&&M.textContent){let t3=M.textContent.match(/@import\s+url\s*\(\s*['"]?(https?:\/\/[^'")\s]+)/i);if(t3)x.push(T({type:"external_resource",element:v,value:t3[1],reason:"External CSS import detected in style element"},v,null,H))}for(let t3 of M.children)if(Z(t3))e5(t3)},T0=(M)=>{let v=M.tagName.toLowerCase();if(v==="script"){let H=S(v);x.push(T({type:"script_content",element:v,reason:"Script element detected (potential security issue in untrusted SVGs)"},v,null,H))}for(let H of M.children)if(Z(H))T0(H)},A0=(M)=>{let v=M.tagName.toLowerCase(),H=S(v);for(let V of M.getAttributeNames())if(En.has(V.toLowerCase()))x.push(T({type:"event_handler",element:v,attr:V,reason:`Event handler attribute '${V}' detected (potential XSS vector)`},v,V,H));for(let V of M.children)if(Z(V))A0(V)},pa=()=>{let M=!1,v=!1,H=!1,V=c.hasAttribute("lang")||c.hasAttribute("xml:lang"),t3=(w3)=>{for(let V3 of w3.children){if(!Z(V3))continue;let K3=V3.tagName.toLowerCase();if(K3==="title")M=!0;if(K3==="desc")v=!0;if(K3==="text"||K3==="tspan"||K3==="textpath")H=!0;t3(V3)}};if(t3(c),!M)x.push(T({type:"missing_title",element:"svg",reason:"Missing <title> element (recommended for accessibility)"},"svg",null,0));let l3=0,n3=(w3)=>{l3++;for(let V3 of w3.children)if(Z(V3))n3(V3)};if(n3(c),!v&&l3>10)x.push(T({type:"missing_desc",element:"svg",reason:`Missing <desc> element (recommended for complex SVGs with ${l3} elements)`},"svg",null,0));if(H&&!V)x.push(T({type:"missing_lang",element:"svg",reason:"Missing lang attribute on SVG with text content"},"svg",null,0));let s3=(w3)=>{let V3=w3.tagName.toLowerCase(),K3=S(V3);for(let r4 of w3.getAttributeNames()){if(r4.startsWith("aria-")&&!bn.has(r4.toLowerCase()))x.push(T({type:"invalid_aria",element:V3,attr:r4,reason:`Unknown ARIA attribute '${r4}'`},V3,r4,K3));if(r4==="role"){let Q3=w3.getAttribute("role");if(Q3&&!S9.has(Q3.toLowerCase()))x.push(T({type:"invalid_aria",element:V3,attr:"role",value:Q3,reason:`Invalid role value '${Q3}' (valid: ${Array.from(S9).slice(0,5).join(", ")}...)`},V3,"role",K3))}if(r4==="aria-hidden"){let Q3=w3.getAttribute("aria-hidden");if(Q3&&Q3!=="true"&&Q3!=="false")x.push(T({type:"invalid_aria",element:V3,attr:"aria-hidden",value:Q3,reason:`aria-hidden must be 'true' or 'false', got '${Q3}'`},V3,"aria-hidden",K3))}}for(let r4 of w3.children)if(Z(r4))s3(r4)};P(),s3(c)};P(),L(c),R(),P(),N(c),P(),Y(c),P(),_(c),P(),C(c),P(),o3(c),P(),$(c),P(),w(c),P(),F(c),P(),e3(c),P(),y3(c),P(),Q(c),P(),g3(c),P(),x3(c),P(),B3(c),P(),U(c),P(),q(c),P(),c3(),P(),N3(c),P(),R3(c),P(),E4(c),P(),f4(c),P(),e5(c),P(),T0(c),P(),A0(c),pa(),x.sort((M,v)=>{if(M.line!==v.line)return M.line-v.line;return M.column-v.column});let O5=x;if(r)O5=x.filter((M)=>M.severity===C3.ERROR);let P2=x.filter((M)=>M.severity===C3.ERROR).length,C0=x.filter((M)=>M.severity===C3.WARNING).length,T2={};for(let M of O5)T2[M.type]=(T2[M.type]||0)+1;let z4={issues:O5,isValid:P2===0,hasErrors:P2>0,hasWarnings:C0>0,errorCount:P2,warningCount:C0,issueCount:O5.length,summary:T2};if(e)try{let M=await import("node:fs/promises"),v=await Promise.resolve().then(()=>(A5(),i5)),H;switch(o){case"json":H=JSON.stringify(z4,null,2);break;case"yaml":H=Cn(z4);break;case"xml":H=fn(z4);break;case"text":default:H=An(z4);break}let V=v.normalize(e);await M.writeFile(V,H,"utf8"),z4.outputFile=V}catch(M){z4.exportError=`Failed to write report to '${e}': ${M.message}`}return z4}function An(t){let a=["=".repeat(60),"SVG VALIDATION REPORT","=".repeat(60),"",`Status: ${t.isValid?"VALID":"INVALID"}`,`Errors: ${t.errorCount}`,`Warnings: ${t.warningCount}`,`Total Issues: ${t.issueCount}`,""];if(t.issues.length>0){a.push("-".repeat(60)),a.push("ISSUES:"),a.push("-".repeat(60)),a.push("");for(let r of t.issues){let e=r.severity.toUpperCase(),o=`${r.line}:${r.column}`;if(a.push(`[${e}] Line ${o}: ${r.type}`),r.element)a.push(` Element: <${r.element}>`);if(r.attr)a.push(` Attribute: ${r.attr}`);if(r.value)a.push(` Value: ${r.value}`);if(a.push(` ${r.reason}`),r.sourceLine)a.push(` Source: ${r.sourceLine.trim()}`);a.push("")}}a.push("=".repeat(60)),a.push("SUMMARY BY TYPE:"),a.push("-".repeat(60));for(let[r,e]of Object.entries(t.summary))a.push(` ${r}: ${e}`);return a.push("=".repeat(60)),a.join(`
|
|
432
|
-
`)}function
|
|
433
|
-
`)}function
|
|
434
|
-
`)}function
|
|
349
|
+
`;return bK({title:"SVG Compatibility Matrix",subtitle:"What problems will your SVG have in each configuration?",columns:Z,rowLevels:K,rowData:Q,getCellContent:H,additionalSections:[{title:"SERVER-SIDE SVG RENDERERS (no HTML embedding)",content:q,height:z.length*30+20}],legend:j,options:{fontFamily:J,minCellWidth:220,legendHeight:1020,...$}})}var fK=G0(($,J={})=>{let Z=J.fixInvalidGroupAttrs!==!1,K=J.fixMissingNamespaces!==!1,Q=J.fixBrokenRefs!==!1,H=J.fixAnimationTiming!==!1,z=J.verbose||!1,q=[],W=new Set,j=(b)=>{let C=b.getAttribute("id");if(C)W.add(C);for(let l of b.children)if(a(l))j(l)};j($);let G=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],F=new Set(["svg","rect","image","foreignObject","use","symbol","pattern","mask","filter","clipPath"]),_=(b)=>{let C=b.tagName.toLowerCase();if(C==="g"&&Z){for(let l of G)if(b.hasAttribute(l)){let g=b.getAttribute(l);b.removeAttribute(l),q.push({type:"invalid_attr_removed",element:C,attr:l,value:g,reason:`SVG 1.1: <g> elements do not support '${l}' attribute`})}}for(let l of b.children)if(a(l))_(l)},U=()=>{if(!K)return;let b=!1,C=(l)=>{for(let g of l.getAttributeNames())if(g.startsWith("xlink:")){b=!0;return}for(let g of l.children){if(a(g))C(g);if(b)return}};if(C($),b&&!$.hasAttribute("xmlns:xlink"))$.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),q.push({type:"namespace_added",namespace:"xmlns:xlink",value:"http://www.w3.org/1999/xlink",reason:"SVG 1.1: xmlns:xlink required when xlink:* attributes are present"})},O=(b)=>{let C=[b,b.replace(/^FRAME(\d+)$/,"FRAME0$1"),b.replace(/^FRAME0(\d+)$/,"FRAME00$1"),b.replace(/^FRAME00(\d+)$/,"FRAME000$1"),b.replace(/^FRAME0+(\d+)$/,"FRAME$1"),b.replace(/^FRAME(\d)$/,"FRAME0000$1"),b.replace(/^FRAME(\d{2})$/,"FRAME000$1"),b.replace(/^FRAME(\d{3})$/,"FRAME00$1"),b.replace(/^FRAME(\d{4})$/,"FRAME0$1")];for(let n of C)if(W.has(n)&&n!==b)return n;let l=null,g=1/0;for(let n of W)if(n.toLowerCase().includes(b.toLowerCase())||b.toLowerCase().includes(n.toLowerCase())){let j0=Math.abs(n.length-b.length);if(j0<g&&j0<=2)g=j0,l=n}return l},V=(b)=>{if(!Q)return;for(let C of["href","xlink:href"]){let l=b.getAttribute(C);if(l&&l.startsWith("#")){let g=l.substring(1);if(!W.has(g)){let n=O(g);if(n)b.setAttribute(C,`#${n}`),q.push({type:"ref_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:`#${n}`,reason:`ID '${g}' not found, fixed to similar ID '${n}'`})}}}if(b.tagName.toLowerCase()==="animate"){let C=b.getAttribute("attributeName");if(C==="href"||C==="xlink:href"){let l=b.getAttribute("values");if(l){let g=l.split(";"),n=!1,j0=g.map((L0)=>{let C0=L0.trim();if(C0.startsWith("#")){let E0=C0.substring(1);if(!W.has(E0)){let U7=O(E0);if(U7)return n=!0,`#${U7}`}}return C0});if(n){let L0=j0.join(";");b.setAttribute("values",L0),q.push({type:"animate_values_fixed",oldValue:l,newValue:L0,reason:"Fixed broken ID references in animate values"})}}}}for(let C of["fill","stroke","clip-path","mask","filter"]){let l=b.getAttribute(C);if(l&&l.startsWith("url(#")){let g=l.match(/url\(#([^)]+)\)/);if(g){let n=g[1];if(!W.has(n)){let j0=O(n);if(j0)b.setAttribute(C,`url(#${j0})`),q.push({type:"url_ref_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:`url(#${j0})`,reason:`ID '${n}' not found, fixed to similar ID '${j0}'`})}}}}for(let C of b.children)if(a(C))V(C)},M=(b)=>{if(!H)return;let C=["animate","animateTransform","animateMotion","animateColor","set"],l=b.tagName.toLowerCase();if(C.includes(l)){let g=b.getAttribute("dur"),n=b.getAttribute("repeatCount");if(g==="0"||g==="0s"){if(!b.getAttribute("keyTimes"))q.push({type:"timing_warning",element:l,attr:"dur",value:g,reason:'dur="0" may cause animation to not play'})}let j0=b.getAttribute("begin");if(j0){let L0=j0;if(j0==="0")L0="0s",b.setAttribute("begin",L0),q.push({type:"timing_normalized",element:l,attr:"begin",oldValue:j0,newValue:L0,reason:"Normalized begin value to include time unit"})}}for(let g of b.children)if(a(g))M(g)},Y=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),X=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),w=(b)=>{let C=b.tagName.toLowerCase();if(Y.has(C)){let l=[];for(let g of Array.from(b.children))if(a(g)&&X.has(g.tagName.toLowerCase()))l.push(g);if(l.length>0){let g=b.getAttribute("id");if(!g)g=`_fix_${C}_${Math.random().toString(36).substring(2,8)}`,b.setAttribute("id",g),q.push({type:"id_generated",element:C,id:g,reason:"Generated ID for animation targeting after moving animate element"});for(let n of l){if(b.removeChild(n),!n.hasAttribute("href")&&!n.hasAttribute("xlink:href"))n.setAttribute("href",`#${g}`);let j0=b.parentNode;if(j0){let L0=b.nextSibling;if(L0)j0.insertBefore(n,L0);else j0.appendChild(n)}q.push({type:"animation_moved_from_empty_element",element:n.tagName.toLowerCase(),parentElement:C,targetId:g,reason:`SVG 1.1: <${C}> has EMPTY content model and cannot have children. Animation moved outside and targets element via href="#${g}".`})}}}for(let l of Array.from(b.children))if(a(l))w(l)},R=/^([+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?)(EM|EX|PX|IN|CM|MM|PT|PC|DEG|GRAD|RAD|S|MS|HZ|KHZ|%)$/i,I=new Set(["x","y","width","height","rx","ry","cx","cy","r","fx","fy","x1","y1","x2","y2","dx","dy","textLength","startOffset","stroke-width","stroke-dashoffset","font-size","baseline-shift","kerning","letter-spacing","word-spacing","markerWidth","markerHeight","refX","refY","stdDeviation","radius"]),f=(b)=>{for(let C of b.getAttributeNames()){if(!I.has(C)&&!C.includes("-"))continue;let l=b.getAttribute(C);if(!l)continue;let g=l.match(R);if(g){let[,n,j0]=g,L0=j0.toLowerCase();if(j0!==L0){let C0=n+L0;b.setAttribute(C,C0),q.push({type:"unit_normalized",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:C0,reason:"SVG 1.1: Unit identifiers in attributes must be lowercase"})}}}for(let C of b.children)if(a(C))f(C)},u=/[\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/g,m=new Set(["points","viewBox","preserveAspectRatio","transform","d","values","keyTimes","keySplines","keyPoints","rotate","stroke-dasharray","baseFrequency","kernelMatrix","tableValues","filterRes","stdDeviation","radius","origin"]),S=(b)=>{for(let C of b.getAttributeNames()){if(!m.has(C)&&C!=="style")continue;let l=b.getAttribute(C);if(!l)continue;if(u.test(l)){let g=l.replace(u," ");b.setAttribute(C,g),q.push({type:"whitespace_normalized",element:b.tagName.toLowerCase(),attr:C,reason:"SVG 1.1: Replaced invalid Unicode whitespace with standard space (0x20)"})}}for(let C of b.children)if(a(C))S(C)},x=(b)=>{for(let C of b.getAttributeNames()){let l=b.getAttribute(C);if(!l)continue;let g=l,n=!1;if(/\d\.$/.test(g)||/\d\.(?=[,\s;)])/.test(g))g=g.replace(/(\d)\.(?=$|[,\s;)])/g,"$1"),n=!0;if(g=g.replace(/(^|[,\s;(])\.(\d)/g,"$10.$2"),g=g.replace(/(^|[,\s;(])-\.(\d)/g,"$1-0.$2"),g!==l)n=!0;if(/\.\.+/.test(g))g=g.replace(/\.\.+/g,"."),n=!0;if(n)b.setAttribute(C,g),q.push({type:"number_format_fixed",element:b.tagName.toLowerCase(),attr:C,oldValue:l,newValue:g,reason:"SVG 1.1: Fixed invalid number format"})}for(let C of b.children)if(a(C))x(C)},h=340000000000000000000000000000000000000,E=-340000000000000000000000000000000000000,d=/[+-]?\d*\.?\d+(?:[Ee][+-]?\d+)?/g,c=(b)=>{for(let C of b.getAttributeNames()){let l=b.getAttribute(C);if(!l)continue;if(C==="id"||C==="class"||C.startsWith("xmlns")||C==="href"||C==="xlink:href"||C==="style")continue;let g=l.match(d);if(!g)continue;for(let n of g){let j0=parseFloat(n);if(!isFinite(j0))q.push({type:"invalid_number_detected",element:b.tagName.toLowerCase(),attr:C,value:n,reason:"SVG 1.1: Invalid number (Infinity or NaN)"});else if(j0>h||j0<E)q.push({type:"out_of_range_detected",element:b.tagName.toLowerCase(),attr:C,value:n,reason:"SVG 1.1: Number exceeds single-precision float range"})}}for(let C of b.children)if(a(C))c(C)},p=(b)=>{let C=b.tagName,l=C.toLowerCase();if(C.includes(":")||G6.has(C)||t9.has(l));else{let g=P6(C,G6);if(g)q.push({type:"mistyped_element_detected",element:C,suggestion:g,reason:`Unknown element <${C}> - did you mean <${g}>?`});else q.push({type:"unknown_element_detected",element:C,reason:`Unknown element <${C}> - not in SVG 1.1 spec`})}for(let g of b.children)if(a(g))p(g)},N=(b)=>{for(let C of b.getAttributeNames()){if(C.startsWith("xmlns")||C.startsWith("data-"))continue;let l=C.toLowerCase();if(F6.has(C)||e9.has(l))continue;if(C.startsWith("-webkit-")||C.startsWith("-moz-")||C.startsWith("-ms-")||C.startsWith("-o-"))continue;if(C.includes(":")&&!C.startsWith("xlink:")&&!C.startsWith("xml:"))continue;let g=P6(C,F6);if(g)q.push({type:"mistyped_attribute_detected",element:b.tagName.toLowerCase(),attr:C,suggestion:g,reason:`Unknown attribute '${C}' on <${b.tagName.toLowerCase()}> - did you mean '${g}'?`})}for(let C of b.children)if(a(C))N(C)},y={a:["href"],animate:["attributeName"],animateColor:["attributeName"],animateTransform:["attributeName"],circle:["r"],"color-profile":["name"],cursor:["href"],ellipse:["rx","ry"],feBlend:["in2"],feComposite:["in2"],feConvolveMatrix:["kernelMatrix"],feDisplacementMap:["in2"],feFuncA:["type"],feFuncB:["type"],feFuncG:["type"],feFuncR:["type"],feImage:["href"],font:["horiz-adv-x"],"font-face-uri":["href"],foreignObject:["width","height"],hkern:["k"],image:["href","width","height"],mpath:["href"],path:["d"],polygon:["points"],polyline:["points"],rect:["width","height"],script:["type"],set:["attributeName"],stop:["offset"],style:["type"],textPath:["href"],tref:["href"],use:["href"],vkern:["k"]},B=["href","xlink:href"],e=(b)=>{let C=b.tagName.toLowerCase(),l=y[C];if(l){for(let g of l)if(g==="href"){if(!B.some((j0)=>b.hasAttribute(j0)))q.push({type:"missing_required_attribute",element:C,attr:g,reason:`Element <${C}> is missing required attribute '${g}' (or 'xlink:href')`})}else if(!b.hasAttribute(g))q.push({type:"missing_required_attribute",element:C,attr:g,reason:`Element <${C}> is missing required attribute '${g}'`})}for(let g of b.children)if(a(g))e(g)},r={circle:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),ellipse:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),line:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),path:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polygon:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),polyline:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),rect:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),use:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),image:new Set(["desc","title","metadata","animate","animatecolor","animatemotion","animatetransform","set"]),animate:new Set(["desc","title","metadata"]),animatecolor:new Set(["desc","title","metadata"]),animatemotion:new Set(["desc","title","metadata","mpath"]),animatetransform:new Set(["desc","title","metadata"]),set:new Set(["desc","title","metadata"]),lineargradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),radialgradient:new Set(["desc","title","metadata","animate","animatetransform","set","stop"]),filter:new Set(["desc","title","metadata","animate","set","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","feflood","fegaussianblur","feimage","femerge","femorphology","feoffset","fespecularlighting","fetile","feturbulence"]),stop:new Set(["animate","animatecolor","set"])},s=(b)=>{let C=b.tagName.toLowerCase(),l=r[C];if(l){for(let g of b.children)if(a(g)){let n=g.tagName.toLowerCase();if(!n.includes(":")&&!l.has(n))q.push({type:"invalid_child_element",parent:C,child:n,reason:`Element <${n}> is not a valid child of <${C}> per SVG 1.1 DTD`})}}for(let g of b.children)if(a(g))s(g)},z0={"alignment-baseline":["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"],"clip-rule":["nonzero","evenodd","inherit"],"color-interpolation":["auto","sRGB","linearRGB","inherit"],"color-interpolation-filters":["auto","sRGB","linearRGB","inherit"],"color-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],direction:["ltr","rtl","inherit"],display:["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"],"dominant-baseline":["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"],"fill-rule":["nonzero","evenodd","inherit"],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded","inherit"],"font-style":["normal","italic","oblique","inherit"],"font-variant":["normal","small-caps","inherit"],"font-weight":["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","inherit"],"image-rendering":["auto","optimizeSpeed","optimizeQuality","inherit"],overflow:["visible","hidden","scroll","auto","inherit"],"pointer-events":["visiblePainted","visibleFill","visibleStroke","visible","painted","fill","stroke","all","none","inherit"],"shape-rendering":["auto","optimizeSpeed","crispEdges","geometricPrecision","inherit"],"stroke-linecap":["butt","round","square","inherit"],"stroke-linejoin":["miter","round","bevel","inherit"],"text-anchor":["start","middle","end","inherit"],"text-rendering":["auto","optimizeSpeed","optimizeLegibility","geometricPrecision","inherit"],"unicode-bidi":["normal","embed","bidi-override","inherit"],visibility:["visible","hidden","collapse","inherit"],"writing-mode":["lr-tb","rl-tb","tb-rl","lr","rl","tb","inherit"],"xml:space":["default","preserve"],additive:["replace","sum"],accumulate:["none","sum"],calcMode:["discrete","linear","paced","spline"],fill:["freeze","remove"],restart:["always","whenNotActive","never"],attributeType:["CSS","XML","auto"],edgeMode:["duplicate","wrap","none"],operator:["over","in","out","atop","xor","arithmetic","erode","dilate"],mode:["normal","multiply","screen","darken","lighten"],type:["translate","scale","rotate","skewX","skewY","matrix","saturate","hueRotate","luminanceToAlpha","identity","table","discrete","linear","gamma","fractalNoise","turbulence"],spreadMethod:["pad","reflect","repeat"],gradientUnits:["userSpaceOnUse","objectBoundingBox"],patternUnits:["userSpaceOnUse","objectBoundingBox"],patternContentUnits:["userSpaceOnUse","objectBoundingBox"],clipPathUnits:["userSpaceOnUse","objectBoundingBox"],maskUnits:["userSpaceOnUse","objectBoundingBox"],maskContentUnits:["userSpaceOnUse","objectBoundingBox"],filterUnits:["userSpaceOnUse","objectBoundingBox"],primitiveUnits:["userSpaceOnUse","objectBoundingBox"],markerUnits:["strokeWidth","userSpaceOnUse"],method:["align","stretch"],spacing:["auto","exact"],lengthAdjust:["spacing","spacingAndGlyphs"],preserveAspectRatio:["none","xMinYMin","xMidYMin","xMaxYMin","xMinYMid","xMidYMid","xMaxYMid","xMinYMax","xMidYMax","xMaxYMax"],zoomAndPan:["disable","magnify"],externalResourcesRequired:["true","false"]},T=new Set(["preserveAspectRatio"]),P=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames()){let g=z0[l];if(g){let n=b.getAttribute(l);if(T.has(l)&&n)n=n.split(/\s+/)[0];if(l==="fill"&&!["animate","animatecolor","animatemotion","animatetransform","set"].includes(C))continue;if(!g.includes(n)&&n!=="inherit")q.push({type:"invalid_enum_value",element:C,attr:l,value:n,validValues:g.slice(0,5).join(", ")+(g.length>5?"...":""),reason:`Invalid value '${n}' for attribute '${l}' - must be one of: ${g.slice(0,5).join(", ")}${g.length>5?"...":""}`})}}for(let l of b.children)if(a(l))P(l)},t={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},"font-size":{min:0,type:"length"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"},width:{min:0,type:"length"},height:{min:0,type:"length"},stdDeviation:{min:0,type:"number"},scale:{type:"number"},baseFrequency:{min:0,type:"number"},numOctaves:{min:1,type:"integer"},seed:{min:0,type:"number"},repeatCount:{min:0,type:"number"}},$0=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames()){let g=t[l];if(g){let n=b.getAttribute(l);if(n==="inherit"||n==="none"||n==="indefinite"||n==="auto")continue;let j0=n.match(/^([+-]?\d*\.?\d+)/);if(j0){let L0=parseFloat(j0[1]);if(isNaN(L0))q.push({type:"invalid_numeric_value",element:C,attr:l,value:n,reason:`Invalid numeric value '${n}' for attribute '${l}'`});else{if(g.min!==void 0&&L0<g.min)q.push({type:"numeric_out_of_range",element:C,attr:l,value:n,constraint:`min: ${g.min}`,reason:`Value '${n}' for '${l}' is below minimum (${g.min})`});if(g.max!==void 0&&L0>g.max)q.push({type:"numeric_out_of_range",element:C,attr:l,value:n,constraint:`max: ${g.max}`,reason:`Value '${n}' for '${l}' exceeds maximum (${g.max})`});if(g.type==="integer"&&!Number.isInteger(L0))q.push({type:"invalid_numeric_value",element:C,attr:l,value:n,reason:`Attribute '${l}' requires an integer value, got '${n}'`})}}}}for(let l of b.children)if(a(l))$0(l)},Q0=(b)=>{let C=new Map,l=(g)=>{let n=g.getAttribute("id");if(n){if(!C.has(n))C.set(n,[]);C.get(n).push(g.tagName.toLowerCase())}for(let j0 of g.children)if(a(j0))l(j0)};l(b);for(let[g,n]of C)if(n.length>1)q.push({type:"duplicate_id",id:g,count:n.length,elements:n.join(", "),reason:`Duplicate ID '${g}' found on ${n.length} elements: ${n.join(", ")}`})},V0=(b)=>{let C=new Set,l=(L0)=>{let C0=L0.getAttribute("id");if(C0)C.add(C0);for(let E0 of L0.children)if(a(E0))l(E0)};l(b);let g=/url\(\s*['"]?#([^'")]+)['"]?\s*\)/g,n=/^#(.+)$/,j0=(L0)=>{let C0=L0.tagName.toLowerCase();for(let E0 of L0.getAttributeNames()){let U7=L0.getAttribute(E0),A6;g.lastIndex=0;while((A6=g.exec(U7))!==null){let b7=A6[1];if(!C.has(b7))q.push({type:"broken_reference",element:C0,attr:E0,refId:b7,reason:`Broken reference: url(#${b7}) points to non-existent ID`})}if(E0==="href"||E0==="xlink:href"){let b7=U7.match(n);if(b7){let _6=b7[1];if(!C.has(_6))q.push({type:"broken_reference",element:C0,attr:E0,refId:_6,reason:`Broken reference: ${E0}="#${_6}" points to non-existent ID`})}}}for(let E0 of L0.children)if(a(E0))j0(E0)};j0($)},N0=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),h0=new Set(["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"]),o=(b)=>{let C=b.toLowerCase().trim();if(C==="none"||C==="inherit"||C==="currentcolor")return!0;if(N0.has(C))return!0;if(C.startsWith("url("))return!0;if(/^#[0-9a-f]{3}$/.test(C)||/^#[0-9a-f]{6}$/.test(C))return!0;if(/^rgb\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)$/.test(C))return!0;if(/^rgba\(\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*[\d.]+%?\s*\)$/.test(C))return!0;return!1},J0=(b)=>{let C=b.tagName.toLowerCase();for(let l of b.getAttributeNames())if(h0.has(l)){let g=b.getAttribute(l);if(!o(g))q.push({type:"invalid_color",element:C,attr:l,value:g,reason:`Invalid color value '${g}' for attribute '${l}'`})}for(let l of b.children)if(a(l))J0(l)},F0=(b)=>{let C=b.tagName.toLowerCase();if(["svg","symbol","marker","pattern","view"].includes(C)){let n=b.getAttribute("viewBox");if(n){let j0=n.trim().split(/[\s,]+/);if(j0.length!==4)q.push({type:"malformed_viewbox",element:C,value:n,reason:`viewBox must have exactly 4 values (min-x, min-y, width, height), got ${j0.length}`});else{for(let E0=0;E0<j0.length;E0++)if(!/^[+-]?\d*\.?\d+([Ee][+-]?\d+)?$/.test(j0[E0])){q.push({type:"malformed_viewbox",element:C,value:n,reason:`viewBox contains invalid number '${j0[E0]}' at position ${E0+1}`});break}let L0=parseFloat(j0[2]),C0=parseFloat(j0[3]);if(isNaN(L0)||isNaN(C0)||L0<0||C0<0)q.push({type:"invalid_viewbox_dimensions",element:C,value:n,reason:`viewBox width and height must be valid non-negative numbers, got ${L0}x${C0}`})}}}let l=b.getAttribute("preserveAspectRatio");if(l){if(!/^(none|xMinYMin|xMidYMin|xMaxYMin|xMinYMid|xMidYMid|xMaxYMid|xMinYMax|xMidYMax|xMaxYMax)(\s+(meet|slice))?$/.test(l.trim()))q.push({type:"malformed_preserveaspectratio",element:C,value:l,reason:`Invalid preserveAspectRatio format '${l}'`})}if(["polygon","polyline"].includes(C)){let n=b.getAttribute("points");if(n){let j0=n.trim().split(/[\s,]+/);if(j0.length>0&&j0.length%2!==0)q.push({type:"malformed_points",element:C,value:n.slice(0,50)+(n.length>50?"...":""),reason:`points attribute must have even number of values (x,y pairs), got ${j0.length}`})}}let g=b.getAttribute("transform");if(g){if(!/^(\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20})+$/.test(g.trim())){if(!/^[\s\w(),.\-+]+$/.test(g))q.push({type:"malformed_transform",element:C,value:g.slice(0,50)+(g.length>50?"...":""),reason:"Potentially malformed transform attribute"})}}for(let n of b.children)if(a(n))F0(n)},O0=(b)=>{let C=b.tagName,l=C.toLowerCase();if(C.includes(":")||G6.has(C)||t9.has(l)){for(let n of Array.from(b.children))if(a(n))O0(n);return}let g=P6(C,G6);if(g){let n=b.ownerDocument.createElement(g);for(let j0 of b.getAttributeNames())n.setAttribute(j0,b.getAttribute(j0));while(b.firstChild)n.appendChild(b.firstChild);if(b.parentNode)b.parentNode.replaceChild(n,b);q.push({type:"element_typo_fixed",oldName:C,newName:g,reason:`Fixed element typo: <${C}> -> <${g}>`});for(let j0 of Array.from(n.children))if(a(j0))O0(j0)}else for(let n of Array.from(b.children))if(a(n))O0(n)},R0=(b)=>{for(let C of Array.from(b.getAttributeNames())){if(C.startsWith("xmlns")||C.startsWith("data-"))continue;if(C.startsWith("-webkit-")||C.startsWith("-moz-"))continue;if(C.includes(":")&&!C.startsWith("xlink:")&&!C.startsWith("xml:"))continue;if(F6.has(C)||e9.has(C.toLowerCase()))continue;let l=P6(C,F6);if(l){let g=b.getAttribute(C);b.removeAttribute(C),b.setAttribute(l,g),q.push({type:"attr_typo_fixed",element:b.tagName.toLowerCase(),oldAttr:C,newAttr:l,reason:`Fixed attribute typo: '${C}' -> '${l}'`})}}for(let C of b.children)if(a(C))R0(C)},I0=(b)=>{let C=new Map,l=new Set,g=(L0)=>{let C0=L0.getAttribute("id");if(C0)C.set(C0,(C.get(C0)||0)+1),l.add(C0);for(let E0 of L0.children)if(a(E0))g(E0)};g(b);let n=new Set,j0=(L0)=>{let C0=L0.getAttribute("id");if(C0)if(n.has(C0)){let E0=C0,U7=2;while(l.has(E0)||n.has(E0))E0=`${C0}_${U7++}`;L0.setAttribute("id",E0),l.add(E0),n.add(E0),q.push({type:"duplicate_id_renamed",oldId:C0,newId:E0,element:L0.tagName.toLowerCase(),reason:`Renamed duplicate ID: '${C0}' -> '${E0}'`})}else n.add(C0);for(let E0 of L0.children)if(a(E0))j0(E0)};j0(b)};if(_($),U(),V($),M($),w($),f($),S($),x($),O0($),R0($),I0($),c($),e($),s($),P($),$0($),V0($),J0($),F0($),$.setAttribute("data-fixes-applied",String(q.length)),z&&q.length>0)$.setAttribute("data-fix-report",JSON.stringify(q));return $}),A0={ERROR:"error",WARNING:"warning"},dz={broken_reference:A0.ERROR,broken_url_reference:A0.ERROR,duplicate_id:A0.ERROR,missing_required_attribute:A0.ERROR,invalid_child_element:A0.ERROR,animation_in_empty_element:A0.ERROR,malformed_viewbox:A0.ERROR,malformed_points:A0.ERROR,malformed_transform:A0.ERROR,invalid_enum_value:A0.ERROR,invalid_numeric_constraint:A0.ERROR,invalid_attr_on_element:A0.WARNING,missing_namespace:A0.WARNING,invalid_timing:A0.WARNING,uppercase_unit:A0.WARNING,invalid_whitespace:A0.WARNING,invalid_number:A0.WARNING,mistyped_element_detected:A0.WARNING,unknown_element_detected:A0.WARNING,mistyped_attribute_detected:A0.WARNING,unknown_attribute_detected:A0.WARNING,invalid_color:A0.WARNING,circular_reference:A0.WARNING,deep_nesting:A0.WARNING,empty_defs:A0.WARNING,gradient_stop_order:A0.WARNING,path_complexity:A0.WARNING,external_resource:A0.WARNING,script_content:A0.WARNING,event_handler:A0.WARNING,missing_title:A0.WARNING,missing_desc:A0.WARNING,invalid_aria:A0.WARNING,missing_lang:A0.WARNING},pz=new Set(["onabort","onactivate","onbegin","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onend","onended","onerror","onfocus","onfocusin","onfocusout","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onrepeat","onreset","onresize","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onunload","onvolumechange","onwaiting","onwheel"]),cz=new Set(["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-dropeffect","aria-errormessage","aria-expanded","aria-flowto","aria-grabbed","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext"]),P5=new Set(["img","graphics-document","graphics-object","graphics-symbol","group","list","listitem","none","presentation","application"]);function lz($){let J={elements:new Map,lines:[]},Z=0;J.lines.push(0);for(let Y=0;Y<$.length;Y++)if($[Y]===`
|
|
350
|
+
`)J.lines.push(Y+1);let K=[],Q=/<!\[CDATA\[([\s\S]*?)\]\]>/g,H;while((H=Q.exec($))!==null)K.push({start:H.index,end:H.index+H[0].length});let z=/<!--[\s\S]*?-->/g,q;while((q=z.exec($))!==null)K.push({start:q.index,end:q.index+q[0].length});let W=/<script[^>]*>([\s\S]*?)<\/script>/gi,j;while((j=W.exec($))!==null){let Y=j.index+j[0].indexOf(">")+1,X=j.index+j[0].lastIndexOf("<");if(X>Y)K.push({start:Y,end:X})}let G=/<style[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=G.exec($))!==null){let Y=F.index+F[0].indexOf(">")+1,X=F.index+F[0].lastIndexOf("<");if(X>Y)K.push({start:Y,end:X})}K.sort((Y,X)=>Y.start-X.start);let _=(Y)=>{for(let X of K){if(Y>=X.start&&Y<X.end)return!0;if(X.start>Y)break}return!1},U=(Y)=>{let X=1;for(let I=0;I<J.lines.length;I++){if(J.lines[I]>Y){X=I;break}X=I+1}let w=J.lines[X-1]||0,R=Y-w+1;return{line:X,column:R}},O=/<([a-zA-Z][a-zA-Z0-9:_-]*)\s*([^>]*?)(\/?)\s*>/g,V=/([a-zA-Z][a-zA-Z0-9:_-]*)\s*=\s*["']([^"']*)["']/g,M;while((M=O.exec($))!==null){if(_(M.index))continue;let Y=M[1].toLowerCase(),X=M[2],w=M.index,R=M.index+M[0].length,{line:I,column:f}=U(w),u=X?M[0].indexOf(X):0,m=new Map;V.lastIndex=0;let S;while((S=V.exec(X))!==null){let x=S[1],h=S[2],E=w+u+S.index,d=U(E);m.set(x.toLowerCase(),{name:x,value:h,line:d.line,column:d.column})}if(!J.elements.has(Y))J.elements.set(Y,[]);J.elements.get(Y).push({line:I,column:f,endColumn:f+M[0].length-1,attrs:m})}return J.getElementPosition=(Y,X=0)=>{let w=J.elements.get(Y.toLowerCase());if(w&&w[X]){let R=w[X];return{line:R.line,column:R.column}}return{line:1,column:1}},J.getAttributePosition=(Y,X,w=0)=>{let R=J.elements.get(Y.toLowerCase());if(R&&R[w]){let I=R[w],f=I.attrs.get(X.toLowerCase());if(f)return{line:f.line,column:f.column};return{line:I.line,column:I.column}}return{line:1,column:1}},J}async function nz($,J={}){Iz();let Z=J.errorsOnly===!0,K=J.outputFile||null,Q=(J.outputFormat||"json").toLowerCase(),H=J.includeSource===!0,z=["text","json","xml","yaml"];if(K&&!z.includes(Q))throw new Error(`Invalid outputFormat '${Q}'. Must be one of: ${z.join(", ")}`);let q="",W;try{if(W=r6($),W===D0.SVG_STRING)q=$;else if(W===D0.FILE_PATH){let D=await import("node:fs/promises"),i=(await Promise.resolve().then(() => (C6(),I6))).normalize($);try{q=await D.readFile(i,"utf8")}catch(v){throw new Error(`Failed to read file '${$}': ${v.message}`)}}else if(W===D0.URL)try{let D=await fetch($);if(!D.ok)throw new Error(`HTTP ${D.status}: ${D.statusText}`);q=await D.text()}catch(D){throw new Error(`Failed to fetch URL '${$}': ${D.message}`)}else if(W===D0.DOM_ELEMENT)if(typeof XMLSerializer!=="undefined")q=new XMLSerializer().serializeToString($);else if($.outerHTML)q=$.outerHTML;else throw new Error("Cannot serialize DOM element: XMLSerializer not available");else throw new Error(`Unknown input type: ${typeof $}`)}catch(D){return{issues:[{type:"input_error",severity:A0.ERROR,reason:D.message,line:0,column:0}],isValid:!1,hasErrors:!0,hasWarnings:!1,errorCount:1,warningCount:0,summary:{input_error:1}}}let j=H?q.split(`
|
|
351
|
+
`):null,G=lz(q),F,_=[],U=(D)=>{let A=D.match(/line\s*:?\s*(\d+)/i)||D.match(/:(\d+):/);return A?parseInt(A[1],10):1},O=(D)=>{let A=D.match(/column\s*:?\s*(\d+)/i)||D.match(/:\d+:(\d+)/);return A?parseInt(A[1],10):1},V=(D)=>{let A=D,i=[],v="_VALID_ENTITY_",K0=/&(amp|lt|gt|quot|apos|#\d{1,7}|#x[\da-fA-F]{1,6});/g,M0=A.replace(K0,v+"$1;").replace(/&/g,"&").replace(new RegExp(v,"g"),"&");if(M0!==A)A=M0,i.push("Escaped unencoded ampersands");let T0=A.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"");if(T0!==A)A=T0,i.push("Removed invalid control characters");if(A.charCodeAt(0)===65279)A=A.slice(1),i.push("Removed UTF-8 BOM");let u0=A.replace(/="([^"]*)<([^"]*)"(?!\s*>)/g,(z7,t0,s0)=>{if(!s0.includes(">"))return`="${t0}<${s0}"`;return z7});if(u0!==A)A=u0,i.push("Escaped < in attribute values");return{fixed:A,appliedFixes:i}};try{F=await a6($,W)}catch(D){let A=D.message||String(D),i=U(A),v=O(A),{fixed:K0,appliedFixes:q0}=V(q);if(q0.length>0&&K0!==q)try{let{JSDOM:H0}=await import("jsdom");F=new H0(K0,{contentType:"image/svg+xml"}).window.document.documentElement,_.push({type:"parse_recovery",severity:A0.WARNING,reason:`Recovered from parse error. Applied fixes: ${q0.join("; ")}`,line:i,column:v}),_.push({type:"original_parse_error",severity:A0.ERROR,reason:`Original parse error: ${A}`,line:i,column:v})}catch(H0){return{issues:[{type:"parse_error",severity:A0.ERROR,reason:`Failed to parse SVG: ${A}`,line:i,column:v},{type:"recovery_failed",severity:A0.WARNING,reason:`Recovery attempted (${q0.join("; ")}) but still failed: ${H0.message}`,line:i,column:v}],isValid:!1,hasErrors:!0,hasWarnings:!0,errorCount:1,warningCount:1,summary:{parse_error:1,recovery_failed:1}}}else return{issues:[{type:"parse_error",severity:A0.ERROR,reason:`Failed to parse SVG: ${A}`,line:i,column:v}],isValid:!1,hasErrors:!0,hasWarnings:!1,errorCount:1,warningCount:0,summary:{parse_error:1}}}let M=[];if(_.length>0)M.push(..._);let Y=new Map,X=(D)=>{let A=D.toLowerCase(),i=Y.get(A)||0;return Y.set(A,i+1),i},w=()=>{Y.clear()},R=(D,A,i=null,v=null)=>{let K0;if(i)K0=G.getAttributePosition(A,i,v||0);else K0=G.getElementPosition(A,v||0);let q0=dz[D.type]||A0.WARNING,H0={...D,severity:q0,line:K0.line,column:K0.column};if(H&&j&&K0.line>0&&K0.line<=j.length)H0.sourceLine=j[K0.line-1];return H0},I=new Set,f=(D)=>{if(!D)return;let A=D.getAttribute("id");if(A)I.add(A);for(let i of D.children)if(a(i))f(i)};f(F);let u=["x","y","width","height","cx","cy","r","rx","ry","x1","y1","x2","y2","d","points"],m=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(A==="g"){for(let v of u)if(D.hasAttribute(v))M.push(R({type:"invalid_attr_on_element",element:A,attr:v,value:D.getAttribute(v),reason:`SVG 1.1: <g> elements do not support '${v}' attribute`},A,v,i))}for(let v of D.children)if(a(v))m(v)},S=()=>{let D=!1,A=null,i=null,v=(K0)=>{for(let q0 of K0.getAttributeNames())if(q0.startsWith("xlink:")){D=!0,A=K0.tagName.toLowerCase(),i=q0;return}for(let q0 of K0.children){if(a(q0))v(q0);if(D)return}};if(v(F),D&&!F.hasAttribute("xmlns:xlink")){let K0=G.getAttributePosition(A,i,0);M.push({type:"missing_namespace",namespace:"xmlns:xlink",reason:"Document uses xlink:* attributes but missing xmlns:xlink namespace declaration",line:K0.line,column:K0.column})}},x=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of["xlink:href","href"]){let K0=D.getAttribute(v);if(K0&&K0.startsWith("#")){let q0=K0.slice(1);if(q0&&!I.has(q0))M.push(R({type:"broken_reference",element:A,attr:v,referencedId:q0,reason:`Reference to non-existent ID '${q0}'`},A,v,i))}}for(let v of D.children)if(a(v))x(v)},h=["begin","end","dur","repeatDur","min","max"],E=new Set(["animate","animateTransform","animateMotion","animateColor","set"]),d=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(E.has(A))for(let v of h){let K0=D.getAttribute(v);if(K0){let q0=K0.trim();if(q0!==K0)M.push(R({type:"invalid_timing",element:A,attr:v,value:K0,reason:"Timing value has leading/trailing whitespace"},A,v,i));if(/[;,]/.test(q0)&&!/^[\d\w\s.;,+-]+$/.test(q0))M.push(R({type:"invalid_timing",element:A,attr:v,value:K0,reason:"Timing value may contain invalid characters"},A,v,i))}}for(let v of D.children)if(a(v))d(v)},c=new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]),p=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);if(c.has(A)){for(let v of D.children)if(a(v)){let K0=v.tagName.toLowerCase();if(E.has(K0))M.push(R({type:"animation_in_empty_element",element:A,child:K0,reason:`Animation element <${K0}> inside <${A}> which has EMPTY content model per SVG 1.1 DTD`},A,null,i))}}for(let v of D.children)if(a(v))p(v)},N=/(\d+\.?\d*)(PX|EM|EX|PT|PC|CM|MM|IN|%)/gi,y=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","font-size","letter-spacing","word-spacing","stroke-dashoffset"],B=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of y){let K0=D.getAttribute(v);if(K0){let q0=K0.match(N);if(q0)for(let H0 of q0){let M0=H0.replace(/[\d.]+/,"");if(M0!==M0.toLowerCase())M.push(R({type:"uppercase_unit",element:A,attr:v,value:K0,reason:`Unit '${M0}' should be lowercase '${M0.toLowerCase()}'`},A,v,i))}}}for(let v of D.children)if(a(v))B(v)},e=["points","viewBox","d","values","keyTimes","keySplines","rotate"],r=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of e){let K0=D.getAttribute(v);if(K0){if(/[\t\n\r]/.test(K0)||/ +/.test(K0))M.push(R({type:"invalid_whitespace",element:A,attr:v,reason:"List attribute contains tabs, newlines, or multiple consecutive spaces"},A,v,i))}}for(let v of D.children)if(a(v))r(v)},s=["width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","stroke-width","stroke-miterlimit","stroke-dashoffset","opacity","fill-opacity","stroke-opacity","font-size"],z0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of s){let K0=D.getAttribute(v);if(K0){let q0=K0.trim();if(/^0\d/.test(q0.replace(/[a-z%]+$/i,"")))M.push(R({type:"invalid_number",element:A,attr:v,value:K0,reason:"Number has unnecessary leading zeros"},A,v,i));if(/\.$/.test(q0.replace(/[a-z%]+$/i,"")))M.push(R({type:"invalid_number",element:A,attr:v,value:K0,reason:"Number has trailing decimal point"},A,v,i))}}for(let v of D.children)if(a(v))z0(v)},T=(D,A=!1)=>{let i=D.tagName,v=i.toLowerCase(),K0=X(v),q0=i.includes(":"),H0=A||L5.has(v)||q0;if(!H0){if(!G6.has(i)&&!t9.has(v)){if(!Rz(v)){let M0=P6(i,G6);if(M0)M.push(R({type:"mistyped_element_detected",element:i,suggestion:M0,reason:`Unknown element <${i}> - did you mean <${M0}>?`},v,null,K0));else M.push(R({type:"unknown_element_detected",element:i,reason:`Unknown element <${i}> - not in SVG 1.1 spec`},v,null,K0))}}}for(let M0 of D.children)if(a(M0))T(M0,H0)},P=(D,A=!1)=>{let i=D.tagName.toLowerCase(),v=X(i),K0=D.tagName.includes(":"),q0=A||L5.has(i)||K0;if(!q0)for(let H0 of D.getAttributeNames()){if(H0.startsWith("data-")||H0.startsWith("aria-"))continue;if(H0==="xmlns"||H0.startsWith("xmlns:"))continue;if(H0.includes(":")&&!H0.startsWith("xlink:")&&!H0.startsWith("xml:"))continue;if(Bz(H0))continue;if(!F6.has(H0)&&!e9.has(H0.toLowerCase())){let M0=P6(H0,F6);if(M0)M.push(R({type:"mistyped_attribute_detected",element:i,attr:H0,suggestion:M0,reason:`Unknown attribute '${H0}' - did you mean '${M0}'?`},i,H0,v));else M.push(R({type:"unknown_attribute_detected",element:i,attr:H0,reason:`Unknown attribute '${H0}' on <${i}> - not in SVG 1.1 spec`},i,H0,v))}}for(let H0 of D.children)if(a(H0))P(H0,q0)},t={use:["xlink:href","href"],image:["xlink:href","href"],feImage:["xlink:href","href"],textPath:["xlink:href","href"],mpath:["xlink:href","href"],animate:["attributeName"],animateTransform:["attributeName","type"],animateMotion:[],animateColor:["attributeName"],set:["attributeName"],feBlend:["in2"],feComposite:["in2"],feDisplacementMap:["in2","scale"],feMorphology:["operator"],feTurbulence:["type"],feConvolveMatrix:["kernelMatrix"],feFuncR:["type"],feFuncG:["type"],feFuncB:["type"],feFuncA:["type"],linearGradient:[],radialGradient:[],stop:["offset"]},$0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=t[A];if(v&&v.length>0){if(v.includes("xlink:href")&&v.includes("href")){if(!D.hasAttribute("xlink:href")&&!D.hasAttribute("href"))M.push(R({type:"missing_required_attribute",element:A,attrs:["href","xlink:href"],reason:`<${A}> requires 'href' or 'xlink:href' attribute`},A,null,i))}else for(let K0 of v)if(!D.hasAttribute(K0))M.push(R({type:"missing_required_attribute",element:A,attr:K0,reason:`<${A}> requires '${K0}' attribute per SVG 1.1 DTD`},A,K0,i))}for(let K0 of D.children)if(a(K0))$0(K0)},Q0={linearGradient:new Set(["stop","animate","animateTransform","set"]),radialGradient:new Set(["stop","animate","animateTransform","set"]),stop:new Set(["animate","set"]),clipPath:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","animate","animateTransform","set","desc","title"]),mask:new Set(["path","text","rect","circle","ellipse","line","polyline","polygon","use","g","defs","image","switch","a","animate","animateTransform","set","desc","title"])},V0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=Q0[A];if(v){for(let K0 of D.children)if(a(K0)){let q0=K0.tagName.toLowerCase();if(!q0.includes(":")&&!v.has(q0))M.push(R({type:"invalid_child_element",element:A,child:q0,reason:`<${q0}> is not a valid child of <${A}> per SVG 1.1 DTD`},A,null,i))}}for(let K0 of D.children)if(a(K0))V0(K0)},N0={spreadMethod:new Set(["pad","reflect","repeat"]),gradientUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),clipPathUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),maskContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),filterUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),primitiveUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),patternContentUnits:new Set(["userSpaceOnUse","objectBoundingBox"]),markerUnits:new Set(["strokeWidth","userSpaceOnUse"]),"fill-rule":new Set(["nonzero","evenodd","inherit"]),"clip-rule":new Set(["nonzero","evenodd","inherit"]),"stroke-linecap":new Set(["butt","round","square","inherit"]),"stroke-linejoin":new Set(["miter","round","bevel","inherit"]),"text-anchor":new Set(["start","middle","end","inherit"]),"dominant-baseline":new Set(["auto","use-script","no-change","reset-size","ideographic","alphabetic","hanging","mathematical","central","middle","text-after-edge","text-before-edge","inherit"]),"alignment-baseline":new Set(["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]),visibility:new Set(["visible","hidden","collapse","inherit"]),display:new Set(["inline","block","list-item","run-in","compact","marker","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","none","inherit"]),overflow:new Set(["visible","hidden","scroll","auto","inherit"])},h0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let[v,K0]of Object.entries(N0)){let q0=D.getAttribute(v);if(q0&&!K0.has(q0))M.push(R({type:"invalid_enum_value",element:A,attr:v,value:q0,validValues:[...K0],reason:`Invalid value '${q0}' for '${v}'. Valid values: ${[...K0].join(", ")}`},A,v,i))}for(let v of D.children)if(a(v))h0(v)},o={opacity:{min:0,max:1,type:"number"},"fill-opacity":{min:0,max:1,type:"number"},"stroke-opacity":{min:0,max:1,type:"number"},"stop-opacity":{min:0,max:1,type:"number"},"flood-opacity":{min:0,max:1,type:"number"},"stroke-width":{min:0,type:"length"},"stroke-miterlimit":{min:1,type:"number"},r:{min:0,type:"length"},rx:{min:0,type:"length"},ry:{min:0,type:"length"}},J0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let[v,K0]of Object.entries(o)){let q0=D.getAttribute(v);if(q0){let H0=parseFloat(q0);if(!isNaN(H0)){if(K0.min!==void 0&&H0<K0.min)M.push(R({type:"invalid_numeric_constraint",element:A,attr:v,value:q0,reason:`Value ${H0} is below minimum ${K0.min}`},A,v,i));if(K0.max!==void 0&&H0>K0.max)M.push(R({type:"invalid_numeric_constraint",element:A,attr:v,value:q0,reason:`Value ${H0} is above maximum ${K0.max}`},A,v,i))}}}for(let v of D.children)if(a(v))J0(v)},F0=(D)=>{let A=new Map,i=new Map,v=(K0)=>{let q0=K0.tagName.toLowerCase(),H0=X(q0),M0=K0.getAttribute("id");if(M0){if(!A.has(M0))A.set(M0,[]),i.set(M0,{tagName:q0,occIdx:H0});A.get(M0).push(q0)}for(let T0 of K0.children)if(a(T0))v(T0)};v(D);for(let[K0,q0]of A)if(q0.length>1){let H0=i.get(K0);M.push(R({type:"duplicate_id",id:K0,elements:q0,count:q0.length,reason:`ID '${K0}' is used ${q0.length} times (on ${q0.join(", ")})`},H0.tagName,"id",H0.occIdx))}},O0=/url\(#([^)]+)\)/g,R0=["fill","stroke","clip-path","mask","filter","color-profile","marker","marker-start","marker-mid","marker-end"],I0=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of R0){let K0=D.getAttribute(v);if(K0){let q0;O0.lastIndex=0;while((q0=O0.exec(K0))!==null){let H0=q0[1];if(!I.has(H0))M.push(R({type:"broken_url_reference",element:A,attr:v,referencedId:H0,reason:`url(#${H0}) references non-existent ID`},A,v,i))}}}for(let v of D.children)if(a(v))I0(v)},b=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","currentcolor","inherit","none","transparent"]),C=["fill","stroke","color","stop-color","flood-color","lighting-color","solid-color"],l=(D)=>{let A=D.toLowerCase().trim();if(b.has(A))return!0;if(/^#[0-9a-f]{3}$/i.test(A))return!0;if(/^#[0-9a-f]{4}$/i.test(A))return!0;if(/^#[0-9a-f]{6}$/i.test(A))return!0;if(/^#[0-9a-f]{8}$/i.test(A))return!0;if(/^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*[\d.]+\s*)?\)$/i.test(A))return!0;if(/^rgba?\(\s*\d+%\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+%?\s*)?\)$/i.test(A))return!0;if(/^hsla?\(\s*\d+\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*[\d.]+\s*)?\)$/i.test(A))return!0;if(/^url\(#[^)]+\)$/i.test(A))return!0;return!1},g=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of C){let K0=D.getAttribute(v);if(K0&&!l(K0))M.push(R({type:"invalid_color",element:A,attr:v,value:K0,reason:`Invalid color value '${K0}'`},A,v,i))}for(let v of D.children)if(a(v))g(v)},n=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=D.getAttribute("viewBox");if(v){let H0=v.trim().split(/[\s,]+/);if(H0.length!==4||!H0.every((M0)=>!isNaN(parseFloat(M0))))M.push(R({type:"malformed_viewbox",element:A,value:v,reason:"viewBox must be exactly 4 numbers (min-x, min-y, width, height)"},A,"viewBox",i))}let K0=D.getAttribute("points");if(K0){let H0=K0.trim().split(/[\s,]+/).filter((M0)=>M0);if(H0.length%2!==0||!H0.every((M0)=>!isNaN(parseFloat(M0))))M.push(R({type:"malformed_points",element:A,value:K0.length>50?K0.substring(0,50)+"...":K0,reason:"points must be pairs of numbers"},A,"points",i))}let q0=D.getAttribute("transform");if(q0){let H0=/^\s{0,20}(matrix|translate|scale|rotate|skewX|skewY)\s{0,20}\([^)]*\)\s{0,20},?\s{0,20}/,M0=q0.trim();while(M0.length>0){let T0=M0.match(H0);if(T0&&T0[0].length>0)M0=M0.substring(T0[0].length);else if(!T0){M.push(R({type:"malformed_transform",element:A,value:q0.length>50?q0.substring(0,50)+"...":q0,reason:`Invalid transform syntax near '${M0.substring(0,20)}'`},A,"transform",i));break}else M0=M0.substring(1)}}if(A==="path"){let H0=D.getAttribute("d");if(H0){let M0=H0.trim();if(M0.length>0){if(!/^[Mm]/.test(M0))M.push(R({type:"malformed_path_data",element:"path",value:H0.length>50?H0.substring(0,50)+"...":H0,reason:"Path data must start with M or m command"},"path","d",i));let T0=M0.replace(/[MmZzLlHhVvCcSsQqTtAa\d\s,.\-+eE]/g,"");if(T0.length>0)M.push(R({type:"malformed_path_data",element:"path",value:H0.length>50?H0.substring(0,50)+"...":H0,reason:`Path data contains invalid characters: '${T0.substring(0,10)}'`},"path","d",i))}}}for(let H0 of D.children)if(a(H0))n(H0)},j0=()=>{let D=new Map,A=(H0)=>{let M0=H0.getAttribute("id");if(M0)D.set(M0,H0);for(let T0 of H0.children)if(a(T0))A(T0)};A(F);let i=["href","xlink:href","mask","clip-path","filter","fill","stroke"],v=(H0)=>{if(!H0)return null;let M0=H0.match(/url\(#([^)]+)\)/);if(M0)return M0[1];let T0=H0.match(/^#(.+)$/);if(T0)return T0[1];return null},K0=(H0,M0=new Set)=>{if(M0.has(H0))return!0;let T0=D.get(H0);if(!T0)return!1;M0.add(H0);let u0=(t0)=>{for(let s0 of i){let M8=v(t0.getAttribute(s0));if(M8&&K0(M8,M0))return!0}for(let s0 of t0.children)if(a(s0)&&u0(s0))return!0;return!1},z7=u0(T0);return M0.delete(H0),z7},q0=["clipPath","mask","filter","symbol","pattern","marker"];for(let[H0,M0]of D){let T0=M0.tagName.toLowerCase();if(q0.includes(T0)){if(K0(H0)){w();let u0=X(T0);M.push(R({type:"circular_reference",element:T0,attr:"id",value:H0,reason:`Circular reference detected: '${H0}' directly or indirectly references itself`},T0,"id",u0))}}}},L0=50,C0=(D,A=0)=>{if(A>L0){let i=D.tagName.toLowerCase(),v=X(i);M.push(R({type:"deep_nesting",element:i,value:String(A),reason:`Element nesting depth (${A}) exceeds ${L0} levels`},i,null,v));return}for(let i of D.children)if(a(i))C0(i,A+1)},E0=(D)=>{let A=D.tagName.toLowerCase();if(A==="defs"){let i=!1;for(let v of D.childNodes)if(a(v)){i=!0;break}if(!i){let v=X(A);M.push(R({type:"empty_defs",element:A,reason:"Empty <defs> element (can be removed)"},A,null,v))}}for(let i of D.children)if(a(i))E0(i)},U7=(D)=>{let A=D.tagName.toLowerCase();if(A==="lineargradient"||A==="radialgradient"){let i=Array.from(D.children).filter((v)=>a(v)&&v.tagName.toLowerCase()==="stop");if(i.length>=2){let v=-1;for(let K0 of i){let q0=K0.getAttribute("offset")||"0",H0=parseFloat(q0);if(q0.includes("%"))H0=H0/100;if(!isNaN(H0)&&H0<v){let M0=X(A);M.push(R({type:"gradient_stop_order",element:A,reason:`Gradient stops not in ascending offset order (${v} followed by ${H0})`},A,null,M0));break}if(!isNaN(H0))v=H0}}}for(let i of D.children)if(a(i))U7(i)},A6=1e4,b7=(D)=>{let A=D.tagName.toLowerCase();if(A==="path"){let i=D.getAttribute("d");if(i){let v=i.match(/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g);if(v&&v.length>A6){let K0=X(A);M.push(R({type:"path_complexity",element:A,attr:"d",value:`${v.length} coordinates`,reason:`Path has ${v.length} coordinates (>${A6}), may cause slow rendering`},A,"d",K0))}}}for(let i of D.children)if(a(i))b7(i)},_6=(D)=>{let A=D.tagName.toLowerCase(),i=X(A),v=["href","xlink:href"];for(let K0 of v){let q0=D.getAttribute(K0);if(q0&&(q0.startsWith("http://")||q0.startsWith("https://")||q0.startsWith("//")))M.push(R({type:"external_resource",element:A,attr:K0,value:q0.length>60?q0.substring(0,60)+"...":q0,reason:"External resource reference detected (potential security/CORS issue)"},A,K0,i))}if(A==="style"&&D.textContent){let K0=D.textContent.match(/@import\s+url\s*\(\s*['"]?(https?:\/\/[^'")\s]+)/i);if(K0)M.push(R({type:"external_resource",element:A,value:K0[1],reason:"External CSS import detected in style element"},A,null,i))}for(let K0 of D.children)if(a(K0))_6(K0)},_8=(D)=>{let A=D.tagName.toLowerCase();if(A==="script"){let i=X(A);M.push(R({type:"script_content",element:A,reason:"Script element detected (potential security issue in untrusted SVGs)"},A,null,i))}for(let i of D.children)if(a(i))_8(i)},U8=(D)=>{let A=D.tagName.toLowerCase(),i=X(A);for(let v of D.getAttributeNames())if(pz.has(v.toLowerCase()))M.push(R({type:"event_handler",element:A,attr:v,reason:`Event handler attribute '${v}' detected (potential XSS vector)`},A,v,i));for(let v of D.children)if(a(v))U8(v)},pK=()=>{let D=!1,A=!1,i=!1,v=F.hasAttribute("lang")||F.hasAttribute("xml:lang"),K0=(T0)=>{for(let u0 of T0.children){if(!a(u0))continue;let z7=u0.tagName.toLowerCase();if(z7==="title")D=!0;if(z7==="desc")A=!0;if(z7==="text"||z7==="tspan"||z7==="textpath")i=!0;K0(u0)}};if(K0(F),!D)M.push(R({type:"missing_title",element:"svg",reason:"Missing <title> element (recommended for accessibility)"},"svg",null,0));let q0=0,H0=(T0)=>{q0++;for(let u0 of T0.children)if(a(u0))H0(u0)};if(H0(F),!A&&q0>10)M.push(R({type:"missing_desc",element:"svg",reason:`Missing <desc> element (recommended for complex SVGs with ${q0} elements)`},"svg",null,0));if(i&&!v)M.push(R({type:"missing_lang",element:"svg",reason:"Missing lang attribute on SVG with text content"},"svg",null,0));let M0=(T0)=>{let u0=T0.tagName.toLowerCase(),z7=X(u0);for(let t0 of T0.getAttributeNames()){if(t0.startsWith("aria-")&&!cz.has(t0.toLowerCase()))M.push(R({type:"invalid_aria",element:u0,attr:t0,reason:`Unknown ARIA attribute '${t0}'`},u0,t0,z7));if(t0==="role"){let s0=T0.getAttribute("role");if(s0&&!P5.has(s0.toLowerCase()))M.push(R({type:"invalid_aria",element:u0,attr:"role",value:s0,reason:`Invalid role value '${s0}' (valid: ${Array.from(P5).slice(0,5).join(", ")}...)`},u0,"role",z7))}if(t0==="aria-hidden"){let s0=T0.getAttribute("aria-hidden");if(s0&&s0!=="true"&&s0!=="false")M.push(R({type:"invalid_aria",element:u0,attr:"aria-hidden",value:s0,reason:`aria-hidden must be 'true' or 'false', got '${s0}'`},u0,"aria-hidden",z7))}}for(let t0 of T0.children)if(a(t0))M0(t0)};w(),M0(F)};w(),m(F),S(),w(),x(F),w(),d(F),w(),p(F),w(),B(F),w(),r(F),w(),z0(F),w(),T(F),w(),P(F),w(),$0(F),w(),V0(F),w(),h0(F),w(),J0(F),w(),F0(F),w(),I0(F),w(),g(F),w(),n(F),w(),j0(),w(),C0(F),w(),E0(F),w(),U7(F),w(),b7(F),w(),_6(F),w(),_8(F),w(),U8(F),pK(),M.sort((D,A)=>{if(D.line!==A.line)return D.line-A.line;return D.column-A.column});let e6=M;if(Z)e6=M.filter((D)=>D.severity===A0.ERROR);let u$=M.filter((D)=>D.severity===A0.ERROR).length,V8=M.filter((D)=>D.severity===A0.WARNING).length,g$={};for(let D of e6)g$[D.type]=(g$[D.type]||0)+1;let K6={issues:e6,isValid:u$===0,hasErrors:u$>0,hasWarnings:V8>0,errorCount:u$,warningCount:V8,issueCount:e6.length,summary:g$};if(K)try{let D=await import("node:fs/promises"),A=await Promise.resolve().then(() => (C6(),I6)),i;switch(Q){case"json":i=JSON.stringify(K6,null,2);break;case"yaml":i=oz(K6);break;case"xml":i=iz(K6);break;case"text":default:i=sz(K6);break}let v=A.normalize(K);await D.writeFile(v,i,"utf8"),K6.outputFile=v}catch(D){K6.exportError=`Failed to write report to '${K}': ${D.message}`}return K6}function sz($){let J=["=".repeat(60),"SVG VALIDATION REPORT","=".repeat(60),"",`Status: ${$.isValid?"VALID":"INVALID"}`,`Errors: ${$.errorCount}`,`Warnings: ${$.warningCount}`,`Total Issues: ${$.issueCount}`,""];if($.issues.length>0){J.push("-".repeat(60)),J.push("ISSUES:"),J.push("-".repeat(60)),J.push("");for(let Z of $.issues){let K=Z.severity.toUpperCase(),Q=`${Z.line}:${Z.column}`;if(J.push(`[${K}] Line ${Q}: ${Z.type}`),Z.element)J.push(` Element: <${Z.element}>`);if(Z.attr)J.push(` Attribute: ${Z.attr}`);if(Z.value)J.push(` Value: ${Z.value}`);if(J.push(` ${Z.reason}`),Z.sourceLine)J.push(` Source: ${Z.sourceLine.trim()}`);J.push("")}}J.push("=".repeat(60)),J.push("SUMMARY BY TYPE:"),J.push("-".repeat(60));for(let[Z,K]of Object.entries($.summary))J.push(` ${Z}: ${K}`);return J.push("=".repeat(60)),J.join(`
|
|
352
|
+
`)}function oz($){let J=["validation_result:",` is_valid: ${$.isValid}`,` has_errors: ${$.hasErrors}`,` has_warnings: ${$.hasWarnings}`,` error_count: ${$.errorCount}`,` warning_count: ${$.warningCount}`,` issue_count: ${$.issueCount}`,""," summary:"];for(let[K,Q]of Object.entries($.summary))J.push(` ${K}: ${Q}`);J.push(""),J.push(" issues:");let Z=(K)=>String(K).replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");for(let K of $.issues){if(J.push(` - type: ${K.type}`),J.push(` severity: ${K.severity}`),J.push(` line: ${K.line}`),J.push(` column: ${K.column}`),K.element)J.push(` element: "${Z(K.element)}"`);if(K.attr)J.push(` attr: "${Z(K.attr)}"`);if(K.value)J.push(` value: "${Z(K.value)}"`);if(J.push(` reason: "${Z(K.reason)}"`),K.sourceLine)J.push(` source_line: "${Z(K.sourceLine)}"`)}return J.join(`
|
|
353
|
+
`)}function iz($){let J=(K)=>String(K).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Z=['<?xml version="1.0" encoding="UTF-8"?>',"<validation_result>",` <is_valid>${$.isValid}</is_valid>`,` <has_errors>${$.hasErrors}</has_errors>`,` <has_warnings>${$.hasWarnings}</has_warnings>`,` <error_count>${$.errorCount}</error_count>`,` <warning_count>${$.warningCount}</warning_count>`,` <issue_count>${$.issueCount}</issue_count>`," <summary>"];for(let[K,Q]of Object.entries($.summary))Z.push(` <${K}>${Q}</${K}>`);Z.push(" </summary>"),Z.push(" <issues>");for(let K of $.issues){if(Z.push(" <issue>"),Z.push(` <type>${J(K.type)}</type>`),Z.push(` <severity>${J(K.severity)}</severity>`),Z.push(` <line>${K.line}</line>`),Z.push(` <column>${K.column}</column>`),K.element)Z.push(` <element>${J(K.element)}</element>`);if(K.attr)Z.push(` <attr>${J(K.attr)}</attr>`);if(K.value)Z.push(` <value>${J(K.value)}</value>`);if(Z.push(` <reason>${J(K.reason)}</reason>`),K.sourceLine)Z.push(` <source_line>${J(K.sourceLine)}</source_line>`);Z.push(" </issue>")}return Z.push(" </issues>"),Z.push("</validation_result>"),Z.join(`
|
|
354
|
+
`)}function SK($){let J=1;for(let Z of $.children)if(a(Z))J+=SK(Z);return J}var vK=G0(async($,J={})=>{let Z=N7($,{minify:J.minify!==!1}),K=await B6(Z,{precision:J.precision||6,curveSegments:J.curveSegments||20,resolveUse:!0,resolveMarkers:!0,resolvePatterns:!0,resolveMasks:!0,resolveClipPaths:!0,flattenTransforms:!0,bakeGradients:!0,removeUnusedDefs:!0,...J});return d0(K.svg)}),DK=G0(($,J={})=>{let Z=$.getElementsByTagName("path");for(let K of Z){let Q=K.getAttribute("d");if(!Q)continue;try{let H=v6(Q),z=K9(H,J.precision||6);K.setAttribute("d",z)}catch(H){console.warn(`Failed to simplify path: ${H.message}`,{pathData:Q.substring(0,100)})}}return $}),hK=G0(($,J={})=>{return _5($,{precision:J.precision??3,removeLinearSplines:J.removeLinearSplines!==!1,optimizeValues:J.optimizeValues!==!1}),$}),yK=G0(($,J={})=>{return U5($,{floatPrecision:J.floatPrecision??J.precision??3,straightCurves:J.straightCurves!==!1,lineShorthands:J.lineShorthands!==!1,convertToZ:J.convertToZ!==!1,utilizeAbsolute:J.utilizeAbsolute!==!1,straightTolerance:J.straightTolerance??0.5}),$}),uK=G0(($,J={})=>{let Z=J.tolerance??1,K=J.algorithm??"douglas-peucker",Q=J.respectStroke!==!1,H=r7($),z=(q)=>{if(q.tagName?.toLowerCase()==="path"){let j=q.getAttribute("d");if(j){let G=Z;if(Q){let U=u6(q),O=y6(q,U,H);if(O.hasStroke&&O.strokeWidth.greaterThan(0)){let V=O.strokeWidth.div(4).toNumber();G=Math.min(Z,V)}}let F=l0(j),_=S9(F,G,K);if(_.simplified){let U=n0(_.commands,J.precision??3);q.setAttribute("d",U)}}}for(let j of q.children||[])z(j)};return z($),$}),gK=G0(($,J={})=>{let Z=(K)=>{let Q=K.getAttribute("transform");if(Q){let H=j7(Q),z=S8(H);K.setAttribute("data-decomposed",JSON.stringify({translateX:z.translateX.toNumber(),translateY:z.translateY.toNumber(),rotation:z.rotation.toNumber(),scaleX:z.scaleX.toNumber(),scaleY:z.scaleY.toNumber(),skewX:z.skewX.toNumber()}))}for(let H of K.children)if(a(H))Z(H)};return Z($),$});function T$($,J){let Z=$.tagName.toLowerCase();try{if(Z==="path"){let K=$.getAttribute("d");if(!K)return null;let Q=v6(K),H=[],z=0,q=0;for(let W of Q)if(W.command==="M"||W.command==="L")z=W.args[0].toNumber(),q=W.args[1].toNumber(),H.push({x:z,y:q});return H}if(Z==="rect"){let K=$.getAttribute("x")||"0",Q=$.getAttribute("y")||"0",H=$.getAttribute("width")||"0",z=$.getAttribute("height")||"0";if(d7(K)||d7(Q)||d7(H)||d7(z))return null;let q=parseFloat(K),W=parseFloat(Q),j=parseFloat(H),G=parseFloat(z);if(isNaN(q)||isNaN(W)||isNaN(j)||isNaN(G))return null;return[{x:q,y:W},{x:q+j,y:W},{x:q+j,y:W+G},{x:q,y:W+G}]}if(Z==="circle"){let K=parseFloat($.getAttribute("cx")||"0"),Q=parseFloat($.getAttribute("cy")||"0"),H=parseFloat($.getAttribute("r")||"0");if(isNaN(K)||isNaN(Q)||isNaN(H))return null;let z=[];for(let q=0;q<J;q++){let W=q/J*2*Math.PI;z.push({x:K+H*Math.cos(W),y:Q+H*Math.sin(W)})}return z}return null}catch(K){return console.warn(`getShapePolygon failed for ${Z}:`,K.message),null}}var rz={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".webp":"image/webp",".avif":"image/avif",".ico":"image/x-icon",".bmp":"image/bmp",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".wav":"audio/wav",".mp3":"audio/mpeg",".ogg":"audio/ogg",".m4a":"audio/mp4",".aac":"audio/aac",".flac":"audio/flac",".webm":"audio/webm",".mp4":"video/mp4",".ogv":"video/ogg",".mov":"video/quicktime",".css":"text/css",".js":"text/javascript"};function j8(){return typeof process!=="undefined"&&process.versions?.node}function A5($){if(!$||typeof $!=="string")return!1;if($.startsWith("#"))return!1;if($.startsWith("data:"))return!1;return!0}function az($){let J=$.indexOf("#");if(J===-1)return{path:$,fragment:null};return{path:$.substring(0,J),fragment:$.substring(J+1)}}function b$($){let J=($.match(/\.[a-z0-9]+$/i)||[""])[0].toLowerCase();return rz[J]||"application/octet-stream"}function x7($,J){if(!$)return $;if($.match(/^https?:\/\//i))return $;if($.startsWith("data:"))return $;if($.startsWith("file://"))return $;if(!J)return $;if(J.match(/^https?:\/\//i))try{return new URL($,J).href}catch(K){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${K.message}`);return $}if(j8())try{let K=(C6(),sK(I6)),Q=J.endsWith("/")?J:K.dirname(J),H=K.resolve(Q,$),z=K.resolve(Q);if(!H.startsWith(z+K.sep)&&H!==z)return console.warn(`Path traversal blocked: ${$} escapes base directory`),$;return H}catch(K){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${K.message}`);let Q=J.endsWith("/")?J:J.substring(0,J.lastIndexOf("/")+1);if($.includes("..")||$.startsWith("/"))return console.warn(`Unsafe path pattern blocked in fallback: ${$}`),$;return Q+$}let Z=J.endsWith("/")?J:J.substring(0,J.lastIndexOf("/")+1);if($.includes("..")||$.startsWith("/"))return console.warn(`Unsafe path pattern blocked: ${$}`),$;return Z+$}async function m7($,J="text",Z=30000){if(j8()&&!$.match(/^https?:\/\//i)){let H=await import("node:fs/promises");return{content:J==="binary"?await H.readFile($):await H.readFile($,"utf8"),contentType:b$($)}}let K=new AbortController,Q=setTimeout(()=>K.abort(),Z);try{let H=await fetch($,{signal:K.signal});if(!H.ok)throw new Error(`HTTP ${H.status}: ${H.statusText}`);let z=H.headers.get("content-type")||b$($);return{content:J==="binary"?await H.arrayBuffer():await H.text(),contentType:z}}finally{clearTimeout(Q)}}function o6($,J){let Z;if(j8())Z=Buffer.from($).toString("base64");else{let K=new Uint8Array($),Q="";for(let H=0;H<K.length;H++)Q+=String.fromCharCode(K[H]);Z=btoa(Q)}return`data:${J};base64,${Z}`}function a9($){let J=[],Z=[],K=/@import\s+(?:url\(\s*["']?([^"')]+)["']?\s*\)|["']([^"']+)["'])/gi,Q,H=0;while((Q=K.exec($))!==null){if(Q.index===H&&Q[0].length===0){console.error("Regex matched empty string in @import, breaking to prevent infinite loop");break}H=Q.index+Math.max(1,Q[0].length),J.push({url:Q[1]||Q[2],fullMatch:Q[0],index:Q.index})}let z=/url\(\s*["']?([^"')]+)["']?\s*\)/gi,q=0;while((Q=z.exec($))!==null){if(Q.index===q&&Q[0].length===0){console.error("Regex matched empty string in url(), breaking to prevent infinite loop");break}if(q=Q.index+Math.max(1,Q[0].length),$.substring(Math.max(0,Q.index-10),Q.index).includes("@import"))continue;if(Q[1].startsWith("#"))continue;if(Q[1].startsWith("data:"))continue;Z.push({url:Q[1],fullMatch:Q[0],index:Q.index})}return{imports:J,urls:Z}}function $8($,J,Z=new Map){if(!$)return Z;let K=$.getAttribute?.("id");if(K){let z=J+K;Z.set(K,z),$.setAttribute("id",z)}let Q=["href","xlink:href","fill","stroke","clip-path","mask","filter","marker-start","marker-mid","marker-end"];for(let z of Q){let q=$.getAttribute?.(z);if(!q)continue;if(q.includes("url(#")){let W=q.replace(/url\(#([^)]+)\)/g,(j,G)=>{return`url(#${Z.get(G)||J+G})`});$.setAttribute(z,W)}else if(q.startsWith("#")){let W=q.substring(1);$.setAttribute(z,"#"+(Z.get(W)||J+W))}}let H=$.getAttribute?.("style");if(H&&H.includes("url(#")){let z=H.replace(/url\(#([^)]+)\)/g,(q,W)=>{return`url(#${Z.get(W)||J+W})`});$.setAttribute("style",z)}if($.children)for(let z of $.children)$8(z,J,Z);return Z}function xK($,J,Z){if(!$){console.warn("setCDATAContent called with null element");return}let K=0,Q=1e4;while($.firstChild&&K++<Q){let z=$.firstChild;if($.removeChild(z),$.firstChild===z){console.error("removeChild failed to remove child in setCDATAContent, breaking to prevent infinite loop");break}}if(K>=Q)console.error(`Safety limit reached in setCDATAContent: ${Q} children processed`);let H=J.includes("<")||J.includes("&")||J.includes("]]>");if(H&&typeof Z.createCDATASection==="function")if(J.includes("]]>")){let z=J.split("]]>");for(let q=0;q<z.length;q++)if(q===0)$.appendChild(Z.createCDATASection(z[q]+"]]"));else if(q===z.length-1)$.appendChild(Z.createCDATASection(">"+z[q]));else $.appendChild(Z.createCDATASection(">"+z[q]+"]]"))}else $.appendChild(Z.createCDATASection(J));else if(H){let z=J.replace(/\]\]>/g,"]]]]><![CDATA[>");$.setAttribute("data-cdata-pending","true"),$.textContent=z}else $.textContent=J}var tz={audio:[".wav",".mp3",".ogg",".webm",".m4a",".aac",".flac"],image:[".png",".jpg",".jpeg",".gif",".svg",".webp",".avif",".ico",".bmp"],video:[".mp4",".webm",".ogv",".avi",".mov"],data:[".json",".xml",".txt",".csv",".tsv"],font:[".woff",".woff2",".ttf",".otf",".eot"]},ez=Object.values(tz).flat();function $q($){let J=new Set,Z=ez.map((H)=>H.replace(".","\\.")).join("|"),K=new RegExp(`["'\`]([^"'\`]*(?:${Z}))["'\`]`,"gi"),Q;while((Q=K.exec($))!==null){let H=Q[1];if(H&&!H.startsWith("data:")&&!H.match(/^https?:\/\/(?!localhost)/)&&H.length>0)J.add(H)}return J}function Jq($){if($.size===0)return"";let J={};for(let[Z,K]of $)J[Z]=K;return`
|
|
435
355
|
// ===== EMBEDDED RESOURCES INTERCEPTOR (auto-generated) =====
|
|
436
356
|
(function() {
|
|
437
|
-
var __EMBEDDED_RESOURCES__ = ${JSON.stringify(
|
|
357
|
+
var __EMBEDDED_RESOURCES__ = ${JSON.stringify(J,null,0)};
|
|
438
358
|
|
|
439
359
|
// Helper to normalize paths for lookup
|
|
440
360
|
function normalizePath(url) {
|
|
@@ -568,5 +488,5 @@ ${i}
|
|
|
568
488
|
})();
|
|
569
489
|
// ===== END EMBEDDED RESOURCES INTERCEPTOR =====
|
|
570
490
|
|
|
571
|
-
`}function Bn(t){let a=new Map,r=(o,n)=>{if(!o||!n)return;let i=o.replace(/['"]/g,"").trim().split(",")[0].trim();if(!a.has(i))a.set(i,new Set);let l=a.get(i);for(let d of n)l.add(d)},e=(o)=>{if(!o)return;let n=(o.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i),i=n?n[1]:null,l=o.getAttribute?.("font-family"),d=o.getAttribute?.("face"),p=i||l||d,g="";if(o.childNodes){for(let c of o.childNodes)if(c.nodeType===3)g+=c.nodeValue||""}if(p&&g.trim())r(p,g);if(o.tagName==="text"||o.tagName==="tspan"){let c=p;if(!c&&o.parentNode){let m=(o.parentNode.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i);c=m?m[1]:o.parentNode.getAttribute?.("font-family")}if(c&&g.trim())r(c,g)}if(o.children)for(let c of o.children)e(c)};return e(t),a}function Xn(t){let a=[...t].sort().join("");return encodeURIComponent(a)}function Ln(t){return t&&(t.includes("fonts.googleapis.com")||t.includes("fonts.gstatic.com"))}function On(t){try{let a=new URL(t).searchParams.get("family");if(a)return a.split(":")[0].replace(/\+/g," ")}catch(a){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${a.message}`);let r=t.match(/family=([^&:]+)/);if(r)return r[1].replace(/\+/g," ")}return null}function kn(t,a){if(!a)return t;try{let r=new URL(t);return r.searchParams.set("text",decodeURIComponent(a)),r.toString()}catch(r){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${r.message}`);let e=t.includes("?")?"&":"?";return`${t}${e}text=${a}`}}var P0=d3(async(t,a={})=>{let{basePath:r="",embedImages:e=!0,embedExternalSVGs:o=!0,externalSVGMode:n="extract",embedCSS:i=!0,embedFonts:l=!0,embedScripts:d=!0,embedAudio:p=!1,subsetFonts:g=!0,verbose:c=!1,recursive:m=!0,maxRecursionDepth:y=10,timeout:h=30000,onMissingResource:s="warn",onProgress:x=null,idPrefix:D="ext_",_visitedURLs:S=null}=a,P=S||new Set,T=[],f=new Map,X=0,B=(N)=>{if(!N||!N.attributes)return;let u=["http://www.inkscape.org/namespaces/inkscape","http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","http://ns.adobe.com/AdobeIllustrator/","http://ns.adobe.com/AdobeSVGViewerExtensions/","http://www.bohemiancoding.com/sketch/ns","http://www.figma.com/figma/ns","http://www.serif.com/","http://www.vecta.io/nano"],O=["http://www.w3.org/2000/svg","http://www.w3.org/1999/xlink","http://www.w3.org/XML/1998/namespace","http://www.w3.org/2000/xmlns/"],Y=N.attributes;for(let j=0;j<Y.length;j++){let _=Y[j];if(_.name.startsWith("xmlns:")){let A=_.name.substring(6),W=_.value;if(u.some((C)=>W.startsWith(C))||!O.includes(W))f.set(A,W)}}},L=(N,u)=>{let O=`Failed to fetch resource: ${N} - ${u.message}`;if(s==="fail")throw Error(O);else if(s==="warn")T.push(O),console.warn("embedExternalDependencies:",O);return null};if(e){let N=[...t.getElementsByTagName("image")];if(x)x("images",0,N.length);for(let u=0;u<N.length;u++){let O=N[u],Y=O.getAttribute("href")||O.getAttribute("xlink:href");if(!Y||!E9(Y))continue;try{let j=u4(Y,r),{content:_,contentType:A}=await I4(j,"binary",h),W=E5(_,A.split(";")[0]);if(O.getAttribute("href"))O.setAttribute("href",W);if(O.getAttribute("xlink:href"))O.setAttribute("xlink:href",W)}catch(j){L(Y,j)}if(x)x("images",u+1,N.length)}}if(o){let N=[...t.getElementsByTagName("use")];if(x)x("externalSVGs",0,N.length);let u=t.querySelector("defs");if(!u){let O=t.documentElement||t;if(!O){if(T.push("Cannot add defs: document has no root SVG element"),x)x("externalSVGs",N.length,N.length)}else if(u=new I3("defs",{},[]),typeof O.insertBefore==="function"&&O.firstChild)O.insertBefore(u,O.firstChild);else if(typeof O.appendChild==="function")O.appendChild(u);else if(O.children&&Array.isArray(O.children))O.children.unshift(u),u.parentNode=O}if(u)for(let O=0;O<N.length;O++){let Y=N[O],j=Y.getAttribute("href")||Y.getAttribute("xlink:href");if(!j||!E9(j))continue;let{path:_,fragment:A}=In(j);if(!_)continue;let W=u4(_,r);if(P.has(W)){T.push(`Circular reference detected: ${W}`);continue}P.add(W);try{let{content:C}=await I4(W,"text",h),z=F3(C);if(!z){L(_,Error("Failed to parse SVG"));continue}let o3=z.documentElement||z;if(B(o3),m&&y>0)await P0(z,{...a,basePath:W,maxRecursionDepth:y-1,_visitedURLs:P});X++;let K=`${D}${X}_`;if(n==="extract"&&A){let $=z.getElementById(A);if($){let w=$.clone?$.clone():JSON.parse(JSON.stringify($));G2(w,K),u.children.push(w);let F=K+A;if(Y.getAttribute("href"))Y.setAttribute("href","#"+F);if(Y.getAttribute("xlink:href"))Y.setAttribute("xlink:href","#"+F)}else L(j,Error(`Fragment #${A} not found in ${_}`))}else{let $=z.documentElement||z;G2($,K);let w=K+"svg";$.setAttribute("id",w),u.children.push($);let F=A?"#"+K+A:"#"+w;if(Y.getAttribute("href"))Y.setAttribute("href",F);if(Y.getAttribute("xlink:href"))Y.setAttribute("xlink:href",F)}}catch(C){L(_,C)}if(x)x("externalSVGs",O+1,N.length)}}if(i||l){let N=[...t.getElementsByTagName("style")];if(x)x("stylesheets",0,N.length);let u=g?Bn(t):null;for(let O=0;O<N.length;O++){let Y=N[O],j=Y.textContent||"";if(i){let{imports:_}=R2(j);for(let A of _.reverse())try{let W=A.url;if(u&&Ln(W)){let $=On(W);if($&&u.has($)){let w=Xn(u.get($));if(W=kn(W,w),c)console.log(`Font subsetting: ${$} -> ${u.get($).size} chars`)}}let C=u4(W,r),{content:z}=await I4(C,"text",h),o3=z,K=R2(z).imports;if(K.length>0)for(let $ of K.reverse())try{let w=u4($.url,C),F=await I4(w,"text",h);o3=o3.substring(0,$.index)+F.content+o3.substring($.index+$.fullMatch.length)}catch(w){L($.url,w)}j=j.substring(0,A.index)+o3+j.substring(A.index+A.fullMatch.length)}catch(W){L(A.url,W)}}if(i||l){let{urls:_}=R2(j);for(let A of _.reverse()){let W=i2(A.url),C=W.startsWith("font/")||W.includes("fontobject");if(C&&!l)continue;if(!C&&!i)continue;try{let z=u4(A.url,r),{content:o3,contentType:K}=await I4(z,"binary",h),$=`url("${E5(o3,K.split(";")[0])}")`;j=j.substring(0,A.index)+$+j.substring(A.index+A.fullMatch.length)}catch(z){L(A.url,z)}}}if(Y.textContent=j,x)x("stylesheets",O+1,N.length)}}if(d){let N=[...t.getElementsByTagName("script")];if(x)x("scripts",0,N.length);for(let u=0;u<N.length;u++){let O=N[u],Y=O.getAttribute("src")||O.getAttribute("href")||O.getAttribute("xlink:href");if(!Y)continue;if(Y.startsWith("data:"))continue;try{let j=u4(Y,r),{content:_}=await I4(j,"text",h);O.removeAttribute("src"),O.removeAttribute("href"),O.removeAttribute("xlink:href"),na(O,_,t)}catch(j){L(Y,j)}if(x)x("scripts",u+1,N.length)}}if(p){let N=[...t.getElementsByTagName("audio")];if(x)x("audio",0,N.length);for(let u=0;u<N.length;u++){let O=N[u],Y=O.getAttribute("src");if(Y&&!Y.startsWith("data:"))try{let _=u4(Y,r),{content:A,contentType:W}=await I4(_,"binary",h),C=W.split(";")[0]||"audio/mpeg",z=E5(A,C);O.setAttribute("src",z)}catch(_){L(Y,_)}let j=O.getElementsByTagName("source");for(let _ of j){let A=_.getAttribute("src");if(A&&!A.startsWith("data:"))try{let W=u4(A,r),{content:C,contentType:z}=await I4(W,"binary",h),o3=z.split(";")[0]||_.getAttribute("type")||"audio/mpeg",K=E5(C,o3);_.setAttribute("src",K)}catch(W){L(A,W)}}if(x)x("audio",u+1,N.length)}}if(d){let N=[],u=t.getElementsByTagName("script");for(let _ of u)if(_.textContent)N.push(_.textContent);let O=t.getElementsByTagName("style");for(let _ of O)if(_.textContent)N.push(_.textContent);let Y=t.getElementsByTagName("foreignObject");for(let _ of Y){let A=_.textContent||"";if(A)N.push(A)}let j=new Set;for(let _ of N){let A=wn(_);for(let W of A)j.add(W)}if(j.size>0){let _=new Map;if(x)x("resources",0,j.size);let A=0;for(let W of j){try{let C=u4(W,r),{content:z,contentType:o3}=await I4(C,"binary",h),K=o3.split(";")[0]||i2(W),$=E5(z,K);if(_.set(W,$),c){let w=(z.length/1024).toFixed(1);console.log(`Embedded resource: ${W} (${w} KB)`)}}catch(C){L(W,C)}if(A++,x)x("resources",A,j.size)}if(_.size>0){let W=vn(_),C=u[0];if(C){let z=C.textContent||"";if(W.includes("<")||W.includes("&")||z.includes("<")||z.includes("&"))C.setAttribute("data-cdata-pending","true");C.textContent=W+z}else{let z=t.createElement("script");z.setAttribute("type","text/javascript"),z.setAttribute("data-cdata-pending","true"),z.textContent=W;let o3=t.documentElement||t;if(o3.firstChild)o3.insertBefore(z,o3.firstChild);else o3.appendChild(z)}if(c)console.log(`Injected resource interceptor for ${_.size} embedded resources`)}}}let R=t.documentElement||t;if(!R.getAttribute("xmlns"))R.setAttribute("xmlns","http://www.w3.org/2000/svg");if(L4(t).includes("xlink:")&&!R.getAttribute("xmlns:xlink"))R.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");for(let[N,u]of f){let O=`xmlns:${N}`;if(!R.getAttribute(O))R.setAttribute(O,u)}if(T.length>0)t._embedWarnings=T;return t}),Yn={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/svg+xml":".svg","image/bmp":".bmp","image/x-icon":".ico","image/tiff":".tiff","audio/mpeg":".mp3","audio/wav":".wav","audio/ogg":".ogg","audio/webm":".webm","audio/aac":".aac","audio/flac":".flac","video/mp4":".mp4","video/webm":".webm","video/ogg":".ogv","video/quicktime":".mov","application/javascript":".js","text/javascript":".js","text/css":".css","font/woff":".woff","font/woff2":".woff2","font/ttf":".ttf","font/otf":".otf","application/font-woff":".woff","application/font-woff2":".woff2","application/x-font-ttf":".ttf","application/x-font-opentype":".otf"};function Q4(t){if(!t||!t.startsWith("data:"))return null;let a=t.match(/^data:([^;,]+)?(?:;([^,]+))?,(.*)$/);if(!a)return null;let r=a[1]||"application/octet-stream",e=a[2]||"",o=a[3]||"";return{mimeType:r,encoding:e,data:o}}function H4(t){if(t.encoding==="base64")return Buffer.from(t.data,"base64");try{return decodeURIComponent(t.data)}catch(a){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${a.message}`);return t.data}}function k4(t,a,r,e=null){let o=Yn[a]||".bin";if(e){let i=e.replace(/[^a-zA-Z0-9._-]/g,"_");return`${t}_${i}`}let n="resource";if(a.startsWith("image/"))n="image";else if(a.startsWith("audio/"))n="audio";else if(a.startsWith("video/"))n="video";else if(a.startsWith("font/")||a.includes("font"))n="font";else if(a.includes("javascript"))n="script";else if(a.includes("css"))n="style";return`${t}_${n}_${String(r).padStart(3,"0")}${o}`}async function ia(t,a={}){let r=B5(t),e=await X5(t,r),o=a.outputFormat||(r===L3.DOM_ELEMENT?d4.DOM_ELEMENT:d4.SVG_STRING),{outputDir:n=null,filenamePrefix:i="resource",extractImages:l=!0,extractFonts:d=!0,extractScripts:p=!0,extractStyles:g=!0,extractAudio:c=!0,extractVideo:m=!0,elementIds:y=null,restoreGoogleFonts:h=!0,dryRun:s=!1,extractOnly:x=!1,onProgress:D=null}=a,S=[],P=[],T=0,f=y?new Set(Array.isArray(y)?y:[y]):null,X=(L)=>{if(!f)return!0;let R=L;while(R&&R.getAttribute){let N=R.getAttribute("id");if(N&&f.has(N))return!0;R=R.parentNode}return!1},B=async(L,R,N)=>{let u=0;if(typeof Buffer<"u"&&Buffer.isBuffer(R))u=R.length;else if(typeof Buffer<"u")u=Buffer.byteLength(R,"utf8");else if(typeof Blob<"u")u=new Blob([R]).size;else u=R.length||0;let O={filename:L,path:n?`${n}/${L}`:L,mimeType:N,size:u};if(!s&&n)try{let Y=await import("node:fs/promises"),j=await Promise.resolve().then(()=>(A5(),i5));await Y.mkdir(n,{recursive:!0});let _=j.join(n,L);if(typeof Buffer<"u"&&Buffer.isBuffer(R))await Y.writeFile(_,R);else await Y.writeFile(_,R,"utf8");O.path=_,S.push(O)}catch(Y){P.push(`Failed to save ${L}: ${Y.message}`),O.error=Y.message}else S.push(O);return O};if(l){let L=[...e.getElementsByTagName("image")];if(D)D("images",0,L.length);for(let R=0;R<L.length;R++){let N=L[R];if(!X(N))continue;let u=N.getAttribute("href")||N.getAttribute("xlink:href");if(!u||!u.startsWith("data:"))continue;let O=Q4(u);if(!O)continue;if(!O.mimeType.startsWith("image/"))continue;T++;let Y=k4(i,O.mimeType,T),j=H4(O),_=await B(Y,j,O.mimeType);if(_.type="image",_.elementId=N.getAttribute("id"),!x){let A=`./${Y}`;if(N.getAttribute("href"))N.setAttribute("href",A);if(N.getAttribute("xlink:href"))N.setAttribute("xlink:href",A)}if(D)D("images",R+1,L.length)}}if(c){let L=[...e.getElementsByTagName("audio")];if(D)D("audio",0,L.length);for(let R=0;R<L.length;R++){let N=L[R];if(!X(N))continue;let u=N.getAttribute("src");if(u&&u.startsWith("data:")){let Y=Q4(u);if(Y&&Y.mimeType.startsWith("audio/")){T++;let j=k4(i,Y.mimeType,T),_=H4(Y),A=await B(j,_,Y.mimeType);if(A.type="audio",A.elementId=N.getAttribute("id"),!x)N.setAttribute("src",`./${j}`)}}let O=N.getElementsByTagName("source");for(let Y of O){let j=Y.getAttribute("src");if(j&&j.startsWith("data:")){let _=Q4(j);if(_&&_.mimeType.startsWith("audio/")){T++;let A=k4(i,_.mimeType,T),W=H4(_),C=await B(A,W,_.mimeType);if(C.type="audio",!x)Y.setAttribute("src",`./${A}`)}}}if(D)D("audio",R+1,L.length)}}if(m){let L=[...e.getElementsByTagName("video")];if(D)D("video",0,L.length);for(let R=0;R<L.length;R++){let N=L[R];if(!X(N))continue;let u=N.getAttribute("src");if(u&&u.startsWith("data:")){let Y=Q4(u);if(Y&&Y.mimeType.startsWith("video/")){T++;let j=k4(i,Y.mimeType,T),_=H4(Y),A=await B(j,_,Y.mimeType);if(A.type="video",A.elementId=N.getAttribute("id"),!x)N.setAttribute("src",`./${j}`)}}let O=N.getElementsByTagName("source");for(let Y of O){let j=Y.getAttribute("src");if(j&&j.startsWith("data:")){let _=Q4(j);if(_&&_.mimeType.startsWith("video/")){T++;let A=k4(i,_.mimeType,T),W=H4(_),C=await B(A,W,_.mimeType);if(C.type="video",!x)Y.setAttribute("src",`./${A}`)}}}if(D)D("video",R+1,L.length)}}if(p){let L=[...e.getElementsByTagName("script")];if(D)D("scripts",0,L.length);for(let R=0;R<L.length;R++){let N=L[R];if(!X(N))continue;let u=N.getAttribute("href")||N.getAttribute("xlink:href");if(u&&!u.startsWith("data:"))continue;let O="";if(u&&u.startsWith("data:")){let _=Q4(u);if(_){let A=H4(_);O=typeof A==="string"?A:A.toString("utf8")}}else if(O=N.textContent||"",N.firstChild&&N.firstChild.nodeType===4)O=N.firstChild.nodeValue||"";if(!O.trim())continue;T++;let Y=k4(i,"application/javascript",T),j=await B(Y,O,"application/javascript");if(j.type="script",j.elementId=N.getAttribute("id"),!x){let _=0;while(N.firstChild&&_++<1e4){let A=N.firstChild;if(N.removeChild(A),N.firstChild===A)break}if(_>=1e4)console.error("Safety limit reached removing script children: 10000 iterations");N.setAttribute("href",`./${Y}`)}if(D)D("scripts",R+1,L.length)}}if(g||d){let L=[...e.getElementsByTagName("style")];if(D)D("styles",0,L.length);for(let R=0;R<L.length;R++){let N=L[R];if(!X(N))continue;let u=N.textContent||"";if(N.firstChild&&N.firstChild.nodeType===4)u=N.firstChild.nodeValue||"";if(!u.trim())continue;let O=!1;if(d){let Y=/@font-face\s*\{[^}]*\}/gi,j=u.match(Y)||[];for(let _ of j){let A=_.match(/src:\s*url\(["']?(data:[^"')]+)["']?\)/);if(A){let W=A[1],C=Q4(W);if(C){T++;let z=k4(i,C.mimeType,T),o3=H4(C),K=await B(z,o3,C.mimeType);K.type="font";let $=_.match(/font-family:\s*["']?([^"';]+)["']?/);if($)K.fontFamily=$[1].trim();if(!x)u=u.replace(W,`./${z}`),O=!0}}}if(h){let _=[],A=/font-family:\s*["']?([^"';,]+)/gi,W;while((W=A.exec(u))!==null){let C=W[1].trim();if(["Roboto","Open Sans","Lato","Montserrat","Oswald","Raleway","Poppins","Source Sans Pro","Ubuntu","Playfair Display","Merriweather","Nunito","PT Sans","Rubik","Work Sans","DM Serif Display","Monofett","Dokdo","Orbitron","Notable","Fira Mono","Fira Code","Inter","Noto Sans","Noto Serif"].some((z)=>C.toLowerCase().includes(z.toLowerCase())))_.push(C)}if(_.length>0&&!x){let C=[...new Set(_)],z=`@import url('https://fonts.googleapis.com/css2?family=${C.map((o3)=>o3.replace(/\s+/g,"+")).join("&family=")}&display=swap');
|
|
572
|
-
`;if(!
|
|
491
|
+
`}function Kq($){let J=new Map,Z=(Q,H)=>{if(!Q||!H)return;let z=Q.replace(/['"]/g,"").trim().split(",")[0].trim();if(!J.has(z))J.set(z,new Set);let q=J.get(z);for(let W of H)q.add(W)},K=(Q)=>{if(!Q)return;let z=(Q.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i),q=z?z[1]:null,W=Q.getAttribute?.("font-family"),j=Q.getAttribute?.("face"),G=q||W||j,F="";if(Q.childNodes){for(let _ of Q.childNodes)if(_.nodeType===3)F+=_.nodeValue||""}if(G&&F.trim())Z(G,F);if(Q.tagName==="text"||Q.tagName==="tspan"){let _=G;if(!_&&Q.parentNode){let O=(Q.parentNode.getAttribute?.("style")||"").match(/font-family:\s*([^;]+)/i);_=O?O[1]:Q.parentNode.getAttribute?.("font-family")}if(_&&F.trim())Z(_,F)}if(Q.children)for(let _ of Q.children)K(_)};return K($),J}function Zq($){let J=[...$].sort().join("");return encodeURIComponent(J)}function Qq($){return $&&($.includes("fonts.googleapis.com")||$.includes("fonts.gstatic.com"))}function Hq($){try{let Z=new URL($).searchParams.get("family");if(Z)return Z.split(":")[0].replace(/\+/g," ")}catch(J){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${J.message}`);let Z=$.match(/family=([^&:]+)/);if(Z)return Z[1].replace(/\+/g," ")}return null}function zq($,J){if(!J)return $;try{let Z=new URL($);return Z.searchParams.set("text",decodeURIComponent(J)),Z.toString()}catch(Z){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${Z.message}`);let K=$.includes("?")?"&":"?";return`${$}${K}text=${J}`}}var G8=G0(async($,J={})=>{let{basePath:Z="",embedImages:K=!0,embedExternalSVGs:Q=!0,externalSVGMode:H="extract",embedCSS:z=!0,embedFonts:q=!0,embedScripts:W=!0,embedAudio:j=!1,subsetFonts:G=!0,verbose:F=!1,recursive:_=!0,maxRecursionDepth:U=10,timeout:O=30000,onMissingResource:V="warn",onProgress:M=null,idPrefix:Y="ext_",_visitedURLs:X=null}=J,w=X||new Set,R=[],I=new Map,f=0,u=(h)=>{if(!h||!h.attributes)return;let E=["http://www.inkscape.org/namespaces/inkscape","http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","http://ns.adobe.com/AdobeIllustrator/","http://ns.adobe.com/AdobeSVGViewerExtensions/","http://www.bohemiancoding.com/sketch/ns","http://www.figma.com/figma/ns","http://www.serif.com/","http://www.vecta.io/nano"],d=["http://www.w3.org/2000/svg","http://www.w3.org/1999/xlink","http://www.w3.org/XML/1998/namespace","http://www.w3.org/2000/xmlns/"],c=h.attributes;for(let p=0;p<c.length;p++){let N=c[p];if(N.name.startsWith("xmlns:")){let y=N.name.substring(6),B=N.value;if(E.some((e)=>B.startsWith(e))||!d.includes(B))I.set(y,B)}}},m=(h,E)=>{let d=`Failed to fetch resource: ${h} - ${E.message}`;if(V==="fail")throw new Error(d);else if(V==="warn")R.push(d),console.warn("embedExternalDependencies:",d);return null};if(K){let E=[...$.getElementsByTagName("image")];if(M)M("images",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("href")||c.getAttribute("xlink:href");if(!p||!A5(p))continue;try{let N=x7(p,Z),{content:y,contentType:B}=await m7(N,"binary",O),e=o6(y,B.split(";")[0]);if(c.getAttribute("href"))c.setAttribute("href",e);if(c.getAttribute("xlink:href"))c.setAttribute("xlink:href",e)}catch(N){m(p,N)}if(M)M("images",d+1,E.length)}}if(Q){let E=[...$.getElementsByTagName("use")];if(M)M("externalSVGs",0,E.length);let d=$.querySelector("defs");if(!d){let c=$.documentElement||$;if(!c){if(R.push("Cannot add defs: document has no root SVG element"),M)M("externalSVGs",E.length,E.length)}else if(d=new B0("defs",{},[]),typeof c.insertBefore==="function"&&c.firstChild)c.insertBefore(d,c.firstChild);else if(typeof c.appendChild==="function")c.appendChild(d);else if(c.children&&Array.isArray(c.children))c.children.unshift(d),d.parentNode=c}if(d)for(let c=0;c<E.length;c++){let p=E[c],N=p.getAttribute("href")||p.getAttribute("xlink:href");if(!N||!A5(N))continue;let{path:y,fragment:B}=az(N);if(!y)continue;let e=x7(y,Z);if(w.has(e)){R.push(`Circular reference detected: ${e}`);continue}w.add(e);try{let{content:r}=await m7(e,"text",O),s=d0(r);if(!s){m(y,new Error("Failed to parse SVG"));continue}let z0=s.documentElement||s;if(u(z0),_&&U>0)await G8(s,{...J,basePath:e,maxRecursionDepth:U-1,_visitedURLs:w});f++;let T=`${Y}${f}_`;if(H==="extract"&&B){let P=s.getElementById(B);if(P){let t=P.clone?P.clone():JSON.parse(JSON.stringify(P));$8(t,T),d.children.push(t);let $0=T+B;if(p.getAttribute("href"))p.setAttribute("href","#"+$0);if(p.getAttribute("xlink:href"))p.setAttribute("xlink:href","#"+$0)}else m(N,new Error(`Fragment #${B} not found in ${y}`))}else{let P=s.documentElement||s;$8(P,T);let t=T+"svg";P.setAttribute("id",t),d.children.push(P);let $0=B?"#"+T+B:"#"+t;if(p.getAttribute("href"))p.setAttribute("href",$0);if(p.getAttribute("xlink:href"))p.setAttribute("xlink:href",$0)}}catch(r){m(y,r)}if(M)M("externalSVGs",c+1,E.length)}}if(z||q){let E=[...$.getElementsByTagName("style")];if(M)M("stylesheets",0,E.length);let d=G?Kq($):null;for(let c=0;c<E.length;c++){let p=E[c],N=p.textContent||"";if(z){let{imports:y}=a9(N);for(let B of y.reverse())try{let e=B.url;if(d&&Qq(e)){let P=Hq(e);if(P&&d.has(P)){let t=Zq(d.get(P));if(e=zq(e,t),F)console.log(`Font subsetting: ${P} -> ${d.get(P).size} chars`)}}let r=x7(e,Z),{content:s}=await m7(r,"text",O),z0=s,T=a9(s).imports;if(T.length>0)for(let P of T.reverse())try{let t=x7(P.url,r),$0=await m7(t,"text",O);z0=z0.substring(0,P.index)+$0.content+z0.substring(P.index+P.fullMatch.length)}catch(t){m(P.url,t)}N=N.substring(0,B.index)+z0+N.substring(B.index+B.fullMatch.length)}catch(e){m(B.url,e)}}if(z||q){let{urls:y}=a9(N);for(let B of y.reverse()){let e=b$(B.url),r=e.startsWith("font/")||e.includes("fontobject");if(r&&!q)continue;if(!r&&!z)continue;try{let s=x7(B.url,Z),{content:z0,contentType:T}=await m7(s,"binary",O),t=`url("${o6(z0,T.split(";")[0])}")`;N=N.substring(0,B.index)+t+N.substring(B.index+B.fullMatch.length)}catch(s){m(B.url,s)}}}if(p.textContent=N,M)M("stylesheets",c+1,E.length)}}if(W){let E=[...$.getElementsByTagName("script")];if(M)M("scripts",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("src")||c.getAttribute("href")||c.getAttribute("xlink:href");if(!p)continue;if(p.startsWith("data:"))continue;try{let N=x7(p,Z),{content:y}=await m7(N,"text",O);c.removeAttribute("src"),c.removeAttribute("href"),c.removeAttribute("xlink:href"),xK(c,y,$)}catch(N){m(p,N)}if(M)M("scripts",d+1,E.length)}}if(j){let E=[...$.getElementsByTagName("audio")];if(M)M("audio",0,E.length);for(let d=0;d<E.length;d++){let c=E[d],p=c.getAttribute("src");if(p&&!p.startsWith("data:"))try{let y=x7(p,Z),{content:B,contentType:e}=await m7(y,"binary",O),r=e.split(";")[0]||"audio/mpeg",s=o6(B,r);c.setAttribute("src",s)}catch(y){m(p,y)}let N=c.getElementsByTagName("source");for(let y of N){let B=y.getAttribute("src");if(B&&!B.startsWith("data:"))try{let e=x7(B,Z),{content:r,contentType:s}=await m7(e,"binary",O),z0=s.split(";")[0]||y.getAttribute("type")||"audio/mpeg",T=o6(r,z0);y.setAttribute("src",T)}catch(e){m(B,e)}}if(M)M("audio",d+1,E.length)}}if(W){let h=[],E=$.getElementsByTagName("script");for(let N of E)if(N.textContent)h.push(N.textContent);let d=$.getElementsByTagName("style");for(let N of d)if(N.textContent)h.push(N.textContent);let c=$.getElementsByTagName("foreignObject");for(let N of c){let y=N.textContent||"";if(y)h.push(y)}let p=new Set;for(let N of h){let y=$q(N);for(let B of y)p.add(B)}if(p.size>0){let N=new Map;if(M)M("resources",0,p.size);let y=0;for(let B of p){try{let e=x7(B,Z),{content:r,contentType:s}=await m7(e,"binary",O),z0=s.split(";")[0]||b$(B),T=o6(r,z0);if(N.set(B,T),F){let P=(r.length/1024).toFixed(1);console.log(`Embedded resource: ${B} (${P} KB)`)}}catch(e){m(B,e)}if(y++,M)M("resources",y,p.size)}if(N.size>0){let B=Jq(N),e=E[0];if(e){let r=e.textContent||"";if(B.includes("<")||B.includes("&")||r.includes("<")||r.includes("&"))e.setAttribute("data-cdata-pending","true");e.textContent=B+r}else{let r=$.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("data-cdata-pending","true"),r.textContent=B;let s=$.documentElement||$;if(s.firstChild)s.insertBefore(r,s.firstChild);else s.appendChild(r)}if(F)console.log(`Injected resource interceptor for ${N.size} embedded resources`)}}}let S=$.documentElement||$;if(!S.getAttribute("xmlns"))S.setAttribute("xmlns","http://www.w3.org/2000/svg");if(N7($).includes("xlink:")&&!S.getAttribute("xmlns:xlink"))S.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");for(let[h,E]of I){let d=`xmlns:${h}`;if(!S.getAttribute(d))S.setAttribute(d,E)}if(R.length>0)$._embedWarnings=R;return $}),qq={"image/png":".png","image/jpeg":".jpg","image/gif":".gif","image/webp":".webp","image/svg+xml":".svg","image/bmp":".bmp","image/x-icon":".ico","image/tiff":".tiff","audio/mpeg":".mp3","audio/wav":".wav","audio/ogg":".ogg","audio/webm":".webm","audio/aac":".aac","audio/flac":".flac","video/mp4":".mp4","video/webm":".webm","video/ogg":".ogv","video/quicktime":".mov","application/javascript":".js","text/javascript":".js","text/css":".css","font/woff":".woff","font/woff2":".woff2","font/ttf":".ttf","font/otf":".otf","application/font-woff":".woff","application/font-woff2":".woff2","application/x-font-ttf":".ttf","application/x-font-opentype":".otf"};function W6($){if(!$||!$.startsWith("data:"))return null;let J=$.match(/^data:([^;,]+)?(?:;([^,]+))?,(.*)$/);if(!J)return null;let Z=J[1]||"application/octet-stream",K=J[2]||"",Q=J[3]||"";return{mimeType:Z,encoding:K,data:Q}}function j6($){if($.encoding==="base64")return Buffer.from($.data,"base64");try{return decodeURIComponent($.data)}catch(J){if(process.env.DEBUG)console.warn(`[svg-toolbox] ${J.message}`);return $.data}}function J6($,J,Z,K=null){let Q=qq[J]||".bin";if(K){let z=K.replace(/[^a-zA-Z0-9._-]/g,"_");return`${$}_${z}`}let H="resource";if(J.startsWith("image/"))H="image";else if(J.startsWith("audio/"))H="audio";else if(J.startsWith("video/"))H="video";else if(J.startsWith("font/")||J.includes("font"))H="font";else if(J.includes("javascript"))H="script";else if(J.includes("css"))H="style";return`${$}_${H}_${String(Z).padStart(3,"0")}${Q}`}async function mK($,J={}){let Z=r6($),K=await a6($,Z),Q=J.outputFormat||(Z===D0.DOM_ELEMENT?_7.DOM_ELEMENT:_7.SVG_STRING),{outputDir:H=null,filenamePrefix:z="resource",extractImages:q=!0,extractFonts:W=!0,extractScripts:j=!0,extractStyles:G=!0,extractAudio:F=!0,extractVideo:_=!0,elementIds:U=null,restoreGoogleFonts:O=!0,dryRun:V=!1,extractOnly:M=!1,onProgress:Y=null}=J,X=[],w=[],R=0,I=U?new Set(Array.isArray(U)?U:[U]):null,f=(S)=>{if(!I)return!0;let x=S;while(x&&x.getAttribute){let h=x.getAttribute("id");if(h&&I.has(h))return!0;x=x.parentNode}return!1},u=async(S,x,h)=>{let E=0;if(typeof Buffer!=="undefined"&&Buffer.isBuffer(x))E=x.length;else if(typeof Buffer!=="undefined")E=Buffer.byteLength(x,"utf8");else if(typeof Blob!=="undefined")E=new Blob([x]).size;else E=x.length||0;let d={filename:S,path:H?`${H}/${S}`:S,mimeType:h,size:E};if(!V&&H)try{let c=await import("node:fs/promises"),p=await Promise.resolve().then(() => (C6(),I6));await c.mkdir(H,{recursive:!0});let N=p.join(H,S);if(typeof Buffer!=="undefined"&&Buffer.isBuffer(x))await c.writeFile(N,x);else await c.writeFile(N,x,"utf8");d.path=N,X.push(d)}catch(c){w.push(`Failed to save ${S}: ${c.message}`),d.error=c.message}else X.push(d);return d};if(q){let x=[...K.getElementsByTagName("image")];if(Y)Y("images",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("href")||E.getAttribute("xlink:href");if(!d||!d.startsWith("data:"))continue;let c=W6(d);if(!c)continue;if(!c.mimeType.startsWith("image/"))continue;R++;let p=J6(z,c.mimeType,R),N=j6(c),y=await u(p,N,c.mimeType);if(y.type="image",y.elementId=E.getAttribute("id"),!M){let B=`./${p}`;if(E.getAttribute("href"))E.setAttribute("href",B);if(E.getAttribute("xlink:href"))E.setAttribute("xlink:href",B)}if(Y)Y("images",h+1,x.length)}}if(F){let x=[...K.getElementsByTagName("audio")];if(Y)Y("audio",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("src");if(d&&d.startsWith("data:")){let p=W6(d);if(p&&p.mimeType.startsWith("audio/")){R++;let N=J6(z,p.mimeType,R),y=j6(p),B=await u(N,y,p.mimeType);if(B.type="audio",B.elementId=E.getAttribute("id"),!M)E.setAttribute("src",`./${N}`)}}let c=E.getElementsByTagName("source");for(let p of c){let N=p.getAttribute("src");if(N&&N.startsWith("data:")){let y=W6(N);if(y&&y.mimeType.startsWith("audio/")){R++;let B=J6(z,y.mimeType,R),e=j6(y),r=await u(B,e,y.mimeType);if(r.type="audio",!M)p.setAttribute("src",`./${B}`)}}}if(Y)Y("audio",h+1,x.length)}}if(_){let x=[...K.getElementsByTagName("video")];if(Y)Y("video",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("src");if(d&&d.startsWith("data:")){let p=W6(d);if(p&&p.mimeType.startsWith("video/")){R++;let N=J6(z,p.mimeType,R),y=j6(p),B=await u(N,y,p.mimeType);if(B.type="video",B.elementId=E.getAttribute("id"),!M)E.setAttribute("src",`./${N}`)}}let c=E.getElementsByTagName("source");for(let p of c){let N=p.getAttribute("src");if(N&&N.startsWith("data:")){let y=W6(N);if(y&&y.mimeType.startsWith("video/")){R++;let B=J6(z,y.mimeType,R),e=j6(y),r=await u(B,e,y.mimeType);if(r.type="video",!M)p.setAttribute("src",`./${B}`)}}}if(Y)Y("video",h+1,x.length)}}if(j){let x=[...K.getElementsByTagName("script")];if(Y)Y("scripts",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.getAttribute("href")||E.getAttribute("xlink:href");if(d&&!d.startsWith("data:"))continue;let c="";if(d&&d.startsWith("data:")){let y=W6(d);if(y){let B=j6(y);c=typeof B==="string"?B:B.toString("utf8")}}else if(c=E.textContent||"",E.firstChild&&E.firstChild.nodeType===4)c=E.firstChild.nodeValue||"";if(!c.trim())continue;R++;let p=J6(z,"application/javascript",R),N=await u(p,c,"application/javascript");if(N.type="script",N.elementId=E.getAttribute("id"),!M){let y=0;while(E.firstChild&&y++<1e4){let B=E.firstChild;if(E.removeChild(B),E.firstChild===B)break}if(y>=1e4)console.error("Safety limit reached removing script children: 10000 iterations");E.setAttribute("href",`./${p}`)}if(Y)Y("scripts",h+1,x.length)}}if(G||W){let x=[...K.getElementsByTagName("style")];if(Y)Y("styles",0,x.length);for(let h=0;h<x.length;h++){let E=x[h];if(!f(E))continue;let d=E.textContent||"";if(E.firstChild&&E.firstChild.nodeType===4)d=E.firstChild.nodeValue||"";if(!d.trim())continue;let c=!1;if(W){let p=/@font-face\s*\{[^}]*\}/gi,N=d.match(p)||[];for(let y of N){let B=y.match(/src:\s*url\(["']?(data:[^"')]+)["']?\)/);if(B){let e=B[1],r=W6(e);if(r){R++;let s=J6(z,r.mimeType,R),z0=j6(r),T=await u(s,z0,r.mimeType);T.type="font";let P=y.match(/font-family:\s*["']?([^"';]+)["']?/);if(P)T.fontFamily=P[1].trim();if(!M)d=d.replace(e,`./${s}`),c=!0}}}if(O){let y=[],B=/font-family:\s*["']?([^"';,]+)/gi,e;while((e=B.exec(d))!==null){let r=e[1].trim();if(["Roboto","Open Sans","Lato","Montserrat","Oswald","Raleway","Poppins","Source Sans Pro","Ubuntu","Playfair Display","Merriweather","Nunito","PT Sans","Rubik","Work Sans","DM Serif Display","Monofett","Dokdo","Orbitron","Notable","Fira Mono","Fira Code","Inter","Noto Sans","Noto Serif"].some((z0)=>r.toLowerCase().includes(z0.toLowerCase())))y.push(r)}if(y.length>0&&!M){let r=[...new Set(y)],s=`@import url('https://fonts.googleapis.com/css2?family=${r.map((z0)=>z0.replace(/\s+/g,"+")).join("&family=")}&display=swap');
|
|
492
|
+
`;if(!d.includes("fonts.googleapis.com"))d=s+d,c=!0,w.push(`Restored Google Fonts import for: ${r.join(", ")}`)}}}if(G&&d.trim()){R++;let p=J6(z,"text/css",R),N=await u(p,d,"text/css");if(N.type="stylesheet",N.elementId=E.getAttribute("id"),!M){let y=0;while(E.firstChild&&y++<1e4){let B=E.firstChild;if(E.removeChild(B),E.firstChild===B)break}if(y>=1e4)console.error("Safety limit reached removing style children: 10000 iterations");E.textContent=`@import url('./${p}');`,c=!0}}else if(c&&!M){let p=0;while(E.firstChild&&p++<1e4){let N=E.firstChild;if(E.removeChild(N),E.firstChild===N)break}if(p>=1e4)console.error("Safety limit reached updating style children: 10000 iterations");xK(E,d,K)}if(Y)Y("styles",h+1,x.length)}}if(!M){if(K._exportedResources=X,w.length>0)K._exportWarnings=w}return{doc:M?null:t6(K,Q,J),extractedFiles:X,warnings:w,summary:{totalExtracted:X.length,images:X.filter((S)=>S.type==="image").length,audio:X.filter((S)=>S.type==="audio").length,video:X.filter((S)=>S.type==="video").length,scripts:X.filter((S)=>S.type==="script").length,fonts:X.filter((S)=>S.type==="font").length,stylesheets:X.filter((S)=>S.type==="stylesheet").length,totalSize:X.reduce((S,x)=>S+x.size,0)}}}var Wq={MAX_PRECISION:i6,DEFAULT_PRECISION:E$,PRECISION_LEVELS:E5,formatPrecision:T5,InputType:D0,OutputFormat:_7,OutputTarget:F7,detectInputType:r6,detectOutputTarget:K8,loadInput:a6,generateOutput:t6,saveOutput:b5,createOperation:G0,cleanupIds:Z8,cleanupNumericValues:f$,cleanupListOfValues:f5,cleanupAttributes:S5,cleanupEnableBackground:v5,removeUnknownsAndDefaults:D5,removeNonInheritableGroupAttrs:h5,removeUselessDefs:y5,removeHiddenElements:S$,removeEmptyText:u5,removeEmptyContainers:v$,removeDoctype:g5,removeXMLProcInst:x5,removeComments:D$,removeMetadata:h$,removeTitle:m5,removeDesc:d5,removeEditorsNSData:Q8,removeEmptyAttrs:p5,removeViewBox:c5,removeXMLNS:l5,removeRasterImages:n5,removeScriptElement:s5,convertShapesToPath:o5,convertPathData:i5,convertTransform:r5,convertColors:y$,convertStyleToAttrs:H8,convertEllipseToCircle:a5,collapseGroups:t5,mergePaths:e5,moveGroupAttrsToElems:$K,moveElemsAttrsToGroup:JK,minifyStyles:z8,inlineStyles:KK,sortAttrs:ZK,sortDefsChildren:QK,reusePaths:HK,removeOffCanvasPath:zK,removeStyleElement:qK,removeXlink:WK,addAttributesToSVGElement:jK,addClassesToSVGElement:GK,prefixIds:FK,removeDimensions:_K,removeAttributesBySelector:UK,removeAttrs:VK,removeElementsByAttr:MK,presetDefault:q8,presetNone:W8,applyPreset:OK,optimize:YK,createConfig:XK,flattenClipPaths:kK,flattenMasks:LK,flattenGradients:wK,flattenPatterns:BK,flattenFilters:NK,flattenUseElements:IK,imageToPath:CK,detectCollisions:PK,measureDistance:AK,validateXML:EK,validateSVG:TK,fixInvalidSVG:fK,ValidationSeverity:A0,flattenAll:vK,simplifyPath:DK,decomposeTransform:gK,optimizeAnimationTiming:hK,optimizePaths:yK,simplifyPaths:uK,embedExternalDependencies:G8,exportEmbeddedResources:mK,convertPathDataAdvanced:E9,parsePathCommands:l0,serializePathCommands:n0,formatPathNumber:T7,douglasPeucker:n6,visvalingamWhyatt:T9,simplifyPolyline:b9,simplifyPolylinePath:S9,isPurePolyline:f9,optimizeKeySplines:N9,optimizeKeyTimes:I9,optimizeAnimationValues:B$,formatSplineValue:l6,parseKeySplines:N$,serializeKeySplines:R9,isLinearSpline:I$,areAllSplinesLinear:F5,identifyStandardEasing:B9,STANDARD_EASINGS:w9,removeLeadingZero:D9,negativeExtraSpace:h9,convertToRelative:y9,convertToAbsolute:u9,lineShorthands:g9,convertToZ:x9,straightCurves:m9,collapseRepeated:d9,floatPrecision:p9,removeUselessCommands:c9,convertCubicToQuadratic:l9,convertQuadraticToSmooth:n9,convertCubicToSmooth:s9,arcShorthands:o9};var jq="1.2.0",dK={VERSION:jq,...F8},K4=dK;if(typeof window!=="undefined")window.SVGToolbox=dK;export{EK as validateXML,nz as validateSVGAsync,TK as validateSVG,m9 as straightCurves,QK as sortDefsChildren,ZK as sortAttrs,uK as simplifyPaths,DK as simplifyPath,b5 as saveOutput,HK as reusePaths,WK as removeXlink,x5 as removeXMLProcInst,l5 as removeXMLNS,c5 as removeViewBox,y5 as removeUselessDefs,c9 as removeUselessCommands,D5 as removeUnknownsAndDefaults,m5 as removeTitle,qK as removeStyleElement,s5 as removeScriptElement,n5 as removeRasterImages,zK as removeOffCanvasPath,h5 as removeNonInheritableGroupAttrs,h$ as removeMetadata,D9 as removeLeadingZero,S$ as removeHiddenElements,u5 as removeEmptyText,v$ as removeEmptyContainers,p5 as removeEmptyAttrs,MK as removeElementsByAttr,Q8 as removeEditorsNSData,g5 as removeDoctype,_K as removeDimensions,d5 as removeDesc,D$ as removeComments,VK as removeAttrs,UK as removeAttributesBySelector,gz as printHierarchicalMatrix,W8 as presetNone,q8 as presetDefault,FK as prefixIds,yK as optimizePaths,hK as optimizeAnimationTiming,YK as optimize,h9 as negativeExtraSpace,$K as moveGroupAttrsToElems,JK as moveElemsAttrsToGroup,z8 as minifyStyles,e5 as mergePaths,AK as measureDistance,a6 as loadInput,g9 as lineShorthands,KK as inlineStyles,CK as imageToPath,t6 as generateOutput,uz as generateFullCompatibilityMatrix,bK as generateFlexibleSVGTable,xz as generateCompatibilityMatrixSVG,mz as generateCompatibilityMatrixFlexible,T5 as formatPrecision,p9 as floatPrecision,IK as flattenUseElements,BK as flattenPatterns,LK as flattenMasks,wK as flattenGradients,NK as flattenFilters,kK as flattenClipPaths,vK as flattenAll,fK as fixInvalidSVG,mK as exportEmbeddedResources,Pz as escapeXml,G8 as embedExternalDependencies,K8 as detectOutputTarget,r6 as detectInputType,PK as detectCollisions,K4 as default,gK as decomposeTransform,G0 as createOperation,XK as createConfig,r5 as convertTransform,x9 as convertToZ,y9 as convertToRelative,u9 as convertToAbsolute,H8 as convertStyleToAttrs,o5 as convertShapesToPath,n9 as convertQuadraticToSmooth,i5 as convertPathData,a5 as convertEllipseToCircle,s9 as convertCubicToSmooth,l9 as convertCubicToQuadratic,y$ as convertColors,d9 as collapseRepeated,t5 as collapseGroups,f$ as cleanupNumericValues,f5 as cleanupListOfValues,Z8 as cleanupIds,v5 as cleanupEnableBackground,S5 as cleanupAttributes,o9 as arcShorthands,OK as applyPreset,yz as analyzeCompatibilityMatrix,fz as analyzeCompatibility,GK as addClassesToSVGElement,jK as addAttributesToSVGElement,A0 as ValidationSeverity,jq as VERSION,E5 as PRECISION_LEVELS,F7 as OutputTarget,_7 as OutputFormat,i6 as MAX_PRECISION,D0 as InputType,E$ as DEFAULT_PRECISION};
|