formatSvgToImg.a06e86c5.js 115 KB

123456789101112131415
  1. import{b6 as Ye}from"./ResizeObserver.es.39b48a47.js";const re={"Acoustic Grand Piano":"\u5927\u94A2\u7434","Bright Acoustic Piano":"\u660E\u4EAE\u7684\u94A2\u7434","Electric Grand Piano":"\u7535\u94A2\u7434","Rhodes Piano":"\u67D4\u548C\u7684\u7535\u94A2\u7434","Chorused Piano":"\u52A0\u5408\u5531\u6548\u679C\u7684\u7535\u94A2\u7434",Harpsichord:"\u7FBD\u7BA1\u952E\u7434",Clavichord:"\u79D1\u62C9\u7EF4\u79D1\u7279\u7434",Celesta:"\u94A2\u7247\u7434",Glockenspiel:"\u94A2\u7247\u7434","Music box":"\u516B\u97F3\u76D2",Vibraphone:"\u98A4\u97F3\u7434",Marimba:"\u9A6C\u6797\u5DF4",Xylophone:"\u6728\u7434","Tubular Bells":"\u7BA1\u949F",Dulcimer:"\u5927\u626C\u7434","Hammond Organ":"\u51FB\u6746\u98CE\u7434","Percussive Organ":"\u6253\u51FB\u5F0F\u98CE\u7434","Rock Organ":"\u6447\u6EDA\u98CE\u7434","Church Organ":"\u6559\u5802\u98CE\u7434","Reed Organ":"\u7C27\u7BA1\u98CE\u7434",Accordian:"\u624B\u98CE\u7434",Harmonica:"\u53E3\u7434","Tango Accordian":"\u63A2\u6208\u624B\u98CE\u7434","Acoustic Guitar":"\u94A2\u5F26\u5409\u4ED6","Electric Guitar":"\u95F7\u97F3\u7535\u5409\u4ED6","Overdriven Guitar":"\u52A0\u9A71\u52A8\u6548\u679C\u7684\u7535\u5409\u4ED6","Distortion Guitar":"\u52A0\u5931\u771F\u6548\u679C\u7684\u7535\u5409\u4ED6","Guitar Harmonics":"\u5409\u4ED6\u548C\u97F3","Acoustic Bass":"\u5927\u8D1D\u53F8","Electric Bass":"\u7535\u8D1D\u53F8","Fretless Bass":"\u65E0\u54C1\u8D1D\u53F8","Slap Bass":"\u638C\u51FB","Synth Bass":"\u7535\u5B50\u5408\u6210",Violin:"\u5C0F\u63D0\u7434",Viola:"\u4E2D\u63D0\u7434",Cello:"\u5927\u63D0\u7434",Contrabass:"\u4F4E\u97F3\u5927\u63D0\u7434","Tremolo Strings":"\u5F26\u4E50\u7FA4\u98A4\u97F3\u97F3\u8272","Pizzicato Strings":"\u5F26\u4E50\u7FA4\u62E8\u5F26\u97F3\u8272","Orchestral Harp":"\u7AD6\u7434",Timpani:"\u5B9A\u97F3\u9F13","String Ensemble":"\u5F26\u4E50\u5408\u594F\u97F3\u8272","Synth Strings":"\u5408\u6210\u5F26\u4E50\u5408\u594F\u97F3\u8272","Choir Aahs":"\u4EBA\u58F0\u5408\u5531","Voice Oohs":"\u4EBA\u58F0","Synth Voice":"\u5408\u6210\u4EBA\u58F0","Orchestra Hit":"\u7BA1\u5F26\u4E50\u6572\u51FB\u9F50\u594F",Trumpet:"\u5C0F\u53F7",Trombone:"\u957F\u53F7",Tuba:"\u5927\u53F7","Muted Trumpet":"\u52A0\u5F31\u97F3\u5668\u5C0F\u53F7","French Horn":"\u6CD5\u56FD\u53F7","Brass Section":"\u94DC\u7BA1\u7EC4","Synth Brass":"\u5408\u6210\u94DC\u7BA1\u97F3\u8272","Soprano Sax":"\u9AD8\u97F3\u8428\u514B\u65AF\u7BA1","Alto Sax":"\u4E2D\u97F3\u8428\u514B\u65AF\u7BA1","Tenor Sax":"\u6B21\u4E2D\u97F3\u8428\u514B\u65AF\u7BA1","Baritone Sax":"\u4F4E\u97F3\u8428\u514B\u65AF\u7BA1",Oboe:"\u53CC\u7C27\u7BA1","English Horn":"\u82F1\u56FD\u7BA1",Bassoon:"\u5DF4\u677E","Soprano Saxophone":"\u9AD8\u97F3\u8428\u514B\u65AF\u7BA1","Alto Saxophone":"\u4E2D\u97F3\u8428\u514B\u65AF\u7BA1","Tenor Saxophone":"\u6B21\u4E2D\u97F3\u8428\u514B\u65AF\u7BA1","Baritone Saxophone":"\u4E0A\u4F4E\u97F3\u8428\u514B\u65AF\u7BA1",Piccolo:"\u77ED\u7B1B",Flute:"\u957F\u7B1B",Recorder:"\u7AD6\u7B1B","Soprano Recorder":"\u9AD8\u97F3\u7AD6\u7B1B","Pan Flute":"\u6392\u7BAB","Bottle Blow":"\u74F6\u6728\u7BA1",Whistle:"\u53E3\u54E8\u58F0",Ocarina:"\u9676\u7B1B",Lead:"\u5408\u6210\u4E3B\u97F3","Lead lead":"\u5408\u6210\u4E3B\u97F3","Pad age":"\u5408\u6210\u97F3\u8272",Pad:"\u5408\u6210\u97F3\u8272",FX:"\u5408\u6210\u6548\u679C \u79D1\u5E7B",Sitar:"\u897F\u5854\u5C14",Banjo:"\u73ED\u5353\u7434",Shamisen:"\u4E09\u6627\u7EBF",Koto:"\u5341\u4E09\u5F26\u7B5D",Kalimba:"\u5361\u6797\u5DF4",Bagpipe:"\u98CE\u7B1B",Fiddle:"\u6C11\u65CF\u63D0\u7434",Shanai:"\u5C71\u5948","Tinkle Bell":"\u53EE\u5F53\u94C3",Agogos:"\u963F\u6208\u6208\u94C3","Steel Drums":"\u94A2\u9F13","Taiko Drum":"\u592A\u9F13","Melodic Toms":"\u55F5\u55F5\u9F13","Synth Drums":"\u5408\u6210\u9F13","Reverse Cymbals":"\u53CD\u5411\u9572","Agogo Bells":"\u963F\u6208\u6208\u94C3","Taiko Drums":"\u592A\u9F13",Bongos:"\u90A6\u6208\u9F13","Bongo Bell":"\u90A6\u6208\u94C3",Congas:"\u5EB7\u52A0\u9F13",Guiro:"\u522E\u58F6","Guitar Fret Noise":"\u5409\u4ED6\u6362\u628A\u6742\u97F3","Breath Noise":"\u547C\u5438\u58F0",Seashore:"\u6D77\u6D6A\u58F0","Bird Tweet":"\u9E1F\u9E23","Telephone Ring":"\u7535\u8BDD\u94C3",Helicopter:"\u76F4\u5347\u673A",Applause:"\u9F13\u638C\u58F0",Gunshot:"\u67AA\u58F0","Acoustic Bass Drum":"\u5927\u9F13","Bass Drum":"\u5927\u9F13","Side Drum":"\u5C0F\u9F13\u9F13\u8FB9","Acoustic Snare":"\u5C0F\u9F13","Hand Claps":"\u62CD\u624B","Electric Snare":"\u5C0F\u9F13","Low Floor Tom":"\u4F4E\u97F3\u55F5\u9F13","Closed Hi-Hat":"\u95ED\u5408\u8E29\u9572","High Floor Tom":"\u9AD8\u97F3\u843D\u5730\u55F5\u9F13","Pedal Hi-Hat":"\u811A\u8E0F\u8E29\u9572","Low Tom":"\u4F4E\u97F3\u55F5\u9F13","Open Hi-Hat":"\u5F00\u97F3\u8E29\u9572","Low-Mid Tom":"\u4E2D\u4F4E\u97F3\u55F5\u9F13","Hi Mid Tom":"\u9AD8\u97F3\u9F13","Crash Cymbals":"\u5BF9\u9572","High Tom":"\u9AD8\u97F3\u55F5\u9F13","Ride Cymbals":"\u53EE\u53EE\u9572","Chinese Cymbals":"\u4E2D\u56FD\u9572","Ride Bell":"\u5706\u94C3",Tambourine:"\u94C3\u9F13","Splash Cymbal":"\u6E85\u97F3\u9572",Cowbell:"\u725B\u94C3","Crash Cymbal":"\u5F3A\u97F3\u94B9","Vibra-Slap":"\u98A4\u97F3\u5668","Ride Cymbal":"\u6253\u70B9\u94B9","Hi Bongo":"\u9AD8\u97F3\u90A6\u6208\u9F13","Low Bongo":"\u4F4E\u97F3\u90A6\u6208\u9F13","Mute Hi Conga":"\u5F31\u97F3\u9AD8\u97F3\u5EB7\u52A0\u9F13","Open Hi Conga":"\u5F3A\u97F3\u9AD8\u97F3\u5EB7\u52A0\u9F13","Low Conga":"\u4F4E\u97F3\u5EB7\u52A0\u9F13","High Timbale":"\u9AD8\u97F3\u5929\u5DF4\u9F13","Low Timbale":"\u4F4E\u97F3\u5929\u5DF4\u9F13","High Agogo":"\u9AD8\u97F3\u963F\u6208\u6208\u94C3","Low Agogo":"\u4F4E\u97F3\u963F\u6208\u6208\u94C3",Cabasa:"\u5361\u5DF4\u8428",Maracas:"\u6C99\u9524","Short Whistle":"\u77ED\u53E3\u54E8","Long Whistle":"\u957F\u53E3\u54E8","Short Guiro":"\u77ED\u522E\u58F6","Long Guiro":"\u957F\u522E\u58F6",Claves:"\u54CD\u68D2","Hi Wood Block":"\u9AD8\u97F3\u6728\u9C7C","Low Wood Block":"\u4F4E\u97F3\u6728\u9C7C","Mute Triangle":"\u5F31\u97F3\u4E09\u89D2\u94C1","Open Triangle":"\u5F3A\u97F3\u4E09\u89D2\u94C1","Drum Set":"\u67B6\u5B50\u9F13","Hulusi flute":"\u846B\u82A6\u4E1D",Melodica:"\u53E3\u98CE\u7434","Snare Drum":"\u5C0F\u519B\u9F13","Horn in F":"\u5706\u53F7",Triangle:"\u4E09\u89D2\u94C1",Vibrato:"\u98A4\u97F3\u7434","Suspend Cymbals":"\u540A\u9572","Suspended Cymbals":"\u540A\u9572","Tom-Toms":"\u55F5\u55F5\u9F13",Bell:"\u94C3\u94DB",Bells:"\u94C3\u94DB","Alto Clarinet":"\u4E2D\u97F3\u5355\u7C27\u7BA1","Bass Clarinet":"\u4F4E\u97F3\u5355\u7C27\u7BA1",Clarinet:"\u5355\u7C27\u7BA1",Cornet:"\u77ED\u53F7",Euphonium:"\u4E0A\u4F4E\u97F3\u53F7","crash cymbals":"\u5BF9\u9572",Castanets:"\u54CD\u677F",Shaker:"\u6C99\u9524","Mark tree":"\u97F3\u6811",Chimes:"\u7BA1\u949F","Mark Tree":"\u97F3\u6811","Tom-toms":"\u55F5\u55F5\u9F13","Hi-Hat":"\u8E29\u9572","Sleigh Bells":"\u96EA\u6A47\u94C3",Flexatone:"\u5F39\u97F3\u5668","Brake drum":"\u95F8\u9F13",Gong:"\u9523","concert tom":"\u97F3\u4E50\u4F1A\u55F5\u55F5\u9F13","brake drum":"\u8F66\u8F6E\u9F13","finger cymbal":"\u6307\u94B9","ride cymbal":"\u53EE\u53EE\u9572","Concert Toms":"\u97F3\u4E50\u4F1A\u55F5\u55F5\u9F13",Vibraslap:"\u5F39\u97F3\u5668","Wood Blocks":"\u6728\u9C7C","Temple Blocks":"\u6728\u9C7C","Wood Block":"\u6728\u9C7C","Field Drum":"\u519B\u9F13","Quad-Toms":"\u7B52\u9F13",Quads:"\u7B52\u9F13","Drums set":"\u67B6\u5B50\u9F13","High Bongo":"\u90A6\u6208",Timbales:"\u5929\u5DF4\u9F13","rain stick":"\u96E8\u68D2","String Bass":"\u5F26\u4E50\u4F4E\u97F3","Floor Tom":"\u4FA7\u55F5\u9F13","Brake Drum":"\u95F8\u9F13","Tam-tam":"\u5927\u9523",Cymbal:"\u9572",Cymbals:"\u9572",Whip:"\u4E50\u97AD",whip:"\u4E50\u97AD"},Os=h=>{const t=h.replace(/ /g," ").toLocaleLowerCase(),e=Object.keys(re);for(let i=0;i<e.length;i++)if(e[i].replace(/ /g," ").toLocaleLowerCase()===t)return re[e[i]]||"";for(let i=0;i<e.length;i++){const s=e[i].replace(/ /g," ").toLocaleLowerCase();if(t.includes(s))return re[e[i]]||""}return""};var Ut={exports:{}},Et={exports:{}};(function(){var h,t,e,i,s,r;typeof performance!="undefined"&&performance!==null&&performance.now?Et.exports=function(){return performance.now()}:typeof process!="undefined"&&process!==null&&process.hrtime?(Et.exports=function(){return(h()-s)/1e6},t=process.hrtime,h=function(){var o;return o=t(),o[0]*1e9+o[1]},i=h(),r=process.uptime()*1e9,s=i-r):Date.now?(Et.exports=function(){return Date.now()-e},e=Date.now()):(Et.exports=function(){return new Date().getTime()-e},e=new Date().getTime())}).call(Ye);var oi=Et.exports,st=typeof window=="undefined"?Ye:window,It=["moz","webkit"],vt="AnimationFrame",Ct=st["request"+vt],wt=st["cancel"+vt]||st["cancelRequest"+vt];for(var Tt=0;!Ct&&Tt<It.length;Tt++)Ct=st[It[Tt]+"Request"+vt],wt=st[It[Tt]+"Cancel"+vt]||st[It[Tt]+"CancelRequest"+vt];if(!Ct||!wt){var ne=0,Ee=0,gt=[],ai=1e3/60;Ct=function(h){if(gt.length===0){var t=oi(),e=Math.max(0,ai-(t-ne));ne=e+t,setTimeout(function(){var i=gt.slice(0);gt.length=0;for(var s=0;s<i.length;s++)if(!i[s].cancelled)try{i[s].callback(ne)}catch(r){setTimeout(function(){throw r},0)}},Math.round(e))}return gt.push({handle:++Ee,callback:h,cancelled:!1}),Ee},wt=function(h){for(var t=0;t<gt.length;t++)gt[t].handle===h&&(gt[t].cancelled=!0)}}Ut.exports=function(h){return Ct.call(st,h)};Ut.exports.cancel=function(){wt.apply(st,arguments)};Ut.exports.polyfill=function(h){h||(h=st),h.requestAnimationFrame=Ct,h.cancelAnimationFrame=wt};var oe=Ut.exports,le=function(h){this.ok=!1,this.alpha=1,h.charAt(0)=="#"&&(h=h.substr(1,6)),h=h.replace(/ /g,""),h=h.toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",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",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",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:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};h=t[h]||h;for(var e=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseFloat(a[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],i=0;i<e.length;i++){var s=e[i].re,r=e[i].process,o=s.exec(h);if(o){var n=r(o);this.r=n[0],this.g=n[1],this.b=n[2],n.length>3&&(this.alpha=n[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var a=this.r.toString(16),u=this.g.toString(16),l=this.b.toString(16);return a.length==1&&(a="0"+a),u.length==1&&(u="0"+u),l.length==1&&(l="0"+l),"#"+a+u+l},this.getHelpXML=function(){for(var a=new Array,u=0;u<e.length;u++)for(var l=e[u].example,f=0;f<l.length;f++)a[a.length]=l[f];for(var g in t)a[a.length]=g;var c=document.createElement("ul");c.setAttribute("id","rgbcolor-examples");for(var u=0;u<a.length;u++)try{var d=document.createElement("li"),p=new RGBColor(a[u]),y=document.createElement("div");y.style.cssText="margin: 3px; border: 1px solid black; background:"+p.toHex()+"; color:"+p.toHex(),y.appendChild(document.createTextNode("test"));var x=document.createTextNode(" "+a[u]+" -> "+p.toRGB()+" -> "+p.toHex());d.appendChild(y),d.appendChild(x),c.appendChild(d)}catch{}return c}};/*! *****************************************************************************
  2. Copyright (c) Microsoft Corporation.
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted.
  5. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  7. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  8. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  9. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  10. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  11. PERFORMANCE OF THIS SOFTWARE.
  12. ***************************************************************************** */var We=function(h,t){return(We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])})(h,t)};function Ge(h,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=h}We(h,t),h.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function ui(h){var t="";Array.isArray(h)||(h=[h]);for(var e=0;e<h.length;e++){var i=h[e];if(i.type===m.CLOSE_PATH)t+="z";else if(i.type===m.HORIZ_LINE_TO)t+=(i.relative?"h":"H")+i.x;else if(i.type===m.VERT_LINE_TO)t+=(i.relative?"v":"V")+i.y;else if(i.type===m.MOVE_TO)t+=(i.relative?"m":"M")+i.x+" "+i.y;else if(i.type===m.LINE_TO)t+=(i.relative?"l":"L")+i.x+" "+i.y;else if(i.type===m.CURVE_TO)t+=(i.relative?"c":"C")+i.x1+" "+i.y1+" "+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===m.SMOOTH_CURVE_TO)t+=(i.relative?"s":"S")+i.x2+" "+i.y2+" "+i.x+" "+i.y;else if(i.type===m.QUAD_TO)t+=(i.relative?"q":"Q")+i.x1+" "+i.y1+" "+i.x+" "+i.y;else if(i.type===m.SMOOTH_QUAD_TO)t+=(i.relative?"t":"T")+i.x+" "+i.y;else{if(i.type!==m.ARC)throw new Error('Unexpected command type "'+i.type+'" at index '+e+".");t+=(i.relative?"a":"A")+i.rX+" "+i.rY+" "+i.xRot+" "+ +i.lArcFlag+" "+ +i.sweepFlag+" "+i.x+" "+i.y}}return t}function ce(h,t){var e=h[0],i=h[1];return[e*Math.cos(t)-i*Math.sin(t),e*Math.sin(t)+i*Math.cos(t)]}function K(){for(var h=[],t=0;t<arguments.length;t++)h[t]=arguments[t];for(var e=0;e<h.length;e++)if(typeof h[e]!="number")throw new Error("assertNumbers arguments["+e+"] is not a number. "+typeof h[e]+" == typeof "+h[e]);return!0}var ot=Math.PI;function ae(h,t,e){h.lArcFlag=h.lArcFlag===0?0:1,h.sweepFlag=h.sweepFlag===0?0:1;var i=h.rX,s=h.rY,r=h.x,o=h.y;i=Math.abs(h.rX),s=Math.abs(h.rY);var n=ce([(t-r)/2,(e-o)/2],-h.xRot/180*ot),a=n[0],u=n[1],l=Math.pow(a,2)/Math.pow(i,2)+Math.pow(u,2)/Math.pow(s,2);1<l&&(i*=Math.sqrt(l),s*=Math.sqrt(l)),h.rX=i,h.rY=s;var f=Math.pow(i,2)*Math.pow(u,2)+Math.pow(s,2)*Math.pow(a,2),g=(h.lArcFlag!==h.sweepFlag?1:-1)*Math.sqrt(Math.max(0,(Math.pow(i,2)*Math.pow(s,2)-f)/f)),c=i*u/s*g,d=-s*a/i*g,p=ce([c,d],h.xRot/180*ot);h.cX=p[0]+(t+r)/2,h.cY=p[1]+(e+o)/2,h.phi1=Math.atan2((u-d)/s,(a-c)/i),h.phi2=Math.atan2((-u-d)/s,(-a-c)/i),h.sweepFlag===0&&h.phi2>h.phi1&&(h.phi2-=2*ot),h.sweepFlag===1&&h.phi2<h.phi1&&(h.phi2+=2*ot),h.phi1*=180/ot,h.phi2*=180/ot}function we(h,t,e){K(h,t,e);var i=h*h+t*t-e*e;if(0>i)return[];if(i===0)return[[h*e/(h*h+t*t),t*e/(h*h+t*t)]];var s=Math.sqrt(i);return[[(h*e+t*s)/(h*h+t*t),(t*e-h*s)/(h*h+t*t)],[(h*e-t*s)/(h*h+t*t),(t*e+h*s)/(h*h+t*t)]]}var R,et=Math.PI/180;function Fe(h,t,e){return(1-e)*h+e*t}function Pe(h,t,e,i){return h+Math.cos(i/180*ot)*t+Math.sin(i/180*ot)*e}function Me(h,t,e,i){var s=1e-6,r=t-h,o=e-t,n=3*r+3*(i-e)-6*o,a=6*(o-r),u=3*r;return Math.abs(n)<s?[-u/a]:function(l,f,g){g===void 0&&(g=1e-6);var c=l*l/4-f;if(c<-g)return[];if(c<=g)return[-l/2];var d=Math.sqrt(c);return[-l/2-d,-l/2+d]}(a/n,u/n,s)}function Ne(h,t,e,i,s){var r=1-s;return h*(r*r*r)+t*(3*r*r*s)+e*(3*r*s*s)+i*(s*s*s)}(function(h){function t(){return s(function(n,a,u){return n.relative&&(n.x1!==void 0&&(n.x1+=a),n.y1!==void 0&&(n.y1+=u),n.x2!==void 0&&(n.x2+=a),n.y2!==void 0&&(n.y2+=u),n.x!==void 0&&(n.x+=a),n.y!==void 0&&(n.y+=u),n.relative=!1),n})}function e(){var n=NaN,a=NaN,u=NaN,l=NaN;return s(function(f,g,c){return f.type&m.SMOOTH_CURVE_TO&&(f.type=m.CURVE_TO,n=isNaN(n)?g:n,a=isNaN(a)?c:a,f.x1=f.relative?g-n:2*g-n,f.y1=f.relative?c-a:2*c-a),f.type&m.CURVE_TO?(n=f.relative?g+f.x2:f.x2,a=f.relative?c+f.y2:f.y2):(n=NaN,a=NaN),f.type&m.SMOOTH_QUAD_TO&&(f.type=m.QUAD_TO,u=isNaN(u)?g:u,l=isNaN(l)?c:l,f.x1=f.relative?g-u:2*g-u,f.y1=f.relative?c-l:2*c-l),f.type&m.QUAD_TO?(u=f.relative?g+f.x1:f.x1,l=f.relative?c+f.y1:f.y1):(u=NaN,l=NaN),f})}function i(){var n=NaN,a=NaN;return s(function(u,l,f){if(u.type&m.SMOOTH_QUAD_TO&&(u.type=m.QUAD_TO,n=isNaN(n)?l:n,a=isNaN(a)?f:a,u.x1=u.relative?l-n:2*l-n,u.y1=u.relative?f-a:2*f-a),u.type&m.QUAD_TO){n=u.relative?l+u.x1:u.x1,a=u.relative?f+u.y1:u.y1;var g=u.x1,c=u.y1;u.type=m.CURVE_TO,u.x1=((u.relative?0:l)+2*g)/3,u.y1=((u.relative?0:f)+2*c)/3,u.x2=(u.x+2*g)/3,u.y2=(u.y+2*c)/3}else n=NaN,a=NaN;return u})}function s(n){var a=0,u=0,l=NaN,f=NaN;return function(g){if(isNaN(l)&&!(g.type&m.MOVE_TO))throw new Error("path must start with moveto");var c=n(g,a,u,l,f);return g.type&m.CLOSE_PATH&&(a=l,u=f),g.x!==void 0&&(a=g.relative?a+g.x:g.x),g.y!==void 0&&(u=g.relative?u+g.y:g.y),g.type&m.MOVE_TO&&(l=a,f=u),c}}function r(n,a,u,l,f,g){return K(n,a,u,l,f,g),s(function(c,d,p,y){var x=c.x1,C=c.x2,b=c.relative&&!isNaN(y),v=c.x!==void 0?c.x:b?0:d,w=c.y!==void 0?c.y:b?0:p;function E(Z){return Z*Z}c.type&m.HORIZ_LINE_TO&&a!==0&&(c.type=m.LINE_TO,c.y=c.relative?0:p),c.type&m.VERT_LINE_TO&&u!==0&&(c.type=m.LINE_TO,c.x=c.relative?0:d),c.x!==void 0&&(c.x=c.x*n+w*u+(b?0:f)),c.y!==void 0&&(c.y=v*a+c.y*l+(b?0:g)),c.x1!==void 0&&(c.x1=c.x1*n+c.y1*u+(b?0:f)),c.y1!==void 0&&(c.y1=x*a+c.y1*l+(b?0:g)),c.x2!==void 0&&(c.x2=c.x2*n+c.y2*u+(b?0:f)),c.y2!==void 0&&(c.y2=C*a+c.y2*l+(b?0:g));var S=n*l-a*u;if(c.xRot!==void 0&&(n!==1||a!==0||u!==0||l!==1))if(S===0)delete c.rX,delete c.rY,delete c.xRot,delete c.lArcFlag,delete c.sweepFlag,c.type=m.LINE_TO;else{var M=c.xRot*Math.PI/180,B=Math.sin(M),_=Math.cos(M),z=1/E(c.rX),I=1/E(c.rY),U=E(_)*z+E(B)*I,L=2*B*_*(z-I),k=E(B)*z+E(_)*I,X=U*l*l-L*a*l+k*a*a,H=L*(n*l+a*u)-2*(U*u*l+k*n*a),Q=U*u*u-L*n*u+k*n*n,V=(Math.atan2(H,X-Q)+Math.PI)%Math.PI/2,N=Math.sin(V),Y=Math.cos(V);c.rX=Math.abs(S)/Math.sqrt(X*E(Y)+H*N*Y+Q*E(N)),c.rY=Math.abs(S)/Math.sqrt(X*E(N)-H*N*Y+Q*E(Y)),c.xRot=180*V/Math.PI}return c.sweepFlag!==void 0&&0>S&&(c.sweepFlag=+!c.sweepFlag),c})}function o(){return function(n){var a={};for(var u in n)a[u]=n[u];return a}}h.ROUND=function(n){function a(u){return Math.round(u*n)/n}return n===void 0&&(n=1e13),K(n),function(u){return u.x1!==void 0&&(u.x1=a(u.x1)),u.y1!==void 0&&(u.y1=a(u.y1)),u.x2!==void 0&&(u.x2=a(u.x2)),u.y2!==void 0&&(u.y2=a(u.y2)),u.x!==void 0&&(u.x=a(u.x)),u.y!==void 0&&(u.y=a(u.y)),u.rX!==void 0&&(u.rX=a(u.rX)),u.rY!==void 0&&(u.rY=a(u.rY)),u}},h.TO_ABS=t,h.TO_REL=function(){return s(function(n,a,u){return n.relative||(n.x1!==void 0&&(n.x1-=a),n.y1!==void 0&&(n.y1-=u),n.x2!==void 0&&(n.x2-=a),n.y2!==void 0&&(n.y2-=u),n.x!==void 0&&(n.x-=a),n.y!==void 0&&(n.y-=u),n.relative=!0),n})},h.NORMALIZE_HVZ=function(n,a,u){return n===void 0&&(n=!0),a===void 0&&(a=!0),u===void 0&&(u=!0),s(function(l,f,g,c,d){if(isNaN(c)&&!(l.type&m.MOVE_TO))throw new Error("path must start with moveto");return a&&l.type&m.HORIZ_LINE_TO&&(l.type=m.LINE_TO,l.y=l.relative?0:g),u&&l.type&m.VERT_LINE_TO&&(l.type=m.LINE_TO,l.x=l.relative?0:f),n&&l.type&m.CLOSE_PATH&&(l.type=m.LINE_TO,l.x=l.relative?c-f:c,l.y=l.relative?d-g:d),l.type&m.ARC&&(l.rX===0||l.rY===0)&&(l.type=m.LINE_TO,delete l.rX,delete l.rY,delete l.xRot,delete l.lArcFlag,delete l.sweepFlag),l})},h.NORMALIZE_ST=e,h.QT_TO_C=i,h.INFO=s,h.SANITIZE=function(n){n===void 0&&(n=0),K(n);var a=NaN,u=NaN,l=NaN,f=NaN;return s(function(g,c,d,p,y){var x=Math.abs,C=!1,b=0,v=0;if(g.type&m.SMOOTH_CURVE_TO&&(b=isNaN(a)?0:c-a,v=isNaN(u)?0:d-u),g.type&(m.CURVE_TO|m.SMOOTH_CURVE_TO)?(a=g.relative?c+g.x2:g.x2,u=g.relative?d+g.y2:g.y2):(a=NaN,u=NaN),g.type&m.SMOOTH_QUAD_TO?(l=isNaN(l)?c:2*c-l,f=isNaN(f)?d:2*d-f):g.type&m.QUAD_TO?(l=g.relative?c+g.x1:g.x1,f=g.relative?d+g.y1:g.y2):(l=NaN,f=NaN),g.type&m.LINE_COMMANDS||g.type&m.ARC&&(g.rX===0||g.rY===0||!g.lArcFlag)||g.type&m.CURVE_TO||g.type&m.SMOOTH_CURVE_TO||g.type&m.QUAD_TO||g.type&m.SMOOTH_QUAD_TO){var w=g.x===void 0?0:g.relative?g.x:g.x-c,E=g.y===void 0?0:g.relative?g.y:g.y-d;b=isNaN(l)?g.x1===void 0?b:g.relative?g.x:g.x1-c:l-c,v=isNaN(f)?g.y1===void 0?v:g.relative?g.y:g.y1-d:f-d;var S=g.x2===void 0?0:g.relative?g.x:g.x2-c,M=g.y2===void 0?0:g.relative?g.y:g.y2-d;x(w)<=n&&x(E)<=n&&x(b)<=n&&x(v)<=n&&x(S)<=n&&x(M)<=n&&(C=!0)}return g.type&m.CLOSE_PATH&&x(c-p)<=n&&x(d-y)<=n&&(C=!0),C?[]:g})},h.MATRIX=r,h.ROTATE=function(n,a,u){a===void 0&&(a=0),u===void 0&&(u=0),K(n,a,u);var l=Math.sin(n),f=Math.cos(n);return r(f,l,-l,f,a-a*f+u*l,u-a*l-u*f)},h.TRANSLATE=function(n,a){return a===void 0&&(a=0),K(n,a),r(1,0,0,1,n,a)},h.SCALE=function(n,a){return a===void 0&&(a=n),K(n,a),r(n,0,0,a,0,0)},h.SKEW_X=function(n){return K(n),r(1,0,Math.atan(n),1,0,0)},h.SKEW_Y=function(n){return K(n),r(1,Math.atan(n),0,1,0,0)},h.X_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(-1,0,0,1,n,0)},h.Y_AXIS_SYMMETRY=function(n){return n===void 0&&(n=0),K(n),r(1,0,0,-1,0,n)},h.A_TO_C=function(){return s(function(n,a,u){return m.ARC===n.type?function(l,f,g){var c,d,p,y;l.cX||ae(l,f,g);for(var x=Math.min(l.phi1,l.phi2),C=Math.max(l.phi1,l.phi2)-x,b=Math.ceil(C/90),v=new Array(b),w=f,E=g,S=0;S<b;S++){var M=Fe(l.phi1,l.phi2,S/b),B=Fe(l.phi1,l.phi2,(S+1)/b),_=B-M,z=4/3*Math.tan(_*et/4),I=[Math.cos(M*et)-z*Math.sin(M*et),Math.sin(M*et)+z*Math.cos(M*et)],U=I[0],L=I[1],k=[Math.cos(B*et),Math.sin(B*et)],X=k[0],H=k[1],Q=[X+z*Math.sin(B*et),H-z*Math.cos(B*et)],V=Q[0],N=Q[1];v[S]={relative:l.relative,type:m.CURVE_TO};var Y=function(Z,tt){var nt=ce([Z*l.rX,tt*l.rY],l.xRot),yt=nt[0],Mt=nt[1];return[l.cX+yt,l.cY+Mt]};c=Y(U,L),v[S].x1=c[0],v[S].y1=c[1],d=Y(V,N),v[S].x2=d[0],v[S].y2=d[1],p=Y(X,H),v[S].x=p[0],v[S].y=p[1],l.relative&&(v[S].x1-=w,v[S].y1-=E,v[S].x2-=w,v[S].y2-=E,v[S].x-=w,v[S].y-=E),w=(y=[v[S].x,v[S].y])[0],E=y[1]}return v}(n,n.relative?0:a,n.relative?0:u):n})},h.ANNOTATE_ARCS=function(){return s(function(n,a,u){return n.relative&&(a=0,u=0),m.ARC===n.type&&ae(n,a,u),n})},h.CLONE=o,h.CALCULATE_BOUNDS=function(){var n=function(g){var c={};for(var d in g)c[d]=g[d];return c},a=t(),u=i(),l=e(),f=s(function(g,c,d){var p=l(u(a(n(g))));function y(N){N>f.maxX&&(f.maxX=N),N<f.minX&&(f.minX=N)}function x(N){N>f.maxY&&(f.maxY=N),N<f.minY&&(f.minY=N)}if(p.type&m.DRAWING_COMMANDS&&(y(c),x(d)),p.type&m.HORIZ_LINE_TO&&y(p.x),p.type&m.VERT_LINE_TO&&x(p.y),p.type&m.LINE_TO&&(y(p.x),x(p.y)),p.type&m.CURVE_TO){y(p.x),x(p.y);for(var C=0,b=Me(c,p.x1,p.x2,p.x);C<b.length;C++)0<(V=b[C])&&1>V&&y(Ne(c,p.x1,p.x2,p.x,V));for(var v=0,w=Me(d,p.y1,p.y2,p.y);v<w.length;v++)0<(V=w[v])&&1>V&&x(Ne(d,p.y1,p.y2,p.y,V))}if(p.type&m.ARC){y(p.x),x(p.y),ae(p,c,d);for(var E=p.xRot/180*Math.PI,S=Math.cos(E)*p.rX,M=Math.sin(E)*p.rX,B=-Math.sin(E)*p.rY,_=Math.cos(E)*p.rY,z=p.phi1<p.phi2?[p.phi1,p.phi2]:-180>p.phi2?[p.phi2+360,p.phi1+360]:[p.phi2,p.phi1],I=z[0],U=z[1],L=function(N){var Y=N[0],Z=N[1],tt=180*Math.atan2(Z,Y)/Math.PI;return tt<I?tt+360:tt},k=0,X=we(B,-S,0).map(L);k<X.length;k++)(V=X[k])>I&&V<U&&y(Pe(p.cX,S,B,V));for(var H=0,Q=we(_,-M,0).map(L);H<Q.length;H++){var V;(V=Q[H])>I&&V<U&&x(Pe(p.cY,M,_,V))}}return g});return f.minX=1/0,f.maxX=-1/0,f.minY=1/0,f.maxY=-1/0,f}})(R||(R={}));var j,qe=function(){function h(){}return h.prototype.round=function(t){return this.transform(R.ROUND(t))},h.prototype.toAbs=function(){return this.transform(R.TO_ABS())},h.prototype.toRel=function(){return this.transform(R.TO_REL())},h.prototype.normalizeHVZ=function(t,e,i){return this.transform(R.NORMALIZE_HVZ(t,e,i))},h.prototype.normalizeST=function(){return this.transform(R.NORMALIZE_ST())},h.prototype.qtToC=function(){return this.transform(R.QT_TO_C())},h.prototype.aToC=function(){return this.transform(R.A_TO_C())},h.prototype.sanitize=function(t){return this.transform(R.SANITIZE(t))},h.prototype.translate=function(t,e){return this.transform(R.TRANSLATE(t,e))},h.prototype.scale=function(t,e){return this.transform(R.SCALE(t,e))},h.prototype.rotate=function(t,e,i){return this.transform(R.ROTATE(t,e,i))},h.prototype.matrix=function(t,e,i,s,r,o){return this.transform(R.MATRIX(t,e,i,s,r,o))},h.prototype.skewX=function(t){return this.transform(R.SKEW_X(t))},h.prototype.skewY=function(t){return this.transform(R.SKEW_Y(t))},h.prototype.xSymmetry=function(t){return this.transform(R.X_AXIS_SYMMETRY(t))},h.prototype.ySymmetry=function(t){return this.transform(R.Y_AXIS_SYMMETRY(t))},h.prototype.annotateArcs=function(){return this.transform(R.ANNOTATE_ARCS())},h}(),hi=function(h){return h===" "||h===" "||h==="\r"||h===`
  13. `},Oe=function(h){return"0".charCodeAt(0)<=h.charCodeAt(0)&&h.charCodeAt(0)<="9".charCodeAt(0)},li=function(h){function t(){var e=h.call(this)||this;return e.curNumber="",e.curCommandType=-1,e.curCommandRelative=!1,e.canParseCommandOrComma=!0,e.curNumberHasExp=!1,e.curNumberHasExpDigits=!1,e.curNumberHasDecimal=!1,e.curArgs=[],e}return Ge(t,h),t.prototype.finish=function(e){if(e===void 0&&(e=[]),this.parse(" ",e),this.curArgs.length!==0||!this.canParseCommandOrComma)throw new SyntaxError("Unterminated command at the path end.");return e},t.prototype.parse=function(e,i){var s=this;i===void 0&&(i=[]);for(var r=function(f){i.push(f),s.curArgs.length=0,s.canParseCommandOrComma=!0},o=0;o<e.length;o++){var n=e[o],a=!(this.curCommandType!==m.ARC||this.curArgs.length!==3&&this.curArgs.length!==4||this.curNumber.length!==1||this.curNumber!=="0"&&this.curNumber!=="1"),u=Oe(n)&&(this.curNumber==="0"&&n==="0"||a);if(!Oe(n)||u)if(n!=="e"&&n!=="E")if(n!=="-"&&n!=="+"||!this.curNumberHasExp||this.curNumberHasExpDigits)if(n!=="."||this.curNumberHasExp||this.curNumberHasDecimal||a){if(this.curNumber&&this.curCommandType!==-1){var l=Number(this.curNumber);if(isNaN(l))throw new SyntaxError("Invalid number ending at "+o);if(this.curCommandType===m.ARC){if(this.curArgs.length===0||this.curArgs.length===1){if(0>l)throw new SyntaxError('Expected positive number, got "'+l+'" at index "'+o+'"')}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 "'+o+'"')}this.curArgs.push(l),this.curArgs.length===ci[this.curCommandType]&&(m.HORIZ_LINE_TO===this.curCommandType?r({type:m.HORIZ_LINE_TO,relative:this.curCommandRelative,x:l}):m.VERT_LINE_TO===this.curCommandType?r({type:m.VERT_LINE_TO,relative:this.curCommandRelative,y:l}):this.curCommandType===m.MOVE_TO||this.curCommandType===m.LINE_TO||this.curCommandType===m.SMOOTH_QUAD_TO?(r({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),m.MOVE_TO===this.curCommandType&&(this.curCommandType=m.LINE_TO)):this.curCommandType===m.CURVE_TO?r({type:m.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===m.SMOOTH_CURVE_TO?r({type:m.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===m.QUAD_TO?r({type:m.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===m.ARC&&r({type:m.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(!hi(n))if(n===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(n!=="+"&&n!=="-"&&n!==".")if(u)this.curNumber=n,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+o+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+n+'" at index '+o+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,n!=="z"&&n!=="Z")if(n==="h"||n==="H")this.curCommandType=m.HORIZ_LINE_TO,this.curCommandRelative=n==="h";else if(n==="v"||n==="V")this.curCommandType=m.VERT_LINE_TO,this.curCommandRelative=n==="v";else if(n==="m"||n==="M")this.curCommandType=m.MOVE_TO,this.curCommandRelative=n==="m";else if(n==="l"||n==="L")this.curCommandType=m.LINE_TO,this.curCommandRelative=n==="l";else if(n==="c"||n==="C")this.curCommandType=m.CURVE_TO,this.curCommandRelative=n==="c";else if(n==="s"||n==="S")this.curCommandType=m.SMOOTH_CURVE_TO,this.curCommandRelative=n==="s";else if(n==="q"||n==="Q")this.curCommandType=m.QUAD_TO,this.curCommandRelative=n==="q";else if(n==="t"||n==="T")this.curCommandType=m.SMOOTH_QUAD_TO,this.curCommandRelative=n==="t";else{if(n!=="a"&&n!=="A")throw new SyntaxError('Unexpected character "'+n+'" at index '+o+".");this.curCommandType=m.ARC,this.curCommandRelative=n==="a"}else i.push({type:m.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=n,this.curNumberHasDecimal=n==="."}else this.curNumber+=n,this.curNumberHasDecimal=!0;else this.curNumber+=n;else this.curNumber+=n,this.curNumberHasExp=!0;else this.curNumber+=n,this.curNumberHasExpDigits=this.curNumberHasExp}return i},t.prototype.transform=function(e){return Object.create(this,{parse:{value:function(i,s){s===void 0&&(s=[]);for(var r=0,o=Object.getPrototypeOf(this).parse.call(this,i);r<o.length;r++){var n=o[r],a=e(n);Array.isArray(a)?s.push.apply(s,a):s.push(a)}return s}}})},t}(qe),m=function(h){function t(e){var i=h.call(this)||this;return i.commands=typeof e=="string"?t.parse(e):e,i}return Ge(t,h),t.prototype.encode=function(){return t.encode(this.commands)},t.prototype.getBounds=function(){var e=R.CALCULATE_BOUNDS();return this.transform(e),e},t.prototype.transform=function(e){for(var i=[],s=0,r=this.commands;s<r.length;s++){var o=e(r[s]);Array.isArray(o)?i.push.apply(i,o):i.push(o)}return this.commands=i,this},t.encode=function(e){return ui(e)},t.parse=function(e){var i=new li,s=[];return i.parse(e,s),i.finish(s),s},t.CLOSE_PATH=1,t.MOVE_TO=2,t.HORIZ_LINE_TO=4,t.VERT_LINE_TO=8,t.LINE_TO=16,t.CURVE_TO=32,t.SMOOTH_CURVE_TO=64,t.QUAD_TO=128,t.SMOOTH_QUAD_TO=256,t.ARC=512,t.LINE_COMMANDS=t.LINE_TO|t.HORIZ_LINE_TO|t.VERT_LINE_TO,t.DRAWING_COMMANDS=t.HORIZ_LINE_TO|t.VERT_LINE_TO|t.LINE_TO|t.CURVE_TO|t.SMOOTH_CURVE_TO|t.QUAD_TO|t.SMOOTH_QUAD_TO|t.ARC,t}(qe),ci=((j={})[m.MOVE_TO]=2,j[m.LINE_TO]=2,j[m.HORIZ_LINE_TO]=1,j[m.VERT_LINE_TO]=1,j[m.CLOSE_PATH]=0,j[m.QUAD_TO]=4,j[m.SMOOTH_QUAD_TO]=2,j[m.CURVE_TO]=6,j[m.SMOOTH_CURVE_TO]=4,j[m.ARC]=7,j);function Ht(h){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ht=function(t){return typeof t}:Ht=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(h)}function fi(h,t){if(!(h instanceof t))throw new TypeError("Cannot call a class as a function")}var gi=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],di=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function pi(h,t,e,i,s){if(typeof h=="string"&&(h=document.getElementById(h)),!h||Ht(h)!=="object"||!("getContext"in h))throw new TypeError("Expecting canvas with `getContext` method in processCanvasRGB(A) calls!");var r=h.getContext("2d");try{return r.getImageData(t,e,i,s)}catch(o){throw new Error("unable to access image data: "+o)}}function mi(h,t,e,i,s,r){if(!(isNaN(r)||r<1)){r|=0;var o=pi(h,t,e,i,s);o=yi(o,t,e,i,s,r),h.getContext("2d").putImageData(o,t,e)}}function yi(h,t,e,i,s,r){for(var o=h.data,n=2*r+1,a=i-1,u=s-1,l=r+1,f=l*(l+1)/2,g=new Ve,c=g,d,p=1;p<n;p++)c=c.next=new Ve,p===l&&(d=c);c.next=g;for(var y=null,x=null,C=0,b=0,v=gi[r],w=di[r],E=0;E<s;E++){c=g;for(var S=o[b],M=o[b+1],B=o[b+2],_=o[b+3],z=0;z<l;z++)c.r=S,c.g=M,c.b=B,c.a=_,c=c.next;for(var I=0,U=0,L=0,k=0,X=l*S,H=l*M,Q=l*B,V=l*_,N=f*S,Y=f*M,Z=f*B,tt=f*_,nt=1;nt<l;nt++){var yt=b+((a<nt?a:nt)<<2),Mt=o[yt],me=o[yt+1],ye=o[yt+2],xe=o[yt+3],Nt=l-nt;N+=(c.r=Mt)*Nt,Y+=(c.g=me)*Nt,Z+=(c.b=ye)*Nt,tt+=(c.a=xe)*Nt,I+=Mt,U+=me,L+=ye,k+=xe,c=c.next}y=g,x=d;for(var Gt=0;Gt<i;Gt++){var qt=tt*v>>w;if(o[b+3]=qt,qt!==0){var Qt=255/qt;o[b]=(N*v>>w)*Qt,o[b+1]=(Y*v>>w)*Qt,o[b+2]=(Z*v>>w)*Qt}else o[b]=o[b+1]=o[b+2]=0;N-=X,Y-=H,Z-=Q,tt-=V,X-=y.r,H-=y.g,Q-=y.b,V-=y.a;var ht=Gt+r+1;ht=C+(ht<a?ht:a)<<2,I+=y.r=o[ht],U+=y.g=o[ht+1],L+=y.b=o[ht+2],k+=y.a=o[ht+3],N+=I,Y+=U,Z+=L,tt+=k,y=y.next;var Ot=x,be=Ot.r,ve=Ot.g,Ae=Ot.b,Ce=Ot.a;X+=be,H+=ve,Q+=Ae,V+=Ce,I-=be,U-=ve,L-=Ae,k-=Ce,x=x.next,b+=4}C+=i}for(var xt=0;xt<i;xt++){b=xt<<2;var lt=o[b],ct=o[b+1],ft=o[b+2],G=o[b+3],$t=l*lt,Zt=l*ct,jt=l*ft,Kt=l*G,Vt=f*lt,Bt=f*ct,kt=f*ft,Dt=f*G;c=g;for(var Se=0;Se<l;Se++)c.r=lt,c.g=ct,c.b=ft,c.a=G,c=c.next;for(var Te=i,Jt=0,te=0,ee=0,ie=0,Rt=1;Rt<=r;Rt++){b=Te+xt<<2;var Lt=l-Rt;Vt+=(c.r=lt=o[b])*Lt,Bt+=(c.g=ct=o[b+1])*Lt,kt+=(c.b=ft=o[b+2])*Lt,Dt+=(c.a=G=o[b+3])*Lt,ie+=lt,Jt+=ct,te+=ft,ee+=G,c=c.next,Rt<u&&(Te+=i)}b=xt,y=g,x=d;for(var se=0;se<s;se++){var q=b<<2;o[q+3]=G=Dt*v>>w,G>0?(G=255/G,o[q]=(Vt*v>>w)*G,o[q+1]=(Bt*v>>w)*G,o[q+2]=(kt*v>>w)*G):o[q]=o[q+1]=o[q+2]=0,Vt-=$t,Bt-=Zt,kt-=jt,Dt-=Kt,$t-=y.r,Zt-=y.g,jt-=y.b,Kt-=y.a,q=xt+((q=se+l)<u?q:u)*i<<2,Vt+=ie+=y.r=o[q],Bt+=Jt+=y.g=o[q+1],kt+=te+=y.b=o[q+2],Dt+=ee+=y.a=o[q+3],y=y.next,$t+=lt=x.r,Zt+=ct=x.g,jt+=ft=x.b,Kt+=G=x.a,ie-=lt,Jt-=ct,te-=ft,ee-=G,x=x.next,b+=i}}return h}var Ve=function h(){fi(this,h),this.r=0,this.g=0,this.b=0,this.a=0,this.next=null};function xi(){let{DOMParser:h}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:h,createCanvas(e,i){return new OffscreenCanvas(e,i)},async createImage(e){const s=await(await fetch(e)).blob();return await createImageBitmap(s)}};return(typeof globalThis.DOMParser!="undefined"||typeof h=="undefined")&&Reflect.deleteProperty(t,"DOMParser"),t}function bi(h){let{DOMParser:t,canvas:e,fetch:i}=h;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,fetch:i,createCanvas:e.createCanvas,createImage:e.loadImage}}var vi=Object.freeze({__proto__:null,offscreen:xi,node:bi});function St(h){return h.replace(/(?!\u3000)\s+/gm," ")}function Ai(h){return h.replace(/^[\n \t]+/,"")}function Ci(h){return h.replace(/[\n \t]+$/,"")}function $(h){const t=h.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return t?t.map(parseFloat):[]}function Si(h){const t=$(h);return[t[0]||0,t[1]||0,t[2]||0,t[3]||0,t[4]||0,t[5]||0]}const Ti=/^[A-Z-]+$/;function Ei(h){return Ti.test(h)?h.toLowerCase():h}function Qe(h){const t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(h);return t&&(t[2]||t[3]||t[4])||""}function wi(h){if(!h.startsWith("rgb"))return h;let t=3;return h.replace(/\d+(\.\d+)?/g,(i,s)=>t--&&s?String(Math.round(parseFloat(i))):i)}const Fi=/(\[[^\]]+\])/g,Pi=/(#[^\s+>~.[:]+)/g,Mi=/(\.[^\s+>~.[:]+)/g,Ni=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,Oi=/(:[\w-]+\([^)]*\))/gi,Vi=/(:[^\s+>~.[:]+)/g,Bi=/([^\s+>~.[:]+)/g;function dt(h,t){const e=t.exec(h);return e?[h.replace(t," "),e.length]:[h,0]}function ki(h){const t=[0,0,0];let e=h.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),i=0;return[e,i]=dt(e,Fi),t[1]+=i,[e,i]=dt(e,Pi),t[0]+=i,[e,i]=dt(e,Mi),t[1]+=i,[e,i]=dt(e,Ni),t[2]+=i,[e,i]=dt(e,Oi),t[1]+=i,[e,i]=dt(e,Vi),t[1]+=i,e=e.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[e,i]=dt(e,Bi),t[2]+=i,t.join("")}const At=1e-8;function Be(h){return Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2))}function fe(h,t){return(h[0]*t[0]+h[1]*t[1])/(Be(h)*Be(t))}function ke(h,t){return(h[0]*t[1]<h[1]*t[0]?-1:1)*Math.acos(fe(h,t))}function De(h){return h*h*h}function Re(h){return 3*h*h*(1-h)}function Le(h){return 3*h*(1-h)*(1-h)}function Ie(h){return(1-h)*(1-h)*(1-h)}function _e(h){return h*h}function ze(h){return 2*h*(1-h)}function He(h){return(1-h)*(1-h)}class A{static empty(t){return new A(t,"EMPTY","")}split(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:" ";const{document:e,name:i}=this;return St(this.getString()).trim().split(t).map(s=>new A(e,i,s))}hasValue(t){const e=this.value;return e!==null&&e!==""&&(t||e!==0)&&typeof e!="undefined"}isString(t){const{value:e}=this,i=typeof e=="string";return!i||!t?i:t.test(e)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const t=this.getString();switch(!0){case t.endsWith("px"):case/^[0-9]+$/.test(t):return!0;default:return!1}}setValue(t){return this.value=t,this}getValue(t){return typeof t=="undefined"||this.hasValue()?this.value:t}getNumber(t){if(!this.hasValue())return typeof t=="undefined"?0:parseFloat(t);const{value:e}=this;let i=parseFloat(e);return this.isString(/%$/)&&(i/=100),i}getString(t){return typeof t=="undefined"||this.hasValue()?typeof this.value=="undefined"?"":String(this.value):String(t)}getColor(t){let e=this.getString(t);return this.isNormalizedColor||(this.isNormalizedColor=!0,e=wi(e),this.value=e),e}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[i,s]=typeof t=="boolean"?[void 0,t]:[t],{viewPort:r}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(r.computeSize("x"),r.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(r.computeSize("x"),r.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*r.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*r.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&s):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*r.computeSize(i);default:{const o=this.getNumber();return e&&o<1?o*r.computeSize(i):o}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const t=this.getString(),e=/#([^)'"]+)/.exec(t),i=(e==null?void 0:e[1])||t;return this.document.definitions[i]}getFillStyleDefinition(t,e){let i=this.getDefinition();if(!i)return null;if(typeof i.createGradient=="function"&&"getBoundingBox"in t)return i.createGradient(this.document.ctx,t,e);if(typeof i.createPattern=="function"){if(i.getHrefAttribute().hasValue()){const s=i.getAttribute("patternTransform");i=i.getHrefAttribute().getDefinition(),i&&s.hasValue()&&i.getAttribute("patternTransform",!0).setValue(s.value)}if(i)return i.createPattern(this.document.ctx,t,e)}return null}getTextBaseline(){if(!this.hasValue())return null;const t=this.getString();return A.textBaselineMapping[t]||null}addOpacity(t){let e=this.getColor();const i=e.length;let s=0;for(let r=0;r<i&&(e[r]===","&&s++,s!==3);r++);if(t.hasValue()&&this.isString()&&s!==3){const r=new le(e);r.ok&&(r.alpha=t.getNumber(),e=r.toRGBA())}return new A(this.document,this.name,e)}constructor(t,e,i){this.document=t,this.name=e,this.value=i,this.isNormalizedColor=!1}}A.textBaselineMapping={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};class Ft{clear(){this.viewPorts=[]}setCurrent(t,e){this.viewPorts.push({width:t,height:e})}removeCurrent(){this.viewPorts.pop()}getRoot(){const[t]=this.viewPorts;return t||Ue()}getCurrent(){const{viewPorts:t}=this,e=t[t.length-1];return e||Ue()}get width(){return this.getCurrent().width}get height(){return this.getCurrent().height}computeSize(t){return typeof t=="number"?t:t==="x"?this.width:t==="y"?this.height:Math.sqrt(Math.pow(this.width,2)+Math.pow(this.height,2))/Math.sqrt(2)}constructor(){this.viewPorts=[]}}Ft.DEFAULT_VIEWPORT_WIDTH=800;Ft.DEFAULT_VIEWPORT_HEIGHT=600;function Ue(){return{width:Ft.DEFAULT_VIEWPORT_WIDTH,height:Ft.DEFAULT_VIEWPORT_HEIGHT}}class O{static parse(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const[i=e,s=e]=$(t);return new O(i,s)}static parseScale(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[i=e,s=i]=$(t);return new O(i,s)}static parsePath(t){const e=$(t),i=e.length,s=[];for(let r=0;r<i;r+=2)s.push(new O(e[r],e[r+1]));return s}angleTo(t){return Math.atan2(t.y-this.y,t.x-this.x)}applyTransform(t){const{x:e,y:i}=this,s=e*t[0]+i*t[2]+t[4],r=e*t[1]+i*t[3]+t[5];this.x=s,this.y=r}constructor(t,e){this.x=t,this.y=e}}class Di{isWorking(){return this.working}start(){if(this.working)return;const{screen:t,onClick:e,onMouseMove:i}=this,s=t.ctx.canvas;s.onclick=e,s.onmousemove=i,this.working=!0}stop(){if(!this.working)return;const t=this.screen.ctx.canvas;this.working=!1,t.onclick=null,t.onmousemove=null}hasEvents(){return this.working&&this.events.length>0}runEvents(){if(!this.working)return;const{screen:t,events:e,eventElements:i}=this,{style:s}=t.ctx.canvas;let r;s&&(s.cursor=""),e.forEach((o,n)=>{let{run:a}=o;for(r=i[n];r;)a(r),r=r.parent}),this.events=[],this.eventElements=[]}checkPath(t,e){if(!this.working||!e)return;const{events:i,eventElements:s}=this;i.forEach((r,o)=>{let{x:n,y:a}=r;!s[o]&&e.isPointInPath&&e.isPointInPath(n,a)&&(s[o]=t)})}checkBoundingBox(t,e){if(!this.working||!e)return;const{events:i,eventElements:s}=this;i.forEach((r,o)=>{let{x:n,y:a}=r;!s[o]&&e.isPointInBox(n,a)&&(s[o]=t)})}mapXY(t,e){const{window:i,ctx:s}=this.screen,r=new O(t,e);let o=s.canvas;for(;o;)r.x-=o.offsetLeft,r.y-=o.offsetTop,o=o.offsetParent;return i!=null&&i.scrollX&&(r.x+=i.scrollX),i!=null&&i.scrollY&&(r.y+=i.scrollY),r}onClick(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onclick",x:e,y:i,run(s){s.onClick&&s.onClick()}})}onMouseMove(t){const{x:e,y:i}=this.mapXY(t.clientX,t.clientY);this.events.push({type:"onmousemove",x:e,y:i,run(s){s.onMouseMove&&s.onMouseMove()}})}constructor(t){this.screen=t,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const $e=typeof window!="undefined"?window:null,Ze=typeof fetch!="undefined"?fetch.bind(void 0):void 0;class rt{wait(t){this.waits.push(t)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const t=this.waits.every(e=>e());return t&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=t,t}setDefaults(t){t.strokeStyle="rgba(0,0,0,0)",t.lineCap="butt",t.lineJoin="miter",t.miterLimit=4}setViewBox(t){let{document:e,ctx:i,aspectRatio:s,width:r,desiredWidth:o,height:n,desiredHeight:a,minX:u=0,minY:l=0,refX:f,refY:g,clip:c=!1,clipX:d=0,clipY:p=0}=t;const y=St(s).replace(/^defer\s/,""),[x,C]=y.split(" "),b=x||"xMidYMid",v=C||"meet",w=r/o,E=n/a,S=Math.min(w,E),M=Math.max(w,E);let B=o,_=a;v==="meet"&&(B*=S,_*=S),v==="slice"&&(B*=M,_*=M);const z=new A(e,"refX",f),I=new A(e,"refY",g),U=z.hasValue()&&I.hasValue();if(U&&i.translate(-S*z.getPixels("x"),-S*I.getPixels("y")),c){const L=S*d,k=S*p;i.beginPath(),i.moveTo(L,k),i.lineTo(r,k),i.lineTo(r,n),i.lineTo(L,n),i.closePath(),i.clip()}if(!U){const L=v==="meet"&&S===E,k=v==="slice"&&M===E,X=v==="meet"&&S===w,H=v==="slice"&&M===w;b.startsWith("xMid")&&(L||k)&&i.translate(r/2-B/2,0),b.endsWith("YMid")&&(X||H)&&i.translate(0,n/2-_/2),b.startsWith("xMax")&&(L||k)&&i.translate(r-B,0),b.endsWith("YMax")&&(X||H)&&i.translate(0,n-_)}switch(!0){case b==="none":i.scale(w,E);break;case v==="meet":i.scale(S,S);break;case v==="slice":i.scale(M,M);break}i.translate(-u,-l)}start(t){let{enableRedraw:e=!1,ignoreMouse:i=!1,ignoreAnimation:s=!1,ignoreDimensions:r=!1,ignoreClear:o=!1,forceRedraw:n,scaleWidth:a,scaleHeight:u,offsetX:l,offsetY:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:g}=this,c=1e3/rt.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=c,this.readyPromise=new Promise(C=>{this.resolveReady=C}),this.isReady()&&this.render(t,r,o,a,u,l,f),!e)return;let d=Date.now(),p=d,y=0;const x=()=>{d=Date.now(),y=d-p,y>=c&&(p=d-y%c,this.shouldUpdate(s,n)&&(this.render(t,r,o,a,u,l,f),g.runEvents())),this.intervalId=oe(x)};i||g.start(),this.intervalId=oe(x)}stop(){this.intervalId&&(oe.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(t,e){if(!t){const{frameDuration:i}=this;if(this.animations.reduce((r,o)=>o.update(i)||r,!1))return!0}return!!(typeof e=="function"&&e()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(t,e,i,s,r,o,n){const{viewPort:a,ctx:u,isFirstRender:l}=this,f=u.canvas;a.clear(),f.width&&f.height&&a.setCurrent(f.width,f.height);const g=t.getStyle("width"),c=t.getStyle("height");!e&&(l||typeof s!="number"&&typeof r!="number")&&(g.hasValue()&&(f.width=g.getPixels("x"),f.style&&(f.style.width="".concat(f.width,"px"))),c.hasValue()&&(f.height=c.getPixels("y"),f.style&&(f.style.height="".concat(f.height,"px"))));let d=f.clientWidth||f.width,p=f.clientHeight||f.height;if(e&&g.hasValue()&&c.hasValue()&&(d=g.getPixels("x"),p=c.getPixels("y")),a.setCurrent(d,p),typeof o=="number"&&t.getAttribute("x",!0).setValue(o),typeof n=="number"&&t.getAttribute("y",!0).setValue(n),typeof s=="number"||typeof r=="number"){const y=$(t.getAttribute("viewBox").getString());let x=0,C=0;if(typeof s=="number"){const v=t.getStyle("width");v.hasValue()?x=v.getPixels("x")/s:y[2]&&!isNaN(y[2])&&(x=y[2]/s)}if(typeof r=="number"){const v=t.getStyle("height");v.hasValue()?C=v.getPixels("y")/r:y[3]&&!isNaN(y[3])&&(C=y[3]/r)}x||(x=C),C||(C=x),t.getAttribute("width",!0).setValue(s),t.getAttribute("height",!0).setValue(r);const b=t.getStyle("transform",!0,!0);b.setValue("".concat(b.getString()," scale(").concat(1/x,", ").concat(1/C,")"))}i||u.clearRect(0,0,d,p),t.render(u),l&&(this.isFirstRender=!1)}constructor(t,{fetch:e=Ze,window:i=$e}={}){if(this.ctx=t,this.viewPort=new Ft,this.mouse=new Di(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=i,!e)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=e}}rt.defaultWindow=$e;rt.defaultFetch=Ze;rt.FRAMERATE=30;rt.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch:Ri}=rt,Li=typeof DOMParser!="undefined"?DOMParser:void 0;class ue{async parse(t){return t.startsWith("<")?this.parseFromString(t):this.load(t)}parseFromString(t){const e=new this.DOMParser;try{return this.checkDocument(e.parseFromString(t,"image/svg+xml"))}catch{return this.checkDocument(e.parseFromString(t,"text/xml"))}}checkDocument(t){const e=t.getElementsByTagName("parsererror")[0];if(e)throw new Error(e.textContent||"Unknown parse error");return t}async load(t){const i=await(await this.fetch(t)).text();return this.parseFromString(i)}constructor({fetch:t=Ri,DOMParser:e=Li}={}){if(!t)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!e)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=t,this.DOMParser=e}}class Ii{apply(t){const{x:e,y:i}=this.point;t.translate(e||0,i||0)}unapply(t){const{x:e,y:i}=this.point;t.translate(-1*e||0,-1*i||0)}applyToPoint(t){const{x:e,y:i}=this.point;t.applyTransform([1,0,0,1,e||0,i||0])}constructor(t,e){this.type="translate",this.point=O.parse(e)}}class _i{apply(t){const{cx:e,cy:i,originX:s,originY:r,angle:o}=this,n=e+s.getPixels("x"),a=i+r.getPixels("y");t.translate(n,a),t.rotate(o.getRadians()),t.translate(-n,-a)}unapply(t){const{cx:e,cy:i,originX:s,originY:r,angle:o}=this,n=e+s.getPixels("x"),a=i+r.getPixels("y");t.translate(n,a),t.rotate(-1*o.getRadians()),t.translate(-n,-a)}applyToPoint(t){const{cx:e,cy:i,angle:s}=this,r=s.getRadians();t.applyTransform([1,0,0,1,e||0,i||0]),t.applyTransform([Math.cos(r),Math.sin(r),-Math.sin(r),Math.cos(r),0,0]),t.applyTransform([1,0,0,1,-e||0,-i||0])}constructor(t,e,i){this.type="rotate";const s=$(e);this.angle=new A(t,"angle",s[0]),this.originX=i[0],this.originY=i[1],this.cx=s[1]||0,this.cy=s[2]||0}}class zi{apply(t){const{scale:{x:e,y:i},originX:s,originY:r}=this,o=s.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(e,i||e),t.translate(-o,-n)}unapply(t){const{scale:{x:e,y:i},originX:s,originY:r}=this,o=s.getPixels("x"),n=r.getPixels("y");t.translate(o,n),t.scale(1/e,1/i||e),t.translate(-o,-n)}applyToPoint(t){const{x:e,y:i}=this.scale;t.applyTransform([e||0,0,0,i||0,0,0])}constructor(t,e,i){this.type="scale";const s=O.parseScale(e);(s.x===0||s.y===0)&&(s.x=At,s.y=At),this.scale=s,this.originX=i[0],this.originY=i[1]}}class je{apply(t){const{originX:e,originY:i,matrix:s}=this,r=e.getPixels("x"),o=i.getPixels("y");t.translate(r,o),t.transform(s[0],s[1],s[2],s[3],s[4],s[5]),t.translate(-r,-o)}unapply(t){const{originX:e,originY:i,matrix:s}=this,r=s[0],o=s[2],n=s[4],a=s[1],u=s[3],l=s[5],f=0,g=0,c=1,d=1/(r*(u*c-l*g)-o*(a*c-l*f)+n*(a*g-u*f)),p=e.getPixels("x"),y=i.getPixels("y");t.translate(p,y),t.transform(d*(u*c-l*g),d*(l*f-a*c),d*(n*g-o*c),d*(r*c-n*f),d*(o*l-n*u),d*(n*a-r*l)),t.translate(-p,-y)}applyToPoint(t){t.applyTransform(this.matrix)}constructor(t,e,i){this.type="matrix",this.matrix=Si(e),this.originX=i[0],this.originY=i[1]}}class Ke extends je{constructor(t,e,i){super(t,e,i),this.type="skew",this.angle=new A(t,"angle",e)}}class Hi extends Ke{constructor(t,e,i){super(t,e,i),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class Ui extends Ke{constructor(t,e,i){super(t,e,i),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function Xi(h){return St(h).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function Yi(h){const[t="",e=""]=h.split("(");return[t.trim(),e.trim().replace(")","")]}class pt{static fromElement(t,e){const i=e.getStyle("transform",!1,!0);if(i.hasValue()){const[s,r=s]=e.getStyle("transform-origin",!1,!0).split();if(s&&r){const o=[s,r];return new pt(t,i.getString(),o)}}return null}apply(t){this.transforms.forEach(e=>e.apply(t))}unapply(t){this.transforms.forEach(e=>e.unapply(t))}applyToPoint(t){this.transforms.forEach(e=>e.applyToPoint(t))}constructor(t,e,i){this.document=t,this.transforms=[],Xi(e).forEach(r=>{if(r==="none")return;const[o,n]=Yi(r),a=pt.transformTypes[o];a&&this.transforms.push(new a(this.document,n,i))})}}pt.transformTypes={translate:Ii,rotate:_i,scale:zi,matrix:je,skewX:Hi,skewY:Ui};class P{getAttribute(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const i=this.attributes[t];if(!i&&e){const s=new A(this.document,t,"");return this.attributes[t]=s,s}return i||A.empty(this.document)}getHrefAttribute(){let t;for(const e in this.attributes)if(e==="href"||e.endsWith(":href")){t=this.attributes[e];break}return t||A.empty(this.document)}getStyle(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const s=this.styles[t];if(s)return s;const r=this.getAttribute(t);if(r.hasValue())return this.styles[t]=r,r;if(!i){const{parent:o}=this;if(o){const n=o.getStyle(t);if(n.hasValue())return n}}if(e){const o=new A(this.document,t,"");return this.styles[t]=o,o}return A.empty(this.document)}render(t){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(t.save(),this.getStyle("mask").hasValue()){const e=this.getStyle("mask").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const e=this.getStyle("filter").getDefinition();e&&(this.applyEffects(t),e.apply(t,this))}else this.setContext(t),this.renderChildren(t),this.clearContext(t);t.restore()}}setContext(t){}applyEffects(t){const e=pt.fromElement(this.document,this);e&&e.apply(t);const i=this.getStyle("clip-path",!1,!0);if(i.hasValue()){const s=i.getDefinition();s&&s.apply(t)}}clearContext(t){}renderChildren(t){this.children.forEach(e=>{e.render(t)})}addChild(t){const e=t instanceof P?t:this.document.createElement(t);e.parent=this,P.ignoreChildTypes.includes(e.type)||this.children.push(e)}matchesSelector(t){var e;const{node:i}=this;if(typeof i.matches=="function")return i.matches(t);const s=(e=i.getAttribute)===null||e===void 0?void 0:e.call(i,"class");return!s||s===""?!1:s.split(" ").some(r=>".".concat(r)===t)}addStylesFromStyleDefinition(){const{styles:t,stylesSpecificity:e}=this.document;let i;for(const s in t)if(!s.startsWith("@")&&this.matchesSelector(s)){const r=t[s],o=e[s];if(r)for(const n in r){let a=this.stylesSpecificity[n];typeof a=="undefined"&&(a="000"),o&&o>=a&&(i=r[n],i&&(this.styles[n]=i),this.stylesSpecificity[n]=o)}}}removeStyles(t,e){return e.reduce((s,r)=>{const o=t.getStyle(r);if(!o.hasValue())return s;const n=o.getString();return o.setValue(""),[...s,[r,n]]},[])}restoreStyles(t,e){e.forEach(i=>{let[s,r]=i;t.getStyle(s,!0).setValue(r)})}isFirstChild(){var t;return((t=this.parent)===null||t===void 0?void 0:t.children.indexOf(this))===0}constructor(t,e,i=!1){if(this.document=t,this.node=e,this.captureTextNodes=i,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!e||e.nodeType!==1)return;Array.from(e.attributes).forEach(o=>{const n=Ei(o.nodeName);this.attributes[n]=new A(t,n,o.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(n=>n.trim()).forEach(n=>{if(!n)return;const[a,u]=n.split(":").map(l=>l.trim());a&&(this.styles[a]=new A(t,a,u))});const{definitions:s}=t,r=this.getAttribute("id");r.hasValue()&&(s[r.getString()]||(s[r.getString()]=this)),Array.from(e.childNodes).forEach(o=>{if(o.nodeType===1)this.addChild(o);else if(i&&(o.nodeType===3||o.nodeType===4)){const n=t.createTextNode(o);n.getText().length>0&&this.addChild(n)}})}}P.ignoreChildTypes=["title"];class Wi extends P{constructor(t,e,i){super(t,e,i)}}function Gi(h){const t=h.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function qi(h){return typeof process=="undefined"?h:h.trim().split(",").map(Gi).join(",")}function Qi(h){if(!h)return"";const t=h.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function $i(h){if(!h)return"";const t=h.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class W{static parse(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1?arguments[1]:void 0,i="",s="",r="",o="",n="";const a=St(t).trim().split(" "),u={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return a.forEach(l=>{switch(!0){case(!u.fontStyle&&W.styles.includes(l)):l!=="inherit"&&(i=l),u.fontStyle=!0;break;case(!u.fontVariant&&W.variants.includes(l)):l!=="inherit"&&(s=l),u.fontStyle=!0,u.fontVariant=!0;break;case(!u.fontWeight&&W.weights.includes(l)):l!=="inherit"&&(r=l),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0;break;case!u.fontSize:l!=="inherit"&&(o=l.split("/")[0]||""),u.fontStyle=!0,u.fontVariant=!0,u.fontWeight=!0,u.fontSize=!0;break;default:l!=="inherit"&&(n+=l)}}),new W(i,s,r,o,n,e)}toString(){return[Qi(this.fontStyle),this.fontVariant,$i(this.fontWeight),this.fontSize,qi(this.fontFamily)].join(" ").trim()}constructor(t,e,i,s,r,o){const n=o?typeof o=="string"?W.parse(o):o:{};this.fontFamily=r||n.fontFamily,this.fontSize=s||n.fontSize,this.fontStyle=t||n.fontStyle,this.fontWeight=i||n.fontWeight,this.fontVariant=e||n.fontVariant}}W.styles="normal|italic|oblique|inherit";W.variants="normal|small-caps|inherit";W.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class J{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(t,e){typeof t!="undefined"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),typeof e!="undefined"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,0)}addY(t){this.addPoint(0,t)}addBoundingBox(t){if(!t)return;const{x1:e,y1:i,x2:s,y2:r}=t;this.addPoint(e,i),this.addPoint(s,r)}sumCubic(t,e,i,s,r){return Math.pow(1-t,3)*e+3*Math.pow(1-t,2)*t*i+3*(1-t)*Math.pow(t,2)*s+Math.pow(t,3)*r}bezierCurveAdd(t,e,i,s,r){const o=6*e-12*i+6*s,n=-3*e+9*i-9*s+3*r,a=3*i-3*e;if(n===0){if(o===0)return;const g=-a/o;0<g&&g<1&&(t?this.addX(this.sumCubic(g,e,i,s,r)):this.addY(this.sumCubic(g,e,i,s,r)));return}const u=Math.pow(o,2)-4*a*n;if(u<0)return;const l=(-o+Math.sqrt(u))/(2*n);0<l&&l<1&&(t?this.addX(this.sumCubic(l,e,i,s,r)):this.addY(this.sumCubic(l,e,i,s,r)));const f=(-o-Math.sqrt(u))/(2*n);0<f&&f<1&&(t?this.addX(this.sumCubic(f,e,i,s,r)):this.addY(this.sumCubic(f,e,i,s,r)))}addBezierCurve(t,e,i,s,r,o,n,a){this.addPoint(t,e),this.addPoint(n,a),this.bezierCurveAdd(!0,t,i,r,n),this.bezierCurveAdd(!1,e,s,o,a)}addQuadraticCurve(t,e,i,s,r,o){const n=t+.6666666666666666*(i-t),a=e+2/3*(s-e),u=n+1/3*(r-t),l=a+1/3*(o-e);this.addBezierCurve(t,e,n,u,a,l,r,o)}isPointInBox(t,e){const{x1:i,y1:s,x2:r,y2:o}=this;return i<=t&&t<=r&&s<=e&&e<=o}constructor(t=Number.NaN,e=Number.NaN,i=Number.NaN,s=Number.NaN){this.x1=t,this.y1=e,this.x2=i,this.y2=s,this.addPoint(t,e),this.addPoint(i,s)}}class mt extends P{calculateOpacity(){let t=1,e=this;for(;e;){const i=e.getStyle("opacity",!1,!0);i.hasValue(!0)&&(t*=i.getNumber()),e=e.parent}return t}setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!e){const i=this.getStyle("fill"),s=this.getStyle("fill-opacity"),r=this.getStyle("stroke"),o=this.getStyle("stroke-opacity");if(i.isUrlDefinition()){const c=i.getFillStyleDefinition(this,s);c&&(t.fillStyle=c)}else if(i.hasValue()){i.getString()==="currentColor"&&i.setValue(this.getStyle("color").getColor());const c=i.getColor();c!=="inherit"&&(t.fillStyle=c==="none"?"rgba(0,0,0,0)":c)}if(s.hasValue()){const c=new A(this.document,"fill",t.fillStyle).addOpacity(s).getColor();t.fillStyle=c}if(r.isUrlDefinition()){const c=r.getFillStyleDefinition(this,o);c&&(t.strokeStyle=c)}else if(r.hasValue()){r.getString()==="currentColor"&&r.setValue(this.getStyle("color").getColor());const c=r.getString();c!=="inherit"&&(t.strokeStyle=c==="none"?"rgba(0,0,0,0)":c)}if(o.hasValue()){const c=new A(this.document,"stroke",t.strokeStyle).addOpacity(o).getString();t.strokeStyle=c}const n=this.getStyle("stroke-width");if(n.hasValue()){const c=n.getPixels();t.lineWidth=c||At}const a=this.getStyle("stroke-linecap"),u=this.getStyle("stroke-linejoin"),l=this.getStyle("stroke-miterlimit"),f=this.getStyle("stroke-dasharray"),g=this.getStyle("stroke-dashoffset");if(a.hasValue()&&(t.lineCap=a.getString()),u.hasValue()&&(t.lineJoin=u.getString()),l.hasValue()&&(t.miterLimit=l.getNumber()),f.hasValue()&&f.getString()!=="none"){const c=$(f.getString());typeof t.setLineDash!="undefined"?t.setLineDash(c):typeof t.webkitLineDash!="undefined"?t.webkitLineDash=c:typeof t.mozDash!="undefined"&&!(c.length===1&&c[0]===0)&&(t.mozDash=c);const d=g.getPixels();typeof t.lineDashOffset!="undefined"?t.lineDashOffset=d:typeof t.webkitLineDashOffset!="undefined"?t.webkitLineDashOffset=d:typeof t.mozDashOffset!="undefined"&&(t.mozDashOffset=d)}}if(this.modifiedEmSizeStack=!1,typeof t.font!="undefined"){const i=this.getStyle("font"),s=this.getStyle("font-style"),r=this.getStyle("font-variant"),o=this.getStyle("font-weight"),n=this.getStyle("font-size"),a=this.getStyle("font-family"),u=new W(s.getString(),r.getString(),o.getString(),n.hasValue()?"".concat(n.getPixels(!0),"px"):"",a.getString(),W.parse(i.getString(),t.font));s.setValue(u.fontStyle),r.setValue(u.fontVariant),o.setValue(u.fontWeight),n.setValue(u.fontSize),a.setValue(u.fontFamily),t.font=u.toString(),n.isPixels()&&(this.document.emSize=n.getPixels(),this.modifiedEmSizeStack=!0)}e||(this.applyEffects(t),t.globalAlpha=this.calculateOpacity())}clearContext(t){super.clearContext(t),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...t){super(...t),this.modifiedEmSizeStack=!1}}class ut extends mt{setContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(t,e);const i=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();i&&(t.textBaseline=i)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(t){if(this.type!=="text")return this.getTElementBoundingBox(t);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t);let e=null;return this.children.forEach((i,s)=>{const r=this.getChildBoundingBox(t,this,this,s);e?e.addBoundingBox(r):e=r}),e}getFontSize(){const{document:t,parent:e}=this,i=W.parse(t.ctx.font).fontSize;return e.getStyle("font-size").getNumber(i)}getTElementBoundingBox(t){const e=this.getFontSize();return new J(this.x,this.y-e,this.x+this.measureText(t),this.y)}getGlyph(t,e,i){const s=e[i];let r;if(t.isArabic){var o;const n=e.length,a=e[i-1],u=e[i+1];let l="isolated";(i===0||a===" ")&&i<n-1&&u!==" "&&(l="terminal"),i>0&&a!==" "&&i<n-1&&u!==" "&&(l="medial"),i>0&&a!==" "&&(i===n-1||u===" ")&&(l="initial"),r=((o=t.arabicGlyphs[s])===null||o===void 0?void 0:o[l])||t.glyphs[s]}else r=t.glyphs[s];return r||(r=t.missingGlyph),r}getText(){return""}getTextFromNode(t){const e=t||this.node,i=Array.from(e.parentNode.childNodes),s=i.indexOf(e),r=i.length-1;let o=St(e.textContent||"");return s===0&&(o=Ai(o)),s===r&&(o=Ci(o)),o}renderChildren(t){if(this.type!=="text"){this.renderTElementChildren(t);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(t),this.children.forEach((i,s)=>{this.renderChild(t,this,this,s)});const{mouse:e}=this.document.screen;e.isWorking()&&e.checkBoundingBox(this,this.getBoundingBox(t))}renderTElementChildren(t){const{document:e,parent:i}=this,s=this.getText(),r=i.getStyle("font-family").getDefinition();if(r){const{unitsPerEm:a}=r.fontFace,u=W.parse(e.ctx.font),l=i.getStyle("font-size").getNumber(u.fontSize),f=i.getStyle("font-style").getString(u.fontStyle),g=l/a,c=r.isRTL?s.split("").reverse().join(""):s,d=$(i.getAttribute("dx").getString()),p=c.length;for(let y=0;y<p;y++){const x=this.getGlyph(r,c,y);t.translate(this.x,this.y),t.scale(g,-g);const C=t.lineWidth;t.lineWidth=t.lineWidth*a/l,f==="italic"&&t.transform(1,0,.4,1,0,0),x.render(t),f==="italic"&&t.transform(1,0,-.4,1,0,0),t.lineWidth=C,t.scale(1/g,-1/g),t.translate(-this.x,-this.y),this.x+=l*(x.horizAdvX||r.horizAdvX)/a,typeof d[y]!="undefined"&&!isNaN(d[y])&&(this.x+=d[y])}return}const{x:o,y:n}=this;t.fillStyle&&t.fillText(s,o,n),t.strokeStyle&&t.strokeText(s,o,n)}applyAnchoring(){if(this.textChunkStart>=this.leafTexts.length)return;const t=this.leafTexts[this.textChunkStart],e=t.getStyle("text-anchor").getString("start"),i=!1;let s=0;e==="start"&&!i||e==="end"&&i?s=t.x-this.minX:e==="end"&&!i||e==="start"&&i?s=t.x-this.maxX:s=t.x-(this.minX+this.maxX)/2;for(let r=this.textChunkStart;r<this.leafTexts.length;r++)this.leafTexts[r].x+=s;this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.textChunkStart=this.leafTexts.length}adjustChildCoordinatesRecursive(t){this.children.forEach((e,i)=>{this.adjustChildCoordinatesRecursiveCore(t,this,this,i)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(t,e,i,s){const r=i.children[s];r.children.length>0?r.children.forEach((o,n)=>{e.adjustChildCoordinatesRecursiveCore(t,e,r,n)}):this.adjustChildCoordinates(t,e,i,s)}adjustChildCoordinates(t,e,i,s){const r=i.children[s];if(typeof r.measureText!="function")return r;t.save(),r.setContext(t,!0);const o=r.getAttribute("x"),n=r.getAttribute("y"),a=r.getAttribute("dx"),u=r.getAttribute("dy"),l=r.getStyle("font-family").getDefinition(),f=Boolean(l==null?void 0:l.isRTL);s===0&&(o.hasValue()||o.setValue(r.getInheritedAttribute("x")),n.hasValue()||n.setValue(r.getInheritedAttribute("y")),a.hasValue()||a.setValue(r.getInheritedAttribute("dx")),u.hasValue()||u.setValue(r.getInheritedAttribute("dy")));const g=r.measureText(t);return f&&(e.x-=g),o.hasValue()?(e.applyAnchoring(),r.x=o.getPixels("x"),a.hasValue()&&(r.x+=a.getPixels("x"))):(a.hasValue()&&(e.x+=a.getPixels("x")),r.x=e.x),e.x=r.x,f||(e.x+=g),n.hasValue()?(r.y=n.getPixels("y"),u.hasValue()&&(r.y+=u.getPixels("y"))):(u.hasValue()&&(e.y+=u.getPixels("y")),r.y=e.y),e.y=r.y,e.leafTexts.push(r),e.minX=Math.min(e.minX,r.x,r.x+g),e.maxX=Math.max(e.maxX,r.x,r.x+g),r.clearContext(t),t.restore(),r}getChildBoundingBox(t,e,i,s){const r=i.children[s];if(typeof r.getBoundingBox!="function")return null;const o=r.getBoundingBox(t);return o&&r.children.forEach((n,a)=>{const u=e.getChildBoundingBox(t,e,r,a);o.addBoundingBox(u)}),o}renderChild(t,e,i,s){const r=i.children[s];r.render(t),r.children.forEach((o,n)=>{e.renderChild(t,e,r,n)})}measureText(t){const{measureCache:e}=this;if(~e)return e;const i=this.getText(),s=this.measureTargetText(t,i);return this.measureCache=s,s}measureTargetText(t,e){if(!e.length)return 0;const{parent:i}=this,s=i.getStyle("font-family").getDefinition();if(s){const o=this.getFontSize(),n=s.isRTL?e.split("").reverse().join(""):e,a=$(i.getAttribute("dx").getString()),u=n.length;let l=0;for(let f=0;f<u;f++)l+=(this.getGlyph(s,n,f).horizAdvX||s.horizAdvX)*o/s.fontFace.unitsPerEm,typeof a[f]!="undefined"&&!isNaN(a[f])&&(l+=a[f]);return l}if(!t.measureText)return e.length*10;t.save(),this.setContext(t,!0);const{width:r}=t.measureText(e);return this.clearContext(t),t.restore(),r}getInheritedAttribute(t){let e=this;for(;e instanceof ut&&e.isFirstChild()&&e.parent;){const i=e.parent.getAttribute(t);if(i.hasValue(!0))return i.getString("0");e=e.parent}return null}constructor(t,e,i){super(t,e,new.target===ut?!0:i),this.type="text",this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY,this.measureCache=-1}}class Xt extends ut{getText(){return this.text}constructor(t,e,i){super(t,e,new.target===Xt?!0:i),this.type="tspan",this.text=this.children.length>0?"":this.getTextFromNode()}}class Zi extends Xt{constructor(...t){super(...t),this.type="textNode"}}class T extends m{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new O(0,0),this.control=new O(0,0),this.current=new O(0,0),this.points=[],this.angles=[]}isEnd(){const{i:t,commands:e}=this;return t>=e.length-1}next(){const t=this.commands[++this.i];return this.previousCommand=this.command,this.command=t,t}getPoint(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const i=new O(this.command[t],this.command[e]);return this.makeAbsolute(i)}getAsControlPoint(t,e){const i=this.getPoint(t,e);return this.control=i,i}getAsCurrentPoint(t,e){const i=this.getPoint(t,e);return this.current=i,i}getReflectedControlPoint(){const t=this.previousCommand.type;if(t!==m.CURVE_TO&&t!==m.SMOOTH_CURVE_TO&&t!==m.QUAD_TO&&t!==m.SMOOTH_QUAD_TO)return this.current;const{current:{x:e,y:i},control:{x:s,y:r}}=this;return new O(2*e-s,2*i-r)}makeAbsolute(t){if(this.command.relative){const{x:e,y:i}=this.current;t.x+=e,t.y+=i}return t}addMarker(t,e,i){const{points:s,angles:r}=this;i&&r.length>0&&!r[r.length-1]&&(r[r.length-1]=s[s.length-1].angleTo(i)),this.addMarkerAngle(t,e?e.angleTo(t):null)}addMarkerAngle(t,e){this.points.push(t),this.angles.push(e)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:t}=this,e=t.length;for(let i=0;i<e;i++)if(!t[i]){for(let s=i+1;s<e;s++)if(t[s]){t[i]=t[s];break}}return t}constructor(t){super(t.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new O(0,0),this.start=new O(0,0),this.current=new O(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class F extends mt{path(t){const{pathParser:e}=this,i=new J;for(e.reset(),t&&t.beginPath();!e.isEnd();)switch(e.next().type){case T.MOVE_TO:this.pathM(t,i);break;case T.LINE_TO:this.pathL(t,i);break;case T.HORIZ_LINE_TO:this.pathH(t,i);break;case T.VERT_LINE_TO:this.pathV(t,i);break;case T.CURVE_TO:this.pathC(t,i);break;case T.SMOOTH_CURVE_TO:this.pathS(t,i);break;case T.QUAD_TO:this.pathQ(t,i);break;case T.SMOOTH_QUAD_TO:this.pathT(t,i);break;case T.ARC:this.pathA(t,i);break;case T.CLOSE_PATH:this.pathZ(t,i);break}return i}getBoundingBox(t){return this.path()}getMarkers(){const{pathParser:t}=this,e=t.getMarkerPoints(),i=t.getMarkerAngles();return e.map((r,o)=>[r,i[o]])}renderChildren(t){this.path(t),this.document.screen.mouse.checkPath(this,t);const e=this.getStyle("fill-rule");t.fillStyle!==""&&(e.getString("inherit")!=="inherit"?t.fill(e.getString()):t.fill()),t.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(t.save(),t.setTransform(1,0,0,1,0,0),t.stroke(),t.restore()):t.stroke());const i=this.getMarkers();if(i){const s=i.length-1,r=this.getStyle("marker-start"),o=this.getStyle("marker-mid"),n=this.getStyle("marker-end");if(r.isUrlDefinition()){const a=r.getDefinition(),[u,l]=i[0];a.render(t,u,l)}if(o.isUrlDefinition()){const a=o.getDefinition();for(let u=1;u<s;u++){const[l,f]=i[u];a.render(t,l,f)}}if(n.isUrlDefinition()){const a=n.getDefinition(),[u,l]=i[s];a.render(t,u,l)}}}static pathM(t){const e=t.getAsCurrentPoint();return t.start=t.current,{point:e}}pathM(t,e){const{pathParser:i}=this,{point:s}=F.pathM(i),{x:r,y:o}=s;i.addMarker(s),e.addPoint(r,o),t&&t.moveTo(r,o)}static pathL(t){const{current:e}=t,i=t.getAsCurrentPoint();return{current:e,point:i}}pathL(t,e){const{pathParser:i}=this,{current:s,point:r}=F.pathL(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathH(t){const{current:e,command:i}=t,s=new O((i.relative?e.x:0)+i.x,e.y);return t.current=s,{current:e,point:s}}pathH(t,e){const{pathParser:i}=this,{current:s,point:r}=F.pathH(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathV(t){const{current:e,command:i}=t,s=new O(e.x,(i.relative?e.y:0)+i.y);return t.current=s,{current:e,point:s}}pathV(t,e){const{pathParser:i}=this,{current:s,point:r}=F.pathV(i),{x:o,y:n}=r;i.addMarker(r,s),e.addPoint(o,n),t&&t.lineTo(o,n)}static pathC(t){const{current:e}=t,i=t.getPoint("x1","y1"),s=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:i,controlPoint:s,currentPoint:r}}pathC(t,e){const{pathParser:i}=this,{current:s,point:r,controlPoint:o,currentPoint:n}=F.pathC(i);i.addMarker(n,o,r),e.addBezierCurve(s.x,s.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathS(t){const{current:e}=t,i=t.getReflectedControlPoint(),s=t.getAsControlPoint("x2","y2"),r=t.getAsCurrentPoint();return{current:e,point:i,controlPoint:s,currentPoint:r}}pathS(t,e){const{pathParser:i}=this,{current:s,point:r,controlPoint:o,currentPoint:n}=F.pathS(i);i.addMarker(n,o,r),e.addBezierCurve(s.x,s.y,r.x,r.y,o.x,o.y,n.x,n.y),t&&t.bezierCurveTo(r.x,r.y,o.x,o.y,n.x,n.y)}static pathQ(t){const{current:e}=t,i=t.getAsControlPoint("x1","y1"),s=t.getAsCurrentPoint();return{current:e,controlPoint:i,currentPoint:s}}pathQ(t,e){const{pathParser:i}=this,{current:s,controlPoint:r,currentPoint:o}=F.pathQ(i);i.addMarker(o,r,r),e.addQuadraticCurve(s.x,s.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathT(t){const{current:e}=t,i=t.getReflectedControlPoint();t.control=i;const s=t.getAsCurrentPoint();return{current:e,controlPoint:i,currentPoint:s}}pathT(t,e){const{pathParser:i}=this,{current:s,controlPoint:r,currentPoint:o}=F.pathT(i);i.addMarker(o,r,r),e.addQuadraticCurve(s.x,s.y,r.x,r.y,o.x,o.y),t&&t.quadraticCurveTo(r.x,r.y,o.x,o.y)}static pathA(t){const{current:e,command:i}=t;let{rX:s,rY:r,xRot:o,lArcFlag:n,sweepFlag:a}=i;const u=o*(Math.PI/180),l=t.getAsCurrentPoint(),f=new O(Math.cos(u)*(e.x-l.x)/2+Math.sin(u)*(e.y-l.y)/2,-Math.sin(u)*(e.x-l.x)/2+Math.cos(u)*(e.y-l.y)/2),g=Math.pow(f.x,2)/Math.pow(s,2)+Math.pow(f.y,2)/Math.pow(r,2);g>1&&(s*=Math.sqrt(g),r*=Math.sqrt(g));let c=(n===a?-1:1)*Math.sqrt((Math.pow(s,2)*Math.pow(r,2)-Math.pow(s,2)*Math.pow(f.y,2)-Math.pow(r,2)*Math.pow(f.x,2))/(Math.pow(s,2)*Math.pow(f.y,2)+Math.pow(r,2)*Math.pow(f.x,2)));isNaN(c)&&(c=0);const d=new O(c*s*f.y/r,c*-r*f.x/s),p=new O((e.x+l.x)/2+Math.cos(u)*d.x-Math.sin(u)*d.y,(e.y+l.y)/2+Math.sin(u)*d.x+Math.cos(u)*d.y),y=ke([1,0],[(f.x-d.x)/s,(f.y-d.y)/r]),x=[(f.x-d.x)/s,(f.y-d.y)/r],C=[(-f.x-d.x)/s,(-f.y-d.y)/r];let b=ke(x,C);return fe(x,C)<=-1&&(b=Math.PI),fe(x,C)>=1&&(b=0),{currentPoint:l,rX:s,rY:r,sweepFlag:a,xAxisRotation:u,centp:p,a1:y,ad:b}}pathA(t,e){const{pathParser:i}=this,{currentPoint:s,rX:r,rY:o,sweepFlag:n,xAxisRotation:a,centp:u,a1:l,ad:f}=F.pathA(i),g=1-n?1:-1,c=l+g*(f/2),d=new O(u.x+r*Math.cos(c),u.y+o*Math.sin(c));if(i.addMarkerAngle(d,c-g*Math.PI/2),i.addMarkerAngle(s,c-g*Math.PI),e.addPoint(s.x,s.y),t&&!isNaN(l)&&!isNaN(f)){const p=r>o?r:o,y=r>o?1:r/o,x=r>o?o/r:1;t.translate(u.x,u.y),t.rotate(a),t.scale(y,x),t.arc(0,0,p,l,l+f,Boolean(1-n)),t.scale(1/y,1/x),t.rotate(-a),t.translate(-u.x,-u.y)}}static pathZ(t){t.current=t.start}pathZ(t,e){F.pathZ(this.pathParser),t&&e.x1!==e.x2&&e.y1!==e.y2&&t.closePath()}constructor(t,e,i){super(t,e,i),this.type="path",this.pathParser=new T(this.getAttribute("d").getString())}}class Pt extends mt{setContext(t){var e;const{document:i}=this,{screen:s,window:r}=i,o=t.canvas;if(s.setDefaults(t),"style"in o&&typeof t.font!="undefined"&&r&&typeof r.getComputedStyle!="undefined"){t.font=r.getComputedStyle(o).getPropertyValue("font");const C=new A(i,"fontSize",W.parse(t.font).fontSize);C.hasValue()&&(i.rootEmSize=C.getPixels("y"),i.emSize=i.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:n,height:a}=s.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const u=this.getAttribute("refX"),l=this.getAttribute("refY"),f=this.getAttribute("viewBox"),g=f.hasValue()?$(f.getString()):null,c=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let d=0,p=0,y=0,x=0;g&&(d=g[0],p=g[1]),this.root||(n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y"),this.type==="marker"&&(y=d,x=p,d=0,p=0)),s.viewPort.setCurrent(n,a),this.node&&(!this.parent||((e=this.node.parentNode)===null||e===void 0?void 0:e.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(t),t.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),g&&(n=g[2],a=g[3]),i.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:s.viewPort.width,desiredWidth:n,height:s.viewPort.height,desiredHeight:a,minX:d,minY:p,refX:u.getValue(),refY:l.getValue(),clip:c,clipX:y,clipY:x}),g&&(s.viewPort.removeCurrent(),s.viewPort.setCurrent(n,a))}clearContext(t){super.clearContext(t),this.document.screen.viewPort.removeCurrent()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const s=this.getAttribute("width",!0),r=this.getAttribute("height",!0),o=this.getAttribute("viewBox"),n=this.getAttribute("style"),a=s.getNumber(0),u=r.getNumber(0);if(i)if(typeof i=="string")this.getAttribute("preserveAspectRatio",!0).setValue(i);else{const l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(s.setValue(t),r.setValue(e),o.hasValue()||o.setValue("0 0 ".concat(a||t," ").concat(u||e)),n.hasValue()){const l=this.getStyle("width"),f=this.getStyle("height");l.hasValue()&&l.setValue("".concat(t,"px")),f.hasValue()&&f.setValue("".concat(e,"px"))}}constructor(...t){super(...t),this.type="svg",this.root=!1}}class Je extends F{path(t){const e=this.getAttribute("x").getPixels("x"),i=this.getAttribute("y").getPixels("y"),s=this.getStyle("width",!1,!0).getPixels("x"),r=this.getStyle("height",!1,!0).getPixels("y"),o=this.getAttribute("rx"),n=this.getAttribute("ry");let a=o.getPixels("x"),u=n.getPixels("y");if(o.hasValue()&&!n.hasValue()&&(u=a),n.hasValue()&&!o.hasValue()&&(a=u),a=Math.min(a,s/2),u=Math.min(u,r/2),t){const l=4*((Math.sqrt(2)-1)/3);t.beginPath(),r>0&&s>0&&(t.moveTo(e+a,i),t.lineTo(e+s-a,i),t.bezierCurveTo(e+s-a+l*a,i,e+s,i+u-l*u,e+s,i+u),t.lineTo(e+s,i+r-u),t.bezierCurveTo(e+s,i+r-u+l*u,e+s-a+l*a,i+r,e+s-a,i+r),t.lineTo(e+a,i+r),t.bezierCurveTo(e+a-l*a,i+r,e,i+r-u+l*u,e,i+r-u),t.lineTo(e,i+u),t.bezierCurveTo(e,i+u-l*u,e+a-l*a,i,e+a,i),t.closePath())}return new J(e,i,e+s,i+r)}getMarkers(){return null}constructor(...t){super(...t),this.type="rect"}}class ji extends F{path(t){const e=this.getAttribute("cx").getPixels("x"),i=this.getAttribute("cy").getPixels("y"),s=this.getAttribute("r").getPixels();return t&&s>0&&(t.beginPath(),t.arc(e,i,s,0,Math.PI*2,!1),t.closePath()),new J(e-s,i-s,e+s,i+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="circle"}}class Ki extends F{path(t){const e=4*((Math.sqrt(2)-1)/3),i=this.getAttribute("rx").getPixels("x"),s=this.getAttribute("ry").getPixels("y"),r=this.getAttribute("cx").getPixels("x"),o=this.getAttribute("cy").getPixels("y");return t&&i>0&&s>0&&(t.beginPath(),t.moveTo(r+i,o),t.bezierCurveTo(r+i,o+e*s,r+e*i,o+s,r,o+s),t.bezierCurveTo(r-e*i,o+s,r-i,o+e*s,r-i,o),t.bezierCurveTo(r-i,o-e*s,r-e*i,o-s,r,o-s),t.bezierCurveTo(r+e*i,o-s,r+i,o-e*s,r+i,o),t.closePath()),new J(r-i,o-s,r+i,o+s)}getMarkers(){return null}constructor(...t){super(...t),this.type="ellipse"}}class Ji extends F{getPoints(){return[new O(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new O(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(t){const[{x:e,y:i},{x:s,y:r}]=this.getPoints();return t&&(t.beginPath(),t.moveTo(e,i),t.lineTo(s,r)),new J(e,i,s,r)}getMarkers(){const[t,e]=this.getPoints(),i=t.angleTo(e);return[[t,i],[e,i]]}constructor(...t){super(...t),this.type="line"}}class ti extends F{path(t){const{points:e}=this,[{x:i,y:s}]=e,r=new J(i,s);return t&&(t.beginPath(),t.moveTo(i,s)),e.forEach(o=>{let{x:n,y:a}=o;r.addPoint(n,a),t&&t.lineTo(n,a)}),r}getMarkers(){const{points:t}=this,e=t.length-1,i=[];return t.forEach((s,r)=>{r!==e&&i.push([s,s.angleTo(t[r+1])])}),i.length>0&&i.push([t[t.length-1],i[i.length-1][1]]),i}constructor(t,e,i){super(t,e,i),this.type="polyline",this.points=[],this.points=O.parsePath(this.getAttribute("points").getString())}}class ts extends ti{path(t){const e=super.path(t),[{x:i,y:s}]=this.points;return t&&(t.lineTo(i,s),t.closePath()),e}constructor(...t){super(...t),this.type="polygon"}}class es extends P{createPattern(t,e,i){const s=this.getStyle("width").getPixels("x",!0),r=this.getStyle("height").getPixels("y",!0),o=new Pt(this.document,null);o.attributes.viewBox=new A(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.width=new A(this.document,"width","".concat(s,"px")),o.attributes.height=new A(this.document,"height","".concat(r,"px")),o.attributes.transform=new A(this.document,"transform",this.getAttribute("patternTransform").getValue()),o.children=this.children;const n=this.document.createCanvas(s,r),a=n.getContext("2d"),u=this.getAttribute("x"),l=this.getAttribute("y");u.hasValue()&&l.hasValue()&&a.translate(u.getPixels("x",!0),l.getPixels("y",!0)),i.hasValue()?this.styles["fill-opacity"]=i:Reflect.deleteProperty(this.styles,"fill-opacity");for(let g=-1;g<=1;g++)for(let c=-1;c<=1;c++)a.save(),o.attributes.x=new A(this.document,"x",g*n.width),o.attributes.y=new A(this.document,"y",c*n.height),o.render(a),a.restore();return t.createPattern(n,"repeat")}constructor(...t){super(...t),this.type="pattern"}}class is extends P{render(t,e,i){if(!e)return;const{x:s,y:r}=e,o=this.getAttribute("orient").getString("auto"),n=this.getAttribute("markerUnits").getString("strokeWidth");t.translate(s,r),o==="auto"&&t.rotate(i),n==="strokeWidth"&&t.scale(t.lineWidth,t.lineWidth),t.save();const a=new Pt(this.document);a.type=this.type,a.attributes.viewBox=new A(this.document,"viewBox",this.getAttribute("viewBox").getValue()),a.attributes.refX=new A(this.document,"refX",this.getAttribute("refX").getValue()),a.attributes.refY=new A(this.document,"refY",this.getAttribute("refY").getValue()),a.attributes.width=new A(this.document,"width",this.getAttribute("markerWidth").getValue()),a.attributes.height=new A(this.document,"height",this.getAttribute("markerHeight").getValue()),a.attributes.overflow=new A(this.document,"overflow",this.getAttribute("overflow").getValue()),a.attributes.fill=new A(this.document,"fill",this.getAttribute("fill").getColor("black")),a.attributes.stroke=new A(this.document,"stroke",this.getAttribute("stroke").getValue("none")),a.children=this.children,a.render(t),t.restore(),n==="strokeWidth"&&t.scale(1/t.lineWidth,1/t.lineWidth),o==="auto"&&t.rotate(-i),t.translate(-s,-r)}constructor(...t){super(...t),this.type="marker"}}class ss extends P{render(){}constructor(...t){super(...t),this.type="defs"}}class ge extends mt{getBoundingBox(t){const e=new J;return this.children.forEach(i=>{e.addBoundingBox(i.getBoundingBox(t))}),e}constructor(...t){super(...t),this.type="g"}}class ei extends P{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(t,e,i){let s=this;this.getHrefAttribute().hasValue()&&(s=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(s));const{stops:r}=s,o=this.getGradient(t,e);if(!o)return this.addParentOpacity(i,r[r.length-1].color);if(r.forEach(n=>{o.addColorStop(n.offset,this.addParentOpacity(i,n.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:n}=this,{MAX_VIRTUAL_PIXELS:a}=rt,{viewPort:u}=n.screen,l=u.getRoot(),f=new Je(n);f.attributes.x=new A(n,"x",-a/3),f.attributes.y=new A(n,"y",-a/3),f.attributes.width=new A(n,"width",a),f.attributes.height=new A(n,"height",a);const g=new ge(n);g.attributes.transform=new A(n,"transform",this.getAttribute("gradientTransform").getValue()),g.children=[f];const c=new Pt(n);c.attributes.x=new A(n,"x",0),c.attributes.y=new A(n,"y",0),c.attributes.width=new A(n,"width",l.width),c.attributes.height=new A(n,"height",l.height),c.children=[g];const d=n.createCanvas(l.width,l.height),p=d.getContext("2d");return p.fillStyle=o,c.render(p),p.createPattern(d,"no-repeat")}return o}inheritStopContainer(t){this.attributesToInherit.forEach(e=>{!this.getAttribute(e).hasValue()&&t.getAttribute(e).hasValue()&&this.getAttribute(e,!0).setValue(t.getAttribute(e).getValue())})}addParentOpacity(t,e){return t.hasValue()?new A(this.document,"color",e).addOpacity(t).getColor():e}constructor(t,e,i){super(t,e,i),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:s,children:r}=this;r.forEach(o=>{o.type==="stop"&&s.push(o)})}}class rs extends ei{getGradient(t,e){const i=this.getGradientUnits()==="objectBoundingBox",s=i?e.getBoundingBox(t):null;if(i&&!s)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const r=i?s.x+s.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),o=i?s.y+s.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),n=i?s.x+s.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),a=i?s.y+s.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return r===n&&o===a?null:t.createLinearGradient(r,o,n,a)}constructor(t,e,i){super(t,e,i),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class ns extends ei{getGradient(t,e){const i=this.getGradientUnits()==="objectBoundingBox",s=e.getBoundingBox(t);if(i&&!s)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const r=i?s.x+s.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),o=i?s.y+s.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let n=r,a=o;this.getAttribute("fx").hasValue()&&(n=i?s.x+s.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(a=i?s.y+s.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const u=i?(s.width+s.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return t.createRadialGradient(n,a,l,r,o,u)}constructor(t,e,i){super(t,e,i),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class os extends P{constructor(t,e,i){super(t,e,i),this.type="stop";const s=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),r=this.getStyle("stop-opacity");let o=this.getStyle("stop-color",!0);o.getString()===""&&o.setValue("#000"),r.hasValue()&&(o=o.addOpacity(r)),this.offset=s,this.color=o.getColor()}}class de extends P{getProperty(){const t=this.getAttribute("attributeType").getString(),e=this.getAttribute("attributeName").getString();return t==="CSS"?this.parent.getStyle(e,!0):this.parent.getAttribute(e,!0)}calcValue(){const{initialUnits:t}=this,{progress:e,from:i,to:s}=this.getProgress();let r=i.getNumber()+(s.getNumber()-i.getNumber())*e;return t==="%"&&(r*=100),"".concat(r).concat(t)}update(t){const{parent:e}=this,i=this.getProperty();if(this.initialValue||(this.initialValue=i.getString(),this.initialUnits=i.getUnits()),this.duration>this.maxDuration){const r=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(r==="freeze"&&!this.frozen)this.frozen=!0,e&&i&&(e.animationFrozen=!0,e.animationFrozenValue=i.getString());else if(r==="remove"&&!this.removed)return this.removed=!0,e&&i&&i.setValue(e.animationFrozen?e.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=t;let s=!1;if(this.begin<this.duration){let r=this.calcValue();const o=this.getAttribute("type");if(o.hasValue()){const n=o.getString();r="".concat(n,"(").concat(r,")")}i.setValue(r),s=!0}return s}getProgress(){const{document:t,values:e}=this;let i=(this.duration-this.begin)/(this.maxDuration-this.begin),s,r;if(e.hasValue()){const o=i*(e.getValue().length-1),n=Math.floor(o),a=Math.ceil(o);let u;u=e.getValue()[n],s=new A(t,"from",u?parseFloat(u):0),u=e.getValue()[a],r=new A(t,"to",u?parseFloat(u):0),i=(o-n)/(a-n)}else s=this.from,r=this.to;return{progress:i,from:s,to:r}}constructor(t,e,i){super(t,e,i),this.type="animate",this.duration=0,this.initialUnits="",this.removed=!1,this.frozen=!1,t.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new A(t,"values",null);const s=this.getAttribute("values");s.hasValue()&&this.values.setValue(s.getString().split(";"))}}class as extends de{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),s=new le(e.getColor()),r=new le(i.getColor());if(s.ok&&r.ok){const o=s.r+(r.r-s.r)*t,n=s.g+(r.g-s.g)*t,a=s.b+(r.b-s.b)*t;return"rgb(".concat(Math.floor(o),", ").concat(Math.floor(n),", ").concat(Math.floor(a),")")}return this.getAttribute("from").getColor()}constructor(...t){super(...t),this.type="animateColor"}}class us extends de{calcValue(){const{progress:t,from:e,to:i}=this.getProgress(),s=$(e.getString()),r=$(i.getString());return s.map((n,a)=>{const u=r[a];return n+(u-n)*t}).join(" ")}constructor(...t){super(...t),this.type="animateTransform"}}class ii extends P{constructor(t,e,i){super(t,e,i),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class pe extends F{constructor(t,e,i){super(t,e,i),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class si extends pe{constructor(...t){super(...t),this.type="missing-glyph",this.horizAdvX=0}}class hs extends P{render(){}constructor(t,e,i){super(t,e,i),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:s}=t,{children:r}=this;for(const o of r)if(o instanceof ii){this.fontFace=o;const n=o.getStyle("font-family");n.hasValue()&&(s[n.getString()]=this)}else if(o instanceof si)this.missingGlyph=o;else if(o instanceof pe)if(o.arabicForm){this.isRTL=!0,this.isArabic=!0;const n=this.arabicGlyphs[o.unicode];typeof n=="undefined"?this.arabicGlyphs[o.unicode]={[o.arabicForm]:o}:n[o.arabicForm]=o}else this.glyphs[o.unicode]=o}}class ls extends ut{getText(){const t=this.getHrefAttribute().getDefinition();if(t){const e=t.children[0];if(e)return e.getText()}return""}constructor(...t){super(...t),this.type="tref"}}class cs extends ut{getText(){return this.text}renderChildren(t){if(this.hasText){super.renderChildren(t);const{document:e,x:i,y:s}=this,{mouse:r}=e.screen,o=new A(e,"fontSize",W.parse(e.ctx.font).fontSize);r.isWorking()&&r.checkBoundingBox(this,new J(i,s-o.getPixels("y"),i+this.measureText(t),s))}else if(this.children.length>0){const e=new ge(this.document);e.children=this.children,e.parent=this,e.render(t)}}onClick(){const{window:t}=this.document;t&&t.open(this.getHrefAttribute().getString())}onMouseMove(){const t=this.document.ctx;t.canvas.style.cursor="pointer"}constructor(t,e,i){super(t,e,i),this.type="a";const{childNodes:s}=e,r=s[0],o=s.length>0&&Array.from(s).every(n=>n.nodeType===3);this.hasText=o,this.text=o?this.getTextFromNode(r):""}}class fs extends ut{getText(){return this.text}path(t){const{dataArray:e}=this;t&&t.beginPath(),e.forEach(i=>{let{type:s,points:r}=i;switch(s){case T.LINE_TO:t&&t.lineTo(r[0],r[1]);break;case T.MOVE_TO:t&&t.moveTo(r[0],r[1]);break;case T.CURVE_TO:t&&t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case T.QUAD_TO:t&&t.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case T.ARC:{const[o,n,a,u,l,f,g,c]=r,d=a>u?a:u,p=a>u?1:a/u,y=a>u?u/a:1;t&&(t.translate(o,n),t.rotate(g),t.scale(p,y),t.arc(0,0,d,l,l+f,Boolean(1-c)),t.scale(1/p,1/y),t.rotate(-g),t.translate(-o,-n));break}case T.CLOSE_PATH:t&&t.closePath();break}})}renderChildren(t){this.setTextData(t),t.save();const e=this.parent.getStyle("text-decoration").getString(),i=this.getFontSize(),{glyphInfo:s}=this,r=t.fillStyle;e==="underline"&&t.beginPath(),s.forEach((o,n)=>{const{p0:a,p1:u,rotation:l,text:f}=o;t.save(),t.translate(a.x,a.y),t.rotate(l),t.fillStyle&&t.fillText(f,0,0),t.strokeStyle&&t.strokeText(f,0,0),t.restore(),e==="underline"&&(n===0&&t.moveTo(a.x,a.y+i/8),t.lineTo(u.x,u.y+i/5))}),e==="underline"&&(t.lineWidth=i/20,t.strokeStyle=r,t.stroke(),t.closePath()),t.restore()}getLetterSpacingAt(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[t]||0}findSegmentToFitChar(t,e,i,s,r,o,n,a,u){let l=o,f=this.measureText(t,a);a===" "&&e==="justify"&&i<s&&(f+=(s-i)/r),u>-1&&(l+=this.getLetterSpacingAt(u));const g=this.textHeight/20,c=this.getEquidistantPointOnPath(l,g,0),d=this.getEquidistantPointOnPath(l+f,g,0),p={p0:c,p1:d},y=c&&d?Math.atan2(d.y-c.y,d.x-c.x):0;if(n){const x=Math.cos(Math.PI/2+y)*n,C=Math.cos(-y)*n;p.p0={...c,x:c.x+x,y:c.y+C},p.p1={...d,x:d.x+x,y:d.y+C}}return l+=f,{offset:l,segment:p,rotation:y}}measureText(t,e){const{measuresCache:i}=this,s=e||this.getText();if(i.has(s))return i.get(s);const r=this.measureTargetText(t,s);return i.set(s,r),r}setTextData(t){if(this.glyphInfo)return;const e=this.getText(),i=e.split(""),s=e.split(" ").length-1,r=this.parent.getAttribute("dx").split().map(b=>b.getPixels("x")),o=this.parent.getAttribute("dy").getPixels("y"),n=this.parent.getStyle("text-anchor").getString("start"),a=this.getStyle("letter-spacing"),u=this.parent.getStyle("letter-spacing");let l=0;!a.hasValue()||a.getValue()==="inherit"?l=u.getPixels():a.hasValue()&&a.getValue()!=="initial"&&a.getValue()!=="unset"&&(l=a.getPixels());const f=[],g=e.length;this.letterSpacingCache=f;for(let b=0;b<g;b++)f.push(typeof r[b]!="undefined"?r[b]:l);const c=f.reduce((b,v,w)=>w===0?0:b+v||0,0),d=this.measureText(t),p=Math.max(d+c,0);this.textWidth=d,this.textHeight=this.getFontSize(),this.glyphInfo=[];const y=this.getPathLength(),x=this.getStyle("startOffset").getNumber(0)*y;let C=0;(n==="middle"||n==="center")&&(C=-p/2),(n==="end"||n==="right")&&(C=-p),C+=x,i.forEach((b,v)=>{const{offset:w,segment:E,rotation:S}=this.findSegmentToFitChar(t,n,p,y,s,C,o,b,v);C=w,!(!E.p0||!E.p1)&&this.glyphInfo.push({text:i[v],p0:E.p0,p1:E.p1,rotation:S})})}parsePathData(t){if(this.pathLength=-1,!t)return[];const e=[],{pathParser:i}=t;for(i.reset();!i.isEnd();){const{current:s}=i,r=s?s.x:0,o=s?s.y:0,n=i.next();let a=n.type,u=[];switch(n.type){case T.MOVE_TO:this.pathM(i,u);break;case T.LINE_TO:a=this.pathL(i,u);break;case T.HORIZ_LINE_TO:a=this.pathH(i,u);break;case T.VERT_LINE_TO:a=this.pathV(i,u);break;case T.CURVE_TO:this.pathC(i,u);break;case T.SMOOTH_CURVE_TO:a=this.pathS(i,u);break;case T.QUAD_TO:this.pathQ(i,u);break;case T.SMOOTH_QUAD_TO:a=this.pathT(i,u);break;case T.ARC:u=this.pathA(i);break;case T.CLOSE_PATH:F.pathZ(i);break}n.type!==T.CLOSE_PATH?e.push({type:a,points:u,start:{x:r,y:o},pathLength:this.calcLength(r,o,a,u)}):e.push({type:T.CLOSE_PATH,points:[],pathLength:0})}return e}pathM(t,e){const{x:i,y:s}=F.pathM(t).point;e.push(i,s)}pathL(t,e){const{x:i,y:s}=F.pathL(t).point;return e.push(i,s),T.LINE_TO}pathH(t,e){const{x:i,y:s}=F.pathH(t).point;return e.push(i,s),T.LINE_TO}pathV(t,e){const{x:i,y:s}=F.pathV(t).point;return e.push(i,s),T.LINE_TO}pathC(t,e){const{point:i,controlPoint:s,currentPoint:r}=F.pathC(t);e.push(i.x,i.y,s.x,s.y,r.x,r.y)}pathS(t,e){const{point:i,controlPoint:s,currentPoint:r}=F.pathS(t);return e.push(i.x,i.y,s.x,s.y,r.x,r.y),T.CURVE_TO}pathQ(t,e){const{controlPoint:i,currentPoint:s}=F.pathQ(t);e.push(i.x,i.y,s.x,s.y)}pathT(t,e){const{controlPoint:i,currentPoint:s}=F.pathT(t);return e.push(i.x,i.y,s.x,s.y),T.QUAD_TO}pathA(t){let{rX:e,rY:i,sweepFlag:s,xAxisRotation:r,centp:o,a1:n,ad:a}=F.pathA(t);return s===0&&a>0&&(a-=2*Math.PI),s===1&&a<0&&(a+=2*Math.PI),[o.x,o.y,e,i,n,a,r,s]}calcLength(t,e,i,s){let r=0,o=null,n=null,a=0;switch(i){case T.LINE_TO:return this.getLineLength(t,e,s[0],s[1]);case T.CURVE_TO:for(r=0,o=this.getPointOnCubicBezier(0,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),a=.01;a<=1;a+=.01)n=this.getPointOnCubicBezier(a,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case T.QUAD_TO:for(r=0,o=this.getPointOnQuadraticBezier(0,t,e,s[0],s[1],s[2],s[3]),a=.01;a<=1;a+=.01)n=this.getPointOnQuadraticBezier(a,t,e,s[0],s[1],s[2],s[3]),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return r;case T.ARC:{r=0;const u=s[4],l=s[5],f=s[4]+l;let g=Math.PI/180;if(Math.abs(u-f)<g&&(g=Math.abs(u-f)),o=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],u,0),l<0)for(a=u-g;a>f;a-=g)n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;else for(a=u+g;a<f;a+=g)n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],a,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),o=n;return n=this.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],f,0),r+=this.getLineLength(o.x,o.y,n.x,n.y),r}}return 0}getPointOnLine(t,e,i,s,r){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e,n=arguments.length>6&&arguments[6]!==void 0?arguments[6]:i;const a=(r-i)/(s-e+At);let u=Math.sqrt(t*t/(1+a*a));s<e&&(u*=-1);let l=a*u,f=null;if(s===e)f={x:o,y:n+l};else if((n-i)/(o-e+At)===a)f={x:o+u,y:n+l};else{let g=0,c=0;const d=this.getLineLength(e,i,s,r);if(d<At)return null;let p=(o-e)*(s-e)+(n-i)*(r-i);p/=d*d,g=e+p*(s-e),c=i+p*(r-i);const y=this.getLineLength(o,n,g,c),x=Math.sqrt(t*t-y*y);u=Math.sqrt(x*x/(1+a*a)),s<e&&(u*=-1),l=a*u,f={x:g+u,y:c+l}}return f}getPointOnPath(t){const e=this.getPathLength();let i=0,s=null;if(t<-5e-5||t-5e-5>e)return null;const{dataArray:r}=this;for(const o of r){if(o&&(o.pathLength<5e-5||i+o.pathLength+5e-5<t)){i+=o.pathLength;continue}const n=t-i;let a=0;switch(o.type){case T.LINE_TO:s=this.getPointOnLine(n,o.start.x,o.start.y,o.points[0],o.points[1],o.start.x,o.start.y);break;case T.ARC:{const u=o.points[4],l=o.points[5],f=o.points[4]+l;if(a=u+n/o.pathLength*l,l<0&&a<f||l>=0&&a>f)break;s=this.getPointOnEllipticalArc(o.points[0],o.points[1],o.points[2],o.points[3],a,o.points[6]);break}case T.CURVE_TO:a=n/o.pathLength,a>1&&(a=1),s=this.getPointOnCubicBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3],o.points[4],o.points[5]);break;case T.QUAD_TO:a=n/o.pathLength,a>1&&(a=1),s=this.getPointOnQuadraticBezier(a,o.start.x,o.start.y,o.points[0],o.points[1],o.points[2],o.points[3]);break}if(s)return s;break}return null}getLineLength(t,e,i,s){return Math.sqrt((i-t)*(i-t)+(s-e)*(s-e))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((t,e)=>e.pathLength>0?t+e.pathLength:t,0)),this.pathLength}getPointOnCubicBezier(t,e,i,s,r,o,n,a,u){const l=a*De(t)+o*Re(t)+s*Le(t)+e*Ie(t),f=u*De(t)+n*Re(t)+r*Le(t)+i*Ie(t);return{x:l,y:f}}getPointOnQuadraticBezier(t,e,i,s,r,o,n){const a=o*_e(t)+s*ze(t)+e*He(t),u=n*_e(t)+r*ze(t)+i*He(t);return{x:a,y:u}}getPointOnEllipticalArc(t,e,i,s,r,o){const n=Math.cos(o),a=Math.sin(o),u={x:i*Math.cos(r),y:s*Math.sin(r)};return{x:t+(u.x*n-u.y*a),y:e+(u.x*a+u.y*n)}}buildEquidistantCache(t,e){const i=this.getPathLength(),s=e||.25,r=t||i/100;if(!this.equidistantCache||this.equidistantCache.step!==r||this.equidistantCache.precision!==s){this.equidistantCache={step:r,precision:s,points:[]};let o=0;for(let n=0;n<=i;n+=s){const a=this.getPointOnPath(n),u=this.getPointOnPath(n+s);!a||!u||(o+=this.getLineLength(a.x,a.y,u.x,u.y),o>=r&&(this.equidistantCache.points.push({x:a.x,y:a.y,distance:n}),o-=r))}}}getEquidistantPointOnPath(t,e,i){if(this.buildEquidistantCache(e,i),t<0||t-this.getPathLength()>5e-5)return null;const s=Math.round(t/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[s]||null}constructor(t,e,i){super(t,e,i),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const s=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(s)}}const gs=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ds extends mt{async loadImage(t){try{const e=await this.document.createImage(t);this.image=e}catch(e){console.error('Error while loading image "'.concat(t,'":'),e)}this.loaded=!0}async loadSvg(t){const e=gs.exec(t);if(e){const i=e[5];i&&(e[4]==="base64"?this.image=atob(i):this.image=decodeURIComponent(i))}else try{const s=await(await this.document.fetch(t)).text();this.image=s}catch(i){console.error('Error while loading image "'.concat(t,'":'),i)}this.loaded=!0}renderChildren(t){const{document:e,image:i,loaded:s}=this,r=this.getAttribute("x").getPixels("x"),o=this.getAttribute("y").getPixels("y"),n=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y");if(!(!s||!i||!n||!a)){if(t.save(),t.translate(r,o),typeof i=="string"){const u=e.canvg.forkString(t,i,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:n,scaleHeight:a}),{documentElement:l}=u.document;l&&(l.parent=this),u.render()}else e.setViewBox({ctx:t,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:n,desiredWidth:i.width,height:a,desiredHeight:i.height}),this.loaded&&(!("complete"in i)||i.complete)&&t.drawImage(i,0,0);t.restore()}}getBoundingBox(){const t=this.getAttribute("x").getPixels("x"),e=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),s=this.getStyle("height").getPixels("y");return new J(t,e,t+i,e+s)}constructor(t,e,i){super(t,e,i),this.type="image",this.loaded=!1;const s=this.getHrefAttribute().getString();if(!s)return;const r=s.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(s);t.images.push(this),r?this.loadSvg(s):this.loadImage(s)}}class ps extends mt{render(t){}constructor(...t){super(...t),this.type="symbol"}}class ms{async load(t,e){try{const{document:i}=this,r=(await i.canvg.parser.load(e)).getElementsByTagName("font");Array.from(r).forEach(o=>{const n=i.createElement(o);i.definitions[t]=n})}catch(i){console.error('Error while loading font "'.concat(e,'":'),i)}this.loaded=!0}constructor(t){this.document=t,this.loaded=!1,t.fonts.push(this)}}class ri extends P{constructor(t,e,i){super(t,e,i),this.type="style",St(Array.from(e.childNodes).map(o=>o.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(o=>{const n=o.trim();if(!n)return;const a=n.split("{"),u=a[0].split(","),l=a[1].split(";");u.forEach(f=>{const g=f.trim();if(!g)return;const c=t.styles[g]||{};if(l.forEach(d=>{const p=d.indexOf(":"),y=d.substr(0,p).trim(),x=d.substr(p+1,d.length-p).trim();y&&x&&(c[y]=new A(t,y,x))}),t.styles[g]=c,t.stylesSpecificity[g]=ki(g),g==="@font-face"){const d=c["font-family"].getString().replace(/"|'/g,"");c.src.getString().split(",").forEach(y=>{if(y.indexOf('format("svg")')>0){const x=Qe(y);x&&new ms(t).load(d,x)}})}})})}}ri.parseExternalUrl=Qe;class ys extends mt{setContext(t){super.setContext(t);const e=this.getAttribute("x"),i=this.getAttribute("y");e.hasValue()&&t.translate(e.getPixels("x"),0),i.hasValue()&&t.translate(0,i.getPixels("y"))}path(t){const{element:e}=this;e&&e.path(t)}renderChildren(t){const{document:e,element:i}=this;if(i){let s=i;if(i.type==="symbol"&&(s=new Pt(e),s.attributes.viewBox=new A(e,"viewBox",i.getAttribute("viewBox").getString()),s.attributes.preserveAspectRatio=new A(e,"preserveAspectRatio",i.getAttribute("preserveAspectRatio").getString()),s.attributes.overflow=new A(e,"overflow",i.getAttribute("overflow").getString()),s.children=i.children,i.styles.opacity=new A(e,"opacity",this.calculateOpacity())),s.type==="svg"){const o=this.getStyle("width",!1,!0),n=this.getStyle("height",!1,!0);o.hasValue()&&(s.attributes.width=new A(e,"width",o.getString())),n.hasValue()&&(s.attributes.height=new A(e,"height",n.getString()))}const r=s.parent;s.parent=this,s.render(t),s.parent=r}}getBoundingBox(t){const{element:e}=this;return e?e.getBoundingBox(t):null}elementTransform(){const{document:t,element:e}=this;return e?pt.fromElement(t,e):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...t){super(...t),this.type="use"}}function _t(h,t,e,i,s,r){return h[e*i*4+t*4+r]}function zt(h,t,e,i,s,r,o){h[e*i*4+t*4+r]=o}function D(h,t,e){return h[t]*e}function it(h,t,e,i){return t+Math.cos(h)*e+Math.sin(h)*i}class ni extends P{apply(t,e,i,s,r){const{includeOpacity:o,matrix:n}=this,a=t.getImageData(0,0,s,r);for(let u=0;u<r;u++)for(let l=0;l<s;l++){const f=_t(a.data,l,u,s,r,0),g=_t(a.data,l,u,s,r,1),c=_t(a.data,l,u,s,r,2),d=_t(a.data,l,u,s,r,3);let p=D(n,0,f)+D(n,1,g)+D(n,2,c)+D(n,3,d)+D(n,4,1),y=D(n,5,f)+D(n,6,g)+D(n,7,c)+D(n,8,d)+D(n,9,1),x=D(n,10,f)+D(n,11,g)+D(n,12,c)+D(n,13,d)+D(n,14,1),C=D(n,15,f)+D(n,16,g)+D(n,17,c)+D(n,18,d)+D(n,19,1);o&&(p=0,y=0,x=0,C*=d/255),zt(a.data,l,u,s,r,0,p),zt(a.data,l,u,s,r,1,y),zt(a.data,l,u,s,r,2,x),zt(a.data,l,u,s,r,3,C)}t.clearRect(0,0,s,r),t.putImageData(a,0,0)}constructor(t,e,i){super(t,e,i),this.type="feColorMatrix";let s=$(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":{const r=s[0];s=[.213+.787*r,.715-.715*r,.072-.072*r,0,0,.213-.213*r,.715+.285*r,.072-.072*r,0,0,.213-.213*r,.715-.715*r,.072+.928*r,0,0,0,0,0,1,0,0,0,0,0,1];break}case"hueRotate":{const r=s[0]*Math.PI/180;s=[it(r,.213,.787,-.213),it(r,.715,-.715,-.715),it(r,.072,-.072,.928),0,0,it(r,.213,-.213,.143),it(r,.715,.285,.14),it(r,.072,-.072,-.283),0,0,it(r,.213,-.213,-.787),it(r,.715,-.715,.715),it(r,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break}case"luminanceToAlpha":s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1];break}this.matrix=s,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}}class Yt extends P{apply(t,e){const{document:i}=this;let s=this.getAttribute("x").getPixels("x"),r=this.getAttribute("y").getPixels("y"),o=this.getStyle("width").getPixels("x"),n=this.getStyle("height").getPixels("y");if(!o&&!n){const c=new J;this.children.forEach(d=>{c.addBoundingBox(d.getBoundingBox(t))}),s=Math.floor(c.x1),r=Math.floor(c.y1),o=Math.floor(c.width),n=Math.floor(c.height)}const a=this.removeStyles(e,Yt.ignoreStyles),u=i.createCanvas(s+o,r+n),l=u.getContext("2d");i.screen.setDefaults(l),this.renderChildren(l),new ni(i,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(l,0,0,s+o,r+n);const f=i.createCanvas(s+o,r+n),g=f.getContext("2d");i.screen.setDefaults(g),e.render(g),g.globalCompositeOperation="destination-in",g.fillStyle=l.createPattern(u,"no-repeat"),g.fillRect(0,0,s+o,r+n),t.fillStyle=g.createPattern(f,"no-repeat"),t.fillRect(0,0,s+o,r+n),this.restoreStyles(e,a)}render(t){}constructor(...t){super(...t),this.type="mask"}}Yt.ignoreStyles=["mask","transform","clip-path"];const Xe=()=>{};class xs extends P{apply(t){const{document:e}=this,i=Reflect.getPrototypeOf(t),{beginPath:s,closePath:r}=t;i&&(i.beginPath=Xe,i.closePath=Xe),Reflect.apply(s,t,[]),this.children.forEach(o=>{if(!("path"in o))return;let n="elementTransform"in o?o.elementTransform():null;n||(n=pt.fromElement(e,o)),n&&n.apply(t),o.path(t),i&&(i.closePath=r),n&&n.unapply(t)}),Reflect.apply(r,t,[]),t.clip(),i&&(i.beginPath=s,i.closePath=r)}render(t){}constructor(...t){super(...t),this.type="clipPath"}}class Wt extends P{apply(t,e){const{document:i,children:s}=this,r="getBoundingBox"in e?e.getBoundingBox(t):null;if(!r)return;let o=0,n=0;s.forEach(x=>{const C=x.extraFilterDistance||0;o=Math.max(o,C),n=Math.max(n,C)});const a=Math.floor(r.width),u=Math.floor(r.height),l=a+2*o,f=u+2*n;if(l<1||f<1)return;const g=Math.floor(r.x),c=Math.floor(r.y),d=this.removeStyles(e,Wt.ignoreStyles),p=i.createCanvas(l,f),y=p.getContext("2d");i.screen.setDefaults(y),y.translate(-g+o,-c+n),e.render(y),s.forEach(x=>{typeof x.apply=="function"&&x.apply(y,0,0,l,f)}),t.drawImage(p,0,0,l,f,g-o,c-n,l,f),this.restoreStyles(e,d)}render(t){}constructor(...t){super(...t),this.type="filter"}}Wt.ignoreStyles=["filter","transform","clip-path"];class bs extends P{apply(t,e,i,s,r){}constructor(t,e,i){super(t,e,i),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class vs extends P{apply(t,e,i,s,r){}constructor(...t){super(...t),this.type="feMorphology"}}class As extends P{apply(t,e,i,s,r){}constructor(...t){super(...t),this.type="feComposite"}}class Cs extends P{apply(t,e,i,s,r){const{document:o,blurRadius:n}=this,a=o.window?o.window.document.body:null,u=t.canvas;u.id=o.getUniqueId(),a&&(u.style.display="none",a.appendChild(u)),mi(u,e,i,s,r,n),a&&a.removeChild(u)}constructor(t,e,i){super(t,e,i),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class Ss extends P{constructor(...t){super(...t),this.type="title"}}class Ts extends P{constructor(...t){super(...t),this.type="desc"}}const Es={svg:Pt,rect:Je,circle:ji,ellipse:Ki,line:Ji,polyline:ti,polygon:ts,path:F,pattern:es,marker:is,defs:ss,linearGradient:rs,radialGradient:ns,stop:os,animate:de,animateColor:as,animateTransform:us,font:hs,"font-face":ii,"missing-glyph":si,glyph:pe,text:ut,tspan:Xt,tref:ls,a:cs,textPath:fs,image:ds,g:ge,symbol:ps,style:ri,use:ys,mask:Yt,clipPath:xs,filter:Wt,feDropShadow:bs,feMorphology:vs,feComposite:As,feColorMatrix:ni,feGaussianBlur:Cs,title:Ss,desc:Ts};function ws(h,t){const e=document.createElement("canvas");return e.width=h,e.height=t,e}async function Fs(h){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const e=document.createElement("img");return t&&(e.crossOrigin="Anonymous"),new Promise((i,s)=>{e.onload=()=>{i(e)},e.onerror=(r,o,n,a,u)=>{s(u)},e.src=h})}const he=12;class at{bindCreateImage(t,e){return typeof e=="boolean"?(i,s)=>t(i,typeof s=="boolean"?s:e):t}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:t}=this;return t[t.length-1]||he}set emSize(t){const{emSizeStack:e}=this;e.push(t)}popEmSize(){const{emSizeStack:t}=this;t.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(t=>t.loaded)}isFontsLoaded(){return this.fonts.every(t=>t.loaded)}createDocumentElement(t){const e=this.createElement(t.documentElement);return e.root=!0,e.addStylesFromStyleDefinition(),this.documentElement=e,e}createElement(t){const e=t.nodeName.replace(/^[^:]+:/,""),i=at.elementTypes[e];return i?new i(this,t):new Wi(this,t)}createTextNode(t){return new Zi(this,t)}setViewBox(t){this.screen.setViewBox({document:this,...t})}constructor(t,{rootEmSize:e=he,emSize:i=he,createCanvas:s=at.createCanvas,createImage:r=at.createImage,anonymousCrossOrigin:o}={}){this.canvg=t,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=t.screen,this.rootEmSize=e,this.emSize=i,this.createCanvas=s,this.createImage=this.bindCreateImage(r,o),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}at.createCanvas=ws;at.createImage=Fs;at.elementTypes=Es;class bt{static async from(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=await new ue(i).parse(e);return new bt(t,r,i)}static fromString(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=new ue(i).parseFromString(e);return new bt(t,r,i)}fork(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return bt.from(t,e,{...this.options,...i})}forkString(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return bt.fromString(t,e,{...this.options,...i})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...t}),await this.ready(),this.stop()}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:e,screen:i,options:s}=this;i.start(e,{enableRedraw:!0,...s,...t})}stop(){this.screen.stop()}resize(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(t,e,i)}constructor(t,e,i={}){this.parser=new ue(i),this.screen=new rt(t,i),this.options=i;const s=new at(this,i),r=s.createDocumentElement(e);this.document=s,this.documentElement=r}}window.OffscreenCanvas||(window.OffscreenCanvas=class{constructor(t,e){return this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=e,this.canvas.convertToBlob=()=>new Promise(i=>{this.canvas.toBlob(i)}),this.canvas}});const Ps=vi.offscreen(),Ms=h=>new Promise((t,e)=>{const i=new FileReader;i.onloadend=()=>t(i.result),i.readAsDataURL(h)}),Bs=async(h,t,e)=>{let i=new OffscreenCanvas(t,e);const s=i.getContext("2d");let r=await bt.fromString(s,h,Ps);r.resize(t/1.2,e/1.2,"xMidYMid meet"),await r.start();let o=await i.convertToBlob();const n=await Ms(o);return s.clearRect(0,0,i.width,i.height),i=null,r.stop(),r=null,o=null,n};export{Os as g,Bs as s};