modern-text 2.0.8 → 2.0.9

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernText={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={grad:.9,turn:360,rad:360/(2*Math.PI)},n=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},r=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},a=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},o=function(e){return{r:i(e.r,0,255),g:i(e.g,0,255),b:i(e.b,0,255),a:i(e.a)}},s=function(e){return{r:r(e.r),g:r(e.g),b:r(e.b),a:r(e.a,3)}},c=/^#([0-9a-f]{3,8})$/i,l=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},u=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},d=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},f=function(e){return{h:a(e.h),s:i(e.s,0,100),l:i(e.l,0,100),a:i(e.a)}},p=function(e){return{h:r(e.h),s:r(e.s),l:r(e.l),a:r(e.a,3)}},m=function(e){return d((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=u(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b={string:[[function(e){var t=c.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?r(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?r(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=v.exec(e)||y.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:o({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var n=g.exec(e)||_.exec(e);if(!n)return null;var r,i;return m(f({h:(r=n[1],i=n[2],i===void 0&&(i=`deg`),Number(r)*(t[i]||1)),s:Number(n[3]),l:Number(n[4]),a:n[5]===void 0?1:Number(n[5])/(n[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,r=e.g,i=e.b,a=e.a,s=a===void 0?1:a;return n(t)&&n(r)&&n(i)?o({r:Number(t),g:Number(r),b:Number(i),a:Number(s)}):null},`rgb`],[function(e){var t=e.h,r=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!n(t)||!n(r)||!n(i)?null:m(f({h:Number(t),s:Number(r),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,r=e.s,o=e.v,s=e.a,c=s===void 0?1:s;return!n(t)||!n(r)||!n(o)?null:d(function(e){return{h:a(e.h),s:i(e.s,0,100),v:i(e.v,0,100),a:i(e.a)}}({h:Number(t),s:Number(r),v:Number(o),a:Number(c)}))},`hsv`]]},x=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},S=function(e){return typeof e==`string`?x(e.trim(),b.string):typeof e==`object`&&e?x(e,b.object):[null,void 0]},C=function(e,t){var n=h(e);return{h:n.h,s:i(n.s+100*t,0,100),l:n.l,a:n.a}},w=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},T=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:i(n.l+100*t,0,100),a:n.a}},E=function(){function e(e){this.parsed=S(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return r(w(this.rgba),2)},e.prototype.isDark=function(){return w(this.rgba)<.5},e.prototype.isLight=function(){return w(this.rgba)>=.5},e.prototype.toHex=function(){return e=s(this.rgba),t=e.r,n=e.g,i=e.b,o=(a=e.a)<1?l(r(255*a)):``,`#`+l(t)+l(n)+l(i)+o;var e,t,n,i,a,o},e.prototype.toRgb=function(){return s(this.rgba)},e.prototype.toRgbString=function(){return e=s(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return p(h(this.rgba))},e.prototype.toHslString=function(){return e=p(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=u(this.rgba),{h:r(e.h),s:r(e.s),v:r(e.v),a:r(e.a,3)};var e},e.prototype.invert=function(){return D({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,-e))},e.prototype.grayscale=function(){return D(C(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),D(T(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),D(T(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?D({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):r(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?D({h:e,s:t.s,l:t.l,a:t.a}):r(t.h)},e.prototype.isEqual=function(e){return this.toHex()===D(e).toHex()},e}(),D=function(e){return e instanceof E?e:new E(e)};function O(e){return e==null||e===``||e===`none`}function k(e,t=0,n=10**t){return Math.round(n*e)/n+0}function A(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function j(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>j(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=j(i,t):n[r]=i)}return n}function M(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function N(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function P(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function F(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function I(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),P(e,t.split(`.`),n)):e[t]}function L(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),F(e,t.split(`.`),n)}var R=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},z=Symbol.for(`declarations`),B=Symbol.for(`inited`);function V(e){let t;if(Object.hasOwn(e,z))t=e[z];else{let n=Object.getPrototypeOf(e);t={...n?V(n):{}},e[z]=t}return t}function ee(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?L(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??ne(e,t,r),o)}function te(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?I(e,r):e[i],a??=ne(e,t,n),a}function ne(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[B]?.[t]){e[B]||(e[B]={}),e[B][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function re(e,t){function n(){return this.getProperty?this.getProperty(e):te(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):ee(this,e,n,t)}return{get:n,set:r}}function ie(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=V(e);i[t]=r;let{get:a,set:o}=re(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function ae(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);ie(t.constructor,n,e)}}var oe=class extends R{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return te(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??ne(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)ee(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??ne(this,e,n),r)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return V(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return this}async _nextTick(){return`requestAnimationFrame`in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&=(this.onUpdate(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function se(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,D(t)}function ce(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}}function le(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ue=`#000000FF`;function de(e){return se(e).isValid()}function fe(e,t=!1){let n=se(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),ue}let{r,g:i,b:a,a:o}=ce(n.rgba);return`#${le(r)}${le(i)}${le(a)}${le(k(o*255))}`}var pe=pe||{};pe.parse=(function(){let e={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return y(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(I(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:y(b)}})}function s(t,r){let i=I(t);if(i){I(e.startCall)||n(`Missing (`);let t=r(i);return I(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=F(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return F(`directional`,e.sideOrCorner,1)}function u(){return F(`angular`,e.angleValue,1)||F(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,I(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||m();if(e)e.at=g();else{let t=h();if(t){e=t;let n=g();n&&(e.at=n)}else{let t=g();if(t)e={type:`default-radial`,at:t};else{let t=_();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=F(`shape`,/^(circle)/i,0);return e&&(e.style=P()||h()),e}function m(){let e=F(`shape`,/^(ellipse)/i,0);return e&&(e.style=_()||j()||h()),e}function h(){return F(`extent-keyword`,e.extentKeywords,1)}function g(){if(F(`position`,/^at/,0)){let e=_();return e||n(`Missing positioning value`),e}}function _(){let e=v();if(e.x||e.y)return{type:`position`,value:e}}function v(){return{x:j(),y:j()}}function y(t){let r=t(),i=[];if(r)for(i.push(r);I(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function b(){let e=x();return e||n(`Expected color definition`),e.length=j(),e}function x(){return C()||O()||D()||T()||w()||E()||S()}function S(){return F(`literal`,e.literalColor,0)}function C(){return F(`hex`,e.hexColor,1)}function w(){return s(e.rgbColor,()=>({type:`rgb`,value:y(A)}))}function T(){return s(e.rgbaColor,()=>({type:`rgba`,value:y(A)}))}function E(){return s(e.varColor,()=>({type:`var`,value:k()}))}function D(){return s(e.hslColor,()=>{I(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function O(){return s(e.hslaColor,()=>{let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;I(e.comma);let o=A();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function k(){return I(e.variableName)[1]}function A(){return I(e.number)[1]}function j(){return F(`%`,e.percentageValue,1)||M()||N()||P()}function M(){return F(`position-keyword`,e.positionKeywords,1)}function N(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return L(r-1),{type:`calc`,value:i}})}function P(){return F(`px`,e.pixelValue,1)||F(`em`,e.emValue,1)}function F(e,t,n){let r=I(t);if(r)return{type:e,value:r[n]}}function I(e){let n,r;return r=/^\s+/.exec(t),r&&L(r[0].length),n=e.exec(t),n&&L(n[0].length),n}function L(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var me=pe.parse.bind(pe),he=he||{};he.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);return i&&(r+=` `+i),r},visit_angular:function(e){return e.value+`deg`},visit_directional:function(e){return`to `+e.value},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})(),he.stringify.bind(he);function ge(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=k(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=fe(e.value);break;case`hex`:a=fe(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break}return{offset:i,color:a}})}function _e(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break}return{type:`linear-gradient`,angle:t,stops:ge(e.colorStops)}}function ve(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:ge(e.colorStops)}}function ye(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function be(e){return me(e).map(e=>{switch(e?.type){case`linear-gradient`:return _e(e);case`repeating-linear-gradient`:return{..._e(e),repeat:!0};case`radial-gradient`:return ve(e);case`repeating-radial-gradient`:return{...ve(e),repeat:!0};default:return}}).filter(Boolean)}var xe=[`color`];function Se(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=fe(t.color),M(t,xe)}var Ce=[`linearGradient`,`radialGradient`,`rotateWithShape`];function we(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=be(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return M(t,Ce)}var Te=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Ee(e){let t;return t=typeof e==`string`?{image:e}:{...e},M(t,Te)}var De=[`preset`,`foregroundColor`,`backgroundColor`];function Oe(e){let t;return t=typeof e==`string`?{preset:e}:{...e},O(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=fe(t.foregroundColor),O(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=fe(t.backgroundColor),M(t,De)}function ke(e){return!O(e.color)}function Ae(e){return typeof e==`string`?de(e):ke(e)}function je(e){return!O(e.image)&&ye(e.image)||!!e.linearGradient||!!e.radialGradient}function Me(e){return typeof e==`string`?ye(e):je(e)}function Ne(e){return!O(e.image)&&!ye(e.image)}function Pe(e){return typeof e==`string`?!de(e)&&!ye(e):Ne(e)}function Fe(e){return!O(e.preset)}function Ie(e){return typeof e==`string`?!1:Fe(e)}function Le(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Ae(e)&&Object.assign(t,Se(e)),Me(e)&&Object.assign(t,we(e)),Pe(e)&&Object.assign(t,Ee(e)),Ie(e)&&Object.assign(t,Oe(e)),M(j(t),Array.from(new Set([`enabled`,...xe,...Te,...Ce,...De])))}function Re(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function ze(e){return typeof e==`string`?{...Le(e)}:{...Le(e),...M(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Be(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Ve(e){return typeof e==`string`?{enabled:!0,color:fe(e)}:{...e,enabled:e.enabled??!0,color:O(e.color)?ue:fe(e.color)}}function He(){return{boxShadow:`none`}}function Ue(e){return j({blur:e.blur,brightness:e.brightness,contrast:e.contrast,grayscale:e.grayscale,hueRotate:e.hueRotate,invert:e.invert,opacity:e.opacity,saturate:e.saturate,sepia:e.sepia,duotone:e.duotone?[fe(e.duotone[0]),fe(e.duotone[1])]:void 0,biLevel:e.biLevel,colorChange:e.colorChange?{from:fe(e.colorChange.from),to:fe(e.colorChange.to)}:void 0})}var We=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`,`filter`];function Ge(e){let t=M(e,We),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function Ke(e){let t=Ge(e);return j({fill:O(t.fill)?void 0:Le(t.fill),outline:O(t.outline)?void 0:ze(t.outline),shadow:O(t.shadow)?void 0:Ve(t.shadow),transform:O(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin,filter:t.filter?Ue(t.filter):void 0})}function qe(){return{overflow:`visible`,direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Je(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function Ye(){return{...qe(),...Je(),...He(),...Re(),...Be(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function Xe(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function Ze(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function Qe(){return{...Xe(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function $e(){return{...Ze(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function et(){return{...$e(),...Qe(),textStrokeWidth:0,textStrokeColor:`none`}}var tt=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function nt(e){let t=j({...e,color:O(e.color)?void 0:fe(e.color),backgroundColor:O(e.backgroundColor)?void 0:fe(e.backgroundColor),borderColor:O(e.borderColor)?void 0:fe(e.borderColor),outlineColor:O(e.outlineColor)?void 0:fe(e.outlineColor),shadowColor:O(e.shadowColor)?void 0:fe(e.shadowColor),textStrokeColor:O(e.textStrokeColor)?void 0:fe(e.textStrokeColor)});for(let e of tt)if(e in t){let n=A(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function rt(){return{...Ye(),...et()}}var it=/\r\n|\n\r|\n|\r/;RegExp(`${it.source}|<br\\/>`,`g`);var at=RegExp(`^(${it.source})$`),ot=`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernText={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={grad:.9,turn:360,rad:360/(2*Math.PI)},n=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},r=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},a=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},o=function(e){return{r:i(e.r,0,255),g:i(e.g,0,255),b:i(e.b,0,255),a:i(e.a)}},s=function(e){return{r:r(e.r),g:r(e.g),b:r(e.b),a:r(e.a,3)}},c=/^#([0-9a-f]{3,8})$/i,l=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},u=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},d=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},f=function(e){return{h:a(e.h),s:i(e.s,0,100),l:i(e.l,0,100),a:i(e.a)}},p=function(e){return{h:r(e.h),s:r(e.s),l:r(e.l),a:r(e.a,3)}},m=function(e){return d((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=u(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b={string:[[function(e){var t=c.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?r(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?r(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=v.exec(e)||y.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:o({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var n=g.exec(e)||_.exec(e);if(!n)return null;var r,i;return m(f({h:(r=n[1],i=n[2],i===void 0&&(i=`deg`),Number(r)*(t[i]||1)),s:Number(n[3]),l:Number(n[4]),a:n[5]===void 0?1:Number(n[5])/(n[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,r=e.g,i=e.b,a=e.a,s=a===void 0?1:a;return n(t)&&n(r)&&n(i)?o({r:Number(t),g:Number(r),b:Number(i),a:Number(s)}):null},`rgb`],[function(e){var t=e.h,r=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!n(t)||!n(r)||!n(i)?null:m(f({h:Number(t),s:Number(r),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,r=e.s,o=e.v,s=e.a,c=s===void 0?1:s;return!n(t)||!n(r)||!n(o)?null:d(function(e){return{h:a(e.h),s:i(e.s,0,100),v:i(e.v,0,100),a:i(e.a)}}({h:Number(t),s:Number(r),v:Number(o),a:Number(c)}))},`hsv`]]},x=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},S=function(e){return typeof e==`string`?x(e.trim(),b.string):typeof e==`object`&&e?x(e,b.object):[null,void 0]},C=function(e,t){var n=h(e);return{h:n.h,s:i(n.s+100*t,0,100),l:n.l,a:n.a}},w=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},T=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:i(n.l+100*t,0,100),a:n.a}},E=function(){function e(e){this.parsed=S(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return r(w(this.rgba),2)},e.prototype.isDark=function(){return w(this.rgba)<.5},e.prototype.isLight=function(){return w(this.rgba)>=.5},e.prototype.toHex=function(){return e=s(this.rgba),t=e.r,n=e.g,i=e.b,o=(a=e.a)<1?l(r(255*a)):``,`#`+l(t)+l(n)+l(i)+o;var e,t,n,i,a,o},e.prototype.toRgb=function(){return s(this.rgba)},e.prototype.toRgbString=function(){return e=s(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return p(h(this.rgba))},e.prototype.toHslString=function(){return e=p(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=u(this.rgba),{h:r(e.h),s:r(e.s),v:r(e.v),a:r(e.a,3)};var e},e.prototype.invert=function(){return D({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,-e))},e.prototype.grayscale=function(){return D(C(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),D(T(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),D(T(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?D({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):r(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?D({h:e,s:t.s,l:t.l,a:t.a}):r(t.h)},e.prototype.isEqual=function(e){return this.toHex()===D(e).toHex()},e}(),D=function(e){return e instanceof E?e:new E(e)};function O(e){return e==null||e===``||e===`none`}function k(e,t=0,n=10**t){return Math.round(n*e)/n+0}function A(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function j(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>j(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=j(i,t):n[r]=i)}return n}function M(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function N(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function P(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function F(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function I(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),P(e,t.split(`.`),n)):e[t]}function L(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),F(e,t.split(`.`),n)}var R=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},z=Symbol.for(`declarations`),B=Symbol.for(`inited`);function V(e){let t;if(Object.hasOwn(e,z))t=e[z];else{let n=Object.getPrototypeOf(e);t={...n?V(n):{}},e[z]=t}return t}function ee(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?L(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??ne(e,t,r),o)}function te(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?I(e,r):e[i],a??=ne(e,t,n),a}function ne(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[B]?.[t]){e[B]||(e[B]={}),e[B][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function re(e,t){function n(){return this.getProperty?this.getProperty(e):te(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):ee(this,e,n,t)}return{get:n,set:r}}function ie(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=V(e);i[t]=r;let{get:a,set:o}=re(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function ae(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);ie(t.constructor,n,e)}}var oe=class extends R{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){t===void 0?delete this._properties[e]:this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return te(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??ne(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)ee(this,e,t,n);else{let r=this.offsetGetProperty(e);if(Object.is(r,t))return;let i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??ne(this,e,n),i)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return V(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return this}async _nextTick(){return`requestAnimationFrame`in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&=(this.onUpdate(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function se(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,D(t)}function ce(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}}function le(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ue=`#000000FF`;function de(e){return se(e).isValid()}function fe(e,t=!1){let n=se(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),ue}let{r,g:i,b:a,a:o}=ce(n.rgba);return`#${le(r)}${le(i)}${le(a)}${le(k(o*255))}`}var pe=pe||{};pe.parse=(function(){let e={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return y(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(I(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:y(b)}})}function s(t,r){let i=I(t);if(i){I(e.startCall)||n(`Missing (`);let t=r(i);return I(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=F(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return F(`directional`,e.sideOrCorner,1)}function u(){return F(`angular`,e.angleValue,1)||F(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,I(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||m();if(e)e.at=g();else{let t=h();if(t){e=t;let n=g();n&&(e.at=n)}else{let t=g();if(t)e={type:`default-radial`,at:t};else{let t=_();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=F(`shape`,/^(circle)/i,0);return e&&(e.style=P()||h()),e}function m(){let e=F(`shape`,/^(ellipse)/i,0);return e&&(e.style=_()||j()||h()),e}function h(){return F(`extent-keyword`,e.extentKeywords,1)}function g(){if(F(`position`,/^at/,0)){let e=_();return e||n(`Missing positioning value`),e}}function _(){let e=v();if(e.x||e.y)return{type:`position`,value:e}}function v(){return{x:j(),y:j()}}function y(t){let r=t(),i=[];if(r)for(i.push(r);I(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function b(){let e=x();return e||n(`Expected color definition`),e.length=j(),e}function x(){return C()||O()||D()||T()||w()||E()||S()}function S(){return F(`literal`,e.literalColor,0)}function C(){return F(`hex`,e.hexColor,1)}function w(){return s(e.rgbColor,()=>({type:`rgb`,value:y(A)}))}function T(){return s(e.rgbaColor,()=>({type:`rgba`,value:y(A)}))}function E(){return s(e.varColor,()=>({type:`var`,value:k()}))}function D(){return s(e.hslColor,()=>{I(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function O(){return s(e.hslaColor,()=>{let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;I(e.comma);let o=A();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function k(){return I(e.variableName)[1]}function A(){return I(e.number)[1]}function j(){return F(`%`,e.percentageValue,1)||M()||N()||P()}function M(){return F(`position-keyword`,e.positionKeywords,1)}function N(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return L(r-1),{type:`calc`,value:i}})}function P(){return F(`px`,e.pixelValue,1)||F(`em`,e.emValue,1)}function F(e,t,n){let r=I(t);if(r)return{type:e,value:r[n]}}function I(e){let n,r;return r=/^\s+/.exec(t),r&&L(r[0].length),n=e.exec(t),n&&L(n[0].length),n}function L(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var me=pe.parse.bind(pe),he=he||{};he.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);return i&&(r+=` `+i),r},visit_angular:function(e){return e.value+`deg`},visit_directional:function(e){return`to `+e.value},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})(),he.stringify.bind(he);function ge(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=k(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=fe(e.value);break;case`hex`:a=fe(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break}return{offset:i,color:a}})}function _e(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break}return{type:`linear-gradient`,angle:t,stops:ge(e.colorStops)}}function ve(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:ge(e.colorStops)}}function ye(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function be(e){return me(e).map(e=>{switch(e?.type){case`linear-gradient`:return _e(e);case`repeating-linear-gradient`:return{..._e(e),repeat:!0};case`radial-gradient`:return ve(e);case`repeating-radial-gradient`:return{...ve(e),repeat:!0};default:return}}).filter(Boolean)}var xe=[`color`];function Se(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=fe(t.color),M(t,xe)}var Ce=[`linearGradient`,`radialGradient`,`rotateWithShape`];function we(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=be(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return M(t,Ce)}var Te=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Ee(e){let t;return t=typeof e==`string`?{image:e}:{...e},M(t,Te)}var De=[`preset`,`foregroundColor`,`backgroundColor`];function Oe(e){let t;return t=typeof e==`string`?{preset:e}:{...e},O(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=fe(t.foregroundColor),O(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=fe(t.backgroundColor),M(t,De)}function ke(e){return!O(e.color)}function Ae(e){return typeof e==`string`?de(e):ke(e)}function je(e){return!O(e.image)&&ye(e.image)||!!e.linearGradient||!!e.radialGradient}function Me(e){return typeof e==`string`?ye(e):je(e)}function Ne(e){return!O(e.image)&&!ye(e.image)}function Pe(e){return typeof e==`string`?!de(e)&&!ye(e):Ne(e)}function Fe(e){return!O(e.preset)}function Ie(e){return typeof e==`string`?!1:Fe(e)}function Le(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Ae(e)&&Object.assign(t,Se(e)),Me(e)&&Object.assign(t,we(e)),Pe(e)&&Object.assign(t,Ee(e)),Ie(e)&&Object.assign(t,Oe(e)),M(j(t),Array.from(new Set([`enabled`,...xe,...Te,...Ce,...De])))}function Re(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function ze(e){return typeof e==`string`?{...Le(e)}:{...Le(e),...M(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Be(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Ve(e){return typeof e==`string`?{enabled:!0,color:fe(e)}:{...e,enabled:e.enabled??!0,color:O(e.color)?ue:fe(e.color)}}function He(){return{boxShadow:`none`}}function Ue(e){return j({blur:e.blur,brightness:e.brightness,contrast:e.contrast,grayscale:e.grayscale,hueRotate:e.hueRotate,invert:e.invert,opacity:e.opacity,saturate:e.saturate,sepia:e.sepia,duotone:e.duotone?[fe(e.duotone[0]),fe(e.duotone[1])]:void 0,biLevel:e.biLevel,colorChange:e.colorChange?{from:fe(e.colorChange.from),to:fe(e.colorChange.to)}:void 0})}var We=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`,`filter`];function Ge(e){let t=M(e,We),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function Ke(e){let t=Ge(e);return j({fill:O(t.fill)?void 0:Le(t.fill),outline:O(t.outline)?void 0:ze(t.outline),shadow:O(t.shadow)?void 0:Ve(t.shadow),transform:O(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin,filter:t.filter?Ue(t.filter):void 0})}function qe(){return{overflow:`visible`,direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Je(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function Ye(){return{...qe(),...Je(),...He(),...Re(),...Be(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function Xe(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function Ze(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function Qe(){return{...Xe(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function $e(){return{...Ze(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function et(){return{...$e(),...Qe(),textStrokeWidth:0,textStrokeColor:`none`}}var tt=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function nt(e){let t=j({...e,color:O(e.color)?void 0:fe(e.color),backgroundColor:O(e.backgroundColor)?void 0:fe(e.backgroundColor),borderColor:O(e.borderColor)?void 0:fe(e.borderColor),outlineColor:O(e.outlineColor)?void 0:fe(e.outlineColor),shadowColor:O(e.shadowColor)?void 0:fe(e.shadowColor),textStrokeColor:O(e.textStrokeColor)?void 0:fe(e.textStrokeColor)});for(let e of tt)if(e in t){let n=A(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function rt(){return{...Ye(),...et()}}var it=/\r\n|\n\r|\n|\r/;RegExp(`${it.source}|<br\\/>`,`g`);var at=RegExp(`^(${it.source})$`),ot=`
2
2
  `;function st(e){return at.test(e)}function ct(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?nt(e):{},a=n?Le(n):void 0,o=r?ze(r):void 0,s=j({...i,fill:a,outline:o,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=s:t.push(s),s}function i(e=``,t,i,a){let o=t?nt(t):{},s=i?Le(i):void 0,c=a?ze(a):void 0;Array.from(e).forEach(e=>{if(st(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(j({...o,fill:s,outline:c,content:ot})),r(a,t,i)}else{let t=n()||r(),i=t.fragments[t.fragments.length-1];if(i){let{content:t,fill:n,outline:r,...a}=i;if(N(s,n)&&N(c,r)&&N(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(j({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(ut(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(lt(e)){let{fragments:t,fill:n,outline:a,...o}=e;r(o,n,a),t.forEach(e=>{let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)})}else Array.isArray(e)?(r(),e.forEach(e=>{if(typeof e==`string`)i(e);else if(ut(e)){let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)}})):console.warn(`Failed to parse text content`,e)});let a=n();return a&&!a.fragments.length&&a.fragments.push({content:``}),t}function lt(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function ut(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function dt(e){return j({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function ft(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:ct(e)}:j({enabled:e.enabled??!0,content:ct(e.content??``),style:e.style?nt(e.style):void 0,deformation:e.deformation?dt(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...Ke(e),effects:e.effects?e.effects.map(e=>Ke(e)):void 0})}function pt(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=mt(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=xt(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return gt(a,o,n,s,c,l,0),o}function mt(e,t,n,r,i){let a;if(i===Wt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Vt(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Vt(i/r|0,e[i],e[i+1],a);return a&&Nt(a,a.next)&&(Ht(a),a=a.next),a}function ht(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(Nt(n,n.next)||H(n.prev,n,n.next)===0)){if(Ht(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function gt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&Et(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?vt(e,r,i,a):_t(e)){t.push(c.i,e.i,l.i),Ht(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=yt(ht(e),t),gt(e,t,n,r,i,a,2)):o===2&&bt(e,t,n,r,i,a):gt(ht(e),t,n,r,i,a,1);break}}}function _t(e){let t=e.prev,n=e,r=e.next;if(H(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&jt(i,s,a,c,o,l,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function vt(e,t,n,r){let i=e.prev,a=e,o=e.next;if(H(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Ot(p,m,t,n,r),v=Ot(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&jt(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&jt(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&jt(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&jt(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function yt(e,t){let n=e;do{let r=n.prev,i=n.next.next;!Nt(r,i)&&Pt(r,n,n.next,i)&&Rt(r,i)&&Rt(i,r)&&(t.push(r.i,n.i,i.i),Ht(n),Ht(n.next),n=e=i),n=n.next}while(n!==e);return ht(n)}function bt(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Mt(o,e)){let s=Bt(o,e);o=ht(o,o.next),s=ht(s,s.next),gt(o,t,n,r,i,a,0),gt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function xt(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=mt(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(kt(o))}i.sort(St);for(let e=0;e<i.length;e++)n=Ct(i[e],n);return n}function St(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function Ct(e,t){let n=wt(e,t);if(!n)return t;let r=Bt(n,e);return ht(r,r.next),ht(n,n.next)}function wt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(Nt(e,n))return n;do{if(Nt(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&At(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Rt(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&Tt(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function Tt(e,t){return H(e.prev,e,t.prev)<0&&H(t.next,e,e.next)<0}function Et(e,t,n,r){let i=e;do i.z===0&&(i.z=Ot(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Dt(i)}function Dt(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function Ot(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function kt(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function At(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function jt(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&At(e,t,n,r,i,a,o,s)}function Mt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Lt(e,t)&&(Rt(e,t)&&Rt(t,e)&&zt(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||Nt(e,t)&&H(e.prev,e,e.next)>0&&H(t.prev,t,t.next)>0)}function H(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Nt(e,t){return e.x===t.x&&e.y===t.y}function Pt(e,t,n,r){let i=It(H(e,t,n)),a=It(H(e,t,r)),o=It(H(n,r,e)),s=It(H(n,r,t));return!!(i!==a&&o!==s||i===0&&Ft(e,n,t)||a===0&&Ft(e,r,t)||o===0&&Ft(n,e,r)||s===0&&Ft(n,t,r))}function Ft(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function It(e){return e>0?1:e<0?-1:0}function Lt(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Pt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Rt(e,t){return H(e.prev,e,e.next)<0?H(e,t,e.next)>=0&&H(e,e.prev,t)>=0:H(e,t,e.prev)<0||H(e,e.next,t)<0}function zt(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Bt(e,t){let n=Ut(e.i,e.x,e.y),r=Ut(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Vt(e,t,n,r){let i=Ut(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Ht(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ut(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Gt(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var Kt={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function qt(e,t){let{fill:n=`#000`,stroke:r=`none`,strokeWidth:i=r===`none`?0:1,strokeLinecap:a=`round`,strokeLinejoin:o=`miter`,strokeMiterlimit:s=0,strokeDasharray:c=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:d=0,shadowBlur:f=0,shadowColor:p=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=n,e.strokeStyle=r,e.lineWidth=i,e.lineCap=a,e.lineJoin=Kt[o],e.miterLimit=s,e.setLineDash(c),e.lineDashOffset=l,e.shadowOffsetX=u,e.shadowOffsetY=d,e.shadowBlur=f,e.shadowColor=p}var U=class e{constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(e===0?this._x:this._x/e,t===0?this._y:this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){return this.set(n.x+(this._x-n.x)*e,n.y+(this._y-n.y)*t)}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},W=class e{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new U((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function Jt(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}var Yt=Math.PI*2;function Xt(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function Zt(e,t,n,r){let i=t.clone().sub(e),a=r.clone().sub(n),o=n.clone().sub(e),s=i.cross(a);if(s===0)return null;let c=o.cross(a)/s;return Math.abs(c)>1?null:new U(e.x+c*i.x,e.y+c*i.y)}var Qt=/([\w-]+)\((.+?)\)/g,$t=/[^,]+/g,en=/([-e.\d]+)(.*)/;function tn(e,t={}){let n=[],r;for(;(r=Qt.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:nn(e,i,t)})}return n}function nn(e,t,n={}){let r=[],i,a=0;for(;(i=$t.exec(t))!==null;)r.push(rn(e,i[0],{...n,index:a++}));return r}function rn(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(en),s={unit:o?.[2]??null,value:t,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(e){case`scale`:case`scaleX`:case`scaleY`:case`scale3d`:s.normalizedDefaultIntValue=1;break}switch(s.unit){case`%`:s.normalizedIntValue=s.intValue/100;break;case`rad`:s.normalizedIntValue=s.intValue/Yt;break;case`deg`:s.normalizedIntValue=s.intValue/360;break;case`px`:switch(a){case 0:s.normalizedIntValue=s.intValue/r;break;case 1:s.normalizedIntValue=s.intValue/i;break}break;default:s.normalizedIntValue=s.intValue;break}return s}function an(e,t){let n=1-e;return n*n*n*t}function on(e,t){let n=1-e;return 3*n*n*e*t}function sn(e,t){return 3*(1-e)*e*e*t}function cn(e,t){return e*e*e*t}function ln(e,t,n,r,i){return an(e,t)+on(e,n)+sn(e,r)+cn(e,i)}function un(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=pt(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var dn=8,fn=1.1920929e-7,pn=1;function mn(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(pn-Math.min(.99,Math.max(0,c)))/1;return u*=u,hn(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function hn(e,t,n,r,i,a,o,s,c,l,u){if(u>dn)return;let d=(e+n)/2,f=(t+r)/2,p=(n+i)/2,m=(r+a)/2,h=(i+o)/2,g=(a+s)/2,_=(d+p)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(_+y)/2,S=(v+b)/2;if(u>0){let u=o-e,d=s-t,f=Math.abs((n-o)*d-(r-s)*u),p=Math.abs((i-o)*d-(a-s)*u);if(f>fn&&p>fn){if((f+p)*(f+p)<=l*(u*u+d*d)){c.push(x,S);return}}else if(f>fn){if(f*f<=l*(u*u+d*d)){c.push(x,S);return}}else if(p>fn){if(p*p<=l*(u*u+d*d)){c.push(x,S);return}}else if(u=x-(e+o)/2,d=S-(t+s)/2,u*u+d*d<=l){c.push(x,S);return}}hn(e,t,d,f,_,v,x,S,c,l,u+1),hn(x,S,y,b,h,g,o,s,c,l,u+1)}var gn=8,_n=1.1920929e-7,vn=1;function yn(e,t,n,r,i,a,o=.5,s=[]){let c=(vn-Math.min(.99,Math.max(0,o)))/1;return c*=c,bn(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function bn(e,t,n,r,i,a,o,s,c){if(c>gn)return;let l=(t+r)/2,u=(n+i)/2,d=(r+a)/2,f=(i+o)/2,p=(l+d)/2,m=(u+f)/2,h=a-t,g=o-n,_=Math.abs((r-a)*g-(i-o)*h);if(_>_n){if(_*_<=s*(h*h+g*g)){e.push(p,m);return}}else if(h=p-(t+a)/2,g=m-(n+o)/2,h*h+g*g<=s){e.push(p,m);return}bn(e,t,n,l,u,p,m,s,c+1),bn(e,p,m,d,f,a,o,s,c+1)}function xn(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function Sn(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&xn(c,l,r,s,e,t)>0&&i++:l<=t&&xn(c,l,r,s,e,t)<0&&i--}return i}function Cn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function wn(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}function Tn(e){let t=e.map((e,t)=>({index:t})),n=[],r=e.map((e,t)=>{let r=e.length;if(!r)return n[t]=null,[];let i=[2**53-1,0],a=[0,2**53-1],o=[-(2**53-1),0],s=[0,-(2**53-1)];for(let t=0;t<r;t+=2){let n=e[t],r=e[t+1];i[0]>n&&(i=[n,r]),a[1]>r&&(a=[n,r]),o[0]<n&&(o=[n,r]),s[1]<r&&(s=[n,r])}n[t]={minX:i[0],minY:a[1],maxX:o[0],maxY:s[1]};let c=[(i[0]+o[0])/2,(a[1]+s[1])/2],l,u,d,f,p,m,h,g;for(let t=0;t<r;t+=2){let n=e[t],r=e[t+1],i=Math.abs(n-c[0]),a=Math.abs(r-c[1]);r<c[1]&&(!l||i<l)&&(l=i,d=[n,r]),r>c[1]&&(!u||i<u)&&(u=i,f=[n,r]),n<c[0]&&(!p||a<p)&&(p=a,h=[n,r]),n>c[0]&&(!m||a<m)&&(m=a,g=[n,r])}return[i,a,o,s,d,f,h,g].filter(Boolean)});for(let i=0,a=e.length;i<a;i++){let o=[],s=r[i],c=n[i];for(let t=0;t<a;t++){if(i===t)continue;let a=n[t];if(!c||!a||!wn(c,a))continue;let l={},u=[];for(let n=0,r=s.length;n<r;n++){let[r,i]=s[n],a=Sn(r,i,e[t]);l[a]=(l[a]??0)+1,u.push(a)}u.filter(e=>e!==0).length>u.filter(e=>e===0).length&&o.push({index:i,parentIndex:t,winding:Number(Array.from(Object.entries(l)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:Cn(r[i][0],r[t][0])})}o.reduce((e,t)=>e+t.winding,0)!==0&&(o.sort((e,t)=>e.dist-t.dist),t[i]=o[0])}return t}function En(e,t,n,r,i,a){return(n-e)*(a-t)-(i-e)*(r-t)}function Dn(e,t,n){let r=n.length,i=0;for(let a=0;a<r;a+=2){let o=n[a],s=n[a+1],c=(a+2)%r,l=n[c],u=n[c+1];s<=t?u>t&&En(o,s,l,u,e,t)>0&&i++:u<=t&&En(o,s,l,u,e,t)<0&&i--}return i}function On(e,t,n){let r=n.length,i=0;for(let a=0;a<r;a+=2){let o=n[a],s=n[a+1],c=(a+2)%r,l=n[c],u=n[c+1];(s<=t&&u>t||s>t&&u<=t)&&e<o+(t-s)/(u-s)*(l-o)&&i++}return i}function kn(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s,l=c===0?0:((e-n)*o+(t-r)*s)/c;l<0?l=0:l>1&&(l=1);let u=n+l*o,d=r+l*s;return Math.hypot(e-u,t-d)}function An(e,t,n=`nonzero`){return t.length<6?!1:n===`evenodd`?(On(e.x,e.y,t)&1)==1:Dn(e.x,e.y,t)!==0}function jn(e,t,n=`nonzero`){let{x:r,y:i}=e;if(n===`evenodd`){let e=0;for(let n=0,a=t.length;n<a;n++){let a=t[n];a.length>=6&&(e+=On(r,i,a))}return(e&1)==1}let a=0;for(let e=0,n=t.length;e<n;e++){let n=t[e];n.length>=6&&(a+=Dn(r,i,n))}return a!==0}function Mn(e,t,n=!1){let r=t.length;if(r<2)return 1/0;let{x:i,y:a}=e;if(r===2)return Math.hypot(i-t[0],a-t[1]);let o=1/0;for(let e=0;e<r-2;e+=2){let n=kn(i,a,t[e],t[e+1],t[e+2],t[e+3]);n<o&&(o=n)}if(n&&r>=6){let e=kn(i,a,t[r-2],t[r-1],t[0],t[1]);e<o&&(o=e)}return o}function Nn(e,t){let n=1-e;return n*n*t}function Pn(e,t){return 2*(1-e)*e*t}function Fn(e,t){return e*e*t}function In(e,t,n,r){return Nn(e,t)+Pn(e,n)+Fn(e,r)}var Ln=1e-4,Rn=1e-4;function zn(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=Ln;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=Bn(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=Hn(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=Vn(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=Hn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,L=Math.min(n*n+r*r,i*i+a*a),R=l?N:P;h<=L+R*R*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=Hn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=Hn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=Hn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=Hn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=Hn(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=Vn(C,w,D,O,N,P,!1,m)));let F=Rn*Rn;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function Bn(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function Vn(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function Hn(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var Un=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}_array;set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}skewX(e){let t=Math.tan(e);return this.a+=t*this.b,this.c+=t*this.d,this.tx+=t*this.ty,this}skewY(e){let t=Math.tan(e);return this.b+=t*this.a,this.d+=t*this.c,this.ty+=t*this.tx,this}skew(e,t){let n=Math.tan(e),r=Math.tan(t),i=this.a,a=this.b,o=this.c,s=this.d,c=this.tx,l=this.ty;return this.a=i+n*a,this.b=r*i+a,this.c=o+n*s,this.d=r*o+s,this.tx=c+n*l,this.ty=r*c+l,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/Yt;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=-Math.atan2(-i,a),l=Math.atan2(r,n),u=Math.abs(c+l);return u<1e-5||Math.abs(Yt-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=l),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new U;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new U;let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=1/(n*a+i*-r),l=e.x,u=e.y;return t.x=a*c*l+-i*c*u+(s*i-o*a)*c,t.y=n*c*u+-r*c*l+(-s*n+o*r)*c,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}prependCssTransform(t,n={}){let{width:r=1,height:i=1}=n,a=new e;return tn(t,{width:r,height:i}).reverse().forEach(({name:e,args:t})=>{let n=t.map(e=>e.normalizedIntValue);switch(e){case`translateX`:a.translateX(n[0]*r);break;case`translateY`:a.translateY(n[0]*i);break;case`translateZ`:a.translateZ(n[0]);break;case`translate`:a.translate(n[0]*r,(n[1]??n[0])*i);break;case`translate3d`:a.translate3d(n[0]*r,(n[1]??n[0])*i,n[2]??n[1]??n[0]);break;case`scaleX`:a.scaleX(n[0]);break;case`scaleY`:a.scaleY(n[0]);break;case`scale`:a.scale(n[0],n[1]??n[0]);break;case`scale3d`:a.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotateX`:a.rotateX(n[0]*Yt);break;case`rotateY`:a.rotateY(n[0]*Yt);break;case`rotateZ`:a.rotateZ(n[0]*Yt);break;case`rotate`:a.rotate(n[0]*Yt);break;case`rotate3d`:a.rotate3d(n[0]*Yt,(n[1]??n[0])*Yt,(n[2]??n[1]??n[0])*Yt,(n[3]??n[2]??n[1]??n[0])*Yt);break;case`skewX`:a.skewX(n[0]*Yt);break;case`skewY`:a.skewY(n[0]*Yt);break;case`skew`:a.skew(n[0]*Yt,(n[0]??n[1])*Yt);break;case`matrix`:a.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}),this.prepend(a),this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}toJSON(){return{a:this.a,b:this.b,c:this.c,d:this.d,tx:this.tx,ty:this.ty}}destroy(){this._array=void 0}};function Wn(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function Gn(e,t,n,r,i,a,o,s){if(t===0||n===0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,l=(o.y-s.y)/2,u=Math.cos(r)*c+Math.sin(r)*l,d=-Math.sin(r)*c+Math.cos(r)*l,f=t*t,p=n*n,m=u*u,h=d*d,g=m/f+h/p;if(g>1){let e=Math.sqrt(g);t=e*t,n=e*n,f=t*t,p=n*n}let _=f*h+p*m,v=(f*p-_)/_,y=Math.sqrt(Math.max(0,v));i===a&&(y=-y);let b=y*t*d/n,x=-y*n*u/t,S=Math.cos(r)*b-Math.sin(r)*x+(o.x+s.x)/2,C=Math.sin(r)*b+Math.cos(r)*x+(o.y+s.y)/2,w=Wn(1,0,(u-b)/t,(d-x)/n),T=Wn((u-b)/t,(d-x)/n,(-u-b)/t,(-d-x)/n)%(Math.PI*2);e.ellipse(S,C,t,n,r,w,w+T,a===0)}var G={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Kn(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function c(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function l(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let u,d=e.length;for(let f=0;f<d;f++){if(u=e[f],Array.isArray(t)&&t.includes(s.length%n)&&G.FLAGS.test(u)){r=1,a=u,l();continue}if(r===0){if(G.WHITESPACE.test(u))continue;if(G.DIGIT.test(u)||G.SIGN.test(u)){r=1,a=u;continue}if(G.POINT.test(u)){r=2,a=u;continue}G.COMMA.test(u)&&(i&&c(u,f,s),i=!0)}if(r===1){if(G.DIGIT.test(u)){a+=u;continue}if(G.POINT.test(u)){a+=u,r=2;continue}if(G.EXP.test(u)){r=3;continue}G.SIGN.test(u)&&a.length===1&&G.SIGN.test(a[0])&&c(u,f,s)}if(r===2){if(G.DIGIT.test(u)){a+=u;continue}if(G.EXP.test(u)){r=3;continue}G.POINT.test(u)&&a[a.length-1]===`.`&&c(u,f,s)}if(r===3){if(G.DIGIT.test(u)){o+=u;continue}if(G.SIGN.test(u)){if(o===``){o+=u;continue}o.length===1&&G.SIGN.test(o)&&c(u,f,s)}}G.WHITESPACE.test(u)?(l(),r=0,i=!1):G.COMMA.test(u)?(l(),r=0,i=!0):G.SIGN.test(u)?(l(),r=1,a=u):G.POINT.test(u)?(l(),r=2,a=u):c(u,f,s)}return l(),s}function qn(e,t){return e-(t-e)}function Jn(e,t){let n=new U,r=new U,i=``;for(let a=0,o=e.length;a<o;a++){let o=e[a];if(((o.type===`s`||o.type===`S`)&&!`CcSs`.includes(i)||(o.type===`t`||o.type===`T`)&&!`QqTt`.includes(i))&&r.copyFrom(n),o.type===`m`||o.type===`M`)o.type===`m`?n.add(o):n.copyFrom(o),t.moveTo(n.x,n.y),r.copyFrom(n);else if(o.type===`h`||o.type===`H`)o.type===`h`?n.x+=o.x:n.x=o.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`v`||o.type===`V`)o.type===`v`?n.y+=o.y:n.y=o.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`l`||o.type===`L`)o.type===`l`?n.add(o):n.copyFrom(o),t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`c`||o.type===`C`)o.type===`c`?(t.bezierCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`s`||o.type===`S`)o.type===`s`?(t.bezierCurveTo(qn(n.x,r.x),qn(n.y,r.y),n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(qn(n.x,r.x),qn(n.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`q`||o.type===`Q`)o.type===`q`?(t.quadraticCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x,n.y+o.y),r.x=n.x+o.x1,r.y=n.y+o.y1,n.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,n.copyFrom(o));else if(o.type===`t`||o.type===`T`){let e=qn(n.x,r.x),i=qn(n.y,r.y);r.x=e,r.y=i,o.type===`t`?(t.quadraticCurveTo(e,i,n.x+o.x,n.y+o.y),n.add(o)):(t.quadraticCurveTo(e,i,o.x,o.y),n.copyFrom(o))}else if(o.type===`a`||o.type===`A`){let e=n.clone();if(o.type===`a`){if(o.x===0&&o.y===0)continue;n.add(o)}else{if(n.equals(o))continue;n.copyFrom(o)}r.copyFrom(n),Gn(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,e,n)}else o.type===`z`||o.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,o);i=o.type}}function Yn(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break}}return r.join(` `)}var Xn=/[a-df-z][^a-df-z]*/gi;function Zn(e){let t=[],n=e.match(Xn);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=Kn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=Kn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=Kn(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=Kn(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var Qn=`data:image/svg+xml;`,$n=`${Qn}base64,`,er=`${Qn}charset=utf8,`;function tr(e){if(typeof e==`string`){let t;e.startsWith($n)?(e=e.substring($n.length,e.length),t=atob(e)):e.startsWith(er)?(e=e.substring(er.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}
3
3
  ${t}`);return n.documentElement}else return e}var nr=`px`,rr=90,ir=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],ar={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function K(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=ir.length;n<r;n++){let r=ir[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return n=ar[t][nr],n<0&&(n=ar[t].in*rr),n*Number.parseFloat(e)}function or(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=sr(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function sr(e){let t=new Un;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(K(e.getAttribute(`x`)),K(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.prependCssTransform(e.getAttribute(`transform`)),t}function cr(e){return new Wr().arc(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`r`)||0),0,Math.PI*2)}function lr(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function ur(e){return new Wr().ellipse(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`rx`)||0),K(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function dr(e){return new Wr().moveTo(K(e.getAttribute(`x1`)||0),K(e.getAttribute(`y1`)||0)).lineTo(K(e.getAttribute(`x2`)||0),K(e.getAttribute(`y2`)||0))}function fr(e){let t=new Wr,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var pr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function mr(e){let t=new Wr,n=0;return e.getAttribute(`points`)?.replace(pr,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var hr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function gr(e){let t=new Wr,n=0;return e.getAttribute(`points`)?.replace(hr,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function _r(e){let t=K(e.getAttribute(`x`)||0),n=K(e.getAttribute(`y`)||0),r=e.getAttribute(`rx`),i=e.getAttribute(`ry`),a=K(r??i??0),o=K(i??r??0),s=K(e.getAttribute(`width`)),c=K(e.getAttribute(`height`));a=Math.max(0,Math.min(a,s/2)),o=Math.max(0,Math.min(o,c/2));let l=.448084975506,u=new Wr;return u.moveTo(t+a,n),u.lineTo(t+s-a,n),(a!==0||o!==0)&&u.bezierCurveTo(t+s-a*l,n,t+s,n+o*l,t+s,n+o),u.lineTo(t+s,n+c-o),(a!==0||o!==0)&&u.bezierCurveTo(t+s,n+c-o*l,t+s-a*l,n+c,t+s-a,n+c),u.lineTo(t+a,n+c),(a!==0||o!==0)&&u.bezierCurveTo(t+a*l,n+c,t,n+c-o*l,t,n+c-o),u.lineTo(t,n+o),(a!==0||o!==0)&&u.bezierCurveTo(t,n+o*l,t+a*l,n,t+a,n),u}function vr(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,K(e)))}function s(e){return Math.max(0,K(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>K(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,K),i(`visibility`,`visibility`),t}function yr(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=vr(e,o,r);break;case`style`:lr(e,r);break;case`g`:o=vr(e,o,r);break;case`path`:o=vr(e,o,r),e.hasAttribute(`d`)&&(a=fr(e));break;case`rect`:o=vr(e,o,r),a=_r(e);break;case`polygon`:o=vr(e,o,r),a=mr(e);break;case`polyline`:o=vr(e,o,r),a=gr(e);break;case`circle`:o=vr(e,o,r),a=cr(e);break;case`ellipse`:o=vr(e,o,r),a=ur(e);break;case`line`:o=vr(e,o,r),a=dr(e);break;case`defs`:i=!0;break;case`use`:{o=vr(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?yr(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new Un,c=[],l=or(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||yr(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function br(e){let t=tr(e);return new Gr(yr(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var xr=class{arcLengthDivision=200;_lengths=[];_adaptiveCache;_owner;_invalidating=!1;invalidate(){return this._invalidating?this:(this._invalidating=!0,this._invalidateSelf(),this._owner?.invalidate(),this._invalidating=!1,this)}_invalidateSelf(){this._lengths.length=0,this._adaptiveCache=void 0}_getCachedAdaptiveVertices(){return this._adaptiveCache??=this.getAdaptiveVertices()}getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this.invalidate(),this}getUnevenVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],i=e[n+1];t.push(new U(r,i))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=U.MAX,t=U.MIN){let n=this.getAdaptiveVertices(),r=e.x,i=e.y,a=t.x,o=t.y;for(let e=0,t=n.length;e<t;e+=2){let t=n[e],s=n[e+1];t<r&&(r=t),s<i&&(i=s),t>a&&(a=t),s>o&&(o=s)}return e.set(r,i),t.set(a,o),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}isPointInFill(e,t={}){return An(e,this._getCachedAdaptiveVertices(),t.fillRule)}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0,closed:i=!1}=t;return Mn(e,this._getCachedAdaptiveVertices(),i)<=n/2+r}contains(e,t,n={}){return this.isPointInFill({x:e,y:t},n)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return un(this.getFillVertices(e),e)}strokeTriangulate(e){return zn(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return Yn(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},Sr=new Un,Cr=new Un,wr=new Un,Tr=new U,Er=class extends xr{constructor(e=new U,t=new U,n=new U,r=0,i=0,a=Math.PI*2,o=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new U){let n=this._getDeltaAngle(),r=this.startAngle+e*n,i=this.cx+this.rx*Math.cos(r),a=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=i-this.cx,r=a-this.cy;i=n*e-r*t+this.cx,a=n*t+r*e+this.cy}return t.set(i,a)}_pointAtAngle(e,t){let n=this.cx+this.rx*Math.cos(e),r=this.cy+this.ry*Math.sin(e);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),i=n-this.cx,a=r-this.cy;n=i*e-a*t+this.cx,r=i*t+a*e+this.cy}return t.set(n,r)}getMinMax(e=U.MAX,t=U.MIN){let{startAngle:n,rotate:r}=this,i=this._getDeltaAngle(),a=Math.cos(r),o=Math.sin(r),s=Tr,c=e.x,l=e.y,u=t.x,d=t.y,f=e=>{this._pointAtAngle(e,s),s.x<c&&(c=s.x),s.y<l&&(l=s.y),s.x>u&&(u=s.x),s.y>d&&(d=s.y)};f(n),f(n+i);let p=Math.atan2(-this.ry*o,this.rx*a),m=Math.atan2(this.ry*a,this.rx*o),h=[p,p+Math.PI,m,m+Math.PI];for(let e=0;e<4;e++)Dr(h[e],n,i)&&f(h[e]);return e.set(c,l),t.set(u,d),{min:e.finite(),max:t.finite()}}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return Tr.set(this.cx,this.cy),e.apply(Tr,Tr),this.cx=Tr.x,this.cy=Tr.y,jr(e)?Or(this,e):kr(this,e),this.invalidate(),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function Dr(e,t,n){let r=Math.PI*2,i=1e-9;if(Math.abs(n)>=r-i)return!0;let a=(e-t)%r;return n>=0?(a<-1e-9&&(a+=r),a>=-1e-9&&a<=n+i):(a>i&&(a-=r),a<=i&&a>=n-i)}function Or(e,t){let n=e.rx,r=e.ry,i=Math.cos(e.rotate),a=Math.sin(e.rotate),o=new U(n*i,n*a),s=new U(-r*a,r*i),c=t.a*o.x+t.c*o.y,l=t.b*o.x+t.d*o.y,u=t.a*s.x+t.c*s.y,d=t.b*s.x+t.d*s.y,f=Sr.set(c,l,u,d,0,0),{a:p,b:m,c:h,d:g}=Cr.copyFrom(f).affineInvert(),_=Mr(p*p+m*m,h*p+g*m,h*h+g*g),v=Math.sqrt(_.rt1),y=Math.sqrt(_.rt2);if(e.rx=1/v,e.ry=1/y,e.rotate=Math.atan2(_.sn,_.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=Cr.set(v,0,0,y,0,0),r=wr.set(_.cs,_.sn,-_.sn,_.cs,0,0),i=n.append(r).append(f),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),Ar(t)&&(e.clockwise=!e.clockwise)}}function kr(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,Ar(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function Ar(e){return e.a*e.d-e.c*e.b<0}function jr(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function Mr(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?(i=.5*(c-u),s=1/i,r=e*s*n-t*s*t):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var Nr=class extends Er{constructor(e=0,t=0,n=1,r=0,i=Math.PI*2,a=!1){super(new U(e,t),new U(n,n),new U,0,r,i,a)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},Pr=class e extends xr{constructor(e=new U,t=new U){super(),this.p1=e,this.p2=t}static from(t,n,r,i){return new e(new U(t,n),new U(r,i))}getPoint(e,t=new U){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new U){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},Fr=class e extends xr{constructor(e=[]){super(),this.curves=e}_adaptiveCacheLen=-1;_invalidateSelf(){super._invalidateSelf(),this._adaptiveCacheLen=-1,this.curves.forEach(e=>e.invalidate())}_getCachedAdaptiveVertices(){return(!this._adaptiveCache||this._adaptiveCacheLen!==this.curves.length)&&(this.curves.forEach(e=>{e._owner=this}),this._adaptiveCache=this.getAdaptiveVertices(),this._adaptiveCacheLen=this.curves.length),this._adaptiveCache}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new U){let n=e*this.getLength(),r=this.getLengths(),i=r.length;if(i===0)return t;let a=0,o=i-1;for(;a<o;){let e=a+o>>>1;r[e]<n?a=e+1:o=e}let s=r[a]-n,c=this.curves[a],l=c.getLength();return c.getPointAt(l===0?0:1-s/l,t)}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)this.curves[t]._owner=this,n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof Pr?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this._invalidating=!0,this.curves.forEach(t=>t.applyTransform(e)),this._invalidating=!1,this.invalidate(),this}getMinMax(e=U.MAX,t=U.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},Ir=class e extends xr{constructor(e=new U,t=new U,n=new U,r=new U){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(t,n,r,i,a,o,s,c){return new e(new U(t,n),new U(r,i),new U(a,o),new U(s,c))}getPoint(e,t=new U){let{p1:n,cp1:r,cp2:i,p2:a}=this;return t.set(ln(e,n.x,r.x,i.x,a.x),ln(e,n.y,r.y,i.y,a.y))}getAdaptiveVertices(e=[]){return mn(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){if(Math.abs(e)<1e-12){if(Math.abs(t)<1e-12)return[];let e=-n/t;return e>=0&&e<=1?[e]:[]}let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp1:r,cp2:i,p2:a}=this,o=this._solveQuadratic(3*(-n.x+3*r.x-3*i.x+a.x),6*(n.x-2*r.x+i.x),3*(r.x-n.x)),s=this._solveQuadratic(3*(-n.y+3*r.y-3*i.y+a.y),6*(n.y-2*r.y+i.y),3*(r.y-n.y)),c=[0,1,...o,...s];for(let n of c){let r=this.getPoint(n);e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),t.x=Math.max(t.x,r.x),t.y=Math.max(t.y,r.y)}return{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Lr=class extends Er{constructor(e=0,t=0,n=1,r=1,i=0,a=0,o=Math.PI*2,s=!1){super(new U(e,t),new U(n,r),new U,i,a,o,s)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},Rr=class extends Fr{},zr=class e extends xr{constructor(e=new U,t=new U,n=new U){super(),this.p1=e,this.cp=t,this.p2=n}static from(t,n,r,i,a,o){return new e(new U(t,n),new U(r,i),new U(a,o))}getPoint(e,t=new U){let{p1:n,cp:r,p2:i}=this;return t.set(In(e,n.x,r.x,i.x),In(e,n.y,r.y,i.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return yn(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp:r,p2:i}=this,a=(e,t,n)=>{let r=e-2*t+n;if(Math.abs(r)<1e-12)return null;let i=(e-t)/r;return i>0&&i<1?i:null},o=a(n.x,r.x,i.x),s=a(n.y,r.y,i.y),c=[n.x,i.x],l=[n.y,i.y];return o!==null&&c.push(In(o,n.x,r.x,i.x)),s!==null&&l.push(In(s,n.y,r.y,i.y)),e.x=Math.min(e.x,...c),e.y=Math.min(e.y,...l),t.x=Math.max(t.x,...c),t.y=Math.max(t.y,...l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Br=class extends Rr{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,i=[new U(e,t),new U(e+n,t),new U(e+n,t+r),new U(e,t+r)];return this.curves=[new Pr(i[0],i[1]),new Pr(i[1],i[2]),new Pr(i[2],i[3]),new Pr(i[3],i[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},Vr=class extends Fr{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,i=Math.max(0,Math.min(this.radius,Math.abs(n)/2,Math.abs(r)/2)),a=e,o=e+i,s=e+n-i,c=e+n,l=t,u=t+i,d=t+r-i,f=t+r;if(i<=0)this.curves=[Pr.from(a,l,c,l),Pr.from(c,l,c,f),Pr.from(c,f,a,f),Pr.from(a,f,a,l)];else{let e=Math.PI/2;this.curves=[Pr.from(o,l,s,l),new Nr(s,u,i,-e,0,!0),Pr.from(c,u,c,d),new Nr(s,d,i,0,e,!0),Pr.from(s,f,o,f),new Nr(o,d,i,e,Math.PI,!0),Pr.from(a,d,a,u),new Nr(o,u,i,Math.PI,Math.PI*1.5,!0)]}return this.invalidate(),this}drawTo(e){return e.roundRect(this.x,this.y,this.width,this.height,this.radius),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},Hr=class extends xr{constructor(e=[]){super(),this.points=e}getPoint(e,t=new U){let{points:n}=this,r=(n.length-1)*e,i=Math.floor(r),a=r-i,o=n[i===0?i:i-1],s=n[i],c=n[i>n.length-2?n.length-1:i+1],l=n[i>n.length-3?n.length-1:i+2];return t.set(Jt(a,o.x,s.x,c.x,l.x),Jt(a,o.y,s.y,c.y,l.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},Ur=class extends Fr{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return Jn(e,this),this}addData(e){return this.addCommands(Zn(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0}=t,i=this._getCachedAdaptiveVertices(),a=i.length;return Mn(e,i,t.closed??(this.autoClose||a>=6&&i[0]===i[a-2]&&i[1]===i[a-1]))<=n/2+r}_setCurrentPoint(e){return this.currentPoint=new U(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new Pr(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new U(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(Pr.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(Ir.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(zr.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new Nr(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Lr(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Br(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new Vr(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new U;return this.curves.push(new Hr([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},Wr=class e extends Fr{_meta;_ringsCache;_ringsCacheLen=-1;currentCurve=new Ur;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new Ur().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.curves.length&&(this.currentCurve=new Ur,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new Ur,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return Jn(e,this),this}addData(e){return this.addCommands(Zn(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this.invalidate(),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this.invalidate(),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(e,t)}),this.invalidate(),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=Zt(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this.invalidate(),this}_invalidateSelf(){super._invalidateSelf(),this._ringsCache=void 0,this._ringsCacheLen=-1}_getRings(){return(!this._ringsCache||this._ringsCacheLen!==this.curves.length)&&(this._ringsCache=this.curves.map(e=>(e._owner=this,e.getAdaptiveVertices())),this._ringsCacheLen=this.curves.length),this._ringsCache}isPointInFill(e,t={}){let n=t.fillRule??this.style.fillRule??`nonzero`;return jn(e,this._getRings(),n)}isPointInStroke(e,t={}){let n=t.strokeWidth??this.strokeWidth,{tolerance:r=0,closed:i}=t;return this.curves.some(t=>t.isPointInStroke(e,{strokeWidth:n,tolerance:r,closed:i}))}getMinMax(e=U.MAX,t=U.MIN,n=!0){if(this.curves.forEach(n=>{n.getMinMax(e,t)}),n){let n=this.strokeWidth;if(n>1&&Number.isFinite(e.x)){let r=n/2;e.set(e.x-r,e.y-r),t.set(t.x+r,t.y+r)}}return{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=Tn(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}un(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new W(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),qt(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),qt(e,t),this.getControlPointRefs().forEach(t=>{Gt(e,t.x,t.y,{radius:4})}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[Xt(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},Gr=class{constructor(e=[],t){this.paths=e,this.viewBox=t}isPointInFill(e,t={}){return this.paths.some(n=>n.isPointInFill(e,t))}contains(e,t,n={}){return this.isPointInFill({x:e,y:t},n)}hitTest(e,t={}){let{stroke:n=!0,tolerance:r,fillRule:i}=t;for(let t=this.paths.length-1;t>=0;t--){let a=this.paths[t];if((a.style.fill??`#000`)!==`none`&&a.isPointInFill(e,{fillRule:i})||n&&(a.style.stroke??`none`)!==`none`&&a.isPointInStroke(e,{tolerance:r}))return a}}getBoundingBox(e=!0){if(!this.paths.length)return;let t=U.MAX,n=U.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new W(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
4
4
  points="${t.join(`,`)} ${r.join(`,`)} ${i.join(`,`)}"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-text",
3
3
  "type": "module",
4
- "version": "2.0.8",
4
+ "version": "2.0.9",
5
5
  "packageManager": "pnpm@10.18.1",
6
6
  "description": "Measure and render text in a way that describes the DOM.",
7
7
  "author": "wxm",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "diff": "^9.0.0",
63
63
  "modern-font": "^0.6.0",
64
- "modern-idoc": "^0.11.9",
64
+ "modern-idoc": "^0.12.1",
65
65
  "modern-path2d": "^1.7.0"
66
66
  },
67
67
  "devDependencies": {