@vue-skuilder/platform-ui 0.1.30 → 0.1.31-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/assets/About-BzQmP9L6.js +2 -0
  2. package/dist/assets/About-BzQmP9L6.js.map +1 -0
  3. package/dist/assets/AdminDashboard-Btfp3xbX.js +2 -0
  4. package/dist/assets/AdminDashboard-Btfp3xbX.js.map +1 -0
  5. package/dist/assets/AdminDashboard-CWnC_vEI.css +1 -0
  6. package/dist/assets/ClassroomCtrlPanel-Del1NMJ0.js +2 -0
  7. package/dist/assets/ClassroomCtrlPanel-Del1NMJ0.js.map +1 -0
  8. package/dist/assets/Classrooms-uc9jXghN.js +2 -0
  9. package/dist/assets/Classrooms-uc9jXghN.js.map +1 -0
  10. package/dist/assets/CourseRouter-DfwtPHs0.js +2 -0
  11. package/dist/assets/CourseRouter-DfwtPHs0.js.map +1 -0
  12. package/dist/assets/CourseRouter-DuzvSsqI.css +1 -0
  13. package/dist/assets/Courses-DQW3kca9.css +1 -0
  14. package/dist/assets/Courses-Iub72F0b.js +2 -0
  15. package/dist/assets/Courses-Iub72F0b.js.map +1 -0
  16. package/dist/assets/DataInputFormTester-BL-SAhyy.js +2 -0
  17. package/dist/assets/DataInputFormTester-BL-SAhyy.js.map +1 -0
  18. package/dist/assets/EloModeration-B90G61YI.css +1 -0
  19. package/dist/assets/EloModeration-DK8zrUJv.js +2 -0
  20. package/dist/assets/EloModeration-DK8zrUJv.js.map +1 -0
  21. package/dist/assets/JoinCode-CnXEpiOH.js +2 -0
  22. package/dist/assets/JoinCode-CnXEpiOH.js.map +1 -0
  23. package/dist/assets/JoinCode-DFiral3R.css +1 -0
  24. package/dist/assets/NewCourseDialog-4P2ZrBpL.js +2 -0
  25. package/dist/assets/NewCourseDialog-4P2ZrBpL.js.map +1 -0
  26. package/dist/assets/ReleaseNotes-CH_BZW3D.js +2 -0
  27. package/dist/assets/ReleaseNotes-CH_BZW3D.js.map +1 -0
  28. package/dist/assets/RequestPasswordReset-06j_OmhC.js +2 -0
  29. package/dist/assets/RequestPasswordReset-06j_OmhC.js.map +1 -0
  30. package/dist/assets/RequestPasswordReset-Du5-awJG.css +1 -0
  31. package/dist/assets/ResetPassword-Bm2btF6K.js +2 -0
  32. package/dist/assets/ResetPassword-Bm2btF6K.js.map +1 -0
  33. package/dist/assets/Study-Cxxw_AYM.css +1 -0
  34. package/dist/assets/Study-D3owlaib.js +2 -0
  35. package/dist/assets/Study-D3owlaib.js.map +1 -0
  36. package/dist/assets/TagInformation-BpBQo85-.js +2 -0
  37. package/dist/assets/TagInformation-BpBQo85-.js.map +1 -0
  38. package/dist/assets/User-NjHri3_k.js +2 -0
  39. package/dist/assets/User-NjHri3_k.js.map +1 -0
  40. package/dist/assets/UserStats-B_Oc2Pl5.js +2 -0
  41. package/dist/assets/UserStats-B_Oc2Pl5.js.map +1 -0
  42. package/dist/assets/VerifyEmail-C_CXjeU5.js +2 -0
  43. package/dist/assets/VerifyEmail-C_CXjeU5.js.map +1 -0
  44. package/dist/assets/edit-ui.es-BX72VVRb.js +2 -0
  45. package/dist/assets/edit-ui.es-BX72VVRb.js.map +1 -0
  46. package/dist/assets/index-BHFq3MXV.js +3 -0
  47. package/dist/assets/index-BHFq3MXV.js.map +1 -0
  48. package/dist/assets/index-CfLe2ewO.js +3 -0
  49. package/dist/assets/index-CfLe2ewO.js.map +1 -0
  50. package/dist/assets/index-kzKpN32E.css +1 -0
  51. package/dist/assets/mousetrap-BPMmAIzH.js +2 -0
  52. package/dist/assets/mousetrap-BPMmAIzH.js.map +1 -0
  53. package/dist/index.html +2 -2
  54. package/dist/sw.js +1 -1
  55. package/dist/sw.js.map +1 -1
  56. package/package.json +7 -9
  57. package/src/router.ts +24 -19
  58. package/src/views/Courses.vue +2 -2
  59. package/dist/assets/index-B6AxCe1N.js +0 -2
  60. package/dist/assets/index-B6AxCe1N.js.map +0 -1
  61. package/dist/assets/index-DPLGnI5s.css +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CfLe2ewO.js","assets/index-kzKpN32E.css"])))=>i.map(i=>d[i]);
2
+ var e=Object.defineProperty,t=(t,i,n)=>((t,i,n)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n)(t,"symbol"!=typeof i?i+"":i,n);import{k as n,aa as r,ac as a,ad as o,a4 as c,X as l,l as h,ae as u,af as d,ag as p,r as f,f as m,o as g,h as b,F as y,e as _,a as w,t as x,d as k,b as C,n as S,ah as M,ai as E,u as T,c as P,w as A,aj as I,ak as N,al as L,G as O,a2 as B,am as D,an as R,H as z,ao as V,ap as q,aq as F,ar as j,as as H,a3 as G,at as U,au as W,m as Y,j as $,K,av as X,g as Q}from"./index-CfLe2ewO.js";import{aw as Z}from"./index-CfLe2ewO.js";const J={NonEmptyString:{instructions:"",test:e=>0!==e.length?{status:n.ok,msg:""}:{status:n.error,msg:"Input cannot be empty"}}},ee=[{name:a.Blanks,fields:[{name:"Input",type:r.MARKDOWN},{name:"Uploads",type:r.MEDIA_UPLOADS}]}],te={name:a.MATH_SingleDigitAddition,fields:[{name:"a",type:r.INT},{name:"b",type:r.INT}]},ie={name:a.MATH_EqualityTest,fields:[{name:"a",type:r.STRING},{name:"b",type:r.STRING}]};function ne(e,t){return Math.floor(Math.random()*(t-e+1))+e}function re(e){const t=[...e];for(let i=t.length-1;i>0;i--){const e=Math.floor(Math.random()*(i+1));[t[i],t[e]]=[t[e],t[i]]}return t}function se(e){return Math.cos(oe(e))}function ae(e){return Math.sin(oe(e))}function oe(e){return e/360*2*Math.PI}function ce(e,t){const i=new Array(t.length).fill("_"),n=e.split("");console.log(e,t),console.log("Attempt char codes:",e.split("").map((e=>e.charCodeAt(0)))),console.log("Answer char codes:",t.split("").map((e=>e.charCodeAt(0))));for(let r=0;r<t.length;r++)r<n.length&&n[r]===t[r]&&(i[r]=n[r],n[r]="");for(let r=t.length-1;r>=0;r--)if("_"===i[r]){const e=n.findIndex((e=>e===t[r]));-1!==e&&(i[r]=t[r],n[e]="")}return console.log(i.join(" ")),i.join(" ")}const le=k({name:"FillInView",components:{MarkdownRenderer:j((()=>U((()=>import("./index-CfLe2ewO.js").then((e=>e.ax))),__vite__mapDeps([0,1])).then((e=>e.MarkdownRenderer)))),RadioMultipleChoice:R,AudioAutoPlayer:F},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"FillInView"),n=L(i);n.question.value=new be(e.data);const r=O(),s=B((()=>{if(!n.question.value)throw i.logger.error("Question not initialized"),new Error("Question not initialized");return n.question.value}));z((()=>{try{if(n.question.value||(n.question.value=new be(e.data)),n.question.value.options){const e=m();r.value=re(e)}}catch(t){i.logger.error("Failed to initialize question:",t)}})),H((()=>{n.question.value=void 0}));const a=B((()=>r.value??[])),o=B((()=>!!e.data[0]["image-1"])),c=B((()=>{if(!o.value)return[""];const t=[];let i=1;for(;e.data[0][`image-${i}`];)t.push(URL.createObjectURL(e.data[0][`image-${i}`])),i++;return t})),l=B((()=>!!e.data[0]["audio-1"])),h=B((()=>s.value?.mdText||"")),u=B((()=>{if(!l.value)return[""];const t=[];let i=1;for(;e.data[0][`audio-${i}`];)t.push(URL.createObjectURL(e.data[0][`audio-${i}`])),i++;return t})),d=B((()=>{if(s.value.answers)return s.value.answers[Math.floor(s.value.answers.length*Math.random())];throw new Error("No answers provided")})),p=B((()=>{const e=d.value;if(console.log(`Prior answers: ${n.priorAnswers.value}`),e&&n.priorAnswers.value[0]?.[0]&&"UserInputString"===n.priorAnswers.value[0][1])return ce(n.priorAnswers.value[0][0],e);if(console.log("found no UserInputString"),d.value){let e="";for(let t=0;t<d.value.length;t++)e+="_ ";return e}return""})),f=B((()=>!!(s.value.answers&&s.value.answers.length>0))),m=()=>{if(!s.value?.options)return;if(s.value.options.length<=6)return s.value.options;const t=[];t.push(s.value.answers[Math.floor(Math.random()*s.value.answers.length)]);let i=re(s.value.options.filter((e=>-1===s.value.answers?.indexOf(e))));return e.modifyDifficulty&&(console.log(`Modifying difficulty: ${e.modifyDifficulty}`),i=e.modifyDifficulty<-200?i.slice(0,1):e.modifyDifficulty<-150?i.slice(0,2):e.modifyDifficulty<-100?i.slice(0,3):e.modifyDifficulty<-50?i.slice(0,4):i.slice(0,5)),t.push(...i.slice(0,5)),t};return G((()=>e.data),(e=>{try{if(n.question.value=new be(e),n.question.value?.options){const e=m();r.value=re(e)}}catch(t){i.logger.error("Failed to initialize/update question:",t)}}),{deep:!0}),{...i,...n,question:s,truncatedOptions:a,hasImage:o,imageURLs:c,hasAudio:l,audioURL:u,obscuredAnswer:p,someAnswer:d,isQuestion:f,handleNext:()=>{n.submitAnswer("")},markdownText:h}}}),he=(e,t)=>{const i=e.__vccOpts||e;for(const[n,r]of t)i[n]=r;return i},ue={"data-viewable":"FillInView"},de=["src"],pe={key:4,class:"text-center text-h6"},fe={key:5,class:"text-center text-h6"},me=he(le,[["render",function(e,t,i,n,r,s){const a=f("audio-auto-player"),o=f("markdown-renderer"),c=f("radio-multiple-choice"),l=f("v-spacer"),h=f("v-btn"),u=f("v-card-actions");return g(),m("div",ue,[e.hasAudio?(g(),P(a,{key:0,src:e.audioURL},null,8,["src"])):b("",!0),e.hasImage?(g(!0),m(y,{key:1},S(e.imageURLs,((e,t)=>(g(),m("img",{key:t,src:e},null,8,de)))),128)):b("",!0),e.markdownText?(g(),P(o,{key:2,md:e.markdownText},null,8,["md"])):b("",!0),e.question?.options?(g(),P(c,{key:3,"choice-list":e.truncatedOptions},null,8,["choice-list"])):1==e.priorAttempts?(g(),m("div",pe,[C("span",null,x(e.obscuredAnswer),1)])):2==e.priorAttempts?(g(),m("div",fe,[C("span",null,x(e.someAnswer),1)])):b("",!0),e.isQuestion?b("",!0):(g(),P(u,{key:6},{default:A((()=>[w(l),w(h,{color:"primary",autofocus:"autofocus",onClick:e.handleNext},{default:A((()=>t[0]||(t[0]=[_(" Next ")]))),_:1},8,["onClick"])])),_:1}))])}],["__scopeId","data-v-f91502f8"]]);function ge(e,t,i){const n=e.split(t),r=n[0],s=n[1].split(i);return{left:r,middle:s[0],right:s[1]}}const ve=class _BlanksCard extends l{constructor(e){super(e),t(this,"mdText",""),t(this,"answers",null),t(this,"options",null),this.mdText=e[0].Input,void 0===this.mdText&&(this.mdText="");const i=d(this.mdText,"{{","}}"),n=[];for(let t=0;t<i.length;t++){const e=i[t],r=e.trim();if(r.startsWith("{{")&&r.endsWith("}}")){const t=r.slice(2,-2).trim();if(p(t))n.push(e);else try{const t=this.optionsFromString(e);this.answers=t.answers,this.options=t.options,this.options?.length?n.push("{{ || }}"):n.push("{{ }}")}catch{n.push(e)}}else n.push(e)}this.mdText=n.join("")}splitTextToken(e){if(u(e)){const t=ge(e.text,"{{","}}"),i=ge(e.raw,"{{","}}"),n=[];return i.left.length>0&&n.push({type:"text",raw:i.left,text:t.left}),i.middle.length>0&&n.push({type:"text",raw:"{{"+i.middle+"}}",text:"{{"+t.middle+"}}"}),i.right.length>0&&n.push({type:"text",raw:i.right,text:t.right}),n}return[e]}optionsFromString(e){if(!e.startsWith("{{")||!e.endsWith("}}"))throw new Error(`string ${e} is not fill-in text - must look like "{{someText}}"`);const t=(e=e.substring(2,e.length-2)).split("||");if(t.length>1){const e=t[0].split("|").map((e=>e.trim())),i=t[1].split("|").map((e=>e.trim())).filter((t=>!e.includes(t)));return i.push(e[ne(0,e.length-1)]),{answers:e,options:re(i)}}return{answers:[e.trim()],options:null}}isCorrect(e){if(console.log(`answers:${this.answers}\nuser answer: ${JSON.stringify(e)}`),"string"==typeof e){if(this.answers)return this.answers.includes(e);if(""===e)return!0;throw new Error("Question has no configured answers!")}if(Array.isArray(e)){if(this.answers)return e.every((e=>this.answers.includes(e)));throw new Error("Question has no configured answers!")}return this.isCorrectRadio(e)}dataShapes(){return _BlanksCard.dataShapes}views(){return _BlanksCard.views}isCorrectRadio(e){return!!this.answers&&this.answers.includes(e.choiceList[e.selection])}};t(ve,"dataShapes",ee),t(ve,"views",[me]);let be=ve;class CourseWare{constructor(e,i){t(this,"name"),t(this,"questionList"),this.name=e,this.questionList=i,this.questionList=this.questionList.concat(this.getBaseQTypes())}get questions(){return this.questionList}get allViews(){const e=new Array;return this.questionList.forEach((t=>{t.views.forEach((t=>{e.push(t)}))})),e}get allViewsMap(){const e={};return this.allViews.forEach((t=>{if(!t.name)throw new Error("View has no name");e[t.name]=t})),e}getQuestion(e){return this.questionList.find((t=>{const i=t.name.replace(/^_/,"").replace(/\d+$/,""),n=e.replace(/^_/,"").replace(/\d+$/,"");return t.name===e||i===n||t.name.includes(n)||e.includes(i)}))}getBaseQTypes(){return[be]}}const ye=new CourseWare("default",[be]),_e=["cg-white","cg-black"],we=["a","b","c","d","e","f","g","h"],xe=["1","2","3","4","5","6","7","8"],ke=[...xe].reverse(),Ce=Array.prototype.concat(...we.map((e=>xe.map((t=>e+t))))),Se=e=>Ce[8*e[0]+e[1]],Me=e=>[e.charCodeAt(0)-97,e.charCodeAt(1)-49],Ee=Ce.map(Me),Te=()=>{let e;return{start(){e=performance.now()},cancel(){e=void 0},stop(){if(!e)return 0;const t=performance.now()-e;return e=void 0,t}}},Pe=e=>"cg-white"===e?"cg-black":"cg-white",Ae=(e,t)=>{const i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n},Ie=(e,t)=>e.role===t.role&&e.color===t.color,Ne=e=>(t,i)=>[(i?t[0]:7-t[0])*e.width/8,(i?7-t[1]:t[1])*e.height/8],Le=(e,t)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px)`},Oe=(e,t,i=1)=>{e.style.transform=`translate(${t[0]}px,${t[1]}px) scale(${i})`},Be=(e,t)=>{e.style.visibility=t?"visible":"hidden"},De=e=>e.clientX||0===e.clientX?[e.clientX,e.clientY]:e.targetTouches?.[0]?[e.targetTouches[0].clientX,e.targetTouches[0].clientY]:void 0,Re=e=>2===e.button,ze=(e,t)=>{const i=document.createElement(e);return t&&(i.className=t),i};function Ve(e,t,i){const n=Me(e);return t||(n[0]=7-n[0],n[1]=7-n[1]),[i.left+i.width*n[0]/8+i.width/16,i.top+i.height*(7-n[1])/8+i.height/16]}const qe=(e,t)=>Math.abs(e-t),Fe=(e,t,i,n)=>{const r=qe(e,i),s=qe(t,n);return 1===r&&2===s||2===r&&1===s},je=(e,t,i,n)=>qe(e,i)===qe(t,n),He=(e,t,i,n)=>e===i||t===n,Ge=(e,t,i,n)=>je(e,t,i,n)||He(e,t,i,n);function Ue(e,t,i){const n=e.get(t);if(!n)return[];const r=Me(t),s=n.role,a="pawn"===s?(o=n.color,(e,t,i,n)=>qe(e,i)<2&&("cg-white"===o?n===t+1||t<=1&&n===t+2&&e===i:n===t-1||t>=6&&n===t-2&&e===i)):"knight"===s?Fe:"bishop"===s?je:"rook"===s?He:"queen"===s?Ge:((e,t,i)=>(n,r,s,a)=>qe(n,s)<2&&qe(r,a)<2||i&&r===a&&r===("cg-white"===e?0:7)&&(4===n&&(2===s&&t.includes(0)||6===s&&t.includes(7))||t.includes(s)))(n.color,function(e,t){const i="cg-white"===t?"1":"8",n=[];for(const[r,s]of e)r[1]===i&&s.color===t&&"rook"===s.role&&n.push(Me(r)[0]);return n}(e,n.color),i);var o;return Ee.filter((e=>(r[0]!==e[0]||r[1]!==e[1])&&a(r[0],r[1],e[0],e[1]))).map(Se)}function We(e,...t){e&&setTimeout((()=>e(...t)),1)}function Ye(e){e.premovable.current&&(e.premovable.current=void 0,We(e.premovable.events.unset))}function $e(e){const t=e.predroppable;t.current&&(t.current=void 0,We(t.events.unset))}function Ke(e,t,i){const n=e.pieces.get(t),r=e.pieces.get(i);if(t===i||!n)return!1;const s=r&&r.color!==n.color?r:void 0;return i===e.selected&&it(e),We(e.events.move,t,i,s),function(e,t,i){if(!e.autoCastle)return!1;const n=e.pieces.get(t);if(!n||"king"!==n.role)return!1;const r=Me(t),s=Me(i);if(0!==r[1]&&7!==r[1]||r[1]!==s[1])return!1;4!==r[0]||e.pieces.has(i)||(6===s[0]?i=Se([7,s[1]]):2===s[0]&&(i=Se([0,s[1]])));const a=e.pieces.get(i);return!(!a||a.color!==n.color||"rook"!==a.role||(e.pieces.delete(t),e.pieces.delete(i),r[0]<s[0]?(e.pieces.set(Se([6,s[1]]),n),e.pieces.set(Se([5,s[1]]),a)):(e.pieces.set(Se([2,s[1]]),n),e.pieces.set(Se([3,s[1]]),a)),0))}(e,t,i)||(e.pieces.set(i,n),e.pieces.delete(t)),e.lastMove=[t,i],e.check=void 0,We(e.events.change),s||!0}function Xe(e,t,i,n){if(e.pieces.has(i)){if(!n)return!1;e.pieces.delete(i)}return We(e.events.dropNewPiece,t,i),e.pieces.set(i,t),e.lastMove=[i],e.check=void 0,We(e.events.change),e.movable.dests=void 0,e.turnColor=Pe(e.turnColor),!0}function Qe(e,t,i){const n=Ke(e,t,i);return n&&(e.movable.dests=void 0,e.turnColor=Pe(e.turnColor),e.animation.current=void 0),n}function Ze(e,t,i){if(rt(e,t,i)){const n=Qe(e,t,i);if(n){const r=e.hold.stop();it(e);const s={premove:!1,ctrlKey:e.stats.ctrlKey,holdTime:r};return!0!==n&&(s.captured=n),We(e.movable.events.after,t,i,s),!0}}else if(function(e,t,i){const n=e.premovable.customDests?.get(t)??Ue(e.pieces,t,e.premovable.castle);return t!==i&&st(e,t)&&n.includes(i)}(e,t,i))return n=e,r=t,s=i,a={ctrlKey:e.stats.ctrlKey},$e(n),n.premovable.current=[r,s],We(n.premovable.events.set,r,s,a),it(e),!0;var n,r,s,a;return it(e),!1}function Je(e,t,i,n){const r=e.pieces.get(t);var s,a,o;r&&(function(e,t,i){const n=e.pieces.get(t);return!(!n||t!==i&&e.pieces.has(i)||"both"!==e.movable.color&&(e.movable.color!==n.color||e.turnColor!==n.color))}(e,t,i)||n)?(e.pieces.delete(t),Xe(e,r,i,n),We(e.movable.events.afterNewPiece,r.role,i,{premove:!1,predrop:!1})):r&&function(e,t,i){const n=e.pieces.get(t),r=e.pieces.get(i);return!!n&&(!r||r.color!==e.movable.color)&&e.predroppable.enabled&&("pawn"!==n.role||"1"!==i[1]&&"8"!==i[1])&&e.movable.color===n.color&&e.turnColor!==n.color}(e,t,i)?(s=e,a=r.role,o=i,Ye(s),s.predroppable.current={role:a,key:o},We(s.predroppable.events.set,a,o)):(Ye(e),$e(e)),e.pieces.delete(t),it(e)}function et(e,t,i){if(We(e.events.select,t),e.selected){if(e.selected===t&&!e.draggable.enabled)return it(e),void e.hold.cancel();if((e.selectable.enabled||i)&&e.selected!==t&&Ze(e,e.selected,t))return void(e.stats.dragged=!1)}(e.selectable.enabled||e.draggable.enabled)&&(nt(e,t)||st(e,t))&&(tt(e,t),e.hold.start())}function tt(e,t){e.selected=t,st(e,t)?e.premovable.customDests||(e.premovable.dests=Ue(e.pieces,t,e.premovable.castle)):e.premovable.dests=void 0}function it(e){e.selected=void 0,e.premovable.dests=void 0,e.hold.cancel()}function nt(e,t){const i=e.pieces.get(t);return!!i&&("both"===e.movable.color||e.movable.color===i.color&&e.turnColor===i.color)}const rt=(e,t,i)=>t!==i&&nt(e,t)&&(e.movable.free||!!e.movable.dests?.get(t)?.includes(i));function st(e,t){const i=e.pieces.get(t);return!!i&&e.premovable.enabled&&e.movable.color===i.color&&e.turnColor!==i.color}function at(e){const t=e.premovable.current;if(!t)return!1;const i=t[0],n=t[1];let r=!1;if(rt(e,i,n)){const t=Qe(e,i,n);if(t){const s={premove:!0};!0!==t&&(s.captured=t),We(e.movable.events.after,i,n,s),r=!0}}return Ye(e),r}function ot(e){Ye(e),$e(e),it(e)}function ct(e){e.movable.color=e.movable.dests=e.animation.current=void 0,ot(e)}function lt(e,t,i){let n=Math.floor(8*(e[0]-i.left)/i.width);t||(n=7-n);let r=7-Math.floor(8*(e[1]-i.top)/i.height);return t||(r=7-r),n>=0&&n<8&&r>=0&&r<8?Se([n,r]):void 0}const ht=e=>"cg-white"===e.orientation,ut="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR",dt={p:"pawn",r:"rook",n:"knight",b:"bishop",q:"queen",k:"king"},pt={pawn:"p",rook:"r",knight:"n",bishop:"b",queen:"q",king:"k"};function ft(e){"start"===e&&(e=ut);const t=new Map;let i=7,n=0;for(const r of e)switch(r){case" ":case"[":return t;case"/":if(--i,i<0)return t;n=0;break;case"~":{const e=t.get(Se([n-1,i]));e&&(e.promoted=!0);break}default:{const e=r.charCodeAt(0);if(e<57)n+=e-48;else{const e=r.toLowerCase();t.set(Se([n,i]),{role:dt[e],color:r===e?"cg-black":"cg-white"}),++n}}}return t}function mt(e,t){t.animation&&(vt(e.animation,t.animation),(e.animation.duration||0)<70&&(e.animation.enabled=!1))}function gt(e,t){if(t.movable?.dests&&(e.movable.dests=void 0),t.drawable?.autoShapes&&(e.drawable.autoShapes=[]),vt(e,t),t.fen&&(e.pieces=ft(t.fen),e.drawable.shapes=t.drawable?.shapes||[]),"check"in t&&function(e,t){if(e.check=void 0,!0===t&&(t=e.turnColor),t)for(const[i,n]of e.pieces)"king"===n.role&&n.color===t&&(e.check=i)}(e,t.check||!1),"lastMove"in t&&!t.lastMove?e.lastMove=void 0:t.lastMove&&(e.lastMove=t.lastMove),e.selected&&tt(e,e.selected),mt(e,t),!e.movable.rookCastle&&e.movable.dests){const t="cg-white"===e.movable.color?"1":"8",i="e"+t,n=e.movable.dests.get(i),r=e.pieces.get(i);if(!n||!r||"king"!==r.role)return;e.movable.dests.set(i,n.filter((e=>!(e==="a"+t&&n.includes("c"+t)||e==="h"+t&&n.includes("g"+t)))))}}function vt(e,t){for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)&&bt(e[i])&&bt(t[i])?vt(e[i],t[i]):e[i]=t[i])}function bt(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const yt=(e,t)=>t.animation.enabled?function(e,t){const i=new Map(t.pieces),n=e(t),r=function(e,t){const i=new Map,n=[],r=new Map,s=[],a=[],o=new Map;let c,l,h;for(const[u,d]of e)o.set(u,wt(u,d));for(const u of Ce)c=t.pieces.get(u),l=o.get(u),c?l?Ie(c,l.piece)||(s.push(l),a.push(wt(u,c))):a.push(wt(u,c)):l&&s.push(l);for(const u of a)l=xt(u,s.filter((e=>Ie(u.piece,e.piece)))),l&&(h=[l.pos[0]-u.pos[0],l.pos[1]-u.pos[1]],i.set(u.key,h.concat(h)),n.push(l.key));for(const u of s)n.includes(u.key)||r.set(u.key,u.piece);return{anims:i,fadings:r}}(i,t);if(r.anims.size||r.fadings.size){const e=t.animation.current&&t.animation.current.start;t.animation.current={start:performance.now(),frequency:1/t.animation.duration,plan:r},e||kt(t,performance.now())}else t.dom.redraw();return n}(e,t):_t(e,t);function _t(e,t){const i=e(t);return t.dom.redraw(),i}const wt=(e,t)=>({key:e,pos:Me(e),piece:t}),xt=(e,t)=>t.sort(((t,i)=>Ae(e.pos,t.pos)-Ae(e.pos,i.pos)))[0];function kt(e,t){const i=e.animation.current;if(void 0===i)return void(e.dom.destroyed||e.dom.redrawNow());const n=1-(t-i.start)*i.frequency;if(n<=0)e.animation.current=void 0,e.dom.redrawNow();else{const t=Ct(n);for(const e of i.plan.anims.values())e[2]=e[0]*t,e[3]=e[1]*t;e.dom.redrawNow(!0),requestAnimationFrame(((t=performance.now())=>kt(e,t)))}}const Ct=e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,St=["green","red","blue","yellow"];function Mt(e,t){if(t.touches&&t.touches.length>1)return;t.stopPropagation(),t.preventDefault(),t.ctrlKey?it(e):ot(e);const i=De(t),n=lt(i,ht(e),e.dom.bounds());n&&(e.drawable.current={orig:n,pos:i,brush:It(t),snapToValidMove:e.drawable.defaultSnapToValidMove},Et(e))}function Et(e){requestAnimationFrame((()=>{const t=e.drawable.current;if(t){const i=lt(t.pos,ht(e),e.dom.bounds());i||(t.snapToValidMove=!1);const n=t.snapToValidMove?function(e,t,i,n){const r=Me(e),s=Ee.filter((e=>Ge(r[0],r[1],e[0],e[1])||Fe(r[0],r[1],e[0],e[1]))),a=s.map((e=>Ve(Se(e),i,n))).map((e=>Ae(t,e))),[,o]=a.reduce(((e,t,i)=>e[0]<t?e:[t,i]),[a[0],0]);return Se(s[o])}(t.orig,t.pos,ht(e),e.dom.bounds()):i;n!==t.mouseSq&&(t.mouseSq=n,t.dest=n!==t.orig?n:void 0,e.dom.redrawNow()),Et(e)}}))}function Tt(e,t){e.drawable.current&&(e.drawable.current.pos=De(t))}function Pt(e){const t=e.drawable.current;t&&(t.mouseSq&&function(e,t){const i=e=>e.orig===t.orig&&e.dest===t.dest,n=e.shapes.find(i);n&&(e.shapes=e.shapes.filter((e=>!i(e)))),n&&n.brush===t.brush||e.shapes.push({orig:t.orig,dest:t.dest,brush:t.brush}),Nt(e)}(e.drawable,t),At(e))}function At(e){e.drawable.current&&(e.drawable.current=void 0,e.dom.redraw())}function It(e){const t=(e.shiftKey||e.ctrlKey)&&Re(e),i=e.altKey||e.metaKey||e.getModifierState?.("AltGraph");return St[(t?1:0)+(i?2:0)]}function Nt(e){e.onChange&&e.onChange(e.shapes)}function Lt(e){requestAnimationFrame((()=>{const t=e.draggable.current;if(!t)return;e.animation.current?.plan.anims.has(t.orig)&&(e.animation.current=void 0);const i=e.pieces.get(t.orig);if(i&&Ie(i,t.piece)){if(!t.started&&Ae(t.pos,t.origPos)>=Math.pow(e.draggable.distance,2)&&(t.started=!0),t.started){if("function"==typeof t.element){const e=t.element();if(!e)return;e.cgDragging=!0,e.classList.add("dragging"),t.element=e}const i=e.dom.bounds();Le(t.element,[t.pos[0]-i.left-i.width/16,t.pos[1]-i.top-i.height/16]),t.keyHasChanged=t.keyHasChanged||t.orig!==lt(t.pos,ht(e),i)}}else Dt(e);Lt(e)}))}function Ot(e,t){e.draggable.current&&(!t.touches||t.touches.length<2)&&(e.draggable.current.pos=De(t))}function Bt(e,t){const i=e.draggable.current;if(!i)return;if("touchend"===t.type&&!1!==t.cancelable&&t.preventDefault(),"touchend"===t.type&&i.originTarget!==t.target&&!i.newPiece)return void(e.draggable.current=void 0);Ye(e),$e(e);const n=lt(De(t)||i.pos,ht(e),e.dom.bounds());n&&i.started&&i.orig!==n?i.newPiece?Je(e,i.orig,n,i.force):(e.stats.ctrlKey=t.ctrlKey,Ze(e,i.orig,n)&&(e.stats.dragged=!0)):i.newPiece?e.pieces.delete(i.orig):e.draggable.deleteOnDropOff&&!n&&(e.pieces.delete(i.orig),We(e.events.change)),(i.orig!==i.previouslySelected&&!i.keyHasChanged||i.orig!==n&&n)&&e.selectable.enabled||it(e),Rt(e),e.draggable.current=void 0,e.dom.redraw()}function Dt(e){const t=e.draggable.current;t&&(t.newPiece&&e.pieces.delete(t.orig),e.draggable.current=void 0,it(e),Rt(e),e.dom.redraw())}function Rt(e){const t=e.dom.elements;t.ghost&&Be(t.ghost,!1)}function zt(e,t){let i=e.dom.elements.board.firstChild;for(;i;){if(i.cgKey===t&&"PIECE"===i.tagName)return i;i=i.nextSibling}}function Vt(e,t){e.exploding&&(t?e.exploding.stage=t:e.exploding=void 0,e.dom.redraw())}const qt={hilitePrimary:{key:"hilitePrimary",color:"#3291ff",opacity:1,lineWidth:1},hiliteWhite:{key:"hiliteWhite",color:"#ffffff",opacity:1,lineWidth:1}};function Ft({orig:e,dest:t,brush:i,piece:n,modifiers:r,customSvg:s,label:a},o,c,l){return[l.width,l.height,c,e,t,i,o&&"-",n&&jt(n),r&&(h=r,[h.lineWidth,h.hilite&&"*"].filter((e=>e)).join(",")),s&&`custom-${Ht(s.html)},${s.center?.[0]??"o"}`,a&&`label-${Ht(a.text)}`].filter((e=>e)).join(",");var h}function jt(e){return[e.color,e.role,e.scale].filter((e=>e)).join(",")}function Ht(e){let t=0;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i)>>>0;return t.toString()}function Gt(e){return["#ffffff","#fff","white"].includes(e.color)?qt.hilitePrimary:qt.hiliteWhite}function Ut(e){const t=Xt(Kt("marker"),{id:"arrowhead-"+e.key,orient:"auto",overflow:"visible",markerWidth:4,markerHeight:4,refX:e.key.startsWith("hilite")?1.86:2.05,refY:2});return t.appendChild(Xt(Kt("path"),{d:"M0,0 V4 L3,2 Z",fill:e.color})),t.setAttribute("cgKey",e.key),t}function Wt(e,t,i,n,r,s){const a=.4*.75**e.text.length,o=ii(i,n,r),c="tr"===s?.4:0,l=Xt(Kt("g"),{transform:`translate(${o[0]+c},${o[1]-c})`,cgHash:t});l.appendChild(Xt(Kt("circle"),{r:.2,"fill-opacity":s?1:.8,"stroke-opacity":s?1:.7,"stroke-width":.03,fill:e.fill??"#666",stroke:"white"}));const h=Xt(Kt("text"),{"font-size":a,"font-family":"Noto Sans","text-anchor":"middle",fill:"white",y:.13*.75**e.text.length});return h.innerHTML=e.text,l.appendChild(h),l}function Yt(e,t){return"cg-white"===t?e:[7-e[0],7-e[1]]}function $t(e,t){return!0===(e&&t.has(e)&&t.get(e).size>1)}function Kt(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Xt(e,t){for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.setAttribute(i,t[i]);return e}function Qt(e,t){return t?{color:e.color,opacity:Math.round(10*e.opacity)/10,lineWidth:Math.round(t.lineWidth||e.lineWidth),key:[e.key,t.lineWidth].filter((e=>e)).join("")}:e}function Zt(e,t){return(e.lineWidth||10)*(t?.85:1)/64}function Jt(e,t){return(e.opacity||1)*(t?.9:1)}function ei(e,t){const i=Math.min(1,t.width/t.height),n=Math.min(1,t.height/t.width);return[(e[0]-3.5)*i,(3.5-e[1])*n]}function ti(e,t,i=!0){const n=Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI;return i?(Math.round(8*n/Math.PI)+16)%16:n}function ii(e,t,i){let n=(r=e,s=t,Math.sqrt([r[0]-s[0],r[1]-s[1]].reduce(((e,t)=>e+t*t),0)));var r,s;const a=ti(e,t,!1);if(i&&(n-=33/64,i.size>1)){n-=10/64;const r=ti(e,t);(i.has((r+1)%16)||i.has((r+15)%16))&&1&r&&(n-=.4)}return[e[0]-Math.cos(a)*n,e[1]-Math.sin(a)*n].map((e=>e+.5))}function ni(e,t){const i=ze("coords",t);let n;for(const r of e)n=ze("coord"),n.textContent=r,i.appendChild(n);return i}function ri(e,t,i,n){return e.addEventListener(t,i,n),()=>e.removeEventListener(t,i,n)}const si=e=>t=>{e.draggable.current?Dt(e):e.drawable.current?At(e):t.shiftKey||Re(t)?e.drawable.enabled&&Mt(e,t):e.viewOnly||(e.dropmode.active?function(e,t){if(!e.dropmode.active)return;Ye(e),$e(e);const i=e.dropmode.piece;if(i){e.pieces.set("a0",i);const n=De(t),r=n&&lt(n,ht(e),e.dom.bounds());r&&Je(e,"a0",r)}e.dom.redraw()}(e,t):function(e,t){if(!e.trustAllEvents&&!t.isTrusted)return;if(void 0!==t.buttons&&t.buttons>1)return;if(t.touches&&t.touches.length>1)return;const i=e.dom.bounds(),n=De(t),r=lt(n,ht(e),i);if(!r)return;const s=e.pieces.get(r),a=e.selected;var o;if(a||!e.drawable.enabled||!e.drawable.eraseOnClick&&s&&s.color===e.turnColor||(o=e).drawable.shapes.length&&(o.drawable.shapes=[],o.dom.redraw(),Nt(o.drawable)),!1!==t.cancelable&&(!t.touches||e.blockTouchScroll||s||a||function(e,t){const i=ht(e),n=e.dom.bounds(),r=Math.pow(n.width/8,2);for(const s of e.pieces.keys()){const e=Ve(s,i,n);if(Ae(e,t)<=r)return!0}return!1}(e,n)))t.preventDefault();else if(t.touches)return;const c=!!e.premovable.current,l=!!e.predroppable.current;e.stats.ctrlKey=t.ctrlKey,e.selected&&rt(e,e.selected,r)?yt((e=>et(e,r)),e):et(e,r);const h=e.selected===r,u=zt(e,r);if(s&&u&&h&&function(e,t){const i=e.pieces.get(t);return!!i&&e.draggable.enabled&&("both"===e.movable.color||e.movable.color===i.color&&(e.turnColor===i.color||e.premovable.enabled))}(e,r)){e.draggable.current={orig:r,piece:s,origPos:n,pos:n,started:e.draggable.autoDistance&&e.stats.dragged,element:u,previouslySelected:a,originTarget:t.target,keyHasChanged:!1},u.cgDragging=!0,u.classList.add("dragging");const o=e.dom.elements.ghost;o&&(o.className=`ghost ${s.color} ${s.role}`,Le(o,Ne(i)(Me(r),ht(e))),Be(o,!0)),Lt(e)}else c&&Ye(e),l&&$e(e);e.dom.redraw()}(e,t))},ai=(e,t,i)=>n=>{e.drawable.current?e.drawable.enabled&&i(e,n):e.viewOnly||t(e,n)};function oi(e){const t=e.dom.elements.wrap.getBoundingClientRect(),i=e.dom.elements.container,n=t.height/t.width,r=8*Math.floor(t.width*window.devicePixelRatio/8)/window.devicePixelRatio,s=r*n;i.style.width=r+"px",i.style.height=s+"px",e.dom.bounds.clear(),e.addDimensionsCssVarsTo?.style.setProperty("---cg-width",r+"px"),e.addDimensionsCssVarsTo?.style.setProperty("---cg-height",s+"px")}const ci=e=>"PIECE"===e.tagName,li=e=>"SQUARE"===e.tagName;function hi(e,t){for(const i of t)e.dom.elements.board.removeChild(i)}function ui(e,t){const i=e[1];return`${t?10-i:3+i}`}const di=e=>`${e.color} ${e.role}`;function pi(e,t,i){const n=e.get(t);n?e.set(t,`${n} ${i}`):e.set(t,i)}function fi(e,t,i){const n=e.get(t);n?n.push(i):e.set(t,[i])}const mi=e=>[e.orig,e.piece?.role,e.piece?.color,e.piece?.scale].join(",");function gi(e,t){const i={pieces:ft(ut),orientation:"cg-white",turnColor:"cg-white",coordinates:!0,coordinatesOnSquares:!1,ranksPosition:"right",autoCastle:!0,viewOnly:!1,disableContextMenu:!1,addPieceZIndex:!1,blockTouchScroll:!1,pieceKey:!1,trustAllEvents:!1,highlight:{lastMove:!0,check:!0},animation:{enabled:!0,duration:200},movable:{free:!0,color:"both",showDests:!0,events:{},rookCastle:!0},premovable:{enabled:!0,showDests:!0,castle:!0,events:{}},predroppable:{enabled:!1,events:{}},draggable:{enabled:!0,distance:3,autoDistance:!0,showGhost:!0,deleteOnDropOff:!1},dropmode:{active:!1},selectable:{enabled:!0},stats:{dragged:!("ontouchstart"in window)},events:{},drawable:{enabled:!0,visible:!0,defaultSnapToValidMove:!0,eraseOnClick:!0,shapes:[],autoShapes:[],brushes:{green:{key:"g",color:"#15781B",opacity:1,lineWidth:10},red:{key:"r",color:"#882020",opacity:1,lineWidth:10},blue:{key:"b",color:"#003088",opacity:1,lineWidth:10},yellow:{key:"y",color:"#e68f00",opacity:1,lineWidth:10},paleBlue:{key:"pb",color:"#003088",opacity:.4,lineWidth:15},paleGreen:{key:"pg",color:"#15781B",opacity:.4,lineWidth:15},paleRed:{key:"pr",color:"#882020",opacity:.4,lineWidth:15},paleGrey:{key:"pgr",color:"#4a4a4a",opacity:.35,lineWidth:15},purple:{key:"purple",color:"#68217a",opacity:.65,lineWidth:10},pink:{key:"pink",color:"#ee2080",opacity:.5,lineWidth:10},white:{key:"white",color:"white",opacity:1,lineWidth:10}},prevSvgHash:""},hold:Te()};function n(){const t="dom"in i?i.dom.unbind:void 0,n=function(e,t){e.innerHTML="",e.classList.add("cg-wrap");for(const c of _e)e.classList.toggle("orientation-"+c,t.orientation===c);e.classList.toggle("manipulable",!t.viewOnly);const i=ze("cg-container");e.appendChild(i);const n=ze("cg-board");let r,s,a,o;if(i.appendChild(n),t.drawable.visible&&(r=Xt(Kt("svg"),{class:"cg-shapes",viewBox:"-4 -4 8 8",preserveAspectRatio:"xMidYMid slice"}),r.appendChild(function(){const e=Kt("defs"),t=Xt(Kt("filter"),{id:"cg-filter-blur"});return t.appendChild(Xt(Kt("feGaussianBlur"),{stdDeviation:"0.019"})),e.appendChild(t),e}()),r.appendChild(Kt("g")),s=Xt(Kt("svg"),{class:"cg-custom-svgs",viewBox:"-3.5 -3.5 8 8",preserveAspectRatio:"xMidYMid slice"}),s.appendChild(Kt("g")),a=ze("cg-auto-pieces"),i.appendChild(r),i.appendChild(s),i.appendChild(a)),t.coordinates){const e="cg-black"===t.orientation?" black":"",n="left"===t.ranksPosition?" left":"";if(t.coordinatesOnSquares){const r="cg-white"===t.orientation?e=>e+1:e=>8-e;we.forEach(((t,s)=>i.appendChild(ni(xe.map((e=>t+e)),"squares rank"+r(s)+e+n))))}else i.appendChild(ni(xe,"ranks"+e+n)),i.appendChild(ni(we,"files"+e))}return t.draggable.enabled&&t.draggable.showGhost&&(o=ze("piece","ghost"),Be(o,!1),i.appendChild(o)),{board:n,container:i,wrap:e,ghost:o,svg:r,customSvg:s,autoPieces:a}}(e,i),r=function(){let e;const t=()=>(void 0===e&&(e=n.board.getBoundingClientRect()),e);return t.clear=()=>{e=void 0},t}(),s=e=>{(function(e){const t=ht(e),i=Ne(e.dom.bounds()),n=e.dom.elements.board,r=e.pieces,s=e.animation.current,a=s?s.plan.anims:new Map,o=s?s.plan.fadings:new Map,c=e.draggable.current,l=function(e){const t=new Map;if(e.lastMove&&e.highlight.lastMove)for(const r of e.lastMove)pi(t,r,"last-move");if(e.check&&e.highlight.check&&pi(t,e.check,"check"),e.selected&&(pi(t,e.selected,"selected"),e.movable.showDests)){const i=e.movable.dests?.get(e.selected);if(i)for(const r of i)pi(t,r,"move-dest"+(e.pieces.has(r)?" oc":""));const n=e.premovable.customDests?.get(e.selected)??e.premovable.dests;if(n)for(const r of n)pi(t,r,"premove-dest"+(e.pieces.has(r)?" oc":""))}const i=e.premovable.current;if(i)for(const r of i)pi(t,r,"current-premove");else e.predroppable.current&&pi(t,e.predroppable.current.key,"current-premove");const n=e.exploding;if(n)for(const r of n.keys)pi(t,r,"exploding"+n.stage);return e.highlight.custom&&e.highlight.custom.forEach(((e,i)=>{pi(t,i,e)})),t}(e),h=new Set,u=new Set,d=new Map,p=new Map;let f,m,g,v,b,y,_,w,x,k;for(m=n.firstChild;m;){if(f=m.cgKey,ci(m))if(g=r.get(f),b=a.get(f),y=o.get(f),v=m.cgPiece,!m.cgDragging||c&&c.orig===f||(m.classList.remove("dragging"),Le(m,i(Me(f),t)),m.cgDragging=!1),!y&&m.cgFading&&(m.cgFading=!1,m.classList.remove("fading")),g){if(b&&m.cgAnimating&&v===di(g)){const e=Me(f);e[0]+=b[2],e[1]+=b[3],m.classList.add("anim"),Le(m,i(e,t))}else m.cgAnimating&&(m.cgAnimating=!1,m.classList.remove("anim"),Le(m,i(Me(f),t)),e.addPieceZIndex&&(m.style.zIndex=ui(Me(f),t)));v!==di(g)||y&&m.cgFading?y&&v===di(y)?(m.classList.add("fading"),m.cgFading=!0):fi(d,v,m):h.add(f)}else fi(d,v,m);else if(li(m)){const e=m.className;l.get(f)===e?u.add(f):fi(p,e,m)}m=m.nextSibling}for(const[C,S]of l)if(!u.has(C)){x=p.get(S),k=x&&x.pop();const e=i(Me(C),t);if(k)k.cgKey=C,Le(k,e);else{const t=ze("square",S);t.cgKey=C,Le(t,e),n.insertBefore(t,n.firstChild)}}for(const[C,S]of r)if(b=a.get(C),!h.has(C))if(_=d.get(di(S)),w=_&&_.pop(),w){w.cgKey=C,w.cgFading&&(w.classList.remove("fading"),w.cgFading=!1);const n=Me(C);e.addPieceZIndex&&(w.style.zIndex=ui(n,t)),b&&(w.cgAnimating=!0,w.classList.add("anim"),n[0]+=b[2],n[1]+=b[3]),Le(w,i(n,t))}else{const r=di(S),s=ze("piece",r),a=Me(C);s.cgPiece=r,s.cgKey=C,b&&(s.cgAnimating=!0,a[0]+=b[2],a[1]+=b[3]),Le(s,i(a,t)),e.addPieceZIndex&&(s.style.zIndex=ui(a,t)),n.appendChild(s)}for(const C of d.values())hi(e,C);for(const C of p.values())hi(e,C)})(a),n.autoPieces&&function(e,t){!function(e,t,i){const n=new Map,r=[];for(const o of e)n.set(o.hash,!1);let s,a=t.firstElementChild;for(;a;)s=a.getAttribute("cgHash"),n.has(s)?n.set(s,!0):r.push(a),a=a.nextElementSibling;for(const o of r)t.removeChild(o);for(const o of e)n.get(o.hash)||t.appendChild(i(o))}(e.drawable.autoShapes.filter((e=>e.piece)).map((e=>({shape:e,hash:mi(e),current:!1}))),t,(t=>function(e,{shape:t,hash:i},n){const r=t.orig,s=t.piece?.role,a=t.piece?.color,o=t.piece?.scale,c=ze("piece",`${s} ${a}`);return c.setAttribute("cgHash",i),c.cgKey=r,c.cgScale=o,Oe(c,Ne(n)(Me(r),ht(e)),o),c}(e,t,e.dom.bounds())))}(a,n.autoPieces),!e&&n.svg&&function(e,t,i){const n=e.drawable,r=n.current,s=r&&r.mouseSq?r:void 0,a=new Map,o=e.dom.bounds(),c=n.autoShapes.filter((e=>!e.piece));for(const d of n.shapes.concat(c).concat(s?[s]:[])){if(!d.dest)continue;const t=a.get(d.dest)??new Set,i=ei(Yt(Me(d.orig),e.orientation),o),n=ei(Yt(Me(d.dest),e.orientation),o);t.add(ti(i,n)),a.set(d.dest,t)}const l=n.shapes.concat(c).map((e=>({shape:e,current:!1,hash:Ft(e,$t(e.dest,a),!1,o)})));s&&l.push({shape:s,current:!0,hash:Ft(s,$t(s.dest,a),!0,o)});const h=l.map((e=>e.hash)).join(";");if(h===e.drawable.prevSvgHash)return;e.drawable.prevSvgHash=h;const u=t.querySelector("defs");!function(e,t,i){const n=new Map;let r;for(const o of t.filter((e=>e.shape.dest&&e.shape.brush)))r=Qt(e.brushes[o.shape.brush],o.shape.modifiers),o.shape.modifiers?.hilite&&n.set(Gt(r).key,Gt(r)),n.set(r.key,r);const s=new Set;let a=i.firstElementChild;for(;a;)s.add(a.getAttribute("cgKey")),a=a.nextElementSibling;for(const[o,c]of n.entries())s.has(o)||i.appendChild(Ut(c))}(n,l,u),function(e,t,i,n){const r=new Map;for(const s of e)r.set(s.hash,!1);for(const s of[t,i]){const e=[];let t,i=s.firstElementChild;for(;i;)t=i.getAttribute("cgHash"),r.has(t)?r.set(t,!0):e.push(i),i=i.nextElementSibling;for(const n of e)s.removeChild(n)}for(const s of e.filter((e=>!r.get(e.hash))))for(const e of n(s))e.isCustom?i.appendChild(e.el):t.appendChild(e.el)}(l,t.querySelector("g"),i.querySelector("g"),(t=>function(e,{shape:t,current:i,hash:n},r,s,a){const o=ei(Yt(Me(t.orig),e.orientation),a),c=t.dest?ei(Yt(Me(t.dest),e.orientation),a):o,l=t.brush&&Qt(r[t.brush],t.modifiers),h=s.get(t.dest),u=[];if(l){const e=Xt(Kt("g"),{cgHash:n});u.push({el:e}),o[0]!==c[0]||o[1]!==c[1]?e.appendChild(function(e,t,i,n,r,s){function a(a){const o=(s&&!r?20:10)/64,c=n[0]-i[0],l=n[1]-i[1],h=Math.atan2(l,c),u=Math.cos(h)*o,d=Math.sin(h)*o;return Xt(Kt("line"),{stroke:a?Gt(t).color:t.color,"stroke-width":Zt(t,r)+(a?.04:0),"stroke-linecap":"round","marker-end":`url(#arrowhead-${a?Gt(t).key:t.key})`,opacity:e.modifiers?.hilite?1:Jt(t,r),x1:i[0],y1:i[1],x2:n[0]-u,y2:n[1]-d})}if(!e.modifiers?.hilite)return a(!1);const o=Kt("g"),c=Xt(Kt("g"),{filter:"url(#cg-filter-blur)"});return c.appendChild(function(e,t){const i={from:[Math.floor(Math.min(e[0],t[0])),Math.floor(Math.min(e[1],t[1]))],to:[Math.ceil(Math.max(e[0],t[0])),Math.ceil(Math.max(e[1],t[1]))]};return Xt(Kt("rect"),{x:i.from[0],y:i.from[1],width:i.to[0]-i.from[0],height:i.to[1]-i.from[1],fill:"none",stroke:"none"})}(i,n)),c.appendChild(a(!0)),o.appendChild(c),o.appendChild(a(!1)),o}(t,l,o,c,i,$t(t.dest,s))):e.appendChild(function(e,t,i,n){const r=[3/64,4/64],s=(n.width+n.height)/(4*Math.max(n.width,n.height));return Xt(Kt("circle"),{stroke:e.color,"stroke-width":r[i?0:1],fill:"none",opacity:Jt(e,i),cx:t[0],cy:t[1],r:s-r[1]/2})}(r[t.brush],o,i,a))}if(t.label){const e=t.label;e.fill||t.brush&&r[t.brush]&&(e.fill=r[t.brush].color);const i=t.brush?void 0:"tr";u.push({el:Wt(e,n,o,c,h,i),isCustom:!0})}if(t.customSvg){const e=t.customSvg.center??"orig",[i,r]="label"===e?ii(o,c,h).map((e=>e-.5)):"dest"===e?c:o,s=Xt(Kt("g"),{transform:`translate(${i},${r})`,cgHash:n});s.innerHTML=`<svg width="1" height="1" viewBox="0 0 100 100">${t.customSvg.html}</svg>`,u.push({el:s,isCustom:!0})}return u}(e,t,n.brushes,a,o)))}(a,n.svg,n.customSvg)},a=i;return a.dom={elements:n,bounds:r,redraw:vi(s),redrawNow:s,unbind:t},a.drawable.prevSvgHash="",oi(a),s(!1),function(e){const t=e.dom.elements.board;if((e.disableContextMenu||e.drawable.enabled)&&t.addEventListener("contextmenu",(e=>e.preventDefault())),e.viewOnly)return;const i=si(e);t.addEventListener("touchstart",i,{passive:!1}),t.addEventListener("mousedown",i,{passive:!1})}(a),t||(a.dom.unbind=function(e){const t=[];if("ResizeObserver"in window||t.push(ri(document.body,"chessground.resize",(()=>{oi(a),function(e){const t=ht(e),i=Ne(e.dom.bounds());let n=e.dom.elements.board.firstChild;for(;n;)(ci(n)&&!n.cgAnimating||li(n))&&Le(n,i(Me(n.cgKey),t)),n=n.nextSibling}(a),n.autoPieces&&function(e){const t=ht(e),i=Ne(e.dom.bounds());let n=e.dom.elements.autoPieces?.firstChild;for(;n;)Oe(n,i(Me(n.cgKey),t),n.cgScale),n=n.nextSibling}(a)}))),!e.viewOnly){const i=ai(e,Ot,Tt),n=ai(e,Bt,Pt);for(const e of["touchmove","mousemove"])t.push(ri(document,e,i));for(const e of["touchend","mouseup"])t.push(ri(document,e,n));const r=()=>e.dom.bounds.clear();t.push(ri(document,"scroll",r,{capture:!0,passive:!0})),t.push(ri(window,"resize",r,{passive:!0}))}return()=>t.forEach((e=>e()))}(a)),a.events.insert?.(n),a}return gt(i,t||{}),function(e,t){function i(){var i;(i=e).orientation=Pe(i.orientation),i.animation.current=i.draggable.current=i.selected=void 0,t()}return{set(t){t.orientation&&t.orientation!==e.orientation&&i(),mt(e,t),(t.fen?yt:_t)((e=>gt(e,t)),e)},state:e,getFen:()=>{return t=e.pieces,ke.map((e=>we.map((i=>{const n=t.get(i+e);if(n){let e=pt[n.role];return"cg-white"===n.color&&(e=e.toUpperCase()),n.promoted&&(e+="~"),e}return"1"})).join(""))).join("/").replace(/1{2,}/g,(e=>e.length.toString()));var t},toggleOrientation:i,setPieces(t){yt((e=>function(e,t){for(const[i,n]of t)n?e.pieces.set(i,n):e.pieces.delete(i)}(e,t)),e)},selectSquare(t,i){t?yt((e=>et(e,t,i)),e):e.selected&&(it(e),e.dom.redraw())},move(t,i){yt((e=>Ke(e,t,i)),e)},newPiece(t,i){yt((e=>Xe(e,t,i)),e)},playPremove(){if(e.premovable.current){if(yt(at,e))return!0;e.dom.redraw()}return!1},playPredrop(t){if(e.predroppable.current){const i=function(e,t){const i=e.predroppable.current;let n=!1;return!!i&&(t(i)&&Xe(e,{role:i.role,color:e.movable.color},i.key)&&(We(e.movable.events.afterNewPiece,i.role,i.key,{premove:!1,predrop:!0}),n=!0),$e(e),n)}(e,t);return e.dom.redraw(),i}return!1},cancelPremove(){_t(Ye,e)},cancelPredrop(){_t($e,e)},cancelMove(){_t((e=>{ot(e),Dt(e)}),e)},stop(){_t((e=>{ct(e),Dt(e)}),e)},explode(t){var i,n;n=t,(i=e).exploding={stage:1,keys:n},i.dom.redraw(),setTimeout((()=>{Vt(i,2),setTimeout((()=>Vt(i,void 0)),120)}),120)},setAutoShapes(t){_t((e=>e.drawable.autoShapes=t),e)},setShapes(t){_t((e=>e.drawable.shapes=t),e)},getKeyAtDomPos:t=>lt(t,ht(e),e.dom.bounds()),redrawAll:t,dragNewPiece(t,i,n){!function(e,t,i,n){const r="a0";e.pieces.set(r,t),e.dom.redraw();const s=De(i);e.draggable.current={orig:r,piece:t,origPos:s,pos:s,started:!0,element:()=>zt(e,r),originTarget:i.target,newPiece:!0,force:!!n,keyHasChanged:!1},Lt(e)}(e,t,i,n)},destroy(){ct(e),e.dom.unbind?.(),e.dom.destroyed=!0}}}(n(),n)}function vi(e){let t=!1;return()=>{t||(t=!0,requestAnimationFrame((()=>{e(),t=!1})))}}const bi="w",yi="b",_i="p",wi="b",xi="r",ki="q",Ci="k",Si="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";class Move{constructor(e,i){t(this,"color"),t(this,"from"),t(this,"to"),t(this,"piece"),t(this,"captured"),t(this,"promotion"),t(this,"flags"),t(this,"san"),t(this,"lan"),t(this,"before"),t(this,"after");const{color:n,piece:r,from:s,to:a,flags:o,captured:c,promotion:l}=i,h=Gi(s),u=Gi(a);this.color=n,this.piece=r,this.from=h,this.to=u,this.san=e._moveToSan(i,e._moves({legal:!0})),this.lan=h+u,this.before=e.fen(),e._makeMove(i),this.after=e.fen(),e._undoMove(),this.flags="";for(const t in Pi)Pi[t]&o&&(this.flags+=Ei[t]);c&&(this.captured=c),l&&(this.promotion=l,this.lan+=l)}isCapture(){return this.flags.indexOf(Ei.CAPTURE)>-1}isPromotion(){return this.flags.indexOf(Ei.PROMOTION)>-1}isEnPassant(){return this.flags.indexOf(Ei.EP_CAPTURE)>-1}isKingsideCastle(){return this.flags.indexOf(Ei.KSIDE_CASTLE)>-1}isQueensideCastle(){return this.flags.indexOf(Ei.QSIDE_CASTLE)>-1}isBigPawn(){return this.flags.indexOf(Ei.BIG_PAWN)>-1}}const Mi=-1,Ei={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},Ti=["a8","b8","c8","d8","e8","f8","g8","h8","a7","b7","c7","d7","e7","f7","g7","h7","a6","b6","c6","d6","e6","f6","g6","h6","a5","b5","c5","d5","e5","f5","g5","h5","a4","b4","c4","d4","e4","f4","g4","h4","a3","b3","c3","d3","e3","f3","g3","h3","a2","b2","c2","d2","e2","f2","g2","h2","a1","b1","c1","d1","e1","f1","g1","h1"],Pi={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},Ai={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},Ii={b:[16,32,17,15],w:[-16,-32,-17,-15]},Ni={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},Li=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],Oi=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],Bi={p:1,n:2,b:4,r:8,q:16,k:32},Di=["n",wi,xi,ki],Ri={[Ci]:Pi.KSIDE_CASTLE,[ki]:Pi.QSIDE_CASTLE},zi={w:[{square:Ai.a1,flag:Pi.QSIDE_CASTLE},{square:Ai.h1,flag:Pi.KSIDE_CASTLE}],b:[{square:Ai.a8,flag:Pi.QSIDE_CASTLE},{square:Ai.h8,flag:Pi.KSIDE_CASTLE}]},Vi={b:1,w:6},qi=["1-0","0-1","1/2-1/2","*"];function Fi(e){return e>>4}function ji(e){return 15&e}function Hi(e){return-1!=="0123456789".indexOf(e)}function Gi(e){const t=ji(e),i=Fi(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(i,i+1)}function Ui(e){return e===bi?yi:bi}function Wi(e,t,i,n,r,s=void 0,a=Pi.NORMAL){const o=Fi(n);if(r!==_i||7!==o&&0!==o)e.push({color:t,from:i,to:n,piece:r,captured:s,flags:a});else for(let c=0;c<Di.length;c++){const o=Di[c];e.push({color:t,from:i,to:n,piece:r,captured:s,promotion:o,flags:a|Pi.PROMOTION})}}function Yi(e){let t=e.charAt(0);if(t>="a"&&t<="h"){if(e.match(/[a-h]\d.*[a-h]\d/))return;return _i}return t=t.toLowerCase(),"o"===t?Ci:t}function $i(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function Ki(e){return e.split(" ").slice(0,4).join(" ")}class Chess{constructor(e=Si,{skipValidation:i=!1}={}){t(this,"_board",new Array(128)),t(this,"_turn",bi),t(this,"_header",{}),t(this,"_kings",{w:Mi,b:Mi}),t(this,"_epSquare",-1),t(this,"_halfMoves",0),t(this,"_moveNumber",0),t(this,"_history",[]),t(this,"_comments",{}),t(this,"_castling",{w:0,b:0}),t(this,"_positionCount",{}),this.load(e,{skipValidation:i})}clear({preserveHeaders:e=!1}={}){this._board=new Array(128),this._kings={w:Mi,b:Mi},this._turn=bi,this._castling={w:0,b:0},this._epSquare=Mi,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=e?this._header:{},this._positionCount={},delete this._header.SetUp,delete this._header.FEN}load(e,{skipValidation:t=!1,preserveHeaders:i=!1}={}){let n=e.split(/\s+/);if(n.length>=2&&n.length<6){const t=["-","-","0","1"];e=n.concat(t.slice(-(6-n.length))).join(" ")}if(n=e.split(/\s+/),!t){const{ok:t,error:i}=function(e){const t=e.split(/\s+/);if(6!==t.length)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const i=parseInt(t[5],10);if(isNaN(i)||i<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const n=parseInt(t[4],10);if(isNaN(n)||n<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};const r=t[0].split("/");if(8!==r.length)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let a=0;a<r.length;a++){let e=0,t=!1;for(let i=0;i<r[a].length;i++)if(Hi(r[a][i])){if(t)return{ok:!1,error:"Invalid FEN: piece data is invalid (consecutive number)"};e+=parseInt(r[a][i],10),t=!0}else{if(!/^[prnbqkPRNBQK]$/.test(r[a][i]))return{ok:!1,error:"Invalid FEN: piece data is invalid (invalid piece)"};e+=1,t=!1}if(8!==e)return{ok:!1,error:"Invalid FEN: piece data is invalid (too many squares in rank)"}}if("3"==t[3][1]&&"w"==t[1]||"6"==t[3][1]&&"b"==t[1])return{ok:!1,error:"Invalid FEN: illegal en-passant square"};const s=[{color:"white",regex:/K/g},{color:"black",regex:/k/g}];for(const{color:a,regex:o}of s){if(!o.test(t[0]))return{ok:!1,error:`Invalid FEN: missing ${a} king`};if((t[0].match(o)||[]).length>1)return{ok:!1,error:`Invalid FEN: too many ${a} kings`}}return Array.from(r[0]+r[7]).some((e=>"P"===e.toUpperCase()))?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}(e);if(!t)throw new Error(i)}const r=n[0];let s=0;this.clear({preserveHeaders:i});for(let a=0;a<r.length;a++){const e=r.charAt(a);if("/"===e)s+=8;else if(Hi(e))s+=parseInt(e,10);else{const t=e<"a"?bi:yi;this._put({type:e.toLowerCase(),color:t},Gi(s)),s++}}this._turn=n[1],n[2].indexOf("K")>-1&&(this._castling.w|=Pi.KSIDE_CASTLE),n[2].indexOf("Q")>-1&&(this._castling.w|=Pi.QSIDE_CASTLE),n[2].indexOf("k")>-1&&(this._castling.b|=Pi.KSIDE_CASTLE),n[2].indexOf("q")>-1&&(this._castling.b|=Pi.QSIDE_CASTLE),this._epSquare="-"===n[3]?Mi:Ai[n[3]],this._halfMoves=parseInt(n[4],10),this._moveNumber=parseInt(n[5],10),this._updateSetup(e),this._incPositionCount(e)}fen(){let e=0,t="";for(let r=Ai.a8;r<=Ai.h1;r++){if(this._board[r]){e>0&&(t+=e,e=0);const{color:i,type:n}=this._board[r];t+=i===bi?n.toUpperCase():n.toLowerCase()}else e++;r+1&136&&(e>0&&(t+=e),r!==Ai.h1&&(t+="/"),e=0,r+=8)}let i="";this._castling[bi]&Pi.KSIDE_CASTLE&&(i+="K"),this._castling[bi]&Pi.QSIDE_CASTLE&&(i+="Q"),this._castling[yi]&Pi.KSIDE_CASTLE&&(i+="k"),this._castling[yi]&Pi.QSIDE_CASTLE&&(i+="q"),i=i||"-";let n="-";if(this._epSquare!==Mi){const e=this._epSquare+(this._turn===bi?16:-16),t=[e+1,e-1];for(const i of t){if(136&i)continue;const e=this._turn;if(this._board[i]?.color===e&&this._board[i]?.type===_i){this._makeMove({color:e,from:i,to:this._epSquare,piece:_i,captured:_i,flags:Pi.EP_CAPTURE});const t=!this._isKingAttacked(e);if(this._undoMove(),t){n=Gi(this._epSquare);break}}}}return[t,this._turn,i,n,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(e){this._history.length>0||(e!==Si?(this._header.SetUp="1",this._header.FEN=e):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(Si)}get(e){return this._board[Ai[e]]}put({type:e,color:t},i){return!!this._put({type:e,color:t},i)&&(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0)}_put({type:e,color:t},i){if(-1==="pnbrqkPNBRQK".indexOf(e.toLowerCase()))return!1;if(!(i in Ai))return!1;const n=Ai[i];if(e==Ci&&this._kings[t]!=Mi&&this._kings[t]!=n)return!1;const r=this._board[n];return r&&r.type===Ci&&(this._kings[r.color]=Mi),this._board[n]={type:e,color:t},e===Ci&&(this._kings[t]=n),!0}remove(e){const t=this.get(e);return delete this._board[Ai[e]],t&&t.type===Ci&&(this._kings[t.color]=Mi),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),t}_updateCastlingRights(){const e=this._board[Ai.e1]?.type===Ci&&this._board[Ai.e1]?.color===bi,t=this._board[Ai.e8]?.type===Ci&&this._board[Ai.e8]?.color===yi;e&&this._board[Ai.a1]?.type===xi&&this._board[Ai.a1]?.color===bi||(this._castling.w&=-65),e&&this._board[Ai.h1]?.type===xi&&this._board[Ai.h1]?.color===bi||(this._castling.w&=-33),t&&this._board[Ai.a8]?.type===xi&&this._board[Ai.a8]?.color===yi||(this._castling.b&=-65),t&&this._board[Ai.h8]?.type===xi&&this._board[Ai.h8]?.color===yi||(this._castling.b&=-33)}_updateEnPassantSquare(){if(this._epSquare===Mi)return;const e=this._epSquare+(this._turn===bi?-16:16),t=this._epSquare+(this._turn===bi?16:-16),i=[t+1,t-1];null===this._board[e]&&null===this._board[this._epSquare]&&this._board[t]?.color===Ui(this._turn)&&this._board[t]?.type===_i&&i.some((e=>!(136&e)&&this._board[e]?.color===this._turn&&this._board[e]?.type===_i))||(this._epSquare=Mi)}_attacked(e,t,i){const n=[];for(let r=Ai.a8;r<=Ai.h1;r++){if(136&r){r+=7;continue}if(void 0===this._board[r]||this._board[r].color!==e)continue;const s=this._board[r],a=r-t;if(0===a)continue;const o=a+119;if(Li[o]&Bi[s.type]){if(s.type===_i){if(a>0&&s.color===bi||a<=0&&s.color===yi){if(!i)return!0;n.push(Gi(r))}continue}if("n"===s.type||"k"===s.type){if(i){n.push(Gi(r));continue}return!0}const e=Oi[o];let c=r+e,l=!1;for(;c!==t;){if(null!=this._board[c]){l=!0;break}c+=e}if(!l){if(i){n.push(Gi(r));continue}return!0}}}return!!i&&n}attackers(e,t){return t?this._attacked(t,Ai[e],!0):this._attacked(this._turn,Ai[e],!0)}_isKingAttacked(e){const t=this._kings[e];return-1!==t&&this._attacked(Ui(e),t)}isAttacked(e,t){return this._attacked(t,Ai[e])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&0===this._moves().length}isStalemate(){return!this.isCheck()&&0===this._moves().length}isInsufficientMaterial(){const e={b:0,n:0,r:0,q:0,k:0,p:0},t=[];let i=0,n=0;for(let r=Ai.a8;r<=Ai.h1;r++){if(n=(n+1)%2,136&r){r+=7;continue}const s=this._board[r];s&&(e[s.type]=s.type in e?e[s.type]+1:1,s.type===wi&&t.push(n),i++)}if(2===i)return!0;if(3===i&&(1===e[wi]||1===e.n))return!0;if(i===e[wi]+2){let e=0;const i=t.length;for(let n=0;n<i;n++)e+=t[n];if(0===e||e===i)return!0}return!1}isThreefoldRepetition(){return this._getPositionCount(this.fen())>=3}isDrawByFiftyMoves(){return this._halfMoves>=100}isDraw(){return this.isDrawByFiftyMoves()||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:e=!1,square:t,piece:i}={}){const n=this._moves({square:t,piece:i});return e?n.map((e=>new Move(this,e))):n.map((e=>this._moveToSan(e,n)))}_moves({legal:e=!0,piece:t,square:i}={}){const n=i?i.toLowerCase():void 0,r=t?.toLowerCase(),s=[],a=this._turn,o=Ui(a);let c=Ai.a8,l=Ai.h1,h=!1;if(n){if(!(n in Ai))return[];c=l=Ai[n],h=!0}for(let d=c;d<=l;d++){if(136&d){d+=7;continue}if(!this._board[d]||this._board[d].color===o)continue;const{type:e}=this._board[d];let t;if(e===_i){if(r&&r!==e)continue;t=d+Ii[a][0],this._board[t]||(Wi(s,a,d,t,_i),t=d+Ii[a][1],Vi[a]!==Fi(d)||this._board[t]||Wi(s,a,d,t,_i,void 0,Pi.BIG_PAWN));for(let e=2;e<4;e++)t=d+Ii[a][e],136&t||(this._board[t]?.color===o?Wi(s,a,d,t,_i,this._board[t].type,Pi.CAPTURE):t===this._epSquare&&Wi(s,a,d,t,_i,_i,Pi.EP_CAPTURE))}else{if(r&&r!==e)continue;for(let i=0,n=Ni[e].length;i<n;i++){const n=Ni[e][i];for(t=d;t+=n,!(136&t);){if(this._board[t]){if(this._board[t].color===a)break;Wi(s,a,d,t,e,this._board[t].type,Pi.CAPTURE);break}if(Wi(s,a,d,t,e),"n"===e||e===Ci)break}}}}if(!(void 0!==r&&r!==Ci||h&&l!==this._kings[a])){if(this._castling[a]&Pi.KSIDE_CASTLE){const e=this._kings[a],t=e+2;this._board[e+1]||this._board[t]||this._attacked(o,this._kings[a])||this._attacked(o,e+1)||this._attacked(o,t)||Wi(s,a,this._kings[a],t,Ci,void 0,Pi.KSIDE_CASTLE)}if(this._castling[a]&Pi.QSIDE_CASTLE){const e=this._kings[a],t=e-2;this._board[e-1]||this._board[e-2]||this._board[e-3]||this._attacked(o,this._kings[a])||this._attacked(o,e-1)||this._attacked(o,t)||Wi(s,a,this._kings[a],t,Ci,void 0,Pi.QSIDE_CASTLE)}}if(!e||-1===this._kings[a])return s;const u=[];for(let d=0,p=s.length;d<p;d++)this._makeMove(s[d]),this._isKingAttacked(a)||u.push(s[d]),this._undoMove();return u}move(e,{strict:t=!1}={}){let i=null;if("string"==typeof e)i=this._moveFromSan(e,t);else if("object"==typeof e){const t=this._moves();for(let n=0,r=t.length;n<r;n++)if(e.from===Gi(t[n].from)&&e.to===Gi(t[n].to)&&(!("promotion"in t[n])||e.promotion===t[n].promotion)){i=t[n];break}}if(!i)throw"string"==typeof e?new Error(`Invalid move: ${e}`):new Error(`Invalid move: ${JSON.stringify(e)}`);const n=new Move(this,i);return this._makeMove(i),this._incPositionCount(n.after),n}_push(e){this._history.push({move:e,kings:{b:this._kings.b,w:this._kings.w},turn:this._turn,castling:{b:this._castling.b,w:this._castling.w},epSquare:this._epSquare,halfMoves:this._halfMoves,moveNumber:this._moveNumber})}_makeMove(e){const t=this._turn,i=Ui(t);if(this._push(e),this._board[e.to]=this._board[e.from],delete this._board[e.from],e.flags&Pi.EP_CAPTURE&&(this._turn===yi?delete this._board[e.to-16]:delete this._board[e.to+16]),e.promotion&&(this._board[e.to]={type:e.promotion,color:t}),this._board[e.to].type===Ci){if(this._kings[t]=e.to,e.flags&Pi.KSIDE_CASTLE){const t=e.to-1,i=e.to+1;this._board[t]=this._board[i],delete this._board[i]}else if(e.flags&Pi.QSIDE_CASTLE){const t=e.to+1,i=e.to-2;this._board[t]=this._board[i],delete this._board[i]}this._castling[t]=0}if(this._castling[t])for(let n=0,r=zi[t].length;n<r;n++)if(e.from===zi[t][n].square&&this._castling[t]&zi[t][n].flag){this._castling[t]^=zi[t][n].flag;break}if(this._castling[i])for(let n=0,r=zi[i].length;n<r;n++)if(e.to===zi[i][n].square&&this._castling[i]&zi[i][n].flag){this._castling[i]^=zi[i][n].flag;break}e.flags&Pi.BIG_PAWN?this._epSquare=t===yi?e.to-16:e.to+16:this._epSquare=Mi,e.piece===_i||e.flags&(Pi.CAPTURE|Pi.EP_CAPTURE)?this._halfMoves=0:this._halfMoves++,t===yi&&this._moveNumber++,this._turn=i}undo(){const e=this._undoMove();if(e){const t=new Move(this,e);return this._decPositionCount(t.after),t}return null}_undoMove(){const e=this._history.pop();if(void 0===e)return null;const t=e.move;this._kings=e.kings,this._turn=e.turn,this._castling=e.castling,this._epSquare=e.epSquare,this._halfMoves=e.halfMoves,this._moveNumber=e.moveNumber;const i=this._turn,n=Ui(i);if(this._board[t.from]=this._board[t.to],this._board[t.from].type=t.piece,delete this._board[t.to],t.captured)if(t.flags&Pi.EP_CAPTURE){let e;e=i===yi?t.to-16:t.to+16,this._board[e]={type:_i,color:n}}else this._board[t.to]={type:t.captured,color:n};if(t.flags&(Pi.KSIDE_CASTLE|Pi.QSIDE_CASTLE)){let e,i;t.flags&Pi.KSIDE_CASTLE?(e=t.to+1,i=t.to-1):(e=t.to-2,i=t.to+1),this._board[e]=this._board[i],delete this._board[i]}return t}pgn({newline:e="\n",maxWidth:t=0}={}){const i=[];let n=!1;for(const u in this._header)i.push("["+u+' "'+this._header[u]+'"]'+e),n=!0;n&&this._history.length&&i.push(e);const r=e=>{const t=this._comments[this.fen()];return void 0!==t&&(e=`${e}${e.length>0?" ":""}{${t}}`),e},s=[];for(;this._history.length>0;)s.push(this._undoMove());const a=[];let o="";for(0===s.length&&a.push(r(""));s.length>0;){o=r(o);const e=s.pop();if(!e)break;if(this._history.length||"b"!==e.color)"w"===e.color&&(o.length&&a.push(o),o=this._moveNumber+".");else{const e=`${this._moveNumber}. ...`;o=o?`${o} ${e}`:e}o=o+" "+this._moveToSan(e,this._moves({legal:!0})),this._makeMove(e)}if(o.length&&a.push(r(o)),void 0!==this._header.Result&&a.push(this._header.Result),0===t)return i.join("")+a.join(" ");const c=function(){return i.length>0&&" "===i[i.length-1]&&(i.pop(),!0)},l=function(n,r){for(const s of r.split(" "))if(s){if(n+s.length>t){for(;c();)n--;i.push(e),n=0}i.push(s),n+=s.length,i.push(" "),n++}return c()&&n--,n};let h=0;for(let u=0;u<a.length;u++)h+a[u].length>t&&a[u].includes("{")?h=l(h,a[u]):(h+a[u].length>t&&0!==u?(" "===i[i.length-1]&&i.pop(),i.push(e),h=0):0!==u&&(i.push(" "),h++),i.push(a[u]),h+=a[u].length);return i.join("")}header(...e){for(let t=0;t<e.length;t+=2)"string"==typeof e[t]&&"string"==typeof e[t+1]&&(this._header[e[t]]=e[t+1]);return this._header}setHeader(e,t){return this._header[e]=t,this._header}removeHeader(e){return e in this._header&&(delete this._header[e],!0)}getHeaders(){return this._header}loadPgn(e,{strict:t=!1,newlineChar:i="\r?\n"}={}){function n(e){return e.replace(/\\/g,"\\")}e=e.trim();const r=new RegExp("^(\\[((?:"+n(i)+")|.)*\\])((?:\\s*"+n(i)+"){2}|(?:\\s*"+n(i)+")*$)").exec(e),s=r&&r.length>=2?r[1]:"";this.reset();const a=function(e){const t={},r=e.split(new RegExp(n(i)));let s="",a="";for(let i=0;i<r.length;i++){const e=/^\s*\[\s*([A-Za-z]+)\s*"(.*)"\s*\]\s*$/;s=r[i].replace(e,"$1"),a=r[i].replace(e,"$2"),s.trim().length>0&&(t[s]=a)}return t}(s);let o="";for(const f in a)"fen"===f.toLowerCase()&&(o=a[f]),this.header(f,a[f]);if(t){if("1"===a.SetUp){if(!("FEN"in a))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(a.FEN,{preserveHeaders:!0})}}else o&&this.load(o,{preserveHeaders:!0});const c=function(e){return`{${t=(e=e.replace(new RegExp(n(i),"g")," ")).slice(1,e.length-1),Array.from(t).map((function(e){return e.charCodeAt(0)<128?e.charCodeAt(0).toString(16):encodeURIComponent(e).replace(/%/g,"").toLowerCase()})).join("")}}`;var t},l=function(e){if(e.startsWith("{")&&e.endsWith("}"))return 0==(t=e.slice(1,e.length-1)).length?"":decodeURIComponent("%"+(t.match(/.{1,2}/g)||[]).join("%"));var t};let h=e.replace(s,"").replace(new RegExp(`({[^}]*})+?|;([^${n(i)}]*)`,"g"),(function(e,t,i){return void 0!==t?c(t):" "+c(`{${i.slice(1)}}`)})).replace(new RegExp(n(i),"g")," ");const u=/(\([^()]+\))+?/g;for(;u.test(h);)h=h.replace(u,"");h=h.replace(/\d+\.(\.\.)?/g,""),h=h.replace(/\.\.\./g,""),h=h.replace(/\$\d+/g,"");let d=h.trim().split(new RegExp(/\s+/));d=d.filter((e=>""!==e));let p="";for(let f=0;f<d.length;f++){const e=l(d[f]);if(void 0!==e){this._comments[this.fen()]=e;continue}const i=this._moveFromSan(d[f],t);if(null==i){if(!(qi.indexOf(d[f])>-1))throw new Error(`Invalid move in PGN: ${d[f]}`);p=d[f]}else p="",this._makeMove(i),this._incPositionCount(this.fen())}p&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",p)}_moveToSan(e,t){let i="";if(e.flags&Pi.KSIDE_CASTLE)i="O-O";else if(e.flags&Pi.QSIDE_CASTLE)i="O-O-O";else{if(e.piece!==_i){const n=function(e,t){const i=e.from,n=e.to,r=e.piece;let s=0,a=0,o=0;for(let c=0,l=t.length;c<l;c++){const e=t[c].from,l=t[c].to;r===t[c].piece&&i!==e&&n===l&&(s++,Fi(i)===Fi(e)&&a++,ji(i)===ji(e)&&o++)}return s>0?a>0&&o>0?Gi(i):o>0?Gi(i).charAt(1):Gi(i).charAt(0):""}(e,t);i+=e.piece.toUpperCase()+n}e.flags&(Pi.CAPTURE|Pi.EP_CAPTURE)&&(e.piece===_i&&(i+=Gi(e.from)[0]),i+="x"),i+=Gi(e.to),e.promotion&&(i+="="+e.promotion.toUpperCase())}return this._makeMove(e),this.isCheck()&&(this.isCheckmate()?i+="#":i+="+"),this._undoMove(),i}_moveFromSan(e,t=!1){const i=$i(e);let n,r,s,a,o,c=Yi(i),l=this._moves({legal:!0,piece:c});for(let u=0,d=l.length;u<d;u++)if(i===$i(this._moveToSan(l[u],l)))return l[u];if(t)return null;let h=!1;if(r=i.match(/([pnbrqkPNBRQK])?([a-h][1-8])x?-?([a-h][1-8])([qrbnQRBN])?/),r?(n=r[1],s=r[2],a=r[3],o=r[4],1==s.length&&(h=!0)):(r=i.match(/([pnbrqkPNBRQK])?([a-h]?[1-8]?)x?-?([a-h][1-8])([qrbnQRBN])?/),r&&(n=r[1],s=r[2],a=r[3],o=r[4],1==s.length&&(h=!0))),c=Yi(i),l=this._moves({legal:!0,piece:n||c}),!a)return null;for(let u=0,d=l.length;u<d;u++)if(s){if(!(n&&n.toLowerCase()!=l[u].piece||Ai[s]!=l[u].from||Ai[a]!=l[u].to||o&&o.toLowerCase()!=l[u].promotion))return l[u];if(h){const e=Gi(l[u].from);if(!(n&&n.toLowerCase()!=l[u].piece||Ai[a]!=l[u].to||s!=e[0]&&s!=e[1]||o&&o.toLowerCase()!=l[u].promotion))return l[u]}}else if(i===$i(this._moveToSan(l[u],l)).replace("x",""))return l[u];return null}ascii(){let e=" +------------------------+\n";for(let t=Ai.a8;t<=Ai.h1;t++){if(0===ji(t)&&(e+=" "+"87654321"[Fi(t)]+" |"),this._board[t]){const i=this._board[t].type;e+=" "+(this._board[t].color===bi?i.toUpperCase():i.toLowerCase())+" "}else e+=" . ";t+1&136&&(e+="|\n",t+=8)}return e+=" +------------------------+\n",e+=" a b c d e f g h",e}perft(e){const t=this._moves({legal:!1});let i=0;const n=this._turn;for(let r=0,s=t.length;r<s;r++)this._makeMove(t[r]),this._isKingAttacked(n)||(e-1>0?i+=this.perft(e-1):i++),this._undoMove();return i}turn(){return this._turn}board(){const e=[];let t=[];for(let i=Ai.a8;i<=Ai.h1;i++)null==this._board[i]?t.push(null):t.push({square:Gi(i),type:this._board[i].type,color:this._board[i].color}),i+1&136&&(e.push(t),t=[],i+=8);return e}squareColor(e){if(e in Ai){const t=Ai[e];return(Fi(t)+ji(t))%2==0?"light":"dark"}return null}history({verbose:e=!1}={}){const t=[],i=[];for(;this._history.length>0;)t.push(this._undoMove());for(;;){const n=t.pop();if(!n)break;e?i.push(new Move(this,n)):i.push(this._moveToSan(n,this._moves())),this._makeMove(n)}return i}_getPositionCount(e){const t=Ki(e);return this._positionCount[t]||0}_incPositionCount(e){const t=Ki(e);void 0===this._positionCount[t]&&(this._positionCount[t]=0),this._positionCount[t]+=1}_decPositionCount(e){const t=Ki(e);1===this._positionCount[t]?delete this._positionCount[t]:this._positionCount[t]-=1}_pruneComments(){const e=[],t={},i=e=>{e in this._comments&&(t[e]=this._comments[e])};for(;this._history.length>0;)e.push(this._undoMove());for(i(this.fen());;){const t=e.pop();if(!t)break;this._makeMove(t),i(this.fen())}this._comments=t}getComment(){return this._comments[this.fen()]}setComment(e){this._comments[this.fen()]=e.replace("{","[").replace("}","]")}deleteComment(){return this.removeComment()}removeComment(){const e=this._comments[this.fen()];return delete this._comments[this.fen()],e}getComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>({fen:e,comment:this._comments[e]})))}deleteComments(){return this.removeComments()}removeComments(){return this._pruneComments(),Object.keys(this._comments).map((e=>{const t=this._comments[e];return delete this._comments[e],{fen:e,comment:t}}))}setCastlingRights(e,t){for(const n of[Ci,ki])void 0!==t[n]&&(t[n]?this._castling[e]|=Ri[n]:this._castling[e]&=~Ri[n]);this._updateCastlingRights();const i=this.getCastlingRights(e);return!(void 0!==t[Ci]&&t[Ci]!==i[Ci]||void 0!==t[ki]&&t[ki]!==i[ki])}getCastlingRights(e){return{[Ci]:!!(this._castling[e]&Ri[Ci]),[ki]:!!(this._castling[e]&Ri[ki])}}moveNumber(){return this._moveNumber}}const Xi=e=>{const t=new Map;return Ti.forEach((i=>{const n=e.moves({square:i,verbose:!0});n.length&&t.set(i,n.map((e=>e.to)))})),t},Qi=e=>"w"===e.turn()?"cg-white":"cg-black",Zi=k({name:"PuzzleView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"PuzzleView"),n=L(i),r=O(null),s=O(),a=O(),o=O("cg-white"),c=O(!1),l=O(null),h=B((()=>{const e=["a","b","c","d","e","f","g","h"];return"cg-white"===o.value?e:e.reverse()})),u=e=>!!e&&["q","r","b","n"].includes(e),d=()=>{s.value&&a.value&&a.value.set({fen:s.value.fen(),turnColor:Qi(s.value),movable:{color:Qi(s.value),dests:Xi(s.value)}})},p=(e,t,i)=>{if(!n.question.value?.moves.length)throw new Error("No moves");if(((e,t,i)=>{if(u(i))return!1;const n=s.value?.get(e);return"p"===n?.type&&("8"===t[1]||"1"===t[1])})(e,t,i))return l.value={from:e,to:t},void(c.value=!0);n.question.value.moves[0]===(u(i)?`${e}${t}${i}`:`${e}${t}`)?(s.value?.move({from:e,to:t,promotion:u(i)?i:void 0}),d(),n.question.value.moves.shift(),0===n.question.value.moves.length?n.submitAnswer(""):window.setTimeout((()=>{if(!n.question.value)return;const e=(e=>{if(e.length<4||e.length>5)throw new Error(`Invalid UCI move format: ${e}`);return{from:e.substring(0,2),to:e.substring(2,4),promotion:5===e.length?e[4]:void 0}})(n.question.value.moves.shift());s.value?.move(e),d()}),300)):(s.value?.move({from:e,to:t,promotion:i}),s.value?.isCheckmate()?n.submitAnswer(un.CHECKMATE):s.value?.undo(),n.submitAnswer(e+t+i),d())};return z((()=>{if(!r.value)return;n.question.value=new un(e.data),s.value=new Chess(n.question.value.fen),o.value="cg-white"===Qi(s.value)?"cg-black":"cg-white",a.value=gi(r.value,{movable:{free:!1,showDests:!0,dests:Xi(s.value),events:{after:p}},draggable:{showGhost:!0},fen:s.value.fen(),orientation:o.value,coordinates:!1,animation:{duration:300,enabled:!0}});const t=n.question.value.moves.shift();a.value.move(t.substring(0,2),t.substring(2)),s.value.move({from:t.substring(0,2),to:t.substring(2)}),d()})),H((()=>{a.value?.destroy(),s.value=void 0})),{boardElement:r,playerColor:o,files:h,showPromotionDialog:c,promotionPieces:[{value:"q",name:"Queen",whiteSymbol:"♕",blackSymbol:"♛"},{value:"r",name:"Rook",whiteSymbol:"♖",blackSymbol:"♜"},{value:"b",name:"Bishop",whiteSymbol:"♗",blackSymbol:"♝"},{value:"n",name:"Knight",whiteSymbol:"♘",blackSymbol:"♞"}],handlePromotion:e=>{"q"===e||"r"===e||"b"===e||"n"===e?l.value&&(i.logger.log(`promoting to ${e}`),c.value=!1,p(l.value.from,l.value.to,e)):i.logger.error(`Invalid promotion piece: ${e}`)},...i,...n}}}),Ji={"data-viewable":"PuzzleView"},en={class:"text-h5"},tn={class:"puzzle-board-wrapper"},nn={class:"puzzle-ranks-labels"},rn={class:"puzzle-board-and-files"},sn={id:"cg",ref:"boardElement"},an={class:"puzzle-files-labels"},on={key:0,class:"puzzle-promotion-dialog"},cn=["onClick"],ln=he(Zi,[["render",function(e,t,i,n,r,s){return g(),m("div",Ji,[C("p",en," Make the best move for "+x("cg-white"===e.playerColor?"White ♖♘♗♕♔♗♘♖":"Black ♜♞♝♚♛♝♞♜")+": ",1),C("div",tn,[C("div",nn,[(g(),m(y,null,S(8,(t=>C("div",{key:t},x("cg-white"===e.playerColor?9-t:t),1))),64))]),C("div",rn,[C("div",sn,null,512),C("div",an,[(g(!0),m(y,null,S(e.files,(e=>(g(),m("div",{key:e},x(e),1)))),128))])])]),e.showPromotionDialog?(g(),m("div",on,[(g(!0),m(y,null,S(e.promotionPieces,(t=>(g(),m("button",{key:t.value,onClick:i=>e.handlePromotion(t.value)},x("cg-white"===e.playerColor?t.whiteSymbol:t.blackSymbol)+" "+x(t.name),9,cn)))),128))])):b("",!0)])}]]),hn=class _ChessPuzzle extends l{constructor(e){super(e),t(this,"fen"),t(this,"id"),t(this,"moves"),t(this,"rating"),t(this,"themes"),t(this,"checkMove",((e,t)=>(alert("checkMove"),console.log("checkMove",e,t),console.log("this.moves[0]",this.moves[0]),this.moves[0]===t)));const[i,n,r,s,,,,a]=e[0].puzzleData.split(",");this.id=i,this.fen=n,this.moves=r.split(" "),this.rating=parseInt(s,10),this.themes=a.split(" ")}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){return this.isCorrect(e)?t<5e3?1:1-Math.min(1,(t-5e3)/1e4):0}dataShapes(){return _ChessPuzzle.dataShapes}views(){return _ChessPuzzle.views}isCorrect(e){const t=0===this.moves.length;return e===_ChessPuzzle.CHECKMATE||t}};t(hn,"dataShapes",[{name:a.CHESS_puzzle,fields:[{name:"puzzleData",type:r.CHESS_PUZZLE,validator:{instructions:"insert a valid fen string",test:function(e){return console.log(`running puzzle validator on ${e}`),e?10!=e.split(",").length?{status:n.error,msg:"puzzleData must have 8 comma-separated fields"}:{status:n.ok,msg:""}:{status:n.error,msg:"no defined input"}}},tagger:()=>["test"]}]}]),t(hn,"views",[ln]),t(hn,"acceptsUserData",!0),t(hn,"CHECKMATE","CHECKMATE");let un=hn;const dn=new CourseWare("chess",[un]),pn=k({name:"AudioParseView",components:{AudioAutoPlayer:F},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"AudioParseView"),n=L(i),r=O("");n.question.value=new vn(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{s.value}}}}),fn={"data-viewable":"AudioParseView"},mn=he(pn,[["render",function(e,t,i,n,r,s){const a=f("AudioAutoPlayer");return g(),m("div",fn,[e.question?(g(),m(y,{key:0},[w(a,{src:e.getURL("audio")},null,8,["src"]),t[0]||(t[0]=C("br",null,null,-1)),t[1]||(t[1]=C("br",null,null,-1)),_(" "+x(e.question.text),1)],64)):b("",!0)])}]]),gn=class _AudioParsingQuestion extends l{constructor(e){super(e),t(this,"audio"),t(this,"text"),this.audio=e[0].audio,this.text=e[0].text}isCorrect(e){throw new Error(`isCorrect() not implemented - cannor parse ${e}`)}dataShapes(){return _AudioParsingQuestion.dataShapes}views(){return _AudioParsingQuestion.views}};t(gn,"dataShapes",[{name:a.FRENCH_AudioParse,fields:[{name:"audio",type:r.IMAGE},{name:"text",type:r.STRING,validator:{test:e=>{const t=e.length<45;return{msg:t?"":"It's too long!",status:t?n.ok:n.error}}}}]}]),t(gn,"views",[mn]);let vn=gn;const bn=k({name:"IdentifyVocab",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"IdentifyVocab"),n=L(i);n.question.value=new kn(e.data);const r=B((()=>n.question.value));return{...i,...n,question:r}}}),yn={"data-viewable":"IdentifyVocab"},_n=he(bn,[["render",function(e,t,i,n,r,s){return g(),m("div",yn,[e.question?(g(),m(y,{key:0},[_(" This is a vocabulary question. ")],64)):b("",!0)])}]]),wn=[{name:"word",type:r.STRING,validator:J.NonEmptyString},{name:"image",type:r.IMAGE},{name:"audio",type:r.AUDIO}],xn=class _VocabQuestion extends l{isCorrect(e){throw new Error(`isCorrect() not implemented. Cannot parse ${e}`)}dataShapes(){return _VocabQuestion.dataShapes}views(){return _VocabQuestion.views}};t(xn,"dataShapes",[{fields:wn,name:a.FRENCH_Vocab}]),t(xn,"views",[_n]);let kn=xn;const Cn=new CourseWare("french",[vn,kn]),Sn=k({name:"AdditionHorizontal",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"AdditionHorizontal"),n=L(i),r=O("");n.question.value=new Nn(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),Mn={"data-viewable":"AdditionHorizontal"},En=he(Sn,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",Mn,[e.question?(g(),m(y,{key:0},[_(x(e.question.a)+" + "+x(e.question.b)+" = ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),Tn=k({name:"VerbalAddition",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"VerbalAddition"),n=L(i),r=O("");n.question.value=new Nn(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),Pn={"data-viewable":"VerbalAddition"},An=he(Tn,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",Pn,[e.question?(g(),m(y,{key:0},[_(x(e.question.a)+" plus "+x(e.question.b)+" is ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),In=class _SingleDigitAdditionQuestion extends l{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return 1*this.a+this.b===e}dataShapes(){return _SingleDigitAdditionQuestion.dataShapes}views(){return _SingleDigitAdditionQuestion.views}};t(In,"dataShapes",[te]),t(In,"views",[En,An]),t(In,"seedData",function(){const e=[];for(let t=0;t<10;t++)for(let i=0;i<10;i++)e.push({a:t,b:i});return e}()),t(In,"acceptsUserData",!1);let Nn=In;const Ln=k({name:"DivisionHorizontal",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"DivisionHorizontal"),n=L(i),r=O("");n.question.value=new zn(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),On={"data-viewable":"DivisionHorizontal"},Bn=he(Ln,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",On,[e.question?(g(),m(y,{key:0},[_(x(e.question.a*e.question.b)+" ÷ "+x(e.question.b)+" = ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),Dn=[{name:"a",type:r.INT},{name:"b",type:r.INT,validator:{instructions:"An integer between 1 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<t&&t<11?{status:n.ok,msg:""}:0===t?{status:n.error,msg:"Thou shalt not divide by zero."}:{status:n.error,msg:"Single digit division problem divisors must be between 1 and 10, inclusive."}}}}],Rn=class _SingleDigitDivisionQuestion extends l{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitDivisionQuestion.dataShapes}views(){return _SingleDigitDivisionQuestion.views}};t(Rn,"dataShapes",[{name:a.MATH_SingleDigitDivision,fields:Dn}]),t(Rn,"views",[Bn]);let zn=Rn;const Vn=k({name:"MultiplicationHorizontal",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"MultiplicationHorizontal"),n=L(i),r=O("");n.question.value=new $n(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),qn={"data-viewable":"MultiplicationHorizontal"},Fn=he(Vn,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",qn,[e.question?(g(),m(y,{key:0},[_(x(e.question.a)+" × "+x(e.question.b)+" = ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),jn=k({name:"VerbalMultiplication",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"VerbalMultiplication"),n=L(i),r=O("");n.question.value=new $n(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{if(s.value){const e=s.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),Hn={"data-viewable":"VerbalMultiplication"},Gn=he(jn,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",Hn,[e.question?(g(),m(y,{key:0},[_(x(e.question.a)+" times "+x(e.question.b)+" is ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),Un={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=10?{status:n.ok,msg:""}:{status:n.error,msg:"Single digit multiplication problem inputs must be between 0 and 10, inclusive."}}},Wn=[{name:"a",type:r.INT,validator:Un},{name:"b",type:r.INT,validator:Un}],Yn=class _SingleDigitMultiplicationQuestion extends l{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a*this.b===e}dataShapes(){return _SingleDigitMultiplicationQuestion.dataShapes}views(){return _SingleDigitMultiplicationQuestion.views}};t(Yn,"dataShapes",[{name:a.MATH_SingleDigitMultiplication,fields:Wn}]),t(Yn,"views",[Gn,Fn]);let $n=Yn;const Kn=k({name:"TrueFalse",components:{TFSelect:D},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"TrueFalse");L(i).question.value=new Jn(e.data);const n=B((()=>new Jn(e.data)));return{question:n,submit:e=>{alert(n.value.isCorrect(0===e))}}}}),Xn={"data-viewable":"TrueFalse"},Qn=he(Kn,[["render",function(e,t,i,n,r,s){const a=f("TFSelect");return g(),m("div",Xn,[_(x(e.question.a)+" = "+x(e.question.b)+" ",1),w(a,{submit:e.submit},null,8,["submit"])])}]]),Zn=class _EqualityTest extends l{constructor(e){super(e),t(this,"a"),t(this,"b"),this.a=e[0].a,this.b=e[0].b}isCorrect(e){return this.a===this.b===e}dataShapes(){return _EqualityTest.dataShapes}views(){return _EqualityTest.views}};t(Zn,"dataShapes",[ie]),t(Zn,"views",[Qn]);let Jn=Zn;const er=k({name:"SolveView",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"Solve"),n=L(i),r=O(""),s=["a","b","d","A","z","B","d","y"],a=O(s[ne(0,s.length)]);n.question.value=new dr(e.data);const o=B((()=>n.question.value));return{...i,...n,answer:r,question:o,variable:a,submit:()=>{if(o.value){const e=o.value.isCorrect(parseInt(r.value,10));alert(e)}}}}}),tr={"data-viewable":"Solve"},ir={key:0},nr={key:1},rr={key:2},sr={key:3},ar={key:4},or=he(er,[["render",function(e,t,i,n,r,s){const a=f("UserInputNumber");return g(),m("div",tr,[e.question?(g(),m(y,{key:0},[t[1]||(t[1]=C("h4",null,"Solve the Equation",-1)),t[2]||(t[2]=C("br",null,null,-1)),t[3]||(t[3]=C("br",null,null,-1)),"ADDITION"===e.question.operation.valueOf()?(g(),m("div",ir,x(e.variable)+" - "+x(e.question.a)+" = "+x(e.question.b),1)):"SUBTRACTION"===e.question.operation.valueOf()?(g(),m("div",nr,x(e.variable)+" + "+x(e.question.a)+" = "+x(e.question.b),1)):"MULTIPLICATION"===e.question.operation.valueOf()?(g(),m("div",rr,x(e.variable)+" ÷ "+x(e.question.a)+" = "+x(e.question.b),1)):"DIVISION"===e.question.operation.valueOf()?(g(),m("div",sr,x(e.variable)+" * "+x(e.question.a)+" = "+x(e.question.b*e.question.a),1)):(g(),m("div",ar,"No operation!? (This should never show)")),t[4]||(t[4]=C("br",null,null,-1)),t[5]||(t[5]=C("br",null,null,-1)),_(" "+x(e.variable)+" = ",1),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])],64)):b("",!0)])}]]),cr={instructions:"An integer between 0 and 10, inclusive.",test:e=>{const t=parseInt(e,10);return 0<=t&&t<=100?{status:n.ok,msg:""}:{status:n.error,msg:"Single-step equation problem inputs must be between 0 and 100, inclusive."}}},lr={test:e=>"ADDITION"===e||"SUBTRACTION"===e||"MULTIPLICATION"===e||"DIVISION"===e?{status:n.ok,msg:""}:{status:n.error,msg:"Operation must be ADDITION, SUBTRACTION, MULTIPLICATION, or DIVISION"}},hr=[{name:"a",type:r.INT,validator:cr},{name:"b",type:r.INT,validator:cr},{name:"operation",type:r.STRING,validator:lr}],ur=class _OneStepEquation extends l{constructor(e){super(e),t(this,"a"),t(this,"b"),t(this,"operation"),this.a=e[0].a,this.b=e[0].b,this.operation=e[0].operation}answer(){let e=0;return"ADDITION"===this.operation?e=this.a+this.b:"SUBTRACTION"===this.operation?e=this.b-this.a:"MULTIPLICATION"===this.operation?e=this.a*this.b:"DIVISION"===this.operation&&(e=this.b),h(`The answer is ${e}\nThe operation is ${this.operation.valueOf()}\nthis.a = ${this.a}\nthis.b = ${this.b}\n`),e}isCorrect(e){return e===this.answer()}dataShapes(){return _OneStepEquation.dataShapes}views(){return _OneStepEquation.views}};t(ur,"dataShapes",[{name:a.MATH_OneStepEquation,fields:hr}]),t(ur,"views",[or]);let dr=ur;const pr=k({name:"AngleCategorizeV",components:{RadioMultipleChoice:R},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"AngleCategorizeV"),n=L(i),r=O(null);n.question.value=new wr(e.data);const s=B((()=>n.question.value)),a=B((()=>{if(!s.value)return 0;const e=s.value.angleCategory;if(e===br.ACUTE)return ne(10,83);if(e===br.RIGHT)return 90;if(e===br.OBTUSE)return ne(97,173);if(e===br.STRAIGHT)return 180;if(e===br.REFLEX)return ne(190,350);throw new Error("Unknown Angle type on AngleCategorize question")}));return z((()=>{if(!r.value)return;const e=r.value.width,t=r.value.height,i=r.value.getContext("2d");if(!i)return;const n=ne(0,360),s=n+a.value;i.moveTo(e/2,t/2);const o=e/2+e*Math.cos(n/360*2*Math.PI),c=t/2+e*Math.sin(n/360*2*Math.PI);i.lineTo(o,c),i.stroke(),i.moveTo(e/2,t/2);const l=e/2+e*Math.cos(s/360*2*Math.PI),h=t/2+e*Math.sin(s/360*2*Math.PI);i.lineTo(l,h),i.stroke(),i.moveTo(e/2,t/2),i.beginPath(),i.arc(e/2,t/2,25,n/360*2*Math.PI,s/360*2*Math.PI),i.stroke()})),{...i,...n,canvasRef:r,question:s}}}),fr={"data-viewable":"AngleCategorizeV"},mr={ref:"canvasRef",width:"300",height:"300"},gr=he(pr,[["render",function(e,t,i,n,r,s){const a=f("radio-multiple-choice");return g(),m("div",fr,[e.question?(g(),m(y,{key:0},[t[0]||(t[0]=C("h2",null,"What kind of angle is this?",-1)),C("canvas",mr,null,512),w(a,{"choice-list":e.question.answers},null,8,["choice-list"])],64)):b("",!0)])}],["__scopeId","data-v-57f16e4a"]]),vr={instructions:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".',test:e=>"ACUTE"===e||"OBTUSE"===e||"REFLEX"===e||"RIGHT"===e||"STRAIGHT"===e?{status:n.ok,msg:""}:{status:n.error,msg:'Must be "ACUTE", "RIGHT", "OBTUSE", "STRAIGHT", or "REFLEX".'}};var br=(e=>(e.ACUTE="ACUTE",e.RIGHT="RIGHT",e.OBTUSE="OBTUSE",e.STRAIGHT="STRAIGHT",e.REFLEX="REFLEX",e))(br||{});const yr=[{name:"Category",type:r.STRING,validator:vr}],_r=class _AngleCategorize extends l{constructor(e){super(e),t(this,"angleCategory"),t(this,"answers"),this.angleCategory=e[0].Category,this.answers=re(["ACUTE","OBTUSE","REFLEX","RIGHT","STRAIGHT"])}isCorrect(e){return this.angleCategory.valueOf()===e.choiceList[e.selection]}dataShapes(){return _AngleCategorize.dataShapes}views(){return _AngleCategorize.views}};t(_r,"dataShapes",[{name:a.MATH_AngleCategorize,fields:yr}]),t(_r,"views",[gr]);let wr=_r;function xr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function kr(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var i=function e(){var i=!1;try{i=this instanceof e}catch{}return i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(i,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),i}function Cr(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Sr={exports:{}};const Mr=kr(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Er,Tr,Pr,Ar={exports:{}};function Ir(){return Er||(Er=1,function(e){var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],i=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],n="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",r={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},s="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",a={5:s,"5module":s+" export import",6:s+" const class extends export import super"},o=/^in(stanceof)?$/,c=new RegExp("["+n+"]"),l=new RegExp("["+n+"‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");function h(e,t){for(var i=65536,n=0;n<t.length;n+=2){if((i+=t[n])>e)return!1;if((i+=t[n+1])>=e)return!0}return!1}function u(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&c.test(String.fromCharCode(e)):!1!==t&&h(e,i)))}function d(e,n){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==n&&(h(e,i)||h(e,t)))))}var p=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function f(e,t){return new p(e,{beforeExpr:!0,binop:t})}var m={beforeExpr:!0},g={startsExpr:!0},v={};function b(e,t){return void 0===t&&(t={}),t.keyword=e,v[e]=new p(e,t)}var y={num:new p("num",g),regexp:new p("regexp",g),string:new p("string",g),name:new p("name",g),privateId:new p("privateId",g),eof:new p("eof"),bracketL:new p("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new p("]"),braceL:new p("{",{beforeExpr:!0,startsExpr:!0}),braceR:new p("}"),parenL:new p("(",{beforeExpr:!0,startsExpr:!0}),parenR:new p(")"),comma:new p(",",m),semi:new p(";",m),colon:new p(":",m),dot:new p("."),question:new p("?",m),questionDot:new p("?."),arrow:new p("=>",m),template:new p("template"),invalidTemplate:new p("invalidTemplate"),ellipsis:new p("...",m),backQuote:new p("`",g),dollarBraceL:new p("${",{beforeExpr:!0,startsExpr:!0}),eq:new p("=",{beforeExpr:!0,isAssign:!0}),assign:new p("_=",{beforeExpr:!0,isAssign:!0}),incDec:new p("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new p("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:f("||",1),logicalAND:f("&&",2),bitwiseOR:f("|",3),bitwiseXOR:f("^",4),bitwiseAND:f("&",5),equality:f("==/!=/===/!==",6),relational:f("</>/<=/>=",7),bitShift:f("<</>>/>>>",8),plusMin:new p("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:f("%",10),star:f("*",10),slash:f("/",10),starstar:new p("**",{beforeExpr:!0}),coalesce:f("??",1),_break:b("break"),_case:b("case",m),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",m),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",m),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",g),_if:b("if"),_return:b("return",m),_switch:b("switch"),_throw:b("throw",m),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",g),_super:b("super",g),_class:b("class",g),_extends:b("extends",m),_export:b("export"),_import:b("import",g),_null:b("null",g),_true:b("true",g),_false:b("false",g),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},_=/\r\n?|\n|\u2028|\u2029/,w=new RegExp(_.source,"g");function x(e){return 10===e||13===e||8232===e||8233===e}function k(e,t,i){void 0===i&&(i=e.length);for(var n=t;n<i;n++){var r=e.charCodeAt(n);if(x(r))return n<i-1&&13===r&&10===e.charCodeAt(n+1)?n+2:n+1}return-1}var C=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,S=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,M=Object.prototype,E=M.hasOwnProperty,T=M.toString,P=Object.hasOwn||function(e,t){return E.call(e,t)},A=Array.isArray||function(e){return"[object Array]"===T.call(e)},I=Object.create(null);function N(e){return I[e]||(I[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function L(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var O=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,B=function(e,t){this.line=e,this.column=t};B.prototype.offset=function(e){return new B(this.line,this.column+e)};var D=function(e,t,i){this.start=t,this.end=i,null!==e.sourceFile&&(this.source=e.sourceFile)};function R(e,t){for(var i=1,n=0;;){var r=k(e,n,t);if(r<0)return new B(i,t-n);++i,n=r}}var z={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},V=!1;function q(e){var t={};for(var i in z)t[i]=e&&P(e,i)?e[i]:z[i];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!V&&"object"==typeof console&&console.warn&&(V=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),e&&null!=e.allowHashBang||(t.allowHashBang=t.ecmaVersion>=14),A(t.onToken)){var n=t.onToken;t.onToken=function(e){return n.push(e)}}return A(t.onComment)&&(t.onComment=function(e,t){return function(i,n,r,s,a,o){var c={type:i?"Block":"Line",value:n,start:r,end:s};e.locations&&(c.loc=new D(this,a,o)),e.ranges&&(c.range=[r,s]),t.push(c)}}(t,t.onComment)),t}var F=256;function j(e,t){return 2|(e?4:0)|(t?8:0)}var H=function(e,t,i){this.options=e=q(e),this.sourceFile=e.sourceFile,this.keywords=N(a[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var n="";!0!==e.allowReserved&&(n=r[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(n+=" await")),this.reservedWords=N(n);var s=(n?n+" ":"")+r.strict;this.reservedWordsStrict=N(s),this.reservedWordsStrictBind=N(s+" "+r.strictBind),this.input=String(t),this.containsEsc=!1,i?(this.pos=i,this.lineStart=this.input.lastIndexOf("\n",i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(_).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=y.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},G={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};H.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},G.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},G.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},G.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},G.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||t.flags&F)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},G.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(64&t)>0||i||this.options.allowSuperOutsideMethod},G.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},G.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},G.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,i=e.inClassFieldInit;return(258&t)>0||i},G.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&F)>0},H.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var i=this,n=0;n<e.length;n++)i=e[n](i);return i},H.parse=function(e,t){return new this(t,e).parse()},H.parseExpressionAt=function(e,t,i){var n=new this(i,e,t);return n.nextToken(),n.parseExpression()},H.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(H.prototype,G);var U=H.prototype,W=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;U.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){S.lastIndex=e,e+=S.exec(this.input)[0].length;var t=W.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){S.lastIndex=e+t[0].length;var i=S.exec(this.input),n=i.index+i[0].length,r=this.input.charAt(n);return";"===r||"}"===r||_.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(r)||"!"===r&&"="===this.input.charAt(n+1))}e+=t[0].length,S.lastIndex=e,e+=S.exec(this.input)[0].length,";"===this.input[e]&&e++}},U.eat=function(e){return this.type===e&&(this.next(),!0)},U.isContextual=function(e){return this.type===y.name&&this.value===e&&!this.containsEsc},U.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},U.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},U.canInsertSemicolon=function(){return this.type===y.eof||this.type===y.braceR||_.test(this.input.slice(this.lastTokEnd,this.start))},U.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},U.semicolon=function(){this.eat(y.semi)||this.insertSemicolon()||this.unexpected()},U.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},U.expect=function(e){this.eat(e)||this.unexpected()},U.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")};var Y=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};U.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}},U.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,n=e.doubleProto;if(!t)return i>=0||n>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},U.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},U.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var $=H.prototype;$.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==y.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var n=0,r=Object.keys(this.undefinedExports);n<r.length;n+=1){var s=r[n];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var K={kind:"loop"},X={kind:"switch"};$.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;S.lastIndex=this.pos;var t=S.exec(this.input),i=this.pos+t[0].length,n=this.input.charCodeAt(i);if(91===n||92===n)return!0;if(e)return!1;if(123===n||n>55295&&n<56320)return!0;if(u(n,!0)){for(var r=i+1;d(n=this.input.charCodeAt(r),!0);)++r;if(92===n||n>55295&&n<56320)return!0;var s=this.input.slice(i,r);if(!o.test(s))return!0}return!1},$.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;S.lastIndex=this.pos;var e,t=S.exec(this.input),i=this.pos+t[0].length;return!(_.test(this.input.slice(this.pos,i))||"function"!==this.input.slice(i,i+8)||i+8!==this.input.length&&(d(e=this.input.charCodeAt(i+8))||e>55295&&e<56320))},$.parseStatement=function(e,t,i){var n,r=this.type,s=this.startNode();switch(this.isLet(e)&&(r=y._var,n="let"),r){case y._break:case y._continue:return this.parseBreakContinueStatement(s,r.keyword);case y._debugger:return this.parseDebuggerStatement(s);case y._do:return this.parseDoStatement(s);case y._for:return this.parseForStatement(s);case y._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case y._class:return e&&this.unexpected(),this.parseClass(s,!0);case y._if:return this.parseIfStatement(s);case y._return:return this.parseReturnStatement(s);case y._switch:return this.parseSwitchStatement(s);case y._throw:return this.parseThrowStatement(s);case y._try:return this.parseTryStatement(s);case y._const:case y._var:return n=n||this.value,e&&"var"!==n&&this.unexpected(),this.parseVarStatement(s,n);case y._while:return this.parseWhileStatement(s);case y._with:return this.parseWithStatement(s);case y.braceL:return this.parseBlock(!0,s);case y.semi:return this.parseEmptyStatement(s);case y._export:case y._import:if(this.options.ecmaVersion>10&&r===y._import){S.lastIndex=this.pos;var a=S.exec(this.input),o=this.pos+a[0].length,c=this.input.charCodeAt(o);if(40===c||46===c)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===y._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var l=this.value,h=this.parseExpression();return r===y.name&&"Identifier"===h.type&&this.eat(y.colon)?this.parseLabeledStatement(s,l,h,e):this.parseExpressionStatement(s,h)}},$.parseBreakContinueStatement=function(e,t){var i="break"===t;this.next(),this.eat(y.semi)||this.insertSemicolon()?e.label=null:this.type!==y.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var n=0;n<this.labels.length;++n){var r=this.labels[n];if(null==e.label||r.name===e.label.name){if(null!=r.kind&&(i||"loop"===r.kind))break;if(e.label&&i)break}}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")},$.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},$.parseDoStatement=function(e){return this.next(),this.labels.push(K),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(y._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(y.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},$.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(K),this.enterScope(0),this.expect(y.parenL),this.type===y.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===y._var||this.type===y._const||i){var n=this.startNode(),r=i?"let":this.value;return this.next(),this.parseVar(n,!0,r),this.finishNode(n,"VariableDeclaration"),(this.type===y._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===n.declarations.length?(this.options.ecmaVersion>=9&&(this.type===y._in?t>-1&&this.unexpected(t):e.await=t>-1),this.parseForIn(e,n)):(t>-1&&this.unexpected(t),this.parseFor(e,n))}var s=this.isContextual("let"),a=!1,o=this.containsEsc,c=new Y,l=this.start,h=t>-1?this.parseExprSubscripts(c,"await"):this.parseExpression(!0,c);return this.type===y._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===y._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(h.start!==l||o||"Identifier"!==h.type||"async"!==h.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),s&&a&&this.raise(h.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(h,!1,c),this.checkLValPattern(h),this.parseForIn(e,h)):(this.checkExpressionErrors(c,!0),t>-1&&this.unexpected(t),this.parseFor(e,h))},$.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Z|(i?0:J),!1,t)},$.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(y._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},$.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(y.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},$.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(y.braceL),this.labels.push(X),this.enterScope(0);for(var i=!1;this.type!==y.braceR;)if(this.type===y._case||this.type===y._default){var n=this.type===y._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(y.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},$.parseThrowStatement=function(e){return this.next(),_.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var Q=[];$.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(y.parenR),e},$.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===y._catch){var t=this.startNode();this.next(),this.eat(y.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(y._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},$.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")},$.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(K),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},$.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},$.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},$.parseLabeledStatement=function(e,t,i,n){for(var r=0,s=this.labels;r<s.length;r+=1)s[r].name===t&&this.raise(i.start,"Label '"+t+"' is already declared");for(var a=this.type.isLoop?"loop":this.type===y._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var c=this.labels[o];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(n?-1===n.indexOf("label")?n+"label":n:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")},$.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},$.parseBlock=function(e,t,i){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(y.braceL),e&&this.enterScope(0);this.type!==y.braceR;){var n=this.parseStatement(null);t.body.push(n)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},$.parseFor=function(e,t){return e.init=t,this.expect(y.semi),e.test=this.type===y.semi?null:this.parseExpression(),this.expect(y.semi),e.update=this.type===y.parenR?null:this.parseExpression(),this.expect(y.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},$.parseForIn=function(e,t){var i=this.type===y._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!i||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(y.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")},$.parseVar=function(e,t,i,n){for(e.declarations=[],e.kind=i;;){var r=this.startNode();if(this.parseVarId(r,i),this.eat(y.eq)?r.init=this.parseMaybeAssign(t):n||"const"!==i||this.type===y._in||this.options.ecmaVersion>=6&&this.isContextual("of")?n||"Identifier"===r.id.type||t&&(this.type===y._in||this.isContextual("of"))?r.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(r,"VariableDeclarator")),!this.eat(y.comma))break}return e},$.parseVarId=function(e,t){e.id=this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?1:2,!1)};var Z=1,J=2;function ee(e,t){var i=t.key.name,n=e[i],r="true";return"MethodDefinition"!==t.type||"get"!==t.kind&&"set"!==t.kind||(r=(t.static?"s":"i")+t.kind),"iget"===n&&"iset"===r||"iset"===n&&"iget"===r||"sget"===n&&"sset"===r||"sset"===n&&"sget"===r?(e[i]="true",!1):!!n||(e[i]=r,!1)}function te(e,t){var i=e.computed,n=e.key;return!i&&("Identifier"===n.type&&n.name===t||"Literal"===n.type&&n.value===t)}$.parseFunction=function(e,t,i,n,r){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===y.star&&t&J&&this.unexpected(),e.generator=this.eat(y.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&Z&&(e.id=4&t&&this.type!==y.name?null:this.parseIdent(),!e.id||t&J||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(j(e.async,e.generator)),t&Z||(e.id=this.type===y.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,r),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&Z?"FunctionDeclaration":"FunctionExpression")},$.parseFunctionParams=function(e){this.expect(y.parenL),e.params=this.parseBindingList(y.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},$.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),r=this.startNode(),s=!1;for(r.body=[],this.expect(y.braceL);this.type!==y.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(r.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&"PrivateIdentifier"===a.key.type&&ee(n,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(r,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},$.parseClassElement=function(e){if(this.eat(y.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),n="",r=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(y.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===y.star?o=!0:n="static"}if(i.static=o,!n&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==y.star||this.canInsertSemicolon()?n="async":s=!0),!n&&(t>=9||!s)&&this.eat(y.star)&&(r=!0),!n&&!s&&!r){var c=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=c:n=c)}if(n?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=n,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===y.parenL||"method"!==a||r||s){var l=!i.static&&te(i,"constructor"),h=l&&e;l&&"method"!==a&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=l?"constructor":a,this.parseClassMethod(i,r,s,h)}else this.parseClassField(i);return i},$.isClassElementNameStart=function(){return this.type===y.name||this.type===y.privateId||this.type===y.num||this.type===y.string||this.type===y.bracketL||this.type.keyword},$.parseClassElementName=function(e){this.type===y.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},$.parseClassMethod=function(e,t,i,n){var r=e.key;"constructor"===e.kind?(t&&this.raise(r.start,"Constructor can't be a generator"),i&&this.raise(r.start,"Constructor can't be an async method")):e.static&&te(e,"prototype")&&this.raise(r.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,i,n);return"get"===e.kind&&0!==s.params.length&&this.raiseRecoverable(s.start,"getter should have no params"),"set"===e.kind&&1!==s.params.length&&this.raiseRecoverable(s.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===s.params[0].type&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},$.parseClassField=function(e){if(te(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&te(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(y.eq)){var t=this.currentThisScope(),i=t.inClassFieldInit;t.inClassFieldInit=!0,e.value=this.parseMaybeAssign(),t.inClassFieldInit=i}else e.value=null;return this.semicolon(),this.finishNode(e,"PropertyDefinition")},$.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==y.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},$.parseClassId=function(e,t){this.type===y.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},$.parseClassSuper=function(e){e.superClass=this.eat(y._extends)?this.parseExprSubscripts(null,!1):null},$.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},$.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,r=0===n?null:this.privateNameStack[n-1],s=0;s<i.length;++s){var a=i[s];P(t,a.name)||(r?r.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},$.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==y.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},$.parseExport=function(e,t){if(this.next(),this.eat(y.star))return this.parseExportAllDeclaration(e,t);if(this.eat(y._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==y.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,n=e.specifiers;i<n.length;i+=1){var r=n[i];this.checkUnreserved(r.local),this.checkLocalExport(r.local),"Literal"===r.local.type&&this.raise(r.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},$.parseExportDeclaration=function(e){return this.parseStatement(null)},$.parseExportDefaultDeclaration=function(){var e;if(this.type===y._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Z,!1,e)}if(this.type===y._class){var i=this.startNode();return this.parseClass(i,"nullableID")}var n=this.parseMaybeAssign();return this.semicolon(),n},$.checkExport=function(e,t,i){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),P(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)},$.checkPatternExport=function(e,t){var i=t.type;if("Identifier"===i)this.checkExport(e,t,t.start);else if("ObjectPattern"===i)for(var n=0,r=t.properties;n<r.length;n+=1){var s=r[n];this.checkPatternExport(e,s)}else if("ArrayPattern"===i)for(var a=0,o=t.elements;a<o.length;a+=1){var c=o[a];c&&this.checkPatternExport(e,c)}else"Property"===i?this.checkPatternExport(e,t.value):"AssignmentPattern"===i?this.checkPatternExport(e,t.left):"RestElement"===i&&this.checkPatternExport(e,t.argument)},$.checkVariableExport=function(e,t){if(e)for(var i=0,n=t;i<n.length;i+=1){var r=n[i];this.checkPatternExport(e,r.id)}},$.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},$.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},$.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(y.braceL);!this.eat(y.braceR);){if(i)i=!1;else if(this.expect(y.comma),this.afterTrailingComma(y.braceR))break;t.push(this.parseExportSpecifier(e))}return t},$.parseImport=function(e){return this.next(),this.type===y.string?(e.specifiers=Q,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===y.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},$.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportSpecifier")},$.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportDefaultSpecifier")},$.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,"ImportNamespaceSpecifier")},$.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===y.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(y.comma)))return e;if(this.type===y.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(y.braceL);!this.eat(y.braceR);){if(t)t=!1;else if(this.expect(y.comma),this.afterTrailingComma(y.braceR))break;e.push(this.parseImportSpecifier())}return e},$.parseWithClause=function(){var e=[];if(!this.eat(y._with))return e;this.expect(y.braceL);for(var t={},i=!0;!this.eat(y.braceR);){if(i)i=!1;else if(this.expect(y.comma),this.afterTrailingComma(y.braceR))break;var n=this.parseImportAttribute(),r="Identifier"===n.key.type?n.key.name:n.key.value;P(t,r)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+r+"'"),t[r]=!0,e.push(n)}return e},$.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===y.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(y.colon),this.type!==y.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},$.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===y.string){var e=this.parseLiteral(this.value);return O.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},$.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},$.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var ie=H.prototype;ie.toAssignable=function(e,t,i){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",i&&this.checkPatternErrors(i,!0);for(var n=0,r=e.properties;n<r.length;n+=1){var s=r[n];this.toAssignable(s,t),"RestElement"!==s.type||"ArrayPattern"!==s.argument.type&&"ObjectPattern"!==s.argument.type||this.raise(s.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",i&&this.checkPatternErrors(i,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,i);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else i&&this.checkPatternErrors(i,!0);return e},ie.toAssignableList=function(e,t){for(var i=e.length,n=0;n<i;n++){var r=e[n];r&&this.toAssignable(r,t)}if(i){var s=e[i-1];6===this.options.ecmaVersion&&t&&s&&"RestElement"===s.type&&"Identifier"!==s.argument.type&&this.unexpected(s.argument.start)}return e},ie.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},ie.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==y.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},ie.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case y.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(y.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case y.braceL:return this.parseObj(!0)}return this.parseIdent()},ie.parseBindingList=function(e,t,i,n){for(var r=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(y.comma),t&&this.type===y.comma)r.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===y.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),r.push(a),this.type===y.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}r.push(this.parseAssignableListItem(n))}return r},ie.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},ie.parseBindingListItem=function(e){return e},ie.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(y.eq))return i;var n=this.startNodeAt(e,t);return n.left=i,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},ie.checkLValSimple=function(e,t,i){void 0===t&&(t=0);var n=0!==t;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(2===t&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(P(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),5!==t&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},ie.checkLValPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"ObjectPattern":for(var n=0,r=e.properties;n<r.length;n+=1){var s=r[n];this.checkLValInnerPattern(s,t,i)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var c=o[a];c&&this.checkLValInnerPattern(c,t,i)}break;default:this.checkLValSimple(e,t,i)}},ie.checkLValInnerPattern=function(e,t,i){switch(void 0===t&&(t=0),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var ne=function(e,t,i,n,r){this.token=e,this.isExpr=!!t,this.preserveSpace=!!i,this.override=n,this.generator=!!r},re={b_stat:new ne("{",!1),b_expr:new ne("{",!0),b_tmpl:new ne("${",!1),p_stat:new ne("(",!1),p_expr:new ne("(",!0),q_tmpl:new ne("`",!0,!0,(function(e){return e.tryReadTemplateToken()})),f_stat:new ne("function",!1),f_expr:new ne("function",!0),f_expr_gen:new ne("function",!0,!1,null,!0),f_gen:new ne("function",!1,!1,null,!0)},se=H.prototype;se.initialContext=function(){return[re.b_stat]},se.curContext=function(){return this.context[this.context.length-1]},se.braceIsBlock=function(e){var t=this.curContext();return t===re.f_expr||t===re.f_stat||(e!==y.colon||t!==re.b_stat&&t!==re.b_expr?e===y._return||e===y.name&&this.exprAllowed?_.test(this.input.slice(this.lastTokEnd,this.start)):e===y._else||e===y.semi||e===y.eof||e===y.parenR||e===y.arrow||(e===y.braceL?t===re.b_stat:e!==y._var&&e!==y._const&&e!==y.name&&!this.exprAllowed):!t.isExpr)},se.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},se.updateContext=function(e){var t,i=this.type;i.keyword&&e===y.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr},se.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},y.parenR.updateContext=y.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===re.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},y.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?re.b_stat:re.b_expr),this.exprAllowed=!0},y.dollarBraceL.updateContext=function(){this.context.push(re.b_tmpl),this.exprAllowed=!0},y.parenL.updateContext=function(e){var t=e===y._if||e===y._for||e===y._with||e===y._while;this.context.push(t?re.p_stat:re.p_expr),this.exprAllowed=!0},y.incDec.updateContext=function(){},y._function.updateContext=y._class.updateContext=function(e){!e.beforeExpr||e===y._else||e===y.semi&&this.curContext()!==re.p_stat||e===y._return&&_.test(this.input.slice(this.lastTokEnd,this.start))||(e===y.colon||e===y.braceL)&&this.curContext()===re.b_stat?this.context.push(re.f_stat):this.context.push(re.f_expr),this.exprAllowed=!1},y.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},y.backQuote.updateContext=function(){this.curContext()===re.q_tmpl?this.context.pop():this.context.push(re.q_tmpl),this.exprAllowed=!1},y.star.updateContext=function(e){if(e===y._function){var t=this.context.length-1;this.context[t]===re.f_expr?this.context[t]=re.f_expr_gen:this.context[t]=re.f_gen}this.exprAllowed=!0},y.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==y.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var ae=H.prototype;function oe(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&oe(e.expression)}function ce(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ce(e.expression)||"ParenthesizedExpression"===e.type&&ce(e.expression)}ae.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,r=e.key;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6)"__proto__"===n&&"init"===s&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);else{var a=t[n="$"+n];a?("init"===s?this.strict&&a.init||a.get||a.set:a.init||a[s])&&this.raiseRecoverable(r.start,"Redefinition of property"):a=t[n]={init:!1,get:!1,set:!1},a[s]=!0}}},ae.parseExpression=function(e,t){var i=this.start,n=this.startLoc,r=this.parseMaybeAssign(e,t);if(this.type===y.comma){var s=this.startNodeAt(i,n);for(s.expressions=[r];this.eat(y.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(s,"SequenceExpression")}return r},ae.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,r=-1,s=-1,a=-1;t?(r=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Y,n=!0);var o=this.start,c=this.startLoc;this.type!==y.parenL&&this.type!==y.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var l=this.parseMaybeConditional(e,t);if(i&&(l=i.call(this,l,o,c)),this.type.isAssign){var h=this.startNodeAt(o,c);return h.operator=this.value,this.type===y.eq&&(l=this.toAssignable(l,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===y.eq?this.checkLValPattern(l):this.checkLValSimple(l),h.left=l,this.next(),h.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(h,"AssignmentExpression")}return n&&this.checkExpressionErrors(t,!0),r>-1&&(t.parenthesizedAssign=r),s>-1&&(t.trailingComma=s),l},ae.parseMaybeConditional=function(e,t){var i=this.start,n=this.startLoc,r=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return r;if(this.eat(y.question)){var s=this.startNodeAt(i,n);return s.test=r,s.consequent=this.parseMaybeAssign(),this.expect(y.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return r},ae.parseExprOps=function(e,t){var i=this.start,n=this.startLoc,r=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||r.start===i&&"ArrowFunctionExpression"===r.type?r:this.parseExprOp(r,i,n,-1,e)},ae.parseExprOp=function(e,t,i,n,r){var s=this.type.binop;if(null!=s&&(!r||this.type!==y._in)&&s>n){var a=this.type===y.logicalOR||this.type===y.logicalAND,o=this.type===y.coalesce;o&&(s=y.logicalAND.binop);var c=this.value;this.next();var l=this.start,h=this.startLoc,u=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,r),l,h,s,r),d=this.buildBinary(t,i,e,u,c,a||o);return(a&&this.type===y.coalesce||o&&(this.type===y.logicalOR||this.type===y.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(d,t,i,n,r)}return e},ae.buildBinary=function(e,t,i,n,r,s){"PrivateIdentifier"===n.type&&this.raise(n.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=i,a.operator=r,a.right=n,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")},ae.parseMaybeUnary=function(e,t,i,n){var r,s=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)r=this.parseAwait(n),t=!0;else if(this.type.prefix){var o=this.startNode(),c=this.type===y.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,c,n),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&oe(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&ce(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,r=this.finishNode(o,c?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==y.privateId){if(r=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return r;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(s,a);l.operator=this.value,l.prefix=!1,l.argument=r,this.checkLValSimple(r),this.next(),r=this.finishNode(l,"UpdateExpression")}}else(n||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),r=this.parsePrivateIdent(),this.type!==y._in&&this.unexpected();return i||!this.eat(y.starstar)?r:t?void this.unexpected(this.lastTokStart):this.buildBinary(s,a,r,this.parseMaybeUnary(null,!1,!1,n),"**",!1)},ae.parseExprSubscripts=function(e,t){var i=this.start,n=this.startLoc,r=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===r.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return r;var s=this.parseSubscripts(r,i,n,!1,t);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s},ae.parseSubscripts=function(e,t,i,n,r){for(var s=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start==5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,i,n,s,a,r);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var c=this.startNodeAt(t,i);c.expression=o,o=this.finishNode(c,"ChainExpression")}return o}e=o}},ae.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(y.arrow)},ae.parseSubscriptAsyncArrow=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,n)},ae.parseSubscript=function(e,t,i,n,r,s,a){var o=this.options.ecmaVersion>=11,c=o&&this.eat(y.questionDot);n&&c&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var l=this.eat(y.bracketL);if(l||c&&this.type!==y.parenL&&this.type!==y.backQuote||this.eat(y.dot)){var h=this.startNodeAt(t,i);h.object=e,l?(h.property=this.parseExpression(),this.expect(y.bracketR)):this.type===y.privateId&&"Super"!==e.type?h.property=this.parsePrivateIdent():h.property=this.parseIdent("never"!==this.options.allowReserved),h.computed=!!l,o&&(h.optional=c),e=this.finishNode(h,"MemberExpression")}else if(!n&&this.eat(y.parenL)){var u=new Y,d=this.yieldPos,p=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(y.parenR,this.options.ecmaVersion>=8,!1,u);if(r&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=d,this.awaitPos=p,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,i,m,a);this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=m,o&&(g.optional=c),e=this.finishNode(g,"CallExpression")}else if(this.type===y.backQuote){(c||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var v=this.startNodeAt(t,i);v.tag=e,v.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(v,"TaggedTemplateExpression")}return e},ae.parseExprAtom=function(e,t,i){this.type===y.slash&&this.readRegexp();var n,r=this.potentialArrowAt===this.start;switch(this.type){case y._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type!==y.parenL||this.allowDirectSuper||this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==y.dot&&this.type!==y.bracketL&&this.type!==y.parenL&&this.unexpected(),this.finishNode(n,"Super");case y._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case y.name:var s=this.start,a=this.startLoc,o=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===c.name&&!this.canInsertSemicolon()&&this.eat(y._function))return this.overrideContext(re.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(r&&!this.canInsertSemicolon()){if(this.eat(y.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[c],!1,t);if(this.options.ecmaVersion>=8&&"async"===c.name&&this.type===y.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(y.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[c],!0,t)}return c;case y.regexp:var l=this.value;return(n=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},n;case y.num:case y.string:return this.parseLiteral(this.value);case y._null:case y._true:case y._false:return(n=this.startNode()).value=this.type===y._null?null:this.type===y._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case y.parenL:var h=this.start,u=this.parseParenAndDistinguishExpression(r,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(u)&&(e.parenthesizedAssign=h),e.parenthesizedBind<0&&(e.parenthesizedBind=h)),u;case y.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(y.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case y.braceL:return this.overrideContext(re.b_expr),this.parseObj(!1,e);case y._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case y._class:return this.parseClass(this.startNode(),!1);case y._new:return this.parseNew();case y.backQuote:return this.parseTemplate();case y._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}},ae.parseExprAtomDefault=function(){this.unexpected()},ae.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===y.parenL&&!e)return this.parseDynamicImport(t);if(this.type===y.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}this.unexpected()},ae.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(y.parenR)?e.options=null:(this.expect(y.comma),this.afterTrailingComma(y.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(y.parenR)||(this.expect(y.comma),this.afterTrailingComma(y.parenR)||this.unexpected())));else if(!this.eat(y.parenR)){var t=this.start;this.eat(y.comma)&&this.eat(y.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},ae.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"===this.options.sourceType||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},ae.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")},ae.parseParenExpression=function(){this.expect(y.parenL);var e=this.parseExpression();return this.expect(y.parenR),e},ae.shouldParseArrow=function(e){return!this.canInsertSemicolon()},ae.parseParenAndDistinguishExpression=function(e,t){var i,n=this.start,r=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,c=this.startLoc,l=[],h=!0,u=!1,d=new Y,p=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==y.parenR;){if(h?h=!1:this.expect(y.comma),s&&this.afterTrailingComma(y.parenR,!0)){u=!0;break}if(this.type===y.ellipsis){a=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===y.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}l.push(this.parseMaybeAssign(!1,d,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(y.parenR),e&&this.shouldParseArrow(l)&&this.eat(y.arrow))return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=f,this.parseParenArrowList(n,r,l,t);l.length&&!u||this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(d,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=f||this.awaitPos,l.length>1?((i=this.startNodeAt(o,c)).expressions=l,this.finishNodeAt(i,"SequenceExpression",m,g)):i=l[0]}else i=this.parseParenExpression();if(this.options.preserveParens){var v=this.startNodeAt(n,r);return v.expression=i,this.finishNode(v,"ParenthesizedExpression")}return i},ae.parseParenItem=function(e){return e},ae.parseParenArrowList=function(e,t,i,n){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,n)};var le=[];ae.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===y.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,r=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,r,!0,!1),this.eat(y.parenL)?e.arguments=this.parseExprList(y.parenR,this.options.ecmaVersion>=8,!1):e.arguments=le,this.finishNode(e,"NewExpression")},ae.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===y.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),i.tail=this.type===y.backQuote,this.finishNode(i,"TemplateElement")},ae.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(i.quasis=[n];!n.tail;)this.type===y.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(y.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(y.braceR),i.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")},ae.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===y.name||this.type===y.num||this.type===y.string||this.type===y.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===y.star)&&!_.test(this.input.slice(this.lastTokEnd,this.start))},ae.parseObj=function(e,t){var i=this.startNode(),n=!0,r={};for(i.properties=[],this.next();!this.eat(y.braceR);){if(n)n=!1;else if(this.expect(y.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(y.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,r,t),i.properties.push(s)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")},ae.parseProperty=function(e,t){var i,n,r,s,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(y.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===y.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===y.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(r=this.start,s=this.startLoc),e||(i=this.eat(y.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(a)?(n=!0,i=this.options.ecmaVersion>=9&&this.eat(y.star),this.parsePropertyName(a)):n=!1,this.parsePropertyValue(a,e,i,n,r,s,t,o),this.finishNode(a,"Property")},ae.parseGetterSetter=function(e){e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var t="get"===e.kind?0:1;if(e.value.params.length!==t){var i=e.value.start;"get"===e.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},ae.parsePropertyValue=function(e,t,i,n,r,s,a,o){(i||n)&&this.type===y.colon&&this.unexpected(),this.eat(y.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===y.parenL?(t&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(i,n)):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===y.comma||this.type===y.braceR||this.type===y.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((i||n)&&this.unexpected(),this.checkUnreserved(e.key),"await"!==e.key.name||this.awaitIdentPos||(this.awaitIdentPos=r),e.kind="init",t?e.value=this.parseMaybeDefault(r,s,this.copyNode(e.key)):this.type===y.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(r,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.shorthand=!0):this.unexpected():((i||n)&&this.unexpected(),this.parseGetterSetter(e))},ae.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(y.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(y.bracketR),e.key;e.computed=!1}return e.key=this.type===y.num||this.type===y.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},ae.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},ae.parseMethod=function(e,t,i){var n=this.startNode(),r=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|j(t,n.generator)|(i?128:0)),this.expect(y.parenL),n.params=this.parseBindingList(y.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=r,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(n,"FunctionExpression")},ae.parseArrowExpression=function(e,t,i,n){var r=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(16|j(i,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=r,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},ae.parseFunctionBody=function(e,t,i,n){var r=t&&this.type!==y.braceL,s=this.strict,a=!1;if(r)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);s&&!o||(a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list");var c=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},ae.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1)if("Identifier"!==i[t].type)return!1;return!0},ae.checkParams=function(e,t){for(var i=Object.create(null),n=0,r=e.params;n<r.length;n+=1){var s=r[n];this.checkLValInnerPattern(s,1,t?null:i)}},ae.parseExprList=function(e,t,i,n){for(var r=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(y.comma),t&&this.afterTrailingComma(e))break;var a=void 0;i&&this.type===y.comma?a=null:this.type===y.ellipsis?(a=this.parseSpread(n),n&&this.type===y.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):a=this.parseMaybeAssign(!1,n),r.push(a)}return r},ae.checkUnreserved=function(e){var t=e.start,i=e.end,n=e.name;this.inGenerator&&"yield"===n&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&"arguments"===n&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),!this.inClassStaticBlock||"arguments"!==n&&"await"!==n||this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(t,i).indexOf("\\")||(this.strict?this.reservedWordsStrict:this.reservedWords).test(n)&&(this.inAsync||"await"!==n||this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))},ae.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"!==t.name||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},ae.parseIdentNode=function(){var e=this.startNode();return this.type===y.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,"class"!==e.name&&"function"!==e.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop(),this.type=y.name):this.unexpected(),e},ae.parsePrivateIdent=function(){var e=this.startNode();return this.type===y.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},ae.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===y.semi||this.canInsertSemicolon()||this.type!==y.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(y.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},ae.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var he=H.prototype;he.raise=function(e,t){var i=R(this.input,e);t+=" ("+i.line+":"+i.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=i,n.raisedAt=this.pos,n},he.raiseRecoverable=he.raise,he.curPosition=function(){if(this.options.locations)return new B(this.curLine,this.pos-this.lineStart)};var ue=H.prototype,de=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};ue.enterScope=function(e){this.scopeStack.push(new de(e))},ue.exitScope=function(){this.scopeStack.pop()},ue.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},ue.declareName=function(e,t,i){var n=!1;if(2===t){var r=this.currentScope();n=r.lexical.indexOf(e)>-1||r.functions.indexOf(e)>-1||r.var.indexOf(e)>-1,r.lexical.push(e),this.inModule&&1&r.flags&&delete this.undefinedExports[e]}else if(4===t)this.currentScope().lexical.push(e);else if(3===t){var s=this.currentScope();n=this.treatFunctionsAsVar?s.lexical.indexOf(e)>-1:s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(32&o.flags&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){n=!0;break}if(o.var.push(e),this.inModule&&1&o.flags&&delete this.undefinedExports[e],259&o.flags)break}n&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")},ue.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},ue.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},ue.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags)return t}},ue.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(259&t.flags&&!(16&t.flags))return t}};var pe=function(e,t,i){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new D(e,i)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},fe=H.prototype;function me(e,t,i,n){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=i),e}fe.startNode=function(){return new pe(this,this.start,this.startLoc)},fe.startNodeAt=function(e,t){return new pe(this,e,t)},fe.finishNode=function(e,t){return me.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},fe.finishNodeAt=function(e,t,i,n){return me.call(this,e,t,i,n)},fe.copyNode=function(e){var t=new pe(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var ge,ve,be="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",ye=be+" Extended_Pictographic",_e=ye+" EBase EComp EMod EPres ExtPict",we={9:be,10:ye,11:ye,12:_e,13:_e,14:_e},xe={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},ke="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ce="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Se=Ce+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Me=Se+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ee=Me+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Te=Ee+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Pe={9:Ce,10:Se,11:Me,12:Ee,13:Te,14:Te+" Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"},Ae={};for(var Ie=0,Ne=[9,10,11,12,13,14];Ie<Ne.length;Ie+=1)ve=void 0,(ve=Ae[ge=Ne[Ie]]={binary:N(we[ge]+" "+ke),binaryOfStrings:N(xe[ge]),nonBinary:{General_Category:N(ke),Script:N(Pe[ge])}}).nonBinary.Script_Extensions=ve.nonBinary.Script,ve.nonBinary.gc=ve.nonBinary.General_Category,ve.nonBinary.sc=ve.nonBinary.Script,ve.nonBinary.scx=ve.nonBinary.Script_Extensions;var Le=H.prototype,Oe=function(e,t){this.parent=e,this.base=t||this};Oe.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var i=e;i;i=i.parent)if(t.base===i.base&&t!==i)return!0;return!1},Oe.prototype.sibling=function(){return new Oe(this.parent,this.base)};var Be=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ae[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function De(e){return 105===e||109===e||115===e}function Re(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function ze(e){return e>=65&&e<=90||e>=97&&e<=122}Be.prototype.reset=function(e,t,i){var n=-1!==i.indexOf("v"),r=-1!==i.indexOf("u");this.start=0|e,this.source=t+"",this.flags=i,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=r&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=r&&this.parser.options.ecmaVersion>=9)},Be.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},Be.prototype.at=function(e,t){void 0===t&&(t=!1);var i=this.source,n=i.length;if(e>=n)return-1;var r=i.charCodeAt(e);if(!t&&!this.switchU||r<=55295||r>=57344||e+1>=n)return r;var s=i.charCodeAt(e+1);return s>=56320&&s<=57343?(r<<10)+s-56613888:r},Be.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var i=this.source,n=i.length;if(e>=n)return n;var r,s=i.charCodeAt(e);return!t&&!this.switchU||s<=55295||s>=57344||e+1>=n||(r=i.charCodeAt(e+1))<56320||r>57343?e+1:e+2},Be.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},Be.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Be.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Be.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Be.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var i=this.pos,n=0,r=e;n<r.length;n+=1){var s=r[n],a=this.at(i,t);if(-1===a||a!==s)return!1;i=this.nextIndex(i,t)}return this.pos=i,!0},Le.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,n=!1,r=!1,s=0;s<i.length;s++){var a=i.charAt(s);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(n=!0),"v"===a&&(r=!0)}this.options.ecmaVersion>=15&&n&&r&&this.raise(e.start,"Invalid regular expression flag")},Le.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},Le.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,i=e.backReferenceNames;t<i.length;t+=1){var n=i[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},Le.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Oe(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},Le.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},Le.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},Le.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1},Le.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},Le.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},Le.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var n=0,r=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue),e.eat(125)))return-1!==r&&r<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1},Le.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},Le.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},Le.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),n=e.eat(45);if(i||n){for(var r=0;r<i.length;r++){var s=i.charAt(r);i.indexOf(s,r+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var a=this.regexp_eatModifiers(e);i||a||58!==e.current()||e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var c=a.charAt(o);(a.indexOf(c,o+1)>-1||i.indexOf(c)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},Le.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},Le.regexp_eatModifiers=function(e){for(var t="",i=0;-1!==(i=e.current())&&De(i);)t+=L(i),e.advance();return t},Le.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},Le.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},Le.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!Re(t)&&(e.lastIntValue=t,e.advance(),!0)},Le.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;-1!==(i=e.current())&&!Re(i);)e.advance();return e.pos!==t},Le.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t||(e.advance(),0))},Le.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var n=0,r=i;n<r.length;n+=1)r[n].separatedFrom(e.branchID)||e.raise("Duplicate capture group name");else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},Le.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},Le.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=L(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=L(e.lastIntValue);return!0}return!1},Le.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),function(e){return u(e,!0)||36===e||95===e}(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},Le.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,n=e.current(i);return e.advance(i),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(n=e.lastIntValue),function(e){return d(e,!0)||36===e||95===e||8204===e||8205===e}(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},Le.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},Le.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1},Le.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},Le.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},Le.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},Le.regexp_eatZero=function(e){return 48===e.current()&&!Fe(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},Le.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},Le.regexp_eatControlLetter=function(e){var t=e.current();return!!ze(t)&&(e.lastIntValue=t%32,e.advance(),!0)},Le.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var i=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var r=e.lastIntValue;if(n&&r>=55296&&r<=56319){var s=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=1024*(r-55296)+(a-56320)+65536,!0}e.pos=s,e.lastIntValue=r}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&function(e){return e>=0&&e<=1114111}(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=i}return!1},Le.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},Le.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};function Ve(e){return ze(e)||95===e}function qe(e){return Ve(e)||Fe(e)}function Fe(e){return e>=48&&e<=57}function je(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function He(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function Ge(e){return e>=48&&e<=55}Le.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return 100===e||68===e||115===e||83===e||119===e||87===e}(t))return e.lastIntValue=-1,e.advance(),1;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=80===t)||112===t)){var n;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&2===n&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return 0},Le.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,n),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,r)}return 0},Le.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){P(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")},Le.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},Le.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Ve(t=e.current());)e.lastStringValue+=L(t),e.advance();return""!==e.lastStringValue},Le.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";qe(t=e.current());)e.lastStringValue+=L(t),e.advance();return""!==e.lastStringValue},Le.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},Le.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&2===i&&e.raise("Negated character class may contain strings"),!0}return!1},Le.regexp_classContents=function(e){return 93===e.current()?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},Le.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;!e.switchU||-1!==t&&-1!==i||e.raise("Invalid character class"),-1!==t&&-1!==i&&t>i&&e.raise("Range out of order in character class")}}},Le.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(99===i||Ge(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return 93!==n&&(e.lastIntValue=n,e.advance(),!0)},Le.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},Le.regexp_classSetExpression=function(e){var t,i=1;if(this.regexp_eatClassSetRange(e));else if(t=this.regexp_eatClassSetOperand(e)){2===t&&(i=2);for(var n=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?2!==t&&(i=1):e.raise("Invalid character in character class");if(n!==e.pos)return i;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return i}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return i;2===t&&(i=2)}},Le.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return-1!==i&&-1!==n&&i>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},Le.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},Le.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return i&&2===n&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var r=this.regexp_eatCharacterClassEscape(e);if(r)return r;e.pos=t}return null},Le.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null},Le.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)2===this.regexp_classString(e)&&(t=2);return t},Le.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?1:2},Le.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e)&&(e.eat(98)?(e.lastIntValue=8,0):(e.pos=t,1)));var i=e.current();return!(i<0||i===e.lookahead()&&function(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}(i)||function(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}(i)||(e.advance(),e.lastIntValue=i,0))},Le.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}(t)&&(e.lastIntValue=t,e.advance(),!0)},Le.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!Fe(t)&&95!==t||(e.lastIntValue=t%32,e.advance(),0))},Le.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},Le.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Fe(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t},Le.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;je(i=e.current());)e.lastIntValue=16*e.lastIntValue+He(i),e.advance();return e.pos!==t},Le.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*i+e.lastIntValue:e.lastIntValue=8*t+i}else e.lastIntValue=t;return!0}return!1},Le.regexp_eatOctalDigit=function(e){var t=e.current();return Ge(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},Le.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var r=e.current();if(!je(r))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+He(r),e.advance()}return!0};var Ue=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new D(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},We=H.prototype;function Ye(e){return"function"!=typeof BigInt?null:BigInt(e.replace(/_/g,""))}We.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new Ue(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},We.getToken=function(){return this.next(),new Ue(this)},"undefined"!=typeof Symbol&&(We[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===y.eof,value:t}}}}),We.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(y.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},We.readToken=function(e){return u(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},We.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},We.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var n=void 0,r=t;(n=k(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())},We.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!x(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())},We.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&C.test(String.fromCharCode(e))))break e;++this.pos}}},We.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)},We.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(y.ellipsis)):(++this.pos,this.finishToken(y.dot))},We.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(y.assign,2):this.finishOp(y.slash,1)},We.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,n=42===e?y.star:y.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++i,n=y.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(y.assign,i+1):this.finishOp(n,i)},We.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(y.assign,3):this.finishOp(124===e?y.logicalOR:y.logicalAND,2):61===t?this.finishOp(y.assign,2):this.finishOp(124===e?y.bitwiseOR:y.bitwiseAND,1)},We.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(y.assign,2):this.finishOp(y.bitwiseXOR,1)},We.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!_.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(y.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(y.assign,2):this.finishOp(y.plusMin,1)},We.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+i)?this.finishOp(y.assign,i+1):this.finishOp(y.bitShift,i)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(i=2),this.finishOp(y.relational,i)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},We.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(y.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(y.arrow)):this.finishOp(61===e?y.eq:y.prefix,1)},We.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(y.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(y.assign,3):this.finishOp(y.coalesce,2)}return this.finishOp(y.question,1)},We.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,u(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(y.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+L(e)+"'")},We.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(y.parenL);case 41:return++this.pos,this.finishToken(y.parenR);case 59:return++this.pos,this.finishToken(y.semi);case 44:return++this.pos,this.finishToken(y.comma);case 91:return++this.pos,this.finishToken(y.bracketL);case 93:return++this.pos,this.finishToken(y.bracketR);case 123:return++this.pos,this.finishToken(y.braceL);case 125:return++this.pos,this.finishToken(y.braceR);case 58:return++this.pos,this.finishToken(y.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(y.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(y.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+L(e)+"'")},We.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)},We.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(_.test(n)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if("["===n)t=!0;else if("]"===n&&t)t=!1;else if("/"===n&&!t)break;e="\\"===n}++this.pos}var r=this.input.slice(i,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||(this.regexpState=new Be(this));o.reset(i,r,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var c=null;try{c=new RegExp(r,a)}catch(l){}return this.finishToken(y.regexp,{pattern:r,flags:a,value:c})},We.readInt=function(e,t,i){for(var n=this.options.ecmaVersion>=12&&void 0===t,r=i&&48===this.input.charCodeAt(this.pos),s=this.pos,a=0,o=0,c=0,l=null==t?1/0:t;c<l;++c,++this.pos){var h=this.input.charCodeAt(this.pos),u=void 0;if(n&&95===h)r&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===c&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;else{if((u=h>=97?h-97+10:h>=65?h-65+10:h>=48&&h<=57?h-48:1/0)>=e)break;o=h,a=a*e+u}}return n&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||null!=t&&this.pos-s!==t?null:a},We.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return null==i&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(i=Ye(this.input.slice(t,this.pos)),++this.pos):u(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(y.num,i)},We.readNumber=function(e){var t=this.pos;e||null!==this.readInt(10,void 0,!0)||this.raise(t,"Invalid number");var i=this.pos-t>=2&&48===this.input.charCodeAt(t);i&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&110===n){var r=Ye(this.input.slice(t,this.pos));return++this.pos,u(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(y.num,r)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),46!==n||i||(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),69!==n&&101!==n||i||(43!==(n=this.input.charCodeAt(++this.pos))&&45!==n||++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),u(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=function(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}(this.input.slice(t,this.pos),i);return this.finishToken(y.num,s)},We.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},We.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;92===n?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):8232===n||8233===n?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(x(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(y.string,t)};var $e={};We.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(ge){if(ge!==$e)throw ge;this.readInvalidTemplateToken()}this.inTemplateElement=!1},We.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw $e;this.raise(e,t)},We.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(96===i||36===i&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==y.template&&this.type!==y.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(y.template,e)):36===i?(this.pos+=2,this.finishToken(y.dollarBraceL)):(++this.pos,this.finishToken(y.backQuote));if(92===i)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(x(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(i)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},We.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(y.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},We.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return L(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],r=parseInt(n,8);return r>255&&(n=n.slice(0,-1),r=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),"0"===n&&56!==t&&57!==t||!this.strict&&!e||this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(r)}return x(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},We.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return null===i&&this.invalidStringToken(t,"Bad character escape sequence"),i},We.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var r=this.fullCharCodeAtPos();if(d(r,n))this.pos+=r<=65535?1:2;else{if(92!==r)break;this.containsEsc=!0,e+=this.input.slice(i,this.pos);var s=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?u:d)(a,n)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=L(a),i=this.pos}t=!1}return e+this.input.slice(i,this.pos)},We.readWord=function(){var e=this.readWord1(),t=y.name;return this.keywords.test(e)&&(t=v[e]),this.finishToken(t,e)};var Ke="8.14.0";H.acorn={Parser:H,version:Ke,defaultOptions:z,Position:B,SourceLocation:D,getLineInfo:R,Node:pe,TokenType:p,tokTypes:y,keywordTypes:v,TokContext:ne,tokContexts:re,isIdentifierChar:d,isIdentifierStart:u,Token:Ue,isNewLine:x,lineBreak:_,lineBreakG:w,nonASCIIwhitespace:C},e.Node=pe,e.Parser=H,e.Position=B,e.SourceLocation=D,e.TokContext=ne,e.Token=Ue,e.TokenType=p,e.defaultOptions=z,e.getLineInfo=R,e.isIdentifierChar=d,e.isIdentifierStart=u,e.isNewLine=x,e.keywordTypes=v,e.lineBreak=_,e.lineBreakG=w,e.nonASCIIwhitespace=C,e.parse=function(e,t){return H.parse(e,t)},e.parseExpressionAt=function(e,t,i){return H.parseExpressionAt(e,t,i)},e.tokContexts=re,e.tokTypes=y,e.tokenizer=function(e,t){return H.tokenizer(e,t)},e.version=Ke}(Ar.exports)),Ar.exports}const Nr=xr((Tr||(Tr=1,Pr=Sr,function(e,t){var i=(e=e||Mr).window,n=e.document,r=new function(){var e=/^(statics|enumerable|beans|preserve)$/,i=[],n=i.slice,r=Object.create,s=Object.getOwnPropertyDescriptor,a=Object.defineProperty,o=i.forEach||function(e,t){for(var i=0,n=this.length;i<n;i++)e.call(t,this[i],i,this)},c=function(e,t){for(var i in this)this.hasOwnProperty(i)&&e.call(t,this[i],i,this)},l=Object.assign||function(e){for(var t=1,i=arguments.length;t<i;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e},h=function(e,t,i){if(e){var n=s(e,"length");(n&&"number"==typeof n.value?o:c).call(e,t,i=i||e)}return i};function u(t,i,n,r,o){var c={};function l(e,l){"string"==typeof(l=l||(l=s(i,e))&&(l.get?l:l.value))&&"#"===l[0]&&(l=t[l.substring(1)]||l);var h,u="function"==typeof l,p=l,f=o||u&&!l.base?l&&l.get?e in t:t[e]:null;o&&f||(u&&f&&(l.base=f),u&&!1!==r&&(h=e.match(/^([gs]et|is)(([A-Z])(.*))$/))&&(c[h[3].toLowerCase()+h[4]]=h[2]),p&&!u&&p.get&&"function"==typeof p.get&&d.isPlainObject(p)||(p={value:p,writable:!0}),(s(t,e)||{configurable:!0}).configurable&&(p.configurable=!0,p.enumerable=null!=n?n:!h),a(t,e,p))}if(i){for(var h in i)i.hasOwnProperty(h)&&!e.test(h)&&l(h);for(var h in c){var u=c[h],p=t["set"+u],f=t["get"+u]||p&&t["is"+u];!f||!0!==r&&0!==f.length||l(h,{get:f,set:p})}}return t}function d(){for(var e=0,t=arguments.length;e<t;e++){var i=arguments[e];i&&l(this,i)}return this}return u(d,{inject:function(e){if(e){var t=!0===e.statics?e:e.statics,i=e.beans,n=e.preserve;t!==e&&u(this.prototype,e,e.enumerable,i,n),u(this,t,null,i,n)}for(var r=1,s=arguments.length;r<s;r++)this.inject(arguments[r]);return this},extend:function(){for(var e,t,i,n=this,s=0,o=arguments.length;s<o&&(!e||!t);s++)i=arguments[s],e=e||i.initialize,t=t||i.prototype;return e=e||function(){n.apply(this,arguments)},t=e.prototype=t||r(this.prototype),a(t,"constructor",{value:e,writable:!0,configurable:!0}),u(e,this),arguments.length&&this.inject.apply(e,arguments),e.base=n,e}}).inject({enumerable:!1,initialize:d,set:d,inject:function(){for(var e=0,t=arguments.length;e<t;e++){var i=arguments[e];i&&u(this,i,i.enumerable,i.beans,i.preserve)}return this},extend:function(){var e=r(this);return e.inject.apply(e,arguments)},each:function(e,t){return h(this,e,t)},clone:function(){return new this.constructor(this)},statics:{set:l,each:h,create:r,define:a,describe:s,clone:function(e){return l(new e.constructor,e)},isPlainObject:function(e){var t=null!=e&&e.constructor;return t&&(t===Object||t===d||"Object"===t.name)},pick:function(e,i){return e!==t?e:i},slice:function(e,t,i){return n.call(e,t,i)}}})};Pr.exports=r,r.inject({enumerable:!1,toString:function(){return null!=this._id?(this._class||"Object")+(this._name?" '"+this._name+"'":" @"+this._id):"{ "+r.each(this,(function(e,t){if(!/^_/.test(t)){var i=typeof e;this.push(t+": "+("number"===i?l.instance.number(e):"string"===i?"'"+e+"'":e))}}),[]).join(", ")+" }"},getClassName:function(){return this._class||""},importJSON:function(e){return r.importJSON(e,this)},exportJSON:function(e){return r.exportJSON(this,e)},toJSON:function(){return r.serialize(this)},set:function(e,t){return e&&r.filter(this,e,t,this._prioritize),this}},{beans:!1,statics:{exports:{},extend:function e(){var t=e.base.apply(this,arguments),i=t.prototype._class;return i&&!r.exports[i]&&(r.exports[i]=t),t},equals:function(e,t){if(e===t)return!0;if(e&&e.equals)return e.equals(t);if(t&&t.equals)return t.equals(e);if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)&&Array.isArray(t)){if((i=e.length)!==t.length)return!1;for(;i--;)if(!r.equals(e[i],t[i]))return!1}else{var i,n=Object.keys(e);if((i=n.length)!==Object.keys(t).length)return!1;for(;i--;){var s=n[i];if(!t.hasOwnProperty(s)||!r.equals(e[s],t[s]))return!1}}return!0}return!1},read:function(e,i,n,s){if(this===r){var a=this.peek(e,i);return e.__index++,a}var o=this.prototype,c=o._readIndex,l=i||c&&e.__index||0,h=e.length,u=e[l];if(s=s||h-l,u instanceof this||n&&n.readNull&&null==u&&s<=1)return c&&(e.__index=l+1),u&&n&&n.clone?u.clone():u;if(u=r.create(o),c&&(u.__read=!0),u=u.initialize.apply(u,l>0||l+s<h?r.slice(e,l,l+s):e)||u,c){e.__index=l+u.__read;var d=u.__filtered;d&&(e.__filtered=d,u.__filtered=t),u.__read=t}return u},peek:function(e,t){return e[e.__index=t||e.__index||0]},remain:function(e){return e.length-(e.__index||0)},readList:function(e,t,i,n){for(var r,s=[],a=t||0,o=n?a+n:e.length,c=a;c<o;c++)s.push(Array.isArray(r=e[c])?this.read(r,0,i):this.read(e,c,i,1));return s},readNamed:function(e,i,n,s,a){var o=this.getNamed(e,i),c=o!==t;if(c){var l=e.__filtered;if(!l){var h=this.getSource(e);(l=e.__filtered=r.create(h)).__unfiltered=h}l[i]=t}return this.read(c?[o]:e,n,s,a)},readSupported:function(e,i){var n=this.getSource(e),r=this,s=!1;return n&&Object.keys(n).forEach((function(n){if(n in i){var a=r.readNamed(e,n);a!==t&&(i[n]=a),s=!0}})),s},getSource:function(e){var i=e.__source;if(i===t){var n=1===e.length&&e[0];i=e.__source=n&&r.isPlainObject(n)?n:null}return i},getNamed:function(e,t){var i=this.getSource(e);if(i)return t?i[t]:e.__filtered||i},hasNamed:function(e,t){return!!this.getNamed(e,t)},filter:function(e,i,n,r){var s;function a(r){if(!(n&&r in n||s&&r in s)){var a=i[r];a!==t&&(e[r]=a)}}if(r){for(var o,c={},l=0,h=r.length;l<h;l++)(o=r[l])in i&&(a(o),c[o]=!0);s=c}return Object.keys(i.__unfiltered||i).forEach(a),e},isPlainValue:function(e,t){return r.isPlainObject(e)||Array.isArray(e)||t&&"string"==typeof e},serialize:function(e,t,i,n){t=t||{};var s,a=!n;if(a&&(t.formatter=new l(t.precision),n={length:0,definitions:{},references:{},add:function(e,t){var i="#"+e._id,n=this.references[i];if(!n){this.length++;var r=t.call(e),s=e._class;s&&r[0]!==s&&r.unshift(s),this.definitions[i]=r,n=this.references[i]=[i]}return n}}),e&&e._serialize){s=e._serialize(t,n);var o=e._class;!o||e._compactSerialize||!a&&i||s[0]===o||s.unshift(o)}else if(Array.isArray(e)){s=[];for(var c=0,h=e.length;c<h;c++)s[c]=r.serialize(e[c],t,i,n)}else if(r.isPlainObject(e)){s={};var u=Object.keys(e);for(c=0,h=u.length;c<h;c++){var d=u[c];s[d]=r.serialize(e[d],t,i,n)}}else s="number"==typeof e?t.formatter.number(e,t.precision):e;return a&&n.length>0?[["dictionary",n.definitions],s]:s},deserialize:function(e,t,i,n,s){var a=e,o=!i,c=o&&e&&e.length&&"dictionary"===e[0][0];if(i=i||{},Array.isArray(e)){var l=e[0],h="dictionary"===l;if(1==e.length&&/^#/.test(l))return i.dictionary[l];a=[];for(var u=(l=r.exports[l])?1:0,d=e.length;u<d;u++)a.push(r.deserialize(e[u],t,i,h,c));if(l){var p=a;a=t?t(l,p,o||s):new l(p)}}else if(r.isPlainObject(e))for(var f in a={},n&&(i.dictionary=a),e)a[f]=r.deserialize(e[f],t,i);return c?a[1]:a},exportJSON:function(e,t){var i=r.serialize(e,t);return t&&0==t.asString?i:JSON.stringify(i)},importJSON:function(e,t){return r.deserialize("string"==typeof e?JSON.parse(e):e,(function(e,i,n){var s=n&&t&&t.constructor===e,a=s?t:r.create(e.prototype);if(1===i.length&&a instanceof w&&(s||!(a instanceof k))){var o=i[0];r.isPlainObject(o)&&(o.insert=!1,s&&(i=i.concat([w.INSERT])))}return(s?a.set:e).apply(a,i),s&&(t=null),a}))},push:function(e,t){var i=t.length;if(i<4096)e.push.apply(e,t);else{var n=e.length;e.length+=i;for(var r=0;r<i;r++)e[n+r]=t[r]}return e},splice:function(e,i,n,s){var a=i&&i.length,o=n===t;(n=o?e.length:n)>e.length&&(n=e.length);for(var c=0;c<a;c++)i[c]._index=n+c;if(o)return r.push(e,i),[];var l=[n,s];i&&r.push(l,i);for(var h=e.splice.apply(e,l),u=(c=0,h.length);c<u;c++)h[c]._index=t;for(c=n+a,u=e.length;c<u;c++)e[c]._index=c;return h},capitalize:function(e){return e.replace(/\b[a-z]/g,(function(e){return e.toUpperCase()}))},camelize:function(e){return e.replace(/-(.)/g,(function(e,t){return t.toUpperCase()}))},hyphenate:function(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}}});var s={on:function(e,t){if("string"!=typeof e)r.each(e,(function(e,t){this.on(t,e)}),this);else{var i=this._eventTypes,n=i&&i[e],s=this._callbacks=this._callbacks||{};-1===(s=s[e]=s[e]||[]).indexOf(t)&&(s.push(t),n&&n.install&&1===s.length&&n.install.call(this,e))}return this},off:function(e,t){if("string"==typeof e){var i,n=this._eventTypes,s=n&&n[e],a=this._callbacks&&this._callbacks[e];return a&&(!t||-1!==(i=a.indexOf(t))&&1===a.length?(s&&s.uninstall&&s.uninstall.call(this,e),delete this._callbacks[e]):-1!==i&&a.splice(i,1)),this}r.each(e,(function(e,t){this.off(t,e)}),this)},once:function(e,t){return this.on(e,(function i(){t.apply(this,arguments),this.off(e,i)}))},emit:function(e,t){var i=this._callbacks&&this._callbacks[e];if(!i)return!1;var n=r.slice(arguments,1),s=t&&t.target&&!t.currentTarget;i=i.slice(),s&&(t.currentTarget=this);for(var a=0,o=i.length;a<o;a++)if(0==i[a].apply(this,n)){t&&t.stop&&t.stop();break}return s&&delete t.currentTarget,!0},responds:function(e){return!(!this._callbacks||!this._callbacks[e])},attach:"#on",detach:"#off",fire:"#emit",_installEvents:function(e){var t=this._eventTypes,i=this._callbacks,n=e?"install":"uninstall";if(t)for(var r in i)if(i[r].length>0){var s=t[r],a=s&&s[n];a&&a.call(this,r)}},statics:{inject:function e(t){var i=t._events;if(i){var n={};r.each(i,(function(e,i){var s="string"==typeof e,a=s?e:i,o=r.capitalize(a),c=a.substring(2).toLowerCase();n[c]=s?{}:e,a="_"+a,t["get"+o]=function(){return this[a]},t["set"+o]=function(e){var t=this[a];t&&this.off(c,t),e&&this.on(c,e),this[a]=e}})),t._eventTypes=n}return e.base.apply(this,arguments)}}},a=r.extend({_class:"PaperScope",initialize:function t(){ae=this,this.settings=new r({applyMatrix:!0,insertItems:!0,handleSize:4,hitTolerance:0}),this.project=null,this.projects=[],this.tools=[],this._id=t._id++,t._scopes[this._id]=this;var i=t.prototype;if(!this.support){var n=ie.getContext(1,1)||{};i.support={nativeDash:"setLineDash"in n||"mozDash"in n,nativeBlendModes:ne.nativeModes},ie.release(n)}if(!this.agent){var s=e.navigator.userAgent.toLowerCase(),a=(/(darwin|win|mac|linux|freebsd|sunos)/.exec(s)||[])[0],o="darwin"===a?"mac":a,c=i.agent=i.browser={platform:o};o&&(c[o]=!0),s.replace(/(opera|chrome|safari|webkit|firefox|msie|trident|atom|node|jsdom)\/?\s*([.\d]+)(?:.*version\/([.\d]+))?(?:.*rv\:v?([.\d]+))?/g,(function(e,t,i,n,r){if(!c.chrome){var s="opera"===t?n:/^(node|trident)$/.test(t)?r:i;c.version=s,c.versionNumber=parseFloat(s),t={trident:"msie",jsdom:"node"}[t]||t,c.name=t,c[t]=!0}})),c.chrome&&delete c.webkit,c.atom&&delete c.chrome}},version:"0.12.18",getView:function(){var e=this.project;return e&&e._view},getPaper:function(){return this},execute:function(e,t){var i=ae.PaperScript.execute(e,this,t);return W.updateFocus(),i},install:function(e){var t=this;for(var i in r.each(["project","view","tool"],(function(i){r.define(e,i,{configurable:!0,get:function(){return t[i]}})})),this)!/^_/.test(i)&&this[i]&&(e[i]=this[i])},setup:function(e){return ae=this,this.project=new _(e),this},createCanvas:function(e,t){return ie.getCanvas(e,t)},activate:function(){ae=this},clear:function(){for(var e=this.projects,t=this.tools,i=e.length-1;i>=0;i--)e[i].remove();for(i=t.length-1;i>=0;i--)t[i].remove()},remove:function(){this.clear(),delete a._scopes[this._id]},statics:new function(){function e(e){return e+="Attribute",function(t,i){return t[e](i)||t[e]("data-paper-"+i)}}return{_scopes:{},_id:0,get:function(e){return this._scopes[e]||null},getAttribute:e("get"),hasAttribute:e("has")}}}),o=r.extend(s,{initialize:function(e){this._scope=ae,this._index=this._scope[this._list].push(this)-1,!e&&this._scope[this._reference]||this.activate()},activate:function(){if(!this._scope)return!1;var e=this._scope[this._reference];return e&&e!==this&&e.emit("deactivate"),this._scope[this._reference]=this,this.emit("activate",e),!0},isActive:function(){return this._scope[this._reference]===this},remove:function(){return null!=this._index&&(r.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),this._scope=null,!0)},getView:function(){return this._scope.getView()}}),c={findItemBoundsCollisions:function(e,t,i){function n(e){for(var t=new Array(e.length),i=0;i<e.length;i++){var n=e[i].getBounds();t[i]=[n.left,n.top,n.right,n.bottom]}return t}var r=n(e),s=t&&t!==e?n(t):r;return this.findBoundsCollisions(r,s,i||0)},findCurveBoundsCollisions:function(e,t,i,n){function r(e){for(var t=Math.min,i=Math.max,n=new Array(e.length),r=0;r<e.length;r++){var s=e[r];n[r]=[t(s[0],s[2],s[4],s[6]),t(s[1],s[3],s[5],s[7]),i(s[0],s[2],s[4],s[6]),i(s[1],s[3],s[5],s[7])]}return n}var s=r(e),a=t&&t!==e?r(t):s;if(n){for(var o=this.findBoundsCollisions(s,a,i||0,!1,!0),c=this.findBoundsCollisions(s,a,i||0,!0,!0),l=[],h=0,u=o.length;h<u;h++)l[h]={hor:o[h],ver:c[h]};return l}return this.findBoundsCollisions(s,a,i||0)},findBoundsCollisions:function(e,t,i,n,r){var s=!t||e===t,a=s?e:e.concat(t),o=e.length,c=a.length;function l(e,t,i){for(var n=0,r=e.length;n<r;){var s=r+n>>>1;a[e[s]][t]<i?n=s+1:r=s}return n-1}for(var h=n?1:0,u=h+2,d=n?0:1,p=d+2,f=new Array(c),m=0;m<c;m++)f[m]=m;f.sort((function(e,t){return a[e][h]-a[t][h]}));var g=[],v=new Array(o);for(m=0;m<c;m++){var b=f[m],y=a[b],_=s?b:b-o,w=b<o,x=s||!w,k=w?[]:null;if(g.length){var C=l(g,u,y[h]-i)+1;if(g.splice(0,C),s&&r){k=k.concat(g);for(var S=0;S<g.length;S++)v[T=g[S]].push(_)}else{var M=y[p],E=y[d];for(S=0;S<g.length;S++){var T=g[S],P=a[T],A=T<o,I=s||T>=o;(r||(w&&I||x&&A)&&M>=P[d]-i&&E<=P[p]+i)&&(w&&I&&k.push(s?T:T-o),x&&A&&v[T].push(_))}}}if(w&&(e===t&&k.push(b),v[b]=k),g.length){var N=l(g,u,y[u]);g.splice(N+1,0,b)}else g.push(b)}for(m=0;m<v.length;m++){var L=v[m];L&&L.sort((function(e,t){return e-t}))}return v}},l=r.extend({initialize:function(e){this.precision=r.pick(e,5),this.multiplier=Math.pow(10,this.precision)},number:function(e){return this.precision<16?Math.round(e*this.multiplier)/this.multiplier:e},pair:function(e,t,i){return this.number(e)+(i||",")+this.number(t)},point:function(e,t){return this.number(e.x)+(t||",")+this.number(e.y)},size:function(e,t){return this.number(e.width)+(t||",")+this.number(e.height)},rectangle:function(e,t){return this.point(e,t)+(t||",")+this.size(e,t)}});l.instance=new l;var h=new function(){var e=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],t=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],i=Math.abs,n=Math.sqrt,r=Math.pow,s=Math.log2||function(e){return Math.log(e)*Math.LOG2E},a=1e-12,o=112e-18;function c(e,t,i){return e<t?t:e>i?i:e}function l(e,t,n){function r(e){var t=134217729*e,i=e-t+t;return[i,e-i]}var s=t*t-e*n,a=t*t+e*n;if(3*i(s)<a){var o=r(e),c=r(t),l=r(n),h=t*t,u=e*n;s=h-u+(c[0]*c[0]-h+2*c[0]*c[1]+c[1]*c[1]-(o[0]*l[0]-u+o[0]*l[1]+o[1]*l[0]+o[1]*l[1]))}return s}function u(){var e=Math.max.apply(Math,arguments);return e&&(e<1e-8||e>1e8)?r(2,-Math.round(s(e))):0}return{EPSILON:a,MACHINE_EPSILON:o,CURVETIME_EPSILON:1e-8,GEOMETRIC_EPSILON:1e-7,TRIGONOMETRIC_EPSILON:1e-8,ANGULAR_EPSILON:1e-5,KAPPA:4*(n(2)-1)/3,isZero:function(e){return e>=-1e-12&&e<=a},isMachineZero:function(e){return e>=-112e-18&&e<=o},clamp:c,integrate:function(i,n,r,s){for(var a=e[s-2],o=t[s-2],c=.5*(r-n),l=c+n,h=0,u=s+1>>1,d=1&s?o[h++]*i(l):0;h<u;){var p=c*a[h];d+=o[h++]*(i(l+p)+i(l-p))}return c*d},findRoot:function(e,t,n,r,s,a,o){for(var l=0;l<a;l++){var h=e(n),u=h/t(n),d=n-u;if(i(u)<o){n=d;break}h>0?(s=n,n=d<=r?.5*(r+s):d):(r=n,n=d>=s?.5*(r+s):d)}return c(n,r,s)},solveQuadratic:function(e,t,r,s,h,d){var p,f=1/0;if(i(e)<a){if(i(t)<a)return i(r)<a?-1:0;p=-r/t}else{var m=l(e,t*=-.5,r);if(m&&i(m)<o){var g=u(i(e),i(t),i(r));g&&(m=l(e*=g,t*=g,r*=g))}if(m>=-112e-18){var v=m<0?0:n(m),b=t+(t<0?-v:v);0===b?f=-(p=r/e):(p=b/e,f=r/b)}}var y=0,_=null==h,w=h-a,x=d+a;return isFinite(p)&&(_||p>w&&p<x)&&(s[y++]=_?p:c(p,h,d)),f!==p&&isFinite(f)&&(_||f>w&&f<x)&&(s[y++]=_?f:c(f,h,d)),y},solveCubic:function(e,t,s,l,d,p,f){var m,g,v,b,y,_=u(i(e),i(t),i(s),i(l));function w(i){var n=e*(m=i);b=(n+(g=n+t))*m+(v=g*m+s),y=v*m+l}if(_&&(e*=_,t*=_,s*=_,l*=_),i(e)<a)e=t,g=s,v=l,m=1/0;else if(i(l)<a)g=t,v=s,m=0;else{w(-t/e/3);var x=y/e,k=r(i(x),1/3),C=x<0?-1:1,S=-b/e,M=S>0?1.324717957244746*Math.max(k,n(S)):k,E=m-C*M;if(E!==m){do{w(E),E=0===b?m:m-y/b/(1+o)}while(C*E>C*m);i(e)*m*m>i(l/m)&&(g=((v=-l/m)-s)/m)}}var T=h.solveQuadratic(e,g,v,d,p,f),P=null==p;return isFinite(m)&&(0===T||T>0&&m!==d[0]&&m!==d[1])&&(P||m>p-a&&m<f+a)&&(d[T++]=P?m:c(m,p,f)),T}}},u={_id:1,_pools:{},get:function(e){if(e){var t=this._pools[e];return t||(t=this._pools[e]={_id:1}),t._id++}return this._id++}},d=r.extend({_class:"Point",_readIndex:!0,initialize:function(e,t){var i=typeof e,n=this.__read,r=0;if("number"===i){var s="number"==typeof t;this._set(e,s?t:e),n&&(r=s?2:1)}else if("undefined"===i||null===e)this._set(0,0),n&&(r=null===e?1:0);else{var a="string"===i?e.split(/[\s,]+/)||[]:e;r=1,Array.isArray(a)?this._set(+a[0],+(a.length>1?a[1]:a[0])):"x"in a?this._set(a.x||0,a.y||0):"width"in a?this._set(a.width||0,a.height||0):"angle"in a?(this._set(a.length||0,0),this.setAngle(a.angle||0)):(this._set(0,0),r=0)}return n&&(this.__read=r),this},set:"#initialize",_set:function(e,t){return this.x=e,this.y=t,this},equals:function(e){return this===e||e&&(this.x===e.x&&this.y===e.y||Array.isArray(e)&&this.x===e[0]&&this.y===e[1])||!1},clone:function(){return new d(this.x,this.y)},toString:function(){var e=l.instance;return"{ x: "+e.number(this.x)+", y: "+e.number(this.y)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.x),t.number(this.y)]},getLength:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setLength:function(e){if(this.isZero()){var t=this._angle||0;this._set(Math.cos(t)*e,Math.sin(t)*e)}else{var i=e/this.getLength();h.isZero(i)&&this.getAngle(),this._set(this.x*i,this.y*i)}},getAngle:function(){return 180*this.getAngleInRadians.apply(this,arguments)/Math.PI},setAngle:function(e){this.setAngleInRadians.call(this,e*Math.PI/180)},getAngleInDegrees:"#getAngle",setAngleInDegrees:"#setAngle",getAngleInRadians:function(){if(arguments.length){var e=d.read(arguments),t=this.getLength()*e.getLength();if(h.isZero(t))return NaN;var i=this.dot(e)/t;return Math.acos(i<-1?-1:i>1?1:i)}return this.isZero()?this._angle||0:this._angle=Math.atan2(this.y,this.x)},setAngleInRadians:function(e){if(this._angle=e,!this.isZero()){var t=this.getLength();this._set(Math.cos(e)*t,Math.sin(e)*t)}},getQuadrant:function(){return this.x>=0?this.y>=0?1:4:this.y>=0?2:3}},{beans:!1,getDirectedAngle:function(){var e=d.read(arguments);return 180*Math.atan2(this.cross(e),this.dot(e))/Math.PI},getDistance:function(){var e=arguments,t=d.read(e),i=t.x-this.x,n=t.y-this.y,s=i*i+n*n;return r.read(e)?s:Math.sqrt(s)},normalize:function(e){e===t&&(e=1);var i=this.getLength(),n=0!==i?e/i:0,r=new d(this.x*n,this.y*n);return n>=0&&(r._angle=this._angle),r},rotate:function(e,t){if(0===e)return this.clone();e=e*Math.PI/180;var i=t?this.subtract(t):this,n=Math.sin(e),r=Math.cos(e);return i=new d(i.x*r-i.y*n,i.x*n+i.y*r),t?i.add(t):i},transform:function(e){return e?e._transformPoint(this):this},add:function(){var e=d.read(arguments);return new d(this.x+e.x,this.y+e.y)},subtract:function(){var e=d.read(arguments);return new d(this.x-e.x,this.y-e.y)},multiply:function(){var e=d.read(arguments);return new d(this.x*e.x,this.y*e.y)},divide:function(){var e=d.read(arguments);return new d(this.x/e.x,this.y/e.y)},modulo:function(){var e=d.read(arguments);return new d(this.x%e.x,this.y%e.y)},negate:function(){return new d(-this.x,-this.y)},isInside:function(){return g.read(arguments).contains(this)},isClose:function(){var e=arguments,t=d.read(e),i=r.read(e);return this.getDistance(t)<=i},isCollinear:function(){var e=d.read(arguments);return d.isCollinear(this.x,this.y,e.x,e.y)},isColinear:"#isCollinear",isOrthogonal:function(){var e=d.read(arguments);return d.isOrthogonal(this.x,this.y,e.x,e.y)},isZero:function(){var e=h.isZero;return e(this.x)&&e(this.y)},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},isInQuadrant:function(e){return this.x*(e>1&&e<4?-1:1)>=0&&this.y*(e>2?-1:1)>=0},dot:function(){var e=d.read(arguments);return this.x*e.x+this.y*e.y},cross:function(){var e=d.read(arguments);return this.x*e.y-this.y*e.x},project:function(){var e=d.read(arguments),t=e.isZero()?0:this.dot(e)/e.dot(e);return new d(e.x*t,e.y*t)},statics:{min:function(){var e=arguments,t=d.read(e),i=d.read(e);return new d(Math.min(t.x,i.x),Math.min(t.y,i.y))},max:function(){var e=arguments,t=d.read(e),i=d.read(e);return new d(Math.max(t.x,i.x),Math.max(t.y,i.y))},random:function(){return new d(Math.random(),Math.random())},isCollinear:function(e,t,i,n){return Math.abs(e*n-t*i)<=1e-8*Math.sqrt((e*e+t*t)*(i*i+n*n))},isOrthogonal:function(e,t,i,n){return Math.abs(e*i+t*n)<=1e-8*Math.sqrt((e*e+t*t)*(i*i+n*n))}}},r.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new d(t(this.x),t(this.y))}}),{})),p=d.extend({initialize:function(e,t,i,n){this._x=e,this._y=t,this._owner=i,this._setter=n},_set:function(e,t,i){return this._x=e,this._y=t,i||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(e){this._x=e,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(e){this._y=e,this._owner[this._setter](this)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(e){this._owner._changeSelection(this._getSelection(),e)},_getSelection:function(){return"setPosition"===this._setter?4:0}}),f=r.extend({_class:"Size",_readIndex:!0,initialize:function(e,t){var i=typeof e,n=this.__read,r=0;if("number"===i){var s="number"==typeof t;this._set(e,s?t:e),n&&(r=s?2:1)}else if("undefined"===i||null===e)this._set(0,0),n&&(r=null===e?1:0);else{var a="string"===i?e.split(/[\s,]+/)||[]:e;r=1,Array.isArray(a)?this._set(+a[0],+(a.length>1?a[1]:a[0])):"width"in a?this._set(a.width||0,a.height||0):"x"in a?this._set(a.x||0,a.y||0):(this._set(0,0),r=0)}return n&&(this.__read=r),this},set:"#initialize",_set:function(e,t){return this.width=e,this.height=t,this},equals:function(e){return e===this||e&&(this.width===e.width&&this.height===e.height||Array.isArray(e)&&this.width===e[0]&&this.height===e[1])||!1},clone:function(){return new f(this.width,this.height)},toString:function(){var e=l.instance;return"{ width: "+e.number(this.width)+", height: "+e.number(this.height)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.width),t.number(this.height)]},add:function(){var e=f.read(arguments);return new f(this.width+e.width,this.height+e.height)},subtract:function(){var e=f.read(arguments);return new f(this.width-e.width,this.height-e.height)},multiply:function(){var e=f.read(arguments);return new f(this.width*e.width,this.height*e.height)},divide:function(){var e=f.read(arguments);return new f(this.width/e.width,this.height/e.height)},modulo:function(){var e=f.read(arguments);return new f(this.width%e.width,this.height%e.height)},negate:function(){return new f(-this.width,-this.height)},isZero:function(){var e=h.isZero;return e(this.width)&&e(this.height)},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{min:function(e,t){return new f(Math.min(e.width,t.width),Math.min(e.height,t.height))},max:function(e,t){return new f(Math.max(e.width,t.width),Math.max(e.height,t.height))},random:function(){return new f(Math.random(),Math.random())}}},r.each(["round","ceil","floor","abs"],(function(e){var t=Math[e];this[e]=function(){return new f(t(this.width),t(this.height))}}),{})),m=f.extend({initialize:function(e,t,i,n){this._width=e,this._height=t,this._owner=i,this._setter=n},_set:function(e,t,i){return this._width=e,this._height=t,i||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(e){this._width=e,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(e){this._height=e,this._owner[this._setter](this)}}),g=r.extend({_class:"Rectangle",_readIndex:!0,beans:!0,initialize:function(e,i,n,s){var a,o=arguments,c=typeof e;if("number"===c?(this._set(e,i,n,s),a=4):"undefined"===c||null===e?(this._set(0,0,0,0),a=null===e?1:0):1===o.length&&(Array.isArray(e)?(this._set.apply(this,e),a=1):e.x!==t||e.width!==t?(this._set(e.x||0,e.y||0,e.width||0,e.height||0),a=1):e.from===t&&e.to===t&&(this._set(0,0,0,0),r.readSupported(o,this)&&(a=1))),a===t){var l,h,u=d.readNamed(o,"from"),p=r.peek(o),m=u.x,g=u.y;if(p&&p.x!==t||r.hasNamed(o,"to")){var v=d.readNamed(o,"to");l=v.x-m,h=v.y-g,l<0&&(m=v.x,l=-l),h<0&&(g=v.y,h=-h)}else{var b=f.read(o);l=b.width,h=b.height}this._set(m,g,l,h),a=o.__index}var y=o.__filtered;return y&&(this.__filtered=y),this.__read&&(this.__read=a),this},set:"#initialize",_set:function(e,t,i,n){return this.x=e,this.y=t,this.width=i,this.height=n,this},clone:function(){return new g(this.x,this.y,this.width,this.height)},equals:function(e){var t=r.isPlainValue(e)?g.read(arguments):e;return t===this||t&&this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height||!1},toString:function(){var e=l.instance;return"{ x: "+e.number(this.x)+", y: "+e.number(this.y)+", width: "+e.number(this.width)+", height: "+e.number(this.height)+" }"},_serialize:function(e){var t=e.formatter;return[t.number(this.x),t.number(this.y),t.number(this.width),t.number(this.height)]},getPoint:function(e){return new(e?d:p)(this.x,this.y,this,"setPoint")},setPoint:function(){var e=d.read(arguments);this.x=e.x,this.y=e.y},getSize:function(e){return new(e?f:m)(this.width,this.height,this,"setSize")},_fw:1,_fh:1,setSize:function(){var e=f.read(arguments),t=this._sx,i=this._sy,n=e.width,r=e.height;t&&(this.x+=(this.width-n)*t),i&&(this.y+=(this.height-r)*i),this.width=n,this.height=r,this._fw=this._fh=1},getLeft:function(){return this.x},setLeft:function(e){if(!this._fw){var t=e-this.x;this.width-=.5===this._sx?2*t:t}this.x=e,this._sx=this._fw=0},getTop:function(){return this.y},setTop:function(e){if(!this._fh){var t=e-this.y;this.height-=.5===this._sy?2*t:t}this.y=e,this._sy=this._fh=0},getRight:function(){return this.x+this.width},setRight:function(e){if(!this._fw){var t=e-this.x;this.width=.5===this._sx?2*t:t}this.x=e-this.width,this._sx=1,this._fw=0},getBottom:function(){return this.y+this.height},setBottom:function(e){if(!this._fh){var t=e-this.y;this.height=.5===this._sy?2*t:t}this.y=e-this.height,this._sy=1,this._fh=0},getCenterX:function(){return this.x+this.width/2},setCenterX:function(e){this._fw||.5===this._sx?this.x=e-this.width/2:(this._sx&&(this.x+=2*(e-this.x)*this._sx),this.width=2*(e-this.x)),this._sx=.5,this._fw=0},getCenterY:function(){return this.y+this.height/2},setCenterY:function(e){this._fh||.5===this._sy?this.y=e-this.height/2:(this._sy&&(this.y+=2*(e-this.y)*this._sy),this.height=2*(e-this.y)),this._sy=.5,this._fh=0},getCenter:function(e){return new(e?d:p)(this.getCenterX(),this.getCenterY(),this,"setCenter")},setCenter:function(){var e=d.read(arguments);return this.setCenterX(e.x),this.setCenterY(e.y),this},getArea:function(){return this.width*this.height},isEmpty:function(){return 0===this.width||0===this.height},contains:function(e){return e&&e.width!==t||4===(Array.isArray(e)?e:arguments).length?this._containsRectangle(g.read(arguments)):this._containsPoint(d.read(arguments))},_containsPoint:function(e){var t=e.x,i=e.y;return t>=this.x&&i>=this.y&&t<=this.x+this.width&&i<=this.y+this.height},_containsRectangle:function(e){var t=e.x,i=e.y;return t>=this.x&&i>=this.y&&t+e.width<=this.x+this.width&&i+e.height<=this.y+this.height},intersects:function(){var e=g.read(arguments),t=r.read(arguments)||0;return e.x+e.width>this.x-t&&e.y+e.height>this.y-t&&e.x<this.x+this.width+t&&e.y<this.y+this.height+t},intersect:function(){var e=g.read(arguments),t=Math.max(this.x,e.x),i=Math.max(this.y,e.y),n=Math.min(this.x+this.width,e.x+e.width),r=Math.min(this.y+this.height,e.y+e.height);return new g(t,i,n-t,r-i)},unite:function(){var e=g.read(arguments),t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.x+this.width,e.x+e.width),r=Math.max(this.y+this.height,e.y+e.height);return new g(t,i,n-t,r-i)},include:function(){var e=d.read(arguments),t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.x+this.width,e.x),r=Math.max(this.y+this.height,e.y);return new g(t,i,n-t,r-i)},expand:function(){var e=f.read(arguments),t=e.width,i=e.height;return new g(this.x-t/2,this.y-i/2,this.width+t,this.height+i)},scale:function(e,i){return this.expand(this.width*e-this.width,this.height*(i===t?e:i)-this.height)}},r.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],(function(e,t){var i=e.join(""),n=/^[RL]/.test(i);t>=4&&(e[1]+=n?"Y":"X");var r=e[n?0:1],s=e[n?1:0],a="get"+r,o="get"+s,c="set"+r,l="set"+s,h="set"+i;this["get"+i]=function(e){return new(e?d:p)(this[a](),this[o](),this,h)},this[h]=function(){var e=d.read(arguments);this[c](e.x),this[l](e.y)}}),{beans:!0})),v=g.extend({initialize:function(e,t,i,n,r,s){this._set(e,t,i,n,!0),this._owner=r,this._setter=s},_set:function(e,t,i,n,r){return this._x=e,this._y=t,this._width=i,this._height=n,r||this._owner[this._setter](this),this}},new function(){var e=g.prototype;return r.each(["x","y","width","height"],(function(e){var t=r.capitalize(e),i="_"+e;this["get"+t]=function(){return this[i]},this["set"+t]=function(e){this[i]=e,this._dontNotify||this._owner[this._setter](this)}}),r.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],(function(t){var i="set"+t;this[i]=function(){this._dontNotify=!0,e[i].apply(this,arguments),this._dontNotify=!1,this._owner[this._setter](this)}}),{isSelected:function(){return!!(2&this._owner._selection)},setSelected:function(e){var t=this._owner;t._changeSelection&&t._changeSelection(2,e)}}))}),b=r.extend({_class:"Matrix",initialize:function e(t,i){var n=arguments,r=n.length,s=!0;if(r>=6?this._set.apply(this,n):1===r||2===r?t instanceof e?this._set(t._a,t._b,t._c,t._d,t._tx,t._ty,i):Array.isArray(t)?this._set.apply(this,i?t.concat([i]):t):s=!1:r?s=!1:this.reset(),!s)throw new Error("Unsupported matrix parameters");return this},set:"#initialize",_set:function(e,t,i,n,r,s,a){return this._a=e,this._b=t,this._c=i,this._d=n,this._tx=r,this._ty=s,a||this._changed(),this},_serialize:function(e,t){return r.serialize(this.getValues(),e,!0,t)},_changed:function(){var e=this._owner;e&&(e._applyMatrix?e.transform(null,!0):e._changed(25))},clone:function(){return new b(this._a,this._b,this._c,this._d,this._tx,this._ty)},equals:function(e){return e===this||e&&this._a===e._a&&this._b===e._b&&this._c===e._c&&this._d===e._d&&this._tx===e._tx&&this._ty===e._ty},toString:function(){var e=l.instance;return"[["+[e.number(this._a),e.number(this._c),e.number(this._tx)].join(", ")+"], ["+[e.number(this._b),e.number(this._d),e.number(this._ty)].join(", ")+"]]"},reset:function(e){return this._a=this._d=1,this._b=this._c=this._tx=this._ty=0,e||this._changed(),this},apply:function(e,t){var i=this._owner;return!!i&&(i.transform(null,r.pick(e,!0),t),this.isIdentity())},translate:function(){var e=d.read(arguments),t=e.x,i=e.y;return this._tx+=t*this._a+i*this._c,this._ty+=t*this._b+i*this._d,this._changed(),this},scale:function(){var e=arguments,t=d.read(e),i=d.read(e,0,{readNull:!0});return i&&this.translate(i),this._a*=t.x,this._b*=t.x,this._c*=t.y,this._d*=t.y,i&&this.translate(i.negate()),this._changed(),this},rotate:function(e){e*=Math.PI/180;var t=d.read(arguments,1),i=t.x,n=t.y,r=Math.cos(e),s=Math.sin(e),a=i-i*r+n*s,o=n-i*s-n*r,c=this._a,l=this._b,h=this._c,u=this._d;return this._a=r*c+s*h,this._b=r*l+s*u,this._c=-s*c+r*h,this._d=-s*l+r*u,this._tx+=a*c+o*h,this._ty+=a*l+o*u,this._changed(),this},shear:function(){var e=arguments,t=d.read(e),i=d.read(e,0,{readNull:!0});i&&this.translate(i);var n=this._a,r=this._b;return this._a+=t.y*this._c,this._b+=t.y*this._d,this._c+=t.x*n,this._d+=t.x*r,i&&this.translate(i.negate()),this._changed(),this},skew:function(){var e=arguments,t=d.read(e),i=d.read(e,0,{readNull:!0}),n=Math.PI/180,r=new d(Math.tan(t.x*n),Math.tan(t.y*n));return this.shear(r,i)},append:function(e,t){if(e){var i=this._a,n=this._b,r=this._c,s=this._d,a=e._a,o=e._c,c=e._b,l=e._d,h=e._tx,u=e._ty;this._a=a*i+c*r,this._c=o*i+l*r,this._b=a*n+c*s,this._d=o*n+l*s,this._tx+=h*i+u*r,this._ty+=h*n+u*s,t||this._changed()}return this},prepend:function(e,t){if(e){var i=this._a,n=this._b,r=this._c,s=this._d,a=this._tx,o=this._ty,c=e._a,l=e._c,h=e._b,u=e._d,d=e._tx,p=e._ty;this._a=c*i+l*n,this._c=c*r+l*s,this._b=h*i+u*n,this._d=h*r+u*s,this._tx=c*a+l*o+d,this._ty=h*a+u*o+p,t||this._changed()}return this},appended:function(e){return this.clone().append(e)},prepended:function(e){return this.clone().prepend(e)},invert:function(){var e=this._a,t=this._b,i=this._c,n=this._d,r=this._tx,s=this._ty,a=e*n-t*i,o=null;return a&&!isNaN(a)&&isFinite(r)&&isFinite(s)&&(this._a=n/a,this._b=-t/a,this._c=-i/a,this._d=e/a,this._tx=(i*s-n*r)/a,this._ty=(t*r-e*s)/a,o=this),o},inverted:function(){return this.clone().invert()},concatenate:"#append",preConcatenate:"#prepend",chain:"#appended",_shiftless:function(){return new b(this._a,this._b,this._c,this._d,0,0)},_orNullIfIdentity:function(){return this.isIdentity()?null:this},isIdentity:function(){return 1===this._a&&0===this._b&&0===this._c&&1===this._d&&0===this._tx&&0===this._ty},isInvertible:function(){var e=this._a*this._d-this._c*this._b;return e&&!isNaN(e)&&isFinite(this._tx)&&isFinite(this._ty)},isSingular:function(){return!this.isInvertible()},transform:function(e,t,i){return arguments.length<3?this._transformPoint(d.read(arguments)):this._transformCoordinates(e,t,i)},_transformPoint:function(e,t,i){var n=e.x,r=e.y;return t||(t=new d),t._set(n*this._a+r*this._c+this._tx,n*this._b+r*this._d+this._ty,i)},_transformCoordinates:function(e,t,i){for(var n=0,r=2*i;n<r;n+=2){var s=e[n],a=e[n+1];t[n]=s*this._a+a*this._c+this._tx,t[n+1]=s*this._b+a*this._d+this._ty}return t},_transformCorners:function(e){var t=e.x,i=e.y,n=t+e.width,r=i+e.height,s=[t,i,n,i,n,r,t,r];return this._transformCoordinates(s,s,4)},_transformBounds:function(e,t,i){for(var n=this._transformCorners(e),r=n.slice(0,2),s=r.slice(),a=2;a<8;a++){var o=n[a],c=1&a;o<r[c]?r[c]=o:o>s[c]&&(s[c]=o)}return t||(t=new g),t._set(r[0],r[1],s[0]-r[0],s[1]-r[1],i)},inverseTransform:function(){return this._inverseTransform(d.read(arguments))},_inverseTransform:function(e,t,i){var n=this._a,r=this._b,s=this._c,a=this._d,o=this._tx,c=this._ty,l=n*a-r*s,h=null;if(l&&!isNaN(l)&&isFinite(o)&&isFinite(c)){var u=e.x-this._tx,p=e.y-this._ty;t||(t=new d),h=t._set((u*a-p*s)/l,(p*n-u*r)/l,i)}return h},decompose:function(){var e,t,i,n=this._a,r=this._b,s=this._c,a=this._d,o=n*a-r*s,c=Math.sqrt,l=Math.atan2,h=180/Math.PI;if(0!==n||0!==r){var u=c(n*n+r*r);e=Math.acos(n/u)*(r>0?1:-1),t=[u,o/u],i=[l(n*s+r*a,u*u),0]}else if(0!==s||0!==a){var p=c(s*s+a*a);e=Math.asin(s/p)*(a>0?1:-1),t=[o/p,p],i=[0,l(n*s+r*a,p*p)]}else e=0,i=t=[0,0];return{translation:this.getTranslation(),rotation:e*h,scaling:new d(t),skewing:new d(i[0]*h,i[1]*h)}},getValues:function(){return[this._a,this._b,this._c,this._d,this._tx,this._ty]},getTranslation:function(){return new d(this._tx,this._ty)},getScaling:function(){return this.decompose().scaling},getRotation:function(){return this.decompose().rotation},applyToContext:function(e){this.isIdentity()||e.transform(this._a,this._b,this._c,this._d,this._tx,this._ty)}},r.each(["a","b","c","d","tx","ty"],(function(e){var t=r.capitalize(e),i="_"+e;this["get"+t]=function(){return this[i]},this["set"+t]=function(e){this[i]=e,this._changed()}}),{})),y=r.extend({_class:"Line",initialize:function(e,t,i,n,r){var s=!1;arguments.length>=4?(this._px=e,this._py=t,this._vx=i,this._vy=n,s=r):(this._px=e.x,this._py=e.y,this._vx=t.x,this._vy=t.y,s=i),s||(this._vx-=this._px,this._vy-=this._py)},getPoint:function(){return new d(this._px,this._py)},getVector:function(){return new d(this._vx,this._vy)},getLength:function(){return this.getVector().getLength()},intersect:function(e,t){return y.intersect(this._px,this._py,this._vx,this._vy,e._px,e._py,e._vx,e._vy,!0,t)},getSide:function(e,t){return y.getSide(this._px,this._py,this._vx,this._vy,e.x,e.y,!0,t)},getDistance:function(e){return Math.abs(this.getSignedDistance(e))},getSignedDistance:function(e){return y.getSignedDistance(this._px,this._py,this._vx,this._vy,e.x,e.y,!0)},isCollinear:function(e){return d.isCollinear(this._vx,this._vy,e._vx,e._vy)},isOrthogonal:function(e){return d.isOrthogonal(this._vx,this._vy,e._vx,e._vy)},statics:{intersect:function(e,t,i,n,r,s,a,o,c,l){c||(i-=e,n-=t,a-=r,o-=s);var u=i*o-n*a;if(!h.isMachineZero(u)){var p=e-r,f=t-s,m=(a*f-o*p)/u,g=(i*f-n*p)/u,v=-1e-12,b=1+1e-12;if(l||v<m&&m<b&&v<g&&g<b)return l||(m=m<=0?0:m>=1?1:m),new d(e+m*i,t+m*n)}},getSide:function(e,t,i,n,r,s,a,o){a||(i-=e,n-=t);var c=r-e,l=c*n-(s-t)*i;return!o&&h.isMachineZero(l)&&(l=(c*i+c*i)/(i*i+n*n))>=0&&l<=1&&(l=0),l<0?-1:l>0?1:0},getSignedDistance:function(e,t,i,n,r,s,a){return a||(i-=e,n-=t),0===i?n>0?r-e:e-r:0===n?i<0?s-t:t-s:((r-e)*n-(s-t)*i)/(n>i?n*Math.sqrt(1+i*i/(n*n)):i*Math.sqrt(1+n*n/(i*i)))},getDistance:function(e,t,i,n,r,s,a){return Math.abs(y.getSignedDistance(e,t,i,n,r,s,a))}}}),_=o.extend({_class:"Project",_list:"projects",_reference:"project",_compactSerialize:!0,initialize:function(e){o.call(this,!0),this._children=[],this._namedChildren={},this._activeLayer=null,this._currentStyle=new H(null,null,this),this._view=W.create(this,e||ie.getCanvas(1,1)),this._selectionItems={},this._selectionCount=0,this._updateVersion=0},_serialize:function(e,t){return r.serialize(this._children,e,!0,t)},_changed:function(e,t){if(1&e){var i=this._view;i&&(i._needsUpdate=!0,!i._requested&&i._autoUpdate&&i.requestUpdate())}var n=this._changes;if(n&&t){var r=this._changesById,s=t._id,a=r[s];a?a.flags|=e:n.push(r[s]={item:t,flags:e})}},clear:function(){for(var e=this._children,t=e.length-1;t>=0;t--)e[t].remove()},isEmpty:function(){return!this._children.length},remove:function e(){return!!e.base.call(this)&&(this._view&&this._view.remove(),!0)},getView:function(){return this._view},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(e){this._currentStyle.set(e)},getIndex:function(){return this._index},getOptions:function(){return this._scope.settings},getLayers:function(){return this._children},getActiveLayer:function(){return this._activeLayer||new k({project:this,insert:!0})},getSymbolDefinitions:function(){var e=[],t={};return this.getItems({class:M,match:function(i){var n=i._definition,r=n._id;return t[r]||(t[r]=!0,e.push(n)),!1}}),e},getSymbols:"getSymbolDefinitions",getSelectedItems:function(){var e=this._selectionItems,t=[];for(var i in e){var n=e[i],r=n._selection;1&r&&n.isInserted()?t.push(n):r||this._updateSelection(n)}return t},_updateSelection:function(e){var t=e._id,i=this._selectionItems;e._selection?i[t]!==e&&(this._selectionCount++,i[t]=e):i[t]===e&&(this._selectionCount--,delete i[t])},selectAll:function(){for(var e=this._children,t=0,i=e.length;t<i;t++)e[t].setFullySelected(!0)},deselectAll:function(){var e=this._selectionItems;for(var t in e)e[t].setFullySelected(!1)},addLayer:function(e){return this.insertLayer(t,e)},insertLayer:function(e,t){if(t instanceof k){t._remove(!1,!0),r.splice(this._children,[t],e,0),t._setProject(this,!0);var i=t._name;i&&t.setName(i),this._changes&&t._changed(5),this._activeLayer||(this._activeLayer=t)}else t=null;return t},_insertItem:function(e,i,n){return i=this.insertLayer(e,i)||(this._activeLayer||this._insertItem(t,new k(w.NO_INSERT),!0)).insertChild(e,i),n&&i.activate&&i.activate(),i},getItems:function(e){return w._getItems(this,e)},getItem:function(e){return w._getItems(this,e,null,null,!0)[0]||null},importJSON:function(e){this.activate();var t=this._activeLayer;return r.importJSON(e,t&&t.isEmpty()&&t)},removeOn:function(e){var t=this._removeSets;if(t){"mouseup"===e&&(t.mousedrag=null);var i=t[e];if(i){for(var n in i){var r=i[n];for(var s in t){var a=t[s];a&&a!=i&&delete a[r._id]}r.remove()}t[e]=null}}},draw:function(e,t,i){this._updateVersion++,e.save(),t.applyToContext(e);for(var n=this._children,s=new r({offset:new d(0,0),pixelRatio:i,viewMatrix:t.isIdentity()?null:t,matrices:[new b],updateMatrix:!0}),a=0,o=n.length;a<o;a++)n[a].draw(e,s);if(e.restore(),this._selectionCount>0){e.save(),e.strokeWidth=1;var c=this._selectionItems,l=this._scope.settings.handleSize,h=this._updateVersion;for(var u in c)c[u]._drawSelection(e,t,l,c,h);e.restore()}}}),w=r.extend(s,{statics:{extend:function e(t){return t._serializeFields&&(t._serializeFields=r.set({},this.prototype._serializeFields,t._serializeFields)),e.base.apply(this,arguments)},INSERT:{insert:!0},NO_INSERT:{insert:!1}},_class:"Item",_name:null,_applyMatrix:!0,_canApplyMatrix:!0,_canScaleStroke:!1,_pivot:null,_visible:!0,_blendMode:"normal",_opacity:1,_locked:!1,_guide:!1,_clipMask:!1,_selection:0,_selectBounds:!0,_selectChildren:!1,_serializeFields:{name:null,applyMatrix:null,matrix:new b,pivot:null,visible:!0,blendMode:"normal",opacity:1,locked:!1,guide:!1,clipMask:!1,selected:!1,data:{}},_prioritize:["applyMatrix"]},new function(){var e=["onMouseDown","onMouseUp","onMouseDrag","onClick","onDoubleClick","onMouseMove","onMouseEnter","onMouseLeave"];return r.each(e,(function(e){this._events[e]={install:function(e){this.getView()._countItemEvent(e,1)},uninstall:function(e){this.getView()._countItemEvent(e,-1)}}}),{_events:{onFrame:{install:function(){this.getView()._animateItem(this,!0)},uninstall:function(){this.getView()._animateItem(this,!1)}},onLoad:{},onError:{}},statics:{_itemHandlers:e}})},{initialize:function(){},_initialize:function(e,i){var n=e&&r.isPlainObject(e),s=n&&!0===e.internal,a=this._matrix=new b,o=n&&e.project||ae.project,c=ae.settings;return this._id=s?null:u.get(),this._parent=this._index=null,this._applyMatrix=this._canApplyMatrix&&c.applyMatrix,i&&a.translate(i),a._owner=this,this._style=new H(o._currentStyle,this,o),s||n&&0==e.insert||!c.insertItems&&(!n||1!=e.insert)?this._setProject(o):(n&&e.parent||o)._insertItem(t,this,!0),n&&e!==w.NO_INSERT&&e!==w.INSERT&&this.set(e,{internal:!0,insert:!0,project:!0,parent:!0}),n},_serialize:function(e,t){var i={},n=this;function s(s){for(var a in s){var o=n[a];r.equals(o,"leading"===a?1.2*s.fontSize:s[a])||(i[a]=r.serialize(o,e,"data"!==a,t))}}return s(this._serializeFields),this instanceof x||s(this._style._defaults),[this._class,i]},_changed:function(e){var i=this._symbol,n=this._parent||i,r=this._project;8&e&&(this._bounds=this._position=this._decomposed=t),16&e&&(this._globalMatrix=t),n&&72&e&&w._clearBoundsCache(n),2&e&&w._clearBoundsCache(this),r&&r._changed(e,this),i&&i._changed(e)},getId:function(){return this._id},getName:function(){return this._name},setName:function(e){if(this._name&&this._removeNamed(),e===+e+"")throw new Error("Names consisting only of numbers are not supported.");var i=this._getOwner();if(e&&i){var n=i._children,r=i._namedChildren;(r[e]=r[e]||[]).push(this),e in n||(n[e]=this)}this._name=e||t,this._changed(256)},getStyle:function(){return this._style},setStyle:function(e){this.getStyle().set(e)}},r.each(["locked","visible","blendMode","opacity","guide"],(function(e){var t=r.capitalize(e),i="_"+e,n={locked:256,visible:265};this["get"+t]=function(){return this[i]},this["set"+t]=function(t){t!=this[i]&&(this[i]=t,this._changed(n[e]||257))}}),{}),{beans:!0,getSelection:function(){return this._selection},setSelection:function(e){if(e!==this._selection){this._selection=e;var t=this._project;t&&(t._updateSelection(this),this._changed(257))}},_changeSelection:function(e,t){var i=this._selection;this.setSelection(t?i|e:i&~e)},isSelected:function(){if(this._selectChildren)for(var e=this._children,t=0,i=e.length;t<i;t++)if(e[t].isSelected())return!0;return!!(1&this._selection)},setSelected:function(e){if(this._selectChildren)for(var t=this._children,i=0,n=t.length;i<n;i++)t[i].setSelected(e);this._changeSelection(1,e)},isFullySelected:function(){var e=this._children,t=!!(1&this._selection);if(e&&t){for(var i=0,n=e.length;i<n;i++)if(!e[i].isFullySelected())return!1;return!0}return t},setFullySelected:function(e){var t=this._children;if(t)for(var i=0,n=t.length;i<n;i++)t[i].setFullySelected(e);this._changeSelection(1,e)},isClipMask:function(){return this._clipMask},setClipMask:function(e){this._clipMask!=(e=!!e)&&(this._clipMask=e,e&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(257),this._parent&&this._parent._changed(2048))},getData:function(){return this._data||(this._data={}),this._data},setData:function(e){this._data=e},getPosition:function(e){var t=e?d:p,i=this._position||(this._position=this._getPositionFromBounds());return new t(i.x,i.y,this,"setPosition")},setPosition:function(){this.translate(d.read(arguments).subtract(this.getPosition(!0)))},_getPositionFromBounds:function(e){return this._pivot?this._matrix._transformPoint(this._pivot):(e||this.getBounds()).getCenter(!0)},getPivot:function(){var e=this._pivot;return e?new p(e.x,e.y,this,"setPivot"):null},setPivot:function(){this._pivot=d.read(arguments,0,{clone:!0,readNull:!0}),this._position=t}},r.each({getStrokeBounds:{stroke:!0},getHandleBounds:{handle:!0},getInternalBounds:{internal:!0}},(function(e,t){this[t]=function(t){return this.getBounds(t,e)}}),{beans:!0,getBounds:function(e,t){var i=t||e instanceof b,n=r.set({},i?t:e,this._boundsOptions);n.stroke&&!this.getStrokeScaling()||(n.cacheItem=this);var s=this._getCachedBounds(i&&e,n).rect;return arguments.length?s:new v(s.x,s.y,s.width,s.height,this,"setBounds")},setBounds:function(){var e=g.read(arguments),t=this.getBounds(),i=this._matrix,n=new b,r=e.getCenter();n.translate(r),e.width==t.width&&e.height==t.height||(i.isInvertible()||(i.set(i._backup||(new b).translate(i.getTranslation())),t=this.getBounds()),n.scale(0!==t.width?e.width/t.width:0,0!==t.height?e.height/t.height:0)),r=t.getCenter(),n.translate(-r.x,-r.y),this.transform(n)},_getBounds:function(e,t){var i=this._children;return i&&i.length?(w._updateBoundsCache(this,t.cacheItem),w._getBounds(i,e,t)):new g},_getBoundsCacheKey:function(e,t){return[e.stroke?1:0,e.handle?1:0,t?1:0].join("")},_getCachedBounds:function(e,t,i){e=e&&e._orNullIfIdentity();var n=t.internal&&!i,r=t.cacheItem,s=n?null:this._matrix._orNullIfIdentity(),a=r&&(!e||e.equals(s))&&this._getBoundsCacheKey(t,n),o=this._bounds;if(w._updateBoundsCache(this._parent||this._symbol,r),a&&o&&a in o)return{rect:(d=o[a]).rect.clone(),nonscaling:d.nonscaling};var c=this._getBounds(e||s,t),l=c.rect||c,h=this._style,u=c.nonscaling||h.hasStroke()&&!h.getStrokeScaling();if(a){o||(this._bounds=o={});var d=o[a]={rect:l.clone(),nonscaling:u,internal:n}}return{rect:l,nonscaling:u}},_getStrokeMatrix:function(e,t){var i=this.getStrokeScaling()?null:t&&t.internal?this:this._parent||this._symbol&&this._symbol._item,n=i?i.getViewMatrix().invert():e;return n&&n._shiftless()},statics:{_updateBoundsCache:function(e,t){if(e&&t){var i=t._id,n=e._boundsCache=e._boundsCache||{ids:{},list:[]};n.ids[i]||(n.list.push(t),n.ids[i]=t)}},_clearBoundsCache:function(e){var i=e._boundsCache;if(i){e._bounds=e._position=e._boundsCache=t;for(var n=0,r=i.list,s=r.length;n<s;n++){var a=r[n];a!==e&&(a._bounds=a._position=t,a._boundsCache&&w._clearBoundsCache(a))}}},_getBounds:function(e,t,i){var n=1/0,r=-n,s=n,a=r,o=!1;i=i||{};for(var c=0,l=e.length;c<l;c++){var h=e[c];if(h._visible&&!h.isEmpty(!0)){var u=h._getCachedBounds(t&&t.appended(h._matrix),i,!0),d=u.rect;n=Math.min(d.x,n),s=Math.min(d.y,s),r=Math.max(d.x+d.width,r),a=Math.max(d.y+d.height,a),u.nonscaling&&(o=!0)}}return{rect:isFinite(n)?new g(n,s,r-n,a-s):new g,nonscaling:o}}}}),{beans:!0,_decompose:function(){return this._applyMatrix?null:this._decomposed||(this._decomposed=this._matrix.decompose())},getRotation:function(){var e=this._decompose();return e?e.rotation:0},setRotation:function(e){var t=this.getRotation();if(null!=t&&null!=e){var i=this._decomposed;this.rotate(e-t),i&&(i.rotation=e,this._decomposed=i)}},getScaling:function(){var e=this._decompose(),t=e&&e.scaling;return new p(t?t.x:1,t?t.y:1,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=d.read(arguments,0,{clone:!0,readNull:!0});if(e&&t&&!e.equals(t)){var i=this.getRotation(),n=this._decomposed,r=new b,s=h.isZero;if(s(e.x)||s(e.y))r.translate(n.translation),i&&r.rotate(i),r.scale(t.x,t.y),this._matrix.set(r);else{var a=this.getPosition(!0);r.translate(a),i&&r.rotate(i),r.scale(t.x/e.x,t.y/e.y),i&&r.rotate(-i),r.translate(a.negate()),this.transform(r)}n&&(n.scaling=t,this._decomposed=n)}},getMatrix:function(){return this._matrix},setMatrix:function(){var e=this._matrix;e.set.apply(e,arguments)},getGlobalMatrix:function(e){var t=this._globalMatrix;if(t)for(var i=this._parent,n=[];i;){if(!i._globalMatrix){t=null;for(var r=0,s=n.length;r<s;r++)n[r]._globalMatrix=null;break}n.push(i),i=i._parent}return t||(t=this._globalMatrix=this._matrix.clone(),(i=this._parent)&&t.prepend(i.getGlobalMatrix(!0))),e?t:t.clone()},getViewMatrix:function(){return this.getGlobalMatrix().prepend(this.getView()._matrix)},getApplyMatrix:function(){return this._applyMatrix},setApplyMatrix:function(e){(this._applyMatrix=this._canApplyMatrix&&!!e)&&this.transform(null,!0)},getTransformContent:"#getApplyMatrix",setTransformContent:"#setApplyMatrix"},{getProject:function(){return this._project},_setProject:function(e,t){if(this._project!==e){this._project&&this._installEvents(!1),this._project=e;for(var i=this._children,n=0,r=i&&i.length;n<r;n++)i[n]._setProject(e);t=!0}t&&this._installEvents(!0)},getView:function(){return this._project._view},_installEvents:function e(t){e.base.call(this,t);for(var i=this._children,n=0,r=i&&i.length;n<r;n++)i[n]._installEvents(t)},getLayer:function(){for(var e=this;e=e._parent;)if(e instanceof k)return e;return null},getParent:function(){return this._parent},setParent:function(e){return e.addChild(this)},_getOwner:"#getParent",getChildren:function(){return this._children},setChildren:function(e){this.removeChildren(),this.addChildren(e)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){var e=this._getOwner();return e&&e._children[this._index+1]||null},getPreviousSibling:function(){var e=this._getOwner();return e&&e._children[this._index-1]||null},getIndex:function(){return this._index},setIndex:function(e){var i=this._parent,n=i&&i._children;n&&i.insertChildren(e in n?e:t,[this])},equals:function(e){return e===this||e&&this._class===e._class&&this._style.equals(e._style)&&this._matrix.equals(e._matrix)&&this._locked===e._locked&&this._visible===e._visible&&this._blendMode===e._blendMode&&this._opacity===e._opacity&&this._clipMask===e._clipMask&&this._guide===e._guide&&this._equals(e)||!1},_equals:function(e){return r.equals(this._children,e._children)},clone:function(e){var i=new this.constructor(w.NO_INSERT),n=this._children,s=r.pick(e?e.insert:t,e===t||!0===e),a=r.pick(e?e.deep:t,!0);n&&i.copyAttributes(this),n&&!a||i.copyContent(this),n||i.copyAttributes(this),s&&i.insertAbove(this);var o=this._name,c=this._parent;if(o&&c){n=c._children;for(var l=o,h=1;n[o];)o=l+" "+h++;o!==l&&i.setName(o)}return i},copyContent:function(e){for(var t=e._children,i=0,n=t&&t.length;i<n;i++)this.addChild(t[i].clone(!1),!0)},copyAttributes:function(e,t){this.setStyle(e._style);for(var i=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide"],n=0,s=i.length;n<s;n++){var a=i[n];e.hasOwnProperty(a)&&(this[a]=e[a])}t||this._matrix.set(e._matrix,!0),this.setApplyMatrix(e._applyMatrix),this.setPivot(e._pivot),this.setSelection(e._selection);var o=e._data,c=e._name;this._data=o?r.clone(o):null,c&&this.setName(c)},rasterize:function(e,i){var n,s,a;r.isPlainObject(e)?(n=e.resolution,s=e.insert,a=e.raster):(n=e,s=i),a||(a=new S(w.NO_INSERT));var o=this.getStrokeBounds(),c=(n||this.getView().getResolution())/72,l=o.getTopLeft().floor(),h=o.getBottomRight().ceil(),u=new f(h.subtract(l)),d=u.multiply(c);if(a.setSize(d,!0),!d.isZero()){var p=a.getContext(!0),m=(new b).scale(c).translate(l.negate());p.save(),m.applyToContext(p),this.draw(p,new r({matrices:[m]})),p.restore()}return a._matrix.set((new b).translate(l.add(u.divide(2))).scale(1/c)),(s===t||s)&&a.insertAbove(this),a},contains:function(){var e=this._matrix;return e.isInvertible()&&!!this._contains(e._inverseTransform(d.read(arguments)))},_contains:function(e){var t=this._children;if(t){for(var i=t.length-1;i>=0;i--)if(t[i].contains(e))return!0;return!1}return e.isInside(this.getInternalBounds())},isInside:function(){return g.read(arguments).contains(this.getBounds())},_asPathItem:function(){return new O.Rectangle({rectangle:this.getInternalBounds(),matrix:this._matrix,insert:!1})},intersects:function(e,t){return e instanceof w&&this._asPathItem().getIntersections(e._asPathItem(),null,t,!0).length>0}},new function(){function e(){var e=arguments;return this._hitTest(d.read(e),T.getOptions(e))}function t(){var e=arguments,t=d.read(e),i=T.getOptions(e),n=[];return this._hitTest(t,new r({all:n},i)),n}function i(e,t,i,n){var r=this._children;if(r)for(var s=r.length-1;s>=0;s--){var a=r[s],o=a!==n&&a._hitTest(e,t,i);if(o&&!t.all)return o}return null}return _.inject({hitTest:e,hitTestAll:t,_hitTest:i}),{hitTest:e,hitTestAll:t,_hitTestChildren:i}},{_hitTest:function(e,t,i){if(this._locked||!this._visible||this._guide&&!t.guides||this.isEmpty())return null;var n=this._matrix,s=i?i.appended(n):this.getGlobalMatrix().prepend(this.getView()._matrix),a=Math.max(t.tolerance,1e-12),o=t._tolerancePadding=new f(O._getStrokePadding(a,n._shiftless().invert()));if(!(e=n._inverseTransform(e))||!this._children&&!this.getBounds({internal:!0,stroke:!0,handle:!0}).expand(o.multiply(2))._containsPoint(e))return null;var c,l,h=!(t.guides&&!this._guide||t.selected&&!this.isSelected()||t.type&&t.type!==r.hyphenate(this._class)||t.class&&!(this instanceof t.class)),u=t.match,d=this;function p(e){return e&&u&&!u(e)&&(e=null),e&&t.all&&t.all.push(e),e}function m(t,i){var n=i?c["get"+i]():d.getPosition();if(e.subtract(n).divide(o).length<=1)return new T(t,d,{name:i?r.hyphenate(i):t,point:n})}var g=t.position,v=t.center,b=t.bounds;if(h&&this._parent&&(g||v||b)){if((v||b)&&(c=this.getInternalBounds()),!(l=g&&m("position")||v&&m("center","Center"))&&b)for(var y=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],_=0;_<8&&!l;_++)l=m("bounds",y[_]);l=p(l)}return l||(l=this._hitTestChildren(e,t,s)||h&&p(this._hitTestSelf(e,t,s,this.getStrokeScaling()?null:s._shiftless().invert()))||null),l&&l.point&&(l.point=n.transform(l.point)),l},_hitTestSelf:function(e,t){if(t.fill&&this.hasFill()&&this._contains(e))return new T("fill",this)},matches:function(e,t){var i=typeof e;if("object"===i){for(var n in e)if(e.hasOwnProperty(n)&&!this.matches(n,e[n]))return!1;return!0}if("function"===i)return e(this);if("match"===e)return t(this);var s=/^(empty|editable)$/.test(e)?this["is"+r.capitalize(e)]():"type"===e?r.hyphenate(this._class):this[e];if("class"===e){if("function"==typeof t)return this instanceof t;s=this._class}if("function"==typeof t)return!!t(s);if(t){if(t.test)return t.test(s);if(r.isPlainObject(t))return function e(t,i){for(var n in t)if(t.hasOwnProperty(n)){var s=t[n],a=i[n];if(r.isPlainObject(s)&&r.isPlainObject(a)){if(!e(s,a))return!1}else if(!r.equals(s,a))return!1}return!0}(t,s)}return r.equals(s,t)},getItems:function(e){return w._getItems(this,e,this._matrix)},getItem:function(e){return w._getItems(this,e,this._matrix,null,!0)[0]||null},statics:{_getItems:function e(t,i,n,s,a){if(!s){var o="object"==typeof i&&i,c=o&&o.overlapping,l=o&&o.inside,h=(_=c||l)&&g.read([_]);s={items:[],recursive:o&&!1!==o.recursive,inside:!!l,overlapping:!!c,rect:h,path:c&&new O.Rectangle({rectangle:h,insert:!1})},o&&(i=r.filter({},i,{recursive:!0,inside:!0,overlapping:!0}))}var u=t._children,d=s.items;n=(h=s.rect)&&(n||new b);for(var p=0,f=u&&u.length;p<f;p++){var m=u[p],v=n&&n.appended(m._matrix),y=!0;if(h){var _=m.getBounds(v);if(!h.intersects(_))continue;h.contains(_)||s.overlapping&&(_.contains(h)||s.path.intersects(m,v))||(y=!1)}if(y&&m.matches(i)&&(d.push(m),a))break;if(!1!==s.recursive&&e(m,i,v,s,a),a&&d.length>0)break}return d}}},{importJSON:function(e){var t=r.importJSON(e,this);return t!==this?this.addChild(t):t},addChild:function(e){return this.insertChild(t,e)},insertChild:function(e,t){var i=t?this.insertChildren(e,[t]):null;return i&&i[0]},addChildren:function(e){return this.insertChildren(this._children.length,e)},insertChildren:function(e,t){var i=this._children;if(i&&t&&t.length>0){for(var n={},s=(t=r.slice(t)).length-1;s>=0;s--){var a=(h=t[s])&&h._id;!h||n[a]?t.splice(s,1):(h._remove(!1,!0),n[a]=!0)}r.splice(i,t,e,0);for(var o=this._project,c=o._changes,l=(s=0,t.length);s<l;s++){var h,u=(h=t[s])._name;h._parent=this,h._setProject(o,!0),u&&h.setName(u),c&&h._changed(5)}this._changed(11)}else t=null;return t},_insertItem:"#insertChild",_insertAt:function(e,t){var i=e&&e._getOwner(),n=e!==this&&i?this:null;return n&&(n._remove(!1,!0),i._insertItem(e._index+t,n)),n},insertAbove:function(e){return this._insertAt(e,1)},insertBelow:function(e){return this._insertAt(e,0)},sendToBack:function(){var e=this._getOwner();return e?e._insertItem(0,this):null},bringToFront:function(){var e=this._getOwner();return e?e._insertItem(t,this):null},appendTop:"#addChild",appendBottom:function(e){return this.insertChild(0,e)},moveAbove:"#insertAbove",moveBelow:"#insertBelow",addTo:function(e){return e._insertItem(t,this)},copyTo:function(e){return this.clone(!1).addTo(e)},reduce:function(e){var t=this._children;if(t&&1===t.length){var i=t[0].reduce(e);return this._parent?(i.insertAbove(this),this.remove()):i.remove(),i}return this},_removeNamed:function(){var e=this._getOwner();if(e){var t=e._children,i=e._namedChildren,n=this._name,r=i[n],s=r?r.indexOf(this):-1;-1!==s&&(t[n]==this&&delete t[n],r.splice(s,1),r.length?t[n]=r[0]:delete i[n])}},_remove:function(e,t){var i=this._getOwner(),n=this._project,s=this._index;return this._style&&this._style._dispose(),!!i&&(this._name&&this._removeNamed(),null!=s&&(n._activeLayer===this&&(n._activeLayer=this.getNextSibling()||this.getPreviousSibling()),r.splice(i._children,null,s,1)),this._installEvents(!1),e&&n._changes&&this._changed(5),t&&i._changed(11,this),this._parent=null,!0)},remove:function(){return this._remove(!0,!0)},replaceWith:function(e){var t=e&&e.insertBelow(this);return t&&this.remove(),t},removeChildren:function(e,t){if(!this._children)return null;e=e||0,t=r.pick(t,this._children.length);for(var i=r.splice(this._children,null,e,t-e),n=i.length-1;n>=0;n--)i[n]._remove(!0,!1);return i.length>0&&this._changed(11),i},clear:"#removeChildren",reverseChildren:function(){if(this._children){this._children.reverse();for(var e=0,t=this._children.length;e<t;e++)this._children[e]._index=e;this._changed(11)}},isEmpty:function(e){var t=this._children,i=t?t.length:0;if(e){for(var n=0;n<i;n++)if(!t[n].isEmpty(e))return!1;return!0}return!i},isEditable:function(){for(var e=this;e;){if(!e._visible||e._locked)return!1;e=e._parent}return!0},hasFill:function(){return this.getStyle().hasFill()},hasStroke:function(){return this.getStyle().hasStroke()},hasShadow:function(){return this.getStyle().hasShadow()},_getOrder:function(e){function t(e){var t=[];do{t.unshift(e)}while(e=e._parent);return t}for(var i=t(this),n=t(e),r=0,s=Math.min(i.length,n.length);r<s;r++)if(i[r]!=n[r])return i[r]._index<n[r]._index?1:-1;return 0},hasChildren:function(){return this._children&&this._children.length>0},isInserted:function(){return!!this._parent&&this._parent.isInserted()},isAbove:function(e){return-1===this._getOrder(e)},isBelow:function(e){return 1===this._getOrder(e)},isParent:function(e){return this._parent===e},isChild:function(e){return e&&e._parent===this},isDescendant:function(e){for(var t=this;t=t._parent;)if(t===e)return!0;return!1},isAncestor:function(e){return!!e&&e.isDescendant(this)},isSibling:function(e){return this._parent===e._parent},isGroupedWith:function(e){for(var t=this._parent;t;){if(t._parent&&/^(Group|Layer|CompoundPath)$/.test(t._class)&&e.isDescendant(t))return!0;t=t._parent}return!1}},r.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var i=arguments,n=(t?r:d).read(i),s=d.read(i,0,{readNull:!0});return this.transform((new b)[e](n,s||this.getPosition(!0)))}}),{translate:function(){var e=new b;return this.transform(e.translate.apply(e,arguments))},transform:function(e,t,i){var n=this._matrix,r=e&&!e.isIdentity(),s=i&&this._canApplyMatrix||this._applyMatrix&&(r||!n.isIdentity()||t&&this._children);if(!r&&!s)return this;if(r){!e.isInvertible()&&n.isInvertible()&&(n._backup=n.getValues()),n.prepend(e,!0);var a=this._style,o=a.getFillColor(!0),c=a.getStrokeColor(!0);o&&o.transform(e),c&&c.transform(e)}if(s&&(s=this._transformContent(n,t,i))){var l=this._pivot;l&&n._transformPoint(l,l,!0),n.reset(!0),i&&this._canApplyMatrix&&(this._applyMatrix=!0)}var h=this._bounds,u=this._position;(r||s)&&this._changed(25);var d=r&&h&&e.decompose();if(d&&d.skewing.isZero()&&d.rotation%90==0){for(var p in h){var f=h[p];if(f.nonscaling)delete h[p];else if(s||!f.internal){var m=f.rect;e._transformBounds(m,m)}}this._bounds=h;var g=h[this._getBoundsCacheKey(this._boundsOptions||{})];g&&(this._position=this._getPositionFromBounds(g.rect))}else r&&u&&this._pivot&&(this._position=e._transformPoint(u,u));return this},_transformContent:function(e,t,i){var n=this._children;if(n){for(var r=0,s=n.length;r<s;r++)n[r].transform(e,t,i);return!0}},globalToLocal:function(){return this.getGlobalMatrix(!0)._inverseTransform(d.read(arguments))},localToGlobal:function(){return this.getGlobalMatrix(!0)._transformPoint(d.read(arguments))},parentToLocal:function(){return this._matrix._inverseTransform(d.read(arguments))},localToParent:function(){return this._matrix._transformPoint(d.read(arguments))},fitBounds:function(e,t){e=g.read(arguments);var i=this.getBounds(),n=i.height/i.width,r=e.height/e.width,s=(t?n>r:n<r)?e.width/i.width:e.height/i.height,a=new g(new d,new f(i.width*s,i.height*s));a.setCenter(e.getCenter()),this.setBounds(a)}}),{_setStyles:function(e,t,i){var n=this._style,r=this._matrix;if(n.hasFill()&&(e.fillStyle=n.getFillColor().toCanvasStyle(e,r)),n.hasStroke()){e.strokeStyle=n.getStrokeColor().toCanvasStyle(e,r),e.lineWidth=n.getStrokeWidth();var s=n.getStrokeJoin(),a=n.getStrokeCap(),o=n.getMiterLimit();if(s&&(e.lineJoin=s),a&&(e.lineCap=a),o&&(e.miterLimit=o),ae.support.nativeDash){var c=n.getDashArray(),l=n.getDashOffset();c&&c.length&&("setLineDash"in e?(e.setLineDash(c),e.lineDashOffset=l):(e.mozDash=c,e.mozDashOffset=l))}}if(n.hasShadow()){var h=t.pixelRatio||1,u=i._shiftless().prepend((new b).scale(h,h)),p=u.transform(new d(n.getShadowBlur(),0)),f=u.transform(this.getShadowOffset());e.shadowColor=n.getShadowColor().toCanvasStyle(e),e.shadowBlur=p.getLength(),e.shadowOffsetX=f.x,e.shadowOffsetY=f.y}},draw:function(e,t,i){if(this._updateVersion=this._project._updateVersion,this._visible&&0!==this._opacity){var n=t.matrices,r=t.viewMatrix,s=this._matrix,a=n[n.length-1].appended(s);if(a.isInvertible()){r=r?r.appended(a):a,n.push(a),t.updateMatrix&&(this._globalMatrix=a);var o,c,l,u=this._blendMode,d=h.clamp(this._opacity,0,1),p="normal"===u,f=ne.nativeModes[u],m=p&&1===d||t.dontStart||t.clip||(f||p&&d<1)&&this._canComposite(),g=t.pixelRatio||1;if(!m){var v=this.getStrokeBounds(r);if(!v.width||!v.height)return void n.pop();l=t.offset,c=t.offset=v.getTopLeft().floor(),o=e,e=ie.getContext(v.getSize().ceil().add(1).multiply(g)),1!==g&&e.scale(g,g)}e.save();var b=i?i.appended(s):this._canScaleStroke&&!this.getStrokeScaling(!0)&&r,y=!m&&t.clipItem,_=!b||y;if(m?(e.globalAlpha=d,f&&(e.globalCompositeOperation=u)):_&&e.translate(-c.x,-c.y),_&&(m?s:r).applyToContext(e),y&&t.clipItem.draw(e,t.extend({clip:!0})),b){e.setTransform(g,0,0,g,0,0);var w=t.offset;w&&e.translate(-w.x,-w.y)}this._draw(e,t,r,b),e.restore(),n.pop(),t.clip&&!t.dontFinish&&e.clip(this.getFillRule()),m||(ne.process(u,e,o,d,c.subtract(l).multiply(g)),ie.release(e),t.offset=l)}}},_isUpdated:function(e){var t=this._parent;if(t instanceof B)return t._isUpdated(e);var i=this._updateVersion===e;return!i&&t&&t._visible&&t._isUpdated(e)&&(this._updateVersion=e,i=!0),i},_drawSelection:function(e,t,i,n,r){var s=this._selection,a=1&s,o=2&s||a&&this._selectBounds,c=4&s;if(this._drawSelected||(a=!1),(a||o||c)&&this._isUpdated(r)){var l,h=this.getSelectedColor(!0)||(l=this.getLayer())&&l.getSelectedColor(!0),u=t.appended(this.getGlobalMatrix(!0)),d=i/2;if(e.strokeStyle=e.fillStyle=h?h.toCanvasStyle(e):"#009dec",a&&this._drawSelected(e,u,n),c){var p=this.getPosition(!0),f=this._parent,m=f?f.localToGlobal(p):p,g=m.x,v=m.y;e.beginPath(),e.arc(g,v,d,0,2*Math.PI,!0),e.stroke();for(var b=[[0,-1],[1,0],[0,1],[-1,0]],y=d,_=i+1,w=0;w<4;w++){var x=b[w],k=x[0],C=x[1];e.moveTo(g+k*y,v+C*y),e.lineTo(g+k*_,v+C*_),e.stroke()}}if(o){var S=u._transformCorners(this.getInternalBounds());for(e.beginPath(),w=0;w<8;w++)e[w?"lineTo":"moveTo"](S[w],S[++w]);for(e.closePath(),e.stroke(),w=0;w<8;w++)e.fillRect(S[w]-d,S[++w]-d,i,i)}}},_canComposite:function(){return!1}},r.each(["down","drag","up","move"],(function(e){this["removeOn"+r.capitalize(e)]=function(){var t={};return t[e]=!0,this.removeOn(t)}}),{removeOn:function(e){for(var t in e)if(e[t]){var i="mouse"+t,n=this._project,r=n._removeSets=n._removeSets||{};r[i]=r[i]||{},r[i][this._id]=this}return this}}),{tween:function(e,t,i){i||(i=t,t=e,e=null,i||(i=t,t=null));var n=i&&i.easing,r=i&&i.start,s=null!=i&&("number"==typeof i?i:i.duration),a=new ee(this,e,t,s,n,r);return s&&this.on("frame",(function e(t){a._handleFrame(1e3*t.time),a.running||this.off("frame",e)})),a},tweenTo:function(e,t){return this.tween(null,e,t)},tweenFrom:function(e,t){return this.tween(e,null,t)}}),x=w.extend({_class:"Group",_selectBounds:!1,_selectChildren:!0,_serializeFields:{children:[]},initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||this.addChildren(Array.isArray(e)?e:arguments)},_changed:function e(i){e.base.call(this,i),2050&i&&(this._clipItem=t)},_getClipItem:function(){var e=this._clipItem;if(e===t){e=null;for(var i=this._children,n=0,r=i.length;n<r;n++)if(i[n]._clipMask){e=i[n];break}this._clipItem=e}return e},isClipped:function(){return!!this._getClipItem()},setClipped:function(e){var t=this.getFirstChild();t&&t.setClipMask(e)},_getBounds:function e(t,i){var n=this._getClipItem();return n?n._getCachedBounds(n._matrix.prepended(t),r.set({},i,{stroke:!1})):e.base.call(this,t,i)},_hitTestChildren:function e(t,i,n){var r=this._getClipItem();return(!r||r.contains(t))&&e.base.call(this,t,i,n,r)},_draw:function(e,t){var i=t.clip,n=!i&&this._getClipItem();t=t.extend({clipItem:n,clip:!1}),i?(e.beginPath(),t.dontStart=t.dontFinish=!0):n&&n.draw(e,t.extend({clip:!0}));for(var r=this._children,s=0,a=r.length;s<a;s++){var o=r[s];o!==n&&o.draw(e,t)}}}),k=x.extend({_class:"Layer",initialize:function(){x.apply(this,arguments)},_getOwner:function(){return this._parent||null!=this._index&&this._project},isInserted:function e(){return this._parent?e.base.call(this):null!=this._index},activate:function(){this._project._activeLayer=this},_hitTestSelf:function(){}}),C=w.extend({_class:"Shape",_applyMatrix:!1,_canApplyMatrix:!1,_canScaleStroke:!0,_serializeFields:{type:null,size:null,radius:null},initialize:function(e,t){this._initialize(e,t)},_equals:function(e){return this._type===e._type&&this._size.equals(e._size)&&r.equals(this._radius,e._radius)},copyContent:function(e){this.setType(e._type),this.setSize(e._size),this.setRadius(e._radius)},getType:function(){return this._type},setType:function(e){this._type=e},getShape:"#getType",setShape:"#setType",getSize:function(){var e=this._size;return new m(e.width,e.height,this,"setSize")},setSize:function(){var e=f.read(arguments);if(this._size){if(!this._size.equals(e)){var t=this._type,i=e.width,n=e.height;"rectangle"===t?this._radius.set(f.min(this._radius,e.divide(2).abs())):"circle"===t?(i=n=(i+n)/2,this._radius=i/2):"ellipse"===t&&this._radius._set(i/2,n/2),this._size._set(i,n),this._changed(9)}}else this._size=e.clone()},getRadius:function(){var e=this._radius;return"circle"===this._type?e:new m(e.width,e.height,this,"setRadius")},setRadius:function(e){var t=this._type;if("circle"===t){if(e===this._radius)return;var i=2*e;this._radius=e,this._size._set(i,i)}else if(e=f.read(arguments),this._radius){if(this._radius.equals(e))return;this._radius.set(e),"rectangle"===t?(i=f.max(this._size,e.multiply(2)),this._size.set(i)):"ellipse"===t&&this._size._set(2*e.width,2*e.height)}else this._radius=e.clone();this._changed(9)},isEmpty:function(){return!1},toPath:function(e){var i=new(O[r.capitalize(this._type)])({center:new d,size:this._size,radius:this._radius,insert:!1});return i.copyAttributes(this),ae.settings.applyMatrix&&i.setApplyMatrix(!0),(e===t||e)&&i.insertAbove(this),i},toShape:"#clone",_asPathItem:function(){return this.toPath(!1)},_draw:function(e,t,i,n){var r=this._style,s=r.hasFill(),a=r.hasStroke(),o=t.dontFinish||t.clip,c=!n;if(s||a||o){var l=this._type,h=this._radius,u="circle"===l;if(t.dontStart||e.beginPath(),c&&u)e.arc(0,0,h,0,2*Math.PI,!0);else{var d=u?h:h.width,p=u?h:h.height,f=this._size,m=f.width,g=f.height;if(c&&"rectangle"===l&&0===d&&0===p)e.rect(-m/2,-g/2,m,g);else{var v=m/2,b=g/2,y=.44771525016920644,_=d*y,w=p*y,x=[-v,-b+p,-v,-b+w,-v+_,-b,-v+d,-b,v-d,-b,v-_,-b,v,-b+w,v,-b+p,v,b-p,v,b-w,v-_,b,v-d,b,-v+d,b,-v+_,b,-v,b-w,-v,b-p];n&&n.transform(x,x,32),e.moveTo(x[0],x[1]),e.bezierCurveTo(x[2],x[3],x[4],x[5],x[6],x[7]),v!==d&&e.lineTo(x[8],x[9]),e.bezierCurveTo(x[10],x[11],x[12],x[13],x[14],x[15]),b!==p&&e.lineTo(x[16],x[17]),e.bezierCurveTo(x[18],x[19],x[20],x[21],x[22],x[23]),v!==d&&e.lineTo(x[24],x[25]),e.bezierCurveTo(x[26],x[27],x[28],x[29],x[30],x[31])}}e.closePath()}o||!s&&!a||(this._setStyles(e,t,i),s&&(e.fill(r.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),a&&e.stroke())},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_getBounds:function(e,t){var i=new g(this._size).setCenter(0,0),n=this._style,r=t.stroke&&n.hasStroke()&&n.getStrokeWidth();return e&&(i=e._transformBounds(i)),r?i.expand(O._getStrokePadding(r,this._getStrokeMatrix(e,t))):i}},new function(){function e(e,t,i){var n=e._radius;if(!n.isZero())for(var r=e._size.divide(2),s=1;s<=4;s++){var a=new d(s>1&&s<4?-1:1,s>2?-1:1),o=a.multiply(r),c=o.subtract(a.multiply(n));if(new g(i?o.add(a.multiply(i)):o,c).contains(t))return{point:c,quadrant:s}}}function t(e,t,i,n){var r=e.divide(t);return(!n||r.isInQuadrant(n))&&r.subtract(r.normalize()).multiply(t).divide(i).length<=1}return{_contains:function t(i){if("rectangle"===this._type){var n=e(this,i);return n?i.subtract(n.point).divide(this._radius).getLength()<=1:t.base.call(this,i)}return i.divide(this.size).getLength()<=.5},_hitTestSelf:function i(n,r,s,a){var o=!1,c=this._style,l=r.stroke&&c.hasStroke(),h=r.fill&&c.hasFill();if(l||h){var u=this._type,d=this._radius,p=l?c.getStrokeWidth()/2:0,f=r._tolerancePadding.add(O._getStrokePadding(p,!c.getStrokeScaling()&&a));if("rectangle"===u){var m=f.multiply(2),v=e(this,n,m);if(v)o=t(n.subtract(v.point),d,f,v.quadrant);else{var b=new g(this._size).setCenter(0,0),y=b.expand(m),_=b.expand(m.negate());o=y._containsPoint(n)&&!_._containsPoint(n)}}else o=t(n,d,f)}return o?new T(l?"stroke":"fill",this):i.base.apply(this,arguments)}}},{statics:new function(){function e(e,t,i,n,s){var a=r.create(C.prototype);return a._type=e,a._size=i,a._radius=n,a._initialize(r.getNamed(s),t),a}return{Circle:function(){var t=arguments,i=d.readNamed(t,"center"),n=r.readNamed(t,"radius");return e("circle",i,new f(2*n),n,t)},Rectangle:function(){var t=arguments,i=g.readNamed(t,"rectangle"),n=f.min(f.readNamed(t,"radius"),i.getSize(!0).divide(2));return e("rectangle",i.getCenter(!0),i.getSize(!0),n,t)},Ellipse:function(){var t=arguments,i=C._readEllipse(t),n=i.radius;return e("ellipse",i.center,n.multiply(2),n,t)},_readEllipse:function(e){var t,i;if(r.hasNamed(e,"radius"))t=d.readNamed(e,"center"),i=f.readNamed(e,"radius");else{var n=g.readNamed(e,"rectangle");t=n.getCenter(!0),i=n.getSize(!0).divide(2)}return{center:t,radius:i}}}}}),S=w.extend({_class:"Raster",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!1,handle:!1},_serializeFields:{crossOrigin:null,source:null},_prioritize:["crossOrigin"],_smoothing:"low",beans:!0,initialize:function(e,i){if(!this._initialize(e,i!==t&&d.read(arguments))){var r,s=typeof e,a="string"===s?n.getElementById(e):"object"===s?e:null;if(a&&a!==w.NO_INSERT)if(a.getContext||null!=a.naturalHeight)r=a;else if(a){var o=f.read(arguments);o.isZero()||(r=ie.getCanvas(o))}r?this.setImage(r):this.setSource(e)}this._size||(this._size=new f,this._loaded=!1)},_equals:function(e){return this.getSource()===e.getSource()},copyContent:function(e){var t=e._image,i=e._canvas;if(t)this._setImage(t);else if(i){var n=ie.getCanvas(e._size);n.getContext("2d").drawImage(i,0,0),this._setImage(n)}this._crossOrigin=e._crossOrigin},getSize:function(){var e=this._size;return new m(e?e.width:0,e?e.height:0,this,"setSize")},setSize:function(e,t){var i=f.read(arguments);if(i.equals(this._size))t&&this.clear();else if(i.width>0&&i.height>0){var n=!t&&this.getElement();this._setImage(ie.getCanvas(i)),n&&this.getContext(!0).drawImage(n,0,0,i.width,i.height)}else this._canvas&&ie.release(this._canvas),this._size=i.clone()},getWidth:function(){return this._size?this._size.width:0},setWidth:function(e){this.setSize(e,this.getHeight())},getHeight:function(){return this._size?this._size.height:0},setHeight:function(e){this.setSize(this.getWidth(),e)},getLoaded:function(){return this._loaded},isEmpty:function(){var e=this._size;return!e||0===e.width&&0===e.height},getResolution:function(){var e=this._matrix,t=new d(0,0).transform(e),i=new d(1,0).transform(e).subtract(t),n=new d(0,1).transform(e).subtract(t);return new f(72/i.getLength(),72/n.getLength())},getPpi:"#getResolution",getImage:function(){return this._image},setImage:function(e){var t=this;function i(e){var i=t.getView(),n=e&&e.type||"load";i&&t.responds(n)&&(ae=i._scope,t.emit(n,new $(e)))}this._setImage(e),this._loaded?setTimeout(i,0):e&&U.add(e,{load:function(n){t._setImage(e),i(n)},error:i})},_setImage:function(e){this._canvas&&ie.release(this._canvas),e&&e.getContext?(this._image=null,this._canvas=e,this._loaded=!0):(this._image=e,this._canvas=null,this._loaded=!!(e&&e.src&&e.complete)),this._size=new f(e?e.naturalWidth||e.width:0,e?e.naturalHeight||e.height:0),this._context=null,this._changed(1033)},getCanvas:function(){if(!this._canvas){var e=ie.getContext(this._size);try{this._image&&e.drawImage(this._image,0,0),this._canvas=e.canvas}catch(t){ie.release(e)}}return this._canvas},setCanvas:"#setImage",getContext:function(e){return this._context||(this._context=this.getCanvas().getContext("2d")),e&&(this._image=null,this._changed(1025)),this._context},setContext:function(e){this._context=e},getSource:function(){var e=this._image;return e&&e.src||this.toDataURL()},setSource:function(t){var i=new e.Image,n=this._crossOrigin;n&&(i.crossOrigin=n),t&&(i.src=t),this.setImage(i)},getCrossOrigin:function(){var e=this._image;return e&&e.crossOrigin||this._crossOrigin||""},setCrossOrigin:function(e){this._crossOrigin=e;var t=this._image;t&&(t.crossOrigin=e)},getSmoothing:function(){return this._smoothing},setSmoothing:function(e){this._smoothing="string"==typeof e?e:e?"low":"off",this._changed(257)},getElement:function(){return this._canvas||this._loaded&&this._image}},{beans:!1,getSubCanvas:function(){var e=g.read(arguments),t=ie.getContext(e.getSize());return t.drawImage(this.getCanvas(),e.x,e.y,e.width,e.height,0,0,e.width,e.height),t.canvas},getSubRaster:function(){var e=g.read(arguments),t=new S(w.NO_INSERT);return t._setImage(this.getSubCanvas(e)),t.translate(e.getCenter().subtract(this.getSize().divide(2))),t._matrix.prepend(this._matrix),t.insertAbove(this),t},toDataURL:function(){var e=this._image,t=e&&e.src;if(/^data:/.test(t))return t;var i=this.getCanvas();return i?i.toDataURL.apply(i,arguments):null},drawImage:function(e){var t=d.read(arguments,1);this.getContext(!0).drawImage(e,t.x,t.y)},getAverageColor:function(e){var t,i;if(e?e instanceof L?(i=e,t=e.getBounds()):"object"==typeof e&&("width"in e?t=new g(e):"x"in e&&(t=new g(e.x-.5,e.y-.5,1,1))):t=this.getBounds(),!t)return null;var n=Math.min(t.width,32),s=Math.min(t.height,32),a=S._sampleContext;a?a.clearRect(0,0,33,33):a=S._sampleContext=ie.getContext(new f(32)),a.save();var o=(new b).scale(n/t.width,s/t.height).translate(-t.x,-t.y);o.applyToContext(a),i&&i.draw(a,new r({clip:!0,matrices:[o]})),this._matrix.applyToContext(a);var c=this.getElement(),l=this._size;c&&a.drawImage(c,-l.width/2,-l.height/2),a.restore();for(var h=a.getImageData(.5,.5,Math.ceil(n),Math.ceil(s)).data,u=[0,0,0],d=0,p=0,m=h.length;p<m;p+=4){var v=h[p+3];d+=v,v/=255,u[0]+=h[p]*v,u[1]+=h[p+1]*v,u[2]+=h[p+2]*v}for(p=0;p<3;p++)u[p]/=d;return d?q.read(u):null},getPixel:function(){var e=d.read(arguments),t=this.getContext().getImageData(e.x,e.y,1,1).data;return new q("rgb",[t[0]/255,t[1]/255,t[2]/255],t[3]/255)},setPixel:function(){var e=arguments,t=d.read(e),i=q.read(e),n=i._convert("rgb"),r=i._alpha,s=this.getContext(!0),a=s.createImageData(1,1),o=a.data;o[0]=255*n[0],o[1]=255*n[1],o[2]=255*n[2],o[3]=null!=r?255*r:255,s.putImageData(a,t.x,t.y)},clear:function(){var e=this._size;this.getContext(!0).clearRect(0,0,e.width+1,e.height+1)},createImageData:function(){var e=f.read(arguments);return this.getContext().createImageData(e.width,e.height)},getImageData:function(){var e=g.read(arguments);return e.isEmpty()&&(e=new g(this._size)),this.getContext().getImageData(e.x,e.y,e.width,e.height)},putImageData:function(e){var t=d.read(arguments,1);this.getContext(!0).putImageData(e,t.x,t.y)},setImageData:function(e){this.setSize(e),this.getContext(!0).putImageData(e,0,0)},_getBounds:function(e,t){var i=new g(this._size).setCenter(0,0);return e?e._transformBounds(i):i},_hitTestSelf:function(e){if(this._contains(e)){var t=this;return new T("pixel",t,{offset:e.add(t._size.divide(2)).round(),color:{get:function(){return t.getPixel(this.offset)}}})}},_draw:function(e,t,i){var n=this.getElement();if(n&&n.width>0&&n.height>0){e.globalAlpha=h.clamp(this._opacity,0,1),this._setStyles(e,t,i);var r=this._smoothing,s="off"===r;G.setPrefixed(e,s?"imageSmoothingEnabled":"imageSmoothingQuality",!s&&r),e.drawImage(n,-this._size.width/2,-this._size.height/2)}},_canComposite:function(){return!0}}),M=w.extend({_class:"SymbolItem",_applyMatrix:!1,_canApplyMatrix:!1,_boundsOptions:{stroke:!0},_serializeFields:{symbol:null},initialize:function(e,i){this._initialize(e,i!==t&&d.read(arguments,1))||this.setDefinition(e instanceof E?e:new E(e))},_equals:function(e){return this._definition===e._definition},copyContent:function(e){this.setDefinition(e._definition)},getDefinition:function(){return this._definition},setDefinition:function(e){this._definition=e,this._changed(9)},getSymbol:"#getDefinition",setSymbol:"#setDefinition",isEmpty:function(){return this._definition._item.isEmpty()},_getBounds:function(e,t){var i=this._definition._item;return i._getCachedBounds(i._matrix.prepended(e),t)},_hitTestSelf:function(e,t,i){var n=t.extend({all:!1}),r=this._definition._item._hitTest(e,n,i);return r&&(r.item=this),r},_draw:function(e,t){this._definition._item.draw(e,t)}}),E=r.extend({_class:"SymbolDefinition",initialize:function(e,t){this._id=u.get(),this.project=ae.project,e&&this.setItem(e,t)},_serialize:function(e,t){return t.add(this,(function(){return r.serialize([this._class,this._item],e,!1,t)}))},_changed:function(e){8&e&&w._clearBoundsCache(this),1&e&&this.project._changed(e)},getItem:function(){return this._item},setItem:function(e,t){e._symbol&&(e=e.clone()),this._item&&(this._item._symbol=null),this._item=e,e.remove(),e.setSelected(!1),t||e.setPosition(new d),e._symbol=this,this._changed(9)},getDefinition:"#getItem",setDefinition:"#setItem",place:function(e){return new M(this,e)},clone:function(){return new E(this._item.clone(!1))},equals:function(e){return e===this||e&&this._item.equals(e._item)||!1}}),T=r.extend({_class:"HitResult",initialize:function(e,t,i){this.type=e,this.item=t,i&&this.inject(i)},statics:{getOptions:function(e){var t=e&&r.read(e);return new r({type:null,tolerance:ae.settings.hitTolerance,fill:!t,stroke:!t,segments:!t,handles:!1,ends:!1,position:!1,center:!1,bounds:!1,guides:!1,selected:!1},t)}}}),P=r.extend({_class:"Segment",beans:!0,_selection:0,initialize:function(e,i,n,r,s,a){var o,c,l,h,u=arguments.length;u>0&&(null==e||"object"==typeof e?1===u&&e&&"point"in e?(o=e.point,c=e.handleIn,l=e.handleOut,h=e.selection):(o=e,c=i,l=n,h=r):(o=[e,i],c=n!==t?[n,r]:null,l=s!==t?[s,a]:null)),new A(o,this,"_point"),new A(c,this,"_handleIn"),new A(l,this,"_handleOut"),h&&this.setSelection(h)},_serialize:function(e,t){var i=this._point,n=this._selection,s=n||this.hasHandles()?[i,this._handleIn,this._handleOut]:i;return n&&s.push(n),r.serialize(s,e,!0,t)},_changed:function(e){var t=this._path;if(t){var i,n=t._curves,r=this._index;n&&(e&&e!==this._point&&e!==this._handleIn||!(i=r>0?n[r-1]:t._closed?n[n.length-1]:null)||i._changed(),e&&e!==this._point&&e!==this._handleOut||!(i=n[r])||i._changed()),t._changed(41)}},getPoint:function(){return this._point},setPoint:function(){this._point.set(d.read(arguments))},getHandleIn:function(){return this._handleIn},setHandleIn:function(){this._handleIn.set(d.read(arguments))},getHandleOut:function(){return this._handleOut},setHandleOut:function(){this._handleOut.set(d.read(arguments))},hasHandles:function(){return!this._handleIn.isZero()||!this._handleOut.isZero()},isSmooth:function(){var e=this._handleIn,t=this._handleOut;return!e.isZero()&&!t.isZero()&&e.isCollinear(t)},clearHandles:function(){this._handleIn._set(0,0),this._handleOut._set(0,0)},getSelection:function(){return this._selection},setSelection:function(e){var t=this._selection,i=this._path;this._selection=e=e||0,i&&e!==t&&(i._updateSelection(this,t,e),i._changed(257))},_changeSelection:function(e,t){var i=this._selection;this.setSelection(t?i|e:i&~e)},isSelected:function(){return!!(7&this._selection)},setSelected:function(e){this._changeSelection(7,e)},getIndex:function(){return this._index!==t?this._index:null},getPath:function(){return this._path||null},getCurve:function(){var e=this._path,t=this._index;return e?(t>0&&!e._closed&&t===e._segments.length-1&&t--,e.getCurves()[t]||null):null},getLocation:function(){var e=this.getCurve();return e?new N(e,this===e._segment1?0:1):null},getNext:function(){var e=this._path&&this._path._segments;return e&&(e[this._index+1]||this._path._closed&&e[0])||null},smooth:function(e,i,n){var r=e||{},s=r.type,a=r.factor,o=this.getPrevious(),c=this.getNext(),l=(o||this)._point,h=this._point,u=(c||this)._point,p=l.getDistance(h),f=h.getDistance(u);if(s&&"catmull-rom"!==s){if("geometric"!==s)throw new Error("Smoothing method '"+s+"' not supported.");if(o&&c){var m=l.subtract(u),g=a===t?.4:a,v=g*p/(p+f);i||this.setHandleIn(m.multiply(v)),n||this.setHandleOut(m.multiply(v-g))}}else{var b=a===t?.5:a,y=Math.pow(p,b),_=y*y,w=Math.pow(f,b),x=w*w;if(!i&&o){var k=2*x+3*w*y+_,C=3*w*(w+y);this.setHandleIn(0!==C?new d((x*l._x+k*h._x-_*u._x)/C-h._x,(x*l._y+k*h._y-_*u._y)/C-h._y):new d)}!n&&c&&(k=2*_+3*y*w+x,C=3*y*(y+w),this.setHandleOut(0!==C?new d((_*u._x+k*h._x-x*l._x)/C-h._x,(_*u._y+k*h._y-x*l._y)/C-h._y):new d))}},getPrevious:function(){var e=this._path&&this._path._segments;return e&&(e[this._index-1]||this._path._closed&&e[e.length-1])||null},isFirst:function(){return!this._index},isLast:function(){var e=this._path;return e&&this._index===e._segments.length-1||!1},reverse:function(){var e=this._handleIn,t=this._handleOut,i=e.clone();e.set(t),t.set(i)},reversed:function(){return new P(this._point,this._handleOut,this._handleIn)},remove:function(){return!!this._path&&!!this._path.removeSegment(this._index)},clone:function(){return new P(this._point,this._handleIn,this._handleOut)},equals:function(e){return e===this||e&&this._class===e._class&&this._point.equals(e._point)&&this._handleIn.equals(e._handleIn)&&this._handleOut.equals(e._handleOut)||!1},toString:function(){var e=["point: "+this._point];return this._handleIn.isZero()||e.push("handleIn: "+this._handleIn),this._handleOut.isZero()||e.push("handleOut: "+this._handleOut),"{ "+e.join(", ")+" }"},transform:function(e){this._transformCoordinates(e,new Array(6),!0),this._changed()},interpolate:function(e,t,i){var n=1-i,r=i,s=e._point,a=t._point,o=e._handleIn,c=t._handleIn,l=t._handleOut,h=e._handleOut;this._point._set(n*s._x+r*a._x,n*s._y+r*a._y,!0),this._handleIn._set(n*o._x+r*c._x,n*o._y+r*c._y,!0),this._handleOut._set(n*h._x+r*l._x,n*h._y+r*l._y,!0),this._changed()},_transformCoordinates:function(e,t,i){var n=this._point,r=i&&this._handleIn.isZero()?null:this._handleIn,s=i&&this._handleOut.isZero()?null:this._handleOut,a=n._x,o=n._y,c=2;return t[0]=a,t[1]=o,r&&(t[c++]=r._x+a,t[c++]=r._y+o),s&&(t[c++]=s._x+a,t[c++]=s._y+o),e&&(e._transformCoordinates(t,t,c/2),a=t[0],o=t[1],i?(n._x=a,n._y=o,c=2,r&&(r._x=t[c++]-a,r._y=t[c++]-o),s&&(s._x=t[c++]-a,s._y=t[c++]-o)):(r||(t[c++]=a,t[c++]=o),s||(t[c++]=a,t[c++]=o))),t}}),A=d.extend({initialize:function(e,i,n){var r,s,a;if(e)if((r=e[0])!==t)s=e[1];else{var o=e;(r=o.x)===t&&(r=(o=d.read(arguments)).x),s=o.y,a=o.selected}else r=s=0;this._x=r,this._y=s,this._owner=i,i[n]=this,a&&this.setSelected(!0)},_set:function(e,t){return this._x=e,this._y=t,this._owner._changed(this),this},getX:function(){return this._x},setX:function(e){this._x=e,this._owner._changed(this)},getY:function(){return this._y},setY:function(e){this._y=e,this._owner._changed(this)},isZero:function(){var e=h.isZero;return e(this._x)&&e(this._y)},isSelected:function(){return!!(this._owner._selection&this._getSelection())},setSelected:function(e){this._owner._changeSelection(this._getSelection(),e)},_getSelection:function(){var e=this._owner;return this===e._point?1:this===e._handleIn?2:this===e._handleOut?4:0}}),I=r.extend({_class:"Curve",beans:!0,initialize:function(e,t,i,n,r,s,a,o){var c,l,h,u,d,p,f=arguments.length;3===f?(this._path=e,c=t,l=i):f?1===f?"segment1"in e?(c=new P(e.segment1),l=new P(e.segment2)):"point1"in e?(h=e.point1,d=e.handle1,p=e.handle2,u=e.point2):Array.isArray(e)&&(h=[e[0],e[1]],u=[e[6],e[7]],d=[e[2]-e[0],e[3]-e[1]],p=[e[4]-e[6],e[5]-e[7]]):2===f?(c=new P(e),l=new P(t)):4===f?(h=e,d=t,p=i,u=n):8===f&&(h=[e,t],u=[a,o],d=[i-e,n-t],p=[r-a,s-o]):(c=new P,l=new P),this._segment1=c||new P(h,null,d),this._segment2=l||new P(u,p,null)},_serialize:function(e,t){return r.serialize(this.hasHandles()?[this.getPoint1(),this.getHandle1(),this.getHandle2(),this.getPoint2()]:[this.getPoint1(),this.getPoint2()],e,!0,t)},_changed:function(){this._length=this._bounds=t},clone:function(){return new I(this._segment1,this._segment2)},toString:function(){var e=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||e.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||e.push("handle2: "+this._segment2._handleIn),e.push("point2: "+this._segment2._point),"{ "+e.join(", ")+" }"},classify:function(){return I.classify(this.getValues())},remove:function(){var e=!1;if(this._path){var t=this._segment2,i=t._handleOut;(e=t.remove())&&this._segment1._handleOut.set(i)}return e},getPoint1:function(){return this._segment1._point},setPoint1:function(){this._segment1._point.set(d.read(arguments))},getPoint2:function(){return this._segment2._point},setPoint2:function(){this._segment2._point.set(d.read(arguments))},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(){this._segment1._handleOut.set(d.read(arguments))},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(){this._segment2._handleIn.set(d.read(arguments))},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var e=this._path&&this._path._curves;return e&&(e[this._segment1._index+1]||this._path._closed&&e[0])||null},getPrevious:function(){var e=this._path&&this._path._curves;return e&&(e[this._segment1._index-1]||this._path._closed&&e[e.length-1])||null},isFirst:function(){return!this._segment1._index},isLast:function(){var e=this._path;return e&&this._segment1._index===e._curves.length-1||!1},isSelected:function(){return this.getPoint1().isSelected()&&this.getHandle1().isSelected()&&this.getHandle2().isSelected()&&this.getPoint2().isSelected()},setSelected:function(e){this.getPoint1().setSelected(e),this.getHandle1().setSelected(e),this.getHandle2().setSelected(e),this.getPoint2().setSelected(e)},getValues:function(e){return I.getValues(this._segment1,this._segment2,e)},getPoints:function(){for(var e=this.getValues(),t=[],i=0;i<8;i+=2)t.push(new d(e[i],e[i+1]));return t}},{getLength:function(){return null==this._length&&(this._length=I.getLength(this.getValues(),0,1)),this._length},getArea:function(){return I.getArea(this.getValues())},getLine:function(){return new y(this._segment1._point,this._segment2._point)},getPart:function(e,t){return new I(I.getPart(this.getValues(),e,t))},getPartLength:function(e,t){return I.getLength(this.getValues(),e,t)},divideAt:function(e){return this.divideAtTime(e&&e.curve===this?e.time:this.getTimeAt(e))},divideAtTime:function(e,t){var i=null;if(e>=1e-8&&e<=.99999999){var n=I.subdivide(this.getValues(),e),r=n[0],s=n[1],a=t||this.hasHandles(),o=this._segment1,c=this._segment2,l=this._path;a&&(o._handleOut._set(r[2]-r[0],r[3]-r[1]),c._handleIn._set(s[4]-s[6],s[5]-s[7]));var h=r[6],u=r[7],p=new P(new d(h,u),a&&new d(r[4]-h,r[5]-u),a&&new d(s[2]-h,s[3]-u));l?(l.insert(o._index+1,p),i=this.getNext()):(this._segment2=p,this._changed(),i=new I(p,c))}return i},splitAt:function(e){var t=this._path;return t?t.splitAt(e):null},splitAtTime:function(e){return this.splitAt(this.getLocationAtTime(e))},divide:function(e,i){return this.divideAtTime(e===t?.5:i?e:this.getTimeAt(e))},split:function(e,i){return this.splitAtTime(e===t?.5:i?e:this.getTimeAt(e))},reversed:function(){return new I(this._segment2.reversed(),this._segment1.reversed())},clearHandles:function(){this._segment1._handleOut._set(0,0),this._segment2._handleIn._set(0,0)},statics:{getValues:function(e,t,i,n){var r=e._point,s=e._handleOut,a=t._handleIn,o=t._point,c=r.x,l=r.y,h=o.x,u=o.y,d=n?[c,l,c,l,h,u,h,u]:[c,l,c+s._x,l+s._y,h+a._x,u+a._y,h,u];return i&&i._transformCoordinates(d,d,4),d},subdivide:function(e,i){var n=e[0],r=e[1],s=e[2],a=e[3],o=e[4],c=e[5],l=e[6],h=e[7];i===t&&(i=.5);var u=1-i,d=u*n+i*s,p=u*r+i*a,f=u*s+i*o,m=u*a+i*c,g=u*o+i*l,v=u*c+i*h,b=u*d+i*f,y=u*p+i*m,_=u*f+i*g,w=u*m+i*v,x=u*b+i*_,k=u*y+i*w;return[[n,r,d,p,b,y,x,k],[x,k,_,w,g,v,l,h]]},getMonoCurves:function(e,t){var i=[],n=t?0:1,r=e[n+0],s=e[n+2],a=e[n+4],o=e[n+6];if(r>=s==s>=a&&s>=a==a>=o||I.isStraight(e))i.push(e);else{var c=3*(s-a)-r+o,l=2*(r+a)-4*s,u=s-r,d=[],p=h.solveQuadratic(c,l,u,d,1e-8,.99999999);if(p){d.sort();var f=d[0],m=I.subdivide(e,f);i.push(m[0]),p>1&&(f=(d[1]-f)/(1-f),m=I.subdivide(m[1],f),i.push(m[0])),i.push(m[1])}else i.push(e)}return i},solveCubic:function(e,t,i,n,r,s){var a=e[t],o=e[t+2],c=e[t+4],l=e[t+6],u=0;if(!(a<i&&l<i&&o<i&&c<i||a>i&&l>i&&o>i&&c>i)){var d=3*(o-a),p=3*(c-o)-d,f=l-a-d-p;u=h.solveCubic(f,p,d,a-i,n,r,s)}return u},getTimeOf:function(e,t){var i=new d(e[0],e[1]),n=new d(e[6],e[7]),r=1e-7;if(null===(t.isClose(i,1e-12)?0:t.isClose(n,1e-12)?1:null))for(var s=[t.x,t.y],a=[],o=0;o<2;o++)for(var c=I.solveCubic(e,o,s[o],a,0,1),l=0;l<c;l++){var h=a[l];if(t.isClose(I.getPoint(e,h),r))return h}return t.isClose(i,r)?0:t.isClose(n,r)?1:null},getNearestTime:function(e,t){if(I.isStraight(e)){var i=e[0],n=e[1],r=e[6]-i,s=e[7]-n,a=r*r+s*s;if(0===a)return 0;var o=((t.x-i)*r+(t.y-n)*s)/a;return o<1e-12?0:o>.999999999999?1:I.getTimeOf(e,new d(i+o*r,n+o*s))}var c=1/0,l=0;function h(i){if(i>=0&&i<=1){var n=t.getDistance(I.getPoint(e,i),!0);if(n<c)return c=n,l=i,!0}}for(var u=0;u<=100;u++)h(u/100);for(var p=.005;p>1e-8;)h(l-p)||h(l+p)||(p/=2);return l},getPart:function(e,t,i){var n=t>i;if(n){var r=t;t=i,i=r}return t>0&&(e=I.subdivide(e,t)[1]),i<1&&(e=I.subdivide(e,(i-t)/(1-t))[0]),n?[e[6],e[7],e[4],e[5],e[2],e[3],e[0],e[1]]:e},isFlatEnough:function(e,t){var i=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=3*r-2*i-c,u=3*s-2*n-l,d=3*a-2*c-i,p=3*o-2*l-n;return Math.max(h*h,d*d)+Math.max(u*u,p*p)<=16*t*t},getArea:function(e){var t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7];return 3*((c-i)*(n+s)-(o-t)*(r+a)+r*(t-s)-n*(i-a)+c*(s+t/3)-o*(a+i/3))/20},getBounds:function(e){for(var t=e.slice(0,2),i=t.slice(),n=[0,0],r=0;r<2;r++)I._addBounds(e[r],e[r+2],e[r+4],e[r+6],r,0,t,i,n);return new g(t[0],t[1],i[0]-t[0],i[1]-t[1])},_addBounds:function(e,t,i,n,r,s,a,o,c){function l(e,t){var i=e-t,n=e+t;i<a[r]&&(a[r]=i),n>o[r]&&(o[r]=n)}s/=2;var u=a[r]+s,d=o[r]-s;if(e<u||t<u||i<u||n<u||e>d||t>d||i>d||n>d)if(t<e!=t<n&&i<e!=i<n)l(e,0),l(n,0);else{var p=3*(t-i)-e+n,f=2*(e+i)-4*t,m=t-e,g=h.solveQuadratic(p,f,m,c);l(n,0);for(var v=0;v<g;v++){var b=c[v],y=1-b;1e-8<=b&&b<=.99999999&&l(y*y*y*e+3*y*y*b*t+3*y*b*b*i+b*b*b*n,s)}}}}},r.each(["getBounds","getStrokeBounds","getHandleBounds"],(function(e){this[e]=function(){this._bounds||(this._bounds={});var t=this._bounds[e];return t||(t=this._bounds[e]=O[e]([this._segment1,this._segment2],!1,this._path)),t.clone()}}),{}),r.each({isStraight:function(e,t,i,n){if(t.isZero()&&i.isZero())return!0;var r=n.subtract(e);if(r.isZero())return!1;if(r.isCollinear(t)&&r.isCollinear(i)){var s=new y(e,n);if(s.getDistance(e.add(t))<1e-7&&s.getDistance(n.add(i))<1e-7){var a=r.dot(r),o=r.dot(t)/a,c=r.dot(i)/a;return o>=0&&o<=1&&c<=0&&c>=-1}}return!1},isLinear:function(e,t,i,n){var r=n.subtract(e).divide(3);return t.equals(r)&&i.negate().equals(r)}},(function(e,t){this[t]=function(t){var i=this._segment1,n=this._segment2;return e(i._point,i._handleOut,n._handleIn,n._point,t)},this.statics[t]=function(t,i){var n=t[0],r=t[1],s=t[6],a=t[7];return e(new d(n,r),new d(t[2]-n,t[3]-r),new d(t[4]-s,t[5]-a),new d(s,a),i)}}),{statics:{},hasHandles:function(){return!this._segment1._handleOut.isZero()||!this._segment2._handleIn.isZero()},hasLength:function(e){return(!this.getPoint1().equals(this.getPoint2())||this.hasHandles())&&this.getLength()>(e||0)},isCollinear:function(e){return e&&this.isStraight()&&e.isStraight()&&this.getLine().isCollinear(e.getLine())},isHorizontal:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).y)<1e-8},isVertical:function(){return this.isStraight()&&Math.abs(this.getTangentAtTime(.5).x)<1e-8}}),{beans:!1,getLocationAt:function(e,t){return this.getLocationAtTime(t?e:this.getTimeAt(e))},getLocationAtTime:function(e){return null!=e&&e>=0&&e<=1?new N(this,e):null},getTimeAt:function(e,t){return I.getTimeAt(this.getValues(),e,t)},getParameterAt:"#getTimeAt",getTimesWithTangent:function(){var e=d.read(arguments);return e.isZero()?[]:I.getTimesWithTangent(this.getValues(),e)},getOffsetAtTime:function(e){return this.getPartLength(0,e)},getLocationOf:function(){return this.getLocationAtTime(this.getTimeOf(d.read(arguments)))},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getTimeOf:function(){return I.getTimeOf(this.getValues(),d.read(arguments))},getParameterOf:"#getTimeOf",getNearestLocation:function(){var e=d.read(arguments),t=this.getValues(),i=I.getNearestTime(t,e),n=I.getPoint(t,i);return new N(this,i,n,null,e.getDistance(n))},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e}},new function(){var e=["getPoint","getTangent","getNormal","getWeightedTangent","getWeightedNormal","getCurvature"];return r.each(e,(function(e){this[e+"At"]=function(t,i){var n=this.getValues();return I[e](n,i?t:I.getTimeAt(n,t))},this[e+"AtTime"]=function(t){return I[e](this.getValues(),t)}}),{statics:{_evaluateMethods:e}})},new function(){function e(e){var t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=9*(n-s)+3*(o-t),h=6*(t+s)-12*n,u=3*(n-t),d=9*(r-a)+3*(c-i),p=6*(i+a)-12*r,f=3*(r-i);return function(e){var t=(l*e+h)*e+u,i=(d*e+p)*e+f;return Math.sqrt(t*t+i*i)}}function i(e,t){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(t-e))))}function n(e,t,i,n){if(null==t||t<0||t>1)return null;var r=e[0],s=e[1],a=e[2],o=e[3],c=e[4],l=e[5],u=e[6],p=e[7],f=h.isZero;f(a-r)&&f(o-s)&&(a=r,o=s),f(c-u)&&f(l-p)&&(c=u,l=p);var m,g,v=3*(a-r),b=3*(c-a)-v,y=u-r-v-b,_=3*(o-s),w=3*(l-o)-_,x=p-s-_-w;if(0===i)m=0===t?r:1===t?u:((y*t+b)*t+v)*t+r,g=0===t?s:1===t?p:((x*t+w)*t+_)*t+s;else{var k=1e-8,C=1-k;if(t<k?(m=v,g=_):t>C?(m=3*(u-c),g=3*(p-l)):(m=(3*y*t+2*b)*t+v,g=(3*x*t+2*w)*t+_),n){0===m&&0===g&&(t<k||t>C)&&(m=c-a,g=l-o);var S=Math.sqrt(m*m+g*g);S&&(m/=S,g/=S)}if(3===i){c=6*y*t+2*b,l=6*x*t+2*w;var M=Math.pow(m*m+g*g,1.5);m=0!==M?(m*l-g*c)/M:0,g=0}}return 2===i?new d(g,-m):new d(m,g)}return{statics:{classify:function(e){var i=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=r*(n-l)+s*(c-i)+i*l-n*c,d=3*(a*(s-n)+o*(i-r)+r*n-s*i),p=d-u,f=p-u+(i*(l-o)+n*(a-c)+c*o-l*a),m=Math.sqrt(f*f+p*p+d*d),g=0!==m?1/m:0,v=h.isZero,b="serpentine";function y(e,i,n){var r=i!==t,s=r&&i>0&&i<1,a=r&&n>0&&n<1;return!r||(s||a)&&("loop"!==e||s&&a)||(e="arch",s=a=!1),{type:e,roots:s||a?s&&a?i<n?[i,n]:[n,i]:[s?i:n]:null}}if(p*=g,d*=g,v(f*=g))return v(p)?y(v(d)?"line":"quadratic"):y(b,d/(3*p));var _=3*p*p-4*f*d;if(v(_))return y("cusp",p/(2*f));var w=_>0?Math.sqrt(_/3):Math.sqrt(-_),x=2*f;return y(_>0?b:"loop",(p+w)/x,(p-w)/x)},getLength:function(n,r,s,a){if(r===t&&(r=0),s===t&&(s=1),I.isStraight(n)){var o=n;s<1&&(o=I.subdivide(o,s)[0],r/=s),r>0&&(o=I.subdivide(o,r)[1]);var c=o[6]-o[0],l=o[7]-o[1];return Math.sqrt(c*c+l*l)}return h.integrate(a||e(n),r,s,i(r,s))},getTimeAt:function(n,r,s){if(s===t&&(s=r<0?1:0),0===r)return s;var a=Math.abs,o=r>0,c=o?s:0,l=o?1:s,u=e(n),d=I.getLength(n,c,l,u),p=a(r)-d;if(a(p)<1e-12)return o?l:c;if(p>1e-12)return null;var f=r/d,m=0;return h.findRoot((function(e){return m+=h.integrate(u,s,e,i(s,e)),s=e,m-r}),u,s+f,c,l,32,1e-12)},getPoint:function(e,t){return n(e,t,0,!1)},getTangent:function(e,t){return n(e,t,1,!0)},getWeightedTangent:function(e,t){return n(e,t,1,!1)},getNormal:function(e,t){return n(e,t,2,!0)},getWeightedNormal:function(e,t){return n(e,t,2,!1)},getCurvature:function(e,t){return n(e,t,3,!1).x},getPeaks:function(e){var t=e[0],i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=3*n-t-3*s+e[6],c=3*t-6*n+3*s,l=-3*t+3*n,u=3*r-i-3*a+e[7],d=3*i-6*r+3*a,p=-3*i+3*r,f=[];return h.solveCubic(9*(o*o+u*u),9*(o*c+d*u),2*(c*c+d*d)+3*(l*o+p*u),l*c+d*p,f,1e-8,.99999999),f.sort()}}}},new function(){function e(e,t,i,n,r,s,a){var o=!a&&i.getPrevious()===r,c=!a&&i!==r&&i.getNext()===r,l=1e-8,h=1-l;if(null!==n&&n>=(o?l:0)&&n<=(c?h:1)&&null!==s&&s>=(c?l:0)&&s<=(o?h:1)){var u=new N(i,n,null,a),d=new N(r,s,null,a);u._intersection=d,d._intersection=u,t&&!t(u)||N.insert(e,u,!0)}}function t(n,r,s,a,o,c,l,h,u,d,p,f,m){if(++u>=4096||++h>=40)return u;var g,v,b=r[0],_=r[1],w=r[6],x=r[7],k=y.getSignedDistance,C=k(b,_,w,x,r[2],r[3]),S=k(b,_,w,x,r[4],r[5]),M=C*S>0?3/4:4/9,E=M*Math.min(0,C,S),T=M*Math.max(0,C,S),P=k(b,_,w,x,n[0],n[1]),A=k(b,_,w,x,n[2],n[3]),N=k(b,_,w,x,n[4],n[5]),L=k(b,_,w,x,n[6],n[7]),O=function(e,t,i,n){var r,s=[0,e],a=[1/3,t],o=[2/3,i],c=[1,n],l=t-(2*e+n)/3,h=i-(e+2*n)/3;if(l*h<0)r=[[s,a,c],[s,o,c]];else{var u=l/h;r=[u>=2?[s,a,c]:u<=.5?[s,o,c]:[s,a,o,c],[s,c]]}return(l||h)<0?r.reverse():r}(P,A,N,L),B=O[0],D=O[1];if(0===C&&0===S&&0===P&&0===A&&0===N&&0===L||null==(g=i(B,D,E,T))||null==(v=i(B.reverse(),D.reverse(),E,T)))return u;var R=d+(p-d)*g,z=d+(p-d)*v;if(Math.max(m-f,z-R)<1e-9){var V=(R+z)/2,q=(f+m)/2;e(o,c,l?a:s,l?q:V,l?s:a,l?V:q)}else{n=I.getPart(n,g,v);var F=m-f;if(v-g>.8)if(z-R>F)V=(R+z)/2,u=t(r,(j=I.subdivide(n,.5))[0],a,s,o,c,!l,h,u,f,m,R,V),u=t(r,j[1],a,s,o,c,!l,h,u,f,m,V,z);else{var j;q=(f+m)/2,u=t((j=I.subdivide(r,.5))[0],n,a,s,o,c,!l,h,u,f,q,R,z),u=t(j[1],n,a,s,o,c,!l,h,u,q,m,R,z)}else u=0===F||F>=1e-9?t(r,n,a,s,o,c,!l,h,u,f,m,R,z):t(n,r,s,a,o,c,l,h,u,R,z,f,m)}return u}function i(e,t,i,r){return e[0][1]<i?n(e,!0,i):t[0][1]>r?n(t,!1,r):e[0][0]}function n(e,t,i){for(var n=e[0][0],r=e[0][1],s=1,a=e.length;s<a;s++){var o=e[s][0],c=e[s][1];if(t?c>=i:c<=i)return c===i?o:n+(i-r)*(o-n)/(c-r);n=o,r=c}return null}function r(e,t,i,n,r){var s=h.isZero;if(s(n)&&s(r)){var a=I.getTimeOf(e,new d(t,i));return null===a?[]:[a]}for(var o=Math.atan2(-r,n),c=Math.sin(o),l=Math.cos(o),u=[],p=[],f=0;f<8;f+=2){var m=e[f]-t,g=e[f+1]-i;u.push(m*l-g*c,m*c+g*l)}return I.solveCubic(u,1,0,p,0,1),p}function s(t,i,n,s,a,o,c){for(var l=i[0],h=i[1],u=r(t,l,h,i[6]-l,i[7]-h),d=0,p=u.length;d<p;d++){var f=u[d],m=I.getPoint(t,f),g=I.getTimeOf(i,m);null!==g&&e(a,o,c?s:n,c?g:f,c?n:s,c?f:g)}}function a(t,i,n,r,s,a){var o=y.intersect(t[0],t[1],t[6],t[7],i[0],i[1],i[6],i[7]);o&&e(s,a,n,I.getTimeOf(t,o),r,I.getTimeOf(i,o))}function o(i,n,r,o,c,l){var h=1e-12,p=Math.min,f=Math.max;if(f(i[0],i[2],i[4],i[6])+h>p(n[0],n[2],n[4],n[6])&&p(i[0],i[2],i[4],i[6])-h<f(n[0],n[2],n[4],n[6])&&f(i[1],i[3],i[5],i[7])+h>p(n[1],n[3],n[5],n[7])&&p(i[1],i[3],i[5],i[7])-h<f(n[1],n[3],n[5],n[7])){var m=u(i,n);if(m)for(var g=0;g<2;g++){var v=m[g];e(c,l,r,v[0],o,v[1],!0)}else{var b=I.isStraight(i),y=I.isStraight(n),_=b&&y,w=b&&!y,x=c.length;if((_?a:b||y?s:t)(w?n:i,w?i:n,w?o:r,w?r:o,c,l,w,0,0,0,1,0,1),!_||c.length===x)for(g=0;g<4;g++){var k=g>>1,C=1&g,S=6*k,M=6*C,E=new d(i[S],i[S+1]),T=new d(n[M],n[M+1]);E.isClose(T,h)&&e(c,l,r,k,o,C)}}}return c}function l(t,i,n,r){var s=I.classify(t);if("loop"===s.type){var a=s.roots;e(n,r,i,a[0],i,a[1])}return n}function u(e,t){function i(e){var t=e[6]-e[0],i=e[7]-e[1];return t*t+i*i}var n=Math.abs,r=y.getDistance,s=1e-7,a=I.isStraight(e),o=I.isStraight(t),c=a&&o,l=i(e)<i(t),h=l?t:e,u=l?e:t,p=h[0],f=h[1],m=h[6]-p,g=h[7]-f;if(r(p,f,m,g,u[0],u[1],!0)<s&&r(p,f,m,g,u[6],u[7],!0)<s)!c&&r(p,f,m,g,h[2],h[3],!0)<s&&r(p,f,m,g,h[4],h[5],!0)<s&&r(p,f,m,g,u[2],u[3],!0)<s&&r(p,f,m,g,u[4],u[5],!0)<s&&(a=o=c=!0);else if(c)return null;if(a^o)return null;for(var v=[e,t],b=[],_=0;_<4&&b.length<2;_++){var w=1&_,x=1^w,k=_>>1,C=I.getTimeOf(v[w],new d(v[x][k?6:0],v[x][k?7:1]));if(null!=C){var S=w?[k,C]:[C,k];(!b.length||n(S[0]-b[0][0])>1e-8&&n(S[1]-b[0][1])>1e-8)&&b.push(S)}if(_>2&&!b.length)break}if(2!==b.length)b=null;else if(!c){var M=I.getPart(e,b[0][0],b[1][0]),E=I.getPart(t,b[0][1],b[1][1]);(n(E[2]-M[2])>s||n(E[3]-M[3])>s||n(E[4]-M[4])>s||n(E[5]-M[5])>s)&&(b=null)}return b}return{getIntersections:function(e){var t=this.getValues(),i=e&&e!==this&&e.getValues();return i?o(t,i,this,e,[]):l(t,this,[])},statics:{getOverlaps:u,getIntersections:function(e,t,i,n,r,s){var a=!t;a&&(t=e);for(var h=e.length,u=t.length,d=new Array(h),p=a?d:new Array(u),f=[],m=0;m<h;m++)d[m]=e[m].getValues(n);if(!a)for(m=0;m<u;m++)p[m]=t[m].getValues(r);for(var g=c.findCurveBoundsCollisions(d,p,1e-7),v=0;v<h;v++){var b=e[v],y=d[v];a&&l(y,b,f,i);var _=g[v];if(_)for(var w=0;w<_.length;w++){if(s&&f.length)return f;var x=_[w];if(!a||x>v){var k=t[x];o(y,p[x],b,k,f,i)}}}return f},getCurveLineIntersections:r,getTimesWithTangent:function(e,t){var i=e[0],n=e[1],r=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],u=t.normalize(),d=u.x,p=u.y,f=3*c-9*a+9*r-3*i,m=3*l-9*o+9*s-3*n,g=6*a-12*r+6*i,v=6*o-12*s+6*n,b=3*r-3*i,y=3*s-3*n,_=2*f*p-2*m*d,w=[];if(Math.abs(_)<h.CURVETIME_EPSILON){if(0!=(_=f*v-m*g)){var x=-(f*y-m*b)/_;x>=0&&x<=1&&w.push(x)}}else{var k=(g*g-4*f*b)*p*p+(-2*g*v+4*m*b+4*f*y)*d*p+(v*v-4*m*y)*d*d,C=g*p-v*d;if(k>=0&&0!=_){var S=Math.sqrt(k),M=-(C+S)/_,E=(-C+S)/_;M>=0&&M<=1&&w.push(M),E>=0&&E<=1&&w.push(E)}}return w}}}}),N=r.extend({_class:"CurveLocation",initialize:function(e,t,i,n,r){if(t>=.99999999){var s=e.getNext();s&&(t=0,e=s)}this._setCurve(e),this._time=t,this._point=i||e.getPointAtTime(t),this._overlap=n,this._distance=r,this._intersection=this._next=this._previous=null},_setPath:function(e){this._path=e,this._version=e?e._version:0},_setCurve:function(e){this._setPath(e._path),this._curve=e,this._segment=null,this._segment1=e._segment1,this._segment2=e._segment2},_setSegment:function(e){var t=e.getCurve();t?this._setCurve(t):(this._setPath(e._path),this._segment1=e,this._segment2=null),this._segment=e,this._time=e===this._segment1?0:1,this._point=e._point.clone()},getSegment:function(){var e=this._segment;if(!e){var t=this.getCurve(),i=this.getTime();0===i?e=t._segment1:1===i?e=t._segment2:null!=i&&(e=t.getPartLength(0,i)<t.getPartLength(i,1)?t._segment1:t._segment2),this._segment=e}return e},getCurve:function(){var e=this._path,t=this;function i(e){var i=e&&e.getCurve();if(i&&null!=(t._time=i.getTimeOf(t._point)))return t._setCurve(i),i}return e&&e._version!==this._version&&(this._time=this._offset=this._curveOffset=this._curve=null),this._curve||i(this._segment)||i(this._segment1)||i(this._segment2.getPrevious())},getPath:function(){var e=this.getCurve();return e&&e._path},getIndex:function(){var e=this.getCurve();return e&&e.getIndex()},getTime:function(){var e=this.getCurve(),t=this._time;return e&&null==t?this._time=e.getTimeOf(this._point):t},getParameter:"#getTime",getPoint:function(){return this._point},getOffset:function(){var e=this._offset;if(null==e){e=0;var t=this.getPath(),i=this.getIndex();if(t&&null!=i)for(var n=t.getCurves(),r=0;r<i;r++)e+=n[r].getLength();this._offset=e+=this.getCurveOffset()}return e},getCurveOffset:function(){var e=this._curveOffset;if(null==e){var t=this.getCurve(),i=this.getTime();this._curveOffset=e=null!=i&&t&&t.getPartLength(0,i)}return e},getIntersection:function(){return this._intersection},getDistance:function(){return this._distance},divide:function(){var e=this.getCurve(),t=e&&e.divideAtTime(this.getTime());return t&&this._setSegment(t._segment1),t},split:function(){var e=this.getCurve(),t=e._path,i=e&&e.splitAtTime(this.getTime());return i&&this._setSegment(t.getLastSegment()),i},equals:function(e,t){var i=this===e;if(!i&&e instanceof N){var n=this.getCurve(),r=e.getCurve(),s=n._path;if(s===r._path){var a=Math.abs,o=a(this.getOffset()-e.getOffset()),c=!t&&this._intersection,l=!t&&e._intersection;i=(o<1e-7||s&&a(s.getLength()-o)<1e-7)&&(!c&&!l||c&&l&&c.equals(l,!0))}}return i},toString:function(){var e=[],t=this.getPoint(),i=l.instance;t&&e.push("point: "+t);var n=this.getIndex();null!=n&&e.push("index: "+n);var r=this.getTime();return null!=r&&e.push("time: "+i.number(r)),null!=this._distance&&e.push("distance: "+i.number(this._distance)),"{ "+e.join(", ")+" }"},isTouching:function(){var e=this._intersection;if(e&&this.getTangent().isCollinear(e.getTangent())){var t=this.getCurve(),i=e.getCurve();return!(t.isStraight()&&i.isStraight()&&t.getLine().intersect(i.getLine()))}return!1},isCrossing:function(){var e=this._intersection;if(!e)return!1;var t=this.getTime(),i=e.getTime(),n=1e-8,r=1-n,s=t>=n&&t<=r,a=i>=n&&i<=r;if(s&&a)return!this.isTouching();var o=this.getCurve(),c=o&&t<n?o.getPrevious():o,l=e.getCurve(),h=l&&i<n?l.getPrevious():l;if(t>r&&(o=o.getNext()),i>r&&(l=l.getNext()),!(c&&o&&h&&l))return!1;var u=[];function d(e,t){var i=e.getValues(),n=I.classify(i).roots||I.getPeaks(i),r=n.length,s=I.getLength(i,t&&r?n[r-1]:0,!t&&r?n[0]:1);u.push(r?s:s/32)}function p(e,t,i){return t<i?e>t&&e<i:e>t||e<i}s||(d(c,!0),d(o,!1)),a||(d(h,!0),d(l,!1));var f=this.getPoint(),m=Math.min.apply(Math,u),g=s?o.getTangentAtTime(t):o.getPointAt(m).subtract(f),v=s?g.negate():c.getPointAt(-m).subtract(f),b=a?l.getTangentAtTime(i):l.getPointAt(m).subtract(f),y=a?b.negate():h.getPointAt(-m).subtract(f),_=v.getAngle(),w=g.getAngle(),x=y.getAngle(),k=b.getAngle();return!!(s?p(_,x,k)^p(w,x,k)&&p(_,k,x)^p(w,k,x):p(x,_,w)^p(k,_,w)&&p(x,w,_)^p(k,w,_))},hasOverlap:function(){return!!this._overlap}},r.each(I._evaluateMethods,(function(e){var t=e+"At";this[e]=function(){var e=this.getCurve(),i=this.getTime();return null!=i&&e&&e[t](i,!0)}}),{preserve:!0}),new function(){function e(e,t,i){var n=e.length,r=0,s=n-1;function a(i,r){for(var s=i+r;s>=-1&&s<=n;s+=r){var a=e[(s%n+n)%n];if(!t.getPoint().isClose(a.getPoint(),1e-7))break;if(t.equals(a))return a}return null}for(;r<=s;){var o,c=r+s>>>1,l=e[c];if(i&&(o=t.equals(l)?l:a(c,-1)||a(c,1)))return t._overlap&&(o._overlap=o._intersection._overlap=!0),o;var h=t.getPath(),u=l.getPath();(h!==u?h._id-u._id:t.getIndex()+t.getTime()-(l.getIndex()+l.getTime()))<0?s=c-1:r=c+1}return e.splice(r,0,t),t}return{statics:{insert:e,expand:function(t){for(var i=t.slice(),n=t.length-1;n>=0;n--)e(i,t[n]._intersection,!1);return i}}}}),L=w.extend({_class:"PathItem",_selectBounds:!1,_canScaleStroke:!0,beans:!0,initialize:function(){},statics:{create:function(e){var t,i,n;if(r.isPlainObject(e)?(i=e.segments,t=e.pathData):Array.isArray(e)?i=e:"string"==typeof e&&(t=e),i){var s=i[0];n=s&&Array.isArray(s[0])}else t&&(n=(t.match(/m/gi)||[]).length>1||/z\s*\S+/i.test(t));return new(n?B:O)(e)}},_asPathItem:function(){return this},isClockwise:function(){return this.getArea()>=0},setClockwise:function(e){this.isClockwise()!=(e=!!e)&&this.reverse()},setPathData:function(e){var t,i,n,r=e&&e.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi),s=!1,a=new d,o=new d;function c(e,i){var n=+t[e];return s&&(n+=a[i]),n}function l(e){return new d(c(e,"x"),c(e+1,"y"))}this.clear();for(var h=0,u=r&&r.length;h<u;h++){var p=r[h],m=p[0],g=m.toLowerCase(),v=(t=p.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))&&t.length;switch(s=m===g,"z"!==i||/[mz]/.test(g)||this.moveTo(a),g){case"m":case"l":for(var b="m"===g,y=0;y<v;y+=2)this[b?"moveTo":"lineTo"](a=l(y)),b&&(o=a,b=!1);n=a;break;case"h":case"v":var _="h"===g?"x":"y";for(a=a.clone(),y=0;y<v;y++)a[_]=c(y,_),this.lineTo(a);n=a;break;case"c":for(y=0;y<v;y+=6)this.cubicCurveTo(l(y),n=l(y+2),a=l(y+4));break;case"s":for(y=0;y<v;y+=4)this.cubicCurveTo(/[cs]/.test(i)?a.multiply(2).subtract(n):a,n=l(y),a=l(y+2)),i=g;break;case"q":for(y=0;y<v;y+=4)this.quadraticCurveTo(n=l(y),a=l(y+2));break;case"t":for(y=0;y<v;y+=2)this.quadraticCurveTo(n=/[qt]/.test(i)?a.multiply(2).subtract(n):a,a=l(y)),i=g;break;case"a":for(y=0;y<v;y+=7)this.arcTo(a=l(y+5),new f(+t[y],+t[y+1]),+t[y+2],+t[y+4],+t[y+3]);break;case"z":this.closePath(1e-12),a=o}i=g}},_canComposite:function(){return!(this.hasFill()&&this.hasStroke())},_contains:function(e){var t=e.isInside(this.getBounds({internal:!0,handle:!0}))?this._getWinding(e):{};return t.onPath||!!("evenodd"===this.getFillRule()?1&t.windingL||1&t.windingR:t.winding)},getIntersections:function(e,t,i,n){var r=this===e||!e,s=this._matrix._orNullIfIdentity(),a=r?s:(i||e._matrix)._orNullIfIdentity();return r||this.getBounds(s).intersects(e.getBounds(a),1e-12)?I.getIntersections(this.getCurves(),!r&&e.getCurves(),t,s,a,n):[]},getCrossings:function(e){return this.getIntersections(e,(function(e){return e.isCrossing()}))},getNearestLocation:function(){for(var e=d.read(arguments),t=this.getCurves(),i=1/0,n=null,r=0,s=t.length;r<s;r++){var a=t[r].getNearestLocation(e);a._distance<i&&(i=a._distance,n=a)}return n},getNearestPoint:function(){var e=this.getNearestLocation.apply(this,arguments);return e?e.getPoint():e},interpolate:function(e,t,i){var n=!this._children,r=n?"_segments":"_children",s=e[r],a=t[r],o=this[r];if(!s||!a||s.length!==a.length)throw new Error("Invalid operands in interpolate() call: "+e+", "+t);var c=o.length,l=a.length;if(c<l)for(var h=n?P:O,u=c;u<l;u++)this.add(new h);else c>l&&this[n?"removeSegments":"removeChildren"](l,c);for(u=0;u<l;u++)o[u].interpolate(s[u],a[u],i);n&&(this.setClosed(e._closed),this._changed(9))},compare:function(e){var t=!1;if(e){var i=this._children||[this],n=e._children?e._children.slice():[e],r=i.length,s=n.length,a=[],o=0;t=!0;for(var l=c.findItemBoundsCollisions(i,n,h.GEOMETRIC_EPSILON),u=r-1;u>=0&&t;u--){var d=i[u];t=!1;var p=l[u];if(p)for(var f=p.length-1;f>=0&&!t;f--)d.compare(n[p[f]])&&(a[p[f]]||(a[p[f]]=!0,o++),t=!0)}t=t&&o===s}return t}}),O=L.extend({_class:"Path",_serializeFields:{segments:[],closed:!1},initialize:function(e){this._closed=!1,this._segments=[],this._version=0;var i=arguments,n=Array.isArray(e)?"object"==typeof e[0]?e:i:!e||e.size!==t||e.x===t&&e.point===t?null:i;n&&n.length>0?this.setSegments(n):(this._curves=t,this._segmentSelection=0,n||"string"!=typeof e||(this.setPathData(e),e=null)),this._initialize(!n&&e)},_equals:function(e){return this._closed===e._closed&&r.equals(this._segments,e._segments)},copyContent:function(e){this.setSegments(e._segments),this._closed=e._closed},_changed:function e(i){if(e.base.call(this,i),8&i){if(this._length=this._area=t,32&i)this._version++;else if(this._curves)for(var n=0,r=this._curves.length;n<r;n++)this._curves[n]._changed()}else 64&i&&(this._bounds=t)},getStyle:function(){var e=this._parent;return(e instanceof B?e:this)._style},getSegments:function(){return this._segments},setSegments:function(e){var i=this.isFullySelected(),n=e&&e.length;if(this._segments.length=0,this._segmentSelection=0,this._curves=t,n){var r=e[n-1];"boolean"==typeof r&&(this.setClosed(r),n--),this._add(P.readList(e,0,{},n))}i&&this.setFullySelected(!0)},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){var e=this._curves,t=this._segments;if(!e){var i=this._countCurves();e=this._curves=new Array(i);for(var n=0;n<i;n++)e[n]=new I(this,t[n],t[n+1]||t[0])}return e},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var e=this.getCurves();return e[e.length-1]},isClosed:function(){return this._closed},setClosed:function(e){if(this._closed!=(e=!!e)){if(this._closed=e,this._curves){var t=this._curves.length=this._countCurves();e&&(this._curves[t-1]=new I(this,this._segments[t-1],this._segments[0]))}this._changed(41)}}},{beans:!0,getPathData:function(e,t){var i,n,r,s,a,o,c,h,u=this._segments,d=u.length,p=new l(t),f=new Array(6),m=!0,g=[];function v(t,l){if(t._transformCoordinates(e,f),i=f[0],n=f[1],m)g.push("M"+p.pair(i,n)),m=!1;else if(a=f[2],o=f[3],a===i&&o===n&&c===r&&h===s){if(!l){var u=i-r,d=n-s;g.push(0===u?"v"+p.number(d):0===d?"h"+p.number(u):"l"+p.pair(u,d))}}else g.push("c"+p.pair(c-r,h-s)+" "+p.pair(a-r,o-s)+" "+p.pair(i-r,n-s));r=i,s=n,c=f[4],h=f[5]}if(!d)return"";for(var b=0;b<d;b++)v(u[b]);return this._closed&&d>0&&(v(u[0],!0),g.push("z")),g.join("")},isEmpty:function(){return!this._segments.length},_transformContent:function(e){for(var t=this._segments,i=new Array(6),n=0,r=t.length;n<r;n++)t[n]._transformCoordinates(e,i,!0);return!0},_add:function(e,t){for(var i=this._segments,n=this._curves,s=e.length,a=null==t,o=(t=a?i.length:t,0);o<s;o++){var c=e[o];c._path&&(c=e[o]=c.clone()),c._path=this,c._index=t+o,c._selection&&this._updateSelection(c,0,c._selection)}if(a)r.push(i,e);else{i.splice.apply(i,[t,0].concat(e)),o=t+s;for(var l=i.length;o<l;o++)i[o]._index=o}if(n){var h=this._countCurves(),u=t>0&&t+s-1===h?t-1:t,d=u,p=Math.min(u+s,h);for(e._curves&&(n.splice.apply(n,[u,0].concat(e._curves)),d+=e._curves.length),o=d;o<p;o++)n.splice(o,0,new I(this,null,null));this._adjustCurves(u,p)}return this._changed(41),e},_adjustCurves:function(e,t){for(var i,n=this._segments,r=this._curves,s=e;s<t;s++)(i=r[s])._path=this,i._segment1=n[s],i._segment2=n[s+1]||n[0],i._changed();(i=r[this._closed&&!e?n.length-1:e-1])&&(i._segment2=n[e]||n[0],i._changed()),(i=r[t])&&(i._segment1=n[t],i._changed())},_countCurves:function(){var e=this._segments.length;return!this._closed&&e>0?e-1:e},add:function(e){var t=arguments;return t.length>1&&"number"!=typeof e?this._add(P.readList(t)):this._add([P.read(t)])[0]},insert:function(e,t){var i=arguments;return i.length>2&&"number"!=typeof t?this._add(P.readList(i,1),e):this._add([P.read(i,1)],e)[0]},addSegment:function(){return this._add([P.read(arguments)])[0]},insertSegment:function(e){return this._add([P.read(arguments,1)],e)[0]},addSegments:function(e){return this._add(P.readList(e))},insertSegments:function(e,t){return this._add(P.readList(t),e)},removeSegment:function(e){return this.removeSegments(e,e+1)[0]||null},removeSegments:function(e,t,i){e=e||0,t=r.pick(t,this._segments.length);var n=this._segments,s=this._curves,a=n.length,o=n.splice(e,t-e),c=o.length;if(!c)return o;for(var l=0;l<c;l++){var h=o[l];h._selection&&this._updateSelection(h,h._selection,0),h._index=h._path=null}l=e;for(var u=n.length;l<u;l++)n[l]._index=l;if(s){var d=e>0&&t===a+(this._closed?1:0)?e-1:e;for(l=(s=s.splice(d,c)).length-1;l>=0;l--)s[l]._path=null;i&&(o._curves=s.slice(1)),this._adjustCurves(d,d)}return this._changed(41),o},clear:"#removeSegments",hasHandles:function(){for(var e=this._segments,t=0,i=e.length;t<i;t++)if(e[t].hasHandles())return!0;return!1},clearHandles:function(){for(var e=this._segments,t=0,i=e.length;t<i;t++)e[t].clearHandles()},getLength:function(){if(null==this._length){for(var e=this.getCurves(),t=0,i=0,n=e.length;i<n;i++)t+=e[i].getLength();this._length=t}return this._length},getArea:function(){var e=this._area;if(null==e){var t=this._segments,i=this._closed;e=0;for(var n=0,r=t.length;n<r;n++){var s=n+1===r;e+=I.getArea(I.getValues(t[n],t[s?0:n+1],null,s&&!i))}this._area=e}return e},isFullySelected:function(){var e=this._segments.length;return this.isSelected()&&e>0&&this._segmentSelection===7*e},setFullySelected:function(e){e&&this._selectSegments(!0),this.setSelected(e)},setSelection:function e(t){1&t||this._selectSegments(!1),e.base.call(this,t)},_selectSegments:function(e){var t=this._segments,i=t.length,n=e?7:0;this._segmentSelection=n*i;for(var r=0;r<i;r++)t[r]._selection=n},_updateSelection:function(e,t,i){e._selection=i,(this._segmentSelection+=i-t)>0&&this.setSelected(!0)},divideAt:function(e){var t,i=this.getLocationAt(e);return i&&(t=i.getCurve().divideAt(i.getCurveOffset()))?t._segment1:null},splitAt:function(e){var t=this.getLocationAt(e),i=t&&t.index,n=t&&t.time;n>.99999999&&(i++,n=0);var r=this.getCurves();if(i>=0&&i<r.length){n>=1e-8&&r[i++].divideAtTime(n);var s,a=this.removeSegments(i,this._segments.length,!0);return this._closed?(this.setClosed(!1),s=this):((s=new O(w.NO_INSERT)).insertAbove(this),s.copyAttributes(this)),s._add(a,0),this.addSegment(a[0]),s}return null},split:function(e,i){var n,r=i===t?e:(n=this.getCurves()[e])&&n.getLocationAtTime(i);return null!=r?this.splitAt(r):null},join:function(e,t){var i=t||0;if(e&&e!==this){var n=e._segments,r=this.getLastSegment(),s=e.getLastSegment();if(!s)return this;r&&r._point.isClose(s._point,i)&&e.reverse();var a=e.getFirstSegment();if(r&&r._point.isClose(a._point,i))r.setHandleOut(a._handleOut),this._add(n.slice(1));else{var o=this.getFirstSegment();o&&o._point.isClose(a._point,i)&&e.reverse(),s=e.getLastSegment(),o&&o._point.isClose(s._point,i)?(o.setHandleIn(s._handleIn),this._add(n.slice(0,n.length-1),0)):this._add(n.slice())}e._closed&&this._add([n[0]]),e.remove()}var c=this.getFirstSegment(),l=this.getLastSegment();return c!==l&&c._point.isClose(l._point,i)&&(c.setHandleIn(l._handleIn),l.remove(),this.setClosed(!0)),this},reduce:function(e){for(var t=this.getCurves(),i=e&&e.simplify,n=i?1e-7:0,r=t.length-1;r>=0;r--){var s=t[r];!s.hasHandles()&&(!s.hasLength(n)||i&&s.isCollinear(s.getNext()))&&s.remove()}return this},reverse:function(){this._segments.reverse();for(var e=0,t=this._segments.length;e<t;e++){var i=this._segments[e],n=i._handleIn;i._handleIn=i._handleOut,i._handleOut=n,i._index=e}this._curves=null,this._changed(9)},flatten:function(e){for(var t=new D(this,e||.25,256,!0).parts,i=t.length,n=[],r=0;r<i;r++)n.push(new P(t[r].curve.slice(0,2)));!this._closed&&i>0&&n.push(new P(t[i-1].curve.slice(6))),this.setSegments(n)},simplify:function(e){var t=new R(this).fit(e||2.5);return t&&this.setSegments(t),!!t},smooth:function(e){var i=this,n=e||{},r=n.type||"asymmetric",s=this._segments,a=s.length,o=this._closed;function c(e,t){var n=e&&e.index;if(null!=n){var r=e.path;if(r&&r!==i)throw new Error(e._class+" "+n+" of "+r+" is not part of "+i);t&&e instanceof I&&n++}else n="number"==typeof e?e:t;return Math.min(n<0&&o?n%a:n<0?n+a:n,a-1)}var l=o&&n.from===t&&n.to===t,h=c(n.from,0),u=c(n.to,a-1);if(h>u)if(o)h-=a;else{var d=h;h=u,u=d}if(/^(?:asymmetric|continuous)$/.test(r)){var p="asymmetric"===r,f=Math.min,m=u-h+1,g=m-1,v=l?f(m,4):1,b=v,y=v,_=[];if(o||(b=f(1,h),y=f(1,a-u-1)),(g+=b+y)<=1)return;for(var w=0,x=h-b;w<=g;w++,x++)_[w]=s[(x<0?x+a:x)%a]._point;var k=_[0]._x+2*_[1]._x,C=_[0]._y+2*_[1]._y,S=2,M=g-1,E=[k],T=[C],P=[S],A=[],N=[];for(w=1;w<g;w++){var L=w<M,O=L?4:p?2:7,B=L?4:p?3:8,D=L?2:p?0:1,R=(L||p?1:2)/S;S=P[w]=O-R,k=E[w]=B*_[w]._x+D*_[w+1]._x-R*k,C=T[w]=B*_[w]._y+D*_[w+1]._y-R*C}for(A[M]=E[M]/P[M],N[M]=T[M]/P[M],w=g-2;w>=0;w--)A[w]=(E[w]-A[w+1])/P[w],N[w]=(T[w]-N[w+1])/P[w];A[g]=(3*_[g]._x-A[M])/2,N[g]=(3*_[g]._y-N[M])/2,w=b;var z=g-y;for(x=h;w<=z;w++,x++){var V=s[x<0?x+a:x],q=V._point,F=A[w]-q._x,j=N[w]-q._y;(l||w<z)&&V.setHandleOut(F,j),(l||w>b)&&V.setHandleIn(-F,-j)}}else for(w=h;w<=u;w++)s[w<0?w+a:w].smooth(n,!l&&w===h,!l&&w===u)},toShape:function(e){if(!this._closed)return null;var i,n,r,s,a,o,c,l=this._segments;function u(e,t){var i=l[e],n=i.getNext(),r=l[t],s=r.getNext();return i._handleOut.isZero()&&n._handleIn.isZero()&&r._handleOut.isZero()&&s._handleIn.isZero()&&n._point.subtract(i._point).isCollinear(s._point.subtract(r._point))}function d(e){var t=l[e],i=t.getNext(),n=t._handleOut,r=i._handleIn,s=.5522847498307936;if(n.isOrthogonal(r)){var a=t._point,o=i._point,c=new y(a,n,!0).intersect(new y(o,r,!0),!0);return c&&h.isZero(n.getLength()/c.subtract(a).getLength()-s)&&h.isZero(r.getLength()/c.subtract(o).getLength()-s)}return!1}function p(e,t){return l[e]._point.getDistance(l[t]._point)}if(!this.hasHandles()&&4===l.length&&u(0,2)&&u(1,3)&&(o=(a=l[1]).getPrevious(),c=a.getNext(),o._handleOut.isZero()&&a._handleIn.isZero()&&a._handleOut.isZero()&&c._handleIn.isZero()&&a._point.subtract(o._point).isOrthogonal(c._point.subtract(a._point)))?(i=C.Rectangle,n=new f(p(0,3),p(0,1)),s=l[1]._point.add(l[2]._point).divide(2)):8===l.length&&d(0)&&d(2)&&d(4)&&d(6)&&u(1,5)&&u(3,7)?(i=C.Rectangle,r=(n=new f(p(1,6),p(0,3))).subtract(new f(p(0,7),p(1,2))).divide(2),s=l[3]._point.add(l[4]._point).divide(2)):4===l.length&&d(0)&&d(1)&&d(2)&&d(3)&&(h.isZero(p(0,2)-p(1,3))?(i=C.Circle,r=p(0,2)/2):(i=C.Ellipse,r=new f(p(2,0)/2,p(3,1)/2)),s=l[1]._point),i){var m=this.getPosition(!0),g=new i({center:m,size:n,radius:r,insert:!1});return g.copyAttributes(this,!0),g._matrix.prepend(this._matrix),g.rotate(s.subtract(m).getAngle()+90),(e===t||e)&&g.insertAbove(this),g}return null},toPath:"#clone",compare:function e(t){if(!t||t instanceof B)return e.base.call(this,t);var i=this.getCurves(),n=t.getCurves(),r=i.length,s=n.length;if(!r||!s)return r==s;for(var a,o,c=i[0].getValues(),l=[],h=0,u=0,d=0;d<s;d++){var p=n[d].getValues();if(l.push(p),g=I.getOverlaps(c,p)){a=!d&&g[0][0]>0?s-1:d,o=g[0][1];break}}var f,m=Math.abs;for(p=l[a];c&&p;){var g;if((g=I.getOverlaps(c,p))&&m(g[0][0]-u)<1e-8){1===(u=g[1][0])&&(c=++h<r?i[h].getValues():null,u=0);var v=g[0][1];if(m(v-o)<1e-8){if(f||(f=[a,v]),1===(o=g[1][1])&&(++a>=s&&(a=0),p=l[a]||n[a].getValues(),o=0),!c)return f[0]===a&&f[1]===o;continue}}break}return!1},_hitTestSelf:function(e,t,i,n){var r,s,a,o,c,l,h=this,u=this.getStyle(),d=this._segments,p=d.length,f=this._closed,m=t._tolerancePadding,g=m,v=t.stroke&&u.hasStroke(),b=t.fill&&u.hasFill(),y=t.curves,_=v?u.getStrokeWidth()/2:b&&t.tolerance>0||y?0:null;function w(t,i){return e.subtract(t).divide(i).length<=1}function x(e,i,n){if(!t.selected||i.isSelected()){var r=e._point;if(i!==r&&(i=i.add(r)),w(i,g))return new T(n,h,{segment:e,point:i})}}function k(e,i){return(i||t.segments)&&x(e,e._point,"segment")||!i&&t.handles&&(x(e,e._handleIn,"handle-in")||x(e,e._handleOut,"handle-out"))}function C(e){o.add(e)}function S(t){var i,c=f||t._index>0&&t._index<p-1;return"round"===(c?r:s)?w(t._point,g):(o=new O({internal:!0,closed:!0}),c?t.isSmooth()||O._addBevelJoin(t,r,_,a,null,n,C,!0):"square"===s&&O._addSquareCap(t,s,_,null,n,C,!0),o.isEmpty()?void 0:o.contains(e)||(i=o.getNearestLocation(e))&&w(i.getPoint(),m))}if(null!==_&&(_>0?(r=u.getStrokeJoin(),s=u.getStrokeCap(),a=u.getMiterLimit(),g=g.add(O._getStrokePadding(_,n))):r=s="round"),!t.ends||t.segments||f){if(t.segments||t.handles)for(var M=0;M<p;M++)if(l=k(d[M]))return l}else if(l=k(d[0],!0)||k(d[p-1],!0))return l;if(null!==_){if(c=this.getNearestLocation(e)){var E=c.getTime();0===E||1===E&&p>1?S(c.getSegment())||(c=null):w(c.getPoint(),g)||(c=null)}if(!c&&"miter"===r&&p>1)for(M=0;M<p;M++){var P=d[M];if(e.getDistance(P._point)<=a*_&&S(P)){c=P.getLocation();break}}}return!c&&b&&this._contains(e)||c&&!v&&!y?new T("fill",this):c?new T(v?"stroke":"curve",this,{location:c,point:c.getPoint()}):null}},r.each(I._evaluateMethods,(function(e){this[e+"At"]=function(t){var i=this.getLocationAt(t);return i&&i[e]()}}),{beans:!1,getLocationOf:function(){for(var e=d.read(arguments),t=this.getCurves(),i=0,n=t.length;i<n;i++){var r=t[i].getLocationOf(e);if(r)return r}return null},getOffsetOf:function(){var e=this.getLocationOf.apply(this,arguments);return e?e.getOffset():null},getLocationAt:function(e){if("number"==typeof e){for(var t=this.getCurves(),i=0,n=0,r=t.length;n<r;n++){var s=i,a=t[n];if((i+=a.getLength())>e)return a.getLocationAt(e-s)}if(t.length>0&&e<=this.getLength())return new N(t[t.length-1],1)}else if(e&&e.getPath&&e.getPath()===this)return e;return null},getOffsetsWithTangent:function(){var e=d.read(arguments);if(e.isZero())return[];for(var t=[],i=0,n=this.getCurves(),r=0,s=n.length;r<s;r++){for(var a=n[r],o=a.getTimesWithTangent(e),c=0,l=o.length;c<l;c++){var h=i+a.getOffsetAtTime(o[c]);t.indexOf(h)<0&&t.push(h)}i+=a.length}return t}}),new function(){function e(e,t,i){var n,r,s,a,o,c,l,h,u=t._segments,d=u.length,p=new Array(6),f=!0;function m(t){if(i)t._transformCoordinates(i,p),n=p[0],r=p[1];else{var u=t._point;n=u._x,r=u._y}if(f)e.moveTo(n,r),f=!1;else{if(i)o=p[2],c=p[3];else{var d=t._handleIn;o=n+d._x,c=r+d._y}o===n&&c===r&&l===s&&h===a?e.lineTo(n,r):e.bezierCurveTo(l,h,o,c,n,r)}s=n,a=r,i?(l=p[4],h=p[5]):(d=t._handleOut,l=s+d._x,h=a+d._y)}for(var g=0;g<d;g++)m(u[g]);t._closed&&d>0&&m(u[0])}return{_draw:function(t,i,n,r){var s=i.dontStart,a=i.dontFinish||i.clip,o=this.getStyle(),c=o.hasFill(),l=o.hasStroke(),h=o.getDashArray(),u=!ae.support.nativeDash&&l&&h&&h.length;function d(e){return h[(e%u+u)%u]}if(s||t.beginPath(),(c||l&&!u||a)&&(e(t,this,r),this._closed&&t.closePath()),!a&&(c||l)&&(this._setStyles(t,i,n),c&&(t.fill(o.getFillRule()),t.shadowColor="rgba(0,0,0,0)"),l)){if(u){s||t.beginPath();for(var p,f=new D(this,.25,32,!1,r),m=f.length,g=-o.getDashOffset(),v=0;g>0;)g-=d(v--)+d(v--);for(;g<m;)p=g+d(v++),(g>0||p>0)&&f.drawPart(t,Math.max(g,0),Math.max(p,0)),g=p+d(v++)}t.stroke()}},_drawSelected:function(t,i){t.beginPath(),e(t,this,i),t.stroke(),function(e,t,i,n){if(!(n<=0))for(var r,s,a=n/2,o=n-2,c=a-1,l=new Array(6),h=0,u=t.length;h<u;h++){var d=t[h],p=d._selection;if(d._transformCoordinates(i,l),r=l[0],s=l[1],2&p&&m(2),4&p&&m(4),e.fillRect(r-a,s-a,n,n),o>0&&!(1&p)){var f=e.fillStyle;e.fillStyle="#ffffff",e.fillRect(r-c,s-c,o,o),e.fillStyle=f}}function m(t){var i=l[t],n=l[t+1];r==i&&s==n||(e.beginPath(),e.moveTo(r,s),e.lineTo(i,n),e.stroke(),e.beginPath(),e.arc(i,n,a,0,2*Math.PI,!0),e.fill())}}(t,this._segments,i,ae.settings.handleSize)}}},new function(){function e(e){var t=e._segments;if(!t.length)throw new Error("Use a moveTo() command first");return t[t.length-1]}return{moveTo:function(){var e=this._segments;1===e.length&&this.removeSegment(0),e.length||this._add([new P(d.read(arguments))])},moveBy:function(){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(){this._add([new P(d.read(arguments))])},cubicCurveTo:function(){var t=arguments,i=d.read(t),n=d.read(t),r=d.read(t),s=e(this);s.setHandleOut(i.subtract(s._point)),this._add([new P(r,n.subtract(r))])},quadraticCurveTo:function(){var t=arguments,i=d.read(t),n=d.read(t),r=e(this)._point;this.cubicCurveTo(i.add(r.subtract(i).multiply(1/3)),i.add(n.subtract(i).multiply(1/3)),n)},curveTo:function(){var t=arguments,i=d.read(t),n=d.read(t),s=r.pick(r.read(t),.5),a=1-s,o=e(this)._point,c=i.subtract(o.multiply(a*a)).subtract(n.multiply(s*s)).divide(2*s*a);if(c.isNaN())throw new Error("Cannot put a curve through points with parameter = "+s);this.quadraticCurveTo(c,n)},arcTo:function(){var t,i,n,s,a=arguments,o=Math.abs,c=Math.sqrt,l=e(this),u=l._point,p=d.read(a),m=r.peek(a);if("boolean"==typeof(x=r.pick(m,!0)))var g=(C=u.add(p).divide(2)).add(C.subtract(u).rotate(x?-90:90));else if(r.remain(a)<=2)g=p,p=d.read(a);else if(!u.equals(p)){var v=f.read(a),_=h.isZero;if(_(v.width)||_(v.height))return this.lineTo(p);var w=r.read(a),x=!!r.read(a),k=!!r.read(a),C=u.add(p).divide(2),S=(Y=u.subtract(C).rotate(-w)).x,M=Y.y,E=o(v.width),T=o(v.height),A=E*E,I=T*T,N=S*S,L=M*M,O=c(N/A+L/I);if(O>1&&(A=(E*=O)*E,I=(T*=O)*T),o(O=(A*I-A*L-I*N)/(A*L+I*N))<1e-12&&(O=0),O<0)throw new Error("Cannot create an arc with the given arguments");t=new d(E*M/T,-T*S/E).multiply((k===x?-1:1)*c(O)).rotate(w).add(C),i=(n=(s=(new b).translate(t).rotate(w).scale(E,T))._inverseTransform(u)).getDirectedAngle(s._inverseTransform(p)),!x&&i>0?i-=360:x&&i<0&&(i+=360)}if(g){var B=new y(u.add(g).divide(2),g.subtract(u).rotate(90),!0),D=new y(g.add(p).divide(2),p.subtract(g).rotate(90),!0),R=new y(u,p),z=R.getSide(g);if(!(t=B.intersect(D,!0))){if(!z)return this.lineTo(p);throw new Error("Cannot create an arc with the given arguments")}i=(n=u.subtract(t)).getDirectedAngle(p.subtract(t));var V=R.getSide(t,!0);0===V?i=z*o(i):z===V&&(i+=i<0?360:-360)}if(i){for(var q=o(i),F=q>=360?4:Math.ceil((q-1e-5)/90),j=i/F,H=j*Math.PI/360,G=4/3*Math.sin(H)/(1+Math.cos(H)),U=[],W=0;W<=F;W++){var Y=p,$=null;if(W<F&&($=n.rotate(90).multiply(G),s?(Y=s._transformPoint(n),$=s._transformPoint(n.add($)).subtract(Y)):Y=t.add(n)),W){var K=n.rotate(-90).multiply(G);s&&(K=s._transformPoint(n.add(K)).subtract(Y)),U.push(new P(Y,K,$))}else l.setHandleOut($);n=n.rotate(j)}this._add(U)}},lineBy:function(){var t=d.read(arguments),i=e(this)._point;this.lineTo(i.add(t))},curveBy:function(){var t=arguments,i=d.read(t),n=d.read(t),s=r.read(t),a=e(this)._point;this.curveTo(a.add(i),a.add(n),s)},cubicCurveBy:function(){var t=arguments,i=d.read(t),n=d.read(t),r=d.read(t),s=e(this)._point;this.cubicCurveTo(s.add(i),s.add(n),s.add(r))},quadraticCurveBy:function(){var t=arguments,i=d.read(t),n=d.read(t),r=e(this)._point;this.quadraticCurveTo(r.add(i),r.add(n))},arcBy:function(){var t=arguments,i=e(this)._point,n=i.add(d.read(t)),s=r.pick(r.peek(t),!0);"boolean"==typeof s?this.arcTo(n,s):this.arcTo(n,i.add(d.read(t)))},closePath:function(e){this.setClosed(!0),this.join(this,e)}}},{_getBounds:function(e,t){var i=t.handle?"getHandleBounds":t.stroke?"getStrokeBounds":"getBounds";return O[i](this._segments,this._closed,this,e,t)},statics:{getBounds:function(e,t,i,n,r,s){var a=e[0];if(!a)return new g;var o=new Array(6),c=a._transformCoordinates(n,new Array(6)),l=c.slice(0,2),h=l.slice(),u=new Array(2);function d(e){e._transformCoordinates(n,o);for(var t=0;t<2;t++)I._addBounds(c[t],c[t+4],o[t+2],o[t],t,s?s[t]:0,l,h,u);var i=c;c=o,o=i}for(var p=1,f=e.length;p<f;p++)d(e[p]);return t&&d(a),new g(l[0],l[1],h[0]-l[0],h[1]-l[1])},getStrokeBounds:function(e,t,i,n,r){var s=i.getStyle(),a=s.hasStroke(),o=s.getStrokeWidth(),c=a&&i._getStrokeMatrix(n,r),l=a&&O._getStrokePadding(o,c),h=O.getBounds(e,t,i,n,r,l);if(!a)return h;var u=o/2,d=s.getStrokeJoin(),p=s.getStrokeCap(),m=s.getMiterLimit(),v=new g(new f(l));function b(e){h=h.include(e)}function y(e){h=h.unite(v.setCenter(e._point.transform(n)))}function _(e,t){"round"===t||e.isSmooth()?y(e):O._addBevelJoin(e,t,u,m,n,c,b)}function w(e,t){"round"===t?y(e):O._addSquareCap(e,t,u,n,c,b)}var x=e.length-(t?0:1);if(x>0){for(var k=1;k<x;k++)_(e[k],d);t?_(e[0],d):(w(e[0],p),w(e[e.length-1],p))}return h},_getStrokePadding:function(e,t){if(!t)return[e,e];var i=new d(e,0).transform(t),n=new d(0,e).transform(t),r=i.getAngleInRadians(),s=i.getLength(),a=n.getLength(),o=Math.sin(r),c=Math.cos(r),l=Math.tan(r),h=Math.atan2(a*l,s),u=Math.atan2(a,l*s);return[Math.abs(s*Math.cos(h)*c+a*Math.sin(h)*o),Math.abs(a*Math.sin(u)*c+s*Math.cos(u)*o)]},_addBevelJoin:function(e,t,i,n,r,s,a,o){var c=e.getCurve(),l=c.getPrevious(),h=c.getPoint1().transform(r),u=l.getNormalAtTime(1).multiply(i).transform(s),p=c.getNormalAtTime(0).multiply(i).transform(s),f=u.getDirectedAngle(p);if((f<0||f>=180)&&(u=u.negate(),p=p.negate()),o&&a(h),a(h.add(u)),"miter"===t){var m=new y(h.add(u),new d(-u.y,u.x),!0).intersect(new y(h.add(p),new d(-p.y,p.x),!0),!0);m&&h.getDistance(m)<=n*i&&a(m)}a(h.add(p))},_addSquareCap:function(e,t,i,n,r,s,a){var o=e._point.transform(n),c=e.getLocation(),l=c.getNormal().multiply(0===c.getTime()?i:-i).transform(r);"square"===t&&(a&&(s(o.subtract(l)),s(o.add(l))),o=o.add(l.rotate(-90))),s(o.add(l)),s(o.subtract(l))},getHandleBounds:function(e,t,i,n,r){var s,a,o=i.getStyle();if(r.stroke&&o.hasStroke()){var c=i._getStrokeMatrix(n,r),l=o.getStrokeWidth()/2,h=l;"miter"===o.getStrokeJoin()&&(h=l*o.getMiterLimit()),"square"===o.getStrokeCap()&&(h=Math.max(h,l*Math.SQRT2)),s=O._getStrokePadding(l,c),a=O._getStrokePadding(h,c)}for(var u=new Array(6),d=1/0,p=-d,f=d,m=p,v=0,b=e.length;v<b;v++){e[v]._transformCoordinates(n,u);for(var y=0;y<6;y+=2){var _=y?s:a,w=_?_[0]:0,x=_?_[1]:0,k=u[y],C=u[y+1],S=k-w,M=k+w,E=C-x,T=C+x;S<d&&(d=S),M>p&&(p=M),E<f&&(f=E),T>m&&(m=T)}}return new g(d,f,p-d,m-f)}}});O.inject({statics:new function(){var e=.5522847498307936,t=[new P([-1,0],[0,e],[0,-e]),new P([0,-1],[-e,0],[e,0]),new P([1,0],[0,-e],[0,e]),new P([0,1],[e,0],[-e,0])];function i(e,t,i){var n=r.getNamed(i),s=new O(n&&(1==n.insert?w.INSERT:0==n.insert?w.NO_INSERT:null));return s._add(e),s._closed=t,s.set(n,w.INSERT)}function n(e,n,r){for(var s=new Array(4),a=0;a<4;a++){var o=t[a];s[a]=new P(o._point.multiply(n).add(e),o._handleIn.multiply(n),o._handleOut.multiply(n))}return i(s,!0,r)}return{Line:function(){var e=arguments;return i([new P(d.readNamed(e,"from")),new P(d.readNamed(e,"to"))],!1,e)},Circle:function(){var e=arguments,t=d.readNamed(e,"center"),i=r.readNamed(e,"radius");return n(t,new f(i),e)},Rectangle:function(){var t,n=arguments,r=g.readNamed(n,"rectangle"),s=f.readNamed(n,"radius",0,{readNull:!0}),a=r.getBottomLeft(!0),o=r.getTopLeft(!0),c=r.getTopRight(!0),l=r.getBottomRight(!0);if(!s||s.isZero())t=[new P(a),new P(o),new P(c),new P(l)];else{var h=(s=f.min(s,r.getSize(!0).divide(2))).width,u=s.height,d=h*e,p=u*e;t=[new P(a.add(h,0),null,[-d,0]),new P(a.subtract(0,u),[0,p]),new P(o.add(0,u),null,[0,-p]),new P(o.add(h,0),[-d,0],null),new P(c.subtract(h,0),null,[d,0]),new P(c.add(0,u),[0,-p],null),new P(l.subtract(0,u),null,[0,p]),new P(l.subtract(h,0),[d,0])]}return i(t,!0,n)},RoundRectangle:"#Rectangle",Ellipse:function(){var e=arguments,t=C._readEllipse(e);return n(t.center,t.radius,e)},Oval:"#Ellipse",Arc:function(){var e=arguments,t=d.readNamed(e,"from"),i=d.readNamed(e,"through"),n=d.readNamed(e,"to"),s=r.getNamed(e),a=new O(s&&0==s.insert&&w.NO_INSERT);return a.moveTo(t),a.arcTo(i,n),a.set(s)},RegularPolygon:function(){for(var e=arguments,t=d.readNamed(e,"center"),n=r.readNamed(e,"sides"),s=r.readNamed(e,"radius"),a=360/n,o=n%3==0,c=new d(0,o?-s:s),l=o?-1:.5,h=new Array(n),u=0;u<n;u++)h[u]=new P(t.add(c.rotate((u+l)*a)));return i(h,!0,e)},Star:function(){for(var e=arguments,t=d.readNamed(e,"center"),n=2*r.readNamed(e,"points"),s=r.readNamed(e,"radius1"),a=r.readNamed(e,"radius2"),o=360/n,c=new d(0,-1),l=new Array(n),h=0;h<n;h++)l[h]=new P(t.add(c.rotate(o*h).multiply(h%2?a:s)));return i(l,!0,e)}}}});var B=L.extend({_class:"CompoundPath",_serializeFields:{children:[]},beans:!0,initialize:function(e){this._children=[],this._namedChildren={},this._initialize(e)||("string"==typeof e?this.setPathData(e):this.addChildren(Array.isArray(e)?e:arguments))},insertChildren:function e(t,i){var n=i,s=n[0];s&&"number"==typeof s[0]&&(n=[n]);for(var a=i.length-1;a>=0;a--){var o=n[a];n!==i||o instanceof O||(n=r.slice(n)),Array.isArray(o)?n[a]=new O({segments:o,insert:!1}):o instanceof B&&(n.splice.apply(n,[a,1].concat(o.removeChildren())),o.remove())}return e.base.call(this,t,n)},reduce:function e(t){for(var i=this._children,n=i.length-1;n>=0;n--){var r;(r=i[n].reduce(t)).isEmpty()&&r.remove()}return i.length?e.base.call(this):((r=new O(w.NO_INSERT)).copyAttributes(this),r.insertAbove(this),this.remove(),r)},isClosed:function(){for(var e=this._children,t=0,i=e.length;t<i;t++)if(!e[t]._closed)return!1;return!0},setClosed:function(e){for(var t=this._children,i=0,n=t.length;i<n;i++)t[i].setClosed(e)},getFirstSegment:function(){var e=this.getFirstChild();return e&&e.getFirstSegment()},getLastSegment:function(){var e=this.getLastChild();return e&&e.getLastSegment()},getCurves:function(){for(var e=this._children,t=[],i=0,n=e.length;i<n;i++)r.push(t,e[i].getCurves());return t},getFirstCurve:function(){var e=this.getFirstChild();return e&&e.getFirstCurve()},getLastCurve:function(){var e=this.getLastChild();return e&&e.getLastCurve()},getArea:function(){for(var e=this._children,t=0,i=0,n=e.length;i<n;i++)t+=e[i].getArea();return t},getLength:function(){for(var e=this._children,t=0,i=0,n=e.length;i<n;i++)t+=e[i].getLength();return t},getPathData:function(e,t){for(var i=this._children,n=[],r=0,s=i.length;r<s;r++){var a=i[r],o=a._matrix;n.push(a.getPathData(e&&!o.isIdentity()?e.appended(o):e,t))}return n.join("")},_hitTestChildren:function e(t,i,n){return e.base.call(this,t,i.class===O||"path"===i.type?i:r.set({},i,{fill:!1}),n)},_draw:function(e,t,i,n){var r=this._children;if(r.length){t=t.extend({dontStart:!0,dontFinish:!0}),e.beginPath();for(var s=0,a=r.length;s<a;s++)r[s].draw(e,t,n);if(!t.clip){this._setStyles(e,t,i);var o=this._style;o.hasFill()&&(e.fill(o.getFillRule()),e.shadowColor="rgba(0,0,0,0)"),o.hasStroke()&&e.stroke()}}},_drawSelected:function(e,t,i){for(var n=this._children,r=0,s=n.length;r<s;r++){var a=n[r],o=a._matrix;i[a._id]||a._drawSelected(e,o.isIdentity()?t:t.appended(o))}}},new function(){function e(e,t){var i=e._children;if(t&&!i.length)throw new Error("Use a moveTo() command first");return i[i.length-1]}return r.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","cubicCurveBy","quadraticCurveBy","curveBy","arcBy"],(function(t){this[t]=function(){var i=e(this,!0);i[t].apply(i,arguments)}}),{moveTo:function(){var t=e(this),i=t&&t.isEmpty()?t:new O(w.NO_INSERT);i!==t&&this.addChild(i),i.moveTo.apply(i,arguments)},moveBy:function(){var t=e(this,!0),i=t&&t.getLastSegment(),n=d.read(arguments);this.moveTo(i?n.add(i._point):n)},closePath:function(t){e(this,!0).closePath(t)}})},r.each(["reverse","flatten","simplify","smooth"],(function(e){this[e]=function(t){for(var i,n=this._children,r=0,s=n.length;r<s;r++)i=n[r][e](t)||i;return i}}),{}));L.inject(new function(){var e=Math.min,i=Math.max,n=Math.abs,s={unite:{1:!0,2:!0},intersect:{2:!0},subtract:{1:!0},exclude:{1:!0,"-1":!0}};function a(e){return e._children||[e]}function o(e,t){var i=e.clone(!1).reduce({simplify:!0}).transform(null,!0,!0);if(t){for(var n=a(i),r=0,s=n.length;r<s;r++)(e=n[r])._closed||e.isEmpty()||(e.closePath(1e-12),e.getFirstSegment().setHandleIn(0,0),e.getLastSegment().setHandleOut(0,0));i=i.resolveCrossings().reorient("nonzero"===i.getFillRule(),!0)}return i}function l(e,t,i,n,r){var s=new B(w.NO_INSERT);return s.addChildren(e,!0),s=s.reduce({simplify:t}),r&&0==r.insert||s.insertAbove(n&&i.isSibling(n)&&i.getIndex()<n.getIndex()?n:i),s.copyAttributes(i,!0),s}function u(e){return e.hasOverlap()||e.isCrossing()}function d(e,t,i,n){if(n&&(0==n.trace||n.stroke)&&/^(subtract|intersect)$/.test(i))return p(e,t,i);var h=o(e,!0),d=t&&e!==t&&o(t,!0),f=s[i];f[i]=!0,d&&(f.subtract||f.exclude)^d.isClockwise()^h.isClockwise()&&d.reverse();var m,b=v(N.expand(h.getIntersections(d,u))),w=a(h),x=d&&a(d),k=[],C=[];function S(e){for(var t=0,i=e.length;t<i;t++){var n=e[t];r.push(k,n._segments),r.push(C,n.getCurves()),n._overlapsOnly=!0}}function M(e){for(var t=[],i=0,n=e&&e.length;i<n;i++)t.push(C[e[i]]);return t}if(b.length){S(w),x&&S(x);for(var E=new Array(C.length),T=0,P=C.length;T<P;T++)E[T]=C[T].getValues();var A=c.findCurveBoundsCollisions(E,E,0,!0),I={};for(T=0;T<C.length;T++){var L=C[T],O=L._path._id;(I[O]=I[O]||{})[L.getIndex()]={hor:M(A[T].hor),ver:M(A[T].ver)}}for(T=0,P=b.length;T<P;T++)y(b[T]._segment,h,d,I,f);for(T=0,P=k.length;T<P;T++){var B=k[T],D=B._intersection;B._winding||y(B,h,d,I,f),D&&D._overlap||(B._path._overlapsOnly=!1)}m=_(k,f)}else m=g(x?w.concat(x):w.slice(),(function(e){return!!f[e]}));return l(m,!0,e,t,n)}function p(e,t,i){var n=o(e),r=o(t),s=n.getIntersections(r,u),a="subtract"===i,c="divide"===i,h={},d=[];function p(e){if(!h[e._id]&&(c||r.contains(e.getPointAt(e.getLength()/2))^a))return d.unshift(e),h[e._id]=!0}for(var f=s.length-1;f>=0;f--){var m=s[f].split();m&&(p(m)&&m.getFirstSegment().setHandleIn(0,0),n.getLastSegment().setHandleOut(0,0))}return p(n),l(d,!1,e,t)}function f(e,t){for(var i=e;i;){if(i===t)return;i=i._previous}for(;e._next&&e._next!==t;)e=e._next;if(!e._next){for(;t._previous;)t=t._previous;e._next=t,t._previous=e}}function m(e){for(var t=e.length-1;t>=0;t--)e[t].clearHandles()}function g(e,t,i){var s=e&&e.length;if(s){var a=r.each(e,(function(e,t){this[e._id]={container:null,winding:e.isClockwise()?1:-1,index:t}}),{}),o=e.slice().sort((function(e,t){return n(t.getArea())-n(e.getArea())})),l=o[0],u=c.findItemBoundsCollisions(o,null,h.GEOMETRIC_EPSILON);null==i&&(i=l.isClockwise());for(var d=0;d<s;d++){var p=o[d],f=a[p._id],m=0,g=u[d];if(g)for(var v=null,b=g.length-1;b>=0;b--)if(g[b]<d){v=v||p.getInteriorPoint();var y=o[g[b]];if(y.contains(v)){var _=a[y._id];m=_.winding,f.winding+=m,f.container=_.exclude?_.container:y;break}}if(t(f.winding)===t(m))f.exclude=!0,e[f.index]=null;else{var w=f.container;p.setClockwise(w?!w.isClockwise():i)}}}return e}function v(e,t,i){var n,r,s,a=t&&[],o=1e-8,c=1-o,l=!1,h=i||[],u=i&&{};function d(e){return e._path._id+"."+e._segment1._index}for(var p=(i&&i.length)-1;p>=0;p--)(g=i[p])._path&&(u[d(g)]=!0);for(p=e.length-1;p>=0;p--){var g,v,b=e[p],y=b._time,_=y,w=t&&!t(b);if((g=b._curve)&&(g!==r?(l=!g.hasHandles()||u&&u[d(g)],n=[],s=null,r=g):s>=o&&(y/=s)),w)n&&n.push(b);else{if(t&&a.unshift(b),s=_,y<o)v=g._segment1;else if(y>c)v=g._segment2;else{var x=g.divideAtTime(y,!0);l&&h.push(g,x),v=x._segment1;for(var k=n.length-1;k>=0;k--){var C=n[k];C._time=(C._time-y)/(1-y)}}b._setSegment(v);var S=v._intersection,M=b._intersection;if(S){f(S,M);for(var E=S;E;)f(E._intersection,S),E=E._next}else v._intersection=M}}return i||m(h),a||e}function b(t,r,s,a,o){var c,l,h=Array.isArray(r)?r:r[s?"hor":"ver"],u=s?1:0,d=1^u,p=[t.x,t.y],f=p[u],m=p[d],g=1e-6,v=f-1e-9,y=f+1e-9,_=0,w=0,x=0,k=0,C=!1,S=!1,M=1,E=[];function T(n){var l=n[d+0],h=n[d+6];if(!(m<e(l,h)||m>i(l,h))){var p=n[u+0],_=n[u+2],w=n[u+4],S=n[u+6];if(l!==h){var T=m===l?0:m===h||v>i(p,_,w,S)||y<e(p,_,w,S)?1:I.solveCubic(n,d,m,E,0,1)>0?E[0]:1,P=0===T?p:1===T?S:I.getPoint(n,T)[s?"y":"x"],A=l>h?1:-1,N=c[d]>c[d+6]?1:-1,L=c[u+6];return m!==l?(P<v?x+=A:P>y?k+=A:C=!0,P>f-g&&P<f+g&&(M/=2)):(A!==N?p<v?x+=A:p>y&&(k+=A):p!=L&&(L<y&&P>y?(k+=A,C=!0):L>v&&P<v&&(x+=A,C=!0)),M/=4),c=n,!o&&P>v&&P<y&&0===I.getTangent(n,T)[s?"x":"y"]&&b(t,r,!s,a,!0)}(p<y&&S>v||S<y&&p>v)&&(C=!0)}}function P(t){var n=t[d+0],r=t[d+2],a=t[d+4],o=t[d+6];if(m<=i(n,r,a,o)&&m>=e(n,r,a,o))for(var c,l=t[u+0],h=t[u+2],p=t[u+4],f=t[u+6],g=v>i(l,h,p,f)||y<e(l,h,p,f)?[t]:I.getMonoCurves(t,s),b=0,_=g.length;b<_;b++)if(c=T(g[b]))return c}for(var A=0,N=h.length;A<N;A++){var L,O=h[A],B=O._path,D=O.getValues();if(!(A&&h[A-1]._path===B||(c=null,B._closed||(l=I.getValues(B.getLastCurve().getSegment2(),O.getSegment1(),null,!a))[d]!==l[d+6]&&(c=l),c))){c=D;for(var R=B.getLastCurve();R&&R!==O;){var z=R.getValues();if(z[d]!==z[d+6]){c=z;break}R=R.getPrevious()}}if(L=P(D))return L;if(A+1===N||h[A+1]._path!==B){if(l&&(L=P(l)))return L;!C||x||k||(x=k=B.isClockwise(a)^s?1:-1),_+=x,w+=k,x=k=0,C&&(S=!0,C=!1),l=null}}return _=n(_),w=n(w),{winding:i(_,w),windingL:_,windingR:w,quality:M,onPath:S}}function y(e,t,i,r,s){var a=[],o=e,c=0;do{if(y=e.getCurve()){var l=y.getLength();a.push({segment:e,curve:y,length:l}),c+=l}e=e.getNext()}while(e&&!e._intersection&&e!==o);for(var u=[.5,.25,.75],d={winding:0,quality:-1},p=0;p<u.length&&d.quality<.5;p++){l=c*u[p];for(var f=0,m=a.length;f<m;f++){var g=a[f],v=g.length;if(l<=v){var y,_=(y=g.curve)._path,w=_._parent,x=w instanceof B?w:_,k=h.clamp(y.getTimeAt(l),.001,.999),C=y.getPointAtTime(k),S=n(y.getTangentAtTime(k).y)<Math.SQRT1_2,M=null;if(s.subtract&&i){var E=(x===t?i:t)._getWinding(C,S,!0);if(x===t&&E.winding||x===i&&!E.winding){if(E.quality<1)continue;M={winding:0,quality:1}}}(M=M||b(C,r[_._id][y.getIndex()],S,!0)).quality>d.quality&&(d=M);break}l-=v}}for(f=a.length-1;f>=0;f--)a[f].segment._winding=d}function _(e,t){var i,n=[];function r(e){var i;return!(!e||e._visited||t&&(!t[(i=e._winding||{}).winding]||t.unite&&2===i.winding&&i.windingL&&i.windingR))}function s(e){if(e)for(var t=0,n=i.length;t<n;t++)if(e===i[t])return!0;return!1}function a(e){for(var t=e._segments,i=0,n=t.length;i<n;i++)t[i]._visited=!0}function o(e,t){var n=e._intersection,a=n,o=[];function c(n,a){for(;n&&n!==a;){var c=n._segment,l=c&&c._path;if(l){var h=c.getNext()||l.getFirstSegment(),u=h._intersection;c!==e&&(s(c)||s(h)||h&&r(c)&&(r(h)||u&&r(u._segment)))&&o.push(c),t&&i.push(c)}n=n._next}}if(t&&(i=[e]),n){for(c(n);n&&n._previous;)n=n._previous;c(n,a)}return o}e.sort((function(e,t){var i=e._intersection,n=t._intersection,r=!(!i||!i._overlap),s=!(!n||!n._overlap),a=e._path,o=t._path;return r^s?r?1:-1:!i^!n?i?1:-1:a!==o?a._id-o._id:e._index-t._index}));for(var c=0,l=e.length;c<l;c++){var h,u,d,p=e[c],f=r(p),m=null,g=!1,v=!0,b=[];if(f&&p._path._overlapsOnly){var y=p._path,_=p._intersection._segment._path;y.compare(_)&&(y.getArea()&&n.push(y.clone(!1)),a(y),a(_),f=!1)}for(;f;){var x=!m,k=o(p,x),C=k.shift(),S=!(g=!x&&(s(p)||s(C)))&&C;if(x&&(m=new O(w.NO_INSERT),h=null),g){(p.isFirst()||p.isLast())&&(v=p._path._closed),p._visited=!0;break}if(S&&h&&(b.push(h),h=null),h||(S&&k.push(p),h={start:m._segments.length,crossings:k,visited:u=[],handleIn:d}),S&&(p=C),!r(p)){m.removeSegments(h.start);for(var M=0,E=u.length;M<E;M++)u[M]._visited=!1;u.length=0;do{(p=h&&h.crossings.shift())&&p._path||(p=null,(h=b.pop())&&(u=h.visited,d=h.handleIn))}while(h&&!r(p));if(!p)break}var T=p.getNext();m.add(new P(p._point,d,T&&p._handleOut)),p._visited=!0,u.push(p),p=T||p._path.getFirstSegment(),d=T&&T._handleIn}g&&(v&&(m.getFirstSegment().setHandleIn(d),m.setClosed(v)),0!==m.getArea()&&n.push(m))}return n}return{_getWinding:function(e,t,i){return b(e,this.getCurves(),t,i)},unite:function(e,t){return d(this,e,"unite",t)},intersect:function(e,t){return d(this,e,"intersect",t)},subtract:function(e,t){return d(this,e,"subtract",t)},exclude:function(e,t){return d(this,e,"exclude",t)},divide:function(e,t){return t&&(0==t.trace||t.stroke)?p(this,e,"divide"):l([this.subtract(e,t),this.intersect(e,t)],!0,this,e,t)},resolveCrossings:function(){var e=this._children,t=e||[this];function i(e,t){var i=e&&e._intersection;return i&&i._overlap&&i._path===t}var n=!1,s=!1,a=this.getIntersections(null,(function(e){return e.hasOverlap()&&(n=!0)||e.isCrossing()&&(s=!0)})),o=n&&s&&[];if(a=N.expand(a),n)for(var c=v(a,(function(e){return e.hasOverlap()}),o),l=c.length-1;l>=0;l--){var h=c[l],u=h._path,d=h._segment,p=d.getPrevious(),f=d.getNext();i(p,u)&&i(f,u)&&(d.remove(),p._handleOut._set(0,0),f._handleIn._set(0,0),p===d||p.getCurve().hasLength()||(f._handleIn.set(p._handleIn),p.remove()))}s&&(v(a,n&&function(e){var t=e.getCurve(),i=e.getSegment(),n=e._intersection,r=n._curve,s=n._segment;if(t&&r&&t._path&&r._path)return!0;i&&(i._intersection=null),s&&(s._intersection=null)},o),o&&m(o),t=_(r.each(t,(function(e){r.push(this,e._segments)}),[])));var g,b=t.length;return b>1&&e?(t!==e&&this.setChildren(t),g=this):1!==b||e||(t[0]!==this&&this.setSegments(t[0].removeSegments()),g=this),g||((g=new B(w.NO_INSERT)).addChildren(t),(g=g.reduce()).copyAttributes(this),this.replaceWith(g)),g},reorient:function(e,i){var n=this._children;return n&&n.length?this.setChildren(g(this.removeChildren(),(function(t){return!!(e?t:1&t)}),i)):i!==t&&this.setClockwise(i),this},getInteriorPoint:function(){var t=this.getBounds().getCenter(!0);if(!this.contains(t)){for(var n=this.getCurves(),r=t.y,s=[],a=[],o=0,c=n.length;o<c;o++){var l=n[o].getValues(),h=l[1],u=l[3],d=l[5],p=l[7];if(r>=e(h,u,d,p)&&r<=i(h,u,d,p))for(var f=I.getMonoCurves(l),m=0,g=f.length;m<g;m++){var v=f[m],b=v[1],y=v[7];if(b!==y&&(r>=b&&r<=y||r>=y&&r<=b)){var _=r===b?v[0]:r===y?v[6]:1===I.solveCubic(v,1,r,a,0,1)?I.getPoint(v,a[0]).x:(v[0]+v[6])/2;s.push(_)}}}s.length>1&&(s.sort((function(e,t){return e-t})),t.x=(s[0]+s[1])/2)}return t}}});var D=r.extend({_class:"PathFlattener",initialize:function(e,t,i,n,r){var s,a=[],o=[],c=0,l=1/(i||32),h=e._segments,u=h[0];function d(e,t){var i=I.getValues(e,t,r);a.push(i),p(i,e._index,0,1)}function p(e,i,r,s){if(!(s-r>l)||n&&I.isStraight(e)||I.isFlatEnough(e,t||.25)){var a=e[6]-e[0],h=e[7]-e[1],u=Math.sqrt(a*a+h*h);u>0&&(c+=u,o.push({offset:c,curve:e,index:i,time:s}))}else{var d=I.subdivide(e,.5),f=(r+s)/2;p(d[0],i,r,f),p(d[1],i,f,s)}}for(var f=1,m=h.length;f<m;f++)d(u,s=h[f]),u=s;e._closed&&d(s||u,h[0]),this.curves=a,this.parts=o,this.length=c,this.index=0},_get:function(e){for(var t,i=this.parts,n=i.length,r=this.index;t=r,r&&!(i[--r].offset<e););for(;t<n;t++){var s=i[t];if(s.offset>=e){this.index=t;var a=i[t-1],o=a&&a.index===s.index?a.time:0,c=a?a.offset:0;return{index:s.index,time:o+(s.time-o)*(e-c)/(s.offset-c)}}}return{index:i[n-1].index,time:1}},drawPart:function(e,t,i){for(var n=this._get(t),r=this._get(i),s=n.index,a=r.index;s<=a;s++){var o=I.getPart(this.curves[s],s===n.index?n.time:0,s===r.index?r.time:1);s===n.index&&e.moveTo(o[0],o[1]),e.bezierCurveTo.apply(e,o.slice(2))}}},r.each(I._evaluateMethods,(function(e){this[e+"At"]=function(t){var i=this._get(t);return I[e](this.curves[i.index],i.time)}}),{})),R=r.extend({initialize:function(e){for(var t,i=this.points=[],n=e._segments,r=e._closed,s=0,a=n.length;s<a;s++){var o=n[s].point;t&&t.equals(o)||i.push(t=o.clone())}r&&(i.unshift(i[i.length-1]),i.push(i[1])),this.closed=r},fit:function(e){var t=this.points,i=t.length,n=null;return i>0&&(n=[new P(t[0])],i>1&&(this.fitCubic(n,e,0,i-1,t[1].subtract(t[0]),t[i-2].subtract(t[i-1])),this.closed&&(n.shift(),n.pop()))),n},fitCubic:function(e,t,i,n,r,s){var a=this.points;if(n-i!=1){for(var o,c=this.chordLengthParameterize(i,n),l=Math.max(t,t*t),h=!0,u=0;u<=4;u++){var d=this.generateBezier(i,n,c,r,s),p=this.findMaxError(i,n,d,c);if(p.error<t&&h)return void this.addCurve(e,d);if(o=p.index,p.error>=l)break;h=this.reparameterize(i,n,c,d),l=p.error}var f=a[o-1].subtract(a[o+1]);this.fitCubic(e,t,i,o,r,f),this.fitCubic(e,t,o,n,f.negate(),s)}else{var m=a[i],g=a[n],v=m.getDistance(g)/3;this.addCurve(e,[m,m.add(r.normalize(v)),g.add(s.normalize(v)),g])}},addCurve:function(e,t){e[e.length-1].setHandleOut(t[1].subtract(t[0])),e.push(new P(t[3],t[2].subtract(t[3])))},generateBezier:function(e,t,i,n,r){for(var s=1e-12,a=Math.abs,o=this.points,c=o[e],l=o[t],h=[[0,0],[0,0]],u=[0,0],d=0,p=t-e+1;d<p;d++){var f=i[d],m=1-f,g=3*f*m,v=m*m*m,b=g*m,y=g*f,_=f*f*f,w=n.normalize(b),x=r.normalize(y),k=o[e+d].subtract(c.multiply(v+b)).subtract(l.multiply(y+_));h[0][0]+=w.dot(w),h[0][1]+=w.dot(x),h[1][0]=h[0][1],h[1][1]+=x.dot(x),u[0]+=w.dot(k),u[1]+=x.dot(k)}var C,S,M=h[0][0]*h[1][1]-h[1][0]*h[0][1];if(a(M)>s){var E=h[0][0]*u[1]-h[1][0]*u[0];C=(u[0]*h[1][1]-u[1]*h[0][1])/M,S=E/M}else{var T=h[0][0]+h[0][1],P=h[1][0]+h[1][1];C=S=a(T)>s?u[0]/T:a(P)>s?u[1]/P:0}var A,I,N=l.getDistance(c),L=s*N;if(C<L||S<L)C=S=N/3;else{var O=l.subtract(c);A=n.normalize(C),I=r.normalize(S),A.dot(O)-I.dot(O)>N*N&&(C=S=N/3,A=I=null)}return[c,c.add(A||n.normalize(C)),l.add(I||r.normalize(S)),l]},reparameterize:function(e,t,i,n){for(var r=e;r<=t;r++)i[r-e]=this.findRoot(n,this.points[r],i[r-e]);r=1;for(var s=i.length;r<s;r++)if(i[r]<=i[r-1])return!1;return!0},findRoot:function(e,t,i){for(var n=[],r=[],s=0;s<=2;s++)n[s]=e[s+1].subtract(e[s]).multiply(3);for(s=0;s<=1;s++)r[s]=n[s+1].subtract(n[s]).multiply(2);var a=this.evaluate(3,e,i),o=this.evaluate(2,n,i),c=this.evaluate(1,r,i),l=a.subtract(t),u=o.dot(o)+l.dot(c);return h.isMachineZero(u)?i:i-l.dot(o)/u},evaluate:function(e,t,i){for(var n=t.slice(),r=1;r<=e;r++)for(var s=0;s<=e-r;s++)n[s]=n[s].multiply(1-i).add(n[s+1].multiply(i));return n[0]},chordLengthParameterize:function(e,t){for(var i=[0],n=e+1;n<=t;n++)i[n-e]=i[n-e-1]+this.points[n].getDistance(this.points[n-1]);n=1;for(var r=t-e;n<=r;n++)i[n]/=i[r];return i},findMaxError:function(e,t,i,n){for(var r=Math.floor((t-e+1)/2),s=0,a=e+1;a<t;a++){var o=this.evaluate(3,i,n[a-e]).subtract(this.points[a]),c=o.x*o.x+o.y*o.y;c>=s&&(s=c,r=a)}return{error:s,index:r}}}),z=w.extend({_class:"TextItem",_applyMatrix:!1,_canApplyMatrix:!1,_serializeFields:{content:null},_boundsOptions:{stroke:!1,handle:!1},initialize:function(e){this._content="",this._lines=[];var i=e&&r.isPlainObject(e)&&e.x===t&&e.y===t;this._initialize(i&&e,!i&&d.read(arguments))},_equals:function(e){return this._content===e._content},copyContent:function(e){this.setContent(e._content)},getContent:function(){return this._content},setContent:function(e){this._content=""+e,this._lines=this._content.split(/\r\n|\n|\r/gm),this._changed(521)},isEmpty:function(){return!this._content},getCharacterStyle:"#getStyle",setCharacterStyle:"#setStyle",getParagraphStyle:"#getStyle",setParagraphStyle:"#setStyle"}),V=z.extend({_class:"PointText",initialize:function(){z.apply(this,arguments)},getPoint:function(){var e=this._matrix.getTranslation();return new p(e.x,e.y,this,"setPoint")},setPoint:function(){var e=d.read(arguments);this.translate(e.subtract(this._matrix.getTranslation()))},_draw:function(e,t,i){if(this._content){this._setStyles(e,t,i);var n=this._lines,r=this._style,s=r.hasFill(),a=r.hasStroke(),o=r.getLeading(),c=e.shadowColor;e.font=r.getFontStyle(),e.textAlign=r.getJustification();for(var l=0,h=n.length;l<h;l++){e.shadowColor=c;var u=n[l];s&&(e.fillText(u,0,0),e.shadowColor="rgba(0,0,0,0)"),a&&e.strokeText(u,0,0),e.translate(0,o)}}},_getBounds:function(e,t){var i=this._style,n=this._lines,r=n.length,s=i.getJustification(),a=i.getLeading(),o=this.getView().getTextWidth(i.getFontStyle(),n),c=0;"left"!==s&&(c-=o/("center"===s?2:1));var l=new g(c,r?-.75*a:0,o,r*a);return e?e._transformBounds(l,l):l}}),q=r.extend(new function(){var e,t={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"],gradient:["gradient","origin","destination","highlight"]},n={},s={transparent:[0,0,0,0]},a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],o={"rgb-hsb":function(e,t,i){var n=Math.max(e,t,i),r=n-Math.min(e,t,i);return[0===r?0:60*(n==e?(t-i)/r+(t<i?6:0):n==t?(i-e)/r+2:(e-t)/r+4),0===n?0:r/n,n]},"hsb-rgb":function(e,t,i){var n,r=(e=(e/60%6+6)%6)-(n=Math.floor(e)),s=[i,i*(1-t),i*(1-t*r),i*(1-t*(1-r))];return[s[(n=a[n])[0]],s[n[1]],s[n[2]]]},"rgb-hsl":function(e,t,i){var n=Math.max(e,t,i),r=Math.min(e,t,i),s=n-r,a=0===s,o=(n+r)/2;return[a?0:60*(n==e?(t-i)/s+(t<i?6:0):n==t?(i-e)/s+2:(e-t)/s+4),a?0:o<.5?s/(n+r):s/(2-n-r),o]},"hsl-rgb":function(e,t,i){if(0===t)return[i,i,i];for(var n=[(e=(e/360%1+1)%1)+1/3,e,e-1/3],r=i<.5?i*(1+t):i+t-i*t,s=2*i-r,a=[],o=0;o<3;o++){var c=n[o];c<0&&(c+=1),c>1&&(c-=1),a[o]=6*c<1?s+6*(r-s)*c:2*c<1?r:3*c<2?s+(r-s)*(2/3-c)*6:s}return a},"rgb-gray":function(e,t,i){return[.2989*e+.587*t+.114*i]},"gray-rgb":function(e){return[e,e,e]},"gray-hsb":function(e){return[0,0,e]},"gray-hsl":function(e){return[0,0,e]},"gradient-rgb":function(){return[]},"rgb-gradient":function(){return[]}};return r.each(t,(function(e,i){n[i]=[],r.each(e,(function(e,s){var a=r.capitalize(e),o=/^(hue|saturation)$/.test(e),c=n[i][s]="gradient"===i?"gradient"===e?function(e){var t=this._components[0];return t!==(e=F.read(Array.isArray(e)?e:arguments,0,{readNull:!0}))&&(t&&t._removeOwner(this),e&&e._addOwner(this)),e}:function(){return d.read(arguments,0,{readNull:"highlight"===e,clone:!0})}:function(e){return null==e||isNaN(e)?0:+e};this["get"+a]=function(){return this._type===i||o&&/^hs[bl]$/.test(this._type)?this._components[s]:this._convert(i)[s]},this["set"+a]=function(e){this._type===i||o&&/^hs[bl]$/.test(this._type)||(this._components=this._convert(i),this._properties=t[i],this._type=i),this._components[s]=c.call(this,e),this._changed()}}),this)}),{_class:"Color",_readIndex:!0,initialize:function a(o){var c,l,h,u,d=arguments,p=this.__read,f=0;Array.isArray(o)&&(o=(d=o)[0]);var m=null!=o&&typeof o;if("string"===m&&o in t&&(c=o,o=d[1],Array.isArray(o)?(l=o,h=d[2]):(p&&(f=1),d=r.slice(d,1),m=typeof o)),!l){if(u="number"===m?d:"object"===m&&null!=o.length?o:null){c||(c=u.length>=3?"rgb":"gray");var g=t[c].length;h=u[g],p&&(f+=u===arguments?g+(null!=h?1:0):1),u.length>g&&(u=r.slice(u,0,g))}else if("string"===m){var v=function(t){var n,r=t.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})([\da-f]{2})?$/i)||t.match(/^#([\da-f])([\da-f])([\da-f])([\da-f])?$/i),a="rgb";if(r){var o=r[4]?4:3;n=new Array(o);for(var c=0;c<o;c++){var l=r[c+1];n[c]=parseInt(1==l.length?l+l:l,16)/255}}else if(r=t.match(/^(rgb|hsl)a?\((.*)\)$/)){a=r[1],n=r[2].trim().split(/[,\s]+/g);for(var h="hsl"===a,u=(c=0,Math.min(n.length,4));c<u;c++){var d=n[c];if(l=parseFloat(d),h)if(0===c){var p=d.match(/([a-z]*)$/)[1];l*={turn:360,rad:180/Math.PI,grad:.9}[p]||1}else c<3&&(l/=100);else c<3&&(l/=/%$/.test(d)?100:255);n[c]=l}}else{var f=s[t];if(!f)if(i){e||((e=ie.getContext(1,1,{willReadFrequently:!0})).globalCompositeOperation="copy"),e.fillStyle="rgba(0,0,0,0)",e.fillStyle=t,e.fillRect(0,0,1,1);var m=e.getImageData(0,0,1,1).data;f=s[t]=[m[0]/255,m[1]/255,m[2]/255]}else f=[0,0,0];n=f.slice()}return[a,n]}(o);c=v[0],4===(l=v[1]).length&&(h=l[3],l.length--)}else if("object"===m)if(o.constructor===a){if(c=o._type,l=o._components.slice(),h=o._alpha,"gradient"===c)for(var b=1,y=l.length;b<y;b++){var _=l[b];_&&(l[b]=_.clone())}}else if(o.constructor===F)c="gradient",u=d;else{var w=t[c="hue"in o?"lightness"in o?"hsl":"hsb":"gradient"in o||"stops"in o||"radial"in o?"gradient":"gray"in o?"gray":"rgb"],x=n[c];for(this._components=l=[],b=0,y=w.length;b<y;b++)null==(k=o[w[b]])&&!b&&"gradient"===c&&"stops"in o&&(k={stops:o.stops,radial:o.radial}),null!=(k=x[b].call(this,k))&&(l[b]=k);h=o.alpha}p&&c&&(f=1)}if(this._type=c||"rgb",!l)for(this._components=l=[],b=0,y=(x=n[this._type]).length;b<y;b++){var k;null!=(k=x[b].call(this,u&&u[b]))&&(l[b]=k)}return this._components=l,this._properties=t[this._type],this._alpha=h,p&&(this.__read=f),this},set:"#initialize",_serialize:function(e,t){var i=this.getComponents();return r.serialize(/^(gray|rgb)$/.test(this._type)?i:[this._type].concat(i),e,!0,t)},_changed:function(){this._canvasStyle=null,this._owner&&(this._setter?this._owner[this._setter](this):this._owner._changed(129))},_convert:function(e){var t;return this._type===e?this._components.slice():(t=o[this._type+"-"+e])?t.apply(this,this._components):o["rgb-"+e].apply(this,o[this._type+"-rgb"].apply(this,this._components))},convert:function(e){return new q(e,this._convert(e),this._alpha)},getType:function(){return this._type},setType:function(e){this._components=this._convert(e),this._properties=t[e],this._type=e},getComponents:function(){var e=this._components.slice();return null!=this._alpha&&e.push(this._alpha),e},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(e){this._alpha=null==e?null:Math.min(Math.max(e,0),1),this._changed()},hasAlpha:function(){return null!=this._alpha},equals:function(e){var t=r.isPlainValue(e,!0)?q.read(arguments):e;return t===this||t&&this._class===t._class&&this._type===t._type&&this.getAlpha()===t.getAlpha()&&r.equals(this._components,t._components)||!1},toString:function(){for(var e=this._properties,t=[],i="gradient"===this._type,n=l.instance,r=0,s=e.length;r<s;r++){var a=this._components[r];null!=a&&t.push(e[r]+": "+(i?a:n.number(a)))}return null!=this._alpha&&t.push("alpha: "+n.number(this._alpha)),"{ "+t.join(", ")+" }"},toCSS:function(e){var t=this._convert("rgb"),i=e||null==this._alpha?1:this._alpha;function n(e){return Math.round(255*(e<0?0:e>1?1:e))}return t=[n(t[0]),n(t[1]),n(t[2])],i<1&&t.push(i<0?0:i),e?"#"+((1<<24)+(t[0]<<16)+(t[1]<<8)+t[2]).toString(16).slice(1):(4==t.length?"rgba(":"rgb(")+t.join(",")+")"},toCanvasStyle:function(e,t){if(this._canvasStyle)return this._canvasStyle;if("gradient"!==this._type)return this._canvasStyle=this.toCSS();var i,n=this._components,r=n[0],s=r._stops,a=n[1],o=n[2],c=n[3],l=t&&t.inverted();if(l&&(a=l._transformPoint(a),o=l._transformPoint(o),c&&(c=l._transformPoint(c))),r._radial){var h=o.getDistance(a);if(c){var u=c.subtract(a);u.getLength()>h&&(c=a.add(u.normalize(h-.1)))}var d=c||a;i=e.createRadialGradient(d.x,d.y,0,a.x,a.y,h)}else i=e.createLinearGradient(a.x,a.y,o.x,o.y);for(var p=0,f=s.length;p<f;p++){var m=s[p],g=m._offset;i.addColorStop(null==g?p/(f-1):g,m._color.toCanvasStyle())}return this._canvasStyle=i},transform:function(e){if("gradient"===this._type){for(var t=this._components,i=1,n=t.length;i<n;i++){var r=t[i];e._transformPoint(r,r,!0)}this._changed()}},statics:{_types:t,random:function(){var e=Math.random;return new q(e(),e(),e())},_setOwner:function(e,t,i){return e&&(e._owner&&t&&e._owner!==t&&(e=e.clone()),!e._owner^!t&&(e._owner=t||null,e._setter=i||null)),e}}})},new function(){return r.each({add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(e,t){return e*t},divide:function(e,t){return e/t}},(function(e,t){this[t]=function(t){t=q.read(arguments);for(var i=this._type,n=this._components,r=t._convert(i),s=0,a=n.length;s<a;s++)r[s]=e(n[s],r[s]);return new q(i,r,null!=this._alpha?e(this._alpha,t.getAlpha()):null)}}),{})}),F=r.extend({_class:"Gradient",initialize:function(e,t){this._id=u.get(),e&&r.isPlainObject(e)&&(this.set(e),e=t=null),null==this._stops&&this.setStops(e||["white","black"]),null==this._radial&&this.setRadial("string"==typeof t&&"radial"===t||t||!1)},_serialize:function(e,t){return t.add(this,(function(){return r.serialize([this._stops,this._radial],e,!0,t)}))},_changed:function(){for(var e=0,t=this._owners&&this._owners.length;e<t;e++)this._owners[e]._changed()},_addOwner:function(e){this._owners||(this._owners=[]),this._owners.push(e)},_removeOwner:function(e){var i=this._owners?this._owners.indexOf(e):-1;-1!=i&&(this._owners.splice(i,1),this._owners.length||(this._owners=t))},clone:function(){for(var e=[],t=0,i=this._stops.length;t<i;t++)e[t]=this._stops[t].clone();return new F(e,this._radial)},getStops:function(){return this._stops},setStops:function(e){if(e.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");var i=this._stops;if(i)for(var n=0,r=i.length;n<r;n++)i[n]._owner=t;for(n=0,r=(i=this._stops=j.readList(e,0,{clone:!0})).length;n<r;n++)i[n]._owner=this;this._changed()},getRadial:function(){return this._radial},setRadial:function(e){this._radial=e,this._changed()},equals:function(e){if(e===this)return!0;if(e&&this._class===e._class){var t=this._stops,i=e._stops,n=t.length;if(n===i.length){for(var r=0;r<n;r++)if(!t[r].equals(i[r]))return!1;return!0}}return!1}}),j=r.extend({_class:"GradientStop",initialize:function(e,i){var n=e,r=i;"object"==typeof e&&i===t&&(Array.isArray(e)&&"number"!=typeof e[0]?(n=e[0],r=e[1]):("color"in e||"offset"in e||"rampPoint"in e)&&(n=e.color,r=e.offset||e.rampPoint||0)),this.setColor(n),this.setOffset(r)},clone:function(){return new j(this._color.clone(),this._offset)},_serialize:function(e,t){var i=this._color,n=this._offset;return r.serialize(null==n?[i]:[i,n],e,!0,t)},_changed:function(){this._owner&&this._owner._changed(129)},getOffset:function(){return this._offset},setOffset:function(e){this._offset=e,this._changed()},getRampPoint:"#getOffset",setRampPoint:"#setOffset",getColor:function(){return this._color},setColor:function(){q._setOwner(this._color,null),this._color=q._setOwner(q.read(arguments,0),this,"setColor"),this._changed()},equals:function(e){return e===this||e&&this._class===e._class&&this._color.equals(e._color)&&this._offset==e._offset||!1}}),H=r.extend(new function(){var e={fillColor:null,fillRule:"nonzero",strokeColor:null,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",strokeScaling:!0,miterLimit:10,dashOffset:0,dashArray:[],shadowColor:null,shadowBlur:0,shadowOffset:new d,selectedColor:null},i=r.set({},e,{fontFamily:"sans-serif",fontWeight:"normal",fontSize:12,leading:null,justification:"left"}),n=r.set({},i,{fillColor:new q}),s={strokeWidth:193,strokeCap:193,strokeJoin:193,strokeScaling:201,miterLimit:193,fontFamily:9,fontWeight:9,fontSize:9,font:9,leading:9,justification:9},a={beans:!0},o={_class:"Style",beans:!0,initialize:function(t,r,s){this._values={},this._owner=r,this._project=r&&r._project||s||ae.project,this._defaults=!r||r instanceof x?i:r instanceof z?n:e,t&&this.set(t)}};return r.each(i,(function(e,i){var n=/Color$/.test(i),c="shadowOffset"===i,l=r.capitalize(i),h=s[i],u="set"+l,p="get"+l;o[u]=function(e){var t=this._owner,r=t&&t._children,s=r&&r.length>0&&!(t instanceof B);if(s)for(var a=0,o=r.length;a<o;a++)r[a]._style[u](e);if(("selectedColor"===i||!s)&&i in this._defaults){var c=this._values[i];c!==e&&(n&&(c&&(q._setOwner(c,null),c._canvasStyle=null),e&&e.constructor===q&&(e=q._setOwner(e,t,s&&u))),this._values[i]=e,t&&t._changed(h||129))}},o[p]=function(e){var s=this._owner,a=s&&s._children,o=a&&a.length>0&&!(s instanceof B);if(o&&!e)for(var l=0,h=a.length;l<h;l++){var f=a[l]._style[p]();if(l){if(!r.equals(m,f))return t}else m=f}else if(i in this._defaults){var m;if((m=this._values[i])===t)(m=this._defaults[i])&&m.clone&&(m=m.clone());else{var g=n?q:c?d:null;!g||m&&m.constructor===g||(this._values[i]=m=g.read([m],0,{readNull:!0,clone:!0}))}}return m&&n&&(m=q._setOwner(m,s,o&&u)),m},a[p]=function(e){return this._style[p](e)},a[u]=function(e){this._style[u](e)}})),r.each({Font:"FontFamily",WindingRule:"FillRule"},(function(e,t){var i="get"+t,n="set"+t;o[i]=a[i]="#get"+e,o[n]=a[n]="#set"+e})),w.inject(a),o},{set:function(e){var t=e instanceof H,i=t?e._values:e;if(i)for(var n in i)if(n in this._defaults){var r=i[n];this[n]=r&&t&&r.clone?r.clone():r}},equals:function(e){function i(e,i,n){var s=e._values,a=i._values,o=i._defaults;for(var c in s){var l=s[c],h=a[c];if(!(n&&c in a||r.equals(l,h===t?o[c]:h)))return!1}return!0}return e===this||e&&this._class===e._class&&i(this,e)&&i(e,this,!0)||!1},_dispose:function(){var e;(e=this.getFillColor())&&(e._canvasStyle=null),(e=this.getStrokeColor())&&(e._canvasStyle=null),(e=this.getShadowColor())&&(e._canvasStyle=null)},hasFill:function(){var e=this.getFillColor();return!!e&&e.alpha>0},hasStroke:function(){var e=this.getStrokeColor();return!!e&&e.alpha>0&&this.getStrokeWidth()>0},hasShadow:function(){var e=this.getShadowColor();return!!e&&e.alpha>0&&(this.getShadowBlur()>0||!this.getShadowOffset().isZero())},getView:function(){return this._project._view},getFontStyle:function(){var e=this.getFontSize();return this.getFontWeight()+" "+e+(/[a-z]/i.test(e+"")?" ":"px ")+this.getFontFamily()},getFont:"#getFontFamily",setFont:"#setFontFamily",getLeading:function e(){var t=e.base.call(this),i=this.getFontSize();return/pt|em|%|px/.test(i)&&(i=this.getView().getPixelSize(i)),null!=t?t:1.2*i}}),G=new function(){function e(e,t,i,n){for(var r=["","webkit","moz","Moz","ms","o"],s=t[0].toUpperCase()+t.substring(1),a=0;a<6;a++){var o=r[a],c=o?o+s:t;if(c in e){if(!i)return e[c];e[c]=n;break}}}return{getStyles:function(e){var t=e&&9!==e.nodeType?e.ownerDocument:e,i=t&&t.defaultView;return i&&i.getComputedStyle(e,"")},getBounds:function(e,t){var i,n=e.ownerDocument,r=n.body,s=n.documentElement;try{i=e.getBoundingClientRect()}catch(l){i={left:0,top:0,width:0,height:0}}var a=i.left-(s.clientLeft||r.clientLeft||0),o=i.top-(s.clientTop||r.clientTop||0);if(!t){var c=n.defaultView;a+=c.pageXOffset||s.scrollLeft||r.scrollLeft,o+=c.pageYOffset||s.scrollTop||r.scrollTop}return new g(a,o,i.width,i.height)},getViewportBounds:function(e){var t=e.ownerDocument,i=t.defaultView,n=t.documentElement;return new g(0,0,i.innerWidth||n.clientWidth,i.innerHeight||n.clientHeight)},getOffset:function(e,t){return G.getBounds(e,t).getPoint()},getSize:function(e){return G.getBounds(e,!0).getSize()},isInvisible:function(e){return G.getSize(e).equals(new f(0,0))},isInView:function(e){return!G.isInvisible(e)&&G.getViewportBounds(e).intersects(G.getBounds(e,!0))},isInserted:function(e){return n.body.contains(e)},getPrefixed:function(t,i){return t&&e(t,i)},setPrefixed:function(t,i,n){if("object"==typeof i)for(var r in i)e(t,r,!0,i[r]);else e(t,i,!0,n)}}},U={add:function(e,t){if(e)for(var i in t)for(var r=t[i],s=i.split(/[\s,]+/g),a=0,o=s.length;a<o;a++){var c=s[a],l=e===n&&("touchstart"===c||"touchmove"===c)&&{passive:!1};e.addEventListener(c,r,l)}},remove:function(e,t){if(e)for(var i in t)for(var n=t[i],r=i.split(/[\s,]+/g),s=0,a=r.length;s<a;s++)e.removeEventListener(r[s],n,!1)},getPoint:function(e){var t=e.targetTouches?e.targetTouches.length?e.targetTouches[0]:e.changedTouches[0]:e;return new d(t.pageX||t.clientX+n.documentElement.scrollLeft,t.pageY||t.clientY+n.documentElement.scrollTop)},getTarget:function(e){return e.target||e.srcElement},getRelatedTarget:function(e){return e.relatedTarget||e.toElement},getOffset:function(e,t){return U.getPoint(e).subtract(G.getOffset(t||U.getTarget(e)))}};U.requestAnimationFrame=new function(){var e,t=G.getPrefixed(i,"requestAnimationFrame"),n=!1,r=[];function s(){var e=r;r=[];for(var i=0,a=e.length;i<a;i++)e[i]();(n=t&&r.length)&&t(s)}return function(i){r.push(i),t?n||(t(s),n=!0):e||(e=setInterval(s,1e3/60))}};var W=r.extend(s,{_class:"View",initialize:function e(t,r){function s(e){return r[e]||parseInt(r.getAttribute(e),10)}function o(){var e=G.getSize(r);return e.isNaN()||e.isZero()?new f(s("width"),s("height")):e}var c;if(i&&r){this._id=r.getAttribute("id"),null==this._id&&r.setAttribute("id",this._id="paper-view-"+e._id++),U.add(r,this._viewEvents);var l="none";if(G.setPrefixed(r.style,{userDrag:l,userSelect:l,touchCallout:l,contentZooming:l,tapHighlightColor:"rgba(0,0,0,0)"}),a.hasAttribute(r,"resize")){var h=this;U.add(i,this._windowEvents={resize:function(){h.setViewSize(o())}})}if(c=o(),a.hasAttribute(r,"stats")&&"undefined"!=typeof Stats){this._stats=new Stats;var u=this._stats.domElement,d=u.style,p=G.getOffset(r);d.position="absolute",d.left=p.x+"px",d.top=p.y+"px",n.body.appendChild(u)}}else c=new f(r),r=null;this._project=t,this._scope=t._scope,this._element=r,this._pixelRatio||(this._pixelRatio=i&&i.devicePixelRatio||1),this._setElementSize(c.width,c.height),this._viewSize=c,e._views.push(this),e._viewsById[this._id]=this,(this._matrix=new b)._owner=this,e._focused||(e._focused=this),this._frameItems={},this._frameItemCount=0,this._itemEvents={native:{},virtual:{}},this._autoUpdate=!ae.agent.node,this._needsUpdate=!1},remove:function(){if(!this._project)return!1;W._focused===this&&(W._focused=null),W._views.splice(W._views.indexOf(this),1),delete W._viewsById[this._id];var e=this._project;return e._view===this&&(e._view=null),U.remove(this._element,this._viewEvents),U.remove(i,this._windowEvents),this._element=this._project=null,this.off("frame"),this._animate=!1,this._frameItems={},!0},_events:r.each(w._itemHandlers.concat(["onResize","onKeyDown","onKeyUp"]),(function(e){this[e]={}}),{onFrame:{install:function(){this.play()},uninstall:function(){this.pause()}}}),_animate:!1,_time:0,_count:0,getAutoUpdate:function(){return this._autoUpdate},setAutoUpdate:function(e){this._autoUpdate=e,e&&this.requestUpdate()},update:function(){},draw:function(){this.update()},requestUpdate:function(){if(!this._requested){var e=this;U.requestAnimationFrame((function(){if(e._requested=!1,e._animate){e.requestUpdate();var t=e._element;G.getPrefixed(n,"hidden")&&"true"!==a.getAttribute(t,"keepalive")||!G.isInView(t)||e._handleFrame()}e._autoUpdate&&e.update()})),this._requested=!0}},play:function(){this._animate=!0,this.requestUpdate()},pause:function(){this._animate=!1},_handleFrame:function(){ae=this._scope;var e=Date.now()/1e3,t=this._last?e-this._last:0;this._last=e,this.emit("frame",new r({delta:t,time:this._time+=t,count:this._count++})),this._stats&&this._stats.update()},_animateItem:function(e,t){var i=this._frameItems;t?(i[e._id]={item:e,time:0,count:0},1==++this._frameItemCount&&this.on("frame",this._handleFrameItems)):(delete i[e._id],0==--this._frameItemCount&&this.off("frame",this._handleFrameItems))},_handleFrameItems:function(e){for(var t in this._frameItems){var i=this._frameItems[t];i.item.emit("frame",new r(e,{time:i.time+=e.delta,count:i.count++}))}},_changed:function(){this._project._changed(4097),this._bounds=this._decomposed=t},getElement:function(){return this._element},getPixelRatio:function(){return this._pixelRatio},getResolution:function(){return 72*this._pixelRatio},getViewSize:function(){var e=this._viewSize;return new m(e.width,e.height,this,"setViewSize")},setViewSize:function(){var e=f.read(arguments),t=e.subtract(this._viewSize);t.isZero()||(this._setElementSize(e.width,e.height),this._viewSize.set(e),this._changed(),this.emit("resize",{size:e,delta:t}),this._autoUpdate&&this.update())},_setElementSize:function(e,t){var i=this._element;i&&(i.width!==e&&(i.width=e),i.height!==t&&(i.height=t))},getBounds:function(){return this._bounds||(this._bounds=this._matrix.inverted()._transformBounds(new g(new d,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},isVisible:function(){return G.isInView(this._element)},isInserted:function(){return G.isInserted(this._element)},getPixelSize:function(e){var t,i=this._element;if(i){var r=i.parentNode,s=n.createElement("div");s.style.fontSize=e,r.appendChild(s),t=parseFloat(G.getStyles(s).fontSize),r.removeChild(s)}else t=parseFloat(t);return t},getTextWidth:function(e,t){return 0}},r.each(["rotate","scale","shear","skew"],(function(e){var t="rotate"===e;this[e]=function(){var i=arguments,n=(t?r:d).read(i),s=d.read(i,0,{readNull:!0});return this.transform((new b)[e](n,s||this.getCenter(!0)))}}),{_decompose:function(){return this._decomposed||(this._decomposed=this._matrix.decompose())},translate:function(){var e=new b;return this.transform(e.translate.apply(e,arguments))},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(){var e=d.read(arguments);this.translate(this.getCenter().subtract(e))},getZoom:function(){var e=this._decompose().scaling;return(e.x+e.y)/2},setZoom:function(e){this.transform((new b).scale(e/this.getZoom(),this.getCenter()))},getRotation:function(){return this._decompose().rotation},setRotation:function(e){var t=this.getRotation();null!=t&&null!=e&&this.rotate(e-t)},getScaling:function(){var e=this._decompose().scaling;return new p(e.x,e.y,this,"setScaling")},setScaling:function(){var e=this.getScaling(),t=d.read(arguments,0,{clone:!0,readNull:!0});e&&t&&this.scale(t.x/e.x,t.y/e.y)},getMatrix:function(){return this._matrix},setMatrix:function(){var e=this._matrix;e.set.apply(e,arguments)},transform:function(e){this._matrix.append(e)},scrollBy:function(){this.translate(d.read(arguments).negate())}}),{projectToView:function(){return this._matrix._transformPoint(d.read(arguments))},viewToProject:function(){return this._matrix._inverseTransform(d.read(arguments))},getEventPoint:function(e){return this.viewToProject(U.getOffset(e,this._element))}},{statics:{_views:[],_viewsById:{},_id:0,create:function(e,t){return n&&"string"==typeof t&&(t=n.getElementById(t)),new(i?Y:W)(e,t)}}},new function(){if(i){var e,t,r,s,a,o=!1,c=!1,l=i.navigator;l.pointerEnabled||l.msPointerEnabled?(r="pointerdown MSPointerDown",s="pointermove MSPointerMove",a="pointerup pointercancel MSPointerUp MSPointerCancel"):(r="touchstart",s="touchmove",a="touchend touchcancel","ontouchstart"in i&&l.userAgent.match(/mobile|tablet|ip(ad|hone|od)|android|silk/i)||(r+=" mousedown",s+=" mousemove",a+=" mouseup"));var h={},u={mouseout:function(e){var t=W._focused,i=U.getRelatedTarget(e);if(t&&(!i||"HTML"===i.nodeName)){var n=U.getOffset(e,t._element),r=n.x,s=Math.abs,a=s(r),o=a-(1<<25);n.x=s(o)<a?o*(r<0?-1:1):r,E(t,e,t.viewToProject(n))}},scroll:M};h[r]=function(e){var t=W._focused=S(e);o||(o=!0,t._handleMouseEvent("mousedown",e))},u[s]=function(i){var n=W._focused;if(!c){var r=S(i);r?n!==r&&(n&&E(n,i),e||(e=n),n=W._focused=t=r):t&&t===n&&(e&&!e.isInserted()&&(e=null),n=W._focused=e,e=null,M())}n&&E(n,i)},u[r]=function(){c=!0},u[a]=function(e){var t=W._focused;t&&o&&t._handleMouseEvent("mouseup",e),c=o=!1},U.add(n,u),U.add(i,{load:M});var d,p,f,m,g,v,b,y,_=!1,w=!1,x={doubleclick:"click",mousedrag:"mousemove"},k=!1,C={mousedown:{mousedown:1,mousedrag:1,click:1,doubleclick:1},mouseup:{mouseup:1,mousedrag:1,click:1,doubleclick:1},mousemove:{mousedrag:1,mousemove:1,mouseenter:1,mouseleave:1}};return{_viewEvents:h,_handleMouseEvent:function(e,t,i){var n=this._itemEvents,r=n.native[e],s="mousemove"===e,a=this._scope.tool,c=this;function l(e){return n.virtual[e]||c.responds(e)||a&&a.responds(e)}s&&o&&l("mousedrag")&&(e="mousedrag"),i||(i=this.getEventPoint(t));var h=this.getBounds().contains(i),u=r&&h&&c._project.hitTest(i,{tolerance:0,fill:!0,stroke:!0}),x=u&&u.item||null,C=!1,S={};if(S[e.substr(5)]=!0,r&&x!==m&&(m&&T(m,null,"mouseleave",t,i),x&&T(x,null,"mouseenter",t,i),m=x),k^h&&(T(this,null,h?"mouseenter":"mouseleave",t,i),C=!0),!h&&!S.drag||i.equals(p)||(P(this,x,s?e:"mousemove",t,i,p),C=!0),k=h,S.down&&h||S.up&&d){if(P(this,x,e,t,i,d),S.down){if(y=x===v&&Date.now()-b<300,f=v=x,!w&&x){for(var M=x;M&&!M.responds("mousedrag");)M=M._parent;M&&(g=x)}d=i}else S.up&&(w||x!==f||(b=Date.now(),P(this,x,y?"doubleclick":"click",t,i,d),y=!1),f=g=null);k=!1,C=!0}p=i,C&&a&&(_=a._handleMouseEvent(e,t,i,S)||_),!1!==t.cancelable&&(_&&!S.move||S.down&&l("mouseup"))&&t.preventDefault()},_handleKeyEvent:function(e,t,i,n){var r,s=this._scope,a=s.tool;function o(a){a.responds(e)&&(ae=s,a.emit(e,r=r||new K(e,t,i,n)))}this.isVisible()&&(o(this),a&&a.responds(e)&&o(a))},_countItemEvent:function(e,t){var i=this._itemEvents,n=i.native,r=i.virtual;for(var s in C)n[s]=(n[s]||0)+(C[s][e]||0)*t;r[e]=(r[e]||0)+t},statics:{updateFocus:M,_resetState:function(){o=c=_=k=!1,e=t=d=p=f=m=g=v=b=y=null}}}}function S(e){var t=U.getTarget(e);return t.getAttribute&&W._viewsById[t.getAttribute("id")]}function M(){var e=W._focused;if(!e||!e.isVisible())for(var i=0,n=W._views.length;i<n;i++)if((e=W._views[i]).isVisible()){W._focused=t=e;break}}function E(e,t,i){e._handleMouseEvent("mousemove",t,i)}function T(e,t,i,n,r,s,a){var o,c=!1;function l(e,i){if(e.responds(i)){if(o||(o=new Q(i,n,r,t||e,s?r.subtract(s):null)),e.emit(i,o)&&(_=!0,o.prevented&&(w=!0),o.stopped))return c=!0}else{var a=x[i];if(a)return l(e,a)}}for(;e&&e!==a&&!l(e,i);)e=e._parent;return c}function P(e,t,i,n,r,s){return e._project.removeOn(i),w=_=!1,g&&T(g,null,i,n,r,s)||t&&t!==g&&!t.isDescendant(g)&&T(t,null,"mousedrag"===i?"mousemove":i,n,r,s,g)||T(e,g||t||e,i,n,r,s)}}),Y=W.extend({_class:"CanvasView",initialize:function(e,t){if(!(t instanceof i.HTMLCanvasElement)){var n=f.read(arguments,1);if(n.isZero())throw new Error("Cannot create CanvasView with the provided argument: "+r.slice(arguments,1));t=ie.getCanvas(n)}var s=this._context=t.getContext("2d");if(s.save(),this._pixelRatio=1,!/^off|false$/.test(a.getAttribute(t,"hidpi"))){var o=i.devicePixelRatio||1,c=G.getPrefixed(s,"backingStorePixelRatio")||1;this._pixelRatio=o/c}W.call(this,e,t),this._needsUpdate=!0},remove:function e(){return this._context.restore(),e.base.call(this)},_setElementSize:function e(t,i){var n=this._pixelRatio;if(e.base.call(this,t*n,i*n),1!==n){var r=this._element,s=this._context;if(!a.hasAttribute(r,"resize")){var o=r.style;o.width=t+"px",o.height=i+"px"}s.restore(),s.save(),s.scale(n,n)}},getContext:function(){return this._context},getPixelSize:function e(t){var i,n=ae.agent;if(n&&n.firefox)i=e.base.call(this,t);else{var r=this._context,s=r.font;r.font=t+" serif",i=parseFloat(r.font),r.font=s}return i},getTextWidth:function(e,t){var i=this._context,n=i.font,r=0;i.font=e;for(var s=0,a=t.length;s<a;s++)r=Math.max(r,i.measureText(t[s]).width);return i.font=n,r},update:function(){if(!this._needsUpdate)return!1;var e=this._project,t=this._context,i=this._viewSize;return t.clearRect(0,0,i.width+1,i.height+1),e&&e.draw(t,this._matrix,this._pixelRatio),this._needsUpdate=!1,!0}}),$=r.extend({_class:"Event",initialize:function(e){this.event=e,this.type=e&&e.type},prevented:!1,stopped:!1,preventDefault:function(){this.prevented=!0,this.event.preventDefault()},stopPropagation:function(){this.stopped=!0,this.event.stopPropagation()},stop:function(){this.stopPropagation(),this.preventDefault()},getTimeStamp:function(){return this.event.timeStamp},getModifiers:function(){return X.modifiers}}),K=$.extend({_class:"KeyEvent",initialize:function(e,t,i,n){this.type=e,this.event=t,this.key=i,this.character=n},toString:function(){return"{ type: '"+this.type+"', key: '"+this.key+"', character: '"+this.character+"', modifiers: "+this.getModifiers()+" }"}}),X=new function(){var e,s,a={"\t":"tab"," ":"space","\b":"backspace","":"delete",Spacebar:"space",Del:"delete",Win:"meta",Esc:"escape"},o={tab:"\t",space:" ",enter:"\r"},c={},l={},h=new r({shift:!1,control:!1,alt:!1,meta:!1,capsLock:!1,space:!1}).inject({option:{get:function(){return this.alt}},command:{get:function(){var e=ae&&ae.agent;return e&&e.mac?this.meta:this.control}}});function u(e){var i=e.key||e.keyIdentifier;return i=/^U\+/.test(i)?String.fromCharCode(parseInt(i.substr(2),16)):/^Arrow[A-Z]/.test(i)?i.substr(5):"Unidentified"===i||i===t?String.fromCharCode(e.keyCode):i,a[i]||(i.length>1?r.hyphenate(i):i.toLowerCase())}function d(t,i,n,s){var a,o=W._focused;if(c[i]=t,t?l[i]=n:delete l[i],i.length>1&&(a=r.camelize(i))in h){h[a]=t;var u=ae&&ae.agent;if("meta"===a&&u&&u.mac)if(t)e={};else{for(var p in e)p in l&&d(!1,p,e[p],s);e=null}}else t&&e&&(e[i]=n);o&&o._handleKeyEvent(t?"keydown":"keyup",s,i,n)}return U.add(n,{keydown:function(e){var t=u(e),i=ae&&ae.agent;t.length>1||i&&i.chrome&&(e.altKey||i.mac&&e.metaKey||!i.mac&&e.ctrlKey)?d(!0,t,o[t]||(t.length>1?"":t),e):s=t},keypress:function(e){if(s){var t=u(e),i=e.charCode,n=i>=32?String.fromCharCode(i):t.length>1?"":t;t!==s&&(t=n.toLowerCase()),d(!0,t,n,e),s=null}},keyup:function(e){var t=u(e);t in l&&d(!1,t,l[t],e)}}),U.add(i,{blur:function(e){for(var t in l)d(!1,t,l[t],e)}}),{modifiers:h,isDown:function(e){return!!c[e]}}},Q=$.extend({_class:"MouseEvent",initialize:function(e,t,i,n,r){this.type=e,this.event=t,this.point=i,this.target=n,this.delta=r},toString:function(){return"{ type: '"+this.type+"', point: "+this.point+", target: "+this.target+(this.delta?", delta: "+this.delta:"")+", modifiers: "+this.getModifiers()+" }"}}),Z=$.extend({_class:"ToolEvent",_item:null,initialize:function(e,t,i){this.tool=e,this.type=t,this.event=i},_choosePoint:function(e,t){return e||(t?t.clone():null)},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(e){this._point=e},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(e){this._lastPoint=e},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(e){this._downPoint=e},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this._middlePoint},setMiddlePoint:function(e){this._middlePoint=e},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(e){this._delta=e},getCount:function(){return this.tool[/^mouse(down|up)$/.test(this.type)?"_downCount":"_moveCount"]},setCount:function(e){this.tool[/^mouse(down|up)$/.test(this.type)?"downCount":"count"]=e},getItem:function(){if(!this._item){var e=this.tool._scope.project.hitTest(this.getPoint());if(e){for(var t=e.item,i=t._parent;/^(Group|CompoundPath)$/.test(i._class);)t=i,i=i._parent;this._item=t}}return this._item},setItem:function(e){this._item=e},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),J=o.extend({_class:"Tool",_list:"tools",_reference:"tool",_events:["onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onActivate","onDeactivate","onEditOptions","onKeyDown","onKeyUp"],initialize:function(e){o.call(this),this._moveCount=-1,this._downCount=-1,this.set(e)},getMinDistance:function(){return this._minDistance},setMinDistance:function(e){this._minDistance=e,null!=e&&null!=this._maxDistance&&e>this._maxDistance&&(this._maxDistance=e)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(e){this._maxDistance=e,null!=this._minDistance&&null!=e&&e<this._minDistance&&(this._minDistance=e)},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(e){this._minDistance=this._maxDistance=e},_handleMouseEvent:function(e,t,i,n){ae=this._scope,n.drag&&!this.responds(e)&&(e="mousemove");var r=n.move||n.drag,s=this.responds(e),a=!1,o=this;function c(e,t){var s=i,a=r?o._point:o._downPoint||s;if(r){if(o._moveCount>=0&&s.equals(a))return!1;if(a&&(null!=e||null!=t)){var c=s.subtract(a),l=c.getLength();if(l<(e||0))return!1;t&&(s=a.add(c.normalize(Math.min(l,t))))}o._moveCount++}return o._point=s,o._lastPoint=a||s,n.down&&(o._moveCount=-1,o._downPoint=s,o._downCount++),!0}function l(){s&&(a=o.emit(e,new Z(o,e,t))||a)}if(n.down)c(),l();else if(n.up)c(null,this._maxDistance),l();else if(s)for(;c(this._minDistance,this._maxDistance);)l();return a}}),ee=r.extend(s,{_class:"Tween",statics:{easings:new r({linear:function(e){return e},easeInQuad:function(e){return e*e},easeOutQuad:function(e){return e*(2-e)},easeInOutQuad:function(e){return e<.5?2*e*e:2*(2-e)*e-1},easeInCubic:function(e){return e*e*e},easeOutCubic:function(e){return--e*e*e+1},easeInOutCubic:function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},easeInQuart:function(e){return e*e*e*e},easeOutQuart:function(e){return 1- --e*e*e*e},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},easeInQuint:function(e){return e*e*e*e*e},easeOutQuint:function(e){return 1+--e*e*e*e*e},easeInOutQuint:function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e}})},initialize:function e(t,i,n,r,s,a){this.object=t;var o=typeof s,c="function"===o;this.type=c?o:"string"===o?s:"linear",this.easing=c?s:e.easings[this.type],this.duration=r,this.running=!1,this._then=null,this._startTime=null;var l=i||n;this._keys=l?Object.keys(l):[],this._parsedKeys=this._parseKeys(this._keys),this._from=l&&this._getState(i),this._to=l&&this._getState(n),!1!==a&&this.start()},then:function(e){return this._then=e,this},start:function(){return this._startTime=null,this.running=!0,this},stop:function(){return this.running=!1,this},update:function(e){if(this.running){e>=1&&(e=1,this.running=!1);for(var t=this.easing(e),i=this._keys,n=function(i){return"function"==typeof i?i(t,e):i},s=0,a=i&&i.length;s<a;s++){var o=i[s],c=n(this._from[o]),l=n(this._to[o]),h=c&&l&&c.__add&&l.__add?l.__subtract(c).__multiply(t).__add(c):(l-c)*t+c;this._setProperty(this._parsedKeys[o],h)}this.responds("update")&&this.emit("update",new r({progress:e,factor:t})),!this.running&&this._then&&this._then(this.object)}return this},_events:{onUpdate:{}},_handleFrame:function(e){var t=this._startTime,i=t?(e-t)/this.duration:0;t||(this._startTime=e),this.update(i)},_getState:function(e){for(var t=this._keys,i={},n=0,r=t.length;n<r;n++){var s,a=t[n],o=this._parsedKeys[a],c=this._getProperty(o);if(e){var l=this._resolveValue(c,e[a]);this._setProperty(o,l),s=(s=this._getProperty(o))&&s.clone?s.clone():s,this._setProperty(o,c)}else s=c&&c.clone?c.clone():c;i[a]=s}return i},_resolveValue:function(e,t){if(t){if(Array.isArray(t)&&2===t.length){var i=t[0];return i&&i.match&&i.match(/^[+\-\*\/]=/)?this._calculate(e,i[0],t[1]):t}if("string"==typeof t){var n=t.match(/^[+\-*/]=(.*)/);if(n){var r=JSON.parse(n[1].replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,'"$2": '));return this._calculate(e,t[0],r)}}}return t},_calculate:function(e,t,i){return ae.PaperScript.calculateBinary(e,t,i)},_parseKeys:function(e){for(var t={},i=0,n=e.length;i<n;i++){var r=e[i],s=r.replace(/\.([^.]*)/g,"/$1").replace(/\[['"]?([^'"\]]*)['"]?\]/g,"/$1");t[r]=s.split("/")}return t},_getProperty:function(e,t){for(var i=this.object,n=0,r=e.length-(t||0);n<r&&i;n++)i=i[e[n]];return i},_setProperty:function(e,t){var i=this._getProperty(e,1);i&&(i[e[e.length-1]]=t)}}),te=function(t){var i=new e.XMLHttpRequest;return i.open((t.method||"get").toUpperCase(),t.url,r.pick(t.async,!0)),t.mimeType&&i.overrideMimeType(t.mimeType),i.onload=function(){var e=i.status;0===e||200===e?t.onLoad&&t.onLoad.call(i,i.responseText):i.onerror()},i.onerror=function(){var e=i.status,n='Could not load "'+t.url+'" (Status: '+e+")";if(!t.onError)throw new Error(n);t.onError(n,e)},i.send(null)},ie=r.exports.CanvasProvider={canvases:[],getCanvas:function(e,t,r){if(!i)return null;var s,a=!0;"object"==typeof e&&(t=e.height,e=e.width),this.canvases.length?s=this.canvases.pop():(s=n.createElement("canvas"),a=!1);var o=s.getContext("2d",r||{});if(!o)throw new Error("Canvas "+s+" is unable to provide a 2D context.");return s.width===e&&s.height===t?a&&o.clearRect(0,0,e+1,t+1):(s.width=e,s.height=t),o.save(),s},getContext:function(e,t,i){var n=this.getCanvas(e,t,i);return n?n.getContext("2d",i||{}):null},release:function(e){var t=e&&e.canvas?e.canvas:e;t&&t.getContext&&(t.getContext("2d").restore(),this.canvases.push(t))}},ne=new function(){var e,t,i,n,s,a,o,c,l,h,u,d=Math.min,p=Math.max,f=Math.abs;function m(e,t,i){return.2989*e+.587*t+.114*i}function g(e,t,i,n){var r=n-m(e,t,i),s=(n=m(l=e+r,h=t+r,u=i+r),d(l,h,u)),a=p(l,h,u);if(s<0){var o=n-s;l=n+(l-n)*n/o,h=n+(h-n)*n/o,u=n+(u-n)*n/o}if(a>255){var c=255-n,f=a-n;l=n+(l-n)*c/f,h=n+(h-n)*c/f,u=n+(u-n)*c/f}}function v(e,t,i){return p(e,t,i)-d(e,t,i)}function b(e,t,i,n){var r,s=[e,t,i],a=p(e,t,i),o=d(e,t,i);r=0===d(o=o===e?0:o===t?1:2,a=a===e?0:a===t?1:2)?1===p(o,a)?2:1:0,s[a]>s[o]?(s[r]=(s[r]-s[o])*n/(s[a]-s[o]),s[a]=n):s[r]=s[a]=0,s[o]=0,l=s[0],h=s[1],u=s[2]}var y={multiply:function(){l=s*e/255,h=a*t/255,u=o*i/255},screen:function(){l=s+e-s*e/255,h=a+t-a*t/255,u=o+i-o*i/255},overlay:function(){l=s<128?2*s*e/255:255-2*(255-s)*(255-e)/255,h=a<128?2*a*t/255:255-2*(255-a)*(255-t)/255,u=o<128?2*o*i/255:255-2*(255-o)*(255-i)/255},"soft-light":function(){var n=e*s/255;l=n+s*(255-(255-s)*(255-e)/255-n)/255,h=(n=t*a/255)+a*(255-(255-a)*(255-t)/255-n)/255,u=(n=i*o/255)+o*(255-(255-o)*(255-i)/255-n)/255},"hard-light":function(){l=e<128?2*e*s/255:255-2*(255-e)*(255-s)/255,h=t<128?2*t*a/255:255-2*(255-t)*(255-a)/255,u=i<128?2*i*o/255:255-2*(255-i)*(255-o)/255},"color-dodge":function(){l=0===s?0:255===e?255:d(255,255*s/(255-e)),h=0===a?0:255===t?255:d(255,255*a/(255-t)),u=0===o?0:255===i?255:d(255,255*o/(255-i))},"color-burn":function(){l=255===s?255:0===e?0:p(0,255-255*(255-s)/e),h=255===a?255:0===t?0:p(0,255-255*(255-a)/t),u=255===o?255:0===i?0:p(0,255-255*(255-o)/i)},darken:function(){l=s<e?s:e,h=a<t?a:t,u=o<i?o:i},lighten:function(){l=s>e?s:e,h=a>t?a:t,u=o>i?o:i},difference:function(){(l=s-e)<0&&(l=-l),(h=a-t)<0&&(h=-h),(u=o-i)<0&&(u=-u)},exclusion:function(){l=s+e*(255-s-s)/255,h=a+t*(255-a-a)/255,u=o+i*(255-o-o)/255},hue:function(){b(e,t,i,v(s,a,o)),g(l,h,u,m(s,a,o))},saturation:function(){b(s,a,o,v(e,t,i)),g(l,h,u,m(s,a,o))},luminosity:function(){g(s,a,o,m(e,t,i))},color:function(){g(e,t,i,m(s,a,o))},add:function(){l=d(s+e,255),h=d(a+t,255),u=d(o+i,255)},subtract:function(){l=p(s-e,0),h=p(a-t,0),u=p(o-i,0)},average:function(){l=(s+e)/2,h=(a+t)/2,u=(o+i)/2},negation:function(){l=255-f(255-e-s),h=255-f(255-t-a),u=255-f(255-i-o)}},_=this.nativeModes=r.each(["source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","lighter","darker","copy","xor"],(function(e){this[e]=!0}),{}),w=ie.getContext(1,1,{willReadFrequently:!0});w&&(r.each(y,(function(e,t){var i="darken"===t,n=!1;w.save();try{w.fillStyle=i?"#300":"#a00",w.fillRect(0,0,1,1),w.globalCompositeOperation=t,w.globalCompositeOperation===t&&(w.fillStyle=i?"#a00":"#300",w.fillRect(0,0,1,1),n=w.getImageData(0,0,1,1).data[0]!==i?170:51)}catch(r){}w.restore(),_[t]=n})),ie.release(w)),this.process=function(r,d,p,f,m){var g=d.canvas,v="normal"===r;if(v||_[r])p.save(),p.setTransform(1,0,0,1,0,0),p.globalAlpha=f,v||(p.globalCompositeOperation=r),p.drawImage(g,m.x,m.y),p.restore();else{var b=y[r];if(!b)return;for(var w=p.getImageData(m.x,m.y,g.width,g.height),x=w.data,k=d.getImageData(0,0,g.width,g.height).data,C=0,S=x.length;C<S;C+=4){e=k[C],s=x[C],t=k[C+1],a=x[C+1],i=k[C+2],o=x[C+2],n=k[C+3],c=x[C+3],b();var M=n*f/255,E=1-M;x[C]=M*l+E*s,x[C+1]=M*h+E*a,x[C+2]=M*u+E*o,x[C+3]=n*f+E*c}p.putImageData(w,m.x,m.y)}}},re=new function(){var e="http://www.w3.org/2000/svg",t="http://www.w3.org/2000/xmlns",i="http://www.w3.org/1999/xlink",r={href:i,xlink:t,xmlns:t+"/","xmlns:xlink":t+"/"};function s(e,t,i){for(var n in t){var s=t[n],a=r[n];"number"==typeof s&&i&&(s=i.number(s)),a?e.setAttributeNS(a,n,s):e.setAttribute(n,s)}return e}return{svg:e,xmlns:t,xlink:i,create:function(t,i,r){return s(n.createElementNS(e,t),i,r)},get:function(e,t){var i=r[t],n=i?e.getAttributeNS(i,t):e.getAttribute(t);return"null"===n?null:n},set:s}},se=r.each({fillColor:["fill","color"],fillRule:["fill-rule","string"],strokeColor:["stroke","color"],strokeWidth:["stroke-width","number"],strokeCap:["stroke-linecap","string"],strokeJoin:["stroke-linejoin","string"],strokeScaling:["vector-effect","lookup",{true:"none",false:"non-scaling-stroke"},function(e,t){return!t&&(e instanceof L||e instanceof C||e instanceof z)}],miterLimit:["stroke-miterlimit","number"],dashArray:["stroke-dasharray","array"],dashOffset:["stroke-dashoffset","number"],fontFamily:["font-family","string"],fontWeight:["font-weight","string"],fontSize:["font-size","number"],justification:["text-anchor","lookup",{left:"start",center:"middle",right:"end"}],opacity:["opacity","number"],blendMode:["mix-blend-mode","style"]},(function(e,t){var i=r.capitalize(t),n=e[2];this[t]={type:e[1],property:t,attribute:e[0],toSVG:n,fromSVG:n&&r.each(n,(function(e,t){this[e]=t}),{}),exportFilter:e[3],get:"get"+i,set:"set"+i}}),{});new function(){var t;function i(e,i,n){var s,a=new r,o=e.getTranslation();if(i&&(e.isInvertible()?(s=(e=e._shiftless())._inverseTransform(o),o=null):s=new d,a[n?"cx":"x"]=s.x,a[n?"cy":"y"]=s.y),!e.isIdentity()){var c=e.decompose();if(c){var l=[],u=c.rotation,p=c.scaling,f=c.skewing;o&&!o.isZero()&&l.push("translate("+t.point(o)+")"),u&&l.push("rotate("+t.number(u)+")"),h.isZero(p.x-1)&&h.isZero(p.y-1)||l.push("scale("+t.point(p)+")"),f.x&&l.push("skewX("+t.number(f.x)+")"),f.y&&l.push("skewY("+t.number(f.y)+")"),a.transform=l.join(" ")}else a.transform="matrix("+e.getValues().join(",")+")"}return a}function n(e,n){for(var r=i(e._matrix),s=e._children,a=re.create("g",r,t),o=0,c=s.length;o<c;o++){var l=s[o],h=m(l,n);if(h)if(l.isClipMask()){var u=re.create("clipPath");u.appendChild(h),p(l,u,"clip"),re.set(a,{"clip-path":"url(#"+u.id+")"})}else a.appendChild(h)}return a}function s(e){var n=e._type,r=e._radius,s=i(e._matrix,!0,"rectangle"!==n);if("rectangle"===n){n="rect";var a=e._size,o=a.width,c=a.height;s.x-=o/2,s.y-=c/2,s.width=o,s.height=c,r.isZero()&&(r=null)}return r&&("circle"===n?s.r=r:(s.rx=r.width,s.ry=r.height)),re.create(n,s,t)}var a,o={Group:n,Layer:n,Raster:function(e,n){var r=i(e._matrix,!0),s=e.getSize(),a=e.getImage();return r.x-=s.width/2,r.y-=s.height/2,r.width=s.width,r.height=s.height,r.href=0==n.embedImages&&a&&a.src||e.toDataURL(),re.create("image",r,t)},Path:function(e,n){var r=n.matchShapes;if(r){var a=e.toShape(!1);if(a)return s(a)}var o,c=e._segments,l=c.length,h=i(e._matrix);if(r&&l>=2&&!e.hasHandles())if(l>2){o=e._closed?"polygon":"polyline";for(var u=[],d=0;d<l;d++)u.push(t.point(c[d]._point));h.points=u.join(" ")}else{o="line";var p=c[0]._point,f=c[1]._point;h.set({x1:p.x,y1:p.y,x2:f.x,y2:f.y})}else o="path",h.d=e.getPathData(null,n.precision);return re.create(o,h,t)},Shape:s,CompoundPath:function(e,n){var r=i(e._matrix),s=e.getPathData(null,n.precision);return s&&(r.d=s),re.create("path",r,t)},SymbolItem:function(e,n){var r=i(e._matrix,!0),s=e._definition,a=c(s,"symbol"),o=s._item,l=o.getStrokeBounds();return a||((a=re.create("symbol",{viewBox:t.rectangle(l)})).appendChild(m(o,n)),p(s,a,"symbol")),r.href="#"+a.id,r.x+=l.x,r.y+=l.y,r.width=l.width,r.height=l.height,r.overflow="visible",re.create("use",r,t)},PointText:function(e){var n=re.create("text",i(e._matrix,!0),t);return n.textContent=e._content,n}};function c(e,t){return a||(a={ids:{},svgs:{}}),e&&a.svgs[t+"-"+(e._id||e.__id||(e.__id=u.get("svg")))]}function p(e,t,i){a||c();var n=a.ids[i]=(a.ids[i]||0)+1;t.id=i+"-"+n,a.svgs[i+"-"+(e._id||e.__id)]=t}function f(t,i){var n=t,r=null;if(a){for(var s in n="svg"===t.nodeName.toLowerCase()&&t,a.svgs)r||(n||(n=re.create("svg")).appendChild(t),r=n.insertBefore(re.create("defs"),n.firstChild)),r.appendChild(a.svgs[s]);a=null}return i.asString?(new e.XMLSerializer).serializeToString(n):n}function m(e,i,n){var s=o[e._class],a=s&&s(e,i);if(a){var l=i.onExport;l&&(a=l(e,a,i)||a);var h=JSON.stringify(e._data);h&&"{}"!==h&&"null"!==h&&a.setAttribute("data-paper-data",h)}return a&&function(e,i,n,s){var a={},o=!s&&e.getParent(),l=[];return null!=e._name&&(a.id=e._name),r.each(se,(function(i){var s=i.get,h=i.type,u=e[s]();if(i.exportFilter?i.exportFilter(e,u):0==n.reduceAttributes||!o||!r.equals(o[s](),u)){if("color"===h&&null!=u){var d=u.getAlpha();d<1&&(a[i.attribute+"-opacity"]=d)}"style"===h?l.push(i.attribute+": "+u):a[i.attribute]=null==u?"none":"color"===h?u.gradient?function(e){var i=c(e,"color");if(!i){var n,r=e.getGradient(),s=r._radial,a=e.getOrigin(),o=e.getDestination();if(s){n={cx:a.x,cy:a.y,r:a.getDistance(o)};var l=e.getHighlight();l&&(n.fx=l.x,n.fy=l.y)}else n={x1:a.x,y1:a.y,x2:o.x,y2:o.y};n.gradientUnits="userSpaceOnUse",i=re.create((s?"radial":"linear")+"Gradient",n,t);for(var h=r._stops,u=0,d=h.length;u<d;u++){var f=h[u],m=f._color,g=m.getAlpha(),v=f._offset;n={offset:null==v?u/(d-1):v},m&&(n["stop-color"]=m.toCSS(!0)),g<1&&(n["stop-opacity"]=g),i.appendChild(re.create("stop",n,t))}p(e,i,"color")}return"url(#"+i.id+")"}(u):u.toCSS(!0):"array"===h?u.join(","):"lookup"===h?i.toSVG[u]:u}})),l.length&&(a.style=l.join(";")),1===a.opacity&&delete a.opacity,e._visible||(a.visibility="hidden"),re.set(i,a,t)}(e,a,i,n)}function v(e){return e||(e={}),t=new l(e.precision),e}w.inject({exportSVG:function(e){return f(m(this,e=v(e),!0),e)}}),_.inject({exportSVG:function(e){e=v(e);var n=this._children,s=this.getView(),a=r.pick(e.bounds,"view"),o=e.matrix||"view"===a&&s._matrix,c=o&&b.read([o]),l="view"===a?new g([0,0],s.getViewSize()):"content"===a?w._getBounds(n,c,{stroke:!0}).rect:g.read([a],0,{readNull:!0}),h={version:"1.1",xmlns:re.svg,"xmlns:xlink":re.xlink};l&&(h.width=l.width,h.height=l.height,(l.x||0===l.x||l.y||0===l.y)&&(h.viewBox=t.rectangle(l)));var u=re.create("svg",h,t),d=u;c&&!c.isIdentity()&&(d=u.appendChild(re.create("g",i(c),t)));for(var p=0,y=n.length;p<y;p++)d.appendChild(m(n[p],e,!0));return f(u,e)}})},new function(){var s,a={};function o(e,t,i,n,r,a){var o=re.get(e,t)||a,c=null==o?n?null:i?"":0:i?o:parseFloat(o);return/%\s*$/.test(o)?c/100*(r?1:s[/x|^width/.test(t)?"width":"height"]):c}function c(e,t,i,n,r,s,a){return t=o(e,t||"x",!1,n,r,s),i=o(e,i||"y",!1,n,r,a),!n||null!=t&&null!=i?new d(t,i):null}function l(e,t,i,n,r){return t=o(e,t||"width",!1,n,r),i=o(e,i||"height",!1,n,r),!n||null!=t&&null!=i?new f(t,i):null}function h(e,t,i){return"none"===e?null:"number"===t?parseFloat(e):"array"===t?e?e.split(/[\s,]+/g).map(parseFloat):[]:"color"===t?A(e)||e:"lookup"===t?i[e]:e}function u(e,t,i,n){var r=e.childNodes,s="clippath"===t,a="defs"===t,o=new x,c=o._project,l=c._currentStyle,h=[];if(s||a||(o=P(o,e,n),c._currentStyle=o._style.clone()),n)for(var u=e.querySelectorAll("defs"),d=0,p=u.length;d<p;d++)I(u[d],i,!1);for(d=0,p=r.length;d<p;d++){var f,m=r[d];1!==m.nodeType||/^defs$/i.test(m.nodeName)||!(f=I(m,i,!1))||f instanceof E||h.push(f)}return o.addChildren(h),s&&(o=P(o.reduce(),e,n)),c._currentStyle=l,(s||a)&&(o.remove(),o=null),o}function p(e,t){for(var i=e.getAttribute("points").match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g),n=[],r=0,s=i.length;r<s;r+=2)n.push(new d(parseFloat(i[r]),parseFloat(i[r+1])));var a=new O(n);return"polygon"===t&&a.closePath(),a}function m(e,t){var i,n=(o(e,"href",!0)||"").substring(1),r="radialgradient"===t;if(n)(i=a[n].getGradient())._radial^r&&((i=i.clone())._radial=r);else{for(var s=e.childNodes,l=[],h=0,u=s.length;h<u;h++){var d=s[h];1===d.nodeType&&l.push(P(new j,d))}i=new F(l,r)}var p,f,m,g="userSpaceOnUse"!==o(e,"gradientUnits",!0);return r?(f=(p=c(e,"cx","cy",!1,g,"50%","50%")).add(o(e,"r",!1,!1,g,"50%"),0),m=c(e,"fx","fy",!0,g)):(p=c(e,"x1","y1",!1,g,"0%","0%"),f=c(e,"x2","y2",!1,g,"100%","0%")),P(new q(i,p,f,m),e)._scaleToBounds=g,null}var v={"#document":function(e,t,i,n){for(var r=e.childNodes,s=0,a=r.length;s<a;s++){var o=r[s];if(1===o.nodeType)return I(o,i,n)}},g:u,svg:u,clippath:u,polygon:p,polyline:p,path:function(e){return L.create(e.getAttribute("d"))},lineargradient:m,radialgradient:m,image:function(e){var t=new S(o(e,"href",!0));return t.on("load",(function(){var t=l(e);this.setSize(t);var i=c(e).add(t.divide(2));this._matrix.append((new b).translate(i))})),t},symbol:function(e,t,i,n){return new E(u(e,t,i,n),!0)},defs:u,use:function(e){var t=(o(e,"href",!0)||"").substring(1),i=a[t],n=c(e);return i?i instanceof E?i.place(n):i.clone().translate(n):null},circle:function(e){return new C.Circle(c(e,"cx","cy"),o(e,"r"))},ellipse:function(e){return new C.Ellipse({center:c(e,"cx","cy"),radius:l(e,"rx","ry")})},rect:function(e){return new C.Rectangle(new g(c(e),l(e)),l(e,"rx","ry"))},line:function(e){return new O.Line(c(e,"x1","y1"),c(e,"x2","y2"))},text:function(e){var t=new V(c(e).add(c(e,"dx","dy")));return t.setContent(e.textContent.trim()||""),t},switch:u};function y(e,t,i,n){if(e.transform){for(var r=(n.getAttribute(i)||"").split(/\)\s*/g),s=new b,a=0,o=r.length;a<o;a++){var c=r[a];if(!c)break;for(var l=c.split(/\(\s*/),h=l[0].trim(),u=l[1].split(/[\s,]+/g),d=0,p=u.length;d<p;d++)u[d]=parseFloat(u[d]);switch(h){case"matrix":s.append(new b(u[0],u[1],u[2],u[3],u[4],u[5]));break;case"rotate":s.rotate(u[0],u[1]||0,u[2]||0);break;case"translate":s.translate(u[0],u[1]||0);break;case"scale":s.scale(u);break;case"skewX":s.skew(u[0],0);break;case"skewY":s.skew(0,u[0])}}e.transform(s)}}function k(e,t,i){var n="fill-opacity"===i?"getFillColor":"getStrokeColor",r=e[n]&&e[n]();r&&r.setAlpha(parseFloat(t))}var M=r.set(r.each(se,(function(e){this[e.attribute]=function(t,i){if(t[e.set]&&(t[e.set](h(i,e.type,e.fromSVG)),"color"===e.type)){var n=t[e.get]();if(n&&n._scaleToBounds){var r=t.getBounds();n.transform((new b).translate(r.getPoint()).scale(r.getSize()))}}}}),{}),{id:function(e,t){a[t]=e,e.setName&&e.setName(t)},"clip-path":function(e,t){var i=A(t);if(i){if((i=i.clone()).setClipMask(!0),!(e instanceof x))return new x(i,e);e.insertChild(0,i)}},gradientTransform:y,transform:y,"fill-opacity":k,"stroke-opacity":k,visibility:function(e,t){e.setVisible&&e.setVisible("visible"===t)},display:function(e,t){e.setVisible&&e.setVisible(null!==t)},"stop-color":function(e,t){e.setColor&&e.setColor(t)},"stop-opacity":function(e,t){e._color&&e._color.setAlpha(parseFloat(t))},offset:function(e,t){if(e.setOffset){var i=t.match(/(.*)%$/);e.setOffset(i?i[1]/100:parseFloat(t))}},viewBox:function(e,t,i,n,r){var s,a=new g(h(t,"array")),o=l(n,null,null,!0);if(e instanceof x){var c=o?o.divide(a.getSize()):1,u=(new b).scale(c).translate(a.getPoint().negate());s=e}else e instanceof E&&(o&&a.setSize(o),s=e._item);if(s){if("visible"!==T(n,"overflow",r)){var d=new C.Rectangle(a);d.setClipMask(!0),s.addChild(d)}u&&s.transform(u)}}});function T(e,i,n){var s=e.attributes[i],a=s&&s.value;if(!a&&e.style){var o=r.camelize(i);(a=e.style[o])||n.node[o]===n.parent[o]||(a=n.node[o])}return a?"none"===a?null:a:t}function P(e,i,n){var s=i.parentNode,a={node:G.getStyles(i)||{},parent:!n&&!/^defs$/i.test(s.tagName)&&G.getStyles(s)||{}};return r.each(M,(function(n,r){var s=T(i,r,a);e=s!==t&&n(e,s,r,i,a)||e})),e}function A(e){var t=e&&e.match(/\((?:["'#]*)([^"')]+)/),n=t&&t[1],r=n&&a[i?n.replace(i.location.href.split("#")[0]+"#",""):n];return r&&r._scaleToBounds&&((r=r.clone())._scaleToBounds=!0),r}function I(e,t,i){var o,c,h,u=e.nodeName.toLowerCase(),d="#document"!==u,p=n.body;i&&d&&(s=ae.getView().getSize(),s=l(e,null,null,!0)||s,o=re.create("svg",{style:"stroke-width: 1px; stroke-miterlimit: 10"}),c=e.parentNode,h=e.nextSibling,o.appendChild(e),p.appendChild(o));var f=ae.settings,m=f.applyMatrix,g=f.insertItems;f.applyMatrix=!1,f.insertItems=!1;var b=v[u],y=b&&b(e,u,t,i)||null;if(f.insertItems=g,f.applyMatrix=m,y){!d||y instanceof x||(y=P(y,e,i));var _=t.onImport,w=d&&e.getAttribute("data-paper-data");_&&(y=_(e,y,t)||y),t.expandShapes&&y instanceof C&&(y.remove(),y=y.toPath()),w&&(y._data=JSON.parse(w))}return o&&(p.removeChild(o),c&&(h?c.insertBefore(e,h):c.appendChild(e))),i&&(a={},y&&r.pick(t.applyMatrix,m)&&y.matrix.apply(!0,!0)),y}function N(i,r,s){if(!i)return null;r="function"==typeof r?{onLoad:r}:r||{};var a=ae,o=null;function c(n){try{var c="object"==typeof n?n:(new e.DOMParser).parseFromString(n.trim(),"image/svg+xml");if(!c.nodeName)throw c=null,new Error("Unsupported SVG source: "+i);ae=a,o=I(c,r,!0),r&&!1===r.insert||s._insertItem(t,o);var h=r.onLoad;h&&h(o,n)}catch(u){l(u)}}function l(e,t){var i=r.onError;if(!i)throw new Error(e);i(e,t)}if("string"!=typeof i||/^[\s\S]*</.test(i)){if("undefined"!=typeof File&&i instanceof File){var h=new FileReader;return h.onload=function(){c(h.result)},h.onerror=function(){l(h.error)},h.readAsText(i)}c(i)}else{var u=n.getElementById(i);u?c(u):te({url:i,async:!0,onLoad:c,onError:l})}return o}w.inject({importSVG:function(e,t){return N(e,t,this)}}),_.inject({importSVG:function(e,t){return this.activate(),N(e,t,this)}})},r.exports.PaperScript=function(){var t,s=this,o=s.acorn;if(!o&&void 0!==Cr)try{o=Ir()}catch(_){}function c(e,t){return(s.acorn||o).parse(e,t)}o||(o=t={},function(e){var t,i,n,r;e.version="0.5.0",e.parse=function(e,r){return i=String(e),n=i.length,a(r),Ye(),function(e){v=b=o,t.locations&&(y=new We),w=k=null,x=[],Ze();var i=e||ht(),n=!0;for(e||(i.body=[]);d!==I;){var r=xt();i.body.push(r),n&&pt(r)&&ot(!0),n=!1}return dt(i,"Program")}(t.program)};var s=e.defaultOptions={ecmaVersion:5,strictSemicolons:!1,allowTrailingCommas:!0,forbidReserved:!1,allowReturnOutsideFunction:!1,locations:!1,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null};function a(e){for(var i in t=e||{},s)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=s[i]);r=t.sourceFile||null}var o,c,l,h,u,d,p,f,m,g,v,b,y,w,x,k,C=e.getLineInfo=function(e,t){for(var i=1,n=0;;){He.lastIndex=n;var r=He.exec(e);if(!(r&&r.index<t))break;++i,n=r.index+r[0].length}return{line:i,column:t-n}};function S(e,t){var n=C(i,e);t+=" ("+n.line+":"+n.column+")";var r=new SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=o,r}e.tokenize=function(e,r){i=String(e),n=i.length,a(r),Ye();var s={};function v(e){return b=l,Ze(e),s.start=c,s.end=l,s.startLoc=h,s.endLoc=u,s.type=d,s.value=p,s}return v.jumpTo=function(e,n){var r;if(o=e,t.locations)for(m=1,g=He.lastIndex=0;(r=He.exec(i))&&r.index<e;)++m,g=r.index+r[0].length;f=n,Qe()},v};var M=[],E={type:"num"},T={type:"regexp"},P={type:"string"},A={type:"name"},I={type:"eof"},N={keyword:"break"},L={keyword:"case",beforeExpr:!0},O={keyword:"catch"},B={keyword:"continue"},D={keyword:"debugger"},R={keyword:"default"},z={keyword:"do",isLoop:!0},V={keyword:"else",beforeExpr:!0},q={keyword:"finally"},F={keyword:"for",isLoop:!0},j={keyword:"function"},H={keyword:"if"},G={keyword:"return",beforeExpr:!0},U={keyword:"switch"},W={keyword:"throw",beforeExpr:!0},Y={keyword:"try"},$={keyword:"var"},K={keyword:"while",isLoop:!0},X={keyword:"with"},Q={keyword:"new",beforeExpr:!0},Z={keyword:"this"},J={keyword:"null",atomValue:null},ee={keyword:"true",atomValue:!0},te={keyword:"false",atomValue:!1},ie={keyword:"in",binop:7,beforeExpr:!0},ne={break:N,case:L,catch:O,continue:B,debugger:D,default:R,do:z,else:V,finally:q,for:F,function:j,if:H,return:G,switch:U,throw:W,try:Y,var:$,while:K,with:X,null:J,true:ee,false:te,new:Q,in:ie,instanceof:{keyword:"instanceof",binop:7,beforeExpr:!0},this:Z,typeof:{keyword:"typeof",prefix:!0,beforeExpr:!0},void:{keyword:"void",prefix:!0,beforeExpr:!0},delete:{keyword:"delete",prefix:!0,beforeExpr:!0}},re={type:"[",beforeExpr:!0},se={type:"]"},ae={type:"{",beforeExpr:!0},oe={type:"}"},ce={type:"(",beforeExpr:!0},le={type:")"},he={type:",",beforeExpr:!0},ue={type:";",beforeExpr:!0},de={type:":",beforeExpr:!0},pe={type:"."},fe={type:"?",beforeExpr:!0},me={binop:10,beforeExpr:!0},ge={isAssign:!0,beforeExpr:!0},ve={isAssign:!0,beforeExpr:!0},be={postfix:!0,prefix:!0,isUpdate:!0},ye={prefix:!0,beforeExpr:!0},_e={binop:1,beforeExpr:!0},we={binop:2,beforeExpr:!0},xe={binop:3,beforeExpr:!0},ke={binop:4,beforeExpr:!0},Ce={binop:5,beforeExpr:!0},Se={binop:6,beforeExpr:!0},Me={binop:7,beforeExpr:!0},Ee={binop:8,beforeExpr:!0},Te={binop:9,prefix:!0,beforeExpr:!0},Pe={binop:10,beforeExpr:!0};for(var Ae in e.tokTypes={bracketL:re,bracketR:se,braceL:ae,braceR:oe,parenL:ce,parenR:le,comma:he,semi:ue,colon:de,dot:pe,question:fe,slash:me,eq:ge,name:A,eof:I,num:E,regexp:T,string:P},ne)e.tokTypes["_"+Ae]=ne[Ae];function Ie(e){e=e.split(" ");var t="",i=[];e:for(var n=0;n<e.length;++n){for(var r=0;r<i.length;++r)if(i[r][0].length==e[n].length){i[r].push(e[n]);continue e}i.push([e[n]])}function s(e){if(1==e.length)return t+="return str === "+JSON.stringify(e[0])+";";t+="switch(str){";for(var i=0;i<e.length;++i)t+="case "+JSON.stringify(e[i])+":";t+="return true}return false;"}if(i.length>3){for(i.sort((function(e,t){return t.length-e.length})),t+="switch(str.length){",n=0;n<i.length;++n){var a=i[n];t+="case "+a[0].length+":",s(a)}t+="}"}else s(e);return new Function("str",t)}var Ne,Le=Ie("abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile"),Oe=Ie("class enum extends super const export import"),Be=Ie("implements interface let package private protected public static yield"),De=Ie("eval arguments"),Re=Ie("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"),ze=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ve="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",qe=new RegExp("["+Ve+"]"),Fe=new RegExp("["+Ve+"̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‌‍‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_]"),je=/[\n\r\u2028\u2029]/,He=/\r\n|[\n\r\u2028\u2029]/g,Ge=e.isIdentifierStart=function(e){return e<65?36===e:e<91||(e<97?95===e:e<123||e>=170&&qe.test(String.fromCharCode(e)))},Ue=e.isIdentifierChar=function(e){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||e>=170&&Fe.test(String.fromCharCode(e))))};function We(){this.line=m,this.column=o-g}function Ye(){m=1,o=g=0,f=!0,Qe()}function $e(e,i){l=o,t.locations&&(u=new We),d=e,Qe(),p=i,f=e.beforeExpr}function Ke(){var e,n=t.onComment&&t.locations&&new We,r=o,s=i.indexOf("*/",o+=2);if(-1===s&&S(o-2,"Unterminated comment"),o=s+2,t.locations)for(He.lastIndex=r;(e=He.exec(i))&&e.index<o;)++m,g=e.index+e[0].length;t.onComment&&t.onComment(!0,i.slice(r+2,s),r,o,n,t.locations&&new We)}function Xe(){for(var e=o,r=t.onComment&&t.locations&&new We,s=i.charCodeAt(o+=2);o<n&&10!==s&&13!==s&&8232!==s&&8233!==s;)++o,s=i.charCodeAt(o);t.onComment&&t.onComment(!1,i.slice(e+2,o),e,o,r,t.locations&&new We)}function Qe(){for(;o<n;){var e=i.charCodeAt(o);if(32===e)++o;else if(13===e)++o,10===(r=i.charCodeAt(o))&&++o,t.locations&&(++m,g=o);else if(10===e||8232===e||8233===e)++o,t.locations&&(++m,g=o);else if(e>8&&e<14)++o;else if(47===e){var r;if(42===(r=i.charCodeAt(o+1)))Ke();else{if(47!==r)break;Xe()}}else if(160===e)++o;else{if(!(e>=5760&&ze.test(String.fromCharCode(e))))break;++o}}}function Ze(e){if(e?o=c+1:c=o,t.locations&&(h=new We),e)return et();if(o>=n)return $e(I);var r=i.charCodeAt(o);if(Ge(r)||92===r)return st();var s=function(e){switch(e){case 46:return(s=i.charCodeAt(o+1))>=48&&s<=57?it(!0):(++o,$e(pe));case 40:return++o,$e(ce);case 41:return++o,$e(le);case 59:return++o,$e(ue);case 44:return++o,$e(he);case 91:return++o,$e(re);case 93:return++o,$e(se);case 123:return++o,$e(ae);case 125:return++o,$e(oe);case 58:return++o,$e(de);case 63:return++o,$e(fe);case 48:var r=i.charCodeAt(o+1);if(120===r||88===r)return function(){o+=2;var e=tt(16);return null==e&&S(c+2,"Expected hexadecimal number"),Ge(i.charCodeAt(o))&&S(o,"Identifier directly after number"),$e(E,e)}();case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return it(!1);case 34:case 39:return function(e){o++;for(var r="";;){o>=n&&S(c,"Unterminated string constant");var s=i.charCodeAt(o);if(s===e)return++o,$e(P,r);if(92===s){s=i.charCodeAt(++o);var a=/^[0-7]+/.exec(i.slice(o,o+3));for(a&&(a=a[0]);a&&parseInt(a,8)>255;)a=a.slice(0,-1);if("0"===a&&(a=null),++o,a)k&&S(o-2,"Octal literal in strict mode"),r+=String.fromCharCode(parseInt(a,8)),o+=a.length-1;else switch(s){case 110:r+="\n";break;case 114:r+="\r";break;case 120:r+=String.fromCharCode(nt(2));break;case 117:r+=String.fromCharCode(nt(4));break;case 85:r+=String.fromCharCode(nt(8));break;case 116:r+="\t";break;case 98:r+="\b";break;case 118:r+="\v";break;case 102:r+="\f";break;case 48:r+="\0";break;case 13:10===i.charCodeAt(o)&&++o;case 10:t.locations&&(g=o,++m);break;default:r+=String.fromCharCode(s)}}else 13!==s&&10!==s&&8232!==s&&8233!==s||S(c,"Unterminated string constant"),r+=String.fromCharCode(s),++o}}(e);case 47:return function(){var e=i.charCodeAt(o+1);return f?(++o,et()):61===e?Je(ve,2):Je(me,1)}();case 37:case 42:return 61===i.charCodeAt(o+1)?Je(ve,2):Je(Pe,1);case 124:case 38:return function(e){var t=i.charCodeAt(o+1);return t===e?Je(124===e?_e:we,2):61===t?Je(ve,2):Je(124===e?xe:Ce,1)}(e);case 94:return 61===i.charCodeAt(o+1)?Je(ve,2):Je(ke,1);case 43:case 45:return function(e){var t=i.charCodeAt(o+1);return t===e?45==t&&62==i.charCodeAt(o+2)&&je.test(i.slice(b,o))?(o+=3,Xe(),Qe(),Ze()):Je(be,2):61===t?Je(ve,2):Je(Te,1)}(e);case 60:case 62:return function(e){var t=i.charCodeAt(o+1),n=1;return t===e?(n=62===e&&62===i.charCodeAt(o+2)?3:2,61===i.charCodeAt(o+n)?Je(ve,n+1):Je(Ee,n)):33==t&&60==e&&45==i.charCodeAt(o+2)&&45==i.charCodeAt(o+3)?(o+=4,Xe(),Qe(),Ze()):(61===t&&(n=61===i.charCodeAt(o+2)?3:2),Je(Me,n))}(e);case 61:case 33:return function(e){return 61===i.charCodeAt(o+1)?Je(Se,61===i.charCodeAt(o+2)?3:2):Je(61===e?ge:ye,1)}(e);case 126:return Je(ye,1)}var s;return!1}(r);if(!1===s){var a=String.fromCharCode(r);if("\\"===a||qe.test(a))return st();S(o,"Unexpected character '"+a+"'")}return s}function Je(e,t){var n=i.slice(o,o+t);o+=t,$e(e,n)}function et(){for(var e,t,r=o;;){o>=n&&S(r,"Unterminated regular expression");var s=i.charAt(o);if(je.test(s)&&S(r,"Unterminated regular expression"),e)e=!1;else{if("["===s)t=!0;else if("]"===s&&t)t=!1;else if("/"===s&&!t)break;e="\\"===s}++o}var a=i.slice(r,o);++o;var c=rt();c&&!/^[gmsiy]*$/.test(c)&&S(r,"Invalid regexp flag");try{var l=new RegExp(a,c)}catch(_){_ instanceof SyntaxError&&S(r,_.message),S(_)}return $e(T,l)}function tt(e,t){for(var n=o,r=0,s=0,a=null==t?1/0:t;s<a;++s){var c,l=i.charCodeAt(o);if((c=l>=97?l-97+10:l>=65?l-65+10:l>=48&&l<=57?l-48:1/0)>=e)break;++o,r=r*e+c}return o===n||null!=t&&o-n!==t?null:r}function it(e){var t=o,n=!1,r=48===i.charCodeAt(o);e||null!==tt(10)||S(t,"Invalid number"),46===i.charCodeAt(o)&&(++o,tt(10),n=!0);var s=i.charCodeAt(o);69!==s&&101!==s||(43!==(s=i.charCodeAt(++o))&&45!==s||++o,null===tt(10)&&S(t,"Invalid number"),n=!0),Ge(i.charCodeAt(o))&&S(o,"Identifier directly after number");var a,c=i.slice(t,o);return n?a=parseFloat(c):r&&1!==c.length?/[89]/.test(c)||k?S(t,"Invalid number"):a=parseInt(c,8):a=parseInt(c,10),$e(E,a)}function nt(e){var t=tt(16,e);return null===t&&S(c,"Bad character escape sequence"),t}function rt(){Ne=!1;for(var e,t=!0,n=o;;){var r=i.charCodeAt(o);if(Ue(r))Ne&&(e+=i.charAt(o)),++o;else{if(92!==r)break;Ne||(e=i.slice(n,o)),Ne=!0,117!=i.charCodeAt(++o)&&S(o,"Expecting Unicode escape sequence \\uXXXX"),++o;var s=nt(4),a=String.fromCharCode(s);a||S(o-1,"Invalid Unicode escape"),(t?Ge(s):Ue(s))||S(o-4,"Invalid Unicode escape"),e+=a}t=!1}return Ne?e:i.slice(n,o)}function st(){var e=rt(),t=A;return!Ne&&Re(e)&&(t=ne[e]),$e(t,e)}function at(){v=c,b=l,y=u,Ze()}function ot(e){if(k=e,o=c,t.locations)for(;o<g;)g=i.lastIndexOf("\n",g-2)+1,--m;Qe(),Ze()}function ct(){this.type=null,this.start=c,this.end=null}function lt(){this.start=h,this.end=null,null!==r&&(this.source=r)}function ht(){var e=new ct;return t.locations&&(e.loc=new lt),t.directSourceFile&&(e.sourceFile=t.directSourceFile),t.ranges&&(e.range=[c,0]),e}function ut(e){var i=new ct;return i.start=e.start,t.locations&&(i.loc=new lt,i.loc.start=e.loc.start),t.ranges&&(i.range=[e.range[0],0]),i}function dt(e,i){return e.type=i,e.end=b,t.locations&&(e.loc.end=y),t.ranges&&(e.range[1]=b),e}function pt(e){return t.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.value}function ft(e){if(d===e)return at(),!0}function mt(){return!t.strictSemicolons&&(d===I||d===oe||je.test(i.slice(b,c)))}function gt(){ft(ue)||mt()||bt()}function vt(e){d===e?at():bt()}function bt(){S(c,"Unexpected token")}function yt(e){"Identifier"!==e.type&&"MemberExpression"!==e.type&&S(e.start,"Assigning to rvalue"),k&&"Identifier"===e.type&&De(e.name)&&S(e.start,"Assigning to "+e.name+" in strict mode")}var _t={kind:"loop"},wt={kind:"switch"};function xt(){(d===me||d===ve&&"/="==p)&&Ze(!0);var e=d,n=ht();switch(e){case N:case B:at();var r=e===N;ft(ue)||mt()?n.label=null:d!==A?bt():(n.label=Rt(),gt());for(var s=0;s<x.length;++s){var a=x[s];if(null==n.label||a.name===n.label.name){if(null!=a.kind&&(r||"loop"===a.kind))break;if(n.label&&r)break}}return s===x.length&&S(n.start,"Unsyntactic "+e.keyword),dt(n,r?"BreakStatement":"ContinueStatement");case D:return at(),gt(),dt(n,"DebuggerStatement");case z:return at(),x.push(_t),n.body=xt(),x.pop(),vt(K),n.test=kt(),gt(),dt(n,"DoWhileStatement");case F:if(at(),x.push(_t),vt(ce),d===ue)return St(n,null);if(d===$){var o=ht();return at(),Et(o,!0),dt(o,"VariableDeclaration"),1===o.declarations.length&&ft(ie)?Mt(n,o):St(n,o)}return o=Tt(!1,!0),ft(ie)?(yt(o),Mt(n,o)):St(n,o);case j:return at(),Bt(n,!0);case H:return at(),n.test=kt(),n.consequent=xt(),n.alternate=ft(V)?xt():null,dt(n,"IfStatement");case G:return w||t.allowReturnOutsideFunction||S(c,"'return' outside of function"),at(),ft(ue)||mt()?n.argument=null:(n.argument=Tt(),gt()),dt(n,"ReturnStatement");case U:at(),n.discriminant=kt(),n.cases=[],vt(ae),x.push(wt);for(var l,h;d!=oe;)if(d===L||d===R){var u=d===L;l&&dt(l,"SwitchCase"),n.cases.push(l=ht()),l.consequent=[],at(),u?l.test=Tt():(h&&S(v,"Multiple default clauses"),h=!0,l.test=null),vt(de)}else l||bt(),l.consequent.push(xt());return l&&dt(l,"SwitchCase"),at(),x.pop(),dt(n,"SwitchStatement");case W:return at(),je.test(i.slice(b,c))&&S(b,"Illegal newline after throw"),n.argument=Tt(),gt(),dt(n,"ThrowStatement");case Y:if(at(),n.block=Ct(),n.handler=null,d===O){var f=ht();at(),vt(ce),f.param=Rt(),k&&De(f.param.name)&&S(f.param.start,"Binding "+f.param.name+" in strict mode"),vt(le),f.guard=null,f.body=Ct(),n.handler=dt(f,"CatchClause")}return n.guardedHandlers=M,n.finalizer=ft(q)?Ct():null,n.handler||n.finalizer||S(n.start,"Missing catch or finally clause"),dt(n,"TryStatement");case $:return at(),Et(n),gt(),dt(n,"VariableDeclaration");case K:return at(),n.test=kt(),x.push(_t),n.body=xt(),x.pop(),dt(n,"WhileStatement");case X:return k&&S(c,"'with' in strict mode"),at(),n.object=kt(),n.body=xt(),dt(n,"WithStatement");case ae:return Ct();case ue:return at(),dt(n,"EmptyStatement");default:var m=p,g=Tt();if(e===A&&"Identifier"===g.type&&ft(de)){for(s=0;s<x.length;++s)x[s].name===m&&S(g.start,"Label '"+m+"' is already declared");var y=d.isLoop?"loop":d===U?"switch":null;return x.push({name:m,kind:y}),n.body=xt(),x.pop(),n.label=g,dt(n,"LabeledStatement")}return n.expression=g,gt(),dt(n,"ExpressionStatement")}}function kt(){vt(ce);var e=Tt();return vt(le),e}function Ct(e){var t,i=ht(),n=!0,r=!1;for(i.body=[],vt(ae);!ft(oe);){var s=xt();i.body.push(s),n&&e&&pt(s)&&(t=r,ot(r=!0)),n=!1}return r&&!t&&ot(!1),dt(i,"BlockStatement")}function St(e,t){return e.init=t,vt(ue),e.test=d===ue?null:Tt(),vt(ue),e.update=d===le?null:Tt(),vt(le),e.body=xt(),x.pop(),dt(e,"ForStatement")}function Mt(e,t){return e.left=t,e.right=Tt(),vt(le),e.body=xt(),x.pop(),dt(e,"ForInStatement")}function Et(e,t){for(e.declarations=[],e.kind="var";;){var i=ht();if(i.id=Rt(),k&&De(i.id.name)&&S(i.id.start,"Binding "+i.id.name+" in strict mode"),i.init=ft(ge)?Tt(!0,t):null,e.declarations.push(dt(i,"VariableDeclarator")),!ft(he))break}return e}function Tt(e,t){var i=Pt(t);if(!e&&d===he){var n=ut(i);for(n.expressions=[i];ft(he);)n.expressions.push(Pt(t));return dt(n,"SequenceExpression")}return i}function Pt(e){var t=function(e){var t,i=(t=e,At(It(),-1,t));if(ft(fe)){var n=ut(i);return n.test=i,n.consequent=Tt(!0),vt(de),n.alternate=Tt(!0,e),dt(n,"ConditionalExpression")}return i}(e);if(d.isAssign){var i=ut(t);return i.operator=p,i.left=t,at(),i.right=Pt(e),yt(t),dt(i,"AssignmentExpression")}return t}function At(e,t,i){var n=d.binop;if(null!=n&&(!i||d!==ie)&&n>t){var r=ut(e);r.left=e,r.operator=p;var s=d;return at(),r.right=At(It(),n,i),At(dt(r,s===_e||s===we?"LogicalExpression":"BinaryExpression"),t,i)}return e}function It(){if(d.prefix){var e=ht(),t=d.isUpdate;return e.operator=p,e.prefix=!0,f=!0,at(),e.argument=It(),t?yt(e.argument):k&&"delete"===e.operator&&"Identifier"===e.argument.type&&S(e.start,"Deleting local variable in strict mode"),dt(e,t?"UpdateExpression":"UnaryExpression")}for(var i=Nt(Lt());d.postfix&&!mt();)(e=ut(i)).operator=p,e.prefix=!1,e.argument=i,yt(i),at(),i=dt(e,"UpdateExpression");return i}function Nt(e,t){var i;return ft(pe)?((i=ut(e)).object=e,i.property=Rt(!0),i.computed=!1,Nt(dt(i,"MemberExpression"),t)):ft(re)?((i=ut(e)).object=e,i.property=Tt(),i.computed=!0,vt(se),Nt(dt(i,"MemberExpression"),t)):!t&&ft(ce)?((i=ut(e)).callee=e,i.arguments=Dt(le,!1),Nt(dt(i,"CallExpression"),t)):e}function Lt(){switch(d){case Z:var e=ht();return at(),dt(e,"ThisExpression");case A:return Rt();case E:case P:case T:return(e=ht()).value=p,e.raw=i.slice(c,l),at(),dt(e,"Literal");case J:case ee:case te:return(e=ht()).value=d.atomValue,e.raw=d.keyword,at(),dt(e,"Literal");case ce:var n=h,r=c;at();var s=Tt();return s.start=r,s.end=l,t.locations&&(s.loc.start=n,s.loc.end=u),t.ranges&&(s.range=[r,l]),vt(le),s;case re:return e=ht(),at(),e.elements=Dt(se,!0,!0),dt(e,"ArrayExpression");case ae:return function(){var e=ht(),i=!0,n=!1;for(e.properties=[],at();!ft(oe);){if(i)i=!1;else if(vt(he),t.allowTrailingCommas&&ft(oe))break;var r,s={key:Ot()},a=!1;if(ft(de)?(s.value=Tt(!0),r=s.kind="init"):t.ecmaVersion>=5&&"Identifier"===s.key.type&&("get"===s.key.name||"set"===s.key.name)?(a=n=!0,r=s.kind=s.key.name,s.key=Ot(),d!==ce&&bt(),s.value=Bt(ht(),!1)):bt(),"Identifier"===s.key.type&&(k||n))for(var o=0;o<e.properties.length;++o){var c=e.properties[o];if(c.key.name===s.key.name){var l=r==c.kind||a&&"init"===c.kind||"init"===r&&("get"===c.kind||"set"===c.kind);l&&!k&&"init"===r&&"init"===c.kind&&(l=!1),l&&S(s.key.start,"Redefinition of property")}}e.properties.push(s)}return dt(e,"ObjectExpression")}();case j:return e=ht(),at(),Bt(e,!1);case Q:return a=ht(),at(),a.callee=Nt(Lt(),!0),ft(ce)?a.arguments=Dt(le,!1):a.arguments=M,dt(a,"NewExpression");default:bt()}var a}function Ot(){return d===E||d===P?Lt():Rt(!0)}function Bt(e,t){d===A?e.id=Rt():t?bt():e.id=null,e.params=[];var i=!0;for(vt(ce);!ft(le);)i?i=!1:vt(he),e.params.push(Rt());var n=w,r=x;if(w=!0,x=[],e.body=Ct(!0),w=n,x=r,k||e.body.body.length&&pt(e.body.body[0]))for(var s=e.id?-1:0;s<e.params.length;++s){var a=s<0?e.id:e.params[s];if((Be(a.name)||De(a.name))&&S(a.start,"Defining '"+a.name+"' in strict mode"),s>=0)for(var o=0;o<s;++o)a.name===e.params[o].name&&S(a.start,"Argument name clash in strict mode")}return dt(e,t?"FunctionDeclaration":"FunctionExpression")}function Dt(e,i,n){for(var r=[],s=!0;!ft(e);){if(s)s=!1;else if(vt(he),i&&t.allowTrailingCommas&&ft(e))break;n&&d===he?r.push(null):r.push(Tt(!0))}return r}function Rt(e){var n=ht();return e&&"everywhere"==t.forbidReserved&&(e=!1),d===A?(!e&&(t.forbidReserved&&(3===t.ecmaVersion?Le:Oe)(p)||k&&Be(p))&&-1==i.slice(c,l).indexOf("\\")&&S(c,"The keyword '"+p+"' is reserved"),n.name=p):e&&d.keyword?n.name=d.keyword:bt(),f=!1,at(),dt(n,"Identifier")}}(t),o.version||(o=null));var l={"+":"__add","-":"__subtract","*":"__multiply","/":"__divide","%":"__modulo","==":"__equals","!=":"__equals"},h={"-":"__negate","+":"__self"},u=r.each(["add","subtract","multiply","divide","modulo","equals","negate"],(function(e){this["__"+e]="#"+e}),{__self:function(){return this}});function p(e,t,i){var n=l[t];if(e&&e[n]){var r=e[n](i);return"!="===t?!r:r}switch(t){case"+":return e+i;case"-":return e-i;case"*":return e*i;case"/":return e/i;case"%":return e%i;case"==":return e==i;case"!=":return e!=i}}function m(e,t){var i=h[e];if(t&&t[i])return t[i]();switch(e){case"+":return+t;case"-":return-t}}function g(t,r){if(!t)return"";var s=[];function a(e){for(var t=0,i=s.length;t<i;t++){var n=s[t];if(n[0]>=e)break;e+=n[1]}return e}function o(e){return t.substring(a(e.range[0]),a(e.range[1]))}function u(e,i){for(var n=a(e.range[0]),r=a(e.range[1]),o=0,c=s.length-1;c>=0;c--)if(n>s[c][0]){o=c+1;break}s.splice(o,0,[n,i.length-r+n]),t=t.substring(0,n)+i+t.substring(r)}var d,p=(r=r||{}).url||"",f=r.sourceMaps,m=r.paperFeatures||{},g=r.source||t,v=r.offset||0,b=ae.agent,y=b.versionNumber,_=!1,w=/\r\n|\n|\r/gm;if(f&&(b.chrome&&y>=30||b.webkit&&y>=537.76||b.firefox&&y>=23||b.node)){if(b.node)v-=2;else if(i&&p&&!i.location.href.indexOf(p)){var x=n.getElementsByTagName("html")[0].innerHTML;v=x.substr(0,x.indexOf(t)+1).match(w).length+1}var k=["AA"+function(e){var t="";for(e=(Math.abs(e)<<1)+(e<0?1:0);e||!t;){var i=31&e;(e>>=5)&&(i|=32),t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]}return t}((_=v>0&&!(b.chrome&&y>=36||b.safari&&y>=600||b.firefox&&y>=40||b.node))?0:v)+"A"];k.length=(t.match(w)||[]).length+1+(_?v:0),d={version:3,file:p,names:[],mappings:k.join(";AACA"),sourceRoot:"",sources:[p],sourcesContent:[g]}}return!1===m.operatorOverloading&&!1===m.moduleExports||function e(i,n,r){if(i){for(var s in i)if("range"!==s&&"loc"!==s){var c=i[s];if(Array.isArray(c))for(var d=0,p=c.length;d<p;d++)e(c[d],i,r);else c&&"object"==typeof c&&e(c,i,r)}!1!==r.operatorOverloading&&function(e,i){switch(e.type){case"UnaryExpression":if(e.operator in h&&"Literal"!==e.argument.type){var n=o(e.argument);u(e,'$__("'+e.operator+'", '+n+")")}break;case"BinaryExpression":if(e.operator in l&&"Literal"!==e.left.type){var r=o(e.left),s=o(e.right),c=(g=e.left,v=e.right,t.substring(a(g.range[1]),a(v.range[0]))),d=e.operator;u(e,"__$__("+r+","+c.replace(new RegExp("\\"+d),'"'+d+'"')+", "+s+")")}break;case"UpdateExpression":case"AssignmentExpression":var p=i&&i.type;if(!("ForStatement"===p||"BinaryExpression"===p&&/^[=!<>]/.test(i.operator)||"MemberExpression"===p&&i.computed))if("UpdateExpression"===e.type){var f=(n=o(e.argument))+" = "+(m="__$__("+n+', "'+e.operator[0]+'", 1)');e.prefix?f="("+f+")":"AssignmentExpression"!==p&&"VariableDeclarator"!==p&&"BinaryExpression"!==p||(o(i.left||i.id)===n&&(f=m),f=n+"; "+f),u(e,f)}else if(/^.=$/.test(e.operator)&&"Literal"!==e.left.type){r=o(e.left),s=o(e.right);var m=r+" = __$__("+r+', "'+e.operator[0]+'", '+s+")";u(e,/^\(.*\)$/.test(o(e))?"("+m+")":m)}}var g,v}(i,n),!1!==r.moduleExports&&function(e){switch(e.type){case"ExportDefaultDeclaration":u({range:[e.start,e.declaration.start]},"module.exports = ");break;case"ExportNamedDeclaration":var t=e.declaration,i=e.specifiers;if(t){var n=t.declarations;n&&(n.forEach((function(e){u(e,"module.exports."+o(e))})),u({range:[e.start,t.start+t.kind.length]},""))}else if(i){var r=i.map((function(e){var t=o(e);return"module.exports."+t+" = "+t+"; "})).join("");r&&u(e,r)}}}(i)}}(c(t,{ranges:!0,preserveParens:!0,sourceType:"module"}),null,m),d&&(_&&(t=new Array(v+1).join("\n")+t),/^(inline|both)$/.test(f)&&(t+="\n//# sourceMappingURL=data:application/json;base64,"+e.btoa(unescape(encodeURIComponent(JSON.stringify(d))))),t+="\n//# sourceURL="+(p||"paperscript")),{url:p,source:g,code:t,map:d}}function v(e,t,i){ae=t;var s,a=t.getView(),o=/\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/.test(e)&&!/\bnew\s+Tool\b/.test(e)?new J:null,c=o?o._events:[],l=["onFrame","onResize"].concat(c),h=[],u=[],f="object"==typeof e?e:g(e,i);function v(t,i){for(var n in t)!i&&/^_/.test(n)||!new RegExp("([\\b\\s\\W]|^)"+n.replace(/\$/g,"\\$")+"\\b").test(e)||(h.push(n),u.push(t[n]))}e=f.code,v({__$__:p,$__:m,paper:t,tool:o},!0),v(t),e="var module = { exports: {} }; "+e,(w=r.each(l,(function(t){new RegExp("\\s+"+t+"\\b").test(e)&&(h.push(t),this.push("module.exports."+t+" = "+t+";"))}),[]).join("\n"))&&(e+="\n"+w),e+="\nreturn module.exports;";var b=ae.agent;if(n&&(b.chrome||b.firefox&&b.versionNumber<40)){var y=n.createElement("script"),_=n.head||n.getElementsByTagName("head")[0];b.firefox&&(e="\n"+e),y.appendChild(n.createTextNode("document.__paperscript__ = function("+h+") {"+e+"\n}")),_.appendChild(y),s=n.__paperscript__,delete n.__paperscript__,_.removeChild(y)}else s=Function(h,e);var w,x=(w=s&&s.apply(t,u))||{};return r.each(c,(function(e){var t=x[e];t&&(o[e]=t)})),a&&(x.onResize&&a.setOnResize(x.onResize),a.emit("resize",{size:a.size,delta:new d}),x.onFrame&&a.setOnFrame(x.onFrame),a.requestUpdate()),w}function b(e){if(/^text\/(?:x-|)paperscript$/.test(e.type)&&"true"!==a.getAttribute(e,"ignore")){var t=a.getAttribute(e,"canvas"),i=n.getElementById(t),r=e.src||e.getAttribute("data-src"),s=a.hasAttribute(e,"async"),o="data-paper-scope";if(!i)throw new Error('Unable to find canvas with id "'+t+'"');var c=a.get(i.getAttribute(o))||(new a).setup(i);return i.setAttribute(o,c._id),r?te({url:r,async:s,mimeType:"text/plain",onLoad:function(e){v(e,c,r)}}):v(e.innerHTML,c,e.baseURI),e.setAttribute("data-paper-ignore","true"),c}}function y(){r.each(n&&n.getElementsByTagName("script"),b)}return d.inject(u),f.inject(u),q.inject(u),i&&("complete"===n.readyState?setTimeout(y):U.add(i,{load:y})),{compile:g,execute:v,load:function(e){return e?b(e):y()},parse:c,calculateBinary:p,calculateUnary:m}}.call(this);var ae=new(a.inject(r.exports,{Base:r,Numerical:h,Key:X,DomEvent:U,DomElement:G,document:n,window:i,Symbol:E,PlacedSymbol:M}));return ae.agent.node&&Mr(ae),"function"==typeof t&&t.amd?t("paper",ae):Pr&&(Pr.exports=ae),ae}.call(Sr.exports,"object"==typeof self?self:null)),Sr.exports)),Lr=k({name:"CalculateSupplementaryAngle",components:{UserInputNumber:I},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"CalculateSupplementaryAngle"),n=L(i),r=O(""),s=O(null),a=O();n.question.value=new qr(e.data);const o=(e,t,i,n,r,s,a=30)=>new e.Point(t/2+a*se(i+(n+r)/2),s/2+a*ae(i+(n+r)/2));return z((async()=>{if(await V(),!s.value)return;a.value=new Nr.PaperScope,a.value.setup(s.value);const e=a.value,t=s.value.width,i=s.value.height,r=ne(0,360),c=t*se(r),l=t*ae(r);new e.Path.Line({from:new e.Point(t/2+c,i/2+l),to:new e.Point(t/2-c,i/2-l)}).strokeColor=new Nr.Color("black");let h=0;const u=[];if(n.question.value)for(let s=0;s<n.question.value.angles.length;s++){const a=n.question.value.angles[s];let c;h+=a,console.log(`drawing angle ${s}:\n angle: ${a}\n angleSum: ${h}\n `);const l=h-a;c=s===n.question.value.angles.length-1?180:h;const d=new e.Point(t/2+30*se(r+l),i/2+30*ae(r+l)),p=o(e,t,r,l,c,i),f=new e.Point(t/2+30*se(r+c),i/2+30*ae(r+c)),m=t*se(r+h),g=t*ae(r+h),v=new e.Path.Line({from:new e.Point(t/2,i/2),to:new e.Point(t/2+m,i/2+g)});if(v.strokeColor=new Nr.Color(0,0,0),u.push(v),n.question.value.targetAngleIndex===s){console.log(`drawing targetAngle at i = ${s}:\n baseAngle: ${r}\n targetAngle: ${a}\n sum: ${h}\n nextAngle: ${c}\n `);const n=new Nr.Color(.1,.5,.8,.35),o=new e.Path.Arc({from:d,through:p,to:f});o.strokeColor=new Nr.Color(.1,.5,.8,.75),o.strokeWidth=3,o.fillColor=n;const l=new e.Path;l.closed=!0,l.add(d),l.add(new Nr.Point(t/2,i/2)),l.add(f),l.fillColor=n}else{const n=new Nr.PointText(p);n.content=a.toString()+"°";let s=!0,h=20;for(;s;)s=!1,n.bounds.center=o(e,t,r,l,c,i,h),u.forEach((e=>{e.intersects(n)&&(s=!0)})),h+=7}}})),q((()=>{a.value=void 0})),{answer:r,canvasRef:s,...i,...n}}}),Or={"data-viewable":"CalculateSupplementaryAngle"},Br={ref:"canvasRef",width:"300",height:"300"},Dr=he(Lr,[["render",function(e,t,i,n,r,s){const a=f("user-input-number");return g(),m("div",Or,[t[1]||(t[1]=C("h2",null,"What is the measurement of the highlighted angle?",-1)),C("canvas",Br,null,512),t[2]||(t[2]=C("br",null,null,-1)),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"])])}],["__scopeId","data-v-4f8ac466"]]),Rr={instructions:"Must be 2 or 3.",test:e=>"2"===e||"3"===e?{status:n.ok,msg:""}:{status:n.error,msg:"Must be 2 or 3."}},zr=[{name:"AngleCount",type:r.INT,validator:Rr}],Vr=class _SupplementaryAngles extends l{constructor(e){super(e),t(this,"angles",[]),t(this,"targetAngleIndex"),t(this,"angleCount"),this.angleCount=e[0].AngleCount;let i=0;for(let t=0;t<=this.angleCount-2;t++){const e=ne(25,155-i);this.angles.push(e),i+=e}this.angles.push(180-i),this.targetAngleIndex=ne(0,this.angleCount-1)}isCorrect(e){return this.angles[this.targetAngleIndex]===e}dataShapes(){return _SupplementaryAngles.dataShapes}views(){return _SupplementaryAngles.views}};t(Vr,"dataShapes",[{name:a.MATH_SupplimentaryAngles,fields:zr}]),t(Vr,"views",[Dr]);let qr=Vr;const Fr=k({name:"VerbalAddition",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"VerbalAddition"),n=L(i),r=O(["","","","",""]);n.question.value=new Xr(e.data);const s=B((()=>n.question.value?n.question.value:new Xr(e.data)));return z((()=>{console.log("focusing..."),document.getElementById("input0")?.focus()})),{...i,...n,answer:r,question:s,track:e=>{console.log(`change in ${e}!\n userAnswer: ${r.value.toString()}\n\n qAnswer: ${s.value?.answer.toString()}`),s.value&&s.value.answer[e].toString().length===r.value[e].length&&(parseInt(r.value[e])===s.value.answer[e]?(document.getElementById("input"+e)?.classList.add("correct"),document.getElementById("input"+e)?.classList.remove("incorrect"),document.getElementById("input"+e)?.setAttribute("disabled","true"),e+1<r.value.length?document.getElementById("input"+(e+1))?.focus():n.submitAnswer(r.value)):(document.getElementById("input"+e)?.classList.add("incorrect"),n.submitAnswer(r.value),console.log(`Wrong! ${r.value[e]} !== ${s.value.answer[e]}`)))}}}}),jr={"data-viewable":"VerbalAddition",class:"text-h5"},Hr={class:"text-h5"},Gr=["value"],Ur=["id","onUpdate:modelValue","autofocus","onKeyup"],Wr={key:0},Yr=he(Fr,[["render",function(e,t,i,n,r,s){return g(),m("div",jr,[C("div",Hr,[t[0]||(t[0]=_(" Count by ")),C("strong",null,x(e.question?.n),1),t[1]||(t[1]=_("s: "))]),C("input",{type:"text",disabled:"",class:"correct",value:e.question.answer[0]-e.question.n},null,8,Gr),t[2]||(t[2]=_(", ")),(g(!0),m(y,null,S(e.question.answer,((t,i)=>(g(),m("span",{key:i},[M(C("input",{id:`input${i}`,ref_for:!0,ref:`input${i}`,class:T(`input${t}${i}`),"onUpdate:modelValue":t=>e.answer[i]=t,type:"text",autofocus:0===i,onKeyup:t=>e.track(i)},null,42,Ur),[[E,e.answer[i]]]),i!==e.question.answer.length-1?(g(),m("span",Wr,", ")):b("",!0)])))),128))])}],["__scopeId","data-v-0452c3a5"]]),$r=[{name:"n",type:r.INT},{name:"hand",type:r.STRING,validator:{test:e=>"LEFT"===e||"RIGHT"===e?{status:n.ok,msg:""}:{status:n.error,msg:"Hand must be LEFT or RIGHT"}}}],Kr=class _CountBy extends l{constructor(e){super(e),t(this,"n"),t(this,"hand"),this.n=e[0].n,this.hand=e[0].hand}get answer(){const e=[],t="LEFT"===this.hand?this.n:6*this.n;for(let i=0;i<5;i++)e.push(t+i*this.n);return e}isCorrect(e){console.log(`Solution: ${this.answer.toString()}`);for(let i=0;i<this.answer.length;i++)if(("string"==typeof(t=e[i])?parseInt(t):t)!==this.answer[i])return console.log(`answer[${i}] == ${e[i]} !== ${this.answer[i]}`),!1;var t;return!0}dataShapes(){return _CountBy.dataShapes}views(){return _CountBy.views}};t(Kr,"dataShapes",[{name:a.MATH_CountBy,fields:$r}]),t(Kr,"views",[Yr]),t(Kr,"seedData",function(){const e=[];for(let t=2;t<=10;t++)e.push({n:t,hand:"LEFT"}),e.push({n:t,hand:"RIGHT"});return e}()),t(Kr,"acceptsUserData",!1);let Xr=Kr;const Qr=new CourseWare("math",[zn,$n,Nn,Jn,dr,wr,qr,Xr]);var Zr,Jr,es={exports:{}};const ts=xr((Zr||(Zr=1,Jr=es,function(e){function t(){if(t.prototype._singleton)throw new Error("WebMidi is a singleton, it cannot be instantiated directly.");(t.prototype._singleton=this)._inputs=[],this._outputs=[],this._userHandlers={},this._stateChangeQueue=[],this._processingStateChange=!1,this._midiInterfaceEvents=["connected","disconnected"],this._nrpnBuffer=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]],this._nrpnEventsEnabled=!0,this._nrpnTypes=["entry","increment","decrement"],this._notes=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],this._semitones={C:0,D:2,E:4,F:5,G:7,A:9,B:11},Object.defineProperties(this,{MIDI_SYSTEM_MESSAGES:{value:{sysex:240,timecode:241,songposition:242,songselect:243,tuningrequest:246,sysexend:247,clock:248,start:250,continue:251,stop:252,activesensing:254,reset:255,midimessage:0,unknownsystemmessage:-1},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MESSAGES:{value:{noteoff:8,noteon:9,keyaftertouch:10,controlchange:11,channelmode:11,nrpn:11,programchange:12,channelaftertouch:13,pitchbend:14},writable:!1,enumerable:!0,configurable:!1},MIDI_REGISTERED_PARAMETER:{value:{pitchbendrange:[0,0],channelfinetuning:[0,1],channelcoarsetuning:[0,2],tuningprogram:[0,3],tuningbank:[0,4],modulationrange:[0,5],azimuthangle:[61,0],elevationangle:[61,1],gain:[61,2],distanceratio:[61,3],maximumdistance:[61,4],maximumdistancegain:[61,5],referencedistanceratio:[61,6],panspreadangle:[61,7],rollangle:[61,8]},writable:!1,enumerable:!0,configurable:!1},MIDI_CONTROL_CHANGE_MESSAGES:{value:{bankselectcoarse:0,modulationwheelcoarse:1,breathcontrollercoarse:2,footcontrollercoarse:4,portamentotimecoarse:5,dataentrycoarse:6,volumecoarse:7,balancecoarse:8,pancoarse:10,expressioncoarse:11,effectcontrol1coarse:12,effectcontrol2coarse:13,generalpurposeslider1:16,generalpurposeslider2:17,generalpurposeslider3:18,generalpurposeslider4:19,bankselectfine:32,modulationwheelfine:33,breathcontrollerfine:34,footcontrollerfine:36,portamentotimefine:37,dataentryfine:38,volumefine:39,balancefine:40,panfine:42,expressionfine:43,effectcontrol1fine:44,effectcontrol2fine:45,holdpedal:64,portamento:65,sustenutopedal:66,softpedal:67,legatopedal:68,hold2pedal:69,soundvariation:70,resonance:71,soundreleasetime:72,soundattacktime:73,brightness:74,soundcontrol6:75,soundcontrol7:76,soundcontrol8:77,soundcontrol9:78,soundcontrol10:79,generalpurposebutton1:80,generalpurposebutton2:81,generalpurposebutton3:82,generalpurposebutton4:83,reverblevel:91,tremololevel:92,choruslevel:93,celestelevel:94,phaserlevel:95,databuttonincrement:96,databuttondecrement:97,nonregisteredparametercoarse:98,nonregisteredparameterfine:99,registeredparametercoarse:100,registeredparameterfine:101},writable:!1,enumerable:!0,configurable:!1},MIDI_NRPN_MESSAGES:{value:{entrymsb:6,entrylsb:38,increment:96,decrement:97,paramlsb:98,parammsb:99,nullactiveparameter:127},writable:!1,enumerable:!0,configurable:!1},MIDI_CHANNEL_MODE_MESSAGES:{value:{allsoundoff:120,resetallcontrollers:121,localcontrol:122,allnotesoff:123,omnimodeoff:124,omnimodeon:125,monomodeon:126,polymodeon:127},writable:!1,enumerable:!0,configurable:!1},octaveOffset:{value:0,writable:!0,enumerable:!0,configurable:!1}}),Object.defineProperties(this,{supported:{enumerable:!0,get:function(){return"requestMIDIAccess"in navigator}},enabled:{enumerable:!0,get:function(){return void 0!==this.interface}.bind(this)},inputs:{enumerable:!0,get:function(){return this._inputs}.bind(this)},outputs:{enumerable:!0,get:function(){return this._outputs}.bind(this)},sysexEnabled:{enumerable:!0,get:function(){return!(!this.interface||!this.interface.sysexEnabled)}.bind(this)},nrpnEventsEnabled:{enumerable:!0,get:function(){return!!this._nrpnEventsEnabled}.bind(this),set:function(e){return this._nrpnEventsEnabled=e,this._nrpnEventsEnabled}},nrpnTypes:{enumerable:!0,get:function(){return this._nrpnTypes}.bind(this)},time:{enumerable:!0,get:function(){return performance.now()}}})}var i=new t;function n(e){var t=this;this._userHandlers={channel:{},system:{}},this._midiInput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiInput.connection}},id:{enumerable:!0,get:function(){return t._midiInput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiInput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiInput.name}},state:{enumerable:!0,get:function(){return t._midiInput.state}},type:{enumerable:!0,get:function(){return t._midiInput.type}}}),this._initializeUserHandlers(),this._midiInput.onmidimessage=this._onMidiMessage.bind(this)}function r(e){var t=this;this._midiOutput=e,Object.defineProperties(this,{connection:{enumerable:!0,get:function(){return t._midiOutput.connection}},id:{enumerable:!0,get:function(){return t._midiOutput.id}},manufacturer:{enumerable:!0,get:function(){return t._midiOutput.manufacturer}},name:{enumerable:!0,get:function(){return t._midiOutput.name}},state:{enumerable:!0,get:function(){return t._midiOutput.state}},type:{enumerable:!0,get:function(){return t._midiOutput.type}}})}t.prototype.enable=function(e,t){this.enabled||(this.supported?navigator.requestMIDIAccess({sysex:t}).then(function(t){var i,n=[],r=[];this.interface=t,this._resetInterfaceUserHandlers(),this.interface.onstatechange=function(e){n.push(e)};for(var s=t.inputs.values(),a=s.next();a&&!a.done;a=s.next())r.push(a.value.open());for(var o=t.outputs.values(),c=o.next();c&&!c.done;c=o.next())r.push(c.value.open());function l(){clearTimeout(i),this._updateInputsAndOutputs(),this.interface.onstatechange=this._onInterfaceStateChange.bind(this),"function"==typeof e&&e.call(this),n.forEach(function(e){this._onInterfaceStateChange(e)}.bind(this))}i=setTimeout(l.bind(this),200),Promise&&Promise.all(r).catch((function(e){})).then(l.bind(this))}.bind(this),function(t){"function"==typeof e&&e.call(this,t)}.bind(this)):"function"==typeof e&&e(new Error("The Web MIDI API is not supported by your browser.")))},t.prototype.disable=function(){if(!this.supported)throw new Error("The Web MIDI API is not supported by your browser.");this.enabled&&(this.removeListener(),this.inputs.forEach((function(e){e.removeListener()}))),this.interface&&(this.interface.onstatechange=void 0),this.interface=void 0,this._inputs=[],this._outputs=[],this._nrpnEventsEnabled=!0,this._resetInterfaceUserHandlers()},t.prototype.addListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before adding event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");return this._userHandlers[e].push(t),this},t.prototype.hasListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before checking event listeners.");if("function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(!(0<=this._midiInterfaceEvents.indexOf(e)))throw new TypeError("The specified event type is not supported.");for(var i=0;i<this._userHandlers[e].length;i++)if(this._userHandlers[e][i]===t)return!0;return!1},t.prototype.removeListener=function(e,t){if(!this.enabled)throw new Error("WebMidi must be enabled before removing event listeners.");if(void 0!==t&&"function"!=typeof t)throw new TypeError("The 'listener' parameter must be a function.");if(0<=this._midiInterfaceEvents.indexOf(e))if(t)for(var i=0;i<this._userHandlers[e].length;i++)this._userHandlers[e][i]===t&&this._userHandlers[e].splice(i,1);else this._userHandlers[e]=[];else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._resetInterfaceUserHandlers()}return this},t.prototype.toMIDIChannels=function(e){var t;if("all"===e||void 0===e)t=["all"];else{if("none"===e)return[];t=Array.isArray(e)?e:[e]}return-1<t.indexOf("all")&&(t=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),t.map((function(e){return parseInt(e)})).filter((function(e){return 1<=e&&e<=16}))},t.prototype.getInputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.inputs.length;t++)if(this.inputs[t].id===e)return this.inputs[t];return!1},t.prototype.getOutputById=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");e=String(e);for(var t=0;t<this.outputs.length;t++)if(this.outputs[t].id===e)return this.outputs[t];return!1},t.prototype.getInputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.inputs.length;t++)if(~this.inputs[t].name.indexOf(e))return this.inputs[t];return!1},t.prototype.getOctave=function(e){if(null!=e&&0<=e&&e<=127)return Math.floor(Math.floor(e)/12-1)+Math.floor(i.octaveOffset)},t.prototype.getOutputByName=function(e){if(!this.enabled)throw new Error("WebMidi is not enabled.");for(var t=0;t<this.outputs.length;t++)if(~this.outputs[t].name.indexOf(e))return this.outputs[t];return!1},t.prototype.guessNoteNumber=function(e){var t=!1;if(e&&e.toFixed&&0<=e&&e<=127?t=Math.round(e):0<=parseInt(e)&&parseInt(e)<=127?t=parseInt(e):("string"==typeof e||e instanceof String)&&(t=this.noteNameToNumber(e)),!1===t)throw new Error("Invalid input value ("+e+").");return t},t.prototype.noteNameToNumber=function(e){"string"!=typeof e&&(e="");var t=e.match(/([CDEFGAB])(#{0,2}|b{0,2})(-?\d+)/i);if(!t)throw new RangeError("Invalid note name.");var n=i._semitones[t[1].toUpperCase()],r=12*(parseInt(t[3])+1-Math.floor(i.octaveOffset))+n;if(-1<t[2].toLowerCase().indexOf("b")?r-=t[2].length:-1<t[2].toLowerCase().indexOf("#")&&(r+=t[2].length),r<0||127<r)throw new RangeError("Invalid note name or note outside valid range.");return r},t.prototype._updateInputsAndOutputs=function(){this._updateInputs(),this._updateOutputs()},t.prototype._updateInputs=function(){for(var e=0;e<this._inputs.length;e++){for(var t=!0,i=this.interface.inputs.values(),r=i.next();r&&!r.done;r=i.next())if(this._inputs[e]._midiInput===r.value){t=!1;break}t&&this._inputs.splice(e,1)}this.interface&&this.interface.inputs.forEach(function(e){for(var t=!0,i=0;i<this._inputs.length;i++)this._inputs[i]._midiInput===e&&(t=!1);t&&this._inputs.push(new n(e))}.bind(this))},t.prototype._updateOutputs=function(){for(var e=0;e<this._outputs.length;e++){for(var t=!0,i=this.interface.outputs.values(),n=i.next();n&&!n.done;n=i.next())if(this._outputs[e]._midiOutput===n.value){t=!1;break}t&&this._outputs.splice(e,1)}this.interface&&this.interface.outputs.forEach(function(e){for(var t=!0,i=0;i<this._outputs.length;i++)this._outputs[i]._midiOutput===e&&(t=!1);t&&this._outputs.push(new r(e))}.bind(this))},t.prototype._onInterfaceStateChange=function(e){this._updateInputsAndOutputs();var t={timestamp:e.timeStamp,type:e.port.state};this.interface&&"connected"===e.port.state?"output"===e.port.type?t.port=this.getOutputById(e.port.id):"input"===e.port.type&&(t.port=this.getInputById(e.port.id)):t.port={connection:"closed",id:e.port.id,manufacturer:e.port.manufacturer,name:e.port.name,state:e.port.state,type:e.port.type},this._userHandlers[e.port.state].forEach((function(e){e(t)}))},t.prototype._resetInterfaceUserHandlers=function(){for(var e=0;e<this._midiInterfaceEvents.length;e++)this._userHandlers[this._midiInterfaceEvents[e]]=[]},n.prototype.on=n.prototype.addListener=function(e,t,n){var r=this;if(void 0===t&&(t="all"),Array.isArray(t)||(t=[t]),t.forEach((function(e){if("all"!==e&&!(1<=e&&e<=16))throw new RangeError("The 'channel' parameter is invalid.")})),"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0!==i.MIDI_SYSTEM_MESSAGES[e])this._userHandlers.system[e]||(this._userHandlers.system[e]=[]),this._userHandlers.system[e].push(n);else{if(void 0===i.MIDI_CHANNEL_MESSAGES[e])throw new TypeError("The specified event type is not supported.");if(-1<t.indexOf("all")){t=[];for(var s=1;s<=16;s++)t.push(s)}this._userHandlers.channel[e]||(this._userHandlers.channel[e]=[]),t.forEach((function(t){r._userHandlers.channel[e][t]||(r._userHandlers.channel[e][t]=[]),r._userHandlers.channel[e][t].push(n)}))}return this},n.prototype.hasListener=function(e,t,n){var r=this;if("function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==i.MIDI_SYSTEM_MESSAGES[e]){for(var s=0;s<this._userHandlers.system[e].length;s++)if(this._userHandlers.system[e][s]===n)return!0}else if(void 0!==i.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var a=1;a<=16;a++)t.push(a)}return!!this._userHandlers.channel[e]&&t.every((function(t){var i=r._userHandlers.channel[e][t];return i&&-1<i.indexOf(n)}))}return!1},n.prototype.removeListener=function(e,t,n){var r=this;if(void 0!==n&&"function"!=typeof n)throw new TypeError("The 'listener' parameter must be a function.");if(void 0===t&&(t="all"),t.constructor!==Array&&(t=[t]),void 0!==i.MIDI_SYSTEM_MESSAGES[e])if(void 0===n)this._userHandlers.system[e]=[];else for(var s=0;s<this._userHandlers.system[e].length;s++)this._userHandlers.system[e][s]===n&&this._userHandlers.system[e].splice(s,1);else if(void 0!==i.MIDI_CHANNEL_MESSAGES[e]){if(-1<t.indexOf("all")){t=[];for(var a=1;a<=16;a++)t.push(a)}if(!this._userHandlers.channel[e])return this;t.forEach((function(t){var i=r._userHandlers.channel[e][t];if(i)if(void 0===n)r._userHandlers.channel[e][t]=[];else for(var s=0;s<i.length;s++)i[s]===n&&i.splice(s,1)}))}else{if(void 0!==e)throw new TypeError("The specified event type is not supported.");this._initializeUserHandlers()}return this},n.prototype._initializeUserHandlers=function(){for(var e in i.MIDI_CHANNEL_MESSAGES)Object.prototype.hasOwnProperty.call(i.MIDI_CHANNEL_MESSAGES,e)&&(this._userHandlers.channel[e]={});for(var t in i.MIDI_SYSTEM_MESSAGES)Object.prototype.hasOwnProperty.call(i.MIDI_SYSTEM_MESSAGES,t)&&(this._userHandlers.system[t]=[])},n.prototype._onMidiMessage=function(e){if(0<this._userHandlers.system.midimessage.length){var t={target:this,data:e.data,timestamp:e.timeStamp,type:"midimessage"};this._userHandlers.system.midimessage.forEach((function(e){e(t)}))}e.data[0]<240?(this._parseChannelEvent(e),this._parseNrpnEvent(e)):e.data[0]<=255&&this._parseSystemEvent(e)},n.prototype._parseNrpnEvent=function(e){var t,n,r=e.data[0]>>4,s=15&e.data[0],a=1+s;if(1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0),i.nrpnEventsEnabled&&r===i.MIDI_CHANNEL_MESSAGES.controlchange&&(t>=i.MIDI_NRPN_MESSAGES.increment&&t<=i.MIDI_NRPN_MESSAGES.parammsb||t===i.MIDI_NRPN_MESSAGES.entrymsb||t===i.MIDI_NRPN_MESSAGES.entrylsb)){var o={target:this,type:"controlchange",data:e.data,timestamp:e.timeStamp,channel:a,controller:{number:t,name:this.getCcNameByNumber(t)},value:n};if(o.controller.number===i.MIDI_NRPN_MESSAGES.parammsb&&o.value!=i.MIDI_NRPN_MESSAGES.nullactiveparameter)i._nrpnBuffer[s]=[],i._nrpnBuffer[s][0]=o;else if(1===i._nrpnBuffer[s].length&&o.controller.number===i.MIDI_NRPN_MESSAGES.paramlsb)i._nrpnBuffer[s].push(o);else if(2!==i._nrpnBuffer[s].length||o.controller.number!==i.MIDI_NRPN_MESSAGES.increment&&o.controller.number!==i.MIDI_NRPN_MESSAGES.decrement&&o.controller.number!==i.MIDI_NRPN_MESSAGES.entrymsb)if(3===i._nrpnBuffer[s].length&&i._nrpnBuffer[s][2].number===i.MIDI_NRPN_MESSAGES.entrymsb&&o.controller.number===i.MIDI_NRPN_MESSAGES.entrylsb)i._nrpnBuffer[s].push(o);else if(3<=i._nrpnBuffer[s].length&&i._nrpnBuffer[s].length<=4&&o.controller.number===i.MIDI_NRPN_MESSAGES.parammsb&&o.value===i.MIDI_NRPN_MESSAGES.nullactiveparameter)i._nrpnBuffer[s].push(o);else if(4<=i._nrpnBuffer[s].length&&i._nrpnBuffer[s].length<=5&&o.controller.number===i.MIDI_NRPN_MESSAGES.paramlsb&&o.value===i.MIDI_NRPN_MESSAGES.nullactiveparameter){i._nrpnBuffer[s].push(o);var c=[];i._nrpnBuffer[s].forEach((function(e){c.push(e.data)}));var l=i._nrpnBuffer[s][0].value<<7|i._nrpnBuffer[s][1].value,h=i._nrpnBuffer[s][2].value;6===i._nrpnBuffer[s].length&&(h=i._nrpnBuffer[s][2].value<<7|i._nrpnBuffer[s][3].value);var u="";switch(i._nrpnBuffer[s][2].controller.number){case i.MIDI_NRPN_MESSAGES.entrymsb:u=i._nrpnTypes[0];break;case i.MIDI_NRPN_MESSAGES.increment:u=i._nrpnTypes[1];break;case i.MIDI_NRPN_MESSAGES.decrement:u=i._nrpnTypes[2];break;default:throw new Error("The NPRN type was unidentifiable.")}var d={timestamp:o.timestamp,channel:o.channel,type:"nrpn",data:c,controller:{number:l,type:u,name:"Non-Registered Parameter "+l},value:h};i._nrpnBuffer[s]=[],this._userHandlers.channel[d.type]&&this._userHandlers.channel[d.type][d.channel]&&this._userHandlers.channel[d.type][d.channel].forEach((function(e){e(d)}))}else i._nrpnBuffer[s]=[];else i._nrpnBuffer[s].push(o)}},n.prototype._parseChannelEvent=function(e){var t,n,r=e.data[0]>>4,s=1+(15&e.data[0]);1<e.data.length&&(t=e.data[1],n=2<e.data.length?e.data[2]:void 0);var a={target:this,data:e.data,timestamp:e.timeStamp,channel:s};r===i.MIDI_CHANNEL_MESSAGES.noteoff||r===i.MIDI_CHANNEL_MESSAGES.noteon&&0===n?(a.type="noteoff",a.note={number:t,name:i._notes[t%12],octave:i.getOctave(t)},a.velocity=n/127,a.rawVelocity=n):r===i.MIDI_CHANNEL_MESSAGES.noteon?(a.type="noteon",a.note={number:t,name:i._notes[t%12],octave:i.getOctave(t)},a.velocity=n/127,a.rawVelocity=n):r===i.MIDI_CHANNEL_MESSAGES.keyaftertouch?(a.type="keyaftertouch",a.note={number:t,name:i._notes[t%12],octave:i.getOctave(t)},a.value=n/127):r===i.MIDI_CHANNEL_MESSAGES.controlchange&&0<=t&&t<=119?(a.type="controlchange",a.controller={number:t,name:this.getCcNameByNumber(t)},a.value=n):r===i.MIDI_CHANNEL_MESSAGES.channelmode&&120<=t&&t<=127?(a.type="channelmode",a.controller={number:t,name:this.getChannelModeByNumber(t)},a.value=n):r===i.MIDI_CHANNEL_MESSAGES.programchange?(a.type="programchange",a.value=t):r===i.MIDI_CHANNEL_MESSAGES.channelaftertouch?(a.type="channelaftertouch",a.value=t/127):r===i.MIDI_CHANNEL_MESSAGES.pitchbend?(a.type="pitchbend",a.value=((n<<7)+t-8192)/8192):a.type="unknownchannelmessage",this._userHandlers.channel[a.type]&&this._userHandlers.channel[a.type][s]&&this._userHandlers.channel[a.type][s].forEach((function(e){e(a)}))},n.prototype.getCcNameByNumber=function(e){if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("The control change number must be between 0 and 119.");for(var t in i.MIDI_CONTROL_CHANGE_MESSAGES)if(Object.prototype.hasOwnProperty.call(i.MIDI_CONTROL_CHANGE_MESSAGES,t)&&e===i.MIDI_CONTROL_CHANGE_MESSAGES[t])return t},n.prototype.getChannelModeByNumber=function(e){if(!(120<=(e=Math.floor(e))&&status<=127))throw new RangeError("The control change number must be between 120 and 127.");for(var t in i.MIDI_CHANNEL_MODE_MESSAGES)if(Object.prototype.hasOwnProperty.call(i.MIDI_CHANNEL_MODE_MESSAGES,t)&&e===i.MIDI_CHANNEL_MODE_MESSAGES[t])return t},n.prototype._parseSystemEvent=function(e){var t=e.data[0],n={target:this,data:e.data,timestamp:e.timeStamp};t===i.MIDI_SYSTEM_MESSAGES.sysex?n.type="sysex":t===i.MIDI_SYSTEM_MESSAGES.timecode?n.type="timecode":t===i.MIDI_SYSTEM_MESSAGES.songposition?n.type="songposition":t===i.MIDI_SYSTEM_MESSAGES.songselect?(n.type="songselect",n.song=e.data[1]):t===i.MIDI_SYSTEM_MESSAGES.tuningrequest?n.type="tuningrequest":t===i.MIDI_SYSTEM_MESSAGES.clock?n.type="clock":t===i.MIDI_SYSTEM_MESSAGES.start?n.type="start":t===i.MIDI_SYSTEM_MESSAGES.continue?n.type="continue":t===i.MIDI_SYSTEM_MESSAGES.stop?n.type="stop":t===i.MIDI_SYSTEM_MESSAGES.activesensing?n.type="activesensing":t===i.MIDI_SYSTEM_MESSAGES.reset?n.type="reset":n.type="unknownsystemmessage",this._userHandlers.system[n.type]&&this._userHandlers.system[n.type].forEach((function(e){e(n)}))},r.prototype.send=function(e,t,i){if(!(128<=e&&e<=255))throw new RangeError("The status byte must be an integer between 128 (0x80) and 255 (0xFF).");void 0===t&&(t=[]),Array.isArray(t)||(t=[t]);var n=[];return t.forEach((function(e){var t=Math.floor(e);if(!(0<=t&&t<=255))throw new RangeError("Data bytes must be integers between 0 (0x00) and 255 (0xFF).");n.push(t)})),this._midiOutput.send([e].concat(n),parseFloat(i)||0),this},r.prototype.sendSysex=function(e,t,n){if(!i.sysexEnabled)throw new Error("Sysex message support must first be activated.");return n=n||{},e=[].concat(e),t.forEach((function(e){if(e<0||127<e)throw new RangeError("The data bytes of a sysex message must be integers between 0 (0x00) and 127 (0x7F).")})),t=e.concat(t,i.MIDI_SYSTEM_MESSAGES.sysexend),this.send(i.MIDI_SYSTEM_MESSAGES.sysex,t,this._parseTimeParameter(n.time)),this},r.prototype.sendTimecodeQuarterFrame=function(e,t){return t=t||{},this.send(i.MIDI_SYSTEM_MESSAGES.timecode,e,this._parseTimeParameter(t.time)),this},r.prototype.sendSongPosition=function(e,t){t=t||{};var n=(e=Math.floor(e)||0)>>7&127,r=127&e;return this.send(i.MIDI_SYSTEM_MESSAGES.songposition,[n,r],this._parseTimeParameter(t.time)),this},r.prototype.sendSongSelect=function(e,t){if(t=t||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The song number must be between 0 and 127.");return this.send(i.MIDI_SYSTEM_MESSAGES.songselect,[e],this._parseTimeParameter(t.time)),this},r.prototype.sendTuningRequest=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.tuningrequest,void 0,this._parseTimeParameter(e.time)),this},r.prototype.sendClock=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.clock,void 0,this._parseTimeParameter(e.time)),this},r.prototype.sendStart=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.start,void 0,this._parseTimeParameter(e.time)),this},r.prototype.sendContinue=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.continue,void 0,this._parseTimeParameter(e.time)),this},r.prototype.sendStop=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.stop,void 0,this._parseTimeParameter(e.time)),this},r.prototype.sendActiveSensing=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.activesensing,[],this._parseTimeParameter(e.time)),this},r.prototype.sendReset=function(e){return e=e||{},this.send(i.MIDI_SYSTEM_MESSAGES.reset,void 0,this._parseTimeParameter(e.time)),this},r.prototype.stopNote=function(e,t,n){if("all"===e)return this.sendChannelMode("allnotesoff",0,t,n);var r=64;return(n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(r=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(r=127*n.velocity),this._convertNoteToArray(e).forEach(function(e){i.toMIDIChannels(t).forEach(function(t){this.send((i.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(r)],this._parseTimeParameter(n.time))}.bind(this))}.bind(this)),this},r.prototype.playNote=function(e,t,n){var r,s=64;if((n=n||{}).rawVelocity?!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=127&&(s=n.velocity):!isNaN(n.velocity)&&0<=n.velocity&&n.velocity<=1&&(s=127*n.velocity),r=this._parseTimeParameter(n.time),this._convertNoteToArray(e).forEach(function(e){i.toMIDIChannels(t).forEach(function(t){this.send((i.MIDI_CHANNEL_MESSAGES.noteon<<4)+(t-1),[e,Math.round(s)],r)}.bind(this))}.bind(this)),!isNaN(n.duration)){n.duration<=0&&(n.duration=0);var a=64;n.rawVelocity?!isNaN(n.release)&&0<=n.release&&n.release<=127&&(a=n.release):!isNaN(n.release)&&0<=n.release&&n.release<=1&&(a=127*n.release),this._convertNoteToArray(e).forEach(function(e){i.toMIDIChannels(t).forEach(function(t){this.send((i.MIDI_CHANNEL_MESSAGES.noteoff<<4)+(t-1),[e,Math.round(a)],(r||i.time)+n.duration)}.bind(this))}.bind(this))}return this},r.prototype.sendKeyAftertouch=function(e,t,n,r){var s=this;if(r=r||{},t<1||16<t)throw new RangeError("The channel must be between 1 and 16.");(isNaN(n)||n<0||1<n)&&(n=.5);var a=Math.round(127*n);return this._convertNoteToArray(e).forEach((function(e){i.toMIDIChannels(t).forEach((function(t){s.send((i.MIDI_CHANNEL_MESSAGES.keyaftertouch<<4)+(t-1),[e,a],s._parseTimeParameter(r.time))}))})),this},r.prototype.sendControlChange=function(e,t,n,r){if(r=r||{},"string"==typeof e){if(void 0===(e=i.MIDI_CONTROL_CHANGE_MESSAGES[e]))throw new TypeError("Invalid controller name.")}else if(!(0<=(e=Math.floor(e))&&e<=119))throw new RangeError("Controller numbers must be between 0 and 119.");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("Controller value must be between 0 and 127.");return i.toMIDIChannels(n).forEach(function(n){this.send((i.MIDI_CHANNEL_MESSAGES.controlchange<<4)+(n-1),[e,t],this._parseTimeParameter(r.time))}.bind(this)),this},r.prototype._selectRegisteredParameter=function(e,t,n){var r=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control65 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control64 value must be between 0 and 127");return i.toMIDIChannels(t).forEach((function(){r.sendControlChange(101,e[0],t,{time:n}),r.sendControlChange(100,e[1],t,{time:n})})),this},r.prototype._selectNonRegisteredParameter=function(e,t,n){var r=this;if(e[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The control63 value must be between 0 and 127");if(e[1]=Math.floor(e[1]),!(0<=e[1]&&e[1]<=127))throw new RangeError("The control62 value must be between 0 and 127");return i.toMIDIChannels(t).forEach((function(){r.sendControlChange(99,e[0],t,{time:n}),r.sendControlChange(98,e[1],t,{time:n})})),this},r.prototype._setCurrentRegisteredParameter=function(e,t,n){var r=this;if((e=[].concat(e))[0]=Math.floor(e[0]),!(0<=e[0]&&e[0]<=127))throw new RangeError("The msb value must be between 0 and 127");return i.toMIDIChannels(t).forEach((function(){r.sendControlChange(6,e[0],t,{time:n})})),e[1]=Math.floor(e[1]),0<=e[1]&&e[1]<=127&&i.toMIDIChannels(t).forEach((function(){r.sendControlChange(38,e[1],t,{time:n})})),this},r.prototype._deselectRegisteredParameter=function(e,t){var n=this;return i.toMIDIChannels(e).forEach((function(){n.sendControlChange(101,127,e,{time:t}),n.sendControlChange(100,127,e,{time:t})})),this},r.prototype.setRegisteredParameter=function(e,t,n,r){var s=this;if(r=r||{},!Array.isArray(e)){if(!i.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=i.MIDI_REGISTERED_PARAMETER[e]}return i.toMIDIChannels(n).forEach((function(){s._selectRegisteredParameter(e,n,r.time),s._setCurrentRegisteredParameter(t,n,r.time),s._deselectRegisteredParameter(n,r.time)})),this},r.prototype.setNonRegisteredParameter=function(e,t,n,r){var s=this;if(r=r||{},!(0<=e[0]&&e[0]<=127&&0<=e[1]&&e[1]<=127))throw new Error("Position 0 and 1 of the 2-position parameter array must both be between 0 and 127.");return t=[].concat(t),i.toMIDIChannels(n).forEach((function(){s._selectNonRegisteredParameter(e,n,r.time),s._setCurrentRegisteredParameter(t,n,r.time),s._deselectRegisteredParameter(n,r.time)})),this},r.prototype.incrementRegisteredParameter=function(e,t,n){var r=this;if(n=n||{},!Array.isArray(e)){if(!i.MIDI_REGISTERED_PARAMETER[e])throw new Error("The specified parameter is not available.");e=i.MIDI_REGISTERED_PARAMETER[e]}return i.toMIDIChannels(t).forEach((function(){r._selectRegisteredParameter(e,t,n.time),r.sendControlChange(96,0,t,{time:n.time}),r._deselectRegisteredParameter(t,n.time)})),this},r.prototype.decrementRegisteredParameter=function(e,t,n){if(n=n||{},!Array.isArray(e)){if(!i.MIDI_REGISTERED_PARAMETER[e])throw new TypeError("The specified parameter is not available.");e=i.MIDI_REGISTERED_PARAMETER[e]}return i.toMIDIChannels(t).forEach(function(){this._selectRegisteredParameter(e,t,n.time),this.sendControlChange(97,0,t,{time:n.time}),this._deselectRegisteredParameter(t,n.time)}.bind(this)),this},r.prototype.setPitchBendRange=function(e,t,n,r){var s=this;if(r=r||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return i.toMIDIChannels(n).forEach((function(){s.setRegisteredParameter("pitchbendrange",[e,t],n,{time:r.time})})),this},r.prototype.setModulationRange=function(e,t,n,r){var s=this;if(r=r||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The semitones value must be between 0 and 127");if(!(0<=(t=Math.floor(t)||0)&&t<=127))throw new RangeError("The cents value must be between 0 and 127");return i.toMIDIChannels(n).forEach((function(){s.setRegisteredParameter("modulationrange",[e,t],n,{time:r.time})})),this},r.prototype.setMasterTuning=function(e,t,n){var r=this;if(n=n||{},(e=parseFloat(e)||0)<=-65||64<=e)throw new RangeError("The value must be a decimal number larger than -65 and smaller than 64.");var s=Math.floor(e)+64,a=e-Math.floor(e),o=(a=Math.round((a+1)/2*16383))>>7&127,c=127&a;return i.toMIDIChannels(t).forEach((function(){r.setRegisteredParameter("channelcoarsetuning",s,t,{time:n.time}),r.setRegisteredParameter("channelfinetuning",[o,c],t,{time:n.time})})),this},r.prototype.setTuningProgram=function(e,t,n){var r=this;if(n=n||{},!(0<=(e=Math.floor(e))&&e<=127))throw new RangeError("The program value must be between 0 and 127");return i.toMIDIChannels(t).forEach((function(){r.setRegisteredParameter("tuningprogram",e,t,{time:n.time})})),this},r.prototype.setTuningBank=function(e,t,n){var r=this;if(n=n||{},!(0<=(e=Math.floor(e)||0)&&e<=127))throw new RangeError("The bank value must be between 0 and 127");return i.toMIDIChannels(t).forEach((function(){r.setRegisteredParameter("tuningbank",e,t,{time:n.time})})),this},r.prototype.sendChannelMode=function(e,t,n,r){if(r=r||{},"string"==typeof e){if(!(e=i.MIDI_CHANNEL_MODE_MESSAGES[e]))throw new TypeError("Invalid channel mode message name.")}else if(!(120<=(e=Math.floor(e))&&e<=127))throw new RangeError("Channel mode numerical identifiers must be between 120 and 127.");if((t=Math.floor(t)||0)<0||127<t)throw new RangeError("Value must be an integer between 0 and 127.");return i.toMIDIChannels(n).forEach(function(n){this.send((i.MIDI_CHANNEL_MESSAGES.channelmode<<4)+(n-1),[e,t],this._parseTimeParameter(r.time))}.bind(this)),this},r.prototype.sendProgramChange=function(e,t,n){var r=this;if(n=n||{},e=Math.floor(e),isNaN(e)||e<0||127<e)throw new RangeError("Program numbers must be between 0 and 127.");return i.toMIDIChannels(t).forEach((function(t){r.send((i.MIDI_CHANNEL_MESSAGES.programchange<<4)+(t-1),[e],r._parseTimeParameter(n.time))})),this},r.prototype.sendChannelAftertouch=function(e,t,n){var r=this;n=n||{},e=parseFloat(e),(isNaN(e)||e<0||1<e)&&(e=.5);var s=Math.round(127*e);return i.toMIDIChannels(t).forEach((function(e){r.send((i.MIDI_CHANNEL_MESSAGES.channelaftertouch<<4)+(e-1),[s],r._parseTimeParameter(n.time))})),this},r.prototype.sendPitchBend=function(e,t,n){var r=this;if(n=n||{},isNaN(e)||e<-1||1<e)throw new RangeError("Pitch bend value must be between -1 and 1.");var s=Math.round((e+1)/2*16383),a=s>>7&127,o=127&s;return i.toMIDIChannels(t).forEach((function(e){r.send((i.MIDI_CHANNEL_MESSAGES.pitchbend<<4)+(e-1),[o,a],r._parseTimeParameter(n.time))})),this},r.prototype._parseTimeParameter=function(e){var t,n=parseFloat(e);return"string"==typeof e&&"+"===e.substring(0,1)?n&&0<n&&(t=i.time+n):n>i.time&&(t=n),t},r.prototype._convertNoteToArray=function(e){var t=[];return Array.isArray(e)||(e=[e]),e.forEach((function(e){t.push(i.guessNoteNumber(e))})),t},Jr.exports?Jr.exports=i:e.WebMidi||(e.WebMidi=i)}(es.exports)),es.exports)),is=(e,t)=>Array(Math.abs(t)+1).join(e);function ns(e){return null!==e&&"object"==typeof e&&"string"==typeof e.name}function rs(e){return null!==e&&"object"==typeof e&&"number"==typeof e.step&&"number"==typeof e.alt}const ss=[0,2,4,-1,1,3,5],as=ss.map((e=>Math.floor(7*e/12)));function os(e){const{step:t,alt:i,oct:n,dir:r=1}=e,s=ss[t]+7*i;return void 0===n?[r*s]:[r*s,r*(n-as[t]-4*i)]}const cs=[3,0,4,1,5,2,6];function ls(e){const[t,i,n]=e,r=cs[function(e){const t=(e+1)%7;return t<0?7+t:t}(t)],s=Math.floor((t+1)/7);return void 0===i?{step:r,alt:s,dir:n}:{step:r,alt:s,oct:i+4*s+as[r],dir:n}}const hs={empty:!0,name:"",pc:"",acc:""},us=new Map;function ds(e){const t=us.get(e);if(t)return t;const i="string"==typeof e?function(e){const t=function(e){const t=ps.exec(e);return[t[1].toUpperCase(),t[2].replace(/x/g,"##"),t[3],t[4]]}(e);if(""===t[0]||""!==t[3])return hs;const i=t[0],n=t[1],r=t[2],s=(i.charCodeAt(0)+3)%7,a="b"===(f=n)[0]?-f.length:f.length,o=r.length?+r:void 0,c=os({step:s,alt:a,oct:o}),l=i+n+r,h=i+n,u=(gs[s]+a+120)%12,d=void 0===o?ms(gs[s]+a,12)-1188:gs[s]+a+12*(o+1),p=d>=0&&d<=127?d:null;var f;return{empty:!1,acc:n,alt:a,chroma:u,coord:c,freq:void 0===o?null:440*Math.pow(2,(d-69)/12),height:d,letter:i,midi:p,name:l,oct:o,pc:h,step:s}}(e):rs(e)?ds(function(e){const{step:t,alt:i,oct:n}=e,r="CDEFGAB".charAt(t);if(!r)return"";const s=r+(e=>e<0?is("b",-e):is("#",e))(i);return n||0===n?s+n:s}(e)):ns(e)?ds(e.name):hs;return us.set(e,i),i}const ps=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function fs(e){return ds(ls(e))}const ms=(e,t)=>(e%t+t)%t,gs=[0,2,4,5,7,9,11],vs={empty:!0,name:"",acc:""},bs=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),ys={};function _s(e){return"string"==typeof e?ys[e]||(ys[e]=function(e){const t=function(e){const t=bs.exec(`${e}`);return null===t?["",""]:t[1]?[t[1],t[2]]:[t[4],t[3]]}(e);if(""===t[0])return vs;const i=+t[0],n=t[1],r=(Math.abs(i)-1)%7,s=xs[r];if("M"===s&&"P"===n)return vs;const a="M"===s?"majorable":"perfectable",o=""+i+n,c=i<0?-1:1,l=8===i||-8===i?i:c*(r+1),h=(d=a,"M"===(p=n)&&"majorable"===d||"P"===p&&"perfectable"===d?0:"m"===p&&"majorable"===d?-1:/^A+$/.test(p)?p.length:/^d+$/.test(p)?-1*("perfectable"===d?p.length:p.length+1):0),u=Math.floor((Math.abs(i)-1)/7);var d,p;return{empty:!1,name:o,num:i,q:n,step:r,alt:h,dir:c,type:a,simple:l,semitones:c*(ws[r]+h+12*u),chroma:(c*(ws[r]+h)%12+12)%12,coord:os({step:r,alt:h,oct:u,dir:c}),oct:u}}(e)):rs(e)?_s(function(e){const{step:t,alt:i,oct:n=0,dir:r}=e;if(!r)return"";const s=t+1+7*n,a=r<0?"-":"",o="M"===xs[t]?"majorable":"perfectable";return a+s+(c=o,0===(l=i)?"majorable"===c?"M":"P":-1===l&&"majorable"===c?"m":l>0?is("A",l):is("d","perfectable"===c?l:l+1));var c,l}(e)):ns(e)?_s(e.name):vs}const ws=[0,2,4,5,7,9,11],xs="PMMPPMM";function ks(e){const[t,i=0]=e;return _s(ls(7*t+12*i<0?[-t,-i,-1]:[t,i,1]))}function Cs(e,t){const i=ds(e),n=_s(t);if(i.empty||n.empty)return"";const r=i.coord,s=n.coord;return fs(1===r.length?[r[0]+s[0]]:[r[0]+s[0],r[1]+s[1]]).name}const Ss={empty:!0,name:"",setNum:0,chroma:"000000000000",normalized:"000000000000",intervals:[]},Ms=e=>Number(e).toString(2),Es=e=>parseInt(e,2),Ts=/^[01]{12}$/;function Ps(e){return Ts.test(e)}const As={[Ss.chroma]:Ss};function Is(e){const t=Ps(e)?e:"number"==typeof(n=e)&&n>=0&&n<=4095?Ms(e):Array.isArray(e)?function(e){if(0===e.length)return Ss.chroma;let t;const i=[0,0,0,0,0,0,0,0,0,0,0,0];for(let n=0;n<e.length;n++)t=ds(e[n]),t.empty&&(t=_s(e[n])),t.empty||(i[t.chroma]=1);return i.join("")}(e):(i=e)&&Ps(i.chroma)?e.chroma:Ss.chroma;var i,n;return As[t]=As[t]||function(e){const t=Es(e),i=function(e){const t=e.split("");return t.map(((e,i)=>function(e,t){const i=t.length,n=(e%i+i)%i;return t.slice(n,i).concat(t.slice(0,n))}(i,t).join("")))}(e).map(Es).filter((e=>e>=2048)).sort()[0];return{empty:!1,name:"",setNum:t,chroma:e,normalized:Ms(i),intervals:Ls(e)}}(t)}const Ns=["1P","2m","2M","3m","3M","4P","5d","5P","6m","6M","7m","7M"];function Ls(e){const t=[];for(let i=0;i<12;i++)"1"===e.charAt(i)&&t.push(Ns[i]);return t}let Os=[],Bs={};[["1P 3M 5P","major","M ^ "],["1P 3M 5P 7M","major seventh","maj7 Δ ma7 M7 Maj7 ^7"],["1P 3M 5P 7M 9M","major ninth","maj9 Δ9 ^9"],["1P 3M 5P 7M 9M 13M","major thirteenth","maj13 Maj13 ^13"],["1P 3M 5P 6M","sixth","6 add6 add13 M6"],["1P 3M 5P 6M 9M","sixth/ninth","6/9 69 M69"],["1P 3M 6m 7M","major seventh flat sixth","M7b6 ^7b6"],["1P 3M 5P 7M 11A","major seventh sharp eleventh","maj#4 Δ#4 Δ#11 M7#11 ^7#11 maj7#11"],["1P 3m 5P","minor","m min -"],["1P 3m 5P 7m","minor seventh","m7 min7 mi7 -7"],["1P 3m 5P 7M","minor/major seventh","m/ma7 m/maj7 mM7 mMaj7 m/M7 -Δ7 mΔ -^7"],["1P 3m 5P 6M","minor sixth","m6 -6"],["1P 3m 5P 7m 9M","minor ninth","m9 -9"],["1P 3m 5P 7M 9M","minor/major ninth","mM9 mMaj9 -^9"],["1P 3m 5P 7m 9M 11P","minor eleventh","m11 -11"],["1P 3m 5P 7m 9M 13M","minor thirteenth","m13 -13"],["1P 3m 5d","diminished","dim ° o"],["1P 3m 5d 7d","diminished seventh","dim7 °7 o7"],["1P 3m 5d 7m","half-diminished","m7b5 ø -7b5 h7 h"],["1P 3M 5P 7m","dominant seventh","7 dom"],["1P 3M 5P 7m 9M","dominant ninth","9"],["1P 3M 5P 7m 9M 13M","dominant thirteenth","13"],["1P 3M 5P 7m 11A","lydian dominant seventh","7#11 7#4"],["1P 3M 5P 7m 9m","dominant flat ninth","7b9"],["1P 3M 5P 7m 9A","dominant sharp ninth","7#9"],["1P 3M 7m 9m","altered","alt7"],["1P 4P 5P","suspended fourth","sus4 sus"],["1P 2M 5P","suspended second","sus2"],["1P 4P 5P 7m","suspended fourth seventh","7sus4 7sus"],["1P 5P 7m 9M 11P","eleventh","11"],["1P 4P 5P 7m 9m","suspended fourth flat ninth","b9sus phryg 7b9sus 7b9sus4"],["1P 5P","fifth","5"],["1P 3M 5A","augmented","aug + +5 ^#5"],["1P 3m 5A","minor augmented","m#5 -#5 m+"],["1P 3M 5A 7M","augmented seventh","maj7#5 maj7+5 +maj7 ^7#5"],["1P 3M 5P 7M 9M 11A","major sharp eleventh (lydian)","maj9#11 Δ9#11 ^9#11"],["1P 2M 4P 5P","","sus24 sus4add9"],["1P 3M 5A 7M 9M","","maj9#5 Maj9#5"],["1P 3M 5A 7m","","7#5 +7 7+ 7aug aug7"],["1P 3M 5A 7m 9A","","7#5#9 7#9#5 7alt"],["1P 3M 5A 7m 9M","","9#5 9+"],["1P 3M 5A 7m 9M 11A","","9#5#11"],["1P 3M 5A 7m 9m","","7#5b9 7b9#5"],["1P 3M 5A 7m 9m 11A","","7#5b9#11"],["1P 3M 5A 9A","","+add#9"],["1P 3M 5A 9M","","M#5add9 +add9"],["1P 3M 5P 6M 11A","","M6#11 M6b5 6#11 6b5"],["1P 3M 5P 6M 7M 9M","","M7add13"],["1P 3M 5P 6M 9M 11A","","69#11"],["1P 3m 5P 6M 9M","","m69 -69"],["1P 3M 5P 6m 7m","","7b6"],["1P 3M 5P 7M 9A 11A","","maj7#9#11"],["1P 3M 5P 7M 9M 11A 13M","","M13#11 maj13#11 M13+4 M13#4"],["1P 3M 5P 7M 9m","","M7b9"],["1P 3M 5P 7m 11A 13m","","7#11b13 7b5b13"],["1P 3M 5P 7m 13M","","7add6 67 7add13"],["1P 3M 5P 7m 9A 11A","","7#9#11 7b5#9 7#9b5"],["1P 3M 5P 7m 9A 11A 13M","","13#9#11"],["1P 3M 5P 7m 9A 11A 13m","","7#9#11b13"],["1P 3M 5P 7m 9A 13M","","13#9"],["1P 3M 5P 7m 9A 13m","","7#9b13"],["1P 3M 5P 7m 9M 11A","","9#11 9+4 9#4"],["1P 3M 5P 7m 9M 11A 13M","","13#11 13+4 13#4"],["1P 3M 5P 7m 9M 11A 13m","","9#11b13 9b5b13"],["1P 3M 5P 7m 9m 11A","","7b9#11 7b5b9 7b9b5"],["1P 3M 5P 7m 9m 11A 13M","","13b9#11"],["1P 3M 5P 7m 9m 11A 13m","","7b9b13#11 7b9#11b13 7b5b9b13"],["1P 3M 5P 7m 9m 13M","","13b9"],["1P 3M 5P 7m 9m 13m","","7b9b13"],["1P 3M 5P 7m 9m 9A","","7b9#9"],["1P 3M 5P 9M","","Madd9 2 add9 add2"],["1P 3M 5P 9m","","Maddb9"],["1P 3M 5d","","Mb5"],["1P 3M 5d 6M 7m 9M","","13b5"],["1P 3M 5d 7M","","M7b5"],["1P 3M 5d 7M 9M","","M9b5"],["1P 3M 5d 7m","","7b5"],["1P 3M 5d 7m 9M","","9b5"],["1P 3M 7m","","7no5"],["1P 3M 7m 13m","","7b13"],["1P 3M 7m 9M","","9no5"],["1P 3M 7m 9M 13M","","13no5"],["1P 3M 7m 9M 13m","","9b13"],["1P 3m 4P 5P","","madd4"],["1P 3m 5P 6m 7M","","mMaj7b6"],["1P 3m 5P 6m 7M 9M","","mMaj9b6"],["1P 3m 5P 7m 11P","","m7add11 m7add4"],["1P 3m 5P 9M","","madd9"],["1P 3m 5d 6M 7M","","o7M7"],["1P 3m 5d 7M","","oM7"],["1P 3m 6m 7M","","mb6M7"],["1P 3m 6m 7m","","m7#5"],["1P 3m 6m 7m 9M","","m9#5"],["1P 3m 5A 7m 9M 11P","","m11A"],["1P 3m 6m 9m","","mb6b9"],["1P 2M 3m 5d 7m","","m9b5"],["1P 4P 5A 7M","","M7#5sus4"],["1P 4P 5A 7M 9M","","M9#5sus4"],["1P 4P 5A 7m","","7#5sus4"],["1P 4P 5P 7M","","M7sus4"],["1P 4P 5P 7M 9M","","M9sus4"],["1P 4P 5P 7m 9M","","9sus4 9sus"],["1P 4P 5P 7m 9M 13M","","13sus4 13sus"],["1P 4P 5P 7m 9m 13m","","7sus4b9b13 7b9b13sus4"],["1P 4P 7m 10m","","4 quartal"],["1P 5P 7m 9m 11P","","11b9"]].forEach((([e,t,i])=>function(e,t,i){const n=function(e){const t=t=>-1!==e.indexOf(t);return t("5A")?"Augmented":t("3M")?"Major":t("5d")?"Diminished":t("3m")?"Minor":"Unknown"}(e),r={...Is(e),name:i||"",quality:n,intervals:e,aliases:t};Os.push(r),r.name&&(Bs[r.name]=r),Bs[r.setNum]=r,Bs[r.chroma]=r,r.aliases.forEach((e=>{return t=r,void(Bs[e]=t);var t}))}(e.split(" "),i.split(" "),t))),Os.sort(((e,t)=>e.setNum-t.setNum));let Ds={};[["1P 2M 3M 5P 6M","major pentatonic","pentatonic"],["1P 3M 4P 5P 7M","ionian pentatonic"],["1P 3M 4P 5P 7m","mixolydian pentatonic","indian"],["1P 2M 4P 5P 6M","ritusen"],["1P 2M 4P 5P 7m","egyptian"],["1P 3M 4P 5d 7m","neopolitan major pentatonic"],["1P 3m 4P 5P 6m","vietnamese 1"],["1P 2m 3m 5P 6m","pelog"],["1P 2m 4P 5P 6m","kumoijoshi"],["1P 2M 3m 5P 6m","hirajoshi"],["1P 2m 4P 5d 7m","iwato"],["1P 2m 4P 5P 7m","in-sen"],["1P 3M 4A 5P 7M","lydian pentatonic","chinese"],["1P 3m 4P 6m 7m","malkos raga"],["1P 3m 4P 5d 7m","locrian pentatonic","minor seven flat five pentatonic"],["1P 3m 4P 5P 7m","minor pentatonic","vietnamese 2"],["1P 3m 4P 5P 6M","minor six pentatonic"],["1P 2M 3m 5P 6M","flat three pentatonic","kumoi"],["1P 2M 3M 5P 6m","flat six pentatonic"],["1P 2m 3M 5P 6M","scriabin"],["1P 3M 5d 6m 7m","whole tone pentatonic"],["1P 3M 4A 5A 7M","lydian #5P pentatonic"],["1P 3M 4A 5P 7m","lydian dominant pentatonic"],["1P 3m 4P 5P 7M","minor #7M pentatonic"],["1P 3m 4d 5d 7m","super locrian pentatonic"],["1P 2M 3m 4P 5P 7M","minor hexatonic"],["1P 2A 3M 5P 5A 7M","augmented"],["1P 2M 3m 3M 5P 6M","major blues"],["1P 2M 4P 5P 6M 7m","piongio"],["1P 2m 3M 4A 6M 7m","prometheus neopolitan"],["1P 2M 3M 4A 6M 7m","prometheus"],["1P 2m 3M 5d 6m 7m","mystery #1"],["1P 2m 3M 4P 5A 6M","six tone symmetric"],["1P 2M 3M 4A 5A 7m","whole tone","messiaen's mode #1"],["1P 2m 4P 4A 5P 7M","messiaen's mode #5"],["1P 3m 4P 5d 5P 7m","minor blues","blues"],["1P 2M 3M 4P 5d 6m 7m","locrian major","arabian"],["1P 2m 3M 4A 5P 6m 7M","double harmonic lydian"],["1P 2M 3m 4P 5P 6m 7M","harmonic minor"],["1P 2m 3m 4d 5d 6m 7m","altered","super locrian","diminished whole tone","pomeroy"],["1P 2M 3m 4P 5d 6m 7m","locrian #2","half-diminished","aeolian b5"],["1P 2M 3M 4P 5P 6m 7m","mixolydian b6","melodic minor fifth mode","hindu"],["1P 2M 3M 4A 5P 6M 7m","lydian dominant","lydian b7","overtone"],["1P 2M 3M 4A 5P 6M 7M","lydian"],["1P 2M 3M 4A 5A 6M 7M","lydian augmented"],["1P 2m 3m 4P 5P 6M 7m","dorian b2","phrygian #6","melodic minor second mode"],["1P 2M 3m 4P 5P 6M 7M","melodic minor"],["1P 2m 3m 4P 5d 6m 7m","locrian"],["1P 2m 3m 4d 5d 6m 7d","ultralocrian","superlocrian bb7","·superlocrian diminished"],["1P 2m 3m 4P 5d 6M 7m","locrian 6","locrian natural 6","locrian sharp 6"],["1P 2A 3M 4P 5P 5A 7M","augmented heptatonic"],["1P 2M 3m 5d 5P 6M 7m","romanian minor"],["1P 2M 3m 4A 5P 6M 7m","dorian #4"],["1P 2M 3m 4A 5P 6M 7M","lydian diminished"],["1P 2m 3m 4P 5P 6m 7m","phrygian"],["1P 2M 3M 4A 5A 7m 7M","leading whole tone"],["1P 2M 3M 4A 5P 6m 7m","lydian minor"],["1P 2m 3M 4P 5P 6m 7m","phrygian dominant","spanish","phrygian major"],["1P 2m 3m 4P 5P 6m 7M","balinese"],["1P 2m 3m 4P 5P 6M 7M","neopolitan major"],["1P 2M 3m 4P 5P 6m 7m","aeolian","minor"],["1P 2M 3M 4P 5P 6m 7M","harmonic major"],["1P 2m 3M 4P 5P 6m 7M","double harmonic major","gypsy"],["1P 2M 3m 4P 5P 6M 7m","dorian"],["1P 2M 3m 4A 5P 6m 7M","hungarian minor"],["1P 2A 3M 4A 5P 6M 7m","hungarian major"],["1P 2m 3M 4P 5d 6M 7m","oriental"],["1P 2m 3m 3M 4A 5P 7m","flamenco"],["1P 2m 3m 4A 5P 6m 7M","todi raga"],["1P 2M 3M 4P 5P 6M 7m","mixolydian","dominant"],["1P 2m 3M 4P 5d 6m 7M","persian"],["1P 2M 3M 4P 5P 6M 7M","major","ionian"],["1P 2m 3M 5d 6m 7m 7M","enigmatic"],["1P 2M 3M 4P 5A 6M 7M","major augmented","major #5","ionian augmented","ionian #5"],["1P 2A 3M 4A 5P 6M 7M","lydian #9"],["1P 2m 2M 4P 4A 5P 6m 7M","messiaen's mode #4"],["1P 2m 3M 4P 4A 5P 6m 7M","purvi raga"],["1P 2m 3m 3M 4P 5P 6m 7m","spanish heptatonic"],["1P 2M 3M 4P 5P 6M 7m 7M","bebop"],["1P 2M 3m 3M 4P 5P 6M 7m","bebop minor"],["1P 2M 3M 4P 5P 5A 6M 7M","bebop major"],["1P 2m 3m 4P 5d 5P 6m 7m","bebop locrian"],["1P 2M 3m 4P 5P 6m 7m 7M","minor bebop"],["1P 2M 3m 4P 5d 6m 6M 7M","diminished","whole-half diminished"],["1P 2M 3M 4P 5d 5P 6M 7M","ichikosucho"],["1P 2M 3m 4P 5P 6m 6M 7M","minor six diminished"],["1P 2m 3m 3M 4A 5P 6M 7m","half-whole diminished","dominant diminished","messiaen's mode #2"],["1P 3m 3M 4P 5P 6M 7m 7M","kafi raga"],["1P 2M 3M 4P 4A 5A 6A 7M","messiaen's mode #6"],["1P 2M 3m 3M 4P 5d 5P 6M 7m","composite blues"],["1P 2M 3m 3M 4A 5P 6m 7m 7M","messiaen's mode #3"],["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M","messiaen's mode #7"],["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M","chromatic"]].forEach((([e,t,...i])=>function(e,t,i=[]){const n={...Is(e),name:t,intervals:e,aliases:i};return Ds[n.name]=n,Ds[n.setNum]=n,Ds[n.chroma]=n,n.aliases.forEach((e=>{return t=n,void(Ds[e]=t);var t})),n}(e.split(" "),t,i))),[[.125,"dl",["large","duplex longa","maxima","octuple","octuple whole"]],[.25,"l",["long","longa"]],[.5,"d",["double whole","double","breve"]],[1,"w",["whole","semibreve"]],[2,"h",["half","minim"]],[4,"q",["quarter","crotchet"]],[8,"e",["eighth","quaver"]],[16,"s",["sixteenth","semiquaver"]],[32,"t",["thirty-second","demisemiquaver"]],[64,"sf",["sixty-fourth","hemidemisemiquaver"]],[128,"h",["hundred twenty-eighth"]],[256,"th",["two hundred fifty-sixth"]]].forEach((([e,t,i])=>{}));const Rs=[1,2,2,3,3,4,5,5,6,6,7,7],zs="P m M m M P d P m M m M".split(" ");qs(((e,t)=>[e[0]+t[0],e[1]+t[1]])),qs(((e,t)=>[e[0]-t[0],e[1]-t[1]]));var Vs=function(e){const t=e<0?-1:1,i=Math.abs(e),n=i%12,r=Math.floor(i/12);return t*(Rs[n]+7*r)+zs[n]};function qs(e){return(t,i)=>{const n=_s(t).coord,r=_s(i).coord;if(n&&r)return ks(e(n,r)).name}}const Fs=Math.log(2),js=Math.log(440);function Hs(e){const t=12*(Math.log(e)-js)/Fs+69;return Math.round(100*t)/100}const Gs="C C# D D# E F F# G G# A A# B".split(" "),Us="C Db D Eb E F Gb G Ab A Bb B".split(" ");function Ws(e,t={}){if(isNaN(e)||e===-1/0||e===1/0)return"";e=Math.round(e);const i=(!0===t.sharps?Gs:Us)[e%12];return t.pitchClass?i:i+(Math.floor(e/12)-1)}const Ys=["C","D","E","F","G","A","B"],$s=e=>e.name,Ks=e=>e.map(ds).filter((e=>!e.empty)),Xs=ds,Qs=Cs,Zs=Cs,Js=e=>t=>Qs(t,e),ea=Js,ta=e=>t=>Qs(e,t),ia=ta;function na(e,t){const i=Xs(e);if(i.empty)return"";const[n,r]=i.coord;return fs(void 0===r?[n+t]:[n+t,r]).name}const ra=na,sa=(e,t)=>e.height-t.height;function aa(e,t){return t=t||sa,Ks(e).sort(t).map($s)}const oa=la(!0),ca=la(!1);function la(e){return t=>{const i=Xs(t);if(i.empty)return"";const n=e?i.alt>0:i.alt<0,r=null===i.midi;return Ws(i.midi||i.chroma,{sharps:n,pitchClass:r})}}var ha={names:function(e){return void 0===e?Ys.slice():Array.isArray(e)?Ks(e).map($s):[]},get:Xs,name:e=>Xs(e).name,pitchClass:e=>Xs(e).pc,accidentals:e=>Xs(e).acc,octave:e=>Xs(e).oct,midi:e=>Xs(e).midi,ascending:sa,descending:(e,t)=>t.height-e.height,sortedNames:aa,sortedUniqNames:function(e){return aa(e,sa).filter(((e,t,i)=>0===t||e!==i[t-1]))},fromMidi:function(e){return Ws(e)},fromMidiSharps:function(e){return Ws(e,{sharps:!0})},freq:e=>Xs(e).freq,fromFreq:function(e){return Ws(Hs(e))},fromFreqSharps:function(e){return Ws(Hs(e),{sharps:!0})},chroma:e=>Xs(e).chroma,transpose:Qs,tr:Zs,transposeBy:Js,trBy:ea,transposeFrom:ta,trFrom:ia,transposeFifths:na,trFifths:ra,simplify:oa,enharmonic:ca};const ua=[[0,2773,0,"ionian","","Maj7","major"],[1,2902,2,"dorian","m","m7"],[2,3418,4,"phrygian","m","m7"],[3,2741,-1,"lydian","","Maj7"],[4,2774,1,"mixolydian","","7"],[5,2906,3,"aeolian","m","m7","minor"],[6,3434,5,"locrian","dim","m7b5"]].map((function(e){const[t,i,n,r,s,a,o]=e,c=o?[o]:[],l=Number(i).toString(2);return{empty:!1,intervals:Ls(l),modeNum:t,chroma:l,normalized:l,name:r,setNum:i,alt:n,triad:s,seventh:a,aliases:c}})),da={};function pa(e,t){return e.map((e=>function(e,t){const i={...e},n=ha.transpose(e.note.name+e.note.octave,Vs(t));return i.note={name:ha.pitchClass(n),number:e.note.number+t,octave:ha.octave(n)},i}(e,t)))}function fa(e){const t=[];e=e.filter((e=>"noteon"===e.type)).sort(((e,t)=>e.timestamp-t.timestamp));for(let i=10;i>0;i--)for(let n=0;n<e.length-i+1;n++)try{t.push(new Syllable(e.slice(n,n+i))),e.splice(n,i),n=-1}catch{}return new SyllableSequence(t)}ua.forEach((e=>{da[e.name]=e,e.aliases.forEach((t=>{da[t]=e}))}));class SyllableSequence{constructor(e){t(this,"syllables"),t(this,"rootNote"),e.length>0?(this.syllables=e.sort(((e,t)=>e.timestamp-t.timestamp)),this.rootNote=this.syllables[0].notes.reduce(((e,t)=>t.note.number<e.note.number?t:e)).note):(this.syllables=[],this.rootNote={name:"C",octave:4,number:0})}append(e){if(this.syllables.length)try{const t=new Syllable(this.syllables[this.syllables.length-1].notes.map((e=>({note:e.note,timestamp:e.timestamp,type:e.type,velocity:e.velocity}))).concat(e));this.syllables.splice(this.syllables.length-1,1,t)}catch{this.syllables.push(new Syllable([e]))}else this.syllables.push(new Syllable([e])),this.rootNote=e.note}grade(e){const t=[];for(let i=0;i<this.syllables.length;i++)t.push(this.syllables[i].grade(e.syllables[i]));return new SyllableSequence(t)}toString(){let e="";return this.syllables.forEach(((t,i)=>{e+=`Syllable ${i+1}: {\n`,t.notes.forEach((t=>{e+=`\t${t.note.name}\t${t.note.number}\t${t.timestamp} ${t.isCorrect?"":"(incorrect)"} ${t.isMissing?"(missing)":""}\n`})),e+=`} - ${t.timestamp}, correct: ${t.isCorrect}\n`})),e}isCorrect(){let e=!0;return this.syllables.forEach((t=>{!1===t.isCorrect?e=!1:t.notes.forEach((t=>{!1===t.isCorrect&&(e=!1)}))})),e}}class Syllable{constructor(e){t(this,"notes"),t(this,"isCorrect");const i=(e=e.filter((e=>"noteon"===e.type))).reduce(((e,t)=>e.timestamp<t.timestamp?e:t)),n=e.reduce(((e,t)=>e.timestamp>t.timestamp?e:t)).timestamp-i.timestamp;if(Syllable.gracePeriod(e.length)<n)throw new Error(`Notes ${e.toString()} are not close enough together to be a syllable`);this.notes=e.map((e=>({...e,isCorrect:!0,isMissing:!1}))).sort(((e,t)=>e.note.number-t.note.number))}get timestamp(){let e=0;return this.notes.forEach((t=>{if(0===t.timestamp)return 0;e+=t.timestamp})),e/=this.notes.length,e}static gracePeriod(e){return 1.3*12*e}grade(e){return this.notes.length!==e.notes.length&&(e.isCorrect=!1),e.notes.forEach((t=>{let i=ha.fromMidi(t.note.number),n=ha.fromMidiSharps(t.note.number);i=ha.pitchClass(i),n=ha.pitchClass(n),t.isCorrect=this.notes.filter((e=>ha.chroma(i)===ha.chroma(e.note.name)||ha.chroma(n)===ha.chroma(e.note.name))).length>=1,t.isCorrect||(e.isCorrect=!1)})),this.notes.forEach((t=>{let i=ha.fromMidi(t.note.number);i=ha.pitchClass(i),e.notes.some((e=>ha.chroma(e.note.name)===ha.chroma(i)))||e.notes.push({...t,isMissing:!0,isCorrect:!1})})),e}}const ma=class _SkMidi{constructor(e){t(this,"recording",[]),t(this,"webmidi",ts),t(this,"input"),t(this,"output"),t(this,"_noteonListeners",[]),t(this,"_noteoffListeners",[]),t(this,"midiAccess"),t(this,"_state","initializing"),t(this,"_userLookup"),this._userLookup=e??null}get state(){return this._state}async init(){if(!this.midiAccess)try{navigator.requestMIDIAccess().then((e=>{this.midiAccess=e,this.midiAccess.onstatechange=e=>{$({text:`Midi device ${e.port.name} is ${e.port.state}`,status:"connected"===e.port.state?n.ok:n.error})}}))}catch(Jr){console.log(`Webmidi not enabled: ${Jr}`),this._state="notsupported"}try{this.webmidi.disable()}catch(Jr){console.log(`Webmidi not enabled: ${Jr}`),this._state="notsupported"}return new Promise(((e,t)=>{this.webmidi.enable((async i=>{i?(this._state="notsupported",console.log(`Webmidi not enabled: ${i}`),t(i)):(console.log("Webmidi enabled"),console.log(`Inputs: ${JSON.stringify(this.webmidi.inputs)}`),console.log(`Outputs: ${JSON.stringify(this.webmidi.outputs)}`),this.output=this.webmidi.outputs[0],this.input=this.webmidi.inputs[0],_SkMidi._initializedWithUserConfig||(await this.loadUserConfiguration(),_SkMidi._initializedWithUserConfig=!0),this.input&&this.output?(console.log("midi init state: ready"),this._state="ready",this.attachListeners()):(console.log("midi init state: nodevice"),this._state="nodevice"),e(!0))}))}))}async loadUserConfiguration(){try{if(!this._userLookup)return void console.log("User lookup function not provided - using default MIDI configuration");const e=await this._userLookup();if(!e)return void console.log("No user found, using default MIDI configuration");const t=await e.getActiveCourses();for(const i of t){const t=await e.getCourseInterface(i.courseID),n=await t.getCourseSettings();if(n?.midiinput||n?.midioutput){n.midiinput&&this.webmidi.getInputById(n.midiinput.toString())&&(this.selectInput(n.midiinput.toString()),console.log(`Loaded saved MIDI input: ${n.midiinput}`)),n.midioutput&&this.webmidi.getOutputById(n.midioutput.toString())&&(this.selectOutput(n.midioutput.toString()),console.log(`Loaded saved MIDI output: ${n.midioutput}`));break}}}catch(Jr){console.error("Failed to load user MIDI configuration:",Jr)}}setStateChangeListener(e){if(this.midiAccess)this.midiAccess.onstatechange=t=>{this.init().then((()=>{console.log(`Midi state: ${this.state}`),e()})),$({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?n.ok:n.error})};else try{navigator.requestMIDIAccess().then((t=>{this.midiAccess=t,this.midiAccess.onstatechange=t=>{this.init().then((()=>{console.log(`Midi state: ${this.state}`),e()})),$({text:`Midi device ${t.port.name} is ${t.port.state}`,status:"connected"===t.port.state?n.ok:n.error})}}))}catch(t){console.log(`Webmidi not enabled: ${t}`),this._state="notsupported"}}attachListeners(){this.input&&(this._noteonListeners.forEach((e=>{this.input?.on("noteon","all",e)})),this._noteoffListeners.forEach((e=>{this.input?.on("noteoff","all",e)})))}get hasRecording(){return this.record.length>0}get configuredInput(){return this.input?`${this.input.manufacturer}: ${this.input.name}`:"(Not Sure!)"}eraseRecording(){this.recording=[]}stopRecording(){this.input?.removeListener()}record(){let e=0;if(void 0===this.input)throw new Error("Midi input not configured!");"open"===this.input.connection&&(this.stopRecording(),this.eraseRecording(),this.input.on("noteon","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,type:t.type,velocity:t.velocity,timestamp:t.timestamp-e})})),this.input.on("noteoff","all",(t=>{0===this.recording.length&&(e=t.timestamp),this.recording.push({note:t.note,velocity:t.velocity,type:t.type,timestamp:t.timestamp-e})})))}addNoteonListenter(e){this._noteonListeners.push(e),this.input&&this.input.on("noteon","all",e)}addNoteoffListenter(e){this._noteoffListeners.push(e),this.input&&this.input.on("noteoff","all",e)}play(e){let t=e||this.recording;t=t.map((e=>({...e,timestamp:e.timestamp+_SkMidi.OFFSET}))),t.forEach((e=>{"noteon"===e.type?this.output?.playNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1}):this.output?.stopNote(e.note.name+e.note.octave,1,{velocity:e.velocity,time:`+${e.timestamp}`,rawVelocity:!1})}))}static async instance(){return _SkMidi._instance||(console.log("Buzz, whirr, Midi instance factory is at work"),_SkMidi._instance=new _SkMidi,await _SkMidi._instance.init()),_SkMidi._instance}get inputs(){return this.webmidi.inputs}get outputs(){return this.webmidi.outputs}selectInput(e){!1!==this.webmidi.getInputById(e)?this.input=this.webmidi.getInputById(e):!1!==this.webmidi.getInputByName(e)&&(this.input=this.webmidi.getInputByName(e))}selectOutput(e){!1!==this.webmidi.getOutputById(e)?this.output=this.webmidi.getOutputById(e):!1!==this.webmidi.getOutputByName(e)&&(this.output=this.webmidi.getOutputByName(e))}};t(ma,"_instance"),t(ma,"OFFSET",5),t(ma,"_initializedWithUserConfig",!1);let ga=ma;const va=k({name:"SyllableSeqVis",props:{seq:{type:Object,required:!0},lastTSsuggestion:{type:Number,required:!1,default:0}},setup(e){const t=O(0),i=O(0),n=O(0),r=O(500),s=B((()=>{const t=e.seq.syllables[e.seq.syllables.length-1].timestamp;return Math.max(1,t,e.lastTSsuggestion)})),a=B((()=>{let t=0,i=500;return e.seq.syllables.forEach((e=>{e.notes.forEach((e=>{e.note.number>t&&(t=e.note.number),e.note.number<i&&(i=e.note.number)}))})),Math.max(3*(t-i)+10,0)})),o=()=>{try{t.value=e.seq.syllables[0].timestamp;const n=e.seq.syllables[e.seq.syllables.length-1].timestamp,r=t.value+e.lastTSsuggestion;i.value=Math.max(n,r)}catch(s){console.log(`[SyllableSeqVis] Error updating bounds: ${s}`)}e.seq.syllables.forEach((e=>{e.notes.forEach((e=>{e.note.number>n.value&&(n.value=e.note.number),e.note.number<r.value&&(r.value=e.note.number)}))}))};return z((()=>{console.log(`SyllableSeqVis created w/ input: \n${e.seq}`),o()})),{firstTS:t,lastTS:i,high:n,low:r,sayNote:e=>{console.log(`${JSON.stringify(e)}`)},getLastTS:s,getHeight:a,updateBounds:o}}}),ba=["height"],ya=["cx","cy","alt","fill","stroke","onMouseenter"],_a=he(va,[["render",function(e,t,i,n,r,s){return g(),m("div",null,[(g(),m("svg",{width:510,height:Math.max(3*(e.high-e.low)+10,0)},[(g(!0),m(y,null,S(e.seq.syllables,(t=>(g(),m(y,null,[(g(!0),m(y,null,S(t.notes,(i=>(g(),m("circle",{key:t.timestamp+"-"+i.note.number,cx:500*(t.timestamp-e.firstTS)/(e.lastTS-e.firstTS)+4,cy:3*(e.high-i.note.number)+4,alt:i.note.name,r:"3",fill:i.isCorrect?"black":i.isMissing?"none":"red",stroke:i.isMissing?"red":"none",onMouseenter:t=>e.sayNote(i)},null,40,ya)))),128))],64)))),256))],8,ba))])}],["__scopeId","data-v-2f79c080"]]),wa=k({name:"NoteDisplay",props:{chroma:{type:Number,required:!0}},setup:e=>({style:t=>{let i="#ffffff";return t===e.chroma?i="#1976D2":1!==t&&3!==t&&6!==t&&8!==t&&10!==t&&-2!==t||(i="#000000"),{fill:i,"fill-opacity":1,stroke:"#000000","stroke-width":.79375,"stroke-miterlimit":4,"stroke-dasharray":"none","stroke-opacity":1}},white:-1,black:-2})}),xa={id:"svg8",width:"300px",height:"auto","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:cc":"http://creativecommons.org/ns#","xmlns:rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","xmlns:svg":"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/svg","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","sodipodi:docname":"keys.svg","inkscape:version":"1.0rc1 (09960d6f05, 2020-04-09)",version:"1.1",viewBox:"0 0 175.24936 73.594925"},ka={id:"metadata5"},Ca={id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"},Sa=k({name:"Playback",components:{SyllableSeqVis:_a,NoteDisplay:he(wa,[["render",function(e,t,i,n,r,s){const a=f("sodipodi:namedview"),o=f("dc:format"),c=f("dc:type"),l=f("dc:title"),h=f("cc:Work"),u=f("rdf:RDF");return g(),m("svg",xa,[t[1]||(t[1]=C("defs",{id:"defs2"},null,-1)),w(a,{id:"base","inkscape:window-maximized":"1","inkscape:window-y":"726","inkscape:window-x":"1491","inkscape:window-height":"1321","inkscape:window-width":"2400",showborder:"false",showgrid:"false","inkscape:document-rotation":"0","inkscape:current-layer":"layer1","inkscape:document-units":"mm","inkscape:cy":"255.88343","inkscape:cx":"754.94284","inkscape:zoom":"0.98994949","inkscape:pageshadow":"2","inkscape:pageopacity":"0.0",borderopacity:"1.0",bordercolor:"#666666",pagecolor:"#ffffff"}),C("metadata",ka,[w(u,null,{default:A((()=>[w(h,{"rdf:about":""},{default:A((()=>[w(o,null,{default:A((()=>t[0]||(t[0]=[_("image/svg+xml")]))),_:1}),w(c,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),w(l)])),_:1})])),_:1})]),C("g",Ca,[C("rect",{id:"rect845",y:"152.19064",x:"-150.12129",height:"73.220116",width:"17.486626",style:X(e.style(0))},null,4),C("rect",{id:"rect845-9",style:X(e.style(2)),width:"17.486626",height:"73.220116",x:"-132.63466",y:"152.19064"},null,4),C("rect",{id:"rect845-6",style:X(e.style(4)),width:"17.486626",height:"73.220116",x:"-115.14803",y:"152.19064"},null,4),C("rect",{id:"rect845-4",style:X(e.style(5)),width:"17.486626",height:"73.220116",x:"-97.661407",y:"152.19064"},null,4),C("rect",{id:"rect845-92",style:X(e.style(7)),width:"17.486626",height:"73.220116",x:"-80.174782",y:"152.19064"},null,4),C("rect",{id:"rect845-3",style:X(e.style(9)),width:"17.486626",height:"73.220116",x:"-62.688156",y:"152.19064"},null,4),C("rect",{id:"rect845-0",style:X(e.style(11)),width:"17.486626",height:"73.220116",x:"-45.20153",y:"152.19064"},null,4),C("rect",{id:"rect845-30",style:X(e.style(e.white)),width:"17.486626",height:"73.220116",x:"-27.714905",y:"152.10745"},null,4),C("rect",{id:"rect898",ry:"0",y:"152.10744",x:"-138.43532",height:"54.415863",width:"10.466455",style:X(e.style(1))},null,4),C("rect",{id:"rect898-3",style:X(e.style(3)),width:"10.466455",height:"54.415863",x:"-120.84978",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect898-7",style:X(e.style(6)),width:"10.466455",height:"54.415863",x:"-85.678711",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect898-8",style:X(e.style(8)),width:"10.466455",height:"54.415863",x:"-68.09317",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect898-1",style:X(e.style(10)),width:"10.466455",height:"54.415863",x:"-50.507633",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect845-30-1",y:"152.10745",x:"-10.228278",height:"73.220116",width:"17.486626",style:X(e.style(e.white))},null,4),C("rect",{id:"rect845-30-9",y:"152.10744",x:"-167.60791",height:"73.220116",width:"17.486626",style:X(e.style(e.white))},null,4),C("rect",{id:"rect898-4",style:X(e.style(e.black)),width:"10.466455",height:"54.415863",x:"-15.336554",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect898-74",style:X(e.style(e.black)),width:"4.4679713",height:"54.415863",x:"-167.60791",y:"152.10744",ry:"0"},null,4),C("rect",{id:"rect898-10",style:X(e.style(e.black)),width:"5.1863246",height:"54.507248",x:"2.2092075",y:"152.06175",ry:"0"},null,4)])])}]])},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"Playback"),r=L(i),s=O(),a=O(!1),o=O("notSet"),c=O(!1),l=O(0),h=O(Y.utc()),u=O(0),d=O(0),p=O(fa([])),f=O(!1),m=O(fa([])),g=O(0),v=O(""),b=O(0),y=O(0),_=O(),w=O();r.question.value=new za(e.data);const x=B((()=>new za(e.data))),k=B((()=>fa(x.value.midi).syllables[0].notes.length>1?"Lowest note of first chord:":"First note:")),C=B((()=>a.value?fa(x.value.midi).rootNote.number%12:0)),S=()=>{o.value?o.value!==s.value?.state&&(a.value=!1,o.value=s.value?.state||"notSet",a.value=!0):(o.value=s.value?.state||"notSet",a.value=!0),i.logger.log(`Playback is running init with state: ${o.value}`),"ready"===o.value&&(u.value=x.value.duration,E())},M=()=>{try{_.value&&(_.value.style.animationName="",requestAnimationFrame((()=>{requestAnimationFrame((()=>{_.value&&(_.value.style.animationDuration=u.value+"ms",_.value.style.animationName="progress")}))})))}catch{setTimeout(M,50)}},E=()=>{s.value?.stopRecording(),s.value?.eraseRecording(),h.value=Y.utc(),b.value=0,y.value=0,c.value=!1,l.value=0,M(),s.value?.play(x.value.midi),setTimeout((()=>{i.logger.log("done playback..."),s.value?.record(),c.value=!0,s.value?.addNoteonListenter((e=>{b.value++,m.value.append(e),w.value?.updateBounds(),b.value+y.value>=x.value.midi.length&&T()})),s.value?.addNoteoffListenter((()=>{y.value++,b.value+y.value>=x.value.midi.length&&T()}))}),x.value.lastNoteOnTimestamp)},T=()=>{if(!s.value?.recording)return!1;const e=fa(x.value.midi),t=fa(s.value.recording);return p.value=e.grade(t),m.value=fa([]),!!r.submitAnswer(s.value.recording).isCorrect||(d.value++,f.value=!0,d.value<r.maxAttemptsPerView.value&&E(),!1)},P=()=>{b.value>0?T():E()};return z((async()=>{try{s.value=await ga.instance(),s.value.setStateChangeListener((()=>{S()})),a.value=!0}catch(e){$({status:n.error,text:"Midi device not supported"}),v.value=JSON.stringify(e),o.value="notsupported",a.value=!0}S(),K.addBinding([{hotkey:"space",callback:P,command:"Clear attempt or play again"}])})),q((()=>{K.removeBinding("space")})),{...i,...r,initialized:a,state:o,recording:c,inputSeq:m,lastTSsuggestion:g,gradedSeq:p,graded:f,promptText:k,firstNoteChroma:C,progressBar:_,inputVisRef:w,clearAttempt:P,notesOn:b}}}),Ma={key:0,"data-viewable":"Playback"},Ea={key:0},Ta={class:"text-h4"},Pa={class:"text-h5"},Aa={key:0},Ia={class:"progressContainer"},Na={id:"progress",ref:"progressBar"},La={key:1},Oa={key:2},Ba=he(Sa,[["render",function(e,t,i,n,r,s){const a=f("note-display"),o=f("v-icon"),c=f("v-btn"),l=f("syllable-seq-vis");return e.initialized?(g(),m("div",Ma,["ready"===e.state?(g(),m("div",Ea,[C("div",Ta,[_(x(e.promptText)+" ",1),w(a,{chroma:e.firstNoteChroma},null,8,["chroma"])]),C("div",Pa,[t[0]||(t[0]=_("Listen...")),e.recording?(g(),m("span",Aa," and Repeat")):b("",!0)]),C("div",Ia,[C("div",Na,null,512)]),w(c,{color:"primary",autofocus:"",onClick:e.clearAttempt},{default:A((()=>[t[2]||(t[2]=_(" Play again ")),w(o,{end:""},{default:A((()=>t[1]||(t[1]=[_("volume_up")]))),_:1})])),_:1},8,["onClick"]),(g(),P(l,{key:0,ref:"inputVisRef",seq:e.inputSeq,"last-t-ssuggestion":e.lastTSsuggestion},null,8,["seq","last-t-ssuggestion"])),e.graded?(g(),P(l,{key:1,seq:e.gradedSeq},null,8,["seq"])):b("",!0)])):"nodevice"===e.state?(g(),m("div",La,"No midi device detected. Please attach one!")):"notsupported"===e.state?(g(),m("div",Oa,t[3]||(t[3]=[C("p",null,"This exercise requires a midi input device, which is not supported by this browser ☹",-1),C("div",null,[C("p",null,"Please try again with one of the following browsers:"),C("ul",null,[C("li",null,[C("a",{href:"https://www.google.com/chrome/"},"Google Chrome")]),C("li",null,[C("a",{href:"https://www.microsoft.com/edge"},"Microsoft Edge")]),C("li",null,[C("a",{href:"https://brave.com/"},"Brave")])])],-1)]))):b("",!0)])):b("",!0)}]]),Da=[{name:"Melody",type:r.MIDI}],Ra=class _EchoQuestion extends l{constructor(e){super(e),t(this,"midi"),this.midi=e[0].Melody}get duration(){return this.midi.reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}get lastNoteOnTimestamp(){return this.midi.filter((e=>"noteon"===e.type)).reduce(((e,t)=>t.timestamp>e.timestamp?t:e)).timestamp}isCorrect(e){const t=fa(this.midi),i=fa(e);try{return t.grade(i).isCorrect()}catch(n){return console.log("ERROR grading this midi sequence!",n),!1}}dataShapes(){return _EchoQuestion.dataShapes}views(){return _EchoQuestion.views}};t(Ra,"dataShapes",[{fields:Da,name:a.PIANO_Echo}]),t(Ra,"views",[Ba]);let za=Ra;const Va=k({name:"NotePlayback",components:{},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"NotePlayback"),n=L(i),r=O(),s=O(!1),a=O(!1),o=O(0),c=O(Y.utc()),l=O(0),h=O(fa([])),u=O(!1),d=O(fa([])),p=O("");n.question.value=new $a(e.data);const f=B((()=>new $a(e.data))),m=()=>{r.value?.stopRecording(),r.value?.eraseRecording(),c.value=Y.utc(),a.value=!1,o.value=0,r.value?.record(),a.value=!0,r.value?.addNoteonListenter((e=>{d.value.append(e)})),r.value?.addNoteoffListenter((()=>{r.value?.recording?.length&&r.value?.recording?.length>=2&&g()}))},g=()=>!!r.value?.recording&&(d.value=fa([]),!!n.submitAnswer(r.value.recording).isCorrect||(l.value++,u.value=!0,l.value<n.maxAttemptsPerView.value&&m(),!1));return z((async()=>{try{r.value=await ga.instance(),p.value=f.value.note,m(),s.value=!0}catch(e){i.logger.error("Failed to initialize MIDI:",e)}})),{...i,...n,initialized:s,recording:a,inputSeq:d,gradedSeq:h,graded:u,note:p,attempts:l}}}),qa={"data-viewable":"NotePlayback"},Fa={class:"text-h4"},ja={class:"font-weight-bold"},Ha={key:0,id:"svg8",width:"300px",height:"auto","xmlns:dc":"http://purl.org/dc/elements/1.1/","xmlns:cc":"http://creativecommons.org/ns#","xmlns:rdf":"http://www.w3.org/1999/02/22-rdf-syntax-ns#","xmlns:svg":"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/svg","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","sodipodi:docname":"keys.svg","inkscape:version":"1.0rc1 (09960d6f05, 2020-04-09)",version:"1.1",viewBox:"0 0 175.24936 73.594925"},Ga={id:"metadata5"},Ua=he(Va,[["render",function(e,t,i,n,r,s){const a=f("sodipodi:namedview"),o=f("dc:format"),c=f("dc:type"),l=f("dc:title"),h=f("cc:Work"),u=f("rdf:RDF");return g(),m("div",qa,[C("div",Fa,[t[0]||(t[0]=_(" Play the note: ")),C("span",ja,x(e.note),1)]),e.graded?(g(),m("svg",Ha,[t[2]||(t[2]=C("defs",{id:"defs2"},null,-1)),w(a,{id:"base","inkscape:window-maximized":"1","inkscape:window-y":"726","inkscape:window-x":"1491","inkscape:window-height":"1321","inkscape:window-width":"2400",showborder:"false",showgrid:"false","inkscape:document-rotation":"0","inkscape:current-layer":"layer1","inkscape:document-units":"mm","inkscape:cy":"255.88343","inkscape:cx":"754.94284","inkscape:zoom":"0.98994949","inkscape:pageshadow":"2","inkscape:pageopacity":"0.0",borderopacity:"1.0",bordercolor:"#666666",pagecolor:"#ffffff"}),C("metadata",Ga,[w(u,null,{default:A((()=>[w(h,{"rdf:about":""},{default:A((()=>[w(o,null,{default:A((()=>t[1]||(t[1]=[_("image/svg+xml")]))),_:1}),w(c,{"rdf:resource":"http://purl.org/dc/dcmitype/StillImage"}),w(l)])),_:1})])),_:1})]),t[3]||(t[3]=C("g",{id:"layer1",transform:"translate(167.75219,-151.96011)","inkscape:groupmode":"layer","inkscape:label":"Layer 1"},[C("rect",{id:"rect845",y:"152.19064",x:"-150.12129",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),C("rect",{id:"rect845-9",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-132.63466",y:"152.19064"}),C("rect",{id:"rect845-6",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-115.14803",y:"152.19064"}),C("rect",{id:"rect845-0",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-45.20153",y:"152.19064"}),C("rect",{id:"rect845-92",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-80.174782",y:"152.19064"}),C("rect",{id:"rect845-3",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-62.688156",y:"152.19064"}),C("rect",{id:"rect845-4",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-97.661407",y:"152.19064"}),C("rect",{id:"rect845-30",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"17.486626",height:"73.220116",x:"-27.714905",y:"152.10745"}),C("rect",{id:"rect898",ry:"0",y:"152.10744",x:"-138.43532",height:"54.415863",width:"10.466455",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),C("rect",{id:"rect898-3",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-120.84978",y:"152.10744",ry:"0"}),C("rect",{id:"rect898-7",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-85.678711",y:"152.10744",ry:"0"}),C("rect",{id:"rect898-8",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-68.09317",y:"152.10744",ry:"0"}),C("rect",{id:"rect898-1",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-50.507633",y:"152.10744",ry:"0"}),C("rect",{id:"rect845-30-1",y:"152.10745",x:"-10.228278",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),C("rect",{id:"rect845-30-9",y:"152.10744",x:"-167.60791",height:"73.220116",width:"17.486626",style:{fill:"#ffffff","fill-opacity":"0",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"}}),C("rect",{id:"rect898-4",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"10.466455",height:"54.415863",x:"-15.336554",y:"152.10744",ry:"0"}),C("rect",{id:"rect898-74",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"4.4679713",height:"54.415863",x:"-167.60791",y:"152.10744",ry:"0"}),C("rect",{id:"rect898-10",style:{fill:"#000000","fill-opacity":"1",stroke:"#000000","stroke-width":"0.79375","stroke-miterlimit":"4","stroke-dasharray":"none","stroke-opacity":"1"},width:"5.1863246",height:"54.507248",x:"2.2092075",y:"152.06175",ry:"0"})],-1))])):b("",!0)])}]]),Wa=[{name:"Note",type:r.STRING}],Ya=class _PlayNote extends l{constructor(e){super(e),t(this,"note"),this.note=e[0].Note}isCorrect(e){return e[0].note.name===this.note}dataShapes(){return _PlayNote.dataShapes}views(){return _PlayNote.views}};t(Ya,"dataShapes",[{fields:Wa,name:a.PIANO_PlayNote}]),t(Ya,"seedData",["A","B","C","D","E","F","G","A♯","C♯","D♯","F♯","G♯","D♭","E♭","G♭","A♭","B♭"].map((e=>({Note:e})))),t(Ya,"views",[Ua]);let $a=Ya;const Ka=new CourseWare("piano",[za,$a]),Xa=k({name:"IdentifyChroma",components:{RadioMultipleChoice:R},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"IdentifyChroma"),n=L(i),r=O(""),s=O(new AudioContext);n.question.value=new io(e.data);const a=B((()=>n.question.value));return z((()=>{(()=>{const e=[];let t=147.5;for(;t>100;)e.push(t),t/=2;e.push(295);let i=590;for(;i<5e3;)e.push(i),i*=2;return e})().forEach((e=>(e=>{const t=s.value.createOscillator();t.type="sine",t.frequency.value=e;const i=s.value.createGain();console.log("Max Gain: "+i.gain.maxValue),i.gain.setValueAtTime(0,0),i.gain.linearRampToValueAtTime(.5,15),t.connect(i),i.connect(s.value.destination),t.start(0),t.stop(14)})(e)))})),{...i,...n,answer:r,question:a,submit:()=>{a.value&&a.value.isCorrect(r.value)}}}}),Qa={"data-viewable":"IdentifyChroma"},Za=he(Xa,[["render",function(e,t,i,n,r,s){const a=f("radio-multiple-choice");return g(),m("div",Qa,[e.question?(g(),m(y,{key:0},[t[0]||(t[0]=_(" What note is being played? ")),w(a,{"choice-list":e.question.choiceList},null,8,["choice-list"])],64)):b("",!0)])}]]);var Ja=(e=>(e.A="A",e.B="B",e.C="C",e.D="D",e.E="E",e.F="F",e.G="G",e))(Ja||{});const eo=[{name:"Chroma",type:r.STRING,validator:{test:e=>Object.values(Ja).includes(e)?{status:n.ok,msg:""}:{status:n.error,msg:"That's not a chroma!"},instructions:"Enter a valid musical note (A-G)"}}],to=class _ChromaQuestion extends l{constructor(e){super(e),t(this,"chroma"),this.chroma=e[0].Chroma}get baseFreq(){const e=440;return"A"===this.chroma?e:"B"===this.chroma?e*Math.pow(2,2/12):"C"===this.chroma?e*Math.pow(2,.25):e}get choiceList(){return re([this.chroma.toString(),"test","options","are","fun"])}isCorrect(e){return e.choiceList[e.selection]===this.chroma.toString()}dataShapes(){return _ChromaQuestion.dataShapes}views(){return _ChromaQuestion.views}};t(to,"dataShapes",[{fields:eo,name:a.PITCH_chroma}]),t(to,"views",[Za]);let io=to;const no=new CourseWare("pitch",[io]);var ro,so,ao,oo,co,lo,ho,uo,po,fo,mo,go,vo,bo,yo,_o,wo,xo,ko,Co,So,Mo,Eo,To;function Po(){return oo?ao:(oo=1,ao=function(e,t){var i=this;if(t||(t={}),i.qpm=t.qpm?parseInt(t.qpm,10):null,!i.qpm){var n=e.metaText?e.metaText.tempo:null;i.qpm=e.getBpm(n)}i.extraMeasuresAtBeginning=t.extraMeasuresAtBeginning?parseInt(t.extraMeasuresAtBeginning,10):0,i.beatCallback=t.beatCallback,i.eventCallback=t.eventCallback,i.lineEndCallback=t.lineEndCallback,i.lineEndAnticipation=t.lineEndAnticipation?parseInt(t.lineEndAnticipation,10):0,i.beatSubdivisions=t.beatSubdivisions?parseInt(t.beatSubdivisions,10):1,i.joggerTimer=null,i.replaceTarget=function(e){i.noteTimings=e.setTiming(i.qpm,i.extraMeasuresAtBeginning),0===e.noteTimings.length&&(i.noteTimings=e.setTiming(0,0)),i.lineEndCallback&&(i.lineEndTimings=function(e,t){for(var i=[],n=null,r=0;r<e.length;r++){var s=e[r];"end"!==s.type&&s.top!==n&&(i.push({measureNumber:s.measureNumber,milliseconds:s.milliseconds-t,top:s.top,bottom:s.top+s.height}),n=s.top)}return i}(e.noteTimings,i.lineEndAnticipation)),i.startTime=null,i.currentBeat=0,i.currentEvent=0,i.currentLine=0,i.currentTime=0,i.isPaused=!1,i.isRunning=!1,i.pausedPercent=null,i.justUnpaused=!1,i.newSeekPercent=0,i.lastTimestamp=0,0!==i.noteTimings.length&&(i.millisecondsPerBeat=1e3/(i.qpm/60)/i.beatSubdivisions,i.lastMoment=i.noteTimings[i.noteTimings.length-1].milliseconds,i.totalBeats=Math.round(i.lastMoment/i.millisecondsPerBeat))},i.replaceTarget(e),i.doTiming=function(e){if(i.lastTimestamp!==e&&(i.lastTimestamp=e,i.startTime||(i.startTime=e),!i.isPaused&&i.isRunning)){for(i.currentTime=e-i.startTime,i.currentTime+=16;i.noteTimings.length>i.currentEvent&&i.noteTimings[i.currentEvent].milliseconds<i.currentTime;){if(i.eventCallback&&"event"===i.noteTimings[i.currentEvent].type){var t=i.startTime;i.eventCallback(i.noteTimings[i.currentEvent]),t!==i.startTime&&(i.currentTime=e-i.startTime)}i.currentEvent++}if(i.lineEndCallback&&i.lineEndTimings.length>i.currentLine&&i.lineEndTimings[i.currentLine].milliseconds<i.currentTime&&i.currentEvent<i.noteTimings.length){var n=i.noteTimings[i.currentEvent].milliseconds===i.currentTime?i.noteTimings[i.currentEvent]:i.noteTimings[i.currentEvent-1];i.lineEndCallback(i.lineEndTimings[i.currentLine],n,{line:i.currentLine,endTimings:i.lineEndTimings,currentTime:i.currentTime}),i.currentLine++}if(i.currentTime<i.lastMoment){if(requestAnimationFrame(i.doTiming),i.currentBeat*i.millisecondsPerBeat<i.currentTime){var r=i.doBeatCallback(e);null!==r&&(i.currentTime=r)}}else if(i.currentBeat<=i.totalBeats&&i.beatCallback){var s=i.doBeatCallback(e);null!==s&&(i.currentTime=s),requestAnimationFrame(i.doTiming)}if(i.currentTime>=i.lastMoment)if(i.eventCallback){var a=i.eventCallback(null);i.shouldStop(a).then((function(e){e&&i.stop()}))}else i.stop()}},i.shouldStop=function(e){return new Promise((function(t){return e?"continue"===e?t(!1):void(e.then&&e.then((function(e){t("continue"!==e)}))):t(!0)}))},i.doBeatCallback=function(e){if(i.beatCallback){for(var t,n,r=i.currentEvent;r<i.noteTimings.length&&null===i.noteTimings[r].left;)r++;if(r<i.noteTimings.length){for(t=i.noteTimings[r].milliseconds,r=Math.max(0,i.currentEvent-1);r>=0&&null===i.noteTimings[r].left;)r--;n=i.noteTimings[r]}var s={},a={};if(n){s.top=n.top,s.height=n.height;var o=Math.max(0,e-i.startTime-n.milliseconds),c=t-n.milliseconds,l=n.endX-n.left,h=c?o*l/c:0;s.left=n.left+h,0===i.currentEvent&&n.milliseconds>e-i.startTime&&(s.left=void 0),a={timestamp:e,startTime:i.startTime,ev:n,endMs:t,offMs:o,offPx:h,gapMs:c,gapPx:l}}else a={timestamp:e,startTime:i.startTime};var u=i.startTime;if(i.beatCallback(i.currentBeat/i.beatSubdivisions,i.totalBeats/i.beatSubdivisions,i.lastMoment,s,a),u!==i.startTime)return e-i.startTime;i.currentBeat++}return null},i.animationJogger=function(){i.isRunning&&(i.doTiming(performance.now()),i.joggerTimer=setTimeout(i.animationJogger,60))},i.start=function(e,t){if(i.isRunning=!0,i.isPaused&&(i.isPaused=!1,void 0===e&&(i.justUnpaused=!0)),e)i.setProgress(e,t);else if(0===e)i.reset();else if(null!==i.pausedPercent){var n=performance.now();i.currentTime=i.lastMoment*i.pausedPercent,i.startTime=n-i.currentTime,i.pausedPercent=null,i.reportNext=!0}requestAnimationFrame(i.doTiming),i.joggerTimer=setTimeout(i.animationJogger,60)},i.pause=function(){i.isPaused=!0;var e=performance.now();i.pausedPercent=(e-i.startTime)/i.lastMoment,i.isRunning=!1,i.joggerTimer&&(clearTimeout(i.joggerTimer),i.joggerTimer=null)},i.currentMillisecond=function(){return i.currentTime},i.reset=function(){i.currentBeat=0,i.currentEvent=0,i.currentLine=0,i.startTime=null,i.pausedPercent=null},i.stop=function(){i.pause(),i.reset()},i.setProgress=function(e,t){var n;switch(t){case"seconds":i.currentTime=1e3*e,i.currentTime<0&&(i.currentTime=0),i.currentTime>i.lastMoment&&(i.currentTime=i.lastMoment),n=i.currentTime/i.lastMoment;break;case"beats":i.currentTime=e*i.millisecondsPerBeat*i.beatSubdivisions,i.currentTime<0&&(i.currentTime=0),i.currentTime>i.lastMoment&&(i.currentTime=i.lastMoment),n=i.currentTime/i.lastMoment;break;default:(n=e)<0&&(n=0),n>1&&(n=1),i.currentTime=i.lastMoment*n}i.isRunning||(i.pausedPercent=n);var r=performance.now();for(i.startTime=r-i.currentTime,i.currentEvent,i.currentEvent=0;i.noteTimings.length>i.currentEvent&&i.noteTimings[i.currentEvent].milliseconds<i.currentTime;)i.currentEvent++;if(i.lineEndCallback)for(i.currentLine=0;i.lineEndTimings.length>i.currentLine&&i.lineEndTimings[i.currentLine].milliseconds+i.lineEndAnticipation<i.currentTime;)i.currentLine++;var s=i.currentBeat;i.currentBeat=Math.floor(i.currentTime/i.millisecondsPerBeat),i.beatCallback&&s!==i.currentBeat&&i.doBeatCallback(i.startTime+i.currentTime),i.eventCallback&&i.currentEvent>=0&&"event"===i.noteTimings[i.currentEvent].type&&i.eventCallback(i.noteTimings[i.currentEvent]),i.lineEndCallback&&i.lineEndCallback(i.lineEndTimings[i.currentLine],i.noteTimings[i.currentEvent],{line:i.currentLine,endTimings:i.lineEndTimings}),i.joggerTimer=setTimeout(i.animationJogger,60)}})}function Ao(){if(lo)return co;lo=1;var e,t,i=Po(),n={};return n.startAnimation=function(n,r,s){function a(e){for(var t=0;t<e.length;t++){var i=e[t];i.classList.contains("abcjs-bar")||(i.style.display="none")}}var o;e&&(e.stop(),e=void 0),s.showCursor&&((t=n.querySelector(".abcjs-cursor"))||((t=document.createElement("DIV")).className="abcjs-cursor cursor",t.style.position="absolute",n.appendChild(t),n.style.position="relative")),(e=new i(r,{qpm:s.bpm,eventCallback:function(i){if(i){if(i.measureStart){var r=".abcjs-l"+(h=i).line+".abcjs-m"+h.measureNumber;r&&(c=r,s.hideCurrentMeasure?(l=c,a(n.querySelectorAll(l))):s.hideFinishedMeasures&&function(e){o&&a(n.querySelectorAll(o)),o=e}(c))}t&&(t.style.left=i.left+"px",t.style.top=i.top+"px",t.style.width=i.width+"px",t.style.height=i.height+"px")}else e.stop(),e=void 0;var c,l,h}})).start()},n.pauseAnimation=function(t){e&&(t?e.pause():e.start())},n.stopAnimation=function(){e&&(e.stop(),e=void 0)},co=n}function Io(){if(uo)return ho;uo=1;var e={cloneArray:function(e){for(var t=[],i=0;i<e.length;i++)t.push(Object.assign({},e[i]));return t},cloneHashOfHash:function(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=Object.assign({},e[i]));return t},cloneHashOfArrayOfHash:function(t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]=e.cloneArray(t[n]));return i},strip:function(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")},startsWith:function(e,t){return 0===e.indexOf(t)},endsWith:function(e,t){var i=e.length-t.length;return i>=0&&e.lastIndexOf(t)===i},last:function(e){return 0===e.length?null:e[e.length-1]}};return ho=e}function No(){if(fo)return po;fo=1;var e=Io(),t={};return function(){var i,n,r,s,a;t.initialize=function(e,t,o,c,l){i=e,n=t,s=c,a=l,(r=o).annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"},r.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},r.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"},r.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"},r.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},r.tripletfont={face:"Times",size:11,weight:"normal",style:"italic",decoration:"none"},r.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},r.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},s.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"},s.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"},s.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"},s.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"},s.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},s.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"},s.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"},s.formatting.tablabelfont={face:'"Trebuchet MS"',size:16,weight:"normal",style:"normal",decoration:"none"},s.formatting.tabnumberfont={face:'"Arial"',size:11,weight:"normal",style:"normal",decoration:"none"},s.formatting.tabgracefont={face:'"Arial"',size:8,weight:"normal",style:"normal",decoration:"none"},s.formatting.annotationfont=r.annotationfont,s.formatting.gchordfont=r.gchordfont,s.formatting.historyfont=r.historyfont,s.formatting.infofont=r.infofont,s.formatting.measurefont=r.measurefont,s.formatting.partsfont=r.partsfont,s.formatting.repeatfont=r.repeatfont,s.formatting.textfont=r.textfont,s.formatting.tripletfont=r.tripletfont,s.formatting.vocalfont=r.vocalfont,s.formatting.wordsfont=r.wordsfont};var o={gchordfont:!0,measurefont:!0,partsfont:!0,annotationfont:!0,composerfont:!0,historyfont:!0,infofont:!0,subtitlefont:!0,textfont:!0,titlefont:!0,voicefont:!0},c=function(e,t,i,r,s){function a(){var a=parseInt(e[0].token);return e.shift(),t?0===e.length?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:a}:1===e.length&&"box"===e[0].token&&o[s]?{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:a,box:!0}:(n("Extra parameters in font definition.",i,r),{face:t.face,weight:t.weight,style:t.style,decoration:t.decoration,size:a}):(n("Can't set just the size of the font since there is no default value.",i,r),{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:a})}if("*"===e[0].token){if(e.shift(),"number"===e[0].type)return a();n("Expected font size number after *.",i,r)}if("number"===e[0].type)return a();for(var c,l=[],h="normal",u="normal",d="none",p=!1,f="face",m=!1;e.length;){var g=e.shift(),v=g.token.toLowerCase();switch(f){case"face":m||"utf"!==v&&"number"!==g.type&&"bold"!==v&&"italic"!==v&&"underline"!==v&&"box"!==v?l.length>0&&"-"===g.token?(m=!0,l[l.length-1]=l[l.length-1]+g.token):m?(m=!1,l[l.length-1]=l[l.length-1]+g.token):l.push(g.token):"number"===g.type?(c?n("Font size specified twice in font definition.",i,r):c=g.token,f="modifier"):"bold"===v?h="bold":"italic"===v?u="italic":"underline"===v?d="underline":"box"===v?(o[s]?p=!0:n('This font style doesn\'t support "box"',i,r),f="finished"):"utf"===v?(g=e.shift(),f="size"):n("Unknown parameter "+g.token+" in font definition.",i,r);break;case"size":"number"===g.type?c?n("Font size specified twice in font definition.",i,r):c=g.token:n("Expected font size in font definition.",i,r),f="modifier";break;case"modifier":"bold"===v?h="bold":"italic"===v?u="italic":"underline"===v?d="underline":"box"===v?(o[s]?p=!0:n('This font style doesn\'t support "box"',i,r),f="finished"):n("Unknown parameter "+g.token+" in font definition.",i,r);break;case"finished":n('Extra characters found after "box" in font definition.',i,r)}}void 0===c?t?c=t.size:(n("Must specify the size of the font since there is no default value.",i,r),c=12):c=parseFloat(c),""===(l=l.join(" "))&&(t?l=t.face:(n("Must specify the name of the font since there is no default value.",i,r),l="sans-serif"));var b=function(e){switch(e){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}}(l),y={};return b?(y.face=b.face,y.weight=b.weight,y.style=b.style,y.decoration=b.decoration,y.size=c,p&&(y.box=!0),y):(y.face=l,y.weight=h,y.style=u,y.decoration=d,y.size=c,p&&(y.box=!0),y)},l=function(e,t,i){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(r[e]=c(t,r[e],i,0,e),r.is_in_header&&(s.formatting[e]=r[e]),null)},h=function(e,t){var i="";t.forEach((function(e){i+=e.token}));var n=parseFloat(i);if(isNaN(n)||0===n)return'Directive "'+e+'" requires a number as a parameter.';s.formatting.scale=n},u=["acoustic-bass-drum","bass-drum-1","side-stick","acoustic-snare","hand-clap","electric-snare","low-floor-tom","closed-hi-hat","high-floor-tom","pedal-hi-hat","low-tom","open-hi-hat","low-mid-tom","hi-mid-tom","crash-cymbal-1","high-tom","ride-cymbal-1","chinese-cymbal","ride-bell","tambourine","splash-cymbal","cowbell","crash-cymbal-2","vibraslap","ride-cymbal-2","hi-bongo","low-bongo","mute-hi-conga","open-hi-conga","low-conga","high-timbale","low-timbale","high-agogo","low-agogo","cabasa","maracas","short-whistle","long-whistle","short-guiro","long-guiro","claves","hi-wood-block","low-wood-block","mute-cuica","open-cuica","mute-triangle","open-triangle"],d=function(e,t,i,n,s){if(1!==i.length||"number"!==i[0].type)return'Directive "'+t+'" requires a number as a parameter.';var a=i[0].intt;return void 0!==n&&a<n?'Directive "'+t+'" requires a number greater than or equal to '+n+" as a parameter.":void 0!==s&&a>s?'Directive "'+t+'" requires a number less than or equal to '+s+" as a parameter.":(r[e]=a,null)},p=function(e,t,i){if(1===i.length&&("true"===i[0].token||"false"===i[0].token))return r[e]="true"===i[0].token,null;var n=d(e,t,i,0,1);return null!==n?n:(r[e]=1===r[e],null)},f=function(e,t,i,n){if(1!==i.length)return'Directive "'+t+'" requires one of [ '+n.join(", ")+" ] as a parameter.";for(var s=i[0].token,a=!1,o=0;!a&&o<n.length;o++)n[o]===s&&(a=!0);return a?(r[e]=s,null):'Directive "'+t+'" requires one of [ '+n.join(", ")+" ] as a parameter."},m=["nobarlines","barlines","beataccents","nobeataccents","droneon","droneoff","drumon","drumoff","fermatafixed","fermataproportional","gchordon","gchordoff","controlcombo","temperamentnormal","noportamento"],g=["gchord","ptstress","beatstring"],v=["bassvol","chordvol","c","channel","beatmod","deltaloudness","drumbars","gracedivider","makechordchannels","randomchordattack","chordattack","stressmodel","transpose","rtranspose","vol","volinc","gchordbars"],b=["program"],y=["ratio","snt","bendvelocity","pitchbend","control","temperamentlinear"],_=["beat"],w=["drone"],x=["portamento"],k=["expand","grace","trim"],C=["drum","chordname"],S=["bassprog","chordprog"];t.parseFontChangeLine=function(e){var t=(e=e.replace(/\$\$/g,"")).split("$");if(t.length>1&&r.setfont){var i=[];""!==t[0]&&i.push({text:t[0]});for(var n=1;n<t.length;n++)if("0"===t[n][0])i.push({text:t[n].substring(1).replace(/\x03/g,"$$")});else{var s=parseInt(t[n][0],10);r.setfont[s]?i.push({font:r.setfont[s],text:t[n].substring(1).replace(/\x03/g,"$$")}):i[i.length-1].text+="$"+t[n].replace(/\x03/g,"$$")}return i}return e.replace(/\x03/g,"$$")};var M=["auto","above","below","hidden"];function E(e){if(0===e.length)return{value:1};if(1===e.length)if("number"===e[0].type){if(e[0].floatt>=0||e[0].floatt<=1)return{value:e[0].floatt}}else{if("false"===e[0].token)return{value:0};if("true"===e[0].token)return{value:1}}return{error:"Directive stretchlast requires zero or one parameter: false, true, or number between 0 and 1 (received "+e[0].token+")"}}t.addDirective=function(o){var T=i.tokenize(o,0,o.length);if(0===T.length||"alpha"!==T[0].type)return null;var P=o.substring(o.indexOf(T[0].token)+T[0].token.length);P=i.stripComment(P);var A,I,N,L,O=T.shift().token.toLowerCase(),B="";switch(O){case"bagpipes":s.formatting.bagpipes=!0;break;case"flatbeams":s.formatting.flatbeams=!0;break;case"jazzchords":s.formatting.jazzchords=!0;break;case"accentAbove":s.formatting.accentAbove=!0;break;case"germanAlphabet":s.formatting.germanAlphabet=!0;break;case"landscape":r.landscape=!0;break;case"papersize":r.papersize=P;break;case"graceslurs":if(1!==T.length)return"Directive graceslurs requires one parameter: 0 or 1";if("0"===T[0].token||"false"===T[0].token)s.formatting.graceSlurs=!1;else{if("1"!==T[0].token&&"true"!==T[0].token)return"Directive graceslurs requires one parameter: 0 or 1 (received "+T[0].token+")";s.formatting.graceSlurs=!0}break;case"lineThickness":var D=E(T);if(void 0!==D.value&&(s.formatting.lineThickness=D.value),D.error)return D.error;break;case"stretchlast":var R=E(T);if(void 0!==R.value&&(s.formatting.stretchlast=R.value),R.error)return R.error;break;case"titlecaps":r.titlecaps=!0;break;case"titleleft":s.formatting.titleleft=!0;break;case"measurebox":s.formatting.measurebox=!0;break;case"vocal":return f("vocalPosition",O,T,M);case"dynamic":return f("dynamicPosition",O,T,M);case"gchord":return f("chordPosition",O,T,M);case"ornament":return f("ornamentPosition",O,T,M);case"volume":return f("volumePosition",O,T,M);case"botmargin":case"botspace":case"composerspace":case"indent":case"leftmargin":case"linesep":case"musicspace":case"partsspace":case"pageheight":case"pagewidth":case"rightmargin":case"stafftopmargin":case"staffsep":case"staffwidth":case"subtitlespace":case"sysstaffsep":case"systemsep":case"textspace":case"titlespace":case"topmargin":case"topspace":case"vocalspace":case"wordsspace":return I=O,N=T,0===(L=i.getMeasurement(N)).used||0!==N.length?'Directive "'+I+'" requires a measurement as a parameter.':(s.formatting[I]=L.value,null);case"voicescale":if(1!==T.length||"number"!==T[0].type)return"voicescale requires one float as a parameter";var z=T.shift();return r.currentVoice&&(r.currentVoice.scale=z.floatt,a.changeVoiceScale(r.currentVoice.scale)),null;case"voicecolor":if(1!==T.length)return"voicecolor requires one string as a parameter";var V=T.shift();return r.currentVoice&&(r.currentVoice.color=V.token,a.changeVoiceColor(r.currentVoice.color)),null;case"vskip":var q=Math.round(function(e,t){var n=i.getMeasurement(t);return 0===n.used||0!==t.length?{error:'Directive "'+e+'" requires a measurement as a parameter.'}:n.value}(O,T));return q.error?q.error:(a.addSpacing(q),null);case"scale":h(O,T);break;case"sep":if(0===T.length)a.addSeparator(14,14,85,{startChar:r.iChar,endChar:r.iChar+5});else{var F=i.getMeasurement(T);if(0===F.used)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var j=F.value;if(0===(F=i.getMeasurement(T)).used)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var H=F.value;if(0===(F=i.getMeasurement(T)).used||0!==T.length)return'Directive "'+O+'" requires 3 numbers: space above, space below, length of line';var G=F.value;a.addSeparator(j,H,G,{startChar:r.iChar,endChar:r.iChar+P.length})}break;case"barsperstaff":if(null!==(B=d("barsperstaff",O,T)))return B;break;case"staffnonote":if(1!==T.length)return"Directive staffnonote requires one parameter: 0 or 1";if("0"===T[0].token)r.staffnonote=!0;else{if("1"!==T[0].token)return"Directive staffnonote requires one parameter: 0 or 1 (received "+T[0].token+")";r.staffnonote=!1}break;case"printtempo":if(null!==(B=p("printTempo",O,T)))return B;break;case"partsbox":if(null!==(B=p("partsBox",O,T)))return B;r.partsfont.box=r.partsBox;break;case"freegchord":if(null!==(B=p("freegchord",O,T)))return B;break;case"measurenb":case"barnumbers":if(null!==(B=d("barNumbers",O,T)))return B;break;case"setbarnb":if(1!==T.length||"number"!==T[0].type)return"Directive setbarnb requires a number as a parameter.";r.currBarNumber=a.setBarNumberImmediate(T[0].intt);break;case"begintext":var U="";for(A=i.nextLine();A&&0!==A.indexOf("%%endtext");)e.startsWith(A,"%%")?U+=A.substring(2)+"\n":U+=A+"\n",A=i.nextLine();a.addText(U,{startChar:r.iChar,endChar:r.iChar+U.length+7});break;case"continueall":r.continueall=!0;break;case"beginps":for(A=i.nextLine();A&&0!==A.indexOf("%%endps");)i.nextLine();n("Postscript ignored",o,0);break;case"deco":P.length>0&&r.ignoredDecorations.push(P.substring(0,P.indexOf(" "))),n("Decoration redefinition ignored",o,0);break;case"text":var W=i.translateString(P);a.addText(t.parseFontChangeLine(W),{startChar:r.iChar,endChar:r.iChar+P.length+7});break;case"center":var Y=i.translateString(P);a.addCentered(t.parseFontChangeLine(Y));break;case"font":break;case"setfont":var $=i.tokenize(P,0,P.length);if($.length>=4&&"-"===$[0].token&&"number"===$[1].type){var K=parseInt($[1].token);K>=1&&K<=9&&(r.setfont||(r.setfont=[]),$.shift(),$.shift(),r.setfont[K]=c($,r.setfont[K],o,0,"setfont"))}break;case"gchordfont":case"partsfont":case"tripletfont":case"vocalfont":case"textfont":case"annotationfont":case"historyfont":case"infofont":case"measurefont":case"repeatfont":case"wordsfont":return l(O,T,o);case"composerfont":case"subtitlefont":case"tempofont":case"titlefont":case"voicefont":case"footerfont":case"headerfont":return function(e,t,i){return 0===t.length?'Directive "'+e+'" requires a font as a parameter.':(s.formatting[e]=c(t,s.formatting[e],i,0,e),null)}(O,T,o);case"barlabelfont":case"barnumberfont":case"barnumfont":return l("measurefont",T,o);case"staves":case"score":r.score_is_present=!0;for(var X,Q=function(t,i,n,s,a){(i||0===r.staves.length)&&r.staves.push({index:r.staves.length,numVoices:0});var o=e.last(r.staves);void 0!==n&&void 0===o.bracket&&(o.bracket=n),void 0!==s&&void 0===o.brace&&(o.brace=s),a&&(o.connectBarLines="end"),void 0===r.voices[t]&&(r.voices[t]={staffNum:o.index,index:o.numVoices},o.numVoices++)},Z=!1,J=!1,ee=!1,te=!1,ie=!1,ne=!1,re=!1,se=function(){if(re=!0,X){var e="start";X.staffNum>0&&("start"!==r.staves[X.staffNum-1].connectBarLines&&"continue"!==r.staves[X.staffNum-1].connectBarLines||(e="continue")),r.staves[X.staffNum].connectBarLines=e}};T.length;){var ae=T.shift();switch(ae.token){case"(":Z?n("Can't nest parenthesis in %%score",o,ae.start):(Z=!0,te=!0);break;case")":!Z||te?n("Unexpected close parenthesis in %%score",o,ae.start):Z=!1;break;case"[":J?n("Can't nest brackets in %%score",o,ae.start):(J=!0,ie=!0);break;case"]":!J||ie?n("Unexpected close bracket in %%score",o,ae.start):(J=!1,r.staves[X.staffNum].bracket="end");break;case"{":ee?n("Can't nest braces in %%score",o,ae.start):(ee=!0,ne=!0);break;case"}":!ee||ne?n("Unexpected close brace in %%score",o,ae.start):(ee=!1,r.staves[X.staffNum].brace="end");break;case"|":se();break;default:for(var oe="";("alpha"===ae.type||"number"===ae.type)&&(oe+=ae.token,ae.continueId);)ae=T.shift();Q(oe,!Z||te,ie?"start":J?"continue":void 0,ne?"start":ee?"continue":void 0,re),te=!1,ie=!1,ne=!1,re=!1,X=r.voices[oe],"staves"===O&&se()}}break;case"newpage":var ce=i.getInt(P);a.addNewPage(0===ce.digits?-1:ce.value);break;case"abc":var le=P.split(" ");switch(le[0]){case"-copyright":case"-creator":case"-edited-by":case"-version":case"-charset":var he=le.shift();a.addMetaText(O+he,le.join(" "),{startChar:r.iChar,endChar:r.iChar+P.length+5});break;default:return"Unknown directive: "+O+le[0]}break;case"header":case"footer":var ue=i.getMeat(P,0,P.length);'"'===(ue=P.substring(ue.start,ue.end))[0]&&'"'===ue[ue.length-1]&&(ue=ue.substring(1,ue.length-1));var de,pe=ue.split("\t");de=1===pe.length?{left:"",center:pe[0],right:""}:2===pe.length?{left:pe[0],center:pe[1],right:""}:{left:pe[0],center:pe[1],right:pe[2]},pe.length>3&&n("Too many tabs in "+O+": "+pe.length+" found.",P,0),a.addMetaTextObj(O,de,{startChar:r.iChar,endChar:r.iChar+o.length});break;case"midi":var fe=i.tokenize(P,0,P.length,!0);fe.length>0&&"="===fe[0].token&&fe.shift(),0===fe.length?n("Expected midi command",P,0):function(e,t,i){var r=e.shift().token,s=[];if(m.indexOf(r)>=0)0!==e.length&&n("Unexpected parameter in MIDI "+r,i,0);else if(g.indexOf(r)>=0)1!==e.length?n("Expected one parameter in MIDI "+r,i,0):s.push(e[0].token);else if(v.indexOf(r)>=0)1!==e.length?n("Expected one parameter in MIDI "+r,i,0):"number"!==e[0].type?n("Expected one integer parameter in MIDI "+r,i,0):s.push(e[0].intt);else if(b.indexOf(r)>=0)1!==e.length&&2!==e.length?n("Expected one or two parameters in MIDI "+r,i,0):"number"!==e[0].type||2===e.length&&"number"!==e[1].type?n("Expected integer parameter in MIDI "+r,i,0):(s.push(e[0].intt),2===e.length&&s.push(e[1].intt));else if(y.indexOf(r)>=0)2!==e.length?n("Expected two parameters in MIDI "+r,i,0):"number"!==e[0].type||"number"!==e[1].type?n("Expected two integer parameters in MIDI "+r,i,0):(s.push(e[0].intt),s.push(e[1].intt));else if(x.indexOf(r)>=0)2!==e.length?n("Expected two parameters in MIDI "+r,i,0):"alpha"!==e[0].type||"number"!==e[1].type?n("Expected one string and one integer parameters in MIDI "+r,i,0):(s.push(e[0].token),s.push(e[1].intt));else if("drummap"===r)2===e.length&&"alpha"===e[0].type&&"number"===e[1].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token]=e[1].intt,s=t.formatting.midi.drummap):3===e.length&&"punct"===e[0].type&&"alpha"===e[1].type&&"number"===e[2].type?(t.formatting||(t.formatting={}),t.formatting.midi||(t.formatting.midi={}),t.formatting.midi.drummap||(t.formatting.midi.drummap={}),t.formatting.midi.drummap[e[0].token+e[1].token]=e[2].intt,s=t.formatting.midi.drummap):n("Expected one note name and one integer parameter in MIDI "+r,i,0);else if(k.indexOf(r)>=0)3!==e.length||"number"!==e[0].type||"/"!==e[1].token||"number"!==e[2].type?n("Expected fraction parameter in MIDI "+r,i,0):(s.push(e[0].intt),s.push(e[2].intt));else if(_.indexOf(r)>=0)4!==e.length?n("Expected four parameters in MIDI "+r,i,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type?n("Expected four integer parameters in MIDI "+r,i,0):(s.push(e[0].intt),s.push(e[1].intt),s.push(e[2].intt),s.push(e[3].intt));else if(w.indexOf(r)>=0)5!==e.length?n("Expected five parameters in MIDI "+r,i,0):"number"!==e[0].type||"number"!==e[1].type||"number"!==e[2].type||"number"!==e[3].type||"number"!==e[4].type?n("Expected five integer parameters in MIDI "+r,i,0):(s.push(e[0].intt),s.push(e[1].intt),s.push(e[2].intt),s.push(e[3].intt),s.push(e[4].intt));else if(b.indexOf(r)>=0)1!==e.length||4!==e.length?n("Expected one or two parameters in MIDI "+r,i,0):"number"!==e[0].type?n("Expected integer parameter in MIDI "+r,i,0):4===e.length?("octave"!==e[1].token&&n("Expected octave parameter in MIDI "+r,i,0),"="!==e[2].token&&n("Expected octave parameter in MIDI "+r,i,0),"number"!==e[3].type&&n("Expected integer parameter for octave in MIDI "+r,i,0)):(s.push(e[0].intt),4===e.length&&s.push(e[3].intt));else if(C.indexOf(r)>=0)if(e.length<2)n("Expected string parameter and at least one integer parameter in MIDI "+r,i,0);else if("alpha"!==e[0].type)n("Expected string parameter and at least one integer parameter in MIDI "+r,i,0);else{var o=e.shift();for(s.push(o.token);e.length>0;)"number"!==(o=e.shift()).type&&n("Expected integer parameter in MIDI "+r,i,0),s.push(o.intt)}else if(S.indexOf(r)>=0)if(1!==e.length&&2!==e.length)n("Expected one or two parameters in MIDI "+r,i,0);else if("number"!==e[0].type)n("Expected integer parameter in MIDI "+r,i,0);else if(2===e.length&&"alpha"!==e[1].type)n("Expected alpha parameter in MIDI "+r,i,0);else if(s.push(e[0].intt),2===e.length){var c=e[1].token;-1!=c.indexOf("octave=")?(c=c.replace("octave=",""),c=parseInt(c),isNaN(c)?n("Expected octave value in MIDI"+r):(c<-1&&(n("Expected octave= in MIDI "+r+" to be >= -1 (recv:"+c+")"),c=-1),c>3&&(n("Expected octave= in MIDI "+r+" to be <= 3 (recv:"+c+")"),c=3),s.push(c))):n("Expected octave= in MIDI"+r)}a.hasBeginMusic()?a.appendElement("midi",-1,-1,{cmd:r,params:s}):(void 0===t.formatting.midi&&(t.formatting.midi={}),t.formatting.midi[r]=s)}(fe,s,P);break;case"percmap":var me=function(e){var t=e.split(/\s+/);if(2!==t.length&&3!==t.length)return{error:'Expected parameters "abc-note", "drum-sound", and optionally "note-head"'};var i=t[0],n=parseInt(t[1],10);if((isNaN(n)||n<35||n>81)&&t[1]&&(n=u.indexOf(t[1].toLowerCase())+35),isNaN(n)||n<35||n>81)return{error:'Expected drum name, received "'+t[1]+'"'};var r={sound:n};return 3===t.length&&(r.noteHead=t[2]),{key:i,value:r}}(P);me.error?n(me.error,o,8):(s.formatting.percmap||(s.formatting.percmap={}),s.formatting.percmap[me.key]=me.value);break;case"map":case"playtempo":case"auquality":case"continuous":case"nobarcheck":s.formatting[O]=P;break;default:return"Unknown directive: "+O}return null},t.globalFormatting=function(e){for(var t in e)if(e.hasOwnProperty(t)){var a,o=""+e[t],c=i.tokenize(o,0,o.length);switch(t){case"titlefont":case"gchordfont":case"composerfont":case"footerfont":case"headerfont":case"historyfont":case"infofont":case"measurefont":case"partsfont":case"repeatfont":case"subtitlefont":case"tempofont":case"textfont":case"voicefont":case"tripletfont":case"vocalfont":case"wordsfont":case"annotationfont":case"tablabelfont":case"tabnumberfont":case"tabgracefont":l(t,c,o);break;case"scale":h(t,c);break;case"partsbox":null!==(a=p("partsBox",t,c))&&n(a),r.partsfont.box=r.partsBox;break;case"freegchord":null!==(a=p("freegchord",t,c))&&n(a);break;case"fontboxpadding":1===c.length&&"number"===c[0].type||n('Directive "'+t+'" requires a number as a parameter.'),s.formatting.fontboxpadding=c[0].floatt;break;case"stafftopmargin":1===c.length&&"number"===c[0].type||n('Directive "'+t+'" requires a number as a parameter.'),s.formatting.stafftopmargin=c[0].floatt;break;case"stretchlast":var u=E(c);if(void 0!==u.value&&(s.formatting.stretchlast=u.value),u.error)return u.error;break;default:n("Formatting directive unrecognized: ",t,0)}}}}(),po=t}function Lo(){if(bo)return vo;bo=1;var e=["C","C♯","D","D♯","E","F","F♯","G","G♯","A","A♯","B"],t=["C","D♭","D","E♭","E","F","G♭","G","A♭","A","B♭","B"],i=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],n=["C","Db","D","Eb","E","F","Gb","G","Ab","A","Bb","B"];return vo=function(r,s,a,o){if(!s||s%12==0)return r;for(;s<0;)s+=12;s>11&&(s%=12);var c=r.match(/^([A-G][b#♭♯]?)([^\/]+)?\/?([A-G][b#♭♯]?)?(.+)?/);if(!c)return r;var l,h=c[1],u=c[2],d=c[3],p=c[4];return(l=e.indexOf(h))<0&&(l=t.indexOf(h)),l<0&&(l=i.indexOf(h)),l<0&&(l=n.indexOf(h)),l<0||(l+=s,l%=12,r=a?o?n[l]:t[l]:o?i[l]:e[l],u&&(r+=u),d&&((l=e.indexOf(d))<0&&(l=t.indexOf(d)),l<0&&(l=i.indexOf(d)),l<0&&(l=n.indexOf(d)),r+="/",l>=0?(l+=s,l%=12,r+=a?o?n[l]:t[l]:o?i[l]:e[l]):r+=d),p&&(r+=p)),r}}function Oo(){if(_o)return yo;_o=1;var e={C:{modes:["CMaj","Amin","Am","GMix","DDor","EPhr","FLyd","BLoc"],stepsFromC:0},Db:{modes:["DbMaj","Bbmin","Bbm","AbMix","EbDor","FPhr","GbLyd","CLoc"],stepsFromC:1},D:{modes:["DMaj","Bmin","Bm","AMix","EDor","F#Phr","GLyd","C#Loc"],stepsFromC:2},Eb:{modes:["EbMaj","Cmin","Cm","BbMix","FDor","GPhr","AbLyd","DLoc"],stepsFromC:3},E:{modes:["EMaj","C#min","C#m","BMix","F#Dor","G#Phr","ALyd","D#Loc"],stepsFromC:4},F:{modes:["FMaj","Dmin","Dm","CMix","GDor","APhr","BbLyd","ELoc"],stepsFromC:5},Gb:{modes:["GbMaj","Ebmin","Ebm","DbMix","AbDor","BbPhr","CbLyd","FLoc"],stepsFromC:6},G:{modes:["GMaj","Emin","Em","DMix","ADor","BPhr","CLyd","F#Loc"],stepsFromC:7},Ab:{modes:["AbMaj","Fmin","Fm","EbMix","BbDor","CPhr","DbLyd","GLoc"],stepsFromC:8},A:{modes:["AMaj","F#min","F#m","EMix","BDor","C#Phr","DLyd","G#Loc"],stepsFromC:9},Bb:{modes:["BbMaj","Gmin","Gm","FMix","CDor","DPhr","EbLyd","ALoc"],stepsFromC:10},B:{modes:["BMaj","G#min","G#m","F#Mix","C#Dor","D#Phr","ELyd","A#Loc"],stepsFromC:11},"C#":{modes:["C#Maj","A#min","A#m","G#Mix","D#Dor","E#Phr","F#Lyd","B#Loc"],stepsFromC:1},"F#":{modes:["F#Maj","D#min","D#m","C#Mix","G#Dor","A#Phr","BLyd","E#Loc"],stepsFromC:6},Cb:{modes:["CbMaj","Abmin","Abm","GbMix","DbDor","EbPhr","FbLyd","BbLoc"],stepsFromC:11}},t=null;return yo={relativeMajor:function(i){t||function(){t={};for(var i=Object.keys(e),n=0;n<i.length;n++){var r=e[i[n]];t[i[n].toLowerCase()]=i[n];for(var s=0;s<r.modes.length;s++){var a=r.modes[s].toLowerCase();t[a]=i[n]}}}();var n=i.toLowerCase().match(/([a-g][b#]?)(maj|min|mix|dor|phr|lyd|loc|m)?/);return n&&n[2]?(n=n[1]+n[2],t[n]||i):i},relativeMode:function(t,i){var n=e[t];if(!n)return t;if(""===i)return t;var r=i.toLowerCase().match(/^(maj|min|mix|dor|phr|lyd|loc|m)/);if(!r)return t;for(var s=r[1],a=0;a<n.modes.length;a++){var o=n.modes[a],c=o.toLowerCase().indexOf(s);if(-1!==c&&c===o.length-s.length)return o.substring(0,o.length-s.length)}return t},transposeKey:function(t,i){var n=e[t];if(!n)return t;for(;i<0;)i+=12;for(var r=(n.stepsFromC+i)%12,s=0;s<Object.keys(e).length;s++){var a=Object.keys(e)[s];if(e[a].stepsFromC===r)return a}return t}}}function Bo(){if(xo)return wo;xo=1;var{relativeMajor:e}=Oo(),t={acc:"sharp",note:"f"},i={acc:"sharp",note:"c"},n={acc:"sharp",note:"g"},r={acc:"sharp",note:"d"},s={acc:"sharp",note:"A"},a={acc:"sharp",note:"e"},o={acc:"flat",note:"B"},c={acc:"flat",note:"e"},l={acc:"flat",note:"A"},h={acc:"flat",note:"d"},u={acc:"flat",note:"G"},d={acc:"flat",note:"c"},p={"C#":[t,i,n,r,s,a,{acc:"sharp",note:"B"}],"F#":[t,i,n,r,s,a],B:[t,i,n,r,s],E:[t,i,n,r],A:[t,i,n],D:[t,i],G:[t],C:[],F:[o],Bb:[o,c],Eb:[o,c,l],Cm:[o,c,l],Ab:[o,c,l,h],Db:[o,c,l,h,u],Gb:[o,c,l,h,u,d],Cb:[o,c,l,h,u,d,{acc:"flat",note:"F"}],"A#":[o,c],"B#":[],"D#":[o,c,l],"E#":[o],"G#":[o,c,l,h],none:[]};return wo=function(t){var i=p[e(t)];return i?JSON.parse(JSON.stringify(i)):null}}function Do(){if(Co)return ko;Co=1;var e=function(){if(go)return mo;go=1;var e={};const t=["C,,,","D,,,","E,,,","F,,,","G,,,","A,,,","B,,,","C,,","D,,","E,,","F,,","G,,","A,,","B,,","C,","D,","E,","F,","G,","A,","B,","C","D","E","F","G","A","B","c","d","e","f","g","a","b","c'","d'","e'","f'","g'","a'","b'","c''","d''","e''","f''","g''","a''","b''","c'''","d'''","e'''","f'''","g'''","a'''","b'''"];return e.pitchIndex=function(e){return t.indexOf(e)},e.noteName=function(e){return t[e]},mo=e}(),t=Lo(),i=Bo(),n={},r={C:0,"C#":1,Db:1,D:2,"D#":3,Eb:3,E:4,F:5,"F#":6,Gb:6,G:7,"G#":8,Ab:8,A:9,"A#":10,Bb:10,B:11},s=["C","Db","D","Eb","E","F","F#","G","Ab","A","Bb","B"],a=["C","C#","D","D#","E","F","F#","G","G#","A","Bb","B"];n.keySignature=function(e,t,n,o,c){if("perc"===e.clef.type||"none"===e.clef.type)return{accidentals:i(t),root:n,acc:o};c||(c=0),e.localTransposeVerticalMovement=0,e.localTransposePreferFlats=!1;var l=i(t);if(!l)return e.key;if(e.localTranspose=(e.globalTranspose?e.globalTranspose:0)+c,!e.localTranspose)return{accidentals:l,root:n,acc:o};if(e.globalTransposeOrigKeySig=l,e.localTranspose%12==0)return e.localTransposeVerticalMovement=e.localTranspose/12*7,{accidentals:l,root:n,acc:o};var h=t[0];"b"===t[1]||"#"===t[1]?(h+=t[1],t=t.substr(2)):t=t.substr(1);var u=r[h],d=void 0!==u;d||(u=0,h="C",t="");for(var p=u+e.localTranspose;p<0;)p+=12;p>11&&(p%=12);var f="m"===t[0]?a[p]:s[p],m=f+t,g=i(m);g.length>0&&"flat"===g[0].acc&&(e.localTransposePreferFlats=!0);var v=m.charCodeAt(0)-h.charCodeAt(0);return e.localTranspose>0?v<0?v+=7:0===v&&("#"!==h[1]&&"b"!==m[1]||(v+=7)):e.localTranspose<0&&(v>0?v-=7:0===v&&("b"!==h[1]&&"#"!==m[1]||(v-=7))),e.localTranspose>0?e.localTransposeVerticalMovement=v+7*Math.floor(e.localTranspose/12):e.localTransposeVerticalMovement=v+7*Math.ceil(e.localTranspose/12),d?{accidentals:g,root:f[0],acc:f.length>1?f[1]:""}:{accidentals:[],root:n,acc:o}},n.chordName=function(e,i){return t(i,e.localTranspose,e.localTransposePreferFlats,e.freegchord)};var o=["c","d","e","f","g","a","b"],c={dblflat:-2,flat:-1,natural:0,sharp:1,dblsharp:2},l={"-2":"dblflat","-1":"flat",0:"natural",1:"sharp",2:"dblsharp"},h={"-2":"__","-1":"_",0:"=",1:"^",2:"^^"};return n.note=function(t,i){if(t.localTranspose&&"perc"!==t.clef.type){var n=i.pitch;if(t.localTransposeVerticalMovement&&(i.pitch=i.pitch+t.localTransposeVerticalMovement,i.name)){var r=i.accidental?i.name.substring(1):i.name,s=i.accidental?i.name[0]:"",a=e.pitchIndex(r);i.name=s+e.noteName(a+t.localTransposeVerticalMovement)}if(i.accidental){var u=function(e,t,i,n,r){for(var s=o[(e+49)%7],a=0,l=0;l<n.length;l++)n[l].note.toLowerCase()===s&&(a=c[n[l].acc]);for(var h=c[i]-a,u=o[(t+49)%7],d=0,p=0;p<r.accidentals.length;p++)r.accidentals[p].note.toLowerCase()===u&&(d=c[r.accidentals[p].acc]);var f=h+d;return f<-2&&(t--,f+="c"===u||"f"===u?1:2),f>2&&(t++,f-="b"===u||"e"===u?1:2),[t,f]}(n,i.pitch,i.accidental,t.globalTransposeOrigKeySig,t.targetKey);i.pitch=u[0],i.accidental=l[u[1]],i.name&&(i.name=h[u[1]]+i.name.replace(/[_^=]/g,""))}}},ko=n}function Ro(){if(Mo)return So;Mo=1;var e=No(),t=Do(),i={};return function(){var n,r,s,a;i.initialize=function(e,t,i,o,c){n=e,r=t,s=i,a=c},i.standardKey=function(e,i,n,r){return t.keySignature(s,e,i,n,r)};var o={treble:{clef:"treble",pitch:4,mid:0},"treble+8":{clef:"treble+8",pitch:4,mid:0},"treble-8":{clef:"treble-8",pitch:4,mid:0},"treble^8":{clef:"treble+8",pitch:4,mid:0},treble_8:{clef:"treble-8",pitch:4,mid:0},treble1:{clef:"treble",pitch:2,mid:2},treble2:{clef:"treble",pitch:4,mid:0},treble3:{clef:"treble",pitch:6,mid:-2},treble4:{clef:"treble",pitch:8,mid:-4},treble5:{clef:"treble",pitch:10,mid:-6},perc:{clef:"perc",pitch:6,mid:0},none:{clef:"none",mid:0},bass:{clef:"bass",pitch:8,mid:-12},"bass+8":{clef:"bass+8",pitch:8,mid:-12},"bass-8":{clef:"bass-8",pitch:8,mid:-12},"bass^8":{clef:"bass+8",pitch:8,mid:-12},bass_8:{clef:"bass-8",pitch:8,mid:-12},"bass+16":{clef:"bass",pitch:8,mid:-12},"bass-16":{clef:"bass",pitch:8,mid:-12},"bass^16":{clef:"bass",pitch:8,mid:-12},bass_16:{clef:"bass",pitch:8,mid:-12},bass1:{clef:"bass",pitch:2,mid:-6},bass2:{clef:"bass",pitch:4,mid:-8},bass3:{clef:"bass",pitch:6,mid:-10},bass4:{clef:"bass",pitch:8,mid:-12},bass5:{clef:"bass",pitch:10,mid:-14},tenor:{clef:"alto",pitch:8,mid:-8},tenor1:{clef:"alto",pitch:2,mid:-2},tenor2:{clef:"alto",pitch:4,mid:-4},tenor3:{clef:"alto",pitch:6,mid:-6},tenor4:{clef:"alto",pitch:8,mid:-8},tenor5:{clef:"alto",pitch:10,mid:-10},alto:{clef:"alto",pitch:6,mid:-6},alto1:{clef:"alto",pitch:2,mid:-2},alto2:{clef:"alto",pitch:4,mid:-4},alto3:{clef:"alto",pitch:6,mid:-6},alto4:{clef:"alto",pitch:8,mid:-8},alto5:{clef:"alto",pitch:10,mid:-10},"alto+8":{clef:"alto+8",pitch:6,mid:-6},"alto-8":{clef:"alto-8",pitch:6,mid:-6},"alto^8":{clef:"alto+8",pitch:6,mid:-6},alto_8:{clef:"alto-8",pitch:6,mid:-6}},c=function(e,t){var i=o[e];return(i?i.mid:0)+t};i.fixClef=function(e){var t=o[e.type];t&&(e.clefPos=t.pitch,e.type=t.clef)},i.deepCopyKey=function(e){var t={accidentals:[],root:e.root,acc:e.acc,mode:e.mode};return e.accidentals.forEach((function(e){t.accidentals.push(Object.assign({},e))})),t};var l={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11};i.addPosToKey=function(e,t){var i=e.verticalPos;t.accidentals.forEach((function(e){var t=l[e.note];t-=i,e.verticalPos=t})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){var t=l[e.note];t-=i,e.verticalPos=t})),i<-10?(t.accidentals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,(e.verticalPos>=11||10===e.verticalPos&&"flat"===e.acc)&&(e.verticalPos-=7),"A"===e.note&&"sharp"===e.acc&&(e.verticalPos-=7),"G"!==e.note&&"F"!==e.note||"flat"!==e.acc||(e.verticalPos-=7)}))):i<-4?(t.accidentals.forEach((function(e){e.verticalPos-=7,-8!==i||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos-=7,-8!==i||"f"!==e.note&&"g"!==e.note||"sharp"!==e.acc||(e.verticalPos-=7)}))):i>=7&&(t.accidentals.forEach((function(e){e.verticalPos+=7})),t.impliedNaturals&&t.impliedNaturals.forEach((function(e){e.verticalPos+=7})))},i.fixKey=function(e,t){var n=Object.assign({},t);return i.addPosToKey(e,n),n};var h=function(e){var t=0,i=e[t++];"^"!==i&&"_"!==i||(i=e[t++]);var n=l[i];for(void 0===n&&(n=6);t<e.length;t++)if(","===e[t])n-=7;else{if("'"!==e[t])break;n+=7}return{mid:n-6,str:e.substring(t)}};i.parseKey=function(t,a){0===t.length&&(t="none");var o=n.tokenize(t,0,t.length),l={};if(0===o.length)return r("Must pass in key signature.",t,0),l;switch(o[0].token){case"HP":e.addDirective("bagpipes"),s.key={root:"HP",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"Hp":e.addDirective("bagpipes"),s.key={root:"Hp",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}],acc:"",mode:""},l.foundKey=!0,o.shift();break;case"none":s.key={root:"none",accidentals:[],acc:"",mode:""},l.foundKey=!0,o.shift();break;default:var h=n.getKeyPitch(o[0].token);if(h.len>0){l.foundKey=!0;var u="",d="";o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift();var p=h.token;if(o.length>0){var f=n.getSharpFlat(o[0].token);if(f.len>0&&(o[0].token.length>1?o[0].token=o[0].token.substring(1):o.shift(),p+=f.token,u=f.token),o.length>0){var m=n.getMode(o[0].token);m.len>0&&(o.shift(),p+=m.token,d=m.token)}if(void 0===i.standardKey(p,h.token,u,0))return r("Unsupported key signature: "+p,t,0),l}var g,v=i.deepCopyKey(s.key),b=!a&&s.globalTranspose?-s.globalTranspose:0;if(a&&(g=s.globalTransposeOrigKeySig),s.key=i.deepCopyKey(i.standardKey(p,h.token,u,b)),a&&(s.globalTransposeOrigKeySig=g),s.key.mode=d,v){for(var y,_=0;_<s.key.accidentals.length;_++)for(y=0;y<v.accidentals.length;y++)v.accidentals[y].note&&s.key.accidentals[_].note.toLowerCase()===v.accidentals[y].note.toLowerCase()&&(v.accidentals[y].note=null);for(y=0;y<v.accidentals.length;y++)v.accidentals[y].note&&(s.key.impliedNaturals||(s.key.impliedNaturals=[]),s.key.impliedNaturals.push({acc:"natural",note:v.accidentals[y].note}))}}}if(0===o.length)return l;if("exp"===o[0].token&&o.shift(),0===o.length)return l;if("oct"===o[0].token&&o.shift(),0===o.length)return l;var w,x=n.getKeyAccidentals2(o);if(x.warn&&r(x.warn,t,0),x.accs){l.foundKey||(l.foundKey=!0,s.key={root:"none",acc:"",mode:"",accidentals:[]}),function(e){for(var t=0;t<e.length;t++)"b"===e[t].note?e[t].note="B":"a"===e[t].note?e[t].note="A":"F"===e[t].note?e[t].note="f":"E"===e[t].note?e[t].note="e":"D"===e[t].note?e[t].note="d":"C"===e[t].note?e[t].note="c":"G"===e[t].note&&"sharp"===e[t].acc?e[t].note="g":"g"===e[t].note&&"flat"===e[t].acc&&(e[t].note="G")}(x.accs);for(var k=0;k<x.accs.length;k++){for(var C=!1,S=0;S<s.key.accidentals.length&&!C;S++)s.key.accidentals[S].note===x.accs[k].note&&(C=!0,s.key.accidentals[S].acc!==x.accs[k].acc&&(s.key.accidentals[S].acc=x.accs[k].acc,s.key.explicitAccidentals||(s.key.explicitAccidentals=[]),s.key.explicitAccidentals.push(x.accs[k])));if(!C&&(s.key.explicitAccidentals||(s.key.explicitAccidentals=[]),s.key.explicitAccidentals.push(x.accs[k]),s.key.accidentals.push(x.accs[k]),s.key.impliedNaturals))for(var M=0;M<s.key.impliedNaturals.length;M++)s.key.impliedNaturals[M].note===x.accs[k].note&&s.key.impliedNaturals.splice(M,1)}}for(;o.length>0;)switch(o[0].token){case"m":case"middle":if(o.shift(),0===o.length)return r("Expected = after middle",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after middle",t,w.start);break}if(0===o.length)return r("Expected parameter after middle=",t,0),l;var E=n.getPitchFromTokens(o);E.warn&&r(E.warn,t,0),E.position&&(s.clef.verticalPos=E.position-6);break;case"transpose":if(o.shift(),0===o.length)return r("Expected = after transpose",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after transpose",t,w.start);break}if(0===o.length)return r("Expected parameter after transpose=",t,0),l;if("number"!==o[0].type){r("Expected number after transpose",t,o[0].start);break}s.clef.transpose=o[0].intt,o.shift();break;case"stafflines":if(o.shift(),0===o.length)return r("Expected = after stafflines",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after stafflines",t,w.start);break}if(0===o.length)return r("Expected parameter after stafflines=",t,0),l;if("number"!==o[0].type){r("Expected number after stafflines",t,o[0].start);break}s.clef.stafflines=o[0].intt,o.shift();break;case"staffscale":if(o.shift(),0===o.length)return r("Expected = after staffscale",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after staffscale",t,w.start);break}if(0===o.length)return r("Expected parameter after staffscale=",t,0),l;if("number"!==o[0].type){r("Expected number after staffscale",t,o[0].start);break}s.clef.staffscale=o[0].floatt,o.shift();break;case"octave":if(o.shift(),0===o.length)return r("Expected = after octave",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after octave",t,w.start);break}if(0===o.length)return r("Expected parameter after octave=",t,0),l;if("number"!==o[0].type){r("Expected number after octave",t,o[0].start);break}s.octave=o[0].intt,o.shift();break;case"style":if(o.shift(),0===o.length)return r("Expected = after style",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after style",t,w.start);break}if(0===o.length)return r("Expected parameter after style=",t,0),l;switch(o[0].token){case"normal":case"harmonic":case"rhythm":case"x":case"triangle":s.style=o[0].token,o.shift();break;default:r("error parsing style element: "+o[0].token,t,o[0].start)}break;case"clef":if(o.shift(),0===o.length)return r("Expected = after clef",t,0),l;if("="!==(w=o.shift()).token){r("Expected = after clef",t,w.start);break}if(0===o.length)return r("Expected parameter after clef=",t,0),l;case"treble":case"bass":case"alto":case"tenor":case"perc":case"none":var T=o.shift();switch(T.token){case"treble":case"tenor":case"alto":case"bass":case"perc":case"none":break;case"C":case"c":T.token="alto";break;case"F":case"f":T.token="bass";break;case"G":case"g":T.token="treble";break;default:r("Expected clef name. Found "+T.token,t,T.start)}o.length>0&&"number"===o[0].type&&(T.token+=o[0].token,o.shift()),o.length>1&&("-"===o[0].token||"+"===o[0].token||"^"===o[0].token||"_"===o[0].token)&&"8"===o[1].token&&(T.token+=o[0].token+o[1].token,o.shift(),o.shift()),s.clef={type:T.token,verticalPos:c(T.token,0)},s.currentVoice&&void 0!==s.currentVoice.transpose&&(s.clef.transpose=s.currentVoice.transpose),l.foundClef=!0;break;default:r("Unknown parameter: "+o[0].token,t,o[0].start),o.shift()}return l},i.parseVoice=function(e,t,i){var o=n.getMeat(e,t,i),l=o.start,u=o.end,d=n.getToken(e,l,u);if(0!==d.length){var p=!1;void 0===s.voices[d]&&(s.voices[d]={},p=!0,s.score_is_present&&r("Can't have an unknown V: id when the %score directive is present",e,l)),l+=d.length,l+=n.eatWhiteSpace(e,l);for(var f={startStaff:p},m=function(t){var i=n.getVoiceToken(e,l,u);void 0!==i.warn?r("Expected value for "+t+" in voice: "+i.warn,e,l):void 0!==i.err?r("Expected value for "+t+" in voice: "+i.err,e,l):0===i.token.length&&'"'!==e[l]?r("Expected value for "+t+" in voice",e,l):f[t]=i.token,l+=i.len},g=function(t,i,a){var o=n.getVoiceToken(e,l,u);void 0!==o.warn?r("Expected value for "+i+" in voice: "+o.warn,e,l):void 0!==o.err?r("Expected value for "+i+" in voice: "+o.err,e,l):0===o.token.length&&'"'!==e[l]?r("Expected value for "+i+" in voice",e,l):(o.token=parseFloat(o.token),s.voices[t][i]=o.token),l+=o.len},v=function(t,i){var s=n.getVoiceToken(e,l,u);if(void 0!==s.warn)r("Expected value for "+t+" in voice: "+s.warn,e,l);else if(void 0!==s.err)r("Expected value for "+t+" in voice: "+s.err,e,l);else{if(0!==s.token.length||'"'===e[l])return s.token;r("Expected value for "+t+" in voice",e,l)}l+=s.len},b=function(t,i){var a=n.getVoiceToken(e,l,u);if(void 0!==a.warn)r("Expected one of (_B, _E, _b, _e) for "+i+" in voice: "+a.warn,e,l);else if(0===a.token.length&&'"'!==e[l])r("Expected one of (_B, _E, _b, _e) for "+i+" in voice",e,l);else{var o={_B:2,_E:9,_b:-10,_e:-3}[a.token];o?s.voices[t][i]=o:r("Expected one of (_B, _E, _b, _e) for "+i+" in voice",e,l)}l+=a.len};l<u;){var y=n.getVoiceToken(e,l,u);if(l+=y.len,y.warn)r("Error parsing voice: "+y.warn,e,l);else{var _=null;switch(y.token){case"clef":case"cl":m("clef");var w=0;void 0!==f.clef&&(f.clef=f.clef.replace(/[',]/g,""),-1!==f.clef.indexOf("+16")&&(w+=14,f.clef=f.clef.replace("+16","")),f.verticalPos=c(f.clef,w));break;case"treble":case"bass":case"tenor":case"alto":case"perc":case"none":case"treble'":case"bass'":case"tenor'":case"alto'":case"none'":case"treble''":case"bass''":case"tenor''":case"alto''":case"none''":case"treble,":case"bass,":case"tenor,":case"alto,":case"none,":case"treble,,":case"bass,,":case"tenor,,":case"alto,,":case"none,,":f.clef=y.token.replace(/[',]/g,""),f.verticalPos=c(f.clef,0),s.voices[d].clef=y.token;break;case"staves":case"stave":case"stv":m("staves");break;case"brace":case"brc":m("brace");break;case"bracket":case"brk":m("bracket");break;case"name":case"nm":m("name");break;case"subname":case"sname":case"snm":m("subname");break;case"merge":f.startStaff=!1;break;case"stem":case"stems":void 0!==(_=n.getVoiceToken(e,l,u)).warn?r("Expected value for stems in voice: "+_.warn,e,l):void 0!==_.err?r("Expected value for stems in voice: "+_.err,e,l):"up"===_.token||"down"===_.token?s.voices[d].stem=_.token:r("Expected up or down for voice stem",e,l),l+=_.len;break;case"up":case"down":s.voices[d].stem=y.token;break;case"middle":case"m":m("verticalPos"),f.verticalPos=h(f.verticalPos).mid;break;case"gchords":case"gch":s.voices[d].suppressChords=!0,"0"===(_=n.getVoiceToken(e,l,u)).token&&(l+=_.len);break;case"space":case"spc":m("spacing");break;case"scale":g(d,"scale");break;case"score":b(d,"scoreTranspose");break;case"transpose":g(d,"transpose");break;case"stafflines":g(d,"stafflines");break;case"staffscale":g(d,"staffscale");break;case"octave":g(d,"octave");break;case"volume":g(d,"volume");break;case"cue":var x=v("cue");s.voices[d].scale="on"===x?.6:1;break;case"style":void 0!==(_=n.getVoiceToken(e,l,u)).warn?r("Expected value for style in voice: "+_.warn,e,l):void 0!==_.err?r("Expected value for style in voice: "+_.err,e,l):"normal"===_.token||"harmonic"===_.token||"rhythm"===_.token||"x"===_.token||"triangle"===_.token?s.voices[d].style=_.token:r("Expected one of [normal, harmonic, rhythm, x, triangle] for voice style",e,l),l+=_.len}}l+=n.eatWhiteSpace(e,l)}if((f.startStaff||0===s.staves.length)&&(s.staves.push({index:s.staves.length,meter:s.origMeter}),s.score_is_present||(s.staves[s.staves.length-1].numVoices=0)),void 0===s.voices[d].staffNum){s.voices[d].staffNum=s.staves.length-1;var k=0;for(var C in s.voices)s.voices.hasOwnProperty(C)&&s.voices[C].staffNum===s.voices[d].staffNum&&k++;s.voices[d].index=k-1}var S=s.staves[s.voices[d].staffNum];return s.score_is_present||S.numVoices++,f.clef&&(S.clef={type:f.clef,verticalPos:f.verticalPos}),f.spacing&&(S.spacing_below_offset=f.spacing),f.verticalPos&&(S.verticalPos=f.verticalPos),f.name&&(S.name?S.name.push(f.name):S.name=[f.name]),f.subname&&(S.subname?S.subname.push(f.subname):S.subname=[f.subname]),function(e){var t=s.voices[e];if(!s.currentVoice||s.currentVoice.index!==t.index||s.currentVoice.staffNum!==t.staffNum)return s.currentVoice=t,a.setCurrentVoice(t.staffNum,t.index,e)}(d)}r("Expected a voice id",e,l)}}(),So=i}var zo,Vo,qo,Fo,jo,Ho,Go,Uo,Wo,Yo,$o,Ko,Xo,Qo,Zo,Jo,ec,tc,ic,nc,rc,sc,ac,oc,cc,lc,hc,uc,dc,pc,fc,mc,gc,vc,bc,yc,_c,wc,xc,kc,Cc,Sc,Mc,Ec,Tc,Pc,Ac,Ic,Nc,Lc,Oc,Bc,Dc,Rc,zc,Vc,qc,Fc,jc,Hc,Gc,Uc,Wc,Yc,$c,Kc,Xc,Qc,Zc,Jc,el,tl,il,nl,rl,sl,al,ol,cl,ll,hl,ul,dl,pl,fl,ml,gl,vl,bl,yl,_l,wl,xl,kl,Cl,Sl,Ml,El,Tl,Pl,Al,Il,Nl,Ll,Ol,Bl,Dl,Rl,zl,Vl,ql,Fl,jl,Hl,Gl,Ul,Wl,Yl,$l,Kl,Xl,Ql,Zl,Jl,eh,th,ih,nh,rh,sh,ah,oh,ch,lh,hh,uh,dh,ph,fh,mh,gh,vh,bh,yh,_h,wh,xh,kh,Ch,Sh,Mh,Eh,Th,Ph,Ah,Ih,Nh,Lh,Oh,Bh,Dh,Rh,zh,Vh,qh,Fh,jh,Hh,Gh,Uh,Wh,Yh,$h,Kh,Xh,Qh,Zh,Jh,eu,tu,iu,nu,ru,su,au,ou,cu,lu,hu,uu,du,pu,fu,mu,gu,vu,bu,yu,_u,wu,xu,ku,Cu,Su,Mu,Eu,Tu,Pu,Au,Iu,Nu,Lu,Ou,Bu,Du,Ru,zu,Vu,qu,Fu,ju,Hu,Gu,Uu,Wu,Yu,$u,Ku,Xu,Qu,Zu,Ju,ed,td,id,nd,rd,sd,ad,od,cd,ld,hd,ud,dd,pd,fd,md,gd,vd,bd,yd,_d,wd,xd,kd,Cd,Sd,Md,Ed,Td,Pd,Ad,Id,Nd,Ld,Od,Bd,Dd,Rd={};function zd(){if(Go)return Ho;function e(e,t){for(var i=[],n=[],r=0,s=0;s<e.length;s++){var a=e[s],o=r+a;o<t?r=o:t-r<o-t&&r>0?(i.push(s-1),n.push(Math.round(r-a)),r=a):s<e.length-1&&(i.push(s),n.push(Math.round(r)),r=0)}return n.push(Math.round(r)),{lineBreaks:i,totals:n}}function t(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t}function i(e,i,n,r,s,a,o,c,l,h,u){for(var d=h;d<e.length;d++){var p=e[d];n+=p,r+=p;var f=Math.abs(n-i[c]);if(Math.abs(f-a)<i[0]/10)if(f<a){var m=t(s),g=t(l);g.push(d-1),m.push(r-p),u.push({accumulator:n,lineAccumulator:p,lineWidths:m,lastVariance:Math.abs(n-i[c+1]),highestVariance:Math.max(o,a),currLine:c+1,lineBreaks:g,startIndex:d+1})}else f>a&&d<e.length-1&&(m=t(s),g=t(l),u.push({accumulator:n,lineAccumulator:r,lineWidths:m,lastVariance:f,highestVariance:Math.max(o,f),currLine:c,lineBreaks:g,startIndex:d+1}));f>a?(l.push(d-1),c++,o=Math.max(o,a),a=Math.abs(n-i[c]),s.push(r-p),r=p):a=f}s.push(r)}function n(e,t,n,r){for(var s=Math.ceil(e.total/t),a=Math.floor(e.total/s),o=[],c=0;c<s;c++)o.push(a*(c+1));var l=[];l.push({accumulator:0,lineAccumulator:0,lineWidths:[],lastVariance:999999,highestVariance:0,currLine:0,lineBreaks:[],startIndex:0});for(var h=0;h<l.length;)i(e.measureWidths,o,l[h].accumulator,l[h].lineAccumulator,l[h].lineWidths,l[h].lastVariance,l[h].highestVariance,l[h].currLine,l[h].lineBreaks,l[h].startIndex,l),h++;for(c=0;c<l.length;c++){var u=l[c];u.variances=[],u.aveVariance=0;for(var d=0;d<u.lineWidths.length;d++){var p=u.lineWidths[d];u.variances.push(p-o[0]),u.aveVariance+=Math.abs(p-o[0])}u.aveVariance=u.aveVariance/u.lineWidths.length,r.attempts.push({type:"optimizeLineWidths",lineBreaks:u.lineBreaks,variances:u.variances,aveVariance:u.aveVariance,widths:e.measureWidths})}var f=9999999,m=-1;for(c=0;c<l.length;c++)(u=l[c]).aveVariance<f&&(f=u.aveVariance,m=c);return{failed:!1,lineBreaks:l[m].lineBreaks,variance:l[m].highestVariance}}function r(e,t,i){for(var n=[],r=[],s=0,a=!1,o=0;o<e.length;o++)(s+=e[o])>t&&(a=!0),o%i==i-1&&(o!==e.length-1&&n.push(o),r.push(Math.round(s)),s=0);return{failed:a,totals:r,lineBreaks:n}}return Go=1,Ho={wrapLines:function(e,t,i){if(t&&0!==e.lines.length){var n=e.deline({lineBreaks:!1}),r=function(e,t){for(var i=[],n=0,r=0,s=0,a=0;a<e.length;a++){var o=e[a];if(o.staff){var c=r,l=t[n];n++;for(var h=0;h<o.staff.length;h++)for(var u=o.staff[h],d=0;d<u.voices.length;d++){s=c;for(var p=0,f=0,m=u.voices[d],g=0,v=0;v<m.length;v++)"bar"===m[v].el_type&&(l[f]===p&&(i.push({ogLine:a,line:s,staff:h,voice:d,start:g,end:v}),g=v+1,s++,r=Math.max(r,s),f++),p++);i.push({ogLine:a,line:s,staff:h,voice:d,start:g,end:m.length}),s++,r=Math.max(r,s)}}else i.push({ogLine:a,line:s}),s++,r=Math.max(r,s)}return i}(n,t);e.lines=function(e,t,i){for(var n=[],r=[],s=[],a=1,o=0;o<t.length;o++){var c=t[o];if(e[c.ogLine].staff){var l=e[c.ogLine].staff[c.staff];if(n[c.line]||(n[c.line]={staff:[]}),!n[c.line].staff[c.staff]){n[c.line].staff[c.staff]={voices:[]},void 0!==i&&0===c.staff&&c.line>0&&(n[c.line].staff[c.staff].barNumber=a);for(var h=Object.keys(l),u=0;u<h.length;u++){var d="voices"===h[u];"meter"===h[u]&&0!==c.line&&(d=!0),d||(n[c.line].staff[c.staff][h[u]]=l[h[u]])}r[c.staff]&&(n[c.line].staff[c.staff].key=r[c.staff])}n[c.line].staff[c.staff].voices[c.voice]||(n[c.line].staff[c.staff].voices[c.voice]=[]),n[c.line].staff[c.staff].voices[c.voice]=e[c.ogLine].staff[c.staff].voices[c.voice].slice(c.start,c.end+1),s[10*c.staff+c.voice]&&n[c.line].staff[c.staff].voices[c.voice].unshift({el_type:"stem",direction:s[10*c.staff+c.voice].direction});for(var p=n[c.line].staff[c.staff].voices[c.voice],f=p.length-1;f>=0;f--)if("key"===p[f].el_type){r[c.staff]={root:p[f].root,acc:p[f].acc,mode:p[f].mode,accidentals:p[f].accidentals.filter((function(e){return"natural"!==e.acc}))};break}for(f=p.length-1;f>=0;f--)if("stem"===p[f].el_type){s[10*c.staff+c.voice]={direction:p[f].direction};break}if(void 0!==i&&0===c.staff&&0===c.voice)for(f=0;f<p.length;f++)"bar"===p[f].el_type&&(a++,f===p.length-1?delete p[f].barNumber:p[f].barNumber=a)}else n[c.line]=e[c.ogLine]}for(var m=0;m<n.length;m++)n[m].staff&&(n[m].staff=n[m].staff.filter((function(e){return null!=e})));return n}(n,r,i),e.lineBreaks=r}},calcLineWraps:function(t,i,s){if(0===i.length||s.staffwidth<i[0].left)return{reParse:!1,explanation:"Staff width is narrower than the margin",revisedParams:s};var a=s.scale?Math.max(s.scale,.1):1,o=s.wrap.minSpacing?Math.max(parseFloat(s.wrap.minSpacing),1):1,c=s.wrap.minSpacingLimit?Math.max(parseFloat(s.wrap.minSpacingLimit),1):o-.1,l=s.wrap.maxSpacing?Math.max(parseFloat(s.wrap.maxSpacing),1):void 0;s.wrap.lastLineLimit&&!l&&(l=Math.max(parseFloat(s.wrap.lastLineLimit),1));for(var h=s.wrap.preferredMeasuresPerLine?Math.max(parseInt(s.wrap.preferredMeasuresPerLine,10),0):void 0,u=[],d=[],p=0;p<i.length;p++){var f=i[p],m=s.staffwidth-f.left,g=m/o/a,v=m/c/a,b={widths:f,lineBreakPoint:g,minLineSize:m/l/a,attempts:[],staffWidth:s.staffwidth,minWidth:Math.round(v)},y=null;if(h){var _=r(f.measureWidths,g,h);b.attempts.push({type:"Fixed Measures Per Line",preferredMeasuresPerLine:h,lineBreaks:_.lineBreaks,failed:_.failed,totals:_.totals}),_.failed||(y=_.lineBreaks)}if(!y){var w=e(f.measureWidths,g);b.attempts.push({type:"Free Form",lineBreaks:w.lineBreaks,totals:w.totals}),(y=w.lineBreaks).length>0&&f.measureWidths.length<25&&(w=n(f,g,0,b),b.attempts.push({type:"Optimize",failed:w.failed,reason:w.reason,lineBreaks:w.lineBreaks,totals:w.totals}),w.failed||(y=w.lineBreaks))}u.push(y),d.push(b)}var x=function(e,t,i){var n={lineBreaks:e,staffwidth:t};for(var r in i)i.hasOwnProperty(r)&&"wrap"!==r&&"staffwidth"!==r&&(n[r]=i[r]);return{revisedParams:n}}(u,s.staffwidth,s);return x.explanation=d,x.reParse=!0,x}}}function Vd(){if(Wo)return Uo;Wo=1;var e={FONTEM:360,FONTSIZE:30};return e.STEP=93*e.FONTSIZE/720,e.SPACE=10,e.TOPNOTE=15,e.STAVEHEIGHT=100,e.INDENT=50,Uo=e}function qd(){if($o)return Yo;var e;$o=1;var t=Io();return function(){var i=1,n=128;function r(e,t,i){for(var n=0,r=t+1;r<e.length;r++)if("note"===e[r].el_type&&n++,e[r].decoration&&e[r].decoration.indexOf(i)>=0)return n;return n}function s(e,t,i){for(var n=Math.min(e.length,t+3),r=t;r<n;r++)if("note"===e[r].el_type&&e[r].decoration)for(var s=0;s<e[r].decoration.length;s++)if(i.indexOf(e[r].decoration[s])>=0)return e[r].decoration[s];return null}function a(e){for(var t=0;t<e.length;t++)for(var i=e[t],n=i.length-1;n>=0&&"bar"!==i[n].el_type;)i[n].noChordVoice=!0,n--}function o(e,t){if(e&&!(e.length<=t)&&e[t].title)return e[t].title.join(" ")}function c(e,t){var i=1/4;e.duration&&(i=e.duration[0]);var n=60;return e.bpm&&(n=e.bpm),i*n/t}function l(e){var t;switch(e.type){case"common_time":t={el_type:"meter",num:4,den:4};break;case"cut_time":t={el_type:"meter",num:2,den:2};break;case"specified":t={el_type:"meter",num:e.value[0].num,den:e.value[0].den};break;default:t={el_type:"meter"}}return i=t.num/t.den,t}function h(e){for(var t=[],i=0;i<e.length;i++)"natural"!==e[i].acc&&t.push(e[i]);return t}function u(e,t){p(e,"HP"===t.root?{el_type:"key",accidentals:[{acc:"natural",note:"g"},{acc:"sharp",note:"f"},{acc:"sharp",note:"c"}]}:{el_type:"key",accidentals:h(t.accidentals)})}function d(e,t){p(e,l(t))}function p(e,t){for(var i=e.length-1;i>=0;i--)if(e[i].el_type===t.el_type)return void(JSON.stringify(e[i])!==JSON.stringify(t)&&e.push(t));e.push(t)}e=function(e,h){var f,m=(h=h||{}).program||0,g=h.midiTranspose||0;e.visualTranspose&&(g-=e.visualTranspose);var v=h.channel||0,b=!1,y=h.drum||"",_=h.drumBars||1,w=h.drumIntro||0,x=""!==y,k=!!h.drumOff,C=[];m=parseInt(m,10),g=parseInt(g,10),10===(v=parseInt(v,10))&&(m=n),y=y.split(" "),_=parseInt(_,10),w=parseInt(w,10);var S=e.formatting.bagpipes;S&&(m=71);var M=[];if(e.formatting.midi){var E=e.formatting.midi;E.program&&E.program.length>0&&(m=E.program[0],E.program.length>1&&(m=E.program[1],v=E.program[0]),b=!0),E.transpose&&(g=E.transpose[0]),E.channel&&(v=E.channel[0],b=!0),E.drum&&(y=E.drum),E.drumbars&&(_=E.drumbars[0]),E.drumon&&(x=!0),10===v&&(m=n),E.beat&&M.push({el_type:"beat",beats:E.beat}),E.nobeataccents&&M.push({el_type:"beataccents",value:!1})}f=h.qpm?parseInt(h.qpm,10):e.metaText.tempo?c(e.metaText.tempo,e.getBeatLength()):h.defaultQpm?h.defaultQpm:180;var T=[];S&&T.push({el_type:"bagpipes"}),T.push({el_type:"instrument",program:m}),v&&T.push({el_type:"channel",channel:v}),g&&T.push({el_type:"transpose",transpose:g}),T.push({el_type:"tempo",qpm:f});for(var P=0;P<M.length;P++)T.push(M[P]);var A,I=[],N=[],L=[],O=[0],B={};B[0]={el_type:"tempo",qpm:f,timing:0};for(var D=[],R=[],z=!1,V=e.lines,q=0;q<V.length;q++){var F=V[q];if(F.staff){let i=function(e){var t,i={pppp:[15,10,5,1],ppp:[30,20,10,1],pp:[45,35,20,1],p:[60,50,35,1],mp:[75,65,50,1],mf:[90,80,65,1],f:[105,95,80,1],ff:[120,110,95,1],fff:[127,125,110,1],ffff:[127,125,110,1]};if(e.decoration)if(e.decoration.indexOf("pppp")>=0?t="pppp":e.decoration.indexOf("ppp")>=0?t="ppp":e.decoration.indexOf("pp")>=0?t="pp":e.decoration.indexOf("p")>=0?t="p":e.decoration.indexOf("mp")>=0?t="mp":e.decoration.indexOf("mf")>=0?t="mf":e.decoration.indexOf("f")>=0?t="f":e.decoration.indexOf("ff")>=0?t="ff":e.decoration.indexOf("fff")>=0?t="fff":e.decoration.indexOf("ffff")>=0&&(t="ffff"),t&&(A=i[t].slice(0),I[H].push({el_type:"beat",beats:A.slice(0)}),N[W]=!1,L[W]=!1),e.decoration.indexOf("crescendo(")>=0){var n=r(Y,ee,"crescendo)"),a=Math.min(127,A[0]+50),o=s(Y,ee+n+1,Object.keys(i));o&&(a=i[o][0]),N[W]=n>0&&Math.floor((a-A[0])/n),L[W]=!1}else if(e.decoration.indexOf("crescendo)")>=0)N[W]=!1;else if(e.decoration.indexOf("diminuendo(")>=0){var c=r(Y,ee,"diminuendo)"),l=Math.max(15,A[0]-50),h=s(Y,ee+c+1,Object.keys(i));h&&(l=i[h][0]),N[W]=!1,L[W]=c>0&&Math.floor((l-A[0])/c)}else e.decoration.indexOf("diminuendo)")>=0&&(L[W]=!1)};for(var j=F.staff,H=0,G=0;G<j.length;G++){var U=j[G];if(!U.clef||"TAB"!==U.clef.type)for(var W=0;W<U.voices.length;W++){var Y=U.voices[W];if(!I[H]){I[H]=[].concat(JSON.parse(JSON.stringify(T)));var $=o(F.staff,H);$&&I[H].unshift({el_type:"name",trackName:$})}if(g&&"perc"===U.clef.type&&I[H].push({el_type:"transpose",transpose:0}),U.clef&&"perc"===U.clef.type&&!b)for(var K=0;K<I[H].length;K++)"instrument"===I[H][K].el_type&&(I[H][K].program=n);else U.key&&u(I[H],U.key);U.meter&&d(I[H],U.meter),!z&&x&&(I[H].push({el_type:"drum",params:{pattern:y,bars:_,on:x,intro:w}}),z=!0),U.clef&&"perc"!==U.clef.type&&U.clef.transpose&&(U.clef.el_type="clef",I[H].push({el_type:"transpose",transpose:U.clef.transpose})),U.clef&&U.clef.type&&(U.clef.type.indexOf("-8")>=0?I[H].push({el_type:"transpose",transpose:-12}):U.clef.type.indexOf("+8")>=0&&I[H].push({el_type:"transpose",transpose:12})),e.formatting.midi&&e.formatting.midi.drumoff&&(I[H].push({el_type:"bar"}),I[H].push({el_type:"drum",params:{pattern:"",on:!1}}));var X=0,Q=0,Z=0,J=0;A=[105,95,85,1];for(var ee=0;ee<Y.length;ee++){var te=Y[ee];switch(te.el_type){case"note":if(N[W]&&(A[0]+=N[W],A[1]+=N[W],A[2]+=N[W],I[H].push({el_type:"beat",beats:A.slice(0)})),L[W]&&(A[0]+=L[W],A[1]+=L[W],A[2]+=L[W],I[H].push({el_type:"beat",beats:A.slice(0)})),i(te),!te.rest||"spacer"!==te.rest.type){var ie={elem:te,el_type:"note",timing:O[H]};if(te.style?ie.style=te.style:C[H]&&(ie.style=C[H]),ie.duration=0===te.duration?.25:te.duration,te.startTriplet){if(Q=te.tripletMultiplier,Z=te.startTriplet*Q*te.duration,te.startTriplet!==te.tripletR&&ee+te.tripletR<=Y.length){for(var ne=0,re=ee;re<ee+te.tripletR;re++)ne+=Y[re].duration;Z=Q*ne}ie.duration=ie.duration*Q,ie.duration=Math.round(1e6*ie.duration)/1e6,J=ie.duration}else Q&&(te.endTriplet?(Q=0,ie.duration=Math.round(1e6*(Z-J))/1e6):(ie.duration=ie.duration*Q,ie.duration=Math.round(1e6*ie.duration)/1e6,J+=ie.duration));te.rest&&(ie.rest=te.rest),te.decoration&&(ie.decoration=te.decoration.slice(0)),te.pitches&&(ie.pitches=t.cloneArray(te.pitches)),te.gracenotes&&(ie.gracenotes=t.cloneArray(te.gracenotes)),te.chord&&(ie.chord=t.cloneArray(te.chord)),I[H].push(ie),"rhythm"===te.style&&a(I),X++,O[H]+=ie.duration}break;case"key":case"keySignature":u(I[H],te);break;case"meter":d(I[H],te);break;case"clef":te.transpose&&I[H].push({el_type:"transpose",transpose:te.transpose}),te.type&&(te.type.indexOf("-8")>=0?I[H].push({el_type:"transpose",transpose:-12}):te.type.indexOf("+8")>=0&&I[H].push({el_type:"transpose",transpose:12}));break;case"tempo":f=c(te,e.getBeatLength()),I[H].push({el_type:"tempo",qpm:f,timing:O[H]}),B[""+O[H]]={el_type:"tempo",qpm:f,timing:O[H]};break;case"bar":X>0&&I[H].push({el_type:"bar"}),i(te),X=0;var se="bar_right_repeat"===te.type||"bar_dbl_repeat"===te.type,ae="1"===te.startEnding,oe="bar_left_repeat"===te.type||"bar_dbl_repeat"===te.type||"bar_right_repeat"===te.type;if(se){var ce=D[H];ce||(ce=0);var le=R[H];le||(le=I[H].length);for(var he=ce;he<le;he++){var ue=Object.assign({},I[H][he]);ue.pitches&&(ue.pitches=t.cloneArray(ue.pitches)),I[H].push(ue)}R[H]=void 0,D[H]=void 0}ae&&(R[H]=I[H].length),oe&&(D[H]=I[H].length);break;case"style":C[H]=te.head;break;case"timeSignature":I[H].push(l(te));break;case"part":case"stem":case"scale":case"break":case"font":break;case"midi":var de=!1;switch(te.cmd){case"drumon":x=!0,de=!0;break;case"drumoff":x=!1,de=!0;break;case"drum":y=te.params,de=!0;break;case"drumbars":_=te.params[0],de=!0;break;case"drummap":break;case"channel":10===te.params[0]&&I[H].push({el_type:"instrument",program:n});break;case"program":p(I[H],{el_type:"instrument",program:te.params[0]}),b=!0;break;case"transpose":I[H].push({el_type:"transpose",transpose:te.params[0]});break;case"gchordoff":I[H].push({el_type:"gchordOn",tacet:!0});break;case"gchordon":I[H].push({el_type:"gchordOn",tacet:!1});break;case"beat":I[H].push({el_type:"beat",beats:te.params});break;case"nobeataccents":I[H].push({el_type:"beataccents",value:!1});break;case"beataccents":I[H].push({el_type:"beataccents",value:!0});break;case"vol":case"volinc":I[H].push({el_type:te.cmd,volume:te.params[0]});break;case"swing":case"gchord":case"bassvol":case"chordvol":case"gchordbars":I[H].push({el_type:te.cmd,param:te.params[0]});break;case"bassprog":case"chordprog":I[H].push({el_type:te.cmd,value:te.params[0],octaveShift:te.params[1]});break;default:console.log("MIDI seq: midi cmd not handled: ",te.cmd,te)}de&&(I[0].push({el_type:"drum",params:{pattern:y,bars:_,intro:w,on:x}}),z=!0);break;default:console.log("MIDI: element type "+te.el_type+" not handled.")}}O[++H]||(O[H]=0)}}}}if(function(e,t){if(t&&0!==t.length)for(var i=Object.keys(t),n=0;n<e.length;n++)for(var r=e[n],s=t[0]?t[0].qpm:0,a=0;a<r.length;a++){var o=r[a];"tempo"===o.el_type&&(s=o.qpm),i.indexOf(""+o.timing)>=0&&s!==t[""+o.timing].qpm&&(s=t[""+o.timing].qpm,"tempo"===o.el_type?(o.qpm=t[""+o.timing].qpm,a++):(e[n].splice(a,0,{el_type:"tempo",qpm:t[""+o.timing].qpm,timing:o.timing}),a+=2))}}(I,B),w)for(var pe=e.getPickupLength(),fe=0;fe<I.length;fe++){for(var me=0;"note"!==I[fe][me].el_type&&I[fe].length>me;)me++;if(I[fe].length>me){for(re=0;re<w;re++)0===pe||re<w-1?(I[fe].splice(me,0,{el_type:"note",rest:{type:"rest"},duration:i},{el_type:"bar"}),me+=2):I[fe].splice(me++,0,{el_type:"note",rest:{type:"rest"},duration:i-pe});k&&(x=!1,I[fe].splice(me++,0,{el_type:"drum",params:{pattern:y,bars:_,intro:w,on:x}}),k=!1)}}return I.length>0&&I[0].length>0&&(I[0][0].pickupLength=e.getPickupLength()),I}}(),Yo=e}function Fd(){if(Zo)return Qo;Zo=1;var e={f0:"_C",n0:"=C",s0:"^C",x0:"C",f1:"_D",n1:"=D",s1:"^D",x1:"D",f2:"_E",n2:"=E",s2:"^E",x2:"E",f3:"_F",n3:"=F",s3:"^F",x3:"F",f4:"_G",n4:"=G",s4:"^G",x4:"G",f5:"_A",n5:"=A",s5:"^A",x5:"A",f6:"_B",n6:"=B",s6:"^B",x6:"B",f7:"_c",n7:"=c",s7:"^c",x7:"c",f8:"_d",n8:"=d",s8:"^d",x8:"d",f9:"_e",n9:"=e",s9:"^e",x9:"e",f10:"_f",n10:"=f",s10:"^f",x10:"f",f11:"_g",n11:"=g",s11:"^g",x11:"g",f12:"_a",n12:"=a",s12:"^a",x12:"a",f13:"_b",n13:"=b",s13:"^b",x13:"b",f14:"_c'",n14:"=c'",s14:"^c'",x14:"c'",f15:"_d'",n15:"=d'",s15:"^d'",x15:"d'",f16:"_e'",n16:"=e'",s16:"^e'",x16:"e'"};return Qo=function(t){var i=(t.accidental?t.accidental[0]:"x")+t.verticalPos;return e[i]}}function jd(){if(rc)return nc;rc=1;var e=Io(),t=Vd(),i=qd(),n=function(){if(ec)return Jo;var e;ec=1;var t=function(){if(Xo)return Ko;Xo=1;var e=function(e,t,i,r){this.chordTrack=[],this.chordTrackFinished=!1,this.chordChannel=e,this.currentChords=[],this.lastChord,this.chordLastBar,this.chordsOff=!!t,this.gChordTacet=this.chordsOff,this.hasRhythmHead=!1,this.transpose=0,this.lastBarTime=0,this.meter=r,this.tempoChangeFactor=1,this.bassInstrument=i.bassprog&&i.bassprog.length>=1?i.bassprog[0]:0,this.chordInstrument=i.chordprog&&i.chordprog.length>=1?i.chordprog[0]:0,this.bassOctaveShift=i.bassprog&&2===i.bassprog.length?i.bassprog[1]:0,this.chordOctaveShift=i.chordprog&&2===i.chordprog.length?i.chordprog[1]:0,this.boomVolume=i.bassvol&&1===i.bassvol.length?i.bassvol[0]:64,this.chickVolume=i.chordvol&&1===i.chordvol.length?i.chordvol[0]:48,i.gchord&&i.gchord.length>0?this.overridePattern=n(i.gchord[0]):this.overridePattern=void 0};function t(e,t,n,r){var s=[];if(!e)return s;t.indexOf("boom")>=0?s.push(n?e.boom:e.boom2):r&&s.push(e.boom);var a=e.chick.length;if(t.indexOf("chick")>=0)for(var o=0;o<a;o++)s.push(e.chick[o]);switch(t){case"DO":s.push(e.chick[0]);break;case"MI":s.push(e.chick[1]);break;case"SOL":s.push(i(e,2));break;case"TI":s.push(i(e,3));break;case"TOP":s.push(i(e,4));break;case"do":s.push(e.chick[0]+12);break;case"mi":s.push(e.chick[1]+12);break;case"sol":s.push(i(e,2)+12);break;case"ti":s.push(i(e,3)+12);break;case"top":s.push(i(e,4)+12)}return s}function i(e,t){var i=Math.floor(t/e.chick.length);return e.chick[t%e.chick.length]+12*i}function n(e){for(var t=[],i=0;i<e.length;i++)switch(e[i]){case"z":case"2":t.push("");break;case"c":t.push("chick");break;case"b":t.push("boom&chick");break;case"f":t.push("boom");break;case"G":t.push("DO");break;case"H":t.push("MI");break;case"I":t.push("SOL");break;case"J":t.push("TI");break;case"K":t.push("TOP");break;case"g":t.push("do");break;case"h":t.push("mi");break;case"i":t.push("sol");break;case"j":t.push("ti");break;case"k":t.push("top")}return t}function r(e){return e/1e6}function s(e,t){return Math.round(e*t*1e6)/1e6}return e.prototype.setMeter=function(e){this.meter=e},e.prototype.setTempoChangeFactor=function(e){this.tempoChangeFactor=e},e.prototype.setLastBarTime=function(e){this.lastBarTime=e},e.prototype.setTranspose=function(e){this.transpose=e},e.prototype.setRhythmHead=function(e,t){this.hasRhythmHead=e;var i=[];if(e&&this.lastChord&&this.lastChord.chick)for(var n=0;n<this.lastChord.chick.length;n++){var r=Object.assign({},t.pitches[0]);r.actualPitch=this.lastChord.chick[n],i.push(r)}return i},e.prototype.barEnd=function(e){this.chordTrack.length>0&&!this.chordTrackFinished&&(this.resolveChords(this.lastBarTime,r(e.time)),this.currentChords=[]),this.chordLastBar=this.lastChord},e.prototype.gChordOn=function(e){this.chordsOff||(this.gChordTacet=e.tacet)},e.prototype.paramChange=function(e){switch(e.el_type){case"gchord":e.param&&e.param.length>0?this.overridePattern=n(e.param):this.overridePattern=void 0;break;case"bassprog":this.bassInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.bassOctaveShift=e.octaveShift:this.bassOctaveShift=0;break;case"chordprog":this.chordInstrument=e.value,null!=e.octaveShift&&null!=e.octaveShift?this.chordOctaveShift=e.octaveShift:this.chordOctaveShift=0;break;case"bassvol":this.boomVolume=e.param;break;case"chordvol":this.chickVolume=e.param;break;default:console.log("unhandled midi param",e)}},e.prototype.finish=function(){this.chordTrackEmpty()||(this.chordTrackFinished=!0)},e.prototype.addTrack=function(e){this.chordTrackEmpty()||e.push(this.chordTrack)},e.prototype.findChord=function(e){if(this.gChordTacet)return"break";if(this.chordTrackFinished||!e.chord||0===e.chord.length)return null;for(var t=0;t<e.chord.length;t++){var i=e.chord[t];if("default"===i.position)return i.name;if(this.breakSynonyms.indexOf(i.name.toLowerCase())>=0)return"break"}return null},e.prototype.interpretChord=function(e){if(0!==e.length){if("break"===e)return{chick:[]};var t=e.substring(0,1);if("("===t){if(0===(e=e.substring(1,e.length-2)).length)return;t=e.substring(0,1)}var i=this.basses[t];if(i){for(var n=this.transpose;n<-8;)n+=12;for(;n>8;)n-=12;(i+=n)<33?i+=12:i>44&&(i-=12);var r,s=i,a=(i+=12*this.bassOctaveShift)-5;1===e.length&&(r=this.chordNotes(i,""));var o=e.substring(1),c=o.substring(0,1);"b"===c||"♭"===c?(s--,i--,a--,o=o.substring(1)):"#"!==c&&"♯"!==c||(s++,i++,a++,o=o.substring(1));var l=o.split("/");if((r=this.chordNotes(s,l[0])).length>=3&&(a=a+(r[2]-r[0])-7),2===l.length&&this.basses[l[1].substring(0,1)]){var h={"#":1,"♯":1,b:-1,"♭":-1}[l[1].substring(1)]||0;i=this.basses[l[1].substring(0,1)]+h+n,a=i+=12*this.bassOctaveShift}return{boom:i,boom2:a,chick:r}}}},e.prototype.chordNotes=function(e,t){var i=this.chordIntervals[t];i||(i="ma"===t.slice(0,2).toLowerCase()||"M"===t[0]?this.chordIntervals.M:"m"===t[0]||"-"===t[0]?this.chordIntervals.m:this.chordIntervals.M),e+=12,e+=12*this.chordOctaveShift;for(var n=[],r=0;r<i.length;r++)n.push(e+i[r]);return n},e.prototype.writeNote=function(e,t,i,n,r,a){void 0!==e&&this.chordTrack.push({cmd:"note",pitch:e,volume:i,start:this.lastBarTime+n*s(t,this.tempoChangeFactor),duration:s(r,this.tempoChangeFactor),gap:0,instrument:a})},e.prototype.chordTrackEmpty=function(){for(var e=!0,t=0;t<this.chordTrack.length&&e;t++)"note"===this.chordTrack[t].cmd&&(e=!1);return e},e.prototype.resolveChords=function(e,i){if(!this.hasRhythmHead){var n=this.meter.num,r=this.meter.den,s=1/r/2,a=parseInt(n,10)/parseInt(r,10)-(i-e)/this.tempoChangeFactor;Math.abs(a)<1e-5&&(a=0),0!==this.currentChords.length&&0===this.currentChords[0].beat||this.currentChords.unshift({beat:0,chord:this.chordLastBar});var o=function(e,t){var i=[];if(0===e.length)return i;for(var n=e[0].chord,r=1;r<e.length;r++){for(var s=e[r];i.length<s.beat;)i.push(n);n=s.chord}for(;i.length<t;)i.push(n);return i}(this.currentChords,8*n/r),c=this.overridePattern?this.overridePattern:this.rhythmPatterns[n+"/"+r];if(a){c=[];for(var l=(i-e)/this.tempoChangeFactor*8,h=0;h<l/2;h+=2)c.push("chick"),c.push("")}if(!c)for(c=[],h=0;h<8*n/r/2;h++)c.push("chick"),c.push("");var u=!0,d=Math.min(c.length,o.length);for(h=0;h<d;h++){h>0&&o[h-1]&&o[h]&&o[h-1].boom!==o[h].boom&&(u=!0);var p=c[h],f=p.indexOf("boom")>=0,m=!f&&0!==h&&c[0].indexOf("boom")>=0&&(!o[h-1]||o[h-1].boom!==o[h].boom),g=t(o[h],p,u,m);f&&(u=!1);for(var v=0;v<g.length;v++)this.writeNote(g[v],.125,f||m?this.boomVolume:this.chickVolume,h,s,f||m?this.bassInstrument:this.chordInstrument),m?m=!1:f=!1}}},e.prototype.processChord=function(e){if(!this.chordTrackFinished){var t,i=this.findChord(e);if(i){var n=this.interpretChord(i);if(n){0===this.chordTrack.length&&this.chordTrack.push({cmd:"program",channel:this.chordChannel,instrument:this.chordInstrument}),this.lastChord=n;var s=(t=this.lastBarTime,8*(r(e.time)-t));this.currentChords.push({chord:this.lastChord,beat:s,start:r(e.time)})}}}},e.prototype.breakSynonyms=["break","(break)","no chord","n.c.","tacet"],e.prototype.basses={A:33,B:35,C:36,D:38,E:40,F:41,G:43},e.prototype.chordIntervals={dim:[0,3,6],"°":[0,3,6],"˚":[0,3,6],dim7:[0,3,6,9],"°7":[0,3,6,9],"˚7":[0,3,6,9],"ø7":[0,3,6,10],"m7(b5)":[0,3,6,10],m7b5:[0,3,6,10],"m7♭5":[0,3,6,10],"-7(b5)":[0,3,6,10],"-7b5":[0,3,6,10],"7b5":[0,4,6,10],"7(b5)":[0,4,6,10],"7♭5":[0,4,6,10],"7(b9,b5)":[0,4,6,10,13],"7b9,b5":[0,4,6,10,13],"7(#9,b5)":[0,4,6,10,15],"7#9b5":[0,4,6,10,15],"maj7(b5)":[0,4,6,11],maj7b5:[0,4,6,11],"13(b5)":[0,4,6,10,14,21],"13b5":[0,4,6,10,14,21],m:[0,3,7],"-":[0,3,7],m6:[0,3,7,9],"-6":[0,3,7,9],m7:[0,3,7,10],"-7":[0,3,7,10],"-(b6)":[0,3,7,8],"-b6":[0,3,7,8],"-6/9":[0,3,7,9,14],"-7(b9)":[0,3,7,10,13],"-7b9":[0,3,7,10,13],"-maj7":[0,3,7,11],"-9+7":[0,3,7,11,13],"-11":[0,3,7,11,14,17],m11:[0,3,7,11,14,17],"-maj9":[0,3,7,11,14],"-∆9":[0,3,7,11,14],mM9:[0,3,7,11,14],M:[0,4,7],6:[0,4,7,9],"6/9":[0,4,7,9,14],"6add9":[0,4,7,9,14],69:[0,4,7,9,14],7:[0,4,7,10],9:[0,4,7,10,14],11:[0,7,10,14,17],13:[0,4,7,10,14,21],"7b9":[0,4,7,10,13],"7♭9":[0,4,7,10,13],"7(b9)":[0,4,7,10,13],"7(#9)":[0,4,7,10,15],"7#9":[0,4,7,10,15],"(13)":[0,4,7,10,14,21],"7(9,13)":[0,4,7,10,14,21],"7(#9,b13)":[0,4,7,10,15,20],"7(#11)":[0,4,7,10,14,18],"7#11":[0,4,7,10,14,18],"7(b13)":[0,4,7,10,20],"7b13":[0,4,7,10,20],"9(#11)":[0,4,7,10,14,18],"9#11":[0,4,7,10,14,18],"13(#11)":[0,4,7,10,18,21],"13#11":[0,4,7,10,18,21],maj7:[0,4,7,11],"∆7":[0,4,7,11],"Δ7":[0,4,7,11],maj9:[0,4,7,11,14],"maj7(9)":[0,4,7,11,14],"maj7(11)":[0,4,7,11,17],"maj7(#11)":[0,4,7,11,18],"maj7(13)":[0,4,7,14,21],"maj7(9,13)":[0,4,7,11,14,21],"7sus4":[0,5,7,10],m7sus4:[0,3,7,10,17],sus4:[0,5,7],sus2:[0,2,7],"7sus2":[0,2,7,10],"9sus4":[0,5,7,10,14],"13sus4":[0,5,7,10,14,21],aug7:[0,4,8,10],"+7":[0,4,8,10],"+":[0,4,8],"7#5":[0,4,8,10],"7♯5":[0,4,8,10],"7+5":[0,4,8,10],"9#5":[0,4,8,10,14],"9♯5":[0,4,8,10,14],"9+5":[0,4,8,10,14],"-7(#5)":[0,3,8,10],"-7#5":[0,3,8,10],"7(#5)":[0,4,8,10],"7(b9,#5)":[0,4,8,10,13],"7b9#5":[0,4,8,10,13],"maj7(#5)":[0,4,8,11],"maj7#5":[0,4,8,11],"maj7(#5,#11)":[0,4,8,11,18],"maj7#5#11":[0,4,8,11,18],"9(#5)":[0,4,8,10,14],"13(#5)":[0,4,8,10,14,21],"13#5":[0,4,8,10,14,21],5:[0,7],"5(8)":[0,7,12],"5add8":[0,7,12]},e.prototype.rhythmPatterns={"2/2":["boom","","","","chick","","",""],"3/2":["boom","","","","chick","","","","chick","","",""],"4/2":["boom","","","","chick","","","","boom","","","","chick","","",""],"2/4":["boom","","chick",""],"3/4":["boom","","chick","","chick",""],"4/4":["boom","","chick","","boom","","chick",""],"5/4":["boom","","chick","","chick","","boom","","chick",""],"6/4":["boom","","chick","","boom","","chick","","boom","","chick",""],"3/8":["boom","","chick"],"5/8":["boom","chick","chick","boom","chick"],"6/8":["boom","","chick","boom","","chick"],"7/8":["boom","chick","chick","boom","chick","boom","chick"],"9/8":["boom","","chick","boom","","chick","boom","","chick"],"10/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick"],"11/8":["boom","chick","chick","boom","chick","chick","boom","chick","boom","chick","chick"],"12/8":["boom","","chick","boom","","chick","boom","","chick","boom","","chick"]},Ko=e}(),i=Fd();return function(){var n,r,s,a,o,c,l,h,u,d,p,f,m,g,v,b,y,_=1,w={num:4,den:4},x=128,k=!0,C=105,S=95,M=85,E=.25,T=0,P={},A=0;function I(e){for(var t=h.length-1;t>=0;t--)if("program"===h[t].cmd)return void(h[t].channel=e)}function N(e){return e/1e6}function L(e){return Math.round(e*_*1e6)/1e6}function O(e){switch(parseInt(e.den,10)){case 2:return.5;case 4:return.25;case 8:return e.num%3==0?.375:.125;case 16:return.125}return.25}function B(e,t){var i=t.start,n=t.duration,r=L(1/32);switch(e){case"trill":for(var s=2;n>0;)h.push({cmd:"note",pitch:t.pitch+s,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),s=2===s?0:2,n-=r,i+=r;break;case"mordent":h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),n-=r,i+=r,h.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),n-=r,i+=r,h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i,duration:n,gap:0,instrument:l});break;case"lowermordent":h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),n-=r,i+=r,h.push({cmd:"note",pitch:t.pitch-2,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),n-=r,i+=r,h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i,duration:n,gap:0,instrument:l});break;case"turn":r=t.duration/4,h.push({cmd:"note",pitch:t.pitch+2,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i+r,duration:r,gap:0,instrument:l,style:"decoration"}),h.push({cmd:"note",pitch:t.pitch-1,volume:t.volume,start:i+2*r,duration:r,gap:0,instrument:l,style:"decoration"}),h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i+3*r,duration:r,gap:0,instrument:l,style:"decoration"});break;case"roll":for(;n>0;)h.push({cmd:"note",pitch:t.pitch,volume:t.volume,start:i,duration:r,gap:0,instrument:l,style:"decoration"}),n-=2*r,i+=2*r}}function D(e,t){var n,r=function(e,t){if(t)return 0;var i;if(null!=m)i=m,m=void 0;else if(k)if(A>e)i=M;else{var n=(e-f)/O(w);i=0===n?C:parseInt(n,10)===n?S:M}else i=S;return g&&(i+=g,g=void 0),i<0&&(i=0),i>127&&(i=127),t?0:i}(N(e.time),t);if(p.processChord(e),e.gracenotes&&e.pitches&&e.pitches.length>0&&e.pitches[0]&&(n=function(e,t){for(var n,r=0,s=[],a=0;a<e.length;a++)r+=(n=e[a]).duration;var o=t/2/r;for(a=0;a<e.length;a++){var c=z(n=e[a]);if(l===x&&y){var h=i(n);h&&y[h]&&(c=y[h].sound)}var u={pitch:c,duration:n.duration*o};u=q(u),s.push(u)}return s}(e.gracenotes,e.pitches[0].duration),e.elem&&(e.elem.midiGraceNotePitches=function(e,t,i,n){var r=[];i=Math.round(i);for(var s=0;s<e.length;s++){var a=e[s];h.push({cmd:"note",pitch:a.pitch,volume:i,start:t,duration:a.duration,gap:0,instrument:n,style:"grace"}),r.push({pitch:a.pitch,durationInMeasures:a.duration,volume:i,instrument:n}),t+=a.duration}return r}(n,N(e.time),2*r/3,l))),e.elem){var s=N(e.time),a=s/E/o*60*1e3;if(void 0===e.elem.currentTrackMilliseconds)e.elem.currentTrackMilliseconds=a,e.elem.currentTrackWholeNotes=s;else if(void 0===e.elem.currentTrackMilliseconds.length)e.elem.currentTrackMilliseconds!==a&&(e.elem.currentTrackMilliseconds=[e.elem.currentTrackMilliseconds,a],e.elem.currentTrackWholeNotes=[e.elem.currentTrackWholeNotes,s]);else{for(var c=!1,u=0;u<e.elem.currentTrackMilliseconds.length;u++)e.elem.currentTrackMilliseconds[u]===a&&(c=!0);c||(e.elem.currentTrackMilliseconds.push(a),e.elem.currentTrackWholeNotes.push(s))}}if(e.pitches){var v="",b=function(e,t){var i={};if(e.decoration)for(var n=0;n<e.decoration.length;n++)"staccato"===e.decoration[n]?i.thisBreakBetweenNotes="staccato":"tenuto"===e.decoration[n]?i.thisBreakBetweenNotes="tenuto":"accent"===e.decoration[n]?i.velocity=Math.min(127,1.5*t):"trill"===e.decoration[n]?i.noteModification="trill":"lowermordent"===e.decoration[n]?i.noteModification="lowermordent":"uppermordent"===e.decoration[n]||"mordent"===e.decoration[n]?i.noteModification="mordent":"turn"===e.decoration[n]?i.noteModification="turn":"roll"===e.decoration[n]&&(i.noteModification="roll");return i}(e,r);b.thisBreakBetweenNotes&&(v=b.thisBreakBetweenNotes),b.velocity&&(r=b.velocity);var _=e.pitches;"rhythm"===e.style&&(_=p.setRhythmHead(!0,e)),e.elem&&(e.elem.midiPitches=[]);for(var P=0;P<_.length;P++){var I=_[P];if(I){I.startSlur&&(T+=I.startSlur.length),I.endSlur&&(T-=I.endSlur.length);var D=I.actualPitch?I.actualPitch:z(I);if(l===x&&y){var R=i(I);R&&y[R]&&(D=y[R].sound)}var V={cmd:"note",pitch:D,volume:r,start:N(e.time),duration:L(I.duration),instrument:l,startChar:e.elem.startChar,endChar:e.elem.endChar};if(V=q(V),e.gracenotes&&(V.duration=V.duration/2,V.start=V.start+V.duration),e.elem&&e.elem.midiPitches.push(V),b.noteModification)B(b.noteModification,V);else{switch(T>0?V.endType="tenuto":v&&(V.endType=v),V.endType){case"tenuto":V.gap=-.001;break;case"staccato":var F=.4*V.duration;V.gap=o/60*F;break;default:V.gap=0}h.push(V)}}}h.length}var j,H=(j=e).pitches&&j.pitches.length>0&&j.pitches[0]?j.pitches[0].duration:j.elem?j.elem.duration:j.duration;d=Math.max(d,N(e.time)+L(H))}e=function(e,i,x,L){i||(i={}),L||(L={}),n=[],r=[0,0,0,0,0,0,0],a=[],o=i.qpm,_=1,c=void 0,l=void 0,h=void 0,u=void 0,d=0,y=x,w={num:4,den:4},k=!0,C=105,S=95,M=85,E=.25,m=void 0,g=void 0,T=0,v=[],P={},b=1,e.length>0&&e[0].length>0&&(A=e[0][0].pickupLength),void 0===i.bassprog||L.bassprog||(L.bassprog=[i.bassprog]),void 0===i.bassvol||L.bassvol||(L.bassvol=[i.bassvol]),void 0===i.chordprog||L.chordprog||(L.chordprog=[i.chordprog]),void 0===i.chordvol||L.chordvol||(L.chordvol=[i.chordvol]),void 0===i.gchord||L.gchord||(L.gchord=[i.gchord]),p=new t(e.length,i.chordsOff,L,w),function(e,t){for(var i=0;i<e.length;i++){for(var n=e[i],r={},s=t.qpm,a=0,o=1,c=0;c<n.length;c++){var l=n[c];if("tempo"!==l.el_type){l.time=a;var h=l.duration?l.duration:0;if(a+=Math.round(h*o*1e6),l.pitches){for(var u=0;u<l.pitches.length;u++){var d=l.pitches[u];if(d)if(d.duration=l.duration,d.startTie)void 0===r[d.pitch]?r[d.pitch]={el:c,pitch:u}:(n[r[d.pitch].el].pitches[r[d.pitch].pitch].duration+=d.duration,l.pitches[u]=null);else if(d.endTie){var p=r[d.pitch];if(p){var f=d.duration;delete n[p.el].pitches[p.pitch].startTie,n[p.el].pitches[p.pitch].duration+=f,l.pitches[u]=null,delete r[d.pitch]}else delete d.endTie}}delete l.duration}}else s?o=l.qpm?s/l.qpm:1:s=l.qpm}for(var m in r)if(r.hasOwnProperty(m)){var g=r[m];delete n[g.el].pitches[g.pitch].startTie}}}(e,i);for(var B=0;B<e.length;B++){s=0,p.setTranspose(s);var R=e[B];h=[{cmd:"program",channel:B,instrument:c}],u=void 0,f=0,p.setLastBarTime(0);var z=!1;(!0===i.voicesOff||i.voicesOff&&i.voicesOff.length&&i.voicesOff.indexOf(B)>=0)&&(z=!0);for(var q=0;q<R.length;q++){var F=R[q];switch(F.el_type){case"name":u={cmd:"text",type:"name",text:F.trackName};break;case"note":D(F,z);break;case"key":r=V(F);break;case"meter":w=F,p.setMeter(w),E=O(w),H();break;case"tempo":o?_=F.qpm?o/F.qpm:1:o=F.qpm,p.setTempoChangeFactor(_);break;case"transpose":s=F.transpose,p.setTranspose(s);break;case"bar":p.barEnd(F),n=[],0===B&&G(e.length+1),p.setRhythmHead(!1),f=N(F.time),p.setLastBarTime(f);break;case"bagpipes":break;case"instrument":if(void 0===c&&(c=F.program),l=F.program,h.length>0&&"program"===h[h.length-1].cmd)h[h.length-1].instrument=F.program;else{var U;for(U=h.length-1;U>=0&&"program"!==h[U].cmd;U--);(U<0||h[U].instrument!==F.program)&&h.push({cmd:"program",channel:0,instrument:F.program})}break;case"channel":I(F.channel);break;case"drum":P=j(F.params),H();break;case"gchordOn":p.gChordOn(F);break;case"beat":C=F.beats[0],S=F.beats[1],M=F.beats[2];break;case"vol":m=F.volume;break;case"volinc":g=F.volume;break;case"beataccents":k=F.value;break;case"gchord":case"bassprog":case"chordprog":case"bassvol":case"chordvol":case"gchordbars":p.paramChange(F);break;default:console.log("MIDI creation. Unknown el_type: "+F.el_type+"\n")}}void 0===h[0].instrument&&(h[0].instrument=c||0),u&&h.unshift(u),a.push(h),p.finish(),v.length}return i.detuneOctave&&function(e,t){for(var i={},n=0;n<e.length;n++)for(var r=0;r<e[n].length;r++){var s=e[n][r];"note"===s.cmd&&(void 0===i[s.start]&&(i[s.start]=[]),i[s.start].push({track:n,event:r,pitch:s.pitch}))}var a=Object.keys(i);for(n=0;n<a.length;n++){var o=i[a[n]];if(o.length>1){var c=(o=o.sort((function(e,t){return e.pitch-t.pitch})))[o.length-1],l=c.pitch%12,h=!1;for(r=0;!h&&r<o.length-1;r++)o[r].pitch%12===l&&(h=!0);if(h){var u=e[c.track][c.event];u.cents||(u.cents=0),u.cents+=t}}}}(a,parseInt(i.detuneOctave,10)),p.addTrack(a),v.length>0&&a.push(v),{tempo:o,instrument:c,tracks:a,totalDuration:d}};var R=[0,2,4,5,7,9,11];function z(e){if(void 0!==e.midipitch)return e.midipitch;var t=e.pitch;if(e.accidental)switch(e.accidental){case"sharp":n[t]=1;break;case"flat":n[t]=-1;break;case"natural":n[t]=0;break;case"dblsharp":n[t]=2;break;case"dblflat":n[t]=-2;break;case"quartersharp":n[t]=.25;break;case"quarterflat":n[t]=-.25}var i,a=12*(i=t,Math.floor(i/7))+R[F(t)]+60;return void 0!==n[t]?a+=n[t]:a+=r[F(t)],a+s}function V(e){var t=[0,0,0,0,0,0,0];if(!e.accidentals)return t;for(var i=0;i<e.accidentals.length;i++){var n,r=e.accidentals[i];switch(r.acc){case"flat":n=-1;break;case"quarterflat":n=-.25;break;case"sharp":n=1;break;case"quartersharp":n=.25;break;default:n=0}t[F(r.note.toLowerCase().charCodeAt(0)-"c".charCodeAt(0))]+=n}return t}function q(e){var t=""+e.pitch;return t.indexOf(".75")>=0?(e.pitch=Math.round(e.pitch),e.cents=-50):t.indexOf(".25")>=0&&(e.pitch=Math.round(e.pitch),e.cents=50),e}function F(e){return(e%=7)<0&&(e+=7),e}function j(e){if(0===e.pattern.length||!1===e.on)return{on:!1};for(var t=e.pattern[0],i=[],n="",r=0,s=0;s<t.length;s++)if("d"===t[s]&&r++,"d"===t[s]||"z"===t[s])0!==n.length?(i.push(n),n=t[s]):n+=t[s];else{if(0===n.length)return{on:!1};n+=t[s]}if(0!==n.length&&i.push(n),e.pattern.length!==2*r+1)return{on:!1};for(var a={on:!0,bars:e.bars,pattern:[]},o=O(w),c=0,l=0;l<i.length;l++){n=i[l];for(var h=1,u=!1,d=0,p=1;p<n.length;p++)switch(n[p]){case"/":0!==d&&(h*=d),d=0,u=!0;break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":d=10*d+n[p];break;default:return{on:!1}}u?(0===d&&(d=2),h/=d):d&&(h*=d),"d"===n[0]?(a.pattern.push({len:h*o,pitch:e.pattern[1+c],velocity:e.pattern[1+c+r]}),c++):a.pattern.push({len:h*o,pitch:null})}return b=e.bars?e.bars:1,a}function H(){if(P&&P.pattern){for(var e=P,t=0,i=w.num/w.den,n=0;n<e.pattern.length;n++)t+=e.pattern[n].len;var r=t/b/i;for(n=0;n<e.pattern.length;n++)e.pattern[n].len=e.pattern[n].len/r;P=e}}function G(e){if(0!==v.length||P.on){var t=w.num/w.den;if(0===v.length){if(d<t)return;v.push({cmd:"program",channel:e,instrument:x})}if(P.on)for(var i=f,n=0;n<P.pattern.length;n++){var r=L(P.pattern[n].len);P.pattern[n].pitch&&v.push({cmd:"note",pitch:P.pattern[n].pitch,volume:P.pattern[n].velocity,start:i,duration:r,gap:0,instrument:x}),i+=r}}}}(),Jo=e}(),r=function(){if(ic)return tc;function e(e,t){return"abselem"===e?"abselem":t}function t(e,t){e.el_type="meter",e.startChar=-1,e.endChar=-1;for(var i=0;i<t.length;i++)t[i].unshift(e)}function i(e,t){e.el_type="key",e.startChar=-1,e.endChar=-1;for(var i=0;i<t.length;i++)t[i].unshift(e)}function n(e,t){e.el_type="clef",e.startChar=-1,e.endChar=-1;for(var i=0;i<t.length;i++)t[i].unshift(e)}function r(e,t,i){e.el_type="font",e.type=i,e.startChar=-1,e.endChar=-1;for(var n=0;n<t.length;n++)t[n].unshift(e)}function s(t,i){return!t||JSON.stringify(t,e)===JSON.stringify(i,e)}function a(e){for(var t={},i=Object.keys(e),n=0;n<i.length;n++)if("staff"!==i[n])t[i[n]]=e[i[n]];else{t.staff=[];for(var r=0;r<e.staff.length;r++){for(var s={},a=Object.keys(e.staff[r]),o=0;o<a.length;o++)if("voices"!==a[o])s[a[o]]=e.staff[r][a[o]];else{s.voices=[];for(var c=0;c<e.staff[r].voices.length;c++)s.voices.push([].concat(e.staff[r].voices[c]))}t.staff.push(s)}}return t}return ic=1,tc=function(e,o){o||(o={});for(var c=!!o.lineBreaks,l=[],h=!1,u=[],d=[],p=[],f=[],m=[],g=[],v=[],b=0;b<e.length;b++){var y=e[b];if(y.staff){if(h&&!y.vskip)for(var _=l[l.length-1],w=0;w<_.staff.length;w++){var x=y.staff[w],k=_.staff[w];if(x&&(s(x.meter,u[w])||(t(x.meter,x.voices),u[w]=x.meter,delete x.meter),s(x.key,d[w])||(i(x.key,x.voices),d[w]=x.key,delete x.key),x.title&&(k.abbrevTitle=x.title),s(x.clef,p[w])||(n(x.clef,x.voices),p[w]=x.clef,delete x.clef),s(x.vocalfont,f[w])||(r(x.vocalfont,x.voices,"vocalfont"),f[w]=x.vocalfont,delete x.vocalfont),s(x.gchordfont,m[w])||(r(x.gchordfont,x.voices,"gchordfont"),m[w]=x.gchordfont,delete x.gchordfont),s(x.tripletfont,g[w])||(r(x.tripletfont,x.voices,"tripletfont"),g[w]=x.tripletfont,delete x.tripletfont),s(x.annotationfont,v[w])||(r(x.annotationfont,x.voices,"annotationfont"),v[w]=x.annotationfont,delete x.annotationfont)),x)for(var C=0;C<k.voices.length;C++){var S=k.voices[C],M=x.voices[C];c&&S.push({el_type:"break"}),M&&(k.voices[C]=S.concat(M))}}else{for(var E=0;E<y.staff.length;E++)d[E]=y.staff[E].key,u[E]=y.staff[E].meter,p[E]=y.staff[E].clef;l.push(a(y))}h=!0}else h=!1,l.push(y)}return l}}();return nc=function(){function s(e,t,i,n){for(var r=0;r<n.length;r++)e[i][n[r]]=t[i][n[r]]}function a(e,t){for(;t<e.length&&null===e[t].left;)t++;return e[t]}this.reset=function(){this.version="1.1.0",this.media="screen",this.metaText={},this.metaTextInfo={},this.formatting={},this.lines=[],this.staffNum=0,this.voiceNum=0,this.lineNum=0,this.runningFonts={},delete this.visualTranspose},this.reset(),this.copyTopInfo=function(e){var t=["tempo","title","header","rhythm","origin","composer","author","partOrder"];s(this,e,"metaText",t),s(this,e,"metaTextInfo",t)},this.copyBottomInfo=function(e){var t=["unalignedWords","book","source","discography","notes","transcription","history","abc-copyright","abc-creator","abc-edited-by","footer"];s(this,e,"metaText",t),s(this,e,"metaTextInfo",t)},this.getBeatLength=function(){var e=this.getMeterFraction(),t=1;return(6===e.num||9===e.num||12===e.num||3===e.num&&8===e.den)&&(t=3),t/e.den},this.getPickupLength=function(){var e=this.getBarLength(),t=function(e,t){for(var i=0,n=0;n<e.length;n++)if(e[n].staff)for(var r=0;r<e[n].staff.length;r++)for(var s=0;s<e[n].staff[r].voices.length;s++)for(var a=e[n].staff[r].voices[s],o=1,c=0;c<a.length;c++){var l=a[c].rest&&"spacer"===a[c].rest.type;if(a[c].startTriplet&&(o=a[c].tripletMultiplier),a[c].duration&&!l&&"tempo"!==a[c].el_type&&(i+=a[c].duration*o),a[c].endTriplet&&(o=1),i>=t&&(i-=t),"bar"===a[c].el_type)return i}return i}(this.lines,e);return t<1e-8||e-t<1e-8?0:t},this.getBarLength=function(){var e=this.getMeterFraction();return e.num/e.den},this.getTotalTime=function(){return this.totalTime},this.getTotalBeats=function(){return this.totalBeats},this.millisecondsPerMeasure=function(e){var t;if(e)t=e;else{var i=this.metaText?this.metaText.tempo:null;t=this.getBpm(i)}return t<=0&&(t=1),this.getBeatsPerMeasure()/t*6e4},this.getBeatsPerMeasure=function(){var e=this.getBeatLength();return this.getBarLength()/e},this.getMeter=function(){for(var e=0;e<this.lines.length;e++){var t=this.lines[e];if(t.staff)for(var i=0;i<t.staff.length;i++){var n=t.staff[i].meter;if(n)return n}}return{type:"common_time"}},this.getMeterFraction=function(){var e=this.getMeter(),t=4,i=4;return e&&("specified"===e.type?(t=parseInt(e.value[0].num,10),i=parseInt(e.value[0].den,10)):"cut_time"===e.type?(t=2,i=2):"common_time"===e.type&&(t=4,i=4)),this.meter={num:t,den:i},this.meter},this.getKeySignature=function(){for(var e=0;e<this.lines.length;e++){var t=this.lines[e];if(t.staff)for(var i=0;i<t.staff.length;i++)if(t.staff[i].key)return t.staff[i].key}return{}},this.getElementFromChar=function(e){for(var t=0;t<this.lines.length;t++){var i=this.lines[t];if(i.staff)for(var n=0;n<i.staff.length;n++)for(var r=i.staff[n],s=0;s<r.voices.length;s++)for(var a=r.voices[s],o=0;o<a.length;o++){var c=a[o];if(c.startChar&&c.endChar&&c.startChar<=e&&c.endChar>e)return c}}return null},this.addElementToEvents=function(t,i,n,r,s,a,o,c,l,h){if(i.hint)return{isTiedState:void 0,duration:0};var u=i.durationClass?i.durationClass:i.duration;if(i.abcelem.rest&&"spacer"===i.abcelem.rest.type&&(u=0),u>0){for(var d=[],p=0;p<i.elemset.length;p++)null!==i.elemset[p]&&d.push(i.elemset[p]);var f=i.startTie;if(void 0!==l)t["event"+l].elements.push(d),h&&(t["event"+n]||(t["event"+n]={type:"event",milliseconds:n,line:a,measureNumber:o,top:r,height:s,left:null,width:0,elements:[],startChar:null,endChar:null,startCharArray:[],endCharArray:[]}),t["event"+n].measureStart=!0,h=!1),f||(l=void 0);else{if(t["event"+n]){if(t["event"+n].left?t["event"+n].left=Math.min(t["event"+n].left,i.x):t["event"+n].left=i.x,t["event"+n].elements.push(d),t["event"+n].startCharArray.push(i.abcelem.startChar),t["event"+n].endCharArray.push(i.abcelem.endChar),null===t["event"+n].startChar&&(t["event"+n].startChar=i.abcelem.startChar),null===t["event"+n].endChar&&(t["event"+n].endChar=i.abcelem.endChar),i.abcelem.midiPitches&&i.abcelem.midiPitches.length)for(t["event"+n].midiPitches||(t["event"+n].midiPitches=[]),p=0;p<i.abcelem.midiPitches.length;p++)t["event"+n].midiPitches.push(i.abcelem.midiPitches[p]);if(i.abcelem.midiGraceNotePitches&&i.abcelem.midiGraceNotePitches.length){t["event"+n].midiGraceNotePitches||(t["event"+n].midiGraceNotePitches=[]);for(var m=0;m<i.abcelem.midiGraceNotePitches.length;m++)t["event"+n].midiGraceNotePitches.push(i.abcelem.midiGraceNotePitches[m])}}else t["event"+n]={type:"event",milliseconds:n,line:a,measureNumber:o,top:r,height:s,left:i.x,width:i.w,elements:[d],startChar:i.abcelem.startChar,endChar:i.abcelem.endChar,startCharArray:[i.abcelem.startChar],endCharArray:[i.abcelem.endChar],midiPitches:i.abcelem.midiPitches?e.cloneArray(i.abcelem.midiPitches):[]},i.abcelem.midiGraceNotePitches&&(t["event"+n].midiGraceNotePitches=e.cloneArray(i.abcelem.midiGraceNotePitches));h&&(t["event"+n].measureStart=!0,h=!1)}}return{isTiedState:l,duration:u/c,nextIsBar:h||"bar"===i.type}},this.makeVoicesArray=function(){for(var e=[],i=[],n={},r=0;r<this.engraver.staffgroups.length;r++){var s=this.engraver.staffgroups[r];if(s&&s.staffs&&s.staffs.length>0)for(var a=s.staffs[0],o=a.absoluteY,c=o-a.top*t.STEP,l=s.staffs[s.staffs.length-1],h=(o=l.absoluteY)-l.bottom*t.STEP-c,u=s.voices,d=0;d<u.length;d++)if(!u[d].staff||!u[d].staff.isTabStaff){var p=!1;e[d]||(e[d]=[]),void 0===i[d]&&(i[d]=0);for(var f=u[d].children,m=0;m<f.length;m++)"tempo"===f[m].type&&(n[i[d]]=this.getBpm(f[m].abcelem)),e[d].push({top:c,height:h,line:s.line,measureNumber:i[d],elem:f[m]}),"bar"===f[m].type&&p&&i[d]++,"note"!==f[m].type&&"rest"!==f[m].type||(p=!0)}}return this.tempoLocations=n,e},this.setupEvents=function(e,t,i,n){n||(n=1);for(var r,s=[],o={},c=e,l=!0,h=this.makeVoicesArray(),u=0,d=0;d<h.length;d++){var p=c,f=Math.round(1e3*p),m=0,g=-1,v=h[d],b=i;t=this.getBeatLength()*b/60;for(var y=-1,_=0;_<v.length;_++){var w=v[_].measureNumber;y!==w&&this.tempoLocations[w]&&(b=this.tempoLocations[w],t=n*this.getBeatLength()*b/60,y=w);var x,k=v[_].elem,C=this.addElementToEvents(o,k,f,v[_].top,v[_].height,v[_].line,v[_].measureNumber,t,r,l);if(r=C.isTiedState,l=C.nextIsBar,p+=C.duration,k.duration>0&&o["event"+f]&&(x="event"+f),f=Math.round(1e3*p),"bar"===k.type){var S=k.abcelem.type,M="bar_right_repeat"===S||"bar_dbl_repeat"===S,E="1"===k.abcelem.startEnding,T="bar_left_repeat"===S||"bar_dbl_repeat"===S||"bar_right_repeat"===S;if(M){_>0&&(o[x].endX=k.x),-1===g&&(g=_);var P=0;y=-1;for(var A=m;A<g;A++){y!==(w=v[A].measureNumber)&&this.tempoLocations[w]&&(b=this.tempoLocations[w],t=n*this.getBeatLength()*b/60,y=w);var I=v[A].elem;r=(C=this.addElementToEvents(o,I,f,v[A].top,v[A].height,v[A].line,v[A].measureNumber,t,r,l)).isTiedState,l=C.nextIsBar,p+=C.duration,P=f,f=Math.round(1e3*p)}o["event"+P]&&(o["event"+P].endX=v[g].elem.x),l=!0,g=-1}E&&(g=_),T&&(m=_)}}u=Math.max(u,f)}return function(e){for(var t,i,n,r,s=e.length-1;s>=0;s--){var a=e[s];"bar"===a.type?(a.top=n,a.nextTop=t,t=n,a.bottom=r,a.nextBottom=i,i=r):"event"===a.type&&(n=a.top,r=a.top+a.height)}}(s=function(e){var t=[];for(var i in e)e.hasOwnProperty(i)&&t.push(e[i]);return t.sort((function(e,t){var i=e.milliseconds-t.milliseconds;return 0!==i?i:"bar"===e.type?-1:1}))}(o)),function(e,t){if(!(t.length<1)){for(var i=0;i<t.length-1;i++){var n=t[i],r=a(t,i+1);if(null!==n.left){var s=r&&n.top===r.top?r.left:e[n.line].staffGroup.w;void 0!==n.endX?s>n.left&&(n.endX=Math.min(n.endX,s)):n.endX=s}}var o=t[t.length-1];o.endX=e[o.line].staffGroup.w}}(this.lines,s),s.push({type:"end",milliseconds:u}),this.addUsefulCallbackInfo(s,b*n),s},this.addUsefulCallbackInfo=function(e,t){for(var i=this.millisecondsPerMeasure(t),n=0;n<e.length;n++)e[n].millisecondsPerMeasure=i},this.getBpm=function(e){var t;if(e||(e=this.metaText?this.metaText.tempo:null),e){t=e.bpm;var i=this.getBeatLength();t=t*(e.duration&&e.duration.length>0?e.duration[0]:i)/i}if(!t){t=180;var n=this.getMeterFraction();n&&3!==n.num&&n.num%3==0&&(t=120)}return t},this.setTiming=function(e,t){if(t=t||0,!this.engraver||!this.engraver.staffgroups)return console.log("setTiming cannot be called before the tune is drawn."),this.noteTimings=[],this.noteTimings;var i=this.metaText?this.metaText.tempo:null,n=this.getBpm(i),r=1;e?i&&(r=e/n):e=n;var s=this.getBeatLength(),a=e/60,o=this.getBarLength()/s*t/a;o&&(o-=this.getPickupLength()/s/a);var c=s*a;return this.noteTimings=this.setupEvents(o,c,e,r),this.noteTimings.length>0?(this.totalTime=this.noteTimings[this.noteTimings.length-1].milliseconds/1e3,this.totalBeats=this.totalTime*a):(this.totalTime=void 0,this.totalBeats=void 0),this.noteTimings},this.setUpAudio=function(e){e||(e={});var t=i(this,e);return n(t,e,this.formatting.percmap,this.formatting.midi)},this.deline=function(e){return r(this.lines,e)},this.findSelectableElement=function(e){return this.engraver&&this.engraver.selectables?this.engraver.findSelectableElement(e):null},this.getSelectableArray=function(){return this.engraver&&this.engraver.selectables?this.engraver.selectables:[]}}}function Hd(){if(cc)return oc;cc=1;var e=Io(),t=No(),n=function(){if(To)return Eo;To=1;var e=Io(),t=No(),i=Ro();return Eo=function(n,r,s,a,o){this.reset=function(e,n,r,s){i.initialize(e,n,r,s,o),t.initialize(e,n,r,s,o)},this.reset(n,r,s,a),this.setTitle=function(e,t){s.hasMainTitle?o.addSubtitle(e,{startChar:s.iChar,endChar:s.iChar+t+2}):(o.addMetaText("title",e,{startChar:s.iChar,endChar:s.iChar+t+2}),s.hasMainTitle=!0)},this.setMeter=function(e){if("C"===(e=n.stripComment(e)))return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"common_time"};if("C|"===e)return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"cut_time"};if("o"===e)return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"tempus_perfectum"};if("c"===e)return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"tempus_imperfectum"};if("o."===e)return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"tempus_perfectum_prolatio"};if("c."===e)return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),{type:"tempus_imperfectum_prolatio"};if(0===e.length||"none"===e.toLowerCase())return!0===s.havent_set_length&&(s.default_length=.125,s.havent_set_length=!1),null;var t=n.tokenize(e,0,e.length);try{var i=function(){var e=function(){var e={value:0,num:""},i=t.shift();for("("===i.token&&(i=t.shift());;){if("number"!==i.type)throw"Expected top number of meter";if(e.value+=parseInt(i.token),e.num+=i.token,0===t.length||"/"===t[0].token)return e;if(")"===(i=t.shift()).token){if(0===t.length||"/"===t[0].token)return e;throw"Unexpected paren in meter"}if("."!==i.token&&"+"!==i.token)throw"Expected top number of meter";if(e.num+=i.token,0===t.length)throw"Expected top number of meter";i=t.shift()}return e}();if(0===t.length)return e;var i=t.shift();if("/"!==i.token)throw"Expected slash in meter";if("number"!==(i=t.shift()).type)throw"Expected bottom number of meter";return e.den=i.token,e.value=e.value/parseInt(e.den),e};if(0===t.length)throw"Expected meter definition in M: line";for(var a={type:"specified",value:[]},o=0;;){var c=i();o+=c.value;var l={num:c.num};if(void 0!==c.den&&(l.den=c.den),a.value.push(l),0===t.length)break}return!0===s.havent_set_length&&(s.default_length=o<.75?.0625:.125,s.havent_set_length=!1),a}catch(h){r(h,e,0)}return null},this.calcTempo=function(e){var t=1/4;s.meter&&"specified"===s.meter.type?t=1/parseInt(s.meter.value[0].den):s.origMeter&&"specified"===s.origMeter.type&&(t=1/parseInt(s.origMeter.value[0].den));for(var i=0;i<e.duration;i++)e.duration[i]=t*e.duration[i];return e},this.resolveTempo=function(){s.tempo&&(this.calcTempo(s.tempo),a.metaText.tempo=s.tempo,delete s.tempo)},this.addUserDefinition=function(t,i,n){var a=t.indexOf("=",i);if(-1!==a){var o=e.strip(t.substring(i,a)),c=e.strip(t.substring(a+1));1===o.length?-1!=="HIJKLMNOPQRSTUVWXYhijklmnopqrstuvw~".indexOf(o)?0!==c.length?(void 0===s.macros&&(s.macros={}),s.macros[o]=c):r("Missing macro definition",t,i):r("Macro definitions must be H-Y, h-w, or tilde",t,i):r("Macro definitions can only be one character",t,i)}else r("Need an = in a macro definition",t,i)},this.setDefaultLength=function(e,t,i){var n=e.substring(t,i).replace(/ /g,"").split("/");if(2===n.length){var r=parseInt(n[0]),a=parseInt(n[1]);a>0&&(s.default_length=r/a,s.havent_set_length=!1)}else 1===n.length&&"1"===n[0]&&(s.default_length=1,s.havent_set_length=!1)};var c={larghissimo:20,adagissimo:24,sostenuto:28,grave:32,largo:40,lento:50,larghetto:60,adagio:68,adagietto:74,andante:80,andantino:88,"marcia moderato":84,"andante moderato":100,moderato:112,allegretto:116,"allegro moderato":120,allegro:126,animato:132,agitato:140,veloce:148,"mosso vivo":156,vivace:164,vivacissimo:172,allegrissimo:176,presto:184,prestissimo:210};this.setTempo=function(e,t,i,a){try{var o=n.tokenize(e,t,i);if(0===o.length)throw"Missing parameter in Q: field";var l={startChar:a+t-2,endChar:a+i},h=!0,u=o.shift();if("quote"===u.type&&(l.preString=u.token,u=o.shift(),0===o.length))return c[l.preString.toLowerCase()]&&(l.bpm=c[l.preString.toLowerCase()],l.suppressBpm=!0),{type:"immediate",tempo:l};if("alpha"===u.type&&"C"===u.token){if(0===o.length)throw"Missing tempo after C in Q: field";if("punct"===(u=o.shift()).type&&"="===u.token){if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(u=o.shift()).type)throw"Expected number after = in Q: field";l.duration=[1],l.bpm=parseInt(u.token)}else{if("number"!==u.type)throw"Expected number or equal after C in Q: field";if(l.duration=[parseInt(u.token)],0===o.length)throw"Missing = after duration in Q: field";if("punct"!==(u=o.shift()).type||"="!==u.token)throw"Expected = after duration in Q: field";if(0===o.length)throw"Missing tempo after = in Q: field";if("number"!==(u=o.shift()).type)throw"Expected number after = in Q: field";l.bpm=parseInt(u.token)}}else{if("number"!==u.type)throw"Unknown value in Q: field";var d=parseInt(u.token);if(0===o.length||"quote"===o[0].type)l.duration=[1],l.bpm=d;else{if(h=!1,"punct"!==(u=o.shift()).type&&"/"!==u.token)throw"Expected fraction in Q: field";if("number"!==(u=o.shift()).type)throw"Expected fraction in Q: field";var p=parseInt(u.token);for(l.duration=[d/p];o.length>0&&"="!==o[0].token&&"quote"!==o[0].type;){if("number"!==(u=o.shift()).type)throw"Expected fraction in Q: field";if(d=parseInt(u.token),"punct"!==(u=o.shift()).type&&"/"!==u.token)throw"Expected fraction in Q: field";if("number"!==(u=o.shift()).type)throw"Expected fraction in Q: field";p=parseInt(u.token),l.duration.push(d/p)}if("punct"!==(u=o.shift()).type&&"="!==u.token)throw"Expected = in Q: field";if("number"!==(u=o.shift()).type)throw"Expected tempo in Q: field";l.bpm=parseInt(u.token)}}if(0!==o.length&&("quote"===(u=o.shift()).type&&(l.postString=u.token,u=o.shift()),0!==o.length))throw"Unexpected string at end of Q: field";return!1===s.printTempo&&(l.suppress=!0),{type:h?"delaySet":"immediate",tempo:l}}catch(f){return r(f,e,t),{type:"none"}}},this.letter_to_inline_header=function(e,c,l){var h=!1,u=n.eatWhiteSpace(e,c);if(c+=u,e.length>=c+5&&"["===e[c]&&":"===e[c+2]){var d=e.indexOf("]",c),p=s.iChar+c,f=s.iChar+d+1;switch(e.substring(c,c+3)){case"[I:":var m=t.addDirective(e.substring(c+3,d));return m&&r(m,e,c),[d-c+1+u];case"[M:":var g=this.setMeter(e.substring(c+3,d));return o.hasBeginMusic()&&g?o.appendStartingElement("meter",p,f,g):s.meter=g,[d-c+1+u];case"[K:":var v=i.parseKey(e.substring(c+3,d),!0);return v.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",p,f,s.clef),v.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",p,f,i.fixKey(s.clef,s.key)),[d-c+1+u];case"[P:":var b=t.parseFontChangeLine(e.substring(c+3,d));return l||a.lines.length<=a.lineNum?s.partForNextLine={title:b,startChar:p,endChar:f}:o.appendElement("part",p,f,{title:b}),[d-c+1+u];case"[L:":return this.setDefaultLength(e,c+3,d),[d-c+1+u];case"[Q:":if(d>0){var y=this.setTempo(e,c+3,d,s.iChar);return"delaySet"===y.type?o.hasBeginMusic()?o.appendElement("tempo",p,f,this.calcTempo(y.tempo)):s.tempoForNextLine=["tempo",p,f,this.calcTempo(y.tempo)]:"immediate"===y.type&&(!l&&o.hasBeginMusic()?o.appendElement("tempo",p,f,y.tempo):s.tempoForNextLine=["tempo",p,f,y.tempo]),[d-c+1+u,e[c+1],e.substring(c+3,d)]}break;case"[V:":if(d>0)return h=i.parseVoice(e,c+3,d),[d-c+1+u,e[c+1],e.substring(c+3,d),h];break;case"[r:":return[d-c+1+u]}}return[0]},this.letter_to_body_header=function(n,a){var c=!1;if(n.length>=a+3)switch(n.substring(a,a+2)){case"I:":var l=t.addDirective(n.substring(a+2));return l&&r(l,n,a),[n.length];case"M:":var h=this.setMeter(n.substring(a+2));return o.hasBeginMusic()&&h&&o.appendStartingElement("meter",s.iChar+a,s.iChar+n.length,h),[n.length];case"K:":var u=i.parseKey(n.substring(a+2),o.hasBeginMusic());return u.foundClef&&o.hasBeginMusic()&&o.appendStartingElement("clef",s.iChar+a,s.iChar+n.length,s.clef),u.foundKey&&o.hasBeginMusic()&&o.appendStartingElement("key",s.iChar+a,s.iChar+n.length,i.fixKey(s.clef,s.key)),[n.length];case"P:":return o.hasBeginMusic()&&o.appendElement("part",s.iChar+a,s.iChar+n.length,{title:n.substring(a+2)}),[n.length];case"L:":return this.setDefaultLength(n,a+2,n.length),[n.length];case"Q:":var d=n.indexOf("",a+2);-1===d&&(d=n.length);var p=this.setTempo(n,a+2,d,s.iChar);return"delaySet"===p.type?o.appendElement("tempo",s.iChar+a,s.iChar+n.length,this.calcTempo(p.tempo)):"immediate"===p.type&&o.appendElement("tempo",s.iChar+a,s.iChar+n.length,p.tempo),[d,n[a],e.strip(n.substring(a+2))];case"V:":return c=i.parseVoice(n,a+2,n.length),[n.length,n[a],e.strip(n.substring(a+2)),c]}return[0]};var l={A:"author",B:"book",C:"composer",D:"discography",F:"url",G:"group",I:"instruction",N:"notes",O:"origin",R:"rhythm",S:"source",W:"unalignedWords",Z:"transcription"};this.parseHeader=function(e){var c=l[e[0]],h=e.length-2,u=n.translateString(n.stripComment(e.substring(2)));if("unalignedWords"===c||"notes"===c)o.addMetaTextArray(c,t.parseFontChangeLine(u),{startChar:s.iChar,endChar:s.iChar+e.length});else if(void 0!==c)o.addMetaText(c,t.parseFontChangeLine(u),{startChar:s.iChar,endChar:s.iChar+e.length});else{var d=s.iChar,p=d+e.length;switch(e[0]){case"H":for(o.addMetaTextArray("history",t.parseFontChangeLine(u),{startChar:s.iChar,endChar:s.iChar+e.length}),e=n.peekLine();e&&":"!==e[1];)n.nextLine(),o.addMetaTextArray("history",t.parseFontChangeLine(n.translateString(n.stripComment(e))),{startChar:s.iChar,endChar:s.iChar+e.length}),e=n.peekLine();break;case"K":this.resolveTempo();var f=i.parseKey(e.substring(2),!1);!s.is_in_header&&o.hasBeginMusic()&&(f.foundClef&&o.appendStartingElement("clef",d,p,s.clef),f.foundKey&&o.appendStartingElement("key",d,p,i.fixKey(s.clef,s.key))),s.is_in_header=!1;break;case"L":this.setDefaultLength(e,2,e.length);break;case"M":s.origMeter=s.meter=this.setMeter(e.substring(2));break;case"P":s.is_in_header?o.addMetaText("partOrder",t.parseFontChangeLine(u),{startChar:s.iChar,endChar:s.iChar+e.length}):s.partForNextLine={title:u,startChar:d,endChar:p};break;case"Q":var m=this.setTempo(e,2,e.length,s.iChar);"delaySet"===m.type?s.tempo=m.tempo:"immediate"===m.type&&(a.metaText.tempo?s.tempoForNextLine=["tempo",d,p,m.tempo]:a.metaText.tempo=m.tempo);break;case"T":s.titlecaps&&(u=u.toUpperCase()),this.setTitle(t.parseFontChangeLine(n.theReverser(u)),h);break;case"U":this.addUserDefinition(e,2,e.length);break;case"V":if(i.parseVoice(e,2,e.length),!s.is_in_header)return{newline:!0};break;case"s":return{symbols:!0};case"w":return{words:!0};case"X":break;case"E":case"m":r("Ignored header",e,0);break;default:return{regular:!0}}}return{}}}}(),r=function(){if(qo)return Vo;qo=1;var e,t,i,n,r,s,a=Ro(),o=Do(),{legalAccents:c,volumeDecorations:l,dynamicDecorations:h,accentPseudonyms:u,accentDynamicPseudonyms:d,nonDecorations:p,durations:f,pitches:m,rests:g,accMap:v,tripletQ:b}=(zo||(zo=1,Rd.legalAccents=["trill","lowermordent","uppermordent","mordent","pralltriller","accent","fermata","invertedfermata","tenuto","0","1","2","3","4","5","+","wedge","open","thumb","snap","turn","roll","breath","shortphrase","mediumphrase","longphrase","segno","coda","D.S.","D.C.","fine","beambr1","beambr2","slide","marcato","upbow","downbow","/","//","///","////","trem1","trem2","trem3","trem4","turnx","invertedturn","invertedturnx","trill(","trill)","arpeggio","xstem","mark","umarcato","style=normal","style=harmonic","style=rhythm","style=x","style=triangle","D.C.alcoda","D.C.alfine","D.S.alcoda","D.S.alfine","editorial","courtesy"],Rd.volumeDecorations=["p","pp","f","ff","mf","mp","ppp","pppp","fff","ffff","sfz"],Rd.dynamicDecorations=["crescendo(","crescendo)","diminuendo(","diminuendo)","glissando(","glissando)","~(","~)"],Rd.accentPseudonyms=[["<","accent"],[">","accent"],["tr","trill"],["plus","+"],["emphasis","accent"],["^","umarcato"],["marcato","umarcato"]],Rd.accentDynamicPseudonyms=[["<(","crescendo("],["<)","crescendo)"],[">(","diminuendo("],[">)","diminuendo)"]],Rd.nonDecorations="ABCDEFGabcdefgxyzZ[]|^_{",Rd.durations=[.5,.75,.875,.9375,.96875,.984375,.25,.375,.4375,.46875,.484375,.4921875,.125,.1875,.21875,.234375,.2421875,.24609375,.0625,.09375,.109375,.1171875,.12109375,.123046875,.03125,.046875,.0546875,.05859375,.060546875,.0615234375,.015625,.0234375,.02734375,.029296875,.0302734375,.03076171875],Rd.pitches={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11},Rd.rests={x:"invisible",X:"invisible-multimeasure",y:"spacer",z:"rest",Z:"multimeasure"},Rd.accMap={dblflat:"__",flat:"_",natural:"=",sharp:"^",dblsharp:"^^",quarterflat:"_/",quartersharp:"^/"},Rd.tripletQ={2:3,3:2,4:3,5:2,6:2,7:2,8:3,9:2}),Rd),y=function(a,o,c,l,h,u){e=a,t=o,i=c,n=l,r=h,s=u,this.lineContinuation=!1},_=function(e,t,i){if(void 0===e.inTie[t])return!1;var n=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;return!(!e.inTie[t][n]||void 0===i.pitches&&"spacer"===i.rest.type)},w={};y.prototype.parseMusic=function(a){s.resolveTempo(),i.is_in_header=!1;for(var o=0,c=i.iChar;e.isWhiteSpace(a[o])&&o<a.length;)o++;if(o!==a.length&&"%"!==a[o]){var l=i.start_new_line;void 0===i.continueall?i.start_new_line=!0:i.start_new_line=!1;var h=0,u=s.letter_to_body_header(a,o);u[0]>0&&(o+=u[0],"V"===u[1]&&this.startNewLine());for(var d=0;o<a.length;){var m=o;if("%"===a[o])break;var g=s.letter_to_inline_header(a,o,l);if(g[0]>0)o+=g[0],"V"===g[1]&&(l=!0);else{var v;for((!r.hasBeginMusic()||l&&!this.lineContinuation)&&(this.startNewLine(),l=!1);;)if((v=e.eatWhiteSpace(a,o))>0&&(o+=v),o>0&&""===a[o-1]&&(v=s.letter_to_body_header(a,o))[0]>0&&("V"===v[1]&&this.startNewLine(),o=v[0],i.start_new_line=!1),(v=T(a,o))[0]>0&&(o+=v[0]),(v=k(a,o))[0]>0){w.chord||(w.chord=[]);var b=e.translateString(v[1]);b=b.replace(/;/g,"\n");for(var y=!1,B=0;B<w.chord.length;B++)w.chord[B].position===v[2]&&(y=!0,w.chord[B].name+="\n"+b);!1===y&&(null===v[2]&&v[3]?w.chord.push({name:b,rel_position:v[3]}):w.chord.push({name:b,position:v[2]})),o+=v[0];var D=e.skipWhiteSpace(a.substring(o));D>0&&(w.force_end_beam_last=!0),o+=D}else if((v=-1===p.indexOf(a[o])?E(a,o):[0])[0]>0)null===v[1]?o+1<a.length&&this.startNewLine():v[1].length>0&&(0===v[1].indexOf("style=")?w.style=v[1].substr(6):(void 0===w.decoration&&(w.decoration=[]),"beambr1"===v[1]?w.beambr=1:"beambr2"===v[1]?w.beambr=2:w.decoration.push(v[1]))),o+=v[0];else{if(!((v=C(a,o))[0]>0))break;w.gracenotes=v[1],o+=v[0]}if((v=P(a,o))[0]>0){d=0,void 0!==w.gracenotes&&(w.rest={type:"spacer"},w.duration=.125,i.addFormattingOptions(w,n.formatting,"note"),r.appendElement("note",c+o,c+o+v[0],w),i.measureNotEmpty=!0,w={});var R={type:v[1]};0===R.type.length?t("Unknown bar type",a,o):(i.inEnding&&"bar_thin"!==R.type&&(R.endEnding=!0,i.inEnding=!1),v[2]&&(R.startEnding=v[2],i.inEnding&&(R.endEnding=!0),i.inEnding=!0,"bar_right_repeat"===v[1]?i.restoreStartEndingHoldOvers():i.duplicateStartEndingHoldOvers()),void 0!==w.decoration&&(R.decoration=w.decoration),void 0!==w.chord&&(R.chord=w.chord),R.startEnding&&void 0===i.barFirstEndingNum?i.barFirstEndingNum=i.currBarNumber:R.startEnding&&R.endEnding&&i.barFirstEndingNum?i.currBarNumber=i.barFirstEndingNum:R.endEnding&&(i.barFirstEndingNum=void 0),"bar_invisible"!==R.type&&i.measureNotEmpty&&O()&&(i.currBarNumber++,i.barNumbers&&i.currBarNumber%i.barNumbers==0&&(R.barNumber=i.currBarNumber)),i.addFormattingOptions(w,n.formatting,"bar"),r.appendElement("bar",c+m,c+o+v[0],R),i.measureNotEmpty=!1,w={}),o+=v[0]}else if("&"===a[o])(v=S(a,o))[0]>0&&(r.appendElement("overlay",c,c+1,{}),o+=1,d++);else{if((v=A(a,o)).consumed>0&&(void 0!==v.startSlur&&(w.startSlur=v.startSlur),v.dottedSlur&&(w.dottedSlur=!0),void 0!==v.triplet&&(h>0?t("Can't nest triplets",a,o):(w.startTriplet=v.triplet,w.tripletMultiplier=v.tripletQ/v.triplet,w.tripletR=v.num_notes,h=void 0===v.num_notes?v.triplet:v.num_notes)),o+=v.consumed),"["===a[o]){o++;for(var z=null,V=!1,q=!1;!q;){var F=E(a,o);F[0]>0&&(o+=F[0]);var j=N(a,o,{},!1);if(null!==j&&void 0!==j.pitch)F[0]>0&&0!==F[1].indexOf("style=")&&(void 0===w.decoration&&(w.decoration=[]),w.decoration.push(F[1])),j.end_beam&&(w.end_beam=!0,delete j.end_beam),void 0===w.pitches?(w.duration=j.duration,w.pitches=[j]):w.pitches.push(j),delete j.duration,F[0]>0&&0===F[1].indexOf("style=")&&(w.pitches[w.pitches.length-1].style=F[1].substr(6)),i.inTieChord[w.pitches.length]&&(j.endTie=!0,i.inTieChord[w.pitches.length]=void 0),j.startTie&&(i.inTieChord[w.pitches.length]=!0),o=j.endChar,delete j.endChar;else if(" "===a[o])t("Spaces are not allowed in chords",a,o),o++;else{if(o<a.length&&"]"===a[o]){o++,0!==i.next_note_duration&&(w.duration=w.duration*i.next_note_duration,i.next_note_duration=0),_(i,d,w)&&(w.pitches.forEach((function(e){e.endTie=!0})),x(i,d,!1)),h>0&&(!w.rest||"spacer"!==w.rest.type)&&0==--h&&(w.endTriplet=!0);for(var H=!1;o<a.length&&!H;){switch(a[o]){case" ":case"\t":I(w);break;case")":void 0===w.endSlur?w.endSlur=1:w.endSlur++;break;case"-":w.pitches.forEach((function(e){e.startTie={}})),x(i,d,!0);break;case">":case"<":var G=L(a,o);o+=G[0]-1,i.next_note_duration=G[2],z?z*=G[1]:z=G[1];break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"/":var U=e.getFraction(a,o);z=U.value;var W=a[o=U.index];" "===W&&(V=!0),"-"===W||")"===W||" "===W||"<"===W||">"===W?o--:H=!0;break;case"0":z=0;break;default:H=!0}H||o++}}else t("Expected ']' to end the chords",a,o);void 0!==w.pitches&&(null!==z&&(w.duration=w.duration*z,V&&I(w)),i.addFormattingOptions(w,n.formatting,"note"),r.appendElement("note",c+m,c+o,w),i.measureNotEmpty=!0,w={}),q=!0}}}else{var Y={},$=N(a,o,Y,!0);void 0!==Y.endTie&&x(i,d,!0),null!==$&&(void 0!==$.pitch?(w.pitches=[{}],void 0!==$.accidental&&(w.pitches[0].accidental=$.accidental),w.pitches[0].pitch=$.pitch,w.pitches[0].name=$.name,($.midipitch||0===$.midipitch)&&(w.pitches[0].midipitch=$.midipitch),void 0!==$.endSlur&&(w.pitches[0].endSlur=$.endSlur),void 0!==$.endTie&&(w.pitches[0].endTie=$.endTie),void 0!==$.startSlur&&(w.pitches[0].startSlur=$.startSlur),void 0!==w.startSlur&&(w.pitches[0].startSlur=w.startSlur),void 0!==w.dottedSlur&&(w.pitches[0].dottedSlur=!0),void 0!==$.startTie&&(w.pitches[0].startTie=$.startTie),void 0!==w.startTie&&(w.pitches[0].startTie=w.startTie)):(w.rest=$.rest,"multimeasure"===$.rest.type&&O()&&(i.currBarNumber+=$.rest.text-1),void 0!==$.endSlur&&(w.endSlur=$.endSlur),void 0!==$.endTie&&(w.rest.endTie=$.endTie),void 0!==$.startSlur&&(w.startSlur=$.startSlur),void 0!==$.startTie&&(w.rest.startTie=$.startTie),void 0!==w.startTie&&(w.rest.startTie=w.startTie)),void 0!==$.chord&&(w.chord=$.chord),void 0!==$.duration&&(w.duration=$.duration),void 0!==$.decoration&&(w.decoration=$.decoration),void 0!==$.graceNotes&&(w.graceNotes=$.graceNotes),delete w.startSlur,delete w.dottedSlur,_(i,d,w)&&(void 0!==w.pitches?w.pitches[0].endTie=!0:"spacer"!==w.rest.type&&(w.rest.endTie=!0),x(i,d,!1)),($.startTie||w.startTie)&&x(i,d,!0),o=$.endChar,h>0&&(!$.rest||"spacer"!==$.rest.type)&&0==--h&&(w.endTriplet=!0),$.end_beam&&I(w),w.rest&&"rest"===w.rest.type&&1===w.duration&&M(i)<=1&&(w.rest.type="whole",w.duration=M(i)),w.duration<1&&-1===f.indexOf(w.duration)&&0!==w.duration&&(w.rest&&"spacer"===w.rest.type||t("Duration not representable: "+a.substring(m,o),a,o)),i.addFormattingOptions(w,n.formatting,"note"),r.appendElement("note",c+m,c+o,w)||(this.startNewLine(),r.appendElement("note",c+m,c+o,w)),i.measureNotEmpty=!0,w={})}o===m&&(" "!==a[o]&&"`"!==a[o]&&t("Unknown character ignored",a,o),o++)}}}this.lineContinuation=a.indexOf("")>=0||u[0]>0,this.lineContinuation||(w={})}};var x=function(e,t,i){var n=e.currentVoice?100*e.currentVoice.staffNum+e.currentVoice.index:0;void 0===e.inTie[t]&&(e.inTie[t]=[]),e.inTie[t][n]=i},k=function(n,r){if('"'===n[r]){var s=e.getBrackettedSubstring(n,r,5);if(s[2]||t("Missing the closing quote while parsing the chord symbol",n,r),s[0]>0&&s[1].length>0&&"^"===s[1][0])s[1]=s[1].substring(1),s[2]="above";else if(s[0]>0&&s[1].length>0&&"_"===s[1][0])s[1]=s[1].substring(1),s[2]="below";else if(s[0]>0&&s[1].length>0&&"<"===s[1][0])s[1]=s[1].substring(1),s[2]="left";else if(s[0]>0&&s[1].length>0&&">"===s[1][0])s[1]=s[1].substring(1),s[2]="right";else if(s[0]>0&&s[1].length>0&&"@"===s[1][0]){s[1]=s[1].substring(1);var a=e.getFloat(s[1]);if(0===a.digits)return t("Missing first position in absolutely positioned annotation.",n,r),s[1]=s[1].replace("@",""),s[2]="above",s;if(s[1]=s[1].substring(a.digits),","!==s[1][0])return t("Missing comma absolutely positioned annotation.",n,r),s[1]=s[1].replace("@",""),s[2]="above",s;s[1]=s[1].substring(1);var c=e.getFloat(s[1]);if(0===c.digits)return t("Missing second position in absolutely positioned annotation.",n,r),s[1]=s[1].replace("@",""),s[2]="above",s;s[1]=s[1].substring(c.digits);var l=e.skipWhiteSpace(s[1]);s[1]=s[1].substring(l),s[2]=null,s[3]={x:a.value,y:c.value}}else!0!==i.freegchord&&(s[1]=s[1].replace(/([ABCDEFG0-9])b/g,"$1♭"),s[1]=s[1].replace(/([ABCDEFG0-9])#/g,"$1♯"),s[1]=s[1].replace(/^([ABCDEFG])([♯♭]?)o([^A-Za-z])/g,"$1$2°$3"),s[1]=s[1].replace(/^([ABCDEFG])([♯♭]?)o$/g,"$1$2°"),s[1]=s[1].replace(/^([ABCDEFG])([♯♭]?)0([^A-Za-z])/g,"$1$2ø$3"),s[1]=s[1].replace(/^([ABCDEFG])([♯♭]?)\^([^A-Za-z])/g,"$1$2∆$3")),s[2]="default",s[1]=o.chordName(i,s[1]);return s}return[0,""]},C=function(n,r){if("{"===n[r]){var s=e.getBrackettedSubstring(n,r,1,"}");s[2]||t("Missing the closing '}' while parsing grace note",n,r),")"===n[r+s[0]]&&(s[0]++,s[1]+=")");for(var a=[],o=0,c=!1;o<s[1].length;){var l=!1;"/"===s[1][o]&&(l=!0,o++);var h=N(s[1],o,{},!1);null!==h?(h.duration=h.duration/(8*i.default_length),l&&(h.acciaccatura=!0),h.rest?t("Rests not allowed as grace notes '"+s[1][o]+"' while parsing grace note",n,r):a.push(h),c&&(h.endTie=!0,c=!1),h.startTie&&(c=!0),o=h.endChar,delete h.endChar,h.end_beam&&(h.endBeam=!0,delete h.end_beam)):(" "===s[1][o]?a.length>0&&(a[a.length-1].endBeam=!0):t("Unknown character '"+s[1][o]+"' while parsing grace note",n,r),o++)}if(a.length)return[s[0],a]}return[0]};function S(e,t){if("&"===e[t]){for(var i=t;e[t]&&":"!==e[t]&&"|"!==e[t];)t++;return[t-i,e.substring(i+1,t)]}return[0]}function M(e){var t=e.origMeter;return t&&"specified"===t.type&&t.value&&0!==t.value.length?parseInt(t.value[0].num,10)/parseInt(t.value[0].den,10):1}var E=function(n,r){var s=i.macros[n[r]];if(void 0!==s)return"!"!==s[0]&&"+"!==s[0]||(s=s.substring(1)),"!"!==s[s.length-1]&&"+"!==s[s.length-1]||(s=s.substring(0,s.length-1)),c.includes(s)?[1,s]:l.includes(s)?("hidden"===i.volumePosition&&(s=""),[1,s]):h.includes(s)?("hidden"===i.dynamicPosition&&(s=""),[1,s]):(i.ignoredDecorations.includes(s)||t("Unknown macro: "+s,n,r),[1,""]);switch(n[r]){case".":if("("===n[r+1]||"-"===n[r+1])break;return[1,"staccato"];case"u":return[1,"upbow"];case"v":return[1,"downbow"];case"~":return[1,"irishroll"];case"!":case"+":var a=e.getBrackettedSubstring(n,r,5);if(a[1].length>1&&("^"===a[1][0]||"_"===a[1][0])&&(a[1]=a[1].substring(1)),c.includes(a[1]))return a;if(l.includes(a[1]))return"hidden"===i.volumePosition&&(a[1]=""),a;if(h.includes(a[1]))return"hidden"===i.dynamicPosition&&(a[1]=""),a;var o=u.findIndex((function(e){return a[1]===e[0]}));return o>=0?(a[1]=u[o][1],a):(o=d.findIndex((function(e){return a[1]===e[0]})))>=0?(a[1]=d[o][1],"hidden"===i.dynamicPosition&&(a[1]=""),a):"!"!==n[r]||1!==a[0]&&"!"===n[r+a[0]-1]?(t("Unknown decoration: "+a[1],n,r),a[1]="",a):[1,null];case"H":return[1,"fermata"];case"J":return[1,"slide"];case"L":return[1,"accent"];case"M":return[1,"mordent"];case"O":return[1,"coda"];case"P":return[1,"pralltriller"];case"R":return[1,"roll"];case"S":return[1,"segno"];case"T":return[1,"trill"]}return[0,0]},T=function(t,i){for(var n=i;e.isWhiteSpace(t[i]);)i++;return[i-n]},P=function(i,n){var r=e.getBarLine(i,n);if(0===r.len)return[0,""];if(r.warn)return t(r.warn,i,n),[r.len,""];for(var s=0;s<i.length&&" "===i[n+r.len+s];s++);var a=r.len;if("["===i[n+r.len+s]&&(r.len+=s+1),'"'===i[n+r.len]&&"["===i[n+r.len-1]){var o=e.getBrackettedSubstring(i,n+r.len,5);return[r.len+o[0],r.token,o[1]]}var c=e.getTokenOf(i.substring(n+r.len),"1234567890-,");return 0===c.len||"-"===c.token[0]?[a,r.token]:[r.len+c.len,r.token,c.token]},A=function(i,n){var r={},s=n;for("."===i[n]&&"("===i[n+1]&&(r.dottedSlur=!0,n++);"("===i[n]||e.isWhiteSpace(i[n]);)"("===i[n]&&(n+1<i.length&&i[n+1]>="2"&&i[n+1]<="9"?(void 0!==r.triplet?t("Can't nest triplets",i,n):(r.triplet=i[n+1]-"0",r.tripletQ=b[r.triplet],r.num_notes=r.triplet,n+2<i.length&&":"===i[n+2]&&(n+3<i.length&&":"===i[n+3]?n+4<i.length&&i[n+4]>="1"&&i[n+4]<="9"?(r.num_notes=i[n+4]-"0",n+=3):t("expected number after the two colons after the triplet to mark the duration",i,n):n+3<i.length&&i[n+3]>="1"&&i[n+3]<="9"?(r.tripletQ=i[n+3]-"0",n+4<i.length&&":"===i[n+4]?n+5<i.length&&i[n+5]>="1"&&i[n+5]<="9"&&(r.num_notes=i[n+5]-"0",n+=4):n+=2):t("expected number after the triplet to mark the duration",i,n))),n++):void 0===r.startSlur?r.startSlur=1:r.startSlur++),n++;return r.consumed=n-s,r};y.prototype.startNewLine=function(){var e={startChar:-1,endChar:-1};i.partForNextLine.title&&(e.part=i.partForNextLine),e.clef=i.currentVoice&&void 0!==i.staves[i.currentVoice.staffNum].clef?Object.assign({},i.staves[i.currentVoice.staffNum].clef):Object.assign({},i.clef);var t=i.currentVoice?i.currentVoice.scoreTranspose:0;if(e.key=a.standardKey(i.key.root+i.key.acc+i.key.mode,i.key.root,i.key.acc,t),e.key.mode=i.key.mode,i.key.impliedNaturals&&(e.key.impliedNaturals=i.key.impliedNaturals),i.key.explicitAccidentals)for(var n=0;n<i.key.explicitAccidentals.length;n++){for(var s=!1,o=0;o<e.key.accidentals.length;o++)e.key.accidentals[o].note===i.key.explicitAccidentals[n].note&&(e.key.accidentals[o].acc=i.key.explicitAccidentals[n].acc,s=!0);s||e.key.accidentals.push(i.key.explicitAccidentals[n])}if(i.targetKey=e.key,e.key.explicitAccidentals&&delete e.key.explicitAccidentals,a.addPosToKey(e.clef,e.key),null!==i.meter?(i.currentVoice?(i.staves.forEach((function(e){e.meter=i.meter})),e.meter=i.staves[i.currentVoice.staffNum].meter,i.staves[i.currentVoice.staffNum].meter=null):e.meter=i.meter,i.meter=null):i.currentVoice&&i.staves[i.currentVoice.staffNum].meter&&(e.meter=i.staves[i.currentVoice.staffNum].meter,i.staves[i.currentVoice.staffNum].meter=null),i.currentVoice&&i.currentVoice.name&&(e.name=i.currentVoice.name),i.vocalfont&&(e.vocalfont=i.vocalfont),i.tripletfont&&(e.tripletfont=i.tripletfont),i.gchordfont&&(e.gchordfont=i.gchordfont),i.style&&(e.style=i.style),i.currentVoice){var c=i.staves[i.currentVoice.staffNum];c.brace&&(e.brace=c.brace),c.bracket&&(e.bracket=c.bracket),c.connectBarLines&&(e.connectBarLines=c.connectBarLines),c.name&&(e.name=c.name[i.currentVoice.index]),c.subname&&(e.subname=c.subname[i.currentVoice.index]),i.currentVoice.stem&&(e.stem=i.currentVoice.stem),i.currentVoice.stafflines&&(e.stafflines=i.currentVoice.stafflines),i.currentVoice.staffscale&&(e.staffscale=i.currentVoice.staffscale),i.currentVoice.scale&&(e.scale=i.currentVoice.scale),i.currentVoice.color&&(e.color=i.currentVoice.color),i.currentVoice.style&&(e.style=i.currentVoice.style),i.currentVoice.transpose&&(e.clef.transpose=i.currentVoice.transpose),e.currentVoice=i.currentVoice;for(var l=Object.keys(i.voices),h=0;h<l.length;h++)e.currentVoice.staffNum===i.voices[l[h]].staffNum&&e.currentVoice.index===i.voices[l[h]].index&&(e.currentVoiceName=l[h])}0===i.barNumbers&&O()&&1!==i.currBarNumber&&(e.barNumber=i.currBarNumber),r.startNewLine(e),i.key.impliedNaturals&&delete i.key.impliedNaturals,i.partForNextLine={},4===i.tempoForNextLine.length&&r.appendElement(i.tempoForNextLine[0],i.tempoForNextLine[1],i.tempoForNextLine[2],i.tempoForNextLine[3]),i.tempoForNextLine=[]};var I=function(e){return void 0!==e.duration&&e.duration<.25&&(e.end_beam=!0),e},N=function(t,s,a,c){var l,h=function(e){return"octave"===e||"duration"===e||"Zduration"===e||"broken_rhythm"===e||"end_slur"===e};"."===t[s]&&"-"===t[s+1]&&(l=!0,s++);for(var u="startSlur",d=!1;;){switch(t[s]){case"(":if("startSlur"!==u)return h(u)?(a.endChar=s,a):null;void 0===a.startSlur?a.startSlur=1:a.startSlur++;break;case")":if(!h(u))return null;void 0===a.endSlur?a.endSlur=1:a.endSlur++;break;case"^":if("startSlur"===u)a.accidental="sharp",u="sharp2";else{if("sharp2"!==u)return h(u)?(a.endChar=s,a):null;a.accidental="dblsharp",u="pitch"}break;case"_":if("startSlur"===u)a.accidental="flat",u="flat2";else{if("flat2"!==u)return h(u)?(a.endChar=s,a):null;a.accidental="dblflat",u="pitch"}break;case"=":if("startSlur"!==u)return h(u)?(a.endChar=s,a):null;a.accidental="natural",u="pitch";break;case"A":case"B":case"C":case"D":case"E":case"F":case"G":case"a":case"b":case"c":case"d":case"e":case"f":case"g":if("startSlur"!==u&&"sharp2"!==u&&"flat2"!==u&&"pitch"!==u)return h(u)?(a.endChar=s,a):null;if(a.pitch=m[t[s]],a.pitch+=7*(i.currentVoice&&void 0!==i.currentVoice.octave?i.currentVoice.octave:i.octave),a.name=t[s],a.accidental&&(a.name=v[a.accidental]+a.name),o.note(i,a),u="octave",c&&0!==i.next_note_duration?(a.duration=i.default_length*i.next_note_duration,i.next_note_duration=0,d=!0):a.duration=i.default_length,i.clef&&"perc"===i.clef.type||i.currentVoice&&"perc"===i.currentVoice.clef){var p=t[s];a.accidental&&(p=v[a.accidental]+p),n.formatting&&n.formatting.midi&&n.formatting.midi.drummap&&(a.midipitch=n.formatting.midi.drummap[p])}break;case",":if("octave"!==u)return h(u)?(a.endChar=s,a):null;a.pitch-=7,a.name+=",";break;case"'":if("octave"!==u)return h(u)?(a.endChar=s,a):null;a.pitch+=7,a.name+="'";break;case"x":case"X":case"y":case"z":case"Z":if("startSlur"!==u)return h(u)?(a.endChar=s,a):null;a.rest={type:g[t[s]]},delete a.accidental,delete a.startSlur,delete a.startTie,delete a.endSlur,delete a.endTie,delete a.end_beam,delete a.grace_notes,a.rest.type.indexOf("multimeasure")>=0?(a.duration=n.getBarLength(),a.rest.text=1,u="Zduration"):(c&&0!==i.next_note_duration?(a.duration=i.default_length*i.next_note_duration,i.next_note_duration=0,d=!0):a.duration=i.default_length,u="duration");break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"0":case"/":if("octave"===u||"duration"===u){var f=e.getFraction(t,s);for(a.duration=a.duration*f.value,a.endChar=f.index;f.index<t.length&&(e.isWhiteSpace(t[f.index])||"-"===t[f.index]);)"-"===t[f.index]?a.startTie={}:a=I(a),f.index++;s=f.index-1,u="broken_rhythm"}else if("sharp2"===u)a.accidental="quartersharp",u="pitch";else{if("flat2"!==u){if("Zduration"===u){var b=e.getNumber(t,s);return a.duration=b.num*n.getBarLength(),a.rest.text=b.num,a.endChar=b.index,a}return null}a.accidental="quarterflat",u="pitch"}break;case"-":if("startSlur"===u)r.addTieToLastNote(l),a.endTie=!0;else{if("octave"!==u&&"duration"!==u&&"end_slur"!==u)return"broken_rhythm"===u?(a.endChar=s,a):null;if(a.startTie={},d||!c)return e.isWhiteSpace(t[s+1])&&I(a),a.endChar=s+1,a;u="broken_rhythm"}break;case" ":case"\t":if(!h(u))return null;a.end_beam=!0,l=!1;do{"."===t[s]&&"-"===t[s+1]&&(l=!0,s++),"-"===t[s]&&(a.startTie={},l&&(a.startTie.style="dotted")),s++}while(s<t.length&&(e.isWhiteSpace(t[s])||"-"===t[s])||"."===t[s]&&"-"===t[s+1]);if(a.endChar=s,d||!c||"<"!==t[s]&&">"!==t[s])return a;s--,u="broken_rhythm";break;case">":case"<":if(!h(u))return null;if(!c)return a.endChar=s,a;var y=L(t,s);s+=y[0]-1,i.next_note_duration=y[2],a.duration=y[1]*a.duration,u="end_slur";break;default:return h(u)?(a.endChar=s,a):null}if(++s===t.length)return h(u)?(a.endChar=s,a):null}return null},L=function(e,t){switch(e[t]){case">":return t<e.length-2&&">"===e[t+1]&&">"===e[t+2]?[3,1.875,.125]:t<e.length-1&&">"===e[t+1]?[2,1.75,.25]:[1,1.5,.5];case"<":return t<e.length-2&&"<"===e[t+1]&&"<"===e[t+2]?[3,.125,1.875]:t<e.length-1&&"<"===e[t+1]?[2,.25,1.75]:[1,.5,1.5]}return null};function O(){return void 0===i.currentVoice||0===i.currentVoice.staffNum&&0===i.currentVoice.index}return Vo=y}(),a=function(){if(jo)return Fo;jo=1;var e=Io(),t=function(t,i){this.lineIndex=0,this.lines=t,this.multilineVars=i,this.skipWhiteSpace=function(e){for(var t=0;t<e.length;t++)if(!this.isWhiteSpace(e[t]))return t;return e.length};var n=function(e,t){return t>=e.length};this.eatWhiteSpace=function(e,t){for(var i=t;i<e.length;i++)if(!this.isWhiteSpace(e[i]))return i-t;return i-t},this.getKeyPitch=function(e){var t=this.skipWhiteSpace(e);if(n(e,t))return{len:0};switch(e[t]){case"A":return{len:t+1,token:"A"};case"B":return{len:t+1,token:"B"};case"C":return{len:t+1,token:"C"};case"D":return{len:t+1,token:"D"};case"E":return{len:t+1,token:"E"};case"F":return{len:t+1,token:"F"};case"G":return{len:t+1,token:"G"}}return{len:0}},this.getSharpFlat=function(e){if("bass"===e)return{len:0};switch(e[0]){case"#":return{len:1,token:"#"};case"b":return{len:1,token:"b"}}return{len:0}},this.getMode=function(e){var t=function(e,t){for(;t<e.length&&(e[t]>="a"&&e[t]<="z"||e[t]>="A"&&e[t]<="Z");)t++;return t},i=this.skipWhiteSpace(e);if(n(e,i))return{len:0};var r=e.substring(i,i+3).toLowerCase();switch((r.length>1&&" "===r[1]||"^"===r[1]||"_"===r[1]||"="===r[1])&&(r=r[0]),r){case"mix":return{len:t(e,i),token:"Mix"};case"dor":return{len:t(e,i),token:"Dor"};case"phr":return{len:t(e,i),token:"Phr"};case"lyd":return{len:t(e,i),token:"Lyd"};case"loc":return{len:t(e,i),token:"Loc"};case"aeo":case"min":case"m":return{len:t(e,i),token:"m"};case"maj":case"ion":return{len:t(e,i),token:""}}return{len:0}},this.getClef=function(t,i){var r=t,s=this.skipWhiteSpace(t);if(n(t,s))return{len:0};var a=!1,o=t.substring(s);if(e.startsWith(o,"clef=")&&(a=!0,o=o.substring(5),s+=5),0===o.length&&a)return{len:s+5,warn:"No clef specified: "+r};var c=this.skipWhiteSpace(o);if(n(o,c))return{len:0};c>0&&(s+=c,o=o.substring(c));var l=null;if(e.startsWith(o,"treble"))l="treble";else if(e.startsWith(o,"bass3"))l="bass3";else if(e.startsWith(o,"bass"))l="bass";else if(e.startsWith(o,"tenor"))l="tenor";else if(e.startsWith(o,"alto2"))l="alto2";else if(e.startsWith(o,"alto1"))l="alto1";else if(e.startsWith(o,"alto"))l="alto";else if(!i&&a&&e.startsWith(o,"none"))l="none";else if(e.startsWith(o,"perc"))l="perc";else if(!i&&a&&e.startsWith(o,"C"))l="tenor";else if(!i&&a&&e.startsWith(o,"F"))l="bass";else{if(i||!a||!e.startsWith(o,"G"))return{len:s+5,warn:"Unknown clef specified: "+r};l="treble"}return o=o.substring(l.length),(c=this.isMatch(o,"+8"))>0?l+="+8":(c=this.isMatch(o,"-8"))>0&&(l+="-8"),{len:s+l.length,token:l,explicit:a}},this.getBarLine=function(e,t){switch(e[t]){case"]":switch(e[++t]){case"|":return{len:2,token:"bar_thick_thin"};case"[":return e[++t]>="1"&&e[t]<="9"||'"'===e[t]?{len:2,token:"bar_invisible"}:{len:1,warn:"Unknown bar symbol"};default:return{len:1,token:"bar_invisible"}}case":":switch(e[++t]){case":":return{len:2,token:"bar_dbl_repeat"};case"|":switch(e[++t]){case"]":return"|"===e[++t]&&":"===e[++t]?{len:5,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};case"|":return":"===e[++t]?{len:4,token:"bar_dbl_repeat"}:{len:3,token:"bar_right_repeat"};default:return{len:2,token:"bar_right_repeat"}}default:return{len:1,warn:"Unknown bar symbol"}}case"[":if("|"!==e[++t])return e[t]>="1"&&e[t]<="9"||'"'===e[t]?{len:1,token:"bar_invisible"}:{len:0};switch(e[++t]){case":":return{len:3,token:"bar_left_repeat"};case"]":return{len:3,token:"bar_invisible"};default:return{len:2,token:"bar_thick_thin"}}case"|":switch(e[++t]){case"]":return{len:2,token:"bar_thin_thick"};case"|":return":"===e[++t]?{len:3,token:"bar_left_repeat"}:{len:2,token:"bar_thin_thin"};case":":for(var i=0;":"===e[t+i];)i++;return{len:1+i,token:"bar_left_repeat"};default:return{len:1,token:"bar_thin"}}}return{len:0}},this.getTokenOf=function(e,t){for(var i=0;i<e.length;i++)if(t.indexOf(e[i])<0)return{len:i,token:e.substring(0,i)};return{len:i,token:e}},this.getToken=function(e,t,i){for(var n=t;n<i&&!this.isWhiteSpace(e[n]);)n++;return e.substring(t,n)},this.isMatch=function(t,i){var r=this.skipWhiteSpace(t);return n(t,r)?0:e.startsWith(t.substring(r),i)?r+i.length:0},this.getPitchFromTokens=function(e){var t={};if(t.position={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11}[e[0].token],void 0===t.position)return{warn:"Pitch expected. Found: "+e[0].token};for(e.shift();e.length;)switch(e[0].token){case",":t.position-=7,e.shift();break;case"'":t.position+=7,e.shift();break;default:return t}return t},this.getKeyAccidentals2=function(e){for(var t;e.length>0;){var i;if("^"===e[0].token){if(i="sharp",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+i};switch(e[0].token){case"^":i="dblsharp",e.shift();break;case"/":i="quartersharp",e.shift()}}else if("="===e[0].token)i="natural",e.shift();else{if("_"!==e[0].token)return{accs:t};if(i="flat",e.shift(),0===e.length)return{accs:t,warn:"Expected note name after "+i};switch(e[0].token){case"_":i="dblflat",e.shift();break;case"/":i="quarterflat",e.shift()}}if(0===e.length)return{accs:t,warn:"Expected note name after "+i};switch(e[0].token[0]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":void 0===t&&(t=[]),t.push({acc:i,note:e[0].token[0]}),1===e[0].token.length?e.shift():e[0].token=e[0].token.substring(1);break;default:return{accs:t,warn:"Expected note name after "+i+" Found: "+e[0].token}}}return{accs:t}},this.getKeyAccidental=function(e){var t={"^":"sharp","^^":"dblsharp","=":"natural",_:"flat",__:"dblflat","_/":"quarterflat","^/":"quartersharp"},i=this.skipWhiteSpace(e);if(n(e,i))return{len:0};var r=null;switch(e[i]){case"^":case"_":case"=":r=e[i];break;default:return{len:0}}if(i++,n(e,i))return{len:1,warn:"Expected note name after accidental"};switch(e[i]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:i+1,token:{acc:t[r],note:e[i]}};case"^":case"_":case"/":if(r+=e[i],i++,n(e,i))return{len:2,warn:"Expected note name after accidental"};switch(e[i]){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:i+1,token:{acc:t[r],note:e[i]}};default:return{len:2,warn:"Expected note name after accidental"}}break;default:return{len:1,warn:"Expected note name after accidental"}}},this.isWhiteSpace=function(e){return" "===e||"\t"===e||""===e},this.getMeat=function(e,t,i){var n=e.indexOf("%",t);for(n>=0&&n<i&&(i=n);t<i&&(" "===e[t]||"\t"===e[t]||""===e[t]);)t++;for(;t<i&&(" "===e[i-1]||"\t"===e[i-1]||""===e[i-1]);)i--;return{start:t,end:i}};var r=function(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"},s=function(e){return e>="0"&&e<="9"};this.tokenize=function(e,t,i,n){var a=this.getMeat(e,t,i);t=a.start,i=a.end;for(var o,c=[];t<i;){if('"'===e[t]){for(o=t+1;o<i&&'"'!==e[o];)o++;c.push({type:"quote",token:e.substring(t+1,o),start:t+1,end:o}),o++}else if(r(e[t])){if(o=t+1,n)for(;o<i&&!this.isWhiteSpace(e[o]);)o++;else for(;o<i&&r(e[o]);)o++;c.push({type:"alpha",token:e.substring(t,o),continueId:s(e[o]),start:t,end:o}),t=o+1}else if("."===e[t]&&s(e[o+1])){o=t+1;for(var l;o<i&&s(e[o]);)o++;l=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:null,floatt:l,continueId:r(e[o]),start:t,end:o}),t=o+1}else if(s(e[t])||"-"===e[t]&&s(e[o+1])){o=t+1;for(var h,u=null;o<i&&s(e[o]);)o++;if("."===e[o]&&s(e[o+1]))for(o++;o<i&&s(e[o]);)o++;else u=parseInt(e.substring(t,o));h=parseFloat(e.substring(t,o)),c.push({type:"number",token:e.substring(t,o),intt:u,floatt:h,continueId:r(e[o]),start:t,end:o}),t=o+1}else" "===e[t]||"\t"===e[t]||c.push({type:"punct",token:e[t],start:t,end:t+1}),o=t+1;t=o}return c},this.getVoiceToken=function(e,t,i){for(var n=t;n<i&&this.isWhiteSpace(e[n])||"="===e[n];)n++;if('"'===e[n]){var r=e.indexOf('"',n+1);return-1===r||r>=i?{len:1,err:"Missing close quote"}:{len:r-t+1,token:this.translateString(e.substring(n+1,r))}}for(var s=n;s<i&&!this.isWhiteSpace(e[s])&&"="!==e[s];)s++;return{len:s-t+1,token:e.substring(n,s)}};var a={"`a":"à","'a":"á","^a":"â","~a":"ã",'"a':"ä",oa:"å",aa:"å","=a":"ā",ua:"ă",";a":"ą","`e":"è","'e":"é","^e":"ê",'"e':"ë","=e":"ē",ue:"ĕ",";e":"ę",".e":"ė","`i":"ì","'i":"í","^i":"î",'"i':"ï","=i":"ī",ui:"ĭ",";i":"į","`o":"ò","'o":"ó","^o":"ô","~o":"õ",'"o':"ö","=o":"ō",uo:"ŏ","/o":"ø","`u":"ù","'u":"ú","^u":"û","~u":"ũ",'"u':"ü",ou:"ů","=u":"ū",uu:"ŭ",";u":"ų","`A":"À","'A":"Á","^A":"Â","~A":"Ã",'"A':"Ä",oA:"Å",AA:"Å","=A":"Ā",uA:"Ă",";A":"Ą","`E":"È","'E":"É","^E":"Ê",'"E':"Ë","=E":"Ē",uE:"Ĕ",";E":"Ę",".E":"Ė","`I":"Ì","'I":"Í","^I":"Î","~I":"Ĩ",'"I':"Ï","=I":"Ī",uI:"Ĭ",";I":"Į",".I":"İ","`O":"Ò","'O":"Ó","^O":"Ô","~O":"Õ",'"O':"Ö","=O":"Ō",uO:"Ŏ","/O":"Ø","`U":"Ù","'U":"Ú","^U":"Û","~U":"Ũ",'"U':"Ü",oU:"Ů","=U":"Ū",uU:"Ŭ",";U":"Ų",ae:"æ",AE:"Æ",oe:"œ",OE:"Œ",ss:"ß","'c":"ć","^c":"ĉ",uc:"č",cc:"ç",".c":"ċ",cC:"Ç","'C":"Ć","^C":"Ĉ",uC:"Č",".C":"Ċ","~N":"Ñ","~n":"ñ","=s":"š",vs:"š",DH:"Ð",dh:"ð",HO:"Ő",Ho:"ő",HU:"Ű",Hu:"ű","'Y":"Ý","'y":"ý","^Y":"Ŷ","^y":"ŷ",'"Y':"Ÿ",'"y':"ÿ",vS:"Š",vZ:"Ž",vz:"ž"},o={"#":"♯",b:"♭","=":"♮"},c={201:"♯",202:"♭",203:"♮",241:"¡",242:"¢",252:"a",262:"2",272:"o",302:"Â",312:"Ê",322:"Ò",332:"Ú",342:"â",352:"ê",362:"ò",372:"ú",243:"£",253:"«",263:"3",273:"»",303:"Ã",313:"Ë",323:"Ó",333:"Û",343:"ã",353:"ë",363:"ó",373:"û",244:"¤",254:"¬",264:" ́",274:"1⁄4",304:"Ä",314:"Ì",324:"Ô",334:"Ü",344:"ä",354:"ì",364:"ô",374:"ü",245:"¥",255:"-",265:"μ",275:"1⁄2",305:"Å",315:"Í",325:"Õ",335:"Ý",345:"å",355:"í",365:"õ",375:"ý",246:"¦",256:"®",266:"¶",276:"3⁄4",306:"Æ",316:"Î",326:"Ö",336:"Þ",346:"æ",356:"î",366:"ö",376:"þ",247:"§",257:" ̄",267:"·",277:"¿",307:"Ç",317:"Ï",327:"×",337:"ß",347:"ç",357:"ï",367:"÷",377:"ÿ",250:" ̈",260:"°",270:" ̧",300:"À",310:"È",320:"Ð",330:"Ø",340:"à",350:"è",360:"ð",370:"ø",251:"©",261:"±",271:"1",301:"Á",311:"É",321:"Ñ",331:"Ù",341:"á",351:"é",361:"ñ",371:"ù"};function l(e){const t=/^(\d+)\./.exec(e);return t?t[1]:null}this.translateString=function(e){var t=e.split("\\");if(1===t.length)return e;var i=null;return t.forEach((function(e){if(null===i)i=e;else{var t=a[e.substring(0,2)];void 0!==t?i+=t+e.substring(2):void 0!==(t=c[e.substring(0,3)])?i+=t+e.substring(3):(t=o[e.substring(0,1)],i+=void 0!==t?t+e.substring(1):"\\"+e)}})),i},this.getNumber=function(e,t){for(var i=0;t<e.length;)switch(e[t]){case"0":i*=10,t++;break;case"1":i=10*i+1,t++;break;case"2":i=10*i+2,t++;break;case"3":i=10*i+3,t++;break;case"4":i=10*i+4,t++;break;case"5":i=10*i+5,t++;break;case"6":i=10*i+6,t++;break;case"7":i=10*i+7,t++;break;case"8":i=10*i+8,t++;break;case"9":i=10*i+9,t++;break;default:return{num:i,index:t}}return{num:i,index:t}},this.getFraction=function(e,t){var i=1,n=1;if("/"!==e[t]){var r=this.getNumber(e,t);i=r.num,t=r.index}if("/"===e[t]){if("/"===e[++t]){for(var s=.5;"/"===e[t++];)s/=2;return{value:i*s,index:t-1}}var a=t,o=this.getNumber(e,t);0===o.num&&a===t&&(o.num=2),0!==o.num&&(n=o.num),t=o.index}return{value:i/n,index:t}};var h=[{match:/,\s*[Tt]he$/,replace:"The "},{match:/,\s*[Aa]$/,replace:"A "},{match:/,\s*[Aa]n$/,replace:"An "}];this.theReverser=function(e){for(var t=0;t<h.length;t++){var i=h[t],n=e.match(i.match);if(n){var r=l(e);r&&(e=(e=e.replace(r+".","")).trim());var s=n[0].length,a=i.replace+e.substring(0,e.length-s);return r&&(a=r+". "+a),a}}return e},this.stripComment=function(t){var i=t.indexOf("%");return i>=0?e.strip(t.substring(0,i)):e.strip(t)},this.getInt=function(e){var t=parseInt(e);if(isNaN(t))return{digits:0};var i=""+t;return{value:t,digits:e.indexOf(i)+i.length}},this.getFloat=function(e){var t=parseFloat(e);if(isNaN(t))return{digits:0};var i=""+t;return{value:t,digits:e.indexOf(i)+i.length}},this.getMeasurement=function(e){if(0===e.length)return{used:0};var t=1,i="";if("-"===e[0].token)e.shift(),i="-",t++;else if("number"!==e[0].type)return{used:0};if(i+=e.shift().token,0===e.length)return{used:1,value:parseInt(i)};var n=e.shift();if("."===n.token){if(t++,0===e.length)return{used:t,value:parseInt(i)};if("number"===e[0].type&&(i=i+"."+(n=e.shift()).token,t++,0===e.length))return{used:t,value:parseFloat(i)};n=e.shift()}switch(n.token){case"pt":case"px":return{used:t+1,value:parseFloat(i)};case"cm":return{used:t+1,value:parseFloat(i)/2.54*72};case"in":return{used:t+1,value:72*parseFloat(i)};default:return e.unshift(n),{used:t,value:parseFloat(i)}}};var u=function(e){return(e=e.replace(/\\n/g,"\n")).replace(/\\"/g,'"')};this.getBrackettedSubstring=function(e,t,i,n){for(var r=n||e[t],s=t+1,a=!1;s<e.length&&(a||e[s]!==r);)a="\\"===e[s],++s;return e[s]===r?[s-t+1,u(e.substring(t+1,s)),!0]:((s=t+i)>e.length-1&&(s=e.length-1),[s-t+1,u(e.substring(t+1,s)),!1])}};return t.prototype.peekLine=function(){return this.lines[this.lineIndex]},t.prototype.nextLine=function(){if(this.lineIndex>0&&(this.multilineVars.iChar+=this.lines[this.lineIndex-1].length+1),this.lineIndex<this.lines.length){var e=this.lines[this.lineIndex];return this.lineIndex++,e}return null},Fo=t}(),o=zd(),c=jd(),l=function(){if(ac)return sc;ac=1;var e=Ro();function t(e){if(!e)return!1;if("string"==typeof e)return!1;for(var t=0;t<e.length;t++)if("string"!=typeof e[t])return!1;return!0}function n(e){for(var t=!1,i=[],n=0;n<e.lines.length;n++){var s=e.lines[n];if(s.staff)for(var a=0;a<s.staff.length;a++){for(var o=s.staff[a],c=[],l=0;l<o.voices.length;l++){var h=o.voices[l];c.push({hasOverlay:!1,voice:[],snip:[]}),i[n]=0;for(var u=0,d=!1,p=-1,f=0;f<h.length;f++){var m=h[f];if("overlay"!==m.el_type||d)"bar"===m.el_type?(d?(d=!1,c[l].snip.push({start:p,len:f-p}),c[l].voice.push(m)):(u>0&&c[l].voice.push({el_type:"note",duration:u,rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}),c[l].voice.push(m)),u=0):"note"===m.el_type?d?c[l].voice.push(m):(u+=m.duration,i[n]+=m.duration):"scale"!==m.el_type&&"stem"!==m.el_type&&"overlay"!==m.el_type&&"style"!==m.el_type&&"transpose"!==m.el_type&&"color"!==m.el_type||c[l].voice.push(m);else{t=!0,d=!0,p=f,c[l].hasOverlay=!0;for(var g=0;g<n;g++)i[g]&&e.lines[g].staff&&o.voices.length>=e.lines[g].staff[0].voices.length&&e.lines[g].staff[0].voices.push([{el_type:"note",duration:i[g],rest:{type:"invisible"},startChar:m.startChar,endChar:m.endChar}])}}c[l].hasOverlay&&0===c[l].snip.length&&c[l].snip.push({start:p,len:h.length-p})}for(l=0;l<c.length;l++){var v=c[l];if(v.hasOverlay){v.voice.splice(0,0,{el_type:"stem",direction:"down"}),o.voices.push(v.voice);for(var b=v.snip.length-1;b>=0;b--){var y=v.snip[b];o.voices[l].splice(y.start,y.len),o.voices[l].splice(y.start+1,0,{el_type:"stem",direction:"auto"});var _=r(o.voices[l],y.start);o.voices[l].splice(_,0,{el_type:"stem",direction:"up"})}for(b=0;b<o.voices[o.voices.length-1].length;b++){o.voices[o.voices.length-1][b]=Object.assign({},o.voices[o.voices.length-1][b]);var w=o.voices[o.voices.length-1][b];"bar"===w.el_type&&w.startEnding&&delete w.startEnding,"bar"===w.el_type&&w.endEnding&&delete w.endEnding}}}}}return t}function r(e,t){for(var i=t-1;i>0&&"bar"!==e[i].el_type;i--);return i}function a(e,t,i,n){var r;n[t]||(n[t]=[]),n[t][i]||(n[t][i]=[]);for(var s=function(e,s,a){if(void 0===n[t][i][a]){for(r=0;r<n[t][i].length;r++)if(void 0!==n[t][i][r]){a=r;break}if(void 0===n[t][i][a]){var o=100*a+1;e.endSlur.forEach((function(e){o===e&&--o})),n[t][i][a]=[o]}}for(var c,l=0;l<s;l++)c=n[t][i][a].pop(),e.endSlur.push(c);return 0===n[t][i][a].length&&delete n[t][i][a],c},a=function(e,r,s,a){e.startSlur=[],void 0===n[t][i][s]&&(n[t][i][s]=[]);for(var o=100*s+1,c=0;c<r;c++)a&&(a.forEach((function(e){o===e&&++o})),a.forEach((function(e){o===e&&++o})),a.forEach((function(e){o===e&&++o}))),n[t][i][s].forEach((function(e){o===e&&++o})),n[t][i][s].forEach((function(e){o===e&&++o})),n[t][i][s].push(o),e.startSlur.push({label:o}),e.dottedSlur&&(e.startSlur[e.startSlur.length-1].style="dotted",delete e.dottedSlur),o++},o=0;o<e.length;o++){var c=e[o];if("note"===c.el_type){if(c.gracenotes)for(var l=0;l<c.gracenotes.length;l++){if(c.gracenotes[l].endSlur){var h=c.gracenotes[l].endSlur;c.gracenotes[l].endSlur=[];for(var u=0;u<h;u++)s(c.gracenotes[l],1,20)}c.gracenotes[l].startSlur&&(r=c.gracenotes[l].startSlur,a(c.gracenotes[l],r,20))}if(c.endSlur&&(r=c.endSlur,c.endSlur=[],s(c,r,0)),c.startSlur&&a(c,r=c.startSlur,0),c.pitches){for(var d=[],p=0;p<c.pitches.length;p++)if(c.pitches[p].endSlur){var f=c.pitches[p].endSlur;c.pitches[p].endSlur=[];for(var m=0;m<f;m++){var g=s(c.pitches[p],1,p+1);d.push(g)}}for(p=0;p<c.pitches.length;p++)c.pitches[p].startSlur&&(r=c.pitches[p].startSlur,a(c.pitches[p],r,p+1,d));c.gracenotes&&c.pitches[0].endSlur&&100===c.pitches[0].endSlur[0]&&c.pitches[0].startSlur&&(c.gracenotes[0].endSlur?c.gracenotes[0].endSlur.push(c.pitches[0].startSlur[0].label):c.gracenotes[0].endSlur=[c.pitches[0].startSlur[0].label],1===c.pitches[0].endSlur.length?delete c.pitches[0].endSlur:100===c.pitches[0].endSlur[0]?c.pitches[0].endSlur.shift():100===c.pitches[0].endSlur[c.pitches[0].endSlur.length-1]&&c.pitches[0].endSlur.pop(),1===n[t][i][1].length?delete n[t][i][1]:n[t][i][1].pop())}}}}function o(e,t){for(i=0;i<e.length;i++)if(void 0!==e[i].staff)for(s=0;s<e[i].staff.length;s++){var n=[];for(v=0;v<e[i].staff[s].voices.length;v++)for(var r=e[i].staff[s].voices[v],a=0,o=0;o<r.length;o++)if("bar"===r[o].el_type){if(++a>=t&&o<r.length-1){var l=c(e,i);if(!l){var h=JSON.parse(JSON.stringify(e[i]));e.push(Object.assign({},h)),l=e[e.length-1];for(var u=0;u<l.staff.length;u++)for(var d=0;d<l.staff[u].voices.length;d++)l.staff[u].voices[d]=[]}var p=o+1,f=e[i].staff[s].voices[v].slice(p);return e[i].staff[s].voices[v]=e[i].staff[s].voices[v].slice(0,p),l.staff[s].voices[v]=n.concat(f.concat(l.staff[s].voices[v])),!0}}else r[o].duration||n.push(r[o])}return!1}function c(e,t){for(t++;e.length>t;){if(e[t].staff)return e[t];t++}return null}function l(e){e.potentialStartBeam&&e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function h(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type||"bar"===e[t].el_type)return!0;return!1}function u(e){for(var t=0;t<e.length;t++)if("note"===e[t].el_type&&(void 0===e[t].rest||void 0!==e[t].chord))return!0;return!1}function d(e,t){e.vskipPending&&(t.vskip=e.vskipPending,delete e.vskipPending),e.lines.push(t)}function p(e){void 0!==e.potentialStartBeam&&void 0!==e.potentialEndBeam&&(e.potentialStartBeam.startBeam=!0,e.potentialEndBeam.endBeam=!0),delete e.potentialStartBeam,delete e.potentialEndBeam}function f(e,t,i){if(e.runningFonts[t]){for(var n=!1,r=Object.keys(i),s=0;s<r.length;s++)e.runningFonts[t][r[s]]!==i[r[s]]&&(n=!0);n&&(e.lines[e.lineNum].staff[e.staffNum][t]=i)}e.runningFonts[t]=i}function m(e,t,i){var n=t.lines[t.lineNum].staff[t.staffNum];if(n.voices[t.voiceNum]=[],n.title||(n.title=[]),n.title[t.voiceNum]={name:i.name,subname:i.subname},i.style&&e.appendElement("style",null,null,{head:i.style}),i.stem)e.appendElement("stem",null,null,{direction:i.stem});else if(t.voiceNum>0){if(void 0!==n.voices[0]){for(var r=!1,s=0;s<n.voices[0].length;s++)"stem"===n.voices[0].el_type&&(r=!0);r||n.voices[0].splice(0,0,{el_type:"stem",direction:"up"})}e.appendElement("stem",null,null,{direction:"down"})}i.scale&&e.appendElement("scale",null,null,{size:i.scale}),i.color&&e.appendElement("color",null,null,{color:i.color})}function g(e,t,i){i.key&&i.key.impliedNaturals&&(i.key.accidentals=i.key.accidentals.concat(i.key.impliedNaturals),delete i.key.impliedNaturals),t.lines[t.lineNum].staff[t.staffNum]={voices:[],clef:i.clef,key:i.key,workingClef:i.clef};var n=t.lines[t.lineNum].staff[t.staffNum];void 0!==i.stafflines&&(n.clef.stafflines=i.stafflines,n.workingClef.stafflines=i.stafflines),i.staffscale&&(n.staffscale=i.staffscale),i.annotationfont&&f(t,"annotationfont",i.annotationfont),i.gchordfont&&f(t,"gchordfont",i.gchordfont),i.tripletfont&&f(t,"tripletfont",i.tripletfont),i.vocalfont&&f(t,"vocalfont",i.vocalfont),i.bracket&&(n.bracket=i.bracket),i.brace&&(n.brace=i.brace),i.connectBarLines&&(n.connectBarLines=i.connectBarLines),i.barNumber&&(n.barNumber=i.barNumber),m(e,t,i),i.part&&e.appendElement("part",i.part.startChar,i.part.endChar,{title:i.part.title}),void 0!==i.meter&&(n.meter=i.meter),t.vskipPending&&(t.lines[t.lineNum].vskip=t.vskipPending,delete t.vskipPending)}return sc=function(i){var r=this,s={},f="";i.reset(),this.setVisualTranspose=function(e){e&&(i.visualTranspose=e)},this.cleanUp=function(r,s,d){var p;l(i),delete i.runningFonts,t((p=i).metaText.notes)&&(p.metaText.notes=p.metaText.notes.join("\n")),t(p.metaText.history)&&(p.metaText.history=p.metaText.history.join("\n")),i.metaText.tempo&&i.metaText.tempo.bpm&&!i.metaText.tempo.duration&&(i.metaText.tempo.duration=[i.getBeatLength()]);var f,m,g=!1;for(y=0;y<i.lines.length;y++)if(void 0!==i.lines[y].staff){var v=!1;for(f=0;f<i.lines[y].staff.length;f++)if(void 0===i.lines[y].staff[f])g=!0,i.lines[y].staff[f]=null;else for(m=0;m<i.lines[y].staff[f].voices.length;m++)void 0===i.lines[y].staff[f].voices[m]?i.lines[y].staff[f].voices[m]=[]:h(i.lines[y].staff[f].voices[m])&&(v=!0);v||(i.lines[y]=null,g=!0)}if(g&&(i.lines=i.lines.filter((function(e){return!!e})),i.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))),r)for(;o(i.lines,r););if(s){for(g=!1,y=0;y<i.lines.length;y++)if(void 0!==i.lines[y].staff)for(f=0;f<i.lines[y].staff.length;f++){var b=!1;for(m=0;m<i.lines[y].staff[f].voices.length;m++)u(i.lines[y].staff[f].voices[m])&&(b=!0);b||(g=!0,i.lines[y].staff[f]=null)}g&&i.lines.forEach((function(e){e.staff&&(e.staff=e.staff.filter((function(e){return!!e})))}))}for(function(e){for(var t=!0,i=0;i<e.length;i++){var n=e[i];if(n.staff){for(var r=0;r<n.staff.length;r++){var s=n.staff[r];if(s.title){for(var a=!1,o=0;o<s.title.length;o++)s.title[o]?(s.title[o]=t?s.title[o].name:s.title[o].subname,s.title[o]?a=!0:s.title[o]=""):s.title[o]="";a||delete s.title}}t=!1}}}(i.lines),y=0;y<i.lines.length;y++)if(i.lines[y].staff)for(f=0;f<i.lines[y].staff.length;f++)delete i.lines[y].staff[f].workingClef;for(;n(i););for(var y=0;y<i.lines.length;y++){var _=i.lines[y].staff;if(_)for(i.staffNum=0;i.staffNum<_.length;i.staffNum++)for(_[i.staffNum].clef&&e.fixClef(_[i.staffNum].clef),i.voiceNum=0;i.voiceNum<_[i.staffNum].voices.length;i.voiceNum++){var w=_[i.staffNum].voices[i.voiceNum];a(w,i.staffNum,i.voiceNum,d);for(var x=0;x<w.length;x++)"clef"===w[x].el_type&&e.fixClef(w[x]);if(w.length>0&&w[w.length-1].barNumber){var k=c(i.lines,y);k&&(k.staff[0].barNumber=w[w.length-1].barNumber),delete w[w.length-1].barNumber}}}return delete i.staffNum,delete i.voiceNum,delete i.lineNum,delete i.potentialStartBeam,delete i.potentialEndBeam,delete i.vskipPending,d},this.addTieToLastNote=function(e){var t=function(e){if(!e.lines[e.lineNum])return null;if(!e.lines[e.lineNum].staff)return null;if(!e.lines[e.lineNum].staff[e.staffNum])return null;var t=e.lines[e.lineNum].staff[e.staffNum].voices[e.voiceNum];if(!t)return null;for(var i=t.length-1;i>=0;i--){var n=t[i];if("note"===n.el_type)return n}return null}(i);return!!(t&&t.pitches&&t.pitches.length>0)&&(t.pitches[0].startTie={},e&&(t.pitches[0].startTie.style="dotted"),!0)},this.appendElement=function(e,t,n,a){var o,c,l;return a.el_type=e,null!==t&&(a.startChar=t),null!==n&&(a.endChar=n),"note"===e?((o=a).duration?o.duration:0)>=.25||a.force_end_beam_last&&void 0!==i.potentialStartBeam?p(i):a.end_beam&&void 0!==i.potentialStartBeam?void 0===a.rest?(c=a,(l=i).potentialStartBeam.startBeam=!0,c.endBeam=!0,delete l.potentialStartBeam,delete l.potentialEndBeam):p(i):void 0===a.rest&&(void 0===i.potentialStartBeam?a.end_beam||(i.potentialStartBeam=a,delete i.potentialEndBeam):i.potentialEndBeam=a):p(i),delete a.end_beam,delete a.force_end_beam_last,a.rest&&"invisible"===a.rest.type&&delete a.decoration,!(i.lines.length<=i.lineNum||i.lines[i.lineNum].staff.length<=i.staffNum||(function(e,t,i,n,r){var s=t.lines[t.lineNum].staff[t.staffNum];if(void 0!==i.pitches){var a=s.workingClef.verticalPos;i.pitches.forEach((function(e){e.verticalPos=e.pitch-a}))}if(void 0!==i.gracenotes){var o=s.workingClef.verticalPos;i.gracenotes.forEach((function(e){e.verticalPos=e.pitch-o}))}s.voices.length<=t.voiceNum&&(n[r]||(n[r]={}),m(e,t,n[r])),s.voices[t.voiceNum].push(i)}(r,i,a,s,f),0))},this.appendStartingElement=function(e,t,n,r){var s;l(i),"key"===e&&(s=r.impliedNaturals,delete r.impliedNaturals,delete r.explicitAccidentals);var a=Object.assign({},r);if(i.lines[i.lineNum]){var o=i.lines[i.lineNum].staff;if(o){o.length<=i.staffNum&&(o[i.staffNum]={},o[i.staffNum].clef=Object.assign({},o[0].clef),o[i.staffNum].key=Object.assign({},o[0].key),o[0].meter&&(o[i.staffNum].meter=Object.assign({},o[0].meter)),o[i.staffNum].workingClef=Object.assign({},o[0].workingClef),o[i.staffNum].voices=[[]]),"clef"===e&&(o[i.staffNum].workingClef=a);for(var c=o[i.staffNum].voices[i.voiceNum],h=0;h<c.length;h++){if("note"===c[h].el_type||"bar"===c[h].el_type)return a.el_type=e,a.startChar=t,a.endChar=n,s&&(a.accidentals=s.concat(a.accidentals)),void c.push(a);if(c[h].el_type===e)return a.el_type=e,a.startChar=t,a.endChar=n,s&&(a.accidentals=s.concat(a.accidentals)),void(c[h]=a)}o[i.staffNum][e]=r}}},this.addSubtitle=function(e,t){d(i,{subtitle:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addSpacing=function(e){i.vskipPending=e},this.addNewPage=function(e){d(i,{newpage:e})},this.addSeparator=function(e,t,n,r){d(i,{separator:{spaceAbove:Math.round(e),spaceBelow:Math.round(t),lineLength:Math.round(n),startChar:r.startChar,endChar:r.endChar}})},this.addText=function(e,t){d(i,{text:{text:e,startChar:t.startChar,endChar:t.endChar}})},this.addCentered=function(e){d(i,{text:[{text:e,center:!0}]})},this.changeVoiceScale=function(e){r.appendElement("scale",null,null,{size:e})},this.changeVoiceColor=function(e){r.appendElement("color",null,null,{color:e})},this.startNewLine=function(e){var t,n,a;l(i),e.currentVoiceName&&(f=e.currentVoiceName,s[e.currentVoiceName]=e),void 0===i.lines[i.lineNum]?(t=r,a=e,(n=i).lines[n.lineNum]={staff:[]},g(t,n,a)):void 0===i.lines[i.lineNum].staff?(i.lineNum++,this.startNewLine(e)):void 0===i.lines[i.lineNum].staff[i.staffNum]?g(r,i,e):void 0===i.lines[i.lineNum].staff[i.staffNum].voices[i.voiceNum]?m(r,i,e):h(i.lines[i.lineNum].staff[i.staffNum].voices[i.voiceNum])?(i.lineNum++,this.startNewLine(e)):e.part&&r.appendElement("part",e.part.startChar,e.part.endChar,{title:e.part.title})},this.setRunningFont=function(e,t){i.runningFonts[e]=t},this.setBarNumberImmediate=function(e){var t=this.getCurrentVoice();if(t&&t.length>0){var i=t[t.length-1];if("bar"!==i.el_type)return e-1;void 0!==i.barNumber&&(i.barNumber=e)}return e},this.hasBeginMusic=function(){for(var e=0;e<i.lines.length;e++)if(i.lines[e].staff)return!0;return!1},this.isFirstLine=function(e){for(var t=e-1;t>=0;t--)if(void 0!==i.lines[t].staff)return!1;return!0},this.getCurrentVoice=function(){var e=function(e,t){for(;t>=0;){if(e[t].staff)return e[t];t--}return null}(i.lines,i.lineNum);if(!e)return null;var t=e.staff[i.staffNum];return t&&void 0!==t.voices[i.voiceNum]?t.voices[i.voiceNum]:null},this.setCurrentVoice=function(e,t,n){i.staffNum=e,i.voiceNum=t,f=n;for(var r=0;r<i.lines.length;r++)if(i.lines[r].staff&&(void 0===i.lines[r].staff[e]||void 0===i.lines[r].staff[e].voices[t]||!h(i.lines[r].staff[e].voices[t])))return i.lineNum=r,!(i.lines[r].staff[e]&&!i.lines[r].staff[e].voices[t]);return i.lineNum=r,!1},this.addMetaText=function(e,t,n){void 0===i.metaText[e]?(i.metaText[e]=t,i.metaTextInfo[e]=n):("string"==typeof i.metaText[e]&&"string"==typeof t?i.metaText[e]+="\n"+t:("string"===i.metaText[e]&&(i.metaText[e]=[{text:i.metaText[e]}]),"string"==typeof t&&(t=[{text:t}]),i.metaText[e]=i.metaText[e].concat(t)),i.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextArray=function(e,t,n){void 0===i.metaText[e]?(i.metaText[e]=[t],i.metaTextInfo[e]=n):(i.metaText[e].push(t),i.metaTextInfo[e].endChar=n.endChar)},this.addMetaTextObj=function(e,t,n){i.metaText[e]=t,i.metaTextInfo[e]=n}}}();return oc=function(){var i,s=new c,h=new l(s),u="",d="";function p(e,t,i){e.positioning||(e.positioning={}),e.positioning[t]=i}function f(e,t,i){e.fonts||(e.fonts={}),e.fonts[t]=i}this.getTune=function(){var e={formatting:s.formatting,lines:s.lines,media:s.media,metaText:s.metaText,metaTextInfo:s.metaTextInfo,version:s.version,addElementToEvents:s.addElementToEvents,addUsefulCallbackInfo:s.addUsefulCallbackInfo,getTotalTime:s.getTotalTime,getTotalBeats:s.getTotalBeats,getBarLength:s.getBarLength,getBeatLength:s.getBeatLength,getBeatsPerMeasure:s.getBeatsPerMeasure,getBpm:s.getBpm,getMeter:s.getMeter,getMeterFraction:s.getMeterFraction,getPickupLength:s.getPickupLength,getKeySignature:s.getKeySignature,getElementFromChar:s.getElementFromChar,makeVoicesArray:s.makeVoicesArray,millisecondsPerMeasure:s.millisecondsPerMeasure,setupEvents:s.setupEvents,setTiming:s.setTiming,setUpAudio:s.setUpAudio,deline:s.deline,findSelectableElement:s.findSelectableElement,getSelectableArray:s.getSelectableArray};return s.lineBreaks&&(e.lineBreaks=s.lineBreaks),s.visualTranspose&&(e.visualTranspose=s.visualTranspose),e};var m,g,v={reset:function(){for(var e in this)this.hasOwnProperty(e)&&"function"!=typeof this[e]&&delete this[e];this.iChar=0,this.key={accidentals:[],root:"none",acc:"",mode:""},this.meter=null,this.origMeter=null,this.hasMainTitle=!1,this.default_length=.125,this.clef={type:"treble",verticalPos:0},this.octave=0,this.next_note_duration=0,this.start_new_line=!0,this.is_in_header=!0,this.partForNextLine={},this.tempoForNextLine=[],this.havent_set_length=!0,this.voices={},this.staves=[],this.macros={},this.currBarNumber=1,this.barCounter={},this.ignoredDecorations=[],this.score_is_present=!1,this.inEnding=!1,this.inTie=[],this.inTieChord={},this.vocalPosition="auto",this.dynamicPosition="auto",this.chordPosition="auto",this.ornamentPosition="auto",this.volumePosition="auto",this.openSlurs=[],this.freegchord=!1,this.endingHoldOver={}},differentFont:function(e,t){return this[e].decoration!==t[e].decoration||this[e].face!==t[e].face||this[e].size!==t[e].size||this[e].style!==t[e].style||this[e].weight!==t[e].weight},addFormattingOptions:function(e,t,i){"note"===i?("auto"!==this.vocalPosition&&p(e,"vocalPosition",this.vocalPosition),"auto"!==this.dynamicPosition&&p(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&p(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&p(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&p(e,"volumePosition",this.volumePosition),this.differentFont("annotationfont",t)&&f(e,"annotationfont",this.annotationfont),this.differentFont("gchordfont",t)&&f(e,"gchordfont",this.gchordfont),this.differentFont("vocalfont",t)&&f(e,"vocalfont",this.vocalfont),this.differentFont("tripletfont",t)&&f(e,"tripletfont",this.tripletfont)):"bar"===i&&("auto"!==this.dynamicPosition&&p(e,"dynamicPosition",this.dynamicPosition),"auto"!==this.chordPosition&&p(e,"chordPosition",this.chordPosition),"auto"!==this.ornamentPosition&&p(e,"ornamentPosition",this.ornamentPosition),"auto"!==this.volumePosition&&p(e,"volumePosition",this.volumePosition),this.differentFont("measurefont",t)&&f(e,"measurefont",this.measurefont),this.differentFont("repeatfont",t)&&f(e,"repeatfont",this.repeatfont))},duplicateStartEndingHoldOvers:function(){this.endingHoldOver={inTie:[],inTieChord:{}};for(var e=0;e<this.inTie.length;e++)if(this.endingHoldOver.inTie.push([]),this.inTie[e])for(var t=0;t<this.inTie[e].length;t++)this.endingHoldOver.inTie[e].push(this.inTie[e][t]);for(var i in this.inTieChord)this.inTieChord.hasOwnProperty(i)&&(this.endingHoldOver.inTieChord[i]=this.inTieChord[i])},restoreStartEndingHoldOvers:function(){if(this.endingHoldOver.inTie){this.inTie=[],this.inTieChord={};for(var e=0;e<this.endingHoldOver.inTie.length;e++){this.inTie.push([]);for(var t=0;t<this.endingHoldOver.inTie[e].length;t++)this.inTie[e].push(this.endingHoldOver.inTie[e][t])}for(var i in this.endingHoldOver.inTieChord)this.endingHoldOver.inTieChord.hasOwnProperty(i)&&(this.inTieChord[i]=this.endingHoldOver.inTieChord[i])}}},b=function(e){var t=e.replace(/\x12/g," ");return(t=(t=t.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")},y=function(e,t,n){t||(t=" ");var r=t[n];" "!==r&&r||(r="SPACE");var s,a,o=b(t.substring(n-64,n))+'<span style="text-decoration:underline;font-size:1.3em;font-weight:bold;">'+r+"</span>"+b(t.substring(n+1).substring(0,64));a="Music Line:"+i.lineIndex+":"+(n+1)+": "+e+": "+o,v.warnings||(v.warnings=[]),v.warnings.push(a),s={message:e,line:t,startChar:v.iChar+n,column:n},v.warningObjects||(v.warningObjects=[]),v.warningObjects.push(s)};this.getWarnings=function(){return v.warnings},this.getWarningObjects=function(){return v.warningObjects};var _=function(t,n){if(n.indexOf("")>=0)u+=n;else if(n=u+n,u="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],s=0,a=!1,o=function(t){var o=e.strip(n.substring(s,t));if(o=o.replace(/\\([-_*|~])/g,"$1"),s=t+1,o.length>0){a&&(o=o.replace(/~/g," "));var c=n[t];return"_"!==c&&"-"!==c&&(c=" "),r.push({syllable:i.translateString(o),divider:c}),a=!1,!0}return!1},c=!1,l=0;l<n.length;l++){switch(n[l]){case" ":case"":o(l);break;case"-":!c&&!o(l)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":c||(o(l),r.push({skip:!0,to:"slur"}));break;case"*":c||(o(l),r.push({skip:!0,to:"next"}));break;case"|":c||(o(l),r.push({skip:!0,to:"bar"}));break;case"~":c||(a=!0)}c="\\"===n[l]}t.forEach((function(e){if(0!==r.length)if(r[0].skip){switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}"bar"!==e.el_type&&(void 0===e.lyric?e.lyric=[{syllable:"",divider:" "}]:e.lyric.push({syllable:"",divider:" "}))}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();t.syllable&&(t.syllable=t.syllable.replace(/ +/g," ")),void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else y("Can't add words before the first line of music",t,0)},w=function(t,n){if(n.indexOf("")>=0)d+=n;else if(n=d+n,d="",t){"-"!==(n=e.strip(n))[n.length-1]&&(n+=" ");for(var r=[],s=0,a=!1,o=function(t){var o=e.strip(n.substring(s,t));if(s=t+1,o.length>0){a&&(o=o.replace(/~/g," "));var c=n[t];return"_"!==c&&"-"!==c&&(c=" "),r.push({syllable:i.translateString(o),divider:c}),a=!1,!0}return!1},c=0;c<n.length;c++)switch(n[c]){case" ":case"":o(c);break;case"-":!o(c)&&r.length>0&&(e.last(r).divider="-",r.push({skip:!0,to:"next"}));break;case"_":o(c),r.push({skip:!0,to:"slur"});break;case"*":o(c),r.push({skip:!0,to:"next"});break;case"|":o(c),r.push({skip:!0,to:"bar"});break;case"~":a=!0}t.forEach((function(e){if(0!==r.length)if(r[0].skip)switch(r[0].to){case"next":case"slur":"note"===e.el_type&&null!==e.pitches&&r.shift();break;case"bar":"bar"===e.el_type&&r.shift()}else if("note"===e.el_type&&void 0===e.rest){var t=r.shift();void 0===e.lyric?e.lyric=[t]:e.lyric.push(t)}}))}else y("Can't add symbols before the first line of music",t,0)},x=function(i){if(e.startsWith(i,"%%")){var n=t.addDirective(i.substring(2));n&&y(n,i,2)}else{var r=i.indexOf("%");if(r>=0&&(i=i.substring(0,r)),0!==(i=i.replace(/\s+$/,"")).length)if(u)_(h.getCurrentVoice(),i.substring(2));else if(d)w(h.getCurrentVoice(),i.substring(2));else if(i.length<2||":"!==i[1]||g.lineContinuation)g.parseMusic(i);else{var s=m.parseHeader(i);s.regular&&g.parseMusic(i),s.newline&&g.startNewLine(),s.words&&_(h.getCurrentVoice(),i.substring(2)),s.symbols&&w(h.getCurrentVoice(),i.substring(2))}}};function k(e,t){e.push({el_type:"hint"});for(var i=0;i<t.length;i++){var n=t[i],r=Object.assign({},n);if(e.push(r),"bar"===n.el_type)return}}function C(e,t){for(var i=0;i<e.length;i++){var n=e[i],r=t[i];if(r)for(var s=0;s<r.voices.length;s++){var a=r.voices[s],o=n.voices[s];o&&k(o,a)}}}this.parse=function(c,l,p){l||(l={}),p||(p=0),s.reset();var f=(c=c.replace(/\r\n?/g,"\n")+"\n").split("\n\\");if(f.length>1){for(var b=1;b<f.length;b++)for(;f[b].length>0&&"\n"!==f[b][0];)f[b]=f[b].substr(1),f[b-1]+=" ";c=f.join(" ")}var k=(c=c.replace(/\\([ \t]*)(%.*)*\n/g,(function(e,t,i){return t+""+(i?Array(i.length+1).join(" "):"")+"\n"}))).split("\n");0===e.last(k).length&&k.pop(),i=new a(k,v),m=new n(i,y,v,s,h),g=new r(i,y,v,s,h,m),l.print&&(s.media="print"),v.reset(),v.iChar=p,l.visualTranspose?(v.globalTranspose=parseInt(l.visualTranspose),0===v.globalTranspose?v.globalTranspose=void 0:h.setVisualTranspose(l.visualTranspose)):v.globalTranspose=void 0,l.lineBreaks&&(v.lineBreaks=l.lineBreaks),m.reset(i,y,v,s);try{l.format&&t.globalFormatting(l.format);for(var S=i.nextLine();S;){if(l.header_only&&!1===v.is_in_header)throw"normal_abort";if(l.stop_on_warning&&v.warnings)throw"normal_abort";var M=v.is_in_header;x(S),M&&!v.is_in_header&&(h.setRunningFont("annotationfont",v.annotationfont),h.setRunningFont("gchordfont",v.gchordfont),h.setRunningFont("tripletfont",v.tripletfont),h.setRunningFont("vocalfont",v.vocalfont)),S=i.nextLine()}u&&_(h.getCurrentVoice(),""),d&&w(h.getCurrentVoice(),""),v.openSlurs=h.cleanUp(v.barsperstaff,v.staffnonote,v.openSlurs)}catch(A){if("normal_abort"!==A)throw A}var E=792,T=612;switch(v.papersize){case"legal":E=1008,T=612;break;case"A4":E=842.4,T=597.6}if(v.landscape){var P=E;E=T,T=P}s.formatting.pagewidth||(s.formatting.pagewidth=T),s.formatting.pageheight||(s.formatting.pageheight=E),l.hint_measures&&function(){for(var e=0;e<s.lines.length;e++){var t=s.lines[e].staff;if(t){for(var i=e+1;i<s.lines.length&&void 0===s.lines[i].staff;)i++;i<s.lines.length&&C(t,s.lines[i].staff)}}}(),o.wrapLines(s,v.lineBreaks,v.barNumbers)}}}function Gd(){if(fc)return pc;fc=1;var e=function(e,t){this.children=[],this.beams=[],this.otherchildren=[],this.w=0,this.duplicate=!1,this.voicenumber=e,this.voicetotal=t,this.bottom=7,this.top=7,this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};return e.prototype.addChild=function(e){if("bar"===e.type){for(var t=!0,i=0;t&&i<this.children.length;i++)this.children[i].type.indexOf("staff-extra")<0&&"tempo"!==this.children[i].type&&(t=!1);t||(this.beams.push("bar"),this.otherchildren.push("bar"))}this.children[this.children.length]=e,this.setRange(e)},e.prototype.setLimit=function(e,t){var i=t.specialY;i||(i=t),i[e]&&(this.specialY[e]?this.specialY[e]=Math.max(this.specialY[e],i[e]):this.specialY[e]=i[e])},e.prototype.adjustRange=function(e){void 0!==e.bottom&&(this.bottom=Math.min(this.bottom,e.bottom)),void 0!==e.top&&(this.top=Math.max(this.top,e.top))},e.prototype.setRange=function(e){this.adjustRange(e),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},e.prototype.addOther=function(e){this.otherchildren.push(e),this.setRange(e)},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setWidth=function(e){this.w=e},pc=e}function Ud(){return gc?mc:(gc=1,mc=function(e,t,i,n){if(e)for(var r=0;r<e.length;r++){var s=e[r],a=s.getAttribute("highlight");a||(a="fill"),s.setAttribute(a,n);var o=s.getAttribute("class");o||(o=""),o=(o=o.replace(i,"")).replace(t,""),t.length>0&&(o.length>0&&" "!==o[o.length-1]&&(o+=" "),o+=t),s.setAttribute("class",o)}})}function Wd(){if(bc)return vc;bc=1;var e=Ud();return vc=function(t,i){void 0===t&&(t="abcjs-note_selected"),void 0===i&&(i="#ff0000"),e(this.elemset,t,"",i)}}function Yd(){if(_c)return yc;_c=1;var e=Ud();return yc=function(t,i){void 0===t&&(t="abcjs-note_selected"),void 0===i&&(i="#000000"),e(this.elemset,"",t,i)}}function $d(){if(xc)return wc;xc=1;var e=Wd(),t=Yd(),i=function(e,t,i,n,r,s){s||(s={}),this.tuneNumber=r,this.abcelem=e,this.duration=t,this.durationClass=s.durationClassOveride?s.durationClassOveride:this.duration,this.minspacing=i||0,this.x=0,this.children=[],this.heads=[],this.extra=[],this.extraw=0,this.w=0,this.right=[],this.invisible=!1,this.bottom=void 0,this.top=void 0,this.type=n,this.fixed={w:0,t:void 0,b:void 0},this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};return i.prototype.getFixedCoords=function(){return{x:this.x,w:this.fixed.w,t:this.fixed.t,b:this.fixed.b}},i.prototype.addExtra=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top),void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom),e.dx<this.extraw&&(this.extraw=e.dx),this.extra[this.extra.length]=e,this._addChild(e)},i.prototype.addHead=function(e){e.dx<this.extraw&&(this.extraw=e.dx),this.heads[this.heads.length]=e,this.addRight(e)},i.prototype.addRight=function(e){this.fixed.w=Math.max(this.fixed.w,e.dx+e.w),void 0!==e.top&&(void 0===this.fixed.t?this.fixed.t=e.top:this.fixed.t=Math.max(this.fixed.t,e.top)),void 0!==e.bottom&&(void 0===this.fixed.b?this.fixed.b=e.bottom:this.fixed.b=Math.min(this.fixed.b,e.bottom)),e.dx+e.w>this.w&&(this.w=e.dx+e.w),this.right[this.right.length]=e,this._addChild(e)},i.prototype.addFixed=function(e){this._addChild(e)},i.prototype.addFixedX=function(e){this._addChild(e)},i.prototype.addCentered=function(e){var t=e.w/2;-t<this.extraw&&(this.extraw=-t),this.extra[this.extra.length]=e,e.dx+t>this.w&&(this.w=e.dx+t),this.right[this.right.length]=e,this._addChild(e)},i.prototype.setLimit=function(e,t){t[e]&&(this.specialY[e]?this.specialY[e]=Math.max(this.specialY[e],t[e]):this.specialY[e]=t[e])},i.prototype._addChild=function(e){var t=!0;"clef"==this.abcelem.el_type&&"barNumber"==e.type&&(t=!1),e.parent=this,this.children[this.children.length]=e,t&&this.pushTop(e.top),this.pushBottom(e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},i.prototype.pushTop=function(e){void 0!==e&&(void 0===this.top?this.top=e:this.top=Math.max(e,this.top))},i.prototype.pushBottom=function(e){void 0!==e&&(void 0===this.bottom?this.bottom=e:this.bottom=Math.min(e,this.bottom))},i.prototype.setX=function(e){this.x=e;for(var t=0;t<this.children.length;t++)this.children[t].setX(e)},i.prototype.center=function(e,t){var i=(t.x-e.x)/2+e.x;this.x=i-this.w/2;for(var n=0;n<this.children.length;n++)this.children[n].setX(this.x)},i.prototype.setHint=function(){this.hint=!0},i.prototype.highlight=function(t,i){e.bind(this)(t,i)},i.prototype.unhighlight=function(e,i){t.bind(this)(e,i)},wc=i}function Kd(){if(Cc)return kc;Cc=1;var e=function(e,t,i,n,r){switch(r=r||{},this.x=0,this.c=e,this.dx=t,this.w=i,this.pitch=n,this.scalex=r.scalex||1,this.scaley=r.scaley||1,this.type=r.type||"symbol",this.pitch2=r.pitch2,this.linewidth=r.linewidth,this.klass=r.klass,this.anchor=r.anchor?r.anchor:"middle",this.top=n,void 0!==this.pitch2&&this.pitch2>this.top&&(this.top=this.pitch2),this.bottom=n,void 0!==this.pitch2&&this.pitch2<this.bottom&&(this.bottom=this.pitch2),r.thickness&&(this.top+=r.thickness/2,this.bottom-=r.thickness/2),r.stemHeight&&(r.stemHeight>0?this.top+=r.stemHeight:this.bottom+=r.stemHeight),r.dim&&(this.dim=r.dim),r.position&&(this.position=r.position),this.height=r.height?r.height:4,r.top&&(this.top=r.top),r.bottom&&(this.bottom=r.bottom),r.name?this.name=r.name:this.c?this.name=this.c:this.name=this.type,r.realWidth?this.realWidth=r.realWidth:this.realWidth=this.w,this.centerVertically=!1,this.type){case"debug":this.chordHeightAbove=this.height;break;case"lyric":r.position&&"below"===r.position?this.lyricHeightBelow=this.height:this.lyricHeightAbove=this.height;break;case"chord":r.position&&"below"===r.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height;break;case"text":void 0===this.pitch?r.position&&"below"===r.position?this.chordHeightBelow=this.height:this.chordHeightAbove=this.height:this.centerVertically=!0;break;case"part":this.partHeightAbove=this.height}};return e.prototype.getChordDim=function(){if("debug"===this.type)return null;if(!this.chordHeightAbove&&!this.chordHeightBelow)return null;var e="chord"===this.type?this.realWidth/2:0,t=this.x-e-0;return{left:t,right:t+this.realWidth+0}},e.prototype.invertLane=function(e){void 0===this.lane&&(this.lane=0),this.lane=e-this.lane-1},e.prototype.putChordInLane=function(e){this.lane=e,this.chordHeightAbove?this.chordHeightAbove=1.25*this.height*this.lane:this.chordHeightBelow=1.25*this.height*this.lane},e.prototype.getLane=function(){return void 0===this.lane?0:this.lane},e.prototype.setX=function(e){this.x=e+this.dx},kc=e}function Xd(){if(Ac)return Pc;Ac=1;var e={__:-2,_:-1,"_/":-.5,"=":0,"":0,"^/":.5,"^":1,"^^":2},t=["C","-","D","-","E","F","-","G","-","A","-","B","c","-","d","-","e","f","-","g","-","a","-","b"];return Pc={noteToMidi:function(i){var n=i.match(/([_^\/]*)([ABCDEFGabcdefg])(,*)('*)/);if(n&&5===n.length){var r=e[n[1]];return 48+t.indexOf(n[2])+r+12*(n[4].length-n[3].length)}return 0},midiToNote:function(e){e=parseInt(e,10);var i=Math.floor(e/12),n=e%12,r=t[n];if("-"===r&&(r="^"+t[n-1]),i>4)for(r=r.toLowerCase(),i-=5;i>0;)r+="'",i--;else for(;i<4;)r+=",",i++;return r}}}function Qd(){if(Nc)return Ic;Nc=1;var{noteToMidi:e,midiToNote:t}=Xd();function i(i,n){var r=e(i);n&&(r+=n);var s,a=t(r),o=!1,c=!1,l=null,h=null,u=!1,d=0;i.startsWith("_")?(o=!0,d=-1,"/"==i[1]?(o=!1,h="v",d=0):"_"==i[1]&&(u=!0,d-=1)):i.startsWith("^")?(c=!0,d=1,"/"==i[1]?(c=!1,h="^",d=0):"^"==i[1]&&(u=!0,d+=1)):i.startsWith("=")&&(l=!0,d=0),((s=o||c||null!=h)||l)&&(a=null!=h||u?i.slice(2):i.slice(1));var p=(a.match(/,/g)||[]).length,f=(a.match(/'/g)||[]).length;this.pitch=r,this.pitchAltered=0,this.name=a,this.acc=d,this.isSharp=c,this.isKeySharp=!1,this.isDouble=u,this.isAltered=s,this.isFlat=o,this.isKeyFlat=!1,this.natural=l,this.quarter=h,this.isLower=this.name==this.name.toLowerCase(),this.name=this.name[0].toUpperCase(),this.hasComma=p,this.isQuoted=f}return i.prototype.sameNoteAs=function(e){return e.pitch===this.pitch},i.prototype.isLowerThan=function(e){return e.pitch>this.pitch},i.prototype.checkKeyAccidentals=function(e,t){if(!this.isAltered&&!this.natural)if(t[this.name.toUpperCase()])switch(t[this.name.toUpperCase()]){case"__":return this.acc=-2,void(this.pitchAltered=-2);case"_":return this.acc=-1,void(this.pitchAltered=-1);case"=":return this.acc=0,void(this.pitchAltered=0);case"^":return this.acc=1,void(this.pitchAltered=1);case"^^":return this.acc=2,void(this.pitchAltered=2)}else if(e)for(var i=this.name,n=0;n<e.length;n++){var r=e[n];i==r.note.toUpperCase()&&("flat"==r.acc&&(this.acc=-1,this.isKeyFlat=!0,this.pitchAltered=-1),"sharp"==r.acc&&(this.acc=1,this.isKeySharp=!0,this.pitchAltered=1))}},i.prototype.getAccidentalEquiv=function(){var e,t,n=((t=new i((e=this).name)).pitch=e.pitch,t.hasComma=e.hasComma,t.isLower=e.isLower,t.isQuoted=e.isQuoted,t.isSharp=e.isSharp,t.isKeySharp=e.isKeySharp,t.isFlat=e.isFlat,t.isKeyFlat=e.isKeyFlat,t);return n.isSharp||n.isKeySharp?((n=n.nextNote()).isFlat=!0,n.isSharp=!1,n.isKeySharp=!1):(n.isFlat||n.isKeyFlat)&&((n=n.prevNote()).isSharp=!0,n.isFlat=!1,n.isKeyFlat=!1),n},i.prototype.nextNote=function(){return new i(t(this.pitch+1+this.pitchAltered))},i.prototype.prevNote=function(){return new i(t(this.pitch-1+this.pitchAltered))},i.prototype.emitNoAccidentals=function(){var e=this.name;this.isLower&&(e=e.toLowerCase());for(var t=0;t<this.isQuoted;t++)e+="'";for(var i=0;i<this.hasComma;i++)e+=",";return e},i.prototype.emit=function(){var e=this.name;(this.isSharp||this.isKeySharp)&&(e="^"+e,this.isDouble&&(e="^"+e)),(this.isFlat||this.isKeyFlat)&&(e="_"+e,this.isDouble&&(e="_"+e)),this.quarter&&(e="^"==this.quarter?"^/"+e:"_/"+e),this.natural&&(e="="+e);for(var t=1;t<=this.hasComma;t++)e+=",";if(this.isLower){e=e.toLowerCase();for(var i=1;i<=this.isQuoted;i++)e+="'"}return e},Ic=i}function Zd(){if(Dc)return Bc;Dc=1;const{noteToMidi:e}=Xd();var t=Qd(),i=function(){if(Oc)return Lc;Oc=1;var e=Qd(),t=["A","B","C","D","E","F","G"];return Lc=function(i,n){var r=new e(i),s=new e(n);if(s.isLowerThan(r)){var a=r.emit();return{error:"Invalid string Instrument tuning : "+s.emit()+" string lower than "+a+" string"}}var o=[],c=t.indexOf(r.name),l=t.indexOf(s.name);if(-1==c||-1==l)return o;for(var h=!1;!h;)o.push(r.emit()),(r=r.nextNote()).sameNoteAs(s)&&(h=!0);return o}}();function n(e,t,i,n,r){var s=e.strings;t.checkKeyAccidentals(e.accidentals,e.measureAccidentals),n&&(s=n);var a=t.emitNoAccidentals(),o=s[i].indexOf(a),c=t.acc;if(-1!=o){if(n&&(o+=r),(t.isFlat||-1==t.acc)&&0==o){var l=t.getAccidentalEquiv();o=s[++i].indexOf(l.emit()),c=0}return{num:o+c,str:i,note:t}}return null}function r(e,t){var i;(t.isAltered||t.natural)&&(t.isFlat?i=t.isDouble?"__":"_":t.isSharp?i=t.isDouble?"^^":"^":t.natural&&(i="="),e.measureAccidentals[t.name.toUpperCase()]=i);for(var n=e.stringPitches.length-1;n>=0;n--)if(t.pitch+t.pitchAltered>=e.stringPitches[n]){var r=t.pitch+t.pitchAltered-e.stringPitches[n];return"^"===t.quarter?r-=.5:"v"===t.quarter&&(r+=.5),{num:Math.round(r),str:e.stringPitches.length-1-n,note:t}}return{num:"?",str:e.stringPitches.length-1,note:t}}function s(e,t){var i={num:"?",str:0,note:t};e.push(i),e.error=t.emit()+": unexpected note for instrument"}function a(n){var r=n.tuning,s=n.capo,a=n.params.highestNote;this.linePitch=n.linePitch,this.highestNote="a'",a&&(this.highestNote=a),this.measureAccidentals={},this.capo=0,s&&(this.capo=parseInt(s,10)),this.transpose=n.transpose?n.transpose:0,this.tuning=r,this.stringPitches=[];for(var o=0;o<this.tuning.length;o++){var c=e(this.tuning[o])+this.capo;this.stringPitches.push(c)}if(this.capo>0&&(this.capoTuning=function(e){var i=null,n=e.tuning;if(e.capo>0){i=[];for(var r=0;r<n.length;r++){for(var s=new t(n[r]),a=0;a<e.capo;a++)s=s.nextNote();i[r]=s.emit()}}return i}(this)),this.strings=function(e){var t=[],n=e.tuning;e.capo>0&&(n=e.capoTuning);for(var r=n.length-1,s=0;s<n.length;s++){var a=e.highestNote;s!=n.length-1&&(a=n[s+1]);var o=i(n[s],a);if(o.error)return o;t[r--]=o}return t}(this),this.strings.error)return n.setError(this.strings.error),void(n.inError=!0);this.secondPos=function(e){var t=[];t[0]=[];for(var i=e.strings,n=1;n<i.length;n++)t[n]=i[n-1];return t}(this)}return a.prototype.stringToPitch=function(e){return 5.3+(this.strings.length-1-e)*this.linePitch},a.prototype.notesToNumber=function(e,i){var a,o,c=null,l=null;if(e&&(l=[],e.length>1?(l=function(e,i){for(var s=[],a=0;a<i.length;a++)if(!i[a].endTie){var o=new t(i[a].name,e.clefTranspose);o.checkKeyAccidentals(e.accidentals,e.measureAccidentals);var c=r(e,o);s.push(c)}return function(e,t){for(var i=0;i<t.length-1;i++){var r=t[i],s=t[i+1];if(r.str==s.str){if(r.str==e.strings.length-1)return r.num="?",void(s.num="?");s.num<r.num?(s.str++,s=n(e,s.note,s.str,e.secondPos,e.strings[s.str].length)):(r.str++,r=n(e,r.note,r.str,e.secondPos,e.strings[r.str].length)),t[i]=r,t[i+1]=s}}}(e,s),s}(this,e)).error&&(c=l.error):e[0].endTie||((a=new t(e[0].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=r(this,a))?l.push(o):(s(l,a),c=l.error))),c)return l;var h=null;if(i){h=[];for(var u=0;u<i.length;u++)(a=new t(i[u].name,this.clefTranspose)).checkKeyAccidentals(this.accidentals,this.measureAccidentals),(o=r(this,a))?h.push(o):(s(h,a),c=l.error)}return{notes:l,graces:h,error:c}},a.prototype.toString=function(){for(var e=[],t=0;t<this.tuning.length;t++){var i=this.tuning[t].replaceAll(",","").replaceAll("'","").toUpperCase();"_"===i[0]?i=i[1]+"b ":"^"===i[0]&&(i=i[1]+"# "),e.push(i)}return e.join("")},a.prototype.tabInfos=function(e){var t=e.params.label;if(t){var i="";return-1!=t.indexOf("%T")&&(i=this.toString(),e.capo>0&&(i+=" capo:"+e.capo),t=t.replace("%T",i)),t}return""},a.prototype.suppress=function(e){return!!e.params.suppress},Bc=a}function Jd(){if(zc)return Rc;zc=1;var e=function(){if(dc)return uc;function e(e,t){this.numLines=e,this.lineSpace=t,this.verticalSize=this.numLines*this.lineSpace,this.bar={pitch:3,pitch2:t*e,height:5}}return dc=1,e.prototype.bypass=function(e){var t=e.staffGroup.voices;return!!(t.length>0&&t[0].isPercussion)},e.prototype.setRelative=function(e,t,i){switch(e.type){case"bar":t.pitch=this.bar.pitch,t.pitch2=this.bar.pitch2,t.height=this.height;break;case"symbol":var n=this.bar.pitch2/2;if("dots.dot"==e.name)return i?(t.pitch=n,!1):(t.pitch=n+this.lineSpace,!0)}return i},uc=e}(),t=function(){if(Tc)return Ec;Tc=1;var e=Gd(),t=function(){if(Mc)return Sc;Mc=1;var e=$d(),t=Kd();function i(e,t){for(var i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])||null!=(n=t[i])&&n.constructor===Object||(e[i]=t[i]));var n}function n(t){var n=new e("",0,0,"",0);return i(n,t),n.top=0,n.bottom=-1,t.abcelem&&(n.abcelem={},i(n.abcelem,t.abcelem),"note"===n.abcelem.el_type&&(n.abcelem.el_type="tabNumber")),t.cloned=n,n}function r(e,r){var s=n(e);if(r)for(var a=e.children,o=!0,c=0;c<a.length;c++){var l=a[c],h=new t("",0,0,0,"");i(h,l),o=r.tablature.setRelative(l,h,o),s.children.push(h)}return s}function s(i,n,r){var s="tab.tiny",a=7.5;i.isTabBig&&(s="tab.big",a=10);var o={el_type:"tab",icon:s,Ypos:a};if(a+=i.tabSymbolOffset,!i.hideTabSymbol){var c=new e(o,0,0,"symbol",0);c.x=n;var l=new t(s,0,0,7.5,"tab");l.x=r,c.children.push(l),"tab"==c.abcelem.el_type&&(l.pitch=a)}return c}function a(e){if(e.extra)for(var t=0;t<e.extra.length;t++){var i=e.extra[t];if("lyric"==i.type)return{bottom:i.bottom,height:i.height}}return null}function o(){this.accidentals=null}function c(e,i,n,r,s){var a=r.num;null!=r.note.quarter&&(a=a.toString(),a+=r.note.quarter);var o=e.semantics.stringToPitch(r.str);n.notes.push({num:a,str:r.str,pitch:r.note.emit()});var c=new t(a,0,0,o+.3,{type:"tabNumber"});return c.x=i,c.isGrace=s,c.isAltered=r.note.isAltered,c}function l(e,t){var i=0;if(e.extra)for(var n=0;n<e.extra.length;n++)if(e.extra[n].c.indexOf("noteheads")>=0){if(i===t)return e.extra[n].x+e.extra[n].w/2;i++}return-1}function h(e){if(e.abcelem){var t=e.abcelem;if(t.rest)return t.gracenotes}return null}function u(e,t,i){var n=e.semantics.notesToNumber(t,i);if(n.error)return e.setError(n.error),n;if(n.graces&&n.notes){var r=n.notes.length-1;n.notes[r].graces=n.graces}return n}function d(e,t,i,n,r){for(var s=0;s<n.length;s++){var a={el_type:"note",startChar:i.abcelem.startChar,endChar:i.abcelem.endChar,notes:[],grace:!0},o=c(e,l(i,s),a,n[s],!0);t.children.push(o),r.push(a)}}return o.prototype.build=function(e,t,i,o,p,f,m){!function(e){for(var t=0;t<e.length;t++)e[t].tabNameInfos}(t);var g=t[p+o],v=t[m],b=null,y=null;"clef"!=g.children[0].abcelem.el_type&&"none"!=f&&g.children.splice(0,0,f);for(var _=0;_<g.children.length;_++){var w=g.children[_],x=w.x,k=x;switch(w.isClef&&(v.children.push(s(e,x,k)),w.abcelem.type.indexOf("-8")>=0&&(e.semantics.clefTranspose=-12),w.abcelem.type.indexOf("+8")>=0&&(e.semantics.clefTranspose=12)),w.type){case"staff-extra key-signature":this.accidentals=w.abcelem.accidentals,e.semantics.accidentals=this.accidentals;break;case"bar":e.semantics.measureAccidentals={};var C=!1;_===g.children.length-1&&(C=!0);var S=r(w,e);if(S.abcelem.barNumber){delete S.abcelem.barNumber;for(var M=0;M<S.children.length;M++)if("barNumber"===S.children[M].type){S.children.splice(M,1);break}}S.abcelem.lastBar=C,v.children.push(S),i.push({el_type:w.abcelem.el_type,type:w.abcelem.type,endChar:w.abcelem.endChar,startChar:w.abcelem.startChar,abselem:S});break;case"rest":var E=h(w);if(E){if((b=u(e,null,E)).error)return;B={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},d(e,T,w,b.graces,i)}break;case"note":var T=n(w);T.x=w.heads[0].x+w.heads[0].w/2,T.lyricDim=a(w);var P=w.abcelem.pitches,A=w.abcelem.gracenotes;if(T.type="tabNumber",(b=u(e,P,A)).error)return;if(b.graces){var I=b.notes.length-1;b.notes[I].graces=b.graces}y={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[]};for(var N=0;N<b.notes.length;N++){var L=b.notes[N];if(L.graces)for(var O=0;O<L.graces.length;O++){var B={el_type:"note",startChar:w.abcelem.startChar,endChar:w.abcelem.endChar,notes:[],grace:!0},D=c(e,l(w,O),B,L.graces[O],!0);T.children.push(D),i.push(B)}var R=c(e,T.x+w.heads[N].dx,y,L,!1);T.children.push(R)}y.notes.length>0&&(y.abselem=T,i.push(y),v.children.push(T))}}},Sc=o}(),i=Vd();function n(e,t,i){var n=e.semantics,r=t.controller.getTextSize,s=n.tabInfos(e),a=!0;if(n.suppress(e)&&(a=!1),a){var o=r.calc(s,"tablabelfont","text instrumentname");return i.tabNameInfos={textSize:{height:o.height,width:o.width},name:s},o.height}return 0}function r(e,t){return!(!t[e].isTabStaff||e!==t.length-1&&t[e+1].isTabStaff)}function s(e,t){for(var i=t;i>=0;i--)if(!e[i].isTabStaff)return i;return-1}function a(e,t){return"clef"===e[t].children[0].abcelem.el_type?null:0==t?"none":e[t-1].children[0]}return Ec=function(o,c,l,h){var u=new t,d={clef:{type:"TAB"}},p=o.linePitch*o.nbLines,f=l.staff;if(f){var m=f[0];if(m&&m.clef&&0==m.clef.stafflines)return void o.setError("No tablatures when stafflines=0");f.splice(f.length,0,d)}var g=l.staffGroup,v=g.voices,b=function(e){for(var t=0,i=0;i<e.children.length;i++){var n=e.children[i];n.specialY&&n.specialY.lyricHeightBelow>t&&(t=n.specialY.lyricHeightBelow)}return t}(v[0]),y=h,_=g.staffs[y],w=p+3-_.bottom-b;_.isTabStaff&&(w=_.top);var x,k={bottom:-1,isTabStaff:!0,specialY:{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0},lines:o.nbLines,linePitch:o.linePitch,dy:.15,top:w},C=function(e,t){for(var i=0,n=0,s=0;;){if(!t[i])return-1;if(t[i].isTabStaff||(s=t[i].voices.length),t[i].isTabStaff){if(n++,r(i,t)&&n<s)return i+1}else if(n=0,i>=e){if(i+1==t.length)return i+1;if(!t[i+1].isTabStaff)return i+1}if(++i>t.length)return-1}}(h,g.staffs);if(-1!==C){k.parentIndex=C-1,g.staffs.splice(C,0,k),g.height+=p+3;var S=function(e,t){for(var i=t;i>=0;i--)if(!e[i].isTabStaff)return e[i];return null}(g.staffs,C),M=1;x=S,1===function(e){for(var t=0,i=0;i<e.length;i++)e[i].isTabStaff||t++;return t}(g.staffs)&&x.voices.length>1&&(M=S.voices.length),d.voices=[];for(var E=0;E<M;E++){var T=new e(0,0);E>0&&(T.duplicate=!0);var P=n(o,c,T)/i.STEP;P=Math.max(P,1),g.staffs[h].top+=1,g.height+=P,T.staff=k;var A=v.length;v.splice(v.length,0,T);var I=a(v,E+h);d.voices[E]=[],u.build(o,v,d.voices[E],E,h,I,A)}!function(e){for(var t=0;t<e.length;t++)if(e[t].isTabStaff){var i=s(e,t);e[t].hasStaff=e[i],e[i].hasTab||(e[i].hasTab=[]),e[i].hasTab.push(e[t])}}(g.staffs)}}}(),i=Zd();function n(){}return n.prototype.init=function(t,n,r,s){this.tune=t,this.params=r,this.tuneNumber=n,this.inError=!1,this.abcTune=t,this.linePitch=3,this.nbLines=s.defaultTuning.length,this.isTabBig=s.isTabBig,this.tabSymbolOffset=s.tabSymbolOffset,this.capo=r.capo,this.transpose=r.visualTranspose,this.hideTabSymbol=r.hideTabSymbol,this.tablature=new e(this.nbLines,this.linePitch);var a=r.tuning;a||(a=s.defaultTuning),this.tuning=a,this.semantics=new i(this)},n.prototype.setError=function(e){e&&(this.error=e,this.inError=!0,this.tune.warnings?this.tune.warnings.push(e):this.tune.warnings=[e])},n.prototype.render=function(e,i,n){this.inError||this.tablature.bypass(i)||t(this,e,i,n)},Rc=function(){return{name:"StringTab",tablature:n}}}function ep(){if(qc)return Vc;qc=1;var e=Jd(),t={violin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},fiddle:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},mandolin:{name:"StringTab",defaultTuning:["G,","D","A","e"],isTabBig:!1,tabSymbolOffset:0},guitar:{name:"StringTab",defaultTuning:["E,","A,","D","G","B","e"],isTabBig:!0,tabSymbolOffset:0},fiveString:{name:"StringTab",defaultTuning:["C,","G,","D","A","e"],isTabBig:!1,tabSymbolOffset:-.95}};return Vc={inited:!1,plugins:{},register:function(e){var t=e.name,i=e.tablature;this.plugins[t]=i},setError:function(e,t){e.warnings?e.warning.push(t):e.warnings=[t]},preparePlugins:function(i,n,r){this.inited||(this.register(new e),this.inited=!0);var s=null;if(r.tablature){var a=r.tablature;s=[];for(var o=0;o<a.length;o++){var c=a[o],l=c.instrument;if(null==l)return this.setError(i,"tablature 'instrument' is missing"),s;var h=t[l],u=null;if(h&&(u=this.plugins[h.name]),u){0!=r.visualTranspose&&(c.visualTranspose=r.visualTranspose),c.abcSrc=r.tablature.abcSrc;var d={classz:u,tuneNumber:n,params:c,instance:null,tabType:h};s.push(d)}else{if(""!==l)return this.setError(i,"Undefined tablature plugin: "+l),s;s.push(null)}}}return s},layoutTablatures:function(e,t){var i=t.tablatures,n=0;if(i&&i.length>0)for(var r=i.length,s=0;s<r;++s)i[s]&&i[s].params.firstStaffOnly&&(i[s].params.suppress=!1);for(var a=0;a<t.lines.length;a++){var o=t.lines[a];if(o.staff&&n++,n>1&&i&&i.length>0)for(r=i.length,s=0;s<r;++s)i[s].params.firstStaffOnly&&(i[s].params.suppress=!0);var c=o.staff;if(c)for(var l=c.length,h=0;h<c.length;h++)if(i[h]&&h<l){var u=i[h];null==u.instance&&(u.instance=new u.classz,u.instance.init(t,u.tuneNumber,u.params,u.tabType)),u.instance.render(e,o,h)}}}}}function tp(){if(jc)return Fc;jc=1;var e=Hd(),t=function(){if(hc)return lc;hc=1;var e=Io();return lc=function(t){for(var i="",n=t.match(/(\s*)/),r=(t=e.strip(t)).split("\nX:"),s=1;s<r.length;s++)r[s]="X:"+r[s];var a=n?n[0].length:0,o=[];r.forEach((function(e){o.push({abc:e,startPos:a}),a+=e.length+1})),o.length>1&&!e.startsWith(o[0].abc,"X:")&&o.shift().abc.split("\n").forEach((function(t){e.startsWith(t,"%%")&&(i+=t+"\n")}));var c=i;return o.forEach((function(t){var n=t.abc.indexOf("\n\n");n>0&&(t.abc=t.abc.substring(0,n)),t.pure=t.abc,t.abc=i+t.abc,t.title="";var r=t.pure.split("T:");r.length>1&&(r=r[1].split("\n"),t.title=e.strip(r[0]));var s=t.pure.substring(2,t.pure.indexOf("\n"));t.id=e.strip(s)})),{header:c,tunes:o}}}(),i=ep(),n={};return function(){n.numberOfTunes=function(e){var t=e.split("\nX:").length;return 0===t&&(t=1),t};var r=n.TuneBook=function(e){var i=t(e);this.header=i.header,this.tunes=i.tunes};r.prototype.getTuneById=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].id===""+e)return this.tunes[t];return null},r.prototype.getTuneByTitle=function(e){for(var t=0;t<this.tunes.length;t++)if(this.tunes[t].title===e)return this.tunes[t];return null},n.parseOnly=function(e,t){for(var i=n.numberOfTunes(e),r=[],s=0;s<i;s++)r.push(1);return n.renderEngine((function(){}),r,e,t)},n.renderEngine=function(t,n,s,a){var o=[];if(void 0!==n&&void 0!==s){var c;(!(c=n)||c.propertyIsEnumerable("length")||"object"!=typeof c||"number"!=typeof c.length)&&(n=[n]),void 0===a&&(a={});for(var l=a.startingTune?parseInt(a.startingTune,10):0,h=new r(s),u=new e,d=0;d<n.length;d++){var p=n[d];if("*"===p||"string"==typeof p&&(p=document.getElementById(p)),p)if(l>=0&&l<h.tunes.length){u.parse(h.tunes[l].abc,a,h.tunes[l].startPos-h.header.length);var f=u.getTune();a.tablature&&(f.tablatures=i.preparePlugins(f,l,a));var m=u.getWarnings();m&&(f.warnings=m);var g=t(p,f,d,h.tunes[l].abc);o.push(g||f)}else p.innerHTML&&(p.innerHTML="");l++}return o}},n.extractMeasures=function(e){for(var t=[],i=new r(e),s=0;s<i.tunes.length;s++){for(var a=i.tunes[s],o=a.abc.split("K:"),c=o[1].split("\n"),l=o[0]+"K:"+c[0]+"\n",h=null,u=null,d=null,p=[],f=!1,m=n.parseOnly(a.abc)[0],g=m.getPickupLength()>0,v=0;v<m.lines.length;v++){var b=m.lines[v];if(b.staff)for(var y=0;y<1;y++)for(var _=b.staff[y],w=0;w<1;w++)for(var x=_.voices[w],k=0;k<x.length;k++){var C=x[k];if(null===d&&C.startChar>=0&&(d=C.startChar,u=void 0===C.chord?h:null),C.chord&&(h=C),"bar"===C.el_type){if(f){var S={abc:a.abc.substring(d,C.endChar)};(h=u&&u.chord&&u.chord.length>0?u.chord[0].name:null)&&(S.lastChord=h),C.startEnding&&(S.startEnding=C.startEnding),C.endEnding&&(S.endEnding=C.endEnding),p.push(S),d=null,f=!1}}else"note"===C.el_type&&(f=!0)}}t.push({header:l,measures:p,hasPickup:g})}return t}}(),Fc=n}function ip(){if(Xc)return Kc;Xc=1;var e=Vd(),t={0:{d:[["M",4.83,-14.97],["c",.33,-.03,1.11,0,1.47,.06],["c",1.68,.36,2.97,1.59,3.78,3.6],["c",1.2,2.97,.81,6.96,-.9,9.27],["c",-.78,1.08,-1.71,1.71,-2.91,1.95],["c",-.45,.09,-1.32,.09,-1.77,0],["c",-.81,-.18,-1.47,-.51,-2.07,-1.02],["c",-2.34,-2.07,-3.15,-6.72,-1.74,-10.2],["c",.87,-2.16,2.28,-3.42,4.14,-3.66],["z"],["m",1.11,.87],["c",-.21,-.06,-.69,-.09,-.87,-.06],["c",-.54,.12,-.87,.42,-1.17,.99],["c",-.36,.66,-.51,1.56,-.6,3],["c",-.03,.75,-.03,4.59,0,5.31],["c",.09,1.5,.27,2.4,.6,3.06],["c",.24,.48,.57,.78,.96,.9],["c",.27,.09,.78,.09,1.05,0],["c",.39,-.12,.72,-.42,.96,-.9],["c",.33,-.66,.51,-1.56,.6,-3.06],["c",.03,-.72,.03,-4.56,0,-5.31],["c",-.09,-1.47,-.27,-2.37,-.6,-3.03],["c",-.24,-.48,-.54,-.78,-.93,-.9],["z"]],w:10.78,h:14.959},1:{d:[["M",3.3,-15.06],["c",.06,-.06,.21,-.03,.66,.15],["c",.81,.39,1.08,.39,1.83,.03],["c",.21,-.09,.39,-.15,.42,-.15],["c",.12,0,.21,.09,.27,.21],["c",.06,.12,.06,.33,.06,5.94],["c",0,3.93,0,5.85,.03,6.03],["c",.06,.36,.15,.69,.27,.96],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.12,-.27,.21,-.6,.27,-.96],["c",.03,-.18,.03,-1.59,.03,-4.29],["c",0,-3.87,0,-4.05,-.06,-4.14],["c",-.09,-.15,-.18,-.24,-.39,-.24],["c",-.12,0,-.15,.03,-.21,.06],["c",-.03,.06,-.45,.99,-.96,2.13],["c",-.48,1.14,-.9,2.1,-.93,2.16],["c",-.06,.15,-.21,.24,-.33,.24],["c",-.24,0,-.42,-.18,-.42,-.39],["c",0,-.06,3.27,-7.62,3.33,-7.74],["z"]],w:8.94,h:15.058},2:{d:[["M",4.23,-14.97],["c",.57,-.06,1.68,0,2.34,.18],["c",.69,.18,1.5,.54,2.01,.9],["c",1.35,.96,1.95,2.25,1.77,3.81],["c",-.15,1.35,-.66,2.34,-1.68,3.15],["c",-.6,.48,-1.44,.93,-3.12,1.65],["c",-1.32,.57,-1.8,.81,-2.37,1.14],["c",-.57,.33,-.57,.33,-.24,.27],["c",.39,-.09,1.26,-.09,1.68,0],["c",.72,.15,1.41,.45,2.1,.9],["c",.99,.63,1.86,.87,2.55,.75],["c",.24,-.06,.42,-.15,.57,-.3],["c",.12,-.09,.3,-.42,.3,-.51],["c",0,-.09,.12,-.21,.24,-.24],["c",.18,-.03,.39,.12,.39,.3],["c",0,.12,-.15,.57,-.3,.87],["c",-.54,1.02,-1.56,1.74,-2.79,2.01],["c",-.42,.09,-1.23,.09,-1.62,.03],["c",-.81,-.18,-1.32,-.45,-2.01,-1.11],["c",-.45,-.45,-.63,-.57,-.96,-.69],["c",-.84,-.27,-1.89,.12,-2.25,.9],["c",-.12,.21,-.21,.54,-.21,.72],["c",0,.12,-.12,.21,-.27,.24],["c",-.15,0,-.27,-.03,-.33,-.15],["c",-.09,-.21,.09,-1.08,.33,-1.71],["c",.24,-.66,.66,-1.26,1.29,-1.89],["c",.45,-.45,.9,-.81,1.92,-1.56],["c",1.29,-.93,1.89,-1.44,2.34,-1.98],["c",.87,-1.05,1.26,-2.19,1.2,-3.63],["c",-.06,-1.29,-.39,-2.31,-.96,-2.91],["c",-.36,-.33,-.72,-.51,-1.17,-.54],["c",-.84,-.03,-1.53,.42,-1.59,1.05],["c",-.03,.33,.12,.6,.57,1.14],["c",.45,.54,.54,.87,.42,1.41],["c",-.15,.63,-.54,1.11,-1.08,1.38],["c",-.63,.33,-1.2,.33,-1.83,0],["c",-.24,-.12,-.33,-.18,-.54,-.39],["c",-.18,-.18,-.27,-.3,-.36,-.51],["c",-.24,-.45,-.27,-.84,-.21,-1.38],["c",.12,-.75,.45,-1.41,1.02,-1.98],["c",.72,-.72,1.74,-1.17,2.85,-1.32],["z"]],w:10.764,h:14.97},3:{d:[["M",3.78,-14.97],["c",.3,-.03,1.41,0,1.83,.06],["c",2.22,.3,3.51,1.32,3.72,2.91],["c",.03,.33,.03,1.26,-.03,1.65],["c",-.12,.84,-.48,1.47,-1.05,1.77],["c",-.27,.15,-.36,.24,-.45,.39],["c",-.09,.21,-.09,.36,0,.57],["c",.09,.15,.18,.24,.51,.39],["c",.75,.42,1.23,1.14,1.41,2.13],["c",.06,.42,.06,1.35,0,1.71],["c",-.18,.81,-.48,1.38,-1.02,1.95],["c",-.75,.72,-1.8,1.2,-3.18,1.38],["c",-.42,.06,-1.56,.06,-1.95,0],["c",-1.89,-.33,-3.18,-1.29,-3.51,-2.64],["c",-.03,-.12,-.03,-.33,-.03,-.6],["c",0,-.36,0,-.42,.06,-.63],["c",.12,-.3,.27,-.51,.51,-.75],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.51,.36,-.63,.54,-.6,.87],["c",.06,.54,.54,.9,1.38,.99],["c",.36,.06,.72,.03,.96,-.06],["c",.81,-.27,1.29,-1.23,1.44,-2.79],["c",.03,-.45,.03,-1.95,-.03,-2.37],["c",-.09,-.75,-.33,-1.23,-.75,-1.44],["c",-.33,-.18,-.45,-.18,-1.98,-.18],["c",-1.35,0,-1.41,0,-1.5,-.06],["c",-.18,-.12,-.24,-.39,-.12,-.6],["c",.12,-.15,.15,-.15,1.68,-.15],["c",1.5,0,1.62,0,1.89,-.15],["c",.18,-.09,.42,-.36,.54,-.57],["c",.18,-.42,.27,-.9,.3,-1.95],["c",.03,-1.2,-.06,-1.8,-.36,-2.37],["c",-.24,-.48,-.63,-.81,-1.14,-.96],["c",-.3,-.06,-1.08,-.06,-1.38,.03],["c",-.6,.15,-.9,.42,-.96,.84],["c",-.03,.3,.06,.45,.63,.84],["c",.33,.24,.42,.39,.45,.63],["c",.03,.72,-.57,1.5,-1.32,1.65],["c",-1.05,.27,-2.1,-.57,-2.1,-1.65],["c",0,-.45,.15,-.96,.39,-1.38],["c",.12,-.21,.54,-.63,.81,-.81],["c",.57,-.42,1.38,-.69,2.25,-.81],["z"]],w:9.735,h:14.967},4:{d:[["M",8.64,-14.94],["c",.27,-.09,.42,-.12,.54,-.03],["c",.09,.06,.15,.21,.15,.3],["c",-.03,.06,-1.92,2.31,-4.23,5.04],["c",-2.31,2.73,-4.23,4.98,-4.26,5.01],["c",-.03,.06,.12,.06,2.55,.06],["l",2.61,0],["l",0,-2.37],["c",0,-2.19,.03,-2.37,.06,-2.46],["c",.03,-.06,.21,-.18,.57,-.42],["c",1.08,-.72,1.38,-1.08,1.86,-2.16],["c",.12,-.3,.24,-.54,.27,-.57],["c",.12,-.12,.39,-.06,.45,.12],["c",.06,.09,.06,.57,.06,3.96],["l",0,3.9],["l",1.08,0],["c",1.05,0,1.11,0,1.2,.06],["c",.24,.15,.24,.54,0,.69],["c",-.09,.06,-.15,.06,-1.2,.06],["l",-1.08,0],["l",0,.33],["c",0,.57,.09,1.11,.3,1.53],["c",.36,.75,.93,1.17,1.68,1.26],["c",.3,.03,.39,.09,.39,.3],["c",0,.15,-.03,.18,-.09,.24],["c",-.06,.06,-.09,.06,-.48,.06],["c",-.42,0,-.69,-.03,-2.1,-.24],["c",-.9,-.15,-1.77,-.15,-2.67,0],["c",-1.41,.21,-1.68,.24,-2.1,.24],["c",-.39,0,-.42,0,-.48,-.06],["c",-.06,-.06,-.06,-.09,-.06,-.24],["c",0,-.21,.06,-.27,.36,-.3],["c",.75,-.09,1.32,-.51,1.68,-1.26],["c",.21,-.42,.3,-.96,.3,-1.53],["l",0,-.33],["l",-2.7,0],["c",-2.91,0,-2.85,0,-3.09,-.15],["c",-.18,-.12,-.3,-.39,-.27,-.54],["c",.03,-.06,.18,-.24,.33,-.45],["c",.75,-.9,1.59,-2.07,2.13,-3.03],["c",.33,-.54,.84,-1.62,1.05,-2.16],["c",.57,-1.41,.84,-2.64,.9,-4.05],["c",.03,-.63,.06,-.72,.24,-.81],["l",.12,-.06],["l",.45,.12],["c",.66,.18,1.02,.24,1.47,.27],["c",.6,.03,1.23,-.09,2.01,-.33],["z"]],w:11.795,h:14.994},5:{d:[["M",1.02,-14.94],["c",.12,-.09,.03,-.09,1.08,.06],["c",2.49,.36,4.35,.36,6.96,-.06],["c",.57,-.09,.66,-.06,.81,.06],["c",.15,.18,.12,.24,-.15,.51],["c",-1.29,1.26,-3.24,2.04,-5.58,2.31],["c",-.6,.09,-1.2,.12,-1.71,.12],["c",-.39,0,-.45,0,-.57,.06],["c",-.09,.06,-.15,.12,-.21,.21],["l",-.06,.12],["l",0,1.65],["l",0,1.65],["l",.21,-.21],["c",.66,-.57,1.41,-.96,2.19,-1.14],["c",.33,-.06,1.41,-.06,1.95,0],["c",2.61,.36,4.02,1.74,4.26,4.14],["c",.03,.45,.03,1.08,-.03,1.44],["c",-.18,1.02,-.78,2.01,-1.59,2.7],["c",-.72,.57,-1.62,1.02,-2.49,1.2],["c",-1.38,.27,-3.03,.06,-4.2,-.54],["c",-1.08,-.54,-1.71,-1.32,-1.86,-2.28],["c",-.09,-.69,.09,-1.29,.57,-1.74],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.36,.33,.57,.75,.6,1.2],["c",0,.21,0,.27,-.06,.42],["c",-.09,.18,-.12,.24,-.54,.54],["c",-.18,.12,-.36,.3,-.42,.33],["c",-.36,.42,-.18,.99,.36,1.26],["c",.51,.27,1.47,.36,2.01,.27],["c",.93,-.21,1.47,-1.17,1.65,-2.91],["c",.06,-.45,.06,-1.89,0,-2.31],["c",-.15,-1.2,-.51,-2.1,-1.05,-2.55],["c",-.21,-.18,-.54,-.36,-.81,-.39],["c",-.3,-.06,-.84,-.03,-1.26,.06],["c",-.93,.18,-1.65,.6,-2.16,1.2],["c",-.15,.21,-.27,.3,-.39,.3],["c",-.15,0,-.3,-.09,-.36,-.18],["c",-.06,-.09,-.06,-.15,-.06,-3.66],["c",0,-3.39,0,-3.57,.06,-3.66],["c",.03,-.06,.09,-.15,.15,-.18],["z"]],w:10.212,h:14.997},6:{d:[["M",4.98,-14.97],["c",.36,-.03,1.2,0,1.59,.06],["c",.9,.15,1.68,.51,2.25,1.05],["c",.57,.51,.87,1.23,.84,1.98],["c",-.03,.51,-.21,.9,-.6,1.26],["c",-.24,.24,-.45,.39,-.75,.51],["c",-.21,.06,-.27,.06,-.6,.06],["c",-.33,0,-.39,0,-.6,-.06],["c",-.3,-.12,-.51,-.27,-.75,-.51],["c",-.39,-.36,-.57,-.78,-.57,-1.26],["c",0,-.27,0,-.3,.09,-.42],["c",.03,-.09,.18,-.21,.3,-.3],["c",.12,-.09,.3,-.21,.39,-.27],["c",.09,-.06,.21,-.18,.27,-.24],["c",.06,-.12,.09,-.15,.09,-.33],["c",0,-.18,-.03,-.24,-.09,-.36],["c",-.24,-.39,-.75,-.6,-1.38,-.57],["c",-.54,.03,-.9,.18,-1.23,.48],["c",-.81,.72,-1.08,2.16,-.96,5.37],["l",0,.63],["l",.3,-.12],["c",.78,-.27,1.29,-.33,2.1,-.27],["c",1.47,.12,2.49,.54,3.27,1.29],["c",.48,.51,.81,1.11,.96,1.89],["c",.06,.27,.06,.42,.06,.93],["c",0,.54,0,.69,-.06,.96],["c",-.15,.78,-.48,1.38,-.96,1.89],["c",-.54,.51,-1.17,.87,-1.98,1.08],["c",-1.14,.3,-2.4,.33,-3.24,.03],["c",-1.5,-.48,-2.64,-1.89,-3.27,-4.02],["c",-.36,-1.23,-.51,-2.82,-.42,-4.08],["c",.3,-3.66,2.28,-6.3,4.95,-6.66],["z"],["m",.66,7.41],["c",-.27,-.09,-.81,-.12,-1.08,-.06],["c",-.72,.18,-1.08,.69,-1.23,1.71],["c",-.06,.54,-.06,3,0,3.54],["c",.18,1.26,.72,1.77,1.8,1.74],["c",.39,-.03,.63,-.09,.9,-.27],["c",.66,-.42,.9,-1.32,.9,-3.24],["c",0,-2.22,-.36,-3.12,-1.29,-3.42],["z"]],w:9.956,h:14.982},7:{d:[["M",.21,-14.97],["c",.21,-.06,.45,0,.54,.15],["c",.06,.09,.06,.15,.06,.39],["c",0,.24,0,.33,.06,.42],["c",.06,.12,.21,.24,.27,.24],["c",.03,0,.12,-.12,.24,-.21],["c",.96,-1.2,2.58,-1.35,3.99,-.42],["c",.15,.12,.42,.3,.54,.45],["c",.48,.39,.81,.57,1.29,.6],["c",.69,.03,1.5,-.3,2.13,-.87],["c",.09,-.09,.27,-.3,.39,-.45],["c",.12,-.15,.24,-.27,.3,-.3],["c",.18,-.06,.39,.03,.51,.21],["c",.06,.18,.06,.24,-.27,.72],["c",-.18,.24,-.54,.78,-.78,1.17],["c",-2.37,3.54,-3.54,6.27,-3.87,9],["c",-.03,.33,-.03,.66,-.03,1.26],["c",0,.9,0,1.08,.15,1.89],["c",.06,.45,.06,.48,.03,.6],["c",-.06,.09,-.21,.21,-.3,.21],["c",-.03,0,-.27,-.06,-.54,-.15],["c",-.84,-.27,-1.11,-.3,-1.65,-.3],["c",-.57,0,-.84,.03,-1.56,.27],["c",-.6,.18,-.69,.21,-.81,.15],["c",-.12,-.06,-.21,-.18,-.21,-.3],["c",0,-.15,.6,-1.44,1.2,-2.61],["c",1.14,-2.22,2.73,-4.68,5.1,-8.01],["c",.21,-.27,.36,-.48,.33,-.48],["c",0,0,-.12,.06,-.27,.12],["c",-.54,.3,-.99,.39,-1.56,.39],["c",-.75,.03,-1.2,-.18,-1.83,-.75],["c",-.99,-.9,-1.83,-1.17,-2.31,-.72],["c",-.18,.15,-.36,.51,-.45,.84],["c",-.06,.24,-.06,.33,-.09,1.98],["c",0,1.62,-.03,1.74,-.06,1.8],["c",-.15,.24,-.54,.24,-.69,0],["c",-.06,-.09,-.06,-.15,-.06,-3.57],["c",0,-3.42,0,-3.48,.06,-3.57],["c",.03,-.06,.09,-.12,.15,-.15],["z"]],w:10.561,h:15.093},8:{d:[["M",4.98,-14.97],["c",.33,-.03,1.02,-.03,1.32,0],["c",1.32,.12,2.49,.6,3.21,1.32],["c",.39,.39,.66,.81,.78,1.29],["c",.09,.36,.09,1.08,0,1.44],["c",-.21,.84,-.66,1.59,-1.59,2.55],["l",-.3,.3],["l",.27,.18],["c",1.47,.93,2.31,2.31,2.25,3.75],["c",-.03,.75,-.24,1.35,-.63,1.95],["c",-.45,.66,-1.02,1.14,-1.83,1.53],["c",-1.8,.87,-4.2,.87,-6,.03],["c",-1.62,-.78,-2.52,-2.16,-2.46,-3.66],["c",.06,-.99,.54,-1.77,1.8,-2.97],["c",.54,-.51,.54,-.54,.48,-.57],["c",-.39,-.27,-.96,-.78,-1.2,-1.14],["c",-.75,-1.11,-.87,-2.4,-.3,-3.6],["c",.69,-1.35,2.25,-2.25,4.2,-2.4],["z"],["m",1.53,.69],["c",-.42,-.09,-1.11,-.12,-1.38,-.06],["c",-.3,.06,-.6,.18,-.81,.3],["c",-.21,.12,-.6,.51,-.72,.72],["c",-.51,.87,-.42,1.89,.21,2.52],["c",.21,.21,.36,.3,1.95,1.23],["c",.96,.54,1.74,.99,1.77,1.02],["c",.09,0,.63,-.6,.99,-1.11],["c",.21,-.36,.48,-.87,.57,-1.23],["c",.06,-.24,.06,-.36,.06,-.72],["c",0,-.45,-.03,-.66,-.15,-.99],["c",-.39,-.81,-1.29,-1.44,-2.49,-1.68],["z"],["m",-1.44,8.07],["l",-1.89,-1.08],["c",-.03,0,-.18,.15,-.39,.33],["c",-1.2,1.08,-1.65,1.95,-1.59,3],["c",.09,1.59,1.35,2.85,3.21,3.24],["c",.33,.06,.45,.06,.93,.06],["c",.63,0,.81,-.03,1.29,-.27],["c",.9,-.42,1.47,-1.41,1.41,-2.4],["c",-.06,-.66,-.39,-1.29,-.9,-1.65],["c",-.12,-.09,-1.05,-.63,-2.07,-1.23],["z"]],w:10.926,h:14.989},9:{d:[["M",4.23,-14.97],["c",.42,-.03,1.29,0,1.62,.06],["c",.51,.12,.93,.3,1.38,.57],["c",1.53,1.02,2.52,3.24,2.73,5.94],["c",.18,2.55,-.48,4.98,-1.83,6.57],["c",-1.05,1.26,-2.4,1.89,-3.93,1.83],["c",-1.23,-.06,-2.31,-.45,-3.03,-1.14],["c",-.57,-.51,-.87,-1.23,-.84,-1.98],["c",.03,-.51,.21,-.9,.6,-1.26],["c",.24,-.24,.45,-.39,.75,-.51],["c",.21,-.06,.27,-.06,.6,-.06],["c",.33,0,.39,0,.6,.06],["c",.3,.12,.51,.27,.75,.51],["c",.39,.36,.57,.78,.57,1.26],["c",0,.27,0,.3,-.09,.42],["c",-.03,.09,-.18,.21,-.3,.3],["c",-.12,.09,-.3,.21,-.39,.27],["c",-.09,.06,-.21,.18,-.27,.24],["c",-.06,.12,-.06,.15,-.06,.33],["c",0,.18,0,.24,.06,.36],["c",.24,.39,.75,.6,1.38,.57],["c",.54,-.03,.9,-.18,1.23,-.48],["c",.81,-.72,1.08,-2.16,.96,-5.37],["l",0,-.63],["l",-.3,.12],["c",-.78,.27,-1.29,.33,-2.1,.27],["c",-1.47,-.12,-2.49,-.54,-3.27,-1.29],["c",-.48,-.51,-.81,-1.11,-.96,-1.89],["c",-.06,-.27,-.06,-.42,-.06,-.96],["c",0,-.51,0,-.66,.06,-.93],["c",.15,-.78,.48,-1.38,.96,-1.89],["c",.15,-.12,.33,-.27,.42,-.36],["c",.69,-.51,1.62,-.81,2.76,-.93],["z"],["m",1.17,.66],["c",-.21,-.06,-.57,-.06,-.81,-.03],["c",-.78,.12,-1.26,.69,-1.41,1.74],["c",-.12,.63,-.15,1.95,-.09,2.79],["c",.12,1.71,.63,2.4,1.77,2.46],["c",1.08,.03,1.62,-.48,1.8,-1.74],["c",.06,-.54,.06,-3,0,-3.54],["c",-.15,-1.05,-.51,-1.53,-1.26,-1.68],["z"]],w:9.959,h:14.986},"rests.multimeasure":{d:[["M",0,-4],["l",0,16],["l",1,0],["l",0,-5],["l",40,0],["l",0,5],["l",1,0],["l",0,-16],["l",-1,0],["l",0,5],["l",-40,0],["l",0,-5],["z"]],w:42,h:18},"rests.whole":{d:[["M",.06,.03],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.half":{d:[["M",.06,-4.62],["l",.09,-.06],["l",5.46,0],["l",5.49,0],["l",.09,.06],["l",.06,.09],["l",0,2.19],["l",0,2.19],["l",-.06,.09],["l",-.09,.06],["l",-5.49,0],["l",-5.46,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-2.19],["l",0,-2.19],["z"]],w:11.25,h:4.68},"rests.quarter":{d:[["M",1.89,-11.82],["c",.12,-.06,.24,-.06,.36,-.03],["c",.09,.06,4.74,5.58,4.86,5.82],["c",.21,.39,.15,.78,-.15,1.26],["c",-.24,.33,-.72,.81,-1.62,1.56],["c",-.45,.36,-.87,.75,-.96,.84],["c",-.93,.99,-1.14,2.49,-.6,3.63],["c",.18,.39,.27,.48,1.32,1.68],["c",1.92,2.25,1.83,2.16,1.83,2.34],["c",0,.18,-.18,.36,-.36,.39],["c",-.15,0,-.27,-.06,-.48,-.27],["c",-.75,-.75,-2.46,-1.29,-3.39,-1.08],["c",-.45,.09,-.69,.27,-.9,.69],["c",-.12,.3,-.21,.66,-.24,1.14],["c",-.03,.66,.09,1.35,.3,2.01],["c",.15,.42,.24,.66,.45,.96],["c",.18,.24,.18,.33,.03,.42],["c",-.12,.06,-.18,.03,-.45,-.3],["c",-1.08,-1.38,-2.07,-3.36,-2.4,-4.83],["c",-.27,-1.05,-.15,-1.77,.27,-2.07],["c",.21,-.12,.42,-.15,.87,-.15],["c",.87,.06,2.1,.39,3.3,.9],["l",.39,.18],["l",-1.65,-1.95],["c",-2.52,-2.97,-2.61,-3.09,-2.7,-3.27],["c",-.09,-.24,-.12,-.48,-.03,-.75],["c",.15,-.48,.57,-.96,1.83,-2.01],["c",.45,-.36,.84,-.72,.93,-.78],["c",.69,-.75,1.02,-1.8,.9,-2.79],["c",-.06,-.33,-.21,-.84,-.39,-1.11],["c",-.09,-.15,-.45,-.6,-.81,-1.05],["c",-.36,-.42,-.69,-.81,-.72,-.87],["c",-.09,-.18,0,-.42,.21,-.51],["z"]],w:7.888,h:21.435},"rests.8th":{d:[["M",1.68,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.33,-.09],["c",.39,-.18,1.32,-1.29,1.68,-1.98],["c",.09,-.21,.24,-.3,.39,-.3],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.27,1.11,-1.86,6.42],["c",-1.02,3.48,-1.89,6.39,-1.92,6.42],["c",0,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.15,-.57,1.68,-4.92],["c",.96,-2.67,1.74,-4.89,1.71,-4.89],["l",-.51,.15],["c",-1.08,.36,-1.74,.48,-2.55,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:7.534,h:13.883},"rests.16th":{d:[["M",3.33,-6.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.87,.42],["c",.39,-.18,1.2,-1.23,1.62,-2.07],["c",.06,-.15,.24,-.24,.36,-.24],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.45,1.86,-2.67,10.17],["c",-1.5,5.55,-2.73,10.14,-2.76,10.17],["c",-.03,.03,-.12,.12,-.24,.15],["c",-.18,.09,-.21,.09,-.45,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.12,-.57,1.44,-4.92],["c",.81,-2.67,1.47,-4.86,1.47,-4.89],["c",-.03,0,-.27,.06,-.54,.15],["c",-1.08,.36,-1.77,.48,-2.58,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.12,0,.18,0,.33,-.09],["c",.33,-.15,1.02,-.93,1.41,-1.59],["c",.12,-.21,.18,-.39,.39,-1.08],["c",.66,-2.1,1.17,-3.84,1.17,-3.87],["c",0,0,-.21,.06,-.42,.15],["c",-.51,.15,-1.2,.33,-1.68,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:9.724,h:21.383},"rests.32nd":{d:[["M",4.23,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.12,0,.18,0,.27,-.06],["c",.33,-.21,.99,-1.11,1.44,-1.98],["c",.09,-.24,.21,-.33,.39,-.33],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.57,2.67,-3.21,13.89],["c",-1.8,7.62,-3.3,13.89,-3.3,13.92],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.09,-.57,1.23,-4.92],["c",.69,-2.67,1.26,-4.86,1.29,-4.89],["c",0,-.03,-.12,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.12,.09,.3,.18,.48,.21],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.29,-1.29,1.56,-1.89],["c",.03,-.12,1.23,-4.59,1.23,-4.65],["c",0,-.03,-.18,.03,-.39,.12],["c",-.63,.18,-1.2,.36,-1.74,.45],["c",-.39,.06,-.54,.06,-1.02,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.18,.18,.51,.27,.72,.15],["c",.3,-.12,.69,-.57,1.08,-1.17],["c",.42,-.6,.39,-.51,1.05,-3.03],["c",.33,-1.26,.6,-2.31,.6,-2.34],["c",0,0,-.21,.03,-.45,.12],["c",-.57,.18,-1.14,.33,-1.62,.42],["c",-.33,.06,-.51,.06,-.96,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:11.373,h:28.883},"rests.64th":{d:[["M",5.13,-13.62],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.54,.3,.75,.18],["c",.24,-.12,.63,-.66,1.08,-1.56],["c",.33,-.66,.39,-.72,.6,-.72],["c",.12,0,.27,.09,.33,.18],["c",.03,.06,-.69,3.66,-3.54,17.64],["c",-1.95,9.66,-3.57,17.61,-3.57,17.64],["c",-.03,.06,-.12,.12,-.24,.18],["c",-.21,.09,-.24,.09,-.48,.09],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.06,-.57,1.05,-4.95],["c",.6,-2.7,1.08,-4.89,1.08,-4.92],["c",0,0,-.24,.06,-.51,.15],["c",-.66,.24,-1.2,.36,-1.77,.48],["c",-.42,.06,-.57,.06,-1.05,.06],["c",-.69,0,-.87,-.03,-1.35,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.72,-1.05,2.22,-1.23,3.06,-.42],["c",.3,.33,.42,.6,.6,1.38],["c",.09,.45,.21,.78,.33,.9],["c",.09,.09,.27,.18,.45,.21],["c",.21,.03,.39,-.09,.72,-.42],["c",.45,-.45,1.02,-1.26,1.17,-1.65],["c",.03,-.09,.27,-1.14,.54,-2.34],["c",.27,-1.2,.48,-2.19,.51,-2.22],["c",0,-.03,-.09,-.03,-.48,.12],["c",-1.17,.39,-2.22,.57,-3,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.15,.39,.57,.57,.9,.42],["c",.36,-.18,1.2,-1.26,1.47,-1.89],["c",.03,-.09,.3,-1.2,.57,-2.43],["l",.51,-2.28],["l",-.54,.18],["c",-1.11,.36,-1.8,.48,-2.61,.48],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.21,.21,.54,.3,.75,.18],["c",.36,-.18,.93,-.93,1.29,-1.68],["c",.12,-.24,.18,-.48,.63,-2.55],["l",.51,-2.31],["c",0,-.03,-.18,.03,-.39,.12],["c",-1.14,.36,-2.1,.54,-2.82,.51],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.453,h:36.383},"rests.128th":{d:[["M",6.03,-21.12],["c",.66,-.09,1.23,.09,1.68,.51],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.21,0,.33,-.06,.54,-.36],["c",.15,-.21,.54,-.93,.78,-1.47],["c",.15,-.33,.18,-.39,.3,-.48],["c",.18,-.09,.45,0,.51,.15],["c",.03,.09,-7.11,42.75,-7.17,42.84],["c",-.03,.03,-.15,.09,-.24,.15],["c",-.18,.06,-.24,.06,-.45,.06],["c",-.24,0,-.3,0,-.48,-.06],["c",-.09,-.06,-.21,-.12,-.21,-.15],["c",-.06,-.03,.03,-.57,.84,-4.98],["c",.51,-2.7,.93,-4.92,.9,-4.92],["c",0,0,-.15,.06,-.36,.12],["c",-.78,.27,-1.62,.48,-2.31,.57],["c",-.15,.03,-.54,.03,-.81,.03],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.63,.48],["c",.12,0,.18,0,.3,-.09],["c",.42,-.21,1.14,-1.11,1.5,-1.83],["c",.12,-.27,.12,-.27,.54,-2.52],["c",.24,-1.23,.42,-2.25,.39,-2.25],["c",0,0,-.24,.06,-.51,.18],["c",-1.26,.39,-2.25,.57,-3.06,.54],["c",-.42,-.03,-.75,-.12,-1.11,-.3],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.21,.51,.3,.75,.18],["c",.36,-.15,1.05,-.99,1.41,-1.77],["l",.15,-.3],["l",.42,-2.25],["c",.21,-1.26,.42,-2.28,.39,-2.28],["l",-.51,.15],["c",-1.11,.39,-1.89,.51,-2.7,.51],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.15,.63,.21,.81,.33,.96],["c",.18,.18,.48,.27,.72,.21],["c",.33,-.12,1.14,-1.26,1.41,-1.95],["c",0,-.09,.21,-1.11,.45,-2.34],["c",.21,-1.2,.39,-2.22,.39,-2.28],["c",.03,-.03,0,-.03,-.45,.12],["c",-.57,.18,-1.2,.33,-1.71,.42],["c",-.3,.06,-.51,.06,-.93,.06],["c",-.66,0,-.84,-.03,-1.32,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.36,-.54,.96,-.87,1.65,-.93],["c",.54,-.03,1.02,.15,1.41,.54],["c",.27,.3,.39,.54,.57,1.26],["c",.09,.33,.18,.66,.21,.72],["c",.12,.27,.33,.45,.6,.48],["c",.18,0,.36,-.09,.57,-.33],["c",.33,-.36,.78,-1.14,.93,-1.56],["c",.03,-.12,.24,-1.2,.45,-2.4],["c",.24,-1.2,.42,-2.22,.42,-2.28],["c",.03,-.03,0,-.03,-.39,.09],["c",-1.05,.36,-1.8,.48,-2.58,.48],["c",-.63,0,-.84,-.03,-1.29,-.27],["c",-1.32,-.63,-1.77,-2.16,-1.02,-3.3],["c",.33,-.45,.84,-.81,1.38,-.9],["z"]],w:12.992,h:43.883},"accidentals.sharp":{d:[["M",5.73,-11.19],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.31],["c",0,1.23,0,2.22,.03,2.22],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.43],["c",0,1.32,0,2.43,.03,2.43],["c",0,0,.27,-.12,.6,-.24],["c",.69,-.27,.78,-.3,.96,-.15],["c",.21,.15,.21,.18,.21,1.38],["c",0,1.02,0,1.11,-.06,1.2],["c",-.03,.06,-.09,.12,-.12,.15],["c",-.06,.03,-.42,.21,-.84,.36],["l",-.75,.33],["l",-.03,2.52],["c",0,2.28,-.03,2.55,-.06,2.64],["c",-.21,.36,-.72,.36,-.93,0],["c",-.03,-.09,-.06,-.33,-.06,-2.43],["l",0,-2.31],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.43],["c",0,2.58,0,2.52,-.15,2.67],["c",-.06,.09,-.27,.18,-.36,.18],["c",-.12,0,-.33,-.09,-.39,-.18],["c",-.15,-.15,-.15,-.09,-.15,-2.43],["c",0,-1.23,0,-2.22,-.03,-2.22],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.43],["c",0,-1.32,0,-2.43,-.03,-2.43],["c",0,0,-.27,.12,-.6,.24],["c",-.69,.27,-.78,.3,-.96,.15],["c",-.21,-.15,-.21,-.18,-.21,-1.38],["c",0,-1.02,0,-1.11,.06,-1.2],["c",.03,-.06,.09,-.12,.12,-.15],["c",.06,-.03,.42,-.21,.84,-.36],["l",.78,-.33],["l",0,-2.52],["c",0,-2.28,.03,-2.55,.06,-2.64],["c",.21,-.36,.72,-.36,.93,0],["c",.03,.09,.06,.33,.06,2.43],["l",.03,2.31],["l",1.26,-.51],["l",1.26,-.51],["l",0,-2.43],["c",0,-2.28,0,-2.43,.06,-2.55],["c",.06,-.12,.12,-.18,.27,-.24],["z"],["m",-.33,10.65],["l",0,-2.43],["l",-1.29,.51],["l",-1.26,.51],["l",0,2.46],["l",0,2.43],["l",.09,-.03],["c",.06,-.03,.63,-.27,1.29,-.51],["l",1.17,-.48],["l",0,-2.46],["z"]],w:8.25,h:22.462},"accidentals.halfsharp":{d:[["M",2.43,-10.05],["c",.21,-.12,.54,-.03,.66,.24],["c",.06,.12,.06,.21,.06,2.01],["c",0,1.05,0,1.89,.03,1.89],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.37],["c",0,1.32,0,2.37,.03,2.37],["l",.72,-.48],["c",.69,-.48,.69,-.51,.87,-.51],["c",.15,0,.18,.03,.27,.09],["c",.21,.15,.21,.18,.21,1.41],["c",0,1.11,-.03,1.14,-.09,1.23],["c",-.03,.03,-.48,.39,-1.02,.75],["l",-.99,.66],["l",0,2.25],["c",0,1.95,0,2.28,-.06,2.37],["c",-.06,.12,-.12,.21,-.24,.27],["c",-.27,.12,-.54,.03,-.69,-.24],["c",-.06,-.12,-.06,-.21,-.06,-2.01],["c",0,-1.05,0,-1.89,-.03,-1.89],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.37],["c",0,-1.32,0,-2.37,-.03,-2.37],["l",-.72,.48],["c",-.69,.48,-.69,.48,-.87,.48],["c",-.15,0,-.18,0,-.27,-.06],["c",-.21,-.15,-.21,-.18,-.21,-1.41],["c",0,-1.11,.03,-1.14,.09,-1.23],["c",.03,-.03,.48,-.39,1.02,-.75],["l",.99,-.66],["l",0,-2.25],["c",0,-2.13,0,-2.28,.06,-2.4],["c",.06,-.12,.12,-.18,.27,-.24],["z"]],w:5.25,h:20.174},"accidentals.nat":{d:[["M",.21,-11.4],["c",.24,-.06,.78,0,.99,.15],["c",.03,.03,.03,.48,0,2.61],["c",-.03,1.44,-.03,2.61,-.03,2.61],["c",0,.03,.75,-.09,1.68,-.24],["c",.96,-.18,1.71,-.27,1.74,-.27],["c",.15,.03,.27,.15,.36,.3],["l",.06,.12],["l",.09,8.67],["c",.09,6.96,.12,8.67,.09,8.67],["c",-.03,.03,-.12,.06,-.21,.09],["c",-.24,.09,-.72,.09,-.96,0],["c",-.09,-.03,-.18,-.06,-.21,-.09],["c",-.03,-.03,-.03,-.48,0,-2.61],["c",.03,-1.44,.03,-2.61,.03,-2.61],["c",0,-.03,-.75,.09,-1.68,.24],["c",-.96,.18,-1.71,.27,-1.74,.27],["c",-.15,-.03,-.27,-.15,-.36,-.3],["l",-.06,-.15],["l",-.09,-7.53],["c",-.06,-4.14,-.09,-8.04,-.12,-8.67],["l",0,-1.11],["l",.15,-.06],["c",.09,-.03,.21,-.06,.27,-.09],["z"],["m",3.75,8.4],["c",0,-.33,0,-.42,-.03,-.42],["c",-.12,0,-2.79,.45,-2.79,.48],["c",-.03,0,-.09,6.3,-.09,6.33],["c",.03,0,2.79,-.45,2.82,-.48],["c",0,0,.09,-4.53,.09,-5.91],["z"]],w:5.4,h:22.8},"accidentals.flat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:6.75,h:18.801},"accidentals.halfflat":{d:[["M",4.83,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.6,-.12,9.06],["c",-.09,5.55,-.15,9.06,-.18,9.12],["c",-.03,.09,-.09,.18,-.15,.27],["c",-.24,.21,-.54,.24,-.81,.06],["c",-.06,-.03,-.27,-.24,-.45,-.42],["c",-.36,-.42,-.66,-.66,-1.8,-1.44],["c",-1.23,-.84,-1.83,-1.32,-2.25,-1.77],["c",-.66,-.78,-.96,-1.56,-.93,-2.46],["c",.09,-1.41,1.11,-2.58,2.4,-2.79],["c",.3,-.06,.84,-.03,1.23,.06],["c",.54,.12,1.08,.33,1.53,.63],["c",.12,.09,.24,.15,.24,.12],["c",0,0,-.12,-8.37,-.18,-9.75],["l",0,-.66],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",-1.65,10.95],["c",-.6,-.18,-1.08,.09,-1.38,.69],["c",-.27,.6,-.36,1.38,-.18,2.07],["c",.12,.42,.42,.99,.72,1.41],["c",.3,.42,.93,1.05,1.56,1.59],["l",.48,.39],["l",0,-.12],["c",.03,-.09,.03,-.48,.06,-.9],["c",.03,-.57,.03,-1.08,0,-2.22],["c",-.03,-1.62,-.03,-1.62,-.24,-2.07],["c",-.21,-.42,-.6,-.75,-1.02,-.84],["z"]],w:6.728,h:18.801},"accidentals.dblflat":{d:[["M",-.36,-14.07],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"],["m",3,-11],["c",.33,-.06,.87,0,1.08,.15],["c",.06,.03,.06,.36,-.03,5.25],["c",-.06,2.85,-.09,5.19,-.09,5.19],["c",0,.03,.12,-.03,.24,-.12],["c",.63,-.42,1.41,-.66,2.19,-.72],["c",.81,-.03,1.47,.21,2.04,.78],["c",.57,.54,.87,1.26,.93,2.04],["c",.03,.57,-.09,1.08,-.36,1.62],["c",-.42,.81,-1.02,1.38,-2.82,2.61],["c",-1.14,.78,-1.44,1.02,-1.8,1.44],["c",-.18,.18,-.39,.39,-.45,.42],["c",-.27,.18,-.57,.15,-.81,-.06],["c",-.06,-.09,-.12,-.18,-.15,-.27],["c",-.03,-.06,-.09,-3.27,-.18,-8.34],["c",-.09,-4.53,-.15,-8.58,-.18,-9.03],["l",0,-.78],["l",.12,-.06],["c",.06,-.03,.18,-.09,.27,-.12],["z"],["m",3.18,11.01],["c",-.21,-.12,-.54,-.15,-.81,-.06],["c",-.54,.15,-.99,.63,-1.17,1.26],["c",-.06,.3,-.12,2.88,-.06,3.87],["c",.03,.42,.03,.81,.06,.9],["l",.03,.12],["l",.45,-.39],["c",.63,-.54,1.26,-1.17,1.56,-1.59],["c",.3,-.42,.6,-.99,.72,-1.41],["c",.18,-.69,.09,-1.47,-.18,-2.07],["c",-.15,-.3,-.33,-.51,-.6,-.63],["z"]],w:12.1,h:18.804},"accidentals.dblsharp":{d:[["M",-.18,-3.96],["c",.06,-.03,.12,-.06,.15,-.06],["c",.09,0,2.76,.27,2.79,.3],["c",.12,.03,.15,.12,.15,.51],["c",.06,.96,.24,1.59,.57,2.1],["c",.06,.09,.15,.21,.18,.24],["l",.09,.06],["l",.09,-.06],["c",.03,-.03,.12,-.15,.18,-.24],["c",.33,-.51,.51,-1.14,.57,-2.1],["c",0,-.39,.03,-.45,.12,-.51],["c",.03,0,.66,-.09,1.44,-.15],["c",1.47,-.15,1.5,-.15,1.56,-.03],["c",.03,.06,0,.42,-.09,1.44],["c",-.09,.72,-.15,1.35,-.15,1.38],["c",0,.03,-.03,.09,-.06,.12],["c",-.06,.06,-.12,.09,-.51,.09],["c",-1.08,.06,-1.8,.3,-2.28,.75],["l",-.12,.09],["l",.09,.09],["c",.12,.15,.39,.33,.63,.45],["c",.42,.18,.96,.27,1.68,.33],["c",.39,0,.45,.03,.51,.09],["c",.03,.03,.06,.09,.06,.12],["c",0,.03,.06,.66,.15,1.38],["c",.09,1.02,.12,1.38,.09,1.44],["c",-.06,.12,-.09,.12,-1.56,-.03],["c",-.78,-.06,-1.41,-.15,-1.44,-.15],["c",-.09,-.06,-.12,-.12,-.12,-.54],["c",-.06,-.93,-.24,-1.56,-.57,-2.07],["c",-.06,-.09,-.15,-.21,-.18,-.24],["l",-.09,-.06],["l",-.09,.06],["c",-.03,.03,-.12,.15,-.18,.24],["c",-.33,.51,-.51,1.14,-.57,2.07],["c",0,.42,-.03,.48,-.12,.54],["c",-.03,0,-.66,.09,-1.44,.15],["c",-1.47,.15,-1.5,.15,-1.56,.03],["c",-.03,-.06,0,-.42,.09,-1.44],["c",.09,-.72,.15,-1.35,.15,-1.38],["c",0,-.03,.03,-.09,.06,-.12],["c",.06,-.06,.12,-.09,.51,-.09],["c",.72,-.06,1.26,-.15,1.68,-.33],["c",.24,-.12,.51,-.3,.63,-.45],["l",.09,-.09],["l",-.12,-.09],["c",-.48,-.45,-1.2,-.69,-2.28,-.75],["c",-.39,0,-.45,-.03,-.51,-.09],["c",-.03,-.03,-.06,-.09,-.06,-.12],["c",0,-.03,-.06,-.63,-.12,-1.38],["c",-.09,-.72,-.15,-1.35,-.15,-1.38],["z"]],w:7.95,h:7.977},"dots.dot":{d:[["M",1.32,-1.68],["c",.09,-.03,.27,-.06,.39,-.06],["c",.96,0,1.74,.78,1.74,1.71],["c",0,.96,-.78,1.74,-1.71,1.74],["c",-.96,0,-1.74,-.78,-1.74,-1.71],["c",0,-.78,.54,-1.5,1.32,-1.68],["z"]],w:3.45,h:3.45},"noteheads.dbl":{d:[["M",-.69,-4.02],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["c",.06,.15,.06,.18,.06,1.41],["l",0,1.23],["l",.12,-.18],["c",.72,-1.26,2.64,-2.31,4.86,-2.64],["c",.81,-.15,1.11,-.15,2.13,-.15],["c",.99,0,1.29,0,2.1,.15],["c",.75,.12,1.38,.27,2.04,.54],["c",1.35,.51,2.34,1.26,2.82,2.1],["l",.12,.18],["l",0,-1.23],["c",0,-1.2,0,-1.26,.06,-1.38],["c",.09,-.18,.15,-.24,.33,-.33],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,3.54],["l",0,3.54],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.38],["l",0,-1.23],["l",-.12,.18],["c",-.48,.84,-1.47,1.59,-2.82,2.1],["c",-.84,.33,-1.71,.54,-2.85,.66],["c",-.45,.06,-2.16,.06,-2.61,0],["c",-1.14,-.12,-2.01,-.33,-2.85,-.66],["c",-1.35,-.51,-2.34,-1.26,-2.82,-2.1],["l",-.12,-.18],["l",0,1.23],["c",0,1.23,0,1.26,-.06,1.38],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-3.54],["c",0,-3.48,0,-3.54,.06,-3.66],["c",.09,-.18,.15,-.24,.33,-.33],["z"],["m",7.71,.63],["c",-.36,-.06,-.9,-.06,-1.14,0],["c",-.3,.03,-.66,.24,-.87,.42],["c",-.6,.54,-.9,1.62,-.75,2.82],["c",.12,.93,.51,1.68,1.11,2.31],["c",.75,.72,1.83,1.2,2.85,1.26],["c",1.05,.06,1.83,-.54,2.1,-1.65],["c",.21,-.9,.12,-1.95,-.24,-2.82],["c",-.36,-.81,-1.08,-1.53,-1.95,-1.95],["c",-.3,-.15,-.78,-.3,-1.11,-.39],["z"]],w:16.83,h:8.145},"noteheads.whole":{d:[["M",6.51,-4.05],["c",.51,-.03,2.01,0,2.52,.03],["c",1.41,.18,2.64,.51,3.72,1.08],["c",1.2,.63,1.95,1.41,2.19,2.31],["c",.09,.33,.09,.9,0,1.23],["c",-.24,.9,-.99,1.68,-2.19,2.31],["c",-1.08,.57,-2.28,.9,-3.75,1.08],["c",-.66,.06,-2.31,.06,-2.97,0],["c",-1.47,-.18,-2.67,-.51,-3.75,-1.08],["c",-1.2,-.63,-1.95,-1.41,-2.19,-2.31],["c",-.09,-.33,-.09,-.9,0,-1.23],["c",.24,-.9,.99,-1.68,2.19,-2.31],["c",1.2,-.63,2.61,-.99,4.23,-1.11],["z"],["m",.57,.66],["c",-.87,-.15,-1.53,0,-2.04,.51],["c",-.15,.15,-.24,.27,-.33,.48],["c",-.24,.51,-.36,1.08,-.33,1.77],["c",.03,.69,.18,1.26,.42,1.77],["c",.6,1.17,1.74,1.98,3.18,2.22],["c",1.11,.21,1.95,-.15,2.34,-.99],["c",.24,-.51,.36,-1.08,.33,-1.8],["c",-.06,-1.11,-.45,-2.04,-1.17,-2.76],["c",-.63,-.63,-1.47,-1.05,-2.4,-1.2],["z"]],w:14.985,h:8.097},"noteheads.half":{d:[["M",7.44,-4.05],["c",.06,-.03,.27,-.03,.48,-.03],["c",1.05,0,1.71,.24,2.1,.81],["c",.42,.6,.45,1.35,.18,2.4],["c",-.42,1.59,-1.14,2.73,-2.16,3.39],["c",-1.41,.93,-3.18,1.44,-5.4,1.53],["c",-1.17,.03,-1.89,-.21,-2.28,-.81],["c",-.42,-.6,-.45,-1.35,-.18,-2.4],["c",.42,-1.59,1.14,-2.73,2.16,-3.39],["c",.63,-.42,1.23,-.72,1.98,-.96],["c",.9,-.3,1.65,-.42,3.12,-.54],["z"],["m",1.29,.87],["c",-.27,-.09,-.63,-.12,-.9,-.03],["c",-.72,.24,-1.53,.69,-3.27,1.8],["c",-2.34,1.5,-3.3,2.25,-3.57,2.79],["c",-.36,.72,-.06,1.5,.66,1.77],["c",.24,.12,.69,.09,.99,0],["c",.84,-.3,1.92,-.93,4.14,-2.37],["c",1.62,-1.08,2.37,-1.71,2.61,-2.19],["c",.36,-.72,.06,-1.5,-.66,-1.77],["z"]],w:10.37,h:8.132},"noteheads.quarter":{d:[["M",6.09,-4.05],["c",.36,-.03,1.2,0,1.53,.06],["c",1.17,.24,1.89,.84,2.16,1.83],["c",.06,.18,.06,.3,.06,.66],["c",0,.45,0,.63,-.15,1.08],["c",-.66,2.04,-3.06,3.93,-5.52,4.38],["c",-.54,.09,-1.44,.09,-1.83,.03],["c",-1.23,-.27,-1.98,-.87,-2.25,-1.86],["c",-.06,-.18,-.06,-.3,-.06,-.66],["c",0,-.45,0,-.63,.15,-1.08],["c",.24,-.78,.75,-1.53,1.44,-2.22],["c",1.2,-1.2,2.85,-2.01,4.47,-2.22],["z"]],w:9.81,h:8.094},"noteheads.slash.nostem":{d:[["M",9.3,-7.77],["c",.06,-.06,.18,-.06,1.71,-.06],["l",1.65,0],["l",.09,.09],["c",.06,.06,.06,.09,.06,.15],["c",-.03,.12,-9.21,15.24,-9.3,15.33],["c",-.06,.06,-.18,.06,-1.71,.06],["l",-1.65,0],["l",-.09,-.09],["c",-.06,-.06,-.06,-.09,-.06,-.15],["c",.03,-.12,9.21,-15.24,9.3,-15.33],["z"]],w:12.81,h:15.63},"noteheads.indeterminate":{d:[["M",.78,-4.05],["c",.12,-.03,.24,-.03,.36,.03],["c",.03,.03,.93,.72,1.95,1.56],["l",1.86,1.5],["l",1.86,-1.5],["c",1.02,-.84,1.92,-1.53,1.95,-1.56],["c",.21,-.12,.33,-.09,.75,.24],["c",.3,.27,.36,.36,.36,.54],["c",0,.03,-.03,.12,-.06,.18],["c",-.03,.06,-.9,.75,-1.89,1.56],["l",-1.8,1.47],["c",0,.03,.81,.69,1.8,1.5],["c",.99,.81,1.86,1.5,1.89,1.56],["c",.03,.06,.06,.15,.06,.18],["c",0,.18,-.06,.27,-.36,.54],["c",-.42,.33,-.54,.36,-.75,.24],["c",-.03,-.03,-.93,-.72,-1.95,-1.56],["l",-1.86,-1.5],["l",-1.86,1.5],["c",-1.02,.84,-1.92,1.53,-1.95,1.56],["c",-.21,.12,-.33,.09,-.75,-.24],["c",-.3,-.27,-.36,-.36,-.36,-.54],["c",0,-.03,.03,-.12,.06,-.18],["c",.03,-.06,.9,-.75,1.89,-1.56],["l",1.8,-1.47],["c",0,-.03,-.81,-.69,-1.8,-1.5],["c",-.99,-.81,-1.86,-1.5,-1.89,-1.56],["c",-.06,-.12,-.09,-.21,-.03,-.36],["c",.03,-.09,.57,-.57,.72,-.63],["z"]],w:9.843,h:8.139},"scripts.ufermata":{d:[["M",-.75,-10.77],["c",.12,0,.45,-.03,.69,-.03],["c",2.91,-.03,5.55,1.53,7.41,4.35],["c",1.17,1.71,1.95,3.72,2.43,6.03],["c",.12,.51,.12,.57,.03,.69],["c",-.12,.21,-.48,.27,-.69,.12],["c",-.12,-.09,-.18,-.24,-.27,-.69],["c",-.78,-3.63,-3.42,-6.54,-6.78,-7.38],["c",-.78,-.21,-1.2,-.24,-2.07,-.24],["c",-.63,0,-.84,0,-1.2,.06],["c",-1.83,.27,-3.42,1.08,-4.8,2.37],["c",-1.41,1.35,-2.4,3.21,-2.85,5.19],["c",-.09,.45,-.15,.6,-.27,.69],["c",-.21,.15,-.57,.09,-.69,-.12],["c",-.09,-.12,-.09,-.18,.03,-.69],["c",.33,-1.62,.78,-3,1.47,-4.38],["c",1.77,-3.54,4.44,-5.67,7.56,-5.97],["z"],["m",.33,7.47],["c",1.38,-.3,2.58,.9,2.31,2.25],["c",-.15,.72,-.78,1.35,-1.47,1.5],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.748,h:11.289},"scripts.dfermata":{d:[["M",-9.63,-.42],["c",.15,-.09,.36,-.06,.51,.03],["c",.12,.09,.18,.24,.27,.66],["c",.78,3.66,3.42,6.57,6.78,7.41],["c",.78,.21,1.2,.24,2.07,.24],["c",.63,0,.84,0,1.2,-.06],["c",1.83,-.27,3.42,-1.08,4.8,-2.37],["c",1.41,-1.35,2.4,-3.21,2.85,-5.22],["c",.09,-.42,.15,-.57,.27,-.66],["c",.21,-.15,.57,-.09,.69,.12],["c",.09,.12,.09,.18,-.03,.69],["c",-.33,1.62,-.78,3,-1.47,4.38],["c",-1.92,3.84,-4.89,6,-8.31,6],["c",-3.42,0,-6.39,-2.16,-8.31,-6],["c",-.48,-.96,-.84,-1.92,-1.14,-2.97],["c",-.18,-.69,-.42,-1.74,-.42,-1.92],["c",0,-.12,.09,-.27,.24,-.33],["z"],["m",9.21,0],["c",1.2,-.27,2.34,.63,2.34,1.86],["c",0,.9,-.66,1.68,-1.5,1.89],["c",-1.38,.27,-2.58,-.93,-2.31,-2.31],["c",.15,-.69,.78,-1.29,1.47,-1.44],["z"]],w:19.744,h:11.274},"scripts.sforzato":{d:[["M",-6.45,-3.69],["c",.06,-.03,.15,-.06,.18,-.06],["c",.06,0,2.85,.72,6.24,1.59],["l",6.33,1.65],["c",.33,.06,.45,.21,.45,.51],["c",0,.3,-.12,.45,-.45,.51],["l",-6.33,1.65],["c",-3.39,.87,-6.18,1.59,-6.21,1.59],["c",-.21,0,-.48,-.24,-.51,-.45],["c",0,-.15,.06,-.36,.18,-.45],["c",.09,-.06,.87,-.27,3.84,-1.05],["c",2.04,-.54,3.84,-.99,4.02,-1.02],["c",.15,-.06,1.14,-.24,2.22,-.42],["c",1.05,-.18,1.92,-.36,1.92,-.36],["c",0,0,-.87,-.18,-1.92,-.36],["c",-1.08,-.18,-2.07,-.36,-2.22,-.42],["c",-.18,-.03,-1.98,-.48,-4.02,-1.02],["c",-2.97,-.78,-3.75,-.99,-3.84,-1.05],["c",-.12,-.09,-.18,-.3,-.18,-.45],["c",.03,-.15,.15,-.3,.3,-.39],["z"]],w:13.5,h:7.5},"scripts.staccato":{d:[["M",-.36,-1.47],["c",.93,-.21,1.86,.51,1.86,1.47],["c",0,.93,-.87,1.65,-1.8,1.47],["c",-.54,-.12,-1.02,-.57,-1.14,-1.08],["c",-.21,-.81,.27,-1.65,1.08,-1.86],["z"]],w:2.989,h:3.004},"scripts.tenuto":{d:[["M",-4.2,-.48],["l",.12,-.06],["l",4.08,0],["l",4.08,0],["l",.12,.06],["c",.39,.21,.39,.75,0,.96],["l",-.12,.06],["l",-4.08,0],["l",-4.08,0],["l",-.12,-.06],["c",-.39,-.21,-.39,-.75,0,-.96],["z"]],w:8.985,h:1.08},"scripts.umarcato":{d:[["M",-.15,-8.19],["c",.15,-.12,.36,-.03,.45,.15],["c",.21,.42,3.45,7.65,3.45,7.71],["c",0,.12,-.12,.27,-.21,.3],["c",-.03,.03,-.51,.03,-1.14,.03],["c",-1.05,0,-1.08,0,-1.17,-.06],["c",-.09,-.06,-.24,-.36,-1.17,-2.4],["c",-.57,-1.29,-1.05,-2.34,-1.08,-2.34],["c",0,-.03,-.51,1.02,-1.08,2.34],["c",-.93,2.07,-1.08,2.34,-1.14,2.4],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.06,3.24,-7.32,3.45,-7.71],["c",.03,-.06,.09,-.15,.15,-.15],["z"]],w:7.5,h:8.245},"scripts.dmarcato":{d:[["M",-3.57,.03],["c",.03,0,.57,-.03,1.17,-.03],["c",1.05,0,1.08,0,1.17,.06],["c",.09,.06,.24,.36,1.17,2.4],["c",.57,1.29,1.05,2.34,1.08,2.34],["c",0,.03,.51,-1.02,1.08,-2.34],["c",.93,-2.07,1.08,-2.34,1.14,-2.4],["c",.06,-.03,.15,-.06,.18,-.06],["c",.15,0,.33,.18,.33,.33],["c",0,.09,-3.45,7.74,-3.54,7.83],["c",-.12,.12,-.3,.12,-.42,0],["c",-.09,-.09,-3.54,-7.74,-3.54,-7.83],["c",0,-.09,.12,-.27,.18,-.3],["z"]],w:7.5,h:8.25},"scripts.stopped":{d:[["M",-.27,-4.08],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.5],["l",0,1.47],["l",1.47,0],["l",1.5,0],["l",.15,.06],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.09,.36,0,.54],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.12,.06,-.18,.06,-1.62,.06],["l",-1.47,0],["l",0,1.47],["l",0,1.47],["l",-.06,.15],["c",-.09,.18,-.15,.24,-.33,.33],["c",-.18,.09,-.36,.09,-.54,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["l",-.06,-.15],["l",0,-1.47],["l",0,-1.47],["l",-1.47,0],["c",-1.44,0,-1.5,0,-1.62,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.47,0],["l",1.47,0],["l",0,-1.47],["c",0,-1.44,0,-1.5,.06,-1.62],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:8.295,h:8.295},"scripts.upbow":{d:[["M",-4.65,-15.54],["c",.12,-.09,.36,-.06,.48,.03],["c",.03,.03,.09,.09,.12,.15],["c",.03,.06,.66,2.13,1.41,4.62],["c",1.35,4.41,1.38,4.56,2.01,6.96],["l",.63,2.46],["l",.63,-2.46],["c",.63,-2.4,.66,-2.55,2.01,-6.96],["c",.75,-2.49,1.38,-4.56,1.41,-4.62],["c",.06,-.15,.18,-.21,.36,-.24],["c",.15,0,.3,.06,.39,.18],["c",.15,.21,.24,-.18,-2.1,7.56],["c",-1.2,3.96,-2.22,7.32,-2.25,7.41],["c",0,.12,-.06,.27,-.09,.3],["c",-.12,.21,-.6,.21,-.72,0],["c",-.03,-.03,-.09,-.18,-.09,-.3],["c",-.03,-.09,-1.05,-3.45,-2.25,-7.41],["c",-2.34,-7.74,-2.25,-7.35,-2.1,-7.56],["c",.03,-.03,.09,-.09,.15,-.12],["z"]],w:9.73,h:15.608},"scripts.downbow":{d:[["M",-5.55,-9.93],["l",.09,-.06],["l",5.46,0],["l",5.46,0],["l",.09,.06],["l",.06,.09],["l",0,4.77],["c",0,5.28,0,4.89,-.18,5.01],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.06,-.09,-.06,-.18,-.06,-2.97],["l",0,-2.85],["l",-4.83,0],["l",-4.83,0],["l",0,2.85],["c",0,2.79,0,2.88,-.06,2.97],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.21,-.06,-4.89],["l",0,-4.77],["z"]],w:11.22,h:9.992},"scripts.turn":{d:[["M",-4.77,-3.9],["c",.36,-.06,1.05,-.06,1.44,.03],["c",.78,.15,1.5,.51,2.34,1.14],["c",.6,.45,1.05,.87,2.22,2.01],["c",1.11,1.08,1.62,1.5,2.22,1.86],["c",.6,.36,1.32,.57,1.92,.57],["c",.9,0,1.71,-.57,1.89,-1.35],["c",.24,-.93,-.39,-1.89,-1.35,-2.1],["l",-.15,-.06],["l",-.09,.15],["c",-.03,.09,-.15,.24,-.24,.33],["c",-.72,.72,-2.04,.54,-2.49,-.36],["c",-.48,-.93,.03,-1.86,1.17,-2.19],["c",.3,-.09,1.02,-.09,1.35,0],["c",.99,.27,1.74,.87,2.25,1.83],["c",.69,1.41,.63,3,-.21,4.26],["c",-.21,.3,-.69,.81,-.99,1.02],["c",-.3,.21,-.84,.45,-1.17,.54],["c",-1.23,.36,-2.49,.15,-3.72,-.6],["c",-.75,-.48,-1.41,-1.02,-2.85,-2.46],["c",-1.11,-1.08,-1.62,-1.5,-2.22,-1.86],["c",-.6,-.36,-1.32,-.57,-1.92,-.57],["c",-.9,0,-1.71,.57,-1.89,1.35],["c",-.24,.93,.39,1.89,1.35,2.1],["l",.15,.06],["l",.09,-.15],["c",.03,-.09,.15,-.24,.24,-.33],["c",.72,-.72,2.04,-.54,2.49,.36],["c",.48,.93,-.03,1.86,-1.17,2.19],["c",-.3,.09,-1.02,.09,-1.35,0],["c",-.99,-.27,-1.74,-.87,-2.25,-1.83],["c",-.69,-1.41,-.63,-3,.21,-4.26],["c",.21,-.3,.69,-.81,.99,-1.02],["c",.48,-.33,1.11,-.57,1.74,-.66],["z"]],w:16.366,h:7.893},"scripts.trill":{d:[["M",-.51,-16.02],["c",.12,-.09,.21,-.18,.21,-.18],["l",-.81,4.02],["l",-.81,4.02],["c",.03,0,.51,-.27,1.08,-.6],["c",.6,-.3,1.14,-.63,1.26,-.66],["c",1.14,-.54,2.31,-.6,3.09,-.18],["c",.27,.15,.54,.36,.6,.51],["l",.06,.12],["l",.21,-.21],["c",.9,-.81,2.22,-.99,3.12,-.42],["c",.6,.42,.9,1.14,.78,2.07],["c",-.15,1.29,-1.05,2.31,-1.95,2.25],["c",-.48,-.03,-.78,-.3,-.96,-.81],["c",-.09,-.27,-.09,-.9,-.03,-1.2],["c",.21,-.75,.81,-1.23,1.59,-1.32],["l",.24,-.03],["l",-.09,-.12],["c",-.51,-.66,-1.62,-.63,-2.31,.03],["c",-.39,.42,-.3,.09,-1.23,4.77],["l",-.81,4.14],["c",-.03,0,-.12,-.03,-.21,-.09],["c",-.33,-.15,-.54,-.18,-.99,-.18],["c",-.42,0,-.66,.03,-1.05,.18],["c",-.12,.06,-.21,.09,-.21,.09],["c",0,-.03,.36,-1.86,.81,-4.11],["c",.9,-4.47,.87,-4.26,.69,-4.53],["c",-.21,-.36,-.66,-.51,-1.17,-.36],["c",-.15,.06,-2.22,1.14,-2.58,1.38],["c",-.12,.09,-.12,.09,-.21,.6],["l",-.09,.51],["l",.21,.24],["c",.63,.75,1.02,1.47,1.2,2.19],["c",.06,.27,.06,.36,.06,.81],["c",0,.42,0,.54,-.06,.78],["c",-.15,.54,-.33,.93,-.63,1.35],["c",-.18,.24,-.57,.63,-.81,.78],["c",-.24,.15,-.63,.36,-.84,.42],["c",-.27,.06,-.66,.06,-.87,.03],["c",-.81,-.18,-1.32,-1.05,-1.38,-2.46],["c",-.03,-.6,.03,-.99,.33,-2.46],["c",.21,-1.08,.24,-1.32,.21,-1.29],["c",-1.2,.48,-2.4,.75,-3.21,.72],["c",-.69,-.06,-1.17,-.3,-1.41,-.72],["c",-.39,-.75,-.12,-1.8,.66,-2.46],["c",.24,-.18,.69,-.42,1.02,-.51],["c",.69,-.18,1.53,-.15,2.31,.09],["c",.3,.09,.75,.3,.99,.45],["c",.12,.09,.15,.09,.15,.03],["c",.03,-.03,.33,-1.59,.72,-3.45],["c",.36,-1.86,.66,-3.42,.69,-3.45],["c",0,-.03,.03,-.03,.21,.03],["c",.21,.06,.27,.06,.48,.06],["c",.42,-.03,.78,-.18,1.26,-.48],["c",.15,-.12,.36,-.27,.48,-.39],["z"],["m",-5.73,7.68],["c",-.27,-.03,-.96,-.06,-1.2,-.03],["c",-.81,.12,-1.35,.57,-1.5,1.2],["c",-.18,.66,.12,1.14,.75,1.29],["c",.66,.12,1.92,-.12,3.18,-.66],["l",.33,-.15],["l",.09,-.39],["c",.06,-.21,.09,-.42,.09,-.45],["c",0,-.03,-.45,-.3,-.75,-.45],["c",-.27,-.15,-.66,-.27,-.99,-.36],["z"],["m",4.29,3.63],["c",-.24,-.39,-.51,-.75,-.51,-.69],["c",-.06,.12,-.39,1.92,-.45,2.28],["c",-.09,.54,-.12,1.14,-.06,1.38],["c",.06,.42,.21,.6,.51,.57],["c",.39,-.06,.75,-.48,.93,-1.14],["c",.09,-.33,.09,-1.05,0,-1.38],["c",-.09,-.39,-.24,-.69,-.42,-1.02],["z"]],w:17.963,h:16.49},"scripts.segno":{d:[["M",-3.72,-11.22],["c",.78,-.09,1.59,.03,2.31,.42],["c",1.2,.6,2.01,1.71,2.31,3.09],["c",.09,.42,.09,1.2,.03,1.5],["c",-.15,.45,-.39,.81,-.66,.93],["c",-.33,.18,-.84,.21,-1.23,.15],["c",-.81,-.18,-1.32,-.93,-1.26,-1.89],["c",.03,-.36,.09,-.57,.24,-.9],["c",.15,-.33,.45,-.6,.72,-.75],["c",.12,-.06,.18,-.09,.18,-.12],["c",0,-.03,-.03,-.15,-.09,-.24],["c",-.18,-.45,-.54,-.87,-.96,-1.08],["c",-1.11,-.57,-2.34,-.18,-2.88,.9],["c",-.24,.51,-.33,1.11,-.24,1.83],["c",.27,1.92,1.5,3.54,3.93,5.13],["c",.48,.33,1.26,.78,1.29,.78],["c",.03,0,1.35,-2.19,2.94,-4.89],["l",2.88,-4.89],["l",.84,0],["l",.87,0],["l",-.03,.06],["c",-.15,.21,-6.15,10.41,-6.15,10.44],["c",0,0,.21,.15,.48,.27],["c",2.61,1.47,4.35,3.03,5.13,4.65],["c",1.14,2.34,.51,5.07,-1.44,6.39],["c",-.66,.42,-1.32,.63,-2.13,.69],["c",-2.01,.09,-3.81,-1.41,-4.26,-3.54],["c",-.09,-.42,-.09,-1.2,-.03,-1.5],["c",.15,-.45,.39,-.81,.66,-.93],["c",.33,-.18,.84,-.21,1.23,-.15],["c",.81,.18,1.32,.93,1.26,1.89],["c",-.03,.36,-.09,.57,-.24,.9],["c",-.15,.33,-.45,.6,-.72,.75],["c",-.12,.06,-.18,.09,-.18,.12],["c",0,.03,.03,.15,.09,.24],["c",.18,.45,.54,.87,.96,1.08],["c",1.11,.57,2.34,.18,2.88,-.9],["c",.24,-.51,.33,-1.11,.24,-1.83],["c",-.27,-1.92,-1.5,-3.54,-3.93,-5.13],["c",-.48,-.33,-1.26,-.78,-1.29,-.78],["c",-.03,0,-1.35,2.19,-2.91,4.89],["l",-2.88,4.89],["l",-.87,0],["l",-.87,0],["l",.03,-.06],["c",.15,-.21,6.15,-10.41,6.15,-10.44],["c",0,0,-.21,-.15,-.48,-.3],["c",-2.61,-1.44,-4.35,-3,-5.13,-4.62],["c",-.9,-1.89,-.72,-4.02,.48,-5.52],["c",.69,-.84,1.68,-1.41,2.73,-1.53],["z"],["m",8.76,9.09],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"],["m",-10.53,2.61],["c",.03,-.03,.15,-.03,.27,-.03],["c",.33,.03,.57,.18,.72,.48],["c",.09,.18,.09,.57,0,.75],["c",-.09,.18,-.21,.3,-.36,.39],["c",-.15,.06,-.21,.06,-.39,.06],["c",-.21,0,-.27,0,-.39,-.06],["c",-.3,-.15,-.48,-.45,-.48,-.75],["c",0,-.39,.24,-.72,.63,-.84],["z"]],w:15,h:22.504},"scripts.coda":{d:[["M",-.21,-10.47],["c",.18,-.12,.42,-.06,.54,.12],["c",.06,.09,.06,.18,.06,1.5],["l",0,1.38],["l",.18,0],["c",.39,.06,.96,.24,1.38,.48],["c",1.68,.93,2.82,3.24,3.03,6.12],["c",.03,.24,.03,.45,.03,.45],["c",0,.03,.6,.03,1.35,.03],["c",1.5,0,1.47,0,1.59,.18],["c",.09,.12,.09,.3,0,.42],["c",-.12,.18,-.09,.18,-1.59,.18],["c",-.75,0,-1.35,0,-1.35,.03],["c",0,0,0,.21,-.03,.42],["c",-.24,3.15,-1.53,5.58,-3.45,6.36],["c",-.27,.12,-.72,.24,-.96,.27],["l",-.18,0],["l",0,1.38],["c",0,1.32,0,1.41,-.06,1.5],["c",-.15,.24,-.51,.24,-.66,0],["c",-.06,-.09,-.06,-.18,-.06,-1.5],["l",0,-1.38],["l",-.18,0],["c",-.39,-.06,-.96,-.24,-1.38,-.48],["c",-1.68,-.93,-2.82,-3.24,-3.03,-6.15],["c",-.03,-.21,-.03,-.42,-.03,-.42],["c",0,-.03,-.6,-.03,-1.35,-.03],["c",-1.5,0,-1.47,0,-1.59,-.18],["c",-.09,-.12,-.09,-.3,0,-.42],["c",.12,-.18,.09,-.18,1.59,-.18],["c",.75,0,1.35,0,1.35,-.03],["c",0,0,0,-.21,.03,-.45],["c",.24,-3.12,1.53,-5.55,3.45,-6.33],["c",.27,-.12,.72,-.24,.96,-.27],["l",.18,0],["l",0,-1.38],["c",0,-1.53,0,-1.5,.18,-1.62],["z"],["m",-.18,6.93],["c",0,-2.97,0,-3.15,-.06,-3.15],["c",-.09,0,-.51,.15,-.66,.21],["c",-.87,.51,-1.38,1.62,-1.56,3.51],["c",-.06,.54,-.12,1.59,-.12,2.16],["l",0,.42],["l",1.2,0],["l",1.2,0],["l",0,-3.15],["z"],["m",1.17,-3.06],["c",-.09,-.03,-.21,-.06,-.27,-.09],["l",-.12,0],["l",0,3.15],["l",0,3.15],["l",1.2,0],["l",1.2,0],["l",0,-.81],["c",-.06,-2.4,-.33,-3.69,-.93,-4.59],["c",-.27,-.39,-.66,-.69,-1.08,-.81],["z"],["m",-1.17,10.14],["l",0,-3.15],["l",-1.2,0],["l",-1.2,0],["l",0,.81],["c",.03,.96,.06,1.47,.15,2.13],["c",.24,2.04,.96,3.12,2.13,3.36],["l",.12,0],["l",0,-3.15],["z"],["m",3.18,-2.34],["l",0,-.81],["l",-1.2,0],["l",-1.2,0],["l",0,3.15],["l",0,3.15],["l",.12,0],["c",1.17,-.24,1.89,-1.32,2.13,-3.36],["c",.09,-.66,.12,-1.17,.15,-2.13],["z"]],w:16.035,h:21.062},"scripts.comma":{d:[["M",1.14,-4.62],["c",.3,-.12,.69,-.03,.93,.15],["c",.12,.12,.36,.45,.51,.78],["c",.9,1.77,.54,4.05,-1.08,6.75],["c",-.36,.63,-.87,1.38,-.96,1.44],["c",-.18,.12,-.42,.06,-.54,-.12],["c",-.09,-.18,-.09,-.3,.12,-.6],["c",.96,-1.44,1.44,-2.97,1.38,-4.35],["c",-.06,-.93,-.3,-1.68,-.78,-2.46],["c",-.27,-.39,-.33,-.63,-.24,-.96],["c",.09,-.27,.36,-.54,.66,-.63],["z"]],w:3.042,h:9.237},"scripts.roll":{d:[["M",1.95,-6],["c",.21,-.09,.36,-.09,.57,0],["c",.39,.15,.63,.39,1.47,1.35],["c",.66,.75,.78,.87,1.08,1.05],["c",.75,.45,1.65,.42,2.4,-.06],["c",.12,-.09,.27,-.27,.54,-.6],["c",.42,-.54,.51,-.63,.69,-.63],["c",.09,0,.3,.12,.36,.21],["c",.09,.12,.12,.3,.03,.42],["c",-.06,.12,-3.15,3.9,-3.3,4.08],["c",-.06,.06,-.18,.12,-.27,.18],["c",-.27,.12,-.6,.06,-.99,-.27],["c",-.27,-.21,-.42,-.39,-1.08,-1.14],["c",-.63,-.72,-.81,-.9,-1.17,-1.08],["c",-.36,-.18,-.57,-.21,-.99,-.21],["c",-.39,0,-.63,.03,-.93,.18],["c",-.36,.15,-.51,.27,-.9,.81],["c",-.24,.27,-.45,.51,-.48,.54],["c",-.12,.09,-.27,.06,-.39,0],["c",-.24,-.15,-.33,-.39,-.21,-.6],["c",.09,-.12,3.18,-3.87,3.33,-4.02],["c",.06,-.06,.18,-.15,.24,-.21],["z"]],w:10.817,h:6.125},"scripts.prall":{d:[["M",-4.38,-3.69],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.57,-.84,1.23,-1.83],["c",1.14,-1.68,1.23,-1.83,1.35,-1.89],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["c",-.03,0,-.57,.84,-1.23,1.83],["c",-1.14,1.68,-1.23,1.83,-1.35,1.89],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["z"]],w:15.011,h:7.5},"scripts.arpeggio":{d:[["M",1.5,0],["c",1.5,2,1.5,3,1.5,3],["s",0,1,-2,1.5],["s",-.5,3,1,5.5],["l",1.5,0],["s",-1.75,-2,-1.9,-3.25],["s",2.15,-.6,2.95,-1.6],["s",.45,-1,.5,-1.25],["s",0,-1,-2,-3.9],["l",-1.5,0],["z"]],w:5,h:10},"scripts.mordent":{d:[["M",-.21,-4.95],["c",.27,-.15,.63,0,.75,.27],["c",.06,.12,.06,.24,.06,1.44],["l",0,1.29],["l",.57,-.84],["c",.51,-.75,.57,-.84,.69,-.9],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["l",.48,-.69],["c",.51,-.78,.54,-.84,.69,-.9],["c",.42,-.18,.87,.15,.81,.6],["c",-.03,.12,-.3,.51,-1.5,2.37],["c",-1.38,2.07,-1.5,2.22,-1.62,2.28],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.83,-1.89],["c",-.81,-.99,-1.5,-1.8,-1.53,-1.86],["c",-.06,-.03,-.06,-.03,-.12,.03],["c",-.06,.06,-.06,.15,-.06,2.28],["c",0,1.95,0,2.25,-.06,2.34],["c",-.18,.45,-.81,.48,-1.05,.03],["c",-.03,-.06,-.06,-.24,-.06,-1.41],["l",0,-1.35],["l",-.57,.84],["c",-.54,.78,-.6,.87,-.72,.93],["c",-.06,.03,-.18,.06,-.24,.06],["c",-.3,0,-.27,.03,-1.89,-1.95],["l",-1.53,-1.83],["l",-.48,.69],["c",-.51,.78,-.54,.84,-.69,.9],["c",-.42,.18,-.87,-.15,-.81,-.6],["c",.03,-.12,.3,-.51,1.5,-2.37],["c",1.38,-2.07,1.5,-2.22,1.62,-2.28],["c",.06,-.03,.18,-.06,.24,-.06],["c",.3,0,.27,-.03,1.89,1.95],["l",1.53,1.83],["c",.03,0,.06,-.06,.09,-.09],["c",.06,-.12,.06,-.15,.06,-2.28],["c",0,-1.92,0,-2.22,.06,-2.31],["c",.06,-.15,.15,-.24,.3,-.3],["z"]],w:15.011,h:10.012},"flags.u8th":{d:[["M",-.42,3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",0,.18],["c",0,.3,.06,.84,.12,1.23],["c",.24,1.53,.9,3.12,2.13,5.16],["l",.99,1.59],["c",.87,1.44,1.38,2.34,1.77,3.09],["c",.81,1.68,1.2,3.06,1.26,4.53],["c",.03,1.53,-.21,3.27,-.75,5.01],["c",-.21,.69,-.51,1.5,-.6,1.59],["c",-.09,.12,-.27,.21,-.42,.21],["c",-.15,0,-.42,-.12,-.51,-.21],["c",-.15,-.18,-.18,-.42,-.09,-.66],["c",.15,-.33,.45,-1.2,.57,-1.62],["c",.42,-1.38,.6,-2.58,.6,-3.9],["c",0,-.66,0,-.81,-.06,-1.11],["c",-.39,-2.07,-1.8,-4.26,-4.59,-7.14],["l",-.42,-.45],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["z"]],w:6.692,h:22.59},"flags.u16th":{d:[["M",-.42,7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,.39],["c",.06,1.08,.39,2.19,.99,3.39],["c",.45,.9,.87,1.59,1.95,3.12],["c",1.29,1.86,1.77,2.64,2.22,3.57],["c",.45,.93,.72,1.8,.87,2.64],["c",.06,.51,.06,1.5,0,1.92],["c",-.12,.6,-.3,1.2,-.54,1.71],["l",-.09,.24],["l",.18,.45],["c",.51,1.2,.72,2.22,.69,3.42],["c",-.06,1.53,-.39,3.03,-.99,4.53],["c",-.3,.75,-.36,.81,-.57,.9],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.12,-.75],["c",.66,-1.41,1.02,-2.88,1.08,-4.32],["c",0,-.6,-.03,-1.05,-.18,-1.59],["c",-.3,-1.2,-.99,-2.4,-2.25,-3.87],["c",-.42,-.48,-1.53,-1.62,-2.19,-2.22],["l",-.45,-.42],["l",-.03,1.11],["l",0,1.11],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["z"],["m",1.65,.09],["c",-.3,-.3,-.69,-.72,-.9,-.87],["l",-.33,-.33],["l",0,.15],["c",0,.3,.06,.81,.15,1.26],["c",.27,1.29,.87,2.61,2.04,4.29],["c",.15,.24,.6,.87,.96,1.38],["l",1.08,1.53],["l",.42,.63],["c",.03,0,.12,-.36,.21,-.72],["c",.06,-.33,.06,-1.2,0,-1.62],["c",-.33,-1.71,-1.44,-3.48,-3.63,-5.7],["z"]],w:6.693,h:26.337},"flags.u32nd":{d:[["M",-.42,11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,.36],["c",.09,1.68,.69,3.27,2.07,5.46],["l",.87,1.35],["c",1.02,1.62,1.47,2.37,1.86,3.18],["c",.48,1.02,.78,1.92,.93,2.88],["c",.06,.48,.06,1.5,0,1.89],["c",-.09,.42,-.21,.87,-.36,1.26],["l",-.12,.3],["l",.15,.39],["c",.69,1.56,.84,2.88,.54,4.38],["c",-.09,.45,-.27,1.08,-.45,1.47],["l",-.12,.24],["l",.18,.36],["c",.33,.72,.57,1.56,.69,2.34],["c",.12,1.02,-.06,2.52,-.42,3.84],["c",-.27,.93,-.75,2.13,-.93,2.31],["c",-.18,.15,-.45,.18,-.66,.09],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.06,-.6],["c",.21,-.36,.42,-.9,.57,-1.38],["c",.51,-1.41,.69,-3.06,.48,-4.08],["c",-.15,-.81,-.57,-1.68,-1.2,-2.55],["c",-.72,-.99,-1.83,-2.13,-3.3,-3.33],["l",-.48,-.42],["l",-.03,1.53],["l",0,1.56],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["z"],["m",1.26,-3.96],["c",-.27,-.3,-.54,-.6,-.66,-.72],["l",-.18,-.21],["l",0,.42],["c",.06,.87,.24,1.74,.66,2.67],["c",.36,.87,.96,1.86,1.92,3.18],["c",.21,.33,.63,.87,.87,1.23],["c",.27,.39,.6,.84,.75,1.08],["l",.27,.39],["l",.03,-.12],["c",.12,-.45,.15,-1.05,.09,-1.59],["c",-.27,-1.86,-1.38,-3.78,-3.75,-6.33],["z"],["m",-.27,6.09],["c",-.27,-.21,-.48,-.42,-.51,-.45],["c",-.06,-.03,-.06,-.03,-.06,.21],["c",0,.9,.3,2.04,.81,3.09],["c",.48,1.02,.96,1.77,2.37,3.63],["c",.6,.78,1.05,1.44,1.29,1.77],["c",.06,.12,.15,.21,.15,.18],["c",.03,-.03,.18,-.57,.24,-.87],["c",.06,-.45,.06,-1.32,-.03,-1.74],["c",-.09,-.48,-.24,-.9,-.51,-1.44],["c",-.66,-1.35,-1.83,-2.7,-3.75,-4.38],["z"]],w:6.697,h:32.145},"flags.u64th":{d:[["M",-.42,15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,.36],["c",.06,1.2,.39,2.37,1.02,3.66],["c",.39,.81,.84,1.56,1.8,3.09],["c",.81,1.26,1.05,1.68,1.35,2.22],["c",.87,1.5,1.35,2.79,1.56,4.08],["c",.06,.54,.06,1.56,-.03,2.04],["c",-.09,.48,-.21,.99,-.36,1.35],["l",-.12,.27],["l",.12,.27],["c",.09,.15,.21,.45,.27,.66],["c",.69,1.89,.63,3.66,-.18,5.46],["l",-.18,.39],["l",.15,.33],["c",.3,.66,.51,1.44,.63,2.1],["c",.06,.48,.06,1.35,0,1.71],["c",-.15,.57,-.42,1.2,-.78,1.68],["l",-.21,.27],["l",.18,.33],["c",.57,1.05,.93,2.13,1.02,3.18],["c",.06,.72,0,1.83,-.21,2.79],["c",-.18,1.02,-.63,2.34,-1.02,3.09],["c",-.15,.33,-.48,.45,-.78,.3],["c",-.18,-.09,-.27,-.18,-.33,-.33],["c",-.09,-.18,-.06,-.3,.03,-.54],["c",.75,-1.5,1.23,-3.45,1.17,-4.89],["c",-.06,-1.02,-.42,-2.01,-1.17,-3.15],["c",-.48,-.72,-1.02,-1.35,-1.89,-2.22],["c",-.57,-.57,-1.56,-1.5,-1.92,-1.77],["l",-.12,-.09],["l",0,1.68],["l",0,1.68],["l",-.21,0],["l",-.21,0],["l",0,-15],["z"],["m",.93,-8.07],["c",-.27,-.3,-.48,-.54,-.51,-.54],["c",0,0,0,.69,.03,1.02],["c",.15,1.47,.75,2.94,2.04,4.83],["l",1.08,1.53],["c",.39,.57,.84,1.2,.99,1.44],["c",.15,.24,.3,.45,.3,.45],["c",0,0,.03,-.09,.06,-.21],["c",.36,-1.59,-.15,-3.33,-1.47,-5.4],["c",-.63,-.93,-1.35,-1.83,-2.52,-3.12],["z"],["m",.06,6.72],["c",-.24,-.21,-.48,-.42,-.51,-.45],["l",-.06,-.06],["l",0,.33],["c",0,1.2,.3,2.34,.93,3.6],["c",.45,.9,.96,1.68,2.25,3.51],["c",.39,.54,.84,1.17,1.02,1.44],["c",.21,.33,.33,.51,.33,.48],["c",.06,-.09,.21,-.63,.3,-.99],["c",.06,-.33,.06,-.45,.06,-.96],["c",0,-.6,-.03,-.84,-.18,-1.35],["c",-.3,-1.08,-1.02,-2.28,-2.13,-3.57],["c",-.39,-.45,-1.44,-1.47,-2.01,-1.98],["z"],["m",0,6.72],["c",-.24,-.21,-.48,-.39,-.51,-.42],["l",-.06,-.06],["l",0,.33],["c",0,1.41,.45,2.82,1.38,4.35],["c",.42,.72,.72,1.14,1.86,2.73],["c",.36,.45,.75,.99,.87,1.2],["c",.15,.21,.3,.36,.3,.36],["c",.06,0,.3,-.48,.39,-.75],["c",.09,-.36,.12,-.63,.12,-1.05],["c",-.06,-1.05,-.45,-2.04,-1.2,-3.18],["c",-.57,-.87,-1.11,-1.53,-2.07,-2.49],["c",-.36,-.33,-.84,-.78,-1.08,-1.02],["z"]],w:6.682,h:39.694},"flags.d8th":{d:[["M",5.67,-21.63],["c",.24,-.12,.54,-.06,.69,.15],["c",.06,.06,.21,.36,.39,.66],["c",.84,1.77,1.26,3.36,1.32,5.1],["c",.03,1.29,-.21,2.37,-.81,3.63],["c",-.6,1.23,-1.26,2.13,-3.21,4.38],["c",-1.35,1.53,-1.86,2.19,-2.4,2.97],["c",-.63,.93,-1.11,1.92,-1.38,2.79],["c",-.15,.54,-.27,1.35,-.27,1.8],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-3.75],["l",0,-3.75],["l",.21,0],["l",.21,0],["l",.48,-.3],["c",1.83,-1.11,3.12,-2.1,4.17,-3.12],["c",.78,-.81,1.32,-1.53,1.71,-2.31],["c",.45,-.93,.6,-1.74,.51,-2.88],["c",-.12,-1.56,-.63,-3.18,-1.47,-4.68],["c",-.12,-.21,-.15,-.33,-.06,-.51],["c",.06,-.15,.15,-.24,.33,-.33],["z"]],w:8.492,h:21.691},"flags.ugrace":{d:[["M",6.03,6.93],["c",.15,-.09,.33,-.06,.51,0],["c",.15,.09,.21,.15,.3,.33],["c",.09,.18,.06,.39,-.03,.54],["c",-.06,.15,-10.89,8.88,-11.07,8.97],["c",-.15,.09,-.33,.06,-.48,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.06,-.39,.03,-.54],["c",.06,-.15,10.89,-8.88,11.07,-8.97],["z"]],w:12.019,h:9.954},"flags.dgrace":{d:[["M",-6.06,-15.93],["c",.18,-.09,.33,-.12,.48,-.06],["c",.18,.09,14.01,8.04,14.1,8.1],["c",.12,.12,.18,.33,.18,.51],["c",-.03,.21,-.15,.39,-.36,.48],["c",-.18,.09,-.33,.12,-.48,.06],["c",-.18,-.09,-14.01,-8.04,-14.1,-8.1],["c",-.12,-.12,-.18,-.33,-.18,-.51],["c",.03,-.21,.15,-.39,.36,-.48],["z"]],w:15.12,h:9.212},"flags.d16th":{d:[["M",6.84,-22.53],["c",.27,-.12,.57,-.06,.72,.15],["c",.15,.15,.33,.87,.45,1.56],["c",.06,.33,.06,1.35,0,1.65],["c",-.06,.33,-.15,.78,-.27,1.11],["c",-.12,.33,-.45,.96,-.66,1.32],["l",-.18,.27],["l",.09,.18],["c",.48,1.02,.72,2.25,.69,3.3],["c",-.06,1.23,-.42,2.28,-1.26,3.45],["c",-.57,.87,-.99,1.32,-3,3.39],["c",-1.56,1.56,-2.22,2.4,-2.76,3.45],["c",-.42,.84,-.66,1.8,-.66,2.55],["l",0,.15],["l",-.21,0],["l",-.21,0],["l",0,-7.5],["l",0,-7.5],["l",.21,0],["l",.21,0],["l",0,1.14],["l",0,1.11],["l",.27,-.15],["c",1.11,-.57,1.77,-.99,2.52,-1.47],["c",2.37,-1.56,3.69,-3.15,4.05,-4.83],["c",.03,-.18,.03,-.39,.03,-.78],["c",0,-.6,-.03,-.93,-.24,-1.5],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.5],["c",-.06,-.18,-.15,-.36,-.15,-.36],["c",-.03,0,-.03,.03,-.06,.06],["c",-.06,.12,-.96,1.02,-1.95,1.98],["c",-.63,.57,-1.26,1.17,-1.44,1.35],["c",-1.53,1.62,-2.28,2.85,-2.55,4.32],["c",-.03,.18,-.03,.54,-.06,.99],["l",0,.69],["l",.18,-.09],["c",.93,-.54,2.1,-1.29,2.82,-1.83],["c",.69,-.51,1.02,-.81,1.53,-1.29],["c",1.86,-1.89,2.37,-3.66,1.68,-5.82],["z"]],w:8.475,h:22.591},"flags.d32nd":{d:[["M",6.84,-29.13],["c",.27,-.12,.57,-.06,.72,.15],["c",.12,.12,.27,.63,.36,1.11],["c",.33,1.59,.06,3.06,-.81,4.47],["l",-.18,.27],["l",.09,.15],["c",.12,.24,.33,.69,.45,1.05],["c",.63,1.83,.45,3.57,-.57,5.22],["l",-.18,.3],["l",.15,.27],["c",.42,.87,.6,1.71,.57,2.61],["c",-.06,1.29,-.48,2.46,-1.35,3.78],["c",-.54,.81,-.93,1.29,-2.46,3],["c",-.51,.54,-1.05,1.17,-1.26,1.41],["c",-1.56,1.86,-2.25,3.36,-2.37,5.01],["l",0,.33],["l",-.21,0],["l",-.21,0],["l",0,-11.25],["l",0,-11.25],["l",.21,0],["l",.21,0],["l",0,1.35],["l",.03,1.35],["l",.78,-.39],["c",1.38,-.69,2.34,-1.26,3.24,-1.92],["c",1.38,-1.02,2.28,-2.13,2.64,-3.21],["c",.15,-.48,.18,-.72,.18,-1.29],["c",0,-.57,-.06,-.9,-.24,-1.47],["c",-.06,-.18,-.12,-.39,-.15,-.45],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.63,7.2],["c",-.09,-.18,-.12,-.21,-.12,-.15],["c",-.03,.09,-1.02,1.08,-2.04,2.04],["c",-1.17,1.08,-1.65,1.56,-2.07,2.04],["c",-.84,.96,-1.38,1.86,-1.68,2.76],["c",-.21,.57,-.27,.99,-.3,1.65],["l",0,.54],["l",.66,-.33],["c",3.57,-1.86,5.49,-3.69,5.94,-5.7],["c",.06,-.39,.06,-1.2,-.03,-1.65],["c",-.06,-.39,-.24,-.9,-.36,-1.2],["z"],["m",-.06,7.2],["c",-.06,-.15,-.12,-.33,-.15,-.45],["l",-.06,-.18],["l",-.18,.21],["l",-1.83,1.83],["c",-.87,.9,-1.77,1.8,-1.95,2.01],["c",-1.08,1.29,-1.62,2.31,-1.89,3.51],["c",-.06,.3,-.06,.51,-.09,.93],["l",0,.57],["l",.09,-.06],["c",.75,-.45,1.89,-1.26,2.52,-1.74],["c",.81,-.66,1.74,-1.53,2.22,-2.16],["c",1.26,-1.53,1.68,-3.06,1.32,-4.47],["z"]],w:8.385,h:29.191},"flags.d64th":{d:[["M",7.08,-32.88],["c",.3,-.12,.66,-.03,.78,.24],["c",.18,.33,.27,2.1,.15,2.64],["c",-.09,.39,-.21,.78,-.39,1.08],["l",-.15,.3],["l",.09,.27],["c",.03,.12,.09,.45,.12,.69],["c",.27,1.44,.18,2.55,-.3,3.6],["l",-.12,.33],["l",.06,.42],["c",.27,1.35,.33,2.82,.21,3.63],["c",-.12,.6,-.3,1.23,-.57,1.8],["l",-.15,.27],["l",.03,.42],["c",.06,1.02,.06,2.7,.03,3.06],["c",-.15,1.47,-.66,2.76,-1.74,4.41],["c",-.45,.69,-.75,1.11,-1.74,2.37],["c",-1.05,1.38,-1.5,1.98,-1.95,2.73],["c",-.93,1.5,-1.38,2.82,-1.44,4.2],["l",0,.42],["l",-.21,0],["l",-.21,0],["l",0,-15],["l",0,-15],["l",.21,0],["l",.21,0],["l",0,1.86],["l",0,1.89],["c",0,0,.21,-.03,.45,-.09],["c",2.22,-.39,4.08,-1.11,5.19,-2.01],["c",.63,-.54,1.02,-1.14,1.2,-1.8],["c",.06,-.3,.06,-1.14,-.03,-1.65],["c",-.03,-.18,-.06,-.39,-.09,-.48],["c",-.03,-.24,.12,-.48,.36,-.6],["z"],["m",-.45,6.15],["c",-.03,-.18,-.06,-.42,-.06,-.54],["l",-.03,-.18],["l",-.33,.3],["c",-.42,.36,-.87,.72,-1.68,1.29],["c",-1.98,1.38,-2.25,1.59,-2.85,2.16],["c",-.75,.69,-1.23,1.44,-1.47,2.19],["c",-.15,.45,-.18,.63,-.21,1.35],["l",0,.66],["l",.39,-.18],["c",1.83,-.9,3.45,-1.95,4.47,-2.91],["c",.93,-.9,1.53,-1.83,1.74,-2.82],["c",.06,-.33,.06,-.87,.03,-1.32],["z"],["m",-.27,4.86],["c",-.03,-.21,-.06,-.36,-.06,-.36],["c",0,-.03,-.12,.09,-.24,.24],["c",-.39,.48,-.99,1.08,-2.16,2.19],["c",-1.47,1.38,-1.92,1.83,-2.46,2.49],["c",-.66,.87,-1.08,1.74,-1.29,2.58],["c",-.09,.42,-.15,.87,-.15,1.44],["l",0,.54],["l",.48,-.33],["c",1.5,-1.02,2.58,-1.89,3.51,-2.82],["c",1.47,-1.47,2.25,-2.85,2.4,-4.26],["c",.03,-.39,.03,-1.17,-.03,-1.71],["z"],["m",-.66,7.68],["c",.03,-.15,.03,-.6,.03,-.99],["l",0,-.72],["l",-.27,.33],["l",-1.74,1.98],["c",-1.77,1.92,-2.43,2.76,-2.97,3.9],["c",-.51,1.02,-.72,1.77,-.75,2.91],["c",0,.63,0,.63,.06,.6],["c",.03,-.03,.3,-.27,.63,-.54],["c",.66,-.6,1.86,-1.8,2.31,-2.31],["c",1.65,-1.89,2.52,-3.54,2.7,-5.16],["z"]],w:8.485,h:32.932},"clefs.C":{d:[["M",.06,-14.94],["l",.09,-.06],["l",1.92,0],["l",1.92,0],["l",.09,.06],["l",.06,.09],["l",0,14.85],["l",0,14.82],["l",-.06,.09],["l",-.09,.06],["l",-1.92,0],["l",-1.92,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"],["m",5.37,0],["c",.09,-.06,.09,-.06,.57,-.06],["c",.45,0,.45,0,.54,.06],["l",.06,.09],["l",0,7.14],["l",0,7.11],["l",.09,-.06],["c",.18,-.18,.72,-.84,.96,-1.2],["c",.3,-.45,.66,-1.17,.84,-1.65],["c",.36,-.9,.57,-1.83,.6,-2.79],["c",.03,-.48,.03,-.54,.09,-.63],["c",.12,-.18,.36,-.21,.54,-.12],["c",.18,.09,.21,.15,.24,.66],["c",.06,.87,.21,1.56,.57,2.22],["c",.51,1.02,1.26,1.68,2.22,1.92],["c",.21,.06,.33,.06,.78,.06],["c",.45,0,.57,0,.84,-.06],["c",.45,-.12,.81,-.33,1.08,-.6],["c",.57,-.57,.87,-1.41,.99,-2.88],["c",.06,-.54,.06,-3,0,-3.57],["c",-.21,-2.58,-.84,-3.87,-2.16,-4.5],["c",-.48,-.21,-1.17,-.36,-1.77,-.36],["c",-.69,0,-1.29,.27,-1.5,.72],["c",-.06,.15,-.06,.21,-.06,.42],["c",0,.24,0,.3,.06,.45],["c",.12,.24,.24,.39,.63,.66],["c",.42,.3,.57,.48,.69,.72],["c",.06,.15,.06,.21,.06,.48],["c",0,.39,-.03,.63,-.21,.96],["c",-.3,.6,-.87,1.08,-1.5,1.26],["c",-.27,.06,-.87,.06,-1.14,0],["c",-.78,-.24,-1.44,-.87,-1.65,-1.68],["c",-.12,-.42,-.09,-1.17,.09,-1.71],["c",.51,-1.65,1.98,-2.82,3.81,-3.09],["c",.84,-.09,2.46,.03,3.51,.27],["c",2.22,.57,3.69,1.8,4.44,3.75],["c",.36,.93,.57,2.13,.57,3.36],["c",0,1.44,-.48,2.73,-1.38,3.81],["c",-1.26,1.5,-3.27,2.43,-5.28,2.43],["c",-.48,0,-.51,0,-.75,-.09],["c",-.15,-.03,-.48,-.21,-.78,-.36],["c",-.69,-.36,-.87,-.42,-1.26,-.42],["c",-.27,0,-.3,0,-.51,.09],["c",-.57,.3,-.81,.9,-.81,2.1],["c",0,1.23,.24,1.83,.81,2.13],["c",.21,.09,.24,.09,.51,.09],["c",.39,0,.57,-.06,1.26,-.42],["c",.3,-.15,.63,-.33,.78,-.36],["c",.24,-.09,.27,-.09,.75,-.09],["c",2.01,0,4.02,.93,5.28,2.4],["c",.9,1.11,1.38,2.4,1.38,3.84],["c",0,1.5,-.3,2.88,-.84,3.96],["c",-.78,1.59,-2.19,2.64,-4.17,3.15],["c",-1.05,.24,-2.67,.36,-3.51,.27],["c",-1.83,-.27,-3.3,-1.44,-3.81,-3.09],["c",-.18,-.54,-.21,-1.29,-.09,-1.74],["c",.15,-.6,.63,-1.2,1.23,-1.47],["c",.36,-.18,.57,-.21,.99,-.21],["c",.42,0,.63,.03,1.02,.21],["c",.42,.21,.84,.63,1.05,1.05],["c",.18,.36,.21,.6,.21,.96],["c",0,.3,0,.36,-.06,.51],["c",-.12,.24,-.27,.42,-.69,.72],["c",-.57,.42,-.69,.63,-.69,1.08],["c",0,.24,0,.3,.06,.45],["c",.12,.21,.3,.39,.57,.54],["c",.42,.18,.87,.21,1.53,.15],["c",1.08,-.15,1.8,-.57,2.34,-1.32],["c",.54,-.75,.84,-1.83,.99,-3.51],["c",.06,-.57,.06,-3.03,0,-3.57],["c",-.12,-1.47,-.42,-2.31,-.99,-2.88],["c",-.27,-.27,-.63,-.48,-1.08,-.6],["c",-.27,-.06,-.39,-.06,-.84,-.06],["c",-.45,0,-.57,0,-.78,.06],["c",-1.14,.27,-2.01,1.17,-2.46,2.49],["c",-.21,.57,-.3,.99,-.33,1.65],["c",-.03,.51,-.06,.57,-.24,.66],["c",-.12,.06,-.27,.06,-.39,0],["c",-.21,-.09,-.21,-.15,-.24,-.75],["c",-.09,-1.92,-.78,-3.72,-2.01,-5.19],["c",-.18,-.21,-.36,-.42,-.39,-.45],["l",-.09,-.06],["l",0,7.11],["l",0,7.14],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.54,.06],["c",-.48,0,-.48,0,-.57,-.06],["l",-.06,-.09],["l",0,-14.82],["l",0,-14.85],["z"]],w:20.31,h:29.97},"clefs.F":{d:[["M",6.3,-7.8],["c",.36,-.03,1.65,0,2.13,.03],["c",3.6,.42,6.03,2.1,6.93,4.86],["c",.27,.84,.36,1.5,.36,2.58],["c",0,.9,-.03,1.35,-.18,2.16],["c",-.78,3.78,-3.54,7.08,-8.37,9.96],["c",-1.74,1.05,-3.87,2.13,-6.18,3.12],["c",-.39,.18,-.75,.33,-.81,.36],["c",-.06,.03,-.15,.06,-.18,.06],["c",-.15,0,-.33,-.18,-.33,-.33],["c",0,-.15,.06,-.21,.51,-.48],["c",3,-1.77,5.13,-3.21,6.84,-4.74],["c",.51,-.45,1.59,-1.5,1.95,-1.95],["c",1.89,-2.19,2.88,-4.32,3.15,-6.78],["c",.06,-.42,.06,-1.77,0,-2.19],["c",-.24,-2.01,-.93,-3.63,-2.04,-4.71],["c",-.63,-.63,-1.29,-1.02,-2.07,-1.2],["c",-1.62,-.39,-3.36,.15,-4.56,1.44],["c",-.54,.6,-1.05,1.47,-1.32,2.22],["l",-.09,.21],["l",.24,-.12],["c",.39,-.21,.63,-.24,1.11,-.24],["c",.3,0,.45,0,.66,.06],["c",1.92,.48,2.85,2.55,1.95,4.38],["c",-.45,.99,-1.41,1.62,-2.46,1.71],["c",-1.47,.09,-2.91,-.87,-3.39,-2.25],["c",-.18,-.57,-.21,-1.32,-.03,-2.28],["c",.39,-2.25,1.83,-4.2,3.81,-5.19],["c",.69,-.36,1.59,-.6,2.37,-.69],["z"],["m",11.58,2.52],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.3,1.17,-.72,2.19,-1.89,1.89],["c",-.99,-.21,-1.5,-1.32,-1.02,-2.25],["c",.18,-.39,.6,-.69,1.02,-.78],["z"],["m",0,7.5],["c",.84,-.21,1.71,.3,1.89,1.14],["c",.21,.87,-.3,1.71,-1.14,1.89],["c",-.87,.21,-1.71,-.3,-1.89,-1.14],["c",-.21,-.84,.3,-1.71,1.14,-1.89],["z"]],w:20.153,h:23.142},"clefs.G":{d:[["M",9.69,-37.41],["c",.09,-.09,.24,-.06,.36,0],["c",.12,.09,.57,.6,.96,1.11],["c",1.77,2.34,3.21,5.85,3.57,8.73],["c",.21,1.56,.03,3.27,-.45,4.86],["c",-.69,2.31,-1.92,4.47,-4.23,7.44],["c",-.3,.39,-.57,.72,-.6,.75],["c",-.03,.06,0,.15,.18,.78],["c",.54,1.68,1.38,4.44,1.68,5.49],["l",.09,.42],["l",.39,0],["c",1.47,.09,2.76,.51,3.96,1.29],["c",1.83,1.23,3.06,3.21,3.39,5.52],["c",.09,.45,.12,1.29,.06,1.74],["c",-.09,1.02,-.33,1.83,-.75,2.73],["c",-.84,1.71,-2.28,3.06,-4.02,3.72],["l",-.33,.12],["l",.03,1.26],["c",0,1.74,-.06,3.63,-.21,4.62],["c",-.45,3.06,-2.19,5.49,-4.47,6.21],["c",-.57,.18,-.9,.21,-1.59,.21],["c",-.69,0,-1.02,-.03,-1.65,-.21],["c",-1.14,-.27,-2.13,-.84,-2.94,-1.65],["c",-.99,-.99,-1.56,-2.16,-1.71,-3.54],["c",-.09,-.81,.06,-1.53,.45,-2.13],["c",.63,-.99,1.83,-1.56,3,-1.53],["c",1.5,.09,2.64,1.32,2.73,2.94],["c",.06,1.47,-.93,2.7,-2.37,2.97],["c",-.45,.06,-.84,.03,-1.29,-.09],["l",-.21,-.09],["l",.09,.12],["c",.39,.54,.78,.93,1.32,1.26],["c",1.35,.87,3.06,1.02,4.35,.36],["c",1.44,-.72,2.52,-2.28,2.97,-4.35],["c",.15,-.66,.24,-1.5,.3,-3.03],["c",.03,-.84,.03,-2.94,0,-3],["c",-.03,0,-.18,0,-.36,.03],["c",-.66,.12,-.99,.12,-1.83,.12],["c",-1.05,0,-1.71,-.06,-2.61,-.3],["c",-4.02,-.99,-7.11,-4.35,-7.8,-8.46],["c",-.12,-.66,-.12,-.99,-.12,-1.83],["c",0,-.84,0,-1.14,.15,-1.92],["c",.36,-2.28,1.41,-4.62,3.3,-7.29],["l",2.79,-3.6],["c",.54,-.66,.96,-1.2,.96,-1.23],["c",0,-.03,-.09,-.33,-.18,-.69],["c",-.96,-3.21,-1.41,-5.28,-1.59,-7.68],["c",-.12,-1.38,-.15,-3.09,-.06,-3.96],["c",.33,-2.67,1.38,-5.07,3.12,-7.08],["c",.36,-.42,.99,-1.05,1.17,-1.14],["z"],["m",2.01,4.71],["c",-.15,-.3,-.3,-.54,-.3,-.54],["c",-.03,0,-.18,.09,-.3,.21],["c",-2.4,1.74,-3.87,4.2,-4.26,7.11],["c",-.06,.54,-.06,1.41,-.03,1.89],["c",.09,1.29,.48,3.12,1.08,5.22],["c",.15,.42,.24,.78,.24,.81],["c",0,.03,.84,-1.11,1.23,-1.68],["c",1.89,-2.73,2.88,-5.07,3.15,-7.53],["c",.09,-.57,.12,-1.74,.06,-2.37],["c",-.09,-1.23,-.27,-1.92,-.87,-3.12],["z"],["m",-2.94,20.7],["c",-.21,-.72,-.39,-1.32,-.42,-1.32],["c",0,0,-1.2,1.47,-1.86,2.37],["c",-2.79,3.63,-4.02,6.3,-4.35,9.3],["c",-.03,.21,-.03,.69,-.03,1.08],["c",0,.69,0,.75,.06,1.11],["c",.12,.54,.27,.99,.51,1.47],["c",.69,1.38,1.83,2.55,3.42,3.42],["c",.96,.54,2.07,.9,3.21,1.08],["c",.78,.12,2.04,.12,2.94,-.03],["c",.51,-.06,.45,-.03,.42,-.3],["c",-.24,-3.33,-.72,-6.33,-1.62,-10.08],["c",-.09,-.39,-.18,-.75,-.18,-.78],["c",-.03,-.03,-.42,0,-.81,.09],["c",-.9,.18,-1.65,.57,-2.22,1.14],["c",-.72,.72,-1.08,1.65,-1.05,2.64],["c",.06,.96,.48,1.83,1.23,2.58],["c",.36,.36,.72,.63,1.17,.9],["c",.33,.18,.36,.21,.42,.33],["c",.18,.42,-.18,.9,-.6,.87],["c",-.18,-.03,-.84,-.36,-1.26,-.63],["c",-.78,-.51,-1.38,-1.11,-1.86,-1.83],["c",-1.77,-2.7,-.99,-6.42,1.71,-8.19],["c",.3,-.21,.81,-.48,1.17,-.63],["c",.3,-.09,1.02,-.3,1.14,-.3],["c",.06,0,.09,0,.09,-.03],["c",.03,-.03,-.51,-1.92,-1.23,-4.26],["z"],["m",3.78,7.41],["c",-.18,-.03,-.36,-.06,-.39,-.06],["c",-.03,0,0,.21,.18,1.02],["c",.75,3.18,1.26,6.3,1.5,9.09],["c",.06,.72,0,.69,.51,.42],["c",.78,-.36,1.44,-.96,1.98,-1.77],["c",1.08,-1.62,1.2,-3.69,.3,-5.55],["c",-.81,-1.62,-2.31,-2.79,-4.08,-3.15],["z"]],w:19.051,h:57.057},"clefs.perc":{d:[["M",5.07,-7.44],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"],["m",6.63,0],["l",.09,-.06],["l",1.53,0],["l",1.53,0],["l",.09,.06],["l",.06,.09],["l",0,7.35],["l",0,7.32],["l",-.06,.09],["l",-.09,.06],["l",-1.53,0],["l",-1.53,0],["l",-.09,-.06],["l",-.06,-.09],["l",0,-7.32],["l",0,-7.35],["z"]],w:21,h:14.97},"tab.big":{d:[["M",20.16,-21.66],["c",.24,-.09,.66,.09,.78,.36],["c",.09,.21,.09,.24,-.18,.54],["c",-.78,.81,-1.86,1.44,-2.94,1.71],["c",-.87,.24,-1.71,.24,-2.55,.03],["l",-.06,-.03],["l",-.18,.99],["c",-.33,1.98,-.75,4.26,-.96,5.04],["c",-.42,1.65,-1.26,3.18,-2.28,4.14],["c",-.57,.57,-1.17,.9,-1.86,1.08],["c",-.18,.06,-.33,.06,-.66,.06],["c",-.54,0,-.78,-.03,-1.23,-.27],["c",-.39,-.18,-.66,-.39,-1.38,-.99],["c",-.3,-.24,-.66,-.51,-.75,-.57],["c",-.21,-.15,-.27,-.24,-.24,-.45],["c",.06,-.27,.36,-.6,.6,-.66],["c",.18,-.03,.33,.06,.9,.57],["c",.48,.42,.72,.57,.93,.69],["c",.66,.33,1.38,.21,1.95,-.36],["c",.63,-.6,1.05,-1.62,1.23,-3],["c",.03,-.18,.09,-.66,.09,-1.11],["c",.09,-1.56,.33,-3.81,.57,-5.49],["c",.06,-.33,.09,-.63,.09,-.63],["c",-.03,-.03,-.81,-.12,-1.02,-.12],["c",-.57,0,-1.32,.12,-1.8,.33],["c",-.87,.3,-1.35,.78,-1.5,1.41],["c",-.18,.63,.09,1.26,.66,1.65],["c",.12,.06,.15,.12,.18,.24],["c",.09,.27,.06,.57,-.09,.75],["c",-.03,.06,-.12,.09,-.27,.15],["c",-.72,.21,-1.44,.15,-2.1,-.18],["c",-.54,-.27,-.96,-.66,-1.2,-1.14],["c",-.39,-.75,-.33,-1.74,.15,-2.52],["c",.27,-.42,.84,-.93,1.41,-1.23],["c",1.17,-.57,2.88,-.9,4.8,-.9],["c",.69,0,.78,0,1.08,.06],["c",.45,.09,1.11,.3,2.07,.6],["c",1.47,.48,1.83,.57,2.55,.54],["c",1.02,-.06,2.04,-.45,2.94,-1.11],["c",.12,-.09,.24,-.18,.27,-.18],["z"],["m",-5.88,13.05],["c",.21,-.03,.81,0,1.08,.06],["c",.48,.12,.9,.42,.99,.69],["c",.03,.09,.03,.15,0,.27],["c",0,.09,-.03,.57,-.06,1.08],["c",-.09,2.19,-.24,5.76,-.39,8.28],["c",-.06,1.53,-.06,1.77,.03,2.01],["c",.09,.18,.15,.24,.3,.3],["c",.24,.12,.54,.06,1.23,-.27],["c",.57,-.27,.66,-.3,.75,-.24],["c",.09,.06,.18,.3,.18,.45],["c",0,.33,-.15,.51,-.45,.63],["c",-.12,.03,-.39,.15,-.6,.27],["c",-1.17,.6,-1.38,.69,-1.8,.72],["c",-.45,.03,-.78,-.09,-1.08,-.39],["c",-.39,-.42,-.66,-1.2,-1.02,-3.12],["c",-.24,-1.23,-.36,-2.07,-.54,-3.75],["l",0,-.18],["l",-.36,.45],["c",-.6,.75,-1.32,1.59,-1.95,2.25],["c",-.15,.18,-.27,.3,-.27,.33],["c",0,0,.06,.09,.15,.18],["c",.24,.33,.6,.57,1.05,.69],["c",.18,.06,.3,.06,.69,.06],["l",.48,.03],["l",.06,.12],["c",.15,.27,.03,.72,-.21,.9],["c",-.18,.12,-.93,.27,-1.41,.27],["c",-.84,0,-1.59,-.3,-1.98,-.84],["l",-.12,-.15],["l",-.45,.42],["c",-.99,.87,-1.53,1.32,-2.16,1.74],["c",-.78,.51,-1.5,.84,-2.1,.93],["c",-.69,.12,-1.2,.03,-1.95,-.42],["c",-.21,-.12,-.51,-.27,-.66,-.36],["c",-.24,-.12,-.3,-.18,-.33,-.24],["c",-.12,-.27,.15,-.78,.45,-.93],["c",.24,-.12,.33,-.09,.9,.18],["c",.6,.3,.84,.39,1.2,.36],["c",.87,-.09,1.77,-.69,3.24,-2.31],["c",2.67,-2.85,4.59,-5.94,5.7,-9.15],["c",.15,-.45,.24,-.63,.42,-.81],["c",.21,-.24,.6,-.45,.99,-.51],["z"],["m",-3.99,16.05],["c",.18,0,.69,-.03,1.17,0],["c",3.27,.03,5.37,.75,6,2.07],["c",.45,.99,.12,2.4,-.81,3.42],["c",-.24,.27,-.57,.57,-.84,.75],["c",-.09,.06,-.18,.09,-.18,.12],["c",0,0,.18,.03,.42,.09],["c",1.23,.3,2.01,.81,2.37,1.59],["c",.27,.54,.3,1.32,.09,2.1],["c",-.12,.36,-.45,1.05,-.69,1.35],["c",-.87,1.17,-2.1,1.92,-3.54,2.25],["c",-.36,.06,-.48,.06,-.96,.06],["c",-.45,0,-.66,0,-.84,-.03],["c",-.84,-.18,-1.47,-.51,-2.07,-1.11],["c",-.33,-.33,-.45,-.51,-.45,-.63],["c",0,-.06,.03,-.15,.06,-.24],["c",.18,-.33,.69,-.6,.93,-.48],["c",.03,.03,.15,.12,.27,.24],["c",.39,.42,.99,.57,1.62,.45],["c",1.05,-.21,1.98,-1.02,2.31,-2.01],["c",.48,-1.53,-.48,-2.55,-2.58,-2.67],["c",-.21,0,-.36,-.03,-.42,-.06],["c",-.15,-.09,-.21,-.51,-.06,-.78],["c",.12,-.27,.24,-.33,.6,-.36],["c",.57,-.06,1.11,-.42,1.5,-.99],["c",.48,-.72,.54,-1.59,.18,-2.31],["c",-.12,-.21,-.45,-.54,-.69,-.69],["c",-.33,-.21,-.93,-.45,-1.35,-.51],["l",-.12,-.03],["l",-.06,.48],["c",-.54,2.94,-1.14,6.24,-1.29,6.75],["c",-.33,1.35,-.93,2.61,-1.65,3.6],["c",-.3,.36,-.81,.9,-1.14,1.14],["c",-.3,.24,-.84,.48,-1.14,.57],["c",-.33,.09,-.96,.09,-1.26,.03],["c",-.45,-.12,-.87,-.39,-1.53,-.96],["c",-.24,-.15,-.51,-.39,-.63,-.48],["c",-.3,-.21,-.33,-.33,-.21,-.63],["c",.12,-.18,.27,-.36,.42,-.45],["c",.27,-.12,.36,-.09,.87,.33],["c",.78,.6,1.08,.75,1.65,.72],["c",.45,-.03,.81,-.21,1.17,-.54],["c",.87,-.9,1.38,-2.85,1.38,-5.37],["c",0,-.6,.03,-1.11,.12,-2.04],["c",.06,-.69,.24,-2.01,.33,-2.58],["c",.06,-.24,.06,-.42,.06,-.42],["c",0,0,-.12,.03,-.21,.09],["c",-1.44,.57,-2.16,1.65,-1.74,2.55],["c",.09,.15,.18,.24,.27,.33],["c",.24,.21,.3,.27,.33,.39],["c",.06,.24,0,.63,-.15,.78],["c",-.09,.12,-.54,.21,-.96,.24],["c",-1.02,.03,-2.01,-.48,-2.43,-1.32],["c",-.21,-.45,-.27,-.9,-.15,-1.44],["c",.06,-.27,.21,-.66,.39,-.93],["c",.87,-1.29,3,-2.22,5.64,-2.43],["z"]],w:19.643,h:43.325},"tab.tiny":{d:[["M",16.02,-17.25],["c",.12,-.09,.15,-.09,.27,-.09],["c",.21,.03,.51,.3,.51,.45],["c",0,.06,-.12,.18,-.3,.36],["c",-1.11,1.08,-2.55,1.59,-3.84,1.41],["c",-.15,-.03,-.33,-.06,-.39,-.09],["c",-.06,-.03,-.09,-.03,-.12,-.03],["c",0,0,-.06,.42,-.15,.93],["c",-.33,2.01,-.66,3.69,-.84,4.26],["c",-.42,1.41,-1.23,2.67,-2.16,3.33],["c",-.27,.18,-.75,.42,-.99,.48],["c",-.3,.09,-.72,.09,-1.02,.06],["c",-.45,-.09,-.84,-.33,-1.53,-.9],["c",-.21,-.18,-.51,-.39,-.63,-.48],["c",-.27,-.21,-.3,-.24,-.3,-.36],["c",0,-.12,.09,-.36,.18,-.45],["c",.09,-.09,.27,-.18,.36,-.18],["c",.12,0,.3,.12,.66,.45],["c",.57,.51,.87,.69,1.23,.72],["c",.93,.06,1.68,-.78,1.98,-2.37],["c",.09,-.39,.15,-.75,.18,-1.53],["c",.06,-.99,.24,-2.79,.42,-4.05],["c",.03,-.3,.06,-.57,.06,-.6],["c",0,-.06,-.03,-.09,-.15,-.12],["c",-.9,-.18,-2.13,.06,-2.76,.57],["c",-.36,.3,-.51,.6,-.51,1.02],["c",0,.45,.15,.75,.48,.99],["c",.06,.06,.15,.18,.18,.24],["c",.12,.24,.03,.63,-.15,.69],["c",-.24,.12,-.6,.15,-.9,.15],["c",-.36,-.03,-.57,-.09,-.87,-.24],["c",-.78,-.36,-1.23,-1.11,-1.2,-1.92],["c",.12,-1.53,1.74,-2.49,4.62,-2.7],["c",1.2,-.09,1.47,-.03,3.33,.57],["c",.9,.3,1.14,.36,1.56,.39],["c",.45,0,.93,-.06,1.38,-.21],["c",.51,-.18,.81,-.33,1.41,-.75],["z"],["m",-4.68,10.38],["c",.39,-.06,.84,0,1.2,.15],["c",.24,.12,.36,.21,.45,.36],["l",.09,.09],["l",-.06,1.41],["c",-.09,2.19,-.18,3.96,-.27,5.49],["c",-.03,.78,-.06,1.59,-.06,1.86],["c",0,.42,0,.48,.06,.57],["c",.06,.18,.18,.24,.36,.27],["c",.18,0,.39,-.06,.84,-.27],["c",.45,-.21,.54,-.24,.63,-.18],["c",.12,.12,.15,.54,.03,.69],["c",-.03,.03,-.15,.12,-.27,.18],["c",-.15,.03,-.3,.12,-.36,.15],["c",-.87,.45,-1.02,.51,-1.26,.57],["c",-.33,.09,-.6,.06,-.84,-.06],["c",-.42,-.18,-.63,-.6,-.87,-1.44],["c",-.3,-1.23,-.57,-2.97,-.66,-4.08],["c",0,-.18,-.03,-.3,-.03,-.33],["l",-.06,.06],["c",-.18,.27,-1.11,1.38,-1.68,2.01],["l",-.33,.33],["l",.06,.09],["c",.06,.15,.27,.33,.48,.42],["c",.27,.18,.51,.24,.96,.27],["l",.39,0],["l",.03,.12],["c",.12,.21,.03,.57,-.15,.69],["c",-.03,.03,-.21,.09,-.36,.15],["c",-.27,.06,-.39,.06,-.75,.06],["c",-.48,0,-.75,-.03,-1.08,-.21],["c",-.21,-.12,-.51,-.36,-.57,-.48],["l",-.03,-.09],["l",-.39,.36],["c",-1.47,1.35,-2.49,1.98,-3.42,2.13],["c",-.54,.09,-.96,-.03,-1.62,-.39],["c",-.21,-.15,-.45,-.27,-.54,-.3],["c",-.18,-.09,-.21,-.21,-.12,-.45],["c",.06,-.27,.33,-.48,.54,-.48],["c",.03,0,.27,.09,.48,.21],["c",.48,.24,.69,.27,.99,.27],["c",.6,-.06,1.17,-.42,2.1,-1.35],["c",2.22,-2.22,4.02,-4.98,4.95,-7.59],["c",.21,-.57,.3,-.78,.48,-.93],["c",.15,-.15,.42,-.27,.66,-.33],["z"],["m",-3.06,12.84],["c",.27,-.03,1.68,0,2.01,.03],["c",1.92,.18,3.15,.69,3.63,1.5],["c",.18,.33,.24,.51,.21,.93],["c",0,.45,-.06,.72,-.24,1.11],["c",-.24,.51,-.69,1.02,-1.17,1.35],["c",-.21,.15,-.21,.15,-.12,.18],["c",.72,.15,1.11,.3,1.5,.57],["c",.39,.24,.63,.57,.75,.96],["c",.09,.3,.09,.96,0,1.29],["c",-.15,.57,-.39,1.05,-.78,1.5],["c",-.66,.75,-1.62,1.32,-2.61,1.53],["c",-.27,.06,-.42,.06,-.84,.06],["c",-.48,0,-.57,0,-.81,-.06],["c",-.6,-.18,-1.05,-.42,-1.47,-.81],["c",-.36,-.39,-.42,-.51,-.3,-.75],["c",.12,-.21,.39,-.39,.6,-.39],["c",.09,0,.15,.03,.33,.18],["c",.12,.12,.27,.24,.36,.27],["c",.96,.48,2.46,-.33,2.82,-1.5],["c",.24,-.81,-.03,-1.44,-.69,-1.77],["c",-.39,-.21,-1.02,-.33,-1.53,-.33],["c",-.18,0,-.21,0,-.27,-.09],["c",-.06,-.09,-.06,-.3,-.03,-.48],["c",.06,-.18,.18,-.36,.33,-.36],["c",.39,-.06,.51,-.09,.72,-.18],["c",.69,-.36,1.11,-1.23,.99,-2.01],["c",-.09,-.51,-.42,-.9,-.93,-1.17],["c",-.24,-.12,-.6,-.27,-.87,-.3],["c",-.09,-.03,-.09,-.03,-.12,.12],["c",0,.09,-.21,1.11,-.42,2.25],["c",-.66,3.75,-.72,3.99,-1.26,5.07],["c",-.9,1.89,-2.25,2.85,-3.48,2.61],["c",-.39,-.09,-.69,-.27,-1.38,-.84],["c",-.63,-.51,-.63,-.48,-.63,-.6],["c",0,-.18,.18,-.48,.39,-.57],["c",.21,-.12,.3,-.09,.81,.33],["c",.15,.15,.39,.3,.54,.36],["c",.18,.12,.27,.12,.48,.15],["c",.99,.06,1.71,-.78,2.04,-2.46],["c",.12,-.66,.18,-1.14,.21,-2.22],["c",.03,-1.23,.12,-2.25,.36,-3.63],["c",.03,-.24,.06,-.45,.06,-.48],["c",-.06,-.03,-.66,.27,-.9,.42],["c",-.06,.06,-.21,.18,-.33,.3],["c",-.57,.57,-.6,1.35,-.06,1.74],["c",.18,.12,.24,.24,.21,.51],["c",-.03,.3,-.15,.42,-.57,.48],["c",-1.11,.24,-2.22,-.42,-2.43,-1.38],["c",-.09,-.45,.03,-1.02,.3,-1.47],["c",.18,-.24,.6,-.63,.9,-.84],["c",.9,-.6,2.28,-1.02,3.69,-1.11],["z"]],w:15.709,h:34.656},"timesig.common":{d:[["M",6.66,-7.83],["c",.72,-.06,1.41,-.03,1.98,.09],["c",1.2,.27,2.34,.96,3.09,1.92],["c",.63,.81,1.08,1.86,1.14,2.73],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,0,-.09,-.12,-.24,-.27],["c",-1.02,-1.11,-2.55,-1.68,-4.08,-1.5],["c",-1.29,.15,-2.04,.69,-2.4,1.74],["c",-.36,.93,-.42,1.89,-.42,5.37],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.63,1.68,1.41,2.07],["c",.81,.39,2.16,.45,3.18,.09],["c",1.29,-.45,2.37,-1.53,3.03,-2.97],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.06,.39,-.42,1.38,-.69,1.89],["c",-.96,1.8,-2.49,2.94,-4.23,3.18],["c",-.99,.12,-2.58,-.06,-3.63,-.45],["c",-.96,-.36,-1.71,-.84,-2.4,-1.5],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.9,-3.45,2.01,-4.56],["c",.69,-.66,1.44,-1.11,2.37,-1.47],["c",.63,-.24,1.47,-.42,2.22,-.48],["z"]],w:13.038,h:15.689},"timesig.cut":{d:[["M",6.24,-10.44],["c",.09,-.06,.09,-.06,.48,-.06],["c",.36,0,.36,0,.45,.06],["l",.06,.09],["l",0,1.23],["l",0,1.26],["l",.27,0],["c",1.26,0,2.49,.45,3.48,1.29],["c",1.05,.87,1.8,2.28,1.89,3.48],["c",.06,1.02,-.51,1.92,-1.44,2.22],["c",-.24,.09,-.3,.09,-.63,.09],["c",-.33,0,-.42,0,-.63,-.06],["c",-.66,-.24,-1.14,-.63,-1.41,-1.2],["c",-.15,-.3,-.21,-.51,-.24,-.9],["c",-.06,-1.08,.57,-2.04,1.56,-2.37],["c",.18,-.06,.27,-.06,.63,-.06],["l",.45,0],["c",.06,.03,.09,.03,.09,0],["c",0,-.03,-.45,-.51,-.66,-.69],["c",-.87,-.69,-1.83,-1.05,-2.94,-1.11],["l",-.42,0],["l",0,7.17],["l",0,7.14],["l",.42,0],["c",.69,-.03,1.23,-.18,1.86,-.51],["c",1.05,-.51,1.89,-1.47,2.46,-2.7],["c",.15,-.33,.33,-.87,.39,-1.17],["c",.09,-.24,.15,-.36,.3,-.39],["c",.21,-.03,.42,.15,.39,.36],["c",-.03,.24,-.21,.78,-.39,1.2],["c",-.96,2.37,-2.94,3.9,-5.13,3.9],["l",-.3,0],["l",0,1.26],["l",0,1.23],["l",-.06,.09],["c",-.09,.06,-.09,.06,-.45,.06],["c",-.39,0,-.39,0,-.48,-.06],["l",-.06,-.09],["l",0,-1.29],["l",0,-1.29],["l",-.21,-.03],["c",-1.23,-.21,-2.31,-.63,-3.21,-1.29],["c",-.15,-.09,-.45,-.36,-.66,-.57],["c",-1.11,-1.11,-1.8,-2.61,-2.04,-4.56],["c",-.06,-.6,-.06,-2.01,0,-2.61],["c",.24,-1.95,.93,-3.45,2.04,-4.59],["c",.42,-.39,.78,-.66,1.26,-.93],["c",.75,-.45,1.65,-.75,2.61,-.9],["l",.21,-.03],["l",0,-1.29],["l",0,-1.29],["z"],["m",-.06,10.44],["c",0,-5.58,0,-6.99,-.03,-6.99],["c",-.15,0,-.63,.27,-.87,.45],["c",-.45,.36,-.75,.93,-.93,1.77],["c",-.18,.81,-.24,1.8,-.24,4.74],["c",0,2.97,.06,3.96,.24,4.77],["c",.24,1.08,.66,1.68,1.41,2.07],["c",.12,.06,.3,.12,.33,.15],["l",.09,0],["l",0,-6.96],["z"]],w:13.038,h:20.97},"timesig.imperfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.imperfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},"timesig.perfectum2":{d:[["M",13,-5],["a",8,8,0,1,0,0,10]],w:13.038,h:20.97},f:{d:[["M",9.93,-14.28],["c",1.53,-.18,2.88,.45,3.12,1.5],["c",.12,.51,0,1.32,-.27,1.86],["c",-.15,.3,-.42,.57,-.63,.69],["c",-.69,.36,-1.56,.03,-1.83,-.69],["c",-.09,-.24,-.09,-.69,0,-.87],["c",.06,-.12,.21,-.24,.45,-.42],["c",.42,-.24,.57,-.45,.6,-.72],["c",.03,-.33,-.09,-.39,-.63,-.42],["c",-.3,0,-.45,0,-.6,.03],["c",-.81,.21,-1.35,.93,-1.74,2.46],["c",-.06,.27,-.48,2.25,-.48,2.31],["c",0,.03,.39,.03,.9,.03],["c",.72,0,.9,0,.99,.06],["c",.42,.15,.45,.72,.03,.9],["c",-.12,.06,-.24,.06,-1.17,.06],["l",-1.05,0],["l",-.78,2.55],["c",-.45,1.41,-.87,2.79,-.96,3.06],["c",-.87,2.37,-2.37,4.74,-3.78,5.91],["c",-1.05,.9,-2.04,1.23,-3.09,1.08],["c",-1.11,-.18,-1.89,-.78,-2.04,-1.59],["c",-.12,-.66,.15,-1.71,.54,-2.19],["c",.69,-.75,1.86,-.54,2.22,.39],["c",.06,.15,.09,.27,.09,.48],["c",0,.24,-.03,.27,-.12,.42],["c",-.03,.09,-.15,.18,-.27,.27],["c",-.09,.06,-.27,.21,-.36,.27],["c",-.24,.18,-.36,.36,-.39,.6],["c",-.03,.33,.09,.39,.63,.42],["c",.42,0,.63,-.03,.9,-.15],["c",.6,-.3,.96,-.96,1.38,-2.64],["c",.09,-.42,.63,-2.55,1.17,-4.77],["l",1.02,-4.08],["c",0,-.03,-.36,-.03,-.81,-.03],["c",-.72,0,-.81,0,-.93,-.06],["c",-.42,-.18,-.39,-.75,.03,-.9],["c",.09,-.06,.27,-.06,1.05,-.06],["l",.96,0],["l",0,-.09],["c",.06,-.18,.3,-.72,.51,-1.17],["c",1.2,-2.46,3.3,-4.23,5.34,-4.5],["z"]],w:16.155,h:19.445},m:{d:[["M",2.79,-8.91],["c",.09,0,.3,-.03,.45,-.03],["c",.24,.03,.3,.03,.45,.12],["c",.36,.15,.63,.54,.75,1.02],["l",.03,.21],["l",.33,-.3],["c",.69,-.69,1.38,-1.02,2.07,-1.02],["c",.27,0,.33,0,.48,.06],["c",.21,.09,.48,.36,.63,.6],["c",.03,.09,.12,.27,.18,.42],["c",.03,.15,.09,.27,.12,.27],["c",0,0,.09,-.09,.18,-.21],["c",.33,-.39,.87,-.81,1.29,-.99],["c",.78,-.33,1.47,-.21,2.01,.33],["c",.3,.33,.48,.69,.6,1.14],["c",.09,.42,.06,.54,-.54,3.06],["c",-.33,1.29,-.57,2.4,-.57,2.43],["c",0,.12,.09,.21,.21,.21],["c",.24,0,.75,-.3,1.2,-.72],["c",.45,-.39,.6,-.45,.78,-.27],["c",.18,.18,.09,.36,-.45,.87],["c",-1.05,.96,-1.83,1.47,-2.58,1.71],["c",-.93,.33,-1.53,.21,-1.8,-.33],["c",-.06,-.15,-.06,-.21,-.06,-.45],["c",0,-.24,.03,-.48,.6,-2.82],["c",.42,-1.71,.6,-2.64,.63,-2.79],["c",.03,-.57,-.3,-.75,-.84,-.48],["c",-.24,.12,-.54,.39,-.66,.63],["c",-.03,.09,-.42,1.38,-.9,3],["c",-.9,3.15,-.84,3,-1.14,3.15],["l",-.15,.09],["l",-.78,0],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.36,-1.38,.84,-2.97],["c",.57,-2.04,.81,-2.97,.84,-3.12],["c",.03,-.54,-.3,-.72,-.84,-.45],["c",-.24,.12,-.57,.42,-.66,.63],["c",-.06,.09,-.51,1.44,-1.05,2.97],["c",-.51,1.56,-.99,2.85,-.99,2.91],["c",-.06,.12,-.21,.24,-.36,.3],["c",-.12,.06,-.21,.06,-.9,.06],["c",-.6,0,-.78,0,-.84,-.06],["c",-.09,-.03,-.18,-.18,-.18,-.27],["c",0,-.03,.45,-1.38,.99,-2.97],["c",1.05,-3.18,1.05,-3.18,.93,-3.45],["c",-.12,-.27,-.39,-.3,-.72,-.15],["c",-.54,.27,-1.14,1.17,-1.56,2.4],["c",-.06,.15,-.15,.3,-.18,.36],["c",-.21,.21,-.57,.27,-.72,.09],["c",-.09,-.09,-.06,-.21,.06,-.63],["c",.48,-1.26,1.26,-2.46,2.01,-3.21],["c",.57,-.54,1.2,-.87,1.83,-1.02],["z"]],w:14.687,h:9.126},p:{d:[["M",1.92,-8.7],["c",.27,-.09,.81,-.06,1.11,.03],["c",.54,.18,.93,.51,1.17,.99],["c",.09,.15,.15,.33,.18,.36],["l",0,.12],["l",.3,-.27],["c",.66,-.6,1.35,-1.02,2.13,-1.2],["c",.21,-.06,.33,-.06,.78,-.06],["c",.45,0,.51,0,.84,.09],["c",1.29,.33,2.07,1.32,2.25,2.79],["c",.09,.81,-.09,2.01,-.45,2.79],["c",-.54,1.26,-1.86,2.55,-3.18,3.03],["c",-.45,.18,-.81,.24,-1.29,.24],["c",-.69,-.03,-1.35,-.18,-1.86,-.45],["c",-.3,-.15,-.51,-.18,-.69,-.09],["c",-.09,.03,-.18,.09,-.18,.12],["c",-.09,.12,-1.05,2.94,-1.05,3.06],["c",0,.24,.18,.48,.51,.63],["c",.18,.06,.54,.15,.75,.15],["c",.21,0,.36,.06,.42,.18],["c",.12,.18,.06,.42,-.12,.54],["c",-.09,.03,-.15,.03,-.78,0],["c",-1.98,-.15,-3.81,-.15,-5.79,0],["c",-.63,.03,-.69,.03,-.78,0],["c",-.24,-.15,-.24,-.57,.03,-.66],["c",.06,-.03,.48,-.09,.99,-.12],["c",.87,-.06,1.11,-.09,1.35,-.21],["c",.18,-.06,.33,-.18,.39,-.3],["c",.06,-.12,3.24,-9.42,3.27,-9.6],["c",.06,-.33,.03,-.57,-.15,-.69],["c",-.09,-.06,-.12,-.06,-.3,-.06],["c",-.69,.06,-1.53,1.02,-2.28,2.61],["c",-.09,.21,-.21,.45,-.27,.51],["c",-.09,.12,-.33,.24,-.48,.24],["c",-.18,0,-.36,-.15,-.36,-.3],["c",0,-.24,.78,-1.83,1.26,-2.55],["c",.72,-1.11,1.47,-1.74,2.28,-1.92],["z"],["m",5.37,1.47],["c",-.27,-.12,-.75,-.03,-1.14,.21],["c",-.75,.48,-1.47,1.68,-1.89,3.15],["c",-.45,1.47,-.42,2.34,0,2.7],["c",.45,.39,1.26,.21,1.83,-.36],["c",.51,-.51,.99,-1.68,1.38,-3.27],["c",.3,-1.17,.33,-1.74,.15,-2.13],["c",-.09,-.15,-.15,-.21,-.33,-.3],["z"]],w:14.689,h:13.127},r:{d:[["M",6.33,-9.12],["c",.27,-.03,.93,0,1.2,.06],["c",.84,.21,1.23,.81,1.02,1.53],["c",-.24,.75,-.9,1.17,-1.56,.96],["c",-.33,-.09,-.51,-.3,-.66,-.75],["c",-.03,-.12,-.09,-.24,-.12,-.3],["c",-.09,-.15,-.3,-.24,-.48,-.24],["c",-.57,0,-1.38,.54,-1.65,1.08],["c",-.06,.15,-.33,1.17,-.9,3.27],["c",-.57,2.31,-.81,3.12,-.87,3.21],["c",-.03,.06,-.12,.15,-.18,.21],["l",-.12,.06],["l",-.81,.03],["c",-.69,0,-.81,0,-.9,-.03],["c",-.09,-.06,-.18,-.21,-.18,-.3],["c",0,-.06,.39,-1.62,.9,-3.51],["c",.84,-3.24,.87,-3.45,.87,-3.72],["c",0,-.21,0,-.27,-.03,-.36],["c",-.12,-.15,-.21,-.24,-.42,-.24],["c",-.24,0,-.45,.15,-.78,.42],["c",-.33,.36,-.45,.54,-.72,1.14],["c",-.03,.12,-.21,.24,-.36,.27],["c",-.12,0,-.15,0,-.24,-.06],["c",-.18,-.12,-.18,-.21,-.06,-.54],["c",.21,-.57,.42,-.93,.78,-1.32],["c",.54,-.51,1.2,-.81,1.95,-.87],["c",.81,-.03,1.53,.3,1.92,.87],["l",.12,.18],["l",.09,-.09],["c",.57,-.45,1.41,-.84,2.19,-.96],["z"]],w:9.41,h:9.132},s:{d:[["M",4.47,-8.73],["c",.09,0,.36,-.03,.57,-.03],["c",.75,.03,1.29,.24,1.71,.63],["c",.51,.54,.66,1.26,.36,1.83],["c",-.24,.42,-.63,.57,-1.11,.42],["c",-.33,-.09,-.6,-.36,-.6,-.57],["c",0,-.03,.06,-.21,.15,-.39],["c",.12,-.21,.15,-.33,.18,-.48],["c",0,-.24,-.06,-.48,-.15,-.6],["c",-.15,-.21,-.42,-.24,-.75,-.15],["c",-.27,.06,-.48,.18,-.69,.36],["c",-.39,.39,-.51,.96,-.33,1.38],["c",.09,.21,.42,.51,.78,.72],["c",1.11,.69,1.59,1.11,1.89,1.68],["c",.21,.39,.24,.78,.15,1.29],["c",-.18,1.2,-1.17,2.16,-2.52,2.52],["c",-1.02,.24,-1.95,.12,-2.7,-.42],["c",-.72,-.51,-.99,-1.47,-.6,-2.19],["c",.24,-.48,.72,-.63,1.17,-.42],["c",.33,.18,.54,.45,.57,.81],["c",0,.21,-.03,.3,-.33,.51],["c",-.33,.24,-.39,.42,-.27,.69],["c",.06,.15,.21,.27,.45,.33],["c",.3,.09,.87,.09,1.2,0],["c",.75,-.21,1.23,-.72,1.29,-1.35],["c",.03,-.42,-.15,-.81,-.54,-1.2],["c",-.24,-.24,-.48,-.42,-1.41,-1.02],["c",-.69,-.42,-1.05,-.93,-1.05,-1.47],["c",0,-.39,.12,-.87,.3,-1.23],["c",.27,-.57,.78,-1.05,1.38,-1.35],["c",.24,-.12,.63,-.27,.9,-.3],["z"]],w:6.632,h:8.758},z:{d:[["M",2.64,-7.95],["c",.36,-.09,.81,-.03,1.71,.27],["c",.78,.21,.96,.27,1.74,.3],["c",.87,.06,1.02,.03,1.38,-.21],["c",.21,-.15,.33,-.15,.48,-.06],["c",.15,.09,.21,.3,.15,.45],["c",-.03,.06,-1.26,1.26,-2.76,2.67],["l",-2.73,2.55],["l",.54,.03],["c",.54,.03,.72,.03,2.01,.15],["c",.36,.03,.9,.06,1.2,.09],["c",.66,0,.81,-.03,1.02,-.24],["c",.3,-.3,.39,-.72,.27,-1.23],["c",-.06,-.27,-.06,-.27,-.03,-.39],["c",.15,-.3,.54,-.27,.69,.03],["c",.15,.33,.27,1.02,.27,1.5],["c",0,1.47,-1.11,2.7,-2.52,2.79],["c",-.57,.03,-1.02,-.09,-2.01,-.51],["c",-1.02,-.42,-1.23,-.48,-2.13,-.54],["c",-.81,-.06,-.96,-.03,-1.26,.18],["c",-.12,.06,-.24,.12,-.27,.12],["c",-.27,0,-.45,-.3,-.36,-.51],["c",.03,-.06,1.32,-1.32,2.91,-2.79],["l",2.88,-2.73],["c",-.03,0,-.21,.03,-.42,.06],["c",-.21,.03,-.78,.09,-1.23,.12],["c",-1.11,.12,-1.23,.15,-1.95,.27],["c",-.72,.15,-1.17,.18,-1.29,.09],["c",-.27,-.18,-.21,-.75,.12,-1.26],["c",.39,-.6,.93,-1.02,1.59,-1.2],["z"]],w:8.573,h:8.743},"+":{d:[["M",3.48,-9.3],["c",.18,-.09,.36,-.09,.54,0],["c",.18,.09,.24,.15,.33,.3],["l",.06,.15],["l",0,1.29],["l",0,1.29],["l",1.29,0],["c",1.23,0,1.29,0,1.41,.06],["c",.06,.03,.15,.09,.18,.12],["c",.12,.09,.21,.33,.21,.48],["c",0,.15,-.09,.39,-.21,.48],["c",-.03,.03,-.12,.09,-.18,.12],["c",-.12,.06,-.18,.06,-1.41,.06],["l",-1.29,0],["l",0,1.29],["c",0,1.23,0,1.29,-.06,1.41],["c",-.09,.18,-.15,.24,-.3,.33],["c",-.21,.09,-.39,.09,-.57,0],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.06,-.12,-.06,-.18,-.06,-1.41],["l",0,-1.29],["l",-1.29,0],["c",-1.23,0,-1.29,0,-1.41,-.06],["c",-.18,-.09,-.24,-.15,-.33,-.33],["c",-.09,-.18,-.09,-.36,0,-.54],["c",.09,-.18,.15,-.24,.33,-.33],["l",.15,-.06],["l",1.26,0],["l",1.29,0],["l",0,-1.29],["c",0,-1.23,0,-1.29,.06,-1.41],["c",.09,-.18,.15,-.24,.33,-.33],["z"]],w:7.507,h:7.515},",":{d:[["M",1.85,-3.36],["c",.57,-.15,1.17,.03,1.59,.45],["c",.45,.45,.6,.96,.51,1.89],["c",-.09,1.23,-.42,2.46,-.99,3.93],["c",-.3,.72,-.72,1.62,-.78,1.68],["c",-.18,.21,-.51,.18,-.66,-.06],["c",-.03,-.06,-.06,-.15,-.06,-.18],["c",0,-.06,.12,-.33,.24,-.63],["c",.84,-1.8,1.02,-2.61,.69,-3.24],["c",-.12,-.24,-.27,-.36,-.75,-.6],["c",-.36,-.15,-.42,-.21,-.6,-.39],["c",-.69,-.69,-.69,-1.71,0,-2.4],["c",.21,-.21,.51,-.39,.81,-.45],["z"]],w:3.452,h:8.143},"-":{d:[["M",.18,-5.34],["c",.09,-.06,.15,-.06,2.31,-.06],["c",2.46,0,2.37,0,2.46,.21],["c",.12,.21,.03,.42,-.15,.54],["c",-.09,.06,-.15,.06,-2.28,.06],["c",-2.16,0,-2.22,0,-2.31,-.06],["c",-.27,-.15,-.27,-.54,-.03,-.69],["z"]],w:5.001,h:.81},".":{d:[["M",1.32,-3.36],["c",1.05,-.27,2.1,.57,2.1,1.65],["c",0,1.08,-1.05,1.92,-2.1,1.65],["c",-.9,-.21,-1.5,-1.14,-1.26,-2.04],["c",.12,-.63,.63,-1.11,1.26,-1.26],["z"]],w:3.413,h:3.402},"scripts.wedge":{d:[["M",-3.66,-7.44],["c",.06,-.09,0,-.09,.81,.03],["c",1.86,.3,3.84,.3,5.73,0],["c",.78,-.12,.72,-.12,.78,-.03],["c",.15,.15,.12,.24,-.24,.6],["c",-.93,.93,-1.98,2.76,-2.67,4.62],["c",-.3,.78,-.51,1.71,-.51,2.13],["c",0,.15,0,.18,-.06,.27],["c",-.12,.09,-.24,.09,-.36,0],["c",-.06,-.09,-.06,-.12,-.06,-.27],["c",0,-.42,-.21,-1.35,-.51,-2.13],["c",-.69,-1.86,-1.74,-3.69,-2.67,-4.62],["c",-.36,-.36,-.39,-.45,-.24,-.6],["z"]],w:7.49,h:7.752},"scripts.thumb":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.27,1.41,-1.08,2.43,-2.16,2.73],["l",-.18,.06],["l",0,.12],["c",.03,.06,.06,.45,.09,.87],["c",.03,.57,.03,.78,0,.84],["c",-.09,.27,-.39,.48,-.66,.48],["c",-.27,0,-.57,-.21,-.66,-.48],["c",-.03,-.06,-.03,-.27,0,-.84],["c",.03,-.42,.06,-.81,.09,-.87],["l",0,-.12],["l",-.18,-.06],["c",-1.08,-.3,-1.89,-1.32,-2.16,-2.73],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.05,.9],["c",-.15,-.09,-.21,-.09,-.45,-.12],["c",-.15,0,-.3,.03,-.39,.03],["c",-.57,.18,-.9,.72,-1.08,1.74],["c",-.06,.48,-.06,1.8,0,2.28],["c",.15,.9,.42,1.44,.9,1.65],["c",.18,.09,.21,.09,.51,.09],["c",.3,0,.33,0,.51,-.09],["c",.48,-.21,.75,-.75,.9,-1.65],["c",.03,-.27,.03,-.54,.03,-1.14],["c",0,-.6,0,-.87,-.03,-1.14],["c",-.15,-.9,-.45,-1.44,-.9,-1.65],["z"]],w:5.955,h:9.75},"scripts.open":{d:[["M",-.54,-3.69],["c",.15,-.03,.36,-.06,.51,-.06],["c",1.44,0,2.58,1.11,2.94,2.85],["c",.09,.48,.09,1.32,0,1.8],["c",-.33,1.74,-1.47,2.85,-2.91,2.85],["c",-1.44,0,-2.58,-1.11,-2.91,-2.85],["c",-.09,-.48,-.09,-1.32,0,-1.8],["c",.15,-.84,.51,-1.53,1.02,-2.04],["c",.39,-.39,.84,-.63,1.35,-.75],["z"],["m",1.11,.9],["c",-.21,-.09,-.27,-.09,-.51,-.12],["c",-.3,0,-.42,.03,-.66,.15],["c",-.24,.12,-.51,.39,-.66,.63],["c",-.54,.93,-.63,2.64,-.21,3.81],["c",.21,.54,.51,.9,.93,1.11],["c",.21,.09,.24,.09,.54,.09],["c",.3,0,.33,0,.54,-.09],["c",.42,-.21,.72,-.57,.93,-1.11],["c",.36,-.99,.36,-2.37,0,-3.36],["c",-.21,-.54,-.51,-.9,-.9,-1.11],["z"]],w:5.955,h:7.5},"scripts.longphrase":{d:[["M",1.47,-15.09],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.54,.06,11.25],["l",0,11.25],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-3.39,-.03,-11.25],["l",0,-11.25],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:23.04},"scripts.mediumphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.39,.06,7.5],["l",0,7.5],["l",-.63,.15],["c",-.66,.18,-1.44,.39,-1.5,.39],["c",-.03,0,-.03,-2.28,-.03,-7.5],["l",0,-7.5],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:15.54},"scripts.shortphrase":{d:[["M",1.47,-7.59],["c",.36,-.09,.66,-.18,.69,-.18],["c",.06,0,.06,.21,.06,3.75],["l",0,3.75],["l",-.42,.09],["c",-.57,.18,-1.65,.45,-1.71,.45],["c",-.03,0,-.03,-.72,-.03,-3.75],["l",0,-3.75],["l",.36,-.09],["c",.21,-.06,.66,-.18,1.05,-.27],["z"]],w:2.16,h:8.04},"scripts.snap":{d:[["M",4.5,-3.39],["c",.36,-.03,.96,-.03,1.35,0],["c",1.56,.15,3.15,.9,4.2,2.01],["c",.24,.27,.33,.42,.33,.6],["c",0,.27,.03,.24,-2.46,2.22],["c",-1.29,1.02,-2.4,1.86,-2.49,1.92],["c",-.18,.09,-.3,.09,-.48,0],["c",-.09,-.06,-1.2,-.9,-2.49,-1.92],["c",-2.49,-1.98,-2.46,-1.95,-2.46,-2.22],["c",0,-.18,.09,-.33,.33,-.6],["c",1.05,-1.08,2.64,-1.86,4.17,-2.01],["z"],["m",1.29,1.17],["c",-1.47,-.15,-2.97,.3,-4.14,1.2],["l",-.18,.15],["l",.06,.09],["c",.15,.12,3.63,2.85,3.66,2.85],["c",.03,0,3.51,-2.73,3.66,-2.85],["l",.06,-.09],["l",-.18,-.15],["c",-.84,-.66,-1.89,-1.08,-2.94,-1.2],["z"]],w:10.38,h:6.84},"noteheads.slash.whole":{d:[["M",5,-5],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"],["m",0,-2],["l",1,1],["l",-5,5],["l",-1,-1],["z"],["m",-4,6],["l",-5,-5],["l",2,-2],["l",5,5],["z"]],w:10.81,h:15.63},"noteheads.slash.quarter":{d:[["M",9,-6],["l",0,4],["l",-9,9],["l",0,-4],["z"]],w:9,h:9},"noteheads.harmonic.quarter":{d:[["M",3.63,-4.02],["c",.09,-.06,.18,-.09,.24,-.03],["c",.03,.03,.87,.93,1.83,2.01],["c",1.5,1.65,1.8,1.98,1.8,2.04],["c",0,.06,-.3,.39,-1.8,2.04],["c",-.96,1.08,-1.8,1.98,-1.83,2.01],["c",-.06,.06,-.15,.03,-.24,-.03],["c",-.12,-.09,-3.54,-3.84,-3.6,-3.93],["c",-.03,-.03,-.03,-.09,-.03,-.15],["c",.03,-.06,3.45,-3.84,3.63,-3.96],["z"]],w:7.5,h:8.165},"noteheads.triangle.quarter":{d:[["M",0,4],["l",9,0],["l",-4.5,-9],["z"]],w:9,h:9}},i=function(e){for(var t=[],i=0,n=e.length;i<n;i++){t[i]=[];for(var r=0,s=e[i].length;r<s;r++)t[i][r]=e[i][r]}return t};return Kc={printSymbol:function(e,n,r,s,a){if(!t[r])return null;var o=i(t[r].d);o[0][1]+=e,o[0][2]+=n;for(var c="",l=0;l<o.length;l++)c+=o[l].join(" ");return a.path=c,s.path(a)},getPathForSymbol:function(e,n,r,s,a){if(s=s||1,a=a||1,!t[r])return null;var o=i(t[r].d);return 1===s&&1===a||function(e,t,i){for(var n=0,r=e.length;n<r;n++){var s,a,o=e[n];for(s=1,a=o.length;s<a;s++)o[s]*=s%2?t:i}}(o,s,a),o[0][1]+=e,o[0][2]+=n,o},getSymbolWidth:function(e){return t[e]?t[e].w:0},symbolHeightInPitches:function(i){return(t[i]?t[i].h:0)/e.STEP},getSymbolAlign:function(e){return"scripts"===e.substring(0,7)&&"scripts.roll"!==e?"center":"left"},getYCorr:function(e){switch(e){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"flags.d64th":case"scripts.trill":case"scripts.upbow":case"scripts.downbow":return-2;case"timesig.common":case"timesig.cut":default:return 0;case"flags.d32nd":case"rests.half":case"rests.8th":case"rests.quarter":case"rests.16th":case"rests.32nd":case"rests.64th":case"scripts.ufermata":case"scripts.wedge":case"scripts.roll":case"scripts.shortphrase":case"scripts.longphrase":return-1;case"flags.u32nd":case"rests.whole":case"scripts.dfermata":return 1;case"flags.u64th":return 3;case"f":case"m":case"p":case"s":case"z":return-4}},setSymbol:function(e,i){t[e]=i}}}function np(){if(dl)return ul;dl=1;var e=function(e){this.type="TieElem",this.anchor1=e.anchor1,this.anchor2=e.anchor2,e.isGrace&&(this.isGrace=!0),e.fixedY&&(this.fixedY=!0),e.stemDir&&(this.stemDir=e.stemDir),void 0!==e.voiceNumber&&(this.voiceNumber=e.voiceNumber),void 0!==e.style&&(this.dotted=!0),this.internalNotes=[]};return e.prototype.addInternalNote=function(e){this.internalNotes.push(e)},e.prototype.setEndAnchor=function(e){this.anchor2=e,this.anchor1?(this.top=Math.max(this.anchor1.pitch,this.anchor2.pitch)+4,this.bottom=Math.min(this.anchor1.pitch,this.anchor2.pitch)-4):(this.top=this.anchor2.pitch+4,this.bottom=this.anchor2.pitch-4)},e.prototype.setStartX=function(e){this.startLimitX=e},e.prototype.setEndX=function(e){this.endLimitX=e},e.prototype.setHint=function(){this.hint=!0},e.prototype.calcTieDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e;e=this.anchor1?this.anchor1.pitch:this.anchor2?this.anchor2.pitch:14,this.anchor1&&"down"===this.anchor1.stemDir&&this.anchor2&&"down"===this.anchor2.stemDir?this.above=!0:this.anchor1&&"up"===this.anchor1.stemDir&&this.anchor2&&"up"===this.anchor2.stemDir?this.above=!1:this.anchor1&&this.anchor2?this.above=e>=6:this.anchor1?this.above="down"===this.anchor1.stemDir:this.anchor2?this.above="down"===this.anchor2.stemDir:this.above=e>=6}},e.prototype.calcSlurDirection=function(){if(this.isGrace)this.above=!1;else if(0===this.voiceNumber)this.above=!0;else if(this.voiceNumber>0)this.above=!1;else{var e=!1;this.anchor1&&"down"===this.anchor1.stemDir&&(e=!0),this.anchor2&&"down"===this.anchor2.stemDir&&(e=!0);for(var t=0;t<this.internalNotes.length;t++)"down"===this.internalNotes[t].stemDir&&(e=!0);this.above=e}},e.prototype.calcX=function(e,t){this.anchor1?(this.startX=this.anchor1.x,this.anchor1.scalex<1&&(this.startX-=3)):this.startLimitX?this.startX=this.startLimitX.x+this.startLimitX.w:this.anchor2?this.startX=this.anchor2.x-20:this.startX=e,!this.anchor1&&this.dotted&&(this.startX-=3),this.anchor2?this.endX=this.anchor2.x:this.endLimitX?this.endX=this.endLimitX.x:this.endX=t},e.prototype.calcTieY=function(){this.anchor1?this.startY=this.anchor1.pitch:this.anchor2?this.startY=this.anchor2.pitch:this.startY=this.above?14:0,this.anchor2?this.endY=this.anchor2.pitch:this.anchor1?this.endY=this.anchor1.pitch:this.endY=this.above?14:0},e.prototype.calcSlurY=function(){if(this.anchor1&&this.anchor2){this.above&&"up"===this.anchor1.stemDir&&!this.fixedY?(this.startY=(this.anchor1.highestVert+this.anchor1.pitch)/2,this.startX+=this.anchor1.w/2):this.startY=this.anchor1.pitch;var e=this.anchor2.parent.beam&&this.anchor2.parent.beam.stemsUp&&this.anchor2.parent.beam.elems[0]!==this.anchor2.parent,t=(this.anchor2.highestVert+this.anchor2.pitch)/2;if(this.above&&"up"===this.anchor2.stemDir&&!this.fixedY&&!e&&t<this.startY?(this.endY=t,this.endX+=Math.round(this.anchor2.w/2)):this.endY=this.above&&e?this.anchor2.highestVert:this.anchor2.pitch,1===this.anchor1.scalex){var i=!!this.anchor1.parent.beam,n=!!this.anchor2.parent.beam;i&&(this.anchor1.parent===this.anchor1.parent.beam.elems[this.anchor1.parent.beam.elems.length-1]||(this.above?this.startY=this.anchor1.parent.fixed.t:this.startY=this.anchor1.parent.fixed.b)),n&&(this.anchor2.parent===this.anchor2.parent.beam.elems[0]||(this.above?this.endY=this.anchor2.parent.fixed.t:this.endY=this.anchor2.parent.fixed.b))}}else this.anchor1?this.startY=this.endY=this.anchor1.pitch:this.anchor2?this.startY=this.endY=this.anchor2.pitch:(this.startY=this.above?14:0,this.endY=this.above?14:0)},e.prototype.avoidCollisionAbove=function(){if(this.above){for(var e=-50,t=0;t<this.internalNotes.length;t++)this.internalNotes[t].highestVert>e&&(e=this.internalNotes[t].highestVert);e>this.startY&&e>this.endY&&(this.startY=this.endY=e-1)}},e.prototype.getYBounds=function(){var e,t;return this.isTie?(this.calcTieDirection(),this.calcX(10,1e3),this.calcTieY()):(this.calcSlurDirection(),this.calcX(10,1e3),this.calcSlurY()),this.above?e=(t=Math.min(this.startY,this.endY))+3:t=(e=Math.min(this.startY,this.endY))-3,[e,t]},ul=e}function rp(){if(fl)return pl;fl=1;var e=al?sl:(al=1,sl=function(e,t,i){this.type="DynamicDecoration",this.anchor=e,this.dec=t,"below"===i?this.volumeHeightBelow=6:this.volumeHeightAbove=6,this.pitch=void 0}),t=cl?ol:(cl=1,ol=function(e,t,i,n){this.type="CrescendoElem",this.anchor1=e,this.anchor2=t,this.dir=i,"above"===n?this.dynamicHeightAbove=6:this.dynamicHeightBelow=6,this.pitch=void 0}),i=hl?ll:(hl=1,ll=function(e,t){this.type="GlissandoElem",this.anchor1=e,this.anchor2=t}),n=ip(),r=Kd(),s=np(),a=function(){this.startDiminuendoX=void 0,this.startCrescendoX=void 0,this.minTop=12,this.minBottom=0};return a.prototype.dynamicDecoration=function(e,n,r,s){for(var a,o,c,l=0;l<n.length;l++)switch(n[l]){case"diminuendo(":this.startDiminuendoX=r,a=void 0;break;case"diminuendo)":a={start:this.startDiminuendoX,stop:r},this.startDiminuendoX=void 0;break;case"crescendo(":this.startCrescendoX=r,o=void 0;break;case"crescendo)":o={start:this.startCrescendoX,stop:r},this.startCrescendoX=void 0;break;case"~(":case"glissando(":this.startGlissandoX=r,c=void 0;break;case"~)":case"glissando)":c={start:this.startGlissandoX,stop:r},this.startGlissandoX=void 0}a&&e.addOther(new t(a.start,a.stop,">",s)),o&&e.addOther(new t(o.start,o.stop,"<",s)),c&&e.addOther(new i(c.start,c.stop))},a.prototype.createDecoration=function(t,i,a,o,c,l,h,u,d,p,f){d||(d={ornamentPosition:"above",volumePosition:p?"above":"below",dynamicPosition:p?"above":"below"}),function(t,i,n,r){for(var s=0;s<i.length;s++)switch(i[s]){case"p":case"mp":case"pp":case"ppp":case"pppp":case"f":case"ff":case"fff":case"ffff":case"sfz":case"mf":var a=new e(n,i[s],r);t.addOther(a)}}(t,i,c,d.volumePosition),this.dynamicDecoration(t,i,c,d.dynamicPosition),function(e,t,i,s,a){function o(e,t){var o="down"===a?function(){if(0===s.heads.length)return 2;for(var e=s.heads[0].pitch,t=1;t<s.heads.length;t++)e=Math.min(e,s.heads[t].pitch);return e}()+1:function(){if(0===s.heads.length)return 10;for(var e=s.heads[0].pitch,t=1;t<s.heads.length;t++)e=Math.max(e,s.heads[t].pitch);return e}()+9;"down"!==a&&1===t&&o--;var c=i/2;c+="down"===a?-5:3;for(var l=0;l<t;l++)o-=1,s.addFixedX(new r(e,c,n.getSymbolWidth(e),o))}for(var c=0;c<e.length;c++)switch(e[c]){case"/":o("flags.ugrace",1);break;case"//":o("flags.ugrace",2);break;case"///":o("flags.ugrace",3);break;case"////":o("flags.ugrace",4)}}(i,0,o,c,h);var m=function(e,t,i,a,o,c,l,h,u){for(var d,p=0;p<t.length;p++){if("staccato"===t[p]||"tenuto"===t[p]||"accent"===t[p]&&!u){var f="scripts."+t[p];if("accent"===t[p]&&(f="scripts.sforzato"),d=void 0===d?"down"===l?i+2:h-2:"down"===l?d+2:d-2,"accent"===t[p])"up"===l?d--:d++;else switch(d){case 2:case 4:case 6:case 8:case 10:"up"===l?d--:d++}i>9&&d++;var m=a/2;"center"!==n.getSymbolAlign(f)&&(m-=n.getSymbolWidth(f)/2),o.addFixedX(new r(f,m,n.getSymbolWidth(f),d))}if("slide"===t[p]&&o.heads[0]){var g=o.heads[0].pitch,v=new r("",-c-15,0,(g-=2)-1),b=new r("",-c-5,0,g+1);o.addFixedX(v),o.addFixedX(b),e.addOther(new s({anchor1:v,anchor2:b,fixedY:!0}))}}return void 0===d&&(d=i),{above:d,below:o.bottom}}(t,i,a,o,c,l,h,u,f);m.above=Math.max(m.above,this.minTop),m.below=Math.min(m.below,u),function(e,t,i,s,a,o,c,l){function h(e,t){"above"===e?s.above+=t:s.below-=t}function u(e){var t;return"above"===e?(t=s.above)<o&&(t=o):(t=s.below)>c&&(t=c),t}function d(e,n,s){var a=u(n);i.addFixedX(new r(e,t/2,0,a+2,{type:"decoration",klass:"ornament",thickness:3,anchor:s})),h(n,5)}function p(e,s){var a=t/2;"center"!==n.getSymbolAlign(e)&&(a-=n.getSymbolWidth(e)/2);var o=n.symbolHeightInPitches(e)+1,c=u(s);c="above"===s?c+o/2:c-o/2,i.addFixedX(new r(e,a,n.getSymbolWidth(e),c,{klass:"ornament",thickness:n.symbolHeightInPitches(e),position:s})),h(s,o)}for(var f={"+":"scripts.stopped",open:"scripts.open",snap:"scripts.snap",wedge:"scripts.wedge",thumb:"scripts.thumb",shortphrase:"scripts.shortphrase",mediumphrase:"scripts.mediumphrase",longphrase:"scripts.longphrase",trill:"scripts.trill",roll:"scripts.roll",irishroll:"scripts.roll",marcato:"scripts.umarcato",dmarcato:"scripts.dmarcato",umarcato:"scripts.umarcato",turn:"scripts.turn",uppermordent:"scripts.prall",pralltriller:"scripts.prall",mordent:"scripts.mordent",lowermordent:"scripts.mordent",downbow:"scripts.downbow",upbow:"scripts.upbow",fermata:"scripts.ufermata",invertedfermata:"scripts.dfermata",breath:",",coda:"scripts.coda",segno:"scripts.segno"},m=0;m<e.length;m++)switch(e[m]){case"0":case"1":case"2":case"3":case"4":case"5":case"D.C.":case"D.S.":d(e[m],a,"middle");break;case"D.C.alcoda":d("D.C. al coda",a,"end");break;case"D.C.alfine":d("D.C. al fine",a,"end");break;case"D.S.alcoda":d("D.S. al coda",a,"end");break;case"D.S.alfine":d("D.S. al fine",a,"end");break;case"fine":d("FINE",a,"middle");break;case"+":case"open":case"snap":case"wedge":case"thumb":case"shortphrase":case"mediumphrase":case"longphrase":case"trill":case"roll":case"irishroll":case"marcato":case"dmarcato":case"turn":case"uppermordent":case"pralltriller":case"mordent":case"lowermordent":case"downbow":case"upbow":case"fermata":case"breath":case"umarcato":case"coda":case"segno":p(f[e[m]],a);break;case"invertedfermata":p(f[e[m]],"below");break;case"mark":i.klass="mark";break;case"accent":l&&(p("scripts.sforzato",a),!0)}}(i,o,c,m,d.ornamentPosition,this.minTop,u,f),function(e,t,i){for(var s=0;s<e.length;s++)if("arpeggio"===e[s])for(var a=t.abcelem.minpitch-1;a<=t.abcelem.maxpitch;a+=2)t.addExtra(new r("scripts.arpeggio",2*-n.getSymbolWidth("scripts.arpeggio")-i,0,a+2,{klass:"ornament",thickness:n.symbolHeightInPitches("scripts.arpeggio")}))}(i,c,l)},pl=a}function sp(){if(Al)return Pl;Al=1;var e=$d(),t=function(){if(Wc)return Uc;Wc=1;var e=function(e,t,i,n){this.type="BeamElem",this.isflat=!!i,this.isgrace=!(!t||"grace"!==t),this.forceup=!!(this.isgrace||t&&"up"===t),this.forcedown=!(!t||"down"!==t),this.elems=[],this.total=0,this.average=6,this.allrests=!0,this.stemHeight=e,this.beams=[],n&&n.duration?(this.duration=n.duration,n.startTriplet&&(this.duration*=n.tripletMultiplier),this.duration=Math.round(1e3*this.duration)/1e3):this.duration=0};function t(e,t){return t?e/t:0}return e.prototype.setHint=function(){this.hint=!0},e.prototype.runningDirection=function(e){var t=e.averagepitch;void 0!==t&&(this.total=Math.round(this.total+t),this.count||(this.count=0),this.count++)},e.prototype.add=function(e){var t=e.abcelem.averagepitch;void 0!==t&&(e.abcelem.rest||(this.allrests=!1),e.beam=this,this.elems.push(e),this.total=Math.round(this.total+t),(void 0===this.min||e.abcelem.minpitch<this.min)&&(this.min=e.abcelem.minpitch),(void 0===this.max||e.abcelem.maxpitch>this.max)&&(this.max=e.abcelem.maxpitch))},e.prototype.addBeam=function(e){this.beams.push(e)},e.prototype.setStemDirection=function(){this.average=t(this.total,this.count),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6,delete this.count,this.total=0},e.prototype.calcDir=function(){this.average=t(this.total,this.elems.length),this.forceup?this.stemsUp=!0:this.forcedown?this.stemsUp=!1:this.stemsUp=this.average<6;for(var e=this.stemsUp?"up":"down",i=0;i<this.elems.length;i++)for(var n=0;n<this.elems[i].heads.length;n++)this.elems[i].heads[n].stemDir=e},Uc=e}(),i=function(){if($c)return Yc;$c=1;var e=function(e,t){this.startVoice=e,this.type=t};return e.prototype.setBottomStaff=function(e){this.endVoice=e,this.startVoice.header&&!this.endVoice.header&&(this.header=this.startVoice.header,delete this.startVoice.header)},e.prototype.continuing=function(e){this.lastContinuedVoice=e},e.prototype.getWidth=function(){return 10},e.prototype.isStartVoice=function(e){return!!(this.startVoice&&this.startVoice.staff&&this.startVoice.staff.voices.length>0&&this.startVoice.staff.voices[0]===e)},Yc=e}(),n=function(){if(Zc)return Qc;Zc=1;var e=$d(),t=ip(),i=Kd();return Qc=function(n,r){var s,a=0;n.el_type="clef";var o=new e(n,0,10,"staff-extra clef",r);switch(o.isClef=!0,n.type){case"treble":s="clefs.G";break;case"tenor":case"alto":s="clefs.C";break;case"bass":s="clefs.F";break;case"treble+8":s="clefs.G",a=1;break;case"tenor+8":case"alto+8":s="clefs.C",a=1;break;case"bass+8":s="clefs.F",a=1;break;case"treble-8":s="clefs.G",a=-1;break;case"tenor-8":case"alto-8":s="clefs.C",a=-1;break;case"bass-8":s="clefs.F",a=-1;break;case"none":return null;case"perc":s="clefs.perc";break;default:o.addFixed(new i("clef="+n.type,0,0,void 0,{type:"debug"}))}if(s){var c=t.symbolHeightInPitches(s),l=function(e){switch(e){case"clefs.G":return-5;case"clefs.C":case"clefs.F":return-4;case"clefs.perc":return-2;default:return 0}}(s);if(o.addRight(new i(s,5,t.getSymbolWidth(s),n.clefPos,{top:c+n.clefPos+l,bottom:n.clefPos+l})),0!==a){var h=2/3,u=(t.getSymbolWidth(s)-t.getSymbolWidth("8")*h)/2,d=a>0?o.top+3:o.bottom-1,p=a>0?o.top+3:o.bottom-3,f=p-2;"bass-8"===n.type&&(d=3,u=0),o.addRight(new i("8",5+u,t.getSymbolWidth("8")*h,d,{scalex:h,scaley:h,top:p,bottom:f}))}}return o}}(),r=function(){if(el)return Jc;el=1;var e=$d(),t=ip(),i=Kd();return Jc=function(n,r){if(n.el_type="keySignature",!n.accidentals||0===n.accidentals.length)return null;var s=new e(n,0,10,"staff-extra key-signature",r);s.isKeySig=!0;var a=0;return n.accidentals.forEach((function(e){var n,r=0;switch(e.acc){case"sharp":n="accidentals.sharp",r=-3;break;case"natural":n="accidentals.nat";break;case"flat":n="accidentals.flat",r=-1.2;break;case"quartersharp":n="accidentals.halfsharp",r=-2.5;break;case"quarterflat":n="accidentals.halfflat",r=-1.2;break;default:n="accidentals.flat"}s.addRight(new i(n,a,t.getSymbolWidth(n),e.verticalPos,{thickness:t.symbolHeightInPitches(n),top:e.verticalPos+t.symbolHeightInPitches(n)+r,bottom:e.verticalPos+r})),a+=t.getSymbolWidth(n)+2}),this),s}}(),s=function(){if(il)return tl;il=1;var e=ip(),t=Kd();return tl=function(i,n,r,s){s||(s={});var a,o=void 0!==s.dir?s.dir:null,c=void 0!==s.headx?s.headx:0,l=void 0!==s.extrax?s.extrax:0,h=void 0!==s.flag?s.flag:null,u=void 0!==s.dot?s.dot:0,d=void 0!==s.dotshiftx?s.dotshiftx:0,p=void 0!==s.scale?s.scale:1,f=void 0!==s.accidentalSlot?s.accidentalSlot:[],m=void 0!==s.shouldExtendStem&&s.shouldExtendStem,g=void 0===s.printAccidentals||s.printAccidentals,v=r.verticalPos,b=0,y=0,_=0;if(void 0===n)i.addFixed(new t("pitch is undefined",0,0,0,{type:"debug"}));else if(""===n)a=new t(null,0,0,v);else{var w=c;if(r.printer_shift){var x="same"===r.printer_shift?1:0;w="down"===o?-e.getSymbolWidth(n)*p+x:e.getSymbolWidth(n)*p-x}var k={scalex:p,scaley:p,thickness:e.symbolHeightInPitches(n)*p,name:r.name};if((a=new t(n,w,e.getSymbolWidth(n)*p,v,k)).stemDir=o,h){var C=v+("down"===o?-7:7)*p;m&&("down"===o&&C>6&&(C=6),"up"===o&&C<6&&(C=6));var S="down"===o?c:c+a.w-.6;i.addRight(new t(h,S,e.getSymbolWidth(h)*p,C,{scalex:p,scaley:p}))}for(y=a.w+d-2+5*u;u>0;u--){var M=1-Math.abs(v)%2;i.addRight(new t("dots.dot",a.w+d-2+5*u,e.getSymbolWidth("dots.dot"),v+M))}}if(a&&(a.highestVert=r.highestVert),g&&r.accidental){var E;switch(r.accidental){case"quartersharp":E="accidentals.halfsharp";break;case"dblsharp":E="accidentals.dblsharp";break;case"sharp":E="accidentals.sharp";break;case"quarterflat":E="accidentals.halfflat";break;case"flat":E="accidentals.flat";break;case"dblflat":E="accidentals.dblflat";break;case"natural":E="accidentals.nat"}for(var T=!1,P=l,A=0;A<f.length;A++)if(v-f[A][0]>=6){f[A][0]=v,P=f[A][1],T=!0;break}!1===T&&(P-=e.getSymbolWidth(E)*p+2,f.push([v,P]),b=e.getSymbolWidth(E)*p+2);var I=e.symbolHeightInPitches(E);i.addExtra(new t(E,P,e.getSymbolWidth(E),v,{scalex:p,scaley:p,top:v+I/2,bottom:v-I/2})),_=e.getSymbolWidth(E)/2}return{notehead:a,accidentalshiftx:b,dotshiftx:y,extraLeft:_}}}(),a=function(){if(rl)return nl;rl=1;var e=$d(),t=ip(),i=Kd();return nl=function(n,r){n.el_type="timeSignature";var s=new e(n,0,10,"staff-extra time-signature",r);if("specified"===n.type)for(var a=0,o=0;o<n.value.length;o++)if(0!==o&&(s.addRight(new i("+",a+1,t.getSymbolWidth("+"),6,{thickness:t.symbolHeightInPitches("+")})),a+=t.getSymbolWidth("+")+2),n.value[o].den){for(var c=0,l=0;l<n.value[o].num.length;l++)c+=t.getSymbolWidth(n.value[o].num[l]);var h=0;for(l=0;l<n.value[o].num.length;l++)h+=t.getSymbolWidth(n.value[o].den[l]);var u=Math.max(c,h);s.addRight(new i(n.value[o].num,a+(u-c)/2,c,8,{thickness:t.symbolHeightInPitches(n.value[o].num[0])})),s.addRight(new i(n.value[o].den,a+(u-h)/2,h,4,{thickness:t.symbolHeightInPitches(n.value[o].den[0])})),a+=u}else{for(var d=0,p=0;p<n.value[o].num.length;p++)d+=t.getSymbolWidth(n.value[o].num[p]);s.addRight(new i(n.value[o].num,a,d,6,{thickness:t.symbolHeightInPitches(n.value[o].num[0])})),a+=d}else"common_time"===n.type?s.addRight(new i("timesig.common",0,t.getSymbolWidth("timesig.common"),6,{thickness:t.symbolHeightInPitches("timesig.common")})):"cut_time"===n.type?s.addRight(new i("timesig.cut",0,t.getSymbolWidth("timesig.cut"),6,{thickness:t.symbolHeightInPitches("timesig.cut")})):"tempus_imperfectum"===n.type?s.addRight(new i("timesig.imperfectum",0,t.getSymbolWidth("timesig.imperfectum"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum")})):"tempus_imperfectum_prolatio"===n.type?s.addRight(new i("timesig.imperfectum2",0,t.getSymbolWidth("timesig.imperfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.imperfectum2")})):"tempus_perfectum"===n.type?s.addRight(new i("timesig.perfectum",0,t.getSymbolWidth("timesig.perfectum"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum")})):"tempus_perfectum_prolatio"===n.type?s.addRight(new i("timesig.perfectum2",0,t.getSymbolWidth("timesig.perfectum2"),6,{thickness:t.symbolHeightInPitches("timesig.perfectum2")})):console.log("time signature:",n);return s}}(),o=rp(),c=gl?ml:(gl=1,ml=function(e,t,i){this.type="EndingElem",this.text=e,this.anchor1=t,this.anchor2=i,this.endingHeightAbove=5,this.pitch=void 0}),l=ip(),h=Kd(),u=Vd(),d=function(){if(_l)return yl;_l=1;var e=bl?vl:(bl=1,vl=function(e){for(var t=0,i=0;i<e.voices.length;i++){var n=e.voices[i].staff;e.voices[i].duplicate||(t+=n.top,t+=-n.bottom)}return t}),t=function(e){this.getTextSize=e,this.voices=[],this.staffs=[],this.brace=void 0,this.bracket=void 0};return t.prototype.setLimit=function(e,t){t.specialY[e]&&(t.staff.specialY[e]?t.staff.specialY[e]=Math.max(t.staff.specialY[e],t.specialY[e]):t.staff.specialY[e]=t.specialY[e])},t.prototype.addVoice=function(e,t,i){var n=this.voices.length;this.voices[n]=e,this.staffs[t]?this.staffs[t].voices.push(n):this.staffs[this.staffs.length]={top:10,bottom:2,lines:i,voices:[n],specialY:{tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}},e.staff=this.staffs[t]},t.prototype.setHeight=function(){this.height=e(this)},t.prototype.setWidth=function(e){this.w=e;for(var t=0;t<this.voices.length;t++)this.voices[t].setWidth(e)},t.prototype.setStaffLimits=function(e){e.staff.top=Math.max(e.staff.top,e.top),e.staff.bottom=Math.min(e.staff.bottom,e.bottom),this.setLimit("tempoHeightAbove",e),this.setLimit("partHeightAbove",e),this.setLimit("volumeHeightAbove",e),this.setLimit("dynamicHeightAbove",e),this.setLimit("endingHeightAbove",e),this.setLimit("chordHeightAbove",e),this.setLimit("lyricHeightAbove",e),this.setLimit("lyricHeightBelow",e),this.setLimit("chordHeightBelow",e),this.setLimit("volumeHeightBelow",e),this.setLimit("dynamicHeightBelow",e)},yl=t}(),p=function(){if(xl)return wl;xl=1;var e=$d(),t=Kd(),i=function(e,t,i){this.type="TempoElement",this.tempo=e,this.tempo.type="tempo",this.tuneNumber=t,this.totalHeightInPitches=6,this.tempoHeightAbove=this.totalHeightInPitches,this.pitch=void 0,this.tempo.duration&&!this.tempo.suppressBpm&&(this.note=this.createNote(i,e,t))};return i.prototype.setX=function(e){this.x=e},i.prototype.createNote=function(i,n,r){var s,a,o,c=n.duration[0],l=new e(n,c,1,"tempo",r);c<=1/32?(o="noteheads.quarter",a="flags.u32nd",s=0):c<=1/16?(o="noteheads.quarter",a="flags.u16th",s=0):c<=3/32?(o="noteheads.quarter",a="flags.u16nd",s=1):c<=1/8?(o="noteheads.quarter",a="flags.u8th",s=0):c<=3/16?(o="noteheads.quarter",a="flags.u8th",s=1):c<=1/4?(o="noteheads.quarter",s=0):c<=3/8?(o="noteheads.quarter",s=1):c<=.5?(o="noteheads.half",s=0):c<=3/4?(o="noteheads.half",s=1):c<=1?(o="noteheads.whole",s=0):c<=1.5?(o="noteheads.whole",s=1):c<=2?(o="noteheads.dbl",s=0):(o="noteheads.dbl",s=1);var h,u=i(l,o,{verticalPos:0},{dir:"up",flag:a,dot:s,scale:.75}).notehead;if(l.addHead(u),"noteheads.whole"!==o&&"noteheads.dbl"!==o){var d=u.dx+u.w;h=new t(null,d,0,.25,{type:"stem",pitch2:3.75,linewidth:-.6}),l.addRight(h)}return l},wl=i}(),f=np(),m=function(){if(Cl)return kl;Cl=1;var e=function(e,t,i){this.type="TripletElem",this.anchor1=t,this.number=e,this.durationClass=("d"+Math.round(1e3*t.parent.durationClass)/1e3).replace(/\./,"-"),this.middleElems=[],this.flatBeams=i.flatBeams};return e.prototype.isClosed=function(){return!!this.anchor2},e.prototype.middleNote=function(e){this.middleElems.push(e)},e.prototype.setCloseAnchor=function(e){this.anchor2=e,this.anchor1.parent.beam&&"up"!==this.anchor1.stemDir||(this.endingHeightAbove=4)},kl=e}(),g=Gd(),v=function(){if(Tl)return El;Tl=1;var e=Kd(),t=Vd();const i=function(){if(Ml)return Sl;function e(e){switch(e){case"B#":return"H#";case"B♯":return"H♯";case"B":return"H";case"Bb":case"B♭":return"B"}return e}return Ml=1,Sl=function(t,i,n){var r=t.split("\n");for(let s=0;s<r.length;s++){let t=r[s].match(/^([ABCDEFG][♯♭]?)?([^\/]+)?(\/([ABCDEFG][#b♯♭]?))?/);if(!t)continue;let a=t[1]||"",o=t[2]||"",c=t[4]||"";n&&(a=e(a),c=e(c));const l=i?"":"",h=c?"/"+c:"";r[s]=[a,o,h].join(l)}return r.join("\n")}}();function n(n,r,s,a,o,c,l,h,u,d,p,f,m,g,v){for(var b=n.split("\n"),y=b.length-1;y>=0;y--){var _,w=b[y],x=0;a||(w=i(w,g,v));var k=h.calc(w,o,c),C=k.width,S=k.height/t.STEP;switch(r){case"left":x=-(p+=C+7),_=d.averagepitch,u.addExtra(new e(w,x,C+4,_,{type:"text",height:S,dim:l,position:"left"}));break;case"right":x=f+=4,_=d.averagepitch,u.addRight(new e(w,x,C+4,_,{type:"text",height:S,dim:l,position:"right"}));break;case"below":u.addRight(new e(w,0,0,void 0,{type:"text",position:"below",height:S,dim:l,realWidth:C}));break;case"above":u.addRight(new e(w,0,0,void 0,{type:"text",position:"above",height:S,dim:l,realWidth:C}));break;default:if(s){var M=s.y+3*t.STEP;u.addRight(new e(w,x+s.x,0,d.minpitch+M/t.STEP,{position:"relative",type:"text",height:S,dim:l}))}else{var E="above";d.positioning&&d.positioning.chordPosition&&(E=d.positioning.chordPosition),"hidden"!==E&&u.addCentered(new e(w,m/2,C,void 0,{type:"chord",position:E,height:S,dim:l,realWidth:C}))}}}return{roomTaken:p,roomTakenRight:f}}return El=function(e,t,i,r,s,a,o,c){for(var l=0;l<i.chord.length;l++){var h,u,d=i.chord[l].position,p=i.chord[l].rel_position,f="left"===d||"right"===d||"below"===d||"above"===d||!!p;f?(h="annotationfont",u="abcjs-annotation"):(h="gchordfont",u="abcjs-chord");var m,g=e.attr(h,u),v=i.chord[l].name;if("string"==typeof v)r=(m=n(v,d,p,f,h,u,g,e,t,i,r,s,a,o,c)).roomTaken,s=m.roomTakenRight;else for(var b=0;b<v.length;b++)r=(m=n(v[b].text,d,p,f,h,u,g,e,t,i,r,s,a,o,c)).roomTaken,s=m.roomTakenRight}return{roomTaken:r,roomTakenRight:s}}}(),b=Fd(),y=Io(),_=function(e){var t=0;return e.duration&&(t=e.duration),t},w=!1,x={rest:{0:"rests.whole",1:"rests.half",2:"rests.quarter",3:"rests.8th",4:"rests.16th",5:"rests.32nd",6:"rests.64th",7:"rests.128th",multi:"rests.multimeasure"},note:{"-1":"noteheads.dbl",0:"noteheads.whole",1:"noteheads.half",2:"noteheads.quarter",3:"noteheads.quarter",4:"noteheads.quarter",5:"noteheads.quarter",6:"noteheads.quarter",7:"noteheads.quarter",nostem:"noteheads.quarter"},rhythm:{"-1":"noteheads.slash.whole",0:"noteheads.slash.whole",1:"noteheads.slash.whole",2:"noteheads.slash.quarter",3:"noteheads.slash.quarter",4:"noteheads.slash.quarter",5:"noteheads.slash.quarter",6:"noteheads.slash.quarter",7:"noteheads.slash.quarter",nostem:"noteheads.slash.nostem"},x:{"-1":"noteheads.indeterminate",0:"noteheads.indeterminate",1:"noteheads.indeterminate",2:"noteheads.indeterminate",3:"noteheads.indeterminate",4:"noteheads.indeterminate",5:"noteheads.indeterminate",6:"noteheads.indeterminate",7:"noteheads.indeterminate",nostem:"noteheads.indeterminate"},harmonic:{"-1":"noteheads.harmonic.quarter",0:"noteheads.harmonic.quarter",1:"noteheads.harmonic.quarter",2:"noteheads.harmonic.quarter",3:"noteheads.harmonic.quarter",4:"noteheads.harmonic.quarter",5:"noteheads.harmonic.quarter",6:"noteheads.harmonic.quarter",7:"noteheads.harmonic.quarter",nostem:"noteheads.harmonic.quarter"},triangle:{"-1":"noteheads.triangle.quarter",0:"noteheads.triangle.quarter",1:"noteheads.triangle.quarter",2:"noteheads.triangle.quarter",3:"noteheads.triangle.quarter",4:"noteheads.triangle.quarter",5:"noteheads.triangle.quarter",6:"noteheads.triangle.quarter",7:"noteheads.triangle.quarter",nostem:"noteheads.triangle.quarter"},uflags:{3:"flags.u8th",4:"flags.u16th",5:"flags.u32nd",6:"flags.u64th"},dflags:{3:"flags.d8th",4:"flags.d16th",5:"flags.d32nd",6:"flags.d64th"}},k=function(e,t,i){this.decoration=new o,this.getTextSize=e,this.tuneNumber=t,this.isBagpipes=i.bagpipes,this.flatBeams=i.flatbeams,this.graceSlurs=i.graceSlurs,this.percmap=i.percmap,this.initialClef=i.initialClef,this.jazzchords=!!i.jazzchords,this.accentAbove=!!i.accentAbove,this.germanAlphabet=!!i.germanAlphabet,this.reset()};function C(e,t){var i=e[t];if("note"!==i.el_type||!i.startBeam||i.endBeam)return{count:1,elem:i};for(var n=[];t<e.length&&"note"===e[t].el_type&&(n.push(e[t]),!e[t].endBeam);)t++;return{count:n.length,elem:n}}function S(e){if(e.pitches){M(e);for(var t=0,i=0;i<e.pitches.length;i++)t+=e.pitches[i].verticalPos;e.averagepitch=t/e.pitches.length,e.minpitch=e.pitches[0].verticalPos,e.maxpitch=e.pitches[e.pitches.length-1].verticalPos}}k.prototype.reset=function(){this.slurs={},this.ties=[],this.voiceScale=1,this.voiceColor=void 0,this.slursbyvoice={},this.tiesbyvoice={},this.endingsbyvoice={},this.scaleByVoice={},this.colorByVoice={},this.tripletmultiplier=1,this.abcline=void 0,this.accidentalSlot=void 0,this.accidentalshiftx=void 0,this.dotshiftx=void 0,this.hasVocals=!1,this.minY=void 0,this.partstartelem=void 0,this.startlimitelem=void 0,this.stemdir=void 0},k.prototype.setStemHeight=function(e){this.stemHeight=Math.round(10*e/u.STEP)/10},k.prototype.getCurrentVoiceId=function(e,t){return"s"+e+"v"+t},k.prototype.pushCrossLineElems=function(e,t){this.slursbyvoice[this.getCurrentVoiceId(e,t)]=this.slurs,this.tiesbyvoice[this.getCurrentVoiceId(e,t)]=this.ties,this.endingsbyvoice[this.getCurrentVoiceId(e,t)]=this.partstartelem,this.scaleByVoice[this.getCurrentVoiceId(e,t)]=this.voiceScale,this.voiceColor&&(this.colorByVoice[this.getCurrentVoiceId(e,t)]=this.voiceColor)},k.prototype.popCrossLineElems=function(e,t){this.slurs=this.slursbyvoice[this.getCurrentVoiceId(e,t)]||{},this.ties=this.tiesbyvoice[this.getCurrentVoiceId(e,t)]||[],this.partstartelem=this.endingsbyvoice[this.getCurrentVoiceId(e,t)],this.voiceScale=this.scaleByVoice[this.getCurrentVoiceId(e,t)],void 0===this.voiceScale&&(this.voiceScale=1),this.voiceColor=this.colorByVoice[this.getCurrentVoiceId(e,t)]},k.prototype.containsLyrics=function(e){for(var t=0;t<e.length;t++)for(var i=0;i<e[t].voices.length;i++)for(var n=0;n<e[t].voices[i].length;n++){var r=e[t].voices[i][n];if(r.lyric)return void(r.positioning&&"below"!==r.positioning.vocalPosition||(this.hasVocals=!0))}},k.prototype.createABCLine=function(e,t,i){this.minY=2,this.containsLyrics(e);var n=new d(this.getTextSize);this.tempoSet=!1;for(var r=0;r<e.length;r++)w&&this.restoreState(),w=!1,this.createABCStaff(n,e[r],t,r,i);return n},k.prototype.createABCStaff=function(e,t,s,o,c){e.getTextSize.updateFonts(t);for(var l=0;l<t.voices.length;l++){var h=new g(l,t.voices.length);0===l?(h.barfrom="start"===t.connectBarLines||"continue"===t.connectBarLines,h.barto="continue"===t.connectBarLines||"end"===t.connectBarLines):h.duplicate=!0,t.title&&t.title[l]&&(h.header=t.title[l].replace(/\\n/g,"\n"),h.headerPosition=6+e.getTextSize.baselineToCenter(h.header,"voicefont","staff-extra voice-name",l,t.voices.length)/u.STEP),t.clef&&"perc"===t.clef.type&&(h.isPercussion=!0);var d=(!this.initialClef||0===c)&&n(t.clef,this.tuneNumber);d&&(0===l&&t.barNumber&&this.addMeasureNumber(t.barNumber,d),h.addChild(d),this.startlimitelem=d);var p=r(t.key,this.tuneNumber);if(p&&(h.addChild(p),this.startlimitelem=p),t.meter){"specified"===t.meter.type?this.measureLength=t.meter.value[0].num/t.meter.value[0].den:this.measureLength=1;var f=a(t.meter,this.tuneNumber);h.addChild(f),this.startlimitelem=f}h.duplicate&&(h.children=[]);var m=t.clef.stafflines||0===t.clef.stafflines?t.clef.stafflines:5;e.addVoice(h,o,m);var v=1===m;this.createABCVoice(t.voices[l],s,o,l,v,h),e.setStaffLimits(h),0===l&&("start"===t.brace||!e.brace&&t.brace?(e.brace||(e.brace=[]),e.brace.push(new i(h,"brace"))):"end"===t.brace&&e.brace?e.brace[e.brace.length-1].setBottomStaff(h):"continue"===t.brace&&e.brace&&e.brace[e.brace.length-1].continuing(h),"start"===t.bracket||!e.bracket&&t.bracket?(e.bracket||(e.bracket=[]),e.bracket.push(new i(h,"bracket"))):"end"===t.bracket&&e.bracket?e.bracket[e.bracket.length-1].setBottomStaff(h):"continue"===t.bracket&&e.bracket&&e.bracket[e.bracket.length-1].continuing(h))}},k.prototype.createABCVoice=function(t,i,n,r,a,o){this.popCrossLineElems(n,r),this.stemdir=this.isBagpipes?"down":null,this.abcline=t,this.partstartelem&&(this.partstartelem=new c("",null,null),o.addOther(this.partstartelem));var l=o.voicetotal<2?-1:o.voicenumber;for(var h in this.slurs)this.slurs.hasOwnProperty(h)&&(this.slurs[h]=new f({force:this.slurs[h].force,voiceNumber:l,stemDir:this.slurs[h].stemDir,style:this.slurs[h].dotted}),w&&this.slurs[h].setHint(),o.addOther(this.slurs[h]));for(var u=0;u<this.ties.length;u++)this.ties[u]=new f({force:this.ties[u].force,stemDir:this.ties[u].stemDir,voiceNumber:l,style:this.ties[u].dotted}),w&&this.ties[u].setHint(),o.addOther(this.ties[u]);for(var d=0;d<this.abcline.length;d++)S(this.abcline[d]),this.minY=Math.min(this.abcline[d].minpitch,this.minY);for(var m=0===n,g=0;g<this.abcline.length;){var v=C(this.abcline,g),b=this.createABCElement(m,a,o,v.elem);if(b)for(u=0;u<b.length;u++){if(!this.tempoSet&&i&&!i.suppress){this.tempoSet=!0;var y=new e(i,0,0,"tempo",this.tuneNumber,{});y.addFixedX(new p(i,this.tuneNumber,s)),o.addChild(y)}o.addChild(b[u])}g+=v.count}this.pushCrossLineElems(n,r)},k.prototype.saveState=function(){this.tiesSave=y.cloneArray(this.ties),this.slursSave=y.cloneHashOfHash(this.slurs),this.slursbyvoiceSave=y.cloneHashOfHash(this.slursbyvoice),this.tiesbyvoiceSave=y.cloneHashOfArrayOfHash(this.tiesbyvoice)},k.prototype.restoreState=function(){this.ties=y.cloneArray(this.tiesSave),this.slurs=y.cloneHashOfHash(this.slursSave),this.slursbyvoice=y.cloneHashOfHash(this.slursbyvoiceSave),this.tiesbyvoice=y.cloneHashOfArrayOfHash(this.tiesbyvoiceSave)},k.prototype.createABCElement=function(t,i,o,c){var l=[];switch(c.el_type){case void 0:l=this.createBeam(i,o,c);break;case"note":l[0]=this.createNote(c,!1,i,o),this.triplet&&this.triplet.isClosed()&&(o.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1);break;case"bar":l[0]=this.createBarLine(o,c,t),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"meter":l[0]=a(c,this.tuneNumber),this.startlimitelem=l[0],o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"clef":if(l[0]=n(c,this.tuneNumber),!l[0])return null;o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"key":var d=r(c,this.tuneNumber);d&&(l[0]=d,this.startlimitelem=l[0]),o.duplicate&&l.length>0&&(l[0].invisible=!0);break;case"stem":this.stemdir="auto"===c.direction?void 0:c.direction;break;case"part":var f=new e(c,0,0,"part",this.tuneNumber),m=this.getTextSize.calc(c.title,"partsfont","part");f.addFixedX(new h(c.title,0,0,void 0,{type:"part",height:m.height/u.STEP})),l[0]=f;break;case"tempo":var g=new e(c,0,0,"tempo",this.tuneNumber);g.addFixedX(new p(c,this.tuneNumber,s)),l[0]=g;break;case"style":"normal"===c.head?delete this.style:this.style=c.head;break;case"hint":w=!0,this.saveState();break;case"midi":break;case"scale":this.voiceScale=c.size;break;case"color":this.voiceColor=c.color,o.color=this.voiceColor;break;default:var v=new e(c,0,0,"unsupported",this.tuneNumber);v.addFixed(new h("element type "+c.el_type,0,0,void 0,{type:"debug"})),l[0]=v}return l},k.prototype.createBeam=function(e,i,n){var r=[],s=new t(this.stemHeight*this.voiceScale,this.stemdir,this.flatBeams,n[0]);w&&s.setHint();for(var a=0;a<n.length;a++)s.runningDirection(n[a]);s.setStemDirection();var o=this.stemdir;for(this.stemdir=s.stemsUp?"up":"down",a=0;a<n.length;a++){var c=n[a],l=this.createNote(c,!0,e,i);r.push(l),s.add(l),this.triplet&&this.triplet.isClosed()&&(i.addOther(this.triplet),this.triplet=null,this.tripletmultiplier=1)}return s.calcDir(),i.addBeam(s),this.stemdir=o,r};var M=function(e){var t;do{t=!0;for(var i=0;i<e.pitches.length-1;i++)if(e.pitches[i].pitch>e.pitches[i+1].pitch){t=!1;var n=e.pitches[i];e.pitches[i]=e.pitches[i+1],e.pitches[i+1]=n}}while(!t)},E=function(e,t,i,n,r,s,a,o,c){for(var l=i;l>11;l--)l%2!=0||n||e.addFixed(new h(null,o,(r+4)*c,l,{type:"ledger"}));for(l=t;l<1;l++)l%2!=0||n||e.addFixed(new h(null,o,(r+4)*c,l,{type:"ledger"}));for(l=0;l<s.length;l++){var u=r;"down"===a&&(u=-u),e.addFixed(new h(null,u+o,(r+4)*c,s[l],{type:"ledger"}))}};function T(e,t){for(var i=0;i<e.length;i++)if(JSON.stringify(e[i])===JSON.stringify(t))return;e.push(t)}return k.prototype.addGraceNotes=function(e,i,n,r,a,o,c){var u=.6;a=Math.round(.7*a);var d,p,m=null;e.gracenotes.length>1&&(m=new t(a,"grace",o),w&&m.setHint(),m.mainNote=n);var g=[];for(p=e.gracenotes.length-1;p>=0;p--)c+=10,g[p]=c,e.gracenotes[p].accidental&&(c+=7);for(p=0;p<e.gracenotes.length;p++){var v=e.gracenotes[p].verticalPos;d=m?null:x.uflags[o?5:3];var b=s(n,"noteheads.quarter",e.gracenotes[p],{dir:"up",headx:-g[p],extrax:-g[p],flag:d,scale:u*this.voiceScale,accidentalSlot:[]});b.notehead.highestVert=b.notehead.pitch+a;var y=b.notehead;if(this.addSlursAndTies(n,e.gracenotes[p],y,i,"up",!0),n.addExtra(y),e.gracenotes[p].acciaccatura){var _=e.gracenotes[p].verticalPos+4.2,k=m?5:6;n.addRight(new h("flags.ugrace",-g[p]+k,0,_,{scalex:u,scaley:u}))}if(m){var C=e.gracenotes[p].duration/2;o&&(C/=2);var S={heads:[y],abcelem:{averagepitch:v,minpitch:v,maxpitch:v,duration:C}};m.add(S)}else{var M=v+1/3*u,T=v+4.2,P=y.dx+y.w;n.addExtra(new h(null,P,0,M,{type:"stem",pitch2:T,linewidth:-.6}))}E(n,v,v,!1,l.getSymbolWidth("noteheads.quarter"),[],!0,y.dx-1,.6);var A=e.rest&&("spacer"===e.rest.type||"invisible"===e.rest.type);0!==p||o||!this.graceSlurs||A||i.addOther(new f({anchor1:y,anchor2:r,isGrace:!0}))}return m&&(m.calcDir(),i.addBeam(m)),c},k.prototype.addNoteToAbcElement=function(e,t,i,n,r,a,o,c,u){var d,p,f,m,g,v=0,y=0,w=0,k=[],C=[],S=0,M=t.averagepitch>=6?"down":"up";for(n&&(M=n),(r=t.style?t.style:r)&&"normal"!==r||(r="note"),(m=a?x[r].nostem:x[r][-o])||console.log("noteSymbol:",r,o,a),g="down"===M?t.pitches.length-2:1;"down"===M?g>=0:g<t.pitches.length;g="down"===M?g-1:g+1){var E=t.pitches["down"===M?g+1:g-1],P=t.pitches[g],A="down"===M?E.pitch-P.pitch:P.pitch-E.pitch;A<=1&&!E.printer_shift&&(P.printer_shift=A?"different":"same",(P.verticalPos>11||P.verticalPos<1)&&k.push(P.verticalPos-P.verticalPos%2),"down"===M?y=l.getSymbolWidth(m)+2:v=l.getSymbolWidth(m)+2)}var I=t.pitches.length;for(g=0;g<t.pitches.length;g++){var N,L;if(c||(N="down"===M&&0!==g||"up"===M&&g!==I-1?null:x["down"===M?"dflags":"uflags"][-o]),t.pitches[g].style)L=x[t.pitches[g].style][-o];else if(u.isPercussion&&this.percmap){L=m;var O=this.percmap[b(t.pitches[g])];O&&O.noteHead&&x[O.noteHead]&&(L=x[O.noteHead][-o])}else L=m;if(t.pitches[g].highestVert=t.pitches[g].verticalPos,("up"===n||"up"===M)&&0===g||("down"===n||"down"===M)&&g===I-1){if((t.startSlur||1===I)&&(t.pitches[g].highestVert=t.pitches[I-1].verticalPos,_(t)<1&&("up"===n||"up"===M)&&(t.pitches[g].highestVert+=6)),t.startSlur)for(t.pitches[g].startSlur||(t.pitches[g].startSlur=[]),f=0;f<t.startSlur.length;f++)T(t.pitches[g].startSlur,t.startSlur[f]);if(t.endSlur)for(t.pitches[g].highestVert=t.pitches[I-1].verticalPos,_(t)<1&&("up"===n||"up"===M)&&(t.pitches[g].highestVert+=6),t.pitches[g].endSlur||(t.pitches[g].endSlur=[]),f=0;f<t.endSlur.length;f++)T(t.pitches[g].endSlur,t.endSlur[f])}var B=!c&&o<=-1,D=s(e,L,t.pitches[g],{dir:M,extrax:-y,flag:N,dot:i,dotshiftx:v,scale:this.voiceScale,accidentalSlot:C,shouldExtendStem:!n,printAccidentals:!u.isPercussion});S=Math.max(l.getSymbolWidth(L),S),e.extraw-=D.extraLeft,(d=D.notehead)&&(this.addSlursAndTies(e,t.pitches[g],d,u,B?M:null,!1),t.gracenotes&&t.gracenotes.length>0&&(d.bottom=d.bottom-1),e.addHead(d)),y+=D.accidentalshiftx,w=Math.max(w,D.dotshiftx)}if(B){var R=Math.round(70*this.voiceScale)/10,z="down"===M?t.minpitch-R:t.minpitch+1/3;z>6&&!n&&(z=6);var V="down"===M?t.maxpitch-1/3:t.maxpitch+R;V<6&&!n&&(V=6);var q="down"===M||0===e.heads.length?0:e.heads[0].w,F="down"===M?1:-1;d&&"noteheads.slash.quarter"===d.c&&("down"===M?V-=1:z+=1),d&&"noteheads.triangle.quarter"===d.c&&("down"===M?V-=.7:z-=1.2),e.addRight(new h(null,q,0,z,{type:"stem",pitch2:V,linewidth:F,bottom:z-1})),p=Math.min(z,V)}return{noteHead:d,roomTaken:y,roomTakenRight:w,min:p,additionalLedgers:k,dir:M,symbolWidth:S}},k.prototype.addLyric=function(e,t){var i="";t.lyric.forEach((function(e){var t=" "===e.divider?"":e.divider;i+=e.syllable+t+"\n"}));var n=this.getTextSize.calc(i,"vocalfont","lyric"),r=t.positioning?t.positioning.vocalPosition:"below";e.addCentered(new h(i,0,n.width,void 0,{type:"lyric",position:r,height:n.height/u.STEP,dim:this.getTextSize.attr("vocalfont","lyric")}))},k.prototype.createNote=function(t,i,n,r){var a,o=null,c=0,u=0,d=0,p=[],f=_(t),g=!1;0===f&&(g=!0,f=.25,i=!0);for(var b=Math.floor(Math.log(f)/Math.log(2)),y=0,k=Math.pow(2,b),C=k/2;k<f;y++,k+=C,C/=2);t.startTriplet&&(this.tripletmultiplier=t.tripletMultiplier);var S=f*this.tripletmultiplier;t.rest&&"multimeasure"===t.rest.type&&(S=1),t.rest&&"invisible-multimeasure"===t.rest.type&&(S=this.measureLength*t.rest.text);var M=t.rest?"rest":"note",T=new e(t,S,1,M,this.tuneNumber,{durationClassOveride:t.duration*this.tripletmultiplier});if(w&&T.setHint(),t.rest){this.measureLength===f&&"invisible"!==t.rest.type&&"spacer"!==t.rest.type&&t.rest.type.indexOf("multimeasure")<0&&(t.rest.type="whole");var P=function(e,t,i,n,r,a,o,c,u){var d,p,f,m,g=7;switch(r&&("down"===a&&(g=3),"up"===a&&(g=11)),o&&(g=i<.5||i<1?7:5),t.rest.type){case"whole":d=x.rest[0],t.averagepitch=g,t.minpitch=g,t.maxpitch=g,n=0;break;case"rest":d="rhythm"===t.style?x.rhythm[-c]:x.rest[-c],t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"invisible":case"invisible-multimeasure":case"spacer":d="",t.averagepitch=g,t.minpitch=g,t.maxpitch=g;break;case"multimeasure":d=x.rest.multi,t.averagepitch=g,t.minpitch=g,t.maxpitch=g,n=0;var v=l.getSymbolWidth(d);e.addHead(new h(d,v,2*v,7));var b=new h(""+t.rest.text,v,v,16,{type:"multimeasure-text"});e.addExtra(b)}if(t.rest.type.indexOf("multimeasure")<0&&"invisible"!==t.rest.type){var y=s(e,d,{verticalPos:g},{dot:n,scale:u});(p=y.notehead)&&(e.addHead(p),f=y.accidentalshiftx,m=y.dotshiftx)}return{noteHead:p,roomTaken:f,roomTakenRight:m}}(T,t,f,y,r.voicetotal>1,this.stemdir,n,b,this.voiceScale);o=P.noteHead,c=P.roomTaken,u=P.roomTakenRight}else{var A=this.addNoteToAbcElement(T,t,y,this.stemdir,this.style,g,b,i,r);void 0!==A.min&&(this.minY=Math.min(A.min,this.minY)),o=A.noteHead,c=A.roomTaken,u=A.roomTakenRight,p=A.additionalLedgers,a=A.dir,d=A.symbolWidth}if(void 0!==t.lyric&&this.addLyric(T,t),void 0!==t.gracenotes&&(c+=this.addGraceNotes(t,r,T,o,this.stemHeight*this.voiceScale,this.isBagpipes,c)),t.decoration){var I=i&&"up"!==a?Math.min(-3,T.bottom-6):T.bottom;this.decoration.createDecoration(r,t.decoration,T.top,o?o.w:0,T,c,a,I,t.positioning,this.hasVocals,this.accentAbove)}if(t.barNumber&&T.addFixed(new h(t.barNumber,-10,0,0,{type:"barNumber"})),E(T,t.minpitch,t.maxpitch,t.rest,d,p,a,-2,1),void 0!==t.chord){var N=v(this.getTextSize,T,t,c,u,d,this.jazzchords,this.germanAlphabet);c=N.roomTaken,u=N.roomTakenRight}return t.startTriplet&&(this.triplet=new m(t.startTriplet,o,{flatBeams:this.flatBeams})),t.endTriplet&&this.triplet&&this.triplet.setCloseAnchor(o),!this.triplet||t.startTriplet||t.endTriplet||t.rest&&"spacer"===t.rest.type||this.triplet.middleNote(o),T},k.prototype.addSlursAndTies=function(e,t,i,n,r,s){if(t.endTie&&this.ties.length>0){for(var a=!1,o=0;o<this.ties.length;o++)if(this.ties[o].anchor1&&this.ties[o].anchor1.pitch===i.pitch){this.ties[o].setEndAnchor(i),n.setRange(this.ties[o]),this.ties.splice(o,1),a=!0;break}a||(this.ties[0].setEndAnchor(i),n.setRange(this.ties[0]),this.ties.splice(0,1))}var c,l,h=n.voicetotal<2?-1:n.voicenumber;if(t.startTie){var u=new f({anchor1:i,force:"down"===this.stemdir||"up"===this.stemdir,stemDir:this.stemdir,isGrace:s,voiceNumber:h,style:t.startTie.style});w&&u.setHint(),this.ties[this.ties.length]=u,n.addOther(u),e.startTie=!0}if(t.endSlur)for(var d=0;d<t.endSlur.length;d++)l=t.endSlur[d],this.slurs[l]?((c=this.slurs[l]).setEndAnchor(i),n.setRange(c),delete this.slurs[l]):(c=new f({anchor2:i,stemDir:this.stemdir,voiceNumber:h}),w&&c.setHint(),n.addOther(c)),this.startlimitelem&&c.setStartX(this.startlimitelem);else if(!s)for(var p in this.slurs)this.slurs.hasOwnProperty(p)&&this.slurs[p].addInternalNote(i);if(t.startSlur)for(d=0;d<t.startSlur.length;d++)l=t.startSlur[d].label,c=new f({anchor1:i,stemDir:this.stemdir,voiceNumber:h,style:t.startSlur[d].style}),w&&c.setHint(),this.slurs[l]=c,n.addOther(c)},k.prototype.addMeasureNumber=function(e,t){var i=this.getTextSize.calc(e,"measurefont","bar-number"),n=0;t.isClef&&(n+=i.width/2);var r=i.width>10&&"treble"===t.abcelem.type?13.5:11;t.addFixed(new h(e,n,i.width,r+i.height/u.STEP,{type:"barNumber",dim:this.getTextSize.attr("measurefont","bar-number")}))},k.prototype.createBarLine=function(t,i,n){var r=new e(i,0,10,"bar",this.tuneNumber),s=null,a=0;i.barNumber&&this.addMeasureNumber(i.barNumber,r);var o="bar_right_repeat"===i.type||"bar_dbl_repeat"===i.type,l="bar_left_repeat"!==i.type&&"bar_thick_thin"!==i.type&&"bar_invisible"!==i.type,u="bar_right_repeat"===i.type||"bar_dbl_repeat"===i.type||"bar_left_repeat"===i.type||"bar_thin_thick"===i.type||"bar_thick_thin"===i.type,d="bar_left_repeat"===i.type||"bar_thick_thin"===i.type||"bar_thin_thin"===i.type||"bar_dbl_repeat"===i.type,p="bar_left_repeat"===i.type||"bar_dbl_repeat"===i.type;if(o||p){for(var f in this.slurs)this.slurs.hasOwnProperty(f)&&this.slurs[f].setEndX(r);this.startlimitelem=r}if(o&&(r.addRight(new h("dots.dot",a,1,7)),r.addRight(new h("dots.dot",a,1,5)),a+=6),l&&(s=new h(null,a,1,2,{type:"bar",pitch2:10,linewidth:.6}),r.addRight(s)),"bar_invisible"===i.type&&(s=new h(null,a,1,2,{type:"none",pitch2:10,linewidth:.6}),r.addRight(s)),i.decoration&&this.decoration.createDecoration(t,i.decoration,12,u?3:1,r,0,"down",2,i.positioning,this.hasVocals,this.accentAbove),u&&(s=new h(null,a+=4,4,2,{type:"bar",pitch2:10,linewidth:4}),r.addRight(s),a+=5),this.partstartelem&&i.endEnding&&(this.partstartelem.anchor2=s,this.partstartelem=null),d&&(s=new h(null,a+=3,1,2,{type:"bar",pitch2:10,linewidth:.6}),r.addRight(s)),p&&(a+=3,r.addRight(new h("dots.dot",a,1,7)),r.addRight(new h("dots.dot",a,1,5))),i.startEnding&&n){var m=this.getTextSize.calc(i.startEnding,"repeatfont","").width;r.minspacing+=m+10,this.partstartelem=new c(i.startEnding,s,null),t.addOther(this.partstartelem)}return r.extraw-=5,void 0!==i.chord&&v(this.getTextSize,r,i,0,0,0,!1,this.germanAlphabet),r},Pl=k}function ap(){return jl?Fl:(jl=1,Fl=function(e,t,i){if(t.text){t.marginLeft||(t.marginLeft=0),t.klass||(t.klass=""),t.anchor||(t.anchor="start"),t.info||(t.info={startChar:-2,endChar:-2}),t.marginTop&&e.push({move:t.marginTop});var n={left:t.marginLeft,text:t.text,font:t.font,anchor:t.anchor,startChar:t.info.startChar,endChar:t.info.endChar,"dominant-baseline":t["dominant-baseline"]};t.absElemType&&(n.absElemType=t.absElemType),!t.inGroup&&t.klass&&(n.klass=t.klass),t.name&&(n.name=t.name),e.push(n);var r=i.calc("A",t.font,t.klass),s=t.text.split("\n").length;if("\n"===t.text[t.text.length-1]&&s--,!t.noMove){var a=1.1*r.height*s;e.push({move:Math.round(a)}),t.marginBottom&&e.push({move:t.marginBottom})}}})}function op(){if(Gl)return Hl;Gl=1;const e=ap();return Hl=function(t,i,n,r,s,a,o,c){var l=c.calc("i",n,r);if(""===i)t.push({move:l.height});else{if("string"==typeof i)return void e(t,{marginLeft:a,text:i,font:n,klass:r,marginTop:o.marginTop,anchor:o.anchor,absElemType:o.absElemType,info:o.info,name:s},c);o.marginTop&&t.push({move:o.marginTop});var h=0,u={left:a,anchor:o.anchor,phrases:[]};r&&(u.klass=r),t.push(u);for(var d=0;d<i.length;d++){var p=i[d],f=p.font?p.font:c.attr(n,r).font,m={content:p.text};f&&(m.attrs={"font-family":c.getFamily(f.face),"font-size":f.size,"font-weight":f.weight,"font-style":f.style,"font-decoration":f.decoration}),u.phrases.push(m);var g=c.calc(p.text,f,r);h=Math.max(h,g.height)," "===p.text[p.text.length-1]&&l.width}t.push({move:h})}}}function cp(){if(Xl)return Kl;function e(e,t,i,n){if(0===e.indexOf(t)){var r=e.replace(t,""),s=parseInt(r,10);""+s===r&&(i[n]=s)}}return Xl=1,Kl=function(t,i){var n=[];if(t.absEl.elemset){for(var r={},s=0;s<t.absEl.elemset.length;s++){var a=t.absEl.elemset[s];if(a)for(var o=a.getAttribute("class").split(" "),c=0;c<o.length;c++)r[o[c]]=!0}for(var l=0;l<Object.keys(r).length;l++)n.push(Object.keys(r)[l])}for(var h={},u=0;u<n.length;u++)e(n[u],"abcjs-v",h,"voice"),e(n[u],"abcjs-l",h,"line"),e(n[u],"abcjs-m",h,"measure");t.staffPos&&(h.staffPos=t.staffPos);for(var d=i.target;d&&d.dataset&&!d.dataset.name&&"svg"!==d.tagName.toLowerCase();)d=d.parentNode;for(var p=i.target;p&&p.dataset&&!p.dataset.index&&"svg"!==p.tagName.toLowerCase();)p=p.parentNode;return p&&p.dataset&&(h.name=p.dataset.name,h.clickedName=d.dataset.name,h.parentClasses=p.classList),d&&d.classList&&(h.clickedClasses=d.classList),h.selectableElement=t.svgEl,{classes:n,analysis:h}}}function lp(){return eh?Jl:(eh=1,Jl=function(e,t,i,n,r){return t+(n-t)/(i-e)*(r-e)})}function hp(){if(ah)return sh;ah=1;var e=function(){if(ih)return th;ih=1;var e=Kd(),t=Vd(),i=lp(),n=function(e){return void 0===e?0:Math.floor(Math.log(e)/Math.log(2))};function r(e,t,i,n){if(!e.children)return n;for(var r=0;r<e.children.length;r++){var s=e.children[r];t&&void 0!==s.top&&"flags.ugrace"===s.c?n=Math.max(n,s.top-i):t||void 0===s.bottom||"flags.ugrace"!==s.c||(n=Math.max(n,i-s.bottom+7))}return n}function s(e,t,i){var n=t.heads[e?0:t.heads.length-1],r=i.heads[e?0:i.heads.length-1],s=n.x;e&&(s+=n.w-.6);var a=r.x;return[s,a+=e?r.w:.6]}return th=function(a){if(0!==a.elems.length&&!a.allrests){var o=(g=a.stemsUp,v=a.isgrace,b=g?t.STEP:-t.STEP,v&&(b*=.4),b),c=a.elems[0],l=a.elems[a.elems.length-1],h=0,u=a.stemsUp?c.abcelem.maxpitch:c.abcelem.minpitch;h=r(c,a.stemsUp,u,h),h=r(l,a.stemsUp,u,h),h=Math.max(a.stemHeight,h+3);var d=function(e,t,i,n,r,s,a,o,c,l){var h=i-2,u=i-2,d=Math.round(n?Math.max(e+h,c+u):Math.min(e-h,o-u)),p=function(e,t,i,n){if(n)return 0;var r=e-t,s=i/2;return r>s&&(r=s),r<-s&&(r=-s),r}(r,s,t,a),f=d+Math.floor(p/2),m=d+Math.floor(-p/2);return l||(n&&d<6||!n&&d>6)&&(f=6,m=6),[f,m]}(a.average,a.elems.length,h,a.stemsUp,c.abcelem.averagepitch,l.abcelem.averagepitch,a.isflat,a.min,a.max,a.isgrace),p=s(a.stemsUp,c,l);a.addBeam({startX:p[0],endX:p[1],startY:d[0],endY:d[1],dy:o});for(var f=function(e,t,r,a,o){for(var c=[],l=[],h=0;h<e.length;h++){var u=e[h];if(!u.abcelem.rest){var d=u.heads[t?0:u.heads.length-1],p=d.x+(t?d.w:0),f=i(r.startX,r.startY,r.endX,r.endY,p),m=t?-1.5:1.5;a&&(m=2*m/3);var g=u.abcelem.duration;0===g&&(g=.25);for(var v=n(g);v<-3;v++){var b=-4-v;if(l[b]?l[b].single=!1:l[b]={x:p+(t?-.6:0),y:f+m*(b+1),durlog:v,single:!0},h>0&&u.abcelem.beambr&&u.abcelem.beambr<=b+1){l[b].split||(l[b].split=[l[b].x]);var y=s(t,e[h-1],u);l[b].split[l[b].split.length-1]>=y[0]&&(y[0]+=u.w),l[b].split.push(y[0]),l[b].split.push(y[1])}}for(var _=l.length-1;_>=0;_--)if(h===e.length-1||n(e[h+1].abcelem.duration)>-_-4){var w=p,x=f+m*(_+1);l[_].single&&(w=0===h?p+5:p-5,x=i(r.startX,r.startY,r.endX,r.endY,w)+m*(_+1));var k={startX:l[_].x,endX:w,startY:l[_].y,endY:x,dy:o};if(void 0!==l[_].split){var C=l[_].split;k.endX<=C[C.length-1]&&(C[C.length-1]-=u.w),C.push(k.endX),k.split=l[_].split}c.push(k),l=l.slice(0,_)}}}return c}(a.elems,a.stemsUp,a.beams[0],a.isgrace,o),m=0;m<f.length;m++)a.addBeam(f[m]);!function(n,r,s,a,o){for(var c=0;c<n.length;c++){var l=n[c];if(!l.abcelem.rest){var h=!l.addExtra,u=h?o:l,d=l.heads[r?0:l.heads.length-1],p=d.pitch+(r?.2:-.2),f=r?d.w:0;h||(f+=d.dx);var m=d.x+f,g=i(s.startX,s.startY,s.endX,s.endY,m),v=r?-.6:.6;r||(g-=a/2/t.STEP),h&&(f+=l.heads[0].dx),"noteheads.slash.quarter"===d.c&&(r?p+=1:p-=1);var b=new e(null,f,0,p,{type:"stem",pitch2:g,linewidth:v});b.setX(u.x),u.addRight(b)}}}(a.elems,a.stemsUp,a.beams[0],o,a.mainNote)}var g,v,b}}(),t=lp(),i=function(){if(rh)return nh;rh=1;var e=lp();function t(e){return e.stemsUp}return nh=function(i){if(i.anchor1&&i.anchor2){i.hasBeam=!!i.anchor1.parent.beam&&i.anchor1.parent.beam===i.anchor2.parent.beam;var n=i.anchor1.parent.beam;if(!i.hasBeam||n.elems[0]===i.anchor1.parent&&n.elems[n.elems.length-1]===i.anchor2.parent||(i.hasBeam=!1),i.hasBeam){var r=t(n)?i.anchor1.x+i.anchor1.w:i.anchor1.x;i.yTextPos=function(t,i,n){if(0===n.beams.length)return 0;n=n.beams[0];var r=t+(i-t)/2;return e(n.startX,n.startY,n.endX,n.endY,r)}(r,i.anchor2.x,n),i.yTextPos+=t(n)?3:-2,i.xTextPos=(o=r)+(i.anchor2.x-o)/2,i.top=i.yTextPos+1,i.bottom=i.yTextPos-2,t(n)&&(i.endingHeightAbove=4)}else{i.startNote=Math.max(i.anchor1.parent.top,9)+4,i.endNote=Math.max(i.anchor2.parent.top,9)+4,"rest"===i.anchor1.parent.type&&"rest"!==i.anchor2.parent.type?i.startNote=i.endNote:"rest"===i.anchor2.parent.type&&"rest"!==i.anchor1.parent.type&&(i.endNote=i.startNote);for(var s=0,a=0;a<i.middleElems.length;a++)s=Math.max(s,i.middleElems[a].top);((s+=4)>i.startNote||s>i.endNote)&&(i.startNote=s,i.endNote=s),i.flatBeams&&(i.startNote=Math.max(i.startNote,i.endNote),i.endNote=Math.max(i.startNote,i.endNote)),i.yTextPos=i.startNote+(i.endNote-i.startNote)/2,i.xTextPos=i.anchor1.x+(i.anchor2.x+i.anchor2.w-i.anchor1.x)/2,i.top=i.yTextPos+1}}var o;delete i.middleElems,delete i.flatBeams}}();function n(e){for(var t=0;t<e.elems.length;t++){var i=e.elems[t];if(i.top)for(var n=a(i,e),r=0;r<i.children.length;r++){var s=i.children[r];if("ornament"===s.klass&&"below"!==s.position&&s.bottom-1.5<n){var o=n-s.bottom+1.5;s.bottom+=o,s.top+=o,s.pitch+=o,n=i.top=s.top}}}}function r(e,t){var i=t.getChordDim();if(i){for(var n=0;n<e.length;n++)if(e[n]<i.left)return n>0&&t.putChordInLane(n),void(e[n]=i.right);e.push(i.right),t.putChordInLane(e.length-1)}}function s(e){for(var t=0,i=0;i<e.children.length;i++)e.children[i].chordHeightBelow&&t++;return t}function a(e,i){return i=i.beams[0],t(i.startX,i.startY,i.endX,i.endY,e.x)}return sh=function(t){for(var a=0;a<t.beams.length;a++)if("BeamElem"===t.beams[a].type){e(t.beams[a]),n(t.beams[a]);for(var o=0;o<t.beams[a].elems.length;o++)t.adjustRange(t.beams[a].elems[o])}for(t.staff.specialY.chordLines=function(e){var t,i,n,a=[0],o=[0];for(t=0;t<e.length;t++){for(i=0;i<e[t].children.length;i++)(n=e[t].children[i]).chordHeightAbove&&r(a,n);for(i=e[t].children.length-1;i>=0;i--)(n=e[t].children[i]).chordHeightBelow&&r(o,n)}return(a.length>1||o.length>1)&&function(e,t){for(var i=0;i<e.length;i++){s(e[i]);for(var n=0;n<e[i].children.length;n++){var r=e[i].children[n];r.chordHeightAbove&&r.invertLane(t)}}}(e,a.length),{above:a.length,below:o.length}}(t.children),a=0;a<t.otherchildren.length;a++){var c=t.otherchildren[a];"TripletElem"===c.type&&(i(c),t.adjustRange(c))}t.staff.top=Math.max(t.staff.top,t.top),t.staff.bottom=Math.min(t.staff.bottom,t.bottom)}}function up(){if(fh)return ph;function e(e,t,i){if(t)for(var n=0;n<t.length;n++)if(t[n].header){var r=i.calc(t[n].header,"voicefont","");e=Math.max(e,r.width)}return e}function t(e,t,n){if(e)for(var r=0;r<e.length;r++)i(t,e[r]),n=Math.max(n,e[r].getWidth());return n}function i(e,t){t.x=e}return fh=1,ph=function(i,n,r,s,a){var o,c,l=i.padding.left,h=0;for(o=0;o<r.length;o++)r[o].header&&(c=n.calc(r[o].header,"voicefont",""),h=Math.max(h,c.width));h=e(h,s,n),(h=e(h,a,n))&&(h+=n.calc("A","voicefont","").width);var u=0;return u=t(s,l+=h,u),l+t(a,l,u)}}function dp(){if(bh)return vh;bh=1;var e=hp(),t=function(){if(ch)return oh;ch=1;var e=Vd();function t(e,t,i,n){if(e.specialY[i]){var r=e.specialY[i];n&&(r*=n),e.top+=r+1,t[i]=e.top}}function i(e,t,i){var o,c;for(o=0;o<t.children.length;o++)n(e,c=t.children[o],i);for(o=0;o<t.otherchildren.length;o++)switch((c=t.otherchildren[o]).type){case"CrescendoElem":r(e,c);break;case"DynamicDecoration":s(e,c);break;case"EndingElem":a(e,c);break;case"TieElem":var l=c.getYBounds();t.staff.top=Math.max(t.staff.top,l[0]),t.staff.top=Math.max(t.staff.top,l[1]),t.staff.bottom=Math.min(t.staff.bottom,l[0]),t.staff.bottom=Math.min(t.staff.bottom,l[1])}}function n(e,t,i){for(var n=0;n<t.children.length;n++){var r=t.children[n];for(var s in t.specialY)t.specialY.hasOwnProperty(s)&&r[s]&&(r.pitch=e[s],void 0===r.top&&("TempoElement"===r.type?o(e,r):c(e,r,i),t.pushTop(r.top),t.pushBottom(r.bottom)))}}function r(e,t){t.dynamicHeightAbove?t.pitch=e.dynamicHeightAbove:t.pitch=e.dynamicHeightBelow}function s(e,t){t.volumeHeightAbove?t.pitch=e.volumeHeightAbove:t.pitch=e.volumeHeightBelow}function a(e,t){t.pitch=e.endingHeightAbove-2}function o(e,t){if(t.pitch=e.tempoHeightAbove,t.top=e.tempoHeightAbove,t.bottom=e.tempoHeightAbove,t.note){var i=t.pitch-t.totalHeightInPitches+1;t.note.top=i,t.note.bottom=i;for(var n=0;n<t.note.children.length;n++){var r=t.note.children[n];r.top+=i,r.bottom+=i,r.pitch+=i,void 0!==r.pitch2&&(r.pitch2+=i)}}}function c(t,i,n){switch(i.type){case"part":i.top=t.partHeightAbove+i.height,i.bottom=t.partHeightAbove;break;case"text":case"chord":i.chordHeightAbove?(i.top=t.chordHeightAbove,i.bottom=t.chordHeightAbove):(i.top=t.chordHeightBelow,i.bottom=t.chordHeightBelow);break;case"lyric":i.lyricHeightAbove?(i.top=t.lyricHeightAbove,i.bottom=t.lyricHeightAbove):(i.top=t.lyricHeightBelow+n.vocal/e.STEP,i.bottom=t.lyricHeightBelow+n.vocal/e.STEP,i.pitch-=n.vocal/e.STEP);break;case"debug":i.top=t.chordHeightAbove,i.bottom=t.chordHeightAbove}void 0!==i.pitch&&void 0!==i.top||console.error("RelativeElement position not set.",i.type,i.pitch,i.top,t)}return oh=function(n,r){for(var s,a=0;a<r.staffs.length;a++){var o=r.staffs[a],c={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0};if(n.showDebug&&n.showDebug.indexOf("box")>=0&&(o.originalTop=o.top,o.originalBottom=o.bottom),t(o,c,"lyricHeightAbove"),t(o,c,"chordHeightAbove",o.specialY.chordLines.above),o.specialY.endingHeightAbove&&(o.specialY.chordHeightAbove?o.top+=2:o.top+=o.specialY.endingHeightAbove+1,c.endingHeightAbove=o.top),o.specialY.dynamicHeightAbove&&o.specialY.volumeHeightAbove?(o.top+=Math.max(o.specialY.dynamicHeightAbove,o.specialY.volumeHeightAbove)+1,c.dynamicHeightAbove=o.top,c.volumeHeightAbove=o.top):(t(o,c,"dynamicHeightAbove"),t(o,c,"volumeHeightAbove")),t(o,c,"partHeightAbove"),t(o,c,"tempoHeightAbove"),o.specialY.lyricHeightBelow&&(o.specialY.lyricHeightBelow+=n.spacing.vocal/e.STEP,c.lyricHeightBelow=o.bottom,o.bottom-=o.specialY.lyricHeightBelow+1),o.specialY.chordHeightBelow){c.chordHeightBelow=o.bottom;var l=o.specialY.chordHeightBelow;o.specialY.chordLines.below&&(l*=o.specialY.chordLines.below),o.bottom-=l+1}o.specialY.volumeHeightBelow&&o.specialY.dynamicHeightBelow?(c.volumeHeightBelow=o.bottom,c.dynamicHeightBelow=o.bottom,o.bottom-=Math.max(o.specialY.volumeHeightBelow,o.specialY.dynamicHeightBelow)+1):o.specialY.volumeHeightBelow?(c.volumeHeightBelow=o.bottom,o.bottom-=o.specialY.volumeHeightBelow+1):o.specialY.dynamicHeightBelow&&(c.dynamicHeightBelow=o.bottom,o.bottom-=o.specialY.dynamicHeightBelow+1),n.showDebug&&n.showDebug.indexOf("box")>=0&&(o.positionY=c);for(var h=0;h<o.voices.length;h++)i(c,r.voices[o.voices[h]],n.spacing);if(void 0!==s){var u=s+(o.top-10),d=n.spacing.systemStaffSeparation/e.STEP-u;d>0&&(o.top+=d)}o.top+=n.spacing.staffTopMargin/e.STEP,s=2-o.bottom}}}(),i=function(){if(dh)return uh;dh=1;var e=function(){if(hh)return lh;hh=1;var e=function(){};return e.beginLayout=function(e,t){t.i=0,t.durationindex=0,t.startx=e,t.minx=e,t.nextx=e,t.spacingduration=0},e.layoutEnded=function(e){return e.i>=e.children.length},e.getNextX=function(e){return Math.max(e.minx,e.nextx)},e.getSpacingUnits=function(e){return Math.sqrt(8*e.spacingduration)},e.layoutOneItem=function(e,t,i,n,r){var s=i.children[i.i];if(!s)return 0;var a=e-i.minx,o=i.durationindex+s.duration>0?n:0;if("note"===s.abcelem.el_type&&!s.abcelem.rest&&0!==i.voicenumber&&r){var c=r.children[r.i],l=c&&(s.abcelem.maxpitch<=c.abcelem.maxpitch+1&&s.abcelem.maxpitch>=c.abcelem.minpitch-1||s.abcelem.minpitch<=c.abcelem.maxpitch+1&&s.abcelem.minpitch>=c.abcelem.minpitch-1);if(l&&s.abcelem.minpitch===c.abcelem.minpitch&&s.abcelem.maxpitch===c.abcelem.maxpitch&&c.heads&&c.heads.length>0&&s.heads&&s.heads.length>0&&c.heads[0].c===s.heads[0].c&&(l=!1),l){var h=c.heads&&c.heads.length>0?c.heads[0].realWidth:c.fixed.w;s.adjustedWidth||(s.adjustedWidth=h+s.w),s.w=s.adjustedWidth;for(var u=0;u<s.children.length;u++){var d=s.children[u];d.name.indexOf("accidental")<0&&(d.adjustedWidth||(d.adjustedWidth=d.dx+h),d.dx=d.adjustedWidth)}}}var p,f,m,g=(f=o,m=0,"note"!==(p=s).type&&"bar"!==p.type||(m=f),-p.extraw+m);return a<g&&(0===i.i||"bar"!==s.type||"part"!==i.children[i.i-1].type&&"tempo"!==i.children[i.i-1].type)&&(e+=g-a),s.setX(e),i.spacingduration=s.duration,i.minx=e+function(e){return e.w}(s),i.i!==i.children.length-1&&(i.minx+=s.minspacing),this.updateNextX(e,t,i),e},e.shiftRight=function(e,t){var i=t.children[t.i];i&&(i.setX(i.x+e),t.minx+=e,t.nextx+=e)},e.updateNextX=function(e,t,i){i.nextx=e+t*this.getSpacingUnits(i)},e.updateIndices=function(e){this.layoutEnded(e)||(e.durationindex+=e.children[e.i].duration,"bar"===e.children[e.i].type&&(e.durationindex=Math.round(64*e.durationindex)/64),e.i++)},lh=e}();function t(t){for(var i=0;i<t.length;i++)if(!e.layoutEnded(t[i]))return!1;return!0}function i(e){return e.durationindex-(e.children[e.i]&&e.children[e.i].duration>0?0:5e-7)}return uh=function(n,r,s,a,o){var c,l=0,h=1e3,u=o;a.startx=u;var d,p,f=0;for(s&&console.log("init layout",n),c=0;c<a.voices.length;c++)e.beginLayout(u,a.voices[c]);for(var m=0;!t(a.voices);){for(f=null,c=0;c<a.voices.length;c++)e.layoutEnded(a.voices[c])||f&&!(i(a.voices[c])<f)||(f=i(a.voices[c]));var g=[],v=[];for(c=0;c<a.voices.length;c++)i(a.voices[c])-f>1e-7?v.push(a.voices[c]):g.push(a.voices[c]);m=0;var b=0;for(c=0;c<g.length;c++)e.getNextX(g[c])>u&&(u=e.getNextX(g[c]),m=e.getSpacingUnits(g[c]),b=g[c].spacingduration);l+=m,h=Math.min(h,m),s&&console.log("currentduration: ",f,l,h);var y=void 0;for(c=0;c<g.length;c++){var _=g[c];0===_.voicenumber&&(y=c);var w=void 0!==y&&g[y].voicenumber!==_.voicenumber?g[y]:void 0;p=w,(d=_)&&d.staff&&d.staff.voices&&0!==d.staff.voices.length&&p&&p.staff&&p.staff.voices&&0!==p.staff.voices.length&&d.staff.voices[0]===p.staff.voices[0]||(w=void 0);var x=e.layoutOneItem(u,n,_,r,w),k=x-u;if(k>0){u=x;for(var C=0;C<c;C++)e.shiftRight(k,g[C])}}for(c=0;c<v.length;c++)v[c].spacingduration-=b,e.updateNextX(u,n,v[c]);for(c=0;c<g.length;c++){var S=g[c];e.updateIndices(S)}}for(c=0;c<a.voices.length;c++)e.getNextX(a.voices[c])>u&&(u=e.getNextX(a.voices[c]),m=e.getSpacingUnits(a.voices[c]));return function(e){for(var t=0,i=0;i<e.length;i++){var n=e[i];if(n.children.length>0){var r=n.children.length-1,s=n.children[r];if("bar"===s.abcelem.el_type){var a=s.children[0].x;a>t?t=a:s.children[0].x=t}}}}(a.voices),l+=m,a.setWidth(u),{spacingUnits:l,minSpace:h}}}(),n=up(),r=function(){if(gh)return mh;gh=1;var e=up();return mh=function(t,i,n){var r=e(t,i.getTextSize,i.voices,i.brace,i.bracket),s=function(e,t){for(var i=0,n=0,r=0;r<e.voices.length;r++){for(var s=0,a=e.voices[r],o=0;o<a.children.length;o++){var c=a.children[o];if(s+=c.duration,c.duration){var l=(c.w+t)/c.duration;i=Math.max(i,l)}}n=Math.max(n,s)}return{totalDuration:n,minSpacing:i}}(i,n.minPadding),a=s.totalDuration,o=s.minSpacing*a;n.minWidth&&(o=Math.max(o,n.minWidth));var c=n.minPadding?n.minPadding/2:2;i.startx=r,i.w=o+r;for(var l=0;l<i.voices.length;l++){var h=i.voices[l];h.startx=r,h.w=o+r;for(var u=r,d=!1,p=0,f=0;f<h.children.length;f++){var m=h.children[f];d||(0!==m.duration?(d=!0,p=(o+r-u)/a,i.gridStart=u):(m.x=u,u+=m.w+m.minspacing)),d&&("center"===n.align?m.x=u+m.duration*p/2-m.w/2:0===m.duration?m.x=u+1-m.w:m.x=u+c-m.extraw,u+=m.duration*p);for(var g=0;g<m.children.length;g++){var v=m.children[g],b=v.dx?v.dx:0;v.x=m.x+b}}i.gridEnd=u}return o}}(),s=function(e,t,r,s,o,c,l){for(var h=n(e,s.getTextSize,s.voices,s.brace,s.bracket),u=r,d=0;d<8;d++){var p=i(u,e.minPadding,l,s,h);if(null===(u=a(c,o.stretchlast,t+e.padding.left,s.w,u,p.spacingUnits,p.minSpace,e.padding.left+e.padding.right)))break}return function(e){for(var t=0;t<e.length;t++)for(var i=e[t],n=1;n<i.children.length-1;n++){var r=i.children[n];if(r.abcelem.rest&&("whole"===r.abcelem.rest.type||"multimeasure"===r.abcelem.rest.type)){var s=i.children[n-1],a=i.children[n+1];r.center(s,a)}}}(s.voices),s.w-h};function a(e,t,i,n,r,s,a,o){if(e)if(void 0===t){if(n/i<.66)return null}else if(!(1-(n+o)/i<t))return null;return Math.abs(i-n)<2?null:s>0?((r=(i-(n-s*r))/s)*a>50&&(r=50/a),r):null}return vh=function(i,n,a,o,c,l){var h,u,d=a;for(h=0;h<n.lines.length;h++){var p;(u=n.lines[h]).staff&&(p=void 0!==l?r(i,u.staffGroup,l):s(i,d,o,u.staffGroup,n.formatting,h===n.lines.length-1,!1),Math.round(p)>Math.round(d)&&(d=p,c&&(h=-1)))}for(h=0;h<n.lines.length;h++)if((u=n.lines[h]).staffGroup&&u.staffGroup.voices){for(var f=0;f<u.staffGroup.voices.length;f++)e(u.staffGroup.voices[f]);t(i,u.staffGroup)}for(h=0;h<n.lines.length;h++)(u=n.lines[h]).staffGroup&&u.staffGroup.setHeight();return d}}function pp(){return Mh||(Mh=1,Sh=function(){for(var e,t,i,n,r,s=0,a=arguments[s++],o=[];a;){if(t=/^[^\x25]+/.exec(a))o.push(t[0]);else if(t=/^\x25{2}/.exec(a))o.push("%");else{if(!(t=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a)))throw"Huh ?!";if(null==(e=arguments[t[1]||s++])||null==e)throw"Too few arguments.";if(/[^s]/.test(t[7])&&"number"!=typeof e)throw"Expecting number but found "+typeof e;switch(t[7]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e);break;case"e":e=t[6]?e.toExponential(t[6]):e.toExponential();break;case"f":e=t[6]?parseFloat(e).toFixed(t[6]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&t[6]?e.substring(0,t[6]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(t[7])&&t[2]&&e>0?"+"+e:e,n=t[3]?"0"==t[3]?"0":t[3][1]:" ",r=t[5]-String(e).length,i=t[5]?str_repeat(n,r):"",o.push(t[4]?e+i:i+e)}a=a.substring(t[0].length)}return o.join("")}),Sh}function fp(){return Th?Eh:(Th=1,Eh=function(e){return parseFloat(e.toFixed(2))})}function mp(){if(Ah)return Ph;Ah=1;var e=fp();return Ph=function(t,i,n){var r,s=i.y;if(i.phrases)return t.paper.richTextLine(i.phrases,i.x,i.y,i.klass,i.anchor);if(i.lane){var a=.25*i.dim.font.size;s+=(i.dim.font.size+a)*i.lane}i.dim?(r=i.dim).attr.class=i.klass:r=t.controller.getFontAndAttr.calc(i.type,i.klass),i.anchor&&(r.attr["text-anchor"]=i.anchor),i["dominant-baseline"]&&(r.attr["dominant-baseline"]=i["dominant-baseline"]),r.attr.x=i.x,r.attr.y=s,i.centerVertically||(r.attr.y+=r.font.size),"debugfont"===i.type&&(console.log("Debug msg: "+i.text),r.attr.stroke="#ff0000"),i.cursor&&(r.attr.cursor=i.cursor);var o=i.text.replace(/\n\n/g,"\n \n");o=o.replace(/^\n/," \n"),r.font.box&&(n||t.paper.openGroup({klass:r.attr.class,fill:t.foregroundColor,"data-name":i.name}),"end"===r.attr["text-anchor"]?r.attr.x-=r.font.padding:"start"===r.attr["text-anchor"]&&(r.attr.x+=r.font.padding),r.attr.y+=r.font.padding,delete r.attr.class),i.noClass&&delete r.attr.class,r.attr.x=e(r.attr.x),r.attr.y=e(r.attr.y),i.name&&(r.attr["data-name"]=i.name);var c=t.paper.text(o,r.attr);if(r.font.box){var l=c.getBBox(),h=0;"middle"===r.attr["text-anchor"]?h=l.width/2+r.font.padding:"end"===r.attr["text-anchor"]&&(h=l.width+2*r.font.padding);var u=0;i.centerVertically&&(u=l.height-r.font.padding),t.paper.rect({"data-name":"box",x:Math.round(i.x-h),y:Math.round(s-u),width:Math.round(l.width+2*r.font.padding),height:Math.round(l.height+2*r.font.padding)}),n||(c=t.paper.closeGroup())}return c}}function gp(){if(Nh)return Ih;Nh=1;var e=pp(),t=Vd(),i=mp();function n(t,i,n,r){return e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",t+n[0],i+r[0],t+n[1],i+r[1],t+n[2],i+r[2],t+n[3],i+r[3],t+n[4],i+r[4],t+n[5],i+r[5],t+n[6],i+r[6])}return Ih=function(r,s,a){var o=s.startVoice.staff.absoluteY-10*t.STEP;return s.endVoice&&s.endVoice.staff?s.endY=s.endVoice.staff.absoluteY-2*t.STEP:s.lastContinuedVoice&&s.lastContinuedVoice.staff?s.endY=s.lastContinuedVoice.staff.absoluteY-2*t.STEP:s.endY=s.startVoice.staff.absoluteY-2*t.STEP,function(r,s,a,o,c,l,h){var u,d,p,f,m,g,v;if(l){r.paper.openGroup({klass:r.controller.classes.generate("staff-extra voice-name"),"data-name":c});var b=a+(o-a)/2;b-=r.controller.getTextSize.baselineToCenter(l,"voicefont","staff-extra voice-name",0,1),i(r,{x:r.padding.left,y:b,text:l,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0})}return"brace"===c?(d=r,m=c,v=n(p=s,f=a,[7.5,-8,21,0,18.5,-10.5,7.5],[0,(g=o-f)/5.5,g/3.14,g/2,g/2.93,g/4.88,0]),v+=n(p,f,[0,17.5,-7.5,6.6,-5,20,0],[g/2,g/1.46,g/1.22,g,g/1.19,g/1.42,g/2]),u=d.paper.path({path:v,stroke:d.foregroundColor,fill:d.foregroundColor,class:d.controller.classes.generate(m),"data-name":m})):"bracket"===c&&(u=function(i,n,r,s,a){n+=t.STEP;var o=.75*t.STEP,c=.75*t.STEP,l=s-r,h=e("M %f %f l %f %f l %f %f l %f %f z",n,r-c,0,l+2*c,o,0,0,-(l+2*c)),u=2*t.STEP,d=t.STEP;return h+=e("M %f %f q %f %f %f %f q %f %f %f %f z",n+o,r-c,.6*u,.2*d,u,-d,.1*-u,.3*d,-u,d+t.STEP),h+=e("M %f %f q %f %f %f %f q %f %f %f %f z",n+o,r+c+l,.6*u,.2*-d,u,d,.1*-u,.3*-d,-u,-d-t.STEP),i.paper.path({path:h,stroke:i.foregroundColor,fill:i.foregroundColor,class:i.controller.classes.generate(a),"data-name":a})}(r,s,a,o,c)),l&&(u=r.paper.closeGroup()),h.wrapSvgEl({el_type:c,startChar:-1,endChar:-1},u),u}(r,s.x,o,s.endY,s.type,s.header,a)}}function vp(){return Oh?Lh:(Oh=1,Lh=function(e,t,i){return e.paper.path(t)})}function bp(){if(Dh)return Bh;Dh=1;var e=pp(),t=vp(),i=fp();function n(e,t,n){return i(e+n*t)}var r=[[3.5,-4.8]],s=[[1.5,-1],[.3,-.3],[-3.5,3.8]],a=[[-1.5,2]],o=[[3,4],[3,-4]],c=[[-3,4],[-3,-4]];function l(e,t){for(var i="",r=0;r<e.length;r++)i+="l"+e[r][0]+" "+n(e[r][1],t,e[r][0]);return i}return Bh=function(i,h,u){h.anchor1&&h.anchor2&&h.anchor1.heads&&h.anchor2.heads&&0!==h.anchor1.heads.length&&0!==h.anchor2.heads.length||window.console.error("Glissando Element not set.");var d,p,f=i.calcY(h.anchor1.heads[0].pitch),m=i.calcY(h.anchor2.heads[0].pitch),g=h.anchor1.x+h.anchor1.w/2,v=h.anchor2.x+h.anchor2.w/2,b=(d=v-g,p=m-f,Math.sqrt(d*d+p*p)),y=h.anchor1.w/2+4,_=h.anchor2.w/2+4,w=function(e,t,i,n){return(n-t)/(i-e)}(g,f,v,m),x=n(f,w,y);n(m,w,-_);var k,C=function(i,n,h,u,d){var p,f=e("M %f %f",n,h);for(f+=l(r,d),p=0;p<u;p++)f+=l(o,d);for(f+=l(s,d),p=0;p<u;p++)f+=l(c,d);return f+=l(a,d)+"z",t(i,{path:f,highlight:"stroke",stroke:i.foregroundColor,class:i.controller.classes.generate("decoration"),"data-name":"glissando"})}(i,g+y,x,(k=b-y-_,Math.max(2,Math.floor((k-10)/6))),w);return u.wrapSvgEl({el_type:"glissando",startChar:-1,endChar:-1},C),[C]}}function yp(){if(qh)return Vh;qh=1;var e=fp();function t(){this.ingroup=!1}t.prototype.beginGroup=function(e,t){this.paper=e,this.controller=t,this.path=[],this.lastM=[0,0],this.ingroup=!0,this.paper.openGroup()},t.prototype.isInGroup=function(){return this.ingroup},t.prototype.addPath=function(t){if(0!==(t=t||[]).length){t[0][0]="m",t[0][1]=e(t[0][1]-this.lastM[0]),t[0][2]=e(t[0][2]-this.lastM[1]),this.lastM[0]+=t[0][1],this.lastM[1]+=t[0][2],this.path.push(t[0]);for(var i=1,n=t.length;i<n;i++)"m"===t[i][0]&&(this.lastM[0]+=t[i][1],this.lastM[1]+=t[i][2]),this.path.push(t[i])}},t.prototype.endGroup=function(e,t){this.ingroup=!1;for(var i=0;i<this.path.length;i++)this.path[i].join(" ");this.path=[];var n=this.paper.closeGroup();return n&&(n.setAttribute("class",this.controller.classes.generate(e)),n.setAttribute("fill",this.controller.renderer.foregroundColor),n.setAttribute("stroke","none"),n.setAttribute("data-name",t)),n};var i=new t;return Vh=i}function _p(){if(jh)return Fh;jh=1;var e=mp(),t=ip(),i=yp();return Fh=function(n,r,s,a,o){var c,l,h,u,d,p;if(!a)return null;if(a.length>1&&a.indexOf(".")<0){var f=i.isInGroup()?"":o.klass;n.paper.openGroup({"data-name":o.name,klass:f});for(var m=0,g=0;g<a.length;g++){var v=a[g];l=t.getYCorr(v),(c=t.printSymbol(r+m,n.calcY(s+l),v,n.paper,{stroke:o.stroke,fill:o.fill}))?g<a.length-1&&(m+=(h=v,u=a[g+1],d=t.getSymbolWidth(v),p=void 0,p=d,"f"===h&&"f"===u&&(p=2*p/3),"p"===h&&"p"===u&&(p=5*p/6),"f"===h&&"z"===u&&(p=5*p/8),p)):e(n,{x:r,y:n.y,text:"no symbol:"+a,type:"debugfont",klass:"debug-msg",anchor:"start"},!1)}return n.paper.closeGroup()}return l=t.getYCorr(a),(c=i.isInGroup()?t.printSymbol(r,n.calcY(s+l),a,n.paper,{"data-name":o.name}):t.printSymbol(r,n.calcY(s+l),a,n.paper,{klass:o.klass,stroke:o.stroke,fill:o.fill,"data-name":o.name}))?c:(e(n,{x:r,y:n.y,text:"no symbol:"+a,type:"debugfont",klass:"debug-msg",anchor:"start"},!1),null)}}function wp(){if(eu)return Jh;eu=1;var e=yp(),t=fp();return Jh=function(i,n,r,s,a,o,c){if(r<0||s<a){var l=t(a);a=t(s),s=l}else s=t(s),a=t(a);n=t(n);var h=t(n+r);if(i.firefox112){var u={x1:n+=r/2,x2:n,y1:s,y2:a,stroke:i.foregroundColor,"stroke-width":Math.abs(r)};return o&&(u.class=o),c&&(u["data-name"]=c),i.paper.lineToBack(u)}for(var d=[["M",n,s],["L",n,a],["L",h,a],["L",h,s],["z"]],p=(u={path:""},0);p<d.length;p++)u.path+=d[p].join(" ");return o&&(u.class=o),c&&(u["data-name"]=c),e.isInGroup()||(u.stroke="none",u.fill=i.foregroundColor),i.paper.pathToBack(u)}}function xp(){if(ru)return nu;ru=1;var e=function(){if(iu)return tu;iu=1;var e=pp(),t=fp();return tu=function(i,n,r,s,a,o,c){var l=i.foregroundColor;n=t(n),r=t(r);var h=t(s-c),u=t(s+c);if(i.firefox112){var d={x1:n,x2:r,y1:s+=c/2,y2:s,stroke:i.foregroundColor,"stroke-width":Math.abs(2*c)};return a&&(d.class=a),o&&(d["data-name"]=o),i.paper.lineToBack(d)}var p={path:e("M %f %f L %f %f L %f %f L %f %f z",n,h,r,h,r,u,n,u),stroke:"none",fill:l};return o&&(p["data-name"]=o),a&&(p.class=a),i.paper.pathToBack(p)}}();return nu=function(t,i,n,r,s,a,o){var c=t.calcY(r);return e(t,i,n,c,s,a,o)}}function kp(){if(au)return su;au=1;var e=mp(),t=wp(),i=xp(),n=_p();return su=function(r,s,a){void 0===s.pitch&&window.console.error(s.type+" Relative Element y-coordinate not set.");var o,c,l,h,u,d,p=r.calcY(s.pitch);switch(s.type){case"symbol":if(null===s.c)return null;var f="symbol";s.klass&&(f+=" "+s.klass),s.graphelem=n(r,s.x,s.pitch,s.c,{scalex:s.scalex,scaley:s.scaley,klass:r.controller.classes.generate(f),name:s.name});break;case"debug":s.graphelem=e(r,{x:s.x,y:r.calcY(15),text:""+s.c,type:"debugfont",klass:r.controller.classes.generate("debug-msg"),anchor:"start",centerVertically:!1,dim:s.dim},!1);break;case"tabNumber":var m="tabnumberfont",g="abcjs-tab-number";s.isGrace&&(m="tabgracefont",p+=2.5,g="tab-grace"),s.graphelem=e(r,{x:s.x,y:p,text:""+s.c,type:m,klass:r.controller.classes.generate(g),anchor:"middle",centerVertically:!1,dim:s.dim,cursor:"default"},!1);break;case"barNumber":s.graphelem=e(r,{x:s.x,y:p,text:""+s.c,type:"measurefont",klass:r.controller.classes.generate("bar-number"),anchor:"middle",dim:s.dim,name:"bar-number"},!0);break;case"lyric":s.graphelem=e(r,{x:s.x,y:p,text:s.c,type:"vocalfont",klass:r.controller.classes.generate("lyric"),anchor:"middle",dim:s.dim,name:"lyric"},!1);break;case"chord":s.graphelem=e(r,{x:s.x,y:p,text:s.c,type:"gchordfont",klass:r.controller.classes.generate("chord"),anchor:"middle",dim:s.dim,lane:s.getLane(),name:"chord"},!1);break;case"decoration":s.graphelem=e(r,{x:s.x,y:p+6,text:s.c,type:"annotationfont",klass:r.controller.classes.generate("annotation"),anchor:s.anchor,centerVertically:!0,dim:s.dim},!1);break;case"text":s.graphelem=e(r,{x:s.x,y:p,text:s.c,type:"annotationfont",klass:r.controller.classes.generate("annotation"),anchor:"start",centerVertically:s.centerVertically,dim:s.dim,lane:s.getLane(),name:"annotation"},!1);break;case"multimeasure-text":s.graphelem=e(r,{x:s.x+s.w/2,y:p,text:s.c,type:"tempofont",klass:r.controller.classes.generate("rest"),anchor:"middle",centerVertically:!1,dim:s.dim},!1);break;case"part":s.graphelem=e(r,{x:s.x,y:p,text:s.c,type:"partsfont",klass:r.controller.classes.generate("part"),anchor:"start",dim:s.dim,name:s.c},!0);break;case"bar":s.graphelem=t(r,s.x,s.linewidth+r.lineThickness,p,a||r.calcY(s.pitch2),null,"bar");break;case"stem":var v=s.linewidth>0?s.linewidth+r.lineThickness:s.linewidth-r.lineThickness;s.graphelem=t(r,s.x,v,p,r.calcY(s.pitch2),"abcjs-stem","stem");break;case"ledger":s.graphelem=i(r,s.x,s.x+s.w,s.pitch,"abcjs-ledger","ledger",.35+r.lineThickness)}return 1!==s.scalex&&s.graphelem&&(o=r.paper,c=s.graphelem,l=s.scalex,h=s.scaley,u=s.x,d=p,o.setAttributeOnElement(c,{style:"transform:scale("+l+","+h+");transform-origin:"+u+"px "+d+"px;"})),s.graphelem}}function Cp(){if(du)return uu;du=1;var e=bp(),t=function(){if(zh)return Rh;zh=1;var e=pp(),t=vp(),i=fp(),n=function(n,r,s,a,o,c,l){r=i(r),s=i(s),a=i(a),o=i(o),c=i(c),l=i(l);var h=e("M %f %f L %f %f M %f %f L %f %f",c,r,l,s,c,a,l,o);return t(n,{path:h,highlight:"stroke",stroke:n.foregroundColor,class:n.controller.classes.generate("dynamics decoration"),"data-name":"dynamics"})};return Rh=function(e,t,i){void 0===t.pitch&&window.console.error("Crescendo Element y-coordinate not set.");var r,s=e.calcY(t.pitch)+4,a=t.anchor1?t.anchor1.x:0,o=t.anchor2?t.anchor2.x:800;return r="<"===t.dir?n(e,s+4,s,s+4,s+8,a,o):n(e,s,s+4,s+8,s+4,a,o),i.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1},r),[r]}}(),i=function(){if(Gh)return Hh;Gh=1;var e=_p();return Hh=function(t,i,n){void 0===i.pitch&&window.console.error("Dynamic Element y-coordinate not set.");var r=e(t,i.anchor.x,i.pitch,i.dec,{scalex:1,scaley:1,klass:t.controller.classes.generate("decoration dynamics"),fill:t.foregroundColor,stroke:"none",name:"dynamics"});return n.wrapSvgEl({el_type:"dynamicDecoration",startChar:-1,endChar:-1,decoration:i.dec},r),[r]}}(),n=function(){if(Wh)return Uh;Wh=1;var e=pp(),t=mp(),i=vp(),n=fp();function r(t,i,r,s){return e("M %f %f L %f %f",n(t),n(i),n(r),n(s))}return Uh=function(e,n,s){e.paper.openGroup({klass:e.controller.classes.generate("triplet "+n.durationClass),"data-name":"triplet"}),n.hasBeam||function(e,t,n,s,a){n=e.calcY(n),a=e.calcY(a);var o="";o+=r(t,n,t,n+5),o+=r(s,a,s,a+5);var c=t+(s-t)/2,l=(a-n)/(s-t),h=c-8;o+=r(t,n,h,n+(h-t)*l);var u=c+8;o+=r(u,n+(u-t)*l,s,a),i(e,{path:o,stroke:e.foregroundColor,"data-name":"triplet-bracket"})}(e,n.anchor1.x,n.startNote,n.anchor2.x+n.anchor2.w,n.endNote),t(e,{x:n.xTextPos,y:e.calcY(n.yTextPos-1),text:""+n.number,type:"tripletfont",anchor:"middle",centerVertically:!0,noClass:!0,name:""+n.number},!0);var a=e.paper.closeGroup();return s.wrapSvgEl({el_type:"triplet",startChar:-1,endChar:-1},a),a}}(),r=function(){if($h)return Yh;$h=1;var e=pp(),t=mp(),i=vp(),n=fp();return Yh=function(r,s,a,o,c){void 0===s.pitch&&window.console.error("Ending Element y-coordinate not set.");var l=n(r.calcY(s.pitch)),h="";s.anchor1&&(a=n(s.anchor1.x+s.anchor1.w),h+=e("M %f %f L %f %f ",a,l,a,n(l+20))),s.anchor2&&(o=n(s.anchor2.x),h+=e("M %f %f L %f %f ",o,l,o,n(l+20))),h+=e("M %f %f L %f %f ",a,l,o,l),r.paper.openGroup({klass:r.controller.classes.generate("ending"),"data-name":"ending"}),i(r,{path:h,stroke:r.foregroundColor,fill:r.foregroundColor,"data-name":"line"}),s.anchor1&&t(r,{x:n(a+5),y:n(r.calcY(s.pitch-.5)),text:s.text,type:"repeatfont",klass:"ending",anchor:"start",noClass:!0,name:s.text});var u=r.paper.closeGroup();return c.wrapSvgEl({el_type:"ending",startChar:-1,endChar:-1},u),[u]}}(),s=function(){if(Xh)return Kh;Xh=1;var e=pp(),t=fp();return Kh=function(i,n,r,s,a){!function(e,t,i){e.anchor1&&e.anchor2?e.anchor1.pitch===e.anchor2.pitch&&0===e.internalNotes.length?e.isTie=!0:e.isTie=!1:e.isTie=!0,e.isTie?(e.calcTieDirection(),e.calcX(t,i),e.calcTieY()):(e.calcSlurDirection(),e.calcX(t,i),e.calcSlurY()),e.avoidCollisionAbove()}(n,r,s);var o="";n.anchor1?o+="abcjs-start-m"+n.anchor1.parent.counters.measure+"-n"+n.anchor1.parent.counters.note:o+="abcjs-start-edge",n.anchor2?o+=" abcjs-end-m"+n.anchor2.parent.counters.measure+"-n"+n.anchor2.parent.counters.note:o+=" abcjs-end-edge",n.hint&&(o="abcjs-hint");var c=n.fixedY?1.5:0,l=function(i,n,r,s,a,o,c,l,h){var u=l?1.2:1.5;n=t(n+6),r=t(r+4),s+=o?u:-u,a+=o?u:-u;var d,p=t(i.calcY(s)),f=t(i.calcY(a)),m=r-n,g=f-p,v=Math.sqrt(m*m+g*g),b=m/v,y=g/v,_=v/3.5,w=l?10:25,x=(o?-1:1)*Math.min(w,Math.max(4,_)),k=t(n+_*b-x*y),C=t(p+_*y+x*b),S=t(r-_*b-x*y),M=t(f-_*y+x*b);if(c?c+=" slur":c="slur",c+=l?" tie":" legato",h){c+=" dotted";var E=e("M %f %f C %f %f %f %f %f %f",n,p,k,C,S,M,r,f);d=i.paper.path({path:E,stroke:i.foregroundColor,fill:"none","stroke-dasharray":"5 5",class:i.controller.classes.generate(c),"data-name":l?"tie":"slur"})}else{var T=e("M %f %f C %f %f %f %f %f %f C %f %f %f %f %f %f z",n,p,k,C,S,M,r,f,t(S-2*y),t(M+2*b),t(k-2*y),t(C+2*b),n,p);d=i.paper.path({path:T,stroke:"none",fill:i.foregroundColor,class:i.controller.classes.generate(c),"data-name":l?"tie":"slur"})}return d}(i,n.startX,n.endX,n.startY+c,n.endY+c,n.above,o,n.isTie,n.dotted),h=-1;n.anchor1&&!n.isTie&&(h=n.anchor1.parent.abcelem.startChar-1);var u=-1;return n.anchor2&&!n.isTie&&(u=n.anchor2.parent.abcelem.endChar+1),a.wrapSvgEl({el_type:"slur",startChar:h,endChar:u},l),[l]}}(),a=function(){if(Zh)return Qh;Zh=1;var e=vp(),t=fp();function i(e,i,n,r,s,a){n=t(e.calcY(n)),s=t(e.calcY(s)),i=t(i),r=t(r);var o=t(n+a);return"M"+i+" "+n+" L"+r+" "+s+"L"+r+" "+t(s+a)+" L"+i+" "+o+"z"}function n(e,t,i,n,r){return(r-i)/(n-t)}function r(e,t,i,n){return t+(n-e)*i}return Qh=function(t,s){if(0!==s.beams.length){for(var a="",o=0;o<s.beams.length;o++){var c=s.beams[o];if(c.split){for(var l=n(0,c.startX,c.startY,c.endX,c.endY),h=[],u=0;u<c.split.length;u+=2)h.push([c.split[u],c.split[u+1]]);for(u=0;u<h.length;u++){var d=r(c.startX,c.startY,l,h[u][0]),p=r(c.startX,c.startY,l,h[u][1]);a+=i(t,h[u][0],d,h[u][1],p,c.dy)}}else a+=i(t,c.startX,c.startY,c.endX,c.endY,c.dy)}var f=("abcjs-d"+s.duration).replace(/\./g,"-"),m=t.controller.classes.generate("beam-elem "+f);return[e(t,{path:a,stroke:"none",fill:t.foregroundColor,class:m})]}}}(),o=mp(),c=function(){if(hu)return lu;hu=1;var e=function(){if(cu)return ou;cu=1;var e=kp(),t=mp();return ou=function(i,n){var r=n.x;void 0===n.pitch&&window.console.error("Tempo Element y-coordinate not set."),n.tempo.el_type="tempo";var s,a=i.calcY(n.pitch)+2;if(n.tempo.preString){s=t(i,{x:r,y:a,text:n.tempo.preString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"pre"},!0);var o=i.controller.getTextSize.calc(n.tempo.preString,"tempofont","tempo",s).width;r+=o+o/n.tempo.preString.length}if(n.note){n.note.setX(r);for(var c=0;c<n.note.children.length;c++)e(i,n.note.children[c],r);r+=n.note.w+5;var l="= "+n.tempo.bpm;s=t(i,{x:r,y:a,text:l,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"beats"});var h=i.controller.getTextSize.calc(l,"tempofont","tempo",s).width;r+=h+h/l.length}n.tempo.postString&&t(i,{x:r,y:a,text:n.tempo.postString,type:"tempofont",klass:"abcjs-tempo",anchor:"start",noClass:!0,name:"post"},!0)}}(),t=kp(),i=Vd(),n=Ud(),r=yp();return lu=function(s,a,o,c,l){if(!a.invisible){var h=a.children.length>0&&"TempoElement"===a.children[0].type;a.elemset=[],r.beginGroup(s.paper,s.controller);for(var u=0;u<a.children.length;u++){var d=a.children[u];if("TempoElement"===d.type)e(s,d);else{var p=t(s,d,o);"symbol"===d.type&&d.c&&d.c.indexOf("notehead")>=0&&p.setAttribute("class","abcjs-notehead")}}var f=a.type;if(("note"===a.type||"rest"===a.type)&&(a.counters=s.controller.classes.getCurrent(),f=(f+=" d"+Math.round(1e3*a.durationClass)/1e3).replace(/\./g,"-"),a.abcelem.pitches))for(var m=0;m<a.abcelem.pitches.length;m++)f+=" p"+a.abcelem.pitches[m].pitch;var g=r.endGroup(f,a.type);if(g){if(a.cloned&&(a.cloned.overrideClasses=g.className.baseVal),a.overrideClasses){var v=g.classList&&g.classList.length>0?g.classList[0]+" ":"";g.setAttribute("class",v+a.overrideClasses)}if(h)a.startChar=a.abcelem.startChar,a.endChar=a.abcelem.endChar,c.add(a,g,!1,l);else{a.elemset.push(g);var b=!1;"note"!==a.type&&"tabNumber"!==a.type||(b=!0),c.add(a,g,b,l)}}else a.elemset.length>0&&c.add(a,a.elemset[0],"note"===a.type,l);if(a.klass&&n(a.elemset,"mark","","#00ff00"),a.hint&&n(a.elemset,"abcjs-hint","",null),a.abcelem.abselem=a,a.heads&&a.heads.length>0){a.notePositions=[];for(var y=0;y<a.heads.length;y++)a.notePositions.push({x:a.heads[y].x+a.heads[y].w/2,y:l.zero-a.heads[y].pitch*i.STEP})}}}}();return uu=function(l,h,u,d,p){var f=h.w-1;l.staffbottom=h.staff.bottom;var m,g,v=l.foregroundColor;if(h.color&&(l.foregroundColor=h.color),h.header){var b=o(l,{x:l.padding.left,y:l.calcY(h.headerPosition),text:h.header,type:"voicefont",klass:"staff-extra voice-name",anchor:"start",centerVertically:!0,name:"voice-name"},!0);d.wrapSvgEl({el_type:"voiceName",startChar:-1,endChar:-1,text:h.header},b)}var y,_=!1;for(m=0;m<h.children.length;m++){"note"!==(g=h.children[m]).type&&"rest"!==g.type||(_=!0);var w=!1;"staff-extra"===g.type||l.controller.classes.isInMeasure()||(l.controller.classes.startMeasure(),w=!0),h.staff.isTabStaff&&(g.invisible=!1,"bar"==g.type&&g.abcelem.lastBar&&(u=h.topLine)),c(l,g,h.barto||m===h.children.length-1?u:0,d,p),("note"===g.type||"rest"===(y=g).type&&!(!y.abcelem||!y.abcelem.rest||"spacer"===y.abcelem.rest.type))&&l.controller.classes.incrNote(),"bar"===g.type&&!w&&_&&l.controller.classes.incrMeasure()}for(l.controller.classes.startMeasure(),m=0;m<h.beams.length;m++){var x=h.beams[m];"bar"===x?l.controller.classes.incrMeasure():a(l,x,d)}for(l.controller.classes.startMeasure(),m=0;m<h.otherchildren.length;m++)if("bar"===(g=h.otherchildren[m]))l.controller.classes.incrMeasure();else switch(g.type){case"GlissandoElem":g.elemset=e(l,g,d);break;case"CrescendoElem":g.elemset=t(l,g,d);break;case"DynamicDecoration":g.elemset=i(l,g,d);break;case"TripletElem":n(l,g,d);break;case"EndingElem":g.elemset=r(l,g,h.startx+10,f,d);break;case"TieElem":g.elemset=s(l,g,h.startx+10,f,d);break;default:console.log(g),c(l,g,h.startx+10,f,d,p)}l.foregroundColor=v}}function Sp(){if(_u)return yu;_u=1;var e=bu?vu:(bu=1,vu=function(e,t){var i=Math.round(e.y),n=(e.controller.width-t)/2,r=n+t,s="M "+n+" "+i+" L "+r+" "+i+" L "+r+" "+(i+1)+" L "+n+" "+(i+1)+" L "+n+" "+i+" z";e.paper.pathToBack({path:s,stroke:"rgba(0,0,0,0)",fill:"rgba(0,0,0,255)",class:e.controller.classes.generate("defined-text")})}),t=mp();return yu=function(i,n,r){for(var s=0;s<n.rows.length;s++){var a=n.rows[s];if(a.absmove)i.absolutemoveY(a.absmove);else if(a.move)i.moveY(a.move);else if(a.text||a.phrases){var o=a.left?a.left:0,c=t(i,{x:o,y:i.y,text:a.text,phrases:a.phrases,"dominant-baseline":a["dominant-baseline"],type:a.font,klass:a.klass,name:a.name,anchor:a.anchor});a.absElemType&&r.wrapSvgEl({el_type:a.absElemType,name:a.name,startChar:a.startChar,endChar:a.endChar,text:a.text},c)}else if(a.separator)e(i,a.separator);else if(a.startGroup)i.paper.openGroup({klass:a.klass,"data-name":a.name});else if(a.endGroup){var l=i.paper.closeGroup();a.absElemType&&r.wrapSvgEl({el_type:a.absElemType,name:a.name,startChar:a.startChar,endChar:a.endChar,text:""},l)}}}}function Mp(){if(Tu)return Eu;Tu=1;var e=function(){if(xu)return wu;xu=1;var e=Vd(),t=gp(),i=Cp(),n=function(){if(fu)return pu;fu=1;var e=xp();return pu=function(t,i,n,r,s,a){var o="abcjs-top-line",c=2;s&&(c=s),t.paper.openGroup({prepend:!0,klass:t.controller.classes.generate("abcjs-staff")});var l=0,h=0;if(1===r)e(t,i,n,6,o,null,a+t.lineThickness),l=t.calcY(10),h=t.calcY(2);else for(var u=r-1;u>=0;u--){var d=(u+1)*c;h=t.calcY(d),0===l&&(l=h),e(t,i,n,d,o,null,a+t.lineThickness),o=void 0}return t.paper.closeGroup(),[l,h]}}(),r=gu?mu:(gu=1,mu=function(e,t,i){var n=e.paper.rectBeneath(t);return i&&e.paper.text(i,{x:0,y:t.y+7,"text-anchor":"start","font-size":"14px",fill:"rgba(0,0,255,.4)",stroke:"rgba(0,0,255,.4)"}),n}),s=wp(),a=Sp();function o(i,n,r,s,a){if(r)for(var o=0;o<r.length;o++)r[o].isStartVoice(s)&&(r[o].startY=n-10*e.STEP,r[o].elemset=t(i,r[o],a))}function c(t,i,n){for(var s=0;s<n.length;s++)for(var a=i[n[s]].children,o=0;o<a.length;o++){var c=a[o],l=c.getFixedCoords();if(!c.invisible&&void 0!==l.t&&void 0!==l.b){var h=(l.t-l.b)*e.STEP;r(t,{x:l.x,y:t.calcY(l.t),width:l.w,height:h,fill:"#88e888","fill-opacity":.4,stroke:"#4aa93d","stroke-opacity":.8});for(var u=0;u<c.children.length;u++){var d=c.children[u],p=d.getChordDim();if(p){var f=t.calcY(d.pitch);f+=d.dim.font.size*d.getLane(),r(t,{x:p.left,y:f,width:p.right-p.left,height:d.dim.font.size,fill:"none",stroke:"#4aa93d","stroke-opacity":.8})}}}}}return wu=function(t,l,h,u){for(var d,p,f,m=t.y,g=0;g<l.staffs.length;g++){var v=l.staffs[g];t.moveY(e.STEP,v.top),v.absoluteY=t.y,t.showDebug&&(t.showDebug.indexOf("box")>=0&&v.voices&&c(t,l.voices,v.voices),t.showDebug.indexOf("grid")>=0&&(t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:m,y2:m,stroke:"#0000ff"}),r(t,{x:t.padding.left,y:t.calcY(v.originalTop),width:t.controller.width,height:t.calcY(v.originalBottom)-t.calcY(v.originalTop),fill:t.foregroundColor,stroke:t.foregroundColor,"fill-opacity":.1,"stroke-opacity":.1}),d=0,E(v,"chordHeightAbove"),E(v,"chordHeightBelow"),E(v,"dynamicHeightAbove"),E(v,"dynamicHeightBelow"),E(v,"endingHeightAbove"),E(v,"lyricHeightAbove"),E(v,"lyricHeightBelow"),E(v,"partHeightAbove"),E(v,"tempoHeightAbove"),E(v,"volumeHeightAbove"),E(v,"volumeHeightBelow"))),t.moveY(e.STEP,-v.bottom),t.showDebug&&t.showDebug.indexOf("grid")>=0&&t.paper.dottedLine({x1:t.padding.left,x2:t.padding.left+t.controller.width,y1:t.y,y2:t.y,stroke:"#0000aa"})}for(var b=2,y=0,_=0;_<l.voices.length;_++){var w=l.voices[_].staff,x=l.voices[_].tabNameInfos;if(t.y=w.absoluteY,t.controller.classes.incrVoice(),!l.voices[_].duplicate){if(p||(p=t.calcY(10)),f=t.calcY(b),0!==w.lines){w.linePitch&&(b=w.linePitch),t.controller.classes.newMeasure();var k=n(t,l.startx,l.w,w.lines,w.linePitch,.35);f=k[1],w.bottomLine=f,w.topLine=k[0],w.hasTab&&(y=w.topLine),w.hasStaff&&(y=w.hasStaff.topLine,l.voices[_].barto=!0,l.voices[_].topLine=p)}o(t,w.absoluteY,l.brace,_,h),o(t,w.absoluteY,l.bracket,_,h)}i(t,l.voices[_],y,h,{top:m,zero:t.y,height:l.height*e.STEP});var C=0;if(x){var S={rows:[]};S.rows.push({absmove:f+2}),S.rows.push({left:l.startx+8,text:x.name,font:"tablabelfont",klass:"text instrument-name",anchor:"start"}),S.rows.push({move:x.textSize.height}),a(t,S),C=x.textSize.height}t.controller.classes.newMeasure(),l.voices[_].duplicate||(y=t.calcY(2+C))}t.controller.classes.newMeasure();var M=l.staffs.length;function E(i,n){var s=["rgb(207,27,36)","rgb(168,214,80)","rgb(110,161,224)","rgb(191,119,218)","rgb(195,30,151)","rgb(31,170,177)","rgb(220,166,142)"];if(i.positionY&&i.positionY[n]){var a=i.specialY[n]*e.STEP;"chordHeightAbove"===n&&i.specialY.chordLines&&i.specialY.chordLines.above&&(a*=i.specialY.chordLines.above),"chordHeightBelow"===n&&i.specialY.chordLines&&i.specialY.chordLines.below&&(a*=i.specialY.chordLines.below),r(t,{x:t.padding.left,y:t.calcY(i.positionY[n]),width:t.controller.width,height:a,fill:s[d],stroke:s[d],"fill-opacity":.4,"stroke-opacity":.4},n.substr(0,4)),(d+=1)>6&&(d=0)}}M>1&&(p=l.staffs[0].topLine,f=l.staffs[M-1].bottomLine,s(t,l.startx,.6,p,f,null)),t.y=m}}(),t=Cu?ku:(Cu=1,ku=function(e,t,i,n){var r=(t+e.padding.left+e.padding.right)*i,s=(e.y+e.padding.bottom)*i;if(e.isPrint&&(s=Math.max(s,1056)),""!==e.ariaLabel){var a="Sheet Music";e.abctune&&e.abctune.metaText&&e.abctune.metaText.title&&(a+=' for "'+e.abctune.metaText.title+'"'),e.paper.setTitle(a);var o=e.ariaLabel?e.ariaLabel:a;e.paper.setAttribute("aria-label",o)}e.paper.insertStyles(".abcjs-dragging-in-progress text, .abcjs-dragging-in-progress tspan {"+["-webkit-touch-callout: none;","-webkit-user-select: none;","-khtml-user-select: none;","-moz-user-select: none;","-ms-user-select: none;","user-select: none;"].join(" ")+"}");var c={overflow:"hidden"};"resize"===n?e.paper.setResponsiveWidth(r,s):(c.width="",c.height=s+"px",i<1?(c.width=r+"px",e.paper.setSize(r/i,s/i)):e.paper.setSize(r,s)),e.paper.setScale(i),e.paper.setParentStyles(c)}),i=Sp(),n=Vd(),r=function(){if(Mu)return Su;Mu=1;var e=Wd(),t=Yd();function i(e,t,i){this.elements=[],this.paper=e,this.tuneNumber=i,this.selectTypes=t}return i.prototype.getElements=function(){return this.elements},i.prototype.add=function(e,t,i,n){if(this.canSelect(e)){var r;r=void 0===this.selectTypes?{selectable:!1,"data-index":this.elements.length}:{selectable:!0,tabindex:0,"data-index":this.elements.length},this.paper.setAttributeOnElement(t,r);var s={absEl:e,svgEl:t,isDraggable:i};void 0!==n&&(s.staffPos=n),this.elements.push(s)}},i.prototype.canSelect=function(e){return!(!1===this.selectTypes||!e||!e.abcelem||!0!==this.selectTypes&&!(void 0===this.selectTypes?"note"===e.abcelem.el_type||"tabNumber"===e.abcelem.el_type:this.selectTypes.indexOf(e.abcelem.el_type)>=0))},i.prototype.wrapSvgEl=function(i,n){var r={tuneNumber:this.tuneNumber,abcelem:i,elemset:[n],highlight:e,unhighlight:t};this.add(r,n,!1)},Su=i}();function s(t,i,r,s){e(t,i,r,s);var a=i.height*n.STEP;return t.y+=a,i}function a(e,t,i,r){var s=-(i.staffs[i.staffs.length-1].bottom-2),a=(r.staffs[0].top-10+s)*n.STEP;a<t&&e.moveY(t-a)}return Eu=function(e,n,o,c,l,h,u,d,p,f){var m=new r(e.paper,d,p),g={};n.shouldAddClasses&&(g.klass="abcjs-meta-top"),e.paper.openGroup(g),e.moveY(e.padding.top),i(e,o.topText,m),e.paper.closeGroup(),e.moveY(e.spacing.music);for(var v=[],b=0;b<o.lines.length;b++){n.incrLine();var y=o.lines[b];if(y.staff){n.shouldAddClasses&&(g.klass="abcjs-staff-wrapper abcjs-l"+n.lineNumber),e.paper.openGroup(g),y.vskip&&e.moveY(y.vskip),v.length>=1&&a(e,e.spacing.staffSeparation,v[v.length-1],y.staffGroup);var _=s(e,y.staffGroup,m,b);_.line=f+b,v.push(_),e.paper.closeGroup()}else y.nonMusic&&(n.shouldAddClasses&&(g.klass="abcjs-non-music"),e.paper.openGroup(g),i(e,y.nonMusic,m),e.paper.closeGroup())}return n.reset(),o.bottomText&&o.bottomText.rows&&o.bottomText.rows.length>0&&(n.shouldAddClasses&&(g.klass="abcjs-meta-bottom"),e.paper.openGroup(g),e.moveY(24),i(e,o.bottomText,m),e.paper.closeGroup()),t(e,l,u,h),{staffgroups:v,selectables:m.getElements()}}}function Ep(){if(Nu)return Iu;Nu=1;var e=Vd(),t=sp(),i=function(){if(Ol)return Ll;Ol=1;var e=Vd(),t=function(){if(Nl)return Il;Nl=1;var e="http://www.w3.org/2000/svg";function t(e){this.svg=s(),this.currentGroup=[],e.appendChild(this.svg)}function i(e,t,i){var n=i-e;return"M "+e+" "+t+" l "+n+" 0 l 0 1 l "+-n+" 0 z "}function n(e,t,i){var n=i-t;return"M "+e+" "+t+" l 0 "+n+" l 1 0 l 0 "+-n+" z "}t.prototype.clear=function(){if(this.svg){var e=this.svg.parentNode;this.svg=s(),this.currentGroup=[],e&&(e.innerHTML="",e.appendChild(this.svg))}},t.prototype.setTitle=function(e){var t=document.createElement("title"),i=document.createTextNode(e);t.appendChild(i),this.svg.insertBefore(t,this.svg.firstChild)},t.prototype.setResponsiveWidth=function(e,t){if(this.svg.setAttribute("viewBox","0 0 "+e+" "+t),this.svg.setAttribute("preserveAspectRatio","xMinYMin meet"),this.svg.removeAttribute("height"),this.svg.removeAttribute("width"),this.svg.style.display="inline-block",this.svg.style.position="absolute",this.svg.style.top="0",this.svg.style.left="0",this.svg.parentNode){var i=this.svg.parentNode.getAttribute("class");i?i.indexOf("abcjs-container")<0&&this.svg.parentNode.setAttribute("class",i+" abcjs-container"):this.svg.parentNode.setAttribute("class","abcjs-container"),this.svg.parentNode.style.display="inline-block",this.svg.parentNode.style.position="relative",this.svg.parentNode.style.width="100%";var n=t/e*100;this.svg.parentNode.style["padding-bottom"]=n+"%",this.svg.parentNode.style["vertical-align"]="middle",this.svg.parentNode.style.overflow="hidden"}},t.prototype.setSize=function(e,t){this.svg.setAttribute("width",e),this.svg.setAttribute("height",t)},t.prototype.setAttribute=function(e,t){this.svg.setAttribute(e,t)},t.prototype.setScale=function(e){1!==e?(this.svg.style.transform="scale("+e+","+e+")",this.svg.style["-ms-transform"]="scale("+e+","+e+")",this.svg.style["-webkit-transform"]="scale("+e+","+e+")",this.svg.style["transform-origin"]="0 0",this.svg.style["-ms-transform-origin-x"]="0",this.svg.style["-ms-transform-origin-y"]="0",this.svg.style["-webkit-transform-origin-x"]="0",this.svg.style["-webkit-transform-origin-y"]="0"):(this.svg.style.transform="",this.svg.style["-ms-transform"]="",this.svg.style["-webkit-transform"]="")},t.prototype.insertStyles=function(t){var i=document.createElementNS(e,"style");i.textContent=t,this.svg.insertBefore(i,this.svg.firstChild)},t.prototype.setParentStyles=function(e){for(var t in e)e.hasOwnProperty(t)&&this.svg.parentNode&&(this.svg.parentNode.style[t]=e[t]);this.dummySvg&&(document.querySelector("body").removeChild(this.dummySvg),this.dummySvg=null)},t.prototype.rect=function(e){var t=[],r=e.x,s=e.y,a=e.x+e.width,o=e.y+e.height;return t.push(i(r,s,a)),t.push(i(r,o,a)),t.push(n(a,s,o)),t.push(n(r,o,s)),this.path({path:t.join(" "),stroke:"none","data-name":e["data-name"]})},t.prototype.dottedLine=function(t){var i=document.createElementNS(e,"line");i.setAttribute("x1",t.x1),i.setAttribute("x2",t.x2),i.setAttribute("y1",t.y1),i.setAttribute("y2",t.y2),i.setAttribute("stroke",t.stroke),i.setAttribute("stroke-dasharray","5,5"),this.svg.insertBefore(i,this.svg.firstChild)},t.prototype.rectBeneath=function(t){var i=document.createElementNS(e,"rect");i.setAttribute("x",t.x),i.setAttribute("width",t.width),i.setAttribute("y",t.y),i.setAttribute("height",t.height),t.stroke&&i.setAttribute("stroke",t.stroke),t["stroke-opacity"]&&i.setAttribute("stroke-opacity",t["stroke-opacity"]),t.fill&&i.setAttribute("fill",t.fill),t["fill-opacity"]&&i.setAttribute("fill-opacity",t["fill-opacity"]),this.svg.insertBefore(i,this.svg.firstChild)},t.prototype.text=function(t,i,n){var r=document.createElementNS(e,"text");for(var s in r.setAttribute("stroke","none"),i)i.hasOwnProperty(s)&&r.setAttribute(s,i[s]);for(var a=(""+t).split("\n"),o=0;o<a.length;o++){var c=document.createElementNS(e,"tspan");if(c.setAttribute("x",i.x?i.x:0),0!==o&&c.setAttribute("dy","1.2em"),-1!==a[o].indexOf("")){var l=a[o].split("");if(c.textContent=l[0],l[1]){var h=document.createElementNS(e,"tspan");h.setAttribute("dy","-0.3em"),h.setAttribute("style","font-size:0.7em"),h.textContent=l[1],c.appendChild(h)}if(l[2]){var u=l[1]?"0.4em":"0.1em",d=document.createElementNS(e,"tspan");d.setAttribute("dy",u),d.setAttribute("style","font-size:0.7em"),d.textContent=l[2],c.appendChild(d)}}else c.textContent=a[o];r.appendChild(c)}return n?n.appendChild(r):this.append(r),r},t.prototype.richTextLine=function(t,i,n,r,s,a){var o=document.createElementNS(e,"text");o.setAttribute("stroke","none"),o.setAttribute("class",r),o.setAttribute("x",i),o.setAttribute("y",n),o.setAttribute("text-anchor",s),o.setAttribute("dominant-baseline","middle");for(var c=0;c<t.length;c++){for(var l=t[c],h=document.createElementNS(e,"tspan"),u=Object.keys(l.attrs),d=0;d<u.length;d++){var p=l.attrs[u[d]];""!==p&&h.setAttribute(u[d],p)}h.textContent=l.content,o.appendChild(h)}return a?a.appendChild(o):this.append(o),o},t.prototype.guessWidth=function(e,t){var i,n=this.createDummySvg(),r=this.text(e,t,n);try{i=r.getBBox(),i=isNaN(i.height)||!i.height?{width:t["font-size"]/2,height:t["font-size"]+2}:{width:i.width,height:i.height}}catch(s){i={width:t["font-size"]/2,height:t["font-size"]+2}}return n.removeChild(r),i},t.prototype.createDummySvg=function(){return this.dummySvg||(this.dummySvg=s(),this.dummySvg.setAttribute("style",["display: block !important;","height: 1px;","width: 1px;","position: absolute;"].join("")),document.querySelector("body").appendChild(this.dummySvg)),this.dummySvg};var r={};function s(){var t=document.createElementNS(e,"svg");return t.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),t.setAttribute("role","img"),t.setAttribute("fill","currentColor"),t.setAttribute("stroke","currentColor"),t}return t.prototype.getTextSize=function(e,t,i){if("number"==typeof e&&(e=""+e),!e||e.match(/^\s+$/))return{width:0,height:0};var n;if(e.length<20&&(n=e+JSON.stringify(t),r[n]))return r[n];var s,a=!i;i||(i=this.text(e,t));try{s=i.getBBox(),s=isNaN(s.height)||!s.height?this.guessWidth(e,t):{width:s.width,height:s.height}}catch(o){s=this.guessWidth(e,t)}return a&&(this.currentGroup.length>0?this.currentGroup[0].removeChild(i):this.svg.removeChild(i)),n&&(r[n]=s),s},t.prototype.openGroup=function(t){t=t||{};var i=document.createElementNS(e,"g");return t.klass&&i.setAttribute("class",t.klass),t.fill&&i.setAttribute("fill",t.fill),t.stroke&&i.setAttribute("stroke",t.stroke),t["data-name"]&&i.setAttribute("data-name",t["data-name"]),t.prepend?this.prepend(i):this.append(i),this.currentGroup.unshift(i),i},t.prototype.closeGroup=function(){var e=this.currentGroup.shift();return e&&0===e.children.length?(e.parentElement.removeChild(e),null):e},t.prototype.path=function(t){var i=document.createElementNS(e,"path");for(var n in t)t.hasOwnProperty(n)&&("path"===n?i.setAttributeNS(null,"d",t.path):"klass"===n?i.setAttributeNS(null,"class",t[n]):void 0!==t[n]&&i.setAttributeNS(null,n,t[n]));return this.append(i),i},t.prototype.pathToBack=function(t){var i=document.createElementNS(e,"path");for(var n in t)t.hasOwnProperty(n)&&("path"===n?i.setAttributeNS(null,"d",t.path):"klass"===n?i.setAttributeNS(null,"class",t[n]):i.setAttributeNS(null,n,t[n]));return this.prepend(i),i},t.prototype.lineToBack=function(t){for(var i=document.createElementNS(e,"line"),n=Object.keys(t),r=0;r<n.length;r++)i.setAttribute(n[r],t[n[r]]);return this.prepend(i),i},t.prototype.append=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.appendChild(e)},t.prototype.prepend=function(e){this.currentGroup.length>0?this.currentGroup[0].appendChild(e):this.svg.insertBefore(e,this.svg.firstChild)},t.prototype.setAttributeOnElement=function(e,t){for(var i in t)t.hasOwnProperty(i)&&e.setAttributeNS(null,i,t[i])},t.prototype.moveElementToChild=function(e,t){e.appendChild(t)},Il=t}(),i=function(i){this.paper=new t(i),this.controller=null,this.space=3*e.SPACE,this.padding={},this.reset(),this.firefox112=navigator.userAgent.indexOf("Firefox/112.0")>=0};return i.prototype.reset=function(){this.paper.clear(),this.y=0,this.abctune=null,this.path=null,this.isPrint=!1,this.lineThickness=0,this.initVerticalSpace()},i.prototype.newTune=function(e){this.abctune=e,this.setVerticalSpace(e.formatting),this.isPrint="print"===e.media,this.setPadding(e)},i.prototype.setLineThickness=function(e){this.lineThickness=e},i.prototype.setPaddingOverride=function(e){this.paddingOverride={top:e.paddingtop,bottom:e.paddingbottom,right:e.paddingright,left:e.paddingleft}},i.prototype.setPadding=function(e){function t(t,i,n,r,s){void 0!==e.formatting[n]?t.padding[i]=e.formatting[n]:void 0!==t.paddingOverride[i]?t.padding[i]=t.paddingOverride[i]:t.isPrint?t.padding[i]=r:t.padding[i]=s}t(this,"top","topmargin",38,15),t(this,"bottom","botmargin",38,15),t(this,"left","leftmargin",68,15),t(this,"right","rightmargin",68,15)},i.prototype.adjustNonScaledItems=function(e){this.padding.top/=e,this.padding.bottom/=e,this.padding.left/=e,this.padding.right/=e,this.abctune.formatting.headerfont.size/=e,this.abctune.formatting.footerfont.size/=e},i.prototype.initVerticalSpace=function(){this.spacing={composer:7.56,graceBefore:8.67,graceInside:10.67,graceAfter:16,info:0,lineSkipFactor:1.1,music:7.56,paragraphSkipFactor:.4,parts:11.33,slurHeight:1,staffSeparation:61.33,staffTopMargin:0,stemHeight:36.67,subtitle:3.78,systemStaffSeparation:48,text:18.9,title:7.56,top:30.24,vocal:0,words:0}},i.prototype.setVerticalSpace=function(e){void 0!==e.staffsep&&(this.spacing.staffSeparation=4*e.staffsep/3),void 0!==e.composerspace&&(this.spacing.composer=4*e.composerspace/3),void 0!==e.partsspace&&(this.spacing.parts=4*e.partsspace/3),void 0!==e.textspace&&(this.spacing.text=4*e.textspace/3),void 0!==e.musicspace&&(this.spacing.music=4*e.musicspace/3),void 0!==e.titlespace&&(this.spacing.title=4*e.titlespace/3),void 0!==e.sysstaffsep&&(this.spacing.systemStaffSeparation=4*e.sysstaffsep/3),void 0!==e.stafftopmargin&&(this.spacing.staffTopMargin=4*e.stafftopmargin/3),void 0!==e.subtitlespace&&(this.spacing.subtitle=4*e.subtitlespace/3),void 0!==e.topspace&&(this.spacing.top=4*e.topspace/3),void 0!==e.vocalspace&&(this.spacing.vocal=4*e.vocalspace/3),void 0!==e.wordsspace&&(this.spacing.words=4*e.wordsspace/3)},i.prototype.calcY=function(t){return this.y-t*e.STEP},i.prototype.moveY=function(e,t){void 0===t&&(t=1),this.y+=e*t},i.prototype.absolutemoveY=function(e){this.y=e},Ll=i}(),n=Dl?Bl:(Dl=1,Bl=function(e,t,i,n,r,s){var a,o=e.text;this.rows=[],t&&this.rows.push({move:t});var c=i.calc("textfont","defined-text");if(""===o)this.rows.push({move:2*c.attr["font-size"]});else if("string"==typeof o)this.rows.push({move:c.attr["font-size"]/2}),this.rows.push({left:n,text:o,font:"textfont",klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),a=s.calc(o,"textfont","defined-text"),this.rows.push({move:a.height});else if(o){for(var l=0,h=n,u="textfont",d=0;d<o.length;d++)u=o[d].font?o[d].font:"textfont",this.rows.push({left:h,text:o[d].text,font:u,klass:"defined-text",anchor:"start",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),h+=(a=s.calc(o[d].text,i.calc(u,"defined-text").font,"defined-text")).width+a.height/2,l=Math.max(l,a.height);this.rows.push({move:l})}else if(1===e.length){var p=r/2;this.rows.push({left:p,text:e[0].text,font:"textfont",klass:"defined-text",anchor:"middle",startChar:e.startChar,endChar:e.endChar,absElemType:"freeText",name:"free-text"}),a=s.calc(e[0].text,"textfont","defined-text"),this.rows.push({move:a.height})}}),r=zl?Rl:(zl=1,Rl=function(e,t,i){this.rows=[],e&&this.rows.push({move:e}),this.rows.push({separator:t,absElemType:"separator"}),i&&this.rows.push({move:i})}),s=ql?Vl:(ql=1,Vl=function(e,t,i,n,r,s){this.rows=[],e&&this.rows.push({move:e});var a=t.titleleft?"start":"middle",o=t.titleleft?r:n;this.rows.push({left:o,text:i.text,font:"subtitlefont",klass:"text subtitle",anchor:a,startChar:i.startChar,endChar:i.endChar,absElemType:"subtitle",name:"subtitle"});var c=s.calc(i.text,"subtitlefont","text subtitle");this.rows.push({move:c.height})}),a=function(){if(Wl)return Ul;Wl=1;const e=ap(),t=op();return Ul=function(i,n,r,s,a,o,c,l,h,u){if(this.rows=[],i.header&&o){var d=u.calc("X","headerfont","abcjs-header abcjs-meta-top").height;e(this.rows,{marginLeft:c,text:i.header.left,font:"headerfont",klass:"header meta-top",marginTop:-d,info:n.header,name:"header"},u),e(this.rows,{marginLeft:c+a/2,text:i.header.center,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"middle",info:n.header,name:"header"},u),e(this.rows,{marginLeft:c+a,text:i.header.right,font:"headerfont",klass:"header meta-top",marginTop:-d,anchor:"end",info:n.header,name:"header"},u)}o&&this.rows.push({move:l.top});var p=r.titleleft?"start":"middle",f=r.titleleft?c:c+a/2;if(i.title){var m=h?"abcjs-title":"";t(this.rows,i.title,"titlefont",m,"title",f,{marginTop:l.title,anchor:p,absElemType:"title",info:n.title},u)}if(s.length)for(var g=0;g<s.length&&s[g].subtitle;)m=h?"abcjs-text abcjs-subtitle":"",t(this.rows,s[g].subtitle.text,"subtitlefont",m,"subtitle",f,{marginTop:l.subtitle,anchor:p,absElemType:"subtitle",info:s[g].subtitle},u),g++;if(i.rhythm||i.origin||i.composer){if(this.rows.push({move:l.composer}),i.rhythm&&i.rhythm.length>0){var v=!(!i.composer&&!i.origin);m=h?"abcjs-rhythm":"",e(this.rows,{marginLeft:c,text:i.rhythm,font:"infofont",klass:m,absElemType:"rhythm",noMove:v,info:n.rhythm,name:"rhythm"},u)}i.composer&&i.composer,i.origin&&i.origin;var b=i.composer?i.composer:"";i.origin&&("string"==typeof b&&"string"==typeof i.origin?b+=" ("+i.origin+")":"string"==typeof b&&"string"!=typeof i.origin?((b=[{text:b}]).push({text:" ("}),(b=b.concat(i.origin)).push({text:")"})):(b.push({text:" ("}),(b=b.concat(i.origin)).push({text:")"}))),b&&(m=h?"abcjs-composer":"",t(this.rows,b,"composerfont",m,"composer",c+a,{anchor:"end",absElemType:"composer",info:n.composer,ingroup:!0},u))}i.author&&i.author.length>0&&(m=h?"abcjs-author":"",t(this.rows,i.author,"composerfont",m,"author",c+a,{anchor:"end",absElemType:"author",info:n.author},u)),i.partOrder&&i.partOrder.length>0&&(m=h?"abcjs-part-order":"",t(this.rows,i.partOrder,"partsfont",m,"part-order",c,{absElemType:"partOrder",info:n.partOrder,anchor:"start"},u))}}(),o=function(){if($l)return Yl;$l=1;const e=ap(),t=op();function i(e,t,i,n,r,s,a){this.rows=[],e.unalignedWords&&e.unalignedWords.length>0&&this.unalignedWords(e.unalignedWords,n,r,s,a),this.extraText(e,n,r,s,a),e.footer&&i&&this.footer(e.footer,t,n,a)}function n(e,i,n,r,s,a,o){n&&(i&&(n="string"==typeof n?i+n:[{text:i}].concat(n)),t(e,n,"historyfont",s=a?"abcjs-extra-text "+s:"","description",r,{absElemType:"extraText",anchor:"start"},o))}function r(i,n,r,s,a,o,c,l,h,u,d,p){if(r){l=d?"abcjs-extra-text "+l:"";var f=p.calc("A",a,l);if("string"==typeof r)n&&(r=n+"\n"+r),e(i,{marginLeft:s,text:r,font:a,absElemType:"extraText",name:h,"dominant-baseline":"middle",klass:l},p);else{i.push({startGroup:c,klass:l,name:h}),i.push({move:u.info}),n&&(e(i,{marginLeft:s,text:n,font:a,absElemType:"extraText",name:h,"dominant-baseline":"middle"},p),i.push({move:3*f.height/4}));for(var m=0;m<r.length;m++)t(i,r[m],a,"",h,s,{anchor:"start"},p),m<r.length-1&&"string"==typeof r[m]&&"string"!=typeof r[m+1]&&i.push({move:3*f.height/4});i.push({endGroup:c,absElemType:o,startChar:-1,endChar:-1,name:h}),i.push({move:f.height})}}}return i.prototype.unalignedWords=function(e,t,i,n,s){var a=n?"abcjs-unaligned-words":"",o="wordsfont",c=s.calc("i",o,a);this.rows.push({move:i.words}),r(this.rows,"",e,t,o,"unalignedWords","unalignedWords",a,"unalignedWords",i,n,s),this.rows.push({move:c.height})},i.prototype.extraText=function(e,t,i,s,a){n(this.rows,"Book: ",e.book,t,"abcjs-book",s,a),n(this.rows,"Source: ",e.source,t,"abcjs-source",s,a),n(this.rows,"Discography: ",e.discography,t,"abcjs-discography",s,a),r(this.rows,"Notes:",e.notes,t,"historyfont","extraText","notes","abcjs-notes","description",i,s,a),n(this.rows,"Transcription: ",e.transcription,t,"abcjs-transcription",s,a),r(this.rows,"History:",e.history,t,"historyfont","extraText","history","abcjs-history","description",i,s,a),n(this.rows,"Copyright: ",e["abc-copyright"],t,"abcjs-copyright",s,a),n(this.rows,"Creator: ",e["abc-creator"],t,"abcjs-creator",s,a),n(this.rows,"Edited By: ",e["abc-edited-by"],t,"abcjs-edited-by",s,a)},i.prototype.footer=function(t,i,n,r){var s="header meta-bottom",a="footerfont";this.rows.push({startGroup:"footer",klass:s}),e(this.rows,{marginLeft:n,text:t.left,font:a,klass:s,name:"footer"},r),e(this.rows,{marginLeft:n+i/2,text:t.center,font:a,klass:s,anchor:"middle",name:"footer"},r),e(this.rows,{marginLeft:n+i,text:t.right,font:a,klass:s,anchor:"end",name:"footer"},r)},Yl=i}(),c=function(){if(Zl)return Ql;Zl=1;var e=Vd(),t=cp();function i(e){"keyboard"===this.dragMechanism&&0!==this.dragYStep&&this.dragTarget&&u.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,e),this.dragYStep=0}function n(e){switch(e.keyCode){case 38:case 40:e.preventDefault()}}function r(t){var i=!1,n=t.target.dataset.index;switch(t.keyCode){case 13:case 32:i=!0,this.dragTarget=this.selectables[n],this.dragIndex=n,this.dragMechanism="keyboard",l.bind(this)(t);break;case 38:i=!0,this.dragTarget=this.selectables[n],this.dragIndex=n,this.dragTarget&&this.dragTarget.isDraggable&&(this.dragging&&this.dragTarget.isDraggable&&this.dragTarget.absEl.highlight(void 0,this.dragColor),this.dragYStep--,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+this.dragYStep*e.STEP+")"));break;case 40:i=!0,this.dragTarget=this.selectables[n],this.dragIndex=n,this.dragMechanism="keyboard",this.dragTarget&&this.dragTarget.isDraggable&&(this.dragging&&this.dragTarget.isDraggable&&this.dragTarget.absEl.highlight(void 0,this.dragColor),this.dragYStep++,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+this.dragYStep*e.STEP+")"));break;case 9:0!==this.dragYStep&&l.bind(this)(t)}i&&t.preventDefault()}function s(e,t){var i,n,r,s,a,o,c=function(e,t){if(!t)return-1;for(var i=0;i<e.length;i++)if(t.dataset.index===e[i].svgEl.dataset.index)return i;return-1}(e.selectables,function(e){if(!e)return null;if("svg"===e.tagName)return e;if(!e.getAttribute)return null;for(var t=e.getAttribute("selectable");!t;)t=!e.parentElement||"svg"===(e=e.parentElement).tagName||e.getAttribute("selectable");return e}(t.target));return c>=0?(s=e.selectables[c].svgEl.getBBox(),a=t,o=e.scale,i=(r=s.x<=a.offsetX&&s.x+s.width>=a.offsetX&&s.y<=a.offsetY&&s.y+s.height>=a.offsetY||Math.abs(a.layerY/o-a.offsetY)<3?[a.offsetX,a.offsetY]:[a.layerX,a.layerY])[0],n=r[1]):(r=function(e){var t,i,n=1,r=1,s=e.target.closest("svg"),a=0;return s&&s.viewBox&&s.viewBox.baseVal&&(0!==s.viewBox.baseVal.width&&(n=s.viewBox.baseVal.width/s.clientWidth),0!==s.viewBox.baseVal.height&&(r=s.viewBox.baseVal.height/s.clientHeight),a=s.viewBox.baseVal.y),e.target&&"svg"===e.target.tagName?(t=e.offsetX,i=e.offsetY):(t=e.layerX,i=e.layerY),[t*=n,(i*=r)+a]}(t),c=function(e,t,i){for(var n=9999999,r=-1,s=0;s<e.selectables.length&&n>0;s++){var a=e.selectables[s];if(e.getDim(a),a.dim.left<t&&a.dim.right>t&&a.dim.top<i&&a.dim.bottom>i)r=s,n=0;else if(a.dim.top<i&&a.dim.bottom>i){var o=Math.min(Math.abs(a.dim.left-t),Math.abs(a.dim.right-t));o<n&&(n=o,r=s)}else if(a.dim.left<t&&a.dim.right>t){var c=Math.min(Math.abs(a.dim.top-i),Math.abs(a.dim.bottom-i));c<n&&(n=c,r=s)}else{var l=Math.abs(t-a.dim.left)>Math.abs(t-a.dim.right)?Math.abs(t-a.dim.right):Math.abs(t-a.dim.left),h=Math.abs(i-a.dim.top)>Math.abs(i-a.dim.bottom)?Math.abs(i-a.dim.bottom):Math.abs(i-a.dim.top),u=Math.sqrt(l*l+h*h);u<n&&(n=u,r=s)}}return r>=0&&n<=12?r:-1}(e,i=r[0],n=r[1])),{x:i,y:n,clickedOn:c}}function a(e){if(e&&e.target&&e.touches&&!(e.touches.length<1)){var t=e.target.getBoundingClientRect(),i=e.touches[0].pageX-t.left,n=e.touches[0].pageY-t.top;e.touches[0].offsetX=i,e.touches[0].offsetY=n,e.touches[0].layerX=e.touches[0].pageX,e.touches[0].layerY=e.touches[0].pageY}}function o(e){var t=e;"touchstart"===e.type&&(a(e),e.touches.length>0&&(t=e.touches[0]));var i=s(this,t);i.clickedOn>=0&&("touchstart"===e.type||0===e.button)&&this.selectables[i.clickedOn]&&(this.dragTarget=this.selectables[i.clickedOn],this.dragIndex=i.clickedOn,this.dragMechanism="mouse",this.dragMouseStart={x:i.x,y:i.y},this.dragging&&this.dragTarget.isDraggable&&(function(e){if(e){var t=f(e.svg);t["abcjs-dragging-in-progress"]=!0,m(e.svg,t)}}(this.renderer.paper),this.dragTarget.absEl.highlight(void 0,this.dragColor)))}function c(t){var i=t;if("touchmove"===t.type&&(a(t),t.touches.length>0&&(i=t.touches[0])),this.lastTouchMove=t,this.dragTarget&&this.dragging&&this.dragTarget.isDraggable&&"mouse"===this.dragMechanism&&this.dragMouseStart){var n=s(this,i),r=Math.round((n.y-this.dragMouseStart.y)/e.STEP);r!==this.dragYStep&&(this.dragYStep=r,this.dragTarget.svgEl.setAttribute("transform","translate(0,"+r*e.STEP+")"))}}function l(e){var t=e;"touchend"===e.type&&this.lastTouchMove&&(a(this.lastTouchMove),this.lastTouchMove&&this.lastTouchMove.touches&&this.lastTouchMove.touches.length>0&&(t=this.lastTouchMove.touches[0])),this.dragTarget&&(d.bind(this)(),this.dragTarget.absEl&&this.dragTarget.absEl.highlight&&(this.selected=[this.dragTarget.absEl],this.dragTarget.absEl.highlight(void 0,this.selectionColor)),u.bind(this)(this.dragTarget,this.dragYStep,this.selectables.length,this.dragIndex,t),this.dragTarget.svgEl&&this.dragTarget.svgEl.focus&&(this.dragTarget.svgEl.focus(),this.dragTarget=null,this.dragIndex=-1),function(e){if(e){var t=f(e.svg);delete t["abcjs-dragging-in-progress"],m(e.svg,t)}}(this.renderer.svg))}function h(e){e>=0&&e<this.selectables.length&&(this.dragTarget=this.selectables[e],this.dragIndex=e,this.dragMechanism="keyboard",l.bind(this)({target:this.dragTarget.svgEl}))}function u(e,i,n,r,s){for(var a=t(e,s),o=a.classes,c=a.analysis,l=0;l<this.listeners.length;l++)this.listeners[l](e.absEl.abcelem,e.absEl.tuneNumber,o.join(" "),c,{step:i,max:n,index:r,setSelection:h.bind(this)},s)}function d(){for(var e=0;e<this.selected.length;e++)this.selected[e].unhighlight(void 0,this.renderer.foregroundColor);this.selected=[]}function p(e,t){d.bind(this)();for(var i=0;i<this.staffgroups.length;i++)for(var n=this.staffgroups[i].voices,r=0;r<n.length;r++)for(var s=n[r].children,a=0;a<s.length;a++){var o=s[a].abcelem.startChar,c=s[a].abcelem.endChar;(t>o&&e<c||t===e&&t===c)&&(this.selected[this.selected.length]=s[a],s[a].highlight(void 0,this.selectionColor))}}function f(e){var t=e.getAttribute("class");t||(t="");for(var i=t.split(" "),n={},r=0;r<i.length;r++)n[i[r]]=!0;return n}function m(e,t){var i=[];for(var n in t)t.hasOwnProperty(n)&&i.push(n);e.setAttribute("class",i.join(" "))}return Ql=function(e,t){if(e.rangeHighlight=p,e.dragging)for(var s=0;s<e.selectables.length;s++){var a=e.selectables[s];"true"===a.svgEl.getAttribute("selectable")&&(a.svgEl.setAttribute("tabindex",0),a.svgEl.setAttribute("data-index",s),a.svgEl.addEventListener("keydown",n.bind(e)),a.svgEl.addEventListener("keyup",r.bind(e)),a.svgEl.addEventListener("focus",i.bind(e)))}for(var h=0;h<t.length;h++)t[h].addEventListener("touchstart",o.bind(e),{passive:!0}),t[h].addEventListener("touchmove",c.bind(e),{passive:!0}),t[h].addEventListener("touchend",l.bind(e),{passive:!0}),t[h].addEventListener("mousedown",o.bind(e)),t[h].addEventListener("mousemove",c.bind(e)),t[h].addEventListener("mouseup",l.bind(e))}}(),l=dp(),h=function(){if(_h)return yh;_h=1;var e=function(e){this.shouldAddClasses=e.shouldAddClasses,this.reset()};return e.prototype.reset=function(){this.lineNumber=null,this.voiceNumber=null,this.measureNumber=null,this.measureTotalPerLine=[],this.noteNumber=null},e.prototype.incrLine=function(){null===this.lineNumber?this.lineNumber=0:this.lineNumber++,this.voiceNumber=null,this.measureNumber=null,this.noteNumber=null},e.prototype.incrVoice=function(){null===this.voiceNumber?this.voiceNumber=0:this.voiceNumber++,this.measureNumber=null,this.noteNumber=null},e.prototype.isInMeasure=function(){return null!==this.measureNumber},e.prototype.newMeasure=function(){this.measureNumber&&(this.measureTotalPerLine[this.lineNumber]=this.measureNumber),this.measureNumber=null,this.noteNumber=null},e.prototype.startMeasure=function(){this.measureNumber=0,this.noteNumber=0},e.prototype.incrMeasure=function(){this.measureNumber++,this.noteNumber=0},e.prototype.incrNote=function(){this.noteNumber++},e.prototype.measureTotal=function(){for(var e=0,t=0;t<this.lineNumber;t++)e+=this.measureTotalPerLine[t]?this.measureTotalPerLine[t]:0;return this.measureNumber&&(e+=this.measureNumber),e},e.prototype.getCurrent=function(e){return{line:this.lineNumber,measure:this.measureNumber,measureTotal:this.measureTotal(),voice:this.voiceNumber,note:this.noteNumber}},e.prototype.generate=function(e){if(!this.shouldAddClasses)return"";var t=[];if(e&&e.length>0&&t.push(e),"abcjs-tab-number"===e)return t.join(" ");if("text instrument-name"===e)return"abcjs-text abcjs-instrument-name";if(null!==this.lineNumber&&t.push("l"+this.lineNumber),null!==this.measureNumber&&t.push("m"+this.measureNumber),null!==this.measureNumber&&t.push("mm"+this.measureTotal()),null!==this.voiceNumber&&t.push("v"+this.voiceNumber),e&&(e.indexOf("note")>=0||e.indexOf("rest")>=0||e.indexOf("lyric")>=0)&&null!==this.noteNumber&&t.push("n"+this.noteNumber),t.length>0){t=(t=t.join(" ")).split(" ");for(var i=0;i<t.length;i++)0!==t[i].indexOf("abcjs-")&&t[i].length>0&&(t[i]="abcjs-"+t[i])}return t.join(" ")},yh=e}(),u=function(){if(xh)return wh;xh=1;var e=function(e,t){this.formatting=e,this.classes=t};return e.prototype.updateFonts=function(e){e.gchordfont&&(this.formatting.gchordfont=e.gchordfont),e.tripletfont&&(this.formatting.tripletfont=e.tripletfont),e.annotationfont&&(this.formatting.annotationfont=e.annotationfont),e.vocalfont&&(this.formatting.vocalfont=e.vocalfont)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t){var i;i="string"==typeof e?(i=this.formatting[e])?{face:i.face,size:Math.round(4*i.size/3),decoration:i.decoration,style:i.style,weight:i.weight,box:i.box}:{face:"Arial",size:Math.round(16),decoration:"underline",style:"normal",weight:"normal"}:{face:e.face,size:Math.round(4*e.size/3),decoration:e.decoration,style:e.style,weight:e.weight,box:e.box};var n=this.formatting.fontboxpadding?this.formatting.fontboxpadding:.1;return i.padding=i.size*n,{font:i,attr:{"font-size":i.size,"font-style":i.style,"font-family":this.getFamily(i.face),"font-weight":i.weight,"text-decoration":i.decoration,class:this.classes.generate(t)}}},wh=e}(),d=function(){if(Ch)return kh;Ch=1;var e=function(e,t){this.getFontAndAttr=e,this.svg=t};return e.prototype.updateFonts=function(e){this.getFontAndAttr.updateFonts(e)},e.prototype.attr=function(e,t){return this.getFontAndAttr.calc(e,t)},e.prototype.getFamily=function(e){return'"'===e[0]&&'"'===e[e.length-1]?e.substring(1,e.length-1):e},e.prototype.calc=function(e,t,i,n){var r;r="string"==typeof t?this.attr(t,i):{font:{face:t.face,size:t.size,decoration:t.decoration,style:t.style,weight:t.weight},attr:{"font-size":t.size,"font-style":t.style,"font-family":this.getFamily(t.face),"font-weight":t.weight,"text-decoration":t.decoration,class:this.getFontAndAttr.classes.generate(i)}};var s=this.svg.getTextSize(e,r.attr,n);return r.font.box?{height:s.height+4*r.font.padding,width:s.width+4*r.font.padding}:s},e.prototype.baselineToCenter=function(e,t,i,n,r){return.5*this.calc(e,t,i).height+(r-n-2)*this.attr(t,i).font.size},kh=e}(),p=Mp(),f=ep(),m=function(){if(Au)return Pu;Au=1;var e=cp();return Pu=function(t){for(var i=t;i&&i.attributes&&"svg"!==i.tagName.toLowerCase()&&!i.attributes.selectable;)i=i.parentNode;if(i&&i.attributes&&i.attributes.selectable){var n=i.attributes["data-index"].nodeValue;if(n&&(n=parseInt(n,10))>=0&&n<this.selectables.length){var r=this.selectables[n],s=e(r,t);return s.index=n,s.element=r,s}}return null}}(),g=function(t,n){n=n||{},this.findSelectableElement=m,this.oneSvgPerLine=n.oneSvgPerLine,this.selectionColor=n.selectionColor,this.dragColor=n.dragColor?n.dragColor:n.selectionColor,this.dragging=!!n.dragging,this.selectTypes=n.selectTypes,this.responsive=n.responsive,this.space=3*e.SPACE,this.initialClef=n.initialClef,this.timeBasedLayout=n.timeBasedLayout,this.expandToWidest=!!n.expandToWidest,this.scale=n.scale?parseFloat(n.scale):0,this.classes=new h({shouldAddClasses:n.add_classes}),this.scale>.1||(this.scale=void 0),n.staffwidth?(this.staffwidthScreen=n.staffwidth,this.staffwidthPrint=n.staffwidth):(this.staffwidthScreen=740,this.staffwidthPrint=680),this.listeners=[],n.clickListener&&this.addSelectListener(n.clickListener),this.renderer=new i(t),this.renderer.setPaddingOverride(n),n.showDebug&&(this.renderer.showDebug=n.showDebug),n.jazzchords&&(this.jazzchords=n.jazzchords),n.accentAbove&&(this.accentAbove=n.accentAbove),n.germanAlphabet&&(this.germanAlphabet=n.germanAlphabet),n.lineThickness&&(this.lineThickness=n.lineThickness),this.renderer.controller=this,this.renderer.foregroundColor=n.foregroundColor?n.foregroundColor:"currentColor",void 0!==n.ariaLabel&&(this.renderer.ariaLabel=n.ariaLabel),this.renderer.minPadding=n.minPadding?n.minPadding:0,this.reset()};function v(e){for(var t=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=0;i<e.attributes.length;i++){var n=e.attributes[i];"height"!==n.name&&"aria-label"!=n.name&&t.setAttribute(n.name,n.value)}return t}return g.prototype.reset=function(){this.selected=[],this.staffgroups=[],this.engraver&&this.engraver.reset(),this.engraver=null,this.renderer.reset(),this.dragTarget=null,this.dragIndex=-1,this.dragMouseStart={x:-1,y:-1},this.dragYStep=0,this.lineThickness&&this.renderer.setLineThickness(this.lineThickness)},g.prototype.engraveABC=function(e,t,i){void 0===e[0]&&(e=[e]),this.reset();for(var n=0;n<e.length;n++)void 0===t&&(t=n),this.getFontAndAttr=new u(e[n].formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper),this.engraveTune(e[n],t,i)},g.prototype.adjustNonScaledItems=function(e){this.width/=e,this.renderer.adjustNonScaledItems(e)},g.prototype.getMeasureWidths=function(e){this.reset(),this.getFontAndAttr=new u(e.formatting,this.classes),this.getTextSize=new d(this.getFontAndAttr,this.renderer.paper);var t=this.jazzchords;this.setupTune(e,0),this.constructTuneElements(e),l(this.renderer,e,0,this.space,this.timeBasedLayout);for(var i,n=[],r=!0,s=0;s<e.lines.length;s++){var a=e.lines[s];if(a.staff){if(r&&(i={left:0,measureWidths:[],total:0},n.push(i),r=!1),a.staffGroup.voices.length>0)for(var o=a.staffGroup.voices[0],c=!1,h=0,p=0;p<o.children.length;p++){var f=o.children[p];c||f.isClef||f.isKeySig||(c=!0,i.left=f.x,h=f.x),"bar"===f.type&&(i.measureWidths.push(f.x-h),i.total+=f.x-h,h=f.x)}}else r=!0}return this.jazzchords=t,n},g.prototype.setupTune=function(e,i){this.classes.reset(),void 0!==e.formatting.jazzchords&&(this.jazzchords=e.formatting.jazzchords),void 0!==e.formatting.accentAbove&&(this.accentAbove=e.formatting.accentAbove),this.renderer.newTune(e),this.engraver=new t(this.getTextSize,i,{bagpipes:e.formatting.bagpipes,flatbeams:e.formatting.flatbeams,graceSlurs:!1!==e.formatting.graceSlurs,percmap:e.formatting.percmap,initialClef:this.initialClef,jazzchords:this.jazzchords,timeBasedLayout:this.timeBasedLayout,accentAbove:this.accentAbove,germanAlphabet:this.germanAlphabet}),this.engraver.setStemHeight(this.renderer.spacing.stemHeight),this.engraver.measureLength=e.getMeterFraction().num/e.getMeterFraction().den,e.formatting.staffwidth?this.width=1.33*e.formatting.staffwidth:this.width=this.renderer.isPrint?this.staffwidthPrint:this.staffwidthScreen;var n=e.formatting.scale?e.formatting.scale:this.scale;return"resize"===this.responsive&&(n=void 0),void 0===n&&(n=this.renderer.isPrint?.75:1),this.adjustNonScaledItems(n),n},g.prototype.constructTuneElements=function(e){var t,i;e.topText=new a(e.metaText,e.metaTextInfo,e.formatting,e.lines,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize);var c=!1,l=!1;for(t=0;t<e.lines.length;t++)if((i=e.lines[t]).staff)l=!0,i.staffGroup=this.engraver.createABCLine(i.staff,c?null:e.metaText.tempo,t),c=!0;else if(i.subtitle){if(l){var h=this.width/2+this.renderer.padding.left;i.nonMusic=new s(this.renderer.spacing.subtitle,e.formatting,i.subtitle,h,this.renderer.padding.left,this.getTextSize)}}else void 0!==i.text?(l=!0,i.nonMusic=new n(i.text,i.vskip,this.getFontAndAttr,this.renderer.padding.left,this.width,this.getTextSize)):void 0!==i.separator&&i.separator.lineLength&&(l=!0,i.nonMusic=new r(i.separator.spaceAbove,i.separator.lineLength,i.separator.spaceBelow));e.bottomText=new o(e.metaText,this.width,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize)},g.prototype.engraveTune=function(e,t,i){var n=this.jazzchords,r=this.setupTune(e,t);this.constructTuneElements(e);var s=l(this.renderer,e,this.width,this.space,this.expandToWidest,this.timeBasedLayout);if(this.expandToWidest&&s>this.width+1&&(e.topText=new a(e.metaText,e.metaTextInfo,e.formatting,e.lines,s,this.renderer.isPrint,this.renderer.padding.left,this.renderer.spacing,this.classes.shouldAddClasses,this.getTextSize),e.lines&&e.lines.length>0))for(var o=e.lines.length,h=0;h<o;++h){var u=e.lines[h];if(u.nonMusic&&u.nonMusic.rows&&u.nonMusic.rows.length>0)for(var d=u.nonMusic.rows.length,m=0;m<d;++m){var g=u.nonMusic.rows[m];g.left&&(u.subtitle||u.text&&u.text.length>0&&u.text[0].center)&&(g.left=s/2+this.renderer.padding.left)}}e.tablatures&&f.layoutTablatures(this.renderer,e);var b=p(this.renderer,this.classes,e,this.width,s,this.responsive,r,this.selectTypes,t,i);if(this.staffgroups=b.staffgroups,this.selectables=b.selectables,this.oneSvgPerLine){var y=this.renderer.paper.svg.parentNode;this.svgs=function(e,t,i,n,r){i||(i="Untitled");var s=t.querySelector("svg");"resize"===n&&(t.style.paddingBottom="");for(var a=s.querySelector("style"),o="resize"===n?s.viewBox.baseVal.width:s.getAttribute("width"),c=t.querySelectorAll("svg > g"),l=0,h=[],u=0;u<c.length;u++){var d=c[u],p=d.getBBox(),f=p.y-l,m=p.height+f,g=document.createElement("div"),b="overflow: hidden;";"resize"!==n&&(b+="height:"+m*r+"px;"),g.setAttribute("style",b);var y=v(s),_='Sheet Music for "'+i+'" section '+(u+1);y.setAttribute("aria-label",_),"resize"!==n&&y.setAttribute("height",m),"resize"===n&&(y.style.position="");var w=e.firefox112?m+1:m;y.setAttribute("viewBox","0 "+l+" "+o+" "+w),y.appendChild(a.cloneNode(!0));var x=document.createElement("title");x.innerText=_,y.appendChild(x),y.appendChild(d),g.appendChild(y),h.push(y),t.appendChild(g),l=p.y+p.height}return t.removeChild(s),h}(this.renderer,y,e.metaText.title,this.responsive,r)}else this.svgs=[this.renderer.paper.svg];c(this,this.svgs),this.jazzchords=n},g.prototype.getDim=function(e){if(!e.dim){var t=e.svgEl.getBBox();e.dim={left:Math.round(t.x),top:Math.round(t.y),right:Math.round(t.x+t.width),bottom:Math.round(t.y+t.height)}}return e.dim},g.prototype.addSelectListener=function(e){this.listeners[this.listeners.length]=e},Iu=g}function Tp(){if(Ou)return Lu;Ou=1;var e=tp();jd();var t=Ep(),i=Hd(),n=zd(),r={};function s(){var e=window.innerWidth;for(var t in r)if(r.hasOwnProperty(t)){var i=r[t];e-=2*i.offsetLeft,i.style.width=e+"px"}}try{window.addEventListener("resize",s),window.addEventListener("orientationChange",s)}catch(o){}function a(e,i,n,s,a){n.viewportHorizontal?(e.innerHTML='<div class="abcjs-inner"></div>',n.scrollHorizontal?(e.style.overflowX="auto",e.style.overflowY="hidden"):e.style.overflow="hidden",r[e.id]=e,e=e.children[0]):n.viewportVertical?(e.innerHTML='<div class="abcjs-inner scroll-amount"></div>',e.style.overflowX="hidden",e.style.overflowY="auto",e=e.children[0]):e.innerHTML="";var o=new t(e,n);o.engraveABC(i,s,a),i.engraver=o,(n.viewportVertical||n.viewportHorizontal)&&(e.parentNode.style.width=e.style.width)}return Lu=function(r,s,o,c,l){var h,u={};if(o){for(h in o)o.hasOwnProperty(h)&&(u[h]=o[h]);u.warnings_id&&u.tablature&&(u.tablature.warning_id=u.warnings_id)}if(c)for(h in c)c.hasOwnProperty(h)&&("listener"===h?c[h].highlight&&(u.clickListener=c[h].highlight):u[h]=c[h]);if(l)for(h in l)l.hasOwnProperty(h)&&(u[h]=l[h]);return e.renderEngine((function(e,r,s,o){var c=!1;return"*"===e&&(c=!0,(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e)),!c&&u.wrap&&u.staffwidth?r=function(e,r,s,o,c){var l=new t(e,c).getMeasureWidths(r),h=n.calcLineWraps(r,l,c);if(h.reParse){var u=new i;u.parse(o,h.revisedParams),r=u.getTune();var d=u.getWarnings();d&&(r.warnings=d)}return c.afterParsing&&c.afterParsing(r,s,o),a(e,r,h.revisedParams,s,0),r.explanation=h.explanation,r}(e,r,s,o,u):(u.afterParsing&&u.afterParsing(r,s,o),a(e,r,u,s,0),c&&e.parentNode.removeChild(e),null)}),r,s,u)}}function Pp(){return zu?Ru:(zu=1,Ru={})}function Ap(){return ju?Fu:(ju=1,Fu=["acoustic_grand_piano","bright_acoustic_piano","electric_grand_piano","honkytonk_piano","electric_piano_1","electric_piano_2","harpsichord","clavinet","celesta","glockenspiel","music_box","vibraphone","marimba","xylophone","tubular_bells","dulcimer","drawbar_organ","percussive_organ","rock_organ","church_organ","reed_organ","accordion","harmonica","tango_accordion","acoustic_guitar_nylon","acoustic_guitar_steel","electric_guitar_jazz","electric_guitar_clean","electric_guitar_muted","overdriven_guitar","distortion_guitar","guitar_harmonics","acoustic_bass","electric_bass_finger","electric_bass_pick","fretless_bass","slap_bass_1","slap_bass_2","synth_bass_1","synth_bass_2","violin","viola","cello","contrabass","tremolo_strings","pizzicato_strings","orchestral_harp","timpani","string_ensemble_1","string_ensemble_2","synth_strings_1","synth_strings_2","choir_aahs","voice_oohs","synth_choir","orchestra_hit","trumpet","trombone","tuba","muted_trumpet","french_horn","brass_section","synth_brass_1","synth_brass_2","soprano_sax","alto_sax","tenor_sax","baritone_sax","oboe","english_horn","bassoon","clarinet","piccolo","flute","recorder","pan_flute","blown_bottle","shakuhachi","whistle","ocarina","lead_1_square","lead_2_sawtooth","lead_3_calliope","lead_4_chiff","lead_5_charang","lead_6_voice","lead_7_fifths","lead_8_bass_lead","pad_1_new_age","pad_2_warm","pad_3_polysynth","pad_4_choir","pad_5_bowed","pad_6_metallic","pad_7_halo","pad_8_sweep","fx_1_rain","fx_2_soundtrack","fx_3_crystal","fx_4_atmosphere","fx_5_brightness","fx_6_goblins","fx_7_echoes","fx_8_scifi","sitar","banjo","shamisen","koto","kalimba","bagpipe","fiddle","shanai","tinkle_bell","agogo","steel_drums","woodblock","taiko_drum","melodic_tom","synth_drum","reverse_cymbal","guitar_fret_noise","breath_noise","seashore","bird_tweet","telephone_ring","helicopter","applause","gunshot","percussion"])}function Ip(){return Wu?Uu:(Wu=1,Uu=function(e){if(e)window.abcjsAudioContext=e;else if(!window.abcjsAudioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return!1;window.abcjsAudioContext=new t}return"suspended"!==window.abcjsAudioContext.state})}function Np(){if($u)return Yu;$u=1;var e=Ip();return Yu=function(){return window.abcjsAudioContext||e(),window.abcjsAudioContext}}function Lp(){if(Xu)return Ku;Xu=1;var e=Np();return Ku=function(){if(!window.Promise)return!1;if(!(window.AudioContext||window.webkitAudioContext||navigator.mozAudioContext||navigator.msAudioContext))return!1;var t=e();return t?void 0!==t.resume:void 0}}function Op(){return Zu?Qu:(Zu=1,Qu={21:"A0",22:"Bb0",23:"B0",24:"C1",25:"Db1",26:"D1",27:"Eb1",28:"E1",29:"F1",30:"Gb1",31:"G1",32:"Ab1",33:"A1",34:"Bb1",35:"B1",36:"C2",37:"Db2",38:"D2",39:"Eb2",40:"E2",41:"F2",42:"Gb2",43:"G2",44:"Ab2",45:"A2",46:"Bb2",47:"B2",48:"C3",49:"Db3",50:"D3",51:"Eb3",52:"E3",53:"F3",54:"Gb3",55:"G3",56:"Ab3",57:"A3",58:"Bb3",59:"B3",60:"C4",61:"Db4",62:"D4",63:"Eb4",64:"E4",65:"F4",66:"Gb4",67:"G4",68:"Ab4",69:"A4",70:"Bb4",71:"B4",72:"C5",73:"Db5",74:"D5",75:"Eb5",76:"E5",77:"F5",78:"Gb5",79:"G5",80:"Ab5",81:"A5",82:"Bb5",83:"B5",84:"C6",85:"Db6",86:"D6",87:"Eb6",88:"E6",89:"F6",90:"Gb6",91:"G6",92:"Ab6",93:"A6",94:"Bb6",95:"B6",96:"C7",97:"Db7",98:"D7",99:"Eb7",100:"E7",101:"F7",102:"Gb7",103:"G7",104:"Ab7",105:"A7",106:"Bb7",107:"B7",108:"C8",109:"Db8",110:"D8",111:"Eb8",112:"E8",113:"F8",114:"Gb8",115:"G8",116:"Ab8",117:"A8",118:"Bb8",119:"B8",120:"C9",121:"Db9"})}function Bp(){return id?td:(id=1,td=function(e){return Math.pow(2,e/1200)})}function Dp(){if(ad)return sd;ad=1;var e=function(){if(qu)return Vu;qu=1;var e=Pp();return Vu=function(t,i,n,r){e[i]||(e[i]={});var s=e[i];return s[n]||(s[n]=new Promise((function(e,s){var a=new XMLHttpRequest;let o=t+i+"-mp3/"+n+".mp3";a.open("GET",o,!0),a.responseType="arraybuffer",a.onload=function(){if(200===a.status){var t=r.decodeAudioData(a.response,(function(t){e({instrument:i,name:n,status:"loaded",audioBuffer:t})}),(function(){s(Error("Can't decode sound at "+o))}));t&&"function"==typeof t.catch&&t.catch(s)}else s(Error("Can't load sound at "+o+" status="+a.status))},a.onerror=function(){s(Error("Can't load sound at "+o))},a.send()})).catch((e=>{throw console.error("Didn't load note",i,n,":",e.message),e}))),s[n]}}(),t=function(){if(Gu)return Hu;Gu=1;var e=Ap();return Hu=function(t){for(var i=[],n=0;n<t.tracks.length;n++)i.push([]);var r=e[0];return t.tracks.forEach((function(t,n){t.forEach((function(t){switch(t.cmd){case"note":var s=void 0!==t.instrument?e[t.instrument]:r;if(t.duration>0){var a=t.gap?t.gap:0,o=t.duration;a=Math.min(a,2*o/3);var c={pitch:t.pitch,instrument:s,start:Math.round(1e6*t.start)/1e6,end:Math.round(1e6*(t.start+o-a))/1e6,volume:t.volume};t.startChar&&(c.startChar=t.startChar),t.endChar&&(c.endChar=t.endChar),t.style&&(c.style=t.style),t.cents&&(c.cents=t.cents),i[n].push(c)}break;case"program":r=e[t.instrument];break;case"text":break;default:console.log("Unhandled midi event",t)}}))})),i}}(),i=Ip(),n=Np(),r=Lp(),s=Op(),a=Ap(),o=ed?Ju:(ed=1,Ju=function(e){return window.URL.createObjectURL(function(e){var t,i,n=e[0],r=n.numberOfChannels,s=n.length*r*2+44,a=new ArrayBuffer(s),o=new DataView(a),c=[],l=0,h=0;for(d(1179011410),d(s-8),d(1163280727),d(544501094),d(16),u(1),u(r),d(n.sampleRate),d(2*n.sampleRate*r),u(2*r),u(16),d(1635017060),d(s-h-4),t=0;t<r;t++)c.push(n.getChannelData(t));for(;h<s;){for(t=0;t<c.length;t++)i=0|(.5+(i=Math.max(-1,Math.min(1,c[t][l])))<0?32768*i:32767*i),o.setInt16(h,i,!0),h+=2;l++}return new Blob([a],{type:"audio/wav"});function u(e){o.setUint16(h,e,!0),h+=2}function d(e){o.setUint32(h,e,!0),h+=4}}(e.audioBuffers))}),c=function(){if(rd)return nd;rd=1;var e=Pp(),t=Op(),i=Bp(),n=function(e,t,i){for(var n=0;n<2;n++)for(var r=t.getChannelData(n),s=e.getChannelData(n),a=0;a<r.length;a++)s[a+i]+=r[a]};return nd=function(r,s,a,o,c,l,h,u,d){var p=window.OfflineAudioContext||window.webkitOfflineAudioContext,f=a.len*a.tempoMultiplier;l&&(f+=l/1e3),(f-=u)<0&&(f=.005);var m=new p(2,Math.floor((f+h)*s),s),g=t[a.pitch];if(!e[a.instrument])return d&&d("placeNote skipped (instrument empty): "+a.instrument+":"+g),Promise.resolve();var v=e[a.instrument][g];return v?v.then((function(e){var t=m.createBufferSource();t.buffer=e.audioBuffer;var u,p=a.volume/96*c;return t.gainNode=m.createGain(),a.pan&&m.createStereoPanner&&(t.panNode=m.createStereoPanner(),t.panNode.pan.setValueAtTime(a.pan,0)),t.gainNode.gain.value=p,t.gainNode.gain.linearRampToValueAtTime(t.gainNode.gain.value,f),t.gainNode.gain.linearRampToValueAtTime(0,f+h),a.cents&&(t.playbackRate.value=i(a.cents)),t.panNode?(t.panNode.connect(m.destination),t.gainNode.connect(t.panNode)):t.gainNode.connect(m.destination),t.connect(t.gainNode),t.start(0),t.noteOff?t.noteOff(f+h):t.stop(f+h),m.oncomplete=function(e){if(e.renderedBuffer&&e.renderedBuffer.getChannelData)for(var t=0;t<o.length;t++){var i=o[t]*a.tempoMultiplier;l&&(i-=l/1e3),i<0&&(i=0),i=Math.floor(i*s),n(r,e.renderedBuffer,i)}d&&d("placeNote: "+a.instrument+":"+g),u()},m.startRendering(),new Promise((function(e){u=e}))})).catch((function(e){return d&&d("placeNote catch: "+e.message),Promise.resolve()})):(d&&d("placeNote skipped: "+a.instrument+":"+g),Promise.resolve())}}(),l=Pp(),h="MIDI is not supported in this browser.",u="https://paulrosen.github.io/midi-js-soundfonts/abcjs/",d="https://paulrosen.github.io/midi-js-soundfonts/FluidR3_GM/";return sd=function(){var p=this;p.audioBufferPossible=void 0,p.directSource=[],p.startTimeSec=void 0,p.pausedTimeSec=void 0,p.audioBuffers=[],p.duration=void 0,p.isRunning=!1,p.options=void 0,p.pickupLength=0,p.init=function(e){e||(e={}),e.options&&(p.options=e.options),i(e.audioContext);var t=n().currentTime;if(p.debugCallback=e.debugCallback,p.debugCallback&&p.debugCallback("init called"),p.audioBufferPossible=p._deviceCapable(),!p.audioBufferPossible)return Promise.reject({status:"NotSupported",message:h});var r=e.options?e.options:{};p.soundFontUrl=r.soundFontUrl?r.soundFontUrl:d,"/"!==p.soundFontUrl[p.soundFontUrl.length-1]&&(p.soundFontUrl+="/"),r.soundFontVolumeMultiplier||0===r.soundFontVolumeMultiplier?p.soundFontVolumeMultiplier=r.soundFontVolumeMultiplier:p.soundFontUrl===d||"https://paulrosen.github.io/midi-js-soundfonts/MusyngKite/"===p.soundFontUrl?p.soundFontVolumeMultiplier=3:p.soundFontUrl===u?p.soundFontVolumeMultiplier=.4:p.soundFontVolumeMultiplier=1,r.programOffsets?p.programOffsets=r.programOffsets:p.soundFontUrl===u?p.programOffsets={bright_acoustic_piano:20,honkytonk_piano:20,electric_piano_1:30,electric_piano_2:30,harpsichord:40,clavinet:20,celesta:20,glockenspiel:40,vibraphone:30,marimba:35,xylophone:30,tubular_bells:35,dulcimer:30,drawbar_organ:20,percussive_organ:25,rock_organ:20,church_organ:40,reed_organ:40,accordion:40,harmonica:40,acoustic_guitar_nylon:20,acoustic_guitar_steel:30,electric_guitar_jazz:25,electric_guitar_clean:15,electric_guitar_muted:35,overdriven_guitar:25,distortion_guitar:20,guitar_harmonics:30,electric_bass_finger:15,electric_bass_pick:30,fretless_bass:40,violin:105,viola:50,cello:40,contrabass:60,trumpet:10,trombone:90,alto_sax:20,tenor_sax:20,clarinet:20,flute:50,banjo:50,woodblock:20}:p.programOffsets={};var o=void 0!==r.fadeLength?parseInt(r.fadeLength,10):NaN;if(p.fadeLength=isNaN(o)?200:o,o=void 0!==r.noteEnd?parseInt(r.noteEnd,10):NaN,p.noteEnd=isNaN(o)?0:o,p.pan=r.pan,p.meterSize=1,e.visualObj)p.flattened=e.visualObj.setUpAudio(r),e.visualObj.getMeterFraction().den&&(p.meterSize=e.visualObj.getMeterFraction().num/e.visualObj.getMeterFraction().den),p.pickupLength=e.visualObj.getPickupLength();else{if(!e.sequence)return Promise.reject(new Error("Must pass in either a visualObj or a sequence"));p.flattened=e.sequence}p.millisecondsPerMeasure=e.millisecondsPerMeasure?e.millisecondsPerMeasure:e.visualObj?e.visualObj.millisecondsPerMeasure(p.flattened.tempo):1e3,p.beatsPerMeasure=e.visualObj?e.visualObj.getBeatsPerMeasure():4,p.sequenceCallback=r.sequenceCallback,p.callbackContext=r.callbackContext,p.onEnded=r.onEnded,p.meterFraction=e.visualObj?e.visualObj.getMeterFraction():{den:1};var c={},f=[],m=[],g=a[0];p.flattened.tracks.forEach((function(e){e.forEach((function(e){if("program"===e.cmd&&a[e.instrument]&&(g=a[e.instrument]),void 0!==e.pitch){var t=e.pitch,i=s[t],n=void 0!==e.instrument?a[e.instrument]:g;if(i)if(c[n]||(c[n]={}),l[n]&&l[n][i]){var r=n+":"+i;f.indexOf(r)<0&&f.push(r)}else c[n][i]=!0;else{var o=n+":"+i;console.log("Can't find note: ",t,o),m.indexOf(o)<0&&m.push(o)}}}))})),p.debugCallback&&p.debugCallback("note gathering time = "+Math.floor(1e3*(n().currentTime-t))+"ms"),t=n().currentTime;var v=[];Object.keys(c).forEach((function(e){Object.keys(c[e]).forEach((function(t){v.push({instrument:e,note:t})}))})),p.debugCallback&&p.debugCallback("notes "+JSON.stringify(v));for(var b=[],y=0;y<v.length;y+=256)b.push(v.slice(y,y+256));return new Promise((function(e,i){var r={cached:f,error:m,loaded:[]},s=0,a=function(){p.debugCallback&&p.debugCallback("loadBatch idx="+s+" len="+b.length),s<b.length?p._loadBatch(b[s],p.soundFontUrl,t).then((function(e){p.debugCallback&&p.debugCallback("loadBatch then"),t=n().currentTime,e&&(e.error&&(r.error=r.error.concat(e.error)),e.loaded&&(r.loaded=r.loaded.concat(e.loaded))),s++,a()}),i):(p.debugCallback&&p.debugCallback("resolve init"),e(r))};a()}))},p._loadBatch=function(t,i,r,s){var a=[];return t.forEach((function(t){p.debugCallback&&p.debugCallback("getNote "+t.instrument+":"+t.note),a.push(e(i,t.instrument,t.note,n()))})),Promise.all(a).then((function(e){p.debugCallback&&p.debugCallback("mp3 load time = "+Math.floor(1e3*(n().currentTime-r))+"ms");for(var a=[],o=[],c=[],l=[],h=0;h<e.length;h++){var u=e[h],d=u.instrument+":"+u.name;"loaded"===u.status?a.push(d):"pending"===u.status?c.push(d):"cached"===u.status?o.push(d):l.push(d+" "+u.message)}if(c.length>0){if(p.debugCallback&&p.debugCallback("pending "+JSON.stringify(c)),s?s*=2:s=50,s<9e4)return new Promise((function(e,t){setTimeout((function(){var n=[];for(h=0;h<c.length;h++)d=c[h].split(":"),n.push({instrument:d[0],note:d[1]});p.debugCallback&&p.debugCallback("retry "+JSON.stringify(n)),p._loadBatch(n,i,r,s).then((function(t){e(t)})).catch((function(e){t(e)}))}),s)}));for(var f=[],m=0;m<t.length;m++)f.push(t[m].instrument+"/"+t[m].note);return p.debugCallback&&p.debugCallback("loadBatch timeout"),Promise.reject(new Error("timeout attempting to load: "+f.join(", ")))}return p.debugCallback&&p.debugCallback("loadBatch resolve"),Promise.resolve({loaded:a,cached:o,error:l})})).catch((function(e){p.debugCallback&&p.debugCallback("loadBatch catch "+e.message)}))},p.prime=function(){var e=p.fadeLength/1e3;return p.isRunning=!1,p.audioBufferPossible?(p.debugCallback&&p.debugCallback("prime called"),new Promise((function(i){var r=n().currentTime,s=p.millisecondsPerMeasure/1e3/p.meterSize;if(p.duration=p.flattened.totalDuration*s,p.duration<=0)return p.audioBuffers=[],i({status:"empty",seconds:0});p.duration+=e;var a=Math.floor(n().sampleRate*p.duration);p.stop();var o=t(p.flattened);p.options.swing&&function(e,t,i,n){if(!(4!=i.den&&8!=i.den||(t=parseFloat(t),isNaN(t)||t<=50))){t>75&&(t=75),t=t/50-1;var r=.25;8===i.den&&(r/=2);for(var s=r/2,a=s*t,o=0;o<e.length;o++)for(var c=e[o],l=0;l<c.length;l++){var h=c[l];if((h.start-n)%s==0&&(h.start-n)%r!=0&&(0==l||c[l-1].start<=c[l].start-s)&&(l==c.length-1||c[l+1].start>=c[l].start+s)){var u=h.start;h.start+=a,h.volume*=1,l>0&&c[l-1].end==u&&(c[l-1].end=h.start,c[l-1].volume*=1)}}}}(o,p.options.swing,p.meterFraction,p.pickupLength),p.sequenceCallback&&p.sequenceCallback(o,p.callbackContext);var l=function(e,t){if(null==t)return null;var i=[];if(t.length){for(var n=0;n<e;n++)if(n<t.length){var r=parseFloat(t[n]);r<-1?r=-1:r>1&&(r=1),i.push(r)}else i.push(0);return i}var s=parseFloat(t);if(s*(e-1)>2)return null;for(var a=e%2==0,o=a?0-s/2:0,c=o+s,l=0;l<e;l++)(a=l%2==0)?(i.push(o),o-=s):(i.push(c),c+=s);return i}(o.length,p.pan),h={};o.forEach((function(e,t){var i=l&&l.length>t?l[t]:0;e.forEach((function(e){var t=e.instrument+":"+e.pitch+":"+e.volume+":"+Math.round(1e3*(e.end-e.start))/1e3+":"+i+":"+s+":"+(e.cents?e.cents:0);p.debugCallback&&p.debugCallback("noteMapTrack "+t),h[t]||(h[t]=[]),h[t].push(e.start)}))}));for(var u=[],d=n().createBuffer(2,a,n().sampleRate),f=0;f<Object.keys(h).length;f++){var m=Object.keys(h)[f],g=m.split(":"),v=void 0!==g[6]?parseFloat(g[6]):0;g={instrument:g[0],pitch:parseInt(g[1],10),volume:parseInt(g[2],10),len:parseFloat(g[3]),pan:parseFloat(g[4]),tempoMultiplier:parseFloat(g[5]),cents:v},u.push(c(d,n().sampleRate,g,h[m],p.soundFontVolumeMultiplier,p.programOffsets[g.instrument],e,p.noteEnd/1e3,p.debugCallback))}function b(e){var t=e&&e.audioBuffers&&e.audioBuffers.length>0?e.audioBuffers[0].duration:0;return{status:n().state,duration:t}}p.audioBuffers=[d],p.debugCallback&&(p.debugCallback("sampleRate = "+n().sampleRate),p.debugCallback("totalSamples = "+a),p.debugCallback("creationTime = "+Math.floor(1e3*(n().currentTime-r))+"ms")),Promise.all(u).then((function(){"suspended"===n().state?n().resume().then((function(){i(b(p))})):"interrupted"===n().state?n().suspend().then((function(){n().resume().then((function(){i(b(p))}))})):i(b(p))}))}))):Promise.reject(new Error(h))},p.start=function(){if(!p.audioBufferPossible)throw new Error(h);p.debugCallback&&p.debugCallback("start called");var e=p.pausedTimeSec?p.pausedTimeSec:0;p._kickOffSound(e),p.startTimeSec=n().currentTime-e,p.pausedTimeSec=void 0,p.debugCallback&&p.debugCallback("MIDI STARTED",p.startTimeSec)},p.pause=function(){if(!p.audioBufferPossible)throw new Error(h);return p.debugCallback&&p.debugCallback("pause called"),p.pausedTimeSec=p.stop(),p.pausedTimeSec},p.resume=function(){p.start()},p.seek=function(e,t){var i;switch(t){case"seconds":i=e;break;case"beats":i=e*p.millisecondsPerMeasure/p.beatsPerMeasure/1e3;break;default:i=(p.duration-p.fadeLength/1e3)*e}if(!p.audioBufferPossible)throw new Error(h);p.debugCallback&&p.debugCallback("seek called sec="+i),p.isRunning?(p.stop(),p._kickOffSound(i)):p.pausedTimeSec=i,p.pausedTimeSec=i},p.stop=function(){return p.isRunning=!1,p.pausedTimeSec=void 0,p.directSource.forEach((function(e){try{e.stop()}catch(t){console.log("direct source didn't stop:",t)}})),p.directSource=[],n().currentTime-p.startTimeSec},p.finished=function(){p.startTimeSec=void 0,p.pausedTimeSec=void 0,p.isRunning=!1},p.download=function(){return o(p)},p.getAudioBuffer=function(){return p.audioBuffers[0]},p.getIsRunning=function(){return p.isRunning},p._deviceCapable=function(){return!!r()||(console.warn(h),p.debugCallback&&p.debugCallback(h),!1)},p._kickOffSound=function(e){p.isRunning=!0,p.directSource=[],p.audioBuffers.forEach((function(e,t){p.directSource[t]=n().createBufferSource(),p.directSource[t].buffer=e,p.directSource[t].connect(n().destination)})),p.directSource.forEach((function(t){t.start(0,e)})),p.onEnded&&(p.directSource[0].onended=function(){p.onEnded(p.callbackContext)})}}}function Rp(){return cd?od:(cd=1,od=function(){var e=this;e.tracks=[],e.totalDuration=0,e.currentInstrument=[],e.starts=[],e.addTrack=function(){return e.tracks.push([]),e.currentInstrument.push(0),e.starts.push(0),e.tracks.length-1},e.setInstrument=function(t,i){e.tracks[t].push({channel:0,cmd:"program",instrument:i}),e.currentInstrument[t]=i},e.appendNote=function(t,i,n,r,s){var a={cmd:"note",duration:n,gap:0,instrument:e.currentInstrument[t],pitch:i,start:e.starts[t],volume:r};s&&(a.cents=s),e.tracks[t].push(a),e.starts[t]+=n,e.totalDuration=Math.max(e.totalDuration,e.starts[t])}})}function zp(){if(_d)return yd;_d=1;var e=Lp(),t=Ip(),i=Np(),n=hd?ld:(hd=1,ld='\n<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 700" preserveAspectRatio="xMidYMid meet">\n\t<g transform="translate(0,700) scale(0.1,-0.1)" >\n\t<path d="M3111 6981 c-20 -37 -90 -55 -364 -96 -120 -18 -190 -33 -244 -55\n\t-42 -17 -124 -42 -182 -56 -78 -18 -119 -34 -157 -60 -28 -19 -86 -46 -128\n\t-60 -43 -13 -107 -42 -144 -64 -37 -23 -84 -46 -106 -52 -21 -7 -56 -29 -79\n\t-50 -22 -22 -61 -50 -86 -63 -26 -13 -67 -40 -91 -60 -24 -20 -65 -47 -90 -60\n\t-25 -13 -53 -31 -61 -41 -8 -9 -32 -30 -54 -46 -75 -54 -486 -460 -512 -507\n\t-15 -25 -48 -69 -75 -98 -26 -28 -48 -57 -48 -63 0 -6 -18 -29 -39 -53 -21\n\t-23 -56 -71 -77 -107 -20 -36 -50 -80 -65 -97 -16 -18 -33 -52 -40 -75 -12\n\t-47 -47 -115 -84 -166 -13 -18 -30 -56 -38 -83 -8 -27 -34 -80 -56 -118 -33\n\t-53 -46 -91 -62 -167 -12 -63 -34 -127 -59 -179 -42 -84 -60 -166 -60 -270 0\n\t-90 26 -122 125 -154 54 -17 96 -19 430 -20 305 -1 381 2 430 14 82 22 140 51\n\t153 78 6 12 22 47 37 77 14 30 38 77 54 103 15 27 34 73 40 103 7 30 28 78 48\n\t107 19 28 44 74 55 101 10 28 34 67 53 87 18 20 49 61 68 90 19 30 44 63 57\n\t74 13 11 36 40 52 65 59 94 232 270 306 313 20 11 57 37 82 58 25 20 70 52\n\t100 72 30 19 66 47 79 61 13 14 49 35 80 46 30 12 80 37 111 56 31 19 95 45\n\t143 58 48 12 110 37 139 55 63 40 127 55 323 76 83 9 208 28 279 41 156 29\n\t165 29 330 4 453 -71 514 -84 606 -130 31 -16 83 -36 116 -45 32 -9 84 -34\n\t115 -56 31 -21 82 -48 113 -60 32 -11 72 -33 89 -48 18 -16 59 -45 92 -65 33\n\t-21 74 -51 90 -66 17 -15 49 -40 73 -54 52 -32 65 -61 50 -113 -8 -31 -61 -90\n\t-277 -308 -300 -303 -361 -382 -369 -481 -2 -29 0 -66 6 -81 13 -40 88 -138\n\t115 -151 12 -6 54 -26 92 -44 l70 -33 945 -2 c520 -1 975 2 1012 7 64 8 191\n\t50 231 76 11 7 33 34 50 60 22 34 42 51 65 58 l32 9 0 1101 0 1102 -32 9 c-21\n\t7 -44 26 -64 55 -60 84 -77 97 -140 110 -44 9 -76 10 -127 2 -59 -9 -77 -17\n\t-134 -62 -37 -28 -172 -155 -301 -281 -129 -127 -249 -237 -267 -245 -25 -10\n\t-41 -11 -71 -2 -58 15 -112 45 -124 69 -6 11 -35 35 -64 54 -28 18 -58 41 -66\n\t50 -8 9 -41 35 -75 58 -33 22 -77 56 -99 75 -21 18 -64 46 -95 61 -31 14 -73\n\t39 -93 55 -20 15 -70 40 -110 55 -40 15 -97 44 -127 64 -29 21 -78 44 -107 53\n\t-30 8 -77 31 -105 51 -42 28 -73 39 -173 60 -68 14 -154 39 -196 58 -95 43\n\t-131 51 -343 76 -209 24 -242 32 -279 70 l-30 29 -328 0 c-312 0 -330 -1 -339\n\t-19z"></path>\n\t<path d="M254 2875 c-89 -16 -107 -26 -145 -78 -32 -44 -62 -66 -91 -67 -17 0\n\t-18 -61 -18 -1140 l0 -1140 24 0 c16 0 41 -17 72 -50 40 -42 61 -55 117 -72\n\tl69 -21 82 23 c44 12 96 30 114 39 18 9 148 132 290 272 141 141 267 261 279\n\t268 51 26 86 14 176 -61 32 -26 62 -48 66 -48 5 0 36 -25 70 -55 34 -30 74\n\t-61 89 -69 15 -8 37 -28 50 -45 12 -17 50 -45 84 -62 34 -17 78 -44 98 -60 19\n\t-16 61 -37 93 -48 32 -11 81 -37 107 -56 27 -20 76 -45 109 -56 33 -12 75 -31\n\t93 -44 62 -45 93 -58 191 -82 54 -12 130 -37 168 -54 68 -29 180 -58 226 -59\n\t62 0 183 -64 183 -96 0 -12 88 -14 639 -14 l639 0 12 30 c18 44 76 66 233 89\n\t89 14 160 30 200 47 34 15 106 42 159 60 54 18 112 44 130 57 47 35 85 52 146\n\t67 29 7 76 28 105 48 29 20 77 48 107 63 30 15 66 39 80 54 14 15 50 40 81 56\n\t31 15 78 46 104 69 26 22 61 46 79 54 17 7 43 26 56 42 14 16 41 41 60 56 64\n\t48 380 362 408 405 15 23 40 51 55 63 15 12 36 38 46 58 11 21 37 57 58 82 22\n\t25 49 62 62 83 13 20 38 56 57 78 19 23 50 74 69 113 19 39 46 86 59 104 14\n\t18 34 62 46 98 12 36 32 77 45 92 31 38 60 97 80 167 9 33 26 76 37 95 29 50\n\t47 103 68 206 10 52 32 117 51 155 29 56 33 74 34 140 0 94 -10 108 -101 138\n\t-61 20 -83 21 -463 21 -226 0 -421 -4 -451 -10 -63 -12 -86 -30 -110 -85 -10\n\t-22 -33 -63 -52 -92 -21 -31 -42 -80 -53 -123 -11 -44 -32 -93 -56 -128 -20\n\t-32 -47 -83 -59 -115 -12 -32 -37 -77 -56 -100 -19 -23 -50 -65 -69 -94 -19\n\t-29 -44 -57 -54 -63 -11 -5 -29 -27 -42 -47 -52 -85 -234 -277 -300 -315 -25\n\t-15 -53 -38 -62 -51 -9 -14 -42 -39 -74 -57 -32 -18 -75 -48 -95 -66 -21 -18\n\t-59 -44 -85 -58 -26 -13 -72 -40 -100 -59 -35 -24 -78 -41 -128 -52 -47 -11\n\t-99 -31 -139 -56 -69 -42 -94 -49 -391 -110 -245 -51 -425 -66 -595 -50 -168\n\t16 -230 27 -330 61 -47 16 -123 35 -170 44 -98 17 -123 25 -172 58 -20 14 -71\n\t37 -114 53 -44 15 -95 40 -115 56 -20 16 -70 42 -110 59 -40 16 -88 45 -108\n\t63 -20 19 -55 46 -78 61 -24 14 -49 35 -55 47 -7 11 -34 33 -60 49 -50 31 -65\n\t61 -53 102 4 13 130 147 281 298 236 238 277 283 299 335 15 32 35 71 46 86\n\t12 18 19 44 19 76 0 42 -8 63 -53 138 -92 151 11 139 -1207 141 -798 2 -1030\n\t0 -1086 -11z"></path>\n\t</g>\n</svg>\n'),r=dd?ud:(dd=1,ud='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-play-svg">\n <g>\n <polygon points="4 0 23 12.5 4 25"/>\n </g>\n</svg>\n'),s=fd?pd:(fd=1,pd='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" class="abcjs-pause-svg">\n <g>\n <rect width="8.23" height="25"/>\n <rect width="8.23" height="25" x="17"/>\n </g>\n</svg>\n'),a=gd?md:(gd=1,md='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="abcjs-loading-svg">\n <circle cx="50" cy="50" fill="none" stroke-width="20" r="35" stroke-dasharray="160 55"></circle>\n</svg>\n'),o=bd?vd:(bd=1,vd='\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25">\n <g>\n <polygon points="5 12.5 24 0 24 25"/>\n <rect width="3" height="25" x="0" y="0"/>\n </g>\n</svg>\n');function c(n,r,s,a,o){var c=!0;if(i()?c="suspended"===i().state:t(),!e())throw{status:"NotSupported",message:"This browser does not support audio."};(c||o)&&s&&s.classList.add("abcjs-loading"),c?i().resume().then((function(){a?a().then((function(e){l(n,r,s,o)})):l(n,r,s,o)})):l(n,r,s,o)}function l(e,t,i,n){n?e(t).then((function(){i&&i.classList.remove("abcjs-loading")})):(e(t),i&&i.classList.remove("abcjs-loading"))}return yd=function(e,l){var h,u,d,p,f,m,g,v=this;if("string"==typeof e){var b=e;if(!(e=document.querySelector(b)))throw new Error('Cannot find element "'+b+'" in the DOM.')}else if(!(e instanceof HTMLElement))throw new Error("The first parameter must be a valid element or selector in the DOM.");if(v.parent=e,v.options={},l&&(v.options=Object.assign({},l)),v.options.ac&&t(v.options.ac),function(e,t){var i=!!t.loopHandler,c=!!t.restartHandler,l=!!t.playHandler||!!t.playPromiseHandler,h=!!t.progressHandler,u=!!t.warpHandler,d=!1!==t.hasClock,p='<div class="abcjs-inline-audio">\n';if(i){var f=t.repeatTitle?t.repeatTitle:"Click to toggle play once/repeat.";p+='<button type="button" class="abcjs-midi-loop abcjs-btn" title="'+f+'" aria-label="'+(t.repeatAria?t.repeatAria:f)+'">'+n+"</button>\n"}if(c){var m=t.restartTitle?t.restartTitle:"Click to go to beginning.";p+='<button type="button" class="abcjs-midi-reset abcjs-btn" title="'+m+'" aria-label="'+(t.restartAria?t.restartAria:m)+'">'+o+"</button>\n"}if(l){var g=t.playTitle?t.playTitle:"Click to play/pause.";p+='<button type="button" class="abcjs-midi-start abcjs-btn" title="'+g+'" aria-label="'+(t.playAria?t.playAria:g)+'">'+r+s+a+"</button>\n"}if(h){var v=t.randomTitle?t.randomTitle:"Click to change the playback position.";p+='<button type="button" class="abcjs-midi-progress-background" title="'+v+'" aria-label="'+(t.randomAria?t.randomAria:v)+'"><span class="abcjs-midi-progress-indicator"></span></button>\n'}if(d&&(p+='<span class="abcjs-midi-clock"></span>\n'),u){var b=t.warpTitle?t.warpTitle:"Change the playback speed.";p+='<span class="abcjs-tempo-wrapper"><label><input class="abcjs-midi-tempo" type="number" min="1" max="300" value="100" title="'+b+'" aria-label="'+(t.warpAria?t.warpAria:b)+'">%</label><span>&nbsp;(<span class="abcjs-midi-current-tempo"></span> '+(t.bpm?t.bpm:"BPM")+")</span></span>\n"}p+='<div class="abcjs-css-warning" style="font-size: 12px;color:red;border: 1px solid red;text-align: center;width: 300px;margin-top: 4px;font-weight: bold;border-radius: 4px;">CSS required: load abcjs-audio.css</div>',p+="</div>\n",e.innerHTML=p}(v.parent,v.options),u=!!(h=v).options.loopHandler,d=!!h.options.restartHandler,p=!!h.options.playHandler||!!h.options.playPromiseHandler,f=!!h.options.progressHandler,m=!!h.options.warpHandler,g=h.parent.querySelector(".abcjs-midi-start"),u&&h.parent.querySelector(".abcjs-midi-loop").addEventListener("click",(function(e){c(h.options.loopHandler,e,g,h.options.afterResume)})),d&&h.parent.querySelector(".abcjs-midi-reset").addEventListener("click",(function(e){c(h.options.restartHandler,e,g,h.options.afterResume)})),p&&g.addEventListener("click",(function(e){c(h.options.playPromiseHandler||h.options.playHandler,e,g,h.options.afterResume,!!h.options.playPromiseHandler)})),f&&h.parent.querySelector(".abcjs-midi-progress-background").addEventListener("click",(function(e){c(h.options.progressHandler,e,g,h.options.afterResume)})),m&&h.parent.querySelector(".abcjs-midi-tempo").addEventListener("change",(function(e){c(h.options.warpHandler,e,g,h.options.afterResume)})),v.disable=function(e){var t=v.parent.querySelector(".abcjs-inline-audio");e?t.classList.add("abcjs-disabled"):t.classList.remove("abcjs-disabled")},v.setWarp=function(e,t){v.parent.querySelector(".abcjs-midi-tempo").value=Math.round(t),v.setTempo(e)},v.setTempo=function(e){var t=v.parent.querySelector(".abcjs-midi-current-tempo");t&&(t.innerHTML=Math.round(e))},v.resetAll=function(){for(var e=v.parent.querySelectorAll(".abcjs-pushed"),t=0;t<e.length;t++)e[t].classList.remove("abcjs-pushed")},v.pushPlay=function(e){var t=v.parent.querySelector(".abcjs-midi-start");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},v.pushLoop=function(e){var t=v.parent.querySelector(".abcjs-midi-loop");t&&(e?t.classList.add("abcjs-pushed"):t.classList.remove("abcjs-pushed"))},v.setProgress=function(e,t){var i=v.parent.querySelector(".abcjs-midi-progress-background"),n=v.parent.querySelector(".abcjs-midi-progress-indicator");if(i&&n){var r=i.clientWidth*e;n.style.left=r+"px";var s=v.parent.querySelector(".abcjs-midi-clock");if(s){var a=t*e/1e3,o=Math.floor(a/60),c=Math.floor(a%60),l=c<10?"0"+c:c;s.innerHTML=o+":"+l}}},v.options.afterResume){var y=!1;v.options.ac?y="suspended"!==v.options.ac.state:i()&&(y="suspended"!==i().state),y&&v.options.afterResume()}}}function Vp(){if(Cd)return kd;Cd=1;var e=zp(),t=Dp(),i=Po(),n=Np();return kd=function(){var r=this;r.warp=100,r.cursorControl=null,r.visualObj=null,r.timer=null,r.midiBuffer=null,r.options=null,r.currentTempo=null,r.control=null,r.isLooping=!1,r.isStarted=!1,r.isLoaded=!1,r.isLoading=!1,r.load=function(t,i,n){n||(n={}),void 0===n.displayPlay&&(n.displayPlay=!0),void 0===n.displayProgress&&(n.displayProgress=!0),r.control=new e(t,{loopHandler:n.displayLoop?r.toggleLoop:void 0,restartHandler:n.displayRestart?r.restart:void 0,playPromiseHandler:n.displayPlay?r.play:void 0,progressHandler:n.displayProgress?r.randomAccess:void 0,warpHandler:n.displayWarp?r.onWarp:void 0,afterResume:r.init}),r.cursorControl=i,r.disable(!0)},r.disable=function(e){r.control&&r.control.disable(e)},r.setTune=function(e,t,i){return r.visualObj=e,r.disable(!1),r.options=i||{},r.control&&(r.pause(),r.setProgress(0,1),r.control.resetAll(),r.restart(),r.isStarted=!1),r.isLooping=!1,t?r.go():Promise.resolve({status:"no-audio-context"})},r.go=function(){r.isLoading=!0;var e,s=100*r.visualObj.millisecondsPerMeasure()/r.warp;return r.currentTempo=Math.round(r.visualObj.getBeatsPerMeasure()/s*6e4),r.control&&r.control.setTempo(r.currentTempo),r.percent=0,r.midiBuffer||(r.midiBuffer=new t),n().resume().then((function(e){return r.midiBuffer.init({visualObj:r.visualObj,options:r.options,millisecondsPerMeasure:s})})).then((function(t){return e=t,r.midiBuffer.prime()})).then((function(){var t=16;return r.cursorControl&&void 0!==r.cursorControl.beatSubdivisions&&parseInt(r.cursorControl.beatSubdivisions,10)>=1&&parseInt(r.cursorControl.beatSubdivisions,10)<=64&&(t=parseInt(r.cursorControl.beatSubdivisions,10)),r.timer=new i(r.visualObj,{beatCallback:r.beatCallback,eventCallback:r.eventCallback,lineEndCallback:r.lineEndCallback,qpm:r.currentTempo,extraMeasuresAtBeginning:r.cursorControl?r.cursorControl.extraMeasuresAtBeginning:void 0,lineEndAnticipation:r.cursorControl?r.cursorControl.lineEndAnticipation:0,beatSubdivisions:t}),r.cursorControl&&r.cursorControl.onReady&&"function"==typeof r.cursorControl.onReady&&r.cursorControl.onReady(r),r.isLoaded=!0,r.isLoading=!1,Promise.resolve({status:"created",notesStatus:e})}))},r.destroy=function(){r.timer&&(r.timer.reset(),r.timer.stop(),r.timer=null),r.midiBuffer&&(r.midiBuffer.stop(),r.midiBuffer=null),r.setProgress(0,1),r.control&&r.control.resetAll()},r.play=function(){return r.runWhenReady(r._play,void 0)},r.runWhenReady=function(e,t){return r.visualObj?r.isLoading?new Promise((function(e){setTimeout(e,500)})).then((function(){return r.isLoading?r.runWhenReady(e,t):e(t)})):r.isLoaded?e(t):r.go().then((function(){return e(t)})):Promise.resolve({status:"loading"})},r._play=function(){return n().resume().then((function(){return r.isStarted=!r.isStarted,r.isStarted?(r.cursorControl&&r.cursorControl.onStart&&"function"==typeof r.cursorControl.onStart&&r.cursorControl.onStart(),r.midiBuffer.start(),r.timer.start(r.percent),r.control&&r.control.pushPlay(!0)):r.pause(),Promise.resolve({status:"ok"})}))},r.pause=function(){r.timer&&(r.timer.pause(),r.midiBuffer.pause(),r.control&&r.control.pushPlay(!1))},r.toggleLoop=function(){r.isLooping=!r.isLooping,r.control&&r.control.pushLoop(r.isLooping)},r.restart=function(){r.timer&&(r.timer.setProgress(0),r.midiBuffer.seek(0))},r.randomAccess=function(e){return r.runWhenReady(r._randomAccess,e)},r._randomAccess=function(e){var t=e.target.classList.contains("abcjs-midi-progress-indicator")?e.target.parentNode:e.target,i=(e.x-t.getBoundingClientRect().left)/t.offsetWidth;return i<0&&(i=0),i>1&&(i=1),r.seek(i),Promise.resolve({status:"ok"})},r.seek=function(e,t){r.timer&&r.midiBuffer&&(r.timer.setProgress(e,t),r.midiBuffer.seek(e,t))},r.setWarp=function(e){if(parseInt(e,10)>0){r.warp=parseInt(e,10);var t=r.isStarted,i=r.percent;return r.destroy(),r.isStarted=!1,r.go().then((function(){return r.setProgress(i,1e3*r.midiBuffer.duration),r.control&&r.control.setWarp(r.currentTempo,r.warp),t?r.play().then((function(){return r.seek(i),Promise.resolve()})):(r.seek(i),Promise.resolve())}))}return Promise.resolve()},r.onWarp=function(e){var t=e.target.value;return r.setWarp(t)},r.setProgress=function(e,t){r.percent=e,r.control&&r.control.setProgress(e,t)},r.finished=function(){if(r.timer.reset(),r.isLooping)return r.timer.start(0),r.midiBuffer.finished(),r.midiBuffer.start(),"continue";r.timer.stop(),r.isStarted&&(r.control&&r.control.pushPlay(!1),r.isStarted=!1,r.midiBuffer.finished(),r.cursorControl&&r.cursorControl.onFinished&&"function"==typeof r.cursorControl.onFinished&&r.cursorControl.onFinished(),r.setProgress(0,1))},r.beatCallback=function(e,t,i,n){var s=e/t;r.setProgress(s,i),r.cursorControl&&r.cursorControl.onBeat&&"function"==typeof r.cursorControl.onBeat&&r.cursorControl.onBeat(e,t,i,n)},r.eventCallback=function(e){if(!e)return r.finished();r.cursorControl&&r.cursorControl.onEvent&&"function"==typeof r.cursorControl.onEvent&&r.cursorControl.onEvent(e)},r.lineEndCallback=function(e,t){r.cursorControl&&r.cursorControl.onLineEnd&&"function"==typeof r.cursorControl.onLineEnd&&r.cursorControl.onLineEnd(e,t)},r.getUrl=function(){return r.midiBuffer.download()},r.download=function(e){var t=r.getUrl(),i=document.createElement("a");document.body.appendChild(i),i.setAttribute("style","display: none;"),i.href=t,i.download=e||"output.wav",i.click(),window.URL.revokeObjectURL(t),document.body.removeChild(i)}}}function qp(){if(Md)return Sd;Md=1;var e,t=Bp();return function(){function i(e,t){for(var i in t)t.hasOwnProperty(i)&&e.setAttribute(i,t[i]);return e}function n(){this.trackstrings="",this.trackcount=0,this.noteOnAndChannel="%90",this.noteOffAndChannel="%80"}function r(e,t){for(var i="",n=0;n<e.length;n++)i+=s(e.charCodeAt(n),2);return"%00%FF"+t+s(i.length/3,2)+i}function s(e,t){var i=e.toString(16);for(i=i.split(".")[0];i.length<t;)i="0"+i;return i.length>t&&(i=i.substring(0,t)),function(e){for(var t="",i=0;i<e.length;i+=2)t+="%",t+=e.substr(i,2);return t}(i)}function a(e){var t=(e=Math.round(e))%128;return s(2*(e-t)+t,4)}function o(e){var t=0,i=[];for(e=Math.round(e);0!==e;)i.push(127&e),e>>=7;for(var n=i.length-1;n>=0;n--){t<<=8;var r=i[n];0!==n&&(r|=128),t|=r}var a=t.toString(16).length;return s(t,a+=a%2)}n.prototype.setTempo=function(e){0===this.trackcount&&(this.startTrack(),this.track+="%00%FF%51%03"+s(Math.round(6e7/e),6),this.endTrack())},n.prototype.setGlobalInfo=function(e,t,i,n){if(0===this.trackcount){this.startTrack();var a=Math.round(6e7/e);this.track+="%00%FF%51%03"+s(a,6),i&&(this.track+=function(e){if(!e||!e.accidentals)return"";for(var t=0,i=256,n=0;n<e.accidentals.length;n++)"sharp"===e.accidentals[n].acc?t++:"flat"===e.accidentals[n].acc&&i--;return"%00%FF%59%02"+s(256!==i?i:t,2)+("m"===e.mode?"%01":"%00")}(i)),n&&(this.track+=function(e){var t,i="%00%FF%58%04"+s(e.num,2),n={1:0,2:1,4:2,8:3,16:4,32:5}[e.den];if(!n)return"";switch(i+=s(n,2),e.num+"/"+e.den){case"2/4":case"3/4":case"4/4":case"5/4":t=24;break;case"6/4":t=72;break;case"2/2":case"3/2":case"4/2":t=48;break;case"3/8":case"6/8":case"9/8":case"12/8":t=36}return t?(i+=s(t,2))+"%08":""}(n)),t&&(this.track+=r(t,"%01")),this.endTrack()}},n.prototype.startTrack=function(){this.noteWarped={},this.track="",this.trackName="",this.trackInstrument="",this.silencelength=0,this.trackcount++,this.instrument&&this.setInstrument(this.instrument)},n.prototype.endTrack=function(){this.track=this.trackName+this.trackInstrument+this.track;var e=s(this.track.length/3+4,8);this.track="MTrk"+e+this.track+"%00%FF%2F%00",this.trackstrings+=this.track},n.prototype.setText=function(e,t){"name"===e&&(this.trackName=r(t,"%03"))},n.prototype.setInstrument=function(e){this.trackInstrument="%00%C0"+s(e,2),this.instrument=e},n.prototype.setChannel=function(e,t){this.channel=e;var i="%00%B"+this.channel.toString(16);this.track+=i+"%79%00",this.track+=i+"%40%00",this.track+=i+"%5B%30",t||(t=0),t=Math.round(64*(t+1)),this.track+=i+"%0A"+s(t,2),this.track+=i+"%07%64",this.noteOnAndChannel="%9"+this.channel.toString(16),this.noteOffAndChannel="%8"+this.channel.toString(16)},n.prototype.startNote=function(e,i,n){if(this.track+=o(this.silencelength),this.silencelength=0,n){this.track+="%e"+this.channel.toString(16);var r=Math.round(4096*t(n));this.track+=a(8192+r),this.track+=o(0),this.noteWarped[e]=!0}this.track+=this.noteOnAndChannel,this.track+="%"+e.toString(16)+s(i,2)},n.prototype.endNote=function(e){this.track+=o(this.silencelength),this.silencelength=0,this.noteWarped[e]&&(this.track+="%e"+this.channel.toString(16),this.track+=a(8192),this.track+=o(0),this.noteWarped[e]=!1),this.track+=this.noteOffAndChannel,this.track+="%"+e.toString(16)+"%00"},n.prototype.addRest=function(e){this.silencelength+=e,this.silencelength<0&&(this.silencelength=0)},n.prototype.getData=function(){return"data:audio/midi,MThd%00%00%00%06%00%01"+s(this.trackcount,4)+"%01%e0"+this.trackstrings},n.prototype.embed=function(e,t){var n=this.getData(),r=i(document.createElement("a"),{href:n});if(r.innerHTML="download midi",e.insertBefore(r,e.firstChild),!t){var s=i(document.createElement("embed"),{src:n,type:"video/quicktime",controller:"true",autoplay:"false",loop:"false",enablejavascript:"true",style:"display:block; height: 20px;"});e.insertBefore(s,e.firstChild)}},e=function(){return new n}}(),Sd=e}function Fp(){if(Nd)return Id;Nd=1;try{if("function"!=typeof window.CustomEvent){var e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i};e.prototype=window.Event.prototype,window.CustomEvent=e}}catch(i){}var t=function(e){this.textarea="string"==typeof e?document.getElementById(e):e,this.initialText=this.textarea.value,this.isDragging=!1};return t.prototype.addSelectionListener=function(e){this.textarea.onmousemove=function(t){this.isDragging&&e.fireSelectionChanged()}},t.prototype.addChangeListener=function(e){this.changelistener=e,this.textarea.onkeyup=function(){e.fireChanged()},this.textarea.onmousedown=function(){this.isDragging=!0,e.fireSelectionChanged()},this.textarea.onmouseup=function(){this.isDragging=!1,e.fireChanged()},this.textarea.onchange=function(){e.fireChanged()}},t.prototype.getSelection=function(){return{start:this.textarea.selectionStart,end:this.textarea.selectionEnd}},t.prototype.setSelection=function(e,t){if(this.textarea.setSelectionRange)this.textarea.setSelectionRange(e,t);else if(this.textarea.createTextRange){var i=this.textarea.createTextRange();i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",e),i.select()}this.textarea.focus()},t.prototype.getString=function(){return this.textarea.value},t.prototype.setString=function(e){this.textarea.value=e,this.initialText=this.getString(),this.changelistener&&this.changelistener.fireChanged()},t.prototype.getElem=function(){return this.textarea},Id=t}const jp=xr(function(){if(Dd)return Bd;Dd=1;var e=so?ro:(so=1,ro="6.4.4"),t=Ao(),i=tp(),n=qd(),r=function(){if(Gc)return Hc;Gc=1;var e,t=Bo(),{relativeMajor:i,transposeKey:n,relativeMode:r}=Oo(),s=Lo();return function(){function a(e,t,i){var n=[],r=t.getKeySignature();if("Hp"===r.root||"HP"===r.root)return n;n=n.concat(function(e,t){for(var i=[],n=e.split("K:"),r=n[0].length,s=1;s<n.length;s++){var a=n[s],o=a.match(/^( *)([A-G])([#b]?)(\w*)/);if(o){var c=r+2+o[1].length,l=o[2]+o[3]+o[4],h=p({root:o[2],acc:o[3],mode:o[4]},t),u=h.root+h.acc+h.mode;i.push({start:c,end:c+l.length,note:u})}r+=a.length+2}return i}(e,i));for(var s=0;s<t.lines.length;s++){var a=t.lines[s].staff;if(a)for(var c=0;c<a.length;c++){var l=a[c];"perc"!==l.clef.type&&(n=n.concat(o(e,l.voices,l.key,i)))}}return n}function o(e,t,i,n){for(var r=[],s=p(i,n),a=0;a<t.length;a++)r=r.concat(h(e,t[a],i.root,c(i),s,n));return r}function c(e){for(var t={},i=0;i<e.accidentals.length;i++){var n=e.accidentals[i];"flat"===n.acc?t[n.note.toUpperCase()]="_":"sharp"===n.acc&&(t[n.note.toUpperCase()]="^")}return t}function l(e,t,i){var n=u.indexOf(e.root)-u.indexOf(t);return"none"===t&&(n=u.indexOf(e.root)),0===n?i>2?n+=7:-12===i&&(n-=7):i>0&&n<0?n+=7:i<0&&n>0&&(n-=7),i>12?n+=7:i<-12&&(n-=7),n}function h(e,t,i,n,r,a){for(var o=[],h=l(r,i,a),u={},d={},m=0;m<t.length;m++){var g=t[m];if(g.chord)for(var v=0;v<g.chord.length;v++){var b=g.chord[v];if("default"===b.position){var k=r.accidentals.length&&"flat"===r.accidentals[0].acc,C=s(b.name,a,k,!0);(C=C.replace(/♭/g,"b").replace(/♯/g,"#"))!==b.name&&o.push(x(e,g.startChar,g.endChar,C))}}if("note"===g.el_type&&g.pitches){for(var S=0;S<g.pitches.length;S++){var M=y(g.pitches[S].name,i,n,u);M.acc&&(u[M.name.toUpperCase()]=M.acc);var E=f(M,r,h,d);E.acc&&(d[E.upper]=E.acc),o.push(_(e,g.startChar,g.endChar,E.acc+E.name,S))}if(g.gracenotes)for(var T=0;T<g.gracenotes.length;T++){var P=y(g.gracenotes[T].name,i,n,u);P.acc&&(u[P.name.toUpperCase()]=P.acc);var A=f(P,r,h,u);A.acc&&(d[A.upper]=A.acc),o.push(w(e,g.startChar,g.endChar,A.acc+A.name,T))}}else"bar"===g.el_type?(u={},d={}):"keySignature"===g.el_type&&(i=g.root,n=c(g),h=l(r=p(g,a),i,a))}return o}e=function(e,o,c){if("TEST"===o)return{keyAccidentals:t,relativeMajor:i,transposeKey:n,relativeMode:r,transposeChordName:s};c=parseInt(c,10);var l,h=[];for(l=0;l<o.length;l++)h=h.concat(a(e,o[l],c));h=h.sort((function(e,t){return t.start-e.start}));var u=e.split("");for(l=0;l<h.length;l++){var d=h[l];u.splice(d.start,d.end-d.start,d.note)}return u.join("")};var u="CDEFGAB",d=[",,,,",",,,",",,",",","","'","''","'''","''''"];function p(e,s){if("none"===e.root)return{root:n("C",s),mode:"",acc:"",accidentals:[]};var a=i(e.root+e.acc+e.mode),o=n(a,s),c=r(o,e.mode),l=t(o);return{root:c[0],mode:e.mode,acc:c.length>1?c[1]:"",accidentals:l}}function f(e,t,i,n){for(var r=e.pitch,s=u.indexOf(e.name),a=(u.indexOf(t.root)+r)%7,o=s+i,c=e.oct;o>6;)c++,o-=7;for(;o<0;)c--,o+=7;for(var l=u[a],h="",d=e.adj,p="=",m=0;m<t.accidentals.length;m++)if(t.accidentals[m].note.toLowerCase()===l.toLowerCase()){d+="flat"===t.accidentals[m].acc?-1:1,p="flat"===t.accidentals[m].acc?"_":"^";break}switch(d){case-2:h="__";break;case-1:h="_";break;case 0:h="=";break;case 1:h="^";break;case 2:h="^^";break;case-3:return(g={}).pitch=e.pitch-1,g.oct=e.oct,g.name=u[u.indexOf(e.name)-1],g.name||(g.name="B",g.oct--),"B"===g.name||"E"===g.name?g.adj=e.adj+1:g.adj=e.adj+2,f(g,t,i+1,n);case 3:var g;return(g={}).pitch=e.pitch+1,g.oct=e.oct,g.name=u[u.indexOf(e.name)+1],g.name||(g.name="C",g.oct++),"C"===g.name||"F"===g.name?g.adj=e.adj-1:g.adj=e.adj-2,f(g,t,i+1,n)}switch(n[l]!==h&&(n[l]||h!==p)||e.courtesy||(h=""),c){case 0:l+=",,,";break;case 1:l+=",,";break;case 2:l+=",";break;case 4:l=l.toLowerCase();break;case 5:l=l.toLowerCase()+"'";break;case 6:l=l.toLowerCase()+"''";break;case 7:l=l.toLowerCase()+"'''";break;case 8:l=l.toLowerCase()+"''''"}return c>4&&(l=l.toLowerCase()),{acc:h,name:l,upper:l.toUpperCase()}}var m=/([_^=]*)([A-Ga-g])([,']*)/,g=/([_^=]*[A-Ga-g][,']*)(\d*\/*\d*)([\>\<\-\)\.\s\\]*)/,v=/([_^=]*[A-Ga-g][,']*)?(\d*\/*\d*)?([\>\<\-\)]*)?/,b=/(\s*)$/;function y(e,t,i,n){var r="none"===t?0:u.indexOf(t),s=e.match(m),a=s[2].toUpperCase(),o=u.indexOf(a)-r;o<0&&(o+=7);var c=d.indexOf(s[3]);a===s[2]&&c--;var l=n[a]||i[a]||"=";return{acc:s[1],name:a,pitch:o,oct:c,adj:k(s[1],i[a],n[a]),courtesy:s[1]===l}}function _(e,t,i,n,r){var s=e.substring(t,i),a=s.match(new RegExp(g.source+b.source),"");if(a){var o=a[1].length,c=a[2].length+a[3].length+a[4].length;t+=i-t-o-c,i-=c}else if(a=s.match(new RegExp(/([^\[]*)/.source+/\[/.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+v.source+/\-?](\d*\/*\d*)?([\>\<\-\)]*)/.source+b.source))){for(var l=1+a[1].length,h=0;h<r;h++)a[3*h+2]&&(l+=a[3*h+2].length),a[3*h+3]&&(l+=a[3*h+3].length),a[3*h+4]&&(l+=a[3*h+4].length);i=(t+=l)+(a[3*r+2]?a[3*r+2].length:0)}return{start:t,end:i,note:n}}function w(e,t,i,n,r){var s=/(\/*)/,a=e.substring(t,i).match(new RegExp(/([^\{]*)/.source+/\{/.source+s.source+v.source+s.source+v.source+s.source+v.source+s.source+v.source+s.source+v.source+s.source+v.source+s.source+v.source+s.source+v.source+/\}/.source));if(a){for(var o=1+a[1].length,c=0;c<r;c++)a[3*c+2]&&(o+=a[3*c+2].length),a[3*c+3]&&(o+=a[3*c+3].length),a[3*c+4]&&(o+=a[3*c+4].length),a[3*c+5]&&(o+=a[3*c+5].length);a[3*r+2]&&(o+=a[3*c+2].length),t+=o;var l=a[3*r+3]?a[3*r+3].length:0;l+=a[3*r+4]?a[3*r+4].length:0,i=t+(l+=a[3*r+5]?a[3*r+5].length:0)}return{start:t,end:i,note:n}}function x(e,t,i,n){var r=e.substring(t,i).match(/([^"]+)?(".+")+/);return r[1]&&(t+=r[1].length),{start:t+1,end:(i=t+r[2].length)-1,note:n}}function k(e,t,i){if(!e&&i&&(e=i),!e)return 0;switch(t){case void 0:switch(e){case"__":return-2;case"_":return-1;case"=":default:return 0;case"^":return 1;case"^^":return 2}case"_":switch(e){case"__":return-1;case"_":default:return 0;case"=":return 1;case"^":return 2;case"^^":return 3}case"^":switch(e){case"__":return-3;case"_":return-2;case"=":return-1;case"^":default:return 0;case"^^":return 1}}return 0}}(),Hc=e}(),s={};s.signature="abcjs-basic v"+e,Object.keys(t).forEach((function(e){s[e]=t[e]})),Object.keys(i).forEach((function(e){s[e]=i[e]})),s.renderAbc=Tp(),s.tuneMetrics=function(){if(Du)return Bu;Du=1;var e=tp(),t=Ep();return Bu=function(i,n){return e.renderEngine((function(e,i,r,s){(e=document.createElement("div")).setAttribute("style","visibility: hidden;"),document.body.appendChild(e);var a=new t(e,n).getMeasureWidths(i);return e.parentNode.removeChild(e),{sections:a}}),"*",i,n)}}(),s.TimingCallbacks=Po();var a=ip();s.setGlyph=a.setSymbol,s.strTranspose=r;var o=Dp(),c=Ap(),l=Op(),h=Rp(),u=zp(),d=Ip(),p=Np(),f=Lp(),m=function(){if(xd)return wd;xd=1;var e=Rp(),t=Dp(),i=Np();function n(e,i,n,r){var s=new t;return s.init({sequence:e,millisecondsPerMeasure:i,options:{soundFontUrl:n},debugCallback:r}).then((function(){return s.prime()})).then((function(){return s.start(),Promise.resolve()}))}return wd=function(t,r,s,a,o){for(var c=new e,l=0;l<t.length;l++){var h=t[l],u=c.addTrack();if(c.setInstrument(u,h.instrument),0===l&&r)for(var d=0;d<r.length;d++){var p=r[d];c.appendNote(u,p.pitch,1/64,p.volume,p.cents)}c.appendNote(u,h.pitch,h.duration,h.volume,h.cents)}var f=i();return"suspended"===f.state?f.resume().then((function(){return n(c,s,a,o)})):n(c,s,a,o)}}(),g=Vp(),v=function(){if(Ad)return Pd;Ad=1;var e=tp(),t=function(){if(Td)return Ed;Td=1;var e,t=qp();return function(){function i(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;r++)n[r]=parseFloat(n[r]);n.sort((function(e,t){return e-t}));for(var s=0,a=0;a<n.length;a++){var o=t[n[a]];if(n[a]>s){var c=(n[a]-s)*i;e.addRest(c),s=n[a]}for(var l=0;l<o.length;l++){var h=o[l];h.volume?e.startNote(h.pitch,h.volume,h.cents):e.endNote(h.pitch)}}}e=function(e,n){void 0===n&&(n={});var r=e.setUpAudio(n),s=t(),a=e.metaText?e.metaText.title:void 0;a&&a.length>128&&(a=a.substring(0,124)+"...");var o=e.getKeySignature(),c=e.getMeterFraction(),l=r.tempo,h=l/60;8==c.den&&(h=(l=6e4/(e.millisecondsPerMeasure()/c.num)/2)/60),s.setGlobalInfo(l,a,o,c);for(var u=0;u<r.tracks.length;u++){s.startTrack();for(var d={},p=0;p<r.tracks[u].length;p++){var f=r.tracks[u][p];switch(f.cmd){case"text":s.setText(f.type,f.text);break;case"program":var m=0;n.pan&&n.pan.length>u&&(m=n.pan[u]),128===f.instrument?(s.setChannel(9,m),s.setInstrument(0)):(s.setChannel(f.channel,m),s.setInstrument(f.instrument));break;case"note":var g=f.gap*h,v=f.start,b=v+f.duration-g;d[v]||(d[v]=[]),d[v].push({pitch:f.pitch,volume:f.volume,cents:f.cents}),d[b]||(d[b]=[]),d[b].push({pitch:f.pitch,volume:0});break;default:console.log("MIDI create Unknown: "+f.cmd)}}i(s,d,1920),s.endTrack()}return s.getData()}}(),Ed=e}();return Pd=function(i,n){var r={};if(n)for(var s in n)n.hasOwnProperty(s)&&(r[s]=n[s]);function a(e,i,n){var s=t(i,r);switch(r.midiOutputType){case"encoded":return s;case"binary":var a=s.replace("data:audio/midi,","");a=(a=a.replace(/MThd/g,"%4d%54%68%64")).replace(/MTrk/g,"%4d%54%72%6b");for(var o=new ArrayBuffer(a.length/3),c=new Uint8Array(o),l=0;l<a.length/3;l++){var h=3*l+1,u=parseInt(a.substring(h,h+2),16);c[l]=u}return c;default:return function(e,t,i,n){var r=["abcjs-download-midi","abcjs-midi-"+n];t.downloadClass&&r.push(t.downloadClass);var s='<div class="'+r.join(" ")+'">';t.preTextDownload&&(s+=t.preTextDownload);var a,o,c=e.metaText&&e.metaText.title?e.metaText.title:"Untitled";return a=t.downloadLabel&&(o=t.downloadLabel)&&"[object Function]"==={}.toString.call(o)?t.downloadLabel(e,n):t.downloadLabel?t.downloadLabel.replace(/%T/,c):'Download MIDI for "'+c+'"',c=c.toLowerCase().replace(/'/g,"").replace(/\W/g,"_").replace(/__/g,"_"),s+='<a download="'+(t.fileName?t.fileName:c+".midi")+'" href="'+i+'">'+a+"</a>",t.postTextDownload&&(s+=t.postTextDownload),s+"</div>"}(i,r,s,n)}}return r.generateInline=!1,"string"==typeof i?e.renderEngine(a,"*",i,r):a(0,i,0)}}(),b=qp();return s.synth={CreateSynth:o,instrumentIndexToName:c,pitchToNoteName:l,SynthController:g,SynthSequence:h,CreateSynthControl:u,registerAudioContext:d,activeAudioContext:p,supportsAudio:f,playEvent:m,getMidiFile:v,sequence:n,midiRenderer:b},s.Editor=function(){if(Od)return Ld;Od=1;var e=Io(),t=Vp(),i=Lp(),n=Tp(),r=Fp(),s=function(t,n){this.abcjsParams=function(e){var t,i={};if(e.abcjsParams)for(t in e.abcjsParams)e.abcjsParams.hasOwnProperty(t)&&(i[t]=e.abcjsParams[t]);if(e.midi_options)for(t in e.midi_options)e.midi_options.hasOwnProperty(t)&&(i[t]=e.midi_options[t]);if(e.parser_options)for(t in e.parser_options)e.parser_options.hasOwnProperty(t)&&(i[t]=e.parser_options[t]);if(e.render_options)for(t in e.render_options)e.render_options.hasOwnProperty(t)&&(i[t]=e.render_options[t]);return i.tablature&&e.warnings_id&&(i.tablature.warnings_id=e.warnings_id),i}(n),n.indicate_changed&&(this.indicate_changed=!0),this.editarea="string"==typeof t?new r(t):t,this.editarea.addSelectionListener(this),this.editarea.addChangeListener(this),n.canvas_id?this.div=n.canvas_id:n.paper_id?this.div=n.paper_id:(this.div=document.createElement("DIV"),this.editarea.getElem().parentNode.insertBefore(this.div,this.editarea.getElem())),"string"==typeof this.div&&(this.div=document.getElementById(this.div)),n.selectionChangeCallback&&(this.selectionChangeCallback=n.selectionChangeCallback),this.clientClickListener=this.abcjsParams.clickListener,this.abcjsParams.clickListener=this.highlight.bind(this),n.synth&&i()&&(this.synth={el:n.synth.el,cursorControl:n.synth.cursorControl,options:n.synth.options}),n.generate_midi&&(this.generate_midi=n.generate_midi,this.abcjsParams.generateDownload&&("string"==typeof n.midi_download_id?this.downloadMidi=document.getElementById(n.midi_download_id):n.midi_download_id&&(this.downloadMidi=n.midi_download_id)),!1!==this.abcjsParams.generateInline&&("string"==typeof n.midi_id?this.inlineMidi=document.getElementById(n.midi_id):n.midi_id&&(this.inlineMidi=n.midi_id))),n.warnings_id?"string"==typeof n.warnings_id?this.warningsdiv=document.getElementById(n.warnings_id):this.warningsdiv=n.warnings_id:n.generate_warnings&&(this.warningsdiv=document.createElement("div"),this.div.parentNode.insertBefore(this.warningsdiv,this.div)),this.onchangeCallback=n.onchange,this.currentAbc="",this.tunes=[],this.bReentry=!1,this.parseABC(),this.modelChanged(),this.addClassName=function(e,t){var i,n;return i=t,(n=e.className).length>0&&(n===i||new RegExp("(^|\\s)"+i+"(\\s|$)").test(n))||(e.className+=(e.className?" ":"")+t),e},this.removeClassName=function(t,i){return t.className=e.strip(t.className.replace(new RegExp("(^|\\s+)"+i+"(\\s+|$)")," ")),t},this.setReadOnly=function(e){var t="abc_textarea_readonly",i=this.editarea.getElem();e?(i.setAttribute("readonly","yes"),this.addClassName(i,t)):(i.removeAttribute("readonly"),this.removeClassName(i,t))}};return s.prototype.redrawMidi=function(){if(this.generate_midi&&!this.midiPause){var e=new window.CustomEvent("generateMidi",{detail:{tunes:this.tunes,abcjsParams:this.abcjsParams,downloadMidiEl:this.downloadMidi,inlineMidiEl:this.inlineMidi,engravingEl:this.div}});window.dispatchEvent(e)}if(this.synth){var i=this.synth.synthControl;this.synth.synthControl||(this.synth.synthControl=new t,this.synth.synthControl.load(this.synth.el,this.synth.cursorControl,this.synth.options)),this.synth.synthControl.setTune(this.tunes[0],i,this.synth.options)}},s.prototype.modelChanged=function(){if(!this.bReentry){this.bReentry=!0;try{this.timerId=null,this.synth&&this.synth.synthControl&&this.synth.synthControl.disable(!0),this.tunes=n(this.div,this.currentAbc,this.abcjsParams),this.tunes.length>0&&(this.warnings=this.tunes[0].warnings),this.redrawMidi()}catch(e){console.error("ABCJS error: ",e),this.warnings||(this.warnings=[]),this.warnings.push(e.message)}this.warningsdiv&&(this.warningsdiv.innerHTML=this.warnings?this.warnings.join("<br />"):"No errors"),this.updateSelection(),this.bReentry=!1}},s.prototype.paramChanged=function(e){if(e)for(var t in e)e.hasOwnProperty(t)&&(this.abcjsParams[t]=e[t]);this.currentAbc="",this.fireChanged()},s.prototype.synthParamChanged=function(e){if(this.synth){if(this.synth.options={},e)for(var t in e)e.hasOwnProperty(t)&&(this.synth.options[t]=e[t]);this.currentAbc="",this.fireChanged()}},s.prototype.parseABC=function(){var e=this.editarea.getString();return e===this.currentAbc?(this.updateSelection(),!1):(this.currentAbc=e,!0)},s.prototype.updateSelection=function(){var e=this.editarea.getSelection();try{this.tunes.length>0&&this.tunes[0].engraver&&this.tunes[0].engraver.rangeHighlight(e.start,e.end)}catch(t){}this.selectionChangeCallback&&this.selectionChangeCallback(e.start,e.end)},s.prototype.fireSelectionChanged=function(){this.updateSelection()},s.prototype.setDirtyStyle=function(t){if(void 0!==this.indicate_changed){var i,n,r,s,a="abc_textarea_dirty",o=this.editarea.getElem();t?(r=n=a,(s=(i=o).className).length>0&&(s===r||new RegExp("(^|\\s)"+r+"(\\s|$)").test(s))||(i.className+=(i.className?" ":"")+n)):(l=a,(c=o).className=e.strip(c.className.replace(new RegExp("(^|\\s+)"+l+"(\\s+|$)")," ")))}var c,l},s.prototype.fireChanged=function(){if(!this.bIsPaused&&this.parseABC()){var e=this;this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout((function(){e.modelChanged()}),300);var t=this.isDirty();this.wasDirty!==t&&(this.wasDirty=t,this.setDirtyStyle(t)),this.onchangeCallback&&this.onchangeCallback(this)}},s.prototype.setNotDirty=function(){this.editarea.initialText=this.editarea.getString(),this.wasDirty=!1,this.setDirtyStyle(!1)},s.prototype.isDirty=function(){return void 0!==this.indicate_changed&&this.editarea.initialText!==this.editarea.getString()},s.prototype.highlight=function(e,t,i,n,r,s){this.editarea.setSelection(e.startChar,e.endChar),this.selectionChangeCallback&&this.selectionChangeCallback(e.startChar,e.endChar),this.clientClickListener&&this.clientClickListener(e,t,i,n,r,s)},s.prototype.pause=function(e){this.bIsPaused=e,e||this.fireChanged()},s.prototype.millisecondsPerMeasure=function(){return this.synth&&this.synth.synthControl&&this.synth.synthControl.visualObj?this.synth.synthControl.visualObj.millisecondsPerMeasure():0},s.prototype.pauseMidi=function(e){this.midiPause=e,e||this.redrawMidi()},Ld=s}(),s.EditArea=Fp(),Bd=s}()),Hp=k({name:"MusicScoreRenderer",props:{abcString:{type:String,required:!0}},mounted(){jp.renderAbc("abc",this.abcString)}}),Gp={id:"abc"},Up=k({name:"IdentifyKeyView",components:{RadioMultipleChoice:R,MusicScoreRenderer:he(Hp,[["render",function(e,t,i,n,r,s){return g(),m("div",Gp)}]])},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"IdentifyKeyView"),n=L(i),r=O("");n.question.value=new Xp(e.data);const s=B((()=>n.question.value)),a=B((()=>{const e=function(){const e=[];for(let t=0;t<5;t++)e.push($p[Math.floor(Math.random()*$p.length)]);return e}();return e.includes(s.value?.key||"")||(e[Math.floor(Math.random()*e.length)]=s.value?.key||""),e}));return{...i,...n,answer:r,question:s,choices:a,submit:()=>{}}}}),Wp={"data-viewable":"IdentifyKeyView"},Yp=he(Up,[["render",function(e,t,i,n,r,s){const a=f("MusicScoreRenderer"),o=f("RadioMultipleChoice");return g(),m("div",Wp,[e.question?(g(),m(y,{key:0},[w(a,{"key-signature":`X:1\nK:${e.question.key}\n||`,"abc-string":"''"},null,8,["key-signature"]),t[0]||(t[0]=_(" This signature is for the major key: _____ ")),w(o,{"choice-list":e.choices},null,8,["choice-list"])],64)):b("",!0)])}]]),$p=["C","G","D","A","E","B","F#","C#","F","Bb","Eb","Ab","Db","Gb","Cb"],Kp=class _IdentifyKeyQuestion extends l{constructor(e){super(e),t(this,"key"),this.key=_IdentifyKeyQuestion.getKey(e[0].key)}static getKey(e){return $p[e]}isCorrect(e){return console.log(`answer: ${JSON.stringify(e)}, key: ${this.key}`),this.key===e.choiceList[e.selection]}dataShapes(){return _IdentifyKeyQuestion.dataShapes}views(){return _IdentifyKeyQuestion.views}};t(Kp,"dataShapes",[{name:a.SIGHTSING_IdentifyKey,fields:[{name:"key",type:r.NUMBER,validator:{test:e=>{const t=parseInt(e);return t>=0&&t<=$p.length?{msg:"",status:n.ok}:{msg:"Please enter a number between 0 and 11",status:n.error}}}}]}]),t(Kp,"views",[Yp]);let Xp=Kp;const Qp=new CourseWare("sightSing",[Xp]),Zp=k({name:"LetterQuestionView",props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"LetterQuestionView"),n=L(i),r=O(null);n.question.value=new nf(e.data);const s=B((()=>n.question.value)),a=e=>{if(!s.value)return;const t=e.key.toLowerCase(),i=s.value.letter.toLowerCase();if(t===i){r.value?.classList.add("pressed");const e=s=>{s.key.toLowerCase()===i&&(r.value?.classList.remove("pressed"),n.submitAnswer(t),window.removeEventListener("keyup",e))};window.addEventListener("keyup",e)}else n.submitAnswer(t)};return z((()=>{window.addEventListener("keypress",a)})),H((()=>{window.removeEventListener("keypress",a)})),{...n,...i,letterDisplay:r,question:s}}}),Jp={"data-viewable":"LetterQuestionView"},ef=he(Zp,[["render",function(e,t,i,n,r,s){return g(),m("div",Jp,[e.question?(g(),m(y,{key:0},[t[0]||(t[0]=C("p",{class:"text-h5"},"Type this letter!",-1)),C("div",{ref:"letterDisplay",class:"letter-display"},x(e.question.letter),513)],64)):b("",!0)])}],["__scopeId","data-v-4ae4db54"]]),tf=class _TypeLetterQuestion extends l{constructor(e){super(e),t(this,"letter"),this.letter=e[0].letter}evaluate(e,t){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e,t)}}displayedSkill(e,t){if(this.isCorrect(e)){if(t<3e3)return 1;{const e=1-(t-3e3)/7e3*.75;return Math.max(.25,e)}}return 0}dataShapes(){return _TypeLetterQuestion.dataShapes}views(){return _TypeLetterQuestion.views}isCorrect(e){const t=e.toLowerCase()===this.letter.toLowerCase();return console.log(`singleLetter Q isCorrect: ${t}`),t}};t(tf,"dataShapes",[{name:a.TYPING_singleLetter,fields:[{name:"letter",type:r.STRING,validator:{instructions:"Enter a single letter",test:function(e){return e&&1===e.length&&/[a-zA-Z]/.test(e)?{status:n.ok,msg:""}:{status:n.error,msg:"Input must be a single letter"}}}}]}]),t(tf,"views",[ef]),t(tf,"acceptsUserData",!0),t(tf,"seedData",function(){const e=[];for(let t=0;t<26;t++)e.push({letter:String.fromCharCode(65+t)});return e}());let nf=tf;const rf=class _FallingLettersQuestion extends l{constructor(e){super(e),t(this,"gameLength"),t(this,"initialSpeed"),t(this,"acceleration"),t(this,"spawnInterval"),this.gameLength=e[0].gameLength,this.initialSpeed=e[0].initialSpeed,this.acceleration=e[0].acceleration,this.spawnInterval=e[0].spawnInterval}evaluate(e){return{isCorrect:this.isCorrect(e),performance:this.displayedSkill(e)}}displayedSkill(e){return e.win?1:e.percentage}dataShapes(){return _FallingLettersQuestion.dataShapes}views(){return _FallingLettersQuestion.views}isCorrect(e){return e.win}};t(rf,"dataShapes",[{name:a.TYPING_fallingLetters,fields:[{name:"gameLength",type:r.NUMBER},{name:"initialSpeed",type:r.NUMBER},{name:"acceleration",type:r.NUMBER},{name:"spawnInterval",type:r.NUMBER,validator:{instructions:"How often should a new letter spawn? (in seconds)",test:e=>"string"==typeof e?parseFloat(e)>0?{status:n.ok,msg:""}:{status:n.error,msg:"Must be greater than 0"}:{status:n.error,msg:"Unexpected non-string input."},placeholder:"1"}}]}]),t(rf,"views",[]),t(rf,"acceptsUserData",!0),t(rf,"seedData",[{gameLength:30,initialSpeed:2,acceleration:.1,spawnInterval:1}]);let sf=rf;const af=k({name:"FallingLettersView",emits:["emitResponse"],props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"FallingLettersView"),n=L(i),r=O(null),s=O([]),a=O(!1),o=O(""),c=O(30),l=O(0),h=O([]),u=O([]),d=O({currentSpeed:2,letterId:0,gameLoop:null,lastSpawn:0,lastUpdate:0,spawnInterval:1e3}),p=e=>{if(a.value)return;const t=(e-d.value.lastUpdate)/1e3;if(d.value.lastUpdate=e,c.value-=t,n.question.value&&(d.value.currentSpeed+=n.question.value.acceleration*t),c.value<=0)return a.value=!0,o.value="You Win!",void n.submitAnswer({lettersTyped:l.value,win:!0,percentage:1});e-d.value.lastSpawn>=d.value.spawnInterval&&((()=>{if(!r.value)return;const e={id:d.value.letterId++,char:String.fromCharCode(65+Math.floor(26*Math.random())),x:Math.random()*(r.value.clientWidth-30),y:-30};s.value.push(e)})(),d.value.lastSpawn=e,d.value.spawnInterval=Math.max(500,d.value.spawnInterval-10)),r.value&&(s.value=s.value.filter((e=>(e.y+=d.value.currentSpeed,!(e.y>r.value.clientHeight&&(a.value=!0,o.value="Game Over!",n.submitAnswer({lettersTyped:l.value,percentage:c.value/(n.question.value?.gameLength||30),win:!1}),1)))))),d.value.gameLoop=requestAnimationFrame(p)},f=e=>{if(a.value)return;const t=e.key.toUpperCase(),i=s.value.findIndex((e=>e.char===t));-1!==i&&(u.value.push({id:Date.now(),x:s.value[i].x,y:s.value[i].y}),setTimeout((()=>{u.value=u.value.filter((e=>e.id!==u.value[u.value.length-1].id))}),300),s.value.splice(i,1),l.value++)};return z((()=>{try{n.question.value=new sf(e.data),n.maxAttemptsPerView.value=1,window.addEventListener("keypress",f),h.value=Array.from({length:7},((e,t)=>({id:t,left:20+t*Math.random()*30-10,height:100+120*Math.random(),scale:1+2*Math.random()}))),n.question.value?(c.value=n.question.value.gameLength,l.value=0,s.value=[],a.value=!1,o.value="",d.value={currentSpeed:n.question.value.initialSpeed,letterId:0,gameLoop:null,lastSpawn:performance.now(),lastUpdate:performance.now(),spawnInterval:1e3*n.question.value.spawnInterval},d.value.gameLoop=requestAnimationFrame(p)):i.logger.error("Question not initialized")}catch(t){i.logger.error("Error initializing game:",t)}})),H((()=>{window.removeEventListener("keypress",f),d.value.gameLoop&&cancelAnimationFrame(d.value.gameLoop)})),{...n,gameArea:r,letters:s,gameOver:a,gameOverMessage:o,timeLeft:c,score:l,treePositions:h,explosions:u}}}),of={class:"game-container"},cf={class:"stats"},lf={class:"time"},hf={class:"score"},uf={ref:"gameArea",class:"game-area"},df={class:"letter-text"},pf={class:"trees"},ff={key:0,class:"game-over"},mf=he(af,[["render",function(e,t,i,n,r,s){return g(),m("div",of,[C("div",cf,[C("div",lf,"Time: "+x(e.timeLeft.toFixed(1))+"s",1),C("div",hf,"Score: "+x(e.score),1)]),C("div",uf,[(g(!0),m(y,null,S(e.letters,(e=>(g(),m("div",{key:e.id,class:"falling-letter",style:X({left:e.x+"px",top:e.y+"px"})},[t[0]||(t[0]=C("div",{class:"meteor-effect"},null,-1)),C("span",df,x(e.char),1)],4)))),128)),(g(!0),m(y,null,S(e.explosions,(e=>(g(),m("div",{key:e.id,class:"explosion",style:X({left:e.x+"px",top:e.y+"px"})},[(g(),m(y,null,S(12,(e=>C("div",{key:e,class:"particle"}))),64))],4)))),128)),t[2]||(t[2]=C("div",{class:"grass-container"},[C("div",{class:"grass"}),C("div",{class:"grass-overlay"})],-1)),C("div",pf,[(g(!0),m(y,null,S(e.treePositions,(e=>(g(),m("div",{key:e.id,class:"tree",style:X({left:`${e.left}%`,height:`${e.height}px`,transform:`scale(${e.scale})`})},t[1]||(t[1]=[C("div",{class:"tree-crown"},null,-1),C("div",{class:"tree-trunk"},null,-1)]),4)))),128))])],512),e.gameOver?(g(),m("div",ff,x(e.gameOverMessage),1)):b("",!0)])}],["__scopeId","data-v-41b85e8b"]]);sf.views=[mf];const gf=new CourseWare("typing",[nf,sf]),vf=k({name:"IdentifyVocab",components:{AudioAutoPlayer:F,UserInputString:W},props:{data:{type:Array,required:!0},modifyDifficulty:{type:Number,required:!1,default:0}},setup(e,{emit:t}){const i=N(e,t,"IdentifyVocab"),n=L(i),r=O("");n.question.value=new kf(e.data);const s=B((()=>n.question.value));return{...i,...n,answer:r,question:s,submit:()=>{s.value&&n.submitAnswer(r.value)}}}}),bf={"data-viewable":"IdentifyVocab"},yf={key:0,class:"text-h6"},_f=he(vf,[["render",function(e,t,i,n,r,s){const a=f("UserInputString"),o=f("center"),c=f("audio-auto-player");return g(),m("div",bf,[e.question?(g(),m(y,{key:0},[t[1]||(t[1]=C("span",{class:"text-h5"}," Spell the word: ",-1)),w(a,{modelValue:e.answer,"onUpdate:modelValue":t[0]||(t[0]=t=>e.answer=t)},null,8,["modelValue"]),w(o,null,{default:A((()=>[e.priorAttempts?(g(),m("span",yf,x(e.question.word),1)):b("",!0)])),_:1}),w(o,null,{default:A((()=>[w(c,{src:[e.getURL("WordAudio"),e.getURL("SentenceAudio"),e.getURL("WordAudio")]},null,8,["src"])])),_:1})],64)):b("",!0)])}]]),wf=[{name:"Word",type:r.STRING,validator:J.NonEmptyString},{name:"ExampleSentence",type:r.STRING},{name:"WordAudio",type:r.AUDIO},{name:"SentenceAudio",type:r.AUDIO}],xf=class _SpellingQuestion extends l{constructor(e){super(e),t(this,"word"),t(this,"sentence"),t(this,"audio_word"),t(this,"audio_sentence"),this.word=e[0].Word,this.sentence=e[0].Sentence,this.audio_word=e[0].WordAudio,this.audio_sentence=e[0].SentenceAudio}isCorrect(e){return e===this.word}dataShapes(){return _SpellingQuestion.dataShapes}views(){return _SpellingQuestion.views}};t(xf,"dataShapes",[{fields:wf,name:a.WORDWORK_Spelling}]),t(xf,"views",[_f]);let kf=xf;const Cf=new CourseWare("wordWork",[kf]),Sf=k({name:"PianoRangeVisualizer",props:{lowestNote:{type:Number,required:!0},highestNote:{type:Number,required:!0},maxWidth:{type:Number,default:1e3}},setup(e){const t=O(null),i=O(800),n=B((()=>{let e=0;for(let t=21;t<=108;t++)o(t)&&e++;return e})),r=B((()=>Math.min(22,i.value/Math.max(25,n.value)))),s=B((()=>.6*r.value)),a=B((()=>Math.min(e.maxWidth,r.value*n.value+10))),o=e=>[0,2,4,5,7,9,11].includes(e%12);return z((()=>{t.value&&(i.value=t.value.clientWidth,new ResizeObserver((e=>{for(const t of e)i.value=t.contentRect.width})).observe(t.value))})),{pianoWrapper:t,keyHeight:100,blackKeyHeight:60,whiteKeyWidth:r,blackKeyWidth:s,svgWidth:a,isWhiteKey:o,getKeyPosition:e=>{let t=0;for(let i=21;i<e;i++)o(i)&&t++;return o(e)?t*r.value:t*r.value-s.value/2},getNoteLabel:e=>{const t=e%12,i=Math.floor(e/12)-1;return`${["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][t]}${i}`}}}}),Mf={class:"piano-range-container"},Ef={class:"piano-wrapper",ref:"pianoWrapper"},Tf=["width","height"],Pf={class:"background-keys",opacity:"0.15"},Af=["x","width","height"],If=["x","width","height"],Nf={class:"selected-range"},Lf=["x","width","height"],Of=["x","width","height"],Bf={class:"range-markers"},Df=["x","height"],Rf=["x","height"],zf=["x","y"],Vf=["x","y"],qf=k({name:"MidiConfig",components:{PianoRangeVisualizer:he(Sf,[["render",function(e,t,i,n,r,s){return g(),m("div",Mf,[C("div",Ef,[(g(),m("svg",{width:e.svgWidth,height:e.keyHeight+20,class:"piano-svg"},[C("g",Pf,[(g(),m(y,null,S(88,(t=>(g(),m(y,{key:`bg-${t}`},[e.isWhiteKey(t+20)?(g(),m("rect",{key:0,x:e.getKeyPosition(t+20),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key",stroke:"#999","stroke-width":"1"},null,8,Af)):b("",!0)],64)))),64)),(g(),m(y,null,S(88,(t=>(g(),m(y,{key:`bg-black-${t}`},[e.isWhiteKey(t+20)?b("",!0):(g(),m("rect",{key:0,x:e.getKeyPosition(t+20),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key"},null,8,If))],64)))),64))]),C("g",Nf,[(g(),m(y,null,S(128,(t=>(g(),m(y,{key:`white-${t}`},[e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(g(),m("rect",{key:0,x:e.getKeyPosition(t),y:"0",width:e.whiteKeyWidth,height:e.keyHeight,class:"white-key active",stroke:"#666","stroke-width":"1"},null,8,Lf)):b("",!0)],64)))),64)),(g(),m(y,null,S(128,(t=>(g(),m(y,{key:`black-${t}`},[!e.isWhiteKey(t)&&t>=e.lowestNote&&t<=e.highestNote?(g(),m("rect",{key:0,x:e.getKeyPosition(t),y:"0",width:e.blackKeyWidth,height:e.blackKeyHeight,class:"black-key active"},null,8,Of)):b("",!0)],64)))),64))]),C("g",Bf,[C("rect",{x:e.getKeyPosition(e.lowestNote)-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker start"},null,8,Df),C("rect",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-2,y:"0",width:4,height:e.keyHeight+5,class:"range-marker end"},null,8,Rf)]),C("text",{x:e.getKeyPosition(e.lowestNote)+3,y:e.keyHeight+12,class:"note-label"},x(e.getNoteLabel(e.lowestNote)),9,zf),C("text",{x:e.getKeyPosition(e.highestNote)+e.whiteKeyWidth-3,y:e.keyHeight+12,"text-anchor":"end",class:"note-label"},x(e.getNoteLabel(e.highestNote)),9,Vf)],8,Tf))],512)])}],["__scopeId","data-v-4b232a8b"]])},props:{_id:{type:String,required:!0},user:{type:Object,required:!0}},setup(e){const t=O(),i=O(!0),r=O([]),s=O([]),a=O(""),o=O(""),c=O(!1),l=O(""),h=O(""),u=O(!1),d=O("full-88"),p=O(21),f=O(108),m=O(""),g=O(0),v=O(0),b=O([]),y=O([{title:"Full 88-key Piano (A0-C8)",value:"full-88"},{title:"76-key Keyboard (E1-G7)",value:"76-key"},{title:"61-key Keyboard (C2-C7)",value:"61-key"},{title:"49-key Keyboard (C3-C7)",value:"49-key"},{title:"37-key Keyboard (C3-C6)",value:"37-key"},{title:"25-key Keyboard (C4-C6)",value:"25-key"},{title:"Custom Range",value:"custom"}]),_=()=>{u.value=a.value!==l.value||o.value!==h.value||d.value!==m.value||"custom"===d.value&&(p.value!==g.value||f.value!==v.value)},w=e=>{$({text:`I hear a ${e.note.name}!`,status:n.ok})};return G(a,(()=>{t.value?.selectInput(a.value),_()})),G(o,(()=>{t.value?.selectOutput(o.value),_()})),z((async()=>{(()=>{const e=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],t=[];for(let i=0;i<=127;i++){const n=Math.floor(i/12)-1,r=e[i%12];t.push({title:`${r}${n} (${i})`,value:i})}b.value=t})();try{t.value=await ga.instance(),i.value="ready"===t.value.state||"nodevice"===t.value.state}catch(n){console.log(`Error on midi Init: ${n}`),i.value=!1}i.value&&(t.value?.addNoteonListenter(w),t.value?(r.value=t.value.inputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id}))),s.value=t.value?.outputs.filter((e=>"connected"===e.state)).map((e=>({title:`${e.manufacturer}: ${e.name}`,value:e.id})))):(r.value=[{title:"No inputs available",value:""}],s.value=[{title:"No outputs available",value:""}]),await(async()=>{const t=await(await e.user.getCourseInterface(e._id)).getCourseSettings();if(t?.midiinput){const e=t.midiinput.toString();r.value.some((t=>t.value===e))&&(a.value=e,l.value=e)}if(t?.midioutput){const e=t.midioutput.toString();s.value.some((t=>t.value===e))&&(o.value=e,h.value=e)}t?.keyboardRange&&(m.value=t.keyboardRange.toString(),d.value=m.value),t?.lowestNote&&(g.value=parseInt(t.lowestNote.toString()),p.value=g.value),t?.highestNote&&(v.value=parseInt(t.highestNote.toString()),f.value=v.value),t?.lowestNote&&t?.highestNote&&!t?.keyboardRange&&(d.value="custom"),u.value=!1})(),!a.value&&r.value.length>0&&(a.value=r.value[0].value),!o.value&&s.value.length>0&&(o.value=s.value[0].value))})),{midiSupported:i,inputs:r,outputs:s,selectedInput:a,selectedOutput:o,updatePending:c,playSound:()=>{t.value?.play([{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.4251968503937008,timestamp:0},{note:{number:64,name:"E",octave:4},velocity:.3779527559055118,type:"noteoff",timestamp:511.90500000002794},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5275590551181102,timestamp:535.8800000001211},{note:{number:60,name:"C",octave:4},velocity:.33858267716535434,type:"noteoff",timestamp:674.9899999999907},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5590551181102362,timestamp:1070.8800000000047},{note:{number:60,name:"C",octave:4},velocity:.3464566929133858,type:"noteoff",timestamp:1214.8999999999069},{note:{number:64,name:"E",octave:4},type:"noteon",velocity:.5118110236220472,timestamp:1424.9400000000605},{note:{number:64,name:"E",octave:4},velocity:.2755905511811024,type:"noteoff",timestamp:1576.9150000000373},{note:{number:62,name:"D",octave:4},type:"noteon",velocity:.3937007874015748,timestamp:1756.9149999999208},{note:{number:62,name:"D",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:1926.9899999998743},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5196850393700787,timestamp:1970.9600000000792},{note:{number:60,name:"C",octave:4},velocity:.36220472440944884,type:"noteoff",timestamp:2126.009999999893},{note:{number:60,name:"C",octave:4},type:"noteon",velocity:.5984251968503937,timestamp:2502.0050000000047},{note:{number:60,name:"C",octave:4},velocity:.3858267716535433,type:"noteoff",timestamp:2853.920000000042},{note:{number:67,name:"G",octave:4},type:"noteon",velocity:.6850393700787402,timestamp:2875.8649999999907},{note:{number:67,name:"G",octave:4},velocity:.6377952755905512,type:"noteoff",timestamp:4497.004999999888}])},saveSettings:async()=>{c.value=!0,(await Q().getUserDB().getCourseInterface(e._id)).updateCourseSettings([{key:"midiinput",value:a.value},{key:"midioutput",value:o.value},{key:"keyboardRange",value:d.value},{key:"lowestNote",value:p.value},{key:"highestNote",value:f.value}]),l.value=a.value,h.value=o.value,m.value=d.value,g.value=p.value,v.value=f.value,u.value=!1,c.value=!1,$({text:"Settings updated.",status:n.ok})},configChanged:u,lowestNote:p,highestNote:f,keyboardRangeOptions:y,selectedKeyboardRange:d,noteOptions:b,updateCustomRangeFromPreset:()=>{switch(d.value){case"full-88":p.value=21,f.value=108;break;case"76-key":p.value=28,f.value=103;break;case"61-key":p.value=36,f.value=96;break;case"49-key":p.value=48,f.value=96;break;case"37-key":p.value=48,f.value=84;break;case"25-key":p.value=60,f.value=84}_()},updateRangeAndCheckChanges:()=>{p.value>=f.value&&(f.value=p.value+12),_()}}}}),Ff={key:0,class:"custom-range-inputs d-flex gap-4"},jf={class:"d-flex justify-space-between mt-3"},Hf={key:1},Gf=he(qf,[["render",function(e,t,i,n,r,s){const a=f("v-toolbar-title"),o=f("v-toolbar"),c=f("v-select"),l=f("v-divider"),h=f("piano-range-visualizer"),u=f("v-btn"),d=f("v-form"),p=f("v-card-text"),v=f("v-card");return g(),P(v,null,{default:A((()=>[w(o,{dense:""},{default:A((()=>[w(a,null,{default:A((()=>t[5]||(t[5]=[_("Configure Midi Device")]))),_:1})])),_:1}),w(p,null,{default:A((()=>[e.midiSupported?(g(),P(d,{key:0,onsubmit:"return false;"},{default:A((()=>[w(c,{modelValue:e.selectedInput,"onUpdate:modelValue":t[0]||(t[0]=t=>e.selectedInput=t),items:e.inputs,label:"Select Input",hint:"Play some notes on your input device to test the connection"},null,8,["modelValue","items"]),w(c,{modelValue:e.selectedOutput,"onUpdate:modelValue":t[1]||(t[1]=t=>e.selectedOutput=t),items:e.outputs,label:"Select Output"},null,8,["modelValue","items"]),w(l,{class:"my-4"}),t[8]||(t[8]=C("h3",{class:"text-subtitle-1 mb-2"},"Keyboard Range",-1)),w(c,{modelValue:e.selectedKeyboardRange,"onUpdate:modelValue":[t[2]||(t[2]=t=>e.selectedKeyboardRange=t),e.updateCustomRangeFromPreset],items:e.keyboardRangeOptions,label:"Select Keyboard Range"},null,8,["modelValue","items","onUpdate:modelValue"]),"custom"===e.selectedKeyboardRange?(g(),m("div",Ff,[w(c,{modelValue:e.lowestNote,"onUpdate:modelValue":[t[3]||(t[3]=t=>e.lowestNote=t),e.updateRangeAndCheckChanges],items:e.noteOptions,label:"Lowest Note"},null,8,["modelValue","items","onUpdate:modelValue"]),w(c,{modelValue:e.highestNote,"onUpdate:modelValue":[t[4]||(t[4]=t=>e.highestNote=t),e.updateRangeAndCheckChanges],items:e.noteOptions,label:"Highest Note"},null,8,["modelValue","items","onUpdate:modelValue"])])):b("",!0),w(h,{"lowest-note":e.lowestNote,"highest-note":e.highestNote},null,8,["lowest-note","highest-note"]),C("div",jf,[w(u,{color:"primary",onClick:e.playSound},{default:A((()=>t[6]||(t[6]=[_("Test midi output")]))),_:1},8,["onClick"]),w(u,{loading:e.updatePending,disabled:!e.configChanged&&!e.updatePending,color:"info",class:"save-button",onClick:e.saveSettings},{default:A((()=>t[7]||(t[7]=[_(" Save these settings ")]))),_:1},8,["loading","disabled","onClick"])])])),_:1})):(g(),m("div",Hf,t[9]||(t[9]=[C("p",null,"This quilt requires a midi input device, which is not supported by this browser.",-1),C("div",null,[C("p",null,"Try one of the following browsers:"),C("ul",null,[C("li",null,[C("a",{href:"https://www.google.com/chrome/"},"Google Chrome")]),C("li",null,[C("a",{href:"https://www.microsoft.com/edge"},"Microsoft Edge")]),C("li",null,[C("a",{href:"https://brave.com/"},"Brave")])])],-1)])))])),_:1})])),_:1})}],["__scopeId","data-v-6ee9020f"]]);class AllCourseWare{constructor(e){t(this,"courseWareList"),t(this,"cachedRawViews",null),this.courseWareList=e}get courses(){return this.courseWareList}getCourseWare(e){return this.courseWareList.find((t=>t.name===e))}allViewsRaw(){if(!this.cachedRawViews){const e=this.allViews();this.cachedRawViews=Object.fromEntries(Object.entries(e).map((([e,t])=>[e,o(t)])))}return this.cachedRawViews}allViews(){const e={};return this.courseWareList.forEach((t=>{Object.assign(e,t.allViewsMap)})),e}getView(e){let t;t="string"==typeof e?c.getViewDescriptor(e):e;const i=this.getCourseWare(t.course);if(i){const e=i.getQuestion(t.questionType);if(e){const n=e.views.find((e=>e.name===t.view));if(n)return n;throw console.error(`QuestionView ${t.view} not found in course ${t.course}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${i.name}\n question: ${e.name}\n views: ${e.views.map((e=>e.name)).join(", ")}\n `),new Error(`view ${t.view} does not exist.`)}throw console.error(`Question ${t.questionType} not found in course ${t.course}\n\n descriptor: ${JSON.stringify(t)}\n\n course: ${i.name}\n questions: ${i.questions.map((e=>e.name)).join(", ")}\n `),new Error(`question ${t.questionType} does not exist.`)}throw console.error(`Course ${t.course} not found.\n\n descriptor: ${JSON.stringify(t)}`),new Error(`course ${t.course} does not exist.`)}toString(){let e="";return this.courses.forEach((t=>{e+=`Course: ${t.name}\n`,t.questions.forEach((t=>{e+=` Question: ${t.name}\n`,t.views.forEach((t=>{e+=` View: ${t.name}\n`}))}))})),e}allDataShapesRaw(){const e=[];return this.courseWareList.forEach((t=>{t.questions.forEach((t=>{t.dataShapes.forEach((t=>{e.includes(t)||e.push(t)}))}))})),e}allDataShapes(){const e=[];return this.courseWareList.forEach((t=>{t.questions.forEach((i=>{i.dataShapes.forEach((n=>{-1===e.findIndex((e=>e.course===t.name&&e.dataShape===n.name))&&e.push({course:t.name,dataShape:n.name,displayable:i})}))}))})),e}getDataShape(e){let t;if(this.getCourseWare(e.course).questions.forEach((i=>{i.dataShapes.forEach((i=>{i.name===e.dataShape&&(t=i)}))})),t)return t;throw new Error(`DataShape ${c.getDataShapeString(e)} not found`)}}const Uf=new AllCourseWare([Qr,Cf,Cn,ye,Ka,no,Qp,dn,gf]);export{AllCourseWare,be as BlanksCard,ee as BlanksCardDataShapes,CourseWare,Z as Displayable,Gf as MidiConfig,l as Question,ga as SkMidi,_a as SyllableSeqVis,SyllableSequence,Uf as allCourseWare,dn as chess,fa as eventsToSyllableSequence,Cn as french,ce as gradeSpellingAttempt,Qr as math,Ka as piano,no as pitch,Qp as sightSing,pa as transposeSyllableSeq,gf as typing,N as useViewable,Cf as wordWork};
3
+ //# sourceMappingURL=index-BHFq3MXV.js.map