Files
mermaid-live-editor/_app/immutable/chunks/View.nwCiJmi8.js
T
2024-05-23 12:59:17 +00:00

17 lines
126 KiB
JavaScript

import{T as qn,s as Wn,b as yn,e as Mt,h as xn,c as St,d as Rt,g as Z,u as gt,U as Et,j as $,k as pe,n as Ne,m as Ve,o as $n,V as Pe,w as Re,t as pt,p as jt,f as dt,W as jn,l as Xn}from"./scheduler.B5J7bj06.js";import{S as Yn,i as Qn}from"./index.B4UWfYdz.js";import{az as Kn,aA as de,ak as Ie,al as Jn,aB as re,aC as tr,aD as er,aE as ze,aF as nr,a as rr}from"./state.CO68XadW.js";function Le(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}let It=!0,wn,Gt,qt;const sr=1e3,ir=150,Mn=Kn(()=>{It=!0,wn()},sr),or=(t,e)=>{qt==null||qt();const{autoSync:n}=qn(de);if(!n)return;wn=e;const r=t>ir;It||Mn(),It=!r},ar=()=>(Gt||(Gt=new Promise(t=>{qt=()=>{Gt=void 0,t()}})),It||Mn(),It),Gs=()=>Gt??Promise.resolve();var lr=function(){var t="",e,n,r,s=[],i={passive:!0};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 a(f,d){var m=function(g){!g&&(g=window.event);var v={originalEvent:g,target:g.target||g.srcElement,type:"wheel",deltaMode:g.type=="MozMousePixelScroll"?0:1,deltaX:0,delatZ:0,preventDefault:function(){g.preventDefault?g.preventDefault():g.returnValue=!1}};return r=="mousewheel"?(v.deltaY=-.025*g.wheelDelta,g.wheelDeltaX&&(v.deltaX=-.025*g.wheelDeltaX)):v.deltaY=g.detail,d(v)};return s.push({element:f,fn:m}),m}function o(f){for(var d=0;d<s.length;d++)if(s[d].element===f)return s[d].fn;return function(){}}function l(f){for(var d=0;d<s.length;d++)if(s[d].element===f)return s.splice(d,1)}function u(f,d,m,g){var v;r==="wheel"?v=m:v=a(f,m),f[e](t+d,v,g?i:!1)}function h(f,d,m,g){var v;r==="wheel"?v=m:v=o(f),f[n](t+d,v,g?i:!1),l(f)}function c(f,d,m){u(f,r,d,m),r=="DOMMouseScroll"&&u(f,"MozMousePixelScroll",d,m)}function p(f,d,m){h(f,r,d,m),r=="DOMMouseScroll"&&h(f,"MozMousePixelScroll",d,m)}return{on:c,off:p}}(),Ae={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,s,i,a,o=null,l=0;n||(n={});var u=function(){l=n.leading===!1?0:r.now(),o=null,a=t.apply(s,i),o||(s=i=null)};return function(){var h=r.now();!l&&n.leading===!1&&(l=h);var c=e-(h-l);return s=this,i=arguments,c<=0||c>e?(clearTimeout(o),o=null,l=h,a=t.apply(s,i),o||(s=i=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 se=Ae,Sn="unknown";document.documentMode&&(Sn="ie");var Ee={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(se.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 s="viewport-"+new Date().toISOString().replace(/\D/g,"");n=document.createElementNS(this.svgNS,"g"),n.setAttribute("id",s);var i=t.childNodes||t.children;if(i&&i.length>0)for(var a=i.length;a>0;a--)i[i.length-a].nodeName!=="defs"&&n.appendChild(i[i.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:se.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)}},Ie?Ie.internetExplorerRedisplayInterval:null),setCTM:function(t,e,n){var r=this,s="matrix("+e.a+","+e.b+","+e.c+","+e.d+","+e.e+","+e.f+")";t.setAttributeNS(null,"transform",s),"transform"in t.style?t.style.transform=s:"-ms-transform"in t.style?t.style["-ms-transform"]=s:"-webkit-transform"in t.style&&(t.style["-webkit-transform"]=s),Sn==="ie"&&n&&(n.parentNode.insertBefore(n,n),window.setTimeout(function(){r.refreshDefsGlobal()},r.internetExplorerRedisplayInterval))},getEventPoint:function(t,e){var n=e.createSVGPoint();return se.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}},X=Ee,ur={enable:function(t){var e=t.svg.querySelector("defs");e||(e=document.createElementNS(X.svgNS,"defs"),t.svg.appendChild(e));var n=e.querySelector("style#svg-pan-zoom-controls-styles");if(!n){var r=document.createElementNS(X.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 s=document.createElementNS(X.svgNS,"g");s.setAttribute("id","svg-pan-zoom-controls"),s.setAttribute("transform","translate("+(t.width-70)+" "+(t.height-76)+") scale(0.75)"),s.setAttribute("class","svg-pan-zoom-control"),s.appendChild(this._createZoomIn(t)),s.appendChild(this._createZoomReset(t)),s.appendChild(this._createZoomOut(t)),t.svg.appendChild(s),t.controlIcons=s},_createZoomIn:function(t){var e=document.createElementNS(X.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(X.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(X.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(X.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(X.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(X.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 s=document.createElementNS(X.svgNS,"path");return s.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"),s.setAttribute("class","svg-pan-zoom-control-element"),e.appendChild(s),e},_createZoomOut:function(t){var e=document.createElementNS(X.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(X.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(X.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)}},hr=Ee,bt=Ae,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=bt.proxy(this.updateCTM,this),this.requestAnimationFrame=bt.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 bt.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 bt.extend({},this.originalState)};B.prototype.getState=function(){return bt.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}),s=!1,i=!1;r===!1?(t.e=this.getPan().x,t.f=this.getPan().y,s=i=!0):bt.isObject(r)&&(r.x===!1?(t.e=this.getPan().x,s=!0):bt.isNumber(r.x)&&(t.e=r.x),r.y===!1?(t.f=this.getPan().y,i=!0):bt.isNumber(r.y)&&(t.f=r.y)),s&&i||!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();hr.setCTM(this.viewport,t,this.defs),this.pendingUpdate=!1,this.options.onUpdatedCTM&&this.options.onUpdatedCTM(t)};var cr=function(t,e){return new B(t,e)},An=lr,me=ur,rt=Ae,at=Ee,fr=cr,V=function(t,e){this.init(t,e)},pr={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},En={passive:!0};V.prototype.init=function(t,e){var n=this;this.svg=t,this.defs=t.querySelector("defs"),at.setupSvgAttributes(this.svg),this.options=rt.extend(rt.extend({},pr),e),this.state="none";var r=at.getBoundingClientRectNormalized(t);this.width=r.width,this.height=r.height,this.viewport=fr(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(i,a){if(n.viewport&&n.options.beforeZoom)return n.options.beforeZoom(i,a)},onZoom:function(i){if(n.viewport&&n.options.onZoom)return n.options.onZoom(i)},beforePan:function(i,a){if(n.viewport&&n.options.beforePan)return n.options.beforePan(i,a)},onPan:function(i){if(n.viewport&&n.options.onPan)return n.options.onPan(i)},onUpdatedCTM:function(i){if(n.viewport&&n.options.onUpdatedCTM)return n.options.onUpdatedCTM(i)}});var s=this.getPublicInstance();s.setBeforeZoom(this.options.beforeZoom),s.setOnZoom(this.options.onZoom),s.setBeforePan(this.options.beforePan),s.setOnPan(this.options.onPan),s.setOnUpdatedCTM(this.options.onUpdatedCTM),this.options.controlIconsEnabled&&me.enable(this),this.lastMouseWheelEventTime=Date.now(),this.setupHandlers()};V.prototype.setupHandlers=function(){var t=this,e=null;if(this.eventListeners={mousedown:function(i){var a=t.handleMouseDown(i,e);return e=i,a},touchstart:function(i){var a=t.handleMouseDown(i,e);return e=i,a},mouseup:function(i){return t.handleMouseUp(i)},touchend:function(i){return t.handleMouseUp(i)},mousemove:function(i){return t.handleMouseMove(i)},touchmove:function(i){return t.handleMouseMove(i)},mouseleave:function(i){return t.handleMouseUp(i)},touchleave:function(i){return t.handleMouseUp(i)},touchcancel:function(i){return t.handleMouseUp(i)}},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 s in this.eventListeners)(this.options.eventsListenerElement||this.svg).addEventListener(s,this.eventListeners[s],this.options.preventMouseEventsDefault?!1:En);this.options.mouseWheelZoomEnabled&&(this.options.mouseWheelZoomEnabled=!1,this.enableMouseWheelZoom())};V.prototype.enableMouseWheelZoom=function(){if(!this.options.mouseWheelZoomEnabled){var t=this;this.wheelListener=function(n){return t.handleMouseWheel(n)};var e=!this.options.preventMouseEventsDefault;An.on(this.options.eventsListenerElement||this.svg,this.wheelListener,e),this.options.mouseWheelZoomEnabled=!0}};V.prototype.disableMouseWheelZoom=function(){if(this.options.mouseWheelZoomEnabled){var t=!this.options.preventMouseEventsDefault;An.off(this.options.eventsListenerElement||this.svg,this.wheelListener,t),this.options.mouseWheelZoomEnabled=!1}};V.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 s=this.svg.getScreenCTM().inverse(),i=at.getEventPoint(t,this.svg).matrixTransform(s),a=Math.pow(1+this.options.zoomScaleSensitivity,-1*e);this.zoomAtPoint(a,i)}};V.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 s=this.viewport.getCTM(),i=e.matrixTransform(s.inverse()),a=this.svg.createSVGMatrix().translate(i.x,i.y).scale(t).translate(-i.x,-i.y),o=s.multiply(a);o.a!==s.a&&this.viewport.setCTM(o)};V.prototype.zoom=function(t,e){this.zoomAtPoint(t,at.getSvgCenterPoint(this.svg,this.width,this.height),e)};V.prototype.publicZoom=function(t,e){e&&(t=this.computeFromRelativeZoom(t)),this.zoom(t,e)};V.prototype.publicZoomAtPoint=function(t,e,n){if(n&&(t=this.computeFromRelativeZoom(t)),rt.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)};V.prototype.getZoom=function(){return this.viewport.getZoom()};V.prototype.getRelativeZoom=function(){return this.viewport.getRelativeZoom()};V.prototype.computeFromRelativeZoom=function(t){return t*this.viewport.getOriginalState().zoom};V.prototype.resetZoom=function(){var t=this.viewport.getOriginalState();this.zoom(t.zoom,!0)};V.prototype.resetPan=function(){this.pan(this.viewport.getOriginalState())};V.prototype.reset=function(){this.resetZoom(),this.resetPan()};V.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)};V.prototype.handleMouseDown=function(t,e){this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),rt.mouseAndTouchNormalize(t,this.svg),this.options.dblClickZoomEnabled&&rt.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()))};V.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)}};V.prototype.handleMouseUp=function(t){this.options.preventMouseEventsDefault&&(t.preventDefault?t.preventDefault():t.returnValue=!1),this.state==="pan"&&(this.state="none")};V.prototype.fit=function(){var t=this.viewport.getViewBox(),e=Math.min(this.width/t.width,this.height/t.height);this.zoom(e,!0)};V.prototype.contain=function(){var t=this.viewport.getViewBox(),e=Math.max(this.width/t.width,this.height/t.height);this.zoom(e,!0)};V.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})};V.prototype.updateBBox=function(){this.viewport.simpleViewBoxCache()};V.prototype.pan=function(t){var e=this.viewport.getCTM();e.e=t.x,e.f=t.y,this.viewport.setCTM(e)};V.prototype.panBy=function(t){var e=this.viewport.getCTM();e.e+=t.x,e.f+=t.y,this.viewport.setCTM(e)};V.prototype.getPan=function(){var t=this.viewport.getState();return{x:t.x,y:t.y}};V.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())};V.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:En);this.disableMouseWheelZoom(),this.getPublicInstance().disableControlIcons(),this.reset(),ht=ht.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}};V.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:rt.proxy(e,t.publicInstance),t.pi},setOnPan:function(e){return t.options.onPan=e===null?null:rt.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,me.enable(t)),t.pi},disableControlIcons:function(){return t.options.controlIconsEnabled&&(t.options.controlIconsEnabled=!1,me.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:rt.proxy(e,t.publicInstance),t.pi},setOnZoom:function(e){return t.options.onZoom=e===null?null:rt.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:rt.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 ht=[],dr=function(t,e){var n=rt.getSvg(t);if(n===null)return null;for(var r=ht.length-1;r>=0;r--)if(ht[r].svg===n)return ht[r].instance.getPublicInstance();return ht.push({svg:n,instance:new V(n,e)}),ht[ht.length-1].instance.getPublicInstance()},mr=dr;const gr=Jn(mr);function ge(t,e,n){if(t&&t.length){const[r,s]=e,i=Math.PI/180*n,a=Math.cos(i),o=Math.sin(i);for(const l of t){const[u,h]=l;l[0]=(u-r)*a-(h-s)*o+r,l[1]=(u-r)*o+(h-s)*a+s}}}function vr(t,e,n){const r=[];t.forEach(s=>r.push(...s)),ge(r,e,n)}function br(t,e){return t[0]===e[0]&&t[1]===e[1]}function yr(t,e,n,r=1){const s=n,i=Math.max(e,.1),a=t[0]&&t[0][0]&&typeof t[0][0]=="number"?[t]:t,o=[0,0];if(s)for(const u of a)ge(u,o,s);const l=xr(a,i,r);if(s){for(const u of a)ge(u,o,-s);vr(l,o,-s)}return l}function xr(t,e,n){const r=[];for(const u of t){const h=[...u];br(h[0],h[h.length-1])||h.push([h[0][0],h[0][1]]),h.length>2&&r.push(h)}const s=[];e=Math.max(e,.1);const i=[];for(const u of r)for(let h=0;h<u.length-1;h++){const c=u[h],p=u[h+1];if(c[1]!==p[1]){const f=Math.min(c[1],p[1]);i.push({ymin:f,ymax:Math.max(c[1],p[1]),x:f===c[1]?c[0]:p[0],islope:(p[0]-c[0])/(p[1]-c[1])})}}if(i.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)),!i.length)return s;let a=[],o=i[0].ymin,l=0;for(;a.length||i.length;){if(i.length){let u=-1;for(let c=0;c<i.length&&!(i[c].ymin>o);c++)u=c;i.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,p=a[h].edge;s.push([[Math.round(c.x),o],[Math.round(p.x),o]])}o+=n,a.forEach(u=>{u.edge.x=u.edge.x+n*u.edge.islope}),l++}return s}function Dt(t,e){var n;const r=e.hachureAngle+90;let s=e.hachureGap;s<0&&(s=e.strokeWidth*4),s=Math.round(Math.max(s,.1));let i=1;return e.roughness>=1&&(((n=e.randomizer)===null||n===void 0?void 0:n.next())||Math.random())>.7&&(i=s),yr(t,s,r,i||1)}class _e{constructor(e){this.helper=e}fillPolygons(e,n){return this._fillPolygons(e,n)}_fillPolygons(e,n){const r=Dt(e,n);return{type:"fillSketch",ops:this.renderLines(r,n)}}renderLines(e,n){const r=[];for(const s of e)r.push(...this.helper.doubleLineOps(s[0][0],s[0][1],s[1][0],s[1][1],n));return r}}function ee(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 wr extends _e{fillPolygons(e,n){let r=n.hachureGap;r<0&&(r=n.strokeWidth*4),r=Math.max(r,.1);const s=Object.assign({},n,{hachureGap:r}),i=Dt(e,s),a=Math.PI/180*n.hachureAngle,o=[],l=r*.5*Math.cos(a),u=r*.5*Math.sin(a);for(const[c,p]of i)ee([c,p])&&o.push([[c[0]-l,c[1]+u],[...p]],[[c[0]+l,c[1]-u],[...p]]);return{type:"fillSketch",ops:this.renderLines(o,n)}}}class Mr extends _e{fillPolygons(e,n){const r=this._fillPolygons(e,n),s=Object.assign({},n,{hachureAngle:n.hachureAngle+90}),i=this._fillPolygons(e,s);return r.ops=r.ops.concat(i.ops),r}}class Sr{constructor(e){this.helper=e}fillPolygons(e,n){n=Object.assign({},n,{hachureAngle:0});const r=Dt(e,n);return this.dotsOnLines(r,n)}dotsOnLines(e,n){const r=[];let s=n.hachureGap;s<0&&(s=n.strokeWidth*4),s=Math.max(s,.1);let i=n.fillWeight;i<0&&(i=n.strokeWidth/2);const a=s/4;for(const o of e){const l=ee(o),u=l/s,h=Math.ceil(u)-1,c=l-h*s,p=(o[0][0]+o[1][0])/2-s/4,f=Math.min(o[0][1],o[1][1]);for(let d=0;d<h;d++){const m=f+c+d*s,g=p-a+Math.random()*2*a,v=m-a+Math.random()*2*a,x=this.helper.ellipse(g,v,i,i,n);r.push(...x.ops)}}return{type:"fillSketch",ops:r}}}class Ar{constructor(e){this.helper=e}fillPolygons(e,n){const r=Dt(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,s=n.dashGap<0?n.hachureGap<0?n.strokeWidth*4:n.hachureGap:n.dashGap,i=[];return e.forEach(a=>{const o=ee(a),l=Math.floor(o/(r+s)),u=(o+s-l*(r+s))/2;let h=a[0],c=a[1];h[0]>c[0]&&(h=a[1],c=a[0]);const p=Math.atan((c[1]-h[1])/(c[0]-h[0]));for(let f=0;f<l;f++){const d=f*(r+s),m=d+r,g=[h[0]+d*Math.cos(p)+u*Math.cos(p),h[1]+d*Math.sin(p)+u*Math.sin(p)],v=[h[0]+m*Math.cos(p)+u*Math.cos(p),h[1]+m*Math.sin(p)+u*Math.sin(p)];i.push(...this.helper.doubleLineOps(g[0],g[1],v[0],v[1],n))}}),i}}class Er{constructor(e){this.helper=e}fillPolygons(e,n){const r=n.hachureGap<0?n.strokeWidth*4:n.hachureGap,s=n.zigzagOffset<0?r:n.zigzagOffset;n=Object.assign({},n,{hachureGap:r+s});const i=Dt(e,n);return{type:"fillSketch",ops:this.zigzagLines(i,s,n)}}zigzagLines(e,n,r){const s=[];return e.forEach(i=>{const a=ee(i),o=Math.round(a/(2*n));let l=i[0],u=i[1];l[0]>u[0]&&(l=i[1],u=i[0]);const h=Math.atan((u[1]-l[1])/(u[0]-l[0]));for(let c=0;c<o;c++){const p=c*2*n,f=(c+1)*2*n,d=Math.sqrt(2*Math.pow(n,2)),m=[l[0]+p*Math.cos(h),l[1]+p*Math.sin(h)],g=[l[0]+f*Math.cos(h),l[1]+f*Math.sin(h)],v=[m[0]+d*Math.cos(h+Math.PI/4),m[1]+d*Math.sin(h+Math.PI/4)];s.push(...this.helper.doubleLineOps(m[0],m[1],v[0],v[1],r),...this.helper.doubleLineOps(v[0],v[1],g[0],g[1],r))}}),s}}const j={};function _r(t,e){let n=t.fillStyle||"hachure";if(!j[n])switch(n){case"zigzag":j[n]||(j[n]=new wr(e));break;case"cross-hatch":j[n]||(j[n]=new Mr(e));break;case"dots":j[n]||(j[n]=new Sr(e));break;case"dashed":j[n]||(j[n]=new Ar(e));break;case"zigzag-line":j[n]||(j[n]=new Er(e));break;case"hachure":default:n="hachure",j[n]||(j[n]=new _e(e));break}return j[n]}function Cr(){return Math.floor(Math.random()*2**31)}class _n{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}}const kr=0,ve=1,Cn=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 Or(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:kr,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:ve,text:`${parseFloat(RegExp.$1)}`},t=t.substr(RegExp.$1.length);else return[];return e[e.length]={type:Cn,text:""},e}function ie(t,e){return t.type===e}function Ce(t){const e=[],n=Or(t);let r="BOD",s=0,i=n[s];for(;!ie(i,Cn);){let a=0;const o=[];if(r==="BOD")if(i.text==="M"||i.text==="m")s++,a=Zt[i.text],r=i.text;else return Ce("M0,0"+t);else ie(i,ve)?a=Zt[r]:(s++,a=Zt[i.text],r=i.text);if(s+a<n.length){for(let l=s;l<s+a;l++){const u=n[l];if(ie(u,ve))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),s+=a,i=n[s],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 kn(t){let e=0,n=0,r=0,s=0;const i=[];for(const{key:a,data:o}of t)switch(a){case"M":i.push({key:"M",data:[...o]}),[e,n]=o,[r,s]=o;break;case"m":e+=o[0],n+=o[1],i.push({key:"M",data:[e,n]}),r=e,s=n;break;case"L":i.push({key:"L",data:[...o]}),[e,n]=o;break;case"l":e+=o[0],n+=o[1],i.push({key:"L",data:[e,n]});break;case"C":i.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);i.push({key:"C",data:l}),e=l[4],n=l[5];break}case"Q":i.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);i.push({key:"Q",data:l}),e=l[2],n=l[3];break}case"A":i.push({key:"A",data:[...o]}),e=o[5],n=o[6];break;case"a":e+=o[5],n+=o[6],i.push({key:"A",data:[o[0],o[1],o[2],o[3],o[4],e,n]});break;case"H":i.push({key:"H",data:[...o]}),e=o[0];break;case"h":e+=o[0],i.push({key:"H",data:[e]});break;case"V":i.push({key:"V",data:[...o]}),n=o[0];break;case"v":n+=o[0],i.push({key:"V",data:[n]});break;case"S":i.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);i.push({key:"S",data:l}),e=l[2],n=l[3];break}case"T":i.push({key:"T",data:[...o]}),e=o[0],n=o[1];break;case"t":e+=o[0],n+=o[1],i.push({key:"T",data:[e,n]});break;case"Z":case"z":i.push({key:"Z",data:[]}),e=r,n=s;break}return i}function On(t){const e=[];let n="",r=0,s=0,i=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,s]=h,[i,a]=h;break;case"C":e.push({key:"C",data:[...h]}),r=h[4],s=h[5],o=h[2],l=h[3];break;case"L":e.push({key:"L",data:[...h]}),[r,s]=h;break;case"H":r=h[0],e.push({key:"L",data:[r,s]});break;case"V":s=h[0],e.push({key:"L",data:[r,s]});break;case"S":{let c=0,p=0;n==="C"||n==="S"?(c=r+(r-o),p=s+(s-l)):(c=r,p=s),e.push({key:"C",data:[c,p,...h]}),o=h[0],l=h[1],r=h[2],s=h[3];break}case"T":{const[c,p]=h;let f=0,d=0;n==="Q"||n==="T"?(f=r+(r-o),d=s+(s-l)):(f=r,d=s);const m=r+2*(f-r)/3,g=s+2*(d-s)/3,v=c+2*(f-c)/3,x=p+2*(d-p)/3;e.push({key:"C",data:[m,g,v,x,c,p]}),o=f,l=d,r=c,s=p;break}case"Q":{const[c,p,f,d]=h,m=r+2*(c-r)/3,g=s+2*(p-s)/3,v=f+2*(c-f)/3,x=d+2*(p-d)/3;e.push({key:"C",data:[m,g,v,x,f,d]}),o=c,l=p,r=f,s=d;break}case"A":{const c=Math.abs(h[0]),p=Math.abs(h[1]),f=h[2],d=h[3],m=h[4],g=h[5],v=h[6];c===0||p===0?(e.push({key:"C",data:[r,s,g,v,g,v]}),r=g,s=v):(r!==g||s!==v)&&(Tn(r,s,g,v,c,p,f,d,m).forEach(function(_){e.push({key:"C",data:_})}),r=g,s=v);break}case"Z":e.push({key:"Z",data:[]}),r=i,s=a;break}n=u}return e}function Tr(t){return Math.PI*t/180}function Ot(t,e,n){const r=t*Math.cos(n)-e*Math.sin(n),s=t*Math.sin(n)+e*Math.cos(n);return[r,s]}function Tn(t,e,n,r,s,i,a,o,l,u){const h=Tr(a);let c=[],p=0,f=0,d=0,m=0;if(u)[p,f,d,m]=u;else{[t,e]=Ot(t,e,-h),[n,r]=Ot(n,r,-h);const P=(t-n)/2,k=(e-r)/2;let I=P*P/(s*s)+k*k/(i*i);I>1&&(I=Math.sqrt(I),s=I*s,i=I*i);const R=o===l?-1:1,F=s*s,W=i*i,J=F*W-F*k*k-W*P*P,H=F*k*k+W*P*P,D=R*Math.sqrt(Math.abs(J/H));d=D*s*k/i+(t+n)/2,m=D*-i*P/s+(e+r)/2,p=Math.asin(parseFloat(((e-m)/i).toFixed(9))),f=Math.asin(parseFloat(((r-m)/i).toFixed(9))),t<d&&(p=Math.PI-p),n<d&&(f=Math.PI-f),p<0&&(p=Math.PI*2+p),f<0&&(f=Math.PI*2+f),l&&p>f&&(p=p-Math.PI*2),!l&&f>p&&(f=f-Math.PI*2)}let g=f-p;if(Math.abs(g)>Math.PI*120/180){const P=f,k=n,I=r;l&&f>p?f=p+Math.PI*120/180*1:f=p+Math.PI*120/180*-1,n=d+s*Math.cos(f),r=m+i*Math.sin(f),c=Tn(n,r,k,I,s,i,a,0,l,[f,P,d,m])}g=f-p;const v=Math.cos(p),x=Math.sin(p),_=Math.cos(f),M=Math.sin(f),O=Math.tan(g/4),y=4/3*s*O,S=4/3*i*O,T=[t,e],N=[t+y*x,e-S*v],G=[n+y*M,r-S*_],U=[n,r];if(N[0]=2*T[0]-N[0],N[1]=2*T[1]-N[1],u)return[N,G,U].concat(c);{c=[N,G,U].concat(c);const P=[];for(let k=0;k<c.length;k+=3){const I=Ot(c[k][0],c[k][1],h),R=Ot(c[k+1][0],c[k+1][1],h),F=Ot(c[k+2][0],c[k+2][1],h);P.push([I[0],I[1],R[0],R[1],F[0],F[1]])}return P}}const Nr={randOffset:zr,randOffsetWithRange:Lr,ellipse:Rr,doubleLineOps:Dr};function Nn(t,e,n,r,s){return{type:"path",ops:yt(t,e,n,r,s)}}function Wt(t,e,n){const r=(t||[]).length;if(r>2){const s=[];for(let i=0;i<r-1;i++)s.push(...yt(t[i][0],t[i][1],t[i+1][0],t[i+1][1],n));return e&&s.push(...yt(t[r-1][0],t[r-1][1],t[0][0],t[0][1],n)),{type:"path",ops:s}}else if(r===2)return Nn(t[0][0],t[0][1],t[1][0],t[1][1],n);return{type:"path",ops:[]}}function Vr(t,e){return Wt(t,!0,e)}function Pr(t,e,n,r,s){const i=[[t,e],[t+n,e],[t+n,e+r],[t,e+r]];return Vr(i,s)}function Ze(t,e){if(t.length){const r=typeof t[0][0]=="number"?[t]:t,s=Ft(r[0],1*(1+e.roughness*.2),e),i=e.disableMultiStroke?[]:Ft(r[0],1.5*(1+e.roughness*.22),Be(e));for(let a=1;a<r.length;a++){const o=r[a];if(o.length){const l=Ft(o,1*(1+e.roughness*.2),e),u=e.disableMultiStroke?[]:Ft(o,1.5*(1+e.roughness*.22),Be(e));for(const h of l)h.op!=="move"&&s.push(h);for(const h of u)h.op!=="move"&&i.push(h)}}return{type:"path",ops:s.concat(i)}}return{type:"path",ops:[]}}function Rr(t,e,n,r,s){const i=Vn(n,r,s);return be(t,e,s,i).opset}function Vn(t,e,n){const r=Math.sqrt(Math.PI*2*Math.sqrt((Math.pow(t/2,2)+Math.pow(e/2,2))/2)),s=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),i=Math.PI*2/s;let a=Math.abs(t/2),o=Math.abs(e/2);const l=1-n.curveFitting;return a+=A(a*l,n),o+=A(o*l,n),{increment:i,rx:a,ry:o}}function be(t,e,n,r){const[s,i]=Ue(r.increment,t,e,r.rx,r.ry,1,r.increment*Xt(.1,Xt(.4,1,n),n),n);let a=Yt(s,null,n);if(!n.disableMultiStroke&&n.roughness!==0){const[o]=Ue(r.increment,t,e,r.rx,r.ry,1.5,0,n),l=Yt(o,null,n);a=a.concat(l)}return{estimatedPoints:i,opset:{type:"path",ops:a}}}function Fe(t,e,n,r,s,i,a,o,l){const u=t,h=e;let c=Math.abs(n/2),p=Math.abs(r/2);c+=A(c*.01,l),p+=A(p*.01,l);let f=s,d=i;for(;f<0;)f+=Math.PI*2,d+=Math.PI*2;d-f>Math.PI*2&&(f=0,d=Math.PI*2);const m=Math.PI*2/l.curveStepCount,g=Math.min(m/2,(d-f)/2),v=Ge(g,u,h,c,p,f,d,1,l);if(!l.disableMultiStroke){const x=Ge(g,u,h,c,p,f,d,1.5,l);v.push(...x)}return a&&(o?v.push(...yt(u,h,u+c*Math.cos(f),h+p*Math.sin(f),l),...yt(u,h,u+c*Math.cos(d),h+p*Math.sin(d),l)):v.push({op:"lineTo",data:[u,h]},{op:"lineTo",data:[u+c*Math.cos(f),h+p*Math.sin(f)]})),{type:"path",ops:v}}function He(t,e){const n=On(kn(Ce(t))),r=[];let s=[0,0],i=[0,0];for(const{key:a,data:o}of n)switch(a){case"M":{i=[o[0],o[1]],s=[o[0],o[1]];break}case"L":r.push(...yt(i[0],i[1],o[0],o[1],e)),i=[o[0],o[1]];break;case"C":{const[l,u,h,c,p,f]=o;r.push(...Zr(l,u,h,c,p,f,i,e)),i=[p,f];break}case"Z":r.push(...yt(i[0],i[1],s[0],s[1],e)),i=[s[0],s[1]];break}return{type:"path",ops:r}}function oe(t,e){const n=[];for(const r of t)if(r.length){const s=e.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:"move",data:[r[0][0]+A(s,e),r[0][1]+A(s,e)]});for(let a=1;a<i;a++)n.push({op:"lineTo",data:[r[a][0]+A(s,e),r[a][1]+A(s,e)]})}}return{type:"fillPath",ops:n}}function _t(t,e){return _r(e,Nr).fillPolygons(t,e)}function Ir(t,e,n,r,s,i,a){const o=t,l=e;let u=Math.abs(n/2),h=Math.abs(r/2);u+=A(u*.01,a),h+=A(h*.01,a);let c=s,p=i;for(;c<0;)c+=Math.PI*2,p+=Math.PI*2;p-c>Math.PI*2&&(c=0,p=Math.PI*2);const f=(p-c)/a.curveStepCount,d=[];for(let m=c;m<=p;m=m+f)d.push([o+u*Math.cos(m),l+h*Math.sin(m)]);return d.push([o+u*Math.cos(p),l+h*Math.sin(p)]),d.push([o,l]),_t([d],a)}function zr(t,e){return A(t,e)}function Lr(t,e,n){return Xt(t,e,n)}function Dr(t,e,n,r,s){return yt(t,e,n,r,s,!0)}function Be(t){const e=Object.assign({},t);return e.randomizer=void 0,t.seed&&(e.seed=t.seed+1),e}function Pn(t){return t.randomizer||(t.randomizer=new _n(t.seed||0)),t.randomizer.next()}function Xt(t,e,n,r=1){return n.roughness*r*(Pn(n)*(e-t)+t)}function A(t,e,n=1){return Xt(-t,t,e,n)}function yt(t,e,n,r,s,i=!1){const a=i?s.disableMultiStrokeFill:s.disableMultiStroke,o=ye(t,e,n,r,s,!0,!1);if(a)return o;const l=ye(t,e,n,r,s,!0,!0);return o.concat(l)}function ye(t,e,n,r,s,i,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=s.maxRandomnessOffset||0;h*h*100>o&&(h=l/10);const c=h/2,p=.2+Pn(s)*.2;let f=s.bowing*s.maxRandomnessOffset*(r-e)/200,d=s.bowing*s.maxRandomnessOffset*(t-n)/200;f=A(f,s,u),d=A(d,s,u);const m=[],g=()=>A(c,s,u),v=()=>A(h,s,u),x=s.preserveVertices;return a?m.push({op:"move",data:[t+(x?0:g()),e+(x?0:g())]}):m.push({op:"move",data:[t+(x?0:A(h,s,u)),e+(x?0:A(h,s,u))]}),a?m.push({op:"bcurveTo",data:[f+t+(n-t)*p+g(),d+e+(r-e)*p+g(),f+t+2*(n-t)*p+g(),d+e+2*(r-e)*p+g(),n+(x?0:g()),r+(x?0:g())]}):m.push({op:"bcurveTo",data:[f+t+(n-t)*p+v(),d+e+(r-e)*p+v(),f+t+2*(n-t)*p+v(),d+e+2*(r-e)*p+v(),n+(x?0:v()),r+(x?0:v())]}),m}function Ft(t,e,n){if(!t.length)return[];const r=[];r.push([t[0][0]+A(e,n),t[0][1]+A(e,n)]),r.push([t[0][0]+A(e,n),t[0][1]+A(e,n)]);for(let s=1;s<t.length;s++)r.push([t[s][0]+A(e,n),t[s][1]+A(e,n)]),s===t.length-1&&r.push([t[s][0]+A(e,n),t[s][1]+A(e,n)]);return Yt(r,null,n)}function Yt(t,e,n){const r=t.length,s=[];if(r>3){const i=[],a=1-n.curveTightness;s.push({op:"move",data:[t[1][0],t[1][1]]});for(let o=1;o+2<r;o++){const l=t[o];i[0]=[l[0],l[1]],i[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],i[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],i[3]=[t[o+1][0],t[o+1][1]],s.push({op:"bcurveTo",data:[i[1][0],i[1][1],i[2][0],i[2][1],i[3][0],i[3][1]]})}}else r===3?(s.push({op:"move",data:[t[1][0],t[1][1]]}),s.push({op:"bcurveTo",data:[t[1][0],t[1][1],t[2][0],t[2][1],t[2][0],t[2][1]]})):r===2&&s.push(...ye(t[0][0],t[0][1],t[1][0],t[1][1],n,!0,!0));return s}function Ue(t,e,n,r,s,i,a,o){const l=o.roughness===0,u=[],h=[];if(l){t=t/4,h.push([e+r*Math.cos(-t),n+s*Math.sin(-t)]);for(let c=0;c<=Math.PI*2;c=c+t){const p=[e+r*Math.cos(c),n+s*Math.sin(c)];u.push(p),h.push(p)}h.push([e+r*Math.cos(0),n+s*Math.sin(0)]),h.push([e+r*Math.cos(t),n+s*Math.sin(t)])}else{const c=A(.5,o)-Math.PI/2;h.push([A(i,o)+e+.9*r*Math.cos(c-t),A(i,o)+n+.9*s*Math.sin(c-t)]);const p=Math.PI*2+c-.01;for(let f=c;f<p;f=f+t){const d=[A(i,o)+e+r*Math.cos(f),A(i,o)+n+s*Math.sin(f)];u.push(d),h.push(d)}h.push([A(i,o)+e+r*Math.cos(c+Math.PI*2+a*.5),A(i,o)+n+s*Math.sin(c+Math.PI*2+a*.5)]),h.push([A(i,o)+e+.98*r*Math.cos(c+a),A(i,o)+n+.98*s*Math.sin(c+a)]),h.push([A(i,o)+e+.9*r*Math.cos(c+a*.5),A(i,o)+n+.9*s*Math.sin(c+a*.5)])}return[h,u]}function Ge(t,e,n,r,s,i,a,o,l){const u=i+A(.1,l),h=[];h.push([A(o,l)+e+.9*r*Math.cos(u-t),A(o,l)+n+.9*s*Math.sin(u-t)]);for(let c=u;c<=a;c=c+t)h.push([A(o,l)+e+r*Math.cos(c),A(o,l)+n+s*Math.sin(c)]);return h.push([e+r*Math.cos(a),n+s*Math.sin(a)]),h.push([e+r*Math.cos(a),n+s*Math.sin(a)]),Yt(h,null,l)}function Zr(t,e,n,r,s,i,a,o){const l=[],u=[o.maxRandomnessOffset||1,(o.maxRandomnessOffset||1)+.3];let h=[0,0];const c=o.disableMultiStroke?1:2,p=o.preserveVertices;for(let f=0;f<c;f++)f===0?l.push({op:"move",data:[a[0],a[1]]}):l.push({op:"move",data:[a[0]+(p?0:A(u[0],o)),a[1]+(p?0:A(u[0],o))]}),h=p?[s,i]:[s+A(u[f],o),i+A(u[f],o)],l.push({op:"bcurveTo",data:[t+A(u[f],o),e+A(u[f],o),n+A(u[f],o),r+A(u[f],o),h[0],h[1]]});return l}function Tt(t){return[...t]}function qe(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(Tt(t[0]),Tt(t[1]),Tt(t[2]),Tt(t[2]));else{const s=[];s.push(t[0],t[0]);for(let o=1;o<t.length;o++)s.push(t[o]),o===t.length-1&&s.push(t[o]);const i=[],a=1-e;r.push(Tt(s[0]));for(let o=1;o+2<s.length;o++){const l=s[o];i[0]=[l[0],l[1]],i[1]=[l[0]+(a*s[o+1][0]-a*s[o-1][0])/6,l[1]+(a*s[o+1][1]-a*s[o-1][1])/6],i[2]=[s[o+1][0]+(a*s[o][0]-a*s[o+2][0])/6,s[o+1][1]+(a*s[o][1]-a*s[o+2][1])/6],i[3]=[s[o+1][0],s[o+1][1]],r.push(i[1],i[2],i[3])}}return r}function Fr(t,e){return Math.sqrt($t(t,e))}function $t(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function Hr(t,e,n){const r=$t(e,n);if(r===0)return $t(t,e);let s=((t[0]-e[0])*(n[0]-e[0])+(t[1]-e[1])*(n[1]-e[1]))/r;return s=Math.max(0,Math.min(1,s)),$t(t,xt(e,n,s))}function xt(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],s=t[e+2],i=t[e+3];let a=3*r[0]-2*n[0]-i[0];a*=a;let o=3*r[1]-2*n[1]-i[1];o*=o;let l=3*s[0]-2*i[0]-n[0];l*=l;let u=3*s[1]-2*i[1]-n[1];return u*=u,a<l&&(a=l),o<u&&(o=u),a+o}function xe(t,e,n,r){const s=r||[];if(Br(t,e)<n){const i=t[e+0];s.length?Fr(s[s.length-1],i)>1&&s.push(i):s.push(i),s.push(t[e+3])}else{const a=t[e+0],o=t[e+1],l=t[e+2],u=t[e+3],h=xt(a,o,.5),c=xt(o,l,.5),p=xt(l,u,.5),f=xt(h,c,.5),d=xt(c,p,.5),m=xt(f,d,.5);xe([a,h,f,m],0,n,s),xe([m,d,p,u],0,n,s)}return s}function Ur(t,e){return Qt(t,0,t.length,e)}function Qt(t,e,n,r,s){const i=s||[],a=t[e],o=t[n-1];let l=0,u=1;for(let h=e+1;h<n-1;++h){const c=Hr(t[h],a,o);c>l&&(l=c,u=h)}return Math.sqrt(l)>r?(Qt(t,e,u+1,r,i),Qt(t,u,n,r,i)):(i.length||i.push(a),i.push(o)),i}function we(t,e=.15,n){const r=[],s=(t.length-1)/3;for(let i=0;i<s;i++){const a=i*3;xe(t,a,e,r)}return n&&n>0?Qt(r,0,r.length,n):r}function Gr(t,e,n){const r=Ce(t),s=On(kn(r)),i=[];let a=[],o=[0,0],l=[];const u=()=>{l.length>=4&&a.push(...we(l,e)),l=[]},h=()=>{u(),a.length&&(i.push(a),a=[])};for(const{key:p,data:f}of s)switch(p){case"M":h(),o=[f[0],f[1]],a.push(o);break;case"L":u(),a.push([f[0],f[1]]);break;case"C":if(!l.length){const d=a.length?a[a.length-1]:o;l.push([d[0],d[1]])}l.push([f[0],f[1]]),l.push([f[2],f[3]]),l.push([f[4],f[5]]);break;case"Z":u(),a.push([o[0],o[1]]);break}if(h(),!n)return i;const c=[];for(const p of i){const f=Ur(p,n);f.length&&c.push(f)}return c}const Y="none";class Kt{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 Cr()}_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,s,i){const a=this._o(i);return this._d("line",[Nn(e,n,r,s,a)],a)}rectangle(e,n,r,s,i){const a=this._o(i),o=[],l=Pr(e,n,r,s,a);if(a.fill){const u=[[e,n],[e+r,n],[e+r,n+s],[e,n+s]];a.fillStyle==="solid"?o.push(oe([u],a)):o.push(_t([u],a))}return a.stroke!==Y&&o.push(l),this._d("rectangle",o,a)}ellipse(e,n,r,s,i){const a=this._o(i),o=[],l=Vn(r,s,a),u=be(e,n,a,l);if(a.fill)if(a.fillStyle==="solid"){const h=be(e,n,a,l).opset;h.type="fillPath",o.push(h)}else o.push(_t([u.estimatedPoints],a));return a.stroke!==Y&&o.push(u.opset),this._d("ellipse",o,a)}circle(e,n,r,s){const i=this.ellipse(e,n,r,r,s);return i.shape="circle",i}linearPath(e,n){const r=this._o(n);return this._d("linearPath",[Wt(e,!1,r)],r)}arc(e,n,r,s,i,a,o=!1,l){const u=this._o(l),h=[],c=Fe(e,n,r,s,i,a,o,!0,u);if(o&&u.fill)if(u.fillStyle==="solid"){const p=Object.assign({},u);p.disableMultiStroke=!0;const f=Fe(e,n,r,s,i,a,!0,!1,p);f.type="fillPath",h.push(f)}else h.push(Ir(e,n,r,s,i,a,u));return u.stroke!==Y&&h.push(c),this._d("arc",h,u)}curve(e,n){const r=this._o(n),s=[],i=Ze(e,r);if(r.fill&&r.fill!==Y)if(r.fillStyle==="solid"){const a=Ze(e,Object.assign(Object.assign({},r),{disableMultiStroke:!0,roughness:r.roughness?r.roughness+r.fillShapeRoughnessGain:0}));s.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(...we(qe([h[0],h[0],h[1],h[2]]),10,(1+r.roughness)/2)):a.push(...we(qe(h),10,(1+r.roughness)/2))}a.length&&s.push(_t([a],r))}return r.stroke!==Y&&s.push(i),this._d("curve",s,r)}polygon(e,n){const r=this._o(n),s=[],i=Wt(e,!0,r);return r.fill&&(r.fillStyle==="solid"?s.push(oe([e],r)):s.push(_t([e],r))),r.stroke!==Y&&s.push(i),this._d("polygon",s,r)}path(e,n){const r=this._o(n),s=[];if(!e)return this._d("path",s,r);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");const i=r.fill&&r.fill!=="transparent"&&r.fill!==Y,a=r.stroke!==Y,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(i)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}));s.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else s.push(oe(u,r));else s.push(_t(u,r));return a&&(o?u.forEach(c=>{s.push(Wt(c,!1,r))}):s.push(h)),this._d("path",s,r)}opsToPath(e,n){let r="";for(const s of e.ops){const i=typeof n=="number"&&n>=0?s.data.map(a=>+a.toFixed(n)):s.data;switch(s.op){case"move":r+=`M${i[0]} ${i[1]} `;break;case"bcurveTo":r+=`C${i[0]} ${i[1]}, ${i[2]} ${i[3]}, ${i[4]} ${i[5]} `;break;case"lineTo":r+=`L${i[0]} ${i[1]} `;break}}return r.trim()}toPaths(e){const n=e.sets||[],r=e.options||this.defaultOptions,s=[];for(const i of n){let a=null;switch(i.type){case"path":a={d:this.opsToPath(i),stroke:r.stroke,strokeWidth:r.strokeWidth,fill:Y};break;case"fillPath":a={d:this.opsToPath(i),stroke:Y,strokeWidth:0,fill:r.fill||Y};break;case"fillSketch":a=this.fillSketch(i,r);break}a&&s.push(a)}return s}fillSketch(e,n){let r=n.fillWeight;return r<0&&(r=n.strokeWidth/2),{d:this.opsToPath(e),stroke:n.fill||Y,strokeWidth:r,fill:Y}}_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 Kt(n)}draw(e){const n=e.sets||[],r=e.options||this.getDefaultOptions(),s=this.ctx,i=e.options.fixedDecimalPlaceDigits;for(const a of n)switch(a.type){case"path":s.save(),s.strokeStyle=r.stroke==="none"?"transparent":r.stroke,s.lineWidth=r.strokeWidth,r.strokeLineDash&&s.setLineDash(r.strokeLineDash),r.strokeLineDashOffset&&(s.lineDashOffset=r.strokeLineDashOffset),this._drawToContext(s,a,i),s.restore();break;case"fillPath":{s.save(),s.fillStyle=r.fill||"";const o=e.shape==="curve"||e.shape==="polygon"||e.shape==="path"?"evenodd":"nonzero";this._drawToContext(s,a,i,o),s.restore();break}case"fillSketch":this.fillSketch(s,a,r);break}}fillSketch(e,n,r){let s=r.fillWeight;s<0&&(s=r.strokeWidth/2),e.save(),r.fillLineDash&&e.setLineDash(r.fillLineDash),r.fillLineDashOffset&&(e.lineDashOffset=r.fillLineDashOffset),e.strokeStyle=r.fill||"",e.lineWidth=s,this._drawToContext(e,n,r.fixedDecimalPlaceDigits),e.restore()}_drawToContext(e,n,r,s="nonzero"){e.beginPath();for(const i of n.ops){const a=typeof r=="number"&&r>=0?i.data.map(o=>+o.toFixed(r)):i.data;switch(i.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(s):e.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(e,n,r,s,i){const a=this.gen.line(e,n,r,s,i);return this.draw(a),a}rectangle(e,n,r,s,i){const a=this.gen.rectangle(e,n,r,s,i);return this.draw(a),a}ellipse(e,n,r,s,i){const a=this.gen.ellipse(e,n,r,s,i);return this.draw(a),a}circle(e,n,r,s){const i=this.gen.circle(e,n,r,s);return this.draw(i),i}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,s,i,a,o=!1,l){const u=this.gen.arc(e,n,r,s,i,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 Ht="http://www.w3.org/2000/svg";class Wr{constructor(e,n){this.svg=e,this.gen=new Kt(n)}draw(e){const n=e.sets||[],r=e.options||this.getDefaultOptions(),s=this.svg.ownerDocument||window.document,i=s.createElementNS(Ht,"g"),a=e.options.fixedDecimalPlaceDigits;for(const o of n){let l=null;switch(o.type){case"path":{l=s.createElementNS(Ht,"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=s.createElementNS(Ht,"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(s,o,r);break}}l&&i.appendChild(l)}return i}fillSketch(e,n,r){let s=r.fillWeight;s<0&&(s=r.strokeWidth/2);const i=e.createElementNS(Ht,"path");return i.setAttribute("d",this.opsToPath(n,r.fixedDecimalPlaceDigits)),i.setAttribute("stroke",r.fill||""),i.setAttribute("stroke-width",s+""),i.setAttribute("fill","none"),r.fillLineDash&&i.setAttribute("stroke-dasharray",r.fillLineDash.join(" ").trim()),r.fillLineDashOffset&&i.setAttribute("stroke-dashoffset",`${r.fillLineDashOffset}`),i}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(e,n){return this.gen.opsToPath(e,n)}line(e,n,r,s,i){const a=this.gen.line(e,n,r,s,i);return this.draw(a)}rectangle(e,n,r,s,i){const a=this.gen.rectangle(e,n,r,s,i);return this.draw(a)}ellipse(e,n,r,s,i){const a=this.gen.ellipse(e,n,r,s,i);return this.draw(a)}circle(e,n,r,s){const i=this.gen.circle(e,n,r,s);return this.draw(i)}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,s,i,a,o=!1,l){const u=this.gen.arc(e,n,r,s,i,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 $r={canvas(t,e){return new qr(t,e)},svg(t,e){return new Wr(t,e)},generator(t){return new Kt(t)},newSeed(){return Kt.newSeed()}};function Jt(t){"@babel/helpers - typeof";return Jt=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},Jt(t)}var jr=/^\s+/,Xr=/\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=Yr(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,s,i,a,o;return n=e.r/255,r=e.g/255,s=e.b/255,n<=.03928?i=n/12.92:i=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),s<=.03928?o=s/12.92:o=Math.pow((s+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(e){return this._a=Rn(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=$e(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=$e(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),s=Math.round(e.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+s+"%)":"hsva("+n+", "+r+"%, "+s+"%, "+this._roundA+")"},toHsl:function(){var e=We(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=We(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),s=Math.round(e.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+s+"%)":"hsla("+n+", "+r+"%, "+s+"%, "+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 ts(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(z(this._r,255)*100)+"%",g:Math.round(z(this._g,255)*100)+"%",b:Math.round(z(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(z(this._r,255)*100)+"%, "+Math.round(z(this._g,255)*100)+"%, "+Math.round(z(this._b,255)*100)+"%)":"rgba("+Math.round(z(this._r,255)*100)+"%, "+Math.round(z(this._g,255)*100)+"%, "+Math.round(z(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:fs[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,s=this._gradientType?"GradientType = 1, ":"";if(e){var i=w(e);r="#"+Xe(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+n+",endColorstr="+r+")"},toString:function(e){var n=!!e;e=e||this._format;var r=!1,s=this._a<1&&this._a>=0,i=!n&&s&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?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(ss,arguments)},brighten:function(){return this._applyModification(is,arguments)},darken:function(){return this._applyModification(os,arguments)},desaturate:function(){return this._applyModification(es,arguments)},saturate:function(){return this._applyModification(ns,arguments)},greyscale:function(){return this._applyModification(rs,arguments)},spin:function(){return this._applyModification(as,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(hs,arguments)},complement:function(){return this._applyCombination(ls,arguments)},monochromatic:function(){return this._applyCombination(cs,arguments)},splitcomplement:function(){return this._applyCombination(us,arguments)},triad:function(){return this._applyCombination(Ye,[3])},tetrad:function(){return this._applyCombination(Ye,[4])}};w.fromRatio=function(t,e){if(Jt(t)=="object"){var n={};for(var r in t)t.hasOwnProperty(r)&&(r==="a"?n[r]=t[r]:n[r]=Nt(t[r]));t=n}return w(t,e)};function Yr(t){var e={r:0,g:0,b:0},n=1,r=null,s=null,i=null,a=!1,o=!1;return typeof t=="string"&&(t=gs(t)),Jt(t)=="object"&&(lt(t.r)&&lt(t.g)&&lt(t.b)?(e=Qr(t.r,t.g,t.b),a=!0,o=String(t.r).substr(-1)==="%"?"prgb":"rgb"):lt(t.h)&&lt(t.s)&&lt(t.v)?(r=Nt(t.s),s=Nt(t.v),e=Jr(t.h,r,s),a=!0,o="hsv"):lt(t.h)&&lt(t.s)&&lt(t.l)&&(r=Nt(t.s),i=Nt(t.l),e=Kr(t.h,r,i),a=!0,o="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=Rn(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 Qr(t,e,n){return{r:z(t,255)*255,g:z(e,255)*255,b:z(n,255)*255}}function We(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var r=Math.max(t,e,n),s=Math.min(t,e,n),i,a,o=(r+s)/2;if(r==s)i=a=0;else{var l=r-s;switch(a=o>.5?l/(2-r-s):l/(r+s),r){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4;break}i/=6}return{h:i,s:a,l:o}}function Kr(t,e,n){var r,s,i;t=z(t,360),e=z(e,100),n=z(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=s=i=n;else{var o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;r=a(l,o,t+1/3),s=a(l,o,t),i=a(l,o,t-1/3)}return{r:r*255,g:s*255,b:i*255}}function $e(t,e,n){t=z(t,255),e=z(e,255),n=z(n,255);var r=Math.max(t,e,n),s=Math.min(t,e,n),i,a,o=r,l=r-s;if(a=r===0?0:l/r,r==s)i=0;else{switch(r){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4;break}i/=6}return{h:i,s:a,v:o}}function Jr(t,e,n){t=z(t,360)*6,e=z(e,100),n=z(n,100);var r=Math.floor(t),s=t-r,i=n*(1-e),a=n*(1-s*e),o=n*(1-(1-s)*e),l=r%6,u=[n,a,i,i,o,n][l],h=[o,n,n,a,i,i][l],c=[i,i,o,n,n,a][l];return{r:u*255,g:h*255,b:c*255}}function je(t,e,n,r){var s=[st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16))];return r&&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[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function ts(t,e,n,r,s){var i=[st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16)),st(In(r))];return s&&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[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function Xe(t,e,n,r){var s=[st(In(r)),st(Math.round(t).toString(16)),st(Math.round(e).toString(16)),st(Math.round(n).toString(16))];return s.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 es(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.s-=e/100,n.s=ne(n.s),w(n)}function ns(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.s+=e/100,n.s=ne(n.s),w(n)}function rs(t){return w(t).desaturate(100)}function ss(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.l+=e/100,n.l=ne(n.l),w(n)}function is(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 os(t,e){e=e===0?0:e||10;var n=w(t).toHsl();return n.l-=e/100,n.l=ne(n.l),w(n)}function as(t,e){var n=w(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,w(n)}function ls(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)],s=360/e,i=1;i<e;i++)r.push(w({h:(n.h+i*s)%360,s:n.s,l:n.l}));return r}function us(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 hs(t,e,n){e=e||6,n=n||30;var r=w(t).toHsl(),s=360/n,i=[w(t)];for(r.h=(r.h-(s*e>>1)+720)%360;--e;)r.h=(r.h+s)%360,i.push(w(r));return i}function cs(t,e){e=e||6;for(var n=w(t).toHsv(),r=n.h,s=n.s,i=n.v,a=[],o=1/e;e--;)a.push(w({h:r,s,v:i})),i=(i+o)%1;return a}w.mix=function(t,e,n){n=n===0?0:n||50;var r=w(t).toRgb(),s=w(e).toRgb(),i=n/100,a={r:(s.r-r.r)*i+r.r,g:(s.g-r.g)*i+r.g,b:(s.b-r.b)*i+r.b,a:(s.a-r.a)*i+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),s,i;switch(i=!1,s=vs(n),s.level+s.size){case"AAsmall":case"AAAlarge":i=r>=4.5;break;case"AAlarge":i=r>=3;break;case"AAAsmall":i=r>=7;break}return i};w.mostReadable=function(t,e,n){var r=null,s=0,i,a,o,l;n=n||{},a=n.includeFallbackColors,o=n.level,l=n.size;for(var u=0;u<e.length;u++)i=w.readability(t,e[u]),i>s&&(s=i,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 Me=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"},fs=w.hexNames=ps(Me);function ps(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function Rn(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function z(t,e){ds(t)&&(t="100%");var n=ms(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 ne(t){return Math.min(1,Math.max(0,t))}function Q(t){return parseInt(t,16)}function ds(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function ms(t){return typeof t=="string"&&t.indexOf("%")!=-1}function st(t){return t.length==1?"0"+t:""+t}function Nt(t){return t<=1&&(t=t*100+"%"),t}function In(t){return Math.round(parseFloat(t)*255).toString(16)}function Qe(t){return Q(t)/255}var et=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",s="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+s),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+s),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+s),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 lt(t){return!!et.CSS_UNIT.exec(t)}function gs(t){t=t.replace(jr,"").replace(Xr,"").toLowerCase();var e=!1;if(Me[t])t=Me[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=et.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=et.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=et.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=et.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=et.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=et.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=et.hex8.exec(t))?{r:Q(n[1]),g:Q(n[2]),b:Q(n[3]),a:Qe(n[4]),format:e?"name":"hex8"}:(n=et.hex6.exec(t))?{r:Q(n[1]),g:Q(n[2]),b:Q(n[3]),format:e?"name":"hex"}:(n=et.hex4.exec(t))?{r:Q(n[1]+""+n[1]),g:Q(n[2]+""+n[2]),b:Q(n[3]+""+n[3]),a:Qe(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=et.hex3.exec(t))?{r:Q(n[1]+""+n[1]),g:Q(n[2]+""+n[2]),b:Q(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function vs(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 zn=function(t,e){return(zn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])})(t,e)};function Ln(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}zn(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function Dn(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 Se(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 nt(){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 ct=Math.PI;function ae(t,e,n){t.lArcFlag=t.lArcFlag===0?0:1,t.sweepFlag=t.sweepFlag===0?0:1;var r=t.rX,s=t.rY,i=t.x,a=t.y;r=Math.abs(t.rX),s=Math.abs(t.rY);var o=Se([(e-i)/2,(n-a)/2],-t.xRot/180*ct),l=o[0],u=o[1],h=Math.pow(l,2)/Math.pow(r,2)+Math.pow(u,2)/Math.pow(s,2);1<h&&(r*=Math.sqrt(h),s*=Math.sqrt(h)),t.rX=r,t.rY=s;var c=Math.pow(r,2)*Math.pow(u,2)+Math.pow(s,2)*Math.pow(l,2),p=(t.lArcFlag!==t.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(r,2)*Math.pow(s,2)-c)/c)),f=r*u/s*p,d=-s*l/r*p,m=Se([f,d],t.xRot/180*ct);t.cX=m[0]+(e+i)/2,t.cY=m[1]+(n+a)/2,t.phi1=Math.atan2((u-d)/s,(l-f)/r),t.phi2=Math.atan2((-u-d)/s,(-l-f)/r),t.sweepFlag===0&&t.phi2>t.phi1&&(t.phi2-=2*ct),t.sweepFlag===1&&t.phi2<t.phi1&&(t.phi2+=2*ct),t.phi1*=180/ct,t.phi2*=180/ct}function Ke(t,e,n){nt(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 s=Math.sqrt(r);return[[(t*n+e*s)/(t*t+e*e),(e*n-t*s)/(t*t+e*e)],[(t*n-e*s)/(t*t+e*e),(e*n+t*s)/(t*t+e*e)]]}var L,ut=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*ct)*e+Math.sin(r/180*ct)*n}function en(t,e,n,r){var s=1e-6,i=e-t,a=n-e,o=3*i+3*(r-n)-6*a,l=6*(a-i),u=3*i;return Math.abs(o)<s?[-u/l]:function(h,c,p){var f=h*h/4-c;if(f<-p)return[];if(f<=p)return[-h/2];var d=Math.sqrt(f);return[-h/2-d,-h/2+d]}(l/o,u/o,s)}function nn(t,e,n,r,s){var i=1-s;return t*(i*i*i)+e*(3*i*i*s)+n*(3*i*s*s)+r*(s*s*s)}(function(t){function e(){return s(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 s(function(c,p,f){return c.type&b.SMOOTH_CURVE_TO&&(c.type=b.CURVE_TO,o=isNaN(o)?p:o,l=isNaN(l)?f:l,c.x1=c.relative?p-o:2*p-o,c.y1=c.relative?f-l:2*f-l),c.type&b.CURVE_TO?(o=c.relative?p+c.x2:c.x2,l=c.relative?f+c.y2:c.y2):(o=NaN,l=NaN),c.type&b.SMOOTH_QUAD_TO&&(c.type=b.QUAD_TO,u=isNaN(u)?p:u,h=isNaN(h)?f:h,c.x1=c.relative?p-u:2*p-u,c.y1=c.relative?f-h:2*f-h),c.type&b.QUAD_TO?(u=c.relative?p+c.x1:c.x1,h=c.relative?f+c.y1:c.y1):(u=NaN,h=NaN),c})}function r(){var o=NaN,l=NaN;return s(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 p=u.x1,f=u.y1;u.type=b.CURVE_TO,u.x1=((u.relative?0:h)+2*p)/3,u.y1=((u.relative?0:c)+2*f)/3,u.x2=(u.x+2*p)/3,u.y2=(u.y+2*f)/3}else o=NaN,l=NaN;return u})}function s(o){var l=0,u=0,h=NaN,c=NaN;return function(p){if(isNaN(h)&&!(p.type&b.MOVE_TO))throw new Error("path must start with moveto");var f=o(p,l,u,h,c);return p.type&b.CLOSE_PATH&&(l=h,u=c),p.x!==void 0&&(l=p.relative?l+p.x:p.x),p.y!==void 0&&(u=p.relative?u+p.y:p.y),p.type&b.MOVE_TO&&(h=l,c=u),f}}function i(o,l,u,h,c,p){return nt(o,l,u,h,c,p),s(function(f,d,m,g){var v=f.x1,x=f.x2,_=f.relative&&!isNaN(g),M=f.x!==void 0?f.x:_?0:d,O=f.y!==void 0?f.y:_?0:m;function y(At){return At*At}f.type&b.HORIZ_LINE_TO&&l!==0&&(f.type=b.LINE_TO,f.y=f.relative?0:m),f.type&b.VERT_LINE_TO&&u!==0&&(f.type=b.LINE_TO,f.x=f.relative?0:d),f.x!==void 0&&(f.x=f.x*o+O*u+(_?0:c)),f.y!==void 0&&(f.y=M*l+f.y*h+(_?0:p)),f.x1!==void 0&&(f.x1=f.x1*o+f.y1*u+(_?0:c)),f.y1!==void 0&&(f.y1=v*l+f.y1*h+(_?0:p)),f.x2!==void 0&&(f.x2=f.x2*o+f.y2*u+(_?0:c)),f.y2!==void 0&&(f.y2=x*l+f.y2*h+(_?0:p));var S=o*h-l*u;if(f.xRot!==void 0&&(o!==1||l!==0||u!==0||h!==1))if(S===0)delete f.rX,delete f.rY,delete f.xRot,delete f.lArcFlag,delete f.sweepFlag,f.type=b.LINE_TO;else{var T=f.xRot*Math.PI/180,N=Math.sin(T),G=Math.cos(T),U=1/y(f.rX),P=1/y(f.rY),k=y(G)*U+y(N)*P,I=2*N*G*(U-P),R=y(N)*U+y(G)*P,F=k*h*h-I*l*h+R*l*l,W=I*(o*h+l*u)-2*(k*u*h+R*o*l),J=k*u*u-I*o*u+R*o*o,H=(Math.atan2(W,F-J)+Math.PI)%Math.PI/2,D=Math.sin(H),it=Math.cos(H);f.rX=Math.abs(S)/Math.sqrt(F*y(it)+W*D*it+J*y(D)),f.rY=Math.abs(S)/Math.sqrt(F*y(D)-W*D*it+J*y(it)),f.xRot=180*H/Math.PI}return f.sweepFlag!==void 0&&0>S&&(f.sweepFlag=+!f.sweepFlag),f})}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),nt(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 s(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),s(function(h,c,p,f,d){if(isNaN(f)&&!(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:p),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?f-c:f,h.y=h.relative?d-p: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=s,t.SANITIZE=function(o){o===void 0&&(o=0),nt(o);var l=NaN,u=NaN,h=NaN,c=NaN;return s(function(p,f,d,m,g){var v=Math.abs,x=!1,_=0,M=0;if(p.type&b.SMOOTH_CURVE_TO&&(_=isNaN(l)?0:f-l,M=isNaN(u)?0:d-u),p.type&(b.CURVE_TO|b.SMOOTH_CURVE_TO)?(l=p.relative?f+p.x2:p.x2,u=p.relative?d+p.y2:p.y2):(l=NaN,u=NaN),p.type&b.SMOOTH_QUAD_TO?(h=isNaN(h)?f:2*f-h,c=isNaN(c)?d:2*d-c):p.type&b.QUAD_TO?(h=p.relative?f+p.x1:p.x1,c=p.relative?d+p.y1:p.y2):(h=NaN,c=NaN),p.type&b.LINE_COMMANDS||p.type&b.ARC&&(p.rX===0||p.rY===0||!p.lArcFlag)||p.type&b.CURVE_TO||p.type&b.SMOOTH_CURVE_TO||p.type&b.QUAD_TO||p.type&b.SMOOTH_QUAD_TO){var O=p.x===void 0?0:p.relative?p.x:p.x-f,y=p.y===void 0?0:p.relative?p.y:p.y-d;_=isNaN(h)?p.x1===void 0?_:p.relative?p.x:p.x1-f:h-f,M=isNaN(c)?p.y1===void 0?M:p.relative?p.y:p.y1-d:c-d;var S=p.x2===void 0?0:p.relative?p.x:p.x2-f,T=p.y2===void 0?0:p.relative?p.y:p.y2-d;v(O)<=o&&v(y)<=o&&v(_)<=o&&v(M)<=o&&v(S)<=o&&v(T)<=o&&(x=!0)}return p.type&b.CLOSE_PATH&&v(f-m)<=o&&v(d-g)<=o&&(x=!0),x?[]:p})},t.MATRIX=i,t.ROTATE=function(o,l,u){l===void 0&&(l=0),u===void 0&&(u=0),nt(o,l,u);var h=Math.sin(o),c=Math.cos(o);return i(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),nt(o,l),i(1,0,0,1,o,l)},t.SCALE=function(o,l){return l===void 0&&(l=o),nt(o,l),i(o,0,0,l,0,0)},t.SKEW_X=function(o){return nt(o),i(1,0,Math.atan(o),1,0,0)},t.SKEW_Y=function(o){return nt(o),i(1,Math.atan(o),0,1,0,0)},t.X_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),nt(o),i(-1,0,0,1,o,0)},t.Y_AXIS_SYMMETRY=function(o){return o===void 0&&(o=0),nt(o),i(1,0,0,-1,0,o)},t.A_TO_C=function(){return s(function(o,l,u){return b.ARC===o.type?function(h,c,p){var f,d,m,g;h.cX||ae(h,c,p);for(var v=Math.min(h.phi1,h.phi2),x=Math.max(h.phi1,h.phi2)-v,_=Math.ceil(x/90),M=new Array(_),O=c,y=p,S=0;S<_;S++){var T=Je(h.phi1,h.phi2,S/_),N=Je(h.phi1,h.phi2,(S+1)/_),G=N-T,U=4/3*Math.tan(G*ut/4),P=[Math.cos(T*ut)-U*Math.sin(T*ut),Math.sin(T*ut)+U*Math.cos(T*ut)],k=P[0],I=P[1],R=[Math.cos(N*ut),Math.sin(N*ut)],F=R[0],W=R[1],J=[F+U*Math.sin(N*ut),W-U*Math.cos(N*ut)],H=J[0],D=J[1];M[S]={relative:h.relative,type:b.CURVE_TO};var it=function(At,kt){var Te=Se([At*h.rX,kt*h.rY],h.xRot),Un=Te[0],Gn=Te[1];return[h.cX+Un,h.cY+Gn]};f=it(k,I),M[S].x1=f[0],M[S].y1=f[1],d=it(H,D),M[S].x2=d[0],M[S].y2=d[1],m=it(F,W),M[S].x=m[0],M[S].y=m[1],h.relative&&(M[S].x1-=O,M[S].y1-=y,M[S].x2-=O,M[S].y2-=y,M[S].x-=O,M[S].y-=y),O=(g=[M[S].x,M[S].y])[0],y=g[1]}return M}(o,o.relative?0:l,o.relative?0:u):o})},t.ANNOTATE_ARCS=function(){return s(function(o,l,u){return o.relative&&(l=0,u=0),b.ARC===o.type&&ae(o,l,u),o})},t.CLONE=a,t.CALCULATE_BOUNDS=function(){var o=function(p){var f={};for(var d in p)f[d]=p[d];return f},l=e(),u=r(),h=n(),c=s(function(p,f,d){var m=h(u(l(o(p))));function g(D){D>c.maxX&&(c.maxX=D),D<c.minX&&(c.minX=D)}function v(D){D>c.maxY&&(c.maxY=D),D<c.minY&&(c.minY=D)}if(m.type&b.DRAWING_COMMANDS&&(g(f),v(d)),m.type&b.HORIZ_LINE_TO&&g(m.x),m.type&b.VERT_LINE_TO&&v(m.y),m.type&b.LINE_TO&&(g(m.x),v(m.y)),m.type&b.CURVE_TO){g(m.x),v(m.y);for(var x=0,_=en(f,m.x1,m.x2,m.x);x<_.length;x++)0<(H=_[x])&&1>H&&g(nn(f,m.x1,m.x2,m.x,H));for(var M=0,O=en(d,m.y1,m.y2,m.y);M<O.length;M++)0<(H=O[M])&&1>H&&v(nn(d,m.y1,m.y2,m.y,H))}if(m.type&b.ARC){g(m.x),v(m.y),ae(m,f,d);for(var y=m.xRot/180*Math.PI,S=Math.cos(y)*m.rX,T=Math.sin(y)*m.rX,N=-Math.sin(y)*m.rY,G=Math.cos(y)*m.rY,U=m.phi1<m.phi2?[m.phi1,m.phi2]:-180>m.phi2?[m.phi2+360,m.phi1+360]:[m.phi2,m.phi1],P=U[0],k=U[1],I=function(D){var it=D[0],At=D[1],kt=180*Math.atan2(At,it)/Math.PI;return kt<P?kt+360:kt},R=0,F=Ke(N,-S,0).map(I);R<F.length;R++)(H=F[R])>P&&H<k&&g(tn(m.cX,S,N,H));for(var W=0,J=Ke(G,-T,0).map(I);W<J.length;W++){var H;(H=J[W])>P&&H<k&&v(tn(m.cY,T,G,H))}}return p});return c.minX=1/0,c.maxX=-1/0,c.minY=1/0,c.maxY=-1/0,c}})(L||(L={}));var tt,Zn=function(){function t(){}return t.prototype.round=function(e){return this.transform(L.ROUND(e))},t.prototype.toAbs=function(){return this.transform(L.TO_ABS())},t.prototype.toRel=function(){return this.transform(L.TO_REL())},t.prototype.normalizeHVZ=function(e,n,r){return this.transform(L.NORMALIZE_HVZ(e,n,r))},t.prototype.normalizeST=function(){return this.transform(L.NORMALIZE_ST())},t.prototype.qtToC=function(){return this.transform(L.QT_TO_C())},t.prototype.aToC=function(){return this.transform(L.A_TO_C())},t.prototype.sanitize=function(e){return this.transform(L.SANITIZE(e))},t.prototype.translate=function(e,n){return this.transform(L.TRANSLATE(e,n))},t.prototype.scale=function(e,n){return this.transform(L.SCALE(e,n))},t.prototype.rotate=function(e,n,r){return this.transform(L.ROTATE(e,n,r))},t.prototype.matrix=function(e,n,r,s,i,a){return this.transform(L.MATRIX(e,n,r,s,i,a))},t.prototype.skewX=function(e){return this.transform(L.SKEW_X(e))},t.prototype.skewY=function(e){return this.transform(L.SKEW_Y(e))},t.prototype.xSymmetry=function(e){return this.transform(L.X_AXIS_SYMMETRY(e))},t.prototype.ySymmetry=function(e){return this.transform(L.Y_AXIS_SYMMETRY(e))},t.prototype.annotateArcs=function(){return this.transform(L.ANNOTATE_ARCS())},t}(),bs=function(t){return t===" "||t===" "||t==="\r"||t===`
`},rn=function(t){return 48<=t.charCodeAt(0)&&t.charCodeAt(0)<=57},ys=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 Ln(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 s=this;r===void 0&&(r=[]);for(var i=function(c){r.push(c),s.curArgs.length=0,s.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===xs[this.curCommandType]&&(b.HORIZ_LINE_TO===this.curCommandType?i({type:b.HORIZ_LINE_TO,relative:this.curCommandRelative,x:h}):b.VERT_LINE_TO===this.curCommandType?i({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?(i({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?i({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?i({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?i({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&&i({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(!bs(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,s){s===void 0&&(s=[]);for(var i=0,a=Object.getPrototypeOf(this).parse.call(this,r);i<a.length;i++){var o=a[i],l=n(o);Array.isArray(l)?s.push.apply(s,l):s.push(l)}return s}}})},e}(Zn),b=function(t){function e(n){var r=t.call(this)||this;return r.commands=typeof n=="string"?e.parse(n):n,r}return Ln(e,t),e.prototype.encode=function(){return e.encode(this.commands)},e.prototype.getBounds=function(){var n=L.CALCULATE_BOUNDS();return this.transform(n),n},e.prototype.transform=function(n){for(var r=[],s=0,i=this.commands;s<i.length;s++){var a=n(i[s]);Array.isArray(a)?r.push.apply(r,a):r.push(a)}return this.commands=r,this},e.encode=function(n){return Dn(n)},e.parse=function(n){var r=new ys,s=[];return r.parse(n,s),r.finish(s),s},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}(Zn),xs=((tt={})[b.MOVE_TO]=2,tt[b.LINE_TO]=2,tt[b.HORIZ_LINE_TO]=1,tt[b.VERT_LINE_TO]=1,tt[b.CLOSE_PATH]=0,tt[b.QUAD_TO]=4,tt[b.SMOOTH_QUAD_TO]=2,tt[b.CURVE_TO]=6,tt[b.SMOOTH_CURVE_TO]=4,tt[b.ARC]=7,tt),ft;function vt(t){if(t.children!==void 0)return t.children;let e,n=0;const r=t.childNodes,s=[];for(;e=r[n++];)e.nodeType===1&&s.push(e);return s}function ke(t){const e=t.parentNode;return e&&e.nodeType===Node.ELEMENT_NODE?e:null}function le(t,e){for(;e.firstChild;)t.append(e.firstChild);return t}function Ct(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"})(ft||(ft={}));const zt="data-sketchy-clip-path",ws=/[acsqt]/i;function Oe(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),s=[];for(let i=0;i<r.length;i++){const a=r[i],o=a.split(",");if(o.length===2)s.push({x:parseFloat(o[0]),y:parseFloat(o[1])});else{const l=i+1;l<r.length&&(s.push({x:parseFloat(a),y:parseFloat(r[l])}),i=l)}}return s}function K(t,e,n){let r=n;const s=e.getAttribute(zt),i=t.pencilFilter&&e.tagName!=="text";if(!(r.tagName==="g"&&r.attributes.length===0)&&(s||i)){const a=document.createElementNS("http://www.w3.org/2000/svg","g");a.appendChild(r),r=a}s&&(r.setAttribute("clip-path",`url(#${s})`),e.removeAttribute(zt)),i&&r.setAttribute("filter","url(#pencilTextureFilter)"),t.svgSketch.appendChild(r)}function Bt(t,e,n){return ws.test(e)&&(n=n?Object.assign(Object.assign({},n),{preserveVertices:!0}):{preserveVertices:!0}),t.rc.path(e,n)}function q(t,e,n,r){let s;if(s=r?e.getAttribute(n):getComputedStyle(e)[n]||e.getAttribute(n),!s){let i=ke(e);const a=r;let o=a;return a&&a.referenced===e&&(i=a.root,o=a.parentContext),!i||i===t.sourceSvg?void 0:q(t,i,n,o)}return s}function Fn(t,e,n,r){let s;if(s=r?e.getAttribute("opacity"):getComputedStyle(e).opacity||e.getAttribute("opacity"),s){let l=1;l=s.indexOf("%")!==-1?Math.min(1,Math.max(0,parseFloat(s.substring(0,s.length-1))/100)):Math.min(1,Math.max(0,parseFloat(s))),n*=l}let i=ke(e);const a=r;let o=a;return a&&a.referenced===e&&(i=a.root,o=a.parentContext),i&&i!==t.sourceSvg?Fn(t,i,n,o):n}function wt(t,e,n){const{fillId:r,strokeId:s}=function(i,a){function o(l){const u=a.getAttribute(l);if(u&&u.indexOf("url")!==-1){const h=Ct(u);if(h&&i.idElements[h]instanceof SVGPatternElement)return h}return null}return{fillId:o("fill"),strokeId:o("stroke")}}(t,e);if(r!==null||s!==null){const i=n();i.setAttribute("fill",r!==null?`url(#${r})`:"none"),i.setAttribute("stroke",s!==null?`url(#${s})`:"none");const a=q(t,e,"stroke-width",t.useElementContext);i.setAttribute("stroke-width",a??"0"),K(t,e,i),on(t,r),on(t,s)}}function on(t,e){if(e===null)return;const n=Oe(t),r=`#${e}`;if(!n.querySelector(r)){const s=t.sourceSvg.querySelector(r);if(s){if(!t.sketchPatterns)return void n.appendChild(s.cloneNode(!0));const i=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),le(document.createElementNS("http://www.w3.org/2000/svg","g"),c.svgSketch)}(t,le(document.createElementNS("http://www.w3.org/2000/svg","g"),s.cloneNode(!0)),{fillStyle:"solid",roughness:.5}),a=s.cloneNode();n.appendChild(le(a,i))}}}const Ms=/^([+-]?(?:\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},Ss=Math.sqrt(2);function Vt(t,e,n,r){const{value:s,unit:i}=ue(n);return function(a){return!!an[a]}(i)?function(a,o){var l;const u=(l=an[o])!==null&&l!==void 0?l:1;return a*u}(s,i):function(a,o,l,u,h){var c;const p=(c=a.viewBox)!==null&&c!==void 0?c:{w:0,h:0};if(h==="%")return function(f,d,{w:m,h:g}={w:0,h:0}){const v=d/100;return f==="x"?v*m:f==="y"?v*g:v*(Math.sqrt(m*m+g*g)/Ss)}(l,u,p);if(h==="vw"||h==="vh"||h==="vmin"||h==="vmax")return function(f,d,{w:m,h:g}={w:0,h:0}){var v,x;const _=f/100,M=(v=window.innerWidth)!==null&&v!==void 0?v:m,O=(x=window.innerHeight)!==null&&x!==void 0?x:g;if(d==="vw")return _*M;if(d==="vh")return _*O;if(d==="vmin")return _*Math.min(M,O);if(d==="vmax")return _*Math.max(M,O);throw new Error(`Not a viewport length unit: ${d}`)}(u,h,p);if(h==="em"||h==="ex"||h==="ch"||h==="rem")return function(f,d,m,g){var v;if(g==="rem"){const O=document.documentElement,y=ue(getComputedStyle(O).fontSize);return m*(y.unit==="px"?y.value:16)}if(g==="ch"){const O=function(y){const S=ke(y);if(!S)return 1;const T=document.createElementNS("http://www.w3.org/2000/svg","text");T.style.visibility="hidden",T.appendChild(document.createTextNode("0")),S.appendChild(T);const N=T.getBBox();return S.removeChild(T),N.width}(d);return m*O}const x=(v=q(f,d,"font-size",f.useElementContext))!==null&&v!==void 0?v:"16px",_=ue(x),M=_.unit==="px"?_.value:16;if(g==="em")return m*M;if(g==="ex")return m*M*.5;throw new Error(`Not a font relative unit: ${g}`)}(a,o,u,h);throw new Error(`Unsupported relative length unit: ${h}`)}(t,e,r,s,i)}function ue(t){const e=t.match(Ms);if(e===null||e.length!==3)throw new Error(`Cannot parse dimension: ${t}`);return{value:parseFloat(e[1]),unit:e[2].toLowerCase()||"px"}}function Pt(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 he(t){if(!t)return!0;const e=t.matrix;return!e||e.a===1&&e.b===0&&e.c===0&&e.d===1}function E(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 Lt(t,e,n){if(!n)return ln(e);const r=ln(e);if(r){const s=r.matrix,i=n.matrix.multiply(s);return t.sourceSvg.createSVGTransformFromMatrix(i)}return n}function mt(t,e,n){if(e&&e.matrix&&!Pt(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:"",s=/stop-color:\s?(.*);?/.exec(r);s&&s.length>1&&(n=s[1])}return w(n||"white")}function hn(t){const e=t.length;let n=0,r=0,s=0,i=0;return t.forEach(a=>{const o=a.toRgb();n+=o.r*o.r,r+=o.g*o.g,s+=o.b*o.b,i+=o.a}),w({r:Math.sqrt(n/e),g:Math.sqrt(r/e),b:Math.sqrt(s/e),a:i/e})}function As(t){const e=t.getAttribute("offset");return e?e.indexOf("%")?parseFloat(e.substring(0,e.length-1)):100*parseFloat(e):0}function Es(t,e){if(t.roughConfig.fillStyle==="solid")return{angle:0,gap:0,weight:0};const{width:n,height:r}=e.getBoundingClientRect(),s=n/r,i=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:_s(t,a,s),gap:Cs(t,o,i),weight:ks(t,l,i)}}function _s({rng:t},{normal:e,horizontal:n,vertical:r},s){if(isFinite(s)){if(s<.25)return t.next(n);if(s>6)return t.next(r)}return t.next(e)}function Cs({rng:t},{normal:e,small:n},r){return r<45?t.next(n):t.next(e)}function ks({rng:t},{normal:e,small:n},r){return r<45?t.next(n):t.next(e)}function ot(t,e,n){var r;const s=(r=t.roughConfig.fixedDecimalPlaceDigits)!==null&&r!==void 0?r:15,i=Object.assign({},t.roughConfig);let a=1;if(!Pt(n)){const m=n.matrix,g=m.a*m.d-m.c*m.b;a=Math.sqrt(Math.abs(g))}const o=Fn(t,e,1,t.useElementContext),l=q(t,e,"fill",t.useElementContext)||"black",u=o*cn(e,"fill-opacity");if(l)if(l.indexOf("url")!==-1){const m=fn(t,l,u);m!=="none"?i.fill=m:delete i.fill}else if(l==="none")delete i.fill;else{const m=w(l);m.setAlpha(u),i.fill=m.toString()}const h=q(t,e,"stroke",t.useElementContext),c=o*cn(e,"stroke-opacity");if(h)if(h.indexOf("url")!==-1)i.stroke=fn(t,h,c);else if(h==="none")i.stroke="none";else{const m=w(h);m.setAlpha(c),i.stroke=m.toString()}else i.stroke="none";const p=q(t,e,"stroke-width",t.useElementContext);if(p){const m=Vt(t,e,p,"stroke-width")*a;i.strokeWidth=parseFloat(m.toFixed(s))}else i.strokeWidth=1;const f=q(t,e,"stroke-dasharray",t.useElementContext);f&&f!=="none"&&(i.strokeLineDash=f.split(/[\s,]+/).filter(m=>m.length>0).map(m=>{const g=Vt(t,e,m,"stroke-dasharray")*a;return Math.max(.5,parseFloat(g.toFixed(s)))}));const d=q(t,e,"stroke-dashoffset",t.useElementContext);if(d){const m=Vt(t,e,d,"stroke-dashoffset")*a;i.strokeLineDashOffset=parseFloat(m.toFixed(s))}if(i.fill&&i.stroke==="none"&&(i.stroke=i.fill,i.strokeWidth=1),t.randomize){const{angle:m,gap:g,weight:v}=Es(t,e);i.hachureAngle=m,i.hachureGap=Math.round(g),i.fillWeight=parseFloat(v.toFixed(s)),i.disableMultiStroke===void 0&&(i.disableMultiStroke=t.rng.next()>.3)}return i}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=Ct(e);if(!r)return"none";const s=t.idElements[r];if(!s)return"none";if(typeof s=="string")return s;if(s instanceof SVGLinearGradientElement||s instanceof SVGRadialGradientElement){const i=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 f=0;f<l.length;f++){const d=un(l[f]),m=As(l[f]),g=c?hn([c,d]):d;let v=Math.max(1,m/10|0);for(;v>0;)h.push(g),v--;c=d}const p=hn(h);return p.setAlpha(o),p.toString()}}(s,n);return t.idElements[r]=i,i}return"none"}function C(t){return`${t.x},${t.y}`}function Ut(t,e,n,r){if(n.length===0)return;const s=n[0],i=n[n.length-1],a=Ct(e.getAttribute("marker-start")),o=a?t.idElements[a]:null;if(o&&n.length>1){let p=o.orientAngle.baseVal.value;const f=n[1],d=o.getAttribute("orient");if(d==="auto"||d==="auto-start-reverse"){const x=d==="auto"?0:180,_=n[n.length-2];pn(n)?p=fe(_,i,f)-x:p=te({x:1,y:0},{x:f.x-s.x,y:f.y-s.y})-x}const m=t.sourceSvg.createSVGMatrix().translate(s.x,s.y).rotate(p).scale(ce(t,o,e)),g=r?r.matrix.multiply(m):m,v=t.sourceSvg.createSVGTransformFromMatrix(g);t.processElement(t,o,v)}const l=Ct(e.getAttribute("marker-end")),u=l?t.idElements[l]:null;if(u){let p=u.orientAngle.baseVal.value;if(n.length>1){const g=u.getAttribute("orient");if(g==="auto"||g==="auto-start-reverse"){const v=n[n.length-2];pn(n)?p=fe(v,i,n[1]):p=te({x:1,y:0},{x:i.x-v.x,y:i.y-v.y})}}const f=t.sourceSvg.createSVGMatrix().translate(i.x,i.y).rotate(p).scale(ce(t,u,e)),d=r?r.matrix.multiply(f):f,m=t.sourceSvg.createSVGTransformFromMatrix(d);t.processElement(t,u,m)}const h=Ct(e.getAttribute("marker-mid")),c=h?t.idElements[h]:null;if(c&&n.length>2)for(let p=0;p<n.length;p++){const f=n[p];if(p===0||p===n.length-1)continue;let d=c.orientAngle.baseVal.value;const m=c.getAttribute("orient");(m==="auto"||m==="auto-start-reverse")&&(d=fe(n[p-1],f,n[p+1]));const g=t.sourceSvg.createSVGMatrix().translate(f.x,f.y).rotate(d).scale(ce(t,c,e)),v=r?r.matrix.multiply(g):g,x=t.sourceSvg.createSVGTransformFromMatrix(v);t.processElement(t,c,x)}}function ce(t,e,n){const r=e.getAttribute("markerUnits");let s=1;if(!r||r==="strokeWidth"){const i=q(t,n,"stroke-width");i&&(s=Vt(t,n,i,"stroke-width"))}return s}function pn(t){return e=t[0],n=t[t.length-1],e.x===n.x&&e.y===n.y;var e,n}function fe(t,e,n){const r={x:n.x-e.x,y:n.y-e.y},s=te(r,{x:t.x-e.x,y:t.y-e.y}),i=e.x+1,a=e.y,o=te(r,{x:i-e.x,y:a-e.y});return((l=s)-180*Math.sign(l))/2-o;var l}function te(t,e){const n=Math.atan2(t.y,t.x),r=Math.atan2(e.y,e.x)-n,s=-Math.sign(r)*Math.PI*2,i=Math.abs(s+r)<Math.abs(r)?s+r:r;return Math.round(360*i/(2*Math.PI))}function dn(t,e,{x:n,y:r,w:s,h:i}){wt(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=s,a.height.baseVal.value=i,a})}function Os(t,e,n,r){const s=Ct(n);if(!s)return;const i=t.idElements[s];if(!i)return;const a=Oe(t),o=`${s}_${a.childElementCount}`,l=document.createElementNS("http://www.w3.org/2000/svg","clipPath");l.id=o,function(c,p){if(c.tagName!=="g")return void c.setAttribute(zt,p);const f=[],d=vt(c);for(let m=d.length-1;m>=0;m--)f.push(d[m]);for(;f.length>0;){const m=f.pop();m.setAttribute(zt,p);const g=vt(m);for(let v=g.length-1;v>=0;v--)f.push(g[v])}}(e,o);const u=[],h=vt(i);for(let c=h.length-1;c>=0;c--){const p=h[c],f=Lt(t,p,r);u.push({element:p,transform:f})}for(;u.length>0;){const{element:c,transform:p}=u.pop();try{Ts(t,c,l,p)}catch(d){console.error(d)}if(c.tagName==="defs"||c.tagName==="svg"||c.tagName==="clipPath"||c.tagName==="text")continue;const f=vt(c);for(let d=f.length-1;d>=0;d--){const m=f[d],g=Lt(t,m,p);u.push({element:m,transform:g})}}l.childNodes.length>0&&a.appendChild(l)}function Ts(t,e,n,r){switch(e.tagName){case"rect":(function(s,i,a,o){const l=i.x.baseVal.value,u=i.y.baseVal.value,h=i.width.baseVal.value,c=i.height.baseVal.value;if(h===0||c===0)return;const p=i.hasAttribute("rx")?i.rx.baseVal.value:null,f=i.hasAttribute("ry")?i.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,p&&(d.rx.baseVal.value=p),f&&(d.ry.baseVal.value=f),mt(0,o,d),a.appendChild(d)})(0,e,n,r);break;case"circle":(function(s,i,a,o){const l=i.cx.baseVal.value,u=i.cy.baseVal.value,h=i.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,mt(0,o,c),a.appendChild(c)})(0,e,n,r);break;case"ellipse":(function(s,i,a,o){const l=i.cx.baseVal.value,u=i.cy.baseVal.value,h=i.rx.baseVal.value,c=i.ry.baseVal.value;if(h===0||c===0)return;const p=document.createElementNS("http://www.w3.org/2000/svg","ellipse");p.cx.baseVal.value=l,p.cy.baseVal.value=u,p.rx.baseVal.value=h,p.ry.baseVal.value=c,mt(0,o,p),a.appendChild(p)})(0,e,n,r);break;case"polygon":(function(s,i,a,o){const l=document.createElementNS("http://www.w3.org/2000/svg","polygon");l.setAttribute("points",i.getAttribute("points")),mt(0,o,l),a.appendChild(l)})(0,e,n,r);break;case"path":(function(s,i,a,o){const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",i.getAttribute("d")),mt(0,o,l),a.appendChild(l)})(0,e,n,r)}}function Ns(t,e,n){const r=document.createElementNS("http://www.w3.org/2000/svg","g");r.setAttribute("class","text-container"),mt(0,n,r);const s=e.cloneNode(!0);s.transform.baseVal.numberOfItems>0&&s.transform.baseVal.clear(),s.removeAttribute("clip-path");const{cssFont:i,fontSize:a}=function(u,h,c=!1){const p={};let f="";const d=q(u,h,"font-style",u.useElementContext);d&&(f+=c?`font-style: ${d};`:d,p.fontStyle=d);const m=q(u,h,"font-weight",u.useElementContext);m&&(f+=c?`font-weight: ${m};`:` ${m}`,p.fontWeight=m);const g=q(u,h,"font-size",u.useElementContext);if(g&&(f+=c?`font-size: ${g};`:` ${g}`,p.fontSize=g),u.fontFamily)f+=c?`font-family: ${u.fontFamily};`:` ${u.fontFamily}`,p.fontFamiliy=u.fontFamily;else{const v=q(u,h,"font-family",u.useElementContext);v&&(f+=c?`font-family: ${v};`:` ${v}`,p.fontFamiliy=v)}return f=f.trim(),Object.assign(Object.assign({},p),{cssFont:f})}(t,e,!0);if(s.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}(s.getAttribute("style"),i)),mn(t,e,s),s.childElementCount>0){const u=vt(s),h=vt(e);for(let c=0;c<u.length;c++){const p=u[c];p instanceof SVGTSpanElement&&mn(t,h[c],p)}}r.appendChild(s),K(t,e,r);const o=t.fontFamily!==null,l=s.hasAttribute(zt);o&&l&&a&&function(u,h,c,p){const{width:f,height:d}=h.getBBox();if(f<=0||d<=0)return;const m=Vt(u,c,p,"font-size");Hn(u,{w:f,h:d},c,m)}(t,e,s,a)}function Hn(t,e,n,r){const{w:s}=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,p=a.parentElement;o||c.appendChild(a);const{width:f,height:d}=l.getBBox();return o||(c.removeChild(a),p&&p.appendChild(a)),h?a.setAttribute("style",h):a.removeAttribute("style"),{w:f,h:d}}(t,n);if(s<e.w||r<=1)return;const i=r-1;n.style.fontSize=`${i}px`,Hn(t,e,n,i)}function mn(t,e,n){const r=q(t,e,"stroke"),s=r?q(t,e,"stroke-width"):null,i=q(t,e,"fill"),a=q(t,e,"dominant-baseline"),o=q(t,e,"text-anchor",t.useElementContext);r&&n.setAttribute("stroke",r),s&&n.setAttribute("stroke-width",s),i&&n.setAttribute("fill",i),o&&n.setAttribute("text-anchor",o),a&&n.setAttribute("dominant-baseline",a)}function Bn(t,e,n,r,s){var i,a;const o=[],l={x:0,y:0,w:r??0,h:s??0};if(e instanceof SVGSVGElement||e instanceof SVGSymbolElement||e instanceof SVGMarkerElement){let u=0,h=0;if(e instanceof SVGSymbolElement)u=parseFloat((i=e.getAttribute("x"))!==null&&i!==void 0?i:"")||0,h=parseFloat((a=e.getAttribute("y"))!==null&&a!==void 0?a:"")||0,r=r??(parseFloat(e.getAttribute("width"))||void 0),s=s??(parseFloat(e.getAttribute("height"))||void 0);else if(e instanceof SVGMarkerElement){const d=e.getAttribute("markerWidth"),m=e.getAttribute("markerHeight");r=d!==null?parseFloat(d):3,s=m!==null?parseFloat(m):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:m,width:g,height:v}=e.viewBox.baseVal;if(l.x=d,l.y=m,l.w=g,l.h=v,r!==void 0&&s!==void 0){const x=r/g,_=s/v,M=u+.5*r,O=h+.5*s,y=d+.5*g,S=m+.5*v;c=c.translate(M,O),c=e.getAttribute("preserveAspectRatio")==="none"?c.scaleNonUniform(x,_):c.scale(Math.min(x,_)),c=c.translate(-y,-S)}}else c=c.translate(u,h);e instanceof SVGMarkerElement&&(c=c.translate(-e.refX.baseVal.value,-e.refY.baseVal.value));const p=n?n.matrix.multiply(c):c;n=t.sourceSvg.createSVGTransformFromMatrix(p);const f=vt(e);for(let d=f.length-1;d>=0;d--){const m=f[d];if(m instanceof SVGSymbolElement||m instanceof SVGMarkerElement)continue;const g=Lt(t,m,n);o.push({element:m,transform:g,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,Vs(t,u,h)}catch(f){console.error(f)}if(u.tagName==="defs"||u.tagName==="symbol"||u.tagName==="marker"||u.tagName==="svg"||u.tagName==="clipPath")continue;const p=vt(u);for(let f=p.length-1;f>=0;f--){const d=p[f],m=Lt(t,d,h);o.push({element:d,transform:m,viewBox:c})}}}function Vs(t,e,n){if(function(s){const i=s.style;return!!i&&(i.display==="none"||i.visibility==="hidden")}(e))return;const r=e.getAttribute("clip-path");switch(r&&Os(t,e,r,n),e.tagName){case"svg":case"symbol":(function(s,i,a){let o=parseFloat(i.getAttribute("width")),l=parseFloat(i.getAttribute("height"));(isNaN(o)||isNaN(l))&&(o=l=void 0),Bn(s,i,a,o,l)})(t,e,n);break;case"rect":(function(s,i,a){const o=i.x.baseVal.value,l=i.y.baseVal.value,u=i.width.baseVal.value,h=i.height.baseVal.value;if(u===0||h===0)return;let c=i.hasAttribute("rx")?Math.min(Math.max(0,i.rx.baseVal.value),u/2):null,p=i.hasAttribute("ry")?Math.min(Math.max(0,i.ry.baseVal.value),h/2):null;c===null&&p===null||(c=c===null?p:c,p=p===null?c:p);const f=E({x:o,y:l},a),d=E({x:o+u,y:l+h},a),m=d.x-f.x,g=d.y-f.y,v={x:f.x,y:f.y,w:m,h:g};if(!Pt(a)&&!he(a)||c||p){let x="";if(c!==null&&p!==null){const M=1.3333333333333333*(Math.sqrt(2)-1),O=E({x:o+c,y:l},a);x+=`M ${C(O)}`,x+=`L ${C(E({x:o+u-c,y:l},a))}`;const y=E({x:o+u-c+M*c,y:l},a),S=E({x:o+u,y:l+M*p},a),T=E({x:o+u,y:l+p},a);x+=`C ${C(y)} ${C(S)} ${C(T)}`,x+=`L ${C(E({x:o+u,y:l+h-p},a))}`;const N=E({x:o+u,y:l+h-p+M*p},a),G=E({x:o+u-M*c,y:l+h},a),U=E({x:o+u-c,y:l+h},a);x+=`C ${C(N)} ${C(G)} ${C(U)}`,x+=`L ${C(E({x:o+c,y:l+h},a))}`;const P=E({x:o+c-M*c,y:l+h},a),k=E({x:o,y:l+h-M*p},a),I=E({x:o,y:l+h-p},a);x+=`C ${C(P)} ${C(k)} ${C(I)}`,x+=`L ${C(E({x:o,y:l+p},a))}`;const R=E({x:o,y:l+M*p},a),F=E({x:o+M*c,y:l},a);x+=`C ${C(R)} ${C(F)} ${C(O)}`,x+="z"}else{const M=E({x:o,y:l},a),O=E({x:o+u,y:l},a),y=E({x:o+u,y:l+h},a),S=E({x:o,y:l+h},a);x+=`M ${C(M)}`,x+=`L ${C(O)}`,x+=`L ${C(y)}`,x+=`L ${C(S)}`,x+="z"}const _=Bt(s,x,ot(s,i,a));dn(s,i,v),K(s,i,_)}else{const x=s.rc.rectangle(v.x,v.y,v.w,v.h,ot(s,i,a));dn(s,i,v),K(s,i,x)}})(t,e,n);break;case"path":(function(s,i,a){const o=i.getAttribute("d"),l=new b(o).toAbs().transform(L.NORMALIZE_HVZ()).transform(L.NORMALIZE_ST()),u=new b(l.commands.map(d=>Object.assign({},d)));a&&u.transform(L.MATRIX(a.matrix.a,a.matrix.b,a.matrix.c,a.matrix.d,a.matrix.e,a.matrix.f));const h=Dn(u.commands);if(h.indexOf("undefined")!==-1)return void console.error("broken path data");const c=Bt(s,h,ot(s,i,a));wt(s,i,()=>{const d=document.createElementNS("http://www.w3.org/2000/svg","path");return d.setAttribute("d",h),d}),K(s,i,c);const p=[];let f;l.commands.forEach(d=>{switch(d.type){case b.MOVE_TO:{const m={x:d.x,y:d.y};p.push(m),f=m;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:p.push({x:d.x,y:d.y});break;case b.HORIZ_LINE_TO:p.push({x:d.x,y:0});break;case b.VERT_LINE_TO:p.push({x:0,y:d.y});break;case b.CLOSE_PATH:f&&p.push(f)}}),Ut(s,i,p,a)})(t,e,n);break;case"use":(function(s,i,a){let o=i.href.baseVal;o.startsWith("#")&&(o=o.substring(1));const l=s.idElements[o];if(l){let u,h;i.getAttribute("width")&&i.getAttribute("height")&&(u=i.width.baseVal.value,h=i.height.baseVal.value);const c=i.x.baseVal.value,p=i.y.baseVal.value;let f=s.sourceSvg.createSVGMatrix().translate(c,p);f=a?a.matrix.multiply(f):f;const d=s.sourceSvg.createSVGTransformFromMatrix(f);if(s.useElementContext){const m={root:i,referenced:l,parentContext:Object.assign({},s.useElementContext)};s.useElementContext=m}else s.useElementContext={root:i,referenced:l,parentContext:null};s.processElement(s,l,Lt(s,l,d),u,h),s.useElementContext.parentContext?s.useElementContext=s.useElementContext.parentContext:s.useElementContext=null}})(t,e,n);break;case"line":(function(s,i,a){const o={x:i.x1.baseVal.value,y:i.y1.baseVal.value},l={x:i.x2.baseVal.value,y:i.y2.baseVal.value},{x:u,y:h}=E(o,a),{x:c,y:p}=E(l,a);if(u===c&&h===p)return;const f=s.rc.line(u,h,c,p,ot(s,i,a));wt(s,i,()=>{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=p,d}),K(s,i,f),Ut(s,i,[o,l],a)})(t,e,n);break;case"circle":(function(s,i,a){const o=i.cx.baseVal.value,l=i.cy.baseVal.value,u=i.r.baseVal.value;if(u===0)return;const h=E({x:o,y:l},a),c=E({x:o+u,y:l+u},a).x-h.x;let p;if(Pt(a)||he(a))p=s.rc.circle(h.x,h.y,2*c,Object.assign(Object.assign({},ot(s,i,a)),{preserveVertices:!0}));else{const f=1.3333333333333333*(Math.sqrt(2)-1),d=E({x:o+u,y:l},a),m=E({x:o,y:l+u},a),g=E({x:o-u,y:l},a),v=E({x:o,y:l-u},a),x=E({x:o+u,y:l+f*u},a),_=E({x:o+f*u,y:l+u},a),M=E({x:o-u,y:l+f*u},a),O=E({x:o-f*u,y:l-u},a),y=E({x:o+u,y:l-f*u},a);p=Bt(s,`M ${C(d)} C ${C(x)} ${C(_)} ${C(m)} S ${C(M)} ${C(g)} S ${C(O)} ${C(v)} S ${C(y)} ${C(d)}z`,ot(s,i,a))}wt(s,i,()=>{const f=document.createElementNS("http://www.w3.org/2000/svg","circle");return f.cx.baseVal.value=h.x,f.cy.baseVal.value=h.y,f.r.baseVal.value=c,f}),K(s,i,p)})(t,e,n);break;case"ellipse":(function(s,i,a){const o=i.cx.baseVal.value,l=i.cy.baseVal.value,u=i.rx.baseVal.value,h=i.ry.baseVal.value;if(u===0||h===0)return;const c=E({x:o,y:l},a),p=E({x:o+u,y:l+h},a),f=p.x-c.x,d=p.y-c.y;let m;if(Pt(a)||he(a))m=s.rc.ellipse(c.x,c.y,2*f,2*d,Object.assign(Object.assign({},ot(s,i,a)),{preserveVertices:!0}));else{const g=1.3333333333333333*(Math.sqrt(2)-1),v=E({x:o+u,y:l},a),x=E({x:o,y:l+h},a),_=E({x:o-u,y:l},a),M=E({x:o,y:l-h},a),O=E({x:o+u,y:l+g*h},a),y=E({x:o+g*u,y:l+h},a),S=E({x:o-u,y:l+g*h},a),T=E({x:o-g*u,y:l-h},a),N=E({x:o+u,y:l-g*h},a);m=Bt(s,`M ${C(v)} C ${C(O)} ${C(y)} ${C(x)} S ${C(S)} ${C(_)} S ${C(T)} ${C(M)} S ${C(N)} ${C(v)}z`,ot(s,i,a))}wt(s,i,()=>{const g=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return g.cx.baseVal.value=c.x,g.cy.baseVal.value=c.y,g.rx.baseVal.value=f,g.ry.baseVal.value=d,g}),K(s,i,m)})(t,e,n);break;case"polyline":(function(s,i,a){const o=sn(i),l=o.map(h=>{const c=E(h,a);return[c.x,c.y]}),u=ot(s,i,a);if(wt(s,i,()=>{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"});K(s,i,s.rc.polygon(l,h))}K(s,i,s.rc.linearPath(l,u)),Ut(s,i,o,a)})(t,e,n);break;case"polygon":(function(s,i,a){const o=sn(i),l=o.map(h=>{const c=E(h,a);return[c.x,c.y]}),u=s.rc.polygon(l,ot(s,i,a));wt(s,i,()=>{const h=document.createElementNS("http://www.w3.org/2000/svg","polygon");return h.setAttribute("points",l.join(" ")),h}),K(s,i,u),o.length>0&&(o.push(o[0]),Ut(s,i,o,a))})(t,e,n);break;case"text":Ns(t,e,n);break;case"image":(function(s,i,a){const o=i.href.baseVal,l=i.x.baseVal.value,u=i.y.baseVal.value;let h,c;if(i.getAttribute("width")&&i.getAttribute("height")&&(h=i.width.baseVal.value,c=i.height.baseVal.value),o.startsWith("data:")&&o.indexOf("image/svg+xml")!==-1){const p=/^data:([^,]*),(.*)/.exec(o);if(p&&p.length>2){const f=p[1];let d=p[2];const m=f.indexOf("base64")!==-1,g=f.indexOf("utf8")!==-1;m&&(d=atob(d)),g||(d=decodeURIComponent(d));const v=new DOMParser().parseFromString(d,"image/svg+xml").firstChild;let x=s.sourceSvg.createSVGMatrix().translate(l,u);x=a?a.matrix.multiply(x):x,s.processElement(s,v,s.sourceSvg.createSVGTransformFromMatrix(x),h,c)}}else{const p=i.cloneNode(),f=document.createElementNS("http://www.w3.org/2000/svg","g");mt(0,a,f),f.appendChild(p),K(s,i,f)}})(t,e,n);break;case"foreignObject":(function(s,i,a){const o=i.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(i);for(const c of u)l.style.setProperty(c,h.getPropertyValue(c));o.transform.baseVal.clear(),mt(0,a,l),l.appendChild(o),K(s,o,l)})(t,e,n)}}class Ps{constructor(e){this.rng=e?new _n(e):null}next(e){var n,r;const s=(r=(n=this.rng)===null||n===void 0?void 0:n.next())!==null&&r!==void 0?r:Math.random();if(e){const i=e[0];return s*(e[1]-i)+i}return s}}class Rs{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===ft.CANVAS&&this.outputElement instanceof SVGSVGElement||e===ft.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=ft.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 s=typeof e=="string"?document.querySelector(e):e;if(!s)throw new Error("Could not find target in document");this.roughConfig=r,this.outputElement=s,s instanceof HTMLCanvasElement?this.$outputType=ft.CANVAS:s instanceof SVGSVGElement?this.$outputType=ft.SVG:this.$outputType=n}sketch(e=!1){var n,r;if(!this.svg)return Promise.resolve(null);e&&this.sourceSvgChanged();const s=this.prepareRenderContainer(),i=this.createRenderContext(s);if(this.pencilFilter&&Oe(i).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}()),i.processElement(i,this.svg,null,this.width,this.height),this.outputElement instanceof SVGSVGElement)return Promise.resolve(this.outputElement);if(this.outputElement instanceof HTMLCanvasElement)return this.drawToCanvas(i,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===ft.SVG){const a=i.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(i,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:$r.svg(e,{options:n}),roughConfig:this.roughConfig,fontFamily:this.fontFamily,pencilFilter:this.pencilFilter,randomize:this.randomize,rng:new Ps(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:Bn}}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(s=>{const i=new XMLSerializer().serializeToString(e.svgSketch),a=new Image;a.onload=function(){r.drawImage(this,0,0),s(n)},a.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(i)}`})}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 s=r;const i=e.hasAttribute("viewBox");return e.hasAttribute(n)?s=e[n].baseVal.unitType===SVGLength.SVG_LENGTHTYPE_PERCENTAGE&&i?e.viewBox.baseVal[n]:e[n].baseVal.value:i&&(s=e.viewBox.baseVal[n]),s}}function gn(t,e,n){const r=t.slice();return r[19]=e[n],r}function vn(t){let e,n;function r(a,o){return a[2]?zs:Is}let s=r(t),i=s(t);return{c(){e=Mt("div"),i.c(),this.h()},l(a){e=St(a,"DIV",{class:!0,id:!0});var o=Rt(e);i.l(o),o.forEach(Z),this.h()},h(){gt(e,"class",n="absolute z-10 w-full p-2 font-mono "+(t[2]?"text-red-600":"text-yellow-600")+" bg-base-100 bg-opacity-80 text-left"),gt(e,"id","errorContainer")},m(a,o){$(a,e,o),i.m(e,null)},p(a,o){s===(s=r(a))&&i?i.p(a,o):(i.d(1),i=s(a),i&&(i.c(),i.m(e,null))),o&4&&n!==(n="absolute z-10 w-full p-2 font-mono "+(a[2]?"text-red-600":"text-yellow-600")+" bg-base-100 bg-opacity-80 text-left")&&gt(e,"class",n)},d(a){a&&Z(e),i.d()}}}function Is(t){let e,n,r,s;function i(l,u){return l[6].autoSync?Ds:Ls}let a=i(t),o=a(t);return{c(){e=pt("Diagram out of sync. "),n=Mt("br"),r=yn(),o.c(),s=jt()},l(l){e=dt(l,"Diagram out of sync. "),n=St(l,"BR",{}),r=xn(l),o.l(l),s=jt()},m(l,u){$(l,e,u),$(l,n,u),$(l,r,u),o.m(l,u),$(l,s,u)},p(l,u){a!==(a=i(l))&&(o.d(1),o=a(l),o&&(o.c(),o.m(s.parentNode,s)))},d(l){l&&(Z(e),Z(n),Z(r),Z(s)),o.d(l)}}}function zs(t){let e,n=Le(t[3]),r=[];for(let s=0;s<n.length;s+=1)r[s]=bn(gn(t,n,s));return{c(){for(let s=0;s<r.length;s+=1)r[s].c();e=jt()},l(s){for(let i=0;i<r.length;i+=1)r[i].l(s);e=jt()},m(s,i){for(let a=0;a<r.length;a+=1)r[a]&&r[a].m(s,i);$(s,e,i)},p(s,i){if(i&8){n=Le(s[3]);let a;for(a=0;a<n.length;a+=1){const o=gn(s,n,a);r[a]?r[a].p(o,i):(r[a]=bn(o),r[a].c(),r[a].m(e.parentNode,e))}for(;a<r.length;a+=1)r[a].d(1);r.length=n.length}},d(s){s&&Z(e),jn(r,s)}}}function Ls(t){let e,n,r,s,i,a,o;return{c(){e=pt("Press "),n=Mt("i"),r=pt(" (Sync button) or "),s=Mt("kbd"),i=pt(ze),a=pt(" + Enter"),o=pt(" to sync."),this.h()},l(l){e=dt(l,"Press "),n=St(l,"I",{class:!0}),Rt(n).forEach(Z),r=dt(l," (Sync button) or "),s=St(l,"KBD",{});var u=Rt(s);i=dt(u,ze),a=dt(u," + Enter"),u.forEach(Z),o=dt(l," to sync."),this.h()},h(){gt(n,"class","fas fa-sync")},m(l,u){$(l,e,u),$(l,n,u),$(l,r,u),$(l,s,u),pe(s,i),pe(s,a),$(l,o,u)},d(l){l&&(Z(e),Z(n),Z(r),Z(s),Z(o))}}}function Ds(t){let e;return{c(){e=pt("It will be updated automatically.")},l(n){e=dt(n,"It will be updated automatically.")},m(n,r){$(n,e,r)},d(n){n&&Z(e)}}}function bn(t){let e=t[19]+"",n,r;return{c(){n=pt(e),r=Mt("br")},l(s){n=dt(s,e),r=St(s,"BR",{})},m(s,i){$(s,n,i),$(s,r,i)},p(s,i){i&8&&e!==(e=s[19]+"")&&Xn(n,e)},d(s){s&&(Z(n),Z(r))}}}function Zs(t){let e,n,r,s=(t[2]&&t[6].error instanceof Error||t[4])&&vn(t);return{c(){s&&s.c(),e=yn(),n=Mt("div"),r=Mt("div"),this.h()},l(i){s&&s.l(i),e=xn(i),n=St(i,"DIV",{id:!0,class:!0});var a=Rt(n);r=St(a,"DIV",{id:!0,class:!0}),Rt(r).forEach(Z),a.forEach(Z),this.h()},h(){gt(r,"id","container"),gt(r,"class","h-full overflow-auto svelte-1ewr4tw"),Et(r,"hide",t[5]),gt(n,"id","view"),gt(n,"class","h-full p-2 svelte-1ewr4tw"),Et(n,"error",t[2]),Et(n,"outOfSync",t[4])},m(i,a){s&&s.m(i,a),$(i,e,a),$(i,n,a),pe(n,r),t[7](r),t[8](n)},p(i,[a]){i[2]&&i[6].error instanceof Error||i[4]?s?s.p(i,a):(s=vn(i),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),a&32&&Et(r,"hide",i[5]),a&4&&Et(n,"error",i[2]),a&16&&Et(n,"outOfSync",i[4])},i:Ne,o:Ne,d(i){i&&(Z(e),Z(n)),s&&s.d(i),t[7](null),t[8](null)}}}function Fs(t,e,n){let r,s;Ve(t,de,y=>n(6,r=y)),Ve(t,re,y=>n(15,s=y));let i="",a="",o,l,u,h=!1,c=[],p=!1,f=!1,d=!0,m=r.panZoom,g;const v=()=>{if(!g)return;const y=g.getPan(),S=g.getZoom();nr({pan:y,zoom:S}),rr("panZoom")},x=y=>{y.panZoom&&(n(5,f=!0),g==null||g.destroy(),g=void 0,Promise.resolve().then(()=>{const S=document.querySelector("#graph-div");if(!S)return;g=gr(S,{onPan:v,onZoom:v,controlIconsEnabled:!0,fit:!0,center:!0});const{pan:T,zoom:N}=y;T!==void 0&&N!==void 0&&Number.isFinite(N)&&(g.zoom(N),g.pan(T)),n(5,f=!1)}))},_=async y=>{var N;const S=Date.now();if(y.error!==void 0){n(2,h=!0),n(3,c=y.error.toString().split(`
`));return}n(2,h=!1);try{if(o&&y&&(y.updateDiagram||y.autoSync)){if(y.autoSync||Pe(re,s.updateDiagram=!1,s),n(4,p=!1),d=!0,i===y.code&&a===y.mermaid&&m===y.panZoom&&l===y.rough)return;if(!ar()){n(4,p=!0);return}i=y.code,a=y.mermaid,m=y.panZoom,l=y.rough;const G=(N=u.parentElement)==null?void 0:N.scrollTop;delete o.dataset.processed;const{svg:U,bindFunctions:P}=await tr(Object.assign({},JSON.parse(y.mermaid)),i,"graph-div");if(U.length>0){x(y),n(0,o.innerHTML=U,o);const k=document.querySelector("#graph-div");if(!k)throw new Error("graph-div not found");if(y.rough){const I=new Rs("#container");I.svg=k,await I.sketch(),k.remove();const R=document.querySelector("#container > svg");if(!R)throw new Error("sketch not found");const F=R.getAttribute("height"),W=R.getAttribute("width");R.setAttribute("height","100%"),R.setAttribute("width","100%"),R.setAttribute("viewBox",`0 0 ${W} ${F}`),R.style.maxWidth="100%"}else k.setAttribute("height","100%"),k.style.maxWidth="100%",P&&P(k)}u.parentElement&&G&&n(1,u.parentElement.scrollTop=G,u),n(2,h=!1)}else d?d=!1:(i!==y.code||a!==y.mermaid)&&n(4,p=!0)}catch(G){console.error("view fail",G),n(2,h=!0)}const T=Date.now()-S;er({code:i,renderTime:T,isRough:y.rough}),or(T,()=>{Pe(re,s.updateDiagram=!0,s)})};$n(()=>{de.subscribe(y=>{_(y)}),window.addEventListener("resize",()=>{r.panZoom&&g&&g.resize()})});function M(y){Re[y?"unshift":"push"](()=>{o=y,n(0,o)})}function O(y){Re[y?"unshift":"push"](()=>{u=y,n(1,u)})}return[o,u,h,c,p,f,r,M,O]}class qs extends Yn{constructor(e){super(),Qn(this,e,Fs,Zs,Wn,{})}}export{qs as V,Le as e,Gs as w};