Files
mermaid-live-editor/_app/immutable/chunks/Ce5RGmfp.js
T
2025-03-15 01:10:54 +00:00

17 lines
125 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import"./CWj6FrbW.js";import{h as Te,a8 as Fn,p as Hn,o as $n,x as Oe,y as Bn,a as Un,B as te,m as tt,aj as Pt,z as ke,H as ut,A as Ne,u as Rt,aw as Gn}from"./PqI9hdxU.js";import{t as we,a as It,b as qn}from"./tO_bP749.js";import{a as Ve,i as Pe,s as Wn,b as Re}from"./CEUc2JjY.js";import{b as Ie}from"./lJ1cVSmK.js";import{bh as jn,bi as ce,aP as ze,aO as Xn,bj as ee,bk as Yn,bl as Qn,bm as Kn,at as Jn,bn as tr}from"./Br9u7Cn3.js";import{u as er}from"./W_wjfChv.js";function mn(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=mn(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function nr(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=mn(t))&&(r&&(r+=" "),r+=e);return r}function qi(t){return typeof t=="object"?nr(t):t??""}const Le=[...`
\r\f \v\uFEFF`];function rr(t,e,n){var r=t==null?"":""+t;if(e&&(r=r?r+" "+e:e),n){for(var i in n)if(n[i])r=r?r+" "+i:i;else if(r.length)for(var s=i.length,a=0;(a=r.indexOf(i,a))>=0;){var o=a+s;(a===0||Le.includes(r[a-1]))&&(o===r.length||Le.includes(r[o]))?r=(a===0?"":r.substring(0,a))+r.substring(o+1):a=o}}return r===""?null:r}function ir(t,e,n,r,i,s){var a=t.__className;if(Te||a!==n){var o=rr(n,r,s);(!Te||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):t.className=o),t.__className=n}else if(s&&i!==s)for(var l in s){var u=!!s[l];(i==null||u!==!!i[l])&&t.classList.toggle(l,u)}return s}let Tt=!0,vn,Ht,$t;const sr=1e3,or=150,bn=jn(()=>{Tt=!0,vn()},sr),ar=(t,e)=>{$t==null||$t();const{autoSync:n}=Fn(ce);if(!n)return;vn=e;const r=t>or;Tt||bn(),Tt=!r},lr=()=>(Ht||(Ht=new Promise(t=>{$t=()=>{Ht=void 0,t()}})),Tt||bn(),Tt),Wi=()=>Ht??Promise.resolve();var ur=function(){var t="",e,n,r,i=[],s={passive:!0},a={passive:!1};window.addEventListener?(e="addEventListener",n="removeEventListener"):(e="attachEvent",n="detachEvent",t="on"),r="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";function o(d,g){var m=function(v){!v&&(v=window.event);var y={originalEvent:v,target:v.target||v.srcElement,type:"wheel",deltaMode:v.type=="MozMousePixelScroll"?0:1,deltaX:0,delatZ:0,preventDefault:function(){v.preventDefault?v.preventDefault():v.returnValue=!1}};return r=="mousewheel"?(y.deltaY=-.025*v.wheelDelta,v.wheelDeltaX&&(y.deltaX=-.025*v.wheelDeltaX)):y.deltaY=v.detail,g(y)};return i.push({element:d,fn:m}),m}function l(d){for(var g=0;g<i.length;g++)if(i[g].element===d)return i[g].fn;return function(){}}function u(d){for(var g=0;g<i.length;g++)if(i[g].element===d)return i.splice(g,1)}function h(d,g,m,v){var y;r==="wheel"?y=m:y=o(d,m),d[e](t+g,y,v?s:a)}function c(d,g,m,v){var y;r==="wheel"?y=m:y=l(d),d[n](t+g,y,v?s:a),u(d)}function f(d,g,m){h(d,r,g,m),r=="DOMMouseScroll"&&h(d,"MozMousePixelScroll",g,m)}function p(d,g,m){c(d,r,g,m),r=="DOMMouseScroll"&&c(d,"MozMousePixelScroll",g,m)}return{on:f,off:p}}(),Me={extend:function(t,e){t=t||{};for(var n in e)this.isObject(e[n])?t[n]=this.extend(t[n],e[n]):t[n]=e[n];return t},isElement:function(t){return t instanceof HTMLElement||t instanceof SVGElement||t instanceof SVGSVGElement||t&&typeof t=="object"&&t!==null&&t.nodeType===1&&typeof t.nodeName=="string"},isObject:function(t){return Object.prototype.toString.call(t)==="[object Object]"},isNumber:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},getSvg:function(t){var e,n;if(this.isElement(t))e=t;else if(typeof t=="string"||t instanceof String){if(e=document.querySelector(t),!e)throw new Error("Provided selector did not find any elements. Selector: "+t)}else throw new Error("Provided selector is not an HTML object nor String");if(e.tagName.toLowerCase()==="svg")n=e;else if(e.tagName.toLowerCase()==="object")n=e.contentDocument.documentElement;else if(e.tagName.toLowerCase()==="embed")n=e.getSVGDocument().documentElement;else throw e.tagName.toLowerCase()==="img"?new Error('Cannot script an SVG in an "img" element. Please use an "object" element or an in-line SVG.'):new Error("Cannot get SVG.");return n},proxy:function(t,e){return function(){return t.apply(e,arguments)}},getType:function(t){return Object.prototype.toString.apply(t).replace(/^\[object\s/,"").replace(/\]$/,"")},mouseAndTouchNormalize:function(t,e){if(t.clientX===void 0||t.clientX===null)if(t.clientX=0,t.clientY=0,t.touches!==void 0&&t.touches.length){if(t.touches[0].clientX!==void 0)t.clientX=t.touches[0].clientX,t.clientY=t.touches[0].clientY;else if(t.touches[0].pageX!==void 0){var n=e.getBoundingClientRect();t.clientX=t.touches[0].pageX-n.left,t.clientY=t.touches[0].pageY-n.top}}else t.originalEvent!==void 0&&t.originalEvent.clientX!==void 0&&(t.clientX=t.originalEvent.clientX,t.clientY=t.originalEvent.clientY)},isDblClick:function(t,e){if(t.detail===2)return!0;if(e!=null){var n=t.timeStamp-e.timeStamp,r=Math.sqrt(Math.pow(t.clientX-e.clientX,2)+Math.pow(t.clientY-e.clientY,2));return n<250&&r<10}return!1},now:Date.now||function(){return new Date().getTime()},throttle:function(t,e,n){var r=this,i,s,a,o=null,l=0;n||(n={});var u=function(){l=n.leading===!1?0:r.now(),o=null,a=t.apply(i,s),o||(i=s=null)};return function(){var h=r.now();!l&&n.leading===!1&&(l=h);var c=e-(h-l);return i=this,s=arguments,c<=0||c>e?(clearTimeout(o),o=null,l=h,a=t.apply(i,s),o||(i=s=null)):!o&&n.trailing!==!1&&(o=setTimeout(u,c)),a}},createRequestAnimationFrame:function(t){var e=null;return t!=="auto"&&t<60&&t>1&&(e=Math.floor(1e3/t)),e===null?window.requestAnimationFrame||De(33):De(e)}};function De(t){return function(e){window.setTimeout(e,t)}}var ne=Me,yn="unknown";document.documentMode&&(yn="ie");var Se={svgNS:"http://www.w3.org/2000/svg",xmlNS:"http://www.w3.org/XML/1998/namespace",xmlnsNS:"http://www.w3.org/2000/xmlns/",xlinkNS:"http://www.w3.org/1999/xlink",evNS:"http://www.w3.org/2001/xml-events",getBoundingClientRectNormalized:function(t){if(t.clientWidth&&t.clientHeight)return{width:t.clientWidth,height:t.clientHeight};if(t.getBoundingClientRect())return t.getBoundingClientRect();throw new Error("Cannot get BoundingClientRect for SVG.")},getOrCreateViewport:function(t,e){var n=null;if(ne.isElement(e)?n=e:n=t.querySelector(e),!n){var r=Array.prototype.slice.call(t.childNodes||t.children).filter(function(l){return l.nodeName!=="defs"&&l.nodeName!=="#text"});r.length===1&&r[0].nodeName==="g"&&r[0].getAttribute("transform")===null&&(n=r[0])}if(!n){var i="viewport-"+new Date().toISOString().replace(/\D/g,"");n=document.createElementNS(this.svgNS,"g"),n.setAttribute("id",i);var s=t.childNodes||t.children;if(s&&s.length>0)for(var a=s.length;a>0;a--)s[s.length-a].nodeName!=="defs"&&n.appendChild(s[s.length-a]);t.appendChild(n)}var o=[];return n.getAttribute("class")&&(o=n.getAttribute("class").split(" ")),~o.indexOf("svg-pan-zoom_viewport")||(o.push("svg-pan-zoom_viewport"),n.setAttribute("class",o.join(" "))),n},setupSvgAttributes:function(t){if(t.setAttribute("xmlns",this.svgNS),t.setAttributeNS(this.xmlnsNS,"xmlns:xlink",this.xlinkNS),t.setAttributeNS(this.xmlnsNS,"xmlns:ev",this.evNS),t.parentNode!==null){var e=t.getAttribute("style")||"";e.toLowerCase().indexOf("overflow")===-1&&t.setAttribute("style","overflow: hidden; "+e)}},internetExplorerRedisplayInterval:300,refreshDefsGlobal:ne.throttle(function(){for(var t=document.querySelectorAll("defs"),e=t.length,n=0;n<e;n++){var r=t[n];r.parentNode.insertBefore(r,r)}},ze?ze.internetExplorerRedisplayInterval:null),setCTM:function(t,e,n){var r=this,i="matrix("+e.a+","+e.b+","+e.c+","+e.d+","+e.e+","+e.f+")";t.setAttributeNS(null,"transform",i),"transform"in t.style?t.style.transform=i:"-ms-transform"in t.style?t.style["-ms-transform"]=i:"-webkit-transform"in t.style&&(t.style["-webkit-transform"]=i),yn==="ie"&&n&&(n.parentNode.insertBefore(n,n),window.setTimeout(function(){r.refreshDefsGlobal()},r.internetExplorerRedisplayInterval))},getEventPoint:function(t,e){var n=e.createSVGPoint();return ne.mouseAndTouchNormalize(t,e),n.x=t.clientX,n.y=t.clientY,n},getSvgCenterPoint:function(t,e,n){return this.createSVGPoint(t,e/2,n/2)},createSVGPoint:function(t,e,n){var r=t.createSVGPoint();return r.x=e,r.y=n,r}},Y=Se,hr={enable:function(t){var e=t.svg.querySelector("defs");e||(e=document.createElementNS(Y.svgNS,"defs"),t.svg.appendChild(e));var n=e.querySelector("style#svg-pan-zoom-controls-styles");if(!n){var r=document.createElementNS(Y.svgNS,"style");r.setAttribute("id","svg-pan-zoom-controls-styles"),r.setAttribute("type","text/css"),r.textContent=".svg-pan-zoom-control { cursor: pointer; fill: black; fill-opacity: 0.333; } .svg-pan-zoom-control:hover { fill-opacity: 0.8; } .svg-pan-zoom-control-background { fill: white; fill-opacity: 0.5; } .svg-pan-zoom-control-background { fill-opacity: 0.8; }",e.appendChild(r)}var i=document.createElementNS(Y.svgNS,"g");i.setAttribute("id","svg-pan-zoom-controls"),i.setAttribute("transform","translate("+(t.width-70)+" "+(t.height-76)+") scale(0.75)"),i.setAttribute("class","svg-pan-zoom-control"),i.appendChild(this._createZoomIn(t)),i.appendChild(this._createZoomReset(t)),i.appendChild(this._createZoomOut(t)),t.svg.appendChild(i),t.controlIcons=i},_createZoomIn:function(t){var e=document.createElementNS(Y.svgNS,"g");e.setAttribute("id","svg-pan-zoom-zoom-in"),e.setAttribute("transform","translate(30.5 5) scale(0.015)"),e.setAttribute("class","svg-pan-zoom-control"),e.addEventListener("click",function(){t.getPublicInstance().zoomIn()},!1),e.addEventListener("touchstart",function(){t.getPublicInstance().zoomIn()},!1);var n=document.createElementNS(Y.svgNS,"rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width","1500"),n.setAttribute("height","1400"),n.setAttribute("class","svg-pan-zoom-control-background"),e.appendChild(n);var r=document.createElementNS(Y.svgNS,"path");return r.setAttribute("d","M1280 576v128q0 26 -19 45t-45 19h-320v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-320q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h320v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h320q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z"),r.setAttribute("class","svg-pan-zoom-control-element"),e.appendChild(r),e},_createZoomReset:function(t){var e=document.createElementNS(Y.svgNS,"g");e.setAttribute("id","svg-pan-zoom-reset-pan-zoom"),e.setAttribute("transform","translate(5 35) scale(0.4)"),e.setAttribute("class","svg-pan-zoom-control"),e.addEventListener("click",function(){t.getPublicInstance().reset()},!1),e.addEventListener("touchstart",function(){t.getPublicInstance().reset()},!1);var n=document.createElementNS(Y.svgNS,"rect");n.setAttribute("x","2"),n.setAttribute("y","2"),n.setAttribute("width","182"),n.setAttribute("height","58"),n.setAttribute("class","svg-pan-zoom-control-background"),e.appendChild(n);var r=document.createElementNS(Y.svgNS,"path");r.setAttribute("d","M33.051,20.632c-0.742-0.406-1.854-0.609-3.338-0.609h-7.969v9.281h7.769c1.543,0,2.701-0.188,3.473-0.562c1.365-0.656,2.048-1.953,2.048-3.891C35.032,22.757,34.372,21.351,33.051,20.632z"),r.setAttribute("class","svg-pan-zoom-control-element"),e.appendChild(r);var i=document.createElementNS(Y.svgNS,"path");return i.setAttribute("d","M170.231,0.5H15.847C7.102,0.5,0.5,5.708,0.5,11.84v38.861C0.5,56.833,7.102,61.5,15.847,61.5h154.384c8.745,0,15.269-4.667,15.269-10.798V11.84C185.5,5.708,178.976,0.5,170.231,0.5z M42.837,48.569h-7.969c-0.219-0.766-0.375-1.383-0.469-1.852c-0.188-0.969-0.289-1.961-0.305-2.977l-0.047-3.211c-0.03-2.203-0.41-3.672-1.142-4.406c-0.732-0.734-2.103-1.102-4.113-1.102h-7.05v13.547h-7.055V14.022h16.524c2.361,0.047,4.178,0.344,5.45,0.891c1.272,0.547,2.351,1.352,3.234,2.414c0.731,0.875,1.31,1.844,1.737,2.906s0.64,2.273,0.64,3.633c0,1.641-0.414,3.254-1.242,4.84s-2.195,2.707-4.102,3.363c1.594,0.641,2.723,1.551,3.387,2.73s0.996,2.98,0.996,5.402v2.32c0,1.578,0.063,2.648,0.19,3.211c0.19,0.891,0.635,1.547,1.333,1.969V48.569z M75.579,48.569h-26.18V14.022h25.336v6.117H56.454v7.336h16.781v6H56.454v8.883h19.125V48.569z M104.497,46.331c-2.44,2.086-5.887,3.129-10.34,3.129c-4.548,0-8.125-1.027-10.731-3.082s-3.909-4.879-3.909-8.473h6.891c0.224,1.578,0.662,2.758,1.316,3.539c1.196,1.422,3.246,2.133,6.15,2.133c1.739,0,3.151-0.188,4.236-0.562c2.058-0.719,3.087-2.055,3.087-4.008c0-1.141-0.504-2.023-1.512-2.648c-1.008-0.609-2.607-1.148-4.796-1.617l-3.74-0.82c-3.676-0.812-6.201-1.695-7.576-2.648c-2.328-1.594-3.492-4.086-3.492-7.477c0-3.094,1.139-5.664,3.417-7.711s5.623-3.07,10.036-3.07c3.685,0,6.829,0.965,9.431,2.895c2.602,1.93,3.966,4.73,4.093,8.402h-6.938c-0.128-2.078-1.057-3.555-2.787-4.43c-1.154-0.578-2.587-0.867-4.301-0.867c-1.907,0-3.428,0.375-4.565,1.125c-1.138,0.75-1.706,1.797-1.706,3.141c0,1.234,0.561,2.156,1.682,2.766c0.721,0.406,2.25,0.883,4.589,1.43l6.063,1.43c2.657,0.625,4.648,1.461,5.975,2.508c2.059,1.625,3.089,3.977,3.089,7.055C108.157,41.624,106.937,44.245,104.497,46.331z M139.61,48.569h-26.18V14.022h25.336v6.117h-18.281v7.336h16.781v6h-16.781v8.883h19.125V48.569z M170.337,20.14h-10.336v28.43h-7.266V20.14h-10.383v-6.117h27.984V20.14z"),i.setAttribute("class","svg-pan-zoom-control-element"),e.appendChild(i),e},_createZoomOut:function(t){var e=document.createElementNS(Y.svgNS,"g");e.setAttribute("id","svg-pan-zoom-zoom-out"),e.setAttribute("transform","translate(30.5 70) scale(0.015)"),e.setAttribute("class","svg-pan-zoom-control"),e.addEventListener("click",function(){t.getPublicInstance().zoomOut()},!1),e.addEventListener("touchstart",function(){t.getPublicInstance().zoomOut()},!1);var n=document.createElementNS(Y.svgNS,"rect");n.setAttribute("x","0"),n.setAttribute("y","0"),n.setAttribute("width","1500"),n.setAttribute("height","1400"),n.setAttribute("class","svg-pan-zoom-control-background"),e.appendChild(n);var r=document.createElementNS(Y.svgNS,"path");return r.setAttribute("d","M1280 576v128q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h896q26 0 45 19t19 45zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z"),r.setAttribute("class","svg-pan-zoom-control-element"),e.appendChild(r),e},disable:function(t){t.controlIcons&&(t.controlIcons.parentNode.removeChild(t.controlIcons),t.controlIcons=null)}},cr=Se,vt=Me,B=function(t,e){this.init(t,e)};B.prototype.init=function(t,e){this.viewport=t,this.options=e,this.originalState={zoom:1,x:0,y:0},this.activeState={zoom:1,x:0,y:0},this.updateCTMCached=vt.proxy(this.updateCTM,this),this.requestAnimationFrame=vt.createRequestAnimationFrame(this.options.refreshRate),this.viewBox={x:0,y:0,width:0,height:0},this.cacheViewBox();var n=this.processCTM();this.setCTM(n),this.updateCTM()};B.prototype.cacheViewBox=function(){var t=this.options.svg.getAttribute("viewBox");if(t){var e=t.split(/[\s\,]/).filter(function(r){return r}).map(parseFloat);this.viewBox.x=e[0],this.viewBox.y=e[1],this.viewBox.width=e[2],this.viewBox.height=e[3];var n=Math.min(this.options.width/this.viewBox.width,this.options.height/this.viewBox.height);this.activeState.zoom=n,this.activeState.x=(this.options.width-this.viewBox.width*n)/2,this.activeState.y=(this.options.height-this.viewBox.height*n)/2,this.updateCTMOnNextFrame(),this.options.svg.removeAttribute("viewBox")}else this.simpleViewBoxCache()};B.prototype.simpleViewBoxCache=function(){var t=this.viewport.getBBox();this.viewBox.x=t.x,this.viewBox.y=t.y,this.viewBox.width=t.width,this.viewBox.height=t.height};B.prototype.getViewBox=function(){return vt.extend({},this.viewBox)};B.prototype.processCTM=function(){var t=this.getCTM();if(this.options.fit||this.options.contain){var e;this.options.fit?e=Math.min(this.options.width/this.viewBox.width,this.options.height/this.viewBox.height):e=Math.max(this.options.width/this.viewBox.width,this.options.height/this.viewBox.height),t.a=e,t.d=e,t.e=-this.viewBox.x*e,t.f=-this.viewBox.y*e}if(this.options.center){var n=(this.options.width-(this.viewBox.width+this.viewBox.x*2)*t.a)*.5,r=(this.options.height-(this.viewBox.height+this.viewBox.y*2)*t.a)*.5;t.e=n,t.f=r}return this.originalState.zoom=t.a,this.originalState.x=t.e,this.originalState.y=t.f,t};B.prototype.getOriginalState=function(){return vt.extend({},this.originalState)};B.prototype.getState=function(){return vt.extend({},this.activeState)};B.prototype.getZoom=function(){return this.activeState.zoom};B.prototype.getRelativeZoom=function(){return this.activeState.zoom/this.originalState.zoom};B.prototype.computeRelativeZoom=function(t){return t/this.originalState.zoom};B.prototype.getPan=function(){return{x:this.activeState.x,y:this.activeState.y}};B.prototype.getCTM=function(){var t=this.options.svg.createSVGMatrix();return t.a=this.activeState.zoom,t.b=0,t.c=0,t.d=this.activeState.zoom,t.e=this.activeState.x,t.f=this.activeState.y,t};B.prototype.setCTM=function(t){var e=this.isZoomDifferent(t),n=this.isPanDifferent(t);if(e||n){if(e&&(this.options.beforeZoom(this.getRelativeZoom(),this.computeRelativeZoom(t.a))===!1?(t.a=t.d=this.activeState.zoom,e=!1):(this.updateCache(t),this.options.onZoom(this.getRelativeZoom()))),n){var r=this.options.beforePan(this.getPan(),{x:t.e,y:t.f}),i=!1,s=!1;r===!1?(t.e=this.getPan().x,t.f=this.getPan().y,i=s=!0):vt.isObject(r)&&(r.x===!1?(t.e=this.getPan().x,i=!0):vt.isNumber(r.x)&&(t.e=r.x),r.y===!1?(t.f=this.getPan().y,s=!0):vt.isNumber(r.y)&&(t.f=r.y)),i&&s||!this.isPanDifferent(t)?n=!1:(this.updateCache(t),this.options.onPan(this.getPan()))}(e||n)&&this.updateCTMOnNextFrame()}};B.prototype.isZoomDifferent=function(t){return this.activeState.zoom!==t.a};B.prototype.isPanDifferent=function(t){return this.activeState.x!==t.e||this.activeState.y!==t.f};B.prototype.updateCache=function(t){this.activeState.zoom=t.a,this.activeState.x=t.e,this.activeState.y=t.f};B.prototype.pendingUpdate=!1;B.prototype.updateCTMOnNextFrame=function(){this.pendingUpdate||(this.pendingUpdate=!0,this.requestAnimationFrame.call(window,this.updateCTMCached))};B.prototype.updateCTM=function(){var t=this.getCTM();cr.setCTM(this.viewport,t,this.defs),this.pendingUpdate=!1,this.options.onUpdatedCTM&&this.options.onUpdatedCTM(t)};var fr=function(t,e){return new B(t,e)},xn=ur,fe=hr,it=Me,at=Se,pr=fr,P=function(t,e){this.init(t,e)},dr={viewportSelector:".svg-pan-zoom_viewport",panEnabled:!0,controlIconsEnabled:!1,zoomEnabled:!0,dblClickZoomEnabled:!0,mouseWheelZoomEnabled:!0,preventMouseEventsDefault:!0,zoomScaleSensitivity:.1,minZoom:.5,maxZoom:10,fit:!0,contain:!1,center:!0,refreshRate:"auto",beforeZoom:null,onZoom:null,beforePan:null,onPan:null,customEventsHandler:null,eventsListenerElement:null,onUpdatedCTM:null},wn={passive:!0};P.prototype.init=function(t,e){var n=this;this.svg=t,this.defs=t.querySelector("defs"),at.setupSvgAttributes(this.svg),this.options=it.extend(it.extend({},dr),e),this.state="none";var r=at.getBoundingClientRectNormalized(t);this.width=r.width,this.height=r.height,this.viewport=pr(at.getOrCreateViewport(this.svg,this.options.viewportSelector),{svg:this.svg,width:this.width,height:this.height,fit:this.options.fit,contain:this.options.contain,center:this.options.center,refreshRate:this.options.refreshRate,beforeZoom:function(s,a){if(n.viewport&&n.options.beforeZoom)return n.options.beforeZoom(s,a)},onZoom:function(s){if(n.viewport&&n.options.onZoom)return n.options.onZoom(s)},beforePan:function(s,a){if(n.viewport&&n.options.beforePan)return n.options.beforePan(s,a)},onPan:function(s){if(n.viewport&&n.options.onPan)return n.options.onPan(s)},onUpdatedCTM:function(s){if(n.viewport&&n.options.onUpdatedCTM)return n.options.onUpdatedCTM(s)}});var i=this.getPublicInstance();i.setBeforeZoom(this.options.beforeZoom),i.setOnZoom(this.options.onZoom),i.setBeforePan(this.options.beforePan),i.setOnPan(this.options.onPan),i.setOnUpdatedCTM(this.options.onUpdatedCTM),this.options.controlIconsEnabled&&fe.enable(this),this.lastMouseWheelEventTime=Date.now(),this.setupHandlers()};P.prototype.setupHandlers=function(){var t=this,e=null;if(this.eventListeners={mousedown:function(s){var a=t.handleMouseDown(s,e);return e=s,a},touchstart:function(s){var a=t.handleMouseDown(s,e);return e=s,a},mouseup:function(s){return t.handleMouseUp(s)},touchend:function(s){return t.handleMouseUp(s)},mousemove:function(s){return t.handleMouseMove(s)},touchmove:function(s){return t.handleMouseMove(s)},mouseleave:function(s){return t.handleMouseUp(s)},touchleave:function(s){return t.handleMouseUp(s)},touchcancel:function(s){return t.handleMouseUp(s)}},this.options.customEventsHandler!=null){this.options.customEventsHandler.init({svgElement:this.svg,eventsListenerElement:this.options.eventsListenerElement,instance:this.getPublicInstance()});var n=this.options.customEventsHandler.haltEventListeners;if(n&&n.length)for(var r=n.length-1;r>=0;r--)this.eventListeners.hasOwnProperty(n[r])&&delete this.eventListeners[n[r]]}for(var i in this.eventListeners)(this.options.eventsListenerElement||this.svg).addEventListener(i,this.eventListeners[i],this.options.preventMouseEventsDefault?!1:wn);this.options.mouseWheelZoomEnabled&&(this.options.mouseWheelZoomEnabled=!1,this.enableMouseWheelZoom())};P.prototype.enableMouseWheelZoom=function(){if(!this.options.mouseWheelZoomEnabled){var t=this;this.wheelListener=function(n){return t.handleMouseWheel(n)};var e=!this.options.preventMouseEventsDefault;xn.on(this.options.eventsListenerElement||this.svg,this.wheelListener,e),this.options.mouseWheelZoomEnabled=!0}};P.prototype.disableMouseWheelZoom=function(){if(this.options.mouseWheelZoomEnabled){var t=!this.options.preventMouseEventsDefault;xn.off(this.options.eventsListenerElement||this.svg,this.wheelListener,t),this.options.mouseWheelZoomEnabled=!1}};P.prototype.handleMouseWheel=function(t){if(!(!this.options.zoomEnabled||this.state!=="none")){this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1);var e=t.deltaY||1,n=Date.now()-this.lastMouseWheelEventTime,r=3+Math.max(0,30-n);this.lastMouseWheelEventTime=Date.now(),"deltaMode"in t&&t.deltaMode===0&&t.wheelDelta&&(e=t.deltaY===0?0:Math.abs(t.wheelDelta)/t.deltaY),e=-.3<e&&e<.3?e:(e>0?1:-1)*Math.log(Math.abs(e)+10)/r;var i=this.svg.getScreenCTM().inverse(),s=at.getEventPoint(t,this.svg).matrixTransform(i),a=Math.pow(1+this.options.zoomScaleSensitivity,-1*e);this.zoomAtPoint(a,s)}};P.prototype.zoomAtPoint=function(t,e,n){var r=this.viewport.getOriginalState();n?(t=Math.max(this.options.minZoom*r.zoom,Math.min(this.options.maxZoom*r.zoom,t)),t=t/this.getZoom()):this.getZoom()*t<this.options.minZoom*r.zoom?t=this.options.minZoom*r.zoom/this.getZoom():this.getZoom()*t>this.options.maxZoom*r.zoom&&(t=this.options.maxZoom*r.zoom/this.getZoom());var i=this.viewport.getCTM(),s=e.matrixTransform(i.inverse()),a=this.svg.createSVGMatrix().translate(s.x,s.y).scale(t).translate(-s.x,-s.y),o=i.multiply(a);o.a!==i.a&&this.viewport.setCTM(o)};P.prototype.zoom=function(t,e){this.zoomAtPoint(t,at.getSvgCenterPoint(this.svg,this.width,this.height),e)};P.prototype.publicZoom=function(t,e){e&&(t=this.computeFromRelativeZoom(t)),this.zoom(t,e)};P.prototype.publicZoomAtPoint=function(t,e,n){if(n&&(t=this.computeFromRelativeZoom(t)),it.getType(e)!=="SVGPoint")if("x"in e&&"y"in e)e=at.createSVGPoint(this.svg,e.x,e.y);else throw new Error("Given point is invalid");this.zoomAtPoint(t,e,n)};P.prototype.getZoom=function(){return this.viewport.getZoom()};P.prototype.getRelativeZoom=function(){return this.viewport.getRelativeZoom()};P.prototype.computeFromRelativeZoom=function(t){return t*this.viewport.getOriginalState().zoom};P.prototype.resetZoom=function(){var t=this.viewport.getOriginalState();this.zoom(t.zoom,!0)};P.prototype.resetPan=function(){this.pan(this.viewport.getOriginalState())};P.prototype.reset=function(){this.resetZoom(),this.resetPan()};P.prototype.handleDblClick=function(t){if(this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),this.options.controlIconsEnabled){var e=t.target.getAttribute("class")||"";if(e.indexOf("svg-pan-zoom-control")>-1)return!1}var n;t.shiftKey?n=1/((1+this.options.zoomScaleSensitivity)*2):n=(1+this.options.zoomScaleSensitivity)*2;var r=at.getEventPoint(t,this.svg).matrixTransform(this.svg.getScreenCTM().inverse());this.zoomAtPoint(n,r)};P.prototype.handleMouseDown=function(t,e){this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),it.mouseAndTouchNormalize(t,this.svg),this.options.dblClickZoomEnabled&&it.isDblClick(t,e)?this.handleDblClick(t):(this.state="pan",this.firstEventCTM=this.viewport.getCTM(),this.stateOrigin=at.getEventPoint(t,this.svg).matrixTransform(this.firstEventCTM.inverse()))};P.prototype.handleMouseMove=function(t){if(this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),this.state==="pan"&&this.options.panEnabled){var e=at.getEventPoint(t,this.svg).matrixTransform(this.firstEventCTM.inverse()),n=this.firstEventCTM.translate(e.x-this.stateOrigin.x,e.y-this.stateOrigin.y);this.viewport.setCTM(n)}};P.prototype.handleMouseUp=function(t){this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),this.state==="pan"&&(this.state="none")};P.prototype.fit=function(){var t=this.viewport.getViewBox(),e=Math.min(this.width/t.width,this.height/t.height);this.zoom(e,!0)};P.prototype.contain=function(){var t=this.viewport.getViewBox(),e=Math.max(this.width/t.width,this.height/t.height);this.zoom(e,!0)};P.prototype.center=function(){var t=this.viewport.getViewBox(),e=(this.width-(t.width+t.x*2)*this.getZoom())*.5,n=(this.height-(t.height+t.y*2)*this.getZoom())*.5;this.getPublicInstance().pan({x:e,y:n})};P.prototype.updateBBox=function(){this.viewport.simpleViewBoxCache()};P.prototype.pan=function(t){var e=this.viewport.getCTM();e.e=t.x,e.f=t.y,this.viewport.setCTM(e)};P.prototype.panBy=function(t){var e=this.viewport.getCTM();e.e+=t.x,e.f+=t.y,this.viewport.setCTM(e)};P.prototype.getPan=function(){var t=this.viewport.getState();return{x:t.x,y:t.y}};P.prototype.resize=function(){var t=at.getBoundingClientRectNormalized(this.svg);this.width=t.width,this.height=t.height;var e=this.viewport;e.options.width=this.width,e.options.height=this.height,e.processCTM(),this.options.controlIconsEnabled&&(this.getPublicInstance().disableControlIcons(),this.getPublicInstance().enableControlIcons())};P.prototype.destroy=function(){var t=this;this.beforeZoom=null,this.onZoom=null,this.beforePan=null,this.onPan=null,this.onUpdatedCTM=null,this.options.customEventsHandler!=null&&this.options.customEventsHandler.destroy({svgElement:this.svg,eventsListenerElement:this.options.eventsListenerElement,instance:this.getPublicInstance()});for(var e in this.eventListeners)(this.options.eventsListenerElement||this.svg).removeEventListener(e,this.eventListeners[e],this.options.preventMouseEventsDefault?!1:wn);this.disableMouseWheelZoom(),this.getPublicInstance().disableControlIcons(),this.reset(),ft=ft.filter(function(n){return n.svg!==t.svg}),delete this.options,delete this.viewport,delete this.publicInstance,delete this.pi,this.getPublicInstance=function(){return null}};P.prototype.getPublicInstance=function(){var t=this;return this.publicInstance||(this.publicInstance=this.pi={enablePan:function(){return t.options.panEnabled=!0,t.pi},disablePan:function(){return t.options.panEnabled=!1,t.pi},isPanEnabled:function(){return!!t.options.panEnabled},pan:function(e){return t.pan(e),t.pi},panBy:function(e){return t.panBy(e),t.pi},getPan:function(){return t.getPan()},setBeforePan:function(e){return t.options.beforePan=e===null?null:it.proxy(e,t.publicInstance),t.pi},setOnPan:function(e){return t.options.onPan=e===null?null:it.proxy(e,t.publicInstance),t.pi},enableZoom:function(){return t.options.zoomEnabled=!0,t.pi},disableZoom:function(){return t.options.zoomEnabled=!1,t.pi},isZoomEnabled:function(){return!!t.options.zoomEnabled},enableControlIcons:function(){return t.options.controlIconsEnabled||(t.options.controlIconsEnabled=!0,fe.enable(t)),t.pi},disableControlIcons:function(){return t.options.controlIconsEnabled&&(t.options.controlIconsEnabled=!1,fe.disable(t)),t.pi},isControlIconsEnabled:function(){return!!t.options.controlIconsEnabled},enableDblClickZoom:function(){return t.options.dblClickZoomEnabled=!0,t.pi},disableDblClickZoom:function(){return t.options.dblClickZoomEnabled=!1,t.pi},isDblClickZoomEnabled:function(){return!!t.options.dblClickZoomEnabled},enableMouseWheelZoom:function(){return t.enableMouseWheelZoom(),t.pi},disableMouseWheelZoom:function(){return t.disableMouseWheelZoom(),t.pi},isMouseWheelZoomEnabled:function(){return!!t.options.mouseWheelZoomEnabled},setZoomScaleSensitivity:function(e){return t.options.zoomScaleSensitivity=e,t.pi},setMinZoom:function(e){return t.options.minZoom=e,t.pi},setMaxZoom:function(e){return t.options.maxZoom=e,t.pi},setBeforeZoom:function(e){return t.options.beforeZoom=e===null?null:it.proxy(e,t.publicInstance),t.pi},setOnZoom:function(e){return t.options.onZoom=e===null?null:it.proxy(e,t.publicInstance),t.pi},zoom:function(e){return t.publicZoom(e,!0),t.pi},zoomBy:function(e){return t.publicZoom(e,!1),t.pi},zoomAtPoint:function(e,n){return t.publicZoomAtPoint(e,n,!0),t.pi},zoomAtPointBy:function(e,n){return t.publicZoomAtPoint(e,n,!1),t.pi},zoomIn:function(){return this.zoomBy(1+t.options.zoomScaleSensitivity),t.pi},zoomOut:function(){return this.zoomBy(1/(1+t.options.zoomScaleSensitivity)),t.pi},getZoom:function(){return t.getRelativeZoom()},setOnUpdatedCTM:function(e){return t.options.onUpdatedCTM=e===null?null:it.proxy(e,t.publicInstance),t.pi},resetZoom:function(){return t.resetZoom(),t.pi},resetPan:function(){return t.resetPan(),t.pi},reset:function(){return t.reset(),t.pi},fit:function(){return t.fit(),t.pi},contain:function(){return t.contain(),t.pi},center:function(){return t.center(),t.pi},updateBBox:function(){return t.updateBBox(),t.pi},resize:function(){return t.resize(),t.pi},getSizes:function(){return{width:t.width,height:t.height,realZoom:t.getZoom(),viewBox:t.viewport.getViewBox()}},destroy:function(){return t.destroy(),t.pi}}),this.publicInstance};var ft=[],gr=function(t,e){var n=it.getSvg(t);if(n===null)return null;for(var r=ft.length-1;r>=0;r--)if(ft[r].svg===n)return ft[r].instance.getPublicInstance();return ft.push({svg:n,instance:new P(n,e)}),ft[ft.length-1].instance.getPublicInstance()},mr=gr;const vr=Xn(mr);function pe(t,e,n){if(t&&t.length){const[r,i]=e,s=Math.PI/180*n,a=Math.cos(s),o=Math.sin(s);for(const l of t){const[u,h]=l;l[0]=(u-r)*a-(h-i)*o+r,l[1]=(u-r)*o+(h-i)*a+i}}}function br(t,e,n){const r=[];t.forEach(i=>r.push(...i)),pe(r,e,n)}function yr(t,e){return t[0]===e[0]&&t[1]===e[1]}function xr(t,e,n,r=1){const i=n,s=Math.max(e,.1),a=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,o=[0,0];if(i)for(const u of a)pe(u,o,i);const l=wr(a,s,r);if(i){for(const u of a)pe(u,o,-i);br(l,o,-i)}return l}function wr(t,e,n){const r=[];for(const u of t){const h=[...u];yr(h[0],h[h.length-1])||h.push([h[0][0],h[0][1]]),h.length>2&&r.push(h)}const i=[];e=Math.max(e,.1);const s=[];for(const u of r)for(let h=0;h<u.length-1;h++){const c=u[h],f=u[h+1];if(c[1]!==f[1]){const p=Math.min(c[1],f[1]);s.push({ymin:p,ymax:Math.max(c[1],f[1]),x:p===c[1]?c[0]:f[0],islope:(f[0]-c[0])/(f[1]-c[1])})}}if(s.sort((u,h)=>u.ymin<h.ymin?-1:u.ymin>h.ymin?1:u.x<h.x?-1:u.x>h.x?1:u.ymax===h.ymax?0:(u.ymax-h.ymax)/Math.abs(u.ymax-h.ymax)),!s.length)return i;let a=[],o=s[0].ymin,l=0;for(;a.length||s.length;){if(s.length){let u=-1;for(let c=0;c<s.length&&!(s[c].ymin>o);c++)u=c;s.splice(0,u+1).forEach(c=>{a.push({s:o,edge:c})})}if(a=a.filter(u=>!(u.edge.ymax<=o)),a.sort((u,h)=>u.edge.x===h.edge.x?0:(u.edge.x-h.edge.x)/Math.abs(u.edge.x-h.edge.x)),(n!==1||l%e===0)&&a.length>1)for(let u=0;u<a.length;u=u+2){const h=u+1;if(h>=a.length)break;const c=a[u].edge,f=a[h].edge;i.push([[Math.round(c.x),o],[Math.round(f.x),o]])}o+=n,a.forEach(u=>{u.edge.x=u.edge.x+n*u.edge.islope}),l++}return i}function Nt(t,e){var n;const r=e.hachureAngle+90;let i=e.hachureGap;i<0&&(i=e.strokeWidth*4),i=Math.round(Math.max(i,.1));let s=1;return e.roughness>=1&&(((n=e.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(s=i),xr(t,i,r,s||1)}class Ae{constructor(e){this.helper=e}fillPolygons(e,n){return this._fillPolygons(e,n)}_fillPolygons(e,n){const r=Nt(e,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(e,n){const r=[];for(const i of e)r.push(...this.helper.doubleLineOps(i[0][0],i[0][1],i[1][0],i[1][1],n));return r}}function Qt(t){const e=t[0],n=t[1];return Math.sqrt(Math.pow(e[0]-n[0],2)+Math.pow(e[1]-n[1],2))}class Mr extends Ae{fillPolygons(e,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);const i=Object.assign({},n,{hachureGap:r}),s=Nt(e,i),a=Math.PI/180*n.hachureAngle,o=[],l=r*.5*Math.cos(a),u=r*.5*Math.sin(a);for(const[c,f]of s)Qt([c,f])&&o.push([[c[0]-l,c[1]+u],[...f]],[[c[0]+l,c[1]-u],[...f]]);return{type:"fillSketch",ops:this.renderLines(o,n)}}}class Sr extends Ae{fillPolygons(e,n){const r=this._fillPolygons(e,n),i=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),s=this._fillPolygons(e,i);return r.ops=r.ops.concat(s.ops),r}}class Ar{constructor(e){this.helper=e}fillPolygons(e,n){n=Object.assign({},n,{hachureAngle:0});const r=Nt(e,n);return this.dotsOnLines(r,n)}dotsOnLines(e,n){const r=[];let i=n.hachureGap;i<0&&(i=n.strokeWidth*4),i=Math.max(i,.1);let s=n.fillWeight;s<0&&(s=n.strokeWidth/2);const a=i/4;for(const o of e){const l=Qt(o),u=l/i,h=Math.ceil(u)-1,c=l-h*i,f=(o[0][0]+o[1][0])/2-i/4,p=Math.min(o[0][1],o[1][1]);for(let d=0;d<h;d++){const g=p+c+d*i,m=f-a+Math.random()*2*a,v=g-a+Math.random()*2*a,y=this.helper.ellipse(m,v,s,s,n);r.push(...y.ops)}}return{type:"fillSketch",ops:r}}}class Er{constructor(e){this.helper=e}fillPolygons(e,n){const r=Nt(e,n);return{type:"fillSketch",ops:this.dashedLine(r,n)}}dashedLine(e,n){const r=n.dashOffset<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashOffset,i=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,s=[];return e.forEach(a=>{const o=Qt(a),l=Math.floor(o/(r+i)),u=(o+i-l*(r+i))/2;let h=a[0],c=a[1];h[0]>c[0]&&(h=a[1],c=a[0]);const f=Math.atan((c[1]-h[1])/(c[0]-h[0]));for(let p=0;p<l;p++){const d=p*(r+i),g=d+r,m=[h[0]+d*Math.cos(f)+u*Math.cos(f),h[1]+d*Math.sin(f)+u*Math.sin(f)],v=[h[0]+g*Math.cos(f)+u*Math.cos(f),h[1]+g*Math.sin(f)+u*Math.sin(f)];s.push(...this.helper.doubleLineOps(m[0],m[1],v[0],v[1],n))}}),s}}class Cr{constructor(e){this.helper=e}fillPolygons(e,n){const r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,i=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+i});const s=Nt(e,n);return{type:"fillSketch",ops:this.zigzagLines(s,i,n)}}zigzagLines(e,n,r){const i=[];return e.forEach(s=>{const a=Qt(s),o=Math.round(a/(2*n));let l=s[0],u=s[1];l[0]>u[0]&&(l=s[1],u=s[0]);const h=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let c=0;c<o;c++){const f=c*2*n,p=(c+1)*2*n,d=Math.sqrt(2*Math.pow(n,2)),g=[l[0]+f*Math.cos(h),l[1]+f*Math.sin(h)],m=[l[0]+p*Math.cos(h),l[1]+p*Math.sin(h)],v=[g[0]+d*Math.cos(h+Math.PI/4),g[1]+d*Math.sin(h+Math.PI/4)];i.push(...this.helper.doubleLineOps(g[0],g[1],v[0],v[1],r),...this.helper.doubleLineOps(v[0],v[1],m[0],m[1],r))}}),i}}const X={};function _r(t,e){let n=t.fillStyle||"hachure";if(!X[n])switch(n){case"zigzag":X[n]||(X[n]=new Mr(e));break;case"cross-hatch":X[n]||(X[n]=new Sr(e));break;case"dots":X[n]||(X[n]=new Ar(e));break;case"dashed":X[n]||(X[n]=new Er(e));break;case"zigzag-line":X[n]||(X[n]=new Cr(e));break;case"hachure":default:n="hachure",X[n]||(X[n]=new Ae(e));break}return X[n]}function Tr(){return Math.floor(Math.random()*2**31)}class Mn{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const Or=0,de=1,Sn=2,zt={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function kr(t){const e=new Array;for(;t!=="";)if(t.match(/^([ \t\r\n,]+)/))t=t.substr(RegExp.$1.length);else if(t.match(/^([aAcChHlLmMqQsStTvVzZ])/))e[e.length]={type:Or,text:RegExp.$1},t=t.substr(RegExp.$1.length);else if(t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))e[e.length]={type:de,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length);else return[];return e[e.length]={type:Sn,text:""},e}function re(t,e){return t.type===e}function Ee(t){const e=[],n=kr(t);let r="BOD",i=0,s=n[i];for(;!re(s,Sn);){let a=0;const o=[];if(r==="BOD")if(s.text==="M"||s.text==="m")i++,a=zt[s.text],r=s.text;else return Ee("M0,0"+t);else re(s,de)?a=zt[r]:(i++,a=zt[s.text],r=s.text);if(i+a<n.length){for(let l=i;l<i+a;l++){const u=n[l];if(re(u,de))o[o.length]=+u.text;else throw new Error("Param not a number: "+r+","+u.text)}if(typeof zt[r]=="number"){const l={key:r,data:o};e.push(l),i+=a,s=n[i],r==="M"&&(r="L"),r==="m"&&(r="l")}else throw new Error("Bad segment: "+r)}else throw new Error("Path data ended short")}return e}function An(t){let e=0,n=0,r=0,i=0;const s=[];for(const{key:a,data:o}of t)switch(a){case"M":s.push({key:"M",data:[...o]}),[e,n]=o,[r,i]=o;break;case"m":e+=o[0],n+=o[1],s.push({key:"M",data:[e,n]}),r=e,i=n;break;case"L":s.push({key:"L",data:[...o]}),[e,n]=o;break;case"l":e+=o[0],n+=o[1],s.push({key:"L",data:[e,n]});break;case"C":s.push({key:"C",data:[...o]}),e=o[4],n=o[5];break;case"c":{const l=o.map((u,h)=>h%2?u+n:u+e);s.push({key:"C",data:l}),e=l[4],n=l[5];break}case"Q":s.push({key:"Q",data:[...o]}),e=o[2],n=o[3];break;case"q":{const l=o.map((u,h)=>h%2?u+n:u+e);s.push({key:"Q",data:l}),e=l[2],n=l[3];break}case"A":s.push({key:"A",data:[...o]}),e=o[5],n=o[6];break;case"a":e+=o[5],n+=o[6],s.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,n]});break;case"H":s.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],s.push({key:"H",data:[e]});break;case"V":s.push({key:"V",data:[...o]}),n=o[0];break;case"v":n+=o[0],s.push({key:"V",data:[n]});break;case"S":s.push({key:"S",data:[...o]}),e=o[2],n=o[3];break;case"s":{const l=o.map((u,h)=>h%2?u+n:u+e);s.push({key:"S",data:l}),e=l[2],n=l[3];break}case"T":s.push({key:"T",data:[...o]}),e=o[0],n=o[1];break;case"t":e+=o[0],n+=o[1],s.push({key:"T",data:[e,n]});break;case"Z":case"z":s.push({key:"Z",data:[]}),e=r,n=i;break}return s}function En(t){const e=[];let n="",r=0,i=0,s=0,a=0,o=0,l=0;for(const{key:u,data:h}of t){switch(u){case"M":e.push({key:"M",data:[...h]}),[r,i]=h,[s,a]=h;break;case"C":e.push({key:"C",data:[...h]}),r=h[4],i=h[5],o=h[2],l=h[3];break;case"L":e.push({key:"L",data:[...h]}),[r,i]=h;break;case"H":r=h[0],e.push({key:"L",data:[r,i]});break;case"V":i=h[0],e.push({key:"L",data:[r,i]});break;case"S":{let c=0,f=0;n==="C"||n==="S"?(c=r+(r-o),f=i+(i-l)):(c=r,f=i),e.push({key:"C",data:[c,f,...h]}),o=h[0],l=h[1],r=h[2],i=h[3];break}case"T":{const[c,f]=h;let p=0,d=0;n==="Q"||n==="T"?(p=r+(r-o),d=i+(i-l)):(p=r,d=i);const g=r+2*(p-r)/3,m=i+2*(d-i)/3,v=c+2*(p-c)/3,y=f+2*(d-f)/3;e.push({key:"C",data:[g,m,v,y,c,f]}),o=p,l=d,r=c,i=f;break}case"Q":{const[c,f,p,d]=h,g=r+2*(c-r)/3,m=i+2*(f-i)/3,v=p+2*(c-p)/3,y=d+2*(f-d)/3;e.push({key:"C",data:[g,m,v,y,p,d]}),o=c,l=f,r=p,i=d;break}case"A":{const c=Math.abs(h[0]),f=Math.abs(h[1]),p=h[2],d=h[3],g=h[4],m=h[5],v=h[6];c===0||f===0?(e.push({key:"C",data:[r,i,m,v,m,v]}),r=m,i=v):(r!==m||i!==v)&&(Cn(r,i,m,v,c,f,p,d,g).forEach(function(E){e.push({key:"C",data:E})}),r=m,i=v);break}case"Z":e.push({key:"Z",data:[]}),r=s,i=a;break}n=u}return e}function Nr(t){return Math.PI*t/180}function St(t,e,n){const r=t*Math.cos(n)-e*Math.sin(n),i=t*Math.sin(n)+e*Math.cos(n);return[r,i]}function Cn(t,e,n,r,i,s,a,o,l,u){const h=Nr(a);let c=[],f=0,p=0,d=0,g=0;if(u)[f,p,d,g]=u;else{[t,e]=St(t,e,-h),[n,r]=St(n,r,-h);const k=(t-n)/2,N=(e-r)/2;let V=k*k/(i*i)+N*N/(s*s);V>1&&(V=Math.sqrt(V),i=V*i,s=V*s);const z=o===l?-1:1,L=i*i,q=s*s,W=L*q-L*N*N-q*k*k,H=L*N*N+q*k*k,Z=z*Math.sqrt(Math.abs(W/H));d=Z*i*N/s+(t+n)/2,g=Z*-s*k/i+(e+r)/2,f=Math.asin(parseFloat(((e-g)/s).toFixed(9))),p=Math.asin(parseFloat(((r-g)/s).toFixed(9))),t<d&&(f=Math.PI-f),n<d&&(p=Math.PI-p),f<0&&(f=Math.PI*2+f),p<0&&(p=Math.PI*2+p),l&&f>p&&(f=f-Math.PI*2),!l&&p>f&&(p=p-Math.PI*2)}let m=p-f;if(Math.abs(m)>Math.PI*120/180){const k=p,N=n,V=r;l&&p>f?p=f+Math.PI*120/180*1:p=f+Math.PI*120/180*-1,n=d+i*Math.cos(p),r=g+s*Math.sin(p),c=Cn(n,r,N,V,i,s,a,0,l,[p,k,d,g])}m=p-f;const v=Math.cos(f),y=Math.sin(f),E=Math.cos(p),M=Math.sin(p),O=Math.tan(m/4),_=4/3*i*O,C=4/3*s*O,R=[t,e],x=[t+_*y,e-C*v],I=[n+_*M,r-C*E],D=[n,r];if(x[0]=2*R[0]-x[0],x[1]=2*R[1]-x[1],u)return[x,I,D].concat(c);{c=[x,I,D].concat(c);const k=[];for(let N=0;N<c.length;N+=3){const V=St(c[N][0],c[N][1],h),z=St(c[N+1][0],c[N+1][1],h),L=St(c[N+2][0],c[N+2][1],h);k.push([V[0],V[1],z[0],z[1],L[0],L[1]])}return k}}const Vr={randOffset:Lr,randOffsetWithRange:Dr,ellipse:Ir,doubleLineOps:Zr};function _n(t,e,n,r,i){return{type:"path",ops:bt(t,e,n,r,i)}}function Bt(t,e,n){const r=(t||[]).length;if(r>2){const i=[];for(let s=0;s<r-1;s++)i.push(...bt(t[s][0],t[s][1],t[s+1][0],t[s+1][1],n));return e&&i.push(...bt(t[r-1][0],t[r-1][1],t[0][0],t[0][1],n)),{type:"path",ops:i}}else if(r===2)return _n(t[0][0],t[0][1],t[1][0],t[1][1],n);return{type:"path",ops:[]}}function Pr(t,e){return Bt(t,!0,e)}function Rr(t,e,n,r,i){const s=[[t,e],[t+n,e],[t+n,e+r],[t,e+r]];return Pr(s,i)}function Ze(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,i=Lt(r[0],1*(1+e.roughness*.2),e),s=e.disableMultiStroke?[]:Lt(r[0],1.5*(1+e.roughness*.22),$e(e));for(let a=1;a<r.length;a++){const o=r[a];if(o.length){const l=Lt(o,1*(1+e.roughness*.2),e),u=e.disableMultiStroke?[]:Lt(o,1.5*(1+e.roughness*.22),$e(e));for(const h of l)h.op!=="move"&&i.push(h);for(const h of u)h.op!=="move"&&s.push(h)}}return{type:"path",ops:i.concat(s)}}return{type:"path",ops:[]}}function Ir(t,e,n,r,i){const s=Tn(n,r,i);return ge(t,e,i,s).opset}function Tn(t,e,n){const r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),s=Math.PI*2/i;let a=Math.abs(t/2),o=Math.abs(e/2);const l=1-n.curveFitting;return a+=S(a*l,n),o+=S(o*l,n),{increment:s,rx:a,ry:o}}function ge(t,e,n,r){const[i,s]=Be(r.increment,t,e,r.rx,r.ry,1,r.increment*Gt(.1,Gt(.4,1,n),n),n);let a=qt(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[o]=Be(r.increment,t,e,r.rx,r.ry,1.5,0,n),l=qt(o,null,n);a=a.concat(l)}return{estimatedPoints:s,opset:{type:"path",ops:a}}}function Fe(t,e,n,r,i,s,a,o,l){const u=t,h=e;let c=Math.abs(n/2),f=Math.abs(r/2);c+=S(c*.01,l),f+=S(f*.01,l);let p=i,d=s;for(;p<0;)p+=Math.PI*2,d+=Math.PI*2;d-p>Math.PI*2&&(p=0,d=Math.PI*2);const g=Math.PI*2/l.curveStepCount,m=Math.min(g/2,(d-p)/2),v=Ue(m,u,h,c,f,p,d,1,l);if(!l.disableMultiStroke){const y=Ue(m,u,h,c,f,p,d,1.5,l);v.push(...y)}return a&&(o?v.push(...bt(u,h,u+c*Math.cos(p),h+f*Math.sin(p),l),...bt(u,h,u+c*Math.cos(d),h+f*Math.sin(d),l)):v.push({op:"lineTo",data:[u,h]},{op:"lineTo",data:[u+c*Math.cos(p),h+f*Math.sin(p)]})),{type:"path",ops:v}}function He(t,e){const n=En(An(Ee(t))),r=[];let i=[0,0],s=[0,0];for(const{key:a,data:o}of n)switch(a){case"M":{s=[o[0],o[1]],i=[o[0],o[1]];break}case"L":r.push(...bt(s[0],s[1],o[0],o[1],e)),s=[o[0],o[1]];break;case"C":{const[l,u,h,c,f,p]=o;r.push(...Fr(l,u,h,c,f,p,s,e)),s=[f,p];break}case"Z":r.push(...bt(s[0],s[1],i[0],i[1],e)),s=[i[0],i[1]];break}return{type:"path",ops:r}}function ie(t,e){const n=[];for(const r of t)if(r.length){const i=e.maxRandomnessOffset||0,s=r.length;if(s>2){n.push({op:"move",data:[r[0][0]+S(i,e),r[0][1]+S(i,e)]});for(let a=1;a<s;a++)n.push({op:"lineTo",data:[r[a][0]+S(i,e),r[a][1]+S(i,e)]})}}return{type:"fillPath",ops:n}}function wt(t,e){return _r(e,Vr).fillPolygons(t,e)}function zr(t,e,n,r,i,s,a){const o=t,l=e;let u=Math.abs(n/2),h=Math.abs(r/2);u+=S(u*.01,a),h+=S(h*.01,a);let c=i,f=s;for(;c<0;)c+=Math.PI*2,f+=Math.PI*2;f-c>Math.PI*2&&(c=0,f=Math.PI*2);const p=(f-c)/a.curveStepCount,d=[];for(let g=c;g<=f;g=g+p)d.push([o+u*Math.cos(g),l+h*Math.sin(g)]);return d.push([o+u*Math.cos(f),l+h*Math.sin(f)]),d.push([o,l]),wt([d],a)}function Lr(t,e){return S(t,e)}function Dr(t,e,n){return Gt(t,e,n)}function Zr(t,e,n,r,i){return bt(t,e,n,r,i,!0)}function $e(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function On(t){return t.randomizer||(t.randomizer=new Mn(t.seed||0)),t.randomizer.next()}function Gt(t,e,n,r=1){return n.roughness*r*(On(n)*(e-t)+t)}function S(t,e,n=1){return Gt(-t,t,e,n)}function bt(t,e,n,r,i,s=!1){const a=s?i.disableMultiStrokeFill:i.disableMultiStroke,o=me(t,e,n,r,i,!0,!1);if(a)return o;const l=me(t,e,n,r,i,!0,!0);return o.concat(l)}function me(t,e,n,r,i,s,a){const o=Math.pow(t-n,2)+Math.pow(e-r,2),l=Math.sqrt(o);let u=1;l<200?u=1:l>500?u=.4:u=-.0016668*l+1.233334;let h=i.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);const c=h/2,f=.2+On(i)*.2;let p=i.bowing*i.maxRandomnessOffset*(r-e)/200,d=i.bowing*i.maxRandomnessOffset*(t-n)/200;p=S(p,i,u),d=S(d,i,u);const g=[],m=()=>S(c,i,u),v=()=>S(h,i,u),y=i.preserveVertices;return a?g.push({op:"move",data:[t+(y?0:m()),e+(y?0:m())]}):g.push({op:"move",data:[t+(y?0:S(h,i,u)),e+(y?0:S(h,i,u))]}),a?g.push({op:"bcurveTo",data:[p+t+(n-t)*f+m(),d+e+(r-e)*f+m(),p+t+2*(n-t)*f+m(),d+e+2*(r-e)*f+m(),n+(y?0:m()),r+(y?0:m())]}):g.push({op:"bcurveTo",data:[p+t+(n-t)*f+v(),d+e+(r-e)*f+v(),p+t+2*(n-t)*f+v(),d+e+2*(r-e)*f+v(),n+(y?0:v()),r+(y?0:v())]}),g}function Lt(t,e,n){if(!t.length)return[];const r=[];r.push([t[0][0]+S(e,n),t[0][1]+S(e,n)]),r.push([t[0][0]+S(e,n),t[0][1]+S(e,n)]);for(let i=1;i<t.length;i++)r.push([t[i][0]+S(e,n),t[i][1]+S(e,n)]),i===t.length-1&&r.push([t[i][0]+S(e,n),t[i][1]+S(e,n)]);return qt(r,null,n)}function qt(t,e,n){const r=t.length,i=[];if(r>3){const s=[],a=1-n.curveTightness;i.push({op:"move",data:[t[1][0],t[1][1]]});for(let o=1;o+2<r;o++){const l=t[o];s[0]=[l[0],l[1]],s[1]=[l[0]+(a*t[o+1][0]-a*t[o-1][0])/6,l[1]+(a*t[o+1][1]-a*t[o-1][1])/6],s[2]=[t[o+1][0]+(a*t[o][0]-a*t[o+2][0])/6,t[o+1][1]+(a*t[o][1]-a*t[o+2][1])/6],s[3]=[t[o+1][0],t[o+1][1]],i.push({op:"bcurveTo",data:[s[1][0],s[1][1],s[2][0],s[2][1],s[3][0],s[3][1]]})}}else r===3?(i.push({op:"move",data:[t[1][0],t[1][1]]}),i.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):r===2&&i.push(...me(t[0][0],t[0][1],t[1][0],t[1][1],n,!0,!0));return i}function Be(t,e,n,r,i,s,a,o){const l=o.roughness===0,u=[],h=[];if(l){t=t/4,h.push([e+r*Math.cos(-t),n+i*Math.sin(-t)]);for(let c=0;c<=Math.PI*2;c=c+t){const f=[e+r*Math.cos(c),n+i*Math.sin(c)];u.push(f),h.push(f)}h.push([e+r*Math.cos(0),n+i*Math.sin(0)]),h.push([e+r*Math.cos(t),n+i*Math.sin(t)])}else{const c=S(.5,o)-Math.PI/2;h.push([S(s,o)+e+.9*r*Math.cos(c-t),S(s,o)+n+.9*i*Math.sin(c-t)]);const f=Math.PI*2+c-.01;for(let p=c;p<f;p=p+t){const d=[S(s,o)+e+r*Math.cos(p),S(s,o)+n+i*Math.sin(p)];u.push(d),h.push(d)}h.push([S(s,o)+e+r*Math.cos(c+Math.PI*2+a*.5),S(s,o)+n+i*Math.sin(c+Math.PI*2+a*.5)]),h.push([S(s,o)+e+.98*r*Math.cos(c+a),S(s,o)+n+.98*i*Math.sin(c+a)]),h.push([S(s,o)+e+.9*r*Math.cos(c+a*.5),S(s,o)+n+.9*i*Math.sin(c+a*.5)])}return[h,u]}function Ue(t,e,n,r,i,s,a,o,l){const u=s+S(.1,l),h=[];h.push([S(o,l)+e+.9*r*Math.cos(u-t),S(o,l)+n+.9*i*Math.sin(u-t)]);for(let c=u;c<=a;c=c+t)h.push([S(o,l)+e+r*Math.cos(c),S(o,l)+n+i*Math.sin(c)]);return h.push([e+r*Math.cos(a),n+i*Math.sin(a)]),h.push([e+r*Math.cos(a),n+i*Math.sin(a)]),qt(h,null,l)}function Fr(t,e,n,r,i,s,a,o){const l=[],u=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let h=[0,0];const c=o.disableMultiStroke?1:2,f=o.preserveVertices;for(let p=0;p<c;p++)p===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(f?0:S(u[0],o)),a[1]+(f?0:S(u[0],o))]}),h=f?[i,s]:[i+S(u[p],o),s+S(u[p],o)],l.push({op:"bcurveTo",data:[t+S(u[p],o),e+S(u[p],o),n+S(u[p],o),r+S(u[p],o),h[0],h[1]]});return l}function At(t){return[...t]}function Ge(t,e=0){const n=t.length;if(n<3)throw new Error("A curve must have at least three points.");const r=[];if(n===3)r.push(At(t[0]),At(t[1]),At(t[2]),At(t[2]));else{const i=[];i.push(t[0],t[0]);for(let o=1;o<t.length;o++)i.push(t[o]),o===t.length-1&&i.push(t[o]);const s=[],a=1-e;r.push(At(i[0]));for(let o=1;o+2<i.length;o++){const l=i[o];s[0]=[l[0],l[1]],s[1]=[l[0]+(a*i[o+1][0]-a*i[o-1][0])/6,l[1]+(a*i[o+1][1]-a*i[o-1][1])/6],s[2]=[i[o+1][0]+(a*i[o][0]-a*i[o+2][0])/6,i[o+1][1]+(a*i[o][1]-a*i[o+2][1])/6],s[3]=[i[o+1][0],i[o+1][1]],r.push(s[1],s[2],s[3])}}return r}function Hr(t,e){return Math.sqrt(Ut(t,e))}function Ut(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function $r(t,e,n){const r=Ut(e,n);if(r===0)return Ut(t,e);let i=((t[0]-e[0])*(n[0]-e[0])+(t[1]-e[1])*(n[1]-e[1]))/r;return i=Math.max(0,Math.min(1,i)),Ut(t,yt(e,n,i))}function yt(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}function Br(t,e){const n=t[e+0],r=t[e+1],i=t[e+2],s=t[e+3];let a=3*r[0]-2*n[0]-s[0];a*=a;let o=3*r[1]-2*n[1]-s[1];o*=o;let l=3*i[0]-2*s[0]-n[0];l*=l;let u=3*i[1]-2*s[1]-n[1];return u*=u,a<l&&(a=l),o<u&&(o=u),a+o}function ve(t,e,n,r){const i=r||[];if(Br(t,e)<n){const s=t[e+0];i.length?Hr(i[i.length-1],s)>1&&i.push(s):i.push(s),i.push(t[e+3])}else{const a=t[e+0],o=t[e+1],l=t[e+2],u=t[e+3],h=yt(a,o,.5),c=yt(o,l,.5),f=yt(l,u,.5),p=yt(h,c,.5),d=yt(c,f,.5),g=yt(p,d,.5);ve([a,h,p,g],0,n,i),ve([g,d,f,u],0,n,i)}return i}function Ur(t,e){return Wt(t,0,t.length,e)}function Wt(t,e,n,r,i){const s=i||[],a=t[e],o=t[n-1];let l=0,u=1;for(let h=e+1;h<n-1;++h){const c=$r(t[h],a,o);c>l&&(l=c,u=h)}return Math.sqrt(l)>r?(Wt(t,e,u+1,r,s),Wt(t,u,n,r,s)):(s.length||s.push(a),s.push(o)),s}function be(t,e=.15,n){const r=[],i=(t.length-1)/3;for(let s=0;s<i;s++){const a=s*3;ve(t,a,e,r)}return n&&n>0?Wt(r,0,r.length,n):r}function Gr(t,e,n){const r=Ee(t),i=En(An(r)),s=[];let a=[],o=[0,0],l=[];const u=()=>{l.length>=4&&a.push(...be(l,e)),l=[]},h=()=>{u(),a.length&&(s.push(a),a=[])};for(const{key:f,data:p}of i)switch(f){case"M":h(),o=[p[0],p[1]],a.push(o);break;case"L":u(),a.push([p[0],p[1]]);break;case"C":if(!l.length){const d=a.length?a[a.length-1]:o;l.push([d[0],d[1]])}l.push([p[0],p[1]]),l.push([p[2],p[3]]),l.push([p[4],p[5]]);break;case"Z":u(),a.push([o[0],o[1]]);break}if(h(),!n)return s;const c=[];for(const f of s){const p=Ur(f,n);p.length&&c.push(p)}return c}const Q="none";class jt{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Tr()}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,n,r){return{shape:e,sets:n||[],options:r||this.defaultOptions}}line(e,n,r,i,s){const a=this._o(s);return this._d("line",[_n(e,n,r,i,a)],a)}rectangle(e,n,r,i,s){const a=this._o(s),o=[],l=Rr(e,n,r,i,a);if(a.fill){const u=[[e,n],[e+r,n],[e+r,n+i],[e,n+i]];a.fillStyle==="solid"?o.push(ie([u],a)):o.push(wt([u],a))}return a.stroke!==Q&&o.push(l),this._d("rectangle",o,a)}ellipse(e,n,r,i,s){const a=this._o(s),o=[],l=Tn(r,i,a),u=ge(e,n,a,l);if(a.fill)if(a.fillStyle==="solid"){const h=ge(e,n,a,l).opset;h.type="fillPath",o.push(h)}else o.push(wt([u.estimatedPoints],a));return a.stroke!==Q&&o.push(u.opset),this._d("ellipse",o,a)}circle(e,n,r,i){const s=this.ellipse(e,n,r,r,i);return s.shape="circle",s}linearPath(e,n){const r=this._o(n);return this._d("linearPath",[Bt(e,!1,r)],r)}arc(e,n,r,i,s,a,o=!1,l){const u=this._o(l),h=[],c=Fe(e,n,r,i,s,a,o,!0,u);if(o&&u.fill)if(u.fillStyle==="solid"){const f=Object.assign({},u);f.disableMultiStroke=!0;const p=Fe(e,n,r,i,s,a,!0,!1,f);p.type="fillPath",h.push(p)}else h.push(zr(e,n,r,i,s,a,u));return u.stroke!==Q&&h.push(c),this._d("arc",h,u)}curve(e,n){const r=this._o(n),i=[],s=Ze(e,r);if(r.fill&&r.fill!==Q)if(r.fillStyle==="solid"){const a=Ze(e,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(a.ops)})}else{const a=[],o=e;if(o.length){const u=typeof o[0][0]=="number"?[o]:o;for(const h of u)h.length<3?a.push(...h):h.length===3?a.push(...be(Ge([h[0],h[0],h[1],h[2]]),10,(1+r.roughness)/2)):a.push(...be(Ge(h),10,(1+r.roughness)/2))}a.length&&i.push(wt([a],r))}return r.stroke!==Q&&i.push(s),this._d("curve",i,r)}polygon(e,n){const r=this._o(n),i=[],s=Bt(e,!0,r);return r.fill&&(r.fillStyle==="solid"?i.push(ie([e],r)):i.push(wt([e],r))),r.stroke!==Q&&i.push(s),this._d("polygon",i,r)}path(e,n){const r=this._o(n),i=[];if(!e)return this._d("path",i,r);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const s=r.fill&&r.fill!=="transparent"&&r.fill!==Q,a=r.stroke!==Q,o=!!(r.simplification&&r.simplification<1),l=o?4-4*(r.simplification||1):(1+r.roughness)/2,u=Gr(e,1,l),h=He(e,r);if(s)if(r.fillStyle==="solid")if(u.length===1){const c=He(e,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));i.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else i.push(ie(u,r));else i.push(wt(u,r));return a&&(o?u.forEach(c=>{i.push(Bt(c,!1,r))}):i.push(h)),this._d("path",i,r)}opsToPath(e,n){let r="";for(const i of e.ops){const s=typeof n=="number"&&n>=0?i.data.map(a=>+a.toFixed(n)):i.data;switch(i.op){case"move":r+=`M${s[0]} ${s[1]} `;break;case"bcurveTo":r+=`C${s[0]} ${s[1]}, ${s[2]} ${s[3]}, ${s[4]} ${s[5]} `;break;case"lineTo":r+=`L${s[0]} ${s[1]} `;break}}return r.trim()}toPaths(e){const n=e.sets||[],r=e.options||this.defaultOptions,i=[];for(const s of n){let a=null;switch(s.type){case"path":a={d:this.opsToPath(s),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:Q};break;case"fillPath":a={d:this.opsToPath(s),stroke:Q,strokeWidth:0,fill:r.fill||Q};break;case"fillSketch":a=this.fillSketch(s,r);break}a&&i.push(a)}return i}fillSketch(e,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(e),stroke:n.fill||Q,strokeWidth:r,fill:Q}}_mergedShape(e){return e.filter((n,r)=>r===0?!0:n.op!=="move")}}class qr{constructor(e,n){this.canvas=e,this.ctx=this.canvas.getContext("2d"),this.gen=new jt(n)}draw(e){const n=e.sets||[],r=e.options||this.getDefaultOptions(),i=this.ctx,s=e.options.fixedDecimalPlaceDigits;for(const a of n)switch(a.type){case"path":i.save(),i.strokeStyle=r.stroke==="none"?"transparent":r.stroke,i.lineWidth=r.strokeWidth,r.strokeLineDash&&i.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(i.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(i,a,s),i.restore();break;case"fillPath":{i.save(),i.fillStyle=r.fill||"";const o=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(i,a,s,o),i.restore();break}case"fillSketch":this.fillSketch(i,a,r);break}}fillSketch(e,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2),e.save(),r.fillLineDash&&e.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(e.lineDashOffset=r.fillLineDashOffset),e.strokeStyle=r.fill||"",e.lineWidth=i,this._drawToContext(e,n,r.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,n,r,i="nonzero"){e.beginPath();for(const s of n.ops){const a=typeof r=="number"&&r>=0?s.data.map(o=>+o.toFixed(r)):s.data;switch(s.op){case"move":e.moveTo(a[0],a[1]);break;case"bcurveTo":e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"lineTo":e.lineTo(a[0],a[1]);break}}n.type==="fillPath"?e.fill(i):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,n,r,i,s){const a=this.gen.line(e,n,r,i,s);return this.draw(a),a}rectangle(e,n,r,i,s){const a=this.gen.rectangle(e,n,r,i,s);return this.draw(a),a}ellipse(e,n,r,i,s){const a=this.gen.ellipse(e,n,r,i,s);return this.draw(a),a}circle(e,n,r,i){const s=this.gen.circle(e,n,r,i);return this.draw(s),s}linearPath(e,n){const r=this.gen.linearPath(e,n);return this.draw(r),r}polygon(e,n){const r=this.gen.polygon(e,n);return this.draw(r),r}arc(e,n,r,i,s,a,o=!1,l){const u=this.gen.arc(e,n,r,i,s,a,o,l);return this.draw(u),u}curve(e,n){const r=this.gen.curve(e,n);return this.draw(r),r}path(e,n){const r=this.gen.path(e,n);return this.draw(r),r}}const Dt="http://www.w3.org/2000/svg";class Wr{constructor(e,n){this.svg=e,this.gen=new jt(n)}draw(e){const n=e.sets||[],r=e.options||this.getDefaultOptions(),i=this.svg.ownerDocument||window.document,s=i.createElementNS(Dt,"g"),a=e.options.fixedDecimalPlaceDigits;for(const o of n){let l=null;switch(o.type){case"path":{l=i.createElementNS(Dt,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke",r.stroke),l.setAttribute("stroke-width",r.strokeWidth+""),l.setAttribute("fill","none"),r.strokeLineDash&&l.setAttribute("stroke-dasharray",r.strokeLineDash.join(" ").trim()),r.strokeLineDashOffset&&l.setAttribute("stroke-dashoffset",`${r.strokeLineDashOffset}`);break}case"fillPath":{l=i.createElementNS(Dt,"path"),l.setAttribute("d",this.opsToPath(o,a)),l.setAttribute("stroke","none"),l.setAttribute("stroke-width","0"),l.setAttribute("fill",r.fill||""),(e.shape==="curve"||e.shape==="polygon")&&l.setAttribute("fill-rule","evenodd");break}case"fillSketch":{l=this.fillSketch(i,o,r);break}}l&&s.appendChild(l)}return s}fillSketch(e,n,r){let i=r.fillWeight;i<0&&(i=r.strokeWidth/2);const s=e.createElementNS(Dt,"path");return s.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),s.setAttribute("stroke",r.fill||""),s.setAttribute("stroke-width",i+""),s.setAttribute("fill","none"),r.fillLineDash&&s.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&s.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),s}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,n){return this.gen.opsToPath(e,n)}line(e,n,r,i,s){const a=this.gen.line(e,n,r,i,s);return this.draw(a)}rectangle(e,n,r,i,s){const a=this.gen.rectangle(e,n,r,i,s);return this.draw(a)}ellipse(e,n,r,i,s){const a=this.gen.ellipse(e,n,r,i,s);return this.draw(a)}circle(e,n,r,i){const s=this.gen.circle(e,n,r,i);return this.draw(s)}linearPath(e,n){const r=this.gen.linearPath(e,n);return this.draw(r)}polygon(e,n){const r=this.gen.polygon(e,n);return this.draw(r)}arc(e,n,r,i,s,a,o=!1,l){const u=this.gen.arc(e,n,r,i,s,a,o,l);return this.draw(u)}curve(e,n){const r=this.gen.curve(e,n);return this.draw(r)}path(e,n){const r=this.gen.path(e,n);return this.draw(r)}}const jr={canvas(t,e){return new qr(t,e)},svg(t,e){return new Wr(t,e)},generator(t){return new jt(t)},newSeed(){return jt.newSeed()}};function Xt(t){"@babel/helpers - typeof";return Xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xt(t)}var Xr=/^\s+/,Yr=/\s+$/;function w(t,e){if(t=t||"",e=e||{},t instanceof w)return t;if(!(this instanceof w))return new w(t,e);var n=Qr(t);this._originalInput=t,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||n.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}w.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),n,r,i,s,a,o;return n=e.r/255,r=e.g/255,i=e.b/255,n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*a+.0722*o},setAlpha:function(e){return this._a=kn(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=We(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=We(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=qe(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=qe(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return je(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return ei(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(F(this._r,255)*100)+"%",g:Math.round(F(this._g,255)*100)+"%",b:Math.round(F(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%)":"rgba("+Math.round(F(this._r,255)*100)+"%, "+Math.round(F(this._g,255)*100)+"%, "+Math.round(F(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:pi[je(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var n="#"+Xe(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(e){var s=w(e);r="#"+Xe(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(e){var n=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0,s=!n&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return w(this.toString())},_applyModification:function(e,n){var r=e.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(si,arguments)},brighten:function(){return this._applyModification(oi,arguments)},darken:function(){return this._applyModification(ai,arguments)},desaturate:function(){return this._applyModification(ni,arguments)},saturate:function(){return this._applyModification(ri,arguments)},greyscale:function(){return this._applyModification(ii,arguments)},spin:function(){return this._applyModification(li,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(ci,arguments)},complement:function(){return this._applyCombination(ui,arguments)},monochromatic:function(){return this._applyCombination(fi,arguments)},splitcomplement:function(){return this._applyCombination(hi,arguments)},triad:function(){return this._applyCombination(Ye,[3])},tetrad:function(){return this._applyCombination(Ye,[4])}};w.fromRatio=function(t,e){if(Xt(t)=="object"){var n={};for(var r in t)t.hasOwnProperty(r)&&(r==="a"?n[r]=t[r]:n[r]=Et(t[r]));t=n}return w(t,e)};function Qr(t){var e={r:0,g:0,b:0},n=1,r=null,i=null,s=null,a=!1,o=!1;return typeof t=="string"&&(t=vi(t)),Xt(t)=="object"&&(ht(t.r)&&ht(t.g)&&ht(t.b)?(e=Kr(t.r,t.g,t.b),a=!0,o=String(t.r).substr(-1)==="%"?"prgb":"rgb"):ht(t.h)&&ht(t.s)&&ht(t.v)?(r=Et(t.s),i=Et(t.v),e=ti(t.h,r,i),a=!0,o="hsv"):ht(t.h)&&ht(t.s)&&ht(t.l)&&(r=Et(t.s),s=Et(t.l),e=Jr(t.h,r,s),a=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=kn(n),{ok:a,format:t.format||o,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function Kr(t,e,n){return{r:F(t,255)*255,g:F(e,255)*255,b:F(n,255)*255}}function qe(t,e,n){t=F(t,255),e=F(e,255),n=F(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,a,o=(r+i)/2;if(r==i)s=a=0;else{var l=r-i;switch(a=o>.5?l/(2-r-i):l/(r+i),r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:a,l:o}}function Jr(t,e,n){var r,i,s;t=F(t,360),e=F(e,100),n=F(n,100);function a(u,h,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(h-u)*6*c:c<1/2?h:c<2/3?u+(h-u)*(2/3-c)*6:u}if(e===0)r=i=s=n;else{var o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;r=a(l,o,t+1/3),i=a(l,o,t),s=a(l,o,t-1/3)}return{r:r*255,g:i*255,b:s*255}}function We(t,e,n){t=F(t,255),e=F(e,255),n=F(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,a,o=r,l=r-i;if(a=r===0?0:l/r,r==i)s=0;else{switch(r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:a,v:o}}function ti(t,e,n){t=F(t,360)*6,e=F(e,100),n=F(n,100);var r=Math.floor(t),i=t-r,s=n*(1-e),a=n*(1-i*e),o=n*(1-(1-i)*e),l=r%6,u=[n,a,s,s,o,n][l],h=[o,n,n,a,s,s][l],c=[s,s,o,n,n,a][l];return{r:u*255,g:h*255,b:c*255}}function je(t,e,n,r){var i=[st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function ei(t,e,n,r,i){var s=[st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16)),st(Nn(r))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function Xe(t,e,n,r){var i=[st(Nn(r)),st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16))];return i.join("")}w.equals=function(t,e){return!t||!e?!1:w(t).toRgbString()==w(e).toRgbString()};w.random=function(){return w.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function ni(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.s-=e/100,n.s=Kt(n.s),w(n)}function ri(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.s+=e/100,n.s=Kt(n.s),w(n)}function ii(t){return w(t).desaturate(100)}function si(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.l+=e/100,n.l=Kt(n.l),w(n)}function oi(t,e){e=e===0?0:e||10;var n=w(t).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(e/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(e/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(e/100)))),w(n)}function ai(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.l-=e/100,n.l=Kt(n.l),w(n)}function li(t,e){var n=w(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,w(n)}function ui(t){var e=w(t).toHsl();return e.h=(e.h+180)%360,w(e)}function Ye(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var n=w(t).toHsl(),r=[w(t)],i=360/e,s=1;s<e;s++)r.push(w({h:(n.h+s*i)%360,s:n.s,l:n.l}));return r}function hi(t){var e=w(t).toHsl(),n=e.h;return[w(t),w({h:(n+72)%360,s:e.s,l:e.l}),w({h:(n+216)%360,s:e.s,l:e.l})]}function ci(t,e,n){e=e||6,n=n||30;var r=w(t).toHsl(),i=360/n,s=[w(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(w(r));return s}function fi(t,e){e=e||6;for(var n=w(t).toHsv(),r=n.h,i=n.s,s=n.v,a=[],o=1/e;e--;)a.push(w({h:r,s:i,v:s})),s=(s+o)%1;return a}w.mix=function(t,e,n){n=n===0?0:n||50;var r=w(t).toRgb(),i=w(e).toRgb(),s=n/100,a={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return w(a)};w.readability=function(t,e){var n=w(t),r=w(e);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};w.isReadable=function(t,e,n){var r=w.readability(t,e),i,s;switch(s=!1,i=bi(n),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};w.mostReadable=function(t,e,n){var r=null,i=0,s,a,o,l;n=n||{},a=n.includeFallbackColors,o=n.level,l=n.size;for(var u=0;u<e.length;u++)s=w.readability(t,e[u]),s>i&&(i=s,r=w(e[u]));return w.isReadable(t,r,{level:o,size:l})||!a?r:(n.includeFallbackColors=!1,w.mostReadable(t,["#fff","#000"],n))};var ye=w.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},pi=w.hexNames=di(ye);function di(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function kn(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function F(t,e){gi(t)&&(t="100%");var n=mi(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Kt(t){return Math.min(1,Math.max(0,t))}function K(t){return parseInt(t,16)}function gi(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function mi(t){return typeof t=="string"&&t.indexOf("%")!=-1}function st(t){return t.length==1?"0"+t:""+t}function Et(t){return t<=1&&(t=t*100+"%"),t}function Nn(t){return Math.round(parseFloat(t)*255).toString(16)}function Qe(t){return K(t)/255}var nt=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ht(t){return!!nt.CSS_UNIT.exec(t)}function vi(t){t=t.replace(Xr,"").replace(Yr,"").toLowerCase();var e=!1;if(ye[t])t=ye[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=nt.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=nt.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=nt.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=nt.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=nt.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=nt.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=nt.hex8.exec(t))?{r:K(n[1]),g:K(n[2]),b:K(n[3]),a:Qe(n[4]),format:e?"name":"hex8"}:(n=nt.hex6.exec(t))?{r:K(n[1]),g:K(n[2]),b:K(n[3]),format:e?"name":"hex"}:(n=nt.hex4.exec(t))?{r:K(n[1]+""+n[1]),g:K(n[2]+""+n[2]),b:K(n[3]+""+n[3]),a:Qe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=nt.hex3.exec(t))?{r:K(n[1]+""+n[1]),g:K(n[2]+""+n[2]),b:K(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function bi(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Vn=function(t,e){return(Vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])})(t,e)};function Pn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Vn(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Rn(t){var e="";Array.isArray(t)||(t=[t]);for(var n=0;n<t.length;n++){var r=t[n];if(r.type===b.CLOSE_PATH)e+="z";else if(r.type===b.HORIZ_LINE_TO)e+=(r.relative?"h":"H")+r.x;else if(r.type===b.VERT_LINE_TO)e+=(r.relative?"v":"V")+r.y;else if(r.type===b.MOVE_TO)e+=(r.relative?"m":"M")+r.x+" "+r.y;else if(r.type===b.LINE_TO)e+=(r.relative?"l":"L")+r.x+" "+r.y;else if(r.type===b.CURVE_TO)e+=(r.relative?"c":"C")+r.x1+" "+r.y1+" "+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===b.SMOOTH_CURVE_TO)e+=(r.relative?"s":"S")+r.x2+" "+r.y2+" "+r.x+" "+r.y;else if(r.type===b.QUAD_TO)e+=(r.relative?"q":"Q")+r.x1+" "+r.y1+" "+r.x+" "+r.y;else if(r.type===b.SMOOTH_QUAD_TO)e+=(r.relative?"t":"T")+r.x+" "+r.y;else{if(r.type!==b.ARC)throw new Error('Unexpected command type "'+r.type+'" at index '+n+".");e+=(r.relative?"a":"A")+r.rX+" "+r.rY+" "+r.xRot+" "+ +r.lArcFlag+" "+ +r.sweepFlag+" "+r.x+" "+r.y}}return e}function xe(t,e){var n=t[0],r=t[1];return[n*Math.cos(e)-r*Math.sin(e),n*Math.sin(e)+r*Math.cos(e)]}function rt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=0;n<t.length;n++)if(typeof t[n]!="number")throw new Error("assertNumbers arguments["+n+"] is not a number. "+typeof t[n]+" == typeof "+t[n]);return!0}var pt=Math.PI;function se(t,e,n){t.lArcFlag=t.lArcFlag===0?0:1,t.sweepFlag=t.sweepFlag===0?0:1;var r=t.rX,i=t.rY,s=t.x,a=t.y;r=Math.abs(t.rX),i=Math.abs(t.rY);var o=xe([(e-s)/2,(n-a)/2],-t.xRot/180*pt),l=o[0],u=o[1],h=Math.pow(l,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(i,2);1<h&&(r*=Math.sqrt(h),i*=Math.sqrt(h)),t.rX=r,t.rY=i;var c=Math.pow(r,2)*Math.pow(u,2)+Math.pow(i,2)*Math.pow(l,2),f=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(i,2)-c)/c)),p=r*u/i*f,d=-i*l/r*f,g=xe([p,d],t.xRot/180*pt);t.cX=g[0]+(e+s)/2,t.cY=g[1]+(n+a)/2,t.phi1=Math.atan2((u-d)/i,(l-p)/r),t.phi2=Math.atan2((-u-d)/i,(-l-p)/r),t.sweepFlag===0&&t.phi2>t.phi1&&(t.phi2-=2*pt),t.sweepFlag===1&&t.phi2<t.phi1&&(t.phi2+=2*pt),t.phi1*=180/pt,t.phi2*=180/pt}function Ke(t,e,n){rt(t,e,n);var r=t*t+e*e-n*n;if(0>r)return[];if(r===0)return[[t*n/(t*t+e*e),e*n/(t*t+e*e)]];var i=Math.sqrt(r);return[[(t*n+e*i)/(t*t+e*e),(e*n-t*i)/(t*t+e*e)],[(t*n-e*i)/(t*t+e*e),(e*n+t*i)/(t*t+e*e)]]}var $,ct=Math.PI/180;function Je(t,e,n){return(1-n)*t+n*e}function tn(t,e,n,r){return t+Math.cos(r/180*pt)*e+Math.sin(r/180*pt)*n}function en(t,e,n,r){var i=1e-6,s=e-t,a=n-e,o=3*s+3*(r-n)-6*a,l=6*(a-s),u=3*s;return Math.abs(o)<i?[-u/l]:function(h,c,f){var p=h*h/4-c;if(p<-1e-6)return[];if(p<=f)return[-h/2];var d=Math.sqrt(p);return[-h/2-d,-h/2+d]}(l/o,u/o,i)}function nn(t,e,n,r,i){var s=1-i;return t*(s*s*s)+e*(3*s*s*i)+n*(3*s*i*i)+r*(i*i*i)}(function(t){function e(){return i(function(o,l,u){return o.relative&&(o.x1!==void 0&&(o.x1+=l),o.y1!==void 0&&(o.y1+=u),o.x2!==void 0&&(o.x2+=l),o.y2!==void 0&&(o.y2+=u),o.x!==void 0&&(o.x+=l),o.y!==void 0&&(o.y+=u),o.relative=!1),o})}function n(){var o=NaN,l=NaN,u=NaN,h=NaN;return i(function(c,f,p){return c.type&b.SMOOTH_CURVE_TO&&(c.type=b.CURVE_TO,o=isNaN(o)?f:o,l=isNaN(l)?p:l,c.x1=c.relative?f-o:2*f-o,c.y1=c.relative?p-l:2*p-l),c.type&b.CURVE_TO?(o=c.relative?f+c.x2:c.x2,l=c.relative?p+c.y2:c.y2):(o=NaN,l=NaN),c.type&b.SMOOTH_QUAD_TO&&(c.type=b.QUAD_TO,u=isNaN(u)?f:u,h=isNaN(h)?p:h,c.x1=c.relative?f-u:2*f-u,c.y1=c.relative?p-h:2*p-h),c.type&b.QUAD_TO?(u=c.relative?f+c.x1:c.x1,h=c.relative?p+c.y1:c.y1):(u=NaN,h=NaN),c})}function r(){var o=NaN,l=NaN;return i(function(u,h,c){if(u.type&b.SMOOTH_QUAD_TO&&(u.type=b.QUAD_TO,o=isNaN(o)?h:o,l=isNaN(l)?c:l,u.x1=u.relative?h-o:2*h-o,u.y1=u.relative?c-l:2*c-l),u.type&b.QUAD_TO){o=u.relative?h+u.x1:u.x1,l=u.relative?c+u.y1:u.y1;var f=u.x1,p=u.y1;u.type=b.CURVE_TO,u.x1=((u.relative?0:h)+2*f)/3,u.y1=((u.relative?0:c)+2*p)/3,u.x2=(u.x+2*f)/3,u.y2=(u.y+2*p)/3}else o=NaN,l=NaN;return u})}function i(o){var l=0,u=0,h=NaN,c=NaN;return function(f){if(isNaN(h)&&!(f.type&b.MOVE_TO))throw new Error("path must start with moveto");var p=o(f,l,u,h,c);return f.type&b.CLOSE_PATH&&(l=h,u=c),f.x!==void 0&&(l=f.relative?l+f.x:f.x),f.y!==void 0&&(u=f.relative?u+f.y:f.y),f.type&b.MOVE_TO&&(h=l,c=u),p}}function s(o,l,u,h,c,f){return rt(o,l,u,h,c,f),i(function(p,d,g,m){var v=p.x1,y=p.x2,E=p.relative&&!isNaN(m),M=p.x!==void 0?p.x:E?0:d,O=p.y!==void 0?p.y:E?0:g;function _(lt){return lt*lt}p.type&b.HORIZ_LINE_TO&&l!==0&&(p.type=b.LINE_TO,p.y=p.relative?0:g),p.type&b.VERT_LINE_TO&&u!==0&&(p.type=b.LINE_TO,p.x=p.relative?0:d),p.x!==void 0&&(p.x=p.x*o+O*u+(E?0:c)),p.y!==void 0&&(p.y=M*l+p.y*h+(E?0:f)),p.x1!==void 0&&(p.x1=p.x1*o+p.y1*u+(E?0:c)),p.y1!==void 0&&(p.y1=v*l+p.y1*h+(E?0:f)),p.x2!==void 0&&(p.x2=p.x2*o+p.y2*u+(E?0:c)),p.y2!==void 0&&(p.y2=y*l+p.y2*h+(E?0:f));var C=o*h-l*u;if(p.xRot!==void 0&&(o!==1||l!==0||u!==0||h!==1))if(C===0)delete p.rX,delete p.rY,delete p.xRot,delete p.lArcFlag,delete p.sweepFlag,p.type=b.LINE_TO;else{var R=p.xRot*Math.PI/180,x=Math.sin(R),I=Math.cos(R),D=1/_(p.rX),k=1/_(p.rY),N=_(I)*D+_(x)*k,V=2*x*I*(D-k),z=_(x)*D+_(I)*k,L=N*h*h-V*l*h+z*l*l,q=V*(o*h+l*u)-2*(N*u*h+z*o*l),W=N*u*u-V*o*u+z*o*o,H=(Math.atan2(q,L-W)+Math.PI)%Math.PI/2,Z=Math.sin(H),U=Math.cos(H);p.rX=Math.abs(C)/Math.sqrt(L*_(U)+q*Z*U+W*_(Z)),p.rY=Math.abs(C)/Math.sqrt(L*_(Z)-q*Z*U+W*_(U)),p.xRot=180*H/Math.PI}return p.sweepFlag!==void 0&&0>C&&(p.sweepFlag=+!p.sweepFlag),p})}function a(){return function(o){var l={};for(var u in o)l[u]=o[u];return l}}t.ROUND=function(o){function l(u){return Math.round(u*o)/o}return o===void 0&&(o=1e13),rt(o),function(u){return u.x1!==void 0&&(u.x1=l(u.x1)),u.y1!==void 0&&(u.y1=l(u.y1)),u.x2!==void 0&&(u.x2=l(u.x2)),u.y2!==void 0&&(u.y2=l(u.y2)),u.x!==void 0&&(u.x=l(u.x)),u.y!==void 0&&(u.y=l(u.y)),u.rX!==void 0&&(u.rX=l(u.rX)),u.rY!==void 0&&(u.rY=l(u.rY)),u}},t.TO_ABS=e,t.TO_REL=function(){return i(function(o,l,u){return o.relative||(o.x1!==void 0&&(o.x1-=l),o.y1!==void 0&&(o.y1-=u),o.x2!==void 0&&(o.x2-=l),o.y2!==void 0&&(o.y2-=u),o.x!==void 0&&(o.x-=l),o.y!==void 0&&(o.y-=u),o.relative=!0),o})},t.NORMALIZE_HVZ=function(o,l,u){return o===void 0&&(o=!0),l===void 0&&(l=!0),u===void 0&&(u=!0),i(function(h,c,f,p,d){if(isNaN(p)&&!(h.type&b.MOVE_TO))throw new Error("path must start with moveto");return l&&h.type&b.HORIZ_LINE_TO&&(h.type=b.LINE_TO,h.y=h.relative?0:f),u&&h.type&b.VERT_LINE_TO&&(h.type=b.LINE_TO,h.x=h.relative?0:c),o&&h.type&b.CLOSE_PATH&&(h.type=b.LINE_TO,h.x=h.relative?p-c:p,h.y=h.relative?d-f:d),h.type&b.ARC&&(h.rX===0||h.rY===0)&&(h.type=b.LINE_TO,delete h.rX,delete h.rY,delete h.xRot,delete h.lArcFlag,delete h.sweepFlag),h})},t.NORMALIZE_ST=n,t.QT_TO_C=r,t.INFO=i,t.SANITIZE=function(o){o===void 0&&(o=0),rt(o);var l=NaN,u=NaN,h=NaN,c=NaN;return i(function(f,p,d,g,m){var v=Math.abs,y=!1,E=0,M=0;if(f.type&b.SMOOTH_CURVE_TO&&(E=isNaN(l)?0:p-l,M=isNaN(u)?0:d-u),f.type&(b.CURVE_TO|b.SMOOTH_CURVE_TO)?(l=f.relative?p+f.x2:f.x2,u=f.relative?d+f.y2:f.y2):(l=NaN,u=NaN),f.type&b.SMOOTH_QUAD_TO?(h=isNaN(h)?p:2*p-h,c=isNaN(c)?d:2*d-c):f.type&b.QUAD_TO?(h=f.relative?p+f.x1:f.x1,c=f.relative?d+f.y1:f.y2):(h=NaN,c=NaN),f.type&b.LINE_COMMANDS||f.type&b.ARC&&(f.rX===0||f.rY===0||!f.lArcFlag)||f.type&b.CURVE_TO||f.type&b.SMOOTH_CURVE_TO||f.type&b.QUAD_TO||f.type&b.SMOOTH_QUAD_TO){var O=f.x===void 0?0:f.relative?f.x:f.x-p,_=f.y===void 0?0:f.relative?f.y:f.y-d;E=isNaN(h)?f.x1===void 0?E:f.relative?f.x:f.x1-p:h-p,M=isNaN(c)?f.y1===void 0?M:f.relative?f.y:f.y1-d:c-d;var C=f.x2===void 0?0:f.relative?f.x:f.x2-p,R=f.y2===void 0?0:f.relative?f.y:f.y2-d;v(O)<=o&&v(_)<=o&&v(E)<=o&&v(M)<=o&&v(C)<=o&&v(R)<=o&&(y=!0)}return f.type&b.CLOSE_PATH&&v(p-g)<=o&&v(d-m)<=o&&(y=!0),y?[]:f})},t.MATRIX=s,t.ROTATE=function(o,l,u){l===void 0&&(l=0),u===void 0&&(u=0),rt(o,l,u);var h=Math.sin(o),c=Math.cos(o);return s(c,h,-h,c,l-l*c+u*h,u-l*h-u*c)},t.TRANSLATE=function(o,l){return l===void 0&&(l=0),rt(o,l),s(1,0,0,1,o,l)},t.SCALE=function(o,l){return l===void 0&&(l=o),rt(o,l),s(o,0,0,l,0,0)},t.SKEW_X=function(o){return rt(o),s(1,0,Math.atan(o),1,0,0)},t.SKEW_Y=function(o){return rt(o),s(1,Math.atan(o),0,1,0,0)},t.X_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),rt(o),s(-1,0,0,1,o,0)},t.Y_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),rt(o),s(1,0,0,-1,0,o)},t.A_TO_C=function(){return i(function(o,l,u){return b.ARC===o.type?function(h,c,f){var p,d,g,m;h.cX||se(h,c,f);for(var v=Math.min(h.phi1,h.phi2),y=Math.max(h.phi1,h.phi2)-v,E=Math.ceil(y/90),M=new Array(E),O=c,_=f,C=0;C<E;C++){var R=Je(h.phi1,h.phi2,C/E),x=Je(h.phi1,h.phi2,(C+1)/E),I=x-R,D=4/3*Math.tan(I*ct/4),k=[Math.cos(R*ct)-D*Math.sin(R*ct),Math.sin(R*ct)+D*Math.cos(R*ct)],N=k[0],V=k[1],z=[Math.cos(x*ct),Math.sin(x*ct)],L=z[0],q=z[1],W=[L+D*Math.sin(x*ct),q-D*Math.cos(x*ct)],H=W[0],Z=W[1];M[C]={relative:h.relative,type:b.CURVE_TO};var U=function(lt,j){var Vt=xe([lt*h.rX,j*h.rY],h.xRot),Jt=Vt[0],Zn=Vt[1];return[h.cX+Jt,h.cY+Zn]};p=U(N,V),M[C].x1=p[0],M[C].y1=p[1],d=U(H,Z),M[C].x2=d[0],M[C].y2=d[1],g=U(L,q),M[C].x=g[0],M[C].y=g[1],h.relative&&(M[C].x1-=O,M[C].y1-=_,M[C].x2-=O,M[C].y2-=_,M[C].x-=O,M[C].y-=_),O=(m=[M[C].x,M[C].y])[0],_=m[1]}return M}(o,o.relative?0:l,o.relative?0:u):o})},t.ANNOTATE_ARCS=function(){return i(function(o,l,u){return o.relative&&(l=0,u=0),b.ARC===o.type&&se(o,l,u),o})},t.CLONE=a,t.CALCULATE_BOUNDS=function(){var o=function(f){var p={};for(var d in f)p[d]=f[d];return p},l=e(),u=r(),h=n(),c=i(function(f,p,d){var g=h(u(l(o(f))));function m(Z){Z>c.maxX&&(c.maxX=Z),Z<c.minX&&(c.minX=Z)}function v(Z){Z>c.maxY&&(c.maxY=Z),Z<c.minY&&(c.minY=Z)}if(g.type&b.DRAWING_COMMANDS&&(m(p),v(d)),g.type&b.HORIZ_LINE_TO&&m(g.x),g.type&b.VERT_LINE_TO&&v(g.y),g.type&b.LINE_TO&&(m(g.x),v(g.y)),g.type&b.CURVE_TO){m(g.x),v(g.y);for(var y=0,E=en(p,g.x1,g.x2,g.x);y<E.length;y++)0<(H=E[y])&&1>H&&m(nn(p,g.x1,g.x2,g.x,H));for(var M=0,O=en(d,g.y1,g.y2,g.y);M<O.length;M++)0<(H=O[M])&&1>H&&v(nn(d,g.y1,g.y2,g.y,H))}if(g.type&b.ARC){m(g.x),v(g.y),se(g,p,d);for(var _=g.xRot/180*Math.PI,C=Math.cos(_)*g.rX,R=Math.sin(_)*g.rX,x=-Math.sin(_)*g.rY,I=Math.cos(_)*g.rY,D=g.phi1<g.phi2?[g.phi1,g.phi2]:-180>g.phi2?[g.phi2+360,g.phi1+360]:[g.phi2,g.phi1],k=D[0],N=D[1],V=function(Z){var U=Z[0],lt=Z[1],j=180*Math.atan2(lt,U)/Math.PI;return j<k?j+360:j},z=0,L=Ke(x,-C,0).map(V);z<L.length;z++)(H=L[z])>k&&H<N&&m(tn(g.cX,C,x,H));for(var q=0,W=Ke(I,-R,0).map(V);q<W.length;q++){var H;(H=W[q])>k&&H<N&&v(tn(g.cY,R,I,H))}}return f});return c.minX=1/0,c.maxX=-1/0,c.minY=1/0,c.maxY=-1/0,c}})($||($={}));var et,In=function(){function t(){}return t.prototype.round=function(e){return this.transform($.ROUND(e))},t.prototype.toAbs=function(){return this.transform($.TO_ABS())},t.prototype.toRel=function(){return this.transform($.TO_REL())},t.prototype.normalizeHVZ=function(e,n,r){return this.transform($.NORMALIZE_HVZ(e,n,r))},t.prototype.normalizeST=function(){return this.transform($.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform($.QT_TO_C())},t.prototype.aToC=function(){return this.transform($.A_TO_C())},t.prototype.sanitize=function(e){return this.transform($.SANITIZE(e))},t.prototype.translate=function(e,n){return this.transform($.TRANSLATE(e,n))},t.prototype.scale=function(e,n){return this.transform($.SCALE(e,n))},t.prototype.rotate=function(e,n,r){return this.transform($.ROTATE(e,n,r))},t.prototype.matrix=function(e,n,r,i,s,a){return this.transform($.MATRIX(e,n,r,i,s,a))},t.prototype.skewX=function(e){return this.transform($.SKEW_X(e))},t.prototype.skewY=function(e){return this.transform($.SKEW_Y(e))},t.prototype.xSymmetry=function(e){return this.transform($.X_AXIS_SYMMETRY(e))},t.prototype.ySymmetry=function(e){return this.transform($.Y_AXIS_SYMMETRY(e))},t.prototype.annotateArcs=function(){return this.transform($.ANNOTATE_ARCS())},t}(),yi=function(t){return t===" "||t===" "||t==="\r"||t===`
`},rn=function(t){return 48<=t.charCodeAt(0)&&t.charCodeAt(0)<=57},xi=function(t){function e(){var n=t.call(this)||this;return n.curNumber="",n.curCommandType=-1,n.curCommandRelative=!1,n.canParseCommandOrComma=!0,n.curNumberHasExp=!1,n.curNumberHasExpDigits=!1,n.curNumberHasDecimal=!1,n.curArgs=[],n}return Pn(e,t),e.prototype.finish=function(n){if(n===void 0&&(n=[]),this.parse(" ",n),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return n},e.prototype.parse=function(n,r){var i=this;r===void 0&&(r=[]);for(var s=function(c){r.push(c),i.curArgs.length=0,i.canParseCommandOrComma=!0},a=0;a<n.length;a++){var o=n[a],l=!(this.curCommandType!==b.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),u=rn(o)&&(this.curNumber==="0"&&o==="0"||l);if(!rn(o)||u)if(o!=="e"&&o!=="E")if(o!=="-"&&o!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(o!=="."||this.curNumberHasExp||this.curNumberHasDecimal||l){if(this.curNumber&&this.curCommandType!==-1){var h=Number(this.curNumber);if(isNaN(h))throw new SyntaxError("Invalid number ending at "+a);if(this.curCommandType===b.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>h)throw new SyntaxError('Expected positive number, got "'+h+'" at index "'+a+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+a+'"')}this.curArgs.push(h),this.curArgs.length===wi[this.curCommandType]&&(b.HORIZ_LINE_TO===this.curCommandType?s({type:b.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):b.VERT_LINE_TO===this.curCommandType?s({type:b.VERT_LINE_TO,relative:this.curCommandRelative,y:h}):this.curCommandType===b.MOVE_TO||this.curCommandType===b.LINE_TO||this.curCommandType===b.SMOOTH_QUAD_TO?(s({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),b.MOVE_TO===this.curCommandType&&(this.curCommandType=b.LINE_TO)):this.curCommandType===b.CURVE_TO?s({type:b.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===b.SMOOTH_CURVE_TO?s({type:b.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===b.QUAD_TO?s({type:b.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===b.ARC&&s({type:b.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!yi(o))if(o===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(o!=="+"&&o!=="-"&&o!==".")if(u)this.curNumber=o,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+a+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+o+'" at index '+a+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,o!=="z"&&o!=="Z")if(o==="h"||o==="H")this.curCommandType=b.HORIZ_LINE_TO,this.curCommandRelative=o==="h";else if(o==="v"||o==="V")this.curCommandType=b.VERT_LINE_TO,this.curCommandRelative=o==="v";else if(o==="m"||o==="M")this.curCommandType=b.MOVE_TO,this.curCommandRelative=o==="m";else if(o==="l"||o==="L")this.curCommandType=b.LINE_TO,this.curCommandRelative=o==="l";else if(o==="c"||o==="C")this.curCommandType=b.CURVE_TO,this.curCommandRelative=o==="c";else if(o==="s"||o==="S")this.curCommandType=b.SMOOTH_CURVE_TO,this.curCommandRelative=o==="s";else if(o==="q"||o==="Q")this.curCommandType=b.QUAD_TO,this.curCommandRelative=o==="q";else if(o==="t"||o==="T")this.curCommandType=b.SMOOTH_QUAD_TO,this.curCommandRelative=o==="t";else{if(o!=="a"&&o!=="A")throw new SyntaxError('Unexpected character "'+o+'" at index '+a+".");this.curCommandType=b.ARC,this.curCommandRelative=o==="a"}else r.push({type:b.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=o,this.curNumberHasDecimal=o==="."}else this.curNumber+=o,this.curNumberHasDecimal=!0;else this.curNumber+=o;else this.curNumber+=o,this.curNumberHasExp=!0;else this.curNumber+=o,this.curNumberHasExpDigits=this.curNumberHasExp}return r},e.prototype.transform=function(n){return Object.create(this,{parse:{value:function(r,i){i===void 0&&(i=[]);for(var s=0,a=Object.getPrototypeOf(this).parse.call(this,r);s<a.length;s++){var o=a[s],l=n(o);Array.isArray(l)?i.push.apply(i,l):i.push(l)}return i}}})},e}(In),b=function(t){function e(n){var r=t.call(this)||this;return r.commands=typeof n=="string"?e.parse(n):n,r}return Pn(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var n=$.CALCULATE_BOUNDS();return this.transform(n),n},e.prototype.transform=function(n){for(var r=[],i=0,s=this.commands;i<s.length;i++){var a=n(s[i]);Array.isArray(a)?r.push.apply(r,a):r.push(a)}return this.commands=r,this},e.encode=function(n){return Rn(n)},e.parse=function(n){var r=new xi,i=[];return r.parse(n,i),r.finish(i),i},e.CLOSE_PATH=1,e.MOVE_TO=2,e.HORIZ_LINE_TO=4,e.VERT_LINE_TO=8,e.LINE_TO=16,e.CURVE_TO=32,e.SMOOTH_CURVE_TO=64,e.QUAD_TO=128,e.SMOOTH_QUAD_TO=256,e.ARC=512,e.LINE_COMMANDS=e.LINE_TO|e.HORIZ_LINE_TO|e.VERT_LINE_TO,e.DRAWING_COMMANDS=e.HORIZ_LINE_TO|e.VERT_LINE_TO|e.LINE_TO|e.CURVE_TO|e.SMOOTH_CURVE_TO|e.QUAD_TO|e.SMOOTH_QUAD_TO|e.ARC,e}(In),wi=((et={})[b.MOVE_TO]=2,et[b.LINE_TO]=2,et[b.HORIZ_LINE_TO]=1,et[b.VERT_LINE_TO]=1,et[b.CLOSE_PATH]=0,et[b.QUAD_TO]=4,et[b.SMOOTH_QUAD_TO]=2,et[b.CURVE_TO]=6,et[b.SMOOTH_CURVE_TO]=4,et[b.ARC]=7,et),dt;function mt(t){if(t.children!==void 0)return t.children;let e,n=0;const r=t.childNodes,i=[];for(;e=r[n++];)e.nodeType===1&&i.push(e);return i}function Ce(t){const e=t.parentNode;return e&&e.nodeType===Node.ELEMENT_NODE?e:null}function oe(t,e){for(;e.firstChild;)t.append(e.firstChild);return t}function Mt(t){if(t===null)return null;const e=/url\('#?(.*?)'\)/.exec(t)||/url\("#?(.*?)"\)/.exec(t)||/url\(#?(.*?)\)/.exec(t);return e&&e.length>1?e[1]:null}(function(t){t[t.SVG=0]="SVG",t[t.CANVAS=1]="CANVAS"})(dt||(dt={}));const Ot="data-sketchy-clip-path",Mi=/[acsqt]/i;function _e(t){if(t.svgSketchDefs)return t.svgSketchDefs;const e=t.svgSketch,n=document.createElementNS("http://www.w3.org/2000/svg","defs");return e.childElementCount>0?e.insertBefore(n,e.firstElementChild):e.appendChild(n),t.svgSketchDefs=n,n}function sn(t){const e=t.getAttribute("points");if(!e)return[];let n;n=e.indexOf(" ")>0?/\s+/g:/,/g;const r=e.split(n),i=[];for(let s=0;s<r.length;s++){const a=r[s],o=a.split(",");if(o.length===2)i.push({x:parseFloat(o[0]),y:parseFloat(o[1])});else{const l=s+1;l<r.length&&(i.push({x:parseFloat(a),y:parseFloat(r[l])}),s=l)}}return i}function J(t,e,n){let r=n;const i=e.getAttribute(Ot),s=t.pencilFilter&&e.tagName!=="text";if(!(r.tagName==="g"&&r.attributes.length===0)&&(i||s)){const a=document.createElementNS("http://www.w3.org/2000/svg","g");a.appendChild(r),r=a}i&&(r.setAttribute("clip-path",`url(#${i})`),e.removeAttribute(Ot)),s&&r.setAttribute("filter","url(#pencilTextureFilter)"),t.svgSketch.appendChild(r)}function Zt(t,e,n){return Mi.test(e)&&(n=n?Object.assign(Object.assign({},n),{preserveVertices:!0}):{preserveVertices:!0}),t.rc.path(e,n)}function G(t,e,n,r){let i;if(i=r?e.getAttribute(n):getComputedStyle(e)[n]||e.getAttribute(n),!i){let s=Ce(e);const a=r;let o=a;return a&&a.referenced===e&&(s=a.root,o=a.parentContext),!s||s===t.sourceSvg?void 0:G(t,s,n,o)}return i}function zn(t,e,n,r){let i;if(i=r?e.getAttribute("opacity"):getComputedStyle(e).opacity||e.getAttribute("opacity"),i){let l=1;l=i.indexOf("%")!==-1?Math.min(1,Math.max(0,parseFloat(i.substring(0,i.length-1))/100)):Math.min(1,Math.max(0,parseFloat(i))),n*=l}let s=Ce(e);const a=r;let o=a;return a&&a.referenced===e&&(s=a.root,o=a.parentContext),s&&s!==t.sourceSvg?zn(t,s,n,o):n}function xt(t,e,n){const{fillId:r,strokeId:i}=function(s,a){function o(l){const u=a.getAttribute(l);if(u&&u.indexOf("url")!==-1){const h=Mt(u);if(h&&s.idElements[h]instanceof SVGPatternElement)return h}return null}return{fillId:o("fill"),strokeId:o("stroke")}}(t,e);if(r!==null||i!==null){const s=n();s.setAttribute("fill",r!==null?`url(#${r})`:"none"),s.setAttribute("stroke",i!==null?`url(#${i})`:"none");const a=G(t,e,"stroke-width",t.useElementContext);s.setAttribute("stroke-width",a??"0"),J(t,e,s),on(t,r),on(t,i)}}function on(t,e){if(e===null)return;const n=_e(t),r=`#${e}`;if(!n.querySelector(r)){const i=t.sourceSvg.querySelector(r);if(i){if(!t.sketchPatterns)return void n.appendChild(i.cloneNode(!0));const s=function(o,l,u){const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.appendChild(l);const c=Object.assign(Object.assign({},o),{sourceSvg:h,svgSketch:document.createElementNS("http://www.w3.org/2000/svg","svg"),roughConfig:Object.assign(Object.assign({},o.roughConfig),u)});return c.processElement(c,l,null),oe(document.createElementNS("http://www.w3.org/2000/svg","g"),c.svgSketch)}(t,oe(document.createElementNS("http://www.w3.org/2000/svg","g"),i.cloneNode(!0)),{fillStyle:"solid",roughness:.5}),a=i.cloneNode();n.appendChild(oe(a,s))}}}const Si=/^([+-]?(?:\d+|\d*\.\d+(?:[eE][+-]?\d+)?))([a-z]*|%)$/,an={in:96,cm:96/2.54,mm:96/25.4,pt:96/72,pc:16,px:1},Ai=Math.sqrt(2);function Ct(t,e,n,r){const{value:i,unit:s}=ae(n);return function(a){return!!an[a]}(s)?function(a,o){var l;const u=(l=an[o])!==null&&l!==void 0?l:1;return a*u}(i,s):function(a,o,l,u,h){var c;const f=(c=a.viewBox)!==null&&c!==void 0?c:{w:0,h:0};if(h==="%")return function(p,d,{w:g,h:m}={w:0,h:0}){const v=d/100;return p==="x"?v*g:p==="y"?v*m:v*(Math.sqrt(g*g+m*m)/Ai)}(l,u,f);if(h==="vw"||h==="vh"||h==="vmin"||h==="vmax")return function(p,d,{w:g,h:m}={w:0,h:0}){var v,y;const E=p/100,M=(v=window.innerWidth)!==null&&v!==void 0?v:g,O=(y=window.innerHeight)!==null&&y!==void 0?y:m;if(d==="vw")return E*M;if(d==="vh")return E*O;if(d==="vmin")return E*Math.min(M,O);if(d==="vmax")return E*Math.max(M,O);throw new Error(`Not a viewport length unit: ${d}`)}(u,h,f);if(h==="em"||h==="ex"||h==="ch"||h==="rem")return function(p,d,g,m){var v;if(m==="rem"){const O=document.documentElement,_=ae(getComputedStyle(O).fontSize);return g*(_.unit==="px"?_.value:16)}if(m==="ch"){const O=function(_){const C=Ce(_);if(!C)return 1;const R=document.createElementNS("http://www.w3.org/2000/svg","text");R.style.visibility="hidden",R.appendChild(document.createTextNode("0")),C.appendChild(R);const x=R.getBBox();return C.removeChild(R),x.width}(d);return g*O}const y=(v=G(p,d,"font-size",p.useElementContext))!==null&&v!==void 0?v:"16px",E=ae(y),M=E.unit==="px"?E.value:16;if(m==="em")return g*M;if(m==="ex")return g*M*.5;throw new Error(`Not a font relative unit: ${m}`)}(a,o,u,h);throw new Error(`Unsupported relative length unit: ${h}`)}(t,e,r,i,s)}function ae(t){const e=t.match(Si);if(e===null||e.length!==3)throw new Error(`Cannot parse dimension: ${t}`);return{value:parseFloat(e[1]),unit:e[2].toLowerCase()||"px"}}function _t(t){if(!t)return!0;const e=t.matrix;return!e||e.a===1&&e.b===0&&e.c===0&&e.d===1&&e.e===0&&e.f===0}function le(t){if(!t)return!0;const e=t.matrix;return!e||e.a===1&&e.b===0&&e.c===0&&e.d===1}function A(t,e){if(!e)return t;const n=e.matrix;return{x:n.a*t.x+n.c*t.y+n.e,y:n.b*t.x+n.d*t.y+n.f}}function ln(t){return t.transform&&t.transform.baseVal.numberOfItems>0?t.transform.baseVal.consolidate():null}function kt(t,e,n){if(!n)return ln(e);const r=ln(e);if(r){const i=r.matrix,s=n.matrix.multiply(i);return t.sourceSvg.createSVGTransformFromMatrix(s)}return n}function gt(t,e,n){if(e&&e.matrix&&!_t(e)){const r=e.matrix;n.transform.baseVal.numberOfItems>0?n.transform.baseVal.getItem(0).setMatrix(r):n.transform.baseVal.appendItem(e)}}function un(t){var e;let n=t.getAttribute("stop-color");if(!n){const r=(e=t.getAttribute("style"))!==null&&e!==void 0?e:"",i=/stop-color:\s?(.*);?/.exec(r);i&&i.length>1&&(n=i[1])}return w(n||"white")}function hn(t){const e=t.length;let n=0,r=0,i=0,s=0;return t.forEach(a=>{const o=a.toRgb();n+=o.r*o.r,r+=o.g*o.g,i+=o.b*o.b,s+=o.a}),w({r:Math.sqrt(n/e),g:Math.sqrt(r/e),b:Math.sqrt(i/e),a:s/e})}function Ei(t){const e=t.getAttribute("offset");return e?e.indexOf("%")?parseFloat(e.substring(0,e.length-1)):100*parseFloat(e):0}function Ci(t,e){if(t.roughConfig.fillStyle==="solid")return{angle:0,gap:0,weight:0};const{width:n,height:r}=e.getBoundingClientRect(),i=n/r,s=Math.sqrt(n*r),{angle:a,gap:o,weight:l}=function(u){const h={angle:{normal:[-30,-50],horizontal:[-30,-50],vertical:[-30,-50]},weight:{normal:[.5,3],small:[.5,3]},gap:{normal:[3,5],small:[3,5]}},c={angle:{normal:[-30,-50],horizontal:[-50,-75],vertical:[-30,-15]},weight:{normal:[1,3],small:[.5,1.7]},gap:{normal:[2,5],small:[1,3]}};switch(u){default:return c;case"zigzag":case"zigzag-line":return Object.assign(Object.assign({},c),{weight:{normal:[.5,3],small:[.5,2]},gap:{normal:[2,6],small:[2,5]}});case"cross-hatch":return Object.assign(Object.assign({},c),{weight:{normal:[1,3],small:[.5,1.3]},gap:{normal:[4,8],small:[2,5]}});case"dots":return h}}(t.roughConfig.fillStyle);return{angle:_i(t,a,i),gap:Ti(t,o,s),weight:Oi(t,l,s)}}function _i({rng:t},{normal:e,horizontal:n,vertical:r},i){if(isFinite(i)){if(i<.25)return t.next(n);if(i>6)return t.next(r)}return t.next(e)}function Ti({rng:t},{normal:e,small:n},r){return r<45?t.next(n):t.next(e)}function Oi({rng:t},{normal:e,small:n},r){return r<45?t.next(n):t.next(e)}function ot(t,e,n){var r;const i=(r=t.roughConfig.fixedDecimalPlaceDigits)!==null&&r!==void 0?r:15,s=Object.assign({},t.roughConfig);let a=1;if(!_t(n)){const g=n.matrix,m=g.a*g.d-g.c*g.b;a=Math.sqrt(Math.abs(m))}const o=zn(t,e,1,t.useElementContext),l=G(t,e,"fill",t.useElementContext)||"black",u=o*cn(e,"fill-opacity");if(l.indexOf("url")!==-1){const g=fn(t,l,u);g!=="none"?s.fill=g:delete s.fill}else if(l==="none")delete s.fill;else{const g=w(l);g.setAlpha(u),s.fill=g.toString()}const h=G(t,e,"stroke",t.useElementContext),c=o*cn(e,"stroke-opacity");if(h)if(h.indexOf("url")!==-1)s.stroke=fn(t,h,c);else if(h==="none")s.stroke="none";else{const g=w(h);g.setAlpha(c),s.stroke=g.toString()}else s.stroke="none";const f=G(t,e,"stroke-width",t.useElementContext);if(f){const g=Ct(t,e,f,"stroke-width")*a;s.strokeWidth=parseFloat(g.toFixed(i))}else s.strokeWidth=1;const p=G(t,e,"stroke-dasharray",t.useElementContext);p&&p!=="none"&&(s.strokeLineDash=p.split(/[\s,]+/).filter(g=>g.length>0).map(g=>{const m=Ct(t,e,g,"stroke-dasharray")*a;return Math.max(.5,parseFloat(m.toFixed(i)))}));const d=G(t,e,"stroke-dashoffset",t.useElementContext);if(d){const g=Ct(t,e,d,"stroke-dashoffset")*a;s.strokeLineDashOffset=parseFloat(g.toFixed(i))}if(s.fill&&s.stroke==="none"&&(s.stroke=s.fill,s.strokeWidth=1),t.randomize){const{angle:g,gap:m,weight:v}=Ci(t,e);s.hachureAngle=g,s.hachureGap=Math.round(m),s.fillWeight=parseFloat(v.toFixed(i)),s.disableMultiStroke===void 0&&(s.disableMultiStroke=t.rng.next()>.3)}return s}function cn(t,e){const n=getComputedStyle(t)[e]||t.getAttribute(e);return n?n.indexOf("%")!==-1?Math.min(1,Math.max(0,parseFloat(n.substring(0,n.length-1))/100)):Math.min(1,Math.max(0,parseFloat(n))):1}function fn(t,e,n){const r=Mt(e);if(!r)return"none";const i=t.idElements[r];if(!i)return"none";if(typeof i=="string")return i;if(i instanceof SVGLinearGradientElement||i instanceof SVGRadialGradientElement){const s=function(a,o){const l=Array.prototype.slice.apply(a.querySelectorAll("stop"));if(l.length===0)return"transparent";if(l.length===1){const u=un(l[0]);return u.setAlpha(o),u.toString()}{const h=[];let c=null;for(let p=0;p<l.length;p++){const d=un(l[p]),g=Ei(l[p]),m=c?hn([c,d]):d;let v=Math.max(1,g/10|0);for(;v>0;)h.push(m),v--;c=d}const f=hn(h);return f.setAlpha(o),f.toString()}}(i,n);return t.idElements[r]=s,s}return"none"}function T(t){return`${t.x},${t.y}`}function Ft(t,e,n,r){if(n.length===0)return;const i=n[0],s=n[n.length-1],a=Mt(e.getAttribute("marker-start")),o=a?t.idElements[a]:null;if(o&&n.length>1){let f=o.orientAngle.baseVal.value;const p=n[1],d=o.getAttribute("orient");if(d==="auto"||d==="auto-start-reverse"){const y=d==="auto"?0:180,E=n[n.length-2];pn(n)?f=he(E,s,p)-y:f=Yt({x:1,y:0},{x:p.x-i.x,y:p.y-i.y})-y}const g=t.sourceSvg.createSVGMatrix().translate(i.x,i.y).rotate(f).scale(ue(t,o,e)),m=r?r.matrix.multiply(g):g,v=t.sourceSvg.createSVGTransformFromMatrix(m);t.processElement(t,o,v)}const l=Mt(e.getAttribute("marker-end")),u=l?t.idElements[l]:null;if(u){let f=u.orientAngle.baseVal.value;if(n.length>1){const m=u.getAttribute("orient");if(m==="auto"||m==="auto-start-reverse"){const v=n[n.length-2];pn(n)?f=he(v,s,n[1]):f=Yt({x:1,y:0},{x:s.x-v.x,y:s.y-v.y})}}const p=t.sourceSvg.createSVGMatrix().translate(s.x,s.y).rotate(f).scale(ue(t,u,e)),d=r?r.matrix.multiply(p):p,g=t.sourceSvg.createSVGTransformFromMatrix(d);t.processElement(t,u,g)}const h=Mt(e.getAttribute("marker-mid")),c=h?t.idElements[h]:null;if(c&&n.length>2)for(let f=0;f<n.length;f++){const p=n[f];if(f===0||f===n.length-1)continue;let d=c.orientAngle.baseVal.value;const g=c.getAttribute("orient");(g==="auto"||g==="auto-start-reverse")&&(d=he(n[f-1],p,n[f+1]));const m=t.sourceSvg.createSVGMatrix().translate(p.x,p.y).rotate(d).scale(ue(t,c,e)),v=r?r.matrix.multiply(m):m,y=t.sourceSvg.createSVGTransformFromMatrix(v);t.processElement(t,c,y)}}function ue(t,e,n){const r=e.getAttribute("markerUnits");let i=1;if(!r||r==="strokeWidth"){const s=G(t,n,"stroke-width");s&&(i=Ct(t,n,s,"stroke-width"))}return i}function pn(t){return e=t[0],n=t[t.length-1],e.x===n.x&&e.y===n.y;var e,n}function he(t,e,n){const r={x:n.x-e.x,y:n.y-e.y},i=Yt(r,{x:t.x-e.x,y:t.y-e.y}),s=e.x+1,a=e.y,o=Yt(r,{x:s-e.x,y:a-e.y});return((l=i)-180*Math.sign(l))/2-o;var l}function Yt(t,e){const n=Math.atan2(t.y,t.x),r=Math.atan2(e.y,e.x)-n,i=-Math.sign(r)*Math.PI*2,s=Math.abs(i+r)<Math.abs(r)?i+r:r;return Math.round(360*s/(2*Math.PI))}function dn(t,e,{x:n,y:r,w:i,h:s}){xt(t,e,()=>{const a=document.createElementNS("http://www.w3.org/2000/svg","rect");return a.x.baseVal.value=n,a.y.baseVal.value=r,a.width.baseVal.value=i,a.height.baseVal.value=s,a})}function ki(t,e,n,r){const i=Mt(n);if(!i)return;const s=t.idElements[i];if(!s)return;const a=_e(t),o=`${i}_${a.childElementCount}`,l=document.createElementNS("http://www.w3.org/2000/svg","clipPath");l.id=o,function(c,f){if(c.tagName!=="g")return void c.setAttribute(Ot,f);const p=[],d=mt(c);for(let g=d.length-1;g>=0;g--)p.push(d[g]);for(;p.length>0;){const g=p.pop();g.setAttribute(Ot,f);const m=mt(g);for(let v=m.length-1;v>=0;v--)p.push(m[v])}}(e,o);const u=[],h=mt(s);for(let c=h.length-1;c>=0;c--){const f=h[c],p=kt(t,f,r);u.push({element:f,transform:p})}for(;u.length>0;){const{element:c,transform:f}=u.pop();try{Ni(t,c,l,f)}catch(d){console.error(d)}if(c.tagName==="defs"||c.tagName==="svg"||c.tagName==="clipPath"||c.tagName==="text")continue;const p=mt(c);for(let d=p.length-1;d>=0;d--){const g=p[d],m=kt(t,g,f);u.push({element:g,transform:m})}}l.childNodes.length>0&&a.appendChild(l)}function Ni(t,e,n,r){switch(e.tagName){case"rect":(function(i,s,a,o){const l=s.x.baseVal.value,u=s.y.baseVal.value,h=s.width.baseVal.value,c=s.height.baseVal.value;if(h===0||c===0)return;const f=s.hasAttribute("rx")?s.rx.baseVal.value:null,p=s.hasAttribute("ry")?s.ry.baseVal.value:null,d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.x.baseVal.value=l,d.y.baseVal.value=u,d.width.baseVal.value=h,d.height.baseVal.value=c,f&&(d.rx.baseVal.value=f),p&&(d.ry.baseVal.value=p),gt(0,o,d),a.appendChild(d)})(0,e,n,r);break;case"circle":(function(i,s,a,o){const l=s.cx.baseVal.value,u=s.cy.baseVal.value,h=s.r.baseVal.value;if(h===0)return;const c=document.createElementNS("http://www.w3.org/2000/svg","circle");c.cx.baseVal.value=l,c.cy.baseVal.value=u,c.r.baseVal.value=h,gt(0,o,c),a.appendChild(c)})(0,e,n,r);break;case"ellipse":(function(i,s,a,o){const l=s.cx.baseVal.value,u=s.cy.baseVal.value,h=s.rx.baseVal.value,c=s.ry.baseVal.value;if(h===0||c===0)return;const f=document.createElementNS("http://www.w3.org/2000/svg","ellipse");f.cx.baseVal.value=l,f.cy.baseVal.value=u,f.rx.baseVal.value=h,f.ry.baseVal.value=c,gt(0,o,f),a.appendChild(f)})(0,e,n,r);break;case"polygon":(function(i,s,a,o){const l=document.createElementNS("http://www.w3.org/2000/svg","polygon");l.setAttribute("points",s.getAttribute("points")),gt(0,o,l),a.appendChild(l)})(0,e,n,r);break;case"path":(function(i,s,a,o){const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",s.getAttribute("d")),gt(0,o,l),a.appendChild(l)})(0,e,n,r)}}function Vi(t,e,n){const r=document.createElementNS("http://www.w3.org/2000/svg","g");r.setAttribute("class","text-container"),gt(0,n,r);const i=e.cloneNode(!0);i.transform.baseVal.numberOfItems>0&&i.transform.baseVal.clear(),i.removeAttribute("clip-path");const{cssFont:s,fontSize:a}=function(u,h,c=!1){const f={};let p="";const d=G(u,h,"font-style",u.useElementContext);d&&(p+=c?`font-style: ${d};`:d,f.fontStyle=d);const g=G(u,h,"font-weight",u.useElementContext);g&&(p+=c?`font-weight: ${g};`:` ${g}`,f.fontWeight=g);const m=G(u,h,"font-size",u.useElementContext);if(m&&(p+=c?`font-size: ${m};`:` ${m}`,f.fontSize=m),u.fontFamily)p+=c?`font-family: ${u.fontFamily};`:` ${u.fontFamily}`,f.fontFamiliy=u.fontFamily;else{const v=G(u,h,"font-family",u.useElementContext);v&&(p+=c?`font-family: ${v};`:` ${v}`,f.fontFamiliy=v)}return p=p.trim(),Object.assign(Object.assign({},f),{cssFont:p})}(t,e,!0);if(i.setAttribute("style",function(...u){let h="";u=u.filter(c=>c!==null);for(const c of u)h.length>0&&h[h.length-1]!==";"&&(h+=";"),h+=c;return h}(i.getAttribute("style"),s)),gn(t,e,i),i.childElementCount>0){const u=mt(i),h=mt(e);for(let c=0;c<u.length;c++){const f=u[c];f instanceof SVGTSpanElement&&gn(t,h[c],f)}}r.appendChild(i),J(t,e,r);const o=t.fontFamily!==null,l=i.hasAttribute(Ot);o&&l&&a&&function(u,h,c,f){const{width:p,height:d}=h.getBBox();if(p<=0||d<=0)return;const g=Ct(u,c,f,"font-size");Ln(u,{w:p},c,g)}(t,e,i,a)}function Ln(t,e,n,r){const{w:i}=function({svgSketch:a,svgSketchIsInDOM:o},l){const u="visibility:hidden;position:absolute;left:-100%;top-100%;",h=a.getAttribute("style");h?a.setAttribute("style",`${h};${u}`):a.setAttribute("style",u);const c=document.body,f=a.parentElement;o||c.appendChild(a);const{width:p,height:d}=l.getBBox();return o||(c.removeChild(a),f&&f.appendChild(a)),h?a.setAttribute("style",h):a.removeAttribute("style"),{w:p,h:d}}(t,n);if(i<e.w||r<=1)return;const s=r-1;n.style.fontSize=`${s}px`,Ln(t,e,n,s)}function gn(t,e,n){const r=G(t,e,"stroke"),i=r?G(t,e,"stroke-width"):null,s=G(t,e,"fill"),a=G(t,e,"dominant-baseline"),o=G(t,e,"text-anchor",t.useElementContext);r&&n.setAttribute("stroke",r),i&&n.setAttribute("stroke-width",i),s&&n.setAttribute("fill",s),o&&n.setAttribute("text-anchor",o),a&&n.setAttribute("dominant-baseline",a)}function Dn(t,e,n,r,i){var s,a;const o=[],l={x:0,y:0,w:r??0,h:i??0};if(e instanceof SVGSVGElement||e instanceof SVGSymbolElement||e instanceof SVGMarkerElement){let u=0,h=0;if(e instanceof SVGSymbolElement)u=parseFloat((s=e.getAttribute("x"))!==null&&s!==void 0?s:"")||0,h=parseFloat((a=e.getAttribute("y"))!==null&&a!==void 0?a:"")||0,r=r??(parseFloat(e.getAttribute("width"))||void 0),i=i??(parseFloat(e.getAttribute("height"))||void 0);else if(e instanceof SVGMarkerElement){const d=e.getAttribute("markerWidth"),g=e.getAttribute("markerHeight");r=d!==null?parseFloat(d):3,i=g!==null?parseFloat(g):3}else e!==t.sourceSvg&&(u=e.x.baseVal.value,h=e.y.baseVal.value);let c=t.sourceSvg.createSVGMatrix();if(e.getAttribute("viewBox")){const{x:d,y:g,width:m,height:v}=e.viewBox.baseVal;if(l.x=d,l.y=g,l.w=m,l.h=v,r!==void 0&&i!==void 0){const y=r/m,E=i/v,M=u+.5*r,O=h+.5*i,_=d+.5*m,C=g+.5*v;c=c.translate(M,O),c=e.getAttribute("preserveAspectRatio")==="none"?c.scaleNonUniform(y,E):c.scale(Math.min(y,E)),c=c.translate(-_,-C)}}else c=c.translate(u,h);e instanceof SVGMarkerElement&&(c=c.translate(-e.refX.baseVal.value,-e.refY.baseVal.value));const f=n?n.matrix.multiply(c):c;n=t.sourceSvg.createSVGTransformFromMatrix(f);const p=mt(e);for(let d=p.length-1;d>=0;d--){const g=p[d];if(g instanceof SVGSymbolElement||g instanceof SVGMarkerElement)continue;const m=kt(t,g,n);o.push({element:g,transform:m,viewBox:l})}}else o.push({element:e,transform:n,viewBox:l});for(;o.length>0;){const{element:u,transform:h,viewBox:c}=o.pop();try{t.viewBox=c,Pi(t,u,h)}catch(p){console.error(p)}if(u.tagName==="defs"||u.tagName==="symbol"||u.tagName==="marker"||u.tagName==="svg"||u.tagName==="clipPath")continue;const f=mt(u);for(let p=f.length-1;p>=0;p--){const d=f[p],g=kt(t,d,h);o.push({element:d,transform:g,viewBox:c})}}}function Pi(t,e,n){if(function(i){const s=i.style;return!!s&&(s.display==="none"||s.visibility==="hidden")}(e))return;const r=e.getAttribute("clip-path");switch(r&&ki(t,e,r,n),e.tagName){case"svg":case"symbol":(function(i,s,a){let o=parseFloat(s.getAttribute("width")),l=parseFloat(s.getAttribute("height"));(isNaN(o)||isNaN(l))&&(o=l=void 0),Dn(i,s,a,o,l)})(t,e,n);break;case"rect":(function(i,s,a){const o=s.x.baseVal.value,l=s.y.baseVal.value,u=s.width.baseVal.value,h=s.height.baseVal.value;if(u===0||h===0)return;let c=s.hasAttribute("rx")?Math.min(Math.max(0,s.rx.baseVal.value),u/2):null,f=s.hasAttribute("ry")?Math.min(Math.max(0,s.ry.baseVal.value),h/2):null;c===null&&f===null||(c=c===null?f:c,f=f===null?c:f);const p=A({x:o,y:l},a),d=A({x:o+u,y:l+h},a),g=d.x-p.x,m=d.y-p.y,v={x:p.x,y:p.y,w:g,h:m};if(!_t(a)&&!le(a)||c||f){let y="";if(c!==null&&f!==null){const M=1.3333333333333333*(Math.sqrt(2)-1),O=A({x:o+c,y:l},a);y+=`M ${T(O)}`,y+=`L ${T(A({x:o+u-c,y:l},a))}`;const _=A({x:o+u-c+M*c,y:l},a),C=A({x:o+u,y:l+M*f},a),R=A({x:o+u,y:l+f},a);y+=`C ${T(_)} ${T(C)} ${T(R)}`,y+=`L ${T(A({x:o+u,y:l+h-f},a))}`;const x=A({x:o+u,y:l+h-f+M*f},a),I=A({x:o+u-M*c,y:l+h},a),D=A({x:o+u-c,y:l+h},a);y+=`C ${T(x)} ${T(I)} ${T(D)}`,y+=`L ${T(A({x:o+c,y:l+h},a))}`;const k=A({x:o+c-M*c,y:l+h},a),N=A({x:o,y:l+h-M*f},a),V=A({x:o,y:l+h-f},a);y+=`C ${T(k)} ${T(N)} ${T(V)}`,y+=`L ${T(A({x:o,y:l+f},a))}`;const z=A({x:o,y:l+M*f},a),L=A({x:o+M*c,y:l},a);y+=`C ${T(z)} ${T(L)} ${T(O)}`,y+="z"}else{const M=A({x:o,y:l},a),O=A({x:o+u,y:l},a),_=A({x:o+u,y:l+h},a),C=A({x:o,y:l+h},a);y+=`M ${T(M)}`,y+=`L ${T(O)}`,y+=`L ${T(_)}`,y+=`L ${T(C)}`,y+="z"}const E=Zt(i,y,ot(i,s,a));dn(i,s,v),J(i,s,E)}else{const y=i.rc.rectangle(v.x,v.y,v.w,v.h,ot(i,s,a));dn(i,s,v),J(i,s,y)}})(t,e,n);break;case"path":(function(i,s,a){const o=s.getAttribute("d"),l=new b(o).toAbs().transform($.NORMALIZE_HVZ()).transform($.NORMALIZE_ST()),u=new b(l.commands.map(d=>Object.assign({},d)));a&&u.transform($.MATRIX(a.matrix.a,a.matrix.b,a.matrix.c,a.matrix.d,a.matrix.e,a.matrix.f));const h=Rn(u.commands);if(h.indexOf("undefined")!==-1)return void console.error("broken path data");const c=Zt(i,h,ot(i,s,a));xt(i,s,()=>{const d=document.createElementNS("http://www.w3.org/2000/svg","path");return d.setAttribute("d",h),d}),J(i,s,c);const f=[];let p;l.commands.forEach(d=>{switch(d.type){case b.MOVE_TO:{const g={x:d.x,y:d.y};f.push(g),p=g;break}case b.LINE_TO:case b.QUAD_TO:case b.SMOOTH_QUAD_TO:case b.CURVE_TO:case b.SMOOTH_CURVE_TO:case b.ARC:f.push({x:d.x,y:d.y});break;case b.HORIZ_LINE_TO:f.push({x:d.x,y:0});break;case b.VERT_LINE_TO:f.push({x:0,y:d.y});break;case b.CLOSE_PATH:p&&f.push(p)}}),Ft(i,s,f,a)})(t,e,n);break;case"use":(function(i,s,a){let o=s.href.baseVal;o.startsWith("#")&&(o=o.substring(1));const l=i.idElements[o];if(l){let u,h;s.getAttribute("width")&&s.getAttribute("height")&&(u=s.width.baseVal.value,h=s.height.baseVal.value);const c=s.x.baseVal.value,f=s.y.baseVal.value;let p=i.sourceSvg.createSVGMatrix().translate(c,f);p=a?a.matrix.multiply(p):p;const d=i.sourceSvg.createSVGTransformFromMatrix(p);if(i.useElementContext){const g={root:s,referenced:l,parentContext:Object.assign({},i.useElementContext)};i.useElementContext=g}else i.useElementContext={root:s,referenced:l,parentContext:null};i.processElement(i,l,kt(i,l,d),u,h),i.useElementContext.parentContext?i.useElementContext=i.useElementContext.parentContext:i.useElementContext=null}})(t,e,n);break;case"line":(function(i,s,a){const o={x:s.x1.baseVal.value,y:s.y1.baseVal.value},l={x:s.x2.baseVal.value,y:s.y2.baseVal.value},{x:u,y:h}=A(o,a),{x:c,y:f}=A(l,a);if(u===c&&h===f)return;const p=i.rc.line(u,h,c,f,ot(i,s,a));xt(i,s,()=>{const d=document.createElementNS("http://www.w3.org/2000/svg","line");return d.x1.baseVal.value=u,d.y1.baseVal.value=h,d.x2.baseVal.value=c,d.y2.baseVal.value=f,d}),J(i,s,p),Ft(i,s,[o,l],a)})(t,e,n);break;case"circle":(function(i,s,a){const o=s.cx.baseVal.value,l=s.cy.baseVal.value,u=s.r.baseVal.value;if(u===0)return;const h=A({x:o,y:l},a),c=A({x:o+u,y:l+u},a).x-h.x;let f;if(_t(a)||le(a))f=i.rc.circle(h.x,h.y,2*c,Object.assign(Object.assign({},ot(i,s,a)),{preserveVertices:!0}));else{const p=1.3333333333333333*(Math.sqrt(2)-1),d=A({x:o+u,y:l},a),g=A({x:o,y:l+u},a),m=A({x:o-u,y:l},a),v=A({x:o,y:l-u},a),y=A({x:o+u,y:l+p*u},a),E=A({x:o+p*u,y:l+u},a),M=A({x:o-u,y:l+p*u},a),O=A({x:o-p*u,y:l-u},a),_=A({x:o+u,y:l-p*u},a);f=Zt(i,`M ${T(d)} C ${T(y)} ${T(E)} ${T(g)} S ${T(M)} ${T(m)} S ${T(O)} ${T(v)} S ${T(_)} ${T(d)}z`,ot(i,s,a))}xt(i,s,()=>{const p=document.createElementNS("http://www.w3.org/2000/svg","circle");return p.cx.baseVal.value=h.x,p.cy.baseVal.value=h.y,p.r.baseVal.value=c,p}),J(i,s,f)})(t,e,n);break;case"ellipse":(function(i,s,a){const o=s.cx.baseVal.value,l=s.cy.baseVal.value,u=s.rx.baseVal.value,h=s.ry.baseVal.value;if(u===0||h===0)return;const c=A({x:o,y:l},a),f=A({x:o+u,y:l+h},a),p=f.x-c.x,d=f.y-c.y;let g;if(_t(a)||le(a))g=i.rc.ellipse(c.x,c.y,2*p,2*d,Object.assign(Object.assign({},ot(i,s,a)),{preserveVertices:!0}));else{const m=1.3333333333333333*(Math.sqrt(2)-1),v=A({x:o+u,y:l},a),y=A({x:o,y:l+h},a),E=A({x:o-u,y:l},a),M=A({x:o,y:l-h},a),O=A({x:o+u,y:l+m*h},a),_=A({x:o+m*u,y:l+h},a),C=A({x:o-u,y:l+m*h},a),R=A({x:o-m*u,y:l-h},a),x=A({x:o+u,y:l-m*h},a);g=Zt(i,`M ${T(v)} C ${T(O)} ${T(_)} ${T(y)} S ${T(C)} ${T(E)} S ${T(R)} ${T(M)} S ${T(x)} ${T(v)}z`,ot(i,s,a))}xt(i,s,()=>{const m=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return m.cx.baseVal.value=c.x,m.cy.baseVal.value=c.y,m.rx.baseVal.value=p,m.ry.baseVal.value=d,m}),J(i,s,g)})(t,e,n);break;case"polyline":(function(i,s,a){const o=sn(s),l=o.map(h=>{const c=A(h,a);return[c.x,c.y]}),u=ot(i,s,a);if(xt(i,s,()=>{const h=document.createElementNS("http://www.w3.org/2000/svg","polyline");return h.setAttribute("points",l.join(" ")),h}),u.fill&&u.fill!=="none"){const h=Object.assign(Object.assign({},u),{stroke:"none"});J(i,s,i.rc.polygon(l,h))}J(i,s,i.rc.linearPath(l,u)),Ft(i,s,o,a)})(t,e,n);break;case"polygon":(function(i,s,a){const o=sn(s),l=o.map(h=>{const c=A(h,a);return[c.x,c.y]}),u=i.rc.polygon(l,ot(i,s,a));xt(i,s,()=>{const h=document.createElementNS("http://www.w3.org/2000/svg","polygon");return h.setAttribute("points",l.join(" ")),h}),J(i,s,u),o.length>0&&(o.push(o[0]),Ft(i,s,o,a))})(t,e,n);break;case"text":Vi(t,e,n);break;case"image":(function(i,s,a){const o=s.href.baseVal,l=s.x.baseVal.value,u=s.y.baseVal.value;let h,c;if(s.getAttribute("width")&&s.getAttribute("height")&&(h=s.width.baseVal.value,c=s.height.baseVal.value),o.startsWith("data:")&&o.indexOf("image/svg+xml")!==-1){const f=/^data:([^,]*),(.*)/.exec(o);if(f&&f.length>2){const p=f[1];let d=f[2];const g=p.indexOf("base64")!==-1,m=p.indexOf("utf8")!==-1;g&&(d=atob(d)),m||(d=decodeURIComponent(d));const v=new DOMParser().parseFromString(d,"image/svg+xml").firstChild;let y=i.sourceSvg.createSVGMatrix().translate(l,u);y=a?a.matrix.multiply(y):y,i.processElement(i,v,i.sourceSvg.createSVGTransformFromMatrix(y),h,c)}}else{const f=s.cloneNode(),p=document.createElementNS("http://www.w3.org/2000/svg","g");gt(0,a,p),p.appendChild(f),J(i,s,p)}})(t,e,n);break;case"foreignObject":(function(i,s,a){const o=s.cloneNode(!0),l=document.createElementNS("http://www.w3.org/2000/svg","g"),u=["color","font-family","font-size","font-style","font-variant","font-weight"],h=getComputedStyle(s);for(const c of u)l.style.setProperty(c,h.getPropertyValue(c));o.transform.baseVal.clear(),gt(0,a,l),l.appendChild(o),J(i,o,l)})(t,e,n)}}class Ri{constructor(e){this.rng=e?new Mn(e):null}next(e){var n,r;const i=(r=(n=this.rng)===null||n===void 0?void 0:n.next())!==null&&r!==void 0?r:Math.random();if(e){const s=e[0];return i*(e[1]-s)+s}return i}}class Ii{set svg(e){this.$svg!==e&&(this.$svg=e,this.sourceSvgChanged())}get svg(){return this.$svg}set outputType(e){if(this.$outputType!==e){if(e===dt.CANVAS&&this.outputElement instanceof SVGSVGElement||e===dt.SVG&&this.outputElement instanceof HTMLCanvasElement)throw new Error(`Output format ${e} incompatible with given output element ${this.outputElement.tagName}`);this.$outputType=e}}get outputType(){return this.$outputType}set roughConfig(e){e.fixedDecimalPlaceDigits===void 0&&(e.fixedDecimalPlaceDigits=3),this.$roughConfig=e}get roughConfig(){return this.$roughConfig}constructor(e,n=dt.SVG,r={}){if(this.backgroundColor=null,this.fontFamily="Comic Sans MS, cursive",this.randomize=!0,this.seed=null,this.sketchPatterns=!0,this.pencilFilter=!1,this.width=0,this.height=0,this.$roughConfig={},this.idElements={},this.lastResult=null,!e)throw new Error("No target provided");const i=typeof e=="string"?document.querySelector(e):e;if(!i)throw new Error("Could not find target in document");this.roughConfig=r,this.outputElement=i,i instanceof HTMLCanvasElement?this.$outputType=dt.CANVAS:i instanceof SVGSVGElement?this.$outputType=dt.SVG:this.$outputType=n}sketch(e=!1){var n,r;if(!this.svg)return Promise.resolve(null);e&&this.sourceSvgChanged();const i=this.prepareRenderContainer(),s=this.createRenderContext(i);if(this.pencilFilter&&_e(s).appendChild(function(){const a=document.createElementNS("http://www.w3.org/2000/svg","filter");a.setAttribute("id","pencilTextureFilter"),a.setAttribute("x","0%"),a.setAttribute("y","0%"),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("filterUnits","objectBoundingBox");const o=document.createElementNS("http://www.w3.org/2000/svg","feTurbulence");o.setAttribute("type","fractalNoise"),o.setAttribute("baseFrequency","2"),o.setAttribute("numOctaves","5"),o.setAttribute("stitchTiles","stitch"),o.setAttribute("result","f1"),a.appendChild(o);const l=document.createElementNS("http://www.w3.org/2000/svg","feColorMatrix");l.setAttribute("type","matrix"),l.setAttribute("values","0 0 0 0 0, 0 0 0 0 0, 0 0 0 0 0, 0 0 0 -1.5 1.5"),l.setAttribute("result","f2"),a.appendChild(l);const u=document.createElementNS("http://www.w3.org/2000/svg","feComposite");return u.setAttribute("operator","in"),u.setAttribute("in","SourceGraphic"),u.setAttribute("in2","f2"),u.setAttribute("result","f3"),a.appendChild(u),a}()),s.processElement(s,this.svg,null,this.width,this.height),this.outputElement instanceof SVGSVGElement)return Promise.resolve(this.outputElement);if(this.outputElement instanceof HTMLCanvasElement)return this.drawToCanvas(s,this.outputElement);if((r=(n=this.lastResult)===null||n===void 0?void 0:n.parentNode)===null||r===void 0||r.removeChild(this.lastResult),this.outputType===dt.SVG){const a=s.svgSketch;return this.outputElement.appendChild(a),this.lastResult=a,Promise.resolve(a)}{const a=document.createElement("canvas");return this.outputElement.appendChild(a),this.lastResult=a,this.drawToCanvas(s,a)}}createRenderContext(e){if(!this.svg)throw new Error("No source SVG set yet.");let n=this.roughConfig;return this.seed!==null&&(n=Object.assign({seed:this.seed},n)),{rc:jr.svg(e,{options:n}),roughConfig:this.roughConfig,fontFamily:this.fontFamily,pencilFilter:this.pencilFilter,randomize:this.randomize,rng:new Ri(this.seed),sketchPatterns:this.sketchPatterns,idElements:this.idElements,sourceSvg:this.svg,svgSketch:e,svgSketchIsInDOM:document.body.contains(e),styleSheets:Array.from(this.svg.querySelectorAll("style")).map(r=>r.sheet).filter(r=>r!==null),processElement:Dn}}drawToCanvas(e,n){n.width=this.width,n.height=this.height;const r=n.getContext("2d");return r.clearRect(0,0,this.width,this.height),new Promise(i=>{const s=new XMLSerializer().serializeToString(e.svgSketch),a=new Image;a.onload=function(){r.drawImage(this,0,0),i(n)},a.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(s)}`})}prepareRenderContainer(){let e,n;for(e=this.outputElement instanceof SVGSVGElement?this.outputElement:document.createElementNS("http://www.w3.org/2000/svg","svg"),e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");e.firstChild;)e.removeChild(e.firstChild);return e.setAttribute("width",this.width.toString()),e.setAttribute("height",this.height.toString()),this.backgroundColor&&(n=document.createElementNS("http://www.w3.org/2000/svg","rect"),n.width.baseVal.value=this.width,n.height.baseVal.value=this.height,n.setAttribute("fill",this.backgroundColor),e.appendChild(n)),e.setAttribute("stroke-linecap","round"),e}sourceSvgChanged(){const e=this.$svg;if(e){const n=this.roughConfig.fixedDecimalPlaceDigits;this.width=parseFloat(this.coerceSize(e,"width",300).toFixed(n)),this.height=parseFloat(this.coerceSize(e,"height",150).toFixed(n)),this.collectElementsWithID()}}collectElementsWithID(){this.idElements={};const e=Array.prototype.slice.apply(this.svg.querySelectorAll("*[id]"));for(const n of e){const r=n.getAttribute("id");r&&(this.idElements[r]=n)}}coerceSize(e,n,r){let i=r;const s=e.hasAttribute("viewBox");return e.hasAttribute(n)?i=e[n].baseVal.unitType===SVGLength.SVG_LENGTHTYPE_PERCENTAGE&&s?e.viewBox.baseVal[n]:e[n].baseVal.value:s&&(i=e.viewBox.baseVal[n]),i}}var zi=we('Press <i class="fas fa-sync"></i> (Sync button) or <kbd></kbd> to sync.',1),Li=we('<div class="absolute z-10 w-full bg-base-100 bg-opacity-80 p-2 text-left font-mono text-yellow-600" id="errorContainer">Diagram out of sync. <br> <!></div>'),Di=we('<!> <div id="view"><div id="container" class="h-full overflow-auto"></div></div>',1);function ji(t,e){Hn(e,!0);const[n,r]=Wn(),i=()=>Ve(ce,"$stateStore",n),s=()=>Ve(ee,"$inputStateStore",n);let a="",o="",l=Pt(void 0),u,h=Pt(void 0),c=Pt(!1),f=Pt(!1),p=!0,d=i().panZoom,g;const m=()=>{if(!g)return;const x=g.getPan(),I=g.getZoom();Kn({pan:x,zoom:I}),Jn("panZoom")},v=(x,I)=>{x.panZoom&&(g==null||g.destroy(),g=void 0,Promise.resolve().then(()=>{g=vr(I,{onPan:m,onZoom:m,controlIconsEnabled:!0,fit:!0,center:!0});const{pan:D,zoom:k}=x;D!==void 0&&k!==void 0&&Number.isFinite(k)&&(g.zoom(k),g.pan(D))}))},y=async x=>{var N,V,z;const I=Date.now();if(x.error!==void 0){ut(c,!0);return}ut(c,!1);let D;try{if(tt(l)&&x&&(x.updateDiagram||x.autoSync)){if(x.autoSync||Re(ee,Rt(s).updateDiagram=!1,Rt(s)),ut(f,!1),p=!0,a===x.code&&o===x.mermaid&&d===x.panZoom&&u===x.rough)return;if(!lr()){ut(f,!0);return}a=x.code,o=x.mermaid,d=x.panZoom,u=x.rough;const L=(V=(N=tt(h))==null?void 0:N.parentElement)==null?void 0:V.scrollTop;delete tt(l).dataset.processed;const q=er("graph-"),{svg:W,bindFunctions:H,diagramType:Z}=await Yn(JSON.parse(x.mermaid),a,q);if(D=Z,W.length>0){tt(l).innerHTML=W;let U=document.querySelector(`#${q}`);if(!U)throw new Error("graph-div not found");if(x.rough){const lt=new Ii("#container");lt.svg=U,await lt.sketch(),U.remove();const j=document.querySelector("#container > svg");if(!j)throw new Error("sketch not found");const Vt=j.getAttribute("height"),Jt=j.getAttribute("width");j.setAttribute("height","100%"),j.setAttribute("width","100%"),j.setAttribute("viewBox",`0 0 ${Jt} ${Vt}`),j.style.maxWidth="100%",U=j}else U.setAttribute("height","100%"),U.style.maxWidth="100%",H&&H(U);v(x,U)}(z=tt(h))!=null&&z.parentElement&&L&&(tt(h).parentElement.scrollTop=L),ut(c,!1)}else p?p=!1:(a!==x.code||o!==x.mermaid)&&ut(f,!0)}catch(L){console.error("view fail",L),ut(c,!0)}const k=Date.now()-I;Qn({code:a,renderTime:k,isRough:x.rough,diagramType:D}),ar(k,()=>{Re(ee,Rt(s).updateDiagram=!0,Rt(s))})};$n(()=>{let x=Promise.resolve();ce.subscribe(I=>{x=x.then(()=>y(I).catch(()=>{}))}),window.addEventListener("resize",()=>{i().panZoom&&g&&g.resize()})});var E=Di(),M=Oe(E);{var O=x=>{var I=Li(),D=te(ke(I),3);{var k=V=>{var z=qn("It will be updated automatically.");It(V,z)},N=V=>{var z=zi(),L=te(Oe(z),3);L.textContent=`${tr??""} + Enter`,Gn(),It(V,z)};Pe(D,V=>{i().autoSync?V(k):V(N,!1)})}Ne(I),It(x,I)};Pe(M,x=>{tt(f)&&x(O)})}var _=te(M,2);let C;var R=ke(_);Ie(R,x=>ut(l,x),()=>tt(l)),Ne(_),Ie(_,x=>ut(h,x),()=>tt(h)),Bn(x=>C=ir(_,1,"h-full p-2 svelte-1blxohz",null,C,x),[()=>({error:tt(c),outOfSync:tt(f)})]),It(t,E),Un(),r()}export{ji as V,qi as c,ir as s,Wi as w};